@povio/ui 5.0.0-rc.5 → 5.0.0-rc.7

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.
@@ -8,7 +8,6 @@ import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
8
8
  import { t as ChevronUp } from "./chevron-up-D_Gqpb5M.js";
9
9
  import { t as FileUpload } from "./FileUpload--7ub3EZO.js";
10
10
  import { t as PasswordInput } from "./PasswordInput-DYwUZ4-k.js";
11
- import { t as Table } from "./Table-piX1SWvN.js";
12
11
  import { t as Info } from "./info-iUmX3uDk.js";
13
12
  import { i as Search } from "./selectDesktop.cva-CHAMxhfO.js";
14
13
  import { t as UIOverrides } from "./uiOverrides.context-BTCH9y5a.js";
@@ -46,8 +45,10 @@ import { t as Dialog } from "./Dialog-9manOgMA.js";
46
45
  import { Pagination } from "./components/pagination.js";
47
46
  import { t as Alert } from "./Alert-CnvEb1D_.js";
48
47
  import { t as Toast } from "./Toast-DtG3pA61.js";
48
+ import { t as Table } from "./Table-BN2_J_Ne.js";
49
49
  import { Link } from "./components/link.js";
50
50
  import { Badge } from "./components/badge.js";
51
+ import { t as inspectTokens } from "./token-classes-Bfcx0get.js";
51
52
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
52
53
  import { c } from "react/compiler-runtime";
