@seedgrid/fe-components 2026.3.3-8 → 2026.3.3-9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SgPlayground.d.ts","sourceRoot":"","sources":["../../src/others/SgPlayground.tsx"],"names":[],"mappings":"AAiBA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CA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E,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AACnF,MAAM,MAAM,uBAAuB,GAAG;IACpC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAqgCF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CAoctE"}
@@ -79,12 +79,7 @@ const TIPTAP_SHIM_PACKAGES = [
79
79
  "@tiptap/extension-superscript",
80
80
  "@tiptap/extension-font-family"
81
81
  ];
82
- // Sandpack's CRA runtime does not execute script tags from template HTML reliably.
83
- // Load Tailwind as external resources so it is injected before module evaluation.
84
- const SANDPACK_EXTERNAL_RESOURCES = [
85
- "/sandpack-tailwind-config.js",
86
- "https://cdn.tailwindcss.com"
87
- ];
82
+ const SANDPACK_EXTERNAL_RESOURCES = [];
88
83
  const SANDPACK_QRCODE_SHIM_INDEX_JS = `const makeError = () =>
89
84
  new Error(
90
85
  "qrcode (node build) is not supported in Sandpack browser runtime. Update @seedgrid/fe-components to a browser-safe QR implementation."
@@ -584,83 +579,6 @@ const SANDPACK_HOST_STYLES_CSS = `
584
579
  left: auto !important;
585
580
  }
586
581
  `;
587
- const SANDPACK_TAILWIND_CONFIG_JS = `function sgPalette(name) {
588
- return {
589
- 50: "rgb(var(--sg-" + name + "-50) / <alpha-value>)",
590
- 100: "rgb(var(--sg-" + name + "-100) / <alpha-value>)",
591
- 200: "rgb(var(--sg-" + name + "-200) / <alpha-value>)",
592
- 300: "rgb(var(--sg-" + name + "-300) / <alpha-value>)",
593
- 400: "rgb(var(--sg-" + name + "-400) / <alpha-value>)",
594
- 500: "rgb(var(--sg-" + name + "-500) / <alpha-value>)",
595
- 600: "rgb(var(--sg-" + name + "-600) / <alpha-value>)",
596
- 700: "rgb(var(--sg-" + name + "-700) / <alpha-value>)",
597
- 800: "rgb(var(--sg-" + name + "-800) / <alpha-value>)",
598
- 900: "rgb(var(--sg-" + name + "-900) / <alpha-value>)",
599
- DEFAULT: "rgb(var(--sg-" + name + "-500) / <alpha-value>)",
600
- hover: "rgb(var(--sg-" + name + "-hover) / <alpha-value>)",
601
- active: "rgb(var(--sg-" + name + "-active) / <alpha-value>)"
602
- };
603
- }
604
-
605
- window.tailwind = window.tailwind || {};
606
- window.tailwind.config = {
607
- theme: {
608
- extend: {
609
- colors: {
610
- border: "hsl(var(--border))",
611
- input: "hsl(var(--input))",
612
- ring: "hsl(var(--ring))",
613
- background: "hsl(var(--background))",
614
- foreground: "hsl(var(--foreground))",
615
- primary: { DEFAULT: "hsl(var(--primary))", foreground: "hsl(var(--primary-foreground))" },
616
- secondary: { DEFAULT: "hsl(var(--secondary))", foreground: "hsl(var(--secondary-foreground))" },
617
- destructive: { DEFAULT: "hsl(var(--destructive))", foreground: "hsl(var(--destructive-foreground))" },
618
- muted: { DEFAULT: "hsl(var(--muted))", foreground: "hsl(var(--muted-foreground))" },
619
- accent: { DEFAULT: "hsl(var(--accent))", foreground: "hsl(var(--accent-foreground))" },
620
- card: { DEFAULT: "hsl(var(--card))", foreground: "hsl(var(--card-foreground))" },
621
- popover: { DEFAULT: "hsl(var(--popover))", foreground: "hsl(var(--popover-foreground))" },
622
- sg: {
623
- bg: "rgb(var(--sg-bg) / <alpha-value>)",
624
- surface: "rgb(var(--sg-surface) / <alpha-value>)",
625
- "muted-surface": "rgb(var(--sg-muted-surface) / <alpha-value>)",
626
- border: "rgb(var(--sg-border) / <alpha-value>)",
627
- ring: "rgb(var(--sg-ring) / <alpha-value>)",
628
- focus: "rgb(var(--sg-ring) / <alpha-value>)",
629
- text: "rgb(var(--sg-text) / <alpha-value>)",
630
- muted: "rgb(var(--sg-muted) / <alpha-value>)",
631
- disabled: "rgb(var(--sg-disabled) / <alpha-value>)",
632
- "on-disabled": "rgb(var(--sg-on-disabled) / <alpha-value>)",
633
- hover: "rgb(var(--sg-primary-50) / <alpha-value>)",
634
- hover2: "rgb(var(--sg-primary-100) / <alpha-value>)",
635
- surface2: "rgb(var(--sg-muted-surface) / <alpha-value>)",
636
- link: "rgb(var(--sg-link) / <alpha-value>)",
637
- "link-hover": "rgb(var(--sg-link-hover) / <alpha-value>)",
638
- "on-primary": "rgb(var(--sg-on-primary) / <alpha-value>)",
639
- "on-secondary": "rgb(var(--sg-on-secondary) / <alpha-value>)",
640
- "on-tertiary": "rgb(var(--sg-on-tertiary) / <alpha-value>)",
641
- "on-warning": "rgb(var(--sg-on-warning) / <alpha-value>)",
642
- "on-error": "rgb(var(--sg-on-error) / <alpha-value>)",
643
- "on-info": "rgb(var(--sg-on-info) / <alpha-value>)",
644
- "on-success": "rgb(var(--sg-on-success) / <alpha-value>)",
645
- primary: sgPalette("primary"),
646
- secondary: sgPalette("secondary"),
647
- tertiary: sgPalette("tertiary"),
648
- warning: sgPalette("warning"),
649
- error: sgPalette("error"),
650
- info: sgPalette("info"),
651
- success: sgPalette("success")
652
- }
653
- },
654
- borderRadius: {
655
- lg: "var(--radius)",
656
- md: "calc(var(--radius) - 2px)",
657
- sm: "calc(var(--radius) - 4px)",
658
- sg: "var(--sg-radius)"
659
- }
660
- }
661
- }
662
- };
663
- `;
664
582
  // Keep CRA's expected HTML entry file path for react/react-ts templates.
665
583
  const SANDPACK_TAILWIND_INDEX_HTML = `<!DOCTYPE html>
