@cxl/build 1.0.0-beta.6 → 1.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/3doc.js +725 -174
- package/README.md +2 -2
- package/audit.d.ts +1 -1
- package/builder.d.ts +2 -2
- package/chunk-5TBO732O.js +1 -0
- package/chunk-BRS7FMWC.js +44 -0
- package/chunk-H5JLK2JS.js +3 -0
- package/chunk-SAGAXEIB.js +0 -0
- package/chunk-X2FGYCN3.js +2 -0
- package/chunk-YAYBL74F.js +1 -0
- package/chunk-Z5ZAKSCR.js +3 -0
- package/docs.d.ts +3 -0
- package/eslint-config.d.ts +1 -1
- package/eslint-config.js +35 -2
- package/file.d.ts +7 -6
- package/git.d.ts +1 -0
- package/index.d.ts +9 -3
- package/index.js +2 -0
- package/library-VNI53TU5.js +1 -0
- package/lint.d.ts +3 -1
- package/npm.d.ts +6 -6
- package/package.d.ts +4 -3
- package/package.json +10 -7
- package/render-A7IJMLQH.js +1 -0
- package/{render-html-3KIHSJJY-VNYRPRM7.js → render-html-AGCMTFIF-RDB43NBT.js} +22 -24
- package/render-md-OFBTLFMU-FMSPZNTU.js +18 -0
- package/render-summary-RXMLD7DO.js +1 -0
- package/root-5D4JT3VY.js +12 -0
- package/spec-browser.js +1682 -104
- package/spec.d.ts +19 -0
- package/tsc.d.ts +9 -1
- package/chunk-FSRPMVAS.js +0 -1
- package/chunk-KPQXDQIW.js +0 -44
- package/chunk-SWJCWBGM.js +0 -1
- package/chunk-TMHR6BIT.js +0 -4
- package/hljs.css +0 -104
- package/index.bundle.js +0 -2
- package/library-PNA444FE.js +0 -1
- package/png-BPHNXF4V.js +0 -1
- package/render-WEE5MH6Y.js +0 -1
- package/render-summary-LMSHEX67-C5I3XNGJ.js +0 -1
- package/root-G5JDVI4D.js +0 -9
package/spec-browser.js
CHANGED
|
@@ -1,132 +1,1710 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../ui-core/dist/ui/rx.js
|
|
2
|
+
var Undefined = {};
|
|
3
|
+
var Terminator = Symbol("terminator");
|
|
4
|
+
function Subscriber(observer, subscribe) {
|
|
5
|
+
let closed = false;
|
|
6
|
+
const result = {
|
|
7
|
+
error: error2,
|
|
8
|
+
unsubscribe,
|
|
9
|
+
get closed() {
|
|
10
|
+
return closed;
|
|
11
|
+
},
|
|
12
|
+
signal: new Signal(),
|
|
13
|
+
next(val) {
|
|
14
|
+
if (closed)
|
|
15
|
+
return;
|
|
16
|
+
try {
|
|
17
|
+
observer.next?.(val);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
error2(e);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
complete() {
|
|
23
|
+
if (!closed) {
|
|
24
|
+
try {
|
|
25
|
+
observer.complete?.();
|
|
26
|
+
} finally {
|
|
27
|
+
unsubscribe();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
observer.signal?.subscribe(unsubscribe);
|
|
33
|
+
function error2(e) {
|
|
34
|
+
if (!closed) {
|
|
35
|
+
if (!observer.error) {
|
|
36
|
+
unsubscribe();
|
|
37
|
+
throw e;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
observer.error(e);
|
|
41
|
+
} finally {
|
|
42
|
+
unsubscribe();
|
|
43
|
+
}
|
|
44
|
+
} else
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
function unsubscribe() {
|
|
48
|
+
if (!closed) {
|
|
49
|
+
closed = true;
|
|
50
|
+
result.signal.next();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
subscribe?.(result);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
error2(e);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
var Observable = class {
|
|
61
|
+
__subscribe;
|
|
62
|
+
constructor(__subscribe) {
|
|
63
|
+
this.__subscribe = __subscribe;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The `then` method allows an Observable to act like a Promise.
|
|
67
|
+
* It converts the Observable's emissions into a Promise that resolves on completion.
|
|
68
|
+
*/
|
|
69
|
+
then(resolve, reject) {
|
|
70
|
+
return toPromise(this).then(resolve, reject);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Used to stitch together functional operators into a chain.
|
|
74
|
+
*/
|
|
75
|
+
pipe(...extra) {
|
|
76
|
+
return extra.reduce((prev, fn) => fn(prev), this);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.
|
|
80
|
+
*/
|
|
81
|
+
subscribe(next) {
|
|
82
|
+
const observer = !next || typeof next === "function" ? { next } : next;
|
|
83
|
+
return Subscriber(observer, this.__subscribe);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var Subject = class extends Observable {
|
|
87
|
+
closed = false;
|
|
88
|
+
signal = new Signal();
|
|
89
|
+
observers = /* @__PURE__ */ new Set();
|
|
90
|
+
constructor() {
|
|
91
|
+
super((subscriber) => this.onSubscribe(subscriber));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Emits a new value to all active subscribers if the Subject is not in a closed state.
|
|
95
|
+
* - Iterates over the list of current subscribers and calls their `next` method with the provided value.
|
|
96
|
+
* - Inactive or closed subscribers are skipped.
|
|
97
|
+
* - This ensures only active subscribers receive new emissions.
|
|
98
|
+
*/
|
|
99
|
+
next(a) {
|
|
100
|
+
if (!this.closed) {
|
|
101
|
+
for (const s of Array.from(this.observers))
|
|
102
|
+
if (!s.closed)
|
|
103
|
+
s.next(a);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/*
|
|
107
|
+
* This method emits an error notification to all active subscribers and sets the Subject's
|
|
108
|
+
* closed state to `true`, preventing any further emissions.
|
|
109
|
+
*/
|
|
110
|
+
error(e) {
|
|
111
|
+
if (!this.closed) {
|
|
112
|
+
this.closed = true;
|
|
113
|
+
let shouldThrow = false, lastError;
|
|
114
|
+
for (const s of Array.from(this.observers))
|
|
115
|
+
try {
|
|
116
|
+
s.error(e);
|
|
117
|
+
} catch (e2) {
|
|
118
|
+
shouldThrow = true;
|
|
119
|
+
lastError = e2;
|
|
120
|
+
}
|
|
121
|
+
if (shouldThrow)
|
|
122
|
+
throw lastError;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/*
|
|
126
|
+
* `complete` method sends a final completion notification to all active subscribers
|
|
127
|
+
* and marks the Subject as closed.
|
|
128
|
+
*/
|
|
129
|
+
complete() {
|
|
130
|
+
if (!this.closed) {
|
|
131
|
+
this.closed = true;
|
|
132
|
+
Array.from(this.observers).forEach((s) => s.complete());
|
|
133
|
+
this.observers.clear();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
onSubscribe(subscriber) {
|
|
137
|
+
if (this.closed)
|
|
138
|
+
subscriber.complete();
|
|
139
|
+
else {
|
|
140
|
+
this.observers.add(subscriber);
|
|
141
|
+
subscriber.signal.subscribe(() => this.observers.delete(subscriber));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var Signal = class extends Observable {
|
|
146
|
+
closed = false;
|
|
147
|
+
observers = /* @__PURE__ */ new Set();
|
|
148
|
+
constructor() {
|
|
149
|
+
super((subscriber) => {
|
|
150
|
+
if (this.closed) {
|
|
151
|
+
subscriber.next();
|
|
152
|
+
subscriber.complete();
|
|
153
|
+
} else
|
|
154
|
+
this.observers.add(subscriber);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
next() {
|
|
158
|
+
if (!this.closed) {
|
|
159
|
+
this.closed = true;
|
|
160
|
+
for (const s of Array.from(this.observers))
|
|
161
|
+
if (!s.closed) {
|
|
162
|
+
s.next();
|
|
163
|
+
s.complete();
|
|
164
|
+
}
|
|
165
|
+
this.observers.clear();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
var OrderedSubject = class extends Subject {
|
|
170
|
+
queue = [];
|
|
171
|
+
emitting = false;
|
|
172
|
+
next(a) {
|
|
173
|
+
if (this.closed)
|
|
174
|
+
return;
|
|
175
|
+
if (this.emitting)
|
|
176
|
+
this.queue.push(a);
|
|
177
|
+
else {
|
|
178
|
+
this.emitting = true;
|
|
179
|
+
super.next(a);
|
|
180
|
+
while (this.queue.length)
|
|
181
|
+
super.next(this.queue.shift());
|
|
182
|
+
this.emitting = false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
var BehaviorSubject = class extends Subject {
|
|
187
|
+
currentValue;
|
|
188
|
+
constructor(currentValue) {
|
|
189
|
+
super();
|
|
190
|
+
this.currentValue = currentValue;
|
|
191
|
+
}
|
|
192
|
+
get value() {
|
|
193
|
+
return this.currentValue;
|
|
194
|
+
}
|
|
195
|
+
next(val) {
|
|
196
|
+
this.currentValue = val;
|
|
197
|
+
super.next(val);
|
|
198
|
+
}
|
|
199
|
+
onSubscribe(subscription) {
|
|
200
|
+
const result = super.onSubscribe(subscription);
|
|
201
|
+
if (!this.closed)
|
|
202
|
+
subscription.next(this.currentValue);
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
var ReplaySubject = class extends Subject {
|
|
207
|
+
bufferSize;
|
|
208
|
+
buffer = [];
|
|
209
|
+
hasError = false;
|
|
210
|
+
lastError;
|
|
211
|
+
constructor(bufferSize = Infinity) {
|
|
212
|
+
super();
|
|
213
|
+
this.bufferSize = bufferSize;
|
|
214
|
+
}
|
|
215
|
+
error(val) {
|
|
216
|
+
this.hasError = true;
|
|
217
|
+
this.lastError = val;
|
|
218
|
+
super.error(val);
|
|
219
|
+
}
|
|
220
|
+
next(val) {
|
|
221
|
+
if (this.buffer.length === this.bufferSize)
|
|
222
|
+
this.buffer.shift();
|
|
223
|
+
this.buffer.push(val);
|
|
224
|
+
return super.next(val);
|
|
225
|
+
}
|
|
226
|
+
onSubscribe(subscriber) {
|
|
227
|
+
this.observers.add(subscriber);
|
|
228
|
+
this.buffer.forEach((val) => subscriber.next(val));
|
|
229
|
+
if (this.hasError)
|
|
230
|
+
subscriber.error(this.lastError);
|
|
231
|
+
else if (this.closed)
|
|
232
|
+
subscriber.complete();
|
|
233
|
+
subscriber.signal.subscribe(() => this.observers.delete(subscriber));
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
var Reference = class extends Subject {
|
|
237
|
+
$value = Undefined;
|
|
238
|
+
get hasValue() {
|
|
239
|
+
return this.$value !== Undefined;
|
|
240
|
+
}
|
|
241
|
+
get value() {
|
|
242
|
+
if (this.$value === Undefined)
|
|
243
|
+
throw new Error("Reference not initialized");
|
|
244
|
+
return this.$value;
|
|
245
|
+
}
|
|
246
|
+
next(val) {
|
|
247
|
+
this.$value = val;
|
|
248
|
+
return super.next(val);
|
|
249
|
+
}
|
|
250
|
+
onSubscribe(subscription) {
|
|
251
|
+
if (!this.closed && this.$value !== Undefined)
|
|
252
|
+
subscription.next(this.$value);
|
|
253
|
+
super.onSubscribe(subscription);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
var EmptyError = class extends Error {
|
|
257
|
+
message = "No elements in sequence";
|
|
258
|
+
};
|
|
259
|
+
function concat(...observables) {
|
|
260
|
+
return new Observable((subscriber) => {
|
|
261
|
+
let index = 0;
|
|
262
|
+
let innerSignal;
|
|
263
|
+
function onComplete() {
|
|
264
|
+
const next = observables[index++];
|
|
265
|
+
if (next && !subscriber.closed) {
|
|
266
|
+
innerSignal?.next();
|
|
267
|
+
next.subscribe({
|
|
268
|
+
next: subscriber.next,
|
|
269
|
+
error: subscriber.error,
|
|
270
|
+
complete: onComplete,
|
|
271
|
+
signal: innerSignal = new Signal()
|
|
272
|
+
});
|
|
273
|
+
} else
|
|
274
|
+
subscriber.complete();
|
|
275
|
+
}
|
|
276
|
+
subscriber.signal.subscribe(() => innerSignal?.next());
|
|
277
|
+
onComplete();
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function defer(fn) {
|
|
281
|
+
return new Observable((subs) => {
|
|
282
|
+
fn().subscribe(subs);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function fromPromise(input) {
|
|
286
|
+
return new Observable((subs) => {
|
|
287
|
+
input.then((result) => {
|
|
288
|
+
if (!subs.closed)
|
|
289
|
+
subs.next(result);
|
|
290
|
+
subs.complete();
|
|
291
|
+
}).catch((err) => subs.error(err));
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
function fromIterable(input) {
|
|
295
|
+
return new Observable((subs) => {
|
|
296
|
+
for (const item of input)
|
|
297
|
+
if (!subs.closed)
|
|
298
|
+
subs.next(item);
|
|
299
|
+
subs.complete();
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function from(input) {
|
|
303
|
+
if (input instanceof Observable)
|
|
304
|
+
return input;
|
|
305
|
+
if (input instanceof Promise)
|
|
306
|
+
return fromPromise(input);
|
|
307
|
+
return fromIterable(input);
|
|
308
|
+
}
|
|
309
|
+
function of(...values) {
|
|
310
|
+
return fromIterable(values);
|
|
311
|
+
}
|
|
312
|
+
function _toPromise(observable2) {
|
|
313
|
+
return new Promise((resolve, reject) => {
|
|
314
|
+
let value = Undefined;
|
|
315
|
+
observable2.subscribe({
|
|
316
|
+
next: (val) => value = val,
|
|
317
|
+
error: (e) => reject(e),
|
|
318
|
+
complete: () => resolve(value)
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function toPromise(observable2) {
|
|
323
|
+
return _toPromise(observable2).then((r) => r === Undefined ? void 0 : r);
|
|
324
|
+
}
|
|
325
|
+
function operatorNext(fn, unsubscribe) {
|
|
326
|
+
return operator((subs) => ({ next: fn(subs), unsubscribe }));
|
|
327
|
+
}
|
|
328
|
+
function operator(fn) {
|
|
329
|
+
return (source) => new Observable((subscriber) => {
|
|
330
|
+
const next = fn(subscriber, source);
|
|
331
|
+
if (next.unsubscribe)
|
|
332
|
+
subscriber.signal.subscribe(() => next.unsubscribe?.());
|
|
333
|
+
if (!next.error)
|
|
334
|
+
next.error = subscriber.error;
|
|
335
|
+
if (!next.complete)
|
|
336
|
+
next.complete = subscriber.complete;
|
|
337
|
+
next.signal = subscriber.signal;
|
|
338
|
+
source.subscribe(next);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function map(mapFn) {
|
|
342
|
+
return operatorNext((subscriber) => (val) => subscriber.next(mapFn(val)));
|
|
343
|
+
}
|
|
344
|
+
function select(mapFn) {
|
|
345
|
+
let lastValue = Undefined;
|
|
346
|
+
return operatorNext((subscriber) => (val) => {
|
|
347
|
+
const result = mapFn(val);
|
|
348
|
+
if (result !== lastValue) {
|
|
349
|
+
lastValue = result;
|
|
350
|
+
subscriber.next(result);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function reduce(reduceFn, seed) {
|
|
355
|
+
return operator((subscriber) => {
|
|
356
|
+
let acc = seed;
|
|
357
|
+
let i = 0;
|
|
358
|
+
return {
|
|
359
|
+
next(val) {
|
|
360
|
+
acc = reduceFn(acc, val, i++);
|
|
361
|
+
},
|
|
362
|
+
complete() {
|
|
363
|
+
subscriber.next(acc);
|
|
364
|
+
subscriber.complete();
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
function throttleTime(time) {
|
|
370
|
+
return operator((subscriber) => {
|
|
371
|
+
let ready = true;
|
|
372
|
+
let to;
|
|
373
|
+
return {
|
|
374
|
+
next(val) {
|
|
375
|
+
if (!ready)
|
|
376
|
+
return;
|
|
377
|
+
ready = false;
|
|
378
|
+
subscriber.next(val);
|
|
379
|
+
to = setTimeout(() => ready = true, time);
|
|
380
|
+
},
|
|
381
|
+
unsubscribe: () => clearTimeout(to)
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function timer(delay) {
|
|
386
|
+
return new Observable((subscriber) => {
|
|
387
|
+
const to = setTimeout(() => {
|
|
388
|
+
subscriber.next();
|
|
389
|
+
subscriber.complete();
|
|
390
|
+
}, delay);
|
|
391
|
+
subscriber.signal.subscribe(() => clearTimeout(to));
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
function debounceTime(time, useTimer = timer) {
|
|
395
|
+
return switchMap((val) => useTimer(time).map(() => val));
|
|
396
|
+
}
|
|
397
|
+
function switchMap(project) {
|
|
398
|
+
return (source) => observable((subscriber) => {
|
|
399
|
+
let hasSubscription = false;
|
|
400
|
+
let completed = false;
|
|
401
|
+
let signal;
|
|
402
|
+
const cleanUp = () => {
|
|
403
|
+
signal?.next();
|
|
404
|
+
hasSubscription = false;
|
|
405
|
+
if (completed)
|
|
406
|
+
subscriber.complete();
|
|
407
|
+
};
|
|
408
|
+
const outerSignal = new Signal();
|
|
409
|
+
subscriber.signal.subscribe(() => {
|
|
410
|
+
cleanUp();
|
|
411
|
+
outerSignal.next();
|
|
412
|
+
});
|
|
413
|
+
source.subscribe({
|
|
414
|
+
next(val) {
|
|
415
|
+
cleanUp();
|
|
416
|
+
signal = new Signal();
|
|
417
|
+
hasSubscription = true;
|
|
418
|
+
from(project(val)).subscribe({
|
|
419
|
+
next: subscriber.next,
|
|
420
|
+
error: subscriber.error,
|
|
421
|
+
complete: cleanUp,
|
|
422
|
+
signal
|
|
423
|
+
});
|
|
424
|
+
},
|
|
425
|
+
error: subscriber.error,
|
|
426
|
+
complete() {
|
|
427
|
+
completed = true;
|
|
428
|
+
if (!hasSubscription)
|
|
429
|
+
subscriber.complete();
|
|
430
|
+
},
|
|
431
|
+
signal: outerSignal
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
function mergeMap(project) {
|
|
436
|
+
return (source) => observable((subscriber) => {
|
|
437
|
+
const signal = subscriber.signal;
|
|
438
|
+
let count = 0;
|
|
439
|
+
let completed = 0;
|
|
440
|
+
let sourceCompleted = false;
|
|
441
|
+
source.subscribe({
|
|
442
|
+
next: (val) => {
|
|
443
|
+
count++;
|
|
444
|
+
from(project(val)).subscribe({
|
|
445
|
+
next: subscriber.next,
|
|
446
|
+
error: subscriber.error,
|
|
447
|
+
complete: () => {
|
|
448
|
+
completed++;
|
|
449
|
+
if (sourceCompleted && completed === count) {
|
|
450
|
+
subscriber.complete();
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
signal
|
|
454
|
+
});
|
|
455
|
+
},
|
|
456
|
+
error: subscriber.error,
|
|
457
|
+
complete() {
|
|
458
|
+
sourceCompleted = true;
|
|
459
|
+
if (completed === count)
|
|
460
|
+
subscriber.complete();
|
|
461
|
+
},
|
|
462
|
+
signal
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
function concatMap(project) {
|
|
467
|
+
return operator((subscriber) => {
|
|
468
|
+
const outerSignal = new Signal();
|
|
469
|
+
let innerSignal;
|
|
470
|
+
let innerSubscription;
|
|
471
|
+
const queue = [];
|
|
472
|
+
let completed = false;
|
|
473
|
+
let active = false;
|
|
474
|
+
const cleanUp = () => {
|
|
475
|
+
innerSignal?.next();
|
|
476
|
+
innerSignal = void 0;
|
|
477
|
+
innerSubscription = void 0;
|
|
478
|
+
active = false;
|
|
479
|
+
if (queue.length && !subscriber.closed)
|
|
480
|
+
run(queue.shift());
|
|
481
|
+
else if (completed)
|
|
482
|
+
subscriber.complete();
|
|
483
|
+
};
|
|
484
|
+
const run = (val) => {
|
|
485
|
+
active = true;
|
|
486
|
+
innerSignal = new Signal();
|
|
487
|
+
innerSubscription = from(project(val)).subscribe({
|
|
488
|
+
next: subscriber.next,
|
|
489
|
+
error: subscriber.error,
|
|
490
|
+
complete: cleanUp,
|
|
491
|
+
signal: innerSignal
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
subscriber.signal.subscribe(() => {
|
|
495
|
+
innerSignal?.next();
|
|
496
|
+
outerSignal.next();
|
|
497
|
+
});
|
|
498
|
+
return {
|
|
499
|
+
next(val) {
|
|
500
|
+
if (active)
|
|
501
|
+
queue.push(val);
|
|
502
|
+
else
|
|
503
|
+
run(val);
|
|
504
|
+
},
|
|
505
|
+
error: subscriber.error,
|
|
506
|
+
complete() {
|
|
507
|
+
completed = true;
|
|
508
|
+
if (!active && queue.length === 0)
|
|
509
|
+
subscriber.complete();
|
|
510
|
+
},
|
|
511
|
+
signal: outerSignal,
|
|
512
|
+
unsubscribe: () => innerSubscription?.unsubscribe()
|
|
513
|
+
};
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function exhaustMap(project) {
|
|
517
|
+
return operator((subscriber) => {
|
|
518
|
+
let ready = true;
|
|
519
|
+
return {
|
|
520
|
+
next(val) {
|
|
521
|
+
if (ready) {
|
|
522
|
+
ready = false;
|
|
523
|
+
from(project(val)).subscribe({
|
|
524
|
+
next: subscriber.next,
|
|
525
|
+
error: subscriber.error,
|
|
526
|
+
complete: () => ready = true,
|
|
527
|
+
signal: subscriber.signal
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
function filter(fn) {
|
|
535
|
+
return operatorNext((subscriber) => (val) => {
|
|
536
|
+
if (fn(val))
|
|
537
|
+
subscriber.next(val);
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
function take(howMany) {
|
|
541
|
+
return operatorNext((subs) => (val) => {
|
|
542
|
+
if (howMany-- > 0 && !subs.closed)
|
|
543
|
+
subs.next(val);
|
|
544
|
+
if (howMany <= 0 || subs.closed)
|
|
545
|
+
subs.complete();
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
function takeWhile(fn) {
|
|
549
|
+
return operatorNext((subs) => (val) => {
|
|
550
|
+
if (!subs.closed && fn(val))
|
|
551
|
+
subs.next(val);
|
|
552
|
+
else
|
|
553
|
+
subs.complete();
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
function first() {
|
|
557
|
+
let done = false;
|
|
558
|
+
return operator((subs) => ({
|
|
559
|
+
next(val) {
|
|
560
|
+
if (done)
|
|
561
|
+
return;
|
|
562
|
+
done = true;
|
|
563
|
+
subs.next(val);
|
|
564
|
+
subs.complete();
|
|
565
|
+
},
|
|
566
|
+
complete() {
|
|
567
|
+
if (!subs.closed)
|
|
568
|
+
subs.error(new EmptyError());
|
|
569
|
+
}
|
|
570
|
+
}));
|
|
571
|
+
}
|
|
572
|
+
function tap(fn) {
|
|
573
|
+
return operatorNext((subscriber) => (val) => {
|
|
574
|
+
fn(val);
|
|
575
|
+
subscriber.next(val);
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
function catchError(selector) {
|
|
579
|
+
return operator((subscriber, source) => {
|
|
580
|
+
let signal;
|
|
581
|
+
const observer = {
|
|
582
|
+
next: subscriber.next,
|
|
583
|
+
error(err) {
|
|
584
|
+
try {
|
|
585
|
+
if (subscriber.closed)
|
|
586
|
+
return;
|
|
587
|
+
const result = selector(err, source);
|
|
588
|
+
signal?.next();
|
|
589
|
+
signal = new Signal();
|
|
590
|
+
result.subscribe({ ...observer, signal });
|
|
591
|
+
} catch (err2) {
|
|
592
|
+
subscriber.error(err2);
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
unsubscribe: () => signal?.next()
|
|
596
|
+
};
|
|
597
|
+
return observer;
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
function distinctUntilChanged() {
|
|
601
|
+
return operatorNext((subscriber) => {
|
|
602
|
+
let lastValue = Undefined;
|
|
603
|
+
return (val) => {
|
|
604
|
+
if (val !== lastValue) {
|
|
605
|
+
lastValue = val;
|
|
606
|
+
subscriber.next(val);
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
function shareLatest() {
|
|
612
|
+
return (source) => {
|
|
613
|
+
const subject = new ReplaySubject(1);
|
|
614
|
+
let ready = false;
|
|
615
|
+
return observable((subs) => {
|
|
616
|
+
subject.subscribe(subs);
|
|
617
|
+
if (!ready) {
|
|
618
|
+
ready = true;
|
|
619
|
+
source.subscribe(subject);
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
function share() {
|
|
625
|
+
return (source) => {
|
|
626
|
+
let subject;
|
|
627
|
+
let subscriptionCount = 0;
|
|
628
|
+
function complete() {
|
|
629
|
+
if (--subscriptionCount === 0)
|
|
630
|
+
subject.signal.next();
|
|
631
|
+
}
|
|
632
|
+
return observable((subs) => {
|
|
633
|
+
subs.signal.subscribe(complete);
|
|
634
|
+
if (subscriptionCount++ === 0) {
|
|
635
|
+
subject = ref();
|
|
636
|
+
subject.subscribe(subs);
|
|
637
|
+
source.subscribe(subject);
|
|
638
|
+
} else
|
|
639
|
+
subject.subscribe(subs);
|
|
640
|
+
});
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
function publishLast() {
|
|
644
|
+
return (source) => {
|
|
645
|
+
const subject = new Subject();
|
|
646
|
+
let sourceSubscription;
|
|
647
|
+
let lastValue;
|
|
648
|
+
let hasEmitted = false;
|
|
649
|
+
let ready = false;
|
|
650
|
+
return observable((subs) => {
|
|
651
|
+
if (ready) {
|
|
652
|
+
subs.next(lastValue);
|
|
653
|
+
subs.complete();
|
|
654
|
+
} else
|
|
655
|
+
subject.subscribe(subs);
|
|
656
|
+
sourceSubscription ??= source.subscribe({
|
|
657
|
+
next: (val) => {
|
|
658
|
+
hasEmitted = true;
|
|
659
|
+
lastValue = val;
|
|
660
|
+
},
|
|
661
|
+
error: subs.error,
|
|
662
|
+
complete() {
|
|
663
|
+
ready = true;
|
|
664
|
+
if (hasEmitted)
|
|
665
|
+
subject.next(lastValue);
|
|
666
|
+
subject.complete();
|
|
667
|
+
},
|
|
668
|
+
signal: subs.signal
|
|
669
|
+
});
|
|
670
|
+
});
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
function merge(...observables) {
|
|
674
|
+
if (observables.length === 1)
|
|
675
|
+
return observables[0];
|
|
676
|
+
return new Observable((subs) => {
|
|
677
|
+
let refCount = observables.length;
|
|
678
|
+
for (const o of observables)
|
|
679
|
+
if (!subs.closed)
|
|
680
|
+
o.subscribe({
|
|
681
|
+
next: subs.next,
|
|
682
|
+
error: subs.error,
|
|
683
|
+
complete() {
|
|
684
|
+
if (refCount-- === 1)
|
|
685
|
+
subs.complete();
|
|
686
|
+
},
|
|
687
|
+
signal: subs.signal
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
function finalize(unsubscribe) {
|
|
692
|
+
return operator((subscriber) => ({
|
|
693
|
+
next: subscriber.next,
|
|
694
|
+
unsubscribe
|
|
695
|
+
}));
|
|
696
|
+
}
|
|
697
|
+
function ignoreElements() {
|
|
698
|
+
return filter(() => false);
|
|
699
|
+
}
|
|
700
|
+
var EMPTY = new Observable((subs) => subs.complete());
|
|
701
|
+
function be(initialValue) {
|
|
702
|
+
return new BehaviorSubject(initialValue);
|
|
703
|
+
}
|
|
704
|
+
function observable(subscribe) {
|
|
705
|
+
return new Observable(subscribe);
|
|
706
|
+
}
|
|
707
|
+
function ref() {
|
|
708
|
+
return new Reference();
|
|
709
|
+
}
|
|
710
|
+
var operators = {
|
|
711
|
+
catchError,
|
|
712
|
+
concatMap,
|
|
713
|
+
debounceTime,
|
|
714
|
+
distinctUntilChanged,
|
|
715
|
+
exhaustMap,
|
|
716
|
+
filter,
|
|
717
|
+
finalize,
|
|
718
|
+
first,
|
|
719
|
+
ignoreElements,
|
|
720
|
+
map,
|
|
721
|
+
mergeMap,
|
|
722
|
+
publishLast,
|
|
723
|
+
reduce,
|
|
724
|
+
select,
|
|
725
|
+
share,
|
|
726
|
+
shareLatest,
|
|
727
|
+
switchMap,
|
|
728
|
+
take,
|
|
729
|
+
takeWhile,
|
|
730
|
+
tap,
|
|
731
|
+
throttleTime
|
|
732
|
+
};
|
|
733
|
+
for (const p in operators) {
|
|
734
|
+
Observable.prototype[p] = function(...args) {
|
|
735
|
+
return this.pipe(operators[p](...args));
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// ../../ui-core/dist/ui/dom.js
|
|
740
|
+
function on(element, event, options) {
|
|
741
|
+
return new Observable((subscriber) => {
|
|
742
|
+
const handler = subscriber.next.bind(subscriber);
|
|
743
|
+
element.addEventListener(event, handler, options);
|
|
744
|
+
subscriber.signal.subscribe(() => element.removeEventListener(event, handler, options));
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
function debounceRaf(fn) {
|
|
748
|
+
let to;
|
|
749
|
+
return function(...args) {
|
|
750
|
+
if (to)
|
|
751
|
+
cancelAnimationFrame(to);
|
|
752
|
+
to = requestAnimationFrame(() => {
|
|
753
|
+
fn.apply(this, args);
|
|
754
|
+
to = 0;
|
|
755
|
+
});
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
function raf(fn) {
|
|
759
|
+
return operator((subscriber) => {
|
|
760
|
+
const next = debounceRaf((val) => {
|
|
761
|
+
if (subscriber.closed)
|
|
762
|
+
return;
|
|
763
|
+
if (fn)
|
|
764
|
+
fn(val);
|
|
765
|
+
subscriber.next(val);
|
|
766
|
+
if (completed)
|
|
767
|
+
subscriber.complete();
|
|
768
|
+
});
|
|
769
|
+
let completed = false;
|
|
770
|
+
return {
|
|
771
|
+
next,
|
|
772
|
+
complete: () => completed = true
|
|
773
|
+
};
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function onEvent(css2, onEv, offEv) {
|
|
777
|
+
return ($) => concat(of(css2 ? $.matches(css2) : false), on($, onEv).switchMap(() => merge(of(true), on($, offEv).map(() => css2 ? $.matches(css2) : false))));
|
|
778
|
+
}
|
|
779
|
+
var animated = onEvent("", "animationstart", "animationend");
|
|
780
|
+
var hovered = onEvent("", "mouseenter", "mouseleave");
|
|
781
|
+
var focused = onEvent(":focus,:focus-within", "focusin", "focusout");
|
|
782
|
+
|
|
783
|
+
// ../../ui-core/dist/ui/component.js
|
|
784
|
+
var LOG = tap((val) => console.trace(val));
|
|
785
|
+
Observable.prototype.log = function() {
|
|
786
|
+
return this.pipe(LOG);
|
|
787
|
+
};
|
|
788
|
+
Observable.prototype.raf = function(fn) {
|
|
789
|
+
return this.pipe(raf(fn));
|
|
790
|
+
};
|
|
791
|
+
var bindings = Symbol("bindings");
|
|
792
|
+
var registeredComponents = {};
|
|
793
|
+
var augments = Symbol("augments");
|
|
794
|
+
var parserSymbol = Symbol("parser");
|
|
795
|
+
var Bindings = class {
|
|
796
|
+
bindings;
|
|
797
|
+
messageHandlers;
|
|
798
|
+
internals;
|
|
799
|
+
attributes$ = new OrderedSubject();
|
|
800
|
+
wasConnected = false;
|
|
801
|
+
wasInitialized = false;
|
|
802
|
+
subscriptions;
|
|
803
|
+
prebind;
|
|
804
|
+
addMessageHandler(handler) {
|
|
805
|
+
(this.messageHandlers ??= /* @__PURE__ */ new Set()).add(handler);
|
|
806
|
+
}
|
|
807
|
+
removeMessageHandler(handler) {
|
|
808
|
+
this.messageHandlers?.delete(handler);
|
|
809
|
+
}
|
|
810
|
+
message(event, val) {
|
|
811
|
+
let stop = false;
|
|
812
|
+
if (this.messageHandlers)
|
|
813
|
+
for (const m of this.messageHandlers) {
|
|
814
|
+
if (m.type === event) {
|
|
815
|
+
m.next(val);
|
|
816
|
+
stop ||= m.stopPropagation;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
return stop;
|
|
820
|
+
}
|
|
821
|
+
add(binding) {
|
|
822
|
+
if (this.wasConnected)
|
|
823
|
+
throw new Error("Cannot bind connected component.");
|
|
824
|
+
if (this.wasInitialized)
|
|
825
|
+
(this.bindings ??= []).push(binding);
|
|
826
|
+
else
|
|
827
|
+
(this.prebind ??= []).push(binding);
|
|
828
|
+
}
|
|
829
|
+
connect() {
|
|
830
|
+
this.wasConnected = true;
|
|
831
|
+
if (!this.subscriptions && (this.prebind || this.bindings)) {
|
|
832
|
+
const subs = this.subscriptions = [];
|
|
833
|
+
if (this.bindings)
|
|
834
|
+
for (const b of this.bindings)
|
|
835
|
+
subs.push(b.subscribe());
|
|
836
|
+
if (this.prebind)
|
|
837
|
+
for (const b of this.prebind)
|
|
838
|
+
subs.push(b.subscribe());
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
disconnect() {
|
|
842
|
+
this.subscriptions?.forEach((s) => s.unsubscribe());
|
|
843
|
+
this.subscriptions = void 0;
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
var cssSymbol = Symbol("css");
|
|
847
|
+
var Component = class extends HTMLElement {
|
|
848
|
+
static observedAttributes;
|
|
849
|
+
static [augments];
|
|
850
|
+
static [parserSymbol];
|
|
851
|
+
[bindings] = new Bindings();
|
|
852
|
+
/**
|
|
853
|
+
* Symbol used to indicate whether the CSS for this node has been applied,
|
|
854
|
+
* preventing duplicate style insertions.
|
|
855
|
+
*/
|
|
856
|
+
[cssSymbol];
|
|
857
|
+
connectedCallback() {
|
|
858
|
+
this[bindings].wasInitialized = true;
|
|
859
|
+
if (!this[bindings].wasConnected)
|
|
860
|
+
this.constructor[augments]?.forEach((f) => f(this));
|
|
861
|
+
this[bindings].connect();
|
|
862
|
+
}
|
|
863
|
+
disconnectedCallback() {
|
|
864
|
+
this[bindings].disconnect();
|
|
865
|
+
}
|
|
866
|
+
attributeChangedCallback(name, oldValue, value) {
|
|
867
|
+
const parser = this.constructor[parserSymbol]?.[name] ?? defaultAttributeParser;
|
|
868
|
+
if (oldValue !== value)
|
|
869
|
+
this[name] = parser(value, this[name]);
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
function defaultAttributeParser(value, oldValue) {
|
|
873
|
+
const isBoolean = oldValue === false || oldValue === true;
|
|
874
|
+
if (value === "") {
|
|
875
|
+
return isBoolean ? true : "";
|
|
876
|
+
} else
|
|
877
|
+
return value === null ? isBoolean ? false : void 0 : value;
|
|
878
|
+
}
|
|
879
|
+
function pushRender(ctor, renderFn) {
|
|
880
|
+
if (!ctor.hasOwnProperty(augments))
|
|
881
|
+
ctor[augments] = ctor[augments]?.slice(0) ?? [];
|
|
882
|
+
ctor[augments]?.push(renderFn);
|
|
883
|
+
}
|
|
884
|
+
var shadowConfig = { mode: "open" };
|
|
885
|
+
function getShadow(el) {
|
|
886
|
+
return el.shadowRoot ?? el.attachShadow(shadowConfig);
|
|
887
|
+
}
|
|
888
|
+
function appendShadow(host, child) {
|
|
889
|
+
if (child instanceof Node)
|
|
890
|
+
getShadow(host).appendChild(child);
|
|
891
|
+
else
|
|
892
|
+
host[bindings].add(child);
|
|
893
|
+
}
|
|
894
|
+
function doAugment(constructor, augments2) {
|
|
895
|
+
if (augments2.length)
|
|
896
|
+
pushRender(constructor, (node) => {
|
|
897
|
+
for (const d of augments2) {
|
|
898
|
+
const result = d.call(constructor, node);
|
|
899
|
+
if (result && result !== node)
|
|
900
|
+
appendShadow(node, result);
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
function registerComponent(tagName, ctor) {
|
|
905
|
+
registeredComponents[tagName] = ctor;
|
|
906
|
+
customElements.define(tagName, ctor);
|
|
907
|
+
}
|
|
908
|
+
function component(ctor, { init, augment, tagName }) {
|
|
909
|
+
if (init)
|
|
910
|
+
for (const fn of init)
|
|
911
|
+
fn(ctor);
|
|
912
|
+
if (augment)
|
|
913
|
+
doAugment(ctor, augment);
|
|
914
|
+
if (tagName)
|
|
915
|
+
registerComponent(tagName, ctor);
|
|
916
|
+
}
|
|
917
|
+
function attributeChanged(element, attribute2) {
|
|
918
|
+
return element[bindings].attributes$.pipe(filter((ev) => ev.attribute === attribute2), map(() => element[attribute2]));
|
|
919
|
+
}
|
|
920
|
+
function get(element, attribute2) {
|
|
921
|
+
return merge(attributeChanged(element, attribute2), defer(() => of(element[attribute2])));
|
|
922
|
+
}
|
|
923
|
+
function getObservedAttributes(target) {
|
|
924
|
+
let result = target.observedAttributes;
|
|
925
|
+
if (result && !target.hasOwnProperty("observedAttributes"))
|
|
926
|
+
result = target.observedAttributes?.slice(0);
|
|
927
|
+
return target.observedAttributes = result || [];
|
|
928
|
+
}
|
|
929
|
+
function setAttribute(el, attr, val) {
|
|
930
|
+
if (val === false || val === null || val === void 0)
|
|
931
|
+
val = null;
|
|
932
|
+
else if (val === true)
|
|
933
|
+
val = "";
|
|
934
|
+
if (val === null)
|
|
935
|
+
el.removeAttribute(attr);
|
|
936
|
+
else
|
|
937
|
+
el.setAttribute(attr, String(val));
|
|
938
|
+
return val;
|
|
939
|
+
}
|
|
940
|
+
function pushParser(ctor, name, parser) {
|
|
941
|
+
if (!ctor.hasOwnProperty(parserSymbol))
|
|
942
|
+
ctor[parserSymbol] = { ...ctor[parserSymbol] };
|
|
943
|
+
if (ctor[parserSymbol])
|
|
944
|
+
ctor[parserSymbol][name] = parser;
|
|
945
|
+
}
|
|
946
|
+
function attribute(name, options) {
|
|
947
|
+
return (ctor) => {
|
|
948
|
+
if (options?.observe !== false)
|
|
949
|
+
getObservedAttributes(ctor).push(name);
|
|
950
|
+
if (options?.parse)
|
|
951
|
+
pushParser(ctor, name, options.parse);
|
|
952
|
+
const prop = `$$${name}`;
|
|
953
|
+
const proto = ctor.prototype;
|
|
954
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
955
|
+
if (descriptor)
|
|
956
|
+
Object.defineProperty(proto, prop, descriptor);
|
|
957
|
+
const persist = options?.persist;
|
|
958
|
+
const newDescriptor = {
|
|
959
|
+
enumerable: true,
|
|
960
|
+
configurable: false,
|
|
961
|
+
get() {
|
|
962
|
+
return this[prop];
|
|
963
|
+
},
|
|
964
|
+
set(value) {
|
|
965
|
+
const current = this[prop];
|
|
966
|
+
if (current !== value) {
|
|
967
|
+
this[prop] = value;
|
|
968
|
+
persist?.(this, name, value);
|
|
969
|
+
this[bindings].attributes$.next({
|
|
970
|
+
target: this,
|
|
971
|
+
attribute: name,
|
|
972
|
+
value
|
|
973
|
+
});
|
|
974
|
+
} else if (descriptor?.set) {
|
|
975
|
+
persist?.(this, name, value);
|
|
976
|
+
this[prop] = value;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
pushRender(ctor, (target) => {
|
|
981
|
+
if (!descriptor)
|
|
982
|
+
target[prop] = target[name];
|
|
983
|
+
Object.defineProperty(target, name, newDescriptor);
|
|
984
|
+
persist?.(target, name, target[name]);
|
|
985
|
+
if (options?.render) {
|
|
986
|
+
const result = options.render(target);
|
|
987
|
+
if (result)
|
|
988
|
+
appendShadow(target, result);
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
function styleAttribute(name) {
|
|
994
|
+
return attribute(name, {
|
|
995
|
+
persist: setAttribute,
|
|
996
|
+
observe: true
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
function expression(host, binding) {
|
|
1000
|
+
const result = document.createTextNode("");
|
|
1001
|
+
host[bindings].add(binding.tap((val) => result.textContent = val));
|
|
1002
|
+
return result;
|
|
1003
|
+
}
|
|
1004
|
+
var childrenFragment = document.createDocumentFragment();
|
|
1005
|
+
function renderChildren(host, children, appendTo = host) {
|
|
1006
|
+
if (children === void 0 || children === null)
|
|
1007
|
+
return;
|
|
1008
|
+
if (Array.isArray(children)) {
|
|
1009
|
+
for (const child of children)
|
|
1010
|
+
renderChildren(host, child, childrenFragment);
|
|
1011
|
+
if (appendTo !== childrenFragment)
|
|
1012
|
+
appendTo.appendChild(childrenFragment);
|
|
1013
|
+
} else if (host instanceof Component && children instanceof Observable)
|
|
1014
|
+
appendTo.appendChild(expression(host, children));
|
|
1015
|
+
else if (children instanceof Node)
|
|
1016
|
+
appendTo.appendChild(children);
|
|
1017
|
+
else if (host instanceof Component && typeof children === "function")
|
|
1018
|
+
renderChildren(host, children(host), appendTo);
|
|
1019
|
+
else
|
|
1020
|
+
appendTo.appendChild(document.createTextNode(children));
|
|
1021
|
+
}
|
|
1022
|
+
function renderAttributes(host, attributes) {
|
|
1023
|
+
for (const attr in attributes) {
|
|
1024
|
+
const value = attributes[attr];
|
|
1025
|
+
if (host instanceof Component) {
|
|
1026
|
+
if (value instanceof Observable)
|
|
1027
|
+
host[bindings].add(attr === "$" ? value : value.tap((v) => host[attr] = v));
|
|
1028
|
+
else if (attr === "$" && typeof value === "function")
|
|
1029
|
+
host[bindings].add(value(host));
|
|
1030
|
+
else
|
|
1031
|
+
host[attr] = value;
|
|
1032
|
+
} else
|
|
1033
|
+
host[attr] = value;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
function tsx(component2, attributes, ...children) {
|
|
1037
|
+
if (component2 !== tsx && typeof component2 === "function" && !(component2.prototype instanceof Component)) {
|
|
1038
|
+
if (children.length)
|
|
1039
|
+
(attributes ??= {}).children = children;
|
|
1040
|
+
return component2(attributes);
|
|
1041
|
+
}
|
|
1042
|
+
const element = component2 === tsx ? document.createDocumentFragment() : typeof component2 === "string" ? document.createElement(component2) : new component2();
|
|
1043
|
+
if (attributes)
|
|
1044
|
+
renderAttributes(element, attributes);
|
|
1045
|
+
if (children.length)
|
|
1046
|
+
renderChildren(element, children);
|
|
1047
|
+
return element;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// ../../ui-core/dist/ui/theme.js
|
|
1051
|
+
var displayContents = css(":host{display:contents}");
|
|
1052
|
+
var onThemeChange = ref();
|
|
1053
|
+
var themeName = be("");
|
|
1054
|
+
var disabledStyles = css(`:host([disabled]) {
|
|
1055
|
+
cursor: default;
|
|
1056
|
+
pointer-events: var(--cxl-override-pointer-events, none);
|
|
1057
|
+
}`);
|
|
1058
|
+
var itemLayout = `
|
|
1059
|
+
box-sizing: border-box;
|
|
1060
|
+
position: relative;
|
|
1061
|
+
display: flex;
|
|
1062
|
+
padding: 4px 16px;
|
|
1063
|
+
min-height: 56px;
|
|
1064
|
+
align-items: center;
|
|
1065
|
+
column-gap: 16px;
|
|
1066
|
+
${font("body-medium")}
|
|
1067
|
+
`;
|
|
1068
|
+
var hasRobotoFont = (() => {
|
|
1069
|
+
for (const font2 of Array.from(document.fonts.keys()))
|
|
1070
|
+
if (font2.family === "Roboto")
|
|
1071
|
+
return true;
|
|
1072
|
+
return false;
|
|
1073
|
+
})();
|
|
1074
|
+
var baseColors = {
|
|
1075
|
+
primary: "#186584",
|
|
1076
|
+
"on-primary": "#FFFFFF",
|
|
1077
|
+
"primary-container": "#C1E8FF",
|
|
1078
|
+
"on-primary-container": "#004D67",
|
|
1079
|
+
secondary: "#4E616C",
|
|
1080
|
+
"on-secondary": "#FFFFFF",
|
|
1081
|
+
"secondary-container": "#D1E6F3",
|
|
1082
|
+
"on-secondary-container": "#364954",
|
|
1083
|
+
tertiary: "#5F5A7D",
|
|
1084
|
+
"on-tertiary": "#FFFFFF",
|
|
1085
|
+
"tertiary-container": "#E5DEFF",
|
|
1086
|
+
"on-tertiary-container": "#474364",
|
|
1087
|
+
error: "#BA1A1A",
|
|
1088
|
+
"on-error": "#FFFFFF",
|
|
1089
|
+
"error-container": "#FFDAD6",
|
|
1090
|
+
"on-error-container": "#93000A",
|
|
1091
|
+
background: "#F6FAFE",
|
|
1092
|
+
"on-background": "#171C1F",
|
|
1093
|
+
surface: "#F6FAFE",
|
|
1094
|
+
"on-surface": "#171C1F",
|
|
1095
|
+
"surface-variant": "#DCE3E9",
|
|
1096
|
+
"on-surface-variant": "#40484D",
|
|
1097
|
+
outline: "#71787D",
|
|
1098
|
+
"outline-variant": "#C0C7CD",
|
|
1099
|
+
scrim: "rgb(29 27 32 / 0.5)",
|
|
1100
|
+
"inverse-surface": "#2C3134",
|
|
1101
|
+
"on-inverse-surface": "#EDF1F5",
|
|
1102
|
+
"inverse-primary": "#8ECFF2",
|
|
1103
|
+
"primary-fixed": "#C1E8FF",
|
|
1104
|
+
"on-primary-fixed": "#001E2B",
|
|
1105
|
+
"primary-fixed-dim": "#8ECFF2",
|
|
1106
|
+
"on-primary-fixed-variant": "#004D67",
|
|
1107
|
+
"secondary-fixed": "#D1E6F3",
|
|
1108
|
+
"on-secondary-fixed": "#091E28",
|
|
1109
|
+
"secondary-fixed-dim": "#B5C9D7",
|
|
1110
|
+
"on-secondary-fixed-variant": "#364954",
|
|
1111
|
+
"tertiary-fixed": "#E5DEFF",
|
|
1112
|
+
"on-tertiary-fixed": "#1B1736",
|
|
1113
|
+
"tertiary-fixed-dim": "#C9C2EA",
|
|
1114
|
+
"on-tertiary-fixed-variant": "#474364",
|
|
1115
|
+
"surface-dim": "#D6DADE",
|
|
1116
|
+
"surface-bright": "#F6FAFE",
|
|
1117
|
+
"surface-container-lowest": "#FFFFFF",
|
|
1118
|
+
"surface-container-low": "#F0F4F8",
|
|
1119
|
+
"surface-container": "#EAEEF2",
|
|
1120
|
+
"surface-container-high": "#E5E9ED",
|
|
1121
|
+
"surface-container-highest": "#DFE3E7",
|
|
1122
|
+
warning: "#DD2C00",
|
|
1123
|
+
"on-warning": "#FFFFFF",
|
|
1124
|
+
"warning-container": "#FFF4E5",
|
|
1125
|
+
"on-warning-container": "#8C1D18",
|
|
1126
|
+
success: "#2E7D32",
|
|
1127
|
+
"on-success": "#FFFFFF",
|
|
1128
|
+
"success-container": "#81C784",
|
|
1129
|
+
"on-success-container": "#000000"
|
|
1130
|
+
};
|
|
1131
|
+
function buildPalette(colors = baseColors) {
|
|
1132
|
+
return Object.entries(colors).map(([key, value]) => `--cxl-color--${key}:${value};--cxl-color-${key}:var(--cxl-color--${key});`).join("");
|
|
1133
|
+
}
|
|
1134
|
+
var theme = {
|
|
1135
|
+
name: "",
|
|
1136
|
+
animation: {
|
|
1137
|
+
flash: {
|
|
1138
|
+
kf: { opacity: [1, 0, 1, 0, 1] },
|
|
1139
|
+
options: { easing: "ease-in" }
|
|
1140
|
+
},
|
|
1141
|
+
spin: {
|
|
1142
|
+
kf: { rotate: ["0deg", "360deg"] }
|
|
1143
|
+
},
|
|
1144
|
+
pulse: {
|
|
1145
|
+
kf: { rotate: ["0deg", "360deg"] },
|
|
1146
|
+
options: { easing: "steps(8)" }
|
|
1147
|
+
},
|
|
1148
|
+
openY: { kf: (el) => ({ height: ["0", `${el.scrollHeight}px`] }) },
|
|
1149
|
+
closeY: { kf: (el) => ({ height: [`${el.scrollHeight}px`, "0"] }) },
|
|
1150
|
+
expand: { kf: { scale: [0, 1] } },
|
|
1151
|
+
expandX: { kf: { scale: ["0 1", "1 1"] } },
|
|
1152
|
+
expandY: { kf: { scale: ["1 0", "1 1"] } },
|
|
1153
|
+
zoomIn: { kf: { scale: [0.3, 1] } },
|
|
1154
|
+
zoomOut: { kf: { scale: [1, 0.3] } },
|
|
1155
|
+
scaleUp: { kf: { scale: [1, 1.25] } },
|
|
1156
|
+
fadeIn: { kf: [{ opacity: 0 }, { opacity: 1 }] },
|
|
1157
|
+
fadeOut: { kf: [{ opacity: 1 }, { opacity: 0 }] },
|
|
1158
|
+
shakeX: {
|
|
1159
|
+
/*kf: () => ({
|
|
1160
|
+
translate: randomShake(10, 8, 'x'),
|
|
1161
|
+
}),*/
|
|
1162
|
+
kf: {
|
|
1163
|
+
translate: [
|
|
1164
|
+
"0",
|
|
1165
|
+
"-10px",
|
|
1166
|
+
"10px",
|
|
1167
|
+
"-10px",
|
|
1168
|
+
"10px",
|
|
1169
|
+
"-10px",
|
|
1170
|
+
"10px",
|
|
1171
|
+
"-10px",
|
|
1172
|
+
"10px",
|
|
1173
|
+
"0"
|
|
1174
|
+
]
|
|
1175
|
+
}
|
|
1176
|
+
},
|
|
1177
|
+
shakeY: {
|
|
1178
|
+
/*kf: {
|
|
1179
|
+
translate: [ '0', 'var(--cxl-animation-shakeX)', '0' ],
|
|
1180
|
+
},*/
|
|
1181
|
+
kf: {
|
|
1182
|
+
translate: [
|
|
1183
|
+
"0",
|
|
1184
|
+
"0 -10px",
|
|
1185
|
+
"0 10px",
|
|
1186
|
+
"0 -10px",
|
|
1187
|
+
"0 10px",
|
|
1188
|
+
"0 -10px",
|
|
1189
|
+
"0 10px",
|
|
1190
|
+
"0 -10px",
|
|
1191
|
+
"0 10px",
|
|
1192
|
+
"0"
|
|
1193
|
+
]
|
|
1194
|
+
}
|
|
1195
|
+
},
|
|
1196
|
+
slideOutLeft: { kf: { translate: ["0", "-100% 0"] } },
|
|
1197
|
+
slideInLeft: { kf: { translate: ["-100% 0", "0"] } },
|
|
1198
|
+
slideOutRight: { kf: { translate: ["0", "100% 0"] } },
|
|
1199
|
+
slideInRight: { kf: { translate: ["100% 0", "0"] } },
|
|
1200
|
+
slideInUp: { kf: { translate: ["0 100%", "0"] } },
|
|
1201
|
+
slideInDown: { kf: { translate: ["0 -100%", "0"] } },
|
|
1202
|
+
slideOutUp: { kf: { translate: ["0", "0 -100%"] } },
|
|
1203
|
+
slideOutDown: { kf: { translate: ["0", "0 100%"] } },
|
|
1204
|
+
focus: {
|
|
1205
|
+
kf: [
|
|
1206
|
+
{ offset: 0.1, filter: "brightness(150%)" },
|
|
1207
|
+
{ filter: "brightness(100%)" }
|
|
1208
|
+
],
|
|
1209
|
+
options: { duration: 500 }
|
|
1210
|
+
}
|
|
1211
|
+
},
|
|
1212
|
+
easing: {
|
|
1213
|
+
emphasized: "cubic-bezier(0.2, 0.0, 0, 1.0)",
|
|
1214
|
+
emphasized_accelerate: "cubic-bezier(0.05, 0.7, 0.1, 1.0)",
|
|
1215
|
+
emphasized_decelerate: "cubic-bezier(0.3, 0.0, 0.8, 0.15)",
|
|
1216
|
+
standard: "cubic-bezier(0.2, 0.0, 0, 1.0)",
|
|
1217
|
+
standard_accelerate: "cubic-bezier(0, 0, 0, 1)",
|
|
1218
|
+
standard_decelerate: "cubic-bezier(0.3, 0, 1, 1)"
|
|
1219
|
+
},
|
|
1220
|
+
breakpoints: {
|
|
1221
|
+
xsmall: 0,
|
|
1222
|
+
small: 600,
|
|
1223
|
+
medium: 905,
|
|
1224
|
+
large: 1240,
|
|
1225
|
+
xlarge: 1920,
|
|
1226
|
+
xxlarge: 2560
|
|
1227
|
+
},
|
|
1228
|
+
//isRTL: false as boolean,
|
|
1229
|
+
disableAnimations: false,
|
|
1230
|
+
prefersReducedMotion: window.matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
1231
|
+
colors: baseColors,
|
|
1232
|
+
imports: hasRobotoFont ? void 0 : [
|
|
1233
|
+
"https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&family=Roboto:wght@300;400;500;700&display=swap"
|
|
1234
|
+
],
|
|
1235
|
+
globalCss: `:root{
|
|
1236
|
+
--cxl-font-family: Roboto;
|
|
1237
|
+
--cxl-font-monospace:"Roboto Mono", monospace;
|
|
1238
|
+
|
|
1239
|
+
--cxl-font-display-large: 400 57px/64px var(--cxl-font-family);
|
|
1240
|
+
--cxl-letter-spacing-display-large: -0.25px;
|
|
1241
|
+
--cxl-font-display-medium: 400 45px/52px var(--cxl-font-family);
|
|
1242
|
+
--cxl-letter-spacing-display-medium: 0;
|
|
1243
|
+
--cxl-font-display-small: 400 36px/44px var(--cxl-font-family);
|
|
1244
|
+
--cxl-letter-spacing-display-small: 0;
|
|
1245
|
+
--cxl-font-headline-large: 400 32px/40px var(--cxl-font-family);
|
|
1246
|
+
--cxl-letter-spacing-headline-large: -0.25px;
|
|
1247
|
+
--cxl-font-headline-medium: 400 28px/36px var(--cxl-font-family);
|
|
1248
|
+
--cxl-letter-spacing-headline-medium: 0;
|
|
1249
|
+
--cxl-font-headline-small: 400 24px/32px var(--cxl-font-family);
|
|
1250
|
+
--cxl-letter-spacing-headline-small: 0;
|
|
1251
|
+
--cxl-font-title-large: 400 22px/28px var(--cxl-font-family);
|
|
1252
|
+
--cxl-letter-spacing-title-large: 0;
|
|
1253
|
+
--cxl-font-title-medium: 500 16px/24px var(--cxl-font-family);
|
|
1254
|
+
--cxl-letter-spacing-title-medium: 0.15px;
|
|
1255
|
+
--cxl-font-title-small: 500 14px/20px var(--cxl-font-family);
|
|
1256
|
+
--cxl-letter-spacing-title-small: 0.1px;
|
|
1257
|
+
--cxl-font-body-large: 400 16px/24px var(--cxl-font-family);
|
|
1258
|
+
--cxl-letter-spacing-body-large: normal;
|
|
1259
|
+
--cxl-font-body-medium: 400 14px/20px var(--cxl-font-family);
|
|
1260
|
+
--cxl-letter-spacing-body-medium: 0.25px;
|
|
1261
|
+
--cxl-font-body-small: 400 12px/16px var(--cxl-font-family);
|
|
1262
|
+
--cxl-letter-spacing-body-small: 0.4px;
|
|
1263
|
+
--cxl-font-label-large: 500 14px/18px var(--cxl-font-family);
|
|
1264
|
+
--cxl-letter-spacing-label-large: 0.1px;
|
|
1265
|
+
--cxl-font-label-medium: 500 12px/16px var(--cxl-font-family);
|
|
1266
|
+
--cxl-letter-spacing-label-medium: 0.5px;
|
|
1267
|
+
--cxl-font-label-small: 500 11px/16px var(--cxl-font-family);
|
|
1268
|
+
--cxl-letter-spacing-label-small: 0.5px;
|
|
1269
|
+
--cxl-font-code:400 14px var(--cxl-font-monospace);
|
|
1270
|
+
--cxl-letter-spacing-code: 0.2px;
|
|
1271
|
+
|
|
1272
|
+
--cxl-font-weight-bold: 700;
|
|
1273
|
+
--cxl-font-weight-label-large-prominent: var(--cxl-font-weight-bold);
|
|
1274
|
+
|
|
1275
|
+
--cxl-speed:200ms;
|
|
1276
|
+
|
|
1277
|
+
--cxl-elevation-1: rgb(0 0 0 / .2) 0 2px 1px -1px, rgb(0 0 0 / .14) 0 1px 1px 0, rgb(0 0 0 / .12) 0px 1px 3px 0;
|
|
1278
|
+
--cxl-elevation-2: rgb(0 0 0 / .2) 0 3px 3px -2px, rgb(0 0 0 / .14) 0 3px 4px 0, rgb(0 0 0 / .12) 0px 1px 8px 0;
|
|
1279
|
+
--cxl-elevation-3: rgba(0, 0, 0, 0.2) 0px 3px 3px -2px, rgba(0, 0, 0, 0.14) 0px 3px 4px 0px, rgba(0, 0, 0, 0.12) 0px 1px 8px 0px;;
|
|
1280
|
+
--cxl-elevation-4: rgba(0, 0, 0, 0.2) 0px 3px 3px -2px, rgba(0, 0, 0, 0.14) 0px 3px 4px 0px, rgba(0, 0, 0, 0.12) 0px 1px 8px 0px;
|
|
1281
|
+
--cxl-elevation-5: rgba(0, 0, 0, 0.2) 0px 3px 3px -2px, rgba(0, 0, 0, 0.14) 0px 3px 4px 0px, rgba(0, 0, 0, 0.12) 0px 1px 8px 0px;
|
|
1282
|
+
|
|
1283
|
+
--cxl-shape-corner-xlarge: 28px;
|
|
1284
|
+
--cxl-shape-corner-large: 16px;
|
|
1285
|
+
--cxl-shape-corner-medium: 12px;
|
|
1286
|
+
--cxl-shape-corner-small: 8px;
|
|
1287
|
+
--cxl-shape-corner-xsmall: 4px;
|
|
1288
|
+
--cxl-shape-corner-full: 50vh;
|
|
1289
|
+
}
|
|
1290
|
+
`,
|
|
1291
|
+
css: ""
|
|
1292
|
+
};
|
|
1293
|
+
function buildMask(sel = "") {
|
|
1294
|
+
return `:host ${sel} {
|
|
1295
|
+
--cxl-mask-hover: color-mix(in srgb, var(--cxl-color-on-surface) 8%, transparent);
|
|
1296
|
+
--cxl-mask-focus: color-mix(in srgb, var(--cxl-color-on-surface) 10%, transparent);
|
|
1297
|
+
--cxl-mask-active: linear-gradient(0, var(--cxl-color-surface-container),var(--cxl-color-surface-container));
|
|
1298
|
+
}
|
|
1299
|
+
:host(:hover) ${sel} { background-image: linear-gradient(0, var(--cxl-mask-hover),var(--cxl-mask-hover)); }
|
|
1300
|
+
:host(:focus-visible) ${sel} { background-image: linear-gradient(0, var(--cxl-mask-focus),var(--cxl-mask-focus)) }
|
|
1301
|
+
:host{-webkit-tap-highlight-color: transparent}
|
|
1302
|
+
`;
|
|
1303
|
+
}
|
|
1304
|
+
var maskStyles = css(buildMask());
|
|
1305
|
+
var globalCss;
|
|
1306
|
+
var themeCss;
|
|
1307
|
+
function observeTheme(host) {
|
|
1308
|
+
let themeOverride;
|
|
1309
|
+
return onThemeChange.tap((theme2) => {
|
|
1310
|
+
const css2 = theme2?.theme.override?.[host.tagName];
|
|
1311
|
+
if (css2) {
|
|
1312
|
+
if (!themeOverride)
|
|
1313
|
+
host.shadowRoot?.adoptedStyleSheets.push(themeOverride ??= newStylesheet(css2));
|
|
1314
|
+
else
|
|
1315
|
+
themeOverride.replace(css2).catch((e) => console.error(e));
|
|
1316
|
+
} else if (themeOverride)
|
|
1317
|
+
themeOverride.replaceSync("");
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
function newStylesheet(css2) {
|
|
1321
|
+
const themeCss2 = new CSSStyleSheet();
|
|
1322
|
+
if (css2)
|
|
1323
|
+
themeCss2.replaceSync(css2);
|
|
1324
|
+
return themeCss2;
|
|
1325
|
+
}
|
|
1326
|
+
function css(styles) {
|
|
1327
|
+
let stylesheet;
|
|
1328
|
+
return (host) => {
|
|
1329
|
+
const shadow = getShadow(host);
|
|
1330
|
+
shadow.adoptedStyleSheets.push(stylesheet ??= newStylesheet(styles));
|
|
1331
|
+
if (!host[cssSymbol]) {
|
|
1332
|
+
if (theme.css)
|
|
1333
|
+
shadow.adoptedStyleSheets.unshift(themeCss ??= newStylesheet(theme.css));
|
|
1334
|
+
host[cssSymbol] = true;
|
|
1335
|
+
return observeTheme(host);
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
var surfaceColors = [
|
|
1340
|
+
"background",
|
|
1341
|
+
"primary",
|
|
1342
|
+
"primary-container",
|
|
1343
|
+
"primary-fixed-dim",
|
|
1344
|
+
"primary-fixed",
|
|
1345
|
+
"secondary",
|
|
1346
|
+
"secondary-container",
|
|
1347
|
+
"tertiary",
|
|
1348
|
+
"tertiary-container",
|
|
1349
|
+
"surface",
|
|
1350
|
+
"surface-container",
|
|
1351
|
+
"surface-container-low",
|
|
1352
|
+
"surface-container-lowest",
|
|
1353
|
+
"surface-container-highest",
|
|
1354
|
+
"surface-container-high",
|
|
1355
|
+
"error",
|
|
1356
|
+
"error-container",
|
|
1357
|
+
"success",
|
|
1358
|
+
"success-container",
|
|
1359
|
+
"warning",
|
|
1360
|
+
"warning-container",
|
|
1361
|
+
"inverse-surface",
|
|
1362
|
+
"inverse-primary"
|
|
1363
|
+
];
|
|
1364
|
+
var SurfaceColorNames = [...surfaceColors, "inherit"];
|
|
1365
|
+
function resetSurface(color, dest = "surface") {
|
|
1366
|
+
return `--cxl-color-${dest}: var(--cxl-color--${color});
|
|
1367
|
+
--cxl-color-on-${dest}: var(--cxl-color--on-${color}, var(--cxl-color--on-surface));
|
|
1368
|
+
--cxl-color-surface-variant: var(--cxl-color--${color === "surface" ? "surface-variant" : color});
|
|
1369
|
+
--cxl-color-on-surface-variant: ${color.includes("surface") ? "var(--cxl-color--on-surface-variant)" : `color-mix(in srgb, var(--cxl-color--on-${color}) 80%, transparent)`};
|
|
1370
|
+
`;
|
|
1371
|
+
}
|
|
1372
|
+
var ColorStyles = surfaceColors.reduce((r, v) => {
|
|
1373
|
+
r[v] = `
|
|
1374
|
+
${resetSurface(v)}
|
|
1375
|
+
${v === "inverse-surface" ? resetSurface("inverse-primary", "primary") : ""}
|
|
1376
|
+
`;
|
|
1377
|
+
return r;
|
|
1378
|
+
}, {
|
|
1379
|
+
inherit: "color:inherit;background-color:inherit;"
|
|
1380
|
+
});
|
|
1381
|
+
function font(name) {
|
|
1382
|
+
return `font:var(--cxl-font-${name});letter-spacing:var(--cxl-letter-spacing-${name});`;
|
|
1383
|
+
}
|
|
1384
|
+
var loadingId = requestAnimationFrame(() => applyTheme());
|
|
1385
|
+
var iconTemplate = document.createElement("template");
|
|
1386
|
+
var iconCache = {};
|
|
1387
|
+
function buildIconFactoryCdn(getUrl) {
|
|
1388
|
+
return function(def) {
|
|
1389
|
+
const href = getUrl(def);
|
|
1390
|
+
const cache = iconCache[href];
|
|
1391
|
+
if (cache)
|
|
1392
|
+
return cache.cloneNode(true);
|
|
1393
|
+
const el = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1394
|
+
const error2 = () => (el.dispatchEvent(new ErrorEvent("error")), "");
|
|
1395
|
+
fetch(href).then((res) => res.ok ? res.text() : error2(), error2).then((svgText) => {
|
|
1396
|
+
if (!svgText)
|
|
1397
|
+
return;
|
|
1398
|
+
iconTemplate.innerHTML = svgText;
|
|
1399
|
+
const svg = iconTemplate.content.children[0];
|
|
1400
|
+
if (!svg)
|
|
1401
|
+
return;
|
|
1402
|
+
const viewbox = svg.getAttribute("viewBox");
|
|
1403
|
+
if (viewbox)
|
|
1404
|
+
el.setAttribute("viewBox", viewbox);
|
|
1405
|
+
else if (svg.hasAttribute("width") && svg.hasAttribute("height"))
|
|
1406
|
+
el.setAttribute("viewBox", `0 0 ${svg.getAttribute("width")} ${svg.getAttribute("height")}`);
|
|
1407
|
+
for (const child of svg.childNodes)
|
|
1408
|
+
el.append(child);
|
|
1409
|
+
iconCache[def.name] = el;
|
|
1410
|
+
}).catch((e) => console.error(e));
|
|
1411
|
+
el.setAttribute("fill", "currentColor");
|
|
1412
|
+
return el;
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
var iconFactoryCdn = buildIconFactoryCdn(({ name: id, width, fill }) => {
|
|
1416
|
+
if (width !== 20 && width !== 24 && width !== 40 && width !== 48)
|
|
1417
|
+
width = 48;
|
|
1418
|
+
return `https://cdn.jsdelivr.net/gh/google/material-design-icons@941fa95/symbols/web/${id}/materialsymbolsoutlined/${id}_${fill ? "fill1_" : ""}${width}px.svg`;
|
|
1419
|
+
});
|
|
1420
|
+
var resolveTheme;
|
|
1421
|
+
var themeReady = new Promise((resolve) => {
|
|
1422
|
+
resolveTheme = () => {
|
|
1423
|
+
onThemeChange.next(void 0);
|
|
1424
|
+
resolve();
|
|
1425
|
+
};
|
|
1426
|
+
});
|
|
1427
|
+
function applyTheme(newTheme) {
|
|
1428
|
+
cancelAnimationFrame(loadingId);
|
|
1429
|
+
if (!globalCss) {
|
|
1430
|
+
if (newTheme) {
|
|
1431
|
+
if (newTheme.colors)
|
|
1432
|
+
theme.colors = newTheme.colors;
|
|
1433
|
+
if (newTheme.globalCss)
|
|
1434
|
+
theme.globalCss += newTheme.globalCss;
|
|
1435
|
+
}
|
|
1436
|
+
document.adoptedStyleSheets.push(globalCss = newStylesheet(`html{${buildPalette(theme.colors)}}${theme.globalCss}`));
|
|
1437
|
+
if (theme.imports)
|
|
1438
|
+
Promise.allSettled(theme.imports.map((imp) => {
|
|
1439
|
+
const link = document.createElement("link");
|
|
1440
|
+
link.rel = "stylesheet";
|
|
1441
|
+
link.href = imp;
|
|
1442
|
+
document.head.append(link);
|
|
1443
|
+
return new Promise((resolve, reject) => (link.onload = resolve, link.onerror = reject));
|
|
1444
|
+
})).then(resolveTheme, (e) => console.error(e));
|
|
1445
|
+
else
|
|
1446
|
+
resolveTheme();
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
// ../spec-browser/index.ts
|
|
1451
|
+
window.__cxlRunner = (data) => {
|
|
1452
|
+
if (data.type === "figure")
|
|
1453
|
+
return {
|
|
1454
|
+
success: true,
|
|
1455
|
+
message: "Screenshot should match baseline",
|
|
1456
|
+
data
|
|
1457
|
+
};
|
|
1458
|
+
if (data.type === "run") {
|
|
1459
|
+
new BrowserRunner(data).run().catch((e) => console.error(e));
|
|
1460
|
+
return {
|
|
1461
|
+
success: true,
|
|
1462
|
+
message: "",
|
|
1463
|
+
data
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
return {
|
|
1467
|
+
success: false,
|
|
1468
|
+
message: `${data.type} not supported.`
|
|
1469
|
+
};
|
|
1470
|
+
};
|
|
1471
|
+
var output = `<style>.thumb{vertical-align:middle;display:inline-block;overflow:hidden;width:320px;position:relative;vertical-align:top}
|
|
2
1472
|
dl { display: flex; margin-top:8px;margin-bottom:8px; } dd { margin-left: 16px}
|
|
3
1473
|
body {font-family:monospace;font-size:16px;tab-size:4}
|
|
4
1474
|
</style>`;
|
|
5
|
-
//let baselinePath: string;
|
|
6
1475
|
function group(testId, title) {
|
|
7
|
-
|
|
1476
|
+
output += `<dl><dt><a data-test="${testId}" href="#">${escapeHtml(
|
|
1477
|
+
title
|
|
1478
|
+
)}</a></dt><dd>`;
|
|
8
1479
|
}
|
|
9
1480
|
function groupEnd() {
|
|
10
|
-
|
|
1481
|
+
output += "</dd></dl>";
|
|
11
1482
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1483
|
+
var ENTITIES_REGEX = /[&<>]/g;
|
|
1484
|
+
var ENTITIES_MAP = {
|
|
1485
|
+
"&": "&",
|
|
1486
|
+
"<": "<",
|
|
1487
|
+
">": ">"
|
|
16
1488
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1489
|
+
function escapeHtml(str) {
|
|
1490
|
+
return str.replace(
|
|
1491
|
+
ENTITIES_REGEX,
|
|
1492
|
+
(e) => ENTITIES_MAP[e] || ""
|
|
1493
|
+
);
|
|
20
1494
|
}
|
|
21
1495
|
function error(msg) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1496
|
+
output += '<div style="background-color:#ffcdd2;padding:8px">';
|
|
1497
|
+
if (msg instanceof Error) {
|
|
1498
|
+
output += `
|
|
25
1499
|
<p style="white-space:pre">${escapeHtml(msg.message)}</p>
|
|
26
|
-
<pre>${escapeHtml(msg.stack ||
|
|
1500
|
+
<pre>${escapeHtml(msg.stack || "")}</pre>
|
|
27
1501
|
`;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
output += `<p style="white-space:pre-wrap">${escapeHtml(msg)}</p>`;
|
|
31
|
-
output += '</div>';
|
|
1502
|
+
} else output += `<p style="white-space:pre-wrap">${escapeHtml(msg)}</p>`;
|
|
1503
|
+
output += "</div>";
|
|
32
1504
|
}
|
|
33
1505
|
function success() {
|
|
34
|
-
|
|
1506
|
+
return "✓";
|
|
35
1507
|
}
|
|
36
1508
|
function failure() {
|
|
37
|
-
|
|
1509
|
+
return "×";
|
|
38
1510
|
}
|
|
39
1511
|
function printError(fail) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1512
|
+
console.error(fail.message);
|
|
1513
|
+
if (fail.stack) console.error(fail.stack);
|
|
1514
|
+
const msg = fail.message;
|
|
1515
|
+
error(msg);
|
|
1516
|
+
}
|
|
1517
|
+
function printResult(result, baselinePath = "spec") {
|
|
1518
|
+
output += result.success ? success() : failure();
|
|
1519
|
+
const data = result.data;
|
|
1520
|
+
if (data?.type === "figure") {
|
|
1521
|
+
output += `<div class="thumb">${data.html}</div>
|
|
1522
|
+
<spec-image-diff src1="spec/${data.name}.png" src2="${baselinePath}/${data.name}.png"></cxl-image-diff>`;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
function findTest(tests, id) {
|
|
1526
|
+
for (const test of tests) {
|
|
1527
|
+
if (test.id === id) return test;
|
|
1528
|
+
const childTest = findTest(test.tests, id);
|
|
1529
|
+
if (childTest) return childTest;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
async function onClick(suite, ev) {
|
|
1533
|
+
const testId = ev.target.dataset.test;
|
|
1534
|
+
if (testId) {
|
|
1535
|
+
ev.stopPropagation();
|
|
1536
|
+
ev.preventDefault();
|
|
1537
|
+
const test = findTest(suite, +testId);
|
|
1538
|
+
if (test) {
|
|
1539
|
+
console.log(`Running test "${test.name}"`);
|
|
1540
|
+
test.results = [];
|
|
1541
|
+
await test.run();
|
|
1542
|
+
console.log(test.results);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
function loadImage(src) {
|
|
1547
|
+
return new Promise((resolve, reject) => {
|
|
1548
|
+
const img = new Image();
|
|
1549
|
+
img.src = src;
|
|
1550
|
+
img.addEventListener("load", () => resolve(img));
|
|
1551
|
+
img.addEventListener("error", () => reject(img));
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
async function imageData(srcA) {
|
|
1555
|
+
const A = await loadImage(srcA);
|
|
1556
|
+
const canvasEl = tsx("canvas");
|
|
1557
|
+
const ctx = canvasEl.getContext("2d");
|
|
1558
|
+
if (!ctx) throw new Error("Could not create context");
|
|
1559
|
+
const w = canvasEl.width = A.width;
|
|
1560
|
+
const h = canvasEl.height = A.height;
|
|
1561
|
+
ctx.drawImage(A, 0, 0);
|
|
1562
|
+
return ctx.getImageData(0, 0, w, h);
|
|
1563
|
+
}
|
|
1564
|
+
function image(src) {
|
|
1565
|
+
const result = new Image();
|
|
1566
|
+
result.src = src;
|
|
1567
|
+
return result;
|
|
1568
|
+
}
|
|
1569
|
+
async function imageDataDiff(A, B) {
|
|
1570
|
+
const w = Math.max(A.width, B.width);
|
|
1571
|
+
const h = Math.max(A.height, B.height);
|
|
1572
|
+
const size = w * h * 4;
|
|
1573
|
+
const diff = new Uint8ClampedArray(size);
|
|
1574
|
+
let diffBytes = 0;
|
|
1575
|
+
for (let i = 0; i < size; i += 4) {
|
|
1576
|
+
const match = A.data[i] === B.data[i] && A.data[i + 1] === B.data[i + 1] && A.data[i + 2] === B.data[i + 2] && A.data[i + 3] === B.data[i + 3];
|
|
1577
|
+
if (!match) diffBytes += 4;
|
|
1578
|
+
diff[i] = diff[i + 3] = match ? 0 : 255;
|
|
1579
|
+
}
|
|
1580
|
+
return {
|
|
1581
|
+
imageA: A,
|
|
1582
|
+
imageB: B,
|
|
1583
|
+
diffBytes,
|
|
1584
|
+
size,
|
|
1585
|
+
diff: new ImageData(diff, w, h)
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
async function imageDiff(srcA, srcB) {
|
|
1589
|
+
const [A, B] = await Promise.all([imageData(srcA), imageData(srcB)]);
|
|
1590
|
+
return imageDataDiff(A, B);
|
|
1591
|
+
}
|
|
1592
|
+
var ImageDiff = class extends Component {
|
|
1593
|
+
src1;
|
|
1594
|
+
src2;
|
|
1595
|
+
ratio = 1;
|
|
1596
|
+
hidediff = false;
|
|
1597
|
+
value;
|
|
1598
|
+
};
|
|
1599
|
+
component(ImageDiff, {
|
|
1600
|
+
tagName: "spec-image-diff",
|
|
1601
|
+
init: [
|
|
1602
|
+
attribute("src1"),
|
|
1603
|
+
attribute("src2"),
|
|
1604
|
+
attribute("ratio"),
|
|
1605
|
+
styleAttribute("hidediff")
|
|
1606
|
+
],
|
|
1607
|
+
augment: [
|
|
1608
|
+
css(`
|
|
1609
|
+
:host {
|
|
1610
|
+
display: inline-block;
|
|
1611
|
+
position: relative;
|
|
1612
|
+
fontSize: 0;
|
|
1613
|
+
}
|
|
1614
|
+
.absolute {
|
|
1615
|
+
position: absolute;
|
|
1616
|
+
top: 0;
|
|
1617
|
+
left: 0;
|
|
1618
|
+
width: '100%';
|
|
1619
|
+
height: '100%';
|
|
1620
|
+
}
|
|
1621
|
+
:host([hidediff]) .diff { opacity: 0 },
|
|
1622
|
+
`),
|
|
1623
|
+
($) => {
|
|
1624
|
+
const C = document.createElement("canvas");
|
|
1625
|
+
C.className = "absolute diff";
|
|
1626
|
+
C.ariaLabel = "rendered diff";
|
|
1627
|
+
const A = tsx("img", { alt: "source a", className: "absolute" });
|
|
1628
|
+
const B = tsx("img", { alt: "source b", className: "absolute" });
|
|
1629
|
+
const ctx = C.getContext("2d");
|
|
1630
|
+
function render() {
|
|
1631
|
+
if (!ctx) throw new Error("No rendering context");
|
|
1632
|
+
if (!$.src1 || !$.src2) return;
|
|
1633
|
+
A.src = $.src2;
|
|
1634
|
+
B.src = $.src1;
|
|
1635
|
+
imageDiff($.src1, $.src2).then(
|
|
1636
|
+
({ diff }) => {
|
|
1637
|
+
$.style.width = `${C.width = diff.width}px`;
|
|
1638
|
+
$.style.height = `${C.height = diff.height}px`;
|
|
1639
|
+
ctx.putImageData(diff, 0, 0);
|
|
1640
|
+
},
|
|
1641
|
+
(e) => console.error(e)
|
|
1642
|
+
);
|
|
1643
|
+
}
|
|
1644
|
+
$.shadowRoot?.append(B, A, C);
|
|
1645
|
+
return merge(
|
|
1646
|
+
merge(get($, "src1"), get($, "src2")).raf(render),
|
|
1647
|
+
get($, "ratio").raf((val) => A.style.opacity = val.toString())
|
|
1648
|
+
);
|
|
1649
|
+
}
|
|
1650
|
+
]
|
|
1651
|
+
});
|
|
1652
|
+
var BrowserRunner = class {
|
|
1653
|
+
suites;
|
|
1654
|
+
baselinePath;
|
|
1655
|
+
constructor(config) {
|
|
1656
|
+
this.suites = config.suites;
|
|
1657
|
+
this.baselinePath = config.baselinePath;
|
|
1658
|
+
}
|
|
1659
|
+
async runSuite(suite) {
|
|
1660
|
+
await suite.run();
|
|
1661
|
+
this.renderTestReport(suite);
|
|
1662
|
+
}
|
|
1663
|
+
renderTestReport(test) {
|
|
56
1664
|
let failureCount = 0;
|
|
57
1665
|
const failures = [];
|
|
58
1666
|
const results = test.results;
|
|
59
|
-
results.forEach(r => {
|
|
60
|
-
|
|
61
|
-
failureCount++;
|
|
62
|
-
failures.push(r);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (results.length === 0 &&
|
|
66
|
-
test.tests.length === 0 &&
|
|
67
|
-
test.only.length === 0) {
|
|
1667
|
+
results.forEach((r) => {
|
|
1668
|
+
if (r.success === false) {
|
|
68
1669
|
failureCount++;
|
|
69
|
-
|
|
1670
|
+
failures.push(r);
|
|
1671
|
+
}
|
|
1672
|
+
});
|
|
1673
|
+
if (results.length === 0 && test.tests.length === 0 && test.only.length === 0) {
|
|
1674
|
+
failureCount++;
|
|
1675
|
+
results.push({ success: false, message: "No assertions found" });
|
|
70
1676
|
}
|
|
71
|
-
group(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
1677
|
+
group(
|
|
1678
|
+
test.id,
|
|
1679
|
+
`${test.name}${failureCount > 0 ? ` (${failureCount} failures)` : ""}`
|
|
1680
|
+
);
|
|
1681
|
+
results.forEach((r) => {
|
|
1682
|
+
printResult(r, this.baselinePath);
|
|
1683
|
+
if (!r.success) printError(r);
|
|
76
1684
|
});
|
|
77
1685
|
if (test.only.length)
|
|
78
|
-
|
|
79
|
-
else
|
|
80
|
-
test.tests.forEach((test) => renderTestReport(test));
|
|
1686
|
+
test.only.forEach((test2) => this.renderTestReport(test2));
|
|
1687
|
+
else test.tests.forEach((test2) => this.renderTestReport(test2));
|
|
81
1688
|
groupEnd();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
async function onClick(suite, ev) {
|
|
93
|
-
const testId = ev.target?.dataset.test;
|
|
94
|
-
if (testId) {
|
|
95
|
-
ev.stopPropagation();
|
|
96
|
-
ev.preventDefault();
|
|
97
|
-
const test = findTest(suite, +testId);
|
|
98
|
-
if (test) {
|
|
99
|
-
console.log(`Running test "${test.name}"`);
|
|
100
|
-
test.results = [];
|
|
101
|
-
await test.run();
|
|
102
|
-
console.log(test.results);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
window.__cxlRunner = data => {
|
|
107
|
-
if (data.type === 'figure')
|
|
108
|
-
return {
|
|
109
|
-
success: true,
|
|
110
|
-
message: 'Screenshot should match baseline',
|
|
111
|
-
data,
|
|
112
|
-
};
|
|
113
|
-
return {
|
|
114
|
-
success: false,
|
|
115
|
-
message: `${data.type} not supported.`,
|
|
116
|
-
};
|
|
1689
|
+
}
|
|
1690
|
+
async run() {
|
|
1691
|
+
await Promise.all(this.suites.map((suite) => this.runSuite(suite)));
|
|
1692
|
+
const container = document.createElement("cxl-content");
|
|
1693
|
+
container.innerHTML = output;
|
|
1694
|
+
container.addEventListener("click", (ev) => {
|
|
1695
|
+
onClick(this.suites, ev).catch((e) => console.error(e));
|
|
1696
|
+
});
|
|
1697
|
+
document.body.appendChild(container);
|
|
1698
|
+
}
|
|
117
1699
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
container.addEventListener('click', ev => onClick(suites, ev));
|
|
129
|
-
document.body.appendChild(container);
|
|
130
|
-
},
|
|
1700
|
+
var index_default = BrowserRunner;
|
|
1701
|
+
export {
|
|
1702
|
+
ImageDiff,
|
|
1703
|
+
index_default as default,
|
|
1704
|
+
escapeHtml,
|
|
1705
|
+
image,
|
|
1706
|
+
imageData,
|
|
1707
|
+
imageDataDiff,
|
|
1708
|
+
imageDiff,
|
|
1709
|
+
loadImage
|
|
131
1710
|
};
|
|
132
|
-
export default browserRunner;
|