lunchboxjs 2.2.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lunchboxjs.cjs +7 -17
- package/dist/lunchboxjs.js +357 -654
- package/dist/lunchboxjs.umd.cjs +7 -17
- package/package.json +3 -3
- package/src/three-lunchbox.ts +17 -5
package/dist/lunchboxjs.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { LitElement as $, html as O, css as V } from "lit";
|
|
2
|
+
import * as d from "three";
|
|
3
|
+
const B = [
|
|
3
4
|
// ORDER MATTERS HERE!
|
|
4
5
|
// Place the objects most likely to wrap other objects at the beginning of the list.
|
|
5
6
|
// Main wrappers
|
|
@@ -85,25 +86,114 @@ const Ae = [
|
|
|
85
86
|
"Color",
|
|
86
87
|
// Loaders
|
|
87
88
|
"TextureLoader"
|
|
88
|
-
]
|
|
89
|
+
], K = (i, e, t) => {
|
|
90
|
+
if (!e)
|
|
91
|
+
return;
|
|
92
|
+
const r = Array.isArray(e) ? e : e.match(/([^[.\]])+/g), s = r == null ? void 0 : r.reduce(
|
|
93
|
+
(n, o) => n && n[o],
|
|
94
|
+
i
|
|
95
|
+
);
|
|
96
|
+
return s === void 0 ? t : s;
|
|
97
|
+
};
|
|
98
|
+
function Y(i) {
|
|
99
|
+
if (!i)
|
|
100
|
+
return !1;
|
|
101
|
+
const e = i.constructor && i.constructor.toString().substring(0, 5) === "class";
|
|
102
|
+
if (i.prototype === void 0)
|
|
103
|
+
return e;
|
|
104
|
+
const t = i.prototype.constructor && i.prototype.constructor.toString && i.prototype.constructor.toString().substring(0, 5) === "class";
|
|
105
|
+
return e || t;
|
|
106
|
+
}
|
|
107
|
+
const Z = () => {
|
|
108
|
+
const i = "[object Number]", t = Object.prototype.toString;
|
|
109
|
+
function r(n) {
|
|
110
|
+
return !!n && typeof n == "object";
|
|
111
|
+
}
|
|
112
|
+
return function(o) {
|
|
113
|
+
return typeof o == "number" || r(o) && t.call(o) == i;
|
|
114
|
+
};
|
|
115
|
+
}, X = Z(), Q = (i, e, t) => {
|
|
116
|
+
const r = Array.isArray(e) ? e : e.match(/([^[.\]])+/g);
|
|
117
|
+
r == null || r.reduce((s, n, o) => (s[n] === void 0 && (s[n] = {}), o === r.length - 1 && (s[n] = t), s[n]), i);
|
|
118
|
+
}, q = "data-three-uuid", L = (i) => {
|
|
119
|
+
var t, r, s;
|
|
120
|
+
let e = i.parentNode;
|
|
121
|
+
for (; e && !(e != null && e.instance) && !((t = e == null ? void 0 : e.three) != null && t.scene); )
|
|
122
|
+
e = (e == null ? void 0 : e.parentNode) || (e == null ? void 0 : e.host) || ((s = (r = e.getRootNode) == null ? void 0 : r.call(e)) == null ? void 0 : s.host);
|
|
123
|
+
return e;
|
|
124
|
+
};
|
|
125
|
+
function b(i, e) {
|
|
126
|
+
return i ? i instanceof ShadowRoot ? b(i.host, e) : i instanceof HTMLElement && (typeof e == "string" && i.matches(e) || typeof e == "function" && e(i)) ? i : b(i.parentNode, e) : null;
|
|
127
|
+
}
|
|
128
|
+
const _ = (i, e, t) => {
|
|
129
|
+
var n, o;
|
|
130
|
+
const r = K(i, e);
|
|
131
|
+
if (X(t) && (r != null && r.setScalar))
|
|
132
|
+
r.setScalar(+t);
|
|
133
|
+
else if (r != null && r.set)
|
|
134
|
+
if (typeof t == "string") {
|
|
135
|
+
const a = t.split(","), h = a.every((c) => !c.match(/^[^\d,]+$/));
|
|
136
|
+
if ((n = t.toLowerCase().trim().match(/^#[\dabcdef]{3,6}$/)) != null && n.length)
|
|
137
|
+
if (t.length === 4) {
|
|
138
|
+
const c = [t[1], t[1], t[2], t[2], t[3], t[3]].join("");
|
|
139
|
+
r.set(+`0x${c}`);
|
|
140
|
+
} else
|
|
141
|
+
r.set(+`0x${t.slice(1)}`);
|
|
142
|
+
else
|
|
143
|
+
a != null && a.length && h ? r.set(...a.map((c) => +c)) : r.set(t);
|
|
144
|
+
} else {
|
|
145
|
+
const a = Array.isArray(t) ? t : [t];
|
|
146
|
+
r.set(...a);
|
|
147
|
+
}
|
|
148
|
+
else
|
|
149
|
+
Q(i, e, t);
|
|
150
|
+
const s = i;
|
|
151
|
+
typeof s.type == "string" && ((o = s.type) != null && o.toLowerCase().endsWith("material")) && (s.needsUpdate = !0);
|
|
152
|
+
}, C = {
|
|
153
|
+
$scene: (i) => {
|
|
154
|
+
const e = i.closest("three-lunchbox");
|
|
155
|
+
return e == null ? void 0 : e.three.scene;
|
|
156
|
+
},
|
|
157
|
+
$camera: (i) => {
|
|
158
|
+
const e = i.closest("three-lunchbox");
|
|
159
|
+
return e == null ? void 0 : e.three.camera;
|
|
160
|
+
},
|
|
161
|
+
$renderer: (i) => {
|
|
162
|
+
const e = i.closest("three-lunchbox");
|
|
163
|
+
return e == null ? void 0 : e.three.renderer;
|
|
164
|
+
},
|
|
165
|
+
$domElement: (i) => {
|
|
166
|
+
var t;
|
|
167
|
+
const e = i.closest("three-lunchbox");
|
|
168
|
+
return (t = e == null ? void 0 : e.three.renderer) == null ? void 0 : t.domElement;
|
|
169
|
+
}
|
|
170
|
+
}, v = (i, e) => {
|
|
171
|
+
var r;
|
|
172
|
+
if (typeof i != "string")
|
|
173
|
+
return i;
|
|
174
|
+
if (i === "")
|
|
175
|
+
return !0;
|
|
176
|
+
const t = (r = C[i]) == null ? void 0 : r.call(C, e);
|
|
177
|
+
return CSS.supports("color", i) ? new d.Color(i) : t ?? i;
|
|
178
|
+
};
|
|
89
179
|
/**
|
|
90
180
|
* @license
|
|
91
181
|
* Copyright 2019 Google LLC
|
|
92
182
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
93
183
|
*/
|
|
94
|
-
const
|
|
95
|
-
let
|
|
96
|
-
constructor(e, t,
|
|
97
|
-
if (this._$cssResult$ = !0,
|
|
184
|
+
const g = globalThis, M = g.ShadowRoot && (g.ShadyCSS === void 0 || g.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, H = Symbol(), U = /* @__PURE__ */ new WeakMap();
|
|
185
|
+
let ee = class {
|
|
186
|
+
constructor(e, t, r) {
|
|
187
|
+
if (this._$cssResult$ = !0, r !== H)
|
|
98
188
|
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
99
189
|
this.cssText = e, this.t = t;
|
|
100
190
|
}
|
|
101
191
|
get styleSheet() {
|
|
102
192
|
let e = this.o;
|
|
103
193
|
const t = this.t;
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
|
|
194
|
+
if (M && e === void 0) {
|
|
195
|
+
const r = t !== void 0 && t.length === 1;
|
|
196
|
+
r && (e = U.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), r && U.set(t, e));
|
|
107
197
|
}
|
|
108
198
|
return e;
|
|
109
199
|
}
|
|
@@ -111,38 +201,29 @@ let be = class {
|
|
|
111
201
|
return this.cssText;
|
|
112
202
|
}
|
|
113
203
|
};
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
if (o._$cssResult$ === !0)
|
|
117
|
-
return o.cssText;
|
|
118
|
-
if (typeof o == "number")
|
|
119
|
-
return o;
|
|
120
|
-
throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
121
|
-
})(r) + i[n + 1], i[0]);
|
|
122
|
-
return new be(t, i, X);
|
|
123
|
-
}, xe = (i, e) => {
|
|
124
|
-
if (Y)
|
|
204
|
+
const te = (i) => new ee(typeof i == "string" ? i : i + "", void 0, H), re = (i, e) => {
|
|
205
|
+
if (M)
|
|
125
206
|
i.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
126
207
|
else
|
|
127
208
|
for (const t of e) {
|
|
128
|
-
const
|
|
129
|
-
|
|
209
|
+
const r = document.createElement("style"), s = g.litNonce;
|
|
210
|
+
s !== void 0 && r.setAttribute("nonce", s), r.textContent = t.cssText, i.appendChild(r);
|
|
130
211
|
}
|
|
131
|
-
},
|
|
212
|
+
}, N = M ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((e) => {
|
|
132
213
|
let t = "";
|
|
133
|
-
for (const
|
|
134
|
-
t +=
|
|
135
|
-
return
|
|
214
|
+
for (const r of e.cssRules)
|
|
215
|
+
t += r.cssText;
|
|
216
|
+
return te(t);
|
|
136
217
|
})(i) : i;
|
|
137
218
|
/**
|
|
138
219
|
* @license
|
|
139
220
|
* Copyright 2017 Google LLC
|
|
140
221
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
141
222
|
*/
|
|
142
|
-
const { is:
|
|
223
|
+
const { is: se, defineProperty: ie, getOwnPropertyDescriptor: ne, getOwnPropertyNames: oe, getOwnPropertySymbols: ae, getPrototypeOf: he } = Object, p = globalThis, j = p.trustedTypes, ce = j ? j.emptyScript : "", S = p.reactiveElementPolyfillSupport, E = (i, e) => i, w = { toAttribute(i, e) {
|
|
143
224
|
switch (e) {
|
|
144
225
|
case Boolean:
|
|
145
|
-
i = i ?
|
|
226
|
+
i = i ? ce : null;
|
|
146
227
|
break;
|
|
147
228
|
case Object:
|
|
148
229
|
case Array:
|
|
@@ -167,76 +248,76 @@ const { is: Re, defineProperty: Ne, getOwnPropertyDescriptor: Le, getOwnProperty
|
|
|
167
248
|
}
|
|
168
249
|
}
|
|
169
250
|
return t;
|
|
170
|
-
} },
|
|
171
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
172
|
-
|
|
251
|
+
} }, T = (i, e) => !se(i, e), D = { attribute: !0, type: String, converter: w, reflect: !1, useDefault: !1, hasChanged: T };
|
|
252
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), p.litPropertyMetadata ?? (p.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
253
|
+
class y extends HTMLElement {
|
|
173
254
|
static addInitializer(e) {
|
|
174
255
|
this._$Ei(), (this.l ?? (this.l = [])).push(e);
|
|
175
256
|
}
|
|
176
257
|
static get observedAttributes() {
|
|
177
258
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
178
259
|
}
|
|
179
|
-
static createProperty(e, t =
|
|
260
|
+
static createProperty(e, t = D) {
|
|
180
261
|
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
181
|
-
const
|
|
182
|
-
|
|
262
|
+
const r = Symbol(), s = this.getPropertyDescriptor(e, r, t);
|
|
263
|
+
s !== void 0 && ie(this.prototype, e, s);
|
|
183
264
|
}
|
|
184
265
|
}
|
|
185
|
-
static getPropertyDescriptor(e, t,
|
|
186
|
-
const { get:
|
|
266
|
+
static getPropertyDescriptor(e, t, r) {
|
|
267
|
+
const { get: s, set: n } = ne(this.prototype, e) ?? { get() {
|
|
187
268
|
return this[t];
|
|
188
269
|
}, set(o) {
|
|
189
270
|
this[t] = o;
|
|
190
271
|
} };
|
|
191
|
-
return { get:
|
|
192
|
-
const a =
|
|
193
|
-
n == null || n.call(this, o), this.requestUpdate(e, a,
|
|
272
|
+
return { get: s, set(o) {
|
|
273
|
+
const a = s == null ? void 0 : s.call(this);
|
|
274
|
+
n == null || n.call(this, o), this.requestUpdate(e, a, r);
|
|
194
275
|
}, configurable: !0, enumerable: !0 };
|
|
195
276
|
}
|
|
196
277
|
static getPropertyOptions(e) {
|
|
197
|
-
return this.elementProperties.get(e) ??
|
|
278
|
+
return this.elementProperties.get(e) ?? D;
|
|
198
279
|
}
|
|
199
280
|
static _$Ei() {
|
|
200
|
-
if (this.hasOwnProperty(
|
|
281
|
+
if (this.hasOwnProperty(E("elementProperties")))
|
|
201
282
|
return;
|
|
202
|
-
const e =
|
|
283
|
+
const e = he(this);
|
|
203
284
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
204
285
|
}
|
|
205
286
|
static finalize() {
|
|
206
|
-
if (this.hasOwnProperty(
|
|
287
|
+
if (this.hasOwnProperty(E("finalized")))
|
|
207
288
|
return;
|
|
208
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
209
|
-
const t = this.properties,
|
|
210
|
-
for (const
|
|
211
|
-
this.createProperty(
|
|
289
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(E("properties"))) {
|
|
290
|
+
const t = this.properties, r = [...oe(t), ...ae(t)];
|
|
291
|
+
for (const s of r)
|
|
292
|
+
this.createProperty(s, t[s]);
|
|
212
293
|
}
|
|
213
294
|
const e = this[Symbol.metadata];
|
|
214
295
|
if (e !== null) {
|
|
215
296
|
const t = litPropertyMetadata.get(e);
|
|
216
297
|
if (t !== void 0)
|
|
217
|
-
for (const [
|
|
218
|
-
this.elementProperties.set(
|
|
298
|
+
for (const [r, s] of t)
|
|
299
|
+
this.elementProperties.set(r, s);
|
|
219
300
|
}
|
|
220
301
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
221
|
-
for (const [t,
|
|
222
|
-
const
|
|
223
|
-
|
|
302
|
+
for (const [t, r] of this.elementProperties) {
|
|
303
|
+
const s = this._$Eu(t, r);
|
|
304
|
+
s !== void 0 && this._$Eh.set(s, t);
|
|
224
305
|
}
|
|
225
306
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
226
307
|
}
|
|
227
308
|
static finalizeStyles(e) {
|
|
228
309
|
const t = [];
|
|
229
310
|
if (Array.isArray(e)) {
|
|
230
|
-
const
|
|
231
|
-
for (const
|
|
232
|
-
t.unshift(
|
|
311
|
+
const r = new Set(e.flat(1 / 0).reverse());
|
|
312
|
+
for (const s of r)
|
|
313
|
+
t.unshift(N(s));
|
|
233
314
|
} else
|
|
234
|
-
e !== void 0 && t.push(
|
|
315
|
+
e !== void 0 && t.push(N(e));
|
|
235
316
|
return t;
|
|
236
317
|
}
|
|
237
318
|
static _$Eu(e, t) {
|
|
238
|
-
const
|
|
239
|
-
return
|
|
319
|
+
const r = t.attribute;
|
|
320
|
+
return r === !1 ? void 0 : typeof r == "string" ? r : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
240
321
|
}
|
|
241
322
|
constructor() {
|
|
242
323
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
@@ -255,19 +336,19 @@ let S = class extends HTMLElement {
|
|
|
255
336
|
}
|
|
256
337
|
_$E_() {
|
|
257
338
|
const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
258
|
-
for (const
|
|
259
|
-
this.hasOwnProperty(
|
|
339
|
+
for (const r of t.keys())
|
|
340
|
+
this.hasOwnProperty(r) && (e.set(r, this[r]), delete this[r]);
|
|
260
341
|
e.size > 0 && (this._$Ep = e);
|
|
261
342
|
}
|
|
262
343
|
createRenderRoot() {
|
|
263
344
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
264
|
-
return
|
|
345
|
+
return re(e, this.constructor.elementStyles), e;
|
|
265
346
|
}
|
|
266
347
|
connectedCallback() {
|
|
267
348
|
var e;
|
|
268
349
|
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((t) => {
|
|
269
|
-
var
|
|
270
|
-
return (
|
|
350
|
+
var r;
|
|
351
|
+
return (r = t.hostConnected) == null ? void 0 : r.call(t);
|
|
271
352
|
});
|
|
272
353
|
}
|
|
273
354
|
enableUpdating(e) {
|
|
@@ -275,43 +356,43 @@ let S = class extends HTMLElement {
|
|
|
275
356
|
disconnectedCallback() {
|
|
276
357
|
var e;
|
|
277
358
|
(e = this._$EO) == null || e.forEach((t) => {
|
|
278
|
-
var
|
|
279
|
-
return (
|
|
359
|
+
var r;
|
|
360
|
+
return (r = t.hostDisconnected) == null ? void 0 : r.call(t);
|
|
280
361
|
});
|
|
281
362
|
}
|
|
282
|
-
attributeChangedCallback(e, t,
|
|
283
|
-
this._$AK(e,
|
|
363
|
+
attributeChangedCallback(e, t, r) {
|
|
364
|
+
this._$AK(e, r);
|
|
284
365
|
}
|
|
285
366
|
_$ET(e, t) {
|
|
286
367
|
var n;
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
const o = (((n =
|
|
290
|
-
this._$Em = e, o == null ? this.removeAttribute(
|
|
368
|
+
const r = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, r);
|
|
369
|
+
if (s !== void 0 && r.reflect === !0) {
|
|
370
|
+
const o = (((n = r.converter) == null ? void 0 : n.toAttribute) !== void 0 ? r.converter : w).toAttribute(t, r.type);
|
|
371
|
+
this._$Em = e, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
|
|
291
372
|
}
|
|
292
373
|
}
|
|
293
374
|
_$AK(e, t) {
|
|
294
375
|
var n, o;
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
const a =
|
|
298
|
-
this._$Em =
|
|
376
|
+
const r = this.constructor, s = r._$Eh.get(e);
|
|
377
|
+
if (s !== void 0 && this._$Em !== s) {
|
|
378
|
+
const a = r.getPropertyOptions(s), h = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((n = a.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? a.converter : w;
|
|
379
|
+
this._$Em = s;
|
|
299
380
|
const c = h.fromAttribute(t, a.type);
|
|
300
|
-
this[
|
|
381
|
+
this[s] = c ?? ((o = this._$Ej) == null ? void 0 : o.get(s)) ?? c, this._$Em = null;
|
|
301
382
|
}
|
|
302
383
|
}
|
|
303
|
-
requestUpdate(e, t,
|
|
384
|
+
requestUpdate(e, t, r, s = !1, n) {
|
|
304
385
|
var o;
|
|
305
386
|
if (e !== void 0) {
|
|
306
387
|
const a = this.constructor;
|
|
307
|
-
if (
|
|
388
|
+
if (s === !1 && (n = this[e]), r ?? (r = a.getPropertyOptions(e)), !((r.hasChanged ?? T)(n, t) || r.useDefault && r.reflect && n === ((o = this._$Ej) == null ? void 0 : o.get(e)) && !this.hasAttribute(a._$Eu(e, r))))
|
|
308
389
|
return;
|
|
309
|
-
this.C(e, t,
|
|
390
|
+
this.C(e, t, r);
|
|
310
391
|
}
|
|
311
392
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
312
393
|
}
|
|
313
|
-
C(e, t, { useDefault:
|
|
314
|
-
|
|
394
|
+
C(e, t, { useDefault: r, reflect: s, wrapped: n }, o) {
|
|
395
|
+
r && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, o ?? t ?? this[e]), n !== !0 || o !== void 0) || (this._$AL.has(e) || (this.hasUpdated || r || (t = void 0), this._$AL.set(e, t)), s === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
|
|
315
396
|
}
|
|
316
397
|
async _$EP() {
|
|
317
398
|
this.isUpdatePending = !0;
|
|
@@ -327,7 +408,7 @@ let S = class extends HTMLElement {
|
|
|
327
408
|
return this.performUpdate();
|
|
328
409
|
}
|
|
329
410
|
performUpdate() {
|
|
330
|
-
var
|
|
411
|
+
var r;
|
|
331
412
|
if (!this.isUpdatePending)
|
|
332
413
|
return;
|
|
333
414
|
if (!this.hasUpdated) {
|
|
@@ -336,9 +417,9 @@ let S = class extends HTMLElement {
|
|
|
336
417
|
this[n] = o;
|
|
337
418
|
this._$Ep = void 0;
|
|
338
419
|
}
|
|
339
|
-
const
|
|
340
|
-
if (
|
|
341
|
-
for (const [n, o] of
|
|
420
|
+
const s = this.constructor.elementProperties;
|
|
421
|
+
if (s.size > 0)
|
|
422
|
+
for (const [n, o] of s) {
|
|
342
423
|
const { wrapped: a } = o, h = this[n];
|
|
343
424
|
a !== !0 || this._$AL.has(n) || h === void 0 || this.C(n, void 0, o, h);
|
|
344
425
|
}
|
|
@@ -346,12 +427,12 @@ let S = class extends HTMLElement {
|
|
|
346
427
|
let e = !1;
|
|
347
428
|
const t = this._$AL;
|
|
348
429
|
try {
|
|
349
|
-
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (
|
|
430
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (r = this._$EO) == null || r.forEach((s) => {
|
|
350
431
|
var n;
|
|
351
|
-
return (n =
|
|
432
|
+
return (n = s.hostUpdate) == null ? void 0 : n.call(s);
|
|
352
433
|
}), this.update(t)) : this._$EM();
|
|
353
|
-
} catch (
|
|
354
|
-
throw e = !1, this._$EM(),
|
|
434
|
+
} catch (s) {
|
|
435
|
+
throw e = !1, this._$EM(), s;
|
|
355
436
|
}
|
|
356
437
|
e && this._$AE(t);
|
|
357
438
|
}
|
|
@@ -359,9 +440,9 @@ let S = class extends HTMLElement {
|
|
|
359
440
|
}
|
|
360
441
|
_$AE(e) {
|
|
361
442
|
var t;
|
|
362
|
-
(t = this._$EO) == null || t.forEach((
|
|
363
|
-
var
|
|
364
|
-
return (
|
|
443
|
+
(t = this._$EO) == null || t.forEach((r) => {
|
|
444
|
+
var s;
|
|
445
|
+
return (s = r.hostUpdated) == null ? void 0 : s.call(r);
|
|
365
446
|
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
366
447
|
}
|
|
367
448
|
_$EM() {
|
|
@@ -383,395 +464,17 @@ let S = class extends HTMLElement {
|
|
|
383
464
|
}
|
|
384
465
|
firstUpdated(e) {
|
|
385
466
|
}
|
|
386
|
-
};
|
|
387
|
-
S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[O("elementProperties")] = /* @__PURE__ */ new Map(), S[O("finalized")] = /* @__PURE__ */ new Map(), W == null || W({ ReactiveElement: S }), (A.reactiveElementVersions ?? (A.reactiveElementVersions = [])).push("2.1.2");
|
|
388
|
-
/**
|
|
389
|
-
* @license
|
|
390
|
-
* Copyright 2017 Google LLC
|
|
391
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
392
|
-
*/
|
|
393
|
-
const x = globalThis, ae = (i) => i, I = x.trustedTypes, he = I ? I.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Ee = "$lit$", g = `lit$${Math.random().toFixed(9).slice(2)}$`, _e = "?" + g, ke = `<${_e}>`, C = document, R = () => C.createComment(""), N = (i) => i === null || typeof i != "object" && typeof i != "function", ee = Array.isArray, Ie = (i) => ee(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", q = `[
|
|
394
|
-
\f\r]`, M = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ce = /-->/g, le = />/g, E = RegExp(`>|${q}(?:([^\\s"'>=/]+)(${q}*=${q}*(?:[^
|
|
395
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), de = /'/g, ue = /"/g, ve = /^(?:script|style|textarea|title)$/i, Be = (i) => (e, ...t) => ({ _$litType$: i, strings: e, values: t }), te = Be(1), P = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), pe = /* @__PURE__ */ new WeakMap(), _ = C.createTreeWalker(C, 129);
|
|
396
|
-
function we(i, e) {
|
|
397
|
-
if (!ee(i) || !i.hasOwnProperty("raw"))
|
|
398
|
-
throw Error("invalid template strings array");
|
|
399
|
-
return he !== void 0 ? he.createHTML(e) : e;
|
|
400
|
-
}
|
|
401
|
-
const Ge = (i, e) => {
|
|
402
|
-
const t = i.length - 1, s = [];
|
|
403
|
-
let r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = M;
|
|
404
|
-
for (let a = 0; a < t; a++) {
|
|
405
|
-
const h = i[a];
|
|
406
|
-
let c, d, l = -1, m = 0;
|
|
407
|
-
for (; m < h.length && (o.lastIndex = m, d = o.exec(h), d !== null); )
|
|
408
|
-
m = o.lastIndex, o === M ? d[1] === "!--" ? o = ce : d[1] !== void 0 ? o = le : d[2] !== void 0 ? (ve.test(d[2]) && (r = RegExp("</" + d[2], "g")), o = E) : d[3] !== void 0 && (o = E) : o === E ? d[0] === ">" ? (o = r ?? M, l = -1) : d[1] === void 0 ? l = -2 : (l = o.lastIndex - d[2].length, c = d[1], o = d[3] === void 0 ? E : d[3] === '"' ? ue : de) : o === ue || o === de ? o = E : o === ce || o === le ? o = M : (o = E, r = void 0);
|
|
409
|
-
const $ = o === E && i[a + 1].startsWith("/>") ? " " : "";
|
|
410
|
-
n += o === M ? h + ke : l >= 0 ? (s.push(c), h.slice(0, l) + Ee + h.slice(l) + g + $) : h + g + (l === -2 ? a : $);
|
|
411
|
-
}
|
|
412
|
-
return [we(i, n + (i[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
413
|
-
};
|
|
414
|
-
class L {
|
|
415
|
-
constructor({ strings: e, _$litType$: t }, s) {
|
|
416
|
-
let r;
|
|
417
|
-
this.parts = [];
|
|
418
|
-
let n = 0, o = 0;
|
|
419
|
-
const a = e.length - 1, h = this.parts, [c, d] = Ge(e, t);
|
|
420
|
-
if (this.el = L.createElement(c, s), _.currentNode = this.el.content, t === 2 || t === 3) {
|
|
421
|
-
const l = this.el.content.firstChild;
|
|
422
|
-
l.replaceWith(...l.childNodes);
|
|
423
|
-
}
|
|
424
|
-
for (; (r = _.nextNode()) !== null && h.length < a; ) {
|
|
425
|
-
if (r.nodeType === 1) {
|
|
426
|
-
if (r.hasAttributes())
|
|
427
|
-
for (const l of r.getAttributeNames())
|
|
428
|
-
if (l.endsWith(Ee)) {
|
|
429
|
-
const m = d[o++], $ = r.getAttribute(l).split(g), H = /([.?@])?(.*)/.exec(m);
|
|
430
|
-
h.push({ type: 1, index: n, name: H[2], strings: $, ctor: H[1] === "." ? We : H[1] === "?" ? qe : H[1] === "@" ? Fe : z }), r.removeAttribute(l);
|
|
431
|
-
} else
|
|
432
|
-
l.startsWith(g) && (h.push({ type: 6, index: n }), r.removeAttribute(l));
|
|
433
|
-
if (ve.test(r.tagName)) {
|
|
434
|
-
const l = r.textContent.split(g), m = l.length - 1;
|
|
435
|
-
if (m > 0) {
|
|
436
|
-
r.textContent = I ? I.emptyScript : "";
|
|
437
|
-
for (let $ = 0; $ < m; $++)
|
|
438
|
-
r.append(l[$], R()), _.nextNode(), h.push({ type: 2, index: ++n });
|
|
439
|
-
r.append(l[m], R());
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
} else if (r.nodeType === 8)
|
|
443
|
-
if (r.data === _e)
|
|
444
|
-
h.push({ type: 2, index: n });
|
|
445
|
-
else {
|
|
446
|
-
let l = -1;
|
|
447
|
-
for (; (l = r.data.indexOf(g, l + 1)) !== -1; )
|
|
448
|
-
h.push({ type: 7, index: n }), l += g.length - 1;
|
|
449
|
-
}
|
|
450
|
-
n++;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
static createElement(e, t) {
|
|
454
|
-
const s = C.createElement("template");
|
|
455
|
-
return s.innerHTML = e, s;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
function T(i, e, t = i, s) {
|
|
459
|
-
var o, a;
|
|
460
|
-
if (e === P)
|
|
461
|
-
return e;
|
|
462
|
-
let r = s !== void 0 ? (o = t._$Co) == null ? void 0 : o[s] : t._$Cl;
|
|
463
|
-
const n = N(e) ? void 0 : e._$litDirective$;
|
|
464
|
-
return (r == null ? void 0 : r.constructor) !== n && ((a = r == null ? void 0 : r._$AO) == null || a.call(r, !1), n === void 0 ? r = void 0 : (r = new n(i), r._$AT(i, t, s)), s !== void 0 ? (t._$Co ?? (t._$Co = []))[s] = r : t._$Cl = r), r !== void 0 && (e = T(i, r._$AS(i, e.values), r, s)), e;
|
|
465
|
-
}
|
|
466
|
-
class ze {
|
|
467
|
-
constructor(e, t) {
|
|
468
|
-
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
469
|
-
}
|
|
470
|
-
get parentNode() {
|
|
471
|
-
return this._$AM.parentNode;
|
|
472
|
-
}
|
|
473
|
-
get _$AU() {
|
|
474
|
-
return this._$AM._$AU;
|
|
475
|
-
}
|
|
476
|
-
u(e) {
|
|
477
|
-
const { el: { content: t }, parts: s } = this._$AD, r = ((e == null ? void 0 : e.creationScope) ?? C).importNode(t, !0);
|
|
478
|
-
_.currentNode = r;
|
|
479
|
-
let n = _.nextNode(), o = 0, a = 0, h = s[0];
|
|
480
|
-
for (; h !== void 0; ) {
|
|
481
|
-
if (o === h.index) {
|
|
482
|
-
let c;
|
|
483
|
-
h.type === 2 ? c = new U(n, n.nextSibling, this, e) : h.type === 1 ? c = new h.ctor(n, h.name, h.strings, this, e) : h.type === 6 && (c = new Ve(n, this, e)), this._$AV.push(c), h = s[++a];
|
|
484
|
-
}
|
|
485
|
-
o !== (h == null ? void 0 : h.index) && (n = _.nextNode(), o++);
|
|
486
|
-
}
|
|
487
|
-
return _.currentNode = C, r;
|
|
488
|
-
}
|
|
489
|
-
p(e) {
|
|
490
|
-
let t = 0;
|
|
491
|
-
for (const s of this._$AV)
|
|
492
|
-
s !== void 0 && (s.strings !== void 0 ? (s._$AI(e, s, t), t += s.strings.length - 2) : s._$AI(e[t])), t++;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
class U {
|
|
496
|
-
get _$AU() {
|
|
497
|
-
var e;
|
|
498
|
-
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
|
|
499
|
-
}
|
|
500
|
-
constructor(e, t, s, r) {
|
|
501
|
-
this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = s, this.options = r, this._$Cv = (r == null ? void 0 : r.isConnected) ?? !0;
|
|
502
|
-
}
|
|
503
|
-
get parentNode() {
|
|
504
|
-
let e = this._$AA.parentNode;
|
|
505
|
-
const t = this._$AM;
|
|
506
|
-
return t !== void 0 && (e == null ? void 0 : e.nodeType) === 11 && (e = t.parentNode), e;
|
|
507
|
-
}
|
|
508
|
-
get startNode() {
|
|
509
|
-
return this._$AA;
|
|
510
|
-
}
|
|
511
|
-
get endNode() {
|
|
512
|
-
return this._$AB;
|
|
513
|
-
}
|
|
514
|
-
_$AI(e, t = this) {
|
|
515
|
-
e = T(this, e, t), N(e) ? e === u || e == null || e === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : e !== this._$AH && e !== P && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ie(e) ? this.k(e) : this._(e);
|
|
516
|
-
}
|
|
517
|
-
O(e) {
|
|
518
|
-
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
519
|
-
}
|
|
520
|
-
T(e) {
|
|
521
|
-
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
522
|
-
}
|
|
523
|
-
_(e) {
|
|
524
|
-
this._$AH !== u && N(this._$AH) ? this._$AA.nextSibling.data = e : this.T(C.createTextNode(e)), this._$AH = e;
|
|
525
|
-
}
|
|
526
|
-
$(e) {
|
|
527
|
-
var n;
|
|
528
|
-
const { values: t, _$litType$: s } = e, r = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = L.createElement(we(s.h, s.h[0]), this.options)), s);
|
|
529
|
-
if (((n = this._$AH) == null ? void 0 : n._$AD) === r)
|
|
530
|
-
this._$AH.p(t);
|
|
531
|
-
else {
|
|
532
|
-
const o = new ze(r, this), a = o.u(this.options);
|
|
533
|
-
o.p(t), this.T(a), this._$AH = o;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
_$AC(e) {
|
|
537
|
-
let t = pe.get(e.strings);
|
|
538
|
-
return t === void 0 && pe.set(e.strings, t = new L(e)), t;
|
|
539
|
-
}
|
|
540
|
-
k(e) {
|
|
541
|
-
ee(this._$AH) || (this._$AH = [], this._$AR());
|
|
542
|
-
const t = this._$AH;
|
|
543
|
-
let s, r = 0;
|
|
544
|
-
for (const n of e)
|
|
545
|
-
r === t.length ? t.push(s = new U(this.O(R()), this.O(R()), this, this.options)) : s = t[r], s._$AI(n), r++;
|
|
546
|
-
r < t.length && (this._$AR(s && s._$AB.nextSibling, r), t.length = r);
|
|
547
|
-
}
|
|
548
|
-
_$AR(e = this._$AA.nextSibling, t) {
|
|
549
|
-
var s;
|
|
550
|
-
for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, t); e !== this._$AB; ) {
|
|
551
|
-
const r = ae(e).nextSibling;
|
|
552
|
-
ae(e).remove(), e = r;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
setConnected(e) {
|
|
556
|
-
var t;
|
|
557
|
-
this._$AM === void 0 && (this._$Cv = e, (t = this._$AP) == null || t.call(this, e));
|
|
558
|
-
}
|
|
559
467
|
}
|
|
560
|
-
|
|
561
|
-
get tagName() {
|
|
562
|
-
return this.element.tagName;
|
|
563
|
-
}
|
|
564
|
-
get _$AU() {
|
|
565
|
-
return this._$AM._$AU;
|
|
566
|
-
}
|
|
567
|
-
constructor(e, t, s, r, n) {
|
|
568
|
-
this.type = 1, this._$AH = u, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = u;
|
|
569
|
-
}
|
|
570
|
-
_$AI(e, t = this, s, r) {
|
|
571
|
-
const n = this.strings;
|
|
572
|
-
let o = !1;
|
|
573
|
-
if (n === void 0)
|
|
574
|
-
e = T(this, e, t, 0), o = !N(e) || e !== this._$AH && e !== P, o && (this._$AH = e);
|
|
575
|
-
else {
|
|
576
|
-
const a = e;
|
|
577
|
-
let h, c;
|
|
578
|
-
for (e = n[0], h = 0; h < n.length - 1; h++)
|
|
579
|
-
c = T(this, a[s + h], t, h), c === P && (c = this._$AH[h]), o || (o = !N(c) || c !== this._$AH[h]), c === u ? e = u : e !== u && (e += (c ?? "") + n[h + 1]), this._$AH[h] = c;
|
|
580
|
-
}
|
|
581
|
-
o && !r && this.j(e);
|
|
582
|
-
}
|
|
583
|
-
j(e) {
|
|
584
|
-
e === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
class We extends z {
|
|
588
|
-
constructor() {
|
|
589
|
-
super(...arguments), this.type = 3;
|
|
590
|
-
}
|
|
591
|
-
j(e) {
|
|
592
|
-
this.element[this.name] = e === u ? void 0 : e;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
class qe extends z {
|
|
596
|
-
constructor() {
|
|
597
|
-
super(...arguments), this.type = 4;
|
|
598
|
-
}
|
|
599
|
-
j(e) {
|
|
600
|
-
this.element.toggleAttribute(this.name, !!e && e !== u);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
class Fe extends z {
|
|
604
|
-
constructor(e, t, s, r, n) {
|
|
605
|
-
super(e, t, s, r, n), this.type = 5;
|
|
606
|
-
}
|
|
607
|
-
_$AI(e, t = this) {
|
|
608
|
-
if ((e = T(this, e, t, 0) ?? u) === P)
|
|
609
|
-
return;
|
|
610
|
-
const s = this._$AH, r = e === u && s !== u || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, n = e !== u && (s === u || r);
|
|
611
|
-
r && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
612
|
-
}
|
|
613
|
-
handleEvent(e) {
|
|
614
|
-
var t;
|
|
615
|
-
typeof this._$AH == "function" ? this._$AH.call(((t = this.options) == null ? void 0 : t.host) ?? this.element, e) : this._$AH.handleEvent(e);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
class Ve {
|
|
619
|
-
constructor(e, t, s) {
|
|
620
|
-
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
|
|
621
|
-
}
|
|
622
|
-
get _$AU() {
|
|
623
|
-
return this._$AM._$AU;
|
|
624
|
-
}
|
|
625
|
-
_$AI(e) {
|
|
626
|
-
T(this, e);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
const F = x.litHtmlPolyfillSupport;
|
|
630
|
-
F == null || F(L, U), (x.litHtmlVersions ?? (x.litHtmlVersions = [])).push("3.3.2");
|
|
631
|
-
const Je = (i, e, t) => {
|
|
632
|
-
const s = (t == null ? void 0 : t.renderBefore) ?? e;
|
|
633
|
-
let r = s._$litPart$;
|
|
634
|
-
if (r === void 0) {
|
|
635
|
-
const n = (t == null ? void 0 : t.renderBefore) ?? null;
|
|
636
|
-
s._$litPart$ = r = new U(e.insertBefore(R(), n), n, void 0, t ?? {});
|
|
637
|
-
}
|
|
638
|
-
return r._$AI(i), r;
|
|
639
|
-
};
|
|
640
|
-
/**
|
|
641
|
-
* @license
|
|
642
|
-
* Copyright 2017 Google LLC
|
|
643
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
644
|
-
*/
|
|
645
|
-
const v = globalThis;
|
|
646
|
-
class w extends S {
|
|
647
|
-
constructor() {
|
|
648
|
-
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
649
|
-
}
|
|
650
|
-
createRenderRoot() {
|
|
651
|
-
var t;
|
|
652
|
-
const e = super.createRenderRoot();
|
|
653
|
-
return (t = this.renderOptions).renderBefore ?? (t.renderBefore = e.firstChild), e;
|
|
654
|
-
}
|
|
655
|
-
update(e) {
|
|
656
|
-
const t = this.render();
|
|
657
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Je(t, this.renderRoot, this.renderOptions);
|
|
658
|
-
}
|
|
659
|
-
connectedCallback() {
|
|
660
|
-
var e;
|
|
661
|
-
super.connectedCallback(), (e = this._$Do) == null || e.setConnected(!0);
|
|
662
|
-
}
|
|
663
|
-
disconnectedCallback() {
|
|
664
|
-
var e;
|
|
665
|
-
super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1);
|
|
666
|
-
}
|
|
667
|
-
render() {
|
|
668
|
-
return P;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
var ge;
|
|
672
|
-
w._$litElement$ = !0, w.finalized = !0, (ge = v.litElementHydrateSupport) == null || ge.call(v, { LitElement: w });
|
|
673
|
-
const V = v.litElementPolyfillSupport;
|
|
674
|
-
V == null || V({ LitElement: w });
|
|
675
|
-
(v.litElementVersions ?? (v.litElementVersions = [])).push("4.2.2");
|
|
676
|
-
const Ze = (i, e, t) => {
|
|
677
|
-
if (!e)
|
|
678
|
-
return;
|
|
679
|
-
const s = Array.isArray(e) ? e : e.match(/([^[.\]])+/g), r = s == null ? void 0 : s.reduce(
|
|
680
|
-
(n, o) => n && n[o],
|
|
681
|
-
i
|
|
682
|
-
);
|
|
683
|
-
return r === void 0 ? t : r;
|
|
684
|
-
};
|
|
685
|
-
function Ke(i) {
|
|
686
|
-
if (!i)
|
|
687
|
-
return !1;
|
|
688
|
-
const e = i.constructor && i.constructor.toString().substring(0, 5) === "class";
|
|
689
|
-
if (i.prototype === void 0)
|
|
690
|
-
return e;
|
|
691
|
-
const t = i.prototype.constructor && i.prototype.constructor.toString && i.prototype.constructor.toString().substring(0, 5) === "class";
|
|
692
|
-
return e || t;
|
|
693
|
-
}
|
|
694
|
-
const Ye = () => {
|
|
695
|
-
const i = "[object Number]", t = Object.prototype.toString;
|
|
696
|
-
function s(n) {
|
|
697
|
-
return !!n && typeof n == "object";
|
|
698
|
-
}
|
|
699
|
-
return function(o) {
|
|
700
|
-
return typeof o == "number" || s(o) && t.call(o) == i;
|
|
701
|
-
};
|
|
702
|
-
}, Xe = Ye(), Qe = (i, e, t) => {
|
|
703
|
-
const s = Array.isArray(e) ? e : e.match(/([^[.\]])+/g);
|
|
704
|
-
s == null || s.reduce((r, n, o) => (r[n] === void 0 && (r[n] = {}), o === s.length - 1 && (r[n] = t), r[n]), i);
|
|
705
|
-
}, Ce = "data-three-uuid", me = (i) => {
|
|
706
|
-
var t, s, r;
|
|
707
|
-
let e = i.parentNode;
|
|
708
|
-
for (; e && !(e != null && e.instance) && !((t = e == null ? void 0 : e.three) != null && t.scene); )
|
|
709
|
-
e = (e == null ? void 0 : e.parentNode) || (e == null ? void 0 : e.host) || ((r = (s = e.getRootNode) == null ? void 0 : s.call(e)) == null ? void 0 : r.host);
|
|
710
|
-
return e;
|
|
711
|
-
};
|
|
712
|
-
function D(i, e) {
|
|
713
|
-
return i ? i instanceof ShadowRoot ? D(i.host, e) : i instanceof HTMLElement && (typeof e == "string" && i.matches(e) || typeof e == "function" && e(i)) ? i : D(i.parentNode, e) : null;
|
|
714
|
-
}
|
|
715
|
-
const Z = (i, e, t) => {
|
|
716
|
-
var n, o;
|
|
717
|
-
const s = Ze(i, e);
|
|
718
|
-
if (Xe(t) && (s != null && s.setScalar))
|
|
719
|
-
s.setScalar(+t);
|
|
720
|
-
else if (s != null && s.set)
|
|
721
|
-
if (typeof t == "string") {
|
|
722
|
-
const a = t.split(","), h = a.every((c) => !c.match(/^[^\d,]+$/));
|
|
723
|
-
if ((n = t.toLowerCase().trim().match(/^#[\dabcdef]{3,6}$/)) != null && n.length)
|
|
724
|
-
if (t.length === 4) {
|
|
725
|
-
const c = [t[1], t[1], t[2], t[2], t[3], t[3]].join("");
|
|
726
|
-
s.set(+`0x${c}`);
|
|
727
|
-
} else
|
|
728
|
-
s.set(+`0x${t.slice(1)}`);
|
|
729
|
-
else
|
|
730
|
-
a != null && a.length && h ? s.set(...a.map((c) => +c)) : s.set(t);
|
|
731
|
-
} else {
|
|
732
|
-
const a = Array.isArray(t) ? t : [t];
|
|
733
|
-
s.set(...a);
|
|
734
|
-
}
|
|
735
|
-
else
|
|
736
|
-
Qe(i, e, t);
|
|
737
|
-
const r = i;
|
|
738
|
-
typeof r.type == "string" && ((o = r.type) != null && o.toLowerCase().endsWith("material")) && (r.needsUpdate = !0);
|
|
739
|
-
}, J = {
|
|
740
|
-
$scene: (i) => {
|
|
741
|
-
const e = i.closest("three-lunchbox");
|
|
742
|
-
return e == null ? void 0 : e.three.scene;
|
|
743
|
-
},
|
|
744
|
-
$camera: (i) => {
|
|
745
|
-
const e = i.closest("three-lunchbox");
|
|
746
|
-
return e == null ? void 0 : e.three.camera;
|
|
747
|
-
},
|
|
748
|
-
$renderer: (i) => {
|
|
749
|
-
const e = i.closest("three-lunchbox");
|
|
750
|
-
return e == null ? void 0 : e.three.renderer;
|
|
751
|
-
},
|
|
752
|
-
$domElement: (i) => {
|
|
753
|
-
var t;
|
|
754
|
-
const e = i.closest("three-lunchbox");
|
|
755
|
-
return (t = e == null ? void 0 : e.three.renderer) == null ? void 0 : t.domElement;
|
|
756
|
-
}
|
|
757
|
-
}, B = (i, e) => {
|
|
758
|
-
var s;
|
|
759
|
-
if (typeof i != "string")
|
|
760
|
-
return i;
|
|
761
|
-
if (i === "")
|
|
762
|
-
return !0;
|
|
763
|
-
const t = (s = J[i]) == null ? void 0 : s.call(J, e);
|
|
764
|
-
return CSS.supports("color", i) ? new p.Color(i) : t ?? i;
|
|
765
|
-
};
|
|
468
|
+
y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[E("elementProperties")] = /* @__PURE__ */ new Map(), y[E("finalized")] = /* @__PURE__ */ new Map(), S == null || S({ ReactiveElement: y }), (p.reactiveElementVersions ?? (p.reactiveElementVersions = [])).push("2.1.2");
|
|
766
469
|
/**
|
|
767
470
|
* @license
|
|
768
471
|
* Copyright 2017 Google LLC
|
|
769
472
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
770
473
|
*/
|
|
771
|
-
const
|
|
772
|
-
const { kind:
|
|
773
|
-
let n = globalThis.litPropertyMetadata.get(
|
|
774
|
-
if (n === void 0 && globalThis.litPropertyMetadata.set(
|
|
474
|
+
const de = { attribute: !0, type: String, converter: w, reflect: !1, hasChanged: T }, le = (i = de, e, t) => {
|
|
475
|
+
const { kind: r, metadata: s } = t;
|
|
476
|
+
let n = globalThis.litPropertyMetadata.get(s);
|
|
477
|
+
if (n === void 0 && globalThis.litPropertyMetadata.set(s, n = /* @__PURE__ */ new Map()), r === "setter" && ((i = Object.create(i)).wrapped = !0), n.set(t.name, i), r === "accessor") {
|
|
775
478
|
const { name: o } = t;
|
|
776
479
|
return { set(a) {
|
|
777
480
|
const h = e.get.call(this);
|
|
@@ -780,19 +483,19 @@ const et = { attribute: !0, type: String, converter: k, reflect: !1, hasChanged:
|
|
|
780
483
|
return a !== void 0 && this.C(o, void 0, i, a), a;
|
|
781
484
|
} };
|
|
782
485
|
}
|
|
783
|
-
if (
|
|
486
|
+
if (r === "setter") {
|
|
784
487
|
const { name: o } = t;
|
|
785
488
|
return function(a) {
|
|
786
489
|
const h = this[o];
|
|
787
490
|
e.call(this, a), this.requestUpdate(o, h, i, !0, a);
|
|
788
491
|
};
|
|
789
492
|
}
|
|
790
|
-
throw Error("Unsupported decorator location: " +
|
|
493
|
+
throw Error("Unsupported decorator location: " + r);
|
|
791
494
|
};
|
|
792
|
-
function
|
|
793
|
-
return (e, t) => typeof t == "object" ?
|
|
794
|
-
const o =
|
|
795
|
-
return
|
|
495
|
+
function u(i) {
|
|
496
|
+
return (e, t) => typeof t == "object" ? le(i, e, t) : ((r, s, n) => {
|
|
497
|
+
const o = s.hasOwnProperty(n);
|
|
498
|
+
return s.constructor.createProperty(n, r), o ? Object.getOwnPropertyDescriptor(s, n) : void 0;
|
|
796
499
|
})(i, e, t);
|
|
797
500
|
}
|
|
798
501
|
/**
|
|
@@ -800,31 +503,31 @@ function y(i) {
|
|
|
800
503
|
* Copyright 2017 Google LLC
|
|
801
504
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
802
505
|
*/
|
|
803
|
-
function
|
|
804
|
-
return
|
|
506
|
+
function ue(i) {
|
|
507
|
+
return u({ ...i, state: !0, attribute: !1 });
|
|
805
508
|
}
|
|
806
|
-
var
|
|
807
|
-
for (var
|
|
808
|
-
(o = i[n]) && (
|
|
809
|
-
return
|
|
509
|
+
var pe = Object.defineProperty, z = (i, e, t, r) => {
|
|
510
|
+
for (var s = void 0, n = i.length - 1, o; n >= 0; n--)
|
|
511
|
+
(o = i[n]) && (s = o(e, t, s) || s);
|
|
512
|
+
return s && pe(e, t, s), s;
|
|
810
513
|
};
|
|
811
|
-
const
|
|
812
|
-
|
|
514
|
+
const P = "raycast", k = [
|
|
515
|
+
P,
|
|
813
516
|
"args",
|
|
814
517
|
"data"
|
|
815
|
-
],
|
|
816
|
-
class
|
|
518
|
+
], G = (i) => i.split("-");
|
|
519
|
+
class A extends $ {
|
|
817
520
|
constructor(e) {
|
|
818
521
|
super(), this.classSource = e, this.instance = null, this.dispose = [], this.mutationObserver = null, this.tryAddOnce = !1, this.connected = !1;
|
|
819
522
|
}
|
|
820
523
|
observeAttributes() {
|
|
821
524
|
this.mutationObserver = new MutationObserver((e) => {
|
|
822
525
|
e.forEach((t) => {
|
|
823
|
-
var
|
|
824
|
-
if (!t.attributeName || (
|
|
526
|
+
var s;
|
|
527
|
+
if (!t.attributeName || (s = Object.getPrototypeOf(this).constructor.observedAttributes) != null && s.includes(t.attributeName))
|
|
825
528
|
return;
|
|
826
|
-
const
|
|
827
|
-
|
|
529
|
+
const r = this.attributes.getNamedItem(t.attributeName);
|
|
530
|
+
r && this.updateProperty(r);
|
|
828
531
|
});
|
|
829
532
|
}), this.mutationObserver.observe(this, {
|
|
830
533
|
attributes: !0
|
|
@@ -835,7 +538,7 @@ class G extends w {
|
|
|
835
538
|
return typeof e == "string" ? JSON.parse(e) : e;
|
|
836
539
|
}
|
|
837
540
|
createUnderlyingThreeObject() {
|
|
838
|
-
this.instance = new this.classSource(...this.parsedArgs().map((e) =>
|
|
541
|
+
this.instance = new this.classSource(...this.parsedArgs().map((e) => v(e, this)));
|
|
839
542
|
}
|
|
840
543
|
refreshAttributes() {
|
|
841
544
|
this.getAttributeNames().forEach((e) => {
|
|
@@ -844,31 +547,31 @@ class G extends w {
|
|
|
844
547
|
}), Array.from(this.attributes).forEach(this.updateProperty.bind(this));
|
|
845
548
|
}
|
|
846
549
|
async onUnderlyingThreeObjectReady() {
|
|
847
|
-
var
|
|
550
|
+
var r, s, n, o;
|
|
848
551
|
const e = this.instance;
|
|
849
|
-
e.uuid && this.setAttribute(
|
|
850
|
-
let t =
|
|
552
|
+
e.uuid && this.setAttribute(q, e.uuid);
|
|
553
|
+
let t = L(this);
|
|
851
554
|
for (; this != null && this.connected && !this.tryAddOnce && !t; )
|
|
852
|
-
await new Promise(requestAnimationFrame), t =
|
|
853
|
-
if (t && t.instance || (
|
|
854
|
-
const a = this.instance, h = this.instance, c = t.instance,
|
|
555
|
+
await new Promise(requestAnimationFrame), t = L(this);
|
|
556
|
+
if (t && t.instance || (r = t == null ? void 0 : t.three) != null && r.scene) {
|
|
557
|
+
const a = this.instance, h = this.instance, c = t.instance, f = t.instance ?? ((s = t.three) == null ? void 0 : s.scene), J = this.instance;
|
|
855
558
|
if ((n = a.type) != null && n.toLowerCase().includes("geometry") && c.geometry)
|
|
856
559
|
c.geometry = a;
|
|
857
560
|
else if ((o = h.type) != null && o.toLowerCase().includes("material") && c.material)
|
|
858
561
|
c.material = h;
|
|
859
|
-
else if (
|
|
562
|
+
else if (f.add)
|
|
860
563
|
try {
|
|
861
|
-
|
|
564
|
+
f.add(J), this.dispatchEvent(new CustomEvent("instanceadded", {
|
|
862
565
|
detail: {
|
|
863
566
|
instance: this.instance,
|
|
864
|
-
parent:
|
|
567
|
+
parent: f
|
|
865
568
|
}
|
|
866
569
|
}));
|
|
867
570
|
} catch {
|
|
868
|
-
throw new Error(`Error adding ${this.tagName} to ${
|
|
571
|
+
throw new Error(`Error adding ${this.tagName} to ${f}`);
|
|
869
572
|
}
|
|
870
|
-
const
|
|
871
|
-
|
|
573
|
+
const x = this.getAttribute("attach");
|
|
574
|
+
x && this.executeAttach(x, this.instance);
|
|
872
575
|
}
|
|
873
576
|
}
|
|
874
577
|
connectedCallback() {
|
|
@@ -880,24 +583,24 @@ class G extends w {
|
|
|
880
583
|
}
|
|
881
584
|
/** Update an instance's property. When creating a `<mesh position-y="0.5">`, for example, this sets `mesh.position.y = 0.5`. */
|
|
882
585
|
updateProperty(e) {
|
|
883
|
-
const { name: t, value:
|
|
884
|
-
let
|
|
586
|
+
const { name: t, value: r } = e;
|
|
587
|
+
let s = t;
|
|
885
588
|
Object.keys(this.instance ?? {}).forEach((a) => {
|
|
886
|
-
a.toLowerCase() ===
|
|
589
|
+
a.toLowerCase() === s && (s = a);
|
|
887
590
|
});
|
|
888
|
-
const n =
|
|
889
|
-
if (
|
|
591
|
+
const n = G(s);
|
|
592
|
+
if (k.includes(s) || k.includes(n[0]))
|
|
890
593
|
return;
|
|
891
|
-
let o =
|
|
594
|
+
let o = v(r, this);
|
|
892
595
|
try {
|
|
893
|
-
o = JSON.parse(
|
|
596
|
+
o = JSON.parse(r === "" ? "true" : r);
|
|
894
597
|
} catch {
|
|
895
598
|
}
|
|
896
|
-
this.instance &&
|
|
599
|
+
this.instance && _(this.instance, n, o);
|
|
897
600
|
}
|
|
898
601
|
executeAttach(e, t) {
|
|
899
|
-
const
|
|
900
|
-
|
|
602
|
+
const r = this.parentElement;
|
|
603
|
+
r.instance && _(r.instance, G(e), t);
|
|
901
604
|
}
|
|
902
605
|
disconnectedCallback() {
|
|
903
606
|
super.disconnectedCallback();
|
|
@@ -909,40 +612,40 @@ class G extends w {
|
|
|
909
612
|
var n, o;
|
|
910
613
|
if (!t)
|
|
911
614
|
return;
|
|
912
|
-
const
|
|
913
|
-
(n =
|
|
615
|
+
const r = t, s = t;
|
|
616
|
+
(n = r.dispose) == null || n.call(r), (o = s.removeFromParent) == null || o.call(s);
|
|
914
617
|
});
|
|
915
618
|
}
|
|
916
619
|
/** Render */
|
|
917
620
|
render() {
|
|
918
|
-
return
|
|
621
|
+
return O`<slot></slot>`;
|
|
919
622
|
}
|
|
920
623
|
createRenderRoot() {
|
|
921
624
|
return this;
|
|
922
625
|
}
|
|
923
626
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
],
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
],
|
|
930
|
-
const
|
|
931
|
-
const e = typeof i == "string" ?
|
|
932
|
-
if (!
|
|
627
|
+
z([
|
|
628
|
+
u({ type: Boolean, attribute: "try-add-once" })
|
|
629
|
+
], A.prototype, "tryAddOnce");
|
|
630
|
+
z([
|
|
631
|
+
ue()
|
|
632
|
+
], A.prototype, "connected");
|
|
633
|
+
const F = (i) => {
|
|
634
|
+
const e = typeof i == "string" ? d[i] : i;
|
|
635
|
+
if (!Y(e))
|
|
933
636
|
return null;
|
|
934
637
|
const t = i.toString().toLowerCase().endsWith("loader");
|
|
935
|
-
class
|
|
638
|
+
class r extends A {
|
|
936
639
|
constructor() {
|
|
937
640
|
super(e);
|
|
938
641
|
}
|
|
939
642
|
}
|
|
940
|
-
class
|
|
643
|
+
class s extends A {
|
|
941
644
|
constructor() {
|
|
942
645
|
super(...arguments), this.loader = null;
|
|
943
646
|
}
|
|
944
647
|
createUnderlyingThreeObject() {
|
|
945
|
-
this.loader = new e(...this.parsedArgs().map((o) =>
|
|
648
|
+
this.loader = new e(...this.parsedArgs().map((o) => v(o, this)));
|
|
946
649
|
}
|
|
947
650
|
async onUnderlyingThreeObjectReady() {
|
|
948
651
|
const o = this.getAttribute("src");
|
|
@@ -966,24 +669,24 @@ const Pe = (i) => {
|
|
|
966
669
|
super.disconnectedCallback(), this.disposeThreeObjects.call(this, [this.loader]);
|
|
967
670
|
}
|
|
968
671
|
}
|
|
969
|
-
return t ?
|
|
672
|
+
return t ? s : r;
|
|
970
673
|
};
|
|
971
|
-
var
|
|
972
|
-
for (var
|
|
973
|
-
(o = i[n]) && (
|
|
974
|
-
return
|
|
674
|
+
var me = Object.defineProperty, m = (i, e, t, r) => {
|
|
675
|
+
for (var s = void 0, n = i.length - 1, o; n >= 0; n--)
|
|
676
|
+
(o = i[n]) && (s = o(e, t, s) || s);
|
|
677
|
+
return s && me(e, t, s), s;
|
|
975
678
|
};
|
|
976
|
-
const
|
|
679
|
+
const fe = "orthographic", I = 1 / 0, R = class R extends $ {
|
|
977
680
|
constructor() {
|
|
978
|
-
super(), this.scratchV2 = new
|
|
979
|
-
e.forEach(({ target: t, contentRect:
|
|
980
|
-
var
|
|
981
|
-
if (t === this && ((
|
|
982
|
-
const n =
|
|
681
|
+
super(), this.scratchV2 = new d.Vector2(), this.background = null, this.dpr = I, this.headless = !1, this.manualRender = !1, this.dispatchBeforeRender = !1, this.dispatchAfterRender = !1, this.rendererArgs = [], this.cameraArgs = [], this.raycaster = new d.Raycaster(), this.raycastPool = [], this.frame = 1 / 0, this.three = this.createThree(), this.resizeObserver = new ResizeObserver((e) => {
|
|
682
|
+
e.forEach(({ target: t, contentRect: r }) => {
|
|
683
|
+
var s;
|
|
684
|
+
if (t === this && ((s = this.three.renderer) == null || s.setSize(r.width * this.dpr, r.height * this.dpr), this.three.camera)) {
|
|
685
|
+
const n = r.width / r.height;
|
|
983
686
|
if (this.three.camera.type.toLowerCase() === "perspectivecamera")
|
|
984
687
|
this.three.camera.aspect = n, this.three.camera.updateProjectionMatrix();
|
|
985
688
|
else if (this.three.camera.type.toLowerCase() === "orthographiccamera") {
|
|
986
|
-
const o =
|
|
689
|
+
const o = r.height / r.width, a = 10;
|
|
987
690
|
this.three.camera.top = o * a, this.three.camera.bottom = -o * a, this.three.camera.right = a, this.three.camera.left = -a, this.three.camera.updateProjectionMatrix();
|
|
988
691
|
}
|
|
989
692
|
this.manualRender || this.renderThree();
|
|
@@ -993,7 +696,7 @@ const nt = "orthographic", $e = 1 / 0, se = class se extends w {
|
|
|
993
696
|
}
|
|
994
697
|
/** Function called at startup when creating Lunchbox's default scene. */
|
|
995
698
|
createDefaultScene() {
|
|
996
|
-
return new
|
|
699
|
+
return new d.Scene();
|
|
997
700
|
}
|
|
998
701
|
createThree() {
|
|
999
702
|
return {
|
|
@@ -1004,47 +707,47 @@ const nt = "orthographic", $e = 1 / 0, se = class se extends w {
|
|
|
1004
707
|
}
|
|
1005
708
|
/** To run on start. */
|
|
1006
709
|
connectedCallback() {
|
|
1007
|
-
if (super.connectedCallback(), this.dpr ===
|
|
1008
|
-
const t = this[e] ?? this.getAttribute(e) ?? {},
|
|
1009
|
-
Object.entries(
|
|
1010
|
-
this.three[e] &&
|
|
710
|
+
if (super.connectedCallback(), this.dpr === I && (this.dpr = window.devicePixelRatio), this.three.camera || (this.getAttribute(fe) !== null ? this.three.camera = new d.OrthographicCamera(...this.cameraArgs) : this.three.camera = new d.PerspectiveCamera(...this.cameraArgs.length ? this.cameraArgs : [75])), ["scene", "camera", "renderer"].forEach((e) => {
|
|
711
|
+
const t = this[e] ?? this.getAttribute(e) ?? {}, r = typeof t == "string" ? JSON.parse(t) : t;
|
|
712
|
+
Object.entries(r).forEach(([s, n]) => {
|
|
713
|
+
this.three[e] && _(this.three[e], s.split("-"), v(n, this));
|
|
1011
714
|
});
|
|
1012
|
-
}), this.resizeObserver.observe(this), this.background !== null && (this.three.scene.background = new
|
|
1013
|
-
const e = new
|
|
715
|
+
}), this.resizeObserver.observe(this), this.background !== null && (this.three.scene.background = new d.Color(this.background)), !this.three.renderer && !this.headless) {
|
|
716
|
+
const e = new d.WebGLRenderer(...this.rendererArgs);
|
|
1014
717
|
e.domElement.addEventListener("pointermove", this.onPointerMove.bind(this)), e.domElement.addEventListener("mousemove", this.onPointerMove.bind(this)), e.domElement.addEventListener("click", this.onClick.bind(this)), this.three.renderer = e;
|
|
1015
718
|
}
|
|
1016
|
-
this.manualRender || this.updateLoop();
|
|
719
|
+
this.dispatchEvent(new CustomEvent("three-ready", { bubbles: !0, composed: !0, detail: { lunchbox: this } })), this.manualRender || this.updateLoop();
|
|
1017
720
|
}
|
|
1018
721
|
disconnectedCallback() {
|
|
1019
|
-
var e, t,
|
|
1020
|
-
(e = this.three.renderer) == null || e.domElement.removeEventListener("pointermove", this.onPointerMove.bind(this)), (t = this.three.renderer) == null || t.domElement.removeEventListener("mousemove", this.onPointerMove.bind(this)), (
|
|
722
|
+
var e, t, r, s;
|
|
723
|
+
(e = this.three.renderer) == null || e.domElement.removeEventListener("pointermove", this.onPointerMove.bind(this)), (t = this.three.renderer) == null || t.domElement.removeEventListener("mousemove", this.onPointerMove.bind(this)), (r = this.three.renderer) == null || r.domElement.removeEventListener("click", this.onClick.bind(this)), (s = this.three.renderer) == null || s.dispose(), this.resizeObserver.unobserve(this), cancelAnimationFrame(this.frame);
|
|
1021
724
|
}
|
|
1022
725
|
handleDefaultSlotChange(e) {
|
|
1023
726
|
e.target.assignedElements().forEach((t) => {
|
|
1024
|
-
const
|
|
1025
|
-
|
|
727
|
+
const r = t;
|
|
728
|
+
r.instance instanceof d.Object3D && t.getAttributeNames().includes(P) && t.getAttributeNames().includes(P) && this.raycastPool.push(r.instance);
|
|
1026
729
|
}), this.renderThree();
|
|
1027
730
|
}
|
|
1028
731
|
runRaycast(e) {
|
|
1029
732
|
var a, h;
|
|
1030
733
|
if (!this.raycastPool.length || !this.three.camera)
|
|
1031
734
|
return [];
|
|
1032
|
-
const t = ((a = this.three.renderer) == null ? void 0 : a.domElement.width) ?? 0,
|
|
735
|
+
const t = ((a = this.three.renderer) == null ? void 0 : a.domElement.width) ?? 0, r = ((h = this.three.renderer) == null ? void 0 : h.domElement.height) ?? 0, s = this.scratchV2.clone().set(
|
|
1033
736
|
e.clientX / (t / this.dpr) * 2 - 1,
|
|
1034
|
-
-(e.clientY / (
|
|
737
|
+
-(e.clientY / (r / this.dpr)) * 2 + 1
|
|
1035
738
|
);
|
|
1036
|
-
return this.raycaster.setFromCamera(
|
|
739
|
+
return this.raycaster.setFromCamera(s, this.three.camera), this.raycaster.intersectObjects(this.raycastPool).map((c) => ({
|
|
1037
740
|
intersect: c,
|
|
1038
741
|
// TODO: cache result of this query selector somewhere?
|
|
1039
|
-
element: this.querySelector(`[${
|
|
742
|
+
element: this.querySelector(`[${q}="${c.object.uuid}"]`)
|
|
1040
743
|
}));
|
|
1041
744
|
}
|
|
1042
745
|
// Pointer movement
|
|
1043
746
|
// ==================
|
|
1044
747
|
onPointerMove(e) {
|
|
1045
|
-
this.runRaycast.bind(this)(e).forEach((
|
|
1046
|
-
var
|
|
1047
|
-
e.type === "pointermove" ? ((
|
|
748
|
+
this.runRaycast.bind(this)(e).forEach((r) => {
|
|
749
|
+
var s, n, o, a;
|
|
750
|
+
e.type === "pointermove" ? ((s = r.element) == null || s.dispatchEvent(new PointerEvent("pointermove")), (n = r.element) == null || n.dispatchEvent(new CustomEvent(Ee, { detail: r }))) : e.type === "mousemove" && ((o = r.element) == null || o.dispatchEvent(new MouseEvent("mousemove")), (a = r.element) == null || a.dispatchEvent(new CustomEvent(be, { detail: r })));
|
|
1048
751
|
});
|
|
1049
752
|
}
|
|
1050
753
|
// Click handling
|
|
@@ -1052,19 +755,19 @@ const nt = "orthographic", $e = 1 / 0, se = class se extends w {
|
|
|
1052
755
|
onClick(e) {
|
|
1053
756
|
let t = [];
|
|
1054
757
|
if (e instanceof TouchEvent) {
|
|
1055
|
-
const
|
|
1056
|
-
t = this.runRaycast.bind(this)(
|
|
758
|
+
const r = e.touches[0];
|
|
759
|
+
t = this.runRaycast.bind(this)(r), t.forEach((s) => {
|
|
1057
760
|
var n;
|
|
1058
|
-
(n =
|
|
761
|
+
(n = s.element) == null || n.dispatchEvent(new TouchEvent("touchstart"));
|
|
1059
762
|
});
|
|
1060
763
|
} else
|
|
1061
|
-
t = this.runRaycast.bind(this)(e), t.forEach((
|
|
1062
|
-
var
|
|
1063
|
-
(
|
|
764
|
+
t = this.runRaycast.bind(this)(e), t.forEach((r) => {
|
|
765
|
+
var s;
|
|
766
|
+
(s = r.element) == null || s.dispatchEvent(new MouseEvent("click"));
|
|
1064
767
|
});
|
|
1065
|
-
t.forEach((
|
|
1066
|
-
var
|
|
1067
|
-
(
|
|
768
|
+
t.forEach((r) => {
|
|
769
|
+
var s;
|
|
770
|
+
(s = r.element) == null || s.dispatchEvent(new CustomEvent(ge, { detail: r }));
|
|
1068
771
|
});
|
|
1069
772
|
}
|
|
1070
773
|
updateLoop() {
|
|
@@ -1072,21 +775,21 @@ const nt = "orthographic", $e = 1 / 0, se = class se extends w {
|
|
|
1072
775
|
}
|
|
1073
776
|
/** Render the 3D scene. Optional scene/camera overrides; defaults to the internal scene and camera. */
|
|
1074
777
|
renderThree(e, t) {
|
|
1075
|
-
var
|
|
1076
|
-
this.dispatchBeforeRender && this.dispatchEvent(new CustomEvent(
|
|
778
|
+
var r;
|
|
779
|
+
this.dispatchBeforeRender && this.dispatchEvent(new CustomEvent(ve, {})), this.three.camera && ((r = this.three.renderer) == null || r.render(
|
|
1077
780
|
e ?? this.three.scene,
|
|
1078
781
|
t ?? this.three.camera
|
|
1079
|
-
), this.dispatchAfterRender && this.dispatchEvent(new CustomEvent(
|
|
782
|
+
), this.dispatchAfterRender && this.dispatchEvent(new CustomEvent(we, {})));
|
|
1080
783
|
}
|
|
1081
784
|
render() {
|
|
1082
785
|
var e;
|
|
1083
|
-
return
|
|
786
|
+
return O`
|
|
1084
787
|
<slot @slotchange=${this.handleDefaultSlotChange}></slot>
|
|
1085
788
|
${(e = this.three.renderer) == null ? void 0 : e.domElement}
|
|
1086
789
|
`;
|
|
1087
790
|
}
|
|
1088
791
|
};
|
|
1089
|
-
|
|
792
|
+
R.styles = V`
|
|
1090
793
|
:host {
|
|
1091
794
|
width: 100%;
|
|
1092
795
|
height: 100%;
|
|
@@ -1100,49 +803,49 @@ se.styles = Oe`
|
|
|
1100
803
|
max-height: 100%;
|
|
1101
804
|
}
|
|
1102
805
|
`;
|
|
1103
|
-
let
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
],
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
],
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
],
|
|
1113
|
-
|
|
1114
|
-
|
|
806
|
+
let l = R;
|
|
807
|
+
m([
|
|
808
|
+
u()
|
|
809
|
+
], l.prototype, "background");
|
|
810
|
+
m([
|
|
811
|
+
u()
|
|
812
|
+
], l.prototype, "dpr");
|
|
813
|
+
m([
|
|
814
|
+
u()
|
|
815
|
+
], l.prototype, "headless");
|
|
816
|
+
m([
|
|
817
|
+
u({
|
|
1115
818
|
attribute: "manual-render",
|
|
1116
819
|
type: Boolean
|
|
1117
820
|
})
|
|
1118
|
-
],
|
|
1119
|
-
|
|
1120
|
-
|
|
821
|
+
], l.prototype, "manualRender");
|
|
822
|
+
m([
|
|
823
|
+
u({
|
|
1121
824
|
attribute: "dispatch-before-render",
|
|
1122
825
|
type: Boolean
|
|
1123
826
|
})
|
|
1124
|
-
],
|
|
1125
|
-
|
|
1126
|
-
|
|
827
|
+
], l.prototype, "dispatchBeforeRender");
|
|
828
|
+
m([
|
|
829
|
+
u({
|
|
1127
830
|
attribute: "dispatch-after-render",
|
|
1128
831
|
type: Boolean
|
|
1129
832
|
})
|
|
1130
|
-
],
|
|
1131
|
-
|
|
1132
|
-
|
|
833
|
+
], l.prototype, "dispatchAfterRender");
|
|
834
|
+
m([
|
|
835
|
+
u({
|
|
1133
836
|
attribute: "renderer-args",
|
|
1134
837
|
type: Object
|
|
1135
838
|
})
|
|
1136
|
-
],
|
|
1137
|
-
|
|
1138
|
-
|
|
839
|
+
], l.prototype, "rendererArgs");
|
|
840
|
+
m([
|
|
841
|
+
u({
|
|
1139
842
|
attribute: "camera-args",
|
|
1140
843
|
type: Object
|
|
1141
844
|
})
|
|
1142
|
-
],
|
|
1143
|
-
class
|
|
845
|
+
], l.prototype, "cameraArgs");
|
|
846
|
+
class ye extends $ {
|
|
1144
847
|
constructor() {
|
|
1145
|
-
super(...arguments), this.parentLunchbox = null, this.frame = -1, this.scratchV3 = new
|
|
848
|
+
super(...arguments), this.parentLunchbox = null, this.frame = -1, this.scratchV3 = new d.Vector3(), this.scratchFrustum = new d.Frustum(), this.scratchMatrix4 = new d.Matrix4();
|
|
1146
849
|
}
|
|
1147
850
|
/** Try attaching the update function to pass the parent's position to children. */
|
|
1148
851
|
tryAttachUpdate() {
|
|
@@ -1152,28 +855,28 @@ class ot extends w {
|
|
|
1152
855
|
return !1;
|
|
1153
856
|
if (!e.isObject3D)
|
|
1154
857
|
throw new Error("html-anchor must be the child of an Object3D");
|
|
1155
|
-
const t =
|
|
858
|
+
const t = b(this, (a) => {
|
|
1156
859
|
var h;
|
|
1157
860
|
return !!((h = a == null ? void 0 : a.three) != null && h.renderer);
|
|
1158
861
|
});
|
|
1159
862
|
if (!t)
|
|
1160
863
|
return console.error("three-lunchbox parent required for html-anchor"), !1;
|
|
1161
|
-
const
|
|
1162
|
-
if (!
|
|
864
|
+
const r = t.three.camera;
|
|
865
|
+
if (!r)
|
|
1163
866
|
return console.error("camera required for html-anchor"), !1;
|
|
1164
|
-
const
|
|
1165
|
-
if (!(
|
|
867
|
+
const s = t.three.renderer;
|
|
868
|
+
if (!(s != null && s.domElement))
|
|
1166
869
|
return console.error("renderer and DOM element required for html-anchor"), !1;
|
|
1167
870
|
const n = () => {
|
|
1168
|
-
this.frame = requestAnimationFrame(n),
|
|
871
|
+
this.frame = requestAnimationFrame(n), r.updateMatrix(), r.updateMatrixWorld(), e.getWorldPosition(this.scratchV3);
|
|
1169
872
|
const a = this.scratchV3.clone();
|
|
1170
|
-
this.scratchV3.project(
|
|
1171
|
-
const h = this.scratchV3.clone().set(
|
|
873
|
+
this.scratchV3.project(r), this.scratchV3.multiplyScalar(0.5).addScalar(0.5), this.scratchV3.y = 1 - this.scratchV3.y;
|
|
874
|
+
const h = this.scratchV3.clone().set(s.domElement.width, s.domElement.height, 1);
|
|
1172
875
|
h.divideScalar(devicePixelRatio), this.scratchV3.multiply(h);
|
|
1173
|
-
const c = e.position.clone().distanceTo(
|
|
1174
|
-
this.scratchFrustum.setFromProjectionMatrix(this.scratchMatrix4.clone().multiplyMatrices(
|
|
1175
|
-
const
|
|
1176
|
-
this.style.setProperty("--left", `${this.scratchV3.x}px`), this.style.setProperty("--top", `${this.scratchV3.y}px`), this.style.setProperty("--distance-from-camera", `${c}`), this.style.setProperty("--in-frustum", `${
|
|
876
|
+
const c = e.position.clone().distanceTo(r.getWorldPosition(this.scratchV3.clone()));
|
|
877
|
+
this.scratchFrustum.setFromProjectionMatrix(this.scratchMatrix4.clone().multiplyMatrices(r.projectionMatrix, r.matrixWorldInverse));
|
|
878
|
+
const f = this.scratchFrustum.containsPoint(a);
|
|
879
|
+
this.style.setProperty("--left", `${this.scratchV3.x}px`), this.style.setProperty("--top", `${this.scratchV3.y}px`), this.style.setProperty("--distance-from-camera", `${c}`), this.style.setProperty("--in-frustum", `${f ? 1 : 0}`), f ? this.classList.add("in-frustum") : this.classList.remove("in-frustum");
|
|
1177
880
|
};
|
|
1178
881
|
return n(), !0;
|
|
1179
882
|
}
|
|
@@ -1193,59 +896,59 @@ class ot extends w {
|
|
|
1193
896
|
this.frame !== -1 && cancelAnimationFrame(this.frame);
|
|
1194
897
|
}
|
|
1195
898
|
render() {
|
|
1196
|
-
return
|
|
899
|
+
return O`<slot></slot>`;
|
|
1197
900
|
}
|
|
1198
901
|
createRenderRoot() {
|
|
1199
902
|
return this;
|
|
1200
903
|
}
|
|
1201
904
|
}
|
|
1202
|
-
const
|
|
905
|
+
const _e = ({
|
|
1203
906
|
prependList: i = []
|
|
1204
907
|
} = {}) => {
|
|
1205
908
|
Object.entries({
|
|
1206
|
-
"three-lunchbox":
|
|
1207
|
-
"html-anchor":
|
|
1208
|
-
}).forEach(([t,
|
|
1209
|
-
customElements.get(t) || customElements.define(t,
|
|
1210
|
-
}), [...i, ...
|
|
1211
|
-
const
|
|
1212
|
-
if (customElements.get(
|
|
909
|
+
"three-lunchbox": l,
|
|
910
|
+
"html-anchor": ye
|
|
911
|
+
}).forEach(([t, r]) => {
|
|
912
|
+
customElements.get(t) || customElements.define(t, r);
|
|
913
|
+
}), [...i, ...B].forEach((t) => {
|
|
914
|
+
const r = W(t);
|
|
915
|
+
if (customElements.get(r))
|
|
1213
916
|
return;
|
|
1214
|
-
const
|
|
1215
|
-
|
|
917
|
+
const s = F(t);
|
|
918
|
+
s && customElements.define(r, s);
|
|
1216
919
|
});
|
|
1217
|
-
},
|
|
920
|
+
}, Pe = (i, e, t = window) => {
|
|
1218
921
|
if (t.customElements.get(i)) {
|
|
1219
922
|
console.log(`${i} already registered as a custom element. Try a different name if registering is still required.`);
|
|
1220
923
|
return;
|
|
1221
924
|
}
|
|
1222
|
-
const
|
|
1223
|
-
if (
|
|
1224
|
-
t.customElements.define(i,
|
|
925
|
+
const r = F(e);
|
|
926
|
+
if (r)
|
|
927
|
+
t.customElements.define(i, r);
|
|
1225
928
|
else
|
|
1226
929
|
throw new Error(`Could not extend ${i}. The second paramater must be a class.`);
|
|
1227
|
-
},
|
|
930
|
+
}, Ee = "threepointermove", be = "threemousemove", ge = "threeclick", ve = "beforerender", we = "afterrender", W = (i) => {
|
|
1228
931
|
let e = i.split(/\.?(?=[A-Z])/).join("-").toLowerCase().replace(/-g-l-/, "-gl-");
|
|
1229
932
|
return e.includes("-") || (e = `three-${e}`), e;
|
|
1230
|
-
},
|
|
933
|
+
}, $e = B.map(W);
|
|
1231
934
|
export {
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
935
|
+
we as AFTER_RENDER_EVENT_NAME,
|
|
936
|
+
ve as BEFORE_RENDER_EVENT_NAME,
|
|
937
|
+
ye as HtmlAnchor,
|
|
938
|
+
ge as THREE_CLICK_EVENT_NAME,
|
|
939
|
+
be as THREE_MOUSE_MOVE_EVENT_NAME,
|
|
940
|
+
Ee as THREE_POINTER_MOVE_EVENT_NAME,
|
|
941
|
+
q as THREE_UUID_ATTRIBUTE_NAME,
|
|
942
|
+
A as ThreeBase,
|
|
943
|
+
l as ThreeLunchbox,
|
|
944
|
+
B as autoComponents,
|
|
945
|
+
b as closestPassShadow,
|
|
946
|
+
Pe as extend,
|
|
947
|
+
K as get,
|
|
948
|
+
L as getCandidateParent,
|
|
949
|
+
_e as initLunchbox,
|
|
950
|
+
Y as isClass,
|
|
951
|
+
X as isNumber,
|
|
952
|
+
Q as set,
|
|
953
|
+
$e as webComponentNames
|
|
1251
954
|
};
|