@schandlergarcia/sf-web-components 1.9.48 → 1.9.52

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.
@@ -227,6 +227,92 @@ if (fs.existsSync(templatesDir)) {
227
227
  }
228
228
  }
229
229
 
230
+ // Copy sample data files
231
+ const dataSourceDir = path.join(packageRoot, 'data');
232
+ const targetDataDir = path.join(cwd, 'src/data');
233
+
234
+ console.log('\nšŸ“Š Installing sample data files...\n');
235
+
236
+ let dataFilesInstalled = 0;
237
+
238
+ if (fs.existsSync(dataSourceDir)) {
239
+ // Create target data directory if it doesn't exist
240
+ if (!fs.existsSync(targetDataDir)) {
241
+ fs.mkdirSync(targetDataDir, { recursive: true });
242
+ }
243
+
244
+ // Copy engine-sample-data.js
245
+ const engineDataSource = path.join(dataSourceDir, 'engine-sample-data.js');
246
+ const engineDataTarget = path.join(targetDataDir, 'engine-sample-data.js');
247
+
248
+ if (fs.existsSync(engineDataSource)) {
249
+ try {
250
+ fs.copyFileSync(engineDataSource, engineDataTarget);
251
+ console.log(' āœ“ Installed engine-sample-data.js');
252
+ dataFilesInstalled++;
253
+ } catch (error) {
254
+ console.error(` āœ— Failed to install engine-sample-data.js: ${error.message}`);
255
+ }
256
+ }
257
+
258
+ // Copy schema.graphql
259
+ const schemaSource = path.join(dataSourceDir, 'schema.graphql');
260
+ const schemaTarget = path.join(cwd, 'schema.graphql');
261
+
262
+ if (fs.existsSync(schemaSource)) {
263
+ try {
264
+ fs.copyFileSync(schemaSource, schemaTarget);
265
+ console.log(' āœ“ Installed schema.graphql (pre-built from sample data)');
266
+ dataFilesInstalled++;
267
+ } catch (error) {
268
+ console.error(` āœ— Failed to install schema.graphql: ${error.message}`);
269
+ }
270
+ }
271
+
272
+ // Copy engine-command-center-prd.md
273
+ const prdSource = path.join(dataSourceDir, 'engine-command-center-prd.md');
274
+ const prdTarget = path.join(cwd, 'engine-command-center-prd.md');
275
+
276
+ if (fs.existsSync(prdSource)) {
277
+ try {
278
+ fs.copyFileSync(prdSource, prdTarget);
279
+ console.log(' āœ“ Installed engine-command-center-prd.md');
280
+ dataFilesInstalled++;
281
+ } catch (error) {
282
+ console.error(` āœ— Failed to install engine-command-center-prd.md: ${error.message}`);
283
+ }
284
+ }
285
+ }
286
+
287
+ // Copy GraphQL schema generator script
288
+ const scriptsSourceDir = path.join(packageRoot, 'scripts');
289
+ const targetScriptsDir = path.join(cwd, 'scripts');
290
+
291
+ console.log('\nšŸ“ Installing GraphQL scripts...\n');
292
+
293
+ let scriptsInstalled = 0;
294
+
295
+ if (fs.existsSync(scriptsSourceDir)) {
296
+ // Create target scripts directory if it doesn't exist
297
+ if (!fs.existsSync(targetScriptsDir)) {
298
+ fs.mkdirSync(targetScriptsDir, { recursive: true });
299
+ }
300
+
301
+ // Copy generate-schema-from-sample.mjs
302
+ const generatorSource = path.join(scriptsSourceDir, 'generate-schema-from-sample.mjs');
303
+ const generatorTarget = path.join(targetScriptsDir, 'generate-schema-from-sample.mjs');
304
+
305
+ if (fs.existsSync(generatorSource)) {
306
+ try {
307
+ fs.copyFileSync(generatorSource, generatorTarget);
308
+ console.log(' āœ“ Installed generate-schema-from-sample.mjs');
309
+ scriptsInstalled++;
310
+ } catch (error) {
311
+ console.error(` āœ— Failed to install generate-schema-from-sample.mjs: ${error.message}`);
312
+ }
313
+ }
314
+ }
315
+
230
316
  // Copy routes.tsx template with full configuration
231
317
  const routesTemplatePath = path.join(packageRoot, 'src/templates/config/routes.tsx.template');
232
318
  const routesPath = path.join(cwd, 'src/routes.tsx');
@@ -268,6 +354,12 @@ if (fs.existsSync(packageJsonPath)) {
268
354
  scriptsAdded.push('validate:dashboard');
269
355
  }
270
356
 
