@shadow-js/ui 1.0.0 → 1.0.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/CHANGELOG.md +6 -0
- package/dist/cli.mjs +13 -25
- package/dist/dev/cli/schema.d.ts +0 -2
- package/dist/dev/locales/ar.d.ts +0 -2
- package/dist/dev/locales/ar.js +1 -2
- package/dist/dev/locales/en.d.ts +0 -2
- package/dist/dev/locales/en.js +1 -2
- package/dist/dev/registry/utils/utils.d.ts +0 -2
- package/dist/dev/registry/utils/utils.js +1 -2
- package/dist/dev/theme/theme-logic.d.ts +0 -2
- package/dist/dev/theme/theme-logic.js +1 -2
- package/dist/dev/theme/theme-provider.d.ts +0 -2
- package/dist/dev/theme/theme-provider.js +1 -2
- package/package.json +11 -11
- package/registry.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { createInterface } from "node:readline/promises";
|
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { parseArgs } from "node:util";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
|
|
8
|
+
// src/cli/fs.ts
|
|
9
9
|
/**
|
|
10
10
|
* The filesystem the CLI works on, as an interface so commands are tested against a temp
|
|
11
11
|
* directory or an in-memory tree, and so every path goes through one place.
|
|
@@ -371,8 +371,7 @@ function unifiedDiff(before, after, labels, context = 3) {
|
|
|
371
371
|
...hunks
|
|
372
372
|
].join("\n");
|
|
373
373
|
}
|
|
374
|
-
|
|
375
|
-
//#region src/cli/paths.ts
|
|
374
|
+
// src/cli/paths.ts
|
|
376
375
|
/**
|
|
377
376
|
* Path handling: reading `tsconfig` path aliases, mapping an import alias to a directory, and the
|
|
378
377
|
* guard that keeps every write inside the project. Pure except for the `ProjectFs` it is handed.
|
|
@@ -567,8 +566,7 @@ function resolveInsideReal(fs, root, target) {
|
|
|
567
566
|
if (rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel)) throw new PathError(`Refusing to write outside the project (symbolic link): ${target}`);
|
|
568
567
|
return absolute;
|
|
569
568
|
}
|
|
570
|
-
|
|
571
|
-
//#region src/cli/pm.ts
|
|
569
|
+
// src/cli/pm.ts
|
|
572
570
|
/**
|
|
573
571
|
* Package manager detection and the install command line. npm is the default; pnpm, yarn and bun
|
|
574
572
|
* are used when their lockfile (or the `packageManager` field) says so.
|
|
@@ -635,8 +633,7 @@ function installCommand(manager, packages) {
|
|
|
635
633
|
};
|
|
636
634
|
}
|
|
637
635
|
}
|
|
638
|
-
|
|
639
|
-
//#region src/cli/schema.ts
|
|
636
|
+
// src/cli/schema.ts
|
|
640
637
|
/**
|
|
641
638
|
* The base colors, in documentation order.
|
|
642
639
|
* @since 1.0.0
|
|
@@ -816,8 +813,7 @@ function parseComponentsConfig(value) {
|
|
|
816
813
|
}
|
|
817
814
|
};
|
|
818
815
|
}
|
|
819
|
-
|
|
820
|
-
//#region src/cli/project.ts
|
|
816
|
+
// src/cli/project.ts
|
|
821
817
|
/**
|
|
822
818
|
* The project the CLI works in: `components.json`, `package.json`, the stylesheet that imports
|
|
823
819
|
* Tailwind, and the theme stylesheet `init` generates. Reads through {@link ProjectFs}.
|
|
@@ -1084,8 +1080,7 @@ function display(root, absolute) {
|
|
|
1084
1080
|
function themePathFor(cssPath) {
|
|
1085
1081
|
return join(dirname(cssPath), THEME_FILE);
|
|
1086
1082
|
}
|
|
1087
|
-
|
|
1088
|
-
//#region src/cli/resolve.ts
|
|
1083
|
+
// src/cli/resolve.ts
|
|
1089
1084
|
/**
|
|
1090
1085
|
* Registry resolution: from the names a user typed to the ordered list of items to copy and the
|
|
1091
1086
|
* npm packages they need. Pure: no filesystem, no network.
|
|
@@ -1242,8 +1237,7 @@ function dependentsOf(index, name, candidates) {
|
|
|
1242
1237
|
}
|
|
1243
1238
|
return found.sort();
|
|
1244
1239
|
}
|
|
1245
|
-
|
|
1246
|
-
//#region src/cli/rewrite.ts
|
|
1240
|
+
// src/cli/rewrite.ts
|
|
1247
1241
|
/**
|
|
1248
1242
|
* Maps one import specifier from the registry layout to the project's aliases.
|
|
1249
1243
|
*
|
|
@@ -1281,8 +1275,7 @@ const SPECIFIER = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(["'])(@\/[^"'\n]+)\2
|
|
|
1281
1275
|
function rewriteImports(source, aliases) {
|
|
1282
1276
|
return source.replace(SPECIFIER, (_match, lead, quote, specifier) => `${lead}${quote}${rewriteSpecifier(specifier, aliases)}${quote}`);
|
|
1283
1277
|
}
|
|
1284
|
-
|
|
1285
|
-
//#region src/cli/commands.ts
|
|
1278
|
+
// src/cli/commands.ts
|
|
1286
1279
|
/**
|
|
1287
1280
|
* The CLI commands. Each takes a {@link CliContext} (filesystem, registry, output, prompt and
|
|
1288
1281
|
* installer are parameters), so tests run them against a temp directory with a recording
|
|
@@ -1823,8 +1816,7 @@ function runRemove(ctx, names, flags) {
|
|
|
1823
1816
|
return failed(ctx, error);
|
|
1824
1817
|
}
|
|
1825
1818
|
}
|
|
1826
|
-
|
|
1827
|
-
//#region src/cli/completion.ts
|
|
1819
|
+
// src/cli/completion.ts
|
|
1828
1820
|
/**
|
|
1829
1821
|
* Shell completion scripts for the `shadow-ui` command. Each script is static text built from the
|
|
1830
1822
|
* commands and flags it is given. It never calls back into the CLI, so it cannot complete
|
|
@@ -1935,8 +1927,7 @@ function fishScript(commands, flags) {
|
|
|
1935
1927
|
...flags.map((flag) => `complete -c shadow-ui -l ${flag}`)
|
|
1936
1928
|
].join("\n");
|
|
1937
1929
|
}
|
|
1938
|
-
|
|
1939
|
-
//#region src/cli/main.ts
|
|
1930
|
+
// src/cli/main.ts
|
|
1940
1931
|
/**
|
|
1941
1932
|
* Argument parsing and dispatch for the `shadow-ui` command. `main` takes its context as a
|
|
1942
1933
|
* parameter, so it is tested without spawning a process.
|
|
@@ -2169,8 +2160,7 @@ async function dispatch(ctx, command, rest, values, common) {
|
|
|
2169
2160
|
}
|
|
2170
2161
|
}
|
|
2171
2162
|
}
|
|
2172
|
-
|
|
2173
|
-
//#region src/cli/registry-source.ts
|
|
2163
|
+
// src/cli/registry-source.ts
|
|
2174
2164
|
/**
|
|
2175
2165
|
* Where the CLI reads the registry from. The registry ships inside the package, so nothing is
|
|
2176
2166
|
* downloaded: `registry.json` plus the files under `registry/` and `styles/`.
|
|
@@ -2243,8 +2233,7 @@ function loadRegistrySource(root = packageRoot()) {
|
|
|
2243
2233
|
return existsSync(file) ? readFileSync(file, "utf8") : void 0;
|
|
2244
2234
|
});
|
|
2245
2235
|
}
|
|
2246
|
-
|
|
2247
|
-
//#region src/cli/bin.ts
|
|
2236
|
+
// src/cli/bin.ts
|
|
2248
2237
|
/**
|
|
2249
2238
|
* The `shadow-ui` executable: wires the real filesystem, terminal and package manager into
|
|
2250
2239
|
* {@link main}. Kept tiny; everything testable lives in the other modules.
|
|
@@ -2254,7 +2243,7 @@ function realContext(cwd) {
|
|
|
2254
2243
|
cwd: resolve(cwd ?? process.cwd()),
|
|
2255
2244
|
fs: nodeFs(),
|
|
2256
2245
|
registry: loadRegistrySource(),
|
|
2257
|
-
version: "1.0.
|
|
2246
|
+
version: "1.0.1",
|
|
2258
2247
|
out: (line) => process.stdout.write(`${line}\n`),
|
|
2259
2248
|
err: (line) => process.stderr.write(`${line}\n`),
|
|
2260
2249
|
async confirm(question) {
|
|
@@ -2289,5 +2278,4 @@ function realContext(cwd) {
|
|
|
2289
2278
|
const argv = process.argv.slice(2);
|
|
2290
2279
|
if (wantsJson(argv)) installCrashHandlers(argv);
|
|
2291
2280
|
process.exitCode = await main(argv, realContext);
|
|
2292
|
-
//#endregion
|
|
2293
2281
|
export {};
|
package/dist/dev/cli/schema.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cli/schema.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The shapes the CLI reads: the registry index (`registry.json`) and the project's
|
|
4
3
|
* `components.json`, with validators that turn untrusted JSON into typed values or a clear error.
|
|
@@ -69,5 +68,4 @@ export interface RegistryIndex {
|
|
|
69
68
|
/** Every installable item, in registry order. */
|
|
70
69
|
readonly items: readonly RegistryItem[];
|
|
71
70
|
}
|
|
72
|
-
//#endregion
|
|
73
71
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/dev/locales/ar.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/locales/ar.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The Arabic messages of the UI kit, as a catalog of messages: every label, description and live-region text the components show, keyed
|
|
4
3
|
* by component. Pass it (or a copy with your own words) to the strings provider of your project, or into a `createI18n` catalog.
|
|
@@ -136,6 +135,5 @@ declare const ar: {
|
|
|
136
135
|
readonly notifications: "الإشعارات";
|
|
137
136
|
};
|
|
138
137
|
};
|
|
139
|
-
//#endregion
|
|
140
138
|
export { ar as default };
|
|
141
139
|
//# sourceMappingURL=ar.d.ts.map
|
package/dist/dev/locales/ar.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locales/ar.ts
|
|
2
2
|
/**
|
|
3
3
|
* The Arabic messages of the UI kit, as a catalog of messages: every label, description and live-region text the components show, keyed
|
|
4
4
|
* by component. Pass it (or a copy with your own words) to the strings provider of your project, or into a `createI18n` catalog.
|
|
@@ -122,7 +122,6 @@ const ar = {
|
|
|
122
122
|
notifications: "الإشعارات"
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
//#endregion
|
|
126
125
|
export { ar as default };
|
|
127
126
|
|
|
128
127
|
//# sourceMappingURL=ar.js.map
|
package/dist/dev/locales/en.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/locales/en.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The English messages of the UI kit, as a catalog of messages: every label, description and live-region text the components show, keyed
|
|
4
3
|
* by component. Pass it (or a copy with your own words) to the strings provider of your project, or into a `createI18n` catalog.
|
|
@@ -136,6 +135,5 @@ declare const en: {
|
|
|
136
135
|
readonly notifications: "Notifications";
|
|
137
136
|
};
|
|
138
137
|
};
|
|
139
|
-
//#endregion
|
|
140
138
|
export { en as default };
|
|
141
139
|
//# sourceMappingURL=en.d.ts.map
|
package/dist/dev/locales/en.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locales/en.ts
|
|
2
2
|
/**
|
|
3
3
|
* The English messages of the UI kit, as a catalog of messages: every label, description and live-region text the components show, keyed
|
|
4
4
|
* by component. Pass it (or a copy with your own words) to the strings provider of your project, or into a `createI18n` catalog.
|
|
@@ -122,7 +122,6 @@ const en = {
|
|
|
122
122
|
notifications: "Notifications"
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
//#endregion
|
|
126
125
|
export { en as default };
|
|
127
126
|
|
|
128
127
|
//# sourceMappingURL=en.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region registry/utils/utils.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Anything a ShadowJS `class` attribute accepts: strings, numbers, nested (readonly) arrays and
|
|
4
3
|
* `{ name: condition }` objects. Falsy values are skipped.
|
|
@@ -25,5 +24,4 @@ export type ClassValue = string | number | bigint | boolean | null | undefined |
|
|
|
25
24
|
* @see {@link ClassValue}
|
|
26
25
|
*/
|
|
27
26
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
28
|
-
//#endregion
|
|
29
27
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { clsx } from "clsx";
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
|
-
|
|
3
|
+
// registry/utils/utils.ts
|
|
4
4
|
/**
|
|
5
5
|
* Joins class names (strings, arrays, `{ name: condition }` objects) and resolves Tailwind
|
|
6
6
|
* conflicts, so the last utility wins: `cn("px-2", props.class)` lets the caller override `px-2`.
|
|
@@ -21,7 +21,6 @@ import { twMerge } from "tailwind-merge";
|
|
|
21
21
|
function cn(...inputs) {
|
|
22
22
|
return twMerge(clsx(...inputs));
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { cn };
|
|
26
25
|
|
|
27
26
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/theme/theme-logic.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Pure theme logic, shared by the provider and the no-flash script so both agree on what
|
|
4
3
|
* "system", "light" and "dark" mean. Nothing here touches `window` unless it is handed an object.
|
|
@@ -183,5 +182,4 @@ export declare function themeScript(options?: ThemeOptions): string;
|
|
|
183
182
|
export declare function themeScriptTag(options?: ThemeOptions & {
|
|
184
183
|
readonly nonce?: string | undefined;
|
|
185
184
|
}): string;
|
|
186
|
-
//#endregion
|
|
187
185
|
//# sourceMappingURL=theme-logic.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/theme/theme-logic.ts
|
|
2
2
|
/**
|
|
3
3
|
* The `localStorage` key that holds the theme choice when `storageKey` is not given.
|
|
4
4
|
* @example
|
|
@@ -178,7 +178,6 @@ function themeScript(options = {}) {
|
|
|
178
178
|
function themeScriptTag(options = {}) {
|
|
179
179
|
return `<script${options.nonce === void 0 ? "" : ` nonce="${options.nonce.replace(/[^A-Za-z0-9+/=_-]/g, "")}"`}>${themeScript(options)}<\/script>`;
|
|
180
180
|
}
|
|
181
|
-
//#endregion
|
|
182
181
|
export { DEFAULT_STORAGE_KEY, applyTheme, isTheme, readStoredTheme, resolveTheme, themeScript, themeScriptTag, writeStoredTheme };
|
|
183
182
|
|
|
184
183
|
//# sourceMappingURL=theme-logic.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ResolvedTheme, Theme, ThemeOptions } from "./theme-logic.js";
|
|
2
2
|
import { Accessor } from "@shadow-js/core";
|
|
3
3
|
import { JsxChild } from "@shadow-js/web/jsx-runtime";
|
|
4
|
-
//#region src/theme/theme-provider.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* What {@link useTheme} returns. Every value is an accessor: call it to read.
|
|
7
6
|
* @since 1.0.0
|
|
@@ -86,5 +85,4 @@ export declare function ThemeProvider(props: ThemeProviderProps): JsxChild;
|
|
|
86
85
|
* @since 1.0.0
|
|
87
86
|
*/
|
|
88
87
|
export declare function useTheme(): ThemeContextValue;
|
|
89
|
-
//#endregion
|
|
90
88
|
//# sourceMappingURL=theme-provider.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { applyTheme, isTheme, readStoredTheme, resolveTheme, writeStoredTheme } from "./theme-logic.js";
|
|
2
2
|
import { batch, createContext, onCleanup, onMount, untrack, useContext, useEffect, useMemo, useSignal } from "@shadow-js/core";
|
|
3
|
-
|
|
3
|
+
// src/theme/theme-provider.ts
|
|
4
4
|
const MISSING = {
|
|
5
5
|
theme: () => "system",
|
|
6
6
|
resolvedTheme: () => void 0,
|
|
@@ -144,7 +144,6 @@ function useTheme() {
|
|
|
144
144
|
if (value === MISSING) throw new Error("useTheme() must be used within <ThemeProvider>");
|
|
145
145
|
return value;
|
|
146
146
|
}
|
|
147
|
-
//#endregion
|
|
148
147
|
export { ThemeProvider, useTheme };
|
|
149
148
|
|
|
150
149
|
//# sourceMappingURL=theme-provider.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shadow-js/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "shadcn-style components you add to your project with a CLI, styled with Tailwind v4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
"check": "npm run lint && npm run typecheck && npm run build && npm test && npm run test:perf && npm run test:gc"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@shadow-js/core": "^1.0.
|
|
64
|
-
"@shadow-js/primitives": "^1.0.
|
|
65
|
-
"@shadow-js/web": "^1.0.
|
|
63
|
+
"@shadow-js/core": "^1.0.1",
|
|
64
|
+
"@shadow-js/primitives": "^1.0.1",
|
|
65
|
+
"@shadow-js/web": "^1.0.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@biomejs/biome": "2.5.15",
|
|
69
|
-
"@shadow-js/compiler": "^1.0.
|
|
70
|
-
"@shadow-js/core": "^1.0.
|
|
71
|
-
"@shadow-js/forms": "^1.0.
|
|
72
|
-
"@shadow-js/primitives": "^1.0.
|
|
73
|
-
"@shadow-js/testing": "^1.0.
|
|
74
|
-
"@shadow-js/web": "^1.0.
|
|
69
|
+
"@shadow-js/compiler": "^1.0.1",
|
|
70
|
+
"@shadow-js/core": "^1.0.1",
|
|
71
|
+
"@shadow-js/forms": "^1.0.1",
|
|
72
|
+
"@shadow-js/primitives": "^1.0.1",
|
|
73
|
+
"@shadow-js/testing": "^1.0.1",
|
|
74
|
+
"@shadow-js/web": "^1.0.1",
|
|
75
75
|
"@tailwindcss/node": "4.3.3",
|
|
76
76
|
"@types/node": "^24.0.0",
|
|
77
77
|
"fast-check": "^4.10.2",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"vitest": "5.0.3"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@shadow-js/table": "1.0.
|
|
87
|
+
"@shadow-js/table": "1.0.1",
|
|
88
88
|
"class-variance-authority": "0.7.1",
|
|
89
89
|
"clsx": "2.1.1",
|
|
90
90
|
"tailwind-merge": "3.7.0"
|
package/registry.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shadow-js/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"frameworkDependencies": [
|
|
5
5
|
"@shadow-js/core",
|
|
6
6
|
"@shadow-js/primitives",
|
|
@@ -1061,7 +1061,7 @@
|
|
|
1061
1061
|
"utils"
|
|
1062
1062
|
],
|
|
1063
1063
|
"dependencies": {
|
|
1064
|
-
"@shadow-js/table": "1.0.
|
|
1064
|
+
"@shadow-js/table": "1.0.1"
|
|
1065
1065
|
},
|
|
1066
1066
|
"exports": [
|
|
1067
1067
|
"DataTable",
|