@seedgrid/fe-components 2026.3.3-1 → 2026.3.3-10
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.
- package/dist/blocked-email-domains.d.ts +5 -0
- package/dist/blocked-email-domains.d.ts.map +1 -0
- package/dist/{blocked-email-domains.json → blocked-email-domains.js} +4 -3
- package/dist/buttons/SgButton.d.ts.map +1 -1
- package/dist/buttons/SgButton.js +5 -4
- package/dist/i18n/en-US.d.ts +3 -0
- package/dist/i18n/en-US.d.ts.map +1 -0
- package/dist/i18n/{en-US.json → en-US.js} +3 -2
- package/dist/i18n/es.d.ts +3 -0
- package/dist/i18n/es.d.ts.map +1 -0
- package/dist/i18n/es.js +85 -0
- package/dist/i18n/index.d.ts +4 -336
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +4 -4
- package/dist/i18n/pt-BR.d.ts +3 -0
- package/dist/i18n/pt-BR.d.ts.map +1 -0
- package/dist/i18n/{pt-BR.json → pt-BR.js} +13 -12
- package/dist/i18n/pt-PT.d.ts +3 -0
- package/dist/i18n/pt-PT.d.ts.map +1 -0
- package/dist/i18n/{pt-PT.json → pt-PT.js} +13 -12
- package/dist/inputs/SgTextEditor.d.ts.map +1 -1
- package/dist/inputs/SgTextEditor.js +1 -0
- package/dist/manifest.js +2 -2
- package/dist/others/SgPlayground.d.ts.map +1 -1
- package/dist/others/SgPlayground.js +611 -137
- package/dist/sandbox.cjs +76 -46
- package/dist/validators.js +1 -1
- package/package.json +1 -1
- package/dist/i18n/es.json +0 -84
|
@@ -59,11 +59,11 @@ const DEFAULT_SEEDGRID_EDITOR_DEPENDENCIES = {
|
|
|
59
59
|
const DEFAULT_SANDBOX_HOST_DEPENDENCIES = {
|
|
60
60
|
"@codesandbox/sandpack-react": "^2.20.0"
|
|
61
61
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
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 = {};
|
|
67
67
|
const TIPTAP_SHIM_PACKAGES = [
|
|
68
68
|
"@tiptap/core",
|
|
69
69
|
"@tiptap/pm",
|
|
@@ -79,10 +79,7 @@ const TIPTAP_SHIM_PACKAGES = [
|
|
|
79
79
|
"@tiptap/extension-superscript",
|
|
80
80
|
"@tiptap/extension-font-family"
|
|
81
81
|
];
|
|
82
|
-
const SANDPACK_EXTERNAL_RESOURCES = [
|
|
83
|
-
// Prebuilt utility CSS so classes from @seedgrid/fe-components can render inside Sandpack
|
|
84
|
-
"https://unpkg.com/tailwindcss@2.2.19/dist/tailwind.min.css"
|
|
85
|
-
];
|
|
82
|
+
const SANDPACK_EXTERNAL_RESOURCES = [];
|
|
86
83
|
const SANDPACK_QRCODE_SHIM_INDEX_JS = `const makeError = () =>
|
|
87
84
|
new Error(
|
|
88
85
|
"qrcode (node build) is not supported in Sandpack browser runtime. Update @seedgrid/fe-components to a browser-safe QR implementation."
|
|
@@ -104,6 +101,26 @@ const SANDPACK_MARKDOWN_IT_BIN_SHIM = `import markdownit from "../index.mjs";
|
|
|
104
101
|
export default markdownit;
|
|
105
102
|
export { markdownit };
|
|
106
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
|
+
});
|
|
107
124
|
const SANDPACK_SANDBOX_SANDPACK_REACT_SHIM_INDEX_JS = `export const SandpackProvider = ({ children }) => children ?? null;
|
|
108
125
|
export const SandpackCodeEditor = () => null;
|
|
109
126
|
export const SandpackPreview = () => null;
|
|
@@ -305,7 +322,68 @@ if (typeof globalThis !== "undefined" && !globalThis.process) {
|
|
|
305
322
|
module.exports = processShim;
|
|
306
323
|
module.exports.default = processShim;
|
|
307
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
|
+
});
|
|
308
385
|
const SANDPACK_FALLBACK_THEME_VARS = {
|
|
386
|
+
// shadcn/ui design tokens (HSL)
|
|
309
387
|
"--background": "0 0% 100%",
|
|
310
388
|
"--foreground": "222.2 84% 4.9%",
|
|
311
389
|
"--primary": "142 76% 36%",
|
|
@@ -317,14 +395,152 @@ const SANDPACK_FALLBACK_THEME_VARS = {
|
|
|
317
395
|
"--destructive": "0 84.2% 60.2%",
|
|
318
396
|
"--destructive-foreground": "0 0% 100%",
|
|
319
397
|
"--border": "214.3 31.8% 91.4%",
|
|
320
|
-
"--
|
|
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",
|
|
321
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",
|
|
322
448
|
"--sg-secondary-600": "82 82 91",
|
|
323
|
-
"--sg-
|
|
324
|
-
"--sg-
|
|
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",
|
|
325
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",
|
|
326
500
|
"--sg-info-600": "2 132 199",
|
|
327
|
-
"--sg-
|
|
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)",
|
|
328
544
|
};
|
|
329
545
|
const SANDPACK_CORE_THEME_VARS = [
|
|
330
546
|
"--background",
|
|
@@ -338,7 +554,63 @@ const SANDPACK_CORE_THEME_VARS = [
|
|
|
338
554
|
"--destructive",
|
|
339
555
|
"--destructive-foreground",
|
|
340
556
|
"--border",
|
|
341
|
-
"--
|
|
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",
|
|
342
614
|
];
|
|
343
615
|
const SANDPACK_BASE_STYLES_CSS = `* {
|
|
344
616
|
box-sizing: border-box;
|
|
@@ -387,6 +659,19 @@ const SANDPACK_HOST_STYLES_CSS = `
|
|
|
387
659
|
left: auto !important;
|
|
388
660
|
}
|
|
389
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
|
+
`;
|
|
390
675
|
function normalizeUrl(raw, fallback) {
|
|
391
676
|
const value = raw?.trim();
|
|
392
677
|
if (!value)
|
|
@@ -439,13 +724,6 @@ function resolveDefaultNpmRegistriesFromEnv() {
|
|
|
439
724
|
}
|
|
440
725
|
];
|
|
441
726
|
}
|
|
442
|
-
function buildCjsModule(value) {
|
|
443
|
-
const serialized = JSON.stringify(value);
|
|
444
|
-
return `const data = ${serialized};
|
|
445
|
-
module.exports = data;
|
|
446
|
-
module.exports.default = data;
|
|
447
|
-
`;
|
|
448
|
-
}
|
|
449
727
|
const SANDPACK_MIN_COMPONENT_MESSAGES = {
|
|
450
728
|
"components.actions.clear": "Clear",
|
|
451
729
|
"components.actions.cancel": "Cancel",
|
|
@@ -466,13 +744,18 @@ const SANDPACK_MIN_COMPONENT_MESSAGES = {
|
|
|
466
744
|
"components.rating.cancel": "Cancel rating",
|
|
467
745
|
"components.radiogroup.cancel": "No option"
|
|
468
746
|
};
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
const
|
|
472
|
-
const
|
|
473
|
-
const
|
|
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({
|
|
474
754
|
blockedEmailDomains: []
|
|
475
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: [] })};`;
|
|
476
759
|
function parseRgbParts(raw) {
|
|
477
760
|
const value = raw.trim();
|
|
478
761
|
if (!value)
|
|
@@ -563,10 +846,9 @@ function readThemeVarsFromHost() {
|
|
|
563
846
|
if (value)
|
|
564
847
|
themeVars[varName] = value;
|
|
565
848
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
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) {
|
|
570
852
|
const value = computed.getPropertyValue(varName).trim();
|
|
571
853
|
if (value)
|
|
572
854
|
themeVars[varName] = value;
|
|
@@ -574,10 +856,41 @@ function readThemeVarsFromHost() {
|
|
|
574
856
|
Object.assign(themeVars, mapSgVarsToCoreVars(themeVars));
|
|
575
857
|
return themeVars;
|
|
576
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
|
+
}
|
|
577
890
|
function normalizeCssSize(value) {
|
|
578
891
|
return typeof value === "number" ? `${value}px` : value;
|
|
579
892
|
}
|
|
580
|
-
function buildSandpackStylesCss(themeVars, previewPadding) {
|
|
893
|
+
function buildSandpackStylesCss(themeVars, previewPadding, hostCss = "") {
|
|
581
894
|
const mergedVars = {
|
|
582
895
|
...SANDPACK_FALLBACK_THEME_VARS,
|
|
583
896
|
...themeVars,
|
|
@@ -591,7 +904,8 @@ function buildSandpackStylesCss(themeVars, previewPadding) {
|
|
|
591
904
|
${rootVars}
|
|
592
905
|
}
|
|
593
906
|
|
|
594
|
-
${SANDPACK_BASE_STYLES_CSS}
|
|
907
|
+
${SANDPACK_BASE_STYLES_CSS}
|
|
908
|
+
${hostCss ? `\n\n${hostCss}` : ""}`;
|
|
595
909
|
}
|
|
596
910
|
function ReadonlyBlock({ code }) {
|
|
597
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 }) }));
|
|
@@ -710,6 +1024,13 @@ function RunButton({ onRun }) {
|
|
|
710
1024
|
}, [onRun, running, sandpack]);
|
|
711
1025
|
return (_jsx(SgButton, { severity: "primary", size: "sm", loading: running, onClick: handleRun, children: running ? "Running" : "Run" }));
|
|
712
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
|
+
}
|
|
713
1034
|
export default function SgPlayground(props) {
|
|
714
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;
|
|
715
1036
|
const effectivePreviewPadding = normalizeCssSize(previewPadding ?? (codeContract === "appFile" ? 12 : 0));
|
|
@@ -722,7 +1043,8 @@ export default function SgPlayground(props) {
|
|
|
722
1043
|
const root = document.documentElement;
|
|
723
1044
|
const refreshStyles = () => {
|
|
724
1045
|
const liveThemeVars = readThemeVarsFromHost();
|
|
725
|
-
|
|
1046
|
+
const hostCss = readHostNextCssText();
|
|
1047
|
+
setSandpackStylesCss(buildSandpackStylesCss(liveThemeVars, effectivePreviewPadding, hostCss));
|
|
726
1048
|
};
|
|
727
1049
|
let frameId = null;
|
|
728
1050
|
const scheduleRefresh = () => {
|
|
@@ -755,14 +1077,14 @@ export default function SgPlayground(props) {
|
|
|
755
1077
|
SgButton,
|
|
756
1078
|
SgAutocomplete
|
|
757
1079
|
} from "@seedgrid/fe-components";`;
|
|
758
|
-
const appTsx = codeContract === "appFile"
|
|
1080
|
+
const appTsx = React.useMemo(() => codeContract === "appFile"
|
|
759
1081
|
? code
|
|
760
|
-
: buildAppTsxFromRenderBody(code, seedgridDefaultImports, previewWrapperClassName);
|
|
1082
|
+
: buildAppTsxFromRenderBody(code, seedgridDefaultImports, previewWrapperClassName), [code, codeContract, previewWrapperClassName, seedgridDefaultImports]);
|
|
761
1083
|
const resolvedSeedgridDependency = seedgridDependency ??
|
|
762
1084
|
process.env.NEXT_PUBLIC_SANDPACK_SEEDGRID_DEPENDENCY ??
|
|
763
1085
|
DEFAULT_SEEDGRID_DEPENDENCY;
|
|
764
|
-
const requestedDeps = dependencies ?? {};
|
|
765
|
-
const requestedDepKeys = Object.keys(requestedDeps);
|
|
1086
|
+
const requestedDeps = React.useMemo(() => dependencies ?? {}, [dependencies]);
|
|
1087
|
+
const requestedDepKeys = React.useMemo(() => Object.keys(requestedDeps), [requestedDeps]);
|
|
766
1088
|
const resolvedBundlerURL = normalizeUrl(bundlerURL ?? process.env.NEXT_PUBLIC_SANDPACK_BUNDLER_URL, DEFAULT_SANDPACK_BUNDLER_URL);
|
|
767
1089
|
const resolvedBundlerTimeoutMs = normalizeTimeoutMs(bundlerTimeoutMs ??
|
|
768
1090
|
Number(process.env.NEXT_PUBLIC_SANDPACK_BUNDLER_TIMEOUT_MS ?? Number.NaN), DEFAULT_SANDPACK_BUNDLER_TIMEOUT_MS);
|
|
@@ -810,116 +1132,260 @@ export default function SgPlayground(props) {
|
|
|
810
1132
|
// Shim lucide-react for all non-full presets to avoid OOM from bundling ~1400 icon components.
|
|
811
1133
|
// Full preset gets the real package so icons render correctly.
|
|
812
1134
|
const shouldShimLucide = includeSeedgridDependency && resolvedPreset !== "full" && !requestedDepKeys.includes("lucide-react");
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
code: JSON.stringify({
|
|
825
|
-
name: "@seedgrid/fe-components",
|
|
826
|
-
version: "0.0.0-sandbox",
|
|
827
|
-
main: "dist/sandbox.cjs",
|
|
828
|
-
exports: { ".": { require: "./dist/sandbox.cjs", default: "./dist/sandbox.cjs" } }
|
|
829
|
-
}),
|
|
830
|
-
hidden: true
|
|
831
|
-
};
|
|
832
|
-
// Compatibility shim for legacy @seedgrid/fe-components builds that still import "qrcode" (node-only path).
|
|
833
|
-
files["/node_modules/qrcode/index.js"] = { code: SANDPACK_QRCODE_SHIM_INDEX_JS, hidden: true };
|
|
834
|
-
// Sandpack runtime can evaluate JSON files as plain JS modules.
|
|
835
|
-
// Provide CJS-compatible shims to keep @seedgrid/fe-components i18n/validators working.
|
|
836
|
-
files["/node_modules/@seedgrid/fe-components/dist/i18n/pt-BR.json"] = {
|
|
837
|
-
code: SANDPACK_SEEDGRID_PT_BR_JSON_SHIM,
|
|
838
|
-
hidden: true
|
|
839
|
-
};
|
|
840
|
-
files["/node_modules/@seedgrid/fe-components/dist/i18n/pt-PT.json"] = {
|
|
841
|
-
code: SANDPACK_SEEDGRID_PT_PT_JSON_SHIM,
|
|
842
|
-
hidden: true
|
|
843
|
-
};
|
|
844
|
-
files["/node_modules/@seedgrid/fe-components/dist/i18n/en-US.json"] = {
|
|
845
|
-
code: SANDPACK_SEEDGRID_EN_US_JSON_SHIM,
|
|
846
|
-
hidden: true
|
|
847
|
-
};
|
|
848
|
-
files["/node_modules/@seedgrid/fe-components/dist/i18n/es.json"] = {
|
|
849
|
-
code: SANDPACK_SEEDGRID_ES_JSON_SHIM,
|
|
850
|
-
hidden: true
|
|
851
|
-
};
|
|
852
|
-
files["/node_modules/@seedgrid/fe-components/dist/blocked-email-domains.json"] = {
|
|
853
|
-
code: SANDPACK_SEEDGRID_BLOCKED_EMAIL_DOMAINS_JSON_SHIM,
|
|
854
|
-
hidden: true
|
|
855
|
-
};
|
|
856
|
-
}
|
|
857
|
-
if (shouldIncludeNodePolyfills) {
|
|
858
|
-
// markdown-it CLI entry uses node:fs and breaks in browser runtime.
|
|
859
|
-
files["/node_modules/markdown-it/bin/markdown-it.mjs"] = {
|
|
860
|
-
code: SANDPACK_MARKDOWN_IT_BIN_SHIM,
|
|
861
|
-
hidden: true
|
|
862
|
-
};
|
|
863
|
-
// Node builtin compatibility shims used by transitive dependencies (e.g. argparse from markdown-it/tiptap).
|
|
864
|
-
files["/node_modules/assert/index.js"] = { code: SANDPACK_ASSERT_SHIM_INDEX_JS, hidden: true };
|
|
865
|
-
files["/node_modules/util/index.js"] = { code: SANDPACK_UTIL_SHIM_INDEX_JS, hidden: true };
|
|
866
|
-
files["/node_modules/path/index.js"] = { code: SANDPACK_PATH_SHIM_INDEX_JS, hidden: true };
|
|
867
|
-
files["/node_modules/fs/index.js"] = { code: SANDPACK_FS_SHIM_INDEX_JS, hidden: true };
|
|
868
|
-
files["/node_modules/process/index.js"] = { code: SANDPACK_PROCESS_SHIM_INDEX_JS, hidden: true };
|
|
869
|
-
}
|
|
870
|
-
if (shouldShimSandpackReact) {
|
|
871
|
-
files["/node_modules/@codesandbox/sandpack-react/index.js"] = {
|
|
872
|
-
code: SANDPACK_SANDBOX_SANDPACK_REACT_SHIM_INDEX_JS,
|
|
873
|
-
hidden: true
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
if (shouldShimTiptap) {
|
|
877
|
-
files["/node_modules/@seedgrid/fe-components/dist/inputs/SgTextEditor.js"] = {
|
|
878
|
-
code: SANDPACK_SEEDGRID_TEXT_EDITOR_SHIM_INDEX_JS,
|
|
879
|
-
hidden: true
|
|
880
|
-
};
|
|
881
|
-
files["/node_modules/@seedgrid/fe-components/dist/inputs/SgTextEditor.mjs"] = {
|
|
882
|
-
code: SANDPACK_SEEDGRID_TEXT_EDITOR_SHIM_INDEX_JS,
|
|
883
|
-
hidden: true
|
|
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);
|
|
884
1146
|
};
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
1147
|
+
console.warn = (...args) => {
|
|
1148
|
+
if (shouldSuppressCoreJsProviderWarning(args))
|
|
1149
|
+
return;
|
|
1150
|
+
originalWarn(...args);
|
|
888
1151
|
};
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1152
|
+
return () => {
|
|
1153
|
+
console.error = originalError;
|
|
1154
|
+
console.warn = originalWarn;
|
|
892
1155
|
};
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1156
|
+
}, [shouldIncludeNodePolyfills]);
|
|
1157
|
+
const files = React.useMemo(() => {
|
|
1158
|
+
const nextFiles = {
|
|
1159
|
+
"/App.tsx": { code: appTsx, active: true },
|
|
1160
|
+
"/styles.css": { code: sandpackStylesCss || buildSandpackStylesCss({}, effectivePreviewPadding) }
|
|
896
1161
|
};
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
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,
|
|
1181
|
+
hidden: true
|
|
1182
|
+
};
|
|
1183
|
+
nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/pt-PT.json"] = {
|
|
1184
|
+
code: SANDPACK_SEEDGRID_PT_PT_JSON_SHIM,
|
|
1185
|
+
hidden: true
|
|
1186
|
+
};
|
|
1187
|
+
nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/en-US.json"] = {
|
|
1188
|
+
code: SANDPACK_SEEDGRID_EN_US_JSON_SHIM,
|
|
900
1189
|
hidden: true
|
|
901
1190
|
};
|
|
902
|
-
|
|
903
|
-
code:
|
|
1191
|
+
nextFiles["/node_modules/@seedgrid/fe-components/dist/i18n/es.json"] = {
|
|
1192
|
+
code: SANDPACK_SEEDGRID_ES_JSON_SHIM,
|
|
904
1193
|
hidden: true
|
|
905
1194
|
};
|
|
906
|
-
|
|
907
|
-
code:
|
|
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,
|
|
908
1217
|
hidden: true
|
|
909
1218
|
};
|
|
910
1219
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
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(() => ({
|
|
923
1389
|
...DEFAULT_SANDBOX_BASE_DEPENDENCIES,
|
|
924
1390
|
...(includeSeedgridDependency ? DEFAULT_SEEDGRID_RUNTIME_DEPENDENCIES : {}),
|
|
925
1391
|
...(includeSeedgridDependency && !shouldShimLucide ? { "lucide-react": "^0.468.0" } : {}),
|
|
@@ -928,7 +1394,15 @@ export default function SgPlayground(props) {
|
|
|
928
1394
|
...(shouldIncludeNodePolyfills ? DEFAULT_SANDPACK_POLYFILLS : {}),
|
|
929
1395
|
...(includeSeedgridDependency ? { "@seedgrid/fe-components": resolvedSeedgridDependency } : {}),
|
|
930
1396
|
...requestedDeps
|
|
931
|
-
}
|
|
1397
|
+
}), [
|
|
1398
|
+
includeEditorDependencies,
|
|
1399
|
+
includeSandpackReactDependency,
|
|
1400
|
+
includeSeedgridDependency,
|
|
1401
|
+
requestedDeps,
|
|
1402
|
+
resolvedSeedgridDependency,
|
|
1403
|
+
shouldIncludeNodePolyfills,
|
|
1404
|
+
shouldShimLucide
|
|
1405
|
+
]);
|
|
932
1406
|
const currentHeight = isExpanded ? expandedHeight : height;
|
|
933
1407
|
const resizeClass = !resizable
|
|
934
1408
|
? undefined
|