@chamn/engine 0.0.41 → 0.0.43

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 (105) hide show
  1. package/dist/component/CSSEditor/index.d.ts +16 -0
  2. package/dist/component/CSSPropertiesEditor/cssProperties.d.ts +898 -0
  3. package/dist/component/CSSPropertiesEditor/index.d.ts +21 -0
  4. package/dist/component/CSSPropertiesEditor/signleProperty.d.ts +25 -0
  5. package/dist/component/CSSPropertiesVariableBindEditor/SingleProperty.d.ts +24 -0
  6. package/dist/component/CSSPropertiesVariableBindEditor/cssProperties.d.ts +898 -0
  7. package/dist/component/CSSPropertiesVariableBindEditor/index.d.ts +19 -0
  8. package/dist/component/CSSSizeInput/index.d.ts +39 -0
  9. package/dist/component/CSSUIPanel/BackgroundInput/index.d.ts +10 -0
  10. package/dist/component/CSSUIPanel/BorderInput/index.d.ts +10 -0
  11. package/dist/component/CSSUIPanel/DimensionInput/index.d.ts +11 -0
  12. package/dist/component/CSSUIPanel/FontInput/index.d.ts +10 -0
  13. package/dist/component/CSSUIPanel/MarginAndPaddingInput/index.d.ts +11 -0
  14. package/dist/component/CSSUIPanel/ShadowInput/index.d.ts +10 -0
  15. package/dist/component/CSSUIPanel/index.d.ts +9 -0
  16. package/dist/component/CSSUIPanel/type.d.ts +3 -0
  17. package/dist/component/ClassNameEditor/index.d.ts +10 -0
  18. package/dist/component/CustomSchemaForm/components/Form/Field/index.d.ts +12 -0
  19. package/dist/component/CustomSchemaForm/components/Form/context.d.ts +12 -0
  20. package/dist/component/CustomSchemaForm/components/Form/index.d.ts +19 -0
  21. package/dist/component/CustomSchemaForm/components/SetterSwitcher/index.d.ts +14 -0
  22. package/dist/component/CustomSchemaForm/components/Setters/AntDColorSetter/index.d.ts +2 -0
  23. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.d.ts +11 -0
  24. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/SortItemOrderModal.d.ts +10 -0
  25. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/index.d.ts +14 -0
  26. package/dist/component/CustomSchemaForm/components/Setters/BooleanSetter/index.d.ts +7 -0
  27. package/dist/component/CustomSchemaForm/components/Setters/CSSSizeSetter/index.d.ts +3 -0
  28. package/dist/component/CustomSchemaForm/components/Setters/CSSValueSetter/index.d.ts +6 -0
  29. package/dist/component/CustomSchemaForm/components/Setters/ColorSetter/index.d.ts +2 -0
  30. package/dist/component/CustomSchemaForm/components/Setters/ExpressionSetter/index.d.ts +10 -0
  31. package/dist/component/CustomSchemaForm/components/Setters/FunctionSetter/index.d.ts +2 -0
  32. package/dist/component/CustomSchemaForm/components/Setters/JSONSetter/index.d.ts +2 -0
  33. package/dist/component/CustomSchemaForm/components/Setters/NumberSetter/index.d.ts +3 -0
  34. package/dist/component/CustomSchemaForm/components/Setters/RadioGroupSetter/index.d.ts +2 -0
  35. package/dist/component/CustomSchemaForm/components/Setters/SelectSetter/index.d.ts +3 -0
  36. package/dist/component/CustomSchemaForm/components/Setters/ShapeSetter/index.d.ts +8 -0
  37. package/dist/component/CustomSchemaForm/components/Setters/SliderSetter/index.d.ts +3 -0
  38. package/dist/component/CustomSchemaForm/components/Setters/StringSetter/index.d.ts +3 -0
  39. package/dist/component/CustomSchemaForm/components/Setters/TextAreaSetter/index.d.ts +3 -0
  40. package/dist/component/CustomSchemaForm/components/Setters/index.d.ts +4 -0
  41. package/dist/component/CustomSchemaForm/components/Setters/type.d.ts +20 -0
  42. package/dist/component/CustomSchemaForm/context.d.ts +15 -0
  43. package/dist/component/CustomSchemaForm/index.d.ts +22 -0
  44. package/dist/component/CustomSchemaForm/utils.d.ts +2 -0
  45. package/dist/component/InputNumberPlus/index.d.ts +9 -0
  46. package/dist/component/MonacoEditor/index.d.ts +14 -0
  47. package/dist/component/Workbench/index.d.ts +72 -0
  48. package/dist/config/colorPickerColorList.d.ts +4 -0
  49. package/dist/core/assetPackagesListManage.d.ts +8 -0
  50. package/dist/core/pluginManager.d.ts +63 -0
  51. package/dist/i18n/en_US/index.d.ts +5 -0
  52. package/dist/i18n/index.d.ts +6 -0
  53. package/dist/i18n/zh_CN/index.d.ts +5 -0
  54. package/dist/index.d.ts +57 -0
  55. package/dist/index.js +2 -2
  56. package/dist/index.js.map +1 -1
  57. package/dist/index.mjs +3 -2
  58. package/dist/index.mjs.map +1 -1
  59. package/dist/material/innerMaterial.d.ts +2 -0
  60. package/dist/plugins/AdvancePanel/index.d.ts +10 -0
  61. package/dist/plugins/ComponentLibrary/components/DragItem/index.d.ts +12 -0
  62. package/dist/plugins/ComponentLibrary/components/ListView/index.d.ts +9 -0
  63. package/dist/plugins/ComponentLibrary/index.d.ts +3 -0
  64. package/dist/plugins/ComponentLibrary/localize/en_US/index.d.ts +1 -0
  65. package/dist/plugins/ComponentLibrary/localize/index.d.ts +2 -0
  66. package/dist/plugins/ComponentLibrary/localize/zh_CN/index.d.ts +1 -0
  67. package/dist/plugins/ComponentLibrary/util.d.ts +1 -0
  68. package/dist/plugins/ComponentStatePanel/index.d.ts +10 -0
  69. package/dist/plugins/Designer/components/Canvas/advanceCustomHook.d.ts +45 -0
  70. package/dist/plugins/Designer/components/Canvas/index.d.ts +63 -0
  71. package/dist/plugins/Designer/components/DefaultSelectToolBar/index.d.ts +16 -0
  72. package/dist/plugins/Designer/components/GhostView/index.d.ts +5 -0
  73. package/dist/plugins/Designer/config.d.ts +1 -0
  74. package/dist/plugins/Designer/index.d.ts +2 -0
  75. package/dist/plugins/Designer/localize/en_US/index.d.ts +1 -0
  76. package/dist/plugins/Designer/localize/index.d.ts +2 -0
  77. package/dist/plugins/Designer/localize/zh_CN/index.d.ts +1 -0
  78. package/dist/plugins/Designer/type.d.ts +26 -0
  79. package/dist/plugins/Designer/util.d.ts +2 -0
  80. package/dist/plugins/DisplaySourceSchema/index.d.ts +9 -0
  81. package/dist/plugins/GlobalStatePanel/index.d.ts +3 -0
  82. package/dist/plugins/GlobalStatePanel/localize/en_US/index.d.ts +1 -0
  83. package/dist/plugins/GlobalStatePanel/localize/index.d.ts +2 -0
  84. package/dist/plugins/GlobalStatePanel/localize/zh_CN/index.d.ts +1 -0
  85. package/dist/plugins/History/index.d.ts +2 -0
  86. package/dist/plugins/History/type.d.ts +12 -0
  87. package/dist/plugins/OutlineTree/components/TreeView/context.d.ts +30 -0
  88. package/dist/plugins/OutlineTree/components/TreeView/dataStruct.d.ts +21 -0
  89. package/dist/plugins/OutlineTree/components/TreeView/index.d.ts +33 -0
  90. package/dist/plugins/OutlineTree/components/TreeView/treeNode.d.ts +11 -0
  91. package/dist/plugins/OutlineTree/index.d.ts +3 -0
  92. package/dist/plugins/OutlineTree/localize/en_US/index.d.ts +1 -0
  93. package/dist/plugins/OutlineTree/localize/index.d.ts +2 -0
  94. package/dist/plugins/OutlineTree/localize/zh_CN/index.d.ts +1 -0
  95. package/dist/plugins/OutlineTree/util.d.ts +14 -0
  96. package/dist/plugins/PropertyPanel/index.d.ts +9 -0
  97. package/dist/plugins/RightPanel/index.d.ts +2 -0
  98. package/dist/plugins/RightPanel/view.d.ts +39 -0
  99. package/dist/plugins/VisualPanelPlus/index.d.ts +4 -0
  100. package/dist/plugins/index.d.ts +9 -0
  101. package/dist/utils/css.d.ts +40 -0
  102. package/dist/utils/defaultEngineConfig.d.ts +13 -0
  103. package/dist/utils/index.d.ts +12 -0
  104. package/dist/utils/logger.d.ts +1 -0
  105. package/package.json +7 -7
