@inpageedit/core 0.16.1 → 0.17.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/InPageEdit.js +1 -1
- package/dist/{PluginImagesUsed-DnPDXczO.js → PluginImagesUsed-D5O8t694.js} +2 -2
- package/dist/{PluginImagesUsed-DnPDXczO.js.map → PluginImagesUsed-D5O8t694.js.map} +1 -1
- package/dist/{PluginPrefSync-CDTFyM8g.js → PluginPrefSync-C8tb5SJJ.js} +2 -2
- package/dist/{PluginPrefSync-CDTFyM8g.js.map → PluginPrefSync-C8tb5SJJ.js.map} +1 -1
- package/dist/{PluginStoreApp-Bng4DFBZ.js → PluginStoreApp-CeKtXL3p.js} +2 -2
- package/dist/{PluginStoreApp-Bng4DFBZ.js.map → PluginStoreApp-CeKtXL3p.js.map} +1 -1
- package/dist/{PluginTemplatesUsed-oM_VzfbH.js → PluginTemplatesUsed-DYv_lbHw.js} +2 -2
- package/dist/{PluginTemplatesUsed-oM_VzfbH.js.map → PluginTemplatesUsed-DYv_lbHw.js.map} +1 -1
- package/dist/core.js +2 -2
- package/dist/{index-42B3CrSO.js → index--IhZKYnh.js} +3 -3
- package/dist/index--IhZKYnh.js.map +1 -0
- package/dist/{index-Bn6y0Eln.js → index-Bf6ewNGZ.js} +101 -113
- package/dist/{index-Bn6y0Eln.js.map → index-Bf6ewNGZ.js.map} +1 -1
- package/dist/{index-BBUv7Lv6.js → index-BuSA1t5R.js} +2 -2
- package/dist/{index-BBUv7Lv6.js.map → index-BuSA1t5R.js.map} +1 -1
- package/dist/{index-D7rUF8vA.js → index-CaTtMzfu.js} +578 -501
- package/dist/index-CaTtMzfu.js.map +1 -0
- package/dist/{index-1sZXko-X.js → index-CxjH0_fO.js} +2 -2
- package/dist/{index-1sZXko-X.js.map → index-CxjH0_fO.js.map} +1 -1
- package/dist/{index-DlCbsA25.js → index-DSh05RaI.js} +3 -3
- package/dist/{index-DlCbsA25.js.map → index-DSh05RaI.js.map} +1 -1
- package/dist/{index-mf_pX14E.js → index-Dp_n8QEV.js} +2 -2
- package/dist/{index-mf_pX14E.js.map → index-Dp_n8QEV.js.map} +1 -1
- package/dist/{index-TG_MTC9y.js → index-Mi3qr9J0.js} +2 -2
- package/dist/{index-TG_MTC9y.js.map → index-Mi3qr9J0.js.map} +1 -1
- package/dist/{index-BllIuJSJ.js → index-QtXlz9l0.js} +3 -3
- package/dist/{index-BllIuJSJ.js.map → index-QtXlz9l0.js.map} +1 -1
- package/dist/{index-BcTomMXW.js → index-_Sydb5MZ.js} +391 -356
- package/dist/index-_Sydb5MZ.js.map +1 -0
- package/dist/{index-CkSHCMRN.js → index-fa8d4Dv_.js} +2 -2
- package/dist/{index-CkSHCMRN.js.map → index-fa8d4Dv_.js.map} +1 -1
- package/dist/{index-CN7r2e0P.js → index-h57rl1RH.js} +11 -11
- package/dist/index-h57rl1RH.js.map +1 -0
- package/dist/{index-CMmEZcB1.js → index-qbW7-LUD.js} +3 -3
- package/dist/index-qbW7-LUD.js.map +1 -0
- package/dist/index.d.ts +77 -39
- package/dist/index.js +2 -2
- package/dist/plugins/index.js +12 -12
- package/dist/services/index.js +14 -12
- package/dist/style.css +1 -1
- package/lib/index.umd.js +15 -15
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +2 -2
- package/dist/index-42B3CrSO.js.map +0 -1
- package/dist/index-BcTomMXW.js.map +0 -1
- package/dist/index-CMmEZcB1.js.map +0 -1
- package/dist/index-CN7r2e0P.js.map +0 -1
- package/dist/index-D7rUF8vA.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { j as _, P as
|
|
2
|
-
import { S as
|
|
3
|
-
import { a as
|
|
1
|
+
import { j as _, P as Le, F as Ae } from "./Promise.withResolvers-C4chhLB1.js";
|
|
2
|
+
import { S as Pe, a as Ie } from "./index-CaTtMzfu.js";
|
|
3
|
+
import { a as oe, m as ae, u as se, b as le, e as D, o as Me, f as ce, g as Fe, w as K, n as B, h as I, i as je, j as Re, t as De, k as Te, s as Oe, r as q, l as G, p as qe, q as H, v as J, F as He, x as Ue, y as Be, z as ne, A as Ve, B as re, c as ze } from "./vueHooks-Bs93iP61.js";
|
|
4
4
|
import { n as Ge } from "./noop-ClDc6zv4.js";
|
|
5
5
|
import { _ as Je } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
-
import { BasePlugin as
|
|
7
|
-
const
|
|
6
|
+
import { BasePlugin as Ke } from "./core.js";
|
|
7
|
+
const w = '@charset "UTF-8";:host{display:block;font-family:var(--schema-font-family, ui-sans-serif, system-ui, -apple-system);color:var(--schema-color-fg, #111827)}*,*:before,*:after{box-sizing:border-box}.wrapper{display:block;background:var(--schema-color-bg, #ffffff)}.form{display:grid;gap:12px}.field{display:grid;gap:6px;padding:8px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);border-radius:var(--schema-radius, 10px);background:var(--schema-surface, #fff)}.label{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.input,select,textarea{width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-input-bg, #fff);color:inherit}.checkbox{display:inline-flex;align-items:center;gap:8px}.helper{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.row{display:grid;gap:8px}.actions{display:flex;gap:8px}.btn{padding:6px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-btn-bg, #f8fafc);border-radius:8px;cursor:pointer;color:var(--schema-color-fg)}.btn.primary{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent}.btn:disabled{opacity:.5;cursor:not-allowed}.btn.danger{background:var(--schema-color-danger, #dc2626);color:#fff;border-color:transparent}.group{display:grid;gap:10px}.kv{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:center}.badge{display:inline-flex;padding:2px 6px;border-radius:999px;font-size:11px;background:var(--schema-badge-bg, #eef2ff);color:var(--schema-badge-fg, #4f46e5)}.hidden{display:none!important}.toolbar{display:flex;gap:6px}.schema-collection-row{position:relative;transition:transform var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease),opacity var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease)}.schema-collection-row.enter{opacity:0}.schema-collection-row.enter.enter-active{opacity:1}.schema-collection-row.leaving{opacity:0}.field.schema-type-array .group,.field.schema-type-array .group .row{position:relative}.keyshortcut-wrap{display:flex;gap:.5em;align-items:center}.keyshortcut-btn{padding:6px 8px;font-size:1em}.keyshortcut-btn.recording{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent;animation:keyshortcut-pulse .5s ease-in-out infinite}@keyframes keyshortcut-pulse{0%,to{opacity:1}50%{opacity:.6}}', ue = {
|
|
8
8
|
arrayAdd: "+",
|
|
9
9
|
arrayMoveUp: "↑",
|
|
10
10
|
arrayMoveDown: "↓",
|
|
@@ -14,35 +14,35 @@ const k = '@charset "UTF-8";:host{display:block;font-family:var(--schema-font-fa
|
|
|
14
14
|
rootLabel: "root"
|
|
15
15
|
}, b = (n, e) => {
|
|
16
16
|
customElements.get(n) || customElements.define(n, e);
|
|
17
|
-
},
|
|
17
|
+
}, We = (n, e, s) => {
|
|
18
18
|
if (!e.length) return;
|
|
19
|
-
let a = n, t = null,
|
|
19
|
+
let a = n, t = null, i = null;
|
|
20
20
|
for (let o = 0; o < e.length - 1; o++) {
|
|
21
21
|
const c = e[o];
|
|
22
22
|
let h = a?.[c];
|
|
23
|
-
h == null ? (h = typeof e[o + 1] == "number" ? [] : {}, a[c] = h) : typeof h != "object" && (h = typeof e[o + 1] == "number" ? [] : {}, a[c] = h), t = a,
|
|
23
|
+
h == null ? (h = typeof e[o + 1] == "number" ? [] : {}, a[c] = h) : typeof h != "object" && (h = typeof e[o + 1] == "number" ? [] : {}, a[c] = h), t = a, i = c, a = h;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const r = e[e.length - 1];
|
|
26
26
|
if (a == null || typeof a != "object") {
|
|
27
|
-
const o = typeof
|
|
27
|
+
const o = typeof r == "number" ? [] : {};
|
|
28
28
|
if (t)
|
|
29
|
-
t[
|
|
29
|
+
t[i] = o, a = o;
|
|
30
30
|
else
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
try {
|
|
34
|
-
a[
|
|
34
|
+
a[r] = s;
|
|
35
35
|
} catch {
|
|
36
36
|
try {
|
|
37
37
|
const o = Array.isArray(a) ? a.slice() : { ...a };
|
|
38
|
-
o[
|
|
38
|
+
o[r] = s, t && (t[i] = o);
|
|
39
39
|
} catch {
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, O = (n) => n.map(String).join("."), Qe = (n) => n.replace(/[^a-zA-Z0-9_-]/g, "_"), A = (n) => `schema_${Qe(O(n) || "root")}`, j = (n) => O(n), f = (n, ...e) => {
|
|
43
43
|
const s = new Set(e);
|
|
44
44
|
s.size && n.setAttribute("part", Array.from(s).join(" "));
|
|
45
|
-
},
|
|
45
|
+
}, Xe = [
|
|
46
46
|
"wrapper",
|
|
47
47
|
"form",
|
|
48
48
|
"field",
|
|
@@ -122,10 +122,10 @@ function de(n) {
|
|
|
122
122
|
function N(n) {
|
|
123
123
|
return n?.meta ?? {};
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Ye(n) {
|
|
126
126
|
return n.length > 0 && n.every((e) => e?.type === "const");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function R(n) {
|
|
129
129
|
if (!n) return;
|
|
130
130
|
const e = n, s = e.meta || {};
|
|
131
131
|
if (Object.prototype.hasOwnProperty.call(s, "default")) return s.default;
|
|
@@ -154,26 +154,26 @@ function j(n) {
|
|
|
154
154
|
return {};
|
|
155
155
|
case "union": {
|
|
156
156
|
const t = e.list || [];
|
|
157
|
-
return t.length ?
|
|
157
|
+
return t.length ? R(t[0]) : void 0;
|
|
158
158
|
}
|
|
159
159
|
case "const":
|
|
160
160
|
return e.value;
|
|
161
161
|
case "date":
|
|
162
162
|
return;
|
|
163
163
|
case "intersect": {
|
|
164
|
-
const t = e.list || [],
|
|
164
|
+
const t = e.list || [], i = (o, c) => {
|
|
165
165
|
if (Array.isArray(o) && Array.isArray(c)) return c.slice();
|
|
166
166
|
if (o && c && typeof o == "object" && typeof c == "object") {
|
|
167
167
|
const h = { ...o };
|
|
168
168
|
for (const l of Object.keys(c))
|
|
169
|
-
h[l] = l in h ?
|
|
169
|
+
h[l] = l in h ? i(h[l], c[l]) : c[l];
|
|
170
170
|
return h;
|
|
171
171
|
}
|
|
172
172
|
return c ?? o;
|
|
173
173
|
};
|
|
174
|
-
let
|
|
175
|
-
for (const o of t)
|
|
176
|
-
return
|
|
174
|
+
let r = {};
|
|
175
|
+
for (const o of t) r = i(r, R(o));
|
|
176
|
+
return r;
|
|
177
177
|
}
|
|
178
178
|
default:
|
|
179
179
|
return;
|
|
@@ -181,20 +181,20 @@ function j(n) {
|
|
|
181
181
|
}
|
|
182
182
|
class S extends HTMLElement {
|
|
183
183
|
constructor() {
|
|
184
|
-
super(), this._path = [], this._i18n =
|
|
184
|
+
super(), this._path = [], this._i18n = ue, this.$root = this.attachShadow({ mode: "open" });
|
|
185
185
|
const e = document.createElement("style");
|
|
186
|
-
e.textContent =
|
|
186
|
+
e.textContent = w, this.$root.appendChild(e);
|
|
187
187
|
}
|
|
188
188
|
/** 初始化公共容器(带类名与 data-path) */
|
|
189
189
|
makeFieldContainer(e, s) {
|
|
190
190
|
const a = document.createElement("div");
|
|
191
|
-
if (a.className = `field schema-form-item schema-type-${e}`, a.setAttribute("data-path",
|
|
191
|
+
if (a.className = `field schema-form-item schema-type-${e}`, a.setAttribute("data-path", O(this._path)), f(a, "field", `field-${e}`), this._label) {
|
|
192
192
|
const t = document.createElement("label");
|
|
193
|
-
t.className = "label", t.textContent = this._label,
|
|
193
|
+
t.className = "label", t.textContent = this._label, f(t, "field-label"), a.appendChild(t);
|
|
194
194
|
}
|
|
195
195
|
if (s && s !== this._label) {
|
|
196
196
|
const t = document.createElement("div");
|
|
197
|
-
t.className = "helper", t.textContent = s,
|
|
197
|
+
t.className = "helper", t.textContent = s, f(t, "field-helper"), a.appendChild(t);
|
|
198
198
|
}
|
|
199
199
|
return a;
|
|
200
200
|
}
|
|
@@ -240,113 +240,148 @@ class S extends HTMLElement {
|
|
|
240
240
|
);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
class
|
|
243
|
+
class F extends S {
|
|
244
|
+
static {
|
|
245
|
+
this.recEnd = null;
|
|
246
|
+
}
|
|
244
247
|
render() {
|
|
245
248
|
if (this.$input && this.$root.contains(this.$input)) {
|
|
246
|
-
const
|
|
247
|
-
if (!(this._label && !
|
|
248
|
-
const
|
|
249
|
-
this.$input.value !==
|
|
249
|
+
const i = !!this.$root.querySelector("label.label");
|
|
250
|
+
if (!(this._label && !i)) {
|
|
251
|
+
const r = this._value ?? "";
|
|
252
|
+
this.$input.value !== r && document.activeElement !== this.$input && (this.$input.value = r);
|
|
250
253
|
return;
|
|
251
254
|
}
|
|
252
255
|
}
|
|
253
|
-
this.$root.innerHTML = `<style>${
|
|
256
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
254
257
|
const e = N(this._schema), s = this.makeFieldContainer("string", e.description), a = document.createElement("input");
|
|
255
|
-
this.$input = a, a.className = "input",
|
|
258
|
+
this.$input = a, a.className = "input", f(a, "field-input", "field-input-text"), a.type = "text", a.name = j(this._path), a.id = A(this._path), e?.pattern?.source && (a.pattern = e.pattern.source), e?.max != null && (a.maxLength = e.max), a.value = this._value ?? "", a.oninput = () => this.emitChange(X("string", a.value));
|
|
256
259
|
const t = s.querySelector("label.label");
|
|
257
|
-
t && (t.htmlFor = a.id),
|
|
260
|
+
if (t && (t.htmlFor = a.id), e.role === "keyshortcut") {
|
|
261
|
+
const i = document.createElement("div");
|
|
262
|
+
i.className = "keyshortcut-wrap";
|
|
263
|
+
const r = document.createElement("button");
|
|
264
|
+
r.type = "button", r.className = "btn keyshortcut-btn", r.title = "Record shortcut", r.textContent = "⌨";
|
|
265
|
+
let o = null;
|
|
266
|
+
const c = () => {
|
|
267
|
+
o && (o(), o = null, r.classList.remove("recording"), r.title = "Record shortcut", F.recEnd === c && (F.recEnd = null));
|
|
268
|
+
};
|
|
269
|
+
r.onclick = () => {
|
|
270
|
+
if (o) {
|
|
271
|
+
c();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
F.recEnd?.(), F.recEnd = c, r.classList.add("recording"), r.title = "Press your keys! (Esc to cancel)";
|
|
275
|
+
const h = (l) => {
|
|
276
|
+
if (l.preventDefault(), l.stopPropagation(), l.key === "Escape") {
|
|
277
|
+
c();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const m = [];
|
|
281
|
+
l.ctrlKey && m.push("ctrl"), l.metaKey && m.push("meta"), l.altKey && m.push("alt"), l.shiftKey && m.push("shift");
|
|
282
|
+
const d = l.key.toLowerCase();
|
|
283
|
+
if (["control", "meta", "alt", "shift"].includes(d)) return;
|
|
284
|
+
m.push(d);
|
|
285
|
+
const p = m.join("-"), u = a.value.trimEnd();
|
|
286
|
+
u.toLowerCase().split(/\s*,\s*/).includes(p) || (a.value = u ? u.replace(/,+$/, "") + ", " + p : p, this.emitChange(a.value)), c();
|
|
287
|
+
};
|
|
288
|
+
document.addEventListener("keydown", h, { capture: !0 }), o = () => document.removeEventListener("keydown", h, { capture: !0 });
|
|
289
|
+
}, i.appendChild(a), i.appendChild(r), s.appendChild(i);
|
|
290
|
+
} else
|
|
291
|
+
s.appendChild(a);
|
|
292
|
+
this.$root.appendChild(s);
|
|
258
293
|
}
|
|
259
294
|
}
|
|
260
|
-
b("schema-form-string",
|
|
295
|
+
b("schema-form-string", F);
|
|
261
296
|
class he extends S {
|
|
262
297
|
render() {
|
|
263
298
|
if (this.$input && this.$root.contains(this.$input)) {
|
|
264
|
-
const
|
|
265
|
-
if (!(this._label && !
|
|
299
|
+
const r = !!this.$root.querySelector("label.label");
|
|
300
|
+
if (!(this._label && !r)) {
|
|
266
301
|
const o = this._value ?? "";
|
|
267
302
|
this.$input.value !== String(o) && document.activeElement !== this.$input && (this.$input.value = o);
|
|
268
303
|
return;
|
|
269
304
|
}
|
|
270
305
|
}
|
|
271
|
-
this.$root.innerHTML = `<style>${
|
|
306
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
272
307
|
const e = this._schema?.type ?? "number", s = N(this._schema), a = this.makeFieldContainer("number", s.description), t = document.createElement("input");
|
|
273
|
-
this.$input = t, t.className = "input",
|
|
274
|
-
const
|
|
275
|
-
|
|
308
|
+
this.$input = t, t.className = "input", f(t, "field-input", "field-input-number"), t.name = j(this._path), t.id = A(this._path), s?.min != null && (t.min = String(s.min)), s?.max != null && (t.max = String(s.max)), s?.step != null && (t.step = String(s.step)), e === "percent" && !t.step && (t.step = "0.01"), t.value = this._value ?? "", t.oninput = () => this.emitChange(X(e, t.value));
|
|
309
|
+
const i = a.querySelector("label.label");
|
|
310
|
+
i && (i.htmlFor = t.id), s.role === "slider" ? t.type = "range" : t.type = "number", a.appendChild(t), this.$root.appendChild(a);
|
|
276
311
|
}
|
|
277
312
|
}
|
|
278
313
|
b("schema-form-number", he);
|
|
279
314
|
class me extends S {
|
|
280
315
|
render() {
|
|
281
|
-
this.$root.innerHTML = `<style>${
|
|
316
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
282
317
|
const e = N(this._schema), s = this.makeFieldContainer("boolean", e.description), a = document.createElement("label");
|
|
283
|
-
a.className = "checkbox",
|
|
318
|
+
a.className = "checkbox", f(a, "field-checkbox");
|
|
284
319
|
const t = document.createElement("input");
|
|
285
|
-
t.type = "checkbox", t.checked = !!this._value, t.name =
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
|
|
320
|
+
t.type = "checkbox", t.checked = !!this._value, t.name = j(this._path), t.id = A(this._path), f(t, "field-input", "field-input-checkbox");
|
|
321
|
+
const i = document.createElement("span");
|
|
322
|
+
i.textContent = e.description ?? this._label ?? "", f(i, "field-checkbox-text"), t.onchange = () => this.emitChange(t.checked);
|
|
323
|
+
const r = s.querySelector("label.label");
|
|
324
|
+
r && (r.htmlFor = t.id), a.append(t, i), s.appendChild(a), this.$root.appendChild(s);
|
|
290
325
|
}
|
|
291
326
|
}
|
|
292
327
|
b("schema-form-boolean", me);
|
|
293
|
-
function
|
|
328
|
+
function V(n) {
|
|
294
329
|
return String(n).padStart(2, "0");
|
|
295
330
|
}
|
|
296
|
-
function
|
|
297
|
-
return `${n.getFullYear()}-${
|
|
331
|
+
function T(n) {
|
|
332
|
+
return `${n.getFullYear()}-${V(n.getMonth() + 1)}-${V(n.getDate())}`;
|
|
298
333
|
}
|
|
299
334
|
function W(n) {
|
|
300
|
-
return `${
|
|
335
|
+
return `${V(n.getHours())}:${V(n.getMinutes())}`;
|
|
301
336
|
}
|
|
302
|
-
function
|
|
303
|
-
return `${
|
|
337
|
+
function U(n) {
|
|
338
|
+
return `${T(n)}T${W(n)}`;
|
|
304
339
|
}
|
|
305
340
|
class pe extends S {
|
|
306
341
|
render() {
|
|
307
342
|
if (this.$input && this.$root.contains(this.$input)) {
|
|
308
|
-
const
|
|
309
|
-
if (!(this._label && !
|
|
343
|
+
const r = !!this.$root.querySelector("label.label");
|
|
344
|
+
if (!(this._label && !r)) {
|
|
310
345
|
const o = N(this._schema).role || "date";
|
|
311
346
|
if (document.activeElement !== this.$input)
|
|
312
347
|
if (this._value instanceof Date)
|
|
313
|
-
o === "date" ? this.$input.value =
|
|
348
|
+
o === "date" ? this.$input.value = T(this._value) : o === "time" ? this.$input.value = W(this._value) : o === "datetime" && (this.$input.value = U(this._value));
|
|
314
349
|
else if (typeof this._value == "string" && o !== "time") {
|
|
315
350
|
const c = new Date(this._value);
|
|
316
|
-
isNaN(+c) || (o === "date" ? this.$input.value =
|
|
351
|
+
isNaN(+c) || (o === "date" ? this.$input.value = T(c) : o === "datetime" && (this.$input.value = U(c)));
|
|
317
352
|
} else this._value || (this.$input.value = "");
|
|
318
353
|
return;
|
|
319
354
|
}
|
|
320
355
|
}
|
|
321
|
-
this.$root.innerHTML = `<style>${
|
|
356
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
322
357
|
const e = N(this._schema), s = this.makeFieldContainer("date", e.description), a = document.createElement("input");
|
|
323
|
-
this.$input = a, a.className = "input",
|
|
358
|
+
this.$input = a, a.className = "input", f(a, "field-input", "field-input-date");
|
|
324
359
|
const t = e.role || "date";
|
|
325
|
-
if (t === "datetime" ? a.type = "datetime-local" : t === "time" ? a.type = "time" : a.type = "date", a.name =
|
|
326
|
-
t === "date" ? a.value =
|
|
360
|
+
if (t === "datetime" ? a.type = "datetime-local" : t === "time" ? a.type = "time" : a.type = "date", a.name = j(this._path), a.id = A(this._path), this._value instanceof Date)
|
|
361
|
+
t === "date" ? a.value = T(this._value) : t === "time" ? a.value = W(this._value) : t === "datetime" && (a.value = U(this._value));
|
|
327
362
|
else if (typeof this._value == "string" && t !== "time") {
|
|
328
|
-
const
|
|
329
|
-
isNaN(+
|
|
363
|
+
const r = new Date(this._value);
|
|
364
|
+
isNaN(+r) || (t === "date" ? a.value = T(r) : t === "datetime" && (a.value = U(r)));
|
|
330
365
|
}
|
|
331
366
|
a.oninput = () => {
|
|
332
367
|
e.role;
|
|
333
|
-
let
|
|
368
|
+
let r;
|
|
334
369
|
if (!a.value)
|
|
335
|
-
|
|
370
|
+
r = void 0;
|
|
336
371
|
else {
|
|
337
372
|
const o = new Date(a.value);
|
|
338
|
-
|
|
373
|
+
r = Number.isNaN(+o) ? void 0 : o;
|
|
339
374
|
}
|
|
340
|
-
this.emitChange(
|
|
375
|
+
this.emitChange(r);
|
|
341
376
|
};
|
|
342
|
-
const
|
|
343
|
-
|
|
377
|
+
const i = s.querySelector("label.label");
|
|
378
|
+
i && (i.htmlFor = a.id), s.appendChild(a), this.$root.appendChild(s);
|
|
344
379
|
}
|
|
345
380
|
}
|
|
346
381
|
b("schema-form-date", pe);
|
|
347
382
|
class Y extends S {
|
|
348
383
|
render() {
|
|
349
|
-
this.$root.innerHTML = `<style>${
|
|
384
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
350
385
|
const e = N(this._schema), s = this._schema.value;
|
|
351
386
|
if (e.role === "raw-html") {
|
|
352
387
|
if (s instanceof Node) {
|
|
@@ -356,47 +391,47 @@ class Y extends S {
|
|
|
356
391
|
this.$root.append(s());
|
|
357
392
|
return;
|
|
358
393
|
} else if (typeof s == "string") {
|
|
359
|
-
const
|
|
360
|
-
|
|
394
|
+
const r = document.createElement("div");
|
|
395
|
+
r.innerHTML = String(s), f(r, "field-const-value"), this.$root.appendChild(r);
|
|
361
396
|
return;
|
|
362
397
|
}
|
|
363
398
|
}
|
|
364
399
|
const a = this.makeFieldContainer("const", e.description), t = document.createElement("section");
|
|
365
|
-
t.className = "const content", t.textContent = String(s), t.id =
|
|
366
|
-
const
|
|
367
|
-
|
|
400
|
+
t.className = "const content", t.textContent = String(s), t.id = A(this._path), f(t, "field-const-value");
|
|
401
|
+
const i = a.querySelector("label.label");
|
|
402
|
+
i && (i.htmlFor = t.id), a.appendChild(t), this.$root.appendChild(a);
|
|
368
403
|
}
|
|
369
404
|
}
|
|
370
405
|
b("schema-form-const", Y);
|
|
371
406
|
class fe extends S {
|
|
372
407
|
render() {
|
|
373
|
-
this.$root.innerHTML = `<style>${
|
|
408
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
374
409
|
const e = N(this._schema), s = this.makeFieldContainer("intersect", e.description);
|
|
375
410
|
s.classList.remove("field");
|
|
376
411
|
const a = document.createElement("div");
|
|
377
|
-
a.classList.add("group"),
|
|
378
|
-
const t = this._schema.list || [],
|
|
412
|
+
a.classList.add("group"), f(a, "field-group");
|
|
413
|
+
const t = this._schema.list || [], i = t.length > 0 && t.every((o) => o?.type === "object"), r = (o, c) => {
|
|
379
414
|
if (Array.isArray(o) && Array.isArray(c)) return c.slice();
|
|
380
415
|
if (o && c && typeof o == "object" && typeof c == "object") {
|
|
381
416
|
const h = { ...o };
|
|
382
417
|
for (const l of Object.keys(c))
|
|
383
|
-
h[l] = l in h ?
|
|
418
|
+
h[l] = l in h ? r(h[l], c[l]) : c[l];
|
|
384
419
|
return h;
|
|
385
420
|
}
|
|
386
421
|
return c ?? o;
|
|
387
422
|
};
|
|
388
|
-
if (
|
|
423
|
+
if (i) {
|
|
389
424
|
const o = this._value && typeof this._value == "object" ? this._value : {};
|
|
390
425
|
t.forEach((c, h) => {
|
|
391
|
-
const l = c?.meta?.description ?? "", m =
|
|
392
|
-
m.addEventListener("change", (
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
this.emitChange(
|
|
426
|
+
const l = c?.meta?.description ?? "", m = P(c, this._path, o, l, this._i18n);
|
|
427
|
+
m.addEventListener("change", (d) => {
|
|
428
|
+
d.stopPropagation();
|
|
429
|
+
const p = r(this._value ?? {}, d.detail.value);
|
|
430
|
+
this.emitChange(p);
|
|
396
431
|
}), a.appendChild(m);
|
|
397
432
|
});
|
|
398
433
|
} else {
|
|
399
|
-
const o = t[t.length - 1], c =
|
|
434
|
+
const o = t[t.length - 1], c = P(o, this._path, this._value, this._label, this._i18n);
|
|
400
435
|
c.addEventListener("change", (h) => {
|
|
401
436
|
h.stopPropagation(), this.emitChange(h.detail.value);
|
|
402
437
|
}), a.appendChild(c);
|
|
@@ -405,7 +440,7 @@ class fe extends S {
|
|
|
405
440
|
}
|
|
406
441
|
}
|
|
407
442
|
b("schema-form-intersect", fe);
|
|
408
|
-
function
|
|
443
|
+
function Ze(n) {
|
|
409
444
|
switch (n.type) {
|
|
410
445
|
case "intersect":
|
|
411
446
|
return "schema-form-intersect";
|
|
@@ -437,45 +472,45 @@ function Ke(n) {
|
|
|
437
472
|
return "schema-form-string";
|
|
438
473
|
}
|
|
439
474
|
}
|
|
440
|
-
function
|
|
441
|
-
const
|
|
442
|
-
return
|
|
475
|
+
function P(n, e, s, a, t) {
|
|
476
|
+
const i = Ze(n), r = document.createElement(i);
|
|
477
|
+
return r.schema = n, r.path = e, r.label = a, t && (r.i18n = t), r.setValue?.(s), r.setAttribute("exportparts", Xe), r;
|
|
443
478
|
}
|
|
444
479
|
class ve extends S {
|
|
445
480
|
render() {
|
|
446
|
-
this.$root.innerHTML = `<style>${
|
|
481
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
447
482
|
const e = N(this._schema), s = this.makeFieldContainer("union", e.description), a = this._schema.list || [];
|
|
448
|
-
if (
|
|
483
|
+
if (Ye(a)) {
|
|
449
484
|
const t = document.createElement("select");
|
|
450
|
-
t.className = "input",
|
|
485
|
+
t.className = "input", f(t, "field-input", "field-input-select"), t.name = j(this._path), t.id = A(this._path), a.forEach((r) => {
|
|
451
486
|
const o = document.createElement("option");
|
|
452
|
-
o.value = String(
|
|
487
|
+
o.value = String(r.value), o.textContent = String(r.meta?.description || r.value || r.type), this._value === r.value && (o.selected = !0), t.appendChild(o);
|
|
453
488
|
}), t.onchange = () => this.emitChange(X("string", t.value));
|
|
454
|
-
const
|
|
455
|
-
|
|
489
|
+
const i = s.querySelector("label.label");
|
|
490
|
+
i && (i.htmlFor = t.id), s.appendChild(t);
|
|
456
491
|
} else {
|
|
457
492
|
const t = document.createElement("div");
|
|
458
|
-
t.className = "toolbar",
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
let
|
|
493
|
+
t.className = "toolbar", f(t, "field-toolbar");
|
|
494
|
+
const i = document.createElement("select");
|
|
495
|
+
i.className = "input", f(i, "field-input", "field-input-select", "field-toolbar-select"), i.name = j(this._path) + ".__type", i.id = A(this._path) + "__type";
|
|
496
|
+
let r = 0;
|
|
462
497
|
a.forEach((l, m) => {
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
}),
|
|
466
|
-
|
|
467
|
-
const l = a[
|
|
498
|
+
const d = document.createElement("option");
|
|
499
|
+
d.value = String(m), d.textContent = String(l.meta?.description || l.value || l.type), i.appendChild(d);
|
|
500
|
+
}), i.onchange = () => {
|
|
501
|
+
r = Number(i.value);
|
|
502
|
+
const l = a[r], m = R(l);
|
|
468
503
|
this.emitChange(m), h();
|
|
469
504
|
};
|
|
470
505
|
const o = s.querySelector("label.label");
|
|
471
|
-
o && (o.htmlFor =
|
|
506
|
+
o && (o.htmlFor = i.id), t.appendChild(i), s.appendChild(t);
|
|
472
507
|
const c = document.createElement("div");
|
|
473
|
-
c.className = "group",
|
|
508
|
+
c.className = "group", f(c, "field-group");
|
|
474
509
|
const h = () => {
|
|
475
510
|
c.innerHTML = "";
|
|
476
|
-
const l = a[
|
|
477
|
-
m instanceof Y || (m.addEventListener("change", (
|
|
478
|
-
|
|
511
|
+
const l = a[r], m = P(l, this._path, this._value, this._label);
|
|
512
|
+
m instanceof Y || (m.addEventListener("change", (d) => {
|
|
513
|
+
d.stopPropagation(), this.emitChange(d.detail.value);
|
|
479
514
|
}), c.appendChild(m));
|
|
480
515
|
};
|
|
481
516
|
h(), s.appendChild(c);
|
|
@@ -486,21 +521,21 @@ class ve extends S {
|
|
|
486
521
|
b("schema-form-union", ve);
|
|
487
522
|
class ge extends S {
|
|
488
523
|
render() {
|
|
489
|
-
this.$root.innerHTML = `<style>${
|
|
524
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
490
525
|
const e = N(this._schema), s = this.makeFieldContainer("tuple", e.description), a = document.createElement("div");
|
|
491
|
-
a.className = "group",
|
|
526
|
+
a.className = "group", f(a, "field-group");
|
|
492
527
|
const t = Array.isArray(this._value) ? this._value : [];
|
|
493
|
-
(this._schema.list || []).forEach((
|
|
494
|
-
const o =
|
|
495
|
-
|
|
496
|
-
[...this._path,
|
|
497
|
-
t[
|
|
498
|
-
`${this._label ?? ""}[${
|
|
528
|
+
(this._schema.list || []).forEach((i, r) => {
|
|
529
|
+
const o = P(
|
|
530
|
+
i,
|
|
531
|
+
[...this._path, r],
|
|
532
|
+
t[r],
|
|
533
|
+
`${this._label ?? ""}[${r}]`
|
|
499
534
|
);
|
|
500
535
|
o.addEventListener("change", (c) => {
|
|
501
536
|
c.stopPropagation();
|
|
502
537
|
const h = Array.isArray(this._value) ? this._value.slice() : [];
|
|
503
|
-
h[
|
|
538
|
+
h[r] = c.detail.value, this.emitChange(h);
|
|
504
539
|
}), a.appendChild(o);
|
|
505
540
|
}), s.appendChild(a), this.$root.appendChild(s);
|
|
506
541
|
}
|
|
@@ -508,23 +543,23 @@ class ge extends S {
|
|
|
508
543
|
b("schema-form-tuple", ge);
|
|
509
544
|
class _e extends S {
|
|
510
545
|
render() {
|
|
511
|
-
this.$root.innerHTML = `<style>${
|
|
546
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
512
547
|
const e = N(this._schema), s = this.makeFieldContainer("object", e.description), a = document.createElement("div");
|
|
513
|
-
a.className = "group",
|
|
548
|
+
a.className = "group", f(a, "field-group");
|
|
514
549
|
const t = this._schema.dict || {};
|
|
515
|
-
Object.keys(t).forEach((
|
|
516
|
-
if (t[
|
|
517
|
-
const
|
|
550
|
+
Object.keys(t).forEach((i) => {
|
|
551
|
+
if (t[i]?.meta?.hidden) return;
|
|
552
|
+
const r = (this._value ?? {})[i], o = P(t[i], [...this._path, i], r, i);
|
|
518
553
|
o.addEventListener("change", (c) => {
|
|
519
554
|
c.stopPropagation();
|
|
520
555
|
const h = { ...this._value ?? {} };
|
|
521
|
-
h[
|
|
556
|
+
h[i] = c.detail.value, this.emitChange(h);
|
|
522
557
|
}), a.appendChild(o);
|
|
523
558
|
}), s.appendChild(a), this.$root.appendChild(s);
|
|
524
559
|
}
|
|
525
560
|
}
|
|
526
561
|
b("schema-form-object", _e);
|
|
527
|
-
class
|
|
562
|
+
class z extends S {
|
|
528
563
|
constructor() {
|
|
529
564
|
super(...arguments), this._itemIds = [];
|
|
530
565
|
}
|
|
@@ -537,7 +572,7 @@ class V extends S {
|
|
|
537
572
|
return crypto.randomUUID();
|
|
538
573
|
} catch {
|
|
539
574
|
}
|
|
540
|
-
return "i" +
|
|
575
|
+
return "i" + z._idCounter++;
|
|
541
576
|
}
|
|
542
577
|
ensureItemIds(e) {
|
|
543
578
|
for (; this._itemIds.length < e; ) this._itemIds.push(this.generateItemId());
|
|
@@ -555,169 +590,169 @@ class V extends S {
|
|
|
555
590
|
Array.from(e.querySelectorAll(".row")).forEach((a) => {
|
|
556
591
|
const t = a.dataset.uid;
|
|
557
592
|
if (!t) return;
|
|
558
|
-
const
|
|
559
|
-
if (!
|
|
560
|
-
const
|
|
593
|
+
const i = s[t];
|
|
594
|
+
if (!i) return;
|
|
595
|
+
const r = a.getBoundingClientRect(), o = i.left - r.left, c = i.top - r.top;
|
|
561
596
|
(o || c) && (a.style.transition = "none", a.style.transform = `translate(${o}px, ${c}px)`, requestAnimationFrame(() => {
|
|
562
597
|
a.style.transition = "transform .25s ease", a.style.transform = "";
|
|
563
598
|
}));
|
|
564
599
|
});
|
|
565
600
|
}
|
|
566
601
|
render() {
|
|
567
|
-
this.$root.innerHTML = `<style>${
|
|
602
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
568
603
|
const e = N(this._schema), s = this.makeFieldContainer("array", e.description), a = document.createElement("div");
|
|
569
|
-
a.className = "group",
|
|
570
|
-
const t = this._schema.inner,
|
|
571
|
-
this.ensureItemIds(
|
|
572
|
-
const
|
|
573
|
-
a.innerHTML = "",
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
const g = this._itemIds[
|
|
577
|
-
|
|
578
|
-
const v =
|
|
604
|
+
a.className = "group", f(a, "field-group");
|
|
605
|
+
const t = this._schema.inner, i = () => Array.isArray(this._value) ? this._value : [];
|
|
606
|
+
this.ensureItemIds(i().length);
|
|
607
|
+
const r = (h, l) => {
|
|
608
|
+
a.innerHTML = "", i().forEach((m, d) => {
|
|
609
|
+
const p = [...this._path, d], u = document.createElement("div");
|
|
610
|
+
u.className = "row schema-collection-row", f(u, "field-row", "collection-row");
|
|
611
|
+
const g = this._itemIds[d];
|
|
612
|
+
u.dataset.uid = g, u.setAttribute("data-path", O(p));
|
|
613
|
+
const v = P(
|
|
579
614
|
t,
|
|
580
|
-
|
|
615
|
+
p,
|
|
581
616
|
m,
|
|
582
|
-
`${this._label ?? ""}[${
|
|
617
|
+
`${this._label ?? ""}[${d}]`
|
|
583
618
|
);
|
|
584
|
-
v.addEventListener("change", (
|
|
585
|
-
|
|
586
|
-
const
|
|
587
|
-
|
|
619
|
+
v.addEventListener("change", (E) => {
|
|
620
|
+
E.stopPropagation();
|
|
621
|
+
const C = i().slice();
|
|
622
|
+
C[d] = E.detail.value, this._value = C, this.emitChange(C);
|
|
588
623
|
});
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
if (
|
|
594
|
-
const
|
|
595
|
-
[
|
|
596
|
-
this._itemIds[
|
|
597
|
-
this._itemIds[
|
|
598
|
-
], this._value =
|
|
624
|
+
const x = document.createElement("div");
|
|
625
|
+
x.className = "actions", f(x, "field-actions");
|
|
626
|
+
const k = document.createElement("button");
|
|
627
|
+
k.type = "button", k.className = "btn", f(k, "field-button", "field-button-secondary"), k.textContent = this._i18n.arrayMoveUp ?? "↑", k.onclick = () => {
|
|
628
|
+
if (d <= 0) return;
|
|
629
|
+
const E = this.capturePositions(a), C = i().slice();
|
|
630
|
+
[C[d - 1], C[d]] = [C[d], C[d - 1]], [this._itemIds[d - 1], this._itemIds[d]] = [
|
|
631
|
+
this._itemIds[d],
|
|
632
|
+
this._itemIds[d - 1]
|
|
633
|
+
], this._value = C, r(E), this.emitChange(C);
|
|
599
634
|
};
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
const
|
|
603
|
-
if (
|
|
604
|
-
const
|
|
605
|
-
[
|
|
606
|
-
this._itemIds[
|
|
607
|
-
this._itemIds[
|
|
608
|
-
], this._value =
|
|
635
|
+
const $ = document.createElement("button");
|
|
636
|
+
$.type = "button", $.className = "btn", f($, "field-button", "field-button-secondary"), $.textContent = this._i18n.arrayMoveDown ?? "↓", $.onclick = () => {
|
|
637
|
+
const E = i();
|
|
638
|
+
if (d >= E.length - 1) return;
|
|
639
|
+
const C = this.capturePositions(a), L = E.slice();
|
|
640
|
+
[L[d + 1], L[d]] = [L[d], L[d + 1]], [this._itemIds[d + 1], this._itemIds[d]] = [
|
|
641
|
+
this._itemIds[d],
|
|
642
|
+
this._itemIds[d + 1]
|
|
643
|
+
], this._value = L, r(C), this.emitChange(L);
|
|
609
644
|
};
|
|
610
645
|
const y = document.createElement("button");
|
|
611
|
-
y.type = "button", y.className = "btn danger",
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
let
|
|
615
|
-
const
|
|
616
|
-
if (
|
|
617
|
-
|
|
618
|
-
const
|
|
619
|
-
this._itemIds.splice(
|
|
646
|
+
y.type = "button", y.className = "btn danger", f(y, "field-button", "field-button-danger"), y.textContent = this._i18n.arrayRemove ?? "×", y.onclick = () => {
|
|
647
|
+
u.classList.add("leaving");
|
|
648
|
+
const E = 250;
|
|
649
|
+
let C = !1;
|
|
650
|
+
const L = () => {
|
|
651
|
+
if (C) return;
|
|
652
|
+
C = !0, clearTimeout(we);
|
|
653
|
+
const te = i().filter((Ct, Se) => Se !== d);
|
|
654
|
+
this._itemIds.splice(d, 1);
|
|
620
655
|
const Ne = this.capturePositions(a);
|
|
621
|
-
this._value =
|
|
656
|
+
this._value = te, r(Ne), this.emitChange(te);
|
|
622
657
|
};
|
|
623
|
-
|
|
624
|
-
const
|
|
625
|
-
},
|
|
626
|
-
|
|
658
|
+
u.addEventListener("transitionend", L, { once: !0 });
|
|
659
|
+
const we = setTimeout(L, E + 80);
|
|
660
|
+
}, x.append(k, $, y), u.appendChild(v), u.appendChild(x), a.appendChild(u), l && l === g && (u.classList.add("enter"), requestAnimationFrame(() => {
|
|
661
|
+
u.classList.add("enter-active");
|
|
627
662
|
}), requestAnimationFrame(() => {
|
|
628
|
-
|
|
663
|
+
u.classList.remove("enter");
|
|
629
664
|
}));
|
|
630
665
|
}), h && this.playFLIP(a, h);
|
|
631
666
|
};
|
|
632
|
-
|
|
667
|
+
r();
|
|
633
668
|
const o = document.createElement("button");
|
|
634
|
-
o.type = "button", o.className = "btn primary",
|
|
635
|
-
const h = this.capturePositions(a), l =
|
|
669
|
+
o.type = "button", o.className = "btn primary", f(o, "field-button", "field-button-primary"), o.textContent = this._i18n.arrayAdd ?? "+", o.onclick = () => {
|
|
670
|
+
const h = this.capturePositions(a), l = i().slice(), m = R(t);
|
|
636
671
|
l.push(m);
|
|
637
|
-
const
|
|
638
|
-
this._itemIds.push(
|
|
672
|
+
const d = this.generateItemId();
|
|
673
|
+
this._itemIds.push(d), this._value = l, r(h, d), this.emitChange(l);
|
|
639
674
|
};
|
|
640
675
|
const c = document.createElement("div");
|
|
641
|
-
c.className = "actions",
|
|
676
|
+
c.className = "actions", f(c, "field-actions"), c.appendChild(o), s.appendChild(a), s.appendChild(c), this.$root.appendChild(s);
|
|
642
677
|
}
|
|
643
678
|
}
|
|
644
|
-
b("schema-form-array",
|
|
679
|
+
b("schema-form-array", z);
|
|
645
680
|
class be extends S {
|
|
646
681
|
render() {
|
|
647
|
-
this.$root.innerHTML = `<style>${
|
|
682
|
+
this.$root.innerHTML = `<style>${w}</style>`;
|
|
648
683
|
const e = N(this._schema), s = this.makeFieldContainer("dict", e.description), a = document.createElement("div");
|
|
649
|
-
a.className = "group",
|
|
650
|
-
const t = this._schema.inner,
|
|
651
|
-
const
|
|
652
|
-
return a.querySelectorAll(".kv").forEach((
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
}),
|
|
656
|
-
}, c = (
|
|
657
|
-
a.querySelectorAll(".kv").forEach((
|
|
658
|
-
const
|
|
659
|
-
if (!
|
|
660
|
-
const g = u
|
|
684
|
+
a.className = "group", f(a, "field-group");
|
|
685
|
+
const t = this._schema.inner, i = this._value ?? {}, r = (d) => `d_${d}`, o = () => {
|
|
686
|
+
const d = {};
|
|
687
|
+
return a.querySelectorAll(".kv").forEach((p) => {
|
|
688
|
+
const u = p.dataset.uid;
|
|
689
|
+
u && (d[u] = p.getBoundingClientRect());
|
|
690
|
+
}), d;
|
|
691
|
+
}, c = (d) => {
|
|
692
|
+
a.querySelectorAll(".kv").forEach((p) => {
|
|
693
|
+
const u = p.dataset.uid;
|
|
694
|
+
if (!u) return;
|
|
695
|
+
const g = d[u];
|
|
661
696
|
if (!g) return;
|
|
662
|
-
const v =
|
|
663
|
-
(
|
|
664
|
-
|
|
697
|
+
const v = p.getBoundingClientRect(), x = g.left - v.left, k = g.top - v.top;
|
|
698
|
+
(x || k) && (p.style.transition = "none", p.style.transform = `translate(${x}px, ${k}px)`, requestAnimationFrame(() => {
|
|
699
|
+
p.style.transition = "transform .25s ease", p.style.transform = "";
|
|
665
700
|
}));
|
|
666
701
|
});
|
|
667
|
-
}, h = (
|
|
668
|
-
a.innerHTML = "", Object.keys(
|
|
669
|
-
const g = [...this._path,
|
|
670
|
-
v.className = "kv schema-collection-row",
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
const
|
|
674
|
-
|
|
702
|
+
}, h = (d, p) => {
|
|
703
|
+
a.innerHTML = "", Object.keys(i).forEach((u) => {
|
|
704
|
+
const g = [...this._path, u], v = document.createElement("div");
|
|
705
|
+
v.className = "kv schema-collection-row", f(v, "field-row", "collection-row"), v.dataset.uid = r(u), v.setAttribute("data-path", O(g));
|
|
706
|
+
const x = document.createElement("input");
|
|
707
|
+
x.className = "input", f(x, "field-input", "field-input-text"), x.value = u, x.name = j(g) + ".__key", x.id = A(g) + "__key";
|
|
708
|
+
const k = P(t, g, i[u], `${this._label ?? ""}[${u}]`), $ = document.createElement("button");
|
|
709
|
+
$.type = "button", $.className = "btn danger", f($, "field-button", "field-button-danger"), $.textContent = this._i18n.dictRemove ?? "×", $.onclick = () => {
|
|
675
710
|
const y = o();
|
|
676
|
-
delete
|
|
677
|
-
const
|
|
678
|
-
delete
|
|
679
|
-
},
|
|
680
|
-
const y =
|
|
681
|
-
if (!y || y ===
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
},
|
|
711
|
+
delete i[u];
|
|
712
|
+
const E = { ...this._value ?? {} };
|
|
713
|
+
delete E[u], this._value = E, h(y), this.emitChange(E);
|
|
714
|
+
}, x.onchange = () => {
|
|
715
|
+
const y = x.value.trim();
|
|
716
|
+
if (!y || y === u || i[y] !== void 0) return;
|
|
717
|
+
const E = o();
|
|
718
|
+
i[y] = i[u], delete i[u];
|
|
719
|
+
const C = { ...this._value ?? {} };
|
|
720
|
+
C[y] = C[u], delete C[u], this._value = C, h(E), this.emitChange(C);
|
|
721
|
+
}, k.addEventListener("change", (y) => {
|
|
687
722
|
y.stopPropagation();
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
}), v.append(
|
|
691
|
-
}),
|
|
723
|
+
const E = { ...this._value ?? {} };
|
|
724
|
+
E[u] = y.detail.value, this._value = E, this.emitChange(E);
|
|
725
|
+
}), v.append(x, k, $), a.appendChild(v), p === u && (v.classList.add("enter"), requestAnimationFrame(() => v.classList.add("enter-active")), requestAnimationFrame(() => v.classList.remove("enter")));
|
|
726
|
+
}), d && c(d);
|
|
692
727
|
};
|
|
693
728
|
h();
|
|
694
729
|
const l = document.createElement("button");
|
|
695
|
-
l.type = "button", l.className = "btn primary",
|
|
696
|
-
let
|
|
697
|
-
for (;
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
const g = { ...this._value ?? {}, [
|
|
701
|
-
this._value = g, h(
|
|
730
|
+
l.type = "button", l.className = "btn primary", f(l, "field-button", "field-button-primary"), l.textContent = this._i18n.dictAdd ?? "+", l.onclick = () => {
|
|
731
|
+
let d = Object.keys(i).length + 1, p = `k${d}`;
|
|
732
|
+
for (; i[p] !== void 0; ) p = `k${++d}`;
|
|
733
|
+
const u = o();
|
|
734
|
+
i[p] = R(t);
|
|
735
|
+
const g = { ...this._value ?? {}, [p]: i[p] };
|
|
736
|
+
this._value = g, h(u, p), this.emitChange(g);
|
|
702
737
|
};
|
|
703
738
|
const m = document.createElement("div");
|
|
704
|
-
m.className = "actions",
|
|
739
|
+
m.className = "actions", f(m, "field-actions"), m.appendChild(l), s.appendChild(a), s.appendChild(m), this.$root.appendChild(s);
|
|
705
740
|
}
|
|
706
741
|
}
|
|
707
742
|
b("schema-form-dict", be);
|
|
708
743
|
class ye extends HTMLElement {
|
|
709
744
|
constructor() {
|
|
710
|
-
super(), this._i18n = { ...
|
|
745
|
+
super(), this._i18n = { ...ue }, this._i18nCommitted = !1, this.$root = this.attachShadow({ mode: "open" });
|
|
711
746
|
const e = document.createElement("style");
|
|
712
|
-
e.textContent =
|
|
747
|
+
e.textContent = w, this.$root.appendChild(e);
|
|
713
748
|
const s = document.createElement("div");
|
|
714
|
-
s.className = "wrapper",
|
|
749
|
+
s.className = "wrapper", f(s, "wrapper");
|
|
715
750
|
const a = document.createElement("form");
|
|
716
|
-
a.className = "form",
|
|
751
|
+
a.className = "form", f(a, "form"), s.appendChild(a), this.$root.appendChild(s), this.addEventListener("change", (t) => {
|
|
717
752
|
if (!t?.detail) return;
|
|
718
|
-
const { path:
|
|
719
|
-
Array.isArray(
|
|
720
|
-
new CustomEvent("form-change", { detail: { path:
|
|
753
|
+
const { path: i, value: r } = t.detail;
|
|
754
|
+
Array.isArray(i) && i.length === 0 ? this._state = r : We(this._state ?? (this._state = {}), i, r), this.dispatchEvent(
|
|
755
|
+
new CustomEvent("form-change", { detail: { path: i, value: r, state: this._state } })
|
|
721
756
|
);
|
|
722
757
|
});
|
|
723
758
|
}
|
|
@@ -727,7 +762,7 @@ class ye extends HTMLElement {
|
|
|
727
762
|
try {
|
|
728
763
|
this._state = this._schema(null, { autofix: !0 });
|
|
729
764
|
} catch {
|
|
730
|
-
this._state =
|
|
765
|
+
this._state = R(this._schema);
|
|
731
766
|
}
|
|
732
767
|
this.render();
|
|
733
768
|
}
|
|
@@ -754,7 +789,7 @@ class ye extends HTMLElement {
|
|
|
754
789
|
try {
|
|
755
790
|
this._state = this._schema(null, { autofix: !0 });
|
|
756
791
|
} catch {
|
|
757
|
-
this._state =
|
|
792
|
+
this._state = R(this._schema);
|
|
758
793
|
}
|
|
759
794
|
this.render();
|
|
760
795
|
}
|
|
@@ -772,7 +807,7 @@ class ye extends HTMLElement {
|
|
|
772
807
|
if (!this._schema) return;
|
|
773
808
|
const e = this.$root.querySelector("form");
|
|
774
809
|
e.innerHTML = "";
|
|
775
|
-
const s =
|
|
810
|
+
const s = P(
|
|
776
811
|
this._schema,
|
|
777
812
|
[],
|
|
778
813
|
this._state,
|
|
@@ -784,11 +819,11 @@ class ye extends HTMLElement {
|
|
|
784
819
|
}
|
|
785
820
|
b("schema-form", ye);
|
|
786
821
|
function et() {
|
|
787
|
-
b("schema-form", ye), b("schema-form-string",
|
|
822
|
+
b("schema-form", ye), b("schema-form-string", F), b("schema-form-number", he), b("schema-form-boolean", me), b("schema-form-date", pe), b("schema-form-const", Y), b("schema-form-union", ve), b("schema-form-tuple", ge), b("schema-form-object", _e), b("schema-form-array", z), b("schema-form-dict", be), b("schema-form-intersect", fe);
|
|
788
823
|
}
|
|
789
|
-
const tt = /* @__PURE__ */
|
|
824
|
+
const tt = /* @__PURE__ */ oe({
|
|
790
825
|
__name: "SchemasteryFormVue",
|
|
791
|
-
props: /* @__PURE__ */
|
|
826
|
+
props: /* @__PURE__ */ ae({
|
|
792
827
|
schema: {},
|
|
793
828
|
value: {},
|
|
794
829
|
validateOnChange: { type: Boolean, default: !1 }
|
|
@@ -798,39 +833,39 @@ const tt = /* @__PURE__ */ re({
|
|
|
798
833
|
value: { required: !1, default: {} },
|
|
799
834
|
valueModifiers: {}
|
|
800
835
|
}),
|
|
801
|
-
emits: /* @__PURE__ */
|
|
836
|
+
emits: /* @__PURE__ */ ae(["change"], ["update:schema", "update:value"]),
|
|
802
837
|
setup(n, { expose: e, emit: s }) {
|
|
803
|
-
const a =
|
|
838
|
+
const a = se(n, "schema"), t = se(n, "value"), i = s, r = le("elRef");
|
|
804
839
|
let o = !1, c = !1;
|
|
805
840
|
const h = (l) => {
|
|
806
841
|
if (c)
|
|
807
842
|
return;
|
|
808
|
-
const m =
|
|
809
|
-
o = !0, t.value =
|
|
843
|
+
const m = r.value, d = n.validateOnChange ? m.getData({ validate: !0 }) : l.detail.state;
|
|
844
|
+
o = !0, t.value = d, B(() => {
|
|
810
845
|
o = !1;
|
|
811
|
-
}),
|
|
846
|
+
}), i("change", l.detail);
|
|
812
847
|
};
|
|
813
848
|
return Me(() => {
|
|
814
849
|
et();
|
|
815
|
-
}),
|
|
816
|
-
const l =
|
|
850
|
+
}), ce(() => {
|
|
851
|
+
const l = r.value;
|
|
817
852
|
a.value && (l.schema = a.value), t.value !== void 0 && l.setData(t.value, { validate: !1, autofix: !0 }), l.addEventListener("form-change", h);
|
|
818
|
-
}),
|
|
819
|
-
|
|
820
|
-
}),
|
|
853
|
+
}), Fe(() => {
|
|
854
|
+
r.value?.removeEventListener("form-change", h);
|
|
855
|
+
}), K(
|
|
821
856
|
a,
|
|
822
857
|
(l) => {
|
|
823
|
-
o ||
|
|
858
|
+
o || r.value && l && r.value.schema !== l && (c = !0, r.value.schema = l, B(() => {
|
|
824
859
|
c = !1;
|
|
825
860
|
}));
|
|
826
861
|
},
|
|
827
862
|
{ deep: !0, immediate: !0 }
|
|
828
|
-
),
|
|
863
|
+
), K(
|
|
829
864
|
t,
|
|
830
865
|
(l) => {
|
|
831
|
-
if (o || !
|
|
832
|
-
const m =
|
|
833
|
-
JSON.stringify(m) !== JSON.stringify(l) && (c = !0,
|
|
866
|
+
if (o || !r.value || l === void 0) return;
|
|
867
|
+
const m = r.value.getData({ validate: !1 });
|
|
868
|
+
JSON.stringify(m) !== JSON.stringify(l) && (c = !0, r.value.setData(l, { validate: !1 }), B(() => {
|
|
834
869
|
c = !1;
|
|
835
870
|
}));
|
|
836
871
|
},
|
|
@@ -838,33 +873,33 @@ const tt = /* @__PURE__ */ re({
|
|
|
838
873
|
), e({
|
|
839
874
|
/** 手动设置数据并可选择是否触发 v-model:data */
|
|
840
875
|
setData(l, m) {
|
|
841
|
-
const
|
|
842
|
-
|
|
876
|
+
const d = r.value;
|
|
877
|
+
d.setData(l, { validate: !!m?.validate }), m?.emit && (t.value = d.getData({ validate: !!m?.validate }));
|
|
843
878
|
},
|
|
844
879
|
/** 获取数据 */
|
|
845
880
|
getData(l) {
|
|
846
|
-
return
|
|
881
|
+
return r.value.getData(l);
|
|
847
882
|
},
|
|
848
883
|
/** 设置 schema,并同步到 v-model:schema */
|
|
849
884
|
setSchema(l, m = !0) {
|
|
850
|
-
|
|
885
|
+
r.value.schema = l, m && (a.value = l);
|
|
851
886
|
},
|
|
852
887
|
refresh() {
|
|
853
|
-
|
|
888
|
+
r.value.refresh();
|
|
854
889
|
},
|
|
855
890
|
reset() {
|
|
856
|
-
|
|
891
|
+
r.value.reset();
|
|
857
892
|
},
|
|
858
893
|
/** 原生元素 */
|
|
859
|
-
el:
|
|
860
|
-
}), (l, m) => (
|
|
894
|
+
el: r
|
|
895
|
+
}), (l, m) => (I(), D("schema-form", je({
|
|
861
896
|
ref_key: "elRef",
|
|
862
|
-
ref:
|
|
897
|
+
ref: r
|
|
863
898
|
}, l.$attrs), null, 16));
|
|
864
899
|
}
|
|
865
900
|
});
|
|
866
901
|
function M(n, e = /* @__PURE__ */ new WeakMap()) {
|
|
867
|
-
if (
|
|
902
|
+
if (Re(n))
|
|
868
903
|
return M(n.value, e);
|
|
869
904
|
if (n === null || typeof n != "object")
|
|
870
905
|
return n;
|
|
@@ -876,21 +911,21 @@ function M(n, e = /* @__PURE__ */ new WeakMap()) {
|
|
|
876
911
|
return new RegExp(n);
|
|
877
912
|
if (n instanceof Map) {
|
|
878
913
|
const t = /* @__PURE__ */ new Map();
|
|
879
|
-
return e.set(n, t), Array.from(n.entries()).forEach(([
|
|
880
|
-
t.set(
|
|
914
|
+
return e.set(n, t), Array.from(n.entries()).forEach(([i, r]) => {
|
|
915
|
+
t.set(i, M(r, e));
|
|
881
916
|
}), t;
|
|
882
917
|
}
|
|
883
918
|
if (n instanceof Set) {
|
|
884
919
|
const t = /* @__PURE__ */ new Set();
|
|
885
|
-
return e.set(n, t), Array.from(n).forEach((
|
|
886
|
-
t.add(M(
|
|
920
|
+
return e.set(n, t), Array.from(n).forEach((i) => {
|
|
921
|
+
t.add(M(i, e));
|
|
887
922
|
}), t;
|
|
888
923
|
}
|
|
889
924
|
if (Array.isArray(n)) {
|
|
890
925
|
const t = [];
|
|
891
926
|
e.set(n, t);
|
|
892
|
-
for (const
|
|
893
|
-
t.push(M(
|
|
927
|
+
for (const i of n)
|
|
928
|
+
t.push(M(i, e));
|
|
894
929
|
return t;
|
|
895
930
|
}
|
|
896
931
|
const s = De(n), a = {};
|
|
@@ -901,104 +936,104 @@ function M(n, e = /* @__PURE__ */ new WeakMap()) {
|
|
|
901
936
|
a[t] = M(s[t], e);
|
|
902
937
|
return a;
|
|
903
938
|
}
|
|
904
|
-
const at = { id: "preferences-ui-app" }, st = { class: "tabbar" }, nt = { class: "tabbar-tabs" },
|
|
939
|
+
const at = { id: "preferences-ui-app" }, st = { class: "tabbar" }, nt = { class: "tabbar-tabs" }, rt = ["onClick", "data-value"], it = { class: "tabbar-content" }, ot = { key: 0 }, lt = { style: { "max-height": "20em", overflow: "auto" } }, ct = /* @__PURE__ */ oe({
|
|
905
940
|
__name: "PreferencesApp",
|
|
906
941
|
setup(n, { expose: e }) {
|
|
907
|
-
const s =
|
|
908
|
-
const
|
|
909
|
-
return
|
|
910
|
-
}), h =
|
|
942
|
+
const s = Te(), a = !1, t = Oe([]), i = q([]), r = q(""), o = G(() => i.value.find((u) => u.name === r.value) || null), c = G(() => {
|
|
943
|
+
const u = t.value.filter((g) => g.category === r.value).map((g) => g.schema);
|
|
944
|
+
return u.length === 0 ? null : Pe.intersect(u);
|
|
945
|
+
}), h = G(() => o.value && typeof o.value.autoGenerateForm == "boolean" ? o.value.autoGenerateForm : !0), l = q({});
|
|
911
946
|
e({
|
|
912
947
|
getValue() {
|
|
913
948
|
return M(l);
|
|
914
949
|
},
|
|
915
|
-
mergeValue(
|
|
950
|
+
mergeValue(u) {
|
|
916
951
|
l.value = {
|
|
917
952
|
...l.value,
|
|
918
|
-
...
|
|
953
|
+
...u
|
|
919
954
|
};
|
|
920
955
|
},
|
|
921
|
-
selectTab(
|
|
922
|
-
|
|
956
|
+
selectTab(u) {
|
|
957
|
+
r.value = u;
|
|
923
958
|
}
|
|
924
|
-
}),
|
|
925
|
-
s.inject(["preferences"], async (
|
|
926
|
-
const g = await
|
|
927
|
-
l.value = g,
|
|
959
|
+
}), ce(async () => {
|
|
960
|
+
s.inject(["preferences"], async (u) => {
|
|
961
|
+
const g = await u.preferences.getAll();
|
|
962
|
+
l.value = g, i.value = u.preferences.getConfigCategories(), t.value = u.preferences.getConfigRegistries(), r.value = i.value[0].name;
|
|
928
963
|
});
|
|
929
964
|
});
|
|
930
|
-
const m = (
|
|
931
|
-
|
|
932
|
-
const v =
|
|
965
|
+
const m = (u, g) => {
|
|
966
|
+
u.preventDefault(), r.value = g;
|
|
967
|
+
const v = u.currentTarget;
|
|
933
968
|
v && v.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
|
|
934
|
-
},
|
|
969
|
+
}, d = le("customRenderContainerRef"), p = q([]);
|
|
935
970
|
return qe(() => {
|
|
936
|
-
|
|
937
|
-
}),
|
|
971
|
+
p.value.forEach((u) => u()), p.value = [];
|
|
972
|
+
}), K(
|
|
938
973
|
o,
|
|
939
|
-
async (
|
|
940
|
-
|
|
941
|
-
const g =
|
|
942
|
-
if (g && (g.innerText = "",
|
|
974
|
+
async (u) => {
|
|
975
|
+
p.value.forEach((v) => v()), p.value = [], await B();
|
|
976
|
+
const g = d.value;
|
|
977
|
+
if (g && (g.innerText = "", u && typeof u.customRenderer == "function")) {
|
|
943
978
|
let v = Ge;
|
|
944
|
-
const
|
|
979
|
+
const x = (y) => {
|
|
945
980
|
v = y;
|
|
946
|
-
},
|
|
947
|
-
|
|
948
|
-
},
|
|
949
|
-
|
|
981
|
+
}, k = (y) => {
|
|
982
|
+
p.value.push(y);
|
|
983
|
+
}, $ = await u.customRenderer({ ctx: s, onMounted: x, onUnmount: k });
|
|
984
|
+
$ && (g.appendChild($), v?.(g));
|
|
950
985
|
}
|
|
951
986
|
},
|
|
952
987
|
{ immediate: !0, deep: !1 }
|
|
953
|
-
), (
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
(
|
|
957
|
-
class: Be(["tab", { active:
|
|
988
|
+
), (u, g) => (I(), D("div", at, [
|
|
989
|
+
H("div", st, [
|
|
990
|
+
H("div", nt, [
|
|
991
|
+
(I(!0), D(He, null, Ue(i.value, (v) => (I(), D("a", {
|
|
992
|
+
class: Be(["tab", { active: r.value === v.name }]),
|
|
958
993
|
key: v.name,
|
|
959
|
-
onClick: (
|
|
994
|
+
onClick: (x) => m(x, v.name),
|
|
960
995
|
"data-value": v.name
|
|
961
|
-
},
|
|
996
|
+
}, ne(v.label), 11, rt))), 128))
|
|
962
997
|
]),
|
|
963
|
-
|
|
964
|
-
o.value && o.value.customRenderer ? (
|
|
998
|
+
H("div", it, [
|
|
999
|
+
o.value && o.value.customRenderer ? (I(), D("div", {
|
|
965
1000
|
class: "custom-render-container",
|
|
966
1001
|
ref_key: "customRenderContainerRef",
|
|
967
|
-
ref:
|
|
968
|
-
key:
|
|
969
|
-
})) :
|
|
970
|
-
h.value && c.value ? (
|
|
1002
|
+
ref: d,
|
|
1003
|
+
key: r.value
|
|
1004
|
+
})) : J("", !0),
|
|
1005
|
+
h.value && c.value ? (I(), Ve(re(tt), {
|
|
971
1006
|
class: "auto-schema-form",
|
|
972
|
-
key:
|
|
973
|
-
"data-category":
|
|
1007
|
+
key: r.value,
|
|
1008
|
+
"data-category": r.value,
|
|
974
1009
|
schema: c.value,
|
|
975
1010
|
value: l.value,
|
|
976
1011
|
"onUpdate:value": g[0] || (g[0] = (v) => l.value = { ...l.value, ...v }),
|
|
977
1012
|
"validate-on-change": !1,
|
|
978
1013
|
i18n: { rootLabel: "" }
|
|
979
|
-
}, null, 8, ["data-category", "schema", "value"])) :
|
|
1014
|
+
}, null, 8, ["data-category", "schema", "value"])) : J("", !0)
|
|
980
1015
|
])
|
|
981
1016
|
]),
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
])) :
|
|
1017
|
+
re(a) ? (I(), D("details", ot, [
|
|
1018
|
+
H("pre", lt, ne(l.value), 1)
|
|
1019
|
+
])) : J("", !0)
|
|
985
1020
|
]));
|
|
986
1021
|
}
|
|
987
|
-
}),
|
|
988
|
-
var
|
|
1022
|
+
}), ut = /* @__PURE__ */ Je(ct, [["__scopeId", "data-v-775e2739"]]);
|
|
1023
|
+
var dt = Object.create, Z = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, Ce = (n, e) => (e = Symbol[n]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + n), xe = (n) => {
|
|
989
1024
|
throw TypeError(n);
|
|
990
|
-
}, mt = (n, e, s) => e in n ? Z(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s, pt = (n, e) => Z(n, "name", { value: e, configurable: !0 }), ft = (n) => [, , ,
|
|
991
|
-
for (var t = 0,
|
|
1025
|
+
}, mt = (n, e, s) => e in n ? Z(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s, pt = (n, e) => Z(n, "name", { value: e, configurable: !0 }), ft = (n) => [, , , dt(n?.[Ce("metadata")] ?? null)], vt = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Ee = (n) => n !== void 0 && typeof n != "function" ? xe("Function expected") : n, gt = (n, e, s, a, t) => ({ kind: vt[n], name: e, metadata: a, addInitializer: (i) => s._ ? xe("Already initialized") : t.push(Ee(i || null)) }), _t = (n, e) => mt(e, Ce("metadata"), n[3]), bt = (n, e, s, a) => {
|
|
1026
|
+
for (var t = 0, i = n[e >> 1], r = i && i.length; t < r; t++) i[t].call(s);
|
|
992
1027
|
return a;
|
|
993
|
-
}, yt = (n, e, s, a, t,
|
|
994
|
-
var
|
|
1028
|
+
}, yt = (n, e, s, a, t, i) => {
|
|
1029
|
+
var r, o, c, h = e & 7, l = !1, m = 0, d = n[m] || (n[m] = []), p = h && (t = t.prototype, h < 5 && (h > 3 || !l) && ht(t, s));
|
|
995
1030
|
pt(t, s);
|
|
996
|
-
for (var
|
|
997
|
-
c = gt(h, s, o = {}, n[3],
|
|
998
|
-
return _t(n, t),
|
|
999
|
-
},
|
|
1000
|
-
|
|
1001
|
-
class Q extends (
|
|
1031
|
+
for (var u = a.length - 1; u >= 0; u--)
|
|
1032
|
+
c = gt(h, s, o = {}, n[3], d), r = (0, a[u])(t, c), o._ = 1, Ee(r) && (t = r);
|
|
1033
|
+
return _t(n, t), p && Z(t, s, p), l ? h ^ 4 ? i : p : t;
|
|
1034
|
+
}, $e, ee, ke;
|
|
1035
|
+
$e = [Ie(["preferences", "modal", "$", "$$"])];
|
|
1036
|
+
class Q extends (ke = Ke) {
|
|
1002
1037
|
constructor(e) {
|
|
1003
1038
|
super(e, {}, "preferences-ui"), this.ctx = e, this._modal = null, this._form = null, e.set("preferencesUI", this);
|
|
1004
1039
|
const s = e.$, a = e.$$;
|
|
@@ -1072,13 +1107,13 @@ class Q extends (we = We) {
|
|
|
1072
1107
|
group: "group2",
|
|
1073
1108
|
index: 99,
|
|
1074
1109
|
onClick: () => this.showModal()
|
|
1075
|
-
}), this.addDisposeHandler((
|
|
1076
|
-
|
|
1110
|
+
}), this.addDisposeHandler((i) => {
|
|
1111
|
+
i.toolbox.removeButton("preferences");
|
|
1077
1112
|
});
|
|
1078
1113
|
});
|
|
1079
1114
|
}
|
|
1080
1115
|
async start() {
|
|
1081
|
-
import("./PluginPrefSync-
|
|
1116
|
+
import("./PluginPrefSync-C8tb5SJJ.js").then(({ PluginPrefSync: e }) => {
|
|
1082
1117
|
this.ctx.plugin(e);
|
|
1083
1118
|
}).catch(this.ctx.logger.warn), this.ctx.on("preferences/changed", (e) => {
|
|
1084
1119
|
this._form?.mergeValue?.(e.input);
|
|
@@ -1096,7 +1131,7 @@ class Q extends (we = We) {
|
|
|
1096
1131
|
outSideClose: !1,
|
|
1097
1132
|
center: !0,
|
|
1098
1133
|
title: `${e`InPageEdit Preferences`} (${this.ctx.version})`,
|
|
1099
|
-
content: /* @__PURE__ */ _(
|
|
1134
|
+
content: /* @__PURE__ */ _(Ae, { children: /* @__PURE__ */ _(Le, {}) })
|
|
1100
1135
|
});
|
|
1101
1136
|
s.get$window().classList.add("dialog");
|
|
1102
1137
|
const a = /* @__PURE__ */ _(
|
|
@@ -1110,11 +1145,11 @@ class Q extends (we = We) {
|
|
|
1110
1145
|
ctx: this.ctx,
|
|
1111
1146
|
modal: s
|
|
1112
1147
|
});
|
|
1113
|
-
const t = this.createPreferencesUIApp(),
|
|
1114
|
-
return this._form =
|
|
1148
|
+
const t = this.createPreferencesUIApp(), i = t.mount(a);
|
|
1149
|
+
return this._form = i, this.ctx.emit("preferences-ui/vue-app-mounted", {
|
|
1115
1150
|
ctx: this.ctx,
|
|
1116
1151
|
app: t,
|
|
1117
|
-
form:
|
|
1152
|
+
form: i
|
|
1118
1153
|
}), s.setButtons([
|
|
1119
1154
|
{
|
|
1120
1155
|
label: e`Close`,
|
|
@@ -1127,10 +1162,10 @@ class Q extends (we = We) {
|
|
|
1127
1162
|
label: e`Save`,
|
|
1128
1163
|
className: "is-primary is-ghost",
|
|
1129
1164
|
method: async () => {
|
|
1130
|
-
const
|
|
1165
|
+
const r = i.getValue();
|
|
1131
1166
|
try {
|
|
1132
|
-
const o = await this.ctx.preferences.setMany(
|
|
1133
|
-
this.logger.info("preferences saved",
|
|
1167
|
+
const o = await this.ctx.preferences.setMany(r);
|
|
1168
|
+
this.logger.info("preferences saved", r, o);
|
|
1134
1169
|
} catch (o) {
|
|
1135
1170
|
this.logger.error("failed to save preferences", o);
|
|
1136
1171
|
}
|
|
@@ -1165,13 +1200,13 @@ class Q extends (we = We) {
|
|
|
1165
1200
|
return this._form?.mergeValue?.(e), !!this._form?.mergeValue;
|
|
1166
1201
|
}
|
|
1167
1202
|
createPreferencesUIApp() {
|
|
1168
|
-
return ze(this.ctx,
|
|
1203
|
+
return ze(this.ctx, ut);
|
|
1169
1204
|
}
|
|
1170
1205
|
}
|
|
1171
|
-
|
|
1172
|
-
Q = yt(
|
|
1173
|
-
bt(
|
|
1206
|
+
ee = ft(ke);
|
|
1207
|
+
Q = yt(ee, 0, "PluginPreferencesUI", $e, Q);
|
|
1208
|
+
bt(ee, 1, Q);
|
|
1174
1209
|
export {
|
|
1175
1210
|
Q as PluginPreferencesUI
|
|
1176
1211
|
};
|
|
1177
|
-
//# sourceMappingURL=index-
|
|
1212
|
+
//# sourceMappingURL=index-_Sydb5MZ.js.map
|