PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/rich-text/index.js +272 -223 24.0.0 → trunk View file →
@@ -257,10 +257,10 @@
257 257 if (keys1.length !== keys2.length) {
258 258 return false;
259 259 }
260 260 const length = keys1.length;
261 - for (let i2 = 0; i2 < length; i2++) {
262 - const name = keys1[i2];
261 + for (let i = 0; i < length; i++) {
262 + const name = keys1[i];
263 263 if (attributes1[name] !== attributes2[name]) {
264 264 return false;
265 265 }
266 266 }
@@ -397,11 +397,11 @@
397 397 return EMPTY_ACTIVE_FORMATS3;
398 398 }
399 399 const selectedFormats = formats.slice(start, end);
400 400 const _activeFormats = [...selectedFormats[0]];
401 - let i2 = selectedFormats.length;
402 - while (i2--) {
403 - const formatsAtIndex = selectedFormats[i2];
401 + let i = selectedFormats.length;
402 + while (i--) {
403 + const formatsAtIndex = selectedFormats[i];
404 404 if (!formatsAtIndex) {
405 405 return EMPTY_ACTIVE_FORMATS3;
406 406 }
407 407 let ii = _activeFormats.length;
@@ -489,11 +489,11 @@
489 489 object: formatType.object,
490 490 attributes: restoreOnAttributes(elementAttributes, isEditableTree)
491 491 };
492 492 }
493 - function isEqualUntil(a2, b2, index) {
493 + function isEqualUntil(a, b, index) {
494 494 do {
495 - if (a2[index] !== b2[index]) {
495 + if (a[index] !== b[index]) {
496 496 return false;
497 497 }
498 498 } while (index--);
499 499 return true;
@@ -521,15 +521,15 @@
521 521 const deepestActiveFormat = activeFormats[activeFormats.length - 1];
522 522 let lastCharacterFormats;
523 523 let lastCharacter;
524 524 append3(tree, "");
525 - for (let i2 = 0; i2 < formatsLength; i2++) {
526 - const character = text.charAt(i2);
525 + for (let i = 0; i < formatsLength; i++) {
526 + const character = text.charAt(i);
527 527 const shouldInsertPadding = isEditableTree && // Pad the line if the line is empty.
528 528 (!lastCharacter || // Pad the line if the previous character is a line break, otherwise
529 529 // the line break won't be visible.
530 530 lastCharacter === "\n");
531 - const characterFormats = formats[i2];
531 + const characterFormats = formats[i];
532 532 let pointer = getLastChild3(tree);
533 533 if (characterFormats) {
534 534 characterFormats.forEach((format, formatIndex) => {
535 535 if (pointer && lastCharacterFormats && // Reuse the last element if all formats remain the same.
@@ -560,9 +560,9 @@
560 560 }
561 561 pointer = append3(newNode, "");
562 562 });
563 563 }
564 - if (i2 === 0) {
564 + if (i === 0) {
565 565 if (onStartIndex && start === 0) {
566 566 onStartIndex(tree, pointer);
567 567 }
568 568 if (onEndIndex && end === 0) {
@@ -569,9 +569,9 @@
569 569 onEndIndex(tree, pointer);
570 570 }
571 571 }
572 572 if (character === OBJECT_REPLACEMENT_CHARACTER) {
573 - const replacement = replacements[i2];
573 + const replacement = replacements[i];
574 574 if (!replacement) {
575 575 continue;
576 576 }
577 577 const { type, attributes, innerHTML } = replacement;
@@ -608,9 +608,9 @@
608 608 const attrs = {
609 609 contenteditable: "false",
610 610 "data-rich-text-bogus": true
611 611 };
612 - if (start === i2 && end === i2 + 1) {
612 + if (start === i && end === i + 1) {
613 613 attrs["data-rich-text-format-boundary"] = true;
614 614 }
615 615 pointer = append3(pointer, {
616 616 type: "span",
@@ -615,9 +615,9 @@
615 615 pointer = append3(pointer, {
616 616 type: "span",
617 617 attributes: attrs
618 618 });
619 - if (isEditableTree && i2 + 1 === text.length) {
619 + if (isEditableTree && i + 1 === text.length) {
620 620 append3(getParent3(pointer), ZWNBSP);
621 621 }
622 622 }
623 623 pointer = append3(
@@ -657,16 +657,16 @@
657 657 pointer = append3(getParent3(pointer), character);
658 658 } else {
659 659 appendText3(pointer, character);
660 660 }
661 - if (onStartIndex && start === i2 + 1) {
661 + if (onStartIndex && start === i + 1) {
662 662 onStartIndex(tree, pointer);
663 663 }
664 - if (onEndIndex && end === i2 + 1) {
664 + if (onEndIndex && end === i + 1) {
665 665 onEndIndex(tree, pointer);
666 666 }
667 - if (shouldInsertPadding && i2 === text.length) {
668 - append3(getParent3(pointer), ZWNBSP);
667 + if (shouldInsertPadding && i === text.length) {
668 + appendText3(pointer, ZWNBSP);
669 669 if (placeholder && text.length === 0) {
670 670 append3(getParent3(pointer), {
671 671 type: "span",
672 672 attributes: {
@@ -986,9 +986,9 @@
986 986 }
987 987 function collapseWhiteSpace(element, isRoot = true, hasPrecedingSpace = false, hasTrailingSpace = false) {
988 988 const clone = element.cloneNode(true);
989 989 clone.normalize();
990 - Array.from(clone.childNodes).forEach((node, i2, nodes) => {
990 + Array.from(clone.childNodes).forEach((node, i, nodes) => {
991 991 if (node.nodeType === node.TEXT_NODE) {
992 992 let newNodeValue = node.nodeValue;
993 993 if (/[\n\t\r\f]/.test(newNodeValue)) {
994 994 newNodeValue = newNodeValue.replace(/[\n\t\r\f]+/g, " ");
@@ -995,12 +995,12 @@
995 995 }
996 996 if (newNodeValue.indexOf(" ") !== -1) {
997 997 newNodeValue = newNodeValue.replace(/ {2,}/g, " ");
998 998 }
999 - if (i2 === 0 && newNodeValue.startsWith(" ") && (isRoot || hasPrecedingSpace)) {
999 + if (i === 0 && newNodeValue.startsWith(" ") && (isRoot || hasPrecedingSpace)) {
1000 1000 newNodeValue = newNodeValue.slice(1);
1001 1001 }
1002 - if (i2 === nodes.length - 1 && newNodeValue.endsWith(" ") && (isRoot || hasTrailingSpace)) {
1002 + if (i === nodes.length - 1 && newNodeValue.endsWith(" ") && (isRoot || hasTrailingSpace)) {
1003 1003 newNodeValue = newNodeValue.slice(0, -1);
1004 1004 }
1005 1005 node.nodeValue = newNodeValue;
1006 1006 } else if (node.nodeType === node.ELEMENT_NODE) {
@@ -1163,10 +1163,10 @@
1163 1163 return;
1164 1164 }
1165 1165 const length = element.attributes.length;
1166 1166 let accumulator;
1167 - for (let i2 = 0; i2 < length; i2++) {
1168 - const { name, value } = element.attributes[i2];
1167 + for (let i = 0; i < length; i++) {
1168 + const { name, value } = element.attributes[i];
1169 1169 if (name.indexOf("data-rich-text-") === 0) {
1170 1170 continue;
1171 1171 }
1172 1172 const safeName = /^on/i.test(name) ? "data-disable-rich-text-" + name : name;
@@ -1176,13 +1176,13 @@
1176 1176 return accumulator;
1177 1177 }
1178 1178
1179 1179 // packages/rich-text/build-module/concat.mjs
1180 - function mergePair(a2, b2) {
1181 - a2.formats = a2.formats.concat(b2.formats);
1182 - a2.replacements = a2.replacements.concat(b2.replacements);
1183 - a2.text += b2.text;
1184 - return a2;
1180 + function mergePair(a, b) {
1181 + a.formats = a.formats.concat(b.formats);
1182 + a.replacements = a.replacements.concat(b.replacements);
1183 + a.text += b.text;
1184 + return a;
1185 1185 }
1186 1186 function concat(...values) {
1187 1187 return normaliseFormats(values.reduce(mergePair, create()));
1188 1188 }
@@ -1338,11 +1338,11 @@
1338 1338 endIndex++;
1339 1339 }
1340 1340 }
1341 1341 } else {
1342 - for (let i2 = startIndex; i2 < endIndex; i2++) {
1343 - if (newFormats[i2]) {
1344 - filterFormats(newFormats, i2, formatType);
1342 + for (let i = startIndex; i < endIndex; i++) {
1343 + if (newFormats[i]) {
1344 + filterFormats(newFormats, i, formatType);
1345 1345 }
1346 1346 }
1347 1347 }
1348 1348 return normaliseFormats({
@@ -1494,10 +1494,10 @@
1494 1494 return [before, after];
1495 1495 }
1496 1496
1497 1497 // packages/rich-text/build-module/is-range-equal.mjs
1498 - function isRangeEqual(a2, b2) {
1499 - return a2 === b2 || a2 && b2 && a2.startContainer === b2.startContainer && a2.startOffset === b2.startOffset && a2.endContainer === b2.endContainer && a2.endOffset === b2.endOffset;
1498 + function isRangeEqual(a, b) {
1499 + return a === b || a && b && a.startContainer === b.startContainer && a.startOffset === b.startOffset && a.endContainer === b.endContainer && a.endOffset === b.endOffset;
1500 1500 }
1501 1501
1502 1502 // packages/rich-text/build-module/to-dom.mjs
1503 1503 var MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
@@ -1502,13 +1502,13 @@
1502 1502 // packages/rich-text/build-module/to-dom.mjs
1503 1503 var MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
1504 1504 function createPathToNode(node, rootNode, path) {
1505 1505 const parentNode = node.parentNode;
1506 - let i2 = 0;
1506 + let i = 0;
1507 1507 while (node = node.previousSibling) {
1508 - i2++;
1508 + i++;
1509 1509 }
1510 - path = [i2, ...path];
1510 + path = [i, ...path];
1511 1511 if (parentNode !== rootNode) {
1512 1512 path = createPathToNode(parentNode, rootNode, path);
1513 1513 }
1514 1514 return path;
@@ -1642,12 +1642,12 @@
1642 1642 applySelection(selection, current);
1643 1643 }
1644 1644 }
1645 1645 function applyValue(future, current) {
1646 - let i2 = 0;
1646 + let i = 0;
1647 1647 let futureChild;
1648 1648 while (futureChild = future.firstChild) {
1649 - const currentChild = current.childNodes[i2];
1649 + const currentChild = current.childNodes[i];
1650 1650 if (!currentChild) {
1651 1651 current.appendChild(futureChild);
1652 1652 } else if (!currentChild.isEqualNode(futureChild)) {
1653 1653 if (currentChild.nodeName !== futureChild.nodeName || currentChild.nodeType === currentChild.TEXT_NODE && currentChild.data !== futureChild.data) {
@@ -1677,12 +1677,12 @@
1677 1677 }
1678 1678 } else {
1679 1679 future.removeChild(futureChild);
1680 1680 }
1681 - i2++;
1681 + i++;
1682 1682 }
1683 - while (current.childNodes[i2]) {
1684 - current.removeChild(current.childNodes[i2]);
1683 + while (current.childNodes[i]) {
1684 + current.removeChild(current.childNodes[i]);
1685 1685 }
1686 1686 }
1687 1687 function applySelection({ startPath, endPath }, current) {
1688 1688 const { node: startContainer, offset: startOffset } = getNodeByPath(
@@ -1754,23 +1754,8 @@
1754 1754 var import_compose8 = __toESM(require_compose(), 1);
1755 1755 var import_data9 = __toESM(require_data(), 1);
1756 1756 var import_deprecated = __toESM(require_deprecated(), 1);
1757 1757
1758 - // packages/rich-text/build-module/owns-selection.mjs
1759 - function ownsSelection(element) {
1760 - const { ownerDocument } = element;
1761 - const { activeElement } = ownerDocument;
1762 - if (activeElement === element) {
1763 - return true;
1764 - }
1765 - if (!activeElement || activeElement.contentEditable !== "true" || element.contentEditable !== "true" || !activeElement.contains(element)) {
1766 - return false;
1767 - }
1768 - const selection = ownerDocument.defaultView.getSelection();
1769 - const { anchorNode, focusNode } = selection;
1770 - return !!anchorNode && !!focusNode && element.contains(anchorNode) && element.contains(focusNode);
1771 - }
1772 -
1773 1758 // packages/rich-text/build-module/hook/use-default-style.mjs
1774 1759 var import_element = __toESM(require_element(), 1);
1775 1760 var whiteSpace = "pre-wrap";
1776 1761 function useDefaultStyle() {
@@ -1782,163 +1767,176 @@
1782 1767 }, []);
1783 1768 }
1784 1769
1785 1770 // node_modules/colord/index.mjs
1786 - var r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
1787 - var t = function(r2) {
1771 + for (r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, t = function(r2) {
1788 1772 return "string" == typeof r2 ? r2.length > 0 : "number" == typeof r2;
1789 - };
1790 - var n = function(r2, t2, n2) {
1773 + }, n = function(r2, t2, n2) {
1791 1774 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r2) / n2 + 0;
1792 - };
1793 - var e = function(r2, t2, n2) {
1775 + }, u = function(r2, t2, n2) {
1794 1776 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r2 > n2 ? n2 : r2 > t2 ? r2 : t2;
1795 - };
1796 - var u = function(r2) {
1797 - return (r2 = isFinite(r2) ? r2 % 360 : 0) > 0 ? r2 : r2 + 360;
1798 - };
1799 - var a = function(r2) {
1800 - return { r: e(r2.r, 0, 255), g: e(r2.g, 0, 255), b: e(r2.b, 0, 255), a: e(r2.a) };
1801 - };
1802 - var o = function(r2) {
1777 + }, e = function(r2) {
1778 + return (r2 = isFinite(r2) ? r2 % 360 : 0) < 0 ? r2 + 360 : r2;
1779 + }, o = function(r2, t2) {
1780 + return void 0 === t2 && (t2 = 0), n(r2, t2) % 360;
1781 + }, a = function(r2) {
1782 + return { r: u(r2.r, 0, 255), g: u(r2.g, 0, 255), b: u(r2.b, 0, 255), a: u(r2.a) };
1783 + }, i = function(r2) {
1803 1784 return { r: n(r2.r), g: n(r2.g), b: n(r2.b), a: n(r2.a, 3) };
1785 + }, s = /^#([0-9a-f]{3,8})$/i, d = function(r2, t2) {
1786 + var n2 = r2.charCodeAt(t2);
1787 + return (15 & n2) + 9 * (n2 >> 6);
1788 + }, h = function(r2, t2) {
1789 + return d(r2, t2) << 4 | d(r2, t2 + 1);
1790 + }, b = [], f = 0; f < 256; f++) b.push((f < 16 ? "0" : "") + f.toString(16));
1791 + var r;
1792 + var t;
1793 + var n;
1794 + var u;
1795 + var e;
1796 + var o;
1797 + var a;
1798 + var i;
1799 + var s;
1800 + var d;
1801 + var h;
1802 + var b;
1803 + var f;
1804 + var g = function(r) {
1805 + return b[u(r, 0, 255)];
1804 1806 };
1805 - var i = /^#([0-9a-f]{3,8})$/i;
1806 - var s = function(r2) {
1807 - var t2 = r2.toString(16);
1808 - return t2.length < 2 ? "0" + t2 : t2;
1807 + var c = function(r) {
1808 + var t = r.r, n = r.g, u = r.b, e = r.a, o = Math.max(t, n, u), a = o - Math.min(t, n, u), i = a ? o === t ? (n - u) / a : o === n ? 2 + (u - t) / a : 4 + (t - n) / a : 0;
1809 + return { h: 60 * (i < 0 ? i + 6 : i), s: o ? a / o * 100 : 0, v: o / 255 * 100, a: e };
1809 1810 };
1810 - var h = function(r2) {
1811 - var t2 = r2.r, n2 = r2.g, e2 = r2.b, u2 = r2.a, a2 = Math.max(t2, n2, e2), o2 = a2 - Math.min(t2, n2, e2), i2 = o2 ? a2 === t2 ? (n2 - e2) / o2 : a2 === n2 ? 2 + (e2 - t2) / o2 : 4 + (t2 - n2) / o2 : 0;
1812 - return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o2 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 };
1811 + var v = function(r) {
1812 + var t = r.h, n = r.s, u = r.v, e = r.a;
1813 + t = t / 360 * 6, n /= 100, u /= 100;
1814 + var o = Math.floor(t), a = u * (1 - n), i = u * (1 - (t - o) * n), s = u * (1 - (1 - t + o) * n), d = o % 6;
1815 + return { r: 255 * [u, i, a, a, s, u][d], g: 255 * [s, u, u, i, a, a][d], b: 255 * [a, a, s, u, u, i][d], a: e };
1813 1816 };
1814 - var b = function(r2) {
1815 - var t2 = r2.h, n2 = r2.s, e2 = r2.v, u2 = r2.a;
1816 - t2 = t2 / 360 * 6, n2 /= 100, e2 /= 100;
1817 - var a2 = Math.floor(t2), o2 = e2 * (1 - n2), i2 = e2 * (1 - (t2 - a2) * n2), s2 = e2 * (1 - (1 - t2 + a2) * n2), h2 = a2 % 6;
1818 - return { r: 255 * [e2, i2, o2, o2, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o2, o2][h2], b: 255 * [o2, o2, s2, e2, e2, i2][h2], a: u2 };
1817 + var l = function(r) {
1818 + return { h: e(r.h), s: u(r.s, 0, 100), l: u(r.l, 0, 100), a: u(r.a) };
1819 1819 };
1820 - var g = function(r2) {
1821 - return { h: u(r2.h), s: e(r2.s, 0, 100), l: e(r2.l, 0, 100), a: e(r2.a) };
1820 + var p = function(r) {
1821 + return { h: o(r.h), s: n(r.s), l: n(r.l), a: n(r.a, 3) };
1822 1822 };
1823 - var d = function(r2) {
1824 - return { h: n(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) };
1823 + var m = function(r) {
1824 + return v((n = (t = r).s, { h: t.h, s: (n *= ((u = t.l) < 50 ? u : 100 - u) / 100) > 0 ? 2 * n / (u + n) * 100 : 0, v: u + n, a: t.a }));
1825 + var t, n, u;
1825 1826 };
1826 - var f = function(r2) {
1827 - return b((n2 = (t2 = r2).s, { h: t2.h, s: (n2 *= ((e2 = t2.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t2.a }));
1828 - var t2, n2, e2;
1827 + var y = function(r) {
1828 + return { h: (t = c(r)).h, s: (e = (200 - (n = t.s)) * (u = t.v) / 100) > 0 && e < 200 ? n * u / 100 / (e <= 100 ? e : 200 - e) * 100 : 0, l: e / 2, a: t.a };
1829 + var t, n, u, e;
1829 1830 };
1830 - var c = function(r2) {
1831 - return { h: (t2 = h(r2)).h, s: (u2 = (200 - (n2 = t2.s)) * (e2 = t2.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t2.a };
1832 - var t2, n2, e2, u2;
1833 - };
1834 - var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
1835 - var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
1836 - var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
1837 - var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
1838 - var y = { string: [[function(r2) {
1839 - var t2 = i.exec(r2);
1840 - return t2 ? (r2 = t2[1]).length <= 4 ? { r: parseInt(r2[0] + r2[0], 16), g: parseInt(r2[1] + r2[1], 16), b: parseInt(r2[2] + r2[2], 16), a: 4 === r2.length ? n(parseInt(r2[3] + r2[3], 16) / 255, 2) : 1 } : 6 === r2.length || 8 === r2.length ? { r: parseInt(r2.substr(0, 2), 16), g: parseInt(r2.substr(2, 2), 16), b: parseInt(r2.substr(4, 2), 16), a: 8 === r2.length ? n(parseInt(r2.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
1841 - }, "hex"], [function(r2) {
1842 - var t2 = v.exec(r2) || m.exec(r2);
1843 - return t2 ? t2[2] !== t2[4] || t2[4] !== t2[6] ? null : a({ r: Number(t2[1]) / (t2[2] ? 100 / 255 : 1), g: Number(t2[3]) / (t2[4] ? 100 / 255 : 1), b: Number(t2[5]) / (t2[6] ? 100 / 255 : 1), a: void 0 === t2[7] ? 1 : Number(t2[7]) / (t2[8] ? 100 : 1) }) : null;
1844 - }, "rgb"], [function(t2) {
1845 - var n2 = l.exec(t2) || p.exec(t2);
1846 - if (!n2) return null;
1847 - var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) });
1848 - return f(a2);
1849 - }, "hsl"]], object: [[function(r2) {
1850 - var n2 = r2.r, e2 = r2.g, u2 = r2.b, o2 = r2.a, i2 = void 0 === o2 ? 1 : o2;
1851 - return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null;
1852 - }, "rgb"], [function(r2) {
1853 - var n2 = r2.h, e2 = r2.s, u2 = r2.l, a2 = r2.a, o2 = void 0 === a2 ? 1 : a2;
1854 - if (!t(n2) || !t(e2) || !t(u2)) return null;
1855 - var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o2) });
1856 - return f(i2);
1857 - }, "hsl"], [function(r2) {
1858 - var n2 = r2.h, a2 = r2.s, o2 = r2.v, i2 = r2.a, s2 = void 0 === i2 ? 1 : i2;
1859 - if (!t(n2) || !t(a2) || !t(o2)) return null;
1860 - var h2 = (function(r3) {
1861 - return { h: u(r3.h), s: e(r3.s, 0, 100), v: e(r3.v, 0, 100), a: e(r3.a) };
1862 - })({ h: Number(n2), s: Number(a2), v: Number(o2), a: Number(s2) });
1863 - return b(h2);
1831 + var N = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
1832 + var x = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
1833 + var M = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
1834 + var H = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
1835 + var $ = { string: [[function(r) {
1836 + if (!s.test(r)) return null;
1837 + var t = r.length;
1838 + return t <= 5 ? { r: 17 * d(r, 1), g: 17 * d(r, 2), b: 17 * d(r, 3), a: 5 === t ? n(17 * d(r, 4) / 255, 2) : 1 } : 7 === t || 9 === t ? { r: h(r, 1), g: h(r, 3), b: h(r, 5), a: 9 === t ? n(h(r, 7) / 255, 2) : 1 } : null;
1839 + }, "hex"], [function(r) {
1840 + var t = M.exec(r) || H.exec(r);
1841 + return t ? t[2] !== t[4] || t[4] !== t[6] ? null : a({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: void 0 === t[7] ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
1842 + }, "rgb"], [function(t) {
1843 + var n = N.exec(t) || x.exec(t);
1844 + if (!n) return null;
1845 + var u, e, o = l({ h: (u = n[1], e = n[2], void 0 === e && (e = "deg"), Number(u) * (r[e] || 1)), s: Number(n[3]), l: Number(n[4]), a: void 0 === n[5] ? 1 : Number(n[5]) / (n[6] ? 100 : 1) });
1846 + return m(o);
1847 + }, "hsl"]], object: [[function(r) {
1848 + var n = r.r, u = r.g, e = r.b, o = r.a, i = void 0 === o ? 1 : o;
1849 + return t(n) && t(u) && t(e) ? a({ r: Number(n), g: Number(u), b: Number(e), a: Number(i) }) : null;
1850 + }, "rgb"], [function(r) {
1851 + var n = r.h, u = r.s, e = r.l, o = r.a, a = void 0 === o ? 1 : o;
1852 + if (!t(n) || !t(u) || !t(e)) return null;
1853 + var i = l({ h: Number(n), s: Number(u), l: Number(e), a: Number(a) });
1854 + return m(i);
1855 + }, "hsl"], [function(r) {
1856 + var n = r.h, o = r.s, a = r.v, i = r.a, s = void 0 === i ? 1 : i;
1857 + if (!t(n) || !t(o) || !t(a)) return null;
1858 + var d = (function(r2) {
1859 + return { h: e(r2.h), s: u(r2.s, 0, 100), v: u(r2.v, 0, 100), a: u(r2.a) };
1860 + })({ h: Number(n), s: Number(o), v: Number(a), a: Number(s) });
1861 + return v(d);
1864 1862 }, "hsv"]] };
1865 - var N = function(r2, t2) {
1866 - for (var n2 = 0; n2 < t2.length; n2++) {
1867 - var e2 = t2[n2][0](r2);
1868 - if (e2) return [e2, t2[n2][1]];
1863 + var j = function(r, t) {
1864 + for (var n = 0; n < t.length; n++) {
1865 + var u = t[n][0](r);
1866 + if (u) return [u, t[n][1]];
1869 1867 }
1870 1868 return [null, void 0];
1871 1869 };
1872 - var x = function(r2) {
1873 - return "string" == typeof r2 ? N(r2.trim(), y.string) : "object" == typeof r2 && null !== r2 ? N(r2, y.object) : [null, void 0];
1870 + var w = function(r) {
1871 + return "string" == typeof r ? j(r.trim(), $.string) : "object" == typeof r && null !== r ? j(r, $.object) : [null, void 0];
1874 1872 };
1875 - var M = function(r2, t2) {
1876 - var n2 = c(r2);
1877 - return { h: n2.h, s: e(n2.s + 100 * t2, 0, 100), l: n2.l, a: n2.a };
1873 + var k = function(r, t) {
1874 + var n = y(r);
1875 + return { h: n.h, s: u(n.s + 100 * t, 0, 100), l: n.l, a: n.a };
1878 1876 };
1879 - var H = function(r2) {
1880 - return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255;
1877 + var E = function(r) {
1878 + return (299 * r.r + 587 * r.g + 114 * r.b) / 1e3 / 255;
1881 1879 };
1882 - var $ = function(r2, t2) {
1883 - var n2 = c(r2);
1884 - return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t2, 0, 100), a: n2.a };
1880 + var R = function(r, t) {
1881 + var n = y(r);
1882 + return { h: n.h, s: n.s, l: u(n.l + 100 * t, 0, 100), a: n.a };
1885 1883 };
1886 - var j = (function() {
1887 - function r2(r3) {
1888 - this.parsed = x(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
1884 + var q = (function() {
1885 + function r(r2) {
1886 + this.parsed = w(r2)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
1889 1887 }
1890 - return r2.prototype.isValid = function() {
1888 + return r.prototype.isValid = function() {
1891 1889 return null !== this.parsed;
1892 - }, r2.prototype.brightness = function() {
1893 - return n(H(this.rgba), 2);
1894 - }, r2.prototype.isDark = function() {
1895 - return H(this.rgba) < 0.5;
1896 - }, r2.prototype.isLight = function() {
1897 - return H(this.rgba) >= 0.5;
1898 - }, r2.prototype.toHex = function() {
1899 - return r3 = o(this.rgba), t2 = r3.r, e2 = r3.g, u2 = r3.b, i2 = (a2 = r3.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t2) + s(e2) + s(u2) + i2;
1900 - var r3, t2, e2, u2, a2, i2;
1901 - }, r2.prototype.toRgb = function() {
1902 - return o(this.rgba);
1903 - }, r2.prototype.toRgbString = function() {
1904 - return r3 = o(this.rgba), t2 = r3.r, n2 = r3.g, e2 = r3.b, (u2 = r3.a) < 1 ? "rgba(" + t2 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t2 + ", " + n2 + ", " + e2 + ")";
1905 - var r3, t2, n2, e2, u2;
1906 - }, r2.prototype.toHsl = function() {
1907 - return d(c(this.rgba));
1908 - }, r2.prototype.toHslString = function() {
1909 - return r3 = d(c(this.rgba)), t2 = r3.h, n2 = r3.s, e2 = r3.l, (u2 = r3.a) < 1 ? "hsla(" + t2 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t2 + ", " + n2 + "%, " + e2 + "%)";
1910 - var r3, t2, n2, e2, u2;
1911 - }, r2.prototype.toHsv = function() {
1912 - return r3 = h(this.rgba), { h: n(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) };
1913 - var r3;
1914 - }, r2.prototype.invert = function() {
1915 - return w({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a });
1916 - var r3;
1917 - }, r2.prototype.saturate = function(r3) {
1918 - return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, r3));
1919 - }, r2.prototype.desaturate = function(r3) {
1920 - return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, -r3));
1921 - }, r2.prototype.grayscale = function() {
1922 - return w(M(this.rgba, -1));
1923 - }, r2.prototype.lighten = function(r3) {
1924 - return void 0 === r3 && (r3 = 0.1), w($(this.rgba, r3));
1925 - }, r2.prototype.darken = function(r3) {
1926 - return void 0 === r3 && (r3 = 0.1), w($(this.rgba, -r3));
1927 - }, r2.prototype.rotate = function(r3) {
1928 - return void 0 === r3 && (r3 = 15), this.hue(this.hue() + r3);
1929 - }, r2.prototype.alpha = function(r3) {
1930 - return "number" == typeof r3 ? w({ r: (t2 = this.rgba).r, g: t2.g, b: t2.b, a: r3 }) : n(this.rgba.a, 3);
1931 - var t2;
1932 - }, r2.prototype.hue = function(r3) {
1933 - var t2 = c(this.rgba);
1934 - return "number" == typeof r3 ? w({ h: r3, s: t2.s, l: t2.l, a: t2.a }) : n(t2.h);
1935 - }, r2.prototype.isEqual = function(r3) {
1936 - return this.toHex() === w(r3).toHex();
1937 - }, r2;
1890 + }, r.prototype.brightness = function() {
1891 + return n(E(this.rgba), 2);
1892 + }, r.prototype.isDark = function() {
1893 + return E(this.rgba) < 0.5;
1894 + }, r.prototype.isLight = function() {
1895 + return E(this.rgba) >= 0.5;
1896 + }, r.prototype.toHex = function() {
1897 + return r2 = i(this.rgba), t = r2.r, u = r2.g, e = r2.b, a = (o = r2.a) < 1 ? g(n(255 * o)) : "", "#" + g(t) + g(u) + g(e) + a;
1898 + var r2, t, u, e, o, a;
1899 + }, r.prototype.toRgb = function() {
1900 + return i(this.rgba);
1901 + }, r.prototype.toRgbString = function() {
1902 + return r2 = i(this.rgba), t = r2.r, n = r2.g, u = r2.b, (e = r2.a) < 1 ? "rgba(" + t + ", " + n + ", " + u + ", " + e + ")" : "rgb(" + t + ", " + n + ", " + u + ")";
1903 + var r2, t, n, u, e;
1904 + }, r.prototype.toHsl = function() {
1905 + return p(y(this.rgba));
1906 + }, r.prototype.toHslString = function() {
1907 + return r2 = p(y(this.rgba)), t = r2.h, n = r2.s, u = r2.l, (e = r2.a) < 1 ? "hsla(" + t + ", " + n + "%, " + u + "%, " + e + ")" : "hsl(" + t + ", " + n + "%, " + u + "%)";
1908 + var r2, t, n, u, e;
1909 + }, r.prototype.toHsv = function() {
1910 + return r2 = c(this.rgba), { h: o(r2.h), s: n(r2.s), v: n(r2.v), a: n(r2.a, 3) };
1911 + var r2;
1912 + }, r.prototype.invert = function() {
1913 + return A({ r: 255 - (r2 = this.rgba).r, g: 255 - r2.g, b: 255 - r2.b, a: r2.a });
1914 + var r2;
1915 + }, r.prototype.saturate = function(r2) {
1916 + return void 0 === r2 && (r2 = 0.1), A(k(this.rgba, r2));
1917 + }, r.prototype.desaturate = function(r2) {
1918 + return void 0 === r2 && (r2 = 0.1), A(k(this.rgba, -r2));
1919 + }, r.prototype.grayscale = function() {
1920 + return A(k(this.rgba, -1));
1921 + }, r.prototype.lighten = function(r2) {
1922 + return void 0 === r2 && (r2 = 0.1), A(R(this.rgba, r2));
1923 + }, r.prototype.darken = function(r2) {
1924 + return void 0 === r2 && (r2 = 0.1), A(R(this.rgba, -r2));
1925 + }, r.prototype.rotate = function(r2) {
1926 + return void 0 === r2 && (r2 = 15), this.hue(y(this.rgba).h + r2);
1927 + }, r.prototype.alpha = function(r2) {
1928 + return "number" == typeof r2 ? A({ r: (t = this.rgba).r, g: t.g, b: t.b, a: r2 }) : n(this.rgba.a, 3);
1929 + var t;
1930 + }, r.prototype.hue = function(r2) {
1931 + var t = y(this.rgba);
1932 + return "number" == typeof r2 ? A({ h: r2, s: t.s, l: t.l, a: t.a }) : o(t.h);
1933 + }, r.prototype.isEqual = function(r2) {
1934 + return this.toHex() === A(r2).toHex();
1935 + }, r;
1938 1936 })();
1939 - var w = function(r2) {
1940 - return r2 instanceof j ? r2 : new j(r2);
1937 + var A = function(r) {
1938 + return r instanceof q ? r : new q(r);
1941 1939 };
1942 1940
1943 1941 // packages/rich-text/build-module/hook/use-boundary-style.mjs
1944 1942 var import_element2 = __toESM(require_element(), 1);
@@ -1957,10 +1955,10 @@
1957 1955 }
1958 1956 const { ownerDocument } = element;
1959 1957 const { defaultView } = ownerDocument;
1960 1958 const computedStyle = defaultView.getComputedStyle(element);
1961 - const newColor = w(computedStyle.color).alpha(0.2).toRgbString();
1962 - const selector = `.rich-text:focus ${boundarySelector}`;
1959 + const newColor = A(computedStyle.color).alpha(0.2).toRgbString();
1960 + const selector = `[contenteditable="true"]:focus ${boundarySelector}`;
1963 1961 const rule = `background-color: ${newColor}`;
1964 1962 const style = `${selector} {${rule}}`;
1965 1963 const globalStyleId = "rich-text-boundary-style";
1966 1964 let globalStyle = ownerDocument.getElementById(globalStyleId);
@@ -1981,8 +1979,25 @@
1981 1979 var import_compose7 = __toESM(require_compose(), 1);
1982 1980
1983 1981 // packages/rich-text/build-module/hook/event-listeners/copy-handler.mjs
1984 1982 var import_compose = __toESM(require_compose(), 1);
1983 +
1984 + // packages/rich-text/build-module/owns-selection.mjs
1985 + function ownsSelection(element) {
1986 + const { ownerDocument } = element;
1987 + const { activeElement } = ownerDocument;
1988 + if (activeElement === element) {
1989 + return true;
1990 + }
1991 + if (!activeElement || activeElement.contentEditable !== "true" || element.contentEditable !== "true" || !activeElement.contains(element)) {
1992 + return false;
1993 + }
1994 + const selection = ownerDocument.defaultView.getSelection();
1995 + const { anchorNode, focusNode } = selection;
1996 + return !!anchorNode && !!focusNode && element.contains(anchorNode) && element.contains(focusNode);
1997 + }
1998 +
1999 + // packages/rich-text/build-module/hook/event-listeners/copy-handler.mjs
1985 2000 var { subscribeDelegatedListener } = unlock(import_compose.privateApis);
1986 2001 var copy_handler_default = (props) => (element) => {
1987 2002 function onCopy(event) {
1988 2003 const { record, handleChange } = props.current;
@@ -2247,8 +2262,15 @@
2247 2262 var input_and_selection_default = (props) => (element) => {
2248 2263 const { ownerDocument } = element;
2249 2264 const { defaultView } = ownerDocument;
2250 2265 let isComposing = false;
2266 + let isPointerDown = false;
2267 + function onPointerDown() {
2268 + isPointerDown = true;
2269 + }
2270 + function onPointerUp() {
2271 + isPointerDown = false;
2272 + }
2251 2273 function onInput(event) {
2252 2274 if (isComposing) {
2253 2275 return;
2254 2276 }
@@ -2351,9 +2373,8 @@
2351 2373 } else {
2352 2374 selection.collapse(element, 0);
2353 2375 }
2354 2376 }
2355 - window.queueMicrotask(handleSelectionChange);
2356 2377 return;
2357 2378 }
2358 2379 if (!isSelected) {
2359 2380 const index = void 0;
@@ -2363,9 +2384,9 @@
2363 2384 end: index,
2364 2385 activeFormats: EMPTY_ACTIVE_FORMATS2
2365 2386 };
2366 2387 selectionSnapshot = void 0;
2367 - } else {
2388 + } else if (!isPointerDown) {
2368 2389 applyRecord(record.current);
2369 2390 }
2370 2391 onSelectionChange(record.current.start, record.current.end);
2371 2392 window.queueMicrotask(handleSelectionChange);
@@ -2391,8 +2412,23 @@
2391 2412 element,
2392 2413 "focusin",
2393 2414 onFocus
2394 2415 );
2416 + const unsubscribePointerDown = subscribeDelegatedListener4(
2417 + element,
2418 + "pointerdown",
2419 + onPointerDown
2420 + );
2421 + const unsubscribePointerUp = subscribeDelegatedListener4(
2422 + defaultView,
2423 + "pointerup",
2424 + onPointerUp
2425 + );
2426 + const unsubscribePointerCancel = subscribeDelegatedListener4(
2427 + defaultView,
2428 + "pointercancel",
2429 + onPointerUp
2430 + );
2395 2431 const unsubscribeSelectionChange = subscribeOwnedListener(
2396 2432 element,
2397 2433 "selectionchange",
2398 2434 handleSelectionChange
@@ -2415,8 +2451,11 @@
2415 2451 unsubscribeInput();
2416 2452 unsubscribeCompositionStart();
2417 2453 unsubscribeCompositionEnd();
2418 2454 unsubscribeFocus();
2455 + unsubscribePointerDown();
2456 + unsubscribePointerUp();
2457 + unsubscribePointerCancel();
2419 2458 unsubscribeSelectionChange();
2420 2459 unsubscribeEnsureSelectionSync.forEach(
2421 2460 (unsubscribe) => unsubscribe()
2422 2461 );
@@ -2486,16 +2525,23 @@
2486 2525 }
2487 2526 if (!event.target.contains(element)) {
2488 2527 return;
2489 2528 }
2529 + if (!event.target.closest("[data-block]")) {
2530 + return;
2531 + }
2490 2532 value = element.getAttribute("contenteditable");
2533 + defaultView.getSelection().removeAllRanges();
2491 2534 element.setAttribute("contenteditable", "false");
2492 - defaultView.getSelection().removeAllRanges();
2493 2535 }
2494 2536 function onPointerUp() {
2495 2537 if (value !== null) {
2496 2538 element.setAttribute("contenteditable", value);
2497 2539 value = null;
2540 + const selection = defaultView.getSelection();
2541 + if (selection.isCollapsed && element.contains(selection.anchorNode)) {
2542 + selection.removeAllRanges();
2543 + }
2498 2544 }
2499 2545 }
2500 2546 const unsubscribePointerDown = subscribeDelegatedListener6(
2501 2547 defaultView,
@@ -2673,8 +2719,12 @@
2673 2719 };
2674 2720 }
2675 2721
2676 2722 // packages/rich-text/build-module/hook/index.mjs
2723 + function hasFocus(element) {
2724 + const { activeElement } = element.ownerDocument;
2725 + return activeElement === element || activeElement?.contentEditable === "true" && activeElement.contains(element);
2726 + }
2677 2727 function useRichTextBase({
2678 2728 value = "",
2679 2729 selectionStart,
2680 2730 selectionEnd,
@@ -2739,14 +2789,11 @@
2739 2789 }
2740 2790 recordRef.current.start = selectionStart;
2741 2791 recordRef.current.end = selectionEnd;
2742 2792 }
2743 - const hadSelectionUpdateRef = (0, import_element5.useRef)(false);
2744 2793 if (!recordRef.current) {
2745 - hadSelectionUpdateRef.current = isSelected;
2746 2794 setRecordFromProps();
2747 2795 } else if (selectionStart !== recordRef.current.start || selectionEnd !== recordRef.current.end) {
2748 - hadSelectionUpdateRef.current = isSelected;
2749 2796 recordRef.current = {
2750 2797 ...recordRef.current,
2751 2798 start: selectionStart,
2752 2799 end: selectionEnd,
@@ -2752,8 +2799,13 @@
2752 2799 end: selectionEnd,
2753 2800 activeFormats: void 0
2754 2801 };
2755 2802 }
2803 + const sentSelectionRef = (0, import_element5.useRef)([]);
2804 + function sendSelection(start, end) {
2805 + sentSelectionRef.current = [start, end];
2806 + onSelectionChange(start, end);
2807 + }
2756 2808 function handleChange(newRecord) {
2757 2809 recordRef.current = newRecord;
2758 2810 applyRecord(newRecord);
2759 2811 if (disableFormats) {
@@ -2771,9 +2823,9 @@
2771 2823 }
2772 2824 }
2773 2825 const { start, end, formats, text } = recordRef.current;
2774 2826 registry.batch(() => {
2775 - onSelectionChange(start, end);
2827 + sendSelection(start, end);
2776 2828 onChange(_valueRef.current, {
2777 2829 __unstableFormats: formats,
2778 2830 __unstableText: text
2779 2831 });
@@ -2779,33 +2831,25 @@
2779 2831 });
2780 2832 });
2781 2833 forceRender();
2782 2834 }
2783 - function applyFromProps() {
2784 - const previousValue = _valueRef.current;
2785 - setRecordFromProps();
2786 - const contentLengthChanged = previousValue && typeof previousValue === "string" && typeof value === "string" && previousValue.length !== value.length;
2787 - const hasFocus = ref.current?.contains(ref.current.ownerDocument.activeElement) || ownsSelection(ref.current);
2788 - const skipSelection = contentLengthChanged && !hasFocus;
2789 - applyRecord(recordRef.current, { domOnly: skipSelection });
2790 - }
2791 - const didMountRef = (0, import_element5.useRef)(false);
2792 2835 (0, import_element5.useLayoutEffect)(() => {
2793 - if (didMountRef.current && value !== _valueRef.current) {
2794 - applyFromProps();
2795 - forceRender();
2836 + if (value === _valueRef.current) {
2837 + return;
2796 2838 }
2839 + setRecordFromProps();
2840 + applyRecord(recordRef.current, {
2841 + domOnly: !hasFocus(ref.current)
2842 + });
2843 + forceRender();
2797 2844 }, [value]);
2798 2845 (0, import_element5.useLayoutEffect)(() => {
2799 - if (!hadSelectionUpdateRef.current) {
2800 - return;
2846 + const [sentStart, sentEnd] = sentSelectionRef.current;
2847 + sentSelectionRef.current = [];
2848 + if (isSelected && (selectionStart !== sentStart || selectionEnd !== sentEnd) && hasFocus(ref.current)) {
2849 + applyRecord(recordRef.current);
2801 2850 }
2802 - if (ref.current.ownerDocument.activeElement !== ref.current && !ownsSelection(ref.current)) {
2803 - ref.current.focus();
2804 - }
2805 - applyRecord(recordRef.current);
2806 - hadSelectionUpdateRef.current = false;
2807 - }, [hadSelectionUpdateRef.current]);
2851 + }, [selectionStart, selectionEnd, isSelected]);
2808 2852 const mergedRefs = (0, import_compose8.useMergeRefs)([
2809 2853 ref,
2810 2854 useDefaultStyle(),
2811 2855 useBoundaryStyle({ record: recordRef }),
@@ -2814,15 +2858,20 @@
2814 2858 handleChange,
2815 2859 applyRecord,
2816 2860 createRecord,
2817 2861 isSelected,
2818 - onSelectionChange,
2862 + onSelectionChange: sendSelection,
2819 2863 forceRender
2820 2864 }),
2821 - (0, import_compose8.useRefEffect)(() => {
2822 - applyFromProps();
2823 - didMountRef.current = true;
2824 - }, [placeholder, ...__unstableDependencies])
2865 + (0, import_compose8.useRefEffect)(
2866 + (element) => {
2867 + setRecordFromProps();
2868 + applyRecord(recordRef.current, {
2869 + domOnly: !hasFocus(element)
2870 + });
2871 + },
2872 + [placeholder, ...__unstableDependencies]
2873 + )
2825 2874 ]);
2826 2875 return {
2827 2876 value: recordRef.current,
2828 2877 // A function to get the most recent value so event handlers in