@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,19 @@
1
+ /// <reference types="react" />
2
+ import { JSExpressionPropType } from '@chamn/model';
3
+ export type CSSPropertiesVariableBindEditorProps = {
4
+ initialValue?: {
5
+ property: string;
6
+ value: string | JSExpressionPropType;
7
+ }[];
8
+ onValueChange?: (val: {
9
+ property: string;
10
+ value: string;
11
+ }[]) => void;
12
+ };
13
+ export type CSSPropertiesVariableBindEditorRef = {
14
+ setValue: (val: {
15
+ property: string;
16
+ value: string | JSExpressionPropType;
17
+ }[]) => void;
18
+ };
19
+ export declare const CSSPropertiesVariableBindEditor: import("react").ForwardRefExoticComponent<CSSPropertiesVariableBindEditorProps & import("react").RefAttributes<CSSPropertiesVariableBindEditorRef>>;
@@ -0,0 +1,39 @@
1
+ import { InputProps } from 'antd';
2
+ import { MouseEventHandler } from 'react';
3
+ type CumulativeInfoType = {
4
+ x: number;
5
+ y: number;
6
+ cumulativeX: number;
7
+ cumulativeY: number;
8
+ };
9
+ export declare const useDragSize: (options?: {
10
+ onStart?: ((data: CumulativeInfoType) => void) | undefined;
11
+ onChange?: ((data: CumulativeInfoType) => void) | undefined;
12
+ onEnd?: ((data: CumulativeInfoType) => void) | undefined;
13
+ limitCumulative?: {
14
+ x?: [number | undefined, number | undefined] | undefined;
15
+ y?: [number | undefined, number | undefined] | undefined;
16
+ } | undefined;
17
+ } | undefined) => {
18
+ onMouseDown: MouseEventHandler<any>;
19
+ };
20
+ type MinMaxType = {
21
+ px?: number;
22
+ vw?: number;
23
+ vh?: number;
24
+ rem?: number;
25
+ };
26
+ export type CSSSizeInputProps = {
27
+ value?: string;
28
+ onValueChange?: (newVal: string | undefined) => void;
29
+ min?: MinMaxType | number;
30
+ max?: MinMaxType | number;
31
+ size?: InputProps['size'];
32
+ style?: React.CSSProperties;
33
+ unit?: boolean;
34
+ /** 累计的偏移量,映射为具体的值,默认 1:1 */
35
+ cumulativeTransform?: (params: CumulativeInfoType) => CumulativeInfoType;
36
+ unitList?: (keyof MinMaxType)[];
37
+ };
38
+ export declare const CSSSizeInput: (props: CSSSizeInputProps) => JSX.Element;
39
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { InputCommonRef } from '../type';
3
+ type Value = Record<'background-color' | 'background-image' | 'background-repeat' | 'background-size', string>;
4
+ export type BackgroundInputProps = {
5
+ value?: Value;
6
+ initialValue?: Value;
7
+ onChange?: (newVal: Value) => void;
8
+ };
9
+ export declare const BackgroundInput: import("react").ForwardRefExoticComponent<BackgroundInputProps & import("react").RefAttributes<InputCommonRef>>;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { InputCommonRef } from '../type';
3
+ type Value = Record<'border' | 'border-radius', string>;
4
+ export type BorderInputProps = {
5
+ value?: Value;
6
+ initialValue?: Value;
7
+ onChange?: (newVal: Value) => void;
8
+ };
9
+ export declare const BorderInput: import("react").ForwardRefExoticComponent<BorderInputProps & import("react").RefAttributes<InputCommonRef>>;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { InputCommonRef } from '../type';
3
+ declare const keyList: readonly ["width", "height", "min-width", "max-width", "min-height", "max-height", "flex", "display"];
4
+ type Value = Record<typeof keyList[number], string>;
5
+ export type DimensionInputProps = {
6
+ value?: Value;
7
+ initialValue?: Value;
8
+ onChange?: (newVal: Value) => void;
9
+ };
10
+ export declare const DimensionInput: import("react").ForwardRefExoticComponent<DimensionInputProps & import("react").RefAttributes<InputCommonRef>>;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { InputCommonRef } from '../type';
3
+ type Value = Record<'font-size' | 'color' | 'text-align' | 'font-weight', string>;
4
+ export type FontInputProps = {
5
+ initialValue?: Value;
6
+ value?: Value;
7
+ onChange?: (newVal: Value) => void;
8
+ };
9
+ export declare const FontInput: import("react").ForwardRefExoticComponent<FontInputProps & import("react").RefAttributes<InputCommonRef>>;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { InputCommonRef } from '../type';
3
+ type Value = Record<'left' | 'right' | 'top' | 'bottom' | 'all', string>;
4
+ export type MarginAndPaddingInputProps = {
5
+ value?: Value;
6
+ initialValue?: Value;
7
+ onChange?: (newVal: Value) => void;
8
+ prefix: 'margin' | 'padding';
9
+ };
10
+ export declare const MarginAndPaddingInput: import("react").ForwardRefExoticComponent<MarginAndPaddingInputProps & import("react").RefAttributes<InputCommonRef>>;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { InputCommonRef } from '../type';
3
+ type Value = Record<'box-shadow', string>;
4
+ export type ShadowInputProps = {
5
+ value?: Value;
6
+ initialValue?: Value;
7
+ onChange?: (newVal: Value) => void;
8
+ };
9
+ export declare const ShadowInput: import("react").ForwardRefExoticComponent<ShadowInputProps & import("react").RefAttributes<InputCommonRef>>;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { InputCommonRef } from './type';
3
+ export type CSSUIPanelProps = {
4
+ initialVal?: Record<string, string>;
5
+ value?: Record<string, string>;
6
+ onValueChange?: (newVal: Record<string, string>) => void;
7
+ };
8
+ export type CSSUIPanelRef = InputCommonRef;
9
+ export declare const CSSUIPanel: import("react").ForwardRefExoticComponent<CSSUIPanelProps & import("react").RefAttributes<InputCommonRef>>;
@@ -0,0 +1,3 @@
1
+ export type InputCommonRef = {
2
+ setValue: (newVal: Record<string, string>) => void;
3
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ClassNameType } from '@chamn/model';
3
+ export type ClassNameEditorProps = {
4
+ initialValue?: ClassNameType[];
5
+ onValueChange?: (val: ClassNameType[]) => void;
6
+ };
7
+ export type ClassNameEditorRef = {
8
+ setValue: (val: ClassNameType[]) => void;
9
+ };
10
+ export declare const ClassNameEditor: React.ForwardRefExoticComponent<ClassNameEditorProps & React.RefAttributes<ClassNameEditorRef>>;
@@ -0,0 +1,12 @@
1
+ import React, { ReactNode } from 'react';
2
+ export type CFieldProps = {
3
+ children: React.ReactNode;
4
+ label?: string;
5
+ tips?: ReactNode | (() => ReactNode);
6
+ name: string;
7
+ condition?: (formState: Record<string, any>) => boolean;
8
+ onConditionValueChange?: (val: boolean) => void;
9
+ noStyle?: boolean;
10
+ hiddenLabel?: boolean;
11
+ };
12
+ export declare const CField: (props: CFieldProps) => JSX.Element | null;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { CSetter } from '../Setters/type';
3
+ export type ContextState = Record<string, any>;
4
+ export type CFormContextData = {
5
+ formName: string;
6
+ formState: ContextState;
7
+ conditionConfig: Record<string, (state: ContextState) => boolean>;
8
+ customSetterMap?: Record<string, CSetter>;
9
+ updateContext: (newState: ContextState) => void;
10
+ updateConditionConfig: (name: string, cb: (state: ContextState) => boolean) => void;
11
+ };
12
+ export declare const CFormContext: React.Context<CFormContextData>;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { CFormContextData, ContextState } from './context';
4
+ export type CFormProps = {
5
+ name: string;
6
+ children?: ReactNode | ReactNode[];
7
+ initialValue?: Record<string, any>;
8
+ customSetterMap: CFormContextData['customSetterMap'];
9
+ onValueChange?: (formData: Record<string, any>) => void;
10
+ };
11
+ export declare const registerCustomSetter: (customSetterMap: CFormContextData['customSetterMap']) => void;
12
+ export declare class CForm extends React.Component<CFormProps, CFormContextData> {
13
+ updateContext: (newState: ContextState) => void;
14
+ constructor(props: CFormProps);
15
+ getFieldsValue: () => Record<string, any>;
16
+ setFields: (state: Record<string, any>) => void;
17
+ formatValue: (data: Record<string, any>) => Record<string, any>;
18
+ render(): ReactNode;
19
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { SetterObjType } from '@chamn/model';
3
+ import { CFieldProps } from '../Form/Field';
4
+ import { CSetter } from '../Setters/type';
5
+ export type SetterSwitcherProps = {
6
+ setters: SetterObjType[];
7
+ customSetterMap?: Record<string, CSetter>;
8
+ keyPaths: string[];
9
+ prefix?: React.ReactNode;
10
+ suffix?: React.ReactNode;
11
+ style?: React.CSSProperties;
12
+ useField?: boolean;
13
+ } & Omit<CFieldProps, 'children'>;
14
+ export declare const SetterSwitcher: ({ setters, keyPaths, condition, useField, ...props }: SetterSwitcherProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { CSetter } from '../type';
2
+ export declare const AntDColorSetter: CSetter;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { SetterObjType } from '@chamn/model';
3
+ export declare function ArrayItem(props: {
4
+ index: number;
5
+ keyPaths: string[];
6
+ value: Record<string, any>;
7
+ setters: SetterObjType[];
8
+ style: React.CSSProperties;
9
+ onValueChange: (val: Record<string, any>) => void;
10
+ onDelete: () => void;
11
+ }): JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ModalProps } from 'antd';
3
+ export type SortItemOrderProps = {
4
+ list: any[];
5
+ keyPaths: string[];
6
+ label: string;
7
+ sortLabelKey?: string;
8
+ onValueChange?: (newList: any[]) => void;
9
+ } & ModalProps;
10
+ export declare const SortItemOrderModal: ({ list, onValueChange, keyPaths, label, sortLabelKey, ...modalProps }: SortItemOrderProps) => JSX.Element;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { CSetterProps } from '../type';
3
+ import { SetterType } from '@chamn/model';
4
+ export type CArraySetterProps = {
5
+ item: {
6
+ setters: SetterType[];
7
+ initialValue?: any;
8
+ };
9
+ sortLabelKey?: string;
10
+ };
11
+ export declare const ArraySetter: {
12
+ ({ onValueChange, setterContext, item: { setters, initialValue: itemInitialValue }, sortLabelKey, initialValue, ...props }: CSetterProps<CArraySetterProps>): JSX.Element;
13
+ setterName: string;
14
+ };
@@ -0,0 +1,7 @@
1
+ import { SwitchProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ type BooleanSetterProps = SwitchProps;
4
+ export declare const BooleanSetter: CSetter<BooleanSetterProps & {
5
+ initialValue?: boolean;
6
+ }>;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import { CSetter } from '../type';
2
+ import { CSSSizeInputProps } from '../../../../../component/CSSSizeInput';
3
+ export declare const CSSSizeSetter: CSetter<CSSSizeInputProps>;
@@ -0,0 +1,6 @@
1
+ import { CSetter } from '../type';
2
+ type CSSValueSetterProps = {
3
+ propertyKey: string;
4
+ };
5
+ export declare const CSSValueSetter: CSetter<CSSValueSetterProps>;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import { CSetter } from '../type';
2
+ export declare const ColorSetter: CSetter;
@@ -0,0 +1,10 @@
1
+ import { CSetter, CSetterProps } from '../type';
2
+ import { ChangeEventHandler } from 'react';
3
+ export type ExpressionSetterProps = CSetterProps<{
4
+ value: {
5
+ type: string;
6
+ value: string;
7
+ };
8
+ onChange: ChangeEventHandler<HTMLTextAreaElement>;
9
+ }>;
10
+ export declare const ExpressionSetter: CSetter<ExpressionSetterProps>;
@@ -0,0 +1,2 @@
1
+ import { CSetter } from '../type';
2
+ export declare const FunctionSetter: CSetter<any>;
@@ -0,0 +1,2 @@
1
+ import { CSetter } from '../type';
2
+ export declare const JSONSetter: CSetter<any>;
@@ -0,0 +1,3 @@
1
+ import { InputNumberProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ export declare const NumberSetter: CSetter<InputNumberProps>;
@@ -0,0 +1,2 @@
1
+ import { CSetter } from '../type';
2
+ export declare const RadioGroupSetter: CSetter;
@@ -0,0 +1,3 @@
1
+ import { SelectProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ export declare const SelectSetter: CSetter<SelectProps>;
@@ -0,0 +1,8 @@
1
+ import { CSetter } from '../type';
2
+ import { MaterialPropType } from '@chamn/model';
3
+ export type CShapeSetterProps = {
4
+ elements: MaterialPropType[];
5
+ initialValue?: Record<string, any>;
6
+ value: Record<string, any>;
7
+ };
8
+ export declare const ShapeSetter: CSetter<CShapeSetterProps>;
@@ -0,0 +1,3 @@
1
+ import { SliderSingleProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ export declare const SliderSetter: CSetter<SliderSingleProps>;
@@ -0,0 +1,3 @@
1
+ import { InputProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ export declare const StringSetter: CSetter<InputProps>;
@@ -0,0 +1,3 @@
1
+ import { CSetter } from '../type';
2
+ import { TextAreaProps } from 'antd/es/input';
3
+ export declare const TextAreaSetter: CSetter<TextAreaProps>;
@@ -0,0 +1,4 @@
1
+ import { CSetter } from './type';
2
+ declare const _default: Record<string, CSetter<any>>;
3
+ export default _default;
4
+ export * from './type';
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { CPluginCtx } from '../../../../core/pluginManager';
3
+ export type CSetter<T = any> = {
4
+ (props: CSetterProps<T>): JSX.Element;
5
+ setterName: string;
6
+ };
7
+ export type CSetterProps<T = {
8
+ _: any;
9
+ }> = {
10
+ onValueChange?: (val: any) => void;
11
+ initialValue?: any;
12
+ value?: any;
13
+ setterContext: {
14
+ pluginCtx: CPluginCtx;
15
+ setCollapseHeaderExt?: (el: React.ReactNode) => void;
16
+ onSetterChange: (keyPaths: string[], setterName: string) => void;
17
+ keyPaths: string[];
18
+ label: string;
19
+ };
20
+ } & T;
@@ -0,0 +1,15 @@
1
+ import React, { Ref } from 'react';
2
+ import { CustomSchemaFormInstance } from '.';
3
+ import { CPluginCtx } from '../../core/pluginManager';
4
+ import { CForm } from './components/Form';
5
+ export type ContextState = Record<string, any>;
6
+ export type CCustomSchemaFormContextData = {
7
+ onSetterChange: (keyPaths: string[], setterName: string) => void;
8
+ defaultSetterConfig: Record<string, {
9
+ name: string;
10
+ setter: string;
11
+ }>;
12
+ formRef?: Ref<CustomSchemaFormInstance | CForm>;
13
+ pluginCtx?: CPluginCtx;
14
+ };
15
+ export declare const CCustomSchemaFormContext: React.Context<CCustomSchemaFormContextData>;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { CMaterialPropsType } from '@chamn/model';
3
+ import { CForm } from './components/Form';
4
+ import { CPluginCtx } from '../../core/pluginManager';
5
+ import { CFormContextData } from './components/Form/context';
6
+ export type CustomSchemaFormInstance = CForm;
7
+ export type CustomSchemaFormProps = {
8
+ pluginCtx?: CPluginCtx;
9
+ initialValue: Record<string, any>;
10
+ properties: CMaterialPropsType<any>;
11
+ onValueChange?: (val: any) => void;
12
+ onSetterChange: (keyPaths: string[], setterName: string) => void;
13
+ /** 存储每个字段上次使用的 setter */
14
+ defaultSetterConfig: Record<string, {
15
+ name: string;
16
+ setter: string;
17
+ }>;
18
+ customSetterMap?: CFormContextData['customSetterMap'];
19
+ };
20
+ export declare const CustomSchemaForm: React.ForwardRefExoticComponent<CustomSchemaFormProps & React.RefAttributes<CForm>>;
21
+ export * from './components/SetterSwitcher';
22
+ export * from './components/Setters';
@@ -0,0 +1,2 @@
1
+ import { SetterObjType, SetterType } from '@chamn/model';
2
+ export declare const getSetterList: <T extends string = "">(setters?: SetterType<T>[]) => SetterObjType<T>[];
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { InputProps } from 'antd';
3
+ export type InputNumberPlusProps = Omit<InputProps, 'onChange'> & {
4
+ min?: number;
5
+ max?: number;
6
+ value?: number;
7
+ onChange?: (newVal: number | undefined) => void;
8
+ };
9
+ export declare const InputNumberPlus: ({ min, max, value, onChange, addonAfter, ...restProps }: InputNumberPlusProps) => JSX.Element;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { EditorProps, Monaco } from '@monaco-editor/react';
3
+ type EditorType = EditorProps;
4
+ export type MonacoEditorInstance = Parameters<Required<EditorType>['onMount']>[0];
5
+ export type MonacoEditorProps = {
6
+ beforeMount?: (monaco: Monaco) => void;
7
+ onDidMount?: (editor: MonacoEditorInstance) => void;
8
+ options?: EditorType['options'];
9
+ onChange?: EditorType['onChange'];
10
+ initialValue?: string;
11
+ language?: 'json' | 'javascript' | 'typescript';
12
+ };
13
+ export declare const MonacoEditor: (props: MonacoEditorProps) => JSX.Element;
14
+ export {};
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import { ResizeCallback } from 're-resizable';
3
+ import { Emitter } from 'mitt';
4
+ export interface PluginContext {
5
+ openPanel: () => void;
6
+ closePanel: () => void;
7
+ getPlugin: (pluginName: string) => any;
8
+ emitter: Emitter<any>;
9
+ }
10
+ type PanelItem = {
11
+ name: string;
12
+ title: string | React.ReactNode;
13
+ icon: React.ReactNode;
14
+ render: React.ReactNode;
15
+ };
16
+ export type WorkbenchCustomView = {
17
+ key: string;
18
+ view: React.ReactNode;
19
+ };
20
+ type WorkbenchStateType = {
21
+ leftBoxVisible: boolean;
22
+ leftBoxSize: {
23
+ width: number;
24
+ height: number | string;
25
+ };
26
+ leftBoxFixed: boolean;
27
+ rightBoxSize: {
28
+ width: number;
29
+ height: number | string;
30
+ };
31
+ rightBoxVisible: boolean;
32
+ currentActiveLeftPanel: string;
33
+ leftPanels: PanelItem[];
34
+ bodyView: React.ReactNode | null;
35
+ rightView: React.ReactNode | null;
36
+ topToolBarView: React.ReactNode | null;
37
+ subTopToolBarView: React.ReactNode | null;
38
+ customViewList: WorkbenchCustomView[];
39
+ };
40
+ export type WorkbenchPropsType = {
41
+ emitter: Emitter<any>;
42
+ };
43
+ export declare class Workbench extends React.Component<WorkbenchPropsType, WorkbenchStateType> {
44
+ emitter: Emitter<any>;
45
+ leftPanelContentRef: React.RefObject<HTMLDivElement>;
46
+ constructor(props: WorkbenchPropsType);
47
+ addLeftPanel: (panel: PanelItem) => void;
48
+ /** 替换对应的 panel */
49
+ replaceLeftPanel: (panelName: string, newPanel: PanelItem) => void;
50
+ /**
51
+ * 添加属于插件的自定义视图
52
+ * @param view
53
+ * @returns dispose: 调用后移除 view
54
+ */
55
+ addCustomView(view: WorkbenchCustomView): () => void;
56
+ openLeftPanel: (currentActiveLeftPanel?: string) => Promise<void>;
57
+ closeLeftPanel: () => Promise<void>;
58
+ toggleLeftPanel: () => void;
59
+ onPluginIconClick: (panel: PanelItem) => void;
60
+ openRightPanel: () => void;
61
+ closeRightPanel: () => void;
62
+ replaceBodyView: (newView: React.ReactNode) => void;
63
+ replaceRightView: (newView: React.ReactNode) => void;
64
+ replaceTopBarView: (newView: React.ReactNode) => void;
65
+ replaceSubTopBarView: (newView: React.ReactNode) => void;
66
+ toggleRightPanel: () => void;
67
+ onLeftBoxResizeStop: ResizeCallback;
68
+ onGlobalClick: (e: MouseEvent) => void;
69
+ componentDidMount(): void;
70
+ render(): JSX.Element;
71
+ }
72
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_PRESET_COLORS: {
2
+ label: string;
3
+ colors: string[];
4
+ }[];
@@ -0,0 +1,8 @@
1
+ import { AssetPackage } from '@chamn/model';
2
+ export declare class AssetsPackageListManager {
3
+ private _assets;
4
+ constructor(assets: AssetPackage[]);
5
+ getList(): AssetPackage[];
6
+ setList(newAssets: AssetPackage[]): void;
7
+ }
8
+ export declare const getUniqueAssetsList: (tempList: AssetPackage[]) => AssetPackage[];
@@ -0,0 +1,63 @@
1
+ import { Engine } from '../index';
2
+ import { CPage } from '@chamn/model';
3
+ import { Emitter } from 'mitt';
4
+ import { Workbench } from '../component/Workbench';
5
+ import { CustomI18n } from '../i18n';
6
+ import { AssetsPackageListManager } from './assetPackagesListManage';
7
+ export type PluginObj<C, E = any> = {
8
+ name: string;
9
+ init: (ctx: CPluginCtx<C>) => Promise<void>;
10
+ destroy: (ctx: CPluginCtx<C>) => Promise<void>;
11
+ /** 用于暴露给外部重载插件 */
12
+ reload?: (ctx: CPluginCtx<C>) => Promise<void>;
13
+ /** 插件暴露给外部可以调用的方法 */
14
+ export: (ctx: CPluginCtx<C>) => E;
15
+ meta: {
16
+ engine: {
17
+ version: string;
18
+ };
19
+ };
20
+ };
21
+ export type CPlugin<C = Record<string, any>, E = any> = PluginObj<C, E> | ((ctx: CPluginCtx<C>) => PluginObj<C, E>);
22
+ type PluginManagerOptions = {
23
+ getWorkbench: () => Workbench;
24
+ emitter: Emitter<any>;
25
+ pageModel: CPage;
26
+ i18n: CustomI18n;
27
+ assetsPackageListManager: AssetsPackageListManager;
28
+ engine: Engine;
29
+ };
30
+ export type CPluginCtx<C = any> = {
31
+ name?: string;
32
+ globalEmitter: Emitter<any>;
33
+ /** 当前插件外部传入的配置 **/
34
+ config: C;
35
+ pluginManager: PluginManager;
36
+ pluginReadyOk: () => void;
37
+ } & PluginManagerOptions;
38
+ export type PluginInstance<C = any, E = any> = {
39
+ ctx: CPluginCtx<C>;
40
+ export: E;
41
+ source: PluginObj<C, E>;
42
+ ready: boolean;
43
+ };
44
+ export type CustomPluginHook<P extends PluginInstance<any, any> = any> = (pluginInstance: P) => P;
45
+ export declare class PluginManager {
46
+ plugins: Map<string, PluginInstance>;
47
+ emitter: Emitter<any>;
48
+ getWorkbench: () => Workbench;
49
+ pageModel: CPage;
50
+ i18n: CustomI18n;
51
+ assetsPackageListManager: AssetsPackageListManager;
52
+ engine: Engine;
53
+ customPluginHooks: Record<string, CustomPluginHook[]>;
54
+ constructor({ getWorkbench, emitter, pageModel, i18n, assetsPackageListManager, engine }: PluginManagerOptions);
55
+ /** 自定义插件, 可以修改插件的配置 */
56
+ customPlugin: <P extends PluginInstance<any, any>>(pluginName: string, customPluginHook: CustomPluginHook<P>) => void;
57
+ createPluginCtx: () => CPluginCtx<any>;
58
+ add(plugin: CPlugin): Promise<void>;
59
+ get<P extends PluginInstance<any, any>>(pluginName: string): Promise<P | undefined>;
60
+ remove(name: string): Promise<void>;
61
+ onPluginReadyOk(pluginName: string, cb?: (pluginHandle: PluginInstance) => void): Promise<PluginInstance<any, any>>;
62
+ }
63
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const en_US: {
2
+ translation: {
3
+ 'Welcome to React': string;
4
+ };
5
+ };
@@ -0,0 +1,6 @@
1
+ import i18n from 'i18next';
2
+ export type CustomI18n = typeof i18n & {
3
+ update: () => void;
4
+ };
5
+ declare const customI18n: CustomI18n;
6
+ export default customI18n;
@@ -0,0 +1,5 @@
1
+ export declare const zh_CN: {
2
+ translation: {
3
+ 'Welcome to React': string;
4
+ };
5
+ };