@tenphi/tasty 0.0.0-snapshot.db103fd → 0.0.0-snapshot.dc62ea3
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 -33
- package/dist/core/index.js +6 -26
- 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 -50
- package/dist/index.js +922 -35
- 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 -5
- package/dist/ssr/index.js +6 -7
- 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 -7
- package/dist/ssr/next.js +38 -16
- 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 +116 -35
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +741 -0
- package/docs/plugins.md +353 -0
- package/docs/react-api.md +681 -0
- package/docs/runtime-benchmarks.md +351 -0
- package/docs/ssr.md +356 -130
- package/docs/styles.md +79 -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/config.d.ts +0 -366
- package/dist/config.js +0 -503
- 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/resolve-ssr-collector.js +0 -14
- package/dist/hooks/resolve-ssr-collector.js.map +0 -1
- package/dist/hooks/useCounterStyle.d.ts +0 -50
- package/dist/hooks/useCounterStyle.js +0 -46
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -43
- package/dist/hooks/useFontFace.js +0 -70
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -30
- package/dist/hooks/useGlobalStyles.js +0 -78
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -64
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -109
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -35
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -45
- package/dist/hooks/useStyles.js +0 -237
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -183
- package/dist/injector/index.js +0 -179
- 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 -49
- 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 -226
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/context.d.ts +0 -8
- package/dist/ssr/context.js +0 -13
- package/dist/ssr/context.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/align.d.ts +0 -15
- package/dist/styles/align.js +0 -14
- package/dist/styles/align.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -113
- 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/createStyle.js +0 -79
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -96
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/display.d.ts +0 -37
- package/dist/styles/display.js +0 -66
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -57
- 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 -36
- 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 -52
- package/dist/styles/inset.js +0 -149
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/justify.d.ts +0 -15
- package/dist/styles/justify.js +0 -14
- package/dist/styles/justify.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -98
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -103
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -64
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -103
- package/dist/styles/padding.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 -126
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -12
- package/dist/styles/radius.js +0 -71
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -46
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -23
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -157
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/types.d.ts +0 -549
- 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 -119
- package/dist/tasty.js +0 -231
- 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 -21
- package/dist/utils/process-tokens.js +0 -90
- 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/docs/runtime.md +0 -485
- /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
package/dist/zero/babel.d.ts
CHANGED
|
@@ -1,182 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { StyleHandlerDefinition } from "../utils/styles.js";
|
|
4
|
-
import { ConfigTokens, RecipeStyles } from "../styles/types.js";
|
|
5
|
-
import { TastyPlugin } from "../plugins/types.js";
|
|
6
|
-
import * as _$_babel_core0 from "@babel/core";
|
|
7
|
-
import { PluginPass } from "@babel/core";
|
|
8
|
-
|
|
9
|
-
//#region src/zero/babel.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* Build-time configuration for zero-runtime mode.
|
|
12
|
-
* Subset of TastyConfig that applies at build time.
|
|
13
|
-
*/
|
|
14
|
-
interface TastyZeroConfig {
|
|
15
|
-
/**
|
|
16
|
-
* Global predefined states for advanced state mapping.
|
|
17
|
-
* Example: { '@mobile': '@media(w < 768px)', '@dark': '@root(theme=dark)' }
|
|
18
|
-
*/
|
|
19
|
-
states?: Record<string, string>;
|
|
20
|
-
/**
|
|
21
|
-
* Enable development mode features: source comments in generated CSS.
|
|
22
|
-
* Default: false
|
|
23
|
-
*/
|
|
24
|
-
devMode?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Parser LRU cache size (default: 1000).
|
|
27
|
-
* Larger values improve performance for builds with many unique style values.
|
|
28
|
-
*/
|
|
29
|
-
parserCacheSize?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Custom units for the style parser (merged with built-in units).
|
|
32
|
-
* Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
|
|
33
|
-
* @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
|
|
34
|
-
*/
|
|
35
|
-
units?: Record<string, string | UnitHandler>;
|
|
36
|
-
/**
|
|
37
|
-
* Custom functions for the style parser (merged with existing).
|
|
38
|
-
* Functions process parsed style groups and return CSS values.
|
|
39
|
-
* @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
|
|
40
|
-
*/
|
|
41
|
-
funcs?: Record<string, (groups: StyleDetails[]) => string>;
|
|
42
|
-
/**
|
|
43
|
-
* Plugins that extend tasty with custom functions, units, states, and handlers.
|
|
44
|
-
* Plugins are processed in order, with later plugins overriding earlier ones.
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* import { okhslPlugin } from '@tenphi/tasty';
|
|
48
|
-
*
|
|
49
|
-
* // babel.config.js
|
|
50
|
-
* module.exports = {
|
|
51
|
-
* plugins: [
|
|
52
|
-
* ['@tenphi/tasty/babel-plugin', {
|
|
53
|
-
* config: { plugins: [okhslPlugin()] }
|
|
54
|
-
* }]
|
|
55
|
-
* ]
|
|
56
|
-
* };
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
plugins?: TastyPlugin[];
|
|
60
|
-
/**
|
|
61
|
-
* Global keyframes definitions for static extraction.
|
|
62
|
-
* Keys are animation names, values are keyframes step definitions.
|
|
63
|
-
* @example { fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } } }
|
|
64
|
-
*/
|
|
65
|
-
keyframes?: Record<string, KeyframesSteps>;
|
|
66
|
-
/**
|
|
67
|
-
* Global @font-face definitions for static extraction.
|
|
68
|
-
* Keys are font-family names, values are descriptors or arrays of descriptors.
|
|
69
|
-
*/
|
|
70
|
-
fontFace?: Record<string, FontFaceInput>;
|
|
71
|
-
/**
|
|
72
|
-
* Global @counter-style definitions for static extraction.
|
|
73
|
-
* Keys are counter-style names, values are descriptor objects.
|
|
74
|
-
*/
|
|
75
|
-
counterStyle?: Record<string, CounterStyleDescriptors>;
|
|
76
|
-
/**
|
|
77
|
-
* Custom style handlers that transform style properties into CSS declarations.
|
|
78
|
-
* Handlers replace built-in handlers for the same style name.
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* handlers: {
|
|
82
|
-
* fill: ({ fill }) => fill ? { 'background-color': fill } : undefined,
|
|
83
|
-
* elevation: ({ elevation }) => ({
|
|
84
|
-
* 'box-shadow': `0 ${elevation}px ${elevation * 2}px rgba(0,0,0,0.1)`,
|
|
85
|
-
* }),
|
|
86
|
-
* }
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
handlers?: Record<string, StyleHandlerDefinition>;
|
|
90
|
-
/**
|
|
91
|
-
* Design tokens injected as CSS custom properties on `:root`.
|
|
92
|
-
* Values are parsed through the Tasty DSL. Supports state maps.
|
|
93
|
-
* @example { '$gap': '4px', '#primary': { '': '#purple', '@dark': '#light-purple' } }
|
|
94
|
-
*/
|
|
95
|
-
tokens?: ConfigTokens;
|
|
96
|
-
/**
|
|
97
|
-
* Predefined tokens replaced during style parsing (parse-time substitution).
|
|
98
|
-
* Use `$name` for custom properties and `#name` for color tokens.
|
|
99
|
-
* @example { $spacing: '2x', '#accent': '#purple' }
|
|
100
|
-
*/
|
|
101
|
-
replaceTokens?: Record<`$${string}` | `#${string}`, string | number>;
|
|
102
|
-
/**
|
|
103
|
-
* Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
|
|
104
|
-
* Recipe values are flat tasty styles (no sub-element keys).
|
|
105
|
-
* @example
|
|
106
|
-
* ```ts
|
|
107
|
-
* recipes: {
|
|
108
|
-
* card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
|
|
109
|
-
* elevated: { shadow: '2x 2x 4x #shadow' },
|
|
110
|
-
* }
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
recipes?: Record<string, RecipeStyles>;
|
|
114
|
-
/**
|
|
115
|
-
* Automatically infer and register CSS @property declarations from values.
|
|
116
|
-
* @default true
|
|
117
|
-
*/
|
|
118
|
-
autoPropertyTypes?: boolean;
|
|
119
|
-
}
|
|
120
|
-
interface TastyZeroBabelOptions {
|
|
121
|
-
/** Output path for generated CSS (default: 'tasty.css') */
|
|
122
|
-
output?: string;
|
|
123
|
-
/**
|
|
124
|
-
* Tasty configuration for build-time processing.
|
|
125
|
-
* Can be a static object or a factory function that returns fresh config.
|
|
126
|
-
* A factory is called on each plugin invocation, enabling hot reload
|
|
127
|
-
* of config values that depend on external files (e.g. theme tokens).
|
|
128
|
-
*/
|
|
129
|
-
config?: TastyZeroConfig | (() => TastyZeroConfig);
|
|
130
|
-
/**
|
|
131
|
-
* Absolute path to a TypeScript/JavaScript module that default-exports
|
|
132
|
-
* a `TastyZeroConfig` object. The module is loaded via jiti on each
|
|
133
|
-
* plugin invocation, enabling hot reload when the file changes.
|
|
134
|
-
*
|
|
135
|
-
* This option is JSON-serializable and is the primary way Turbopack
|
|
136
|
-
* passes config to the Babel plugin (since Turbopack loader options
|
|
137
|
-
* must be plain primitives/objects/arrays).
|
|
138
|
-
*
|
|
139
|
-
* When both `config` and `configFile` are set, `config` takes precedence.
|
|
140
|
-
*
|
|
141
|
-
* @example '/absolute/path/to/tasty-zero.config.ts'
|
|
142
|
-
*/
|
|
143
|
-
configFile?: string;
|
|
144
|
-
/**
|
|
145
|
-
* Absolute file paths whose content affects the generated CSS.
|
|
146
|
-
* When any of these files change, babel-loader invalidates its cache
|
|
147
|
-
* and re-runs the plugin with fresh config values.
|
|
148
|
-
*
|
|
149
|
-
* Typically includes theme files that define Glaze palettes or token values.
|
|
150
|
-
* Paths must be absolute (resolved by the Next.js wrapper).
|
|
151
|
-
*/
|
|
152
|
-
configDeps?: string[];
|
|
153
|
-
/**
|
|
154
|
-
* Automatically replace `@tenphi/tasty/static` imports with an import
|
|
155
|
-
* of the generated CSS file. This eliminates the need for users to
|
|
156
|
-
* manually import the CSS in their app entry point.
|
|
157
|
-
*
|
|
158
|
-
* @default true
|
|
159
|
-
*/
|
|
160
|
-
injectImport?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Output mode for extracted CSS.
|
|
163
|
-
*
|
|
164
|
-
* - `'file'` (default): CSS is written to a single output file and
|
|
165
|
-
* the `@tenphi/tasty/static` import is rewritten to import that file.
|
|
166
|
-
* - `'inject'`: CSS is embedded inline in the JS output and injected
|
|
167
|
-
* at runtime via a tiny injector from `@tenphi/tasty/static/inject`.
|
|
168
|
-
* No CSS file is written. Each `tastyStatic` call becomes
|
|
169
|
-
* self-contained. Best for reusable components and extensions.
|
|
170
|
-
*
|
|
171
|
-
* When `mode` is `'inject'`, `output` and `injectImport` are ignored.
|
|
172
|
-
*
|
|
173
|
-
* @default 'file'
|
|
174
|
-
*/
|
|
175
|
-
mode?: 'file' | 'inject';
|
|
176
|
-
}
|
|
177
|
-
/** Clear the shared CSSWriter cache. Exposed for testing. */
|
|
178
|
-
declare function clearWriterCache(): void;
|
|
179
|
-
declare const _default: (api: object, options: TastyZeroBabelOptions | null | undefined, dirname: string) => _$_babel_core0.PluginObj<PluginPass>;
|
|
180
|
-
//#endregion
|
|
181
|
-
export { TastyZeroBabelOptions, TastyZeroConfig, clearWriterCache, _default as default };
|
|
182
|
-
//# sourceMappingURL=babel.d.ts.map
|
|
1
|
+
import { n as _default, r as TastyZeroConfig, t as TastyZeroBabelOptions } from "../babel-DWCsafYw.js";
|
|
2
|
+
export { TastyZeroBabelOptions, type TastyZeroConfig, _default as default };
|
package/dist/zero/babel.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { extractCounterStyleFromStyles, extractFontFaceFromStyles, extractKeyframesFromStyles, extractPropertiesFromStyles, extractStylesForSelector, extractStylesWithChunks } from "./extractor.js";
|
|
6
|
-
import { CSSWriter } from "./css-writer.js";
|
|
1
|
+
import { b as resetConfig, d as getGlobalStyles, i as getGlobalConfigTokens, s as getGlobalFunctions, t as configure } from "../config-B3gPdCqd.js";
|
|
2
|
+
import { t as mergeStyles } from "../merge-styles-DuoZEsm9.js";
|
|
3
|
+
import { t as resolveRecipes } from "../resolve-recipes-H9NqOQuP.js";
|
|
4
|
+
import { a as extractFunctionsFromStyles, c as extractStylesForSelector, i as extractFontFaceFromStyles, l as extractStylesWithChunks, o as extractKeyframesFromStyles, r as extractCounterStyleFromStyles, s as extractPropertiesFromStyles, t as CSSWriter, u as setExtractorNamePrefix } from "../css-writer-Bgowobbx.js";
|
|
7
5
|
import * as fs from "fs";
|
|
8
6
|
import * as path from "path";
|
|
9
7
|
import { declare } from "@babel/helper-plugin-utils";
|
|
10
8
|
import * as t from "@babel/types";
|
|
11
9
|
import { createJiti } from "jiti";
|
|
10
|
+
//#region \0rolldown/runtime.js
|
|
11
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/zero/writer-cache.ts
|
|
17
|
+
const writerCache = /* @__PURE__ */ new Map();
|
|
18
|
+
//#endregion
|
|
12
19
|
//#region src/zero/babel.ts
|
|
13
20
|
/**
|
|
14
21
|
* Babel plugin for zero-runtime tasty static site generation.
|
|
@@ -50,11 +57,6 @@ function clearRequireCacheTree(filePath) {
|
|
|
50
57
|
}
|
|
51
58
|
delete __require.cache[resolved];
|
|
52
59
|
}
|
|
53
|
-
const writerCache = /* @__PURE__ */ new Map();
|
|
54
|
-
/** Clear the shared CSSWriter cache. Exposed for testing. */
|
|
55
|
-
function clearWriterCache() {
|
|
56
|
-
writerCache.clear();
|
|
57
|
-
}
|
|
58
60
|
var babel_default = declare((api, options) => {
|
|
59
61
|
api.assertVersion(7);
|
|
60
62
|
const mode = options.mode ?? "file";
|
|
@@ -80,24 +82,33 @@ var babel_default = declare((api, options) => {
|
|
|
80
82
|
const configOption = options.config;
|
|
81
83
|
let resolvedConfig;
|
|
82
84
|
if (configOption) resolvedConfig = typeof configOption === "function" ? configOption() : configOption;
|
|
83
|
-
else if (options.configFile)
|
|
84
|
-
|
|
85
|
+
else if (options.configFile) {
|
|
86
|
+
const loaded = createJiti(path.dirname(options.configFile), { moduleCache: false })(options.configFile);
|
|
87
|
+
resolvedConfig = loaded && typeof loaded === "object" && "default" in loaded ? loaded.default : loaded;
|
|
88
|
+
} else resolvedConfig = {};
|
|
85
89
|
const devMode = resolvedConfig.devMode ?? false;
|
|
86
90
|
if (cached) resetConfig();
|
|
87
|
-
|
|
91
|
+
const finalConfig = {
|
|
92
|
+
namePrefix: "ts",
|
|
93
|
+
...resolvedConfig
|
|
94
|
+
};
|
|
95
|
+
configure(finalConfig);
|
|
96
|
+
setExtractorNamePrefix(finalConfig.namePrefix ?? "ts");
|
|
88
97
|
const newWriter = new CSSWriter(outputPath, { devMode });
|
|
89
98
|
if (mode !== "inject") {
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
const tokenCSS = extractCSSFromStyles(":root", getGlobalConfigTokens());
|
|
100
|
+
if (tokenCSS) newWriter.add(":root:tokens", tokenCSS);
|
|
101
|
+
const globalStyles = getGlobalStyles();
|
|
102
|
+
if (globalStyles) for (const [selector, styles] of Object.entries(globalStyles)) {
|
|
103
|
+
const css = extractCSSFromStyles(selector, styles);
|
|
104
|
+
if (css) newWriter.add(`global:${selector}`, css);
|
|
94
105
|
}
|
|
95
106
|
}
|
|
96
107
|
writerCache.set(resolvedOutputPath, {
|
|
97
108
|
writer: newWriter,
|
|
98
109
|
configKey,
|
|
99
110
|
registry: {},
|
|
100
|
-
config:
|
|
111
|
+
config: finalConfig
|
|
101
112
|
});
|
|
102
113
|
}
|
|
103
114
|
const entry = writerCache.get(resolvedOutputPath);
|
|
@@ -105,12 +116,19 @@ var babel_default = declare((api, options) => {
|
|
|
105
116
|
const globalRegistry = entry.registry;
|
|
106
117
|
const config = entry.config;
|
|
107
118
|
const devMode = config.devMode ?? false;
|
|
119
|
+
setExtractorNamePrefix(config.namePrefix ?? "ts");
|
|
108
120
|
let tokenCSS;
|
|
121
|
+
let globalStylesCSS;
|
|
109
122
|
if (mode === "inject") {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
tokenCSS = extractCSSFromStyles(":root", getGlobalConfigTokens());
|
|
124
|
+
const gs = getGlobalStyles();
|
|
125
|
+
if (gs) {
|
|
126
|
+
globalStylesCSS = /* @__PURE__ */ new Map();
|
|
127
|
+
for (const [selector, styles] of Object.entries(gs)) {
|
|
128
|
+
const css = extractCSSFromStyles(selector, styles);
|
|
129
|
+
if (css) globalStylesCSS.set(selector, css);
|
|
130
|
+
}
|
|
131
|
+
if (globalStylesCSS.size === 0) globalStylesCSS = void 0;
|
|
114
132
|
}
|
|
115
133
|
}
|
|
116
134
|
return {
|
|
@@ -141,9 +159,9 @@ var babel_default = declare((api, options) => {
|
|
|
141
159
|
const args = path.node.arguments;
|
|
142
160
|
if (args.length === 0) throw path.buildCodeFrameError("tastyStatic() requires at least one argument");
|
|
143
161
|
const firstArg = args[0];
|
|
144
|
-
if (t.isStringLiteral(firstArg)) handleSelectorMode(path, args, cssWriter, mode, state.sourceFile, config.keyframes, config.autoPropertyTypes, config.
|
|
145
|
-
else if (t.isObjectExpression(firstArg)) handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, config.keyframes, config.autoPropertyTypes, config.
|
|
146
|
-
else if (t.isIdentifier(firstArg)) handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, config.keyframes, config.autoPropertyTypes, config.
|
|
162
|
+
if (t.isStringLiteral(firstArg)) handleSelectorMode(path, args, cssWriter, mode, state.sourceFile, config.keyframes, config.autoPropertyTypes, config.fontFaces, config.counterStyles, getGlobalFunctions() ?? void 0);
|
|
163
|
+
else if (t.isObjectExpression(firstArg)) handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, config.keyframes, config.autoPropertyTypes, config.fontFaces, config.counterStyles, getGlobalFunctions() ?? void 0);
|
|
164
|
+
else if (t.isIdentifier(firstArg)) handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, config.keyframes, config.autoPropertyTypes, config.fontFaces, config.counterStyles, getGlobalFunctions() ?? void 0);
|
|
147
165
|
else throw path.buildCodeFrameError("tastyStatic() first argument must be an object (styles), identifier (base StaticStyle), or string (selector)");
|
|
148
166
|
},
|
|
149
167
|
VariableDeclarator(path, state) {
|
|
@@ -168,12 +186,20 @@ var babel_default = declare((api, options) => {
|
|
|
168
186
|
},
|
|
169
187
|
post() {
|
|
170
188
|
if (mode === "inject") {
|
|
171
|
-
if (this._fileAddedCSS && tokenCSS) {
|
|
189
|
+
if (this._fileAddedCSS && (tokenCSS || globalStylesCSS)) {
|
|
172
190
|
const program = this.file.ast.program;
|
|
173
|
-
const injectCall = createInjectCallAST(":root", tokenCSS);
|
|
174
191
|
let insertIndex = 0;
|
|
175
192
|
for (let i = 0; i < program.body.length; i++) if (t.isImportDeclaration(program.body[i])) insertIndex = i + 1;
|
|
176
|
-
|
|
193
|
+
if (tokenCSS) {
|
|
194
|
+
const injectCall = createInjectCallAST(":root", tokenCSS);
|
|
195
|
+
program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
|
|
196
|
+
insertIndex++;
|
|
197
|
+
}
|
|
198
|
+
if (globalStylesCSS) for (const [selector, css] of globalStylesCSS) {
|
|
199
|
+
const injectCall = createInjectCallAST(selector, css);
|
|
200
|
+
program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
|
|
201
|
+
insertIndex++;
|
|
202
|
+
}
|
|
177
203
|
}
|
|
178
204
|
return;
|
|
179
205
|
}
|
|
@@ -206,7 +232,7 @@ function extractClassNameFromStaticStyleObject(node) {
|
|
|
206
232
|
/**
|
|
207
233
|
* Handle tastyStatic(styles) - returns StaticStyle object
|
|
208
234
|
*/
|
|
209
|
-
function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle) {
|
|
235
|
+
function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction) {
|
|
210
236
|
const stylesArg = args[0];
|
|
211
237
|
if (!t.isObjectExpression(stylesArg)) throw path.buildCodeFrameError("tastyStatic(styles) argument must be a static object literal");
|
|
212
238
|
const styles = resolveRecipes(evaluateObjectExpression(stylesArg, path));
|
|
@@ -214,14 +240,15 @@ function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, gl
|
|
|
214
240
|
const properties = extractPropertiesFromStyles(styles, { autoPropertyTypes });
|
|
215
241
|
const fontFaces = extractFontFaceFromStyles(styles, globalFontFace);
|
|
216
242
|
const counterStyles = extractCounterStyleFromStyles(styles, globalCounterStyle);
|
|
243
|
+
const functions = extractFunctionsFromStyles(styles, globalFunction);
|
|
217
244
|
const chunks = extractStylesWithChunks(styles);
|
|
218
245
|
const className = chunks.length > 0 ? chunks.map((c) => c.className).join(" ") : "";
|
|
219
246
|
const staticStyleObject = createStaticStyleAST(className, styles);
|
|
220
247
|
if (mode === "inject") {
|
|
221
|
-
const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap));
|
|
248
|
+
const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap));
|
|
222
249
|
path.replaceWith(t.sequenceExpression([injectCall, staticStyleObject]));
|
|
223
250
|
} else {
|
|
224
|
-
writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, chunks, nameMap, state.sourceFile);
|
|
251
|
+
writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, state.sourceFile);
|
|
225
252
|
path.replaceWith(staticStyleObject);
|
|
226
253
|
}
|
|
227
254
|
registerIfVariableDeclaration(path, className, styles, state, globalRegistry);
|
|
@@ -229,7 +256,7 @@ function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, gl
|
|
|
229
256
|
/**
|
|
230
257
|
* Handle tastyStatic(base, styles) - extends base with additional styles
|
|
231
258
|
*/
|
|
232
|
-
function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle) {
|
|
259
|
+
function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction) {
|
|
233
260
|
if (args.length < 2) throw path.buildCodeFrameError("tastyStatic(base, styles) requires two arguments");
|
|
234
261
|
const baseArg = args[0];
|
|
235
262
|
const stylesArg = args[1];
|
|
@@ -244,14 +271,15 @@ function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode,
|
|
|
244
271
|
const properties = extractPropertiesFromStyles(mergedStyles, { autoPropertyTypes });
|
|
245
272
|
const fontFaces = extractFontFaceFromStyles(mergedStyles, globalFontFace);
|
|
246
273
|
const counterStyles = extractCounterStyleFromStyles(mergedStyles, globalCounterStyle);
|
|
274
|
+
const functions = extractFunctionsFromStyles(mergedStyles, globalFunction);
|
|
247
275
|
const chunks = extractStylesWithChunks(mergedStyles);
|
|
248
276
|
const className = chunks.length > 0 ? chunks.map((c) => c.className).join(" ") : "";
|
|
249
277
|
const staticStyleObject = createStaticStyleAST(className, mergedStyles);
|
|
250
278
|
if (mode === "inject") {
|
|
251
|
-
const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap));
|
|
279
|
+
const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap));
|
|
252
280
|
path.replaceWith(t.sequenceExpression([injectCall, staticStyleObject]));
|
|
253
281
|
} else {
|
|
254
|
-
writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, chunks, nameMap, state.sourceFile);
|
|
282
|
+
writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, state.sourceFile);
|
|
255
283
|
path.replaceWith(staticStyleObject);
|
|
256
284
|
}
|
|
257
285
|
registerIfVariableDeclaration(path, className, mergedStyles, state, globalRegistry);
|
|
@@ -259,7 +287,7 @@ function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode,
|
|
|
259
287
|
/**
|
|
260
288
|
* Handle tastyStatic(selector, styles) - removes the call entirely
|
|
261
289
|
*/
|
|
262
|
-
function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle) {
|
|
290
|
+
function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction) {
|
|
263
291
|
if (args.length < 2) throw path.buildCodeFrameError("tastyStatic(selector, styles) requires two arguments");
|
|
264
292
|
const selectorArg = args[0];
|
|
265
293
|
const stylesArg = args[1];
|
|
@@ -271,6 +299,7 @@ function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyfr
|
|
|
271
299
|
const properties = extractPropertiesFromStyles(styles, { autoPropertyTypes });
|
|
272
300
|
const fontFaces = extractFontFaceFromStyles(styles, globalFontFace);
|
|
273
301
|
const counterStyles = extractCounterStyleFromStyles(styles, globalCounterStyle);
|
|
302
|
+
const functions = extractFunctionsFromStyles(styles, globalFunction);
|
|
274
303
|
const result = extractStylesForSelector(selector, styles);
|
|
275
304
|
const selectorCSS = nameMap.size > 0 ? replaceAnimationNamesInCSS(result.css, nameMap) : result.css;
|
|
276
305
|
if (mode === "inject") {
|
|
@@ -279,13 +308,14 @@ function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyfr
|
|
|
279
308
|
for (const prop of properties) cssParts.push(prop.css);
|
|
280
309
|
for (const ff of fontFaces) cssParts.push(ff.css);
|
|
281
310
|
for (const cs of counterStyles) cssParts.push(cs.css);
|
|
311
|
+
for (const fn of functions) cssParts.push(fn.css);
|
|
282
312
|
cssParts.push(selectorCSS);
|
|
283
313
|
const injectCall = createInjectCallAST(selector, cssParts.join("\n"));
|
|
284
314
|
const parent = path.parentPath;
|
|
285
315
|
if (parent && t.isExpressionStatement(parent.node)) parent.replaceWith(t.expressionStatement(injectCall));
|
|
286
316
|
else path.replaceWith(injectCall);
|
|
287
317
|
} else {
|
|
288
|
-
writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, [], nameMap, sourceFile);
|
|
318
|
+
writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, [], nameMap, sourceFile);
|
|
289
319
|
cssWriter.add(selector, selectorCSS, sourceFile);
|
|
290
320
|
const parent = path.parentPath;
|
|
291
321
|
if (parent && t.isExpressionStatement(parent.node)) parent.remove();
|
|
@@ -295,29 +325,39 @@ function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyfr
|
|
|
295
325
|
/**
|
|
296
326
|
* Collect all extracted CSS parts into a single string (for inject mode).
|
|
297
327
|
*/
|
|
298
|
-
function collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap) {
|
|
328
|
+
function collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap) {
|
|
299
329
|
const parts = [];
|
|
300
330
|
for (const kf of keyframes) parts.push(kf.css);
|
|
301
331
|
for (const prop of properties) parts.push(prop.css);
|
|
302
332
|
for (const ff of fontFaces) parts.push(ff.css);
|
|
303
333
|
for (const cs of counterStyles) parts.push(cs.css);
|
|
334
|
+
for (const fn of functions) parts.push(fn.css);
|
|
304
335
|
for (const chunk of chunks) parts.push(nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css);
|
|
305
336
|
return parts.join("\n");
|
|
306
337
|
}
|
|
307
338
|
/**
|
|
308
339
|
* Write all extracted CSS parts to a CSSWriter (for file mode).
|
|
309
340
|
*/
|
|
310
|
-
function writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, chunks, nameMap, sourceFile) {
|
|
341
|
+
function writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, sourceFile) {
|
|
311
342
|
for (const kf of keyframes) cssWriter.add(kf.css, kf.css, sourceFile);
|
|
312
343
|
for (const prop of properties) cssWriter.add(prop.css, prop.css, sourceFile);
|
|
313
344
|
for (const ff of fontFaces) cssWriter.add(ff.css, ff.css, sourceFile);
|
|
314
345
|
for (const cs of counterStyles) cssWriter.add(cs.css, cs.css, sourceFile);
|
|
346
|
+
for (const fn of functions) cssWriter.add(fn.css, fn.css, sourceFile);
|
|
315
347
|
for (const chunk of chunks) {
|
|
316
348
|
const css = nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css;
|
|
317
349
|
cssWriter.add(chunk.className, css, sourceFile);
|
|
318
350
|
}
|
|
319
351
|
}
|
|
320
352
|
/**
|
|
353
|
+
* Extract CSS for a selector from a styles/tokens object.
|
|
354
|
+
* Returns undefined when there are no styles or no CSS output.
|
|
355
|
+
*/
|
|
356
|
+
function extractCSSFromStyles(selector, styles) {
|
|
357
|
+
if (!styles || Object.keys(styles).length === 0) return void 0;
|
|
358
|
+
return extractStylesForSelector(selector, styles).css || void 0;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
321
361
|
* Create an `_$i(id, css)` call expression AST node for inject mode.
|
|
322
362
|
*/
|
|
323
363
|
function createInjectCallAST(id, css) {
|
|
@@ -433,6 +473,6 @@ function escapeRegex(str) {
|
|
|
433
473
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
434
474
|
}
|
|
435
475
|
//#endregion
|
|
436
|
-
export {
|
|
476
|
+
export { babel_default as default };
|
|
437
477
|
|
|
438
478
|
//# sourceMappingURL=babel.js.map
|