@octane-xplat/patches 0.0.0-nightly.g2e22171

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Alec Larson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @octane-xplat/patches
2
+
3
+ The pnpm patch files used by freshly scaffolded Octane-xplat apps. Apps do not
4
+ install this package directly — create templates declare it as a pnpm
5
+ `configDependencies` package so the patches are in place before regular app
6
+ dependencies install.
7
+
8
+ The canonical patch files and their rationale live in
9
+ `packages/cli/patches/manifest.json`. `pnpm sync:patches` generates this
10
+ package's `patches/` directory from that source. Do not edit the copies here
11
+ by hand.
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@octane-xplat/patches",
3
+ "version": "0.0.0-nightly.g2e22171",
4
+ "description": "pnpm config dependency carrying the framework patch files",
5
+ "keywords": [
6
+ "framework",
7
+ "octane",
8
+ "patches",
9
+ "pnpm",
10
+ "xplat"
11
+ ],
12
+ "homepage": "https://github.com/octane-xplat/octane-xplat/tree/main/packages/patches",
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/octane-xplat/octane-xplat",
17
+ "directory": "packages/patches"
18
+ },
19
+ "files": [
20
+ "patches"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "scripts": {}
26
+ }
@@ -0,0 +1,29 @@
1
+ diff --git a/dist/LexicalLink.dev.js b/dist/LexicalLink.dev.js
2
+ index 758326c08edf9018bbe1c571fd3a7f4779449fc2..78736faebb10bf217362e9decca3b2f01832260d 100644
3
+ --- a/dist/LexicalLink.dev.js
4
+ +++ b/dist/LexicalLink.dev.js
5
+ @@ -1406,7 +1406,13 @@ function createLinkMatcherWithRegExp(regExp, urlTransformer = text => text) {
6
+ };
7
+ };
8
+ }
9
+ -const URL_REGEX = /((https?:\/\/(www\.)?)|(www\.))[-\p{L}\p{N}@:%._+~#=]{1,256}\.[\p{L}\p{N}]{1,6}(?:[-\p{L}\p{N}()@:%_+.~#?&//=]*[\p{L}\p{N}()@_~#?&//=])?/u;
10
+ +let URL_REGEX = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(?:[-a-zA-Z0-9()@:%_+.~#?&//=]*[a-zA-Z0-9()@_~#?&//=])?/;
11
+ +try {
12
+ + // \p{} property escapes need ICU, which embedded runtimes
13
+ + // (NativeScript's V8) ship without — the literal form throws at
14
+ + // parse time, so build it dynamically and keep an ASCII fallback.
15
+ + URL_REGEX = new RegExp('((https?:\\/\\/(www\\.)?)|(www\\.))[-\\p{L}\\p{N}@:%._+~#=]{1,256}\\.[\\p{L}\\p{N}]{1,6}(?:[-\\p{L}\\p{N}()@:%_+.~#?&//=]*[\\p{L}\\p{N}()@_~#?&//=])?', 'u');
16
+ +} catch {}
17
+ const EMAIL_REGEX = /(([^<>()[\]\\.,;:\s@"]{1,64}(\.[^<>()[\]\\.,;:\s@"]{1,64}){0,63})|(".{1,255}"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]{1,63}\.){1,127}[a-zA-Z]{2,63}))/;
18
+
19
+ /**
20
+ diff --git a/dist/LexicalLink.prod.js b/dist/LexicalLink.prod.js
21
+ index 455336042df5df4857ea918a92cb03a67b5725a1..a082a7133b5490a8e3c65810e8a465d118bb1cf6 100644
22
+ --- a/dist/LexicalLink.prod.js
23
+ +++ b/dist/LexicalLink.prod.js
24
+ @@ -6,4 +6,4 @@
25
+ *
26
+ */
27
+
28
+ -import{AriaLiveRegionExtension as t}from"@lexical/a11y";import{effect as e}from"@lexical/extension/signals";import{namedSignals as n}from"@lexical/extension/namedSignals";import{getterTableOf as r,setterTableOf as i,setterDefaultOf as l,ElementNode as o,$getDocument as s,addClassNamesToElement as u,isHTMLAnchorElement as a,$copyNode as c,$isRangeSelection as f,$applyNodeReplacement as g,createCommand as d,$getSelection as _,$isNodeSelection as p,$findMatchingParent as h,nodeSchema as m,withField as x,stringValue as y,nullable as v,booleanValue as k,$normalizeSelection__EXPERIMENTAL as b,$setSelection as U,$getChildCaret as S,$isElementNode as T,$insertNodeToNearestRootAtCaret as L,$rewindSiblingCaret as C,$caretFromPoint as A,$normalizeCaret as N,$isSiblingCaret as R,$setPointFromCaret as P,shallowMergeConfig as O,mergeRegister as I,COMMAND_PRIORITY_EDITOR as w,PASTE_COMMAND as F,$isTextNode as D,COMMAND_PRIORITY_LOW as M,registerEventListeners as E,isDOMNode as z,getNearestEditorFromDOMNode as $,$getNearestNodeFromDOMNode as W,TextNode as K,$isLineBreakNode as B,$createTextNode as j}from"lexical";import{sel as J,$distributeInlineWrapper as Z,CoreImportExtension as H,DOMImportExtension as G}from"@lexical/html";import{objectKlassEquals as q}from"@lexical/utils";const Q=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function V(t,e){if("number"==typeof t)return Number.isFinite(t)?t:e;if("string"!=typeof t||!Q.test(t))return e;const n=Number(t);return Number.isFinite(n)?n:e}function X(t,e,n,r,i){const l=V(t,e);return l>=n&&l<=r&&Number.isInteger(l)?l:e}function Y(t,e){t.__rel=e.__rel,t.__target=e.__target,t.__title=e.__title,t.__url=e.__url}const tt=t=>{const e=r(t,"format"),n=i(t,"format"),o=l(t,"format");return{exportJSON:function(t){const n=t.__textFormat,r=t.__textStyle,i=(0!==n||""!==r)&&t.shouldSerializeTextStyles();return{children:[],rel:t.__rel,target:t.__target,title:t.__title,url:t.__url,direction:t.__dir,format:e[t.__format],indent:t.__indent,textFormat:0!==n&&i?n:void 0,textStyle:""!==r&&i?r:void 0,type:t.__type,version:1}},exportCompactJSON:function(t){const n=t.__textFormat,r=t.__textStyle,i=(0!==n||""!==r)&&t.shouldSerializeTextStyles(),l={type:t.__type,children:[]},o=t.__rel;null!=o&&(l.rel=o);const s=t.__target;null!=s&&(l.target=s);const u=t.__title;null!=u&&(l.title=u);const a=t.__url;void 0!==a&&""!==a&&(l.url=a);const c=t.__dir;null!=c&&(l.direction=c);const f=e[t.__format];void 0!==f&&""!==f&&(l.format=f);const g=t.__indent;return void 0!==g&&0!==g&&(l.indent=g),void 0!==n&&0!==n&&i&&(l.textFormat=n),void 0!==r&&""!==r&&i&&(l.textStyle=r),l},updateFromJSON:function(t,e){const r=e.direction;t.__dir=null===r||"ltr"===r||"rtl"===r?r:null;const i=e.format;t.__format="string"==typeof i&&i in n?n[i]:o,t.__indent=X(e.indent,0,0,Infinity),t.__textFormat=V(e.textFormat,0);const l=e.textStyle;t.__textStyle="string"==typeof l?l:"";const s=e.rel;t.__rel="string"==typeof s&&""!==s?s:null;const u=e.target;t.__target="string"==typeof u&&""!==u?u:null;const a=e.title;t.__title="string"==typeof a&&""!==a?a:null;const c=e.url;return t.__url="string"==typeof c?c:"",t},afterCloneFrom:Y}};function et(t,e){t.__isUnlinked=e.__isUnlinked}const nt=t=>{const e=r(t,"format"),n=i(t,"format"),o=l(t,"format");return{exportJSON:function(t){const n=t.__textFormat,r=t.__textStyle,i=(0!==n||""!==r)&&t.shouldSerializeTextStyles();return{children:[],isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title,url:t.__url,direction:t.__dir,format:e[t.__format],indent:t.__indent,textFormat:0!==n&&i?n:void 0,textStyle:""!==r&&i?r:void 0,type:t.__type,version:1}},exportCompactJSON:function(t){const n=t.__textFormat,r=t.__textStyle,i=(0!==n||""!==r)&&t.shouldSerializeTextStyles(),l={type:t.__type,children:[]},o=t.__isUnlinked;void 0!==o&&!1!==o&&(l.isUnlinked=o);const s=t.__rel;null!=s&&(l.rel=s);const u=t.__target;null!=u&&(l.target=u);const a=t.__title;null!=a&&(l.title=a);const c=t.__url;void 0!==c&&""!==c&&(l.url=c);const f=t.__dir;null!=f&&(l.direction=f);const g=e[t.__format];void 0!==g&&""!==g&&(l.format=g);const d=t.__indent;return void 0!==d&&0!==d&&(l.indent=d),void 0!==n&&0!==n&&i&&(l.textFormat=n),void 0!==r&&""!==r&&i&&(l.textStyle=r),l},updateFromJSON:function(t,e){const r=e.direction;t.__dir=null===r||"ltr"===r||"rtl"===r?r:null;const i=e.format;t.__format="string"==typeof i&&i in n?n[i]:o,t.__indent=X(e.indent,0,0,Infinity),t.__textFormat=V(e.textFormat,0);const l=e.textStyle;t.__textStyle="string"==typeof l?l:"";const s=e.rel;t.__rel="string"==typeof s&&""!==s?s:null;const u=e.target;t.__target="string"==typeof u&&""!==u?u:null;const a=e.title;t.__title="string"==typeof a&&""!==a?a:null;const c=e.url;t.__url="string"==typeof c?c:"";const f=e.isUnlinked;return t.__isUnlinked="boolean"==typeof f&&f,t},afterCloneFrom:et}},rt=new Set(["http:","https:","mailto:","sms:","tel:"]),it=/* @__PURE__ */m()({rel:/* @__PURE__ */x(/* @__PURE__ */v(/* @__PURE__ */y(),{defaultAsNull:!0}),{field:"__rel"}),target:/* @__PURE__ */x(/* @__PURE__ */v(/* @__PURE__ */y(),{defaultAsNull:!0}),{field:"__target"}),title:/* @__PURE__ */x(/* @__PURE__ */v(/* @__PURE__ */y(),{defaultAsNull:!0}),{field:"__title"}),url:/* @__PURE__ */x(/* @__PURE__ */y(),{field:"__url",getter:"getURL",setter:"setURL"})});class lt extends o{__url;__target;__rel;__title;$config(){return this.config("link",{extends:o,generated:tt,importDOM:{a:()=>({conversion:at,priority:1})},json:it})}constructor(t="",e={},n){super(n);const{target:r=null,rel:i=null,title:l=null}=e;this.__url=t,this.__target=r,this.__rel=i,this.__title=l}createDOM(t){const e=s().createElement("a");return this.updateLinkDOM(null,e,t),u(e,t.theme.link),e}updateLinkDOM(t,e,n){if(a(e)){t&&t.__url===this.__url||(e.href=this.sanitizeUrl(this.__url));for(const n of["target","rel","title"]){const r=`__${n}`,i=this[r];t&&t[r]===i||(i?e[n]=i:e.removeAttribute(n))}}}updateDOM(t,e,n){return this.updateLinkDOM(t,e,n),!1}sanitizeUrl(t){const e=t;t=vt(t);try{const e=new URL(vt(t));if(!rt.has(e.protocol))return"about:blank"}catch(t){const n=e.replace(/[\u0000-\u001F\u007F\s]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);if(null!=n&&!rt.has(`${n[1].toLowerCase()}:`))return"about:blank"}return t}getURL(){return this.getLatest().__url}setURL(t){const e=this.getWritable();return e.__url=t,e}getTarget(){return this.getLatest().__target}setTarget(t){const e=this.getWritable();return e.__target=t,e}getRel(){return this.getLatest().__rel}setRel(t){const e=this.getWritable();return e.__rel=t,e}getTitle(){return this.getLatest().__title}setTitle(t){const e=this.getWritable();return e.__title=t,e}insertNewAfter(t,e=!0){const n=c(this);return this.insertAfter(n,e),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(t,e,n){if(!f(e))return!1;const r=e.anchor.getNode(),i=e.focus.getNode();return(this.is(r)||this.isParentOf(r))&&(this.is(i)||this.isParentOf(i))&&e.getTextContent().length>0}isEmailURI(){return this.getURL().startsWith("mailto:")}isWebSiteURI(){const t=this.getURL();return t.startsWith("https://")||t.startsWith("http://")}shouldMergeAdjacentLink(t){return this.getType()===t.getType()&&this.getURL()===t.getURL()&&this.getTarget()===t.getTarget()&&this.getRel()===t.getRel()&&this.getTitle()===t.getTitle()}}function ot(t){const e=A(t,"next");return[e,e.getFlipped()]}function st(t,e){for(const n of e)if(n.origin.isAttached()){const e=N(n);return void P(t,e)}}function ut(t){const e=_();let n=null,r=null;function i(){f(e)&&(st(e.anchor,n),st(e.focus,r),b(e))}f(e)&&(n=ot(e.anchor),r=ot(e.focus));let l=!1;for(const e of S(t,"next")){const n=e.origin;if(T(n)&&!n.isInline()){const r=n.getChildren();if(r.length>0){const e=c(t);e.append(...r),n.append(e),l=!0}L(n,C(e),{$shouldSplit:()=>!1})}}function o(t,e,n){const[r,i]=t,l=t=>R(t)&&t.origin.is(e);if(!l(r)&&!l(i))return t;const o=N(S(n,"next"));return[o,o.getFlipped()]}if(t.isAttached()){const e=t.getPreviousSibling();if(ft(e)&&e.shouldMergeAdjacentLink(t))return n&&(n=o(n,e,t)),r&&(r=o(r,e,t)),e.append(...t.getChildren()),t.remove(),void i();const s=t.getNextSibling();ft(s)&&t.shouldMergeAdjacentLink(s)&&(n&&(n=o(n,t,s)),r&&(r=o(r,t,s)),t.append(...s.getChildren()),s.remove(),l=!0)}if(l){if(!t.canBeEmpty()&&t.isEmpty()){const e=t.getParent();t.remove(),e&&e.isEmpty()&&e.remove()}i()}}function at(t){let e=null;if(a(t)){const n=t.textContent;(null!==n&&""!==n||t.children.length>0)&&(e=ct(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function ct(t="",e){return g(new lt(t,e))}function ft(t){return t instanceof lt}const gt=/* @__PURE__ */m()({isUnlinked:/* @__PURE__ */x(/* @__PURE__ */k(),{field:"__isUnlinked"})});class dt extends lt{__isUnlinked;constructor(t="",e={},n){super(t,e,n),this.__isUnlinked=void 0!==e.isUnlinked&&null!==e.isUnlinked&&e.isUnlinked}$config(){return this.config("autolink",{extends:lt,generated:nt,json:gt})}shouldMergeAdjacentLink(t){return!1}getIsUnlinked(){return this.getLatest().__isUnlinked}setIsUnlinked(t){const e=this.getWritable();return e.__isUnlinked=t,e}createDOM(t){return this.__isUnlinked?s().createElement("span"):super.createDOM(t)}updateDOM(t,e,n){return super.updateDOM(t,e,n)||t.__isUnlinked!==this.__isUnlinked}}function _t(t="",e){return g(new dt(t,e))}function pt(t){return t instanceof dt}const ht=/* @__PURE__ */d("TOGGLE_LINK_COMMAND");function mt(t,e){if("element"===t.type){const n=t.getNode();T(n)||function(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252);return n.getChildren()[t.offset+e]||null}return null}function xt(t,e={}){let n;if(t&&"object"==typeof t){const{url:r,...i}=t;n=r,e={...i,...e}}else n=t;const{target:r,title:i}=e,l=void 0===e.rel?"noreferrer":e.rel,o=_();if(null===o||!f(o)&&!p(o))return;if(p(o)){const t=o.getNodes();if(0===t.length)return;return void t.forEach(t=>{if(null===n){const e=h(t,t=>!pt(t)&&ft(t));e&&(e.insertBefore(t),0===e.getChildren().length&&e.remove())}else{const e=h(t,t=>!pt(t)&&ft(t));if(e)e.setURL(n),void 0!==r&&e.setTarget(r),void 0!==l&&e.setRel(l),void 0!==i&&e.setTitle(i);else{const e=ct(n,{rel:l,target:r,title:i});t.insertBefore(e),e.append(t)}}})}if(o.isCollapsed()&&null===n)for(const t of o.getNodes()){const e=h(t,t=>!pt(t)&&ft(t));return void(null!==e&&(e.getParentOrThrow().splice(e.getIndexWithinParent(),0,e.getChildren()),e.remove()))}const s=o.extract();if(null===n){const t=new Set;return void s.forEach(e=>{const n=h(e,t=>!pt(t)&&ft(t));if(null!==n){const e=n.getKey();if(t.has(e))return;!function(t,e){const n=new Set(e.filter(e=>t.isParentOf(e)).map(t=>t.getKey())),r=t.getChildren(),i=r=>n.has(r.getKey())||T(r)&&e.some(e=>t.isParentOf(e)&&r.isParentOf(e)),l=r.filter(i);if(l.length===r.length)return r.forEach(e=>t.insertBefore(e)),void t.remove();const o=r.findIndex(i),s=r.findLastIndex(i),u=0===o,a=s===r.length-1;if(u)l.forEach(e=>t.insertBefore(e));else if(a)for(let e=l.length-1;e>=0;e--)t.insertAfter(l[e]);else{for(let e=l.length-1;e>=0;e--)t.insertAfter(l[e]);const e=r.slice(s+1);if(e.length>0){const n=c(t);l[l.length-1].insertAfter(n),e.forEach(t=>n.append(t))}}}(n,s),t.add(e)}})}const u=new Set,a=t=>{u.has(t.getKey())||(u.add(t.getKey()),t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==l&&t.setRel(l),void 0!==i&&t.setTitle(i))};if(1===s.length){const t=s[0],e=h(t,ft);if(null!==e)return a(e)}!function(t){const e=_();if(!f(e))return t();const n=b(e),r=n.isBackward(),i=mt(n.anchor,r?-1:0),l=mt(n.focus,r?0:-1),o=t();if(i||l){const t=_();if(f(t)){const e=t.clone();if(i){const t=i.getParent();t&&e.anchor.set(t.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(l){const t=l.getParent();t&&e.focus.set(t.getKey(),l.getIndexWithinParent()+(r?0:1),"element")}U(b(e))}}}(()=>{let t=null;for(const e of s){if(!e.isAttached())continue;const o=h(e,ft);if(o){a(o);continue}if(T(e)){if(!e.isInline())continue;if(ft(e)){if(!(pt(e)||null!==t&&t.getParentOrThrow().isParentOf(e))){a(e),t=e;continue}for(const t of e.getChildren())e.insertBefore(t);e.remove();continue}}const s=e.getPreviousSibling();ft(s)&&s.is(t)?s.append(e):(t=ct(n,{rel:l,target:r,title:i}),e.insertAfter(t),t.append(e))}})}const yt=/^\+?[0-9\s()-]{5,}$/;function vt(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:yt.test(t)?`tel:${t}`:`https://${t}`}const kt={build:(t,e)=>n(e),config:{created:"Link",createdMany:"%s links",destroyed:"Link removed",destroyedMany:"%s links removed",disabled:!1},dependencies:[t],name:"@lexical/link/AutoLinkAnnounce",register(n,r,i){const{created:l,createdMany:o,destroyed:s,destroyedMany:u,disabled:a}=i.getOutput(),{announce:c}=i.getDependency(t).output;return e(()=>a.value?void 0:n.registerMutationListener(dt,t=>{let e=0,n=0;for(const[,r]of t)"created"===r?e++:"destroyed"===r&&n++;e>0&&0===n?c(1===e?l.peek():o.peek().replace("%s",String(e))):n>0&&0===e&&c(1===n?s.peek():u.peek().replace("%s",String(n)))},{skipInitialization:!0}))}},bt=[{$import:(t,e)=>{if(!e.textContent&&0===e.children.length)return[];const n=e.getAttribute("href")||"",r={rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")};return Z(t.$importChildren(e),()=>ct(n,r))},match:/* @__PURE__ */J.tag("a"),name:"@lexical/link/a"}];function Ut(t,n){return I(t.registerNodeTransform(lt,ut),t.registerCommand(ht,t=>{const e=n.validateUrl.peek(),r=n.attributes.peek();if(null===t)return xt(null),!0;if("string"==typeof t)return!(void 0!==e&&!e(t))&&(xt(t,r),!0);{const{url:n,...i}=t;return!(void 0!==e&&!e(n))&&(xt(n,{...r,...i}),!0)}},w),e(()=>{const e=n.validateUrl.value;if(!e)return;const r=n.attributes.value;return t.registerCommand(F,n=>{const i=_();if(!f(i)||i.isCollapsed()||!q(n,ClipboardEvent))return!1;if(null===n.clipboardData)return!1;const l=n.clipboardData.getData("text");if(!e(l))return!1;return!i.getNodes().some(t=>T(t)||D(t)&&!t.isSimpleText())&&(t.dispatchCommand(ht,{...r,url:l}),n.preventDefault(),!0)},M)}))}const St={build:(t,e,r)=>n(e),config:{attributes:void 0,validateUrl:void 0},dependencies:[H,[G,{rules:bt}]],mergeConfig(t,e){const n=O(t,e);return t.attributes&&(n.attributes=O(t.attributes,n.attributes)),n},name:"@lexical/link/Link",nodes:()=>[lt],register:(t,e,n)=>Ut(t,n.getOutput())},Tt={dependencies:[St],name:"@lexical/link/Import"};function Lt(t,e,n={}){const r=n=>{const r=1===n.button;if("auxclick"===n.type&&!r)return;const i=n.target;if(!z(i))return;const l=$(i);if(null===l)return;let o=null,s=null,u=!1;if(l.update(()=>{const t=W(i);if(null!==t){const n=h(t,T);if(!e.disabled.peek())if(ft(n))u=pt(n)&&n.getIsUnlinked(),o=n.sanitizeUrl(n.getURL()),s=n.getTarget();else{const t=function(t,e){let n=t;for(;null!=n;){if(e(n))return n;n=n.parentNode}return null}(i,a);null!==t&&(o=t.href,s=t.target)}}}),null===o||""===o||u)return;const c=t.read("latest",_);!f(c)||c.isCollapsed()?(window.open(o,e.newTab.peek()||r||n.metaKey||n.ctrlKey||"_blank"===s?"_blank":"_self"),n.preventDefault()):n.preventDefault()};return t.registerRootListener(t=>{if(t)return E(t,{auxclick:r,click:r},n)})}const Ct={build:(t,e,r)=>n(e),config:{disabled:!1,newTab:!1},dependencies:[St],name:"@lexical/link/ClickableLink",register:(t,e,n)=>Lt(t,n.getOutput())};function At(t,e=t=>t){return n=>{const r=t.exec(n);return null===r?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}const Nt=/((https?:\/\/(www\.)?)|(www\.))[-\p{L}\p{N}@:%._+~#=]{1,256}\.[\p{L}\p{N}]{1,6}(?:[-\p{L}\p{N}()@:%_+.~#?&//=]*[\p{L}\p{N}()@_~#?&//=])?/u,Rt=t=>{const e=Nt.exec(t);if(null===e)return null;let n=e[0],r=0;for(const t of n)"("===t?r++:")"===t&&r--;for(;r<0&&n.endsWith(")");)n=n.slice(0,-1),r++;return{index:e.index,length:n.length,text:n,url:n.startsWith("http")?n:`https://${n}`}},Pt=/* @__PURE__ */At(/(([^<>()[\]\\.,;:\s@"]{1,64}(\.[^<>()[\]\\.,;:\s@"]{1,64}){0,63})|(".{1,255}"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]{1,63}\.){1,127}[a-zA-Z]{2,63}))/,t=>`mailto:${t}`);function Ot(t,e){for(let n=0;n<e.length;n++){const r=e[n](t);if(r)return r}return null}const It=/[.,;\s]/;function wt(t,e){return e.test(t)}function Ft(t,e){return wt(t[t.length-1],e)}function Dt(t,e){return wt(t[0],e)}function Mt(t,e){let n=t.getPreviousSibling();return T(n)&&(n=n.getLastDescendant()),null===n||B(n)||D(n)&&Ft(n.getTextContent(),e)}function Et(t,e){let n=t.getNextSibling();return T(n)&&(n=n.getFirstDescendant()),null===n||B(n)||D(n)&&Dt(n.getTextContent(),e)}function zt(t,e,n,r,i){if(!(t>0?wt(r[t-1],n):Mt(i[0],n)))return!1;return e<r.length?wt(r[e],n):Et(i[i.length-1],n)}function $t(t,e,n){const r=[],i=[],l=[];let o=0,s=0;const u=[...t];for(;u.length>0;){const t=u[0],a=t.getTextContent().length,c=s;s+a<=e?(r.push(t),o+=a):c>=n?l.push(t):i.push(t),s+=a,u.shift()}return[o,r,i,l]}function Wt(t,e,n,r){const i=_t(r.url,r.attributes);if(1===t.length){let l,o=t[0];0===e?[l,o]=o.splitText(n):[,l,o]=o.splitText(e,n);const s=j(r.text);return s.setFormat(l.getFormat()),s.setDetail(l.getDetail()),s.setStyle(l.getStyle()),i.append(s),l.replace(i),o}if(t.length>1){const r=t[0];let l,o=r.getTextContent().length;0===e?l=r:[,l]=r.splitText(e);const s=[];let u;for(let e=1;e<t.length;e++){const r=t[e],i=r.getTextContent().length,l=o;if(l<n)if(o+i<=n)s.push(r);else{const[t,e]=r.splitText(n-l);s.push(t),u=e}o+=i}const a=_(),c=a?a.getNodes().find(D):void 0,g=j(l.getTextContent());return g.setFormat(l.getFormat()),g.setDetail(l.getDetail()),g.setStyle(l.getStyle()),i.append(g,...s),c&&c===l&&(f(a)?g.select(a.anchor.offset,a.focus.offset):p(a)&&g.select(0,g.getTextContent().length)),l.replace(i),u}}function Kt(t,e,n,r){const i=t.getChildren(),l=i.length;for(let e=0;e<l;e++){const r=i[e];if(!D(r)||!r.isSimpleText())return Bt(t),void n(null,t.getURL())}const o=t.getTextContent(),s=Ot(o,e);if(null===s||s.text!==o)return Bt(t),void n(null,t.getURL());if(!Mt(t,r)||!Et(t,r))return Bt(t),void n(null,t.getURL());const u=t.getURL();u!==s.url&&(t.setURL(s.url),n(s.url,u)),s.attributes&&(t.getRel()!==s.attributes.rel&&t.setRel(s.attributes.rel||null),t.getTarget()!==s.attributes.target&&t.setTarget(s.attributes.target||null),t.getTitle()!==s.attributes.title&&t.setTitle(s.attributes.title||null))}function Bt(t){const e=t.getChildren();for(let n=e.length-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(t=>t.getLatest())}const jt={changeHandlers:[],excludeParents:[],matchers:[],separatorRegex:It};function Jt(t,e=jt){const{matchers:n,changeHandlers:r,excludeParents:i,separatorRegex:l=It}=e,o=(t,e)=>{for(const n of r)n(t,e)};return I(t.registerNodeTransform(K,t=>{const e=t.getParentOrThrow(),r=t.getPreviousSibling();if(pt(e))Kt(e,n,o,l);else if(!ft(e)&&!i.some(t=>t(e))){if(t.isSimpleText()&&(Dt(t.getTextContent(),l)||!pt(r))){const e=function(t){const e=[t];let n=t.getNextSibling();for(;null!==n&&D(n)&&n.isSimpleText()&&(e.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return e}(t);!function(t,e,n,r){for(const e of t){const t=e.getParent();if(pt(t)&&!t.getIsUnlinked())return}let i=[...t];const l=i.map(t=>t.getTextContent()).join("");let o,s=l,u=0;for(;(o=Ot(s,e))&&null!==o;){const t=o.index,e=t+o.length;if(zt(u+t,u+e,r,l,i)){const[r,,l,a]=$t(i,u+t,u+e);let c=!1;for(const t of l){const e=t.getParent();if(pt(e)&&!e.getIsUnlinked()){c=!0;break}}if(c){u+=e,s=s.substring(e);continue}const f=Wt(l,u+t-r,u+e-r,o);i=f?[f,...a]:a,n(o.url,null),u=0}else u+=e;s=s.substring(e)}}(e,n,o,l)}!function(t,e,n,r){const i=t.getParent(),l=t.getPreviousSibling(),o=t.getNextSibling(),s=t.getTextContent();if(!pt(i)||i.getIsUnlinked()){if(pt(l)&&!l.getIsUnlinked()&&l.is(t.getPreviousSibling())&&t.getParent()===l.getParent()){if(!Dt(s,r))return Bt(l),void n(null,l.getURL());if(u=s,l.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(u):/^\.[a-zA-Z0-9]{1,}/.test(u)){const i=l.getTextContent()+s,o=Ot(i,e);null!==o&&o.text===i&&(l.append(t),Kt(l,e,n,r),n(null,l.getURL()))}}var u;!pt(o)||o.getIsUnlinked()||Ft(s,r)||o.is(t.getNextSibling())&&t.getParent()===o.getParent()&&(Bt(o),n(null,o.getURL()))}}(t,n,o,l)}}),t.registerCommand(ht,t=>{const e=_();if(null!==t||!f(e))return!1;return e.extract().forEach(t=>{const e=t.getParent();pt(e)&&(e.setIsUnlinked(!e.getIsUnlinked()),e.markDirty())}),!1},M))}const Zt={config:jt,dependencies:[kt,St],mergeConfig(t,e){const n=O(t,e);for(const r of["matchers","changeHandlers","excludeParents"]){const i=e[r];Array.isArray(i)&&(n[r]=[...t[r],...i])}return n},name:"@lexical/link/AutoLink",nodes:[dt],register:Jt};export{_t as $createAutoLinkNode,ct as $createLinkNode,pt as $isAutoLinkNode,ft as $isLinkNode,xt as $toggleLink,kt as AutoLinkAnnounceExtension,Zt as AutoLinkExtension,dt as AutoLinkNode,Ct as ClickableLinkExtension,St as LinkExtension,Tt as LinkImportExtension,bt as LinkImportRules,lt as LinkNode,ht as TOGGLE_LINK_COMMAND,Pt as autoLinkEmailMatcher,Rt as autoLinkUrlMatcher,At as createLinkMatcherWithRegExp,vt as formatUrl,Jt as registerAutoLink,Lt as registerClickableLink,Ut as registerLink};
29
+ +import{AriaLiveRegionExtension as t}from"@lexical/a11y";import{effect as e}from"@lexical/extension/signals";import{namedSignals as n}from"@lexical/extension/namedSignals";import{getterTableOf as r,setterTableOf as i,setterDefaultOf as l,ElementNode as o,$getDocument as s,addClassNamesToElement as u,isHTMLAnchorElement as a,$copyNode as c,$isRangeSelection as f,$applyNodeReplacement as g,createCommand as d,$getSelection as _,$isNodeSelection as p,$findMatchingParent as h,nodeSchema as m,withField as x,stringValue as y,nullable as v,booleanValue as k,$normalizeSelection__EXPERIMENTAL as b,$setSelection as U,$getChildCaret as S,$isElementNode as T,$insertNodeToNearestRootAtCaret as L,$rewindSiblingCaret as C,$caretFromPoint as A,$normalizeCaret as N,$isSiblingCaret as R,$setPointFromCaret as P,shallowMergeConfig as O,mergeRegister as I,COMMAND_PRIORITY_EDITOR as w,PASTE_COMMAND as F,$isTextNode as D,COMMAND_PRIORITY_LOW as M,registerEventListeners as E,isDOMNode as z,getNearestEditorFromDOMNode as $,$getNearestNodeFromDOMNode as W,TextNode as K,$isLineBreakNode as B,$createTextNode as j}from"lexical";import{sel as J,$distributeInlineWrapper as Z,CoreImportExtension as H,DOMImportExtension as G}from"@lexical/html";import{objectKlassEquals as q}from"@lexical/utils";const Q=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function V(t,e){if("number"==typeof t)return Number.isFinite(t)?t:e;if("string"!=typeof t||!Q.test(t))return e;const n=Number(t);return Number.isFinite(n)?n:e}function X(t,e,n,r,i){const l=V(t,e);return l>=n&&l<=r&&Number.isInteger(l)?l:e}function Y(t,e){t.__rel=e.__rel,t.__target=e.__target,t.__title=e.__title,t.__url=e.__url}const tt=t=>{const e=r(t,"format"),n=i(t,"format"),o=l(t,"format");return{exportJSON:function(t){const n=t.__textFormat,r=t.__textStyle,i=(0!==n||""!==r)&&t.shouldSerializeTextStyles();return{children:[],rel:t.__rel,target:t.__target,title:t.__title,url:t.__url,direction:t.__dir,format:e[t.__format],indent:t.__indent,textFormat:0!==n&&i?n:void 0,textStyle:""!==r&&i?r:void 0,type:t.__type,version:1}},exportCompactJSON:function(t){const n=t.__textFormat,r=t.__textStyle,i=(0!==n||""!==r)&&t.shouldSerializeTextStyles(),l={type:t.__type,children:[]},o=t.__rel;null!=o&&(l.rel=o);const s=t.__target;null!=s&&(l.target=s);const u=t.__title;null!=u&&(l.title=u);const a=t.__url;void 0!==a&&""!==a&&(l.url=a);const c=t.__dir;null!=c&&(l.direction=c);const f=e[t.__format];void 0!==f&&""!==f&&(l.format=f);const g=t.__indent;return void 0!==g&&0!==g&&(l.indent=g),void 0!==n&&0!==n&&i&&(l.textFormat=n),void 0!==r&&""!==r&&i&&(l.textStyle=r),l},updateFromJSON:function(t,e){const r=e.direction;t.__dir=null===r||"ltr"===r||"rtl"===r?r:null;const i=e.format;t.__format="string"==typeof i&&i in n?n[i]:o,t.__indent=X(e.indent,0,0,Infinity),t.__textFormat=V(e.textFormat,0);const l=e.textStyle;t.__textStyle="string"==typeof l?l:"";const s=e.rel;t.__rel="string"==typeof s&&""!==s?s:null;const u=e.target;t.__target="string"==typeof u&&""!==u?u:null;const a=e.title;t.__title="string"==typeof a&&""!==a?a:null;const c=e.url;return t.__url="string"==typeof c?c:"",t},afterCloneFrom:Y}};function et(t,e){t.__isUnlinked=e.__isUnlinked}const nt=t=>{const e=r(t,"format"),n=i(t,"format"),o=l(t,"format");return{exportJSON:function(t){const n=t.__textFormat,r=t.__textStyle,i=(0!==n||""!==r)&&t.shouldSerializeTextStyles();return{children:[],isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title,url:t.__url,direction:t.__dir,format:e[t.__format],indent:t.__indent,textFormat:0!==n&&i?n:void 0,textStyle:""!==r&&i?r:void 0,type:t.__type,version:1}},exportCompactJSON:function(t){const n=t.__textFormat,r=t.__textStyle,i=(0!==n||""!==r)&&t.shouldSerializeTextStyles(),l={type:t.__type,children:[]},o=t.__isUnlinked;void 0!==o&&!1!==o&&(l.isUnlinked=o);const s=t.__rel;null!=s&&(l.rel=s);const u=t.__target;null!=u&&(l.target=u);const a=t.__title;null!=a&&(l.title=a);const c=t.__url;void 0!==c&&""!==c&&(l.url=c);const f=t.__dir;null!=f&&(l.direction=f);const g=e[t.__format];void 0!==g&&""!==g&&(l.format=g);const d=t.__indent;return void 0!==d&&0!==d&&(l.indent=d),void 0!==n&&0!==n&&i&&(l.textFormat=n),void 0!==r&&""!==r&&i&&(l.textStyle=r),l},updateFromJSON:function(t,e){const r=e.direction;t.__dir=null===r||"ltr"===r||"rtl"===r?r:null;const i=e.format;t.__format="string"==typeof i&&i in n?n[i]:o,t.__indent=X(e.indent,0,0,Infinity),t.__textFormat=V(e.textFormat,0);const l=e.textStyle;t.__textStyle="string"==typeof l?l:"";const s=e.rel;t.__rel="string"==typeof s&&""!==s?s:null;const u=e.target;t.__target="string"==typeof u&&""!==u?u:null;const a=e.title;t.__title="string"==typeof a&&""!==a?a:null;const c=e.url;t.__url="string"==typeof c?c:"";const f=e.isUnlinked;return t.__isUnlinked="boolean"==typeof f&&f,t},afterCloneFrom:et}},rt=new Set(["http:","https:","mailto:","sms:","tel:"]),it=/* @__PURE__ */m()({rel:/* @__PURE__ */x(/* @__PURE__ */v(/* @__PURE__ */y(),{defaultAsNull:!0}),{field:"__rel"}),target:/* @__PURE__ */x(/* @__PURE__ */v(/* @__PURE__ */y(),{defaultAsNull:!0}),{field:"__target"}),title:/* @__PURE__ */x(/* @__PURE__ */v(/* @__PURE__ */y(),{defaultAsNull:!0}),{field:"__title"}),url:/* @__PURE__ */x(/* @__PURE__ */y(),{field:"__url",getter:"getURL",setter:"setURL"})});class lt extends o{__url;__target;__rel;__title;$config(){return this.config("link",{extends:o,generated:tt,importDOM:{a:()=>({conversion:at,priority:1})},json:it})}constructor(t="",e={},n){super(n);const{target:r=null,rel:i=null,title:l=null}=e;this.__url=t,this.__target=r,this.__rel=i,this.__title=l}createDOM(t){const e=s().createElement("a");return this.updateLinkDOM(null,e,t),u(e,t.theme.link),e}updateLinkDOM(t,e,n){if(a(e)){t&&t.__url===this.__url||(e.href=this.sanitizeUrl(this.__url));for(const n of["target","rel","title"]){const r=`__${n}`,i=this[r];t&&t[r]===i||(i?e[n]=i:e.removeAttribute(n))}}}updateDOM(t,e,n){return this.updateLinkDOM(t,e,n),!1}sanitizeUrl(t){const e=t;t=vt(t);try{const e=new URL(vt(t));if(!rt.has(e.protocol))return"about:blank"}catch(t){const n=e.replace(/[\u0000-\u001F\u007F\s]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);if(null!=n&&!rt.has(`${n[1].toLowerCase()}:`))return"about:blank"}return t}getURL(){return this.getLatest().__url}setURL(t){const e=this.getWritable();return e.__url=t,e}getTarget(){return this.getLatest().__target}setTarget(t){const e=this.getWritable();return e.__target=t,e}getRel(){return this.getLatest().__rel}setRel(t){const e=this.getWritable();return e.__rel=t,e}getTitle(){return this.getLatest().__title}setTitle(t){const e=this.getWritable();return e.__title=t,e}insertNewAfter(t,e=!0){const n=c(this);return this.insertAfter(n,e),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(t,e,n){if(!f(e))return!1;const r=e.anchor.getNode(),i=e.focus.getNode();return(this.is(r)||this.isParentOf(r))&&(this.is(i)||this.isParentOf(i))&&e.getTextContent().length>0}isEmailURI(){return this.getURL().startsWith("mailto:")}isWebSiteURI(){const t=this.getURL();return t.startsWith("https://")||t.startsWith("http://")}shouldMergeAdjacentLink(t){return this.getType()===t.getType()&&this.getURL()===t.getURL()&&this.getTarget()===t.getTarget()&&this.getRel()===t.getRel()&&this.getTitle()===t.getTitle()}}function ot(t){const e=A(t,"next");return[e,e.getFlipped()]}function st(t,e){for(const n of e)if(n.origin.isAttached()){const e=N(n);return void P(t,e)}}function ut(t){const e=_();let n=null,r=null;function i(){f(e)&&(st(e.anchor,n),st(e.focus,r),b(e))}f(e)&&(n=ot(e.anchor),r=ot(e.focus));let l=!1;for(const e of S(t,"next")){const n=e.origin;if(T(n)&&!n.isInline()){const r=n.getChildren();if(r.length>0){const e=c(t);e.append(...r),n.append(e),l=!0}L(n,C(e),{$shouldSplit:()=>!1})}}function o(t,e,n){const[r,i]=t,l=t=>R(t)&&t.origin.is(e);if(!l(r)&&!l(i))return t;const o=N(S(n,"next"));return[o,o.getFlipped()]}if(t.isAttached()){const e=t.getPreviousSibling();if(ft(e)&&e.shouldMergeAdjacentLink(t))return n&&(n=o(n,e,t)),r&&(r=o(r,e,t)),e.append(...t.getChildren()),t.remove(),void i();const s=t.getNextSibling();ft(s)&&t.shouldMergeAdjacentLink(s)&&(n&&(n=o(n,t,s)),r&&(r=o(r,t,s)),t.append(...s.getChildren()),s.remove(),l=!0)}if(l){if(!t.canBeEmpty()&&t.isEmpty()){const e=t.getParent();t.remove(),e&&e.isEmpty()&&e.remove()}i()}}function at(t){let e=null;if(a(t)){const n=t.textContent;(null!==n&&""!==n||t.children.length>0)&&(e=ct(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function ct(t="",e){return g(new lt(t,e))}function ft(t){return t instanceof lt}const gt=/* @__PURE__ */m()({isUnlinked:/* @__PURE__ */x(/* @__PURE__ */k(),{field:"__isUnlinked"})});class dt extends lt{__isUnlinked;constructor(t="",e={},n){super(t,e,n),this.__isUnlinked=void 0!==e.isUnlinked&&null!==e.isUnlinked&&e.isUnlinked}$config(){return this.config("autolink",{extends:lt,generated:nt,json:gt})}shouldMergeAdjacentLink(t){return!1}getIsUnlinked(){return this.getLatest().__isUnlinked}setIsUnlinked(t){const e=this.getWritable();return e.__isUnlinked=t,e}createDOM(t){return this.__isUnlinked?s().createElement("span"):super.createDOM(t)}updateDOM(t,e,n){return super.updateDOM(t,e,n)||t.__isUnlinked!==this.__isUnlinked}}function _t(t="",e){return g(new dt(t,e))}function pt(t){return t instanceof dt}const ht=/* @__PURE__ */d("TOGGLE_LINK_COMMAND");function mt(t,e){if("element"===t.type){const n=t.getNode();T(n)||function(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252);return n.getChildren()[t.offset+e]||null}return null}function xt(t,e={}){let n;if(t&&"object"==typeof t){const{url:r,...i}=t;n=r,e={...i,...e}}else n=t;const{target:r,title:i}=e,l=void 0===e.rel?"noreferrer":e.rel,o=_();if(null===o||!f(o)&&!p(o))return;if(p(o)){const t=o.getNodes();if(0===t.length)return;return void t.forEach(t=>{if(null===n){const e=h(t,t=>!pt(t)&&ft(t));e&&(e.insertBefore(t),0===e.getChildren().length&&e.remove())}else{const e=h(t,t=>!pt(t)&&ft(t));if(e)e.setURL(n),void 0!==r&&e.setTarget(r),void 0!==l&&e.setRel(l),void 0!==i&&e.setTitle(i);else{const e=ct(n,{rel:l,target:r,title:i});t.insertBefore(e),e.append(t)}}})}if(o.isCollapsed()&&null===n)for(const t of o.getNodes()){const e=h(t,t=>!pt(t)&&ft(t));return void(null!==e&&(e.getParentOrThrow().splice(e.getIndexWithinParent(),0,e.getChildren()),e.remove()))}const s=o.extract();if(null===n){const t=new Set;return void s.forEach(e=>{const n=h(e,t=>!pt(t)&&ft(t));if(null!==n){const e=n.getKey();if(t.has(e))return;!function(t,e){const n=new Set(e.filter(e=>t.isParentOf(e)).map(t=>t.getKey())),r=t.getChildren(),i=r=>n.has(r.getKey())||T(r)&&e.some(e=>t.isParentOf(e)&&r.isParentOf(e)),l=r.filter(i);if(l.length===r.length)return r.forEach(e=>t.insertBefore(e)),void t.remove();const o=r.findIndex(i),s=r.findLastIndex(i),u=0===o,a=s===r.length-1;if(u)l.forEach(e=>t.insertBefore(e));else if(a)for(let e=l.length-1;e>=0;e--)t.insertAfter(l[e]);else{for(let e=l.length-1;e>=0;e--)t.insertAfter(l[e]);const e=r.slice(s+1);if(e.length>0){const n=c(t);l[l.length-1].insertAfter(n),e.forEach(t=>n.append(t))}}}(n,s),t.add(e)}})}const u=new Set,a=t=>{u.has(t.getKey())||(u.add(t.getKey()),t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==l&&t.setRel(l),void 0!==i&&t.setTitle(i))};if(1===s.length){const t=s[0],e=h(t,ft);if(null!==e)return a(e)}!function(t){const e=_();if(!f(e))return t();const n=b(e),r=n.isBackward(),i=mt(n.anchor,r?-1:0),l=mt(n.focus,r?0:-1),o=t();if(i||l){const t=_();if(f(t)){const e=t.clone();if(i){const t=i.getParent();t&&e.anchor.set(t.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(l){const t=l.getParent();t&&e.focus.set(t.getKey(),l.getIndexWithinParent()+(r?0:1),"element")}U(b(e))}}}(()=>{let t=null;for(const e of s){if(!e.isAttached())continue;const o=h(e,ft);if(o){a(o);continue}if(T(e)){if(!e.isInline())continue;if(ft(e)){if(!(pt(e)||null!==t&&t.getParentOrThrow().isParentOf(e))){a(e),t=e;continue}for(const t of e.getChildren())e.insertBefore(t);e.remove();continue}}const s=e.getPreviousSibling();ft(s)&&s.is(t)?s.append(e):(t=ct(n,{rel:l,target:r,title:i}),e.insertAfter(t),t.append(e))}})}const yt=/^\+?[0-9\s()-]{5,}$/;function vt(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:yt.test(t)?`tel:${t}`:`https://${t}`}const kt={build:(t,e)=>n(e),config:{created:"Link",createdMany:"%s links",destroyed:"Link removed",destroyedMany:"%s links removed",disabled:!1},dependencies:[t],name:"@lexical/link/AutoLinkAnnounce",register(n,r,i){const{created:l,createdMany:o,destroyed:s,destroyedMany:u,disabled:a}=i.getOutput(),{announce:c}=i.getDependency(t).output;return e(()=>a.value?void 0:n.registerMutationListener(dt,t=>{let e=0,n=0;for(const[,r]of t)"created"===r?e++:"destroyed"===r&&n++;e>0&&0===n?c(1===e?l.peek():o.peek().replace("%s",String(e))):n>0&&0===e&&c(1===n?s.peek():u.peek().replace("%s",String(n)))},{skipInitialization:!0}))}},bt=[{$import:(t,e)=>{if(!e.textContent&&0===e.children.length)return[];const n=e.getAttribute("href")||"",r={rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")};return Z(t.$importChildren(e),()=>ct(n,r))},match:/* @__PURE__ */J.tag("a"),name:"@lexical/link/a"}];function Ut(t,n){return I(t.registerNodeTransform(lt,ut),t.registerCommand(ht,t=>{const e=n.validateUrl.peek(),r=n.attributes.peek();if(null===t)return xt(null),!0;if("string"==typeof t)return!(void 0!==e&&!e(t))&&(xt(t,r),!0);{const{url:n,...i}=t;return!(void 0!==e&&!e(n))&&(xt(n,{...r,...i}),!0)}},w),e(()=>{const e=n.validateUrl.value;if(!e)return;const r=n.attributes.value;return t.registerCommand(F,n=>{const i=_();if(!f(i)||i.isCollapsed()||!q(n,ClipboardEvent))return!1;if(null===n.clipboardData)return!1;const l=n.clipboardData.getData("text");if(!e(l))return!1;return!i.getNodes().some(t=>T(t)||D(t)&&!t.isSimpleText())&&(t.dispatchCommand(ht,{...r,url:l}),n.preventDefault(),!0)},M)}))}const St={build:(t,e,r)=>n(e),config:{attributes:void 0,validateUrl:void 0},dependencies:[H,[G,{rules:bt}]],mergeConfig(t,e){const n=O(t,e);return t.attributes&&(n.attributes=O(t.attributes,n.attributes)),n},name:"@lexical/link/Link",nodes:()=>[lt],register:(t,e,n)=>Ut(t,n.getOutput())},Tt={dependencies:[St],name:"@lexical/link/Import"};function Lt(t,e,n={}){const r=n=>{const r=1===n.button;if("auxclick"===n.type&&!r)return;const i=n.target;if(!z(i))return;const l=$(i);if(null===l)return;let o=null,s=null,u=!1;if(l.update(()=>{const t=W(i);if(null!==t){const n=h(t,T);if(!e.disabled.peek())if(ft(n))u=pt(n)&&n.getIsUnlinked(),o=n.sanitizeUrl(n.getURL()),s=n.getTarget();else{const t=function(t,e){let n=t;for(;null!=n;){if(e(n))return n;n=n.parentNode}return null}(i,a);null!==t&&(o=t.href,s=t.target)}}}),null===o||""===o||u)return;const c=t.read("latest",_);!f(c)||c.isCollapsed()?(window.open(o,e.newTab.peek()||r||n.metaKey||n.ctrlKey||"_blank"===s?"_blank":"_self"),n.preventDefault()):n.preventDefault()};return t.registerRootListener(t=>{if(t)return E(t,{auxclick:r,click:r},n)})}const Ct={build:(t,e,r)=>n(e),config:{disabled:!1,newTab:!1},dependencies:[St],name:"@lexical/link/ClickableLink",register:(t,e,n)=>Lt(t,n.getOutput())};function At(t,e=t=>t){return n=>{const r=t.exec(n);return null===r?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}const Nt=(()=>{try{return new RegExp('((https?:\\/\\/(www\\.)?)|(www\\.))[-\\p{L}\\p{N}@:%._+~#=]{1,256}\\.[\\p{L}\\p{N}]{1,6}(?:[-\\p{L}\\p{N}()@:%_+.~#?&//=]*[\\p{L}\\p{N}()@_~#?&//=])?','u')}catch{return /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(?:[-a-zA-Z0-9()@:%_+.~#?&//=]*[a-zA-Z0-9()@_~#?&//=])?/}})(),Rt=t=>{const e=Nt.exec(t);if(null===e)return null;let n=e[0],r=0;for(const t of n)"("===t?r++:")"===t&&r--;for(;r<0&&n.endsWith(")");)n=n.slice(0,-1),r++;return{index:e.index,length:n.length,text:n,url:n.startsWith("http")?n:`https://${n}`}},Pt=/* @__PURE__ */At(/(([^<>()[\]\\.,;:\s@"]{1,64}(\.[^<>()[\]\\.,;:\s@"]{1,64}){0,63})|(".{1,255}"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]{1,63}\.){1,127}[a-zA-Z]{2,63}))/,t=>`mailto:${t}`);function Ot(t,e){for(let n=0;n<e.length;n++){const r=e[n](t);if(r)return r}return null}const It=/[.,;\s]/;function wt(t,e){return e.test(t)}function Ft(t,e){return wt(t[t.length-1],e)}function Dt(t,e){return wt(t[0],e)}function Mt(t,e){let n=t.getPreviousSibling();return T(n)&&(n=n.getLastDescendant()),null===n||B(n)||D(n)&&Ft(n.getTextContent(),e)}function Et(t,e){let n=t.getNextSibling();return T(n)&&(n=n.getFirstDescendant()),null===n||B(n)||D(n)&&Dt(n.getTextContent(),e)}function zt(t,e,n,r,i){if(!(t>0?wt(r[t-1],n):Mt(i[0],n)))return!1;return e<r.length?wt(r[e],n):Et(i[i.length-1],n)}function $t(t,e,n){const r=[],i=[],l=[];let o=0,s=0;const u=[...t];for(;u.length>0;){const t=u[0],a=t.getTextContent().length,c=s;s+a<=e?(r.push(t),o+=a):c>=n?l.push(t):i.push(t),s+=a,u.shift()}return[o,r,i,l]}function Wt(t,e,n,r){const i=_t(r.url,r.attributes);if(1===t.length){let l,o=t[0];0===e?[l,o]=o.splitText(n):[,l,o]=o.splitText(e,n);const s=j(r.text);return s.setFormat(l.getFormat()),s.setDetail(l.getDetail()),s.setStyle(l.getStyle()),i.append(s),l.replace(i),o}if(t.length>1){const r=t[0];let l,o=r.getTextContent().length;0===e?l=r:[,l]=r.splitText(e);const s=[];let u;for(let e=1;e<t.length;e++){const r=t[e],i=r.getTextContent().length,l=o;if(l<n)if(o+i<=n)s.push(r);else{const[t,e]=r.splitText(n-l);s.push(t),u=e}o+=i}const a=_(),c=a?a.getNodes().find(D):void 0,g=j(l.getTextContent());return g.setFormat(l.getFormat()),g.setDetail(l.getDetail()),g.setStyle(l.getStyle()),i.append(g,...s),c&&c===l&&(f(a)?g.select(a.anchor.offset,a.focus.offset):p(a)&&g.select(0,g.getTextContent().length)),l.replace(i),u}}function Kt(t,e,n,r){const i=t.getChildren(),l=i.length;for(let e=0;e<l;e++){const r=i[e];if(!D(r)||!r.isSimpleText())return Bt(t),void n(null,t.getURL())}const o=t.getTextContent(),s=Ot(o,e);if(null===s||s.text!==o)return Bt(t),void n(null,t.getURL());if(!Mt(t,r)||!Et(t,r))return Bt(t),void n(null,t.getURL());const u=t.getURL();u!==s.url&&(t.setURL(s.url),n(s.url,u)),s.attributes&&(t.getRel()!==s.attributes.rel&&t.setRel(s.attributes.rel||null),t.getTarget()!==s.attributes.target&&t.setTarget(s.attributes.target||null),t.getTitle()!==s.attributes.title&&t.setTitle(s.attributes.title||null))}function Bt(t){const e=t.getChildren();for(let n=e.length-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(t=>t.getLatest())}const jt={changeHandlers:[],excludeParents:[],matchers:[],separatorRegex:It};function Jt(t,e=jt){const{matchers:n,changeHandlers:r,excludeParents:i,separatorRegex:l=It}=e,o=(t,e)=>{for(const n of r)n(t,e)};return I(t.registerNodeTransform(K,t=>{const e=t.getParentOrThrow(),r=t.getPreviousSibling();if(pt(e))Kt(e,n,o,l);else if(!ft(e)&&!i.some(t=>t(e))){if(t.isSimpleText()&&(Dt(t.getTextContent(),l)||!pt(r))){const e=function(t){const e=[t];let n=t.getNextSibling();for(;null!==n&&D(n)&&n.isSimpleText()&&(e.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return e}(t);!function(t,e,n,r){for(const e of t){const t=e.getParent();if(pt(t)&&!t.getIsUnlinked())return}let i=[...t];const l=i.map(t=>t.getTextContent()).join("");let o,s=l,u=0;for(;(o=Ot(s,e))&&null!==o;){const t=o.index,e=t+o.length;if(zt(u+t,u+e,r,l,i)){const[r,,l,a]=$t(i,u+t,u+e);let c=!1;for(const t of l){const e=t.getParent();if(pt(e)&&!e.getIsUnlinked()){c=!0;break}}if(c){u+=e,s=s.substring(e);continue}const f=Wt(l,u+t-r,u+e-r,o);i=f?[f,...a]:a,n(o.url,null),u=0}else u+=e;s=s.substring(e)}}(e,n,o,l)}!function(t,e,n,r){const i=t.getParent(),l=t.getPreviousSibling(),o=t.getNextSibling(),s=t.getTextContent();if(!pt(i)||i.getIsUnlinked()){if(pt(l)&&!l.getIsUnlinked()&&l.is(t.getPreviousSibling())&&t.getParent()===l.getParent()){if(!Dt(s,r))return Bt(l),void n(null,l.getURL());if(u=s,l.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(u):/^\.[a-zA-Z0-9]{1,}/.test(u)){const i=l.getTextContent()+s,o=Ot(i,e);null!==o&&o.text===i&&(l.append(t),Kt(l,e,n,r),n(null,l.getURL()))}}var u;!pt(o)||o.getIsUnlinked()||Ft(s,r)||o.is(t.getNextSibling())&&t.getParent()===o.getParent()&&(Bt(o),n(null,o.getURL()))}}(t,n,o,l)}}),t.registerCommand(ht,t=>{const e=_();if(null!==t||!f(e))return!1;return e.extract().forEach(t=>{const e=t.getParent();pt(e)&&(e.setIsUnlinked(!e.getIsUnlinked()),e.markDirty())}),!1},M))}const Zt={config:jt,dependencies:[kt,St],mergeConfig(t,e){const n=O(t,e);for(const r of["matchers","changeHandlers","excludeParents"]){const i=e[r];Array.isArray(i)&&(n[r]=[...t[r],...i])}return n},name:"@lexical/link/AutoLink",nodes:[dt],register:Jt};export{_t as $createAutoLinkNode,ct as $createLinkNode,pt as $isAutoLinkNode,ft as $isLinkNode,xt as $toggleLink,kt as AutoLinkAnnounceExtension,Zt as AutoLinkExtension,dt as AutoLinkNode,Ct as ClickableLinkExtension,St as LinkExtension,Tt as LinkImportExtension,bt as LinkImportRules,lt as LinkNode,ht as TOGGLE_LINK_COMMAND,Pt as autoLinkEmailMatcher,Rt as autoLinkUrlMatcher,At as createLinkMatcherWithRegExp,vt as formatUrl,Jt as registerAutoLink,Lt as registerClickableLink,Ut as registerLink};
@@ -0,0 +1,225 @@
1
+ diff --git a/dist/driver.js b/dist/driver.js
2
+ index c88828e30337ee566bc1a919940e58b4b0227aba..5fcee7ffb92d8ddf937b65b27825cbb81944a195 100644
3
+ --- a/dist/driver.js
4
+ +++ b/dist/driver.js
5
+ @@ -56,15 +56,34 @@ function applyProps(node, props) {
6
+ }
7
+ }
8
+ /**
9
+ - * `update` carries the host's dynamic-prop snapshot; attributes that were
10
+ - * static in the compiled plan arrive only with `create`. Merge instead of
11
+ - * replace, or a first update would strip a node's static layout props.
12
+ + * `update` carries the host's complete prop bag: a key present in the last
13
+ + * applied bag but absent from the next is a removal, and the view state it
14
+ + * installed returns to the prop's documented default. `undefined` never
15
+ + * crosses the wire (the runtime elides it); `null` is "not supplied" for
16
+ + * props without an explicit nullable contract — both reset through setProp.
17
+ */
18
+ function updateProps(node, next) {
19
+ + const dropped = [];
20
+ + for (const name in node.props) {
21
+ + if (node.props[name] != null && !(name in next))
22
+ + dropped.push(name);
23
+ + }
24
+ applyProps(node, next);
25
+ - node.props = { ...node.props, ...next };
26
+ + for (const name of dropped) {
27
+ + resetProp(node, node.view, name);
28
+ + }
29
+ + node.props = next;
30
+ }
31
+ function setProp(node, view, name, value) {
32
+ + // Keep authored placement separate from Grid's computed native coordinates.
33
+ + // NativeScript does not retain a setter write equal to its default (row/col 0).
34
+ + if (name === 'row' || name === 'col' || name === 'rowSpan' || name === 'colSpan') {
35
+ + const key = Symbol.for('octane-xplat.grid-placement');
36
+ + const placement = view[key] ?? (view[key] = {});
37
+ + if (value == null || value === unsetValue) delete placement[name];
38
+ + else placement[name] = value;
39
+ + view.notify({ eventName: 'xplatGridPlacementChange', object: view });
40
+ + }
41
+ if (name === 'children' || name === 'key' || name === 'ref')
42
+ return;
43
+ // Event props arrive as their own `event` commands.
44
+ @@ -78,13 +97,28 @@ function setProp(node, view, name, value) {
45
+ return;
46
+ }
47
+ if (name === 'style') {
48
+ - applyStyle(view, value);
49
+ + applyStyle(node, view, value);
50
+ return;
51
+ }
52
+ if (name === 'renderItem' && view instanceof ListView) {
53
+ setRenderItem(view, value ?? null, createNativeScriptRoot);
54
+ return;
55
+ }
56
+ + // `null`/`unsetValue` restore the prop's default rather than writing a
57
+ + // literal null through a native setter. `undefined` is a removal: skip it
58
+ + // when nothing applied (NativeScript setters coerce it badly) and reset
59
+ + // when a real value did.
60
+ + if (value == null || value === unsetValue) {
61
+ + if (value === undefined && node.props[name] == null)
62
+ + return;
63
+ + resetProp(node, view, name);
64
+ + return;
65
+ + }
66
+ + // Capture the pre-prop value once so a plain (non-Property) field can be
67
+ + // restored when the prop is removed later.
68
+ + const defaults = (node.propDefaults ??= {});
69
+ + if (!(name in defaults))
70
+ + defaults[name] = view[name];
71
+ // Core raises `<name>Change` for a script write exactly as for a user
72
+ // edit; a controlled input must not see its own value come back as one.
73
+ const echo = `${name}Change`;
74
+ @@ -99,6 +133,44 @@ function setProp(node, view, name, value) {
75
+ node.muted.delete(echo);
76
+ }
77
+ }
78
+ +/** Restore a removed prop to the value it holds when never supplied. */
79
+ +function resetProp(node, view, name) {
80
+ + if (view === null)
81
+ + return;
82
+ + if (name === 'children' || name === 'key' || name === 'ref')
83
+ + return;
84
+ + // `on*` handlers unbind through `event` commands, not props.
85
+ + if (EVENT_PROP.test(name))
86
+ + return;
87
+ + if (name === 'className' || name === 'class') {
88
+ + view.className = unsetValue;
89
+ + return;
90
+ + }
91
+ + if (name === 'style') {
92
+ + applyStyle(node, view, null);
93
+ + return;
94
+ + }
95
+ + if (name === 'renderItem' && view instanceof ListView) {
96
+ + setRenderItem(view, null, createNativeScriptRoot);
97
+ + return;
98
+ + }
99
+ + const echo = `${name}Change`;
100
+ + const listening = node.listeners.has(echo);
101
+ + if (listening)
102
+ + node.muted.add(echo);
103
+ + try {
104
+ + // Property/CssProperty setters consume the sentinel and restore the
105
+ + // declared default. A plain field stores it raw — detect that and
106
+ + // write back the captured pre-prop value instead.
107
+ + view[name] = unsetValue;
108
+ + if (view[name] === unsetValue)
109
+ + view[name] = node.propDefaults?.[name];
110
+ + }
111
+ + finally {
112
+ + if (listening)
113
+ + node.muted.delete(echo);
114
+ + }
115
+ +}
116
+ // `class`/`className` compose clsx-style on the DOM renderer; join arrays
117
+ // with spaces so NativeScript's class selectors can match each class.
118
+ function normalizeClass(value) {
119
+ @@ -112,15 +184,67 @@ function normalizeClass(value) {
120
+ .join(' ');
121
+ return '';
122
+ }
123
+ -function applyStyle(view, value) {
124
+ - if (value == null || value === unsetValue)
125
+ - return;
126
+ +/**
127
+ + * The `style` prop replaces wholesale — a key dropped or nulled since the last
128
+ + * apply resets what it installed (`unsetValue` clears a local CssProperty
129
+ + * value so the cascade can re-apply). String styles are parsed for their
130
+ + * declared names so a later object or removal can reset them.
131
+ + */
132
+ +function applyStyle(node, view, value) {
133
+ + const applied = node.styleKeys;
134
+ + node.styleKeys = undefined;
135
+ if (typeof value === 'string') {
136
+ + clearStyleKeys(view, applied);
137
+ view.setInlineStyle(value);
138
+ + node.styleKeys = inlineStyleKeys(value);
139
+ + return;
140
+ + }
141
+ + if (value == null || value === unsetValue || typeof value !== 'object') {
142
+ + clearStyleKeys(view, applied);
143
+ return;
144
+ }
145
+ - if (typeof value === 'object')
146
+ - Object.assign(view.style, value);
147
+ + if (applied !== undefined) {
148
+ + for (const key of applied) {
149
+ + if (!(key in value))
150
+ + unsetStyleKey(view, key);
151
+ + }
152
+ + }
153
+ + for (const [key, nextValue] of Object.entries(value)) {
154
+ + if (nextValue == null)
155
+ + unsetStyleKey(view, key);
156
+ + else
157
+ + view.style[key] = nextValue;
158
+ + }
159
+ + node.styleKeys = new Set(Object.keys(value));
160
+ +}
161
+ +function clearStyleKeys(view, keys) {
162
+ + if (keys === undefined)
163
+ + return;
164
+ + for (const key of keys)
165
+ + unsetStyleKey(view, key);
166
+ +}
167
+ +function unsetStyleKey(view, name) {
168
+ + const style = view.style;
169
+ + if (name.startsWith('--')) {
170
+ + style.setUnscopedCssVariable?.(name, unsetValue);
171
+ + return;
172
+ + }
173
+ + style[name] = unsetValue;
174
+ + // A style field outside the CssProperty registry stores the sentinel raw.
175
+ + if (style[name] === unsetValue)
176
+ + style[name] = undefined;
177
+ +}
178
+ +function inlineStyleKeys(style) {
179
+ + const keys = new Set();
180
+ + for (const declaration of style.split(';')) {
181
+ + const colon = declaration.indexOf(':');
182
+ + if (colon === -1)
183
+ + continue;
184
+ + const name = declaration.slice(0, colon).trim();
185
+ + if (name !== '')
186
+ + keys.add(name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()));
187
+ + }
188
+ + return keys;
189
+ }
190
+ /** Recompute a text host's `text` from its `#text` children. */
191
+ function syncText(parent) {
192
+ @@ -482,7 +606,7 @@ function applyCommand(container, command) {
193
+ }
194
+ export const nativeScriptDriver = {
195
+ id: NATIVESCRIPT_RENDERER_ID,
196
+ - capabilities: { text: 'host' },
197
+ + capabilities: { text: 'host', visibility: true },
198
+ events: {
199
+ classify(name) {
200
+ if (!EVENT_PROP.test(name))
201
+ diff --git a/dist/intrinsics.d.ts b/dist/intrinsics.d.ts
202
+ index 45a47cbbce199df9635852ca4cdb2849e9bbc83d..d555b50c08276e925132b2be9bb62302fe0a4228 100644
203
+ --- a/dist/intrinsics.d.ts
204
+ +++ b/dist/intrinsics.d.ts
205
+ @@ -24,9 +24,9 @@
206
+ */
207
+ import type * as NS from '@nativescript/core';
208
+ export type NativeScriptNode = unknown;
209
+ -type Ref<TInstance> = ((instance: TInstance | null) => void) | {
210
+ +type Ref<TInstance> = ((instance: TInstance | null) => void | (() => void)) | {
211
+ current: TInstance | null;
212
+ -} | null;
213
+ +} | readonly Ref<TInstance>[] | null | undefined;
214
+ /**
215
+ * The driver assigns every non-event prop onto the view instance, so a JSX
216
+ * attribute is a NativeScript view property rather than a DOM attribute.
217
+ @@ -117,7 +117,7 @@ export interface ListViewAttributes {
218
+ }
219
+ export interface OctaneAttributes<TInstance> {
220
+ key?: string | number;
221
+ - ref?: Ref<TInstance> | readonly Ref<TInstance>[];
222
+ + ref?: Ref<TInstance>;
223
+ children?: NativeScriptNode;
224
+ }
225
+ type Overridden = keyof CommonAttributes | keyof OctaneAttributes<unknown> | keyof CommonEvents<unknown>;
@@ -0,0 +1,225 @@
1
+ diff --git a/dist/driver.js b/dist/driver.js
2
+ index 8bc563add4cb675a12651184b63805b10224274d..a10f12af74fd32a630b71811c3f10f9338d63a50 100644
3
+ --- a/dist/driver.js
4
+ +++ b/dist/driver.js
5
+ @@ -91,15 +91,34 @@
6
+ }
7
+ }
8
+ /**
9
+ - * `update` carries the host's dynamic-prop snapshot; attributes that were
10
+ - * static in the compiled plan arrive only with `create`. Merge instead of
11
+ - * replace, or a first update would strip a node's static layout props.
12
+ + * `update` carries the host's complete prop bag: a key present in the last
13
+ + * applied bag but absent from the next is a removal, and the view state it
14
+ + * installed returns to the prop's documented default. `undefined` never
15
+ + * crosses the wire (the runtime elides it); `null` is "not supplied" for
16
+ + * props without an explicit nullable contract — both reset through setProp.
17
+ */
18
+ function updateProps(node, next) {
19
+ + const dropped = [];
20
+ + for (const name in node.props) {
21
+ + if (node.props[name] != null && !(name in next))
22
+ + dropped.push(name);
23
+ + }
24
+ applyProps(node, next);
25
+ - node.props = { ...node.props, ...next };
26
+ + for (const name of dropped) {
27
+ + resetProp(node, node.view, name);
28
+ + }
29
+ + node.props = next;
30
+ }
31
+ function setProp(node, view, name, value) {
32
+ + // Keep authored placement separate from Grid's computed native coordinates.
33
+ + // NativeScript does not retain a setter write equal to its default (row/col 0).
34
+ + if (name === 'row' || name === 'col' || name === 'rowSpan' || name === 'colSpan') {
35
+ + const key = Symbol.for('octane-xplat.grid-placement');
36
+ + const placement = view[key] ?? (view[key] = {});
37
+ + if (value == null || value === unsetValue) delete placement[name];
38
+ + else placement[name] = value;
39
+ + view.notify({ eventName: 'xplatGridPlacementChange', object: view });
40
+ + }
41
+ if (name === 'children' || name === 'key' || name === 'ref')
42
+ return;
43
+ // Event props arrive as their own `event` commands.
44
+ @@ -113,13 +132,28 @@
45
+ return;
46
+ }
47
+ if (name === 'style') {
48
+ - applyStyle(view, value);
49
+ + applyStyle(node, view, value);
50
+ return;
51
+ }
52
+ if (name === 'renderItem' && view instanceof ListView) {
53
+ setRenderItem(view, value ?? null, createNativeScriptRoot);
54
+ return;
55
+ }
56
+ + // `null`/`unsetValue` restore the prop's default rather than writing a
57
+ + // literal null through a native setter. `undefined` is a removal: skip it
58
+ + // when nothing applied (NativeScript setters coerce it badly) and reset
59
+ + // when a real value did.
60
+ + if (value == null || value === unsetValue) {
61
+ + if (value === undefined && node.props[name] == null)
62
+ + return;
63
+ + resetProp(node, view, name);
64
+ + return;
65
+ + }
66
+ + // Capture the pre-prop value once so a plain (non-Property) field can be
67
+ + // restored when the prop is removed later.
68
+ + const defaults = (node.propDefaults ??= {});
69
+ + if (!(name in defaults))
70
+ + defaults[name] = view[name];
71
+ // Core raises `<name>Change` for a script write exactly as for a user
72
+ // edit; a controlled input must not see its own value come back as one.
73
+ const echo = `${name}Change`;
74
+ @@ -128,6 +162,44 @@
75
+ node.muted.add(echo);
76
+ try {
77
+ view[name] = value;
78
+ + }
79
+ + finally {
80
+ + if (listening)
81
+ + node.muted.delete(echo);
82
+ + }
83
+ +}
84
+ +/** Restore a removed prop to the value it holds when never supplied. */
85
+ +function resetProp(node, view, name) {
86
+ + if (view === null)
87
+ + return;
88
+ + if (name === 'children' || name === 'key' || name === 'ref')
89
+ + return;
90
+ + // `on*` handlers unbind through `event` commands, not props.
91
+ + if (EVENT_PROP.test(name))
92
+ + return;
93
+ + if (name === 'className' || name === 'class') {
94
+ + view.className = unsetValue;
95
+ + return;
96
+ + }
97
+ + if (name === 'style') {
98
+ + applyStyle(node, view, null);
99
+ + return;
100
+ + }
101
+ + if (name === 'renderItem' && view instanceof ListView) {
102
+ + setRenderItem(view, null, createNativeScriptRoot);
103
+ + return;
104
+ + }
105
+ + const echo = `${name}Change`;
106
+ + const listening = node.listeners.has(echo);
107
+ + if (listening)
108
+ + node.muted.add(echo);
109
+ + try {
110
+ + // Property/CssProperty setters consume the sentinel and restore the
111
+ + // declared default. A plain field stores it raw — detect that and
112
+ + // write back the captured pre-prop value instead.
113
+ + view[name] = unsetValue;
114
+ + if (view[name] === unsetValue)
115
+ + view[name] = node.propDefaults?.[name];
116
+ }
117
+ finally {
118
+ if (listening)
119
+ @@ -147,15 +219,67 @@
120
+ .join(' ');
121
+ return '';
122
+ }
123
+ -function applyStyle(view, value) {
124
+ - if (value == null || value === unsetValue)
125
+ - return;
126
+ +/**
127
+ + * The `style` prop replaces wholesale — a key dropped or nulled since the last
128
+ + * apply resets what it installed (`unsetValue` clears a local CssProperty
129
+ + * value so the cascade can re-apply). String styles are parsed for their
130
+ + * declared names so a later object or removal can reset them.
131
+ + */
132
+ +function applyStyle(node, view, value) {
133
+ + const applied = node.styleKeys;
134
+ + node.styleKeys = undefined;
135
+ if (typeof value === 'string') {
136
+ + clearStyleKeys(view, applied);
137
+ view.setInlineStyle(value);
138
+ + node.styleKeys = inlineStyleKeys(value);
139
+ return;
140
+ }
141
+ - if (typeof value === 'object')
142
+ - Object.assign(view.style, value);
143
+ + if (value == null || value === unsetValue || typeof value !== 'object') {
144
+ + clearStyleKeys(view, applied);
145
+ + return;
146
+ + }
147
+ + if (applied !== undefined) {
148
+ + for (const key of applied) {
149
+ + if (!(key in value))
150
+ + unsetStyleKey(view, key);
151
+ + }
152
+ + }
153
+ + for (const [key, nextValue] of Object.entries(value)) {
154
+ + if (nextValue == null)
155
+ + unsetStyleKey(view, key);
156
+ + else
157
+ + view.style[key] = nextValue;
158
+ + }
159
+ + node.styleKeys = new Set(Object.keys(value));
160
+ +}
161
+ +function clearStyleKeys(view, keys) {
162
+ + if (keys === undefined)
163
+ + return;
164
+ + for (const key of keys)
165
+ + unsetStyleKey(view, key);
166
+ +}
167
+ +function unsetStyleKey(view, name) {
168
+ + const style = view.style;
169
+ + if (name.startsWith('--')) {
170
+ + style.setUnscopedCssVariable?.(name, unsetValue);
171
+ + return;
172
+ + }
173
+ + style[name] = unsetValue;
174
+ + // A style field outside the CssProperty registry stores the sentinel raw.
175
+ + if (style[name] === unsetValue)
176
+ + style[name] = undefined;
177
+ +}
178
+ +function inlineStyleKeys(style) {
179
+ + const keys = new Set();
180
+ + for (const declaration of style.split(';')) {
181
+ + const colon = declaration.indexOf(':');
182
+ + if (colon === -1)
183
+ + continue;
184
+ + const name = declaration.slice(0, colon).trim();
185
+ + if (name !== '')
186
+ + keys.add(name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()));
187
+ + }
188
+ + return keys;
189
+ }
190
+ /** Recompute a text host's `text` from its `#text` children. */
191
+ function syncText(parent) {
192
+ @@ -641,7 +765,7 @@
193
+ }
194
+ export const nativeScriptDriver = {
195
+ id: NATIVESCRIPT_RENDERER_ID,
196
+ - capabilities: { text: 'host' },
197
+ + capabilities: { text: 'host', visibility: true },
198
+ events: {
199
+ classify(name) {
200
+ if (!EVENT_PROP.test(name))
201
+ diff --git a/dist/intrinsics.d.ts b/dist/intrinsics.d.ts
202
+ index 45a47cbbce199df9635852ca4cdb2849e9bbc83d..d555b50c08276e925132b2be9bb62302fe0a4228 100644
203
+ --- a/dist/intrinsics.d.ts
204
+ +++ b/dist/intrinsics.d.ts
205
+ @@ -24,9 +24,9 @@
206
+ */
207
+ import type * as NS from '@nativescript/core';
208
+ export type NativeScriptNode = unknown;
209
+ -type Ref<TInstance> = ((instance: TInstance | null) => void) | {
210
+ +type Ref<TInstance> = ((instance: TInstance | null) => void | (() => void)) | {
211
+ current: TInstance | null;
212
+ -} | null;
213
+ +} | readonly Ref<TInstance>[] | null | undefined;
214
+ /**
215
+ * The driver assigns every non-event prop onto the view instance, so a JSX
216
+ * attribute is a NativeScript view property rather than a DOM attribute.
217
+ @@ -117,7 +117,7 @@ export interface ListViewAttributes {
218
+ }
219
+ export interface OctaneAttributes<TInstance> {
220
+ key?: string | number;
221
+ - ref?: Ref<TInstance> | readonly Ref<TInstance>[];
222
+ + ref?: Ref<TInstance>;
223
+ children?: NativeScriptNode;
224
+ }
225
+ type Overridden = keyof CommonAttributes | keyof OctaneAttributes<unknown> | keyof CommonEvents<unknown>;