@wordpress/dom 4.40.1-next.v.202602241322.0 → 4.41.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.41.0 (2026-03-04)
6
+
5
7
  ## 4.40.0 (2026-02-18)
6
8
 
7
9
  ## 4.39.0 (2026-01-29)
@@ -38,14 +38,17 @@ var import_get_computed_style = __toESM(require("./get-computed-style.cjs"));
38
38
  function hiddenCaretRangeFromPoint(doc, x, y, container) {
39
39
  const originalZIndex = container.style.zIndex;
40
40
  const originalPosition = container.style.position;
41
+ const originalBorderRadius = container.style.borderRadius;
41
42
  const { position = "static" } = (0, import_get_computed_style.default)(container);
42
43
  if (position === "static") {
43
44
  container.style.position = "relative";
44
45
  }
45
46
  container.style.zIndex = "10000";
47
+ container.style.borderRadius = "0";
46
48
  const range = (0, import_caret_range_from_point.default)(doc, x, y);
47
49
  container.style.zIndex = originalZIndex;
48
50
  container.style.position = originalPosition;
51
+ container.style.borderRadius = originalBorderRadius;
49
52
  return range;
50
53
  }
51
54
  //# sourceMappingURL=hidden-caret-range-from-point.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dom/hidden-caret-range-from-point.js"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\n\treturn range;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oCAAgC;AAChC,gCAA6B;AAcd,SAAR,0BAA4C,KAAK,GAAG,GAAG,WAAY;AACzE,QAAM,iBAAiB,UAAU,MAAM;AACvC,QAAM,mBAAmB,UAAU,MAAM;AAEzC,QAAM,EAAE,WAAW,SAAS,QAAI,0BAAAA,SAAkB,SAAU;AAG5D,MAAK,aAAa,UAAW;AAC5B,cAAU,MAAM,WAAW;AAAA,EAC5B;AAEA,YAAU,MAAM,SAAS;AAEzB,QAAM,YAAQ,8BAAAC,SAAqB,KAAK,GAAG,CAAE;AAE7C,YAAU,MAAM,SAAS;AACzB,YAAU,MAAM,WAAW;AAE3B,SAAO;AACR;",
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\tconst originalBorderRadius = container.style.borderRadius;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\t// When an element has border radius, the x/y coordinates can incorrectly fall\n\t// outside the element because of the radius. Temporarily reset the value\n\t// to ensure the coordinates are tested against a rectangle and not a pill-shaped\n\t// element. See https://github.com/WordPress/gutenberg/issues/72053 for more info.\n\tcontainer.style.borderRadius = '0';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\tcontainer.style.borderRadius = originalBorderRadius;\n\n\treturn range;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oCAAgC;AAChC,gCAA6B;AAcd,SAAR,0BAA4C,KAAK,GAAG,GAAG,WAAY;AACzE,QAAM,iBAAiB,UAAU,MAAM;AACvC,QAAM,mBAAmB,UAAU,MAAM;AACzC,QAAM,uBAAuB,UAAU,MAAM;AAE7C,QAAM,EAAE,WAAW,SAAS,QAAI,0BAAAA,SAAkB,SAAU;AAG5D,MAAK,aAAa,UAAW;AAC5B,cAAU,MAAM,WAAW;AAAA,EAC5B;AAEA,YAAU,MAAM,SAAS;AAMzB,YAAU,MAAM,eAAe;AAE/B,QAAM,YAAQ,8BAAAC,SAAqB,KAAK,GAAG,CAAE;AAE7C,YAAU,MAAM,SAAS;AACzB,YAAU,MAAM,WAAW;AAC3B,YAAU,MAAM,eAAe;AAE/B,SAAO;AACR;",
6
6
  "names": ["getComputedStyle", "caretRangeFromPoint"]
7
7
  }
@@ -4,14 +4,17 @@ import getComputedStyle from "./get-computed-style.mjs";
4
4
  function hiddenCaretRangeFromPoint(doc, x, y, container) {
5
5
  const originalZIndex = container.style.zIndex;
6
6
  const originalPosition = container.style.position;
7
+ const originalBorderRadius = container.style.borderRadius;
7
8
  const { position = "static" } = getComputedStyle(container);
8
9
  if (position === "static") {
9
10
  container.style.position = "relative";
10
11
  }
11
12
  container.style.zIndex = "10000";
13
+ container.style.borderRadius = "0";
12
14
  const range = caretRangeFromPoint(doc, x, y);
13
15
  container.style.zIndex = originalZIndex;
14
16
  container.style.position = originalPosition;
17
+ container.style.borderRadius = originalBorderRadius;
15
18
  return range;
16
19
  }
