@yahoo/uds-create-cli 5.82.0 → 5.82.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yahoo/uds-create-cli",
3
- "version": "5.82.0",
3
+ "version": "5.82.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,10 +32,10 @@
32
32
  "@modelcontextprotocol/sdk": "^1.32.2",
33
33
  "@orpc/client": "^1.13.9",
34
34
  "@orpc/contract": "^1.13.9",
35
- "@yahoo/uds-create-config": "5.82.0",
36
- "@yahoo/uds-create-loader": "5.82.0",
37
- "@yahoo/uds-create-types": "5.82.0",
38
- "@yahoo/uds-create-utils": "5.82.0",
35
+ "@yahoo/uds-create-config": "5.82.1",
36
+ "@yahoo/uds-create-loader": "5.82.1",
37
+ "@yahoo/uds-create-types": "5.82.1",
38
+ "@yahoo/uds-create-utils": "5.82.1",
39
39
  "esbuild": "^0.27.4",
40
40
  "ts-morph": "^27.0.2",
41
41
  "get-tsconfig": "^4.10.0",
@@ -54,11 +54,11 @@
54
54
  },
55
55
  "udsSchemaVersion": 20261106185419,
56
56
  "optionalDependencies": {
57
- "@yahoo/uds-create-cli-darwin-arm64": "5.82.0",
58
- "@yahoo/uds-create-cli-darwin-x64": "5.82.0",
59
- "@yahoo/uds-create-cli-linux-arm64": "5.82.0",
60
- "@yahoo/uds-create-cli-linux-x64": "5.82.0",
61
- "@yahoo/uds-create-cli-linux-arm64-musl": "5.82.0",
62
- "@yahoo/uds-create-cli-linux-x64-musl": "5.82.0"
57
+ "@yahoo/uds-create-cli-darwin-arm64": "5.82.1",
58
+ "@yahoo/uds-create-cli-darwin-x64": "5.82.1",
59
+ "@yahoo/uds-create-cli-linux-arm64": "5.82.1",
60
+ "@yahoo/uds-create-cli-linux-x64": "5.82.1",
61
+ "@yahoo/uds-create-cli-linux-arm64-musl": "5.82.1",
62
+ "@yahoo/uds-create-cli-linux-x64-musl": "5.82.1"
63
63
  }
64
64
  }
@@ -88389,6 +88389,8 @@ var Converter = class {
88389
88389
  breakpoints;
88390
88390
  /** Each modifier's class prefix (`md`) → the prop key its bag is written under (`_md`). */
88391
88391
  modifierKeys;
88392
+ /** The classes a modifier's selector names on another element (`.peer`, `.group`). */
88393
+ markerClasses;
88392
88394
  constructor(options, grammar) {
88393
88395
  this.options = options;
88394
88396
  this.grammar = grammar;
@@ -88414,6 +88416,13 @@ var Converter = class {
88414
88416
  });
88415
88417
  }
88416
88418
  this.breakpoints = breakpoints;
88419
+ const markers = /* @__PURE__ */ new Set();
88420
+ for (const modifier of options.config.list("modifier")) {
88421
+ const { type, value } = modifier.toJSON();
88422
+ if (type !== "selector" || typeof value !== "string") continue;
88423
+ for (const [, name] of value.matchAll(/\.(-?[A-Za-z_][\w-]*)/g)) markers.add(name);
88424
+ }
88425
+ this.markerClasses = markers;
88417
88426
  this.modifierKeys = new Map(options.config.list("modifier").map((modifier) => [modifierClassPrefix(modifier), `_${modifier.leaf}`]));
88418
88427
  }
