@staging-apiplus/essentials 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@staging-apiplus/essentials",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "quickpage": {
5
5
  "kind": "code-package",
6
6
  "engine": "^1.0.0",
7
+ "manifest": "./dist/qp-package.json",
7
8
  "modules": [
8
9
  {
9
10
  "id": "gallery",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "@staging-apiplus/essentials",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "engine": "^1.0.0",
5
5
  "framework": "svelte",
6
6
  "capabilities": [
@@ -38,15 +38,8 @@
38
38
  "items": {
39
39
  "content": {
40
40
  "list": "wrapper",
41
- "hideInactive": true
42
- },
43
- "markers": {
44
- "list": "pagination",
45
- "template": "paginationDot",
46
- "variables": [
47
- "slideIndex",
48
- "slideNumber"
49
- ]
41
+ "item": "slide",
42
+ "shiftToActive": true
50
43
  },
51
44
  "add": {
52
45
  "label": "Add slide",
@@ -76,10 +69,14 @@
76
69
  "chromeNavigation": {
77
70
  "prevRole": "prev",
78
71
  "nextRole": "next"
72
+ },
73
+ "unboundRoleParents": {
74
+ "paginationDot": "pagination"
79
75
  }
80
76
  },
81
77
  "schema": "./dist/slider.schema.json",
82
78
  "runtime": "./dist/slider.js",
79
+ "wiringSchema": "./dist/slider.wiring.json",
83
80
  "editor": {
84
81
  "runtime": "./dist/slider.editor.js"
85
82
  }
@@ -123,6 +120,7 @@
123
120
  },
124
121
  "schema": "./dist/tab.schema.json",
125
122
  "runtime": "./dist/tab.js",
123
+ "wiringSchema": "./dist/tab.wiring.json",
126
124
  "editor": {
127
125
  "runtime": "./dist/tab.editor.js"
128
126
  }
@@ -1,33 +1,496 @@
1
- import { n as e, t } from "./derive_logic_editor_panel-D_bgZnMq.js";
2
- import { n, t as r } from "./design_time-hqGakP97.js";
1
+ import { n as e, t } from "./derive_logic_editor_panel-CpdUm43a.js";
2
+ import { n, r, t as i } from "./design_time-CtAJMDnD.js";
3
+ //#region ../../packages/qp_sdk/src/editor/bridge/editor_panel.ts
4
+ var a = {
5
+ Setting: "setting",
6
+ Slide: "slide",
7
+ Vertical: "vertical",
8
+ Horizontal: "horizontal"
9
+ }, o = 30, s = 334, c = "#0099FF26", l = "#38b6ff80", u = [
10
+ "#ff66c426",
11
+ "#ff313126",
12
+ "#ff751f26"
13
+ ], d = {
14
+ fontFamily: "system-ui",
15
+ fontSize: "48px",
16
+ fontWeight: "700",
17
+ color: "#000000"
18
+ }, f = {
19
+ page: "95bc79e3-2ffc-4f0e-bc3b-59772d40b5dd",
20
+ host: "72fe81e8-1821-4e65-9d40-f3ed990c81ae",
21
+ wrapper: "b0b1b6f1-5f20-46f2-80c8-3f2482a18095",
22
+ slides: [
23
+ "65e9e881-6038-4aac-ac85-846defc4382f",
24
+ "a9c45552-e9ce-4750-93f8-ff44fe98767b",
25
+ "115bb039-6113-4f53-827d-28c5bad38a31"
26
+ ],
27
+ pagination: "e5c43906-ca4a-4cd7-a9a0-cd90b3b562a1",
28
+ dot: "e0f3ebf7-ae36-4cf1-9add-c54af889fe0e",
29
+ nav: "3746c8c1-56d4-4b0f-8694-26dc940366b0",
30
+ prev: "b382ce4c-346c-41bc-8825-80f29c883348",
31
+ prevText: "9cb450ae-9399-4950-b19c-de0b02991ff3",
32
+ next: "0acdcb04-00f4-4d13-ba60-19c0e415fe57",
33
+ nextText: "6cc69b23-2b5f-4e34-8112-509dcf5a635e"
34
+ }, p = f.pagination, m = f.dot, h = (e) => `${e}px`;
35
+ function g(e, t = e) {
36
+ return {
37
+ paddingTop: h(e),
38
+ paddingRight: h(t),
39
+ paddingBottom: h(e),
40
+ paddingLeft: h(t)
41
+ };
42
+ }
43
+ function _(e) {
44
+ return {
45
+ borderTopLeftRadius: h(e),
46
+ borderTopRightRadius: h(e),
47
+ borderBottomRightRadius: h(e),
48
+ borderBottomLeftRadius: h(e)
49
+ };
50
+ }
51
+ function v(e) {
52
+ return { background: { bg1: { css: e } } };
53
+ }
54
+ function y(e, t) {
55
+ return [e.nodes.frame({
56
+ id: t.frameId,
57
+ parentId: f.nav,
58
+ indexKey: t.indexKey,
59
+ title: t.title,
60
+ props: { style: {
61
+ display: "flex",
62
+ overflow: "hidden",
63
+ flexDirection: "column",
64
+ justifyContent: "center",
65
+ alignItems: "center",
66
+ ...g(10),
67
+ rowGap: h(10),
68
+ columnGap: h(10),
69
+ position: "relative",
70
+ width: "fit-content",
71
+ height: "fit-content",
72
+ aspectRatio: "1",
73
+ flexGrow: "0",
74
+ flexShrink: "0",
75
+ ...v(c)
76
+ } }
77
+ }), e.nodes.text({
78
+ id: t.textId,
79
+ parentId: t.frameId,
80
+ indexKey: "a0",
81
+ title: `${t.title} icon`,
82
+ text: t.text,
83
+ textStyle: d,
84
+ props: { style: {
85
+ display: "flex",
86
+ width: "fit-content",
87
+ height: "fit-content",
88
+ flexGrow: "0",
89
+ flexShrink: "0"
90
+ } }
91
+ })];
92
+ }
93
+ function b(e) {
94
+ return [e.nodes.frame({
95
+ id: p,
96
+ parentId: f.host,
97
+ indexKey: "a1",
98
+ title: "Pagination",
99
+ props: { style: {
100
+ display: "flex",
101
+ overflow: "hidden",
102
+ flexDirection: "row",
103
+ justifyContent: "center",
104
+ alignItems: "center",
105
+ ...g(10),
106
+ rowGap: h(10),
107
+ columnGap: h(10),
108
+ position: "relative",
109
+ width: h(400),
110
+ height: h(40),
111
+ flexGrow: "0",
112
+ flexShrink: "0",
113
+ borderTopWidth: h(2),
114
+ borderRightWidth: h(2),
115
+ borderBottomWidth: h(2),
116
+ borderLeftWidth: h(2),
117
+ borderColor: "#000000",
118
+ borderStyle: "solid",
119
+ ..._(20)
120
+ } }
121
+ }), e.nodes.frame({
122
+ id: m,
123
+ parentId: p,
124
+ indexKey: "a0",
125
+ title: "Dot",
126
+ props: {
127
+ style: {
128
+ display: "flex",
129
+ overflow: "hidden",
130
+ flexDirection: "column",
131
+ alignItems: "start",
132
+ rowGap: h(10),
133
+ columnGap: h(10),
134
+ position: "relative",
135
+ width: h(20),
136
+ height: "100%",
137
+ flexGrow: "0",
138
+ flexShrink: "0",
139
+ ..._(20),
140
+ ...v(c)
141
+ },
142
+ interaction: { pseudoStates: { "dot-selected": {
143
+ state: "[aria-current=\"true\"]",
144
+ title: "aria-current",
145
+ indexKey: "a0",
146
+ targets: { [`node=${m}`]: { props: { style: {
147
+ ...v(l),
148
+ width: h(50)
149
+ } } } }
150
+ } } }
151
+ }
152
+ })];
153
+ }
154
+ function x(e) {
155
+ return {
156
+ flatNodes: b(e),
157
+ rootNodeId: p,
158
+ roleNodes: {
159
+ [r.Pagination]: p,
160
+ [r.PaginationDot]: m
161
+ },
162
+ wiring: { [r.Pagination]: r.Pagination },
163
+ roleDefinitions: n
164
+ };
165
+ }
166
+ function S(e) {
167
+ let t = [
168
+ e.nodes.frame({
169
+ id: f.host,
170
+ parentId: f.page,
171
+ indexKey: "a0",
172
+ title: "Slider",
173
+ props: { style: {
174
+ display: "flex",
175
+ overflow: "hidden",
176
+ flexDirection: "column",
177
+ justifyContent: "center",
178
+ alignItems: "center",
179
+ ...g(20, 50),
180
+ rowGap: h(20),
181
+ columnGap: h(10),
182
+ position: "relative",
183
+ width: "stretch",
184
+ height: "fit-content",
185
+ flexGrow: "0",
186
+ flexShrink: "0"
187
+ } }
188
+ }),
189
+ e.nodes.frame({
190
+ id: f.wrapper,
191
+ parentId: f.host,
192
+ indexKey: "a0",
193
+ title: "Slides",
194
+ props: { style: {
195
+ display: "flex",
196
+ overflow: "hidden",
197
+ flexDirection: "row",
198
+ alignItems: "start",
199
+ ...g(o),
200
+ rowGap: h(10),
201
+ columnGap: h(10),
202
+ position: "relative",
203
+ width: "100%",
204
+ height: h(s),
205
+ flexGrow: "0",
206
+ flexShrink: "0",
207
+ ...v(c)
208
+ } }
209
+ }),
210
+ ...u.map((t, n) => e.nodes.frame({
211
+ id: f.slides[n],
212
+ parentId: f.wrapper,
213
+ indexKey: `a${n}`,
214
+ title: `Slide ${n + 1}`,
215
+ props: { style: {
216
+ display: "flex",
217
+ overflow: "hidden",
218
+ flexDirection: "column",
219
+ alignItems: "start",
220
+ rowGap: h(10),
221
+ columnGap: h(10),
222
+ position: "relative",
223
+ width: "100%",
224
+ height: "100%",
225
+ flexGrow: "0",
226
+ flexShrink: "0",
227
+ ...v(t)
228
+ } }
229
+ })),
230
+ ...b(e),
231
+ e.nodes.frame({
232
+ id: f.nav,
233
+ parentId: f.host,
234
+ indexKey: "a2",
235
+ title: "Navigation",
236
+ props: { style: {
237
+ display: "flex",
238
+ overflow: "hidden",
239
+ flexDirection: "row",
240
+ justifyContent: "center",
241
+ alignItems: "center",
242
+ ...g(10),
243
+ rowGap: h(10),
244
+ columnGap: h(10),
245
+ position: "relative",
246
+ width: "fit-content",
247
+ height: "fit-content",
248
+ flexGrow: "0",
249
+ flexShrink: "0"
250
+ } }
251
+ }),
252
+ ...y(e, {
253
+ frameId: f.prev,
254
+ textId: f.prevText,
255
+ title: "Previous",
256
+ text: "<",
257
+ indexKey: "a0"
258
+ }),
259
+ ...y(e, {
260
+ frameId: f.next,
261
+ textId: f.nextText,
262
+ title: "Next",
263
+ text: ">",
264
+ indexKey: "a1"
265
+ })
266
+ ];
267
+ return {
268
+ version: 1,
269
+ hostNodeId: f.host,
270
+ flatNodes: t,
271
+ roleNodes: {
272
+ [r.Wrapper]: f.wrapper,
273
+ [r.Slide]: f.slides[0],
274
+ [r.Pagination]: p,
275
+ [r.PaginationDot]: m,
276
+ [r.Prev]: f.prev,
277
+ [r.Next]: f.next
278
+ },
279
+ attach: {
280
+ repeatRoles: [{
281
+ role: r.PaginationDot,
282
+ sourceRole: r.Wrapper
283
+ }],
284
+ editorState: { activeSlideIndex: 0 },
285
+ wiring: {
286
+ wrapper: `@role:${r.Wrapper}`,
287
+ pagination: `@role:${r.Pagination}`,
288
+ prevButton: `@role:${r.Prev}`,
289
+ nextButton: `@role:${r.Next}`
290
+ },
291
+ roleDefinitions: n
292
+ }
293
+ };
294
+ }
295
+ //#endregion
3
296
  //#region src/slider/editor/editor.ts
4
- var i = t(r, { contentRole: n.Slide }, {
297
+ var C = 3e3, w = 500, T = {
298
+ vertical: "vertical",
299
+ horizontal: "horizontal"
300
+ }, E = t(i, { contentRole: r.Slide }, {
5
301
  includeSettings: !1,
6
302
  suggestClass: "qp-slider-slide",
7
303
  contentActions: {
8
304
  reorder: "reorderSlide",
9
305
  remove: "removeSlide",
10
306
  add: "addSlide",
11
- setActive: "setActiveSlide"
307
+ setActive: "setActiveSlide",
308
+ duplicate: "duplicateSlide",
309
+ rename: "renameSlide"
12
310
  }
13
- }), a = e({
311
+ }), D = E.find((e) => e.type === "collection"), O = E.filter((e) => e.type === "logic-states");
312
+ function k(e) {
313
+ return e.tree.getRoleStyle(r.Wrapper, "flexDirection") === "column" ? "rowGap" : "columnGap";
314
+ }
315
+ function A(e) {
316
+ return e.tree.hasRole(r.Wrapper);
317
+ }
318
+ function j(e) {
319
+ return e.logic.getProps().autoplay === !0;
320
+ }
321
+ function M(e) {
322
+ return e.tree.isRoleVisible(r.Pagination);
323
+ }
324
+ function N(e, t) {
325
+ return e.tree.setRoleRepeated(r.PaginationDot, {
326
+ sourceRole: r.Wrapper,
327
+ enabled: t
328
+ });
329
+ }
330
+ var P = {
331
+ type: "controls",
332
+ id: "slider-settings",
333
+ label: "Settings",
334
+ controls: [
335
+ {
336
+ id: "default-slide",
337
+ kind: "select",
338
+ label: "Default",
339
+ value: {
340
+ editorState: i.activeIndexStateKey,
341
+ fallback: 0
342
+ },
343
+ options: (e) => e.host.listByRole(r.Slide).map((e, t) => ({
344
+ value: t,
345
+ label: e.name
346
+ }))
347
+ },
348
+ {
349
+ id: "autoplay",
350
+ kind: "toggle",
351
+ label: "Autoplay",
352
+ value: {
353
+ prop: "autoplay",
354
+ fallback: !1
355
+ }
356
+ },
357
+ {
358
+ id: "autoplay-delay",
359
+ kind: "number",
360
+ label: "Speed",
361
+ value: {
362
+ prop: "autoplayDelay",
363
+ fallback: C
364
+ },
365
+ min: w,
366
+ step: 100,
367
+ unit: "ms",
368
+ isDisabled: (e) => !j(e)
369
+ },
370
+ {
371
+ id: "loop",
372
+ kind: "toggle",
373
+ label: "Loop",
374
+ value: {
375
+ prop: "loop",
376
+ fallback: !0
377
+ }
378
+ },
379
+ {
380
+ id: "space-between",
381
+ kind: "style-input",
382
+ label: "Space between",
383
+ role: r.Wrapper,
384
+ property: k,
385
+ cssProperty: "gap",
386
+ isVisible: A
387
+ },
388
+ {
389
+ id: "pagination",
390
+ kind: "toggle",
391
+ label: "Pagination",
392
+ value: {
393
+ read: M,
394
+ action: "setPagination"
395
+ }
396
+ },
397
+ {
398
+ id: "pagination-dot",
399
+ kind: "toggle",
400
+ label: "Pagination dot",
401
+ description: "Pagination dots automatically repeat based on the number of slides.",
402
+ value: {
403
+ read: (e) => e.tree.isRoleRepeated(r.PaginationDot),
404
+ action: "setPaginationDot"
405
+ },
406
+ isDisabled: (e) => !M(e) || !e.tree.hasRole(r.PaginationDot),
407
+ devOnly: !0
408
+ }
409
+ ]
410
+ }, F = [
411
+ {
412
+ type: "repeat-source",
413
+ role: r.Slide,
414
+ parentRole: r.Wrapper,
415
+ addAction: "addSlide"
416
+ },
417
+ {
418
+ type: "controls",
419
+ id: "slider-direction",
420
+ controls: [{
421
+ id: "direction",
422
+ kind: "segmented",
423
+ label: "Direction",
424
+ description: "Specifies the direction in which the slider moves during transition.",
425
+ options: [{
426
+ value: T.vertical,
427
+ label: "column (vertical)",
428
+ icon: a.Vertical
429
+ }, {
430
+ value: T.horizontal,
431
+ label: "row (horizontal)",
432
+ icon: a.Horizontal
433
+ }],
434
+ value: {
435
+ read: (e) => e.tree.getRoleStyle(r.Wrapper, "flexDirection") === "column" ? T.vertical : T.horizontal,
436
+ action: "setDirection"
437
+ },
438
+ isVisible: A
439
+ }]
440
+ },
441
+ ...D ? [{
442
+ ...D,
443
+ label: "Slide"
444
+ }] : []
445
+ ], I = e({
14
446
  editorPanel: {
15
447
  profile: { label: "Slider" },
16
- sections: i
448
+ sections: [...O, P],
449
+ dialog: {
450
+ label: "Slide settings",
451
+ icon: a.Slide,
452
+ sections: F
453
+ }
454
+ },
455
+ insert: {
456
+ label: "Slider",
457
+ snapshot: S,
458
+ roleSubtrees: { [r.Pagination]: x }
459
+ },
460
+ async onWireBound(e, t) {
461
+ let { bridge: n } = e;
462
+ return t !== r.Pagination || !n.tree.hasRole(r.PaginationDot) ? { success: !0 } : N(n, !0);
17
463
  },
18
- async onAction(e, t, r) {
464
+ async onAction(e, t, n) {
19
465
  let { bridge: i } = e;
20
466
  switch (t) {
21
467
  case "reorderSlide": {
22
- let e = String(r.nodeId ?? ""), t = Number(r.offset ?? 0);
468
+ let e = String(n.nodeId ?? ""), t = Number(n.offset ?? 0);
23
469
  return i.tree.reorderChild(e, t);
24
470
  }
25
471
  case "removeSlide": {
26
- let e = String(r.nodeId ?? "");
472
+ let e = String(n.nodeId ?? "");
27
473
  return i.tree.removeRole(e);
28
474
  }
29
- case "addSlide": return i.tree.addRole(n.Slide, { parentRole: n.Wrapper });
30
- case "setActiveSlide": return i.logic.setEditorState({ activeSlideIndex: Number(r.index ?? 0) });
475
+ case "addSlide": return i.tree.addRole(r.Slide, { parentRole: r.Wrapper });
476
+ case "setActiveSlide": return i.logic.setEditorState({ activeSlideIndex: Number(n.index ?? 0) });
477
+ case "duplicateSlide": {
478
+ let e = String(n.nodeId ?? ""), t = i.host.listByRole(r.Slide).findIndex((t) => t.nodeId === e), a = Number(i.logic.getEditorState().activeSlideIndex ?? 0), o = await i.tree.duplicateRole(e);
479
+ return o.success && t >= 0 && a > t ? i.logic.setEditorState({ activeSlideIndex: a + 1 }) : o;
480
+ }
481
+ case "setDirection": return i.tree.setRoleStyle(r.Wrapper, "flexDirection", n.value === T.vertical ? "column" : "row");
482
+ case "setPagination": {
483
+ let e = n.value === !0;
484
+ if (i.tree.hasRole(r.Pagination)) return i.tree.setRoleVisible(r.Pagination, e);
485
+ if (!e) return { success: !0 };
486
+ let t = await i.tree.insertRoleSubtree(r.Pagination, { afterRole: r.Wrapper });
487
+ return t.success ? N(i, !0) : t;
488
+ }
489
+ case "setPaginationDot": return N(i, n.value === !0);
490
+ case "renameSlide": {
491
+ let e = String(n.nodeId ?? ""), t = String(n.label ?? "");
492
+ return i.tree.renameRoleNode(e, t);
493
+ }
31
494
  default: return {
32
495
  success: !1,
33
496
  message: `Unsupported slider editor action: ${t}`
@@ -36,4 +499,4 @@ var i = t(r, { contentRole: n.Slide }, {
36
499
  }
37
500
  });
38
501
  //#endregion
39
- export { a as default };
502
+ export { I as default };