@edgeandnode/eds-react 1.0.1 → 1.1.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/README.md +50 -8
- package/dist/EDSContext.d.ts +4 -1
- package/dist/EDSContext.d.ts.map +1 -1
- package/dist/EDSContext.js +7 -0
- package/dist/EDSContext.js.map +1 -1
- package/dist/EDSProvider.d.ts +13 -6
- package/dist/EDSProvider.d.ts.map +1 -1
- package/dist/EDSProvider.js +60 -68
- package/dist/EDSProvider.js.map +1 -1
- package/dist/components/Address.d.ts +3 -3
- package/dist/components/Address.d.ts.map +1 -1
- package/dist/components/Address.js.map +1 -1
- package/dist/components/Avatar.d.ts +3 -3
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +3 -2
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Breadcrumbs.parts.d.ts +7 -6
- package/dist/components/Breadcrumbs.parts.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.parts.js +15 -14
- package/dist/components/Breadcrumbs.parts.js.map +1 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +3 -2
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts +8 -4
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/Card.js +2 -1
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Cluster.d.ts +3 -3
- package/dist/components/Cluster.d.ts.map +1 -1
- package/dist/components/Cluster.js.map +1 -1
- package/dist/components/CodeBlock.parts.d.ts.map +1 -1
- package/dist/components/CodeBlock.parts.js +16 -20
- package/dist/components/CodeBlock.parts.js.map +1 -1
- package/dist/components/CopyButton.d.ts.map +1 -1
- package/dist/components/CopyButton.js +3 -2
- package/dist/components/CopyButton.js.map +1 -1
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/Icon.js +3 -3
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/Keyboard.js +1 -1
- package/dist/components/LocalTheme.d.ts +29 -0
- package/dist/components/LocalTheme.d.ts.map +1 -0
- package/dist/components/LocalTheme.js +28 -0
- package/dist/components/LocalTheme.js.map +1 -0
- package/dist/components/Menu.parts.d.ts +43 -9
- package/dist/components/Menu.parts.d.ts.map +1 -1
- package/dist/components/Menu.parts.js +121 -115
- package/dist/components/Menu.parts.js.map +1 -1
- package/dist/components/Modal.parts.d.ts +1 -1
- package/dist/components/Modal.parts.d.ts.map +1 -1
- package/dist/components/Modal.parts.js +22 -11
- package/dist/components/Modal.parts.js.map +1 -1
- package/dist/components/Pane.parts.d.ts +23 -22
- package/dist/components/Pane.parts.d.ts.map +1 -1
- package/dist/components/Pane.parts.js +3 -3
- package/dist/components/Pane.parts.js.map +1 -1
- package/dist/components/Prose.d.ts +1 -1
- package/dist/components/Prose.d.ts.map +1 -1
- package/dist/components/Prose.js +3 -3
- package/dist/components/Prose.js.map +1 -1
- package/dist/components/Prose.meta.d.ts +5 -0
- package/dist/components/Prose.meta.d.ts.map +1 -1
- package/dist/components/Prose.meta.js +10 -0
- package/dist/components/Prose.meta.js.map +1 -1
- package/dist/components/SegmentedControl.parts.d.ts.map +1 -1
- package/dist/components/SegmentedControl.parts.js +3 -2
- package/dist/components/SegmentedControl.parts.js.map +1 -1
- package/dist/components/Select.parts.d.ts +12 -7
- package/dist/components/Select.parts.d.ts.map +1 -1
- package/dist/components/Select.parts.js +28 -18
- package/dist/components/Select.parts.js.map +1 -1
- package/dist/components/TabSet.parts.d.ts.map +1 -1
- package/dist/components/TabSet.parts.js +3 -2
- package/dist/components/TabSet.parts.js.map +1 -1
- package/dist/components/Table.parts.d.ts.map +1 -1
- package/dist/components/Table.parts.js +3 -4
- package/dist/components/Table.parts.js.map +1 -1
- package/dist/components/ThemeSwitcher.d.ts +5 -5
- package/dist/components/ThemeSwitcher.d.ts.map +1 -1
- package/dist/components/ThemeSwitcher.js +6 -5
- package/dist/components/ThemeSwitcher.js.map +1 -1
- package/dist/components/Tooltip.parts.js +2 -2
- package/dist/components/Tooltip.parts.js.map +1 -1
- package/dist/components/base/Addon.d.ts.map +1 -1
- package/dist/components/base/Addon.js +2 -4
- package/dist/components/base/Addon.js.map +1 -1
- package/dist/components/base/ButtonOrLink.parts.d.ts.map +1 -1
- package/dist/components/base/ButtonOrLink.parts.js +2 -1
- package/dist/components/base/ButtonOrLink.parts.js.map +1 -1
- package/dist/components/base/MaybeButtonOrLink.d.ts +7 -5
- package/dist/components/base/MaybeButtonOrLink.d.ts.map +1 -1
- package/dist/components/base/MaybeButtonOrLink.js +7 -2
- package/dist/components/base/MaybeButtonOrLink.js.map +1 -1
- package/dist/components/base/Render.d.ts +25 -6
- package/dist/components/base/Render.d.ts.map +1 -1
- package/dist/components/base/Render.js +4 -3
- package/dist/components/base/Render.js.map +1 -1
- package/dist/components/base/index.d.ts +1 -1
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/useCSSProp.js +1 -1
- package/dist/hooks/useCSSProp.js.map +1 -1
- package/dist/hooks/useEDS.d.ts +24 -1
- package/dist/hooks/useEDS.d.ts.map +1 -1
- package/dist/hooks/useEDS.js +26 -2
- package/dist/hooks/useEDS.js.map +1 -1
- package/dist/hooks/useStyleObserver.d.ts.map +1 -1
- package/dist/hooks/useStyleObserver.js +2 -1
- package/dist/hooks/useStyleObserver.js.map +1 -1
- package/dist/icons/CalendarDynamicIcon.d.ts.map +1 -1
- package/dist/icons/CalendarDynamicIcon.js +3 -1
- package/dist/icons/CalendarDynamicIcon.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme-persistence.d.ts +18 -0
- package/dist/theme-persistence.d.ts.map +1 -0
- package/dist/theme-persistence.js +25 -0
- package/dist/theme-persistence.js.map +1 -0
- package/dist/utils/getReactNodeKey.d.ts.map +1 -1
- package/dist/utils/getReactNodeKey.js +31 -13
- package/dist/utils/getReactNodeKey.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/internal/getTooltipProps.d.ts +9 -0
- package/dist/utils/internal/getTooltipProps.d.ts.map +1 -0
- package/dist/utils/internal/getTooltipProps.js +18 -0
- package/dist/utils/internal/getTooltipProps.js.map +1 -0
- package/dist/utils/internal/index.d.ts +4 -0
- package/dist/utils/internal/index.d.ts.map +1 -0
- package/dist/utils/internal/index.js +4 -0
- package/dist/utils/internal/index.js.map +1 -0
- package/dist/utils/internal/resolveLazy.d.ts +29 -0
- package/dist/utils/internal/resolveLazy.d.ts.map +1 -0
- package/dist/utils/internal/resolveLazy.js +40 -0
- package/dist/utils/internal/resolveLazy.js.map +1 -0
- package/dist/utils/internal/styleScheduler.d.ts.map +1 -0
- package/dist/utils/internal/styleScheduler.js.map +1 -0
- package/dist/utils/isComponentType.d.ts +9 -0
- package/dist/utils/isComponentType.d.ts.map +1 -0
- package/dist/utils/isComponentType.js +22 -0
- package/dist/utils/isComponentType.js.map +1 -0
- package/dist/utils/isReactNode.d.ts +7 -0
- package/dist/utils/isReactNode.d.ts.map +1 -1
- package/dist/utils/isReactNode.js +11 -0
- package/dist/utils/isReactNode.js.map +1 -1
- package/dist/utils/reactNodeToString.d.ts +3 -0
- package/dist/utils/reactNodeToString.d.ts.map +1 -1
- package/dist/utils/reactNodeToString.js +6 -0
- package/dist/utils/reactNodeToString.js.map +1 -1
- package/dist/utils/styleObserver.js +1 -1
- package/dist/utils/trimReactNode.d.ts +3 -0
- package/dist/utils/trimReactNode.d.ts.map +1 -1
- package/dist/utils/trimReactNode.js +6 -0
- package/dist/utils/trimReactNode.js.map +1 -1
- package/package.json +24 -23
- package/scripts/update-skill.cjs +18 -5
- package/skill/SKILL.md +95 -57
- package/skill/references/tokens.md +2 -8
- package/src/EDSContext.ts +10 -1
- package/src/EDSProvider.tsx +111 -80
- package/src/components/Address.tsx +4 -3
- package/src/components/Avatar.tsx +10 -5
- package/src/components/Breadcrumbs.parts.tsx +35 -18
- package/src/components/Button.tsx +7 -2
- package/src/components/Card.tsx +14 -8
- package/src/components/Cluster.tsx +5 -3
- package/src/components/CodeBlock.parts.tsx +20 -24
- package/src/components/CopyButton.tsx +3 -2
- package/src/components/Icon.tsx +3 -9
- package/src/components/Keyboard.tsx +1 -1
- package/src/components/LocalTheme.tsx +47 -0
- package/src/components/Menu.parts.tsx +368 -245
- package/src/components/Modal.parts.tsx +28 -11
- package/src/components/Pane.parts.tsx +31 -26
- package/src/components/Prose.meta.ts +10 -0
- package/src/components/Prose.tsx +4 -3
- package/src/components/SegmentedControl.parts.tsx +3 -8
- package/src/components/Select.parts.tsx +43 -34
- package/src/components/TabSet.parts.tsx +3 -5
- package/src/components/Table.parts.tsx +3 -3
- package/src/components/ThemeSwitcher.tsx +13 -15
- package/src/components/Tooltip.parts.tsx +2 -2
- package/src/components/base/Addon.tsx +3 -4
- package/src/components/base/ButtonOrLink.parts.tsx +2 -1
- package/src/components/base/MaybeButtonOrLink.tsx +11 -6
- package/src/components/base/Render.tsx +28 -4
- package/src/components/base/index.ts +2 -0
- package/src/components/index.ts +8 -0
- package/src/hooks/useCSSProp.ts +1 -1
- package/src/hooks/useEDS.ts +26 -2
- package/src/hooks/useStyleObserver.ts +2 -1
- package/src/icons/CalendarDynamicIcon.tsx +1 -0
- package/src/index.ts +2 -1
- package/src/theme-persistence.ts +31 -0
- package/src/utils/getReactNodeKey.ts +30 -14
- package/src/utils/index.ts +1 -1
- package/src/utils/internal/getTooltipProps.ts +25 -0
- package/src/utils/internal/index.ts +3 -0
- package/src/utils/internal/resolveLazy.ts +44 -0
- package/src/utils/isComponentType.ts +27 -0
- package/src/utils/isReactNode.ts +11 -0
- package/src/utils/reactNodeToString.ts +7 -0
- package/src/utils/styleObserver.ts +1 -1
- package/src/utils/trimReactNode.tsx +7 -0
- package/dist/utils/styleScheduler.d.ts.map +0 -1
- package/dist/utils/styleScheduler.js.map +0 -1
- package/src/__snapshots__/compiled.css +0 -22499
- package/styles/tailwind.storybook.css +0 -19
- /package/dist/utils/{styleScheduler.d.ts → internal/styleScheduler.d.ts} +0 -0
- /package/dist/utils/{styleScheduler.js → internal/styleScheduler.js} +0 -0
- /package/src/utils/{styleScheduler.ts → internal/styleScheduler.ts} +0 -0
package/dist/utils/index.js
CHANGED
|
@@ -3,12 +3,12 @@ export { getAssetUrl } from './getAssetUrl.js';
|
|
|
3
3
|
export { getCSSPropsAttributes } from './getCSSPropsAttributes.js';
|
|
4
4
|
export { getReactNodeKey } from './getReactNodeKey.js';
|
|
5
5
|
export { InlineCounter } from './InlineCounter.js';
|
|
6
|
+
export { isComponentType } from './isComponentType.js';
|
|
6
7
|
export { isReactNode } from './isReactNode.js';
|
|
7
8
|
export { reactNodeToString } from './reactNodeToString.js';
|
|
8
9
|
export { RenderCount } from './RenderCount.js';
|
|
9
10
|
export { setInputValue } from './setInputValue.js';
|
|
10
11
|
export { splitProps } from './splitProps.js';
|
|
11
12
|
export { styleObserver } from './styleObserver.js';
|
|
12
|
-
export { styleScheduler } from './styleScheduler.js';
|
|
13
13
|
export { trimReactNode } from './trimReactNode.js';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TooltipProps } from '../../components/Tooltip.tsx';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a component's `tooltip` prop, which accepts either the tooltip's content or its props.
|
|
4
|
+
* Checks for props (a plain object that isn't a React node) rather than for content, so that any
|
|
5
|
+
* kind of node is treated as content, including ones that `isReactNode` doesn't recognize (e.g.
|
|
6
|
+
* portals or promises).
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTooltipProps(tooltip: TooltipProps['content'] | Omit<TooltipProps, 'children'>): Omit<TooltipProps, 'children'>;
|
|
9
|
+
//# sourceMappingURL=getTooltipProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTooltipProps.d.ts","sourceRoot":"","sources":["../../../src/utils/internal/getTooltipProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEhE;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,GAChE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAGhC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a component's `tooltip` prop, which accepts either the tooltip's content or its props.
|
|
3
|
+
* Checks for props (a plain object that isn't a React node) rather than for content, so that any
|
|
4
|
+
* kind of node is treated as content, including ones that `isReactNode` doesn't recognize (e.g.
|
|
5
|
+
* portals or promises).
|
|
6
|
+
*/
|
|
7
|
+
export function getTooltipProps(tooltip) {
|
|
8
|
+
if (tooltip === undefined)
|
|
9
|
+
return {};
|
|
10
|
+
return isTooltipProps(tooltip) ? tooltip : { content: tooltip };
|
|
11
|
+
}
|
|
12
|
+
function isTooltipProps(tooltip) {
|
|
13
|
+
return (typeof tooltip === 'object' &&
|
|
14
|
+
tooltip !== null &&
|
|
15
|
+
!('$$typeof' in tooltip) &&
|
|
16
|
+
[Object.prototype, null].includes(Object.getPrototypeOf(tooltip)));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=getTooltipProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTooltipProps.js","sourceRoot":"","sources":["../../../src/utils/internal/getTooltipProps.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAiE;IAEjE,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IACpC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AACjE,CAAC;AAED,SAAS,cAAc,CACrB,OAAqF;IAErF,OAAO,CACL,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,KAAK,IAAI;QAChB,CAAC,CAAC,UAAU,IAAI,OAAO,CAAC;QACxB,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAClE,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/internal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/internal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `value` is a lazy value, which is how the React Server Components payload can encode an
|
|
3
|
+
* element passed as a prop from a server component (e.g. when it's rendered by an async server
|
|
4
|
+
* component), or the `type` of an element created by a server component (so the client can suspend
|
|
5
|
+
* on that component's code). `React.lazy()` components are lazy values too.
|
|
6
|
+
*
|
|
7
|
+
* Not to be confused with `react-is`'s `isLazy`, which checks whether an element's type is lazy.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isLazy(value: unknown): value is {
|
|
10
|
+
_payload: unknown;
|
|
11
|
+
_init: (payload: unknown) => unknown;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Resolves a lazy value (see `isLazy`) to what it stands for. React resolves lazy values when
|
|
15
|
+
* rendering them, but code that inspects nodes or element types (`isValidElement`, `cloneElement`,
|
|
16
|
+
* reading `props`, comparing `type`, etc.) must resolve them first. Suspends (throws) while the
|
|
17
|
+
* value's content or code is still loading, so it must be called during render.
|
|
18
|
+
*
|
|
19
|
+
* React has no public API for this. Its `Children` utilities resolve lazy values but only keep
|
|
20
|
+
* renderable results, so they drop a function component and throw on a `memo` or `forwardRef` one.
|
|
21
|
+
* This relies on the same internal `_init` and `_payload` fields they use, which is why it's kept
|
|
22
|
+
* internal rather than offered as public API. Returns other values as is, including lazy ones in an
|
|
23
|
+
* unexpected shape.
|
|
24
|
+
*
|
|
25
|
+
* The return type is the same as the argument's because TypeScript already types a lazy value as
|
|
26
|
+
* what it resolves to.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveLazy<Value>(value: Value): Value;
|
|
29
|
+
//# sourceMappingURL=resolveLazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveLazy.d.ts","sourceRoot":"","sources":["../../../src/utils/internal/resolveLazy.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAA;CAAE,CAUtE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAItD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Lazy } from 'react-is';
|
|
2
|
+
/**
|
|
3
|
+
* Whether `value` is a lazy value, which is how the React Server Components payload can encode an
|
|
4
|
+
* element passed as a prop from a server component (e.g. when it's rendered by an async server
|
|
5
|
+
* component), or the `type` of an element created by a server component (so the client can suspend
|
|
6
|
+
* on that component's code). `React.lazy()` components are lazy values too.
|
|
7
|
+
*
|
|
8
|
+
* Not to be confused with `react-is`'s `isLazy`, which checks whether an element's type is lazy.
|
|
9
|
+
*/
|
|
10
|
+
export function isLazy(value) {
|
|
11
|
+
return (typeof value === 'object' &&
|
|
12
|
+
value !== null &&
|
|
13
|
+
'$$typeof' in value &&
|
|
14
|
+
value.$$typeof === Lazy &&
|
|
15
|
+
'_payload' in value &&
|
|
16
|
+
'_init' in value &&
|
|
17
|
+
typeof value._init === 'function');
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a lazy value (see `isLazy`) to what it stands for. React resolves lazy values when
|
|
21
|
+
* rendering them, but code that inspects nodes or element types (`isValidElement`, `cloneElement`,
|
|
22
|
+
* reading `props`, comparing `type`, etc.) must resolve them first. Suspends (throws) while the
|
|
23
|
+
* value's content or code is still loading, so it must be called during render.
|
|
24
|
+
*
|
|
25
|
+
* React has no public API for this. Its `Children` utilities resolve lazy values but only keep
|
|
26
|
+
* renderable results, so they drop a function component and throw on a `memo` or `forwardRef` one.
|
|
27
|
+
* This relies on the same internal `_init` and `_payload` fields they use, which is why it's kept
|
|
28
|
+
* internal rather than offered as public API. Returns other values as is, including lazy ones in an
|
|
29
|
+
* unexpected shape.
|
|
30
|
+
*
|
|
31
|
+
* The return type is the same as the argument's because TypeScript already types a lazy value as
|
|
32
|
+
* what it resolves to.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveLazy(value) {
|
|
35
|
+
let resolvedValue = value;
|
|
36
|
+
while (isLazy(resolvedValue))
|
|
37
|
+
resolvedValue = resolvedValue._init(resolvedValue._payload);
|
|
38
|
+
return resolvedValue;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=resolveLazy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveLazy.js","sourceRoot":"","sources":["../../../src/utils/internal/resolveLazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CACpB,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,UAAU,IAAI,KAAK;QACnB,KAAK,CAAC,QAAQ,KAAK,IAAI;QACvB,UAAU,IAAI,KAAK;QACnB,OAAO,IAAI,KAAK;QAChB,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,CAClC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAQ,KAAY;IAC7C,IAAI,aAAa,GAAY,KAAK,CAAA;IAClC,OAAO,MAAM,CAAC,aAAa,CAAC;QAAE,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACzF,OAAO,aAAsB,CAAA;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styleScheduler.d.ts","sourceRoot":"","sources":["../../../src/utils/internal/styleScheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAM,cAAc;IAClB,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,OAAO,CAAqB;IAEpC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAiBzC;IAED;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAM/D;CACF;AAGD,eAAO,MAAM,cAAc,gBAAuB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styleScheduler.js","sourceRoot":"","sources":["../../../src/utils/internal/styleScheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,cAAc;IACV,KAAK,GAAkB,IAAI,CAAA;IAC3B,OAAO,GAAmB,EAAE,CAAA;IAEpC;;;;OAIG;IACH,QAAQ,CAAC,QAAoB;QAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAE3B,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,GAAG,qBAAqB,CAAC,GAAG,EAAE;gBACtC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAA;gBAC9B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;gBACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;gBAEjB,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;YACjC,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,GAAG,EAAE;YACV,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;YAC5C,IAAI,KAAK,KAAK,CAAC,CAAC;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACjD,CAAC,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,OAAgB;QAC/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;gBACjB,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAA;YAC3C,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,kDAAkD;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Whether `value` is a component (function, class, `forwardRef`, or `memo`) rather than a node.
|
|
4
|
+
*
|
|
5
|
+
* Like React's `Children` utilities, this resolves lazy values (e.g. elements from server
|
|
6
|
+
* components), which suspends while one is still loading, so call it during render.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isComponentType<Props>(value: ReactNode | ComponentType<Props>): value is ComponentType<Props>;
|
|
9
|
+
//# sourceMappingURL=isComponentType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isComponentType.d.ts","sourceRoot":"","sources":["../../src/utils/isComponentType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKrD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EACnC,KAAK,EAAE,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,GACtC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,CAa/B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ForwardRef, Memo } from 'react-is';
|
|
2
|
+
import { isLazy, resolveLazy } from './internal/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether `value` is a component (function, class, `forwardRef`, or `memo`) rather than a node.
|
|
5
|
+
*
|
|
6
|
+
* Like React's `Children` utilities, this resolves lazy values (e.g. elements from server
|
|
7
|
+
* components), which suspends while one is still loading, so call it during render.
|
|
8
|
+
*/
|
|
9
|
+
export function isComponentType(value) {
|
|
10
|
+
/**
|
|
11
|
+
* Unlike `react-is`'s `isValidElementType`, which returns `true` for any lazy value, resolving
|
|
12
|
+
* tells lazy components (e.g. `React.lazy()`) apart from lazy nodes.
|
|
13
|
+
*/
|
|
14
|
+
if (isLazy(value))
|
|
15
|
+
return isComponentType(resolveLazy(value));
|
|
16
|
+
return (typeof value === 'function' ||
|
|
17
|
+
(typeof value === 'object' &&
|
|
18
|
+
value !== null &&
|
|
19
|
+
'$$typeof' in value &&
|
|
20
|
+
(value.$$typeof === ForwardRef || value.$$typeof === Memo)));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=isComponentType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isComponentType.js","sourceRoot":"","sources":["../../src/utils/isComponentType.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAuC;IAEvC;;;OAGG;IACH,IAAI,MAAM,CAAC,KAAK,CAAC;QAAE,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,CACL,OAAO,KAAK,KAAK,UAAU;QAC3B,CAAC,OAAO,KAAK,KAAK,QAAQ;YACxB,KAAK,KAAK,IAAI;YACd,UAAU,IAAI,KAAK;YACnB,CAAC,KAAK,CAAC,QAAQ,KAAK,UAAU,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAC9D,CAAA;AACH,CAAC"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Whether `value` is a React node: `null`, `undefined`, a string, number, or boolean, an element, a
|
|
4
|
+
* lazy node (e.g. an element from a server component), or an array of these.
|
|
5
|
+
*
|
|
6
|
+
* Like React's `Children` utilities, this resolves lazy values (e.g. elements from server
|
|
7
|
+
* components), which suspends while one is still loading, so call it during render.
|
|
8
|
+
*/
|
|
2
9
|
export declare function isReactNode(value: unknown): value is ReactNode;
|
|
3
10
|
//# sourceMappingURL=isReactNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isReactNode.d.ts","sourceRoot":"","sources":["../../src/utils/isReactNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"isReactNode.d.ts","sourceRoot":"","sources":["../../src/utils/isReactNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAItD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAY9D"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { isValidElement } from 'react';
|
|
2
|
+
import { isLazy, resolveLazy } from './internal/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether `value` is a React node: `null`, `undefined`, a string, number, or boolean, an element, a
|
|
5
|
+
* lazy node (e.g. an element from a server component), or an array of these.
|
|
6
|
+
*
|
|
7
|
+
* Like React's `Children` utilities, this resolves lazy values (e.g. elements from server
|
|
8
|
+
* components), which suspends while one is still loading, so call it during render.
|
|
9
|
+
*/
|
|
2
10
|
export function isReactNode(value) {
|
|
11
|
+
// Resolving tells lazy nodes apart from lazy components (e.g. `React.lazy()`)
|
|
12
|
+
if (isLazy(value))
|
|
13
|
+
return isReactNode(resolveLazy(value));
|
|
3
14
|
return (value === null ||
|
|
4
15
|
value === undefined ||
|
|
5
16
|
typeof value === 'string' ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isReactNode.js","sourceRoot":"","sources":["../../src/utils/isReactNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAA;AAEtD,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,CACL,KAAK,KAAK,IAAI;QACd,KAAK,KAAK,SAAS;QACnB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,cAAc,CAAC,KAAK,CAAC;QACrB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CACnD,CAAA;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"isReactNode.js","sourceRoot":"","sources":["../../src/utils/isReactNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,8EAA8E;IAC9E,IAAI,MAAM,CAAC,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAA;IACzD,OAAO,CACL,KAAK,KAAK,IAAI;QACd,KAAK,KAAK,SAAS;QACnB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,cAAc,CAAC,KAAK,CAAC;QACrB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CACnD,CAAA;AACH,CAAC"}
|
|
@@ -5,6 +5,9 @@ import { type ReactNode } from 'react';
|
|
|
5
5
|
*
|
|
6
6
|
* Based on `https://github.com/sunknudsen/react-node-to-string`
|
|
7
7
|
*
|
|
8
|
+
* Like React's `Children` utilities, this resolves lazy values (e.g. elements from server
|
|
9
|
+
* components), which suspends while one is still loading, so call it during render.
|
|
10
|
+
*
|
|
8
11
|
* @param reactNode - The React node to convert to string.
|
|
9
12
|
* @returns The string representation of the node, or empty string for null/undefined/boolean.
|
|
10
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactNodeToString.d.ts","sourceRoot":"","sources":["../../src/utils/reactNodeToString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"reactNodeToString.d.ts","sourceRoot":"","sources":["../../src/utils/reactNodeToString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIzE;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAiB9D"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { isValidElement } from 'react';
|
|
2
|
+
import { isLazy, resolveLazy } from './internal/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* Converts a `ReactNode` to a `string` representation. Extracts text content from React elements
|
|
4
5
|
* recursively.
|
|
5
6
|
*
|
|
6
7
|
* Based on `https://github.com/sunknudsen/react-node-to-string`
|
|
7
8
|
*
|
|
9
|
+
* Like React's `Children` utilities, this resolves lazy values (e.g. elements from server
|
|
10
|
+
* components), which suspends while one is still loading, so call it during render.
|
|
11
|
+
*
|
|
8
12
|
* @param reactNode - The React node to convert to string.
|
|
9
13
|
* @returns The string representation of the node, or empty string for null/undefined/boolean.
|
|
10
14
|
*/
|
|
11
15
|
export function reactNodeToString(reactNode) {
|
|
16
|
+
if (isLazy(reactNode))
|
|
17
|
+
return reactNodeToString(resolveLazy(reactNode));
|
|
12
18
|
if (typeof reactNode === 'string') {
|
|
13
19
|
return reactNode;
|
|
14
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactNodeToString.js","sourceRoot":"","sources":["../../src/utils/reactNodeToString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,MAAM,OAAO,CAAA;AAEzE
|
|
1
|
+
{"version":3,"file":"reactNodeToString.js","sourceRoot":"","sources":["../../src/utils/reactNodeToString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,MAAM,OAAO,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAoB;IACpD,IAAI,MAAM,CAAC,SAAS,CAAC;QAAE,OAAO,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAA;IAEvE,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,SAAS,CAAC,CAAA;IAC1B,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,KAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC/E,CAAC;IACD,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,SAAmD,CAAA;QACnE,OAAO,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import StyleObserver from 'style-observer';
|
|
2
|
-
import { styleScheduler } from './
|
|
2
|
+
import { styleScheduler } from './internal/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Singleton StyleObserver that all `useStyleObserver` hooks subscribe to. Instead of each hook
|
|
5
5
|
* creating its own StyleObserver instance (with its own CSS transitions and event listeners), a
|
|
@@ -13,6 +13,9 @@ type Side = 'start' | 'end' | 'both';
|
|
|
13
13
|
* When recursing into a non-string edge child (e.g. a nested fragment), only the corresponding side
|
|
14
14
|
* is trimmed, so that whitespace which is internal to the outer node is preserved.
|
|
15
15
|
*
|
|
16
|
+
* Like React's `Children` utilities, this resolves lazy values (e.g. elements from server
|
|
17
|
+
* components), which suspends while one is still loading, so call it during render.
|
|
18
|
+
*
|
|
16
19
|
* @example
|
|
17
20
|
* ````tsx
|
|
18
21
|
* trimReactNode(' hello ') // 'hello'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trimReactNode.d.ts","sourceRoot":"","sources":["../../src/utils/trimReactNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"trimReactNode.d.ts","sourceRoot":"","sources":["../../src/utils/trimReactNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAInF,KAAK,IAAI,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,GAAE,IAAa,GAAG,SAAS,CAoElF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Children, isValidElement } from 'react';
|
|
2
|
+
import { isLazy, resolveLazy } from './internal/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* Trims leading and trailing whitespace from a `ReactNode`.
|
|
4
5
|
*
|
|
@@ -12,6 +13,9 @@ import { Children, isValidElement } from 'react';
|
|
|
12
13
|
* When recursing into a non-string edge child (e.g. a nested fragment), only the corresponding side
|
|
13
14
|
* is trimmed, so that whitespace which is internal to the outer node is preserved.
|
|
14
15
|
*
|
|
16
|
+
* Like React's `Children` utilities, this resolves lazy values (e.g. elements from server
|
|
17
|
+
* components), which suspends while one is still loading, so call it during render.
|
|
18
|
+
*
|
|
15
19
|
* @example
|
|
16
20
|
* ````tsx
|
|
17
21
|
* trimReactNode(' hello ') // 'hello'
|
|
@@ -27,6 +31,8 @@ import { Children, isValidElement } from 'react';
|
|
|
27
31
|
* @returns A new `ReactNode` with the requested edge whitespace removed.
|
|
28
32
|
*/
|
|
29
33
|
export function trimReactNode(reactNode, side = 'both') {
|
|
34
|
+
if (isLazy(reactNode))
|
|
35
|
+
return trimReactNode(resolveLazy(reactNode), side);
|
|
30
36
|
// Handle primitives
|
|
31
37
|
if (typeof reactNode === 'string') {
|
|
32
38
|
switch (side) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trimReactNode.js","sourceRoot":"","sources":["../../src/utils/trimReactNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAqC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"trimReactNode.js","sourceRoot":"","sources":["../../src/utils/trimReactNode.tsx"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgeandnode/eds-react",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "React components for the Edge Design System",
|
|
5
5
|
"author": "Edge & Node and contributors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,8 +35,9 @@
|
|
|
35
35
|
"src",
|
|
36
36
|
"!src/**/*.test.*",
|
|
37
37
|
"!src/**/*.stories.*",
|
|
38
|
+
"!src/**/__snapshots__",
|
|
39
|
+
"!styles/tailwind.storybook.css",
|
|
38
40
|
"skill",
|
|
39
|
-
"!skill/.benchmark",
|
|
40
41
|
"scripts/update-skill.cjs"
|
|
41
42
|
],
|
|
42
43
|
"peerDependencies": {
|
|
@@ -46,48 +47,48 @@
|
|
|
46
47
|
"tailwindcss": "^4.3.2"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"@base-ui/react": "
|
|
50
|
-
"@base-ui/utils": "^0.
|
|
51
|
-
"@edgeandnode/eds-css": "1.0
|
|
52
|
-
"@edgeandnode/eds-icons": "1.0.
|
|
53
|
-
"@edgeandnode/eds-utils": "1.0.
|
|
50
|
+
"@base-ui/react": "~1.9.0",
|
|
51
|
+
"@base-ui/utils": "^0.5.0",
|
|
52
|
+
"@edgeandnode/eds-css": "1.1.0",
|
|
53
|
+
"@edgeandnode/eds-icons": "1.0.2",
|
|
54
|
+
"@edgeandnode/eds-utils": "1.0.2",
|
|
54
55
|
"@react-aria/utils": "^3.34.1",
|
|
55
56
|
"@react-hookz/web": "^26.1.0",
|
|
56
57
|
"@ver0/deep-equal": "^2.0.1",
|
|
57
58
|
"escape-string-regexp": "^5.0.0",
|
|
58
|
-
"motion": "^
|
|
59
|
-
"react-aria": "^3.
|
|
60
|
-
"react-keyed-flatten-children": "^5.1.
|
|
59
|
+
"motion": "^14.3.0",
|
|
60
|
+
"react-aria": "^3.53.1",
|
|
61
|
+
"react-keyed-flatten-children": "^5.1.4",
|
|
61
62
|
"react-markdown": "^10.1.0",
|
|
62
63
|
"remark-gfm": "^4.0.1",
|
|
63
|
-
"shiki": "^4.
|
|
64
|
+
"shiki": "^4.5.0",
|
|
64
65
|
"style-observer": "^0.1.2",
|
|
65
66
|
"ts-extras": "^1.3.0",
|
|
66
67
|
"type-fest": "^5.10.0"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
|
-
"@storybook/addon-mcp": "^10.6.
|
|
70
|
-
"@storybook/addon-themes": "^10.6.
|
|
71
|
-
"@storybook/addon-vitest": "^10.6.
|
|
72
|
-
"@storybook/react": "^10.6.
|
|
73
|
-
"@storybook/react-vite": "^10.6.
|
|
70
|
+
"@storybook/addon-mcp": "^10.6.2",
|
|
71
|
+
"@storybook/addon-themes": "^10.6.2",
|
|
72
|
+
"@storybook/addon-vitest": "^10.6.2",
|
|
73
|
+
"@storybook/react": "^10.6.2",
|
|
74
|
+
"@storybook/react-vite": "^10.6.2",
|
|
74
75
|
"@svgr/core": "^8.1.0",
|
|
75
76
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
76
77
|
"@svgr/plugin-svgo": "^8.1.0",
|
|
77
78
|
"@tailwindcss/cli": "^4.3.3",
|
|
78
79
|
"@tailwindcss/postcss": "^4.3.3",
|
|
79
80
|
"@tailwindcss/vite": "^4.3.3",
|
|
80
|
-
"@types/node": "^26.6.
|
|
81
|
+
"@types/node": "^26.6.5",
|
|
81
82
|
"@types/react": "^19.3.0",
|
|
82
83
|
"@types/react-dom": "^19.3.0",
|
|
83
84
|
"@types/react-is": "^19.3.0",
|
|
84
|
-
"@web3icons/react": "^4.1.
|
|
85
|
+
"@web3icons/react": "^4.1.24",
|
|
85
86
|
"lightningcss": "^1.33.0",
|
|
86
|
-
"postcss": "^8.5.
|
|
87
|
-
"react": "^19.3.
|
|
88
|
-
"react-dom": "^19.3.
|
|
89
|
-
"react-is": "^19.3.
|
|
90
|
-
"storybook": "^10.6.
|
|
87
|
+
"postcss": "^8.5.30",
|
|
88
|
+
"react": "^19.3.1",
|
|
89
|
+
"react-dom": "^19.3.1",
|
|
90
|
+
"react-is": "^19.3.1",
|
|
91
|
+
"storybook": "^10.6.2",
|
|
91
92
|
"storybook-addon-rtl": "^3.0.2",
|
|
92
93
|
"tailwindcss": "^4.3.3"
|
|
93
94
|
},
|
package/scripts/update-skill.cjs
CHANGED
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
mkdirSync,
|
|
15
15
|
copyFileSync,
|
|
16
16
|
unlinkSync,
|
|
17
|
+
rmSync,
|
|
17
18
|
statSync,
|
|
18
19
|
} = require('fs')
|
|
19
20
|
const { join, dirname, relative } = require('path')
|
|
@@ -87,14 +88,11 @@ function compareSemver(a, b) {
|
|
|
87
88
|
return 0
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
/**
|
|
91
|
-
* Recursively copy a directory, overwriting existing files. Only copies files that are included in
|
|
92
|
-
* the published package (skips dotdirs).
|
|
93
|
-
*/
|
|
91
|
+
/** Recursively copy a directory, overwriting existing files. */
|
|
94
92
|
function copyDir(src, dest) {
|
|
95
93
|
mkdirSync(dest, { recursive: true })
|
|
96
94
|
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
97
|
-
// Skip dotdirs (e.g.
|
|
95
|
+
// Skip dotfiles and dotdirs (e.g. `.DS_Store` when the package is linked from a workspace)
|
|
98
96
|
if (entry.name.startsWith('.')) continue
|
|
99
97
|
|
|
100
98
|
const srcPath = join(src, entry.name)
|
|
@@ -145,6 +143,21 @@ for (const targetDir of foundDirs) {
|
|
|
145
143
|
// If no version field, this may be a custom skill named "eds" — skip silently
|
|
146
144
|
if (!installedVersion) continue
|
|
147
145
|
|
|
146
|
+
/**
|
|
147
|
+
* The skill benchmark used to live in `skill/.benchmark`, so `npx skills add` (which copies the
|
|
148
|
+
* whole skill folder from GitHub) installed it too. It now lives outside the skill folder, so
|
|
149
|
+
* remove any stale copy. This runs even when the skill is up to date, so that a removal that
|
|
150
|
+
* failed (e.g. because a file was locked) is retried on the next install instead of failing it.
|
|
151
|
+
*/
|
|
152
|
+
const benchmarkDir = join(targetDir, '.benchmark')
|
|
153
|
+
try {
|
|
154
|
+
rmSync(benchmarkDir, { recursive: true, force: true })
|
|
155
|
+
} catch (error) {
|
|
156
|
+
console.warn(
|
|
157
|
+
`Couldn't remove the stale EDS skill benchmark at ${relative(initCwd, benchmarkDir)}: ${error.message}`,
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
148
161
|
// If installed version is >= package version, skip (prevents downgrades in monorepos)
|
|
149
162
|
if (compareSemver(installedVersion, packageVersion) >= 0) {
|
|
150
163
|
console.log(`EDS skill is up to date (v${installedVersion}) at ${relative(initCwd, targetDir)}`)
|