what-core 0.7.0 → 0.8.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/dist/index.js CHANGED
@@ -1726,6 +1726,10 @@ function setProp(el, key, value, isSvg) {
1726
1726
  }
1727
1727
 
1728
1728
  // packages/core/src/render.js
1729
+ var _onTextInsert = null;
1730
+ function _setTextInsertHook(fn) {
1731
+ _onTextInsert = typeof fn === "function" ? fn : null;
1732
+ }
1729
1733
  function _$createComponent(Component, props, children) {
1730
1734
  if (children && children.length > 0) {
1731
1735
  const mergedChildren = children.length === 1 ? children[0] : children;
@@ -1860,6 +1864,7 @@ function insert(parent, child, marker) {
1860
1864
  const m = marker || null;
1861
1865
  if (m) parent.insertBefore(textNode, m);
1862
1866
  else parent.appendChild(textNode);
1867
+ if (_onTextInsert) _onTextInsert(parent, String(first));
1863
1868
  let current2 = textNode;
1864
1869
  let isTextFastPath = true;
1865
1870
  effect(() => {
@@ -1868,6 +1873,7 @@ function insert(parent, child, marker) {
1868
1873
  if (isTextFastPath && (vt === "string" || vt === "number")) {
1869
1874
  const str = String(val);
1870
1875
  if (textNode.data !== str) textNode.data = str;
1876
+ if (_onTextInsert) _onTextInsert(parent, str);
1871
1877
  } else {
1872
1878
  isTextFastPath = false;
1873
1879
  current2 = reconcileInsert(parent, val, current2, m);
@@ -5785,6 +5791,8 @@ var VALID_EXPORTS = /* @__PURE__ */ new Set([
5785
5791
  "onResize",
5786
5792
  "onIntersect",
5787
5793
  "smoothScrollTo",
5794
+ // Text insertion hook (for external text engines)
5795
+ "_setTextInsertHook",
5788
5796
  // Animation
5789
5797
  "spring",
5790
5798
  "tween",
@@ -6015,6 +6023,7 @@ export {
6015
6023
  _$templateImpl as _$template,
6016
6024
  __getCacheSnapshot,
6017
6025
  __setDevToolsHooks,
6026
+ _setTextInsertHook,
6018
6027
  template as _template,
6019
6028
  announce,
6020
6029
  announceAssertive,