@wix/zero-config-implementation 1.19.0 → 1.20.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.
@@ -0,0 +1,6 @@
1
+ import { DATA } from '@wix/zero-config-schema';
2
+ /**
3
+ * Maps @wix/public-schemas type names (PascalCase) to their DATA_TYPE keys.
4
+ * Derived from the exports of @wix/public-schemas.
5
+ */
6
+ export declare const WIX_TYPE_TO_DATA_TYPE: Record<string, keyof typeof DATA.DATA_TYPE>;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "1.19.0",
7
+ "version": "1.20.0",
8
8
  "description": "Core library for extracting component manifests from JS and CSS files",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
@@ -38,6 +38,7 @@
38
38
  "typescript": "^5.0.0"
39
39
  },
40
40
  "dependencies": {
41
+ "@wix/zero-config-schema": "1.0.0",
41
42
  "lightningcss": "^1.31.1"
42
43
  },
43
44
  "devDependencies": {
@@ -75,5 +76,5 @@
75
76
  ]
76
77
  }
77
78
  },
78
- "falconPackageHash": "c023fc2f7c36ad9d9d7f5d3e24b22d292e138350cb6a48ae6964e8a0"
79
+ "falconPackageHash": "9d8e025c881d82e1e831ca0c9455a53b725239084e43035bef8a1981"
79
80
  }
@@ -12,16 +12,17 @@
12
12
  * resolved type metadata is inconsistent (kind === 'array' but no elementType).
13
13
  */
14
14
 
15
+ import type { DataItem } from '@wix/zero-config-schema'
16
+ import { DATA, MEDIA } from '@wix/zero-config-schema'
15
17
  import type { Result } from 'neverthrow'
16
18
  import { err, ok } from 'neverthrow'
17
19
  import { ParseError } from '../errors'
18
20
  import type { DOMBinding, TrackingStores } from '../information-extractors/react'
19
21
  import type { PropInfo, ResolvedType } from '../information-extractors/ts/types'
20
- import type { DataItem } from '../schema'
21
- import { DATA, MEDIA } from '../schema'
22
+ import { WIX_TYPE_TO_DATA_TYPE } from '../wix-type-to-data-type'
22
23
  import { formatDisplayName } from './utils'
23
24
 
24
- const { DATA_TYPE, WIX_TYPE_TO_DATA_TYPE } = DATA
25
+ const { DATA_TYPE } = DATA
25
26
 
26
27
  type ParseErrorInstance = InstanceType<typeof ParseError>
27
28
 
@@ -1,3 +1,12 @@
1
+ import type {
2
+ CssCustomPropertyItem,
3
+ CssPropertyItem,
4
+ DataItem,
5
+ EditorElement,
6
+ EditorReactComponent,
7
+ ElementItem,
8
+ } from '@wix/zero-config-schema'
9
+ import { ELEMENTS } from '@wix/zero-config-schema'
1
10
  import type { ComponentInfoWithCss } from '../index'
2
11
  import type { MatchedCssData } from '../information-extractors/css/types'
