@bedrock-layout/solid 0.2.2 → 0.5.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/lib/index.m.js CHANGED
@@ -1,4 +1,1139 @@
1
- const Stack = () => {
2
- return void 0;
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a2, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a2, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a2, prop, b[prop]);
16
+ }
17
+ return a2;
3
18
  };
4
- export { Stack };
19
+ var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
20
+ let e = { data: "" }, t = (t2) => typeof window == "object" ? ((t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign((t2 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t2 || e, l = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, a = /\/\*[^]*?\*\/|\s\s+|\n/g, n = (e2, t2) => {
21
+ let r = "", l2 = "", a2 = "";
22
+ for (let o2 in e2) {
23
+ let s2 = e2[o2];
24
+ o2[0] == "@" ? o2[1] == "i" ? r = o2 + " " + s2 + ";" : l2 += o2[1] == "f" ? n(s2, o2) : o2 + "{" + n(s2, o2[1] == "k" ? "" : t2) + "}" : typeof s2 == "object" ? l2 += n(s2, t2 ? t2.replace(/([^,])+/g, (e3) => o2.replace(/(^:.*)|([^,])+/g, (t3) => /&/.test(t3) ? t3.replace(/&/g, e3) : e3 ? e3 + " " + t3 : t3)) : o2) : s2 != null && (o2 = /^--/.test(o2) ? o2 : o2.replace(/[A-Z]/g, "-$&").toLowerCase(), a2 += n.p ? n.p(o2, s2) : o2 + ":" + s2 + ";");
25
+ }
26
+ return r + (t2 && a2 ? t2 + "{" + a2 + "}" : a2) + l2;
27
+ }, o = {}, s = (e2) => {
28
+ if (typeof e2 == "object") {
29
+ let t2 = "";
30
+ for (let r in e2)
31
+ t2 += r + s(e2[r]);
32
+ return t2;
33
+ }
34
+ return e2;
35
+ }, c = (e2, t2, r, c2, i2) => {
36
+ let u2 = s(e2), p = o[u2] || (o[u2] = ((e3) => {
37
+ let t3 = 0, r2 = 11;
38
+ for (; t3 < e3.length; )
39
+ r2 = 101 * r2 + e3.charCodeAt(t3++) >>> 0;
40
+ return "go" + r2;
41
+ })(u2));
42
+ if (!o[p]) {
43
+ let t3 = u2 !== e2 ? e2 : ((e3) => {
44
+ let t4, r2 = [{}];
45
+ for (; t4 = l.exec(e3.replace(a, "")); )
46
+ t4[4] ? r2.shift() : t4[3] ? r2.unshift(r2[0][t4[3]] = r2[0][t4[3]] || {}) : r2[0][t4[1]] = t4[2];
47
+ return r2[0];
48
+ })(e2);
49
+ o[p] = n(i2 ? { ["@keyframes " + p]: t3 } : t3, r ? "" : "." + p);
50
+ }
51
+ return ((e3, t3, r2) => {
52
+ t3.data.indexOf(e3) == -1 && (t3.data = r2 ? e3 + t3.data : t3.data + e3);
53
+ })(o[p], t2, c2), p;
54
+ }, i = (e2, t2, r) => e2.reduce((e3, l2, a2) => {
55
+ let o2 = t2[a2];
56
+ if (o2 && o2.call) {
57
+ let e4 = o2(r), t3 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4;
58
+ o2 = t3 ? "." + t3 : e4 && typeof e4 == "object" ? e4.props ? "" : n(e4, "") : e4 === false ? "" : e4;
59
+ }
60
+ return e3 + l2 + (o2 == null ? "" : o2);
61
+ }, "");
62
+ function u(e2) {
63
+ let r = this || {}, l2 = e2.call ? e2(r.p) : e2;
64
+ return c(l2.unshift ? l2.raw ? i(l2, [].slice.call(arguments, 1), r.p) : l2.reduce((e3, t2) => Object.assign(e3, t2 && t2.call ? t2(r.p) : t2), {}) : l2, t(r.target), r.g, r.o, r.k);
65
+ }
66
+ u.bind({ g: 1 });
67
+ u.bind({ k: 1 });
68
+ const equalFn = (a2, b) => a2 === b;
69
+ const $PROXY = Symbol("solid-proxy");
70
+ const signalOptions = {
71
+ equals: equalFn
72
+ };
73
+ let runEffects = runQueue;
74
+ const NOTPENDING = {};
75
+ const STALE = 1;
76
+ const PENDING = 2;
77
+ const UNOWNED = {
78
+ owned: null,
79
+ cleanups: null,
80
+ context: null,
81
+ owner: null
82
+ };
83
+ var Owner = null;
84
+ let Transition = null;
85
+ let Listener = null;
86
+ let Pending = null;
87
+ let Updates = null;
88
+ let Effects = null;
89
+ let ExecCount = 0;
90
+ function createComputed(fn, value, options) {
91
+ const c2 = createComputation(fn, value, true, STALE);
92
+ updateComputation(c2);
93
+ }
94
+ function createRenderEffect(fn, value, options) {
95
+ const c2 = createComputation(fn, value, false, STALE);
96
+ updateComputation(c2);
97
+ }
98
+ function createMemo(fn, value, options) {
99
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
100
+ const c2 = createComputation(fn, value, true, 0);
101
+ c2.pending = NOTPENDING;
102
+ c2.observers = null;
103
+ c2.observerSlots = null;
104
+ c2.comparator = options.equals || void 0;
105
+ updateComputation(c2);
106
+ return readSignal.bind(c2);
107
+ }
108
+ function batch(fn) {
109
+ if (Pending)
110
+ return fn();
111
+ let result;
112
+ const q = Pending = [];
113
+ try {
114
+ result = fn();
115
+ } finally {
116
+ Pending = null;
117
+ }
118
+ runUpdates(() => {
119
+ for (let i2 = 0; i2 < q.length; i2 += 1) {
120
+ const data = q[i2];
121
+ if (data.pending !== NOTPENDING) {
122
+ const pending = data.pending;
123
+ data.pending = NOTPENDING;
124
+ writeSignal(data, pending);
125
+ }
126
+ }
127
+ }, false);
128
+ return result;
129
+ }
130
+ function untrack(fn) {
131
+ let result, listener = Listener;
132
+ Listener = null;
133
+ result = fn();
134
+ Listener = listener;
135
+ return result;
136
+ }
137
+ function createContext(defaultValue) {
138
+ const id = Symbol("context");
139
+ return {
140
+ id,
141
+ Provider: createProvider(id),
142
+ defaultValue
143
+ };
144
+ }
145
+ function useContext(context) {
146
+ return lookup(Owner, context.id) || context.defaultValue;
147
+ }
148
+ function children(fn) {
149
+ const children2 = createMemo(fn);
150
+ return createMemo(() => resolveChildren(children2()));
151
+ }
152
+ function readSignal() {
153
+ const runningTransition = Transition;
154
+ if (this.sources && (this.state || runningTransition)) {
155
+ const updates = Updates;
156
+ Updates = null;
157
+ this.state === STALE || runningTransition ? updateComputation(this) : lookDownstream(this);
158
+ Updates = updates;
159
+ }
160
+ if (Listener) {
161
+ const sSlot = this.observers ? this.observers.length : 0;
162
+ if (!Listener.sources) {
163
+ Listener.sources = [this];
164
+ Listener.sourceSlots = [sSlot];
165
+ } else {
166
+ Listener.sources.push(this);
167
+ Listener.sourceSlots.push(sSlot);
168
+ }
169
+ if (!this.observers) {
170
+ this.observers = [Listener];
171
+ this.observerSlots = [Listener.sources.length - 1];
172
+ } else {
173
+ this.observers.push(Listener);
174
+ this.observerSlots.push(Listener.sources.length - 1);
175
+ }
176
+ }
177
+ return this.value;
178
+ }
179
+ function writeSignal(node, value, isComp) {
180
+ if (node.comparator) {
181
+ if (node.comparator(node.value, value))
182
+ return value;
183
+ }
184
+ if (Pending) {
185
+ if (node.pending === NOTPENDING)
186
+ Pending.push(node);
187
+ node.pending = value;
188
+ return value;
189
+ }
190
+ let TransitionRunning = false;
191
+ node.value = value;
192
+ if (node.observers && node.observers.length) {
193
+ runUpdates(() => {
194
+ for (let i2 = 0; i2 < node.observers.length; i2 += 1) {
195
+ const o2 = node.observers[i2];
196
+ if (TransitionRunning && Transition.disposed.has(o2))
197
+ ;
198
+ if (o2.pure)
199
+ Updates.push(o2);
200
+ else
201
+ Effects.push(o2);
202
+ if (o2.observers && (TransitionRunning && !o2.tState || !TransitionRunning && !o2.state))
203
+ markUpstream(o2);
204
+ if (TransitionRunning)
205
+ ;
206
+ else
207
+ o2.state = STALE;
208
+ }
209
+ if (Updates.length > 1e6) {
210
+ Updates = [];
211
+ if (false)
212
+ ;
213
+ throw new Error();
214
+ }
215
+ }, false);
216
+ }
217
+ return value;
218
+ }
219
+ function updateComputation(node) {
220
+ if (!node.fn)
221
+ return;
222
+ cleanNode(node);
223
+ const owner = Owner, listener = Listener, time = ExecCount;
224
+ Listener = Owner = node;
225
+ runComputation(node, node.value, time);
226
+ Listener = listener;
227
+ Owner = owner;
228
+ }
229
+ function runComputation(node, value, time) {
230
+ let nextValue;
231
+ try {
232
+ nextValue = node.fn(value);
233
+ } catch (err) {
234
+ handleError(err);
235
+ }
236
+ if (!node.updatedAt || node.updatedAt <= time) {
237
+ if (node.observers && node.observers.length) {
238
+ writeSignal(node, nextValue);
239
+ } else
240
+ node.value = nextValue;
241
+ node.updatedAt = time;
242
+ }
243
+ }
244
+ function createComputation(fn, init, pure, state = STALE, options) {
245
+ const c2 = {
246
+ fn,
247
+ state,
248
+ updatedAt: null,
249
+ owned: null,
250
+ sources: null,
251
+ sourceSlots: null,
252
+ cleanups: null,
253
+ value: init,
254
+ owner: Owner,
255
+ context: null,
256
+ pure
257
+ };
258
+ if (Owner === null)
259
+ ;
260
+ else if (Owner !== UNOWNED) {
261
+ {
262
+ if (!Owner.owned)
263
+ Owner.owned = [c2];
264
+ else
265
+ Owner.owned.push(c2);
266
+ }
267
+ }
268
+ return c2;
269
+ }
270
+ function runTop(node) {
271
+ const runningTransition = Transition;
272
+ if (node.state !== STALE)
273
+ return node.state = 0;
274
+ if (node.suspense && untrack(node.suspense.inFallback))
275
+ return node.suspense.effects.push(node);
276
+ const ancestors = [node];
277
+ while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
278
+ if (node.state || runningTransition)
279
+ ancestors.push(node);
280
+ }
281
+ for (let i2 = ancestors.length - 1; i2 >= 0; i2--) {
282
+ node = ancestors[i2];
283
+ if (node.state === STALE || runningTransition) {
284
+ updateComputation(node);
285
+ } else if (node.state === PENDING || runningTransition) {
286
+ const updates = Updates;
287
+ Updates = null;
288
+ lookDownstream(node, ancestors[0]);
289
+ Updates = updates;
290
+ }
291
+ }
292
+ }
293
+ function runUpdates(fn, init) {
294
+ if (Updates)
295
+ return fn();
296
+ let wait = false;
297
+ if (!init)
298
+ Updates = [];
299
+ if (Effects)
300
+ wait = true;
301
+ else
302
+ Effects = [];
303
+ ExecCount++;
304
+ try {
305
+ return fn();
306
+ } catch (err) {
307
+ handleError(err);
308
+ } finally {
309
+ completeUpdates(wait);
310
+ }
311
+ }
312
+ function completeUpdates(wait) {
313
+ if (Updates) {
314
+ runQueue(Updates);
315
+ Updates = null;
316
+ }
317
+ if (wait)
318
+ return;
319
+ if (Effects.length)
320
+ batch(() => {
321
+ runEffects(Effects);
322
+ Effects = null;
323
+ });
324
+ else {
325
+ Effects = null;
326
+ }
327
+ }
328
+ function runQueue(queue) {
329
+ for (let i2 = 0; i2 < queue.length; i2++)
330
+ runTop(queue[i2]);
331
+ }
332
+ function lookDownstream(node, ignore) {
333
+ node.state = 0;
334
+ const runningTransition = Transition;
335
+ for (let i2 = 0; i2 < node.sources.length; i2 += 1) {
336
+ const source = node.sources[i2];
337
+ if (source.sources) {
338
+ if (source.state === STALE || runningTransition) {
339
+ if (source !== ignore)
340
+ runTop(source);
341
+ } else if (source.state === PENDING || runningTransition)
342
+ lookDownstream(source, ignore);
343
+ }
344
+ }
345
+ }
346
+ function markUpstream(node) {
347
+ const runningTransition = Transition;
348
+ for (let i2 = 0; i2 < node.observers.length; i2 += 1) {
349
+ const o2 = node.observers[i2];
350
+ if (!o2.state || runningTransition) {
351
+ o2.state = PENDING;
352
+ if (o2.pure)
353
+ Updates.push(o2);
354
+ else
355
+ Effects.push(o2);
356
+ o2.observers && markUpstream(o2);
357
+ }
358
+ }
359
+ }
360
+ function cleanNode(node) {
361
+ let i2;
362
+ if (node.sources) {
363
+ while (node.sources.length) {
364
+ const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
365
+ if (obs && obs.length) {
366
+ const n2 = obs.pop(), s2 = source.observerSlots.pop();
367
+ if (index < obs.length) {
368
+ n2.sourceSlots[s2] = index;
369
+ obs[index] = n2;
370
+ source.observerSlots[index] = s2;
371
+ }
372
+ }
373
+ }
374
+ }
375
+ if (node.owned) {
376
+ for (i2 = 0; i2 < node.owned.length; i2++)
377
+ cleanNode(node.owned[i2]);
378
+ node.owned = null;
379
+ }
380
+ if (node.cleanups) {
381
+ for (i2 = 0; i2 < node.cleanups.length; i2++)
382
+ node.cleanups[i2]();
383
+ node.cleanups = null;
384
+ }
385
+ node.state = 0;
386
+ node.context = null;
387
+ }
388
+ function handleError(err) {
389
+ throw err;
390
+ }
391
+ function lookup(owner, key) {
392
+ return owner && (owner.context && owner.context[key] !== void 0 ? owner.context[key] : owner.owner && lookup(owner.owner, key));
393
+ }
394
+ function resolveChildren(children2) {
395
+ if (typeof children2 === "function" && !children2.length)
396
+ return resolveChildren(children2());
397
+ if (Array.isArray(children2)) {
398
+ const results = [];
399
+ for (let i2 = 0; i2 < children2.length; i2++) {
400
+ const result = resolveChildren(children2[i2]);
401
+ Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
402
+ }
403
+ return results;
404
+ }
405
+ return children2;
406
+ }
407
+ function createProvider(id) {
408
+ return function provider(props) {
409
+ let res;
410
+ createComputed(() => res = untrack(() => {
411
+ Owner.context = {
412
+ [id]: props.value
413
+ };
414
+ return children(() => props.children);
415
+ }));
416
+ return res;
417
+ };
418
+ }
419
+ function trueFn() {
420
+ return true;
421
+ }
422
+ const propTraps = {
423
+ get(_, property, receiver) {
424
+ if (property === $PROXY)
425
+ return receiver;
426
+ return _.get(property);
427
+ },
428
+ has(_, property) {
429
+ return _.has(property);
430
+ },
431
+ set: trueFn,
432
+ deleteProperty: trueFn,
433
+ getOwnPropertyDescriptor(_, property) {
434
+ return {
435
+ configurable: true,
436
+ enumerable: true,
437
+ get() {
438
+ return _.get(property);
439
+ },
440
+ set: trueFn,
441
+ deleteProperty: trueFn
442
+ };
443
+ },
444
+ ownKeys(_) {
445
+ return _.keys();
446
+ }
447
+ };
448
+ function resolveSource(s2) {
449
+ return typeof s2 === "function" ? s2() : s2;
450
+ }
451
+ function mergeProps(...sources) {
452
+ return new Proxy({
453
+ get(property) {
454
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
455
+ const v = resolveSource(sources[i2])[property];
456
+ if (v !== void 0)
457
+ return v;
458
+ }
459
+ },
460
+ has(property) {
461
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
462
+ if (property in resolveSource(sources[i2]))
463
+ return true;
464
+ }
465
+ return false;
466
+ },
467
+ keys() {
468
+ const keys = [];
469
+ for (let i2 = 0; i2 < sources.length; i2++)
470
+ keys.push(...Object.keys(resolveSource(sources[i2])));
471
+ return [...new Set(keys)];
472
+ }
473
+ }, propTraps);
474
+ }
475
+ function splitProps(props, ...keys) {
476
+ const blocked = new Set(keys.flat());
477
+ const descriptors = Object.getOwnPropertyDescriptors(props);
478
+ const res = keys.map((k) => {
479
+ const clone = {};
480
+ for (let i2 = 0; i2 < k.length; i2++) {
481
+ const key = k[i2];
482
+ Object.defineProperty(clone, key, descriptors[key] ? descriptors[key] : {
483
+ get() {
484
+ return props[key];
485
+ },
486
+ set() {
487
+ return true;
488
+ }
489
+ });
490
+ }
491
+ return clone;
492
+ });
493
+ res.push(new Proxy({
494
+ get(property) {
495
+ return blocked.has(property) ? void 0 : props[property];
496
+ },
497
+ has(property) {
498
+ return blocked.has(property) ? false : property in props;
499
+ },
500
+ keys() {
501
+ return Object.keys(props).filter((k) => !blocked.has(k));
502
+ }
503
+ }, propTraps));
504
+ return res;
505
+ }
506
+ const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
507
+ const Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
508
+ const ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
509
+ const Aliases = {
510
+ className: "class",
511
+ htmlFor: "for"
512
+ };
513
+ const PropAliases = {
514
+ class: "className",
515
+ formnovalidate: "formNoValidate",
516
+ ismap: "isMap",
517
+ nomodule: "noModule",
518
+ playsinline: "playsInline",
519
+ readonly: "readOnly"
520
+ };
521
+ const DelegatedEvents = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
522
+ const SVGNamespace = {
523
+ xlink: "http://www.w3.org/1999/xlink",
524
+ xml: "http://www.w3.org/XML/1998/namespace"
525
+ };
526
+ function reconcileArrays(parentNode, a2, b) {
527
+ let bLength = b.length, aEnd = a2.length, bEnd = bLength, aStart = 0, bStart = 0, after = a2[aEnd - 1].nextSibling, map = null;
528
+ while (aStart < aEnd || bStart < bEnd) {
529
+ if (a2[aStart] === b[bStart]) {
530
+ aStart++;
531
+ bStart++;
532
+ continue;
533
+ }
534
+ while (a2[aEnd - 1] === b[bEnd - 1]) {
535
+ aEnd--;
536
+ bEnd--;
537
+ }
538
+ if (aEnd === aStart) {
539
+ const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
540
+ while (bStart < bEnd)
541
+ parentNode.insertBefore(b[bStart++], node);
542
+ } else if (bEnd === bStart) {
543
+ while (aStart < aEnd) {
544
+ if (!map || !map.has(a2[aStart]))
545
+ a2[aStart].remove();
546
+ aStart++;
547
+ }
548
+ } else if (a2[aStart] === b[bEnd - 1] && b[bStart] === a2[aEnd - 1]) {
549
+ const node = a2[--aEnd].nextSibling;
550
+ parentNode.insertBefore(b[bStart++], a2[aStart++].nextSibling);
551
+ parentNode.insertBefore(b[--bEnd], node);
552
+ a2[aEnd] = b[bEnd];
553
+ } else {
554
+ if (!map) {
555
+ map = /* @__PURE__ */ new Map();
556
+ let i2 = bStart;
557
+ while (i2 < bEnd)
558
+ map.set(b[i2], i2++);
559
+ }
560
+ const index = map.get(a2[aStart]);
561
+ if (index != null) {
562
+ if (bStart < index && index < bEnd) {
563
+ let i2 = aStart, sequence = 1, t2;
564
+ while (++i2 < aEnd && i2 < bEnd) {
565
+ if ((t2 = map.get(a2[i2])) == null || t2 !== index + sequence)
566
+ break;
567
+ sequence++;
568
+ }
569
+ if (sequence > index - bStart) {
570
+ const node = a2[aStart];
571
+ while (bStart < index)
572
+ parentNode.insertBefore(b[bStart++], node);
573
+ } else
574
+ parentNode.replaceChild(b[bStart++], a2[aStart++]);
575
+ } else
576
+ aStart++;
577
+ } else
578
+ a2[aStart++].remove();
579
+ }
580
+ }
581
+ }
582
+ const $$EVENTS = "_$DX_DELEGATE";
583
+ function delegateEvents(eventNames, document2 = window.document) {
584
+ const e2 = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
585
+ for (let i2 = 0, l2 = eventNames.length; i2 < l2; i2++) {
586
+ const name = eventNames[i2];
587
+ if (!e2.has(name)) {
588
+ e2.add(name);
589
+ document2.addEventListener(name, eventHandler);
590
+ }
591
+ }
592
+ }
593
+ function setAttribute(node, name, value) {
594
+ if (value == null)
595
+ node.removeAttribute(name);
596
+ else
597
+ node.setAttribute(name, value);
598
+ }
599
+ function setAttributeNS(node, namespace, name, value) {
600
+ if (value == null)
601
+ node.removeAttributeNS(namespace, name);
602
+ else
603
+ node.setAttributeNS(namespace, name, value);
604
+ }
605
+ function addEventListener(node, name, handler, delegate) {
606
+ if (delegate) {
607
+ if (Array.isArray(handler)) {
608
+ node[`$$${name}`] = handler[0];
609
+ node[`$$${name}Data`] = handler[1];
610
+ } else
611
+ node[`$$${name}`] = handler;
612
+ } else if (Array.isArray(handler)) {
613
+ node.addEventListener(name, (e2) => handler[0](handler[1], e2));
614
+ } else
615
+ node.addEventListener(name, handler);
616
+ }
617
+ function classList(node, value, prev = {}) {
618
+ const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
619
+ let i2, len;
620
+ for (i2 = 0, len = prevKeys.length; i2 < len; i2++) {
621
+ const key = prevKeys[i2];
622
+ if (!key || key === "undefined" || value[key])
623
+ continue;
624
+ toggleClassKey(node, key, false);
625
+ delete prev[key];
626
+ }
627
+ for (i2 = 0, len = classKeys.length; i2 < len; i2++) {
628
+ const key = classKeys[i2], classValue = !!value[key];
629
+ if (!key || key === "undefined" || prev[key] === classValue || !classValue)
630
+ continue;
631
+ toggleClassKey(node, key, true);
632
+ prev[key] = classValue;
633
+ }
634
+ return prev;
635
+ }
636
+ function style(node, value, prev = {}) {
637
+ const nodeStyle = node.style;
638
+ if (value == null || typeof value === "string")
639
+ return nodeStyle.cssText = value;
640
+ typeof prev === "string" && (prev = {});
641
+ let v, s2;
642
+ for (s2 in prev) {
643
+ value[s2] == null && nodeStyle.removeProperty(s2);
644
+ delete prev[s2];
645
+ }
646
+ for (s2 in value) {
647
+ v = value[s2];
648
+ if (v !== prev[s2]) {
649
+ nodeStyle.setProperty(s2, v);
650
+ prev[s2] = v;
651
+ }
652
+ }
653
+ return prev;
654
+ }
655
+ function spread(node, accessor, isSVG, skipChildren) {
656
+ if (typeof accessor === "function") {
657
+ createRenderEffect((current) => spreadExpression(node, accessor(), current, isSVG, skipChildren));
658
+ } else
659
+ spreadExpression(node, accessor, void 0, isSVG, skipChildren);
660
+ }
661
+ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
662
+ for (const prop in prevProps) {
663
+ if (!(prop in props)) {
664
+ if (prop === "children")
665
+ continue;
666
+ assignProp(node, prop, null, prevProps[prop], isSVG);
667
+ }
668
+ }
669
+ for (const prop in props) {
670
+ if (prop === "children") {
671
+ if (!skipChildren)
672
+ insertExpression(node, props.children);
673
+ continue;
674
+ }
675
+ const value = props[prop];
676
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
677
+ }
678
+ }
679
+ function toPropertyName(name) {
680
+ return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
681
+ }
682
+ function toggleClassKey(node, key, value) {
683
+ const classNames = key.trim().split(/\s+/);
684
+ for (let i2 = 0, nameLen = classNames.length; i2 < nameLen; i2++)
685
+ node.classList.toggle(classNames[i2], value);
686
+ }
687
+ function assignProp(node, prop, value, prev, isSVG) {
688
+ let isCE, isProp, isChildProp;
689
+ if (prop === "style")
690
+ return style(node, value, prev);
691
+ if (prop === "classList")
692
+ return classList(node, value, prev);
693
+ if (value === prev)
694
+ return prev;
695
+ if (prop === "ref") {
696
+ value(node);
697
+ } else if (prop.slice(0, 3) === "on:") {
698
+ node.addEventListener(prop.slice(3), value);
699
+ } else if (prop.slice(0, 10) === "oncapture:") {
700
+ node.addEventListener(prop.slice(10), value, true);
701
+ } else if (prop.slice(0, 2) === "on") {
702
+ const name = prop.slice(2).toLowerCase();
703
+ const delegate = DelegatedEvents.has(name);
704
+ addEventListener(node, name, value, delegate);
705
+ delegate && delegateEvents([name]);
706
+ } else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
707
+ if (isCE && !isProp && !isChildProp)
708
+ node[toPropertyName(prop)] = value;
709
+ else
710
+ node[PropAliases[prop] || prop] = value;
711
+ } else {
712
+ const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
713
+ if (ns)
714
+ setAttributeNS(node, ns, prop, value);
715
+ else
716
+ setAttribute(node, Aliases[prop] || prop, value);
717
+ }
718
+ return value;
719
+ }
720
+ function eventHandler(e2) {
721
+ const key = `$$${e2.type}`;
722
+ let node = e2.composedPath && e2.composedPath()[0] || e2.target;
723
+ if (e2.target !== node) {
724
+ Object.defineProperty(e2, "target", {
725
+ configurable: true,
726
+ value: node
727
+ });
728
+ }
729
+ Object.defineProperty(e2, "currentTarget", {
730
+ configurable: true,
731
+ get() {
732
+ return node || document;
733
+ }
734
+ });
735
+ while (node !== null) {
736
+ const handler = node[key];
737
+ if (handler && !node.disabled) {
738
+ const data = node[`${key}Data`];
739
+ data !== void 0 ? handler(data, e2) : handler(e2);
740
+ if (e2.cancelBubble)
741
+ return;
742
+ }
743
+ node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
744
+ }
745
+ }
746
+ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
747
+ if (!skipChildren && "children" in props) {
748
+ createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
749
+ }
750
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
751
+ return prevProps;
752
+ }
753
+ function insertExpression(parent, value, current, marker, unwrapArray) {
754
+ while (typeof current === "function")
755
+ current = current();
756
+ if (value === current)
757
+ return current;
758
+ const t2 = typeof value, multi = marker !== void 0;
759
+ parent = multi && current[0] && current[0].parentNode || parent;
760
+ if (t2 === "string" || t2 === "number") {
761
+ if (t2 === "number")
762
+ value = value.toString();
763
+ if (multi) {
764
+ let node = current[0];
765
+ if (node && node.nodeType === 3) {
766
+ node.data = value;
767
+ } else
768
+ node = document.createTextNode(value);
769
+ current = cleanChildren(parent, current, marker, node);
770
+ } else {
771
+ if (current !== "" && typeof current === "string") {
772
+ current = parent.firstChild.data = value;
773
+ } else
774
+ current = parent.textContent = value;
775
+ }
776
+ } else if (value == null || t2 === "boolean") {
777
+ current = cleanChildren(parent, current, marker);
778
+ } else if (t2 === "function") {
779
+ createRenderEffect(() => {
780
+ let v = value();
781
+ while (typeof v === "function")
782
+ v = v();
783
+ current = insertExpression(parent, v, current, marker);
784
+ });
785
+ return () => current;
786
+ } else if (Array.isArray(value)) {
787
+ const array = [];
788
+ if (normalizeIncomingArray(array, value, unwrapArray)) {
789
+ createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
790
+ return () => current;
791
+ }
792
+ if (array.length === 0) {
793
+ current = cleanChildren(parent, current, marker);
794
+ if (multi)
795
+ return current;
796
+ } else if (Array.isArray(current)) {
797
+ if (current.length === 0) {
798
+ appendNodes(parent, array, marker);
799
+ } else
800
+ reconcileArrays(parent, current, array);
801
+ } else {
802
+ current && cleanChildren(parent);
803
+ appendNodes(parent, array);
804
+ }
805
+ current = array;
806
+ } else if (value instanceof Node) {
807
+ if (Array.isArray(current)) {
808
+ if (multi)
809
+ return current = cleanChildren(parent, current, marker, value);
810
+ cleanChildren(parent, current, null, value);
811
+ } else if (current == null || current === "" || !parent.firstChild) {
812
+ parent.appendChild(value);
813
+ } else
814
+ parent.replaceChild(value, parent.firstChild);
815
+ current = value;
816
+ } else
817
+ ;
818
+ return current;
819
+ }
820
+ function normalizeIncomingArray(normalized, array, unwrap) {
821
+ let dynamic = false;
822
+ for (let i2 = 0, len = array.length; i2 < len; i2++) {
823
+ let item = array[i2], t2;
824
+ if (item instanceof Node) {
825
+ normalized.push(item);
826
+ } else if (item == null || item === true || item === false)
827
+ ;
828
+ else if (Array.isArray(item)) {
829
+ dynamic = normalizeIncomingArray(normalized, item) || dynamic;
830
+ } else if ((t2 = typeof item) === "string") {
831
+ normalized.push(document.createTextNode(item));
832
+ } else if (t2 === "function") {
833
+ if (unwrap) {
834
+ while (typeof item === "function")
835
+ item = item();
836
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
837
+ } else {
838
+ normalized.push(item);
839
+ dynamic = true;
840
+ }
841
+ } else
842
+ normalized.push(document.createTextNode(item.toString()));
843
+ }
844
+ return dynamic;
845
+ }
846
+ function appendNodes(parent, array, marker) {
847
+ for (let i2 = 0, len = array.length; i2 < len; i2++)
848
+ parent.insertBefore(array[i2], marker);
849
+ }
850
+ function cleanChildren(parent, current, marker, replacement) {
851
+ if (marker === void 0)
852
+ return parent.textContent = "";
853
+ const node = replacement || document.createTextNode("");
854
+ if (current.length) {
855
+ let inserted = false;
856
+ for (let i2 = current.length - 1; i2 >= 0; i2--) {
857
+ const el = current[i2];
858
+ if (node !== el) {
859
+ const isParent = el.parentNode === parent;
860
+ if (!inserted && !i2)
861
+ isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
862
+ else
863
+ isParent && el.remove();
864
+ } else
865
+ inserted = true;
866
+ }
867
+ } else
868
+ parent.insertBefore(node, marker);
869
+ return [node];
870
+ }
871
+ function ssr(template, ...nodes) {
872
+ }
873
+ function ssrSpread(accessor) {
874
+ }
875
+ const isServer = false;
876
+ const ThemeContext = createContext();
877
+ function makeStyled(tag) {
878
+ let _ctx = this || {};
879
+ return (...args) => {
880
+ const Styled = (props) => {
881
+ const theme = useContext(ThemeContext);
882
+ const withTheme = mergeProps(props, { theme });
883
+ const clone = mergeProps(withTheme, {
884
+ get className() {
885
+ const pClassName = withTheme.className, append = "className" in withTheme && /^go[0-9]+/.test(pClassName);
886
+ let className = u.apply({ target: _ctx.target, o: append, p: withTheme, g: _ctx.g }, args);
887
+ return [pClassName, className].filter(Boolean).join(" ");
888
+ }
889
+ });
890
+ const [local, newProps] = splitProps(clone, ["as"]);
891
+ const createTag = local.as || tag;
892
+ let el;
893
+ if (typeof createTag === "function") {
894
+ el = createTag(newProps);
895
+ } else if (isServer) {
896
+ const [local2, others] = splitProps(newProps, ["children"]);
897
+ el = ssr([`<${createTag} `, ">", `</${createTag}>`], ssrSpread(), local2.children || "");
898
+ } else {
899
+ el = document.createElement(createTag);
900
+ spread(el, newProps);
901
+ }
902
+ return el;
903
+ };
904
+ Styled.className = (props) => {
905
+ return untrack(() => {
906
+ return u.apply({ target: _ctx.target, p: props, g: _ctx.g }, args);
907
+ });
908
+ };
909
+ return Styled;
910
+ };
911
+ }
912
+ const styled = new Proxy(makeStyled, {
913
+ get(target, tag) {
914
+ return target(tag);
915
+ }
916
+ });
917
+ function checkIsCSSLength(str) {
918
+ if (typeof str !== "string")
919
+ return false;
920
+ return [
921
+ /^[0-9]{0,10000}\.?[0-9]{1,10000}(vmin|vmax|vh|vw|%|ch|ex|em|rem|in|cm|mm|pt|pc|px)$/,
922
+ /^var\(--\D{1,100}\)$/
923
+ ].some((regex) => regex.test(str));
924
+ }
925
+ const spacing = {
926
+ none: "0px",
927
+ xxs: "0.0625rem",
928
+ xs: "0.125rem",
929
+ sm: "0.25rem",
930
+ md: "0.5rem",
931
+ mdLg: "0.75rem",
932
+ lg: "1rem",
933
+ lgXl: "1.5rem",
934
+ xl: "2rem",
935
+ xlXXl: "3rem",
936
+ xxl: "4rem"
937
+ };
938
+ function fromEntries(entries) {
939
+ return entries.reduce((acc, [key, value]) => {
940
+ return __spreadProps(__spreadValues({}, acc), { [key]: value });
941
+ }, {});
942
+ }
943
+ const getSpacingValue = (spacingKey, theme) => {
944
+ var _a, _b;
945
+ const maybeSpaceingOrDefault = (_b = (_a = theme == null ? void 0 : theme.space) != null ? _a : theme == null ? void 0 : theme.spacing) != null ? _b : spacing;
946
+ const safeSpacings = fromEntries(Object.entries(maybeSpaceingOrDefault).map(([spaceKey, value]) => [
947
+ spaceKey,
948
+ typeof value === "number" ? `${value}px` : value
949
+ ]));
950
+ const spacingVal = safeSpacings[spacingKey];
951
+ const isCSSLength = checkIsCSSLength(spacingVal);
952
+ return isCSSLength ? spacingVal : void 0;
953
+ };
954
+ const Stack = styled("div")`
955
+ @property --gutter {
956
+ syntax: "<length-percentage>";
957
+ inherits: false;
958
+ initial-value: 0;
959
+ }
960
+
961
+ --gutter: ${(props) => {
962
+ var _a;
963
+ return props.gutter ? (_a = getSpacingValue(props.gutter, props.theme)) != null ? _a : "0px" : "0px";
964
+ }};
965
+ box-sizing: border-box;
966
+ > * {
967
+ margin: 0;
968
+ }
969
+ display: flex;
970
+ flex-direction: column;
971
+
972
+ gap: var(--gutter, 0px);
973
+ align-content: start;
974
+
975
+ & > [data-bedrock-column] {
976
+ grid-column: span 1 / auto;
977
+ }
978
+ `;
979
+ const Grid = styled("div")`
980
+ @property --gutter {
981
+ syntax: "<length-percentage>";
982
+ inherits: false;
983
+ initial-value: 0;
984
+ }
985
+
986
+ @property --minItemWidth {
987
+ syntax: "<length-percentage>";
988
+ inherits: false;
989
+ initial-value: 639px;
990
+ }
991
+
992
+ --gutter: ${(props) => {
993
+ var _a;
994
+ return props.gutter ? (_a = getSpacingValue(props.gutter, props.theme)) != null ? _a : "0px" : "0px";
995
+ }};
996
+ --minItemWidth: ${(props) => {
997
+ var _a;
998
+ return typeof props.minItemWidth === "string" ? props.minItemWidth : `${(_a = props.minItemWidth) != null ? _a : 0}px`;
999
+ }};
1000
+
1001
+ box-sizing: border-box;
1002
+ > * {
1003
+ margin: 0;
1004
+ }
1005
+
1006
+ display: grid;
1007
+ gap: var(--gutter, 0px);
1008
+
1009
+ grid-template-columns: repeat(
1010
+ auto-fit,
1011
+ minmax(min(var(--minItemWidth, 639px), 100%), 1fr)
1012
+ );
1013
+ `;
1014
+ function getSafeMaxWidth(maxWidth) {
1015
+ if (maxWidth === void 0)
1016
+ return "100%";
1017
+ if (typeof maxWidth === "number")
1018
+ return `${maxWidth}px`;
1019
+ return maxWidth;
1020
+ }
1021
+ const Center = styled("div")`
1022
+ @property --maxWidth {
1023
+ syntax: "<length-percentage>";
1024
+ inherits: false;
1025
+ initial-value: 100%;
1026
+ }
1027
+
1028
+ --maxWidth: ${(props) => getSafeMaxWidth(props.maxWidth)};
1029
+
1030
+ box-sizing: content-box;
1031
+
1032
+ margin-inline-start: auto;
1033
+ margin-inline-end: auto;
1034
+ margin-inline: auto;
1035
+
1036
+ max-inline-size: var(--maxWidth, 100%);
1037
+
1038
+ ${(props) => props.centerChildren ? u`
1039
+ display: flex;
1040
+ flex-direction: column;
1041
+ align-items: center;
1042
+ ` : ""}
1043
+
1044
+ ${(props) => props.centerText ? u`
1045
+ text-align: center;
1046
+ ` : ""}
1047
+ `;
1048
+ function getSafeBasis(basis) {
1049
+ if (basis === void 0)
1050
+ return "100%";
1051
+ if (typeof basis === "number")
1052
+ return `${basis}px`;
1053
+ return basis;
1054
+ }
1055
+ const ColumnDrop = styled("div")`
1056
+ @property --basis {
1057
+ syntax: "<length-percentage>";
1058
+ inherits: true;
1059
+ initial-value: 100%;
1060
+ }
1061
+
1062
+ @property --gutter {
1063
+ syntax: "<length-percentage>";
1064
+ inherits: false;
1065
+ initial-value: 0px;
1066
+ }
1067
+
1068
+ --basis: ${(props) => getSafeBasis(props.basis)};
1069
+ --gutter: ${(props) => {
1070
+ var _a;
1071
+ return props.gutter ? (_a = getSpacingValue(props.gutter, props.theme)) != null ? _a : "0px" : "0px";
1072
+ }};
1073
+
1074
+ box-sizing: border-box;
1075
+ > * {
1076
+ margin: 0;
1077
+ flex-basis: var(--basis, 100%);
1078
+ flex-grow: ${(props) => props.noStretchedColumns ? "0" : "1"};
1079
+ flex-shrink: 1;
1080
+ }
1081
+
1082
+ display: flex;
1083
+ flex-wrap: wrap;
1084
+ gap: var(--gutter, 0px);
1085
+ `;
1086
+ function checkIsRatio(ratio) {
1087
+ const isCorrectArray = Array.isArray(ratio) && ratio.length === 2 && ratio.every(Number.isFinite);
1088
+ return isCorrectArray || typeof ratio === "string" && /^\d{1,1000}\/\d{1,1000}$/.test(ratio);
1089
+ }
1090
+ function getRatioString(ratio) {
1091
+ return Array.isArray(ratio) ? ratio.join("/") : ratio;
1092
+ }
1093
+ function getSafeRatio(ratio) {
1094
+ const isRatio = checkIsRatio(ratio);
1095
+ return isRatio ? getRatioString(ratio) : void 0;
1096
+ }
1097
+ const Frame = styled.div`
1098
+ box-sizing: border-box;
1099
+ display: block;
1100
+ inline-size: 100%;
1101
+ position: relative;
1102
+ overflow: hidden;
1103
+
1104
+ ${(props) => {
1105
+ const maybeRatio = getSafeRatio(props.ratio);
1106
+ if (maybeRatio) {
1107
+ return u`
1108
+ aspect-ratio: ${maybeRatio};
1109
+ `;
1110
+ }
1111
+ return "";
1112
+ }};
1113
+
1114
+ > * {
1115
+ position: absolute;
1116
+
1117
+ inset-block-start: 0;
1118
+ inset-block-end: 0;
1119
+ inset-inline-start: 0;
1120
+ inset-inline-end: 0;
1121
+
1122
+ inset-block: 0;
1123
+ inset-inline: 0;
1124
+
1125
+ display: flex;
1126
+ justify-content: center;
1127
+ align-items: center;
1128
+ }
1129
+
1130
+ > :is(img, video) {
1131
+ inline-size: 100%;
1132
+ block-size: 100%;
1133
+ size: 100%;
1134
+
1135
+ object-fit: cover;
1136
+ object-position: ${(props) => typeof props.position === "string" ? props.position : "50%"};
1137
+ }
1138
+ `;
1139
+ export { Center, ColumnDrop, Frame, Grid, Stack, checkIsCSSLength, getSpacingValue, spacing };