baseline-kit 2.0.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +258 -102
  2. package/dist/README.md +258 -102
  3. package/dist/baseline-kit.css +151 -0
  4. package/dist/components/Baseline/Baseline.d.ts +4 -5
  5. package/dist/components/Box/Box.d.ts +16 -5
  6. package/dist/components/Config/Config.d.ts +60 -17
  7. package/dist/components/Config/defaults.d.ts +2 -2
  8. package/dist/components/Config/index.d.ts +1 -1
  9. package/dist/components/Guide/Guide.d.ts +21 -12
  10. package/dist/components/Guide/index.d.ts +0 -6
  11. package/dist/components/Guide/types.d.ts +1 -1
  12. package/dist/components/Layout/Layout.d.ts +10 -6
  13. package/dist/components/Padder/Padder.d.ts +13 -7
  14. package/dist/components/Spacer/Spacer.d.ts +40 -11
  15. package/dist/components/Stack/Stack.d.ts +15 -8
  16. package/dist/components/index.d.ts +4 -3
  17. package/dist/components/styles/index.d.ts +11 -0
  18. package/dist/components/types.d.ts +3 -3
  19. package/dist/hooks/useBaseline.d.ts +13 -18
  20. package/dist/hooks/useConfig.d.ts +3 -8
  21. package/dist/hooks/useDebug.d.ts +1 -6
  22. package/dist/hooks/useGuide.d.ts +2 -7
  23. package/dist/hooks/useIsClient.d.ts +6 -0
  24. package/dist/hooks/useVirtual.d.ts +0 -5
  25. package/dist/index.cjs +1 -31
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.ts +25 -3
  28. package/dist/index.mjs +1557 -1542
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/styles.css +1 -1
  31. package/dist/styles.d.ts +6 -0
  32. package/dist/theme/dark.css +67 -0
  33. package/dist/theme/default.css +82 -0
  34. package/dist/theme/tokens.css +82 -0
  35. package/dist/theme.css +142 -0
  36. package/dist/theme.d.ts +6 -0
  37. package/dist/utils/convert.d.ts +0 -22
  38. package/dist/utils/grid.d.ts +22 -0
  39. package/dist/utils/index.d.ts +2 -0
  40. package/dist/utils/math.d.ts +20 -36
  41. package/dist/utils/merge.d.ts +54 -5
  42. package/dist/utils/normalize.d.ts +0 -35
  43. package/dist/utils/parse.d.ts +0 -34
  44. package/dist/utils/snapping.d.ts +0 -5
  45. package/dist/utils/ssr.d.ts +26 -0
  46. package/dist/utils/timing.d.ts +0 -5
  47. package/package.json +81 -39
package/dist/index.mjs CHANGED
@@ -1,462 +1,154 @@
1
- import * as f from "react";
2
- import oe, { useMemo as ot, useCallback as kt, useState as re, useLayoutEffect as Jt, useRef as se } from "react";
3
- var ut = { exports: {} }, at = {};
4
- /**
5
- * @license React
6
- * react-jsx-runtime.production.js
7
- *
8
- * Copyright (c) Meta Platforms, Inc. and affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- var zt;
14
- function ae() {
15
- if (zt) return at;
16
- zt = 1;
17
- var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
18
- function o(a, s, r) {
19
- var i = null;
20
- if (r !== void 0 && (i = "" + r), s.key !== void 0 && (i = "" + s.key), "key" in s) {
21
- r = {};
22
- for (var d in s)
23
- d !== "key" && (r[d] = s[d]);
24
- } else r = s;
25
- return s = r.ref, {
26
- $$typeof: e,
27
- type: a,
28
- key: i,
29
- ref: s !== void 0 ? s : null,
30
- props: r
31
- };
1
+ import { jsx as y, Fragment as K, jsxs as Z } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import { useState as mt, useEffect as St, useMemo as Q, useCallback as ot, useLayoutEffect as ht } from "react";
4
+ const Ct = {
5
+ /** Color for single-line guides */
6
+ line: "var(--bk-guide-color-line-theme)",
7
+ /** Color for pattern-based guides */
8
+ pattern: "var(--bk-guide-color-pattern-theme)",
9
+ /** Color for auto-calculated guides */
10
+ auto: "var(--bk-guide-color-auto-theme)",
11
+ /** Color for fixed-column guides */
12
+ fixed: "var(--bk-guide-color-fixed-theme)"
13
+ }, Mt = {
14
+ /** Color for line variant */
15
+ line: "var(--bk-baseline-color-line-theme)",
16
+ /** Color for flat/block variant */
17
+ flat: "var(--bk-baseline-color-flat-theme)"
18
+ }, $t = {
19
+ /** Color for line-style spacers */
20
+ line: "var(--bk-spacer-color-line-theme)",
21
+ /** Color for flat/block spacers */
22
+ flat: "var(--bk-spacer-color-flat-theme)",
23
+ /** Color for measurement indicators */
24
+ text: "var(--bk-spacer-color-text-theme)"
25
+ }, Rt = {
26
+ /** Border color for debug outline */
27
+ line: "var(--bk-box-color-line-theme)",
28
+ /** Background color for debug mode */
29
+ flat: "var(--bk-box-color-flat-theme)",
30
+ /** Color for measurement indicators */
31
+ text: "var(--bk-box-color-text-theme)"
32
+ }, Et = {
33
+ /** Border color for debug outline */
34
+ line: "var(--bk-stack-color-line-theme)",
35
+ /** Background color for debug mode */
36
+ flat: "var(--bk-stack-color-flat-theme)",
37
+ /** Color for measurement indicators */
38
+ text: "var(--bk-stack-color-text-theme)"
39
+ }, Vt = {
40
+ /** Border color for debug outline */
41
+ line: "var(--bk-layout-color-line-theme)",
42
+ /** Background color for debug mode */
43
+ flat: "var(--bk-layout-color-flat-theme)",
44
+ /** Color for measurement indicators */
45
+ text: "var(--bk-layout-color-text-theme)"
46
+ }, Gt = "var(--bk-padder-color-theme)", Ot = {
47
+ /** Base unit for spacing calculations (in pixels) */
48
+ base: 8,
49
+ /** Baseline grid configuration */
50
+ baseline: {
51
+ variant: "line",
52
+ debugging: "hidden",
53
+ colors: Mt
54
+ },
55
+ /** Guide overlay configuration */
56
+ guide: {
57
+ variant: "line",
58
+ debugging: "hidden",
59
+ colors: Ct
60
+ },
61
+ /** Spacer component configuration */
62
+ spacer: {
63
+ variant: "line",
64
+ debugging: "hidden",
65
+ colors: $t
66
+ },
67
+ /** Box component configuration */
68
+ box: {
69
+ debugging: "hidden",
70
+ colors: Rt
71
+ },
72
+ /** Stack/Flex component configuration */
73
+ stack: {
74
+ debugging: "hidden",
75
+ colors: Et
76
+ },
77
+ /** Layout component configuration */
78
+ layout: {
79
+ debugging: "hidden",
80
+ colors: Vt
81
+ },
82
+ /** Padder component configuration */
83
+ padder: {
84
+ debugging: "hidden",
85
+ color: Gt
32
86
  }
33
- return at.Fragment = n, at.jsx = o, at.jsxs = o, at;
34
- }
35
- var it = {};
36
- /**
37
- * @license React
38
- * react-jsx-runtime.development.js
39
- *
40
- * Copyright (c) Meta Platforms, Inc. and affiliates.
41
- *
42
- * This source code is licensed under the MIT license found in the
43
- * LICENSE file in the root directory of this source tree.
44
- */
45
- var Ut;
46
- function ie() {
47
- return Ut || (Ut = 1, process.env.NODE_ENV !== "production" && function() {
48
- function e(t) {
49
- if (t == null) return null;
50
- if (typeof t == "function")
51
- return t.$$typeof === te ? null : t.displayName || t.name || null;
52
- if (typeof t == "string") return t;
53
- switch (t) {
54
- case V:
55
- return "Fragment";
56
- case E:
57
- return "Portal";
58
- case R:
59
- return "Profiler";
60
- case O:
61
- return "StrictMode";
62
- case T:
63
- return "Suspense";
64
- case L:
65
- return "SuspenseList";
66
- }
67
- if (typeof t == "object")
68
- switch (typeof t.tag == "number" && console.error(
69
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
70
- ), t.$$typeof) {
71
- case j:
72
- return (t.displayName || "Context") + ".Provider";
73
- case w:
74
- return (t._context.displayName || "Context") + ".Consumer";
75
- case y:
76
- var l = t.render;
77
- return t = t.displayName, t || (t = l.displayName || l.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
78
- case B:
79
- return l = t.displayName || null, l !== null ? l : e(t.type) || "Memo";
80
- case W:
81
- l = t._payload, t = t._init;
82
- try {
83
- return e(t(l));
84
- } catch {
85
- }
86
- }
87
- return null;
88
- }
89
- function n(t) {
90
- return "" + t;
91
- }
92
- function o(t) {
93
- try {
94
- n(t);
95
- var l = !1;
96
- } catch {
97
- l = !0;
98
- }
99
- if (l) {
100
- l = console;
101
- var u = l.error, S = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
102
- return u.call(
103
- l,
104
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
105
- S
106
- ), n(t);
107
- }
108
- }
109
- function a() {
110
- }
111
- function s() {
112
- if (rt === 0) {
113
- jt = console.log, Ot = console.info, Tt = console.warn, At = console.error, $t = console.group, Mt = console.groupCollapsed, Nt = console.groupEnd;
114
- var t = {
115
- configurable: !0,
116
- enumerable: !0,
117
- value: a,
118
- writable: !0
119
- };
120
- Object.defineProperties(console, {
121
- info: t,
122
- log: t,
123
- warn: t,
124
- error: t,
125
- group: t,
126
- groupCollapsed: t,
127
- groupEnd: t
128
- });
129
- }
130
- rt++;
131
- }
132
- function r() {
133
- if (rt--, rt === 0) {
134
- var t = { configurable: !0, enumerable: !0, writable: !0 };
135
- Object.defineProperties(console, {
136
- log: K({}, t, { value: jt }),
137
- info: K({}, t, { value: Ot }),
138
- warn: K({}, t, { value: Tt }),
139
- error: K({}, t, { value: At }),
140
- group: K({}, t, { value: $t }),
141
- groupCollapsed: K({}, t, { value: Mt }),
142
- groupEnd: K({}, t, { value: Nt })
143
- });
144
- }
145
- 0 > rt && console.error(
146
- "disabledDepth fell below zero. This is a bug in React. Please file an issue."
147
- );
148
- }
149
- function i(t) {
150
- if (ht === void 0)
151
- try {
152
- throw Error();
153
- } catch (u) {
154
- var l = u.stack.trim().match(/\n( *(at )?)/);
155
- ht = l && l[1] || "", Vt = -1 < u.stack.indexOf(`
156
- at`) ? " (<anonymous>)" : -1 < u.stack.indexOf("@") ? "@unknown:0:0" : "";
157
- }
158
- return `
159
- ` + ht + t + Vt;
160
- }
161
- function d(t, l) {
162
- if (!t || pt) return "";
163
- var u = vt.get(t);
164
- if (u !== void 0) return u;
165
- pt = !0, u = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
166
- var S = null;
167
- S = Z.H, Z.H = null, s();
168
- try {
169
- var z = {
170
- DetermineComponentFrameRoot: function() {
171
- try {
172
- if (l) {
173
- var q = function() {
174
- throw Error();
175
- };
176
- if (Object.defineProperty(q.prototype, "props", {
177
- set: function() {
178
- throw Error();
179
- }
180
- }), typeof Reflect == "object" && Reflect.construct) {
181
- try {
182
- Reflect.construct(q, []);
183
- } catch (H) {
184
- var lt = H;
185
- }
186
- Reflect.construct(t, [], q);
187
- } else {
188
- try {
189
- q.call();
190
- } catch (H) {
191
- lt = H;
192
- }
193
- t.call(q.prototype);
194
- }
195
- } else {
196
- try {
197
- throw Error();
198
- } catch (H) {
199
- lt = H;
200
- }
201
- (q = t()) && typeof q.catch == "function" && q.catch(function() {
202
- });
203
- }
204
- } catch (H) {
205
- if (H && lt && typeof H.stack == "string")
206
- return [H.stack, lt.stack];
207
- }
208
- return [null, null];
209
- }
210
- };
211
- z.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
212
- var G = Object.getOwnPropertyDescriptor(
213
- z.DetermineComponentFrameRoot,
214
- "name"
215
- );
216
- G && G.configurable && Object.defineProperty(
217
- z.DetermineComponentFrameRoot,
218
- "name",
219
- { value: "DetermineComponentFrameRoot" }
220
- );
221
- var p = z.DetermineComponentFrameRoot(), F = p[0], et = p[1];
222
- if (F && et) {
223
- var Y = F.split(`
224
- `), Q = et.split(`
225
- `);
226
- for (p = G = 0; G < Y.length && !Y[G].includes(
227
- "DetermineComponentFrameRoot"
228
- ); )
229
- G++;
230
- for (; p < Q.length && !Q[p].includes(
231
- "DetermineComponentFrameRoot"
232
- ); )
233
- p++;
234
- if (G === Y.length || p === Q.length)
235
- for (G = Y.length - 1, p = Q.length - 1; 1 <= G && 0 <= p && Y[G] !== Q[p]; )
236
- p--;
237
- for (; 1 <= G && 0 <= p; G--, p--)
238
- if (Y[G] !== Q[p]) {
239
- if (G !== 1 || p !== 1)
240
- do
241
- if (G--, p--, 0 > p || Y[G] !== Q[p]) {
242
- var st = `
243
- ` + Y[G].replace(
244
- " at new ",
245
- " at "
246
- );
247
- return t.displayName && st.includes("<anonymous>") && (st = st.replace("<anonymous>", t.displayName)), typeof t == "function" && vt.set(t, st), st;
248
- }
249
- while (1 <= G && 0 <= p);
250
- break;
251
- }
252
- }
253
- } finally {
254
- pt = !1, Z.H = S, r(), Error.prepareStackTrace = u;
255
- }
256
- return Y = (Y = t ? t.displayName || t.name : "") ? i(Y) : "", typeof t == "function" && vt.set(t, Y), Y;
257
- }
258
- function g(t) {
259
- if (t == null) return "";
260
- if (typeof t == "function") {
261
- var l = t.prototype;
262
- return d(
263
- t,
264
- !(!l || !l.isReactComponent)
265
- );
266
- }
267
- if (typeof t == "string") return i(t);
268
- switch (t) {
269
- case T:
270
- return i("Suspense");
271
- case L:
272
- return i("SuspenseList");
273
- }
274
- if (typeof t == "object")
275
- switch (t.$$typeof) {
276
- case y:
277
- return t = d(t.render, !1), t;
278
- case B:
279
- return g(t.type);
280
- case W:
281
- l = t._payload, t = t._init;
282
- try {
283
- return g(t(l));
284
- } catch {
285
- }
286
- }
287
- return "";
288
- }
289
- function c() {
290
- var t = Z.A;
291
- return t === null ? null : t.getOwner();
292
- }
293
- function m(t) {
294
- if (_t.call(t, "key")) {
295
- var l = Object.getOwnPropertyDescriptor(t, "key").get;
296
- if (l && l.isReactWarning) return !1;
297
- }
298
- return t.key !== void 0;
299
- }
300
- function x(t, l) {
301
- function u() {
302
- Gt || (Gt = !0, console.error(
303
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
304
- l
305
- ));
306
- }
307
- u.isReactWarning = !0, Object.defineProperty(t, "key", {
308
- get: u,
309
- configurable: !0
310
- });
311
- }
312
- function b() {
313
- var t = e(this.type);
314
- return Wt[t] || (Wt[t] = !0, console.error(
315
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
316
- )), t = this.props.ref, t !== void 0 ? t : null;
317
- }
318
- function v(t, l, u, S, z, G) {
319
- return u = G.ref, t = {
320
- $$typeof: C,
321
- type: t,
322
- key: l,
323
- props: G,
324
- _owner: z
325
- }, (u !== void 0 ? u : null) !== null ? Object.defineProperty(t, "ref", {
326
- enumerable: !1,
327
- get: b
328
- }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
329
- configurable: !1,
330
- enumerable: !1,
331
- writable: !0,
332
- value: 0
333
- }), Object.defineProperty(t, "_debugInfo", {
334
- configurable: !1,
335
- enumerable: !1,
336
- writable: !0,
337
- value: null
338
- }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
339
- }
340
- function A(t, l, u, S, z, G) {
341
- if (typeof t == "string" || typeof t == "function" || t === V || t === R || t === O || t === T || t === L || t === P || typeof t == "object" && t !== null && (t.$$typeof === W || t.$$typeof === B || t.$$typeof === j || t.$$typeof === w || t.$$typeof === y || t.$$typeof === ee || t.getModuleId !== void 0)) {
342
- var p = l.children;
343
- if (p !== void 0)
344
- if (S)
345
- if (gt(p)) {
346
- for (S = 0; S < p.length; S++)
347
- M(p[S], t);
348
- Object.freeze && Object.freeze(p);
349
- } else
350
- console.error(
351
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
352
- );
353
- else M(p, t);
354
- } else
355
- p = "", (t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (p += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), t === null ? S = "null" : gt(t) ? S = "array" : t !== void 0 && t.$$typeof === C ? (S = "<" + (e(t.type) || "Unknown") + " />", p = " Did you accidentally export a JSX literal instead of a component?") : S = typeof t, console.error(
356
- "React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
357
- S,
358
- p
359
- );
360
- if (_t.call(l, "key")) {
361
- p = e(t);
362
- var F = Object.keys(l).filter(function(Y) {
363
- return Y !== "key";
364
- });
365
- S = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", Bt[p + S] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
366
- `A props object containing a "key" prop is being spread into JSX:
367
- let props = %s;
368
- <%s {...props} />
369
- React keys must be passed directly to JSX without using spread:
370
- let props = %s;
371
- <%s key={someKey} {...props} />`,
372
- S,
373
- p,
374
- F,
375
- p
376
- ), Bt[p + S] = !0);
377
- }
378
- if (p = null, u !== void 0 && (o(u), p = "" + u), m(l) && (o(l.key), p = "" + l.key), "key" in l) {
379
- u = {};
380
- for (var et in l)
381
- et !== "key" && (u[et] = l[et]);
382
- } else u = l;
383
- return p && x(
384
- u,
385
- typeof t == "function" ? t.displayName || t.name || "Unknown" : t
386
- ), v(t, p, G, z, c(), u);
387
- }
388
- function M(t, l) {
389
- if (typeof t == "object" && t && t.$$typeof !== ne) {
390
- if (gt(t))
391
- for (var u = 0; u < t.length; u++) {
392
- var S = t[u];
393
- h(S) && $(S, l);
394
- }
395
- else if (h(t))
396
- t._store && (t._store.validated = 1);
397
- else if (t === null || typeof t != "object" ? u = null : (u = ct && t[ct] || t["@@iterator"], u = typeof u == "function" ? u : null), typeof u == "function" && u !== t.entries && (u = u.call(t), u !== t))
398
- for (; !(t = u.next()).done; )
399
- h(t.value) && $(t.value, l);
400
- }
401
- }
402
- function h(t) {
403
- return typeof t == "object" && t !== null && t.$$typeof === C;
404
- }
405
- function $(t, l) {
406
- if (t._store && !t._store.validated && t.key == null && (t._store.validated = 1, l = N(l), !Lt[l])) {
407
- Lt[l] = !0;
408
- var u = "";
409
- t && t._owner != null && t._owner !== c() && (u = null, typeof t._owner.tag == "number" ? u = e(t._owner.type) : typeof t._owner.name == "string" && (u = t._owner.name), u = " It was passed a child from " + u + ".");
410
- var S = Z.getCurrentStack;
411
- Z.getCurrentStack = function() {
412
- var z = g(t.type);
413
- return S && (z += S() || ""), z;
414
- }, console.error(
415
- 'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
416
- l,
417
- u
418
- ), Z.getCurrentStack = S;
419
- }
420
- }
421
- function N(t) {
422
- var l = "", u = c();
423
- return u && (u = e(u.type)) && (l = `
424
-
425
- Check the render method of \`` + u + "`."), l || (t = e(t)) && (l = `
426
-
427
- Check the top-level render call using <` + t + ">."), l;
428
- }
429
- var k = oe, C = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), V = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), j = Symbol.for("react.context"), y = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), L = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), W = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), ct = Symbol.iterator, te = Symbol.for("react.client.reference"), Z = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, _t = Object.prototype.hasOwnProperty, K = Object.assign, ee = Symbol.for("react.client.reference"), gt = Array.isArray, rt = 0, jt, Ot, Tt, At, $t, Mt, Nt;
430
- a.__reactDisabledLog = !0;
431
- var ht, Vt, pt = !1, vt = new (typeof WeakMap == "function" ? WeakMap : Map)(), ne = Symbol.for("react.client.reference"), Gt, Wt = {}, Bt = {}, Lt = {};
432
- it.Fragment = V, it.jsx = function(t, l, u, S, z) {
433
- return A(t, l, u, !1, S, z);
434
- }, it.jsxs = function(t, l, u, S, z) {
435
- return A(t, l, u, !0, S, z);
436
- };
437
- }()), it;
438
- }
439
- var Yt;
440
- function ce() {
441
- return Yt || (Yt = 1, process.env.NODE_ENV === "production" ? ut.exports = ae() : ut.exports = ie()), ut.exports;
87
+ }, rt = l.createContext(Ot);
88
+ rt.displayName = "ConfigContext";
89
+ const gt = () => l.use(rt), Dt = (t) => {
90
+ const {
91
+ parentConfig: e,
92
+ base: n,
93
+ baseline: s,
94
+ guide: o,
95
+ spacer: r,
96
+ box: i,
97
+ stack: a,
98
+ layout: c,
99
+ padder: d
100
+ } = t;
101
+ return {
102
+ base: n ?? e.base,
103
+ baseline: { ...e.baseline, ...s },
104
+ guide: { ...e.guide, ...o },
105
+ spacer: { ...e.spacer, ...r },
106
+ box: { ...e.box, ...i },
107
+ stack: { ...e.stack, ...a },
108
+ layout: { ...e.layout, ...c },
109
+ padder: { ...e.padder, ...d }
110
+ };
111
+ };
112
+ function it({
113
+ children: t,
114
+ base: e,
115
+ stack: n,
116
+ baseline: s,
117
+ guide: o,
118
+ layout: r,
119
+ spacer: i,
120
+ box: a,
121
+ padder: c
122
+ }) {
123
+ const d = gt(), f = l.useMemo(() => Dt({
124
+ parentConfig: d,
125
+ base: e,
126
+ baseline: s,
127
+ guide: o,
128
+ spacer: i,
129
+ box: a,
130
+ stack: n,
131
+ layout: r,
132
+ padder: c
133
+ }), [d, e, s, o, i, a, n, r, c]);
134
+ return /* @__PURE__ */ y(rt, { value: f, children: t });
442
135
  }