@@ -0,0 +1,2 @@
1
+ import { CMaterialType } from '@chamn/model';
2
+ export declare const InnerComponentMeta: CMaterialType<"">[];
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { CNode, CRootNode } from '@chamn/model';
3
+ import { CPluginCtx } from '../../core/pluginManager';
4
+ import { CRightPanelItem } from '../RightPanel/view';
5
+ export type AdvancePanelProps = {
6
+ node: CNode | CRootNode | null;
7
+ pluginCtx: CPluginCtx;
8
+ };
9
+ export declare const AdvancePanel: (props: AdvancePanelProps) => JSX.Element;
10
+ export declare const AdvancePanelConfig: CRightPanelItem;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export type DragComponentItemProps = {
3
+ id: string;
4
+ name: string;
5
+ description?: any;
6
+ icon: React.ReactNode | string;
7
+ iconText?: string;
8
+ style?: React.CSSProperties;
9
+ containerClassName?: string;
10
+ };
11
+ export declare const DragComponentItem: (props: DragComponentItemProps) => JSX.Element;
12
+ export declare const DRAG_ITEM_KEY = "data-drag-key";
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { SnippetsType } from '@chamn/model';
3
+ export type ListViewProps = {
4
+ dataSource: {
5
+ name: string;
6
+ list: SnippetsType[];
7
+ }[];
8
+ };
9
+ export declare const ListView: (props: ListViewProps) => JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ import { CPlugin } from '../../core/pluginManager';
2
+ export declare const PLUGIN_NAME = "ComponentLib";
3
+ export declare const ComponentLibPlugin: CPlugin;
@@ -0,0 +1 @@
1
+ export declare const en_US: Record<string, any>;
@@ -0,0 +1,2 @@
1
+ declare const _default: Record<string, any>;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const zh_CN: Record<string, any>;
@@ -0,0 +1 @@
1
+ export declare const getTargetMNodeKeyVal: (dom: HTMLElement | null, key: string) => null | string;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { CNode, CRootNode } from '@chamn/model';
3
+ import { CPluginCtx } from '../../core/pluginManager';
4
+ import { CRightPanelItem } from '../RightPanel/view';
5
+ export type ComponentStatePanelProps = {
6
+ node: CNode | CRootNode | null;
7
+ pluginCtx: CPluginCtx;
8
+ };
9
+ export declare const ComponentStatePanel: (props: ComponentStatePanelProps) => JSX.Element;
10
+ export declare const ComponentStatePanelConfig: CRightPanelItem;
@@ -0,0 +1,45 @@
1
+ /// <reference types="react" />
2
+ import { CPluginCtx } from '../../../../core/pluginManager';
3
+ import { Layout, LayoutDragAndDropExtraDataType, LayoutDragEvent } from '../../../../index';
4
+ import { AdvanceCustom, CNode, CRootNode } from '@chamn/model';
5
+ export interface AdvanceCustomHookOptions {
6
+ getPortalViewCtx: () => {
7
+ setView: (view: React.ReactNode) => void;
8
+ clearView: () => void;
9
+ };
10
+ ctx: CPluginCtx;
11
+ layoutRef: React.RefObject<Layout>;
12
+ }
13
+ export type HookParameter = {
14
+ dragNode?: CNode | CRootNode;
15
+ dropNode?: CNode | CRootNode;
16
+ eventObj: LayoutDragEvent<LayoutDragAndDropExtraDataType>;
17
+ };
18
+ export declare class AdvanceCustomHook {
19
+ getPortalViewCtx: AdvanceCustomHookOptions['getPortalViewCtx'];
20
+ ctx: CPluginCtx;
21
+ layoutRef: AdvanceCustomHookOptions['layoutRef'];
22
+ constructor(options: AdvanceCustomHookOptions);
23
+ canDrag({ dragNode, eventObj }: HookParameter): ReturnType<Required<AdvanceCustom>['canDragNode']>;
24
+ canDrop({ dragNode, dropNode, eventObj }: HookParameter): ReturnType<Required<AdvanceCustom>['canDropNode']>;
25
+ 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 & {
29
+ 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;
33
+ getToolbarViewRender(node?: CNode | CRootNode | null): ((props: {
34
+ node: CNode | CRootNode;
35
+ context: any;
36
+ 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>>;
41
+ };
42
+ }) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | null | undefined;
43
+ onCopy(node: CNode | CRootNode): Promise<false | CNode | CRootNode>;
44
+ onDelete(node: CNode | CRootNode): Promise<false | CNode | CRootNode>;
45
+ }
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { Layout, LayoutPropsType } from '@chamn/layout';
3
+ import { AdvanceCustom, CNode, CPage, CRootNode } from '@chamn/model';
4
+ import { AssetPackage } from '@chamn/model';
5
+ import { CPluginCtx } from '../../../../core/pluginManager';
6
+ import { AdvanceCustomHook } from './advanceCustomHook';
7
+ import { DesignerPluginConfig } from '../../type';
8
+ import { AdvanceCustomFuncParam } from '@chamn/model';
9
+ export type DesignerCtx = CPluginCtx<DesignerPluginConfig>;
10
+ export type DesignerPropsType = {
11
+ pluginCtx: DesignerCtx;
12
+ };
13
+ export type WrapComponentOptionsType = {
14
+ ctx: DesignerCtx;
15
+ node: CNode | CRootNode;
16
+ };
17
+ type DesignerStateType = {
18
+ pageModel: CPage;
19
+ hoverToolbarView: React.ReactNode;
20
+ selectToolbarView: React.ReactNode;
21
+ selectRectViewRender: AdvanceCustom['selectRectViewRender'] | null;
22
+ hoverRectViewRender: AdvanceCustom['hoverRectViewRender'] | null;
23
+ dropViewRender: AdvanceCustom['dropViewRender'] | null;
24
+ ghostView: React.ReactNode;
25
+ portalView: React.ReactNode;
26
+ };
27
+ export declare class Designer extends React.Component<DesignerPropsType, DesignerStateType> {
28
+ layoutRef: React.RefObject<Layout>;
29
+ customAdvanceHook: AdvanceCustomHook;
30
+ constructor(props: DesignerPropsType);
31
+ getPortalViewCtx: () => {
32
+ setView: (view: React.ReactNode) => void;
33
+ clearView: () => void;
34
+ };
35
+ /**
36
+ * 更新 render 中的 components ;
37
+ */
38
+ updateRenderComponents(newComponentMap?: Record<string, any>): Promise<void>;
39
+ componentDidMount(): void;
40
+ reloadRender({ assets }: {
41
+ assets?: AssetPackage[];
42
+ }): void;
43
+ init(): Promise<void>;
44
+ onNodeDragging: LayoutPropsType['onNodeDragging'];
45
+ onNodeDragEnd: LayoutPropsType['onNodeDraEnd'];
46
+ onNodeDrop: LayoutPropsType['onNodeDrop'];
47
+ onSelectNode: Required<LayoutPropsType>['onSelectNode'];
48
+ onDragStart: LayoutPropsType['onNodeDragStart'];
49
+ getGhostView: (dragNode: CNode | CRootNode, commonParam: AdvanceCustomFuncParam) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
50
+ toSelectNode: (nodeId: string) => Promise<true | undefined>;
51
+ toCopyNode: (id: string) => Promise<void>;
52
+ toDeleteNode: (nodeId: string) => Promise<void>;
53
+ toHidden: (id: string) => void;
54
+ getToolbarView: (node: CNode | CRootNode) => JSX.Element;
55
+ onHoverNode: LayoutPropsType['onHoverNode'];
56
+ nodeCanDrag: LayoutPropsType['nodeCanDrag'];
57
+ nodeCanDrop: LayoutPropsType['nodeCanDrop'];
58
+ innerSelectRectViewRender: LayoutPropsType['selectRectViewRender'];
59
+ innerHoverRectViewRender: LayoutPropsType['hoverRectViewRender'];
60
+ innerDropViewRender: LayoutPropsType['dropViewRender'];
61
+ render(): JSX.Element;
62
+ }
63
+ export {};
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { CNode } from '@chamn/model';
3
+ export type DefaultSelectToolBarProps = {
4
+ nodeList: CNode[];
5
+ toSelectNode: (id: string) => void;
6
+ toDelete: (id: string) => void;
7
+ toCopy: (idd: string) => void;
8
+ toHidden: (idd: string) => void;
9
+ };
10
+ export declare const getDefaultToolbarItem: (props: DefaultSelectToolBarProps) => {
11
+ copyItem: JSX.Element;
12
+ deleteItem: JSX.Element;
13
+ visibleItem: JSX.Element;
14
+ nodeLayout: JSX.Element;
15
+ };
16
+ export declare const DefaultSelectToolBar: (props: DefaultSelectToolBarProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { CNode, CRootNode } from '@chamn/model';
3
+ export declare const GhostView: ({ node }: {
4
+ node: CNode | CRootNode;
5
+ }) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const PLUGIN_NAME = "Designer";
@@ -0,0 +1,2 @@
1
+ import { DesignerPluginType } from './type';
2
+ export declare const DesignerPlugin: DesignerPluginType;
@@ -0,0 +1 @@
1
+ export declare const en_US: Record<string, any>;
@@ -0,0 +1,2 @@
1
+ declare const _default: Record<string, any>;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const zh_CN: Record<string, any>;
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { CPlugin, PluginInstance } from '../../core/pluginManager';
3
+ import { DragAndDrop, Layout, LayoutPropsType } from '@chamn/layout';
4
+ import { AdvanceCustom, AssetPackage, CPageDataType } from '@chamn/model';
5
+ import { RenderInstance } from '@chamn/render';
6
+ import { Designer } from './components/Canvas';
7
+ export type DesignerExport = {
8
+ reload: (params?: {
9
+ assets?: AssetPackage[];
10
+ }) => void;
11
+ getInstance: () => Designer | null;
12
+ getDnd: () => DragAndDrop | undefined;
13
+ selectNode: (nodeId: string) => void;
14
+ copyNode: (nodeId: string) => void;
15
+ deleteNode: (nodeId: string) => void;
16
+ getSelectedNodeId: () => string | undefined;
17
+ updatePage: (page: CPageDataType) => void;
18
+ getComponentInstances: (id: string) => RenderInstance[];
19
+ getDynamicComponentInstances: (id: string) => RenderInstance;
20
+ getLayoutRef: () => React.RefObject<Layout>;
21
+ getDesignerWindow: () => Window | null;
22
+ updateRenderComponents: (newComponentMap: Record<string, string>) => void;
23
+ };
24
+ export type DesignerPluginConfig = Omit<LayoutPropsType, 'selectRectViewRender' | 'hoverRectViewRender' | 'dropViewRender' | 'ghostView' | 'selectToolBarView' | 'hoverToolBarView'> & Pick<AdvanceCustom, 'selectRectViewRender' | 'hoverRectViewRender' | 'dropViewRender' | 'ghostViewRender' | 'toolbarViewRender'>;
25
+ export type DesignerPluginType = CPlugin<DesignerPluginConfig, DesignerExport>;
26
+ export type DesignerPluginInstance = PluginInstance<DesignerPluginConfig, DesignerExport>;
@@ -0,0 +1,2 @@
1
+ import { CNode, CRootNode } from '@chamn/model';
2
+ export declare const getClosestNodeList: (node: CNode | CRootNode, level?: number) => CNode[];
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { CPage } from '@chamn/model';
3
+ import { EnginContext } from '../../index';
4
+ export type DisplaySourceSchemaProps = {
5
+ pageModel: CPage;
6
+ engineCtx: EnginContext;
7
+ children: React.ReactNode;
8
+ };
9
+ export declare const DisplaySourceSchema: (props: DisplaySourceSchemaProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { CPlugin } from '../../core/pluginManager';
2
+ export declare const PLUGIN_NAME = "GlobalState";
3
+ export declare const GlobalStatePanelPlugin: CPlugin;
@@ -0,0 +1 @@
1
+ export declare const en_US: Record<string, any>;
@@ -0,0 +1,2 @@
1
+ declare const _default: Record<string, any>;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const zh_CN: Record<string, any>;
@@ -0,0 +1,2 @@
1
+ import { HistoryPluginType } from './type';
2
+ export declare const HistoryPlugin: HistoryPluginType;
@@ -0,0 +1,12 @@
1
+ import { CPlugin, PluginInstance } from '../../core/pluginManager';
2
+ export type HistoryExport = {
3
+ addStep: () => void;
4
+ reset: () => Promise<void>;
5
+ preStep: () => void;
6
+ nextStep: () => Promise<void> | undefined;
7
+ canGoPreStep: () => boolean;
8
+ canGoNextStep: () => boolean;
9
+ };
10
+ export type HistoryPluginConfig = any;
11
+ export type HistoryPluginType = CPlugin<HistoryPluginConfig, HistoryExport>;
12
+ export type HistoryPluginInstance = PluginInstance<HistoryPluginConfig, HistoryExport>;
@@ -0,0 +1,30 @@
1
+ import { Sensor } from '@chamn/layout';
2
+ import { CPage } from '@chamn/model';
3
+ import React from 'react';
4
+ import { TreeNodeData } from './dataStruct';
5
+ import { DesignerExport } from '../../../../plugins/Designer/type';
6
+ export declare enum DragState {
7
+ DRAGGING = "DRAGGING",
8
+ NORMAL = "NORMAL"
9
+ }
10
+ export type ContextState = {
11
+ treeData: TreeNodeData[];
12
+ currentSelectNodeKeys: string[];
13
+ expandKeys: string[];
14
+ multiSelect: boolean;
15
+ dragState: DragState;
16
+ pageModel: CPage | null;
17
+ };
18
+ export type CTreeContextData = {
19
+ sensor?: Sensor;
20
+ state: ContextState;
21
+ updateState: (state: Partial<ContextState>) => void;
22
+ onSelectNode: (params: {
23
+ keys: string[];
24
+ node: TreeNodeData;
25
+ }) => void;
26
+ onDeleteNode: (id: string) => void;
27
+ onCopyNode: (id: string) => void;
28
+ getDesignerHandler?: () => Promise<DesignerExport>;
29
+ };
30
+ export declare const CTreeContext: React.Context<CTreeContextData>;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export type TreeNodeData = {
3
+ containerRender?: (params: {
4
+ item: TreeNodeData;
5
+ treeNodeView: JSX.Element;
6
+ }) => React.ReactElement;
7
+ titleViewRender?: (params: {
8
+ item: TreeNodeData;
9
+ titleView: React.ReactNode;
10
+ }) => React.ReactElement;
11
+ title: React.ReactNode;
12
+ icon?: React.ReactNode;
13
+ key?: string;
14
+ children?: TreeNodeData[];
15
+ parent?: TreeNodeData | null;
16
+ canBeSelected?: boolean;
17
+ canDrag?: boolean;
18
+ canDropPos?: boolean | ('before' | 'after' | 'current')[];
19
+ rootNode?: boolean;
20
+ };
21
+ export declare const DemoTreeData: TreeNodeData;
@@ -0,0 +1,33 @@
1
+ import { Sensor } from '@chamn/layout';
2
+ import { CNode, CRootNode } from '@chamn/model';
3
+ import React from 'react';
4
+ import { WithTranslation } from 'react-i18next';
5
+ import { CPluginCtx } from '../../../../core/pluginManager';
6
+ import { ContextState } from './context';
7
+ import { TreeNodeData } from './dataStruct';
8
+ interface TreeViewProps extends WithTranslation {
9
+ pluginCtx: CPluginCtx;
10
+ multiSelect?: boolean;
11
+ }
12
+ export declare class TreeView extends React.Component<TreeViewProps, ContextState & {
13
+ dropPosInfo: {
14
+ x: number;
15
+ y: number;
16
+ } | null;
17
+ }> {
18
+ domRef: React.RefObject<HTMLDivElement>;
19
+ disposeCbList: (() => void)[];
20
+ sensor?: Sensor;
21
+ constructor(props: TreeViewProps);
22
+ getDesignerHandler: () => Promise<import('../../../../plugins/Designer/type').DesignerExport>;
23
+ updateTreeDataFromNode: () => void;
24
+ getParentKeyPaths: (targetKey: string) => string[];
25
+ scrollNodeToView: (key: string) => void;
26
+ componentDidMount(): Promise<void>;
27
+ toSelectTreeNode: (node: CNode | CRootNode | null) => void;
28
+ containNode: (parentNode: TreeNodeData, targetNode: TreeNodeData) => null;
29
+ getTreeNodeByKey: (key: string) => TreeNodeData | null;
30
+ registerDragEvent: () => Promise<void>;
31
+ render(): JSX.Element;
32
+ }
33
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { TreeNodeData } from './dataStruct';
3
+ import { CPluginCtx } from '../../../../core/pluginManager';
4
+ export declare const DRAG_ITEM_KEY = "data-drag-key";
5
+ export type TreeNodeProps = {
6
+ item: TreeNodeData;
7
+ level?: number;
8
+ paths?: (string | number)[];
9
+ pluginCtx: CPluginCtx;
10
+ };
11
+ export declare const TreeNode: (props: TreeNodeProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { CPlugin } from '../../core/pluginManager';
2
+ export declare const PLUGIN_NAME = "OutlineTree";
3
+ export declare const OutlineTreePlugin: CPlugin;
@@ -0,0 +1 @@
1
+ export declare const en_US: Record<string, any>;
@@ -0,0 +1,2 @@
1
+ declare const _default: Record<string, any>;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const zh_CN: Record<string, any>;
@@ -0,0 +1,14 @@
1
+ import { CNode, CNodeDataType, CPage, CPageDataType, DropPosType, MTitle } from '@chamn/model';
2
+ import { TreeNodeData } from './components/TreeView/dataStruct';
3
+ export declare const getTargetMNodeKeyVal: (dom: HTMLElement | null, key: string) => null | string;
4
+ export declare const transformNodeSchemaToTreeData: (nodeSchema: CNodeDataType | CNodeDataType[], parent: TreeNodeData, pageModel: CPage) => TreeNodeData | TreeNodeData[];
5
+ export declare const transformPageSchemaToTreeData: (pageSchema: CPageDataType, pageModel: CPage) => TreeNodeData[];
6
+ export declare const traverseTree: (tree: TreeNodeData | TreeNodeData[], handler: (node: TreeNodeData) => boolean) => void;
7
+ export declare function calculateDropPosInfo(params: {
8
+ point: {
9
+ x: number;
10
+ y: number;
11
+ };
12
+ dom: HTMLElement;
13
+ }): DropPosType;
14
+ export declare const getNodePropsLabelMap: (node: CNode) => Record<string, MTitle>;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { CNode, CRootNode } from '@chamn/model';
3
+ import { CPluginCtx } from '../../core/pluginManager';
4
+ import { CRightPanelItem } from '../RightPanel/view';
5
+ export declare const PropertyPanel: (props: {
6
+ node: CNode | CRootNode | null;
7
+ pluginCtx: CPluginCtx;
8
+ }) => JSX.Element;
9
+ export declare const PropertyPanelConfig: CRightPanelItem;
@@ -0,0 +1,2 @@
1
+ import { CPlugin } from '../../core/pluginManager';
2
+ export declare const RightPanelPlugin: CPlugin;
@@ -0,0 +1,39 @@
1
+ import { CNode, CRootNode } from '@chamn/model';
2
+ import React from 'react';
3
+ import { CPluginCtx } from '../../core/pluginManager';
4
+ export type RightPanelOptions = {
5
+ node: CNode | CRootNode | null;
6
+ pluginCtx: CPluginCtx;
7
+ activeTab: string;
8
+ };
9
+ export type CRightPanelItem = {
10
+ key: string;
11
+ name: string | ((props: RightPanelOptions) => React.ReactNode);
12
+ view: (props: RightPanelOptions) => React.ReactNode;
13
+ show?: (options: RightPanelOptions) => boolean;
14
+ };
15
+ interface RightPanelProps {
16
+ pluginCtx: CPluginCtx;
17
+ }
18
+ interface RightPanelState {
19
+ node: CNode | CRootNode | null;
20
+ activeKey: string;
21
+ panels: CRightPanelItem[];
22
+ displayPanels: CRightPanelItem[];
23
+ }
24
+ export declare class RightPanel extends React.Component<RightPanelProps, RightPanelState> {
25
+ constructor(props: RightPanelProps);
26
+ addPanel: (panel: CRightPanelItem) => void;
27
+ removePanel: (panelName: string) => void;
28
+ replacePanel: (panelName: string, newPanel: CRightPanelItem) => void;
29
+ choosePanel: (panelName: string) => void;
30
+ /** 更新被展示的 panel, 根据 panel 的 show 方法 */
31
+ updatePanels: () => {
32
+ panels: CRightPanelItem[];
33
+ displayPanels: CRightPanelItem[];
34
+ };
35
+ onNodeChange: ({ node }: any) => void;
36
+ componentDidMount(): void;
37
+ render(): JSX.Element;
38
+ }
39
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { CRightPanelItem, RightPanelOptions } from '../RightPanel/view';
3
+ export declare const VisualPanelPlus: (props: RightPanelOptions) => JSX.Element;
4
+ export declare const VisualPanelPlusConfig: CRightPanelItem;
@@ -0,0 +1,9 @@
1
+ import { CPlugin } from '../core/pluginManager';
2
+ import { ComponentLibPlugin } from './ComponentLibrary';
3
+ import { DesignerPlugin } from './Designer';
4
+ import { RightPanelPlugin } from './RightPanel';
5
+ import { GlobalStatePanelPlugin } from './GlobalStatePanel';
6
+ import { DisplaySourceSchema } from './DisplaySourceSchema';
7
+ import { HistoryPlugin } from './History';
8
+ export declare const DEFAULT_PLUGIN_LIST: CPlugin[];
9
+ export { DesignerPlugin, ComponentLibPlugin, RightPanelPlugin, GlobalStatePanelPlugin, HistoryPlugin, DisplaySourceSchema, };
@@ -0,0 +1,40 @@
1
+ import { CSSVal } from '../component/CSSEditor';
2
+ import { CNodeModelDataType, CSSType, JSExpressionPropType } from '@chamn/model';
3
+ export type StyleArr = {
4
+ property: string;
5
+ value: any;
6
+ }[];
7
+ export declare const styleArr2Obj: (val: StyleArr) => Record<string, any>;
8
+ export declare const styleObjToArr: (obj?: Record<string, any>) => StyleArr;
9
+ export declare const styleList2Text: (val: StyleArr) => string;
10
+ export declare const formatStyleProperty: (styleList?: CNodeModelDataType['style']) => {
11
+ normalProperty: {
12
+ property: string;
13
+ value: string;
14
+ }[];
15
+ expressionProperty: {
16
+ property: string;
17
+ value: JSExpressionPropType;
18
+ }[];
19
+ allProperty: {
20
+ property: string;
21
+ value: any;
22
+ }[];
23
+ };
24
+ export declare const formatCSSTextProperty: (cssText: string) => {
25
+ id: string;
26
+ property: string;
27
+ value: string;
28
+ }[];
29
+ export declare const formatCssToNodeVal: (className: string, val: CSSVal) => CSSType;
30
+ export declare const formatNodeValToEditor: (val?: CSSType) => CSSVal;
31
+ export declare const getColorFromStr: (str: string) => string[];
32
+ export type BoxShadowObjType = {
33
+ offsetX: string | undefined;
34
+ offsetY: string | undefined;
35
+ blur: string | undefined;
36
+ spread: string | undefined;
37
+ color: string | undefined;
38
+ type?: 'inset' | '';
39
+ };
40
+ export declare const parseBoxShadowString: (str: string) => BoxShadowObjType[];
@@ -0,0 +1,13 @@
1
+ import { LayoutPropsType } from '@chamn/layout';
2
+ /** 默认使用 react 18 模式渲染 */
3
+ export declare const beforeInitRender: LayoutPropsType['beforeInitRender'];
4
+ /** 默认使用 react 18 模式渲染 */
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;
13
+ }) => void;
@@ -0,0 +1,12 @@
1
+ /**
2
+ *
3
+ * @param time 毫秒
4
+ * @returns
5
+ */
6
+ export declare const waitReactUpdate: ({ time, cb, }?: {
7
+ time?: number | undefined;
8
+ cb?: ((...args: any[]) => void) | undefined;
9
+ }) => Promise<unknown>;
10
+ export * from './css';
11
+ export * from './defaultEngineConfig';
12
+ export * from './logger';
@@ -0,0 +1 @@
1
+ export declare const LOGGER: import("consola").Consola;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chamn/engine",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -38,9 +38,9 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@ant-design/icons": "^4.8.0",
41
- "@chamn/layout": "0.0.41",
42
- "@chamn/model": "0.0.41",
43
- "@chamn/render": "0.0.41",
41
+ "@chamn/layout": "0.0.43",
42
+ "@chamn/model": "0.0.43",
43
+ "@chamn/render": "0.0.43",
44
44
  "@dnd-kit/core": "^6.0.7",
45
45
  "@dnd-kit/modifiers": "^6.0.1",
46
46
  "@dnd-kit/sortable": "^7.0.2",
@@ -60,8 +60,8 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@babel/core": "^7.21.0",
63
- "@chamn/build-script": "0.0.41",
64
- "@chamn/demo-page": "0.0.41",
63
+ "@chamn/build-script": "0.0.43",
64
+ "@chamn/demo-page": "0.0.43",
65
65
  "@storybook/addon-docs": "^7.4.0",
66
66
  "@storybook/addon-essentials": "^7.4.0",
67
67
  "@storybook/addon-interactions": "^7.4.0",
@@ -94,5 +94,5 @@
94
94
  "storybook": "^7.4.0"
95
95
  },
96
96
  "config": {},
97
- "gitHead": "461b7336581080db9c5abdc3dec64f3dcf428b44"
97
+ "gitHead": "5a6197e162a6faf1e8953a6077c77ee49db03d63"
98
98
  }