teacss 0.3.0 → 0.3.1

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 CHANGED
@@ -8,8 +8,7 @@ Readable utilities for humans. Predictable syntax for AI agents.
8
8
 
9
9
  `teacss` is the application-facing package. Its root entry provides the
10
10
  official `cn` and `recipe` runtime helpers plus Standard preset constant
11
- tables, while its subpaths expose the engine, official presets, and supported
12
- build integrations.
11
+ tables, while its subpaths expose the engine and official presets.
13
12
 
14
13
  Use it for normal TeaCSS applications. Preset authors, custom integration
15
14
  authors, and tooling authors should import the narrower `@teacss/*` packages
@@ -17,18 +16,16 @@ that own those extension APIs; the root entry intentionally does not expose
17
16
  low-level factories such as `createDefiner`.
18
17
 
19
18
  The base installation contains the runtime class helpers, engine core, and
20
- official presets. Build integrations are opt-in peers so installing `teacss`
21
- does not also install unused Astro, Vite, Rsbuild, or PostCSS tooling. Install
22
- the matching `@teacss/*` integration package beside `teacss`; the stable
23
- `teacss/*` subpath then re-exports that package:
19
+ official presets. Build integrations are separate packages, so install and
20
+ import the one owned by the selected build boundary directly:
24
21
 
25
22
  | Build boundary | Additional installation | Import |
26
23
  | --- | --- | --- |
27
- | Vite | `bun add -d @teacss/vite vite` | `teacss/vite` |
28
- | Astro | `bun add -d @teacss/astro astro vite` | `teacss/astro` |
29
- | Rsbuild | `bun add -d @teacss/rsbuild @rsbuild/core` | `teacss/rsbuild` |
30
- | PostCSS | `bun add -d @teacss/postcss postcss` | `teacss/postcss` |
31
- | Bun Build | `bun add -d @teacss/bun` | `teacss/bun` |
24
+ | Vite | `bun add -d @teacss/vite vite` | `@teacss/vite` |
25
+ | Astro | `bun add -d @teacss/astro astro vite` | `@teacss/astro` |
26
+ | Rsbuild | `bun add -d @teacss/rsbuild @rsbuild/core` | `@teacss/rsbuild` |
27
+ | PostCSS | `bun add -d @teacss/postcss postcss` | `@teacss/postcss` |
28
+ | Bun Build | `bun add -d @teacss/bun` | `@teacss/bun` |
32
29
 
33
30
  The standalone CLI is intentionally separate because `teacss` has no CLI
34
31
  subpath or executable:
@@ -69,7 +66,7 @@ bun add -d @teacss/vite vite
69
66
  Use the Vite integration:
70
67
 
71
68
  ```ts
72
- import { pluginTeacss } from "teacss/vite";
69
+ import { pluginTeacss } from "@teacss/vite";
73
70
 
74
71
  export default {
75
72
  plugins: [pluginTeacss()],
@@ -151,7 +148,7 @@ The application entry exports `recipe`, bound once to its exact official
151
148
  import { recipe, type ClassProp, type VariantProps } from "teacss";
152
149
 
153
150
  const badge = recipe({
154
- styles: "d:inline-flex align-items:center radius:full p-x:2",
151
+ className: "d:inline-flex align-items:center rd:full p-x:2",
155
152
  variants: {
156
153
  tone: {
157
154
  neutral: "bg-color:gray-100 text-color:gray-900",
@@ -178,15 +175,15 @@ function badgeClassName({ className, ...variants }: BadgeProps) {
178
175
  }
179
176
  ```
180
177
 
181
- A primitive string `styles` value selects the single-element form. Its variant
182
- choices and compound outputs are strings; the recipe call accepts variants plus
183
- `className` and returns the merged string directly.
178
+ A primitive string top-level `className` value selects the single-element form.
179
+ Its variant choices and compound outputs are strings; the recipe call accepts
180
+ variants plus caller `className` and returns the merged string directly.
184
181
 
185
- Use a non-empty object `styles` value for multiple elements:
182
+ Use a non-empty object top-level `className` value for multiple elements:
186
183
 
