@tenphi/tasty 0.0.0-snapshot.bbd10c7 → 0.0.0-snapshot.bbd36bd
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/README.md +196 -140
- package/dist/astro-CeYENy2x.js +301 -0
- package/dist/astro-CeYENy2x.js.map +1 -0
- package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +16 -6
- package/dist/async-storage-DKK-wTD4.js.map +1 -0
- package/dist/babel-DWCsafYw.d.ts +83 -0
- package/dist/collector-B3OsM252.js +327 -0
- package/dist/collector-B3OsM252.js.map +1 -0
- package/dist/collector-BTVXj2hS.d.ts +163 -0
- package/dist/config-B3gPdCqd.js +12421 -0
- package/dist/config-B3gPdCqd.js.map +1 -0
- package/dist/config-LfIDmVHx.d.ts +1363 -0
- package/dist/context-CA8YKeMn.js +24 -0
- package/dist/context-CA8YKeMn.js.map +1 -0
- package/dist/core/index.d.ts +5 -34
- package/dist/core/index.js +6 -27
- package/dist/core-DGm0CFHP.js +1732 -0
- package/dist/core-DGm0CFHP.js.map +1 -0
- package/dist/css-resources-Cyl_axbI.js +149 -0
- package/dist/css-resources-Cyl_axbI.js.map +1 -0
- package/dist/{zero/extractor.js → css-writer-Bgowobbx.js} +148 -24
- package/dist/css-writer-Bgowobbx.js.map +1 -0
- package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +2 -2
- package/dist/format-global-rules-DklyaXv-.js.map +1 -0
- package/dist/{ssr/format-rules.js → format-rules-XRw9u7d4.js} +33 -2
- package/dist/format-rules-XRw9u7d4.js.map +1 -0
- package/dist/hydrate-CNOmZprz.js +37 -0
- package/dist/hydrate-CNOmZprz.js.map +1 -0
- package/dist/index-Bm9ltvdH.d.ts +1933 -0
- package/dist/index-BmogEzTo.d.ts +1575 -0
- package/dist/index.d.ts +5 -51
- package/dist/index.js +922 -36
- package/dist/index.js.map +1 -0
- package/dist/keyframes-DE-OE76F.js +535 -0
- package/dist/keyframes-DE-OE76F.js.map +1 -0
- package/dist/{utils/merge-styles.d.ts → merge-styles-BcLl1u_d.d.ts} +3 -3
- package/dist/{utils/merge-styles.js → merge-styles-DuoZEsm9.js} +3 -4
- package/dist/merge-styles-DuoZEsm9.js.map +1 -0
- package/dist/{utils/resolve-recipes.js → resolve-recipes-H9NqOQuP.js} +4 -6
- package/dist/resolve-recipes-H9NqOQuP.js.map +1 -0
- package/dist/ssr/astro-client.js +19 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +18 -0
- package/dist/ssr/astro-middleware-static.js +18 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +19 -0
- package/dist/ssr/astro-middleware.js +19 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +117 -11
- package/dist/ssr/astro.js +2 -64
- package/dist/ssr/index.d.ts +37 -4
- package/dist/ssr/index.js +6 -6
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +66 -0
- package/dist/ssr/next-config.js +115 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +14 -5
- package/dist/ssr/next.js +32 -15
- package/dist/ssr/next.js.map +1 -1
- package/dist/ssr-collector-ref-COs_ioWl.js +29 -0
- package/dist/ssr-collector-ref-COs_ioWl.js.map +1 -0
- package/dist/static/index.d.ts +91 -5
- package/dist/static/index.js +49 -3
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.js.map +1 -1
- package/dist/zero/babel.d.ts +2 -182
- package/dist/zero/babel.js +80 -40
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +81 -3
- package/dist/zero/index.js +2 -3
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +1 -1
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +20 -12
- package/docs/adoption.md +59 -32
- package/docs/ai-agents.md +224 -0
- package/docs/comparison.md +76 -48
- package/docs/configuration.md +566 -69
- package/docs/debug.md +35 -18
- package/docs/design-system.md +63 -32
- package/docs/dsl.md +527 -179
- package/docs/getting-started.md +62 -41
- package/docs/injector.md +157 -51
- package/docs/methodology.md +69 -37
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +741 -0
- package/docs/plugins.md +353 -0
- package/docs/{runtime.md → react-api.md} +176 -67
- package/docs/runtime-benchmarks.md +351 -0
- package/docs/ssr.md +350 -94
- package/docs/styles.md +65 -16
- package/docs/tasty-static.md +149 -87
- package/package.json +78 -23
- package/tasty.config.ts +6 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -7
- package/dist/chunks/cacheKey.js +0 -77
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -258
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/index.d.ts +0 -1
- package/dist/chunks/renderChunk.d.ts +0 -1
- package/dist/chunks/renderChunk.js +0 -59
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/compute-styles.d.ts +0 -31
- package/dist/compute-styles.js +0 -356
- package/dist/compute-styles.js.map +0 -1
- package/dist/config.d.ts +0 -372
- package/dist/config.js +0 -507
- package/dist/config.js.map +0 -1
- package/dist/counter-style/index.js +0 -51
- package/dist/counter-style/index.js.map +0 -1
- package/dist/debug.d.ts +0 -89
- package/dist/debug.js +0 -453
- package/dist/debug.js.map +0 -1
- package/dist/font-face/index.js +0 -63
- package/dist/font-face/index.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/useCounterStyle.d.ts +0 -50
- package/dist/hooks/useCounterStyle.js +0 -45
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -43
- package/dist/hooks/useFontFace.js +0 -69
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -30
- package/dist/hooks/useGlobalStyles.js +0 -77
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -63
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -108
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -34
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -40
- package/dist/hooks/useStyles.js +0 -29
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -166
- package/dist/injector/index.js +0 -166
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -166
- package/dist/injector/injector.js +0 -464
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -136
- package/dist/injector/sheet-manager.js +0 -733
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -204
- package/dist/keyframes/index.js +0 -206
- package/dist/keyframes/index.js.map +0 -1
- package/dist/parser/classify.js +0 -319
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -60
- package/dist/parser/const.js.map +0 -1
- package/dist/parser/lru.js +0 -109
- package/dist/parser/lru.js.map +0 -1
- package/dist/parser/parser.d.ts +0 -25
- package/dist/parser/parser.js +0 -115
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/tokenizer.js +0 -69
- package/dist/parser/tokenizer.js.map +0 -1
- package/dist/parser/types.d.ts +0 -51
- package/dist/parser/types.js +0 -46
- package/dist/parser/types.js.map +0 -1
- package/dist/pipeline/conditions.d.ts +0 -134
- package/dist/pipeline/conditions.js +0 -406
- package/dist/pipeline/conditions.js.map +0 -1
- package/dist/pipeline/exclusive.js +0 -230
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -55
- package/dist/pipeline/index.js +0 -708
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1103
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -446
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -515
- package/dist/pipeline/simplify.js.map +0 -1
- package/dist/pipeline/warnings.js +0 -18
- package/dist/pipeline/warnings.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -97
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -76
- package/dist/properties/index.js +0 -222
- package/dist/properties/index.js.map +0 -1
- package/dist/properties/property-type-resolver.d.ts +0 -24
- package/dist/properties/property-type-resolver.js +0 -90
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/ssr/astro.js.map +0 -1
- package/dist/ssr/async-storage.d.ts +0 -17
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -39
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.d.ts +0 -102
- package/dist/ssr/collector.js +0 -219
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/format-global-rules.js.map +0 -1
- package/dist/ssr/format-keyframes.js +0 -69
- package/dist/ssr/format-keyframes.js.map +0 -1
- package/dist/ssr/format-property.js +0 -49
- package/dist/ssr/format-property.js.map +0 -1
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -22
- package/dist/ssr/hydrate.js +0 -49
- package/dist/ssr/hydrate.js.map +0 -1
- package/dist/ssr/ssr-collector-ref.js +0 -12
- package/dist/ssr/ssr-collector-ref.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -170
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -30
- package/dist/static/tastyStatic.js.map +0 -1
- package/dist/static/types.d.ts +0 -49
- package/dist/static/types.js +0 -24
- package/dist/static/types.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -120
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -26
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/const.js +0 -17
- package/dist/styles/const.js.map +0 -1
- package/dist/styles/createStyle.js +0 -79
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -109
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/directional.js +0 -133
- package/dist/styles/directional.js.map +0 -1
- package/dist/styles/display.d.ts +0 -30
- package/dist/styles/display.js +0 -73
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -62
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -51
- package/dist/styles/fill.js.map +0 -1
- package/dist/styles/flow.d.ts +0 -16
- package/dist/styles/flow.js +0 -12
- package/dist/styles/flow.js.map +0 -1
- package/dist/styles/gap.d.ts +0 -31
- package/dist/styles/gap.js +0 -38
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -19
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +0 -8
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -24
- package/dist/styles/inset.js +0 -34
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -100
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -32
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -55
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -32
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/placement.d.ts +0 -37
- package/dist/styles/placement.js +0 -74
- package/dist/styles/placement.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -71
- package/dist/styles/predefined.js +0 -237
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -52
- package/dist/styles/preset.js +0 -127
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -12
- package/dist/styles/radius.js +0 -83
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollMargin.d.ts +0 -24
- package/dist/styles/scrollMargin.js +0 -32
- package/dist/styles/scrollMargin.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -51
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -25
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/shared.js +0 -17
- package/dist/styles/shared.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -159
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/types.d.ts +0 -564
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -19
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -134
- package/dist/tasty.js +0 -240
- package/dist/tasty.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -21
- package/dist/utils/cache-wrapper.js.map +0 -1
- package/dist/utils/case-converter.js +0 -8
- package/dist/utils/case-converter.js.map +0 -1
- package/dist/utils/color-math.d.ts +0 -46
- package/dist/utils/color-math.js +0 -749
- package/dist/utils/color-math.js.map +0 -1
- package/dist/utils/color-space.d.ts +0 -5
- package/dist/utils/color-space.js +0 -228
- package/dist/utils/color-space.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -10
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/css-types.d.ts +0 -7
- package/dist/utils/dotize.d.ts +0 -26
- package/dist/utils/dotize.js +0 -122
- package/dist/utils/dotize.js.map +0 -1
- package/dist/utils/filter-base-props.d.ts +0 -15
- package/dist/utils/filter-base-props.js +0 -45
- package/dist/utils/filter-base-props.js.map +0 -1
- package/dist/utils/get-display-name.d.ts +0 -7
- package/dist/utils/get-display-name.js +0 -10
- package/dist/utils/get-display-name.js.map +0 -1
- package/dist/utils/has-keys.js +0 -13
- package/dist/utils/has-keys.js.map +0 -1
- package/dist/utils/is-dev-env.js +0 -19
- package/dist/utils/is-dev-env.js.map +0 -1
- package/dist/utils/is-valid-element-type.js +0 -15
- package/dist/utils/is-valid-element-type.js.map +0 -1
- package/dist/utils/merge-styles.js.map +0 -1
- package/dist/utils/mod-attrs.d.ts +0 -6
- package/dist/utils/mod-attrs.js +0 -20
- package/dist/utils/mod-attrs.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -17
- package/dist/utils/process-tokens.js +0 -83
- package/dist/utils/process-tokens.js.map +0 -1
- package/dist/utils/resolve-recipes.d.ts +0 -17
- package/dist/utils/resolve-recipes.js.map +0 -1
- package/dist/utils/selector-transform.js +0 -32
- package/dist/utils/selector-transform.js.map +0 -1
- package/dist/utils/string.js +0 -8
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -99
- package/dist/utils/styles.js +0 -220
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -47
- package/dist/utils/typography.js +0 -51
- package/dist/utils/typography.js.map +0 -1
- package/dist/utils/warnings.d.ts +0 -16
- package/dist/utils/warnings.js +0 -16
- package/dist/utils/warnings.js.map +0 -1
- package/dist/zero/css-writer.d.ts +0 -45
- package/dist/zero/css-writer.js +0 -73
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js.map +0 -1
- package/docs/PIPELINE.md +0 -519
- /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-styles-DuoZEsm9.js","names":[],"sources":["../src/utils/merge-styles.ts"],"sourcesContent":["import { isSelector } from '../pipeline';\nimport type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const inheritKeys = new Set<string>();\n const removeKeys = new Set<string>();\n const overrideKeys = new Map<string, unknown>();\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n inheritKeys.add(key);\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val === null) {\n removeKeys.add(key);\n } else if (key in parentMap) {\n overrideKeys.set(key, val);\n }\n }\n\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(parentMap)) {\n if (removeKeys.has(key)) continue;\n if (inheritKeys.has(key)) continue;\n if (overrideKeys.has(key)) {\n result[key] = overrideKeys.get(key);\n } else {\n result[key] = parentMap[key];\n }\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of Object.keys(childMap)) {\n if (inheritKeys.has(key)) {\n result[key] = parentMap[key];\n } else if (\n !removeKeys.has(key) &&\n !overrideKeys.has(key) &&\n // Skip @inherit for keys that weren't in the parent (already warned above)\n childMap[key] !== INHERIT_VALUE\n ) {\n result[key] = childMap[key];\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }\n\n return styles;\n}\n"],"mappings":"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"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { isDevEnv } from "./
|
|
2
|
-
import {
|
|
3
|
-
import { getGlobalRecipes } from "../config.js";
|
|
4
|
-
import { mergeStyles } from "./merge-styles.js";
|
|
1
|
+
import { I as isSelector, Qt as isDevEnv, u as getGlobalRecipes } from "./config-B3gPdCqd.js";
|
|
2
|
+
import { t as mergeStyles } from "./merge-styles-DuoZEsm9.js";
|
|
5
3
|
//#region src/utils/resolve-recipes.ts
|
|
6
4
|
/**
|
|
7
5
|
* Recipe resolution utility.
|
|
@@ -141,6 +139,6 @@ function resolveRecipes(styles) {
|
|
|
141
139
|
return changed ? result : styles;
|
|
142
140
|
}
|
|
143
141
|
//#endregion
|
|
144
|
-
export { resolveRecipes };
|
|
142
|
+
export { resolveRecipes as t };
|
|
145
143
|
|
|
146
|
-
//# sourceMappingURL=resolve-recipes.js.map
|
|
144
|
+
//# sourceMappingURL=resolve-recipes-H9NqOQuP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-recipes-H9NqOQuP.js","names":[],"sources":["../src/utils/resolve-recipes.ts"],"sourcesContent":["/**\n * Recipe resolution utility.\n *\n * Resolves `recipe` style properties by looking up predefined recipe styles\n * from global configuration and merging them with the component's own styles.\n *\n * Resolution order per level (top-level and each sub-element independently):\n * base_recipe_1 base_recipe_2 → component styles → post_recipe_1 post_recipe_2\n *\n * The `/` separator splits base recipes (before component styles)\n * from post recipes (after component styles). All merges use mergeStyles\n * semantics: primitives and state maps with '' key fully replace;\n * state maps without '' key extend the existing value.\n *\n * Returns the same object reference if no recipes are present (zero overhead).\n */\n\nimport { getGlobalRecipes } from '../config';\nimport { isSelector } from '../pipeline';\nimport type { RecipeStyles, Styles } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\nimport { mergeStyles } from './merge-styles';\n\nconst devMode = isDevEnv();\n\ninterface ParsedRecipeGroups {\n base: string[] | null;\n post: string[] | null;\n}\n\n/**\n * Parse a recipe string into base and post recipe name groups.\n *\n * Syntax: `'base1 base2 / post1 post2'`\n * - Names are space-separated within each group\n * - `/` separates base (before component) from post (after component) groups\n * - `/` is optional; if absent, all names are base\n * - `none` as the sole base value means \"no base recipes\"\n *\n * Returns `{ base: null, post: null }` if the string is empty or invalid.\n */\nfunction parseRecipeNames(value: unknown): ParsedRecipeGroups {\n const empty: ParsedRecipeGroups = { base: null, post: null };\n\n if (typeof value !== 'string') return empty;\n const trimmed = value.trim();\n if (trimmed === '') return empty;\n\n const slashIndex = trimmed.indexOf('/');\n\n if (slashIndex === -1) {\n if (trimmed === 'none') return empty;\n const names = splitNames(trimmed);\n return { base: names, post: null };\n }\n\n const basePart = trimmed.slice(0, slashIndex);\n const postPart = trimmed.slice(slashIndex + 1);\n\n return {\n base: basePart.trim() === 'none' ? null : splitNames(basePart),\n post: splitNames(postPart),\n };\n}\n\nfunction splitNames(s: string): string[] | null {\n const names = s.split(/\\s+/).filter(Boolean);\n return names.length > 0 ? names : null;\n}\n\n/**\n * Collect merged styles for a list of recipe names.\n * Each recipe is flat-spread on top of the previous.\n */\nfunction collectRecipeStyles(\n names: string[],\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> {\n let merged: Record<string, unknown> = {};\n\n for (const name of names) {\n const recipeStyles = recipes[name];\n\n if (!recipeStyles) {\n if (devMode) {\n console.warn(\n `[Tasty] Recipe \"${name}\" not found. ` +\n `Make sure it is defined in configure({ recipes: { ... } }).`,\n );\n }\n continue;\n }\n\n merged = { ...merged, ...(recipeStyles as Record<string, unknown>) };\n }\n\n return merged;\n}\n\n/**\n * Resolve recipe references in a flat styles object (no sub-elements).\n * Returns null if no `recipe` key is present.\n *\n * Resolution: base recipes → component styles → post recipes (all via mergeStyles)\n */\nfunction resolveRecipesForLevel(\n styles: Record<string, unknown>,\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> | null {\n if (!('recipe' in styles)) return null;\n\n const { base, post } = parseRecipeNames(styles.recipe);\n\n // Separate selector keys (sub-elements) from flat style properties.\n // mergeStyles handles selectors with its own semantics (e.g. false = delete),\n // but at this level we only want recipe merging on flat properties.\n\n const { recipe: _recipe, ...allRest } = styles;\n const flatStyles: Record<string, unknown> = {};\n const selectorStyles: Record<string, unknown> = {};\n\n for (const key of Object.keys(allRest)) {\n if (isSelector(key)) {\n selectorStyles[key] = allRest[key];\n } else {\n flatStyles[key] = allRest[key];\n }\n }\n\n if (!base && !post) {\n return allRest;\n }\n\n // 1. Merge base recipes, then component styles on top (via mergeStyles)\n let result: Record<string, unknown>;\n\n if (base) {\n const baseStyles = collectRecipeStyles(base, recipes);\n result = mergeStyles(baseStyles as Styles, flatStyles as Styles) as Record<\n string,\n unknown\n >;\n } else {\n result = { ...flatStyles };\n }\n\n // 2. Apply post recipes via mergeStyles (state map extend semantics)\n if (post) {\n const postStyles = collectRecipeStyles(post, recipes);\n result = mergeStyles(result as Styles, postStyles as Styles) as Record<\n string,\n unknown\n >;\n }\n\n // Re-attach selector keys unchanged\n for (const key of Object.keys(selectorStyles)) {\n result[key] = selectorStyles[key];\n }\n\n return result;\n}\n\n/**\n * Resolve all `recipe` style properties in a styles object.\n *\n * Handles both top-level and sub-element recipe references.\n * Returns the same object reference if no recipes are present anywhere\n * (zero overhead for the common case).\n *\n * @param styles - The styles object potentially containing `recipe` keys\n * @returns Resolved styles with recipe values merged in, or the original object if unchanged\n */\nexport function resolveRecipes(styles: Styles): Styles {\n const recipes = getGlobalRecipes();\n\n // Fast path: no recipes configured globally\n if (!recipes) return styles;\n\n let changed = false;\n\n // Resolve top-level recipe\n const topResolved = resolveRecipesForLevel(\n styles as Record<string, unknown>,\n recipes,\n );\n\n let result: Record<string, unknown>;\n\n if (topResolved) {\n changed = true;\n result = topResolved;\n } else {\n // Keep reference; a shallow copy is deferred until a sub-element actually changes\n result = styles as Record<string, unknown>;\n }\n\n // Resolve sub-element recipes\n const keys = Object.keys(result);\n\n for (const key of keys) {\n if (!isSelector(key)) continue;\n\n const subStyles = result[key];\n\n if (\n !subStyles ||\n typeof subStyles !== 'object' ||\n Array.isArray(subStyles)\n ) {\n continue;\n }\n\n const subRecord = subStyles as Record<string, unknown>;\n\n if (!('recipe' in subRecord)) continue;\n\n const subResolved = resolveRecipesForLevel(subRecord, recipes);\n\n if (subResolved) {\n if (!changed) {\n // First change in sub-elements -- need to shallow-copy the top level\n changed = true;\n result = { ...(styles as Record<string, unknown>) };\n }\n result[key] = subResolved;\n }\n }\n\n return changed ? (result as Styles) : styles;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,MAAM,UAAU,SAAS;;;;;;;;;;;;AAkBzB,SAAS,iBAAiB,OAAoC;CAC5D,MAAM,QAA4B;EAAE,MAAM;EAAM,MAAM;CAAK;CAE3D,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,YAAY,IAAI,OAAO;CAE3B,MAAM,aAAa,QAAQ,QAAQ,GAAG;CAEtC,IAAI,eAAe,IAAI;EACrB,IAAI,YAAY,QAAQ,OAAO;EAE/B,OAAO;GAAE,MADK,WAAW,OACN;GAAG,MAAM;EAAK;CACnC;CAEA,MAAM,WAAW,QAAQ,MAAM,GAAG,UAAU;CAC5C,MAAM,WAAW,QAAQ,MAAM,aAAa,CAAC;CAE7C,OAAO;EACL,MAAM,SAAS,KAAK,MAAM,SAAS,OAAO,WAAW,QAAQ;EAC7D,MAAM,WAAW,QAAQ;CAC3B;AACF;AAEA,SAAS,WAAW,GAA4B;CAC9C,MAAM,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO;CAC3C,OAAO,MAAM,SAAS,IAAI,QAAQ;AACpC;;;;;AAMA,SAAS,oBACP,OACA,SACyB;CACzB,IAAI,SAAkC,CAAC;CAEvC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,eAAe,QAAQ;EAE7B,IAAI,CAAC,cAAc;GACjB,IAAI,SACF,QAAQ,KACN,mBAAmB,KAAK,yEAE1B;GAEF;EACF;EAEA,SAAS;GAAE,GAAG;GAAQ,GAAI;EAAyC;CACrE;CAEA,OAAO;AACT;;;;;;;AAQA,SAAS,uBACP,QACA,SACgC;CAChC,IAAI,EAAE,YAAY,SAAS,OAAO;CAElC,MAAM,EAAE,MAAM,SAAS,iBAAiB,OAAO,MAAM;CAMrD,MAAM,EAAE,QAAQ,SAAS,GAAG,YAAY;CACxC,MAAM,aAAsC,CAAC;CAC7C,MAAM,iBAA0C,CAAC;CAEjD,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GACnC,IAAI,WAAW,GAAG,GAChB,eAAe,OAAO,QAAQ;MAE9B,WAAW,OAAO,QAAQ;CAI9B,IAAI,CAAC,QAAQ,CAAC,MACZ,OAAO;CAIT,IAAI;CAEJ,IAAI,MAEF,SAAS,YADU,oBAAoB,MAAM,OACf,GAAa,UAAoB;MAK/D,SAAS,EAAE,GAAG,WAAW;CAI3B,IAAI,MAAM;EACR,MAAM,aAAa,oBAAoB,MAAM,OAAO;EACpD,SAAS,YAAY,QAAkB,UAAoB;CAI7D;CAGA,KAAK,MAAM,OAAO,OAAO,KAAK,cAAc,GAC1C,OAAO,OAAO,eAAe;CAG/B,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,eAAe,QAAwB;CACrD,MAAM,UAAU,iBAAiB;CAGjC,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI,UAAU;CAGd,MAAM,cAAc,uBAClB,QACA,OACF;CAEA,IAAI;CAEJ,IAAI,aAAa;EACf,UAAU;EACV,SAAS;CACX,OAEE,SAAS;CAIX,MAAM,OAAO,OAAO,KAAK,MAAM;CAE/B,KAAK,MAAM,OAAO,MAAM;EACtB,IAAI,CAAC,WAAW,GAAG,GAAG;EAEtB,MAAM,YAAY,OAAO;EAEzB,IACE,CAAC,aACD,OAAO,cAAc,YACrB,MAAM,QAAQ,SAAS,GAEvB;EAGF,MAAM,YAAY;EAElB,IAAI,EAAE,YAAY,YAAY;EAE9B,MAAM,cAAc,uBAAuB,WAAW,OAAO;EAE7D,IAAI,aAAa;GACf,IAAI,CAAC,SAAS;IAEZ,UAAU;IACV,SAAS,EAAE,GAAI,OAAmC;GACpD;GACA,OAAO,OAAO;EAChB;CACF;CAEA,OAAO,UAAW,SAAoB;AACxC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as hydrateTastyClasses } from "../hydrate-CNOmZprz.js";
|
|
2
|
+
//#region src/ssr/astro-client.ts
|
|
3
|
+
/**
|
|
4
|
+
* Client-side cache hydration for Astro islands.
|
|
5
|
+
*
|
|
6
|
+
* Reads the class name list from `window.__TASTY__` (populated by
|
|
7
|
+
* inline scripts emitted during SSR) and pre-populates the injector
|
|
8
|
+
* so island hydration skips the style pipeline entirely.
|
|
9
|
+
*
|
|
10
|
+
* This module is browser-safe — it does NOT import node:async_hooks.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* - Automatically injected by tastyIntegration() via injectScript('before-hydration')
|
|
14
|
+
* - Can be imported manually: `import '@tenphi/tasty/ssr/astro-client'`
|
|
15
|
+
*/
|
|
16
|
+
if (typeof window !== "undefined") hydrateTastyClasses();
|
|
17
|
+
//#endregion
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=astro-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro-client.js","names":[],"sources":["../../src/ssr/astro-client.ts"],"sourcesContent":["/**\n * Client-side cache hydration for Astro islands.\n *\n * Reads the class name list from `window.__TASTY__` (populated by\n * inline scripts emitted during SSR) and pre-populates the injector\n * so island hydration skips the style pipeline entirely.\n *\n * This module is browser-safe — it does NOT import node:async_hooks.\n *\n * Usage:\n * - Automatically injected by tastyIntegration() via injectScript('before-hydration')\n * - Can be imported manually: `import '@tenphi/tasty/ssr/astro-client'`\n */\n\nimport { hydrateTastyClasses } from './hydrate';\n\nif (typeof window !== 'undefined') {\n hydrateTastyClasses();\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAI,OAAO,WAAW,aACpB,oBAAoB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/ssr/astro-middleware-extract-static.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Prerender-extraction middleware entrypoint for sites without islands.
|
|
4
|
+
* Exported only so Astro can resolve it through the package exports map.
|
|
5
|
+
*/
|
|
6
|
+
declare const onRequest: (context: {
|
|
7
|
+
isPrerendered?: boolean;
|
|
8
|
+
}, next: () => Promise<Response>) => Promise<Response>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { onRequest };
|
|
11
|
+
//# sourceMappingURL=astro-middleware-extract-static.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro-middleware-extract-static.js","names":[],"sources":["../../src/ssr/astro-middleware-extract-static.ts"],"sourcesContent":["/**\n * Prerender-extraction middleware entrypoint for sites without islands.\n * Exported only so Astro can resolve it through the package exports map.\n */\n\nimport { tastyMiddleware } from './astro';\n\nconst options = {\n transferCache: false,\n extractionMetadata: true,\n};\n\nexport const onRequest = tastyMiddleware(options);\n"],"mappings":";AAYA,MAAa,YAAY,gBAAgB;CAJvC,eAAe;CACf,oBAAoB;AAGmB,CAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/ssr/astro-middleware-extract.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Prerender-extraction middleware entrypoint with island cache transfer.
|
|
4
|
+
* Exported only so Astro can resolve it through the package exports map.
|
|
5
|
+
*/
|
|
6
|
+
declare const onRequest: (context: {
|
|
7
|
+
isPrerendered?: boolean;
|
|
8
|
+
}, next: () => Promise<Response>) => Promise<Response>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { onRequest };
|
|
11
|
+
//# sourceMappingURL=astro-middleware-extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro-middleware-extract.js","names":[],"sources":["../../src/ssr/astro-middleware-extract.ts"],"sourcesContent":["/**\n * Prerender-extraction middleware entrypoint with island cache transfer.\n * Exported only so Astro can resolve it through the package exports map.\n */\n\nimport { tastyMiddleware } from './astro';\n\nconst options = {\n transferCache: true,\n extractionMetadata: true,\n};\n\nexport const onRequest = tastyMiddleware(options);\n"],"mappings":";AAYA,MAAa,YAAY,gBAAgB;CAJvC,eAAe;CACf,oBAAoB;AAGmB,CAAO"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/ssr/astro-middleware-static.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Astro middleware entrypoint for `tastyIntegration({ islands: false })`.
|
|
4
|
+
*
|
|
5
|
+
* Registered via `addMiddleware()` as
|
|
6
|
+
* `@tenphi/tasty/ssr/astro-middleware-static`. Exposed as a package subpath
|
|
7
|
+
* only so Astro can resolve it — use `tastyMiddleware({ transferCache: false })`
|
|
8
|
+
* directly if you need manual middleware composition.
|
|
9
|
+
*
|
|
10
|
+
* Identical to `./astro-middleware` except that no class-list `<script>` is
|
|
11
|
+
* emitted, so a site without `client:*` islands ships zero client JavaScript.
|
|
12
|
+
*/
|
|
13
|
+
declare const onRequest: (context: {
|
|
14
|
+
isPrerendered?: boolean;
|
|
15
|
+
}, next: () => Promise<Response>) => Promise<Response>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { onRequest };
|
|
18
|
+
//# sourceMappingURL=astro-middleware-static.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { n as tastyMiddleware } from "../astro-CeYENy2x.js";
|
|
2
|
+
//#region src/ssr/astro-middleware-static.ts
|
|
3
|
+
/**
|
|
4
|
+
* Astro middleware entrypoint for `tastyIntegration({ islands: false })`.
|
|
5
|
+
*
|
|
6
|
+
* Registered via `addMiddleware()` as
|
|
7
|
+
* `@tenphi/tasty/ssr/astro-middleware-static`. Exposed as a package subpath
|
|
8
|
+
* only so Astro can resolve it — use `tastyMiddleware({ transferCache: false })`
|
|
9
|
+
* directly if you need manual middleware composition.
|
|
10
|
+
*
|
|
11
|
+
* Identical to `./astro-middleware` except that no class-list `<script>` is
|
|
12
|
+
* emitted, so a site without `client:*` islands ships zero client JavaScript.
|
|
13
|
+
*/
|
|
14
|
+
const onRequest = tastyMiddleware({ transferCache: false });
|
|
15
|
+
//#endregion
|
|
16
|
+
export { onRequest };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=astro-middleware-static.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro-middleware-static.js","names":[],"sources":["../../src/ssr/astro-middleware-static.ts"],"sourcesContent":["/**\n * Astro middleware entrypoint for `tastyIntegration({ islands: false })`.\n *\n * Registered via `addMiddleware()` as\n * `@tenphi/tasty/ssr/astro-middleware-static`. Exposed as a package subpath\n * only so Astro can resolve it — use `tastyMiddleware({ transferCache: false })`\n * directly if you need manual middleware composition.\n *\n * Identical to `./astro-middleware` except that no class-list `<script>` is\n * emitted, so a site without `client:*` islands ships zero client JavaScript.\n */\n\nimport { tastyMiddleware } from './astro';\n\nexport const onRequest = tastyMiddleware({ transferCache: false });\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,YAAY,gBAAgB,EAAE,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/ssr/astro-middleware.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Astro middleware entrypoint for `tastyIntegration()`.
|
|
4
|
+
*
|
|
5
|
+
* Registered via `addMiddleware()` as `@tenphi/tasty/ssr/astro-middleware`.
|
|
6
|
+
* Exposed as a package subpath only so Astro can resolve it — use
|
|
7
|
+
* `tastyMiddleware()` directly if you need manual middleware composition.
|
|
8
|
+
*
|
|
9
|
+
* This is the islands variant: the rendered class list is transferred to the
|
|
10
|
+
* client so hydrating islands skip the style pipeline. See
|
|
11
|
+
* `./astro-middleware-static` for the variant used by
|
|
12
|
+
* `tastyIntegration({ islands: false })`.
|
|
13
|
+
*/
|
|
14
|
+
declare const onRequest: (context: {
|
|
15
|
+
isPrerendered?: boolean;
|
|
16
|
+
}, next: () => Promise<Response>) => Promise<Response>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { onRequest };
|
|
19
|
+
//# sourceMappingURL=astro-middleware.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { n as tastyMiddleware } from "../astro-CeYENy2x.js";
|
|
2
|
+
//#region src/ssr/astro-middleware.ts
|
|
3
|
+
/**
|
|
4
|
+
* Astro middleware entrypoint for `tastyIntegration()`.
|
|
5
|
+
*
|
|
6
|
+
* Registered via `addMiddleware()` as `@tenphi/tasty/ssr/astro-middleware`.
|
|
7
|
+
* Exposed as a package subpath only so Astro can resolve it — use
|
|
8
|
+
* `tastyMiddleware()` directly if you need manual middleware composition.
|
|
9
|
+
*
|
|
10
|
+
* This is the islands variant: the rendered class list is transferred to the
|
|
11
|
+
* client so hydrating islands skip the style pipeline. See
|
|
12
|
+
* `./astro-middleware-static` for the variant used by
|
|
13
|
+
* `tastyIntegration({ islands: false })`.
|
|
14
|
+
*/
|
|
15
|
+
const onRequest = tastyMiddleware({ transferCache: true });
|
|
16
|
+
//#endregion
|
|
17
|
+
export { onRequest };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=astro-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro-middleware.js","names":[],"sources":["../../src/ssr/astro-middleware.ts"],"sourcesContent":["/**\n * Astro middleware entrypoint for `tastyIntegration()`.\n *\n * Registered via `addMiddleware()` as `@tenphi/tasty/ssr/astro-middleware`.\n * Exposed as a package subpath only so Astro can resolve it — use\n * `tastyMiddleware()` directly if you need manual middleware composition.\n *\n * This is the islands variant: the rendered class list is transferred to the\n * client so hydrating islands skip the style pipeline. See\n * `./astro-middleware-static` for the variant used by\n * `tastyIntegration({ islands: false })`.\n */\n\nimport { tastyMiddleware } from './astro';\n\nexport const onRequest = tastyMiddleware({ transferCache: true });\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAa,YAAY,gBAAgB,EAAE,eAAe,KAAK,CAAC"}
|
package/dist/ssr/astro.d.ts
CHANGED
|
@@ -1,29 +1,135 @@
|
|
|
1
|
-
import { hydrateTastyCache } from "./hydrate.js";
|
|
2
|
-
|
|
3
1
|
//#region src/ssr/astro.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Astro integration for Tasty SSR.
|
|
4
|
+
*
|
|
5
|
+
* Provides:
|
|
6
|
+
* - tastyIntegration() — Astro Integration API (recommended)
|
|
7
|
+
* - tastyMiddleware() — manual middleware for advanced composition
|
|
8
|
+
*
|
|
9
|
+
* Import from '@tenphi/tasty/ssr/astro'.
|
|
10
|
+
*/
|
|
4
11
|
interface TastyMiddlewareOptions {
|
|
5
12
|
/**
|
|
6
|
-
* Whether to embed the
|
|
7
|
-
* Set to false to skip
|
|
13
|
+
* Whether to embed the class-list script for client hydration.
|
|
14
|
+
* Set to false to skip class transfer (e.g. for CSP restrictions).
|
|
15
|
+
* Without it, client components may re-inject CSS that already exists
|
|
16
|
+
* in server-rendered `<style>` tags. Default: true.
|
|
8
17
|
*/
|
|
9
18
|
transferCache?: boolean;
|
|
10
19
|
}
|
|
11
20
|
/**
|
|
12
21
|
* Create an Astro middleware that collects Tasty styles during SSR.
|
|
13
22
|
*
|
|
14
|
-
* All React components rendered during the request
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* injects the collected CSS into </head>.
|
|
23
|
+
* All React components rendered during the request will have their
|
|
24
|
+
* computeStyles() calls captured by the collector via AsyncLocalStorage.
|
|
25
|
+
* After rendering, the middleware injects the collected CSS into </head>.
|
|
18
26
|
*
|
|
19
|
-
* @example
|
|
27
|
+
* @example Manual middleware setup
|
|
20
28
|
* ```ts
|
|
21
29
|
* // src/middleware.ts
|
|
22
30
|
* import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';
|
|
23
31
|
* export const onRequest = tastyMiddleware();
|
|
24
32
|
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Composing with other middleware
|
|
35
|
+
* ```ts
|
|
36
|
+
* // src/middleware.ts
|
|
37
|
+
* import { sequence } from 'astro:middleware';
|
|
38
|
+
* import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';
|
|
39
|
+
*
|
|
40
|
+
* export const onRequest = sequence(
|
|
41
|
+
* tastyMiddleware(),
|
|
42
|
+
* myOtherMiddleware,
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare function tastyMiddleware(options?: TastyMiddlewareOptions): (context: {
|
|
47
|
+
isPrerendered?: boolean;
|
|
48
|
+
}, next: () => Promise<Response>) => Promise<Response>;
|
|
49
|
+
interface TastyIntegrationCSSOptions {
|
|
50
|
+
/**
|
|
51
|
+
* CSS delivery mode. Extraction only applies to prerendered builds.
|
|
52
|
+
* Extracted CSS preserves resource URLs verbatim, so use absolute URLs or
|
|
53
|
+
* data URLs. Root-relative URLs are also supported unless `assetsPrefix`
|
|
54
|
+
* sends CSS to an external origin. The build rejects resource URLs whose
|
|
55
|
+
* targets would change after extraction.
|
|
56
|
+
*/
|
|
57
|
+
mode?: 'inline' | 'extract';
|
|
58
|
+
}
|
|
59
|
+
interface TastyIntegrationOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Enable island hydration support.
|
|
62
|
+
*
|
|
63
|
+
* When `true` (default): injects a client hydration script via
|
|
64
|
+
* `injectScript('before-hydration')` and sets `transferCache: true`
|
|
65
|
+
* on the middleware. Islands skip the style pipeline during hydration.
|
|
66
|
+
*
|
|
67
|
+
* When `false`: no client JS is shipped and `transferCache` is set
|
|
68
|
+
* to `false`. Use this for fully static sites without `client:*`
|
|
69
|
+
* directives.
|
|
70
|
+
*/
|
|
71
|
+
islands?: boolean;
|
|
72
|
+
/** Configure inline or build-wide extracted CSS delivery. */
|
|
73
|
+
css?: TastyIntegrationCSSOptions;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Astro integration that automatically sets up Tasty SSR.
|
|
77
|
+
*
|
|
78
|
+
* Registers middleware for cross-component CSS deduplication and
|
|
79
|
+
* optionally injects a client hydration script for island support.
|
|
80
|
+
*
|
|
81
|
+
* @example Basic setup (with islands)
|
|
82
|
+
* ```ts
|
|
83
|
+
* // astro.config.mjs
|
|
84
|
+
* import { tastyIntegration } from '@tenphi/tasty/ssr/astro';
|
|
85
|
+
*
|
|
86
|
+
* export default defineConfig({
|
|
87
|
+
* integrations: [tastyIntegration()],
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example Static-only (no client JS)
|
|
92
|
+
* ```ts
|
|
93
|
+
* // astro.config.mjs
|
|
94
|
+
* import { tastyIntegration } from '@tenphi/tasty/ssr/astro';
|
|
95
|
+
*
|
|
96
|
+
* export default defineConfig({
|
|
97
|
+
* integrations: [tastyIntegration({ islands: false })],
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
25
100
|
*/
|
|
26
|
-
declare function
|
|
101
|
+
declare function tastyIntegration(options?: TastyIntegrationOptions): {
|
|
102
|
+
name: string;
|
|
103
|
+
hooks: {
|
|
104
|
+
'astro:config:setup': ({
|
|
105
|
+
addMiddleware,
|
|
106
|
+
injectScript
|
|
107
|
+
}: {
|
|
108
|
+
addMiddleware: (middleware: {
|
|
109
|
+
entrypoint: string | URL;
|
|
110
|
+
order: "pre" | "post";
|
|
111
|
+
}) => void;
|
|
112
|
+
injectScript: (stage: "head-inline" | "before-hydration" | "page" | "page-ssr", content: string) => void;
|
|
113
|
+
}) => void;
|
|
114
|
+
'astro:config:done': ({
|
|
115
|
+
config
|
|
116
|
+
}: {
|
|
117
|
+
config: {
|
|
118
|
+
base?: string;
|
|
119
|
+
site?: URL;
|
|
120
|
+
build?: {
|
|
121
|
+
assets?: string;
|
|
122
|
+
assetsPrefix?: string | Record<string, string>;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
}) => void;
|
|
126
|
+
'astro:build:done': ({
|
|
127
|
+
dir
|
|
128
|
+
}: {
|
|
129
|
+
dir: URL;
|
|
130
|
+
}) => Promise<void>;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
27
133
|
//#endregion
|
|
28
|
-
export { TastyMiddlewareOptions,
|
|
134
|
+
export { TastyIntegrationCSSOptions, TastyIntegrationOptions, TastyMiddlewareOptions, tastyIntegration, tastyMiddleware };
|
|
29
135
|
//# sourceMappingURL=astro.d.ts.map
|
package/dist/ssr/astro.js
CHANGED
|
@@ -1,64 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ServerStyleCollector } from "./collector.js";
|
|
4
|
-
import { getSSRCollector, runWithCollector } from "./async-storage.js";
|
|
5
|
-
import { hydrateTastyCache } from "./hydrate.js";
|
|
6
|
-
//#region src/ssr/astro.ts
|
|
7
|
-
/**
|
|
8
|
-
* Astro integration for Tasty SSR.
|
|
9
|
-
*
|
|
10
|
-
* Provides tastyMiddleware() for Astro's middleware system.
|
|
11
|
-
* The middleware wraps request handling in a ServerStyleCollector
|
|
12
|
-
* via AsyncLocalStorage, then injects collected CSS into </head>.
|
|
13
|
-
*
|
|
14
|
-
* Import from '@tenphi/tasty/ssr/astro'.
|
|
15
|
-
*/
|
|
16
|
-
registerSSRCollectorGetter(getSSRCollector);
|
|
17
|
-
/**
|
|
18
|
-
* Create an Astro middleware that collects Tasty styles during SSR.
|
|
19
|
-
*
|
|
20
|
-
* All React components rendered during the request (both static
|
|
21
|
-
* and islands) will have their useStyles() calls captured by the
|
|
22
|
-
* collector via AsyncLocalStorage. After rendering, the middleware
|
|
23
|
-
* injects the collected CSS into </head>.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* // src/middleware.ts
|
|
28
|
-
* import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';
|
|
29
|
-
* export const onRequest = tastyMiddleware();
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
function tastyMiddleware(options) {
|
|
33
|
-
const { transferCache = true } = options ?? {};
|
|
34
|
-
return async (_context, next) => {
|
|
35
|
-
const collector = new ServerStyleCollector();
|
|
36
|
-
const response = await runWithCollector(collector, () => next());
|
|
37
|
-
const css = collector.getCSS();
|
|
38
|
-
if (!css) return response;
|
|
39
|
-
const nonce = getConfig().nonce;
|
|
40
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
41
|
-
const html = await response.text();
|
|
42
|
-
const styleTag = `<style data-tasty-ssr${nonceAttr}>${css}</style>`;
|
|
43
|
-
let cacheTag = "";
|
|
44
|
-
if (transferCache) {
|
|
45
|
-
const cacheState = collector.getCacheState();
|
|
46
|
-
if (Object.keys(cacheState.entries).length > 0) cacheTag = `<script data-tasty-cache type="application/json"${nonceAttr}>${JSON.stringify(cacheState)}<\/script>`;
|
|
47
|
-
}
|
|
48
|
-
const modifiedHtml = html.replace("</head>", `${styleTag}${cacheTag}</head>`);
|
|
49
|
-
return new Response(modifiedHtml, {
|
|
50
|
-
status: response.status,
|
|
51
|
-
headers: response.headers
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
if (typeof window !== "undefined") {
|
|
56
|
-
const script = document.querySelector("script[data-tasty-cache]");
|
|
57
|
-
if (script) try {
|
|
58
|
-
hydrateTastyCache(JSON.parse(script.textContent));
|
|
59
|
-
} catch {}
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
export { hydrateTastyCache, tastyMiddleware };
|
|
63
|
-
|
|
64
|
-
//# sourceMappingURL=astro.js.map
|
|
1
|
+
import { n as tastyMiddleware, t as tastyIntegration } from "../astro-CeYENy2x.js";
|
|
2
|
+
export { tastyIntegration, tastyMiddleware };
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { i as createServerStyleCollector, n as ServerStyleArtifactKind, r as ServerStyleCollector, t as ServerStyleArtifact } from "../collector-BTVXj2hS.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ssr/async-storage.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Run a function with a ServerStyleCollector bound to the current
|
|
6
|
+
* async context. All useStyles() calls within `fn` (and any async
|
|
7
|
+
* continuations) will find this collector via getSSRCollector().
|
|
8
|
+
*/
|
|
9
|
+
declare function runWithCollector<T>(collector: ServerStyleCollector, fn: () => T): T;
|
|
10
|
+
/**
|
|
11
|
+
* Retrieve the ServerStyleCollector bound to the current async context.
|
|
12
|
+
* Returns null when called outside of runWithCollector() or on the client.
|
|
13
|
+
*/
|
|
14
|
+
declare function getSSRCollector(): ServerStyleCollector | null;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/ssr/hydrate.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Client-side cache hydration for SSR/RSC.
|
|
19
|
+
*
|
|
20
|
+
* Pre-populates the client injector's rules map with class names
|
|
21
|
+
* rendered on the server. With hash-based naming, the client derives
|
|
22
|
+
* the same class name from the same cache key, so only the class name
|
|
23
|
+
* list needs to cross the wire — no cache keys or counters.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Pre-populate the client-side style registry from the server's class name list.
|
|
27
|
+
*
|
|
28
|
+
* Call this before ReactDOM.hydrateRoot() or ensure it runs before
|
|
29
|
+
* any tasty() component renders on the client.
|
|
30
|
+
*
|
|
31
|
+
* When called without arguments, reads the class list from `window.__TASTY__`
|
|
32
|
+
* (populated by inline scripts emitted during SSR/RSC streaming).
|
|
33
|
+
*/
|
|
34
|
+
declare function hydrateTastyClasses(classes?: string[]): void;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { type ServerStyleArtifact, type ServerStyleArtifactKind, ServerStyleCollector, createServerStyleCollector, getSSRCollector, hydrateTastyClasses, runWithCollector };
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ServerStyleCollector } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { r as registerSSRCollectorGetterGlobal } from "../ssr-collector-ref-COs_ioWl.js";
|
|
2
|
+
import { n as createServerStyleCollector, t as ServerStyleCollector } from "../collector-B3OsM252.js";
|
|
3
|
+
import { n as runWithCollector, t as getSSRCollector } from "../async-storage-DKK-wTD4.js";
|
|
4
|
+
import { t as hydrateTastyClasses } from "../hydrate-CNOmZprz.js";
|
|
5
5
|
//#region src/ssr/index.ts
|
|
6
|
-
|
|
6
|
+
registerSSRCollectorGetterGlobal(getSSRCollector);
|
|
7
7
|
//#endregion
|
|
8
|
-
export { ServerStyleCollector, getSSRCollector,
|
|
8
|
+
export { ServerStyleCollector, createServerStyleCollector, getSSRCollector, hydrateTastyClasses, runWithCollector };
|
|
9
9
|
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/dist/ssr/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/ssr/index.ts"],"sourcesContent":["/**\n * SSR entry point for @tenphi/tasty.\n *\n * Provides the core SSR infrastructure: ServerStyleCollector,\n * AsyncLocalStorage integration, and cache hydration.\n *\n * Import from '@tenphi/tasty/ssr'.\n */\n\n// Core collector\nexport { ServerStyleCollector } from './collector';\nexport type {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/ssr/index.ts"],"sourcesContent":["/**\n * SSR entry point for @tenphi/tasty.\n *\n * Provides the core SSR infrastructure: ServerStyleCollector,\n * AsyncLocalStorage integration, and cache hydration.\n *\n * Import from '@tenphi/tasty/ssr'.\n */\n\n// Core collector\nexport { ServerStyleCollector, createServerStyleCollector } from './collector';\nexport type { ServerStyleArtifact, ServerStyleArtifactKind } from './collector';\n\n// AsyncLocalStorage integration for Astro / generic frameworks\nexport { runWithCollector, getSSRCollector } from './async-storage';\n\n// Client-side cache hydration\nexport { hydrateTastyClasses } from './hydrate';\n\n// Register the ALS getter so hooks can find the collector\n// without importing 'node:async_hooks' in the browser bundle.\n// Uses globalThis so the getter is visible across separate module graphs.\nimport { getSSRCollector } from './async-storage';\nimport { registerSSRCollectorGetterGlobal } from './ssr-collector-ref';\n\nregisterSSRCollectorGetterGlobal(getSSRCollector);\n"],"mappings":";;;;;AAyBA,iCAAiC,eAAe"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { t as TastyConfig } from "../config-LfIDmVHx.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ssr/next-config.d.ts
|
|
4
|
+
interface NextConfig {
|
|
5
|
+
basePath?: string;
|
|
6
|
+
env?: Record<string, string | undefined>;
|
|
7
|
+
headers?: () => Promise<NextHeader[]>;
|
|
8
|
+
output?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
interface NextHeader {
|
|
12
|
+
source: string;
|
|
13
|
+
headers: {
|
|
14
|
+
key: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
interface TastyNextOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Next.js project directory. Useful when the build command runs from a
|
|
22
|
+
* monorepo root rather than the app directory.
|
|
23
|
+
*
|
|
24
|
+
* @default process.cwd()
|
|
25
|
+
*/
|
|
26
|
+
rootDir?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Tasty configuration used to generate the shared stylesheet.
|
|
29
|
+
* `config` takes precedence when both config sources are provided.
|
|
30
|
+
*/
|
|
31
|
+
config?: TastyConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Project-relative path to a TypeScript/JavaScript module whose default
|
|
34
|
+
* export is a Tasty configuration object.
|
|
35
|
+
*
|
|
36
|
+
* @example './app/tasty.config.ts'
|
|
37
|
+
*/
|
|
38
|
+
configFile?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Filesystem directory for generated stylesheets. When it is inside the
|
|
41
|
+
* project's `public` directory, its public URL is inferred automatically.
|
|
42
|
+
*
|
|
43
|
+
* @default 'public/_tasty'
|
|
44
|
+
*/
|
|
45
|
+
outputDir?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Root-relative URL path corresponding to `outputDir`. This is required
|
|
48
|
+
* when `outputDir` is outside the project's `public` directory.
|
|
49
|
+
* The Next.js `basePath` is prepended automatically.
|
|
50
|
+
*
|
|
51
|
+
* @default inferred from outputDir
|
|
52
|
+
* @example '/assets/tasty'
|
|
53
|
+
*/
|
|
54
|
+
publicPath?: string;
|
|
55
|
+
/** Whether to generate and register the shared stylesheet. @default true */
|
|
56
|
+
enabled?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Add a cacheable, content-hashed stylesheet for Tasty configuration globals.
|
|
60
|
+
* Route-dependent component and hook styles continue to stream through
|
|
61
|
+
* `TastyRegistry` so App Router navigation and Suspense remain correct.
|
|
62
|
+
*/
|
|
63
|
+
declare function withTastyNext(options: TastyNextOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { TastyNextOptions, withTastyNext };
|
|
66
|
+
//# sourceMappingURL=next-config.d.ts.map
|