zyzz 0.0.25 → 0.0.26

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.
Files changed (36) hide show
  1. package/dist/Vars.d.ts +18 -2
  2. package/dist/Vars.d.ts.map +1 -1
  3. package/dist/Vars.js +21 -3
  4. package/dist/Vars.js.map +1 -1
  5. package/dist/compiler/internal/Configurations.d.ts +3 -0
  6. package/dist/compiler/internal/Configurations.d.ts.map +1 -1
  7. package/dist/compiler/internal/Configurations.js +2 -1
  8. package/dist/compiler/internal/Configurations.js.map +1 -1
  9. package/dist/compiler/internal/Themes.d.ts.map +1 -1
  10. package/dist/compiler/internal/Themes.js +103 -27
  11. package/dist/compiler/internal/Themes.js.map +1 -1
  12. package/dist/internal/Configuration.d.ts.map +1 -1
  13. package/dist/internal/Configuration.js +5 -1
  14. package/dist/internal/Configuration.js.map +1 -1
  15. package/dist/internal/VariableSets.d.ts +20 -4
  16. package/dist/internal/VariableSets.d.ts.map +1 -1
  17. package/dist/internal/VariableSets.js +70 -19
  18. package/dist/internal/VariableSets.js.map +1 -1
  19. package/dist/react-native/internal/Tokens.d.ts.map +1 -1
  20. package/dist/react-native/internal/Tokens.js +3 -6
  21. package/dist/react-native/internal/Tokens.js.map +1 -1
  22. package/dist/vite/index.d.ts.map +1 -1
  23. package/dist/vite/index.js +3 -7
  24. package/dist/vite/index.js.map +1 -1
  25. package/dist/web/internal/Themes.d.ts.map +1 -1
  26. package/dist/web/internal/Themes.js +4 -2
  27. package/dist/web/internal/Themes.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/Vars.ts +104 -12
  30. package/src/compiler/internal/Configurations.ts +4 -1
  31. package/src/compiler/internal/Themes.ts +149 -45
  32. package/src/internal/Configuration.ts +5 -4
  33. package/src/internal/VariableSets.ts +104 -24
  34. package/src/react-native/internal/Tokens.ts +5 -6
  35. package/src/vite/index.ts +3 -9
  36. package/src/web/internal/Themes.ts +12 -11
@@ -32,12 +32,11 @@ export function resolve(
32
32
  (metadata.contract[Token.identity] !== undefined &&
33
33
  metadata.contract[Token.identity] ===
34
34
  value.contract[Token.identity]))
35
- const next = shared
36
- ? Object.hasOwn(metadata.values, value.path)
37
- ? metadata.values[value.path]
38
- : undefined
39
- : value.value
40
- if (next === undefined) throw new Error('Theme is missing a live token.')
35
+ // A set sharing its contract with an extension lacks the extension's added paths.
36
+ const next =
37
+ shared && Object.hasOwn(metadata.values, value.path)
38
+ ? metadata.values[value.path]!
39
+ : value.value
41
40
  active.add(value)
42
41
  const result = scalar(next)
43
42
  active.delete(value)
package/src/vite/index.ts CHANGED
@@ -907,15 +907,9 @@ export function zyzz(options: zyzz.Options = {}): Plugin {
907
907
  url += target.slice(raw.length)
908
908
  }
909
909
  } else {
910
- const pathname = file
911
- .replaceAll('\\', '/')
912
- .split('/')
913
- .map((part, index) =>
914
- index === 0 && /^[a-z]:$/i.test(part)
915
- ? part
916
- : encodeURIComponent(part),
917
- )
918
- .join('/')
910
+ // Vite reads `/@fs/` URLs with `decodeURI`, which keeps reserved escapes
911
+ // such as `%40` in scoped package paths, so those characters stay raw.
912
+ const pathname = encodeURI(file.replaceAll('\\', '/'))
919
913
 
920
914
  url = `/@fs/${pathname}${target.slice(raw.length)}`
921
915
  }
@@ -130,8 +130,8 @@ export function create() {
130
130
  const paths = [...contract.paths]
131
131
  for (const [path, name] of paths) {
132
132
  const value = data.values[path]
133
- if (value === undefined)
134
- throw new Error('Theme scope is missing a live token.')
133
+ // A set sharing its contract with an extension lacks the extension's added paths.
134
+ if (value === undefined) continue
135
135
 
136
136
  const label = path
137
137
  declarations.push({
@@ -144,15 +144,16 @@ export function create() {
144
144
 
145
145
  rules.push(...declarations)
146
146
  for (const [path, name] of contract.paths)
147
- conditional(
148
- data.values[path]!,
149
- name,
150
- `.${className}`,
151
- rules,
152
- path,
153
- [],
154
- data.contract,
155
- )
147
+ if (Object.hasOwn(data.values, path))
148
+ conditional(
149
+ data.values[path]!,
150
+ name,
151
+ `.${className}`,
152
+ rules,
153
+ path,
154
+ [],
155
+ data.contract,
156
+ )
156
157
  }
157
158
 
158
159
  for (const rule of rules) {