@urbicon-ui/sv 6.48.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Felix Urban
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/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @urbicon-ui/sv
2
+
3
+ The [Svelte CLI](https://svelte.dev/docs/cli) community add-on for
4
+ [Urbicon UI](https://ui.urbicon.de) — one command from an empty directory (or an
5
+ existing SvelteKit project) to a working, styled setup.
6
+
7
+ > **Beta.** sv community add-ons are
8
+ > [experimental](https://svelte.dev/docs/cli/community) — the add-on API may
9
+ > change between sv releases. This package tracks its `sv` peer range.
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ # New project — sv asks its own questions (TypeScript, Prettier, …):
15
+ bunx sv create my-app --add @urbicon-ui
16
+
17
+ # Existing SvelteKit project:
18
+ bunx sv add @urbicon-ui
19
+ ```
20
+
21
+ Any package manager works (`npx sv …` likewise); non-interactive runs (CI,
22
+ agents) should pre-answer Tailwind's plugin prompt:
23
+ `bunx sv add tailwindcss=plugins:none @urbicon-ui`.
24
+
25
+ `@urbicon-ui` resolves to this package; the `tailwindcss` add-on is pulled in
26
+ automatically as a dependency.
27
+
28
+ ## What it does
29
+
30
+ - Adds `@urbicon-ui/blocks` (dependency) and `@urbicon-ui/design` (devDependency)
31
+ as a caret range floored at the release this add-on shipped with — all
32
+ `@urbicon-ui/*` packages version in lockstep.
33
+ - Adds `@import '@urbicon-ui/blocks/style/index.css';` to the app stylesheet,
34
+ after Tailwind. That single import carries the design tokens **and** the
35
+ `@source` directives that make Tailwind generate the components' classes — no
36
+ consumer-side `@source` needed.
37
+ - Points you at the next step:
38
+
39
+ ```bash
40
+ bunx urbicon init --hook # AGENTS.md agent context + the edit-time design gate
41
+ ```
42
+
43
+ The design-loop onboarding deliberately lives in `urbicon init`, not here: it is
44
+ idempotent, version-stamped and meant to be re-run after upgrades — things a
45
+ one-shot scaffolder cannot be.
46
+
47
+ ## Local development
48
+
49
+ ```bash
50
+ bun run build # bundles src/index.ts → dist/index.mjs (sv stays external)
51
+ cd /path/to/test-project
52
+ bunx sv add file:/path/to/packages/sv --no-git-check
53
+ ```
54
+
55
+ Part of the [Urbicon UI monorepo](https://github.com/urbicon/ui); see the
56
+ [getting-started guide](https://ui.urbicon.de/getting-started) for the manual
57
+ setup this add-on automates.
package/dist/index.mjs ADDED
@@ -0,0 +1,97 @@
1
+ // src/index.ts
2
+ import { readFileSync } from "node:fs";
3
+ import { defineAddon } from "sv";
4
+
5
+ // src/stylesheet.ts
6
+ var BLOCKS_IMPORT = "@import '@urbicon-ui/blocks/style/index.css';";
7
+ function maskComments(css) {
8
+ let out = "";
9
+ let inComment = false;
10
+ for (let i = 0;i < css.length; i++) {
11
+ if (!inComment && css.startsWith("/*", i)) {
12
+ inComment = true;
13
+ out += " ";
14
+ i++;
15
+ } else if (inComment && css.startsWith("*/", i)) {
16
+ inComment = false;
17
+ out += " ";
18
+ i++;
19
+ } else {
20
+ const ch = css[i];
21
+ out += inComment && ch !== `
22
+ ` ? " " : ch;
23
+ }
24
+ }
25
+ return out;
26
+ }
27
+ function addBlocksImport(content) {
28
+ if (content.length === 0)
29
+ return `${BLOCKS_IMPORT}
30
+ `;
31
+ const lines = content.split(`
32
+ `);
33
+ const masked = maskComments(content).split(`
34
+ `);
35
+ const line = (i) => masked[i] ?? "";
36
+ const insert = content.includes(`\r
37
+ `) ? `${BLOCKS_IMPORT}\r` : BLOCKS_IMPORT;
38
+ if (masked.some((l) => /^\s*@import\b/.test(l) && l.includes("@urbicon-ui/blocks/style/index.css"))) {
39
+ return content;
40
+ }
41
+ let at = -1;
42
+ for (const [i, l] of masked.entries()) {
43
+ if (/^\s*@import\s+['"]tailwindcss/.test(l))
44
+ at = i;
45
+ }
46
+ if (at === -1) {
47
+ for (const [i, l] of masked.entries()) {
48
+ if (/^\s*@import\b/.test(l))
49
+ at = i;
50
+ }
51
+ }
52
+ if (at !== -1) {
53
+ while (at < masked.length - 1 && !line(at).includes(";"))
54
+ at++;
55
+ lines.splice(at + 1, 0, insert);
56
+ return lines.join(`
57
+ `);
58
+ }
59
+ const first = masked.findIndex((l) => l.trim() !== "");
60
+ if (first !== -1 && /^\s*@charset\b/.test(line(first))) {
61
+ lines.splice(first + 1, 0, insert);
62
+ return lines.join(`
63
+ `);
64
+ }
65
+ return `${insert}
66
+ ${content}`;
67
+ }
68
+
69
+ // src/index.ts
70
+ var VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8")).version;
71
+ var src_default = defineAddon({
72
+ id: "urbicon-ui",
73
+ shortDescription: "Svelte 5 + Tailwind 4 components on a token-based design system",
74
+ homepage: "https://ui.urbicon.de",
75
+ options: {},
76
+ setup: ({ isKit, unsupported, dependsOn }) => {
77
+ if (!isKit)
78
+ unsupported("Requires SvelteKit");
79
+ dependsOn("tailwindcss");
80
+ },
81
+ run: ({ sv, file }) => {
82
+ sv.dependency("@urbicon-ui/blocks", `^${VERSION}`);
83
+ sv.devDependency("@urbicon-ui/design", `^${VERSION}`);
84
+ sv.file(file.stylesheet, addBlocksImport);
85
+ },
86
+ nextSteps: ({ packageManager }) => {
87
+ const runx = packageManager === "bun" ? "bunx" : "npx";
88
+ return [
89
+ `Onboard your agent and arm the design gate: ${runx} urbicon init --hook`,
90
+ "Import from the package root: import { Button } from '@urbicon-ui/blocks'",
91
+ "Getting started: https://ui.urbicon.de/getting-started"
92
+ ];
93
+ }
94
+ });
95
+ export {
96
+ src_default as default
97
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@urbicon-ui/sv",
3
+ "version": "6.48.0",
4
+ "description": "Svelte CLI (sv) community add-on for Urbicon UI — installs the blocks library and the urbicon CLI, wires the Tailwind 4 stylesheet, and hands over to the design-loop onboarding.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/urbicon/ui.git",
9
+ "directory": "packages/sv"
10
+ },
11
+ "homepage": "https://ui.urbicon.de",
12
+ "bugs": "https://github.com/urbicon/ui/issues",
13
+ "keywords": [
14
+ "sv-add",
15
+ "svelte",
16
+ "sveltekit",
17
+ "urbicon-ui",
18
+ "design-system",
19
+ "tailwindcss"
20
+ ],
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "default": "./dist/index.mjs"
25
+ }
26
+ },
27
+ "files": [
28
+ "LICENSE",
29
+ "dist",
30
+ "README.md"
31
+ ],
32
+ "sideEffects": false,
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "scripts": {
37
+ "build": "bun build ./src/index.ts --target node --format esm --external sv --outfile dist/index.mjs",
38
+ "check": "tsc --noEmit",
39
+ "test": "vitest",
40
+ "test:run": "vitest run"
41
+ },
42
+ "peerDependencies": {
43
+ "sv": "^0.17.0"
44
+ },
45
+ "devDependencies": {
46
+ "sv": "^0.17.0",
47
+ "typescript": "^6.0.3",
48
+ "@types/node": "^26.1.2",
49
+ "vitest": "^4.1.9"
50
+ },
51
+ "author": "Urbicon UI Team"
52
+ }