53
54
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -309,168 +310,6 @@ const __iconData = {
309
310
  __iconData.node;
310
311
  const Users = createLucideIcon(__iconData);
311
312
  //#endregion
312
- //#region src/configurator/inspector/token-classes.ts
313
- /** Tailwind breakpoints from the Atlas base theme, in rem. */
314
- const breakpoints = {
315
- sm: 23.75,
316
- md: 37.5,
317
- lg: 80,
318
- xl: 105
319
- };
320
- /** Utility prefix → the slots it sets, its specificity, and the theme namespace its value lives in. */
321
- const utilities = [
322
- [
323
- "p",
324
- [
325
- "padding.top",
326
- "padding.right",
327
- "padding.bottom",
328
- "padding.left"
329
- ],
330
- 0,
331
- "spacing"
332
- ],
333
- [
334
- "px",
335
- ["padding.left", "padding.right"],
336
- 1,
337
- "spacing"
338
- ],
339
- [
340
- "py",
341
- ["padding.top", "padding.bottom"],
342
- 1,
343
- "spacing"
344
- ],
345
- [
346
- "pt",
347
- ["padding.top"],
348
- 2,
349
- "spacing"
350
- ],
351
- [
352
- "pr",
353
- ["padding.right"],
354
- 2,
355
- "spacing"
356
- ],
357
- [
358
- "pe",
359
- ["padding.right"],
360
- 2,
361
- "spacing"
362
- ],
363
- [
364
- "pb",
365
- ["padding.bottom"],
366
- 2,
367
- "spacing"
368
- ],
369
- [
370
- "pl",
371
- ["padding.left"],
372
- 2,
373
- "spacing"
374
- ],
375
- [
376
- "ps",
377
- ["padding.left"],
378
- 2,
379
- "spacing"
380
- ],
381
- [
382
- "gap",
383
- ["gap.row", "gap.column"],
384
- 0,
385
- "spacing"
386
- ],
387
- [
388
- "gap-x",
389
- ["gap.column"],
390
- 1,
391
- "spacing"
392
- ],
393
- [
394
- "gap-y",
395
- ["gap.row"],
396
- 1,
397
- "spacing"
398
- ],
399
- [
400
- "rounded",
401
- ["radius"],
402
- 0,
403
- "radius"
404
- ]
405
- ];
406
- /** Splits `md:hover:px-4` into its variants and utility, ignoring colons inside `[...]` / `(...)`. */
407
- function splitVariants(className) {
408
- const parts = [];
409
- let depth = 0;
410
- let current = "";
411
- for (const char of className) {
412
- if (char === "[" || char === "(") depth++;
413
- if (char === "]" || char === ")") depth--;
414
- if (char === ":" && depth === 0) {
415
- parts.push(current);
416
- current = "";
417
- } else current += char;
418
- }
419
- return {
420
- variants: parts,
421
- utility: current
422
- };
423
- }
424
- /** Breakpoint weight when every variant is an active breakpoint; `undefined` for state variants or inactive breakpoints. */
425
- function variantWeight(variants, viewportWidth, rootFontSize) {
426
- let weight = 0;
427
- for (const variant of variants) {
428
- const max = variant.startsWith("max-");
429
- const size = breakpoints[max ? variant.slice(4) : variant];
430
- if (size === void 0) return void 0;
431
- if (!(max ? viewportWidth < size * rootFontSize : viewportWidth >= size * rootFontSize)) return void 0;
432
- weight = Math.max(weight, size);
433
- }
434
- return weight;
435
- }
436
- function tokenFor(value, namespace, isKnown) {
437
- const referenced = value.match(/^\[.*?var\((--[\w-]+)/)?.[1] ?? value.match(/^\((--[\w-]+)\)$/)?.[1];
438
- if (referenced) return isKnown(referenced) ? referenced : void 0;
439
- const name = `--${namespace}-${value}`;
440
- return isKnown(name) ? name : void 0;
441
- }
442
- /**
443
- * Resolves which theme tokens drive an element's padding, gap and radius from its rendered Tailwind classes.
444
- * Only tokens accepted by `isKnown` are returned, so every result can be opened in the editor.
445
- */
446
- function inspectTokens(className, isKnown, viewportWidth = Infinity, rootFontSize = 16) {
447
- const winners = /* @__PURE__ */ new Map();
448
- for (const raw of className.split(/\s+/).filter(Boolean)) {
449
- const { variants, utility } = splitVariants(raw);
450
- const weight = variantWeight(variants, viewportWidth, rootFontSize);
451
- if (weight === void 0) continue;
452
- const clean = utility.replace(/^!|!$/g, "");
453
- for (const [prefix, slots, specificity, namespace] of utilities) {
454
- if (!clean.startsWith(`${prefix}-`)) continue;
455
- const token = tokenFor(clean.slice(prefix.length + 1), namespace, isKnown);
456
- if (!token) continue;
457
- const rank = weight * 10 + specificity;
458
- for (const slot of slots) if ((winners.get(slot)?.rank ?? -1) <= rank) winners.set(slot, {
459
- token,
460
- rank
461
- });
462
- }
463
- }
464
- const result = {
465
- padding: {},
466
- gap: {}
467
- };
468
- for (const [slot, { token }] of winners) if (slot === "radius") result.radius = token;
469
- else if (slot.startsWith("gap.")) result.gap[slot.slice(4)] = token;
470
- else result.padding[slot.slice(8)] = token;
471
- return result;
472
- }
473
- //#endregion
474
313
  //#region src/configurator/inspector/Inspector.tsx
475
314
  const px = (value) => parseFloat(value) || 0;
476
315
  const hasTokens = (tokens) => !!(tokens.radius || tokens.gap.row || tokens.gap.column || Object.keys(tokens.padding).length);
@@ -482,7 +321,7 @@ function Inspector({ isKnown, describe, onSelect, revision, children }) {
482
321
  const [regions, setRegions] = useState([]);
483
322
  const [outline, setOutline] = useState(null);
484
323
  const [active, setActive] = useState(null);
485
- const tokensOf = useCallback((element) => inspectTokens(typeof element.className === "string" ? element.className : "", isKnown, window.innerWidth, px(getComputedStyle(document.documentElement).fontSize) || 16), [isKnown]);
324
+ const tokensOf = useCallback((element) => inspectTokens(typeof element.className === "string" ? element.className : "", isKnown, element.ownerDocument.defaultView?.innerWidth ?? 0, px(element.ownerDocument.defaultView?.getComputedStyle(element.ownerDocument.documentElement).fontSize ?? "16") || 16), [isKnown]);
486
325
  const measure = useCallback(() => {
487
326
  const stage = stageRef.current;
488
327
  if (!stage || !target || !target.isConnected) {
@@ -493,7 +332,7 @@ function Inspector({ isKnown, describe, onSelect, revision, children }) {
493
332
  const origin = stage.getBoundingClientRect();
494
333
  const box = target.getBoundingClientRect();
495
334
  const scale = target.offsetWidth ? box.width / target.offsetWidth : 1;
496
- const style = getComputedStyle(target);
335
+ const style = target.ownerDocument.defaultView.getComputedStyle(target);
497
336
  const tokens = tokensOf(target);
498
337
  const left = box.left - origin.left;
499
338
  const top = box.top - origin.top;
@@ -566,27 +405,28 @@ function Inspector({ isKnown, describe, onSelect, revision, children }) {
566
405
  useLayoutEffect(measure, [measure, revision]);
567
406
  useEffect(() => {
568
407
  const stage_0 = stageRef.current;
569
- if (!stage_0) return;
408
+ const ownerWindow = stage_0?.ownerDocument.defaultView;
409
+ if (!stage_0 || !ownerWindow) return;
570
410
  let frame = 0;
571
411
  const schedule = () => {
572
- cancelAnimationFrame(frame);
573
- frame = requestAnimationFrame(measure);
412
+ ownerWindow.cancelAnimationFrame(frame);
413
+ frame = ownerWindow.requestAnimationFrame(measure);
574
414
  };
575
415
  const observer = new ResizeObserver(schedule);
576
416
  observer.observe(stage_0);
577
417
  if (target) observer.observe(target);
578
- window.addEventListener("scroll", schedule, true);
418
+ ownerWindow.addEventListener("scroll", schedule, true);
579
419
  return () => {
580
- cancelAnimationFrame(frame);
420
+ ownerWindow.cancelAnimationFrame(frame);
581
421
  observer.disconnect();
582
- window.removeEventListener("scroll", schedule, true);
422
+ ownerWindow.removeEventListener("scroll", schedule, true);
583
423
  };
584
424
  }, [measure, target]);
585
425
  const onPointerMove = (event) => {
586
426
  if (event.target.closest(".studio-inspect-region")) return;
587
427
  const content = contentRef.current;
588
428
  if (!content) return;
589
- const hit = document.elementsFromPoint(event.clientX, event.clientY).find((element_0) => content.contains(element_0) && hasTokens(tokensOf(element_0)));
429
+ const hit = content.ownerDocument.elementsFromPoint(event.clientX, event.clientY).find((element_0) => content.contains(element_0) && hasTokens(tokensOf(element_0)));
590
430
  if (hit && hit !== target) setTarget(hit);
591
431
  };
592
432
  return /* @__PURE__ */ jsxs("div", {
@@ -3522,6 +3362,7 @@ function ZoomedDemo(t0) {
3522
3362
  t8 = /* @__PURE__ */ jsx(PortalHere, { children: (portalRef) => /* @__PURE__ */ jsx("div", {
3523
3363
  ref: portalRef,
3524
3364
  className: "studio-gallery-demo",
3365
+ "data-inspector-name": demo.title,
3525
3366
  style: {
3526
3367
  width,
3527
3368
  maxWidth: "100%"
@@ -3561,105 +3402,112 @@ function ZoomedDemo(t0) {
3561
3402
  }
3562
3403
  /** Every Povio UI component in one scrollable list; clicking a card zooms it into the token inspector. */
3563
3404
  function ComponentGallery(t0) {
3564
- const $ = c(12);
3405
+ const $ = c(14);
3565
3406
  const { inspector } = t0;
3407
+ const galleryRef = useRef(null);
3566
3408
  const [zoomed, setZoomed] = useState(null);
3567
3409
  const [zoomedWidth, setZoomedWidth] = useState();
3410
+ const open = (id) => {
3411
+ setZoomedWidth(galleryRef.current?.querySelector(`#gallery-card-${id} .studio-gallery-demo`)?.offsetWidth);
3412
+ setZoomed(id);
3413
+ };
3568
3414
  let t1;
3569
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3570
- t1 = (id) => {
3571
- setZoomedWidth(document.querySelector(`#gallery-card-${id} .studio-gallery-demo`)?.offsetWidth);
3572
- setZoomed(id);
3573
- };
3574
- $[0] = t1;
3575
- } else t1 = $[0];
3576
- const open = t1;
3577
- let t2;
3578
- if ($[1] !== zoomed) {
3579
- t2 = demos.find((demo) => demo.id === zoomed);
3580
- $[1] = zoomed;
3581
- $[2] = t2;
3582
- } else t2 = $[2];
3583
- const zoomedDemo = t2;
3415
+ if ($[0] !== zoomed) {
3416
+ t1 = demos.find((demo) => demo.id === zoomed);
3417
+ $[0] = zoomed;
3418
+ $[1] = t1;
3419
+ } else t1 = $[1];
3420
+ const zoomedDemo = t1;
3584
3421
  const lastZoomed = useRef(null);
3422
+ let t2;
3585
3423
  let t3;
3586
- let t4;
3587
- if ($[3] !== zoomed) {
3588
- t3 = () => {
3424
+ if ($[2] !== zoomed) {
3425
+ t2 = () => {
3589
3426
  if (zoomed) lastZoomed.current = zoomed;
3590
- else if (lastZoomed.current) document.querySelector(`#gallery-card-${lastZoomed.current} .studio-gallery-card-hit`)?.focus();
3427
+ else if (lastZoomed.current) galleryRef.current?.querySelector(`#gallery-card-${lastZoomed.current} .studio-gallery-card-hit`)?.focus();
3591
3428
  };
3592
- t4 = [zoomed];
3593
- $[3] = zoomed;
3429
+ t3 = [zoomed];
3430
+ $[2] = zoomed;
3431
+ $[3] = t2;
3594
3432
  $[4] = t3;
3595
- $[5] = t4;
3596
3433
  } else {
3434
+ t2 = $[3];
3597
3435
  t3 = $[4];
3598
- t4 = $[5];
3599
3436
  }
3600
- useEffect(t3, t4);
3437
+ useEffect(t2, t3);
3601
3438
  if (zoomedDemo) {
3439
+ let t4;
3440
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
3441
+ t4 = () => setZoomed(null);
3442
+ $[5] = t4;
3443
+ } else t4 = $[5];
3602
3444
  let t5;
3603
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
3604
- t5 = () => setZoomed(null);
3605
- $[6] = t5;
3606
- } else t5 = $[6];
3607
- let t6;
3608
- if ($[7] !== inspector || $[8] !== zoomedDemo || $[9] !== zoomedWidth) {
3609
- t6 = /* @__PURE__ */ jsx(ZoomedDemo, {
3445
+ if ($[6] !== inspector || $[7] !== zoomedDemo || $[8] !== zoomedWidth) {
3446
+ t5 = /* @__PURE__ */ jsx(ZoomedDemo, {
3610
3447
  demo: zoomedDemo,
3611
3448
  width: zoomedWidth,
3612
3449
  inspector,
3613
- onBack: t5
3450
+ onBack: t4
3614
3451
  }, zoomedDemo.id);
3615
- $[7] = inspector;
3616
- $[8] = zoomedDemo;
3617
- $[9] = zoomedWidth;
3618
- $[10] = t6;
3619
- } else t6 = $[10];
3620
- return t6;
3452
+ $[6] = inspector;
3453
+ $[7] = zoomedDemo;
3454
+ $[8] = zoomedWidth;
3455
+ $[9] = t5;
3456
+ } else t5 = $[9];
3457
+ return t5;
3621
3458
  }
3459
+ const t4 = "studio-gallery";
3622
3460
  let t5;
3623
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
3624
- t5 = /* @__PURE__ */ jsxs("div", {
3625
- className: "studio-gallery",
3626
- children: [/* @__PURE__ */ jsx(LayoutPreview, {}), galleryGroups.map((group) => {
3627
- const items = demos.filter((demo_0) => demo_0.group === group);
3628
- if (!items.length) return null;
3629
- return /* @__PURE__ */ jsxs("section", {
3630
- className: "studio-gallery-group",
3631
- "aria-label": group,
3632
- children: [/* @__PURE__ */ jsx("h3", { children: group }), /* @__PURE__ */ jsx("div", {
3633
- className: "studio-gallery-grid",
3634
- children: items.map((demo_1) => /* @__PURE__ */ jsxs("div", {
3635
- id: `gallery-card-${demo_1.id}`,
3636
- className: `studio-gallery-card ${demo_1.wide ? "is-wide" : ""}`,
3637
- children: [
3638
- /* @__PURE__ */ jsx("button", {
3639
- type: "button",
3640
- className: "studio-gallery-card-hit",
3641
- "aria-label": `Inspect ${demo_1.title}`,
3642
- onClick: () => open(demo_1.id)
3643
- }),
3644
- /* @__PURE__ */ jsx("span", {
3645
- className: "studio-gallery-card-title",
3646
- children: demo_1.title
3647
- }),
3648
- /* @__PURE__ */ jsx(PortalHere, { children: (portalRef) => /* @__PURE__ */ jsx("div", {
3649
- ref: portalRef,
3650
- className: "studio-gallery-demo",
3651
- inert: true,
3652
- children: demo_1.render()
3653
- }) })
3654
- ]
3655
- }, demo_1.id))
3656
- })]
3657
- }, group);
3461
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
3462
+ t5 = /* @__PURE__ */ jsx(LayoutPreview, {});
3463
+ $[10] = t5;
3464
+ } else t5 = $[10];
3465
+ const t6 = galleryGroups.map((group) => {
3466
+ const items = demos.filter((demo_0) => demo_0.group === group);
3467
+ if (!items.length) return null;
3468
+ return /* @__PURE__ */ jsxs("section", {
3469
+ className: "studio-gallery-group",
3470
+ "aria-label": group,
3471
+ children: [/* @__PURE__ */ jsx("h3", { children: group }), /* @__PURE__ */ jsx("div", {
3472
+ className: "studio-gallery-grid",
3473
+ children: items.map((demo_1) => /* @__PURE__ */ jsxs("div", {
3474
+ id: `gallery-card-${demo_1.id}`,
3475
+ className: `studio-gallery-card ${demo_1.wide ? "is-wide" : ""}`,
3476
+ children: [
3477
+ /* @__PURE__ */ jsx("button", {
3478
+ type: "button",
3479
+ className: "studio-gallery-card-hit",
3480
+ "aria-label": `Inspect ${demo_1.title}`,
3481
+ onClick: () => open(demo_1.id)
3482
+ }),
3483
+ /* @__PURE__ */ jsx("span", {
3484
+ className: "studio-gallery-card-title",
3485
+ children: demo_1.title
3486
+ }),
3487
+ /* @__PURE__ */ jsx(PortalHere, { children: (portalRef) => /* @__PURE__ */ jsx("div", {
3488
+ ref: portalRef,
3489
+ className: "studio-gallery-demo",
3490
+ "data-inspector-name": demo_1.title,
3491
+ inert: true,
3492
+ children: demo_1.render()
3493
+ }) })
3494
+ ]
3495
+ }, demo_1.id))
3658
3496
  })]
3497
+ }, group);
3498
+ });
3499
+ let t7;
3500
+ if ($[11] !== t5 || $[12] !== t6) {
3501
+ t7 = /* @__PURE__ */ jsxs("div", {
3502
+ ref: galleryRef,
3503
+ className: t4,
3504
+ children: [t5, t6]
3659
3505
  });
3660
3506
  $[11] = t5;
3661
- } else t5 = $[11];
3662
- return t5;
3507
+ $[12] = t6;
3508
+ $[13] = t7;
3509
+ } else t7 = $[13];
3510
+ return t7;
3663
3511
  }
3664
3512
  //#endregion
3665
3513
  export { ComponentGallery as default };
@@ -1,71 +1,18 @@
1
1
  import { t as logger } from "./logger-CqZjM-sn.js";
2
- import { t as createLucideIcon } from "./createLucideIcon-LcezOE4z.js";
3
2
  import { t as UIConfig } from "./uiConfig.context-BS3r_kTS.js";
4
3
  import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
5
4
  import { t as ChevronUp } from "./chevron-up-D_Gqpb5M.js";
5
+ import { a as tableHeaderTextDefinition, c as GripVertical, i as tableHeadRowDefinition, n as tableDataDefinition, o as tableRowDefinition, r as tableHeadDataDefinition, s as theadDefinition, t as tableCellTextDefinition } from "./table.cva-D5oQ-QvA.js";
6
6
  import { t as clsx } from "./clsx-CnD0nOiA.js";
7
7
  import { t as UIOverrides } from "./uiOverrides.context-BTCH9y5a.js";
8
8
  import { t as IconSlot } from "./IconSlot-DSK7qNxc.js";
9
9
  import { t as Typography } from "./Typography-LU4z2pR1.js";
10
10
  import { InlineIconButton } from "./components/inline-icon-button.js";
11
11
  import { t as useIntersectionObserver } from "./useIntersectionObserver-DYfHnGGU.js";
12
- import { a as tableHeaderTextDefinition, i as tableHeadRowDefinition, n as tableDataDefinition, o as tableRowDefinition, r as tableHeadDataDefinition, s as theadDefinition, t as tableCellTextDefinition } from "./table.cva-DlMT-zLD.js";
13
12
  import { Suspense, lazy, useCallback, useMemo, useRef, useState } from "react";
14
13
  import { jsx, jsxs } from "react/jsx-runtime";
15
14
  import { createPaginatedRowModel, createSortedRowModel, flexRender, stockFeatures, tableFeatures, useTable } from "@tanstack/react-table";
16
15
  import i18next from "i18next";
17
- //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/grip-vertical.mjs
18
- /**
19
- * @license lucide-react v1.43.0 - ISC
20
- *
21
- * This source code is licensed under the ISC license.
22
- * See the LICENSE file in the root directory of this source tree.
23
- */
24
- const __iconData = {
25
- name: "grip-vertical",
26
- size: 24,
27
- node: [
28
- ["circle", {
29
- cx: "9",
30
- cy: "12",
31
- r: "1",
32
- key: "1vctgf"
33
- }],
34
- ["circle", {
35
- cx: "9",
36
- cy: "5",
37
- r: "1",
38
- key: "hp0tcf"
39
- }],
40
- ["circle", {
41
- cx: "9",
42
- cy: "19",
43
- r: "1",
44
- key: "fkjjf6"
45
- }],
46
- ["circle", {
47
- cx: "15",
48
- cy: "12",
49
- r: "1",
50
- key: "1tmaij"
51
- }],
52
- ["circle", {
53
- cx: "15",
54
- cy: "5",
55
- r: "1",
56
- key: "19l28e"
57
- }],
58
- ["circle", {
59
- cx: "15",
60
- cy: "19",
61
- r: "1",
62
- key: "f4zoj3"
63
- }]
64
- ]
65
- };
66
- __iconData.node;
67
- const GripVertical = createLucideIcon(__iconData);
68
- //#endregion
69
16
  //#region src/components/table/CellText.tsx
70
17
  const CellText = (props) => {
71
18
  const uiConfig = UIConfig.useConfig();