teacss 0.5.1 → 0.6.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/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # TeaCSS
2
2
 
3
- The application package for TeaCSS.
3
+ The development tool package for TeaCSS.
4
4
 
5
- The root entry exports the official `cn`, `recipe`, `omitAttributes`,
6
- runtime types, and Standard constant tables. Engine and preset factories are
7
- available through explicit subpaths.
5
+ It provides the `teacss` command, the `teacss/cli` programmatic API, and
6
+ Standard constant tables at the root. Core and preset factories remain
7
+ available through explicit subpaths. Runtime class helpers live in
8
+ `@teacss/classes`.
8
9
 
9
10
  ## Install
10
11
 
11
- Install `teacss` as an application dependency and add the adapter for the
12
+ Install `teacss` as a development dependency with the adapter and host for the
12
13
  project's build tool:
13
14
 
14
15
  | Build tool | Development packages |
@@ -18,7 +19,21 @@ project's build tool:
18
19
  | Rsbuild | `@teacss/rsbuild @rsbuild/core` |
19
20
  | PostCSS | `@teacss/postcss postcss` |
20
21
  | Bun Build | `@teacss/bun` |
21
- | Standalone CLI | `@teacss/cli` |
22
+ | Standalone CLI | Included with `teacss` |
23
+
24
+ For example, `npm install --save-dev teacss @teacss/vite vite` sets up Vite.
25
+ For standalone output, install only `teacss` and run its CLI:
26
+
27
+ ```sh
28
+ npx teacss "src/**/*.{ts,tsx,html}" -o tea.css --watch
29
+ ```
30
+
31
+ The independent `@teacss/cli` package remains available for direct installs.
32
+ Both `teacss/cli` and `@teacss/cli` expose the programmatic `build` API:
33
+
34
+ ```ts
35
+ import { build } from "teacss/cli";
36
+ ```
22
37
 
23
38
  Example with Vite:
24
39
 
@@ -30,7 +45,7 @@ export default defineConfig({ plugins: [pluginTeacss()] });
30
45
  ```
31
46
 
32
47
  ```css
33
- @preset "standard";
48
+ @presets "standard";
34
49
  @source "./src/**/*.{ts,tsx,html}";
35
50
  @teacss;
36
51
  ```
@@ -44,31 +59,36 @@ import "virtual:teacss.css";
44
59
  Enable optional vocabularies explicitly:
45
60
 
46
61
  ```css
47
- @preset "standard";
48
- @preset "official";
49
- @preset "icons";
62
+ @presets "standard,official";
63
+ @presets "icons";
50
64
  ```
51
65
 
52
- Official includes `prose`, `prose-hans` and `prose-hant` for long-form content;
53
- the separate Articles preset is retired. Official does not enable Standard. All preset factories are available from
54
- subpaths:
66
+ Official includes `prose`, `prose-hans` and `prose-hant` for long-form content
67
+ and does not enable Standard. Preset factories are available from subpaths:
55
68
 
56
69
  | Import | Export |
57
70
  | ------------------------- | ------------------- |
58
- | `teacss/preset-standard` | `presetStandard` |
59
- | `teacss/preset-official` | `presetOfficial` |
71
+ | `teacss/preset-standard` | `presetStandard` |
72
+ | `teacss/preset-official` | `presetOfficial` |
60
73
  | `teacss/preset-icons` | `presetIcons` |
61
74
  | `teacss/core` | Core engine exports |
62
75
 
63
76
  ## Runtime classes
64
77
 
78
+ Install `@teacss/classes` as an application dependency to compose class
79
+ strings at runtime:
80
+
81
+ ```sh
82
+ npm install @teacss/classes
83
+ ```
84
+
65
85
  ```ts
66
- import { cn, recipe, type ClassProp, type VariantProps } from "teacss";
86
+ import { cn, recipe, type ClassProp, type VariantProps } from "@teacss/classes";
67
87
 
68
88
  cn("p:4 d:flex", "p:8"); // "d:flex p:8"
69
89
 
