made-refine 0.2.13 → 0.2.15

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.
@@ -29,6 +29,12 @@ interface ElementLocator {
29
29
  id: string | null;
30
30
  classList: string[];
31
31
  domSource?: DomSourceLocation;
32
+ reactComponentName?: string;
33
+ authoredProps?: Record<string, unknown>;
34
+ subElementSources?: Record<string, DomSourceLocation>;
35
+ callSiteSource?: DomSourceLocation;
36
+ definitionSource?: DomSourceLocation;
37
+ isComponentPrimitive?: boolean;
32
38
  }
33
39
  interface CSSPropertyValue {
34
40
  numericValue: number;
@@ -135,6 +141,7 @@ interface DirectEditState {
135
141
  computedColor: ColorProperties | null;
136
142
  computedBoxShadow: string | null;
137
143
  computedTypography: TypographyProperties | null;
144
+ isComponentPrimitive: boolean;
138
145
  originalStyles: Record<string, string>;
139
146
  pendingStyles: Record<string, string>;
140
147
  editModeActive: boolean;
@@ -485,6 +492,12 @@ declare function getChildBriefInfo(element: HTMLElement): ChildBriefInfo;
485
492
  /** Resolve the source location for an element: data-direct-edit-source attribute, then fiber fallback. */
486
493
  declare function getElementSource(element: HTMLElement): DomSourceLocation | null;
487
494
  declare function getElementLocator(element: HTMLElement): ElementLocator;
495
+ declare function getLocatorHeader(locator: ElementLocator): {
496
+ componentLabel: string;
497
+ formattedSource: string | null;
498
+ formattedCallSite: string | null;
499
+ };
500
+ declare function formatComponentTree(reactStack: ReactComponentFrame[]): string | null;
488
501
  declare function buildElementContext(locator: ElementLocator): string;
489
502
  /** Whether a session edit has any meaningful changes (styles, text, or move). */
490
503
  declare function hasSessionEditChanges(edit: SessionEdit): boolean;
@@ -535,4 +548,4 @@ declare function getExportContentProfile(edits: SessionEdit[], comments: Comment
535
548
  declare function buildExportInstruction(profile: ExportContentProfile): string;
536
549
  declare function buildSessionExport(edits: SessionEdit[], comments?: Comment[], options?: SessionExportOptions): string;
537
550
 
538
- export { elementFromPointWithoutOverlays as $, type ActiveTool as A, type BorderRadiusPropertyKey as B, type CSSPropertyValue as C, type DragState as D, type ElementInfo as E, type FlexPropertyKey as F, type Guideline as G, type MeasurementState as H, type SizingChangePhase as I, type SizingMode as J, type SizingProperties as K, type SpacingProperties as L, type MeasurementLine as M, type UndoEntry as N, type UndoMoveEntry as O, type UndoSelectionEntry as P, buildCommentExport as Q, type ReactComponentFrame as R, type SelectElementOptions as S, type TypographyPropertyKey as T, type UndoEditEntry as U, buildSessionExport as V, calculateDropPosition as W, calculateElementMeasurements as X, calculateGuidelineMeasurements as Y, calculateParentMeasurements as Z, colorToTailwind as _, type DropIndicator as a, findContainerAtPoint as a0, findLayoutContainerAtPoint as a1, formatPropertyValue as a2, getComputedBorderStyles as a3, getComputedBoxShadow as a4, getComputedColorStyles as a5, getComputedStyles as a6, getDimensionDisplay as a7, getElementInfo as a8, getElementLocator as a9, findChildAtPoint as aA, findTextOwnerAtPoint as aB, findTextOwnerByRangeScan as aC, flexPropertyToCSSMap as aD, getAllComputedStyles as aE, getChildBriefInfo as aF, getComputedSizing as aG, getComputedTypography as aH, getContextOnlyBlocks as aI, getElementDisplayName as aJ, getElementSource as aK, getExportContentProfile as aL, getMoveIntentForEdit as aM, getOriginalInlineStyles as aN, getSelectionColors as aO, getSizingValue as aP, hasSessionEditChanges as aQ, isInFlowChild as aR, isInputFocused as aS, isTextElement as aT, partitionMultiSelectedEdits as aU, propertyToCSSMap as aV, resolveElementTarget as aW, sizingPropertyToCSSMap as aX, sizingToTailwind as aY, sizingValueToCSS as aZ, typographyPropertyToCSSMap as a_, getFlexDirection as aa, isFlexContainer as ab, isLayoutContainer as ac, parseColorValue as ad, parsePropertyValue as ae, stylesToTailwind as af, type AllComputedStyles as ag, type ExportContentProfile as ah, type MovePlanContext as ai, ORIGINAL_STYLE_PROPS as aj, borderPropertyToCSSMap as ak, borderRadiusPropertyToCSSMap as al, buildEditExport as am, buildElementContext as an, buildExportInstruction as ao, buildMovePlan as ap, buildMovePlanContext as aq, clamp as ar, collapseExportShorthands as as, collapseSpacingShorthands as at, colorPropertyToCSSMap as au, computeHoverHighlight as av, computeIntendedIndex as aw, detectChildrenDirection as ax, detectSizingMode as ay, ensureDirectTextSpanAtPoint as az, type SelectElementsOptions as b, type SpacingPropertyKey as c, type BorderPropertyKey as d, type BorderProperties as e, type SizingPropertyKey as f, type SizingValue as g, type SizingChangeOptions as h, type ColorPropertyKey as i, type ColorValue as j, type Theme as k, type BorderStyleControlPreference as l, type DirectEditState as m, type SessionEdit as n, type SessionItem as o, type CanvasElementKind as p, type TypographyProperties as q, type Comment as r, type BorderRadiusProperties as s, type BorderStyle as t, type ColorProperties as u, type CommentReply as v, type DomSourceLocation as w, type DropTarget as x, type ElementLocator as y, type FlexProperties as z };
551
+ export { elementFromPointWithoutOverlays as $, type ActiveTool as A, type BorderRadiusPropertyKey as B, type CSSPropertyValue as C, type DragState as D, type ElementInfo as E, type FlexPropertyKey as F, type Guideline as G, type MeasurementState as H, type SizingChangePhase as I, type SizingMode as J, type SizingProperties as K, type SpacingProperties as L, type MeasurementLine as M, type UndoEntry as N, type UndoMoveEntry as O, type UndoSelectionEntry as P, buildCommentExport as Q, type ReactComponentFrame as R, type SelectElementOptions as S, type TypographyPropertyKey as T, type UndoEditEntry as U, buildSessionExport as V, calculateDropPosition as W, calculateElementMeasurements as X, calculateGuidelineMeasurements as Y, calculateParentMeasurements as Z, colorToTailwind as _, type DropIndicator as a, sizingValueToCSS as a$, findContainerAtPoint as a0, findLayoutContainerAtPoint as a1, formatPropertyValue as a2, getComputedBorderStyles as a3, getComputedBoxShadow as a4, getComputedColorStyles as a5, getComputedStyles as a6, getDimensionDisplay as a7, getElementInfo as a8, getElementLocator as a9, findChildAtPoint as aA, findTextOwnerAtPoint as aB, findTextOwnerByRangeScan as aC, flexPropertyToCSSMap as aD, formatComponentTree as aE, getAllComputedStyles as aF, getChildBriefInfo as aG, getComputedSizing as aH, getComputedTypography as aI, getContextOnlyBlocks as aJ, getElementDisplayName as aK, getElementSource as aL, getExportContentProfile as aM, getLocatorHeader as aN, getMoveIntentForEdit as aO, getOriginalInlineStyles as aP, getSelectionColors as aQ, getSizingValue as aR, hasSessionEditChanges as aS, isInFlowChild as aT, isInputFocused as aU, isTextElement as aV, partitionMultiSelectedEdits as aW, propertyToCSSMap as aX, resolveElementTarget as aY, sizingPropertyToCSSMap as aZ, sizingToTailwind as a_, getFlexDirection as aa, isFlexContainer as ab, isLayoutContainer as ac, parseColorValue as ad, parsePropertyValue as ae, stylesToTailwind as af, type AllComputedStyles as ag, type ExportContentProfile as ah, type MovePlanContext as ai, ORIGINAL_STYLE_PROPS as aj, borderPropertyToCSSMap as ak, borderRadiusPropertyToCSSMap as al, buildEditExport as am, buildElementContext as an, buildExportInstruction as ao, buildMovePlan as ap, buildMovePlanContext as aq, clamp as ar, collapseExportShorthands as as, collapseSpacingShorthands as at, colorPropertyToCSSMap as au, computeHoverHighlight as av, computeIntendedIndex as aw, detectChildrenDirection as ax, detectSizingMode as ay, ensureDirectTextSpanAtPoint as az, type SelectElementsOptions as b, typographyPropertyToCSSMap as b0, type SpacingPropertyKey as c, type BorderPropertyKey as d, type BorderProperties as e, type SizingPropertyKey as f, type SizingValue as g, type SizingChangeOptions as h, type ColorPropertyKey as i, type ColorValue as j, type Theme as k, type BorderStyleControlPreference as l, type DirectEditState as m, type SessionEdit as n, type SessionItem as o, type CanvasElementKind as p, type TypographyProperties as q, type Comment as r, type BorderRadiusProperties as s, type BorderStyle as t, type ColorProperties as u, type CommentReply as v, type DomSourceLocation as w, type DropTarget as x, type ElementLocator as y, type FlexProperties as z };
@@ -29,6 +29,12 @@ interface ElementLocator {
29
29
  id: string | null;
30
30
  classList: string[];
31
31
  domSource?: DomSourceLocation;
32
+ reactComponentName?: string;
33
+ authoredProps?: Record<string, unknown>;
34
+ subElementSources?: Record<string, DomSourceLocation>;
35
+ callSiteSource?: DomSourceLocation;
36
+ definitionSource?: DomSourceLocation;
37
+ isComponentPrimitive?: boolean;
32
38
  }
33
39
  interface CSSPropertyValue {
34
40
  numericValue: number;
@@ -135,6 +141,7 @@ interface DirectEditState {
135
141
  computedColor: ColorProperties | null;
136
142
  computedBoxShadow: string | null;
137
143
  computedTypography: TypographyProperties | null;
144
+ isComponentPrimitive: boolean;
138
145
  originalStyles: Record<string, string>;
139
146
  pendingStyles: Record<string, string>;
140
147
  editModeActive: boolean;
@@ -485,6 +492,12 @@ declare function getChildBriefInfo(element: HTMLElement): ChildBriefInfo;
485
492
  /** Resolve the source location for an element: data-direct-edit-source attribute, then fiber fallback. */
486
493
  declare function getElementSource(element: HTMLElement): DomSourceLocation | null;
487
494
  declare function getElementLocator(element: HTMLElement): ElementLocator;
495
+ declare function getLocatorHeader(locator: ElementLocator): {
496
+ componentLabel: string;
497
+ formattedSource: string | null;
498
+ formattedCallSite: string | null;
499
+ };
500
+ declare function formatComponentTree(reactStack: ReactComponentFrame[]): string | null;
488
501
  declare function buildElementContext(locator: ElementLocator): string;
489
502
  /** Whether a session edit has any meaningful changes (styles, text, or move). */
490
503
  declare function hasSessionEditChanges(edit: SessionEdit): boolean;
@@ -535,4 +548,4 @@ declare function getExportContentProfile(edits: SessionEdit[], comments: Comment
535
548
  declare function buildExportInstruction(profile: ExportContentProfile): string;
536
549
  declare function buildSessionExport(edits: SessionEdit[], comments?: Comment[], options?: SessionExportOptions): string;
537
550
 
538
- export { elementFromPointWithoutOverlays as $, type ActiveTool as A, type BorderRadiusPropertyKey as B, type CSSPropertyValue as C, type DragState as D, type ElementInfo as E, type FlexPropertyKey as F, type Guideline as G, type MeasurementState as H, type SizingChangePhase as I, type SizingMode as J, type SizingProperties as K, type SpacingProperties as L, type MeasurementLine as M, type UndoEntry as N, type UndoMoveEntry as O, type UndoSelectionEntry as P, buildCommentExport as Q, type ReactComponentFrame as R, type SelectElementOptions as S, type TypographyPropertyKey as T, type UndoEditEntry as U, buildSessionExport as V, calculateDropPosition as W, calculateElementMeasurements as X, calculateGuidelineMeasurements as Y, calculateParentMeasurements as Z, colorToTailwind as _, type DropIndicator as a, findContainerAtPoint as a0, findLayoutContainerAtPoint as a1, formatPropertyValue as a2, getComputedBorderStyles as a3, getComputedBoxShadow as a4, getComputedColorStyles as a5, getComputedStyles as a6, getDimensionDisplay as a7, getElementInfo as a8, getElementLocator as a9, findChildAtPoint as aA, findTextOwnerAtPoint as aB, findTextOwnerByRangeScan as aC, flexPropertyToCSSMap as aD, getAllComputedStyles as aE, getChildBriefInfo as aF, getComputedSizing as aG, getComputedTypography as aH, getContextOnlyBlocks as aI, getElementDisplayName as aJ, getElementSource as aK, getExportContentProfile as aL, getMoveIntentForEdit as aM, getOriginalInlineStyles as aN, getSelectionColors as aO, getSizingValue as aP, hasSessionEditChanges as aQ, isInFlowChild as aR, isInputFocused as aS, isTextElement as aT, partitionMultiSelectedEdits as aU, propertyToCSSMap as aV, resolveElementTarget as aW, sizingPropertyToCSSMap as aX, sizingToTailwind as aY, sizingValueToCSS as aZ, typographyPropertyToCSSMap as a_, getFlexDirection as aa, isFlexContainer as ab, isLayoutContainer as ac, parseColorValue as ad, parsePropertyValue as ae, stylesToTailwind as af, type AllComputedStyles as ag, type ExportContentProfile as ah, type MovePlanContext as ai, ORIGINAL_STYLE_PROPS as aj, borderPropertyToCSSMap as ak, borderRadiusPropertyToCSSMap as al, buildEditExport as am, buildElementContext as an, buildExportInstruction as ao, buildMovePlan as ap, buildMovePlanContext as aq, clamp as ar, collapseExportShorthands as as, collapseSpacingShorthands as at, colorPropertyToCSSMap as au, computeHoverHighlight as av, computeIntendedIndex as aw, detectChildrenDirection as ax, detectSizingMode as ay, ensureDirectTextSpanAtPoint as az, type SelectElementsOptions as b, type SpacingPropertyKey as c, type BorderPropertyKey as d, type BorderProperties as e, type SizingPropertyKey as f, type SizingValue as g, type SizingChangeOptions as h, type ColorPropertyKey as i, type ColorValue as j, type Theme as k, type BorderStyleControlPreference as l, type DirectEditState as m, type SessionEdit as n, type SessionItem as o, type CanvasElementKind as p, type TypographyProperties as q, type Comment as r, type BorderRadiusProperties as s, type BorderStyle as t, type ColorProperties as u, type CommentReply as v, type DomSourceLocation as w, type DropTarget as x, type ElementLocator as y, type FlexProperties as z };
551
+ export { elementFromPointWithoutOverlays as $, type ActiveTool as A, type BorderRadiusPropertyKey as B, type CSSPropertyValue as C, type DragState as D, type ElementInfo as E, type FlexPropertyKey as F, type Guideline as G, type MeasurementState as H, type SizingChangePhase as I, type SizingMode as J, type SizingProperties as K, type SpacingProperties as L, type MeasurementLine as M, type UndoEntry as N, type UndoMoveEntry as O, type UndoSelectionEntry as P, buildCommentExport as Q, type ReactComponentFrame as R, type SelectElementOptions as S, type TypographyPropertyKey as T, type UndoEditEntry as U, buildSessionExport as V, calculateDropPosition as W, calculateElementMeasurements as X, calculateGuidelineMeasurements as Y, calculateParentMeasurements as Z, colorToTailwind as _, type DropIndicator as a, sizingValueToCSS as a$, findContainerAtPoint as a0, findLayoutContainerAtPoint as a1, formatPropertyValue as a2, getComputedBorderStyles as a3, getComputedBoxShadow as a4, getComputedColorStyles as a5, getComputedStyles as a6, getDimensionDisplay as a7, getElementInfo as a8, getElementLocator as a9, findChildAtPoint as aA, findTextOwnerAtPoint as aB, findTextOwnerByRangeScan as aC, flexPropertyToCSSMap as aD, formatComponentTree as aE, getAllComputedStyles as aF, getChildBriefInfo as aG, getComputedSizing as aH, getComputedTypography as aI, getContextOnlyBlocks as aJ, getElementDisplayName as aK, getElementSource as aL, getExportContentProfile as aM, getLocatorHeader as aN, getMoveIntentForEdit as aO, getOriginalInlineStyles as aP, getSelectionColors as aQ, getSizingValue as aR, hasSessionEditChanges as aS, isInFlowChild as aT, isInputFocused as aU, isTextElement as aV, partitionMultiSelectedEdits as aW, propertyToCSSMap as aX, resolveElementTarget as aY, sizingPropertyToCSSMap as aZ, sizingToTailwind as a_, getFlexDirection as aa, isFlexContainer as ab, isLayoutContainer as ac, parseColorValue as ad, parsePropertyValue as ae, stylesToTailwind as af, type AllComputedStyles as ag, type ExportContentProfile as ah, type MovePlanContext as ai, ORIGINAL_STYLE_PROPS as aj, borderPropertyToCSSMap as ak, borderRadiusPropertyToCSSMap as al, buildEditExport as am, buildElementContext as an, buildExportInstruction as ao, buildMovePlan as ap, buildMovePlanContext as aq, clamp as ar, collapseExportShorthands as as, collapseSpacingShorthands as at, colorPropertyToCSSMap as au, computeHoverHighlight as av, computeIntendedIndex as aw, detectChildrenDirection as ax, detectSizingMode as ay, ensureDirectTextSpanAtPoint as az, type SelectElementsOptions as b, typographyPropertyToCSSMap as b0, type SpacingPropertyKey as c, type BorderPropertyKey as d, type BorderProperties as e, type SizingPropertyKey as f, type SizingValue as g, type SizingChangeOptions as h, type ColorPropertyKey as i, type ColorValue as j, type Theme as k, type BorderStyleControlPreference as l, type DirectEditState as m, type SessionEdit as n, type SessionItem as o, type CanvasElementKind as p, type TypographyProperties as q, type Comment as r, type BorderRadiusProperties as s, type BorderStyle as t, type ColorProperties as u, type CommentReply as v, type DomSourceLocation as w, type DropTarget as x, type ElementLocator as y, type FlexProperties as z };
package/dist/utils.d.mts CHANGED
@@ -1 +1 @@
1
- export { ag as AllComputedStyles, e as BorderProperties, d as BorderPropertyKey, s as BorderRadiusProperties, B as BorderRadiusPropertyKey, t as BorderStyle, C as CSSPropertyValue, u as ColorProperties, i as ColorPropertyKey, j as ColorValue, m as DirectEditState, D as DragState, a as DropIndicator, x as DropTarget, E as ElementInfo, y as ElementLocator, ah as ExportContentProfile, z as FlexProperties, F as FlexPropertyKey, M as MeasurementLine, H as MeasurementState, ai as MovePlanContext, aj as ORIGINAL_STYLE_PROPS, R as ReactComponentFrame, J as SizingMode, K as SizingProperties, f as SizingPropertyKey, g as SizingValue, L as SpacingProperties, c as SpacingPropertyKey, q as TypographyProperties, T as TypographyPropertyKey, ak as borderPropertyToCSSMap, al as borderRadiusPropertyToCSSMap, Q as buildCommentExport, am as buildEditExport, an as buildElementContext, ao as buildExportInstruction, ap as buildMovePlan, aq as buildMovePlanContext, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, ar as clamp, as as collapseExportShorthands, at as collapseSpacingShorthands, au as colorPropertyToCSSMap, _ as colorToTailwind, av as computeHoverHighlight, aw as computeIntendedIndex, ax as detectChildrenDirection, ay as detectSizingMode, $ as elementFromPointWithoutOverlays, az as ensureDirectTextSpanAtPoint, aA as findChildAtPoint, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, aB as findTextOwnerAtPoint, aC as findTextOwnerByRangeScan, aD as flexPropertyToCSSMap, a2 as formatPropertyValue, aE as getAllComputedStyles, aF as getChildBriefInfo, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, aG as getComputedSizing, a6 as getComputedStyles, aH as getComputedTypography, aI as getContextOnlyBlocks, a7 as getDimensionDisplay, aJ as getElementDisplayName, a8 as getElementInfo, a9 as getElementLocator, aK as getElementSource, aL as getExportContentProfile, aa as getFlexDirection, aM as getMoveIntentForEdit, aN as getOriginalInlineStyles, aO as getSelectionColors, aP as getSizingValue, aQ as hasSessionEditChanges, ab as isFlexContainer, aR as isInFlowChild, aS as isInputFocused, ac as isLayoutContainer, aT as isTextElement, ad as parseColorValue, ae as parsePropertyValue, aU as partitionMultiSelectedEdits, aV as propertyToCSSMap, aW as resolveElementTarget, aX as sizingPropertyToCSSMap, aY as sizingToTailwind, aZ as sizingValueToCSS, af as stylesToTailwind, a_ as typographyPropertyToCSSMap } from './utils-DvJ3xKrO.mjs';
1
+ export { ag as AllComputedStyles, e as BorderProperties, d as BorderPropertyKey, s as BorderRadiusProperties, B as BorderRadiusPropertyKey, t as BorderStyle, C as CSSPropertyValue, u as ColorProperties, i as ColorPropertyKey, j as ColorValue, m as DirectEditState, D as DragState, a as DropIndicator, x as DropTarget, E as ElementInfo, y as ElementLocator, ah as ExportContentProfile, z as FlexProperties, F as FlexPropertyKey, M as MeasurementLine, H as MeasurementState, ai as MovePlanContext, aj as ORIGINAL_STYLE_PROPS, R as ReactComponentFrame, J as SizingMode, K as SizingProperties, f as SizingPropertyKey, g as SizingValue, L as SpacingProperties, c as SpacingPropertyKey, q as TypographyProperties, T as TypographyPropertyKey, ak as borderPropertyToCSSMap, al as borderRadiusPropertyToCSSMap, Q as buildCommentExport, am as buildEditExport, an as buildElementContext, ao as buildExportInstruction, ap as buildMovePlan, aq as buildMovePlanContext, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, ar as clamp, as as collapseExportShorthands, at as collapseSpacingShorthands, au as colorPropertyToCSSMap, _ as colorToTailwind, av as computeHoverHighlight, aw as computeIntendedIndex, ax as detectChildrenDirection, ay as detectSizingMode, $ as elementFromPointWithoutOverlays, az as ensureDirectTextSpanAtPoint, aA as findChildAtPoint, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, aB as findTextOwnerAtPoint, aC as findTextOwnerByRangeScan, aD as flexPropertyToCSSMap, aE as formatComponentTree, a2 as formatPropertyValue, aF as getAllComputedStyles, aG as getChildBriefInfo, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, aH as getComputedSizing, a6 as getComputedStyles, aI as getComputedTypography, aJ as getContextOnlyBlocks, a7 as getDimensionDisplay, aK as getElementDisplayName, a8 as getElementInfo, a9 as getElementLocator, aL as getElementSource, aM as getExportContentProfile, aa as getFlexDirection, aN as getLocatorHeader, aO as getMoveIntentForEdit, aP as getOriginalInlineStyles, aQ as getSelectionColors, aR as getSizingValue, aS as hasSessionEditChanges, ab as isFlexContainer, aT as isInFlowChild, aU as isInputFocused, ac as isLayoutContainer, aV as isTextElement, ad as parseColorValue, ae as parsePropertyValue, aW as partitionMultiSelectedEdits, aX as propertyToCSSMap, aY as resolveElementTarget, aZ as sizingPropertyToCSSMap, a_ as sizingToTailwind, a$ as sizingValueToCSS, af as stylesToTailwind, b0 as typographyPropertyToCSSMap } from './utils-lksVP2Wq.mjs';
package/dist/utils.d.ts CHANGED
@@ -1 +1 @@
1
- export { ag as AllComputedStyles, e as BorderProperties, d as BorderPropertyKey, s as BorderRadiusProperties, B as BorderRadiusPropertyKey, t as BorderStyle, C as CSSPropertyValue, u as ColorProperties, i as ColorPropertyKey, j as ColorValue, m as DirectEditState, D as DragState, a as DropIndicator, x as DropTarget, E as ElementInfo, y as ElementLocator, ah as ExportContentProfile, z as FlexProperties, F as FlexPropertyKey, M as MeasurementLine, H as MeasurementState, ai as MovePlanContext, aj as ORIGINAL_STYLE_PROPS, R as ReactComponentFrame, J as SizingMode, K as SizingProperties, f as SizingPropertyKey, g as SizingValue, L as SpacingProperties, c as SpacingPropertyKey, q as TypographyProperties, T as TypographyPropertyKey, ak as borderPropertyToCSSMap, al as borderRadiusPropertyToCSSMap, Q as buildCommentExport, am as buildEditExport, an as buildElementContext, ao as buildExportInstruction, ap as buildMovePlan, aq as buildMovePlanContext, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, ar as clamp, as as collapseExportShorthands, at as collapseSpacingShorthands, au as colorPropertyToCSSMap, _ as colorToTailwind, av as computeHoverHighlight, aw as computeIntendedIndex, ax as detectChildrenDirection, ay as detectSizingMode, $ as elementFromPointWithoutOverlays, az as ensureDirectTextSpanAtPoint, aA as findChildAtPoint, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, aB as findTextOwnerAtPoint, aC as findTextOwnerByRangeScan, aD as flexPropertyToCSSMap, a2 as formatPropertyValue, aE as getAllComputedStyles, aF as getChildBriefInfo, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, aG as getComputedSizing, a6 as getComputedStyles, aH as getComputedTypography, aI as getContextOnlyBlocks, a7 as getDimensionDisplay, aJ as getElementDisplayName, a8 as getElementInfo, a9 as getElementLocator, aK as getElementSource, aL as getExportContentProfile, aa as getFlexDirection, aM as getMoveIntentForEdit, aN as getOriginalInlineStyles, aO as getSelectionColors, aP as getSizingValue, aQ as hasSessionEditChanges, ab as isFlexContainer, aR as isInFlowChild, aS as isInputFocused, ac as isLayoutContainer, aT as isTextElement, ad as parseColorValue, ae as parsePropertyValue, aU as partitionMultiSelectedEdits, aV as propertyToCSSMap, aW as resolveElementTarget, aX as sizingPropertyToCSSMap, aY as sizingToTailwind, aZ as sizingValueToCSS, af as stylesToTailwind, a_ as typographyPropertyToCSSMap } from './utils-DvJ3xKrO.js';
1
+ export { ag as AllComputedStyles, e as BorderProperties, d as BorderPropertyKey, s as BorderRadiusProperties, B as BorderRadiusPropertyKey, t as BorderStyle, C as CSSPropertyValue, u as ColorProperties, i as ColorPropertyKey, j as ColorValue, m as DirectEditState, D as DragState, a as DropIndicator, x as DropTarget, E as ElementInfo, y as ElementLocator, ah as ExportContentProfile, z as FlexProperties, F as FlexPropertyKey, M as MeasurementLine, H as MeasurementState, ai as MovePlanContext, aj as ORIGINAL_STYLE_PROPS, R as ReactComponentFrame, J as SizingMode, K as SizingProperties, f as SizingPropertyKey, g as SizingValue, L as SpacingProperties, c as SpacingPropertyKey, q as TypographyProperties, T as TypographyPropertyKey, ak as borderPropertyToCSSMap, al as borderRadiusPropertyToCSSMap, Q as buildCommentExport, am as buildEditExport, an as buildElementContext, ao as buildExportInstruction, ap as buildMovePlan, aq as buildMovePlanContext, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, ar as clamp, as as collapseExportShorthands, at as collapseSpacingShorthands, au as colorPropertyToCSSMap, _ as colorToTailwind, av as computeHoverHighlight, aw as computeIntendedIndex, ax as detectChildrenDirection, ay as detectSizingMode, $ as elementFromPointWithoutOverlays, az as ensureDirectTextSpanAtPoint, aA as findChildAtPoint, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, aB as findTextOwnerAtPoint, aC as findTextOwnerByRangeScan, aD as flexPropertyToCSSMap, aE as formatComponentTree, a2 as formatPropertyValue, aF as getAllComputedStyles, aG as getChildBriefInfo, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, aH as getComputedSizing, a6 as getComputedStyles, aI as getComputedTypography, aJ as getContextOnlyBlocks, a7 as getDimensionDisplay, aK as getElementDisplayName, a8 as getElementInfo, a9 as getElementLocator, aL as getElementSource, aM as getExportContentProfile, aa as getFlexDirection, aN as getLocatorHeader, aO as getMoveIntentForEdit, aP as getOriginalInlineStyles, aQ as getSelectionColors, aR as getSizingValue, aS as hasSessionEditChanges, ab as isFlexContainer, aT as isInFlowChild, aU as isInputFocused, ac as isLayoutContainer, aV as isTextElement, ad as parseColorValue, ae as parsePropertyValue, aW as partitionMultiSelectedEdits, aX as propertyToCSSMap, aY as resolveElementTarget, aZ as sizingPropertyToCSSMap, a_ as sizingToTailwind, a$ as sizingValueToCSS, af as stylesToTailwind, b0 as typographyPropertyToCSSMap } from './utils-lksVP2Wq.js';
package/dist/utils.js CHANGED
@@ -51,6 +51,7 @@ __export(utils_exports, {
51
51
  findTextOwnerAtPoint: () => findTextOwnerAtPoint,
52
52
  findTextOwnerByRangeScan: () => findTextOwnerByRangeScan,
53
53
  flexPropertyToCSSMap: () => flexPropertyToCSSMap,
54
+ formatComponentTree: () => formatComponentTree,
54
55
  formatPropertyValue: () => formatPropertyValue,
55
56
  getAllComputedStyles: () => getAllComputedStyles,
56
57
  getChildBriefInfo: () => getChildBriefInfo,
@@ -68,6 +69,7 @@ __export(utils_exports, {
68
69
  getElementSource: () => getElementSource,
69
70
  getExportContentProfile: () => getExportContentProfile,
70
71
  getFlexDirection: () => getFlexDirection,
72
+ getLocatorHeader: () => getLocatorHeader,
71
73
  getMoveIntentForEdit: () => getMoveIntentForEdit,
72
74
  getOriginalInlineStyles: () => getOriginalInlineStyles,
73
75
  getSelectionColors: () => getSelectionColors,
@@ -133,6 +135,122 @@ function getZoomScale() {
133
135
  return snap.active ? snap.zoom : 1;
134
136
  }
135
137
 
138
+ // src/utils/react-fiber.ts
139
+ var EXCLUDED_PROP_KEYS = /* @__PURE__ */ new Set([
140
+ "className",
141
+ "style",
142
+ "children",
143
+ "ref",
144
+ "key",
145
+ "render"
146
+ ]);
147
+ function serializePropValue(value) {
148
+ if (typeof value === "function") return "[function]";
149
+ if (typeof value === "symbol") return void 0;
150
+ if (value === void 0) return void 0;
151
+ if (value !== null && typeof value === "object") {
152
+ if ("$$typeof" in value) return "[element]";
153
+ try {
154
+ JSON.stringify(value);
155
+ return value;
156
+ } catch {
157
+ return "[object]";
158
+ }
159
+ }
160
+ return value;
161
+ }
162
+ function getComponentProps(fiber) {
163
+ const props = fiber?.memoizedProps ?? fiber?.pendingProps;
164
+ if (!props || typeof props !== "object") return {};
165
+ const result = {};
166
+ for (const [key, value] of Object.entries(props)) {
167
+ if (EXCLUDED_PROP_KEYS.has(key)) continue;
168
+ if (key.startsWith("data-")) continue;
169
+ const serialized = serializePropValue(value);
170
+ if (serialized !== void 0) {
171
+ result[key] = serialized;
172
+ }
173
+ }
174
+ return result;
175
+ }
176
+ function getCallSiteSource(fiber) {
177
+ const source = fiber?._debugSource;
178
+ if (source?.fileName) {
179
+ return {
180
+ file: source.fileName,
181
+ line: typeof source.lineNumber === "number" ? source.lineNumber : void 0,
182
+ column: typeof source.columnNumber === "number" ? source.columnNumber : void 0
183
+ };
184
+ }
185
+ const pending = fiber?.pendingProps?.__source;
186
+ if (pending?.fileName) {
187
+ return {
188
+ file: pending.fileName,
189
+ line: typeof pending.lineNumber === "number" ? pending.lineNumber : void 0,
190
+ column: typeof pending.columnNumber === "number" ? pending.columnNumber : void 0
191
+ };
192
+ }
193
+ return null;
194
+ }
195
+ function deriveDefinitionSource(frames) {
196
+ for (const frame of frames) {
197
+ if (frame.file && isComponentPrimitivePath(frame.file)) {
198
+ return { file: frame.file, line: frame.line, column: frame.column };
199
+ }
200
+ }
201
+ return null;
202
+ }
203
+ var PRIMITIVE_PATH_PATTERNS = [
204
+ /\/components\/ui\//,
205
+ /\/ui\/primitives\//,
206
+ /\/design-system\//
207
+ ];
208
+ var PRIMITIVE_NPM_PATTERNS = [
209
+ /@base-ui\//,
210
+ /@radix-ui\//,
211
+ /@headlessui\//,
212
+ /@chakra-ui\//,
213
+ /@mantine\//,
214
+ /@mui\//,
215
+ /@ark-ui\//
216
+ ];
217
+ var FRAMEWORK_EXCLUSION_PATTERNS = [
218
+ /node_modules\/react\//,
219
+ /node_modules\/react-dom\//,
220
+ /node_modules\/next\/dist\//,
221
+ /node_modules\/scheduler\//,
222
+ /node_modules\/react-server\//
223
+ ];
224
+ function isComponentPrimitivePath(filePath) {
225
+ const normalized = filePath.replace(/\\/g, "/");
226
+ for (const pattern of FRAMEWORK_EXCLUSION_PATTERNS) {
227
+ if (pattern.test(normalized)) return false;
228
+ }
229
+ for (const pattern of PRIMITIVE_NPM_PATTERNS) {
230
+ if (pattern.test(normalized)) return true;
231
+ }
232
+ for (const pattern of PRIMITIVE_PATH_PATTERNS) {
233
+ if (pattern.test(normalized)) return true;
234
+ }
235
+ return false;
236
+ }
237
+ function classifyComponentFiber(fiber, frames, elementSourceFile) {
238
+ if (elementSourceFile && isComponentPrimitivePath(elementSourceFile)) {
239
+ return { isComponentPrimitive: true };
240
+ }
241
+ if (!fiber) return { isComponentPrimitive: false };
242
+ const callSite = getCallSiteSource(fiber);
243
+ if (callSite?.file && isComponentPrimitivePath(callSite.file)) {
244
+ return { isComponentPrimitive: true };
245
+ }
246
+ for (const frame of frames) {
247
+ if (frame.file && isComponentPrimitivePath(frame.file)) {
248
+ return { isComponentPrimitive: true };
249
+ }
250
+ }
251
+ return { isComponentPrimitive: false };
252
+ }
253
+
136
254
  // src/utils.ts
137
255
  function clamp(value, min, max) {
138
256
  if (!Number.isFinite(value)) return min;
@@ -1898,38 +2016,48 @@ function getOwnerStack(fiber) {
1898
2016
  const frames = [];
1899
2017
  let current = fiber;
1900
2018
  let lastFrame = null;
2019
+ let nearestComponentFiber = null;
1901
2020
  while (current) {
1902
2021
  const frame = buildFrame(current);
1903
2022
  if (frame && shouldIncludeFrame(frame, lastFrame)) {
1904
2023
  frames.push(frame);
1905
2024
  lastFrame = frame;
2025
+ if (!nearestComponentFiber) {
2026
+ nearestComponentFiber = current;
2027
+ }
1906
2028
  }
1907
2029
  current = current._debugOwner;
1908
2030
  }
1909
- return frames;
2031
+ return { frames, nearestComponentFiber };
1910
2032
  }
1911
2033
  function getRenderStack(fiber) {
1912
2034
  const frames = [];
1913
2035
  let current = fiber;
1914
2036
  let lastFrame = null;
2037
+ let nearestComponentFiber = null;
1915
2038
  while (current) {
1916
2039
  const frame = buildFrame(current);
1917
2040
  if (frame && shouldIncludeFrame(frame, lastFrame)) {
1918
2041
  frames.push(frame);
1919
2042
  lastFrame = frame;
2043
+ if (!nearestComponentFiber) {
2044
+ nearestComponentFiber = current;
2045
+ }
1920
2046
  }
1921
2047
  current = current.return;
1922
2048
  }
1923
- return frames;
2049
+ return { frames, nearestComponentFiber };
1924
2050
  }
1925
- function getReactComponentStack(element) {
2051
+ function getReactComponentInfo(element) {
1926
2052
  const fiber = getFiberForElement(element);
1927
- if (!fiber) return [];
1928
- const ownerStack = getOwnerStack(fiber);
1929
- if (ownerStack.length > 0) {
1930
- return ownerStack;
2053
+ if (!fiber) return { frames: [], nearestComponentFiber: null };
2054
+ const elementSource = getSourceFromFiber(fiber);
2055
+ const elementSourceFile = elementSource?.fileName || void 0;
2056
+ const ownerResult = getOwnerStack(fiber);
2057
+ if (ownerResult.frames.length > 0) {
2058
+ return { ...ownerResult, elementSourceFile };
1931
2059
  }
1932
- return getRenderStack(fiber);
2060
+ return { ...getRenderStack(fiber), elementSourceFile };
1933
2061
  }
1934
2062
  function getElementDisplayName(element) {
1935
2063
  const tag = element.tagName.toLowerCase();
@@ -2231,6 +2359,27 @@ function parseDomSource(element) {
2231
2359
  }
2232
2360
  return { file, line, column };
2233
2361
  }
2362
+ var MAX_SUB_ELEMENT_SOURCES = 20;
2363
+ function collectSubElementSources(element) {
2364
+ const sources = {};
2365
+ const children = element.querySelectorAll("[data-direct-edit-source]");
2366
+ const labelCounts = /* @__PURE__ */ new Map();
2367
+ let count = 0;
2368
+ for (const child of children) {
2369
+ if (count >= MAX_SUB_ELEMENT_SOURCES) break;
2370
+ if (!(child instanceof HTMLElement)) continue;
2371
+ const source = parseDomSource(child);
2372
+ if (!source) continue;
2373
+ const text = ((child.innerText || child.textContent) ?? "").trim();
2374
+ let baseLabel = text.length > 0 && text.length <= 30 ? text.slice(0, 30).toLowerCase().replace(/\s+/g, "_") : child.tagName.toLowerCase();
2375
+ const existing = labelCounts.get(baseLabel) ?? 0;
2376
+ labelCounts.set(baseLabel, existing + 1);
2377
+ const label = existing > 0 ? `${baseLabel}_${existing + 1}` : baseLabel;
2378
+ sources[label] = source;
2379
+ count++;
2380
+ }
2381
+ return sources;
2382
+ }
2234
2383
  function getElementSource(element) {
2235
2384
  const domSource = parseDomSource(element);
2236
2385
  if (domSource) return domSource;
@@ -2253,8 +2402,15 @@ function getElementSource(element) {
2253
2402
  function getElementLocator(element) {
2254
2403
  const elementInfo = getElementInfo(element);
2255
2404
  const domSource = getElementSource(element);
2405
+ const { frames, nearestComponentFiber, elementSourceFile } = getReactComponentInfo(element);
2406
+ const componentName = nearestComponentFiber?.type?.displayName || nearestComponentFiber?.type?.name || void 0;
2407
+ const authoredProps = nearestComponentFiber ? getComponentProps(nearestComponentFiber) : void 0;
2408
+ const classification = classifyComponentFiber(nearestComponentFiber, frames, elementSourceFile);
2409
+ const callSite = nearestComponentFiber ? getCallSiteSource(nearestComponentFiber) : null;
2410
+ const definitionSrc = classification.isComponentPrimitive ? deriveDefinitionSource(frames) : null;
2411
+ const subSources = collectSubElementSources(element);
2256
2412
  return {
2257
- reactStack: getReactComponentStack(element),
2413
+ reactStack: frames,
2258
2414
  domSelector: buildDomSelector(element),
2259
2415
  domContextHtml: buildDomContextHtml(element),
2260
2416
  targetHtml: buildTargetHtml(element),
@@ -2262,36 +2418,80 @@ function getElementLocator(element) {
2262
2418
  tagName: elementInfo.tagName,
2263
2419
  id: elementInfo.id,
2264
2420
  classList: elementInfo.classList,
2265
- domSource: domSource ?? void 0
2421
+ domSource: domSource ?? void 0,
2422
+ reactComponentName: componentName,
2423
+ authoredProps: authoredProps && Object.keys(authoredProps).length > 0 ? authoredProps : void 0,
2424
+ subElementSources: Object.keys(subSources).length > 0 ? subSources : void 0,
2425
+ callSiteSource: callSite ?? void 0,
2426
+ definitionSource: definitionSrc ?? void 0,
2427
+ isComponentPrimitive: nearestComponentFiber || elementSourceFile ? classification.isComponentPrimitive : void 0
2266
2428
  };
2267
2429
  }
2268
2430
  function getLocatorHeader(locator) {
2269
2431
  const primaryFrame = getPrimaryFrame(locator);
2270
- const componentLabel = primaryFrame?.name ? primaryFrame.name : locator.tagName;
2271
- const formattedSource = locator.domSource?.file ? formatSourceLocation(locator.domSource.file, locator.domSource.line, locator.domSource.column) : primaryFrame?.file ? formatSourceLocation(primaryFrame.file, primaryFrame.line, primaryFrame.column) : null;
2272
- return { componentLabel, formattedSource };
2432
+ const componentLabel = locator.reactComponentName ?? primaryFrame?.name ?? locator.tagName;
2433
+ let formattedSource;
2434
+ if (locator.isComponentPrimitive && locator.definitionSource?.file) {
2435
+ formattedSource = formatSourceLocation(
2436
+ locator.definitionSource.file,
2437
+ locator.definitionSource.line,
2438
+ locator.definitionSource.column
2439
+ );
2440
+ } else {
2441
+ formattedSource = locator.domSource?.file ? formatSourceLocation(locator.domSource.file, locator.domSource.line, locator.domSource.column) : primaryFrame?.file ? formatSourceLocation(primaryFrame.file, primaryFrame.line, primaryFrame.column) : null;
2442
+ }
2443
+ const formattedCallSite = locator.callSiteSource?.file ? formatSourceLocation(locator.callSiteSource.file, locator.callSiteSource.line, locator.callSiteSource.column) : null;
2444
+ return { componentLabel, formattedSource, formattedCallSite };
2445
+ }
2446
+ function formatComponentTree(reactStack) {
2447
+ const names = reactStack.map((f) => f.name).filter(Boolean);
2448
+ if (names.length === 0) return null;
2449
+ if (names.length === 1) return names[0];
2450
+ const [component, ...ancestors] = names;
2451
+ return `${component} (in ${ancestors.join(" > ")})`;
2273
2452
  }
2274
2453
  function buildLocatorContextLines(locator, options) {
2275
2454
  const lines = [];
2276
- const { componentLabel, formattedSource } = getLocatorHeader(locator);
2455
+ const { componentLabel, formattedSource, formattedCallSite } = getLocatorHeader(locator);
2277
2456
  const target = (locator.targetHtml || locator.domContextHtml || "").trim();
2278
2457
  const context = locator.domContextHtml?.trim() || "";
2279
- const selector = locator.domSelector?.trim();
2458
+ const path = locator.domSelector?.trim();
2280
2459
  const text = locator.textPreview?.trim();
2281
2460
  lines.push(`@<${componentLabel}>`);
2282
2461
  lines.push("");
2462
+ const tree = formatComponentTree(locator.reactStack);
2463
+ if (tree) {
2464
+ lines.push(`react: ${tree}`);
2465
+ }
2466
+ if (locator.authoredProps && Object.keys(locator.authoredProps).length > 0) {
2467
+ lines.push(`props: ${JSON.stringify(locator.authoredProps)}`);
2468
+ }
2469
+ if (locator.isComponentPrimitive != null) {
2470
+ lines.push(`type: ${locator.isComponentPrimitive ? "component" : "instance"}`);
2471
+ }
2472
+ lines.push(`source: ${formattedSource ?? "(file not available)"}`);
2473
+ if (formattedCallSite && formattedCallSite !== formattedSource) {
2474
+ lines.push(`call-site: ${formattedCallSite}`);
2475
+ }
2476
+ if (locator.subElementSources && Object.keys(locator.subElementSources).length > 0) {
2477
+ lines.push("source-map:");
2478
+ for (const [label, source] of Object.entries(locator.subElementSources)) {
2479
+ lines.push(` - ${label}: ${formatSourceLocation(source.file, source.line, source.column)}`);
2480
+ }
2481
+ }
2482
+ if (path) {
2483
+ lines.push(`path: ${path}`);
2484
+ }
2283
2485
  if (target) {
2486
+ lines.push("");
2284
2487
  lines.push("target:");
2285
2488
  lines.push(target);
2286
2489
  }
2287
2490
  if (!options?.skipContext && context && context !== target) {
2491
+ lines.push("");
2288
2492
  lines.push("context:");
2289
2493
  lines.push(context);
2290
2494
  }
2291
- lines.push(`in ${formattedSource ?? "(file not available)"}`);
2292
- if (selector) {
2293
- lines.push(`selector: ${selector}`);
2294
- }
2295
2495
  if (text) {
2296
2496
  lines.push(`text: ${text}`);
2297
2497
  }
@@ -3088,6 +3288,7 @@ ${buildMoveExportLines(moveIntent).join("\n")}`;
3088
3288
  findTextOwnerAtPoint,
3089
3289
  findTextOwnerByRangeScan,
3090
3290
  flexPropertyToCSSMap,
3291
+ formatComponentTree,
3091
3292
  formatPropertyValue,
3092
3293
  getAllComputedStyles,
3093
3294
  getChildBriefInfo,
@@ -3105,6 +3306,7 @@ ${buildMoveExportLines(moveIntent).join("\n")}`;
3105
3306
  getElementSource,
3106
3307
  getExportContentProfile,
3107
3308
  getFlexDirection,
3309
+ getLocatorHeader,
3108
3310
  getMoveIntentForEdit,
3109
3311
  getOriginalInlineStyles,
3110
3312
  getSelectionColors,