@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.
package/dist/index.d.mts CHANGED
@@ -1,16 +1,16 @@
1
- import { a as LogicUtil, c as TObject, d as makeLogicNode, f as CVector, h as TVector, i as LogicType, l as TSchema, m as MaybePromise, n as ELogicType, o as Static, p as DeepPartial, r as EVarType, s as TLogicNode, t as ELogicScope, u as TVoid } from "./index-X3hhfmWd.mjs";
2
- import * as _$vue from "vue";
1
+ import { a as LogicUtil, c as TObject, d as makeLogicNode, f as CVector, h as TVector, i as LogicType, l as TSchema, m as MaybePromise, n as ELogicType, o as Static, p as DeepPartial, r as EVarType, s as TLogicNode, t as ELogicScope, u as TVoid } from "./index-DQhxmFHB.mjs";
2
+ import "typescript";
3
3
  import { Component, ComputedRef } from "vue";
4
+ import "@sinclair/typebox";
4
5
  import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
5
- import { PGliteWorker } from "@electric-sql/pglite/worker";
6
6
  import { Cron } from "lite-cron";
7
-
7
+ import { PGliteWorker } from "@electric-sql/pglite/worker";
8
8
  //#region src/components/LSettingsStoryWrapper.vue.d.ts
9
9
  declare var __VLS_1: {};
10
10
  type __VLS_Slots = {} & {
11
11
  default?: (props: typeof __VLS_1) => any;
12
12
  };
13
- declare const __VLS_base: _$vue.DefineComponent<{}, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
13
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
14
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
15
  declare const _default: typeof __VLS_export;
16
16
  type __VLS_WithSlots<T, S> = T & {
@@ -24,7 +24,7 @@ type TSlot = TSchema<TObject> | TSchema<TVoid>;
24
24
  type StaticOfProps<T extends Record<string, TSchema>> = { [K in keyof T]: {
25
25
  schema: TSchema;
26
26
  value: Static<T[K]>;
27
- } };
27
+ }; };
28
28
  type TComponent<TProps extends Record<string, TSchema> = Record<string, TSchema>, TInternals = unknown> = {
29
29
  build?: {
30
30
  imports?: Array<{
@@ -42,10 +42,11 @@ type TComponent<TProps extends Record<string, TSchema> = Record<string, TSchema>
42
42
  emits?: Record<string, TSchema>;
43
43
  icon?: IconDefinition | string;
44
44
  internals?: TInternals;
45
+ llm?: string;
45
46
  models?: Record<string, TSchema>;
46
47
  name: string;
47
48
  preview?: {
48
- properties?: Partial<{ [TKey in keyof TProps]: Static<TProps[TKey]> }>;
49
+ properties?: Partial<{ [TKey in keyof TProps]: Static<TProps[TKey]>; }>;
49
50
  slots?: Record<string, string>;
50
51
  style?: string;
51
52
  };
@@ -55,12 +56,51 @@ type TComponent<TProps extends Record<string, TSchema> = Record<string, TSchema>
55
56
  }) => Record<string, TSlot>);
56
57
  };
57
58
  //#endregion
59
+ //#region src/types/guard.d.ts
60
+ type TRouteGuard = {
61
+ build: {
62
+ generate: (config: Record<string, unknown>) => string;
63
+ imports?: Array<{
64
+ name: string;
65
+ target: string;
66
+ }>;
67
+ };
68
+ check: (params: {
69
+ config: Record<string, unknown>;
70
+ context: Record<string, unknown>;
71
+ }) => MaybePromise<void>;
72
+ config?: TSchema<TObject>;
73
+ description?: string;
74
+ id: string;
75
+ label: string;
76
+ };
77
+ //#endregion
58
78
  //#region src/types/hooks.d.ts