70
90
  const badge = recipe({
71
- className: "d:inline-flex p:2",
91
+ defaults: "d:inline-flex p:2",
72
92
  variants: {
73
93
  tone: { accent: "bg-color:blue-500 text-color:white" },
74
94
  },
@@ -77,10 +97,18 @@ const badge = recipe({
77
97
  type BadgeProps = VariantProps<typeof badge> & ClassProp;
78
98
  ```
79
99
 
80
- `cn` understands Standard and canonical icon conflicts but does not validate
81
- values. `recipe` supports string or named-element `className` definitions,
82
- variants, compounds, and exact-reciper extension. Import low-level factories
83
- such as `createMerger` and `createReciper` from `@teacss/classes`.
100
+ `cn` understands Standard conflicts and merges all `icon:value` declarations
101
+ by prefix without validating values. `recipe` uses string or named-element
102
+ `defaults` for base styles, `variants` for conditional styles, and
103
+ `defaultVariants` for initial selections. It supports compounds and extension
104
+ within the same loaded classes module.
105
+ These functions and their `ClassDict`, `ClassValue`, `Merger`, `ClassProp`,
106
+ `RecipeIntrospection`, `Reciper`, and `VariantProps` types are exported only by
107
+ `@teacss/classes`. The `teacss` root no longer re-exports them.
108
+
109
+ Custom merger hooks, injected recipe mergers, and preset-only merge entries are
110
+ not supported. See the [migration guide](../../docs/guides/upgrading-to-0-6.md#2-classes-与-recipe)
111
+ when upgrading an integration that used them.
84
112
 
85
113
  Standard constant tables are re-exported from the root; there is no
86
114
  `teacss/constants` subpath.
package/bin/teacss.mjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import "@teacss/cli/cli";
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { CliOptions, CliWatchSession, build, checkProject, initializeConfig } from "@teacss/cli";
2
+ export { type CliOptions, type CliWatchSession, build, checkProject, initializeConfig };
package/dist/cli.js ADDED
@@ -0,0 +1 @@
1
+ import{build as e,checkProject as t,initializeConfig as n}from"@teacss/cli";export{e as build,t as checkProject,n as initializeConfig};
package/dist/index.d.ts CHANGED
@@ -1,7 +1 @@
1
- import { ClassProp, Merger, RecipeIntrospection, Reciper, VariantProps, omitAttributes } from "@teacss/classes";
2
- export * from "@teacss/preset-standard/constants";
3
- //#region src/index.d.ts
4
- export declare const cn: Merger;
5
- export declare const recipe: Reciper;
6
- //#endregion
7
- export { type ClassProp, type RecipeIntrospection, type VariantProps, omitAttributes };
1
+ export * from "@teacss/preset-standard/constants";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{createMerger as e,createReciper as t,omitAttributes as n}from"@teacss/classes";import{pluginIcon as r}from"@teacss/preset-icons/merge";import{pluginStandard as i}from"@teacss/preset-standard/merge";export*from"@teacss/preset-standard/constants";const a=e({plugins:[i,r]});let o;const s=(e=>(o??=t({merge:a}),o(e)));export{a as cn,n as omitAttributes,s as recipe};
1
+ export*from"@teacss/preset-standard/constants";export{};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "teacss",
3
- "version": "0.5.1",
4
- "description": "The TeaCSS application entry with the official `cn`, `recipe`, engine, and preset subpaths.",
3
+ "version": "0.6.0",
4
+ "description": "TeaCSS developer tooling with a CLI and engine and preset subpaths.",
5
5
  "homepage": "https://css.teasim.com",
6
6
  "funding": "https://github.com/sponsors/billgo",
7
7
  "license": "MIT",
@@ -10,6 +10,7 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": "./dist/index.js",
13
+ "./cli": "./dist/cli.js",
13
14
  "./core": "./dist/core.js",
14
15
  "./preset-icons": "./dist/preset-icons.js",
15
16
  "./preset-official": "./dist/preset-official.js",
@@ -17,7 +18,11 @@
17
18
  "./package.json": "./package.json"
18
19
  },
19
20
  "types": "./dist/index.d.ts",
21
+ "bin": {
22
+ "teacss": "./bin/teacss.mjs"
23
+ },
20
24
  "files": [
25
+ "bin",
21
26
  "dist",
22
27
  "README.md"
23
28
  ],
@@ -26,11 +31,11 @@
26
31
  "dev": "tsdown --watch"
27
32
  },
28
33
  "dependencies": {
29
- "@teacss/classes": "0.5.1",
30
- "@teacss/core": "0.5.1",
31
- "@teacss/preset-icons": "0.5.1",
32
- "@teacss/preset-official": "0.5.1",
33
- "@teacss/preset-standard": "0.5.1"
34
+ "@teacss/cli": "0.6.0",
35
+ "@teacss/core": "0.6.0",
36
+ "@teacss/preset-icons": "0.6.0",
37
+ "@teacss/preset-official": "0.6.0",
38
+ "@teacss/preset-standard": "0.6.0"
34
39
  },
35
40
  "engines": {
36
41
  "node": ">=22.12.0"