@luna-park/plugin 1.8.0 → 2.0.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/dist/index.mjs CHANGED
@@ -1,55 +1,20 @@
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";
1
+ import { a as LogicUtil, c as mergeIntersection, i as LogicType, n as ELogicType, o as getSchemaDefault, p as cloneWithFunctions, r as EVarType, s as makeLogicNode, t as ELogicScope } from "./dist-CZjmIqBC.mjs";
2
2
  import { createElementBlock, openBlock, renderSlot } from "vue";
3
3
  import { Type } from "@sinclair/typebox";
4
- //#region \0/plugin-vue/export-helper
4
+ // \0/plugin-vue/export-helper
5
5
  var export_helper_default = (sfc, props) => {
6
6
  const target = sfc.__vccOpts || sfc;
7
7
  for (const [key, val] of props) target[key] = val;
8
8
  return target;
9
9
  };
10
- //#endregion
11
- //#region src/components/LSettingsStoryWrapper.vue
10
+ // src/components/LSettingsStoryWrapper.vue
12
11
  const _sfc_main = {};
13
12
  const _hoisted_1 = { class: "story-wrapper" };
14
13
  function _sfc_render(_ctx, _cache) {
15
14
  return openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]);
16
15
  }
17
16
  var LSettingsStoryWrapper_default = /*#__PURE__*/ export_helper_default(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8d6cff07"]]);
18
- //#endregion
19
- //#region src/types/hooks.ts
20
- let EPluginHooks = /* @__PURE__ */ function(EPluginHooks) {
21
- EPluginHooks["BackendMiddleware"] = "backend/middleware";
22
- EPluginHooks["BackendInputNode"] = "backend/input-node";
23
- EPluginHooks["DatabaseScope"] = "database/scope";
24
- EPluginHooks["DatabaseChange"] = "database/change";
25
- return EPluginHooks;
26
- }({});
27
- //#endregion
28
- //#region src/types/plugin.ts
29
- let EInjectionKey = /* @__PURE__ */ function(EInjectionKey) {
30
- EInjectionKey["ViteImport"] = "viteImport";
31
- EInjectionKey["VitePlugin"] = "vitePlugin";
32
- EInjectionKey["AppImport"] = "appImport";
33
- EInjectionKey["AppBody"] = "appBody";
34
- EInjectionKey["AppSetup"] = "appSetup";
35
- EInjectionKey["Style"] = "style";
36
- EInjectionKey["ServerImport"] = "serverImport";
37
- EInjectionKey["ServerBody"] = "serverBody";
38
- return EInjectionKey;
39
- }({});
40
- //#endregion
41
- //#region src/types/token.ts
42
- let ETokenType = /* @__PURE__ */ function(ETokenType) {
43
- ETokenType["Color"] = "color";
44
- ETokenType["FontSize"] = "font-size";
45
- ETokenType["FontWeight"] = "font-weight";
46
- ETokenType["FontFamily"] = "font-family";
47
- ETokenType["Length"] = "length";
48
- ETokenType["Time"] = "time";
49
- return ETokenType;
50
- }({});
51
- //#endregion
52
- //#region ../shared/dist/rolldown-runtime-D7D4PA-g.mjs
17
+ // ../shared/dist/rolldown-runtime-D8jQpDG7.mjs
53
18
  var __defProp = Object.defineProperty;
54
19
  var __exportAll = (all, no_symbols) => {
55
20
  let target = {};
@@ -60,8 +25,7 @@ var __exportAll = (all, no_symbols) => {
60
25
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
61
26
  return target;
62
27
  };
63
- //#endregion
64
- //#region ../shared/dist/index.mjs
28
+ // ../shared/dist/index.mjs
65
29
  const config = {
66
30
  backendUrl: "https://luna-park.app",
67
31
  hostUrl: "https://host.luna-park.app",
@@ -89,7 +53,7 @@ var api_default = {
89
53
  };
90
54
  if (!init.body) {
91
55
  init.headers = { ...init.headers };
92
- delete init.headers?.["Content-Type"];
56
+ delete init.headers["Content-Type"];
93
57
  }
94
58
  return fetch(url, init);
95
59
  },
@@ -134,30 +98,23 @@ var app_exports$1 = /* @__PURE__ */ __exportAll({
134
98
  appEdits: () => appEdits
135
99
  });
136
100
  /**
137
- * Wire schema of an application, validated loosely (see `TApplication<true>` for the full shape)
101
+ * Wire schema of an application, validated loosely but typed as `TApplicationExport`
138
102
  */
139
- const app = Type.Object({
103
+ const app = Type.Unsafe(Type.Object({
140
104
  name: Type.String(),
141
105
  config: Type.Record(Type.String(), Type.Unknown()),
142
106
  tree: Type.Unknown(),
143
107
  version: Type.Optional(Type.Number())
144
- });
108
+ }));
145
109
  const appEdits = Type.Array(Type.Object({
146
110
  file: Type.Unknown(),
147
111
  path: Type.String()
148
112
  }));
149
- const keyConfig = Type.Object({
150
- id: Type.Optional(Type.String()),
151
- domain: Type.String(),
152
- owner: Type.String(),
153
- private: Type.String(),
154
- public: Type.String()
155
- });
156
113
  const project = Type.Object({
157
114
  id: Type.String(),
158
115
  app: Type.Object({
159
116
  name: Type.String(),
160
- config: Type.Unknown()
117
+ config: Type.Unsafe(Type.Unknown())
161
118
  }),
162
119
  createdAt: TypeDate,
163
120
  icon: Type.String(),
@@ -175,28 +132,40 @@ const privateProject = Type.Object({
175
132
  ...project.properties,
176
133
  app: Type.Unknown()
177
134
  });
135
+ const session = Type.Object({
136
+ id: Type.String(),
137
+ createdAt: Type.String(),
138
+ current: Type.Boolean(),
139
+ lastUsedAt: Type.Optional(Type.String()),
140
+ userAgent: Type.Optional(Type.String())
141
+ });
178
142
  let EPlanKey = /* @__PURE__ */ function(EPlanKey) {
179
143
  EPlanKey["Free"] = "free";
180
144
  EPlanKey["Edu"] = "edu";
181
145
  EPlanKey["Pro"] = "pro";
182
- EPlanKey["Org"] = "org";
183
146
  return EPlanKey;
184
147
  }({});
148
+ let EPaymentOffer = /* @__PURE__ */ function(EPaymentOffer) {
149
+ EPaymentOffer["Monthly"] = "monthly";
150
+ EPaymentOffer["Perpetual"] = "perpetual";
151
+ EPaymentOffer["Renewal"] = "renewal";
152
+ return EPaymentOffer;
153
+ }({});
185
154
  const flags = {
186
155
  free: {
187
156
  compilation: {
188
157
  export: true,
189
- source: false,
190
- web: true
191
- },
192
- editor: {
193
- desktop: false,
158
+ source: true,
194
159
  web: true
195
160
  },
196
161
  desktop: { compilation: {
197
162
  desktop: false,
198
163
  mobile: false
199
164
  } },
165
+ editor: {
166
+ desktop: true,
167
+ web: true
168
+ },
200
169
  watermark: true
201
170
  },
202
171
  pro: {
@@ -205,27 +174,26 @@ const flags = {
205
174
  source: true,
206
175
  web: true
207
176
  },
208
- editor: {
209
- desktop: true,
210
- web: true
211
- },
212
177
  desktop: { compilation: {
213
178
  desktop: true,
214
179
  mobile: true
215
180
  } },
181
+ editor: {
182
+ desktop: true,
183
+ web: true
184
+ },
216
185
  watermark: false
217
186
  }
218
187
  };
219
- flags.pro, flags.pro, flags.pro, flags.free;
188
+ flags.pro, flags.pro, flags.free;
220
189
  const user = Type.Object({
221
190
  id: Type.Optional(Type.String()),
222
191
  auth: Type.Optional(Type.Object({})),
223
192
  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
- })),
228
- plan: Type.Object({ name: Type.Enum(EPlanKey) }),
193
+ plan: Type.Object({
194
+ name: Type.Enum(EPlanKey),
195
+ updatesUntil: Type.Optional(Type.String())
196
+ }),
229
197
  profile: Type.Object({
230
198
  other: Type.Object({
231
199
  avatar: Type.String(),
@@ -248,7 +216,11 @@ const user = Type.Object({
248
216
  settings: Type.Object({
249
217
  newsletter: Type.Boolean(),
250
218
  onboarding: Type.Boolean()
251
- })
219
+ }),
220
+ terms: Type.Optional(Type.Object({
221
+ acceptedAt: Type.Union([Type.String(), Type.Null()]),
222
+ version: Type.Union([Type.String(), Type.Null()])
223
+ }))
252
224
  });
253
225
  let EElementType = /* @__PURE__ */ function(EElementType) {
254
226
  EElementType["Script"] = "script";
@@ -267,12 +239,32 @@ let EElementType = /* @__PURE__ */ function(EElementType) {
267
239
  EElementType["Media"] = "media";
268
240
  return EElementType;
269
241
  }({});
242
+ let EDBOperation = /* @__PURE__ */ function(EDBOperation) {
243
+ EDBOperation["And"] = "and";
244
+ EDBOperation["Or"] = "or";
245
+ return EDBOperation;
246
+ }({});
247
+ let EDBCondition = /* @__PURE__ */ function(EDBCondition) {
248
+ EDBCondition["Equals"] = "equals";
249
+ EDBCondition["NotEquals"] = "notEquals";
250
+ EDBCondition["GreaterThan"] = "greaterThan";
251
+ EDBCondition["LessThan"] = "lessThan";
252
+ EDBCondition["GreaterThanOrEquals"] = "greaterThanOrEquals";
253
+ EDBCondition["LessThanOrEquals"] = "lessThanOrEquals";
254
+ EDBCondition["In"] = "in";
255
+ EDBCondition["IsNull"] = "isNull";
256
+ EDBCondition["NotNull"] = "notNull";
257
+ EDBCondition["Like"] = "like";
258
+ EDBCondition["ILike"] = "ilike";
259
+ EDBCondition["Contains"] = "contains";
260
+ return EDBCondition;
261
+ }({});
270
262
  const types = {
271
263
  ...app_exports$1,
272
- keyConfig,
273
264
  privateProject,
274
265
  project,
275
266
  publicProject,
267
+ session,
276
268
  user
277
269
  };
278
270
  var app_exports = /* @__PURE__ */ __exportAll({
@@ -309,6 +301,8 @@ const authorize = {
309
301
  type: "post",
310
302
  body: Type.Object({
311
303
  client_id: Type.String(),
304
+ code_challenge: Type.Optional(Type.String()),
305
+ code_challenge_method: Type.Optional(Type.Literal("S256")),
312
306
  redirect_uri: Type.String(),
313
307
  response_type: Type.Literal("code"),
314
308
  scope: Type.Optional(Type.String())
@@ -320,13 +314,14 @@ const token = {
320
314
  type: "post",
321
315
  body: Type.Union([Type.Object({
322
316
  client_id: Type.String(),
323
- client_secret: Type.String(),
317
+ client_secret: Type.Optional(Type.String()),
324
318
  code: Type.String(),
319
+ code_verifier: Type.Optional(Type.String()),
325
320
  grant_type: Type.Literal("authorization_code"),
326
321
  redirect_uri: Type.String()
327
322
  }), Type.Object({
328
323
  client_id: Type.String(),
329
- client_secret: Type.String(),
324
+ client_secret: Type.Optional(Type.String()),
330
325
  grant_type: Type.Literal("refresh_token"),
331
326
  refresh_token: Type.String()
332
327
  })]),
@@ -373,24 +368,9 @@ const update$2 = {
373
368
  url: "/challenge"
374
369
  };
375
370
  var compiler_exports = /* @__PURE__ */ __exportAll({
376
- build: () => build,
377
371
  compile: () => compile$1,
378
372
  download: () => download
379
373
  });
380
- const build = {
381
- type: "post",
382
- body: Type.Object({
383
- entry: Type.Optional(Type.String()),
384
- key: Type.String(),
385
- script: Type.Unknown()
386
- }),
387
- params: Type.Object({ type: Type.Union([Type.Literal("main"), Type.Literal("logic")]) }),
388
- response: { 200: Type.Object({
389
- code: Type.String(),
390
- message: Type.String()
391
- }) },
392
- url: "/compiler/build/:type"
393
- };
394
374
  const compile$1 = {
395
375
  type: "post",
396
376
  body: Type.Object({ target: Type.Union([
@@ -414,38 +394,26 @@ const download = {
414
394
  response: { 200: Type.Unknown() },
415
395
  url: "/compiler/download/:id/:target"
416
396
  };
417
- var desktop_exports = /* @__PURE__ */ __exportAll({ latest: () => latest });
418
- const latest = {
419
- type: "get",
420
- dev: true,
421
- querystring: Type.Object({
422
- arch: Type.Union([
423
- Type.Literal("x86_64"),
424
- Type.Literal("i686"),
425
- Type.Literal("aarch64"),
426
- Type.Literal("armv7")
427
- ]),
428
- target: Type.Union([
429
- Type.Literal("windows"),
430
- Type.Literal("linux"),
431
- Type.Literal("darwin")
432
- ]),
433
- version: Type.Optional(Type.String())
434
- }),
435
- response: { 200: Type.Object({
436
- notes: Type.String(),
437
- pub_date: Type.String(),
438
- signature: Type.String(),
439
- url: Type.String(),
440
- version: Type.String()
441
- }) },
442
- url: "/desktop/release/latest"
443
- };
444
397
  var deploy_exports = /* @__PURE__ */ __exportAll({
445
- create: () => create$3,
446
- listServers: () => listServers
398
+ addServerMember: () => addServerMember,
399
+ create: () => create$2,
400
+ environments: () => environments,
401
+ events: () => events,
402
+ getVariables: () => getVariables,
403
+ listServerMembers: () => listServerMembers,
404
+ listServers: () => listServers,
405
+ monitoringLink: () => monitoringLink,
406
+ promote: () => promote,
407
+ rebuild: () => rebuild,
408
+ removeServerMember: () => removeServerMember,
409
+ rollback: () => rollback,
410
+ runtime: () => runtime,
411
+ serverBackups: () => serverBackups,
412
+ setAutoUpdate: () => setAutoUpdate,
413
+ setVariables: () => setVariables,
414
+ updateServer: () => updateServer
447
415
  });
448
- const create$3 = {
416
+ const create$2 = {
449
417
  type: "post",
450
418
  body: Type.Object({ serverId: Type.String({ format: "uuid" }) }),
451
419
  params: Type.Object({
@@ -455,17 +423,231 @@ const create$3 = {
455
423
  response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
456
424
  url: "/deploy/:appId/:environment"
457
425
  };
426
+ const environmentKind = Type.Union([Type.Literal("staging"), Type.Literal("production")]);
427
+ const environmentParams = Type.Object({
428
+ appId: Type.String({ format: "uuid" }),
429
+ environment: environmentKind
430
+ });
431
+ const messageResponse = Type.Object({ message: Type.String() });
432
+ const deploymentSummary = Type.Object({
433
+ id: Type.String({ format: "uuid" }),
434
+ baseHash: Type.Union([Type.String(), Type.Null()]),
435
+ createdAt: Type.String(),
436
+ error: Type.Union([Type.String(), Type.Null()]),
437
+ hasImage: Type.Boolean(),
438
+ source: Type.Union([Type.Literal("cloud"), Type.Literal("desktop")]),
439
+ state: Type.Union([
440
+ Type.Literal("building"),
441
+ Type.Literal("checking"),
442
+ Type.Literal("failed"),
443
+ Type.Literal("preparing_database"),
444
+ Type.Literal("ready"),
445
+ Type.Literal("starting"),
446
+ Type.Literal("superseded")
447
+ ]),
448
+ stateEnteredAt: Type.String()
449
+ });
458
450
  const listServers = {
459
451
  type: "get",
460
452
  response: { 200: Type.Array(Type.Object({
461
453
  id: Type.String({ format: "uuid" }),
462
- name: Type.String()
454
+ name: Type.String(),
455
+ ipv6: Type.Union([Type.String(), Type.Null()]),
456
+ maintenanceHour: Type.Integer(),
457
+ ownerMail: Type.Union([Type.String(), Type.Null()]),
458
+ readyAt: Type.Union([Type.String(), Type.Null()]),
459
+ role: Type.Union([Type.Literal("member"), Type.Literal("owner")]),
460
+ status: Type.String(),
461
+ url: Type.Union([Type.String(), Type.Null()])
463
462
  })) },
464
463
  url: "/deploy/servers"
465
464
  };
465
+ const serverParams = Type.Object({ serverId: Type.String({ format: "uuid" }) });
466
+ const serverMember = Type.Object({
467
+ id: Type.String({ format: "uuid" }),
468
+ mail: Type.String()
469
+ });
470
+ const listServerMembers = {
471
+ type: "get",
472
+ params: serverParams,
473
+ response: { 200: Type.Array(serverMember) },
474
+ url: "/deploy/servers/:serverId/members"
475
+ };
476
+ const addServerMember = {
477
+ type: "post",
478
+ body: Type.Object({ mail: Type.String({ format: "email" }) }),
479
+ params: serverParams,
480
+ response: { 200: serverMember },
481
+ url: "/deploy/servers/:serverId/members"
482
+ };
483
+ const removeServerMember = {
484
+ type: "delete",
485
+ params: Type.Object({
486
+ serverId: Type.String({ format: "uuid" }),
487
+ userId: Type.String({ format: "uuid" })
488
+ }),
489
+ response: { 200: messageResponse },
490
+ url: "/deploy/servers/:serverId/members/:userId"
491
+ };
492
+ const monitoringLink = {
493
+ type: "post",
494
+ params: serverParams,
495
+ response: { 200: Type.Object({ url: Type.String() }) },
496
+ url: "/deploy/servers/:serverId/monitoring"
497
+ };
498
+ const environments = {
499
+ type: "get",
500
+ params: Type.Object({ appId: Type.String({ format: "uuid" }) }),
501
+ response: { 200: Type.Object({
502
+ autoUpdate: Type.Boolean(),
503
+ environments: Type.Array(Type.Object({
504
+ active: Type.Union([deploymentSummary, Type.Null()]),
505
+ history: Type.Array(deploymentSummary),
506
+ kind: environmentKind,
507
+ pending: Type.Union([deploymentSummary, Type.Null()]),
508
+ status: Type.String(),
509
+ url: Type.Union([Type.String(), Type.Null()])
510
+ })),
511
+ serverId: Type.Union([Type.String({ format: "uuid" }), Type.Null()])
512
+ }) },
513
+ url: "/deploy/:appId/environments"
514
+ };
515
+ const events = {
516
+ type: "get",
517
+ params: Type.Object({ deploymentId: Type.String({ format: "uuid" }) }),
518
+ response: { 200: Type.Array(Type.Object({
519
+ id: Type.String({ format: "uuid" }),
520
+ createdAt: Type.String(),
521
+ kind: Type.Union([
522
+ Type.Literal("status"),
523
+ Type.Literal("stderr"),
524
+ Type.Literal("stdout")
525
+ ]),
526
+ message: Type.String(),
527
+ state: Type.String()
528
+ })) },
529
+ url: "/deploy/deployment/:deploymentId/events"
530
+ };
531
+ const getVariables = {
532
+ type: "get",
533
+ params: environmentParams,
534
+ response: { 200: Type.Object({ variables: Type.String() }) },
535
+ url: "/deploy/:appId/:environment/variables"
536
+ };
537
+ const setVariables = {
538
+ type: "put",
539
+ body: Type.Object({ variables: Type.String({ maxLength: 65536 }) }),
540
+ params: environmentParams,
541
+ response: { 200: messageResponse },
542
+ url: "/deploy/:appId/:environment/variables"
543
+ };
544
+ const rollback = {
545
+ type: "post",
546
+ params: Type.Object({
547
+ ...environmentParams.properties,
548
+ deploymentId: Type.String({ format: "uuid" })
549
+ }),
550
+ response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
551
+ url: "/deploy/:appId/:environment/rollback/:deploymentId"
552
+ };
553
+ const promote = {
554
+ type: "post",
555
+ params: Type.Object({
556
+ appId: Type.String({ format: "uuid" }),
557
+ stagingDeploymentId: Type.String({ format: "uuid" })
558
+ }),
559
+ response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
560
+ url: "/deploy/:appId/promote/:stagingDeploymentId"
561
+ };
562
+ const setAutoUpdate = {
563
+ type: "put",
564
+ body: Type.Object({ enabled: Type.Boolean() }),
565
+ params: Type.Object({ appId: Type.String({ format: "uuid" }) }),
566
+ response: { 200: messageResponse },
567
+ url: "/deploy/:appId/auto-update"
568
+ };
569
+ const updateServer = {
570
+ type: "put",
571
+ body: Type.Object({ maintenanceHour: Type.Integer({
572
+ maximum: 23,
573
+ minimum: 0
574
+ }) }),
575
+ params: Type.Object({ serverId: Type.String({ format: "uuid" }) }),
576
+ response: { 200: messageResponse },
577
+ url: "/deploy/servers/:serverId"
578
+ };
579
+ const serverBackups = {
580
+ type: "get",
581
+ params: Type.Object({ serverId: Type.String({ format: "uuid" }) }),
582
+ response: { 200: Type.Object({ backups: Type.Array(Type.Object({
583
+ modifiedAt: Type.String(),
584
+ path: Type.String(),
585
+ size: Type.Number()
586
+ })) }) },
587
+ url: "/deploy/servers/:serverId/backups"
588
+ };
589
+ const runtime = {
590
+ type: "get",
591
+ response: { 200: Type.Object({ hash: Type.String() }) },
592
+ url: "/deploy/runtime"
593
+ };
594
+ const rebuild = {
595
+ type: "post",
596
+ params: Type.Object({
597
+ appId: Type.String({ format: "uuid" }),
598
+ environment: Type.Union([Type.Literal("staging"), Type.Literal("production")])
599
+ }),
600
+ response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
601
+ url: "/deploy/rebuild/:appId/:environment"
602
+ };
603
+ var desktop_exports = /* @__PURE__ */ __exportAll({
604
+ latest: () => latest,
605
+ versions: () => versions
606
+ });
607
+ const TypeDesktopTarget = Type.Union([
608
+ Type.Literal("windows"),
609
+ Type.Literal("linux"),
610
+ Type.Literal("darwin")
611
+ ]);
612
+ const latest = {
613
+ type: "get",
614
+ dev: true,
615
+ querystring: Type.Object({
616
+ arch: Type.Union([
617
+ Type.Literal("x86_64"),
618
+ Type.Literal("i686"),
619
+ Type.Literal("aarch64"),
620
+ Type.Literal("armv7")
621
+ ]),
622
+ target: TypeDesktopTarget,
623
+ version: Type.Optional(Type.String())
624
+ }),
625
+ response: {
626
+ 200: Type.Object({
627
+ notes: Type.String(),
628
+ pub_date: Type.String(),
629
+ signature: Type.String(),
630
+ url: Type.String(),
631
+ version: Type.String()
632
+ }),
633
+ 204: Type.Unsafe({})
634
+ },
635
+ url: "/desktop/release/latest"
636
+ };
637
+ const versions = {
638
+ type: "get",
639
+ response: { 200: Type.Array(Type.Object({
640
+ downloads: Type.Array(Type.Object({
641
+ target: TypeDesktopTarget,
642
+ url: Type.String()
643
+ })),
644
+ version: Type.String()
645
+ })) },
646
+ url: "/desktop/release/versions"
647
+ };
466
648
  var file_exports = /* @__PURE__ */ __exportAll({
467
- list: () => list$3,
468
- remove: () => remove$2,
649
+ list: () => list$2,
650
+ remove: () => remove$1,
469
651
  status: () => status,
470
652
  upload: () => upload
471
653
  });
@@ -486,13 +668,13 @@ const upload = {
486
668
  }) },
487
669
  url: "/file/upload"
488
670
  };
489
- const remove$2 = {
671
+ const remove$1 = {
490
672
  type: "post",
491
673
  body: Type.Object({ target: Type.String() }),
492
674
  response: { 200: Type.Object({ message: Type.String() }) },
493
675
  url: "/file/remove"
494
676
  };
495
- const list$3 = {
677
+ const list$2 = {
496
678
  type: "get",
497
679
  querystring: Type.Object({
498
680
  limit: Type.Optional(Type.String()),
@@ -535,44 +717,9 @@ const googleAuth = {
535
717
  response: { 200: Type.Object({ token: Type.Optional(Type.String()) }) },
536
718
  url: "/integrations/google/auth"
537
719
  };
538
- var keyConfig_exports = /* @__PURE__ */ __exportAll({
539
- check: () => check$1,
540
- create: () => create$2,
541
- list: () => list$2,
542
- remove: () => remove$1
543
- });
544
- const create$2 = {
545
- type: "post",
546
- body: Type.Object({ domain: Type.String() }),
547
- response: { 200: Type.Object({
548
- key: types.keyConfig,
549
- message: Type.String()
550
- }) },
551
- url: "/key-config"
552
- };
553
- const list$2 = {
554
- type: "get",
555
- response: { 200: Type.Array(types.keyConfig) },
556
- url: "/key-config"
557
- };
558
- const remove$1 = {
559
- type: "delete",
560
- params: Type.Object({ id: Type.String() }),
561
- response: { 200: Type.Object({ message: Type.String() }) },
562
- url: "/key-config/:id"
563
- };
564
- const check$1 = {
565
- type: "post",
566
- body: Type.Object({
567
- domain: Type.String(),
568
- key: Type.String()
569
- }),
570
- dev: true,
571
- response: { 200: Type.Object({ message: Type.String() }) },
572
- url: "/key-config/check"
573
- };
574
720
  var license_exports = /* @__PURE__ */ __exportAll({
575
721
  check: () => check,
722
+ connect: () => connect,
576
723
  link: () => link,
577
724
  list: () => list$1,
578
725
  reset: () => reset
@@ -589,6 +736,7 @@ const link = {
589
736
  body: Type.Object({
590
737
  name: Type.String(),
591
738
  fingerprint: TypeMachineFingerprint,
739
+ installId: Type.Optional(Type.String({ maxLength: 64 })),
592
740
  key: Type.String()
593
741
  }),
594
742
  dev: true,
@@ -599,11 +747,13 @@ const check = {
599
747
  type: "post",
600
748
  body: Type.Object({
601
749
  fingerprint: TypeMachineFingerprint,
750
+ installId: Type.Optional(Type.String({ maxLength: 64 })),
602
751
  key: Type.String()
603
752
  }),
604
753
  dev: true,
605
754
  response: { 200: Type.Object({
606
755
  mail: Type.Optional(Type.String()),
756
+ updatesUntil: Type.Optional(Type.String()),
607
757
  valid: Type.Boolean(),
608
758
  version: Type.Optional(Type.String())
609
759
  }) },
@@ -614,13 +764,29 @@ const list$1 = {
614
764
  response: { 200: Type.Array(Type.Object({
615
765
  id: Type.String(),
616
766
  name: Type.String(),
617
- expirationDate: TypeDate,
767
+ expirationDate: Type.Union([TypeDate, Type.Null()]),
618
768
  key: Type.String(),
619
769
  lastUsed: TypeDate,
620
770
  version: Type.String()
621
771
  })) },
622
772
  url: "/license/list"
623
773
  };
774
+ const connect = {
775
+ type: "post",
776
+ body: Type.Object({
777
+ name: Type.String(),
778
+ fingerprint: TypeMachineFingerprint,
779
+ installId: Type.Optional(Type.String({ maxLength: 64 }))
780
+ }),
781
+ dev: true,
782
+ headers: Type.Object({ authorization: Type.String() }),
783
+ response: { 200: Type.Object({
784
+ inUse: Type.Boolean(),
785
+ key: Type.Optional(Type.String()),
786
+ mail: Type.String()
787
+ }) },
788
+ url: "/license/connect"
789
+ };
624
790
  var magiclink_exports = /* @__PURE__ */ __exportAll({
625
791
  activate: () => activate,
626
792
  create: () => create$1,
@@ -659,7 +825,7 @@ var payment_exports = /* @__PURE__ */ __exportAll({
659
825
  });
660
826
  const checkout = {
661
827
  type: "post",
662
- body: Type.Object({ plan: Type.Union([Type.Literal("pro"), Type.Literal("org")]) }),
828
+ body: Type.Object({ offer: Type.Enum(EPaymentOffer) }),
663
829
  response: { 200: Type.Object({
664
830
  message: Type.String(),
665
831
  redirection: Type.String()
@@ -678,7 +844,6 @@ var project_exports = /* @__PURE__ */ __exportAll({
678
844
  create: () => create,
679
845
  edit: () => edit,
680
846
  list: () => list,
681
- proxy: () => proxy,
682
847
  remove: () => remove,
683
848
  star: () => star
684
849
  });
@@ -688,8 +853,7 @@ const create = {
688
853
  icon: Type.String(),
689
854
  template: Type.Union([
690
855
  Type.Literal("default"),
691
- Type.Literal("ferris-wheel"),
692
- Type.Literal("frontend"),
856
+ Type.Literal("landing"),
693
857
  Type.Literal("nuxt"),
694
858
  Type.Literal("testing")
695
859
  ]),
@@ -739,22 +903,6 @@ const star = {
739
903
  response: { 200: Type.Object({ message: Type.String() }) },
740
904
  url: "/project/star"
741
905
  };
742
- const proxy = {
743
- type: "post",
744
- body: Type.Object({
745
- body: Type.Optional(Type.Unknown()),
746
- headers: Type.Optional(Type.Record(Type.String(), Type.String())),
747
- method: Type.Optional(Type.Union([
748
- Type.Literal("GET"),
749
- Type.Literal("POST"),
750
- Type.Literal("PUT"),
751
- Type.Literal("DELETE")
752
- ])),
753
- url: Type.String({ format: "uri" })
754
- }),
755
- response: { 200: Type.Unknown() },
756
- url: "/project/proxy"
757
- };
758
906
  var script_exports = /* @__PURE__ */ __exportAll({
759
907
  compile: () => compile,
760
908
  get: () => get$1,
@@ -792,7 +940,11 @@ var turnstile_exports = /* @__PURE__ */ __exportAll({ tick: () => tick });
792
940
  const tick = {
793
941
  type: "post",
794
942
  body: Type.Object({
795
- data: Type.Optional(Type.Unknown()),
943
+ data: Type.Optional(Type.Intersect([Type.Object({ desktop: Type.Optional(Type.Object({
944
+ id: Type.String({ minLength: 1 }),
945
+ os: Type.Optional(Type.Unknown()),
946
+ version: Type.Optional(Type.String())
947
+ }, { additionalProperties: true })) }, { additionalProperties: true }), Type.Record(Type.String(), Type.Unknown())])),
796
948
  scope: Type.String()
797
949
  }),
798
950
  response: { 200: Type.Object({}) },
@@ -802,9 +954,12 @@ var user_exports = /* @__PURE__ */ __exportAll({
802
954
  acceptTerms: () => acceptTerms,
803
955
  confirmAccountDeletion: () => confirmAccountDeletion,
804
956
  disconnect: () => disconnect,
957
+ disconnectEverywhere: () => disconnectEverywhere,
805
958
  get: () => get,
959
+ listSessions: () => listSessions,
806
960
  ping: () => ping,
807
961
  requestAccountDeletion: () => requestAccountDeletion,
962
+ revokeSession: () => revokeSession,
808
963
  unsubscribe: () => unsubscribe,
809
964
  update: () => update,
810
965
  waitlist: () => waitlist
@@ -846,10 +1001,26 @@ const confirmAccountDeletion = {
846
1001
  url: "/user/account-deletion/:token"
847
1002
  };
848
1003
  const disconnect = {
849
- type: "get",
1004
+ type: "post",
850
1005
  response: { 200: Type.Object({ message: Type.String() }) },
851
1006
  url: "/user/disconnect"
852
1007
  };
1008
+ const listSessions = {
1009
+ type: "get",
1010
+ response: { 200: Type.Array(types.session) },
1011
+ url: "/user/sessions"
1012
+ };
1013
+ const revokeSession = {
1014
+ type: "delete",
1015
+ params: Type.Object({ id: Type.String({ format: "uuid" }) }),
1016
+ response: { 200: Type.Object({ message: Type.String() }) },
1017
+ url: "/user/sessions/:id"
1018
+ };
1019
+ const disconnectEverywhere = {
1020
+ type: "post",
1021
+ response: { 200: Type.Object({ message: Type.String() }) },
1022
+ url: "/user/disconnect-everywhere"
1023
+ };
853
1024
  const waitlist = {
854
1025
  type: "post",
855
1026
  body: Type.Object({ mail: Type.String({ format: "email" }) }),
@@ -868,11 +1039,10 @@ const routes = {
868
1039
  auth: auth_exports,
869
1040
  challenge: challenge_exports,
870
1041
  compiler: compiler_exports,
871
- desktop: desktop_exports,
872
1042
  deploy: deploy_exports,
1043
+ desktop: desktop_exports,
873
1044
  file: file_exports,
874
1045
  integrations: integrations_exports,
875
- keyConfig: keyConfig_exports,
876
1046
  license: license_exports,
877
1047
  magiclink: magiclink_exports,
878
1048
  payment: payment_exports,
@@ -882,24 +1052,19 @@ const routes = {
882
1052
  user: user_exports
883
1053
  };
884
1054
  const api = {};
885
- for (const serviceName of Object.keys(routes)) {
1055
+ for (const [serviceName, serviceRoutes] of Object.entries(routes)) {
886
1056
  api[serviceName] = {};
887
- for (const routeName of Object.keys(routes[serviceName])) {
888
- const route = routes[serviceName][routeName];
889
- api[serviceName][routeName] = async (args = {}) => {
890
- const url = new URL(api_default.getBaseUrl({ dev: route.dev }) + route.url);
891
- if (route.params && args.params) for (const key of Object.keys(route.params.properties)) url.href = url.href.replace(`:${key}`, args.params[key]);
892
- if (args.querystring) {
893
- for (const key of Object.keys(args.querystring)) if (args.querystring[key]) url.searchParams.append(key, args.querystring[key].toString());
894
- }
895
- let service = api_default[route.type];
896
- if (route.multipart) service = api_default.multipart;
897
- const result = await service(url.href, args.body);
898
- const content = await getContent(result);
899
- if (result.status >= 400) throw new Error(`Error ${result.status} (${result.statusText}): ${content.message || content}`);
900
- return content;
901
- };
902
- }
1057
+ for (const [routeName, route] of Object.entries(serviceRoutes)) api[serviceName][routeName] = async (args = {}) => {
1058
+ const url = new URL(api_default.getBaseUrl({ dev: Boolean(route.dev) }) + route.url);
1059
+ if (route.params && args.params) for (const key of Object.keys(route.params.properties)) url.href = url.href.replace(`:${key}`, args.params[key]);
1060
+ if (args.querystring) {
1061
+ for (const key of Object.keys(args.querystring)) if (args.querystring[key]) url.searchParams.append(key, args.querystring[key].toString());
1062
+ }
1063
+ const result = await (route.multipart ? api_default.multipart : api_default[route.type])(url.href, args.body);
1064
+ const content = await getContent(result);
1065
+ if (result.status >= 400) throw new Error(`Error ${result.status} (${result.statusText}): ${content.message || content}`);
1066
+ return content;
1067
+ };
903
1068
  }
904
1069
  function getContent(response) {
905
1070
  if (response.headers.get("Content-Type")?.startsWith("application/json")) return response.json();
@@ -907,6 +1072,7 @@ function getContent(response) {
907
1072
  }
908
1073
  function isSchemaType(schema, ...types) {
909
1074
  if (schema?.type === EVarType.union) return schema.elements.length > 0 && schema.elements.every((element) => isSchemaType(element, ...types));
1075
+ if (schema?.type === EVarType.intersection) return isSchemaType(mergeIntersection(schema), ...types);
910
1076
  return Boolean(schema && types.includes(schema.type));
911
1077
  }
912
1078
  function strip(schema) {
@@ -945,8 +1111,963 @@ const primitives = [
945
1111
  ];
946
1112
  const ordered = [EVarType.number, EVarType.string];
947
1113
  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();
948
- //#endregion
949
- //#region src/index.ts
1114
+ // src/types/hooks.ts
1115
+ let EPluginHooks = /* @__PURE__ */ function(EPluginHooks) {
1116
+ EPluginHooks["BackendMiddleware"] = "backend/middleware";
1117
+ EPluginHooks["BackendInputNode"] = "backend/input-node";
1118
+ EPluginHooks["DatabaseScope"] = "database/scope";
1119
+ EPluginHooks["DatabaseChange"] = "database/change";
1120
+ return EPluginHooks;
1121
+ }({});
1122
+ // src/types/plugin.ts
1123
+ let EInjectionKey = /* @__PURE__ */ function(EInjectionKey) {
1124
+ EInjectionKey["ViteImport"] = "viteImport";
1125
+ EInjectionKey["VitePlugin"] = "vitePlugin";
1126
+ EInjectionKey["AppImport"] = "appImport";
1127
+ EInjectionKey["AppBody"] = "appBody";
1128
+ EInjectionKey["AppSetup"] = "appSetup";
1129
+ EInjectionKey["Style"] = "style";
1130
+ EInjectionKey["ServerImport"] = "serverImport";
1131
+ EInjectionKey["ServerBody"] = "serverBody";
1132
+ return EInjectionKey;
1133
+ }({});
1134
+ /*!
1135
+ * Font Awesome Pro 6.7.2 by @fontawesome - https://fontawesome.com
1136
+ * License - https://fontawesome.com/license (Commercial License)
1137
+ * Copyright 2024 Fonticons, Inc.
1138
+ */
1139
+ /*!
1140
+ * Font Awesome Pro 6.7.2 by @fontawesome - https://fontawesome.com
1141
+ * License - https://fontawesome.com/license (Commercial License)
1142
+ * Copyright 2024 Fonticons, Inc.
1143
+ */
1144
+ LogicType.string(), LogicType.string({
1145
+ default: "_blank",
1146
+ enum: [
1147
+ "_blank",
1148
+ "_self",
1149
+ "_parent",
1150
+ "_top"
1151
+ ]
1152
+ }), LogicType.string({
1153
+ name: "Type",
1154
+ description: "The input type",
1155
+ enum: [
1156
+ "text",
1157
+ "password",
1158
+ "email",
1159
+ "number",
1160
+ "date",
1161
+ "checkbox",
1162
+ "radio"
1163
+ ]
1164
+ }), LogicType.string({
1165
+ name: "Placeholder",
1166
+ description: "The input placeholder"
1167
+ }), LogicType.string({
1168
+ name: "Value",
1169
+ description: "The input value"
1170
+ }), LogicType.string({
1171
+ name: "Type",
1172
+ description: "The media type"
1173
+ }), LogicType.string({
1174
+ name: "Alt",
1175
+ description: "The alt text"
1176
+ }), LogicType.string({
1177
+ name: "Source",
1178
+ description: "The source"
1179
+ });
1180
+ const baseEvent = LogicType.object({
1181
+ preventDefault: LogicType.function(LogicType.object({}), LogicType.void(), { description: "Prevent the default action of the event" }),
1182
+ target: LogicType.interface("HTMLElement")
1183
+ });
1184
+ LogicType.object({
1185
+ ...baseEvent.properties,
1186
+ data: LogicType.string({
1187
+ description: "Value of the character inserted",
1188
+ example: "a"
1189
+ }),
1190
+ inputType: LogicType.string({
1191
+ description: "Type of change",
1192
+ example: "insertText"
1193
+ })
1194
+ }, { name: "Input Event" }), LogicType.object({
1195
+ ...baseEvent.properties,
1196
+ altKey: LogicType.boolean({
1197
+ description: "Alt key was pressed",
1198
+ example: false
1199
+ }),
1200
+ charCode: LogicType.number({
1201
+ description: "Unicode value of a character key pressed",
1202
+ example: 97
1203
+ }),
1204
+ code: LogicType.string({
1205
+ description: "Physical key code",
1206
+ example: "KeyA"
1207
+ }),
1208
+ ctrlKey: LogicType.boolean({
1209
+ description: "Ctrl key was pressed",
1210
+ example: false
1211
+ }),
1212
+ key: LogicType.string({
1213
+ description: "Value of a key or keys pressed by the user",
1214
+ example: "a"
1215
+ }),
1216
+ keyCode: LogicType.number({
1217
+ description: "Unicode value of a non-character key",
1218
+ example: 65
1219
+ }),
1220
+ metaKey: LogicType.boolean({
1221
+ description: "Meta key was pressed",
1222
+ example: false
1223
+ }),
1224
+ repeat: LogicType.boolean({
1225
+ description: "Key is being held down and repeating",
1226
+ example: false
1227
+ }),
1228
+ shiftKey: LogicType.boolean({
1229
+ description: "Shift key was pressed",
1230
+ example: false
1231
+ })
1232
+ }, { name: "Keyboard Event" }), LogicType.object({
1233
+ ...baseEvent.properties,
1234
+ altKey: LogicType.boolean({
1235
+ description: "Alt key was pressed",
1236
+ example: false
1237
+ }),
1238
+ button: LogicType.number({
1239
+ description: "Button pressed on the mouse",
1240
+ example: 0
1241
+ }),
1242
+ clientX: LogicType.number({
1243
+ description: "Horizontal coordinate within the application's viewport",
1244
+ example: 150
1245
+ }),
1246
+ clientY: LogicType.number({
1247
+ description: "Vertical coordinate within the application's viewport",
1248
+ example: 200
1249
+ }),
1250
+ ctrlKey: LogicType.boolean({
1251
+ description: "Ctrl key was pressed",
1252
+ example: false
1253
+ }),
1254
+ metaKey: LogicType.boolean({
1255
+ description: "Meta key was pressed",
1256
+ example: false
1257
+ }),
1258
+ movementX: LogicType.number({
1259
+ description: "Horizontal distance the mouse moved since the last event",
1260
+ example: 5
1261
+ }),
1262
+ movementY: LogicType.number({
1263
+ description: "Vertical distance the mouse moved since the last event",
1264
+ example: 10
1265
+ }),
1266
+ offsetX: LogicType.number({
1267
+ description: "Horizontal coordinate within the element",
1268
+ example: 30
1269
+ }),
1270
+ offsetY: LogicType.number({
1271
+ description: "Vertical coordinate within the element",
1272
+ example: 50
1273
+ }),
1274
+ pageX: LogicType.number({
1275
+ description: "Horizontal coordinate within the whole document",
1276
+ example: 150
1277
+ }),
1278
+ pageY: LogicType.number({
1279
+ description: "Vertical coordinate within the whole document",
1280
+ example: 200
1281
+ }),
1282
+ screenX: LogicType.number({
1283
+ description: "Horizontal coordinate within the screen's viewport",
1284
+ example: 170
1285
+ }),
1286
+ screenY: LogicType.number({
1287
+ description: "Vertical coordinate within the screen's viewport",
1288
+ example: 220
1289
+ }),
1290
+ shiftKey: LogicType.boolean({
1291
+ description: "Shift key was pressed",
1292
+ example: false
1293
+ })
1294
+ }, { name: "Mouse Event" }), LogicType.object({
1295
+ ...baseEvent.properties,
1296
+ submitter: LogicType.interface("HTMLElement", { description: "Button that submitted the form" })
1297
+ }, { name: "Submit Event" }), LogicType.object({
1298
+ ...baseEvent.properties,
1299
+ deltaMode: LogicType.number({
1300
+ description: "Unit of the delta values scroll amount",
1301
+ example: 0
1302
+ }),
1303
+ deltaX: LogicType.number({
1304
+ description: "Horizontal scroll amount",
1305
+ example: 0
1306
+ }),
1307
+ deltaY: LogicType.number({
1308
+ description: "Vertical scroll amount",
1309
+ example: 3
1310
+ }),
1311
+ deltaZ: LogicType.number({
1312
+ description: "Z-axis scroll amount",
1313
+ example: 0
1314
+ })
1315
+ }, { name: "Wheel Event" });
1316
+ let ETokenType = /* @__PURE__ */ function(ETokenType) {
1317
+ ETokenType["Class"] = "class";
1318
+ ETokenType["Color"] = "color";
1319
+ ETokenType["FontSize"] = "font-size";
1320
+ ETokenType["FontWeight"] = "font-weight";
1321
+ ETokenType["FontFamily"] = "font-family";
1322
+ ETokenType["Length"] = "length";
1323
+ ETokenType["Time"] = "time";
1324
+ return ETokenType;
1325
+ }({});
1326
+ function buildGridSpan(value) {
1327
+ return /^\s*\d+\s*$/.test(String(value)) ? `span ${value}` : value;
1328
+ }
1329
+ LogicType.object({
1330
+ background: LogicType.object({
1331
+ attachment: LogicType.string({
1332
+ name: "background-attachment",
1333
+ enum: ["scroll", "fixed"]
1334
+ }),
1335
+ clip: LogicType.string({
1336
+ name: "background-clip",
1337
+ enum: [
1338
+ "border-box",
1339
+ "padding-box",
1340
+ "content-box",
1341
+ "text"
1342
+ ]
1343
+ }),
1344
+ color: LogicType.string({
1345
+ name: "background-color",
1346
+ default: "#ffffff",
1347
+ format: "color",
1348
+ options: { token: "color" }
1349
+ }),
1350
+ image: LogicType.string({
1351
+ name: "background-image",
1352
+ default: "linear-gradient(90deg, #000000 0%, #ffffff 100%)",
1353
+ options: { image: true }
1354
+ }),
1355
+ origin: LogicType.string({
1356
+ name: "background-origin",
1357
+ enum: [
1358
+ "border-box",
1359
+ "padding-box",
1360
+ "content-box"
1361
+ ]
1362
+ }),
1363
+ position: LogicType.string({
1364
+ name: "background-position",
1365
+ enum: [
1366
+ "top left",
1367
+ "top center",
1368
+ "top right",
1369
+ "center left",
1370
+ "center center",
1371
+ "center right",
1372
+ "bottom left",
1373
+ "bottom center",
1374
+ "bottom right"
1375
+ ],
1376
+ options: { displayGrid: 3 }
1377
+ }),
1378
+ repeat: LogicType.string({
1379
+ name: "background-repeat",
1380
+ enum: [
1381
+ "repeat",
1382
+ "repeat-x",
1383
+ "repeat-y",
1384
+ "no-repeat"
1385
+ ]
1386
+ }),
1387
+ size: LogicType.string({
1388
+ name: "background-size",
1389
+ enum: [
1390
+ "auto",
1391
+ "cover",
1392
+ "contain"
1393
+ ]
1394
+ })
1395
+ }),
1396
+ border: LogicType.object({
1397
+ color: LogicType.string({
1398
+ name: "border-color",
1399
+ format: "color",
1400
+ options: { token: "color" }
1401
+ }),
1402
+ radius: LogicType.string({
1403
+ name: "border-radius",
1404
+ options: {
1405
+ clamp: true,
1406
+ min: 0,
1407
+ mode: "corner",
1408
+ quad: true,
1409
+ token: "length",
1410
+ units: ["px", "%"]
1411
+ }
1412
+ }),
1413
+ style: LogicType.string({
1414
+ name: "border-style",
1415
+ enum: [
1416
+ "none",
1417
+ "solid",
1418
+ "dashed",
1419
+ "dotted"
1420
+ ]
1421
+ }),
1422
+ width: LogicType.string({
1423
+ name: "border-width",
1424
+ options: {
1425
+ clamp: true,
1426
+ min: 0,
1427
+ quad: true,
1428
+ token: "length",
1429
+ units: ["px"]
1430
+ }
1431
+ }),
1432
+ shadow: LogicType.string({
1433
+ name: "box-shadow",
1434
+ default: "0 0 4px #000000",
1435
+ options: {
1436
+ custom: true,
1437
+ shadow: true
1438
+ }
1439
+ })
1440
+ }),
1441
+ display: LogicType.object({
1442
+ display: LogicType.string({
1443
+ name: "display",
1444
+ enum: [
1445
+ "block",
1446
+ "inline",
1447
+ "inline-block",
1448
+ "flex",
1449
+ "grid",
1450
+ "none"
1451
+ ]
1452
+ }),
1453
+ gap: LogicType.string({
1454
+ name: "gap",
1455
+ options: {
1456
+ flex: true,
1457
+ grid: true,
1458
+ token: "length",
1459
+ units: ["px", "%"]
1460
+ }
1461
+ }),
1462
+ direction: LogicType.string({
1463
+ name: "flex-direction",
1464
+ enum: [
1465
+ "row",
1466
+ "row-reverse",
1467
+ "column",
1468
+ "column-reverse"
1469
+ ],
1470
+ options: { flex: true }
1471
+ }),
1472
+ alignContent: LogicType.string({
1473
+ name: "align-content",
1474
+ enum: [
1475
+ "flex-start",
1476
+ "flex-end",
1477
+ "center",
1478
+ "space-between",
1479
+ "stretch"
1480
+ ],
1481
+ options: { flex: true }
1482
+ }),
1483
+ alignItems: LogicType.string({
1484
+ name: "align-items",
1485
+ enum: [
1486
+ "flex-start",
1487
+ "flex-end",
1488
+ "center",
1489
+ "stretch"
1490
+ ],
1491
+ options: { flex: true }
1492
+ }),
1493
+ justifyContent: LogicType.string({
1494
+ name: "justify-content",
1495
+ enum: [
1496
+ "flex-start",
1497
+ "flex-end",
1498
+ "center",
1499
+ "space-between",
1500
+ "space-around"
1501
+ ],
1502
+ options: { flex: true }
1503
+ }),
1504
+ wrap: LogicType.string({
1505
+ name: "flex-wrap",
1506
+ enum: ["nowrap", "wrap"],
1507
+ options: { flex: true }
1508
+ }),
1509
+ gridColumns: LogicType.string({
1510
+ name: "grid-template-columns",
1511
+ build(input) {
1512
+ const value = input.trim();
1513
+ const fractionMatch = value.match(/^(\d+)fr$/);
1514
+ if (fractionMatch) return `repeat(${fractionMatch[1]}, 1fr)`;
1515
+ const pixelMatch = value.match(/^(\d+(?:\.\d+)?)px$/);
1516
+ if (pixelMatch) return `repeat(auto-fill, minmax(${pixelMatch[1]}px, 1fr))`;
1517
+ return input;
1518
+ },
1519
+ default: "1fr",
1520
+ options: {
1521
+ custom: true,
1522
+ grid: true,
1523
+ units: ["fr", "px"]
1524
+ },
1525
+ parse(value) {
1526
+ const fractionMatch = value.match(/^repeat\((\d+),\s*1fr\)$/);
1527
+ if (fractionMatch) return `${fractionMatch[1]}fr`;
1528
+ const pixelMatch = value.match(/^repeat\(auto-fill,\s*minmax\((\d+(?:\.\d+)?)px,\s*1fr\)\)$/);
1529
+ if (pixelMatch) return `${pixelMatch[1]}px`;
1530
+ return value;
1531
+ }
1532
+ }),
1533
+ gridRows: LogicType.string({
1534
+ name: "grid-auto-rows",
1535
+ default: "1fr",
1536
+ options: {
1537
+ grid: true,
1538
+ units: ["fr", "px"]
1539
+ }
1540
+ }),
1541
+ placeItems: LogicType.string({
1542
+ name: "place-items",
1543
+ enum: [
1544
+ "start",
1545
+ "end",
1546
+ "center",
1547
+ "stretch"
1548
+ ],
1549
+ options: { grid: true }
1550
+ }),
1551
+ zIndex: LogicType.number({
1552
+ name: "z-index",
1553
+ options: {
1554
+ clamp: true,
1555
+ default: 0,
1556
+ fixed: 0,
1557
+ max: 100,
1558
+ min: -100
1559
+ }
1560
+ }),
1561
+ opacity: LogicType.string({
1562
+ name: "opacity",
1563
+ default: "100%",
1564
+ options: {
1565
+ fixed: 2,
1566
+ max: 100,
1567
+ min: 0,
1568
+ units: ["%"]
1569
+ }
1570
+ }),
1571
+ overflow: LogicType.string({
1572
+ name: "overflow",
1573
+ enum: [
1574
+ "visible",
1575
+ "hidden",
1576
+ "scroll",
1577
+ "auto"
1578
+ ]
1579
+ }),
1580
+ position: LogicType.string({
1581
+ name: "position",
1582
+ enum: [
1583
+ "static",
1584
+ "relative",
1585
+ "absolute",
1586
+ "fixed",
1587
+ "sticky"
1588
+ ]
1589
+ })
1590
+ }),
1591
+ effects: LogicType.object({
1592
+ backdropFilter: LogicType.string({
1593
+ name: "backdrop-filter",
1594
+ options: { filter: true }
1595
+ }),
1596
+ filter: LogicType.string({
1597
+ name: "filter",
1598
+ options: { filter: true }
1599
+ }),
1600
+ mixBlendMode: LogicType.string({
1601
+ name: "mix-blend-mode",
1602
+ enum: [
1603
+ "normal",
1604
+ "multiply",
1605
+ "screen",
1606
+ "overlay",
1607
+ "darken",
1608
+ "lighten",
1609
+ "color-dodge",
1610
+ "color-burn",
1611
+ "hard-light",
1612
+ "soft-light",
1613
+ "difference",
1614
+ "exclusion",
1615
+ "hue",
1616
+ "saturation",
1617
+ "color",
1618
+ "luminosity"
1619
+ ]
1620
+ })
1621
+ }),
1622
+ font: LogicType.object({
1623
+ color: LogicType.string({
1624
+ name: "color",
1625
+ format: "color",
1626
+ options: { token: "color" }
1627
+ }),
1628
+ family: LogicType.string({
1629
+ name: "font-family",
1630
+ default: "sans-serif",
1631
+ options: { token: "font-family" }
1632
+ }),
1633
+ letterSpacing: LogicType.string({
1634
+ name: "letter-spacing",
1635
+ options: {
1636
+ token: "length",
1637
+ units: ["px", "%"]
1638
+ }
1639
+ }),
1640
+ lineHeight: LogicType.string({
1641
+ name: "line-height",
1642
+ default: "20px",
1643
+ options: {
1644
+ token: "font-size",
1645
+ units: ["px", "%"]
1646
+ }
1647
+ }),
1648
+ size: LogicType.string({
1649
+ name: "font-size",
1650
+ default: "16px",
1651
+ options: {
1652
+ min: 0,
1653
+ token: "font-size",
1654
+ units: [
1655
+ "px",
1656
+ "%",
1657
+ "rem"
1658
+ ]
1659
+ }
1660
+ }),
1661
+ style: LogicType.string({
1662
+ name: "font-style",
1663
+ enum: [
1664
+ "normal",
1665
+ "italic",
1666
+ "oblique"
1667
+ ]
1668
+ }),
1669
+ variant: LogicType.string({
1670
+ name: "font-variant-caps",
1671
+ enum: [
1672
+ "normal",
1673
+ "small-caps",
1674
+ "all-small-caps"
1675
+ ]
1676
+ }),
1677
+ weight: LogicType.string({
1678
+ name: "font-weight",
1679
+ enum: [
1680
+ "normal",
1681
+ "bold",
1682
+ "lighter",
1683
+ "bolder"
1684
+ ],
1685
+ options: {
1686
+ custom: true,
1687
+ token: "font-weight"
1688
+ }
1689
+ })
1690
+ }),
1691
+ inset: LogicType.object({
1692
+ inset: LogicType.string({
1693
+ name: "inset",
1694
+ options: {
1695
+ quad: true,
1696
+ units: ["px", "%"]
1697
+ }
1698
+ }),
1699
+ bottom: LogicType.string({
1700
+ name: "bottom",
1701
+ options: { units: ["px", "%"] }
1702
+ }),
1703
+ left: LogicType.string({
1704
+ name: "left",
1705
+ options: { units: ["px", "%"] }
1706
+ }),
1707
+ right: LogicType.string({
1708
+ name: "right",
1709
+ options: { units: ["px", "%"] }
1710
+ }),
1711
+ top: LogicType.string({
1712
+ name: "top",
1713
+ options: { units: ["px", "%"] }
1714
+ })
1715
+ }),
1716
+ pointer: LogicType.object({
1717
+ cursor: LogicType.string({
1718
+ name: "cursor",
1719
+ enum: [
1720
+ "auto",
1721
+ "default",
1722
+ "none",
1723
+ "context-menu",
1724
+ "help",
1725
+ "pointer",
1726
+ "progress",
1727
+ "wait",
1728
+ "cell",
1729
+ "crosshair",
1730
+ "text",
1731
+ "vertical-text",
1732
+ "alias",
1733
+ "copy",
1734
+ "move",
1735
+ "no-drop",
1736
+ "not-allowed",
1737
+ "grab",
1738
+ "grabbing",
1739
+ "all-scroll",
1740
+ "col-resize",
1741
+ "row-resize",
1742
+ "n-resize",
1743
+ "e-resize",
1744
+ "s-resize",
1745
+ "w-resize",
1746
+ "ne-resize",
1747
+ "nw-resize",
1748
+ "se-resize",
1749
+ "sw-resize",
1750
+ "ew-resize",
1751
+ "ns-resize",
1752
+ "nesw-resize",
1753
+ "nwse-resize",
1754
+ "zoom-in",
1755
+ "zoom-out"
1756
+ ]
1757
+ }),
1758
+ events: LogicType.string({
1759
+ name: "pointer-events",
1760
+ enum: ["auto", "none"]
1761
+ }),
1762
+ userSelect: LogicType.string({
1763
+ name: "user-select",
1764
+ enum: [
1765
+ "auto",
1766
+ "none",
1767
+ "text",
1768
+ "all"
1769
+ ]
1770
+ })
1771
+ }),
1772
+ size: LogicType.object({
1773
+ aspectRatio: LogicType.number({
1774
+ name: "aspect-ratio",
1775
+ default: 1,
1776
+ options: {
1777
+ clamp: true,
1778
+ min: 0
1779
+ }
1780
+ }),
1781
+ boxSizing: LogicType.string({
1782
+ name: "box-sizing",
1783
+ enum: ["content-box", "border-box"]
1784
+ }),
1785
+ flex: LogicType.string({
1786
+ name: "flex",
1787
+ enum: {
1788
+ "auto": "auto",
1789
+ "initial": "initial",
1790
+ "1 1 0": "elastic",
1791
+ "none": "fixed"
1792
+ },
1793
+ options: { custom: true }
1794
+ }),
1795
+ gridColumns: LogicType.number({
1796
+ name: "grid-column",
1797
+ build: buildGridSpan,
1798
+ default: 1,
1799
+ options: {
1800
+ clamp: true,
1801
+ min: 1,
1802
+ number: true
1803
+ },
1804
+ parse: (value) => parseInt(value.split(" ")[1])
1805
+ }),
1806
+ gridRows: LogicType.number({
1807
+ name: "grid-row",
1808
+ build: buildGridSpan,
1809
+ default: 1,
1810
+ options: {
1811
+ clamp: true,
1812
+ min: 1,
1813
+ number: true
1814
+ },
1815
+ parse: (value) => parseInt(value.split(" ")[1])
1816
+ }),
1817
+ height: LogicType.string({
1818
+ name: "height",
1819
+ default: "100%",
1820
+ options: {
1821
+ clamp: true,
1822
+ custom: true,
1823
+ min: 0,
1824
+ token: "length",
1825
+ units: [
1826
+ "px",
1827
+ "%",
1828
+ "vh"
1829
+ ]
1830
+ }
1831
+ }),
1832
+ maxHeight: LogicType.string({
1833
+ name: "max-height",
1834
+ default: "100%",
1835
+ options: {
1836
+ clamp: true,
1837
+ custom: true,
1838
+ min: 0,
1839
+ token: "length",
1840
+ units: [
1841
+ "px",
1842
+ "%",
1843
+ "vh"
1844
+ ]
1845
+ }
1846
+ }),
1847
+ maxWidth: LogicType.string({
1848
+ name: "max-width",
1849
+ default: "100%",
1850
+ options: {
1851
+ clamp: true,
1852
+ custom: true,
1853
+ min: 0,
1854
+ token: "length",
1855
+ units: [
1856
+ "px",
1857
+ "%",
1858
+ "vw"
1859
+ ]
1860
+ }
1861
+ }),
1862
+ minHeight: LogicType.string({
1863
+ name: "min-height",
1864
+ default: "100%",
1865
+ options: {
1866
+ clamp: true,
1867
+ custom: true,
1868
+ min: 0,
1869
+ token: "length",
1870
+ units: [
1871
+ "px",
1872
+ "%",
1873
+ "vh"
1874
+ ]
1875
+ }
1876
+ }),
1877
+ minWidth: LogicType.string({
1878
+ name: "min-width",
1879
+ default: "100%",
1880
+ options: {
1881
+ clamp: true,
1882
+ custom: true,
1883
+ min: 0,
1884
+ token: "length",
1885
+ units: [
1886
+ "px",
1887
+ "%",
1888
+ "vw"
1889
+ ]
1890
+ }
1891
+ }),
1892
+ objectFit: LogicType.string({
1893
+ name: "object-fit",
1894
+ enum: [
1895
+ "fill",
1896
+ "contain",
1897
+ "cover",
1898
+ "none",
1899
+ "scale-down"
1900
+ ]
1901
+ }),
1902
+ width: LogicType.string({
1903
+ name: "width",
1904
+ default: "100%",
1905
+ options: {
1906
+ clamp: true,
1907
+ custom: true,
1908
+ min: 0,
1909
+ token: "length",
1910
+ units: [
1911
+ "px",
1912
+ "%",
1913
+ "vw"
1914
+ ]
1915
+ }
1916
+ })
1917
+ }),
1918
+ spacing: LogicType.object({
1919
+ margin: LogicType.string({
1920
+ name: "margin",
1921
+ options: {
1922
+ custom: true,
1923
+ quad: true,
1924
+ token: "length",
1925
+ units: ["px", "%"]
1926
+ }
1927
+ }),
1928
+ padding: LogicType.string({
1929
+ name: "padding",
1930
+ options: {
1931
+ custom: true,
1932
+ quad: true,
1933
+ token: "length",
1934
+ units: ["px", "%"]
1935
+ }
1936
+ })
1937
+ }),
1938
+ text: LogicType.object({
1939
+ align: LogicType.string({
1940
+ name: "text-align",
1941
+ enum: [
1942
+ "left",
1943
+ "right",
1944
+ "center",
1945
+ "justify"
1946
+ ]
1947
+ }),
1948
+ decoration: LogicType.string({
1949
+ name: "text-decoration",
1950
+ enum: [
1951
+ "none",
1952
+ "underline",
1953
+ "overline",
1954
+ "line-through"
1955
+ ]
1956
+ }),
1957
+ overflow: LogicType.string({
1958
+ name: "text-overflow",
1959
+ enum: ["clip", "ellipsis"]
1960
+ }),
1961
+ shadow: LogicType.string({
1962
+ name: "text-shadow",
1963
+ default: "0 0 4px #000000",
1964
+ options: {
1965
+ custom: true,
1966
+ shadow: true
1967
+ }
1968
+ }),
1969
+ transform: LogicType.string({
1970
+ name: "text-transform",
1971
+ enum: [
1972
+ "none",
1973
+ "capitalize",
1974
+ "uppercase",
1975
+ "lowercase"
1976
+ ]
1977
+ }),
1978
+ wrap: LogicType.string({
1979
+ name: "text-wrap",
1980
+ enum: [
1981
+ "normal",
1982
+ "nowrap",
1983
+ "balance",
1984
+ "pre",
1985
+ "pre-line",
1986
+ "pre-wrap"
1987
+ ]
1988
+ })
1989
+ }),
1990
+ transform: LogicType.object({
1991
+ origin: LogicType.string({
1992
+ name: "transform-origin",
1993
+ enum: [
1994
+ "left top",
1995
+ "left center",
1996
+ "left bottom",
1997
+ "right top",
1998
+ "right center",
1999
+ "right bottom",
2000
+ "center top",
2001
+ "center center",
2002
+ "center bottom"
2003
+ ]
2004
+ }),
2005
+ perspective: LogicType.number({
2006
+ name: "perspective",
2007
+ options: { suffix: "px" }
2008
+ }),
2009
+ rotate: LogicType.number({
2010
+ name: "rotate",
2011
+ options: { suffix: "deg" }
2012
+ }),
2013
+ scale: LogicType.number({
2014
+ name: "scale",
2015
+ default: 100,
2016
+ options: {
2017
+ fixed: 0,
2018
+ max: 200,
2019
+ min: 0,
2020
+ suffix: "%"
2021
+ }
2022
+ }),
2023
+ translate: LogicType.string({
2024
+ name: "translate",
2025
+ options: {
2026
+ dual: true,
2027
+ units: ["px", "%"]
2028
+ }
2029
+ })
2030
+ }),
2031
+ transition: LogicType.object({
2032
+ delay: LogicType.string({
2033
+ name: "transition-delay",
2034
+ options: {
2035
+ token: "time",
2036
+ units: ["s", "ms"]
2037
+ }
2038
+ }),
2039
+ duration: LogicType.string({
2040
+ name: "transition-duration",
2041
+ options: {
2042
+ token: "time",
2043
+ units: ["s", "ms"]
2044
+ }
2045
+ }),
2046
+ property: LogicType.string({
2047
+ name: "transition-property",
2048
+ enum: [
2049
+ "all",
2050
+ "color",
2051
+ "background",
2052
+ "margin",
2053
+ "padding",
2054
+ "none"
2055
+ ],
2056
+ options: { custom: true }
2057
+ }),
2058
+ timingFunction: LogicType.string({
2059
+ name: "transition-timing-function",
2060
+ enum: [
2061
+ "linear",
2062
+ "ease",
2063
+ "ease-in",
2064
+ "ease-out",
2065
+ "ease-in-out"
2066
+ ]
2067
+ })
2068
+ })
2069
+ });
2070
+ // src/index.ts
950
2071
  function makePlugin(plugin) {
951
2072
  return plugin;
952
2073
  }
@@ -955,16 +2076,19 @@ function makeComponent(component) {
955
2076
  }
956
2077
  async function loadPlugin(plugin, env) {
957
2078
  const result = cloneWithFunctions(plugin);
958
- const { config, internals } = env.app?.config?.plugins?.[plugin.id] ?? {};
2079
+ const { config, internals } = getPluginSettings(plugin, env);
959
2080
  for (const category of [
960
2081
  "build",
961
2082
  "editor",
962
2083
  "inject"
963
- ]) if (result[category]) for (const key in result[category]) result[category][key] = await getPluginParam(result[category][key], {
964
- ...env,
965
- config,
966
- internals
967
- });
2084
+ ]) {
2085
+ const options = result[category];
2086
+ if (options) for (const key in options) options[key] = await getPluginParam(options[key], {
2087
+ ...env,
2088
+ config,
2089
+ internals
2090
+ });
2091
+ }
968
2092
  return result;
969
2093
  }
970
2094
  function sortPlugins(plugins) {
@@ -989,13 +2113,27 @@ function sortPlugins(plugins) {
989
2113
  }
990
2114
  async function getPluginApi(plugin, env) {
991
2115
  if (!plugin?.api) return;
992
- const { config, internals } = env.app?.config?.plugins?.[plugin.id] ?? {};
2116
+ const { config, internals } = getPluginSettings(plugin, env);
993
2117
  return await getPluginParam(plugin.api, {
994
2118
  ...env,
995
2119
  config,
996
2120
  internals
997
2121
  });
998
2122
  }
2123
+ function getPluginSettings(plugin, env) {
2124
+ const { config, internals } = env.app?.config?.plugins?.[plugin.id] ?? {};
2125
+ if (!plugin.config) return {
2126
+ config,
2127
+ internals
2128
+ };
2129
+ return {
2130
+ config: {
2131
+ ...getSchemaDefault(plugin.config),
2132
+ ...config
2133
+ },
2134
+ internals
2135
+ };
2136
+ }
999
2137
  async function getPluginParam(target, env) {
1000
2138
  if (typeof target === "function") return target({
1001
2139
  mode: "editor",
@@ -1003,5 +2141,4 @@ async function getPluginParam(target, env) {
1003
2141
  });
1004
2142
  return target;
1005
2143
  }
1006
- //#endregion
1007
- export { EElementType, EInjectionKey, ELogicScope, ELogicType, EPluginHooks, ETokenType, EVarType, LSettingsStoryWrapper_default as LSettingsStoryWrapper, LogicType, LogicUtil, getPluginApi, getPluginParam, loadPlugin, makeComponent, makeLogicNode, makePlugin, sortPlugins };
2144
+ export { EDBCondition, EDBOperation, EElementType, EInjectionKey, ELogicScope, ELogicType, EPluginHooks, ETokenType, EVarType, LSettingsStoryWrapper_default as LSettingsStoryWrapper, LogicType, LogicUtil, getPluginApi, getPluginParam, loadPlugin, makeComponent, makeLogicNode, makePlugin, sortPlugins };