@combos-fun/inspector-decorator 0.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Combos Fun团队
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @combos-fun/inspector-decorator
@@ -0,0 +1,164 @@
1
+ 'use strict';
2
+
3
+ require('reflect-metadata');
4
+
5
+ class SymbolKeysNotSupportedError extends Error {
6
+ constructor() {
7
+ super('Symbol keys are not supported yet!');
8
+ Object.setPrototypeOf(this, new.target.prototype);
9
+ }
10
+ }
11
+
12
+ const IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
13
+ const COMPONENT_EXECUTE_MODE_METADATA = 'COMPONENT_EXECUTE_MODE_METADATA';
14
+
15
+ function isFunction(val) {
16
+ return typeof val === 'function';
17
+ }
18
+ function transformBasicType(type) {
19
+ if (type === String) {
20
+ return 'string';
21
+ }
22
+ if (type === Number) {
23
+ return 'number';
24
+ }
25
+ if (type === Boolean) {
26
+ return 'boolean';
27
+ }
28
+ return 'unknown';
29
+ }
30
+ function defineTypes(target, key, options, returnTypeFunction) {
31
+ let type = Reflect.getMetadata('design:type', target, key);
32
+ let isArray = type === Array;
33
+ const str = transformBasicType(type);
34
+ if (str !== 'unknown') {
35
+ type = str;
36
+ }
37
+ if (returnTypeFunction) {
38
+ const returnType = returnTypeFunction();
39
+ if (Array.isArray(returnType)) {
40
+ isArray = true;
41
+ // not support Tuples yet
42
+ type = returnType[0];
43
+ }
44
+ else {
45
+ type = returnType;
46
+ }
47
+ }
48
+ const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
49
+ properties[key] = {
50
+ type,
51
+ isArray: isArray,
52
+ ...options,
53
+ };
54
+ Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
55
+ }
56
+ function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
57
+ if (typeof returnTypeFuncOrOptions === 'function') {
58
+ return {
59
+ returnTypeFunc: returnTypeFuncOrOptions,
60
+ options: maybeOptions || {},
61
+ };
62
+ }
63
+ return {
64
+ options: returnTypeFuncOrOptions || {},
65
+ };
66
+ }
67
+ function Field(returnTypeFunction, maybeOptions) {
68
+ return (target, propertyKey) => {
69
+ if (typeof propertyKey === 'symbol') {
70
+ throw new SymbolKeysNotSupportedError();
71
+ }
72
+ const { options, returnTypeFunc } = getTypeDecoratorParams(returnTypeFunction, maybeOptions);
73
+ defineTypes(target, propertyKey, options, returnTypeFunc);
74
+ };
75
+ }
76
+ function getPropertiesOf(target, isRoot = true) {
77
+ const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target) || {};
78
+ const name = target.componentName;
79
+ const rootObject = {
80
+ name,
81
+ type: name,
82
+ isArray: false,
83
+ };
84
+ if (isRoot) {
85
+ rootObject.isFolder = true;
86
+ }
87
+ if (!Object.keys(properties).length && target.componentName) {
88
+ return rootObject;
89
+ }
90
+ rootObject.type = 'object';
91
+ rootObject.children = [];
92
+ Object.keys(properties).forEach(propertyKey => {
93
+ if (isFunction(properties[propertyKey].type)) {
94
+ const maybeBasicType = transformBasicType(properties[propertyKey].type);
95
+ if (maybeBasicType !== 'unknown') {
96
+ properties[propertyKey].type = maybeBasicType;
97
+ }
98
+ else {
99
+ const child = getPropertiesOf(properties[propertyKey].type, false);
100
+ properties[propertyKey].type = 'object';
101
+ if (!properties[propertyKey].children) {
102
+ properties[propertyKey].children = [];
103
+ }
104
+ properties[propertyKey].children.push(...(child.children || []));
105
+ }
106
+ }
107
+ if (!properties[propertyKey].name) {
108
+ properties[propertyKey].name = propertyKey;
109
+ }
110
+ if (properties[propertyKey].isArray) {
111
+ properties[propertyKey].addable = true;
112
+ }
113
+ rootObject.children.push(properties[propertyKey]);
114
+ });
115
+ return rootObject;
116
+ }
117
+ var ExecuteMode;
118
+ (function (ExecuteMode) {
119
+ ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
120
+ ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
121
+ ExecuteMode[ExecuteMode["All"] = 6] = "All";
122
+ })(ExecuteMode || (ExecuteMode = {}));
123
+ const ExecuteInEditMode = target => {
124
+ Reflect.defineMetadata(COMPONENT_EXECUTE_MODE_METADATA, ExecuteMode.Edit, target);
125
+ };
126
+ const shouldExecuteInEditMode = (target) => {
127
+ const mode = Reflect.getMetadata(COMPONENT_EXECUTE_MODE_METADATA, target);
128
+ return !!(mode & ExecuteMode.Edit);
129
+ };
130
+
131
+ /**
132
+ * Legacy inspector hints used across Combos plugins: writes `constructor.IDEProps`
133
+ * (object keyed by property name). Compatible with legacy inspector-decorator style (v0.0.x IDEProps).
134
+ */
135
+ function getIDEPropsPropertyObj(target, propertyKey) {
136
+ if (!target.constructor.IDEProps) {
137
+ target.constructor.IDEProps = {};
138
+ }
139
+ if (!target.constructor.IDEProps[propertyKey]) {
140
+ target.constructor.IDEProps[propertyKey] = {};
141
+ }
142
+ return target.constructor.IDEProps[propertyKey];
143
+ }
144
+ function type(typeString) {
145
+ return function (target, propertyKey) {
146
+ const prop = getIDEPropsPropertyObj(target, propertyKey);
147
+ prop.key = propertyKey;
148
+ prop.type = typeString;
149
+ };
150
+ }
151
+ function step(stepValue) {
152
+ return function (target, propertyKey) {
153
+ const prop = getIDEPropsPropertyObj(target, propertyKey);
154
+ prop.step = stepValue;
155
+ };
156
+ }
157
+
158
+ exports.ExecuteInEditMode = ExecuteInEditMode;
159
+ exports.Field = Field;
160
+ exports.getPropertiesOf = getPropertiesOf;
161
+ exports.shouldExecuteInEditMode = shouldExecuteInEditMode;
162
+ exports.step = step;
163
+ exports.type = type;
164
+ //# sourceMappingURL=inspector-decorator.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspector-decorator.cjs.js","sources":["../lib/exceptions.ts","../lib/constants.ts","../lib/decorators.ts","../lib/ideLegacy.ts"],"sourcesContent":["export class SymbolKeysNotSupportedError extends Error {\n constructor() {\n super('Symbol keys are not supported yet!');\n\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class StaticGetPropertiesIsNotAFunctionError extends Error {\n constructor() {\n super('getProperties is not a function!');\n\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","export const IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';\nexport const COMPONENT_EXECUTE_MODE_METADATA = 'COMPONENT_EXECUTE_MODE_METADATA';\n","import {TypeDecoratorParams, ReturnTypeFunc, FieldOptions, ClassType, FieldMetadata} from './interface';\nimport {SymbolKeysNotSupportedError} from './exceptions';\nimport {IDE_PROPERTY_METADATA, COMPONENT_EXECUTE_MODE_METADATA} from './constants';\n\nfunction isFunction(val: unknown): val is Function {\n return typeof val === 'function';\n}\n\nfunction transformBasicType(type: unknown): 'string' | 'number' | 'boolean' | 'unknown' {\n if (type === String) {\n return 'string';\n }\n if (type === Number) {\n return 'number';\n }\n if (type === Boolean) {\n return 'boolean';\n }\n return 'unknown';\n}\n\nfunction defineTypes(target: any, key: string | symbol, options: FieldOptions, returnTypeFunction?: ReturnTypeFunc) {\n let type = Reflect.getMetadata('design:type', target, key);\n let isArray = type === Array;\n const str = transformBasicType(type);\n if (str !== 'unknown') {\n type = str;\n }\n if (returnTypeFunction) {\n const returnType = returnTypeFunction();\n if (Array.isArray(returnType)) {\n isArray = true;\n // not support Tuples yet\n type = returnType[0];\n } else {\n type = returnType;\n }\n }\n const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};\n properties[key] = {\n type,\n isArray: isArray,\n ...options,\n };\n Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);\n}\n\nfunction getTypeDecoratorParams(\n returnTypeFuncOrOptions: ReturnTypeFunc | FieldOptions | undefined,\n maybeOptions: FieldOptions | undefined,\n): TypeDecoratorParams {\n if (typeof returnTypeFuncOrOptions === 'function') {\n return {\n returnTypeFunc: returnTypeFuncOrOptions,\n options: maybeOptions || {},\n };\n }\n return {\n options: returnTypeFuncOrOptions || {},\n };\n}\n\nexport function Field(): PropertyDecorator;\nexport function Field(options: FieldOptions): PropertyDecorator;\nexport function Field(returnTypeFunction?: ReturnTypeFunc): PropertyDecorator;\nexport function Field(returnTypeFunction?: ReturnTypeFunc | FieldOptions, maybeOptions?: FieldOptions): PropertyDecorator;\nexport function Field(returnTypeFunction?: ReturnTypeFunc | FieldOptions, maybeOptions?: FieldOptions): PropertyDecorator {\n return (target, propertyKey) => {\n if (typeof propertyKey === 'symbol') {\n throw new SymbolKeysNotSupportedError();\n }\n\n const {options, returnTypeFunc} = getTypeDecoratorParams(returnTypeFunction, maybeOptions);\n defineTypes(target, propertyKey, options, returnTypeFunc);\n };\n}\n\nexport function getPropertiesOf<\n T extends ClassType<any> & {\n componentName?: string;\n },\n>(target: T, isRoot = true): FieldMetadata {\n const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target) || {};\n const name = target.componentName;\n const rootObject: FieldMetadata = {\n name,\n type: name,\n isArray: false,\n };\n if (isRoot) {\n rootObject.isFolder = true;\n }\n if (!Object.keys(properties).length && target.componentName) {\n return rootObject;\n }\n\n rootObject.type = 'object';\n rootObject.children = [];\n Object.keys(properties).forEach(propertyKey => {\n if (isFunction(properties[propertyKey].type)) {\n const maybeBasicType = transformBasicType(properties[propertyKey].type);\n if (maybeBasicType !== 'unknown') {\n properties[propertyKey].type = maybeBasicType;\n } else {\n const child = getPropertiesOf(properties[propertyKey].type, false);\n properties[propertyKey].type = 'object';\n if (!properties[propertyKey].children) {\n properties[propertyKey].children = [];\n }\n properties[propertyKey].children.push(...(child.children || []));\n }\n }\n if (!properties[propertyKey].name) {\n properties[propertyKey].name = propertyKey;\n }\n if (properties[propertyKey].isArray) {\n properties[propertyKey].addable = true;\n }\n rootObject.children!.push(properties[propertyKey]);\n });\n return rootObject;\n}\n\nenum ExecuteMode {\n Edit = 1 << 1,\n Game = 1 << 2,\n All = Edit | Game,\n}\n\nexport const ExecuteInEditMode: ClassDecorator = target => {\n Reflect.defineMetadata(COMPONENT_EXECUTE_MODE_METADATA, ExecuteMode.Edit, target);\n};\n\nexport const shouldExecuteInEditMode = (target: ClassType<any>): boolean => {\n const mode = Reflect.getMetadata(COMPONENT_EXECUTE_MODE_METADATA, target);\n return !!(mode & ExecuteMode.Edit);\n};\n","/**\n * Legacy inspector hints used across Combos plugins: writes `constructor.IDEProps`\n * (object keyed by property name). Compatible with legacy inspector-decorator style (v0.0.x IDEProps).\n */\nfunction getIDEPropsPropertyObj(target: any, propertyKey: string | symbol): Record<string, unknown> {\n if (!target.constructor.IDEProps) {\n target.constructor.IDEProps = {};\n }\n if (!target.constructor.IDEProps[propertyKey]) {\n target.constructor.IDEProps[propertyKey] = {};\n }\n return target.constructor.IDEProps[propertyKey];\n}\n\nexport function type(typeString: string) {\n return function (target: any, propertyKey: string | symbol): void {\n const prop = getIDEPropsPropertyObj(target, propertyKey);\n prop.key = propertyKey;\n prop.type = typeString;\n };\n}\n\nexport function step(stepValue: number) {\n return function (target: any, propertyKey: string | symbol): void {\n const prop = getIDEPropsPropertyObj(target, propertyKey);\n prop.step = stepValue;\n };\n}\n"],"names":[],"mappings":";;;;AAAM,MAAO,2BAA4B,SAAQ,KAAK,CAAA;AACpD,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,oCAAoC,CAAC;QAE3C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;IACnD;AACD;;ACNM,MAAM,qBAAqB,GAAG,uBAAuB;AACrD,MAAM,+BAA+B,GAAG,iCAAiC;;ACGhF,SAAS,UAAU,CAAC,GAAY,EAAA;AAC9B,IAAA,OAAO,OAAO,GAAG,KAAK,UAAU;AAClC;AAEA,SAAS,kBAAkB,CAAC,IAAa,EAAA;AACvC,IAAA,IAAI,IAAI,KAAK,MAAM,EAAE;AACnB,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,IAAI,KAAK,MAAM,EAAE;AACnB,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,IAAI,KAAK,OAAO,EAAE;AACpB,QAAA,OAAO,SAAS;IAClB;AACA,IAAA,OAAO,SAAS;AAClB;AAEA,SAAS,WAAW,CAAC,MAAW,EAAE,GAAoB,EAAE,OAAqB,EAAE,kBAAmC,EAAA;AAChH,IAAA,IAAI,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,CAAC;AAC1D,IAAA,IAAI,OAAO,GAAG,IAAI,KAAK,KAAK;AAC5B,IAAA,MAAM,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC;AACpC,IAAA,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,IAAI,GAAG,GAAG;IACZ;IACA,IAAI,kBAAkB,EAAE;AACtB,QAAA,MAAM,UAAU,GAAG,kBAAkB,EAAE;AACvC,QAAA,IAAI,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,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC7C,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE;IAC/C;IACA,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC;AACjD;AAEM,SAAU,IAAI,CAAC,UAAkB,EAAA;IACrC,OAAO,UAAU,MAAW,EAAE,WAA4B,EAAA;QACxD,MAAM,IAAI,GAAG,sBAAsB,CAAC,MAAM,EAAE,WAAW,CAAC;AACxD,QAAA,IAAI,CAAC,GAAG,GAAG,WAAW;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,UAAU;AACxB,IAAA,CAAC;AACH;AAEM,SAAU,IAAI,CAAC,SAAiB,EAAA;IACpC,OAAO,UAAU,MAAW,EAAE,WAA4B,EAAA;QACxD,MAAM,IAAI,GAAG,sBAAsB,CAAC,MAAM,EAAE,WAAW,CAAC;AACxD,QAAA,IAAI,CAAC,IAAI,GAAG,SAAS;AACvB,IAAA,CAAC;AACH;;;;;;;;;"}
@@ -0,0 +1 @@
1
+ "use strict";require("reflect-metadata");class t extends Error{constructor(){super("Symbol keys are not supported yet!"),Object.setPrototypeOf(this,new.target.prototype)}}const e="IDE_PROPERTY_METADATA",n="COMPONENT_EXECUTE_MODE_METADATA";function o(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}var r;!function(t){t[t.Edit=2]="Edit",t[t.Game=4]="Game",t[t.All=6]="All"}(r||(r={}));function c(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}exports.ExecuteInEditMode=t=>{Reflect.defineMetadata(n,r.Edit,t)},exports.Field=function(n,r){return(c,s)=>{if("symbol"==typeof s)throw new t;const{options:i,returnTypeFunc:u}=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(n,r);!function(t,n,r,c){let s=Reflect.getMetadata("design:type",t,n),i=s===Array;const u=o(s);if("unknown"!==u&&(s=u),c){const t=c();Array.isArray(t)?(i=!0,s=t[0]):s=t}const a=Reflect.getMetadata(e,t.constructor)||{};a[n]={type:s,isArray:i,...r},Reflect.defineMetadata(e,a,t.constructor)}(c,s,i,u)}},exports.getPropertiesOf=function t(n,r=!0){const c=Reflect.getMetadata(e,n)||{},s=n.componentName,i={name:s,type:s,isArray:!1};return r&&(i.isFolder=!0),!Object.keys(c).length&&n.componentName||(i.type="object",i.children=[],Object.keys(c).forEach(e=>{if("function"==typeof c[e].type){const n=o(c[e].type);if("unknown"!==n)c[e].type=n;else{const n=t(c[e].type,!1);c[e].type="object",c[e].children||(c[e].children=[]),c[e].children.push(...n.children||[])}}c[e].name||(c[e].name=e),c[e].isArray&&(c[e].addable=!0),i.children.push(c[e])})),i},exports.shouldExecuteInEditMode=t=>!!(Reflect.getMetadata(n,t)&r.Edit),exports.step=function(t){return function(e,n){c(e,n).step=t}},exports.type=function(t){return function(e,n){const o=c(e,n);o.key=n,o.type=t}};
@@ -0,0 +1,54 @@
1
+ interface RecursiveArray<TValue> extends Array<RecursiveArray<TValue> | TValue> {
2
+ }
3
+ interface ClassType<T = any> {
4
+ new (...args: any[]): T;
5
+ }
6
+ type TypeValue = ClassType | Function | object | symbol;
7
+ type ReturnTypeFuncValue = TypeValue | RecursiveArray<TypeValue>;
8
+ type TypeValueThunk = (type?: void) => TypeValue;
9
+ type ClassTypeResolver = (of?: void) => ClassType | Function;
10
+ type ReturnTypeFunc = (returns?: void) => ReturnTypeFuncValue;
11
+ interface NumberOptions {
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ }
16
+ interface FieldOptions extends NumberOptions, FillterOptions, FilltersOptions, AnyOptions {
17
+ type?: string;
18
+ }
19
+ type AnyOptions = Record<string, any>;
20
+ interface FillterOptions {
21
+ filter?(val: any): any;
22
+ }
23
+ interface FilltersOptions {
24
+ filters?: ((val: any) => any)[];
25
+ }
26
+ interface TypeDecoratorParams {
27
+ returnTypeFunc?: ReturnTypeFunc;
28
+ options: FieldOptions;
29
+ }
30
+ interface FieldMetadata extends NumberOptions, FillterOptions, FilltersOptions, AnyOptions {
31
+ name: string;
32
+ type: string;
33
+ children?: FieldMetadata[];
34
+ isFolder?: boolean;
35
+ isArray: boolean;
36
+ addable?: boolean;
37
+ }
38
+ type ReturnTypeAsync<T extends (...args: any) => any> = T extends (...args: any) => Promise<infer R> ? R : T extends (...args: any) => infer R ? R : any;
39
+
40
+ declare function Field(): PropertyDecorator;
41
+ declare function Field(options: FieldOptions): PropertyDecorator;
42
+ declare function Field(returnTypeFunction?: ReturnTypeFunc): PropertyDecorator;
43
+ declare function Field(returnTypeFunction?: ReturnTypeFunc | FieldOptions, maybeOptions?: FieldOptions): PropertyDecorator;
44
+ declare function getPropertiesOf<T extends ClassType<any> & {
45
+ componentName?: string;
46
+ }>(target: T, isRoot?: boolean): FieldMetadata;
47
+ declare const ExecuteInEditMode: ClassDecorator;
48
+ declare const shouldExecuteInEditMode: (target: ClassType<any>) => boolean;
49
+
50
+ declare function type(typeString: string): (target: any, propertyKey: string | symbol) => void;
51
+ declare function step(stepValue: number): (target: any, propertyKey: string | symbol) => void;
52
+
53
+ export { ExecuteInEditMode, Field, getPropertiesOf, shouldExecuteInEditMode, step, type };
54
+ export type { ClassType, ClassTypeResolver, FieldMetadata, FieldOptions, FillterOptions, FilltersOptions, RecursiveArray, ReturnTypeAsync, ReturnTypeFunc, ReturnTypeFuncValue, TypeDecoratorParams, TypeValue, TypeValueThunk };
@@ -0,0 +1,157 @@
1
+ import 'reflect-metadata';
2
+
3
+ class SymbolKeysNotSupportedError extends Error {
4
+ constructor() {
5
+ super('Symbol keys are not supported yet!');
6
+ Object.setPrototypeOf(this, new.target.prototype);
7
+ }
8
+ }
9
+
10
+ const IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
11
+ const COMPONENT_EXECUTE_MODE_METADATA = 'COMPONENT_EXECUTE_MODE_METADATA';
12
+
13
+ function isFunction(val) {
14
+ return typeof val === 'function';
15
+ }
16
+ function transformBasicType(type) {
17
+ if (type === String) {
18
+ return 'string';
19
+ }
20
+ if (type === Number) {
21
+ return 'number';
22
+ }
23
+ if (type === Boolean) {
24
+ return 'boolean';
25
+ }
26
+ return 'unknown';
27
+ }
28
+ function defineTypes(target, key, options, returnTypeFunction) {
29
+ let type = Reflect.getMetadata('design:type', target, key);
30
+ let isArray = type === Array;
31
+ const str = transformBasicType(type);
32
+ if (str !== 'unknown') {
33
+ type = str;
34
+ }
35
+ if (returnTypeFunction) {
36
+ const returnType = returnTypeFunction();
37
+ if (Array.isArray(returnType)) {
38
+ isArray = true;
39
+ // not support Tuples yet
40
+ type = returnType[0];
41
+ }
42
+ else {
43
+ type = returnType;
44
+ }
45
+ }
46
+ const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
47
+ properties[key] = {
48
+ type,
49
+ isArray: isArray,
50
+ ...options,
51
+ };
52
+ Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
53
+ }
54
+ function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
55
+ if (typeof returnTypeFuncOrOptions === 'function') {
56
+ return {
57
+ returnTypeFunc: returnTypeFuncOrOptions,
58
+ options: maybeOptions || {},
59
+ };
60
+ }
61
+ return {
62
+ options: returnTypeFuncOrOptions || {},
63
+ };
64
+ }
65
+ function Field(returnTypeFunction, maybeOptions) {
66
+ return (target, propertyKey) => {
67
+ if (typeof propertyKey === 'symbol') {
68
+ throw new SymbolKeysNotSupportedError();
69
+ }
70
+ const { options, returnTypeFunc } = getTypeDecoratorParams(returnTypeFunction, maybeOptions);
71
+ defineTypes(target, propertyKey, options, returnTypeFunc);
72
+ };
73
+ }
74
+ function getPropertiesOf(target, isRoot = true) {
75
+ const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target) || {};
76
+ const name = target.componentName;
77
+ const rootObject = {
78
+ name,
79
+ type: name,
80
+ isArray: false,
81
+ };
82
+ if (isRoot) {
83
+ rootObject.isFolder = true;
84
+ }
85
+ if (!Object.keys(properties).length && target.componentName) {
86
+ return rootObject;
87
+ }
88
+ rootObject.type = 'object';
89
+ rootObject.children = [];
90
+ Object.keys(properties).forEach(propertyKey => {
91
+ if (isFunction(properties[propertyKey].type)) {
92
+ const maybeBasicType = transformBasicType(properties[propertyKey].type);
93
+ if (maybeBasicType !== 'unknown') {
94
+ properties[propertyKey].type = maybeBasicType;
95
+ }
96
+ else {
97
+ const child = getPropertiesOf(properties[propertyKey].type, false);
98
+ properties[propertyKey].type = 'object';
99
+ if (!properties[propertyKey].children) {
100
+ properties[propertyKey].children = [];
101
+ }
102
+ properties[propertyKey].children.push(...(child.children || []));
103
+ }
104
+ }
105
+ if (!properties[propertyKey].name) {
106
+ properties[propertyKey].name = propertyKey;
107
+ }
108
+ if (properties[propertyKey].isArray) {
109
+ properties[propertyKey].addable = true;
110
+ }
111
+ rootObject.children.push(properties[propertyKey]);
112
+ });
113
+ return rootObject;
114
+ }
115
+ var ExecuteMode;
116
+ (function (ExecuteMode) {
117
+ ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
118
+ ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
119
+ ExecuteMode[ExecuteMode["All"] = 6] = "All";
120
+ })(ExecuteMode || (ExecuteMode = {}));
121
+ const ExecuteInEditMode = target => {
122
+ Reflect.defineMetadata(COMPONENT_EXECUTE_MODE_METADATA, ExecuteMode.Edit, target);
123
+ };
124
+ const shouldExecuteInEditMode = (target) => {
125
+ const mode = Reflect.getMetadata(COMPONENT_EXECUTE_MODE_METADATA, target);
126
+ return !!(mode & ExecuteMode.Edit);
127
+ };
128
+
129
+ /**
130
+ * Legacy inspector hints used across Combos plugins: writes `constructor.IDEProps`
131
+ * (object keyed by property name). Compatible with legacy inspector-decorator style (v0.0.x IDEProps).
132
+ */
133
+ function getIDEPropsPropertyObj(target, propertyKey) {
134
+ if (!target.constructor.IDEProps) {
135
+ target.constructor.IDEProps = {};
136
+ }
137
+ if (!target.constructor.IDEProps[propertyKey]) {
138
+ target.constructor.IDEProps[propertyKey] = {};
139
+ }
140
+ return target.constructor.IDEProps[propertyKey];
141
+ }
142
+ function type(typeString) {
143
+ return function (target, propertyKey) {
144
+ const prop = getIDEPropsPropertyObj(target, propertyKey);
145
+ prop.key = propertyKey;
146
+ prop.type = typeString;
147
+ };
148
+ }
149
+ function step(stepValue) {
150
+ return function (target, propertyKey) {
151
+ const prop = getIDEPropsPropertyObj(target, propertyKey);
152
+ prop.step = stepValue;
153
+ };
154
+ }
155
+
156
+ export { ExecuteInEditMode, Field, getPropertiesOf, shouldExecuteInEditMode, step, type };
157
+ //# sourceMappingURL=inspector-decorator.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspector-decorator.esm.js","sources":["../lib/exceptions.ts","../lib/constants.ts","../lib/decorators.ts","../lib/ideLegacy.ts"],"sourcesContent":["export class SymbolKeysNotSupportedError extends Error {\n constructor() {\n super('Symbol keys are not supported yet!');\n\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class StaticGetPropertiesIsNotAFunctionError extends Error {\n constructor() {\n super('getProperties is not a function!');\n\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","export const IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';\nexport const COMPONENT_EXECUTE_MODE_METADATA = 'COMPONENT_EXECUTE_MODE_METADATA';\n","import {TypeDecoratorParams, ReturnTypeFunc, FieldOptions, ClassType, FieldMetadata} from './interface';\nimport {SymbolKeysNotSupportedError} from './exceptions';\nimport {IDE_PROPERTY_METADATA, COMPONENT_EXECUTE_MODE_METADATA} from './constants';\n\nfunction isFunction(val: unknown): val is Function {\n return typeof val === 'function';\n}\n\nfunction transformBasicType(type: unknown): 'string' | 'number' | 'boolean' | 'unknown' {\n if (type === String) {\n return 'string';\n }\n if (type === Number) {\n return 'number';\n }\n if (type === Boolean) {\n return 'boolean';\n }\n return 'unknown';\n}\n\nfunction defineTypes(target: any, key: string | symbol, options: FieldOptions, returnTypeFunction?: ReturnTypeFunc) {\n let type = Reflect.getMetadata('design:type', target, key);\n let isArray = type === Array;\n const str = transformBasicType(type);\n if (str !== 'unknown') {\n type = str;\n }\n if (returnTypeFunction) {\n const returnType = returnTypeFunction();\n if (Array.isArray(returnType)) {\n isArray = true;\n // not support Tuples yet\n type = returnType[0];\n } else {\n type = returnType;\n }\n }\n const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};\n properties[key] = {\n type,\n isArray: isArray,\n ...options,\n };\n Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);\n}\n\nfunction getTypeDecoratorParams(\n returnTypeFuncOrOptions: ReturnTypeFunc | FieldOptions | undefined,\n maybeOptions: FieldOptions | undefined,\n): TypeDecoratorParams {\n if (typeof returnTypeFuncOrOptions === 'function') {\n return {\n returnTypeFunc: returnTypeFuncOrOptions,\n options: maybeOptions || {},\n };\n }\n return {\n options: returnTypeFuncOrOptions || {},\n };\n}\n\nexport function Field(): PropertyDecorator;\nexport function Field(options: FieldOptions): PropertyDecorator;\nexport function Field(returnTypeFunction?: ReturnTypeFunc): PropertyDecorator;\nexport function Field(returnTypeFunction?: ReturnTypeFunc | FieldOptions, maybeOptions?: FieldOptions): PropertyDecorator;\nexport function Field(returnTypeFunction?: ReturnTypeFunc | FieldOptions, maybeOptions?: FieldOptions): PropertyDecorator {\n return (target, propertyKey) => {\n if (typeof propertyKey === 'symbol') {\n throw new SymbolKeysNotSupportedError();\n }\n\n const {options, returnTypeFunc} = getTypeDecoratorParams(returnTypeFunction, maybeOptions);\n defineTypes(target, propertyKey, options, returnTypeFunc);\n };\n}\n\nexport function getPropertiesOf<\n T extends ClassType<any> & {\n componentName?: string;\n },\n>(target: T, isRoot = true): FieldMetadata {\n const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target) || {};\n const name = target.componentName;\n const rootObject: FieldMetadata = {\n name,\n type: name,\n isArray: false,\n };\n if (isRoot) {\n rootObject.isFolder = true;\n }\n if (!Object.keys(properties).length && target.componentName) {\n return rootObject;\n }\n\n rootObject.type = 'object';\n rootObject.children = [];\n Object.keys(properties).forEach(propertyKey => {\n if (isFunction(properties[propertyKey].type)) {\n const maybeBasicType = transformBasicType(properties[propertyKey].type);\n if (maybeBasicType !== 'unknown') {\n properties[propertyKey].type = maybeBasicType;\n } else {\n const child = getPropertiesOf(properties[propertyKey].type, false);\n properties[propertyKey].type = 'object';\n if (!properties[propertyKey].children) {\n properties[propertyKey].children = [];\n }\n properties[propertyKey].children.push(...(child.children || []));\n }\n }\n if (!properties[propertyKey].name) {\n properties[propertyKey].name = propertyKey;\n }\n if (properties[propertyKey].isArray) {\n properties[propertyKey].addable = true;\n }\n rootObject.children!.push(properties[propertyKey]);\n });\n return rootObject;\n}\n\nenum ExecuteMode {\n Edit = 1 << 1,\n Game = 1 << 2,\n All = Edit | Game,\n}\n\nexport const ExecuteInEditMode: ClassDecorator = target => {\n Reflect.defineMetadata(COMPONENT_EXECUTE_MODE_METADATA, ExecuteMode.Edit, target);\n};\n\nexport const shouldExecuteInEditMode = (target: ClassType<any>): boolean => {\n const mode = Reflect.getMetadata(COMPONENT_EXECUTE_MODE_METADATA, target);\n return !!(mode & ExecuteMode.Edit);\n};\n","/**\n * Legacy inspector hints used across Combos plugins: writes `constructor.IDEProps`\n * (object keyed by property name). Compatible with legacy inspector-decorator style (v0.0.x IDEProps).\n */\nfunction getIDEPropsPropertyObj(target: any, propertyKey: string | symbol): Record<string, unknown> {\n if (!target.constructor.IDEProps) {\n target.constructor.IDEProps = {};\n }\n if (!target.constructor.IDEProps[propertyKey]) {\n target.constructor.IDEProps[propertyKey] = {};\n }\n return target.constructor.IDEProps[propertyKey];\n}\n\nexport function type(typeString: string) {\n return function (target: any, propertyKey: string | symbol): void {\n const prop = getIDEPropsPropertyObj(target, propertyKey);\n prop.key = propertyKey;\n prop.type = typeString;\n };\n}\n\nexport function step(stepValue: number) {\n return function (target: any, propertyKey: string | symbol): void {\n const prop = getIDEPropsPropertyObj(target, propertyKey);\n prop.step = stepValue;\n };\n}\n"],"names":[],"mappings":";;AAAM,MAAO,2BAA4B,SAAQ,KAAK,CAAA;AACpD,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,oCAAoC,CAAC;QAE3C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;IACnD;AACD;;ACNM,MAAM,qBAAqB,GAAG,uBAAuB;AACrD,MAAM,+BAA+B,GAAG,iCAAiC;;ACGhF,SAAS,UAAU,CAAC,GAAY,EAAA;AAC9B,IAAA,OAAO,OAAO,GAAG,KAAK,UAAU;AAClC;AAEA,SAAS,kBAAkB,CAAC,IAAa,EAAA;AACvC,IAAA,IAAI,IAAI,KAAK,MAAM,EAAE;AACnB,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,IAAI,KAAK,MAAM,EAAE;AACnB,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,IAAI,KAAK,OAAO,EAAE;AACpB,QAAA,OAAO,SAAS;IAClB;AACA,IAAA,OAAO,SAAS;AAClB;AAEA,SAAS,WAAW,CAAC,MAAW,EAAE,GAAoB,EAAE,OAAqB,EAAE,kBAAmC,EAAA;AAChH,IAAA,IAAI,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,CAAC;AAC1D,IAAA,IAAI,OAAO,GAAG,IAAI,KAAK,KAAK;AAC5B,IAAA,MAAM,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC;AACpC,IAAA,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,IAAI,GAAG,GAAG;IACZ;IACA,IAAI,kBAAkB,EAAE;AACtB,QAAA,MAAM,UAAU,GAAG,kBAAkB,EAAE;AACvC,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC7B,OAAO,GAAG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AM,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE;IAC/C;IACA,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC;AACjD;AAEM,SAAU,IAAI,CAAC,UAAkB,EAAA;IACrC,OAAO,UAAU,MAAW,EAAE,WAA4B,EAAA;QACxD,MAAM,IAAI,GAAG,sBAAsB,CAAC,MAAM,EAAE,WAAW,CAAC;AACxD,QAAA,IAAI,CAAC,GAAG,GAAG,WAAW;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,UAAU;AACxB,IAAA,CAAC;AACH;AAEM,SAAU,IAAI,CAAC,SAAiB,EAAA;IACpC,OAAO,UAAU,MAAW,EAAE,WAA4B,EAAA;QACxD,MAAM,IAAI,GAAG,sBAAsB,CAAC,MAAM,EAAE,WAAW,CAAC;AACxD,QAAA,IAAI,CAAC,IAAI,GAAG,SAAS;AACvB,IAAA,CAAC;AACH;;;;"}
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./dist/inspector-decorator.cjs.prod.js');
5
+ } else {
6
+ module.exports = require('./dist/inspector-decorator.cjs.js');
7
+ }
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@combos-fun/inspector-decorator",
3
+ "version": "0.0.1",
4
+ "description": "Runtime decorators used by Combos Fun engine packages (Field + legacy type/step IDEProps).",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "index.js",
9
+ "module": "dist/inspector-decorator.esm.js",
10
+ "types": "dist/inspector-decorator.d.ts",
11
+ "files": [
12
+ "index.js",
13
+ "dist"
14
+ ],
15
+ "keywords": [
16
+ "combos-fun",
17
+ "decorators"
18
+ ],
19
+ "author": "sun668 <q947692259@gmail.com>",
20
+ "dependencies": {
21
+ "reflect-metadata": "^0.2.2",
22
+ "tslib": "^2.8.1"
23
+ },
24
+ "scripts": {
25
+ "build": "node ../../scripts/build-package.mjs"
26
+ }
27
+ }