@coinbase/cds-web 9.28.0 → 9.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.
- package/CHANGELOG.md +7 -0
- package/dts/illustrations/HeroSquare.d.ts.map +1 -1
- package/dts/illustrations/Pictogram.d.ts.map +1 -1
- package/dts/illustrations/SpotIcon.d.ts.map +1 -1
- package/dts/illustrations/SpotRectangle.d.ts.map +1 -1
- package/dts/illustrations/SpotSquare.d.ts.map +1 -1
- package/dts/illustrations/createIllustration.d.ts +11 -1
- package/dts/illustrations/createIllustration.d.ts.map +1 -1
- package/dts/system/FramerMotionProvider.d.ts.map +1 -1
- package/esm/illustrations/HeroSquare.js +5 -2
- package/esm/illustrations/Pictogram.js +6 -2
- package/esm/illustrations/SpotIcon.js +6 -2
- package/esm/illustrations/SpotRectangle.js +5 -2
- package/esm/illustrations/SpotSquare.js +6 -2
- package/esm/illustrations/createIllustration.js +19 -5
- package/esm/system/FramerMotionProvider.js +9 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 9.29.0 (2026-10-02)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Feat: lazy-load framer-motion's `domAnimation` features in `ThemeProvider`, keeping them out of the initial bundle. Pass `motionFeatures={domAnimation}` to load them eagerly.
|
|
6
|
+
- Feat: lazy-load the illustration `svgEsmMap` modules, keeping them out of the initial bundle. Themed illustrations (`applyTheme`) now fetch one extra chunk before rendering.
|
|
7
|
+
|
|
1
8
|
## 9.28.0 (2026-09-18)
|
|
2
9
|
|
|
3
10
|
### 🚀 Features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeroSquare.d.ts","sourceRoot":"","sources":["../../src/illustrations/HeroSquare.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HeroSquare.d.ts","sourceRoot":"","sources":["../../src/illustrations/HeroSquare.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,YAAY,CAAC,GACnE,qBAAqB,GAAG;IACtB;;;SAGK;IACL,SAAS,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;CACrD,CAAC;AAEJ,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAUlD,eAAO,MAAM,UAAU,kHAItB,CAAC;AAEF,YAAY,EAAE,cAAc,EAAE,MAAM,2EAA2E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pictogram.d.ts","sourceRoot":"","sources":["../../src/illustrations/Pictogram.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pictogram.d.ts","sourceRoot":"","sources":["../../src/illustrations/Pictogram.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAU9B,eAAO,MAAM,SAAS,iHAIrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,WAAW,CAAC,GACjE,qBAAqB,GAAG;IACtB;;SAEK;IACL,SAAS,CAAC,EAAE,yBAAyB,CAAC,WAAW,CAAC,CAAC;CACpD,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotIcon.d.ts","sourceRoot":"","sources":["../../src/illustrations/SpotIcon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpotIcon.d.ts","sourceRoot":"","sources":["../../src/illustrations/SpotIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAU9B,eAAO,MAAM,QAAQ,gHAA4E,CAAC;AAElG,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,UAAU,CAAC,GAC/D,qBAAqB,GAAG;IACtB;;SAEK;IACL,SAAS,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;CACrD,CAAC;AACJ,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotRectangle.d.ts","sourceRoot":"","sources":["../../src/illustrations/SpotRectangle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpotRectangle.d.ts","sourceRoot":"","sources":["../../src/illustrations/SpotRectangle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,eAAe,CAAC,GACzE,qBAAqB,GAAG;IACtB;;;SAGK;IACL,SAAS,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;CACxD,CAAC;AAEJ,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAUxD,eAAO,MAAM,aAAa,qHAIzB,CAAC;AAEF,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotSquare.d.ts","sourceRoot":"","sources":["../../src/illustrations/SpotSquare.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpotSquare.d.ts","sourceRoot":"","sources":["../../src/illustrations/SpotSquare.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAU9B,eAAO,MAAM,UAAU,kHAItB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,YAAY,CAAC,GACnE,qBAAqB,GAAG;IACtB;;SAEK;IACL,SAAS,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;CACrD,CAAC;AAEJ,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -67,6 +67,16 @@ type SvgEsmConfigShape<Variant extends IllustrationVariant> = Partial<
|
|
|
67
67
|
}
|
|
68
68
|
>
|
|
69
69
|
>;
|
|
70
|
+
/**
|
|
71
|
+
* A loader for a variant's full svgEsmMap module, or an already-resolved map (for callers that
|
|
72
|
+
* still import it eagerly). Accepting a loader lets `createIllustration` defer the entire
|
|
73
|
+
* per-name map — not just the SVG bodies it points to — out of the static import graph of every
|
|
74
|
+
* consumer, since the map is only ever read inside a post-mount `useEffect` when `applyTheme` is
|
|
75
|
+
* set.
|
|
76
|
+
*/
|
|
77
|
+
type SvgEsmConfigSource<Variant extends IllustrationVariant> =
|
|
78
|
+
| SvgEsmConfigShape<Variant>
|
|
79
|
+
| (() => Promise<SvgEsmConfigShape<Variant>>);
|
|
70
80
|
export type IllustrationA11yProps = {
|
|
71
81
|
/** Alt tag to apply to the img
|
|
72
82
|
* @default "" will identify the image as decorative
|
|
@@ -78,7 +88,7 @@ export type IllustrationBasePropsWithA11y<Type extends IllustrationVariant> =
|
|
|
78
88
|
export declare function createIllustration<Variant extends IllustrationVariant>(
|
|
79
89
|
variant: Variant,
|
|
80
90
|
versionMap: IllustrationVersionMapShape<Variant>,
|
|
81
|
-
svgEsmConfig?:
|
|
91
|
+
svgEsmConfig?: SvgEsmConfigSource<Variant>,
|
|
82
92
|
): React.NamedExoticComponent<IllustrationBasePropsWithA11y<Variant>>;
|
|
83
93
|
export {};
|
|
84
94
|
//# sourceMappingURL=createIllustration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIllustration.d.ts","sourceRoot":"","sources":["../../src/illustrations/createIllustration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAI1E,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,6BAA6B,CAAC;AAarC,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,cAAc,CAAC;IAC3B,aAAa,EAAE,iBAAiB,CAAC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,EAAE,mBAAmB,CAAC;IAChC,UAAU,EAAE,mBAAmB,CAAC;IAChC,aAAa,EAAE,sBAAsB,CAAC;IACtC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,oBAAoB,IAAI,WAAW,GAAG;IACtF,+CAA+C;IAC/C,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;IACzC,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;SAIK;IACL,QAAQ,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;IACrC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,2BAA2B,CAAC,OAAO,SAAS,mBAAmB,IAAI,MAAM,CAC5E,oBAAoB,CAAC,OAAO,CAAC,EAC7B,MAAM,CACP,CAAC;AAEF;;;GAGG;AACH,KAAK,iBAAiB,CAAC,OAAO,SAAS,mBAAmB,IAAI,OAAO,CACnE,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CAC7E,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,6BAA6B,CAAC,IAAI,SAAS,mBAAmB,IACxE,qBAAqB,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC;AAEtD,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,mBAAmB,EACpE,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,2BAA2B,CAAC,OAAO,CAAC,EAChD,YAAY,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"createIllustration.d.ts","sourceRoot":"","sources":["../../src/illustrations/createIllustration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAI1E,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,6BAA6B,CAAC;AAarC,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,cAAc,CAAC;IAC3B,aAAa,EAAE,iBAAiB,CAAC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,EAAE,mBAAmB,CAAC;IAChC,UAAU,EAAE,mBAAmB,CAAC;IAChC,aAAa,EAAE,sBAAsB,CAAC;IACtC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,oBAAoB,IAAI,WAAW,GAAG;IACtF,+CAA+C;IAC/C,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;IACzC,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;SAIK;IACL,QAAQ,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;IACrC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,2BAA2B,CAAC,OAAO,SAAS,mBAAmB,IAAI,MAAM,CAC5E,oBAAoB,CAAC,OAAO,CAAC,EAC7B,MAAM,CACP,CAAC;AAEF;;;GAGG;AACH,KAAK,iBAAiB,CAAC,OAAO,SAAS,mBAAmB,IAAI,OAAO,CACnE,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CAC7E,CAAC;AAEF;;;;;;GAMG;AACH,KAAK,kBAAkB,CAAC,OAAO,SAAS,mBAAmB,IACvD,iBAAiB,CAAC,OAAO,CAAC,GAC1B,CAAC,MAAM,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,6BAA6B,CAAC,IAAI,SAAS,mBAAmB,IACxE,qBAAqB,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC;AAEtD,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,mBAAmB,EACpE,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,2BAA2B,CAAC,OAAO,CAAC,EAChD,YAAY,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,sEAkG3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FramerMotionProvider.d.ts","sourceRoot":"","sources":["../../src/system/FramerMotionProvider.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"FramerMotionProvider.d.ts","sourceRoot":"","sources":["../../src/system/FramerMotionProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAE3D,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IACpE,cAAc,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC;AAUF,eAAO,MAAM,oBAAoB,GAAI,+BAGlC,yBAAyB,4CAM3B,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import heroSquareSvgEsmMap from '@coinbase/cds-illustrations/__generated__/heroSquare/data/svgEsmMap';
|
|
2
1
|
import heroSquareVersionMap from '@coinbase/cds-illustrations/__generated__/heroSquare/data/versionMap';
|
|
3
2
|
import { createIllustration } from './createIllustration';
|
|
4
|
-
|
|
3
|
+
// Loaded lazily — only fetched once a HeroSquare with applyTheme actually mounts — so the
|
|
4
|
+
// generated per-name svgEsmMap never lands in the static import graph of consumers that don't
|
|
5
|
+
// use theming.
|
|
6
|
+
const loadHeroSquareSvgEsmMap = () => import('@coinbase/cds-illustrations/__generated__/heroSquare/data/svgEsmMap').then(mod => mod.default);
|
|
7
|
+
export const HeroSquare = createIllustration('heroSquare', heroSquareVersionMap, loadHeroSquareSvgEsmMap);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import pictogramSvgEsmMap from '@coinbase/cds-illustrations/__generated__/pictogram/data/svgEsmMap';
|
|
2
1
|
import pictogramVersionMap from '@coinbase/cds-illustrations/__generated__/pictogram/data/versionMap';
|
|
3
2
|
import { createIllustration } from './createIllustration';
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
// Loaded lazily — only fetched once a Pictogram with applyTheme actually mounts — so the
|
|
5
|
+
// generated per-name svgEsmMap never lands in the static import graph of consumers that don't
|
|
6
|
+
// use theming.
|
|
7
|
+
const loadPictogramSvgEsmMap = () => import('@coinbase/cds-illustrations/__generated__/pictogram/data/svgEsmMap').then(mod => mod.default);
|
|
8
|
+
export const Pictogram = createIllustration('pictogram', pictogramVersionMap, loadPictogramSvgEsmMap);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import spotIconSvgEsmMap from '@coinbase/cds-illustrations/__generated__/spotIcon/data/svgEsmMap';
|
|
2
1
|
import spotIconVersionMap from '@coinbase/cds-illustrations/__generated__/spotIcon/data/versionMap';
|
|
3
2
|
import { createIllustration } from './createIllustration';
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
// Loaded lazily — only fetched once a SpotIcon with applyTheme actually mounts — so the
|
|
5
|
+
// generated per-name svgEsmMap never lands in the static import graph of consumers that don't
|
|
6
|
+
// use theming.
|
|
7
|
+
const loadSpotIconSvgEsmMap = () => import('@coinbase/cds-illustrations/__generated__/spotIcon/data/svgEsmMap').then(mod => mod.default);
|
|
8
|
+
export const SpotIcon = createIllustration('spotIcon', spotIconVersionMap, loadSpotIconSvgEsmMap);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import spotRectangleSvgEsmMap from '@coinbase/cds-illustrations/__generated__/spotRectangle/data/svgEsmMap';
|
|
2
1
|
import spotRectangleVersionMap from '@coinbase/cds-illustrations/__generated__/spotRectangle/data/versionMap';
|
|
3
2
|
import { createIllustration } from './createIllustration';
|
|
4
|
-
|
|
3
|
+
// Loaded lazily — only fetched once a SpotRectangle with applyTheme actually mounts — so the
|
|
4
|
+
// generated per-name svgEsmMap never lands in the static import graph of consumers that don't
|
|
5
|
+
// use theming.
|
|
6
|
+
const loadSpotRectangleSvgEsmMap = () => import('@coinbase/cds-illustrations/__generated__/spotRectangle/data/svgEsmMap').then(mod => mod.default);
|
|
7
|
+
export const SpotRectangle = createIllustration('spotRectangle', spotRectangleVersionMap, loadSpotRectangleSvgEsmMap);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import spotSquareSvgEsmMap from '@coinbase/cds-illustrations/__generated__/spotSquare/data/svgEsmMap';
|
|
2
1
|
import spotSquareVersionMap from '@coinbase/cds-illustrations/__generated__/spotSquare/data/versionMap';
|
|
3
2
|
import { createIllustration } from './createIllustration';
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
// Loaded lazily — only fetched once a SpotSquare with applyTheme actually mounts — so the
|
|
5
|
+
// generated per-name svgEsmMap never lands in the static import graph of consumers that don't
|
|
6
|
+
// use theming.
|
|
7
|
+
const loadSpotSquareSvgEsmMap = () => import('@coinbase/cds-illustrations/__generated__/spotSquare/data/svgEsmMap').then(mod => mod.default);
|
|
8
|
+
export const SpotSquare = createIllustration('spotSquare', spotSquareVersionMap, loadSpotSquareSvgEsmMap);
|
|
@@ -13,6 +13,14 @@ const STATIC_ASSETS_CDN = 'https://static-assets.coinbase.com/ui-infra/illustrat
|
|
|
13
13
|
* any bundler (Vite, webpack, esbuild) can code-split without CORS or bare-specifier issues.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* A loader for a variant's full svgEsmMap module, or an already-resolved map (for callers that
|
|
18
|
+
* still import it eagerly). Accepting a loader lets `createIllustration` defer the entire
|
|
19
|
+
* per-name map — not just the SVG bodies it points to — out of the static import graph of every
|
|
20
|
+
* consumer, since the map is only ever read inside a post-mount `useEffect` when `applyTheme` is
|
|
21
|
+
* set.
|
|
22
|
+
*/
|
|
23
|
+
|
|
16
24
|
export function createIllustration(variant, versionMap, svgEsmConfig) {
|
|
17
25
|
const defaultSize = getDefaultSizeObjectForIllustration(variant);
|
|
18
26
|
const Illustration = /*#__PURE__*/memo(function Illustration(_ref) {
|
|
@@ -34,12 +42,18 @@ export function createIllustration(variant, versionMap, svgEsmConfig) {
|
|
|
34
42
|
// null = not yet loaded (or load failed), string = loaded inline SVG
|
|
35
43
|
const [svgMarkup, setSvgMarkup] = useState(null);
|
|
36
44
|
useEffect(() => {
|
|
37
|
-
var _svgEsmConfig$name;
|
|
38
45
|
let cancelled = false;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
if (applyTheme && svgEsmConfig) {
|
|
47
|
+
// svgEsmConfig may be the resolved map, or a loader for it — resolve either shape to the
|
|
48
|
+
// map before looking up this illustration's themeable loader.
|
|
49
|
+
const resolvedConfig = typeof svgEsmConfig === 'function' ? svgEsmConfig() : Promise.resolve(svgEsmConfig);
|
|
50
|
+
resolvedConfig.then(config => {
|
|
51
|
+
var _config$name;
|
|
52
|
+
if (cancelled) return undefined;
|
|
53
|
+
const themeableLoader = (_config$name = config[name]) === null || _config$name === void 0 ? void 0 : _config$name.themeable;
|
|
54
|
+
return themeableLoader === null || themeableLoader === void 0 ? void 0 : themeableLoader();
|
|
55
|
+
}).then(svg => {
|
|
56
|
+
if (!cancelled && svg) setSvgMarkup(svg);
|
|
43
57
|
}).catch(err => {
|
|
44
58
|
if (isDevelopment()) {
|
|
45
59
|
console.error("Failed to load themeable illustration ".concat(name, ":"), err);
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LazyMotion } from 'framer-motion';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* Loads the `domAnimation` feature bundle asynchronously via `LazyMotion`'s loader form
|
|
6
|
+
* (https://motion.dev/docs/react-reduce-bundle-size), instead of statically importing it.
|
|
7
|
+
* This keeps framer-motion's animation features out of the static import graph of every
|
|
8
|
+
* ThemeProvider consumer, since ThemeProvider always mounts FramerMotionProvider.
|
|
9
|
+
*/
|
|
10
|
+
const loadDomAnimationFeatures = () => import('framer-motion').then(mod => mod.domAnimation);
|
|
4
11
|
export const FramerMotionProvider = _ref => {
|
|
5
12
|
let {
|
|
6
13
|
children,
|
|
7
|
-
motionFeatures =
|
|
14
|
+
motionFeatures = loadDomAnimationFeatures
|
|
8
15
|
} = _ref;
|
|
9
16
|
return /*#__PURE__*/_jsx(LazyMotion, {
|
|
10
17
|
strict: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-web",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.29.0",
|
|
4
4
|
"description": "Coinbase Design System - Web",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -227,9 +227,9 @@
|
|
|
227
227
|
"react-dom": "^18.0.0 || ~19.1.2"
|
|
228
228
|
},
|
|
229
229
|
"dependencies": {
|
|
230
|
-
"@coinbase/cds-common": "^9.
|
|
231
|
-
"@coinbase/cds-icons": "^5.
|
|
232
|
-
"@coinbase/cds-illustrations": "^4.
|
|
230
|
+
"@coinbase/cds-common": "^9.29.0",
|
|
231
|
+
"@coinbase/cds-icons": "^5.26.0",
|
|
232
|
+
"@coinbase/cds-illustrations": "^4.49.0",
|
|
233
233
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
234
234
|
"@coinbase/cds-utils": "^2.3.5",
|
|
235
235
|
"@floating-ui/react-dom": "^2.1.1",
|