@fluentui/react-utilities 0.0.0-nightly-20230317-0436.1 → 0.0.0-nightly-20230317-1454.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/.swcrc +39 -0
  2. package/CHANGELOG.json +5 -5
  3. package/CHANGELOG.md +5 -5
  4. package/lib/compose/getSlots.js +6 -7
  5. package/lib/compose/getSlots.js.map +1 -1
  6. package/lib/compose/index.js +4 -4
  7. package/lib/compose/index.js.map +1 -1
  8. package/lib/compose/isResolvedShorthand.js +2 -2
  9. package/lib/compose/isResolvedShorthand.js.map +1 -1
  10. package/lib/compose/resolveShorthand.js +3 -3
  11. package/lib/compose/resolveShorthand.js.map +1 -1
  12. package/lib/compose/types.js +1 -1
  13. package/lib/compose/types.js.map +1 -1
  14. package/lib/events/index.js +1 -1
  15. package/lib/events/index.js.map +1 -1
  16. package/lib/events/mouseTouchHelpers.js +5 -4
  17. package/lib/events/mouseTouchHelpers.js.map +1 -1
  18. package/lib/hooks/index.js +12 -12
  19. package/lib/hooks/index.js.map +1 -1
  20. package/lib/hooks/useControllableState.js +7 -7
  21. package/lib/hooks/useControllableState.js.map +1 -1
  22. package/lib/hooks/useEventCallback.js +3 -3
  23. package/lib/hooks/useEventCallback.js.map +1 -1
  24. package/lib/hooks/useFirstMount.js +1 -1
  25. package/lib/hooks/useFirstMount.js.map +1 -1
  26. package/lib/hooks/useForceUpdate.js +1 -1
  27. package/lib/hooks/useForceUpdate.js.map +1 -1
  28. package/lib/hooks/useId.js +6 -6
  29. package/lib/hooks/useId.js.map +1 -1
  30. package/lib/hooks/useIsomorphicLayoutEffect.js +3 -4
  31. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  32. package/lib/hooks/useMergedRefs.js +2 -2
  33. package/lib/hooks/useMergedRefs.js.map +1 -1
  34. package/lib/hooks/useOnClickOutside.js +20 -23
  35. package/lib/hooks/useOnClickOutside.js.map +1 -1
  36. package/lib/hooks/useOnScrollOutside.js +7 -7
  37. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  38. package/lib/hooks/usePrevious.js +1 -1
  39. package/lib/hooks/usePrevious.js.map +1 -1
  40. package/lib/hooks/useScrollbarWidth.js +5 -5
  41. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  42. package/lib/hooks/useTimeout.js +1 -1
  43. package/lib/hooks/useTimeout.js.map +1 -1
  44. package/lib/index.js +6 -6
  45. package/lib/index.js.map +1 -1
  46. package/lib/ssr/SSRContext.js +5 -6
  47. package/lib/ssr/SSRContext.js.map +1 -1
  48. package/lib/ssr/canUseDOM.js +2 -3
  49. package/lib/ssr/canUseDOM.js.map +1 -1
  50. package/lib/ssr/index.js +2 -2
  51. package/lib/ssr/index.js.map +1 -1
  52. package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
  53. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  54. package/lib/trigger/getTriggerChild.js +2 -2
  55. package/lib/trigger/getTriggerChild.js.map +1 -1
  56. package/lib/trigger/index.js +4 -4
  57. package/lib/trigger/index.js.map +1 -1
  58. package/lib/trigger/isFluentTrigger.js +1 -0
  59. package/lib/trigger/isFluentTrigger.js.map +1 -1
  60. package/lib/trigger/types.js +1 -1
  61. package/lib/trigger/types.js.map +1 -1
  62. package/lib/utils/clamp.js +1 -2
  63. package/lib/utils/clamp.js.map +1 -1
  64. package/lib/utils/getNativeElementProps.js +4 -4
  65. package/lib/utils/getNativeElementProps.js.map +1 -1
  66. package/lib/utils/getRTLSafeKey.js +6 -7
  67. package/lib/utils/getRTLSafeKey.js.map +1 -1
  68. package/lib/utils/getReactCallbackName.js +3 -2
  69. package/lib/utils/getReactCallbackName.js.map +1 -1
  70. package/lib/utils/index.js +8 -8
  71. package/lib/utils/index.js.map +1 -1
  72. package/lib/utils/isHTMLElement.js +2 -4
  73. package/lib/utils/isHTMLElement.js.map +1 -1
  74. package/lib/utils/isInteractiveHTMLElement.js +5 -5
  75. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  76. package/lib/utils/mergeCallbacks.js +3 -4
  77. package/lib/utils/mergeCallbacks.js.map +1 -1
  78. package/lib/utils/omit.js +1 -2
  79. package/lib/utils/omit.js.map +1 -1
  80. package/lib/utils/properties.js +28 -55
  81. package/lib/utils/properties.js.map +1 -1
  82. package/lib-commonjs/compose/getSlots.js +47 -55
  83. package/lib-commonjs/compose/getSlots.js.map +1 -1
  84. package/lib-commonjs/compose/index.js +8 -7
  85. package/lib-commonjs/compose/index.js.map +1 -1
  86. package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
  87. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  88. package/lib-commonjs/compose/resolveShorthand.js +25 -32
  89. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  90. package/lib-commonjs/compose/types.js +5 -2
  91. package/lib-commonjs/compose/types.js.map +1 -1
  92. package/lib-commonjs/events/index.js +5 -4
  93. package/lib-commonjs/events/index.js.map +1 -1
  94. package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
  95. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  96. package/lib-commonjs/hooks/index.js +16 -15
  97. package/lib-commonjs/hooks/index.js.map +1 -1
  98. package/lib-commonjs/hooks/useControllableState.js +63 -64
  99. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  100. package/lib-commonjs/hooks/useEventCallback.js +25 -31
  101. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  102. package/lib-commonjs/hooks/useFirstMount.js +15 -23
  103. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  104. package/lib-commonjs/hooks/useForceUpdate.js +9 -11
  105. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  106. package/lib-commonjs/hooks/useId.js +48 -47
  107. package/lib-commonjs/hooks/useId.js.map +1 -1
  108. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
  109. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  110. package/lib-commonjs/hooks/useMergedRefs.js +25 -27
  111. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  112. package/lib-commonjs/hooks/useOnClickOutside.js +109 -115
  113. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  114. package/lib-commonjs/hooks/useOnScrollOutside.js +33 -36
  115. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  116. package/lib-commonjs/hooks/usePrevious.js +17 -15
  117. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  118. package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
  119. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  120. package/lib-commonjs/hooks/useTimeout.js +30 -30
  121. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  122. package/lib-commonjs/index.js +52 -214
  123. package/lib-commonjs/index.js.map +1 -1
  124. package/lib-commonjs/ssr/SSRContext.js +56 -59
  125. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  126. package/lib-commonjs/ssr/canUseDOM.js +12 -12
  127. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  128. package/lib-commonjs/ssr/index.js +6 -5
  129. package/lib-commonjs/ssr/index.js.map +1 -1
  130. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
  131. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  132. package/lib-commonjs/trigger/getTriggerChild.js +16 -36
  133. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  134. package/lib-commonjs/trigger/index.js +8 -7
  135. package/lib-commonjs/trigger/index.js.map +1 -1
  136. package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
  137. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  138. package/lib-commonjs/trigger/types.js +5 -2
  139. package/lib-commonjs/trigger/types.js.map +1 -1
  140. package/lib-commonjs/utils/clamp.js +10 -9
  141. package/lib-commonjs/utils/clamp.js.map +1 -1
  142. package/lib-commonjs/utils/getNativeElementProps.js +54 -61
  143. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  144. package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
  145. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  146. package/lib-commonjs/utils/getReactCallbackName.js +24 -24
  147. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  148. package/lib-commonjs/utils/index.js +12 -11
  149. package/lib-commonjs/utils/index.js.map +1 -1
  150. package/lib-commonjs/utils/isHTMLElement.js +12 -12
  151. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  152. package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
  153. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  154. package/lib-commonjs/utils/mergeCallbacks.js +14 -13
  155. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  156. package/lib-commonjs/utils/omit.js +18 -17
  157. package/lib-commonjs/utils/omit.js.map +1 -1
  158. package/lib-commonjs/utils/properties.js +327 -223
  159. package/lib-commonjs/utils/properties.js.map +1 -1
  160. package/package.json +4 -4