88419
88428
  convertTop(el) {
@@ -88494,15 +88503,22 @@ var Converter = class {
88494
88503
  plain(el, convertKids = () => this.plainChildren(el)) {
88495
88504
  const tag = el.tagName.toLowerCase();
88496
88505
  if (FORBIDDEN_TAGS.has(tag)) return [];
88497
- if (el.hasAttribute(FOLD)) return this.pinFolded(el, convertKids());
88498
- if ([...inlineDeclarations(el), ...declarationsOf(el.getAttribute("data-uds-computed") ?? "")].find(([property]) => property === "display")?.[1].trim() === "contents") return convertKids();
88506
+ let kidsOf = convertKids;
88507
+ if (el.hasAttribute(FOLD) && !this.placesItself(el)) {
88508
+ const kids = convertKids();
88509
+ if (kids.length <= 1) return this.pinFolded(el, kids);
88510
+ kidsOf = () => kids;
88511
+ }
88512
+ if ([...inlineDeclarations(el), ...declarationsOf(el.getAttribute("data-uds-computed") ?? "")].find(([property]) => property === "display")?.[1].trim() === "contents") return kidsOf();
88499
88513
  const { className: className2, style, paints } = this.plainStyle(el);
88500
88514
  const attrs = plainAttributes(el);
88501
88515
  if (tag === "img" && !attrs.src) return [];
88502
- const children = VOID_TAGS.has(tag) ? [] : convertKids();
88516
+ const children = VOID_TAGS.has(tag) ? [] : kidsOf();
88503
88517
  const text = children.length === 0 ? plainText(el) : "";
88504
- if (children.length === 0 && !text && !VOID_TAGS.has(tag) && !paints && !sizesItself(el) && !el.hasAttribute(EMBED_SPACE_ATTR)) return [];
88505
- if (!(className2 !== "" || Object.keys(style).length > 0 || Object.keys(attrs).length > 0) && GROUPING_TAGS.has(tag)) {
88518
+ if (children.length === 0 && !text && !VOID_TAGS.has(tag) && !paints && !sizesItself(el) && !el.hasAttribute(EMBED_SPACE_ATTR) && !holdsGridCell(el)) return [];
88519
+ const carries = className2 !== "" || Object.keys(style).length > 0 || Object.keys(attrs).length > 0;
88520
+ const holdsCell = children.length === 0 && !text && holdsGridCell(el);
88521
+ if (!carries && GROUPING_TAGS.has(tag) && children.length <= 1 && !holdsCell) {
88506
88522
  if (text) return this.plainTextRun(text);
88507
88523
  return children;
88508
88524
  }
@@ -88690,6 +88706,7 @@ var Converter = class {
88690
88706
  classes.push(...owned.length < each.atoms.size ? this.narrowed(each, new Set(owned)) : [each.bare]);
88691
88707
  }
88692
88708
  fromDeclarations(declarationsOf(el.getAttribute("data-uds-computed") ?? ""));
88709
+ for (const cls of classesOf(el)) if (this.markerClasses.has(cls)) classes.push(cls);
88693
88710
  return {
88694
88711
  className: [...new Set(classes)].join(" "),
88695
88712
  style,
@@ -88726,6 +88743,20 @@ var Converter = class {
88726
88743
  }
88727
88744
  }
88728
88745
  /**
88746
+ * Whether an element's classes or computed styles place it in its parent's grid or flex row (a
88747
+ * column span, its own alignment, a flex share). Folding it would leave its child unplaced, so a
88748
+ * card spanning two columns would take one.
88749
+ */
88750
+ placesItself(el) {
88751
+ if (declarationsOf(el.getAttribute("data-uds-computed") ?? "").some(([property]) => PLACEMENT_PROPERTY.test(property))) return true;
88752
+ return classesOf(el).some((cls) => {
88753
+ const read = this.readModifiedClass(cls);
88754
+ if (!read || read.modifiers.length > 0) return false;
88755
+ const { properties = [] } = this.options.config.resolve("style-property", read.style.path)?.toJSON() ?? {};
88756
+ return properties.some((property) => PLACEMENT_PROPERTY.test(property));
88757
+ });
88758
+ }
88759
+ /**
88729
88760
  * The content of an unmarked wrapper the capture folded, with the wrapper's measured box written
88730
88761
  * onto it when it is one element: the wrapper's sizing (a flex share, a fixed size) no longer reaches
88731
88762
  * the child, so the child keeps the box it had.
@@ -88860,7 +88891,7 @@ var Converter = class {
88860
88891
  const important = /^!|!$/.test(leaf);
88861
88892
  if (important) leaf = leaf.replace(/^!|!$/, "");
88862
88893
  if (important) rank += IMPORTANT_RANK;
88863
- const style = this.grammar.styleProp(leaf);
88894
+ const style = this.grammar.styleProp(leaf) ?? this.grammar.styleProp(FADED_CLASS.exec(leaf)?.[1] ?? "");
88864
88895
  return style ? {
88865
88896
  modifiers,
88866
88897
  style,
@@ -89607,6 +89638,8 @@ var ROOT_ATTRIBUTE_PROPS = [
89607
89638
  "placeholder"
89608
89639
  ];
89609
89640
  var PAINT_PROPERTY = /^(background|border-(top-|right-|bottom-|left-)?(width|color)|box-shadow|outline)/;
89641
+ var FADED_CLASS = /^(.+)\/(?:100|\d{1,2}(?:\.\d+)?)$/;
89642
+ var PLACEMENT_PROPERTY = /^(grid-(column|row|area)(-start|-end)?|(align|justify|place)-self|order|flex(-grow)?)$/;
89610
89643
  var GROUPING_TAGS = /* @__PURE__ */ new Set(["div", "span"]);
89611
89644
  var VOID_TAGS = /* @__PURE__ */ new Set([
89612
89645
  "img",
@@ -89634,6 +89667,7 @@ var PLAIN_ATTRIBUTES = {
89634
89667
  rowspan: "rowSpan",
89635
89668
  for: "htmlFor"
89636
89669
  };
89670
+ var BOOLEAN_ATTRIBUTES = ["open", "disabled"];
89637
89671
  function plainAttributes(el) {
89638
89672
  const out = {};
89639
89673
  const tag = el.tagName.toLowerCase();
@@ -89648,6 +89682,17 @@ function plainAttributes(el) {
89648
89682
  const value = tag === "textarea" ? el.textContent ?? "" : el.getAttribute("value");
89649
89683
  if (value) out.defaultValue = value;
89650
89684
  }
89685
+ if (tag === "input" && el.hasAttribute("checked")) out.defaultChecked = true;
89686
+ for (const attr of BOOLEAN_ATTRIBUTES) if (el.hasAttribute(attr)) out[attr] = true;
89687
+ if (tag === "option") {
89688
+ const value = el.getAttribute("value");
89689
+ if (value !== null && value !== void 0) out.value = value;
89690
+ }
89691
+ if (tag === "select") {
89692
+ const chosen = el.querySelector("option[selected]");
89693
+ const value = chosen?.getAttribute("value") ?? chosen?.textContent;
89694
+ if (value) out.defaultValue = value;
89695
+ }
89651
89696
  return out;
89652
89697
  }
89653
89698
  function plainText(el) {
@@ -89667,6 +89712,9 @@ function camelCase3(property) {
89667
89712
  function isImage(el) {
89668
89713
  return el.tagName.toLowerCase() === "img" && !el.hasAttribute("data-uds-component");
89669
89714
  }
89715
+ function isFieldControl(el) {
89716
+ return isField(el) || el.tagName.toLowerCase() === "select";
89717
+ }
89670
89718
  function isField(el) {
89671
89719
  const tag = el.tagName.toLowerCase();
89672
89720
  return tag === "input" || tag === "textarea";
@@ -89728,6 +89776,11 @@ var SIZING_PROPERTY = /* @__PURE__ */ new Set([
89728
89776
  "min-height",
89729
89777
  "flex-basis"
89730
89778
  ]);
89779
+ function holdsGridCell(el) {
89780
+ const parent = el.parentElement;
89781
+ if (!parent) return false;
89782
+ return declarationsOf(parent.getAttribute("data-uds-computed") ?? "").some(([property, value]) => property === "display" && /^(inline-)?grid$/.test(value.trim()));
89783
+ }
89731
89784
  function sizesItself(el) {
89732
89785
  return inlineDeclarations(el).some(([property, value]) => {
89733
89786
  const size = value.trim().toLowerCase();
@@ -89828,7 +89881,7 @@ function nearestRoot(el) {
89828
89881
  function visible(el) {
89829
89882
  const style = el.getAttribute("style") ?? "";
89830
89883
  if (/display:\s*none/.test(style)) return false;
89831
- if (hiddenInline(el) && /position:\s*(absolute|fixed)/.test(style)) return false;
89884
+ if (hiddenInline(el) && /position:\s*(absolute|fixed)/.test(style) && !(isFieldControl(el) && !/visibility:\s*hidden/.test(style))) return false;
89832
89885
  if (el.hasAttribute("hidden")) return false;
89833
89886
  if (el.getAttribute("role") === "tooltip") return false;
89834
89887
  if (el.getAttribute("data-uds-props")?.includes('"hidden":true')) return false;