@luna-park/plugin 1.4.2 → 1.5.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.
@@ -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
- } //#endregion
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 extends TSchema = TSchema> {
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<Static<T>>;
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
- interface TFunction<TInputs extends TObject = TObject, TOutput extends TSchema = TSchema, TPromise extends boolean = false> {
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<TInputs, TOutput, TPromise>;
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<Static<TLogic>>;
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>>>(items: T, args?: TArgs) => TArray<T> & TArgs;
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?: TArguments) => TExec;
154
- function: <TInputs extends TObject, TOutput extends TSchema = TUndefined, TPromise extends boolean = false>(inputs?: TInputs, output?: TOutput, args?: TArguments & {
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 = TSchema<TAnyLogic>>(key: TKey, value: TValue, args?: TArguments) => TRecord<TKey, TValue>;
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: <T extends TSchema>(target: Array<string>, args?: TArguments) => TType<T>;
163
- undefined: (args?: TArguments) => TUndefined;
164
- union: <T extends Array<TSchema>>(elements: T, args?: TArguments) => TUnion<T>;
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?: TArguments) => TVoid;
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 StaticObject<T extends TProperties> = { [K in RequiredKeys<T>]: Static<T[K]> } & { [K in OptionalKeys<T>]?: Static<T[K]> };
173
- type StaticRecord<TKey extends TSchema<TString> | TSchema<TNumber>, TValue extends TSchema> = Record<Static<TKey>, Static<TValue>>;
174
- type StaticUnion<T extends ReadonlyArray<TSchema>> = { [K in keyof T]: Static<T[K]> }[number];
175
- type StaticFunction<TInputs extends TObject, TOutput extends TSchema, TPromise extends boolean = false> = TPromise extends true ? (...args: Array<Static<TInputs>[string]>) => Promise<Static<TOutput>> : (...args: Array<Static<TInputs>[string]>) => Static<TOutput>;
176
- type Static<T extends TSchema> = T extends {
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: TObject, keys: Array<string>): TObject;
181
- partial(target: TObject, force?: boolean): TObject;
182
- pick(target: TObject, keys: Array<string>): TObject;
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: TObject): TObject;
185
- }; //#endregion
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;
@@ -214,6 +243,7 @@ type TNodeDisplay = {
214
243
  hoverable?: boolean;
215
244
  icon?: string | IconDefinition;
216
245
  inspector?: string;
246
+ interfaceBelow?: boolean;
217
247
  noDelete?: boolean;
218
248
  noSelection?: boolean;
219
249
  notFound?: boolean;
@@ -234,11 +264,11 @@ type TNodeIOSchema<TInterface extends TNodeInterfaceDescriptor> = { [TKey in key
234
264
  linked: boolean;
235
265
  schema: TOnlyVarsOf<TInterface>[TKey];
236
266
  value: Static<TOnlyVarsOf<TInterface>[TKey]>;
237
- } };
238
- type TNodeOptionals<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor> = { [TKey in keyof (TOnlyVarsOf<TInputs> | TOnlyVarsOf<TOutputs>)]: boolean };
267
+ }; };
268
+ type TNodeOptionals<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor> = { [TKey in keyof (TOnlyVarsOf<TInputs> | TOnlyVarsOf<TOutputs>)]: boolean; };
239
269
  type TNodeConfigSchema<TConfig extends TNodeConfigDescriptor> = {
240
270
  internal?: unknown;
241
- } & { [TKey in keyof TConfig]: Static<TConfig[TKey]> };
271
+ } & { [TKey in keyof TConfig]: Static<TConfig[TKey]>; };
242
272
  type TNodeDynamics<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor> = {
243
273
  inputs?: (ioSchema: {
244
274
  config: TNodeConfigSchema<TConfig>;
@@ -255,6 +285,7 @@ type TNodeDynamics<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TN
255
285
  };
256
286
  type TDocumentation = {
257
287
  description?: string;
288
+ dynamics?: string;
258
289
  examples?: Array<{
259
290
  inputs: Array<{
260
291
  key: string;
@@ -270,17 +301,18 @@ type TDocumentation = {
270
301
  name: string;
271
302
  }>;
272
303
  };
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] };
304
+ type TOnlyExecOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? TAnchor : never]: TNodeInterfaceDescriptor[TAnchor]; };
305
+ type TOnlyVarsOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? never : TAnchor]: TNodeInterfaceDescriptor[TAnchor]; };
275
306
  type MethodsFrom<TInterface extends TNodeInterfaceDescriptor> = { [TKey in keyof TInterface]: (() => MaybePromise<Static<TInterface[TKey]>>) | {
276
307
  async: () => Promise<Static<TInterface[TKey]>>;
277
308
  sync: () => MaybePromise<Static<TInterface[TKey]>>;
278
- } };
309
+ }; };
279
310
  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> } & { [TKey in keyof TOnlyVarsOf<TInputs>]: Static<TInputs[TKey]> } & { [TKey in keyof TOnlyVarsOf<TOutputs>]: Static<TOutputs[TKey]> } & Record<`internal_${string}`, unknown> & {
281
- arguments: Promise<Array<unknown>>;
311
+ 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> & {
312
+ arguments: Array<unknown>;
282
313
  cache: Record<string, unknown>;
283
- config: { [TKey in keyof TConfig]: Static<TConfig[TKey]> };
314
+ config: { [TKey in keyof TConfig]: Static<TConfig[TKey]>; };
315
+ instance: <TValue>(deps: Array<unknown>, factory: () => TValue, key?: string) => TValue;
284
316
  properties: Record<string, {
285
317
  name: string;
286
318
  value: Promise<unknown>;
@@ -299,7 +331,8 @@ type TNodeGenerated<TInputs extends TNodeInterfaceDescriptor, TOutputs extends T
299
331
  }>;
300
332
  entry?: boolean;
301
333
  generate?: (data: {
302
- config?: { [TKey in keyof TConfig]: Static<TConfig[TKey]> };
334
+ config?: { [TKey in keyof TConfig]: Static<TConfig[TKey]>; };
335
+ id?: string;
303
336
  inputKeys: Array<string>;
304
337
  key?: string;
305
338
  }) => string;
@@ -331,6 +364,7 @@ type TLogicNode = {
331
364
  entry?: boolean;
332
365
  generate?: (options: {
333
366
  config: Record<string, unknown>;
367
+ id?: string;
334
368
  inputKeys: Array<string>;
335
369
  key: string;
336
370
  }) => string;
@@ -362,7 +396,6 @@ type TLogicNode = {
362
396
  outputs: TNodeInterfaceDescriptor;
363
397
  type?: ELogicType;
364
398
  };
365
- declare function makeLogicNode<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor>(node: TNodeDescriptor<TInputs, TOutputs, TConfig>): TLogicNode; //#endregion
366
- //#region src/logic/lib.d.ts
399
+ declare function makeLogicNode<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor>(node: TNodeDescriptor<TInputs, TOutputs, TConfig>): TLogicNode;
367
400
  //#endregion
368
401
  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 };