187
184
  ```ts
188
185
  const button = recipe({
189
- styles: {
186
+ className: {
190
187
  container: "d:inline-flex align-items:center p:2 p:4@md",
191
188
  icon: "inline-size:4x",
192
189
  },
@@ -222,21 +219,21 @@ const button = recipe({
222
219
  },
223
220
  {
224
221
  disabled: true,
225
- parts: ["container", "icon"],
222
+ classKeys: ["container", "icon"],
226
223
  className: "opacity:80",
227
224
  },
228
225
  ],
229
226
  });
230
227
 
231
- const styles = button({
228
+ const classes = button({
232
229
  size: "large",
233
230
  });
234
231
 
235
- styles.container({
232
+ classes.container({
236
233
  disabled: true,
237
234
  className: "p:6",
238
235
  });
239
- styles.icon();
236
+ classes.icon();
240
237
 
241
238
  type ButtonProps = VariantProps<typeof button> & ClassProp;
242
239
 
@@ -245,14 +242,15 @@ function buttonClassName({ className, ...variants }: ButtonProps) {
245
242
  }
246
243
  ```
247
244
 
248
- There is no distinguished or required `root` key in object `styles`; every
249
- declared key is an ordinary style name. Variant choices are always target maps.
250
- A compound either supplies a non-empty `className` target map, or pairs a
251
- primitive-string `className` with a non-empty `parts` array to broadcast that
252
- class to several effective named styles. `parts` may name declared or inherited
253
- styles and must be dense, unique, and free of unknown names. The two compound
254
- forms are mutually exclusive, and matching entries contribute in declaration
255
- order. A recipe call returns a readonly resolver for every name.
245
+ There is no distinguished or required `root` key in an object-form top-level
246
+ `className`; every declared key is an ordinary named class. Variant choices are
247
+ always target maps. A compound either supplies a non-empty `className` target
248
+ map, or pairs a primitive-string `className` with a non-empty `classKeys` array
249
+ to broadcast that class to several effective named classes. `classKeys` may
250
+ name declared or inherited classes and must be dense, unique, and free of
251
+ unknown names. The two compound forms are mutually exclusive, and matching
252
+ entries contribute in declaration order. A recipe call returns a readonly
253
+ resolver for every name.
256
254
  Recipe-level selections are captured once. A resolver selection is local to
257
255
  that invocation, compounds are re-evaluated for it, and `className` appends only
258
256
  to that resolver. The one-sided `"true"` choice makes `disabled`
@@ -261,10 +259,10 @@ fragment but can still drive defaults and compounds. Responsive behavior
261
259
  remains suffix-only inside static values, such as `p:4@md`; recipe props do not
262
260
  accept breakpoint objects.
263
261
 
264
- Every definition without `extend` requires its own `styles` field. An extending
265
- child may omit `styles` to inherit the parent's string or object mode, base
266
- fragments, and existing named styles. If a child declares `styles`, it must keep
267
- that mode; an object child may add new names:
262
+ Every definition without `extend` requires its own `className` field. An
263
+ extending child may omit `className` to inherit the parent's string or object
264
+ mode, base fragments, and existing named classes. If a child declares
265
+ `className`, it must keep that mode; an object child may add new names:
268
266
 
269
267
  ```ts
270
268
  const primaryButton = recipe({
@@ -280,13 +278,20 @@ const primaryButton = recipe({
280
278
 
281
279
  const strongBadge = recipe({
282
280
  extend: badge,
283
- styles: "font-weight:700",
281
+ className: "font-weight:700",
284
282
  });
285
283
  ```
286
284
 
287
- `parts` is reserved as a variant name. Nested `compoundVariants[].parts` is
288
- supported; the superseded top-level definition field `parts` is not accepted
289
- as a compatibility alias.
285
+ `classKeys` is reserved as a variant name, while `parts`, `styles`, and
286
+ `styleKeys` are available as ordinary variant names. Nested
287
+ `compoundVariants[].classKeys` is supported; the retired top-level definition
288
+ field `styles` and former nested `parts` selector are not compatibility aliases.
289
+
290
+ The repeated `className` spelling is separated by boundary:
291
+ `definition.className` supplies base classes and selects string or object mode,
292
+ `compoundVariants[].className` supplies a compound output, and caller
293
+ `className` is accepted by a single-element recipe call or one named resolver.
294
+ A multi-element recipe call itself accepts shared selections only.
290
295
 