@@ -1,35 +1,35 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useTimeout", {
6
+ enumerable: true,
7
+ get: ()=>useTimeout
5
8
  });
6
- exports.useTimeout = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- /**
9
- * @internal
10
- * Helper to manage a browser timeout.
11
- * Ensures that the timeout isn't set multiple times at once,
12
- * and is cleaned up when the component is unloaded.
13
- *
14
- * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.
15
- */
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
16
11
  function useTimeout() {
17
- const [timeout] = React.useState(() => ({
18
- id: undefined,
19
- set: (fn, delay) => {
20
- timeout.clear();
21
- timeout.id = setTimeout(fn, delay);
22
- },
23
- clear: () => {
24
- if (timeout.id !== undefined) {
25
- clearTimeout(timeout.id);
26
- timeout.id = undefined;
27
- }
28
- }
29
- }));
30
- // Clean up the timeout when the component is unloaded
31
- React.useEffect(() => timeout.clear, [timeout]);
32
- return [timeout.set, timeout.clear];
33
- }
34
- exports.useTimeout = useTimeout;
12
+ const [timeout] = _react.useState(()=>({
13
+ id: undefined,
14
+ set: (fn, delay)=>{
15
+ timeout.clear();
16
+ timeout.id = setTimeout(fn, delay);
17
+ },
18
+ clear: ()=>{
19
+ if (timeout.id !== undefined) {
20
+ clearTimeout(timeout.id);
21
+ timeout.id = undefined;
22
+ }
23
+ }
24
+ }));
25
+ // Clean up the timeout when the component is unloaded
26
+ _react.useEffect(()=>timeout.clear, [
27
+ timeout
28
+ ]);
29
+ return [
30
+ timeout.set,
31
+ timeout.clear
32
+ ];
33
+ } //# sourceMappingURL=useTimeout.js.map
34
+
35
35
  //# sourceMappingURL=useTimeout.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","useTimeout","timeout","useState","id","undefined","set","fn","delay","clear","setTimeout","clearTimeout","useEffect","exports"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useTimeout.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const [timeout] = React.useState(() => ({\n id: undefined as ReturnType<typeof setTimeout> | undefined,\n set: (fn: () => void, delay: number) => {\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: () => {\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n },\n }));\n\n // Clean up the timeout when the component is unloaded\n React.useEffect(() => timeout.clear, [timeout]);\n\n return [timeout.set, timeout.clear] as const;\n}\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AAEA;;;;;;;;AAQA,SAAgBC,UAAUA,CAAA;EACxB,MAAM,CAACC,OAAO,CAAC,GAAGH,KAAK,CAACI,QAAQ,CAAC,OAAO;IACtCC,EAAE,EAAEC,SAAsD;IAC1DC,GAAG,EAAEA,CAACC,EAAc,EAAEC,KAAa,KAAI;MACrCN,OAAO,CAACO,KAAK,EAAE;MACfP,OAAO,CAACE,EAAE,GAAGM,UAAU,CAACH,EAAE,EAAEC,KAAK,CAAC;IACpC,CAAC;IACDC,KAAK,EAAEA,CAAA,KAAK;MACV,IAAIP,OAAO,CAACE,EAAE,KAAKC,SAAS,EAAE;QAC5BM,YAAY,CAACT,OAAO,CAACE,EAAE,CAAC;QACxBF,OAAO,CAACE,EAAE,GAAGC,SAAS;;IAE1B;GACD,CAAC,CAAC;EAEH;EACAN,KAAK,CAACa,SAAS,CAAC,MAAMV,OAAO,CAACO,KAAK,EAAE,CAACP,OAAO,CAAC,CAAC;EAE/C,OAAO,CAACA,OAAO,CAACI,GAAG,EAAEJ,OAAO,CAACO,KAAK,CAAU;AAC9C;AAnBAI,OAAA,CAAAZ,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"sources":["../../lib/hooks/useTimeout.js"],"sourcesContent":["import * as React from \"react\";\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const [timeout] = React.useState(() => ({\n id: undefined,\n set: (fn, delay) => {\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: () => {\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n }\n }));\n // Clean up the timeout when the component is unloaded\n React.useEffect(() => timeout.clear, [timeout]);\n return [timeout.set, timeout.clear];\n}\n//# sourceMappingURL=useTimeout.js.map"],"names":["useTimeout","timeout","React","useState","id","undefined","set","fn","delay","clear","setTimeout","clearTimeout","useEffect"],"mappings":";;;;+BASgBA;;aAAAA;;;6DATO;AAShB,SAASA,aAAa;IAC3B,MAAM,CAACC,QAAQ,GAAGC,OAAMC,QAAQ,CAAC,IAAO,CAAA;YACtCC,IAAIC;YACJC,KAAK,CAACC,IAAIC,QAAU;gBAClBP,QAAQQ,KAAK;gBACbR,QAAQG,EAAE,GAAGM,WAAWH,IAAIC;YAC9B;YACAC,OAAO,IAAM;gBACX,IAAIR,QAAQG,EAAE,KAAKC,WAAW;oBAC5BM,aAAaV,QAAQG,EAAE;oBACvBH,QAAQG,EAAE,GAAGC;gBACf,CAAC;YACH;QACF,CAAA;IACA,sDAAsD;IACtDH,OAAMU,SAAS,CAAC,IAAMX,QAAQQ,KAAK,EAAE;QAACR;KAAQ;IAC9C,OAAO;QAACA,QAAQK,GAAG;QAAEL,QAAQQ,KAAK;KAAC;AACrC,EACA,sCAAsC"}
