@immense/vue-pom-generator 1.0.99 → 1.0.100
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/README.md +14 -6
- package/RELEASE_NOTES.md +45 -42
- package/dist/index.cjs +60 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +60 -2
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/types.d.ts +10 -7
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/transform.d.ts +2 -3
- package/dist/transform.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -787,12 +787,20 @@ misleading API. Components that do not forward the marker to a DOM root are omit
|
|
|
787
787
|
component-instance composition rather than falling back to page-wide selectors; their
|
|
788
788
|
own standalone fixture is still generated normally.
|
|
789
789
|
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
790
|
+
Repeated option controls use their semantic identity automatically:
|
|
791
|
+
|
|
792
|
+
- radio inputs require `:value` and generate `selectByValue(value)`;
|
|
793
|
+
- elements with `role="option"` require `:data-value` and generate a keyed option action;
|
|
794
|
+
- other repeated controls continue to use their Vue `:key` identity.
|
|
795
|
+
|
|
796
|
+
When the template does not expose a finite set of values, the generated option parameter
|
|
797
|
+
accepts primitive HTML values (`string | number | boolean | bigint`) so domain enums can be
|
|
798
|
+
passed without string conversion.
|
|
799
|
+
|
|
800
|
+
Use `injection.optionKeyAttribute` only to override those conventions for a component.
|
|
801
|
+
Map the component to `"key"` to explicitly use Vue's reconciliation key, or to another
|
|
802
|
+
bound attribute such as `"data-option-id"`. A configured binding is required on recognized
|
|
803
|
+
option controls; generation fails instead of silently choosing a different identity.
|
|
796
804
|
|
|
797
805
|
`data-pom-instance` is generator-owned. Do not author it in Vue templates.
|
|
798
806
|
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,65 +1,68 @@
|
|
|
1
|
-
I'll verify
|
|
1
|
+
I'll verify the actual commits and PR merge times in this release range before writing the notes.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
PR #63 merged at 22:00:03Z (before the window start of 22:06:13Z), so it's in the prior release.
|
|
4
|
+
Only PR #62 is in range. Let me review the actual diff to write accurate notes.
|
|
4
5
|
|
|
5
|
-
Now I
|
|
6
|
-
|
|
7
|
-
notes.
|
|
8
|
-
|
|
9
|
-
I now have a complete picture. v1.0.99 includes exactly two PRs (#55 and #63); #61 was the v1.0.98
|
|
10
|
-
release commit itself and is excluded. Here are the release notes:
|
|
6
|
+
Now I have a complete picture. Only PR #62 falls in the release window (PR #63 merged before the
|
|
7
|
+
window start). Here are the release notes:
|
|
11
8
|
|
|
12
9
|
Highlights
|
|
13
10
|
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
-
|
|
11
|
+
- The generator now infers semantic option identities automatically instead of relying solely on
|
|
12
|
+
Vue's :key directive.
|
|
13
|
+
- Radio inputs derive identity from :value and emit selectByValue(value); elements with
|
|
14
|
+
role="option" derive identity from :data-value.
|
|
15
|
+
- optionKeyAttribute is repurposed as an explicit override — map to "key" to opt back into Vue's
|
|
16
|
+
reconciliation key, or to a custom bound attribute.
|
|
17
|
+
- Missing identity bindings on recognized option controls now fail fast with a clear, actionable
|
|
18
|
+
error instead of silently falling back.
|
|
21
19
|
|
|
22
20
|
Changes
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
Semantic option identity inference
|
|
23
|
+
|
|
24
|
+
- Added getConventionalOptionIdentityAttribute to detect radio (:value) and ARIA option
|
|
25
|
+
(:data-value) controls by role and tag.
|
|
26
|
+
- Repeated radios generate selectByValue(value); repeated role="option" elements generate a keyed
|
|
27
|
+
option action keyed off :data-value.
|
|
28
|
+
- Other repeated controls continue to use Vue's :key identity unchanged.
|
|
29
|
+
|
|
30
|
+
optionKeyAttribute override semantics
|
|
25
31
|
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
- Explicit component configuration wins over semantic inference.
|
|
33
|
+
- Mapping a component to "key" selects Vue's reconciliation :key; any other value must match a
|
|
34
|
+
bound attribute on the option element.
|
|
35
|
+
- A configured or conventional binding that is missing on a repeated option control throws a
|
|
36
|
+
descriptive error with file/line context.
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
Documentation & types
|
|
32
39
|
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
- When preferAssociatedLabel is set, BasePage.clickTestId now locates the nested native checkable
|
|
36
|
-
control inside the wrapper and uses it as the click target instead of the wrapper element
|
|
37
|
-
- Keyboard activation (Space) and cursor animation now target the nested control rather than the
|
|
38
|
-
wrapper
|
|
40
|
+
- Updated README.md and plugin/types.ts to document the new conventions, override behavior, and
|
|
41
|
+
fail-fast guarantee.
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
Tests
|
|
41
44
|
|
|
42
|
-
-
|
|
43
|
-
|
|
45
|
+
- Added fixtures covering missing :value on mousedown handlers, option-change handlers without
|
|
46
|
+
:value, and option elements missing :data-value.
|
|
47
|
+
- Updated transform.test.ts and semantic-component-instances.test.ts to reflect the new identity
|
|
48
|
+
resolution.
|
|
44
49
|
|
|
45
50
|
Breaking Changes
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
- Repeated radios must bind :value. Repeated elements with role="option" must bind :data-value.
|
|
53
|
+
Templates that previously relied on an implicit :key fallback for these controls will now fail
|
|
54
|
+
generation with a directed error message.
|
|
55
|
+
- Missing optionKeyAttribute overrides no longer silently fall back to :key. A configured binding
|
|
56
|
+
is required on recognized option controls; absence is a hard error.
|
|
49
57
|
|
|
50
58
|
Pull Requests Included
|
|
51
59
|
|
|
52
|
-
- ]8;id=md-
|
|
53
|
-
- ]8;id=md-1f8vu20;https://github.com/immense/vue-pom-generator/pull/55#55 fix(runtime): activate nested checkbox controls]8;;
|
|
60
|
+
- ]8;id=md-co5m4y;https://github.com/immense/vue-pom-generator/pull/62#62 Infer semantic option identities]8;;]8;; (@dkattan)]8;;
|
|
54
61
|
|
|
55
62
|
Testing
|
|
56
63
|
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
|
|
61
|
-
(tests/transform.test.ts)
|
|
62
|
-
- Updated semantic component instance tests to exercise numeric radio values end-to-end, including
|
|
63
|
-
a typecheck consumer file that compiles selectByValue(3)
|
|
64
|
-
(tests/semantic-component-instances.test.ts)
|
|
64
|
+
- npm test (42 files, 431 tests), npm run typecheck, npm run lint (0 errors), npm run smoke:pack,
|
|
65
|
+
and npm run test:playwright (3 tests) all pass.
|
|
66
|
+
- Validated against an ImmyBot generated-POM migration build (643 entries, 1,442 selectors) using a
|
|
67
|
+
local packed dependency.
|
|
65
68
|
|
package/dist/index.cjs
CHANGED
|
@@ -8728,6 +8728,24 @@ function getStaticAttributeContent(element, name) {
|
|
|
8728
8728
|
function getNativeHtmlControlRole(element) {
|
|
8729
8729
|
return getElementControlRole(element);
|
|
8730
8730
|
}
|
|
8731
|
+
function getConventionalOptionIdentityAttribute(element) {
|
|
8732
|
+
const explicitRole = getStaticAttributeContent(element, "role")?.toLowerCase();
|
|
8733
|
+
if (explicitRole === "option") {
|
|
8734
|
+
return "data-value";
|
|
8735
|
+
}
|
|
8736
|
+
if (explicitRole === "radio") {
|
|
8737
|
+
return "value";
|
|
8738
|
+
}
|
|
8739
|
+
const tag = element.tag.toLowerCase();
|
|
8740
|
+
const type = getStaticAttributeContent(element, "type")?.toLowerCase();
|
|
8741
|
+
if ((tag === "input" || tag === "uinput") && type === "radio") {
|
|
8742
|
+
return "value";
|
|
8743
|
+
}
|
|
8744
|
+
return null;
|
|
8745
|
+
}
|
|
8746
|
+
function describeConventionalOption(element) {
|
|
8747
|
+
return getConventionalOptionIdentityAttribute(element) === "value" ? "radio" : `<${element.tag} role="option">`;
|
|
8748
|
+
}
|
|
8731
8749
|
function normalizeControlLabelText(value) {
|
|
8732
8750
|
const normalized = (value ?? "").replace(/\*/g, " ").replace(/\s+/g, " ").trim();
|
|
8733
8751
|
return normalized || null;
|
|
@@ -9282,15 +9300,55 @@ Fix: set \`role\` explicitly in nativeWrappers (e.g. { "${element.tag}": { role:
|
|
|
9282
9300
|
const getBestAvailableKeyInfo = () => {
|
|
9283
9301
|
const parentNode = context.parent && typeof context.parent === "object" ? context.parent : null;
|
|
9284
9302
|
const isDirectVForChild = parentNode?.type === compilerCore.NodeTypes.FOR;
|
|
9285
|
-
const
|
|
9303
|
+
const isInVForScope = isDirectVForChild || context.scopes.vFor > 0;
|
|
9304
|
+
const vForKeyInfo = (isDirectVForChild ? getKeyDirectiveInfo(element) : null) || getContainedInVForDirectiveKeyInfo(context, element, hierarchyMap);
|
|
9305
|
+
const conventionalIdentityAttribute = getConventionalOptionIdentityAttribute(element);
|
|
9306
|
+
const configuredAttrName = optionKeyAttribute[componentName]?.trim();
|
|
9307
|
+
if (configuredAttrName === "key") {
|
|
9308
|
+
if (vForKeyInfo) {
|
|
9309
|
+
return vForKeyInfo;
|
|
9310
|
+
}
|
|
9311
|
+
if (isInVForScope && conventionalIdentityAttribute) {
|
|
9312
|
+
const loc = element.loc.start;
|
|
9313
|
+
throw new Error(
|
|
9314
|
+
`[vue-pom-generator] optionKeyAttribute maps ${componentName} to "key", but repeated ${describeConventionalOption(element)} has no resolvable v-for :key.
|
|
9315
|
+
File: ${context.filename ?? "unknown"}:${loc.line}:${loc.column}
|
|
9316
|
+
|
|
9317
|
+
Fix: bind :key on the repeated option or remove the override to use the conventional :${conventionalIdentityAttribute} identity.`
|
|
9318
|
+
);
|
|
9319
|
+
}
|
|
9320
|
+
}
|
|
9286
9321
|
if (configuredAttrName && configuredAttrName !== "key") {
|
|
9287
9322
|
const bindingKeyInfo = getBindingKeyInfo(element, configuredAttrName);
|
|
9288
9323
|
if (bindingKeyInfo) {
|
|
9289
9324
|
selectorParameterName = configuredAttrName === "value" ? "value" : "key";
|
|
9290
9325
|
return bindingKeyInfo;
|
|
9291
9326
|
}
|
|
9327
|
+
if (isInVForScope && conventionalIdentityAttribute) {
|
|
9328
|
+
const loc = element.loc.start;
|
|
9329
|
+
throw new Error(
|
|
9330
|
+
`[vue-pom-generator] optionKeyAttribute maps ${componentName} to "${configuredAttrName}", but repeated ${describeConventionalOption(element)} does not bind :${configuredAttrName}.
|
|
9331
|
+
File: ${context.filename ?? "unknown"}:${loc.line}:${loc.column}
|
|
9332
|
+
|
|
9333
|
+
Fix: bind :${configuredAttrName} on the option element or remove the override to use the conventional :${conventionalIdentityAttribute} identity.`
|
|
9334
|
+
);
|
|
9335
|
+
}
|
|
9336
|
+
}
|
|
9337
|
+
if (conventionalIdentityAttribute) {
|
|
9338
|
+
const bindingKeyInfo = getBindingKeyInfo(element, conventionalIdentityAttribute);
|
|
9339
|
+
if (bindingKeyInfo) {
|
|
9340
|
+
selectorParameterName = conventionalIdentityAttribute === "value" ? "value" : "key";
|
|
9341
|
+
return bindingKeyInfo;
|
|
9342
|
+
}
|
|
9343
|
+
if (isInVForScope) {
|
|
9344
|
+
const loc = element.loc.start;
|
|
9345
|
+
throw new Error(
|
|
9346
|
+
`[vue-pom-generator] Repeated ${describeConventionalOption(element)} must bind :${conventionalIdentityAttribute} for generated option selection.
|
|
9347
|
+
Component: ${componentName}
|
|
9348
|
+
File: ${context.filename ?? "unknown"}:${loc.line}:${loc.column}`
|
|
9349
|
+
);
|
|
9350
|
+
}
|
|
9292
9351
|
}
|
|
9293
|
-
const vForKeyInfo = (isDirectVForChild ? getKeyDirectiveInfo(element) : null) || getContainedInVForDirectiveKeyInfo(context, element, hierarchyMap);
|
|
9294
9352
|
if (vForKeyInfo) {
|
|
9295
9353
|
return vForKeyInfo;
|
|
9296
9354
|
}
|