made-refine 0.2.11 → 0.2.13

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.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { D as DragState, a as DropIndicator, S as SelectElementOptions, b as SelectElementsOptions, c as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, d as BorderPropertyKey, e as BorderProperties, F as FlexPropertyKey, f as SizingPropertyKey, g as SizingValue, h as SizingChangeOptions, i as ColorPropertyKey, j as ColorValue, T as TypographyPropertyKey, A as ActiveTool, k as Theme, l as BorderStyleControlPreference, m as DirectEditState, n as SessionEdit, o as SessionItem, p as CanvasElementKind, q as TypographyProperties, M as MeasurementLine, G as Guideline, r as Comment } from './utils-Dn_oW8f_.mjs';
4
- export { s as BorderRadiusProperties, t as BorderStyle, u as ColorProperties, v as CommentReply, w as DomSourceLocation, x as DropTarget, E as ElementInfo, y as ElementLocator, z as FlexProperties, H as MeasurementState, R as ReactComponentFrame, I as SizingChangePhase, J as SizingMode, K as SizingProperties, L as SpacingProperties, U as UndoEditEntry, N as UndoEntry, O as UndoMoveEntry, P as UndoSelectionEntry, Q as buildCommentExport, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, _ as colorToTailwind, $ as elementFromPointWithoutOverlays, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, a2 as formatPropertyValue, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, a6 as getComputedStyles, a7 as getDimensionDisplay, a8 as getElementInfo, a9 as getElementLocator, aa as getFlexDirection, ab as isFlexContainer, ac as isLayoutContainer, ad as parseColorValue, ae as parsePropertyValue, af as stylesToTailwind } from './utils-Dn_oW8f_.mjs';
3
+ import { D as DragState, a as DropIndicator, S as SelectElementOptions, b as SelectElementsOptions, c as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, d as BorderPropertyKey, e as BorderProperties, F as FlexPropertyKey, f as SizingPropertyKey, g as SizingValue, h as SizingChangeOptions, i as ColorPropertyKey, j as ColorValue, T as TypographyPropertyKey, A as ActiveTool, k as Theme, l as BorderStyleControlPreference, m as DirectEditState, n as SessionEdit, o as SessionItem, p as CanvasElementKind, q as TypographyProperties, M as MeasurementLine, G as Guideline, r as Comment } from './utils-DvJ3xKrO.mjs';
4
+ export { s as BorderRadiusProperties, t as BorderStyle, u as ColorProperties, v as CommentReply, w as DomSourceLocation, x as DropTarget, E as ElementInfo, y as ElementLocator, z as FlexProperties, H as MeasurementState, R as ReactComponentFrame, I as SizingChangePhase, J as SizingMode, K as SizingProperties, L as SpacingProperties, U as UndoEditEntry, N as UndoEntry, O as UndoMoveEntry, P as UndoSelectionEntry, Q as buildCommentExport, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, _ as colorToTailwind, $ as elementFromPointWithoutOverlays, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, a2 as formatPropertyValue, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, a6 as getComputedStyles, a7 as getDimensionDisplay, a8 as getElementInfo, a9 as getElementLocator, aa as getFlexDirection, ab as isFlexContainer, ac as isLayoutContainer, ad as parseColorValue, ae as parsePropertyValue, af as stylesToTailwind } from './utils-DvJ3xKrO.mjs';
5
5
 
6
6
  declare function DirectEdit(): react_jsx_runtime.JSX.Element;
