@wix/react-component-schema 1.6.0 → 1.8.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/src/index.test.ts CHANGED
@@ -17,4 +17,14 @@ describe('react-component-schema dist', () => {
17
17
  const content = readFileSync(resolve(__dirname, '../dist/editor-react-types.d.ts'), 'utf-8')
18
18
  expect(content).toMatchSnapshot()
19
19
  })
20
+
21
+ it('dist/theme-variables.scss matches snapshot', () => {
22
+ const content = readFileSync(resolve(__dirname, '../dist/theme-variables.scss'), 'utf-8')
23
+ expect(content).toMatchSnapshot()
24
+ })
25
+
26
+ it('dist/theme-variables.module.css matches snapshot', () => {
27
+ const content = readFileSync(resolve(__dirname, '../dist/theme-variables.module.css'), 'utf-8')
28
+ expect(content).toMatchSnapshot()
29
+ })
20
30
  })
package/src/index.ts CHANGED
@@ -14,6 +14,18 @@ export {
14
14
  OverrideType,
15
15
  } from '@wix/component-protocol/schema'
16
16
 
17
+ // TODO: replace with re-export from @wix/component-protocol/schema once
18
+ // https://github.com/wix-private/component-protocol exports DomEventType.
19
+ export const DOM_EVENT = {
20
+ POINTER: 'POINTER',
21
+ CHANGE: 'CHANGE',
22
+ FOCUS: 'FOCUS',
23
+ SUBMIT: 'SUBMIT',
24
+ KEYBOARD: 'KEYBOARD',
25
+ } as const
26
+
27
+ export type DomEvent = (typeof DOM_EVENT)[keyof typeof DOM_EVENT]
28
+
17
29
  export type {
18
30
  Behaviors,
19
31
  StyleItem,
@@ -95,3 +107,18 @@ export type EditorElement = RawEditorElement &
95
107
  RequiredFields<RawEditorElement, 'selector' | 'displayName'> & {
96
108
  presets?: Record<string, PresetItem>
97
109
  }
110
+
111
+ export {
112
+ /** General site palette: backgrounds, system states, accent, and base colors. Subset of {@link WixThemeVariableNames}. */
113
+ ColorVariableNames,
114
+ /** All box/container variables: borders, radius, shadow, padding, and colors. */
115
+ BoxVariableNames,
116
+ /** All button variables: font, layout, borders, and colors. */
117
+ ButtonVariableNames,
118
+ /** All line/divider variables: width and color. */
119
+ LineVariableNames,
120
+ /** All text variables: font shorthand and color. */
121
+ TextVariableNames,
122
+ /** Union of all Wix site theme variable names across all element types. */
123
+ WixThemeVariableNames,
124
+ } from '@wix/wix-site-theme-variables'
package/vite.config.ts CHANGED
@@ -65,10 +65,34 @@ function wrapEditorReactTypesDeclarationPlugin(): Plugin {
65
65
  }
66
66
  }
67
67
 
68
+ function generateThemeVariableStylesPlugin(): Plugin {
69
+ return {
70
+ name: 'generate-theme-variable-styles',
71
+ async closeBundle() {
72
+ const { WixThemeVariableNames } = await import('@wix/wix-site-theme-variables')
73
+ const variableNames = Object.keys(WixThemeVariableNames)
74
+
75
+ const scssContent = `${[
76
+ '// Auto-generated — do not edit. Source: WixThemeVariableNames.',
77
+ ...variableNames.map((variableName) => `$${variableName}: var(--${variableName});`),
78
+ ].join('\n')}\n`
79
+
80
+ const cssModuleContent = `${[
81
+ '/* Auto-generated — do not edit. Source: WixThemeVariableNames. */',
82
+ ...variableNames.map((variableName) => `@value ${variableName}: --${variableName};`),
83
+ ].join('\n')}\n`
84
+
85
+ writeFileSync(resolve(__dirname, 'dist/theme-variables.scss'), scssContent)
86
+ writeFileSync(resolve(__dirname, 'dist/theme-variables.module.css'), cssModuleContent)
87
+ },
88
+ }
89
+ }
90
+
68
91
  export default defineConfig({
69
92
  plugins: [
70
93
  pureEnumAnnotationsPlugin(),
71
94
  wrapEditorReactTypesDeclarationPlugin(),
95
+ generateThemeVariableStylesPlugin(),
72
96
  dts({
73
97
  include: ['src/**/*.ts'],
74
98
  exclude: ['**/*.test.ts'],
@@ -78,6 +102,7 @@ export default defineConfig({
78
102
  '@wix/ambassador-devcenter-v1-component-type-data',
79
103
  '@wix/ambassador-devcenter-components-overrides-v1-components-override',
80
104
  '@wix/editor-react-types',
105
+ '@wix/wix-site-theme-variables',
81
106
  ],
82
107
  }),
83
108
  ],