@fluentui/react-motion-components-preview 0.15.1 → 0.15.3
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.
|
@@ -2,22 +2,26 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks if a React element has all of the specified props explicitly provided.
|
|
4
4
|
*
|
|
5
|
+
* - Exported for testing purposes
|
|
6
|
+
*
|
|
5
7
|
* @param element - React element to inspect
|
|
6
8
|
* @param props - Array of prop names to verify presence on the element
|
|
7
9
|
* @returns true if all props exist on element.props, false otherwise
|
|
8
10
|
*
|
|
9
|
-
* @internal
|
|
11
|
+
* @internal
|
|
10
12
|
*/ /**
|
|
11
13
|
* Checks if a React element is a motion component created by createMotionComponent.
|
|
12
14
|
* Motion components are detected by the presence of the MOTION_DEFINITION symbol on the component.
|
|
13
15
|
*
|
|
16
|
+
* - Exported for testing purposes
|
|
17
|
+
*
|
|
14
18
|
* @param element - React element to inspect
|
|
15
19
|
* @returns true when the element's type contains the MOTION_DEFINITION symbol
|
|
16
20
|
*
|
|
17
21
|
* **Note:** This is a heuristic detection. Motion components may or may not support
|
|
18
22
|
* specific props like `delay` or `visible` depending on their implementation.
|
|
19
23
|
*
|
|
20
|
-
* @internal
|
|
24
|
+
* @internal
|
|
21
25
|
*/ export function isMotionComponent(element) {
|
|
22
26
|
if (!(element === null || element === void 0 ? void 0 : element.type) || typeof element.type !== 'function') {
|
|
23
27
|
return false;
|
|
@@ -30,12 +34,14 @@ import * as React from 'react';
|
|
|
30
34
|
* Checks if a React element is a presence motion component by looking for the PRESENCE_MOTION_DEFINITION symbol.
|
|
31
35
|
* This symbol is added internally by createPresenceComponent and provides reliable detection.
|
|
32
36
|
*
|
|
37
|
+
* - Exported for testing purposes
|
|
38
|
+
*
|
|
33
39
|
* @param element - React element to inspect
|
|
34
40
|
* @returns true when the element's type contains the PRESENCE_MOTION_DEFINITION symbol
|
|
35
41
|
*
|
|
36
42
|
* **Presence components** (like Fade, Scale, Slide) are guaranteed to support both `visible` and `delay` props.
|
|
37
43
|
*
|
|
38
|
-
* @internal
|
|
44
|
+
* @internal
|
|
39
45
|
*/ export function isPresenceComponent(element) {
|
|
40
46
|
if (!(element === null || element === void 0 ? void 0 : element.type) || typeof element.type !== 'function') {
|
|
41
47
|
return false;
|
|
@@ -48,6 +54,8 @@ import * as React from 'react';
|
|
|
48
54
|
* Checks if a React element accepts both `delay` and `exitDelay` props.
|
|
49
55
|
* This uses a best-effort heuristic to detect components that support both delay props.
|
|
50
56
|
*
|
|
57
|
+
* - Exported for testing purposes
|
|
58
|
+
*
|
|
51
59
|
* @param element - React element to inspect
|
|
52
60
|
* @returns true when the element likely supports both delay and exitDelay props
|
|
53
61
|
*
|
|
@@ -59,7 +67,7 @@ import * as React from 'react';
|
|
|
59
67
|
* **When to override:** If auto-detection is incorrect, use explicit `delayMode` prop on Stagger.
|
|
60
68
|
* For example, custom motion components that don't support both props should use `delayMode="timing"`.
|
|
61
69
|
*
|
|
62
|
-
* @internal
|
|
70
|
+
* @internal
|
|
63
71
|
*/ export function acceptsDelayProps(element) {
|
|
64
72
|
return isPresenceComponent(element) || isMotionComponent(element);
|
|
65
73
|
}
|
|
@@ -67,6 +75,8 @@ import * as React from 'react';
|
|
|
67
75
|
* Checks if a React element accepts a `visible` prop.
|
|
68
76
|
* This uses a best-effort heuristic to detect components that support visible props.
|
|
69
77
|
*
|
|
78
|
+
* - Exported for testing purposes
|
|
79
|
+
*
|
|
70
80
|
* @param element - React element to inspect
|
|
71
81
|
* @returns true when the element likely supports a `visible` prop
|
|
72
82
|
*
|
|
@@ -77,7 +87,7 @@ import * as React from 'react';
|
|
|
77
87
|
* **When to override:** If auto-detection is incorrect, use explicit `hideMode` prop on Stagger.
|
|
78
88
|
* For example, custom components that don't support visible should use `hideMode="visibilityStyle"` or `hideMode="unmount"`.
|
|
79
89
|
*
|
|
80
|
-
* @internal
|
|
90
|
+
* @internal
|
|
81
91
|
*/ export function acceptsVisibleProp(element) {
|
|
82
92
|
return isPresenceComponent(element);
|
|
83
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/choreography/Stagger/utils/motionComponentDetection.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Checks if a React element has all of the specified props explicitly provided.\n *\n * @param element - React element to inspect\n * @param props - Array of prop names to verify presence on the element\n * @returns true if all props exist on element.props, false otherwise\n *\n * @internal
|
|
1
|
+
{"version":3,"sources":["../src/choreography/Stagger/utils/motionComponentDetection.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Checks if a React element has all of the specified props explicitly provided.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @param props - Array of prop names to verify presence on the element\n * @returns true if all props exist on element.props, false otherwise\n *\n * @internal\n */\n\n/**\n * Checks if a React element is a motion component created by createMotionComponent.\n * Motion components are detected by the presence of the MOTION_DEFINITION symbol on the component.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @returns true when the element's type contains the MOTION_DEFINITION symbol\n *\n * **Note:** This is a heuristic detection. Motion components may or may not support\n * specific props like `delay` or `visible` depending on their implementation.\n *\n * @internal\n */\nexport function isMotionComponent(element: React.ReactElement): boolean {\n if (!element?.type || typeof element.type !== 'function') {\n return false;\n }\n\n // Check if the component has the MOTION_DEFINITION symbol (internal to createMotionComponent)\n const symbols = Object.getOwnPropertySymbols(element.type);\n return symbols.some(sym => sym.description === 'MOTION_DEFINITION');\n}\n\n/**\n * Checks if a React element is a presence motion component by looking for the PRESENCE_MOTION_DEFINITION symbol.\n * This symbol is added internally by createPresenceComponent and provides reliable detection.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @returns true when the element's type contains the PRESENCE_MOTION_DEFINITION symbol\n *\n * **Presence components** (like Fade, Scale, Slide) are guaranteed to support both `visible` and `delay` props.\n *\n * @internal\n */\nexport function isPresenceComponent(element: React.ReactElement): boolean {\n if (!element?.type || typeof element.type !== 'function') {\n return false;\n }\n\n // Check if the component has the PRESENCE_MOTION_DEFINITION symbol (internal to createPresenceComponent)\n const symbols = Object.getOwnPropertySymbols(element.type);\n return symbols.some(sym => sym.description === 'PRESENCE_MOTION_DEFINITION');\n}\n\n/**\n * Checks if a React element accepts both `delay` and `exitDelay` props.\n * This uses a best-effort heuristic to detect components that support both delay props.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @returns true when the element likely supports both delay and exitDelay props\n *\n * **Auto-detection includes:**\n * - Presence components (Fade, Scale, etc.) - guaranteed to support both delay and exitDelay\n * - Motion components (.In/.Out variants, custom motion components) - may support both delay props\n * - Elements with explicit delay and exitDelay props already set\n *\n * **When to override:** If auto-detection is incorrect, use explicit `delayMode` prop on Stagger.\n * For example, custom motion components that don't support both props should use `delayMode=\"timing\"`.\n *\n * @internal\n */\nexport function acceptsDelayProps(element: React.ReactElement): boolean {\n return isPresenceComponent(element) || isMotionComponent(element);\n}\n\n/**\n * Checks if a React element accepts a `visible` prop.\n * This uses a best-effort heuristic to detect components that support visible props.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @returns true when the element likely supports a `visible` prop\n *\n * **Auto-detection includes:**\n * - Presence components (Fade, Scale, etc.) - guaranteed to support visible\n * - Elements with explicit visible props already set\n *\n * **When to override:** If auto-detection is incorrect, use explicit `hideMode` prop on Stagger.\n * For example, custom components that don't support visible should use `hideMode=\"visibilityStyle\"` or `hideMode=\"unmount\"`.\n *\n * @internal\n */\nexport function acceptsVisibleProp(element: React.ReactElement): boolean {\n return isPresenceComponent(element);\n}\n"],"names":["React","isMotionComponent","element","type","symbols","Object","getOwnPropertySymbols","some","sym","description","isPresenceComponent","acceptsDelayProps","acceptsVisibleProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B;;;;;;;;;;CAUC,GAED;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC,kBAAkBC,OAA2B;IAC3D,IAAI,EAACA,oBAAAA,8BAAAA,QAASC,IAAI,KAAI,OAAOD,QAAQC,IAAI,KAAK,YAAY;QACxD,OAAO;IACT;IAEA,8FAA8F;IAC9F,MAAMC,UAAUC,OAAOC,qBAAqB,CAACJ,QAAQC,IAAI;IACzD,OAAOC,QAAQG,IAAI,CAACC,CAAAA,MAAOA,IAAIC,WAAW,KAAK;AACjD;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,SAASC,oBAAoBR,OAA2B;IAC7D,IAAI,EAACA,oBAAAA,8BAAAA,QAASC,IAAI,KAAI,OAAOD,QAAQC,IAAI,KAAK,YAAY;QACxD,OAAO;IACT;IAEA,yGAAyG;IACzG,MAAMC,UAAUC,OAAOC,qBAAqB,CAACJ,QAAQC,IAAI;IACzD,OAAOC,QAAQG,IAAI,CAACC,CAAAA,MAAOA,IAAIC,WAAW,KAAK;AACjD;AAEA;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASE,kBAAkBT,OAA2B;IAC3D,OAAOQ,oBAAoBR,YAAYD,kBAAkBC;AAC3D;AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASU,mBAAmBV,OAA2B;IAC5D,OAAOQ,oBAAoBR;AAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/choreography/Stagger/utils/motionComponentDetection.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Checks if a React element has all of the specified props explicitly provided.\n *\n * @param element - React element to inspect\n * @param props - Array of prop names to verify presence on the element\n * @returns true if all props exist on element.props, false otherwise\n *\n * @internal
|
|
1
|
+
{"version":3,"sources":["../src/choreography/Stagger/utils/motionComponentDetection.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Checks if a React element has all of the specified props explicitly provided.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @param props - Array of prop names to verify presence on the element\n * @returns true if all props exist on element.props, false otherwise\n *\n * @internal\n */\n\n/**\n * Checks if a React element is a motion component created by createMotionComponent.\n * Motion components are detected by the presence of the MOTION_DEFINITION symbol on the component.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @returns true when the element's type contains the MOTION_DEFINITION symbol\n *\n * **Note:** This is a heuristic detection. Motion components may or may not support\n * specific props like `delay` or `visible` depending on their implementation.\n *\n * @internal\n */\nexport function isMotionComponent(element: React.ReactElement): boolean {\n if (!element?.type || typeof element.type !== 'function') {\n return false;\n }\n\n // Check if the component has the MOTION_DEFINITION symbol (internal to createMotionComponent)\n const symbols = Object.getOwnPropertySymbols(element.type);\n return symbols.some(sym => sym.description === 'MOTION_DEFINITION');\n}\n\n/**\n * Checks if a React element is a presence motion component by looking for the PRESENCE_MOTION_DEFINITION symbol.\n * This symbol is added internally by createPresenceComponent and provides reliable detection.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @returns true when the element's type contains the PRESENCE_MOTION_DEFINITION symbol\n *\n * **Presence components** (like Fade, Scale, Slide) are guaranteed to support both `visible` and `delay` props.\n *\n * @internal\n */\nexport function isPresenceComponent(element: React.ReactElement): boolean {\n if (!element?.type || typeof element.type !== 'function') {\n return false;\n }\n\n // Check if the component has the PRESENCE_MOTION_DEFINITION symbol (internal to createPresenceComponent)\n const symbols = Object.getOwnPropertySymbols(element.type);\n return symbols.some(sym => sym.description === 'PRESENCE_MOTION_DEFINITION');\n}\n\n/**\n * Checks if a React element accepts both `delay` and `exitDelay` props.\n * This uses a best-effort heuristic to detect components that support both delay props.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @returns true when the element likely supports both delay and exitDelay props\n *\n * **Auto-detection includes:**\n * - Presence components (Fade, Scale, etc.) - guaranteed to support both delay and exitDelay\n * - Motion components (.In/.Out variants, custom motion components) - may support both delay props\n * - Elements with explicit delay and exitDelay props already set\n *\n * **When to override:** If auto-detection is incorrect, use explicit `delayMode` prop on Stagger.\n * For example, custom motion components that don't support both props should use `delayMode=\"timing\"`.\n *\n * @internal\n */\nexport function acceptsDelayProps(element: React.ReactElement): boolean {\n return isPresenceComponent(element) || isMotionComponent(element);\n}\n\n/**\n * Checks if a React element accepts a `visible` prop.\n * This uses a best-effort heuristic to detect components that support visible props.\n *\n * - Exported for testing purposes\n *\n * @param element - React element to inspect\n * @returns true when the element likely supports a `visible` prop\n *\n * **Auto-detection includes:**\n * - Presence components (Fade, Scale, etc.) - guaranteed to support visible\n * - Elements with explicit visible props already set\n *\n * **When to override:** If auto-detection is incorrect, use explicit `hideMode` prop on Stagger.\n * For example, custom components that don't support visible should use `hideMode=\"visibilityStyle\"` or `hideMode=\"unmount\"`.\n *\n * @internal\n */\nexport function acceptsVisibleProp(element: React.ReactElement): boolean {\n return isPresenceComponent(element);\n}\n"],"names":["acceptsDelayProps","acceptsVisibleProp","isMotionComponent","isPresenceComponent","element","type","symbols","Object","getOwnPropertySymbols","some","sym","description"],"mappings":";;;;;;;;;;;IAgFgBA,iBAAiB;eAAjBA;;IAsBAC,kBAAkB;eAAlBA;;IA1EAC,iBAAiB;eAAjBA;;IAuBAC,mBAAmB;eAAnBA;;;;iEAnDO;AA4BhB,SAASD,kBAAkBE,OAA2B;IAC3D,IAAI,EAACA,oBAAAA,8BAAAA,QAASC,IAAI,KAAI,OAAOD,QAAQC,IAAI,KAAK,YAAY;QACxD,OAAO;IACT;IAEA,8FAA8F;IAC9F,MAAMC,UAAUC,OAAOC,qBAAqB,CAACJ,QAAQC,IAAI;IACzD,OAAOC,QAAQG,IAAI,CAACC,CAAAA,MAAOA,IAAIC,WAAW,KAAK;AACjD;AAeO,SAASR,oBAAoBC,OAA2B;IAC7D,IAAI,EAACA,oBAAAA,8BAAAA,QAASC,IAAI,KAAI,OAAOD,QAAQC,IAAI,KAAK,YAAY;QACxD,OAAO;IACT;IAEA,yGAAyG;IACzG,MAAMC,UAAUC,OAAOC,qBAAqB,CAACJ,QAAQC,IAAI;IACzD,OAAOC,QAAQG,IAAI,CAACC,CAAAA,MAAOA,IAAIC,WAAW,KAAK;AACjD;AAqBO,SAASX,kBAAkBI,OAA2B;IAC3D,OAAOD,oBAAoBC,YAAYF,kBAAkBE;AAC3D;AAoBO,SAASH,mBAAmBG,OAA2B;IAC5D,OAAOD,oBAAoBC;AAC7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-motion-components-preview",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "A preview package for Fluent UI motion components, providing a collection of components",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|