@usetheo/ui 0.6.0-next.0 → 0.6.2-next.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/CHANGELOG.md +128 -0
- package/dist/components.css +2 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/styles.css +32 -0
- package/dist/vite-plugin.js +10 -6
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +5 -2
package/dist/styles.css
CHANGED
|
@@ -27,6 +27,31 @@
|
|
|
27
27
|
border-color: hsl(var(--border));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/* Tailwind v4 preflight regression compensation —
|
|
31
|
+
* v4 intentionally dropped the `button { cursor: pointer }` rule
|
|
32
|
+
* (https://tailwindcss.com/docs/upgrade-guide#default-button-cursor)
|
|
33
|
+
* so every native <button> renders with the default arrow cursor.
|
|
34
|
+
*
|
|
35
|
+
* Library authors are expected to opt in explicitly per button. The
|
|
36
|
+
* Violet Forge `<Button>` primitive does so (see its CVA). For the
|
|
37
|
+
* dozens of native <button> elements composites render directly,
|
|
38
|
+
* we restore the v3 behavior here — scoped to *interactive* buttons:
|
|
39
|
+
*
|
|
40
|
+
* - `:not(:disabled)` skips the HTML `disabled` attribute path
|
|
41
|
+
* (browser already shows `cursor: default` for disabled, but the
|
|
42
|
+
* rule below stays explicit for clarity).
|
|
43
|
+
* - `:not([aria-disabled="true"])` skips the ARIA-disabled path
|
|
44
|
+
* (where the button stays focusable but acts as no-op).
|
|
45
|
+
*
|
|
46
|
+
* This is an EXPLICIT opt-in by the library author for consumers who
|
|
47
|
+
* imported `@usetheo/ui/styles.css` — it does NOT alter Tailwind's
|
|
48
|
+
* global preflight, only this stylesheet's @layer base.
|
|
49
|
+
*/
|
|
50
|
+
button:not(:disabled):not([aria-disabled="true"]),
|
|
51
|
+
[role="button"]:not([aria-disabled="true"]) {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
30
55
|
html {
|
|
31
56
|
font-family: var(--font-body);
|
|
32
57
|
-webkit-font-smoothing: antialiased;
|
|
@@ -103,3 +128,10 @@
|
|
|
103
128
|
scrollbar-color: hsl(var(--primary) / 0.3) transparent;
|
|
104
129
|
}
|
|
105
130
|
}
|
|
131
|
+
|
|
132
|
+
/* RFC 0008 follow-up #2 — pre-compiled utility rules. The bytes here
|
|
133
|
+
* are emitted at build time by `scripts/build-precompiled-css.ts` so
|
|
134
|
+
* consumers do not depend on Tailwind v4 `@source` scanning the
|
|
135
|
+
* library's node_modules tree (which breaks under pnpm symlinks).
|
|
136
|
+
*/
|
|
137
|
+
@import "./components.css";
|
package/dist/vite-plugin.js
CHANGED
|
@@ -3,12 +3,16 @@ var PLUGIN_NAME = "@usetheo/ui/vite-plugin";
|
|
|
3
3
|
var VIRTUAL_ID = "virtual:@usetheo/ui/library-sources.css";
|
|
4
4
|
var RESOLVED_VIRTUAL_ID = `\0${VIRTUAL_ID}`;
|
|
5
5
|
function buildLibrarySourcesCss(extra = []) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
if (extra.length === 0) {
|
|
7
|
+
return [
|
|
8
|
+
"/* @usetheo/ui/vite-plugin \u2014 `virtual:@usetheo/ui/library-sources.css` */",
|
|
9
|
+
"/* The library now ships pre-compiled utility CSS via `dist/components.css` */",
|
|
10
|
+
"/* (chained from `dist/styles.css`), so no `@source` glob is needed here. */",
|
|
11
|
+
"/* This virtual module remains resolvable for backwards compatibility. */",
|
|
12
|
+
""
|
|
13
|
+
].join("\n");
|
|
14
|
+
}
|
|
15
|
+
return `${extra.map((g) => `@source ${JSON.stringify(g)};`).join("\n")}
|
|
12
16
|
`;
|
|
13
17
|
}
|
|
14
18
|
function useTheoUIVite(opts = {}) {
|
package/dist/vite-plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vite-plugin.ts"],"names":[],"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;AAAA;AAAA;AAAA;AAAA;AAAA,IAON,MAAM,MAAA,CAAO,WAAA,EAAa,IAAA,EAAwD;AAChF,MAAA,IAAI,CAAC,aAAA,EAAe;AAClB,QAAA,OAAO,MAAA;AAAA,MACT;AAEA,MAAA,IAAI;AAKF,QAAA,MAAM,SAAA,GAAY,mBAAA;AAClB,QAAA,MAAM,MAAM,MAAM;AAAA;AAAA,UAA0B;AAAA,SAAA;AAC5C,QAAA,MAAM,UAAW,GAAA,CAA8B,OAAA;AAC/C,QAAA,IAAI,OAAO,YAAY,UAAA,EAAY;AACjC,UAAA,eAAA,EAAgB;AAChB,UAAA,OAAO,KAAA,CAAA;AAAA,QACT;AACA,QAAA,MAAM,KAAM,OAAA,EAAoC;AAChD,QAAA,MAAM,kBAAkB,KAAA,CAAM,OAAA,CAAQ,EAAE,CAAA,GAAI,EAAA,GAAK,CAAC,EAAE,CAAA;AACpD,QAAA,OAAO,EAAE,SAAS,eAAA,EAAgB;AAAA,MACpC,CAAA,CAAA,MAAQ;AACN,QAAA,eAAA,EAAgB;AAChB,QAAA,OAAO,MAAA;AAAA,MACT;AAAA,IACF,CAAA;AAAA,IAEA,UAAU,EAAA,EAAI;AACZ,MAAA,IAAI,OAAO,UAAA,EAAY;AACrB,QAAA,OAAO,mBAAA;AAAA,MACT;AACA,MAAA,OAAO,MAAA;AAAA,IACT,CAAA;AAAA,IAEA,KAAK,EAAA,EAAI;AACP,MAAA,IAAI,OAAO,mBAAA,EAAqB;AAC9B,QAAA,OAAO,uBAAuB,KAAK,CAAA;AAAA,MACrC;AACA,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,GACF;AACF","file":"vite-plugin.js","sourcesContent":["/**\n * `@usetheo/ui/vite-plugin` — auto-wire Tailwind v4 for consumers.\n *\n * Default export is a factory returning ONE Vite Plugin. Internally:\n * 1. chains `@tailwindcss/vite` v4 via the `config()` hook when resolvable\n * and `opts.tailwind !== false`,\n * 2. exposes a virtual module `virtual:@usetheo/ui/library-sources.css`\n * whose contents register `@source` directives covering the library's\n * published files, so consumer-side Tailwind scans `@usetheo/ui` JSX\n * and emits its utility classes,\n * 3. degrades gracefully via `console.warn` (never throws) when\n * `@tailwindcss/vite` is not installed — the surface stays usable in\n * CSS-only mode via the pre-built `@usetheo/ui/styles.css` subpath.\n *\n * This is the cross-repo contract TheoKit's `integrateUseTheoUI()` probes\n * for. See `docs/rfcs/0008-vite-plugin-and-preset.md`.\n */\nimport type { Plugin, UserConfig } from \"vite\";\n\nexport interface UseTheoUIPluginOptions {\n /** Disable Tailwind v4 auto-chain. Default: `true`. */\n tailwind?: boolean;\n /** Extra `@source` globs merged into the library defaults. */\n contentExtra?: string[];\n}\n\nconst PLUGIN_NAME = \"@usetheo/ui/vite-plugin\";\nconst VIRTUAL_ID = \"virtual:@usetheo/ui/library-sources.css\";\nconst RESOLVED_VIRTUAL_ID = `\\0${VIRTUAL_ID}`;\n\nfunction buildLibrarySourcesCss(extra: string[] = []): string {\n // RFC 0008 follow-up #2 (0.6.1-next.0):\n // The previous implementation emitted `@source` globs pointing at\n // `node_modules/@usetheo/ui/dist/**/*.{js,mjs,cjs}` so Tailwind v4 would\n // scan the library's published JS for utility classes. Under pnpm,\n // `node_modules/@usetheo/ui` is a symlink to a deep `.pnpm` directory\n // and Tailwind v4's tinyglobby scanner does NOT follow symlinks — the\n // glob expanded to zero matches and the consumer saw flat-rendered\n // components (no hover/focus/active variants emitted).\n //\n // The fix lives entirely on the library side: `dist/styles.css` now\n // chains `@import \"./components.css\"`, a pre-compiled CSS file built\n // by `scripts/build-precompiled-css.ts` containing the materialized\n // utility rules for every class the library uses. Consumers get every\n // variant for free with a single `@import \"@usetheo/ui/styles.css\"` —\n // no filesystem scanning, no symlink dependency.\n //\n // The virtual module below is retained for backwards compatibility\n // (TheoKit's earlier integration code may still resolve it) but it\n // now emits ONLY the optional consumer-supplied `contentExtra` globs.\n // The library-side default globs are gone — pre-compiled CSS replaces\n // them. Returning empty (`extra = []`) is safe; Tailwind v4 ignores\n // empty CSS.\n if (extra.length === 0) {\n return [\n \"/* @usetheo/ui/vite-plugin — `virtual:@usetheo/ui/library-sources.css` */\",\n \"/* The library now ships pre-compiled utility CSS via `dist/components.css` */\",\n \"/* (chained from `dist/styles.css`), so no `@source` glob is needed here. */\",\n \"/* This virtual module remains resolvable for backwards compatibility. */\",\n \"\",\n ].join(\"\\n\");\n }\n return `${extra.map((g) => `@source ${JSON.stringify(g)};`).join(\"\\n\")}\\n`;\n}\n\nexport default function useTheoUIVite(opts: UseTheoUIPluginOptions = {}): Plugin {\n const wantsTailwind = opts.tailwind !== false;\n const extra = opts.contentExtra ?? [];\n\n let warned = false;\n const warnMissingPeer = (): void => {\n if (warned) return;\n warned = true;\n // biome-ignore lint/suspicious/noConsole: TheoKit cross-repo contract requires `console.warn` (not throw) when the optional `@tailwindcss/vite` peer is missing. See RFC 0008 §3 D1.\n console.warn(\n `[${PLUGIN_NAME}] @tailwindcss/vite was not resolvable; falling back to CSS-only mode. Install \\`@tailwindcss/vite@^4\\` to get the utility-driven design tokens, or import \\`@usetheo/ui/styles.css\\` directly for the pre-built surface.`,\n );\n };\n\n return {\n name: PLUGIN_NAME,\n\n // Vite's typing for `config()` since 5.x explicitly omits `plugins` from\n // the allowed return shape to nudge authors toward `Plugin[]` factories.\n // The runtime still honors `{ plugins }` merge, and the TheoKit contract\n // requires ONE Plugin object (so we can't return `Plugin[]` here).\n // The cast keeps the public surface honest and the type-checker quiet.\n async config(_userConfig, _env): Promise<Omit<UserConfig, \"plugins\"> | undefined> {\n if (!wantsTailwind) {\n return undefined;\n }\n\n try {\n // Dynamic import keeps `@tailwindcss/vite` as an OPTIONAL peer. The\n // specifier is held in a variable so Vite's import-analysis pass\n // leaves it alone — at runtime the consumer's resolver does the\n // actual resolution. Resolution failure must not crash the build.\n const specifier = \"@tailwindcss/vite\";\n const mod = await import(/* @vite-ignore */ specifier);\n const factory = (mod as { default?: unknown }).default;\n if (typeof factory !== \"function\") {\n warnMissingPeer();\n return undefined;\n }\n const tw = (factory as () => Plugin | Plugin[])();\n const tailwindPlugins = Array.isArray(tw) ? tw : [tw];\n return { plugins: tailwindPlugins } as unknown as Omit<UserConfig, \"plugins\">;\n } catch {\n warnMissingPeer();\n return undefined;\n }\n },\n\n resolveId(id) {\n if (id === VIRTUAL_ID) {\n return RESOLVED_VIRTUAL_ID;\n }\n return undefined;\n },\n\n load(id) {\n if (id === RESOLVED_VIRTUAL_ID) {\n return buildLibrarySourcesCss(extra);\n }\n return undefined;\n },\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usetheo/ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-next.0",
|
|
4
4
|
"description": "Theo UI — framework-agnostic React component library with the Violet Forge design system. Focused on AI-agent interfaces, cloud dashboards, and developer-tooling surfaces.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"./styles.css": "./dist/styles.css",
|
|
14
14
|
"./styles-v3-legacy.css": "./dist/styles-v3-legacy.css",
|
|
15
|
+
"./components.css": "./dist/components.css",
|
|
15
16
|
"./tokens.css": "./dist/tokens.css",
|
|
16
17
|
"./tokens-v4.css": "./dist/tokens-v4.css",
|
|
17
18
|
"./preset.css": "./dist/preset.css",
|
|
@@ -487,7 +488,8 @@
|
|
|
487
488
|
"dogfood:slide-rich": "tsx scripts/dogfood-slide-rich.ts",
|
|
488
489
|
"dogfood:v4-zero-config": "tsx scripts/dogfood-v4-zero-config.ts",
|
|
489
490
|
"dogfood:v4-real-build": "bash scripts/dogfood-v4-real-build.sh",
|
|
490
|
-
"
|
|
491
|
+
"dogfood:precompiled-utilities": "tsx scripts/dogfood-precompiled-utilities.ts",
|
|
492
|
+
"quality:gates": "pnpm format:check && pnpm lint:ci && pnpm typecheck && pnpm test && pnpm build && pnpm registry:build && pnpm registry:validate && pnpm quality:structure && pnpm quality:bundle && pnpm quality:a11y && pnpm ladle:build && pnpm dogfood:whiteboard && pnpm dogfood:slide && pnpm dogfood:slide-deck && pnpm dogfood:slide-rich && pnpm dogfood:v4-zero-config && pnpm dogfood:precompiled-utilities",
|
|
491
493
|
"quality:gates:fast": "pnpm format:check && pnpm lint:ci && pnpm typecheck && pnpm registry:build && pnpm registry:validate && pnpm quality:structure"
|
|
492
494
|
},
|
|
493
495
|
"peerDependencies": {
|
|
@@ -601,6 +603,7 @@
|
|
|
601
603
|
"devDependencies": {
|
|
602
604
|
"@biomejs/biome": "^1.9.4",
|
|
603
605
|
"@ladle/react": "^4.1.2",
|
|
606
|
+
"@tailwindcss/cli": "^4.3.0",
|
|
604
607
|
"@testing-library/dom": "^10.4.0",
|
|
605
608
|
"@testing-library/jest-dom": "^6.6.3",
|
|
606
609
|
"@testing-library/react": "^16.1.0",
|