666
584
  <html lang="en">
@@ -858,10 +776,41 @@ function readThemeVarsFromHost() {
858
776
  Object.assign(themeVars, mapSgVarsToCoreVars(themeVars));
859
777
  return themeVars;
860
778
  }
779
+ function getStyleSheetHref(styleSheet) {
780
+ const cssSheet = styleSheet;
781
+ if (cssSheet.href)
782
+ return cssSheet.href;
783
+ const ownerNode = cssSheet.ownerNode;
784
+ if (!(ownerNode instanceof Element))
785
+ return "";
786
+ return ownerNode.getAttribute("data-n-href") ?? "";
787
+ }
788
+ function readHostNextCssText() {
789
+ if (typeof document === "undefined")
790
+ return "";
791
+ const chunks = [];
792
+ const sheets = Array.from(document.styleSheets);
793
+ for (const sheet of sheets) {
794
+ const href = getStyleSheetHref(sheet);
795
+ if (!href.includes("/_next/static/css/"))
796
+ continue;
797
+ let rules;
798
+ try {
799
+ rules = sheet.cssRules;
800
+ }
801
+ catch {
802
+ continue;
803
+ }
804
+ for (const rule of Array.from(rules)) {
805
+ chunks.push(rule.cssText);
806
+ }
807
+ }
808
+ return chunks.join("\n");
809
+ }
861
810
  function normalizeCssSize(value) {
862
811
  return typeof value === "number" ? `${value}px` : value;
863
812
  }
864
- function buildSandpackStylesCss(themeVars, previewPadding) {
813
+ function buildSandpackStylesCss(themeVars, previewPadding, hostCss = "") {
865
814
  const mergedVars = {
866
815
  ...SANDPACK_FALLBACK_THEME_VARS,
867
816
  ...themeVars,
@@ -875,7 +824,8 @@ function buildSandpackStylesCss(themeVars, previewPadding) {
875
824
  ${rootVars}
876
825
  }
877
826
 
878
- ${SANDPACK_BASE_STYLES_CSS}`;
827
+ ${SANDPACK_BASE_STYLES_CSS}
828
+ ${hostCss ? `\n\n${hostCss}` : ""}`;
879
829
  }
880
830
  function ReadonlyBlock({ code }) {
881
831
  return (_jsx("pre", { className: "overflow-auto rounded-lg border border-border bg-muted/30 p-4 text-xs leading-relaxed", children: _jsx("code", { children: code }) }));
@@ -1006,7 +956,8 @@ export default function SgPlayground(props) {
1006
956
  const root = document.documentElement;
1007
957
  const refreshStyles = () => {
1008
958
  const liveThemeVars = readThemeVarsFromHost();
1009
- setSandpackStylesCss(buildSandpackStylesCss(liveThemeVars, effectivePreviewPadding));
959
+ const hostCss = readHostNextCssText();
960
+ setSandpackStylesCss(buildSandpackStylesCss(liveThemeVars, effectivePreviewPadding, hostCss));
1010
961
  };
1011
962
  let frameId = null;
1012
963
  const scheduleRefresh = () => {
@@ -1110,12 +1061,8 @@ export default function SgPlayground(props) {
1110
1061
  };
1111
1062
  // Compatibility shim for legacy @seedgrid/fe-components builds that still import "qrcode" (node-only path).
1112
1063
  files["/node_modules/qrcode/index.js"] = { code: SANDPACK_QRCODE_SHIM_INDEX_JS, hidden: true };
1113
- // Virtual index.html: loads Tailwind v3 play CDN with SeedGrid design-token config.
1114
- // This keeps CRA's public/index.html entry path expected by the react/react-ts templates.
1064
+ // Keep CRA's public/index.html entry path expected by the react/react-ts templates.
1115
1065
  files["/public/index.html"] = { code: SANDPACK_TAILWIND_INDEX_HTML, hidden: true };
1116
- // Tailwind config is loaded via externalResources because Sandpack runtime
1117
- // does not execute scripts from template HTML head/body consistently.
1118
- files["/sandpack-tailwind-config.js"] = { code: SANDPACK_TAILWIND_CONFIG_JS, hidden: true };
1119
1066
  // Sandpack runtime can evaluate JSON files as plain JS modules.
1120
1067
  // Provide CJS-compatible shims to keep @seedgrid/fe-components i18n/validators working.
1121
1068
  // .json shims cover current npm versions; .js shims cover new versions after JSON→TypeScript conversion.