@contentful/experience-design-system-extraction 2.35.1-dev-build-4f1ad8cb.0 → 2.35.1-dev-build-10b29479.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 +1 -1
- package/dist/src/extract/services/classification/classify-component-props.js +22 -3
- package/dist/src/extract/services/classification/helpers/detect-dom-props.d.ts +2 -0
- package/dist/src/extract/services/classification/helpers/detect-dom-props.js +63 -0
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +0 -1
- package/package.json +1 -1
- package/dist/src/extract/services/classification/bucket-component-props.d.ts +0 -11
- package/dist/src/extract/services/classification/bucket-component-props.js +0 -29
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-extraction",
|
|
3
|
-
"version": "2.35.1-dev-build-
|
|
3
|
+
"version": "2.35.1-dev-build-10b29479.0",
|
|
4
4
|
"description": "Component extraction engine for the Contentful Experience Design System SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isStringLiteralUnion, isBooleanType, isStringType, isNumberType, isComplexType, } from './helpers/check-prop-types.js';
|
|
2
|
+
import { isDomPassThroughProp } from './helpers/detect-dom-props.js';
|
|
2
3
|
/**
|
|
3
4
|
* Deterministic pre-classification rule engine.
|
|
4
5
|
* Applies rules in priority order and returns on the first match.
|
|
@@ -25,6 +26,16 @@ export function preClassifyProp(prop) {
|
|
|
25
26
|
if (type.includes('Dispatch<') || type.includes('SetStateAction')) {
|
|
26
27
|
return { category: 'exclude' };
|
|
27
28
|
}
|
|
29
|
+
// Rule 6: DOM / a11y / framework pass-through props
|
|
30
|
+
if (isDomPassThroughProp(name)) {
|
|
31
|
+
return { category: 'exclude' };
|
|
32
|
+
}
|
|
33
|
+
// `name` is overloaded: form controls forward it to the DOM, while icons,
|
|
34
|
+
// flags, and animations often use it as an authorable semantic selector.
|
|
35
|
+
// Exclude only when the extractor retained concrete DOM provenance.
|
|
36
|
+
if (name === 'name' && prop.domAttribute) {
|
|
37
|
+
return { category: 'exclude' };
|
|
38
|
+
}
|
|
28
39
|
// Rule 7: String literal union
|
|
29
40
|
if (isStringLiteralUnion(type)) {
|
|
30
41
|
return { category: 'design', cdfTypeHint: 'enum' };
|
|
@@ -102,13 +113,21 @@ export function preClassifyComponent(component) {
|
|
|
102
113
|
if (result?.category === 'exclude') {
|
|
103
114
|
return [];
|
|
104
115
|
}
|
|
116
|
+
// Provenance is extraction-only evidence. Do not add it to the payload
|
|
117
|
+
// presented to downstream agents.
|
|
118
|
+
const { domAttribute: _domAttribute, ...authorableProp } = prop;
|
|
105
119
|
if (prop.category) {
|
|
106
|
-
return [
|
|
120
|
+
return [authorableProp];
|
|
107
121
|
}
|
|
108
122
|
if (!result) {
|
|
109
|
-
return [
|
|
123
|
+
return [authorableProp];
|
|
110
124
|
}
|
|
111
|
-
return [
|
|
125
|
+
return [
|
|
126
|
+
{
|
|
127
|
+
...authorableProp,
|
|
128
|
+
category: result.category,
|
|
129
|
+
},
|
|
130
|
+
];
|
|
112
131
|
});
|
|
113
132
|
return { ...component, props };
|
|
114
133
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const DOM_PASS_THROUGH_PROPS = new Set([
|
|
2
|
+
// Bare HTML / framework styling pass-through
|
|
3
|
+
'className',
|
|
4
|
+
'class',
|
|
5
|
+
'classes',
|
|
6
|
+
'classNames',
|
|
7
|
+
'rootClassName',
|
|
8
|
+
'prefixCls',
|
|
9
|
+
'style',
|
|
10
|
+
'styles',
|
|
11
|
+
// Bare HTML attributes
|
|
12
|
+
'id',
|
|
13
|
+
'role',
|
|
14
|
+
'tabIndex',
|
|
15
|
+
'tabindex',
|
|
16
|
+
'htmlFor',
|
|
17
|
+
'for',
|
|
18
|
+
'slot',
|
|
19
|
+
'is',
|
|
20
|
+
'lang',
|
|
21
|
+
'dir',
|
|
22
|
+
'hidden',
|
|
23
|
+
'draggable',
|
|
24
|
+
'spellCheck',
|
|
25
|
+
'spellcheck',
|
|
26
|
+
'contentEditable',
|
|
27
|
+
'contenteditable',
|
|
28
|
+
'inputMode',
|
|
29
|
+
'inputmode',
|
|
30
|
+
'autoComplete',
|
|
31
|
+
'autocomplete',
|
|
32
|
+
'autoFocus',
|
|
33
|
+
'autofocus',
|
|
34
|
+
'translate',
|
|
35
|
+
'part',
|
|
36
|
+
'exportparts',
|
|
37
|
+
'aria',
|
|
38
|
+
// Framework theming / pass-through escape hatches — dev-facing, never marketer-configurable
|
|
39
|
+
'dt',
|
|
40
|
+
'pt',
|
|
41
|
+
'ptOptions',
|
|
42
|
+
'unstyled',
|
|
43
|
+
'sx',
|
|
44
|
+
// Polymorphic component props — change rendered HTML/component, not marketer-visible behavior
|
|
45
|
+
'as',
|
|
46
|
+
'element',
|
|
47
|
+
'component',
|
|
48
|
+
// QA / vendor test attributes
|
|
49
|
+
'dataQa',
|
|
50
|
+
'data-qa',
|
|
51
|
+
// Vue v-model internals — framework wiring, never marketer-configurable
|
|
52
|
+
'modelValue',
|
|
53
|
+
'modelModifiers',
|
|
54
|
+
]);
|
|
55
|
+
/** Returns true when the prop name is a DOM attribute, a11y attribute, or framework pass-through escape hatch. */
|
|
56
|
+
export function isDomPassThroughProp(name) {
|
|
57
|
+
if (DOM_PASS_THROUGH_PROPS.has(name))
|
|
58
|
+
return true;
|
|
59
|
+
// aria-label, aria-hidden, ariaLabel, ariaHidden — both kebab and camel forms
|
|
60
|
+
if (/^aria[-A-Z]/.test(name))
|
|
61
|
+
return true;
|
|
62
|
+
return name.startsWith('data-');
|
|
63
|
+
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ export { extractAstroComponents } from './extract/framework-adapters/astro/extra
|
|
|
13
13
|
export { extractWebComponentDefinitions } from './extract/framework-adapters/web-components/extractor.js';
|
|
14
14
|
export { extractSvelteComponents } from './extract/framework-adapters/svelte/extractor.js';
|
|
15
15
|
export { extractAllowedComponentsFromTypeText, extractAllowedComponentsFromJsdoc, } from './extract/helpers/evidence/collect-allowed-component-names.js';
|
|
16
|
-
export type { PropBucket, PropBucketAssignment } from './extract/services/classification/bucket-component-props.js';
|
|
17
|
-
export { bucketComponentProps, bucketComponentsProps, } from './extract/services/classification/bucket-component-props.js';
|
|
18
16
|
export { evaluateExtractionQuality } from './extract/services/quality/evaluate-extraction-quality.js';
|
|
19
17
|
export { hasNoAuthoringSurface } from './extract/services/quality/helpers/authorability/evaluate-authorability.js';
|
|
20
18
|
export { hasNoAuthoringSurface as isNonAuthorableComponent } from './extract/services/quality/helpers/authorability/evaluate-authorability.js';
|
package/dist/src/index.js
CHANGED
|
@@ -11,7 +11,6 @@ export { extractAstroComponents } from './extract/framework-adapters/astro/extra
|
|
|
11
11
|
export { extractWebComponentDefinitions } from './extract/framework-adapters/web-components/extractor.js';
|
|
12
12
|
export { extractSvelteComponents } from './extract/framework-adapters/svelte/extractor.js';
|
|
13
13
|
export { extractAllowedComponentsFromTypeText, extractAllowedComponentsFromJsdoc, } from './extract/helpers/evidence/collect-allowed-component-names.js';
|
|
14
|
-
export { bucketComponentProps, bucketComponentsProps, } from './extract/services/classification/bucket-component-props.js';
|
|
15
14
|
// Post-extraction filtering and scoring
|
|
16
15
|
export { evaluateExtractionQuality } from './extract/services/quality/evaluate-extraction-quality.js';
|
|
17
16
|
export { hasNoAuthoringSurface } from './extract/services/quality/helpers/authorability/evaluate-authorability.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-extraction",
|
|
3
|
-
"version": "2.35.1-dev-build-
|
|
3
|
+
"version": "2.35.1-dev-build-10b29479.0",
|
|
4
4
|
"description": "Component extraction engine for the Contentful Experience Design System SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { RawComponentDefinition } from '../../types/component.js';
|
|
2
|
-
export type PropBucket = 'custom' | 'dom-passthrough' | 'other';
|
|
3
|
-
export interface PropBucketAssignment {
|
|
4
|
-
component: string;
|
|
5
|
-
source: string;
|
|
6
|
-
customPropNames: string[];
|
|
7
|
-
domPassthroughPropNames: string[];
|
|
8
|
-
otherPropNames: string[];
|
|
9
|
-
}
|
|
10
|
-
export declare function bucketComponentProps(component: RawComponentDefinition): PropBucketAssignment;
|
|
11
|
-
export declare function bucketComponentsProps(components: readonly RawComponentDefinition[]): PropBucketAssignment[];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export function bucketComponentProps(component) {
|
|
2
|
-
const customPropNames = [];
|
|
3
|
-
const domPassthroughPropNames = [];
|
|
4
|
-
const otherPropNames = [];
|
|
5
|
-
for (const prop of component.props) {
|
|
6
|
-
if (!prop.type.trim()) {
|
|
7
|
-
otherPropNames.push(prop.name);
|
|
8
|
-
}
|
|
9
|
-
else if (prop.domAttribute === true) {
|
|
10
|
-
domPassthroughPropNames.push(prop.name);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
customPropNames.push(prop.name);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const sortNames = (names) => names.toSorted((left, right) => left.localeCompare(right));
|
|
17
|
-
return {
|
|
18
|
-
component: component.name,
|
|
19
|
-
source: component.source,
|
|
20
|
-
customPropNames: sortNames(customPropNames),
|
|
21
|
-
domPassthroughPropNames: sortNames(domPassthroughPropNames),
|
|
22
|
-
otherPropNames: sortNames(otherPropNames),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export function bucketComponentsProps(components) {
|
|
26
|
-
return components
|
|
27
|
-
.map(bucketComponentProps)
|
|
28
|
-
.toSorted((left, right) => `${left.component}\u0000${left.source}`.localeCompare(`${right.component}\u0000${right.source}`));
|
|
29
|
-
}
|