@deneb-ui/cli 2.0.70 → 2.0.72

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.
@@ -33,6 +33,20 @@ const { BROAD_CONTENT_CONTAINERS } = require('./fivora-contract.cjs');
33
33
  const TECHNICAL_TEXT_RE = /^(true|false|null|undefined|px|rem|em|auto|hidden|flex|grid|sr-only)$/i;
34
34
  const ARIA_ONLY_RE = /^(aria-|data-state|data-slot|data-orientation)/;
35
35
  const SKIP_ATTR_NAMES = new Set(['className', 'class', 'style', 'key', 'id', 'role', 'type', 'name', 'htmlFor', 'suppressHydrationWarning']);
36
+ const USER_FACING_PROP_NAMES = new Set([
37
+ 'title',
38
+ 'heading',
39
+ 'subheading',
40
+ 'subtitle',
41
+ 'label',
42
+ 'description',
43
+ 'caption',
44
+ 'badge',
45
+ 'buttonText',
46
+ 'ctaText',
47
+ 'helperText',
48
+ 'summary',
49
+ ]);
36
50
 
37
51
  function fingerprintCandidate(features) {
38
52
  return shortHash(JSON.stringify(features));
@@ -569,6 +583,43 @@ function analyzeFile({ code, relativeFile, profile, graph, ownerScope, component
569
583
  });
570
584
  }
571
585
 
586
+ const isCustomComponent = Boolean(name && ((name[0] >= 'A' && name[0] <= 'Z') || name.includes('.')));
587
+ if (isCustomComponent && !apiOwned && node.openingElement && Array.isArray(node.openingElement.attributes)) {
588
+ for (const attr of node.openingElement.attributes) {
589
+ if (attr.type === 'JSXAttribute' && attr.name && USER_FACING_PROP_NAMES.has(attr.name.name)) {
590
+ const propName = attr.name.name;
591
+ let propValue = '';
592
+ if (attr.value) {
593
+ if (attr.value.type === 'StringLiteral' || attr.value.type === 'Literal') {
594
+ propValue = String(attr.value.value || '');
595
+ } else if (attr.value.type === 'JSXExpressionContainer') {
596
+ const expr = attr.value.expression;
597
+ if (expr && (expr.type === 'StringLiteral' || expr.type === 'Literal')) {
598
+ propValue = String(expr.value || '');
599
+ }
600
+ }
601
+ }
602
+ if (propValue && !isStaticSkipText(propValue)) {
603
+ const propLoc = `${loc}:${propName}`;
604
+ if (!usedLocs.has(propLoc)) {
605
+ usedLocs.add(propLoc);
606
+ candidates.push({
607
+ ...baseMeta,
608
+ loc: propLoc,
609
+ kind: 'text',
610
+ operation: 'extract-prop',
611
+ value: propValue,
612
+ extra: { propName, tag: name },
613
+ confidence: 0.88,
614
+ reason: `component-prop-${propName}`,
615
+ fingerprint: fingerprintCandidate({ tag: name, kind: 'prop', propName }),
616
+ });
617
+ }
618
+ }
619
+ }
620
+ }
621
+ }
622
+
572
623
  const insideForm = parents.some((p) => FORM_CONTAINER_TAGS.has(p));
573
624
 
574
625
  const actionableHref = href || (name === 'Button' ? getJsxAttributeLiteral(node, 'href') : null);
@@ -609,6 +660,22 @@ function analyzeFile({ code, relativeFile, profile, graph, ownerScope, component
609
660
  return;
610
661
  }
611
662
 
663
+ const isHashAnchor = Boolean(actionableHref && actionableHref.startsWith('#') && (!actionIntent || actionIntent.action === 'link'));
664
+ if (isHashAnchor && innerText && !textInfo.dynamic && !apiOwned) {
665
+ usedLocs.add(loc);
666
+ candidates.push({
667
+ ...baseMeta,
668
+ kind: 'text',
669
+ operation: 'extract-text',
670
+ value: innerText,
671
+ confidence: confidenceFor('text'),
672
+ reason: 'in-page-anchor-label',
673
+ fingerprint: fingerprintCandidate({ tag: name, kind: 'text', text: innerText }),
674
+ });
675
+ this.traverse(pathNode);
676
+ return;
677
+ }
678
+
612
679
  const isAction = !isSubmit && (Boolean(actionableHref) || Boolean(actionIntent)) && (ACTION_TAGS.has(name) || isLikelyCtaClass(className));
613
680
 
614
681
  if (isAction && (actionableHref || actionIntent)) {