@genesislcap/rapid-design-system 15.28.1 → 15.29.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.
@@ -613,23 +613,23 @@ export declare const RadioGroup: React.ForwardRefExoticComponent<
613
613
  >;
614
614
  export type RadioGroupRef = RadioGroupWC;
615
615
 
616
- export declare const Scheduler: React.ForwardRefExoticComponent<
616
+ export declare const RapidRouter: React.ForwardRefExoticComponent<
617
617
  React.PropsWithChildren<
618
- Omit<PublicOf<SchedulerWC>, 'children' | 'style'> &
618
+ Omit<PublicOf<RapidRouterWC>, 'children' | 'style'> &
619
619
  HTMLWCProps & {
620
620
  }
621
- > & React.RefAttributes<SchedulerWC>
621
+ > & React.RefAttributes<RapidRouterWC>
622
622
  >;
623
- export type SchedulerRef = SchedulerWC;
623
+ export type RapidRouterRef = RapidRouterWC;
624
624
 
625
- export declare const RapidRouter: React.ForwardRefExoticComponent<
625
+ export declare const Scheduler: React.ForwardRefExoticComponent<
626
626
  React.PropsWithChildren<
627
- Omit<PublicOf<RapidRouterWC>, 'children' | 'style'> &
627
+ Omit<PublicOf<SchedulerWC>, 'children' | 'style'> &
628
628
  HTMLWCProps & {
629
629
  }
630
- > & React.RefAttributes<RapidRouterWC>
630
+ > & React.RefAttributes<SchedulerWC>
631
631
  >;
632
- export type RapidRouterRef = RapidRouterWC;
632
+ export type SchedulerRef = SchedulerWC;
633
633
 
634
634
  export declare const SchedulerCronBuilder: React.ForwardRefExoticComponent<
635
635
  React.PropsWithChildren<
@@ -649,6 +649,19 @@ export declare const SchedulerTimezone: React.ForwardRefExoticComponent<
649
649
  >;
650
650
  export type SchedulerTimezoneRef = SchedulerTimezoneWC;
651
651
 
652
+ export declare const SectionNavigator: React.ForwardRefExoticComponent<
653
+ React.PropsWithChildren<
654
+ Omit<PublicOf<SectionNavigatorWC>, 'children' | 'style'> &
655
+ HTMLWCProps & {
656
+ onSectionNavigatorSetState?: (event: CustomEvent<unknown>) => void;
657
+ onSectionNavigatorSetStates?: (event: CustomEvent<unknown>) => void;
658
+ onSectionNavigatorClearState?: (event: CustomEvent<unknown>) => void;
659
+ onSectionNavigatorClearAllStates?: (event: CustomEvent<unknown>) => void;
660
+ }
661
+ > & React.RefAttributes<SectionNavigatorWC>
662
+ >;
663
+ export type SectionNavigatorRef = SectionNavigatorWC;
664
+
652
665
  export declare const SearchBarCombobox: React.ForwardRefExoticComponent<
653
666
  React.PropsWithChildren<
654
667
  Omit<PublicOf<SearchBarComboboxWC>, 'children' | 'style'> &
@@ -669,19 +682,6 @@ export declare const SearchBar: React.ForwardRefExoticComponent<
669
682
  >;
670
683
  export type SearchBarRef = SearchBarWC;
671
684
 
672
- export declare const SectionNavigator: React.ForwardRefExoticComponent<
673
- React.PropsWithChildren<
674
- Omit<PublicOf<SectionNavigatorWC>, 'children' | 'style'> &
675
- HTMLWCProps & {
676
- onSectionNavigatorSetState?: (event: CustomEvent<unknown>) => void;
677
- onSectionNavigatorSetStates?: (event: CustomEvent<unknown>) => void;
678
- onSectionNavigatorClearState?: (event: CustomEvent<unknown>) => void;
679
- onSectionNavigatorClearAllStates?: (event: CustomEvent<unknown>) => void;
680
- }
681
- > & React.RefAttributes<SectionNavigatorWC>
682
- >;
683
- export type SectionNavigatorRef = SectionNavigatorWC;
684
-
685
685
  export declare const SegmentedControl: React.ForwardRefExoticComponent<