@@ -1,217 +1,55 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getEventClientCoords = exports.isMouseEvent = exports.isTouchEvent = exports.isFluentTrigger = exports.getTriggerChild = exports.applyTriggerPropsToChildren = exports.omit = exports.isInteractiveHTMLElement = exports.isHTMLElement = exports.mergeCallbacks = exports.getRTLSafeKey = exports.getPartitionedNativeProps = exports.getNativeElementProps = exports.clamp = exports.SSRProvider = exports.useIsSSR = exports.canUseDOM = exports.useTimeout = exports.useScrollbarWidth = exports.usePrevious = exports.useOnScrollOutside = exports.useOnClickOutside = exports.useMergedRefs = exports.useIsomorphicLayoutEffect = exports.useId = exports.useForceUpdate = exports.useFirstMount = exports.useEventCallback = exports.useControllableState = exports.resetIdsForTests = exports.IdPrefixProvider = exports.isResolvedShorthand = exports.resolveShorthand = exports.getSlots = void 0;
7
- var index_1 = /*#__PURE__*/require("./compose/index");
8
- Object.defineProperty(exports, "getSlots", {
9
- enumerable: true,
10
- get: function () {
11
- return index_1.getSlots;
12
- }
13
- });
14
- Object.defineProperty(exports, "resolveShorthand", {
15
- enumerable: true,
16
- get: function () {
17
- return index_1.resolveShorthand;
18
- }
19
- });
20
- Object.defineProperty(exports, "isResolvedShorthand", {
21
- enumerable: true,
22
- get: function () {
23
- return index_1.isResolvedShorthand;
24
- }
25
- });
26
- var index_2 = /*#__PURE__*/require("./hooks/index");
27
- Object.defineProperty(exports, "IdPrefixProvider", {
28
- enumerable: true,
29
- get: function () {
30
- return index_2.IdPrefixProvider;
31
- }
32
- });
33
- Object.defineProperty(exports, "resetIdsForTests", {
34
- enumerable: true,
35
- get: function () {
36
- return index_2.resetIdsForTests;
37
- }
38
- });
39
- Object.defineProperty(exports, "useControllableState", {
40
- enumerable: true,
41
- get: function () {
42
- return index_2.useControllableState;
43
- }
44
- });
45
- Object.defineProperty(exports, "useEventCallback", {
46
- enumerable: true,
47
- get: function () {
48
- return index_2.useEventCallback;
49
- }
50
- });
51
- Object.defineProperty(exports, "useFirstMount", {
52
- enumerable: true,
53
- get: function () {
54
- return index_2.useFirstMount;
55
- }
56
- });
57
- Object.defineProperty(exports, "useForceUpdate", {
58
- enumerable: true,
59
- get: function () {
60
- return index_2.useForceUpdate;
61
- }
62
- });
63
- Object.defineProperty(exports, "useId", {
64
- enumerable: true,
65
- get: function () {
66
- return index_2.useId;
67
- }
68
- });
69
- Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
70
- enumerable: true,
71
- get: function () {
72
- return index_2.useIsomorphicLayoutEffect;
73
- }
74
- });
75
- Object.defineProperty(exports, "useMergedRefs", {
76
- enumerable: true,
77
- get: function () {
78
- return index_2.useMergedRefs;
79
- }
80
- });
81
- Object.defineProperty(exports, "useOnClickOutside", {
82
- enumerable: true,
83
- get: function () {
84
- return index_2.useOnClickOutside;
85
- }
86
- });
87
- Object.defineProperty(exports, "useOnScrollOutside", {
88
- enumerable: true,
89
- get: function () {
90
- return index_2.useOnScrollOutside;
91
- }
92
- });
93
- Object.defineProperty(exports, "usePrevious", {
94
- enumerable: true,
95
- get: function () {
96
- return index_2.usePrevious;
97
- }
98
- });
99
- Object.defineProperty(exports, "useScrollbarWidth", {
100
- enumerable: true,
101
- get: function () {
102
- return index_2.useScrollbarWidth;
103
- }
104
- });
105
- Object.defineProperty(exports, "useTimeout", {
106
- enumerable: true,
107
- get: function () {
108
- return index_2.useTimeout;
109
- }
110
- });
111
- var index_3 = /*#__PURE__*/require("./ssr/index");
112
- Object.defineProperty(exports, "canUseDOM", {
113
- enumerable: true,
114
- get: function () {
115
- return index_3.canUseDOM;
116
- }
117
- });
118
- Object.defineProperty(exports, "useIsSSR", {
119
- enumerable: true,
120
- get: function () {
121
- return index_3.useIsSSR;
122
- }
123
- });
124
- Object.defineProperty(exports, "SSRProvider", {
125
- enumerable: true,
126
- get: function () {
127
- return index_3.SSRProvider;
128
- }
129
- });
130
- var index_4 = /*#__PURE__*/require("./utils/index");
131
- Object.defineProperty(exports, "clamp", {
132
- enumerable: true,
133
- get: function () {
134
- return index_4.clamp;
135
- }
136
- });
137
- Object.defineProperty(exports, "getNativeElementProps", {
138
- enumerable: true,
139
- get: function () {
140
- return index_4.getNativeElementProps;
141
- }
142
- });
143
- Object.defineProperty(exports, "getPartitionedNativeProps", {
144
- enumerable: true,
145
- get: function () {
146
- return index_4.getPartitionedNativeProps;
147
- }
148
- });
149
- Object.defineProperty(exports, "getRTLSafeKey", {
150
- enumerable: true,
151
- get: function () {
152
- return index_4.getRTLSafeKey;
153
- }
154
- });
155
- Object.defineProperty(exports, "mergeCallbacks", {
156
- enumerable: true,
157
- get: function () {
158
- return index_4.mergeCallbacks;
159
- }
160
- });
161
- Object.defineProperty(exports, "isHTMLElement", {
162
- enumerable: true,
163
- get: function () {
164
- return index_4.isHTMLElement;
165
- }
166
- });
167
- Object.defineProperty(exports, "isInteractiveHTMLElement", {
168
- enumerable: true,
169
- get: function () {
170
- return index_4.isInteractiveHTMLElement;
171
- }
172
- });
173
- Object.defineProperty(exports, "omit", {
174
- enumerable: true,
175
- get: function () {
176
- return index_4.omit;
177
- }
178
- });
179
- var index_5 = /*#__PURE__*/require("./trigger/index");
180
- Object.defineProperty(exports, "applyTriggerPropsToChildren", {
181
- enumerable: true,
182
- get: function () {
183
- return index_5.applyTriggerPropsToChildren;
184
- }
185
- });
186
- Object.defineProperty(exports, "getTriggerChild", {
187
- enumerable: true,
188
- get: function () {
189
- return index_5.getTriggerChild;
190
- }
191
- });
192
- Object.defineProperty(exports, "isFluentTrigger", {
193
- enumerable: true,
194
- get: function () {
195
- return index_5.isFluentTrigger;
196
- }
197
- });
198
- var index_6 = /*#__PURE__*/require("./events/index");
199
- Object.defineProperty(exports, "isTouchEvent", {
200
- enumerable: true,
201
- get: function () {
202
- return index_6.isTouchEvent;
203
- }
204
- });
205
- Object.defineProperty(exports, "isMouseEvent", {
206
- enumerable: true,
207
- get: function () {
208
- return index_6.isMouseEvent;
209
- }
210
- });
211
- Object.defineProperty(exports, "getEventClientCoords", {
212
- enumerable: true,
213
- get: function () {
214
- return index_6.getEventClientCoords;
215
- }
216
- });
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ getSlots: ()=>_index.getSlots,
13
+ resolveShorthand: ()=>_index.resolveShorthand,
14
+ isResolvedShorthand: ()=>_index.isResolvedShorthand,
15
+ IdPrefixProvider: ()=>_index1.IdPrefixProvider,
16
+ resetIdsForTests: ()=>_index1.resetIdsForTests,
17
+ useControllableState: ()=>_index1.useControllableState,
18
+ useEventCallback: ()=>_index1.useEventCallback,
19
+ useFirstMount: ()=>_index1.useFirstMount,
20
+ useForceUpdate: ()=>_index1.useForceUpdate,
21
+ useId: ()=>_index1.useId,
22
+ useIsomorphicLayoutEffect: ()=>_index1.useIsomorphicLayoutEffect,
23
+ useMergedRefs: ()=>_index1.useMergedRefs,
24
+ useOnClickOutside: ()=>_index1.useOnClickOutside,
25
+ useOnScrollOutside: ()=>_index1.useOnScrollOutside,
26
+ usePrevious: ()=>_index1.usePrevious,
27
+ useScrollbarWidth: ()=>_index1.useScrollbarWidth,
28
+ useTimeout: ()=>_index1.useTimeout,
29
+ canUseDOM: ()=>_index2.canUseDOM,
30
+ useIsSSR: ()=>_index2.useIsSSR,
31
+ SSRProvider: ()=>_index2.SSRProvider,
32
+ clamp: ()=>_index3.clamp,
33
+ getNativeElementProps: ()=>_index3.getNativeElementProps,
34
+ getPartitionedNativeProps: ()=>_index3.getPartitionedNativeProps,
35
+ getRTLSafeKey: ()=>_index3.getRTLSafeKey,
36
+ mergeCallbacks: ()=>_index3.mergeCallbacks,
37
+ isHTMLElement: ()=>_index3.isHTMLElement,
38
+ isInteractiveHTMLElement: ()=>_index3.isInteractiveHTMLElement,
39
+ omit: ()=>_index3.omit,
40
+ applyTriggerPropsToChildren: ()=>_index4.applyTriggerPropsToChildren,
41
+ getTriggerChild: ()=>_index4.getTriggerChild,
42
+ isFluentTrigger: ()=>_index4.isFluentTrigger,
43
+ isTouchEvent: ()=>_index5.isTouchEvent,
44
+ isMouseEvent: ()=>_index5.isMouseEvent,
45
+ getEventClientCoords: ()=>_index5.getEventClientCoords
46
+ });
47
+ const _index = require("./compose/index");
48
+ const _index1 = require("./hooks/index");
49
+ const _index2 = require("./ssr/index");
50
+ const _index3 = require("./utils/index");
51
+ const _index4 = require("./trigger/index");
52
+ const _index5 = require("./events/index");
53
+ //# sourceMappingURL=index.js.map
54
+
217
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["index_1","require","Object","defineProperty","exports","enumerable","get","getSlots","resolveShorthand","isResolvedShorthand","index_2","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","index_3","canUseDOM","useIsSSR","SSRProvider","index_4","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","index_5","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","index_6","isTouchEvent","isMouseEvent","getEventClientCoords"],"sources":["../../../../../../../packages/react-components/react-utilities/src/index.ts"],"sourcesContent":["export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,gBAAAC,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,OAAA,CAAAO,QAAQ;EAAA;AAAA;AAAEL,MAAA,CAAAC,c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A;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAgC,OAAA,CAAAE,eAAe;EAAA;AAAA;AAAEtC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAgC,OAAA,CAAAG,eAAe;EAAA;AAAA;AAQtE,IAAAC,OAAA,gBAAAzC,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAoC,OAAA,CAAAC,YAAY;EAAA;AAAA;AAAEzC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAoC,OAAA,CAAAE,YAAY;EAAA;AAAA;AAAE1C,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAoC,OAAA,CAAAG,oBAAoB;EAAA;AAAA"}
1
+ {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { getSlots, resolveShorthand, isResolvedShorthand } from \"./compose/index\";\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from \"./hooks/index\";\nexport { canUseDOM, useIsSSR, SSRProvider } from \"./ssr/index\";\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit } from \"./utils/index\";\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from \"./trigger/index\";\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from \"./events/index\";\n//# sourceMappingURL=index.js.map"],"names":["getSlots","resolveShorthand","isResolvedShorthand","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"mappings":";;;;;;;;;;;IAASA,QAAQ,MAARA,eAAQ;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mBAAmB,MAAnBA,0BAAmB;IAC/CC,gBAAgB,MAAhBA,wBAAgB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,oBAAoB,MAApBA,4BAAoB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,KAAK,MAALA,aAAK;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,kBAAkB,MAAlBA,0BAAkB;IAAEC,WAAW,MAAXA,mBAAW;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,UAAU,MAAVA,kBAAU;IAC7OC,SAAS,MAATA,iBAAS;IAAEC,QAAQ,MAARA,gBAAQ;IAAEC,WAAW,MAAXA,mBAAW;IAChCC,KAAK,MAALA,aAAK;IAAEC,qBAAqB,MAArBA,6BAAqB;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,wBAAwB,MAAxBA,gCAAwB;IAAEC,IAAI,MAAJA,YAAI;IACrIC,2BAA2B,MAA3BA,mCAA2B;IAAEC,eAAe,MAAfA,uBAAe;IAAEC,eAAe,MAAfA,uBAAe;IAC7DC,YAAY,MAAZA,oBAAY;IAAEC,YAAY,MAAZA,oBAAY;IAAEC,oBAAoB,MAApBA,4BAAoB;;uBALO;wBAC8L;wBAC7M;wBACqG;wBACxE;wBACb;CACjE,iCAAiC"}
@@ -1,69 +1,66 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ defaultSSRContextValue: ()=>defaultSSRContextValue,
13
+ SSRContext: ()=>SSRContext,
14
+ useSSRContext: ()=>useSSRContext,
15
+ SSRProvider: ()=>SSRProvider,
16
+ useIsSSR: ()=>useIsSSR
5
17
  });
