@luna-park/plugin 1.5.0 → 1.6.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 -50
- package/dist/{dist-JzydDdZn.mjs → dist-BoFOku7q.mjs} +6 -0
- package/dist/extractor.d.mts +1 -1
- package/dist/extractor.mjs +1 -1
- package/dist/{index-DwEOlEBY.d.mts → index-76yMHag4.d.mts} +35 -7
- package/dist/index.d.mts +133 -55
- package/dist/index.mjs +69 -32
- package/package.json +1 -1
package/bin/preview.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { parseArgs } from "node:util";
|
|
3
|
-
|
|
4
|
-
import { resolve } from "path";
|
|
5
|
-
|
|
6
|
-
import { startPreviewServer } from "../dist/preview.mjs";
|
|
7
|
-
|
|
8
|
-
const cwd = process.cwd();
|
|
9
|
-
|
|
10
|
-
// Parse CLI arguments
|
|
11
|
-
const { values } = parseArgs({
|
|
12
|
-
options: {
|
|
13
|
-
dist: {
|
|
14
|
-
default: "dist",
|
|
15
|
-
short: "d",
|
|
16
|
-
type: "string"
|
|
17
|
-
},
|
|
18
|
-
help: {
|
|
19
|
-
default: false,
|
|
20
|
-
short: "h",
|
|
21
|
-
type: "boolean"
|
|
22
|
-
},
|
|
23
|
-
port: {
|
|
24
|
-
default: "2084",
|
|
25
|
-
short: "p",
|
|
26
|
-
type: "string"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (values.help) {
|
|
32
|
-
console.log(`
|
|
33
|
-
Usage: luna-preview [options]
|
|
34
|
-
|
|
35
|
-
Options:
|
|
36
|
-
-p, --port <port> Port to run the server on (default: 2084)
|
|
37
|
-
-d, --dist <dir> Distribution directory to serve (default: dist)
|
|
38
|
-
-h, --help Show this help message
|
|
39
|
-
`);
|
|
40
|
-
process.exit(0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const dist = resolve(cwd, values.dist);
|
|
44
|
-
const port = parseInt(values.port);
|
|
45
|
-
|
|
46
|
-
startPreviewServer({
|
|
47
|
-
dist,
|
|
48
|
-
externals: ["vue", "vue-router", "@luna-park/design"],
|
|
49
|
-
port
|
|
50
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
3
|
+
|
|
4
|
+
import { resolve } from "path";
|
|
5
|
+
|
|
6
|
+
import { startPreviewServer } from "../dist/preview.mjs";
|
|
7
|
+
|
|
8
|
+
const cwd = process.cwd();
|
|
9
|
+
|
|
10
|
+
// Parse CLI arguments
|
|
11
|
+
const { values } = parseArgs({
|
|
12
|
+
options: {
|
|
13
|
+
dist: {
|
|
14
|
+
default: "dist",
|
|
15
|
+
short: "d",
|
|
16
|
+
type: "string"
|
|
17
|
+
},
|
|
18
|
+
help: {
|
|
19
|
+
default: false,
|
|
20
|
+
short: "h",
|
|
21
|
+
type: "boolean"
|
|
22
|
+
},
|
|
23
|
+
port: {
|
|
24
|
+
default: "2084",
|
|
25
|
+
short: "p",
|
|
26
|
+
type: "string"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (values.help) {
|
|
32
|
+
console.log(`
|
|
33
|
+
Usage: luna-preview [options]
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
-p, --port <port> Port to run the server on (default: 2084)
|
|
37
|
+
-d, --dist <dir> Distribution directory to serve (default: dist)
|
|
38
|
+
-h, --help Show this help message
|
|
39
|
+
`);
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const dist = resolve(cwd, values.dist);
|
|
44
|
+
const port = parseInt(values.port);
|
|
45
|
+
|
|
46
|
+
startPreviewServer({
|
|
47
|
+
dist,
|
|
48
|
+
externals: ["vue", "vue-router", "@luna-park/design"],
|
|
49
|
+
port
|
|
50
|
+
});
|
|
@@ -448,6 +448,11 @@ function cleanUnion(schema) {
|
|
|
448
448
|
}
|
|
449
449
|
function cleanInterface(schema) {
|
|
450
450
|
if (schema.className === "Array") return LogicType.array(schema.options.template[0]);
|
|
451
|
+
if (schema.className === "Type" && schema.options?.template?.[0]?.enum?.length) {
|
|
452
|
+
const reference = schema.options.template[0].enum[0];
|
|
453
|
+
const target = (Array.isArray(reference) ? reference.join("") : String(reference)).split("/");
|
|
454
|
+
return LogicType.type(target, schema.optional ? { optional: true } : {});
|
|
455
|
+
}
|
|
451
456
|
if (schema.className === "keyof") return LogicType.string();
|
|
452
457
|
if (schema.className === "Record") return LogicType.object({});
|
|
453
458
|
if (schema.className === "PropertyKey") return LogicType.union([LogicType.string(), LogicType.number()]);
|
|
@@ -591,6 +596,7 @@ function schemaLoop(schema, func, key) {
|
|
|
591
596
|
}) || schema;
|
|
592
597
|
if (schema.type === "object") for (const key in schema.properties) schema.properties[key] = schemaLoop(schema.properties[key], func, key);
|
|
593
598
|
if (schema.type === "array") schema.items = schemaLoop(schema.items, func);
|
|
599
|
+
if (schema.type === "record") schema.value = schemaLoop(schema.value, func);
|
|
594
600
|
if (schema.type === "function") {
|
|
595
601
|
schema.inputs = schemaLoop(schema.inputs, func);
|
|
596
602
|
schema.output = schemaLoop(schema.output, func);
|
package/dist/extractor.d.mts
CHANGED
package/dist/extractor.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as typeToSchema, d as objectMap, i as LogicType, l as cleanObject, r as EVarType, s as schemaLoop } from "./dist-
|
|
1
|
+
import { c as typeToSchema, d as objectMap, i as LogicType, l as cleanObject, r as EVarType, s as schemaLoop } from "./dist-BoFOku7q.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import * as ts$1 from "typescript";
|
|
4
4
|
import ts from "typescript";
|
|
@@ -111,7 +111,8 @@ interface TObject<T extends TProperties = TProperties> {
|
|
|
111
111
|
static: StaticObject<T>;
|
|
112
112
|
type: EVarType.object;
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
type TRecordKey = TString | TNumber;
|
|
115
|
+
interface TRecord<TKey extends TRecordKey = TString, TValue extends TSchema = TSchema> {
|
|
115
116
|
key: TKey;
|
|
116
117
|
static: StaticRecord<TKey, TValue>;
|
|
117
118
|
type: EVarType.record;
|
|
@@ -144,7 +145,7 @@ type TFunction<TInputs extends TObject = TObject, TOutput extends TSchema = TSch
|
|
|
144
145
|
static: StaticFunction<TParameters, TOutput, TPromise>;
|
|
145
146
|
type: EVarType.function;
|
|
146
147
|
};
|
|
147
|
-
type TAnyLogic = TExec | TObject | TRecord<
|
|
148
|
+
type TAnyLogic = TExec | TObject | TRecord<TRecordKey> | TInterface | TType | TArray | TString | TNumber | TBoolean | TUnknown | TUndefined | TUnion | TFunction<TObject, TSchema, boolean, ReadonlyArray<never>> | TVoid;
|
|
148
149
|
type TSchema<TLogic extends TAnyLogic = TAnyLogic> = TLogic & TArguments;
|
|
149
150
|
declare const LogicType: {
|
|
150
151
|
array: <T extends TSchema, TArgs extends TArguments<Array<StaticSchema<T>>>>(items: T, args?: TArgs) => TArray<T> & TArgs;
|
|
@@ -154,7 +155,7 @@ declare const LogicType: {
|
|
|
154
155
|
interface: <T = unknown, TArgs extends TArguments<T> = TArguments<T>>(interfaceClass: (new (...args: Array<unknown>) => T) | string, args?: TArgs) => TInterface<T> & TArgs;
|
|
155
156
|
number: <TArgs extends TArguments<number>>(args?: TArgs) => TNumber & TArgs;
|
|
156
157
|
object: <T extends TProperties, TArgs extends TArguments<object>>(properties?: T, args?: TArgs) => TObject<T> & TArgs;
|
|
157
|
-
record: <TKey extends
|
|
158
|
+
record: <TKey extends TRecordKey, TValue extends TSchema, const TArgs extends TArguments<StaticRecord<TKey, TValue>> = {}>(key: TKey, value: TValue, args?: TArgs) => TRecord<TKey, TValue> & TArgs;
|
|
158
159
|
string: <TArgs extends TArguments<string>>(args?: TArgs) => TString & TArgs;
|
|
159
160
|
type: typeof createType;
|
|
160
161
|
undefined: <const TArgs extends TArguments<undefined> = {}>(args?: TArgs) => TUndefined & TArgs;
|
|
@@ -170,7 +171,7 @@ type StaticSchema<T extends TSchema> = [TSchema] extends [T] ? unknown : T exten
|
|
|
170
171
|
static: unknown;
|
|
171
172
|
} ? Static<T> : unknown;
|
|
172
173
|
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<
|
|
174
|
+
type StaticRecord<TKey extends TSchema<TRecordKey>, TValue extends TSchema> = Record<StaticSchema<TKey> & (string | number), StaticSchema<TValue>>;
|
|
174
175
|
type StaticUnion<T extends ReadonlyArray<TSchema>> = StaticSchema<T[number]>;
|
|
175
176
|
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
177
|
optional: true;
|
|
@@ -212,6 +213,28 @@ declare const LogicUtil: {
|
|
|
212
213
|
required<TTarget extends TObject>(target: TTarget): TTransformedObject<TTarget, TRequiredProperties<TTarget["properties"]>>;
|
|
213
214
|
};
|
|
214
215
|
//#endregion
|
|
216
|
+
//#region src/logic/interface.d.ts
|
|
217
|
+
type TInterfaceConstantValue = string | number | boolean | object;
|
|
218
|
+
type TInterfaceConstantConfig<TEditor = unknown> = {
|
|
219
|
+
build?: {
|
|
220
|
+
generate?: (code: string) => string;
|
|
221
|
+
imports?: Array<{
|
|
222
|
+
name: string;
|
|
223
|
+
target: string;
|
|
224
|
+
}>;
|
|
225
|
+
};
|
|
226
|
+
editor?: TEditor;
|
|
227
|
+
parse?: (value: TInterfaceConstantValue) => unknown;
|
|
228
|
+
schema?: TSchema;
|
|
229
|
+
serialize?: (instance: unknown) => TInterfaceConstantValue;
|
|
230
|
+
};
|
|
231
|
+
type TInterfaceConfig<TEditor = unknown> = {
|
|
232
|
+
class?: new (...args: Array<unknown>) => unknown;
|
|
233
|
+
constant?: TInterfaceConstantConfig<TEditor>;
|
|
234
|
+
extends?: Array<string>;
|
|
235
|
+
name: string;
|
|
236
|
+
};
|
|
237
|
+
//#endregion
|
|
215
238
|
//#region src/logic/node.d.ts
|
|
216
239
|
type Component = {
|
|
217
240
|
name: string;
|
|
@@ -234,15 +257,17 @@ type TNodeDisplay = {
|
|
|
234
257
|
back?: string | IconDefinition;
|
|
235
258
|
data?: {
|
|
236
259
|
size?: {
|
|
237
|
-
x
|
|
238
|
-
y
|
|
260
|
+
x?: number;
|
|
261
|
+
y?: number;
|
|
239
262
|
};
|
|
240
263
|
};
|
|
241
264
|
fixed?: boolean;
|
|
242
265
|
headerless?: boolean;
|
|
243
266
|
hoverable?: boolean;
|
|
267
|
+
hue?: number;
|
|
244
268
|
icon?: string | IconDefinition;
|
|
245
269
|
inspector?: string;
|
|
270
|
+
interfaceBelow?: boolean;
|
|
246
271
|
noDelete?: boolean;
|
|
247
272
|
noSelection?: boolean;
|
|
248
273
|
notFound?: boolean;
|
|
@@ -256,6 +281,7 @@ type TNodeDisplay = {
|
|
|
256
281
|
inspector?: string;
|
|
257
282
|
interface?: Component | string;
|
|
258
283
|
name?: string;
|
|
284
|
+
onDoubleClick?: () => void | Promise<void>;
|
|
259
285
|
priority?: number;
|
|
260
286
|
};
|
|
261
287
|
type TNodeConfigDescriptor = Record<string, TSchema>;
|
|
@@ -284,6 +310,7 @@ type TNodeDynamics<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TN
|
|
|
284
310
|
};
|
|
285
311
|
type TDocumentation = {
|
|
286
312
|
description?: string;
|
|
313
|
+
dynamics?: string;
|
|
287
314
|
examples?: Array<{
|
|
288
315
|
inputs: Array<{
|
|
289
316
|
key: string;
|
|
@@ -298,6 +325,7 @@ type TDocumentation = {
|
|
|
298
325
|
description: string;
|
|
299
326
|
name: string;
|
|
300
327
|
}>;
|
|
328
|
+
short?: string;
|
|
301
329
|
};
|
|
302
330
|
type TOnlyExecOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? TAnchor : never]: TNodeInterfaceDescriptor[TAnchor]; };
|
|
303
331
|
type TOnlyVarsOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? never : TAnchor]: TNodeInterfaceDescriptor[TAnchor]; };
|
|
@@ -396,4 +424,4 @@ type TLogicNode = {
|
|
|
396
424
|
};
|
|
397
425
|
declare function makeLogicNode<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor>(node: TNodeDescriptor<TInputs, TOutputs, TConfig>): TLogicNode;
|
|
398
426
|
//#endregion
|
|
399
|
-
export { LogicUtil as a,
|
|
427
|
+
export { TVector as _, LogicUtil as a, TInterfaceConstantValue as c, TSchema as d, TVoid as f, MaybePromise as g, DeepPartial as h, LogicType as i, TLogicNode as l, CVector as m, ELogicType as n, Static as o, makeLogicNode as p, EVarType as r, TInterfaceConfig as s, ELogicScope as t, TObject as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as LogicUtil, c as
|
|
1
|
+
import { _ as TVector, a as LogicUtil, c as TInterfaceConstantValue, d as TSchema, f as TVoid, g as MaybePromise, h as DeepPartial, i as LogicType, l as TLogicNode, m as CVector, n as ELogicType, o as Static, p as makeLogicNode, r as EVarType, s as TInterfaceConfig, t as ELogicScope, u as TObject } from "./index-76yMHag4.mjs";
|
|
2
2
|
import "typescript";
|
|
3
|
-
import { Component, ComputedRef } from "vue";
|
|
3
|
+
import { Component, ComputedRef, Directive } from "vue";
|
|
4
4
|
import "@sinclair/typebox";
|
|
5
5
|
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
6
6
|
import { Cron } from "lite-cron";
|
|
@@ -78,9 +78,29 @@ type TRouteGuard = {
|
|
|
78
78
|
//#region src/types/hooks.d.ts
|
|
79
79
|
export declare enum EPluginHooks {
|
|
80
80
|
BackendMiddleware = "backend/middleware",
|
|
81
|
-
BackendInputNode = "backend/input-node"
|
|
81
|
+
BackendInputNode = "backend/input-node",
|
|
82
|
+
DatabaseScope = "database/scope",
|
|
83
|
+
DatabaseChange = "database/change"
|
|
82
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
|
+
};
|
|
83
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
|
+
};
|
|
84
104
|
[EPluginHooks.BackendMiddleware]: {
|
|
85
105
|
cookies: Record<string, {
|
|
86
106
|
options?: Record<string, unknown>;
|
|
@@ -93,6 +113,23 @@ type THookParams = {
|
|
|
93
113
|
};
|
|
94
114
|
};
|
|
95
115
|
//#endregion
|
|
116
|
+
//#region src/types/interface.d.ts
|
|
117
|
+
type TInterface = TInterfaceConfig<Component> & {
|
|
118
|
+
arguments?: Array<TSchema>;
|
|
119
|
+
description?: string;
|
|
120
|
+
methods?: Array<{
|
|
121
|
+
name: string;
|
|
122
|
+
parameters?: Array<TSchema>;
|
|
123
|
+
return: TSchema;
|
|
124
|
+
}>;
|
|
125
|
+
};
|
|
126
|
+
type TInterfaceEditorProps = {
|
|
127
|
+
anchor?: boolean;
|
|
128
|
+
modelValue?: TInterfaceConstantValue;
|
|
129
|
+
placeholder?: string;
|
|
130
|
+
schema: TSchema;
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
96
133
|
//#region ../logic-dts/dist/nodes.d.ts
|
|
97
134
|
type TExportNodeFunction = {
|
|
98
135
|
name?: string;
|
|
@@ -109,7 +146,7 @@ type TExportNodeResult = {
|
|
|
109
146
|
types: Record<string, TSchema>;
|
|
110
147
|
};
|
|
111
148
|
//#endregion
|
|
112
|
-
//#region ../shared/dist/index-
|
|
149
|
+
//#region ../shared/dist/index-BWE-Rute.d.mts
|
|
113
150
|
//#endregion
|
|
114
151
|
//#region src/types/editor/wire.d.ts
|
|
115
152
|
declare class CPathPoint {
|
|
@@ -138,7 +175,7 @@ declare class CWire {
|
|
|
138
175
|
get type(): TSchema;
|
|
139
176
|
get toType(): TSchema;
|
|
140
177
|
getPoints(): string;
|
|
141
|
-
|
|
178
|
+
getPath(): TPath;
|
|
142
179
|
}
|
|
143
180
|
type TWire<TExport extends boolean = false> = TExport extends true ? {
|
|
144
181
|
from: {
|
|
@@ -284,7 +321,6 @@ type TRouteGuardRef = {
|
|
|
284
321
|
};
|
|
285
322
|
type TFileRoute<TExport extends boolean = false> = TFileBase<TExport> & {
|
|
286
323
|
type: EElementType.Route;
|
|
287
|
-
dev?: boolean;
|
|
288
324
|
guards?: Array<TRouteGuardRef>;
|
|
289
325
|
input: {
|
|
290
326
|
body: TSchema;
|
|
@@ -330,19 +366,6 @@ type TFileStore<TExport extends boolean = false> = TFileBase<TExport> & {
|
|
|
330
366
|
value: Record<string, unknown>;
|
|
331
367
|
}>;
|
|
332
368
|
//#endregion
|
|
333
|
-
//#region src/layout/template.d.ts
|
|
334
|
-
declare enum EElementTemplate {
|
|
335
|
-
If = "if",
|
|
336
|
-
For = "for"
|
|
337
|
-
}
|
|
338
|
-
declare enum ETemplatePreview {
|
|
339
|
-
Display = "display",
|
|
340
|
-
Hide = "hide",
|
|
341
|
-
Real = "real",
|
|
342
|
-
Once = "once",
|
|
343
|
-
All = "all"
|
|
344
|
-
}
|
|
345
|
-
//#endregion
|
|
346
369
|
//#region src/types/layout.d.ts
|
|
347
370
|
type TTextBlock = {
|
|
348
371
|
content: string;
|
|
@@ -359,10 +382,6 @@ type TLayoutContentType<TElement extends ELayoutElement, TExport extends boolean
|
|
|
359
382
|
} : TElement extends ELayoutElement.customHtml ? {
|
|
360
383
|
html: string;
|
|
361
384
|
variables: Array<string>;
|
|
362
|
-
} : TElement extends ELayoutElement.template ? {
|
|
363
|
-
preview: ETemplatePreview;
|
|
364
|
-
template: EElementTemplate;
|
|
365
|
-
var: TMaybeDynamicVariable<TExport>;
|
|
366
385
|
} : TElement extends ELayoutElement.package ? {
|
|
367
386
|
slots: Record<string, TLayoutSchema<ELayoutElement, TExport>>;
|
|
368
387
|
target: Array<string>;
|
|
@@ -380,6 +399,11 @@ type TLayoutStyle<TExport extends boolean = false> = {
|
|
|
380
399
|
quick?: Array<string>;
|
|
381
400
|
[media: `${number}`]: TLayoutStyleStates<TExport> | undefined;
|
|
382
401
|
};
|
|
402
|
+
type TLayoutClass<TExport extends boolean = false> = {
|
|
403
|
+
id: string;
|
|
404
|
+
name: string;
|
|
405
|
+
style: TLayoutStyle<TExport>;
|
|
406
|
+
};
|
|
383
407
|
type TLayoutEventParameter<TExport extends boolean = false> = {
|
|
384
408
|
schema: TSchema;
|
|
385
409
|
value: TMaybeDynamicVariable<TExport>;
|
|
@@ -393,7 +417,8 @@ type TLayoutSchema<TElement extends ELayoutElement = ELayoutElement, TExport ext
|
|
|
393
417
|
content: TLayoutContentType<TInnerElement, TExport>;
|
|
394
418
|
element: TInnerElement;
|
|
395
419
|
events: Record<string, Record<string, TLayoutEventParameter<TExport>>>;
|
|
396
|
-
|
|
420
|
+
models?: Record<string, Array<string>>;
|
|
421
|
+
plugins?: Record<string, Record<string, TMaybeDynamicVariable<TExport>>>;
|
|
397
422
|
properties: Record<string, TMaybeDynamicVariable<TExport>>;
|
|
398
423
|
style: TLayoutStyle<TExport>;
|
|
399
424
|
tag?: string;
|
|
@@ -459,8 +484,11 @@ type TApplicationConfig = {
|
|
|
459
484
|
};
|
|
460
485
|
description?: string;
|
|
461
486
|
desktop: {
|
|
487
|
+
appleTeamId?: string;
|
|
488
|
+
backendUrl?: string;
|
|
462
489
|
fullscreen: boolean;
|
|
463
490
|
height: number;
|
|
491
|
+
identifier?: string;
|
|
464
492
|
resizable: boolean;
|
|
465
493
|
version: string;
|
|
466
494
|
width: number;
|
|
@@ -498,8 +526,29 @@ type TApplicationConfig = {
|
|
|
498
526
|
web: {
|
|
499
527
|
history: EHistoryMode;
|
|
500
528
|
pwa: boolean;
|
|
529
|
+
pwaConfig?: TApplicationPwaConfig;
|
|
501
530
|
};
|
|
502
531
|
};
|
|
532
|
+
declare enum EPwaDisplay {
|
|
533
|
+
Standalone = "standalone",
|
|
534
|
+
Fullscreen = "fullscreen",
|
|
535
|
+
MinimalUi = "minimal-ui",
|
|
536
|
+
Browser = "browser"
|
|
537
|
+
}
|
|
538
|
+
declare enum EPwaOrientation {
|
|
539
|
+
Any = "any",
|
|
540
|
+
Portrait = "portrait",
|
|
541
|
+
Landscape = "landscape"
|
|
542
|
+
}
|
|
543
|
+
type TApplicationPwaConfig = {
|
|
544
|
+
backgroundColor: string;
|
|
545
|
+
description: string;
|
|
546
|
+
display: EPwaDisplay;
|
|
547
|
+
icon: string;
|
|
548
|
+
orientation: EPwaOrientation;
|
|
549
|
+
shortName: string;
|
|
550
|
+
themeColor: string;
|
|
551
|
+
};
|
|
503
552
|
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>;
|
|
504
553
|
//#endregion
|
|
505
554
|
//#region src/types/files/folder.d.ts
|
|
@@ -578,6 +627,7 @@ type TCanvas = {
|
|
|
578
627
|
zoom: number;
|
|
579
628
|
};
|
|
580
629
|
type TGraph<TExport extends boolean = false> = {
|
|
630
|
+
autoplace?: boolean;
|
|
581
631
|
canvas: TCanvas;
|
|
582
632
|
nodes: Record<string, TNode<TExport>>;
|
|
583
633
|
wires: Record<string, TWire<TExport>>;
|
|
@@ -631,7 +681,7 @@ type TNodeData = {
|
|
|
631
681
|
number: number;
|
|
632
682
|
};
|
|
633
683
|
optionals?: Record<string, boolean>;
|
|
634
|
-
size?: TVector
|
|
684
|
+
size?: Partial<TVector>;
|
|
635
685
|
} & Record<string, unknown>;
|
|
636
686
|
declare class CNode {
|
|
637
687
|
id: string;
|
|
@@ -668,6 +718,7 @@ declare class CNode {
|
|
|
668
718
|
getRelativeAnchorLocation(anchor: CNodeAnchor): CVector;
|
|
669
719
|
getRelativeAnchorLocation_internal(anchor: CNodeAnchor): CVector;
|
|
670
720
|
getLocation(): CVector;
|
|
721
|
+
getHeaderHeight(): number;
|
|
671
722
|
getSize(): TVector;
|
|
672
723
|
execute(outputKey: string, stack?: TStack): MaybePromise<void>;
|
|
673
724
|
get isAsync(): boolean;
|
|
@@ -808,6 +859,7 @@ type TComponentOptions = {
|
|
|
808
859
|
};
|
|
809
860
|
type TFileComponent<TExport extends boolean = false> = TFileBase<TExport> & {
|
|
810
861
|
type: EElementType.Component;
|
|
862
|
+
classes?: Record<string, TLayoutClass<TExport>>;
|
|
811
863
|
collapsed?: boolean;
|
|
812
864
|
layout: TLayoutSchema<ELayoutElement, TExport>;
|
|
813
865
|
logics: Record<string, TAnyLogic<TExport>>;
|
|
@@ -829,39 +881,40 @@ declare enum EDynamicVariableType {
|
|
|
829
881
|
Dynamic = "dynamic",
|
|
830
882
|
Token = "token"
|
|
831
883
|
}
|
|
832
|
-
declare enum
|
|
833
|
-
Identity = "identity",
|
|
884
|
+
declare enum EDynamicOperation {
|
|
834
885
|
Equal = "equal",
|
|
835
886
|
NotEqual = "not-equal",
|
|
836
887
|
Greater = "greater",
|
|
837
|
-
Less = "less",
|
|
838
888
|
GreaterEqual = "greater-equal",
|
|
889
|
+
Less = "less",
|
|
839
890
|
LessEqual = "less-equal",
|
|
840
891
|
StartsWith = "starts-with",
|
|
841
892
|
EndsWith = "ends-with",
|
|
842
893
|
Includes = "includes",
|
|
843
|
-
Ternary = "ternary",
|
|
844
|
-
Cast = "cast",
|
|
845
894
|
At = "at",
|
|
846
|
-
Join = "join"
|
|
847
|
-
|
|
848
|
-
|
|
895
|
+
Join = "join",
|
|
896
|
+
ToLowerCase = "to-lower-case",
|
|
897
|
+
Length = "length",
|
|
898
|
+
Not = "not",
|
|
899
|
+
And = "and",
|
|
900
|
+
Or = "or",
|
|
849
901
|
Add = "add",
|
|
850
902
|
Subtract = "subtract",
|
|
851
903
|
Multiply = "multiply",
|
|
852
904
|
Divide = "divide",
|
|
853
905
|
Modulo = "modulo",
|
|
854
|
-
|
|
855
|
-
|
|
906
|
+
Ternary = "ternary",
|
|
907
|
+
ToString = "to-string",
|
|
908
|
+
ToNumber = "to-number",
|
|
909
|
+
ToBoolean = "to-boolean",
|
|
910
|
+
Call = "call"
|
|
856
911
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
mode?: EVarType;
|
|
864
|
-
operation: EDynamicVariableOperation;
|
|
912
|
+
/**
|
|
913
|
+
* One operation applied to the previous value, optionally followed by a property access on its result.
|
|
914
|
+
*/
|
|
915
|
+
type TDynamicVariableStep = {
|
|
916
|
+
access?: Array<string>;
|
|
917
|
+
operation: EDynamicOperation;
|
|
865
918
|
variables: Array<TMaybeDynamicVariable<true>>;
|
|
866
919
|
};
|
|
867
920
|
/**
|
|
@@ -871,7 +924,7 @@ type TBaseDynamicVariable = {
|
|
|
871
924
|
type: EDynamicVariableType;
|
|
872
925
|
_dynamic: true;
|
|
873
926
|
access: Array<string>;
|
|
874
|
-
|
|
927
|
+
steps?: Array<TDynamicVariableStep>;
|
|
875
928
|
token: string;
|
|
876
929
|
value: unknown;
|
|
877
930
|
};
|
|
@@ -903,16 +956,38 @@ type TValue<TExport extends boolean = false> = TExport extends false ? {
|
|
|
903
956
|
schema: TSchema;
|
|
904
957
|
} : TSchema;
|
|
905
958
|
//#endregion
|
|
906
|
-
//#region src/types/
|
|
907
|
-
type
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
959
|
+
//#region src/types/panel.d.ts
|
|
960
|
+
type TElementPanelAction = {
|
|
961
|
+
icon: IconDefinition;
|
|
962
|
+
onClick: (params: {
|
|
963
|
+
getElements: () => Array<HTMLElement>;
|
|
964
|
+
schema: TLayoutSchema;
|
|
965
|
+
}) => void;
|
|
966
|
+
title: string;
|
|
967
|
+
};
|
|
968
|
+
type TElementPanel = {
|
|
969
|
+
actions?: Array<TElementPanelAction>;
|
|
970
|
+
component?: Component;
|
|
971
|
+
directive?: {
|
|
972
|
+
build: {
|
|
973
|
+
from: string;
|
|
974
|
+
name: `v${string}`;
|
|
975
|
+
};
|
|
976
|
+
value: Directive;
|
|
977
|
+
};
|
|
978
|
+
filter?: (schema: TLayoutSchema) => boolean;
|
|
979
|
+
icon?: IconDefinition;
|
|
980
|
+
id: string;
|
|
981
|
+
label: string;
|
|
982
|
+
properties?: Record<string, TSchema>;
|
|
983
|
+
};
|
|
984
|
+
type TElementPanelProps<TValues = Record<string, unknown>> = {
|
|
985
|
+
getElements: () => Array<HTMLElement>;
|
|
986
|
+
modelValue: TValues;
|
|
987
|
+
schema: TLayoutSchema;
|
|
988
|
+
};
|
|
989
|
+
type TPanels = {
|
|
990
|
+
element?: Array<TElementPanel>;
|
|
916
991
|
};
|
|
917
992
|
//#endregion
|
|
918
993
|
//#region src/types/template.d.ts
|
|
@@ -955,6 +1030,7 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
|
|
|
955
1030
|
name: string;
|
|
956
1031
|
version?: string;
|
|
957
1032
|
}>;
|
|
1033
|
+
env?: Record<string, string>;
|
|
958
1034
|
frontImports?: Array<{
|
|
959
1035
|
name: string;
|
|
960
1036
|
version?: string;
|
|
@@ -975,6 +1051,7 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
|
|
|
975
1051
|
inputs?: Record<string, Component>;
|
|
976
1052
|
interfaces?: Array<TInterface>;
|
|
977
1053
|
nodes?: Array<TLogicNode>;
|
|
1054
|
+
panel?: TPanels;
|
|
978
1055
|
templates?: Array<TTemplate>;
|
|
979
1056
|
tokens?: Array<TToken>;
|
|
980
1057
|
wrapper?: TComponent & {
|
|
@@ -1020,6 +1097,7 @@ type TEnv<TConfig extends TSchema = TSchema, TInternals = unknown> = {
|
|
|
1020
1097
|
config: Static<TConfig>;
|
|
1021
1098
|
getFile: (id: string) => TFile | undefined;
|
|
1022
1099
|
internals: TInternals;
|
|
1100
|
+
log: (message: string, severity?: "info" | "warning" | "error") => void;
|
|
1023
1101
|
mode: "build" | "editor";
|
|
1024
1102
|
};
|
|
1025
1103
|
type TOption<TParams = unknown, TResult = unknown> = TResult | ((env: TParams) => Promise<TResult> | TResult);
|
|
@@ -1030,4 +1108,4 @@ export declare function makeComponent<TProps extends Record<string, TSchema>>(co
|
|
|
1030
1108
|
export declare function loadPlugin<TConfig extends TSchema, TInternal>(plugin: TPlugin<TConfig, TInternal>, env: Partial<TEnv>): Promise<TBasePlugin<TConfig, TInternal>>;
|
|
1031
1109
|
export declare function getPluginParam<T>(target: TOption<TEnv, T>, env: Partial<TEnv>): Promise<T>;
|
|
1032
1110
|
//#endregion
|
|
1033
|
-
export { EElementType, ELogicScope, ELogicType, 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 TRouteGuard, type TSchema, type TSlot, type TTemplate, type TToken, makeLogicNode };
|
|
1111
|
+
export { EElementType, ELogicScope, ELogicType, EVarType, _default as LSettingsStoryWrapper, LogicType, LogicUtil, type Static, type TAnyLogic, type TApplication, type TBasePlugin, type TComponent, type TDatabaseCondition, type TElementPanel, type TElementPanelAction, type TElementPanelProps, 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 TInterface, type TInterfaceEditorProps, type TLayoutSchema, type TLogic, type TLogicMain, type TLogicNode, type TOption, type TPanels, type TPlugin, type TProxyPlugin, type TRouteGuard, type TSchema, type TSlot, type TTemplate, type TToken, makeLogicNode };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as LogicUtil, i as LogicType, n as ELogicType, o as makeLogicNode, r as EVarType, t as ELogicScope, u as cloneWithFunctions } from "./dist-
|
|
1
|
+
import { a as LogicUtil, i as LogicType, n as ELogicType, o as makeLogicNode, r as EVarType, t as ELogicScope, u as cloneWithFunctions } from "./dist-BoFOku7q.mjs";
|
|
2
2
|
import { createElementBlock, openBlock, renderSlot } from "vue";
|
|
3
3
|
import { Type } from "@sinclair/typebox";
|
|
4
4
|
//#region \0/plugin-vue/export-helper
|
|
@@ -20,6 +20,8 @@ var LSettingsStoryWrapper_default = /*#__PURE__*/ export_helper_default(_sfc_mai
|
|
|
20
20
|
let EPluginHooks = /* @__PURE__ */ function(EPluginHooks) {
|
|
21
21
|
EPluginHooks["BackendMiddleware"] = "backend/middleware";
|
|
22
22
|
EPluginHooks["BackendInputNode"] = "backend/input-node";
|
|
23
|
+
EPluginHooks["DatabaseScope"] = "database/scope";
|
|
24
|
+
EPluginHooks["DatabaseChange"] = "database/change";
|
|
23
25
|
return EPluginHooks;
|
|
24
26
|
}({});
|
|
25
27
|
//#endregion
|
|
@@ -183,9 +185,7 @@ let EPlanKey = /* @__PURE__ */ function(EPlanKey) {
|
|
|
183
185
|
const flags = {
|
|
184
186
|
free: {
|
|
185
187
|
compilation: {
|
|
186
|
-
desktop: false,
|
|
187
188
|
export: true,
|
|
188
|
-
mobile: false,
|
|
189
189
|
source: false,
|
|
190
190
|
web: true
|
|
191
191
|
},
|
|
@@ -193,13 +193,15 @@ const flags = {
|
|
|
193
193
|
desktop: false,
|
|
194
194
|
web: true
|
|
195
195
|
},
|
|
196
|
+
desktop: { compilation: {
|
|
197
|
+
desktop: false,
|
|
198
|
+
mobile: false
|
|
199
|
+
} },
|
|
196
200
|
watermark: true
|
|
197
201
|
},
|
|
198
202
|
pro: {
|
|
199
203
|
compilation: {
|
|
200
|
-
desktop: true,
|
|
201
204
|
export: true,
|
|
202
|
-
mobile: true,
|
|
203
205
|
source: true,
|
|
204
206
|
web: true
|
|
205
207
|
},
|
|
@@ -207,6 +209,10 @@ const flags = {
|
|
|
207
209
|
desktop: true,
|
|
208
210
|
web: true
|
|
209
211
|
},
|
|
212
|
+
desktop: { compilation: {
|
|
213
|
+
desktop: true,
|
|
214
|
+
mobile: true
|
|
215
|
+
} },
|
|
210
216
|
watermark: false
|
|
211
217
|
}
|
|
212
218
|
};
|
|
@@ -215,6 +221,10 @@ const user = Type.Object({
|
|
|
215
221
|
id: Type.Optional(Type.String()),
|
|
216
222
|
auth: Type.Optional(Type.Object({})),
|
|
217
223
|
mail: Type.String(),
|
|
224
|
+
terms: Type.Optional(Type.Object({
|
|
225
|
+
version: Type.Union([Type.String(), Type.Null()]),
|
|
226
|
+
acceptedAt: Type.Union([Type.String(), Type.Null()])
|
|
227
|
+
})),
|
|
218
228
|
plan: Type.Object({ name: Type.Enum(EPlanKey) }),
|
|
219
229
|
profile: Type.Object({
|
|
220
230
|
other: Type.Object({
|
|
@@ -383,19 +393,11 @@ const build = {
|
|
|
383
393
|
};
|
|
384
394
|
const compile$1 = {
|
|
385
395
|
type: "post",
|
|
386
|
-
body: Type.Object({
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
])),
|
|
392
|
-
target: Type.Union([
|
|
393
|
-
Type.Literal("source"),
|
|
394
|
-
Type.Literal("export"),
|
|
395
|
-
Type.Literal("web"),
|
|
396
|
-
Type.Literal("desktop")
|
|
397
|
-
])
|
|
398
|
-
}),
|
|
396
|
+
body: Type.Object({ target: Type.Union([
|
|
397
|
+
Type.Literal("source"),
|
|
398
|
+
Type.Literal("export"),
|
|
399
|
+
Type.Literal("web")
|
|
400
|
+
]) }),
|
|
399
401
|
params: Type.Object({ id: Type.String() }),
|
|
400
402
|
response: { 200: Type.Object({
|
|
401
403
|
message: Type.String(),
|
|
@@ -407,22 +409,10 @@ const download = {
|
|
|
407
409
|
type: "get",
|
|
408
410
|
params: Type.Object({
|
|
409
411
|
id: Type.String(),
|
|
410
|
-
|
|
411
|
-
Type.Literal("win32-installer"),
|
|
412
|
-
Type.Literal("darwin-installer"),
|
|
413
|
-
Type.Literal("linux-installer"),
|
|
414
|
-
Type.Literal("win32-portable"),
|
|
415
|
-
Type.Literal("darwin-portable"),
|
|
416
|
-
Type.Literal("linux-portable")
|
|
417
|
-
])),
|
|
418
|
-
target: Type.Union([
|
|
419
|
-
Type.Literal("source"),
|
|
420
|
-
Type.Literal("export"),
|
|
421
|
-
Type.Literal("desktop")
|
|
422
|
-
])
|
|
412
|
+
target: Type.Union([Type.Literal("source"), Type.Literal("export")])
|
|
423
413
|
}),
|
|
424
414
|
response: { 200: Type.Unknown() },
|
|
425
|
-
url: "/compiler/download/:id/:target
|
|
415
|
+
url: "/compiler/download/:id/:target"
|
|
426
416
|
};
|
|
427
417
|
var desktop_exports = /* @__PURE__ */ __exportAll({ latest: () => latest });
|
|
428
418
|
const latest = {
|
|
@@ -809,6 +799,7 @@ const tick = {
|
|
|
809
799
|
url: "/turnstile/tick"
|
|
810
800
|
};
|
|
811
801
|
var user_exports = /* @__PURE__ */ __exportAll({
|
|
802
|
+
acceptTerms: () => acceptTerms,
|
|
812
803
|
confirmAccountDeletion: () => confirmAccountDeletion,
|
|
813
804
|
disconnect: () => disconnect,
|
|
814
805
|
get: () => get,
|
|
@@ -831,6 +822,12 @@ const get = {
|
|
|
831
822
|
response: { 200: types.user },
|
|
832
823
|
url: "/user"
|
|
833
824
|
};
|
|
825
|
+
const acceptTerms = {
|
|
826
|
+
type: "post",
|
|
827
|
+
body: Type.Object({ termsVersion: Type.String() }),
|
|
828
|
+
response: { 200: Type.Object({ message: Type.String() }) },
|
|
829
|
+
url: "/user/terms/accept"
|
|
830
|
+
};
|
|
834
831
|
const update = {
|
|
835
832
|
type: "post",
|
|
836
833
|
body: Type.Partial(types.user),
|
|
@@ -908,6 +905,46 @@ function getContent(response) {
|
|
|
908
905
|
if (response.headers.get("Content-Type")?.startsWith("application/json")) return response.json();
|
|
909
906
|
return response.text();
|
|
910
907
|
}
|
|
908
|
+
function isSchemaType(schema, ...types) {
|
|
909
|
+
if (schema?.type === EVarType.union) return schema.elements.length > 0 && schema.elements.every((element) => isSchemaType(element, ...types));
|
|
910
|
+
return Boolean(schema && types.includes(schema.type));
|
|
911
|
+
}
|
|
912
|
+
function strip(schema) {
|
|
913
|
+
const result = { ...schema };
|
|
914
|
+
delete result.default;
|
|
915
|
+
delete result.name;
|
|
916
|
+
delete result.optional;
|
|
917
|
+
return result;
|
|
918
|
+
}
|
|
919
|
+
function named(schema, name) {
|
|
920
|
+
return {
|
|
921
|
+
...strip(schema),
|
|
922
|
+
name
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
function binary(operator, precedence, types, evaluate, output) {
|
|
926
|
+
return {
|
|
927
|
+
accepts: (input) => isSchemaType(input, ...types),
|
|
928
|
+
argPrecedence: precedence + 1,
|
|
929
|
+
args: (input) => [named(input, "Value")],
|
|
930
|
+
evaluate,
|
|
931
|
+
inputPrecedence: precedence,
|
|
932
|
+
output: output ?? ((input) => strip(input)),
|
|
933
|
+
precedence,
|
|
934
|
+
print: (input, [arg]) => `${input} ${operator} ${arg}`
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
function comparison(operator, precedence, types, evaluate) {
|
|
938
|
+
return binary(operator, precedence, types, evaluate, () => LogicType.boolean());
|
|
939
|
+
}
|
|
940
|
+
const primitives = [
|
|
941
|
+
EVarType.boolean,
|
|
942
|
+
EVarType.number,
|
|
943
|
+
EVarType.string,
|
|
944
|
+
EVarType.unknown
|
|
945
|
+
];
|
|
946
|
+
const ordered = [EVarType.number, EVarType.string];
|
|
947
|
+
comparison("===", 8, primitives, (input, [arg]) => input === arg), comparison("!==", 8, primitives, (input, [arg]) => input !== arg), comparison(">", 9, ordered, (input, [arg]) => input > arg), comparison(">=", 9, ordered, (input, [arg]) => input >= arg), comparison("<", 9, ordered, (input, [arg]) => input < arg), comparison("<=", 9, ordered, (input, [arg]) => input <= arg), binary("&&", 4, [EVarType.boolean], (input, [arg]) => Boolean(input && arg)), binary("||", 3, primitives, (input, [arg]) => input || arg), binary("+", 11, [EVarType.number, EVarType.string], (input, [arg]) => input + arg), binary("-", 11, [EVarType.number], (input, [arg]) => input - arg), binary("*", 12, [EVarType.number], (input, [arg]) => input * arg), binary("/", 12, [EVarType.number], (input, [arg]) => input / arg), binary("%", 12, [EVarType.number], (input, [arg]) => input % arg), EVarType.boolean, EVarType.number, EVarType.unknown, LogicType.string(), EVarType.boolean, EVarType.string, EVarType.unknown, LogicType.number(), EVarType.number, EVarType.string, EVarType.unknown, LogicType.boolean();
|
|
911
948
|
//#endregion
|
|
912
949
|
//#region src/index.ts
|
|
913
950
|
function makePlugin(plugin) {
|