@bedrock-layout/solid 0.12.1 → 1.1.2

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,61 +1,17 @@
1
- import { splitProps, createMemo, sharedConfig, untrack, createRenderEffect, createComponent, mergeProps, createContext, useContext, createSignal, onMount, createEffect, onCleanup, children, Switch, Match } from "solid-js";
2
- import { init, registerCallback } from "@bedrock-layout/register-resize-callback";
3
- function checkIsCSSLength(str) {
4
- if (typeof str !== "string")
5
- return false;
6
- return [
7
- /^[0-9]{0,10000}\.?[0-9]{1,10000}(vmin|vmax|vh|vw|%|ch|ex|em|rem|in|cm|mm|pt|pc|px)$/,
8
- /^var\(--\D{1,100}\)$/
9
- ].some((regex) => regex.test(str));
10
- }
11
- const spacing = {
12
- none: "0px",
13
- xxs: "0.0625rem",
14
- xs: "0.125rem",
15
- sm: "0.25rem",
16
- md: "0.5rem",
17
- mdLg: "0.75rem",
18
- lg: "1rem",
19
- lgXl: "1.5rem",
20
- xl: "2rem",
21
- xlXXl: "3rem",
22
- xxl: "4rem"
23
- };
24
- function fromEntries(entries) {
25
- return entries.reduce((acc, [key, value]) => {
26
- return { ...acc, [key]: value };
27
- }, {});
28
- }
29
- const getSpacingValue = (spacingKey, theme) => {
30
- var _a, _b;
31
- const maybeSpaceingOrDefault = (_b = (_a = theme == null ? void 0 : theme.space) != null ? _a : theme == null ? void 0 : theme.spacing) != null ? _b : spacing;
32
- const safeSpacings = fromEntries(
33
- Object.entries(maybeSpaceingOrDefault).map(([spaceKey, value]) => [
34
- spaceKey,
35
- typeof value === "number" ? `${value}px` : value
36
- ])
37
- );
38
- const spacingVal = safeSpacings[spacingKey];
39
- const isCSSLength = checkIsCSSLength(spacingVal);
40
- return isCSSLength ? spacingVal : void 0;
41
- };
42
- 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"];
43
- const Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
44
- const ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
45
- const Aliases = {
1
+ import re from "open-props";
2
+ import { createRenderEffect as S, sharedConfig as d, splitProps as V, createMemo as I, untrack as X, createComponent as E, mergeProps as u, createContext as ce, useContext as le, createSignal as z, onMount as q, createEffect as U, onCleanup as Q, children as fe } from "solid-js";
3
+ import { init as J, registerCallback as Y } from "@bedrock-layout/register-resize-callback";
4
+ const ae = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"], ue = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...ae]), de = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]), ye = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
46
5
  className: "class",
47
6
  htmlFor: "for"
48
- };
49
- const PropAliases = {
7
+ }), B = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
50
8
  class: "className",
51
9
  formnovalidate: "formNoValidate",
52
10
  ismap: "isMap",
53
11
  nomodule: "noModule",
54
12
  playsinline: "playsInline",
55
13
  readonly: "readOnly"
