made-refine 0.2.10 → 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/utils.mjs CHANGED
@@ -602,8 +602,7 @@ function detectSizingMode(element, dimension) {
602
602
  }
603
603
  function getSizingValue(element, dimension) {
604
604
  const mode = detectSizingMode(element, dimension);
605
- const rect = element.getBoundingClientRect();
606
- const numericValue = Math.round(dimension === "width" ? rect.width : rect.height);
605
+ const numericValue = Math.round(dimension === "width" ? element.offsetWidth : element.offsetHeight);
607
606
  return {
608
607
  mode,
609
608
  value: {
@@ -2208,6 +2207,35 @@ function buildLocatorContextLines(locator, options) {
2208
2207
  function buildElementContext(locator) {
2209
2208
  return buildLocatorContextLines(locator).join("\n");
2210
2209
  }
2210
+ function hasSessionEditChanges(edit) {
2211
+ return Object.keys(edit.pendingStyles).length > 0 || Boolean(edit.textEdit) || Boolean(edit.move);
2212
+ }
2213
+ function partitionMultiSelectedEdits(elements, sessionEditsRef) {
2214
+ const editsWithChanges = [];
2215
+ const contextBlocks = [];
2216
+ for (const el of elements) {
2217
+ if (!el.isConnected) continue;
2218
+ const edit = sessionEditsRef.current.get(el);
2219
+ if (edit && hasSessionEditChanges(edit)) {
2220
+ editsWithChanges.push(edit);
2221
+ } else {
2222
+ contextBlocks.push(buildElementContext(getElementLocator(el)));
2223
+ }
2224
+ }
2225
+ return { editsWithChanges, contextBlocks };
2226
+ }
2227
+ function getContextOnlyBlocks(selectedElements, sessionItems) {
2228
+ if (selectedElements.length <= 1) return [];
2229
+ const sessionElementSet = new Set(
2230
+ sessionItems.filter((i) => i.type === "edit").map((i) => i.edit.element)
2231
+ );
2232
+ const blocks = [];
2233
+ for (const el of selectedElements) {
2234
+ if (!el.isConnected || sessionElementSet.has(el)) continue;
2235
+ blocks.push(buildElementContext(getElementLocator(el)));
2236
+ }
2237
+ return blocks;
2238
+ }
2211
2239
  var spacingGroups = [
2212
2240
  { top: "padding-top", right: "padding-right", bottom: "padding-bottom", left: "padding-left", all: "padding", inline: "padding-inline", block: "padding-block" },
2213
2241
  { top: "margin-top", right: "margin-right", bottom: "margin-bottom", left: "margin-left", all: "margin", inline: "margin-inline", block: "margin-block" }
@@ -2880,7 +2908,7 @@ function buildExportInstruction(profile) {
2880
2908
  return hasComments ? "Address this feedback on the UI. Use the provided source location and selector to find each element in the codebase." : "";
2881
2909
  }
2882
2910
  const parts = [];
2883
- if (hasCssEdits) parts.push("Apply the CSS changes to the targeted elements using the project's existing styling approach (Tailwind, CSS modules, etc.).");
2911
+ 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.");
2884
2912
  if (hasTextEdits) parts.push("Update the text content as specified.");
2885
2913
  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.");
2886
2914
  if (hasComments) parts.push("Address the comments on the relevant elements.");
@@ -2975,6 +3003,7 @@ export {
2975
3003
  getComputedSizing,
2976
3004
  getComputedStyles,
2977
3005
  getComputedTypography,
3006
+ getContextOnlyBlocks,
2978
3007
  getDimensionDisplay,
2979
3008
  getElementDisplayName,
2980
3009
  getElementInfo,
@@ -2986,6 +3015,7 @@ export {
2986
3015
  getOriginalInlineStyles,
2987
3016
  getSelectionColors,
2988
3017
  getSizingValue,
3018
+ hasSessionEditChanges,
2989
3019
  isFlexContainer,
2990
3020
  isInFlowChild,
2991
3021
  isInputFocused,
@@ -2993,6 +3023,7 @@ export {
2993
3023
  isTextElement2 as isTextElement,
2994
3024
  parseColorValue,
2995
3025
  parsePropertyValue,
3026
+ partitionMultiSelectedEdits,
2996
3027
  propertyToCSSMap,
2997
3028
  resolveElementTarget,
2998
3029
  sizingPropertyToCSSMap,