zazz-ui 0.3.2 → 0.3.4
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/CHANGELOG.md +18 -0
- package/README.md +29 -2
- package/dist/add-P8X_avx2.js +3 -0
- package/dist/{add-Cvilkl7S.js → add-TSAcIuda.js} +9 -5
- package/dist/cli.js +10 -7
- package/dist/codemod-D_Qdyjbn.js +553 -0
- package/dist/{diff-BRTyzqhQ.js → diff-SlSZRLDi.js} +8 -7
- package/dist/{errors-DC2U2USS.js → errors--aALbpFB.js} +1 -2
- package/dist/{init-m26gsqEa.js → init-DarNiijO.js} +3 -4
- package/dist/init-DuvWuYCt.js +3 -0
- package/dist/update-C32jRa_O.js +3 -0
- package/dist/{update-CaIG25mx.js → update-CzvFHR7k.js} +151 -44
- package/dist/{wiring-CWDMdCmo.js → wiring-K8-qOImj.js} +37 -27
- package/package.json +3 -4
- package/dist/init-DqkIVXKV.js +0 -3
- package/dist/update-BPtPsPr7.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Notable changes to the `zazz-ui` CLI. The CLI versions independently of `@zazz-ui/core` (ADR-0010); the kit's own changelog is the one `update` and `diff` print.
|
|
4
4
|
|
|
5
|
+
## 0.3.4 (2026-11-27)
|
|
6
|
+
|
|
7
|
+
- New codemod: `codemod small-sizes [paths...]`, for the small control sizes the kit removed (`data-button-size` and `data-toggle-size` `"sm"` and `"icon-sm"`). It asks whether to remove them or keep them, and removing is the default (also under `-y` and without a terminal). Remove rewrites the markup: `"sm"` is dropped and `"icon-sm"` becomes `"icon"`. It lists selectors, sizes set from script, and template values, leaves them as written, and exits with code 2. Keep (`--restore`) leaves the markup and adds the removed rules back: to the vendored `button.css` and `toggle.css` in a vendored project (even when an older kit still ships them, so the next `update` keeps them), or to `zazz-small-sizes.css` without a `zazz.json` or for a primitive that isn't vendored. It takes no `@version`; one passed is ignored with a warning. Fields are not touched. `--dry-run` writes nothing.
|
|
8
|
+
- New command: `codemod data-font [@version] [paths...]`. It moves a project to typography roles in `data-font`: `data-ui="text-sm"` becomes `data-font="sm"`, `data-ui="text-link"` becomes `data-ui="link"`, and a quoted `[data-ui~="text-sm"]` selector becomes `[data-font="sm"]`. In a vendored project it first runs `update` when the recorded kit predates `data-font`, then `add` for the primitives the markup uses (`font`, `link`, `prose`). It never rewrites a vendored kit directory. It leaves what it cannot move safely (two roles on one element, template syntax in the value, a role set from script, an unquoted selector, a file that is not UTF-8), lists those places, and exits with code 2. `--dry-run` writes nothing.
|
|
9
|
+
- `add` and `update` vendor each primitive's data file (`primitives/<name>/<name>.json`: its hooks, attributes, slots, and states). Kits that predate the files vendor as before.
|
|
10
|
+
- A narrowed update (`update tabs`) vendors a shared script that the target version introduced. Before, it read the script from the version the base was recorded at, found nothing, and wrote no file, but still added the import to the entry script, so the page's scripts failed to load. A whole-kit `update` was not affected.
|
|
11
|
+
- `update` no longer deletes a script that a skipped primitive or your entry script still imports. Deleting one left the entry script (`index.js`) with a dead import, and then no script on the page loaded. Two cases:
|
|
12
|
+
- A primitive is skipped (a conflict in CI, or "Skip" at the prompt) and the kit moved or removed a shared script it imports. The script stays on disk. The first whole-kit `update` after the primitive moves deletes it.
|
|
13
|
+
- The entry script you end up with still imports a file the update would delete: you kept your version through a conflict, took conflict markers, or the base unit was skipped and the old entry stayed. This covers shared scripts, a script a primitive dropped, and the scripts of a primitive the kit removed. The file stays, and the output names it (`--dry-run` leaves it out of the plan without a note). Remove the import and run a whole-kit `zazz-ui update` to delete it. A commented-out import does not hold a file. If a later kit version ships the file again, its primitive takes it back.
|
|
14
|
+
- When the base unit is skipped, `update` still vendors the new shared scripts the updated primitives import, and lists them in its output. They were left out with the rest of the base unit, so the updated primitives imported files that did not exist.
|
|
15
|
+
- `zazz.json` has a new optional map, `base.sources`. It names the kit version a base file's recorded copy came from when that is not the base's own version. That happens when `update` or `add` vendors a shared script ahead of the base, when a skipped primitive keeps a script the kit moved, and when your entry still imports a removed file. `update` merges your edits to such a file against that version, and `diff --upstream` reads it from there. Without the record, an edited script could come back as a whole-file conflict. While the map has entries, a whole-kit `update` checks those files again instead of reporting `Already at`. `zazz-ui` 0.3.3 and earlier drop the map when they rewrite `zazz.json`.
|
|
16
|
+
- Re-running `update` after it skipped the base unit brings the entries up to date. Before, a narrowed re-run (`update tabs`) printed `Already at` and left `index.css` and the entry script without the updated primitive's imports, and a whole-kit re-run kept an edited entry script as it was, also without them. A skipped base unit now records the primitive versions its entries were generated for, in a new optional `base.entries` map in `zazz.json`. The next `update` sees the map, merges your entry edits against the entries for those versions, and removes the map once the base unit applies. `zazz-ui` 0.3.3 and earlier drop the map when they rewrite `zazz.json`.
|
|
17
|
+
|
|
18
|
+
## 0.3.3 (2026-11-16)
|
|
19
|
+
|
|
20
|
+
- An exact version (`update @0.14.1`, `diff @0.14.1`, `init 0.14.1`) resolves right after it is published. The CLI reads an exact version from npm's cache, and when the cached version list predated the release, it reported "No matching version found" until something like `@latest` refreshed the list. A cache miss now asks the registry once. `--offline` still never goes online.
|
|
21
|
+
- The README lists `@zazz-ui/core` 0.1 through 0.14 as supported.
|
|
22
|
+
|
|
5
23
|
## 0.3.2 (2026-10-26)
|
|
6
24
|
|
|
7
25
|
- `init --ts` vendors the kit's `globals.d.ts`, the ambient types the TypeScript sources check against (`window.Utils`, `Signals`, `Toaster`, `CommandEvent`). A full `update` adds it to an existing `--ts` project and keeps it current. If you copied the file in by hand, delete your copy after updating, or TypeScript reports a duplicate `EmblaCarouselType`.
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Flags: `--dir <path>`, `--ts` (vendor TypeScript sources instead of compiled js,
|
|
|
17
17
|
|
|
18
18
|
## What add does
|
|
19
19
|
|
|
20
|
-
`add <primitive...>` resolves the primitives you ask for plus everything they depend on (adding `combobox` brings `select`, `fields`, `popover`, `button`, `kbd`, and `badge`), copies the files at your project's recorded kit version, and inserts the entry imports at the right cascade position. Your edits to vendored files are never touched. `--examples` also copies the primitive's example markup.
|
|
20
|
+
`add <primitive...>` resolves the primitives you ask for plus everything they depend on (adding `combobox` brings `select`, `fields`, `popover`, `button`, `kbd`, and `badge`), copies the files at your project's recorded kit version (with each primitive's data file, `primitives/<name>/<name>.json`, from kits that ship one), and inserts the entry imports at the right cascade position. Your edits to vendored files are never touched. `--examples` also copies the primitive's example markup.
|
|
21
21
|
|
|
22
22
|
## What update does
|
|
23
23
|
|
|
@@ -27,13 +27,40 @@ Naming primitives narrows the update (`update @0.5.0 button`): only those move,
|
|
|
27
27
|
|
|
28
28
|
`diff [@version] [name...]` shows all of it read-only: your files against the target version's exact bytes, plus the changelog slice. `--upstream` compares pristine-to-pristine instead, ignoring your edits.
|
|
29
29
|
|
|
30
|
+
## What codemod does
|
|
31
|
+
|
|
32
|
+
`codemod data-font [@version] [paths...]` moves a project to typography roles in `data-font`. It rewrites `data-ui="text-sm"` to `data-font="sm"` and `data-ui="text-link"` to `data-ui="link"`, keeps any identity that shared the attribute (`data-ui="badge text-xs"` becomes `data-ui="badge" data-font="xs"`), and rewrites quoted selectors (`[data-ui~="text-sm"]` becomes `[data-font="sm"]`).
|
|
33
|
+
|
|
34
|
+
It reads markup, templates, scripts, and stylesheets under the project root, or under the paths you name. It skips every vendored kit directory, `node_modules` and other dependency and build folders, dot-directories, a top-level `vendor` or `tmp`, minified files, and plain Markdown. Name a file to rewrite it anyway; a vendored kit file is never rewritten.
|
|
35
|
+
|
|
36
|
+
In a vendored project it handles the kit as well. If the recorded kit predates `data-font`, it runs `update` first, to latest or to the `@version` you pass. That update brings the new `_variables.css` and `_typography.css`, and `--keep`, `--theirs`, and `--markers` answer its conflicts. Then it runs `add` for the primitives your markup uses: `font`, and `link` and `prose` where they appear. Without a `zazz.json` it rewrites the markup and leaves the kit to you.
|
|
37
|
+
|
|
38
|
+
It only moves what it can move safely. It leaves these as written, lists the ones it finds, and exits with code 2:
|
|
39
|
+
|
|
40
|
+
- an element with two roles, or one that already has `data-font`
|
|
41
|
+
- a value with template syntax among its tokens (`data-ui="text-sm {{ extra }}"`)
|
|
42
|
+
- a role set from script (`el.setAttribute("data-ui", "text-xs")`, `data-ui={…}`)
|
|
43
|
+
- an unquoted selector (`[data-ui~=text-sm]`)
|
|
44
|
+
- a file that is not UTF-8 or is over 2 MB
|
|
45
|
+
|
|
46
|
+
The list covers the common ways a role is set, not every one; search for `text-` afterward if your templates build `data-ui` in unusual ways. `--dry-run` prints the files and counts and writes nothing. A second run changes nothing.
|
|
47
|
+
|
|
48
|
+
### small-sizes
|
|
49
|
+
|
|
50
|
+
`codemod small-sizes [paths...]` handles the small control sizes the kit removed: `data-button-size` and `data-toggle-size` no longer take `"sm"` or `"icon-sm"`. It asks what to do; removing them is the default, and it is the answer under `-y` or without a terminal.
|
|
51
|
+
|
|
52
|
+
- **Remove**: rewrites the markup. `"sm"` is dropped and `"icon-sm"` becomes `"icon"`, quoted or not, with or without spaces around `=`. A selector (`[data-button-size="sm"]`), a size set from script, or a template value is listed for review, left as written, and the command exits with code 2.
|
|
53
|
+
- **Keep** (`--restore`, or pick it at the prompt): leaves the markup alone and adds the removed rules back. In a vendored project they go at the end of the vendored `button.css` and `toggle.css`, where `update` merges them like any edit of yours. Without a `zazz.json`, and for button or toggle when it isn't vendored, they go in `zazz-small-sizes.css` at the project root (added to the end if the file exists), which you load after the kit's stylesheet. It recognizes its own rules by their header, so running it again adds nothing twice, and on a vendored kit old enough to still have the sizes it adds them anyway, so the next `update` can't drop them. Inside an input group or a password group a small size wins over the size the group gives its buttons.
|
|
54
|
+
|
|
55
|
+
Fields never had a small size and are not touched. `--dry-run` writes nothing.
|
|
56
|
+
|
|
30
57
|
## Owning the code
|
|
31
58
|
|
|
32
59
|
There is no runtime dependency on `@zazz-ui/core`. The files in `zazz/` are yours: edit them, delete what you don't want, commit them like any other source. `zazz.json` is what makes that safe, and `update` is what makes it cheap.
|
|
33
60
|
|
|
34
61
|
## Requirements
|
|
35
62
|
|
|
36
|
-
Node 22.22+ (or 24.15+). Works with `@zazz-ui/core` 0.1 through 0.
|
|
63
|
+
Node 22.22+ (or 24.15+). Works with `@zazz-ui/core` 0.1 through 0.16 (manifest v1–v2); given a newer kit, the CLI tells you to upgrade it. Works offline once a kit version is cached; respects your `.npmrc` (registries, proxies, auth). `--registry`, `--offline`, and `--prefer-offline` are available on every command.
|
|
37
64
|
|
|
38
65
|
## License
|
|
39
66
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
1
|
+
import { _ as resolveKit, a as renderIndexJs, b as filterCollisions, c as createUi, d as baseCssSplit, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, m as primitiveFiles, n as insertCssImports, o as sha256, p as baseScriptFiles, r as renderHead, s as vendorFiles, t as appendJsImports, u as describe, y as loadConfig } from "./wiring-K8-qOImj.js";
|
|
2
|
+
import { t as ZazzError } from "./errors--aALbpFB.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/commands/add.ts
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview `zazz-ui add` — vendor primitives and their dependencies.
|
|
10
10
|
* @description Resolves the requested primitives' dependency closure through
|
|
@@ -52,12 +52,17 @@ async function runAdd(names, flags, global) {
|
|
|
52
52
|
version: kit.version,
|
|
53
53
|
files: hashes
|
|
54
54
|
};
|
|
55
|
+
if (config.base.entries) config.base.entries[name] = kit.version;
|
|
55
56
|
}
|
|
56
57
|
const freshEntries = fresh.flatMap((name) => kit.manifest.primitives[name] ?? []);
|
|
57
58
|
const neededBase = baseScriptFiles(freshEntries, config.language).filter((file) => !(file in config.base.files));
|
|
58
59
|
const base = await vendorFiles(kit, neededBase, destRoot);
|
|
59
60
|
vendorWrites.push(...base.writes);
|
|
60
61
|
Object.assign(config.base.files, base.hashes);
|
|
62
|
+
if (kit.version !== (config.base.version ?? config.kit.version)) config.base.sources = {
|
|
63
|
+
...config.base.sources,
|
|
64
|
+
...Object.fromEntries(Object.keys(base.hashes).map((file) => [file, kit.version]))
|
|
65
|
+
};
|
|
61
66
|
const { kept, skipped } = await filterCollisions(vendorWrites, {
|
|
62
67
|
ui,
|
|
63
68
|
force: flags.force === true
|
|
@@ -128,5 +133,4 @@ async function wiringWrites(kit, config, destRoot, fresh) {
|
|
|
128
133
|
return writes;
|
|
129
134
|
}
|
|
130
135
|
|
|
131
|
-
|
|
132
|
-
export { runAdd };
|
|
136
|
+
export { runAdd as t };
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as ZazzError } from "./errors
|
|
2
|
+
import { t as ZazzError } from "./errors--aALbpFB.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Command, Option } from "commander";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/cli.ts
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview `zazz-ui` — vendor Zazz primitives into your project.
|
|
10
10
|
* @description Thin commander program: parses flags, hands off to command
|
|
@@ -15,21 +15,25 @@ import { Command, Option } from "commander";
|
|
|
15
15
|
const { version } = createRequire(import.meta.url)("../package.json");
|
|
16
16
|
const program = new Command("zazz-ui").description("Vendor Zazz Design Framework primitives into your project").version(version).option("-c, --cwd <path>", "run as if started in <path>", process.cwd()).option("-y, --yes", "answer prompts with their defaults; never block").option("--silent", "no output except errors").option("--registry <url>", "npm registry override").option("--offline", "cache only; never touch the network").option("--prefer-offline", "use cached data without revalidating");
|
|
17
17
|
program.command("init").description("vendor the Zazz base (tokens, reset, runtime) into this project").argument("[version]", "kit version, @-prefixed (e.g. @0.5.0); default latest").option("--dir <path>", "target directory for vendored files", "zazz").option("--ts", "vendor TypeScript sources instead of compiled .js").option("--legacy <path>", "wire an existing stylesheet into the legacy.imports cascade sublayer").option("--no-fonts", "omit the Geist fonts block from head.html").option("--no-theme-script", "omit the theme-persistence script from head.html").option("--force", "overwrite existing files without asking").option("--dry-run", "print the plan without writing").action(async (versionArg, options) => {
|
|
18
|
-
const { runInit } = await import("./init-
|
|
18
|
+
const { runInit } = await import("./init-DuvWuYCt.js");
|
|
19
19
|
await runInit(versionArg, options, program.opts());
|
|
20
20
|
});
|
|
21
21
|
program.command("update").description("move vendored files to a new kit version with 3-way merges").argument("[args...]", "target version @-prefixed (default @latest) and/or primitive names to narrow to").addOption(new Option("--keep", "resolve every conflict by keeping your version").conflicts(["theirs", "markers"])).addOption(new Option("--theirs", "resolve every conflict by taking the new version").conflicts(["keep", "markers"])).addOption(new Option("--markers", "write diff3 conflict markers for every conflict").conflicts(["keep", "theirs"])).option("--force", "overwrite stray files without asking").option("--dry-run", "print the plan without writing").action(async (args, options) => {
|
|
22
|
-
const { runUpdate } = await import("./update-
|
|
22
|
+
const { runUpdate } = await import("./update-C32jRa_O.js");
|
|
23
23
|
await runUpdate(args, options, program.opts());
|
|
24
24
|
});
|
|
25
25
|
program.command("diff").description("preview what an update would change (read-only)").argument("[args...]", "target version @-prefixed (default @latest) and/or names to narrow to (base, button, …)").option("--upstream", "compare pristine recorded vs target instead of your files vs target").action(async (args, options) => {
|
|
26
|
-
const { runDiff } = await import("./diff-
|
|
26
|
+
const { runDiff } = await import("./diff-SlSZRLDi.js");
|
|
27
27
|
await runDiff(args, options, program.opts());
|
|
28
28
|
});
|
|
29
29
|
program.command("add").description("vendor primitives (and their dependencies) at the project's kit version").argument("<primitive...>", "primitive names (e.g. button combobox)").option("--examples", "also copy the primitives' example html").option("--force", "overwrite existing files without asking").option("--dry-run", "print the closure and file plan without writing").action(async (names, options) => {
|
|
30
|
-
const { runAdd } = await import("./add-
|
|
30
|
+
const { runAdd } = await import("./add-P8X_avx2.js");
|
|
31
31
|
await runAdd(names, options, program.opts());
|
|
32
32
|
});
|
|
33
|
+
program.command("codemod").description("rewrite your markup for a breaking kit change (data-font, small-sizes)").argument("<name>", "the codemod to run: data-font, small-sizes").argument("[args...]", "files or directories to rewrite (default the whole project), and/or the kit version to update to first, @-prefixed (default @latest)").addOption(new Option("--keep", "if the kit updates first: keep your version on every conflict").conflicts(["theirs", "markers"])).addOption(new Option("--theirs", "if the kit updates first: take the new version on every conflict").conflicts(["keep", "markers"])).addOption(new Option("--markers", "if the kit updates first: write diff3 conflict markers on every conflict").conflicts(["keep", "theirs"])).option("--force", "overwrite existing files when vendoring without asking").option("--restore", "small-sizes: keep the small sizes, adding their rules back, instead of removing them").option("--dry-run", "list what would change without writing").action(async (name, args, options) => {
|
|
34
|
+
const { runCodemod } = await import("./codemod-D_Qdyjbn.js");
|
|
35
|
+
await runCodemod(name, args, options, program.opts());
|
|
36
|
+
});
|
|
33
37
|
try {
|
|
34
38
|
await program.parseAsync();
|
|
35
39
|
} catch (error) {
|
|
@@ -40,5 +44,4 @@ try {
|
|
|
40
44
|
} else throw error;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
//#endregion
|
|
44
47
|
export { };
|