56
- };
57
- const DelegatedEvents = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
58
- const SVGElements = /* @__PURE__ */ new Set([
14
+ }), me = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]), he = /* @__PURE__ */ new Set([
59
15
  "altGlyph",
60
16
  "altGlyphDef",
61
17
  "altGlyphItem",
@@ -132,1216 +88,805 @@ const SVGElements = /* @__PURE__ */ new Set([
132
88
  "use",
133
89
  "view",
134
90
  "vkern"
135
- ]);
136
- const SVGNamespace = {
91
+ ]), ge = {
137
92
  xlink: "http://www.w3.org/1999/xlink",
138
93
  xml: "http://www.w3.org/XML/1998/namespace"
139
94
  };
140
- function reconcileArrays(parentNode, a, b) {
141
- let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
142
- while (aStart < aEnd || bStart < bEnd) {
143
- if (a[aStart] === b[bStart]) {
144
- aStart++;
145
- bStart++;
95
+ function be(e, t, n) {
96
+ let i = n.length, s = t.length, r = i, c = 0, o = 0, l = t[s - 1].nextSibling, f = null;
97
+ for (; c < s || o < r; ) {
98
+ if (t[c] === n[o]) {
99
+ c++, o++;
146
100
  continue;
147
101
  }
148
- while (a[aEnd - 1] === b[bEnd - 1]) {
149
- aEnd--;
150
- bEnd--;
151
- }
152
- if (aEnd === aStart) {
153
- const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
154
- while (bStart < bEnd)
155
- parentNode.insertBefore(b[bStart++], node);
156
- } else if (bEnd === bStart) {
157
- while (aStart < aEnd) {
158
- if (!map || !map.has(a[aStart]))
159
- a[aStart].remove();
160
- aStart++;
161
- }
162
- } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
163
- const node = a[--aEnd].nextSibling;
164
- parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
165
- parentNode.insertBefore(b[--bEnd], node);
166
- a[aEnd] = b[bEnd];
102
+ for (; t[s - 1] === n[r - 1]; )
103
+ s--, r--;
104
+ if (s === c) {
105
+ const a = r < i ? o ? n[o - 1].nextSibling : n[r - o] : l;
106
+ for (; o < r; )
107
+ e.insertBefore(n[o++], a);
108
+ } else if (r === o)
109
+ for (; c < s; )
110
+ (!f || !f.has(t[c])) && t[c].remove(), c++;
111
+ else if (t[c] === n[r - 1] && n[o] === t[s - 1]) {
112
+ const a = t[--s].nextSibling;
113
+ e.insertBefore(n[o++], t[c++].nextSibling), e.insertBefore(n[--r], a), t[s] = n[r];
167
114
  } else {
168
- if (!map) {
169
- map = /* @__PURE__ */ new Map();
170
- let i = bStart;
171
- while (i < bEnd)
172
- map.set(b[i], i++);
115
+ if (!f) {
116
+ f = /* @__PURE__ */ new Map();
117
+ let y = o;
118
+ for (; y < r; )
119
+ f.set(n[y], y++);
173
120
  }
174
- const index = map.get(a[aStart]);
175
- if (index != null) {
176
- if (bStart < index && index < bEnd) {
177
- let i = aStart, sequence = 1, t;
178
- while (++i < aEnd && i < bEnd) {
179
- if ((t = map.get(a[i])) == null || t !== index + sequence)
180
- break;
181
- sequence++;
182
- }
183
- if (sequence > index - bStart) {
184
- const node = a[aStart];
185
- while (bStart < index)
186
- parentNode.insertBefore(b[bStart++], node);
121
+ const a = f.get(t[c]);
122
+ if (a != null)
123
+ if (o < a && a < r) {
124
+ let y = c, x = 1, A;
125
+ for (; ++y < s && y < r && !((A = f.get(t[y])) == null || A !== a + x); )
126
+ x++;
127
+ if (x > a - o) {
128
+ const P = t[c];
129
+ for (; o < a; )
130
+ e.insertBefore(n[o++], P);
187
131
  } else
188
- parentNode.replaceChild(b[bStart++], a[aStart++]);
132
+ e.replaceChild(n[o++], t[c++]);
189
133
  } else
190
- aStart++;
191
- } else
192
- a[aStart++].remove();
134
+ c++;
135
+ else
136
+ t[c++].remove();
193
137
  }
194
138
  }
195
139
  }
196
- const $$EVENTS = "_$DX_DELEGATE";
197
- function delegateEvents(eventNames, document2 = window.document) {
198
- const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
199
- for (let i = 0, l = eventNames.length; i < l; i++) {
200
- const name = eventNames[i];
201
- if (!e.has(name)) {
202
- e.add(name);
203
- document2.addEventListener(name, eventHandler);
204
- }
140
+ const D = "_$DX_DELEGATE";
141
+ function Z(e, t, n) {
142
+ const i = document.createElement("template");
143
+ i.innerHTML = e;
144
+ let s = i.content.firstChild;
145
+ return n && (s = s.firstChild), s;
146
+ }
147
+ function $e(e, t = window.document) {
148
+ const n = t[D] || (t[D] = /* @__PURE__ */ new Set());
149
+ for (let i = 0, s = e.length; i < s; i++) {
150
+ const r = e[i];
151
+ n.has(r) || (n.add(r), t.addEventListener(r, Me));
205
152
  }
206
153
  }
207
- function setAttribute(node, name, value) {
208
- if (value == null)
209
- node.removeAttribute(name);
210
- else
211
- node.setAttribute(name, value);
212
- }
213
- function setAttributeNS(node, namespace, name, value) {
214
- if (value == null)
215
- node.removeAttributeNS(namespace, name);
216
- else
217
- node.setAttributeNS(namespace, name, value);
218
- }
219
- function className(node, value) {
220
- if (value == null)
221
- node.removeAttribute("class");
222
- else
223
- node.className = value;
224
- }
225
- function addEventListener(node, name, handler, delegate) {
226
- if (delegate) {
227
- if (Array.isArray(handler)) {
228
- node[`$$${name}`] = handler[0];
229
- node[`$$${name}Data`] = handler[1];
230
- } else
231
- node[`$$${name}`] = handler;
232
- } else if (Array.isArray(handler)) {
233
- const handlerFn = handler[0];
234
- node.addEventListener(name, handler[0] = (e) => handlerFn.call(node, handler[1], e));
154
+ function K(e, t, n) {
155
+ n == null ? e.removeAttribute(t) : e.setAttribute(t, n);
156
+ }
157
+ function xe(e, t, n, i) {
158
+ i == null ? e.removeAttributeNS(t, n) : e.setAttributeNS(t, n, i);
159
+ }
160
+ function Se(e, t) {
161
+ t == null ? e.removeAttribute("class") : e.className = t;
162
+ }
163
+ function Ae(e, t, n, i) {
164
+ if (i)
165
+ Array.isArray(n) ? (e[`$$${t}`] = n[0], e[`$$${t}Data`] = n[1]) : e[`$$${t}`] = n;
166
+ else if (Array.isArray(n)) {
167
+ const s = n[0];
168
+ e.addEventListener(t, n[0] = (r) => s.call(e, n[1], r));
235
169
  } else
236
- node.addEventListener(name, handler);
237
- }
238
- function classList(node, value, prev = {}) {
239
- const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
240
- let i, len;
241
- for (i = 0, len = prevKeys.length; i < len; i++) {
242
- const key = prevKeys[i];
243
- if (!key || key === "undefined" || value[key])
244
- continue;
245
- toggleClassKey(node, key, false);
246
- delete prev[key];
170
+ e.addEventListener(t, n);
171
+ }
172
+ function we(e, t, n = {}) {
173
+ const i = Object.keys(t || {}), s = Object.keys(n);
174
+ let r, c;
175
+ for (r = 0, c = s.length; r < c; r++) {
176
+ const o = s[r];
177
+ !o || o === "undefined" || t[o] || (R(e, o, !1), delete n[o]);
247
178
  }
248
- for (i = 0, len = classKeys.length; i < len; i++) {
249
- const key = classKeys[i], classValue = !!value[key];
250
- if (!key || key === "undefined" || prev[key] === classValue || !classValue)
251
- continue;
252
- toggleClassKey(node, key, true);
253
- prev[key] = classValue;
179
+ for (r = 0, c = i.length; r < c; r++) {
180
+ const o = i[r], l = !!t[o];
181
+ !o || o === "undefined" || n[o] === l || !l || (R(e, o, !0), n[o] = l);
254
182
  }
255
- return prev;
256
- }
257
- function style(node, value, prev = {}) {
258
- const nodeStyle = node.style;
259
- const prevString = typeof prev === "string";
260
- if (value == null && prevString || typeof value === "string")
261
- return nodeStyle.cssText = value;
262
- prevString && (nodeStyle.cssText = void 0, prev = {});
263
- value || (value = {});
264
- let v, s;
265
- for (s in prev) {
266
- value[s] == null && nodeStyle.removeProperty(s);
267
- delete prev[s];
268
- }
269
- for (s in value) {
270
- v = value[s];
271
- if (v !== prev[s]) {
272
- nodeStyle.setProperty(s, v);
273
- prev[s] = v;
274
- }
275
- }
276
- return prev;
277
- }
278
- function spread(node, accessor, isSVG, skipChildren) {
279
- if (typeof accessor === "function") {
280
- createRenderEffect((current) => spreadExpression(node, accessor(), current, isSVG, skipChildren));
281
- } else
282
- spreadExpression(node, accessor, void 0, isSVG, skipChildren);
283
- }
284
- function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
285
- props || (props = {});
286
- for (const prop in prevProps) {
287
- if (!(prop in props)) {
288
- if (prop === "children")
183
+ return n;
184
+ }
185
+ function p(e, t, n) {
186
+ if (!t)
187
+ return n ? K(e, "style") : t;
188
+ const i = e.style;
189
+ if (typeof t == "string")
190
+ return i.cssText = t;
191
+ typeof n == "string" && (i.cssText = n = void 0), n || (n = {}), t || (t = {});
192
+ let s, r;
193
+ for (r in n)
194
+ t[r] == null && i.removeProperty(r), delete n[r];
195
+ for (r in t)
196
+ s = t[r], s !== n[r] && (i.setProperty(r, s), n[r] = s);
197
+ return n;
198
+ }
199
+ function je(e, t = {}, n, i) {
200
+ const s = {};
201
+ return i || S(() => s.children = j(e, t.children, s.children)), S(() => t.ref && t.ref(e)), S(() => Ee(e, t, n, !0, s, !0)), s;
202
+ }
203
+ function Ce(e, t, n) {
204
+ return X(() => e(t, n));
205
+ }
206
+ function ee(e, t, n, i) {
207
+ if (n !== void 0 && !i && (i = []), typeof t != "function")
208
+ return j(e, t, i, n);
209
+ S((s) => j(e, t(), s, n), i);
210
+ }
211
+ function Ee(e, t, n, i, s = {}, r = !1) {
212
+ t || (t = {});
213
+ for (const c in s)
214
+ if (!(c in t)) {
215
+ if (c === "children")
289
216
  continue;
290
- assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
217
+ s[c] = G(e, c, null, s[c], n, r);
291
218
  }
292
- }
293
- for (const prop in props) {
294
- if (prop === "children") {
295
- if (!skipChildren)
296
- insertExpression(node, props.children);
219
+ for (const c in t) {
220
+ if (c === "children") {
221
+ i || j(e, t.children);
297
222
  continue;
298
223
  }
299
- const value = props[prop];
300
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
224
+ const o = t[c];
225
+ s[c] = G(e, c, o, s[c], n, r);
301
226
  }
302
227
  }
303
- function getNextElement(template) {
304
- let node, key;
305
- if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
306
- return template.cloneNode(true);
307
- }
308
- if (sharedConfig.completed)
309
- sharedConfig.completed.add(node);
310
- sharedConfig.registry.delete(key);
311
- return node;
312
- }
313
- function toPropertyName(name) {
314
- return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
315
- }
316
- function toggleClassKey(node, key, value) {
317
- const classNames = key.trim().split(/\s+/);
318
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
319
- node.classList.toggle(classNames[i], value);
320
- }
321
- function assignProp(node, prop, value, prev, isSVG, skipRef) {
322
- let isCE, isProp, isChildProp;
323
- if (prop === "style")
324
- return style(node, value, prev);
325
- if (prop === "classList")
326
- return classList(node, value, prev);
327
- if (value === prev)
328
- return prev;
329
- if (prop === "ref") {
330
- if (!skipRef) {
331
- value(node);
228
+ function Ie(e) {
229
+ let t, n;
230
+ return !d.context || !(t = d.registry.get(n = Oe())) ? e.cloneNode(!0) : (d.completed && d.completed.add(t), d.registry.delete(n), t);
231
+ }
232
+ function ze(e) {
233
+ return e.toLowerCase().replace(/-([a-z])/g, (t, n) => n.toUpperCase());
234
+ }
235
+ function R(e, t, n) {
236
+ const i = t.trim().split(/\s+/);
237
+ for (let s = 0, r = i.length; s < r; s++)
238
+ e.classList.toggle(i[s], n);
239
+ }
240
+ function G(e, t, n, i, s, r) {
241
+ let c, o, l;
242
+ if (t === "style")
243
+ return p(e, n, i);
244
+ if (t === "classList")
245
+ return we(e, n, i);
246
+ if (n === i)
247
+ return i;
248
+ if (t === "ref")
249
+ r || n(e);
250
+ else if (t.slice(0, 3) === "on:") {
251
+ const f = t.slice(3);
252
+ i && e.removeEventListener(f, i), n && e.addEventListener(f, n);
253
+ } else if (t.slice(0, 10) === "oncapture:") {
254
+ const f = t.slice(10);
255
+ i && e.removeEventListener(f, i, !0), n && e.addEventListener(f, n, !0);
256
+ } else if (t.slice(0, 2) === "on") {
257
+ const f = t.slice(2).toLowerCase(), a = me.has(f);
258
+ if (!a && i) {
259
+ const y = Array.isArray(i) ? i[0] : i;
260
+ e.removeEventListener(f, y);
332
261
  }
333
- } else if (prop.slice(0, 3) === "on:") {
334
- const e = prop.slice(3);
335
- prev && node.removeEventListener(e, prev);
336
- value && node.addEventListener(e, value);
337
- } else if (prop.slice(0, 10) === "oncapture:") {
338
- const e = prop.slice(10);
339
- prev && node.removeEventListener(e, prev, true);
340
- value && node.addEventListener(e, value, true);
341
- } else if (prop.slice(0, 2) === "on") {
342
- const name = prop.slice(2).toLowerCase();
343
- const delegate = DelegatedEvents.has(name);
344
- if (!delegate && prev) {
345
- const h = Array.isArray(prev) ? prev[0] : prev;
346
- node.removeEventListener(name, h);
347
- }
348
- if (delegate || value) {
349
- addEventListener(node, name, value, delegate);
350
- delegate && delegateEvents([name]);
351
- }
352
- } else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
353
- if (prop === "class" || prop === "className")
354
- className(node, value);
355
- else if (isCE && !isProp && !isChildProp)
356
- node[toPropertyName(prop)] = value;
357
- else
358
- node[PropAliases[prop] || prop] = value;
359
- } else {
360
- const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
361
- if (ns)
362
- setAttributeNS(node, ns, prop, value);
363
- else
364
- setAttribute(node, Aliases[prop] || prop, value);
262
+ (a || n) && (Ae(e, f, n, a), a && $e([f]));
263
+ } else if ((l = de.has(t)) || !s && (B[t] || (o = ue.has(t))) || (c = e.nodeName.includes("-")))
264
+ t === "class" || t === "className" ? Se(e, n) : c && !o && !l ? e[ze(t)] = n : e[B[t] || t] = n;
265
+ else {
266
+ const f = s && t.indexOf(":") > -1 && ge[t.split(":")[0]];
267
+ f ? xe(e, f, t, n) : K(e, ye[t] || t, n);
365
268
  }
366
- return value;
367
- }
368
- function eventHandler(e) {
369
- const key = `$$${e.type}`;
370
- let node = e.composedPath && e.composedPath()[0] || e.target;
371
- if (e.target !== node) {
372
- Object.defineProperty(e, "target", {
373
- configurable: true,
374
- value: node
375
- });
376
- }
377
- Object.defineProperty(e, "currentTarget", {
378
- configurable: true,
269
+ return n;
270
+ }
271
+ function Me(e) {
272
+ const t = `$$${e.type}`;
273
+ let n = e.composedPath && e.composedPath()[0] || e.target;
274
+ for (e.target !== n && Object.defineProperty(e, "target", {
275
+ configurable: !0,
276
+ value: n
277
+ }), Object.defineProperty(e, "currentTarget", {
278
+ configurable: !0,
379
279
  get() {
380
- return node || document;
280
+ return n || document;
381
281
  }
382
- });
383
- if (sharedConfig.registry && !sharedConfig.done) {
384
- sharedConfig.done = true;
385
- document.querySelectorAll("[id^=pl-]").forEach((elem) => elem.remove());
386
- }
387
- while (node !== null) {
388
- const handler = node[key];
389
- if (handler && !node.disabled) {
390
- const data = node[`${key}Data`];
391
- data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
392
- if (e.cancelBubble)
282
+ }), d.registry && !d.done && (d.done = !0, document.querySelectorAll("[id^=pl-]").forEach((i) => {
283
+ for (; i && i.nodeType !== 8 && i.nodeValue !== "pl-" + e; ) {
284
+ let s = i.nextSibling;
285
+ i.remove(), i = s;
286
+ }
287
+ i && i.remove();
288
+ })); n; ) {
289
+ const i = n[t];
290
+ if (i && !n.disabled) {
291
+ const s = n[`${t}Data`];
292
+ if (s !== void 0 ? i.call(n, s, e) : i.call(n, e), e.cancelBubble)
393
293
  return;
394
294
  }
395
- node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
295
+ n = n._$host || n.parentNode || n.host;
396
296
  }
397
297
  }
398
- function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
399
- props || (props = {});
400
- if (!skipChildren && "children" in props) {
401
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
402
- }
403
- props.ref && props.ref(node);
404
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
405
- return prevProps;
406
- }
407
- function insertExpression(parent, value, current, marker, unwrapArray) {
408
- if (sharedConfig.context && !current)
409
- current = [...parent.childNodes];
410
- while (typeof current === "function")
411
- current = current();
412
- if (value === current)
413
- return current;
414
- const t = typeof value, multi = marker !== void 0;
415
- parent = multi && current[0] && current[0].parentNode || parent;
416
- if (t === "string" || t === "number") {
417
- if (sharedConfig.context)
418
- return current;
419
- if (t === "number")
420
- value = value.toString();
421
- if (multi) {
422
- let node = current[0];
423
- if (node && node.nodeType === 3) {
424
- node.data = value;
425
- } else
426
- node = document.createTextNode(value);
427
- current = cleanChildren(parent, current, marker, node);
428
- } else {
429
- if (current !== "" && typeof current === "string") {
430
- current = parent.firstChild.data = value;
431
- } else
432
- current = parent.textContent = value;
433
- }
434
- } else if (value == null || t === "boolean") {
435
- if (sharedConfig.context)
436
- return current;
437
- current = cleanChildren(parent, current, marker);
438
- } else if (t === "function") {
439
- createRenderEffect(() => {
440
- let v = value();
441
- while (typeof v === "function")
442
- v = v();
443
- current = insertExpression(parent, v, current, marker);
444
- });
445
- return () => current;
446
- } else if (Array.isArray(value)) {
447
- const array = [];
448
- const currentArray = current && Array.isArray(current);
449
- if (normalizeIncomingArray(array, value, current, unwrapArray)) {
450
- createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
451
- return () => current;
452
- }
453
- if (sharedConfig.context) {
454
- if (!array.length)
455
- return current;
456
- for (let i = 0; i < array.length; i++) {
457
- if (array[i].parentNode)
458
- return current = array;
459
- }
460
- }
461
- if (array.length === 0) {
462
- current = cleanChildren(parent, current, marker);
463
- if (multi)
464
- return current;
465
- } else if (currentArray) {
466
- if (current.length === 0) {
467
- appendNodes(parent, array, marker);
468
- } else
469
- reconcileArrays(parent, current, array);
470
- } else {
471
- current && cleanChildren(parent);
472
- appendNodes(parent, array);
473
- }
474
- current = array;
475
- } else if (value instanceof Node) {
476
- if (sharedConfig.context && value.parentNode)
477
- return current = multi ? [value] : value;
478
- if (Array.isArray(current)) {
479
- if (multi)
480
- return current = cleanChildren(parent, current, marker, value);
481
- cleanChildren(parent, current, null, value);
482
- } else if (current == null || current === "" || !parent.firstChild) {
483
- parent.appendChild(value);
298
+ function j(e, t, n, i, s) {
299
+ for (d.context && !n && (n = [...e.childNodes]); typeof n == "function"; )
300
+ n = n();
301
+ if (t === n)
302
+ return n;
303
+ const r = typeof t, c = i !== void 0;
304
+ if (e = c && n[0] && n[0].parentNode || e, r === "string" || r === "number") {
305
+ if (d.context)
306
+ return n;
307
+ if (r === "number" && (t = t.toString()), c) {
308
+ let o = n[0];
309
+ o && o.nodeType === 3 ? o.data = t : o = document.createTextNode(t), n = w(e, n, i, o);
484
310
  } else
485
- parent.replaceChild(value, parent.firstChild);
486
- current = value;
487
- } else
488
- ;
489
- return current;
490
- }
491
- function normalizeIncomingArray(normalized, array, current, unwrap) {
492
- let dynamic = false;
493
- for (let i = 0, len = array.length; i < len; i++) {
494
- let item = array[i], prev = current && current[i];
495
- if (item instanceof Node) {
496
- normalized.push(item);
497
- } else if (item == null || item === true || item === false)
498
- ;
499
- else if (Array.isArray(item)) {
500
- dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
501
- } else if (typeof item === "function") {
502
- if (unwrap) {
503
- while (typeof item === "function")
504
- item = item();
505
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
506
- } else {
507
- normalized.push(item);
508
- dynamic = true;
311
+ n !== "" && typeof n == "string" ? n = e.firstChild.data = t : n = e.textContent = t;
312
+ } else if (t == null || r === "boolean") {
313
+ if (d.context)
314
+ return n;
315
+ n = w(e, n, i);
316
+ } else {
317
+ if (r === "function")
318
+ return S(() => {
319
+ let o = t();
320
+ for (; typeof o == "function"; )
321
+ o = o();
322
+ n = j(e, o, n, i);
323
+ }), () => n;
324
+ if (Array.isArray(t)) {
325
+ const o = [], l = n && Array.isArray(n);
326
+ if (N(o, t, n, s))
327
+ return S(() => n = j(e, o, n, i, !0)), () => n;
328
+ if (d.context) {
329
+ if (!o.length)
330
+ return n;
331
+ for (let f = 0; f < o.length; f++)
332
+ if (o[f].parentNode)
333
+ return n = o;
509
334
  }
510
- } else {
511
- const value = String(item);
512
- if (prev && prev.nodeType === 3 && prev.data === value) {
513
- normalized.push(prev);
335
+ if (o.length === 0) {
336
+ if (n = w(e, n, i), c)
337
+ return n;
338
+ } else
339
+ l ? n.length === 0 ? H(e, o, i) : be(e, n, o) : (n && w(e), H(e, o));
340
+ n = o;
341
+ } else if (t instanceof Node) {
342
+ if (d.context && t.parentNode)
343
+ return n = c ? [t] : t;
344
+ if (Array.isArray(n)) {
345
+ if (c)
346
+ return n = w(e, n, i, t);
347
+ w(e, n, null, t);
514
348
  } else
515
- normalized.push(document.createTextNode(value));
349
+ n == null || n === "" || !e.firstChild ? e.appendChild(t) : e.replaceChild(t, e.firstChild);
350
+ n = t;
516
351
  }
517
352
  }
518
- return dynamic;
519
- }
520
- function appendNodes(parent, array, marker) {
521
- for (let i = 0, len = array.length; i < len; i++)
522
- parent.insertBefore(array[i], marker);
523
- }
524
- function cleanChildren(parent, current, marker, replacement) {
525
- if (marker === void 0)
526
- return parent.textContent = "";
527
- const node = replacement || document.createTextNode("");
528
- if (current.length) {
529
- let inserted = false;
530
- for (let i = current.length - 1; i >= 0; i--) {
531
- const el = current[i];
532
- if (node !== el) {
533
- const isParent = el.parentNode === parent;
534
- if (!inserted && !i)
535
- isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
536
- else
537
- isParent && el.remove();
353
+ return n;
354
+ }
355
+ function N(e, t, n, i) {
356
+ let s = !1;
357
+ for (let r = 0, c = t.length; r < c; r++) {
358
+ let o = t[r], l = n && n[r];
359
+ if (o instanceof Node)
360
+ e.push(o);
361
+ else if (!(o == null || o === !0 || o === !1))
362
+ if (Array.isArray(o))
363
+ s = N(e, o, l) || s;
364
+ else if (typeof o == "function")
365
+ if (i) {
366
+ for (; typeof o == "function"; )
367
+ o = o();
368
+ s = N(e, Array.isArray(o) ? o : [o], Array.isArray(l) ? l : [l]) || s;
369
+ } else
370
+ e.push(o), s = !0;
371
+ else {
372
+ const f = String(o);
373
+ l && l.nodeType === 3 && l.data === f ? e.push(l) : e.push(document.createTextNode(f));
374
+ }
375
+ }
376
+ return s;
377
+ }
378
+ function H(e, t, n = null) {
379
+ for (let i = 0, s = t.length; i < s; i++)
380
+ e.insertBefore(t[i], n);
381
+ }
382
+ function w(e, t, n, i) {
383
+ if (n === void 0)
384
+ return e.textContent = "";
385
+ const s = i || document.createTextNode("");
386
+ if (t.length) {
387
+ let r = !1;
388
+ for (let c = t.length - 1; c >= 0; c--) {
389
+ const o = t[c];
390
+ if (s !== o) {
391
+ const l = o.parentNode === e;
392
+ !r && !c ? l ? e.replaceChild(s, o) : e.insertBefore(s, n) : l && o.remove();
538
393
  } else
539
- inserted = true;
394
+ r = !0;
540
395
  }
541
396
  } else
542
- parent.insertBefore(node, marker);
543
- return [node];
544
- }
545
- function getHydrationKey() {
546
- const hydrate = sharedConfig.context;
547
- return `${hydrate.id}${hydrate.count++}`;
548
- }
549
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
550
- function createElement(tagName, isSVG = false) {
551
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
552
- }
553
- function Dynamic(props) {
554
- const [p, others] = splitProps(props, ["component"]);
555
- const cached = createMemo(() => p.component);
556
- return createMemo(() => {
557
- const component = cached();
558
- switch (typeof component) {
397
+ e.insertBefore(s, n);
398
+ return [s];
399
+ }
400
+ function Oe() {
401
+ const e = d.context;
402
+ return `${e.id}${e.count++}`;
403
+ }
404
+ const Pe = "http://www.w3.org/2000/svg";
405
+ function Te(e, t = !1) {
406
+ return t ? document.createElementNS(Pe, e) : document.createElement(e);
407
+ }
408
+ function ke(e) {
409
+ const [t, n] = V(e, ["component"]), i = I(() => t.component);
410
+ return I(() => {
411
+ const s = i();
412
+ switch (typeof s) {
559
413
  case "function":
560
- return untrack(() => component(others));
414
+ return X(() => s(n));
561
415
  case "string":
562
- const isSvg = SVGElements.has(component);
563
- const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
564
- spread(el, others, isSvg);
565
- return el;
416
+ const r = he.has(s), c = d.context ? Ie() : Te(s, r);
417
+ return je(c, n, r), c;
566
418
  }
567
419
  });
568
420
  }
569
- function convertToMaybe(value) {
570
- return value != null ? value : void 0;
571
- }
572
- function omitProps(value, keys) {
573
- return Object.keys(value).filter((k) => !keys.includes(k)).reduce((newObject, k) => {
574
- Object.defineProperty(newObject, k, {
575
- get() {
576
- return value[k];
577
- },
578
- configurable: true,
579
- enumerable: true
580
- });
581
- return newObject;
582
- }, {});
421
+ function M(e) {
422
+ return e ?? void 0;
583
423
  }
584
- function createDynamic(source, props) {
585
- return createComponent(
586
- Dynamic,
587
- mergeProps(
588
- {
589
- get component() {
590
- return source();
591
- }
592
- },
593
- props
594
- )
595
- );
424
+ function m(e, t) {
425
+ return Object.keys(e).filter((n) => !t.includes(n)).reduce((n, i) => (Object.defineProperty(n, i, {
426
+ get() {
427
+ return e[i];
428
+ },
429
+ configurable: !0,
430
+ enumerable: !0
431
+ }), n), {});
432
+ }
433
+ function h(e, t) {
434
+ return E(ke, u({
435
+ get component() {
436
+ return e();
437
+ }
438
+ }, t));
596
439
  }
597
- function createPropsFromAccessors(props) {
598
- if (!Object.values(props).every((x) => typeof x === "function"))
440
+ function g(e) {
441
+ if (!Object.values(e).every((t) => typeof t == "function"))
599
442
  throw new Error("Please provide an object with accessor values only.");
600
- return Object.keys(props).reduce((getterObj, key) => {
601
- const accessor = props[key];
602
- Object.defineProperty(getterObj, key, {
443
+ return Object.keys(e).reduce((t, n) => {
444
+ const i = e[n];
445
+ return Object.defineProperty(t, n, {
603
446
  get() {
604
- return accessor();
447
+ return i();
605
448
  },
606
- configurable: true,
607
- enumerable: true
608
- });
609
- return getterObj;
449
+ configurable: !0,
450
+ enumerable: !0
451
+ }), t;
610
452
  }, {});
611
453
  }
612
- function getSafeMaxWidth(maxWidth) {
613
- if (maxWidth === void 0)
614
- return "100%";
615
- if (typeof maxWidth === "number")
616
- return `${maxWidth}px`;
617
- return maxWidth;
618
- }
619
- function Center(props) {
620
- const propsStyle = () => {
621
- var _a;
622
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
623
- (str, [key, value]) => str + `${key}:${value};`,
624
- ""
625
- );
626
- };
627
- const maxWidth = () => `--maxWidth: ${getSafeMaxWidth(props.maxWidth)};`;
628
- const centerText = () => props.centerText ? "center-text" : "";
629
- const centerChildren = () => props.centerChildren ? "center-children" : "";
630
- const attrString = () => [centerText(), centerChildren()].filter(Boolean).join(" ");
631
- const style2 = () => [propsStyle(), maxWidth()].join("; ");
632
- return createDynamic(
633
- () => {
634
- var _a;
635
- return (_a = props.as) != null ? _a : "div";
636
- },
637
- mergeProps(
638
- omitProps(props, ["as", "maxWidth", "centerText", "centerChildren"]),
639
- createPropsFromAccessors({
640
- style: style2,
641
- "data-bedrock-center": attrString
642
- })
643
- )
644
- );
454
+ const te = /^--\D{1}.{0,100}$/;
455
+ function ne(e) {
456
+ return te.test(e);
457
+ }
458
+ function W(e) {
459
+ return typeof e != "string" ? !1 : [/^[0-9]{0,10000}\.?[0-9]{1,10000}(vmin|vmax|vh|vw|%|ch|ex|em|rem|in|cm|mm|pt|pc|px)$/, /^var\(--\D{1}.{0,100}\)$/, te].some((t) => t.test(e));
460
+ }
461
+ const {
462
+ sizeXxs: Ne,
463
+ sizeXs: Le,
464
+ sizeSm: We,
465
+ sizeMd: ve,
466
+ sizeLg: Be,
467
+ sizeXl: De,
468
+ sizeXxl: Re,
469
+ sizeContent1: Ge,
470
+ sizeContent2: He,
471
+ sizeContent3: _e,
472
+ sizeHeader1: Fe,
473
+ sizeHeader2: Ve,
474
+ sizeHeader3: Xe,
475
+ size000: qe,
476
+ size00: Ue,
477
+ size1: Qe,
478
+ size2: Je,
479
+ size3: Ye,
480
+ size4: Ze,
481
+ size5: Ke,
482
+ size6: pe,
483
+ size7: et,
484
+ size8: tt,
485
+ size9: nt,
486
+ size10: it,
487
+ size11: st,
488
+ size12: ot,
489
+ size13: rt,
490
+ size14: ct,
491
+ size15: lt
492
+ } = re, ft = {
493
+ size000: qe,
494
+ size00: Ue,
495
+ size1: Qe,
496
+ size2: Je,
497
+ size3: Ye,
498
+ size4: Ze,
499
+ size5: Ke,
500
+ size6: pe,
501
+ size7: et,
502
+ size8: tt,
503
+ size9: nt,
504
+ size10: it,
505
+ size11: st,
506
+ size12: ot,
507
+ size13: rt,
508
+ size14: ct,
509
+ size15: lt
510
+ }, at = {
511
+ sizeXxs: Ne,
512
+ sizeXs: Le,
513
+ sizeSm: We,
514
+ sizeMd: ve,
515
+ sizeLg: Be,
516
+ sizeXl: De,
517
+ sizeXxl: Re,
518
+ sizeContent1: Ge,
519
+ sizeContent2: He,
520
+ sizeContent3: _e,
521
+ sizeHeader1: Fe,
522
+ sizeHeader2: Ve,
523
+ sizeHeader3: Xe
524
+ }, ut = ft, dt = at;
525
+ function ie(e) {
526
+ return e.reduce((t, [n, i]) => ({
527
+ ...t,
528
+ [n]: i
529
+ }), {});
530
+ }
531
+ function _(e, t) {
532
+ if (t !== void 0)
533
+ return typeof t == "number" && t >= 0 ? `${t}px` : typeof t == "string" && W(t) ? ne(t) ? `var(${t})` : t : M(b(e, t));
534
+ }
535
+ function b(e, t) {
536
+ const n = e.space ?? ut, i = ie(Object.entries(n).map(([s, r]) => [s, typeof r == "number" ? `${r}px` : r]));
537
+ return M(i[t]);
538
+ }
539
+ function O(e, t) {
540
+ if (t === void 0)
541
+ return;
542
+ if (typeof t == "number" && t >= 0)
543
+ return `${t}px`;
544
+ if (typeof t == "string" && W(t))
545
+ return ne(t) ? `var(${t})` : t;
546
+ const n = e.sizes ?? dt, i = ie(Object.entries(n).map(([s, r]) => [s, typeof r == "number" ? `${r}px` : r]));
547
+ return M(i[t]);
548
+ }
549
+ function yt(e) {
550
+ return e === void 0 ? "100%" : typeof e == "number" ? `${e}px` : e;
551
+ }
552
+ function Bt(e) {
553
+ const t = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((o, [l, f]) => o + `${l}:${f};`, ""), n = () => `--maxWidth: ${yt(e.maxWidth)};`, i = () => e.centerText ? "center-text" : "", s = () => e.centerChildren ? "center-children" : "", r = () => [i(), s()].filter(Boolean).join(" "), c = () => [t(), n()].join("; ");
554
+ return h(() => e.as ?? "div", u(m(e, ["as", "maxWidth", "centerText", "centerChildren"]), g({
555
+ style: c,
556
+ "data-bedrock-center": r
557
+ })));
645
558
  }
646
- const ThemeContext = createContext({});
647
- function ThemeProvider(props) {
648
- return /* @__PURE__ */ React.createElement(ThemeContext.Provider, {
649
- value: props.theme
650
- }, props.children);
559
+ const se = ce({});
560
+ function Dt(e) {
561
+ return E(se.Provider, {
562
+ get value() {
563
+ return e.theme;
564
+ },
565
+ get children() {
566
+ return e.children;
567
+ }
568
+ });
651
569
  }
652
- function useTheme() {
570
+ function $() {
653
571
  try {
654
- return useContext(ThemeContext);
655
- } catch (e) {
572
+ return le(se);
573
+ } catch {
656
574
  return {};
657
575
  }
658
576
  }
659
- function getSafeMinItemWidth(minItemWidth) {
660
- if (minItemWidth === void 0)
661
- return "159px";
662
- if (typeof minItemWidth === "number")
663
- return `${minItemWidth}px`;
664
- return minItemWidth;
665
- }
666
- function ColumnDrop(props) {
667
- const theme = useTheme();
668
- const propsStyle = () => {
669
- var _a;
670
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
671
- (str, [key, value]) => str + `${key}:${value};`,
672
- ""
673
- );
674
- };
675
- const gutter = () => {
676
- var _a, _b;
677
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"}`;
678
- };
679
- const minItemWidth = () => `--minItemWidth: ${getSafeMinItemWidth(props.minItemWidth)}`;
680
- const noStretchedColumns = () => props.noStretchedColumns === true ? "no-stretched-columns" : "";
681
- const style2 = () => [propsStyle(), gutter(), minItemWidth()].join("; ");
682
- return createDynamic(
683
- () => {
684
- var _a;
685
- return (_a = props.as) != null ? _a : "div";
686
- },
687
- mergeProps(
688
- omitProps(props, ["as", "gutter", "minItemWidth", "noStretchedColumns"]),
689
- createPropsFromAccessors({
690
- style: style2,
691
- "data-bedrock-column-drop": noStretchedColumns
692
- })
693
- )
694
- );
577
+ function mt(e, t) {
578
+ return O(e, t);
695
579
  }
696
- function fail(msg) {
697
- throw new Error(msg);
580
+ function Rt(e) {
581
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((o, [l, f]) => o + `${l}:${f};`, ""), i = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"}`, s = () => `--minItemWidth: ${mt(t, e.minItemWidth)}`, r = () => e.noStretchedColumns === !0 ? "no-stretched-columns" : "", c = () => [n(), i(), s()].join("; ");
582
+ return h(() => e.as ?? "div", u(m(e, ["as", "gutter", "minItemWidth", "noStretchedColumns"]), g({
583
+ style: c,
584
+ "data-bedrock-column-drop": r
585
+ })));
698
586
  }
699
- function assertIsValidWidth(width) {
700
- if (typeof width !== "number" && !Array.isArray(width)) {
701
- fail("width must be a number or an array of two numbers");
702
- }
703
- if (Array().concat(width).some((w) => w < 0)) {
704
- fail("width value(s) must be 0 or greater");
705
- }
706
- const isInvalidArray = Array.isArray(width) && (width.length !== 2 || width[0] > width[1]);
707
- if (isInvalidArray) {
708
- fail(
709
- `The second width value, ${width[1]}, is not larger than ${width[0]}. Please provide a value greater than first width value`
710
- );
711
- }
587
+ function T(e) {
588
+ throw new Error(e);
712
589
  }
713
- function createContainerQuery(width, maybeRef) {
714
- assertIsValidWidth(width);
715
- const [matches, setMatch] = createSignal(false);
716
- const [node, nodeRef] = createSignal();
717
- onMount(() => {
718
- init();
719
- });
720
- createEffect(() => {
721
- if (node() === void 0 || node() === null)
590
+ function ht(e) {
591
+ typeof e != "number" && !Array.isArray(e) && T("width must be a number or an array of two numbers"), Array().concat(e).some((n) => n < 0) && T("width value(s) must be 0 or greater"), Array.isArray(e) && (e.length !== 2 || e[0] > e[1]) && T(`The second width value, ${e[1]}, is not larger than ${e[0]}. Please provide a value greater than first width value`);
592
+ }
593
+ function Gt(e, t) {
594
+ ht(e);
595
+ const [n, i] = z(!1), [s, r] = z();
596
+ return q(() => {
597
+ J();
598
+ }), U(() => {
599
+ if (s() === void 0 || s() === null)
722
600
  return;
723
- if (maybeRef) {
724
- maybeRef(node());
725
- }
726
- const cleanup = registerCallback(node(), (entry) => {
727
- var _a, _b;
728
- const nodeWidth = (_b = (_a = entry.borderBoxSize) == null ? void 0 : _a.inlineSize) != null ? _b : entry.contentRect.width;
729
- if (nodeWidth > 0) {
730
- const newMatch = Array.isArray(width) ? nodeWidth >= width[0] && nodeWidth <= width[1] : nodeWidth <= width;
731
- setMatch(newMatch);
601
+ t && t(s());
602
+ const c = Y(s(), (o) => {
603
+ var f;
604
+ const l = ((f = o.borderBoxSize) == null ? void 0 : f.inlineSize) ?? o.contentRect.width;
605
+ if (l > 0) {
606
+ const a = Array.isArray(e) ? l >= e[0] && l <= e[1] : l <= e;
607
+ i(a);
732
608
  }
733
609
  });
734
- onCleanup(cleanup);
735
- });
736
- return [matches, nodeRef];
737
- }
738
- function checkIsRatio(ratio) {
739
- const isCorrectArray = Array.isArray(ratio) && ratio.length === 2 && ratio.every(Number.isFinite);
740
- return isCorrectArray || typeof ratio === "string" && /^\d{1,1000} {0,1}\/ {0,1}\d{1,1000}$/.test(ratio);
741
- }
742
- function getRatioString(ratio) {
743
- return Array.isArray(ratio) ? ratio.join("/") : ratio;
744
- }
745
- function getSafeRatio(ratio) {
746
- const isRatio = checkIsRatio(ratio);
747
- return isRatio ? getRatioString(ratio) : void 0;
748
- }
749
- function Frame(props) {
750
- const propsStyle = () => {
751
- var _a;
752
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
753
- (str, [key, value]) => str + `${key}:${value};`,
754
- ""
755
- );
756
- };
757
- const maybeRatioAssesor = () => getSafeRatio(props.ratio);
758
- const ratio = () => maybeRatioAssesor() ? `--ratio: ${maybeRatioAssesor()}` : "";
759
- const position = () => typeof props.position === "string" ? `--position: ${props.position}` : "50%";
760
- const style2 = () => [propsStyle(), ratio(), position()].join("; ");
761
- return createDynamic(
762
- () => {
763
- var _a;
764
- return (_a = props.as) != null ? _a : "div";
765
- },
766
- mergeProps(
767
- omitProps(props, ["as", "ratio", "position"]),
768
- createPropsFromAccessors({
769
- style: style2,
770
- "data-bedrock-frame": () => ""
771
- })
772
- )
773
- );
610
+ Q(c);
611
+ }), [n, r];
774
612
  }
775
- function Grid(props) {
776
- const theme = useTheme();
777
- const propsStyle = () => {
778
- var _a;
779
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
780
- (str, [key, value]) => str + `${key}:${value};`,
781
- ""
782
- );
783
- };
784
- const gutter = () => {
785
- var _a, _b;
786
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"};`;
787
- };
788
- const minItemWidth = () => {
789
- var _a;
790
- return `--minItemWidth: ${typeof props.minItemWidth === "string" ? props.minItemWidth : `${(_a = props.minItemWidth) != null ? _a : 0}px`};`;
791
- };
792
- const style2 = () => [propsStyle(), gutter(), minItemWidth()].join("; ");
793
- return createDynamic(
794
- () => {
795
- var _a;
796
- return (_a = props.as) != null ? _a : "div";
797
- },
798
- mergeProps(
799
- omitProps(props, ["as", "gutter", "minItemWidth"]),
800
- createPropsFromAccessors({
801
- style: style2,
802
- "data-bedrock-grid": () => ""
803
- })
804
- )
805
- );
613
+ function gt(e) {
614
+ return Array.isArray(e) && e.length === 2 && e.every(Number.isFinite) || typeof e == "string" && /^\d{1,1000} {0,1}\/ {0,1}\d{1,1000}$/.test(e);
806
615
  }
807
- const PIXELS_PER_INCH = 96;
808
- function parseUnit(str) {
809
- var _a;
810
- str = String(str);
811
- const num = parseFloat(str);
812
- const [, unit] = (_a = str.match(/[\d.\-+]*\s*(.*)/)) != null ? _a : ["", ""];
813
- return [num, unit];
814
- }
815
- function toPX(str, element) {
816
- if (!str)
817
- return void 0;
818
- const elementOrBody = element != null ? element : document.body;
819
- const safeStr = (str != null ? str : "px").trim().toLowerCase();
820
- switch (safeStr) {
616
+ function bt(e) {
617
+ return Array.isArray(e) ? e.join("/") : e;
618
+ }
619
+ function $t(e) {
620
+ return gt(e) ? bt(e) : void 0;
621
+ }
622
+ function Ht(e) {
623
+ const t = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((c, [o, l]) => c + `${o}:${l};`, ""), n = () => $t(e.ratio), i = () => n() ? `--ratio: ${n()}` : "", s = () => typeof e.position == "string" ? `--position: ${e.position}` : "50%", r = () => [t(), i(), s()].join("; ");
624
+ return h(() => e.as ?? "div", u(m(e, ["as", "ratio", "position"]), g({
625
+ style: r,
626
+ "data-bedrock-frame": () => ""
627
+ })));
628
+ }
629
+ function xt(e) {
630
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((c, [o, l]) => c + `${o}:${l};`, ""), i = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"};`, s = () => `--minItemWidth: ${typeof e.minItemWidth == "string" ? e.minItemWidth : `${e.minItemWidth ?? 0}px`};`, r = () => [n(), i(), s()].join("; ");
631
+ return h(() => e.as ?? "div", u(m(e, ["as", "gutter", "minItemWidth"]), g({
632
+ style: r,
633
+ "data-bedrock-grid": () => ""
634
+ })));
635
+ }
636
+ const C = 96;
637
+ function oe(e) {
638
+ e = String(e);
639
+ const t = parseFloat(e), [, n] = e.match(/[\d.\-+]*\s*(.*)/) ?? ["", ""];
640
+ return [t, n];
641
+ }
642
+ function v(e, t) {
643
+ if (!e)
644
+ return;
645
+ const n = t ?? document.body, i = (e ?? "px").trim().toLowerCase();
646
+ switch (i) {
821
647
  case "vmin":
822
648
  case "vmax":
823
649
  case "vh":
824
650
  case "vw":
825
651
  case "%":
826
- return void 0;
652
+ return;
827
653
  case "ch":
828
654
  case "ex":
829
- return getSizeBrutal(safeStr, elementOrBody);
655
+ return St(i, n);
830
656
  case "em":
831
- return getPropertyInPX(elementOrBody, "font-size");
657
+ return L(n, "font-size");
832
658
  case "rem":
833
- return getPropertyInPX(document.body, "font-size");
659
+ return L(document.body, "font-size");
834
660
  case "in":
835
- return PIXELS_PER_INCH;
661
+ return C;
836
662
  case "cm":
837
- return PIXELS_PER_INCH / 2.54;
663
+ return C / 2.54;
838
664
  case "mm":
839
- return PIXELS_PER_INCH / 25.4;
665
+ return C / 25.4;
840
666
  case "pt":
841
- return PIXELS_PER_INCH / 72;
667
+ return C / 72;
842
668
  case "pc":
843
- return PIXELS_PER_INCH / 6;
669
+ return C / 6;
844
670
  case "px":
845
671
  return 1;
846
672
  default: {
847
- const [value, units] = parseUnit(safeStr);
848
- if (isNaN(value))
849
- return void 0;
850
- if (!units)
851
- return value;
852
- const px = toPX(units, element);
853
- return typeof px === "number" ? value * px : void 0;
673
+ const [s, r] = oe(i);
674
+ if (isNaN(s))
675
+ return;
676
+ if (!r)
677
+ return s;
678
+ const c = v(r, t);
679
+ return typeof c == "number" ? s * c : void 0;
854
680
  }
855
681
  }
856
682
  }
857
- function getPropertyInPX(element, prop) {
858
- var _a;
859
- const [value, units] = parseUnit(
860
- getComputedStyle(element).getPropertyValue(prop)
683
+ function L(e, t) {
684
+ const [n, i] = oe(
685
+ getComputedStyle(e).getPropertyValue(t)
861
686
  );
862
- return value * ((_a = toPX(units, element)) != null ? _a : 1);
863
- }
864
- function getSizeBrutal(unit, element) {
865
- const testDIV = document.createElement("div");
866
- testDIV.style["height"] = "128" + unit;
867
- element.appendChild(testDIV);
868
- const size = getPropertyInPX(testDIV, "height") / 128;
869
- element.removeChild(testDIV);
870
- return size;
871
- }
872
- const MIN_HEIGHT = 1;
873
- const isBrowser = typeof window === "object" && typeof document === "object" && document.nodeType === 9;
874
- const Resizer = (props) => {
875
- const [rowSpan, setRowSpan] = createSignal(1);
876
- const [node, nodeRef] = createSignal();
877
- const theme = useTheme();
878
- onMount(() => {
879
- init();
880
- });
881
- createEffect(() => {
882
- const ref = convertToMaybe(node());
883
- if (ref === void 0)
687
+ return n * (v(i, e) ?? 1);
688
+ }
689
+ function St(e, t) {
690
+ const n = document.createElement("div");
691
+ n.style.height = "128" + e, t.appendChild(n);
692
+ const i = L(n, "height") / 128;
693
+ return t.removeChild(n), i;
694
+ }
695
+ const At = /* @__PURE__ */ Z("<div></div>"), k = 1, wt = typeof window == "object" && typeof document == "object" && document.nodeType === 9, jt = (e) => {
696
+ const [t, n] = z(1), [i, s] = z(), r = $();
697
+ return q(() => {
698
+ J();
699
+ }), U(() => {
700
+ const c = M(i());
701
+ if (c === void 0)
884
702
  return;
885
- const cleanup = registerCallback(ref, ({ target }) => {
886
- var _a;
887
- setRowSpan(1);
888
- const gapString = props.gutter ? (_a = getSpacingValue(props.gutter, theme)) != null ? _a : "1px" : "1px";
889
- const maybeGap = isBrowser ? toPX(gapString, target) : void 0;
890
- const gap = Math.max(maybeGap != null ? maybeGap : MIN_HEIGHT, MIN_HEIGHT);
891
- const [child] = Array.from(target.children);
892
- const height = 1 + Math.min(target.scrollHeight, child.scrollHeight);
893
- const rowHeight = Math.max(Math.ceil(height / gap), MIN_HEIGHT);
894
- setRowSpan(rowHeight);
703
+ const o = Y(c, ({
704
+ target: l
705
+ }) => {
706
+ n(1);
707
+ const f = e.gutter ? b(r, e.gutter) ?? "1px" : "1px", a = wt ? v(f, l) : void 0, y = Math.max(a ?? k, k), [x] = Array.from(l.children), A = 1 + Math.min(l.scrollHeight, x.scrollHeight), P = Math.max(Math.ceil(A / y), k);
708
+ n(P);
895
709
  });
896
- onCleanup(cleanup);
897
- });
898
- return /* @__PURE__ */ React.createElement("div", {
899
- style: `grid-row: span ${rowSpan()};`,
900
- ref: nodeRef
901
- }, props.children);
902
- };
903
- const MasonryGrid = (props) => {
904
- const childrenMemo = children(() => props.children);
905
- const emptyResolvedChildren = [];
906
- const wrappedChildren = emptyResolvedChildren.concat(childrenMemo()).filter(Boolean).map((child) => /* @__PURE__ */ React.createElement(Resizer, {
907
- gutter: props.gutter
908
- }, child));
909
- return /* @__PURE__ */ React.createElement(Grid, {
910
- style: "grid-template-rows: 1px;",
911
- ...props
912
- }, wrappedChildren);
913
- };
914
- const justifyMap$1 = {
710
+ Q(o);
711
+ }), (() => {
712
+ const c = At.cloneNode(!0);
713
+ return Ce(s, c), ee(c, () => e.children), S((o) => p(c, `grid-row: span ${t()};`, o)), c;
714
+ })();
715
+ }, _t = (e) => {
716
+ const t = fe(() => e.children), i = [].concat(t()).filter(Boolean).map((s) => E(jt, {
717
+ get gutter() {
718
+ return e.gutter;
719
+ },
720
+ children: s
721
+ }));
722
+ return E(xt, u({
723
+ style: "grid-template-rows: 1px;"
724
+ }, e, {
725
+ children: i
726
+ }));
727
+ }, Ct = {
915
728
  start: "justify:start",
916
729
  end: "justify:end",
917
730
  center: "justify:center"
918
- };
919
- const alignMap$1 = {
731
+ }, Et = {
920
732
  start: "align:start",
921
733
  end: "align:end",
922
734
  center: "align:center",
923
735
  stretch: "align:stretch"
924
736
  };
925
- function InlineCluster(props) {
926
- const theme = useTheme();
927
- const propsStyle = () => {
928
- var _a;
929
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
930
- (str, [key, value]) => str + `${key}:${value};`,
931
- ""
932
- );
933
- };
934
- const gutter = () => {
935
- var _a, _b;
936
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"};`;
937
- };
938
- const justify = () => props.justify !== void 0 ? justifyMap$1[props.justify] : void 0;
939
- const align = () => props.align !== void 0 ? alignMap$1[props.align] : void 0;
940
- const style2 = () => [propsStyle(), gutter()].join("; ");
941
- const attrAssesor = () => [justify(), align()].filter(Boolean).join(" ");
942
- return createDynamic(
943
- () => {
944
- var _a;
945
- return (_a = props.as) != null ? _a : "div";
946
- },
947
- mergeProps(
948
- omitProps(props, ["as", "gutter", "justify", "align"]),
949
- createPropsFromAccessors({
950
- style: style2,
951
- "data-bedrock-inline-cluster": attrAssesor
952
- })
953
- )
954
- );
737
+ function Ft(e) {
738
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((l, [f, a]) => l + `${f}:${a};`, ""), i = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"};`, s = () => e.justify !== void 0 ? Ct[e.justify] : void 0, r = () => e.align !== void 0 ? Et[e.align] : void 0, c = () => [n(), i()].join("; "), o = () => [s(), r()].filter(Boolean).join(" ");
739
+ return h(() => e.as ?? "div", u(m(e, ["as", "gutter", "justify", "align"]), g({
740
+ style: c,
741
+ "data-bedrock-inline-cluster": o
742
+ })));
955
743
  }
956
- const justifyMap = {
744
+ const It = {
957
745
  start: "justify:start",
958
746
  end: "justify:end",
959
747
  center: "justify:center"
960
- };
961
- const alignMap = {
748
+ }, zt = {
962
749
  start: "align:start",
963
750
  end: "align:end",
964
751
  center: "align:center",
965
752
  stretch: "align:stretch"
966
753
  };
967
- function shouldUseSwitch(switchAt) {
968
- if (typeof switchAt === "number" && switchAt > -1) {
969
- return true;
970
- }
971
- if (typeof switchAt === "string" && typeof CSS !== void 0) {
972
- return CSS.supports(`height: ${switchAt}`);
973
- }
974
- return false;
975
- }
976
- function Inline(props) {
977
- const theme = useTheme();
978
- const propsStyle = () => {
979
- var _a;
980
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
981
- (str, [key, value]) => str + `${key}:${value};`,
982
- ""
983
- );
984
- };
985
- const gutter = () => {
986
- var _a, _b;
987
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"};`;
988
- };
989
- const minItemWidth = () => props.minItemWidth ? `--minItemWidth: ${typeof props.minItemWidth === "string" ? props.minItemWidth : `${props.minItemWidth}px`};` : void 0;
990
- const switchAt = () => shouldUseSwitch(props.switchAt) ? `--switchAt: ${typeof props.switchAt === "string" ? props.switchAt : `${props.switchAt}px`};` : void 0;
991
- const justify = () => props.justify !== void 0 ? justifyMap[props.justify] : void 0;
992
- const align = () => props.align !== void 0 ? alignMap[props.align] : void 0;
993
- const stretch = () => props.stretch ? `stretch:${props.stretch}` : void 0;
994
- const style2 = () => [propsStyle(), gutter(), switchAt(), minItemWidth()].join("; ");
995
- const attrAssesor = () => [justify(), align(), stretch()].filter(Boolean).join(" ");
996
- return createDynamic(
997
- () => {
998
- var _a;
999
- return (_a = props.as) != null ? _a : "div";
1000
- },
1001
- mergeProps(
1002
- omitProps(props, [
1003
- "as",
1004
- "gutter",
1005
- "justify",
1006
- "align",
1007
- "stretch",
1008
- "switchAt"
1009
- ]),
1010
- createPropsFromAccessors({
1011
- style: style2,
1012
- "data-bedrock-inline": attrAssesor
1013
- })
1014
- )
1015
- );
1016
- }
1017
- const validKeys = /* @__PURE__ */ new Set([
1018
- "left",
1019
- "right",
1020
- "top",
1021
- "bottom",
1022
- "inlineStart",
1023
- "inlineEnd",
1024
- "blockStart",
1025
- "blockEnd"
1026
- ]);
1027
- const keyToProperty = (key, val) => {
1028
- const modernMap = {
1029
- left: `padding-inline-start:${val};`,
1030
- right: `padding-inline-end:${val};`,
1031
- top: `padding-block-start:${val};`,
1032
- bottom: `padding-block-end:${val};`,
1033
- inlineStart: `padding-inline-start:${val};`,
1034
- inlineEnd: `padding-inline-end:${val};`,
1035
- blockStart: `padding-block-start:${val};`,
1036
- blockEnd: `padding-block-end:${val};`
1037
- };
1038
- return modernMap[key];
1039
- };
1040
- function paddingOrDefault(theme) {
1041
- return (key) => {
1042
- const maybePadding = getSpacingValue(key, theme);
1043
- return maybePadding != null ? maybePadding : "0px";
1044
- };
754
+ function Vt(e) {
755
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((y, [x, A]) => y + `${x}:${A};`, ""), i = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"};`, s = () => e.minItemWidth ? `--minItemWidth: ${typeof e.minItemWidth == "string" ? e.minItemWidth : `${e.minItemWidth}px`};` : void 0, r = () => e.switchAt ? `--switchAt: ${O(t, e.switchAt) ?? "0px"};` : "", c = () => e.justify !== void 0 ? It[e.justify] : void 0, o = () => e.align !== void 0 ? zt[e.align] : void 0, l = () => e.stretch ? `stretch:${e.stretch}` : void 0, f = () => [n(), i(), r(), s()].join("; "), a = () => [c(), o(), l()].filter(Boolean).join(" ");
756
+ return h(() => e.as ?? "div", u(m(e, ["as", "gutter", "justify", "align", "stretch", "switchAt"]), g({
757
+ style: f,
758
+ "data-bedrock-inline": a
759
+ })));
1045
760
  }
1046
- function paddingToString(theme, padding) {
1047
- var _a;
1048
- if (Array.isArray(padding) && padding.length > 4) {
761
+ const Mt = (e) => ({
762
+ left: "padding-inline-start",
763
+ right: "padding-inline-end",
764
+ top: "padding-block-start",
765
+ bottom: "padding-block-end",
766
+ inlineStart: "padding-inline-start",
767
+ inlineEnd: "padding-inline-end",
768
+ blockStart: "padding-block-start",
769
+ blockEnd: "padding-block-end"
770
+ })[e], Ot = (e, t) => {
771
+ if (!t)
772
+ return "";
773
+ if (Array.isArray(t) && t.length > 4)
1049
774
  throw new Error("padding arrays can only be 4 or less in length");
1050
- }
1051
- const validSpacings = new Set(Object.keys((_a = theme == null ? void 0 : theme.spacing) != null ? _a : spacing));
1052
- const isValidPadding = () => {
1053
- if (typeof padding === "string")
1054
- return true;
1055
- if (Array.isArray(padding)) {
1056
- return padding.every((val) => validSpacings.has(val));
1057
- }
1058
- return padding && Object.keys(padding).every((key) => validKeys.has(key)) && Object.values(padding).every((val) => validSpacings.has(val));
775
+ const n = typeof t == "object" && !Array.isArray(t) ? Object.entries(t).reduce((i, [s, r]) => ({
776
+ ...i,
777
+ [Mt(s)]: _(e, r) ?? "0px"
778
+ }), {}) : {
779
+ padding: Array.from(Array.isArray(t) ? t : [t]).map((i) => _(e, i) ?? "0px").join(" ")
1059
780
  };
1060
- if (!isValidPadding()) {
1061
- console.error("Invalid padding Type");
1062
- }
1063
- const getPadding = paddingOrDefault(theme);
1064
- return typeof padding === "object" && !Array.isArray(padding) ? Object.entries(padding).reduce(
1065
- (acc, [key, val]) => validKeys.has(key) ? acc + keyToProperty(key, getPadding(val)) : acc,
1066
- ""
1067
- ) : padding !== void 0 ? `padding: ${Array.from(Array.isArray(padding) ? padding : [padding]).map((pad) => getPadding(pad)).join(" ")};` : "";
1068
- }
1069
- function PadBox(props) {
1070
- const theme = useTheme();
1071
- const propsStyle = () => {
1072
- var _a;
1073
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
1074
- (str, [key, value]) => str + `${key}:${value};`,
1075
- ""
1076
- );
1077
- };
1078
- const padding = () => paddingToString(theme, props.padding);
1079
- const style2 = () => [propsStyle(), padding()].join("; ");
1080
- return createDynamic(
1081
- () => {
1082
- var _a;
1083
- return (_a = props.as) != null ? _a : "div";
1084
- },
1085
- mergeProps(
1086
- omitProps(props, ["as", "padding"]),
1087
- createPropsFromAccessors({
1088
- style: style2,
1089
- "data-bedrock-padbox": () => ""
1090
- })
1091
- )
1092
- );
781
+ return Object.entries(n).reduce((i, [s, r]) => i + `${s}:${r};`, "");
782
+ };
783
+ function Xt(e) {
784
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((r, [c, o]) => r + `${c}:${o};`, ""), i = () => Ot(t, e.padding), s = () => [n(), i()].join("; ");
785
+ return h(() => e.as ?? "div", u(m(e, ["as", "padding"]), g({
786
+ style: s,
787
+ "data-bedrock-padbox": () => ""
788
+ })));
1093
789
  }
1094
- function Reel(props) {
1095
- const theme = useTheme();
1096
- const propsStyle = () => {
1097
- var _a;
1098
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
1099
- (str, [key, value]) => str + `${key}:${value};`,
1100
- ""
1101
- );
1102
- };
1103
- const gutter = () => {
1104
- var _a, _b;
1105
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"};`;
1106
- };
1107
- const snapType = () => {
1108
- switch (props.snapType) {
1109
- case "none": {
790
+ function qt(e) {
791
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((c, [o, l]) => c + `${o}:${l};`, ""), i = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"};`, s = () => {
792
+ switch (e.snapType) {
793
+ case "none":
1110
794
  return "snapType:none";
1111
- }
1112
- case "proximity": {
795
+ case "proximity":
1113
796
  return "snapType:proximity";
1114
- }
1115
- case "mandatory": {
797
+ case "mandatory":
1116
798
  return "snapType:mandatory";
1117
- }
1118
- default: {
799
+ default:
1119
800
  return "snapType:none";
1120
- }
1121
801
  }
1122
- };
1123
- const style2 = () => [propsStyle(), gutter()].join("; ");
1124
- return createDynamic(
1125
- () => {
1126
- var _a;
1127
- return (_a = props.as) != null ? _a : "div";
1128
- },
1129
- mergeProps(
1130
- omitProps(props, ["as", "gutter"]),
1131
- createPropsFromAccessors({ style: style2, "data-bedrock-reel": snapType })
1132
- )
1133
- );
1134
- }
1135
- function Stack(props) {
1136
- const theme = useTheme();
1137
- const propsStyle = () => {
1138
- var _a;
1139
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
1140
- (str, [key, value]) => str + `${key}:${value};`,
1141
- ""
1142
- );
1143
- };
1144
- const gutter = () => {
1145
- var _a, _b;
1146
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"};`;
1147
- };
1148
- const style2 = () => [propsStyle(), gutter()].join("; ");
1149
- return createDynamic(
1150
- () => {
1151
- var _a;
1152
- return (_a = props.as) != null ? _a : "div";
1153
- },
1154
- mergeProps(
1155
- omitProps(props, ["as", "gutter"]),
1156
- createPropsFromAccessors({ style: style2, "data-bedrock-stack": () => "" })
1157
- )
1158
- );
802
+ }, r = () => [n(), i()].join("; ");
803
+ return h(() => e.as ?? "div", u(m(e, ["as", "gutter"]), g({
804
+ style: r,
805
+ "data-bedrock-reel": s
806
+ })));
1159
807
  }
1160
- const fractions = {
808
+ const F = {
1161
809
  "1/4": "fraction:1/4",
1162
810
  "1/3": "fraction:1/3",
1163
811
  "1/2": "fraction:1/2",
1164
812
  "2/3": "fraction:2/3",
1165
813
  "3/4": "fraction:3/4",
1166
- "auto-start": `fraction:auto-start`,
1167
- "auto-end": `fraction:auto-end`
814
+ "auto-start": "fraction:auto-start",
815
+ "auto-end": "fraction:auto-end"
1168
816
  };
1169
- function SplitBase(props) {
1170
- const theme = useTheme();
1171
- const propsStyle = () => {
1172
- var _a;
1173
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
1174
- (str, [key, value]) => str + `${key}:${value};`,
1175
- ""
1176
- );
1177
- };
1178
- const gutter = () => {
1179
- var _a, _b;
1180
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"};`;
1181
- };
1182
- const fraction = () => {
1183
- var _a, _b;
1184
- return (_b = fractions[(_a = props.fraction) != null ? _a : "1/2"]) != null ? _b : fractions["1/2"];
1185
- };
1186
- const style2 = () => [propsStyle(), gutter()].join("; ");
1187
- return createDynamic(
1188
- () => {
1189
- var _a;
1190
- return (_a = props.as) != null ? _a : "div";
1191
- },
1192
- mergeProps(
1193
- omitProps(props, ["as", "gutter", "fraction"]),
1194
- createPropsFromAccessors({
1195
- style: style2,
1196
- "data-bedrock-split": fraction
1197
- })
1198
- )
1199
- );
817
+ function Ut(e) {
818
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((l, [f, a]) => l + `${f}:${a};`, ""), i = () => e.switchAt ? `--switchAt: ${O(t, e.switchAt) ?? "0px"};` : "", s = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"};`, r = () => F[e.fraction ?? "1/2"] ?? F["1/2"], c = () => e.minItemWidth ? `--minItemWidth: ${typeof e.minItemWidth == "string" ? e.minItemWidth : `${e.minItemWidth}px`};` : void 0, o = () => [n(), s(), i(), c()].join("; ");
819
+ return h(() => e.as ?? "div", u(m(e, ["as", "gutter", "fraction"]), g({
820
+ style: o,
821
+ "data-bedrock-split": r
822
+ })));
1200
823
  }
1201
- const Split = (props) => {
1202
- const [local, rest] = splitProps(props, ["switchAt", "fraction"]);
1203
- const maybePx = typeof local.switchAt === "string" ? toPX(local.switchAt) : local.switchAt;
1204
- const widthToSwitchAt = Math.max(maybePx != null ? maybePx : 0, 0);
1205
- const [shouldSwitch, nodeRef] = createContainerQuery(
1206
- widthToSwitchAt,
1207
- props.ref
1208
- );
1209
- return /* @__PURE__ */ React.createElement(Switch, null, /* @__PURE__ */ React.createElement(Match, {
1210
- when: shouldSwitch() === false
1211
- }, /* @__PURE__ */ React.createElement(SplitBase, {
1212
- fraction: local.fraction,
1213
- ...rest,
1214
- ref: nodeRef
1215
- })), /* @__PURE__ */ React.createElement(Match, {
1216
- when: shouldSwitch() === true
1217
- }, /* @__PURE__ */ React.createElement(Stack, {
1218
- ...rest,
1219
- ref: nodeRef
824
+ function Qt(e) {
825
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((r, [c, o]) => r + `${c}:${o};`, ""), i = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"};`, s = () => [n(), i()].join("; ");
826
+ return h(() => e.as ?? "div", u(m(e, ["as", "gutter"]), g({
827
+ style: s,
828
+ "data-bedrock-stack": () => ""
1220
829
  })));
1221
- };
1222
- function getSafeMinHeight(minHeight) {
1223
- if (typeof minHeight === "number")
1224
- return `${minHeight}px`;
1225
- return minHeight && checkIsCSSLength(minHeight) ? minHeight : "100vh";
1226
- }
1227
- function CoverWrapper(props) {
1228
- const theme = useTheme();
1229
- const propsStyle = () => {
1230
- var _a;
1231
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
1232
- (str, [key, value]) => str + `${key}:${value};`,
1233
- ""
1234
- );
1235
- };
1236
- const gutter = () => {
1237
- var _a, _b;
1238
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"};`;
1239
- };
1240
- const minHeight = () => `--minHeight: ${getSafeMinHeight(props.minHeight)};`;
1241
- const stretchContent = () => props.stretchContent === true ? "stretch-content" : "";
1242
- const style2 = () => [propsStyle(), gutter(), minHeight()].join("; ");
1243
- return createDynamic(
1244
- () => {
1245
- var _a;
1246
- return (_a = props.as) != null ? _a : "div";
1247
- },
1248
- mergeProps(
1249
- omitProps(props, ["as", "minHeight", "stretchContent"]),
1250
- createPropsFromAccessors({
1251
- style: style2,
1252
- "data-bedrock-cover": stretchContent
1253
- })
1254
- )
1255
- );
1256
830
  }
1257
- const Cover = (props) => {
1258
- return /* @__PURE__ */ React.createElement(CoverWrapper, {
1259
- ...props
1260
- }, props.top, /* @__PURE__ */ React.createElement("div", {
1261
- "data-bedrock-cover-centered": true
1262
- }, props.children), props.bottom);
1263
- };
1264
- function ColumnsBase(props) {
1265
- const theme = useTheme();
1266
- const propsStyle = () => {
1267
- var _a;
1268
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
1269
- (str, [key, value]) => str + `${key}:${value};`,
1270
- ""
1271
- );
1272
- };
1273
- const gutter = () => {
1274
- var _a, _b;
1275
- return `--gutter: ${(_b = getSpacingValue((_a = props.gutter) != null ? _a : "none", theme)) != null ? _b : "0px"};`;
1276
- };
1277
- const columns = () => `--columns: ${props.columns && props.columns > 0 ? props.columns : 1};`;
1278
- const dense = () => props.dense ? "dense" : "";
1279
- const style2 = () => [propsStyle(), gutter(), columns()].join("; ");
1280
- return createDynamic(
1281
- () => {
1282
- var _a;
1283
- return (_a = props.as) != null ? _a : "div";
1284
- },
1285
- mergeProps(
1286
- omitProps(props, ["as", "gutter", "columns", "dense"]),
1287
- createPropsFromAccessors({
1288
- style: style2,
1289
- "data-bedrock-columns": dense
1290
- })
1291
- )
1292
- );
831
+ const Pt = /* @__PURE__ */ Z("<div data-bedrock-cover-centered></div>");
832
+ function Tt(e) {
833
+ return typeof e == "number" ? `${e}px` : e && W(e) ? e : "100vh";
1293
834
  }
1294
- const Columns = (props) => {
1295
- const [local, rest] = splitProps(props, ["switchAt", "columns", "dense"]);
1296
- const maybePx = typeof local.switchAt === "string" ? toPX(local.switchAt) : local.switchAt;
1297
- const widthToSwitchAt = Math.max(maybePx != null ? maybePx : 0, 0);
1298
- const [shouldSwitch, nodeRef] = createContainerQuery(widthToSwitchAt);
1299
- const combineRef = (ref) => {
1300
- var _a;
1301
- nodeRef(ref);
1302
- (_a = rest.ref) == null ? void 0 : _a.call(rest, ref);
1303
- };
1304
- return /* @__PURE__ */ React.createElement(Switch, null, /* @__PURE__ */ React.createElement(Match, {
1305
- when: shouldSwitch() === false
1306
- }, /* @__PURE__ */ React.createElement(ColumnsBase, {
1307
- columns: local.columns,
1308
- dense: local.dense,
1309
- ...rest,
1310
- ref: combineRef
1311
- })), /* @__PURE__ */ React.createElement(Match, {
1312
- when: shouldSwitch() === true
1313
- }, /* @__PURE__ */ React.createElement(Stack, {
1314
- ...rest,
1315
- ref: combineRef
835
+ function kt(e) {
836
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((o, [l, f]) => o + `${l}:${f};`, ""), i = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"};`, s = () => `--minHeight: ${Tt(e.minHeight)};`, r = () => e.stretchContent === !0 ? "stretch-content" : "", c = () => [n(), i(), s()].join("; ");
837
+ return h(() => e.as ?? "div", u(m(e, ["as", "minHeight", "stretchContent"]), g({
838
+ style: c,
839
+ "data-bedrock-cover": r
1316
840
  })));
1317
- };
1318
- const safeSpan = (span) => {
1319
- return typeof span === "number" ? span : 1;
1320
- };
1321
- function Column(props) {
1322
- const propsStyle = () => {
1323
- var _a;
1324
- return typeof props.style === "string" ? props.style : Object.entries((_a = props.style) != null ? _a : {}).reduce(
1325
- (str, [key, value]) => str + `${key}:${value};`,
1326
- ""
1327
- );
1328
- };
1329
- const span = () => `--span: ${safeSpan(props.span)};`;
1330
- const offsetStart = () => props.offsetStart && props.offsetStart > 0 ? `--offsetStart: ${props.offsetStart};` : "";
1331
- const offsetEnd = () => props.offsetEnd && props.offsetEnd > 0 ? `--offsetEnd: ${props.offsetEnd};` : "";
1332
- const style2 = () => [propsStyle(), span(), offsetStart(), offsetEnd()].join("; ");
1333
- return createDynamic(
1334
- () => {
1335
- var _a;
1336
- return (_a = props.as) != null ? _a : "div";
1337
- },
1338
- mergeProps(
1339
- omitProps(props, ["as", "span", "offsetStart", "offsetEnd"]),
1340
- createPropsFromAccessors({
1341
- style: style2,
1342
- "data-bedrock-column": () => ""
1343
- })
1344
- )
1345
- );
1346
841
  }
1347
- export { Center, Column, ColumnDrop, Columns, ColumnsBase, Cover, Frame, Grid, Inline, InlineCluster, MasonryGrid, PadBox, Reel, Split, SplitBase, Stack, ThemeProvider, checkIsCSSLength, createContainerQuery, getSpacingValue, spacing, useTheme };
842
+ function Jt(e) {
843
+ const [t, n] = V(e, ["children", "top", "bottom"]);
844
+ return E(kt, u(n, {
845
+ get children() {
846
+ return [I(() => t.top), (() => {
847
+ const i = Pt.cloneNode(!0);
848
+ return ee(i, () => t.children), i;
849
+ })(), I(() => t.bottom)];
850
+ }
851
+ }));
852
+ }
853
+ function Yt(e) {
854
+ const t = $(), n = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((o, [l, f]) => o + `${l}:${f};`, ""), i = () => `--gutter: ${b(t, e.gutter ?? "size00") ?? "0px"};`, s = () => `--columns: ${e.columns && e.columns > 0 ? e.columns : 1};`, r = () => e.switchAt ? `--switchAt: ${O(t, e.switchAt) ?? "0px"};` : "", c = () => [n(), i(), s(), r()].join("; ");
855
+ return h(() => e.as ?? "div", u(m(e, ["as", "gutter", "columns", "switchAt"]), g({
856
+ style: c,
857
+ "data-bedrock-columns": () => ""
858
+ })));
859
+ }
860
+ const Nt = (e) => typeof e == "number" ? e : 1;
861
+ function Zt(e) {
862
+ const t = () => typeof e.style == "string" ? e.style : Object.entries(e.style ?? {}).reduce((c, [o, l]) => c + `${o}:${l};`, ""), n = () => `--span: ${Nt(e.span)};`, i = () => e.offsetStart && e.offsetStart > 0 ? `--offsetStart: ${e.offsetStart};` : "", s = () => e.offsetEnd && e.offsetEnd > 0 ? `--offsetEnd: ${e.offsetEnd};` : "", r = () => [t(), n(), i(), s()].join("; ");
863
+ return h(() => e.as ?? "div", u(m(e, ["as", "span", "offsetStart", "offsetEnd"]), g({
864
+ style: r,
865
+ "data-bedrock-column": () => ""
866
+ })));
867
+ }
868
+ export {
869
+ Bt as Center,
870
+ Zt as Column,
871
+ Rt as ColumnDrop,
872
+ Yt as Columns,
873
+ Jt as Cover,
874
+ Ht as Frame,
875
+ xt as Grid,
876
+ Vt as Inline,
877
+ Ft as InlineCluster,
878
+ _t as MasonryGrid,
879
+ Xt as PadBox,
880
+ qt as Reel,
881
+ Ut as Split,
882
+ Qt as Stack,
883
+ Dt as ThemeProvider,
884
+ W as checkIsCSSLength,
885
+ Gt as createContainerQuery,
886
+ _ as getSafeGutter,
887
+ O as getSizeValue,
888
+ b as getSpacingValue,
889
+ dt as sizes,
890
+ ut as spacing,
891
+ $ as useTheme
892
+ };