@luna-park/plugin 1.4.1 → 1.5.0
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/bin/preview.js +50 -0
- package/dist/{dist-hc-SHkAg.mjs → dist-JzydDdZn.mjs} +97 -95
- package/dist/extractor.d.mts +6 -8
- package/dist/extractor.mjs +3 -4
- package/dist/{index-X3hhfmWd.d.mts → index-DwEOlEBY.d.mts} +75 -44
- package/dist/index.d.mts +616 -524
- package/dist/index.mjs +124 -70
- package/dist/preview.d.mts +2 -3
- package/package.json +26 -26
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
2
|
-
|
|
3
2
|
//#region ../utils/dist/index.d.mts
|
|
4
|
-
type DeepPartial<T> = { [K in keyof T]?: T[K] extends Array<unknown> ? Array<DeepPartial<T[K][number]>> : T[K] extends Record<string, unknown> ? DeepPartial<T[K]> : T[K] };
|
|
3
|
+
type DeepPartial<T> = { [K in keyof T]?: T[K] extends Array<unknown> ? Array<DeepPartial<T[K][number]>> : T[K] extends Record<string, unknown> ? DeepPartial<T[K]> : T[K]; };
|
|
5
4
|
type MaybePromise<T> = T | Promise<T>;
|
|
6
5
|
//#endregion
|
|
7
6
|
//#region src/vector.d.ts
|
|
@@ -27,7 +26,8 @@ declare class CVector {
|
|
|
27
26
|
isNearlyEqual(vector: TVector): boolean;
|
|
28
27
|
getPointString(): string;
|
|
29
28
|
getMagnitude(): number;
|
|
30
|
-
}
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region ../logicnodes/dist/index.d.mts
|
|
33
33
|
//#region src/logic/type.d.ts
|
|
@@ -67,7 +67,6 @@ interface TArguments<TType = unknown> {
|
|
|
67
67
|
optional?: boolean;
|
|
68
68
|
options?: {
|
|
69
69
|
access?: TSchema<TObject>;
|
|
70
|
-
format?: (arg: TType) => TType;
|
|
71
70
|
freeze?: boolean;
|
|
72
71
|
readonly?: boolean;
|
|
73
72
|
} & Record<string, unknown>;
|
|
@@ -124,14 +123,14 @@ interface TInterface<T = unknown> {
|
|
|
124
123
|
static: T;
|
|
125
124
|
type: EVarType.interface;
|
|
126
125
|
}
|
|
127
|
-
interface TType<T
|
|
126
|
+
interface TType<T = unknown> {
|
|
128
127
|
static: T;
|
|
129
128
|
target: Array<string>;
|
|
130
129
|
type: EVarType.type;
|
|
131
130
|
}
|
|
132
131
|
interface TArray<T extends TSchema = TSchema> {
|
|
133
132
|
items: T;
|
|
134
|
-
static: Array<
|
|
133
|
+
static: Array<StaticSchema<T>>;
|
|
135
134
|
type: EVarType.array;
|
|
136
135
|
}
|
|
137
136
|
interface TUnion<T extends ReadonlyArray<TSchema> = ReadonlyArray<TSchema>> {
|
|
@@ -139,50 +138,80 @@ interface TUnion<T extends ReadonlyArray<TSchema> = ReadonlyArray<TSchema>> {
|
|
|
139
138
|
static: StaticUnion<T>;
|
|
140
139
|
type: EVarType.union;
|
|
141
140
|
}
|
|
142
|
-
|
|
141
|
+
type TFunction<TInputs extends TObject = TObject, TOutput extends TSchema = TSchema, TPromise extends boolean = false, TParameters extends ReadonlyArray<TSchema> = ReadonlyArray<TSchema>> = {
|
|
143
142
|
inputs: TInputs;
|
|
144
143
|
output: TOutput;
|
|
145
|
-
static: StaticFunction<
|
|
144
|
+
static: StaticFunction<TParameters, TOutput, TPromise>;
|
|
146
145
|
type: EVarType.function;
|
|
147
|
-
}
|
|
148
|
-
type TAnyLogic = TExec | TObject | TRecord | TInterface | TType | TArray | TString | TNumber | TBoolean | TUnknown | TUndefined | TUnion | TFunction | TVoid;
|
|
149
|
-
type TSchema<TLogic extends TAnyLogic = TAnyLogic> = TLogic & TArguments
|
|
146
|
+
};
|
|
147
|
+
type TAnyLogic = TExec | TObject | TRecord<TString | TNumber> | TInterface | TType | TArray | TString | TNumber | TBoolean | TUnknown | TUndefined | TUnion | TFunction<TObject, TSchema, boolean, ReadonlyArray<never>> | TVoid;
|
|
148
|
+
type TSchema<TLogic extends TAnyLogic = TAnyLogic> = TLogic & TArguments;
|
|
150
149
|
declare const LogicType: {
|
|
151
|
-
array: <T extends TSchema, TArgs extends TArguments<Array<T
|
|
150
|
+
array: <T extends TSchema, TArgs extends TArguments<Array<StaticSchema<T>>>>(items: T, args?: TArgs) => TArray<T> & TArgs;
|
|
152
151
|
boolean: <TArgs extends TArguments<boolean>>(args?: TArgs) => TBoolean & TArgs;
|
|
153
|
-
exec: (args?:
|
|
154
|
-
function:
|
|
155
|
-
promise?: TPromise;
|
|
156
|
-
}) => TFunction<TInputs, TOutput, TPromise>;
|
|
152
|
+
exec: <const TArgs extends TArguments = {}>(args?: TArgs) => TExec & TArgs;
|
|
153
|
+
function: typeof createFunction;
|
|
157
154
|
interface: <T = unknown, TArgs extends TArguments<T> = TArguments<T>>(interfaceClass: (new (...args: Array<unknown>) => T) | string, args?: TArgs) => TInterface<T> & TArgs;
|
|
158
155
|
number: <TArgs extends TArguments<number>>(args?: TArgs) => TNumber & TArgs;
|
|
159
156
|
object: <T extends TProperties, TArgs extends TArguments<object>>(properties?: T, args?: TArgs) => TObject<T> & TArgs;
|
|
160
|
-
record: <TKey extends TString | TNumber, TValue extends TSchema
|
|
157
|
+
record: <TKey extends TString | TNumber, TValue extends TSchema, const TArgs extends TArguments<StaticRecord<TKey, TValue>> = {}>(key: TKey, value: TValue, args?: TArgs) => TRecord<TKey, TValue> & TArgs;
|
|
161
158
|
string: <TArgs extends TArguments<string>>(args?: TArgs) => TString & TArgs;
|
|
162
|
-
type:
|
|
163
|
-
undefined: (args?:
|
|
164
|
-
union: <T extends
|
|
159
|
+
type: typeof createType;
|
|
160
|
+
undefined: <const TArgs extends TArguments<undefined> = {}>(args?: TArgs) => TUndefined & TArgs;
|
|
161
|
+
union: <const T extends ReadonlyArray<TSchema>, const TArgs extends TArguments<StaticUnion<T>> = {}>(elements: T, args?: TArgs) => TUnion<T> & TArgs;
|
|
165
162
|
unknown: <TArgs extends TArguments>(args?: TArgs) => TUnknown & TArgs;
|
|
166
|
-
void: (args?:
|
|
163
|
+
void: <const TArgs extends TArguments<void> = {}>(args?: TArgs) => TVoid & TArgs;
|
|
167
164
|
};
|
|
168
165
|
type OptionalKeys<T extends TProperties> = { [K in keyof T]: T[K] extends {
|
|
169
166
|
optional: true;
|
|
170
|
-
} ? K : never }[keyof T];
|
|
167
|
+
} ? K : never; }[keyof T];
|
|
171
168
|
type RequiredKeys<T extends TProperties> = Exclude<keyof T, OptionalKeys<T>>;
|
|
172
|
-
type
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
type
|
|
176
|
-
type
|
|
169
|
+
type StaticSchema<T extends TSchema> = [TSchema] extends [T] ? unknown : T extends {
|
|
170
|
+
static: unknown;
|
|
171
|
+
} ? Static<T> : unknown;
|
|
172
|
+
type StaticObject<T extends TProperties> = string extends keyof T ? Record<string, unknown> : { [K in RequiredKeys<T>]: StaticSchema<T[K]>; } & { [K in OptionalKeys<T>]?: StaticSchema<T[K]>; };
|
|
173
|
+
type StaticRecord<TKey extends TSchema<TString> | TSchema<TNumber>, TValue extends TSchema> = Record<StaticSchema<TKey> & (string | number), StaticSchema<TValue>>;
|
|
174
|
+
type StaticUnion<T extends ReadonlyArray<TSchema>> = StaticSchema<T[number]>;
|
|
175
|
+
type TStaticParameters<T extends ReadonlyArray<TSchema>> = number extends T["length"] ? Array<StaticSchema<T[number]>> : T extends readonly [...infer TRest extends ReadonlyArray<TSchema>, infer TLast extends TSchema] ? TLast extends {
|
|
176
|
+
optional: true;
|
|
177
|
+
} ? [...TStaticParameters<TRest>, StaticSchema<TLast>?] : [...TStaticParameters<TRest>, StaticSchema<TLast>] : [];
|
|
178
|
+
type StaticFunction<TParameters extends ReadonlyArray<TSchema>, TOutput extends TSchema, TPromise extends boolean = false> = TPromise extends true ? (...args: TStaticParameters<TParameters>) => Promise<StaticSchema<TOutput>> : (...args: TStaticParameters<TParameters>) => StaticSchema<TOutput>;
|
|
179
|
+
type TFunctionEntries = ReadonlyArray<readonly [string, TSchema]>;
|
|
180
|
+
type TEntryProperties<T extends TFunctionEntries> = { [TEntry in T[number] as TEntry[0]]: TEntry[1]; };
|
|
181
|
+
type TEntryParameters<T extends TFunctionEntries> = { [K in keyof T]: T[K][1]; };
|
|
182
|
+
type TObjectParameters<T extends TObject> = keyof T["properties"] extends never ? ReadonlyArray<TSchema> : ReadonlyArray<T["properties"][keyof T["properties"]]>;
|
|
183
|
+
type TFunctionPromise<T extends TArguments> = "promise" extends keyof T ? Exclude<T["promise"], undefined> : false;
|
|
184
|
+
declare function createFunction<const TEntries extends TFunctionEntries = [], TOutput extends TSchema = TVoid, const TArgs extends TArguments = {}>(inputs?: TEntries, output?: TOutput, args?: TArgs): TFunction<TObject<TEntryProperties<TEntries>>, TOutput, TFunctionPromise<TArgs>, TEntryParameters<TEntries>> & TArgs;
|
|
185
|
+
declare function createFunction<TInputs extends TObject, TOutput extends TSchema = TVoid, const TArgs extends TArguments = {}>(inputs: TInputs, output?: TOutput, args?: TArgs): TFunction<TInputs, TOutput, TFunctionPromise<TArgs>, TObjectParameters<TInputs>> & TArgs;
|
|
186
|
+
declare function createType<T, const TArgs extends TArguments<T> & {
|
|
187
|
+
optional: true;
|
|
188
|
+
} = TArguments<T> & {
|
|
189
|
+
optional: true;
|
|
190
|
+
}>(target: Array<string>, args: TArgs): TType<T> & TArgs;
|
|
191
|
+
declare function createType<T, const TArgs extends TArguments<T> = TArguments<T>>(target: Array<string>, args?: TArgs): TType<T> & TArgs;
|
|
192
|
+
type Static<T extends {
|
|
193
|
+
optional?: boolean;
|
|
194
|
+
static: unknown;
|
|
195
|
+
}> = T extends {
|
|
177
196
|
optional: true;
|
|
178
197
|
} ? (T["static"] | undefined) : T["static"];
|
|
198
|
+
type TTransformedObject<TTarget extends TObject, T extends TProperties> = Omit<TTarget, "properties" | "static"> & TObject<T>;
|
|
199
|
+
type TWithOptional<T extends TSchema, TOptional extends boolean> = T extends TSchema ? Omit<T, "optional"> & {
|
|
200
|
+
optional: TOptional;
|
|
201
|
+
} : never;
|
|
202
|
+
type TPartialOptional<T extends TSchema> = T["required"] extends true ? false : true extends T["required"] ? boolean : true;
|
|
203
|
+
type TPartialProperties<T extends TProperties, TForce extends boolean> = TForce extends true ? { [K in keyof T]: TWithOptional<T[K], TPartialOptional<T[K]>>; } : { [K in keyof T]: TWithOptional<T[K], true>; };
|
|
204
|
+
type TRequiredProperties<T extends TProperties> = { [K in keyof T]: TWithOptional<T[K], false>; };
|
|
205
|
+
type TPickedProperties<T extends TProperties, TKeys extends ReadonlyArray<string>> = number extends TKeys["length"] ? TProperties : Pick<T, Extract<TKeys[number], keyof T>>;
|
|
206
|
+
type TOmittedProperties<T extends TProperties, TKeys extends ReadonlyArray<string>> = number extends TKeys["length"] ? TProperties : Omit<T, TKeys[number]>;
|
|
179
207
|
declare const LogicUtil: {
|
|
180
|
-
omit(target:
|
|
181
|
-
partial(target:
|
|
182
|
-
pick(target:
|
|
208
|
+
omit<TTarget extends TObject, const TKeys extends ReadonlyArray<string>>(target: TTarget, keys: TKeys): TTransformedObject<TTarget, TOmittedProperties<TTarget["properties"], TKeys>>;
|
|
209
|
+
partial<TTarget extends TObject, TForce extends boolean = false>(target: TTarget, force?: TForce): TTransformedObject<TTarget, TPartialProperties<TTarget["properties"], TForce>>;
|
|
210
|
+
pick<TTarget extends TObject, const TKeys extends ReadonlyArray<string>>(target: TTarget, keys: TKeys): TTransformedObject<TTarget, TPickedProperties<TTarget["properties"], TKeys>>;
|
|
183
211
|
promise(target: TSchema): TSchema;
|
|
184
|
-
required(target:
|
|
185
|
-
};
|
|
212
|
+
required<TTarget extends TObject>(target: TTarget): TTransformedObject<TTarget, TRequiredProperties<TTarget["properties"]>>;
|
|
213
|
+
};
|
|
214
|
+
//#endregion
|
|
186
215
|
//#region src/logic/node.d.ts
|
|
187
216
|
type Component = {
|
|
188
217
|
name: string;
|
|
@@ -234,11 +263,11 @@ type TNodeIOSchema<TInterface extends TNodeInterfaceDescriptor> = { [TKey in key
|
|
|
234
263
|
linked: boolean;
|
|
235
264
|
schema: TOnlyVarsOf<TInterface>[TKey];
|
|
236
265
|
value: Static<TOnlyVarsOf<TInterface>[TKey]>;
|
|
237
|
-
} };
|
|
238
|
-
type TNodeOptionals<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor> = { [TKey in keyof (TOnlyVarsOf<TInputs> | TOnlyVarsOf<TOutputs>)]: boolean };
|
|
266
|
+
}; };
|
|
267
|
+
type TNodeOptionals<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor> = { [TKey in keyof (TOnlyVarsOf<TInputs> | TOnlyVarsOf<TOutputs>)]: boolean; };
|
|
239
268
|
type TNodeConfigSchema<TConfig extends TNodeConfigDescriptor> = {
|
|
240
269
|
internal?: unknown;
|
|
241
|
-
} & { [TKey in keyof TConfig]: Static<TConfig[TKey]
|
|
270
|
+
} & { [TKey in keyof TConfig]: Static<TConfig[TKey]>; };
|
|
242
271
|
type TNodeDynamics<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor> = {
|
|
243
272
|
inputs?: (ioSchema: {
|
|
244
273
|
config: TNodeConfigSchema<TConfig>;
|
|
@@ -270,17 +299,18 @@ type TDocumentation = {
|
|
|
270
299
|
name: string;
|
|
271
300
|
}>;
|
|
272
301
|
};
|
|
273
|
-
type TOnlyExecOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? TAnchor : never]: TNodeInterfaceDescriptor[TAnchor] };
|
|
274
|
-
type TOnlyVarsOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? never : TAnchor]: TNodeInterfaceDescriptor[TAnchor] };
|
|
302
|
+
type TOnlyExecOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? TAnchor : never]: TNodeInterfaceDescriptor[TAnchor]; };
|
|
303
|
+
type TOnlyVarsOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? never : TAnchor]: TNodeInterfaceDescriptor[TAnchor]; };
|
|
275
304
|
type MethodsFrom<TInterface extends TNodeInterfaceDescriptor> = { [TKey in keyof TInterface]: (() => MaybePromise<Static<TInterface[TKey]>>) | {
|
|
276
305
|
async: () => Promise<Static<TInterface[TKey]>>;
|
|
277
306
|
sync: () => MaybePromise<Static<TInterface[TKey]>>;
|
|
278
|
-
} };
|
|
307
|
+
}; };
|
|
279
308
|
type TMethodsOf<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor> = MethodsFrom<TOnlyExecOf<TInputs>> & MethodsFrom<TOnlyVarsOf<TOutputs>>;
|
|
280
|
-
type TNodeDescriptor<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor> = TNodeGenerated<TInputs, TOutputs, TConfig> & ThisType<{ [TKey in keyof TOnlyExecOf<TOutputs>]: (stack?: unknown) => Promise<void
|
|
281
|
-
arguments:
|
|
309
|
+
type TNodeDescriptor<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor> = TNodeGenerated<TInputs, TOutputs, TConfig> & ThisType<{ [TKey in keyof TOnlyExecOf<TOutputs>]: (stack?: unknown) => Promise<void>; } & { [TKey in keyof TOnlyVarsOf<TInputs>]: Static<TInputs[TKey]>; } & { [TKey in keyof TOnlyVarsOf<TOutputs>]: Static<TOutputs[TKey]>; } & Record<`internal_${string}`, unknown> & {
|
|
310
|
+
arguments: Array<unknown>;
|
|
282
311
|
cache: Record<string, unknown>;
|
|
283
|
-
config: { [TKey in keyof TConfig]: Static<TConfig[TKey]
|
|
312
|
+
config: { [TKey in keyof TConfig]: Static<TConfig[TKey]>; };
|
|
313
|
+
instance: <TValue>(deps: Array<unknown>, factory: () => TValue, key?: string) => TValue;
|
|
284
314
|
properties: Record<string, {
|
|
285
315
|
name: string;
|
|
286
316
|
value: Promise<unknown>;
|
|
@@ -299,7 +329,8 @@ type TNodeGenerated<TInputs extends TNodeInterfaceDescriptor, TOutputs extends T
|
|
|
299
329
|
}>;
|
|
300
330
|
entry?: boolean;
|
|
301
331
|
generate?: (data: {
|
|
302
|
-
config?: { [TKey in keyof TConfig]: Static<TConfig[TKey]
|
|
332
|
+
config?: { [TKey in keyof TConfig]: Static<TConfig[TKey]>; };
|
|
333
|
+
id?: string;
|
|
303
334
|
inputKeys: Array<string>;
|
|
304
335
|
key?: string;
|
|
305
336
|
}) => string;
|
|
@@ -331,6 +362,7 @@ type TLogicNode = {
|
|
|
331
362
|
entry?: boolean;
|
|
332
363
|
generate?: (options: {
|
|
333
364
|
config: Record<string, unknown>;
|
|
365
|
+
id?: string;
|
|
334
366
|
inputKeys: Array<string>;
|
|
335
367
|
key: string;
|
|
336
368
|
}) => string;
|
|
@@ -362,7 +394,6 @@ type TLogicNode = {
|
|
|
362
394
|
outputs: TNodeInterfaceDescriptor;
|
|
363
395
|
type?: ELogicType;
|
|
364
396
|
};
|
|
365
|
-
declare function makeLogicNode<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor>(node: TNodeDescriptor<TInputs, TOutputs, TConfig>): TLogicNode;
|
|
366
|
-
//#region src/logic/lib.d.ts
|
|
397
|
+
declare function makeLogicNode<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor>(node: TNodeDescriptor<TInputs, TOutputs, TConfig>): TLogicNode;
|
|
367
398
|
//#endregion
|
|
368
399
|
export { LogicUtil as a, TObject as c, makeLogicNode as d, CVector as f, TVector as h, LogicType as i, TSchema as l, MaybePromise as m, ELogicType as n, Static as o, DeepPartial as p, EVarType as r, TLogicNode as s, ELogicScope as t, TVoid as u };
|