made-refine 0.2.10 → 0.2.11

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" }
@@ -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,