@chamn/engine 0.1.1 → 0.2.1

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 (61) 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 +381 -0
  39. package/dist/index.cjs.map +1 -0
  40. package/dist/index.d.ts +5 -5
  41. package/dist/index.js +38460 -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/type.d.ts +0 -1
  55. package/dist/utils/css.d.ts +1 -1
  56. package/dist/utils/defaultEngineConfig.d.ts +7 -7
  57. package/dist/utils/index.d.ts +2 -2
  58. package/dist/utils/logger.d.ts +1 -1
  59. package/package.json +12 -25
  60. package/dist/index.mjs +0 -35957
  61. 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;
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').ConsolaInstance;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@chamn/engine",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
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"
@@ -26,9 +27,7 @@
26
27
  "build:analyze": "cross-env BUILD_TYPE=PKG build-script --build --analyze",
27
28
  "lint": "eslint --ext .tsx,.ts src/",
28
29
  "prettier": "prettier --write ./src",
29
- "test": "jest",
30
- "storybook": "storybook dev -p 6006",
31
- "build-storybook": "storybook build"
30
+ "test": "jest"
32
31
  },
33
32
  "peerDependencies": {
34
33
  "react": ">=16.9.0",
@@ -36,9 +35,9 @@
36
35
  },
37
36
  "dependencies": {
38
37
  "@ant-design/icons": "^5.4.0",
39
- "@chamn/layout": "0.1.1",
40
- "@chamn/model": "0.1.1",
41
- "@chamn/render": "0.1.1",
38
+ "@chamn/layout": "0.2.1",
39
+ "@chamn/model": "0.2.1",
40
+ "@chamn/render": "0.2.1",
42
41
  "@dnd-kit/core": "^6.0.7",
43
42
  "@dnd-kit/modifiers": "^6.0.1",
44
43
  "@dnd-kit/sortable": "^7.0.2",
@@ -47,7 +46,7 @@
47
46
  "ahooks": "^3.7.4",
48
47
  "antd": "^5.8.5",
49
48
  "color": "^4.2.3",
50
- "consola": "^2.15.3",
49
+ "consola": "^3.2.3",
51
50
  "css": "^3.0.0",
52
51
  "i18next": "^22.1.5",
53
52
  "loadjs": "^4.3.0",
@@ -59,19 +58,9 @@
59
58
  },
60
59
  "devDependencies": {
61
60
  "@babel/core": "^7.21.0",
62
- "@chamn/build-script": "0.1.1",
63
- "@chamn/demo-page": "0.1.1",
64
- "@storybook/addon-docs": "^7.4.0",
65
- "@storybook/addon-essentials": "^7.4.0",
66
- "@storybook/addon-interactions": "^7.4.0",
67
- "@storybook/addon-links": "^7.4.0",
68
- "@storybook/addon-onboarding": "^1.0.8",
69
- "@storybook/blocks": "^7.4.0",
70
- "@storybook/react": "^7.4.0",
71
- "@storybook/react-vite": "^7.4.0",
72
- "@storybook/testing-library": "^0.2.0",
61
+ "@chamn/build-script": "0.2.1",
62
+ "@chamn/demo-page": "0.2.1",
73
63
  "@types/color": "^3.0.4",
74
- "@types/consola": "^2.2.5",
75
64
  "@types/css": "^0.0.34",
76
65
  "@types/loadjs": "^4.0.4",
77
66
  "@types/lodash-es": "^4.17.6",
@@ -89,10 +78,8 @@
89
78
  "react-dom": "^18.2.0",
90
79
  "react-i18next": "^12.1.1",
91
80
  "react-router-dom": "^6.7.0",
92
- "rollup-plugin-visualizer": "^5.8.3",
93
- "sass": "^1.54.0",
94
- "storybook": "^7.4.0"
81
+ "sass": "^1.54.0"
95
82
  },
96
83
  "config": {},
97
- "gitHead": "043d4a88d4c0e05669831338ec2a10498457000d"
84
+ "gitHead": "eb4e01d3b4c7c1ca1af81127782cb413a3bc7aa8"
98
85
  }