@toolmain/components 1.2.14 → 1.2.16

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 (3) hide show
  1. package/dist/index.d.ts +111 -25
  2. package/dist/index.js +4700 -4721
  3. package/package.json +7 -7
package/dist/index.d.ts CHANGED
@@ -108,6 +108,26 @@ declare type __VLS_Props_5 = {
108
108
  provider: ComponentProvider;
109
109
  };
110
110
 
111
+ declare type __VLS_Props_6 = {
112
+ /**
113
+ * drag bar size, specified as width when moving horizontally, and height when moving vertically
114
+ */
115
+ size: number | string;
116
+ /**
117
+ * drag bar is attached to the `direction` of the `target` element
118
+ */
119
+ direction: "top" | "right" | "bottom" | "left";
120
+ /**
121
+ * the targe element which size will be changed, if not set,
122
+ * represent current element's parent element
123
+ */
124
+ target?: HTMLElement | null;
125
+ /**
126
+ * the target element's style
127
+ */
128
+ modelValue: CSSProperties;
129
+ };
130
+
111
131
  declare type __VLS_Slots = {} & {
112
132
  default?: (props: typeof __VLS_1) => any;
113
133
  };
@@ -248,7 +268,7 @@ export declare type BaseComponentSerialized = {
248
268
  children: BaseComponentSerialized[];
249
269
  };
250
270
 
