@cratis/components.conformance 0.0.0 → 4.0.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/CONFORMANCE.md +64 -0
- package/LICENSE +21 -0
- package/README.md +119 -1
- package/dist/AdapterPackageMetadata.d.ts +28 -0
- package/dist/AdapterPackageMetadata.d.ts.map +1 -0
- package/dist/AdapterPackageMetadata.js +4 -0
- package/dist/AdapterPackageMetadata.js.map +1 -0
- package/dist/ConformanceCheck.d.ts +13 -0
- package/dist/ConformanceCheck.d.ts.map +1 -0
- package/dist/ConformanceCheck.js +4 -0
- package/dist/ConformanceCheck.js.map +1 -0
- package/dist/ConformanceFamily.d.ts +12 -0
- package/dist/ConformanceFamily.d.ts.map +1 -0
- package/dist/ConformanceFamily.js +15 -0
- package/dist/ConformanceFamily.js.map +1 -0
- package/dist/ConformanceLibrary.d.ts +19 -0
- package/dist/ConformanceLibrary.d.ts.map +1 -0
- package/dist/ConformanceLibrary.js +4 -0
- package/dist/ConformanceLibrary.js.map +1 -0
- package/dist/ConformanceLimitation.d.ts +6 -0
- package/dist/ConformanceLimitation.d.ts.map +1 -0
- package/dist/ConformanceLimitation.js +4 -0
- package/dist/ConformanceLimitation.js.map +1 -0
- package/dist/ConformanceOptions.d.ts +19 -0
- package/dist/ConformanceOptions.d.ts.map +1 -0
- package/dist/ConformanceOptions.js +4 -0
- package/dist/ConformanceOptions.js.map +1 -0
- package/dist/ConformanceReport.d.ts +13 -0
- package/dist/ConformanceReport.d.ts.map +1 -0
- package/dist/ConformanceReport.js +4 -0
- package/dist/ConformanceReport.js.map +1 -0
- package/dist/ConformanceSkipRequest.d.ts +7 -0
- package/dist/ConformanceSkipRequest.d.ts.map +1 -0
- package/dist/ConformanceSkipRequest.js +4 -0
- package/dist/ConformanceSkipRequest.js.map +1 -0
- package/dist/ConformanceStatus.d.ts +7 -0
- package/dist/ConformanceStatus.d.ts.map +1 -0
- package/dist/ConformanceStatus.js +10 -0
- package/dist/ConformanceStatus.js.map +1 -0
- package/dist/ConformanceSummary.d.ts +8 -0
- package/dist/ConformanceSummary.d.ts.map +1 -0
- package/dist/ConformanceSummary.js +4 -0
- package/dist/ConformanceSummary.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/SlotProfile.d.ts +20 -0
- package/dist/internal/SlotProfile.d.ts.map +1 -0
- package/dist/internal/SlotProfile.js +4 -0
- package/dist/internal/SlotProfile.js.map +1 -0
- package/dist/internal/metadata.d.ts +9 -0
- package/dist/internal/metadata.d.ts.map +1 -0
- package/dist/internal/metadata.js +196 -0
- package/dist/internal/metadata.js.map +1 -0
- package/dist/internal/reactNormalization.d.ts +12 -0
- package/dist/internal/reactNormalization.d.ts.map +1 -0
- package/dist/internal/reactNormalization.js +45 -0
- package/dist/internal/reactNormalization.js.map +1 -0
- package/dist/internal/slotProfiles.d.ts +4 -0
- package/dist/internal/slotProfiles.d.ts.map +1 -0
- package/dist/internal/slotProfiles.js +608 -0
- package/dist/internal/slotProfiles.js.map +1 -0
- package/dist/runConformance.d.ts +13 -0
- package/dist/runConformance.d.ts.map +1 -0
- package/dist/runConformance.js +504 -0
- package/dist/runConformance.js.map +1 -0
- package/package.json +55 -4
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import adapterSchema from '@cratis/components/schemas/ui-adapter.schema.json' with { type: 'json' };
|
|
4
|
+
// SAFETY: the schema is a checked-in Core package artifact validated by renderer-contract and
|
|
5
|
+
// archive gates; the public JSON declaration stays unknown so consumers must choose their decoder.
|
|
6
|
+
const schema = adapterSchema;
|
|
7
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
8
|
+
const valueType = (value) => {
|
|
9
|
+
if (Array.isArray(value))
|
|
10
|
+
return 'array';
|
|
11
|
+
if (value === null)
|
|
12
|
+
return 'null';
|
|
13
|
+
if (typeof value === 'number' && Number.isInteger(value))
|
|
14
|
+
return 'integer';
|
|
15
|
+
return typeof value === 'object' ? 'object' : typeof value;
|
|
16
|
+
};
|
|
17
|
+
const sameJson = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
18
|
+
const resolveReference = (reference) => {
|
|
19
|
+
if (!reference.startsWith('#/')) {
|
|
20
|
+
throw new Error(`Unsupported schema reference '${reference}'.`);
|
|
21
|
+
}
|
|
22
|
+
let current = schema;
|
|
23
|
+
for (const encodedSegment of reference.slice(2).split('/')) {
|
|
24
|
+
const segment = encodedSegment.replaceAll('~1', '/').replaceAll('~0', '~');
|
|
25
|
+
if (!isRecord(current) || !Object.hasOwn(current, segment)) {
|
|
26
|
+
throw new Error(`Unresolved schema reference '${reference}'.`);
|
|
27
|
+
}
|
|
28
|
+
current = current[segment];
|
|
29
|
+
}
|
|
30
|
+
if (!isRecord(current)) {
|
|
31
|
+
throw new Error(`Schema reference '${reference}' does not resolve to a rule.`);
|
|
32
|
+
}
|
|
33
|
+
return current;
|
|
34
|
+
};
|
|
35
|
+
const validateAgainstSchema = (candidate, rule, location = '$') => {
|
|
36
|
+
if (rule.$ref)
|
|
37
|
+
return validateAgainstSchema(candidate, resolveReference(rule.$ref), location);
|
|
38
|
+
const problems = [];
|
|
39
|
+
const add = (message) => problems.push(`${location}: ${message}`);
|
|
40
|
+
if (rule.type && valueType(candidate) !== rule.type) {
|
|
41
|
+
add(`expected ${rule.type}, got ${valueType(candidate)}`);
|
|
42
|
+
return problems;
|
|
43
|
+
}
|
|
44
|
+
if ('const' in rule && !sameJson(candidate, rule.const)) {
|
|
45
|
+
add(`expected ${JSON.stringify(rule.const)}`);
|
|
46
|
+
}
|
|
47
|
+
if (rule.enum && !rule.enum.some((value) => sameJson(value, candidate))) {
|
|
48
|
+
add('value is outside the declared enum');
|
|
49
|
+
}
|
|
50
|
+
if (typeof candidate === 'string') {
|
|
51
|
+
if (rule.minLength !== undefined && candidate.length < rule.minLength) {
|
|
52
|
+
add(`must have at least ${rule.minLength} characters`);
|
|
53
|
+
}
|
|
54
|
+
if (rule.maxLength !== undefined && candidate.length > rule.maxLength) {
|
|
55
|
+
add(`must have no more than ${rule.maxLength} characters`);
|
|
56
|
+
}
|
|
57
|
+
if (rule.pattern && !new RegExp(rule.pattern, 'u').test(candidate)) {
|
|
58
|
+
add(`does not match ${rule.pattern}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (Array.isArray(candidate)) {
|
|
62
|
+
if (rule.minItems !== undefined && candidate.length < rule.minItems) {
|
|
63
|
+
add(`must contain at least ${rule.minItems} items`);
|
|
64
|
+
}
|
|
65
|
+
if (rule.maxItems !== undefined && candidate.length > rule.maxItems) {
|
|
66
|
+
add(`must contain no more than ${rule.maxItems} items`);
|
|
67
|
+
}
|
|
68
|
+
if (rule.uniqueItems &&
|
|
69
|
+
new Set(candidate.map((item) => JSON.stringify(item))).size !==
|
|
70
|
+
candidate.length) {
|
|
71
|
+
add('items must be unique');
|
|
72
|
+
}
|
|
73
|
+
if (rule.items) {
|
|
74
|
+
candidate.forEach((item, index) => {
|
|
75
|
+
problems.push(...validateAgainstSchema(item, rule.items, `${location}[${index}]`));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (isRecord(candidate)) {
|
|
80
|
+
const keys = Object.keys(candidate);
|
|
81
|
+
if (rule.minProperties !== undefined && keys.length < rule.minProperties) {
|
|
82
|
+
add(`must contain at least ${rule.minProperties} properties`);
|
|
83
|
+
}
|
|
84
|
+
if (rule.maxProperties !== undefined && keys.length > rule.maxProperties) {
|
|
85
|
+
add(`must contain no more than ${rule.maxProperties} properties`);
|
|
86
|
+
}
|
|
87
|
+
for (const required of rule.required ?? []) {
|
|
88
|
+
if (!Object.hasOwn(candidate, required))
|
|
89
|
+
add(`missing required property '${required}'`);
|
|
90
|
+
}
|
|
91
|
+
for (const key of keys) {
|
|
92
|
+
if (rule.propertyNames) {
|
|
93
|
+
problems.push(...validateAgainstSchema(key, rule.propertyNames, `${location}.${key} (property name)`));
|
|
94
|
+
}
|
|
95
|
+
const propertyRule = rule.properties && Object.hasOwn(rule.properties, key)
|
|
96
|
+
? rule.properties[key]
|
|
97
|
+
: undefined;
|
|
98
|
+
if (propertyRule) {
|
|
99
|
+
problems.push(...validateAgainstSchema(candidate[key], propertyRule, `${location}.${key}`));
|
|
100
|
+
}
|
|
101
|
+
else if (rule.additionalProperties === false) {
|
|
102
|
+
add(`unknown property '${key}'`);
|
|
103
|
+
}
|
|
104
|
+
else if (isRecord(rule.additionalProperties)) {
|
|
105
|
+
problems.push(...validateAgainstSchema(candidate[key], rule.additionalProperties, `${location}.${key}`));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const nested of rule.allOf ?? []) {
|
|
110
|
+
problems.push(...validateAgainstSchema(candidate, nested, location));
|
|
111
|
+
}
|
|
112
|
+
if (rule.if &&
|
|
113
|
+
validateAgainstSchema(candidate, rule.if, location).length === 0 &&
|
|
114
|
+
rule.then) {
|
|
115
|
+
problems.push(...validateAgainstSchema(candidate, rule.then, location));
|
|
116
|
+
}
|
|
117
|
+
if (rule.oneOf) {
|
|
118
|
+
const matches = rule.oneOf.filter((option) => validateAgainstSchema(candidate, option, location).length === 0).length;
|
|
119
|
+
if (matches !== 1)
|
|
120
|
+
add(`must match exactly one alternative, matched ${matches}`);
|
|
121
|
+
}
|
|
122
|
+
return problems;
|
|
123
|
+
};
|
|
124
|
+
/** Validates package metadata against the actual published adapter schema. */
|
|
125
|
+
export const validateMetadata = (value) => validateAgainstSchema(value, schema);
|
|
126
|
+
/** Compares static package metadata to the immutable runtime manifest. */
|
|
127
|
+
export const compareMetadata = (metadata, library) => {
|
|
128
|
+
const problems = [];
|
|
129
|
+
if (metadata.id !== library.id)
|
|
130
|
+
problems.push('id differs from runtime manifest');
|
|
131
|
+
if (metadata.displayName !== library.displayName)
|
|
132
|
+
problems.push('displayName differs from runtime manifest');
|
|
133
|
+
if (metadata.abi !== `^${library.abi}`)
|
|
134
|
+
problems.push('abi differs from runtime manifest');
|
|
135
|
+
if (metadata.level !== library.level)
|
|
136
|
+
problems.push('level differs from runtime manifest');
|
|
137
|
+
if (metadata.profile !== library.profile)
|
|
138
|
+
problems.push('profile differs from runtime manifest');
|
|
139
|
+
const staticSlots = Array.isArray(metadata.slots) ? [...metadata.slots].sort() : [];
|
|
140
|
+
const runtimeSlots = [...(library.profileSlots ?? Object.keys(library.slots))].sort();
|
|
141
|
+
if (JSON.stringify(staticSlots) !== JSON.stringify(runtimeSlots))
|
|
142
|
+
problems.push('slots differ from runtime profileSlots');
|
|
143
|
+
const staticCapabilities = Array.isArray(metadata.capabilities)
|
|
144
|
+
? [...metadata.capabilities].sort()
|
|
145
|
+
: [];
|
|
146
|
+
if (JSON.stringify(staticCapabilities) !==
|
|
147
|
+
JSON.stringify([...library.capabilities].sort()))
|
|
148
|
+
problems.push('capabilities differ from runtime manifest');
|
|
149
|
+
if (isRecord(metadata.modes)) {
|
|
150
|
+
const modeSlots = Object.keys(metadata.modes).sort((left, right) => left.localeCompare(right));
|
|
151
|
+
if (JSON.stringify(modeSlots) !== JSON.stringify(runtimeSlots)) {
|
|
152
|
+
problems.push('mode slots differ from runtime profileSlots');
|
|
153
|
+
}
|
|
154
|
+
for (const slotId of runtimeSlots) {
|
|
155
|
+
if (metadata.modes[slotId] !== library.slots[slotId]?.mode)
|
|
156
|
+
problems.push(`mode differs for '${slotId}'`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return problems;
|
|
160
|
+
};
|
|
161
|
+
/** Rejects capability claims that this bounded harness cannot support with the declared slots. */
|
|
162
|
+
export const overDeclaredCapabilities = (library) => {
|
|
163
|
+
const slots = new Set(library.profileSlots ?? Object.keys(library.slots));
|
|
164
|
+
const requires = {
|
|
165
|
+
'focus.trap': ['dialogs.dialog'],
|
|
166
|
+
'focus.restore': ['dialogs.dialog'],
|
|
167
|
+
'overlay.portal': [
|
|
168
|
+
'common.tooltip',
|
|
169
|
+
'dropdown.select',
|
|
170
|
+
'dialogs.dialog',
|
|
171
|
+
'display.datePicker',
|
|
172
|
+
],
|
|
173
|
+
'selection.multi': ['dropdown.select'],
|
|
174
|
+
'datetime.i18n': ['display.datePicker'],
|
|
175
|
+
'form.validationMessage': ['common.textInput', 'common.textArea'],
|
|
176
|
+
};
|
|
177
|
+
const problems = [];
|
|
178
|
+
for (const capability of library.capabilities) {
|
|
179
|
+
const required = requires[capability];
|
|
180
|
+
if (required && !required.some((slot) => slots.has(slot)))
|
|
181
|
+
problems.push(`${capability} has no supporting slot`);
|
|
182
|
+
if (capability === 'collection.virtualize' ||
|
|
183
|
+
capability === 'machine.binding' ||
|
|
184
|
+
capability === 'paging.server')
|
|
185
|
+
problems.push(`${capability} has no evidence family in this 14-slot harness`);
|
|
186
|
+
}
|
|
187
|
+
if (library.capabilities.includes('slot.render')) {
|
|
188
|
+
for (const slot of slots) {
|
|
189
|
+
const declaration = library.slots[slot];
|
|
190
|
+
if (!declaration?.render || declaration.fidelity === 'unsupported')
|
|
191
|
+
problems.push(`slot.render over-declared for '${slot}'`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return problems;
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/internal/metadata.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,aAAa,MAAM,mDAAmD,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AA4BpG,8FAA8F;AAC9F,mGAAmG;AACnG,MAAM,MAAM,GAAG,aAA+B,CAAC;AAE/C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAA8C,EAAE,CAC5E,OAAO,KAAK,KAAK,QAAQ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AAC,CAAC;QAC1D,IACI,UAAU,KAAK,uBAAuB;YACtC,UAAU,KAAK,iBAAiB;YAChC,UAAU,KAAK,eAAe;YAE9B,QAAQ,CAAC,IAAI,CAAC,GAAG,UAAU,iDAAiD,CAAC,CAAC;IACtF,CAAC;IACD,IAAI,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QAC/C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,IAAuB,CAAC,CAAC;YAC3D,IAAI,CAAC,WAAW,EAAE,MAAM,IAAI,WAAW,CAAC,QAAQ,KAAK,aAAa;gBAC9D,QAAQ,CAAC,IAAI,CAAC,kCAAkC,IAAI,GAAG,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CSSProperties, Ref } from 'react';
|
|
2
|
+
/** Internal vendor-to-React prop normalization used by executable fixtures. */
|
|
3
|
+
export declare const normalizeReactProps: (props: Readonly<Record<string, unknown>>) => Readonly<Record<string, unknown>>;
|
|
4
|
+
/** Merges object and callback refs without hiding either assignment. */
|
|
5
|
+
export declare const mergeRefs: <T>(...refs: readonly (Ref<T> | undefined)[]) => Ref<T>;
|
|
6
|
+
/** Runs pass-through behavior first and honors preventDefault before public behavior. */
|
|
7
|
+
export declare const composeHandlers: <T extends Event>(first: ((event: T) => void) | undefined, second: ((event: T) => void) | undefined) => (event: T) => void;
|
|
8
|
+
/** Registers a listener and returns idempotent StrictMode-safe cleanup. */
|
|
9
|
+
export declare const listen: <K extends keyof DocumentEventMap>(document: Document, type: K, listener: (event: DocumentEventMap[K]) => void) => () => void;
|
|
10
|
+
/** Constructs style evidence without dropping CSS custom properties. */
|
|
11
|
+
export declare const normalizeStyle: (style: CSSProperties & Readonly<Record<`--${string}`, string | number>>) => CSSProperties;
|
|
12
|
+
//# sourceMappingURL=reactNormalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactNormalization.d.ts","sourceRoot":"","sources":["../../src/internal/reactNormalization.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhD,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,GAC5B,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KACzC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWlC,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,KAAG,GAAG,CAAC,CAAC,CAMxE,CAAC;AAEN,yFAAyF;AACzF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,KAAK,EAC3C,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,EACvC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,MACtC,OAAO,CAAC,SAGb,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,MAAM,gBAAgB,EACnD,UAAU,QAAQ,EAClB,MAAM,CAAC,EACP,UAAU,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,eAUjD,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,cAAc,GACvB,OAAO,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,KACxE,aAA+B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/** Internal vendor-to-React prop normalization used by executable fixtures. */
|
|
4
|
+
export const normalizeReactProps = (props) => {
|
|
5
|
+
const normalized = {};
|
|
6
|
+
for (const [key, value] of Object.entries(props)) {
|
|
7
|
+
const normalizedKey = key === 'class' ? 'className'
|
|
8
|
+
: key === 'for' ? 'htmlFor'
|
|
9
|
+
: key === 'stroke-width' ? 'strokeWidth'
|
|
10
|
+
: key === 'fill-rule' ? 'fillRule'
|
|
11
|
+
: key;
|
|
12
|
+
normalized[normalizedKey] = value;
|
|
13
|
+
}
|
|
14
|
+
return normalized;
|
|
15
|
+
};
|
|
16
|
+
/** Merges object and callback refs without hiding either assignment. */
|
|
17
|
+
export const mergeRefs = (...refs) => (value) => {
|
|
18
|
+
for (const ref of refs) {
|
|
19
|
+
if (typeof ref === 'function')
|
|
20
|
+
ref(value);
|
|
21
|
+
else if (ref)
|
|
22
|
+
ref.current = value;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/** Runs pass-through behavior first and honors preventDefault before public behavior. */
|
|
26
|
+
export const composeHandlers = (first, second) => (event) => {
|
|
27
|
+
first?.(event);
|
|
28
|
+
if (!event.defaultPrevented)
|
|
29
|
+
second?.(event);
|
|
30
|
+
};
|
|
31
|
+
/** Registers a listener and returns idempotent StrictMode-safe cleanup. */
|
|
32
|
+
export const listen = (document, type, listener) => {
|
|
33
|
+
let active = true;
|
|
34
|
+
const eventListener = listener;
|
|
35
|
+
document.addEventListener(type, eventListener);
|
|
36
|
+
return () => {
|
|
37
|
+
if (!active)
|
|
38
|
+
return;
|
|
39
|
+
active = false;
|
|
40
|
+
document.removeEventListener(type, eventListener);
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/** Constructs style evidence without dropping CSS custom properties. */
|
|
44
|
+
export const normalizeStyle = (style) => ({ ...style });
|
|
45
|
+
//# sourceMappingURL=reactNormalization.js.map
|
|
@@ -0,0 +1 @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AK,CAAC,gBAAgB;QAAE,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG,CAClB,QAAkB,EAClB,IAAO,EACP,QAA8C,EAChD,EAAE;IACA,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,MAAM,aAAa,GAAG,QAAyB,CAAC;IAChD,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC/C,OAAO,GAAG,EAAE;QACR,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,GAAG,KAAK,CAAC;QACf,QAAQ,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,CAC1B,KAAuE,EAC1D,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SlotProfile } from './SlotProfile.js';
|
|
2
|
+
/** Creates fresh public-prop fixtures for all fourteen ABI v1 slots. */
|
|
3
|
+
export declare const createSlotProfiles: (evidence: Map<string, Readonly<Record<string, unknown>>>) => readonly SlotProfile[];
|
|
4
|
+
//# sourceMappingURL=slotProfiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slotProfiles.d.ts","sourceRoot":"","sources":["../../src/internal/slotProfiles.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAepD,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,GAC3B,UAAU,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KACzD,SAAS,WAAW,EA4nBtB,CAAC"}
|