@contentful/experience-design-system-cli 2.12.4-dev-build-9c819d8.0 → 2.13.1-dev-build-847dead.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/dist/package.json +3 -6
- package/dist/src/analyze/command.js +2 -22
- package/dist/src/analyze/select/command.js +1 -1
- package/dist/src/analyze/select/tui/components/FieldEditor.js +4 -1
- package/dist/src/analyze/select-agent/command.js +1 -1
- package/dist/src/apply/command.d.ts +1 -5
- package/dist/src/apply/command.js +0 -43
- package/dist/src/import/tui/steps/GenerateReviewStep.d.ts +1 -1
- package/dist/src/import/tui/steps/GenerateReviewStep.js +20 -102
- package/dist/src/import/tui/steps/WizardPreviewStep.d.ts +0 -10
- package/dist/src/import/tui/steps/WizardPreviewStep.js +51 -95
- package/dist/src/import/tui/steps/preview-diff.js +0 -48
- package/dist/src/session/db.d.ts +0 -9
- package/dist/src/session/db.js +0 -46
- package/dist/src/types.d.ts +2 -76
- package/dist/src/types.js +1 -4
- package/package.json +3 -6
- package/dist/src/analyze/cycle-detection.d.ts +0 -68
- package/dist/src/analyze/cycle-detection.js +0 -285
- package/dist/src/analyze/extract/astro.d.ts +0 -5
- package/dist/src/analyze/extract/astro.js +0 -289
- package/dist/src/analyze/extract/non-authorable-filter.d.ts +0 -16
- package/dist/src/analyze/extract/non-authorable-filter.js +0 -60
- package/dist/src/analyze/extract/pipeline.d.ts +0 -6
- package/dist/src/analyze/extract/pipeline.js +0 -314
- package/dist/src/analyze/extract/react.d.ts +0 -2
- package/dist/src/analyze/extract/react.js +0 -2041
- package/dist/src/analyze/extract/scoring.d.ts +0 -12
- package/dist/src/analyze/extract/scoring.js +0 -108
- package/dist/src/analyze/extract/slot-allowed-components.d.ts +0 -8
- package/dist/src/analyze/extract/slot-allowed-components.js +0 -40
- package/dist/src/analyze/extract/slot-detection.d.ts +0 -35
- package/dist/src/analyze/extract/slot-detection.js +0 -101
- package/dist/src/analyze/extract/source-inspection.d.ts +0 -13
- package/dist/src/analyze/extract/source-inspection.js +0 -189
- package/dist/src/analyze/extract/stencil.d.ts +0 -2
- package/dist/src/analyze/extract/stencil.js +0 -296
- package/dist/src/analyze/extract/svelte.d.ts +0 -5
- package/dist/src/analyze/extract/svelte.js +0 -1626
- package/dist/src/analyze/extract/tsx-shared.d.ts +0 -8
- package/dist/src/analyze/extract/tsx-shared.js +0 -263
- package/dist/src/analyze/extract/validate.d.ts +0 -16
- package/dist/src/analyze/extract/validate.js +0 -94
- package/dist/src/analyze/extract/vue-tsx.d.ts +0 -2
- package/dist/src/analyze/extract/vue-tsx.js +0 -498
- package/dist/src/analyze/extract/vue.d.ts +0 -5
- package/dist/src/analyze/extract/vue.js +0 -653
- package/dist/src/analyze/extract/web-components.d.ts +0 -2
- package/dist/src/analyze/extract/web-components.js +0 -876
- package/dist/src/analyze/pre-classify.d.ts +0 -17
- package/dist/src/analyze/pre-classify.js +0 -211
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { RawPropDefinition, RawComponentDefinition } from '../types.js';
|
|
2
|
-
export interface PreClassification {
|
|
3
|
-
category: 'content' | 'design' | 'state' | 'exclude';
|
|
4
|
-
cdfTypeHint?: 'string' | 'enum' | 'richtext' | 'media' | 'boolean';
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Deterministic pre-classification rule engine.
|
|
8
|
-
* Applies rules in priority order and returns on the first match.
|
|
9
|
-
*/
|
|
10
|
-
export declare function preClassifyProp(prop: RawPropDefinition): PreClassification | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Applies pre-classification to all props in a component definition.
|
|
13
|
-
* - Leaves existing category values unchanged
|
|
14
|
-
* - Sets category for content/design/state matches
|
|
15
|
-
* - Does NOT set category for 'exclude' results (leaves undefined)
|
|
16
|
-
*/
|
|
17
|
-
export declare function preClassifyComponent(component: RawComponentDefinition): RawComponentDefinition;
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determines whether a type string represents a simple/primitive type
|
|
3
|
-
* (string, boolean, number, or string literal union) vs a complex type
|
|
4
|
-
* (object, function, array, generic, etc.).
|
|
5
|
-
*/
|
|
6
|
-
function isSimpleType(type) {
|
|
7
|
-
const t = type.trim();
|
|
8
|
-
if (t === 'string' || t === 'boolean' || t === 'number')
|
|
9
|
-
return true;
|
|
10
|
-
// String literal union (e.g., "'a' | 'b'")
|
|
11
|
-
if (isStringLiteralUnion(t))
|
|
12
|
-
return true;
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
function isStringLiteralUnion(type) {
|
|
16
|
-
return type.includes('|') && type.includes("'");
|
|
17
|
-
}
|
|
18
|
-
function isBooleanType(type) {
|
|
19
|
-
return type.trim() === 'boolean';
|
|
20
|
-
}
|
|
21
|
-
function isStringType(type) {
|
|
22
|
-
return type.trim() === 'string';
|
|
23
|
-
}
|
|
24
|
-
function isNumberType(type) {
|
|
25
|
-
return type.trim() === 'number';
|
|
26
|
-
}
|
|
27
|
-
function isComplexType(type) {
|
|
28
|
-
return !isSimpleType(type);
|
|
29
|
-
}
|
|
30
|
-
const DOM_PASS_THROUGH_PROPS = new Set([
|
|
31
|
-
// Bare HTML / framework styling pass-through
|
|
32
|
-
'className',
|
|
33
|
-
'class',
|
|
34
|
-
'classes',
|
|
35
|
-
'classNames',
|
|
36
|
-
'rootClassName',
|
|
37
|
-
'prefixCls',
|
|
38
|
-
'style',
|
|
39
|
-
'styles',
|
|
40
|
-
// Bare HTML attributes
|
|
41
|
-
'id',
|
|
42
|
-
'role',
|
|
43
|
-
'tabIndex',
|
|
44
|
-
'tabindex',
|
|
45
|
-
'name',
|
|
46
|
-
'htmlFor',
|
|
47
|
-
'for',
|
|
48
|
-
'slot',
|
|
49
|
-
'is',
|
|
50
|
-
'lang',
|
|
51
|
-
'dir',
|
|
52
|
-
'hidden',
|
|
53
|
-
'draggable',
|
|
54
|
-
'spellCheck',
|
|
55
|
-
'spellcheck',
|
|
56
|
-
'contentEditable',
|
|
57
|
-
'contenteditable',
|
|
58
|
-
'inputMode',
|
|
59
|
-
'inputmode',
|
|
60
|
-
'autoComplete',
|
|
61
|
-
'autocomplete',
|
|
62
|
-
'autoFocus',
|
|
63
|
-
'autofocus',
|
|
64
|
-
'translate',
|
|
65
|
-
'part',
|
|
66
|
-
'exportparts',
|
|
67
|
-
'aria',
|
|
68
|
-
// Framework theming / pass-through escape hatches — dev-facing, never marketer-configurable
|
|
69
|
-
'dt',
|
|
70
|
-
'pt',
|
|
71
|
-
'ptOptions',
|
|
72
|
-
'unstyled',
|
|
73
|
-
// Polymorphic component props — change rendered HTML/component, not marketer-visible behavior
|
|
74
|
-
'as',
|
|
75
|
-
'element',
|
|
76
|
-
'component',
|
|
77
|
-
// QA / vendor test attributes
|
|
78
|
-
'dataQa',
|
|
79
|
-
'data-qa',
|
|
80
|
-
// Vue v-model internals — framework wiring, never marketer-configurable
|
|
81
|
-
'modelValue',
|
|
82
|
-
'modelModifiers',
|
|
83
|
-
]);
|
|
84
|
-
function isDomPassThroughProp(name) {
|
|
85
|
-
if (DOM_PASS_THROUGH_PROPS.has(name))
|
|
86
|
-
return true;
|
|
87
|
-
// aria-label, aria-hidden, ariaLabel, ariaHidden — both kebab and camel forms
|
|
88
|
-
if (/^aria[-A-Z]/.test(name))
|
|
89
|
-
return true;
|
|
90
|
-
if (name.startsWith('data-'))
|
|
91
|
-
return true;
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Deterministic pre-classification rule engine.
|
|
96
|
-
* Applies rules in priority order and returns on the first match.
|
|
97
|
-
*/
|
|
98
|
-
export function preClassifyProp(prop) {
|
|
99
|
-
const { name, type } = prop;
|
|
100
|
-
// Rule 1: Event handlers
|
|
101
|
-
// name starts with `on` + uppercase, OR type contains `=> void` or `EventHandler`
|
|
102
|
-
if (/^on[A-Z]/.test(name) || type.includes('=> void') || type.includes('EventHandler')) {
|
|
103
|
-
return { category: 'exclude' };
|
|
104
|
-
}
|
|
105
|
-
// Rule 2: Refs
|
|
106
|
-
if (name === 'ref' || name === 'innerRef' || type.includes('Ref<') || type.includes('RefObject<')) {
|
|
107
|
-
return { category: 'exclude' };
|
|
108
|
-
}
|
|
109
|
-
// Rule 3: Test IDs
|
|
110
|
-
if (name === 'testId' || name === 'data-testid' || name === 'dataTestId') {
|
|
111
|
-
return { category: 'exclude' };
|
|
112
|
-
}
|
|
113
|
-
// Rule 4: Key prop
|
|
114
|
-
if (name === 'key') {
|
|
115
|
-
return { category: 'exclude' };
|
|
116
|
-
}
|
|
117
|
-
// Rule 5: Dispatch/setter
|
|
118
|
-
if (type.includes('Dispatch<') || type.includes('SetStateAction')) {
|
|
119
|
-
return { category: 'exclude' };
|
|
120
|
-
}
|
|
121
|
-
// Rule 6: DOM / a11y / framework pass-through props
|
|
122
|
-
// These are escape hatches developers use to wire components into the DOM.
|
|
123
|
-
// Marketers should never configure them in the ExO editor; exposing them
|
|
124
|
-
// generates noise that obscures the props that actually carry intent.
|
|
125
|
-
if (isDomPassThroughProp(name)) {
|
|
126
|
-
return { category: 'exclude' };
|
|
127
|
-
}
|
|
128
|
-
// Rule 7: String literal union
|
|
129
|
-
if (isStringLiteralUnion(type)) {
|
|
130
|
-
return { category: 'design', cdfTypeHint: 'enum' };
|
|
131
|
-
}
|
|
132
|
-
// Rule 8: Design name patterns (only for simple types)
|
|
133
|
-
if (!isComplexType(type)) {
|
|
134
|
-
const designNameStart = /^(variant|size|spacing|gap|color|bg|theme|align|layout|orientation|position)/i;
|
|
135
|
-
const designNameEnd = /(Color|Size|Variant|Style)$/;
|
|
136
|
-
if (designNameStart.test(name) || designNameEnd.test(name)) {
|
|
137
|
-
return { category: 'design', cdfTypeHint: 'string' };
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// Rule 10: Boolean + state names (checked before rule 9 since state names
|
|
141
|
-
// like "disabled" would otherwise match the visual toggle prefix "disable")
|
|
142
|
-
if (isBooleanType(type)) {
|
|
143
|
-
const stateNames = ['disabled', 'loading', 'expanded', 'isOpen', 'selected', 'checked', 'active', 'preview'];
|
|
144
|
-
if (stateNames.includes(name)) {
|
|
145
|
-
return { category: 'state', cdfTypeHint: 'boolean' };
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
// Rule 9: Boolean + visual toggle name
|
|
149
|
-
if (isBooleanType(type)) {
|
|
150
|
-
const visualToggle = /^(hide|show|enable|disable|vertical|horizontal|reverse|bold|italic|imageOn|with)/i;
|
|
151
|
-
if (visualToggle.test(name)) {
|
|
152
|
-
return { category: 'design', cdfTypeHint: 'boolean' };
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// Rule 11: State identifiers
|
|
156
|
-
if (name === 'componentId' || name === 'sectionKey' || name === 'locale' || name === 'variantIndex') {
|
|
157
|
-
return { category: 'state', cdfTypeHint: 'string' };
|
|
158
|
-
}
|
|
159
|
-
// Rule 12: URL patterns (string type only)
|
|
160
|
-
if (isStringType(type)) {
|
|
161
|
-
const urlNameStart = /^(href|url|link|src)/i;
|
|
162
|
-
const urlNameEnd = /(Url|Href|Link|Src)$/;
|
|
163
|
-
if (urlNameStart.test(name) || urlNameEnd.test(name)) {
|
|
164
|
-
return { category: 'content', cdfTypeHint: 'string' };
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
// Rule 13: Text patterns (string type only)
|
|
168
|
-
if (isStringType(type)) {
|
|
169
|
-
const textNameStart = /^(label|title|text|description|caption|heading|subheading|body|alt|name|placeholder|summary)/i;
|
|
170
|
-
const textNameEnd = /(Text|Label|Title|Name)$/;
|
|
171
|
-
if (textNameStart.test(name) || textNameEnd.test(name)) {
|
|
172
|
-
return { category: 'content', cdfTypeHint: 'string' };
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// Rule 14: Remaining strings
|
|
176
|
-
if (isStringType(type)) {
|
|
177
|
-
return { category: 'content', cdfTypeHint: 'string' };
|
|
178
|
-
}
|
|
179
|
-
// Rule 15: Remaining booleans
|
|
180
|
-
if (isBooleanType(type)) {
|
|
181
|
-
return { category: 'design', cdfTypeHint: 'boolean' };
|
|
182
|
-
}
|
|
183
|
-
// Rule 16: Remaining numbers
|
|
184
|
-
if (isNumberType(type)) {
|
|
185
|
-
return { category: 'design', cdfTypeHint: 'string' };
|
|
186
|
-
}
|
|
187
|
-
// Rule 17: Complex/object/function/array types — no hint
|
|
188
|
-
return undefined;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Applies pre-classification to all props in a component definition.
|
|
192
|
-
* - Leaves existing category values unchanged
|
|
193
|
-
* - Sets category for content/design/state matches
|
|
194
|
-
* - Does NOT set category for 'exclude' results (leaves undefined)
|
|
195
|
-
*/
|
|
196
|
-
export function preClassifyComponent(component) {
|
|
197
|
-
const props = component.props.map((prop) => {
|
|
198
|
-
// If category is already set, leave unchanged
|
|
199
|
-
if (prop.category) {
|
|
200
|
-
return prop;
|
|
201
|
-
}
|
|
202
|
-
const result = preClassifyProp(prop);
|
|
203
|
-
// If no result or excluded, leave unchanged
|
|
204
|
-
if (!result || result.category === 'exclude') {
|
|
205
|
-
return prop;
|
|
206
|
-
}
|
|
207
|
-
// Set category hint
|
|
208
|
-
return { ...prop, category: result.category };
|
|
209
|
-
});
|
|
210
|
-
return { ...component, props };
|
|
211
|
-
}
|