@bamboocss/generator 1.57.5 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -70,7 +70,7 @@ function generateConditions(ctx) {
70
70
  function generateCssFn(ctx) {
71
71
  return {
72
72
  dts: outdent.outdent`
73
- ${ctx.file.importType("SystemStyleObject, ViewTransitionFn", "../types/index")}
73
+ ${ctx.file.importType("KeyframesFn, SystemStyleObject, ViewTransitionFn", "../types/index")}
74
74
 
75
75
  type Styles = SystemStyleObject | undefined | null | false
76
76
 
@@ -116,6 +116,22 @@ function generateCssFn(ctx) {
116
116
  */
117
117
  export declare const viewTransition: ViewTransitionFn;
118
118
 
119
+ /**
120
+ * Write a \`@keyframes\` block from these stops and get back its name, to animate with.
121
+ *
122
+ * The name is a hash of the stops as written, so the same stops anywhere in the project are
123
+ * one block. The call is replaced by the name at build time, which is why the stops have to
124
+ * be known then.
125
+ *
126
+ * @example
127
+ * const fadeIn = keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })
128
+ *
129
+ * css({ animation: \`\${fadeIn} 0.2s ease-out\` })
130
+ *
131
+ * @see https://bamboocss.com/docs/concepts/keyframes
132
+ */
133
+ export declare const keyframes: KeyframesFn;
134
+
119
135
  `,
120
136
  js: outdent.outdent`
121
137
  ${ctx.file.import("cloneStyles, uncompiledStyle", "../helpers")}
@@ -133,6 +149,8 @@ function generateCssFn(ctx) {
133
149
 
134
150
  export const viewTransition = (_options) => uncompiledStyle('viewTransition')
135
151
 
152
+ export const keyframes = (_stops) => uncompiledStyle('keyframes')
153
+
136
154
  `
137
155
  };
138
156
  }
@@ -629,7 +647,7 @@ function generateRecipes(ctx, filters) {
629
647
  if (recipes.isEmpty()) return;
630
648
  return ctx.recipes.filterDetails(filters).map((recipe) => {
631
649
  const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
632
- const { description, defaultVariants, compoundVariants, deprecated } = config;
650
+ const { description, defaultVariants, deprecated } = config;
633
651
  const getDefaultValueJsDoc = (key) => {
634
652
  if (!hasOwn(defaultVariants, key)) return;
635
653
  let defaultValue = defaultVariants[key];
@@ -651,7 +669,6 @@ function generateRecipes(ctx, filters) {
651
669
  })
652
670
  `,
653
671
  dts: outdent.outdent`
654
- ${ctx.file.importType("ConditionalValue", "../types/index")}
655
672
  ${ctx.file.importType("DistributiveOmit, Pretty", "../types/system-types")}
656
673
 
657
674
  interface ${upperName}Variant {
@@ -665,7 +682,7 @@ function generateRecipes(ctx, filters) {
665
682
  ${_bamboocss_core.Recipes.isSlotRecipeConfig(config) ? `type ${upperName}Slot = ${(0, _bamboocss_shared.unionType)(config.slots)}` : ""}
666
683
 
667
684
  export type ${upperName}VariantProps = {
668
- [key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`} | undefined
685
+ [key in keyof ${upperName}Variant]?: ${upperName}Variant[key] | undefined
669
686
  }
670
687
 
671
688
  export interface ${upperName}Recipe {
@@ -1562,7 +1579,7 @@ var content$2 = "import type { Pseudos } from './csstype'\n\ntype AriaAttributes
1562
1579
  var content$1 = "interface ConditionOptions {\n /**\n * The conditions to generate for the rule.\n * @example ['hover', 'focus']\n */\n conditions?: string[]\n /**\n * Whether to generate responsive styles for the rule.\n */\n responsive?: boolean\n}\n\nexport interface CssRule extends ConditionOptions {\n /**\n * The css properties to generate utilities for.\n * @example ['margin', 'padding']\n */\n properties: {\n [property: string]: Array<string | number>\n }\n}\n\ninterface RecipeRuleVariants {\n [variant: string]: boolean | string[]\n}\n\nexport type RecipeRuleObject = RecipeRuleVariants & ConditionOptions\nexport type RecipeRule = '*' | RecipeRuleObject\n\nexport type PatternRule = '*' | CssRule\n\nexport interface StaticCssOptions {\n /**\n * The css utility classes to generate.\n */\n css?: CssRule[]\n /**\n * The css recipes to generate.\n */\n recipes?:\n | '*'\n | {\n [recipe: string]: RecipeRule[]\n }\n /**\n * The css patterns to generate.\n */\n patterns?: {\n [pattern: string]: PatternRule[]\n }\n /**\n * The CSS themes to generate\n */\n themes?: string[]\n}\n";
1563
1580
  //#endregion
1564
1581
  //#region src/artifacts/generated/system-types.d.ts.json
1565
- var content = "import type { ConditionalValue, Nested } from './conditions'\nimport type { AtRule, Globals, Properties } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\nexport type Pretty<T> = { [K in keyof T]: T[K] } & {}\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type DistributiveUnion<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]\n} & DistributiveOmit<U, keyof T>\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\ntype CornerShapeValue = 'round' | 'square' | 'bevel' | 'scoop' | 'notch' | 'squircle' | `superellipse(${number})`\n\nexport interface ModernCssProperties {\n /**\n * Controls whether the entire element should be draggable instead of its contents.\n */\n WebkitUserDrag?: Globals | 'auto' | 'element' | 'none' | undefined\n\n /**\n * Specifies whether an element can be used to drag the entire app window (Electron).\n */\n WebkitAppRegion?: Globals | 'drag' | 'no-drag' | undefined\n\n /**\n * Sets the horizontal spacing between table borders.\n */\n WebkitBorderHorizontalSpacing?: Globals | String | Number | undefined\n\n /**\n * Sets the vertical spacing between table borders.\n */\n WebkitBorderVerticalSpacing?: Globals | String | Number | undefined\n\n /**\n * Controls the display of text content for security purposes (e.g., password fields).\n */\n WebkitTextSecurity?: Globals | 'none' | 'circle' | 'disc' | 'square' | undefined\n\n /**\n * Specifies the shape of a box's corners within the area defined by the border-radius property.\n * @experimental\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/corner-shape\n */\n cornerShape?:\n | Globals\n | CornerShapeValue\n | `${CornerShapeValue} ${CornerShapeValue}`\n | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`\n | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`\n | String\n | undefined\n}\n\nexport type CssProperty = keyof Properties\n\nexport interface CssProperties extends Properties<String | Number>, CssVarProperties, ModernCssProperties {}\n\nexport interface CssKeyframes {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ninterface GenericProperties {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Omit<Nested<SystemProperties & CssVarProperties>, 'base'>\n\n/**\n * The four `::view-transition-*` pseudo-elements a `viewTransition()` bag can style.\n *\n * `imagePair` is camelCase here and emitted as `::view-transition-image-pair`, matching\n * how every other property in a style object is authored.\n */\nexport interface ViewTransitionStyleObject {\n group?: SystemStyleObject | undefined\n imagePair?: SystemStyleObject | undefined\n old?: SystemStyleObject | undefined\n new?: SystemStyleObject | undefined\n}\n\nexport type ViewTransitionFn = (options: ViewTransitionStyleObject) => string\n\nexport interface GlobalStyleObject {\n [selector: string]: SystemStyleObject\n}\nexport interface ExtendableGlobalStyleObject {\n [selector: string]: SystemStyleObject | undefined\n extend?: GlobalStyleObject | undefined\n}\n\n/* -----------------------------------------------------------------------------\n * Composition (text styles, layer styles)\n * -----------------------------------------------------------------------------*/\n\ntype FilterStyleObject<P extends string> = {\n [K in P]?: (K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown) | undefined\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>\n\n/* -----------------------------------------------------------------------------\n * Font face\n * -----------------------------------------------------------------------------*/\n\nexport type GlobalFontfaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>\n\nexport type FontfaceRule = Omit<GlobalFontfaceRule, 'fontFamily'>\n\nexport interface GlobalFontface {\n [name: string]: FontfaceRule | FontfaceRule[]\n}\n\nexport interface ExtendableGlobalFontface {\n [name: string]: FontfaceRule | FontfaceRule[] | GlobalFontface | undefined\n extend?: GlobalFontface | undefined\n}\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ninterface WithCss {\n css?: SystemStyleObject | SystemStyleObject[] | undefined\n}\n\nexport type JsxStyleProps = SystemStyleObject & WithCss\n\nexport interface PatchedHTMLProps {\n htmlWidth?: string | number | undefined\n htmlHeight?: string | number | undefined\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string | undefined\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n";
1582
+ var content = "import type { ConditionalValue, Nested } from './conditions'\nimport type { AtRule, Globals, Properties } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\nexport type Pretty<T> = { [K in keyof T]: T[K] } & {}\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type DistributiveUnion<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]\n} & DistributiveOmit<U, keyof T>\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\ntype CornerShapeValue = 'round' | 'square' | 'bevel' | 'scoop' | 'notch' | 'squircle' | `superellipse(${number})`\n\nexport interface ModernCssProperties {\n /**\n * Controls whether the entire element should be draggable instead of its contents.\n */\n WebkitUserDrag?: Globals | 'auto' | 'element' | 'none' | undefined\n\n /**\n * Specifies whether an element can be used to drag the entire app window (Electron).\n */\n WebkitAppRegion?: Globals | 'drag' | 'no-drag' | undefined\n\n /**\n * Sets the horizontal spacing between table borders.\n */\n WebkitBorderHorizontalSpacing?: Globals | String | Number | undefined\n\n /**\n * Sets the vertical spacing between table borders.\n */\n WebkitBorderVerticalSpacing?: Globals | String | Number | undefined\n\n /**\n * Controls the display of text content for security purposes (e.g., password fields).\n */\n WebkitTextSecurity?: Globals | 'none' | 'circle' | 'disc' | 'square' | undefined\n\n /**\n * Specifies the shape of a box's corners within the area defined by the border-radius property.\n * @experimental\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/corner-shape\n */\n cornerShape?:\n | Globals\n | CornerShapeValue\n | `${CornerShapeValue} ${CornerShapeValue}`\n | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`\n | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`\n | String\n | undefined\n}\n\nexport type CssProperty = keyof Properties\n\nexport interface CssProperties extends Properties<String | Number>, CssVarProperties, ModernCssProperties {}\n\nexport interface CssKeyframes {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ninterface GenericProperties {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Omit<Nested<SystemProperties & CssVarProperties>, 'base'>\n\n/**\n * A style object with these properties alone, in every condition and selector too: what a component\n * takes when it lets its caller style part of it. `SystemStyleObjectWith<'width' | 'margin'>` takes\n * those two; a shorthand, `mt`, is a property of its own and listed as one. It is a\n * `SystemStyleObject`, so it goes into `css()` as one.\n */\nexport type SystemStyleObjectWith<K extends keyof SystemProperties> = Omit<Nested<Pick<SystemProperties, K>>, 'base'>\n\n/** A style object with every property but these, in every condition and selector too. @see SystemStyleObjectWith */\nexport type SystemStyleObjectWithout<K extends keyof SystemProperties> = Omit<Nested<Omit<SystemProperties, K>>, 'base'>\n\n/**\n * The four `::view-transition-*` pseudo-elements a `viewTransition()` bag can style.\n *\n * `imagePair` is camelCase here and emitted as `::view-transition-image-pair`, matching\n * how every other property in a style object is authored.\n */\nexport interface ViewTransitionStyleObject {\n group?: SystemStyleObject | undefined\n imagePair?: SystemStyleObject | undefined\n old?: SystemStyleObject | undefined\n new?: SystemStyleObject | undefined\n}\n\nexport type ViewTransitionFn = (options: ViewTransitionStyleObject) => string\n\n/**\n * The stops of one `@keyframes` block: `from`, `to` or a percentage, each the declarations at that\n * point, as a theme keyframe takes them.\n */\nexport interface KeyframeStops {\n [stop: string]: CssProperties\n}\n\nexport type KeyframesFn = (stops: KeyframeStops) => string\n\nexport interface GlobalStyleObject {\n [selector: string]: SystemStyleObject\n}\nexport interface ExtendableGlobalStyleObject {\n [selector: string]: SystemStyleObject | undefined\n extend?: GlobalStyleObject | undefined\n}\n\n/* -----------------------------------------------------------------------------\n * Composition (text styles, layer styles)\n * -----------------------------------------------------------------------------*/\n\ntype FilterStyleObject<P extends string> = {\n [K in P]?: (K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown) | undefined\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>\n\n/* -----------------------------------------------------------------------------\n * Font face\n * -----------------------------------------------------------------------------*/\n\nexport type GlobalFontfaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>\n\nexport type FontfaceRule = Omit<GlobalFontfaceRule, 'fontFamily'>\n\nexport interface GlobalFontface {\n [name: string]: FontfaceRule | FontfaceRule[]\n}\n\nexport interface ExtendableGlobalFontface {\n [name: string]: FontfaceRule | FontfaceRule[] | GlobalFontface | undefined\n extend?: GlobalFontface | undefined\n}\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ninterface WithCss {\n css?: SystemStyleObject | SystemStyleObject[] | undefined\n}\n\nexport type JsxStyleProps = SystemStyleObject & WithCss\n\nexport interface PatchedHTMLProps {\n htmlWidth?: string | number | undefined\n htmlHeight?: string | number | undefined\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string | undefined\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n";
1566
1583
  //#endregion
1567
1584
  //#region src/artifacts/types/generated.ts
1568
1585
  function getGeneratedTypes(ctx) {
@@ -2192,7 +2209,13 @@ function stringifyVars(options) {
2192
2209
  }
2193
2210
  const anyTheme = conditions.isThemeCondition(keys[0]) ? conditions.getThemeSelector() : void 0;
2194
2211
  const rules = combos.map((segments) => {
2195
- const rule = getDeepestRule(root, segments.map((segment, index) => anyTheme && index > 0 ? transformThemeSegment(segment, anyTheme) : transformSegment(segment)).filter(Boolean));
2212
+ let nested = false;
2213
+ const rule = getDeepestRule(root, segments.map((segment) => {
2214
+ if (segment.startsWith("@")) return segment;
2215
+ const meets = nested;
2216
+ nested = true;
2217
+ return meets ? transformNestedSegment(segment, anyTheme) : transformSegment(segment);
2218
+ }).filter(Boolean));
2196
2219
  if (!rule) return;
2197
2220
  getDeepestNode(rule)?.append(css);
2198
2221
  return (0, _bamboocss_core.expandNestedCss)(rule.toString());
@@ -2233,26 +2256,29 @@ function transformSegment(seg) {
2233
2256
  return parent ? `&${parent}` : seg;
2234
2257
  }
2235
2258
  /**
2236
- * A condition inside a theme, as the selector nested under the theme's root.
2259
+ * A condition after another selector condition, as the selector nested under the element that one
2260
+ * declares on: a theme's root, or the element `.dark &` names.
2237
2261
  *
2238
2262
  * A theme's tokens are declared on its root, `[data-bamboo-theme=pastel]`, and inherit from there.
2239
2263
  * `.dark &` was compounded onto that root, as `transformSegment` writes it, and so held only where
2240
2264
  * the theme attribute and the dark class share an element: a theme in a page that `<html
2241
2265
  * class="dark">` puts in dark mode kept its light values, and a dark panel inside the theme took
2242
- * the default dark values instead of the theme's.
2266
+ * the default dark values instead of the theme's. `.hc &` after `.dark &` was compounded the same
2267
+ * way outside a theme, `.dark.hc`, where an ordinary `css()` call nesting the two applies under
2268
+ * `.hc .dark`: a page with `.hc` above `.dark` kept the token's dark value alone.
2243
2269
  *
2244
- * So each `P &` in it meets the root wherever the two can, as `themeBoundaries` writes it. Anything
2245
- * else is nested as it is written: `&:hover` on the root, `.dark > &` above it alone, and
2270
+ * So each `P &` in it meets that element wherever the two can, as `boundaries` writes it. Anything
2271
+ * else is nested as it is written: `&:hover` on the element, `.dark > &` above it alone, and
2246
2272
  * `.dark & .panel` around it.
2247
2273
  */
2248
- function transformThemeSegment(segment, anyTheme) {
2274
+ function transformNestedSegment(segment, anyTheme) {
2249
2275
  if (segment.startsWith("@")) return segment;
2250
2276
  const selectors = (0, _bamboocss_core.splitSelectors)(segment);
2251
2277
  const parents = selectors.map(_bamboocss_core.nestingParent);
2252
2278
  if (parents.some((parent) => parent !== void 0 && hasPseudoElement(parent))) return transformSegment(segment);
2253
2279
  const meeting = selectors.flatMap((selector, index) => {
2254
2280
  const parent = parents[index];
2255
- return parent === void 0 ? [selector] : themeBoundaries(parent, anyTheme);
2281
+ return parent === void 0 ? [selector] : boundaries(parent, anyTheme);
2256
2282
  });
2257
2283
  return [...new Set(meeting)].join(", ");
2258
2284
  }
@@ -2261,20 +2287,27 @@ const hasPseudoElement = (selector) => withoutQuotes(selector).includes("::");
2261
2287
  /** A selector without what its quoted values hold, so a `::` in one is not read as its own. */
2262
2288
  const withoutQuotes = (selector) => selector.replace(/"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'/g, "\"\"");
2263
2289
  /**
2264
- * Where `P` in `P &` meets a theme's root, `&`: above it, on it, and inside it, where the theme's
2265
- * values are declared on the element `P` names.
2290
+ * Where `P` in `P &` meets the element `&` declares on — a theme's root, or the element an earlier
2291
+ * condition names: above it and on it, and for a theme inside it too, where the theme's values are
2292
+ * declared on the element `P` names.
2293
+ *
2294
+ * Each is more specific than the values on `&` alone and than the default `P` rule, so it wins over
2295
+ * both in whichever order they are written — but for the root of another theme nested in this one.
2296
+ * There the nested theme's own `P` values have to win, and this one's only fill in what it leaves
2297
+ * out, so the rule for that root is no more specific than the root's own. It wins over the default
2298
+ * rule by coming after it, and against a value the nested theme sets for every condition, the order
2299
+ * of the two themes decides.
2266
2300
  *
2267
- * Each is more specific than the theme's values alone and than the default `P` rule, so it wins
2268
- * over both in whichever order they are written — but for the root of another theme nested in this
2269
- * one. There the nested theme's own `P` values have to win, and this one's only fill in what it
2270
- * leaves out, so the rule for that root is no more specific than the root's own. It wins over the
2271
- * default rule by coming after it, and against a value the nested theme sets for every condition,
2272
- * the order of the two themes decides.
2301
+ * Outside a theme nothing tells such a root from any other element, so a condition meets the one
2302
+ * before it from above and on it alone, where an ordinary `css()` call nesting the two applies and
2303
+ * where both are on one element. Inside it, `.dark .hc` would declare on a `.light` panel or the root
2304
+ * of a region of the project's own, `[data-color=pastel]`, over the values that one has to keep.
2273
2305
  */
2274
- function themeBoundaries(parent, anyTheme) {
2306
+ function boundaries(parent, anyTheme) {
2275
2307
  if (parent === "*") return ["* &"];
2276
2308
  const compound = (0, _bamboocss_core.isCompound)(parent);
2277
2309
  const on = compound && /^[.[:#]/.test(parent) ? parent : `:is(${parent})`;
2310
+ if (anyTheme === void 0) return [`${parent} &`, `&${on}`];
2278
2311
  const inside = compound ? parent : `:is(${parent})`;
2279
2312
  return [
2280
2313
  `${parent} &`,
@@ -2713,7 +2746,7 @@ function setupPatterns(ctx, filters) {
2713
2746
  function setupCssIndex(ctx) {
2714
2747
  const index = {
2715
2748
  js: outdent.default`
2716
- ${ctx.file.reExport("css, fallback, viewTransition", "./css")}
2749
+ ${ctx.file.reExport("css, fallback, keyframes, viewTransition", "./css")}
2717
2750
  ${ctx.file.reExport("cx", "./cx")}
2718
2751
  ${ctx.file.reExport("cva", "./cva")}
2719
2752
  ${ctx.file.reExport("sva", "./sva")}
@@ -2729,7 +2762,7 @@ function setupCssIndex(ctx) {
2729
2762
  ${ctx.file.reExport("cvaMap, splitProps", "./cx")}
2730
2763
  `,
2731
2764
  dts: outdent.default`
2732
- ${ctx.file.reExportDts("css, fallback, viewTransition", "./css")}
2765
+ ${ctx.file.reExportDts("css, fallback, keyframes, viewTransition", "./css")}
2733
2766
  ${ctx.file.reExportDts("cx", "./cx")}
2734
2767
  ${ctx.file.reExportDts("cva", "./cva")}
2735
2768
  ${ctx.file.exportType("RecipeVariant, RecipeVariantProps", "./cva")}
package/dist/index.mjs CHANGED
@@ -44,7 +44,7 @@ function generateConditions(ctx) {
44
44
  function generateCssFn(ctx) {
45
45
  return {
46
46
  dts: outdent`
47
- ${ctx.file.importType("SystemStyleObject, ViewTransitionFn", "../types/index")}
47
+ ${ctx.file.importType("KeyframesFn, SystemStyleObject, ViewTransitionFn", "../types/index")}
48
48
 
49
49
  type Styles = SystemStyleObject | undefined | null | false
50
50
 
@@ -90,6 +90,22 @@ function generateCssFn(ctx) {
90
90
  */
91
91
  export declare const viewTransition: ViewTransitionFn;
92
92
 
93
+ /**
94
+ * Write a \`@keyframes\` block from these stops and get back its name, to animate with.
95
+ *
96
+ * The name is a hash of the stops as written, so the same stops anywhere in the project are
97
+ * one block. The call is replaced by the name at build time, which is why the stops have to
98
+ * be known then.
99
+ *
100
+ * @example
101
+ * const fadeIn = keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })
102
+ *
103
+ * css({ animation: \`\${fadeIn} 0.2s ease-out\` })
104
+ *
105
+ * @see https://bamboocss.com/docs/concepts/keyframes
106
+ */
107
+ export declare const keyframes: KeyframesFn;
108
+
93
109
  `,
94
110
  js: outdent`
95
111
  ${ctx.file.import("cloneStyles, uncompiledStyle", "../helpers")}
@@ -107,6 +123,8 @@ function generateCssFn(ctx) {
107
123
 
108
124
  export const viewTransition = (_options) => uncompiledStyle('viewTransition')
109
125
 
126
+ export const keyframes = (_stops) => uncompiledStyle('keyframes')
127
+
110
128
  `
111
129
  };
112
130
  }
@@ -603,7 +621,7 @@ function generateRecipes(ctx, filters) {
603
621
  if (recipes.isEmpty()) return;
604
622
  return ctx.recipes.filterDetails(filters).map((recipe) => {
605
623
  const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
606
- const { description, defaultVariants, compoundVariants, deprecated } = config;
624
+ const { description, defaultVariants, deprecated } = config;
607
625
  const getDefaultValueJsDoc = (key) => {
608
626
  if (!hasOwn(defaultVariants, key)) return;
609
627
  let defaultValue = defaultVariants[key];
@@ -625,7 +643,6 @@ function generateRecipes(ctx, filters) {
625
643
  })
626
644
  `,
627
645
  dts: outdent`
628
- ${ctx.file.importType("ConditionalValue", "../types/index")}
629
646
  ${ctx.file.importType("DistributiveOmit, Pretty", "../types/system-types")}
630
647
 
631
648
  interface ${upperName}Variant {
@@ -639,7 +656,7 @@ function generateRecipes(ctx, filters) {
639
656
  ${Recipes.isSlotRecipeConfig(config) ? `type ${upperName}Slot = ${unionType(config.slots)}` : ""}
640
657
 
641
658
  export type ${upperName}VariantProps = {
642
- [key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`} | undefined
659
+ [key in keyof ${upperName}Variant]?: ${upperName}Variant[key] | undefined
643
660
  }
644
661
 
645
662
  export interface ${upperName}Recipe {
@@ -1536,7 +1553,7 @@ var content$2 = "import type { Pseudos } from './csstype'\n\ntype AriaAttributes
1536
1553
  var content$1 = "interface ConditionOptions {\n /**\n * The conditions to generate for the rule.\n * @example ['hover', 'focus']\n */\n conditions?: string[]\n /**\n * Whether to generate responsive styles for the rule.\n */\n responsive?: boolean\n}\n\nexport interface CssRule extends ConditionOptions {\n /**\n * The css properties to generate utilities for.\n * @example ['margin', 'padding']\n */\n properties: {\n [property: string]: Array<string | number>\n }\n}\n\ninterface RecipeRuleVariants {\n [variant: string]: boolean | string[]\n}\n\nexport type RecipeRuleObject = RecipeRuleVariants & ConditionOptions\nexport type RecipeRule = '*' | RecipeRuleObject\n\nexport type PatternRule = '*' | CssRule\n\nexport interface StaticCssOptions {\n /**\n * The css utility classes to generate.\n */\n css?: CssRule[]\n /**\n * The css recipes to generate.\n */\n recipes?:\n | '*'\n | {\n [recipe: string]: RecipeRule[]\n }\n /**\n * The css patterns to generate.\n */\n patterns?: {\n [pattern: string]: PatternRule[]\n }\n /**\n * The CSS themes to generate\n */\n themes?: string[]\n}\n";
1537
1554
  //#endregion
1538
1555
  //#region src/artifacts/generated/system-types.d.ts.json
1539
- var content = "import type { ConditionalValue, Nested } from './conditions'\nimport type { AtRule, Globals, Properties } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\nexport type Pretty<T> = { [K in keyof T]: T[K] } & {}\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type DistributiveUnion<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]\n} & DistributiveOmit<U, keyof T>\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\ntype CornerShapeValue = 'round' | 'square' | 'bevel' | 'scoop' | 'notch' | 'squircle' | `superellipse(${number})`\n\nexport interface ModernCssProperties {\n /**\n * Controls whether the entire element should be draggable instead of its contents.\n */\n WebkitUserDrag?: Globals | 'auto' | 'element' | 'none' | undefined\n\n /**\n * Specifies whether an element can be used to drag the entire app window (Electron).\n */\n WebkitAppRegion?: Globals | 'drag' | 'no-drag' | undefined\n\n /**\n * Sets the horizontal spacing between table borders.\n */\n WebkitBorderHorizontalSpacing?: Globals | String | Number | undefined\n\n /**\n * Sets the vertical spacing between table borders.\n */\n WebkitBorderVerticalSpacing?: Globals | String | Number | undefined\n\n /**\n * Controls the display of text content for security purposes (e.g., password fields).\n */\n WebkitTextSecurity?: Globals | 'none' | 'circle' | 'disc' | 'square' | undefined\n\n /**\n * Specifies the shape of a box's corners within the area defined by the border-radius property.\n * @experimental\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/corner-shape\n */\n cornerShape?:\n | Globals\n | CornerShapeValue\n | `${CornerShapeValue} ${CornerShapeValue}`\n | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`\n | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`\n | String\n | undefined\n}\n\nexport type CssProperty = keyof Properties\n\nexport interface CssProperties extends Properties<String | Number>, CssVarProperties, ModernCssProperties {}\n\nexport interface CssKeyframes {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ninterface GenericProperties {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Omit<Nested<SystemProperties & CssVarProperties>, 'base'>\n\n/**\n * The four `::view-transition-*` pseudo-elements a `viewTransition()` bag can style.\n *\n * `imagePair` is camelCase here and emitted as `::view-transition-image-pair`, matching\n * how every other property in a style object is authored.\n */\nexport interface ViewTransitionStyleObject {\n group?: SystemStyleObject | undefined\n imagePair?: SystemStyleObject | undefined\n old?: SystemStyleObject | undefined\n new?: SystemStyleObject | undefined\n}\n\nexport type ViewTransitionFn = (options: ViewTransitionStyleObject) => string\n\nexport interface GlobalStyleObject {\n [selector: string]: SystemStyleObject\n}\nexport interface ExtendableGlobalStyleObject {\n [selector: string]: SystemStyleObject | undefined\n extend?: GlobalStyleObject | undefined\n}\n\n/* -----------------------------------------------------------------------------\n * Composition (text styles, layer styles)\n * -----------------------------------------------------------------------------*/\n\ntype FilterStyleObject<P extends string> = {\n [K in P]?: (K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown) | undefined\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>\n\n/* -----------------------------------------------------------------------------\n * Font face\n * -----------------------------------------------------------------------------*/\n\nexport type GlobalFontfaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>\n\nexport type FontfaceRule = Omit<GlobalFontfaceRule, 'fontFamily'>\n\nexport interface GlobalFontface {\n [name: string]: FontfaceRule | FontfaceRule[]\n}\n\nexport interface ExtendableGlobalFontface {\n [name: string]: FontfaceRule | FontfaceRule[] | GlobalFontface | undefined\n extend?: GlobalFontface | undefined\n}\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ninterface WithCss {\n css?: SystemStyleObject | SystemStyleObject[] | undefined\n}\n\nexport type JsxStyleProps = SystemStyleObject & WithCss\n\nexport interface PatchedHTMLProps {\n htmlWidth?: string | number | undefined\n htmlHeight?: string | number | undefined\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string | undefined\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n";
1556
+ var content = "import type { ConditionalValue, Nested } from './conditions'\nimport type { AtRule, Globals, Properties } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\nexport type Pretty<T> = { [K in keyof T]: T[K] } & {}\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type DistributiveUnion<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]\n} & DistributiveOmit<U, keyof T>\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\ntype CornerShapeValue = 'round' | 'square' | 'bevel' | 'scoop' | 'notch' | 'squircle' | `superellipse(${number})`\n\nexport interface ModernCssProperties {\n /**\n * Controls whether the entire element should be draggable instead of its contents.\n */\n WebkitUserDrag?: Globals | 'auto' | 'element' | 'none' | undefined\n\n /**\n * Specifies whether an element can be used to drag the entire app window (Electron).\n */\n WebkitAppRegion?: Globals | 'drag' | 'no-drag' | undefined\n\n /**\n * Sets the horizontal spacing between table borders.\n */\n WebkitBorderHorizontalSpacing?: Globals | String | Number | undefined\n\n /**\n * Sets the vertical spacing between table borders.\n */\n WebkitBorderVerticalSpacing?: Globals | String | Number | undefined\n\n /**\n * Controls the display of text content for security purposes (e.g., password fields).\n */\n WebkitTextSecurity?: Globals | 'none' | 'circle' | 'disc' | 'square' | undefined\n\n /**\n * Specifies the shape of a box's corners within the area defined by the border-radius property.\n * @experimental\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/corner-shape\n */\n cornerShape?:\n | Globals\n | CornerShapeValue\n | `${CornerShapeValue} ${CornerShapeValue}`\n | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`\n | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`\n | String\n | undefined\n}\n\nexport type CssProperty = keyof Properties\n\nexport interface CssProperties extends Properties<String | Number>, CssVarProperties, ModernCssProperties {}\n\nexport interface CssKeyframes {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ninterface GenericProperties {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Omit<Nested<SystemProperties & CssVarProperties>, 'base'>\n\n/**\n * A style object with these properties alone, in every condition and selector too: what a component\n * takes when it lets its caller style part of it. `SystemStyleObjectWith<'width' | 'margin'>` takes\n * those two; a shorthand, `mt`, is a property of its own and listed as one. It is a\n * `SystemStyleObject`, so it goes into `css()` as one.\n */\nexport type SystemStyleObjectWith<K extends keyof SystemProperties> = Omit<Nested<Pick<SystemProperties, K>>, 'base'>\n\n/** A style object with every property but these, in every condition and selector too. @see SystemStyleObjectWith */\nexport type SystemStyleObjectWithout<K extends keyof SystemProperties> = Omit<Nested<Omit<SystemProperties, K>>, 'base'>\n\n/**\n * The four `::view-transition-*` pseudo-elements a `viewTransition()` bag can style.\n *\n * `imagePair` is camelCase here and emitted as `::view-transition-image-pair`, matching\n * how every other property in a style object is authored.\n */\nexport interface ViewTransitionStyleObject {\n group?: SystemStyleObject | undefined\n imagePair?: SystemStyleObject | undefined\n old?: SystemStyleObject | undefined\n new?: SystemStyleObject | undefined\n}\n\nexport type ViewTransitionFn = (options: ViewTransitionStyleObject) => string\n\n/**\n * The stops of one `@keyframes` block: `from`, `to` or a percentage, each the declarations at that\n * point, as a theme keyframe takes them.\n */\nexport interface KeyframeStops {\n [stop: string]: CssProperties\n}\n\nexport type KeyframesFn = (stops: KeyframeStops) => string\n\nexport interface GlobalStyleObject {\n [selector: string]: SystemStyleObject\n}\nexport interface ExtendableGlobalStyleObject {\n [selector: string]: SystemStyleObject | undefined\n extend?: GlobalStyleObject | undefined\n}\n\n/* -----------------------------------------------------------------------------\n * Composition (text styles, layer styles)\n * -----------------------------------------------------------------------------*/\n\ntype FilterStyleObject<P extends string> = {\n [K in P]?: (K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown) | undefined\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>\n\n/* -----------------------------------------------------------------------------\n * Font face\n * -----------------------------------------------------------------------------*/\n\nexport type GlobalFontfaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>\n\nexport type FontfaceRule = Omit<GlobalFontfaceRule, 'fontFamily'>\n\nexport interface GlobalFontface {\n [name: string]: FontfaceRule | FontfaceRule[]\n}\n\nexport interface ExtendableGlobalFontface {\n [name: string]: FontfaceRule | FontfaceRule[] | GlobalFontface | undefined\n extend?: GlobalFontface | undefined\n}\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ninterface WithCss {\n css?: SystemStyleObject | SystemStyleObject[] | undefined\n}\n\nexport type JsxStyleProps = SystemStyleObject & WithCss\n\nexport interface PatchedHTMLProps {\n htmlWidth?: string | number | undefined\n htmlHeight?: string | number | undefined\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string | undefined\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n";
1540
1557
  //#endregion
1541
1558
  //#region src/artifacts/types/generated.ts
1542
1559
  function getGeneratedTypes(ctx) {
@@ -2166,7 +2183,13 @@ function stringifyVars(options) {
2166
2183
  }
2167
2184
  const anyTheme = conditions.isThemeCondition(keys[0]) ? conditions.getThemeSelector() : void 0;
2168
2185
  const rules = combos.map((segments) => {
2169
- const rule = getDeepestRule(root, segments.map((segment, index) => anyTheme && index > 0 ? transformThemeSegment(segment, anyTheme) : transformSegment(segment)).filter(Boolean));
2186
+ let nested = false;
2187
+ const rule = getDeepestRule(root, segments.map((segment) => {
2188
+ if (segment.startsWith("@")) return segment;
2189
+ const meets = nested;
2190
+ nested = true;
2191
+ return meets ? transformNestedSegment(segment, anyTheme) : transformSegment(segment);
2192
+ }).filter(Boolean));
2170
2193
  if (!rule) return;
2171
2194
  getDeepestNode(rule)?.append(css);
2172
2195
  return expandNestedCss(rule.toString());
@@ -2207,26 +2230,29 @@ function transformSegment(seg) {
2207
2230
  return parent ? `&${parent}` : seg;
2208
2231
  }
2209
2232
  /**
2210
- * A condition inside a theme, as the selector nested under the theme's root.
2233
+ * A condition after another selector condition, as the selector nested under the element that one
2234
+ * declares on: a theme's root, or the element `.dark &` names.
2211
2235
  *
2212
2236
  * A theme's tokens are declared on its root, `[data-bamboo-theme=pastel]`, and inherit from there.
2213
2237
  * `.dark &` was compounded onto that root, as `transformSegment` writes it, and so held only where
2214
2238
  * the theme attribute and the dark class share an element: a theme in a page that `<html
2215
2239
  * class="dark">` puts in dark mode kept its light values, and a dark panel inside the theme took
2216
- * the default dark values instead of the theme's.
2240
+ * the default dark values instead of the theme's. `.hc &` after `.dark &` was compounded the same
2241
+ * way outside a theme, `.dark.hc`, where an ordinary `css()` call nesting the two applies under
2242
+ * `.hc .dark`: a page with `.hc` above `.dark` kept the token's dark value alone.
2217
2243
  *
2218
- * So each `P &` in it meets the root wherever the two can, as `themeBoundaries` writes it. Anything
2219
- * else is nested as it is written: `&:hover` on the root, `.dark > &` above it alone, and
2244
+ * So each `P &` in it meets that element wherever the two can, as `boundaries` writes it. Anything
2245
+ * else is nested as it is written: `&:hover` on the element, `.dark > &` above it alone, and
2220
2246
  * `.dark & .panel` around it.
2221
2247
  */
2222
- function transformThemeSegment(segment, anyTheme) {
2248
+ function transformNestedSegment(segment, anyTheme) {
2223
2249
  if (segment.startsWith("@")) return segment;
2224
2250
  const selectors = splitSelectors(segment);
2225
2251
  const parents = selectors.map(nestingParent);
2226
2252
  if (parents.some((parent) => parent !== void 0 && hasPseudoElement(parent))) return transformSegment(segment);
2227
2253
  const meeting = selectors.flatMap((selector, index) => {
2228
2254
  const parent = parents[index];
2229
- return parent === void 0 ? [selector] : themeBoundaries(parent, anyTheme);
2255
+ return parent === void 0 ? [selector] : boundaries(parent, anyTheme);
2230
2256
  });
2231
2257
  return [...new Set(meeting)].join(", ");
2232
2258
  }
@@ -2235,20 +2261,27 @@ const hasPseudoElement = (selector) => withoutQuotes(selector).includes("::");
2235
2261
  /** A selector without what its quoted values hold, so a `::` in one is not read as its own. */
2236
2262
  const withoutQuotes = (selector) => selector.replace(/"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'/g, "\"\"");
2237
2263
  /**
2238
- * Where `P` in `P &` meets a theme's root, `&`: above it, on it, and inside it, where the theme's
2239
- * values are declared on the element `P` names.
2264
+ * Where `P` in `P &` meets the element `&` declares on — a theme's root, or the element an earlier
2265
+ * condition names: above it and on it, and for a theme inside it too, where the theme's values are
2266
+ * declared on the element `P` names.
2267
+ *
2268
+ * Each is more specific than the values on `&` alone and than the default `P` rule, so it wins over
2269
+ * both in whichever order they are written — but for the root of another theme nested in this one.
2270
+ * There the nested theme's own `P` values have to win, and this one's only fill in what it leaves
2271
+ * out, so the rule for that root is no more specific than the root's own. It wins over the default
2272
+ * rule by coming after it, and against a value the nested theme sets for every condition, the order
2273
+ * of the two themes decides.
2240
2274
  *
2241
- * Each is more specific than the theme's values alone and than the default `P` rule, so it wins
2242
- * over both in whichever order they are written — but for the root of another theme nested in this
2243
- * one. There the nested theme's own `P` values have to win, and this one's only fill in what it
2244
- * leaves out, so the rule for that root is no more specific than the root's own. It wins over the
2245
- * default rule by coming after it, and against a value the nested theme sets for every condition,
2246
- * the order of the two themes decides.
2275
+ * Outside a theme nothing tells such a root from any other element, so a condition meets the one
2276
+ * before it from above and on it alone, where an ordinary `css()` call nesting the two applies and
2277
+ * where both are on one element. Inside it, `.dark .hc` would declare on a `.light` panel or the root
2278
+ * of a region of the project's own, `[data-color=pastel]`, over the values that one has to keep.
2247
2279
  */
2248
- function themeBoundaries(parent, anyTheme) {
2280
+ function boundaries(parent, anyTheme) {
2249
2281
  if (parent === "*") return ["* &"];
2250
2282
  const compound = isCompound(parent);
2251
2283
  const on = compound && /^[.[:#]/.test(parent) ? parent : `:is(${parent})`;
2284
+ if (anyTheme === void 0) return [`${parent} &`, `&${on}`];
2252
2285
  const inside = compound ? parent : `:is(${parent})`;
2253
2286
  return [
2254
2287
  `${parent} &`,
@@ -2687,7 +2720,7 @@ function setupPatterns(ctx, filters) {
2687
2720
  function setupCssIndex(ctx) {
2688
2721
  const index = {
2689
2722
  js: outdent$1`
2690
- ${ctx.file.reExport("css, fallback, viewTransition", "./css")}
2723
+ ${ctx.file.reExport("css, fallback, keyframes, viewTransition", "./css")}
2691
2724
  ${ctx.file.reExport("cx", "./cx")}
2692
2725
  ${ctx.file.reExport("cva", "./cva")}
2693
2726
  ${ctx.file.reExport("sva", "./sva")}
@@ -2703,7 +2736,7 @@ function setupCssIndex(ctx) {
2703
2736
  ${ctx.file.reExport("cvaMap, splitProps", "./cx")}
2704
2737
  `,
2705
2738
  dts: outdent$1`
2706
- ${ctx.file.reExportDts("css, fallback, viewTransition", "./css")}
2739
+ ${ctx.file.reExportDts("css, fallback, keyframes, viewTransition", "./css")}
2707
2740
  ${ctx.file.reExportDts("cx", "./cx")}
2708
2741
  ${ctx.file.reExportDts("cva", "./cva")}
2709
2742
  ${ctx.file.exportType("RecipeVariant, RecipeVariantProps", "./cva")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/generator",
3
- "version": "1.57.5",
3
+ "version": "1.58.0",
4
4
  "description": "The css generator for css bamboo",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -38,12 +38,12 @@
38
38
  "pluralize": "8.0.0",
39
39
  "postcss": "8.5.26",
40
40
  "ts-pattern": "5.9.0",
41
- "@bamboocss/core": "1.57.5",
42
- "@bamboocss/is-valid-prop": "^1.57.5",
43
- "@bamboocss/logger": "1.57.5",
44
- "@bamboocss/shared": "1.57.5",
45
- "@bamboocss/token-dictionary": "1.57.5",
46
- "@bamboocss/types": "1.57.5"
41
+ "@bamboocss/core": "1.58.0",
42
+ "@bamboocss/is-valid-prop": "^1.58.0",
43
+ "@bamboocss/logger": "1.58.0",
44
+ "@bamboocss/shared": "1.58.0",
45
+ "@bamboocss/token-dictionary": "1.58.0",
46
+ "@bamboocss/types": "1.58.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/pluralize": "0.0.33"