@fluentic/style 0.1.0-beta.1 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -2
- package/README.md +80 -23
- package/atomic/atRule/utils.ts +3 -2
- package/atomic/className.ts +25 -4
- package/atomic/debug/className/className.ts +23 -2
- package/atomic/element.ts +5 -2
- package/atomic/theme.ts +4 -2
- package/atomic/token.ts +4 -2
- package/atomic/utils/css.ts +44 -19
- package/atomic/utils/format.ts +1 -1
- package/atomic/utils/hash.ts +78 -0
- package/atomic/var.ts +3 -2
- package/builder/classname/class_name_builder.ts +447 -0
- package/builder/classname/fns.ts +77 -0
- package/builder/classname/index.ts +3 -0
- package/builder/classname/types.ts +34 -0
- package/builder/data/create.ts +6 -6
- package/builder/data/data.ts +7 -7
- package/builder/data/debug.ts +1 -0
- package/builder/data/is.ts +3 -3
- package/builder/data/merge/scope.ts +18 -19
- package/builder/data/merge/style.ts +11 -0
- package/builder/data/state.ts +1 -0
- package/builder/style_builder.ts +17 -17
- package/builder/style_fns.ts +33 -33
- package/builder/types/alias.ts +10 -10
- package/builder/types/fns.ts +11 -11
- package/builder/types/types.ts +5 -5
- package/compiler/compiler/types.ts +0 -1
- package/compiler/transform/debug/plugin.ts +8 -3
- package/compiler/transform/debug/utils/debug_data.ts +73 -0
- package/compiler/transform/evaluator/evaluator.ts +33 -2
- package/compiler/transform/evaluator/tracer.ts +13 -9
- package/compiler/transform/extract/chain/chain.ts +596 -28
- package/compiler/transform/extract/plugin.ts +5 -2
- package/compiler/transform/extract/utils/state.ts +1 -0
- package/compiler/utils/constants.ts +4 -4
- package/compiler/utils/file_resolver.ts +1 -0
- package/compiler/utils/import_source.ts +3 -2
- package/config/build.ts +12 -2
- package/config/config/css.ts +3 -0
- package/config/config/debug.ts +13 -1
- package/config/config/dev.ts +17 -1
- package/config/configure.ts +10 -2
- package/config/types.ts +7 -0
- package/dev/config.ts +2 -3
- package/dialect/extracted/index.ts +5 -0
- package/dialect/index.ts +1 -0
- package/dialect/namedTokens.ts +136 -0
- package/dist/{className-C1Ht5Wvv.js → className-CKo4TxuT.js} +2 -2
- package/dist/{className-C1Ht5Wvv.js.map → className-CKo4TxuT.js.map} +1 -1
- package/dist/{className-DC2Cq8p3.js → className-ZJ5pBA-o.js} +19 -7
- package/dist/className-ZJ5pBA-o.js.map +1 -0
- package/dist/compiler/index.mjs +1 -1
- package/dist/{compiler-DENc3a2R.mjs → compiler-D5v5tJXI.mjs} +607 -114
- package/dist/compiler-D5v5tJXI.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/{config-BryWDfQX.js → config-BEvP7108.js} +12 -4
- package/dist/config-BEvP7108.js.map +1 -0
- package/dist/config-B_cbG3S6.js +1 -0
- package/dist/config-FIfi5aJ8.js +32 -0
- package/dist/config-FIfi5aJ8.js.map +1 -0
- package/dist/config-OXHoDUIo.js +6 -0
- package/dist/{config-Di2VYYKV.js.map → config-OXHoDUIo.js.map} +1 -1
- package/dist/css-CELBp6Gu.js +58 -0
- package/dist/css-CELBp6Gu.js.map +1 -0
- package/dist/{css-BowBszUt.js → css-DcuJ_jSH.js} +17 -17
- package/dist/css-DcuJ_jSH.js.map +1 -0
- package/dist/{css-ByOrugEX.js → css-dPoZJDQH.js} +80 -78
- package/dist/css-dPoZJDQH.js.map +1 -0
- package/dist/{css-DcazYor9.js → css-oOt6ZR54.js} +10 -8
- package/dist/css-oOt6ZR54.js.map +1 -0
- package/dist/css.js +1 -1
- package/dist/{css_extra-DlOnsnR1.js → css_extra-DQdCrYoC.js} +2 -2
- package/dist/{css_extra-DlOnsnR1.js.map → css_extra-DQdCrYoC.js.map} +1 -1
- package/dist/{css_extra-oIi3UEPK.js → css_extra-DeTuIlcO.js} +2 -2
- package/dist/{css_extra-oIi3UEPK.js.map → css_extra-DeTuIlcO.js.map} +1 -1
- package/dist/{data-BsqOa5br.js → data-CeYstKMP.js} +21 -12
- package/dist/data-CeYstKMP.js.map +1 -0
- package/dist/{debug-n2aZQBSa.js → debug-D96KGgpH.js} +3 -3
- package/dist/debug-D96KGgpH.js.map +1 -0
- package/dist/dev/rsc.js +9 -9
- package/dist/{dev-CcphAa3R.js → dev-fOtWB5K3.js} +7 -8
- package/dist/{dev-CcphAa3R.js.map → dev-fOtWB5K3.js.map} +1 -1
- package/dist/{dev-DfBbuLeE.js → dev-p8tW7X-A.js} +14 -4
- package/dist/dev-p8tW7X-A.js.map +1 -0
- package/dist/dev.js +1 -1
- package/dist/dialect/extracted/index.js +2 -0
- package/dist/dialect/index.js +2 -0
- package/dist/{elementMarker-Bu7gDAkE.js → elementMarker-CvqqIb7J.js} +10 -8
- package/dist/{elementMarker-Bu7gDAkE.js.map → elementMarker-CvqqIb7J.js.map} +1 -1
- package/dist/entry/dev/css.js +2 -2
- package/dist/entry/dev/jsx-dev-runtime.js +2 -1
- package/dist/entry/dev/jsx-runtime.js +2 -1
- package/dist/entry/dev.js +12 -9
- package/dist/entry/prod/css.js +2 -2
- package/dist/entry/prod/jsx-dev-runtime.js +2 -2
- package/dist/entry/prod/jsx-runtime.js +2 -2
- package/dist/entry/prod/runtime.js +4 -4
- package/dist/entry/prod.js +8 -8
- package/dist/entry/prod.js.map +1 -1
- package/dist/entry/rsc-dev/css.js +2 -2
- package/dist/entry/rsc-dev/dev.js +4 -5
- package/dist/entry/rsc-dev/dev.js.map +1 -1
- package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
- package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
- package/dist/entry/rsc-dev.js +341 -105
- package/dist/entry/rsc-dev.js.map +1 -1
- package/dist/entry/rsc-prod/css.js +2 -2
- package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
- package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
- package/dist/entry/rsc-prod/runtime.js +4 -4
- package/dist/entry/rsc-prod.js +7 -7
- package/dist/extract-DeOytHKW.js +2 -0
- package/dist/{getClassName-BlvXHYuf.js → getClassName-oiQ8CnkS.js} +3 -3
- package/dist/getClassName-oiQ8CnkS.js.map +1 -0
- package/dist/global-Cul1dX8k.js +14 -0
- package/dist/{global-CvfmFLsK.js.map → global-Cul1dX8k.js.map} +1 -1
- package/dist/global-zaCE-g1C.js +31 -0
- package/dist/global-zaCE-g1C.js.map +1 -0
- package/dist/{format-3nKBE_5t.js → hash-Bycpk3MR.js} +53 -37
- package/dist/hash-Bycpk3MR.js.map +1 -0
- package/dist/index.js +10 -8
- package/dist/jsx/jsx-dev-runtime.js +2 -2
- package/dist/jsx/jsx-dev-runtime.server.js +1 -1
- package/dist/jsx/jsx-runtime.js +2 -2
- package/dist/jsx/jsx-runtime.server.js +1 -1
- package/dist/{jsx-D2BksHSv.js → jsx-A4cK517J.js} +7 -7
- package/dist/{jsx-D2BksHSv.js.map → jsx-A4cK517J.js.map} +1 -1
- package/dist/{jsx-CwTeyUxr.js → jsx-Ba-XV33u.js} +3 -3
- package/dist/{jsx-CwTeyUxr.js.map → jsx-Ba-XV33u.js.map} +1 -1
- package/dist/{jsx_dev_runtime-B6xs4by8.js → jsx_dev_runtime-BQcRzl5D.js} +2 -2
- package/dist/{jsx_dev_runtime-B6xs4by8.js.map → jsx_dev_runtime-BQcRzl5D.js.map} +1 -1
- package/dist/{jsx_runtime-iHLDwpcW.js → jsx_runtime-B9KEoAQN.js} +2 -2
- package/dist/{jsx_runtime-iHLDwpcW.js.map → jsx_runtime-B9KEoAQN.js.map} +1 -1
- package/dist/{jsx_runtime-04xfnsi7.js → jsx_runtime-BXcbW8Yp.js} +2 -2
- package/dist/{jsx_runtime-04xfnsi7.js.map → jsx_runtime-BXcbW8Yp.js.map} +1 -1
- package/dist/{layer-D1SaH07m.js → layer-CbQzwZF-.js} +4 -4
- package/dist/{layer-D1SaH07m.js.map → layer-CbQzwZF-.js.map} +1 -1
- package/dist/{loader-B5Kw0DD-.mjs → loader-BAth2yZ1.mjs} +3 -3
- package/dist/{loader-B5Kw0DD-.mjs.map → loader-BAth2yZ1.mjs.map} +1 -1
- package/dist/{misc-DCdYYyhK.mjs → misc-DFBKJGLT.mjs} +7 -3
- package/dist/{misc-DCdYYyhK.mjs.map → misc-DFBKJGLT.mjs.map} +1 -1
- package/dist/namedTokens-BUa6raTb.js +83 -0
- package/dist/namedTokens-BUa6raTb.js.map +1 -0
- package/dist/plugin/farm/index.mjs +2 -2
- package/dist/plugin/nextjs/index.mjs +4 -4
- package/dist/plugin/nextjs/loader.mjs +4 -4
- package/dist/plugin/parcel/optimizer.cjs +1 -1
- package/dist/plugin/parcel/optimizer.mjs +2 -2
- package/dist/plugin/parcel/resolver.cjs +1 -1
- package/dist/plugin/parcel/resolver.mjs +2 -2
- package/dist/plugin/parcel/runtime.cjs +1 -1
- package/dist/plugin/parcel/runtime.mjs +1 -1
- package/dist/plugin/parcel/transformer.cjs +1 -1
- package/dist/plugin/parcel/transformer.mjs +2 -2
- package/dist/plugin/rspack/index.mjs +1 -1
- package/dist/plugin/vite/index.mjs +11 -8
- package/dist/plugin/vite/index.mjs.map +1 -1
- package/dist/plugin/webpack/index.mjs +1 -1
- package/dist/plugin/webpack/loader.mjs +2 -2
- package/dist/presets/tailwind/index.js +971 -0
- package/dist/presets/tailwind/index.js.map +1 -0
- package/dist/{property-CnLFt5kx.js → property-CF6JgpTq.js} +2 -2
- package/dist/{property-CnLFt5kx.js.map → property-CF6JgpTq.js.map} +1 -1
- package/dist/{registry-yHLRxyoo.mjs → registry-CiwvMfx8.mjs} +2 -2
- package/dist/{registry-yHLRxyoo.mjs.map → registry-CiwvMfx8.mjs.map} +1 -1
- package/dist/{rules-9HSO1pxL.js → rules-DlXcch7-.js} +13 -10
- package/dist/rules-DlXcch7-.js.map +1 -0
- package/dist/runtime-BKChZZ2-.js +52 -0
- package/dist/runtime-BKChZZ2-.js.map +1 -0
- package/dist/server.js +13 -11
- package/dist/server.js.map +1 -1
- package/dist/{shared-CxbHR89f.mjs → shared-x59dI2NW.mjs} +4 -4
- package/dist/{shared-CxbHR89f.mjs.map → shared-x59dI2NW.mjs.map} +1 -1
- package/dist/{shared-CBArHB9-.cjs → shared-yDD0nfm1.cjs} +603 -110
- package/dist/shared-yDD0nfm1.cjs.map +1 -0
- package/dist/sheet-B-uJfHRY.js +7 -0
- package/dist/sheet-B-uJfHRY.js.map +1 -0
- package/dist/{sidecar-BFakLl0X.mjs → sidecar-CJ6i4wmn.mjs} +3 -3
- package/dist/{sidecar-BFakLl0X.mjs.map → sidecar-CJ6i4wmn.mjs.map} +1 -1
- package/dist/{style-B1UUqjj5.js → style-91J0B5ef.js} +35 -7
- package/dist/style-91J0B5ef.js.map +1 -0
- package/dist/{style-v2bf70TZ.js → style-Bw5ka-Nq.js} +440 -135
- package/dist/style-Bw5ka-Nq.js.map +1 -0
- package/dist/{style-DgHbdbdF.js → style-DFFK06Of.js} +258 -82
- package/dist/style-DFFK06Of.js.map +1 -0
- package/dist/style-pz8e5To1.js +5 -0
- package/dist/{styleStore-DyNXBcUK.js → styleStore-DJ0Msgkh.js} +6 -5
- package/dist/{styleStore-DyNXBcUK.js.map → styleStore-DJ0Msgkh.js.map} +1 -1
- package/dist/{styleStore-Dea_WVbr.js → styleStore-ydQcDBD4.js} +16 -7
- package/dist/styleStore-ydQcDBD4.js.map +1 -0
- package/dist/token-DTOyFLmp.js +58 -0
- package/dist/token-DTOyFLmp.js.map +1 -0
- package/dist/{token-u_tM-mtg.js → token-DT_sCPtm.js} +125 -31
- package/dist/token-DT_sCPtm.js.map +1 -0
- package/dist/{trace-Bu_qOqRy.js → trace-CO36aenp.js} +3 -3
- package/dist/{trace-Bu_qOqRy.js.map → trace-CO36aenp.js.map} +1 -1
- package/dist/{trace-CU0rvNYr.js → trace-D8j96G57.js} +2 -2
- package/dist/{trace-CU0rvNYr.js.map → trace-D8j96G57.js.map} +1 -1
- package/dist/transform-BTJOg8Hg.js +23 -0
- package/dist/transform-BTJOg8Hg.js.map +1 -0
- package/dist/{utils-CWNHx4EC.js → utils-Bmw655wa.js} +3 -3
- package/dist/{utils-CWNHx4EC.js.map → utils-Bmw655wa.js.map} +1 -1
- package/dist/{utils-CEaq_c-A.mjs → utils-D2fygyTm.mjs} +4 -4
- package/dist/{utils-CEaq_c-A.mjs.map → utils-D2fygyTm.mjs.map} +1 -1
- package/dist/{utils-Bdbqn0f8.mjs → utils-DTXCTUlS.mjs} +3 -3
- package/dist/{utils-Bdbqn0f8.mjs.map → utils-DTXCTUlS.mjs.map} +1 -1
- package/dist/{utils-BbehLOby.js → utils-DVFxZnVC.js} +159 -76
- package/dist/utils-DVFxZnVC.js.map +1 -0
- package/dist/{utils-D7FAOyg6.js → utils-hoYnMiA7.js} +4 -4
- package/dist/{utils-D7FAOyg6.js.map → utils-hoYnMiA7.js.map} +1 -1
- package/dist/utils.js +3 -3
- package/dist/value-D-ZcRzLA.js +42 -0
- package/dist/value-D-ZcRzLA.js.map +1 -0
- package/dist/{value-BR4e2MKt.js → value-DvFkGBy2.js} +147 -28
- package/dist/value-DvFkGBy2.js.map +1 -0
- package/dist/value-dG9LK0Gq.js +85 -0
- package/dist/value-dG9LK0Gq.js.map +1 -0
- package/dist/{valueRef-lshFk1Cs.js → valueRef-CsLVJwjA.js} +2 -2
- package/dist/{valueRef-lshFk1Cs.js.map → valueRef-CsLVJwjA.js.map} +1 -1
- package/dist/{webpack-Dh6lox2l.mjs → webpack-BOU7_xld.mjs} +5 -5
- package/dist/{webpack-Dh6lox2l.mjs.map → webpack-BOU7_xld.mjs.map} +1 -1
- package/entry/dev/config.ts +1 -1
- package/entry/dev/index.ts +1 -0
- package/entry/dev/jsx_dev_runtime.ts +1 -0
- package/entry/dev/jsx_runtime.ts +1 -0
- package/entry/dev/sheet.ts +4 -0
- package/entry/prod/runtime.ts +1 -1
- package/entry/rsc_dev/config.ts +1 -1
- package/entry/rsc_dev/server.ts +1 -1
- package/entry/rsc_prod/runtime.ts +1 -1
- package/entry/rsc_prod/server.ts +1 -1
- package/entry/shared/config_dev.ts +12 -0
- package/entry/shared/dev.ts +11 -2
- package/entry/shared/utils.ts +28 -0
- package/package.json +26 -9
- package/plugin/bundler/vite/plugin.ts +2 -1
- package/plugin/bundler/vite/state.ts +10 -5
- package/plugin/utils/runtimeEntry.ts +12 -0
- package/presets/tailwind/classname/index.ts +2 -0
- package/presets/tailwind/classname/transform.ts +208 -0
- package/presets/tailwind/classname/types.ts +124 -0
- package/presets/tailwind/index.ts +5 -0
- package/presets/tailwind/selectors.ts +27 -0
- package/presets/tailwind/style/index.ts +2 -0
- package/presets/tailwind/style/transform.ts +430 -0
- package/presets/tailwind/style/types.ts +346 -0
- package/presets/tailwind/theme.ts +479 -0
- package/presets/tailwind/types.ts +147 -0
- package/runtime/core/cache/pool.ts +1 -1
- package/runtime/extract/getClassName.ts +1 -6
- package/runtime/extract/index.ts +1 -1
- package/runtime/index.ts +8 -1
- package/runtime/types.ts +4 -2
- package/style/classname.ts +41 -0
- package/style/index.ts +1 -0
- package/style/style.ts +30 -11
- package/style/theme.ts +4 -2
- package/style/transform.ts +41 -2
- package/utils/hash.ts +4 -0
- package/atomic/layer/README.md +0 -116
- package/dist/className-DC2Cq8p3.js.map +0 -1
- package/dist/compiler-DENc3a2R.mjs.map +0 -1
- package/dist/config-BryWDfQX.js.map +0 -1
- package/dist/config-DKHXWhe1.js +0 -1
- package/dist/config-Di2VYYKV.js +0 -6
- package/dist/config-DloHOG6I.js +0 -13
- package/dist/config-DloHOG6I.js.map +0 -1
- package/dist/css-BowBszUt.js.map +0 -1
- package/dist/css-ByOrugEX.js.map +0 -1
- package/dist/css-DcazYor9.js.map +0 -1
- package/dist/data-BsqOa5br.js.map +0 -1
- package/dist/debug-BAw63qX6.js +0 -15
- package/dist/debug-BAw63qX6.js.map +0 -1
- package/dist/debug-DGki_v7g.js +0 -15
- package/dist/debug-DGki_v7g.js.map +0 -1
- package/dist/debug-n2aZQBSa.js.map +0 -1
- package/dist/dev-DfBbuLeE.js.map +0 -1
- package/dist/extract-DEwSDJ9Z.js +0 -2
- package/dist/format-3nKBE_5t.js.map +0 -1
- package/dist/getClassName-BlvXHYuf.js.map +0 -1
- package/dist/global-CvfmFLsK.js +0 -11
- package/dist/rules-9HSO1pxL.js.map +0 -1
- package/dist/runtime-CYqNCiaM.js +0 -53
- package/dist/runtime-CYqNCiaM.js.map +0 -1
- package/dist/shared-CBArHB9-.cjs.map +0 -1
- package/dist/style-B-6jHipw.js +0 -5
- package/dist/style-B1UUqjj5.js.map +0 -1
- package/dist/style-DgHbdbdF.js.map +0 -1
- package/dist/style-v2bf70TZ.js.map +0 -1
- package/dist/styleStore-Dea_WVbr.js.map +0 -1
- package/dist/token-u_tM-mtg.js.map +0 -1
- package/dist/utils-BbehLOby.js.map +0 -1
- package/dist/value-BR4e2MKt.js.map +0 -1
- package/dist/value-E8rEv2Oe.js +0 -136
- package/dist/value-E8rEv2Oe.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-
|
|
1
|
+
{"version":3,"file":"utils-D2fygyTm.mjs","names":[],"sources":["../plugin/nextjs/constants.ts","../plugin/nextjs/utils.ts"],"sourcesContent":["import { STYLE_IMPORTS } from '../utils/imports';\n\nexport const DEV_CSS_ROUTE = '/__fluentic/dev.css';\n\nexport const LOADER_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/loader';\n\nexport const CSS_ENTRY_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/bundle.css';\n","import { createHash } from 'node:crypto';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport type { Compiler as PluginCompiler } from '../../compiler';\nimport { normalizePath } from '../../compiler/utils/path';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport { createWebpackRegistry } from '../bundler/webpack/shared/registry';\nimport type { FileCssCache } from '../utils/cache';\nimport type { PluginOptions as BasePluginOptions } from '../utils/compiler';\nimport type { TransformFilter } from '../utils/filter';\nimport { getPluginBuildConfig, getPluginBuildDevConfig } from '../utils/runtimeEntry';\nimport type { SourcemapSidecar } from '../utils/sidecar';\nimport { resolvePluginSourcemapOptions } from '../utils/sourcemap';\nimport { LOADER_IMPORT_PATH } from './constants';\nimport type { PluginOptions, WebpackConfiguration } from './types';\n\nexport const nextRegistry = createWebpackRegistry('nextjs.registry');\n\nexport const PRECOLLECT_CACHE_DIRS = {\n dev: 'nextjs/precollect/dev',\n prod: 'nextjs/precollect/prod',\n};\n\nexport const NEXT_COMPILER_IDS = {\n turbopack: 'nextjs:turbopack',\n webpackServer: 'nextjs:webpack-server',\n webpackClient: 'nextjs:webpack-client',\n};\n\nexport type { PluginCompiler };\n\nexport type NextLoaderState = {\n compiler: PluginCompiler;\n filter: TransformFilter;\n dev: boolean;\n isServer: boolean;\n configHash: string;\n devCssHref: string | null;\n cssEntryImportPath: string;\n cssCache: Pick<FileCssCache, 'setFileCss'> | null;\n};\n\nexport type NextWebpackEntryValue = string | string[] | {\n import?: string | string[];\n [key: string]: unknown;\n};\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(LOADER_IMPORT_PATH);\n}\n\nexport function getNextCacheDir(rootDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(rootDir, '.next/cache/fluentic-style');\n}\n\nexport function getNextPrecollectCacheSubdir(dev: boolean) {\n return dev ? PRECOLLECT_CACHE_DIRS.dev : PRECOLLECT_CACHE_DIRS.prod;\n}\n\nexport function createNextBuildConfig(options: PluginOptions): BuildConfig {\n return getPluginBuildConfig(options);\n}\n\nexport function createNextBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n return getPluginBuildDevConfig(options);\n}\n\nexport function createNextConfigHash(\n buildConfig: BuildConfig,\n dev: boolean,\n) {\n const values = [\n dev ? 'dev' : 'prod',\n buildConfig.hoist ? 'hoist' : 'no-hoist',\n ];\n\n return createHash('sha256').update(values.join('\\0')).digest('hex');\n}\n\nexport function resolveNextCompilerOptions(\n options: PluginOptions,\n sidecar: SourcemapSidecar | null,\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n dev: boolean,\n): BasePluginOptions {\n const resolved = resolvePluginSourcemapOptions({\n ...options,\n devSourcemap: dev ? 'sidecarServer' : 'sourceUrl',\n }, sidecar);\n\n return {\n ...resolved,\n css: {\n ...resolved.css,\n ...buildConfig.css,\n },\n dev: {\n ...resolved.dev,\n ...buildDevConfig,\n },\n };\n}\n\nexport function removeUndefinedValues<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item) => removeUndefinedValues(item)) as T;\n }\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, item] of Object.entries(value)) {\n if (item !== undefined) {\n result[key] = removeUndefinedValues(item);\n }\n }\n\n return result as T;\n}\n\nexport function prependClientEntry(entry: unknown, moduleId: string) {\n if (typeof entry === 'function') {\n return async () => prependClientEntry(await entry(), moduleId);\n }\n\n if (!entry || typeof entry !== 'object') return entry;\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependEntryValue(value as NextWebpackEntryValue, moduleId);\n }\n\n return result;\n}\n\nexport function prependEntryValue(entry: NextWebpackEntryValue, moduleId: string): NextWebpackEntryValue {\n if (typeof entry === 'string') {\n return entry === moduleId ? entry : [moduleId, entry];\n }\n\n if (Array.isArray(entry)) {\n return entry.includes(moduleId) ? entry : [moduleId, ...entry];\n }\n\n const imports = entry.import;\n if (!imports) return { ...entry, import: moduleId };\n\n return {\n ...entry,\n import: Array.isArray(imports)\n ? imports.includes(moduleId) ? imports : [moduleId, ...imports]\n : imports === moduleId\n ? imports\n : [moduleId, imports],\n };\n}\n\nexport function isAppLayoutFile(filePath: string) {\n return /\\/app\\/(?:[^/]+\\/)*layout\\.[cm]?[jt]sx?$/.test(normalizePath(filePath));\n}\n\nexport function hasCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function replaceCssMarker(source: string, marker: string, css: string) {\n return source.split(marker).join(css);\n}\n\nexport function addAliases(config: WebpackConfiguration, aliases: Record<string, string>) {\n if (!config.resolve) config.resolve = {};\n if (!config.resolve.alias) config.resolve.alias = {};\n Object.assign(config.resolve.alias, aliases);\n}\n\nexport function addWebpackPlugin(config: WebpackConfiguration, plugin: WebpackPluginInstance) {\n if (!config.plugins) config.plugins = [];\n config.plugins.push(plugin);\n}\n\nexport function replaceCssMarkerAsset(args: {\n compiler: Compiler;\n compilation: Compilation;\n css: string;\n marker: string;\n}) {\n for (const asset of args.compilation.getAssets()) {\n if (!asset.name.endsWith('.css')) continue;\n\n const source = asset.source.source().toString();\n if (!hasCssMarker(source, args.marker)) continue;\n\n args.compilation.updateAsset(\n asset.name,\n new args.compiler.webpack.sources.RawSource(\n replaceCssMarker(source, args.marker, args.css),\n ),\n );\n\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAEA,MAAa,gBAAgB;AAE7B,MAAa,qBAAqB,cAAc,SAAS;AAEzD,MAAa,wBAAwB,cAAc,SAAS;;;ACW5D,MAAa,eAAe,sBAAsB,iBAAiB;AAEnE,MAAa,wBAAwB;CACnC,KAAK;CACL,MAAM;AACR;AAEA,MAAa,oBAAoB;CAC/B,WAAW;CACX,eAAe;CACf,eAAe;AACjB;AAoBA,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,kBAAkB;AAClE;AAEA,SAAgB,gBAAgB,SAAiB,UAAmB;CAClE,OAAO,YAAY,KAAK,KAAK,SAAS,4BAA4B;AACpE;AAEA,SAAgB,6BAA6B,KAAc;CACzD,OAAO,MAAM,sBAAsB,MAAM,sBAAsB;AACjE;AAEA,SAAgB,sBAAsB,SAAqC;CACzE,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,yBAAyB,SAA+C;CACtF,OAAO,wBAAwB,OAAO;AACxC;AAEA,SAAgB,qBACd,aACA,KACA;CACA,MAAM,SAAS,CACb,MAAM,QAAQ,QACd,YAAY,QAAQ,UAAU,UAChC;CAEA,OAAO,WAAW,QAAQ,EAAE,OAAO,OAAO,KAAK,IAAI,CAAC,EAAE,OAAO,KAAK;AACpE;AAEA,SAAgB,2BACd,SACA,SACA,aACA,gBACA,KACmB;CACnB,MAAM,WAAW,8BAA8B;EAC7C,GAAG;EACH,cAAc,MAAM,kBAAkB;CACxC,GAAG,OAAO;CAEV,OAAO;EACL,GAAG;EACH,KAAK;GACH,GAAG,SAAS;GACZ,GAAG,YAAY;EACjB;EACA,KAAK;GACH,GAAG,SAAS;GACZ,GAAG;EACL;CACF;AACF;AAEA,SAAgB,sBAAyB,OAAa;CACpD,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,KAAK,SAAS,sBAAsB,IAAI,CAAC;CAGxD,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAGT,MAAM,SAAkC,CAAC;CAEzC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,KAAK,GAC5C,IAAI,SAAS,KAAA,GACX,OAAO,OAAO,sBAAsB,IAAI;CAI5C,OAAO;AACT;AAwCA,SAAgB,gBAAgB,UAAkB;CAChD,OAAO,2CAA2C,KAAK,cAAc,QAAQ,CAAC;AAChF;AAEA,SAAgB,aAAa,QAAgB,QAAgB;CAC3D,OAAO,OAAO,SAAS,MAAM;AAC/B;AAEA,SAAgB,iBAAiB,QAAgB,QAAgB,KAAa;CAC5E,OAAO,OAAO,MAAM,MAAM,EAAE,KAAK,GAAG;AACtC;AAEA,SAAgB,WAAW,QAA8B,SAAiC;CACxF,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,IAAI,CAAC,OAAO,QAAQ,OAAO,OAAO,QAAQ,QAAQ,CAAC;CACnD,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AAC7C;AAEA,SAAgB,iBAAiB,QAA8B,QAA+B;CAC5F,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,OAAO,QAAQ,KAAK,MAAM;AAC5B;AAEA,SAAgB,sBAAsB,MAKnC;CACD,KAAK,MAAM,SAAS,KAAK,YAAY,UAAU,GAAG;EAChD,IAAI,CAAC,MAAM,KAAK,SAAS,MAAM,GAAG;EAElC,MAAM,SAAS,MAAM,OAAO,OAAO,EAAE,SAAS;EAC9C,IAAI,CAAC,aAAa,QAAQ,KAAK,MAAM,GAAG;EAExC,KAAK,YAAY,YACf,MAAM,MACN,IAAI,KAAK,SAAS,QAAQ,QAAQ,UAChC,iBAAiB,QAAQ,KAAK,QAAQ,KAAK,GAAG,CAChD,CACF;EAEA,OAAO;CACT;CAEA,OAAO;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as normalizePath } from "./compiler-
|
|
2
|
-
import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-
|
|
1
|
+
import { o as normalizePath } from "./compiler-D5v5tJXI.mjs";
|
|
2
|
+
import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-CiwvMfx8.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region plugin/bundler/webpack/utils.ts
|
|
@@ -46,4 +46,4 @@ function prependEntryImport(entryImport, runtimeFilePath) {
|
|
|
46
46
|
//#endregion
|
|
47
47
|
export { prependWebpackRuntimeEntry as a, hasWebpackCssMarker as i, getStylePackageDistPath as n, replaceWebpackCssMarker as o, getTransformLoaderPath as r, webpackRegistry as s, createWebpackRuntimeModuleSource as t };
|
|
48
48
|
|
|
49
|
-
//# sourceMappingURL=utils-
|
|
49
|
+
//# sourceMappingURL=utils-DTXCTUlS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-
|
|
1
|
+
{"version":3,"file":"utils-DTXCTUlS.mjs","names":[],"sources":["../plugin/bundler/webpack/utils.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { EntryNormalized } from 'webpack';\nimport { normalizePath } from '../../../compiler/utils/path';\nimport { SIDECAR_URL_GLOBAL_SYMBOL } from '../../../config/utils';\nimport type { PluginCompiler } from '../../utils';\nimport { STYLE_IMPORTS } from '../../utils/imports';\nimport { createWebpackRegistry } from './shared/registry';\n\ntype WebpackStaticEntry = Exclude<EntryNormalized, () => Promise<unknown>>;\ntype WebpackEntryDescription = WebpackStaticEntry[string];\n\nexport type WebpackLoaderState = {\n transform: PluginCompiler['transform'];\n};\n\nexport const webpackRegistry = createWebpackRegistry('webpack.registry');\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(STYLE_IMPORTS.Plugin + '/webpack/loader');\n}\n\nexport function getStylePackageDistPath() {\n return path.resolve(path.dirname(getTransformLoaderPath()), '../..');\n}\n\nexport function createWebpackRuntimeModuleSource(\n extract: boolean,\n cssFilePath: string | null,\n options: {\n runtimeImportPath?: string | null;\n sidecarUrl?: string | null;\n } = {},\n) {\n return [\n extract && cssFilePath && `import ${JSON.stringify(normalizePath(cssFilePath))};`,\n options.sidecarUrl && options.runtimeImportPath && `import ${JSON.stringify(options.runtimeImportPath)};`,\n options.sidecarUrl &&\n `globalThis[Symbol.for(${JSON.stringify(SIDECAR_URL_GLOBAL_SYMBOL)})] = ${JSON.stringify(options.sidecarUrl)};`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function replaceWebpackCssMarker(\n source: string,\n marker: string,\n css: string,\n) {\n return source.replace(marker, css);\n}\n\nexport function hasWebpackCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function prependWebpackRuntimeEntry(\n entry: EntryNormalized,\n runtimeFilePath: string,\n): EntryNormalized {\n if (typeof entry === 'function') {\n return async () => prependWebpackRuntimeStaticEntry(await entry(), runtimeFilePath);\n }\n\n return prependWebpackRuntimeStaticEntry(entry, runtimeFilePath);\n}\n\nfunction prependWebpackRuntimeStaticEntry(\n entry: WebpackStaticEntry,\n runtimeFilePath: string,\n): WebpackStaticEntry {\n const result: WebpackStaticEntry = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependWebpackRuntimeEntryDescription(value, runtimeFilePath);\n }\n\n return result;\n}\n\nfunction prependWebpackRuntimeEntryDescription(\n entry: WebpackEntryDescription,\n runtimeFilePath: string,\n): WebpackEntryDescription {\n if (!entry.import) return entry;\n\n return {\n ...entry,\n import: prependEntryImport(entry.import, runtimeFilePath),\n };\n}\n\nfunction prependEntryImport(entryImport: string[], runtimeFilePath: string) {\n return entryImport.includes(runtimeFilePath)\n ? entryImport\n : [runtimeFilePath, ...entryImport];\n}\n"],"mappings":";;;;;AAgBA,MAAa,kBAAkB,sBAAsB,kBAAkB;AAEvE,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,cAAc,SAAS,iBAAiB;AACxF;AAEA,SAAgB,0BAA0B;CACxC,OAAO,KAAK,QAAQ,KAAK,QAAQ,uBAAuB,CAAC,GAAG,OAAO;AACrE;AAEA,SAAgB,iCACd,SACA,aACA,UAGI,CAAC,GACL;CACA,OAAO;EACL,WAAW,eAAe,UAAU,KAAK,UAAU,cAAc,WAAW,CAAC,EAAE;EAC/E,QAAQ,cAAc,QAAQ,qBAAqB,UAAU,KAAK,UAAU,QAAQ,iBAAiB,EAAE;EACvG,QAAQ,cACR,yBAAyB,KAAK,UAAA,4BAAmC,EAAE,OAAO,KAAK,UAAU,QAAQ,UAAU,EAAE;EAC7G;CACF,EAAE,OAAO,OAAO,EAAE,KAAK,IAAI;AAC7B;AAEA,SAAgB,wBACd,QACA,QACA,KACA;CACA,OAAO,OAAO,QAAQ,QAAQ,GAAG;AACnC;AAEA,SAAgB,oBAAoB,QAAgB,QAAgB;CAClE,OAAO,OAAO,SAAS,MAAM;AAC/B;AAEA,SAAgB,2BACd,OACA,iBACiB;CACjB,IAAI,OAAO,UAAU,YACnB,OAAO,YAAY,iCAAiC,MAAM,MAAM,GAAG,eAAe;CAGpF,OAAO,iCAAiC,OAAO,eAAe;AAChE;AAEA,SAAS,iCACP,OACA,iBACoB;CACpB,MAAM,SAA6B,CAAC;CAEpC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,OAAO,OAAO,sCAAsC,OAAO,eAAe;CAG5E,OAAO;AACT;AAEA,SAAS,sCACP,OACA,iBACyB;CACzB,IAAI,CAAC,MAAM,QAAQ,OAAO;CAE1B,OAAO;EACL,GAAG;EACH,QAAQ,mBAAmB,MAAM,QAAQ,eAAe;CAC1D;AACF;AAEA,SAAS,mBAAmB,aAAuB,iBAAyB;CAC1E,OAAO,YAAY,SAAS,eAAe,IACvC,cACA,CAAC,iBAAiB,GAAG,WAAW;AACtC"}
|
|
@@ -3,12 +3,90 @@ function hasOwn(target, field) {
|
|
|
3
3
|
return Object.prototype.hasOwnProperty.call(target, field);
|
|
4
4
|
}
|
|
5
5
|
//#endregion
|
|
6
|
+
//#region utils/global.ts
|
|
7
|
+
function symbol(name) {
|
|
8
|
+
return Symbol.for(`@fluentic/style.${name}`);
|
|
9
|
+
}
|
|
10
|
+
function globalData(key, data) {
|
|
11
|
+
const id = symbol(key);
|
|
12
|
+
const root = globalThis;
|
|
13
|
+
if (root[id] === void 0) assign(root, id, data());
|
|
14
|
+
return root[id];
|
|
15
|
+
}
|
|
16
|
+
function assign(target, id, value) {
|
|
17
|
+
Object.defineProperty(target, id, {
|
|
18
|
+
value,
|
|
19
|
+
configurable: true,
|
|
20
|
+
enumerable: false,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region config/config/css.ts
|
|
26
|
+
const CSS_CONFIG_DEFAULT = {
|
|
27
|
+
layer: true,
|
|
28
|
+
layers: ["$layer"],
|
|
29
|
+
layerNamespace: "css"
|
|
30
|
+
};
|
|
31
|
+
const CSS_CONFIG = globalData("config.css", () => ({ ...CSS_CONFIG_DEFAULT }));
|
|
32
|
+
//#endregion
|
|
6
33
|
//#region utils/hash.ts
|
|
7
34
|
function hashString(str) {
|
|
8
35
|
let hash = 2166136261;
|
|
9
36
|
for (let i = 0; i < str.length; i++) hash = Math.imul(hash ^ str.charCodeAt(i), 16777619);
|
|
10
37
|
return (hash >>> 0).toString(36).padEnd(7, "0");
|
|
11
38
|
}
|
|
39
|
+
function normalizeHashLength(length) {
|
|
40
|
+
return Number.isFinite(length) ? Math.max(1, Math.floor(length)) : 7;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region config/config/debug.ts
|
|
44
|
+
const DEFAULT_DEBUG_CONFIG = {
|
|
45
|
+
isDebugClassNameEnabled: false,
|
|
46
|
+
isDebugClassNameConfigured: false,
|
|
47
|
+
maxPropertyLength: 24,
|
|
48
|
+
maxValueLength: 8,
|
|
49
|
+
maxSelectorLength: 8,
|
|
50
|
+
maxParentSelectorLength: 8,
|
|
51
|
+
maxAtRuleLength: 10
|
|
52
|
+
};
|
|
53
|
+
globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region config/utils.ts
|
|
56
|
+
const SIDECAR_URL_GLOBAL_SYMBOL = "FLUENTIC_STYLE_SIDECAR_URL";
|
|
57
|
+
function getCacheTTL(cache) {
|
|
58
|
+
return cache === true ? 3e5 : cache === false ? 0 : Math.max(cache, 0);
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region config/config/runtime.ts
|
|
62
|
+
const RUNTIME_CONFIG_DEFAULT = {
|
|
63
|
+
changes: 0,
|
|
64
|
+
isPlugin: false,
|
|
65
|
+
isHoist: false,
|
|
66
|
+
isExtracted: false,
|
|
67
|
+
isRSC: false,
|
|
68
|
+
runtimeCacheTTL: getCacheTTL(true)
|
|
69
|
+
};
|
|
70
|
+
const RUNTIME_CONFIG = globalData("config.runtime", () => ({ ...RUNTIME_CONFIG_DEFAULT }));
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region config/config/dev.ts
|
|
73
|
+
const DEV_CONFIG_DEFAULT = {
|
|
74
|
+
isDev: false,
|
|
75
|
+
isCheckSelectorEnabled: true,
|
|
76
|
+
isSourcemapEnabled: true,
|
|
77
|
+
isLocalClassNameEnabled: true,
|
|
78
|
+
sheetMaxRules: 1e3,
|
|
79
|
+
sheetStyleTagNonce: null,
|
|
80
|
+
hashLength: null,
|
|
81
|
+
stylePriorityMode: "sort",
|
|
82
|
+
sourcemapLocationMode: "style",
|
|
83
|
+
isElementClassNameEnabled: true
|
|
84
|
+
};
|
|
85
|
+
globalData("config.dev.isDev", () => ({ isDev: false }));
|
|
86
|
+
const DEV_CONFIG = globalData("config.dev", () => ({ ...DEV_CONFIG_DEFAULT }));
|
|
87
|
+
globalData("config.dev.plugin", () => ({ config: null }));
|
|
88
|
+
globalData("config.dev.base", () => ({ config: null }));
|
|
89
|
+
globalData("config.dev.utils", () => ({ config: null }));
|
|
12
90
|
//#endregion
|
|
13
91
|
//#region atomic/utils/css.ts
|
|
14
92
|
function getCssVar(varName, value) {
|
|
@@ -22,20 +100,38 @@ function escapeCssValue(value) {
|
|
|
22
100
|
return value.trim().replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/'/g, "\\'").replace(/;/g, "\\;");
|
|
23
101
|
}
|
|
24
102
|
function escapeCssIdent(ident) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
103
|
+
let result = "";
|
|
104
|
+
for (let i = 0; i < ident.length; i++) {
|
|
105
|
+
const char = ident.charAt(i);
|
|
106
|
+
const code = ident.charCodeAt(i);
|
|
107
|
+
const nextCode = ident.charCodeAt(i + 1);
|
|
108
|
+
if (code === 0) {
|
|
109
|
+
result += "�";
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (code >= 1 && code <= 31 || code === 127 || i === 0 && code >= 48 && code <= 57 || i === 1 && code >= 48 && code <= 57 && ident.charCodeAt(0) === 45) {
|
|
113
|
+
result += "\\" + code.toString(16) + " ";
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (i === 0 && code === 45 && ident.length === 1) {
|
|
117
|
+
result += "\\-";
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (code >= 55296 && code <= 56319 && nextCode >= 56320 && nextCode <= 57343) {
|
|
121
|
+
result += char + ident.charAt(++i);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (code >= 128 || code === 45 || code === 95 || code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
125
|
+
result += char;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
result += "\\" + char;
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
29
131
|
}
|
|
30
132
|
function sanitizeCssIdentName(value, fallback = "") {
|
|
31
133
|
return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || fallback;
|
|
32
134
|
}
|
|
33
|
-
function getIdentifierSafeHash(value) {
|
|
34
|
-
const hash = hashString(value);
|
|
35
|
-
const first = hash.charCodeAt(0);
|
|
36
|
-
if (first < 48 || first > 57) return hash;
|
|
37
|
-
return String.fromCharCode(97 + first - 48) + hash.slice(1);
|
|
38
|
-
}
|
|
39
135
|
//#endregion
|
|
40
136
|
//#region atomic/utils/debug.ts
|
|
41
137
|
function sanitizeDebugName(value) {
|
|
@@ -63,7 +159,7 @@ function createNameFormatter(keys) {
|
|
|
63
159
|
const name = getFormatFn(format)(info);
|
|
64
160
|
if (!hash) return name;
|
|
65
161
|
if (name.includes(HASH_TOKEN)) return name.replace(HASH_TOKEN, hash);
|
|
66
|
-
return name ? name + "
|
|
162
|
+
return name ? name + "--" + hash : hash;
|
|
67
163
|
};
|
|
68
164
|
}
|
|
69
165
|
function compileFormat(format, keySet) {
|
|
@@ -149,77 +245,63 @@ function formatTokenValue(value, maxLength, truncate) {
|
|
|
149
245
|
if (!Number.isFinite(maxLength) || maxLength < 0 || value.length <= maxLength) return value;
|
|
150
246
|
return truncate ? value.slice(0, maxLength) : null;
|
|
151
247
|
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region atomic/utils/hash.ts
|
|
250
|
+
const POOLED_HASH_STATE = globalData("atomic.hashPool", () => ({
|
|
251
|
+
byValue: /* @__PURE__ */ new Map(),
|
|
252
|
+
byHash: /* @__PURE__ */ new Map(),
|
|
253
|
+
usedByLength: []
|
|
254
|
+
}));
|
|
255
|
+
function getIdentifierSafeHash(value, startLength = 7) {
|
|
256
|
+
return getPooledHash(value, startLength);
|
|
257
|
+
}
|
|
258
|
+
function getPooledHash(value, startLength) {
|
|
259
|
+
const normalizedStartLength = normalizeHashLength(startLength);
|
|
260
|
+
const valueKey = normalizedStartLength + "\0" + value;
|
|
261
|
+
const existing = POOLED_HASH_STATE.byValue.get(valueKey);
|
|
262
|
+
if (existing) return existing;
|
|
263
|
+
let length = normalizedStartLength;
|
|
264
|
+
while (true) {
|
|
265
|
+
if (getPooledHashUsedCount(length) >= getIdentifierSafeHashPoolSize(length)) {
|
|
266
|
+
length++;
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
for (let index = 0; index < getIdentifierSafeHashPoolSize(length); index++) {
|
|
270
|
+
const hash = getPooledHashCandidate(value, length, index);
|
|
271
|
+
const owner = POOLED_HASH_STATE.byHash.get(hash);
|
|
272
|
+
if (owner !== void 0 && owner !== valueKey) continue;
|
|
273
|
+
POOLED_HASH_STATE.byValue.set(valueKey, hash);
|
|
274
|
+
POOLED_HASH_STATE.byHash.set(hash, valueKey);
|
|
275
|
+
POOLED_HASH_STATE.usedByLength[length] = getPooledHashUsedCount(length) + 1;
|
|
276
|
+
return hash;
|
|
277
|
+
}
|
|
278
|
+
length++;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function getPooledHashCandidate(value, length, index) {
|
|
282
|
+
return getIdentifierSafeHashValue(hashString(index === 0 ? value : value + "::" + index)).slice(0, length);
|
|
283
|
+
}
|
|
284
|
+
function getPooledHashUsedCount(length) {
|
|
285
|
+
return POOLED_HASH_STATE.usedByLength[length] ?? 0;
|
|
286
|
+
}
|
|
287
|
+
function getIdentifierSafeHashPoolSize(length) {
|
|
288
|
+
if (length <= 0) return 0;
|
|
289
|
+
return 26 * 36 ** (length - 1);
|
|
290
|
+
}
|
|
291
|
+
function getIdentifierSafeHashValue(hash) {
|
|
292
|
+
const first = hash.charCodeAt(0);
|
|
293
|
+
if (first < 48 || first > 57) return hash;
|
|
294
|
+
return String.fromCharCode(97 + first - 48) + hash.slice(1);
|
|
295
|
+
}
|
|
152
296
|
const formatElementClassName = createNameFormatter(["name"]);
|
|
153
297
|
function getElementClassName(label, id, elementClassNameFormat) {
|
|
154
298
|
const name = sanitizeDebugName(label) || null;
|
|
155
|
-
const hash = getIdentifierSafeHash(id);
|
|
299
|
+
const hash = getIdentifierSafeHash(id, DEV_CONFIG.hashLength ?? CSS_CONFIG.hashLength ?? 3);
|
|
156
300
|
return formatElementClassName(elementClassNameFormat || "@(name)", hash, { name });
|
|
157
301
|
}
|
|
158
302
|
function getElementMarkerRuleCss(className) {
|
|
159
303
|
return `.${escapeCssIdent(className)}{--fluentic-element-marker:0}`;
|
|
160
304
|
}
|
|
161
|
-
//#endregion
|
|
162
|
-
//#region utils/global.ts
|
|
163
|
-
function symbol(name) {
|
|
164
|
-
return Symbol.for(`@fluentic/style.${name}`);
|
|
165
|
-
}
|
|
166
|
-
function globalData(key, data) {
|
|
167
|
-
const id = symbol(key);
|
|
168
|
-
const root = globalThis;
|
|
169
|
-
if (root[id] === void 0) assign(root, id, data());
|
|
170
|
-
return root[id];
|
|
171
|
-
}
|
|
172
|
-
function assign(target, id, value) {
|
|
173
|
-
Object.defineProperty(target, id, {
|
|
174
|
-
value,
|
|
175
|
-
configurable: true,
|
|
176
|
-
enumerable: false,
|
|
177
|
-
writable: true
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region config/config/css.ts
|
|
182
|
-
const CSS_CONFIG_DEFAULT = {
|
|
183
|
-
layer: true,
|
|
184
|
-
layers: ["$layer"],
|
|
185
|
-
layerNamespace: "css"
|
|
186
|
-
};
|
|
187
|
-
const CSS_CONFIG = globalData("config.css", () => ({ ...CSS_CONFIG_DEFAULT }));
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region config/utils.ts
|
|
190
|
-
const SIDECAR_URL_GLOBAL_SYMBOL = "FLUENTIC_STYLE_SIDECAR_URL";
|
|
191
|
-
function getCacheTTL(cache) {
|
|
192
|
-
return cache === true ? 3e5 : cache === false ? 0 : Math.max(cache, 0);
|
|
193
|
-
}
|
|
194
|
-
//#endregion
|
|
195
|
-
//#region config/config/runtime.ts
|
|
196
|
-
const RUNTIME_CONFIG_DEFAULT = {
|
|
197
|
-
changes: 0,
|
|
198
|
-
isPlugin: false,
|
|
199
|
-
isHoist: false,
|
|
200
|
-
isExtracted: false,
|
|
201
|
-
isRSC: false,
|
|
202
|
-
runtimeCacheTTL: getCacheTTL(true)
|
|
203
|
-
};
|
|
204
|
-
const RUNTIME_CONFIG = globalData("config.runtime", () => ({ ...RUNTIME_CONFIG_DEFAULT }));
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region config/config/dev.ts
|
|
207
|
-
const DEV_CONFIG_DEFAULT = {
|
|
208
|
-
isDev: false,
|
|
209
|
-
isCheckSelectorEnabled: true,
|
|
210
|
-
isSourcemapEnabled: true,
|
|
211
|
-
isLocalClassNameEnabled: true,
|
|
212
|
-
sheetMaxRules: 1e3,
|
|
213
|
-
sheetStyleTagNonce: null,
|
|
214
|
-
stylePriorityMode: "layer",
|
|
215
|
-
sourcemapLocationMode: "style",
|
|
216
|
-
isElementClassNameEnabled: true
|
|
217
|
-
};
|
|
218
|
-
globalData("config.dev.isDev", () => ({ isDev: false }));
|
|
219
|
-
const DEV_CONFIG = globalData("config.dev", () => ({ ...DEV_CONFIG_DEFAULT }));
|
|
220
|
-
globalData("config.dev.plugin", () => ({ config: null }));
|
|
221
|
-
globalData("config.dev.base", () => ({ config: null }));
|
|
222
|
-
globalData("config.dev.utils", () => ({ config: null }));
|
|
223
305
|
globalData("config.build", () => ({ current: null }));
|
|
224
306
|
//#endregion
|
|
225
307
|
//#region atomic/layer/layer.ts
|
|
@@ -1089,6 +1171,7 @@ createNameFormatter([
|
|
|
1089
1171
|
"value"
|
|
1090
1172
|
]);
|
|
1091
1173
|
const formatScopeClassName = createNameFormatter(["className"]);
|
|
1174
|
+
createNameFormatter(["className"]);
|
|
1092
1175
|
function getDebugScopeClassName(format, info) {
|
|
1093
1176
|
return formatScopeClassName(format || "-(className)", null, info);
|
|
1094
1177
|
}
|
|
@@ -1263,7 +1346,7 @@ function createCacheValue() {
|
|
|
1263
1346
|
const formatTokenName = createNameFormatter(["name"]);
|
|
1264
1347
|
function getTokenVarName(token, format) {
|
|
1265
1348
|
const id = getStyleTokenId(token);
|
|
1266
|
-
return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id), { name: id });
|
|
1349
|
+
return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: id });
|
|
1267
1350
|
}
|
|
1268
1351
|
function getTokenVar(token, format) {
|
|
1269
1352
|
return getTokenVarFallback(token, format);
|
|
@@ -2412,4 +2495,4 @@ function createJsx(fn, transformElement) {
|
|
|
2412
2495
|
//#endregion
|
|
2413
2496
|
export { transformElement as a, wrapFragment as i, createJsxDEV as n, wrapCreateElement as r, createJsx as t };
|
|
2414
2497
|
|
|
2415
|
-
//# sourceMappingURL=utils-
|
|
2498
|
+
//# sourceMappingURL=utils-DVFxZnVC.js.map
|