17
20
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dom/hidden-caret-range-from-point.js"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\n\treturn range;\n}\n"],
5
- "mappings": ";AAGA,OAAO,yBAAyB;AAChC,OAAO,sBAAsB;AAcd,SAAR,0BAA4C,KAAK,GAAG,GAAG,WAAY;AACzE,QAAM,iBAAiB,UAAU,MAAM;AACvC,QAAM,mBAAmB,UAAU,MAAM;AAEzC,QAAM,EAAE,WAAW,SAAS,IAAI,iBAAkB,SAAU;AAG5D,MAAK,aAAa,UAAW;AAC5B,cAAU,MAAM,WAAW;AAAA,EAC5B;AAEA,YAAU,MAAM,SAAS;AAEzB,QAAM,QAAQ,oBAAqB,KAAK,GAAG,CAAE;AAE7C,YAAU,MAAM,SAAS;AACzB,YAAU,MAAM,WAAW;AAE3B,SAAO;AACR;",
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\tconst originalBorderRadius = container.style.borderRadius;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\t// When an element has border radius, the x/y coordinates can incorrectly fall\n\t// outside the element because of the radius. Temporarily reset the value\n\t// to ensure the coordinates are tested against a rectangle and not a pill-shaped\n\t// element. See https://github.com/WordPress/gutenberg/issues/72053 for more info.\n\tcontainer.style.borderRadius = '0';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\tcontainer.style.borderRadius = originalBorderRadius;\n\n\treturn range;\n}\n"],
5
+ "mappings": ";AAGA,OAAO,yBAAyB;AAChC,OAAO,sBAAsB;AAcd,SAAR,0BAA4C,KAAK,GAAG,GAAG,WAAY;AACzE,QAAM,iBAAiB,UAAU,MAAM;AACvC,QAAM,mBAAmB,UAAU,MAAM;AACzC,QAAM,uBAAuB,UAAU,MAAM;AAE7C,QAAM,EAAE,WAAW,SAAS,IAAI,iBAAkB,SAAU;AAG5D,MAAK,aAAa,UAAW;AAC5B,cAAU,MAAM,WAAW;AAAA,EAC5B;AAEA,YAAU,MAAM,SAAS;AAMzB,YAAU,MAAM,eAAe;AAE/B,QAAM,QAAQ,oBAAqB,KAAK,GAAG,CAAE;AAE7C,YAAU,MAAM,SAAS;AACzB,YAAU,MAAM,WAAW;AAC3B,YAAU,MAAM,eAAe;AAE/B,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/hidden-caret-range-from-point.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,uDAPW,QAAQ,KACR,MAAM,KACN,MAAM,aACN,WAAW,GAET,KAAK,OAAA,CAqBjB"}
1
+ {"version":3,"file":"hidden-caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/hidden-caret-range-from-point.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,uDAPW,QAAQ,KACR,MAAM,KACN,MAAM,aACN,WAAW,GAET,KAAK,OAAA,CA6BjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dom",
3
- "version": "4.40.1-next.v.202602241322.0+bce7cff88",
3
+ "version": "4.41.0",
4
4
  "description": "DOM utilities module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -45,10 +45,10 @@
45
45
  "types": "build-types",
46
46
  "sideEffects": false,
47
47
  "dependencies": {
48
- "@wordpress/deprecated": "^4.40.1-next.v.202602241322.0+bce7cff88"
48
+ "@wordpress/deprecated": "^4.41.0"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "943dde7f0b600ce238726c36284bc9f70ce0ffa4"
53
+ "gitHead": "8bfc179b9aed74c0a6dd6e8edf7a49e40e4f87cc"
54
54
  }
@@ -19,6 +19,7 @@ import getComputedStyle from './get-computed-style';
19
19
  export default function hiddenCaretRangeFromPoint( doc, x, y, container ) {
20
20
  const originalZIndex = container.style.zIndex;
21
21
  const originalPosition = container.style.position;
22
+ const originalBorderRadius = container.style.borderRadius;
22
23
 
23
24
  const { position = 'static' } = getComputedStyle( container );
24
25
 
@@ -29,10 +30,17 @@ export default function hiddenCaretRangeFromPoint( doc, x, y, container ) {
29
30
 
30
31
  container.style.zIndex = '10000';
31
32
 
33
+ // When an element has border radius, the x/y coordinates can incorrectly fall
34
+ // outside the element because of the radius. Temporarily reset the value
35
+ // to ensure the coordinates are tested against a rectangle and not a pill-shaped
36
+ // element. See https://github.com/WordPress/gutenberg/issues/72053 for more info.
37
+ container.style.borderRadius = '0';
38
+
32
39
  const range = caretRangeFromPoint( doc, x, y );
33
40
 
34
41
  container.style.zIndex = originalZIndex;
35
42
  container.style.position = originalPosition;
43
+ container.style.borderRadius = originalBorderRadius;
36
44
 
37
45
  return range;
38
46
  }