@micha.bigler/ui-core-micha 2.33.2 → 2.35.0

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 (84) hide show
  1. package/WORK_ORDERS.md +9 -2
  2. package/dist/auth/ReauthModal.js +3 -1
  3. package/dist/components/AccessCodeManager.js +16 -14
  4. package/dist/components/AccessCodeSingleUseToggle.js +2 -1
  5. package/dist/components/AllowedEmailDomainsManager.js +3 -1
  6. package/dist/components/AuthFactorRequirementCard.js +2 -1
  7. package/dist/components/BulkInviteCsvTab.js +7 -7
  8. package/dist/components/LoginForm.js +2 -1
  9. package/dist/components/MFAComponent.js +15 -8
  10. package/dist/components/MfaLoginComponent.js +4 -1
  11. package/dist/components/PasskeysComponent.js +4 -2
  12. package/dist/components/QrSignupManager.js +2 -1
  13. package/dist/components/QrSignupValidityManager.js +4 -1
  14. package/dist/components/RegistrationMethodsManager.js +3 -1
  15. package/dist/components/SecurityComponent.js +3 -1
  16. package/dist/components/SocialLoginButtons.js +2 -1
  17. package/dist/components/SupportRecoveryRequestsTab.js +4 -1
  18. package/dist/components/UserInviteComponent.js +8 -8
  19. package/dist/components/UserListComponent.js +8 -4
  20. package/dist/components/charts/ChartFrame.js +8 -3
  21. package/dist/components/charts/TimeSeriesChart.js +7 -4
  22. package/dist/components/charts/exportChart.js +2 -2
  23. package/dist/index.js +1 -1
  24. package/dist/layout/PageLayout.js +3 -2
  25. package/dist/messaging/AttachmentList.js +6 -1
  26. package/dist/messaging/Composer.js +2 -1
  27. package/dist/messaging/DirectMessageLauncher.js +2 -1
  28. package/dist/messaging/MessageBubble.js +29 -8
  29. package/dist/messaging/PollCard.js +6 -4
  30. package/dist/messaging/Thread.js +2 -1
  31. package/dist/notifications/NotificationSettings.js +17 -3
  32. package/dist/notifications/PopupSurface.js +2 -1
  33. package/dist/onboarding/steps/BrowserPushStep.js +2 -1
  34. package/dist/pages/AccountPage.js +2 -1
  35. package/dist/pages/LoginPage.js +2 -1
  36. package/dist/pages/SignUpPage.js +2 -1
  37. package/dist/pages/SignupConfirmPage.js +2 -1
  38. package/dist/theme/index.js +2 -1
  39. package/dist/theme/kitSxRegistry.js +187 -0
  40. package/dist/theme/themeCompleteness.js +422 -1
  41. package/package.json +1 -1
  42. package/src/auth/ReauthModal.jsx +5 -2
  43. package/src/components/AccessCodeManager.jsx +22 -20
  44. package/src/components/AccessCodeSingleUseToggle.jsx +4 -2
  45. package/src/components/AllowedEmailDomainsManager.jsx +6 -3
  46. package/src/components/AuthFactorRequirementCard.jsx +4 -2
  47. package/src/components/BulkInviteCsvTab.jsx +11 -10
  48. package/src/components/LoginForm.jsx +5 -3
  49. package/src/components/MFAComponent.jsx +20 -12
  50. package/src/components/MfaLoginComponent.jsx +9 -5
  51. package/src/components/PasskeysComponent.jsx +7 -4
  52. package/src/components/QrSignupManager.jsx +6 -4
  53. package/src/components/QrSignupValidityManager.jsx +8 -4
  54. package/src/components/RegistrationMethodsManager.jsx +7 -4
  55. package/src/components/SecurityComponent.jsx +10 -7
  56. package/src/components/SocialLoginButtons.jsx +2 -1
  57. package/src/components/SupportRecoveryRequestsTab.jsx +8 -4
  58. package/src/components/UserInviteComponent.jsx +10 -10
  59. package/src/components/UserListComponent.jsx +12 -7
  60. package/src/components/charts/ChartFrame.jsx +13 -3
  61. package/src/components/charts/TimeSeriesChart.jsx +8 -4
  62. package/src/components/charts/exportChart.js +2 -2
  63. package/src/index.js +4 -0
  64. package/src/layout/PageLayout.jsx +4 -2
  65. package/src/messaging/AttachmentList.jsx +9 -3
  66. package/src/messaging/Composer.jsx +3 -1
  67. package/src/messaging/DirectMessageLauncher.jsx +3 -1
  68. package/src/messaging/MessageBubble.jsx +31 -9
  69. package/src/messaging/PollCard.jsx +8 -6
  70. package/src/messaging/Thread.jsx +3 -1
  71. package/src/notifications/NotificationSettings.jsx +24 -9
  72. package/src/notifications/PopupSurface.jsx +3 -1
  73. package/src/onboarding/steps/BrowserPushStep.jsx +3 -1
  74. package/src/pages/AccountPage.jsx +11 -9
  75. package/src/pages/LoginPage.jsx +6 -4
  76. package/src/pages/SignUpPage.jsx +4 -2
  77. package/src/pages/SignupConfirmPage.jsx +4 -2
  78. package/src/theme/index.js +4 -0
  79. package/src/theme/kitSxRegistry.js +246 -0
  80. package/src/theme/themeCompleteness.js +451 -1
  81. package/tests/ChartFrame.test.jsx +5 -0
  82. package/tests/themeCompleteness.test.js +351 -0
  83. package/work-orders/THEME-4.md +86 -0
  84. package/work-orders/THEME-5.md +341 -0