686
686
  React.PropsWithChildren<
687
687
  Omit<PublicOf<SegmentedControlWC>, 'children' | 'style'> &
package/dist/react.cjs CHANGED
@@ -678,14 +678,14 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
678
678
  return React.createElement(customElements.getName(RadioGroupWC) ?? '%%prefix%%-radio-group', { ...rest, ref }, children);
679
679
  });
680
680
 
681
- const Scheduler = React.forwardRef(function Scheduler(props, ref) {
681
+ const RapidRouter = React.forwardRef(function RapidRouter(props, ref) {
682
682
  const { children, ...rest } = props;
683
- return React.createElement(customElements.getName(SchedulerWC) ?? '%%prefix%%-scheduler', { ...rest, ref }, children);
683
+ return React.createElement(customElements.getName(RapidRouterWC) ?? 'rapid-router', { ...rest, ref }, children);
684
684
  });
685
685
 
686
- const RapidRouter = React.forwardRef(function RapidRouter(props, ref) {
686
+ const Scheduler = React.forwardRef(function Scheduler(props, ref) {
687
687
  const { children, ...rest } = props;
688
- return React.createElement(customElements.getName(RapidRouterWC) ?? 'rapid-router', { ...rest, ref }, children);
688
+ return React.createElement(customElements.getName(SchedulerWC) ?? '%%prefix%%-scheduler', { ...rest, ref }, children);
689
689
  });
690
690
 
691
691
  const SchedulerCronBuilder = React.forwardRef(function SchedulerCronBuilder(props, ref) {
@@ -698,6 +698,38 @@ const SchedulerTimezone = React.forwardRef(function SchedulerTimezone(props, ref
698
698
  return React.createElement(customElements.getName(SchedulerTimezoneWC) ?? '%%prefix%%-scheduler-timezone', { ...rest, ref }, children);
699
699
  });
700
700
 
701
+ const SectionNavigator = React.forwardRef(function SectionNavigator(props, ref) {
702
+ const { onSectionNavigatorSetState, onSectionNavigatorSetStates, onSectionNavigatorClearState, onSectionNavigatorClearAllStates, children, ...rest } = props;
703
+ const _innerRef = React.useRef(null);
704
+ const _onSectionNavigatorSetStateRef = React.useRef(onSectionNavigatorSetState);
705
+ _onSectionNavigatorSetStateRef.current = onSectionNavigatorSetState;
706
+ const _onSectionNavigatorSetStatesRef = React.useRef(onSectionNavigatorSetStates);
707
+ _onSectionNavigatorSetStatesRef.current = onSectionNavigatorSetStates;
708
+ const _onSectionNavigatorClearStateRef = React.useRef(onSectionNavigatorClearState);
709
+ _onSectionNavigatorClearStateRef.current = onSectionNavigatorClearState;
710
+ const _onSectionNavigatorClearAllStatesRef = React.useRef(onSectionNavigatorClearAllStates);
711
+ _onSectionNavigatorClearAllStatesRef.current = onSectionNavigatorClearAllStates;
712
+ React.useLayoutEffect(() => {
713
+ const el = _innerRef.current;
714
+ if (!el) return;
715
+ const _onSectionNavigatorSetStateFn = (e) => _onSectionNavigatorSetStateRef.current?.(e);
716
+ el.addEventListener('section-navigator-set-state', _onSectionNavigatorSetStateFn);
717
+ const _onSectionNavigatorSetStatesFn = (e) => _onSectionNavigatorSetStatesRef.current?.(e);
718
+ el.addEventListener('section-navigator-set-states', _onSectionNavigatorSetStatesFn);
719
+ const _onSectionNavigatorClearStateFn = (e) => _onSectionNavigatorClearStateRef.current?.(e);
720
+ el.addEventListener('section-navigator-clear-state', _onSectionNavigatorClearStateFn);
721
+ const _onSectionNavigatorClearAllStatesFn = (e) => _onSectionNavigatorClearAllStatesRef.current?.(e);
722
+ el.addEventListener('section-navigator-clear-all-states', _onSectionNavigatorClearAllStatesFn);
723
+ return () => {
724
+ el.removeEventListener('section-navigator-set-state', _onSectionNavigatorSetStateFn);
725
+ el.removeEventListener('section-navigator-set-states', _onSectionNavigatorSetStatesFn);
726
+ el.removeEventListener('section-navigator-clear-state', _onSectionNavigatorClearStateFn);
727
+ el.removeEventListener('section-navigator-clear-all-states', _onSectionNavigatorClearAllStatesFn);
728
+ };
729
+ }, []);
730
+ return React.createElement(customElements.getName(SectionNavigatorWC) ?? '%%prefix%%-section-navigator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
731
+ });
732
+
701
733
  const SearchBarCombobox = React.forwardRef(function SearchBarCombobox(props, ref) {
702
734
  const { onOpenChange, children, ...rest } = props;
703
735
  const _innerRef = React.useRef(null);
@@ -732,38 +764,6 @@ const SearchBar = React.forwardRef(function SearchBar(props, ref) {
732
764
  return React.createElement(customElements.getName(SearchBarWC) ?? '%%prefix%%-search-bar', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
733
765
  });
734
766
 
735
- const SectionNavigator = React.forwardRef(function SectionNavigator(props, ref) {
736
- const { onSectionNavigatorSetState, onSectionNavigatorSetStates, onSectionNavigatorClearState, onSectionNavigatorClearAllStates, children, ...rest } = props;
737
- const _innerRef = React.useRef(null);
738
- const _onSectionNavigatorSetStateRef = React.useRef(onSectionNavigatorSetState);
739
- _onSectionNavigatorSetStateRef.current = onSectionNavigatorSetState;
740
- const _onSectionNavigatorSetStatesRef = React.useRef(onSectionNavigatorSetStates);
741
- _onSectionNavigatorSetStatesRef.current = onSectionNavigatorSetStates;
742
- const _onSectionNavigatorClearStateRef = React.useRef(onSectionNavigatorClearState);
743
- _onSectionNavigatorClearStateRef.current = onSectionNavigatorClearState;
744
- const _onSectionNavigatorClearAllStatesRef = React.useRef(onSectionNavigatorClearAllStates);
745
- _onSectionNavigatorClearAllStatesRef.current = onSectionNavigatorClearAllStates;
746
- React.useLayoutEffect(() => {
747
- const el = _innerRef.current;
748
- if (!el) return;
749
- const _onSectionNavigatorSetStateFn = (e) => _onSectionNavigatorSetStateRef.current?.(e);
750
- el.addEventListener('section-navigator-set-state', _onSectionNavigatorSetStateFn);
751
- const _onSectionNavigatorSetStatesFn = (e) => _onSectionNavigatorSetStatesRef.current?.(e);
752
- el.addEventListener('section-navigator-set-states', _onSectionNavigatorSetStatesFn);
753
- const _onSectionNavigatorClearStateFn = (e) => _onSectionNavigatorClearStateRef.current?.(e);
754
- el.addEventListener('section-navigator-clear-state', _onSectionNavigatorClearStateFn);
755
- const _onSectionNavigatorClearAllStatesFn = (e) => _onSectionNavigatorClearAllStatesRef.current?.(e);
756
- el.addEventListener('section-navigator-clear-all-states', _onSectionNavigatorClearAllStatesFn);
757
- return () => {
758
- el.removeEventListener('section-navigator-set-state', _onSectionNavigatorSetStateFn);
759
- el.removeEventListener('section-navigator-set-states', _onSectionNavigatorSetStatesFn);
760
- el.removeEventListener('section-navigator-clear-state', _onSectionNavigatorClearStateFn);
761
- el.removeEventListener('section-navigator-clear-all-states', _onSectionNavigatorClearAllStatesFn);
762
- };
763
- }, []);
764
- return React.createElement(customElements.getName(SectionNavigatorWC) ?? '%%prefix%%-section-navigator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
765
- });
766
-
767
767
  const SegmentedControl = React.forwardRef(function SegmentedControl(props, ref) {
768
768
  const { children, ...rest } = props;
769
769
  return React.createElement(customElements.getName(SegmentedControlWC) ?? '%%prefix%%-segmented-control', { ...rest, ref }, children);
@@ -1049,13 +1049,13 @@ module.exports = {
1049
1049
  ProgressRing,
1050
1050
  Radio,
1051
1051
  RadioGroup,
1052
- Scheduler,
1053
1052
  RapidRouter,
1053
+ Scheduler,
1054
1054
  SchedulerCronBuilder,
1055
1055
  SchedulerTimezone,
1056
+ SectionNavigator,
1056
1057
  SearchBarCombobox,
1057
1058
  SearchBar,
1058
- SectionNavigator,
1059
1059
  SegmentedControl,
1060
1060
  SegmentedItem,
1061
1061
  Select,
package/dist/react.mjs CHANGED
@@ -676,14 +676,14 @@ export const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
676
676
  return React.createElement(customElements.getName(RadioGroupWC) ?? '%%prefix%%-radio-group', { ...rest, ref }, children);
677
677
  });
678
678
 
679
- export const Scheduler = React.forwardRef(function Scheduler(props, ref) {
679
+ export const RapidRouter = React.forwardRef(function RapidRouter(props, ref) {
680
680
  const { children, ...rest } = props;
681
- return React.createElement(customElements.getName(SchedulerWC) ?? '%%prefix%%-scheduler', { ...rest, ref }, children);
681
+ return React.createElement(customElements.getName(RapidRouterWC) ?? 'rapid-router', { ...rest, ref }, children);
682
682
  });
683
683
 
684
- export const RapidRouter = React.forwardRef(function RapidRouter(props, ref) {
684
+ export const Scheduler = React.forwardRef(function Scheduler(props, ref) {
685
685
  const { children, ...rest } = props;
686
- return React.createElement(customElements.getName(RapidRouterWC) ?? 'rapid-router', { ...rest, ref }, children);
686
+ return React.createElement(customElements.getName(SchedulerWC) ?? '%%prefix%%-scheduler', { ...rest, ref }, children);
687
687
  });
688
688
 
689
689
  export const SchedulerCronBuilder = React.forwardRef(function SchedulerCronBuilder(props, ref) {
@@ -696,6 +696,38 @@ export const SchedulerTimezone = React.forwardRef(function SchedulerTimezone(pro
696
696
  return React.createElement(customElements.getName(SchedulerTimezoneWC) ?? '%%prefix%%-scheduler-timezone', { ...rest, ref }, children);
697
697
  });
698
698
 
699
+ export const SectionNavigator = React.forwardRef(function SectionNavigator(props, ref) {
700
+ const { onSectionNavigatorSetState, onSectionNavigatorSetStates, onSectionNavigatorClearState, onSectionNavigatorClearAllStates, children, ...rest } = props;
701
+ const _innerRef = React.useRef(null);
702
+ const _onSectionNavigatorSetStateRef = React.useRef(onSectionNavigatorSetState);
703
+ _onSectionNavigatorSetStateRef.current = onSectionNavigatorSetState;
704
+ const _onSectionNavigatorSetStatesRef = React.useRef(onSectionNavigatorSetStates);
705
+ _onSectionNavigatorSetStatesRef.current = onSectionNavigatorSetStates;
706
+ const _onSectionNavigatorClearStateRef = React.useRef(onSectionNavigatorClearState);
707
+ _onSectionNavigatorClearStateRef.current = onSectionNavigatorClearState;
708
+ const _onSectionNavigatorClearAllStatesRef = React.useRef(onSectionNavigatorClearAllStates);
709
+ _onSectionNavigatorClearAllStatesRef.current = onSectionNavigatorClearAllStates;
710
+ React.useLayoutEffect(() => {
711
+ const el = _innerRef.current;
712
+ if (!el) return;
713
+ const _onSectionNavigatorSetStateFn = (e) => _onSectionNavigatorSetStateRef.current?.(e);
714
+ el.addEventListener('section-navigator-set-state', _onSectionNavigatorSetStateFn);
715
+ const _onSectionNavigatorSetStatesFn = (e) => _onSectionNavigatorSetStatesRef.current?.(e);
716
+ el.addEventListener('section-navigator-set-states', _onSectionNavigatorSetStatesFn);
717
+ const _onSectionNavigatorClearStateFn = (e) => _onSectionNavigatorClearStateRef.current?.(e);
718
+ el.addEventListener('section-navigator-clear-state', _onSectionNavigatorClearStateFn);
719
+ const _onSectionNavigatorClearAllStatesFn = (e) => _onSectionNavigatorClearAllStatesRef.current?.(e);
720
+ el.addEventListener('section-navigator-clear-all-states', _onSectionNavigatorClearAllStatesFn);
721
+ return () => {
722
+ el.removeEventListener('section-navigator-set-state', _onSectionNavigatorSetStateFn);
723
+ el.removeEventListener('section-navigator-set-states', _onSectionNavigatorSetStatesFn);
724
+ el.removeEventListener('section-navigator-clear-state', _onSectionNavigatorClearStateFn);
725
+ el.removeEventListener('section-navigator-clear-all-states', _onSectionNavigatorClearAllStatesFn);
726
+ };
727
+ }, []);
728
+ return React.createElement(customElements.getName(SectionNavigatorWC) ?? '%%prefix%%-section-navigator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
729
+ });
730
+
699
731
  export const SearchBarCombobox = React.forwardRef(function SearchBarCombobox(props, ref) {
700
732
  const { onOpenChange, children, ...rest } = props;
701
733
  const _innerRef = React.useRef(null);
@@ -730,38 +762,6 @@ export const SearchBar = React.forwardRef(function SearchBar(props, ref) {
730
762
  return React.createElement(customElements.getName(SearchBarWC) ?? '%%prefix%%-search-bar', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
731
763
  });
732
764
 
733
- export const SectionNavigator = React.forwardRef(function SectionNavigator(props, ref) {
734
- const { onSectionNavigatorSetState, onSectionNavigatorSetStates, onSectionNavigatorClearState, onSectionNavigatorClearAllStates, children, ...rest } = props;
735
- const _innerRef = React.useRef(null);
736
- const _onSectionNavigatorSetStateRef = React.useRef(onSectionNavigatorSetState);
737
- _onSectionNavigatorSetStateRef.current = onSectionNavigatorSetState;
738
- const _onSectionNavigatorSetStatesRef = React.useRef(onSectionNavigatorSetStates);
739
- _onSectionNavigatorSetStatesRef.current = onSectionNavigatorSetStates;
740
- const _onSectionNavigatorClearStateRef = React.useRef(onSectionNavigatorClearState);
741
- _onSectionNavigatorClearStateRef.current = onSectionNavigatorClearState;
742
- const _onSectionNavigatorClearAllStatesRef = React.useRef(onSectionNavigatorClearAllStates);
743
- _onSectionNavigatorClearAllStatesRef.current = onSectionNavigatorClearAllStates;
744
- React.useLayoutEffect(() => {
745
- const el = _innerRef.current;
746
- if (!el) return;
747
- const _onSectionNavigatorSetStateFn = (e) => _onSectionNavigatorSetStateRef.current?.(e);
748
- el.addEventListener('section-navigator-set-state', _onSectionNavigatorSetStateFn);
749
- const _onSectionNavigatorSetStatesFn = (e) => _onSectionNavigatorSetStatesRef.current?.(e);
750
- el.addEventListener('section-navigator-set-states', _onSectionNavigatorSetStatesFn);
751
- const _onSectionNavigatorClearStateFn = (e) => _onSectionNavigatorClearStateRef.current?.(e);
752
- el.addEventListener('section-navigator-clear-state', _onSectionNavigatorClearStateFn);
753
- const _onSectionNavigatorClearAllStatesFn = (e) => _onSectionNavigatorClearAllStatesRef.current?.(e);
754
- el.addEventListener('section-navigator-clear-all-states', _onSectionNavigatorClearAllStatesFn);
755
- return () => {
756
- el.removeEventListener('section-navigator-set-state', _onSectionNavigatorSetStateFn);
757
- el.removeEventListener('section-navigator-set-states', _onSectionNavigatorSetStatesFn);
758
- el.removeEventListener('section-navigator-clear-state', _onSectionNavigatorClearStateFn);
759
- el.removeEventListener('section-navigator-clear-all-states', _onSectionNavigatorClearAllStatesFn);
760
- };
761
- }, []);
762
- return React.createElement(customElements.getName(SectionNavigatorWC) ?? '%%prefix%%-section-navigator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
763
- });
764
-
765
765
  export const SegmentedControl = React.forwardRef(function SegmentedControl(props, ref) {
766
766
  const { children, ...rest } = props;
767
767
  return React.createElement(customElements.getName(SegmentedControlWC) ?? '%%prefix%%-segmented-control', { ...rest, ref }, children);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/rapid-design-system",
3
3
  "description": "Rapid Design System",
4
- "version": "15.28.1",
4
+ "version": "15.29.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -40,17 +40,17 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@genesiscommunitysuccess/analyzer-import-alias-plugin": "^5.0.3",
43
- "@genesislcap/foundation-testing": "15.28.1",
44
- "@genesislcap/genx": "15.28.1",
45
- "@genesislcap/rollup-builder": "15.28.1",
46
- "@genesislcap/ts-builder": "15.28.1",
47
- "@genesislcap/uvu-playwright-builder": "15.28.1",
48
- "@genesislcap/vite-builder": "15.28.1",
49
- "@genesislcap/webpack-builder": "15.28.1",
50
- "flexlayout-react": "^0.10.8"
43
+ "@genesislcap/foundation-testing": "15.29.0",
44
+ "@genesislcap/genx": "15.29.0",
45
+ "@genesislcap/rollup-builder": "15.29.0",
46
+ "@genesislcap/ts-builder": "15.29.0",
47
+ "@genesislcap/uvu-playwright-builder": "15.29.0",
48
+ "@genesislcap/vite-builder": "15.29.0",
49
+ "@genesislcap/webpack-builder": "15.29.0",
50
+ "flexlayout-react": "0.10.8"
51
51
  },
52
52
  "peerDependencies": {
53
- "flexlayout-react": "^0.10.8"
53
+ "flexlayout-react": "0.10.8"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "flexlayout-react": {
@@ -58,9 +58,9 @@
58
58
  }
59
59
  },
60
60
  "dependencies": {
61
- "@genesislcap/foundation-logger": "15.28.1",
62
- "@genesislcap/foundation-ui": "15.28.1",
63
- "@genesislcap/foundation-utils": "15.28.1",
61
+ "@genesislcap/foundation-logger": "15.29.0",
62
+ "@genesislcap/foundation-ui": "15.29.0",
63
+ "@genesislcap/foundation-utils": "15.29.0",
64
64
  "@microsoft/fast-colors": "5.3.1",
65
65
  "@microsoft/fast-components": "2.30.6",
66
66
  "@microsoft/fast-element": "1.14.0",
@@ -23,6 +23,13 @@
23
23
  * The package `build` runs this in write mode, so a flexlayout-react version bump that is
24
24
  * not accompanied by a regenerated theme leaves the working tree dirty and fails CI's
25
25
  * "Check working tree" gate — turning silent, per-app drift into one loud build failure.
26
+ *
27
+ * It also asserts that every package declaring flexlayout-react pins the exact version the
28
+ * theme is built from (see PINNED_DECLARATIONS). Those declarations are what consumers
29
+ * resolve against, and nothing else compares them: a divergence installs cleanly, passes
30
+ * `pnpm peers check`, regenerates an unchanged theme, and leaves CI green while quietly
31
+ * resolving two copies of flexlayout-react — which breaks the `instanceof` checks the
32
+ * library relies on internally. This is the only gate on that.
26
33
  */
27
34
  import { existsSync, readFileSync, watch, writeFileSync } from 'node:fs';
28
35
  import { basename, dirname, join, resolve } from 'node:path';
@@ -77,9 +84,64 @@ function stripSourceMap(css) {
77
84
  return css.replace(/\/\*#\s*sourceMappingURL=[^*]*\*\/\s*$/, '').replace(/\s+$/, '');
78
85
  }
79
86
 
87
+ /**
88
+ * Every workspace package that declares flexlayout-react to consumers, and the manifest fields
89
+ * it declares it in. All of them must name the exact version this theme is generated from —
90
+ * an exact pin, not a range, so a consumer cannot resolve a version the theme was not built
91
+ * against. Private packages are deliberately out of scope: only published declarations shape
92
+ * what a consumer's installer sees.
93
+ */
94
+ const PINNED_DECLARATIONS = [
95
+ { dir: pkgRoot, fields: ['devDependencies', 'peerDependencies'] },
96
+ {
97
+ dir: resolve(pkgRoot, '..', '..', 'foundation-react-utils'),
98
+ fields: ['dependencies'],
99
+ },
100
+ ];
101
+
102
+ /**
103
+ * Fail the build unless every declaration in PINNED_DECLARATIONS is an exact pin equal to the
104
+ * installed flexlayout-react version.
105
+ * @param {string} version the resolved flexlayout-react version the theme is built from
106
+ */
107
+ function assertPinnedVersionsMatch(version) {
108
+ const problems = [];
109
+
110
+ for (const { dir, fields } of PINNED_DECLARATIONS) {
111
+ const manifestPath = join(dir, 'package.json');
112
+ if (!existsSync(manifestPath)) {
113
+ // The relative hop above is the only thing tying these packages together; if it stops
114
+ // resolving, the check has silently stopped checking, so say so rather than skipping.
115
+ throw new Error(
116
+ `Could not read ${manifestPath} to verify its flexlayout-react pin. If the package ` +
117
+ 'moved, update PINNED_DECLARATIONS in this script.',
118
+ );
119
+ }
120
+ const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
121
+ for (const field of fields) {
122
+ const declared = manifest[field]?.['flexlayout-react'];
123
+ if (declared === undefined) {
124
+ problems.push(`${manifest.name} has no flexlayout-react in ${field}`);
125
+ } else if (declared !== version) {
126
+ problems.push(`${manifest.name} ${field} declares "${declared}", expected "${version}"`);
127
+ }
128
+ }
129
+ }
130
+
131
+ if (problems.length > 0) {
132
+ throw new Error(
133
+ `flexlayout-react is pinned inconsistently (installed: ${version}):\n` +
134
+ problems.map((problem) => ` - ${problem}`).join('\n') +
135
+ '\nEvery declaration must be the same exact version, so consumers cannot resolve a ' +
136
+ 'version this theme was not generated against.',
137
+ );
138
+ }
139
+ }
140
+
80
141
  function buildGeneratedFile() {
81
142
  const flexlayoutPkg = findFlexlayoutPackage();
82
143
  const version = JSON.parse(readFileSync(join(flexlayoutPkg, 'package.json'), 'utf8')).version;
144
+ assertPinnedVersionsMatch(version);
83
145
  const basePath = join(flexlayoutPkg, 'style', 'dark.css');
84
146
  if (!existsSync(basePath)) {
85
147
  throw new Error(`flexlayout-react base theme not found at ${basePath}`);