7
7
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { D as DragState, a as DropIndicator, S as SelectElementOptions, b as SelectElementsOptions, c as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, d as BorderPropertyKey, e as BorderProperties, F as FlexPropertyKey, f as SizingPropertyKey, g as SizingValue, h as SizingChangeOptions, i as ColorPropertyKey, j as ColorValue, T as TypographyPropertyKey, A as ActiveTool, k as Theme, l as BorderStyleControlPreference, m as DirectEditState, n as SessionEdit, o as SessionItem, p as CanvasElementKind, q as TypographyProperties, M as MeasurementLine, G as Guideline, r as Comment } from './utils-Dn_oW8f_.js';
4
- export { s as BorderRadiusProperties, t as BorderStyle, u as ColorProperties, v as CommentReply, w as DomSourceLocation, x as DropTarget, E as ElementInfo, y as ElementLocator, z as FlexProperties, H as MeasurementState, R as ReactComponentFrame, I as SizingChangePhase, J as SizingMode, K as SizingProperties, L as SpacingProperties, U as UndoEditEntry, N as UndoEntry, O as UndoMoveEntry, P as UndoSelectionEntry, Q as buildCommentExport, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, _ as colorToTailwind, $ as elementFromPointWithoutOverlays, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, a2 as formatPropertyValue, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, a6 as getComputedStyles, a7 as getDimensionDisplay, a8 as getElementInfo, a9 as getElementLocator, aa as getFlexDirection, ab as isFlexContainer, ac as isLayoutContainer, ad as parseColorValue, ae as parsePropertyValue, af as stylesToTailwind } from './utils-Dn_oW8f_.js';
3
+ import { D as DragState, a as DropIndicator, S as SelectElementOptions, b as SelectElementsOptions, c as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, d as BorderPropertyKey, e as BorderProperties, F as FlexPropertyKey, f as SizingPropertyKey, g as SizingValue, h as SizingChangeOptions, i as ColorPropertyKey, j as ColorValue, T as TypographyPropertyKey, A as ActiveTool, k as Theme, l as BorderStyleControlPreference, m as DirectEditState, n as SessionEdit, o as SessionItem, p as CanvasElementKind, q as TypographyProperties, M as MeasurementLine, G as Guideline, r as Comment } from './utils-DvJ3xKrO.js';
4
+ export { s as BorderRadiusProperties, t as BorderStyle, u as ColorProperties, v as CommentReply, w as DomSourceLocation, x as DropTarget, E as ElementInfo, y as ElementLocator, z as FlexProperties, H as MeasurementState, R as ReactComponentFrame, I as SizingChangePhase, J as SizingMode, K as SizingProperties, L as SpacingProperties, U as UndoEditEntry, N as UndoEntry, O as UndoMoveEntry, P as UndoSelectionEntry, Q as buildCommentExport, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, _ as colorToTailwind, $ as elementFromPointWithoutOverlays, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, a2 as formatPropertyValue, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, a6 as getComputedStyles, a7 as getDimensionDisplay, a8 as getElementInfo, a9 as getElementLocator, aa as getFlexDirection, ab as isFlexContainer, ac as isLayoutContainer, ad as parseColorValue, ae as parsePropertyValue, af as stylesToTailwind } from './utils-DvJ3xKrO.js';
5
5
 
6
6
  declare function DirectEdit(): react_jsx_runtime.JSX.Element;
7
7
 
package/dist/index.js CHANGED
@@ -2980,7 +2980,7 @@ function buildExportInstruction(profile) {
2980
2980
  return hasComments ? "Address this feedback on the UI. Use the provided source location and selector to find each element in the codebase." : "";
2981
2981
  }
2982
2982
  const parts = [];
2983
- if (hasCssEdits) parts.push("Apply the CSS changes to the targeted elements using the project's existing styling approach (Tailwind, CSS modules, etc.).");
2983
+ if (hasCssEdits) parts.push("Apply the CSS changes to the targeted elements using the project's existing styling approach (Tailwind, CSS modules, etc.). Map values to existing CSS variables, design tokens, or utility classes already used in the project whenever possible.");
2984
2984
  if (hasTextEdits) parts.push("Update the text content as specified.");
2985
2985
  if (hasMoves) parts.push("Implement the move plan below directly in source code. For `structural_move`, reorder/reparent elements using the target anchors. For `layout_refactor`, apply the listed flex/grid refactor steps. Do NOT simulate movement with absolute positioning, left/top offsets, transform, or margin hacks.");
2986
2986
  if (hasComments) parts.push("Address the comments on the relevant elements.");
