@staging-apiplus/essentials 0.0.0-stage → 0.0.2
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/README.md +30 -2
- package/dist/derive_logic_editor_panel-D_bgZnMq.js +56 -0
- package/dist/design_time-BeEBEFSF.js +39 -0
- package/dist/design_time-hqGakP97.js +47 -0
- package/dist/gallery/package.json +7 -0
- package/dist/gallery.js +6657 -0
- package/dist/gallery.schema.json +589 -0
- package/dist/logic_role_kind-DV5olnbL.js +9 -0
- package/dist/npm-package.json +46 -0
- package/dist/qp-package.json +134 -0
- package/dist/slider/package.json +7 -0
- package/dist/slider.editor.js +39 -0
- package/dist/slider.js +335 -0
- package/dist/slider.schema.json +32 -0
- package/dist/slider.wiring.json +26 -0
- package/dist/sync_selected_style_roles-PKX5qPBc.js +45 -0
- package/dist/tab/package.json +7 -0
- package/dist/tab.editor.js +52 -0
- package/dist/tab.js +185 -0
- package/dist/tab.schema.json +13 -0
- package/dist/tab.wiring.json +16 -0
- package/package.json +68 -4
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "@staging-apiplus/essentials",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"engine": "^1.0.0",
|
|
5
|
+
"framework": "svelte",
|
|
6
|
+
"capabilities": [
|
|
7
|
+
"document:component:render",
|
|
8
|
+
"document:logic:mount",
|
|
9
|
+
"editor:plugin:load"
|
|
10
|
+
],
|
|
11
|
+
"library": {
|
|
12
|
+
"category": "Custom"
|
|
13
|
+
},
|
|
14
|
+
"modules": {
|
|
15
|
+
"components": [
|
|
16
|
+
{
|
|
17
|
+
"id": "gallery",
|
|
18
|
+
"tag": "qp-ext-qp-gallery",
|
|
19
|
+
"slots": [
|
|
20
|
+
"slide"
|
|
21
|
+
],
|
|
22
|
+
"schema": "./dist/gallery.schema.json",
|
|
23
|
+
"runtime": "./dist/gallery.js"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"logics": [
|
|
27
|
+
{
|
|
28
|
+
"id": "slider",
|
|
29
|
+
"wiring": [
|
|
30
|
+
"wrapper",
|
|
31
|
+
"pagination",
|
|
32
|
+
"prevButton",
|
|
33
|
+
"nextButton"
|
|
34
|
+
],
|
|
35
|
+
"designTime": {
|
|
36
|
+
"mode": "active-item",
|
|
37
|
+
"activeIndexStateKey": "activeSlideIndex",
|
|
38
|
+
"items": {
|
|
39
|
+
"content": {
|
|
40
|
+
"list": "wrapper",
|
|
41
|
+
"hideInactive": true
|
|
42
|
+
},
|
|
43
|
+
"markers": {
|
|
44
|
+
"list": "pagination",
|
|
45
|
+
"template": "paginationDot",
|
|
46
|
+
"variables": [
|
|
47
|
+
"slideIndex",
|
|
48
|
+
"slideNumber"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"add": {
|
|
52
|
+
"label": "Add slide",
|
|
53
|
+
"name": "Slide {n}"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"states": {
|
|
57
|
+
"paginationDot": {
|
|
58
|
+
"selected": {
|
|
59
|
+
"marker": "aria-current",
|
|
60
|
+
"required": true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"controls": {
|
|
65
|
+
"prev": {
|
|
66
|
+
"disabled": {
|
|
67
|
+
"marker": "aria-disabled"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"next": {
|
|
71
|
+
"disabled": {
|
|
72
|
+
"marker": "aria-disabled"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"chromeNavigation": {
|
|
77
|
+
"prevRole": "prev",
|
|
78
|
+
"nextRole": "next"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"schema": "./dist/slider.schema.json",
|
|
82
|
+
"runtime": "./dist/slider.js",
|
|
83
|
+
"wiringSchema": "./dist/slider.wiring.json",
|
|
84
|
+
"editor": {
|
|
85
|
+
"runtime": "./dist/slider.editor.js"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "tab",
|
|
90
|
+
"wiring": [
|
|
91
|
+
"tabList",
|
|
92
|
+
"panelList"
|
|
93
|
+
],
|
|
94
|
+
"designTime": {
|
|
95
|
+
"mode": "active-item",
|
|
96
|
+
"activeIndexStateKey": "activeTabIndex",
|
|
97
|
+
"items": {
|
|
98
|
+
"label": {
|
|
99
|
+
"list": "tabList"
|
|
100
|
+
},
|
|
101
|
+
"content": {
|
|
102
|
+
"list": "panelList",
|
|
103
|
+
"hideInactive": true
|
|
104
|
+
},
|
|
105
|
+
"add": {
|
|
106
|
+
"label": "Add tab",
|
|
107
|
+
"name": "Tab {n}"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"states": {
|
|
111
|
+
"tab": {
|
|
112
|
+
"selected": {
|
|
113
|
+
"marker": "aria-selected",
|
|
114
|
+
"required": true
|
|
115
|
+
},
|
|
116
|
+
"hover": {}
|
|
117
|
+
},
|
|
118
|
+
"panel": {
|
|
119
|
+
"active": {
|
|
120
|
+
"automatic": true
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"schema": "./dist/tab.schema.json",
|
|
126
|
+
"runtime": "./dist/tab.js",
|
|
127
|
+
"wiringSchema": "./dist/tab.wiring.json",
|
|
128
|
+
"editor": {
|
|
129
|
+
"runtime": "./dist/tab.editor.js"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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";
|
|
3
|
+
//#region src/slider/editor/editor.ts
|
|
4
|
+
var i = t(r, { contentRole: n.Slide }, {
|
|
5
|
+
includeSettings: !1,
|
|
6
|
+
suggestClass: "qp-slider-slide",
|
|
7
|
+
contentActions: {
|
|
8
|
+
reorder: "reorderSlide",
|
|
9
|
+
remove: "removeSlide",
|
|
10
|
+
add: "addSlide",
|
|
11
|
+
setActive: "setActiveSlide"
|
|
12
|
+
}
|
|
13
|
+
}), a = e({
|
|
14
|
+
editorPanel: {
|
|
15
|
+
profile: { label: "Slider" },
|
|
16
|
+
sections: i
|
|
17
|
+
},
|
|
18
|
+
async onAction(e, t, r) {
|
|
19
|
+
let { bridge: i } = e;
|
|
20
|
+
switch (t) {
|
|
21
|
+
case "reorderSlide": {
|
|
22
|
+
let e = String(r.nodeId ?? ""), t = Number(r.offset ?? 0);
|
|
23
|
+
return i.tree.reorderChild(e, t);
|
|
24
|
+
}
|
|
25
|
+
case "removeSlide": {
|
|
26
|
+
let e = String(r.nodeId ?? "");
|
|
27
|
+
return i.tree.removeRole(e);
|
|
28
|
+
}
|
|
29
|
+
case "addSlide": return i.tree.addRole(n.Slide, { parentRole: n.Wrapper });
|
|
30
|
+
case "setActiveSlide": return i.logic.setEditorState({ activeSlideIndex: Number(r.index ?? 0) });
|
|
31
|
+
default: return {
|
|
32
|
+
success: !1,
|
|
33
|
+
message: `Unsupported slider editor action: ${t}`
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { a as default };
|
package/dist/slider.js
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { t as e } from "./sync_selected_style_roles-PKX5qPBc.js";
|
|
2
|
+
import { n as t, t as n } from "./design_time-hqGakP97.js";
|
|
3
|
+
//#region src/slider/runtime/dom.ts
|
|
4
|
+
var r = "data-qp-logic-slider", i = "qp-slider-runtime-styles", a = "qp-slider-dot", o = `
|
|
5
|
+
[${r}] {
|
|
6
|
+
display: block;
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[${r}] .qp-slider-wrapper {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
flex-wrap: nowrap;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
will-change: transform;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Publish critical CSS hides inactive slides by class with !important. */
|
|
21
|
+
[${r}] .qp-slider-slide {
|
|
22
|
+
display: flex !important;
|
|
23
|
+
align-items: center !important;
|
|
24
|
+
justify-content: center !important;
|
|
25
|
+
visibility: visible !important;
|
|
26
|
+
flex: 0 0 auto;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[${r}] .qp-slider-prev,
|
|
31
|
+
[${r}] .qp-slider-next {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 50%;
|
|
34
|
+
z-index: 10;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
pointer-events: auto;
|
|
37
|
+
transform: translateY(-50%);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[${r}] .qp-slider-prev {
|
|
41
|
+
left: 8px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[${r}] .qp-slider-next {
|
|
45
|
+
right: 8px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[${r}] .qp-slider-pagination {
|
|
49
|
+
position: absolute;
|
|
50
|
+
bottom: 12px;
|
|
51
|
+
left: 0;
|
|
52
|
+
right: 0;
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
gap: 8px;
|
|
58
|
+
z-index: 10;
|
|
59
|
+
pointer-events: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[${r}] .${a} {
|
|
63
|
+
width: 8px;
|
|
64
|
+
height: 8px;
|
|
65
|
+
border-radius: 999px;
|
|
66
|
+
border: none;
|
|
67
|
+
padding: 0;
|
|
68
|
+
background: rgba(0, 0, 0, 0.3);
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
function s() {
|
|
73
|
+
if (typeof document > "u" || document.getElementById("qp-slider-runtime-styles")) return;
|
|
74
|
+
let e = document.createElement("style");
|
|
75
|
+
e.id = i, e.textContent = o, document.head.appendChild(e);
|
|
76
|
+
}
|
|
77
|
+
function c(e, t) {
|
|
78
|
+
if (t instanceof HTMLElement) return t;
|
|
79
|
+
let n = e.querySelector(".qp-slider-wrapper");
|
|
80
|
+
return n instanceof HTMLElement ? n : null;
|
|
81
|
+
}
|
|
82
|
+
function l(e, t) {
|
|
83
|
+
t.classList.contains("qp-slider-wrapper") || t.classList.add("qp-slider-wrapper");
|
|
84
|
+
for (let e of g(t)) e.classList.contains("qp-slider-slide") || e.classList.add("qp-slider-slide");
|
|
85
|
+
for (let t of [
|
|
86
|
+
".qp-slider-prev",
|
|
87
|
+
".qp-slider-next",
|
|
88
|
+
".qp-slider-pagination"
|
|
89
|
+
]) {
|
|
90
|
+
let n = e.querySelector(t);
|
|
91
|
+
if (n instanceof HTMLElement) {
|
|
92
|
+
let e = t.slice(1);
|
|
93
|
+
n.classList.contains(e) || n.classList.add(e);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function u(e) {
|
|
98
|
+
for (let t of g(e)) t.style.setProperty("display", "flex", "important"), t.style.setProperty("align-items", "center", "important"), t.style.setProperty("justify-content", "center", "important"), t.style.setProperty("visibility", "visible", "important");
|
|
99
|
+
}
|
|
100
|
+
var d = [
|
|
101
|
+
"qp-slider-prev",
|
|
102
|
+
"qp-slider-next",
|
|
103
|
+
"qp-slider-pagination",
|
|
104
|
+
a
|
|
105
|
+
];
|
|
106
|
+
function f(e) {
|
|
107
|
+
return d.some((t) => e.classList.contains(t));
|
|
108
|
+
}
|
|
109
|
+
function p(e) {
|
|
110
|
+
if (f(e)) return !0;
|
|
111
|
+
let t = m(e);
|
|
112
|
+
return t.length > 0 && t.every(f);
|
|
113
|
+
}
|
|
114
|
+
function m(e) {
|
|
115
|
+
return Array.from(e.children).filter((e) => e instanceof HTMLElement);
|
|
116
|
+
}
|
|
117
|
+
function h(e, t) {
|
|
118
|
+
if (t.length === 0) return e;
|
|
119
|
+
let n = t[0]?.parentElement;
|
|
120
|
+
return n instanceof HTMLElement && n !== e && t.every((e) => e.parentElement === n) ? n : e;
|
|
121
|
+
}
|
|
122
|
+
function g(e) {
|
|
123
|
+
let t = m(e).filter((e) => e.classList.contains("qp-slider-slide") && !f(e));
|
|
124
|
+
if (t.length > 0) return t;
|
|
125
|
+
let n = m(e).filter((e) => !p(e));
|
|
126
|
+
if (n.length === 1) {
|
|
127
|
+
let e = m(n[0]).filter((e) => !f(e));
|
|
128
|
+
if (e.length > 1) return e;
|
|
129
|
+
}
|
|
130
|
+
if (n.length > 1) {
|
|
131
|
+
let e = n.map((e) => ({
|
|
132
|
+
el: e,
|
|
133
|
+
count: m(e).filter((e) => !f(e)).length
|
|
134
|
+
})).sort((e, t) => t.count - e.count), t = e[0], r = e[1];
|
|
135
|
+
if (t && t.count >= 2 && t.count > (r?.count ?? 0)) return m(t.el).filter((e) => !f(e));
|
|
136
|
+
}
|
|
137
|
+
return n;
|
|
138
|
+
}
|
|
139
|
+
function _(e) {
|
|
140
|
+
let t = e.getBoundingClientRect(), n = e.clientWidth > 0 ? e.clientWidth : t.width, r = e.clientHeight > 0 ? e.clientHeight : t.height;
|
|
141
|
+
if (typeof getComputedStyle == "function") {
|
|
142
|
+
let t = getComputedStyle(e), i = (Number.parseFloat(t.paddingLeft) || 0) + (Number.parseFloat(t.paddingRight) || 0), a = (Number.parseFloat(t.paddingTop) || 0) + (Number.parseFloat(t.paddingBottom) || 0);
|
|
143
|
+
return {
|
|
144
|
+
width: Math.max(0, n - i),
|
|
145
|
+
height: Math.max(0, r - a)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
width: n,
|
|
150
|
+
height: r
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function v(e, t) {
|
|
154
|
+
let n = _(e);
|
|
155
|
+
if (!t || t === e) return n;
|
|
156
|
+
let r = _(t);
|
|
157
|
+
return {
|
|
158
|
+
width: n.width > 0 ? n.width : r.width,
|
|
159
|
+
height: n.height > 0 ? n.height : r.height
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function y(e, t) {
|
|
163
|
+
e.style.padding = "0", e.style.gap = "0", e.style.rowGap = "0", e.style.columnGap = "0", e.style.boxSizing = "border-box";
|
|
164
|
+
let { width: n, height: r } = v(e, t);
|
|
165
|
+
e.style.display = "block", e.style.position = "relative", e.style.overflow = "hidden", n > 0 && (e.style.width = `${n}px`, e.style.maxWidth = `${n}px`), r > 0 && (e.style.height = `${r}px`);
|
|
166
|
+
let i = g(t), a = h(t, i), o = n > 0 ? Math.max(i.length, 1) * n : 0;
|
|
167
|
+
a.style.display = "flex", a.style.flexDirection = "row", a.style.flexWrap = "nowrap", a.style.flexShrink = "0", a.style.overflow = "hidden", a.style.padding = "0", a.style.gap = "0", a.style.boxSizing = "border-box", a.style.width = o > 0 ? `${o}px` : "max-content", a.style.maxWidth = "none", a.style.height = r > 0 ? `${r}px` : "100%", a !== t && (t.style.transform = "", t.style.transition = "", t.style.overflow = "hidden", t.style.position = "relative", t.style.padding = "0", t.style.gap = "0", t.style.width = "100%", t.style.maxWidth = "100%", t.style.height = r > 0 ? `${r}px` : "100%");
|
|
168
|
+
for (let e of i) e.style.display = "flex", e.style.alignItems = "center", e.style.justifyContent = "center", e.style.flex = "0 0 auto", e.style.flexShrink = "0", e.style.width = `${n}px`, e.style.minWidth = `${n}px`, e.style.maxWidth = `${n}px`, r > 0 && (e.style.height = `${r}px`), e.style.boxSizing = "border-box", e.style.overflow = "hidden";
|
|
169
|
+
return n;
|
|
170
|
+
}
|
|
171
|
+
function b(e, t, n, r) {
|
|
172
|
+
let i = g(t);
|
|
173
|
+
if (i.length === 0) return;
|
|
174
|
+
let a = Math.max(0, Math.min(n, i.length - 1));
|
|
175
|
+
u(t);
|
|
176
|
+
let o = y(e, t), s = h(t, i), c = a * Math.max(0, o);
|
|
177
|
+
s.style.transition = r > 0 ? `transform ${r}ms ease` : "none", s.style.transform = `translate3d(-${c}px, 0, 0)`;
|
|
178
|
+
}
|
|
179
|
+
function x(e, t, n) {
|
|
180
|
+
e.replaceChildren();
|
|
181
|
+
let r = [];
|
|
182
|
+
for (let i = 0; i < n; i += 1) {
|
|
183
|
+
let n = t.cloneNode(!0);
|
|
184
|
+
n.classList.add(a), n.setAttribute("aria-label", `Go to slide ${i + 1}`), n.dataset.slideIndex = String(i), e.appendChild(n), r.push(n);
|
|
185
|
+
}
|
|
186
|
+
return r;
|
|
187
|
+
}
|
|
188
|
+
function S(e, t) {
|
|
189
|
+
let n = Array.from(e.querySelectorAll(`.${a}`)).filter((e) => e instanceof HTMLElement);
|
|
190
|
+
if (n.length === t) return n;
|
|
191
|
+
e.replaceChildren();
|
|
192
|
+
let r = [];
|
|
193
|
+
for (let n = 0; n < t; n += 1) {
|
|
194
|
+
let t = document.createElement("button");
|
|
195
|
+
t.type = "button", t.className = a, t.setAttribute("aria-label", `Go to slide ${n + 1}`), t.dataset.slideIndex = String(n), e.appendChild(t), r.push(t);
|
|
196
|
+
}
|
|
197
|
+
return r;
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/slider/runtime/runtime.ts
|
|
201
|
+
function C(e) {
|
|
202
|
+
return e.scopeRoot instanceof HTMLElement ? e.scopeRoot : null;
|
|
203
|
+
}
|
|
204
|
+
function w(e, t, n) {
|
|
205
|
+
if (e instanceof HTMLElement) return e;
|
|
206
|
+
let r = t.querySelector(n);
|
|
207
|
+
return r instanceof HTMLElement ? r : null;
|
|
208
|
+
}
|
|
209
|
+
function T(e) {
|
|
210
|
+
let t = C(e);
|
|
211
|
+
if (!t) return null;
|
|
212
|
+
let n = c(t, e.wiring.wrapper);
|
|
213
|
+
return n ? {
|
|
214
|
+
slider: t,
|
|
215
|
+
wrapper: n,
|
|
216
|
+
prevButton: w(e.wiring.prevButton, t, ".qp-slider-prev"),
|
|
217
|
+
nextButton: w(e.wiring.nextButton, t, ".qp-slider-next"),
|
|
218
|
+
pagination: w(e.wiring.pagination, t, ".qp-slider-pagination")
|
|
219
|
+
} : null;
|
|
220
|
+
}
|
|
221
|
+
function E(e, t) {
|
|
222
|
+
let n = Array.from(e.children).filter((e) => e instanceof HTMLElement);
|
|
223
|
+
if (n.length > 0 && !n.some((e) => e.classList.contains("qp-slider-dot"))) {
|
|
224
|
+
let r = n[0];
|
|
225
|
+
return x(e, r, t);
|
|
226
|
+
}
|
|
227
|
+
return S(e, t);
|
|
228
|
+
}
|
|
229
|
+
function D(e, t, n, r) {
|
|
230
|
+
let i = t <= 0, a = t >= n - 1;
|
|
231
|
+
for (let [t, n] of [[e.prevButton, !r && i], [e.nextButton, !r && a]]) t && (n ? t.setAttribute("aria-disabled", "true") : t.removeAttribute("aria-disabled"));
|
|
232
|
+
}
|
|
233
|
+
function O(r, i) {
|
|
234
|
+
e({
|
|
235
|
+
spec: n,
|
|
236
|
+
activeIndex: i,
|
|
237
|
+
roleLists: { [t.PaginationDot]: r }
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function k(e, t) {
|
|
241
|
+
e && !e.classList.contains(t) && e.classList.add(t);
|
|
242
|
+
}
|
|
243
|
+
function A(e) {
|
|
244
|
+
k(e.prevButton, "qp-slider-prev"), k(e.nextButton, "qp-slider-next"), k(e.pagination, "qp-slider-pagination"), l(e.slider, e.wrapper);
|
|
245
|
+
}
|
|
246
|
+
function j(e) {
|
|
247
|
+
let t = Number(e.editorState?.[n.activeIndexStateKey] ?? 0);
|
|
248
|
+
return Number.isFinite(t) ? t : 0;
|
|
249
|
+
}
|
|
250
|
+
function M(e) {
|
|
251
|
+
let t = e, n = T(e);
|
|
252
|
+
if (!n) return;
|
|
253
|
+
s(), A(n), u(n.wrapper);
|
|
254
|
+
let i = j(e), a, o = [], c = null, l = (e) => Number(e.props.speed ?? 400), d = (e) => !!e.props.loop, f = (e) => !!e.props.autoplay, p = (e) => Number(e.props.autoplayDelay ?? 3e3), m = () => {
|
|
255
|
+
a &&= (clearInterval(a), void 0);
|
|
256
|
+
}, h = (e, t, n = !0) => {
|
|
257
|
+
let r = T(e);
|
|
258
|
+
if (!r) return;
|
|
259
|
+
let a = g(r.wrapper);
|
|
260
|
+
if (a.length === 0) return;
|
|
261
|
+
A(r), u(r.wrapper);
|
|
262
|
+
let s = d(e), c = t;
|
|
263
|
+
if (s) {
|
|
264
|
+
let e = a.length;
|
|
265
|
+
c = (t % e + e) % e;
|
|
266
|
+
} else c = Math.max(0, Math.min(t, a.length - 1));
|
|
267
|
+
i = c, b(r.slider, r.wrapper, i, n ? l(e) : 0), O(o, i), D(r, i, a.length, s);
|
|
268
|
+
}, _ = (e) => {
|
|
269
|
+
m(), f(e) && (a = setInterval(() => {
|
|
270
|
+
h(t, i + 1);
|
|
271
|
+
}, p(e)));
|
|
272
|
+
}, y = (e) => {
|
|
273
|
+
let t = T(e);
|
|
274
|
+
if (!t?.pagination) {
|
|
275
|
+
o = [];
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
let n = g(t.wrapper);
|
|
279
|
+
o = E(t.pagination, n.length), O(o, i);
|
|
280
|
+
}, x = (e) => {
|
|
281
|
+
let n = T(t);
|
|
282
|
+
if (!n) return;
|
|
283
|
+
let r = e.target;
|
|
284
|
+
if (r instanceof Node) {
|
|
285
|
+
if (n.prevButton && (n.prevButton === r || n.prevButton.contains(r))) {
|
|
286
|
+
e.preventDefault(), h(t, i - 1);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (n.nextButton && (n.nextButton === r || n.nextButton.contains(r))) {
|
|
290
|
+
e.preventDefault(), h(t, i + 1);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (n.pagination) {
|
|
294
|
+
for (let [n, i] of o.entries()) if (i === r || i.contains(r)) {
|
|
295
|
+
e.preventDefault(), h(t, n);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}, S = new ResizeObserver(() => {
|
|
301
|
+
h(t, i, !1);
|
|
302
|
+
}), C = (e) => {
|
|
303
|
+
let t = T(e);
|
|
304
|
+
t && (S.disconnect(), S.observe(t.slider));
|
|
305
|
+
}, w = (e) => {
|
|
306
|
+
let t = T(e);
|
|
307
|
+
t && c !== t.slider && (c?.removeEventListener("click", x), c = t.slider, c.addEventListener("click", x));
|
|
308
|
+
}, k = (e) => {
|
|
309
|
+
t = e;
|
|
310
|
+
let n = T(e);
|
|
311
|
+
n && (n.slider.setAttribute(r, ""), A(n), w(e), y(e), h(e, i, !1), _(e), C(e));
|
|
312
|
+
}, M = (e, t = 0) => {
|
|
313
|
+
let n = T(e);
|
|
314
|
+
if (!n) return;
|
|
315
|
+
let { width: r } = v(n.slider, n.wrapper);
|
|
316
|
+
if (r > 0 || t >= 30) {
|
|
317
|
+
h(e, i, !1);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
requestAnimationFrame(() => M(e, t + 1));
|
|
321
|
+
};
|
|
322
|
+
return w(e), k(e), M(e), {
|
|
323
|
+
update: (e) => {
|
|
324
|
+
k(e);
|
|
325
|
+
},
|
|
326
|
+
destroy: () => {
|
|
327
|
+
m(), S.disconnect(), c?.removeEventListener("click", x), c?.removeAttribute(r), c = null;
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
var N = { mount(e) {
|
|
332
|
+
return M(e);
|
|
333
|
+
} };
|
|
334
|
+
//#endregion
|
|
335
|
+
export { N as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://quickpage.dev/schemas/logic/v1",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"speed": {
|
|
6
|
+
"type": "number",
|
|
7
|
+
"default": 400,
|
|
8
|
+
"minimum": 0,
|
|
9
|
+
"x-qp-control": "number",
|
|
10
|
+
"x-qp-label": "Transition speed (ms)"
|
|
11
|
+
},
|
|
12
|
+
"loop": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"default": false,
|
|
15
|
+
"x-qp-control": "boolean",
|
|
16
|
+
"x-qp-label": "Loop slides"
|
|
17
|
+
},
|
|
18
|
+
"autoplay": {
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"default": false,
|
|
21
|
+
"x-qp-control": "boolean",
|
|
22
|
+
"x-qp-label": "Autoplay"
|
|
23
|
+
},
|
|
24
|
+
"autoplayDelay": {
|
|
25
|
+
"type": "number",
|
|
26
|
+
"default": 3000,
|
|
27
|
+
"minimum": 500,
|
|
28
|
+
"x-qp-control": "number",
|
|
29
|
+
"x-qp-label": "Autoplay delay (ms)"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://quickpage.dev/schemas/wiring/v1",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"wrapper": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"x-qp-wire-kind": "node",
|
|
8
|
+
"x-qp-label": "Slider wrapper"
|
|
9
|
+
},
|
|
10
|
+
"pagination": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"x-qp-wire-kind": "node",
|
|
13
|
+
"x-qp-label": "Pagination"
|
|
14
|
+
},
|
|
15
|
+
"prevButton": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"x-qp-wire-kind": "node",
|
|
18
|
+
"x-qp-label": "Previous button"
|
|
19
|
+
},
|
|
20
|
+
"nextButton": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"x-qp-wire-kind": "node",
|
|
23
|
+
"x-qp-label": "Next button"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region ../../packages/qp_sdk/src/logic/sync_selected_style_roles.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return t <= 0 ? 0 : Math.max(0, Math.min(e, t - 1));
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
6
|
+
if (e.activeIndex !== void 0) return e.activeIndex;
|
|
7
|
+
let t = Number(e.editorState?.[e.spec.activeIndexStateKey] ?? 0);
|
|
8
|
+
return Number.isFinite(t) ? t : 0;
|
|
9
|
+
}
|
|
10
|
+
function n(e, t, n) {
|
|
11
|
+
let r = t[e];
|
|
12
|
+
if (r?.length) return r;
|
|
13
|
+
let i = n?.[e];
|
|
14
|
+
return i ? [i] : [];
|
|
15
|
+
}
|
|
16
|
+
function r(e, t, n) {
|
|
17
|
+
if (e instanceof HTMLElement) {
|
|
18
|
+
if (n) {
|
|
19
|
+
e.setAttribute(t, "true");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
e.removeAttribute(t);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function i(e) {
|
|
26
|
+
if (e.selectedStyleRoles?.length) return e.selectedStyleRoles;
|
|
27
|
+
if (!e.states) return;
|
|
28
|
+
let t = [];
|
|
29
|
+
for (let [n, r] of Object.entries(e.states)) for (let e of Object.values(r)) (e.marker === "aria-selected" || e.marker === "aria-current") && t.push({
|
|
30
|
+
role: n,
|
|
31
|
+
marker: e.marker
|
|
32
|
+
});
|
|
33
|
+
return t.length > 0 ? t : void 0;
|
|
34
|
+
}
|
|
35
|
+
function a(a) {
|
|
36
|
+
let o = i(a.spec);
|
|
37
|
+
if (!o?.length) return;
|
|
38
|
+
let s = t(a);
|
|
39
|
+
for (let t of o) {
|
|
40
|
+
let i = n(t.role, a.roleLists, a.roleNodes), o = e(s, i.length);
|
|
41
|
+
for (let e = 0; e < i.length; e++) r(i[e], t.marker, e === o);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { a as t };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { n as e, t } from "./derive_logic_editor_panel-D_bgZnMq.js";
|
|
2
|
+
import { n, t as r } from "./design_time-BeEBEFSF.js";
|
|
3
|
+
//#region src/tab/editor/editor.ts
|
|
4
|
+
var i = t(r, {
|
|
5
|
+
labelRole: n.Tab,
|
|
6
|
+
contentRole: n.Panel,
|
|
7
|
+
labelListRole: n.TabList,
|
|
8
|
+
contentListRole: n.PanelList
|
|
9
|
+
}, { includeSettings: !1 }), a = e({
|
|
10
|
+
editorPanel: {
|
|
11
|
+
profile: { label: "Tabs" },
|
|
12
|
+
sections: i
|
|
13
|
+
},
|
|
14
|
+
async onAction(e, t, r) {
|
|
15
|
+
let { bridge: i } = e;
|
|
16
|
+
switch (t) {
|
|
17
|
+
case "reorderTab": {
|
|
18
|
+
let e = String(r.nodeId ?? ""), t = Number(r.offset ?? 0), a = await i.tree.reorderChild(e, t);
|
|
19
|
+
if (!a.success) return a;
|
|
20
|
+
let o = i.host.listByRole(n.Tab).findIndex((t) => t.nodeId === e), s = i.host.listByRole(n.Panel)[o];
|
|
21
|
+
return s && await i.tree.reorderChild(s.nodeId, t), a;
|
|
22
|
+
}
|
|
23
|
+
case "removeTab": {
|
|
24
|
+
let e = String(r.nodeId ?? ""), t = i.host.listByRole(n.Tab), a = t.findIndex((t) => t.nodeId === e), o = i.host.listByRole(n.Panel)[a], s = await i.tree.removeRole(e);
|
|
25
|
+
if (!s.success) return s;
|
|
26
|
+
o && await i.tree.removeRole(o.nodeId);
|
|
27
|
+
let c = Math.max(0, Math.min(Number(i.logic.getEditorState().activeTabIndex ?? 0), Math.max(0, t.length - 2)));
|
|
28
|
+
return i.logic.setEditorState({ activeTabIndex: c });
|
|
29
|
+
}
|
|
30
|
+
case "addTab": {
|
|
31
|
+
let e = i.host.listByRole(n.Tab).length, t = await i.tree.addRole(n.Tab, { parentRole: n.TabList });
|
|
32
|
+
if (!t.success) return t;
|
|
33
|
+
let r = await i.tree.addRole(n.Panel, { parentRole: n.PanelList });
|
|
34
|
+
return r.success ? i.logic.setEditorState({ activeTabIndex: e }) : r;
|
|
35
|
+
}
|
|
36
|
+
case "setActiveTab": return i.logic.setEditorState({ activeTabIndex: Number(r.index ?? 0) });
|
|
37
|
+
case "renameTab": {
|
|
38
|
+
let e = String(r.headerNodeId ?? ""), t = String(r.label ?? "");
|
|
39
|
+
return e ? i.tree.renameRoleNode(e, t) : {
|
|
40
|
+
success: !1,
|
|
41
|
+
message: "Tab header node id is required"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
default: return {
|
|
45
|
+
success: !1,
|
|
46
|
+
message: `Unsupported tab editor action: ${t}`
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
//#endregion
|
|
52
|
+
export { a as default };
|