@ubnt/store.core 9.37.0-beta.6 → 9.37.0-beta.8
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/CHANGELOG.md +8 -0
- package/lib/assets/attention.svg +5 -5
- package/lib/assets/attention2.svg +5 -5
- package/lib/assets/icons/wizard/plus.svg.js +1 -1
- package/lib/assets/icons/wizard/plus.svg.mjs +2 -2
- package/lib/assets/minus4.svg +8 -8
- package/lib/assets/minus5.svg +8 -8
- package/lib/assets/plus.svg +4 -22
- package/lib/assets/plus2.svg +22 -4
- package/lib/assets/plus5.svg +9 -9
- package/lib/assets/plus6.svg +9 -9
- package/lib/assets/port.svg +4 -2
- package/lib/assets/port2.svg +2 -4
- package/lib/assets/ucgMax.jpg +0 -0
- package/lib/assets/ucgMax2.jpg +0 -0
- package/lib/assets/ucgUltra.jpg +0 -0
- package/lib/assets/ucgUltra2.jpg +0 -0
- package/lib/components/FeaturesSection_deprecated/AllFeaturesButton/AllFeaturesButton.js +1 -1
- package/lib/components/FeaturesSection_deprecated/AllFeaturesButton/AllFeaturesButton.mjs +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/plus.svg.js +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/plus.svg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/port.svg.js +1 -1
- package/lib/components/ModelCompareV3/assets/port.svg.mjs +2 -2
- package/lib/components/ModelCompareV3/data/CloudGateways.js +6 -6
- package/lib/components/ModelCompareV3/data/CloudGateways.mjs +4 -4
- package/lib/components/ModelCompareV3/data/products/aiLpr.js +1 -1
- package/lib/components/ModelCompareV3/data/products/aiLpr.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/aiLpr.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/aiLpr.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgMax.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgMax.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgUltra.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgUltra.mjs +1 -1
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.js +1 -1
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.mjs +1 -1
- package/lib/components/ProductWizard/ProductWizard.js +1 -1
- package/lib/components/ProductWizard/ProductWizard.mjs +1 -1
- package/lib/components/QuantityInput/QuantityInput.js +1 -1
- package/lib/components/QuantityInput/QuantityInput.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.js +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/assets/port.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/assets/port.svg.mjs +2 -2
- package/lib/constants/icons/options/colors/black.svg.js +5 -5
- package/lib/constants/icons/options/colors/index.js +3 -3
- package/lib/constants/icons/options/styles/black.svg.js +5 -5
- package/lib/constants/icons/options/styles/index.js +3 -3
- package/lib/constants/optionIcons.js +6 -6
- package/lib/constants/optionIcons.mjs +4 -4
- package/lib/utils/nextjs/ssr/registry.d.ts +1 -1
- package/lib/utils/nextjs/ssr/registry.js +6 -3
- package/lib/utils/nextjs/ssr/registry.js.map +1 -1
- package/lib/utils/nextjs/ssr/registry.mjs +6 -3
- package/lib/utils/nextjs/ssr/registry.mjs.map +1 -1
- package/lib/utils/nextjs/ssr/style-inject.js +1 -1
- package/lib/utils/nextjs/ssr/style-inject.js.map +1 -1
- package/lib/utils/nextjs/ssr/style-inject.mjs +1 -1
- package/lib/utils/nextjs/ssr/style-inject.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.mjs","sources":["../../../../src/utils/nextjs/ssr/registry.tsx"],"sourcesContent":["import { SSR_INJECT_ID } from \"./constants\";\nimport type { InjectedModule } from \"./types\";\n\n/**\n * Helper to read injected styles from SSR and inject them into header so first-render is styled correctly.\n * See `./style-inject.ts` for more info!\n *\n * Based on:\n * @see https://github.com/egoist/style-inject/pull/28/files\n *\n * @example\n * \\/**\n * * Add styled-components server-side render support\n * * Taken from https://github.com/vercel/next.js/blob/master/examples/with-styled-components/pages/_document.js\n * *\\/\n * static override async getInitialProps(ctx: DocumentContext): Promise<{\n * styles: JSX.Element;\n * html: string;\n * head?: (JSX.Element | null)[] | undefined;\n * }> {\n * const sheet = new ServerStyleSheet();\n * const originalRenderPage = ctx.renderPage;\n *\n * try {\n * ctx.renderPage = () =>\n * originalRenderPage({\n * enhanceApp: (App) =>\n * function AppEnhanced(props) {\n * return sheet.collectStyles(<App {...props} />);\n * },\n * });\n *\n * const initialProps = await Document.getInitialProps(ctx);\n * return {\n * ...initialProps,\n * styles: (\n * <>\n * {\\/**\n * * Order of injecting important so we:\n * * 1. Inject global css from next\n * * 2. Inject ui-component styles\n * * 3. Inject our styled-component styles (with possible overrides ui-component overrides)\n * *\\/}\n * {initialProps.styles}\n * <UiComponentsSsrStyleRegistry />\n * {sheet.getStyleElement()}\n * </>\n * ),\n * };\n * } finally {\n * sheet.seal();\n * }\n * }\n */\nexport const UiComponentsSsrStyleRegistryPagesRouter = ()
|
|
1
|
+
{"version":3,"file":"registry.mjs","sources":["../../../../src/utils/nextjs/ssr/registry.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { SSR_INJECT_ID } from \"./constants\";\nimport type { InjectedModule } from \"./types\";\n\n/**\n * Helper to read injected styles from SSR and inject them into header so first-render is styled correctly.\n * See `./style-inject.ts` for more info!\n *\n * Based on:\n * @see https://github.com/egoist/style-inject/pull/28/files\n *\n * @example\n * \\/**\n * * Add styled-components server-side render support\n * * Taken from https://github.com/vercel/next.js/blob/master/examples/with-styled-components/pages/_document.js\n * *\\/\n * static override async getInitialProps(ctx: DocumentContext): Promise<{\n * styles: JSX.Element;\n * html: string;\n * head?: (JSX.Element | null)[] | undefined;\n * }> {\n * const sheet = new ServerStyleSheet();\n * const originalRenderPage = ctx.renderPage;\n *\n * try {\n * ctx.renderPage = () =>\n * originalRenderPage({\n * enhanceApp: (App) =>\n * function AppEnhanced(props) {\n * return sheet.collectStyles(<App {...props} />);\n * },\n * });\n *\n * const initialProps = await Document.getInitialProps(ctx);\n * return {\n * ...initialProps,\n * styles: (\n * <>\n * {\\/**\n * * Order of injecting important so we:\n * * 1. Inject global css from next\n * * 2. Inject ui-component styles\n * * 3. Inject our styled-component styles (with possible overrides ui-component overrides)\n * *\\/}\n * {initialProps.styles}\n * <UiComponentsSsrStyleRegistry />\n * {sheet.getStyleElement()}\n * </>\n * ),\n * };\n * } finally {\n * sheet.seal();\n * }\n * }\n */\nexport const UiComponentsSsrStyleRegistryPagesRouter = memo(\n function UiComponentsSsrStyleRegistryPagesRouter() {\n // @ts-expect-error Dangerously accessing globalThis\n const injections = globalThis[SSR_INJECT_ID] as unknown as\n | InjectedModule[]\n | undefined;\n\n const injectionsExist =\n !!injections && Array.isArray(injections) && !!injections.length;\n\n // TODO: For app router will have to migrate to using `useServerInsertedHTML`, see\n // https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components\n\n // Create a style element for each injection\n return (\n <>\n {/* Empty style element as \"bookmark\" for style-inject to know for first insertion where to place first style tag */}\n <noscript data-uic-style=\"\" key=\"data-uic-reference\" />\n {injectionsExist &&\n injections?.map((module: { id: string; css: string }) => (\n <style\n data-uic-style={module.id}\n key={module.id}\n // Dangerouslt set inner HTML to inject the CSS to not escape `content: \"\"`\n dangerouslySetInnerHTML={{ __html: module.css }}\n />\n ))}\n </>\n );\n },\n);\n"],"names":["UiComponentsSsrStyleRegistryPagesRouter","memo","UiComponentsSsrStyleRegistryPagesRouter2","injections","globalThis","SSR_INJECT_ID","injectionsExist","Array","isArray","length","jsxs","Fragment","children","jsx","map","module","id","dangerouslySetInnerHTML","__html","css"],"mappings":";;;;AAwDO,MAAMA,uCAA0C,GAAAC,IAAA,CACrD,SAASD,wCAA0CE,CAAA,EAAA;EAE3C,MAAAC,UAAA,GAAaC,WAAWC,aAAa,CAAA;EAIrC,MAAAC,eAAA,GACJ,CAAC,CAACH,UAAc,IAAAI,KAAA,CAAMC,QAAQL,UAAU,CAAA,IAAK,CAAC,CAACA,UAAW,CAAAM,MAAA;EAM5D,sBAGIC,IAAA,CAAAC,QAAA,EAAA;IAAAC,QAAA,EAAA,CAAC,eAAAC,GAAA,CAAA,UAAA,EAAA;MAAS,gBAAe,EAAA;IAAA,CAAA,EAAO,oBAAqB,CAAA,EACpDP,eACC,IAAAH,UAAA,EAAYW,GAAI,CAACC,MACf,IAAA,eAAAF,GAAA,CAAC,OAAA,EAAA;MACC,kBAAgBE,MAAO,CAAAC,EAAA;MAGvBC,uBAAyB,EAAA;QAAEC,MAAQ,EAAAH,MAAA,CAAOI;MAAI;IAAA,CAAA,EAFzCJ,MAAO,CAAAC,EAAA,CAIf,CAAA;EACL,CAAA,CAAA;AAEJ,CACF,CAAA;"}
|
|
@@ -33,7 +33,7 @@ function styleInject(css, id) {
|
|
|
33
33
|
}
|
|
34
34
|
const style = document.createElement("style");
|
|
35
35
|
style.setAttribute(SSR_NODE_DATA_ID, id);
|
|
36
|
-
style.
|
|
36
|
+
style.innerHTML = css;
|
|
37
37
|
if (injectedStylesLength) {
|
|
38
38
|
const lastStyle = injectedStyles[injectedStylesLength - 1];
|
|
39
39
|
if (lastStyle) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-inject.js","sources":["../../../../src/utils/nextjs/ssr/style-inject.ts"],"sourcesContent":["// #############################################################################\n// ! This file can't contain any imports, as it's copy-pasted into the bundled code!\n// #############################################################################\n\n/**\n * Name for the global object that will be used to store the SSR modules when injecting them into the page.\n */\nconst SSR_INJECT_ID = \"__styleInject_SSR_MODULES\";\n\n/**\n * Data attribute that indicates that given `<style>` node was injected by us\n */\nconst SSR_NODE_DATA_ID = \"data-uic-style\";\n\ntype InjectedModule = {\n /**\n * The ID of the style tag (typically some stable unique hash derived CSS content)\n */\n id: string;\n /**\n * The CSS string to inject\n */\n css: string;\n};\n\n// #############################################################################\n\n/**\n * Util to inject styles into the DOM, this is a patched version of the original styled-inject.\n *\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/rollup.config.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/scripts/rollup-plugin-local-style-inject.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/src/docs/helpers/style-inject.es.js\n * - Original styled-inject: https://github.com/egoist/style-inject/blob/master/src/index.js\n * - SSR Patch: https://github.com/egoist/style-inject/pull/28/files\n */\nexport default function styleInject(\n css: InjectedModule[\"css\"],\n id: InjectedModule[\"id\"],\n) {\n // Nothing to inject\n if (!css) {\n return;\n }\n\n // Patch missing global variable\n // @ts-expect-error Dangerously accessing globalThis\n if (!globalThis[SSR_INJECT_ID]) {\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID] = [];\n }\n\n // Exit early if the style is already injected/registered\n // @ts-expect-error Dangerously accessing globalThis\n if (globalThis[SSR_INJECT_ID].find((item) => item.id === id)) {\n return;\n }\n\n // Register the injected module\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID].push({ id, css });\n\n // Exit early as we can't inject styles on the server, registering is enough\n if (typeof document === \"undefined\") {\n return;\n }\n\n // Try to find either bookmark `<noscript/>` or last injected `<style/>`\n const injectedStyles = document.head.querySelectorAll(\n `:scope > [${SSR_NODE_DATA_ID}]`,\n );\n const injectedStylesLength = injectedStyles.length;\n\n // Check if the style is already injected and return early if needed\n for (let i = 0; i < injectedStylesLength; i++) {\n const style = injectedStyles[i];\n\n if (!!style && style.getAttribute(SSR_NODE_DATA_ID) === id) {\n return;\n }\n }\n\n // Create a style tag\n const style = document.createElement(\"style\");\n // Set a data element so for next DOM inject we can append to the last element we appended\n style.setAttribute(SSR_NODE_DATA_ID, id);\n
|
|
1
|
+
{"version":3,"file":"style-inject.js","sources":["../../../../src/utils/nextjs/ssr/style-inject.ts"],"sourcesContent":["// #############################################################################\n// ! This file can't contain any imports, as it's copy-pasted into the bundled code!\n// #############################################################################\n\n/**\n * Name for the global object that will be used to store the SSR modules when injecting them into the page.\n */\nconst SSR_INJECT_ID = \"__styleInject_SSR_MODULES\";\n\n/**\n * Data attribute that indicates that given `<style>` node was injected by us\n */\nconst SSR_NODE_DATA_ID = \"data-uic-style\";\n\ntype InjectedModule = {\n /**\n * The ID of the style tag (typically some stable unique hash derived CSS content)\n */\n id: string;\n /**\n * The CSS string to inject\n */\n css: string;\n};\n\n// #############################################################################\n\n/**\n * Util to inject styles into the DOM, this is a patched version of the original styled-inject.\n *\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/rollup.config.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/scripts/rollup-plugin-local-style-inject.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/src/docs/helpers/style-inject.es.js\n * - Original styled-inject: https://github.com/egoist/style-inject/blob/master/src/index.js\n * - SSR Patch: https://github.com/egoist/style-inject/pull/28/files\n */\nexport default function styleInject(\n css: InjectedModule[\"css\"],\n id: InjectedModule[\"id\"],\n) {\n // Nothing to inject\n if (!css) {\n return;\n }\n\n // Patch missing global variable\n // @ts-expect-error Dangerously accessing globalThis\n if (!globalThis[SSR_INJECT_ID]) {\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID] = [];\n }\n\n // Exit early if the style is already injected/registered\n // @ts-expect-error Dangerously accessing globalThis\n if (globalThis[SSR_INJECT_ID].find((item) => item.id === id)) {\n return;\n }\n\n // Register the injected module\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID].push({ id, css });\n\n // Exit early as we can't inject styles on the server, registering is enough\n if (typeof document === \"undefined\") {\n return;\n }\n\n // Try to find either bookmark `<noscript/>` or last injected `<style/>`\n const injectedStyles = document.head.querySelectorAll(\n `:scope > [${SSR_NODE_DATA_ID}]`,\n );\n const injectedStylesLength = injectedStyles.length;\n\n // Check if the style is already injected and return early if needed\n for (let i = 0; i < injectedStylesLength; i++) {\n const style = injectedStyles[i];\n\n if (!!style && style.getAttribute(SSR_NODE_DATA_ID) === id) {\n return;\n }\n }\n\n // Create a style tag\n const style = document.createElement(\"style\");\n // Set a data element so for next DOM inject we can append to the last element we appended\n style.setAttribute(SSR_NODE_DATA_ID, id);\n /**\n * Experimented with various ways of injecting the CSS as many approaches escapes certain CSS. E.g. `content: \"\";` -->\n * `content:&qout;&qout;;;` which would partially break the given style tag and cause random layout issues as partial\n * styles would be applied.\n *\n * - Didn't work as escaped the CSS content:\n * - `style.textContent = css;`\n * - `style.innerText = css;`\n * Old way:\n * - `style.styleSheet.cssText = css`\n * Worked:\n * - `style.innerHTML = css;\n * TODO: maybe in 2025 look at `CSSStyleSheet` constructor and `insertRule` method - https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet\n */\n style.innerHTML = css;\n\n // Attempt to append the style (to preserve overriding logic with styled-components)\n if (injectedStylesLength) {\n const lastStyle = injectedStyles[injectedStylesLength - 1];\n\n if (lastStyle) {\n lastStyle.after(style);\n return;\n }\n }\n\n // If that didn't work append to end of head (should have been handled by the bookmark, but just in case)\n document.head.appendChild(style);\n}\n"],"names":["SSR_INJECT_ID","SSR_NODE_DATA_ID","styleInject","css","id","globalThis","find","item","push","document","injectedStyles","head","querySelectorAll","injectedStylesLength","length","i","style","getAttribute","createElement","setAttribute","innerHTML","lastStyle","after","appendChild"],"mappings":";;;;;;AAOA,MAAMA,aAAgB,GAAA,2BAAA;AAKtB,MAAMC,gBAAmB,GAAA,gBAAA;AAwBD,SAAAC,WAAAA,CACtBC,KACAC,EACA,EAAA;EAEA,IAAI,CAACD,GAAK,EAAA;IACR;EACF;EAII,IAAA,CAACE,UAAW,CAAAL,aAAa,CAAG,EAAA;IAEnBK,UAAA,CAAAL,aAAa,IAAI,EAAC;EAC/B;EAII,IAAAK,UAAA,CAAWL,aAAa,CAAE,CAAAM,IAAA,CAAMC,IAAS,IAAAA,IAAA,CAAKH,EAAO,KAAAA,EAAE,CAAG,EAAA;IAC5D;EACF;EAIAC,UAAA,CAAWL,aAAa,CAAE,CAAAQ,IAAA,CAAK;IAAEJ,EAAA;IAAID;GAAK,CAAA;EAGtC,IAAA,OAAOM,aAAa,WAAa,EAAA;IACnC;EACF;EAGM,MAAAC,cAAA,GAAiBD,SAASE,IAAK,CAAAC,gBAAA,CACnC,aAAaX,gBAAgB,GAAA,CAC/B;EACA,MAAMY,uBAAuBH,cAAe,CAAAI,MAAA;EAG5C,KAAA,IAASC,CAAI,GAAA,CAAA,EAAGA,CAAI,GAAAF,oBAAA,EAAsBE,CAAK,EAAA,EAAA;IACvCC,MAAAA,MAAAA,GAAQN,eAAeK,CAAC,CAAA;IAE9B,IAAI,CAAC,CAACC,MAAAA,IAASA,OAAMC,YAAa,CAAAhB,gBAAgB,MAAMG,EAAI,EAAA;MAC1D;IACF;EACF;EAGM,MAAAY,KAAA,GAAQP,QAAS,CAAAS,aAAA,CAAc,OAAO,CAAA;EAEtCF,KAAA,CAAAG,YAAA,CAAalB,kBAAkBG,EAAE,CAAA;EAevCY,KAAA,CAAMI,SAAY,GAAAjB,GAAA;EAGlB,IAAIU,oBAAsB,EAAA;IAClB,MAAAQ,SAAA,GAAYX,cAAe,CAAAG,oBAAA,GAAuB,CAAC,CAAA;IAEzD,IAAIQ,SAAW,EAAA;MACbA,SAAA,CAAUC,MAAMN,KAAK,CAAA;MACrB;IACF;EACF;EAGSP,QAAA,CAAAE,IAAA,CAAKY,YAAYP,KAAK,CAAA;AACjC;"}
|
|
@@ -29,7 +29,7 @@ function styleInject(css, id) {
|
|
|
29
29
|
}
|
|
30
30
|
const style = document.createElement("style");
|
|
31
31
|
style.setAttribute(SSR_NODE_DATA_ID, id);
|
|
32
|
-
style.
|
|
32
|
+
style.innerHTML = css;
|
|
33
33
|
if (injectedStylesLength) {
|
|
34
34
|
const lastStyle = injectedStyles[injectedStylesLength - 1];
|
|
35
35
|
if (lastStyle) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-inject.mjs","sources":["../../../../src/utils/nextjs/ssr/style-inject.ts"],"sourcesContent":["// #############################################################################\n// ! This file can't contain any imports, as it's copy-pasted into the bundled code!\n// #############################################################################\n\n/**\n * Name for the global object that will be used to store the SSR modules when injecting them into the page.\n */\nconst SSR_INJECT_ID = \"__styleInject_SSR_MODULES\";\n\n/**\n * Data attribute that indicates that given `<style>` node was injected by us\n */\nconst SSR_NODE_DATA_ID = \"data-uic-style\";\n\ntype InjectedModule = {\n /**\n * The ID of the style tag (typically some stable unique hash derived CSS content)\n */\n id: string;\n /**\n * The CSS string to inject\n */\n css: string;\n};\n\n// #############################################################################\n\n/**\n * Util to inject styles into the DOM, this is a patched version of the original styled-inject.\n *\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/rollup.config.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/scripts/rollup-plugin-local-style-inject.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/src/docs/helpers/style-inject.es.js\n * - Original styled-inject: https://github.com/egoist/style-inject/blob/master/src/index.js\n * - SSR Patch: https://github.com/egoist/style-inject/pull/28/files\n */\nexport default function styleInject(\n css: InjectedModule[\"css\"],\n id: InjectedModule[\"id\"],\n) {\n // Nothing to inject\n if (!css) {\n return;\n }\n\n // Patch missing global variable\n // @ts-expect-error Dangerously accessing globalThis\n if (!globalThis[SSR_INJECT_ID]) {\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID] = [];\n }\n\n // Exit early if the style is already injected/registered\n // @ts-expect-error Dangerously accessing globalThis\n if (globalThis[SSR_INJECT_ID].find((item) => item.id === id)) {\n return;\n }\n\n // Register the injected module\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID].push({ id, css });\n\n // Exit early as we can't inject styles on the server, registering is enough\n if (typeof document === \"undefined\") {\n return;\n }\n\n // Try to find either bookmark `<noscript/>` or last injected `<style/>`\n const injectedStyles = document.head.querySelectorAll(\n `:scope > [${SSR_NODE_DATA_ID}]`,\n );\n const injectedStylesLength = injectedStyles.length;\n\n // Check if the style is already injected and return early if needed\n for (let i = 0; i < injectedStylesLength; i++) {\n const style = injectedStyles[i];\n\n if (!!style && style.getAttribute(SSR_NODE_DATA_ID) === id) {\n return;\n }\n }\n\n // Create a style tag\n const style = document.createElement(\"style\");\n // Set a data element so for next DOM inject we can append to the last element we appended\n style.setAttribute(SSR_NODE_DATA_ID, id);\n
|
|
1
|
+
{"version":3,"file":"style-inject.mjs","sources":["../../../../src/utils/nextjs/ssr/style-inject.ts"],"sourcesContent":["// #############################################################################\n// ! This file can't contain any imports, as it's copy-pasted into the bundled code!\n// #############################################################################\n\n/**\n * Name for the global object that will be used to store the SSR modules when injecting them into the page.\n */\nconst SSR_INJECT_ID = \"__styleInject_SSR_MODULES\";\n\n/**\n * Data attribute that indicates that given `<style>` node was injected by us\n */\nconst SSR_NODE_DATA_ID = \"data-uic-style\";\n\ntype InjectedModule = {\n /**\n * The ID of the style tag (typically some stable unique hash derived CSS content)\n */\n id: string;\n /**\n * The CSS string to inject\n */\n css: string;\n};\n\n// #############################################################################\n\n/**\n * Util to inject styles into the DOM, this is a patched version of the original styled-inject.\n *\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/rollup.config.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/scripts/rollup-plugin-local-style-inject.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/src/docs/helpers/style-inject.es.js\n * - Original styled-inject: https://github.com/egoist/style-inject/blob/master/src/index.js\n * - SSR Patch: https://github.com/egoist/style-inject/pull/28/files\n */\nexport default function styleInject(\n css: InjectedModule[\"css\"],\n id: InjectedModule[\"id\"],\n) {\n // Nothing to inject\n if (!css) {\n return;\n }\n\n // Patch missing global variable\n // @ts-expect-error Dangerously accessing globalThis\n if (!globalThis[SSR_INJECT_ID]) {\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID] = [];\n }\n\n // Exit early if the style is already injected/registered\n // @ts-expect-error Dangerously accessing globalThis\n if (globalThis[SSR_INJECT_ID].find((item) => item.id === id)) {\n return;\n }\n\n // Register the injected module\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID].push({ id, css });\n\n // Exit early as we can't inject styles on the server, registering is enough\n if (typeof document === \"undefined\") {\n return;\n }\n\n // Try to find either bookmark `<noscript/>` or last injected `<style/>`\n const injectedStyles = document.head.querySelectorAll(\n `:scope > [${SSR_NODE_DATA_ID}]`,\n );\n const injectedStylesLength = injectedStyles.length;\n\n // Check if the style is already injected and return early if needed\n for (let i = 0; i < injectedStylesLength; i++) {\n const style = injectedStyles[i];\n\n if (!!style && style.getAttribute(SSR_NODE_DATA_ID) === id) {\n return;\n }\n }\n\n // Create a style tag\n const style = document.createElement(\"style\");\n // Set a data element so for next DOM inject we can append to the last element we appended\n style.setAttribute(SSR_NODE_DATA_ID, id);\n /**\n * Experimented with various ways of injecting the CSS as many approaches escapes certain CSS. E.g. `content: \"\";` -->\n * `content:&qout;&qout;;;` which would partially break the given style tag and cause random layout issues as partial\n * styles would be applied.\n *\n * - Didn't work as escaped the CSS content:\n * - `style.textContent = css;`\n * - `style.innerText = css;`\n * Old way:\n * - `style.styleSheet.cssText = css`\n * Worked:\n * - `style.innerHTML = css;\n * TODO: maybe in 2025 look at `CSSStyleSheet` constructor and `insertRule` method - https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet\n */\n style.innerHTML = css;\n\n // Attempt to append the style (to preserve overriding logic with styled-components)\n if (injectedStylesLength) {\n const lastStyle = injectedStyles[injectedStylesLength - 1];\n\n if (lastStyle) {\n lastStyle.after(style);\n return;\n }\n }\n\n // If that didn't work append to end of head (should have been handled by the bookmark, but just in case)\n document.head.appendChild(style);\n}\n"],"names":["SSR_INJECT_ID","SSR_NODE_DATA_ID","styleInject","css","id","globalThis","find","item","push","document","injectedStyles","head","querySelectorAll","injectedStylesLength","length","i","style","getAttribute","createElement","setAttribute","innerHTML","lastStyle","after","appendChild"],"mappings":";;AAOA,MAAMA,aAAgB,GAAA,2BAAA;AAKtB,MAAMC,gBAAmB,GAAA,gBAAA;AAwBD,SAAAC,WAAAA,CACtBC,KACAC,EACA,EAAA;EAEA,IAAI,CAACD,GAAK,EAAA;IACR;EACF;EAII,IAAA,CAACE,UAAW,CAAAL,aAAa,CAAG,EAAA;IAEnBK,UAAA,CAAAL,aAAa,IAAI,EAAC;EAC/B;EAII,IAAAK,UAAA,CAAWL,aAAa,CAAE,CAAAM,IAAA,CAAMC,IAAS,IAAAA,IAAA,CAAKH,EAAO,KAAAA,EAAE,CAAG,EAAA;IAC5D;EACF;EAIAC,UAAA,CAAWL,aAAa,CAAE,CAAAQ,IAAA,CAAK;IAAEJ,EAAA;IAAID;GAAK,CAAA;EAGtC,IAAA,OAAOM,aAAa,WAAa,EAAA;IACnC;EACF;EAGM,MAAAC,cAAA,GAAiBD,SAASE,IAAK,CAAAC,gBAAA,CACnC,aAAaX,gBAAgB,GAAA,CAC/B;EACA,MAAMY,uBAAuBH,cAAe,CAAAI,MAAA;EAG5C,KAAA,IAASC,CAAI,GAAA,CAAA,EAAGA,CAAI,GAAAF,oBAAA,EAAsBE,CAAK,EAAA,EAAA;IACvCC,MAAAA,MAAAA,GAAQN,eAAeK,CAAC,CAAA;IAE9B,IAAI,CAAC,CAACC,MAAAA,IAASA,OAAMC,YAAa,CAAAhB,gBAAgB,MAAMG,EAAI,EAAA;MAC1D;IACF;EACF;EAGM,MAAAY,KAAA,GAAQP,QAAS,CAAAS,aAAA,CAAc,OAAO,CAAA;EAEtCF,KAAA,CAAAG,YAAA,CAAalB,kBAAkBG,EAAE,CAAA;EAevCY,KAAA,CAAMI,SAAY,GAAAjB,GAAA;EAGlB,IAAIU,oBAAsB,EAAA;IAClB,MAAAQ,SAAA,GAAYX,cAAe,CAAAG,oBAAA,GAAuB,CAAC,CAAA;IAEzD,IAAIQ,SAAW,EAAA;MACbA,SAAA,CAAUC,MAAMN,KAAK,CAAA;MACrB;IACF;EACF;EAGSP,QAAA,CAAAE,IAAA,CAAKY,YAAYP,KAAK,CAAA;AACjC;"}
|