443
- var _ = ce();
444
- function le(e) {
445
- const n = e.trim().match(/^([+-]?[\d.]+)([a-zA-Z%]+)$/);
446
- if (!n) return null;
447
- const o = parseFloat(n[1]), a = n[2];
448
- return { value: o, unit: a };
136
+ function _t(t) {
137
+ const e = t.trim().match(/^([+-]?[\d.]+)([a-zA-Z%]+)$/);
138
+ if (!e) return null;
139
+ const n = parseFloat(e[1]), s = e[2];
140
+ return { value: n, unit: s };
449
141
  }
450
- function U(e, n) {
451
- return e === void 0 && n !== void 0 ? `${n}px` : e === "auto" || typeof e == "string" && /^(auto|100%|0|.*(fr|vh|vw|vmin|vmax|rem))$/.test(e) ? String(e) : typeof e == "number" ? `${e}px` : e ?? "";
142
+ function O(t, e) {
143
+ return t === void 0 && e !== void 0 ? `${e}px` : t === "auto" || typeof t == "string" && /^(auto|100%|0|.*(fr|vh|vw|vmin|vmax|rem))$/.test(t) ? String(t) : typeof t == "number" ? `${t}px` : t ?? "";
452
144
  }
453
- const ue = {
145
+ const At = {
454
146
  parentSize: 0,
455
147
  viewportWidth: typeof window < "u" ? window.innerWidth : 1920,
456
148
  viewportHeight: typeof window < "u" ? window.innerHeight : 1080,
457
149
  rootFontSize: 16,
458
150
  parentFontSize: 16
459
- }, wt = {
151
+ }, lt = {
460
152
  px: 1,
461
153
  in: 96,
462
154
  // 1in = 96px
@@ -468,1281 +160,1604 @@ const ue = {
468
160
  // 1pt = 1.33px
469
161
  pc: 16
470
162
  // 1pc = 16px
471
- }, Xt = ["em", "rem", "vh", "vw", "vmin", "vmax", "%"];
472
- function yt(e, n) {
473
- if (typeof e == "number") return e;
474
- if (typeof e != "string") return null;
475
- const o = le(e);
476
- if (!o) return null;
477
- const { value: a, unit: s } = o;
478
- if (s in wt)
479
- return a * wt[s];
480
- if (s === "auto") return null;
481
- if (Xt.includes(s)) {
482
- const r = { ...ue, ...n };
483
- switch (s) {
163
+ }, It = [
164
+ "em",
165
+ "rem",
166
+ "vh",
167
+ "vw",
168
+ "vmin",
169
+ "vmax",
170
+ "%"
171
+ ];
172
+ function pt(t, e) {
173
+ if (typeof t == "number") return t;
174
+ if (typeof t != "string") return null;
175
+ const n = _t(t);
176
+ if (!n) return null;
177
+ const { value: s, unit: o } = n;
178
+ if (o in lt)
179
+ return s * lt[o];
180
+ if (o === "auto") return null;
181
+ if (It.includes(o)) {
182
+ const r = { ...At, ...e };
183
+ switch (o) {
484
184
  case "em":
485
- return a * r.parentFontSize;
185
+ return s * r.parentFontSize;
486
186
  case "rem":
487
- return a * r.rootFontSize;
187
+ return s * r.rootFontSize;
488
188
  case "vh":
489
- return a / 100 * r.viewportHeight;
189
+ return s / 100 * r.viewportHeight;
490
190
  case "vw":
491
- return a / 100 * r.viewportWidth;
191
+ return s / 100 * r.viewportWidth;
492
192
  case "vmin":
493
- return a / 100 * Math.min(r.viewportWidth, r.viewportHeight);
193
+ return s / 100 * Math.min(r.viewportWidth, r.viewportHeight);
494
194
  case "vmax":
495
- return a / 100 * Math.max(r.viewportWidth, r.viewportHeight);
195
+ return s / 100 * Math.max(r.viewportWidth, r.viewportHeight);
496
196
  case "%":
497
- return a / 100 * r.parentSize;
197
+ return s / 100 * r.parentSize;
498
198
  default:
499
199
  return null;
500
200
  }
501
201
  }
502
202
  return null;
503
203
  }
504
- function Ke(e, n, o) {
505
- const a = (o == null ? void 0 : o.round) ?? !0, s = e === void 0 ? 0 : typeof e == "number" ? e : yt(e) ?? 0;
506
- return `${(a ? Math.round(s) : s) % n}px`;
204
+ function Lt(t, e, n) {
205
+ return Math.min(Math.max(t, e), n);
507
206
  }
508
- function fe(e, n, o) {
509
- return Math.min(Math.max(e, n), o);
207
+ function Nt(t) {
208
+ const { height: e, top: n, bottom: s, base: o } = t, r = (e ?? 0) - (n + s);
209
+ return Math.max(1, Math.floor(r / o));
510
210
  }
511
- function Qe(e, n = 0) {
512
- if (n >= 0)
513
- return Number((Math.round(e * 10 ** n) / 10 ** n).toFixed(n));
514
- {
515
- const o = 10 ** Math.abs(n);
516
- return Math.round(e / o) * o;
517
- }
518
- }
519
- function dt(e, n = {}) {
211
+ function st(t, e = {}) {
520
212
  const {
521
- base: o = 8,
522
- round: a = !0,
523
- clamp: s,
213
+ base: n = 8,
214
+ round: s = !0,
215
+ clamp: o,
524
216
  suppressWarnings: r = !1
525
- } = n;
526
- if (e === "auto") return o;
217
+ } = e;
218
+ if (t === "auto") return n;
527
219
  let i = null;
528
- if (typeof e == "number")
529
- i = e;
530
- else if (typeof e == "string") {
531
- const c = yt(e);
532
- c === null ? (r || console.error(
533
- `Failed to convert "${e}" to pixels. Falling back to base ${o}.`
534
- ), i = o) : i = c;
220
+ if (typeof t == "number")
221
+ i = t;
222
+ else if (typeof t == "string") {
223
+ const d = pt(t);
224
+ d === null ? (r || console.error(
225
+ `Failed to convert "${t}" to pixels. Falling back to base ${n}.`
226
+ ), i = n) : i = d;
535
227
  }
536
- i === null && (i = o);
537
- const d = a ? Math.round(i / o) * o : i, g = s !== void 0 ? fe(
538
- d,
539
- s.min ?? -1 / 0,
540
- s.max ?? 1 / 0
541
- ) : d;
542
- return !r && g !== i && console.warn(`Normalized ${i} to ${g} to match base ${o}px.`), g;
228
+ i === null && (i = n);
229
+ const a = s ? Math.round(i / n) * n : i, c = o !== void 0 ? Lt(
230
+ a,
231
+ o.min ?? -1 / 0,
232
+ o.max ?? 1 / 0
233
+ ) : a;
234
+ return !r && c !== i && console.warn(`Normalized ${i} to ${c} to match base ${n}px.`), c;
543
235
  }
544
- function Dt(e, n, o) {
545
- if (!e || e[0] === void 0 && e[1] === void 0)
546
- return n;
547
- const a = e[0] !== void 0 ? dt(e[0], o) : n[0], s = e[1] !== void 0 ? dt(e[1], o) : n[1];
548
- return [a, s];
236
+ function kt(t, e, n) {
237
+ if (!t || t[0] === void 0 && t[1] === void 0)
238
+ return e;
239
+ const s = t[0] !== void 0 ? st(t[0], n) : e[0], o = t[1] !== void 0 ? st(t[1], n) : e[1];
240
+ return [s, o];
549
241
  }
550
- function D(e) {
551
- if ("padding" in e && e.padding != null)
552
- return de(e.padding);
553
- const n = "block" in e && e.block != null ? be(e.block) : { top: 0, bottom: 0 }, o = "inline" in e && e.inline != null ? me(e.inline) : { left: 0, right: 0 };
242
+ function Y(t) {
243
+ if ("padding" in t && t.padding != null)
244
+ return Bt(t.padding);
245
+ const e = "block" in t && t.block != null ? Wt(t.block) : { top: 0, bottom: 0 }, n = "inline" in t && t.inline != null ? zt(t.inline) : { left: 0, right: 0 };
554
246
  return {
555
- top: n.top,
556
- right: o.right,
557
- bottom: n.bottom,
558
- left: o.left
247
+ top: e.top,
248
+ right: n.right,
249
+ bottom: e.bottom,
250
+ left: n.left
559
251
  };
560
252
  }
561
- function de(e) {
562
- if (typeof e == "number")
563
- return { top: e, right: e, bottom: e, left: e };
564
- if (Array.isArray(e)) {
565
- if (e.length === 2) {
566
- const [n, o] = e;
567
- return { top: n, right: o, bottom: n, left: o };
253
+ function Bt(t) {
254
+ if (typeof t == "number")
255
+ return { top: t, right: t, bottom: t, left: t };
256
+ if (Array.isArray(t)) {
257
+ if (t.length === 2) {
258
+ const [e, n] = t;
259
+ return { top: e, right: n, bottom: e, left: n };
568
260
  }
569
- if (e.length >= 4) {
570
- const [n, o, a, s] = e;
261
+ if (t.length >= 4) {
262
+ const [e, n, s, o] = t;
571
263
  return {
572
- top: n ?? 0,
573
- right: o ?? 0,
574
- bottom: a ?? 0,
575
- left: s ?? 0
264
+ top: e ?? 0,
265
+ right: n ?? 0,
266
+ bottom: s ?? 0,
267
+ left: o ?? 0
576
268
  };
577
269
  }
578
270
  }
579
- if (typeof e == "object" && !Array.isArray(e)) {
580
- const n = e.top ?? 0, o = e.bottom ?? 0, a = e.left ?? 0, s = e.right ?? 0;
581
- return { top: n, right: s, bottom: o, left: a };
271
+ if (typeof t == "object" && !Array.isArray(t)) {
272
+ const e = t.top ?? 0, n = t.bottom ?? 0, s = t.left ?? 0, o = t.right ?? 0;
273
+ return { top: e, right: o, bottom: n, left: s };
582
274
  }
583
275
  return { top: 0, right: 0, bottom: 0, left: 0 };
584
276
  }
585
- function be(e) {
586
- if (typeof e == "number")
587
- return { top: e, bottom: e };
588
- if (Array.isArray(e)) {
589
- const [n, o] = e;
277
+ function Wt(t) {
278
+ if (typeof t == "number")
279
+ return { top: t, bottom: t };
280
+ if (Array.isArray(t)) {
281
+ const [e, n] = t;
590
282
  return {
591
- top: n ?? 0,
592
- bottom: o ?? 0
283
+ top: e ?? 0,
284
+ bottom: n ?? 0
593
285
  };
594
286
  }
595
- return typeof e == "object" ? {
596
- top: e.start ?? 0,
597
- bottom: e.end ?? 0
287
+ return typeof t == "object" ? {
288
+ top: t.start ?? 0,
289
+ bottom: t.end ?? 0
598
290
  } : { top: 0, bottom: 0 };
599
291
  }
600
- function me(e) {
601
- if (typeof e == "number")
602
- return { left: e, right: e };
603
- if (Array.isArray(e)) {
604
- const [n, o] = e;
292
+ function zt(t) {
293
+ if (typeof t == "number")
294
+ return { left: t, right: t };
295
+ if (Array.isArray(t)) {
296
+ const [e, n] = t;
605
297
  return {
606
- left: n ?? 0,
607
- right: o ?? 0
298
+ left: e ?? 0,
299
+ right: n ?? 0
608
300
  };
609
301
  }
610
- return typeof e == "object" ? {
611
- left: e.start ?? 0,
612
- right: e.end ?? 0
302
+ return typeof t == "object" ? {
303
+ left: t.start ?? 0,
304
+ right: t.end ?? 0
613
305
  } : { left: 0, right: 0 };
614
306
  }
615
- function ge(e, n, o, a) {
616
- const s = D({ padding: o });
617
- if (a === "none")
618
- return s;
619
- if (a === "height") {
620
- const r = e % n;
621
- r !== 0 && (s.bottom += n - r);
307
+ function Ht(t, e, n, s) {
308
+ const o = Y({ padding: n });
309
+ if (s === "none")
310
+ return o;
311
+ if (s === "height") {
312
+ const r = t % e;
313
+ r !== 0 && (o.bottom += e - r);
622
314
  }
623
- if (a === "clamp") {
624
- s.top = s.top % n;
625
- const r = e % n;
626
- r !== 0 && (s.bottom += n - r), s.bottom = s.bottom % n;
315
+ if (s === "clamp") {
316
+ o.top = o.top % e;
317
+ const r = t % e;
318
+ r !== 0 && (o.bottom += e - r), o.bottom = o.bottom % e;
627
319
  }
628
- return s;
320
+ return o;
629
321
  }
630
- const J = (...e) => e.filter(Boolean).join(" ").trim(), I = (...e) => Object.assign({}, ...e.filter((n) => n !== void 0));
631
- function he(e, n) {
632
- if (e)
633
- if (typeof e == "function")
634
- e(n);
322
+ const Tt = (t, e, n) => {
323
+ const s = {};
324
+ return t !== void 0 ? (s.gridColumn = `span ${t}`, s.gridRow = `span ${t}`) : (e !== void 0 && (s.gridColumn = `span ${e}`), n !== void 0 && (s.gridRow = `span ${n}`)), s;
325
+ }, z = (...t) => t.filter(Boolean).join(" ").trim(), q = (...t) => Object.assign(
326
+ {},
327
+ ...t.filter((e) => e !== void 0)
328
+ );
329
+ function Ft(t, e) {
330
+ if (t)
331
+ if (typeof t == "function")
332
+ t(e);
635
333
  else
636
334
  try {
637
- Object.assign(e, { current: n });
638
- } catch (o) {
639
- console.error("Error assigning ref:", o);
335
+ Object.assign(t, { current: e });
336
+ } catch (n) {
337
+ console.error("Error assigning ref:", n);
640
338
  }
641
339
  }
642
- function Zt(...e) {
643
- return (n) => {
644
- e.forEach((o) => {
645
- he(o, n);
340
+ function yt(...t) {
341
+ return (e) => {
342
+ t.forEach((n) => {
343
+ Ft(n, e);
646
344
  });
647
345
  };
648
346
  }
649
- const tn = (e, n) => {
650
- let o = null;
651
- const a = () => {
652
- o && (clearTimeout(o), o = null);
653
- };
654
- return [(...r) => {
655
- a(), o = setTimeout(() => e(...r), n);
656
- }, a];
657
- }, Kt = (e) => {
658
- let n = null, o = null;
659
- return (...s) => {
660
- o = s, n !== null && cancelAnimationFrame(n), n = requestAnimationFrame(() => {
661
- e(...o), n = null, o = null;
347
+ function k(t, e, n) {
348
+ var a, c, d;
349
+ const s = typeof t == "string" ? t : t.key, o = typeof t == "string" ? e : t.value, r = typeof t == "string" ? n : t.defaultStyles, i = typeof t == "object" ? t.skipDimensions : void 0;
350
+ if (i) {
351
+ if ((a = i.fitContent) != null && a.includes(s) && o === "fit-content")
352
+ return {};
353
+ if ((c = i.auto) != null && c.includes(s) && o === "auto")
354
+ return {};
355
+ if ((d = i.fullSize) != null && d.includes(s) && (o === "100%" || o === "100vh" || o === "100vw"))
356
+ return {};
357
+ }
358
+ return o !== r[s] ? { [s]: o } : {};
359
+ }
360
+ const vt = (t) => {
361
+ let e = null, n = null;
362
+ return (...o) => {
363
+ n = o, e !== null && cancelAnimationFrame(e), e = requestAnimationFrame(() => {
364
+ t(...n), e = null, n = null;
662
365
  });
663
366
  };
664
367
  };
665
- function bt(e) {
666
- const [n, o] = f.useState({ width: 0, height: 0 }), a = f.useCallback(() => {
667
- if (e.current)
668
- try {
669
- const r = e.current.getBoundingClientRect(), i = {
670
- width: r ? Math.round(r.width) : 0,
671
- height: r ? Math.round(r.height) : 0
672
- };
673
- o(
674
- (d) => d.width === i.width && d.height === i.height ? d : i
675
- );
676
- } catch {
677
- o({ width: 0, height: 0 });
678
- }
679
- }, [e]), s = f.useMemo(() => Kt(a), [a]);
680
- return f.useLayoutEffect(() => {
681
- a();
682
- }, [a]), f.useLayoutEffect(() => {
683
- if (!e.current) return;
684
- const r = new ResizeObserver(() => {
685
- s();
686
- });
687
- return r.observe(e.current), () => {
688
- r.disconnect();
689
- };
690
- }, [e, s]), { ...n, refresh: s };
691
- }
692
- function pe({
693
- totalLines: e,
694
- lineHeight: n,
695
- containerRef: o,
696
- buffer: a = 0
697
- }) {
698
- const s = ot(
699
- () => typeof a == "number" ? a : parseInt(a, 10) || 0,
700
- [a]
701
- ), r = kt(() => {
702
- const m = o.current;
703
- if (!m) return { start: 0, end: e };
704
- if (m.closest(".block"))
705
- return { start: 0, end: e };
706
- const b = m.getBoundingClientRect().top + window.scrollY, v = Math.max(0, window.scrollY - b - s), A = v + window.innerHeight + s * 2, M = Math.max(0, Math.floor(v / n)), h = Math.min(e, Math.ceil(A / n));
707
- return { start: M, end: h };
708
- }, [e, n, o, s]), [i, d] = re(r);
709
- ve(["scroll", "resize"], () => {
710
- c();
711
- });
712
- const g = kt(() => {
713
- d((m) => {
714
- const x = r();
715
- return m.start !== x.start || m.end !== x.end ? x : m;
716
- });
717
- }, [r]), c = ot(() => Kt(g), [g]);
718
- return Jt(() => {
719
- const m = o.current;
720
- if (!m) return;
721
- const x = new IntersectionObserver(c, { threshold: 0 });
722
- return x.observe(m), c(), () => {
723
- x.disconnect();
724
- };
725
- }, [o, r, c]), i;
368
+ function jt() {
369
+ const [t, e] = mt(!1);
370
+ return St(() => {
371
+ e(!0);
372
+ }, []), t;
726
373
  }
727
- function ve(e, n) {
728
- const o = kt(n, [n]);
729
- Jt(() => {
730
- const a = () => o();
731
- return e.forEach((s) => window.addEventListener(s, a)), () => e.forEach((s) => window.removeEventListener(s, a));
732
- }, [e, o]);
733
- }
734
- function mt(e, {
735
- base: n = 8,
736
- snapping: o = "none",
737
- spacing: a = {},
738
- warnOnMisalignment: s = !1
739
- } = {}) {
740
- if (n < 1)
741
- throw new Error("Base must be >= 1 for baseline alignment.");
742
- const { height: r } = bt(e), i = se(!1);
743
- return ot(() => {
744
- const d = D({ padding: a }), g = r % n === 0;
745
- if (!g && s && process.env.NODE_ENV === "development" && console.warn(
746
- `[useBaseline] Element height (${r}px) is not aligned with base (${n}px).`
747
- ), o === "none")
748
- return { padding: d, isAligned: g, height: r };
749
- if (i.current)
750
- return { padding: d, isAligned: g, height: r };
751
- const c = ge(r, n, d, o);
752
- return i.current = !0, { padding: c, isAligned: g, height: r };
753
- }, [n, o, a, s, r]);
754
- }
755
- function xe(e, n) {
756
- const { width: o } = bt(e);
757
- return ot(() => {
758
- const a = n.variant ?? "line", s = dt(n.gap ?? 0, { base: 1 });
759
- if (!o)
760
- return {
761
- template: "none",
762
- columnsCount: 0,
763
- calculatedGap: 0,
764
- isValid: !1
765
- };
766
- try {
767
- switch (a) {
768
- case "line": {
769
- const r = Math.max(1, Math.floor(o / (s + 1)) + 1);
770
- return {
771
- template: `repeat(${r}, 1px)`,
772
- columnsCount: r,
773
- calculatedGap: s,
774
- isValid: !0
775
- };
776
- }
777
- case "pattern": {
778
- if (!qe(n.columns))
779
- throw new Error('Invalid "pattern" columns array');
780
- const r = n.columns.map((i) => typeof i == "number" ? `${i}px` : i);
781
- return r.some((i) => i === "0" || i === "0px") ? {
782
- template: "none",
783
- columnsCount: 0,
784
- calculatedGap: 0,
785
- isValid: !1
786
- } : {
787
- template: r.join(" "),
788
- columnsCount: r.length,
789
- calculatedGap: s,
790
- isValid: !0
791
- };
792
- }
793
- case "fixed": {
794
- const r = typeof n.columns == "number" ? n.columns : 0;
795
- if (r < 1)
796
- throw new Error(`Invalid columns count: ${r}`);
797
- const i = n.columnWidth ? U(n.columnWidth) : "1fr";
798
- return {
799
- template: `repeat(${r}, ${i})`,
800
- columnsCount: r,
801
- calculatedGap: s,
802
- isValid: !0
803
- };
804
- }
805
- case "auto": {
806
- const r = n.columnWidth ?? "auto";
807
- if (r === "auto")
808
- return {
809
- template: "repeat(auto-fit, minmax(0, 1fr))",
810
- columnsCount: 1,
811
- calculatedGap: s,
812
- isValid: !0
813
- };
814
- const i = typeof r == "number" ? `${r}px` : r.toString(), d = yt(i) ?? 0, g = d > 0 ? Math.max(1, Math.floor((o + s) / (d + s))) : 1;
815
- return {
816
- template: `repeat(auto-fit, minmax(${i}, 1fr))`,
817
- columnsCount: g,
818
- calculatedGap: s,
819
- isValid: !0
820
- };
821
- }
822
- default: {
823
- console.warn(
824
- `[useGuide] Unknown variant "${a}". Falling back to "line".`
825
- );
826
- const r = Math.max(1, Math.floor(o / (s + 1)) + 1);
827
- return {
828
- template: `repeat(${r}, 1px)`,
829
- columnsCount: r,
830
- calculatedGap: s,
831
- isValid: !0
832
- };
833
- }
834
- }
835
- } catch (r) {
836
- return console.warn("Error in useGuide:", r), {
837
- template: "none",
838
- columnsCount: 0,
839
- calculatedGap: 0,
840
- isValid: !1
841
- };
842
- }
843
- }, [n, o]);
374
+ const xt = typeof window > "u";
375
+ function Be(t, e) {
376
+ if (xt)
377
+ return e;
378
+ try {
379
+ return t();
380
+ } catch {
381
+ return e;
382
+ }
844
383
  }
845
- function X(e) {
846
- const n = Qt();
847
- return ot(() => Object.assign(
848
- { base: n.base },
849
- n[e]
850
- ), [n, e]);
384
+ function J(t, e, n) {
385
+ return !t || xt ? e : n;
851
386
  }
852
- function tt(e, n) {
853
- return ot(() => {
854
- const o = e ?? n;
855
- return {
856
- isShown: o === "visible",
857
- isHidden: o === "hidden",
858
- isNone: o === "none",
859
- debugging: o
860
- };
861
- }, [e, n]);
387
+ function wt({ children: t, fallback: e = null }) {
388
+ return jt() ? /* @__PURE__ */ y(K, { children: t }) : /* @__PURE__ */ y(K, { children: e });
862
389
  }
863
- const ke = {
864
- /** Color for single-line guides */
865
- line: "var(--bk-guide-color-line-theme)",
866
- /** Color for pattern-based guides */
867
- pattern: "var(--bk-guide-color-pattern-theme)",
868
- /** Color for auto-calculated guides */
869
- auto: "var(--bk-guide-color-auto-theme)",
870
- /** Color for fixed-column guides */
871
- fixed: "var(--bk-guide-color-fixed-theme)"
872
- }, we = {
873
- /** Color for line variant */
874
- line: "var(--bk-baseline-color-line-theme)",
875
- /** Color for flat/block variant */
876
- flat: "var(--bk-baseline-color-flat-theme)"
877
- }, ye = {
878
- /** Color for line-style spacers */
879
- line: "var(--bk-spacer-color-line-theme)",
880
- /** Color for flat/block spacers */
881
- flat: "var(--bk-spacer-color-flat-theme)",
882
- /** Color for measurement indicators */
883
- text: "var(--bk-spacer-color-text-theme)"
884
- }, Ee = {
885
- /** Border color for debug outline */
886
- line: "var(--bk-box-color-line-theme)",
887
- /** Background color for debug mode */
888
- flat: "var(--bk-box-color-flat-theme)",
889
- /** Color for measurement indicators */
890
- text: "var(--bk-box-color-text-theme)"
891
- }, Se = {
892
- /** Border color for debug outline */
893
- line: "var(--bk-stack-color-line-theme)",
894
- /** Background color for debug mode */
895
- flat: "var(--bk-stack-color-flat-theme)",
896
- /** Color for measurement indicators */
897
- text: "var(--bk-stack-color-text-theme)"
898
- }, Ce = {
899
- /** Border color for debug outline */
900
- line: "var(--bk-layout-color-line-theme)",
901
- /** Background color for debug mode */
902
- flat: "var(--bk-layout-color-flat-theme)",
903
- /** Color for measurement indicators */
904
- text: "var(--bk-layout-color-text-theme)"
905
- }, Re = "var(--bk-padder-color-theme)", _e = {
906
- /** Base unit for spacing calculations (in pixels) */
907
- base: 8,
908
- /** Baseline grid configuration */
909
- baseline: {
910
- variant: "line",
911
- debugging: "hidden",
912
- colors: we
913
- },
914
- /** Guide overlay configuration */
915
- guide: {
916
- variant: "line",
917
- debugging: "hidden",
918
- colors: ke
919
- },
920
- /** Spacer component configuration */
921
- spacer: {
922
- variant: "line",
923
- debugging: "hidden",
924
- colors: ye
925
- },
926
- /** Box component configuration */
927
- box: {
928
- debugging: "hidden",
929
- colors: Ee
930
- },
931
- /** Stack/Flex component configuration */
932
- stack: {
933
- debugging: "hidden",
934
- colors: Se
935
- },
936
- /** Layout component configuration */
937
- layout: {
938
- debugging: "hidden",
939
- colors: Ce
940
- },
941
- /** Padder component configuration */
942
- padder: {
943
- debugging: "hidden",
944
- color: Re
945
- }
946
- }, Et = f.createContext(null);
947
- Et.displayName = "ConfigContext";
948
- const Qt = () => f.use(Et) ?? _e, je = ({
949
- base: e,
950
- baseline: n,
951
- guide: o,
952
- stack: a,
953
- spacer: s,
954
- layout: r,
955
- box: i,
956
- padder: d
957
- }) => ({
958
- "--bkb": `${e}px`,
959
- // Baseline Colors
960
- "--bkbcl": n.colors.line,
961
- "--bkbcf": n.colors.flat,
962
- // Guide Colors
963
- "--bkgcl": o.colors.line,
964
- "--bkgcp": o.colors.pattern,
965
- "--bkgca": o.colors.auto,
966
- "--bkgcf": o.colors.fixed,
967
- // Spacer Colors
968
- "--bkscl": s.colors.line,
969
- "--bkscf": s.colors.flat,
970
- "--bksci": s.colors.text,
971
- // Box Colors
972
- "--bkxcl": i.colors.line,
973
- "--bkxcf": i.colors.flat,
974
- "--bkxci": i.colors.text,
975
- // Flex Colors
976
- "--bkkcl": a.colors.line,
977
- "--bkkcf": a.colors.flat,
978
- "--bkkci": a.colors.text,
979
- // Layout Colors
980
- "--bklcl": r.colors.line,
981
- "--bklcf": r.colors.flat,
982
- "--bklci": r.colors.text,
983
- // Padder Color
984
- "--bkpc": d.color
985
- });
986
- function St({
987
- children: e,
988
- base: n,
989
- stack: o,
990
- baseline: a,
991
- guide: s,
992
- layout: r,
993
- spacer: i,
994
- box: d,
995
- padder: g
996
- }) {
997
- const c = Qt(), m = f.useMemo(() => {
998
- const x = {
999
- base: n ?? c.base,
1000
- baseline: { ...c.baseline, ...a },
1001
- guide: { ...c.guide, ...s },
1002
- spacer: { ...c.spacer, ...i },
1003
- box: { ...c.box, ...d },
1004
- stack: { ...c.stack, ...o },
1005
- layout: { ...c.layout, ...r },
1006
- padder: { ...c.padder, ...g }
390
+ function P(t) {
391
+ const [e, n] = l.useState({ width: 0, height: 0 }), s = l.useCallback(() => {
392
+ if (t.current)
393
+ try {
394
+ const r = t.current.getBoundingClientRect(), i = {
395
+ width: r ? Math.round(r.width) : 0,
396
+ height: r ? Math.round(r.height) : 0
397
+ };
398
+ n(
399
+ (a) => a.width === i.width && a.height === i.height ? a : i
400
+ );
401
+ } catch {
402
+ n({ width: 0, height: 0 });
403
+ }
404
+ }, [t]), o = l.useMemo(() => vt(s), [s]);
405
+ return l.useLayoutEffect(() => {
406
+ typeof window > "u" || s();
407
+ }, [s]), l.useLayoutEffect(() => {
408
+ if (typeof window > "u" || !t.current) return;
409
+ const r = new ResizeObserver(() => {
410
+ o();
411
+ });
412
+ return r.observe(t.current), () => {
413
+ r.disconnect();
1007
414
  };
1008
- return {
1009
- ...x,
1010
- cssVariables: je(x)
415
+ }, [t, o]), { ...e, refresh: o };
416
+ }
417
+ function Ut({
418
+ totalLines: t,
419
+ lineHeight: e,
420
+ containerRef: n,
421
+ buffer: s = 0
422
+ }) {
423
+ const o = Q(
424
+ () => typeof s == "number" ? s : parseInt(s, 10) || 0,
425
+ [s]
426
+ ), r = ot(() => {
427
+ const f = n.current;
428
+ if (!f) return { start: 0, end: t };
429
+ if (f.closest(".block"))
430
+ return { start: 0, end: t };
431
+ const M = f.getBoundingClientRect().top + window.scrollY, v = Math.max(0, window.scrollY - M - o), b = v + window.innerHeight + o * 2, w = Math.max(0, Math.floor(v / e)), g = Math.min(t, Math.ceil(b / e));
432
+ return { start: w, end: g };
433
+ }, [t, e, n, o]), [i, a] = mt(r);
434
+ qt(["scroll", "resize"], () => {
435
+ d();
436
+ });
437
+ const c = ot(() => {
438
+ a((f) => {
439
+ const u = r();
440
+ return f.start !== u.start || f.end !== u.end ? u : f;
441
+ });
442
+ }, [r]), d = Q(
443
+ () => vt(c),
444
+ [c]
445
+ );
446
+ return ht(() => {
447
+ const f = n.current;
448
+ if (!f) return;
449
+ const u = new IntersectionObserver(d, {
450
+ threshold: 0
451
+ });
452
+ return u.observe(f), d(), () => {
453
+ u.disconnect();
1011
454
  };
1012
- }, [
1013
- n,
1014
- c.base,
1015
- c.baseline,
1016
- c.guide,
1017
- c.spacer,
1018
- c.box,
1019
- c.stack,
1020
- c.layout,
1021
- c.padder,
1022
- a,
1023
- s,
1024
- i,
1025
- d,
1026
- o,
1027
- r,
1028
- g
1029
- ]);
1030
- return /* @__PURE__ */ _.jsx(Et, { value: m, children: e });
455
+ }, [n, r, d]), i;
456
+ }
457
+ function qt(t, e) {
458
+ const n = ot(e, [e]);
459
+ ht(() => {
460
+ const s = () => n();
461
+ return t.forEach((o) => window.addEventListener(o, s)), () => t.forEach((o) => window.removeEventListener(o, s));
462
+ }, [t, n]);
463
+ }
464
+ function tt(t, {
465
+ base: e = 8,
466
+ snapping: n = "none",
467
+ spacing: s = {},
468
+ warnOnMisalignment: o = !1
469
+ } = {}) {
470
+ if (e < 1)
471
+ throw new Error("Base must be >= 1 for baseline alignment.");
472
+ const { height: r } = P(t), i = l.useRef(!1), a = l.useRef(!1);
473
+ return l.useMemo(() => {
474
+ const c = Y({ padding: s }), d = r % e === 0;
475
+ if (!d && o && process.env.NODE_ENV === "development" && (a.current || (console.warn(
476
+ `[useBaseline] Element height (${r}px) is not aligned with base (${e}px).`
477
+ ), a.current = !0)), n === "none")
478
+ return { padding: c, isAligned: d, height: r };
479
+ if (i.current)
480
+ return { padding: c, isAligned: d, height: r };
481
+ const f = Ht(
482
+ r,
483
+ e,
484
+ c,
485
+ n
486
+ );
487
+ return i.current = !0, { padding: f, isAligned: d, height: r };
488
+ }, [e, n, s, o, r]);
1031
489
  }
1032
- const Oe = "spr_4aLVm", Te = "line_lUa33", Ae = "flat_zXVQF", Pt = {
1033
- spr: Oe,
1034
- line: Te,
1035
- flat: Ae
1036
- }, $e = f.memo(function({
1037
- height: n,
1038
- width: o,
1039
- indicatorNode: a,
1040
- debugging: s,
490
+ const Xt = "spr_zbcF6", Yt = "line_qHW69", Zt = "flat_gqixr", ct = {
491
+ spr: Xt,
492
+ line: Yt,
493
+ flat: Zt
494
+ }, Kt = (t, e, n, s) => ({
495
+ "--bksw": "100%",
496
+ "--bksh": "100%",
497
+ "--bksb": `${t}px`,
498
+ "--bksct": e,
499
+ "--bkscf": n,
500
+ "--bkscl": s
501
+ }), Jt = (t, e, n, s) => {
502
+ if (!t || !e) return null;
503
+ const o = typeof n == "number" ? n : 0, r = typeof s == "number" ? s : 0;
504
+ return /* @__PURE__ */ Z(K, { children: [
505
+ r !== 0 && /* @__PURE__ */ y("span", { children: e(r, "height") }, "height"),
506
+ o !== 0 && /* @__PURE__ */ y("span", { children: e(o, "width") }, "width")
507
+ ] });
508
+ }, Qt = l.memo(function({
509
+ height: e,
510
+ width: n,
511
+ indicatorNode: s,
512
+ debugging: o,
1041
513
  variant: r,
1042
514
  base: i,
1043
- color: d,
1044
- className: g,
1045
- style: c,
1046
- ...m
515
+ color: a,
516
+ className: c,
517
+ style: d,
518
+ children: f,
519
+ ssrMode: u = !1,
520
+ ...M
1047
521
  }) {
1048
- const x = f.useRef(null), b = X("spacer"), { isShown: v } = tt(s, b.debugging), A = r ?? b.variant, M = i ?? b.base, [h, $] = Dt(
1049
- [o, n],
1050
- [0, 0],
1051
- { base: M, suppressWarnings: !0 }
1052
- ), N = f.useMemo(() => !v || !a ? null : [
1053
- $ !== 0 && /* @__PURE__ */ _.jsx("span", { children: a($, "height") }, "height"),
1054
- h !== 0 && /* @__PURE__ */ _.jsx("span", { children: a(h, "width") }, "width")
1055
- ].filter(Boolean), [v, a, $, h]), k = f.useMemo(() => ({
1056
- "--bksh": "100%",
1057
- "--bksw": "100%",
1058
- "--bksb": `${b.base}px`,
1059
- "--bksci": "var(--bk-spacer-color-text-theme)",
1060
- "--bkscl": "var(--bk-spacer-color-line-theme)",
1061
- "--bkscf": "var(--bk-spacer-color-flat-theme)"
1062
- }), [b.base]), C = f.useCallback(
1063
- (V, O) => (V === "--bksw" || V === "--bksh") && O === "100%" ? {} : O !== k[V] ? { [V]: O } : {},
1064
- [k]
1065
- ), E = f.useMemo(() => {
1066
- const V = U($ || "100%"), O = U(h || "100%"), R = `${i || b.base}px`, w = {
1067
- ...C("--bksh", V),
1068
- ...C("--bksw", O),
1069
- ...C("--bksb", R),
1070
- ...C(
1071
- "--bksci",
1072
- d ?? b.colors.text
1073
- ),
1074
- ...C(
1075
- "--bkscl",
1076
- d ?? b.colors.line
1077
- ),
1078
- ...C(
1079
- "--bkscf",
1080
- d ?? b.colors.flat
1081
- )
522
+ const v = l.useRef(null), b = T("spacer"), { isShown: w } = j(o, b.debugging), g = r ?? b.variant, h = i ?? b.base, [D, S] = l.useState(!1);
523
+ l.useEffect(() => {
524
+ S(!0);
525
+ }, []);
526
+ const [x, $] = l.useMemo(() => kt([n, e], [0, 0], {
527
+ base: h,
528
+ suppressWarnings: !0
529
+ }), [n, e, h]), I = J(
530
+ D && !u,
531
+ !1,
532
+ // Don't show measurements during SSR
533
+ w && s !== void 0
534
+ ), m = l.useMemo(() => I ? Jt(w, s, x, $) : null, [I, w, s, x, $]), G = l.useMemo(
535
+ () => Kt(
536
+ h,
537
+ b.colors.text,
538
+ b.colors.flat,
539
+ b.colors.line
540
+ ),
541
+ [h, b.colors]
542
+ ), A = l.useMemo(() => {
543
+ const p = O($ || "100%"), B = O(x || "100%"), _ = `${h}px`, V = ["--bksw", "--bksh"], L = {
544
+ ...k({
545
+ key: "--bksh",
546
+ value: p,
547
+ defaultStyles: G,
548
+ skipDimensions: { fullSize: V }
549
+ }),
550
+ ...k({
551
+ key: "--bksw",
552
+ value: B,
553
+ defaultStyles: G,
554
+ skipDimensions: { fullSize: V }
555
+ }),
556
+ // Explicitly set --bksb to ensure it is always applied
557
+ "--bksb": _,
558
+ ...k({
559
+ key: "--bksct",
560
+ value: a ?? b.colors.text,
561
+ defaultStyles: G
562
+ }),
563
+ ...k({
564
+ key: "--bkscl",
565
+ value: a ?? b.colors.line,
566
+ defaultStyles: G
567
+ }),
568
+ ...k({
569
+ key: "--bkscf",
570
+ value: a ?? b.colors.flat,
571
+ defaultStyles: G
572
+ })
1082
573
  };
1083
- return I(w, c);
574
+ return q(L, d);
1084
575
  }, [
1085
- C,
576
+ x,
1086
577
  $,
578
+ a,
1087
579
  h,
1088
- b.base,
1089
- d,
1090
- b.colors.text,
1091
- b.colors.line,
1092
- b.colors.flat,
1093
- c
580
+ b.colors,
581
+ G,
582
+ d
1094
583
  ]);
1095
- return /* @__PURE__ */ _.jsx(
584
+ return /* @__PURE__ */ Z(
1096
585
  "div",
1097
586
  {
1098
- ref: x,
587
+ ref: v,
1099
588
  "data-testid": "spacer",
1100
- className: J(Pt.spr, v && Pt[A], g),
1101
- "data-variant": A,
1102
- style: E,
1103
- ...m,
1104
- children: N
589
+ className: z(
590
+ ct.spr,
591
+ w && ct[g],
592
+ c
593
+ ),
594
+ "data-variant": g,
595
+ "data-height": typeof $ == "number" ? `${$}px` : $,
596
+ style: A,
597
+ ...M,
598
+ children: [
599
+ m,
600
+ f
601
+ ]
1105
602
  }
1106
603
  );
1107
- }), Me = "pad_I0i9S", Ne = "v_E0FRN", xt = {
1108
- pad: Me,
1109
- v: Ne
1110
- }, Ct = f.memo(
1111
- f.forwardRef(function({
1112
- children: n,
1113
- className: o,
1114
- debugging: a,
1115
- height: s,
604
+ }), Pt = "pad_w2-sL", te = "v_lhGBy", nt = {
605
+ pad: Pt,
606
+ v: te
607
+ }, ee = (t, e, n, s) => {
608
+ const o = {};
609
+ return t !== "fit-content" && (o["--bkpw"] = O(t || "fit-content")), e !== "fit-content" && (o["--bkph"] = O(e || "fit-content")), o["--bkpb"] = `${n}px`, o["--bkpc"] = s, o;
610
+ }, ne = (t, e) => {
611
+ const { top: n, right: s, bottom: o, left: r } = e, i = {};
612
+ return t || ((n > 0 || o > 0) && (i.paddingBlock = `${n}px ${o}px`), (r > 0 || s > 0) && (i.paddingInline = `${r}px ${s}px`)), i;
613
+ }, oe = (t, e, n) => {
614
+ const s = t || "line", o = e || "none", r = (i, a) => /* @__PURE__ */ y(
615
+ Qt,
616
+ {
617
+ variant: s,
618
+ debugging: a === 0 || i === 0 ? "none" : o,
619
+ indicatorNode: n,
620
+ height: a !== "100%" ? a : void 0,
621
+ width: i !== "100%" ? i : void 0
622
+ }
623
+ );
624
+ return r.displayName = "PadderSpacer", r;
625
+ }, at = l.memo(
626
+ l.forwardRef(function({
627
+ children: e,
628
+ className: n,
629
+ debugging: s,
630
+ height: o,
1116
631
  indicatorNode: r,
1117
632
  style: i,
1118
- width: d,
1119
- ...g
1120
- }, c) {
1121
- const m = X("padder"), { variant: x } = X("spacer"), b = f.useMemo(
1122
- () => D(g),
1123
- [g]
1124
- ), { isShown: v, isNone: A, debugging: M } = tt(
1125
- a,
1126
- m.debugging
1127
- ), h = !A, $ = f.useRef(null), {
1128
- padding: { top: N, left: k, bottom: C, right: E }
1129
- } = mt($, {
1130
- base: m.base,
633
+ width: a,
634
+ ssrMode: c = !1,
635
+ ...d
636
+ }, f) {
637
+ const u = T("padder"), { variant: M } = T("spacer"), v = l.useMemo(
638
+ () => Y(d),
639
+ [d]
640
+ ), { isShown: b, isNone: w, debugging: g } = j(
641
+ s,
642
+ u.debugging
643
+ ), h = !w, [D, S] = l.useState(!1);
644
+ l.useEffect(() => {
645
+ S(!0);
646
+ }, []);
647
+ const x = l.useRef(null), $ = tt(x, {
648
+ base: u.base,
1131
649
  snapping: "height",
1132
- spacing: b,
1133
- warnOnMisalignment: !A
1134
- }), V = Zt(c, $), O = f.useMemo(() => {
1135
- const w = {};
1136
- return d !== "fit-content" && (w["--bkpw"] = U(d || "fit-content")), s !== "fit-content" && (w["--bkph"] = U(s || "fit-content")), m.base !== 8 && (w["--bkpb"] = `${m.base}px`), m.color !== "var(--bk-padder-color-theme)" && (w["--bkpc"] = m.color), h || ((N > 0 || C > 0) && (w.paddingBlock = `${N}px ${C}px`), (k > 0 || E > 0) && (w.paddingInline = `${k}px ${E}px`)), I(w, i);
650
+ spacing: v,
651
+ warnOnMisalignment: !w
652
+ }), I = {
653
+ padding: {
654
+ top: v.top || 0,
655
+ right: v.right || 0,
656
+ bottom: v.bottom || 0,
657
+ left: v.left || 0
658
+ }
659
+ }, { padding: m } = J(
660
+ D && !c,
661
+ I,
662
+ $
663
+ ), G = yt(f, x), A = l.useMemo(() => {
664
+ const B = ee(
665
+ a,
666
+ o,
667
+ u.base,
668
+ u.color
669
+ ), _ = ne(h, {
670
+ top: m.top,
671
+ right: m.right,
672
+ bottom: m.bottom,
673
+ left: m.left
674
+ });
675
+ return q(
676
+ { ...B, ..._ },
677
+ i
678
+ );
1137
679
  }, [
1138
- d,
1139
- s,
1140
- m.base,
1141
- m.color,
680
+ a,
681
+ o,
682
+ u.base,
683
+ u.color,
1142
684
  h,
1143
- N,
1144
- E,
1145
- C,
1146
- k,
685
+ m.top,
686
+ m.right,
687
+ m.bottom,
688
+ m.left,
1147
689
  i
1148
- ]), R = (w, j) => /* @__PURE__ */ _.jsx(
1149
- $e,
1150
- {
1151
- variant: x,
1152
- debugging: M,
1153
- indicatorNode: r,
1154
- height: j !== "100%" ? j : void 0,
1155
- width: w !== "100%" ? w : void 0
1156
- }
690
+ ]), p = l.useMemo(
691
+ () => oe(M, g, r),
692
+ [M, g, r]
1157
693
  );
1158
- return h ? /* @__PURE__ */ _.jsxs(
694
+ return h ? /* @__PURE__ */ Z(
1159
695
  "div",
1160
696
  {
1161
- ref: V,
697
+ ref: G,
1162
698
  "data-testid": "padder",
1163
- className: J(xt.pad, v && xt.v, o),
1164
- style: O,
699
+ className: z(nt.pad, b && nt.v, n),
700
+ style: A,
1165
701
  children: [
1166
- /* @__PURE__ */ _.jsxs(_.Fragment, { children: [
1167
- N > 0 && /* @__PURE__ */ _.jsx("div", { style: { gridColumn: "1 / -1" }, children: R("100%", N) }),
1168
- k > 0 && /* @__PURE__ */ _.jsx("div", { style: { gridRow: "2 / 3" }, children: R(k, "100%") })
702
+ /* @__PURE__ */ Z(K, { children: [
703
+ m.top >= 0 && /* @__PURE__ */ y("div", { style: { gridColumn: "1 / -1" }, children: p("100%", m.top) }),
704
+ m.left >= 0 && /* @__PURE__ */ y("div", { style: { gridRow: "2 / 3" }, children: p(m.left, "100%") })
1169
705
  ] }),
1170
- /* @__PURE__ */ _.jsx("div", { style: { gridRow: "2 / 3", gridColumn: "2 / 3" }, children: n }),
1171
- /* @__PURE__ */ _.jsxs(_.Fragment, { children: [
1172
- E > 0 && /* @__PURE__ */ _.jsx("div", { style: { gridRow: "2 / 3" }, children: R(E, "100%") }),
1173
- C > 0 && /* @__PURE__ */ _.jsx("div", { style: { gridColumn: "1 / -1" }, children: R("100%", C) })
706
+ /* @__PURE__ */ y("div", { style: { gridRow: "2 / 3", gridColumn: "2 / 3" }, children: e }),
707
+ /* @__PURE__ */ Z(K, { children: [
708
+ m.right >= 0 && /* @__PURE__ */ y("div", { style: { gridRow: "2 / 3" }, children: p(m.right, "100%") }),
709
+ m.bottom >= 0 && /* @__PURE__ */ y("div", { style: { gridColumn: "1 / -1" }, children: p("100%", m.bottom) })
1174
710
  ] })
1175
711
  ]
1176
712
  }
1177
- ) : /* @__PURE__ */ _.jsx(
713
+ ) : /* @__PURE__ */ y(
1178
714
  "div",
1179
715
  {
1180
- ref: V,
716
+ ref: G,
1181
717
  "data-testid": "padder",
1182
- className: J(xt.pad, o),
1183
- style: O,
1184
- children: n
718
+ className: z(nt.pad, n),
719
+ style: A,
720
+ children: e
1185
721
  }
1186
722
  );
1187
723
  })
1188
- ), Ve = "lay_yGGkG", Ge = "v_uVoBP", Ft = {
1189
- lay: Ve,
1190
- v: Ge
1191
- };
1192
- function Ht(e) {
1193
- return typeof e == "number" ? `repeat(${e}, 1fr)` : typeof e == "string" ? e : Array.isArray(e) ? e.map((n) => typeof n == "number" ? `${n}px` : n).join(" ") : "repeat(auto-fit, minmax(100px, 1fr))";
1194
- }
1195
- const en = f.memo(function({
1196
- children: n,
1197
- columns: o,
1198
- rows: a,
1199
- rowGap: s,
1200
- columnGap: r,
1201
- gap: i,
724
+ ), se = "lay_5cMu5", re = "v_dprVE", ut = {
725
+ lay: se,
726
+ v: re
727
+ }, ie = (t) => ({
728
+ "--bklw": "auto",
729
+ "--bklh": "auto",
730
+ "--bklcl": t.line,
731
+ "--bklcf": t.flat,
732
+ "--bklci": t.text
733
+ }), dt = (t) => typeof t == "number" ? `repeat(${t}, 1fr)` : typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => typeof e == "number" ? `${e}px` : e).join(" ") : "repeat(auto-fill, minmax(100px, 1fr))", ae = (t, e, n) => {
734
+ const s = {};
735
+ return t !== void 0 && (s.gap = O(t)), e !== void 0 && (s.rowGap = O(e)), n !== void 0 && (s.columnGap = O(n)), s;
736
+ }, We = l.memo(function({
737
+ alignContent: e,
738
+ alignItems: n,
739
+ children: s,
740
+ className: o,
741
+ columns: r = "repeat(auto-fill, minmax(100px, 1fr))",
742
+ columnGap: i,
743
+ debugging: a,
744
+ gap: c,
1202
745
  height: d,
1203
- width: g,
1204
- indicatorNode: c,
1205
- justifyItems: m,
1206
- alignItems: x,
1207
- justifyContent: b,
1208
- alignContent: v,
1209
- className: A,
1210
- variant: M,
1211
- style: h,
1212
- debugging: $,
1213
- ...N
746
+ indicatorNode: f,
747
+ justifyContent: u,
748
+ justifyItems: M,
749
+ rowGap: v,
750
+ rows: b,
751
+ style: w,
752
+ variant: g,
753
+ width: h,
754
+ ssrMode: D = !1,
755
+ ...S
1214
756
  }) {
1215
- const k = X("layout"), { isShown: C } = tt($, k.debugging), E = f.useRef(null), V = f.useMemo(
1216
- () => D(N),
1217
- [N]
1218
- ), { padding: O } = mt(E, {
1219
- base: k.base,
757
+ const x = T("layout"), { isShown: $, debugging: I } = j(a, x.debugging), [m, G] = l.useState(!1);
758
+ l.useEffect(() => {
759
+ G(!0);
760
+ }, []);
761
+ const A = l.useRef(null), p = l.useMemo(
762
+ () => Y(S),
763
+ [S]
764
+ ), B = tt(A, {
765
+ base: x.base,
1220
766
  snapping: "height",
1221
- spacing: V,
767
+ spacing: p,
1222
768
  warnOnMisalignment: !0
1223
- }), R = f.useMemo(
1224
- () => Ht(o),
1225
- [o]
1226
- ), w = f.useMemo(
1227
- () => a ? Ht(a) : "auto",
1228
- [a]
1229
- ), j = f.useMemo(
1230
- () => ({
1231
- "--bklw": "auto",
1232
- "--bklh": "auto",
1233
- "--bklcl": k.colors.line,
1234
- "--bklcf": k.colors.flat,
1235
- "--bklci": k.colors.text
1236
- }),
1237
- [k.colors.line, k.colors.flat, k.colors.text]
1238
- ), y = f.useCallback(
1239
- (B, W) => (B === "--bklw" || B === "--bklh") && W === "auto" ? {} : W !== j[B] ? { [B]: W } : {},
1240
- [j]
1241
- ), T = f.useMemo(
1242
- () => ({
1243
- ...i !== void 0 && { gap: U(i) },
1244
- ...s !== void 0 && { rowGap: U(s) },
1245
- ...r !== void 0 && { columnGap: U(r) }
1246
- }),
1247
- [i, s, r]
1248
- ), L = f.useMemo(() => {
1249
- const B = U(g || "auto"), W = U(d || "auto");
1250
- return I(
769
+ }), _ = {
770
+ padding: {
771
+ top: p.top || 0,
772
+ right: p.right || 0,
773
+ bottom: p.bottom || 0,
774
+ left: p.left || 0
775
+ }
776
+ }, { padding: V } = J(
777
+ m && !D,
778
+ _,
779
+ B
780
+ ), L = l.useMemo(
781
+ () => dt(r),
782
+ [r]
783
+ ), C = l.useMemo(
784
+ () => b ? dt(b) : "auto",
785
+ [b]
786
+ ), E = l.useMemo(
787
+ () => ie(x.colors),
788
+ [x.colors]
789
+ ), R = l.useMemo(
790
+ () => ae(c, v, i),
791
+ [c, v, i]
792
+ ), N = l.useMemo(() => {
793
+ const W = O(h || "auto"), X = O(d || "auto"), U = ["--bklw", "--bklh"];
794
+ return q(
1251
795
  {
1252
796
  // Theme overrides
1253
- ...y("--bklw", B),
1254
- ...y("--bklh", W),
1255
- ...y("--bklcl", k.colors.line),
1256
- ...y("--bklcf", k.colors.flat),
1257
- ...y("--bklci", k.colors.text),
797
+ ...k({
798
+ key: "--bklw",
799
+ value: W,
800
+ defaultStyles: E,
801
+ skipDimensions: { auto: U }
802
+ }),
803
+ ...k({
804
+ key: "--bklh",
805
+ value: X,
806
+ defaultStyles: E,
807
+ skipDimensions: { auto: U }
808
+ }),
809
+ ...k({
810
+ key: "--bklcl",
811
+ value: x.colors.line,
812
+ defaultStyles: E
813
+ }),
814
+ ...k({
815
+ key: "--bklcf",
816
+ value: x.colors.flat,
817
+ defaultStyles: E
818
+ }),
819
+ ...k({
820
+ key: "--bklci",
821
+ value: x.colors.text,
822
+ defaultStyles: E
823
+ }),
1258
824
  // Grid properties - only inject if different from defaults
1259
- ...R !== "repeat(auto-fit, minmax(100px, 1fr))" && {
1260
- "--bklgtc": R
825
+ ...L !== "repeat(auto-fill, minmax(100px, 1fr))" && {
826
+ "--bklgtc": L
1261
827
  },
1262
- ...w !== "auto" && { "--bklgtr": w },
1263
- ...m && { "--bklji": m },
1264
- ...x && { "--bklai": x },
1265
- ...b && { "--bkljc": b },
1266
- ...v && { "--bklac": v },
828
+ ...C !== "auto" && { "--bklgtr": C },
829
+ ...M && { "--bklji": M },
830
+ ...n && { "--bklai": n },
831
+ ...u && { "--bkljc": u },
832
+ ...e && { "--bklac": e },
1267
833
  // Include gap styles
1268
- ...T
834
+ ...R
1269
835
  },
1270
- h
836
+ w
1271
837
  );
1272
838
  }, [
1273
- R,
1274
- w,
1275
- m,
1276
- x,
1277
- b,
1278
- v,
1279
- g,
1280
- d,
1281
- k.colors.line,
1282
- k.colors.flat,
1283
- k.colors.text,
1284
- y,
839
+ L,
840
+ C,
841
+ M,
842
+ n,
843
+ u,
844
+ e,
1285
845
  h,
1286
- T
846
+ d,
847
+ x.colors,
848
+ E,
849
+ w,
850
+ R
1287
851
  ]);
1288
- return /* @__PURE__ */ _.jsx(
1289
- St,
852
+ return /* @__PURE__ */ y(it, { spacer: { variant: g ?? "line" }, children: /* @__PURE__ */ y(
853
+ at,
1290
854
  {
1291
- spacer: { variant: M ?? "line" },
1292
- children: /* @__PURE__ */ _.jsx(
1293
- Ct,
855
+ ref: A,
856
+ className: $ ? ut.v : "",
857
+ block: [V.top, V.bottom],
858
+ ...f ? { indicatorNode: f } : {},
859
+ inline: [V.left, V.right],
860
+ debugging: I,
861
+ width: h,
862
+ height: d,
863
+ ssrMode: D,
864
+ children: /* @__PURE__ */ y(
865
+ "div",
1294
866
  {
1295
- ref: E,
1296
- className: C ? Ft.v : "",
1297
- block: [O.top, O.bottom],
1298
- indicatorNode: c,
1299
- inline: [O.left, O.right],
1300
- debugging: $,
1301
- width: g,
1302
- height: d,
1303
- children: /* @__PURE__ */ _.jsx(
1304
- "div",
1305
- {
1306
- "data-testid": "layout",
1307
- className: J(A, Ft.lay),
1308
- style: L,
1309
- children: n
1310
- }
1311
- )
867
+ "data-testid": "layout",
868
+ className: z(o, ut.lay),
869
+ style: N,
870
+ ...S && Object.keys(S).length > 0 ? Object.fromEntries(
871
+ Object.entries(S).filter(
872
+ ([W]) => W !== "ssrMode"
873
+ )
874
+ ) : {},
875
+ children: s
1312
876
  }
1313
877
  )
1314
878
  }
1315
- );
1316
- }), We = "box_LHy8B", Be = "v_q3Ozc", It = {
1317
- box: We,
1318
- v: Be
1319
- }, nn = f.memo(
1320
- f.forwardRef(function({
1321
- children: n,
1322
- snapping: o = "clamp",
1323
- debugging: a,
1324
- className: s,
879
+ ) });
880
+ }), le = "box_rDCRX", ce = "v_0MMHD", ft = {
881
+ box: le,
882
+ v: ce
883
+ }, ue = (t, e) => ({
884
+ "--bkboxw": "auto",
885
+ "--bkboxh": "auto",
886
+ "--bkboxc": e,
887
+ "--bkboxb": `${t}px`
888
+ }), de = ({
889
+ width: t,
890
+ height: e,
891
+ base: n,
892
+ lineColor: s,
893
+ defaultStyles: o
894
+ }) => {
895
+ const r = O(t || "fit-content"), i = O(e || "fit-content"), a = ["--bkboxw", "--bkboxh"];
896
+ return {
897
+ ...k({
898
+ key: "--bkboxw",
899
+ value: r,
900
+ defaultStyles: o,
901
+ skipDimensions: { fitContent: a }
902
+ }),
903
+ ...k({
904
+ key: "--bkboxh",
905
+ value: i,
906
+ defaultStyles: o,
907
+ skipDimensions: { fitContent: a }
908
+ }),
909
+ ...k({
910
+ key: "--bkboxb",
911
+ value: `${n}px`,
912
+ defaultStyles: o
913
+ }),
914
+ ...k({
915
+ key: "--bkboxc",
916
+ value: s,
917
+ defaultStyles: o
918
+ })
919
+ };
920
+ }, ze = l.memo(
921
+ l.forwardRef(function({
922
+ children: e,
923
+ snapping: n = "clamp",
924
+ debugging: s,
925
+ className: o,
1325
926
  colSpan: r,
1326
927
  rowSpan: i,
1327
- span: d,
1328
- width: g,
1329
- height: c,
1330
- style: m,
1331
- ...x
1332
- }, b) {
1333
- const v = X("box"), { isShown: A, debugging: M } = tt(a, v.debugging), h = f.useRef(null), { top: $, bottom: N, left: k, right: C } = D(x), { padding: E } = mt(h, {
1334
- base: v.base,
1335
- snapping: o,
1336
- spacing: { top: $, bottom: N, left: k, right: C },
1337
- warnOnMisalignment: M !== "none"
1338
- }), V = f.useMemo(() => {
1339
- const j = {};
1340
- return d !== void 0 ? (j.gridColumn = `span ${d}`, j.gridRow = `span ${d}`) : (r !== void 0 && (j.gridColumn = `span ${r}`), i !== void 0 && (j.gridRow = `span ${i}`)), j;
1341
- }, [r, i, d]), O = f.useMemo(
1342
- () => ({
1343
- "--bkxw": "fit-content",
1344
- "--bkxh": "fit-content",
1345
- "--bkxb": `${v.base}px`,
1346
- "--bkxcl": v.colors.line
1347
- }),
1348
- [v.base, v.colors.line]
1349
- ), R = f.useCallback(
1350
- (j, y) => (j === "--bkxw" || j === "--bkxh") && y === "fit-content" ? {} : y !== O[j] ? { [j]: y } : {},
1351
- [O]
1352
- ), w = f.useMemo(() => {
1353
- const j = U(g || "fit-content"), y = U(c || "fit-content"), T = {
1354
- ...R("--bkxw", j),
1355
- ...R("--bkxh", y),
1356
- ...R("--bkxb", `${v.base}px`),
1357
- ...R("--bkxcl", v.colors.line)
1358
- };
1359
- return I(T, m);
928
+ span: a,
929
+ width: c,
930
+ height: d,
931
+ style: f,
932
+ ssrMode: u = !1,
933
+ ...M
934
+ }, v) {
935
+ const b = T("box"), { isShown: w, debugging: g } = j(s, b.debugging), [h, D] = l.useState(!1);
936
+ l.useEffect(() => {
937
+ D(!0);
938
+ }, []);
939
+ const S = l.useRef(null), { top: x, bottom: $, left: I, right: m } = Y(M), G = tt(S, {
940
+ base: b.base,
941
+ snapping: n,
942
+ spacing: { top: x, bottom: $, left: I, right: m },
943
+ warnOnMisalignment: g !== "none"
944
+ }), A = {
945
+ padding: {
946
+ top: x || 0,
947
+ right: m || 0,
948
+ bottom: $ || 0,
949
+ left: I || 0
950
+ }
951
+ }, { padding: p } = J(
952
+ h && !u,
953
+ A,
954
+ G
955
+ ), B = l.useMemo(
956
+ () => Tt(a, r, i),
957
+ [r, i, a]
958
+ ), _ = l.useMemo(
959
+ () => ue(b.base, b.colors.line),
960
+ [b.base, b.colors.line]
961
+ ), V = l.useMemo(() => {
962
+ const L = de({
963
+ width: c,
964
+ height: d,
965
+ base: b.base,
966
+ lineColor: b.colors.line,
967
+ defaultStyles: _
968
+ });
969
+ return q(L, f);
1360
970
  }, [
1361
- v.base,
1362
- v.colors.line,
1363
- g,
971
+ b.base,
972
+ b.colors.line,
1364
973
  c,
1365
- R,
1366
- m
974
+ d,
975
+ _,
976
+ f
1367
977
  ]);
1368
- return /* @__PURE__ */ _.jsx(
978
+ return /* @__PURE__ */ y(
1369
979
  "div",
1370
980
  {
1371
- ref: Zt(b, h),
981
+ ref: yt(v, S),
1372
982
  "data-testid": "box",
1373
- className: J(It.box, A && It.v, s),
1374
- style: I(w, V),
1375
- children: /* @__PURE__ */ _.jsx(
1376
- St,
983
+ className: z(ft.box, w && ft.v, o),
984
+ style: q(V, B),
985
+ children: /* @__PURE__ */ y(it, { base: 1, spacer: { variant: "flat" }, children: /* @__PURE__ */ y(
986
+ at,
1377
987
  {
1378
- base: 1,
1379
- spacer: { variant: "flat" },
1380
- children: /* @__PURE__ */ _.jsx(
1381
- Ct,
1382
- {
1383
- block: [E.top, E.bottom],
1384
- inline: [E.left, E.right],
1385
- width: "fit-content",
1386
- height: c,
1387
- debugging: M,
1388
- children: n
1389
- }
1390
- )
988
+ block: [p.top, p.bottom],
989
+ inline: [p.left, p.right],
990
+ width: "fit-content",
991
+ height: d,
992
+ debugging: g,
993
+ ssrMode: u,
994
+ children: e
1391
995
  }
1392
- )
996
+ ) })
1393
997
  }
1394
998
  );
1395
999
  })
1396
- ), Le = "stk_4t2AU", ze = "v_Uwir6", qt = {
1397
- stk: Le,
1398
- v: ze
1399
- }, on = f.memo(function({
1400
- align: n = "flex-start",
1401
- children: o,
1402
- className: a,
1403
- columnGap: s,
1000
+ ), fe = "stk_l-58l", be = "v_-k3qw", bt = {
1001
+ stk: fe,
1002
+ v: be
1003
+ }, me = {
1004
+ x: "row",
1005
+ y: "column",
1006
+ "-x": "row-reverse",
1007
+ "-y": "column-reverse"
1008
+ }, he = (t) => ({
1009
+ "--bkkw": "auto",
1010
+ "--bkkh": "auto",
1011
+ "--bkkcl": t.line,
1012
+ "--bkkcf": t.flat,
1013
+ "--bkkci": t.text
1014
+ }), ge = (t, e, n) => ({
1015
+ rowGap: n !== void 0 ? n : t,
1016
+ columnGap: n !== void 0 ? n : e
1017
+ }), He = l.memo(function({
1018
+ align: e = "flex-start",
1019
+ children: n,
1020
+ className: s,
1021
+ columnGap: o,
1404
1022
  debugging: r,
1405
1023
  direction: i = "row",
1406
- gap: d,
1407
- height: g,
1408
- indicatorNode: c,
1409
- justify: m = "flex-start",
1410
- rowGap: x,
1411
- style: b,
1024
+ gap: a,
1025
+ height: c,
1026
+ indicatorNode: d,
1027
+ justify: f = "flex-start",
1028
+ rowGap: u,
1029
+ style: M,
1412
1030
  variant: v,
1413
- width: A,
1414
- ...M
1031
+ width: b,
1032
+ ssrMode: w = !1,
1033
+ ...g
1415
1034
  }) {
1416
- const h = X("stack"), { isShown: $, debugging: N } = tt(r, h.debugging), k = f.useRef(null), C = f.useMemo(
1417
- () => D(M),
1418
- [M]
1419
- ), { padding: E } = mt(k, {
1035
+ const h = T("stack"), { isShown: D, debugging: S } = j(r, h.debugging), [x, $] = l.useState(!1);
1036
+ l.useEffect(() => {
1037
+ $(!0);
1038
+ }, []);
1039
+ const I = l.useRef(null), { top: m, right: G, bottom: A, left: p } = Y({
1040
+ ...g
1041
+ }), B = tt(I, {
1420
1042
  base: h.base,
1421
1043
  snapping: "height",
1422
- spacing: C,
1423
- warnOnMisalignment: !0
1424
- }), V = f.useMemo(
1425
- () => ({
1426
- rowGap: x,
1427
- columnGap: s,
1428
- ...d !== void 0 && { gap: d }
1429
- }),
1430
- [x, s, d]
1431
- ), O = f.useMemo(
1432
- () => ({
1433
- "--bkkw": "auto",
1434
- "--bkkh": "auto",
1435
- "--bkkcl": h.colors.line,
1436
- "--bkkcf": h.colors.flat,
1437
- "--bkkci": h.colors.text
1438
- }),
1439
- [h.colors.line, h.colors.flat, h.colors.text]
1440
- ), R = f.useCallback(
1441
- (y, T) => y === "--bkkw" && T === "auto" ? {} : y === "--bkkh" && T === "auto" ? {} : T !== O[y] ? { [y]: T } : {},
1442
- [O]
1443
- ), w = f.useMemo(() => {
1444
- const y = U(A || "auto"), T = U(g || "auto"), L = {
1445
- ...R("--bkkw", y),
1446
- ...R("--bkkh", T),
1447
- ...R("--bkkcl", h.colors.line),
1448
- ...R("--bkkcf", h.colors.flat),
1449
- ...R("--bkkci", h.colors.text)
1044
+ spacing: { top: m, right: G, bottom: A, left: p },
1045
+ warnOnMisalignment: S !== "none"
1046
+ }), _ = {
1047
+ padding: {
1048
+ top: m || 0,
1049
+ right: G || 0,
1050
+ bottom: A || 0,
1051
+ left: p || 0
1052
+ }
1053
+ }, { padding: V } = J(
1054
+ x && !w,
1055
+ _,
1056
+ B
1057
+ ), L = l.useMemo(() => {
1058
+ const N = u !== void 0 ? Number(u) : void 0, W = o !== void 0 ? Number(o) : void 0, X = a !== void 0 ? Number(a) : void 0;
1059
+ return ge(
1060
+ N,
1061
+ W,
1062
+ X
1063
+ );
1064
+ }, [u, o, a]), C = l.useMemo(
1065
+ () => he(h.colors),
1066
+ [h.colors]
1067
+ ), E = l.useMemo(() => {
1068
+ const N = O(b || "auto"), W = O(c || "auto"), X = me[i] || i, U = ["--bkkw", "--bkkh"], et = {
1069
+ ...k({
1070
+ key: "--bkkw",
1071
+ value: N,
1072
+ defaultStyles: C,
1073
+ skipDimensions: { auto: U }
1074
+ }),
1075
+ ...k({
1076
+ key: "--bkkh",
1077
+ value: W,
1078
+ defaultStyles: C,
1079
+ skipDimensions: { auto: U }
1080
+ }),
1081
+ ...k({
1082
+ key: "--bkkcl",
1083
+ value: h.colors.line,
1084
+ defaultStyles: C
1085
+ }),
1086
+ ...k({
1087
+ key: "--bkkcf",
1088
+ value: h.colors.flat,
1089
+ defaultStyles: C
1090
+ }),
1091
+ ...k({
1092
+ key: "--bkkci",
1093
+ value: h.colors.text,
1094
+ defaultStyles: C
1095
+ })
1450
1096
  };
1451
- return I({
1452
- flexDirection: i,
1453
- justifyContent: m,
1454
- alignItems: n,
1455
- width: A,
1456
- height: g
1457
- }, V, L, b);
1097
+ return q({
1098
+ flexDirection: X,
1099
+ justifyContent: f,
1100
+ alignItems: e,
1101
+ width: b,
1102
+ height: c
1103
+ }, L, et, M);
1458
1104
  }, [
1459
1105
  i,
1460
- m,
1461
- n,
1462
- A,
1463
- g,
1106
+ f,
1107
+ e,
1108
+ b,
1109
+ c,
1464
1110
  h.colors.line,
1465
1111
  h.colors.flat,
1466
1112
  h.colors.text,
1467
- R,
1468
- V,
1469
- b
1470
- ]), j = N === "none" ? {
1471
- ...w,
1472
- paddingBlock: `${E.top}px ${E.bottom}px`,
1473
- paddingInline: `${E.left}px ${E.right}px`
1474
- } : w;
1475
- return /* @__PURE__ */ _.jsx(
1476
- St,
1113
+ C,
1114
+ L,
1115
+ M
1116
+ ]), R = S === "none" ? {
1117
+ ...E,
1118
+ paddingBlock: `${V.top}px ${V.bottom}px`,
1119
+ paddingInline: `${V.left}px ${V.right}px`
1120
+ } : E;
1121
+ return /* @__PURE__ */ y(it, { spacer: { variant: v ?? "line" }, children: /* @__PURE__ */ y(
1122
+ at,
1477
1123
  {
1478
- spacer: { variant: v ?? "line" },
1479
- children: /* @__PURE__ */ _.jsx(
1480
- Ct,
1124
+ ref: I,
1125
+ block: [V.top, V.bottom],
1126
+ inline: [V.left, V.right],
1127
+ debugging: S,
1128
+ indicatorNode: d,
1129
+ width: b,
1130
+ height: c,
1131
+ ssrMode: w,
1132
+ children: /* @__PURE__ */ y(
1133
+ "div",
1481
1134
  {
1482
- ref: k,
1483
- className: $ ? qt.v : "",
1484
- block: [E.top, E.bottom],
1485
- inline: [E.left, E.right],
1486
- debugging: N,
1487
- indicatorNode: c,
1488
- width: A,
1489
- height: g,
1490
- children: /* @__PURE__ */ _.jsx(
1491
- "div",
1492
- {
1493
- "data-testid": "stack",
1494
- className: J(a, qt.stk),
1495
- style: j,
1496
- ...M,
1497
- children: o
1498
- }
1499
- )
1135
+ "data-testid": "stack",
1136
+ className: z(s, bt.stk, D && bt.v),
1137
+ style: R,
1138
+ ...g,
1139
+ children: n
1500
1140
  }
1501
1141
  )
1502
1142
  }
1503
- );
1504
- }), Ue = "gde_eT-MH", Ye = "line_xcGxq", Pe = "cols_LoPVp", Fe = "col_ZgTMC", nt = {
1505
- gde: Ue,
1506
- line: Ye,
1507
- cols: Pe,
1508
- col: Fe
1509
- }, rn = f.memo(function({
1510
- className: n,
1511
- debugging: o,
1512
- style: a,
1513
- variant: s,
1514
- align: r = "start",
1143
+ ) });
1144
+ }), pe = "gde_-Naxo", ke = "line_-VS-e", ye = "cols_8lD6D", ve = "col_rlbsL", xe = "ssr_VGvpO", H = {
1145
+ gde: pe,
1146
+ line: ke,
1147
+ cols: ye,
1148
+ col: ve,
1149
+ ssr: xe
1150
+ }, we = (t) => {
1151
+ const { variant: e, base: n, gap: s, columns: o, columnWidth: r } = t;
1152
+ switch (e) {
1153
+ case "line":
1154
+ return {
1155
+ variant: "line",
1156
+ gap: s,
1157
+ base: n
1158
+ };
1159
+ case "pattern":
1160
+ if (o && Array.isArray(o))
1161
+ return {
1162
+ variant: "pattern",
1163
+ columns: o,
1164
+ gap: s,
1165
+ base: n
1166
+ };
1167
+ break;
1168
+ case "fixed":
1169
+ if (o !== void 0) {
1170
+ const i = typeof o == "number" ? o : parseInt(String(o), 10);
1171
+ return {
1172
+ variant: "fixed",
1173
+ columns: isNaN(i) ? 12 : i,
1174
+ columnWidth: r || "60px",
1175
+ gap: s,
1176
+ base: n
1177
+ };
1178
+ }
1179
+ break;
1180
+ }
1181
+ return {
1182
+ variant: "auto",
1183
+ columnWidth: r || "1fr",
1184
+ gap: s,
1185
+ base: n
1186
+ };
1187
+ }, Se = (t, e) => ({
1188
+ "--bkgw": "auto",
1189
+ "--bkgh": "auto",
1190
+ "--bkgmw": "none",
1191
+ "--bkgcw": "60px",
1192
+ "--bkggw": "24px",
1193
+ "--bkgc": "12",
1194
+ "--bkgb": `${t}px`,
1195
+ "--bkgcl": e,
1196
+ "--bkgg": "0"
1197
+ }), Te = l.memo(function({
1198
+ className: e,
1199
+ debugging: n,
1200
+ style: s,
1201
+ variant: o,
1202
+ align: r = "center",
1515
1203
  gap: i,
1516
- height: d,
1517
- width: g,
1518
- columns: c,
1519
- columnWidth: m,
1520
- ...x
1204
+ height: a,
1205
+ width: c,
1206
+ columns: d,
1207
+ columnWidth: f,
1208
+ maxWidth: u,
1209
+ color: M,
1210
+ children: v,
1211
+ ssrMode: b = !1,
1212
+ ...w
1521
1213
  }) {
1522
- const b = X("guide"), v = s ?? b.variant, { isShown: A } = tt(o, b.debugging), M = f.useRef(null), { width: h, height: $ } = bt(M), { top: N, right: k, bottom: C, left: E } = f.useMemo(() => D(x), [x]), V = f.useMemo(() => {
1523
- const W = dt(i);
1524
- return {
1525
- line: {
1526
- variant: "line",
1527
- gap: W - 1,
1528
- base: b.base
1214
+ const g = T("guide"), h = o ?? g.variant, D = typeof i == "number" ? i : 0, { isShown: S } = j(n, g.debugging);
1215
+ if (!S)
1216
+ return /* @__PURE__ */ y(
1217
+ "div",
1218
+ {
1219
+ className: z(H.g, H.h, e),
1220
+ style: s,
1221
+ "data-testid": "guide",
1222
+ "data-variant": h,
1223
+ ...w,
1224
+ children: v
1225
+ }
1226
+ );
1227
+ const x = /* @__PURE__ */ y(
1228
+ "div",
1229
+ {
1230
+ className: z(H.g, H.h, H.ssr, e),
1231
+ style: {
1232
+ width: c || "100%",
1233
+ height: a || "100%",
1234
+ maxWidth: u || "none",
1235
+ ...s
1529
1236
  },
1530
- auto: m ? {
1531
- variant: "auto",
1532
- columnWidth: m,
1533
- gap: W,
1534
- base: b.base
1535
- } : null,
1536
- pattern: Array.isArray(c) ? {
1537
- variant: "pattern",
1538
- columns: c,
1539
- gap: W,
1540
- base: b.base
1541
- } : null,
1542
- fixed: typeof c == "number" ? {
1543
- variant: "fixed",
1544
- columns: c,
1545
- columnWidth: m,
1546
- gap: W,
1547
- base: b.base
1548
- } : null
1549
- }[v] ?? {
1550
- variant: "line",
1551
- gap: W - 1,
1552
- base: b.base
1237
+ "data-testid": "guide",
1238
+ "data-variant": h,
1239
+ children: v
1240
+ }
1241
+ );
1242
+ return /* @__PURE__ */ y(wt, { fallback: x, children: /* @__PURE__ */ y(
1243
+ Ce,
1244
+ {
1245
+ className: e,
1246
+ debugging: n,
1247
+ style: s,
1248
+ variant: h,
1249
+ align: r,
1250
+ gap: D,
1251
+ height: a,
1252
+ width: c,
1253
+ columns: d,
1254
+ columnWidth: f,
1255
+ maxWidth: u,
1256
+ color: M,
1257
+ ssrMode: b,
1258
+ ...w,
1259
+ children: v
1260
+ }
1261
+ ) });
1262
+ }), Ce = l.memo(function({
1263
+ className: e,
1264
+ debugging: n,
1265
+ style: s,
1266
+ variant: o,
1267
+ align: r = "center",
1268
+ gap: i,
1269
+ height: a,
1270
+ width: c,
1271
+ columns: d,
1272
+ columnWidth: f,
1273
+ maxWidth: u,
1274
+ color: M,
1275
+ children: v,
1276
+ ssrMode: b = !1,
1277
+ ...w
1278
+ }) {
1279
+ const g = T("guide"), { isShown: h } = j(n, g.debugging), D = l.useRef(null), {
1280
+ width: S,
1281
+ height: x,
1282
+ refresh: $
1283
+ // Keep the refresh function available for dynamic updates
1284
+ } = P(D);
1285
+ l.useEffect(() => {
1286
+ const R = () => {
1287
+ $();
1288
+ };
1289
+ return window.addEventListener("resize", R), () => {
1290
+ window.removeEventListener("resize", R);
1291
+ };
1292
+ }, [$]);
1293
+ const I = l.useMemo(() => {
1294
+ const R = o, N = typeof i == "number" ? i : 0;
1295
+ return we({
1296
+ variant: R,
1297
+ base: g.base,
1298
+ gap: N,
1299
+ columns: d,
1300
+ columnWidth: f
1301
+ });
1302
+ }, [o, g.base, i, d, f]), { template: m, columnsCount: G, calculatedGap: A } = Ee(
1303
+ D,
1304
+ I
1305
+ ), p = l.useMemo(
1306
+ () => Se(g.base, g.colors.line),
1307
+ [g.base, g.colors.line]
1308
+ ), B = l.useMemo(() => {
1309
+ const R = O(c || S || "auto"), N = O(a || x || "auto"), W = O(u || "none"), X = O(f || "60px"), U = ["--bkgw", "--bkgh"], et = {
1310
+ ...k({
1311
+ key: "--bkgw",
1312
+ value: R,
1313
+ defaultStyles: p,
1314
+ skipDimensions: { auto: U }
1315
+ }),
1316
+ ...k({
1317
+ key: "--bkgh",
1318
+ value: N,
1319
+ defaultStyles: p,
1320
+ skipDimensions: { auto: U }
1321
+ }),
1322
+ ...k({
1323
+ key: "--bkgmw",
1324
+ value: W,
1325
+ defaultStyles: p
1326
+ }),
1327
+ ...k({
1328
+ key: "--bkgcw",
1329
+ value: X,
1330
+ defaultStyles: p
1331
+ }),
1332
+ ...k({
1333
+ key: "--bkgc",
1334
+ value: `${G}`,
1335
+ defaultStyles: p
1336
+ }),
1337
+ ...k({
1338
+ key: "--bkgb",
1339
+ value: "0",
1340
+ defaultStyles: p
1341
+ }),
1342
+ ...k({
1343
+ key: "--bkgcl",
1344
+ value: M ?? g.colors.line,
1345
+ defaultStyles: p
1346
+ }),
1347
+ ...k({
1348
+ key: "--bkgg",
1349
+ value: `${A}px`,
1350
+ defaultStyles: p
1351
+ }),
1352
+ ...k({
1353
+ key: "--bkgj",
1354
+ value: r || "center",
1355
+ defaultStyles: p
1356
+ }),
1357
+ ...m && m !== "none" ? { "--bkgt": m } : {},
1358
+ // Add grid template if available
1359
+ ...m && m !== "none" ? { gridTemplateColumns: m } : {}
1553
1360
  };
1554
- }, [i, b.base, m, c, v]), {
1555
- template: O,
1556
- columnsCount: R,
1557
- calculatedGap: w
1558
- } = xe(M, V), j = f.useMemo(() => ({
1559
- "--bkgg": `${w}px`,
1560
- "--bkgj": "start",
1561
- "--bkgcl": b.colors.line,
1562
- "--bkgcp": b.colors.pattern,
1563
- "--bkgw": "100vw",
1564
- "--bkgh": "100vh"
1565
- }), [w, b.colors.line, b.colors.pattern]), y = f.useCallback(
1566
- (W, P) => W === "--bkgw" && P === "100vw" || W === "--bkgh" && P === "100vh" ? {} : P !== j[W] ? { [W]: P } : {},
1567
- [j]
1568
- ), T = {
1569
- "--bkgg": `${w}px`,
1570
- "--bkgj": r,
1571
- "--bkgcl": b.colors.line,
1572
- "--bkgcp": b.colors.pattern,
1573
- "--bkgpb": `${N}px ${C}px`,
1574
- "--bkgpi": `${E}px ${k}px`,
1575
- "--bkgt": O,
1576
- "--bkgw": U(g ?? h, 0) || "100vw",
1577
- "--bkgh": U(d ?? $, 0) || "100vh"
1578
- }, L = {
1579
- ...y("--bkgw", T["--bkgw"]),
1580
- ...y("--bkgh", T["--bkgh"]),
1581
- ...y("--bkgj", r),
1582
- ...y("--bkgcl", b.colors.line),
1583
- ...y("--bkgcp", b.colors.pattern),
1584
- ...y("--bkgg", `${w}px`)
1585
- }, B = I(T, L, a);
1586
- return /* @__PURE__ */ _.jsx(
1361
+ return q(et, s);
1362
+ }, [
1363
+ c,
1364
+ a,
1365
+ u,
1366
+ f,
1367
+ G,
1368
+ M,
1369
+ m,
1370
+ A,
1371
+ S,
1372
+ x,
1373
+ g.colors.line,
1374
+ p,
1375
+ s,
1376
+ r
1377
+ ]), _ = () => {
1378
+ const R = typeof i == "number" ? i : 0, N = R === 0 ? 0 : R - 1, W = N + 1;
1379
+ return { finalGap: N, actualGapWithLine: W };
1380
+ }, { finalGap: V, actualGapWithLine: L } = _(), C = typeof c == "number" ? c : S || 1024;
1381
+ let E;
1382
+ return V === 0 ? E = Math.floor(C) + 1 : o === "line" ? E = Math.max(
1383
+ 1,
1384
+ Math.floor((C + 1) / L) + 1
1385
+ ) : E = Math.max(
1386
+ 1,
1387
+ Math.floor(C / L) + 1
1388
+ ), /* @__PURE__ */ Z(
1587
1389
  "div",
1588
1390
  {
1589
- ref: M,
1391
+ ref: D,
1590
1392
  "data-testid": "guide",
1591
- className: J(
1592
- nt.gde,
1593
- n,
1594
- A ? nt.v : nt.h,
1595
- v === "line" && nt.line
1393
+ className: z(
1394
+ H.gde,
1395
+ e,
1396
+ h ? H.v : H.h,
1397
+ o === "line" && H.line
1596
1398
  ),
1597
- "data-variant": v,
1399
+ "data-variant": o,
1598
1400
  style: B,
1599
- ...x,
1600
- children: A && /* @__PURE__ */ _.jsx("div", { className: nt.cols, "data-variant": v, children: Array.from({ length: R }, (W, P) => {
1601
- const ct = b.colors[v] ?? b.colors.line;
1602
- return /* @__PURE__ */ _.jsx(
1603
- "div",
1604
- {
1605
- className: nt.col,
1606
- "data-column-index": P,
1607
- "data-variant": v,
1608
- style: { backgroundColor: ct }
1609
- },
1610
- P
1611
- );
1612
- }) })
1401
+ ...w,
1402
+ children: [
1403
+ h && /* @__PURE__ */ y("div", { className: H.cols, "data-variant": o, children: Array.from({ length: E }, (R, N) => {
1404
+ const W = g.colors[o] ?? g.colors.line;
1405
+ return /* @__PURE__ */ y(
1406
+ "div",
1407
+ {
1408
+ className: H.col,
1409
+ "data-column-index": N,
1410
+ "data-variant": o,
1411
+ style: { backgroundColor: W }
1412
+ },
1413
+ N
1414
+ );
1415
+ }) }),
1416
+ v
1417
+ ]
1613
1418
  }
1614
1419
  );
1615
- }), He = /^\d*\.?\d+(?:fr|px|%|em|rem|vh|vw|vmin|vmax|pt|pc|in|cm|mm)$/, Ie = (e) => typeof e == "number" ? Number.isFinite(e) && e >= 0 : typeof e != "string" ? !1 : e === "auto" || e === "100%" || He.test(e), qe = (e) => Array.isArray(e) && e.length > 0 && e.every(Ie), sn = (e) => {
1616
- const n = [...Object.keys(wt), ...Xt];
1617
- return typeof e == "number" || typeof e == "string" && n.some((o) => e.endsWith(o));
1618
- }, an = (e) => typeof e == "string" && De.includes(e), Rt = (e) => typeof e == "object" && e !== null, cn = (e) => Rt(e) && e.variant === "line", ln = (e) => Rt(e) && "columns" in e && !("variant" in e), un = (e) => Rt(e) && "columnWidth" in e && !("variant" in e) && !("columns" in e), Je = "bas_qAJSK", Xe = "row_y6My5", ft = {
1619
- bas: Je,
1620
- row: Xe
1621
- }, fn = f.memo(function({
1622
- className: n,
1623
- debugging: o,
1624
- style: a,
1625
- variant: s,
1420
+ }), Me = /^\d*\.?\d+(?:fr|px|%|em|rem|vh|vw|vmin|vmax|pt|pc|in|cm|mm)$/, $e = (t) => typeof t == "number" ? Number.isFinite(t) && t >= 0 : typeof t != "string" ? !1 : t === "auto" || t === "100%" || Me.test(t), Re = (t) => Array.isArray(t) && t.length > 0 && t.every($e);
1421
+ function Ee(t, e) {
1422
+ const { width: n } = P(t), s = l.useRef(!1);
1423
+ return l.useMemo(() => {
1424
+ const o = e.variant ?? "line", r = e.base ?? 8, i = st(e.gap ?? 0, { base: r });
1425
+ if (!n)
1426
+ return {
1427
+ template: "none",
1428
+ columnsCount: 0,
1429
+ calculatedGap: 0,
1430
+ isValid: !1
1431
+ };
1432
+ try {
1433
+ switch (o) {
1434
+ case "line": {
1435
+ const a = i === 0 ? 0 : i - 1, c = a + 1;
1436
+ let d;
1437
+ return a === 0 ? d = Math.max(1, Math.floor(n) + 1) : d = Math.max(
1438
+ 1,
1439
+ Math.floor((n + 1) / c) + 1
1440
+ ), {
1441
+ template: `repeat(${d}, 1px)`,
1442
+ columnsCount: d,
1443
+ calculatedGap: i > 0 ? i - 1 : i,
1444
+ isValid: !0
1445
+ };
1446
+ }
1447
+ case "pattern": {
1448
+ if (!e.columns || !Array.isArray(e.columns))
1449
+ throw new Error("Missing or invalid pattern columns");
1450
+ if (!Re(e.columns))
1451
+ throw new Error('Invalid "pattern" columns array');
1452
+ const a = e.columns.map(
1453
+ (c) => typeof c == "number" ? `${c}px` : c
1454
+ );
1455
+ return a.some((c) => c === "0" || c === "0px") ? {
1456
+ template: "none",
1457
+ columnsCount: 0,
1458
+ calculatedGap: 0,
1459
+ isValid: !1
1460
+ } : {
1461
+ template: a.join(" "),
1462
+ columnsCount: a.length,
1463
+ calculatedGap: i,
1464
+ isValid: !0
1465
+ };
1466
+ }
1467
+ case "fixed": {
1468
+ const a = typeof e.columns == "number" ? e.columns : 0;
1469
+ if (a < 1)
1470
+ throw new Error(`Invalid columns count: ${a}`);
1471
+ const c = e.columnWidth ? O(e.columnWidth) : "1fr";
1472
+ return {
1473
+ template: `repeat(${a}, ${c})`,
1474
+ columnsCount: a,
1475
+ calculatedGap: i,
1476
+ isValid: !0
1477
+ };
1478
+ }
1479
+ case "auto": {
1480
+ const a = e.columnWidth ?? "auto";
1481
+ if (a === "auto")
1482
+ return {
1483
+ template: "repeat(auto-fill, minmax(0, 1fr))",
1484
+ columnsCount: 1,
1485
+ calculatedGap: i,
1486
+ isValid: !0
1487
+ };
1488
+ const c = typeof a == "number" ? `${a}px` : a.toString(), d = pt(c) ?? 0, f = d > 0 ? Math.max(1, Math.floor((n + i) / (d + i))) : 1;
1489
+ return {
1490
+ template: `repeat(auto-fill, ${c})`,
1491
+ columnsCount: f,
1492
+ calculatedGap: i,
1493
+ isValid: !0
1494
+ };
1495
+ }
1496
+ default: {
1497
+ s.current || (console.warn(
1498
+ `[useGuide] Unknown variant "${o}". Falling back to "line".`
1499
+ ), s.current = !0);
1500
+ const a = Math.max(1, Math.floor(n / (i + 1)) + 1);
1501
+ return {
1502
+ template: `repeat(${a}, 1px)`,
1503
+ columnsCount: a,
1504
+ calculatedGap: i,
1505
+ isValid: !0
1506
+ };
1507
+ }
1508
+ }
1509
+ } catch (a) {
1510
+ return console.warn("Error in useGuide:", a), {
1511
+ template: "none",
1512
+ columnsCount: 0,
1513
+ calculatedGap: 0,
1514
+ isValid: !1
1515
+ };
1516
+ }
1517
+ }, [e, n]);
1518
+ }
1519
+ function T(t) {
1520
+ const e = gt();
1521
+ return Q(() => Object.assign(
1522
+ { base: e.base },
1523
+ e[t]
1524
+ ), [e, t]);
1525
+ }
1526
+ function j(t, e) {
1527
+ return Q(() => {
1528
+ const n = t ?? e;
1529
+ return {
1530
+ isShown: n === "visible",
1531
+ isHidden: n === "hidden",
1532
+ isNone: n === "none",
1533
+ debugging: n
1534
+ };
1535
+ }, [t, e]);
1536
+ }
1537
+ const Ve = "bas_e-SXr", Ge = "row_q-FZb", Oe = "ssr_W1N5g", F = {
1538
+ bas: Ve,
1539
+ row: Ge,
1540
+ ssr: Oe
1541
+ }, De = (t, e, n) => ({
1542
+ "--bkbw": "100%",
1543
+ "--bkbh": "100%",
1544
+ "--bkbb": `${t}px`,
1545
+ "--bkbcl": e,
1546
+ "--bkbcf": n
1547
+ }), _e = (t) => {
1548
+ const { index: e, base: n, variant: s, chosenColor: o, lineColor: r, flatColor: i } = t;
1549
+ return {
1550
+ "--bkrt": e === 0 ? "0px" : `${e * n}px`,
1551
+ "--bkrh": s === "line" ? "1px" : `${n}px`,
1552
+ "--bkbc": o || (s === "line" ? r : i)
1553
+ };
1554
+ }, Ae = l.memo(function({
1555
+ className: e,
1556
+ debugging: n,
1557
+ style: s,
1558
+ variant: o,
1626
1559
  height: r,
1627
1560
  width: i,
1628
- base: d,
1629
- ...g
1561
+ base: a,
1562
+ color: c,
1563
+ ssrMode: d = !1,
1564
+ ...f
1630
1565
  }) {
1631
- const c = X("baseline"), m = s ?? c.variant, x = d ?? c.base, { isShown: b } = tt(o, c.debugging), v = f.useRef(null), { width: A, height: M } = bt(v), [h, $] = f.useMemo(() => Dt(
1566
+ const u = T("baseline"), { isShown: M } = j(n, u.debugging), v = l.useRef(null), {
1567
+ width: b,
1568
+ height: w,
1569
+ refresh: g
1570
+ } = P(v);
1571
+ l.useEffect(() => {
1572
+ const C = () => {
1573
+ g();
1574
+ };
1575
+ return window.addEventListener("resize", C), () => {
1576
+ window.removeEventListener("resize", C);
1577
+ };
1578
+ }, [g]);
1579
+ const [h, D] = l.useMemo(() => kt(
1632
1580
  [i, r],
1633
- [A, M]
1634
- ), [i, r, A, M]), { top: N, right: k, bottom: C, left: E } = f.useMemo(
1635
- () => D(g),
1636
- [g]
1637
- ), V = f.useMemo(() => {
1638
- const T = ($ ?? 0) - (N + C);
1639
- return Math.max(1, Math.floor(T / x));
1640
- }, [$, N, C, x]), { start: O, end: R } = pe({
1641
- totalLines: V,
1642
- lineHeight: x,
1581
+ [b, w]
1582
+ ), [i, r, b, w]), { top: S, right: x, bottom: $, left: I } = l.useMemo(
1583
+ () => Y(f),
1584
+ [f]
1585
+ ), m = l.useMemo(() => {
1586
+ const C = [S, x, $, I].map((E) => E ? `${E}px` : "0").join(" ");
1587
+ return C !== "0 0 0 0" ? C : void 0;
1588
+ }, [S, x, $, I]), G = l.useMemo(() => {
1589
+ const C = a || u.base;
1590
+ return Nt({
1591
+ height: D,
1592
+ top: S,
1593
+ bottom: $,
1594
+ base: C
1595
+ });
1596
+ }, [D, S, $, a, u.base]), { start: A, end: p } = Ut({
1597
+ totalLines: G,
1598
+ lineHeight: a || u.base,
1643
1599
  containerRef: v,
1644
1600
  buffer: 160
1645
- }), w = m === "line" ? c.colors.line : c.colors.flat, j = f.useMemo(() => {
1646
- const T = [N, k, C, E].map((L) => L ? `${L}px` : "0").join(" ");
1647
- return I(
1601
+ }), B = c || (o === "line" ? u.colors.line : u.colors.flat), _ = l.useMemo(
1602
+ () => De(
1603
+ a || u.base,
1604
+ u.colors.line,
1605
+ u.colors.flat
1606
+ ),
1607
+ [a, u.colors.line, u.colors.flat, u.base]
1608
+ ), V = l.useMemo(() => {
1609
+ const C = O(i || "100%"), E = O(r || "100%"), R = ["--bkbw", "--bkbh"];
1610
+ return q(
1648
1611
  {
1649
- "--bkbw": i ? `${h}px` : "100%",
1650
- "--bkbh": r ? `${$}px` : "100%",
1651
- ...T !== "0 0 0 0" && { padding: T }
1612
+ ...k({
1613
+ key: "--bkbw",
1614
+ value: C,
1615
+ defaultStyles: _,
1616
+ skipDimensions: { fullSize: R }
1617
+ }),
1618
+ ...k({
1619
+ key: "--bkbh",
1620
+ value: E,
1621
+ defaultStyles: _,
1622
+ skipDimensions: { fullSize: R }
1623
+ }),
1624
+ ...k({
1625
+ key: "--bkbb",
1626
+ value: `${a}px`,
1627
+ defaultStyles: _
1628
+ }),
1629
+ ...k({
1630
+ key: "--bkbcl",
1631
+ value: c || u.colors.line,
1632
+ defaultStyles: _
1633
+ }),
1634
+ ...k({
1635
+ key: "--bkbcf",
1636
+ value: c || u.colors.flat,
1637
+ defaultStyles: _
1638
+ }),
1639
+ ...m && { padding: m }
1652
1640
  },
1653
- a
1641
+ s
1654
1642
  );
1655
1643
  }, [
1656
- N,
1657
- k,
1658
- C,
1659
- E,
1660
1644
  i,
1661
- h,
1662
1645
  r,
1663
- $,
1664
- a
1665
- ]), y = f.useCallback(
1666
- (T) => {
1667
- const L = m === "line" ? "1px" : `${x}px`, B = m === "line" ? c.colors.line : c.colors.flat;
1668
- return I({
1669
- "--bkrt": `${T * x}px`,
1670
- ...L !== "1px" && { "--bkrh": L },
1671
- ...w !== B && { "--bkbcl": w }
1646
+ a,
1647
+ c,
1648
+ u.colors.line,
1649
+ u.colors.flat,
1650
+ m,
1651
+ _,
1652
+ s
1653
+ ]), L = l.useCallback(
1654
+ (C) => {
1655
+ const E = o, R = a || u.base;
1656
+ return _e({
1657
+ index: C,
1658
+ base: R,
1659
+ variant: E,
1660
+ chosenColor: B,
1661
+ lineColor: u.colors.line,
1662
+ flatColor: u.colors.flat
1672
1663
  });
1673
1664
  },
1674
- [x, m, w, c.colors.line, c.colors.flat]
1665
+ [
1666
+ a,
1667
+ o,
1668
+ B,
1669
+ u.colors.line,
1670
+ u.colors.flat,
1671
+ u.base
1672
+ ]
1675
1673
  );
1676
- return /* @__PURE__ */ _.jsx(
1674
+ return /* @__PURE__ */ y(
1677
1675
  "div",
1678
1676
  {
1679
1677
  ref: v,
1680
1678
  "data-testid": "baseline",
1681
- className: J(
1682
- ft.bas,
1683
- b ? ft.v : ft.h,
1684
- n
1679
+ className: z(
1680
+ F.bas,
1681
+ M ? F.v : F.h,
1682
+ e
1685
1683
  ),
1686
- style: j,
1687
- ...g,
1688
- children: b && Array.from({ length: R - O }, (T, L) => {
1689
- const B = L + O;
1690
- return /* @__PURE__ */ _.jsx(
1684
+ style: V,
1685
+ ...f,
1686
+ children: M && Array.from({ length: p - A }, (C, E) => {
1687
+ const R = E + A;
1688
+ return /* @__PURE__ */ y(
1691
1689
  "div",
1692
1690
  {
1693
- className: ft.row,
1694
- "data-row-index": B,
1695
- style: y(B)
1691
+ className: F.row,
1692
+ "data-row-index": R,
1693
+ style: L(R)
1696
1694
  },
1697
- B
1695
+ R
1698
1696
  );
1699
1697
  })
1700
1698
  }
1701
1699
  );
1702
- }), De = ["start", "center", "end"], dn = ["line", "flat"];
1700
+ }), Fe = l.memo(function({
1701
+ className: e,
1702
+ debugging: n,
1703
+ style: s,
1704
+ variant: o,
1705
+ height: r,
1706
+ width: i,
1707
+ base: a,
1708
+ color: c,
1709
+ ssrMode: d = !1,
1710
+ ...f
1711
+ }) {
1712
+ const u = T("baseline"), M = o ?? u.variant, v = a ?? u.base, { isShown: b } = j(n, u.debugging);
1713
+ if (!b)
1714
+ return /* @__PURE__ */ y(
1715
+ "div",
1716
+ {
1717
+ className: z(F.b, F.h, e),
1718
+ style: s,
1719
+ "data-testid": "baseline",
1720
+ ...f
1721
+ }
1722
+ );
1723
+ const w = /* @__PURE__ */ y(
1724
+ "div",
1725
+ {
1726
+ className: z(F.b, F.h, F.ssr, e),
1727
+ style: {
1728
+ width: i || "100%",
1729
+ height: r || "100%",
1730
+ ...s
1731
+ },
1732
+ "data-testid": "baseline"
1733
+ }
1734
+ );
1735
+ return /* @__PURE__ */ y(wt, { fallback: w, children: /* @__PURE__ */ y(
1736
+ Ae,
1737
+ {
1738
+ className: e,
1739
+ debugging: n,
1740
+ style: s,
1741
+ variant: M,
1742
+ height: r,
1743
+ width: i,
1744
+ base: v,
1745
+ color: c,
1746
+ ssrMode: d,
1747
+ ...f
1748
+ }
1749
+ ) });
1750
+ });
1703
1751
  export {
1704
- wt as ABSOLUTE_UNIT_CONVERSIONS,
1705
- fn as Baseline,
1706
- nn as Box,
1707
- St as Config,
1708
- _e as DEFAULT_CONFIG,
1709
- De as GRID_ALIGNMENTS,
1710
- rn as Guide,
1711
- en as Layout,
1712
- dn as PADD_VARIANTS,
1713
- Ct as Padder,
1714
- Xt as RELATIVE_UNITS,
1715
- $e as Spacer,
1716
- on as Stack,
1717
- ge as calculateSnappedSpacing,
1718
- fe as clamp,
1719
- yt as convertValue,
1720
- je as createCSSVariables,
1721
- tn as debounce,
1722
- U as formatValue,
1723
- un as isAutoCalculatedGuide,
1724
- an as isGuideAlignment,
1725
- ln as isGuideColumnConfig,
1726
- cn as isGuideLineConfig,
1727
- sn as isGuideValue,
1728
- Ie as isValidGuideColumnValue,
1729
- qe as isValidGuidePattern,
1730
- J as mergeClasses,
1731
- Zt as mergeRefs,
1732
- I as mergeStyles,
1733
- Ke as moduloize,
1734
- dt as normalizeValue,
1735
- Dt as normalizeValuePair,
1736
- D as parsePadding,
1737
- le as parseUnit,
1738
- Kt as rafThrottle,
1739
- Qe as round,
1740
- mt as useBaseline,
1741
- X as useConfig,
1742
- tt as useDebug,
1743
- Qt as useDefaultConfig,
1744
- xe as useGuide,
1745
- bt as useMeasure,
1746
- pe as useVirtual
1752
+ Fe as Baseline,
1753
+ ze as Box,
1754
+ it as Config,
1755
+ Te as Guide,
1756
+ We as Layout,
1757
+ at as Padder,
1758
+ Qt as Spacer,
1759
+ He as Stack,
1760
+ xt as isSSR,
1761
+ Be as safeClientValue
1747
1762
  };
1748
1763
  //# sourceMappingURL=index.mjs.map