357
+ // Add the graphql:schema:sample script if it doesn't exist
358
+ if (!packageJson.scripts['graphql:schema:sample']) {
359
+ packageJson.scripts['graphql:schema:sample'] = 'node scripts/generate-schema-from-sample.mjs';
360
+ scriptsAdded.push('graphql:schema:sample');
361
+ }
362
+
271
363
  if (scriptsAdded.length > 0) {
272
364
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
273
365
  scriptsAdded.forEach(script => {
@@ -359,6 +451,8 @@ console.log('\nšŸ“Š Summary:');
359
451
  console.log(` - Copied ${componentsCopied} UI components`);
360
452
  console.log(` - Updated ${filesUpdated} files`);
361
453
  console.log(` - Installed ${templatesInstalled} page templates`);
454
+ console.log(` - Installed ${dataFilesInstalled} sample data files (including schema.graphql)`);
455
+ console.log(` - Installed ${scriptsInstalled} GraphQL scripts`);
362
456
  console.log(` - Installed CommandCenter.tsx for dashboard management`);
363
457
  console.log(` - Added "npm run reset:command-center" script`);
364
458
  console.log(` - Installed AI assistant rules for command center building`);
@@ -402,17 +402,331 @@ echo "→ Cleaning caches…"
402
402
  rm -rf node_modules/.vite 2>/dev/null && echo " āœ“ Cleared Vite cache" || true
403
403
  echo ""
404
404
 
405
+ # ── 9. Restore Engine-branded global.css ────────────────────────────────────
406
+
407
+ # Ensure src/styles directory exists
408
+ mkdir -p src/styles
409
+
410
+ GLOBAL_CSS="src/styles/global.css"
411
+ echo "→ Restoring Engine-branded ${GLOBAL_CSS}..."
412
+
413
+ cat > "$GLOBAL_CSS" << 'GLOBAL_CSS_EOF'
414
+ @import '@heroui/styles';
415
+
416
+ @layer base {
417
+ html,
418
+ body,
419
+ #root {
420
+ @apply min-h-screen;
421
+ }
422
+
423
+ body {
424
+ @apply antialiased bg-white;
425
+ }
426
+ }
427
+
428
+ @import 'tw-animate-css';
429
+ @import 'shadcn/tailwind.css';
430
+
431
+ @custom-variant dark (&:is(.dark *));
432
+
433
+ @source "../components/library";
434
+ @source "../components/pages";
435
+
436
+ @theme inline {
437
+ --color-background: var(--background);
438
+ --color-foreground: var(--foreground);
439
+ --color-card: var(--card);
440
+ --color-card-foreground: var(--card-foreground);
441
+ --color-popover: var(--popover);
442
+ --color-popover-foreground: var(--popover-foreground);
443
+ --color-primary: var(--primary);
444
+ --color-primary-foreground: var(--primary-foreground);
445
+ --color-secondary: var(--secondary);
446
+ --color-secondary-foreground: var(--secondary-foreground);
447
+ --color-muted: var(--muted);
448
+ --color-muted-foreground: var(--muted-foreground);
449
+ --color-accent: var(--accent);
450
+ --color-accent-foreground: var(--accent-foreground);
451
+ --color-destructive: var(--destructive);
452
+ --color-destructive-foreground: var(--destructive-foreground);
453
+ --color-border: var(--border);
454
+ --color-input: var(--input);
455
+ --color-ring: var(--ring);
456
+ --color-chart-1: var(--chart-1);
457
+ --color-chart-2: var(--chart-2);
458
+ --color-chart-3: var(--chart-3);
459
+ --color-chart-4: var(--chart-4);
460
+ --color-chart-5: var(--chart-5);
461
+ --radius-sm: calc(var(--radius) - 4px);
462
+ --radius-md: calc(var(--radius) - 2px);
463
+ --radius-lg: var(--radius);
464
+ --radius-xl: calc(var(--radius) + 4px);
465
+ --color-sidebar: var(--sidebar);
466
+ --color-sidebar-foreground: var(--sidebar-foreground);
467
+ --color-sidebar-primary: var(--sidebar-primary);
468
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
469
+ --color-sidebar-accent: var(--sidebar-accent);
470
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
471
+ --color-sidebar-border: var(--sidebar-border);
472
+ --color-sidebar-ring: var(--sidebar-ring);
473
+
474
+ /* Engine brand palette */
475
+ --color-engine-black: #111111;
476
+ --color-engine-teal: #5BC8C8;
477
+ --color-engine-green: #3DAB5F;
478
+ --color-engine-coral: #FF5722;
479
+ --color-engine-orange: #F59E0B;
480
+ --color-engine-savings: #16A34A;
481
+ --color-engine-bg: #F7F8FA;
482
+ --color-engine-border: #E5E7EB;
483
+ --color-engine-text: #111111;
484
+ --color-engine-muted: #6B7280;
485
+ --color-engine-label: #9CA3AF;
486
+
487
+ /* Engine teal brand palette */
488
+ --color-brand-50: #ECFDF9;
489
+ --color-brand-100: #D1FAF0;
490
+ --color-brand-200: #A7F3E1;
491
+ --color-brand-300: #6EE7C8;
492
+ --color-brand-400: #34D3AB;
493
+ --color-brand-500: #5BC8C8;
494
+ --color-brand-600: #0D9488;
495
+ --color-brand-700: #0F766E;
496
+ --color-brand-800: #115E59;
497
+ --color-brand-900: #134E4A;
498
+ --color-brand-950: #042F2E;
499
+
500
+ --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
501
+ --font-mono: 'JetBrains Mono', ui-monospace, monospace;
502
+
503
+ /* Engine border radius tokens */
504
+ --radius-pill: 9999px;
505
+ --radius-card: 10px;
506
+ }
507
+
508
+ :root {
509
+ --radius: 0.625rem;
510
+ --background: oklch(1 0 0);
511
+ --foreground: oklch(0.145 0 0);
512
+ --card: oklch(1 0 0);
513
+ --card-foreground: oklch(0.145 0 0);
514
+ --popover: oklch(1 0 0);
515
+ --popover-foreground: oklch(0.145 0 0);
516
+ --primary: oklch(0.205 0 0);
517
+ --primary-foreground: oklch(0.985 0 0);
518
+ --secondary: oklch(0.97 0 0);
519
+ --secondary-foreground: oklch(0.205 0 0);
520
+ --muted: oklch(0.97 0 0);
521
+ --muted-foreground: oklch(0.556 0 0);
522
+ --accent: oklch(0.97 0 0);
523
+ --accent-foreground: oklch(0.205 0 0);
524
+ --destructive: oklch(0.577 0.245 27.325);
525
+ --border: oklch(0.922 0 0);
526
+ --input: oklch(0.922 0 0);
527
+ --ring: oklch(0.708 0 0);
528
+ --chart-1: oklch(0.646 0.222 41.116);
529
+ --chart-2: oklch(0.6 0.118 184.704);
530
+ --chart-3: oklch(0.398 0.07 227.392);
531
+ --chart-4: oklch(0.828 0.189 84.429);
532
+ --chart-5: oklch(0.769 0.188 70.08);
533
+ --sidebar: oklch(0.985 0 0);
534
+ --sidebar-foreground: oklch(0.145 0 0);
535
+ --sidebar-primary: oklch(0.205 0 0);
536
+ --sidebar-primary-foreground: oklch(0.985 0 0);
537
+ --sidebar-accent: oklch(0.97 0 0);
538
+ --sidebar-accent-foreground: oklch(0.205 0 0);
539
+ --sidebar-border: oklch(0.922 0 0);
540
+ --sidebar-ring: oklch(0.708 0 0);
541
+ }
542
+
543
+ .dark {
544
+ --background: oklch(0.145 0 0);
545
+ --foreground: oklch(0.985 0 0);
546
+ --card: oklch(0.205 0 0);
547
+ --card-foreground: oklch(0.985 0 0);
548
+ --popover: oklch(0.205 0 0);
549
+ --popover-foreground: oklch(0.985 0 0);
550
+ --primary: oklch(0.922 0 0);
551
+ --primary-foreground: oklch(0.205 0 0);
552
+ --secondary: oklch(0.269 0 0);
553
+ --secondary-foreground: oklch(0.985 0 0);
554
+ --muted: oklch(0.269 0 0);
555
+ --muted-foreground: oklch(0.708 0 0);
556
+ --accent: oklch(0.269 0 0);
557
+ --accent-foreground: oklch(0.985 0 0);
558
+ --destructive: oklch(0.704 0.191 22.216);
559
+ --border: oklch(1 0 0 / 10%);
560
+ --input: oklch(1 0 0 / 15%);
561
+ --ring: oklch(0.556 0 0);
562
+ --chart-1: oklch(0.488 0.243 264.376);
563
+ --chart-2: oklch(0.696 0.17 162.48);
564
+ --chart-3: oklch(0.769 0.188 70.08);
565
+ --chart-4: oklch(0.627 0.265 303.9);
566
+ --chart-5: oklch(0.645 0.246 16.439);
567
+ --sidebar: oklch(0.205 0 0);
568
+ --sidebar-foreground: oklch(0.985 0 0);
569
+ --sidebar-primary: oklch(0.488 0.243 264.376);
570
+ --sidebar-primary-foreground: oklch(0.985 0 0);
571
+ --sidebar-accent: oklch(0.269 0 0);
572
+ --sidebar-accent-foreground: oklch(0.985 0 0);
573
+ --sidebar-border: oklch(1 0 0 / 10%);
574
+ --sidebar-ring: oklch(0.556 0 0);
575
+ }
576
+
577
+ @layer base {
578
+ * {
579
+ @apply border-border outline-ring/50;
580
+ }
581
+ body {
582
+ @apply bg-background text-foreground;
583
+ }
584
+ }
585
+
586
+ /*
587
+ * Restore HeroUI theme variables inside the Command Center scope.
588
+ * shadcn redefines --muted, --accent, --accent-foreground with different
589
+ * semantics (bg colors vs text colors). This scope restores HeroUI's values
590
+ * so HeroUI components render correctly.
591
+ */
592
+ .heroui-scope {
593
+ /* Engine HeroUI theme overrides */
594
+ --primary: #000000;
595
+ --primary-foreground: oklch(0.9911 0 0);
596
+ --secondary: #5BC8C8;
597
+ --secondary-foreground: oklch(0.2103 0.0059 285.89);
598
+ --success: #16A34A;
599
+ --success-foreground: oklch(0.9911 0 0);
600
+ --warning: #F59E0B;
601
+ --warning-foreground: oklch(0.2103 0.0059 285.89);
602
+ --danger: #FF5722;
603
+ --danger-foreground: oklch(0.9911 0 0);
604
+
605
+ --muted: oklch(0.5517 0.0138 285.94);
606
+ --accent: oklch(0.6204 0.195 253.83);
607
+ --accent-foreground: oklch(0.9911 0 0);
608
+ --background: oklch(0.9702 0 0);
609
+ --foreground: oklch(0.2103 0.0059 285.89);
610
+ --default: oklch(94% 0.001 286.375);
611
+ --default-foreground: oklch(0.2103 0.0059 285.89);
612
+ --border: oklch(90% 0.004 286.32);
613
+ --separator: oklch(92% 0.004 286.32);
614
+ --segment: oklch(100% 0 0);
615
+ --segment-foreground: oklch(0.2103 0.0059 285.89);
616
+ --surface: oklch(100% 0 0);
617
+ --surface-foreground: oklch(0.2103 0.0059 285.89);
618
+ --overlay: oklch(100% 0 0);
619
+ --overlay-foreground: oklch(0.2103 0.0059 285.89);
620
+ --focus: oklch(0.6204 0.195 253.83);
621
+ --link: oklch(0.2103 0.0059 285.89);
622
+ }
623
+
624
+ .dark .heroui-scope,
625
+ .heroui-scope.dark {
626
+ --muted: oklch(70.5% 0.015 286.067);
627
+ --background: oklch(12% 0.005 285.823);
628
+ --foreground: oklch(0.9911 0 0);
629
+ --default: oklch(27.4% 0.006 286.033);
630
+ --default-foreground: oklch(0.9911 0 0);
631
+ --border: oklch(28% 0.006 286.033);
632
+ --separator: oklch(25% 0.006 286.033);
633
+ --segment: oklch(0.3964 0.01 285.93);
634
+ --segment-foreground: oklch(0.9911 0 0);
635
+ --surface: oklch(0.2103 0.0059 285.89);
636
+ --surface-foreground: oklch(0.9911 0 0);
637
+ --overlay: oklch(0.2103 0.0059 285.89);
638
+ --overlay-foreground: oklch(0.9911 0 0);
639
+ --warning: oklch(0.8203 0.1388 76.34);
640
+ --warning-foreground: oklch(0.2103 0.0059 285.89);
641
+ --danger: oklch(0.594 0.1967 24.63);
642
+ --danger-foreground: oklch(0.9911 0 0);
643
+ --focus: oklch(0.6204 0.195 253.83);
644
+ --link: oklch(0.9911 0 0);
645
+ }
646
+ GLOBAL_CSS_EOF
647
+
648
+ echo " āœ“ Engine branding restored"
649
+ echo ""
650
+
651
+ # ── 10. Restore Engine sample data and schema ──────────────────────────────
652
+
653
+ # Ensure src/data directory exists
654
+ mkdir -p src/data
655
+
656
+ ENGINE_DATA="src/data/engine-sample-data.js"
657
+ echo "→ Restoring ${ENGINE_DATA}..."
658
+
659
+ # Detect package location
660
+ if [ -d "node_modules/@schandlergarcia/sf-web-components/data" ]; then
661
+ PACKAGE_DATA="node_modules/@schandlergarcia/sf-web-components/data/engine-sample-data.js"
662
+ PACKAGE_SCHEMA="node_modules/@schandlergarcia/sf-web-components/data/schema.graphql"
663
+ elif [ -f "$SCRIPT_DIR/../data/engine-sample-data.js" ]; then
664
+ # Running from package source
665
+ PACKAGE_DATA="$SCRIPT_DIR/../data/engine-sample-data.js"
666
+ PACKAGE_SCHEMA="$SCRIPT_DIR/../data/schema.graphql"
667
+ else
668
+ echo " ⚠ Could not find engine-sample-data.js in package"
669
+ PACKAGE_DATA=""
670
+ PACKAGE_SCHEMA=""
671
+ fi
672
+
673
+ if [ -n "$PACKAGE_DATA" ] && [ -f "$PACKAGE_DATA" ]; then
674
+ cp "$PACKAGE_DATA" "$ENGINE_DATA"
675
+ echo " āœ“ Engine sample data restored"
676
+ else
677
+ echo " ⚠ Skipped sample data (package data not found)"
678
+ fi
679
+
680
+ # Restore schema.graphql
681
+ SCHEMA_FILE="schema.graphql"
682
+ echo "→ Restoring ${SCHEMA_FILE}..."
683
+
684
+ if [ -n "$PACKAGE_SCHEMA" ] && [ -f "$PACKAGE_SCHEMA" ]; then
685
+ cp "$PACKAGE_SCHEMA" "$SCHEMA_FILE"
686
+ echo " āœ“ GraphQL schema restored (pre-built from sample data)"
687
+ else
688
+ echo " ⚠ Skipped schema (package schema not found)"
689
+ fi
690
+
691
+ # Restore engine-command-center-prd.md
692
+ PRD_FILE="engine-command-center-prd.md"
693
+ echo "→ Restoring ${PRD_FILE}..."
694
+
695
+ # Detect package location for PRD
696
+ if [ -d "node_modules/@schandlergarcia/sf-web-components/data" ]; then
697
+ PACKAGE_PRD="node_modules/@schandlergarcia/sf-web-components/data/engine-command-center-prd.md"
698
+ elif [ -f "$SCRIPT_DIR/../data/engine-command-center-prd.md" ]; then
699
+ # Running from package source
700
+ PACKAGE_PRD="$SCRIPT_DIR/../data/engine-command-center-prd.md"
701
+ else
702
+ PACKAGE_PRD=""
703
+ fi
704
+
705
+ if [ -n "$PACKAGE_PRD" ] && [ -f "$PACKAGE_PRD" ]; then
706
+ cp "$PACKAGE_PRD" "$PRD_FILE"
707
+ echo " āœ“ Engine PRD restored"
708
+ else
709
+ echo " ⚠ Skipped PRD (package PRD not found)"
710
+ fi
711
+
712
+ echo ""
713
+
405
714
  # ── Done ─────────────────────────────────────────────────────────────────────
406
715
 
407
716
  echo "╔════════════════════════════════════════════════╗"
408
717
  echo "ā•‘ āœ“ Reset complete! ā•‘"
409
718
  echo "ā•‘ ā•‘"
410
- echo "ā•‘ Everything preserved: ā•‘"
411
- echo "ā•‘ • Theme (global.css + initialMode) ā•‘"
719
+ echo "ā•‘ Restored: ā•‘"
720
+ echo "ā•‘ • Engine brand theme (global.css) ā•‘"
721
+ echo "ā•‘ - Teal brand palette (#5BC8C8) ā•‘"
722
+ echo "ā•‘ - Inter font stack ā•‘"
723
+ echo "ā•‘ - HeroUI Engine theme overrides ā•‘"
724
+ echo "ā•‘ • Engine sample data (engine-sample-data.js)ā•‘"
725
+ echo "ā•‘ • GraphQL schema (schema.graphql) ā•‘"
726
+ echo "ā•‘ • Engine PRD (engine-command-center-prd.md)ā•‘"
412
727
  echo "ā•‘ • Component library (cards, charts, etc.) ā•‘"
413
728
  echo "ā•‘ • HeroUI wrappers & theme providers ā•‘"
414
729
  echo "ā•‘ • Salesforce SDK stubs for local dev ā•‘"
415
- echo "ā•‘ • All styles & dependencies ā•‘"
416
730
  echo "ā•‘ ā•‘"
417
731
  echo "ā•‘ Layout: ā•‘"
418
732
  echo "ā•‘ / → Home (search page) ā•‘"