59
- declare enum EPluginHooks {
79
+ export declare enum EPluginHooks {
60
80
  BackendMiddleware = "backend/middleware",
61
- BackendInputNode = "backend/input-node"
81
+ BackendInputNode = "backend/input-node",
82
+ DatabaseScope = "database/scope",
83
+ DatabaseChange = "database/change"
62
84
  }
85
+ type TDatabaseCondition = {
86
+ operation: string;
87
+ source: Array<string>;
88
+ target: unknown;
89
+ type: "value" | "column";
90
+ } | {
91
+ conditions: Array<TDatabaseCondition>;
92
+ type: "and" | "or";
93
+ };
63
94
  type THookParams = {
95
+ [EPluginHooks.DatabaseScope]: {
96
+ addConditions: (conditions: Array<TDatabaseCondition>) => void;
97
+ table: string;
98
+ };
99
+ [EPluginHooks.DatabaseChange]: {
100
+ operation: "insert" | "update" | "delete";
101
+ rows: Array<Record<string, unknown>>;
102
+ table: string;
103
+ };
64
104
  [EPluginHooks.BackendMiddleware]: {
65
105
  cookies: Record<string, {
66
106
  options?: Record<string, unknown>;
@@ -73,37 +113,6 @@ type THookParams = {
73
113
  };
74
114
  };
75
115
  //#endregion
76
- //#region ../shared/dist/layout-w4K7EDPE.d.mts
77
- declare enum ELayoutElement {
78
- input = "input",
79
- div = "div",
80
- media = "media",
81
- customText = "customText",
82
- component = "component",
83
- package = "package",
84
- customHtml = "customHtml",
85
- slot = "slot",
86
- template = "template",
87
- variable = "variable",
88
- link = "link"
89
- }
90
- declare enum ELayoutEvent {
91
- click = "click",
92
- keydown = "keydown",
93
- mouseenter = "mouseenter",
94
- mouseleave = "mouseleave",
95
- mousedown = "mousedown",
96
- mouseup = "mouseup",
97
- mousemove = "mousemove",
98
- wheel = "wheel"
99
- }
100
- //#endregion
101
- //#region src/layout/template.d.ts
102
- declare enum EElementTemplate {
103
- If = "if",
104
- For = "for"
105
- } //#endregion
106
- //#endregion
107
116
  //#region ../logic-dts/dist/nodes.d.ts
108
117
  type TExportNodeFunction = {
109
118
  name?: string;
@@ -120,89 +129,13 @@ type TExportNodeResult = {
120
129
  types: Record<string, TSchema>;
121
130
  };
122
131
  //#endregion
123
- //#region ../shared/dist/index.d.mts
132
+ //#region ../shared/dist/index-D4yemxKH.d.mts
124
133
  //#endregion
125
- //#region src/types/editor/node.d.ts
126
- type TBaseNode = {
127
- id: string;
128
- data?: object;
129
- dbNode: TGeneratedNode;
130
- inputs: Record<string, CNodeAnchor>;
131
- location: TVector;
132
- outputs: Record<string, CNodeAnchor>;
133
- };
134
- type TGeneratedNode<TLogic extends TLogicNode = TLogicNode> = TLogic & {
135
- node?: CNode;
136
- origin: TLogic;
137
- proxy: any;
138
- };
139
- type TNodeData = {
140
- config?: Record<string, unknown>;
141
- multiple?: {
142
- isArray?: boolean;
143
- number: number;
144
- };
145
- optionals?: Record<string, boolean>;
146
- size?: TVector;
147
- } & Record<string, unknown>;
148
- declare class CNode {
149
- id: string;
150
- dbNode: TGeneratedNode;
151
- element?: HTMLElement;
152
- invert: boolean;
153
- parent?: TAnyLogic;
154
- config: {
155
- animate: boolean;
156
- processing: boolean;
157
- };
158
- inputs: Record<string, CNodeAnchor>;
159
- outputs: Record<string, CNodeAnchor>;
160
- cache: {
161
- location?: CVector;
162
- relativeLocation?: CVector;
163
- reloadKey: number;
164
- size?: CVector;
165
- };
166
- _data: TNodeData;
167
- constructor(node: TBaseNode);
168
- get orderedInputs(): Array<CNodeAnchor>;
169
- get orderedOutputs(): Array<CNodeAnchor>;
170
- set location(location: TVector);
171
- get location(): TVector;
172
- reload(): void;
173
- getSafeInputs(): Record<string, CNodeAnchor>;
174
- getSafeOutputs(): Record<string, CNodeAnchor>;
175
- set data(data: Record<string, unknown>);
176
- get data(): TNodeData;
177
- reset(): void;
178
- setLocation(location: TVector): CNode;
179
- getAnchorLocation(anchor: CNodeAnchor): CVector;
180
- getRelativeAnchorLocation(anchor: CNodeAnchor): CVector;
181
- getRelativeAnchorLocation_internal(anchor: CNodeAnchor): CVector;
182
- getLocation(): CVector;
183
- getSize(): TVector;
184
- execute(outputKey: string, stack?: TStack): MaybePromise<void>;
185
- get isAsync(): boolean;
186
- getInput(inputKey: string, stack?: TStack): unknown;
187
- setOutput(outputKey: string, value: unknown, stack?: TStack): void;
188
- }
189
- type TNode<TExport extends boolean = false> = TExport extends true ? {
190
- data?: Record<string, unknown>;
191
- internal?: {
192
- inputs?: Record<string, unknown>;
193
- outputs?: Record<string, unknown>;
194
- };
195
- location: TVector;
196
- logic: string;
197
- } : CNode; //#endregion
198
134
  //#region src/types/editor/wire.d.ts
199
135
  declare class CPathPoint {
200
136
  direction: CVector;
201
137
  location: CVector;
202
- constructor({
203
- direction,
204
- location
205
- }: {
138
+ constructor({ direction, location }: {
206
139
  direction: TVector;
207
140
  location: TVector;
208
141
  });
@@ -210,7 +143,7 @@ declare class CPathPoint {
210
143
  reverse: boolean;
211
144
  }): CPathPoint;
212
145
  }
213
- type Path = Array<CPathPoint>;
146
+ type TPath = Array<CPathPoint>;
214
147
  declare class CWire {
215
148
  id: string;
216
149
  from: CAnchor;
@@ -225,7 +158,7 @@ declare class CWire {
225
158
  get type(): TSchema;
226
159
  get toType(): TSchema;
227
160
  getPoints(): string;
228
- registerRibbon(path: Path): void;
161
+ registerRibbon(path: TPath): void;
229
162
  }
230
163
  type TWire<TExport extends boolean = false> = TExport extends true ? {
231
164
  from: {
@@ -236,65 +169,8 @@ type TWire<TExport extends boolean = false> = TExport extends true ? {
236
169
  key: string;
237
170
  node: string;
238
171
  };
239
- } : CWire; //#endregion
240
- //#region src/types/editor/anchor.d.ts
241
- type TDBAnchor = {
242
- id?: string;
243
- schema: TSchema;
244
- };
245
- declare enum EAnchorDirection {
246
- input = "input",
247
- output = "output",
248
- none = "none"
249
- }
250
- declare class CAnchor {
251
- connections: Array<CWire>;
252
- dbAnchor: TDBAnchor;
253
- padding?: number;
254
- protected constructor(anchor: {
255
- connections?: Array<CWire>;
256
- dbAnchor: TDBAnchor;
257
- padding?: number;
258
- });
259
- getLocation(): TVector;
260
- getPadding(): number;
261
- get schema(): TSchema;
262
- get schemaRaw(): TSchema;
263
- get toSchema(): TSchema;
264
- }
265
- declare class CNodeAnchor extends CAnchor {
266
- key: string;
267
- index: number;
268
- node: CNode;
269
- direction: EAnchorDirection;
270
- value: unknown;
271
- element?: HTMLElement;
272
- cache: {
273
- preview?: unknown;
274
- relativeLocation?: CVector;
275
- };
276
- constructor(anchor: {
277
- connections?: Array<CWire>;
278
- dbAnchor: TDBAnchor;
279
- direction: EAnchorDirection;
280
- element?: HTMLElement;
281
- index: number;
282
- key: string;
283
- node: CNode;
284
- padding?: number;
285
- });
286
- get schema(): TSchema;
287
- get toSchema(): TSchema;
288
- get schemaRaw(): TSchema;
289
- getLocation(): CVector;
290
- getRelativeLocation(): CVector;
291
- resetCache(): void;
292
- getPadding(): number;
293
- isDisabled(): boolean;
294
- errorMessage(): string | undefined;
295
- setValue(value: string | number | boolean): void;
296
- resetValue(): void;
297
- } //#endregion
172
+ } : CWire;
173
+ //#endregion
298
174
  //#region src/types/file.d.ts
299
175
  declare enum EElementType {
300
176
  Script = "script",
@@ -312,46 +188,34 @@ declare enum EElementType {
312
188
  Cron = "cron",
313
189
  Media = "media"
314
190
  }
315
- /**
316
- * Check if the source scope is compatible with the target scope
317
- * @param source - The source scope (from)
318
- * @param target - The target scope (to)
319
- */
320
191
  //#endregion
321
- //#region src/types/files/folder.d.ts
322
- type TFolder<TExport extends boolean = false> = TFileBase<TExport> & {
323
- type: EElementType.Folder;
324
- children: Record<string, TFile<TExport>>;
325
- color?: string;
326
- }; //#endregion
327
- //#region src/types/files/common.d.ts
328
- type TFileState = {
329
- expand?: boolean;
330
- isEditing?: boolean;
331
- logic?: {
332
- location: TVector;
333
- zoom: number;
334
- };
335
- opened?: boolean;
336
- panel?: string;
192
+ //#region src/types/files/config.d.ts
193
+ type TFileConfig<TExport extends boolean = false> = TFileBase<TExport> & {
194
+ type: EElementType.Config;
195
+ content: unknown;
196
+ display: EConfigDisplay;
197
+ schema: TSchema;
198
+ scope: ELogicScope;
337
199
  };
338
- type TFileBase<TExport extends boolean = false> = {
339
- name: string;
340
- state: TFileState;
341
- } & (TExport extends false ? {
342
- id: string;
343
- parent?: TFolder<TExport>;
344
- } : {}); //#endregion
345
- //#region src/types/files/database.d.ts
346
- type TFileDatabase<TExport extends boolean = false> = TFileBase<TExport> & {
347
- type: EElementType.Database;
348
- data: Array<Record<string, unknown>>;
349
- schema: TSchema<TObject>;
350
- } & (TExport extends false ? {
351
- db: CDatabase;
200
+ declare enum EConfigDisplay {
201
+ Smart = "smart",
202
+ Performance = "performance"
203
+ }
204
+ //#endregion
205
+ //#region src/types/files/cron.d.ts
206
+ type TFileCron<TExport extends boolean = false> = TFileBase<TExport> & {
207
+ type: EElementType.Cron;
208
+ active: boolean;
209
+ editorTrigger: boolean;
210
+ logics: Record<string, TAnyLogic<TExport>>;
211
+ time: string;
212
+ } & TRuntimeOnly<TExport, {
213
+ cron?: Cron;
352
214
  scope: ELogicScope.Backend;
353
- } : {}); //#endregion
215
+ }>;
216
+ //#endregion
354
217
  //#region src/types/editor/database.d.ts
218
+ type TDatabaseRow = Record<string, unknown>;
355
219
  type TQueryValue = string | number | boolean;
356
220
  type TQueryOperation = Record<string, {
357
221
  $eq?: TQueryValue;
@@ -387,283 +251,60 @@ declare class CDatabase {
387
251
  exist: boolean;
388
252
  constructor(file: TFileDatabase);
389
253
  init(): Promise<void>;
390
- findById(id: string): Promise<Record<string, unknown> | undefined>;
391
- find(filter: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
392
- findWithQuery(query: TQuery, options?: TQueryOptions): Promise<Array<Record<string, unknown>>>;
393
- updateById(id: string, data: Record<string, unknown>): Promise<void>;
394
- update(filter: Record<string, unknown>, data: Record<string, unknown>): Promise<void>;
395
- updateWithQuery(query: TQuery, data: Record<string, unknown>): Promise<void>;
396
- deleteById(id: string): Promise<Record<string, unknown> | undefined>;
397
- delete(filter: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
398
- deleteWithQuery(query: TQuery): Promise<Record<string, unknown> | undefined>;
399
- insert(data: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
400
- toRealKey(row: Record<string, unknown>): Record<string, unknown>;
401
- toSchemaKey(row: Record<string, unknown>): Record<string, unknown>;
254
+ findById(id: string): Promise<TDatabaseRow | undefined>;
255
+ find(filter: TDatabaseRow): Promise<Array<TDatabaseRow>>;
256
+ findWithQuery(query: TQuery, options?: TQueryOptions): Promise<Array<TDatabaseRow>>;
257
+ updateById(id: string, data: TDatabaseRow): Promise<void>;
258
+ update(filter: TDatabaseRow, data: TDatabaseRow): Promise<void>;
259
+ updateWithQuery(query: TQuery, data: TDatabaseRow): Promise<void>;
260
+ deleteById(id: string): Promise<TDatabaseRow | undefined>;
261
+ delete(filter: TDatabaseRow): Promise<TDatabaseRow | undefined>;
262
+ deleteWithQuery(query: TQuery): Promise<TDatabaseRow | undefined>;
263
+ insert(data: TDatabaseRow): Promise<TDatabaseRow | undefined>;
264
+ toRealKey(row: TDatabaseRow): TDatabaseRow;
265
+ toSchemaKey(row: TDatabaseRow): TDatabaseRow;
402
266
  updateColumns(init: boolean): Promise<void>;
403
- save(): Promise<Array<Record<string, unknown>> | unknown>;
267
+ save(): Promise<Array<TDatabaseRow>>;
404
268
  load(): Promise<void>;
405
- getUpdate(data: Record<string, unknown>): unknown;
406
- getQueryFilter(filter: Record<string, unknown>): unknown;
269
+ getUpdate(data: TDatabaseRow): unknown;
270
+ getQueryFilter(filter: TDatabaseRow): unknown;
407
271
  getQueryOptions(options?: TQueryOptions): unknown;
408
272
  getQuery(query: TQuery): unknown;
409
273
  getOperation(query: TQueryOperation): unknown;
410
- } //#endregion
411
- //#region src/types/editor/stack.d.ts
412
- type TStackParent = {
413
- logic?: TLogic;
414
- node?: CNode;
415
- stack: TStack;
274
+ }
275
+ //#endregion
276
+ //#region src/types/files/database.d.ts
277
+ type TFileDatabase<TExport extends boolean = false> = TFileBase<TExport> & {
278
+ type: EElementType.Database;
279
+ data: Array<TDatabaseRow>;
280
+ schema: TSchema<TObject>;
281
+ } & TRuntimeOnly<TExport, {
282
+ db: CDatabase;
283
+ scope: ELogicScope.Backend;
284
+ }>;
285
+ //#endregion
286
+ //#region src/types/files/media.d.ts
287
+ type TFileMedia<TExport extends boolean = false> = TFileBase<TExport> & {
288
+ type: EElementType.Media;
289
+ mimeType: string;
290
+ target: string;
291
+ previewUrl?: string;
416
292
  };
417
- type TStack = {
418
- id: string;
419
- config?: Record<string, unknown>;
420
- context: object;
421
- parent?: TStackParent;
422
- variables: Record<string, unknown>;
423
- }; //#endregion
424
- //#region src/types/logic.d.ts
425
- declare enum ELogicMode {
426
- Pure = "pure",
427
- Macro = "macro",
428
- Code = "code"
293
+ //#endregion
294
+ //#region src/types/files/route.d.ts
295
+ declare enum ERouteMethod {
296
+ Get = "get",
297
+ Post = "post",
298
+ Put = "put",
299
+ Delete = "delete"
429
300
  }
430
- type TLogicBase<TExport extends boolean = false> = {
431
- name: string;
432
- type: EElementType;
433
- graph: TGraph<TExport>;
434
- values: {
435
- variables: Record<string, TValue<TExport>>;
436
- };
437
- } & (TExport extends false ? {
301
+ type TRouteGuardRef = {
438
302
  id: string;
439
- db: Record<string, TLogicNode>;
440
- isEditing?: boolean;
441
- parent: TFile<TExport>;
442
- } : {});
443
- type TLogic<TExport extends boolean = false> = TLogicBase<TExport> & {
444
- type: EElementType.Logic | EElementType.Standalone;
445
- async: boolean;
446
- code?: string;
447
- export: boolean;
448
- inputs: Record<string, TAnchor<TExport>>;
449
- mode: ELogicMode;
450
- outputs: Record<string, TAnchor<TExport>>;
451
- packages?: Array<string>;
452
- } & (TExport extends false ? {
453
- id: string;
454
- } : {});
455
- type TLogicMain<TExport extends boolean = false> = TLogicBase<TExport> & {
456
- name: "Main";
457
- type: EElementType.MainLogic;
458
- } & (TExport extends false ? {
459
- id: "main";
460
- } : {});
461
- type TCanvas = {
462
- location: TVector;
463
- zoom: number;
464
- };
465
- type TGraph<TExport extends boolean = false> = {
466
- canvas: TCanvas;
467
- nodes: Record<string, TNode<TExport>>;
468
- wires: Record<string, TWire<TExport>>;
469
- };
470
- type TAnchor<TExport extends boolean = false> = TExport extends true ? TSchema : {
471
- id: string;
472
- parent?: TLogic<TExport>;
473
- schema: TSchema;
474
- };
475
- type TAnyLogic<TExport extends boolean = false> = TLogic<TExport> | TLogicMain<TExport>; //#endregion
476
- //#region src/types/value.d.ts
477
- declare enum ELayoutValueType {
478
- variable = "variable",
479
- property = "property",
480
- attribute = "attribute",
481
- context = "context",
482
- computed = "computed",
483
- event = "event",
484
- file = "file",
485
- model = "model",
486
- logic = "logic"
487
- }
488
- type TContextValue = {
489
- schema: TSchema;
490
- value: unknown;
491
- };
492
- type TLayoutContext = Record<string, TContextValue>;
493
- type TLayoutValue<TExport extends boolean = false> = {
494
- id: string;
495
- type?: ELayoutValueType;
496
- baseType?: ELayoutValueType;
497
- child: Array<string>;
498
- component: TFileComponent<TExport>;
499
- context: TLayoutContext;
500
- stackId: string;
501
- get value(): unknown;
502
- set value(value: unknown);
503
- get schema(): TSchema;
504
- get baseSchema(): TSchema;
505
- }; //#endregion
506
- //#region src/types/variable.d.ts
507
- declare enum EDynamicVariableType {
508
- Constant = "constant",
509
- Dynamic = "dynamic",
510
- Token = "token"
511
- }
512
- declare enum EDynamicVariableOperation {
513
- Equal = "equal",
514
- Greater = "greater",
515
- Less = "less",
516
- StartsWith = "starts-with",
517
- EndsWith = "ends-with",
518
- Contains = "contains"
519
- }
520
- type TBaseDynamicVariable<TExport extends boolean = false> = {
521
- type: EDynamicVariableType;
522
- _dynamic: true;
523
- access: Array<string>;
524
- target: {
525
- invert?: boolean;
526
- operation: EDynamicVariableOperation;
527
- variable?: TDynamicVariable<TExport>;
528
- };
529
- token: string;
530
- value: unknown;
531
- };
532
- type TDynamicVariable<TExport extends boolean = false> = (TExport extends true ? TBaseDynamicVariable<TExport> : TBaseDynamicVariable<TExport> & {
533
- getComputed(component: TFileComponent, options: {
534
- context?: TLayoutContext;
535
- stackId?: string;
536
- }): ComputedRef<TContextValue | TLayoutValue>;
537
- getValue(component: TFileComponent, options: {
538
- base?: boolean;
539
- context?: TLayoutContext;
540
- stackId?: string;
541
- }): TContextValue;
542
- getRawValue(): unknown;
543
- toJSON(): unknown;
544
- }) | unknown;
545
- type TValue<TExport extends boolean = false> = TExport extends false ? {
546
- id: string;
547
- isEditing?: boolean;
548
- parent?: TLogic<TExport>;
549
- schema: TSchema;
550
- } : TSchema; //#endregion
551
- //#region src/types/layout.d.ts
552
- type TTextBlock = {
553
- content: string;
554
- key: string;
555
- };
556
- type TLayoutContentType<TElement extends ELayoutElement, TExport extends boolean = false> = TElement extends ELayoutElement.variable ? {
557
- var: TDynamicVariable | unknown;
558
- } : TElement extends ELayoutElement.component ? {
559
- id: string;
560
- slot: boolean;
561
- slots: Record<string, TLayoutSchema<TElement, TExport>>;
562
- } : TElement extends ELayoutElement.customText ? {
563
- text: TTextBlock;
564
- variables: Array<string>;
565
- } : TElement extends ELayoutElement.customHtml ? {
566
- html: string;
567
- variables: Array<string>;
568
- } : TElement extends ELayoutElement.template ? {
569
- preview: string;
570
- template: EElementTemplate;
571
- var: TDynamicVariable | unknown;
572
- } : TElement extends ELayoutElement.package ? {
573
- slot: boolean;
574
- slots: Record<string, TLayoutSchema<TElement, TExport>>;
575
- target: Array<string>;
576
- } : Record<string, unknown>;
577
- type TLayoutSchema<TElement extends ELayoutElement = ELayoutElement, TExport extends boolean = false> = { [TInnerElement in TElement]: {
578
- id: string;
579
- name: string;
580
- children: Array<TLayoutSchema<ELayoutElement, TExport>>;
581
- classes: Array<TDynamicVariable<TExport>>;
582
- collapsed?: boolean;
583
- component: TFileComponent<TExport>;
584
- content: TLayoutContentType<TInnerElement>;
585
- element: TInnerElement;
586
- events: Array<ELayoutEvent | string>;
587
- model?: Array<string>;
588
- properties: Record<string, TDynamicVariable<TExport>>;
589
- style: { [key in "base" | string]: { [key in "default" | "hover"]: { [key in string]: TDynamicVariable<TExport> } } } & {
590
- quick?: Array<string>;
591
- };
592
- tag?: string;
593
- } }[TElement] & (TExport extends false ? {
594
- parent?: TLayoutSchema<ELayoutElement, TExport>;
595
- } : {}); //#endregion
596
- //#region src/types/files/component.d.ts
597
- declare enum EComponentType {
598
- Component = "component",
599
- Page = "page"
600
- }
601
- declare enum EComponentPreview {
602
- Compact = "compact",
603
- Stretch = "stretch",
604
- Full = "full"
605
- }
606
- type TComponentOptions = {
607
- type: EComponentType;
608
- path: string;
609
- preview: EComponentPreview;
610
- previewSize: string;
611
- };
612
- type TFileComponent<TExport extends boolean = false> = TFileBase<TExport> & {
613
- type: EElementType.Component;
614
- collapsed?: boolean;
615
- layout: TLayoutSchema<ELayoutElement, TExport>;
616
- logics: Record<string, TLogic<TExport> | TLogicMain<TExport>>;
617
- options: TComponentOptions;
618
- values: {
619
- computed: Record<string, TValue<TExport>>;
620
- events: Record<string, TValue<TExport>>;
621
- model?: TSchema;
622
- properties: Record<string, TValue<TExport>>;
623
- variables: Record<string, TValue<TExport>>;
624
- };
625
- } & (TExport extends false ? {
626
- flat: Record<string, TLayoutSchema>;
627
- } : {}); //#endregion
628
- //#region src/types/files/config.d.ts
629
- type TFileConfig<TExport extends boolean = false> = TFileBase<TExport> & {
630
- type: EElementType.Config;
631
- content: unknown;
632
- display: EConfigDisplay;
633
- schema: TSchema;
634
- scope: ELogicScope;
303
+ config: Record<string, unknown>;
635
304
  };
636
- declare enum EConfigDisplay {
637
- Smart = "smart",
638
- Performance = "performance"
639
- } //#endregion
640
- //#region src/types/files/cron.d.ts
641
- type TFileCron<TExport extends boolean = false> = TFileBase<TExport> & {
642
- type: EElementType.Cron;
643
- active: boolean;
644
- editorTrigger: boolean;
645
- logics: Record<string, TAnyLogic<TExport>>;
646
- time: string;
647
- } & (TExport extends false ? {
648
- cron?: Cron;
649
- scope: ELogicScope.Backend;
650
- } : {}); //#endregion
651
- //#region src/types/files/media.d.ts
652
- type TFileMedia<TExport extends boolean = false> = TFileBase<TExport> & {
653
- type: EElementType.Media;
654
- mimeType: string;
655
- target: string;
656
- }; //#endregion
657
- //#region src/types/files/route.d.ts
658
- declare enum ERouteMethod {
659
- Get = "get",
660
- Post = "post",
661
- Put = "put",
662
- Delete = "delete"
663
- }
664
305
  type TFileRoute<TExport extends boolean = false> = TFileBase<TExport> & {
665
306
  type: EElementType.Route;
666
- dev?: boolean;
307
+ guards?: Array<TRouteGuardRef>;
667
308
  input: {
668
309
  body: TSchema;
669
310
  headers: TSchema;
@@ -673,9 +314,10 @@ type TFileRoute<TExport extends boolean = false> = TFileBase<TExport> & {
673
314
  method: ERouteMethod;
674
315
  output: TSchema;
675
316
  path: string;
676
- } & (TExport extends false ? {
317
+ } & TRuntimeOnly<TExport, {
677
318
  scope: ELogicScope.Backend;
678
- } : {}); //#endregion
319
+ }>;
320
+ //#endregion
679
321
  //#region src/types/files/script.d.ts
680
322
  type TFileScript<TExport extends boolean = false> = TFileBase<TExport> & {
681
323
  type: EElementType.Script;
@@ -684,7 +326,8 @@ type TFileScript<TExport extends boolean = false> = TFileBase<TExport> & {
684
326
  autoReload?: boolean;
685
327
  };
686
328
  scope: ELogicScope;
687
- }; //#endregion
329
+ };
330
+ //#endregion
688
331
  //#region src/types/files/store.d.ts
689
332
  declare enum EStoreType {
690
333
  Memory = "memory",
@@ -700,29 +343,88 @@ type TFileStore<TExport extends boolean = false> = TFileBase<TExport> & {
700
343
  logics: Record<string, TLogic<TExport>>;
701
344
  options: TStoreOptions;
702
345
  schema: TSchema;
703
- } & (TExport extends false ? {
346
+ } & TRuntimeOnly<TExport, {
704
347
  proxy: TSchema;
705
348
  scope: ELogicScope.Frontend;
706
349
  value: Record<string, unknown>;
707
- } : {}); //#endregion
350
+ }>;
351
+ //#endregion
352
+ //#region src/types/layout.d.ts
353
+ type TTextBlock = {
354
+ content: string;
355
+ key: string;
356
+ };
357
+ type TLayoutContentType<TElement extends ELayoutElement, TExport extends boolean = false> = TElement extends ELayoutElement.variable ? {
358
+ var: TMaybeDynamicVariable<TExport>;
359
+ } : TElement extends ELayoutElement.component ? {
360
+ id: string;
361
+ slots: Record<string, TLayoutSchema<ELayoutElement, TExport>>;
362
+ } : TElement extends ELayoutElement.customText ? {
363
+ text: TTextBlock;
364
+ variables: Array<string>;
365
+ } : TElement extends ELayoutElement.customHtml ? {
366
+ html: string;
367
+ variables: Array<string>;
368
+ } : TElement extends ELayoutElement.package ? {
369
+ slots: Record<string, TLayoutSchema<ELayoutElement, TExport>>;
370
+ target: Array<string>;
371
+ } : Record<string, unknown>;
372
+ /**
373
+ * Style rules by category, then by property
374
+ */
375
+ type TLayoutStyleRules<TExport extends boolean = false> = Record<string, Record<string, TMaybeDynamicVariable<TExport>>>;
376
+ type TLayoutStyleStates<TExport extends boolean = false> = {
377
+ default?: TLayoutStyleRules<TExport>;
378
+ hover?: TLayoutStyleRules<TExport>;
379
+ };
380
+ type TLayoutStyle<TExport extends boolean = false> = {
381
+ base?: TLayoutStyleStates<TExport>;
382
+ quick?: Array<string>;
383
+ [media: `${number}`]: TLayoutStyleStates<TExport> | undefined;
384
+ };
385
+ type TLayoutClass<TExport extends boolean = false> = {
386
+ id: string;
387
+ name: string;
388
+ style: TLayoutStyle<TExport>;
389
+ };
390
+ type TLayoutEventParameter<TExport extends boolean = false> = {
391
+ schema: TSchema;
392
+ value: TMaybeDynamicVariable<TExport>;
393
+ };
394
+ type TLayoutSchema<TElement extends ELayoutElement = ELayoutElement, TExport extends boolean = false> = { [TInnerElement in TElement]: {
395
+ id: string;
396
+ name: string;
397
+ children: Array<TLayoutSchema<ELayoutElement, TExport>>;
398
+ classes: Array<TMaybeDynamicVariable<TExport>>;
399
+ collapsed?: boolean;
400
+ content: TLayoutContentType<TInnerElement, TExport>;
401
+ element: TInnerElement;
402
+ events: Record<string, Record<string, TLayoutEventParameter<TExport>>>;
403
+ models?: Record<string, Array<string>>;
404
+ properties: Record<string, TMaybeDynamicVariable<TExport>>;
405
+ style: TLayoutStyle<TExport>;
406
+ tag?: string;
407
+ }; }[TElement] & TRuntimeOnly<TExport, {
408
+ component: TFileComponent<TExport>;
409
+ parent?: TLayoutSchema<ELayoutElement, TExport>;
410
+ }>;
411
+ //#endregion
708
412
  //#region src/types/files/text.d.ts
709
413
  type TFileText<TExport extends boolean = false> = TFileBase<TExport> & {
710
414
  type: EElementType.Text;
711
- blocks: Array<{
712
- content: string;
713
- key: string;
714
- }>;
715
- } & (TExport extends false ? {
415
+ blocks: Array<TTextBlock>;
416
+ } & TRuntimeOnly<TExport, {
716
417
  scope: ELogicScope.Frontend;
717
- } : {}); //#endregion
418
+ }>;
419
+ //#endregion
718
420
  //#region src/types/files/type.d.ts
719
421
  type TFileType<TExport extends boolean = false> = TFileBase<TExport> & {
720
- name: string;
721
422
  type: EElementType.Type;
722
423
  schemas: Record<string, TSchema>;
723
- } & (TExport extends false ? {
424
+ } & TRuntimeOnly<TExport, {
724
425
  scope: ELogicScope.Shared;
725
- } : {}); //#endregion
426
+ }>;
427
+ //#endregion
726
428
  //#region src/types/files/index.d.ts
727
429
  type TApplication<TExport extends boolean = false> = {
728
430
  name: string;
@@ -743,14 +445,25 @@ declare enum EFileSortStrategy {
743
445
  Name = "name",
744
446
  Type = "type"
745
447
  }
448
+ type TApplicationToken = {
449
+ id: string;
450
+ name: string;
451
+ value: string;
452
+ };
453
+ type TApplicationFontToken = TApplicationToken & {
454
+ default?: boolean;
455
+ cdn?: string;
456
+ };
457
+ type TApplicationTokens = {
458
+ colors: Array<TApplicationToken>;
459
+ fonts: Array<TApplicationFontToken>;
460
+ lengths: Array<TApplicationToken>;
461
+ };
746
462
  type TApplicationConfig = {
747
463
  backend: {
748
464
  proxy: string;
749
465
  salt: string;
750
466
  };
751
- database: {
752
- type: string;
753
- };
754
467
  description?: string;
755
468
  desktop: {
756
469
  fullscreen: boolean;
@@ -774,23 +487,7 @@ type TApplicationConfig = {
774
487
  html: string;
775
488
  js: string;
776
489
  };
777
- tokens: {
778
- colors: Array<{
779
- id: string;
780
- name: string;
781
- value: string;
782
- }>;
783
- fonts: Array<{
784
- id: string;
785
- name: string;
786
- value: string;
787
- }>;
788
- lengths: Array<{
789
- id: string;
790
- name: string;
791
- value: string;
792
- }>;
793
- };
490
+ tokens: TApplicationTokens;
794
491
  };
795
492
  plugins: Record<string, {
796
493
  config?: unknown;
@@ -810,9 +507,411 @@ type TApplicationConfig = {
810
507
  pwa: boolean;
811
508
  };
812
509
  };
813
- type TFile<TExport extends boolean = false> = (TFolder<TExport> | TFileComponent<TExport> | TFileConfig<TExport> | TFileCron<TExport> | TFileDatabase<TExport> | TFileRoute<TExport> | TFileScript<TExport> | TFileStore<TExport> | TFileText<TExport> | TFileType<TExport> | TFileMedia<TExport>) & {
510
+ type TFile<TExport extends boolean = false> = TFolder<TExport> | TFileComponent<TExport> | TFileConfig<TExport> | TFileCron<TExport> | TFileDatabase<TExport> | TFileRoute<TExport> | TFileScript<TExport> | TFileStore<TExport> | TFileText<TExport> | TFileType<TExport> | TFileMedia<TExport>;
511
+ //#endregion
512
+ //#region src/types/files/folder.d.ts
513
+ type TFolderArtboardView = {
514
+ name: string;
515
+ location: TVector;
516
+ properties: Record<string, unknown>;
517
+ };
518
+ type TFolderArtboard = {
519
+ location: TVector;
520
+ views: Record<string, TFolderArtboardView>;
521
+ };
522
+ type TFolder<TExport extends boolean = false> = TFileBase<TExport> & {
523
+ type: EElementType.Folder;
524
+ artboards?: Record<string, TFolderArtboard>;
525
+ children: Record<string, TFile<TExport>>;
526
+ color?: string;
527
+ };
528
+ //#endregion
529
+ //#region src/types/files/common.d.ts
530
+ /**
531
+ * Fields that only exist on the in-memory (non-export) shape
532
+ */
533
+ type TRuntimeOnly<TExport extends boolean, T> = TExport extends false ? T : Record<never, never>;
534
+ type TFileState = {
535
+ expand?: boolean;
814
536
  isEditing?: boolean;
537
+ logic?: TCanvas;
538
+ opened?: boolean;
539
+ panel?: string;
815
540
  };
541
+ type TFileBase<TExport extends boolean = false> = {
542
+ name: string;
543
+ state: TFileState;
544
+ } & TRuntimeOnly<TExport, {
545
+ id: string;
546
+ parent?: TFolder<TExport>;
547
+ }>;
548
+ //#endregion
549
+ //#region src/types/logic.d.ts
550
+ declare enum ELogicMode {
551
+ Pure = "pure",
552
+ Macro = "macro",
553
+ Code = "code"
554
+ }
555
+ type TLogicBase<TExport extends boolean = false> = {
556
+ name: string;
557
+ graph: TGraph<TExport>;
558
+ values: {
559
+ variables: Record<string, TValue<TExport>>;
560
+ };
561
+ } & TRuntimeOnly<TExport, {
562
+ id: string;
563
+ db: Record<string, TLogicNode>;
564
+ isEditing?: boolean;
565
+ parent: TFile<TExport>;
566
+ }>;
567
+ type TLogic<TExport extends boolean = false> = TLogicBase<TExport> & {
568
+ type: EElementType.Logic | EElementType.Standalone;
569
+ async: boolean;
570
+ code?: string;
571
+ export: boolean;
572
+ inputs: Record<string, TAnchor<TExport>>;
573
+ mode: ELogicMode;
574
+ outputs: Record<string, TAnchor<TExport>>;
575
+ packages?: Array<string>;
576
+ };
577
+ type TLogicMain<TExport extends boolean = false> = TLogicBase<TExport> & {
578
+ name: "Main";
579
+ type: EElementType.MainLogic;
580
+ } & TRuntimeOnly<TExport, {
581
+ id: "main";
582
+ }>;
583
+ type TCanvas = {
584
+ location: TVector;
585
+ zoom: number;
586
+ };
587
+ type TGraph<TExport extends boolean = false> = {
588
+ autoplace?: boolean;
589
+ canvas: TCanvas;
590
+ nodes: Record<string, TNode<TExport>>;
591
+ wires: Record<string, TWire<TExport>>;
592
+ };
593
+ type TAnchor<TExport extends boolean = false> = TExport extends true ? TSchema : {
594
+ id: string;
595
+ parent?: TLogic<TExport>;
596
+ schema: TSchema;
597
+ };
598
+ type TAnyLogic<TExport extends boolean = false> = TLogic<TExport> | TLogicMain<TExport>;
599
+ //#endregion
600
+ //#region src/types/editor/stack.d.ts
601
+ type TStackParent = {
602
+ logic?: TLogic;
603
+ node?: CNode;
604
+ stack: TStack;
605
+ };
606
+ type TStack = {
607
+ id: string;
608
+ config?: Record<string, unknown>;
609
+ context: object;
610
+ parent?: TStackParent;
611
+ variables: Record<string, unknown>;
612
+ };
613
+ //#endregion
614
+ //#region src/types/editor/node.d.ts
615
+ type TBaseNode = {
616
+ id: string;
617
+ data?: object;
618
+ dbNode: TGeneratedNode;
619
+ inputs: Record<string, CNodeAnchor>;
620
+ location: TVector;
621
+ outputs: Record<string, CNodeAnchor>;
622
+ };
623
+ /**
624
+ * Proxy bound to a stack, exposing the node inputs, outputs and context by key
625
+ */
626
+ type TNodeProxy = {
627
+ [key: string]: unknown;
628
+ with(stack?: TStack): TNodeProxy;
629
+ };
630
+ type TGeneratedNode<TLogic extends TLogicNode = TLogicNode> = TLogic & {
631
+ node?: CNode;
632
+ origin: TLogic;
633
+ proxy: TNodeProxy;
634
+ };
635
+ type TNodeData = {
636
+ config?: Record<string, unknown>;
637
+ multiple?: {
638
+ isArray?: boolean;
639
+ number: number;
640
+ };
641
+ optionals?: Record<string, boolean>;
642
+ size?: TVector;
643
+ } & Record<string, unknown>;
644
+ declare class CNode {
645
+ id: string;
646
+ dbNode: TGeneratedNode;
647
+ element?: HTMLElement;
648
+ invert: boolean;
649
+ parent?: TAnyLogic;
650
+ config: {
651
+ animate: boolean;
652
+ processing: boolean;
653
+ };
654
+ inputs: Record<string, CNodeAnchor>;
655
+ outputs: Record<string, CNodeAnchor>;
656
+ cache: {
657
+ location?: CVector;
658
+ relativeLocation?: CVector;
659
+ reloadKey: number;
660
+ size?: CVector;
661
+ };
662
+ _data: TNodeData;
663
+ constructor(node: TBaseNode);
664
+ get orderedInputs(): Array<CNodeAnchor>;
665
+ get orderedOutputs(): Array<CNodeAnchor>;
666
+ set location(location: TVector);
667
+ get location(): TVector;
668
+ reload(): void;
669
+ getSafeInputs(): Record<string, CNodeAnchor>;
670
+ getSafeOutputs(): Record<string, CNodeAnchor>;
671
+ set data(data: Record<string, unknown>);
672
+ get data(): TNodeData;
673
+ reset(): void;
674
+ setLocation(location: TVector): CNode;
675
+ getAnchorLocation(anchor: CNodeAnchor): CVector;
676
+ getRelativeAnchorLocation(anchor: CNodeAnchor): CVector;
677
+ getRelativeAnchorLocation_internal(anchor: CNodeAnchor): CVector;
678
+ getLocation(): CVector;
679
+ getSize(): TVector;
680
+ execute(outputKey: string, stack?: TStack): MaybePromise<void>;
681
+ get isAsync(): boolean;
682
+ getInput(inputKey: string, stack?: TStack): unknown;
683
+ setOutput(outputKey: string, value: unknown, stack?: TStack): void;
684
+ }
685
+ type TNode<TExport extends boolean = false> = TExport extends true ? {
686
+ data?: Record<string, unknown>;
687
+ internal?: {
688
+ inputs?: Record<string, unknown>;
689
+ outputs?: Record<string, unknown>;
690
+ };
691
+ location: TVector;
692
+ logic: string;
693
+ } : CNode;
694
+ //#endregion
695
+ //#region src/types/editor/anchor.d.ts
696
+ type TDBAnchor = {
697
+ id?: string;
698
+ schema: TSchema;
699
+ };
700
+ declare enum EAnchorDirection {
701
+ Input = "input",
702
+ Output = "output",
703
+ None = "none"
704
+ }
705
+ declare class CAnchor {
706
+ connections: Array<CWire>;
707
+ dbAnchor: TDBAnchor;
708
+ padding?: number;
709
+ protected constructor(anchor: {
710
+ connections?: Array<CWire>;
711
+ dbAnchor: TDBAnchor;
712
+ padding?: number;
713
+ });
714
+ getLocation(): TVector;
715
+ getPadding(): number;
716
+ get schema(): TSchema;
717
+ get schemaRaw(): TSchema;
718
+ get toSchema(): TSchema;
719
+ }
720
+ declare class CNodeAnchor extends CAnchor {
721
+ key: string;
722
+ index: number;
723
+ node: CNode;
724
+ direction: EAnchorDirection;
725
+ value: unknown;
726
+ element?: HTMLElement;
727
+ cache: {
728
+ preview?: unknown;
729
+ relativeLocation?: CVector;
730
+ };
731
+ constructor(anchor: {
732
+ connections?: Array<CWire>;
733
+ dbAnchor: TDBAnchor;
734
+ direction: EAnchorDirection;
735
+ element?: HTMLElement;
736
+ index: number;
737
+ key: string;
738
+ node: CNode;
739
+ padding?: number;
740
+ });
741
+ get schema(): TSchema;
742
+ get toSchema(): TSchema;
743
+ get schemaRaw(): TSchema;
744
+ getLocation(): CVector;
745
+ getRelativeLocation(): CVector;
746
+ resetCache(): void;
747
+ getPadding(): number;
748
+ isDisabled(): boolean;
749
+ errorMessage(): string | undefined;
750
+ setValue(value: string | number | boolean): void;
751
+ resetValue(): void;
752
+ }
753
+ //#endregion
754
+ //#region src/types/value.d.ts
755
+ declare enum ELayoutValueType {
756
+ Variable = "variable",
757
+ Property = "property",
758
+ Attribute = "attribute",
759
+ Context = "context",
760
+ Computed = "computed",
761
+ Event = "event",
762
+ File = "file",
763
+ Model = "model",
764
+ Logic = "logic"
765
+ }
766
+ type TContextValue = {
767
+ schema: TSchema;
768
+ value: unknown;
769
+ };
770
+ type TLayoutContext = Record<string, TContextValue>;
771
+ /**
772
+ * Runtime-only reactive value (never exported)
773
+ */
774
+ type TLayoutValue = {
775
+ id: string;
776
+ type?: ELayoutValueType;
777
+ baseType?: ELayoutValueType;
778
+ child: Array<string>;
779
+ component?: TFileComponent;
780
+ context: TLayoutContext;
781
+ stackId: string;
782
+ get value(): unknown;
783
+ set value(value: unknown);
784
+ get schema(): TSchema;
785
+ get baseSchema(): TSchema;
786
+ };
787
+ declare enum ELayoutElement {
788
+ input = "input",
789
+ div = "div",
790
+ media = "media",
791
+ customText = "customText",
792
+ component = "component",
793
+ package = "package",
794
+ customHtml = "customHtml",
795
+ slot = "slot",
796
+ template = "template",
797
+ variable = "variable",
798
+ link = "link"
799
+ }
800
+ //#endregion
801
+ //#region src/types/files/component.d.ts
802
+ declare enum EComponentType {
803
+ Component = "component",
804
+ Page = "page"
805
+ }
806
+ declare enum EComponentPreview {
807
+ Compact = "compact",
808
+ Stretch = "stretch",
809
+ Full = "full"
810
+ }
811
+ type TComponentOptions = {
812
+ type: EComponentType;
813
+ path: string;
814
+ preview: EComponentPreview;
815
+ previewSize: string;
816
+ };
817
+ type TFileComponent<TExport extends boolean = false> = TFileBase<TExport> & {
818
+ type: EElementType.Component;
819
+ classes?: Record<string, TLayoutClass<TExport>>;
820
+ collapsed?: boolean;
821
+ layout: TLayoutSchema<ELayoutElement, TExport>;
822
+ logics: Record<string, TAnyLogic<TExport>>;
823
+ options: TComponentOptions;
824
+ values: {
825
+ computed: Record<string, TValue<TExport>>;
826
+ events: Record<string, TValue<TExport>>;
827
+ model?: TSchema;
828
+ properties: Record<string, TValue<TExport>>;
829
+ variables: Record<string, TValue<TExport>>;
830
+ };
831
+ } & TRuntimeOnly<TExport, {
832
+ flat: Record<string, TLayoutSchema>;
833
+ }>;
834
+ //#endregion
835
+ //#region src/types/variable.d.ts
836
+ declare enum EDynamicVariableType {
837
+ Constant = "constant",
838
+ Dynamic = "dynamic",
839
+ Token = "token"
840
+ }
841
+ declare enum EDynamicOperation {
842
+ Equal = "equal",
843
+ NotEqual = "not-equal",
844
+ Greater = "greater",
845
+ GreaterEqual = "greater-equal",
846
+ Less = "less",
847
+ LessEqual = "less-equal",
848
+ StartsWith = "starts-with",
849
+ EndsWith = "ends-with",
850
+ Includes = "includes",
851
+ At = "at",
852
+ Join = "join",
853
+ ToLowerCase = "to-lower-case",
854
+ Length = "length",
855
+ Not = "not",
856
+ And = "and",
857
+ Or = "or",
858
+ Add = "add",
859
+ Subtract = "subtract",
860
+ Multiply = "multiply",
861
+ Divide = "divide",
862
+ Modulo = "modulo",
863
+ Ternary = "ternary",
864
+ ToString = "to-string",
865
+ ToNumber = "to-number",
866
+ ToBoolean = "to-boolean",
867
+ Call = "call"
868
+ }
869
+ /**
870
+ * One operation applied to the previous value, optionally followed by a property access on its result.
871
+ */
872
+ type TDynamicVariableStep = {
873
+ access?: Array<string>;
874
+ operation: EDynamicOperation;
875
+ variables: Array<TMaybeDynamicVariable<true>>;
876
+ };
877
+ /**
878
+ * Serializable data of a dynamic variable. Runtime variables extend it with methods, so they stay assignable to it.
879
+ */
880
+ type TBaseDynamicVariable = {
881
+ type: EDynamicVariableType;
882
+ _dynamic: true;
883
+ access: Array<string>;
884
+ steps?: Array<TDynamicVariableStep>;
885
+ token: string;
886
+ value: unknown;
887
+ };
888
+ type TDynamicVariable<TExport extends boolean = false> = TExport extends true ? TBaseDynamicVariable : TBaseDynamicVariable & {
889
+ getComputed(component: TFileComponent, options?: {
890
+ context?: TLayoutContext;
891
+ stackId?: string;
892
+ }): ComputedRef<TContextValue | TLayoutValue>;
893
+ getValue(component: TFileComponent, options?: {
894
+ base?: boolean;
895
+ context?: TLayoutContext;
896
+ stackId?: string;
897
+ }): TContextValue;
898
+ getRawValue(): unknown;
899
+ toJSON(): unknown;
900
+ };
901
+ /**
902
+ * A raw constant stored in place of a dynamic variable (constants are unwrapped on load).
903
+ * Arrays and objects may still contain dynamic variables.
904
+ */
905
+ type TRawValue<TExport extends boolean = false> = string | number | boolean | null | undefined | Array<TMaybeDynamicVariable<TExport>> | {
906
+ [key: string]: TMaybeDynamicVariable<TExport>;
907
+ };
908
+ type TMaybeDynamicVariable<TExport extends boolean = false> = TDynamicVariable<TExport> | TRawValue<TExport>;
909
+ type TValue<TExport extends boolean = false> = TExport extends false ? {
910
+ id: string;
911
+ isEditing?: boolean;
912
+ parent?: TLogic<TExport>;
913
+ schema: TSchema;
914
+ } : TSchema;
816
915
  //#endregion
817
916
  //#region src/types/interface.d.ts
818
917
  type TInterface = {
@@ -834,7 +933,7 @@ type TTemplate = {
834
933
  };
835
934
  //#endregion
836
935
  //#region src/types/token.d.ts
837
- declare enum ETokenType {
936
+ export declare enum ETokenType {
838
937
  Color = "color",
839
938
  FontSize = "font-size",
840
939
  FontWeight = "font-weight",
@@ -850,7 +949,7 @@ type TToken = {
850
949
  };
851
950
  //#endregion
852
951
  //#region src/types/plugin.d.ts
853
- declare enum EInjectionKey {
952
+ export declare enum EInjectionKey {
854
953
  ViteImport = "viteImport",
855
954
  VitePlugin = "vitePlugin",
856
955
  AppImport = "appImport",
@@ -866,6 +965,7 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
866
965
  name: string;
867
966
  version?: string;
868
967
  }>;
968
+ env?: Record<string, string>;
869
969
  frontImports?: Array<{
870
970
  name: string;
871
971
  version?: string;
@@ -882,6 +982,8 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
882
982
  description?: string;
883
983
  editor?: {
884
984
  components?: Array<TComponent>;
985
+ guards?: Array<TRouteGuard>;
986
+ inputs?: Record<string, Component>;
885
987
  interfaces?: Array<TInterface>;
886
988
  nodes?: Array<TLogicNode>;
887
989
  templates?: Array<TTemplate>;
@@ -890,7 +992,7 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
890
992
  attributes?: Record<string, unknown>;
891
993
  };
892
994
  };
893
- hooks?: { [THook in EPluginHooks]?: (params: THookParams[THook]) => MaybePromise<void> };
995
+ hooks?: { [THook in EPluginHooks]?: (params: THookParams[THook]) => MaybePromise<void>; };
894
996
  icon: string;
895
997
  id: string;
896
998
  inject?: {
@@ -904,6 +1006,7 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
904
1006
  unmount?: (env: TEnv<TConfig, TInternals>) => Promise<void> | void;
905
1007
  update?: (env: TEnv<TConfig, TInternals>) => Promise<void> | void;
906
1008
  };
1009
+ llm?: string;
907
1010
  name: string;
908
1011
  settings?: Array<{
909
1012
  component: Component;
@@ -912,8 +1015,8 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
912
1015
  }>;
913
1016
  windows?: Record<string, Component>;
914
1017
  };
915
- type TPlugin<TConfig extends TSchema = TSchema, TInternal = unknown, TBase extends TBasePlugin<TConfig, TInternal> = TBasePlugin<TConfig, TInternal>> = Omit<TBase, "build" | "editor" | "inject"> & { [TCategory in "build" | "editor" | "inject"]?: { [TKey in keyof NonNullable<TBase[TCategory]>]: TOption<TEnv<TConfig, TInternal>, NonNullable<TBase[TCategory]>[TKey]> } };
916
- type TProxyPlugin<TConfig extends TSchema = TSchema, TInternal = unknown, TBase extends TBasePlugin<TConfig, TInternal> = TBasePlugin<TConfig, TInternal>> = Omit<TBase, "build" | "editor" | "inject"> & { [TCategory in "build" | "editor" | "inject"]?: { [TKey in keyof NonNullable<TBase[TCategory]>]: Promise<NonNullable<TBase[TCategory]>[TKey]> } };
1018
+ type TPlugin<TConfig extends TSchema = TSchema, TInternal = unknown, TBase extends TBasePlugin<TConfig, TInternal> = TBasePlugin<TConfig, TInternal>> = Omit<TBase, "build" | "editor" | "inject"> & { [TCategory in "build" | "editor" | "inject"]?: { [TKey in keyof NonNullable<TBase[TCategory]>]: TOption<TEnv<TConfig, TInternal>, NonNullable<TBase[TCategory]>[TKey]>; }; };
1019
+ type TProxyPlugin<TConfig extends TSchema = TSchema, TInternal = unknown, TBase extends TBasePlugin<TConfig, TInternal> = TBasePlugin<TConfig, TInternal>> = Omit<TBase, "build" | "editor" | "inject"> & { [TCategory in "build" | "editor" | "inject"]?: { [TKey in keyof NonNullable<TBase[TCategory]>]: Promise<NonNullable<TBase[TCategory]>[TKey]>; }; };
917
1020
  type TEnv<TConfig extends TSchema = TSchema, TInternals = unknown> = {
918
1021
  addFile: (file: DeepPartial<TFile<true>> & {
919
1022
  type: EElementType;
@@ -928,14 +1031,15 @@ type TEnv<TConfig extends TSchema = TSchema, TInternals = unknown> = {
928
1031
  config: Static<TConfig>;
929
1032
  getFile: (id: string) => TFile | undefined;
930
1033
  internals: TInternals;
1034
+ log: (message: string, severity?: "info" | "warning" | "error") => void;
931
1035
  mode: "build" | "editor";
932
1036
  };
933
1037
  type TOption<TParams = unknown, TResult = unknown> = TResult | ((env: TParams) => Promise<TResult> | TResult);
934
1038
  //#endregion
935
1039
  //#region src/index.d.ts
936
- declare function makePlugin<TConfig extends TSchema, TInternal>(plugin: TPlugin<TConfig, TInternal>): TPlugin<TConfig, TInternal>;
937
- declare function makeComponent<TProps extends Record<string, TSchema>>(component: TComponent<TProps>): TComponent<TProps>;
938
- declare function loadPlugin<TConfig extends TSchema, TInternal>(plugin: TPlugin<TConfig, TInternal>, env: Partial<TEnv>): Promise<TBasePlugin<TConfig, TInternal>>;
939
- declare function getPluginParam<T>(target: TOption<TEnv, T>, env: Partial<TEnv>): Promise<T>;
1040
+ export declare function makePlugin<TConfig extends TSchema, TInternal>(plugin: TPlugin<TConfig, TInternal>): TPlugin<TConfig, TInternal>;
1041
+ export declare function makeComponent<TProps extends Record<string, TSchema>>(component: TComponent<TProps>): TComponent<TProps>;
1042
+ export declare function loadPlugin<TConfig extends TSchema, TInternal>(plugin: TPlugin<TConfig, TInternal>, env: Partial<TEnv>): Promise<TBasePlugin<TConfig, TInternal>>;
1043
+ export declare function getPluginParam<T>(target: TOption<TEnv, T>, env: Partial<TEnv>): Promise<T>;
940
1044
  //#endregion
941
- export { EElementType, EInjectionKey, ELogicScope, ELogicType, EPluginHooks, ETokenType, EVarType, _default as LSettingsStoryWrapper, LogicType, LogicUtil, type Static, type TAnyLogic, type TApplication, type TBasePlugin, type TComponent, type TEnv, type TFile, type TFileComponent, type TFileConfig, type TFileCron, type TFileDatabase, type TFileMedia, type TFileRoute, type TFileScript, type TFileStore, type TFileText, type TFileType, type TFolder, type THookParams, type TLogic, type TLogicMain, type TLogicNode, type TOption, type TPlugin, type TProxyPlugin, type TSchema, type TSlot, type TTemplate, type TToken, getPluginParam, loadPlugin, makeComponent, makeLogicNode, makePlugin };
1045
+ export { EElementType, ELogicScope, ELogicType, EVarType, _default as LSettingsStoryWrapper, LogicType, LogicUtil, type Static, type TAnyLogic, type TApplication, type TBasePlugin, type TComponent, type TDatabaseCondition, type TEnv, type TFile, type TFileComponent, type TFileConfig, type TFileCron, type TFileDatabase, type TFileMedia, type TFileRoute, type TFileScript, type TFileStore, type TFileText, type TFileType, type TFolder, type THookParams, type TLogic, type TLogicMain, type TLogicNode, type TOption, type TPlugin, type TProxyPlugin, type TRouteGuard, type TSchema, type TSlot, type TTemplate, type TToken, makeLogicNode };