@animus-ui/vite-plugin 0.1.38 → 0.1.41

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/README.md CHANGED
@@ -23,6 +23,8 @@ export default defineConfig({
23
23
 
24
24
  The `system` option points to the file that exports your built system instance. The plugin loads this file in a subprocess to serialize the prop config and theme data for the Rust extraction pipeline.
25
25
 
26
+ TypeScript apps get the plugin's virtual modules (`virtual:animus/styles.css`, `virtual:animus/font-preloads`) typed with `/// <reference types="@animus-ui/vite-plugin/client" />` or `"types": ["@animus-ui/vite-plugin/client"]` in `tsconfig.json`.
27
+
26
28
  ## What It Does
27
29
 
28
30
  1. **Build time**: Analyzes all files importing from `@animus-ui/system`, extracts static styles into CSS with `@layer` ordering
@@ -127,6 +129,16 @@ animusExtract({
127
129
  });
128
130
  ```
129
131
 
132
+ An entry's `fetchpriority` (`'high'`, `'low'` or `'auto'`) is written on the
133
+ preloads of the faces it selects, in `index.html` and in
134
+ `virtual:animus/font-preloads`; a file several entries select carries the
135
+ strongest one given. A preload competes with the critical CSS and
136
+ JavaScript, so give `'high'` only to the face the first screen paints with:
137
+
138
+ ```ts
139
+ fontPreloads: [{ family: 'Apercu', weight: 400, fetchpriority: 'high' }],
140
+ ```
141
+
130
142
  `[]` preloads none. An entry no face matches reports
131
143
  `animus.style.font-preload-unmatched`; a malformed one, such as a weight
132
144
  range, reports `animus.style.font-preload-invalid`.
@@ -137,6 +149,38 @@ file can delay first paint by seconds on a slow link. A preloaded file that
137
149
  is not WOFF2 or WOFF, or an `asset()` file over 150 KB, reports
138
150
  `animus.style.font-face-preload-costly`.
139
151
 
152
+ ## Split stylesheets
153
+
154
+ `stylesheets: 'split'` builds the stylesheet as three files instead of one,
155
+ each a consecutive slice of the single sheet, in its order:
156
+
157
+ 1. foundation: theme variables and color modes, `@property` registrations,
158
+ and `anm-global` (resets, `@font-face`, keyframes), with any
159
+ `quarantine` sheets;
160
+ 2. components: `anm-base`, `anm-variants`, `anm-compounds`, `anm-states`;
161
+ 3. utilities: `anm-system`, `anm-custom`.
162
+
163
+ Each page links them in that order exactly where Vite places the single sheet
164
+ among the app's own CSS, as ordinary render-blocking stylesheets: app CSS
165
+ bundled with it keeps its place before or after the three files. They hold
166
+ the single sheet's rules in its order, so the cascade is unchanged; Vite
167
+ minifies each file on its own, which leaves its bytes the same apart from
168
+ the newline ending each file. Their URLs are the ones Vite gives its own
169
+ links, through `base` and `experimental.renderBuiltUrl`.
170
+ Each file is named by its content, so a browser keeps its cached copy of a
171
+ file an edit leaves alone: an edit to a component's styles changes only the
172
+ components file. The three files compress slightly worse than one (about
173
+ 0.1% more gzip on a large app).
174
+
175
+ ```ts
176
+ animusExtract({ system: './src/ds.ts', stylesheets: 'split' });
177
+ ```
178
+
179
+ A split build needs a page Vite builds from HTML that links the stylesheet,
180
+ which is where the links go: one with no page, or whose stylesheet only a lazy
181
+ chunk loads, fails. The dev server keeps one sheet. `'single'` (the default)
182
+ is one sheet the bundle imports.
183
+
140
184
  ## Third-party stylesheets
141
185
 
142
186
  A library's plain CSS outside any `@layer` beats every Animus layer. With
package/client.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ // The modules @animus-ui/vite-plugin serves to app code. Reference them with
2
+ // `/// <reference types="@animus-ui/vite-plugin/client" />`, or with
3
+ // `"types": ["@animus-ui/vite-plugin/client"]` in tsconfig.json. Free of the
4
+ // plugin's own (Node) types, so a browser tsconfig needs nothing more.
5
+
6
+ /** Animus's stylesheet: import it once, from the app's entry. */
7
+ declare module 'virtual:animus/styles.css' {}
8
+
9
+ /** Each font file this build preloads, at the URL index.html preloads it,
10
+ * with the faces that preload it. */
11
+ declare module 'virtual:animus/font-preloads' {
12
+ /** A face that preloads a file: its family, as `fontPreloads` matches
13
+ * it, and the descriptors it declares. */
14
+ interface PreloadedFontFace {
15
+ family: string;
16
+ weight?: string;
17
+ style?: string;
18
+ unicodeRange?: string;
19
+ }
20
+ /** A preloaded font file: the plugin's `FontPreload`. */
21
+ interface FontPreload {
22
+ href: string;
23
+ /** The file's MIME type, where its format names a known one. */
24
+ type?: string;
25
+ faces?: PreloadedFontFace[];
26
+ /** The `fetchpriority` the `fontPreloads` option gives it. */
27
+ fetchpriority?: 'high' | 'low' | 'auto';
28
+ }
29
+ const preloads: ReadonlyArray<FontPreload>;
30
+ export default preloads;
31
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,cAAc,GACrB,IAAI,CA+EN"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,cAAc,GACrB,IAAI,CAkFN"}
@@ -1,3 +1,4 @@
1
+ import type { StylesheetSlice } from '@animus-ui/extract/pipeline';
1
2
  /**
2
3
  * The namespace every virtual module here lives under; the `transform` guard
3
4
  * matches on this same string so a rename cannot strand it.
@@ -5,6 +6,18 @@
5
6
  export declare const VIRTUAL_PREFIX = "virtual:animus/";
6
7
  export declare const VIRTUAL_CSS_ID = "virtual:animus/styles.css";
7
8
  export declare const RESOLVED_CSS_ID = "\0virtual:animus/styles.css";
9
+ /** A slice of the stylesheet, which `stylesheets: 'split'` builds emit as
10
+ * a file of its own. */
11
+ export declare const sliceStylesheetId: (slice: StylesheetSlice) => string;
12
+ export declare const RESOLVED_SLICE_IDS: ReadonlyMap<string, StylesheetSlice>;
13
+ /**
14
+ * What the stylesheet module holds in a split build: one rule that keeps
15
+ * the stylesheet's place in Vite's CSS, where the page's links to the
16
+ * slices then go. Its own property, so no minifier merges or drops it.
17
+ */
18
+ export declare const SPLIT_STYLESHEET_MARKER = ".animus-split-stylesheet{--animus-split-stylesheet:1}";
19
+ /** The marker as a built stylesheet spells it, minified or not. */
20
+ export declare const SPLIT_STYLESHEET_MARKER_RE: RegExp;
8
21
  export declare const VIRTUAL_COMPONENTS_ID = "virtual:animus/components.js";
9
22
  export declare const RESOLVED_COMPONENTS_ID = "\0virtual:animus/components.js";
10
23
  export declare const VIRTUAL_BRIDGE_ID = "virtual:animus/hmr-bridge.js";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,8BAAgC,CAAC;AAC5D,eAAO,MAAM,eAAe,gCAAwB,CAAC;AAErD,eAAO,MAAM,qBAAqB,iCAAmC,CAAC;AACtE,eAAO,MAAM,sBAAsB,mCAA+B,CAAC;AAEnE,eAAO,MAAM,iBAAiB,iCAAmC,CAAC;AAClE,eAAO,MAAM,kBAAkB,mCAA2B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,sCAA8B,CAAC;AAE7D,eAAO,MAAM,uBAAuB,gCAAkC,CAAC;AACvE,eAAO,MAAM,wBAAwB,kCAAiC,CAAC;AAEvE;kDACkD;AAClD,eAAO,MAAM,wBAAwB,iCAA0B,CAAC;AAChE,eAAO,MAAM,yBAAyB,mCAAkC,CAAC;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,8BAAgC,CAAC;AAC5D,eAAO,MAAM,eAAe,gCAAwB,CAAC;AAErD;yBACyB;AACzB,eAAO,MAAM,iBAAiB,UAAW,eAAe,KAAG,MACnB,CAAC;AACzC,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAEnE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,0DACqB,CAAC;AAC1D,mEAAmE;AACnE,eAAO,MAAM,0BAA0B,QAC4C,CAAC;AAEpF,eAAO,MAAM,qBAAqB,iCAAmC,CAAC;AACtE,eAAO,MAAM,sBAAsB,mCAA+B,CAAC;AAEnE,eAAO,MAAM,iBAAiB,iCAAmC,CAAC;AAClE,eAAO,MAAM,kBAAkB,mCAA2B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,sCAA8B,CAAC;AAE7D,eAAO,MAAM,uBAAuB,gCAAkC,CAAC;AACvE,eAAO,MAAM,wBAAwB,kCAAiC,CAAC;AAEvE;kDACkD;AAClD,eAAO,MAAM,wBAAwB,iCAA0B,CAAC;AAChE,eAAO,MAAM,yBAAyB,mCAAkC,CAAC;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
package/dist/context.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { LightningTargets } from './css';
4
4
  import type { AnimusExtractOptions } from './index';
5
5
  import type { ExcludeMatcher, ExternalPackageOutcome, FontPreload, HostAssetClassification, HostExtensionPolicy, HostLoadExpander, ProjectManifest, SystemConfig } from '@animus-ui/extract/pipeline';
6
6
  import type { SessionOutcome, SessionPublication, WatchChanges } from '@animus-ui/extract/session';
7
- import type { Logger } from 'vite';
7
+ import type { Logger, ResolvedConfig } from 'vite';
8
8
  /** A Session outcome, and whether its publication changed the served
9
9
  * system-props module. */
10
10
  export interface ObservedOutcome {
@@ -23,9 +23,17 @@ export declare class PluginContext {
23
23
  /** Emission mode (the explicit `mode` option wins over the command); feeds
24
24
  * engine devMode and the minify default. Lifecycle stays on `isProd`. */
25
25
  emissionProd: boolean;
26
+ /** A build that links the stylesheet's slices from each page, in place of
27
+ * the one sheet the CSS module carries; the dev server keeps one sheet. */
28
+ get splitsStylesheet(): boolean;
26
29
  rootDir: string;
27
30
  logger: Logger | null;
28
31
  lcssTargets: LightningTargets;
32
+ /** Whether the stylesheet this client build served kept an authored
33
+ * `:dir()`, which Vite's own CSS minification may still lower. */
34
+ servedDirSelector: boolean;
35
+ /** Whether this client build warned that its minification lowered one. */
36
+ warnedLoweredDir: boolean;
29
37
  pathAliasesJson: string | null;
30
38
  /** Vite's export conditions, so the loader reads the files Vite serves. */
31
39
  resolveConditions: string[];
@@ -91,6 +99,7 @@ export declare class PluginContext {
91
99
  /** Coalesces a burst of invalidations into one full reload. */
92
100
  private readonly reloadWindow;
93
101
  base: string;
102
+ renderBuiltUrl: ResolvedConfig['experimental']['renderBuiltUrl'];
94
103
  /** Vite's root and `server.origin`, which a dev asset URL is served
95
104
  * under. */
96
105
  viteRoot: string;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAgBA,OAAO,EAGL,iBAAiB,EAGjB,iBAAiB,EAGlB,MAAM,4BAA4B,CAAC;AAYpC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAEV,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAEV,cAAc,EACd,kBAAkB,EAClB,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE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I,CAMpD;IAED;;;;8EAI0E;IAC1E,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUpC;IAED;;yDAEqD;IACrD;wCACoC;IACpC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYxC;IAED,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIvC;IAED;6EACyE;IACzE,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAqBtD;IAED;;uDAEmD;IACnD,OAAO,CAAC,eAAe;IAevB,2DAA2D;IAC3D,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAKtC;IAED;oCACgC;IAChC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAgBxC;IAED,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAKvE;IAED,8DAA8D;IAC9D,oBAAoB,IAAI,MAAM,EAAE,CAM/B;IAED;;;gDAG4C;IAC5C,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED;8EAC0E;IAC1E,OAAO,CAAC,uBAAuB;IA2B/B,6BAA6B,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAazD;IAED,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3C;IAED;;;;;;0DAMsD;IACtD,wBAAwB,IAAI,IAAI,CAsB/B;IAED;;;yEAGqE;IACrE,0BAA0B,IAAI,IAAI,CAcjC;IAED,aAAa,IAAI,IAAI,CA2BpB;CACF"}
@@ -1,5 +1,5 @@
1
1
  import type { PluginContext } from './context';
2
- import type { HtmlTagDescriptor } from 'vite';
2
+ import type { HtmlTagDescriptor, Rolldown } from 'vite';
3
3
  /**
4
4
  * The hrefs a finished document preloads both through Animus's tag and
5
5
  * through another, which the page wrote or a hook running after Animus's
@@ -21,4 +21,15 @@ export declare function injectHeadTags(html: string, tags: HtmlTagDescriptor[]):
21
21
  * the font preloads, then the development bridge.
22
22
  */
23
23
  export declare function buildIndexHtmlTags(ctx: PluginContext, html?: string): HtmlTagDescriptor[];
24
+ /**
25
+ * Puts a split build's slices where the single stylesheet would have been.
26
+ * The stylesheet module held only a marker rule, so it kept its place in
27
+ * Vite's CSS: the file holding the marker is cut there, and each page's
28
+ * link to it becomes the file's CSS before the marker, the slices in
29
+ * order, then its CSS after the marker, in a file of its own when CSS
30
+ * precedes the marker too. A carrier left empty is kept, unlinked, for a
31
+ * lazy chunk that names it. The build fails when no page links the
32
+ * carrier: its stylesheet loads with a lazy chunk, or no page is built.
33
+ */
34
+ export declare function placeStylesheetSlices(ctx: PluginContext, bundle: Rolldown.OutputBundle, sliceIds: readonly string[], emitAsset: (name: string, source: string) => string): void;
24
35
  //# sourceMappingURL=index-html.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-html.d.ts","sourceRoot":"","sources":["../src/index-html.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AA0C9C;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAeV;AAsED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,iBAAiB,EAAE,GACxB,MAAM,GAAG,iBAAiB,EAAE,CAU9B;AA0BD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,aAAa,EAClB,IAAI,SAAK,GACR,iBAAiB,EAAE,CAuCrB"}
1
+ {"version":3,"file":"index-html.d.ts","sourceRoot":"","sources":["../src/index-html.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AA0CxD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAeV;AAsED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,iBAAiB,EAAE,GACxB,MAAM,GAAG,iBAAiB,EAAE,CAU9B;AA2BD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,aAAa,EAClB,IAAI,SAAK,GACR,iBAAiB,EAAE,CAuCrB;AAsCD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,QAAQ,CAAC,YAAY,EAC7B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,GAClD,IAAI,CAuFN"}
package/dist/index.cjs CHANGED
@@ -204,6 +204,7 @@ function applyResolvedConfig(ctx, config) {
204
204
  ctx.log(`extension order: ${ctx.extensionPolicy.resolverVersion}`);
205
205
  ctx.logger = config.logger;
206
206
  ctx.base = config.base ?? "/";
207
+ ctx.renderBuiltUrl = config.experimental.renderBuiltUrl;
207
208
  ctx.viteRoot = config.root;
208
209
  ctx.serverOrigin = config.server.origin ?? "";
209
210
  ctx.publicDir = config.publicDir;
@@ -235,6 +236,18 @@ function applyResolvedConfig(ctx, config) {
235
236
  const VIRTUAL_PREFIX = "virtual:animus/";
236
237
  const VIRTUAL_CSS_ID = `${VIRTUAL_PREFIX}styles.css`;
237
238
  const RESOLVED_CSS_ID = `\0${VIRTUAL_CSS_ID}`;
239
+ /** A slice of the stylesheet, which `stylesheets: 'split'` builds emit as
240
+ * a file of its own. */
241
+ const sliceStylesheetId = (slice) => `${VIRTUAL_PREFIX}styles.${slice}.css`;
242
+ const RESOLVED_SLICE_IDS = new Map(_animus_ui_extract_pipeline.STYLESHEET_SLICES.map((slice) => [`\0${sliceStylesheetId(slice)}`, slice]));
243
+ /**
244
+ * What the stylesheet module holds in a split build: one rule that keeps
245
+ * the stylesheet's place in Vite's CSS, where the page's links to the
246
+ * slices then go. Its own property, so no minifier merges or drops it.
247
+ */
248
+ const SPLIT_STYLESHEET_MARKER = ".animus-split-stylesheet{--animus-split-stylesheet:1}";
249
+ /** The marker as a built stylesheet spells it, minified or not. */
250
+ const SPLIT_STYLESHEET_MARKER_RE = /\.animus-split-stylesheet\s*\{\s*--animus-split-stylesheet\s*:\s*1\s*;?\s*\}\n?/;
238
251
  const VIRTUAL_COMPONENTS_ID = `${VIRTUAL_PREFIX}components.js`;
239
252
  const RESOLVED_COMPONENTS_ID = `\0${VIRTUAL_COMPONENTS_ID}`;
240
253
  const VIRTUAL_BRIDGE_ID = `${VIRTUAL_PREFIX}hmr-bridge.js`;
@@ -349,9 +362,19 @@ var PluginContext = class {
349
362
  /** Emission mode (the explicit `mode` option wins over the command); feeds
350
363
  * engine devMode and the minify default. Lifecycle stays on `isProd`. */
351
364
  emissionProd = false;
365
+ /** A build that links the stylesheet's slices from each page, in place of
366
+ * the one sheet the CSS module carries; the dev server keeps one sheet. */
367
+ get splitsStylesheet() {
368
+ return this.isProd && this.options.stylesheets === "split";
369
+ }
352
370
  rootDir = "";
353
371
  logger = null;
354
372
  lcssTargets = {};
373
+ /** Whether the stylesheet this client build served kept an authored
374
+ * `:dir()`, which Vite's own CSS minification may still lower. */
375
+ servedDirSelector = false;
376
+ /** Whether this client build warned that its minification lowered one. */
377
+ warnedLoweredDir = false;
355
378
  pathAliasesJson = null;
356
379
  /** Vite's export conditions, so the loader reads the files Vite serves. */
357
380
  resolveConditions = [];
@@ -458,6 +481,7 @@ var PluginContext = class {
458
481
  this.devServer?.hot?.send({ type: "full-reload" });
459
482
  });
460
483
  base = "/";
484
+ renderBuiltUrl;
461
485
  /** Vite's root and `server.origin`, which a dev asset URL is served
462
486
  * under. */
463
487
  viteRoot = "";
@@ -542,6 +566,7 @@ var PluginContext = class {
542
566
  prefix: options.prefix,
543
567
  prefixContextualVars: options.prefixContextualVars,
544
568
  targets: options.targets,
569
+ keepDirSelector: options.keepDirSelector,
545
570
  minify: options.minify,
546
571
  staticCss: options.staticCss,
547
572
  layers: options.layers,
@@ -1453,13 +1478,14 @@ function injectHeadTags(html, tags) {
1453
1478
  function fontPreloadTags(ctx, html) {
1454
1479
  if (!ctx.served?.fontPreloads.length) return [];
1455
1480
  const existing = preloadedHrefs(html);
1456
- return ctx.fontPreloads.filter(({ href }) => !existing.has(href)).map(({ href, type }) => {
1481
+ return ctx.fontPreloads.filter(({ href }) => !existing.has(href)).map(({ href, type, fetchpriority }) => {
1457
1482
  const attrs = {
1458
1483
  rel: "preload",
1459
1484
  href,
1460
1485
  as: "font"
1461
1486
  };
1462
1487
  if (type !== void 0) attrs.type = type;
1488
+ if (fetchpriority !== void 0) attrs.fetchpriority = fetchpriority;
1463
1489
  attrs.crossorigin = true;
1464
1490
  attrs[ANIMUS_PRELOAD_MARKER] = true;
1465
1491
  return {
@@ -1501,6 +1527,92 @@ function buildIndexHtmlTags(ctx, html = "") {
1501
1527
  });
1502
1528
  return tags;
1503
1529
  }
1530
+ /**
1531
+ * A built file's URL in a page, as Vite writes its own links: the host's
1532
+ * `renderBuiltUrl` first, then relative to the page under a relative base,
1533
+ * else under the base.
1534
+ */
1535
+ function builtUrl(ctx, page, fileName) {
1536
+ let relative = ctx.base === "" || ctx.base === "./";
1537
+ const rendered = ctx.renderBuiltUrl?.(fileName, {
1538
+ hostId: page,
1539
+ hostType: "html",
1540
+ type: "asset",
1541
+ ssr: false
1542
+ });
1543
+ if (rendered instanceof Object) {
1544
+ if (rendered.runtime !== void 0) throw new Error(`[animus-extract] renderBuiltUrl returned { runtime } for ${fileName}, which a page's <link> cannot load`);
1545
+ if (rendered.relative !== void 0) relative = rendered.relative;
1546
+ } else if (rendered) return rendered;
1547
+ if (relative) return `${path.posix.join(path.posix.relative(page, "").slice(0, -2), "./")}${fileName}`;
1548
+ return `${decodeURI(ctx.base).replace(/\/$/, "")}/${fileName}`;
1549
+ }
1550
+ /** `tag`, a stylesheet link, linking `href` instead, with `attributes`. */
1551
+ function linkingInstead(tag, href, attributes = "") {
1552
+ return tag.replace(HREF_RE, ` href="${escapeHtml(href)}"`).replace(/\s*\/?>$/, `${attributes}>`);
1553
+ }
1554
+ /**
1555
+ * Puts a split build's slices where the single stylesheet would have been.
1556
+ * The stylesheet module held only a marker rule, so it kept its place in
1557
+ * Vite's CSS: the file holding the marker is cut there, and each page's
1558
+ * link to it becomes the file's CSS before the marker, the slices in
1559
+ * order, then its CSS after the marker, in a file of its own when CSS
1560
+ * precedes the marker too. A carrier left empty is kept, unlinked, for a
1561
+ * lazy chunk that names it. The build fails when no page links the
1562
+ * carrier: its stylesheet loads with a lazy chunk, or no page is built.
1563
+ */
1564
+ function placeStylesheetSlices(ctx, bundle, sliceIds, emitAsset) {
1565
+ const fileOf = /* @__PURE__ */ new Map();
1566
+ const pages = [];
1567
+ const carriers = [];
1568
+ for (const file of Object.values(bundle)) {
1569
+ if (file.type !== "asset") continue;
1570
+ if (file.fileName.endsWith(".html")) pages.push(file);
1571
+ if (file.fileName.endsWith(".css") && SPLIT_STYLESHEET_MARKER_RE.test(String(file.source))) carriers.push(file);
1572
+ const id = sliceIds.find((slice) => file.originalFileNames.some((name) => name.endsWith(slice)));
1573
+ if (id !== void 0) fileOf.set(id, file.fileName);
1574
+ }
1575
+ const slices = sliceIds.map((id) => {
1576
+ const fileName = fileOf.get(id);
1577
+ if (fileName === void 0) throw new Error(`[animus-extract] stylesheets: 'split' emitted ${id}, and the bundle holds no file for it, so the stylesheet would load without it.`);
1578
+ return fileName;
1579
+ });
1580
+ if (carriers.length === 0) {
1581
+ for (const fileName of slices) delete bundle[fileName];
1582
+ return;
1583
+ }
1584
+ if (carriers.length > 1) throw new Error(`[animus-extract] stylesheets: 'split' found Animus's stylesheet in ${carriers.map((file) => file.fileName).join(" and ")}, and places it once.`);
1585
+ const carrier = carriers[0];
1586
+ const text = String(carrier.source);
1587
+ const marker = SPLIT_STYLESHEET_MARKER_RE.exec(text);
1588
+ const before = text.slice(0, marker.index);
1589
+ const after = text.slice(marker.index + marker[0].length);
1590
+ const precedes = before.trim() !== "";
1591
+ const follows = after.trim() !== "";
1592
+ carrier.source = precedes ? before : after;
1593
+ const rest = precedes && follows ? emitAsset(carrier.names[0] ?? "index.css", after) : null;
1594
+ const sequence = [
1595
+ ...precedes ? [null] : [],
1596
+ ...slices,
1597
+ ...follows ? [rest] : []
1598
+ ];
1599
+ let linked = false;
1600
+ for (const page of pages) {
1601
+ const html = Buffer.from(page.source).toString("utf8");
1602
+ const carrierUrl = builtUrl(ctx, page.fileName, carrier.fileName);
1603
+ page.source = html.replace(LINK_TAG_RE, (tag, offset) => {
1604
+ const rel = attribute(tag, REL_RE)?.toLowerCase().split(/\s+/) ?? [];
1605
+ const href = attribute(tag, HREF_RE);
1606
+ if (!rel.includes("stylesheet") || href === void 0) return tag;
1607
+ if (attributeText(href) !== carrierUrl) return tag;
1608
+ linked = true;
1609
+ const lineStart = html.lastIndexOf("\n", offset - 1) + 1;
1610
+ const indent = /^[ \t]*/.exec(html.slice(lineStart))[0];
1611
+ return sequence.map((fileName) => fileName === null ? tag : linkingInstead(tag, builtUrl(ctx, page.fileName, fileName), fileName === rest ? "" : " data-animus-stylesheet")).join(`\n${indent}`);
1612
+ });
1613
+ }
1614
+ if (!linked) throw new Error(`[animus-extract] stylesheets: 'split' links the stylesheet's files where a page links ${carrier.fileName}, which holds Animus's stylesheet, and no page links it: it loads with a lazy chunk, or the build has no HTML page. Import Animus's components from the page's entry, or leave \`stylesheets\` unset for one sheet.`);
1615
+ }
1504
1616
  //#endregion
1505
1617
  //#region src/quarantine-plugin.ts
1506
1618
  /**
@@ -1538,6 +1650,7 @@ function sheetRegistryHash(ctx) {
1538
1650
  }
1539
1651
  function resolveVirtualId(ctx, id) {
1540
1652
  if (id === VIRTUAL_CSS_ID) return RESOLVED_CSS_ID;
1653
+ if (id.startsWith("virtual:animus/") && RESOLVED_SLICE_IDS.has(`\0${id}`)) return `\0${id}`;
1541
1654
  if (id === VIRTUAL_COMPONENTS_ID) return RESOLVED_COMPONENTS_ID;
1542
1655
  if (id === VIRTUAL_BRIDGE_ID) return RESOLVED_BRIDGE_ID;
1543
1656
  if (id === VIRTUAL_SYSTEM_PROPS_ID) return RESOLVED_SYSTEM_PROPS_ID;
@@ -1552,47 +1665,49 @@ function resolveVirtualId(ctx, id) {
1552
1665
  }
1553
1666
  return null;
1554
1667
  }
1555
- function loadVirtualModule(ctx, id) {
1556
- const lcssOpts = {
1668
+ function lightningOptions(ctx) {
1669
+ return {
1557
1670
  minify: ctx.options.minify ?? ctx.emissionProd,
1558
1671
  targets: ctx.lcssTargets,
1672
+ keepDirSelector: ctx.options.keepDirSelector,
1559
1673
  warnFn: (msg) => ctx.warn(msg)
1560
1674
  };
1561
- const checked = (css) => {
1562
- (0, _animus_ui_extract_pipeline.reportSurvivingAssetPlaceholders)(css, {
1563
- strict: ctx.options.strict,
1564
- warn: (message) => ctx.warn(message),
1565
- reportErrors: ctx.reportErrors(),
1566
- prefix: "[animus-extract]"
1567
- });
1568
- return css;
1569
- };
1570
- if (id === RESOLVED_CSS_ID) {
1571
- if (!ctx.isProd && ctx.storedManifest) {
1572
- const { variables, body } = (0, _animus_ui_extract_pipeline.assembleStylesheet)({
1573
- layers: ctx.options.layers,
1574
- variableCss: ctx.variableCss,
1575
- globalCss: ctx.globalCss,
1576
- split: true
1577
- });
1578
- return checked([variables, (0, _animus_ui_extract_pipeline.postProcessCss)(body, {
1579
- ...lcssOpts,
1580
- minify: false
1581
- })].filter(Boolean).join("\n"));
1582
- }
1583
- const { variables, body } = (0, _animus_ui_extract_pipeline.assembleStylesheet)({
1584
- layers: ctx.options.layers,
1585
- variableCss: ctx.variableCss,
1586
- globalCss: ctx.globalCss,
1587
- componentCss: ctx.resolvedComponentCss,
1588
- split: true
1589
- });
1590
- return checked([variables, (0, _animus_ui_extract_pipeline.postProcessCss)(body, lcssOpts)].filter(Boolean).join("\n"));
1591
- }
1675
+ }
1676
+ function checked(ctx, css) {
1677
+ (0, _animus_ui_extract_pipeline.reportSurvivingAssetPlaceholders)(css, {
1678
+ strict: ctx.options.strict,
1679
+ warn: (message) => ctx.warn(message),
1680
+ reportErrors: ctx.reportErrors(),
1681
+ prefix: "[animus-extract]"
1682
+ });
1683
+ return css;
1684
+ }
1685
+ /**
1686
+ * The stylesheet `virtual:animus/styles.css` serves: the variables, then
1687
+ * the post-processed body. In development the component layers arrive
1688
+ * through the bridge's sheet instead, unminified.
1689
+ */
1690
+ function stylesheetSource(ctx) {
1691
+ const bridged = !ctx.isProd && Boolean(ctx.storedManifest);
1692
+ const { variables, body } = (0, _animus_ui_extract_pipeline.assembleStylesheet)({
1693
+ layers: ctx.options.layers,
1694
+ variableCss: ctx.variableCss,
1695
+ globalCss: ctx.globalCss,
1696
+ componentCss: bridged ? void 0 : ctx.resolvedComponentCss,
1697
+ split: true
1698
+ });
1699
+ const lcssOpts = lightningOptions(ctx);
1700
+ if (bridged) lcssOpts.minify = false;
1701
+ const processedBody = (0, _animus_ui_extract_pipeline.postProcessCss)(body, lcssOpts);
1702
+ if (ctx.isProd && !ctx.servedDirSelector) ctx.servedDirSelector = processedBody.includes(":dir(");
1703
+ return checked(ctx, [variables, processedBody].filter(Boolean).join("\n"));
1704
+ }
1705
+ function loadVirtualModule(ctx, id) {
1706
+ if (id === RESOLVED_CSS_ID) return ctx.splitsStylesheet ? SPLIT_STYLESHEET_MARKER : stylesheetSource(ctx);
1592
1707
  if (id === RESOLVED_COMPONENTS_ID) {
1593
1708
  const strippedCss = (0, _animus_ui_extract_pipeline.stripLeadingLayerDeclaration)(ctx.resolvedComponentCss || "");
1594
- return `export default \`${checked((0, _animus_ui_extract_pipeline.postProcessCss)(strippedCss, {
1595
- ...lcssOpts,
1709
+ return `export default \`${checked(ctx, (0, _animus_ui_extract_pipeline.postProcessCss)(strippedCss, {
1710
+ ...lightningOptions(ctx),
1596
1711
  minify: false
1597
1712
  })).replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;`;
1598
1713
  }
@@ -1702,6 +1817,11 @@ async function sourceKitConfig(rootDir, systemPath, engine) {
1702
1817
  /** The URL a build's root is served at, for resolving a page's hrefs: an
1703
1818
  * absolute `base`, a root-relative one on a stand-in origin, or the root
1704
1819
  * for a relative one, which every page resolves from its own location. */
1820
+ /** Whether a hook runs for the browser's environment; a host without
1821
+ * environments builds only that one. */
1822
+ function isClient(context) {
1823
+ return (context.environment?.config.consumer ?? "client") === "client";
1824
+ }
1705
1825
  function servedBase(base) {
1706
1826
  const origin = "https://animus.invalid/";
1707
1827
  if (/^[a-z][a-z\d+.-]*:/i.test(base)) return new URL(base.replace(/\/?$/, "/"));
@@ -1726,6 +1846,14 @@ function animusExtract(options) {
1726
1846
  ...options,
1727
1847
  layers: vendor.order
1728
1848
  } : options);
1849
+ /** The stylesheet with the declared vendor sheets at its head, so they
1850
+ * arrive wherever it does, whatever imports it. */
1851
+ async function withVendorHead(context, sheet) {
1852
+ const layergate = await vendor?.plugin();
1853
+ return layergate ? await layergate.stylesheetHead.call(context, RESOLVED_CSS_ID) + sheet : sheet;
1854
+ }
1855
+ let slices = /* @__PURE__ */ new Map();
1856
+ let linkedSlices = [];
1729
1857
  return {
1730
1858
  name: "animus-extract",
1731
1859
  enforce: "pre",
@@ -1734,15 +1862,20 @@ function animusExtract(options) {
1734
1862
  const withVendor = (own) => vendorConfig ? (0, vite.mergeConfig)(own, vendorConfig) : own;
1735
1863
  const { mode } = (0, _animus_ui_extract_pipeline.resolveMode)(options.mode, () => env.command === "build" ? "production" : "development");
1736
1864
  const define = { __ANIMUS_DEV__: mode === "development" };
1865
+ const keptDir = options.keepDirSelector ? { css: { lightningcss: { exclude: (userConfig.css?.lightningcss?.exclude ?? 0) | _animus_ui_extract_pipeline.DIR_SELECTOR_FEATURE } } } : {};
1737
1866
  const root = (0, path.resolve)(userConfig.root ?? process.cwd());
1738
1867
  const kits = await sourceKitConfig(root, (0, path.resolve)(root, options.system), ctx.kitEngine());
1739
- if (!kits) return withVendor({ define });
1868
+ if (!kits) return withVendor({
1869
+ define,
1870
+ ...keptDir
1871
+ });
1740
1872
  const { roots, ...config } = kits;
1741
1873
  const watched = env.command === "serve" && userConfig.server?.watch !== null ? { server: { watch: { ignored: kitWatchNegations(roots) } } } : {};
1742
1874
  return withVendor({
1743
1875
  define,
1744
1876
  ...config,
1745
- ...watched
1877
+ ...watched,
1878
+ ...keptDir
1746
1879
  });
1747
1880
  },
1748
1881
  async configureServer(server) {
@@ -1761,6 +1894,10 @@ function animusExtract(options) {
1761
1894
  ctx.close();
1762
1895
  },
1763
1896
  async buildStart() {
1897
+ if (isClient(this)) {
1898
+ ctx.servedDirSelector = false;
1899
+ ctx.warnedLoweredDir = false;
1900
+ }
1764
1901
  await (await vendor?.plugin())?.buildStart.call(this);
1765
1902
  await ctx.builds.open(this.environment ?? ctx.builds.single);
1766
1903
  await runBuildStart(ctx, async (specifier, importer) => {
@@ -1770,6 +1907,22 @@ function animusExtract(options) {
1770
1907
  name: fileName,
1771
1908
  source
1772
1909
  }) : void 0);
1910
+ if (ctx.splitsStylesheet && isClient(this)) {
1911
+ const sheet = await withVendorHead(this, stylesheetSource(ctx));
1912
+ const cut = (0, _animus_ui_extract_pipeline.splitStylesheet)(sheet);
1913
+ slices = new Map(cut.map(({ slice, css }) => [slice, css]));
1914
+ linkedSlices = [];
1915
+ for (const { slice, css } of cut) {
1916
+ if (css === "") continue;
1917
+ const id = sliceStylesheetId(slice);
1918
+ this.emitFile({
1919
+ type: "chunk",
1920
+ id,
1921
+ name: `animus-${slice}`
1922
+ });
1923
+ linkedSlices.push(id);
1924
+ }
1925
+ }
1773
1926
  },
1774
1927
  async resolveId(id, importer, resolveOptions) {
1775
1928
  const owned = await (await vendor?.plugin())?.resolveId.call(this, id, importer, resolveOptions);
@@ -1786,11 +1939,12 @@ function animusExtract(options) {
1786
1939
  };
1787
1940
  },
1788
1941
  async load(id) {
1789
- const layergate = await vendor?.plugin();
1790
- const loaded = await layergate?.load.call(this, id);
1942
+ const loaded = await (await vendor?.plugin())?.load.call(this, id);
1791
1943
  if (loaded) return loaded;
1944
+ const slice = RESOLVED_SLICE_IDS.get(id);
1945
+ if (slice !== void 0) return slices.get(slice) ?? "";
1792
1946
  const own = loadVirtualModule(ctx, id);
1793
- if (layergate && id === RESOLVED_CSS_ID && own !== null) return await layergate.stylesheetHead.call(this, id) + own;
1947
+ if (id === RESOLVED_CSS_ID && own !== null && !ctx.splitsStylesheet) return withVendorHead(this, own);
1794
1948
  return own;
1795
1949
  },
1796
1950
  async transform(code, id) {
@@ -1800,6 +1954,18 @@ function animusExtract(options) {
1800
1954
  generateBundle: {
1801
1955
  order: "post",
1802
1956
  handler(_output, bundle) {
1957
+ if (linkedSlices.length > 0 && isClient(this)) placeStylesheetSlices(ctx, bundle, linkedSlices, (name, source) => this.getFileName(this.emitFile({
1958
+ type: "asset",
1959
+ name,
1960
+ source
1961
+ })));
1962
+ if (ctx.servedDirSelector && !ctx.warnedLoweredDir && isClient(this)) {
1963
+ const sheets = Object.values(bundle).flatMap((file) => file.type === "asset" && file.fileName.endsWith(".css") ? [file.source] : []);
1964
+ if (sheets.length > 0 && sheets.every((source) => !Buffer.from(source).toString("utf8").includes(":dir("))) {
1965
+ ctx.warnedLoweredDir = true;
1966
+ ctx.warn((0, _animus_ui_extract_pipeline.loweredDirMessage)("Vite's CSS minification", "build.cssTarget"));
1967
+ }
1968
+ }
1803
1969
  if (!ctx.served?.fontPreloads.length) return;
1804
1970
  for (const file of Object.values(bundle)) {
1805
1971
  if (file.type !== "asset" || !file.fileName.endsWith(".html")) continue;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { AnimusQuarantineOptions, ClosedDynamicImport, FontPreloadEntry, DiagnosticLevels, StaticCssConfig } from '@animus-ui/extract/pipeline';
1
+ import type { AnimusQuarantineOptions, ClosedDynamicImport, FontPreloadEntry, DiagnosticLevels, StaticCssConfig, StylesheetDelivery } from '@animus-ui/extract/pipeline';
2
2
  import type { Plugin } from 'vite';
3
3
  export { discoverFiles } from '@animus-ui/extract/pipeline';
4
- export type { AnimusQuarantineOptions } from '@animus-ui/extract/pipeline';
4
+ export type { AnimusQuarantineOptions, StylesheetDelivery, } from '@animus-ui/extract/pipeline';
5
5
  /** The entries `virtual:animus/font-preloads` exports by default: each file
6
6
  * this build preloads, the URL it is preloaded at, and its faces. */
7
7
  export type { FontPreload, PreloadedFontFace, } from '@animus-ui/extract/pipeline';
@@ -31,9 +31,19 @@ export interface AnimusExtractOptions {
31
31
  closedDynamicImports?: ClosedDynamicImport[];
32
32
  /** The font faces this app preloads, in place of each typed face's own
33
33
  * `preload` flag, so a face declared once for every product preloads only
34
- * where the app renders it: family names, or `{ family, weight?, style? }`
35
- * (see `FontPreloadEntry`). `[]` preloads none. */
34
+ * where the app renders it: family names, or `{ family, weight?, style?,
35
+ * unicodeRange?, fetchpriority? }` (see `FontPreloadEntry`). `[]`
36
+ * preloads none. */
36
37
  fontPreloads?: FontPreloadEntry[];
38
+ /** `'split'` builds the stylesheet as three consecutive files, each page
39
+ * linking them in order where it would link the one sheet `'single'`
40
+ * (the default) builds: foundation (variables, `@property`,
41
+ * `anm-global`), components (base through states), then utilities
42
+ * (`anm-system`, `anm-custom`). In order they hold that sheet's rules,
43
+ * so the cascade is unchanged, and a file an edit leaves alone keeps its
44
+ * hash. Needs a page Vite builds from HTML to link the stylesheet; the
45
+ * dev server keeps one sheet. */
46
+ stylesheets?: StylesheetDelivery;
37
47
  /**
38
48
  * Substrings, or globs when `*`/`?` present. Replaces the defaults `dist`,
39
49
  * `.test.`, `.spec.`; `node_modules`, `.next`, `.animus` always apply.
@@ -78,6 +88,12 @@ export interface AnimusExtractOptions {
78
88
  * to the project's browserslist config, then to `defaults`.
79
89
  */
80
90
  targets?: string | string[];
91
+ /** Keeps `:dir()` as written where the targets would lower it to
92
+ * `:lang()` over right-to-left language codes, which an element that sets
93
+ * only `dir` does not match. A build also excludes it from Vite's own
94
+ * Lightning CSS minification (`css.lightningcss.exclude`), which lowers
95
+ * for `build.cssTarget` across the bundle's CSS. */
96
+ keepDirSelector?: boolean;
81
97
  /** Absent minifies in production only; `false` still autoprefixes. */
82
98
  minify?: boolean;
83
99
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAEhB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,YAAY,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E;sEACsE;AACtE,YAAY,EACV,WAAW,EACX,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AA+CrC,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf;;;0DAGsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7C;;;wDAGoD;IACpD,YAAY,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;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;;OAGG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC;IACd;;;OAGG;IACH,mBAAmB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC;AAuBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAqRnE;eAEc,aAAa"}
@@ -3,5 +3,11 @@ export declare function resolveVirtualId(ctx: PluginContext, id: string): string
3
3
  id: string;
4
4
  moduleSideEffects: boolean;
5
5
  } | null;
6
+ /**
7
+ * The stylesheet `virtual:animus/styles.css` serves: the variables, then
8
+ * the post-processed body. In development the component layers arrive
9
+ * through the bridge's sheet instead, unminified.
10
+ */
11
+ export declare function stylesheetSource(ctx: PluginContext): string;
6
12
  export declare function loadVirtualModule(ctx: PluginContext, id: string): string | null;
7
13
  //# sourceMappingURL=virtual-modules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-modules.d.ts","sourceRoot":"","sources":["../src/virtual-modules.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAa/C,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAoB5D;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG,IAAI,CAkHf"}
1
+ {"version":3,"file":"virtual-modules.d.ts","sourceRoot":"","sources":["../src/virtual-modules.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAa/C,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAuB5D;AAqBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAiB3D;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG,IAAI,CAgFf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/vite-plugin",
3
- "version": "0.1.38",
3
+ "version": "0.1.41",
4
4
  "description": "Animus static CSS extraction Vite plugin",
5
5
  "keywords": [
6
6
  "animus",
@@ -20,6 +20,7 @@
20
20
  "directory": "packages/vite-plugin"
21
21
  },
22
22
  "files": [
23
+ "client.d.ts",
23
24
  "dist"
24
25
  ],
25
26
  "main": "./dist/index.cjs",
@@ -28,6 +29,9 @@
28
29
  ".": {
29
30
  "types": "./dist/index.d.ts",
30
31
  "default": "./dist/index.cjs"
32
+ },
33
+ "./client": {
34
+ "types": "./client.d.ts"
31
35
  }
32
36
  },
33
37
  "publishConfig": {
@@ -39,16 +43,16 @@
39
43
  "compile": "bun check"
40
44
  },
41
45
  "dependencies": {
42
- "@animus-ui/extract": "0.1.38",
46
+ "@animus-ui/extract": "0.1.41",
43
47
  "browserslist": "^4.28.8",
44
48
  "lightningcss": "^1.33.0"
45
49
  },
46
50
  "devDependencies": {
47
- "@animus-ui/assertions": "0.1.38",
48
- "@animus-ui/layergate": "0.1.38"
51
+ "@animus-ui/assertions": "0.1.41",
52
+ "@animus-ui/layergate": "0.1.41"
49
53
  },
50
54
  "peerDependencies": {
51
- "@animus-ui/layergate": "0.1.38",
55
+ "@animus-ui/layergate": "0.1.41",
52
56
  "vite": ">=8 <9"
53
57
  },
54
58
  "peerDependenciesMeta": {