291
296
  `@teacss/classes` exports the factory rather than a pre-bound definer. This
292
297
  integration creates its own `recipe` from the official `cn`; custom
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "teacss",
3
- "version": "0.3.0",
4
- "description": "The TeaCSS application entry with the official `cn`, `recipe`, engine, presets, and opt-in build integration subpaths.",
3
+ "version": "0.3.1",
4
+ "description": "The TeaCSS application entry with the official `cn`, `recipe`, engine, and preset subpaths.",
5
5
  "homepage": "https://css.teasim.com",
6
6
  "funding": "https://github.com/sponsors/billgo",
7
7
  "license": "MIT",
@@ -10,15 +10,10 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": "./dist/index.js",
13
- "./astro": "./dist/astro.js",
14
- "./bun": "./dist/bun.js",
15
13
  "./core": "./dist/core.js",
16
- "./postcss": "./dist/postcss.js",
17
14
  "./preset-articles": "./dist/preset-articles.js",
18
15
  "./preset-icons": "./dist/preset-icons.js",
19
16
  "./preset-standard": "./dist/preset-standard.js",
20
- "./rsbuild": "./dist/rsbuild.js",
21
- "./vite": "./dist/vite.js",
22
17
  "./package.json": "./package.json"
23
18
  },
24
19
  "types": "./dist/index.d.ts",
@@ -31,35 +26,11 @@
31
26
  "dev": "tsdown --watch"
32
27
  },
33
28
  "dependencies": {
34
- "@teacss/classes": "0.3.0",
35
- "@teacss/core": "0.3.0",
36
- "@teacss/preset-articles": "0.3.0",
37
- "@teacss/preset-icons": "0.3.0",
38
- "@teacss/preset-standard": "0.3.0"
39
- },
40
- "peerDependencies": {
41
- "@teacss/astro": "0.3.0",
42
- "@teacss/bun": "0.3.0",
43
- "@teacss/postcss": "0.3.0",
44
- "@teacss/rsbuild": "0.3.0",
45
- "@teacss/vite": "0.3.0"
46
- },
47
- "peerDependenciesMeta": {
48
- "@teacss/astro": {
49
- "optional": true
50
- },
51
- "@teacss/bun": {
52
- "optional": true
53
- },
54
- "@teacss/postcss": {
55
- "optional": true
56
- },
57
- "@teacss/rsbuild": {
58
- "optional": true
59
- },
60
- "@teacss/vite": {
61
- "optional": true
62
- }
29
+ "@teacss/classes": "0.3.1",
30
+ "@teacss/core": "0.3.1",
31
+ "@teacss/preset-articles": "0.3.1",
32
+ "@teacss/preset-icons": "0.3.1",
33
+ "@teacss/preset-standard": "0.3.1"
63
34
  },
64
35
  "engines": {
65
36
  "node": ">=22.12.0"
package/dist/astro.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "@teacss/astro";
package/dist/astro.js DELETED
@@ -1 +0,0 @@
1
- export*from"@teacss/astro";export{};
package/dist/bun.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "@teacss/bun";
package/dist/bun.js DELETED
@@ -1 +0,0 @@
1
- export*from"@teacss/bun";export{};
package/dist/postcss.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "@teacss/postcss";
package/dist/postcss.js DELETED
@@ -1 +0,0 @@
1
- export*from"@teacss/postcss";export{};
package/dist/rsbuild.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "@teacss/rsbuild";
package/dist/rsbuild.js DELETED
@@ -1 +0,0 @@
1
- export*from"@teacss/rsbuild";export{};
package/dist/vite.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "@teacss/vite";
package/dist/vite.js DELETED
@@ -1 +0,0 @@
1
- export*from"@teacss/vite";export{};