@chamn/engine 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/_dev_/index.d.ts +1 -0
  2. package/dist/_dev_/lib/index.d.ts +1 -0
  3. package/dist/_dev_/page/Editor/index.d.ts +1 -0
  4. package/dist/_dev_/page/Preview/index.d.ts +1 -0
  5. package/dist/_dev_/render.d.ts +1 -0
  6. package/dist/_dev_/router.d.ts +1 -0
  7. package/dist/component/CSSEditor/index.d.ts +1 -1
  8. package/dist/component/CSSPropertiesEditor/index.d.ts +1 -2
  9. package/dist/component/CSSPropertiesEditor/signleProperty.d.ts +1 -2
  10. package/dist/component/CSSPropertiesEditor/util.d.ts +1 -0
  11. package/dist/component/CSSPropertiesVariableBindEditor/SingleProperty.d.ts +1 -2
  12. package/dist/component/CSSPropertiesVariableBindEditor/index.d.ts +1 -2
  13. package/dist/component/CSSPropertiesVariableBindEditor/util.d.ts +1 -0
  14. package/dist/component/CSSSizeInput/index.d.ts +7 -7
  15. package/dist/component/CSSUIPanel/BackgroundInput/index.d.ts +1 -2
  16. package/dist/component/CSSUIPanel/BorderInput/index.d.ts +1 -2
  17. package/dist/component/CSSUIPanel/DimensionInput/index.d.ts +1 -2
  18. package/dist/component/CSSUIPanel/FontInput/index.d.ts +1 -2
  19. package/dist/component/CSSUIPanel/MarginAndPaddingInput/index.d.ts +1 -2
  20. package/dist/component/CSSUIPanel/ShadowInput/index.d.ts +1 -2
  21. package/dist/component/CSSUIPanel/index.d.ts +1 -2
  22. package/dist/component/ClassNameEditor/index.d.ts +1 -1
  23. package/dist/component/CustomColorPicker/index.d.ts +2 -3
  24. package/dist/component/CustomSchemaForm/components/Form/Field/index.d.ts +1 -1
  25. package/dist/component/CustomSchemaForm/components/Form/context.d.ts +1 -1
  26. package/dist/component/CustomSchemaForm/components/Form/index.d.ts +5 -3
  27. package/dist/component/CustomSchemaForm/components/SetterSwitcher/index.d.ts +1 -1
  28. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.d.ts +1 -1
  29. package/dist/component/CustomSchemaForm/components/Setters/CSSSizeSetter/index.d.ts +1 -1
  30. package/dist/component/CustomSchemaForm/components/Setters/FunctionSetter/defaultDts.d.ts +78 -0
  31. package/dist/component/CustomSchemaForm/components/Setters/type.d.ts +0 -1
  32. package/dist/component/CustomSchemaForm/context.d.ts +1 -1
  33. package/dist/component/CustomSchemaForm/index.d.ts +1 -1
  34. package/dist/component/CustomSchemaForm/utils.d.ts +2 -2
  35. package/dist/component/Workbench/index.d.ts +2 -2
  36. package/dist/core/pluginManager.d.ts +1 -1
  37. package/dist/i18n/index.d.ts +1 -1
  38. package/dist/index.cjs +383 -0
  39. package/dist/index.cjs.map +1 -0
  40. package/dist/index.d.ts +5 -5
  41. package/dist/index.js +38342 -237
  42. package/dist/index.js.map +1 -1
  43. package/dist/material/innerMaterial.d.ts +37 -2
  44. package/dist/plugins/ComponentLibrary/components/DragItem/index.d.ts +1 -1
  45. package/dist/plugins/Designer/components/Canvas/advanceCustomHook.d.ts +12 -13
  46. package/dist/plugins/Designer/components/Canvas/index.d.ts +3 -4
  47. package/dist/plugins/Designer/type.d.ts +0 -1
  48. package/dist/plugins/DisplaySourceSchema/index.d.ts +1 -1
  49. package/dist/plugins/OutlineTree/components/TreeView/context.d.ts +2 -2
  50. package/dist/plugins/OutlineTree/components/TreeView/dataStruct.d.ts +1 -1
  51. package/dist/plugins/OutlineTree/components/TreeView/index.d.ts +2 -2
  52. package/dist/plugins/PropertyPanel/utils.d.ts +2 -0
  53. package/dist/plugins/RightPanel/view.d.ts +1 -1
  54. package/dist/stories/components/inputPlus.stories.d.ts +5 -0
  55. package/dist/stories/plugins/CSSEditor.stories.d.ts +5 -0
  56. package/dist/stories/plugins/VisualPanelPlus.stories.d.ts +5 -0
  57. package/dist/stories/setters/colorSetter.stories.d.ts +5 -0
  58. package/dist/type.d.ts +0 -1
  59. package/dist/utils/css.d.ts +1 -1
  60. package/dist/utils/defaultEngineConfig.d.ts +7 -7
  61. package/dist/utils/index.d.ts +2 -2
  62. package/dist/utils/logger.d.ts +1 -1
  63. package/package.json +9 -8
  64. package/dist/index.mjs +0 -35957
  65. package/dist/index.mjs.map +0 -1