@@ -3692,11 +3692,6 @@ function useStyleUpdaters({
3692
3692
  var React3 = __toESM(require("react"));
3693
3693
 
3694
3694
  // src/clipboard.ts
3695
- function buildAgentClipboardText(markdown) {
3696
- return `implement the visual edits
3697
-
3698
- ${markdown}`;
3699
- }
3700
3695
  function tryRestoreFocus(element) {
3701
3696
  if (!(element instanceof HTMLElement)) return;
3702
3697
  try {
@@ -5394,6 +5389,12 @@ async function checkAgentConnection() {
5394
5389
  }
5395
5390
 
5396
5391
  // src/use-agent-comms.ts
5392
+ function withInstruction(profile, markdown) {
5393
+ const instruction = buildExportInstruction(profile);
5394
+ return instruction ? `${instruction}
5395
+
5396
+ ${markdown}` : markdown;
5397
+ }
5397
5398
  function buildLocatorPayload(locator) {
5398
5399
  return {
5399
5400
  element: {
@@ -5486,6 +5487,11 @@ function useAgentComms({ stateRef, sessionEditsRef, getSessionItems, saveCurrent
5486
5487
  const movePlan = includeBatchMoveEnvelope ? resolvedPlanContext.movePlan : null;
5487
5488
  const hasMeaningfulPayload = changes.length > 0 || sessionEdit.textEdit != null || moveIntent != null;
5488
5489
  if (!hasMeaningfulPayload) return true;
5490
+ const profile = getExportContentProfile(
5491
+ [sessionEdit],
5492
+ [],
5493
+ resolvedPlanContext
5494
+ );
5489
5495
  try {
5490
5496
  const result = await sendEditToAgent({
5491
5497
  ...buildLocatorPayload(locator),
@@ -5493,7 +5499,7 @@ function useAgentComms({ stateRef, sessionEditsRef, getSessionItems, saveCurrent
5493
5499
  textChange: sessionEdit.textEdit ?? null,
5494
5500
  moveIntent,
5495
5501
  ...movePlan ? { movePlan } : {},
5496
- exportMarkdown
5502
+ exportMarkdown: withInstruction(profile, exportMarkdown)
5497
5503
  });
5498
5504
  if (result.ok) {
5499
5505
  removeSessionEdit(sessionEdit.element);
@@ -5505,12 +5511,13 @@ function useAgentComms({ stateRef, sessionEditsRef, getSessionItems, saveCurrent
5505
5511
  }, [updateAgentAvailability, removeSessionEdit]);
5506
5512
  const sendSessionCommentToAgent = React5.useCallback(async (comment) => {
5507
5513
  const exportMarkdown = buildCommentExport(comment.locator, comment.text, comment.replies);
5514
+ const commentProfile = { hasCssEdits: false, hasTextEdits: false, hasMoves: false, hasComments: true };
5508
5515
  try {
5509
5516
  const result = await sendCommentToAgent({
5510
5517
  ...buildLocatorPayload(comment.locator),
5511
5518
  commentText: comment.text,
5512
5519
  replies: comment.replies,
5513
- exportMarkdown
5520
+ exportMarkdown: withInstruction(commentProfile, exportMarkdown)
5514
5521
  });
5515
5522
  if (result.ok) {
5516
5523
  deleteComment(comment.id);
@@ -5530,12 +5537,14 @@ function useAgentComms({ stateRef, sessionEditsRef, getSessionItems, saveCurrent
5530
5537
  );
5531
5538
  if (editsWithChanges.length === 0 && contextBlocks.length === 0) return false;
5532
5539
  const markdownParts = [];
5540
+ let movePlanCtx = null;
5533
5541
  if (editsWithChanges.length > 0) {
5534
- const movePlanContext = buildMovePlanContext(editsWithChanges);
5535
- markdownParts.push(buildSessionExport(editsWithChanges, [], { movePlanContext }));
5542
+ movePlanCtx = buildMovePlanContext(editsWithChanges);
5543
+ markdownParts.push(buildSessionExport(editsWithChanges, [], { movePlanContext: movePlanCtx }));
5536
5544
  }
5537
5545
  markdownParts.push(...contextBlocks);
5538
5546
  const exportMarkdown = markdownParts.join("\n\n");
5547
+ const multiProfile = getExportContentProfile(editsWithChanges, [], movePlanCtx);
5539
5548
  const primaryEl = current.selectedElements.find((el) => el.isConnected);
5540
5549
  if (!primaryEl) return false;
5541
5550
  const primary = getElementLocator(primaryEl);
@@ -5545,7 +5554,7 @@ function useAgentComms({ stateRef, sessionEditsRef, getSessionItems, saveCurrent
5545
5554
  changes: [],
5546
5555
  textChange: null,
5547
5556
  moveIntent: null,
5548
- exportMarkdown
5557
+ exportMarkdown: withInstruction(multiProfile, exportMarkdown)
5549
5558
  });
5550
5559
  if (result.ok) {
5551
5560
  for (const el of current.selectedElements) {
@@ -6494,9 +6503,10 @@ function DirectEditProvider({ children }) {
6494
6503
  enterCanvas();
6495
6504
  }
6496
6505
  if (wasActive) {
6506
+ clearSelection();
6497
6507
  closePanel();
6498
6508
  }
6499
- }, [toggleEditModeBase, stateRef, exitCanvas, enterCanvas, closePanel]);
6509
+ }, [toggleEditModeBase, stateRef, exitCanvas, enterCanvas, clearSelection, closePanel]);
6500
6510
  const toggleCanvasWithPreference = React8.useCallback(() => {
6501
6511
  const willBeActive = !stateRef.current.canvas.active;
6502
6512
  toggleCanvas();
@@ -14821,7 +14831,10 @@ function DirectEditDemo() {
14821
14831
  const handleExportEdits = async () => {
14822
14832
  if (Object.keys(pendingStyles).length === 0) return false;
14823
14833
  const exportMarkdown = buildEditExport(DEMO_LOCATOR, pendingStyles);
14824
- return copyText(buildAgentClipboardText(exportMarkdown));
14834
+ const instruction = buildExportInstruction({ hasCssEdits: true, hasTextEdits: false, hasMoves: false, hasComments: false });
14835
+ return copyText(`${instruction}
14836
+
14837
+ ${exportMarkdown}`);
14825
14838
  };
14826
14839
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "min-h-screen p-8", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mx-auto max-w-4xl", children: [
14827
14840
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "mb-2 text-2xl font-bold", children: "Direct Edit Panel" }),