@fragments-sdk/mcp 0.10.0 → 0.10.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.
@@ -60253,12 +60253,7 @@ var MAX_ROOT_BRANCHES = 4;
60253
60253
  var MAX_CLASSNAMES = 64;
60254
60254
  var REACT_HOOK_STATE = /* @__PURE__ */ new Set(["useState", "useReducer"]);
60255
60255
  var REACT_HOOK_EFFECT = /* @__PURE__ */ new Set(["useEffect", "useLayoutEffect", "useInsertionEffect"]);
60256
- var WRAPPER_NAMES = /* @__PURE__ */ new Set([
60257
- "forwardRef",
60258
- "memo",
60259
- "observer",
60260
- "styled"
60261
- ]);
60256
+ var WRAPPER_NAMES = /* @__PURE__ */ new Set(["forwardRef", "memo", "observer", "styled"]);
60262
60257
  function mapDefinitionKind(declaration) {
60263
60258
  if (ts3.isClassDeclaration(declaration) || ts3.isClassExpression(declaration)) {
60264
60259
  return { kind: "class", wrappedBy: [], inner: declaration };
@@ -60385,7 +60380,9 @@ function mapRootElements(inner) {
60385
60380
  truncated = true;
60386
60381
  branches.length = MAX_ROOT_BRANCHES;
60387
60382
  }
60388
- const rootElements = branches.map(({ jsx, guard }) => toRootElementFact(jsx, guard));
60383
+ const rootElements = branches.flatMap(
60384
+ ({ jsx, guard }) => effectiveRootNodes(jsx).map((root) => toRootElementFact(root, guard))
60385
+ );
60389
60386
  return { rootElements, rootElementsTruncated: truncated };
60390
60387
  }
60391
60388
  function collectReturnedJsx(node, acc, guard) {
@@ -60427,8 +60424,7 @@ function collectFromExpression(expr, acc, guard) {
60427
60424
  return;
60428
60425
  }
60429
60426
  if (ts3.isJsxElement(stripped) || ts3.isJsxSelfClosingElement(stripped)) {
60430
- const opening = ts3.isJsxElement(stripped) ? stripped.openingElement : stripped;
60431
- acc.push({ jsx: opening, guard });
60427
+ acc.push({ jsx: stripped, guard });
60432
60428
  return;
60433
60429
  }
60434
60430
  if (ts3.isJsxFragment(stripped)) {
@@ -60445,6 +60441,48 @@ function stripParens(expr) {
60445
60441
  function combineGuards(prev, next) {
60446
60442
  return prev ? `${prev} && ${next}` : next;
60447
60443
  }
60444
+ function effectiveRootNodes(jsx) {
60445
+ return effectiveRootsFromJsx(jsx);
60446
+ }
60447
+ function effectiveRootsFromJsx(jsx) {
60448
+ if (ts3.isJsxSelfClosingElement(jsx)) return [jsx];
60449
+ if (ts3.isJsxFragment(jsx)) return effectiveRootsFromFragment(jsx);
60450
+ const opening = jsx.openingElement;
60451
+ const children = effectiveRootsFromChildren(jsx.children);
60452
+ if (children.length > 0 && shouldPreferChildRoots(opening)) {
60453
+ const preferred = children.filter(isRootCandidate);
60454
+ return preferred.length > 0 ? preferred : children;
60455
+ }
60456
+ return [opening];
60457
+ }
60458
+ function effectiveRootsFromFragment(jsx) {
60459
+ const children = effectiveRootsFromChildren(jsx.children);
60460
+ return children.length > 0 ? children : [jsx];
60461
+ }
60462
+ function effectiveRootsFromChildren(children) {
60463
+ const roots = [];
60464
+ for (const child of children) {
60465
+ if (ts3.isJsxElement(child) || ts3.isJsxSelfClosingElement(child) || ts3.isJsxFragment(child)) {
60466
+ roots.push(...effectiveRootsFromJsx(child));
60467
+ }
60468
+ }
60469
+ return roots;
60470
+ }
60471
+ function shouldPreferChildRoots(opening) {
60472
+ const tag = opening.tagName.getText();
60473
+ if (tag === "Fragment") return true;
60474
+ if (tag.endsWith(".Provider")) return true;
60475
+ if (tag === "Field.Root" || tag.endsWith("Field.Root")) return true;
60476
+ return /^(div|span|label|section|fieldset)$/i.test(tag);
60477
+ }
60478
+ function isRootCandidate(jsx) {
60479
+ if (ts3.isJsxFragment(jsx)) return false;
60480
+ const tag = jsx.tagName.getText();
60481
+ if (/^[a-z]/.test(tag)) {
60482
+ return /^(button|input|textarea|select|dialog|details|progress|hr|table|nav|form)$/i.test(tag);
60483
+ }
60484
+ return !tag.includes(".") || tag.endsWith(".Root");
60485
+ }
60448
60486
  function toRootElementFact(jsx, guard) {
60449
60487
  if (ts3.isJsxFragment(jsx)) {
60450
60488
  return { tag: "Fragment", attrs: {}, conditionalGuard: guard };
@@ -60959,4 +60997,4 @@ export {
60959
60997
  resolveTokensWithSass,
60960
60998
  ucfId
60961
60999
  };
60962
- //# sourceMappingURL=dist-TTCI6TME.js.map
61000
+ //# sourceMappingURL=dist-LVC53MY5.js.map