@styleframe/core 3.4.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,13 @@
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
+
3
11
  ## 3.4.0
4
12
 
5
13
  ### 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
 
@@ -489,6 +489,7 @@ export declare type Root = {
489
489
  _registry: Map<string, Container | Root | Theme>;
490
490
  _usage: {
491
491
  variables: Set<string>;
492
+ utilities: Set<string>;
492
493
  };
493
494
  };
494
495
 
@@ -559,6 +560,13 @@ export declare type TokenType = Variable["type"] | Reference["type"] | Selector[
559
560
 
560
561
  export declare type TokenValue = PrimitiveTokenValue | Reference | CSS_2 | Array<PrimitiveTokenValue | Reference | CSS_2>;
561
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
+
562
570
  export declare function transformUtilityKey(replacerOrOptions?: ((key: string) => string) | TransformUtilityKeyOptions): (value: TokenValue) => Record<string, TokenValue>;
563
571
 
564
572
  export declare interface TransformUtilityKeyOptions {