@povio/ui 5.0.0-rc.6 → 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.
@@ -48,6 +48,7 @@ import { t as Toast } from "./Toast-DtG3pA61.js";
48
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);
@@ -3523,6 +3362,7 @@ function ZoomedDemo(t0) {
3523
3362
  t8 = /* @__PURE__ */ jsx(PortalHere, { children: (portalRef) => /* @__PURE__ */ jsx("div", {
3524
3363
  ref: portalRef,
3525
3364
  className: "studio-gallery-demo",
3365
+ "data-inspector-name": demo.title,
3526
3366
  style: {
3527
3367
  width,
3528
3368
  maxWidth: "100%"
@@ -3647,6 +3487,7 @@ function ComponentGallery(t0) {
3647
3487
  /* @__PURE__ */ jsx(PortalHere, { children: (portalRef) => /* @__PURE__ */ jsx("div", {
3648
3488
  ref: portalRef,
3649
3489
  className: "studio-gallery-demo",
3490
+ "data-inspector-name": demo_1.title,
3650
3491
  inert: true,
3651
3492
  children: demo_1.render()
3652
3493
  }) })