@plexui/ui 0.16.0 → 0.17.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.
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Vite plugin for Plex UI.
3
+ *
4
+ * Importing `@plexui/ui/vite` and adding `plexui()` to your `plugins`
5
+ * array eliminates every install-time gotcha documented in
6
+ * /docs/installation:
7
+ *
8
+ * 1. Pins `css.transformer = 'postcss'` so Lightning CSS doesn't
9
+ * reorder cascade layers strict-by-first-occurrence.
10
+ * 2. Pins `build.cssMinify = 'esbuild'` so Vite 8's Lightning CSS
11
+ * minifier doesn't strip the bare `@layer` declaration.
12
+ * 3. Injects `<style>@layer theme, base, components, utilities;</style>`
13
+ * into <head> as a runtime failsafe — the browser sees the layer
14
+ * order before any stylesheet rule arrives, regardless of how the
15
+ * bundler shuffles things.
16
+ *
17
+ * Usage:
18
+ *
19
+ * // vite.config.ts
20
+ * import { defineConfig } from 'vite';
21
+ * import plexui from '@plexui/ui/vite';
22
+ *
23
+ * export default defineConfig({
24
+ * plugins: [plexui()],
25
+ * });
26
+ *
27
+ * That replaces the manual `@layer …;` declaration in main.css and the
28
+ * manual `css.transformer` / `build.cssMinify` overrides. Your global
29
+ * stylesheet still needs `@import "@plexui/ui/css"` and `@source` —
30
+ * those wire the runtime tokens and Tailwind class-extraction, which a
31
+ * Vite plugin can't do for you.
32
+ */
33
+ const LAYER_DECLARATION = "<style>@layer theme, base, components, utilities;</style>";
34
+ export default function plexui(options = {}) {
35
+ const { injectLayerOrder = true } = options;
36
+ return {
37
+ name: "@plexui/ui",
38
+ enforce: "pre",
39
+ config() {
40
+ return {
41
+ css: { transformer: "postcss" },
42
+ build: { cssMinify: "esbuild" },
43
+ };
44
+ },
45
+ transformIndexHtml(html) {
46
+ if (!injectLayerOrder)
47
+ return html;
48
+ // Place the layer declaration right after <head> so it lands
49
+ // before any bundler-injected <link rel="stylesheet">.
50
+ return html.replace(/(<head[^>]*>)/i, `$1\n ${LAYER_DECLARATION}`);
51
+ },
52
+ };
53
+ }
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAkBH,MAAM,iBAAiB,GACrB,2DAA2D,CAAA;AAW7D,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,UAA+B,EAAE;IAC9D,MAAM,EAAE,gBAAgB,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IAE3C,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,KAAK;QACd,MAAM;YACJ,OAAO;gBACL,GAAG,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE;gBAC/B,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;aAChC,CAAA;QACH,CAAC;QACD,kBAAkB,CAAC,IAAI;YACrB,IAAI,CAAC,gBAAgB;gBAAE,OAAO,IAAI,CAAA;YAClC,6DAA6D;YAC7D,uDAAuD;YACvD,OAAO,IAAI,CAAC,OAAO,CACjB,gBAAgB,EAChB,WAAW,iBAAiB,EAAE,CAC/B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["/**\n * Vite plugin for Plex UI.\n *\n * Importing `@plexui/ui/vite` and adding `plexui()` to your `plugins`\n * array eliminates every install-time gotcha documented in\n * /docs/installation:\n *\n * 1. Pins `css.transformer = 'postcss'` so Lightning CSS doesn't\n * reorder cascade layers strict-by-first-occurrence.\n * 2. Pins `build.cssMinify = 'esbuild'` so Vite 8's Lightning CSS\n * minifier doesn't strip the bare `@layer` declaration.\n * 3. Injects `<style>@layer theme, base, components, utilities;</style>`\n * into <head> as a runtime failsafe — the browser sees the layer\n * order before any stylesheet rule arrives, regardless of how the\n * bundler shuffles things.\n *\n * Usage:\n *\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import plexui from '@plexui/ui/vite';\n *\n * export default defineConfig({\n * plugins: [plexui()],\n * });\n *\n * That replaces the manual `@layer …;` declaration in main.css and the\n * manual `css.transformer` / `build.cssMinify` overrides. Your global\n * stylesheet still needs `@import \"@plexui/ui/css\"` and `@source` —\n * those wire the runtime tokens and Tailwind class-extraction, which a\n * Vite plugin can't do for you.\n */\n\n// We deliberately do NOT import from \"vite\". Keeping vite out of the\n// build keeps it out of the runtime dependency graph entirely (the\n// plugin file is a few dozen lines and only describes the shape vite\n// expects). Consumers get full type-safety by declaring their config\n// `defineConfig({ plugins: [plexui()] })` — vite's own types cover the\n// `Plugin[]` slot, so our return value is just shaped to match it.\ntype ViteLikePlugin = {\n name: string\n enforce?: \"pre\" | \"post\"\n config?: () => {\n css?: { transformer?: \"postcss\" | \"lightningcss\" }\n build?: { cssMinify?: boolean | \"esbuild\" | \"lightningcss\" }\n }\n transformIndexHtml?: (html: string) => string\n}\n\nconst LAYER_DECLARATION =\n \"<style>@layer theme, base, components, utilities;</style>\"\n\nexport type PlexUIPluginOptions = {\n /**\n * Inject the cascade-layer `<style>` tag into <head> as a runtime\n * failsafe. Defaults to `true`. Disable only if you've already added\n * the equivalent `<style>` tag to your `index.html` by hand.\n */\n injectLayerOrder?: boolean\n}\n\nexport default function plexui(options: PlexUIPluginOptions = {}): ViteLikePlugin {\n const { injectLayerOrder = true } = options\n\n return {\n name: \"@plexui/ui\",\n enforce: \"pre\",\n config() {\n return {\n css: { transformer: \"postcss\" },\n build: { cssMinify: \"esbuild\" },\n }\n },\n transformIndexHtml(html) {\n if (!injectLayerOrder) return html\n // Place the layer declaration right after <head> so it lands\n // before any bundler-injected <link rel=\"stylesheet\">.\n return html.replace(\n /(<head[^>]*>)/i,\n `$1\\n ${LAYER_DECLARATION}`,\n )\n },\n }\n}\n"]}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Vite plugin for Plex UI.
3
+ *
4
+ * Importing `@plexui/ui/vite` and adding `plexui()` to your `plugins`
5
+ * array eliminates every install-time gotcha documented in
6
+ * /docs/installation:
7
+ *
8
+ * 1. Pins `css.transformer = 'postcss'` so Lightning CSS doesn't
9
+ * reorder cascade layers strict-by-first-occurrence.
10
+ * 2. Pins `build.cssMinify = 'esbuild'` so Vite 8's Lightning CSS
11
+ * minifier doesn't strip the bare `@layer` declaration.
12
+ * 3. Injects `<style>@layer theme, base, components, utilities;</style>`
13
+ * into <head> as a runtime failsafe — the browser sees the layer
14
+ * order before any stylesheet rule arrives, regardless of how the
15
+ * bundler shuffles things.
16
+ *
17
+ * Usage:
18
+ *
19
+ * // vite.config.ts
20
+ * import { defineConfig } from 'vite';
21
+ * import plexui from '@plexui/ui/vite';
22
+ *
23
+ * export default defineConfig({
24
+ * plugins: [plexui()],
25
+ * });
26
+ *
27
+ * That replaces the manual `@layer …;` declaration in main.css and the
28
+ * manual `css.transformer` / `build.cssMinify` overrides. Your global
29
+ * stylesheet still needs `@import "@plexui/ui/css"` and `@source` —
30
+ * those wire the runtime tokens and Tailwind class-extraction, which a
31
+ * Vite plugin can't do for you.
32
+ */
33
+ type ViteLikePlugin = {
34
+ name: string;
35
+ enforce?: "pre" | "post";
36
+ config?: () => {
37
+ css?: {
38
+ transformer?: "postcss" | "lightningcss";
39
+ };
40
+ build?: {
41
+ cssMinify?: boolean | "esbuild" | "lightningcss";
42
+ };
43
+ };
44
+ transformIndexHtml?: (html: string) => string;
45
+ };
46
+ export type PlexUIPluginOptions = {
47
+ /**
48
+ * Inject the cascade-layer `<style>` tag into <head> as a runtime
49
+ * failsafe. Defaults to `true`. Disable only if you've already added
50
+ * the equivalent `<style>` tag to your `index.html` by hand.
51
+ */
52
+ injectLayerOrder?: boolean;
53
+ };
54
+ export default function plexui(options?: PlexUIPluginOptions): ViteLikePlugin;
55
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/ui",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Modern design system for building high-quality applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,6 +46,10 @@
46
46
  "types": "./dist/types/hooks/*.d.ts",
47
47
  "default": "./dist/es/hooks/*.js"
48
48
  },
49
+ "./vite": {
50
+ "types": "./dist/types/vite/index.d.ts",
51
+ "default": "./dist/es/vite/index.js"
52
+ },
49
53
  "./types": {
50
54
  "types": "./dist/types/types.d.ts",
51
55
  "default": "./dist/es/types.js"
@@ -82,7 +86,13 @@
82
86
  "peerDependencies": {
83
87
  "react": "^18.0.0 || ^19.0.0",
84
88
  "react-dom": "^18.0.0 || ^19.0.0",
85
- "tailwindcss": "^4.0.10"
89
+ "tailwindcss": "^4.0.10",
90
+ "vite": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
91
+ },
92
+ "peerDependenciesMeta": {
93
+ "vite": {
94
+ "optional": true
95
+ }
86
96
  },
87
97
  "dependencies": {
88
98
  "@maskito/core": "^5.2.2",