@luna-park/plugin 1.8.0 → 2.0.1

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