@immense/vue-pom-generator 1.0.34 → 1.0.36

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/index.mjs CHANGED
@@ -964,6 +964,18 @@ function nodeHandlerAttributeInfo(node) {
964
964
  }
965
965
  return null;
966
966
  };
967
+ const getRootIdentifierFromMemberChain = (node2) => {
968
+ if (!node2) {
969
+ return null;
970
+ }
971
+ if (isIdentifierNode(node2)) {
972
+ return node2.name;
973
+ }
974
+ if (isMemberExpressionNode(node2)) {
975
+ return getRootIdentifierFromMemberChain(node2.object);
976
+ }
977
+ return null;
978
+ };
967
979
  const getAssignmentTargetName = (lhs) => {
968
980
  if (!lhs) {
969
981
  return null;
@@ -1018,7 +1030,10 @@ function nodeHandlerAttributeInfo(node) {
1018
1030
  }
1019
1031
  if (isMemberExpressionNode(arg)) {
1020
1032
  const stableName = getLastIdentifierFromMemberChain(arg);
1021
- if (stableName) {
1033
+ const rootName = getRootIdentifierFromMemberChain(arg);
1034
+ const firstChar = (rootName ?? "").charAt(0);
1035
+ const isConstantLikeRoot = firstChar !== "" && firstChar === firstChar.toUpperCase() && firstChar !== firstChar.toLowerCase();
1036
+ if (stableName && isConstantLikeRoot) {
1022
1037
  return toPascalCase(stableName.slice(0, 24));
1023
1038
  }
1024
1039
  }
@@ -1036,12 +1051,15 @@ function nodeHandlerAttributeInfo(node) {
1036
1051
  const first = args.length > 0 ? args[0] : null;
1037
1052
  if (!isObjectExpressionNode(first)) {
1038
1053
  const parts2 = [];
1039
- for (const arg of args.slice(0, 2)) {
1054
+ for (const arg of args.slice(0, 4)) {
1040
1055
  const w = stableWordFromValue(arg ?? null);
1041
1056
  if (!w) {
1042
- return null;
1057
+ continue;
1043
1058
  }
1044
1059
  parts2.push(w);
1060
+ if (parts2.length >= 2) {
1061
+ break;
1062
+ }
1045
1063
  }
1046
1064
  if (parts2.length === 0) {
1047
1065
  return null;
@@ -5601,14 +5619,23 @@ Fix: remove the explicit ${attrLabel}, or change existingIdBehavior to "overwrit
5601
5619
  upsertAttribute(element, "option-data-testid-prefix", optionDataTestIdPrefixValue);
5602
5620
  }
5603
5621
  const nativeRole = nativeWrappers[element.tag]?.role ?? element.tag;
5604
- const primarySemanticHint = semanticNameHint || conditionalHint || void 0;
5605
- const alternates = nameCollisionBehavior === "error" && semanticNameHint && conditionalHint ? [`${semanticNameHint} ${conditionalHint}`] : void 0;
5622
+ const wrapperHintCandidates = [
5623
+ semanticNameHint,
5624
+ getStaticAttributeContent(element, "title"),
5625
+ getStaticAttributeContent(element, "label"),
5626
+ getStaticAttributeContent(element, "okTitle"),
5627
+ getStaticAttributeContent(element, "cancelTitle"),
5628
+ getStaticAttributeContent(element, "id") || getStaticAttributeContent(element, "name"),
5629
+ getInnerText(element) || null,
5630
+ nameCollisionBehavior === "error" && semanticNameHint && conditionalHint ? `${semanticNameHint} ${conditionalHint}` : conditionalHint
5631
+ ].map((value) => (value ?? "").trim()).filter(Boolean).filter((value, index, values) => values.indexOf(value) === index);
5632
+ const [primarySemanticHint, ...alternates] = wrapperHintCandidates;
5606
5633
  const pomMergeKey = semanticNameHint && conditionalMergeGroupKey ? `wrapper:ifgroup:${conditionalMergeGroupKey}:model:${semanticNameHint}` : void 0;
5607
5634
  applyResolvedDataTestIdForElement({
5608
5635
  preferredGeneratedValue: nativeWrappersValue,
5609
5636
  nativeRoleOverride: nativeRole,
5610
5637
  semanticNameHint: primarySemanticHint,
5611
- semanticNameHintAlternates: alternates,
5638
+ semanticNameHintAlternates: alternates.length ? alternates : void 0,
5612
5639
  pomMergeKey
5613
5640
  });
5614
5641
  return;