3
12
  import type {
@@ -7,15 +16,6 @@ import type {
7
16
  ExtractedElement,
8
17
  TrackingStores,
9
18
  } from '../information-extractors/react'
10
- import type {
11
- CssCustomPropertyItem,
12
- CssPropertyItem,
13
- DataItem,
14
- EditorElement,
15
- EditorReactComponent,
16
- ElementItem,
17
- } from '../schema'
18
- import { ELEMENTS } from '../schema'
19
19
  import { findPreferredSemanticClass } from '../utils/css-class'
20
20
  import { buildDataItem } from './data-item-builder'
21
21
  import { formatDisplayName } from './utils'
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import type { EditorReactComponent } from '@wix/zero-config-schema'
1
2
  import { Result, ResultAsync } from 'neverthrow'
2
3
  import type { ComponentType } from 'react'
3
- import type { EditorReactComponent } from './schema'
4
4
 
5
5
  import { extractAllComponentInfo, extractCssImports, extractDefaultComponentInfo } from './information-extractors/ts'
6
6
  import type { ComponentInfo } from './information-extractors/ts'
@@ -23,7 +23,7 @@ export type {
23
23
  ProcessComponentResult,
24
24
  } from './manifest-pipeline'
25
25
 
26
- export type { EditorReactComponent } from './schema'
26
+ export type { EditorReactComponent } from '@wix/zero-config-schema'
27
27
 
28
28
  // Converter
29
29
  import { toEditorReactComponent } from './converters'
@@ -1,13 +1,11 @@
1
1
  import * as fs from 'node:fs'
2
2
  import * as path from 'node:path'
3
3
  import ts from 'typescript'
4
- import { DATA } from '../../../schema'
4
+ import { WIX_TYPE_TO_DATA_TYPE } from '../../../wix-type-to-data-type'
5
5
  import type { PropInfo, ResolvedType } from '../types'
6
6
 
7
7
  const MAX_RESOLVE_DEPTH = 30
8
8
 
9
- const { WIX_TYPE_TO_DATA_TYPE } = DATA
10
-
11
9
  /**
12
10
  * Cache for package name lookups
13
11
  */
@@ -0,0 +1,33 @@
1
+ import type { DATA } from '@wix/zero-config-schema'
2
+
3
+ /**
4
+ * Maps @wix/public-schemas type names (PascalCase) to their DATA_TYPE keys.
5
+ * Derived from the exports of @wix/public-schemas.
6
+ */
7
+ export const WIX_TYPE_TO_DATA_TYPE: Record<string, keyof typeof DATA.DATA_TYPE> = {
8
+ Link: 'link',
9
+ Image: 'image',
10
+ Video: 'video',
11
+ VectorArt: 'vectorArt',
12
+ A11y: 'a11y',
13
+ Audio: 'audio',
14
+ MenuItems: 'menuItems',
15
+ Schema: 'schema',
16
+ Text: 'text',
17
+ TextEnum: 'textEnum',
18
+ NumberType: 'number',
19
+ BooleanValue: 'booleanValue',
20
+ LocalDate: 'localDate',
21
+ LocalTime: 'localTime',
22
+ LocalDateTime: 'localDateTime',
23
+ WebUrl: 'webUrl',
24
+ Email: 'email',
25
+ Phone: 'phone',
26
+ Hostname: 'hostname',
27
+ Regex: 'regex',
28
+ Guid: 'guid',
29
+ RichText: 'richText',
30
+ Container: 'container',
31
+ ArrayItems: 'arrayItems',
32
+ Direction: 'direction',
33
+ }
package/dist/schema.d.ts DELETED
@@ -1,168 +0,0 @@
1
- export declare const DATA: {
2
- DATA_TYPE: {
3
- readonly UNKNOWN_DataType: "UNKNOWN_DataType";
4
- readonly text: "text";
5
- readonly textEnum: "textEnum";
6
- readonly number: "number";
7
- readonly booleanValue: "booleanValue";
8
- readonly a11y: "a11y";
9
- readonly link: "link";
10
- readonly image: "image";
11
- readonly video: "video";
12
- readonly vectorArt: "vectorArt";
13
- readonly audio: "audio";
14
- readonly schema: "schema";
15
- readonly localDate: "localDate";
16
- readonly localTime: "localTime";
17
- readonly localDateTime: "localDateTime";
18
- readonly webUrl: "webUrl";
19
- readonly email: "email";
20
- readonly phone: "phone";
21
- readonly hostname: "hostname";
22
- readonly regex: "regex";
23
- readonly guid: "guid";
24
- readonly richText: "richText";
25
- readonly container: "container";
26
- readonly arrayItems: "arrayItems";
27
- readonly direction: "direction";
28
- readonly menuItems: "menuItems";
29
- readonly data: "data";
30
- readonly function: "function";
31
- readonly onClick: "onClick";
32
- readonly onChange: "onChange";
33
- readonly onKeyPress: "onKeyPress";
34
- readonly onKeyUp: "onKeyUp";
35
- readonly onSubmit: "onSubmit";
36
- };
37
- A11Y_ATTRIBUTES: {
38
- readonly Unknown_AriaAttributes: "Unknown_AriaAttributes";
39
- readonly tabIndex: "tabIndex";
40
- readonly ariaLevel: "ariaLevel";
41
- readonly ariaExpanded: "ariaExpanded";
42
- readonly ariaDisabled: "ariaDisabled";
43
- readonly ariaAtomic: "ariaAtomic";
44
- readonly ariaHidden: "ariaHidden";
45
- readonly ariaBusy: "ariaBusy";
46
- readonly multiline: "multiline";
47
- readonly ariaAutocomplete: "ariaAutocomplete";
48
- readonly ariaPressed: "ariaPressed";
49
- readonly ariaHaspopup: "ariaHaspopup";
50
- readonly ariaRelevant: "ariaRelevant";
51
- readonly role: "role";
52
- readonly ariaLive: "ariaLive";
53
- readonly ariaCurrent: "ariaCurrent";
54
- readonly ariaLabel: "ariaLabel";
55
- readonly ariaRoledescription: "ariaRoledescription";
56
- readonly ariaDescribedby: "ariaDescribedby";
57
- readonly ariaLabelledby: "ariaLabelledby";
58
- readonly ariaErrormessage: "ariaErrormessage";
59
- readonly ariaOwns: "ariaOwns";
60
- readonly ariaControls: "ariaControls";
61
- readonly tag: "tag";
62
- readonly ariaMultiline: "ariaMultiline";
63
- readonly ariaInvalid: "ariaInvalid";
64
- };
65
- LINK_TYPE: {
66
- readonly UNKNOWN_LinkType: "UNKNOWN_LinkType";
67
- readonly externalLink: "externalLink";
68
- readonly anchorLink: "anchorLink";
69
- readonly emailLink: "emailLink";
70
- readonly phoneLink: "phoneLink";
71
- readonly dynamicPageLink: "dynamicPageLink";
72
- readonly pageLink: "pageLink";
73
- readonly whatsAppLink: "whatsAppLink";
74
- readonly documentLink: "documentLink";
75
- readonly popupLink: "popupLink";
76
- readonly addressLink: "addressLink";
77
- readonly edgeAnchorLinks: "edgeAnchorLinks";
78
- readonly loginToWixLink: "loginToWixLink";
79
- };
80
- WIX_TYPE_TO_DATA_TYPE: Record<string, "number" | "function" | "UNKNOWN_DataType" | "text" | "textEnum" | "booleanValue" | "a11y" | "link" | "image" | "video" | "vectorArt" | "audio" | "schema" | "localDate" | "localTime" | "localDateTime" | "webUrl" | "email" | "phone" | "hostname" | "regex" | "guid" | "richText" | "container" | "arrayItems" | "direction" | "menuItems" | "data" | "onClick" | "onChange" | "onKeyPress" | "onKeyUp" | "onSubmit">;
81
- };
82
- export declare const MEDIA: {
83
- VIDEO_CATEGORY: {
84
- readonly UNKNOWN_VideoCategoryTypes: "UNKNOWN_VideoCategoryTypes";
85
- readonly VIDEO: "VIDEO";
86
- readonly VIDEO_TRANSPARENT: "VIDEO_TRANSPARENT";
87
- readonly VIDEO_OPAQUE: "VIDEO_OPAQUE";
88
- };
89
- VECTOR_ART_CATEGORY: {
90
- readonly UNKNOWN_VectorArtCategoryTypes: "UNKNOWN_VectorArtCategoryTypes";
91
- readonly SHAPE_ALL: "SHAPE_ALL";
92
- readonly SHAPE_BASIC: "SHAPE_BASIC";
93
- readonly SHAPE_ART: "SHAPE_ART";
94
- readonly ICON_SOCIAL: "ICON_SOCIAL";
95
- readonly SHAPE_DIVIDERS: "SHAPE_DIVIDERS";
96
- readonly SHAPE_LOCATION: "SHAPE_LOCATION";
97
- readonly SHAPE_DOCUMENTS: "SHAPE_DOCUMENTS";
98
- readonly SHAPE_SOCIAL: "SHAPE_SOCIAL";
99
- readonly SHAPE_ARROWS: "SHAPE_ARROWS";
100
- };
101
- IMAGE_CATEGORY: {
102
- readonly UNKNOWN_CategoryName: "UNKNOWN_CategoryName";
103
- readonly IMAGE: "IMAGE";
104
- readonly IMAGE_BACKGROUND: "IMAGE_BACKGROUND";
105
- };
106
- };
107
- export declare const ELEMENTS: {
108
- ELEMENT_TYPE: {
109
- readonly UNKNOWN_ElementType: "UNKNOWN_ElementType";
110
- readonly inlineElement: "inlineElement";
111
- readonly refElement: "refElement";
112
- };
113
- };
114
- export interface DataItem {
115
- displayName?: string;
116
- defaultValue?: unknown;
117
- dataType?: string;
118
- text?: Record<string, unknown>;
119
- number?: Record<string, unknown>;
120
- booleanValue?: unknown;
121
- textEnum?: {
122
- options: Array<{
123
- value: string;
124
- displayName?: string;
125
- }>;
126
- };
127
- arrayItems?: {
128
- dataItem?: DataItem;
129
- };
130
- data?: {
131
- items?: Record<string, DataItem>;
132
- };
133
- function?: Record<string, unknown>;
134
- link?: {
135
- linkTypes?: string[];
136
- };
137
- image?: {
138
- category?: string;
139
- };
140
- }
141
- export interface CssPropertyItem {
142
- defaultValue?: string;
143
- }
144
- export interface CssCustomPropertyItem {
145
- defaultValue?: string;
146
- }
147
- export interface EditorElement {
148
- selector?: string;
149
- displayName?: string;
150
- data?: Record<string, DataItem>;
151
- elements?: Record<string, ElementItem>;
152
- cssProperties?: Record<string, CssPropertyItem>;
153
- cssCustomProperties?: Record<string, CssCustomPropertyItem>;
154
- }
155
- export interface ElementItem {
156
- elementType?: string;
157
- inlineElement?: {
158
- selector?: string;
159
- displayName?: string;
160
- data?: Record<string, DataItem>;
161
- cssProperties?: Record<string, CssPropertyItem>;
162
- cssCustomProperties?: Record<string, CssCustomPropertyItem>;
163
- elements?: Record<string, ElementItem>;
164
- };
165
- }
166
- export interface EditorReactComponent {
167
- editorElement?: EditorElement;
168
- }
package/src/schema.ts DELETED
@@ -1,206 +0,0 @@
1
- // ─────────────────────────────────────────────────────────────────────────────
2
- // Constants
3
- // Extracted verbatim from @wix/component-protocol (chunk-U3HQJA7D.js).
4
- // ─────────────────────────────────────────────────────────────────────────────
5
-
6
- const DATA_TYPE = {
7
- UNKNOWN_DataType: 'UNKNOWN_DataType',
8
- text: 'text',
9
- textEnum: 'textEnum',
10
- number: 'number',
11
- booleanValue: 'booleanValue',
12
- a11y: 'a11y',
13
- link: 'link',
14
- image: 'image',
15
- video: 'video',
16
- vectorArt: 'vectorArt',
17
- audio: 'audio',
18
- schema: 'schema',
19
- localDate: 'localDate',
20
- localTime: 'localTime',
21
- localDateTime: 'localDateTime',
22
- webUrl: 'webUrl',
23
- email: 'email',
24
- phone: 'phone',
25
- hostname: 'hostname',
26
- regex: 'regex',
27
- guid: 'guid',
28
- richText: 'richText',
29
- container: 'container',
30
- arrayItems: 'arrayItems',
31
- direction: 'direction',
32
- menuItems: 'menuItems',
33
- data: 'data',
34
- function: 'function',
35
- onClick: 'onClick',
36
- onChange: 'onChange',
37
- onKeyPress: 'onKeyPress',
38
- onKeyUp: 'onKeyUp',
39
- onSubmit: 'onSubmit',
40
- } as const
41
-
42
- const A11Y_ATTRIBUTES = {
43
- Unknown_AriaAttributes: 'Unknown_AriaAttributes',
44
- tabIndex: 'tabIndex',
45
- ariaLevel: 'ariaLevel',
46
- ariaExpanded: 'ariaExpanded',
47
- ariaDisabled: 'ariaDisabled',
48
- ariaAtomic: 'ariaAtomic',
49
- ariaHidden: 'ariaHidden',
50
- ariaBusy: 'ariaBusy',
51
- multiline: 'multiline',
52
- ariaAutocomplete: 'ariaAutocomplete',
53
- ariaPressed: 'ariaPressed',
54
- ariaHaspopup: 'ariaHaspopup',
55
- ariaRelevant: 'ariaRelevant',
56
- role: 'role',
57
- ariaLive: 'ariaLive',
58
- ariaCurrent: 'ariaCurrent',
59
- ariaLabel: 'ariaLabel',
60
- ariaRoledescription: 'ariaRoledescription',
61
- ariaDescribedby: 'ariaDescribedby',
62
- ariaLabelledby: 'ariaLabelledby',
63
- ariaErrormessage: 'ariaErrormessage',
64
- ariaOwns: 'ariaOwns',
65
- ariaControls: 'ariaControls',
66
- tag: 'tag',
67
- ariaMultiline: 'ariaMultiline',
68
- ariaInvalid: 'ariaInvalid',
69
- } as const
70
-
71
- const LINK_TYPE = {
72
- UNKNOWN_LinkType: 'UNKNOWN_LinkType',
73
- externalLink: 'externalLink',
74
- anchorLink: 'anchorLink',
75
- emailLink: 'emailLink',
76
- phoneLink: 'phoneLink',
77
- dynamicPageLink: 'dynamicPageLink',
78
- pageLink: 'pageLink',
79
- whatsAppLink: 'whatsAppLink',
80
- documentLink: 'documentLink',
81
- popupLink: 'popupLink',
82
- addressLink: 'addressLink',
83
- edgeAnchorLinks: 'edgeAnchorLinks',
84
- loginToWixLink: 'loginToWixLink',
85
- } as const
86
-
87
- const IMAGE_CATEGORY = {
88
- UNKNOWN_CategoryName: 'UNKNOWN_CategoryName',
89
- IMAGE: 'IMAGE',
90
- IMAGE_BACKGROUND: 'IMAGE_BACKGROUND',
91
- } as const
92
-
93
- const VIDEO_CATEGORY = {
94
- UNKNOWN_VideoCategoryTypes: 'UNKNOWN_VideoCategoryTypes',
95
- VIDEO: 'VIDEO',
96
- VIDEO_TRANSPARENT: 'VIDEO_TRANSPARENT',
97
- VIDEO_OPAQUE: 'VIDEO_OPAQUE',
98
- } as const
99
-
100
- const VECTOR_ART_CATEGORY = {
101
- UNKNOWN_VectorArtCategoryTypes: 'UNKNOWN_VectorArtCategoryTypes',
102
- SHAPE_ALL: 'SHAPE_ALL',
103
- SHAPE_BASIC: 'SHAPE_BASIC',
104
- SHAPE_ART: 'SHAPE_ART',
105
- ICON_SOCIAL: 'ICON_SOCIAL',
106
- SHAPE_DIVIDERS: 'SHAPE_DIVIDERS',
107
- SHAPE_LOCATION: 'SHAPE_LOCATION',
108
- SHAPE_DOCUMENTS: 'SHAPE_DOCUMENTS',
109
- SHAPE_SOCIAL: 'SHAPE_SOCIAL',
110
- SHAPE_ARROWS: 'SHAPE_ARROWS',
111
- } as const
112
-
113
- const ELEMENT_TYPE = {
114
- UNKNOWN_ElementType: 'UNKNOWN_ElementType',
115
- inlineElement: 'inlineElement',
116
- refElement: 'refElement',
117
- } as const
118
-
119
- /**
120
- * Maps @wix/public-schemas type names (PascalCase) to their DATA_TYPE keys.
121
- * Derived from the exports of @wix/public-schemas.
122
- */
123
- const WIX_TYPE_TO_DATA_TYPE: Record<string, keyof typeof DATA_TYPE> = {
124
- Link: 'link',
125
- Image: 'image',
126
- Video: 'video',
127
- VectorArt: 'vectorArt',
128
- A11y: 'a11y',
129
- Audio: 'audio',
130
- MenuItems: 'menuItems',
131
- Schema: 'schema',
132
- Text: 'text',
133
- TextEnum: 'textEnum',
134
- NumberType: 'number',
135
- BooleanValue: 'booleanValue',
136
- LocalDate: 'localDate',
137
- LocalTime: 'localTime',
138
- LocalDateTime: 'localDateTime',
139
- WebUrl: 'webUrl',
140
- Email: 'email',
141
- Phone: 'phone',
142
- Hostname: 'hostname',
143
- Regex: 'regex',
144
- Guid: 'guid',
145
- RichText: 'richText',
146
- Container: 'container',
147
- ArrayItems: 'arrayItems',
148
- Direction: 'direction',
149
- }
150
-
151
- export const DATA = { DATA_TYPE, A11Y_ATTRIBUTES, LINK_TYPE, WIX_TYPE_TO_DATA_TYPE }
152
- export const MEDIA = { VIDEO_CATEGORY, VECTOR_ART_CATEGORY, IMAGE_CATEGORY }
153
- export const ELEMENTS = { ELEMENT_TYPE }
154
-
155
- // ─────────────────────────────────────────────────────────────────────────────
156
- // Types
157
- // Minimal stubs matching only the properties accessed in this codebase.
158
- // ─────────────────────────────────────────────────────────────────────────────
159
-
160
- export interface DataItem {
161
- displayName?: string
162
- defaultValue?: unknown
163
- dataType?: string
164
- text?: Record<string, unknown>
165
- number?: Record<string, unknown>
166
- booleanValue?: unknown
167
- textEnum?: { options: Array<{ value: string; displayName?: string }> }
168
- arrayItems?: { dataItem?: DataItem }
169
- data?: { items?: Record<string, DataItem> }
170
- function?: Record<string, unknown>
171
- link?: { linkTypes?: string[] }
172
- image?: { category?: string }
173
- }
174
-
175
- export interface CssPropertyItem {
176
- defaultValue?: string
177
- }
178
-
179
- export interface CssCustomPropertyItem {
180
- defaultValue?: string
181
- }
182
-
183
- export interface EditorElement {
184
- selector?: string
185
- displayName?: string
186
- data?: Record<string, DataItem>
187
- elements?: Record<string, ElementItem>
188
- cssProperties?: Record<string, CssPropertyItem>
189
- cssCustomProperties?: Record<string, CssCustomPropertyItem>
190
- }
191
-
192
- export interface ElementItem {
193
- elementType?: string
194
- inlineElement?: {
195
- selector?: string
196
- displayName?: string
197
- data?: Record<string, DataItem>
198
- cssProperties?: Record<string, CssPropertyItem>
199
- cssCustomProperties?: Record<string, CssCustomPropertyItem>
200
- elements?: Record<string, ElementItem>
201
- }
202
- }
203
-
204
- export interface EditorReactComponent {
205
- editorElement?: EditorElement
206
- }