@wix/zero-config-implementation 1.20.0 → 1.22.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.
@@ -53,4 +53,15 @@ export interface CSSParserAPI {
53
53
  * @returns DOM-matchable selector string or null
54
54
  */
55
55
  getDomSelector: (selector: string) => string | null
56
+
57
+ /**
58
+ * Determines the CSS property type for a custom property based on how it is used.
59
+ * If all usages of varName are within the same CSS property, returns that property name.
60
+ * If usages differ, returns the CSS data type inferred from the initial value
61
+ * ('color', 'length', 'number', or 'string').
62
+ * Returns undefined if the variable is never used via var().
63
+ * @param varName - The CSS variable name (with or without --)
64
+ * @param defaultValue - The initial value string of the custom property
65
+ */
66
+ getVarPropertyType: (varName: string, defaultValue: string) => string | undefined
56
67
  }
@@ -39,6 +39,7 @@ export interface ExtractedCssInfo {
39
39
 
40
40
  export interface ComponentInfoWithCss extends CoupledComponentInfo {
41
41
  css: ExtractedCssInfo[]
42
+ varUsedByTraceId: Map<string, Set<string>>
42
43
  }
43
44
 
44
45
  /** The result of processing a single component through the manifest pipeline. */
@@ -147,13 +148,15 @@ export function processComponent(
147
148
  warnings.push(...cssWarnings)
148
149
 
149
150
  // Match CSS selectors to elements
151
+ let varUsedByTraceId = new Map<string, Set<string>>()
150
152
  if (html && extractedElements.length > 0 && css.length > 0) {
151
153
  try {
152
- const enrichedElements = matchCssSelectors(html, extractedElements, css)
154
+ const matchResult = matchCssSelectors(html, extractedElements, css)
153
155
  enhancedInfo = {
154
156
  ...enhancedInfo,
155
- elements: convertElements(enrichedElements),
157
+ elements: convertElements(matchResult.elements),
156
158
  }
159
+ varUsedByTraceId = matchResult.varUsedByTraceId
157
160
  } catch (error) {
158
161
  warnings.push({
159
162
  componentName: componentInfo.componentName,
@@ -168,6 +171,7 @@ export function processComponent(
168
171
  component: {
169
172
  ...enhancedInfo,
170
173
  css,
174
+ varUsedByTraceId,
171
175
  },
172
176
  warnings,
173
177
  }