@react-aria/ssr 3.9.4-nightly.4623 → 3.9.4
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/dist/SSRProvider.main.js +11 -11
- package/dist/SSRProvider.mjs +11 -11
- package/dist/SSRProvider.module.js +11 -11
- package/package.json +2 -2
package/dist/SSRProvider.main.js
CHANGED
|
@@ -45,7 +45,7 @@ function $97d95f6660b1bb14$var$LegacySSRProvider(props) {
|
|
|
45
45
|
let value = (0, $14Xyt$react.useMemo)(()=>({
|
|
46
46
|
// If this is the first SSRProvider, start with an empty string prefix, otherwise
|
|
47
47
|
// append and increment the counter.
|
|
48
|
-
prefix: cur === $97d95f6660b1bb14$var$defaultContext ?
|
|
48
|
+
prefix: cur === $97d95f6660b1bb14$var$defaultContext ? '' : `${cur.prefix}-${counter}`,
|
|
49
49
|
current: 0
|
|
50
50
|
}), [
|
|
51
51
|
cur,
|
|
@@ -53,7 +53,7 @@ function $97d95f6660b1bb14$var$LegacySSRProvider(props) {
|
|
|
53
53
|
]);
|
|
54
54
|
// If on the client, and the component was initially server rendered,
|
|
55
55
|
// then schedule a layout effect to update the component after hydration.
|
|
56
|
-
if (typeof document !==
|
|
56
|
+
if (typeof document !== 'undefined') // This if statement technically breaks the rules of hooks, but is safe
|
|
57
57
|
// because the condition never changes after mounting.
|
|
58
58
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
59
59
|
(0, $14Xyt$react.useLayoutEffect)(()=>{
|
|
@@ -67,16 +67,16 @@ function $97d95f6660b1bb14$var$LegacySSRProvider(props) {
|
|
|
67
67
|
}
|
|
68
68
|
let $97d95f6660b1bb14$var$warnedAboutSSRProvider = false;
|
|
69
69
|
function $97d95f6660b1bb14$export$9f8ac96af4b1b2ae(props) {
|
|
70
|
-
if (typeof (0, ($parcel$interopDefault($14Xyt$react)))[
|
|
71
|
-
if (process.env.NODE_ENV !==
|
|
72
|
-
console.warn(
|
|
70
|
+
if (typeof (0, ($parcel$interopDefault($14Xyt$react)))['useId'] === 'function') {
|
|
71
|
+
if (process.env.NODE_ENV !== 'test' && !$97d95f6660b1bb14$var$warnedAboutSSRProvider) {
|
|
72
|
+
console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
|
|
73
73
|
$97d95f6660b1bb14$var$warnedAboutSSRProvider = true;
|
|
74
74
|
}
|
|
75
75
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($14Xyt$react))).createElement((0, ($parcel$interopDefault($14Xyt$react))).Fragment, null, props.children);
|
|
76
76
|
}
|
|
77
77
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($14Xyt$react))).createElement($97d95f6660b1bb14$var$LegacySSRProvider, props);
|
|
78
78
|
}
|
|
79
|
-
let $97d95f6660b1bb14$var$canUseDOM = Boolean(typeof window !==
|
|
79
|
+
let $97d95f6660b1bb14$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
80
80
|
let $97d95f6660b1bb14$var$componentIds = new WeakMap();
|
|
81
81
|
function $97d95f6660b1bb14$var$useCounter(isDisabled = false) {
|
|
82
82
|
let ctx = (0, $14Xyt$react.useContext)($97d95f6660b1bb14$var$SSRContext);
|
|
@@ -120,19 +120,19 @@ function $97d95f6660b1bb14$var$useLegacySSRSafeId(defaultId) {
|
|
|
120
120
|
let ctx = (0, $14Xyt$react.useContext)($97d95f6660b1bb14$var$SSRContext);
|
|
121
121
|
// If we are rendering in a non-DOM environment, and there's no SSRProvider,
|
|
122
122
|
// provide a warning to hint to the developer to add one.
|
|
123
|
-
if (ctx === $97d95f6660b1bb14$var$defaultContext && !$97d95f6660b1bb14$var$canUseDOM) console.warn(
|
|
123
|
+
if (ctx === $97d95f6660b1bb14$var$defaultContext && !$97d95f6660b1bb14$var$canUseDOM) console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
|
|
124
124
|
let counter = $97d95f6660b1bb14$var$useCounter(!!defaultId);
|
|
125
|
-
let prefix = ctx === $97d95f6660b1bb14$var$defaultContext && process.env.NODE_ENV ===
|
|
125
|
+
let prefix = ctx === $97d95f6660b1bb14$var$defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;
|
|
126
126
|
return defaultId || `${prefix}-${counter}`;
|
|
127
127
|
}
|
|
128
128
|
function $97d95f6660b1bb14$var$useModernSSRSafeId(defaultId) {
|
|
129
129
|
// @ts-ignore
|
|
130
130
|
let id = (0, ($parcel$interopDefault($14Xyt$react))).useId();
|
|
131
131
|
let [didSSR] = (0, $14Xyt$react.useState)($97d95f6660b1bb14$export$535bd6ca7f90a273());
|
|
132
|
-
let prefix = didSSR || process.env.NODE_ENV ===
|
|
132
|
+
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${$97d95f6660b1bb14$var$defaultContext.prefix}`;
|
|
133
133
|
return defaultId || `${prefix}-${id}`;
|
|
134
134
|
}
|
|
135
|
-
const $97d95f6660b1bb14$export$619500959fc48b26 = typeof (0, ($parcel$interopDefault($14Xyt$react)))[
|
|
135
|
+
const $97d95f6660b1bb14$export$619500959fc48b26 = typeof (0, ($parcel$interopDefault($14Xyt$react)))['useId'] === 'function' ? $97d95f6660b1bb14$var$useModernSSRSafeId : $97d95f6660b1bb14$var$useLegacySSRSafeId;
|
|
136
136
|
function $97d95f6660b1bb14$var$getSnapshot() {
|
|
137
137
|
return false;
|
|
138
138
|
}
|
|
@@ -146,7 +146,7 @@ function $97d95f6660b1bb14$var$subscribe(onStoreChange) {
|
|
|
146
146
|
}
|
|
147
147
|
function $97d95f6660b1bb14$export$535bd6ca7f90a273() {
|
|
148
148
|
// In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
|
|
149
|
-
if (typeof (0, ($parcel$interopDefault($14Xyt$react)))[
|
|
149
|
+
if (typeof (0, ($parcel$interopDefault($14Xyt$react)))['useSyncExternalStore'] === 'function') return (0, ($parcel$interopDefault($14Xyt$react)))['useSyncExternalStore']($97d95f6660b1bb14$var$subscribe, $97d95f6660b1bb14$var$getSnapshot, $97d95f6660b1bb14$var$getServerSnapshot);
|
|
150
150
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
151
151
|
return (0, $14Xyt$react.useContext)($97d95f6660b1bb14$var$IsSSRContext);
|
|
152
152
|
}
|
package/dist/SSRProvider.mjs
CHANGED
|
@@ -33,7 +33,7 @@ function $b5e257d569688ac6$var$LegacySSRProvider(props) {
|
|
|
33
33
|
let value = (0, $670gB$useMemo)(()=>({
|
|
34
34
|
// If this is the first SSRProvider, start with an empty string prefix, otherwise
|
|
35
35
|
// append and increment the counter.
|
|
36
|
-
prefix: cur === $b5e257d569688ac6$var$defaultContext ?
|
|
36
|
+
prefix: cur === $b5e257d569688ac6$var$defaultContext ? '' : `${cur.prefix}-${counter}`,
|
|
37
37
|
current: 0
|
|
38
38
|
}), [
|
|
39
39
|
cur,
|
|
@@ -41,7 +41,7 @@ function $b5e257d569688ac6$var$LegacySSRProvider(props) {
|
|
|
41
41
|
]);
|
|
42
42
|
// If on the client, and the component was initially server rendered,
|
|
43
43
|
// then schedule a layout effect to update the component after hydration.
|
|
44
|
-
if (typeof document !==
|
|
44
|
+
if (typeof document !== 'undefined') // This if statement technically breaks the rules of hooks, but is safe
|
|
45
45
|
// because the condition never changes after mounting.
|
|
46
46
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
47
47
|
(0, $670gB$useLayoutEffect)(()=>{
|
|
@@ -55,16 +55,16 @@ function $b5e257d569688ac6$var$LegacySSRProvider(props) {
|
|
|
55
55
|
}
|
|
56
56
|
let $b5e257d569688ac6$var$warnedAboutSSRProvider = false;
|
|
57
57
|
function $b5e257d569688ac6$export$9f8ac96af4b1b2ae(props) {
|
|
58
|
-
if (typeof (0, $670gB$react)[
|
|
59
|
-
if (process.env.NODE_ENV !==
|
|
60
|
-
console.warn(
|
|
58
|
+
if (typeof (0, $670gB$react)['useId'] === 'function') {
|
|
59
|
+
if (process.env.NODE_ENV !== 'test' && !$b5e257d569688ac6$var$warnedAboutSSRProvider) {
|
|
60
|
+
console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
|
|
61
61
|
$b5e257d569688ac6$var$warnedAboutSSRProvider = true;
|
|
62
62
|
}
|
|
63
63
|
return /*#__PURE__*/ (0, $670gB$react).createElement((0, $670gB$react).Fragment, null, props.children);
|
|
64
64
|
}
|
|
65
65
|
return /*#__PURE__*/ (0, $670gB$react).createElement($b5e257d569688ac6$var$LegacySSRProvider, props);
|
|
66
66
|
}
|
|
67
|
-
let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !==
|
|
67
|
+
let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
68
68
|
let $b5e257d569688ac6$var$componentIds = new WeakMap();
|
|
69
69
|
function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
|
|
70
70
|
let ctx = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
|
@@ -108,19 +108,19 @@ function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
|
|
|
108
108
|
let ctx = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
|
109
109
|
// If we are rendering in a non-DOM environment, and there's no SSRProvider,
|
|
110
110
|
// provide a warning to hint to the developer to add one.
|
|
111
|
-
if (ctx === $b5e257d569688ac6$var$defaultContext && !$b5e257d569688ac6$var$canUseDOM) console.warn(
|
|
111
|
+
if (ctx === $b5e257d569688ac6$var$defaultContext && !$b5e257d569688ac6$var$canUseDOM) console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
|
|
112
112
|
let counter = $b5e257d569688ac6$var$useCounter(!!defaultId);
|
|
113
|
-
let prefix = ctx === $b5e257d569688ac6$var$defaultContext && process.env.NODE_ENV ===
|
|
113
|
+
let prefix = ctx === $b5e257d569688ac6$var$defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;
|
|
114
114
|
return defaultId || `${prefix}-${counter}`;
|
|
115
115
|
}
|
|
116
116
|
function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
|
|
117
117
|
// @ts-ignore
|
|
118
118
|
let id = (0, $670gB$react).useId();
|
|
119
119
|
let [didSSR] = (0, $670gB$useState)($b5e257d569688ac6$export$535bd6ca7f90a273());
|
|
120
|
-
let prefix = didSSR || process.env.NODE_ENV ===
|
|
120
|
+
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
|
|
121
121
|
return defaultId || `${prefix}-${id}`;
|
|
122
122
|
}
|
|
123
|
-
const $b5e257d569688ac6$export$619500959fc48b26 = typeof (0, $670gB$react)[
|
|
123
|
+
const $b5e257d569688ac6$export$619500959fc48b26 = typeof (0, $670gB$react)['useId'] === 'function' ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId;
|
|
124
124
|
function $b5e257d569688ac6$var$getSnapshot() {
|
|
125
125
|
return false;
|
|
126
126
|
}
|
|
@@ -134,7 +134,7 @@ function $b5e257d569688ac6$var$subscribe(onStoreChange) {
|
|
|
134
134
|
}
|
|
135
135
|
function $b5e257d569688ac6$export$535bd6ca7f90a273() {
|
|
136
136
|
// In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
|
|
137
|
-
if (typeof (0, $670gB$react)[
|
|
137
|
+
if (typeof (0, $670gB$react)['useSyncExternalStore'] === 'function') return (0, $670gB$react)['useSyncExternalStore']($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
|
|
138
138
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
139
139
|
return (0, $670gB$useContext)($b5e257d569688ac6$var$IsSSRContext);
|
|
140
140
|
}
|
|
@@ -33,7 +33,7 @@ function $b5e257d569688ac6$var$LegacySSRProvider(props) {
|
|
|
33
33
|
let value = (0, $670gB$useMemo)(()=>({
|
|
34
34
|
// If this is the first SSRProvider, start with an empty string prefix, otherwise
|
|
35
35
|
// append and increment the counter.
|
|
36
|
-
prefix: cur === $b5e257d569688ac6$var$defaultContext ?
|
|
36
|
+
prefix: cur === $b5e257d569688ac6$var$defaultContext ? '' : `${cur.prefix}-${counter}`,
|
|
37
37
|
current: 0
|
|
38
38
|
}), [
|
|
39
39
|
cur,
|
|
@@ -41,7 +41,7 @@ function $b5e257d569688ac6$var$LegacySSRProvider(props) {
|
|
|
41
41
|
]);
|
|
42
42
|
// If on the client, and the component was initially server rendered,
|
|
43
43
|
// then schedule a layout effect to update the component after hydration.
|
|
44
|
-
if (typeof document !==
|
|
44
|
+
if (typeof document !== 'undefined') // This if statement technically breaks the rules of hooks, but is safe
|
|
45
45
|
// because the condition never changes after mounting.
|
|
46
46
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
47
47
|
(0, $670gB$useLayoutEffect)(()=>{
|
|
@@ -55,16 +55,16 @@ function $b5e257d569688ac6$var$LegacySSRProvider(props) {
|
|
|
55
55
|
}
|
|
56
56
|
let $b5e257d569688ac6$var$warnedAboutSSRProvider = false;
|
|
57
57
|
function $b5e257d569688ac6$export$9f8ac96af4b1b2ae(props) {
|
|
58
|
-
if (typeof (0, $670gB$react)[
|
|
59
|
-
if (process.env.NODE_ENV !==
|
|
60
|
-
console.warn(
|
|
58
|
+
if (typeof (0, $670gB$react)['useId'] === 'function') {
|
|
59
|
+
if (process.env.NODE_ENV !== 'test' && !$b5e257d569688ac6$var$warnedAboutSSRProvider) {
|
|
60
|
+
console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
|
|
61
61
|
$b5e257d569688ac6$var$warnedAboutSSRProvider = true;
|
|
62
62
|
}
|
|
63
63
|
return /*#__PURE__*/ (0, $670gB$react).createElement((0, $670gB$react).Fragment, null, props.children);
|
|
64
64
|
}
|
|
65
65
|
return /*#__PURE__*/ (0, $670gB$react).createElement($b5e257d569688ac6$var$LegacySSRProvider, props);
|
|
66
66
|
}
|
|
67
|
-
let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !==
|
|
67
|
+
let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
68
68
|
let $b5e257d569688ac6$var$componentIds = new WeakMap();
|
|
69
69
|
function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
|
|
70
70
|
let ctx = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
|
@@ -108,19 +108,19 @@ function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
|
|
|
108
108
|
let ctx = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
|
109
109
|
// If we are rendering in a non-DOM environment, and there's no SSRProvider,
|
|
110
110
|
// provide a warning to hint to the developer to add one.
|
|
111
|
-
if (ctx === $b5e257d569688ac6$var$defaultContext && !$b5e257d569688ac6$var$canUseDOM) console.warn(
|
|
111
|
+
if (ctx === $b5e257d569688ac6$var$defaultContext && !$b5e257d569688ac6$var$canUseDOM) console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
|
|
112
112
|
let counter = $b5e257d569688ac6$var$useCounter(!!defaultId);
|
|
113
|
-
let prefix = ctx === $b5e257d569688ac6$var$defaultContext && process.env.NODE_ENV ===
|
|
113
|
+
let prefix = ctx === $b5e257d569688ac6$var$defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;
|
|
114
114
|
return defaultId || `${prefix}-${counter}`;
|
|
115
115
|
}
|
|
116
116
|
function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
|
|
117
117
|
// @ts-ignore
|
|
118
118
|
let id = (0, $670gB$react).useId();
|
|
119
119
|
let [didSSR] = (0, $670gB$useState)($b5e257d569688ac6$export$535bd6ca7f90a273());
|
|
120
|
-
let prefix = didSSR || process.env.NODE_ENV ===
|
|
120
|
+
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
|
|
121
121
|
return defaultId || `${prefix}-${id}`;
|
|
122
122
|
}
|
|
123
|
-
const $b5e257d569688ac6$export$619500959fc48b26 = typeof (0, $670gB$react)[
|
|
123
|
+
const $b5e257d569688ac6$export$619500959fc48b26 = typeof (0, $670gB$react)['useId'] === 'function' ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId;
|
|
124
124
|
function $b5e257d569688ac6$var$getSnapshot() {
|
|
125
125
|
return false;
|
|
126
126
|
}
|
|
@@ -134,7 +134,7 @@ function $b5e257d569688ac6$var$subscribe(onStoreChange) {
|
|
|
134
134
|
}
|
|
135
135
|
function $b5e257d569688ac6$export$535bd6ca7f90a273() {
|
|
136
136
|
// In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
|
|
137
|
-
if (typeof (0, $670gB$react)[
|
|
137
|
+
if (typeof (0, $670gB$react)['useSyncExternalStore'] === 'function') return (0, $670gB$react)['useSyncExternalStore']($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
|
|
138
138
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
139
139
|
return (0, $670gB$useContext)($b5e257d569688ac6$var$IsSSRContext);
|
|
140
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/ssr",
|
|
3
|
-
"version": "3.9.4
|
|
3
|
+
"version": "3.9.4",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"context": "node"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
|
|
45
45
|
}
|