@seedgrid/fe-components 2026.3.3 → 2026.3.4

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 (49) hide show
  1. package/dist/blocked-email-domains.d.ts +5 -0
  2. package/dist/blocked-email-domains.d.ts.map +1 -0
  3. package/dist/{blocked-email-domains.json → blocked-email-domains.js} +4 -3
  4. package/dist/buttons/SgButton.d.ts.map +1 -1
  5. package/dist/buttons/SgButton.js +5 -4
  6. package/dist/buttons/SgFloatActionButton.d.ts.map +1 -1
  7. package/dist/buttons/SgFloatActionButton.js +1 -0
  8. package/dist/buttons/SgSplitButton.d.ts.map +1 -1
  9. package/dist/buttons/SgSplitButton.js +3 -29
  10. package/dist/i18n/en-US.d.ts +3 -0
  11. package/dist/i18n/en-US.d.ts.map +1 -0
  12. package/dist/i18n/{en-US.json → en-US.js} +3 -2
  13. package/dist/i18n/es.d.ts +3 -0
  14. package/dist/i18n/es.d.ts.map +1 -0
  15. package/dist/i18n/es.js +85 -0
  16. package/dist/i18n/index.d.ts +4 -336
  17. package/dist/i18n/index.d.ts.map +1 -1
  18. package/dist/i18n/index.js +4 -4
  19. package/dist/i18n/pt-BR.d.ts +3 -0
  20. package/dist/i18n/pt-BR.d.ts.map +1 -0
  21. package/dist/i18n/{pt-BR.json → pt-BR.js} +13 -12
  22. package/dist/i18n/pt-PT.d.ts +3 -0
  23. package/dist/i18n/pt-PT.d.ts.map +1 -0
  24. package/dist/i18n/{pt-PT.json → pt-PT.js} +13 -12
  25. package/dist/inputs/SgInputDate.d.ts.map +1 -1
  26. package/dist/inputs/SgInputDate.js +9 -2
  27. package/dist/inputs/SgInputNumber.d.ts +4 -0
  28. package/dist/inputs/SgInputNumber.d.ts.map +1 -1
  29. package/dist/inputs/SgInputNumber.js +46 -8
  30. package/dist/inputs/SgInputText.d.ts +4 -0
  31. package/dist/inputs/SgInputText.d.ts.map +1 -1
  32. package/dist/inputs/SgInputText.js +46 -8
  33. package/dist/inputs/SgInputTextArea.d.ts +4 -0
  34. package/dist/inputs/SgInputTextArea.d.ts.map +1 -1
  35. package/dist/inputs/SgInputTextArea.js +45 -7
  36. package/dist/inputs/SgTextEditor.d.ts.map +1 -1
  37. package/dist/inputs/SgTextEditor.js +1 -0
  38. package/dist/layout/SgMenu.js +3 -5
  39. package/dist/layout/SgToolBar.d.ts.map +1 -1
  40. package/dist/layout/SgToolBar.js +10 -5
  41. package/dist/manifest.js +2 -2
  42. package/dist/menus/SgDockMenu.d.ts.map +1 -1
  43. package/dist/menus/SgDockMenu.js +1 -0
  44. package/dist/others/SgPlayground.d.ts.map +1 -1
  45. package/dist/others/SgPlayground.js +641 -121
  46. package/dist/sandbox.cjs +453 -0
  47. package/dist/validators.js +1 -1
  48. package/package.json +5 -2
  49. package/dist/i18n/es.json +0 -84
@@ -15,9 +15,31 @@ const DEFAULT_SANDBOX_BASE_DEPENDENCIES = {
15
15
  "react-dom": "18.2.0"
16
16
  };
17
17
  const DEFAULT_SEEDGRID_RUNTIME_DEPENDENCIES = {
18
- "react-hook-form": "^7.0.0",
19
- "lucide-react": "^0.468.0"
18
+ "react-hook-form": "^7.0.0"
20
19
  };
