This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make getObject utility reusabble
- Loading branch information
Showing
7 changed files
with
134 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './model-tree'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as Model from '../model'; | ||
import * as Types from '../types'; | ||
|
||
export function getModelByName(modelName?: Types.ModelName): Types.ModelSurface | undefined { | ||
switch (modelName) { | ||
case Types.ModelName.AlvaApp: | ||
return Model.AlvaApp; | ||
case Types.ModelName.Element: | ||
return Model.Element; | ||
case Types.ModelName.ElementAction: | ||
return Model.ElementAction; | ||
case Types.ModelName.ElementContent: | ||
return Model.ElementContent; | ||
case Types.ModelName.ElementProperty: | ||
return Model.ElementProperty; | ||
case Types.ModelName.Page: | ||
return Model.Page; | ||
case Types.ModelName.Pattern: | ||
return Model.Pattern; | ||
case Types.ModelName.PatternLibrary: | ||
return Model.PatternLibrary; | ||
case Types.ModelName.PatternProperty: | ||
return Model.PatternProperty; | ||
case Types.ModelName.PatternSlot: | ||
return Model.PatternSlot; | ||
case Types.ModelName.UserStore: | ||
return Model.UserStore; | ||
case Types.ModelName.UserStoreAction: | ||
return Model.UserStoreAction; | ||
case Types.ModelName.UserStoreEnhancer: | ||
return Model.UserStoreEnhancer; | ||
case Types.ModelName.UserStoreProperty: | ||
return Model.UserStoreProperty; | ||
case Types.ModelName.UserStoreReference: | ||
return Model.UserStoreReference; | ||
default: | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { AlvaApp } from './alva-app'; | ||
import { Element, ElementContent, ElementProperty } from './element'; | ||
import { ElementAction } from './element-action'; | ||
import { Page } from './page'; | ||
import { PatternLibrary } from './pattern-library'; | ||
import { Project } from './project'; | ||
import { AnyPatternProperty } from './pattern-property'; | ||
import { Pattern } from './pattern'; | ||
import { UserStore } from './user-store'; | ||
import { UserStoreAction } from './user-store-action'; | ||
import { UserStoreEnhancer } from './user-store-enhancer'; | ||
import { UserStoreProperty } from './user-store-property'; | ||
import { UserStoreReference } from './user-store-reference'; | ||
|
||
export type AnyModel = | ||
| AlvaApp | ||
| AnyPatternProperty | ||
| Element | ||
| ElementContent | ||
| ElementAction | ||
| ElementProperty | ||
| Page | ||
| Pattern | ||
| PatternLibrary | ||
| Project | ||
| UserStore | ||
| UserStoreAction | ||
| UserStoreEnhancer | ||
| UserStoreProperty | ||
| UserStoreReference; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters