@react-aria/ssr 3.2.1-nightly.3373 → 3.3.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/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AC4BA,EAAiF,AAAjF,+EAAiF;AACjF,EAAkF,AAAlF,gFAAkF;AAClF,EAA+E,AAA/E,6EAA+E;AAC/E,EAA+E,AAA/E,6EAA+E;AAC/E,EAA2D,AAA3D,yDAA2D;AAC3D,KAAK,CAAC,oCAAc,GAAoB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW;IACrD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,KAAK,CAAC,gCAAU,iBAAG,sCAAK,CAAC,aAAa,CAAkB,oCAAc;SAWtD,yCAAW,CAAC,KAAuB,EAAe,CAAC;IACjE,GAAG,CAAC,GAAG,GAAG,uBAAU,CAAC,gCAAU;IAC/B,GAAG,CAAC,KAAK,GAAoB,oBAAO,MAAQ,CAAC;YAC3C,EAAiF,AAAjF,+EAAiF;YACjF,EAAoC,AAApC,kCAAoC;YACpC,MAAM,EAAE,GAAG,KAAK,oCAAc,GAAG,CAAE,OAAM,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO;YACpE,OAAO,EAAE,CAAC;QACZ,CAAC;MAAG,CAAC;QAAA,GAAG;IAAA,CAAC;IAET,MAAM,oEACH,gCAAU,CAAC,QAAQ;QAAC,KAAK,EAAE,KAAK;OAC9B,KAAK,CAAC,QAAQ;AAGrB,CAAC;AAED,GAAG,CAAC,+BAAS,GAAG,OAAO,CACrB,MAAM,CAAC,MAAM,KAAK,CAAW,cAC7B,MAAM,CAAC,QAAQ,IACf,MAAM,CAAC,QAAQ,CAAC,aAAa;SAIf,yCAAY,CAAC,SAAkB,EAAU,CAAC;IACxD,GAAG,CAAC,GAAG,GAAG,uBAAU,CAAC,gCAAU;IAE/B,EAA4E,AAA5E,0EAA4E;IAC5E,EAAyD,AAAzD,uDAAyD;IACzD,EAAE,EAAE,GAAG,KAAK,oCAAc,KAAK,+BAAS,EACtC,OAAO,CAAC,IAAI,CAAC,CAAiJ;IAGhK,MAAM,CAAC,oBAAO,KAAO,SAAS,KAAK,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO;MAAI,CAAC;QAAA,SAAS;IAAA,CAAC;AAC3F,CAAC;SAOe,yCAAQ,GAAY,CAAC;IACnC,GAAG,CAAC,GAAG,GAAG,uBAAU,CAAC,gCAAU;IAC/B,GAAG,CAAC,cAAc,GAAG,GAAG,KAAK,oCAAc;IAC3C,GAAG,EAAE,KAAK,EAAE,QAAQ,IAAI,qBAAQ,CAAC,cAAc;IAE/C,EAAqE,AAArE,mEAAqE;IACrE,EAAyE,AAAzE,uEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAW,cAAI,cAAc,EACjD,EAAuE,AAAvE,qEAAuE;IACvE,EAAsD,AAAtD,oDAAsD;IACtD,EAAsD,AAAtD,oDAAsD;IACtD,4BAAe,KAAO,CAAC;QACrB,QAAQ,CAAC,KAAK;IAChB,CAAC,EAAE,CAAC,CAAC;IAGP,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-aria/ssr/src/index.ts","packages/@react-aria/ssr/src/SSRProvider.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is\n// guarded by a check that it only runs on the client side.\n// eslint-disable-next-line rulesdir/useLayoutEffectRule\nimport React, {ReactNode, useContext, useLayoutEffect, useMemo, useState} from 'react';\n\n// To support SSR, the auto incrementing id counter is stored in a context. This allows\n// it to be reset on every request to ensure the client and server are consistent.\n// There is also a prefix string that is used to support async loading components\n// Each async boundary must be wrapped in an SSR provider, which appends to the prefix\n// and resets the current id counter. This ensures that async loaded components have\n// consistent ids regardless of the loading order.\ninterface SSRContextValue {\n prefix: string,\n current: number\n}\n\n// Default context value to use in case there is no SSRProvider. This is fine for\n// client-only apps. In order to support multiple copies of React Aria potentially\n// being on the page at once, the prefix is set to a random number. SSRProvider\n// will reset this to zero for consistency between server and client, so in the\n// SSR case multiple copies of React Aria is not supported.\nconst defaultContext: SSRContextValue = {\n prefix: String(Math.round(Math.random() * 10000000000)),\n current: 0\n};\n\nconst SSRContext = React.createContext<SSRContextValue>(defaultContext);\n\ninterface SSRProviderProps {\n /** Your application here. */\n children: ReactNode\n}\n\n/**\n * When using SSR with React Aria, applications must be wrapped in an SSRProvider.\n * This ensures that auto generated ids are consistent between the client and server.\n */\nexport function SSRProvider(props: SSRProviderProps): JSX.Element {\n let cur = useContext(SSRContext);\n let value: SSRContextValue = useMemo(() => ({\n // If this is the first SSRProvider, start with an empty string prefix, otherwise\n // append and increment the counter.\n prefix: cur === defaultContext ? '' : `${cur.prefix}-${++cur.current}`,\n current: 0\n }), [cur]);\n\n return (\n <SSRContext.Provider value={value}>\n {props.children}\n </SSRContext.Provider>\n );\n}\n\nlet canUseDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n\n/** @private */\nexport function useSSRSafeId(defaultId?: string): string {\n let ctx = useContext(SSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider,\n // provide a warning to hint to the developer to add one.\n if (ctx === defaultContext && !canUseDOM) {\n console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');\n }\n\n return useMemo(() => defaultId || `react-aria${ctx.prefix}-${++ctx.current}`, [defaultId]);\n}\n\n/**\n * Returns whether the component is currently being server side rendered or\n * hydrated on the client. Can be used to delay browser-specific rendering\n * until after hydration.\n */\nexport function useIsSSR(): boolean {\n let cur = useContext(SSRContext);\n let isInSSRContext = cur !== defaultContext;\n let [isSSR, setIsSSR] = useState(isInSSRContext);\n\n // If on the client, and the component was initially server rendered,\n // then schedule a layout effect to update the component after hydration.\n if (typeof window !== 'undefined' && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe\n // because the condition never changes after mounting.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AC4BA,EAAiF,AAAjF,+EAAiF;AACjF,EAAkF,AAAlF,gFAAkF;AAClF,EAA+E,AAA/E,6EAA+E;AAC/E,EAA+E,AAA/E,6EAA+E;AAC/E,EAA2D,AAA3D,yDAA2D;AAC3D,KAAK,CAAC,oCAAc,GAAoB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW;IACrD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,KAAK,CAAC,gCAAU,iBAAG,sCAAK,CAAC,aAAa,CAAkB,oCAAc;SAWtD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IACrE,EAAyE,AAAzE,uEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAW,cAAI,cAAc,EACjD,EAAuE,AAAvE,qEAAuE;IACvE,EAAsD,AAAtD,oDAAsD;IACtD,EAAsD,AAAtD,oDAAsD;IACtD,4BAAe,KAAO,CAAC;QACrB,QAAQ,CAAC,KAAK;IAChB,CAAC,EAAE,CAAC,CAAC;IAGP,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-aria/ssr/src/index.ts","packages/@react-aria/ssr/src/SSRProvider.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\nexport type {SSRProviderProps} from './SSRProvider';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is\n// guarded by a check that it only runs on the client side.\n// eslint-disable-next-line rulesdir/useLayoutEffectRule\nimport React, {ReactNode, useContext, useLayoutEffect, useMemo, useState} from 'react';\n\n// To support SSR, the auto incrementing id counter is stored in a context. This allows\n// it to be reset on every request to ensure the client and server are consistent.\n// There is also a prefix string that is used to support async loading components\n// Each async boundary must be wrapped in an SSR provider, which appends to the prefix\n// and resets the current id counter. This ensures that async loaded components have\n// consistent ids regardless of the loading order.\ninterface SSRContextValue {\n prefix: string,\n current: number\n}\n\n// Default context value to use in case there is no SSRProvider. This is fine for\n// client-only apps. In order to support multiple copies of React Aria potentially\n// being on the page at once, the prefix is set to a random number. SSRProvider\n// will reset this to zero for consistency between server and client, so in the\n// SSR case multiple copies of React Aria is not supported.\nconst defaultContext: SSRContextValue = {\n prefix: String(Math.round(Math.random() * 10000000000)),\n current: 0\n};\n\nconst SSRContext = React.createContext<SSRContextValue>(defaultContext);\n\nexport interface SSRProviderProps {\n /** Your application here. */\n children: ReactNode\n}\n\n/**\n * When using SSR with React Aria, applications must be wrapped in an SSRProvider.\n * This ensures that auto generated ids are consistent between the client and server.\n */\nexport function SSRProvider(props: SSRProviderProps): JSX.Element {\n let cur = useContext(SSRContext);\n let value: SSRContextValue = useMemo(() => ({\n // If this is the first SSRProvider, start with an empty string prefix, otherwise\n // append and increment the counter.\n prefix: cur === defaultContext ? '' : `${cur.prefix}-${++cur.current}`,\n current: 0\n }), [cur]);\n\n return (\n <SSRContext.Provider value={value}>\n {props.children}\n </SSRContext.Provider>\n );\n}\n\nlet canUseDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n\n/** @private */\nexport function useSSRSafeId(defaultId?: string): string {\n let ctx = useContext(SSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider,\n // provide a warning to hint to the developer to add one.\n if (ctx === defaultContext && !canUseDOM) {\n console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');\n }\n\n return useMemo(() => defaultId || `react-aria${ctx.prefix}-${++ctx.current}`, [defaultId]);\n}\n\n/**\n * Returns whether the component is currently being server side rendered or\n * hydrated on the client. Can be used to delay browser-specific rendering\n * until after hydration.\n */\nexport function useIsSSR(): boolean {\n let cur = useContext(SSRContext);\n let isInSSRContext = cur !== defaultContext;\n let [isSSR, setIsSSR] = useState(isInSSRContext);\n\n // If on the client, and the component was initially server rendered,\n // then schedule a layout effect to update the component after hydration.\n if (typeof window !== 'undefined' && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe\n // because the condition never changes after mounting.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AC4BA,EAAiF,AAAjF,+EAAiF;AACjF,EAAkF,AAAlF,gFAAkF;AAClF,EAA+E,AAA/E,6EAA+E;AAC/E,EAA+E,AAA/E,6EAA+E;AAC/E,EAA2D,AAA3D,yDAA2D;AAC3D,KAAK,CAAC,oCAAc,GAAoB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW;IACrD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,KAAK,CAAC,gCAAU,iBAAG,YAAK,CAAC,aAAa,CAAkB,oCAAc;SAWtD,yCAAW,CAAC,KAAuB,EAAe,CAAC;IACjE,GAAG,CAAC,GAAG,GAAG,iBAAU,CAAC,gCAAU;IAC/B,GAAG,CAAC,KAAK,GAAoB,cAAO,MAAQ,CAAC;YAC3C,EAAiF,AAAjF,+EAAiF;YACjF,EAAoC,AAApC,kCAAoC;YACpC,MAAM,EAAE,GAAG,KAAK,oCAAc,GAAG,CAAE,OAAM,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO;YACpE,OAAO,EAAE,CAAC;QACZ,CAAC;MAAG,CAAC;QAAA,GAAG;IAAA,CAAC;IAET,MAAM,0CACH,gCAAU,CAAC,QAAQ;QAAC,KAAK,EAAE,KAAK;OAC9B,KAAK,CAAC,QAAQ;AAGrB,CAAC;AAED,GAAG,CAAC,+BAAS,GAAG,OAAO,CACrB,MAAM,CAAC,MAAM,KAAK,CAAW,cAC7B,MAAM,CAAC,QAAQ,IACf,MAAM,CAAC,QAAQ,CAAC,aAAa;SAIf,yCAAY,CAAC,SAAkB,EAAU,CAAC;IACxD,GAAG,CAAC,GAAG,GAAG,iBAAU,CAAC,gCAAU;IAE/B,EAA4E,AAA5E,0EAA4E;IAC5E,EAAyD,AAAzD,uDAAyD;IACzD,EAAE,EAAE,GAAG,KAAK,oCAAc,KAAK,+BAAS,EACtC,OAAO,CAAC,IAAI,CAAC,CAAiJ;IAGhK,MAAM,CAAC,cAAO,KAAO,SAAS,KAAK,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO;MAAI,CAAC;QAAA,SAAS;IAAA,CAAC;AAC3F,CAAC;SAOe,yCAAQ,GAAY,CAAC;IACnC,GAAG,CAAC,GAAG,GAAG,iBAAU,CAAC,gCAAU;IAC/B,GAAG,CAAC,cAAc,GAAG,GAAG,KAAK,oCAAc;IAC3C,GAAG,EAAE,KAAK,EAAE,QAAQ,IAAI,eAAQ,CAAC,cAAc;IAE/C,EAAqE,AAArE,mEAAqE;IACrE,EAAyE,AAAzE,uEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAW,cAAI,cAAc,EACjD,EAAuE,AAAvE,qEAAuE;IACvE,EAAsD,AAAtD,oDAAsD;IACtD,EAAsD,AAAtD,oDAAsD;IACtD,sBAAe,KAAO,CAAC;QACrB,QAAQ,CAAC,KAAK;IAChB,CAAC,EAAE,CAAC,CAAC;IAGP,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-aria/ssr/src/index.ts","packages/@react-aria/ssr/src/SSRProvider.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is\n// guarded by a check that it only runs on the client side.\n// eslint-disable-next-line rulesdir/useLayoutEffectRule\nimport React, {ReactNode, useContext, useLayoutEffect, useMemo, useState} from 'react';\n\n// To support SSR, the auto incrementing id counter is stored in a context. This allows\n// it to be reset on every request to ensure the client and server are consistent.\n// There is also a prefix string that is used to support async loading components\n// Each async boundary must be wrapped in an SSR provider, which appends to the prefix\n// and resets the current id counter. This ensures that async loaded components have\n// consistent ids regardless of the loading order.\ninterface SSRContextValue {\n prefix: string,\n current: number\n}\n\n// Default context value to use in case there is no SSRProvider. This is fine for\n// client-only apps. In order to support multiple copies of React Aria potentially\n// being on the page at once, the prefix is set to a random number. SSRProvider\n// will reset this to zero for consistency between server and client, so in the\n// SSR case multiple copies of React Aria is not supported.\nconst defaultContext: SSRContextValue = {\n prefix: String(Math.round(Math.random() * 10000000000)),\n current: 0\n};\n\nconst SSRContext = React.createContext<SSRContextValue>(defaultContext);\n\ninterface SSRProviderProps {\n /** Your application here. */\n children: ReactNode\n}\n\n/**\n * When using SSR with React Aria, applications must be wrapped in an SSRProvider.\n * This ensures that auto generated ids are consistent between the client and server.\n */\nexport function SSRProvider(props: SSRProviderProps): JSX.Element {\n let cur = useContext(SSRContext);\n let value: SSRContextValue = useMemo(() => ({\n // If this is the first SSRProvider, start with an empty string prefix, otherwise\n // append and increment the counter.\n prefix: cur === defaultContext ? '' : `${cur.prefix}-${++cur.current}`,\n current: 0\n }), [cur]);\n\n return (\n <SSRContext.Provider value={value}>\n {props.children}\n </SSRContext.Provider>\n );\n}\n\nlet canUseDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n\n/** @private */\nexport function useSSRSafeId(defaultId?: string): string {\n let ctx = useContext(SSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider,\n // provide a warning to hint to the developer to add one.\n if (ctx === defaultContext && !canUseDOM) {\n console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');\n }\n\n return useMemo(() => defaultId || `react-aria${ctx.prefix}-${++ctx.current}`, [defaultId]);\n}\n\n/**\n * Returns whether the component is currently being server side rendered or\n * hydrated on the client. Can be used to delay browser-specific rendering\n * until after hydration.\n */\nexport function useIsSSR(): boolean {\n let cur = useContext(SSRContext);\n let isInSSRContext = cur !== defaultContext;\n let [isSSR, setIsSSR] = useState(isInSSRContext);\n\n // If on the client, and the component was initially server rendered,\n // then schedule a layout effect to update the component after hydration.\n if (typeof window !== 'undefined' && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe\n // because the condition never changes after mounting.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;AC4BA,EAAiF,AAAjF,+EAAiF;AACjF,EAAkF,AAAlF,gFAAkF;AAClF,EAA+E,AAA/E,6EAA+E;AAC/E,EAA+E,AAA/E,6EAA+E;AAC/E,EAA2D,AAA3D,yDAA2D;AAC3D,KAAK,CAAC,oCAAc,GAAoB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAA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AAc,GAAG,GAAG,KAAK,oCAAc;IAC3C,GAAG,EAAE,KAAK,EAAE,QAAQ,IAAI,eAAQ,CAAC,cAAc;IAE/C,EAAqE,AAArE,mEAAqE;IACrE,EAAyE,AAAzE,uEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAW,cAAI,cAAc,EACjD,EAAuE,AAAvE,qEAAuE;IACvE,EAAsD,AAAtD,oDAAsD;IACtD,EAAsD,AAAtD,oDAAsD;IACtD,sBAAe,KAAO,CAAC;QACrB,QAAQ,CAAC,KAAK;IAChB,CAAC,EAAE,CAAC,CAAC;IAGP,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-aria/ssr/src/index.ts","packages/@react-aria/ssr/src/SSRProvider.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\nexport type {SSRProviderProps} from './SSRProvider';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is\n// guarded by a check that it only runs on the client side.\n// eslint-disable-next-line rulesdir/useLayoutEffectRule\nimport React, {ReactNode, useContext, useLayoutEffect, useMemo, useState} from 'react';\n\n// To support SSR, the auto incrementing id counter is stored in a context. This allows\n// it to be reset on every request to ensure the client and server are consistent.\n// There is also a prefix string that is used to support async loading components\n// Each async boundary must be wrapped in an SSR provider, which appends to the prefix\n// and resets the current id counter. This ensures that async loaded components have\n// consistent ids regardless of the loading order.\ninterface SSRContextValue {\n prefix: string,\n current: number\n}\n\n// Default context value to use in case there is no SSRProvider. This is fine for\n// client-only apps. In order to support multiple copies of React Aria potentially\n// being on the page at once, the prefix is set to a random number. SSRProvider\n// will reset this to zero for consistency between server and client, so in the\n// SSR case multiple copies of React Aria is not supported.\nconst defaultContext: SSRContextValue = {\n prefix: String(Math.round(Math.random() * 10000000000)),\n current: 0\n};\n\nconst SSRContext = React.createContext<SSRContextValue>(defaultContext);\n\nexport interface SSRProviderProps {\n /** Your application here. */\n children: ReactNode\n}\n\n/**\n * When using SSR with React Aria, applications must be wrapped in an SSRProvider.\n * This ensures that auto generated ids are consistent between the client and server.\n */\nexport function SSRProvider(props: SSRProviderProps): JSX.Element {\n let cur = useContext(SSRContext);\n let value: SSRContextValue = useMemo(() => ({\n // If this is the first SSRProvider, start with an empty string prefix, otherwise\n // append and increment the counter.\n prefix: cur === defaultContext ? '' : `${cur.prefix}-${++cur.current}`,\n current: 0\n }), [cur]);\n\n return (\n <SSRContext.Provider value={value}>\n {props.children}\n </SSRContext.Provider>\n );\n}\n\nlet canUseDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n\n/** @private */\nexport function useSSRSafeId(defaultId?: string): string {\n let ctx = useContext(SSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider,\n // provide a warning to hint to the developer to add one.\n if (ctx === defaultContext && !canUseDOM) {\n console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');\n }\n\n return useMemo(() => defaultId || `react-aria${ctx.prefix}-${++ctx.current}`, [defaultId]);\n}\n\n/**\n * Returns whether the component is currently being server side rendered or\n * hydrated on the client. Can be used to delay browser-specific rendering\n * until after hydration.\n */\nexport function useIsSSR(): boolean {\n let cur = useContext(SSRContext);\n let isInSSRContext = cur !== defaultContext;\n let [isSSR, setIsSSR] = useState(isInSSRContext);\n\n // If on the client, and the component was initially server rendered,\n // then schedule a layout effect to update the component after hydration.\n if (typeof window !== 'undefined' && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe\n // because the condition never changes after mounting.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- interface SSRProviderProps {
2
+ export interface SSRProviderProps {
3
3
  /** Your application here. */
4
4
  children: ReactNode;
5
5
  }
@@ -1 +1 @@
1
- {"mappings":";AAwCA;IACE,6BAA6B;IAC7B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;GAGG;AACH,4BAA4B,KAAK,EAAE,gBAAgB,GAAG,IAAI,OAAO,CAchE;AAQD,eAAe;AACf,6BAA6B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAUvD;AAED;;;;GAIG;AACH,4BAA4B,OAAO,CAiBlC","sources":["packages/@react-aria/ssr/src/packages/@react-aria/ssr/src/SSRProvider.tsx","packages/@react-aria/ssr/src/packages/@react-aria/ssr/src/index.ts","packages/@react-aria/ssr/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";AAwCA;IACE,6BAA6B;IAC7B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;GAGG;AACH,4BAA4B,KAAK,EAAE,gBAAgB,GAAG,IAAI,OAAO,CAchE;AAQD,eAAe;AACf,6BAA6B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAUvD;AAED;;;;GAIG;AACH,4BAA4B,OAAO,CAiBlC","sources":["packages/@react-aria/ssr/src/packages/@react-aria/ssr/src/SSRProvider.tsx","packages/@react-aria/ssr/src/packages/@react-aria/ssr/src/index.ts","packages/@react-aria/ssr/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\nexport type {SSRProviderProps} from './SSRProvider';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/ssr",
3
- "version": "3.2.1-nightly.3373+8defd74c9",
3
+ "version": "3.3.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -25,5 +25,5 @@
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },
28
- "gitHead": "8defd74c9698b4dda32fd20bcfc579b123cd98e7"
28
+ "gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
29
29
  }
@@ -38,7 +38,7 @@ const defaultContext: SSRContextValue = {
38
38
 
39
39
  const SSRContext = React.createContext<SSRContextValue>(defaultContext);
40
40
 
41
- interface SSRProviderProps {
41
+ export interface SSRProviderProps {
42
42
  /** Your application here. */
43
43
  children: ReactNode
44
44
  }
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  export {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';
13
+ export type {SSRProviderProps} from './SSRProvider';