20
+ // lucide-react is a heavy peer dep (~1400 icons). For non-full presets we shim it with
21
+ // a generic SVG placeholder to avoid OOM in the browser bundler.
22
+ const SANDPACK_LUCIDE_REACT_SHIM_INDEX_JS = `const React = require("react");
23
+ const Icon = function(props) {
24
+ return React.createElement("svg", {
25
+ xmlns: "http://www.w3.org/2000/svg",
26
+ width: props.size || props.width || 16,
27
+ height: props.size || props.height || 16,
28
+ viewBox: "0 0 24 24",
29
+ fill: "none",
30
+ stroke: props.color || "currentColor",
31
+ strokeWidth: props.strokeWidth || 2,
32
+ className: props.className
33
+ });
34
+ };
35
+ const proxy = new Proxy({}, {
36
+ get: function(_, key) {
37
+ if (key === "__esModule") return true;
38
+ return Icon;
39
+ }
40
+ });
41
+ module.exports = proxy;
42
+ `;
21
43
  const DEFAULT_SEEDGRID_EDITOR_DEPENDENCIES = {
22
44
  "@tiptap/core": "^2.9.1",
23
45
  "@tiptap/react": "^2.9.1",
@@ -37,11 +59,11 @@ const DEFAULT_SEEDGRID_EDITOR_DEPENDENCIES = {
37
59
  const DEFAULT_SANDBOX_HOST_DEPENDENCIES = {
38
60
  "@codesandbox/sandpack-react": "^2.20.0"
39
61
  };
40
- const DEFAULT_SANDPACK_POLYFILLS = {
41
- assert: "^2.1.0",
42
- process: "^0.11.10",
43
- util: "^0.12.5"
44
- };
62
+ // Keep this empty: editor runtime uses in-memory shims under /node_modules/*
63
+ // for assert/path/process/util/fs and node:* aliases.
64
+ // Installing npm polyfill packages here pulls deep transitive trees and may
65
+ // explode resolution inside Sandpack (e.g. dunder-proto/get, get-proto, etc).
66
+ const DEFAULT_SANDPACK_POLYFILLS = {};
45
67
  const TIPTAP_SHIM_PACKAGES = [
46
68
  "@tiptap/core",
47
69
  "@tiptap/pm",
@@ -57,10 +79,7 @@ const TIPTAP_SHIM_PACKAGES = [
57
79
  "@tiptap/extension-superscript",
58
80
  "@tiptap/extension-font-family"
59
81
  ];
60
- const SANDPACK_EXTERNAL_RESOURCES = [
61
- // Prebuilt utility CSS so classes from @seedgrid/fe-components can render inside Sandpack
62
- "https://unpkg.com/tailwindcss@2.2.19/dist/tailwind.min.css"
63
- ];
82
+ const SANDPACK_EXTERNAL_RESOURCES = [];
64
83
  const SANDPACK_QRCODE_SHIM_INDEX_JS = `const makeError = () =>
65
84
  new Error(
66
85
  "qrcode (node build) is not supported in Sandpack browser runtime. Update @seedgrid/fe-components to a browser-safe QR implementation."
@@ -82,6 +101,26 @@ const SANDPACK_MARKDOWN_IT_BIN_SHIM = `import markdownit from "../index.mjs";
82
101
  export default markdownit;
83
102
  export { markdownit };
84
103
  `;
104
+ const SANDPACK_MARKDOWN_IT_PACKAGE_JSON_SHIM = JSON.stringify({
105
+ name: "markdown-it",
106
+ version: "14.1.1-shim",
107
+ main: "dist/index.cjs.js",
108
+ module: "index.mjs",
109
+ exports: {
110
+ ".": {
111
+ import: "./index.mjs",
112
+ require: "./dist/index.cjs.js"
113
+ },
114
+ "./*": {
115
+ import: "./*",
116
+ require: "./*"
117
+ }
118
+ },
119
+ // Sandpack can accidentally prioritize `bin`; force it to a browser-safe module.
120
+ bin: {
121
+ "markdown-it": "dist/index.cjs.js"
122
+ }
123
+ });
85
124
  const SANDPACK_SANDBOX_SANDPACK_REACT_SHIM_INDEX_JS = `export const SandpackProvider = ({ children }) => children ?? null;
86
125
  export const SandpackCodeEditor = () => null;
87
126
  export const SandpackPreview = () => null;
@@ -283,7 +322,68 @@ if (typeof globalThis !== "undefined" && !globalThis.process) {
283
322
  module.exports = processShim;
284
323
  module.exports.default = processShim;
285
324
  `;
325
+ const SANDPACK_NODE_ASSERT_ALIAS_SHIM_INDEX_JS = `const assertShim = require("assert");
326
+ module.exports = assertShim;
327
+ module.exports.default = assertShim;
328
+ `;
329
+ const SANDPACK_NODE_UTIL_ALIAS_SHIM_INDEX_JS = `const utilShim = require("util");
330
+ module.exports = utilShim;
331
+ module.exports.default = utilShim;
332
+ `;
333
+ const SANDPACK_NODE_PATH_ALIAS_SHIM_INDEX_JS = `const pathShim = require("path");
334
+ module.exports = pathShim;
335
+ module.exports.default = pathShim;
336
+ `;
337
+ const SANDPACK_NODE_FS_ALIAS_SHIM_INDEX_JS = `const fsShim = require("fs");
338
+ module.exports = fsShim;
339
+ module.exports.default = fsShim;
340
+ `;
341
+ const SANDPACK_NODE_PROCESS_ALIAS_SHIM_INDEX_JS = `const processShim = require("process");
342
+ module.exports = processShim;
343
+ module.exports.default = processShim;
344
+ `;
345
+ const SANDPACK_NODE_FS_PROMISES_ALIAS_SHIM_INDEX_JS = `const fsShim = require("fs");
346
+ module.exports = fsShim.promises || {};
347
+ module.exports.default = module.exports;
348
+ `;
349
+ const SANDPACK_NODE_ASSERT_PACKAGE_JSON_SHIM = JSON.stringify({
350
+ name: "node:assert",
351
+ version: "0.0.0-shim",
352
+ main: "index.js",
353
+ module: "index.js"
354
+ });
355
+ const SANDPACK_NODE_UTIL_PACKAGE_JSON_SHIM = JSON.stringify({
356
+ name: "node:util",
357
+ version: "0.0.0-shim",
358
+ main: "index.js",
359
+ module: "index.js"
360
+ });
361
+ const SANDPACK_NODE_PATH_PACKAGE_JSON_SHIM = JSON.stringify({
362
+ name: "node:path",
363
+ version: "0.0.0-shim",
364
+ main: "index.js",
365
+ module: "index.js"
366
+ });
367
+ const SANDPACK_NODE_FS_PACKAGE_JSON_SHIM = JSON.stringify({
368
+ name: "node:fs",
369
+ version: "0.0.0-shim",
370
+ main: "index.js",
371
+ module: "index.js"
372
+ });
373
+ const SANDPACK_NODE_PROCESS_PACKAGE_JSON_SHIM = JSON.stringify({
374
+ name: "node:process",
375
+ version: "0.0.0-shim",
376
+ main: "index.js",
377
+ module: "index.js"
378
+ });
379
+ const SANDPACK_NODE_FS_PROMISES_PACKAGE_JSON_SHIM = JSON.stringify({
380
+ name: "node:fs/promises",
381
+ version: "0.0.0-shim",
382
+ main: "index.js",
383
+ module: "index.js"
384
+ });
286
385
  const SANDPACK_FALLBACK_THEME_VARS = {
386
+ // shadcn/ui design tokens (HSL)
287
387
  "--background": "0 0% 100%",
288
388
  "--foreground": "222.2 84% 4.9%",
289
389
  "--primary": "142 76% 36%",
@@ -295,14 +395,152 @@ const SANDPACK_FALLBACK_THEME_VARS = {
295
395
  "--destructive": "0 84.2% 60.2%",
296
396
  "--destructive-foreground": "0 0% 100%",
297
397
  "--border": "214.3 31.8% 91.4%",
298
- "--ring": "var(--primary)",
398
+ "--input": "214.3 31.8% 91.4%",
399
+ "--ring": "142 76% 36%",
400
+ "--muted": "210 40% 96.1%",
401
+ "--muted-foreground": "215.4 16.3% 46.9%",
402
+ "--card": "0 0% 100%",
403
+ "--card-foreground": "222.2 84% 4.9%",
404
+ "--popover": "0 0% 100%",
405
+ "--popover-foreground": "222.2 84% 4.9%",
406
+ "--radius": "0.5rem",
407
+ // SeedGrid neutrals (RGB space-separated)
408
+ "--sg-bg": "255 255 255",
409
+ "--sg-surface": "248 250 252",
410
+ "--sg-muted-surface": "241 245 249",
411
+ "--sg-text": "15 23 42",
412
+ "--sg-muted": "100 116 139",
413
+ "--sg-border": "226 232 240",
414
+ "--sg-ring": "74 222 128",
415
+ "--sg-disabled": "203 213 225",
416
+ "--sg-on-disabled": "148 163 184",
417
+ "--sg-link": "22 163 74",
418
+ "--sg-link-hover": "21 128 61",
419
+ "--sg-radius": "0.5rem",
420
+ // On-color tokens
421
+ "--sg-on-primary": "255 255 255",
422
+ "--sg-on-secondary": "255 255 255",
423
+ "--sg-on-tertiary": "255 255 255",
424
+ "--sg-on-warning": "255 255 255",
425
+ "--sg-on-error": "255 255 255",
426
+ "--sg-on-info": "255 255 255",
427
+ "--sg-on-success": "255 255 255",
428
+ // Primary palette (green)
429
+ "--sg-primary-50": "240 253 244",
430
+ "--sg-primary-100": "220 252 231",
431
+ "--sg-primary-200": "187 247 208",
432
+ "--sg-primary-300": "134 239 172",
433
+ "--sg-primary-400": "74 222 128",
434
+ "--sg-primary-500": "34 197 94",
299
435
  "--sg-primary-600": "22 163 74",
436
+ "--sg-primary-700": "21 128 61",
437
+ "--sg-primary-800": "22 101 52",
438
+ "--sg-primary-900": "20 83 45",
439
+ "--sg-primary-hover": "21 128 61",
440
+ "--sg-primary-active": "22 101 52",
441
+ // Secondary palette (zinc)
442
+ "--sg-secondary-50": "250 250 250",
443
+ "--sg-secondary-100": "244 244 245",
444
+ "--sg-secondary-200": "228 228 231",
445
+ "--sg-secondary-300": "212 212 216",
446
+ "--sg-secondary-400": "161 161 170",
447
+ "--sg-secondary-500": "113 113 122",
300
448
  "--sg-secondary-600": "82 82 91",
301
- "--sg-tertiary-600": "20 184 166",
302
- "--sg-error-600": "220 38 38",
449
+ "--sg-secondary-700": "63 63 70",
450
+ "--sg-secondary-800": "39 39 42",
451
+ "--sg-secondary-900": "24 24 27",
452
+ "--sg-secondary-hover": "63 63 70",
453
+ "--sg-secondary-active": "39 39 42",
454
+ // Tertiary palette (teal)
455
+ "--sg-tertiary-50": "240 253 250",
456
+ "--sg-tertiary-100": "204 251 241",
457
+ "--sg-tertiary-200": "153 246 228",
458
+ "--sg-tertiary-300": "94 234 212",
459
+ "--sg-tertiary-400": "45 212 191",
460
+ "--sg-tertiary-500": "20 184 166",
461
+ "--sg-tertiary-600": "13 148 136",
462
+ "--sg-tertiary-700": "15 118 110",
463
+ "--sg-tertiary-800": "17 94 89",
464
+ "--sg-tertiary-900": "19 78 74",
465
+ "--sg-tertiary-hover": "15 118 110",
466
+ "--sg-tertiary-active": "17 94 89",
467
+ // Warning palette (amber)
468
+ "--sg-warning-50": "255 251 235",
469
+ "--sg-warning-100": "254 243 199",
470
+ "--sg-warning-200": "253 230 138",
471
+ "--sg-warning-300": "252 211 77",
472
+ "--sg-warning-400": "251 191 36",
473
+ "--sg-warning-500": "245 158 11",
303
474
  "--sg-warning-600": "217 119 6",
475
+ "--sg-warning-700": "180 83 9",
476
+ "--sg-warning-800": "146 64 14",
477
+ "--sg-warning-900": "120 53 15",
478
+ "--sg-warning-hover": "180 83 9",
479
+ "--sg-warning-active": "146 64 14",
480
+ // Error palette (red)
481
+ "--sg-error-50": "254 242 242",
482
+ "--sg-error-100": "254 226 226",
483
+ "--sg-error-200": "254 202 202",
484
+ "--sg-error-300": "252 165 165",
485
+ "--sg-error-400": "248 113 113",
486
+ "--sg-error-500": "239 68 68",
487
+ "--sg-error-600": "220 38 38",
488
+ "--sg-error-700": "185 28 28",
489
+ "--sg-error-800": "153 27 27",
490
+ "--sg-error-900": "127 29 29",
491
+ "--sg-error-hover": "185 28 28",
492
+ "--sg-error-active": "153 27 27",
493
+ // Info palette (sky)
494
+ "--sg-info-50": "240 249 255",
495
+ "--sg-info-100": "224 242 254",
496
+ "--sg-info-200": "186 230 253",
497
+ "--sg-info-300": "125 211 252",
498
+ "--sg-info-400": "56 189 248",
499
+ "--sg-info-500": "14 165 233",
304
500
  "--sg-info-600": "2 132 199",
305
- "--sg-success-600": "22 163 74"
501
+ "--sg-info-700": "3 105 161",
502
+ "--sg-info-800": "7 89 133",
503
+ "--sg-info-900": "12 74 110",
504
+ "--sg-info-hover": "3 105 161",
505
+ "--sg-info-active": "7 89 133",
506
+ // Success palette (green, same as primary)
507
+ "--sg-success-50": "240 253 244",
508
+ "--sg-success-100": "220 252 231",
509
+ "--sg-success-200": "187 247 208",
510
+ "--sg-success-300": "134 239 172",
511
+ "--sg-success-400": "74 222 128",
512
+ "--sg-success-500": "34 197 94",
513
+ "--sg-success-600": "22 163 74",
514
+ "--sg-success-700": "21 128 61",
515
+ "--sg-success-800": "22 101 52",
516
+ "--sg-success-900": "20 83 45",
517
+ "--sg-success-hover": "21 128 61",
518
+ "--sg-success-active": "22 101 52",
519
+ // Button component vars (green primary default)
520
+ "--sg-btn-bg": "rgb(22 163 74)",
521
+ "--sg-btn-fg": "rgb(255 255 255)",
522
+ "--sg-btn-border": "rgb(22 163 74)",
523
+ "--sg-btn-hover-bg": "rgb(21 128 61)",
524
+ "--sg-btn-hover-fg": "rgb(255 255 255)",
525
+ "--sg-btn-hover-border": "rgb(21 128 61)",
526
+ "--sg-btn-active-bg": "rgb(22 101 52)",
527
+ "--sg-btn-ring": "rgb(74 222 128 / 0.4)",
528
+ "--sg-btn-tint": "22 163 74",
529
+ // Avatar component vars
530
+ "--sg-avatar-bg": "rgb(22 163 74)",
531
+ "--sg-avatar-fg": "rgb(255 255 255)",
532
+ "--sg-avatar-border": "transparent",
533
+ "--sg-avatar-ring": "rgb(74 222 128)",
534
+ // Badge component vars
535
+ "--sg-badge-bg": "rgb(240 253 244)",
536
+ "--sg-badge-fg": "rgb(22 163 74)",
537
+ "--sg-badge-border": "rgb(187 247 208)",
538
+ "--sg-badge-hover-bg": "rgb(220 252 231)",
539
+ "--sg-badge-hover-fg": "rgb(21 128 61)",
540
+ "--sg-badge-hover-border": "rgb(134 239 172)",
541
+ "--sg-badge-ring": "rgb(74 222 128)",
542
+ "--sg-badge-soft-bg": "rgb(240 253 244)",
543
+ "--sg-badge-soft-fg": "rgb(22 163 74)",
306
544
  };
307
545
  const SANDPACK_CORE_THEME_VARS = [
308
546
  "--background",
@@ -316,7 +554,63 @@ const SANDPACK_CORE_THEME_VARS = [
316
554
  "--destructive",
317
555
  "--destructive-foreground",
318
556
  "--border",
319
- "--ring"
557
+ "--input",
558
+ "--ring",
559
+ "--muted",
560
+ "--muted-foreground",
561
+ "--radius"
562
+ ];
563
+ // Explicit list of --sg-* vars to read from host via getPropertyValue().
564
+ // CSSStyleDeclaration.length/.item() does NOT enumerate CSS custom properties,
565
+ // so we must call getPropertyValue() for each var by name.
566
+ const SANDPACK_SG_VARS = [
567
+ // Neutrals
568
+ "--sg-bg", "--sg-surface", "--sg-muted-surface",
569
+ "--sg-text", "--sg-muted", "--sg-border", "--sg-ring",
570
+ "--sg-disabled", "--sg-on-disabled",
571
+ "--sg-link", "--sg-link-hover",
572
+ "--sg-radius",
573
+ // On-color tokens
574
+ "--sg-on-primary", "--sg-on-secondary", "--sg-on-tertiary",
575
+ "--sg-on-warning", "--sg-on-error", "--sg-on-info", "--sg-on-success",
576
+ // Primary palette
577
+ "--sg-primary-50", "--sg-primary-100", "--sg-primary-200", "--sg-primary-300",
578
+ "--sg-primary-400", "--sg-primary-500", "--sg-primary-600", "--sg-primary-700",
579
+ "--sg-primary-800", "--sg-primary-900", "--sg-primary-hover", "--sg-primary-active",
580
+ // Secondary palette
581
+ "--sg-secondary-50", "--sg-secondary-100", "--sg-secondary-200", "--sg-secondary-300",
582
+ "--sg-secondary-400", "--sg-secondary-500", "--sg-secondary-600", "--sg-secondary-700",
583
+ "--sg-secondary-800", "--sg-secondary-900", "--sg-secondary-hover", "--sg-secondary-active",
584
+ // Tertiary palette
585
+ "--sg-tertiary-50", "--sg-tertiary-100", "--sg-tertiary-200", "--sg-tertiary-300",
586
+ "--sg-tertiary-400", "--sg-tertiary-500", "--sg-tertiary-600", "--sg-tertiary-700",
587
+ "--sg-tertiary-800", "--sg-tertiary-900", "--sg-tertiary-hover", "--sg-tertiary-active",
588
+ // Warning palette
589
+ "--sg-warning-50", "--sg-warning-100", "--sg-warning-200", "--sg-warning-300",
590
+ "--sg-warning-400", "--sg-warning-500", "--sg-warning-600", "--sg-warning-700",
591
+ "--sg-warning-800", "--sg-warning-900", "--sg-warning-hover", "--sg-warning-active",
592
+ // Error palette
593
+ "--sg-error-50", "--sg-error-100", "--sg-error-200", "--sg-error-300",
594
+ "--sg-error-400", "--sg-error-500", "--sg-error-600", "--sg-error-700",
595
+ "--sg-error-800", "--sg-error-900", "--sg-error-hover", "--sg-error-active",
596
+ // Info palette
597
+ "--sg-info-50", "--sg-info-100", "--sg-info-200", "--sg-info-300",
598
+ "--sg-info-400", "--sg-info-500", "--sg-info-600", "--sg-info-700",
599
+ "--sg-info-800", "--sg-info-900", "--sg-info-hover", "--sg-info-active",
600
+ // Success palette
601
+ "--sg-success-50", "--sg-success-100", "--sg-success-200", "--sg-success-300",
602
+ "--sg-success-400", "--sg-success-500", "--sg-success-600", "--sg-success-700",
603
+ "--sg-success-800", "--sg-success-900", "--sg-success-hover", "--sg-success-active",
604
+ // Button component vars
605
+ "--sg-btn-bg", "--sg-btn-fg", "--sg-btn-border",
606
+ "--sg-btn-hover-bg", "--sg-btn-hover-fg", "--sg-btn-hover-border",
607
+ "--sg-btn-active-bg", "--sg-btn-ring", "--sg-btn-tint",
608
+ // Avatar component vars
609
+ "--sg-avatar-bg", "--sg-avatar-fg", "--sg-avatar-border", "--sg-avatar-ring",
610
+ // Badge component vars
611
+ "--sg-badge-bg", "--sg-badge-fg", "--sg-badge-border",
612
+ "--sg-badge-hover-bg", "--sg-badge-hover-fg", "--sg-badge-hover-border",
613
+ "--sg-badge-ring", "--sg-badge-soft-bg", "--sg-badge-soft-fg",
320
614
  ];
321
615
  const SANDPACK_BASE_STYLES_CSS = `* {
322
616
  box-sizing: border-box;
@@ -365,6 +659,19 @@ const SANDPACK_HOST_STYLES_CSS = `
365
659
  left: auto !important;
366
660
  }
367
661
  `;
662
+ // Keep CRA's expected HTML entry file path for react/react-ts templates.
663
+ const SANDPACK_TAILWIND_INDEX_HTML = `<!DOCTYPE html>
664
+ <html lang="en">
665
+ <head>
666
+ <meta charset="UTF-8">
667
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
668
+ <title>Document</title>
669
+ </head>
670
+ <body>
671
+ <div id="root"></div>
672
+ </body>
673
+ </html>
674
+ `;
368
675
  function normalizeUrl(raw, fallback) {
369
676
  const value = raw?.trim();
370
677
  if (!value)
@@ -417,13 +724,6 @@ function resolveDefaultNpmRegistriesFromEnv() {
417
724
  }
418
725
  ];
419
726
  }
420
- function buildCjsModule(value) {
421
- const serialized = JSON.stringify(value);
422
- return `const data = ${serialized};
423
- module.exports = data;
424
- module.exports.default = data;
425
- `;
426
- }
427
727
  const SANDPACK_MIN_COMPONENT_MESSAGES = {
428
728
  "components.actions.clear": "Clear",
429
729
  "components.actions.cancel": "Cancel",
@@ -444,13 +744,18 @@ const SANDPACK_MIN_COMPONENT_MESSAGES = {
444
744
  "components.rating.cancel": "Cancel rating",
445
745
  "components.radiogroup.cancel": "No option"
446
746
  };
447
- const SANDPACK_SEEDGRID_PT_BR_JSON_SHIM = buildCjsModule(SANDPACK_MIN_COMPONENT_MESSAGES);
448
- const SANDPACK_SEEDGRID_PT_PT_JSON_SHIM = buildCjsModule(SANDPACK_MIN_COMPONENT_MESSAGES);
449
- const SANDPACK_SEEDGRID_EN_US_JSON_SHIM = buildCjsModule(SANDPACK_MIN_COMPONENT_MESSAGES);
450
- const SANDPACK_SEEDGRID_ES_JSON_SHIM = buildCjsModule(SANDPACK_MIN_COMPONENT_MESSAGES);
451
- const SANDPACK_SEEDGRID_BLOCKED_EMAIL_DOMAINS_JSON_SHIM = buildCjsModule({
747
+ // These shims use valid JSON so the Sandpack bundler can parse them as JSON modules.
748
+ // (The self-hosted bundler evaluates .json files as JS, wrapping them with module.exports = {...}.)
749
+ const SANDPACK_SEEDGRID_PT_BR_JSON_SHIM = JSON.stringify(SANDPACK_MIN_COMPONENT_MESSAGES);
750
+ const SANDPACK_SEEDGRID_PT_PT_JSON_SHIM = JSON.stringify(SANDPACK_MIN_COMPONENT_MESSAGES);
751
+ const SANDPACK_SEEDGRID_EN_US_JSON_SHIM = JSON.stringify(SANDPACK_MIN_COMPONENT_MESSAGES);
752
+ const SANDPACK_SEEDGRID_ES_JSON_SHIM = JSON.stringify(SANDPACK_MIN_COMPONENT_MESSAGES);
753
+ const SANDPACK_SEEDGRID_BLOCKED_EMAIL_DOMAINS_JSON_SHIM = JSON.stringify({
452
754
  blockedEmailDomains: []
453
755
  });
756
+ // CJS shims for .js locale files (new npm versions after the JSON→TypeScript conversion).
757
+ const SANDPACK_SEEDGRID_LOCALE_JS_SHIM = `module.exports = ${JSON.stringify(SANDPACK_MIN_COMPONENT_MESSAGES)};`;
758
+ const SANDPACK_SEEDGRID_BLOCKED_EMAIL_JS_SHIM = `module.exports = ${JSON.stringify({ blockedEmailDomains: [] })};`;
454
759
  function parseRgbParts(raw) {
455
760
  const value = raw.trim();
456
761
  if (!value)
@@ -541,10 +846,9 @@ function readThemeVarsFromHost() {
541
846
  if (value)
542
847
  themeVars[varName] = value;
543
848
  }
544
- for (let index = 0; index < computed.length; index += 1) {
545
- const varName = computed.item(index)?.trim();
546
- if (!varName || !varName.startsWith("--sg-"))
547
- continue;
849
+ // CSSStyleDeclaration.length/.item() does NOT enumerate CSS custom properties,
850
+ // so we explicitly call getPropertyValue() for each known --sg-* var.
851
+ for (const varName of SANDPACK_SG_VARS) {
548
852
  const value = computed.getPropertyValue(varName).trim();
549
853
  if (value)
550
854
  themeVars[varName] = value;
@@ -552,10 +856,41 @@ function readThemeVarsFromHost() {
552
856
  Object.assign(themeVars, mapSgVarsToCoreVars(themeVars));
553
857
  return themeVars;
554
858
  }
859
+ function getStyleSheetHref(styleSheet) {
860
+ const cssSheet = styleSheet;
861
+ if (cssSheet.href)
862
+ return cssSheet.href;
863
+ const ownerNode = cssSheet.ownerNode;
864
+ if (!(ownerNode instanceof Element))
865
+ return "";
866
+ return ownerNode.getAttribute("data-n-href") ?? "";
867
+ }
868
+ function readHostNextCssText() {
869
+ if (typeof document === "undefined")
870
+ return "";
871
+ const chunks = [];
872
+ const sheets = Array.from(document.styleSheets);
873
+ for (const sheet of sheets) {
874
+ const href = getStyleSheetHref(sheet);
875
+ if (!href.includes("/_next/static/css/"))
876
+ continue;
877
+ let rules;
878
+ try {
879
+ rules = sheet.cssRules;
880
+ }
881
+ catch {
882
+ continue;
883
+ }
884
+ for (const rule of Array.from(rules)) {
885
+ chunks.push(rule.cssText);
886
+ }
887
+ }
888
+ return chunks.join("\n");
889
+ }
555
890
  function normalizeCssSize(value) {
556
891
  return typeof value === "number" ? `${value}px` : value;
557
892
  }
558
- function buildSandpackStylesCss(themeVars, previewPadding) {
893
+ function buildSandpackStylesCss(themeVars, previewPadding, hostCss = "") {
559
894
  const mergedVars = {
560
895
  ...SANDPACK_FALLBACK_THEME_VARS,
561
896
  ...themeVars,
@@ -569,7 +904,8 @@ function buildSandpackStylesCss(themeVars, previewPadding) {
569
904
  ${rootVars}
570
905
  }
571
906
 
572
- ${SANDPACK_BASE_STYLES_CSS}`;
907
+ ${SANDPACK_BASE_STYLES_CSS}
908
+ ${hostCss ? `\n\n${hostCss}` : ""}`;
573
909
  }
574
910
  function ReadonlyBlock({ code }) {
575
911
  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 }) }));
@@ -688,6 +1024,13 @@ function RunButton({ onRun }) {
688
1024
  }, [onRun, running, sandpack]);
689
1025
  return (_jsx(SgButton, { severity: "primary", size: "sm", loading: running, onClick: handleRun, children: running ? "Running" : "Run" }));
690
1026
  }
1027
+ const COREJS_PROVIDER_WARNING_PREFIX = "Internal error in the corejs3 provider: unknown polyfill";
1028
+ function shouldSuppressCoreJsProviderWarning(args) {
1029
+ if (args.length === 0)
1030
+ return false;
1031
+ const firstArg = args[0];
1032
+ return typeof firstArg === "string" && firstArg.includes(COREJS_PROVIDER_WARNING_PREFIX);
1033
+ }
691
1034
  export default function SgPlayground(props) {
692
1035
  const { code, interactive = false, codeContract = "renderBody", preset = "auto", title, description, height = 360, expandedHeight = "70vh", expandable = true, resizable = true, resizeAxis = "vertical", previewPadding, className, dependencies, defaultImports, previewWrapperClassName = "h-[420px] rounded-xl border border-border bg-muted/30 p-3", seedgridDependency, bundlerURL, bundlerTimeoutMs, npmRegistries, withCard = true, collapsible = true, defaultOpen = true, cardId } = props;
693
1036
  const effectivePreviewPadding = normalizeCssSize(previewPadding ?? (codeContract === "appFile" ? 12 : 0));
@@ -700,7 +1043,8 @@ export default function SgPlayground(props) {
700
1043
  const root = document.documentElement;
701
1044
  const refreshStyles = () => {
702
1045
  const liveThemeVars = readThemeVarsFromHost();
703
- setSandpackStylesCss(buildSandpackStylesCss(liveThemeVars, effectivePreviewPadding));
1046
+ const hostCss = readHostNextCssText();
1047
+ setSandpackStylesCss(buildSandpackStylesCss(liveThemeVars, effectivePreviewPadding, hostCss));
704
1048
  };
705
1049
  let frameId = null;
706
1050
  const scheduleRefresh = () => {
@@ -733,14 +1077,14 @@ export default function SgPlayground(props) {
733
1077
  SgButton,
734
1078
  SgAutocomplete
735
1079
  } from "@seedgrid/fe-components";`;
736
- const appTsx = codeContract === "appFile"
1080
+ const appTsx = React.useMemo(() => codeContract === "appFile"
737
1081
  ? code
738
- : buildAppTsxFromRenderBody(code, seedgridDefaultImports, previewWrapperClassName);
1082
+ : buildAppTsxFromRenderBody(code, seedgridDefaultImports, previewWrapperClassName), [code, codeContract, previewWrapperClassName, seedgridDefaultImports]);
739
1083
  const resolvedSeedgridDependency = seedgridDependency ??
740
1084
  process.env.NEXT_PUBLIC_SANDPACK_SEEDGRID_DEPENDENCY ??
741
1085
  DEFAULT_SEEDGRID_DEPENDENCY;
742
- const requestedDeps = dependencies ?? {};
743
- const requestedDepKeys = Object.keys(requestedDeps);
1086
+ const requestedDeps = React.useMemo(() => dependencies ?? {}, [dependencies]);
1087
+ const requestedDepKeys = React.useMemo(() => Object.keys(requestedDeps), [requestedDeps]);
744
1088
  const resolvedBundlerURL = normalizeUrl(bundlerURL ?? process.env.NEXT_PUBLIC_SANDPACK_BUNDLER_URL, DEFAULT_SANDPACK_BUNDLER_URL);
745
1089
  const resolvedBundlerTimeoutMs = normalizeTimeoutMs(bundlerTimeoutMs ??
746
1090
  Number(process.env.NEXT_PUBLIC_SANDPACK_BUNDLER_TIMEOUT_MS ?? Number.NaN), DEFAULT_SANDPACK_BUNDLER_TIMEOUT_MS);
@@ -785,104 +1129,280 @@ export default function SgPlayground(props) {
785
1129
  const shouldShimSandpackReact = includeSeedgridDependency && !includeSandpackReactDependency;
786
1130
  const shouldShimTiptap = includeSeedgridDependency && !includeEditorDependencies;
787
1131
  const shouldIncludeNodePolyfills = includeEditorDependencies;
788
- const files = {
789
- "/App.tsx": { code: appTsx, active: true },
790
- "/styles.css": { code: sandpackStylesCss || buildSandpackStylesCss({}, effectivePreviewPadding) }
791
- };
792
- if (includeSeedgridDependency) {
793
- // Compatibility shim for legacy @seedgrid/fe-components builds that still import "qrcode" (node-only path).
794
- files["/node_modules/qrcode/index.js"] = { code: SANDPACK_QRCODE_SHIM_INDEX_JS, hidden: true };
795
- // Sandpack runtime can evaluate JSON files as plain JS modules.
796
- // Provide CJS-compatible shims to keep @seedgrid/fe-components i18n/validators working.
797
- files["/node_modules/@seedgrid/fe-components/dist/i18n/pt-BR.json"] = {
798
- code: SANDPACK_SEEDGRID_PT_BR_JSON_SHIM,
799
- hidden: true
800
- };
801
- files["/node_modules/@seedgrid/fe-components/dist/i18n/pt-PT.json"] = {
802
- code: SANDPACK_SEEDGRID_PT_PT_JSON_SHIM,
803
- hidden: true
804
- };
805
- files["/node_modules/@seedgrid/fe-components/dist/i18n/en-US.json"] = {
806
- code: SANDPACK_SEEDGRID_EN_US_JSON_SHIM,
807
- hidden: true
808
- };
809
- files["/node_modules/@seedgrid/fe-components/dist/i18n/es.json"] = {
810
- code: SANDPACK_SEEDGRID_ES_JSON_SHIM,
811
- hidden: true
812
- };
813
- files["/node_modules/@seedgrid/fe-components/dist/blocked-email-domains.json"] = {
814
- code: SANDPACK_SEEDGRID_BLOCKED_EMAIL_DOMAINS_JSON_SHIM,
815
- hidden: true
816
- };
817
- }
818
- if (shouldIncludeNodePolyfills) {
819
- // markdown-it CLI entry uses node:fs and breaks in browser runtime.
820
- files["/node_modules/markdown-it/bin/markdown-it.mjs"] = {
821
- code: SANDPACK_MARKDOWN_IT_BIN_SHIM,
822
- hidden: true
823
- };
824
- // Node builtin compatibility shims used by transitive dependencies (e.g. argparse from markdown-it/tiptap).
825
- files["/node_modules/assert/index.js"] = { code: SANDPACK_ASSERT_SHIM_INDEX_JS, hidden: true };
826
- files["/node_modules/util/index.js"] = { code: SANDPACK_UTIL_SHIM_INDEX_JS, hidden: true };
827
- files["/node_modules/path/index.js"] = { code: SANDPACK_PATH_SHIM_INDEX_JS, hidden: true };
828
- files["/node_modules/fs/index.js"] = { code: SANDPACK_FS_SHIM_INDEX_JS, hidden: true };
829
- files["/node_modules/process/index.js"] = { code: SANDPACK_PROCESS_SHIM_INDEX_JS, hidden: true };
830
- }
831
- if (shouldShimSandpackReact) {
832
- files["/node_modules/@codesandbox/sandpack-react/index.js"] = {
833
- code: SANDPACK_SANDBOX_SANDPACK_REACT_SHIM_INDEX_JS,
834
- hidden: true
835
- };
836
- }
837
- if (shouldShimTiptap) {
838
- files["/node_modules/@seedgrid/fe-components/dist/inputs/SgTextEditor.js"] = {
839
- code: SANDPACK_SEEDGRID_TEXT_EDITOR_SHIM_INDEX_JS,
840
- hidden: true
841
- };
842
- files["/node_modules/@seedgrid/fe-components/dist/inputs/SgTextEditor"] = {
843
- code: SANDPACK_SEEDGRID_TEXT_EDITOR_SHIM_INDEX_JS,
844
- hidden: true
845
- };
846
- files["/node_modules/@seedgrid/fe-components/dist/inputs/SgTextEditor.mjs"] = {
847
- code: SANDPACK_SEEDGRID_TEXT_EDITOR_SHIM_INDEX_JS,
848
- hidden: true
1132
+ // Shim lucide-react for all non-full presets to avoid OOM from bundling ~1400 icon components.
1133
+ // Full preset gets the real package so icons render correctly.
1134
+ const shouldShimLucide = includeSeedgridDependency && resolvedPreset !== "full" && !requestedDepKeys.includes("lucide-react");
1135
+ React.useEffect(() => {
1136
+ if (!shouldIncludeNodePolyfills)
1137
+ return;
1138
+ if (typeof window === "undefined")
1139
+ return;
1140
+ const originalError = console.error;
1141
+ const originalWarn = console.warn;
1142
+ console.error = (...args) => {
1143
+ if (shouldSuppressCoreJsProviderWarning(args))
1144
+ return;
1145
+ originalError(...args);
849
1146
  };
850
- files["/node_modules/@tiptap/react/package.json"] = {
851
- code: JSON.stringify({ name: "@tiptap/react", version: "0.0.0-shim", main: "index.js", module: "index.mjs" }),
852
- hidden: true
1147
+ console.warn = (...args) => {
1148
+ if (shouldSuppressCoreJsProviderWarning(args))
1149
+ return;
1150
+ originalWarn(...args);
853
1151
  };
854
- files["/node_modules/@tiptap/react/index.js"] = {
855
- code: SANDPACK_TIPTAP_REACT_SHIM_INDEX_JS,
856
- hidden: true
1152
+ return () => {
1153
+ console.error = originalError;
1154
+ console.warn = originalWarn;
857
1155
  };
858
- files["/node_modules/@tiptap/react/index.mjs"] = {
859
- code: SANDPACK_TIPTAP_REACT_SHIM_INDEX_JS,
860
- hidden: true
1156
+ }, [shouldIncludeNodePolyfills]);
1157
+ const files = React.useMemo(() => {
1158
+ const nextFiles = {
1159
+ "/App.tsx": { code: appTsx, active: true },
1160
+ "/styles.css": { code: sandpackStylesCss || buildSandpackStylesCss({}, effectivePreviewPadding) }
861
1161
  };
862
- for (const packageName of TIPTAP_SHIM_PACKAGES) {
863
- files[`/node_modules/${packageName}/package.json`] = {
864
- code: JSON.stringify({ name: packageName, version: "0.0.0-shim", main: "index.js", module: "index.mjs" }),
1162
+ if (includeSeedgridDependency) {
1163
+ // Intercept the package entry point and redirect to the pre-compiled sandbox bundle
1164
+ // (dist/sandbox.cjs) instead of the tsc barrel file (dist/index.js).
1165
+ // This makes the Sandpack bundler fetch and process ONE file instead of 200+ individual files.
1166
+ // The real package.json from npm is left intact so version resolution works normally.
1167
+ // Requires @seedgrid/fe-components to be built with: pnpm run build:sandbox
1168
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/index.js"] = {
1169
+ code: `module.exports = require("./sandbox.cjs");`,
1170
+ hidden: true
1171
+ };
1172
+ // Compatibility shim for legacy @seedgrid/fe-components builds that still import "qrcode" (node-only path).
1173
+ nextFiles["/node_modules/qrcode/index.js"] = { code: SANDPACK_QRCODE_SHIM_INDEX_JS, hidden: true };
1174
+ // Keep CRA's public/index.html entry path expected by the react/react-ts templates.
1175
+ nextFiles["/public/index.html"] = { code: SANDPACK_TAILWIND_INDEX_HTML, hidden: true };
1176
+ // Sandpack runtime can evaluate JSON files as plain JS modules.
1177
+ // Provide CJS-compatible shims to keep @seedgrid/fe-components i18n/validators working.
1178
+ // .json shims cover current npm versions; .js shims cover new versions after JSON→TypeScript conversion.
1179
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/pt-BR.json"] = {
1180
+ code: SANDPACK_SEEDGRID_PT_BR_JSON_SHIM,
865
1181
  hidden: true
866
1182
  };
867
- files[`/node_modules/${packageName}/index.js`] = {
868
- code: SANDPACK_TIPTAP_EXTENSION_SHIM_INDEX_JS,
1183
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/pt-PT.json"] = {
1184
+ code: SANDPACK_SEEDGRID_PT_PT_JSON_SHIM,
869
1185
  hidden: true
870
1186
  };
871
- files[`/node_modules/${packageName}/index.mjs`] = {
872
- code: SANDPACK_TIPTAP_EXTENSION_SHIM_INDEX_JS,
1187
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/en-US.json"] = {
1188
+ code: SANDPACK_SEEDGRID_EN_US_JSON_SHIM,
1189
+ hidden: true
1190
+ };
1191
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/es.json"] = {
1192
+ code: SANDPACK_SEEDGRID_ES_JSON_SHIM,
1193
+ hidden: true
1194
+ };
1195
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/blocked-email-domains.json"] = {
1196
+ code: SANDPACK_SEEDGRID_BLOCKED_EMAIL_DOMAINS_JSON_SHIM,
1197
+ hidden: true
1198
+ };
1199
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/pt-BR.js"] = {
1200
+ code: SANDPACK_SEEDGRID_LOCALE_JS_SHIM,
1201
+ hidden: true
1202
+ };
1203
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/pt-PT.js"] = {
1204
+ code: SANDPACK_SEEDGRID_LOCALE_JS_SHIM,
1205
+ hidden: true
1206
+ };
1207
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/en-US.js"] = {
1208
+ code: SANDPACK_SEEDGRID_LOCALE_JS_SHIM,
1209
+ hidden: true
1210
+ };
1211
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/es.js"] = {
1212
+ code: SANDPACK_SEEDGRID_LOCALE_JS_SHIM,
1213
+ hidden: true
1214
+ };
1215
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/blocked-email-domains.js"] = {
1216
+ code: SANDPACK_SEEDGRID_BLOCKED_EMAIL_JS_SHIM,
873
1217
  hidden: true
874
1218
  };
875
1219
  }
876
- }
877
- const deps = {
1220
+ if (shouldIncludeNodePolyfills) {
1221
+ const markdownItPackageShimPaths = [
1222
+ "/node_modules/markdown-it/package.json",
1223
+ "/node_modules/prosemirror-markdown/node_modules/markdown-it/package.json",
1224
+ "/node_modules/@tiptap/pm/node_modules/markdown-it/package.json",
1225
+ "/node_modules/@tiptap/pm/node_modules/prosemirror-markdown/node_modules/markdown-it/package.json"
1226
+ ];
1227
+ const markdownItBinShimPaths = [
1228
+ "/node_modules/markdown-it/bin/markdown-it.mjs",
1229
+ "/node_modules/prosemirror-markdown/node_modules/markdown-it/bin/markdown-it.mjs",
1230
+ "/node_modules/@tiptap/pm/node_modules/markdown-it/bin/markdown-it.mjs",
1231
+ "/node_modules/@tiptap/pm/node_modules/prosemirror-markdown/node_modules/markdown-it/bin/markdown-it.mjs"
1232
+ ];
1233
+ // Keep markdown-it package metadata browser-safe. In some Sandpack resolver paths,
1234
+ // `bin` can be chosen as entrypoint; forcing it to dist avoids node-only imports.
1235
+ for (const shimPath of markdownItPackageShimPaths) {
1236
+ nextFiles[shimPath] = {
1237
+ code: SANDPACK_MARKDOWN_IT_PACKAGE_JSON_SHIM,
1238
+ hidden: true
1239
+ };
1240
+ }
1241
+ // markdown-it CLI entry uses node:fs and breaks in browser runtime.
1242
+ for (const shimPath of markdownItBinShimPaths) {
1243
+ nextFiles[shimPath] = {
1244
+ code: SANDPACK_MARKDOWN_IT_BIN_SHIM,
1245
+ hidden: true
1246
+ };
1247
+ }
1248
+ // Node builtin compatibility shims used by transitive dependencies (e.g. argparse from markdown-it/tiptap).
1249
+ nextFiles["/node_modules/assert/package.json"] = {
1250
+ code: JSON.stringify({ name: "assert", version: "0.0.0-shim", main: "index.js" }),
1251
+ hidden: true
1252
+ };
1253
+ nextFiles["/node_modules/util/package.json"] = {
1254
+ code: JSON.stringify({ name: "util", version: "0.0.0-shim", main: "index.js" }),
1255
+ hidden: true
1256
+ };
1257
+ nextFiles["/node_modules/path/package.json"] = {
1258
+ code: JSON.stringify({ name: "path", version: "0.0.0-shim", main: "index.js" }),
1259
+ hidden: true
1260
+ };
1261
+ nextFiles["/node_modules/fs/package.json"] = {
1262
+ code: JSON.stringify({ name: "fs", version: "0.0.0-shim", main: "index.js" }),
1263
+ hidden: true
1264
+ };
1265
+ nextFiles["/node_modules/process/package.json"] = {
1266
+ code: JSON.stringify({ name: "process", version: "0.0.0-shim", main: "index.js" }),
1267
+ hidden: true
1268
+ };
1269
+ nextFiles["/node_modules/assert/index.js"] = { code: SANDPACK_ASSERT_SHIM_INDEX_JS, hidden: true };
1270
+ nextFiles["/node_modules/util/index.js"] = { code: SANDPACK_UTIL_SHIM_INDEX_JS, hidden: true };
1271
+ nextFiles["/node_modules/path/index.js"] = { code: SANDPACK_PATH_SHIM_INDEX_JS, hidden: true };
1272
+ nextFiles["/node_modules/fs/index.js"] = { code: SANDPACK_FS_SHIM_INDEX_JS, hidden: true };
1273
+ nextFiles["/node_modules/process/index.js"] = { code: SANDPACK_PROCESS_SHIM_INDEX_JS, hidden: true };
1274
+ // node:* specifiers are increasingly used by ESM packages.
1275
+ // Mirror aliases to the shims above so both `fs` and `node:fs` resolve.
1276
+ nextFiles["/node_modules/node:assert/package.json"] = {
1277
+ code: SANDPACK_NODE_ASSERT_PACKAGE_JSON_SHIM,
1278
+ hidden: true
1279
+ };
1280
+ nextFiles["/node_modules/node:assert/index.js"] = {
1281
+ code: SANDPACK_NODE_ASSERT_ALIAS_SHIM_INDEX_JS,
1282
+ hidden: true
1283
+ };
1284
+ nextFiles["/node_modules/node:util/package.json"] = {
1285
+ code: SANDPACK_NODE_UTIL_PACKAGE_JSON_SHIM,
1286
+ hidden: true
1287
+ };
1288
+ nextFiles["/node_modules/node:util/index.js"] = {
1289
+ code: SANDPACK_NODE_UTIL_ALIAS_SHIM_INDEX_JS,
1290
+ hidden: true
1291
+ };
1292
+ nextFiles["/node_modules/node:path/package.json"] = {
1293
+ code: SANDPACK_NODE_PATH_PACKAGE_JSON_SHIM,
1294
+ hidden: true
1295
+ };
1296
+ nextFiles["/node_modules/node:path/index.js"] = {
1297
+ code: SANDPACK_NODE_PATH_ALIAS_SHIM_INDEX_JS,
1298
+ hidden: true
1299
+ };
1300
+ nextFiles["/node_modules/node:fs/package.json"] = {
1301
+ code: SANDPACK_NODE_FS_PACKAGE_JSON_SHIM,
1302
+ hidden: true
1303
+ };
1304
+ nextFiles["/node_modules/node:fs/index.js"] = {
1305
+ code: SANDPACK_NODE_FS_ALIAS_SHIM_INDEX_JS,
1306
+ hidden: true
1307
+ };
1308
+ nextFiles["/node_modules/node:process/package.json"] = {
1309
+ code: SANDPACK_NODE_PROCESS_PACKAGE_JSON_SHIM,
1310
+ hidden: true
1311
+ };
1312
+ nextFiles["/node_modules/node:process/index.js"] = {
1313
+ code: SANDPACK_NODE_PROCESS_ALIAS_SHIM_INDEX_JS,
1314
+ hidden: true
1315
+ };
1316
+ nextFiles["/node_modules/node:fs/promises/package.json"] = {
1317
+ code: SANDPACK_NODE_FS_PROMISES_PACKAGE_JSON_SHIM,
1318
+ hidden: true
1319
+ };
1320
+ nextFiles["/node_modules/node:fs/promises/index.js"] = {
1321
+ code: SANDPACK_NODE_FS_PROMISES_ALIAS_SHIM_INDEX_JS,
1322
+ hidden: true
1323
+ };
1324
+ }
1325
+ if (shouldShimSandpackReact) {
1326
+ nextFiles["/node_modules/@codesandbox/sandpack-react/index.js"] = {
1327
+ code: SANDPACK_SANDBOX_SANDPACK_REACT_SHIM_INDEX_JS,
1328
+ hidden: true
1329
+ };
1330
+ }
1331
+ if (shouldShimTiptap) {
1332
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/inputs/SgTextEditor.js"] = {
1333
+ code: SANDPACK_SEEDGRID_TEXT_EDITOR_SHIM_INDEX_JS,
1334
+ hidden: true
1335
+ };
1336
+ nextFiles["/node_modules/@seedgrid/fe-components/dist/inputs/SgTextEditor.mjs"] = {
1337
+ code: SANDPACK_SEEDGRID_TEXT_EDITOR_SHIM_INDEX_JS,
1338
+ hidden: true
1339
+ };
1340
+ nextFiles["/node_modules/@tiptap/react/package.json"] = {
1341
+ code: JSON.stringify({ name: "@tiptap/react", version: "0.0.0-shim", main: "index.js", module: "index.mjs" }),
1342
+ hidden: true
1343
+ };
1344
+ nextFiles["/node_modules/@tiptap/react/index.js"] = {
1345
+ code: SANDPACK_TIPTAP_REACT_SHIM_INDEX_JS,
1346
+ hidden: true
1347
+ };
1348
+ nextFiles["/node_modules/@tiptap/react/index.mjs"] = {
1349
+ code: SANDPACK_TIPTAP_REACT_SHIM_INDEX_JS,
1350
+ hidden: true
1351
+ };
1352
+ for (const packageName of TIPTAP_SHIM_PACKAGES) {
1353
+ nextFiles[`/node_modules/${packageName}/package.json`] = {
1354
+ code: JSON.stringify({ name: packageName, version: "0.0.0-shim", main: "index.js", module: "index.mjs" }),
1355
+ hidden: true
1356
+ };
1357
+ nextFiles[`/node_modules/${packageName}/index.js`] = {
1358
+ code: SANDPACK_TIPTAP_EXTENSION_SHIM_INDEX_JS,
1359
+ hidden: true
1360
+ };
1361
+ nextFiles[`/node_modules/${packageName}/index.mjs`] = {
1362
+ code: SANDPACK_TIPTAP_EXTENSION_SHIM_INDEX_JS,
1363
+ hidden: true
1364
+ };
1365
+ }
1366
+ }
1367
+ if (shouldShimLucide) {
1368
+ nextFiles["/node_modules/lucide-react/package.json"] = {
1369
+ code: JSON.stringify({ name: "lucide-react", version: "0.0.0-shim", main: "index.js" }),
1370
+ hidden: true
1371
+ };
1372
+ nextFiles["/node_modules/lucide-react/index.js"] = {
1373
+ code: SANDPACK_LUCIDE_REACT_SHIM_INDEX_JS,
1374
+ hidden: true
1375
+ };
1376
+ }
1377
+ return nextFiles;
1378
+ }, [
1379
+ appTsx,
1380
+ effectivePreviewPadding,
1381
+ includeSeedgridDependency,
1382
+ sandpackStylesCss,
1383
+ shouldIncludeNodePolyfills,
1384
+ shouldShimLucide,
1385
+ shouldShimSandpackReact,
1386
+ shouldShimTiptap
1387
+ ]);
1388
+ const deps = React.useMemo(() => ({
878
1389
  ...DEFAULT_SANDBOX_BASE_DEPENDENCIES,
879
1390
  ...(includeSeedgridDependency ? DEFAULT_SEEDGRID_RUNTIME_DEPENDENCIES : {}),
1391
+ ...(includeSeedgridDependency && !shouldShimLucide ? { "lucide-react": "^0.468.0" } : {}),
880
1392
  ...(includeEditorDependencies ? DEFAULT_SEEDGRID_EDITOR_DEPENDENCIES : {}),
881
1393
  ...(includeSandpackReactDependency ? DEFAULT_SANDBOX_HOST_DEPENDENCIES : {}),
882
1394
  ...(shouldIncludeNodePolyfills ? DEFAULT_SANDPACK_POLYFILLS : {}),
883
1395
  ...(includeSeedgridDependency ? { "@seedgrid/fe-components": resolvedSeedgridDependency } : {}),
884
1396
  ...requestedDeps
885
- };
1397
+ }), [
1398
+ includeEditorDependencies,
1399
+ includeSandpackReactDependency,
1400
+ includeSeedgridDependency,
1401
+ requestedDeps,
1402
+ resolvedSeedgridDependency,
1403
+ shouldIncludeNodePolyfills,
1404
+ shouldShimLucide
1405
+ ]);
886
1406
  const currentHeight = isExpanded ? expandedHeight : height;
887
1407
  const resizeClass = !resizable
888
1408
  ? undefined
@@ -905,8 +1425,8 @@ export default function SgPlayground(props) {
905
1425
  bundlerTimeout: resolvedBundlerTimeoutMs,
906
1426
  activeFile: "/App.tsx",
907
1427
  visibleFiles: ["/App.tsx"],
908
- externalResources: SANDPACK_EXTERNAL_RESOURCES
909
- }), [resolvedBundlerTimeoutMs, resolvedBundlerURL]);
1428
+ externalResources: includeSeedgridDependency ? SANDPACK_EXTERNAL_RESOURCES : []
1429
+ }), [includeSeedgridDependency, resolvedBundlerTimeoutMs, resolvedBundlerURL]);
910
1430
  const content = interactive ? (_jsx("div", { className: cn(withCard ? "" : "rounded-lg border border-border", withCard ? undefined : className), children: _jsxs(SandpackProvider, { template: "react-ts", files: files, customSetup: sandpackCustomSetup, options: sandpackOptions, children: [_jsx("style", { children: SANDPACK_HOST_STYLES_CSS }), _jsxs("div", { className: "flex items-center justify-between border-b border-border px-3 py-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [withCard ? null : _jsx("span", { className: "text-sm font-medium", children: title ?? "Example" }), _jsx("span", { className: "text-xs text-muted-foreground", children: codeContract === "renderBody" ? "editable snippet" : "editable App.tsx" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [expandable ? (_jsx(SgButton, { appearance: "outline", size: "sm", onClick: () => setIsExpanded((prev) => !prev), children: isExpanded ? "Reduzir" : "Expandir" })) : null, _jsx(RunButton, { onRun: () => setActivePanel("preview") })] })] }), _jsxs("div", { className: "flex md:hidden border-b border-border", children: [_jsx("button", { type: "button", className: cn("flex-1 py-2 text-sm font-medium border-b-2 -mb-px transition-colors", activePanel === "code"
911
1431
  ? "border-primary text-foreground"
912
1432
  : "border-transparent text-muted-foreground hover:text-foreground"), onClick: () => setActivePanel("code"), children: "C\u00F3digo" }), _jsx("button", { type: "button", className: cn("flex-1 py-2 text-sm font-medium border-b-2 -mb-px transition-colors", activePanel === "preview"