loseta 0.0.0-stage → 0.1.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.
Files changed (120) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +12 -0
  3. package/README.md +73 -2
  4. package/bin/loseta.js +2 -0
  5. package/dist/cli.d.ts +1 -0
  6. package/dist/cli.js +26 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/add.d.ts +24 -0
  9. package/dist/commands/add.js +174 -0
  10. package/dist/commands/add.js.map +1 -0
  11. package/dist/commands/init.d.ts +26 -0
  12. package/dist/commands/init.js +154 -0
  13. package/dist/commands/init.js.map +1 -0
  14. package/dist/commands/list.d.ts +11 -0
  15. package/dist/commands/list.js +41 -0
  16. package/dist/commands/list.js.map +1 -0
  17. package/dist/config.d.ts +16 -0
  18. package/dist/config.js +41 -0
  19. package/dist/config.js.map +1 -0
  20. package/dist/fs.d.ts +8 -0
  21. package/dist/fs.js +30 -0
  22. package/dist/fs.js.map +1 -0
  23. package/dist/imports.d.ts +10 -0
  24. package/dist/imports.js +61 -0
  25. package/dist/imports.js.map +1 -0
  26. package/dist/manifest.d.ts +12 -0
  27. package/dist/manifest.js +34 -0
  28. package/dist/manifest.js.map +1 -0
  29. package/dist/registry.d.ts +17 -0
  30. package/dist/registry.js +66 -0
  31. package/dist/registry.js.map +1 -0
  32. package/dist/types.d.ts +48 -0
  33. package/dist/types.js +2 -0
  34. package/dist/types.js.map +1 -0
  35. package/dist/ui.d.ts +5 -0
  36. package/dist/ui.js +14 -0
  37. package/dist/ui.js.map +1 -0
  38. package/package.json +58 -4
  39. package/registry/base.css +20 -0
  40. package/registry/components/alert-dialog.css +97 -0
  41. package/registry/components/alert.css +39 -0
  42. package/registry/components/badge.css +25 -0
  43. package/registry/components/button-group.css +83 -0
  44. package/registry/components/button.css +26 -0
  45. package/registry/components/card.css +46 -0
  46. package/registry/components/checkbox.css +24 -0
  47. package/registry/components/dialog.css +64 -0
  48. package/registry/components/dropdown-menu.css +97 -0
  49. package/registry/components/empty.css +64 -0
  50. package/registry/components/field.css +164 -0
  51. package/registry/components/input.css +26 -0
  52. package/registry/components/item.css +102 -0
  53. package/registry/components/kbd.css +11 -0
  54. package/registry/components/label.css +31 -0
  55. package/registry/components/native-select.css +21 -0
  56. package/registry/components/popover.css +7 -0
  57. package/registry/components/radio.css +25 -0
  58. package/registry/components/skeleton.css +11 -0
  59. package/registry/components/switch.css +27 -0
  60. package/registry/components/table.css +73 -0
  61. package/registry/components/tabs.css +61 -0
  62. package/registry/components/textarea.css +19 -0
  63. package/registry/components/tooltip.css +255 -0
  64. package/registry/examples/alert-dialog.html +20 -0
  65. package/registry/examples/alert.html +15 -0
  66. package/registry/examples/badge.html +9 -0
  67. package/registry/examples/button-group.html +13 -0
  68. package/registry/examples/button.html +21 -0
  69. package/registry/examples/card.html +18 -0
  70. package/registry/examples/checkbox.html +8 -0
  71. package/registry/examples/dialog.html +26 -0
  72. package/registry/examples/dropdown-menu.html +15 -0
  73. package/registry/examples/empty.html +11 -0
  74. package/registry/examples/field.html +15 -0
  75. package/registry/examples/input.html +9 -0
  76. package/registry/examples/item.html +20 -0
  77. package/registry/examples/kbd.html +6 -0
  78. package/registry/examples/label.html +5 -0
  79. package/registry/examples/native-select.html +10 -0
  80. package/registry/examples/popover.html +16 -0
  81. package/registry/examples/radio.html +15 -0
  82. package/registry/examples/skeleton.html +6 -0
  83. package/registry/examples/switch.html +5 -0
  84. package/registry/examples/table.html +34 -0
  85. package/registry/examples/tabs.html +27 -0
  86. package/registry/examples/textarea.html +6 -0
  87. package/registry/examples/tooltip.html +4 -0
  88. package/registry/primitives/dialog-shell.css +71 -0
  89. package/registry/primitives/popover.css +130 -0
  90. package/registry/registry.json +884 -0
  91. package/registry/reset.css +148 -0
  92. package/registry/schema.json +77 -0
  93. package/registry/themes/nova/alert-dialog.css +74 -0
  94. package/registry/themes/nova/alert.css +114 -0
  95. package/registry/themes/nova/badge.css +86 -0
  96. package/registry/themes/nova/button-group.css +74 -0
  97. package/registry/themes/nova/button.css +227 -0
  98. package/registry/themes/nova/card.css +102 -0
  99. package/registry/themes/nova/checkbox.css +59 -0
  100. package/registry/themes/nova/dialog.css +64 -0
  101. package/registry/themes/nova/dropdown-menu.css +105 -0
  102. package/registry/themes/nova/empty.css +54 -0
  103. package/registry/themes/nova/field.css +120 -0
  104. package/registry/themes/nova/input.css +57 -0
  105. package/registry/themes/nova/item.css +133 -0
  106. package/registry/themes/nova/kbd.css +22 -0
  107. package/registry/themes/nova/label.css +71 -0
  108. package/registry/themes/nova/native-select.css +71 -0
  109. package/registry/themes/nova/popover.css +25 -0
  110. package/registry/themes/nova/primitives/dialog-shell.css +23 -0
  111. package/registry/themes/nova/primitives/popover.css +16 -0
  112. package/registry/themes/nova/radio.css +53 -0
  113. package/registry/themes/nova/skeleton.css +7 -0
  114. package/registry/themes/nova/switch.css +87 -0
  115. package/registry/themes/nova/table.css +87 -0
  116. package/registry/themes/nova/tabs.css +146 -0
  117. package/registry/themes/nova/textarea.css +49 -0
  118. package/registry/themes/nova/tooltip.css +22 -0
  119. package/registry/tokens.css +139 -0
  120. package/registry/utilities.css +14 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 loseta contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ loseta
