@terrazzo/plugin-css 0.8.0 → 0.9.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,26 @@
1
1
  # @terrazzo/plugin-css
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#497](https://github.com/terrazzoapp/terrazzo/pull/497) [`9b80fd4`](https://github.com/terrazzoapp/terrazzo/commit/9b80fd4edd1198021d8e309483e8cd8551fe79dc) Thanks [@bschlenk](https://github.com/bschlenk)! - - potential 5x speedup for @terrazzo/plugin-css
8
+ - removed isTokenMatch from @terrazzo/token-tools
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [[`9b80fd4`](https://github.com/terrazzoapp/terrazzo/commit/9b80fd4edd1198021d8e309483e8cd8551fe79dc)]:
13
+ - @terrazzo/cli@0.9.0
14
+ - @terrazzo/token-tools@0.9.0
15
+
16
+ ## 0.8.1
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [[`5edf1fd`](https://github.com/terrazzoapp/terrazzo/commit/5edf1fde42cd53b5883eefcbe849dc5749cfaa8f)]:
21
+ - @terrazzo/cli@0.8.1
22
+ - @terrazzo/token-tools@0.8.1
23
+
3
24
  ## 0.8.0
4
25
 
5
26
  ### Minor Changes
package/README.md CHANGED
@@ -21,6 +21,8 @@ export default defineConfig({
21
21
  plugins: [
22
22
  css({
23
23
  filename: "tokens.css",
24
+ variableName: (id) => id.replace(/\./g, "-"),
25
+ baseSelector: ":root",
24
26
  }),
25
27
  ],
26
28
  });
package/dist/index.js CHANGED
@@ -2394,10 +2394,6 @@ function wildcardMatch(pattern, options) {
2394
2394
 
2395
2395
  //#endregion
2396
2396
  //#region ../token-tools/dist/index.js
2397
- /** Match token against globs */
2398
- function isTokenMatch(tokenID, globPatterns) {
2399
- return wildcardMatch(globPatterns)(tokenID);
2400
- }
2401
2397
  /** Give a user pertinent feedback if they override a transform incorrectly */
2402
2398
  function validateCustomTransform(value, { $type }) {
2403
2399
  if (value) {
@@ -2782,7 +2778,8 @@ function generateUtilityCSS(groups, tokens) {
2782
2778
  const groupEntries = Object.entries(groups);
2783
2779
  groupEntries.sort((a, b) => a[0].localeCompare(b[0]));
2784
2780
  for (const [group, selectors] of groupEntries) {
2785
- const matchingTokens = tokens.filter((token) => isTokenMatch(token.token.id, selectors));
2781
+ const selectorMatcher = wildcardMatch(selectors);
2782
+ const matchingTokens = tokens.filter((token) => selectorMatcher(token.token.id));
2786
2783
  if (!matchingTokens.length) {
2787
2784
  console.warn(`[@terrazzo/plugin-css] utility group "${group}" matched 0 tokens: ${JSON.stringify(selectors)}`);
2788
2785
  break;
@@ -2990,8 +2987,9 @@ function buildFormat({ getTransforms, exclude, utility, modeSelectors, baseSelec
2990
2987
  declarations: {}
2991
2988
  };
2992
2989
  rules.push(rootRule, p3Rule, rec2020Rule);
2990
+ const shouldExclude = wildcardMatch(exclude ?? []);
2993
2991
  for (const token of rootTokens) {
2994
- if (isTokenMatch(token.token.id, exclude ?? [])) continue;
2992
+ if (shouldExclude(token.token.id)) continue;
2995
2993
  const localID = token.localID ?? token.token.id;
2996
2994
  const aliasTokens = token.token.aliasedBy?.length ? getTransforms({
2997
2995
  format: FORMAT_ID,