@styleframe/core 3.3.0 → 3.5.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @styleframe/core
2
2
 
3
+ ## 3.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#221](https://github.com/styleframe-dev/styleframe/pull/221) [`6d406c2`](https://github.com/styleframe-dev/styleframe/commit/6d406c289b39c666a3fb7468aa3ec08f5a6d316b) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Add `treeshake` option to remove unused variables from CSS output.
8
+
9
+ `root._usage` now tracks both `variables` and `utilities` referenced during config execution and scanner registration. The transpiler's new `treeshake: true` option filters `root.variables` and theme variables down to only those present in `_usage.variables`. The plugin enables treeshaking by default when generating global CSS.
10
+
11
+ ## 3.4.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#203](https://github.com/styleframe-dev/styleframe/pull/203) [`c314dbc`](https://github.com/styleframe-dev/styleframe/commit/c314dbc78872df38efe72d7931faf86afce5ffcc) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Track variable references in `root._usage.variables` for future transpiler optimizations
16
+ - Add `_usage: { variables: Set<string> }` to `Root` type and initialize in `createRoot()`
17
+ - Record variable names whenever `ref()` is called or `@`-prefixed syntax is resolved
18
+
3
19
  ## 3.3.0
4
20
 
5
21
  ### Minor Changes
@@ -57,7 +57,7 @@ export declare type ContainerInput = Pick<Container, "declarations" | "variables
57
57
 
58
58
  export declare function createAtRuleFunction(parent: Container, root: Root): (identifier: string, rule: string, declarationsOrCallback?: DeclarationsBlock | ContainerInput | DeclarationsCallback) => AtRule;
59
59
 
60
- export declare function createCssFunction(_parent: Container, _root: Root): (strings: TemplateStringsArray, ...interpolations: (TokenValue | Variable | AtRule)[]) => CSS_2;
60
+ export declare function createCssFunction(_parent: Container, root: Root): (strings: TemplateStringsArray, ...interpolations: (TokenValue | Variable | AtRule)[]) => CSS_2;
61
61
 
62
62
  export declare function createDeclarationsCallbackContext(parent: Container, root: Root): DeclarationsCallbackContext;
63
63
 
@@ -487,6 +487,10 @@ export declare type Root = {
487
487
  children: ContainerChild[];
488
488
  themes: Theme[];
489
489
  _registry: Map<string, Container | Root | Theme>;
490
+ _usage: {
491
+ variables: Set<string>;
492
+ utilities: Set<string>;
493
+ };
490
494
  };
491
495
 
492
496
  export declare type RuntimeModifierDeclarationsBlock = Record<string, PrimitiveTokenValue>;
@@ -556,6 +560,13 @@ export declare type TokenType = Variable["type"] | Reference["type"] | Selector[
556
560
 
557
561
  export declare type TokenValue = PrimitiveTokenValue | Reference | CSS_2 | Array<PrimitiveTokenValue | Reference | CSS_2>;
558
562
 
563
+ /**
564
+ * Records a variable name in `root._usage.variables` for any Reference
565
+ * embedded in the given value (either the value itself or any Reference
566
+ * parts inside a CSS object).
567
+ */
568
+ export declare function trackReferenceUsage(root: Root, value: TokenValue): void;
569
+
559
570
  export declare function transformUtilityKey(replacerOrOptions?: ((key: string) => string) | TransformUtilityKeyOptions): (value: TokenValue) => Record<string, TokenValue>;
560
571
 
561
572
  export declare interface TransformUtilityKeyOptions {