251
- declare interface BaseConfigProps {
271
+ export declare interface BaseConfigProps {
252
272
  /**
253
273
  * 当属性存在多种类型时,要选择最终的类型
254
274
  */
@@ -275,7 +295,7 @@ declare interface BaseConfigProps {
275
295
  disabled?: boolean;
276
296
  }
277
297
 
278
- declare interface BaseProps extends BaseConfigProps {
298
+ export declare interface BaseProps extends BaseConfigProps {
279
299
  /**
280
300
  * 默认预设值
281
301
  */
@@ -390,11 +410,11 @@ export declare type CameraConf = {
390
410
  };
391
411
  };
392
412
 
393
- declare interface ColorProps extends BaseProps {
413
+ export declare interface ColorProps extends BaseProps {
394
414
  type: PropsType.Color;
395
415
  }
396
416
 
397
- declare type CombArray<T> = T | T[];
417
+ export declare type CombArray<T> = T | T[];
398
418
 
399
419
  /**
400
420
  * UI组件拥有的默认事件
@@ -409,6 +429,7 @@ export declare type ComponentEvents = {
409
429
  */
410
430
  args: string[];
411
431
  returnType?: string;
432
+ version?: string;
412
433
  };
413
434
 
414
435
  export declare class ComponentGenerator {
@@ -530,7 +551,15 @@ export declare interface ComponentProvider extends EventBus<ProviderEv> {
530
551
  getVarState: () => ComponentVarState;
531
552
  }
532
553
 
533
- declare interface ComponentVarState {
554
+ export declare type ComponentUIGroup = {
555
+ label: string;
556
+ list: Array<{
557
+ label: string;
558
+ icon?: string | VNode;
559
+ }>;
560
+ };
561
+
562
+ export declare interface ComponentVarState {
534
563
  dispose: () => void;
535
564
  createVariable: (config: VariableStatic) => Variable;
536
565
  delVariable: (varId: string) => Variable | undefined;
@@ -623,6 +652,11 @@ declare interface DebugPanel {
623
652
  node: VNode | Component | string;
624
653
  }
625
654
 
655
+ /**
656
+ * 元素默认属性
657
+ */
658
+ export declare const defaultProps: () => Record<string, Props>;
659
+
626
660
  export declare type DeliverParam = {
627
661
  instanceId?: string;
628
662
  raw?: RawComponent;
@@ -711,7 +745,7 @@ export declare interface ElRect {
711
745
  y: number;
712
746
  }
713
747
 
714
- declare interface EnumProps extends BaseProps {
748
+ export declare interface EnumProps extends BaseProps {
715
749
  type: PropsType.Enum;
716
750
  enums: Array<string | number | boolean>;
717
751
  }
@@ -768,12 +802,12 @@ export declare interface EventMap {
768
802
  moving: (pos: DragAttr) => void;
769
803
  }
770
804
 
771
- declare interface ExtendProps extends BaseProps {
805
+ export declare interface ExtendProps extends BaseProps {
772
806
  type: PropsType.Extend;
773
807
  extendType: string;
774
808
  }
775
809
 
776
- declare interface ExtendPropsParser {
810
+ export declare interface ExtendPropsParser {
777
811
  parse(value: Props): PropsValue;
778
812
  extendType(): string;
779
813
  }
@@ -791,7 +825,7 @@ declare type FixedArray<T, L extends number> = Pick<T[], Exclude<keyof T[], ArrM
791
825
  readonly length: L;
792
826
  };
793
827
 
794
- declare interface FunctionProps extends BaseProps {
828
+ export declare interface FunctionProps extends BaseProps {
795
829
  type: PropsType.Function;
796
830
  /**
797
831
  * 实际的参数字符串会被传送到`Function`的参数中
@@ -817,6 +851,11 @@ export declare class GeneralLibrary implements ComponentLibrary {
817
851
  isPlaceHolder(raw: RawComponent): boolean;
818
852
  }
819
853
 
854
+ /**
855
+ * 推算出当前属性的最终类型
856
+ */
857
+ export declare function getFinalType(props: Props): PropsType | undefined;
858
+
820
859
  export declare function getModel(url: string, onProgress?: (progress: LoadProgressData) => void): Promise<{
821
860
  code: number;
822
861
  msg: string;
@@ -840,7 +879,7 @@ export declare const htmlTextConfig: (label: string, libraryId: string) => RawCo
840
879
 
841
880
  export declare const htmlTextLabel: string[];
842
881
 
843
- declare interface IconProps extends BaseProps {
882
+ export declare interface IconProps extends BaseProps {
844
883
  type: PropsType.Icon;
845
884
  }
846
885
 
@@ -850,7 +889,32 @@ export declare function initRect(): Rect;
850
889
 
851
890
  export declare type InitType = "auto" | "inherit" | "initial" | "unset";
852
891
 
853
- declare interface JSONProps extends BaseProps {
892
+ export declare function isColorProps(props: Props): props is ColorProps;
893
+
894
+ export declare function isEnumProps(props: Props): props is EnumProps;
895
+
896
+ export declare function isExtendProps(props: Props): props is ExtendProps;
897
+
898
+ export declare function isFunctionProps(props: Props): props is FunctionProps;
899
+
900
+ export declare function isIconProps(props: Props): props is IconProps;
901
+
902
+ export declare function isJSONProps(props: Props): props is JSONProps;
903
+
904
+ /**
905
+ * 判断是否是基本数据类型
906
+ */
907
+ export declare function isPrimitive(type: unknown): type is Primitive;
908
+
909
+ export declare function isPrimitiveProps(props: Props): props is PrimitiveProps;
910
+
911
+ export declare function isTimeProps(props: Props): props is TimeProps;
912
+
913
+ export declare function isType(src: unknown, target: PropsType): boolean;
914
+
915
+ export declare function isVueProps(props: Props): props is VueProps;
916
+
917
+ export declare interface JSONProps extends BaseProps {
854
918
  type: PropsType.JSON;
855
919
  }
856
920
 
@@ -989,7 +1053,7 @@ export declare interface LoadProgressData {
989
1053
  describe?: string;
990
1054
  }
991
1055
 
992
- declare type MixedProps = BaseProps & Partial<Omit<PrimitiveProps, "type">> & Partial<Omit<ColorProps, "type">> & Partial<Omit<JSONProps, "type">> & Partial<Omit<TimeProps, "type">> & Partial<Omit<EnumProps, "type">> & Partial<Omit<FunctionProps, "type">> & Partial<Omit<VueProps, "type">> & Partial<Omit<ExtendProps, "type">> & Partial<Omit<IconProps, "type">> & {
1056
+ export declare type MixedProps = BaseProps & Partial<Omit<PrimitiveProps, "type">> & Partial<Omit<ColorProps, "type">> & Partial<Omit<JSONProps, "type">> & Partial<Omit<TimeProps, "type">> & Partial<Omit<EnumProps, "type">> & Partial<Omit<FunctionProps, "type">> & Partial<Omit<VueProps, "type">> & Partial<Omit<ExtendProps, "type">> & Partial<Omit<IconProps, "type">> & {
993
1057
  type: Array<PropsType>;
994
1058
  };
995
1059
 
@@ -1076,6 +1140,13 @@ declare class NodeTree {
1076
1140
 
1077
1141
  export declare const ParentView: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
1078
1142
 
1143
+ export declare function parseProp(propKey: string, prop: Props, parser: PropsGenerator, provider: ComponentProvider): unknown;
1144
+
1145
+ /**
1146
+ * @param [withoutUndefined=false] 是否过滤掉undefined的属性,default:false
1147
+ */
1148
+ export declare function parseProps(newProps: Record<string, Props>, parser: PropsGenerator, provider: ComponentProvider, withoutUndefined?: boolean): Record<string, unknown>;
1149
+
1079
1150
  export declare const placeholderNode: () => VNode<RendererNode, RendererElement, {
1080
1151
  [key: string]: any;
1081
1152
  }>;
@@ -1088,13 +1159,13 @@ export declare const placeholderRaw: () => RawComponent;
1088
1159
  /**
1089
1160
  * 基础数据类型的单个或者数组结构类型
1090
1161
  */
1091
- declare interface PrimitiveProps extends BaseProps {
1162
+ export declare interface PrimitiveProps extends BaseProps {
1092
1163
  type: CombArray<PropsType.Number | PropsType.String | PropsType.Boolean | PropsType.Undefined | PropsType.Null | PropsType.Symbol | PropsType.BigInt>;
1093
1164
  }
1094
1165
 
1095
- declare type Props = PrimitiveProps | ColorProps | JSONProps | TimeProps | EnumProps | FunctionProps | VueProps | ExtendProps | IconProps | MixedProps;
1166
+ export declare type Props = PrimitiveProps | ColorProps | JSONProps | TimeProps | EnumProps | FunctionProps | VueProps | ExtendProps | IconProps | MixedProps;
1096
1167
 
1097
- declare interface PropsGenerator {
1168
+ export declare interface PropsGenerator {
1098
1169
  addParser(parser: PropsParser): this;
1099
1170
  addExtendParser(extendParser: ExtendPropsParser): this;
1100
1171
  getParsers(): PropsParser[];
@@ -1112,12 +1183,12 @@ export declare class PropsGeneratorImpl implements PropsGenerator {
1112
1183
  parse(props: Props): PropsValue | undefined;
1113
1184
  }
1114
1185
 
1115
- declare interface PropsParser {
1186
+ export declare interface PropsParser {
1116
1187
  parse(value: Props): PropsValue;
1117
1188
  propsType(): PropsType;
1118
1189
  }
1119
1190
 
1120
- declare enum PropsType {
1191
+ export declare enum PropsType {
1121
1192
  Number = "Number",
1122
1193
  String = "String",
1123
1194
  Boolean = "Boolean",
@@ -1141,7 +1212,7 @@ declare enum PropsType {
1141
1212
  Extend = "Extend"
1142
1213
  }
1143
1214
 
1144
- declare type PropsValue = Props & {
1215
+ export declare type PropsValue = Props & {
1145
1216
  value: unknown;
1146
1217
  };
1147
1218
 
@@ -1267,6 +1338,11 @@ export declare interface Rect {
1267
1338
  y: number;
1268
1339
  }
1269
1340
 
1341
+ /**
1342
+ * 注册默认UI组件内部事件
1343
+ */
1344
+ export declare const registerEvents: (instanceId: string, raw: RawComponent, provider?: ComponentProvider) => Record<string, CallBackFn>;
1345
+
1270
1346
  /**
1271
1347
  * 远程资源,贴图,视频等
1272
1348
  */
@@ -1306,6 +1382,16 @@ export declare type RendererConf = {
1306
1382
  clearColor: string;
1307
1383
  };
1308
1384
 
1385
+ export declare const Resize: DefineComponent<__VLS_Props_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
1386
+ scaling: () => any;
1387
+ afterScale: () => any;
1388
+ "update:modelValue": (value: CSSProperties) => any;
1389
+ }, string, PublicProps, Readonly<__VLS_Props_6> & Readonly<{
1390
+ onScaling?: (() => any) | undefined;
1391
+ onAfterScale?: (() => any) | undefined;
1392
+ "onUpdate:modelValue"?: ((value: CSSProperties) => any) | undefined;
1393
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1394
+
1309
1395
  /**
1310
1396
  * tranlate rgb color to hex string
1311
1397
  */
@@ -1618,7 +1704,7 @@ export declare type ThreePanelConf = {
1618
1704
  lights: Array<LightMeta>;
1619
1705
  };
1620
1706
 
1621
- declare interface TimeProps extends BaseProps {
1707
+ export declare interface TimeProps extends BaseProps {
1622
1708
  type: PropsType.Time;
1623
1709
  format?: string;
1624
1710
  }
@@ -1716,7 +1802,7 @@ export declare function useTarget(): Target;
1716
1802
 
1717
1803
  export declare const useVarState: () => ComponentVarState;
1718
1804
 
1719
- declare enum ValueType {
1805
+ export declare enum ValueType {
1720
1806
  /**
1721
1807
  * 属性值为静态值
1722
1808
  */
@@ -1731,7 +1817,7 @@ declare enum ValueType {
1731
1817
  Remote = "Remote"
1732
1818
  }
1733
1819
 
1734
- declare interface Variable {
1820
+ export declare interface Variable {
1735
1821
  /**
1736
1822
  * 唯一ID
1737
1823
  */
@@ -1755,11 +1841,11 @@ declare interface Variable {
1755
1841
  value: Ref<unknown> | Reactive<Array<unknown> | Record<string, unknown>>;
1756
1842
  }
1757
1843
 
1758
- declare type VariableSerialized = Omit<Variable, "value"> & {
1844
+ export declare type VariableSerialized = Omit<Variable, "value"> & {
1759
1845
  value: any;
1760
1846
  };
1761
1847
 
1762
- declare type VariableStatic = Omit<Variable, "id" | "value" | "type"> & Partial<Pick<Variable, "id">> & {
1848
+ export declare type VariableStatic = Omit<Variable, "id" | "value" | "type"> & Partial<Pick<Variable, "id">> & {
1763
1849
  value?: any;
1764
1850
  };
1765
1851
 
@@ -1774,13 +1860,13 @@ export declare class VarState implements ComponentVarState {
1774
1860
  deserialize(data: VariableSerialized[]): Variable[];
1775
1861
  }
1776
1862
 
1777
- declare enum VarsType {
1863
+ export declare enum VarsType {
1778
1864
  Primitive = "Primitive",
1779
1865
  Object = "Object",
1780
1866
  Array = "Array"
1781
1867
  }
1782
1868
 
1783
- declare interface VueProps extends BaseProps {
1869
+ export declare interface VueProps extends BaseProps {
1784
1870
  type: PropsType.Vue;
1785
1871
  }
1786
1872