@@ -1,2 +1,37 @@
1
- import { CMaterialType } from '@chamn/model';
2
- export declare const InnerComponentMeta: CMaterialType[];
1
+ import { CMaterialPropsType, CMaterialType } from '@chamn/model';
2
+ export declare const InnerComponentMeta: (CMaterialType | {
3
+ npm: {
4
+ name: string;
5
+ package: string;
6
+ version: string;
7
+ };
8
+ componentName: string;
9
+ title: string;
10
+ screenshot?: string;
11
+ icon?: string;
12
+ tags?: string[];
13
+ groupName?: string;
14
+ category?: string;
15
+ priority?: number;
16
+ snippets: import('@chamn/model').SnippetsType[];
17
+ props: CMaterialPropsType<"">;
18
+ fixedProps?: Record<string, any> | ((props: Record<string, any>) => Record<string, any>);
19
+ isContainer?: boolean | import('@chamn/model').ContainerConfig;
20
+ rootSelector?: string;
21
+ disableEditorDragDom?: {
22
+ class?: string[];
23
+ id?: string[];
24
+ } | boolean;
25
+ actions?: {
26
+ title: string;
27
+ name: string;
28
+ params?: {
29
+ name: string;
30
+ description: string;
31
+ }[];
32
+ template?: string;
33
+ }[];
34
+ events?: import('@chamn/model').CMaterialEventType[];
35
+ advanceCustom?: import('@chamn/model').AdvanceCustom;
36
+ extra?: Record<any, any>;
37
+ })[];
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  export type DragComponentItemProps = {
3
3
  id: string;
4
4
  name: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CPluginCtx } from '../../../../core/pluginManager';
3
2
  import { Layout, LayoutDragAndDropExtraDataType, LayoutDragEvent } from '../../../../index';
4
3
  import { AdvanceCustom, CNode, CRootNode } from '@chamn/model';
