baseline-kit 5.0.0 → 5.2.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 (94) hide show
  1. package/CHANGELOG.md +243 -0
  2. package/README.md +227 -353
  3. package/dist/baseline-kit.css +5 -2
  4. package/dist/core.cjs +1 -1
  5. package/dist/core.d.ts +25 -9
  6. package/dist/core.mjs +1 -1
  7. package/dist/guide.cjs +1 -1
  8. package/dist/guide.cjs.map +1 -1
  9. package/dist/guide.css +1 -1
  10. package/dist/guide.d.ts +16 -16
  11. package/dist/guide.mjs +147 -150
  12. package/dist/guide.mjs.map +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +22 -12
  16. package/dist/index.mjs +169 -158
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/remix-server.d.ts +8 -0
  19. package/dist/remix-server.mjs +15 -0
  20. package/dist/remix-server.mjs.map +1 -0
  21. package/dist/remix.css +2 -0
  22. package/dist/remix.d.ts +191 -0
  23. package/dist/remix.mjs +984 -0
  24. package/dist/remix.mjs.map +1 -0
  25. package/dist/{src-QHaSfgVe.js → src-D0nL1BwZ.js} +96 -165
  26. package/dist/src-D0nL1BwZ.js.map +1 -0
  27. package/dist/src-R5usYJol.cjs +2 -0
  28. package/dist/src-R5usYJol.cjs.map +1 -0
  29. package/dist/styles.css +1 -1
  30. package/dist/theme/default.css +0 -1
  31. package/dist/theme/tokens.css +0 -1
  32. package/dist/theme.css +4 -1
  33. package/package.json +86 -37
  34. package/dist/README.md +0 -468
  35. package/dist/core/src/config/defaults.d.ts +0 -2
  36. package/dist/core/src/config/index.d.ts +0 -3
  37. package/dist/core/src/config/merge.d.ts +0 -21
  38. package/dist/core/src/config/schema.d.ts +0 -33
  39. package/dist/core/src/descriptors/baseline.d.ts +0 -26
  40. package/dist/core/src/descriptors/box.d.ts +0 -20
  41. package/dist/core/src/descriptors/guide.d.ts +0 -44
  42. package/dist/core/src/descriptors/index.d.ts +0 -5
  43. package/dist/core/src/descriptors/padder.d.ts +0 -19
  44. package/dist/core/src/descriptors/spacer.d.ts +0 -24
  45. package/dist/core/src/index.d.ts +0 -10
  46. package/dist/core/src/types.d.ts +0 -62
  47. package/dist/core/src/utils/convert.d.ts +0 -10
  48. package/dist/core/src/utils/grid.d.ts +0 -18
  49. package/dist/core/src/utils/index.d.ts +0 -8
  50. package/dist/core/src/utils/math.d.ts +0 -9
  51. package/dist/core/src/utils/merge.d.ts +0 -28
  52. package/dist/core/src/utils/normalize.d.ts +0 -13
  53. package/dist/core/src/utils/padding.d.ts +0 -2
  54. package/dist/core/src/utils/parse.d.ts +0 -5
  55. package/dist/core/src/utils/snapping.d.ts +0 -2
  56. package/dist/core/src/validation/guide.d.ts +0 -3
  57. package/dist/core/src/validation/index.d.ts +0 -1
  58. package/dist/dom/src/index.d.ts +0 -11
  59. package/dist/dom/src/measure.d.ts +0 -18
  60. package/dist/dom/src/observers.d.ts +0 -5
  61. package/dist/dom/src/ssr.d.ts +0 -20
  62. package/dist/dom/src/timing.d.ts +0 -2
  63. package/dist/dom/src/viewport.d.ts +0 -7
  64. package/dist/dom/src/virtual.d.ts +0 -23
  65. package/dist/react/src/components/Baseline/Baseline.d.ts +0 -13
  66. package/dist/react/src/components/Baseline/index.d.ts +0 -1
  67. package/dist/react/src/components/Box/Box.d.ts +0 -26
  68. package/dist/react/src/components/Box/index.d.ts +0 -1
  69. package/dist/react/src/components/Config/Config.d.ts +0 -20
  70. package/dist/react/src/components/Config/index.d.ts +0 -2
  71. package/dist/react/src/components/Guide/Guide.d.ts +0 -16
  72. package/dist/react/src/components/Guide/index.d.ts +0 -1
  73. package/dist/react/src/components/Padder/Padder.d.ts +0 -20
  74. package/dist/react/src/components/Padder/index.d.ts +0 -1
  75. package/dist/react/src/components/Spacer/Spacer.d.ts +0 -14
  76. package/dist/react/src/components/Spacer/index.d.ts +0 -1
  77. package/dist/react/src/components/index.d.ts +0 -12
  78. package/dist/react/src/components/types.d.ts +0 -29
  79. package/dist/react/src/guide.d.ts +0 -10
  80. package/dist/react/src/hooks/index.d.ts +0 -10
  81. package/dist/react/src/hooks/useBaseline.d.ts +0 -26
  82. package/dist/react/src/hooks/useConfig.d.ts +0 -9
  83. package/dist/react/src/hooks/useDebug.d.ts +0 -6
  84. package/dist/react/src/hooks/useGuide.d.ts +0 -7
  85. package/dist/react/src/hooks/useIsClient.d.ts +0 -4
  86. package/dist/react/src/hooks/useMeasure.d.ts +0 -10
  87. package/dist/react/src/hooks/useVirtual.d.ts +0 -14
  88. package/dist/react/src/index.d.ts +0 -21
  89. package/dist/react/src/utils/index.d.ts +0 -9
  90. package/dist/react/src/utils/merge.d.ts +0 -10
  91. package/dist/react/src/utils/ssr.d.ts +0 -1
  92. package/dist/src-CMjyHjX5.cjs +0 -2
  93. package/dist/src-CMjyHjX5.cjs.map +0 -1
  94. package/dist/src-QHaSfgVe.js.map +0 -1
