teacss 0.5.2 → 0.6.2

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,24 @@ 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}" --preset standard -o tea.css
29
+ ```
30
+
31
+ `--preset standard` enables utilities when the project has no CSS entry. Add
32
+ `--watch` to rebuild as source files change, and include `tea.css` in the page.
33
+
34
+ The independent `@teacss/cli` package remains available for direct installs.
35
+ Both `teacss/cli` and `@teacss/cli` expose the programmatic `build` API:
36
+
37
+ ```ts
38
+ import { build } from "teacss/cli";
39
+ ```
22
40
 
23
41
  Example with Vite:
24
42
 
@@ -30,7 +48,7 @@ export default defineConfig({ plugins: [pluginTeacss()] });
30
48
  ```
31
49
 
32
50
  ```css
33
- @preset "standard";
51
+ @presets "standard";
34
52
  @source "./src/**/*.{ts,tsx,html}";
35
53
  @teacss;
36
54
  ```
@@ -44,31 +62,36 @@ import "virtual:teacss.css";
44
62
  Enable optional vocabularies explicitly:
45
63
 
46
64
  ```css
47
- @preset "standard";
48
- @preset "official";
49
- @preset "icons";
65
+ @presets "standard,official";
66
+ @presets "icons";
50
67
  ```
51
68
 
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:
69
+ Official includes `prose`, `prose-hans` and `prose-hant` for long-form content
70
+ and does not enable Standard. Preset factories are available from subpaths:
55
71
 
56
72
  | Import | Export |
57
73
  | ------------------------- | ------------------- |
58
- | `teacss/preset-standard` | `presetStandard` |
59
- | `teacss/preset-official` | `presetOfficial` |
74
+ | `teacss/preset-standard` | `presetStandard` |
75
+ | `teacss/preset-official` | `presetOfficial` |
60
76
  | `teacss/preset-icons` | `presetIcons` |
61
77
  | `teacss/core` | Core engine exports |
62
78
 
63
79
  ## Runtime classes
64
80
 
81
+ Install `@teacss/classes` as an application dependency to compose class
82
+ strings at runtime:
83
+
84
+ ```sh
85
+ npm install @teacss/classes
86
+ ```
87
+
65
88
  ```ts
66
- import { cn, recipe, type ClassProp, type VariantProps } from "teacss";
89
+ import { cn, recipe, type ClassProp, type VariantProps } from "@teacss/classes";
67
90
 
68
91
  cn("p:4 d:flex", "p:8"); // "d:flex p:8"
69
92
 
70
93
  const badge = recipe({
71
- className: "d:inline-flex p:2",
94
+ defaults: "d:inline-flex p:2",
72
95
  variants: {
73
96
  tone: { accent: "bg-color:blue-500 text-color:white" },
74
97
  },
@@ -77,10 +100,18 @@ const badge = recipe({
77
100
  type BadgeProps = VariantProps<typeof badge> & ClassProp;
78
101
  ```
79
102
 
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`.
103
+ `cn` understands Standard conflicts and merges all `icon:value` declarations
104
+ by prefix without validating values. `recipe` uses string or named-element
105
+ `defaults` for base styles, `variants` for conditional styles, and
106
+ `defaultVariants` for initial selections. It supports compounds and extension
107
+ within the same loaded classes module.
108
+ These functions and their `ClassDict`, `ClassValue`, `Merger`, `ClassProp`,
109
+ `RecipeIntrospection`, `Reciper`, and `VariantProps` types are exported only by
110
+ `@teacss/classes`. The `teacss` root no longer re-exports them.
111
+
112
+ Custom merger hooks, injected recipe mergers, and preset-only merge entries are
113
+ not supported. See the [migration guide](../../docs/guides/upgrading-to-0-6.md#2-classes-与-recipe)
114
+ when upgrading an integration that used them.
84
115
 
85
116
  Standard constant tables are re-exported from the root; there is no
86
117
  `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.2",
4
- "description": "The TeaCSS application entry with the official `cn`, `recipe`, engine, and preset subpaths.",
3
+ "version": "0.6.2",
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.2",
30
- "@teacss/core": "0.5.2",
31
- "@teacss/preset-icons": "0.5.2",
32
- "@teacss/preset-official": "0.5.2",
33
- "@teacss/preset-standard": "0.5.2"
34
+ "@teacss/cli": "0.6.2",
35
+ "@teacss/core": "0.6.2",
36
+ "@teacss/preset-icons": "0.6.2",
37
+ "@teacss/preset-official": "0.6.2",
38
+ "@teacss/preset-standard": "0.6.2"
34
39
  },
35
40
  "engines": {
36
41
  "node": ">=22.12.0"