@startinblox/boilerplate 3.0.4 → 3.0.6
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
|
|
|
@@ -143,12 +144,10 @@ async _afterAttach() {
|
|
|
143
144
|
### `ObjectsHandler` methods
|
|
144
145
|
|
|
145
146
|
* `hasType(type)`: Checks if any object within `this.objects` shares the requested type, returning a boolean.
|
|
146
|
-
* `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.
|
|
147
147
|
|
|
148
148
|
### `ObjectHandler` methods
|
|
149
149
|
|
|
150
150
|
* `isType(type)`: Checks if the object shares the requested type, returning a boolean.
|
|
151
|
-
* `renderTemplateWhenWith`: Functions identically to the `ObjectsHandler` method but applies to a single object.
|
|
152
151
|
|
|
153
152
|
### Available helpers
|
|
154
153
|
|
|
@@ -202,13 +201,19 @@ This project utilizes [`@lit/localize`](https://www.npmjs.com/package/@lit/local
|
|
|
202
201
|
To change the locale at runtime within an application:
|
|
203
202
|
|
|
204
203
|
```javascript
|
|
204
|
+
// With Orbit:
|
|
205
205
|
window.setLocale.map((setLocale) => setLocale("your-lang-code"));
|
|
206
|
+
// Without Orbit:
|
|
207
|
+
window.setLocale("your-lang-code");
|
|
206
208
|
```
|
|
207
209
|
|
|
208
210
|
To retrieve the current locale:
|
|
209
211
|
|
|
210
212
|
```javascript
|
|
213
|
+
// With Orbit:
|
|
211
214
|
window.getLocale.map((locale) => console.log(locale));
|
|
215
|
+
// Without Orbit:
|
|
216
|
+
console.log(window.getLocale("your-lang-code"));
|
|
212
217
|
```
|
|
213
218
|
|
|
214
219
|
### Testing
|
package/dist/index.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
6
|
+
const N = globalThis, et = N.ShadowRoot && (N.ShadyCSS === void 0 || N.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, st = Symbol(), ut = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let Ct = class {
|
|
8
8
|
constructor(t, e, r) {
|
|
9
|
-
if (this._$cssResult$ = !0, r !==
|
|
9
|
+
if (this._$cssResult$ = !0, r !== st) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = t, this.t = e;
|
|
11
11
|
}
|
|
12
12
|
get styleSheet() {
|
|
13
13
|
let t = this.o;
|
|
14
14
|
const e = this.t;
|
|
15
|
-
if (
|
|
15
|
+
if (et && t === void 0) {
|
|
16
16
|
const r = e !== void 0 && e.length === 1;
|
|
17
|
-
r && (t =
|
|
17
|
+
r && (t = ut.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), r && ut.set(e, t));
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}
|
|
@@ -22,33 +22,33 @@ let Ct = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const it = (s) => new Ct(typeof s == "string" ? s : s + "", void 0, st), rt = (s, ...t) => {
|
|
26
26
|
const e = s.length === 1 ? s[0] : t.reduce((r, i, o) => r + ((n) => {
|
|
27
27
|
if (n._$cssResult$ === !0) return n.cssText;
|
|
28
28
|
if (typeof n == "number") return n;
|
|
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
|
-
return new Ct(e, s,
|
|
32
|
-
},
|
|
33
|
-
if (
|
|
31
|
+
return new Ct(e, s, st);
|
|
32
|
+
}, Vt = (s, t) => {
|
|
33
|
+
if (et) 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
|
+
}, dt = et ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let e = "";
|
|
40
40
|
for (const r of t.cssRules) e += r.cssText;
|
|
41
|
-
return
|
|
41
|
+
return it(e);
|
|
42
42
|
})(s) : s;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: Bt, defineProperty:
|
|
48
|
+
const { is: Bt, defineProperty: Wt, getOwnPropertyDescriptor: Ft, getOwnPropertyNames: Kt, getOwnPropertySymbols: Xt, getPrototypeOf: Jt } = Object, B = globalThis, pt = B.trustedTypes, Zt = pt ? pt.emptyScript : "", Gt = B.reactiveElementPolyfillSupport, O = (s, t) => s, D = { toAttribute(s, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
s = s ?
|
|
51
|
+
s = s ? Zt : 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) => !Bt(s, t), ft = { 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);
|
|
@@ -82,14 +82,14 @@ let E = class extends HTMLElement {
|
|
|
82
82
|
static get observedAttributes() {
|
|
83
83
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
84
|
}
|
|
85
|
-
static createProperty(t, e =
|
|
85
|
+
static createProperty(t, e = ft) {
|
|
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 && Wt(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 } = Ft(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[e];
|
|
94
94
|
}, set(n) {
|
|
95
95
|
this[e] = n;
|
|
@@ -100,17 +100,17 @@ let E = class extends HTMLElement {
|
|
|
100
100
|
}, configurable: !0, enumerable: !0 };
|
|
101
101
|
}
|
|
102
102
|
static getPropertyOptions(t) {
|
|
103
|
-
return this.elementProperties.get(t) ??
|
|
103
|
+
return this.elementProperties.get(t) ?? ft;
|
|
104
104
|
}
|
|
105
105
|
static _$Ei() {
|
|
106
|
-
if (this.hasOwnProperty(
|
|
107
|
-
const t =
|
|
106
|
+
if (this.hasOwnProperty(O("elementProperties"))) return;
|
|
107
|
+
const t = Jt(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 = [...Kt(e), ...Xt(e)];
|
|
114
114
|
for (const i of r) this.createProperty(i, e[i]);
|
|
115
115
|
}
|
|
116
116
|
const t = this[Symbol.metadata];
|
|
@@ -129,8 +129,8 @@ let E = class extends HTMLElement {
|
|
|
129
129
|
const e = [];
|
|
130
130
|
if (Array.isArray(t)) {
|
|
131
131
|
const r = new Set(t.flat(1 / 0).reverse());
|
|
132
|
-
for (const i of r) e.unshift(
|
|
133
|
-
} else t !== void 0 && e.push(
|
|
132
|
+
for (const i of r) e.unshift(dt(i));
|
|
133
|
+
} else t !== void 0 && e.push(dt(t));
|
|
134
134
|
return e;
|
|
135
135
|
}
|
|
136
136
|
static _$Eu(t, e) {
|
|
@@ -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 Vt(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,75 +254,75 @@ 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(), Gt?.({ 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
|
|
264
|
-
\f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
265
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
266
|
-
function
|
|
267
|
-
if (!
|
|
268
|
-
return
|
|
263
|
+
const ot = globalThis, q = ot.trustedTypes, _t = q ? q.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, Pt = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, Rt = "?" + y, Qt = `<${Rt}>`, A = document, j = () => A.createComment(""), x = (s) => s === null || typeof s != "object" && typeof s != "function", nt = Array.isArray, Yt = (s) => nt(s) || typeof s?.[Symbol.iterator] == "function", K = `[
|
|
264
|
+
\f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, $t = /-->/g, gt = />/g, b = RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
|
|
265
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), yt = /'/g, vt = /"/g, Ot = /^(?:script|style|textarea|title)$/i, te = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), T = te(1), C = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), bt = /* @__PURE__ */ new WeakMap(), w = A.createTreeWalker(A, 129);
|
|
266
|
+
function jt(s, t) {
|
|
267
|
+
if (!nt(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
268
|
+
return _t !== void 0 ? _t.createHTML(t) : t;
|
|
269
269
|
}
|
|
270
|
-
const
|
|
270
|
+
const ee = (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 =
|
|
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 = $t : d[1] !== void 0 ? n = gt : 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] === '"' ? vt : yt) : n === vt || n === yt ? n = b : n === $t || n === gt ? n = R : (n = b, i = void 0);
|
|
277
|
+
const g = n === b && s[h + 1].startsWith("/>") ? " " : "";
|
|
278
|
+
o += n === R ? a + Qt : 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 [jt(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] = ee(t, e);
|
|
288
|
+
if (this.el = L.createElement(u, r), w.currentNode = this.el.content, e === 2 || e === 3) {
|
|
289
|
+
const l = this.el.content.firstChild;
|
|
290
|
+
l.replaceWith(...l.childNodes);
|
|
291
291
|
}
|
|
292
|
-
for (; (i =
|
|
292
|
+
for (; (i = w.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] === "." ? ie : M[1] === "?" ? re : M[1] === "@" ? oe : 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], j()), w.nextNode(), a.push({ type: 2, index: ++o });
|
|
303
|
+
i.append(l[f], j());
|
|
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
|
}
|
|
313
313
|
}
|
|
314
314
|
static createElement(t, e) {
|
|
315
|
-
const r =
|
|
315
|
+
const r = A.createElement("template");
|
|
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 = x(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 se {
|
|
326
326
|
constructor(t, e) {
|
|
327
327
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
328
328
|
}
|
|
@@ -333,17 +333,17 @@ class ie {
|
|
|
333
333
|
return this._$AM._$AU;
|
|
334
334
|
}
|
|
335
335
|
u(t) {
|
|
336
|
-
const { el: { content: e }, parts: r } = this._$AD, i = (t?.creationScope ??
|
|
337
|
-
|
|
338
|
-
let o =
|
|
336
|
+
const { el: { content: e }, parts: r } = this._$AD, i = (t?.creationScope ?? A).importNode(e, !0);
|
|
337
|
+
w.currentNode = i;
|
|
338
|
+
let o = w.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 ne(o, this, t)), this._$AV.push(u), a = r[++h];
|
|
343
343
|
}
|
|
344
|
-
n !== a?.index && (o =
|
|
344
|
+
n !== a?.index && (o = w.nextNode(), n++);
|
|
345
345
|
}
|
|
346
|
-
return
|
|
346
|
+
return w.currentNode = A, i;
|
|
347
347
|
}
|
|
348
348
|
p(t) {
|
|
349
349
|
let e = 0;
|
|
@@ -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), x(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) : Yt(t) ? this.k(t) : this._(t);
|
|
373
373
|
}
|
|
374
374
|
O(t) {
|
|
375
375
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -378,25 +378,25 @@ 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 && x(this._$AH) ? this._$AA.nextSibling.data = t : this.T(A.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(jt(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 se(i, this), n = o.u(this.options);
|
|
388
388
|
o.p(e), this.T(n), this._$AH = o;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
_$AC(t) {
|
|
392
|
-
let e =
|
|
393
|
-
return e === void 0 &&
|
|
392
|
+
let e = bt.get(t.strings);
|
|
393
|
+
return e === void 0 && bt.set(t.strings, e = new L(t)), e;
|
|
394
394
|
}
|
|
395
395
|
k(t) {
|
|
396
|
-
|
|
396
|
+
nt(this._$AH) || (this._$AH = [], this._$AR());
|
|
397
397
|
const e = this._$AH;
|
|
398
398
|
let r, i = 0;
|
|
399
|
-
for (const o of t) i === e.length ? e.push(r = new U(this.O(
|
|
399
|
+
for (const o of t) i === e.length ? e.push(r = new U(this.O(j()), this.O(j()), this, this.options)) : r = e[i], r._$AI(o), i++;
|
|
400
400
|
i < e.length && (this._$AR(r && r._$AB.nextSibling, i), e.length = i);
|
|
401
401
|
}
|
|
402
402
|
_$AR(t = this._$AA.nextSibling, e) {
|
|
@@ -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 = !x(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 ||= !x(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 ie 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 re 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 oe 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 ne {
|
|
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,17 +471,17 @@ 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 ae = ot.litHtmlPolyfillSupport;
|
|
478
|
+
ae?.(L, U), (ot.litHtmlVersions ??= []).push("3.3.0");
|
|
479
|
+
const he = (s, t, e) => {
|
|
480
480
|
const r = e?.renderBefore ?? t;
|
|
481
481
|
let i = r._$litPart$;
|
|
482
482
|
if (i === void 0) {
|
|
483
483
|
const o = e?.renderBefore ?? null;
|
|
484
|
-
r._$litPart$ = i = new U(t.insertBefore(
|
|
484
|
+
r._$litPart$ = i = new U(t.insertBefore(j(), o), o, void 0, e ?? {});
|
|
485
485
|
}
|
|
486
486
|
return i._$AI(s), i;
|
|
487
487
|
};
|
|
@@ -490,7 +490,7 @@ const le = (s, t, e) => {
|
|
|
490
490
|
* Copyright 2017 Google LLC
|
|
491
491
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
492
492
|
*/
|
|
493
|
-
const
|
|
493
|
+
const at = globalThis;
|
|
494
494
|
let S = class extends E {
|
|
495
495
|
constructor() {
|
|
496
496
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = 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 = he(e, this.renderRoot, this.renderOptions);
|
|
505
505
|
}
|
|
506
506
|
connectedCallback() {
|
|
507
507
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -510,19 +510,19 @@ 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
|
-
S._$litElement$ = !0, S.finalized = !0,
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
(
|
|
516
|
+
S._$litElement$ = !0, S.finalized = !0, at.litElementHydrateSupport?.({ LitElement: S });
|
|
517
|
+
const le = at.litElementPolyfillSupport;
|
|
518
|
+
le?.({ LitElement: S });
|
|
519
|
+
(at.litElementVersions ??= []).push("4.2.0");
|
|
520
520
|
/**
|
|
521
521
|
* @license
|
|
522
522
|
* Copyright 2017 Google LLC
|
|
523
523
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
524
524
|
*/
|
|
525
|
-
const
|
|
525
|
+
const ht = (s) => (t, e) => {
|
|
526
526
|
e !== void 0 ? e.addInitializer(() => {
|
|
527
527
|
customElements.define(s, t);
|
|
528
528
|
}) : customElements.define(s, t);
|
|
@@ -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 ce = { attribute: !0, type: String, converter: D, reflect: !1, hasChanged: W }, ue = (s = ce, 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" ? ue(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);
|
|
@@ -564,7 +564,7 @@ function p(s) {
|
|
|
564
564
|
* Copyright 2017 Google LLC
|
|
565
565
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
566
566
|
*/
|
|
567
|
-
function
|
|
567
|
+
function xt(s) {
|
|
568
568
|
return p({ ...s, state: !0, attribute: !1 });
|
|
569
569
|
}
|
|
570
570
|
/**
|
|
@@ -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 de = Symbol();
|
|
576
|
+
class pe {
|
|
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 ?? fe, 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 === de) this.i = 0;
|
|
616
616
|
else {
|
|
617
617
|
if (o === !1) {
|
|
618
618
|
try {
|
|
@@ -659,43 +659,31 @@ class fe {
|
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
const
|
|
662
|
+
const fe = (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 _e = 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 && _e(t, e, i), i;
|
|
675
672
|
};
|
|
676
|
-
|
|
677
|
-
class at extends S {
|
|
673
|
+
class lt 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
|
-
],
|
|
693
|
-
var
|
|
680
|
+
], lt.prototype, "objects");
|
|
681
|
+
var ge = 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 && ge(t, e, i), i;
|
|
697
685
|
};
|
|
698
|
-
class $ extends
|
|
686
|
+
class $ extends lt {
|
|
699
687
|
constructor({
|
|
700
688
|
defaultRoute: t = !1,
|
|
701
689
|
setupSubscriptions: e = !0,
|
|
@@ -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) ? (be({
|
|
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();
|
|
@@ -767,9 +755,9 @@ class $ extends at {
|
|
|
767
755
|
try {
|
|
768
756
|
if (t) {
|
|
769
757
|
let i = t;
|
|
770
|
-
if (typeof t == "string" && (i = await window.sibStore.getData(t,
|
|
758
|
+
if (typeof t == "string" && (i = await window.sibStore.getData(t, wt)), typeof t != "string" && t.isFullResource && (t.isFullResource?.() || (i = await window.sibStore.getData(
|
|
771
759
|
t["@id"],
|
|
772
|
-
|
|
760
|
+
wt
|
|
773
761
|
))), typeof t != "string" && !t.isFullResource && (i.properties = Object.keys(i), i.get = (o) => i[o]), !i) return { _originalResource: i };
|
|
774
762
|
if (typeof i == "object" && i !== null) {
|
|
775
763
|
if (i["ldp:contains"]) {
|
|
@@ -810,12 +798,12 @@ v([
|
|
|
810
798
|
p({ attribute: !1 })
|
|
811
799
|
], $.prototype, "cherryPickedProperties");
|
|
812
800
|
v([
|
|
813
|
-
|
|
801
|
+
xt()
|
|
814
802
|
], $.prototype, "orbit");
|
|
815
803
|
v([
|
|
816
|
-
|
|
804
|
+
xt()
|
|
817
805
|
], $.prototype, "currentRoute");
|
|
818
|
-
const
|
|
806
|
+
const ye = (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 ve() {
|
|
832
820
|
return Math.random().toString(16).slice(2);
|
|
833
821
|
}
|
|
834
|
-
const
|
|
822
|
+
const be = ({
|
|
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 = ve(), 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 me extends S {
|
|
865
853
|
constructor() {
|
|
866
854
|
super(...arguments), this.object = {
|
|
867
855
|
"@id": ""
|
|
@@ -870,42 +858,13 @@ 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
862
|
const mt = (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
|
+
}, we = (s, t, e = "asc") => s.sort((r, i) => {
|
|
909
868
|
let o = r, n = i;
|
|
910
869
|
Array.isArray(t) ? (o = mt(r, t), n = mt(i, t)) : (o = r[t], n = i[t]);
|
|
911
870
|
let h = 0;
|
|
@@ -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: {
|
|
@@ -927,44 +886,44 @@ const mt = (s, t) => {
|
|
|
927
886
|
}
|
|
928
887
|
})
|
|
929
888
|
);
|
|
930
|
-
},
|
|
931
|
-
var
|
|
932
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
889
|
+
}, wt = {};
|
|
890
|
+
var Ee = Object.getOwnPropertyDescriptor, Se = (s, t, e, r) => {
|
|
891
|
+
for (var i = r > 1 ? void 0 : r ? Ee(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
|
};
|
|
936
|
-
let
|
|
895
|
+
let Q = 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 pe(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), we(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 ye(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
|
});
|
|
965
924
|
}
|
|
966
925
|
};
|
|
967
|
-
|
|
926
|
+
Q.styles = rt`
|
|
968
927
|
div {
|
|
969
928
|
background-color: red;
|
|
970
929
|
position: absolute;
|
|
@@ -974,25 +933,25 @@ Z.styles = st`
|
|
|
974
933
|
bottom: 0;
|
|
975
934
|
}
|
|
976
935
|
`;
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
],
|
|
936
|
+
Q = Se([
|
|
937
|
+
ht("solid-boilerplate")
|
|
938
|
+
], Q);
|
|
980
939
|
/**
|
|
981
940
|
* @license
|
|
982
941
|
* Copyright 2021 Google LLC
|
|
983
942
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
984
943
|
*/
|
|
985
|
-
const
|
|
944
|
+
const Y = "lit-localize-status";
|
|
986
945
|
/**
|
|
987
946
|
* @license
|
|
988
947
|
* Copyright 2021 Google LLC
|
|
989
948
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
990
949
|
*/
|
|
991
|
-
const
|
|
950
|
+
const Ce = (s, ...t) => ({
|
|
992
951
|
strTag: !0,
|
|
993
952
|
strings: s,
|
|
994
953
|
values: t
|
|
995
|
-
}),
|
|
954
|
+
}), Tt = Ce, Pe = (s) => typeof s != "string" && "strTag" in s, Lt = (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,38 +962,38 @@ const Re = (s, ...t) => ({
|
|
|
1003
962
|
* Copyright 2021 Google LLC
|
|
1004
963
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1005
964
|
*/
|
|
1006
|
-
const
|
|
1007
|
-
let
|
|
1008
|
-
function
|
|
965
|
+
const Ut = (s) => Pe(s) ? Lt(s.strings, s.values) : s;
|
|
966
|
+
let ct = Ut, At = !1;
|
|
967
|
+
function Re(s) {
|
|
1009
968
|
if (At)
|
|
1010
969
|
throw new Error("lit-localize can only be configured once");
|
|
1011
|
-
|
|
970
|
+
ct = s, At = !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();
|
|
1022
981
|
}, this.host = t;
|
|
1023
982
|
}
|
|
1024
983
|
hostConnected() {
|
|
1025
|
-
window.addEventListener(
|
|
984
|
+
window.addEventListener(Y, this.__litLocalizeEventHandler);
|
|
1026
985
|
}
|
|
1027
986
|
hostDisconnected() {
|
|
1028
|
-
window.removeEventListener(
|
|
987
|
+
window.removeEventListener(Y, this.__litLocalizeEventHandler);
|
|
1029
988
|
}
|
|
1030
989
|
}
|
|
1031
|
-
const
|
|
990
|
+
const je = (s) => s.addController(new Oe(s)), xe = je;
|
|
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 Mt = () => (s, t) => (s.addInitializer(xe), s);
|
|
1038
997
|
/**
|
|
1039
998
|
* @license
|
|
1040
999
|
* Copyright 2020 Google LLC
|
|
@@ -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 Et = /* @__PURE__ */ new WeakMap(), St = /* @__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 Lt(
|
|
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 = Et.get(i);
|
|
1060
|
+
return o === void 0 && (o = i.values, Et.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 Ut(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 = St.get(t);
|
|
1072
|
+
return e === void 0 && (e = He(t, typeof s != "string" && !("strTag" in s)), St.set(t, e)), e;
|
|
1114
1073
|
}
|
|
1115
1074
|
/**
|
|
1116
1075
|
* @license
|
|
@@ -1118,99 +1077,105 @@ function ke(s) {
|
|
|
1118
1077
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1119
1078
|
*/
|
|
1120
1079
|
function X(s) {
|
|
1121
|
-
window.dispatchEvent(new CustomEvent(
|
|
1080
|
+
window.dispatchEvent(new CustomEvent(Y, { detail: s }));
|
|
1122
1081
|
}
|
|
1123
|
-
let I = "", J,
|
|
1124
|
-
|
|
1125
|
-
let
|
|
1126
|
-
const
|
|
1082
|
+
let I = "", J, Nt, k, tt, Dt, m = new Ht();
|
|
1083
|
+
m.resolve();
|
|
1084
|
+
let H = 0;
|
|
1085
|
+
const qe = (s) => (Re((t, e) => Ne(Dt, t, e)), I = Nt = s.sourceLocale, k = new Set(s.targetLocales), k.add(s.sourceLocale), tt = s.loadLocale, { getLocale: Ie, setLocale: ke }), Ie = () => I, ke = (s) => {
|
|
1127
1086
|
if (s === (J ?? I))
|
|
1128
|
-
return
|
|
1129
|
-
if (!k || !
|
|
1087
|
+
return m.promise;
|
|
1088
|
+
if (!k || !tt)
|
|
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 Ht()), X({ status: "loading", loadingLocale: s }), (s === Nt ? (
|
|
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
|
-
) :
|
|
1141
|
-
|
|
1099
|
+
) : tt(s)).then((r) => {
|
|
1100
|
+
H === t && (I = s, J = void 0, Dt = 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
|
+
}, qt = ":host{background-color:pink;user-select:none}";
|
|
1109
|
+
var ze = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, It = (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 me {
|
|
1156
1115
|
constructor() {
|
|
1157
1116
|
super(...arguments), this.object = { "@id": "" };
|
|
1158
1117
|
}
|
|
1159
1118
|
render() {
|
|
1160
|
-
return this.isType("some:Type") ? c :
|
|
1161
|
-
${
|
|
1119
|
+
return this.isType("some:Type") ? c : T`<li>
|
|
1120
|
+
${ct(Tt`Sample object named: ${this.object.name}`)}
|
|
1162
1121
|
</li>`;
|
|
1163
1122
|
}
|
|
1164
1123
|
};
|
|
1165
|
-
z.styles =
|
|
1166
|
-
${
|
|
1124
|
+
z.styles = rt`
|
|
1125
|
+
${it(qt)}
|
|
1167
1126
|
`;
|
|
1168
|
-
|
|
1127
|
+
It([
|
|
1169
1128
|
p({ attribute: !1, type: Object })
|
|
1170
1129
|
], z.prototype, "object", 2);
|
|
1171
|
-
z =
|
|
1172
|
-
|
|
1173
|
-
|
|
1130
|
+
z = It([
|
|
1131
|
+
ht("sample-object"),
|
|
1132
|
+
Mt()
|
|
1174
1133
|
], z);
|
|
1175
|
-
var
|
|
1176
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
1134
|
+
var Be = Object.defineProperty, We = Object.getOwnPropertyDescriptor, kt = (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
|
-
let V = class extends
|
|
1139
|
+
let V = class extends lt {
|
|
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`${ct("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
|
-
V.styles =
|
|
1194
|
-
${
|
|
1152
|
+
V.styles = rt`
|
|
1153
|
+
${it(qt)}
|
|
1195
1154
|
`;
|
|
1196
|
-
|
|
1155
|
+
kt([
|
|
1197
1156
|
p({ attribute: !1, type: Object })
|
|
1198
1157
|
], V.prototype, "objects", 2);
|
|
1199
|
-
V =
|
|
1200
|
-
|
|
1201
|
-
|
|
1158
|
+
V = kt([
|
|
1159
|
+
ht("sample-objects"),
|
|
1160
|
+
Mt()
|
|
1202
1161
|
], V);
|
|
1203
|
-
const
|
|
1162
|
+
const Fe = {
|
|
1163
|
+
s9cb0b52fd65ea225: Tt`Sample object named: ${0}`,
|
|
1164
|
+
se975788b1544119d: "Here are all of our objects:"
|
|
1165
|
+
}, Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1166
|
+
__proto__: null,
|
|
1167
|
+
templates: Fe
|
|
1168
|
+
}, Symbol.toStringTag, { value: "Module" })), Xe = "en", zt = [
|
|
1204
1169
|
"en"
|
|
1205
|
-
],
|
|
1206
|
-
|
|
1170
|
+
], Je = /* @__PURE__ */ Object.assign({ "../../generated/locales/en.ts": Ke }), Ze = new Map(
|
|
1171
|
+
zt.map((s) => [
|
|
1207
1172
|
s,
|
|
1208
|
-
|
|
1173
|
+
Je[`../../generated/locales/${s}.ts`]
|
|
1209
1174
|
])
|
|
1210
|
-
), { getLocale:
|
|
1211
|
-
sourceLocale:
|
|
1212
|
-
targetLocales:
|
|
1213
|
-
loadLocale: async (s) =>
|
|
1175
|
+
), { getLocale: Z, setLocale: G } = qe({
|
|
1176
|
+
sourceLocale: Xe,
|
|
1177
|
+
targetLocales: zt,
|
|
1178
|
+
loadLocale: async (s) => Ze.get(s)
|
|
1214
1179
|
});
|
|
1215
|
-
window.getLocale = window.getLocale ? window.getLocale.push(
|
|
1216
|
-
window.setLocale = window.setLocale ? window.setLocale.push(
|
|
1180
|
+
window.getLocale = window.orbit ? window.getLocale ? window.getLocale.push(Z) : [Z] : Z;
|
|
1181
|
+
window.setLocale = window.orbit ? window.setLocale ? window.setLocale.push(G) : [G] : G;
|
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
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { configureLocalization } from "@lit/localize";
|
|
2
2
|
import { sourceLocale, targetLocales } from "@src/generated/locale-codes.js";
|
|
3
3
|
|
|
4
|
-
const langs = import.meta.glob("
|
|
4
|
+
const langs = import.meta.glob("../../generated/locales/**/*.ts", { eager: true });
|
|
5
5
|
|
|
6
6
|
const localizedTemplates: Map<string, any> = new Map(
|
|
7
7
|
targetLocales.map((locale) => [
|
|
8
8
|
locale,
|
|
9
|
-
langs[
|
|
9
|
+
langs[`../../generated/locales/${locale}.ts`],
|
|
10
10
|
]),
|
|
11
11
|
);
|
|
12
12
|
|
package/src/index.ts
CHANGED
|
@@ -3,5 +3,5 @@ import "@styles/index.scss";
|
|
|
3
3
|
import.meta.glob("./components/**/*.ts", { eager: true });
|
|
4
4
|
import.meta.glob("./components/**/*.js", { eager: true });
|
|
5
5
|
|
|
6
|
-
window.getLocale = window.getLocale ? window.getLocale.push(getLocale) : [getLocale];
|
|
7
|
-
window.setLocale = window.setLocale ? window.setLocale.push(setLocale) : [setLocale];
|
|
6
|
+
window.getLocale = window.orbit ? window.getLocale ? window.getLocale.push(getLocale) : [getLocale] : getLocale;
|
|
7
|
+
window.setLocale = window.orbit ? window.setLocale ? window.setLocale.push(setLocale) : [setLocale] : setLocale;
|