6
- exports.useIsSSR = exports.SSRProvider = exports.useSSRContext = exports.SSRContext = exports.defaultSSRContextValue = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const canUseDOM_1 = /*#__PURE__*/require("./canUseDOM");
9
- /**
10
- * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.
11
- *
12
- * @internal
13
- */
14
- exports.defaultSSRContextValue = {
15
- current: 0
18
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
19
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
20
+ const _canUseDOM = require("./canUseDOM");
21
+ const defaultSSRContextValue = {
22
+ current: 0
16
23
  };
17
- exports.SSRContext = /*#__PURE__*/React.createContext(undefined);
18
- /**
19
- * @internal
20
- */
24
+ const SSRContext = /*#__PURE__*/ _react.createContext(undefined);
21
25
  function useSSRContext() {
22
- var _a;
23
- return (_a = React.useContext(exports.SSRContext)) !== null && _a !== void 0 ? _a : exports.defaultSSRContextValue;
26
+ return _react.useContext(SSRContext) ?? defaultSSRContextValue;
24
27
  }
25
- exports.useSSRContext = useSSRContext;
26
- /**
27
- * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids
28
- * are consistent between the client and server.
29
- *
30
- * @public
31
- */
32
- const SSRProvider = props => {
33
- const [value] = React.useState(() => ({
34
- current: 0
35
- }));
36
- return React.createElement(exports.SSRContext.Provider, {
37
- value: value
38
- }, props.children);
28
+ const SSRProvider = (props)=>{
29
+ const [value] = _react.useState(()=>({
30
+ current: 0
31
+ }));
32
+ return /*#__PURE__*/ _react.createElement(SSRContext.Provider, {
33
+ value: value
34
+ }, props.children);
39
35
  };
40
- exports.SSRProvider = SSRProvider;
41
- /**
42
- * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay
43
- * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.
44
- */
45
36
  function useIsSSR() {
46
- const isInSSRContext = useSSRContext() !== exports.defaultSSRContextValue;
47
- const [isSSR, setIsSSR] = React.useState(isInSSRContext);
48
- // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
49
- // developer to add one.
50
- if (process.env.NODE_ENV !== 'production') {
51
- if (!isInSSRContext && !canUseDOM_1.canUseDOM()) {
52
- // eslint-disable-next-line no-console
53
- console.error(['@fluentui/react-components: ', 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.', '\n', '\n', 'Check documentation at https://aka.ms/fluentui-ssr'].join(''));
37
+ const isInSSRContext = useSSRContext() !== defaultSSRContextValue;
38
+ const [isSSR, setIsSSR] = _react.useState(isInSSRContext);
39
+ // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
40
+ // developer to add one.
41
+ if (process.env.NODE_ENV !== "production") {
42
+ if (!isInSSRContext && !(0, _canUseDOM.canUseDOM)()) {
43
+ // eslint-disable-next-line no-console
44
+ console.error([
45
+ "@fluentui/react-components: ",
46
+ "When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are " + "generated between the client and server.",
47
+ "\n",
48
+ "\n",
49
+ "Check documentation at https://aka.ms/fluentui-ssr"
50
+ ].join(""));
51
+ }
54
52
  }
55
- }
56
- // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
57
- // component after hydration.
58
- if (canUseDOM_1.canUseDOM() && isInSSRContext) {
59
- // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
60
- // mounting.
61
- // eslint-disable-next-line
62
- React.useLayoutEffect(() => {
63
- setIsSSR(false);
64
- }, []);
65
- }
66
- return isSSR;
67
- }
68
- exports.useIsSSR = useIsSSR;
53
+ // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
54
+ // component after hydration.
55
+ if ((0, _canUseDOM.canUseDOM)() && isInSSRContext) {
56
+ // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
57
+ // mounting.
58
+ // eslint-disable-next-line
59
+ _react.useLayoutEffect(()=>{
60
+ setIsSSR(false);
61
+ }, []);
62
+ }
63
+ return isSSR;
64
+ } //# sourceMappingURL=SSRContext.js.map
65
+
69
66
  //# sourceMappingURL=SSRContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","canUseDOM_1","exports","defaultSSRContextValue","current","SSRContext","createContext","undefined","useSSRContext","_a","useContext","SSRProvider","props","value","useState","createElement","Provider","children","useIsSSR","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","join","useLayoutEffect"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/ssr/SSRContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue | undefined>(undefined) as React.Context<SSRContextValue>;\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext) ?? defaultSSRContextValue;\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC<{ children: React.ReactNode }> = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(\n [\n '@fluentui/react-components: ',\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' +\n 'generated between the client and server.',\n '\\n',\n '\\n',\n 'Check documentation at https://aka.ms/fluentui-ssr',\n ].join(''),\n );\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,WAAA,gBAAAD,OAAA;AAYA;;;;;AAKaE,OAAA,CAAAC,sBAAsB,GAAoB;EACrDC,OAAO,EAAE;CACV;AAEYF,OAAA,CAAAG,UAAU,gBAAGN,KAAK,CAACO,aAAa,CAA8BC,SAAS,CAAmC;AAEvH;;;AAGA,SAAgBC,aAAaA,CAAA;;EAC3B,OAAO,CAAAC,EAAA,GAAAV,KAAK,CAACW,UAAU,CAACR,OAAA,CAAAG,UAAU,CAAC,cAAAI,EAAA,cAAAA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sourcesContent":["import * as React from \"react\";\nimport { canUseDOM } from \"./canUseDOM\";\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue = {\n current: 0\n};\nexport const SSRContext = /*#__PURE__*/React.createContext(undefined);\n/**\n * @internal\n */\nexport function useSSRContext() {\n return React.useContext(SSRContext) ?? defaultSSRContextValue;\n}\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider = props => {\n const [value] = React.useState(() => ({\n current: 0\n }));\n return /*#__PURE__*/React.createElement(SSRContext.Provider, {\n value: value\n }, props.children);\n};\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR() {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== \"production\") {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error([\"@fluentui/react-components: \", \"When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are \" + \"generated between the client and server.\", \"\\n\", \"\\n\", \"Check documentation at https://aka.ms/fluentui-ssr\"].join(\"\"));\n }\n }\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n return isSSR;\n}\n//# sourceMappingURL=SSRContext.js.map"],"names":["defaultSSRContextValue","SSRContext","useSSRContext","SSRProvider","useIsSSR","current","React","createContext","undefined","useContext","props","value","useState","createElement","Provider","children","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","join","useLayoutEffect"],"mappings":";;;;;;;;;;;IAOaA,sBAAsB,MAAtBA;IAGAC,UAAU,MAAVA;IAIGC,aAAa,MAAbA;IASHC,WAAW,MAAXA;IAYGC,QAAQ,MAARA;;;6DAnCO;2BACG;AAMnB,MAAMJ,yBAAyB;IACpCK,SAAS;AACX;AACO,MAAMJ,aAAa,WAAW,GAAEK,OAAMC,aAAa,CAACC;AAIpD,SAASN,gBAAgB;IAC9B,OAAOI,OAAMG,UAAU,CAACR,eAAeD;AACzC;AAOO,MAAMG,cAAcO,CAAAA,QAAS;IAClC,MAAM,CAACC,MAAM,GAAGL,OAAMM,QAAQ,CAAC,IAAO,CAAA;YACpCP,SAAS;QACX,CAAA;IACA,OAAO,WAAW,GAAEC,OAAMO,aAAa,CAACZ,WAAWa,QAAQ,EAAE;QAC3DH,OAAOA;IACT,GAAGD,MAAMK,QAAQ;AACnB;AAKO,SAASX,WAAW;IACzB,MAAMY,iBAAiBd,oBAAoBF;IAC3C,MAAM,CAACiB,OAAOC,SAAS,GAAGZ,OAAMM,QAAQ,CAACI;IACzC,6GAA6G;IAC7G,wBAAwB;IACxB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,CAACL,kBAAkB,CAACM,IAAAA,oBAAS,KAAI;YACnC,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;gBAAC;gBAAgC,4GAA4G;gBAA4C;gBAAM;gBAAM;aAAqD,CAACC,IAAI,CAAC;QAChR,CAAC;IACH,CAAC;IACD,iHAAiH;IACjH,6BAA6B;IAC7B,IAAIH,IAAAA,oBAAS,OAAMN,gBAAgB;QACjC,iHAAiH;QACjH,YAAY;QACZ,2BAA2B;QAC3BV,OAAMoB,eAAe,CAAC,IAAM;YAC1BR,SAAS,KAAK;QAChB,GAAG,EAAE;IACP,CAAC;IACD,OAAOD;AACT,EACA,sCAAsC"}
@@ -1,16 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.canUseDOM = void 0;
7
1
  /**
8
2
  * Verifies if an application can use DOM.
9
- */
3
+ */ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "canUseDOM", {
8
+ enumerable: true,
9
+ get: ()=>canUseDOM
10
+ });
10
11
  function canUseDOM() {
11
- return typeof window !== 'undefined' && !!(window.document &&
12
- // eslint-disable-next-line deprecation/deprecation
13
- window.document.createElement);
14
- }
15
- exports.canUseDOM = canUseDOM;
12
+ return typeof window !== "undefined" && !!(window.document && // eslint-disable-next-line deprecation/deprecation
13
+ window.document.createElement);
14
+ } //# sourceMappingURL=canUseDOM.js.map
15
+
16
16
  //# sourceMappingURL=canUseDOM.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["canUseDOM","window","document","createElement","exports"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/ssr/canUseDOM.ts"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n typeof window !== 'undefined' &&\n !!(\n window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement\n )\n );\n}\n"],"mappings":";;;;;;AAAA;;;AAGA,SAAgBA,SAASA,CAAA;EACvB,OACE,OAAOC,MAAM,KAAK,WAAW,IAC7B,CAAC,EACCA,MAAM,CAACC,QAAQ;EACf;EACAD,MAAM,CAACC,QAAQ,CAACC,aAAa,CAC9B;AAEL;AATAC,OAAA,CAAAJ,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"sources":["../../lib/ssr/canUseDOM.js"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */export function canUseDOM() {\n return typeof window !== \"undefined\" && !!(window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement);\n}\n//# sourceMappingURL=canUseDOM.js.map"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;CAEC;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,YAAY;IAC7B,OAAO,OAAOC,WAAW,eAAe,CAAC,CAAEA,CAAAA,OAAOC,QAAQ,IAC1D,mDAAmD;IACnDD,OAAOC,QAAQ,CAACC,aAAa,AAAD;AAC9B,EACA,qCAAqC"}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./canUseDOM"), exports);
8
- tslib_1.__exportStar(require("./SSRContext"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./canUseDOM"), exports);
7
+ _exportStar(require("./SSRContext"), exports);
8
+ //# sourceMappingURL=index.js.map
9
+
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/ssr/index.ts"],"sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,iBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,kBAAAC,OAAA"}
1
+ {"version":3,"sources":["../../lib/ssr/index.js"],"sourcesContent":["export * from \"./canUseDOM\";\nexport * from \"./SSRContext\";\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;CACd,iCAAiC"}