2
+ Copyright (c) 2026 loseta contributors
3
+
4
+ This project includes CSS, design tokens and component patterns derived from:
5
+
6
+ - shadcn/ui (https://ui.shadcn.com)
7
+ MIT License, Copyright (c) 2023 shadcn
8
+
9
+ - Tailwind CSS (https://tailwindcss.com)
10
+ MIT License, Copyright (c) Tailwind Labs, Inc.
11
+
12
+ The original loseta code is licensed under the MIT License; see LICENSE.
package/README.md CHANGED
@@ -1,3 +1,74 @@
1
- # Temporary Holding Version
1
+ # loseta
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The CLI and registry for [loseta](https://github.com/vladiantio/loseta).
4
+
5
+ ```bash
6
+ npx loseta init
7
+ npx loseta add button card field
8
+ ```
9
+
10
+ ## Commands
11
+
12
+ | Command | Description |
13
+ | --- | --- |
14
+ | `loseta init` | Create `loseta.json`, install the foundation files and generate `index.css`. |
15
+ | `loseta add <items...>` | Install components and their registry dependencies. |
16
+ | `loseta add all` | Install every stable component. |
17
+ | `loseta list` | List stable components. |
18
+ | `loseta list --all` | Include primitives and foundation items. |
19
+
20
+ `add` flags: `--overwrite`, `--no-deps`, `--html`, `--theme`, `--yes`.
21
+ `init` flags: `--css-dir`, `--entrypoint`, `--theme`, `--import`, `--yes`.
22
+
23
+ ## Registry layout
24
+
25
+ ```
26
+ registry/
27
+ registry.json # item manifest
28
+ schema.json # JSON Schema for the manifest
29
+ tokens.css # design tokens
30
+ reset.css # minimal reset
31
+ base.css # element defaults
32
+ utilities.css # sr-only
33
+ primitives/ # shared popover and dialog shells
34
+ components/ # structural CSS per component
35
+ themes/nova/ # visual CSS per component
36
+ examples/ # example markup used by `add --html`
37
+ ```
38
+
39
+ Each component item contains:
40
+
41
+ - a base file in `components/` (structure and behavior),
42
+ - a theme file in `themes/nova/` (visual style),
43
+ - optional primitive dependencies,
44
+ - a root selector list,
45
+ - optional composition metadata.
46
+
47
+ `index.css` is generated by the CLI and declares the layer order:
48
+
49
+ ```css
50
+ @layer loseta.tokens, loseta.reset, loseta.base, loseta.components, loseta.theme, loseta.utilities;
51
+ ```
52
+
53
+ ## Development
54
+
55
+ ```bash
56
+ pnpm install
57
+ pnpm --filter loseta build # tsc -> dist/
58
+ pnpm --filter loseta validate # registry integrity + CSS parse
59
+ pnpm --filter loseta examples # regenerate registry/examples from the docs
60
+ pnpm --filter loseta dev # run the CLI with tsx
61
+ ```
62
+
63
+ The registry is validated for:
64
+
65
+ - schema conformance,
66
+ - file and example existence,
67
+ - dependency resolution and cycles,
68
+ - `@layer` wrapping,
69
+ - forbidden Tailwind/legacy patterns,
70
+ - CSS parseability with Lightning CSS.
71
+
72
+ ## License
73
+
74
+ MIT. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
package/bin/loseta.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/cli.js";
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,26 @@
1
+ import { defineCommand, runMain } from "citty";
2
+ import { readFileSync } from "node:fs";
3
+ import { addCommand } from "./commands/add.js";
4
+ import { initCommand } from "./commands/init.js";
5
+ import { listCommand } from "./commands/list.js";
6
+ process.stdout.on("error", (error) => {
7
+ if (error.code === "EPIPE") {
8
+ process.exit(0);
9
+ }
10
+ throw error;
11
+ });
12
+ const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
13
+ const main = defineCommand({
14
+ meta: {
15
+ name: "loseta",
16
+ version: packageJson.version,
17
+ description: packageJson.description ?? "Native CSS component scaffolds."
18
+ },
19
+ subCommands: {
20
+ init: initCommand,
21
+ add: addCommand,
22
+ list: listCommand
23
+ }
24
+ });
25
+ runMain(main);
26
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAA4B,EAAE,EAAE;IAC1D,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,KAAK,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CACrB,CAAC;AAE/C,MAAM,IAAI,GAAG,aAAa,CAAC;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,WAAW,EAAE,WAAW,CAAC,WAAW,IAAI,iCAAiC;KAC1E;IACD,WAAW,EAAE;QACX,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,UAAU;QACf,IAAI,EAAE,WAAW;KAClB;CACF,CAAC,CAAC;AAEH,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare const addCommand: import("citty").CommandDef<{
2
+ readonly overwrite: {
3
+ readonly type: "boolean";
4
+ readonly description: "Overwrite existing files without prompting";
5
+ readonly alias: "o";
6
+ };
7
+ readonly noDeps: {
8
+ readonly type: "boolean";
9
+ readonly description: "Do not install registry dependencies";
10
+ };
11
+ readonly html: {
12
+ readonly type: "boolean";
13
+ readonly description: "Print the example HTML for the added components";
14
+ };
15
+ readonly theme: {
16
+ readonly type: "string";
17
+ readonly description: "Theme to use (default: nova)";
18
+ };
19
+ readonly yes: {
20
+ readonly type: "boolean";
21
+ readonly description: "Skip prompts; keep modified files untouched";
22
+ readonly alias: "y";
23
+ };
24
+ }>;
@@ -0,0 +1,174 @@
1
+ import { defineCommand } from "citty";
2
+ import { confirm, intro, isCancel, log, outro } from "@clack/prompts";
3
+ import { join, resolve } from "node:path";
4
+ import { readConfig } from "../config.js";
5
+ import { copyFile, exists, hashFile, readTextIfExists } from "../fs.js";
6
+ import { writeIndex } from "../imports.js";
7
+ import { installedNames, readManifest, upsertManifestItem, writeManifest } from "../manifest.js";
8
+ import { findItem, itemMap, loadRegistry, registryDir, resolveItems, stableComponents } from "../registry.js";
9
+ import { installedSummary, printItems } from "../ui.js";
10
+ const FOUNDATION = ["tokens", "reset", "base", "utilities"];
11
+ export const addCommand = defineCommand({
12
+ meta: {
13
+ name: "add",
14
+ description: "Add components to your project."
15
+ },
16
+ args: {
17
+ overwrite: {
18
+ type: "boolean",
19
+ description: "Overwrite existing files without prompting",
20
+ alias: "o"
21
+ },
22
+ noDeps: {
23
+ type: "boolean",
24
+ description: "Do not install registry dependencies"
25
+ },
26
+ html: {
27
+ type: "boolean",
28
+ description: "Print the example HTML for the added components"
29
+ },
30
+ theme: {
31
+ type: "string",
32
+ description: "Theme to use (default: nova)"
33
+ },
34
+ yes: {
35
+ type: "boolean",
36
+ description: "Skip prompts; keep modified files untouched",
37
+ alias: "y"
38
+ }
39
+ },
40
+ async run({ args }) {
41
+ const projectRoot = process.cwd();
42
+ const config = readConfig(projectRoot);
43
+ if (!config) {
44
+ log.error("loseta.json not found. Run `loseta init` first.");
45
+ process.exitCode = 1;
46
+ return;
47
+ }
48
+ const manifest = readManifest(projectRoot);
49
+ if (!manifest) {
50
+ log.error(".loseta/manifest.json not found. Run `loseta init` first.");
51
+ process.exitCode = 1;
52
+ return;
53
+ }
54
+ const registry = loadRegistry();
55
+ const installed = installedNames(manifest);
56
+ const missingFoundation = FOUNDATION.filter((name) => !installed.has(name));
57
+ if (missingFoundation.length > 0) {
58
+ log.error(`The loseta foundation is incomplete (missing: ${missingFoundation.join(", ")}). Run \`loseta init\`.`);
59
+ process.exitCode = 1;
60
+ return;
61
+ }
62
+ let names = args._.map(String);
63
+ if (names.length === 0) {
64
+ intro("loseta add");
65
+ printItems(stableComponents(registry));
66
+ outro("Run `loseta add <component...>` or `loseta add all`.");
67
+ return;
68
+ }
69
+ if (names.includes("all")) {
70
+ names = stableComponents(registry).map((item) => item.name);
71
+ }
72
+ const map = itemMap(registry);
73
+ for (const name of names) {
74
+ const item = map.get(name);
75
+ if (!item) {
76
+ log.error(`Unknown item: ${name}. Run \`loseta list\` to see available components.`);
77
+ process.exitCode = 1;
78
+ return;
79
+ }
80
+ if (item.type !== "component" || item.status !== "stable") {
81
+ log.error(`${name} is a ${item.type} and cannot be added directly. Dependencies are installed automatically.`);
82
+ process.exitCode = 1;
83
+ return;
84
+ }
85
+ }
86
+ const theme = args.theme ?? config.theme;
87
+ if (theme !== "nova") {
88
+ log.error(`Unknown theme: ${theme}. Available themes: nova.`);
89
+ process.exitCode = 1;
90
+ return;
91
+ }
92
+ let resolved;
93
+ if (args.noDeps) {
94
+ resolved = names.map((name) => findItem(registry, name));
95
+ const missing = resolved
96
+ .flatMap((item) => item.registryDependencies ?? [])
97
+ .filter((dependency) => !installed.has(dependency));
98
+ if (missing.length > 0) {
99
+ log.warn(`--no-deps: missing ${[...new Set(missing)].join(", ")}. The component may not work.`);
100
+ }
101
+ }
102
+ else {
103
+ resolved = resolveItems(registry, names);
104
+ }
105
+ const cssDirAbs = resolve(projectRoot, config.cssDir);
106
+ let copied = 0;
107
+ let skipped = 0;
108
+ for (const item of resolved) {
109
+ const files = [];
110
+ for (const file of item.files) {
111
+ const source = join(registryDir, file.path);
112
+ const target = join(cssDirAbs, file.target);
113
+ const sourceHash = hashFile(source);
114
+ const targetHash = exists(target) ? hashFile(target) : undefined;
115
+ let shouldCopy = true;
116
+ if (targetHash !== undefined) {
117
+ if (targetHash === sourceHash) {
118
+ shouldCopy = false;
119
+ }
120
+ else if (args.overwrite) {
121
+ shouldCopy = true;
122
+ }
123
+ else if (args.yes) {
124
+ log.warn(`Keeping modified file: ${file.target}`);
125
+ shouldCopy = false;
126
+ }
127
+ else {
128
+ const answer = await confirm({
129
+ message: `Overwrite ${file.target}?`,
130
+ initialValue: false
131
+ });
132
+ shouldCopy = !isCancel(answer) && Boolean(answer);
133
+ }
134
+ }
135
+ if (shouldCopy) {
136
+ copyFile(source, target);
137
+ copied += 1;
138
+ }
139
+ else {
140
+ skipped += 1;
141
+ }
142
+ files.push({ path: file.target, hash: hashFile(target) });
143
+ }
144
+ upsertManifestItem(manifest, {
145
+ name: item.name,
146
+ version: registry.version,
147
+ files
148
+ });
149
+ }
150
+ writeManifest(projectRoot, manifest);
151
+ writeIndex(projectRoot, config, registry, installedNames(manifest));
152
+ const added = resolved.filter((item) => item.type === "component").map((item) => item.name);
153
+ const primitives = resolved
154
+ .filter((item) => item.type === "primitive")
155
+ .map((item) => item.name);
156
+ log.success(`Added ${installedSummary(added)}.`);
157
+ if (primitives.length > 0) {
158
+ log.info(`Installed dependencies: ${primitives.join(", ")}.`);
159
+ }
160
+ log.info(`${copied} file(s) written, ${skipped} skipped.`);
161
+ if (args.html) {
162
+ for (const name of added) {
163
+ const example = readTextIfExists(join(registryDir, "examples", `${name}.html`));
164
+ if (example === undefined) {
165
+ log.warn(`No example HTML for ${name} yet.`);
166
+ continue;
167
+ }
168
+ console.log(`\n<!-- ${name} -->\n${example.trim()}\n`);
169
+ }
170
+ }
171
+ outro("Done.");
172
+ }
173
+ });
174
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAU,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;IACtC,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,iCAAiC;KAC/C;IACD,IAAI,EAAE;QACJ,SAAS,EAAE;YACT,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,4CAA4C;YACzD,KAAK,EAAE,GAAG;SACX;QACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,sCAAsC;SACpD;Q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AC,IAAI,CAAC,uBAAuB,IAAI,OAAO,CAAC,CAAC;oBAC7C,SAAS;gBACX,CAAC;gBACD,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,SAAS,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ export declare const initCommand: import("citty").CommandDef<{
2
+ readonly cssDir: {
3
+ readonly type: "string";
4
+ readonly description: "Directory for loseta CSS (default: src/styles/loseta)";
5
+ readonly alias: "c";
6
+ };
7
+ readonly entrypoint: {
8
+ readonly type: "string";
9
+ readonly description: "CSS entrypoint to import loseta from";
10
+ readonly alias: "e";
11
+ };
12
+ readonly theme: {
13
+ readonly type: "string";
14
+ readonly description: "Theme to install (default: nova)";
15
+ readonly default: "nova";
16
+ };
17
+ readonly import: {
18
+ readonly type: "boolean";
19
+ readonly description: "Add the @import to the detected entrypoint without prompting";
20
+ };
21
+ readonly yes: {
22
+ readonly type: "boolean";
23
+ readonly description: "Use defaults without prompting";
24
+ readonly alias: "y";
25
+ };
26
+ }>;
@@ -0,0 +1,154 @@
1
+ import { defineCommand } from "citty";
2
+ import { cancel, confirm, intro, isCancel, log, outro, text } from "@clack/prompts";
3
+ import { existsSync } from "node:fs";
4
+ import { join, resolve } from "node:path";
5
+ import { DEFAULT_CSS_DIR, DEFAULT_THEME, detectEntrypoint, readConfig, writeConfig } from "../config.js";
6
+ import { copyFile, hashFile } from "../fs.js";
7
+ import { addEntrypointImport, writeIndex } from "../imports.js";
8
+ import { installedNames, upsertManifestItem, writeManifest } from "../manifest.js";
9
+ import { loadRegistry, registryDir, resolveItems } from "../registry.js";
10
+ export const initCommand = defineCommand({
11
+ meta: {
12
+ name: "init",
13
+ description: "Set up loseta in this project."
14
+ },
15
+ args: {
16
+ cssDir: {
17
+ type: "string",
18
+ description: "Directory for loseta CSS (default: src/styles/loseta)",
19
+ alias: "c"
20
+ },
21
+ entrypoint: {
22
+ type: "string",
23
+ description: "CSS entrypoint to import loseta from",
24
+ alias: "e"
25
+ },
26
+ theme: {
27
+ type: "string",
28
+ description: "Theme to install (default: nova)",
29
+ default: DEFAULT_THEME
30
+ },
31
+ import: {
32
+ type: "boolean",
33
+ description: "Add the @import to the detected entrypoint without prompting"
34
+ },
35
+ yes: {
36
+ type: "boolean",
37
+ description: "Use defaults without prompting",
38
+ alias: "y"
39
+ }
40
+ },
41
+ async run({ args }) {
42
+ const projectRoot = process.cwd();
43
+ intro("loseta init");
44
+ const existingConfig = readConfig(projectRoot);
45
+ if (existingConfig && !args.yes) {
46
+ log.warn("loseta.json already exists.");
47
+ const proceed = await confirm({
48
+ message: "Reinitialize and overwrite the foundation files?",
49
+ initialValue: false
50
+ });
51
+ if (isCancel(proceed) || !proceed) {
52
+ cancel("Cancelled.");
53
+ return;
54
+ }
55
+ }
56
+ let cssDir = args.cssDir ?? existingConfig?.cssDir ?? DEFAULT_CSS_DIR;
57
+ let theme = args.theme ?? existingConfig?.theme ?? DEFAULT_THEME;
58
+ let entrypoint = args.entrypoint ?? existingConfig?.entrypoint ?? detectEntrypoint(projectRoot) ?? "";
59
+ if (!args.yes) {
60
+ const cssDirAnswer = await text({
61
+ message: "Where should the loseta CSS live?",
62
+ placeholder: DEFAULT_CSS_DIR,
63
+ defaultValue: cssDir
64
+ });
65
+ if (isCancel(cssDirAnswer)) {
66
+ cancel("Cancelled.");
67
+ return;
68
+ }
69
+ cssDir = String(cssDirAnswer);
70
+ const themeAnswer = await text({
71
+ message: "Theme",
72
+ placeholder: DEFAULT_THEME,
73
+ defaultValue: theme
74
+ });
75
+ if (isCancel(themeAnswer)) {
76
+ cancel("Cancelled.");
77
+ return;
78
+ }
79
+ theme = String(themeAnswer);
80
+ const entrypointAnswer = await text({
81
+ message: "CSS entrypoint (leave empty to skip)",
82
+ placeholder: "src/styles/global.css",
83
+ defaultValue: entrypoint
84
+ });
85
+ if (isCancel(entrypointAnswer)) {
86
+ cancel("Cancelled.");
87
+ return;
88
+ }
89
+ entrypoint = String(entrypointAnswer);
90
+ }
91
+ if (theme !== "nova") {
92
+ log.error(`Unknown theme: ${theme}. Available themes: nova.`);
93
+ process.exitCode = 1;
94
+ return;
95
+ }
96
+ const config = {
97
+ cssDir,
98
+ theme,
99
+ ...(entrypoint ? { entrypoint } : {})
100
+ };
101
+ writeConfig(projectRoot, config);
102
+ const registry = loadRegistry();
103
+ const foundation = registry.items.filter((item) => item.type === "foundation" && item.status === "stable");
104
+ const items = resolveItems(registry, foundation.map((item) => item.name));
105
+ const cssDirAbs = resolve(projectRoot, cssDir);
106
+ const manifest = { version: registry.version, items: [] };
107
+ for (const item of items) {
108
+ const files = [];
109
+ for (const file of item.files) {
110
+ const source = join(registryDir, file.path);
111
+ const target = join(cssDirAbs, file.target);
112
+ copyFile(source, target);
113
+ files.push({ path: file.target, hash: hashFile(target) });
114
+ }
115
+ upsertManifestItem(manifest, {
116
+ name: item.name,
117
+ version: registry.version,
118
+ files
119
+ });
120
+ }
121
+ writeManifest(projectRoot, manifest);
122
+ writeIndex(projectRoot, config, registry, installedNames(manifest));
123
+ if (config.entrypoint) {
124
+ const entrypointAbs = resolve(projectRoot, config.entrypoint);
125
+ if (!existsSync(entrypointAbs)) {
126
+ log.warn(`Entrypoint not found: ${config.entrypoint}. Import ${join(cssDir, "index.css")} manually.`);
127
+ }
128
+ else {
129
+ let shouldImport = Boolean(args.import);
130
+ if (!args.yes && args.import === undefined) {
131
+ const answer = await confirm({
132
+ message: `Add @import to ${config.entrypoint}?`,
133
+ initialValue: true
134
+ });
135
+ shouldImport = !isCancel(answer) && Boolean(answer);
136
+ }
137
+ if (shouldImport) {
138
+ const changed = addEntrypointImport(projectRoot, config);
139
+ if (changed) {
140
+ log.success(`Updated ${config.entrypoint}.`);
141
+ }
142
+ }
143
+ else {
144
+ log.info(`Import ${join(cssDir, "index.css")} from ${config.entrypoint} to load loseta.`);
145
+ }
146
+ }
147
+ }
148
+ else {
149
+ log.info(`Import ${join(cssDir, "index.css")} from your CSS entrypoint to load loseta.`);
150
+ }
151
+ outro(`loseta initialized in ${cssDir}`);
152
+ }
153
+ });
154
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EACL,cAAc,EAEd,kBAAkB,EAClB,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGzE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,gCAAgC;KAC9C;IACD,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,uDAAuD;YACpE,KAAK,EAAE,GAAG;SACX;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,sCAAsC;YACnD,KAAK,EAAE,GAAG;SACX;QACD,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E,WAAW,CAAC,2CAA2C,CAAC,CAAC;QAC3F,CAAC;QAED,KAAK,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const listCommand: import("citty").CommandDef<{
2
+ readonly all: {
3
+ readonly type: "boolean";
4
+ readonly description: "Include primitives and foundation items";
5
+ readonly alias: "a";
6
+ };
7
+ readonly json: {
8
+ readonly type: "boolean";
9
+ readonly description: "Print the registry as JSON";
10
+ };
11
+ }>;
@@ -0,0 +1,41 @@
1
+ import { defineCommand } from "citty";
2
+ import pc from "picocolors";
3
+ import { loadRegistry, stableComponents } from "../registry.js";
4
+ import { printItems } from "../ui.js";
5
+ export const listCommand = defineCommand({
6
+ meta: {
7
+ name: "list",
8
+ description: "List available components."
9
+ },
10
+ args: {
11
+ all: {
12
+ type: "boolean",
13
+ description: "Include primitives and foundation items",
14
+ alias: "a"
15
+ },
16
+ json: {
17
+ type: "boolean",
18
+ description: "Print the registry as JSON"
19
+ }
20
+ },
21
+ run({ args }) {
22
+ const registry = loadRegistry();
23
+ const components = stableComponents(registry);
24
+ if (args.json) {
25
+ const items = args.all ? registry.items : components;
26
+ console.log(JSON.stringify(items, null, 2));
27
+ return;
28
+ }
29
+ console.log(pc.bold("Components"));
30
+ printItems(components);
31
+ if (args.all) {
32
+ const primitives = registry.items.filter((item) => item.type === "primitive");
33
+ const foundation = registry.items.filter((item) => item.type === "foundation");
34
+ console.log(`\n${pc.bold("Primitives")}`);
35
+ printItems(primitives);
36
+ console.log(`\n${pc.bold("Foundation")}`);
37
+ printItems(foundation);
38
+ }
39
+ }
40
+ });
41
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,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I,KAAK,YAAY,CAAC,CAAC;YAC/E,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YAC1C,UAAU,CAAC,UAAU,CAAC,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YAC1C,UAAU,CAAC,UAAU,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { LosetaConfig } from "./types.js";
2
+ export declare const CONFIG_FILE = "loseta.json";
3
+ export declare const DEFAULT_CSS_DIR = "src/styles/loseta";
4
+ export declare const DEFAULT_THEME = "nova";
5
+ /** Absolute path to loseta.json. */
6
+ export declare function configPath(projectRoot: string): string;
7
+ /** Reads loseta.json when present. */
8
+ export declare function readConfig(projectRoot: string): LosetaConfig | undefined;
9
+ /** Writes loseta.json. */
10
+ export declare function writeConfig(projectRoot: string, config: LosetaConfig): void;
11
+ /** Resolves a config-relative path against the project root. */
12
+ export declare function fromProjectRoot(projectRoot: string, path: string): string;
13
+ /** Absolute path to the generated index.css. */
14
+ export declare function indexCssPath(projectRoot: string, config: LosetaConfig): string;
15
+ /** Detects a likely CSS entrypoint in the current project. */
16
+ export declare function detectEntrypoint(projectRoot: string): string | undefined;