@@ -23,24 +22,24 @@ export declare class AdvanceCustomHook {
23
22
  canDrag({ dragNode, eventObj }: HookParameter): ReturnType<Required<AdvanceCustom>['canDragNode']>;
24
23
  canDrop({ dragNode, dropNode, eventObj }: HookParameter): ReturnType<Required<AdvanceCustom>['canDropNode']>;
25
24
  onNewAdd({ dragNode, dropNode, eventObj }: HookParameter): ReturnType<Required<AdvanceCustom>['onNewAdd']>;
26
- getSelectRectViewRender(node: CNode | CRootNode): ((props: import("@chamn/model").CustomViewRenderProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | undefined;
27
- getHoverRectViewRender(node?: CNode | CRootNode | null): ((props: import("@chamn/model").CustomViewRenderProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | null | undefined;
28
- getDropViewRender(node?: CNode | CRootNode | null): ((props: import("@chamn/model").CustomViewRenderProps & {
25
+ getSelectRectViewRender(node: CNode | CRootNode): ((props: import('@chamn/model').CustomViewRenderProps) => React.ReactElement) | undefined;
26
+ getHoverRectViewRender(node?: CNode | CRootNode | null): ((props: import('@chamn/model').CustomViewRenderProps) => React.ReactElement) | null | undefined;
27
+ getDropViewRender(node?: CNode | CRootNode | null): ((props: import('@chamn/model').CustomViewRenderProps & {
29
28
  canDrop: boolean;
30
- posInfo: import("@chamn/model").DropPosType;
31
- }) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | null | undefined;
32
- getGhostViewRender(node?: CNode | CRootNode | null): ((props: import("@chamn/model").CustomViewRenderProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | null | undefined;
29
+ posInfo: import('@chamn/model').DropPosType;
30
+ }) => React.ReactElement) | null | undefined;
31
+ getGhostViewRender(node?: CNode | CRootNode | null): ((props: import('@chamn/model').CustomViewRenderProps) => React.ReactElement) | null | undefined;
33
32
  getToolbarViewRender(node?: CNode | CRootNode | null): ((props: {
34
33
  node: CNode | CRootNode;
35
34
  context: any;
36
35
  toolBarItems: {
37
- copyItem: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
38
- deleteItem: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
39
- visibleItem: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
40
- nodeLayout: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
36
+ copyItem: React.ReactElement;
37
+ deleteItem: React.ReactElement;
38
+ visibleItem: React.ReactElement;
39
+ nodeLayout: React.ReactElement;
41
40
  };
42
- toolBarItemList: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[];
43
- }) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | null | undefined;
41
+ toolBarItemList: React.ReactElement[];
42
+ }) => React.ReactElement) | null | undefined;
44
43
  onCopy(node: CNode | CRootNode): Promise<false | CNode | CRootNode>;
45
44
  onDelete(node: CNode | CRootNode): Promise<false | CNode | CRootNode>;
46
45
  }
@@ -1,10 +1,9 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  import { Layout, LayoutPropsType } from '@chamn/layout';
3
- import { AdvanceCustom, CNode, CPage, CRootNode } from '@chamn/model';
3
+ import { AdvanceCustom, CNode, CPage, CRootNode, AdvanceCustomFuncParam } from '@chamn/model';
4
4
  import { CPluginCtx } from '../../../../core/pluginManager';
5
5
  import { AdvanceCustomHook } from './advanceCustomHook';
6
6
  import { DesignerPluginConfig } from '../../type';
7
- import { AdvanceCustomFuncParam } from '@chamn/model';
8
7
  export type DesignerCtx = CPluginCtx<DesignerPluginConfig>;
9
8
  export type DesignerPropsType = {
10
9
  pluginCtx: DesignerCtx;
@@ -36,7 +35,7 @@ export declare class Designer extends React.Component<DesignerPropsType, Designe
36
35
  */
37
36
  updateRenderComponents(newComponentMap?: Record<string, any>): Promise<void>;
38
37
  componentDidMount(): void;
39
- getIframeDom(): import("@chamn/layout").IFrameContainer | undefined;
38
+ getIframeDom(): import('@chamn/layout').IFrameContainer | undefined;
40
39
  reloadRender(): void;
41
40
  init(): Promise<void>;
42
41
  onNodeDragging: LayoutPropsType['onNodeDragging'];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CPlugin, PluginInstance } from '../../core/pluginManager';
3
2
  import { DragAndDrop, IFrameContainer, Layout, LayoutPropsType } from '@chamn/layout';
4
3
  import { AdvanceCustom, AssetPackage, CPageDataType } from '@chamn/model';
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  import { CPage } from '@chamn/model';
3
3
  import { EnginContext } from '../../type';
4
4
  export type DisplaySourceSchemaProps = {
@@ -1,8 +1,8 @@
1
1
  import { Sensor } from '@chamn/layout';
2
2
  import { CPage } from '@chamn/model';
3
- import React from 'react';
3
+ import { default as React } from 'react';
4
4
  import { TreeNodeData } from './dataStruct';
5
- import { DesignerExport } from '../../../../plugins/Designer/type';
5
+ import { DesignerExport } from '../../../Designer/type';
6
6
  export declare enum DragState {
7
7
  DRAGGING = "DRAGGING",
8
8
  NORMAL = "NORMAL"
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  export type TreeNodeData = {
3
3
  containerRender?: (params: {
4
4
  item: TreeNodeData;
@@ -1,6 +1,6 @@
1
1
  import { Sensor } from '@chamn/layout';
2
2
  import { CNode, CRootNode } from '@chamn/model';
3
- import React from 'react';
3
+ import { default as React } from 'react';
4
4
  import { WithTranslation } from 'react-i18next';
5
5
  import { CPluginCtx } from '../../../../core/pluginManager';
6
6
  import { ContextState } from './context';
@@ -19,7 +19,7 @@ export declare class TreeView extends React.Component<TreeViewProps, ContextStat
19
19
  disposeCbList: (() => void)[];
20
20
  sensor?: Sensor;
21
21
  constructor(props: TreeViewProps);
22
- getDesignerHandler: () => Promise<import('../../../../plugins/Designer/type').DesignerExport>;
22
+ getDesignerHandler: () => Promise<import('../../../Designer/type').DesignerExport>;
23
23
  updateTreeDataFromNode: () => void;
24
24
  getParentKeyPaths: (targetKey: string) => string[];
25
25
  scrollNodeToView: (key: string) => void;
@@ -0,0 +1,2 @@
1
+ import { SetterObjType, SetterType } from '@chamn/model';
2
+ export declare const getSetterList: (setters?: SetterType[]) => SetterObjType[];
@@ -1,5 +1,5 @@
1
1
  import { CNode, CRootNode } from '@chamn/model';
2
- import React from 'react';
2
+ import { default as React } from 'react';
3
3
  import { CPluginCtx } from '../../core/pluginManager';
4
4
  export type RightPanelOptions = {
5
5
  node: CNode | CRootNode | null;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const TargetComponent: (props: import('../../component/CSSSizeInput').CSSSizeInputProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const _default: Meta<typeof TargetComponent>;
4
+ export default _default;
5
+ export declare const Default: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { VisualPanelPlus } from '../../plugins/VisualPanelPlus';
3
+ declare const _default: Meta<typeof VisualPanelPlus>;
4
+ export default _default;
5
+ export declare const Default: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { ComponentMeta } from '@storybook/react';
2
+ import { VisualPanelPlus } from '../../plugins/VisualPanelPlus';
3
+ declare const _default: ComponentMeta<typeof VisualPanelPlus>;
4
+ export default _default;
5
+ export declare const Default: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const TargetComponent: import('../..').CSetter;
3
+ declare const _default: Meta<typeof TargetComponent>;
4
+ export default _default;
5
+ export declare const Default: () => import("react/jsx-runtime").JSX.Element;
package/dist/type.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CPageDataType, CMaterialType, AssetPackage } from '@chamn/model';
3
2
  import { Engine } from '.';
4
3
  import { PluginManager, CPlugin } from './core/pluginManager';
@@ -7,7 +7,7 @@ export type StyleArr = {
7
7
  export declare const styleArr2Obj: (val: StyleArr) => Record<string, any>;
8
8
  export declare const styleObjToArr: (obj?: Record<string, any>) => StyleArr;
9
9
  export declare const styleList2Text: (val: StyleArr) => string;
10
- export declare const formatStyleProperty: (styleList?: CNodeModelDataType['style']) => {
10
+ export declare const formatStyleProperty: (styleList?: CNodeModelDataType["style"]) => {
11
11
  normalProperty: {
12
12
  property: string;
13
13
  value: string;
@@ -3,11 +3,11 @@ import { LayoutPropsType } from '@chamn/layout';
3
3
  export declare const beforeInitRender: LayoutPropsType['beforeInitRender'];
4
4
  /** 默认使用 react 18 模式渲染 */
5
5
  export declare const getDefaultRender: (components: Record<string, any>) => (options: {
6
- iframe: import("@chamn/layout").IFrameContainer;
7
- pageModel?: import("@chamn/model").CPage | undefined;
8
- page?: import("@chamn/model").CPageDataType | undefined;
9
- assets: import("@chamn/model").AssetPackage[];
10
- renderJSUrl?: string | undefined;
11
- beforeInitRender?: (() => void) | undefined;
12
- ready: (designRender: import("@chamn/render").DesignRender) => void;
6
+ iframe: import('@chamn/layout').IFrameContainer;
7
+ pageModel?: import('@chamn/model').CPage;
8
+ page?: import('@chamn/model').CPageDataType;
9
+ assets: import('@chamn/model').AssetPackage[];
10
+ renderJSUrl?: string;
11
+ beforeInitRender?: () => void;
12
+ ready: (designRender: import('@chamn/render').DesignRender) => void;
13
13
  }) => void;
@@ -4,8 +4,8 @@
4
4
  * @returns
5
5
  */
6
6
  export declare const waitReactUpdate: ({ time, cb, }?: {
7
- time?: number | undefined;
8
- cb?: ((...args: any[]) => void) | undefined;
7
+ time?: number;
8
+ cb?: (...args: any[]) => void;
9
9
  }) => Promise<unknown>;
10
10
  export * from './css';
11
11
  export * from './defaultEngineConfig';
@@ -1 +1 @@
1
- export declare const LOGGER: import("consola").Consola;
1
+ export declare const LOGGER: import('consola').Consola;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@chamn/engine",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
+ "type": "module",
4
5
  "files": [
5
6
  "dist"
6
7
  ],
7
8
  "main": "dist/index.js",
8
- "module": "dist/index.mjs",
9
+ "module": "dist/index.js",
9
10
  "types": "dist/index.d.ts",
10
11
  "publishConfig": {
11
12
  "access": "public"
@@ -36,9 +37,9 @@
36
37
  },
37
38
  "dependencies": {
38
39
  "@ant-design/icons": "^5.4.0",
39
- "@chamn/layout": "0.1.0",
40
- "@chamn/model": "0.1.0",
41
- "@chamn/render": "0.1.0",
40
+ "@chamn/layout": "0.2.0",
41
+ "@chamn/model": "0.2.0",
42
+ "@chamn/render": "0.2.0",
42
43
  "@dnd-kit/core": "^6.0.7",
43
44
  "@dnd-kit/modifiers": "^6.0.1",
44
45
  "@dnd-kit/sortable": "^7.0.2",
@@ -59,8 +60,8 @@
59
60
  },
60
61
  "devDependencies": {
61
62
  "@babel/core": "^7.21.0",
62
- "@chamn/build-script": "0.1.0",
63
- "@chamn/demo-page": "0.1.0",
63
+ "@chamn/build-script": "0.2.0",
64
+ "@chamn/demo-page": "0.2.0",
64
65
  "@storybook/addon-docs": "^7.4.0",
65
66
  "@storybook/addon-essentials": "^7.4.0",
66
67
  "@storybook/addon-interactions": "^7.4.0",
@@ -94,5 +95,5 @@
94
95
  "storybook": "^7.4.0"
95
96
  },
96
97
  "config": {},
97
- "gitHead": "cefa3f0a4a9c72c81b5337bbdb6e0429ca247252"
98
+ "gitHead": "0803de3f04dcebe415446700f2e3e7ec73a0fb6e"
98
99
  }