@@ -1,6 +1,12 @@
1
1
  import { createTheme, getContrastRatio as getMuiContrastRatio } from '@mui/material/styles';
2
2
 
3
- import { STATUS_KEYS, TYPOGRAPHY_VARIANTS } from './tokens';
3
+ import {
4
+ BASELINE_PALETTE,
5
+ BASELINE_STATIC,
6
+ STATUS_KEYS,
7
+ TYPOGRAPHY_VARIANTS,
8
+ } from './tokens';
9
+ import { KIT_COMPONENT_SX_REGISTRY } from './kitSxRegistry';
4
10
 
5
11
  const MUI_DEFAULT_THEME = createTheme();
6
12
 
@@ -366,6 +372,450 @@ export function assertThemeComplete(theme, { exemptions = [] } = {}) {
366
372
  return { findings };
367
373
  }
368
374
 
375
+ const SAME_ROOT_STYLE_OVERRIDE_SLOTS = {
376
+ MuiAlert: ['standardSuccess', 'standardWarning', 'standardError', 'standardInfo'],
377
+ MuiButton: ['root', 'contained', 'outlined'],
378
+ MuiChip: ['root', 'outlined'],
379
+ };
380
+
381
+ // MUI's sx prop accepts aliases and CSS spacing shorthands that
382
+ // styleOverrides' plain CSS-in-JS objects do not. Each known alias is
383
+ // expanded to the canonical CSS properties it can affect so the
384
+ // disjointness check compares effects, not raw key spellings; a property
385
+ // outside this table expands to itself.
386
+ const SPACING_SHORTHAND_LONGHANDS = {
387
+ bgcolor: ['backgroundColor'],
388
+ typography: [
389
+ 'fontFamily',
390
+ 'fontSize',
391
+ 'fontStyle',
392
+ 'fontWeight',
393
+ 'letterSpacing',
394
+ 'lineHeight',
395
+ 'textTransform',
396
+ ],
397
+ p: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],
398
+ padding: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],
399
+ px: ['paddingLeft', 'paddingRight'],
400
+ paddingX: ['paddingLeft', 'paddingRight'],
401
+ py: ['paddingTop', 'paddingBottom'],
402
+ paddingY: ['paddingTop', 'paddingBottom'],
403
+ pt: ['paddingTop'],
404
+ pr: ['paddingRight'],
405
+ pb: ['paddingBottom'],
406
+ pl: ['paddingLeft'],
407
+ m: ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'],
408
+ margin: ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'],
409
+ mx: ['marginLeft', 'marginRight'],
410
+ marginX: ['marginLeft', 'marginRight'],
411
+ my: ['marginTop', 'marginBottom'],
412
+ marginY: ['marginTop', 'marginBottom'],
413
+ mt: ['marginTop'],
414
+ mr: ['marginRight'],
415
+ mb: ['marginBottom'],
416
+ ml: ['marginLeft'],
417
+ };
418
+
419
+ function expandShorthandProperty(property) {
420
+ return SPACING_SHORTHAND_LONGHANDS[property] || [property];
421
+ }
422
+
423
+ function styleOverrideKeys(componentConfig, slots = ['root']) {
424
+ const keys = new Set();
425
+ for (const slot of slots) {
426
+ const slotStyles = componentConfig?.styleOverrides?.[slot];
427
+ if (!slotStyles || typeof slotStyles !== 'object' || Array.isArray(slotStyles)) continue;
428
+ Object.keys(slotStyles).forEach((key) => expandShorthandProperty(key).forEach((longhand) => keys.add(longhand)));
429
+ }
430
+ return keys;
431
+ }
432
+
433
+ /**
434
+ * Reports top-level property collisions between registered kit sx objects and
435
+ * the baseline MUI component they target. Known sx aliases are compared by
436
+ * the CSS properties they affect, not by literal key name.
437
+ *
438
+ * This is deliberately a lower bound on shadowing: unknown normalisation gaps
439
+ * remain. A clean result proves only that the registered top-level key sets
440
+ * are disjoint; it is not proof that no component can shadow the baseline.
441
+ */
442
+ export function assertKitSxDisjoint(
443
+ theme,
444
+ { registry = KIT_COMPONENT_SX_REGISTRY, exemptions = [] } = {},
445
+ ) {
446
+ const declaredExemptions = [
447
+ ...(theme?.themeCompleteness?.exemptions || []),
448
+ ...exemptions,
449
+ ];
450
+ const validExemptions = new Set();
451
+ const findings = [];
452
+
453
+ for (const exemption of declaredExemptions) {
454
+ if (!exemption?.surface || !exemption?.reason?.trim()) {
455
+ findings.push({
456
+ surface: `exemption.${exemption?.surface || 'unknown'}`,
457
+ reason: 'A completeness exemption must name a surface and include a reason.',
458
+ });
459
+ continue;
460
+ }
461
+ validExemptions.add(exemption.surface);
462
+ }
463
+
464
+ for (const entry of registry) {
465
+ const baselineKeys = styleOverrideKeys(
466
+ theme?.components?.[entry.muiComponent],
467
+ entry.slots || SAME_ROOT_STYLE_OVERRIDE_SLOTS[entry.muiComponent],
468
+ );
469
+ for (const property of Object.keys(entry.sx || {})) {
470
+ const surface = `${entry.component}.${entry.muiComponent}.${property}`;
471
+ const collides = expandShorthandProperty(property).some((longhand) => baselineKeys.has(longhand));
472
+ if (collides && !validExemptions.has(surface)) {
473
+ findings.push({
474
+ surface,
475
+ reason: `${entry.component} sx shadows ${entry.muiComponent} styleOverrides property "${property}".`,
476
+ });
477
+ }
478
+ }
479
+ }
480
+
481
+ return { findings };
482
+ }
483
+
484
+ const BASELINE_STYLED_MUI_COMPONENTS = [
485
+ 'Alert',
486
+ 'BottomNavigation',
487
+ 'BottomNavigationAction',
488
+ 'Button',
489
+ 'Card',
490
+ 'Checkbox',
491
+ 'Chip',
492
+ 'Container',
493
+ 'CssBaseline',
494
+ 'Dialog',
495
+ 'Divider',
496
+ 'Drawer',
497
+ 'FilledInput',
498
+ 'FormControlLabel',
499
+ 'IconButton',
500
+ 'Input',
501
+ 'Menu',
502
+ 'OutlinedInput',
503
+ 'Paper',
504
+ 'Select',
505
+ 'TableCell',
506
+ 'TextField',
507
+ 'Tooltip',
508
+ ];
509
+
510
+ function jsxOpeningTag(source, start) {
511
+ let braces = 0;
512
+ let quote = null;
513
+ for (let index = start; index < source.length; index += 1) {
514
+ const character = source[index];
515
+ if (quote) {
516
+ if (character === quote && source[index - 1] !== '\\') quote = null;
517
+ continue;
518
+ }
519
+ if (character === '"' || character === "'" || character === '`') {
520
+ quote = character;
521
+ } else if (character === '{') {
522
+ braces += 1;
523
+ } else if (character === '}') {
524
+ braces = Math.max(0, braces - 1);
525
+ } else if (character === '>' && braces === 0) {
526
+ return source.slice(start, index + 1);
527
+ }
528
+ }
529
+ return source.slice(start);
530
+ }
531
+
532
+ function topLevelSxValue(tag) {
533
+ let braces = 0;
534
+ let quote = null;
535
+ for (let index = 0; index < tag.length; index += 1) {
536
+ const character = tag[index];
537
+ if (quote) {
538
+ if (character === quote && tag[index - 1] !== '\\') quote = null;
539
+ continue;
540
+ }
541
+ if (character === '"' || character === "'" || character === '`') {
542
+ quote = character;
543
+ continue;
544
+ }
545
+ if (braces === 0 && (index === 0 || /\s/.test(tag[index - 1]))) {
546
+ const attribute = tag.slice(index).match(/^sx\b\s*=\s*/)?.[0];
547
+ if (attribute) return tag.slice(index + attribute.length);
548
+ }
549
+ if (character === '{') braces += 1;
550
+ if (character === '}') braces = Math.max(0, braces - 1);
551
+ }
552
+ return '';
553
+ }
554
+
555
+ /**
556
+ * Reports baseline-styled MUI tags that bypass the exported-object convention.
557
+ * Like assertKitSxDisjoint, this is a documented lower bound: conditional,
558
+ * array, callback, and otherwise nested sx expressions are not inspected.
559
+ */
560
+ export function reportKitSxBypasses(sources = [], { registry } = {}) {
561
+ const normalized = sources.map((entry, index) =>
562
+ typeof entry === 'string'
563
+ ? { path: `source-${index + 1}`, source: entry }
564
+ : { path: entry.path || `source-${index + 1}`, source: entry.source || '' },
565
+ );
566
+ const findings = [];
567
+ const registeredTargets = registry
568
+ ? registry.reduce((targets, { exportName, muiComponent }) => {
569
+ if (!exportName || !muiComponent) return targets;
570
+ if (!targets.has(exportName)) targets.set(exportName, new Set());
571
+ targets.get(exportName).add(muiComponent);
572
+ return targets;
573
+ }, new Map())
574
+ : null;
575
+ const componentPattern = BASELINE_STYLED_MUI_COMPONENTS.join('|');
576
+ const tagPattern = new RegExp(`<(${componentPattern})\\b`, 'g');
577
+
578
+ for (const { path, source } of normalized) {
579
+ const exportedObjects = new Set(
580
+ [...source.matchAll(/\bexport\s+const\s+([A-Za-z_$][\w$]*)\s*=\s*\{/g)]
581
+ .map((match) => match[1]),
582
+ );
583
+
584
+ for (const match of source.matchAll(tagPattern)) {
585
+ const tag = jsxOpeningTag(source, match.index);
586
+ const sxValue = topLevelSxValue(tag);
587
+ const inline = /^\{\s*\{/.test(sxValue);
588
+ const identifier = sxValue.match(/^\{\s*([A-Za-z_$][\w$]*)\s*\}/)?.[1];
589
+ const exported = identifier && exportedObjects.has(identifier);
590
+ const muiComponent = `Mui${match[1]}`;
591
+ const unregistered = exported
592
+ && registeredTargets
593
+ && !registeredTargets.get(identifier)?.has(muiComponent);
594
+ if (!inline && (!identifier || (exported && !unregistered))) continue;
595
+
596
+ const line = source.slice(0, match.index).split(/\r?\n/).length;
597
+ findings.push({
598
+ surface: `${path}:${line}.Mui${match[1]}.sx`,
599
+ reason: inline
600
+ ? `${match[1]} uses an inline sx object instead of a top-level exported object.`
601
+ : unregistered
602
+ ? `${match[1]} uses exported sx object "${identifier}" without a ${muiComponent} registry entry.`
603
+ : `${match[1]} uses non-exported sx object "${identifier}".`,
604
+ });
605
+ }
606
+ }
607
+
608
+ return { findings };
609
+ }
610
+
611
+ const BASIC_CSS_COLOUR_NAMES = new Set([
612
+ 'aqua',
613
+ 'black',
614
+ 'blue',
615
+ 'fuchsia',
616
+ 'gray',
617
+ 'green',
618
+ 'grey',
619
+ 'lime',
620
+ 'maroon',
621
+ 'navy',
622
+ 'olive',
623
+ 'purple',
624
+ 'red',
625
+ 'silver',
626
+ 'teal',
627
+ 'white',
628
+ 'yellow',
629
+ ]);
630
+
631
+ const MUI_DEFAULT_NUMERIC_RAMP_NAMES = new Set([
632
+ 'amber',
633
+ 'blue',
634
+ 'bluegrey',
635
+ 'brown',
636
+ 'cyan',
637
+ 'deeporange',
638
+ 'deeppurple',
639
+ 'green',
640
+ 'grey',
641
+ 'indigo',
642
+ 'lightblue',
643
+ 'lightgreen',
644
+ 'lime',
645
+ 'orange',
646
+ 'pink',
647
+ 'purple',
648
+ 'red',
649
+ 'teal',
650
+ 'yellow',
651
+ ]);
652
+
653
+ const HEX_COLOUR_PATTERN = /#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})(?![\da-f])/gi;
654
+ const RGB_COLOUR_PATTERN = /rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+(?:\s*,\s*[\d.]+)?\s*\)/gi;
655
+ const NAMED_COLOUR_PATTERN = new RegExp(
656
+ `\\b(?:${[...BASIC_CSS_COLOUR_NAMES].join('|')})\\b`,
657
+ 'gi',
658
+ );
659
+ const COLOUR_PROPERTY_PATTERN = /\b(?:background(?:Color)?|bgcolor|border(?:Top|Right|Bottom|Left)?(?:Color)?|boxShadow|caretColor|color|fill|fillStyle|outline(?:Color)?|stroke|strokeStyle|textShadow|WebkitTextFillColor)\s*(?::|=)\s*$/;
660
+
661
+ function colourKey(value) {
662
+ const colour = parseColour(value);
663
+ return colour ? `${colour.r},${colour.g},${colour.b},${colour.a}` : null;
664
+ }
665
+
666
+ function collectBaselineColourKeys(...roots) {
667
+ const keys = new Set();
668
+ const visit = (value) => {
669
+ if (typeof value === 'string') {
670
+ for (const match of value.matchAll(HEX_COLOUR_PATTERN)) {
671
+ const key = colourKey(match[0]);
672
+ if (key) keys.add(key);
673
+ }
674
+ for (const match of value.matchAll(RGB_COLOUR_PATTERN)) {
675
+ const key = colourKey(match[0]);
676
+ if (key) keys.add(key);
677
+ }
678
+ return;
679
+ }
680
+ if (Array.isArray(value)) {
681
+ value.forEach(visit);
682
+ return;
683
+ }
684
+ if (value && typeof value === 'object') Object.values(value).forEach(visit);
685
+ };
686
+ roots.forEach(visit);
687
+ return keys;
688
+ }
689
+
690
+ function maskComments(source) {
691
+ const characters = [...source];
692
+ let quote = null;
693
+ for (let index = 0; index < characters.length; index += 1) {
694
+ const character = characters[index];
695
+ if (quote) {
696
+ if (character === quote && characters[index - 1] !== '\\') quote = null;
697
+ continue;
698
+ }
699
+ if (character === '"' || character === "'" || character === '`') {
700
+ quote = character;
701
+ continue;
702
+ }
703
+ if (character === '/' && characters[index + 1] === '/') {
704
+ for (; index < characters.length && characters[index] !== '\n'; index += 1) {
705
+ characters[index] = ' ';
706
+ }
707
+ index -= 1;
708
+ } else if (character === '/' && characters[index + 1] === '*') {
709
+ characters[index] = ' ';
710
+ characters[index + 1] = ' ';
711
+ index += 2;
712
+ while (index < characters.length
713
+ && !(characters[index] === '*' && characters[index + 1] === '/')) {
714
+ if (characters[index] !== '\n' && characters[index] !== '\r') characters[index] = ' ';
715
+ index += 1;
716
+ }
717
+ if (index < characters.length) {
718
+ characters[index] = ' ';
719
+ characters[index + 1] = ' ';
720
+ index += 1;
721
+ }
722
+ }
723
+ }
724
+ return characters.join('');
725
+ }
726
+
727
+ function maskQrPrintDocument(source, path) {
728
+ if (!path.replaceAll('\\', '/').endsWith('/QrSignupManager.jsx')) return source;
729
+ const call = /\bprintWindow\.document\.write\s*\(\s*`/g.exec(source);
730
+ if (!call) return source;
731
+ const start = call.index + call[0].lastIndexOf('`');
732
+ let end = start + 1;
733
+ while (end < source.length) {
734
+ if (source[end] === '`' && source[end - 1] !== '\\') break;
735
+ end += 1;
736
+ }
737
+ if (end >= source.length) return source;
738
+
739
+ // The generated print document is standalone HTML rendered outside the
740
+ // React tree, where no application theme is available. Mask the region as
741
+ // one unit instead of accumulating permanent per-colour exemptions.
742
+ return source.slice(0, start)
743
+ + source.slice(start, end + 1).replace(/[^\r\n]/g, ' ')
744
+ + source.slice(end + 1);
745
+ }
746
+
747
+ function normalizedSources(sources) {
748
+ return sources.map((entry, index) =>
749
+ typeof entry === 'string'
750
+ ? { path: `source-${index + 1}`, source: entry }
751
+ : { path: entry.path || `source-${index + 1}`, source: entry.source || '' },
752
+ );
753
+ }
754
+
755
+ /**
756
+ * Reports colour literals in component source that do not come from the
757
+ * baseline palette, plus report-only uses of MUI's untouched numeric ramps.
758
+ */
759
+ export function reportOffPaletteColours(
760
+ sources = [],
761
+ { palette = BASELINE_PALETTE, baselineStatic = BASELINE_STATIC } = {},
762
+ ) {
763
+ const allowedColours = collectBaselineColourKeys(palette, baselineStatic);
764
+ const findings = [];
765
+ const stringPattern = /(["'`])((?:\\.|(?!\1)[\s\S])*)\1/g;
766
+
767
+ for (const { path, source } of normalizedSources(sources)) {
768
+ const normalizedPath = path.replaceAll('\\', '/');
769
+ if (/(^|\/)src\/theme\//.test(normalizedPath)) continue;
770
+ const scanSource = maskComments(maskQrPrintDocument(source, normalizedPath));
771
+
772
+ for (const match of scanSource.matchAll(stringPattern)) {
773
+ const value = match[2].trim();
774
+ const line = source.slice(0, match.index).split(/\r?\n/).length;
775
+ const surface = `${path}:${line}.colour`;
776
+
777
+ for (const hex of value.matchAll(HEX_COLOUR_PATTERN)) {
778
+ if (!allowedColours.has(colourKey(hex[0]))) {
779
+ findings.push({
780
+ surface,
781
+ reason: `Off-palette hex colour "${hex[0]}" is not derived from the baseline palette.`,
782
+ });
783
+ }
784
+ }
785
+
786
+ for (const rgb of value.matchAll(RGB_COLOUR_PATTERN)) {
787
+ if (!allowedColours.has(colourKey(rgb[0]))) {
788
+ findings.push({
789
+ surface,
790
+ reason: `Off-palette rgb colour "${rgb[0]}" is not derived from the baseline palette.`,
791
+ });
792
+ }
793
+ }
794
+
795
+ const before = scanSource.slice(Math.max(0, match.index - 40), match.index);
796
+ const isColourProperty = COLOUR_PROPERTY_PATTERN.test(before);
797
+ const numericRamp = value.match(/^([a-z]+)\.(\d+)$/i);
798
+ if (isColourProperty && !numericRamp) {
799
+ for (const namedColour of value.matchAll(NAMED_COLOUR_PATTERN)) {
800
+ findings.push({
801
+ surface,
802
+ reason: `Named CSS colour "${namedColour[0]}" bypasses the baseline palette.`,
803
+ });
804
+ }
805
+ }
806
+
807
+ if (numericRamp && MUI_DEFAULT_NUMERIC_RAMP_NAMES.has(numericRamp[1].toLowerCase())) {
808
+ findings.push({
809
+ surface,
810
+ reason: `Report only: "${value}" uses MUI's untouched numeric palette ramp, not a baseline token.`,
811
+ });
812
+ }
813
+ }
814
+ }
815
+
816
+ return { findings };
817
+ }
818
+
369
819
  /** Reports adoption signals as numbers; it never changes completeness. */
370
820
  export function reportThemeAdoption(sources = []) {
371
821
  const normalized = sources.map((entry, index) =>
@@ -154,6 +154,11 @@ describe('ChartFrame', () => {
154
154
 
155
155
  fireEvent.click(screen.getByRole('button', { name: 'Export PNG' }));
156
156
  await vi.waitFor(() => expect(chartExport.exportChartPng).toHaveBeenCalledOnce());
157
+ expect(chartExport.exportChartPng).toHaveBeenCalledWith(
158
+ expect.any(HTMLElement),
159
+ 'chart.png',
160
+ '#fff',
161
+ );
157
162
  await vi.waitFor(() => expect(onExportPng).toHaveBeenCalledOnce());
158
163
  });
159
164