@startinblox/boilerplate 3.0.3 → 3.0.5
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
CHANGED
|
@@ -18,6 +18,7 @@ This boilerplate includes:
|
|
|
18
18
|
* **Unpluggin Icons:** Access to a vast library of icons from [Iconify](https://icon-sets.iconify.design/).
|
|
19
19
|
* **Lit Integration:** Pre-made component classes to accelerate development.
|
|
20
20
|
* **Vite-powered:** Typescript, SASS, PostCSS, Autoprefixer... Focus on your component logic, not the build process.
|
|
21
|
+
* **BiomeJS:** For linting and formatting, preconfigured for Startin'blox JS styling, using the most [reasonable one](https://github.com/airbnb/javascript). Use [Biome](https://biomejs.dev/fr/) within your preferred editor.
|
|
21
22
|
|
|
22
23
|
## Getting started
|
|
23
24
|
|
|
@@ -47,8 +48,12 @@ To initialize a new component repository from this boilerplate:
|
|
|
47
48
|
For production usage, components can be served via a CDN like JSDelivr or self-hosted.
|
|
48
49
|
|
|
49
50
|
```html
|
|
50
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@startinblox/core@latest/dist/store.js"></script>
|
|
51
|
-
|
|
51
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@startinblox/core@latest/dist/store.js" defer=""></script>
|
|
52
|
+
<!--
|
|
53
|
+
Or the entire core:
|
|
54
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@startinblox/core@latest/dist/index.js" defer=""></script>
|
|
55
|
+
-->
|
|
56
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/your-component-name@latest" defer=""></script>
|
|
52
57
|
<!-- ... -->
|
|
53
58
|
<your-component-1 data-src="..."></your-component-1>
|
|
54
59
|
<your-component-2>Hello World!</your-component-2>
|
|
@@ -139,12 +144,10 @@ async _afterAttach() {
|
|
|
139
144
|
### `ObjectsHandler` methods
|
|
140
145
|
|
|
141
146
|
* `hasType(type)`: Checks if any object within `this.objects` shares the requested type, returning a boolean.
|
|
142
|
-
* `renderTemplateWhenWith(property, callback)`: Renders the `callback` if the specified property (or properties) is present. Nested arrays enable `OR` testing, while `AND` testing is implicit. Example: `[["name", "shortname"], "description"]` returns the callback if (`name` OR `shortname`) AND `description` are present.
|
|
143
147
|
|
|
144
148
|
### `ObjectHandler` methods
|
|
145
149
|
|
|
146
150
|
* `isType(type)`: Checks if the object shares the requested type, returning a boolean.
|
|
147
|
-
* `renderTemplateWhenWith`: Functions identically to the `ObjectsHandler` method but applies to a single object.
|
|
148
151
|
|
|
149
152
|
### Available helpers
|
|
150
153
|
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
6
|
+
const N = globalThis, Y = N.ShadowRoot && (N.ShadyCSS === void 0 || N.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, tt = Symbol(), lt = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let Ct = class {
|
|
8
8
|
constructor(t, e, r) {
|
|
9
9
|
if (this._$cssResult$ = !0, r !== tt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
@@ -29,10 +29,10 @@ const et = (s) => new Ct(typeof s == "string" ? s : s + "", void 0, tt), st = (s
|
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(i) + s[o + 1], s[0]);
|
|
31
31
|
return new Ct(e, s, tt);
|
|
32
|
-
},
|
|
32
|
+
}, zt = (s, t) => {
|
|
33
33
|
if (Y) s.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
34
34
|
else for (const e of t) {
|
|
35
|
-
const r = document.createElement("style"), i =
|
|
35
|
+
const r = document.createElement("style"), i = N.litNonce;
|
|
36
36
|
i !== void 0 && r.setAttribute("nonce", i), r.textContent = e.cssText, s.appendChild(r);
|
|
37
37
|
}
|
|
38
38
|
}, ct = Y ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
|
|
@@ -45,10 +45,10 @@ const et = (s) => new Ct(typeof s == "string" ? s : s + "", void 0, tt), st = (s
|
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is:
|
|
48
|
+
const { is: Vt, defineProperty: Bt, getOwnPropertyDescriptor: Wt, getOwnPropertyNames: Ft, getOwnPropertySymbols: Kt, getPrototypeOf: Xt } = Object, B = globalThis, ut = B.trustedTypes, Jt = ut ? ut.emptyScript : "", Zt = B.reactiveElementPolyfillSupport, O = (s, t) => s, D = { toAttribute(s, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
s = s ?
|
|
51
|
+
s = s ? Jt : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -73,8 +73,8 @@ const { is: Bt, defineProperty: Ft, getOwnPropertyDescriptor: Kt, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return e;
|
|
76
|
-
} },
|
|
77
|
-
Symbol.metadata ??= Symbol("metadata"),
|
|
76
|
+
} }, W = (s, t) => !Vt(s, t), dt = { attribute: !0, type: String, converter: D, reflect: !1, useDefault: !1, hasChanged: W };
|
|
77
|
+
Symbol.metadata ??= Symbol("metadata"), B.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
78
78
|
let E = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
80
80
|
this._$Ei(), (this.l ??= []).push(t);
|
|
@@ -85,11 +85,11 @@ let E = class extends HTMLElement {
|
|
|
85
85
|
static createProperty(t, e = dt) {
|
|
86
86
|
if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
87
87
|
const r = Symbol(), i = this.getPropertyDescriptor(t, r, e);
|
|
88
|
-
i !== void 0 &&
|
|
88
|
+
i !== void 0 && Bt(this.prototype, t, i);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(t, e, r) {
|
|
92
|
-
const { get: i, set: o } =
|
|
92
|
+
const { get: i, set: o } = Wt(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[e];
|
|
94
94
|
}, set(n) {
|
|
95
95
|
this[e] = n;
|
|
@@ -103,14 +103,14 @@ let E = class extends HTMLElement {
|
|
|
103
103
|
return this.elementProperties.get(t) ?? dt;
|
|
104
104
|
}
|
|
105
105
|
static _$Ei() {
|
|
106
|
-
if (this.hasOwnProperty(
|
|
107
|
-
const t =
|
|
106
|
+
if (this.hasOwnProperty(O("elementProperties"))) return;
|
|
107
|
+
const t = Xt(this);
|
|
108
108
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
109
109
|
}
|
|
110
110
|
static finalize() {
|
|
111
|
-
if (this.hasOwnProperty(
|
|
112
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
113
|
-
const e = this.properties, r = [...
|
|
111
|
+
if (this.hasOwnProperty(O("finalized"))) return;
|
|
112
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(O("properties"))) {
|
|
113
|
+
const e = this.properties, r = [...Ft(e), ...Kt(e)];
|
|
114
114
|
for (const i of r) this.createProperty(i, e[i]);
|
|
115
115
|
}
|
|
116
116
|
const t = this[Symbol.metadata];
|
|
@@ -156,7 +156,7 @@ let E = class extends HTMLElement {
|
|
|
156
156
|
}
|
|
157
157
|
createRenderRoot() {
|
|
158
158
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
159
|
-
return
|
|
159
|
+
return zt(t, this.constructor.elementStyles), t;
|
|
160
160
|
}
|
|
161
161
|
connectedCallback() {
|
|
162
162
|
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((t) => t.hostConnected?.());
|
|
@@ -186,7 +186,7 @@ let E = class extends HTMLElement {
|
|
|
186
186
|
requestUpdate(t, e, r) {
|
|
187
187
|
if (t !== void 0) {
|
|
188
188
|
const i = this.constructor, o = this[t];
|
|
189
|
-
if (r ??= i.getPropertyOptions(t), !((r.hasChanged ??
|
|
189
|
+
if (r ??= i.getPropertyOptions(t), !((r.hasChanged ?? W)(o, e) || r.useDefault && r.reflect && o === this._$Ej?.get(t) && !this.hasAttribute(i._$Eu(t, r)))) return;
|
|
190
190
|
this.C(t, e, r);
|
|
191
191
|
}
|
|
192
192
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
@@ -254,59 +254,59 @@ let E = class extends HTMLElement {
|
|
|
254
254
|
firstUpdated(t) {
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[
|
|
257
|
+
E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[O("elementProperties")] = /* @__PURE__ */ new Map(), E[O("finalized")] = /* @__PURE__ */ new Map(), Zt?.({ ReactiveElement: E }), (B.reactiveElementVersions ??= []).push("2.1.0");
|
|
258
258
|
/**
|
|
259
259
|
* @license
|
|
260
260
|
* Copyright 2017 Google LLC
|
|
261
261
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
262
262
|
*/
|
|
263
|
-
const it = globalThis, q = it.trustedTypes, pt = q ? q.createPolicy("lit-html", { createHTML: (s) => s }) : void 0,
|
|
264
|
-
\f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ft = /-->/g, _t = />/g,
|
|
265
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), $t = /'/g, gt = /"/g,
|
|
266
|
-
function
|
|
263
|
+
const it = globalThis, q = it.trustedTypes, pt = q ? q.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, Pt = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, Rt = "?" + y, Gt = `<${Rt}>`, w = document, x = () => w.createComment(""), j = (s) => s === null || typeof s != "object" && typeof s != "function", rt = Array.isArray, Qt = (s) => rt(s) || typeof s?.[Symbol.iterator] == "function", K = `[
|
|
264
|
+
\f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ft = /-->/g, _t = />/g, b = RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
|
|
265
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), $t = /'/g, gt = /"/g, Ot = /^(?:script|style|textarea|title)$/i, Yt = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), T = Yt(1), C = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), yt = /* @__PURE__ */ new WeakMap(), A = w.createTreeWalker(w, 129);
|
|
266
|
+
function xt(s, t) {
|
|
267
267
|
if (!rt(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
268
268
|
return pt !== void 0 ? pt.createHTML(t) : t;
|
|
269
269
|
}
|
|
270
|
-
const
|
|
270
|
+
const te = (s, t) => {
|
|
271
271
|
const e = s.length - 1, r = [];
|
|
272
272
|
let i, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = R;
|
|
273
273
|
for (let h = 0; h < e; h++) {
|
|
274
274
|
const a = s[h];
|
|
275
|
-
let
|
|
276
|
-
for (; f < a.length && (n.lastIndex = f, d = n.exec(a), d !== null); ) f = n.lastIndex, n === R ? d[1] === "!--" ? n = ft : d[1] !== void 0 ? n = _t : d[2] !== void 0 ? (
|
|
277
|
-
const g = n ===
|
|
278
|
-
o += n === R ? a +
|
|
275
|
+
let u, d, l = -1, f = 0;
|
|
276
|
+
for (; f < a.length && (n.lastIndex = f, d = n.exec(a), d !== null); ) f = n.lastIndex, n === R ? d[1] === "!--" ? n = ft : d[1] !== void 0 ? n = _t : d[2] !== void 0 ? (Ot.test(d[2]) && (i = RegExp("</" + d[2], "g")), n = b) : d[3] !== void 0 && (n = b) : n === b ? d[0] === ">" ? (n = i ?? R, l = -1) : d[1] === void 0 ? l = -2 : (l = n.lastIndex - d[2].length, u = d[1], n = d[3] === void 0 ? b : d[3] === '"' ? gt : $t) : n === gt || n === $t ? n = b : n === ft || n === _t ? n = R : (n = b, i = void 0);
|
|
277
|
+
const g = n === b && s[h + 1].startsWith("/>") ? " " : "";
|
|
278
|
+
o += n === R ? a + Gt : l >= 0 ? (r.push(u), a.slice(0, l) + Pt + a.slice(l) + y + g) : a + y + (l === -2 ? h : g);
|
|
279
279
|
}
|
|
280
|
-
return [
|
|
280
|
+
return [xt(s, o + (s[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
281
281
|
};
|
|
282
282
|
class L {
|
|
283
283
|
constructor({ strings: t, _$litType$: e }, r) {
|
|
284
284
|
let i;
|
|
285
285
|
this.parts = [];
|
|
286
286
|
let o = 0, n = 0;
|
|
287
|
-
const h = t.length - 1, a = this.parts, [
|
|
288
|
-
if (this.el = L.createElement(
|
|
289
|
-
const
|
|
290
|
-
|
|
287
|
+
const h = t.length - 1, a = this.parts, [u, d] = te(t, e);
|
|
288
|
+
if (this.el = L.createElement(u, r), A.currentNode = this.el.content, e === 2 || e === 3) {
|
|
289
|
+
const l = this.el.content.firstChild;
|
|
290
|
+
l.replaceWith(...l.childNodes);
|
|
291
291
|
}
|
|
292
292
|
for (; (i = A.nextNode()) !== null && a.length < h; ) {
|
|
293
293
|
if (i.nodeType === 1) {
|
|
294
|
-
if (i.hasAttributes()) for (const
|
|
295
|
-
const f = d[n++], g = i.getAttribute(
|
|
296
|
-
a.push({ type: 1, index: o, name: M[2], strings: g, ctor: M[1] === "." ?
|
|
297
|
-
} else
|
|
298
|
-
if (
|
|
299
|
-
const
|
|
294
|
+
if (i.hasAttributes()) for (const l of i.getAttributeNames()) if (l.endsWith(Pt)) {
|
|
295
|
+
const f = d[n++], g = i.getAttribute(l).split(y), M = /([.?@])?(.*)/.exec(f);
|
|
296
|
+
a.push({ type: 1, index: o, name: M[2], strings: g, ctor: M[1] === "." ? se : M[1] === "?" ? ie : M[1] === "@" ? re : F }), i.removeAttribute(l);
|
|
297
|
+
} else l.startsWith(y) && (a.push({ type: 6, index: o }), i.removeAttribute(l));
|
|
298
|
+
if (Ot.test(i.tagName)) {
|
|
299
|
+
const l = i.textContent.split(y), f = l.length - 1;
|
|
300
300
|
if (f > 0) {
|
|
301
301
|
i.textContent = q ? q.emptyScript : "";
|
|
302
|
-
for (let g = 0; g < f; g++) i.append(
|
|
303
|
-
i.append(
|
|
302
|
+
for (let g = 0; g < f; g++) i.append(l[g], x()), A.nextNode(), a.push({ type: 2, index: ++o });
|
|
303
|
+
i.append(l[f], x());
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
} else if (i.nodeType === 8) if (i.data ===
|
|
306
|
+
} else if (i.nodeType === 8) if (i.data === Rt) a.push({ type: 2, index: o });
|
|
307
307
|
else {
|
|
308
|
-
let
|
|
309
|
-
for (; (
|
|
308
|
+
let l = -1;
|
|
309
|
+
for (; (l = i.data.indexOf(y, l + 1)) !== -1; ) a.push({ type: 7, index: o }), l += y.length - 1;
|
|
310
310
|
}
|
|
311
311
|
o++;
|
|
312
312
|
}
|
|
@@ -316,13 +316,13 @@ class L {
|
|
|
316
316
|
return r.innerHTML = t, r;
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
if (t ===
|
|
319
|
+
function P(s, t, e = s, r) {
|
|
320
|
+
if (t === C) return t;
|
|
321
321
|
let i = r !== void 0 ? e._$Co?.[r] : e._$Cl;
|
|
322
|
-
const o =
|
|
323
|
-
return i?.constructor !== o && (i?._$AO?.(!1), o === void 0 ? i = void 0 : (i = new o(s), i._$AT(s, e, r)), r !== void 0 ? (e._$Co ??= [])[r] = i : e._$Cl = i), i !== void 0 && (t =
|
|
322
|
+
const o = j(t) ? void 0 : t._$litDirective$;
|
|
323
|
+
return i?.constructor !== o && (i?._$AO?.(!1), o === void 0 ? i = void 0 : (i = new o(s), i._$AT(s, e, r)), r !== void 0 ? (e._$Co ??= [])[r] = i : e._$Cl = i), i !== void 0 && (t = P(s, i._$AS(s, t.values), i, r)), t;
|
|
324
324
|
}
|
|
325
|
-
class
|
|
325
|
+
class ee {
|
|
326
326
|
constructor(t, e) {
|
|
327
327
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
328
328
|
}
|
|
@@ -338,8 +338,8 @@ class ie {
|
|
|
338
338
|
let o = A.nextNode(), n = 0, h = 0, a = r[0];
|
|
339
339
|
for (; a !== void 0; ) {
|
|
340
340
|
if (n === a.index) {
|
|
341
|
-
let
|
|
342
|
-
a.type === 2 ?
|
|
341
|
+
let u;
|
|
342
|
+
a.type === 2 ? u = new U(o, o.nextSibling, this, t) : a.type === 1 ? u = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (u = new oe(o, this, t)), this._$AV.push(u), a = r[++h];
|
|
343
343
|
}
|
|
344
344
|
n !== a?.index && (o = A.nextNode(), n++);
|
|
345
345
|
}
|
|
@@ -369,7 +369,7 @@ class U {
|
|
|
369
369
|
return this._$AB;
|
|
370
370
|
}
|
|
371
371
|
_$AI(t, e = this) {
|
|
372
|
-
t =
|
|
372
|
+
t = P(this, t, e), j(t) ? t === c || t == null || t === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : t !== this._$AH && t !== C && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Qt(t) ? this.k(t) : this._(t);
|
|
373
373
|
}
|
|
374
374
|
O(t) {
|
|
375
375
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -378,13 +378,13 @@ class U {
|
|
|
378
378
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
379
379
|
}
|
|
380
380
|
_(t) {
|
|
381
|
-
this._$AH !== c &&
|
|
381
|
+
this._$AH !== c && j(this._$AH) ? this._$AA.nextSibling.data = t : this.T(w.createTextNode(t)), this._$AH = t;
|
|
382
382
|
}
|
|
383
383
|
$(t) {
|
|
384
|
-
const { values: e, _$litType$: r } = t, i = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = L.createElement(
|
|
384
|
+
const { values: e, _$litType$: r } = t, i = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = L.createElement(xt(r.h, r.h[0]), this.options)), r);
|
|
385
385
|
if (this._$AH?._$AD === i) this._$AH.p(e);
|
|
386
386
|
else {
|
|
387
|
-
const o = new
|
|
387
|
+
const o = new ee(i, this), n = o.u(this.options);
|
|
388
388
|
o.p(e), this.T(n), this._$AH = o;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
@@ -422,11 +422,11 @@ class F {
|
|
|
422
422
|
_$AI(t, e = this, r, i) {
|
|
423
423
|
const o = this.strings;
|
|
424
424
|
let n = !1;
|
|
425
|
-
if (o === void 0) t =
|
|
425
|
+
if (o === void 0) t = P(this, t, e, 0), n = !j(t) || t !== this._$AH && t !== C, n && (this._$AH = t);
|
|
426
426
|
else {
|
|
427
427
|
const h = t;
|
|
428
|
-
let a,
|
|
429
|
-
for (t = o[0], a = 0; a < o.length - 1; a++)
|
|
428
|
+
let a, u;
|
|
429
|
+
for (t = o[0], a = 0; a < o.length - 1; a++) u = P(this, h[r + a], e, a), u === C && (u = this._$AH[a]), n ||= !j(u) || u !== this._$AH[a], u === c ? t = c : t !== c && (t += (u ?? "") + o[a + 1]), this._$AH[a] = u;
|
|
430
430
|
}
|
|
431
431
|
n && !i && this.j(t);
|
|
432
432
|
}
|
|
@@ -434,7 +434,7 @@ class F {
|
|
|
434
434
|
t === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
class
|
|
437
|
+
class se extends F {
|
|
438
438
|
constructor() {
|
|
439
439
|
super(...arguments), this.type = 3;
|
|
440
440
|
}
|
|
@@ -442,7 +442,7 @@ class re extends F {
|
|
|
442
442
|
this.element[this.name] = t === c ? void 0 : t;
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
class
|
|
445
|
+
class ie extends F {
|
|
446
446
|
constructor() {
|
|
447
447
|
super(...arguments), this.type = 4;
|
|
448
448
|
}
|
|
@@ -450,12 +450,12 @@ class oe extends F {
|
|
|
450
450
|
this.element.toggleAttribute(this.name, !!t && t !== c);
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
class
|
|
453
|
+
class re extends F {
|
|
454
454
|
constructor(t, e, r, i, o) {
|
|
455
455
|
super(t, e, r, i, o), this.type = 5;
|
|
456
456
|
}
|
|
457
457
|
_$AI(t, e = this) {
|
|
458
|
-
if ((t =
|
|
458
|
+
if ((t = P(this, t, e, 0) ?? c) === C) return;
|
|
459
459
|
const r = this._$AH, i = t === c && r !== c || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, o = t !== c && (r === c || i);
|
|
460
460
|
i && this.element.removeEventListener(this.name, this, r), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
461
461
|
}
|
|
@@ -463,7 +463,7 @@ class ne extends F {
|
|
|
463
463
|
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class oe {
|
|
467
467
|
constructor(t, e, r) {
|
|
468
468
|
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = r;
|
|
469
469
|
}
|
|
@@ -471,12 +471,12 @@ class ae {
|
|
|
471
471
|
return this._$AM._$AU;
|
|
472
472
|
}
|
|
473
473
|
_$AI(t) {
|
|
474
|
-
|
|
474
|
+
P(this, t);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
const
|
|
477
|
+
const ne = it.litHtmlPolyfillSupport;
|
|
478
|
+
ne?.(L, U), (it.litHtmlVersions ??= []).push("3.3.0");
|
|
479
|
+
const ae = (s, t, e) => {
|
|
480
480
|
const r = e?.renderBefore ?? t;
|
|
481
481
|
let i = r._$litPart$;
|
|
482
482
|
if (i === void 0) {
|
|
@@ -501,7 +501,7 @@ let S = class extends E {
|
|
|
501
501
|
}
|
|
502
502
|
update(t) {
|
|
503
503
|
const e = this.render();
|
|
504
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do =
|
|
504
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = ae(e, this.renderRoot, this.renderOptions);
|
|
505
505
|
}
|
|
506
506
|
connectedCallback() {
|
|
507
507
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -510,12 +510,12 @@ let S = class extends E {
|
|
|
510
510
|
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
511
511
|
}
|
|
512
512
|
render() {
|
|
513
|
-
return
|
|
513
|
+
return C;
|
|
514
514
|
}
|
|
515
515
|
};
|
|
516
516
|
S._$litElement$ = !0, S.finalized = !0, ot.litElementHydrateSupport?.({ LitElement: S });
|
|
517
|
-
const
|
|
518
|
-
|
|
517
|
+
const he = ot.litElementPolyfillSupport;
|
|
518
|
+
he?.({ LitElement: S });
|
|
519
519
|
(ot.litElementVersions ??= []).push("4.2.0");
|
|
520
520
|
/**
|
|
521
521
|
* @license
|
|
@@ -532,7 +532,7 @@ const nt = (s) => (t, e) => {
|
|
|
532
532
|
* Copyright 2017 Google LLC
|
|
533
533
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
534
534
|
*/
|
|
535
|
-
const
|
|
535
|
+
const le = { attribute: !0, type: String, converter: D, reflect: !1, hasChanged: W }, ce = (s = le, t, e) => {
|
|
536
536
|
const { kind: r, metadata: i } = e;
|
|
537
537
|
let o = globalThis.litPropertyMetadata.get(i);
|
|
538
538
|
if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), r === "setter" && ((s = Object.create(s)).wrapped = !0), o.set(e.name, s), r === "accessor") {
|
|
@@ -554,7 +554,7 @@ const ue = { attribute: !0, type: String, converter: D, reflect: !1, hasChanged:
|
|
|
554
554
|
throw Error("Unsupported decorator location: " + r);
|
|
555
555
|
};
|
|
556
556
|
function p(s) {
|
|
557
|
-
return (t, e) => typeof e == "object" ?
|
|
557
|
+
return (t, e) => typeof e == "object" ? ce(s, t, e) : ((r, i, o) => {
|
|
558
558
|
const n = i.hasOwnProperty(o);
|
|
559
559
|
return i.constructor.createProperty(o, r), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
|
|
560
560
|
})(s, t, e);
|
|
@@ -572,8 +572,8 @@ function jt(s) {
|
|
|
572
572
|
* Copyright 2017 Google LLC
|
|
573
573
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
574
574
|
*/
|
|
575
|
-
const
|
|
576
|
-
class
|
|
575
|
+
const ue = Symbol();
|
|
576
|
+
class de {
|
|
577
577
|
get taskComplete() {
|
|
578
578
|
return this.t || (this.i === 1 ? this.t = new Promise((t, e) => {
|
|
579
579
|
this.o = t, this.h = e;
|
|
@@ -582,7 +582,7 @@ class fe {
|
|
|
582
582
|
constructor(t, e, r) {
|
|
583
583
|
this.p = 0, this.i = 0, (this._ = t).addController(this);
|
|
584
584
|
const i = typeof e == "object" ? e : { task: e, args: r };
|
|
585
|
-
this.v = i.task, this.j = i.args, this.m = i.argsEqual ??
|
|
585
|
+
this.v = i.task, this.j = i.args, this.m = i.argsEqual ?? pe, this.k = i.onComplete, this.A = i.onError, this.autoRun = i.autoRun ?? !0, "initialValue" in i && (this.u = i.initialValue, this.i = 2, this.O = this.T?.());
|
|
586
586
|
}
|
|
587
587
|
hostUpdate() {
|
|
588
588
|
this.autoRun === !0 && this.S();
|
|
@@ -612,7 +612,7 @@ class fe {
|
|
|
612
612
|
o = !0, r = n;
|
|
613
613
|
}
|
|
614
614
|
if (this.p === i) {
|
|
615
|
-
if (e ===
|
|
615
|
+
if (e === ue) this.i = 0;
|
|
616
616
|
else {
|
|
617
617
|
if (o === !1) {
|
|
618
618
|
try {
|
|
@@ -659,41 +659,29 @@ class fe {
|
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
const
|
|
662
|
+
const pe = (s, t) => s === t || s.length === t.length && s.every((e, r) => !W(e, t[r]));
|
|
663
663
|
!window.orbit && !"/".includes("cypress") && await new Promise((s) => {
|
|
664
664
|
document.addEventListener("orbit-ready", () => {
|
|
665
665
|
s(!0);
|
|
666
666
|
});
|
|
667
667
|
});
|
|
668
|
-
|
|
669
|
-
__proto__: null
|
|
670
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
671
|
-
var $e = Object.defineProperty, ge = (s, t, e, r) => {
|
|
668
|
+
var fe = Object.defineProperty, _e = (s, t, e, r) => {
|
|
672
669
|
for (var i = void 0, o = s.length - 1, n; o >= 0; o--)
|
|
673
670
|
(n = s[o]) && (i = n(t, e, i) || i);
|
|
674
|
-
return i &&
|
|
671
|
+
return i && fe(t, e, i), i;
|
|
675
672
|
};
|
|
676
|
-
const ye = Object.values(Lt);
|
|
677
673
|
class at extends S {
|
|
678
674
|
constructor() {
|
|
679
675
|
super(...arguments), this.objects = [], this.hasType = (t, e = this.objects) => new Set(e.flatMap((i) => i["@type"])).has(t);
|
|
680
676
|
}
|
|
681
|
-
renderTemplateWhenWith(t, e, r = this.objects) {
|
|
682
|
-
const i = (n, h) => Array.isArray(n) ? n.some((a) => h(a)) : h(n);
|
|
683
|
-
return t.filter(
|
|
684
|
-
(n) => i(n, (h) => ye.includes(h))
|
|
685
|
-
).every(
|
|
686
|
-
(n) => i(n, (h) => this.hasType(h, r))
|
|
687
|
-
) ? e.call(this) : c;
|
|
688
|
-
}
|
|
689
677
|
}
|
|
690
|
-
|
|
678
|
+
_e([
|
|
691
679
|
p({ attribute: !1 })
|
|
692
680
|
], at.prototype, "objects");
|
|
693
|
-
var
|
|
681
|
+
var $e = Object.defineProperty, v = (s, t, e, r) => {
|
|
694
682
|
for (var i = void 0, o = s.length - 1, n; o >= 0; o--)
|
|
695
683
|
(n = s[o]) && (i = n(t, e, i) || i);
|
|
696
|
-
return i &&
|
|
684
|
+
return i && $e(t, e, i), i;
|
|
697
685
|
};
|
|
698
686
|
class $ extends at {
|
|
699
687
|
constructor({
|
|
@@ -712,7 +700,7 @@ class $ extends at {
|
|
|
712
700
|
document.readyState !== "complete" ? document.addEventListener("DOMContentLoaded", i) : i();
|
|
713
701
|
}
|
|
714
702
|
async _attach(t, e, r) {
|
|
715
|
-
return !this.orbit && window.orbit && (this.orbit = window.orbit, e) ? (
|
|
703
|
+
return !this.orbit && window.orbit && (this.orbit = window.orbit, e) ? (ve({
|
|
716
704
|
component: this,
|
|
717
705
|
defaultRoute: t,
|
|
718
706
|
ignoreRouter: r
|
|
@@ -732,7 +720,7 @@ class $ extends at {
|
|
|
732
720
|
);
|
|
733
721
|
h && (r = h[0]?.uniq);
|
|
734
722
|
}
|
|
735
|
-
r &&
|
|
723
|
+
r && Ae(
|
|
736
724
|
(window.orbit ? window.orbit.getRoute(r, !0) : r) + (i ? `-${i}` : ""),
|
|
737
725
|
o
|
|
738
726
|
), t.preventDefault();
|
|
@@ -815,7 +803,7 @@ v([
|
|
|
815
803
|
v([
|
|
816
804
|
jt()
|
|
817
805
|
], $.prototype, "currentRoute");
|
|
818
|
-
const
|
|
806
|
+
const ge = (s, { keywords: t = [], attributes: e = ["dataSrc"] } = {}) => {
|
|
819
807
|
const r = () => {
|
|
820
808
|
t && e && (s.caching === void 0 && (s.caching = 0), s.hasCachedDatas === void 0 && (s.hasCachedDatas = !1), s.cacheListener = (i) => {
|
|
821
809
|
const o = i.detail.id || i.detail.resource["@id"];
|
|
@@ -828,15 +816,15 @@ const me = (s, { keywords: t = [], attributes: e = ["dataSrc"] } = {}) => {
|
|
|
828
816
|
};
|
|
829
817
|
document.readyState !== "complete" ? document.addEventListener("DOMContentLoaded", r) : r();
|
|
830
818
|
};
|
|
831
|
-
function
|
|
819
|
+
function ye() {
|
|
832
820
|
return Math.random().toString(16).slice(2);
|
|
833
821
|
}
|
|
834
|
-
const
|
|
822
|
+
const ve = ({
|
|
835
823
|
component: s,
|
|
836
824
|
defaultRoute: t = !1,
|
|
837
825
|
ignoreRouter: e = !1
|
|
838
826
|
}) => {
|
|
839
|
-
if (s.uniq || (s.uniq =
|
|
827
|
+
if (s.uniq || (s.uniq = ye(), t && !s.route && !e && (s.route = t)), s._subscriptions = /* @__PURE__ */ new Set(), !e) {
|
|
840
828
|
s.route || (s.route = s.uniq, window.orbit && (s.route = window.orbit.getRoute(s.uniq))), s.noRouter = !0;
|
|
841
829
|
let r = document.querySelector("solid-router");
|
|
842
830
|
for (; r; )
|
|
@@ -860,8 +848,8 @@ const Ae = ({
|
|
|
860
848
|
for (const r of s._subscriptions)
|
|
861
849
|
document.removeEventListener(r[0], r[1]);
|
|
862
850
|
}, s._subscribe();
|
|
863
|
-
}
|
|
864
|
-
class
|
|
851
|
+
};
|
|
852
|
+
class be extends S {
|
|
865
853
|
constructor() {
|
|
866
854
|
super(...arguments), this.object = {
|
|
867
855
|
"@id": ""
|
|
@@ -870,44 +858,15 @@ class we extends S {
|
|
|
870
858
|
return Array.isArray(r) ? r.includes(t) : typeof r == "string" ? r === t : !1;
|
|
871
859
|
};
|
|
872
860
|
}
|
|
873
|
-
getNestedProperty(t, e = this.object) {
|
|
874
|
-
return t.split(".").reduce((r, i) => {
|
|
875
|
-
if (r === void 0)
|
|
876
|
-
return;
|
|
877
|
-
const o = i.match(/(.*)\[(.*)\]/);
|
|
878
|
-
if (o) {
|
|
879
|
-
const n = o[1], h = o[2], a = r[n];
|
|
880
|
-
if (!Array.isArray(a))
|
|
881
|
-
return;
|
|
882
|
-
if (h === "")
|
|
883
|
-
return a.length > 0 ? a : void 0;
|
|
884
|
-
const l = Number.parseInt(h, 10);
|
|
885
|
-
return Number.isNaN(l) || l < 0 || l >= a.length ? void 0 : r[n][l];
|
|
886
|
-
}
|
|
887
|
-
return r && r[i] !== "undefined" ? r[i] : void 0;
|
|
888
|
-
}, e);
|
|
889
|
-
}
|
|
890
|
-
renderTemplateWhenWith(t, e, r = this.object) {
|
|
891
|
-
const i = (h, a) => Array.isArray(h) ? h.some((l) => a(l)) : a(h), o = t.filter(
|
|
892
|
-
(h) => i(h, (a) => vt.includes(a))
|
|
893
|
-
);
|
|
894
|
-
return t.filter(
|
|
895
|
-
(h) => i(h, (a) => !vt.includes(a))
|
|
896
|
-
).every(
|
|
897
|
-
(h) => i(h, (a) => this.getNestedProperty(a, r))
|
|
898
|
-
) && o.every(
|
|
899
|
-
(h) => i(h, (a) => this.isType(a, r))
|
|
900
|
-
) ? e.call(this) : c;
|
|
901
|
-
}
|
|
902
861
|
}
|
|
903
|
-
const
|
|
862
|
+
const vt = (s, t) => {
|
|
904
863
|
let e = s;
|
|
905
864
|
for (let r = 0; r < t.length && (e && t[r] in e); r++)
|
|
906
865
|
e = e[t[r]];
|
|
907
866
|
return e;
|
|
908
|
-
},
|
|
867
|
+
}, me = (s, t, e = "asc") => s.sort((r, i) => {
|
|
909
868
|
let o = r, n = i;
|
|
910
|
-
Array.isArray(t) ? (o =
|
|
869
|
+
Array.isArray(t) ? (o = vt(r, t), n = vt(i, t)) : (o = r[t], n = i[t]);
|
|
911
870
|
let h = 0;
|
|
912
871
|
if (typeof o == "number" && typeof n == "number")
|
|
913
872
|
h = o - n;
|
|
@@ -918,7 +877,7 @@ const mt = (s, t) => {
|
|
|
918
877
|
else
|
|
919
878
|
throw new TypeError(`Unsupported data type for key "${t}"`);
|
|
920
879
|
return e === "asc" ? h : -h;
|
|
921
|
-
}),
|
|
880
|
+
}), Ae = (s, t = !1) => {
|
|
922
881
|
window.dispatchEvent(
|
|
923
882
|
new CustomEvent("requestNavigation", {
|
|
924
883
|
detail: {
|
|
@@ -928,8 +887,8 @@ const mt = (s, t) => {
|
|
|
928
887
|
})
|
|
929
888
|
);
|
|
930
889
|
}, bt = {};
|
|
931
|
-
var
|
|
932
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
890
|
+
var we = Object.getOwnPropertyDescriptor, Ee = (s, t, e, r) => {
|
|
891
|
+
for (var i = r > 1 ? void 0 : r ? we(t, e) : t, o = s.length - 1, n; o >= 0; o--)
|
|
933
892
|
(n = s[o]) && (i = n(i) || i);
|
|
934
893
|
return i;
|
|
935
894
|
};
|
|
@@ -937,28 +896,28 @@ let Z = class extends $ {
|
|
|
937
896
|
constructor() {
|
|
938
897
|
super(...arguments), this.cherryPickedProperties = [
|
|
939
898
|
{ key: "name", value: "name" }
|
|
940
|
-
], this._getResource = new
|
|
899
|
+
], this._getResource = new de(this, {
|
|
941
900
|
task: async ([s]) => {
|
|
942
901
|
if (!(!s || !this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))) {
|
|
943
902
|
if (!this.hasCachedDatas || this.oldDataSrc !== s) {
|
|
944
903
|
if (!s) return;
|
|
945
904
|
this.datas = await this._getProxyValue(s), this.hasCachedDatas = !0;
|
|
946
905
|
}
|
|
947
|
-
return this.oldDataSrc !== s && (this.oldDataSrc = s),
|
|
906
|
+
return this.oldDataSrc !== s && (this.oldDataSrc = s), me(this.datas, "name", "asc");
|
|
948
907
|
}
|
|
949
908
|
},
|
|
950
909
|
args: () => [this.dataSrc, this.caching, this.currentRoute]
|
|
951
910
|
});
|
|
952
911
|
}
|
|
953
912
|
async _afterAttach() {
|
|
954
|
-
return
|
|
913
|
+
return ge(this, {
|
|
955
914
|
keywords: ["some-keyword", "for-invalidating", "cache"]
|
|
956
915
|
}), Promise.resolve();
|
|
957
916
|
}
|
|
958
917
|
render() {
|
|
959
918
|
return this.gatekeeper() || this._getResource.render({
|
|
960
|
-
pending: () =>
|
|
961
|
-
complete: (s) => s ?
|
|
919
|
+
pending: () => T`<solid-loader></solid-loader>`,
|
|
920
|
+
complete: (s) => s ? T`<div>
|
|
962
921
|
<sample-objects .objects=${s}></sample-objects>
|
|
963
922
|
</div>` : c
|
|
964
923
|
});
|
|
@@ -974,7 +933,7 @@ Z.styles = st`
|
|
|
974
933
|
bottom: 0;
|
|
975
934
|
}
|
|
976
935
|
`;
|
|
977
|
-
Z =
|
|
936
|
+
Z = Ee([
|
|
978
937
|
nt("solid-boilerplate")
|
|
979
938
|
], Z);
|
|
980
939
|
/**
|
|
@@ -988,11 +947,11 @@ const G = "lit-localize-status";
|
|
|
988
947
|
* Copyright 2021 Google LLC
|
|
989
948
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
990
949
|
*/
|
|
991
|
-
const
|
|
950
|
+
const Se = (s, ...t) => ({
|
|
992
951
|
strTag: !0,
|
|
993
952
|
strings: s,
|
|
994
953
|
values: t
|
|
995
|
-
}),
|
|
954
|
+
}), Ce = Se, Pe = (s) => typeof s != "string" && "strTag" in s, Tt = (s, t, e) => {
|
|
996
955
|
let r = s[0];
|
|
997
956
|
for (let i = 1; i < s.length; i++)
|
|
998
957
|
r += t[e ? e[i - 1] : i - 1], r += s[i];
|
|
@@ -1003,19 +962,19 @@ const Re = (s, ...t) => ({
|
|
|
1003
962
|
* Copyright 2021 Google LLC
|
|
1004
963
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1005
964
|
*/
|
|
1006
|
-
const
|
|
1007
|
-
let ht =
|
|
1008
|
-
function
|
|
1009
|
-
if (
|
|
965
|
+
const Lt = (s) => Pe(s) ? Tt(s.strings, s.values) : s;
|
|
966
|
+
let ht = Lt, mt = !1;
|
|
967
|
+
function Re(s) {
|
|
968
|
+
if (mt)
|
|
1010
969
|
throw new Error("lit-localize can only be configured once");
|
|
1011
|
-
ht = s,
|
|
970
|
+
ht = s, mt = !0;
|
|
1012
971
|
}
|
|
1013
972
|
/**
|
|
1014
973
|
* @license
|
|
1015
974
|
* Copyright 2021 Google LLC
|
|
1016
975
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1017
976
|
*/
|
|
1018
|
-
class
|
|
977
|
+
class Oe {
|
|
1019
978
|
constructor(t) {
|
|
1020
979
|
this.__litLocalizeEventHandler = (e) => {
|
|
1021
980
|
e.detail.status === "ready" && this.host.requestUpdate();
|
|
@@ -1028,19 +987,19 @@ class je {
|
|
|
1028
987
|
window.removeEventListener(G, this.__litLocalizeEventHandler);
|
|
1029
988
|
}
|
|
1030
989
|
}
|
|
1031
|
-
const
|
|
990
|
+
const xe = (s) => s.addController(new Oe(s)), je = xe;
|
|
1032
991
|
/**
|
|
1033
992
|
* @license
|
|
1034
993
|
* Copyright 2021 Google LLC
|
|
1035
994
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1036
995
|
*/
|
|
1037
|
-
const
|
|
996
|
+
const Ut = () => (s, t) => (s.addInitializer(je), s);
|
|
1038
997
|
/**
|
|
1039
998
|
* @license
|
|
1040
999
|
* Copyright 2020 Google LLC
|
|
1041
1000
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1042
1001
|
*/
|
|
1043
|
-
class
|
|
1002
|
+
class Mt {
|
|
1044
1003
|
constructor() {
|
|
1045
1004
|
this.settled = !1, this.promise = new Promise((t, e) => {
|
|
1046
1005
|
this._resolve = t, this._reject = e;
|
|
@@ -1061,10 +1020,10 @@ class Ht {
|
|
|
1061
1020
|
const _ = [];
|
|
1062
1021
|
for (let s = 0; s < 256; s++)
|
|
1063
1022
|
_[s] = (s >> 4 & 15).toString(16) + (s & 15).toString(16);
|
|
1064
|
-
function
|
|
1023
|
+
function Te(s) {
|
|
1065
1024
|
let t = 0, e = 8997, r = 0, i = 33826, o = 0, n = 40164, h = 0, a = 52210;
|
|
1066
|
-
for (let
|
|
1067
|
-
e ^= s.charCodeAt(
|
|
1025
|
+
for (let u = 0; u < s.length; u++)
|
|
1026
|
+
e ^= s.charCodeAt(u), t = e * 435, r = i * 435, o = n * 435, h = a * 435, o += e << 8, h += i << 8, r += t >>> 16, e = t & 65535, o += r >>> 16, i = r & 65535, a = h + (o >>> 16) & 65535, n = o & 65535;
|
|
1068
1027
|
return _[a >> 8] + _[a & 255] + _[n >> 8] + _[n & 255] + _[i >> 8] + _[i & 255] + _[e >> 8] + _[e & 255];
|
|
1069
1028
|
}
|
|
1070
1029
|
/**
|
|
@@ -1072,24 +1031,24 @@ function Me(s) {
|
|
|
1072
1031
|
* Copyright 2020 Google LLC
|
|
1073
1032
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1074
1033
|
*/
|
|
1075
|
-
const
|
|
1076
|
-
function
|
|
1077
|
-
return (t ?
|
|
1034
|
+
const Le = "", Ue = "h", Me = "s";
|
|
1035
|
+
function He(s, t) {
|
|
1036
|
+
return (t ? Ue : Me) + Te(typeof s == "string" ? s : s.join(Le));
|
|
1078
1037
|
}
|
|
1079
1038
|
/**
|
|
1080
1039
|
* @license
|
|
1081
1040
|
* Copyright 2021 Google LLC
|
|
1082
1041
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1083
1042
|
*/
|
|
1084
|
-
const
|
|
1085
|
-
function
|
|
1043
|
+
const At = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new Map();
|
|
1044
|
+
function Ne(s, t, e) {
|
|
1086
1045
|
if (s) {
|
|
1087
|
-
const r = e?.id ??
|
|
1046
|
+
const r = e?.id ?? De(t), i = s[r];
|
|
1088
1047
|
if (i) {
|
|
1089
1048
|
if (typeof i == "string")
|
|
1090
1049
|
return i;
|
|
1091
1050
|
if ("strTag" in i)
|
|
1092
|
-
return
|
|
1051
|
+
return Tt(
|
|
1093
1052
|
i.strings,
|
|
1094
1053
|
// Cast `template` because its type wasn't automatically narrowed (but
|
|
1095
1054
|
// we know it must be the same type as `localized`).
|
|
@@ -1097,20 +1056,20 @@ function Ie(s, t, e) {
|
|
|
1097
1056
|
i.values
|
|
1098
1057
|
);
|
|
1099
1058
|
{
|
|
1100
|
-
let o =
|
|
1101
|
-
return o === void 0 && (o = i.values,
|
|
1059
|
+
let o = At.get(i);
|
|
1060
|
+
return o === void 0 && (o = i.values, At.set(i, o)), {
|
|
1102
1061
|
...i,
|
|
1103
1062
|
values: o.map((n) => t.values[n])
|
|
1104
1063
|
};
|
|
1105
1064
|
}
|
|
1106
1065
|
}
|
|
1107
1066
|
}
|
|
1108
|
-
return
|
|
1067
|
+
return Lt(t);
|
|
1109
1068
|
}
|
|
1110
|
-
function
|
|
1069
|
+
function De(s) {
|
|
1111
1070
|
const t = typeof s == "string" ? s : s.strings;
|
|
1112
|
-
let e =
|
|
1113
|
-
return e === void 0 && (e =
|
|
1071
|
+
let e = wt.get(t);
|
|
1072
|
+
return e === void 0 && (e = He(t, typeof s != "string" && !("strTag" in s)), wt.set(t, e)), e;
|
|
1114
1073
|
}
|
|
1115
1074
|
/**
|
|
1116
1075
|
* @license
|
|
@@ -1120,97 +1079,97 @@ function ke(s) {
|
|
|
1120
1079
|
function X(s) {
|
|
1121
1080
|
window.dispatchEvent(new CustomEvent(G, { detail: s }));
|
|
1122
1081
|
}
|
|
1123
|
-
let I = "", J,
|
|
1124
|
-
|
|
1125
|
-
let
|
|
1126
|
-
const
|
|
1082
|
+
let I = "", J, Ht, k, Q, Nt, m = new Mt();
|
|
1083
|
+
m.resolve();
|
|
1084
|
+
let H = 0;
|
|
1085
|
+
const qe = (s) => (Re((t, e) => Ne(Nt, t, e)), I = Ht = s.sourceLocale, k = new Set(s.targetLocales), k.add(s.sourceLocale), Q = s.loadLocale, { getLocale: Ie, setLocale: ke }), Ie = () => I, ke = (s) => {
|
|
1127
1086
|
if (s === (J ?? I))
|
|
1128
|
-
return
|
|
1087
|
+
return m.promise;
|
|
1129
1088
|
if (!k || !Q)
|
|
1130
1089
|
throw new Error("Internal error");
|
|
1131
1090
|
if (!k.has(s))
|
|
1132
1091
|
throw new Error("Invalid locale code");
|
|
1133
|
-
|
|
1134
|
-
const t =
|
|
1135
|
-
return J = s,
|
|
1092
|
+
H++;
|
|
1093
|
+
const t = H;
|
|
1094
|
+
return J = s, m.settled && (m = new Mt()), X({ status: "loading", loadingLocale: s }), (s === Ht ? (
|
|
1136
1095
|
// We could switch to the source locale synchronously, but we prefer to
|
|
1137
1096
|
// queue it on a microtask so that switching locales is consistently
|
|
1138
1097
|
// asynchronous.
|
|
1139
1098
|
Promise.resolve({ templates: void 0 })
|
|
1140
1099
|
) : Q(s)).then((r) => {
|
|
1141
|
-
|
|
1100
|
+
H === t && (I = s, J = void 0, Nt = r.templates, X({ status: "ready", readyLocale: s }), m.resolve());
|
|
1142
1101
|
}, (r) => {
|
|
1143
|
-
|
|
1102
|
+
H === t && (X({
|
|
1144
1103
|
status: "error",
|
|
1145
1104
|
errorLocale: s,
|
|
1146
1105
|
errorMessage: r.toString()
|
|
1147
|
-
}),
|
|
1148
|
-
}),
|
|
1149
|
-
},
|
|
1150
|
-
var
|
|
1151
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
1106
|
+
}), m.reject(r));
|
|
1107
|
+
}), m.promise;
|
|
1108
|
+
}, Dt = ":host{background-color:pink;user-select:none}";
|
|
1109
|
+
var ze = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, qt = (s, t, e, r) => {
|
|
1110
|
+
for (var i = r > 1 ? void 0 : r ? Ve(t, e) : t, o = s.length - 1, n; o >= 0; o--)
|
|
1152
1111
|
(n = s[o]) && (i = (r ? n(t, e, i) : n(i)) || i);
|
|
1153
|
-
return r && i &&
|
|
1112
|
+
return r && i && ze(t, e, i), i;
|
|
1154
1113
|
};
|
|
1155
|
-
let z = class extends
|
|
1114
|
+
let z = class extends be {
|
|
1156
1115
|
constructor() {
|
|
1157
1116
|
super(...arguments), this.object = { "@id": "" };
|
|
1158
1117
|
}
|
|
1159
1118
|
render() {
|
|
1160
|
-
return this.isType("some:Type") ? c :
|
|
1161
|
-
${ht(
|
|
1119
|
+
return this.isType("some:Type") ? c : T`<li>
|
|
1120
|
+
${ht(Ce`Sample object named: ${this.object.name}`)}
|
|
1162
1121
|
</li>`;
|
|
1163
1122
|
}
|
|
1164
1123
|
};
|
|
1165
1124
|
z.styles = st`
|
|
1166
|
-
${et(
|
|
1125
|
+
${et(Dt)}
|
|
1167
1126
|
`;
|
|
1168
|
-
|
|
1127
|
+
qt([
|
|
1169
1128
|
p({ attribute: !1, type: Object })
|
|
1170
1129
|
], z.prototype, "object", 2);
|
|
1171
|
-
z =
|
|
1130
|
+
z = qt([
|
|
1172
1131
|
nt("sample-object"),
|
|
1173
|
-
|
|
1132
|
+
Ut()
|
|
1174
1133
|
], z);
|
|
1175
|
-
var
|
|
1176
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
1134
|
+
var Be = Object.defineProperty, We = Object.getOwnPropertyDescriptor, It = (s, t, e, r) => {
|
|
1135
|
+
for (var i = r > 1 ? void 0 : r ? We(t, e) : t, o = s.length - 1, n; o >= 0; o--)
|
|
1177
1136
|
(n = s[o]) && (i = (r ? n(t, e, i) : n(i)) || i);
|
|
1178
|
-
return r && i &&
|
|
1137
|
+
return r && i && Be(t, e, i), i;
|
|
1179
1138
|
};
|
|
1180
1139
|
let V = class extends at {
|
|
1181
1140
|
constructor() {
|
|
1182
1141
|
super(...arguments), this.objects = [];
|
|
1183
1142
|
}
|
|
1184
1143
|
render() {
|
|
1185
|
-
return this.hasType("some:Type") ? c :
|
|
1144
|
+
return this.hasType("some:Type") ? c : T`${ht("Here are all of our objects:")}<br />
|
|
1186
1145
|
<ul>
|
|
1187
1146
|
${this.objects.map(
|
|
1188
|
-
(s) =>
|
|
1147
|
+
(s) => T`<sample-object .object=${s}></sample-object>`
|
|
1189
1148
|
)}
|
|
1190
1149
|
</ul>`;
|
|
1191
1150
|
}
|
|
1192
1151
|
};
|
|
1193
1152
|
V.styles = st`
|
|
1194
|
-
${et(
|
|
1153
|
+
${et(Dt)}
|
|
1195
1154
|
`;
|
|
1196
|
-
|
|
1155
|
+
It([
|
|
1197
1156
|
p({ attribute: !1, type: Object })
|
|
1198
1157
|
], V.prototype, "objects", 2);
|
|
1199
|
-
V =
|
|
1158
|
+
V = It([
|
|
1200
1159
|
nt("sample-objects"),
|
|
1201
|
-
|
|
1160
|
+
Ut()
|
|
1202
1161
|
], V);
|
|
1203
|
-
const
|
|
1162
|
+
const Fe = "en", kt = [
|
|
1204
1163
|
"en"
|
|
1205
|
-
],
|
|
1206
|
-
|
|
1164
|
+
], Ke = /* @__PURE__ */ Object.assign({}), Xe = new Map(
|
|
1165
|
+
kt.map((s) => [
|
|
1207
1166
|
s,
|
|
1208
|
-
|
|
1167
|
+
Ke[`../generated/locales/${s}.ts`]
|
|
1209
1168
|
])
|
|
1210
|
-
), { getLocale:
|
|
1211
|
-
sourceLocale:
|
|
1212
|
-
targetLocales:
|
|
1213
|
-
loadLocale: async (s) =>
|
|
1169
|
+
), { getLocale: Et, setLocale: St } = qe({
|
|
1170
|
+
sourceLocale: Fe,
|
|
1171
|
+
targetLocales: kt,
|
|
1172
|
+
loadLocale: async (s) => Xe.get(s)
|
|
1214
1173
|
});
|
|
1215
|
-
window.getLocale = window.getLocale ? window.getLocale.push(
|
|
1216
|
-
window.setLocale = window.setLocale ? window.setLocale.push(
|
|
1174
|
+
window.getLocale = window.getLocale ? window.getLocale.push(Et) : [Et];
|
|
1175
|
+
window.setLocale = window.setLocale ? window.setLocale.push(St) : [St];
|
package/package.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
LimitedResource,
|
|
3
3
|
Resource,
|
|
4
|
-
TemplateResultOrSymbol,
|
|
5
4
|
} from "@src/component";
|
|
6
|
-
import { LitElement
|
|
7
|
-
|
|
8
|
-
import * as rdf from "@src/initializer";
|
|
9
|
-
|
|
10
|
-
const rdfs = Object.values(rdf);
|
|
5
|
+
import { LitElement } from "lit";
|
|
11
6
|
|
|
12
7
|
export class ComponentObjectHandler extends LitElement {
|
|
13
8
|
object?: LimitedResource = {
|
|
@@ -24,77 +19,4 @@ export class ComponentObjectHandler extends LitElement {
|
|
|
24
19
|
}
|
|
25
20
|
return false;
|
|
26
21
|
};
|
|
27
|
-
|
|
28
|
-
private getNestedProperty(path: string, obj: Resource = (this.object as Resource)): any {
|
|
29
|
-
return path.split(".").reduce((subObj: any, key) => {
|
|
30
|
-
if (subObj === undefined) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const arrayMatch = key.match(/(.*)\[(.*)\]/);
|
|
35
|
-
if (arrayMatch) {
|
|
36
|
-
const baseKey = arrayMatch[1];
|
|
37
|
-
const index = arrayMatch[2];
|
|
38
|
-
|
|
39
|
-
const array = subObj[baseKey];
|
|
40
|
-
|
|
41
|
-
if (!Array.isArray(array)) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (index === "") {
|
|
46
|
-
if (array.length > 0) {
|
|
47
|
-
return array;
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const numericIndex = Number.parseInt(index, 10);
|
|
53
|
-
if (
|
|
54
|
-
Number.isNaN(numericIndex) ||
|
|
55
|
-
numericIndex < 0 ||
|
|
56
|
-
numericIndex >= array.length
|
|
57
|
-
) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return subObj[baseKey][numericIndex];
|
|
62
|
-
}
|
|
63
|
-
return subObj && subObj[key] !== "undefined" ? subObj[key] : undefined;
|
|
64
|
-
}, obj);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
renderTemplateWhenWith(
|
|
68
|
-
requiredProperties: (string | string[])[],
|
|
69
|
-
template: () => TemplateResultOrSymbol,
|
|
70
|
-
obj: Resource = (this.object as Resource)
|
|
71
|
-
): TemplateResultOrSymbol {
|
|
72
|
-
const tester = (
|
|
73
|
-
property: string | string[],
|
|
74
|
-
cb: (some: string) => boolean
|
|
75
|
-
) =>
|
|
76
|
-
Array.isArray(property)
|
|
77
|
-
? property.some((subProp) => cb(subProp))
|
|
78
|
-
: cb(property);
|
|
79
|
-
|
|
80
|
-
const typeProperties = requiredProperties.filter((property) =>
|
|
81
|
-
tester(property, (p) => rdfs.includes(p))
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const keyProperties = requiredProperties.filter((property) =>
|
|
85
|
-
tester(property, (p) => !rdfs.includes(p))
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
keyProperties.every((property) =>
|
|
90
|
-
tester(property, (p) => this.getNestedProperty(p, obj))
|
|
91
|
-
) &&
|
|
92
|
-
typeProperties.every((property) =>
|
|
93
|
-
tester(property, (p) => this.isType(p, obj))
|
|
94
|
-
)
|
|
95
|
-
) {
|
|
96
|
-
return template.call(this);
|
|
97
|
-
}
|
|
98
|
-
return nothing;
|
|
99
|
-
}
|
|
100
22
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type { Resource
|
|
2
|
-
import { LitElement
|
|
1
|
+
import type { Resource } from "@src/component";
|
|
2
|
+
import { LitElement } from "lit";
|
|
3
3
|
|
|
4
|
-
import * as rdf from "@src/initializer";
|
|
5
4
|
import { property } from "lit/decorators.js";
|
|
6
5
|
|
|
7
|
-
const rdfs = Object.values(rdf);
|
|
8
|
-
|
|
9
6
|
export class ComponentObjectsHandler extends LitElement {
|
|
10
7
|
@property({ attribute: false })
|
|
11
8
|
objects?: Resource[] = [];
|
|
@@ -14,31 +11,4 @@ export class ComponentObjectsHandler extends LitElement {
|
|
|
14
11
|
const typeValue = new Set(objs.flatMap((o) => o["@type"]));
|
|
15
12
|
return typeValue.has(type);
|
|
16
13
|
};
|
|
17
|
-
|
|
18
|
-
renderTemplateWhenWith(
|
|
19
|
-
requiredProperties: (string | string[])[],
|
|
20
|
-
template: () => TemplateResultOrSymbol,
|
|
21
|
-
objs: Resource[] = this.objects as Resource[]
|
|
22
|
-
): TemplateResultOrSymbol {
|
|
23
|
-
const tester = (
|
|
24
|
-
property: string | string[],
|
|
25
|
-
cb: (some: string) => boolean
|
|
26
|
-
) =>
|
|
27
|
-
Array.isArray(property)
|
|
28
|
-
? property.some((subProp) => cb(subProp))
|
|
29
|
-
: cb(property);
|
|
30
|
-
|
|
31
|
-
const typeProperties = requiredProperties.filter((property) =>
|
|
32
|
-
tester(property, (p) => rdfs.includes(p))
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
typeProperties.every((property) =>
|
|
37
|
-
tester(property, (p) => this.hasType(p, objs))
|
|
38
|
-
)
|
|
39
|
-
) {
|
|
40
|
-
return template.call(this);
|
|
41
|
-
}
|
|
42
|
-
return nothing;
|
|
43
|
-
}
|
|
44
14
|
}
|