package/dist/remix.mjs ADDED
@@ -0,0 +1,984 @@
1
+ import { clientEntry as e, ref as t } from "remix/ui";
2
+ import { jsx as n, jsxs as r } from "remix/ui/jsx-runtime";
3
+ //#region packages/core/src/config/defaults.ts
4
+ var i = {
5
+ base: 8,
6
+ baseline: {
7
+ variant: "line",
8
+ debugging: "hidden",
9
+ colors: {
10
+ line: "var(--bk-baseline-color-line-theme, hsla(240, 60%, 40%, 0.15))",
11
+ flat: "var(--bk-baseline-color-flat-theme, hsla(230, 100%, 70%, 0.2))"
12
+ }
13
+ },
14
+ guide: {
15
+ variant: "line",
16
+ debugging: "hidden",
17
+ colors: {
18
+ line: "var(--bk-guide-color-line-theme, hsla(240, 60%, 40%, 0.15))",
19
+ pattern: "var(--bk-guide-color-pattern-theme, hsla(230, 100%, 70%, 0.2))",
20
+ auto: "var(--bk-guide-color-auto-theme, hsla(200, 100%, 70%, 0.15))",
21
+ fixed: "var(--bk-guide-color-fixed-theme, hsla(200, 100%, 70%, 0.15))"
22
+ }
23
+ },
24
+ spacer: {
25
+ variant: "line",
26
+ debugging: "hidden",
27
+ colors: {
28
+ line: "var(--bk-spacer-color-line-theme, hsla(270, 60%, 40%, 0.6))",
29
+ flat: "var(--bk-spacer-color-flat-theme, hsla(230, 100%, 70%, 0.2))",
30
+ text: "var(--bk-spacer-color-text-theme, hsla(270, 60%, 40%, 1))"
31
+ }
32
+ },
33
+ box: {
34
+ debugging: "hidden",
35
+ colors: {
36
+ line: "var(--bk-box-color-line-theme, hsla(300, 60%, 40%, 0.6))",
37
+ flat: "var(--bk-box-color-flat-theme, hsla(260, 100%, 70%, 0.2))",
38
+ text: "var(--bk-box-color-text-theme, hsla(300, 60%, 40%, 0.9))"
39
+ }
40
+ },
41
+ padder: {
42
+ debugging: "hidden",
43
+ color: "var(--bk-padder-color-theme, hsla(270, 60%, 40%, 0.6))"
44
+ }
45
+ }, a = [
46
+ "baseline",
47
+ "guide",
48
+ "spacer",
49
+ "box",
50
+ "padder"
51
+ ], o = (e) => {
52
+ let { parentConfig: t, base: n } = e, r = {};
53
+ for (let n of a) {
54
+ let i = e[n], a = t[n], o = {
55
+ ...a,
56
+ ...i
57
+ };
58
+ i && "colors" in i && i.colors && "colors" in a && (o.colors = {
59
+ ...a.colors,
60
+ ...i.colors
61
+ }), r[n] = o;
62
+ }
63
+ return {
64
+ base: n ?? t.base,
65
+ ...r
66
+ };
67
+ };
68
+ //#endregion
69
+ //#region packages/core/src/utils/parse.ts
70
+ function s(e) {
71
+ let t = e.trim().match(/^([+-]?[\d.]+)([a-zA-Z%]+)$/);
72
+ return t ? {
73
+ value: parseFloat(t[1]),
74
+ unit: t[2]
75
+ } : null;
76
+ }
77
+ function c(e, t) {
78
+ return e === void 0 && t !== void 0 ? `${t}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 ?? "";
79
+ }
80
+ //#endregion
81
+ //#region packages/core/src/utils/convert.ts
82
+ var l = {
83
+ parentSize: 0,
84
+ viewportWidth: 1920,
85
+ viewportHeight: 1080,
86
+ rootFontSize: 16,
87
+ parentFontSize: 16
88
+ }, u = {
89
+ px: 1,
90
+ in: 96,
91
+ cm: 37.8,
92
+ mm: 3.78,
93
+ pt: 1.33,
94
+ pc: 16
95
+ }, d = {
96
+ em: (e) => e.parentFontSize,
97
+ rem: (e) => e.rootFontSize,
98
+ vh: (e) => e.viewportHeight / 100,
99
+ vw: (e) => e.viewportWidth / 100,
100
+ vmin: (e) => Math.min(e.viewportWidth, e.viewportHeight) / 100,
101
+ vmax: (e) => Math.max(e.viewportWidth, e.viewportHeight) / 100,
102
+ "%": (e) => e.parentSize / 100
103
+ };
104
+ function f(e, t) {
105
+ if (typeof e == "number") return e;
106
+ if (typeof e != "string") return null;
107
+ let n = s(e);
108
+ if (!n) return null;
109
+ let { value: r, unit: i } = n;
110
+ if (i in u) return r * u[i];
111
+ if (i === "auto") return null;
112
+ let a = d[i];
113
+ return a ? r * a({
114
+ ...l,
115
+ ...t
116
+ }) : null;
117
+ }
118
+ //#endregion
119
+ //#region packages/core/src/utils/math.ts
120
+ function p(e, t, n) {
121
+ return Math.min(Math.max(e, t), n);
122
+ }
123
+ function m(e) {
124
+ let { height: t, top: n, bottom: r, base: i } = e, a = (t ?? 0) - (n + r);
125
+ return Math.max(1, Math.floor(a / i));
126
+ }
127
+ //#endregion
128
+ //#region packages/core/src/utils/normalize.ts
129
+ function h(e, t = {}) {
130
+ let { base: n = 8, round: r = !0, clamp: i, context: a } = t;
131
+ if (e === "auto") return n;
132
+ let o = null;
133
+ if (typeof e == "number" ? o = e : typeof e == "string" && (o = f(e, a) ?? n), o === null && (o = n), n <= 0) return o;
134
+ let s = r ? Math.round(o / n) * n : o;
135
+ return i === void 0 ? s : p(s, i.min ?? -Infinity, i.max ?? Infinity);
136
+ }
137
+ function g(e, t, n) {
138
+ return !e || e[0] === void 0 && e[1] === void 0 ? t : [e[0] === void 0 ? t[0] : h(e[0], n), e[1] === void 0 ? t[1] : h(e[1], n)];
139
+ }
140
+ //#endregion
141
+ //#region packages/core/src/utils/padding.ts
142
+ function _(e) {
143
+ if ("padding" in e && e.padding != null) return v(e.padding);
144
+ let t = "block" in e && e.block != null ? y(e.block) : {
145
+ top: 0,
146
+ bottom: 0
147
+ }, n = "inline" in e && e.inline != null ? b(e.inline) : {
148
+ left: 0,
149
+ right: 0
150
+ };
151
+ return {
152
+ top: t.top,
153
+ right: n.right,
154
+ bottom: t.bottom,
155
+ left: n.left
156
+ };
157
+ }
158
+ function v(e) {
159
+ if (typeof e == "number") return {
160
+ top: e,
161
+ right: e,
162
+ bottom: e,
163
+ left: e
164
+ };
165
+ if (Array.isArray(e)) {
166
+ let [t = 0, n = 0, r, i] = e;
167
+ return {
168
+ top: t,
169
+ right: n,
170
+ bottom: r ?? t,
171
+ left: i ?? n
172
+ };
173
+ }
174
+ return typeof e == "object" ? {
175
+ top: e.top ?? 0,
176
+ right: e.right ?? 0,
177
+ bottom: e.bottom ?? 0,
178
+ left: e.left ?? 0
179
+ } : {
180
+ top: 0,
181
+ right: 0,
182
+ bottom: 0,
183
+ left: 0
184
+ };
185
+ }
186
+ function y(e) {
187
+ if (typeof e == "number") return {
188
+ top: e,
189
+ bottom: e
190
+ };
191
+ if (Array.isArray(e)) {
192
+ let [t, n] = e;
193
+ return {
194
+ top: t ?? 0,
195
+ bottom: n ?? 0
196
+ };
197
+ }
198
+ return typeof e == "object" ? {
199
+ top: e.start ?? 0,
200
+ bottom: e.end ?? 0
201
+ } : {
202
+ top: 0,
203
+ bottom: 0
204
+ };
205
+ }
206
+ function b(e) {
207
+ if (typeof e == "number") return {
208
+ left: e,
209
+ right: e
210
+ };
211
+ if (Array.isArray(e)) {
212
+ let [t, n] = e;
213
+ return {
214
+ left: t ?? 0,
215
+ right: n ?? 0
216
+ };
217
+ }
218
+ return typeof e == "object" ? {
219
+ left: e.start ?? 0,
220
+ right: e.end ?? 0
221
+ } : {
222
+ left: 0,
223
+ right: 0
224
+ };
225
+ }
226
+ //#endregion
227
+ //#region packages/core/src/utils/snapping.ts
228
+ function x(e, t, n, r) {
229
+ let i = _({ padding: n }), a = typeof r == "string" ? r : r.mode, o = typeof r == "string" ? "bottom" : r.snapEdge ?? "bottom";
230
+ if (a === "none") return i;
231
+ if (a === "height") {
232
+ let n = e % t;
233
+ if (n !== 0) {
234
+ let e = t - n;
235
+ o === "top" ? i.top += e : i.bottom += e;
236
+ }
237
+ }
238
+ if (a === "clamp") {
239
+ i.top %= t;
240
+ let n = e % t;
241
+ n !== 0 && (i.bottom += t - n), i.bottom %= t;
242
+ }
243
+ return i;
244
+ }
245
+ //#endregion
246
+ //#region packages/core/src/utils/merge.ts
247
+ function S(e, t, n) {
248
+ let r = typeof e == "string" ? e : e.key, i = typeof e == "string" ? t : e.value, a = typeof e == "string" ? n : e.defaultStyles, o = typeof e == "object" ? e.skipDimensions : void 0;
249
+ return o && (o.fitContent?.includes(r) && i === "fit-content" || o.auto?.includes(r) && i === "auto" || o.fullSize?.includes(r) && (i === "100%" || i === "100vh" || i === "100vw")) || i === a[r] ? {} : { [r]: i };
250
+ }
251
+ //#endregion
252
+ //#region packages/core/src/validation/guide.ts
253
+ var ee = /^\d*\.?\d+(?:fr|px|%|em|rem|vh|vw|vmin|vmax|pt|pc|in|cm|mm)$/, C = (e) => typeof e == "number" ? Number.isFinite(e) && e >= 0 : typeof e == "string" ? e === "auto" || e === "100%" || ee.test(e) : !1, te = (e) => Array.isArray(e) && e.length > 0 && e.every(C), w = {
254
+ template: "none",
255
+ columnsCount: 0,
256
+ calculatedGap: 0,
257
+ isValid: !1
258
+ };
259
+ function ne(e, t, n) {
260
+ let r = t.variant ?? "line", i = t.base ?? 8, a = h(t.gap ?? 0, {
261
+ base: i,
262
+ context: n
263
+ });
264
+ if (!e) return w;
265
+ switch (r) {
266
+ case "line": {
267
+ let t = a === 0 ? 0 : a - 1, n = t + 1, r = t === 0 ? Math.max(1, Math.floor(e) + 1) : Math.max(1, Math.floor((e + 1) / n) + 1);
268
+ return {
269
+ template: `repeat(${r}, 1px)`,
270
+ columnsCount: r,
271
+ calculatedGap: a > 0 ? a - 1 : a,
272
+ isValid: !0
273
+ };
274
+ }
275
+ case "pattern": {
276
+ if (!t.columns || !Array.isArray(t.columns) || !te(t.columns)) return w;
277
+ let e = t.columns.map((e) => typeof e == "number" ? `${e}px` : e);
278
+ return e.some((e) => e === "0" || e === "0px") ? w : {
279
+ template: e.join(" "),
280
+ columnsCount: e.length,
281
+ calculatedGap: a,
282
+ isValid: !0
283
+ };
284
+ }
285
+ case "fixed": {
286
+ let e = typeof t.columns == "number" ? t.columns : 0;
287
+ return e < 1 ? w : {
288
+ template: `repeat(${e}, ${t.columnWidth ? c(t.columnWidth) : "1fr"})`,
289
+ columnsCount: e,
290
+ calculatedGap: a,
291
+ isValid: !0
292
+ };
293
+ }
294
+ case "auto": {
295
+ let r = t.columnWidth ?? "auto";
296
+ if (r === "auto") return {
297
+ template: "repeat(auto-fill, minmax(0, 1fr))",
298
+ columnsCount: 1,
299
+ calculatedGap: a,
300
+ isValid: !0
301
+ };
302
+ let i = typeof r == "number" ? `${r}px` : r.toString(), o = f(i, n) ?? 0, s = o > 0 ? Math.max(1, Math.floor((e + a) / (o + a))) : 1;
303
+ return {
304
+ template: `repeat(auto-fill, ${i})`,
305
+ columnsCount: s,
306
+ calculatedGap: a,
307
+ isValid: !0
308
+ };
309
+ }
310
+ default: {
311
+ let t = Math.max(1, Math.floor(e / (a + 1)) + 1);
312
+ return {
313
+ template: `repeat(${t}, 1px)`,
314
+ columnsCount: t,
315
+ calculatedGap: a,
316
+ isValid: !0
317
+ };
318
+ }
319
+ }
320
+ }
321
+ var T = (e, t, n) => {
322
+ let r = {};
323
+ return e === void 0 ? (t !== void 0 && (r.gridColumn = `span ${t}`), n !== void 0 && (r.gridRow = `span ${n}`)) : (r.gridColumn = `span ${e}`, r.gridRow = `span ${e}`), r;
324
+ };
325
+ //#endregion
326
+ //#region packages/core/src/descriptors/guide.ts
327
+ function E({ variant: e, base: t, gap: n, columns: r, columnWidth: i }) {
328
+ switch (e) {
329
+ case "line": return {
330
+ variant: "line",
331
+ gap: n,
332
+ base: t
333
+ };
334
+ case "pattern":
335
+ if (r && Array.isArray(r)) return {
336
+ variant: "pattern",
337
+ columns: r,
338
+ gap: n,
339
+ base: t
340
+ };
341
+ break;
342
+ case "fixed": if (r !== void 0) {
343
+ let e = typeof r == "number" ? r : parseInt(String(r), 10);
344
+ return {
345
+ variant: "fixed",
346
+ columns: isNaN(e) ? 12 : e,
347
+ columnWidth: i || "60px",
348
+ gap: n,
349
+ base: t
350
+ };
351
+ }
352
+ }
353
+ return {
354
+ variant: "auto",
355
+ columnWidth: i || "1fr",
356
+ gap: n,
357
+ base: t
358
+ };
359
+ }
360
+ var D = (e, t) => ({
361
+ "--bkgd-w": "100%",
362
+ "--bkgd-h": "100%",
363
+ "--bkgd-mw": "none",
364
+ "--bkgd-cw": "60px",
365
+ "--bkgd-gw": "24px",
366
+ "--bkgd-n": "12",
367
+ "--bkgd-b": `${e}px`,
368
+ "--bkgd-cl": t,
369
+ "--bkgd-g": "0"
370
+ });
371
+ function O(e) {
372
+ let { base: t, colors: n, variant: r, align: i, width: a, height: o, columnWidth: s, maxWidth: l, color: u, template: d, columnsCount: f, calculatedGap: p, isVisible: m } = e, h = D(t, n.line), g = {
373
+ "--bkgd-cl": u ?? n.line,
374
+ "--bkgd-cp": u ?? n.pattern,
375
+ "--bkgd-ca": u ?? n.auto,
376
+ "--bkgd-cf": u ?? n.fixed,
377
+ "--bkgd-w": c(a ?? "100%"),
378
+ "--bkgd-h": c(o ?? "100%"),
379
+ ...S({
380
+ key: "--bkgd-mw",
381
+ value: c(l || "none"),
382
+ defaultStyles: h
383
+ }),
384
+ ...S({
385
+ key: "--bkgd-cw",
386
+ value: c(s || "60px"),
387
+ defaultStyles: h
388
+ }),
389
+ ...S({
390
+ key: "--bkgd-n",
391
+ value: `${f}`,
392
+ defaultStyles: h
393
+ }),
394
+ ...S({
395
+ key: "--bkgd-b",
396
+ value: "0",
397
+ defaultStyles: h
398
+ }),
399
+ ...S({
400
+ key: "--bkgd-cl",
401
+ value: u ?? n.line,
402
+ defaultStyles: h
403
+ }),
404
+ ...S({
405
+ key: "--bkgd-g",
406
+ value: `${p}px`,
407
+ defaultStyles: h
408
+ }),
409
+ ...S({
410
+ key: "--bkgd-j",
411
+ value: i || "center",
412
+ defaultStyles: h
413
+ }),
414
+ ...d && d !== "none" ? { "--bkgd-t": d } : {}
415
+ }, _ = u ?? (r && r in n ? n[r] : void 0) ?? n.line, v = r === "line", y = ["gde", m ? "v" : "h"];
416
+ return v && y.push("line"), v && (g["--bkgd-line-color"] = "var(--bkgd-cl)", g["--bkgd-line-period"] = `${p + 1}px`), {
417
+ containerStyle: g,
418
+ columnColor: _,
419
+ columnsCount: f,
420
+ calculatedGap: p,
421
+ template: d,
422
+ isVisible: m,
423
+ isLineVariant: v,
424
+ classTokens: y
425
+ };
426
+ }
427
+ //#endregion
428
+ //#region packages/core/src/descriptors/baseline.ts
429
+ function k(e) {
430
+ let { base: t, colors: n, variant: r, width: i, height: a, color: o, containerWidth: s, containerHeight: l, spacing: u, isVisible: d } = e, { top: f, right: p, bottom: h, left: v } = _(u), y = [
431
+ f,
432
+ p,
433
+ h,
434
+ v
435
+ ].map((e) => e ? `${e}px` : "0").join(" "), b = y === "0 0 0 0" ? void 0 : y, x = m({
436
+ height: l > 0 ? l : g([void 0, a], [s, 0])[1],
437
+ top: f,
438
+ bottom: h,
439
+ base: t
440
+ });
441
+ return {
442
+ containerStyle: {
443
+ ...i === void 0 ? {} : { "--bkbl-w": c(i) },
444
+ ...a === void 0 ? {} : { "--bkbl-h": c(a) },
445
+ "--bkbl-cl": o ?? n.line,
446
+ "--bkbl-cf": o ?? n.flat,
447
+ "--bkbl-c": r === "line" ? "var(--bkbl-cl)" : "var(--bkbl-cf)",
448
+ ...b ? { padding: b } : {}
449
+ },
450
+ rowCount: x,
451
+ getRowStyle: (e) => ({
452
+ "--bkbl-rt": e === 0 ? "0px" : `${e * t}px`,
453
+ "--bkbl-rh": r === "line" ? "1px" : `${t}px`
454
+ }),
455
+ padding: b,
456
+ isVisible: d,
457
+ classTokens: ["bas", d ? "v" : "h"]
458
+ };
459
+ }
460
+ //#endregion
461
+ //#region packages/core/src/descriptors/box.ts
462
+ function A(e) {
463
+ let { lineColor: t, width: n, height: r, span: i, colSpan: a, rowSpan: o, isVisible: s } = e, l = {
464
+ ...n === void 0 ? {} : { "--bkbx-w": c(n) },
465
+ ...r === void 0 ? {} : { "--bkbx-h": c(r) },
466
+ "--bkbx-cl": t
467
+ }, u = T(i, a, o), d = ["box"];
468
+ return s && d.push("v"), {
469
+ boxStyle: l,
470
+ gridSpanStyle: u,
471
+ classTokens: d
472
+ };
473
+ }
474
+ //#endregion
475
+ //#region packages/core/src/descriptors/spacer.ts
476
+ function j(e) {
477
+ let { base: t, colors: n, width: r, height: i, color: a, variant: o, isVisible: s } = e, [l, u] = g([r, i], [0, 0], {
478
+ base: t,
479
+ suppressWarnings: !0
480
+ }), d = {
481
+ ...i === void 0 ? {} : { "--bksp-h": c(u) },
482
+ ...r === void 0 ? {} : { "--bksp-w": c(l) },
483
+ "--bksp-b": `${t}px`,
484
+ "--bksp-ct": a ?? n.text,
485
+ "--bksp-cl": a ?? n.line,
486
+ "--bksp-cf": a ?? n.flat
487
+ }, f = ["spr"];
488
+ return s && f.push(o), {
489
+ style: d,
490
+ normWidth: l,
491
+ normHeight: u,
492
+ classTokens: f
493
+ };
494
+ }
495
+ //#endregion
496
+ //#region packages/core/src/descriptors/padder.ts
497
+ function re(e) {
498
+ let { base: t, color: n, width: r, height: i, padding: a, enableSpacers: o, isVisible: s } = e, l = {};
499
+ if (r !== void 0 && r !== "fit-content" && (l["--bkpd-w"] = c(r)), i !== void 0 && i !== "fit-content" && (l["--bkpd-h"] = c(i)), l["--bkpd-b"] = `${t}px`, l["--bkpd-c"] = n, !o) {
500
+ let { top: e, right: t, bottom: n, left: r } = a;
501
+ (e > 0 || n > 0) && (l.paddingBlock = `${e}px ${n}px`), (r > 0 || t > 0) && (l.paddingInline = `${r}px ${t}px`);
502
+ }
503
+ let u = ["pad"];
504
+ return s && o && u.push("v"), {
505
+ containerStyle: l,
506
+ classTokens: u
507
+ };
508
+ }
509
+ //#endregion
510
+ //#region packages/remix/src/Config.ts
511
+ function M(e) {
512
+ return () => {
513
+ let t = o({
514
+ parentConfig: e.props.__baselineConfig ?? e.context.get(N) ?? i,
515
+ base: e.props.base,
516
+ baseline: e.props.baseline,
517
+ guide: e.props.guide,
518
+ spacer: e.props.spacer,
519
+ box: e.props.box,
520
+ padder: e.props.padder
521
+ });
522
+ return e.context.set(t), e.props.children ?? null;
523
+ };
524
+ }
525
+ var N = M, P = (e) => {
526
+ let t = null, n = null;
527
+ return [(...r) => {
528
+ n = r, t !== null && cancelAnimationFrame(t), t = requestAnimationFrame(() => {
529
+ e(...n), t = null, n = null;
530
+ });
531
+ }, () => {
532
+ t !== null && (cancelAnimationFrame(t), t = null, n = null);
533
+ }];
534
+ };
535
+ //#endregion
536
+ //#region packages/dom/src/measure.ts
537
+ function F(e, t) {
538
+ let n = {
539
+ width: 0,
540
+ height: 0
541
+ }, r = () => {
542
+ try {
543
+ let r = e.getBoundingClientRect(), i = {
544
+ width: Math.round(r.width),
545
+ height: Math.round(r.height)
546
+ };
547
+ (i.width !== n.width || i.height !== n.height) && (n = i, t(i));
548
+ } catch {}
549
+ }, [i, a] = P(r);
550
+ r();
551
+ let o = new ResizeObserver(i);
552
+ return o.observe(e), {
553
+ refresh: i,
554
+ disconnect() {
555
+ o.disconnect(), a();
556
+ }
557
+ };
558
+ }
559
+ //#endregion
560
+ //#region packages/dom/src/virtual.ts
561
+ function I(e, t, n) {
562
+ let { totalItems: r, itemHeight: i, buffer: a = 0 } = t;
563
+ if (!Number.isFinite(i) || i <= 0) throw Error("createVirtualTracker requires itemHeight to be greater than 0");
564
+ if (!Number.isFinite(r) || r < 0) throw Error("createVirtualTracker requires totalItems to be 0 or greater");
565
+ let o = () => {
566
+ let t = e.getBoundingClientRect().top + window.scrollY, n = Math.max(0, window.scrollY - t - a), o = n + window.innerHeight + a * 2;
567
+ return {
568
+ start: Math.max(0, Math.floor(n / i)),
569
+ end: Math.min(r, Math.ceil(o / i))
570
+ };
571
+ }, s = {
572
+ start: 0,
573
+ end: r
574
+ }, [c, l] = P(() => {
575
+ let e = o();
576
+ (e.start !== s.start || e.end !== s.end) && (s = e, n(e));
577
+ }), u = { passive: !0 };
578
+ window.addEventListener("scroll", c, u), window.addEventListener("resize", c, u);
579
+ let d = new IntersectionObserver(c, { threshold: 0 });
580
+ return d.observe(e), c(), {
581
+ refresh: c,
582
+ disconnect() {
583
+ window.removeEventListener("scroll", c, u), window.removeEventListener("resize", c, u), d.disconnect(), l();
584
+ }
585
+ };
586
+ }
587
+ //#endregion
588
+ //#region packages/remix/src/shared.tsx
589
+ function L(...e) {
590
+ return e.filter(Boolean).join(" ");
591
+ }
592
+ function R(...e) {
593
+ let t = {};
594
+ for (let n of e) if (n) {
595
+ if (typeof n == "string") {
596
+ t.cssText = n;
597
+ continue;
598
+ }
599
+ Object.assign(t, n);
600
+ }
601
+ return t;
602
+ }
603
+ function z(e, t, n) {
604
+ return e.context.get(t) ?? n;
605
+ }
606
+ function B(e, t) {
607
+ let n = e ?? t;
608
+ return {
609
+ isShown: n === "visible",
610
+ isNone: n === "none",
611
+ debugging: n
612
+ };
613
+ }
614
+ var V = 40, H = /* @__PURE__ */ new WeakSet(), U = [], W = !1;
615
+ function G() {
616
+ W = !1;
617
+ let e = U.splice(0, V);
618
+ for (let t of e) {
619
+ if (t.signal.aborted) {
620
+ H.delete(t);
621
+ continue;
622
+ }
623
+ try {
624
+ t.update().catch(() => void 0).finally(() => H.delete(t));
625
+ } catch {
626
+ H.delete(t);
627
+ }
628
+ }
629
+ U.length > 0 && K();
630
+ }
631
+ function K() {
632
+ W || (W = !0, setTimeout(typeof requestAnimationFrame == "function" ? () => requestAnimationFrame(G) : () => setTimeout(G, 0), 0));
633
+ }
634
+ function q(e) {
635
+ e.signal.aborted || H.has(e) || (H.add(e), U.push(e), K());
636
+ }
637
+ function J(t, r) {
638
+ let a = e(t, r);
639
+ return ((e) => () => {
640
+ let t = e.context.get(N), r = e.props.__baselineConfig ?? t ?? i;
641
+ return /* @__PURE__ */ n(a, {
642
+ ...e.props,
643
+ __baselineConfig: r
644
+ });
645
+ });
646
+ }
647
+ function Y(e) {
648
+ let n = null, r, i = !1, a = 0, o = (e) => {
649
+ e.aborted || i || a >= 10 || (a += 1, r?.refresh(), requestAnimationFrame(() => o(e)));
650
+ };
651
+ return {
652
+ attach: t((t, s) => {
653
+ n = t, typeof ResizeObserver < "u" && (r = F(t, (t) => {
654
+ i = t.width > 0 || t.height > 0;
655
+ let n = () => {
656
+ s.aborted || e(t);
657
+ };
658
+ typeof requestAnimationFrame == "function" ? requestAnimationFrame(n) : queueMicrotask(n);
659
+ }), queueMicrotask(() => {
660
+ s.aborted || (r?.refresh(), requestAnimationFrame(() => o(s)));
661
+ })), s.addEventListener("abort", () => {
662
+ r?.disconnect(), r = void 0, i = !1, a = 0, n = null;
663
+ }, { once: !0 });
664
+ }),
665
+ getElement: () => n
666
+ };
667
+ }
668
+ function ie(e, t, n, r = 160) {
669
+ let i, a = "", o = 0, s = {
670
+ start: 0,
671
+ end: 0
672
+ }, c = () => {
673
+ i?.disconnect(), i = void 0, a = "";
674
+ };
675
+ return e.signal.addEventListener("abort", c, { once: !0 }), {
676
+ setConfig: (e, l) => {
677
+ let u = t();
678
+ if (!u || typeof IntersectionObserver > "u") return;
679
+ let d = `${e}:${l}:${r}`;
680
+ d !== a && (c(), a = d, o = e, s = {
681
+ start: 0,
682
+ end: e
683
+ }, n(s), i = I(u, {
684
+ totalItems: e,
685
+ itemHeight: l,
686
+ buffer: r
687
+ }, (e) => {
688
+ s = e, n(e);
689
+ }));
690
+ },
691
+ getRange(e) {
692
+ return {
693
+ start: Math.min(Math.max(s.start, 0), e),
694
+ end: Math.min(Math.max(e === o && s.end || e, 0), e)
695
+ };
696
+ },
697
+ dispose: c
698
+ };
699
+ }
700
+ //#endregion
701
+ //#region packages/remix/src/Baseline.tsx
702
+ function ae(e) {
703
+ let t = {
704
+ width: 0,
705
+ height: 0
706
+ }, r = () => {
707
+ q(e);
708
+ }, a = Y((e) => {
709
+ (e.width !== t.width || e.height !== t.height) && (t = e, r());
710
+ }), o = ie(e, a.getElement, r);
711
+ return () => {
712
+ let r = e.props, s = r.__baselineConfig ?? z(e, N, i), l = r.base ?? s.base, u = r.variant ?? s.baseline.variant, d = B(r.debugging, s.baseline.debugging), f = k({
713
+ base: l,
714
+ colors: s.baseline.colors,
715
+ variant: u,
716
+ width: r.width,
717
+ height: r.height,
718
+ color: r.color,
719
+ containerWidth: t.width,
720
+ containerHeight: t.height,
721
+ spacing: {
722
+ padding: r.padding,
723
+ block: r.block,
724
+ inline: r.inline
725
+ },
726
+ isVisible: d.isShown
727
+ });
728
+ if (r.ssrMode) return /* @__PURE__ */ n("div", {
729
+ className: L("bk-bas", "bk-h", "bk-ssr", r.className),
730
+ "data-testid": "baseline",
731
+ "aria-hidden": !0,
732
+ style: R(f.containerStyle, {
733
+ width: c(r.width ?? "100%"),
734
+ height: c(r.height ?? "100%")
735
+ }, r.style)
736
+ });
737
+ d.isShown && e.queueTask(() => o.setConfig(f.rowCount, l));
738
+ let p = o.getRange(f.rowCount), m = d.isShown ? Array.from({ length: Math.max(0, p.end - p.start) }, (e, t) => {
739
+ let r = p.start + t;
740
+ return /* @__PURE__ */ n("div", {
741
+ className: "bk-row",
742
+ "data-row-index": r,
743
+ style: f.getRowStyle(r)
744
+ }, r);
745
+ }) : [];
746
+ return /* @__PURE__ */ n("div", {
747
+ className: L(...f.classTokens.map((e) => `bk-${e}`), r.className),
748
+ "data-testid": "baseline",
749
+ "aria-hidden": !0,
750
+ style: R(f.containerStyle, {
751
+ width: c(r.width ?? "100%"),
752
+ height: c(r.height ?? "100%")
753
+ }, r.style),
754
+ mix: typeof window > "u" || r.ssrMode ? void 0 : a.attach,
755
+ children: m
756
+ });
757
+ };
758
+ }
759
+ var oe = J(`${import.meta.url}#Baseline`, ae);
760
+ //#endregion
761
+ //#region packages/remix/src/Guide.tsx
762
+ function se(e) {
763
+ let t = {
764
+ width: 0,
765
+ height: 0
766
+ }, a = () => {
767
+ q(e);
768
+ }, o = Y((e) => {
769
+ (e.width !== t.width || e.height !== t.height) && (t = e, a());
770
+ });
771
+ return () => {
772
+ let a = e.props, s = a.__baselineConfig ?? z(e, N, i), c = a.variant ?? s.guide.variant, l = B(a.debugging, s.guide.debugging), u = E({
773
+ variant: c,
774
+ base: s.base,
775
+ gap: a.gap ?? 0,
776
+ columns: a.columns,
777
+ columnWidth: a.columnWidth
778
+ }), d = ne(t.width, u, {
779
+ viewportWidth: typeof window > "u" ? void 0 : window.innerWidth,
780
+ viewportHeight: typeof window > "u" ? void 0 : window.innerHeight
781
+ }), f = O({
782
+ base: s.base,
783
+ colors: s.guide.colors,
784
+ variant: c,
785
+ align: a.align ?? "center",
786
+ width: a.width,
787
+ height: a.height,
788
+ columnWidth: a.columnWidth,
789
+ maxWidth: a.maxWidth,
790
+ color: a.color,
791
+ template: d.template,
792
+ columnsCount: d.columnsCount,
793
+ calculatedGap: d.calculatedGap,
794
+ isVisible: l.isShown
795
+ });
796
+ if (a.ssrMode) return /* @__PURE__ */ n("div", {
797
+ className: L("bk-gde", "bk-h", "bk-ssr", a.className),
798
+ "data-testid": "guide",
799
+ "data-variant": c,
800
+ "aria-hidden": !0,
801
+ style: R({
802
+ width: a.width ?? "100%",
803
+ height: a.height ?? "100%",
804
+ maxWidth: a.maxWidth ?? "none"
805
+ }, a.style),
806
+ children: a.children
807
+ });
808
+ let p = !f.isLineVariant && l.isShown ? Array.from({ length: f.columnsCount }, (e, t) => /* @__PURE__ */ n("div", {
809
+ className: "bk-col",
810
+ "data-column-index": t,
811
+ "data-variant": c
812
+ }, t)) : null, m = l.isShown ? /* @__PURE__ */ n("div", {
813
+ className: "bk-cols",
814
+ "data-variant": c,
815
+ children: p
816
+ }) : null;
817
+ return /* @__PURE__ */ r("div", {
818
+ className: L(...f.classTokens.map((e) => `bk-${e}`), a.className),
819
+ "data-testid": "guide",
820
+ "data-variant": c,
821
+ "aria-hidden": !0,
822
+ style: R(f.containerStyle, a.style),
823
+ mix: typeof window > "u" || a.ssrMode ? void 0 : o.attach,
824
+ children: [m, a.children]
825
+ });
826
+ };
827
+ }
828
+ var ce = J(`${import.meta.url}#Guide`, se);
829
+ //#endregion
830
+ //#region packages/remix/src/Spacer.tsx
831
+ function le(e) {
832
+ return () => {
833
+ let t = e.props, a = t.__baselineConfig ?? z(e, N, i), o = t.base ?? a.base, s = t.variant ?? a.spacer.variant, c = B(t.debugging, a.spacer.debugging), l = j({
834
+ base: o,
835
+ colors: a.spacer.colors,
836
+ width: t.width,
837
+ height: t.height,
838
+ color: t.color,
839
+ variant: s,
840
+ isVisible: c.isShown
841
+ }), u = c.isShown && t.indicatorNode ? [l.normHeight === 0 ? null : /* @__PURE__ */ n("span", {
842
+ className: "bk-indicator",
843
+ "aria-hidden": !0,
844
+ children: t.indicatorNode(l.normHeight, "height")
845
+ }, "height"), l.normWidth === 0 ? null : /* @__PURE__ */ n("span", {
846
+ className: "bk-indicator",
847
+ "aria-hidden": !0,
848
+ children: t.indicatorNode(l.normWidth, "width")
849
+ }, "width")] : null;
850
+ return /* @__PURE__ */ r("div", {
851
+ className: L(...l.classTokens.map((e) => `bk-${e}`), t.className),
852
+ "data-testid": "spacer",
853
+ "data-variant": s,
854
+ "data-height": `${l.normHeight}px`,
855
+ style: R(l.style, t.style),
856
+ children: [u, t.children]
857
+ });
858
+ };
859
+ }
860
+ var X = J(`${import.meta.url}#Spacer`, le), ue = X, Z = { gridColumn: "1 / -1" }, Q = { gridRow: "2 / 3" }, de = {
861
+ gridRow: "2 / 3",
862
+ gridColumn: "2 / 3"
863
+ };
864
+ function fe(e) {
865
+ let t = i.base, r = _({}), a = null, o = Y(({ height: n }) => {
866
+ e.props.ssrMode || a || n === 0 || (a = x(n, t, r, "height"), q(e));
867
+ });
868
+ return () => {
869
+ let s = e.props, c = s.__baselineConfig ?? z(e, N, i), l = B(s.debugging, c.padder.debugging);
870
+ t = c.base, r = _({
871
+ padding: s.padding,
872
+ block: s.block,
873
+ inline: s.inline
874
+ });
875
+ let u = s.ssrMode ? r : a ?? r, d = typeof window > "u" || s.ssrMode ? void 0 : o.attach, f = re({
876
+ base: c.base,
877
+ color: c.padder.color,
878
+ width: s.width,
879
+ height: s.height,
880
+ padding: u,
881
+ enableSpacers: !l.isNone,
882
+ isVisible: l.isShown
883
+ });
884
+ if (l.isNone) return /* @__PURE__ */ n("div", {
885
+ className: L(...f.classTokens.map((e) => `bk-${e}`), s.className),
886
+ "data-testid": "padder",
887
+ mix: d,
888
+ style: R(f.containerStyle, s.style),
889
+ children: s.children
890
+ });
891
+ let p = c.spacer.variant, m = (e, t) => /* @__PURE__ */ n(ue, {
892
+ __baselineConfig: c,
893
+ width: e === "100%" ? void 0 : e,
894
+ height: t === "100%" ? void 0 : t,
895
+ variant: p,
896
+ debugging: l.debugging,
897
+ indicatorNode: s.indicatorNode
898
+ }), h = [
899
+ u.top >= 0 ? /* @__PURE__ */ n("div", {
900
+ style: Z,
901
+ children: m("100%", u.top)
902
+ }, "top") : null,
903
+ u.left >= 0 ? /* @__PURE__ */ n("div", {
904
+ style: Q,
905
+ children: m(u.left, "100%")
906
+ }, "left") : null,
907
+ /* @__PURE__ */ n("div", {
908
+ className: "bk-pad-content",
909
+ "data-testid": "padder-content",
910
+ style: de,
911
+ children: s.children
912
+ }, "content"),
913
+ u.right >= 0 ? /* @__PURE__ */ n("div", {
914
+ style: Q,
915
+ children: m(u.right, "100%")
916
+ }, "right") : null,
917
+ u.bottom >= 0 ? /* @__PURE__ */ n("div", {
918
+ style: Z,
919
+ children: m("100%", u.bottom)
920
+ }, "bottom") : null
921
+ ];
922
+ return /* @__PURE__ */ n("div", {
923
+ className: L(...f.classTokens.map((e) => `bk-${e}`), s.className),
924
+ "data-testid": "padder",
925
+ mix: d,
926
+ style: R(f.containerStyle, s.style),
927
+ children: h
928
+ });
929
+ };
930
+ }
931
+ var $ = J(`${import.meta.url}#Padder`, fe), pe = N;
932
+ function me(e) {
933
+ let t = i.base, r = "clamp", a = "bottom", o = _({}), s = null, c = () => {
934
+ q(e);
935
+ }, l = Y((e) => {
936
+ r === "none" || s || e.height === 0 || (s = x(e.height, t, o, {
937
+ mode: r,
938
+ snapEdge: a
939
+ }), c());
940
+ });
941
+ return () => {
942
+ let c = e.props, u = c.__baselineConfig ?? z(e, N, i), d = c.snapping ?? "clamp", f = c.snapEdge ?? "bottom", p = B(c.debugging, u.box.debugging), m = _({
943
+ padding: c.padding,
944
+ block: c.block,
945
+ inline: c.inline
946
+ });
947
+ t = u.base, r = d, a = f, o = m;
948
+ let h = d === "none" ? m : s ?? m, g = A({
949
+ base: u.base,
950
+ lineColor: u.box.colors.line,
951
+ width: c.width,
952
+ height: c.height,
953
+ span: c.span,
954
+ colSpan: c.colSpan,
955
+ rowSpan: c.rowSpan,
956
+ isVisible: p.isShown
957
+ }), v = /* @__PURE__ */ n($, {
958
+ block: [h.top, h.bottom],
959
+ inline: [h.left, h.right],
960
+ width: "fit-content",
961
+ height: c.height,
962
+ debugging: p.debugging,
963
+ ssrMode: !0,
964
+ children: c.children
965
+ });
966
+ return /* @__PURE__ */ n("div", {
967
+ className: L(...g.classTokens.map((e) => `bk-${e}`), c.className),
968
+ "data-testid": "box",
969
+ style: R(g.boxStyle, g.gridSpanStyle, c.style),
970
+ mix: typeof window > "u" || c.ssrMode || d === "none" ? void 0 : l.attach,
971
+ children: /* @__PURE__ */ n(pe, {
972
+ __baselineConfig: u,
973
+ base: 1,
974
+ spacer: { variant: "flat" },
975
+ children: v
976
+ })
977
+ });
978
+ };
979
+ }
980
+ var he = J(`${import.meta.url}#Box`, me);
981
+ //#endregion
982
+ export { oe as Baseline, he as Box, N as Config, ce as Guide, $ as Padder, X as Spacer };
983
+
984
+ //# sourceMappingURL=remix.mjs.map