@bedrock-layout/solid 0.11.10 → 0.12.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/center.d.ts +5 -4
- package/lib/column-drop.d.ts +7 -6
- package/lib/columns.d.ts +8 -16
- package/lib/cover.d.ts +4 -3
- package/lib/frame.d.ts +5 -4
- package/lib/grid.d.ts +5 -4
- package/lib/index.cjs.js +1 -318
- package/lib/index.d.ts +1 -0
- package/lib/index.m.js +1074 -459
- package/lib/index.umd.js +1 -318
- package/lib/inline-cluster.d.ts +12 -11
- package/lib/inline.d.ts +23 -6
- package/lib/masonry-grid.d.ts +2 -4
- package/lib/padbox.d.ts +5 -9
- package/lib/reel.d.ts +5 -4
- package/lib/spacing-constants.d.ts +4 -4
- package/lib/split.d.ts +4 -4
- package/lib/stack.d.ts +5 -4
- package/lib/theme-provider.d.ts +9 -0
- package/lib/toPx.d.ts +2 -1
- package/lib/typeUtils.d.ts +36 -0
- package/package.json +4 -4
package/lib/index.m.js
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
|
|
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 = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { styled, useTheme } from "solid-styled-components";
|
|
1
|
+
import { splitProps, createMemo, sharedConfig, untrack, createRenderEffect, createComponent, mergeProps, createContext, useContext, createSignal, onMount, createEffect, onCleanup, children, Switch, Match } from "solid-js";
|
|
21
2
|
import { init, registerCallback } from "@bedrock-layout/register-resize-callback";
|
|
22
|
-
import { createSignal, onMount, createEffect, onCleanup, children, Switch, Match } from "solid-js";
|
|
23
3
|
function checkIsCSSLength(str) {
|
|
24
4
|
if (typeof str !== "string")
|
|
25
5
|
return false;
|
|
@@ -43,20 +23,592 @@ const spacing = {
|
|
|
43
23
|
};
|
|
44
24
|
function fromEntries(entries) {
|
|
45
25
|
return entries.reduce((acc, [key, value]) => {
|
|
46
|
-
return
|
|
26
|
+
return { ...acc, [key]: value };
|
|
47
27
|
}, {});
|
|
48
28
|
}
|
|
49
29
|
const getSpacingValue = (spacingKey, theme) => {
|
|
50
30
|
var _a, _b;
|
|
51
31
|
const maybeSpaceingOrDefault = (_b = (_a = theme == null ? void 0 : theme.space) != null ? _a : theme == null ? void 0 : theme.spacing) != null ? _b : spacing;
|
|
52
|
-
const safeSpacings = fromEntries(
|
|
53
|
-
spaceKey,
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
const safeSpacings = fromEntries(
|
|
33
|
+
Object.entries(maybeSpaceingOrDefault).map(([spaceKey, value]) => [
|
|
34
|
+
spaceKey,
|
|
35
|
+
typeof value === "number" ? `${value}px` : value
|
|
36
|
+
])
|
|
37
|
+
);
|
|
56
38
|
const spacingVal = safeSpacings[spacingKey];
|
|
57
39
|
const isCSSLength = checkIsCSSLength(spacingVal);
|
|
58
40
|
return isCSSLength ? spacingVal : void 0;
|
|
59
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 = {
|
|
46
|
+
className: "class",
|
|
47
|
+
htmlFor: "for"
|
|
48
|
+
};
|
|
49
|
+
const PropAliases = {
|
|
50
|
+
class: "className",
|
|
51
|
+
formnovalidate: "formNoValidate",
|
|
52
|
+
ismap: "isMap",
|
|
53
|
+
nomodule: "noModule",
|
|
54
|
+
playsinline: "playsInline",
|
|
55
|
+
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([
|
|
59
|
+
"altGlyph",
|
|
60
|
+
"altGlyphDef",
|
|
61
|
+
"altGlyphItem",
|
|
62
|
+
"animate",
|
|
63
|
+
"animateColor",
|
|
64
|
+
"animateMotion",
|
|
65
|
+
"animateTransform",
|
|
66
|
+
"circle",
|
|
67
|
+
"clipPath",
|
|
68
|
+
"color-profile",
|
|
69
|
+
"cursor",
|
|
70
|
+
"defs",
|
|
71
|
+
"desc",
|
|
72
|
+
"ellipse",
|
|
73
|
+
"feBlend",
|
|
74
|
+
"feColorMatrix",
|
|
75
|
+
"feComponentTransfer",
|
|
76
|
+
"feComposite",
|
|
77
|
+
"feConvolveMatrix",
|
|
78
|
+
"feDiffuseLighting",
|
|
79
|
+
"feDisplacementMap",
|
|
80
|
+
"feDistantLight",
|
|
81
|
+
"feFlood",
|
|
82
|
+
"feFuncA",
|
|
83
|
+
"feFuncB",
|
|
84
|
+
"feFuncG",
|
|
85
|
+
"feFuncR",
|
|
86
|
+
"feGaussianBlur",
|
|
87
|
+
"feImage",
|
|
88
|
+
"feMerge",
|
|
89
|
+
"feMergeNode",
|
|
90
|
+
"feMorphology",
|
|
91
|
+
"feOffset",
|
|
92
|
+
"fePointLight",
|
|
93
|
+
"feSpecularLighting",
|
|
94
|
+
"feSpotLight",
|
|
95
|
+
"feTile",
|
|
96
|
+
"feTurbulence",
|
|
97
|
+
"filter",
|
|
98
|
+
"font",
|
|
99
|
+
"font-face",
|
|
100
|
+
"font-face-format",
|
|
101
|
+
"font-face-name",
|
|
102
|
+
"font-face-src",
|
|
103
|
+
"font-face-uri",
|
|
104
|
+
"foreignObject",
|
|
105
|
+
"g",
|
|
106
|
+
"glyph",
|
|
107
|
+
"glyphRef",
|
|
108
|
+
"hkern",
|
|
109
|
+
"image",
|
|
110
|
+
"line",
|
|
111
|
+
"linearGradient",
|
|
112
|
+
"marker",
|
|
113
|
+
"mask",
|
|
114
|
+
"metadata",
|
|
115
|
+
"missing-glyph",
|
|
116
|
+
"mpath",
|
|
117
|
+
"path",
|
|
118
|
+
"pattern",
|
|
119
|
+
"polygon",
|
|
120
|
+
"polyline",
|
|
121
|
+
"radialGradient",
|
|
122
|
+
"rect",
|
|
123
|
+
"set",
|
|
124
|
+
"stop",
|
|
125
|
+
"svg",
|
|
126
|
+
"switch",
|
|
127
|
+
"symbol",
|
|
128
|
+
"text",
|
|
129
|
+
"textPath",
|
|
130
|
+
"tref",
|
|
131
|
+
"tspan",
|
|
132
|
+
"use",
|
|
133
|
+
"view",
|
|
134
|
+
"vkern"
|
|
135
|
+
]);
|
|
136
|
+
const SVGNamespace = {
|
|
137
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
138
|
+
xml: "http://www.w3.org/XML/1998/namespace"
|
|
139
|
+
};
|
|
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++;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
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];
|
|
167
|
+
} else {
|
|
168
|
+
if (!map) {
|
|
169
|
+
map = /* @__PURE__ */ new Map();
|
|
170
|
+
let i = bStart;
|
|
171
|
+
while (i < bEnd)
|
|
172
|
+
map.set(b[i], i++);
|
|
173
|
+
}
|
|
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);
|
|
187
|
+
} else
|
|
188
|
+
parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
189
|
+
} else
|
|
190
|
+
aStart++;
|
|
191
|
+
} else
|
|
192
|
+
a[aStart++].remove();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
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
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
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));
|
|
235
|
+
} 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];
|
|
247
|
+
}
|
|
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;
|
|
254
|
+
}
|
|
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")
|
|
289
|
+
continue;
|
|
290
|
+
assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
for (const prop in props) {
|
|
294
|
+
if (prop === "children") {
|
|
295
|
+
if (!skipChildren)
|
|
296
|
+
insertExpression(node, props.children);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const value = props[prop];
|
|
300
|
+
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
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);
|
|
332
|
+
}
|
|
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);
|
|
365
|
+
}
|
|
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,
|
|
379
|
+
get() {
|
|
380
|
+
return node || document;
|
|
381
|
+
}
|
|
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)
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
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);
|
|
484
|
+
} 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;
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
const value = String(item);
|
|
512
|
+
if (prev && prev.nodeType === 3 && prev.data === value) {
|
|
513
|
+
normalized.push(prev);
|
|
514
|
+
} else
|
|
515
|
+
normalized.push(document.createTextNode(value));
|
|
516
|
+
}
|
|
517
|
+
}
|
|
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();
|
|
538
|
+
} else
|
|
539
|
+
inserted = true;
|
|
540
|
+
}
|
|
541
|
+
} 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) {
|
|
559
|
+
case "function":
|
|
560
|
+
return untrack(() => component(others));
|
|
561
|
+
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;
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
}
|
|
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
|
+
}, {});
|
|
583
|
+
}
|
|
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
|
+
);
|
|
596
|
+
}
|
|
597
|
+
function createPropsFromAccessors(props) {
|
|
598
|
+
if (!Object.values(props).every((x) => typeof x === "function"))
|
|
599
|
+
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, {
|
|
603
|
+
get() {
|
|
604
|
+
return accessor();
|
|
605
|
+
},
|
|
606
|
+
configurable: true,
|
|
607
|
+
enumerable: true
|
|
608
|
+
});
|
|
609
|
+
return getterObj;
|
|
610
|
+
}, {});
|
|
611
|
+
}
|
|
60
612
|
function getSafeMaxWidth(maxWidth) {
|
|
61
613
|
if (maxWidth === void 0)
|
|
62
614
|
return "100%";
|
|
@@ -64,74 +616,83 @@ function getSafeMaxWidth(maxWidth) {
|
|
|
64
616
|
return `${maxWidth}px`;
|
|
65
617
|
return maxWidth;
|
|
66
618
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
+
);
|
|
645
|
+
}
|
|
646
|
+
const ThemeContext = createContext({});
|
|
647
|
+
function ThemeProvider(props) {
|
|
648
|
+
return /* @__PURE__ */ React.createElement(ThemeContext.Provider, {
|
|
649
|
+
value: props.theme
|
|
650
|
+
}, props.children);
|
|
651
|
+
}
|
|
652
|
+
function useTheme() {
|
|
653
|
+
try {
|
|
654
|
+
return useContext(ThemeContext);
|
|
655
|
+
} catch (e) {
|
|
656
|
+
return {};
|
|
82
657
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
${(props) => props.centerChildren ? `
|
|
87
|
-
display: flex;
|
|
88
|
-
flex-direction: column;
|
|
89
|
-
align-items: center;
|
|
90
|
-
` : ""}
|
|
91
|
-
|
|
92
|
-
${(props) => props.centerText ? `
|
|
93
|
-
text-align: center;
|
|
94
|
-
` : ""}
|
|
95
|
-
`;
|
|
96
|
-
function getSafeBasis(basis) {
|
|
97
|
-
if (basis === void 0)
|
|
658
|
+
}
|
|
659
|
+
function getSafeMinItemWidth(minItemWidth) {
|
|
660
|
+
if (minItemWidth === void 0)
|
|
98
661
|
return "159px";
|
|
99
|
-
if (typeof
|
|
100
|
-
return `${
|
|
101
|
-
return
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
gap: var(--gutter, 0px);
|
|
134
|
-
`;
|
|
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
|
+
);
|
|
695
|
+
}
|
|
135
696
|
function fail(msg) {
|
|
136
697
|
throw new Error(msg);
|
|
137
698
|
}
|
|
@@ -144,7 +705,9 @@ function assertIsValidWidth(width) {
|
|
|
144
705
|
}
|
|
145
706
|
const isInvalidArray = Array.isArray(width) && (width.length !== 2 || width[0] > width[1]);
|
|
146
707
|
if (isInvalidArray) {
|
|
147
|
-
fail(
|
|
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
|
+
);
|
|
148
711
|
}
|
|
149
712
|
}
|
|
150
713
|
function createContainerQuery(width, maybeRef) {
|
|
@@ -183,83 +746,64 @@ function getSafeRatio(ratio) {
|
|
|
183
746
|
const isRatio = checkIsRatio(ratio);
|
|
184
747
|
return isRatio ? getRatioString(ratio) : void 0;
|
|
185
748
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
inset-block: 0;
|
|
212
|
-
inset-inline: 0;
|
|
213
|
-
|
|
214
|
-
display: flex;
|
|
215
|
-
justify-content: center;
|
|
216
|
-
align-items: center;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
> :is(img, video) {
|
|
220
|
-
inline-size: 100%;
|
|
221
|
-
block-size: 100%;
|
|
222
|
-
size: 100%;
|
|
223
|
-
|
|
224
|
-
object-fit: cover;
|
|
225
|
-
object-position: ${(props) => typeof props.position === "string" ? props.position : "50%"};
|
|
226
|
-
}
|
|
227
|
-
`;
|
|
228
|
-
const Grid = styled("div")`
|
|
229
|
-
@property --gutter {
|
|
230
|
-
syntax: "<length-percentage>";
|
|
231
|
-
inherits: false;
|
|
232
|
-
initial-value: 0;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
@property --minItemWidth {
|
|
236
|
-
syntax: "<length-percentage>";
|
|
237
|
-
inherits: false;
|
|
238
|
-
initial-value: 639px;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
--gutter: ${(props) => {
|
|
242
|
-
var _a;
|
|
243
|
-
return props.gutter ? (_a = getSpacingValue(props.gutter, props.theme)) != null ? _a : "0px" : "0px";
|
|
244
|
-
}};
|
|
245
|
-
--minItemWidth: ${(props) => {
|
|
246
|
-
var _a;
|
|
247
|
-
return typeof props.minItemWidth === "string" ? props.minItemWidth : `${(_a = props.minItemWidth) != null ? _a : 0}px`;
|
|
248
|
-
}};
|
|
249
|
-
|
|
250
|
-
box-sizing: border-box;
|
|
251
|
-
> * {
|
|
252
|
-
margin: 0;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
display: grid;
|
|
256
|
-
gap: var(--gutter, 0px);
|
|
257
|
-
|
|
258
|
-
grid-template-columns: repeat(
|
|
259
|
-
auto-fit,
|
|
260
|
-
minmax(min(var(--minItemWidth, 639px), 100%), 1fr)
|
|
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
|
+
)
|
|
261
773
|
);
|
|
262
|
-
|
|
774
|
+
}
|
|
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
|
+
);
|
|
806
|
+
}
|
|
263
807
|
const PIXELS_PER_INCH = 96;
|
|
264
808
|
function parseUnit(str) {
|
|
265
809
|
var _a;
|
|
@@ -270,7 +814,7 @@ function parseUnit(str) {
|
|
|
270
814
|
}
|
|
271
815
|
function toPX(str, element) {
|
|
272
816
|
if (!str)
|
|
273
|
-
return
|
|
817
|
+
return void 0;
|
|
274
818
|
const elementOrBody = element != null ? element : document.body;
|
|
275
819
|
const safeStr = (str != null ? str : "px").trim().toLowerCase();
|
|
276
820
|
switch (safeStr) {
|
|
@@ -279,7 +823,7 @@ function toPX(str, element) {
|
|
|
279
823
|
case "vh":
|
|
280
824
|
case "vw":
|
|
281
825
|
case "%":
|
|
282
|
-
return
|
|
826
|
+
return void 0;
|
|
283
827
|
case "ch":
|
|
284
828
|
case "ex":
|
|
285
829
|
return getSizeBrutal(safeStr, elementOrBody);
|
|
@@ -302,17 +846,19 @@ function toPX(str, element) {
|
|
|
302
846
|
default: {
|
|
303
847
|
const [value, units] = parseUnit(safeStr);
|
|
304
848
|
if (isNaN(value))
|
|
305
|
-
return
|
|
849
|
+
return void 0;
|
|
306
850
|
if (!units)
|
|
307
851
|
return value;
|
|
308
852
|
const px = toPX(units, element);
|
|
309
|
-
return typeof px === "number" ? value * px :
|
|
853
|
+
return typeof px === "number" ? value * px : void 0;
|
|
310
854
|
}
|
|
311
855
|
}
|
|
312
856
|
}
|
|
313
857
|
function getPropertyInPX(element, prop) {
|
|
314
858
|
var _a;
|
|
315
|
-
const [value, units] = parseUnit(
|
|
859
|
+
const [value, units] = parseUnit(
|
|
860
|
+
getComputedStyle(element).getPropertyValue(prop)
|
|
861
|
+
);
|
|
316
862
|
return value * ((_a = toPX(units, element)) != null ? _a : 1);
|
|
317
863
|
}
|
|
318
864
|
function getSizeBrutal(unit, element) {
|
|
@@ -323,15 +869,8 @@ function getSizeBrutal(unit, element) {
|
|
|
323
869
|
element.removeChild(testDIV);
|
|
324
870
|
return size;
|
|
325
871
|
}
|
|
872
|
+
const MIN_HEIGHT = 1;
|
|
326
873
|
const isBrowser = typeof window === "object" && typeof document === "object" && document.nodeType === 9;
|
|
327
|
-
const RowSpanner = styled.div`
|
|
328
|
-
grid-row: span var(--rows, 1);
|
|
329
|
-
|
|
330
|
-
> * {
|
|
331
|
-
display: block;
|
|
332
|
-
height: 100%;
|
|
333
|
-
}
|
|
334
|
-
`;
|
|
335
874
|
const Resizer = (props) => {
|
|
336
875
|
const [rowSpan, setRowSpan] = createSignal(1);
|
|
337
876
|
const [node, nodeRef] = createSignal();
|
|
@@ -340,65 +879,91 @@ const Resizer = (props) => {
|
|
|
340
879
|
init();
|
|
341
880
|
});
|
|
342
881
|
createEffect(() => {
|
|
343
|
-
const ref = node();
|
|
344
|
-
if (ref === void 0
|
|
882
|
+
const ref = convertToMaybe(node());
|
|
883
|
+
if (ref === void 0)
|
|
345
884
|
return;
|
|
346
885
|
const cleanup = registerCallback(ref, ({ target }) => {
|
|
347
886
|
var _a;
|
|
348
887
|
setRowSpan(1);
|
|
349
888
|
const gapString = props.gutter ? (_a = getSpacingValue(props.gutter, theme)) != null ? _a : "1px" : "1px";
|
|
350
|
-
const maybeGap = isBrowser ? toPX(gapString, target) :
|
|
351
|
-
const gap = Math.max(maybeGap != null ? maybeGap :
|
|
889
|
+
const maybeGap = isBrowser ? toPX(gapString, target) : void 0;
|
|
890
|
+
const gap = Math.max(maybeGap != null ? maybeGap : MIN_HEIGHT, MIN_HEIGHT);
|
|
352
891
|
const [child] = Array.from(target.children);
|
|
353
892
|
const height = 1 + Math.min(target.scrollHeight, child.scrollHeight);
|
|
354
|
-
const rowHeight = Math.ceil(height / gap);
|
|
893
|
+
const rowHeight = Math.max(Math.ceil(height / gap), MIN_HEIGHT);
|
|
355
894
|
setRowSpan(rowHeight);
|
|
356
895
|
});
|
|
357
896
|
onCleanup(cleanup);
|
|
358
897
|
});
|
|
359
|
-
return /* @__PURE__ */ React.createElement(
|
|
360
|
-
style:
|
|
898
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
899
|
+
style: `grid-row: span ${rowSpan()};`,
|
|
361
900
|
ref: nodeRef
|
|
362
901
|
}, props.children);
|
|
363
902
|
};
|
|
364
|
-
const MasonryGridWrapper = styled(Grid)`
|
|
365
|
-
grid-template-rows: 1px;
|
|
366
|
-
`;
|
|
367
903
|
const MasonryGrid = (props) => {
|
|
368
904
|
const childrenMemo = children(() => props.children);
|
|
369
905
|
const emptyResolvedChildren = [];
|
|
370
906
|
const wrappedChildren = emptyResolvedChildren.concat(childrenMemo()).filter(Boolean).map((child) => /* @__PURE__ */ React.createElement(Resizer, {
|
|
371
907
|
gutter: props.gutter
|
|
372
908
|
}, child));
|
|
373
|
-
return /* @__PURE__ */ React.createElement(
|
|
909
|
+
return /* @__PURE__ */ React.createElement(Grid, {
|
|
910
|
+
style: "grid-template-rows: 1px;",
|
|
911
|
+
...props
|
|
912
|
+
}, wrappedChildren);
|
|
374
913
|
};
|
|
914
|
+
const justifyMap$1 = {
|
|
915
|
+
start: "justify:start",
|
|
916
|
+
end: "justify:end",
|
|
917
|
+
center: "justify:center"
|
|
918
|
+
};
|
|
919
|
+
const alignMap$1 = {
|
|
920
|
+
start: "align:start",
|
|
921
|
+
end: "align:end",
|
|
922
|
+
center: "align:center",
|
|
923
|
+
stretch: "align:stretch"
|
|
924
|
+
};
|
|
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
|
+
);
|
|
955
|
+
}
|
|
375
956
|
const justifyMap = {
|
|
376
|
-
start: "
|
|
377
|
-
end: "
|
|
378
|
-
center: "center"
|
|
957
|
+
start: "justify:start",
|
|
958
|
+
end: "justify:end",
|
|
959
|
+
center: "justify:center"
|
|
960
|
+
};
|
|
961
|
+
const alignMap = {
|
|
962
|
+
start: "align:start",
|
|
963
|
+
end: "align:end",
|
|
964
|
+
center: "align:center",
|
|
965
|
+
stretch: "align:stretch"
|
|
379
966
|
};
|
|
380
|
-
const alignMap = __spreadProps(__spreadValues({}, justifyMap), {
|
|
381
|
-
stretch: "stretch"
|
|
382
|
-
});
|
|
383
|
-
const InlineCluster = styled.div`
|
|
384
|
-
--gutter: ${(props) => {
|
|
385
|
-
var _a;
|
|
386
|
-
return props.gutter ? (_a = getSpacingValue(props.gutter, props.theme)) != null ? _a : "0px" : "0px";
|
|
387
|
-
}};
|
|
388
|
-
|
|
389
|
-
box-sizing: border-box;
|
|
390
|
-
> * {
|
|
391
|
-
margin: 0;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
display: flex;
|
|
395
|
-
flex-wrap: wrap;
|
|
396
|
-
gap: var(--gutter, 0px);
|
|
397
|
-
|
|
398
|
-
justify-content: ${(props) => typeof props.justify !== "undefined" && justifyMap[props.justify] ? justifyMap[props.justify] : justifyMap.start};
|
|
399
|
-
|
|
400
|
-
align-items: ${(props) => typeof props.align !== "undefined" && alignMap[props.align] ? alignMap[props.align] : alignMap.start};
|
|
401
|
-
`;
|
|
402
967
|
function shouldUseSwitch(switchAt) {
|
|
403
968
|
if (typeof switchAt === "number" && switchAt > -1) {
|
|
404
969
|
return true;
|
|
@@ -408,35 +973,47 @@ function shouldUseSwitch(switchAt) {
|
|
|
408
973
|
}
|
|
409
974
|
return false;
|
|
410
975
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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
|
+
}
|
|
440
1017
|
const validKeys = /* @__PURE__ */ new Set([
|
|
441
1018
|
"left",
|
|
442
1019
|
"right",
|
|
@@ -484,249 +1061,287 @@ function paddingToString(theme, padding) {
|
|
|
484
1061
|
console.error("Invalid padding Type");
|
|
485
1062
|
}
|
|
486
1063
|
const getPadding = paddingOrDefault(theme);
|
|
487
|
-
return typeof padding === "object" && !Array.isArray(padding) ? Object.entries(padding).reduce(
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
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
|
+
);
|
|
1093
|
+
}
|
|
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": {
|
|
1110
|
+
return "snapType:none";
|
|
1111
|
+
}
|
|
1112
|
+
case "proximity": {
|
|
1113
|
+
return "snapType:proximity";
|
|
1114
|
+
}
|
|
1115
|
+
case "mandatory": {
|
|
1116
|
+
return "snapType:mandatory";
|
|
1117
|
+
}
|
|
1118
|
+
default: {
|
|
1119
|
+
return "snapType:none";
|
|
1120
|
+
}
|
|
523
1121
|
}
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
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
|
+
);
|
|
1159
|
+
}
|
|
552
1160
|
const fractions = {
|
|
553
|
-
"1/4": "
|
|
554
|
-
"1/3": "
|
|
555
|
-
"1/2": "
|
|
556
|
-
"2/3": "
|
|
557
|
-
"3/4": "
|
|
558
|
-
"auto-start": `auto
|
|
559
|
-
"auto-end": `
|
|
1161
|
+
"1/4": "fraction:1/4",
|
|
1162
|
+
"1/3": "fraction:1/3",
|
|
1163
|
+
"1/2": "fraction:1/2",
|
|
1164
|
+
"2/3": "fraction:2/3",
|
|
1165
|
+
"3/4": "fraction:3/4",
|
|
1166
|
+
"auto-start": `fraction:auto-start`,
|
|
1167
|
+
"auto-end": `fraction:auto-end`
|
|
560
1168
|
};
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
|
|
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
|
+
);
|
|
1200
|
+
}
|
|
579
1201
|
const Split = (props) => {
|
|
580
|
-
const
|
|
581
|
-
const
|
|
582
|
-
const
|
|
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
|
+
);
|
|
583
1209
|
return /* @__PURE__ */ React.createElement(Switch, null, /* @__PURE__ */ React.createElement(Match, {
|
|
584
1210
|
when: shouldSwitch() === false
|
|
585
|
-
}, /* @__PURE__ */ React.createElement(SplitBase,
|
|
586
|
-
fraction:
|
|
587
|
-
|
|
1211
|
+
}, /* @__PURE__ */ React.createElement(SplitBase, {
|
|
1212
|
+
fraction: local.fraction,
|
|
1213
|
+
...rest,
|
|
588
1214
|
ref: nodeRef
|
|
589
|
-
}))
|
|
1215
|
+
})), /* @__PURE__ */ React.createElement(Match, {
|
|
590
1216
|
when: shouldSwitch() === true
|
|
591
|
-
}, /* @__PURE__ */ React.createElement(Stack,
|
|
1217
|
+
}, /* @__PURE__ */ React.createElement(Stack, {
|
|
1218
|
+
...rest,
|
|
592
1219
|
ref: nodeRef
|
|
593
|
-
})))
|
|
1220
|
+
})));
|
|
594
1221
|
};
|
|
595
1222
|
function getSafeMinHeight(minHeight) {
|
|
596
1223
|
if (typeof minHeight === "number")
|
|
597
1224
|
return `${minHeight}px`;
|
|
598
1225
|
return minHeight && checkIsCSSLength(minHeight) ? minHeight : "100vh";
|
|
599
1226
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
> [data-bedrock-cover-centered] {
|
|
631
|
-
margin-block-start: auto;
|
|
632
|
-
margin-block-end: auto;
|
|
633
|
-
|
|
634
|
-
${({ stretchContent }) => stretchContent === true ? `
|
|
635
|
-
flex: 1;
|
|
636
|
-
display: flex;
|
|
637
|
-
flex-direction: column;
|
|
638
|
-
> * {
|
|
639
|
-
flex: 1;
|
|
640
|
-
}
|
|
641
|
-
` : ""};
|
|
642
|
-
}
|
|
643
|
-
`;
|
|
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
|
+
}
|
|
644
1257
|
const Cover = (props) => {
|
|
645
|
-
return /* @__PURE__ */ React.createElement(CoverWrapper,
|
|
1258
|
+
return /* @__PURE__ */ React.createElement(CoverWrapper, {
|
|
1259
|
+
...props
|
|
1260
|
+
}, props.top, /* @__PURE__ */ React.createElement("div", {
|
|
646
1261
|
"data-bedrock-cover-centered": true
|
|
647
1262
|
}, props.children), props.bottom);
|
|
648
1263
|
};
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
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
|
+
);
|
|
1293
|
+
}
|
|
678
1294
|
const Columns = (props) => {
|
|
679
|
-
const
|
|
680
|
-
const
|
|
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);
|
|
681
1298
|
const [shouldSwitch, nodeRef] = createContainerQuery(widthToSwitchAt);
|
|
682
1299
|
const combineRef = (ref) => {
|
|
683
1300
|
var _a;
|
|
684
1301
|
nodeRef(ref);
|
|
685
|
-
(_a =
|
|
1302
|
+
(_a = rest.ref) == null ? void 0 : _a.call(rest, ref);
|
|
686
1303
|
};
|
|
687
1304
|
return /* @__PURE__ */ React.createElement(Switch, null, /* @__PURE__ */ React.createElement(Match, {
|
|
688
1305
|
when: shouldSwitch() === false
|
|
689
|
-
}, /* @__PURE__ */ React.createElement(ColumnsBase,
|
|
1306
|
+
}, /* @__PURE__ */ React.createElement(ColumnsBase, {
|
|
1307
|
+
columns: local.columns,
|
|
1308
|
+
dense: local.dense,
|
|
1309
|
+
...rest,
|
|
690
1310
|
ref: combineRef
|
|
691
|
-
}))
|
|
1311
|
+
})), /* @__PURE__ */ React.createElement(Match, {
|
|
692
1312
|
when: shouldSwitch() === true
|
|
693
|
-
}, /* @__PURE__ */ React.createElement(Stack,
|
|
1313
|
+
}, /* @__PURE__ */ React.createElement(Stack, {
|
|
1314
|
+
...rest,
|
|
694
1315
|
ref: combineRef
|
|
695
|
-
})))
|
|
1316
|
+
})));
|
|
696
1317
|
};
|
|
697
1318
|
const safeSpan = (span) => {
|
|
698
1319
|
return typeof span === "number" ? span : 1;
|
|
699
1320
|
};
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
content: "";
|
|
728
|
-
grid-column: span min(${props.offsetEnd}, var(--columns, 1));
|
|
729
|
-
}
|
|
730
|
-
` : ""}
|
|
731
|
-
`;
|
|
732
|
-
export { Center, Column, ColumnDrop, Columns, Cover, Frame, Grid, Inline, InlineCluster, MasonryGrid, PadBox, Reel, Split, Stack, checkIsCSSLength, createContainerQuery, getSpacingValue, spacing };
|
|
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
|
+
}
|
|
1347
|
+
export { Center, Column, ColumnDrop, Columns, ColumnsBase, Cover, Frame, Grid, Inline, InlineCluster, MasonryGrid, PadBox, Reel, Split, SplitBase, Stack, ThemeProvider, checkIsCSSLength, createContainerQuery, getSpacingValue, spacing, useTheme };
|