@lytjs/renderer 4.0.4 → 4.1.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/dom.cjs +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/native.cjs +1 -1
- package/dist/native.mjs +1 -1
- package/dist/ssr.cjs +1 -1
- package/dist/ssr.mjs +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/dom/dom-renderer.d.ts.map +1 -1
- package/dist/types/dom/index.d.ts.map +1 -1
- package/dist/types/dom/patch-events.d.ts +2 -2
- package/dist/types/dom/patch-events.d.ts.map +1 -1
- package/dist/types/miniapp/index.d.ts.map +1 -1
- package/dist/types/miniapp/miniapp-renderer.d.ts +3 -3
- package/dist/types/miniapp/miniapp-renderer.d.ts.map +1 -1
- package/dist/types/native/index.d.ts.map +1 -1
- package/dist/types/native/native-renderer.d.ts +2 -2
- package/dist/types/native/native-renderer.d.ts.map +1 -1
- package/dist/types/ssr/hydration.d.ts.map +1 -1
- package/dist/types/ssr/index.d.ts.map +1 -1
- package/dist/types/ssr/ssr-renderer.d.ts.map +1 -1
- package/dist/types/vapor/index.d.ts.map +1 -1
- package/dist/types/vapor/vapor-compiler.d.ts +3 -3
- package/dist/types/vapor/vapor-compiler.d.ts.map +1 -1
- package/dist/types/vapor/vapor-component.d.ts +1 -1
- package/dist/types/vapor/vapor-component.d.ts.map +1 -1
- package/dist/types/vapor/vapor-reactive.d.ts +7 -6
- package/dist/types/vapor/vapor-reactive.d.ts.map +1 -1
- package/dist/types/vapor/vapor-renderer.d.ts +8 -8
- package/dist/types/vapor/vapor-renderer.d.ts.map +1 -1
- package/dist/vapor.cjs +1 -1
- package/dist/vapor.mjs +1 -1
- package/package.json +3 -3
package/dist/dom.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var M=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var me=(n,e)=>{for(var t in e)M(n,t,{get:e[t],enumerable:!0})},ve=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ye(e))!ue.call(n,r)&&r!==t&&M(n,r,{get:()=>e[r],enumerable:!(o=pe(e,r))||o.enumerable});return n};var Ne=n=>ve(M({},"__esModule",{value:!0}),n);var Ie={};me(Ie,{Comment:()=>K,DOMRenderer:()=>C,Fragment:()=>P,PatchFlags:()=>x,PatchPropFlags:()=>X,ShapeFlags:()=>u,Text:()=>k,createInvoker:()=>z,createRenderer:()=>ee,domRenderer:()=>de,getEventInvokers:()=>se,getEventKey:()=>G,getSVGPropName:()=>ie,isSVGElement:()=>_,normalizeEventName:()=>I,parseEventModifier:()=>B,patchAllProps:()=>T,patchClass:()=>v,patchDOMProp:()=>w,patchDOMProps:()=>re,patchElementProps:()=>fe,patchEvent:()=>L,patchEventOnElement:()=>le,patchProp:()=>y,patchStyle:()=>N,removeAllEventListeners:()=>D,removeDOMProp:()=>h,setDOMProp:()=>E});module.exports=Ne(Ie);var $=require("@lytjs/vdom");var u=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(u||{}),x=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(x||{}),P=Symbol("Fragment"),k=Symbol("Text"),K=Symbol("Comment");function m(n){return n.type===P}function R(n){return n.type===k}function V(n){return n.type===K}function F(n,e){return n.type===e.type&&n.key===e.key}function W(n){return Array.isArray(n.dynamicChildren)}function J(n,e,t,o){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o);else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();n.addEventListener(e,r,o)}else t==="key"||t==="ref"||n.setAttribute(e,t,o)}function H(n,e,t,o,r){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o||{});else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r&&n.removeEventListener(e,i,r),o&&n.addEventListener(e,i,o)}else n.setAttribute(e,t,o)}function j(n,e,t,o){for(let r in o){if(r==="key"||r==="ref")continue;let i=t[r],s=o[r];s!==i&&H(n,e,r,s,i)}for(let r in t)if(!(r==="key"||r==="ref")&&!(r in o))if(r==="class")n.setClass(e,"");else if(r==="style")n.setStyle(e,{});else if(r.startsWith("on")||r.startsWith("@")){let i=r.startsWith("@")?r.slice(1).toLowerCase():r.slice(2).toLowerCase();n.removeEventListener(e,i,t[r])}else n.removeAttribute(e,r)}function U(n,e,t,o,r,i){let{shapeFlag:s}=t;if(m(t)){he(n,e,t,o,r,i);return}if(R(t)){let a=n.createText(t.children);t.el=a,n.insert(o,a,r);return}if(V(t)){let a=n.createComment(t.children);t.el=a,n.insert(o,a,r);return}if(s&1){Ee(n,e,t,o,r,i);return}if(s&6){ge(e,t,o,r,i);return}}function Ee(n,e,t,o,r,i){let s=t.type,a=n.createElement(s);if(t.el=a,t.props)for(let d in t.props){let p=t.props[d];J(n,a,d,p)}let{shapeFlag:c,children:f}=t;c&8?a.textContent=f:c&16&&A(e,f,a,null,i),n.insert(o,a,r)}function A(n,e,t,o,r){for(let i=0;i<e.length;i++)n(null,e[i],t,o,r)}function he(n,e,t,o,r,i){let{children:s}=t,a=n.createComment("");n.insert(o,a,r),Array.isArray(s)&&s.length>0&&A(e,s,o,a,i),t.el=a,t.anchor=a}function ge(n,e,t,o,r){let i=e.component;i&&i.update&&i.update(),i&&i.subTree&&(n(null,i.subTree,t,o,i),e.el=i.subTree.el)}function Q(n,e,t,o){let{shapeFlag:r,children:i}=t;if(m(t)){if(Array.isArray(i))for(let s=0;s<i.length;s++)e(i[s],o);t.anchor&&t.anchor.parentNode&&n.remove(t.anchor);return}if(r&6){t.component&&t.component.subTree&&e(t.component.subTree,o);return}t.el&&n.remove(t.el)}function b(n,e){for(let t=0;t<e.length;t++)n(e[t])}var S=require("@lytjs/vdom");function O(n,e,t,o,r,i=null,s=null){if(o==null){t&&e(t,r);return}if(t===null){U(n,Y(n,e),o,r,i,s);return}if(W(o)&&W(t)){xe(n,e,t,o,r,s);return}if(!F(t,o)){e(t,r),U(n,Y(n,e),o,r,i,s);return}o.el=t.el,o.anchor=t.anchor;let{shapeFlag:a}=o;if(m(o)){Ce(n,e,t,o,r,i,s);return}if(R(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(V(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(a&1){Le(n,e,t,o,s);return}if(a&6){Re(t,o,s);return}}function Y(n,e){return(t,o,r,i,s)=>{O(n,e,t,o,r,i,s)}}function Le(n,e,t,o,r=null){let i=o.el=t.el,s=t.props||{},a=o.props||{},{patchFlag:c,dynamicProps:f}=o;if(c&&c>0){if(c&1&&t.children!==o.children&&(i.textContent=o.children),c&2&&s.class!==a.class&&n.setClass(i,a.class),c&4&&s.style!==a.style&&n.setStyle(i,a.style||{}),c&8&&f)for(let d=0;d<f.length;d++){let p=f[d],l=s[p],q=a[p];q!==l&&H(n,i,p,q,l)}c&16&&j(n,i,s,a)}else j(n,i,s,a);(!c||!(c&1))&&Z(n,e,t,o,i,null,r)}function Z(n,e,t,o,r,i,s){let a=t.shapeFlag,c=o.shapeFlag,f=t.children,d=o.children;if(c&8){a&16&&b(e,f),f!==d&&(r.textContent=d);return}if(c&16){a&16?Te(n,e,f,d,r,i,s):(a&8&&(r.textContent=""),A(Y(n,e),d,r,i,s));return}d==null&&(a&8?r.textContent="":a&16&&b(e,f))}function Te(n,e,t,o,r,i,s){o.every(c=>c.key!==null&&c.key!==void 0)&&t.every(c=>c.key!==null&&c.key!==void 0)?(0,S.patchKeyedChildren)(t,o,r,i,s,null,!1):(0,S.patchUnkeyedChildren)(t,o,r,i,s,null,!1)}function Ce(n,e,t,o,r,i,s){let a=t.children,c=o.children;Array.isArray(c)&&c.length>0?(Z(n,e,t,o,r,i,s),o.el=c[0].el,o.anchor=c[c.length-1].el?n.nextSibling(c[c.length-1].el):i):Array.isArray(a)&&a.length>0&&c===null?(b(e,a),o.el=t.el,o.anchor=t.anchor):(o.el=t.el,o.anchor=t.anchor)}function xe(n,e,t,o,r,i){let s=t.dynamicChildren,a=o.dynamicChildren;for(let c=0;c<a.length;c++)O(n,e,s[c],a[c],r,null,i)}function Re(n,e,t){e.component=n.component,e.el=n.el,e.component&&e.component.update&&e.component.update()}function ee(n){function e(r,i){Q(n,e,r,i)}(0,$.registerDOMOperations)({insert(r,i,s){n.insert(i,r,s)},createElement(r){return n.createElement(r)},createText(r){return n.createText(r)},setText(r,i){r.nodeValue=i},setElementText(r,i){r.textContent=i},remove(r){n.remove(r)},createComment(r){return n.createComment(r)},mount(r,i,s,a,c,f,d){o(null,r,i,s,a)},patch(r,i,s,a,c,f,d,p){o(r,i,s,a,c)},unmount(r,i,s,a){e(r)},move(r,i,s){n.insert(i,r.el,s)}});function o(r,i,s,a,c){O(n,e,r,i,s,a,c)}return{mount(r,i){i.nodeType===1&&(i.textContent=""),o(null,r,i,null,null)},patch(r,i,s){var a;o(r,i,s||((a=r.el)==null?void 0:a.parentNode),null,null)},unmount(r,i){e(r,i)}}}var ne={acceptCharset:"acceptCharset",accessKey:"accessKey",className:"className",htmlFor:"htmlFor",httpEquiv:"httpEquiv",tabIndex:"tabIndex"},oe={allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,inert:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0},Ve={"accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","baseline-shift":"baselineShift","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","paint-order":"paintOrder","pointer-events":"pointerEvents","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","transform-origin":"transformOrigin","word-spacing":"wordSpacing","writing-mode":"writingMode","xlink:href":"xlinkHref","xlink:title":"xlinkTitle","xml:lang":"xmlLang","xml:space":"xmlSpace"};function E(n,e,t){if(e==="class"){n.className=t==null?"":String(t);return}if(e==="style"){if(typeof t=="string")n.style.cssText=t;else if(t!=null&&typeof t=="object")for(let r in t)n.style[r]=t[r];else n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let r=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase();typeof t=="function"&&n.addEventListener(r,t);return}if(e in oe){t?(n.setAttribute(e,""),e in n&&(n[e]=!0)):(n.removeAttribute(e),e in n&&(n[e]=!1));return}let o=ne[e]||e;if(o in n){try{n[o]=t==null?"":t}catch(r){n.setAttribute(e,t==null?"":String(t))}return}t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,String(t))}function h(n,e){if(e==="class"){n.className="";return}if(e==="style"){n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let o=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase(),r=n._vei;if(r){let i="on"+o.charAt(0).toUpperCase()+o.slice(1),s=r[i];s&&(n.removeEventListener(o,s),r[i]=void 0)}return}if(e in oe){n.removeAttribute(e),e in n&&(n[e]=!1);return}let t=ne[e]||e;if(t in n){try{n[t]=""}catch(o){n.removeAttribute(e)}return}n.removeAttribute(e)}function te(n){return n.startsWith("on")||n.startsWith("@")}function re(n,e,t){let o=e?Object.keys(e):[],r=t?Object.keys(t):[];for(let i=0;i<r.length;i++){let s=r[i],a=t[s],c=e?e[s]:void 0;s==="key"||s==="ref"||a!==c&&(s==="class"?n.className=a==null?"":String(a):s==="style"?Ae(n,a,c):te(s)||E(n,s,a))}for(let i=0;i<o.length;i++){let s=o[i];s==="key"||s==="ref"||(!t||!(s in t))&&(s==="class"?n.className="":s==="style"?n.style.cssText="":te(s)||h(n,s))}}function Ae(n,e,t){if(!e||typeof e=="string"&&!e.trim()){n.style.cssText="";return}if(typeof e=="string"){n.style.cssText=e;return}if(typeof t=="object"&&t!==null)for(let o in t)o in e||(n.style[o]="");for(let o in e)n.style[o]=e[o]}function _(n){return n==="svg"||n==="path"||n==="circle"||n==="rect"||n==="line"||n==="polyline"||n==="polygon"||n==="ellipse"||n==="g"||n==="defs"||n==="use"||n==="text"||n==="tspan"||n==="clipPath"||n==="mask"||n==="filter"||n==="linearGradient"||n==="radialGradient"||n==="stop"||n==="pattern"||n==="symbol"||n==="image"||n==="foreignObject"||n==="animate"||n==="animateTransform"||n==="animateMotion"}function ie(n){return Ve[n]||n}var be=/^(?:@|on)/;function I(n){return n.replace(be,"").toLowerCase()}function G(n){let e=I(n);return"on"+e.charAt(0).toUpperCase()+e.slice(1)}var Se={stop:"stop",prevent:"prevent",capture:"capture",once:"once",self:"self",passive:"passive"};function B(n){let e=n.split("."),o={name:e[0],stop:!1,prevent:!1,capture:!1,once:!1,self:!1,passive:!1};for(let r=1;r<e.length;r++){let i=e[r],s=Se[i];s&&(o[s]=!0)}return o}function z(n){let e=(t=>{e.value&&e.value(t)});return e.value=n,e}var g="_vei";function se(n){return n[g]||null}function L(n,e,t,o,r){let i=G(e),s=B(I(e)),a=s.name,c=n[g];c||(c=n[g]={});let f=c[i];if(t&&f)f.value=t;else if(t&&!f){let d=z(t);c[i]=d;let p={};s.capture&&(p.capture=!0),s.once&&(p.once=!0),s.passive&&(p.passive=!0),n.addEventListener(a,d,p)}else!t&&f&&(n.removeEventListener(a,f),c[i]=void 0)}function D(n){let e=n[g];if(e){for(let t in e){let o=e[t];if(o){let r=t.charAt(2).toLowerCase()+t.slice(3);n.removeEventListener(r,o)}}n[g]={}}}var X=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(X||{});function v(n,e,t){let o=ce(e);o!==t&&(n.className=o)}function ce(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++){let r=ce(n[o]);r&&(t+=(t?" ":"")+r)}return t}let e="";for(let t in n)n[t]&&(e+=(e?" ":"")+t);return e}return String(n)}function N(n,e,t){if(!e){n.style.cssText="";return}if(!t){typeof e=="string"?n.style.cssText=e:typeof e=="object"&&ae(n,e);return}if(typeof e!=typeof t){n.style.cssText="",typeof e=="string"?n.style.cssText=e:typeof e=="object"&&ae(n,e);return}if(typeof e=="string"){e!==t&&(n.style.cssText=e);return}if(typeof e=="object"&&typeof t=="object"){for(let o in t)o in e||(n.style[o]="");for(let o in e){let r=e[o],i=t[o];r!==i&&(n.style[o]=r==null?"":r)}}}function ae(n,e){for(let t in e)n.style[t]=e[t]===null||e[t]===void 0?"":e[t]}function le(n,e,t,o){L(n,"",e,t,o)}var Oe=new Set(["class","style","key","ref"]);function _e(n){return n.length>2&&(n[0]==="o"||n[0]==="O"||n[0]==="@")&&(n[1]==="n"||n[1]==="N")}function w(n,e,t,o,r){if(!Oe.has(e)){if(e==="class"){v(n,t,o);return}if(e==="style"){N(n,t,o);return}if(_e(e)){L(n,e,t,o,r);return}if(t===!1||t===null||t===void 0){n.removeAttribute(e);return}if(e in n)try{n[e]=t}catch(i){n.setAttribute(e,String(t))}else n.setAttribute(e,String(t))}}function y(n,e,t,o,r){w(n,e,t,o,r)}function T(n,e,t,o){if(t)for(let r in t){if(r==="key"||r==="ref")continue;let i=t[r],s=e?e[r]:void 0;i!==s&&y(n,r,i,s,o)}if(e)for(let r in e)r==="key"||r==="ref"||(!t||!(r in t))&&y(n,r,null,e[r],o)}function fe(n,e,t,o){let r=e.props||{},i=t.props||{},{patchFlag:s,dynamicProps:a}=t;if(!s||s===-1){T(n,r,i,o);return}if(s===-2){T(n,r,i,o);return}if(s&1&&e.children!==t.children&&(n.textContent=t.children),s&2&&r.class!==i.class&&v(n,i.class,r.class),s&4&&r.style!==i.style&&N(n,i.style,r.style),s&8&&a)for(let c=0;c<a.length;c++){let f=a[c],d=r[f],p=i[f];p!==d&&y(n,f,p,d,o)}s&16&&T(n,r,i,o)}var C=class{createElement(e){return _(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}createText(e){return document.createTextNode(e)}createComment(e){return document.createComment(e)}setAttribute(e,t,o){E(e,t,o)}removeAttribute(e,t){h(e,t)}setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let o in t)e.style[o]=t[o]}setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let o="";for(let r in t)t[r]&&(o+=(o?" ":"")+r);e.className=o}else e.className=""}insert(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}replace(e,t,o){e.replaceChild(o,t)}addEventListener(e,t,o,r){e.addEventListener(t,o,r)}removeEventListener(e,t,o){e.removeEventListener(t,o)}nextTick(e){Promise.resolve().then(e)}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}querySelector(e){return document.querySelector(e)}setClassWithOld(e,t,o){v(e,t,o)}setStyleWithOld(e,t,o){N(e,t,o)}setAttributeWithOld(e,t,o,r){y(e,t,o,r)}setElementText(e,t){e.textContent=t}setText(e,t){e.nodeValue=t}insertBefore(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}removeChild(e,t){e.removeChild(t)}setAnchor(e,t){e.anchor=t}getNextSibling(e){return e.nextSibling}cleanupEvents(e){D(e)}},de=new C;
|
|
1
|
+
var M=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var me=(n,e)=>{for(var t in e)M(n,t,{get:e[t],enumerable:!0})},ve=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ye(e))!ue.call(n,r)&&r!==t&&M(n,r,{get:()=>e[r],enumerable:!(o=de(e,r))||o.enumerable});return n};var Ne=n=>ve(M({},"__esModule",{value:!0}),n);var Ie={};me(Ie,{Comment:()=>K,DOMRenderer:()=>C,Fragment:()=>P,PatchFlags:()=>x,PatchPropFlags:()=>z,ShapeFlags:()=>u,Text:()=>k,createInvoker:()=>X,createRenderer:()=>ee,domRenderer:()=>pe,getEventInvokers:()=>se,getEventKey:()=>G,getSVGPropName:()=>ie,isSVGElement:()=>_,normalizeEventName:()=>I,parseEventModifier:()=>B,patchAllProps:()=>T,patchClass:()=>v,patchDOMProp:()=>w,patchDOMProps:()=>re,patchElementProps:()=>fe,patchEvent:()=>L,patchEventOnElement:()=>le,patchProp:()=>y,patchStyle:()=>N,removeAllEventListeners:()=>D,removeDOMProp:()=>h,setDOMProp:()=>E});module.exports=Ne(Ie);var $=require("@lytjs/vdom");var u=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(u||{}),x=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(x||{}),P=Symbol("Fragment"),k=Symbol("Text"),K=Symbol("Comment");function m(n){return n.type===P}function R(n){return n.type===k}function V(n){return n.type===K}function F(n,e){return n.type===e.type&&n.key===e.key}function W(n){return Array.isArray(n.dynamicChildren)}function J(n,e,t,o){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o);else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();n.addEventListener(e,r,o)}else t==="key"||t==="ref"||n.setAttribute(e,t,o)}function H(n,e,t,o,r){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o||{});else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r&&n.removeEventListener(e,i,r),o&&n.addEventListener(e,i,o)}else n.setAttribute(e,t,o)}function j(n,e,t,o){for(let r in o){if(r==="key"||r==="ref")continue;let i=t[r],s=o[r];s!==i&&H(n,e,r,s,i)}for(let r in t)if(!(r==="key"||r==="ref")&&!(r in o))if(r==="class")n.setClass(e,"");else if(r==="style")n.setStyle(e,{});else if(r.startsWith("on")||r.startsWith("@")){let i=r.startsWith("@")?r.slice(1).toLowerCase():r.slice(2).toLowerCase();n.removeEventListener(e,i,t[r])}else n.removeAttribute(e,r)}function U(n,e,t,o,r,i){let{shapeFlag:s}=t;if(m(t)){he(n,e,t,o,r,i);return}if(R(t)){let a=n.createText(t.children);t.el=a,n.insert(o,a,r);return}if(V(t)){let a=n.createComment(t.children);t.el=a,n.insert(o,a,r);return}if(s&1){Ee(n,e,t,o,r,i);return}if(s&6){ge(e,t,o,r,i);return}}function Ee(n,e,t,o,r,i){let s=t.type,a=n.createElement(s);if(t.el=a,t.props)for(let p in t.props){let d=t.props[p];J(n,a,p,d)}let{shapeFlag:c,children:f}=t;c&8?a.textContent=f:c&16&&A(e,f,a,null,i),n.insert(o,a,r)}function A(n,e,t,o,r){for(let i=0;i<e.length;i++)n(null,e[i],t,o,r)}function he(n,e,t,o,r,i){let{children:s}=t,a=n.createComment("");n.insert(o,a,r),Array.isArray(s)&&s.length>0&&A(e,s,o,a,i),t.el=a,t.anchor=a}function ge(n,e,t,o,r){let i=e.component;i&&i.update&&i.update(),i&&i.subTree&&(n(null,i.subTree,t,o,i),e.el=i.subTree.el)}function Q(n,e,t,o){let{shapeFlag:r,children:i}=t;if(m(t)){if(Array.isArray(i))for(let s=0;s<i.length;s++)e(i[s],o);t.anchor&&t.anchor.parentNode&&n.remove(t.anchor);return}if(r&6){t.component&&t.component.subTree&&e(t.component.subTree,o);return}t.el&&n.remove(t.el)}function b(n,e){for(let t=0;t<e.length;t++)n(e[t])}var S=require("@lytjs/vdom");function O(n,e,t,o,r,i=null,s=null){if(o==null){t&&e(t,r);return}if(t===null){U(n,Y(n,e),o,r,i,s);return}if(W(o)&&W(t)){xe(n,e,t,o,r,s);return}if(!F(t,o)){e(t,r),U(n,Y(n,e),o,r,i,s);return}o.el=t.el,o.anchor=t.anchor;let{shapeFlag:a}=o;if(m(o)){Ce(n,e,t,o,r,i,s);return}if(R(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(V(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(a&1){Le(n,e,t,o,s);return}if(a&6){Re(t,o,s);return}}function Y(n,e){return(t,o,r,i,s)=>{O(n,e,t,o,r,i,s)}}function Le(n,e,t,o,r=null){let i=o.el=t.el,s=t.props||{},a=o.props||{},{patchFlag:c,dynamicProps:f}=o;if(c&&c>0){if(c&1&&t.children!==o.children&&(i.textContent=o.children),c&2&&s.class!==a.class&&n.setClass(i,a.class),c&4&&s.style!==a.style&&n.setStyle(i,a.style||{}),c&8&&f)for(let p=0;p<f.length;p++){let d=f[p],l=s[d],q=a[d];q!==l&&H(n,i,d,q,l)}c&16&&j(n,i,s,a)}else j(n,i,s,a);(!c||!(c&1))&&Z(n,e,t,o,i,null,r)}function Z(n,e,t,o,r,i,s){let a=t.shapeFlag,c=o.shapeFlag,f=t.children,p=o.children;if(c&8){a&16&&b(e,f),f!==p&&(r.textContent=p);return}if(c&16){a&16?Te(n,e,f,p,r,i,s):(a&8&&(r.textContent=""),A(Y(n,e),p,r,i,s));return}p==null&&(a&8?r.textContent="":a&16&&b(e,f))}function Te(n,e,t,o,r,i,s){o.every(c=>c.key!==null&&c.key!==void 0)&&t.every(c=>c.key!==null&&c.key!==void 0)?(0,S.patchKeyedChildren)(t,o,r,i,s,null,!1):(0,S.patchUnkeyedChildren)(t,o,r,i,s,null,!1)}function Ce(n,e,t,o,r,i,s){let a=t.children,c=o.children;Array.isArray(c)&&c.length>0?(Z(n,e,t,o,r,i,s),o.el=c[0].el,o.anchor=c[c.length-1].el?n.nextSibling(c[c.length-1].el):i):Array.isArray(a)&&a.length>0&&c===null?(b(e,a),o.el=t.el,o.anchor=t.anchor):(o.el=t.el,o.anchor=t.anchor)}function xe(n,e,t,o,r,i){let s=t.dynamicChildren,a=o.dynamicChildren;for(let c=0;c<a.length;c++)O(n,e,s[c],a[c],r,null,i)}function Re(n,e,t){e.component=n.component,e.el=n.el,e.component&&e.component.update&&e.component.update()}function ee(n){function e(r,i){Q(n,e,r,i)}(0,$.registerDOMOperations)({insert(r,i,s){n.insert(i,r,s)},createElement(r){return n.createElement(r)},createText(r){return n.createText(r)},setText(r,i){r.nodeValue=i},setElementText(r,i){r.textContent=i},remove(r){n.remove(r)},createComment(r){return n.createComment(r)},mount(r,i,s,a,c,f,p){o(null,r,i,s,a)},patch(r,i,s,a,c,f,p,d){o(r,i,s,a,c)},unmount(r,i,s,a){e(r)},move(r,i,s){n.insert(i,r.el,s)}});function o(r,i,s,a,c){O(n,e,r,i,s,a,c)}return{mount(r,i){i.nodeType===1&&(i.textContent=""),o(null,r,i,null,null)},patch(r,i,s){var a;o(r,i,s||((a=r.el)==null?void 0:a.parentNode),null,null)},unmount(r,i){e(r,i)}}}var ne={acceptCharset:"acceptCharset",accessKey:"accessKey",className:"className",htmlFor:"htmlFor",httpEquiv:"httpEquiv",tabIndex:"tabIndex"},oe={allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,inert:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0},Ve={"accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","baseline-shift":"baselineShift","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","paint-order":"paintOrder","pointer-events":"pointerEvents","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","transform-origin":"transformOrigin","word-spacing":"wordSpacing","writing-mode":"writingMode","xlink:href":"xlinkHref","xlink:title":"xlinkTitle","xml:lang":"xmlLang","xml:space":"xmlSpace"};function E(n,e,t){if(e==="class"){n.className=t==null?"":String(t);return}if(e==="style"){if(typeof t=="string")n.style.cssText=t;else if(t!=null&&typeof t=="object")for(let r in t)n.style[r]=t[r];else n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let r=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase();typeof t=="function"&&n.addEventListener(r,t);return}if(e in oe){t?(n.setAttribute(e,""),e in n&&(n[e]=!0)):(n.removeAttribute(e),e in n&&(n[e]=!1));return}let o=ne[e]||e;if(o in n){try{n[o]=t==null?"":t}catch(r){n.setAttribute(e,t==null?"":String(t))}return}t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,String(t))}function h(n,e){if(e==="class"){n.className="";return}if(e==="style"){n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let o=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase(),r=n._vei;if(r){let i="on"+o.charAt(0).toUpperCase()+o.slice(1),s=r[i];s&&(n.removeEventListener(o,s),r[i]=void 0)}return}if(e in oe){n.removeAttribute(e),e in n&&(n[e]=!1);return}let t=ne[e]||e;if(t in n){try{n[t]=""}catch(o){n.removeAttribute(e)}return}n.removeAttribute(e)}function te(n){return n.startsWith("on")||n.startsWith("@")}function re(n,e,t){let o=e?Object.keys(e):[],r=t?Object.keys(t):[];for(let i=0;i<r.length;i++){let s=r[i],a=t[s],c=e?e[s]:void 0;s==="key"||s==="ref"||a!==c&&(s==="class"?n.className=a==null?"":String(a):s==="style"?Ae(n,a,c):te(s)||E(n,s,a))}for(let i=0;i<o.length;i++){let s=o[i];s==="key"||s==="ref"||(!t||!(s in t))&&(s==="class"?n.className="":s==="style"?n.style.cssText="":te(s)||h(n,s))}}function Ae(n,e,t){if(!e||typeof e=="string"&&!e.trim()){n.style.cssText="";return}if(typeof e=="string"){n.style.cssText=e;return}if(typeof t=="object"&&t!==null)for(let o in t)o in e||(n.style[o]="");for(let o in e)n.style[o]=e[o]}function _(n){return n==="svg"||n==="path"||n==="circle"||n==="rect"||n==="line"||n==="polyline"||n==="polygon"||n==="ellipse"||n==="g"||n==="defs"||n==="use"||n==="text"||n==="tspan"||n==="clipPath"||n==="mask"||n==="filter"||n==="linearGradient"||n==="radialGradient"||n==="stop"||n==="pattern"||n==="symbol"||n==="image"||n==="foreignObject"||n==="animate"||n==="animateTransform"||n==="animateMotion"}function ie(n){return Ve[n]||n}var be=/^(?:@|on)/;function I(n){return n.replace(be,"").toLowerCase()}function G(n){let e=I(n);return"on"+e.charAt(0).toUpperCase()+e.slice(1)}var Se={stop:"stop",prevent:"prevent",capture:"capture",once:"once",self:"self",passive:"passive"};function B(n){let e=n.split("."),o={name:e[0],stop:!1,prevent:!1,capture:!1,once:!1,self:!1,passive:!1};for(let r=1;r<e.length;r++){let i=e[r],s=Se[i];s&&(o[s]=!0)}return o}function X(n){let e=(t=>{e.value&&e.value(t)});return e.value=n,e}var g="_vei";function se(n){return n[g]||null}function L(n,e,t,o,r){let i=G(e),s=B(I(e)),a=s.name,c=n[g];c||(c=n[g]={});let f=c[i];if(t&&f)f.value=t;else if(t&&!f){let p=X(t);c[i]=p;let d={};s.capture&&(d.capture=!0),s.once&&(d.once=!0),s.passive&&(d.passive=!0),n.addEventListener(a,p,d)}else!t&&f&&(n.removeEventListener(a,f),c[i]=void 0)}function D(n){let e=n[g];if(e){for(let t in e){let o=e[t];if(o){let r=t.charAt(2).toLowerCase()+t.slice(3);n.removeEventListener(r,o)}}n[g]={}}}var z=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(z||{});function v(n,e,t){let o=ce(e);o!==t&&(n.className=o)}function ce(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++){let r=ce(n[o]);r&&(t+=(t?" ":"")+r)}return t}let e="";for(let t in n)n[t]&&(e+=(e?" ":"")+t);return e}return String(n)}function N(n,e,t){if(!e){n.style.cssText="";return}if(!t){typeof e=="string"?n.style.cssText=e:typeof e=="object"&&ae(n,e);return}if(typeof e!=typeof t){n.style.cssText="",typeof e=="string"?n.style.cssText=e:typeof e=="object"&&ae(n,e);return}if(typeof e=="string"){e!==t&&(n.style.cssText=e);return}if(typeof e=="object"&&typeof t=="object"){for(let o in t)o in e||(n.style[o]="");for(let o in e){let r=e[o],i=t[o];r!==i&&(n.style[o]=r==null?"":r)}}}function ae(n,e){for(let t in e)n.style[t]=e[t]===null||e[t]===void 0?"":e[t]}function le(n,e,t,o){L(n,"",e,t,o)}var Oe=new Set(["class","style","key","ref"]);function _e(n){return n.length>2&&(n[0]==="o"||n[0]==="O"||n[0]==="@")&&(n[1]==="n"||n[1]==="N")}function w(n,e,t,o,r){if(!Oe.has(e)){if(e==="class"){v(n,t,o);return}if(e==="style"){N(n,t,o);return}if(_e(e)){L(n,e,t,o,r);return}if(t===!1||t===null||t===void 0){n.removeAttribute(e);return}if(e in n)try{n[e]=t}catch(i){n.setAttribute(e,String(t))}else n.setAttribute(e,String(t))}}function y(n,e,t,o,r){w(n,e,t,o,r)}function T(n,e,t,o){if(t)for(let r in t){if(r==="key"||r==="ref")continue;let i=t[r],s=e?e[r]:void 0;i!==s&&y(n,r,i,s,o)}if(e)for(let r in e)r==="key"||r==="ref"||(!t||!(r in t))&&y(n,r,null,e[r],o)}function fe(n,e,t,o){let r=e.props||{},i=t.props||{},{patchFlag:s,dynamicProps:a}=t;if(!s||s===-1){T(n,r,i,o);return}if(s===-2){T(n,r,i,o);return}if(s&1&&e.children!==t.children&&(n.textContent=t.children),s&2&&r.class!==i.class&&v(n,i.class,r.class),s&4&&r.style!==i.style&&N(n,i.style,r.style),s&8&&a)for(let c=0;c<a.length;c++){let f=a[c],p=r[f],d=i[f];d!==p&&y(n,f,d,p,o)}s&16&&T(n,r,i,o)}var C=class{createElement(e){return _(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}createText(e){return document.createTextNode(e)}createComment(e){return document.createComment(e)}setAttribute(e,t,o){E(e,t,o)}removeAttribute(e,t){h(e,t)}setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let o in t)e.style[o]=t[o]}setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let o="";for(let r in t)t[r]&&(o+=(o?" ":"")+r);e.className=o}else e.className=""}insert(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}replace(e,t,o){e.replaceChild(o,t)}addEventListener(e,t,o,r){e.addEventListener(t,o,r)}removeEventListener(e,t,o){e.removeEventListener(t,o)}nextTick(e){Promise.resolve().then(e)}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}querySelector(e){return document.querySelector(e)}setClassWithOld(e,t,o){v(e,t,o)}setStyleWithOld(e,t,o){N(e,t,o)}setAttributeWithOld(e,t,o,r){y(e,t,o,r)}setElementText(e,t){e.textContent=t}setText(e,t){e.nodeValue=t}insertBefore(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}removeChild(e,t){e.removeChild(t)}setAnchor(e,t){e.anchor=t}getNextSibling(e){return e.nextSibling}cleanupEvents(e){D(e)}},pe=new C;
|
package/dist/dom.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{registerDOMOperations as pe}from"@lytjs/vdom";var m=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(m||{}),S=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(S||{}),H=Symbol("Fragment"),j=Symbol("Text"),U=Symbol("Comment");function y(n){return n.type===H}function h(n){return n.type===j}function g(n){return n.type===U}function Y(n,e){return n.type===e.type&&n.key===e.key}function O(n){return Array.isArray(n.dynamicChildren)}function G(n,e,t,o){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o);else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();n.addEventListener(e,r,o)}else t==="key"||t==="ref"||n.setAttribute(e,t,o)}function _(n,e,t,o,r){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o||{});else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r&&n.removeEventListener(e,i,r),o&&n.addEventListener(e,i,o)}else n.setAttribute(e,t,o)}function I(n,e,t,o){for(let r in o){if(r==="key"||r==="ref")continue;let i=t[r],s=o[r];s!==i&&_(n,e,r,s,i)}for(let r in t)if(!(r==="key"||r==="ref")&&!(r in o))if(r==="class")n.setClass(e,"");else if(r==="style")n.setStyle(e,{});else if(r.startsWith("on")||r.startsWith("@")){let i=r.startsWith("@")?r.slice(1).toLowerCase():r.slice(2).toLowerCase();n.removeEventListener(e,i,t[r])}else n.removeAttribute(e,r)}function D(n,e,t,o,r,i){let{shapeFlag:s}=t;if(y(t)){oe(n,e,t,o,r,i);return}if(h(t)){let a=n.createText(t.children);t.el=a,n.insert(o,a,r);return}if(g(t)){let a=n.createComment(t.children);t.el=a,n.insert(o,a,r);return}if(s&1){ne(n,e,t,o,r,i);return}if(s&6){re(e,t,o,r,i);return}}function ne(n,e,t,o,r,i){let s=t.type,a=n.createElement(s);if(t.el=a,t.props)for(let d in t.props){let p=t.props[d];G(n,a,d,p)}let{shapeFlag:c,children:f}=t;c&8?a.textContent=f:c&16&&L(e,f,a,null,i),n.insert(o,a,r)}function L(n,e,t,o,r){for(let i=0;i<e.length;i++)n(null,e[i],t,o,r)}function oe(n,e,t,o,r,i){let{children:s}=t,a=n.createComment("");n.insert(o,a,r),Array.isArray(s)&&s.length>0&&L(e,s,o,a,i),t.el=a,t.anchor=a}function re(n,e,t,o,r){let i=e.component;i&&i.update&&i.update(),i&&i.subTree&&(n(null,i.subTree,t,o,i),e.el=i.subTree.el)}function B(n,e,t,o){let{shapeFlag:r,children:i}=t;if(y(t)){if(Array.isArray(i))for(let s=0;s<i.length;s++)e(i[s],o);t.anchor&&t.anchor.parentNode&&n.remove(t.anchor);return}if(r&6){t.component&&t.component.subTree&&e(t.component.subTree,o);return}t.el&&n.remove(t.el)}function T(n,e){for(let t=0;t<e.length;t++)n(e[t])}import{patchKeyedChildren as ie,patchUnkeyedChildren as se}from"@lytjs/vdom";function C(n,e,t,o,r,i=null,s=null){if(o==null){t&&e(t,r);return}if(t===null){D(n,M(n,e),o,r,i,s);return}if(O(o)&&O(t)){fe(n,e,t,o,r,s);return}if(!Y(t,o)){e(t,r),D(n,M(n,e),o,r,i,s);return}o.el=t.el,o.anchor=t.anchor;let{shapeFlag:a}=o;if(y(o)){le(n,e,t,o,r,i,s);return}if(h(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(g(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(a&1){ae(n,e,t,o,s);return}if(a&6){de(t,o,s);return}}function M(n,e){return(t,o,r,i,s)=>{C(n,e,t,o,r,i,s)}}function ae(n,e,t,o,r=null){let i=o.el=t.el,s=t.props||{},a=o.props||{},{patchFlag:c,dynamicProps:f}=o;if(c&&c>0){if(c&1&&t.children!==o.children&&(i.textContent=o.children),c&2&&s.class!==a.class&&n.setClass(i,a.class),c&4&&s.style!==a.style&&n.setStyle(i,a.style||{}),c&8&&f)for(let d=0;d<f.length;d++){let p=f[d],l=s[p],W=a[p];W!==l&&_(n,i,p,W,l)}c&16&&I(n,i,s,a)}else I(n,i,s,a);(!c||!(c&1))&&z(n,e,t,o,i,null,r)}function z(n,e,t,o,r,i,s){let a=t.shapeFlag,c=o.shapeFlag,f=t.children,d=o.children;if(c&8){a&16&&T(e,f),f!==d&&(r.textContent=d);return}if(c&16){a&16?ce(n,e,f,d,r,i,s):(a&8&&(r.textContent=""),L(M(n,e),d,r,i,s));return}d==null&&(a&8?r.textContent="":a&16&&T(e,f))}function ce(n,e,t,o,r,i,s){o.every(c=>c.key!==null&&c.key!==void 0)&&t.every(c=>c.key!==null&&c.key!==void 0)?ie(t,o,r,i,s,null,!1):se(t,o,r,i,s,null,!1)}function le(n,e,t,o,r,i,s){let a=t.children,c=o.children;Array.isArray(c)&&c.length>0?(z(n,e,t,o,r,i,s),o.el=c[0].el,o.anchor=c[c.length-1].el?n.nextSibling(c[c.length-1].el):i):Array.isArray(a)&&a.length>0&&c===null?(T(e,a),o.el=t.el,o.anchor=t.anchor):(o.el=t.el,o.anchor=t.anchor)}function fe(n,e,t,o,r,i){let s=t.dynamicChildren,a=o.dynamicChildren;for(let c=0;c<a.length;c++)C(n,e,s[c],a[c],r,null,i)}function de(n,e,t){e.component=n.component,e.el=n.el,e.component&&e.component.update&&e.component.update()}function ye(n){function e(r,i){B(n,e,r,i)}pe({insert(r,i,s){n.insert(i,r,s)},createElement(r){return n.createElement(r)},createText(r){return n.createText(r)},setText(r,i){r.nodeValue=i},setElementText(r,i){r.textContent=i},remove(r){n.remove(r)},createComment(r){return n.createComment(r)},mount(r,i,s,a,c,f,d){o(null,r,i,s,a)},patch(r,i,s,a,c,f,d,p){o(r,i,s,a,c)},unmount(r,i,s,a){e(r)},move(r,i,s){n.insert(i,r.el,s)}});function o(r,i,s,a,c){C(n,e,r,i,s,a,c)}return{mount(r,i){i.nodeType===1&&(i.textContent=""),o(null,r,i,null,null)},patch(r,i,s){var a;o(r,i,s||((a=r.el)==null?void 0:a.parentNode),null,null)},unmount(r,i){e(r,i)}}}var w={acceptCharset:"acceptCharset",accessKey:"accessKey",className:"className",htmlFor:"htmlFor",httpEquiv:"httpEquiv",tabIndex:"tabIndex"},q={allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,inert:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0},ue={"accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","baseline-shift":"baselineShift","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","paint-order":"paintOrder","pointer-events":"pointerEvents","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","transform-origin":"transformOrigin","word-spacing":"wordSpacing","writing-mode":"writingMode","xlink:href":"xlinkHref","xlink:title":"xlinkTitle","xml:lang":"xmlLang","xml:space":"xmlSpace"};function x(n,e,t){if(e==="class"){n.className=t==null?"":String(t);return}if(e==="style"){if(typeof t=="string")n.style.cssText=t;else if(t!=null&&typeof t=="object")for(let r in t)n.style[r]=t[r];else n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let r=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase();typeof t=="function"&&n.addEventListener(r,t);return}if(e in q){t?(n.setAttribute(e,""),e in n&&(n[e]=!0)):(n.removeAttribute(e),e in n&&(n[e]=!1));return}let o=w[e]||e;if(o in n){try{n[o]=t==null?"":t}catch(r){n.setAttribute(e,t==null?"":String(t))}return}t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,String(t))}function R(n,e){if(e==="class"){n.className="";return}if(e==="style"){n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let o=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase(),r=n._vei;if(r){let i="on"+o.charAt(0).toUpperCase()+o.slice(1),s=r[i];s&&(n.removeEventListener(o,s),r[i]=void 0)}return}if(e in q){n.removeAttribute(e),e in n&&(n[e]=!1);return}let t=w[e]||e;if(t in n){try{n[t]=""}catch(o){n.removeAttribute(e)}return}n.removeAttribute(e)}function X(n){return n.startsWith("on")||n.startsWith("@")}function me(n,e,t){let o=e?Object.keys(e):[],r=t?Object.keys(t):[];for(let i=0;i<r.length;i++){let s=r[i],a=t[s],c=e?e[s]:void 0;s==="key"||s==="ref"||a!==c&&(s==="class"?n.className=a==null?"":String(a):s==="style"?ve(n,a,c):X(s)||x(n,s,a))}for(let i=0;i<o.length;i++){let s=o[i];s==="key"||s==="ref"||(!t||!(s in t))&&(s==="class"?n.className="":s==="style"?n.style.cssText="":X(s)||R(n,s))}}function ve(n,e,t){if(!e||typeof e=="string"&&!e.trim()){n.style.cssText="";return}if(typeof e=="string"){n.style.cssText=e;return}if(typeof t=="object"&&t!==null)for(let o in t)o in e||(n.style[o]="");for(let o in e)n.style[o]=e[o]}function P(n){return n==="svg"||n==="path"||n==="circle"||n==="rect"||n==="line"||n==="polyline"||n==="polygon"||n==="ellipse"||n==="g"||n==="defs"||n==="use"||n==="text"||n==="tspan"||n==="clipPath"||n==="mask"||n==="filter"||n==="linearGradient"||n==="radialGradient"||n==="stop"||n==="pattern"||n==="symbol"||n==="image"||n==="foreignObject"||n==="animate"||n==="animateTransform"||n==="animateMotion"}function Ne(n){return ue[n]||n}var Ee=/^(?:@|on)/;function k(n){return n.replace(Ee,"").toLowerCase()}function F(n){let e=k(n);return"on"+e.charAt(0).toUpperCase()+e.slice(1)}var he={stop:"stop",prevent:"prevent",capture:"capture",once:"once",self:"self",passive:"passive"};function J(n){let e=n.split("."),o={name:e[0],stop:!1,prevent:!1,capture:!1,once:!1,self:!1,passive:!1};for(let r=1;r<e.length;r++){let i=e[r],s=he[i];s&&(o[s]=!0)}return o}function Q(n){let e=(t=>{e.value&&e.value(t)});return e.value=n,e}var v="_vei";function ge(n){return n[v]||null}function V(n,e,t,o,r){let i=F(e),s=J(k(e)),a=s.name,c=n[v];c||(c=n[v]={});let f=c[i];if(t&&f)f.value=t;else if(t&&!f){let d=Q(t);c[i]=d;let p={};s.capture&&(p.capture=!0),s.once&&(p.once=!0),s.passive&&(p.passive=!0),n.addEventListener(a,d,p)}else!t&&f&&(n.removeEventListener(a,f),c[i]=void 0)}function K(n){let e=n[v];if(e){for(let t in e){let o=e[t];if(o){let r=t.charAt(2).toLowerCase()+t.slice(3);n.removeEventListener(r,o)}}n[v]={}}}var $=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))($||{});function N(n,e,t){let o=ee(e);o!==t&&(n.className=o)}function ee(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++){let r=ee(n[o]);r&&(t+=(t?" ":"")+r)}return t}let e="";for(let t in n)n[t]&&(e+=(e?" ":"")+t);return e}return String(n)}function E(n,e,t){if(!e){n.style.cssText="";return}if(!t){typeof e=="string"?n.style.cssText=e:typeof e=="object"&&Z(n,e);return}if(typeof e!=typeof t){n.style.cssText="",typeof e=="string"?n.style.cssText=e:typeof e=="object"&&Z(n,e);return}if(typeof e=="string"){e!==t&&(n.style.cssText=e);return}if(typeof e=="object"&&typeof t=="object"){for(let o in t)o in e||(n.style[o]="");for(let o in e){let r=e[o],i=t[o];r!==i&&(n.style[o]=r==null?"":r)}}}function Z(n,e){for(let t in e)n.style[t]=e[t]===null||e[t]===void 0?"":e[t]}function Le(n,e,t,o){V(n,"",e,t,o)}var Te=new Set(["class","style","key","ref"]);function Ce(n){return n.length>2&&(n[0]==="o"||n[0]==="O"||n[0]==="@")&&(n[1]==="n"||n[1]==="N")}function te(n,e,t,o,r){if(!Te.has(e)){if(e==="class"){N(n,t,o);return}if(e==="style"){E(n,t,o);return}if(Ce(e)){V(n,e,t,o,r);return}if(t===!1||t===null||t===void 0){n.removeAttribute(e);return}if(e in n)try{n[e]=t}catch(i){n.setAttribute(e,String(t))}else n.setAttribute(e,String(t))}}function u(n,e,t,o,r){te(n,e,t,o,r)}function A(n,e,t,o){if(t)for(let r in t){if(r==="key"||r==="ref")continue;let i=t[r],s=e?e[r]:void 0;i!==s&&u(n,r,i,s,o)}if(e)for(let r in e)r==="key"||r==="ref"||(!t||!(r in t))&&u(n,r,null,e[r],o)}function xe(n,e,t,o){let r=e.props||{},i=t.props||{},{patchFlag:s,dynamicProps:a}=t;if(!s||s===-1){A(n,r,i,o);return}if(s===-2){A(n,r,i,o);return}if(s&1&&e.children!==t.children&&(n.textContent=t.children),s&2&&r.class!==i.class&&N(n,i.class,r.class),s&4&&r.style!==i.style&&E(n,i.style,r.style),s&8&&a)for(let c=0;c<a.length;c++){let f=a[c],d=r[f],p=i[f];p!==d&&u(n,f,p,d,o)}s&16&&A(n,r,i,o)}var b=class{createElement(e){return P(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}createText(e){return document.createTextNode(e)}createComment(e){return document.createComment(e)}setAttribute(e,t,o){x(e,t,o)}removeAttribute(e,t){R(e,t)}setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let o in t)e.style[o]=t[o]}setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let o="";for(let r in t)t[r]&&(o+=(o?" ":"")+r);e.className=o}else e.className=""}insert(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}replace(e,t,o){e.replaceChild(o,t)}addEventListener(e,t,o,r){e.addEventListener(t,o,r)}removeEventListener(e,t,o){e.removeEventListener(t,o)}nextTick(e){Promise.resolve().then(e)}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}querySelector(e){return document.querySelector(e)}setClassWithOld(e,t,o){N(e,t,o)}setStyleWithOld(e,t,o){E(e,t,o)}setAttributeWithOld(e,t,o,r){u(e,t,o,r)}setElementText(e,t){e.textContent=t}setText(e,t){e.nodeValue=t}insertBefore(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}removeChild(e,t){e.removeChild(t)}setAnchor(e,t){e.anchor=t}getNextSibling(e){return e.nextSibling}cleanupEvents(e){K(e)}},Re=new b;export{U as Comment,b as DOMRenderer,H as Fragment,S as PatchFlags,$ as PatchPropFlags,m as ShapeFlags,j as Text,Q as createInvoker,ye as createRenderer,Re as domRenderer,ge as getEventInvokers,F as getEventKey,Ne as getSVGPropName,P as isSVGElement,k as normalizeEventName,J as parseEventModifier,A as patchAllProps,N as patchClass,te as patchDOMProp,me as patchDOMProps,xe as patchElementProps,V as patchEvent,Le as patchEventOnElement,u as patchProp,E as patchStyle,K as removeAllEventListeners,R as removeDOMProp,x as setDOMProp};
|
|
1
|
+
import{registerDOMOperations as de}from"@lytjs/vdom";var m=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(m||{}),S=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(S||{}),H=Symbol("Fragment"),j=Symbol("Text"),U=Symbol("Comment");function y(n){return n.type===H}function h(n){return n.type===j}function g(n){return n.type===U}function Y(n,e){return n.type===e.type&&n.key===e.key}function O(n){return Array.isArray(n.dynamicChildren)}function G(n,e,t,o){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o);else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();n.addEventListener(e,r,o)}else t==="key"||t==="ref"||n.setAttribute(e,t,o)}function _(n,e,t,o,r){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o||{});else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r&&n.removeEventListener(e,i,r),o&&n.addEventListener(e,i,o)}else n.setAttribute(e,t,o)}function I(n,e,t,o){for(let r in o){if(r==="key"||r==="ref")continue;let i=t[r],s=o[r];s!==i&&_(n,e,r,s,i)}for(let r in t)if(!(r==="key"||r==="ref")&&!(r in o))if(r==="class")n.setClass(e,"");else if(r==="style")n.setStyle(e,{});else if(r.startsWith("on")||r.startsWith("@")){let i=r.startsWith("@")?r.slice(1).toLowerCase():r.slice(2).toLowerCase();n.removeEventListener(e,i,t[r])}else n.removeAttribute(e,r)}function D(n,e,t,o,r,i){let{shapeFlag:s}=t;if(y(t)){oe(n,e,t,o,r,i);return}if(h(t)){let a=n.createText(t.children);t.el=a,n.insert(o,a,r);return}if(g(t)){let a=n.createComment(t.children);t.el=a,n.insert(o,a,r);return}if(s&1){ne(n,e,t,o,r,i);return}if(s&6){re(e,t,o,r,i);return}}function ne(n,e,t,o,r,i){let s=t.type,a=n.createElement(s);if(t.el=a,t.props)for(let p in t.props){let d=t.props[p];G(n,a,p,d)}let{shapeFlag:c,children:f}=t;c&8?a.textContent=f:c&16&&L(e,f,a,null,i),n.insert(o,a,r)}function L(n,e,t,o,r){for(let i=0;i<e.length;i++)n(null,e[i],t,o,r)}function oe(n,e,t,o,r,i){let{children:s}=t,a=n.createComment("");n.insert(o,a,r),Array.isArray(s)&&s.length>0&&L(e,s,o,a,i),t.el=a,t.anchor=a}function re(n,e,t,o,r){let i=e.component;i&&i.update&&i.update(),i&&i.subTree&&(n(null,i.subTree,t,o,i),e.el=i.subTree.el)}function B(n,e,t,o){let{shapeFlag:r,children:i}=t;if(y(t)){if(Array.isArray(i))for(let s=0;s<i.length;s++)e(i[s],o);t.anchor&&t.anchor.parentNode&&n.remove(t.anchor);return}if(r&6){t.component&&t.component.subTree&&e(t.component.subTree,o);return}t.el&&n.remove(t.el)}function T(n,e){for(let t=0;t<e.length;t++)n(e[t])}import{patchKeyedChildren as ie,patchUnkeyedChildren as se}from"@lytjs/vdom";function C(n,e,t,o,r,i=null,s=null){if(o==null){t&&e(t,r);return}if(t===null){D(n,M(n,e),o,r,i,s);return}if(O(o)&&O(t)){fe(n,e,t,o,r,s);return}if(!Y(t,o)){e(t,r),D(n,M(n,e),o,r,i,s);return}o.el=t.el,o.anchor=t.anchor;let{shapeFlag:a}=o;if(y(o)){le(n,e,t,o,r,i,s);return}if(h(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(g(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(a&1){ae(n,e,t,o,s);return}if(a&6){pe(t,o,s);return}}function M(n,e){return(t,o,r,i,s)=>{C(n,e,t,o,r,i,s)}}function ae(n,e,t,o,r=null){let i=o.el=t.el,s=t.props||{},a=o.props||{},{patchFlag:c,dynamicProps:f}=o;if(c&&c>0){if(c&1&&t.children!==o.children&&(i.textContent=o.children),c&2&&s.class!==a.class&&n.setClass(i,a.class),c&4&&s.style!==a.style&&n.setStyle(i,a.style||{}),c&8&&f)for(let p=0;p<f.length;p++){let d=f[p],l=s[d],W=a[d];W!==l&&_(n,i,d,W,l)}c&16&&I(n,i,s,a)}else I(n,i,s,a);(!c||!(c&1))&&X(n,e,t,o,i,null,r)}function X(n,e,t,o,r,i,s){let a=t.shapeFlag,c=o.shapeFlag,f=t.children,p=o.children;if(c&8){a&16&&T(e,f),f!==p&&(r.textContent=p);return}if(c&16){a&16?ce(n,e,f,p,r,i,s):(a&8&&(r.textContent=""),L(M(n,e),p,r,i,s));return}p==null&&(a&8?r.textContent="":a&16&&T(e,f))}function ce(n,e,t,o,r,i,s){o.every(c=>c.key!==null&&c.key!==void 0)&&t.every(c=>c.key!==null&&c.key!==void 0)?ie(t,o,r,i,s,null,!1):se(t,o,r,i,s,null,!1)}function le(n,e,t,o,r,i,s){let a=t.children,c=o.children;Array.isArray(c)&&c.length>0?(X(n,e,t,o,r,i,s),o.el=c[0].el,o.anchor=c[c.length-1].el?n.nextSibling(c[c.length-1].el):i):Array.isArray(a)&&a.length>0&&c===null?(T(e,a),o.el=t.el,o.anchor=t.anchor):(o.el=t.el,o.anchor=t.anchor)}function fe(n,e,t,o,r,i){let s=t.dynamicChildren,a=o.dynamicChildren;for(let c=0;c<a.length;c++)C(n,e,s[c],a[c],r,null,i)}function pe(n,e,t){e.component=n.component,e.el=n.el,e.component&&e.component.update&&e.component.update()}function ye(n){function e(r,i){B(n,e,r,i)}de({insert(r,i,s){n.insert(i,r,s)},createElement(r){return n.createElement(r)},createText(r){return n.createText(r)},setText(r,i){r.nodeValue=i},setElementText(r,i){r.textContent=i},remove(r){n.remove(r)},createComment(r){return n.createComment(r)},mount(r,i,s,a,c,f,p){o(null,r,i,s,a)},patch(r,i,s,a,c,f,p,d){o(r,i,s,a,c)},unmount(r,i,s,a){e(r)},move(r,i,s){n.insert(i,r.el,s)}});function o(r,i,s,a,c){C(n,e,r,i,s,a,c)}return{mount(r,i){i.nodeType===1&&(i.textContent=""),o(null,r,i,null,null)},patch(r,i,s){var a;o(r,i,s||((a=r.el)==null?void 0:a.parentNode),null,null)},unmount(r,i){e(r,i)}}}var w={acceptCharset:"acceptCharset",accessKey:"accessKey",className:"className",htmlFor:"htmlFor",httpEquiv:"httpEquiv",tabIndex:"tabIndex"},q={allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,inert:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0},ue={"accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","baseline-shift":"baselineShift","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","paint-order":"paintOrder","pointer-events":"pointerEvents","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","transform-origin":"transformOrigin","word-spacing":"wordSpacing","writing-mode":"writingMode","xlink:href":"xlinkHref","xlink:title":"xlinkTitle","xml:lang":"xmlLang","xml:space":"xmlSpace"};function x(n,e,t){if(e==="class"){n.className=t==null?"":String(t);return}if(e==="style"){if(typeof t=="string")n.style.cssText=t;else if(t!=null&&typeof t=="object")for(let r in t)n.style[r]=t[r];else n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let r=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase();typeof t=="function"&&n.addEventListener(r,t);return}if(e in q){t?(n.setAttribute(e,""),e in n&&(n[e]=!0)):(n.removeAttribute(e),e in n&&(n[e]=!1));return}let o=w[e]||e;if(o in n){try{n[o]=t==null?"":t}catch(r){n.setAttribute(e,t==null?"":String(t))}return}t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,String(t))}function R(n,e){if(e==="class"){n.className="";return}if(e==="style"){n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let o=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase(),r=n._vei;if(r){let i="on"+o.charAt(0).toUpperCase()+o.slice(1),s=r[i];s&&(n.removeEventListener(o,s),r[i]=void 0)}return}if(e in q){n.removeAttribute(e),e in n&&(n[e]=!1);return}let t=w[e]||e;if(t in n){try{n[t]=""}catch(o){n.removeAttribute(e)}return}n.removeAttribute(e)}function z(n){return n.startsWith("on")||n.startsWith("@")}function me(n,e,t){let o=e?Object.keys(e):[],r=t?Object.keys(t):[];for(let i=0;i<r.length;i++){let s=r[i],a=t[s],c=e?e[s]:void 0;s==="key"||s==="ref"||a!==c&&(s==="class"?n.className=a==null?"":String(a):s==="style"?ve(n,a,c):z(s)||x(n,s,a))}for(let i=0;i<o.length;i++){let s=o[i];s==="key"||s==="ref"||(!t||!(s in t))&&(s==="class"?n.className="":s==="style"?n.style.cssText="":z(s)||R(n,s))}}function ve(n,e,t){if(!e||typeof e=="string"&&!e.trim()){n.style.cssText="";return}if(typeof e=="string"){n.style.cssText=e;return}if(typeof t=="object"&&t!==null)for(let o in t)o in e||(n.style[o]="");for(let o in e)n.style[o]=e[o]}function P(n){return n==="svg"||n==="path"||n==="circle"||n==="rect"||n==="line"||n==="polyline"||n==="polygon"||n==="ellipse"||n==="g"||n==="defs"||n==="use"||n==="text"||n==="tspan"||n==="clipPath"||n==="mask"||n==="filter"||n==="linearGradient"||n==="radialGradient"||n==="stop"||n==="pattern"||n==="symbol"||n==="image"||n==="foreignObject"||n==="animate"||n==="animateTransform"||n==="animateMotion"}function Ne(n){return ue[n]||n}var Ee=/^(?:@|on)/;function k(n){return n.replace(Ee,"").toLowerCase()}function F(n){let e=k(n);return"on"+e.charAt(0).toUpperCase()+e.slice(1)}var he={stop:"stop",prevent:"prevent",capture:"capture",once:"once",self:"self",passive:"passive"};function J(n){let e=n.split("."),o={name:e[0],stop:!1,prevent:!1,capture:!1,once:!1,self:!1,passive:!1};for(let r=1;r<e.length;r++){let i=e[r],s=he[i];s&&(o[s]=!0)}return o}function Q(n){let e=(t=>{e.value&&e.value(t)});return e.value=n,e}var v="_vei";function ge(n){return n[v]||null}function V(n,e,t,o,r){let i=F(e),s=J(k(e)),a=s.name,c=n[v];c||(c=n[v]={});let f=c[i];if(t&&f)f.value=t;else if(t&&!f){let p=Q(t);c[i]=p;let d={};s.capture&&(d.capture=!0),s.once&&(d.once=!0),s.passive&&(d.passive=!0),n.addEventListener(a,p,d)}else!t&&f&&(n.removeEventListener(a,f),c[i]=void 0)}function K(n){let e=n[v];if(e){for(let t in e){let o=e[t];if(o){let r=t.charAt(2).toLowerCase()+t.slice(3);n.removeEventListener(r,o)}}n[v]={}}}var $=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))($||{});function N(n,e,t){let o=ee(e);o!==t&&(n.className=o)}function ee(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++){let r=ee(n[o]);r&&(t+=(t?" ":"")+r)}return t}let e="";for(let t in n)n[t]&&(e+=(e?" ":"")+t);return e}return String(n)}function E(n,e,t){if(!e){n.style.cssText="";return}if(!t){typeof e=="string"?n.style.cssText=e:typeof e=="object"&&Z(n,e);return}if(typeof e!=typeof t){n.style.cssText="",typeof e=="string"?n.style.cssText=e:typeof e=="object"&&Z(n,e);return}if(typeof e=="string"){e!==t&&(n.style.cssText=e);return}if(typeof e=="object"&&typeof t=="object"){for(let o in t)o in e||(n.style[o]="");for(let o in e){let r=e[o],i=t[o];r!==i&&(n.style[o]=r==null?"":r)}}}function Z(n,e){for(let t in e)n.style[t]=e[t]===null||e[t]===void 0?"":e[t]}function Le(n,e,t,o){V(n,"",e,t,o)}var Te=new Set(["class","style","key","ref"]);function Ce(n){return n.length>2&&(n[0]==="o"||n[0]==="O"||n[0]==="@")&&(n[1]==="n"||n[1]==="N")}function te(n,e,t,o,r){if(!Te.has(e)){if(e==="class"){N(n,t,o);return}if(e==="style"){E(n,t,o);return}if(Ce(e)){V(n,e,t,o,r);return}if(t===!1||t===null||t===void 0){n.removeAttribute(e);return}if(e in n)try{n[e]=t}catch(i){n.setAttribute(e,String(t))}else n.setAttribute(e,String(t))}}function u(n,e,t,o,r){te(n,e,t,o,r)}function A(n,e,t,o){if(t)for(let r in t){if(r==="key"||r==="ref")continue;let i=t[r],s=e?e[r]:void 0;i!==s&&u(n,r,i,s,o)}if(e)for(let r in e)r==="key"||r==="ref"||(!t||!(r in t))&&u(n,r,null,e[r],o)}function xe(n,e,t,o){let r=e.props||{},i=t.props||{},{patchFlag:s,dynamicProps:a}=t;if(!s||s===-1){A(n,r,i,o);return}if(s===-2){A(n,r,i,o);return}if(s&1&&e.children!==t.children&&(n.textContent=t.children),s&2&&r.class!==i.class&&N(n,i.class,r.class),s&4&&r.style!==i.style&&E(n,i.style,r.style),s&8&&a)for(let c=0;c<a.length;c++){let f=a[c],p=r[f],d=i[f];d!==p&&u(n,f,d,p,o)}s&16&&A(n,r,i,o)}var b=class{createElement(e){return P(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}createText(e){return document.createTextNode(e)}createComment(e){return document.createComment(e)}setAttribute(e,t,o){x(e,t,o)}removeAttribute(e,t){R(e,t)}setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let o in t)e.style[o]=t[o]}setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let o="";for(let r in t)t[r]&&(o+=(o?" ":"")+r);e.className=o}else e.className=""}insert(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}replace(e,t,o){e.replaceChild(o,t)}addEventListener(e,t,o,r){e.addEventListener(t,o,r)}removeEventListener(e,t,o){e.removeEventListener(t,o)}nextTick(e){Promise.resolve().then(e)}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}querySelector(e){return document.querySelector(e)}setClassWithOld(e,t,o){N(e,t,o)}setStyleWithOld(e,t,o){E(e,t,o)}setAttributeWithOld(e,t,o,r){u(e,t,o,r)}setElementText(e,t){e.textContent=t}setText(e,t){e.nodeValue=t}insertBefore(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}removeChild(e,t){e.removeChild(t)}setAnchor(e,t){e.anchor=t}getNextSibling(e){return e.nextSibling}cleanupEvents(e){K(e)}},Re=new b;export{U as Comment,b as DOMRenderer,H as Fragment,S as PatchFlags,$ as PatchPropFlags,m as ShapeFlags,j as Text,Q as createInvoker,ye as createRenderer,Re as domRenderer,ge as getEventInvokers,F as getEventKey,Ne as getSVGPropName,P as isSVGElement,k as normalizeEventName,J as parseEventModifier,A as patchAllProps,N as patchClass,te as patchDOMProp,me as patchDOMProps,xe as patchElementProps,V as patchEvent,Le as patchEventOnElement,u as patchProp,E as patchStyle,K as removeAllEventListeners,R as removeDOMProp,x as setDOMProp};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var M=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var me=(n,e)=>{for(var t in e)M(n,t,{get:e[t],enumerable:!0})},ve=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ye(e))!ue.call(n,r)&&r!==t&&M(n,r,{get:()=>e[r],enumerable:!(o=pe(e,r))||o.enumerable});return n};var Ne=n=>ve(M({},"__esModule",{value:!0}),n);var Ie={};me(Ie,{Comment:()=>K,DOMRenderer:()=>C,Fragment:()=>P,PatchFlags:()=>x,PatchPropFlags:()=>X,ShapeFlags:()=>u,Text:()=>k,createInvoker:()=>z,createRenderer:()=>ee,domRenderer:()=>de,getEventInvokers:()=>se,getEventKey:()=>G,getSVGPropName:()=>ie,isSVGElement:()=>_,normalizeEventName:()=>I,parseEventModifier:()=>B,patchAllProps:()=>T,patchClass:()=>v,patchDOMProp:()=>w,patchDOMProps:()=>re,patchElementProps:()=>fe,patchEvent:()=>L,patchEventOnElement:()=>le,patchProp:()=>y,patchStyle:()=>N,removeAllEventListeners:()=>D,removeDOMProp:()=>h,setDOMProp:()=>E});module.exports=Ne(Ie);var $=require("@lytjs/vdom");var u=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(u||{}),x=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(x||{}),P=Symbol("Fragment"),k=Symbol("Text"),K=Symbol("Comment");function m(n){return n.type===P}function R(n){return n.type===k}function V(n){return n.type===K}function F(n,e){return n.type===e.type&&n.key===e.key}function W(n){return Array.isArray(n.dynamicChildren)}function J(n,e,t,o){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o);else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();n.addEventListener(e,r,o)}else t==="key"||t==="ref"||n.setAttribute(e,t,o)}function H(n,e,t,o,r){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o||{});else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r&&n.removeEventListener(e,i,r),o&&n.addEventListener(e,i,o)}else n.setAttribute(e,t,o)}function j(n,e,t,o){for(let r in o){if(r==="key"||r==="ref")continue;let i=t[r],s=o[r];s!==i&&H(n,e,r,s,i)}for(let r in t)if(!(r==="key"||r==="ref")&&!(r in o))if(r==="class")n.setClass(e,"");else if(r==="style")n.setStyle(e,{});else if(r.startsWith("on")||r.startsWith("@")){let i=r.startsWith("@")?r.slice(1).toLowerCase():r.slice(2).toLowerCase();n.removeEventListener(e,i,t[r])}else n.removeAttribute(e,r)}function U(n,e,t,o,r,i){let{shapeFlag:s}=t;if(m(t)){he(n,e,t,o,r,i);return}if(R(t)){let a=n.createText(t.children);t.el=a,n.insert(o,a,r);return}if(V(t)){let a=n.createComment(t.children);t.el=a,n.insert(o,a,r);return}if(s&1){Ee(n,e,t,o,r,i);return}if(s&6){ge(e,t,o,r,i);return}}function Ee(n,e,t,o,r,i){let s=t.type,a=n.createElement(s);if(t.el=a,t.props)for(let d in t.props){let p=t.props[d];J(n,a,d,p)}let{shapeFlag:c,children:f}=t;c&8?a.textContent=f:c&16&&A(e,f,a,null,i),n.insert(o,a,r)}function A(n,e,t,o,r){for(let i=0;i<e.length;i++)n(null,e[i],t,o,r)}function he(n,e,t,o,r,i){let{children:s}=t,a=n.createComment("");n.insert(o,a,r),Array.isArray(s)&&s.length>0&&A(e,s,o,a,i),t.el=a,t.anchor=a}function ge(n,e,t,o,r){let i=e.component;i&&i.update&&i.update(),i&&i.subTree&&(n(null,i.subTree,t,o,i),e.el=i.subTree.el)}function Q(n,e,t,o){let{shapeFlag:r,children:i}=t;if(m(t)){if(Array.isArray(i))for(let s=0;s<i.length;s++)e(i[s],o);t.anchor&&t.anchor.parentNode&&n.remove(t.anchor);return}if(r&6){t.component&&t.component.subTree&&e(t.component.subTree,o);return}t.el&&n.remove(t.el)}function b(n,e){for(let t=0;t<e.length;t++)n(e[t])}var S=require("@lytjs/vdom");function O(n,e,t,o,r,i=null,s=null){if(o==null){t&&e(t,r);return}if(t===null){U(n,Y(n,e),o,r,i,s);return}if(W(o)&&W(t)){xe(n,e,t,o,r,s);return}if(!F(t,o)){e(t,r),U(n,Y(n,e),o,r,i,s);return}o.el=t.el,o.anchor=t.anchor;let{shapeFlag:a}=o;if(m(o)){Ce(n,e,t,o,r,i,s);return}if(R(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(V(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(a&1){Le(n,e,t,o,s);return}if(a&6){Re(t,o,s);return}}function Y(n,e){return(t,o,r,i,s)=>{O(n,e,t,o,r,i,s)}}function Le(n,e,t,o,r=null){let i=o.el=t.el,s=t.props||{},a=o.props||{},{patchFlag:c,dynamicProps:f}=o;if(c&&c>0){if(c&1&&t.children!==o.children&&(i.textContent=o.children),c&2&&s.class!==a.class&&n.setClass(i,a.class),c&4&&s.style!==a.style&&n.setStyle(i,a.style||{}),c&8&&f)for(let d=0;d<f.length;d++){let p=f[d],l=s[p],q=a[p];q!==l&&H(n,i,p,q,l)}c&16&&j(n,i,s,a)}else j(n,i,s,a);(!c||!(c&1))&&Z(n,e,t,o,i,null,r)}function Z(n,e,t,o,r,i,s){let a=t.shapeFlag,c=o.shapeFlag,f=t.children,d=o.children;if(c&8){a&16&&b(e,f),f!==d&&(r.textContent=d);return}if(c&16){a&16?Te(n,e,f,d,r,i,s):(a&8&&(r.textContent=""),A(Y(n,e),d,r,i,s));return}d==null&&(a&8?r.textContent="":a&16&&b(e,f))}function Te(n,e,t,o,r,i,s){o.every(c=>c.key!==null&&c.key!==void 0)&&t.every(c=>c.key!==null&&c.key!==void 0)?(0,S.patchKeyedChildren)(t,o,r,i,s,null,!1):(0,S.patchUnkeyedChildren)(t,o,r,i,s,null,!1)}function Ce(n,e,t,o,r,i,s){let a=t.children,c=o.children;Array.isArray(c)&&c.length>0?(Z(n,e,t,o,r,i,s),o.el=c[0].el,o.anchor=c[c.length-1].el?n.nextSibling(c[c.length-1].el):i):Array.isArray(a)&&a.length>0&&c===null?(b(e,a),o.el=t.el,o.anchor=t.anchor):(o.el=t.el,o.anchor=t.anchor)}function xe(n,e,t,o,r,i){let s=t.dynamicChildren,a=o.dynamicChildren;for(let c=0;c<a.length;c++)O(n,e,s[c],a[c],r,null,i)}function Re(n,e,t){e.component=n.component,e.el=n.el,e.component&&e.component.update&&e.component.update()}function ee(n){function e(r,i){Q(n,e,r,i)}(0,$.registerDOMOperations)({insert(r,i,s){n.insert(i,r,s)},createElement(r){return n.createElement(r)},createText(r){return n.createText(r)},setText(r,i){r.nodeValue=i},setElementText(r,i){r.textContent=i},remove(r){n.remove(r)},createComment(r){return n.createComment(r)},mount(r,i,s,a,c,f,d){o(null,r,i,s,a)},patch(r,i,s,a,c,f,d,p){o(r,i,s,a,c)},unmount(r,i,s,a){e(r)},move(r,i,s){n.insert(i,r.el,s)}});function o(r,i,s,a,c){O(n,e,r,i,s,a,c)}return{mount(r,i){i.nodeType===1&&(i.textContent=""),o(null,r,i,null,null)},patch(r,i,s){var a;o(r,i,s||((a=r.el)==null?void 0:a.parentNode),null,null)},unmount(r,i){e(r,i)}}}var ne={acceptCharset:"acceptCharset",accessKey:"accessKey",className:"className",htmlFor:"htmlFor",httpEquiv:"httpEquiv",tabIndex:"tabIndex"},oe={allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,inert:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0},Ve={"accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","baseline-shift":"baselineShift","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","paint-order":"paintOrder","pointer-events":"pointerEvents","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","transform-origin":"transformOrigin","word-spacing":"wordSpacing","writing-mode":"writingMode","xlink:href":"xlinkHref","xlink:title":"xlinkTitle","xml:lang":"xmlLang","xml:space":"xmlSpace"};function E(n,e,t){if(e==="class"){n.className=t==null?"":String(t);return}if(e==="style"){if(typeof t=="string")n.style.cssText=t;else if(t!=null&&typeof t=="object")for(let r in t)n.style[r]=t[r];else n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let r=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase();typeof t=="function"&&n.addEventListener(r,t);return}if(e in oe){t?(n.setAttribute(e,""),e in n&&(n[e]=!0)):(n.removeAttribute(e),e in n&&(n[e]=!1));return}let o=ne[e]||e;if(o in n){try{n[o]=t==null?"":t}catch(r){n.setAttribute(e,t==null?"":String(t))}return}t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,String(t))}function h(n,e){if(e==="class"){n.className="";return}if(e==="style"){n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let o=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase(),r=n._vei;if(r){let i="on"+o.charAt(0).toUpperCase()+o.slice(1),s=r[i];s&&(n.removeEventListener(o,s),r[i]=void 0)}return}if(e in oe){n.removeAttribute(e),e in n&&(n[e]=!1);return}let t=ne[e]||e;if(t in n){try{n[t]=""}catch(o){n.removeAttribute(e)}return}n.removeAttribute(e)}function te(n){return n.startsWith("on")||n.startsWith("@")}function re(n,e,t){let o=e?Object.keys(e):[],r=t?Object.keys(t):[];for(let i=0;i<r.length;i++){let s=r[i],a=t[s],c=e?e[s]:void 0;s==="key"||s==="ref"||a!==c&&(s==="class"?n.className=a==null?"":String(a):s==="style"?Ae(n,a,c):te(s)||E(n,s,a))}for(let i=0;i<o.length;i++){let s=o[i];s==="key"||s==="ref"||(!t||!(s in t))&&(s==="class"?n.className="":s==="style"?n.style.cssText="":te(s)||h(n,s))}}function Ae(n,e,t){if(!e||typeof e=="string"&&!e.trim()){n.style.cssText="";return}if(typeof e=="string"){n.style.cssText=e;return}if(typeof t=="object"&&t!==null)for(let o in t)o in e||(n.style[o]="");for(let o in e)n.style[o]=e[o]}function _(n){return n==="svg"||n==="path"||n==="circle"||n==="rect"||n==="line"||n==="polyline"||n==="polygon"||n==="ellipse"||n==="g"||n==="defs"||n==="use"||n==="text"||n==="tspan"||n==="clipPath"||n==="mask"||n==="filter"||n==="linearGradient"||n==="radialGradient"||n==="stop"||n==="pattern"||n==="symbol"||n==="image"||n==="foreignObject"||n==="animate"||n==="animateTransform"||n==="animateMotion"}function ie(n){return Ve[n]||n}var be=/^(?:@|on)/;function I(n){return n.replace(be,"").toLowerCase()}function G(n){let e=I(n);return"on"+e.charAt(0).toUpperCase()+e.slice(1)}var Se={stop:"stop",prevent:"prevent",capture:"capture",once:"once",self:"self",passive:"passive"};function B(n){let e=n.split("."),o={name:e[0],stop:!1,prevent:!1,capture:!1,once:!1,self:!1,passive:!1};for(let r=1;r<e.length;r++){let i=e[r],s=Se[i];s&&(o[s]=!0)}return o}function z(n){let e=(t=>{e.value&&e.value(t)});return e.value=n,e}var g="_vei";function se(n){return n[g]||null}function L(n,e,t,o,r){let i=G(e),s=B(I(e)),a=s.name,c=n[g];c||(c=n[g]={});let f=c[i];if(t&&f)f.value=t;else if(t&&!f){let d=z(t);c[i]=d;let p={};s.capture&&(p.capture=!0),s.once&&(p.once=!0),s.passive&&(p.passive=!0),n.addEventListener(a,d,p)}else!t&&f&&(n.removeEventListener(a,f),c[i]=void 0)}function D(n){let e=n[g];if(e){for(let t in e){let o=e[t];if(o){let r=t.charAt(2).toLowerCase()+t.slice(3);n.removeEventListener(r,o)}}n[g]={}}}var X=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(X||{});function v(n,e,t){let o=ce(e);o!==t&&(n.className=o)}function ce(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++){let r=ce(n[o]);r&&(t+=(t?" ":"")+r)}return t}let e="";for(let t in n)n[t]&&(e+=(e?" ":"")+t);return e}return String(n)}function N(n,e,t){if(!e){n.style.cssText="";return}if(!t){typeof e=="string"?n.style.cssText=e:typeof e=="object"&&ae(n,e);return}if(typeof e!=typeof t){n.style.cssText="",typeof e=="string"?n.style.cssText=e:typeof e=="object"&&ae(n,e);return}if(typeof e=="string"){e!==t&&(n.style.cssText=e);return}if(typeof e=="object"&&typeof t=="object"){for(let o in t)o in e||(n.style[o]="");for(let o in e){let r=e[o],i=t[o];r!==i&&(n.style[o]=r==null?"":r)}}}function ae(n,e){for(let t in e)n.style[t]=e[t]===null||e[t]===void 0?"":e[t]}function le(n,e,t,o){L(n,"",e,t,o)}var Oe=new Set(["class","style","key","ref"]);function _e(n){return n.length>2&&(n[0]==="o"||n[0]==="O"||n[0]==="@")&&(n[1]==="n"||n[1]==="N")}function w(n,e,t,o,r){if(!Oe.has(e)){if(e==="class"){v(n,t,o);return}if(e==="style"){N(n,t,o);return}if(_e(e)){L(n,e,t,o,r);return}if(t===!1||t===null||t===void 0){n.removeAttribute(e);return}if(e in n)try{n[e]=t}catch(i){n.setAttribute(e,String(t))}else n.setAttribute(e,String(t))}}function y(n,e,t,o,r){w(n,e,t,o,r)}function T(n,e,t,o){if(t)for(let r in t){if(r==="key"||r==="ref")continue;let i=t[r],s=e?e[r]:void 0;i!==s&&y(n,r,i,s,o)}if(e)for(let r in e)r==="key"||r==="ref"||(!t||!(r in t))&&y(n,r,null,e[r],o)}function fe(n,e,t,o){let r=e.props||{},i=t.props||{},{patchFlag:s,dynamicProps:a}=t;if(!s||s===-1){T(n,r,i,o);return}if(s===-2){T(n,r,i,o);return}if(s&1&&e.children!==t.children&&(n.textContent=t.children),s&2&&r.class!==i.class&&v(n,i.class,r.class),s&4&&r.style!==i.style&&N(n,i.style,r.style),s&8&&a)for(let c=0;c<a.length;c++){let f=a[c],d=r[f],p=i[f];p!==d&&y(n,f,p,d,o)}s&16&&T(n,r,i,o)}var C=class{createElement(e){return _(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}createText(e){return document.createTextNode(e)}createComment(e){return document.createComment(e)}setAttribute(e,t,o){E(e,t,o)}removeAttribute(e,t){h(e,t)}setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let o in t)e.style[o]=t[o]}setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let o="";for(let r in t)t[r]&&(o+=(o?" ":"")+r);e.className=o}else e.className=""}insert(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}replace(e,t,o){e.replaceChild(o,t)}addEventListener(e,t,o,r){e.addEventListener(t,o,r)}removeEventListener(e,t,o){e.removeEventListener(t,o)}nextTick(e){Promise.resolve().then(e)}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}querySelector(e){return document.querySelector(e)}setClassWithOld(e,t,o){v(e,t,o)}setStyleWithOld(e,t,o){N(e,t,o)}setAttributeWithOld(e,t,o,r){y(e,t,o,r)}setElementText(e,t){e.textContent=t}setText(e,t){e.nodeValue=t}insertBefore(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}removeChild(e,t){e.removeChild(t)}setAnchor(e,t){e.anchor=t}getNextSibling(e){return e.nextSibling}cleanupEvents(e){D(e)}},de=new C;
|
|
1
|
+
var M=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var me=(n,e)=>{for(var t in e)M(n,t,{get:e[t],enumerable:!0})},ve=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ye(e))!ue.call(n,r)&&r!==t&&M(n,r,{get:()=>e[r],enumerable:!(o=de(e,r))||o.enumerable});return n};var Ne=n=>ve(M({},"__esModule",{value:!0}),n);var Ie={};me(Ie,{Comment:()=>K,DOMRenderer:()=>C,Fragment:()=>P,PatchFlags:()=>x,PatchPropFlags:()=>z,ShapeFlags:()=>u,Text:()=>k,createInvoker:()=>X,createRenderer:()=>ee,domRenderer:()=>pe,getEventInvokers:()=>se,getEventKey:()=>G,getSVGPropName:()=>ie,isSVGElement:()=>_,normalizeEventName:()=>I,parseEventModifier:()=>B,patchAllProps:()=>T,patchClass:()=>v,patchDOMProp:()=>w,patchDOMProps:()=>re,patchElementProps:()=>fe,patchEvent:()=>L,patchEventOnElement:()=>le,patchProp:()=>y,patchStyle:()=>N,removeAllEventListeners:()=>D,removeDOMProp:()=>h,setDOMProp:()=>E});module.exports=Ne(Ie);var $=require("@lytjs/vdom");var u=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(u||{}),x=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(x||{}),P=Symbol("Fragment"),k=Symbol("Text"),K=Symbol("Comment");function m(n){return n.type===P}function R(n){return n.type===k}function V(n){return n.type===K}function F(n,e){return n.type===e.type&&n.key===e.key}function W(n){return Array.isArray(n.dynamicChildren)}function J(n,e,t,o){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o);else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();n.addEventListener(e,r,o)}else t==="key"||t==="ref"||n.setAttribute(e,t,o)}function H(n,e,t,o,r){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o||{});else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r&&n.removeEventListener(e,i,r),o&&n.addEventListener(e,i,o)}else n.setAttribute(e,t,o)}function j(n,e,t,o){for(let r in o){if(r==="key"||r==="ref")continue;let i=t[r],s=o[r];s!==i&&H(n,e,r,s,i)}for(let r in t)if(!(r==="key"||r==="ref")&&!(r in o))if(r==="class")n.setClass(e,"");else if(r==="style")n.setStyle(e,{});else if(r.startsWith("on")||r.startsWith("@")){let i=r.startsWith("@")?r.slice(1).toLowerCase():r.slice(2).toLowerCase();n.removeEventListener(e,i,t[r])}else n.removeAttribute(e,r)}function U(n,e,t,o,r,i){let{shapeFlag:s}=t;if(m(t)){he(n,e,t,o,r,i);return}if(R(t)){let a=n.createText(t.children);t.el=a,n.insert(o,a,r);return}if(V(t)){let a=n.createComment(t.children);t.el=a,n.insert(o,a,r);return}if(s&1){Ee(n,e,t,o,r,i);return}if(s&6){ge(e,t,o,r,i);return}}function Ee(n,e,t,o,r,i){let s=t.type,a=n.createElement(s);if(t.el=a,t.props)for(let p in t.props){let d=t.props[p];J(n,a,p,d)}let{shapeFlag:c,children:f}=t;c&8?a.textContent=f:c&16&&A(e,f,a,null,i),n.insert(o,a,r)}function A(n,e,t,o,r){for(let i=0;i<e.length;i++)n(null,e[i],t,o,r)}function he(n,e,t,o,r,i){let{children:s}=t,a=n.createComment("");n.insert(o,a,r),Array.isArray(s)&&s.length>0&&A(e,s,o,a,i),t.el=a,t.anchor=a}function ge(n,e,t,o,r){let i=e.component;i&&i.update&&i.update(),i&&i.subTree&&(n(null,i.subTree,t,o,i),e.el=i.subTree.el)}function Q(n,e,t,o){let{shapeFlag:r,children:i}=t;if(m(t)){if(Array.isArray(i))for(let s=0;s<i.length;s++)e(i[s],o);t.anchor&&t.anchor.parentNode&&n.remove(t.anchor);return}if(r&6){t.component&&t.component.subTree&&e(t.component.subTree,o);return}t.el&&n.remove(t.el)}function b(n,e){for(let t=0;t<e.length;t++)n(e[t])}var S=require("@lytjs/vdom");function O(n,e,t,o,r,i=null,s=null){if(o==null){t&&e(t,r);return}if(t===null){U(n,Y(n,e),o,r,i,s);return}if(W(o)&&W(t)){xe(n,e,t,o,r,s);return}if(!F(t,o)){e(t,r),U(n,Y(n,e),o,r,i,s);return}o.el=t.el,o.anchor=t.anchor;let{shapeFlag:a}=o;if(m(o)){Ce(n,e,t,o,r,i,s);return}if(R(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(V(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(a&1){Le(n,e,t,o,s);return}if(a&6){Re(t,o,s);return}}function Y(n,e){return(t,o,r,i,s)=>{O(n,e,t,o,r,i,s)}}function Le(n,e,t,o,r=null){let i=o.el=t.el,s=t.props||{},a=o.props||{},{patchFlag:c,dynamicProps:f}=o;if(c&&c>0){if(c&1&&t.children!==o.children&&(i.textContent=o.children),c&2&&s.class!==a.class&&n.setClass(i,a.class),c&4&&s.style!==a.style&&n.setStyle(i,a.style||{}),c&8&&f)for(let p=0;p<f.length;p++){let d=f[p],l=s[d],q=a[d];q!==l&&H(n,i,d,q,l)}c&16&&j(n,i,s,a)}else j(n,i,s,a);(!c||!(c&1))&&Z(n,e,t,o,i,null,r)}function Z(n,e,t,o,r,i,s){let a=t.shapeFlag,c=o.shapeFlag,f=t.children,p=o.children;if(c&8){a&16&&b(e,f),f!==p&&(r.textContent=p);return}if(c&16){a&16?Te(n,e,f,p,r,i,s):(a&8&&(r.textContent=""),A(Y(n,e),p,r,i,s));return}p==null&&(a&8?r.textContent="":a&16&&b(e,f))}function Te(n,e,t,o,r,i,s){o.every(c=>c.key!==null&&c.key!==void 0)&&t.every(c=>c.key!==null&&c.key!==void 0)?(0,S.patchKeyedChildren)(t,o,r,i,s,null,!1):(0,S.patchUnkeyedChildren)(t,o,r,i,s,null,!1)}function Ce(n,e,t,o,r,i,s){let a=t.children,c=o.children;Array.isArray(c)&&c.length>0?(Z(n,e,t,o,r,i,s),o.el=c[0].el,o.anchor=c[c.length-1].el?n.nextSibling(c[c.length-1].el):i):Array.isArray(a)&&a.length>0&&c===null?(b(e,a),o.el=t.el,o.anchor=t.anchor):(o.el=t.el,o.anchor=t.anchor)}function xe(n,e,t,o,r,i){let s=t.dynamicChildren,a=o.dynamicChildren;for(let c=0;c<a.length;c++)O(n,e,s[c],a[c],r,null,i)}function Re(n,e,t){e.component=n.component,e.el=n.el,e.component&&e.component.update&&e.component.update()}function ee(n){function e(r,i){Q(n,e,r,i)}(0,$.registerDOMOperations)({insert(r,i,s){n.insert(i,r,s)},createElement(r){return n.createElement(r)},createText(r){return n.createText(r)},setText(r,i){r.nodeValue=i},setElementText(r,i){r.textContent=i},remove(r){n.remove(r)},createComment(r){return n.createComment(r)},mount(r,i,s,a,c,f,p){o(null,r,i,s,a)},patch(r,i,s,a,c,f,p,d){o(r,i,s,a,c)},unmount(r,i,s,a){e(r)},move(r,i,s){n.insert(i,r.el,s)}});function o(r,i,s,a,c){O(n,e,r,i,s,a,c)}return{mount(r,i){i.nodeType===1&&(i.textContent=""),o(null,r,i,null,null)},patch(r,i,s){var a;o(r,i,s||((a=r.el)==null?void 0:a.parentNode),null,null)},unmount(r,i){e(r,i)}}}var ne={acceptCharset:"acceptCharset",accessKey:"accessKey",className:"className",htmlFor:"htmlFor",httpEquiv:"httpEquiv",tabIndex:"tabIndex"},oe={allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,inert:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0},Ve={"accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","baseline-shift":"baselineShift","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","paint-order":"paintOrder","pointer-events":"pointerEvents","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","transform-origin":"transformOrigin","word-spacing":"wordSpacing","writing-mode":"writingMode","xlink:href":"xlinkHref","xlink:title":"xlinkTitle","xml:lang":"xmlLang","xml:space":"xmlSpace"};function E(n,e,t){if(e==="class"){n.className=t==null?"":String(t);return}if(e==="style"){if(typeof t=="string")n.style.cssText=t;else if(t!=null&&typeof t=="object")for(let r in t)n.style[r]=t[r];else n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let r=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase();typeof t=="function"&&n.addEventListener(r,t);return}if(e in oe){t?(n.setAttribute(e,""),e in n&&(n[e]=!0)):(n.removeAttribute(e),e in n&&(n[e]=!1));return}let o=ne[e]||e;if(o in n){try{n[o]=t==null?"":t}catch(r){n.setAttribute(e,t==null?"":String(t))}return}t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,String(t))}function h(n,e){if(e==="class"){n.className="";return}if(e==="style"){n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let o=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase(),r=n._vei;if(r){let i="on"+o.charAt(0).toUpperCase()+o.slice(1),s=r[i];s&&(n.removeEventListener(o,s),r[i]=void 0)}return}if(e in oe){n.removeAttribute(e),e in n&&(n[e]=!1);return}let t=ne[e]||e;if(t in n){try{n[t]=""}catch(o){n.removeAttribute(e)}return}n.removeAttribute(e)}function te(n){return n.startsWith("on")||n.startsWith("@")}function re(n,e,t){let o=e?Object.keys(e):[],r=t?Object.keys(t):[];for(let i=0;i<r.length;i++){let s=r[i],a=t[s],c=e?e[s]:void 0;s==="key"||s==="ref"||a!==c&&(s==="class"?n.className=a==null?"":String(a):s==="style"?Ae(n,a,c):te(s)||E(n,s,a))}for(let i=0;i<o.length;i++){let s=o[i];s==="key"||s==="ref"||(!t||!(s in t))&&(s==="class"?n.className="":s==="style"?n.style.cssText="":te(s)||h(n,s))}}function Ae(n,e,t){if(!e||typeof e=="string"&&!e.trim()){n.style.cssText="";return}if(typeof e=="string"){n.style.cssText=e;return}if(typeof t=="object"&&t!==null)for(let o in t)o in e||(n.style[o]="");for(let o in e)n.style[o]=e[o]}function _(n){return n==="svg"||n==="path"||n==="circle"||n==="rect"||n==="line"||n==="polyline"||n==="polygon"||n==="ellipse"||n==="g"||n==="defs"||n==="use"||n==="text"||n==="tspan"||n==="clipPath"||n==="mask"||n==="filter"||n==="linearGradient"||n==="radialGradient"||n==="stop"||n==="pattern"||n==="symbol"||n==="image"||n==="foreignObject"||n==="animate"||n==="animateTransform"||n==="animateMotion"}function ie(n){return Ve[n]||n}var be=/^(?:@|on)/;function I(n){return n.replace(be,"").toLowerCase()}function G(n){let e=I(n);return"on"+e.charAt(0).toUpperCase()+e.slice(1)}var Se={stop:"stop",prevent:"prevent",capture:"capture",once:"once",self:"self",passive:"passive"};function B(n){let e=n.split("."),o={name:e[0],stop:!1,prevent:!1,capture:!1,once:!1,self:!1,passive:!1};for(let r=1;r<e.length;r++){let i=e[r],s=Se[i];s&&(o[s]=!0)}return o}function X(n){let e=(t=>{e.value&&e.value(t)});return e.value=n,e}var g="_vei";function se(n){return n[g]||null}function L(n,e,t,o,r){let i=G(e),s=B(I(e)),a=s.name,c=n[g];c||(c=n[g]={});let f=c[i];if(t&&f)f.value=t;else if(t&&!f){let p=X(t);c[i]=p;let d={};s.capture&&(d.capture=!0),s.once&&(d.once=!0),s.passive&&(d.passive=!0),n.addEventListener(a,p,d)}else!t&&f&&(n.removeEventListener(a,f),c[i]=void 0)}function D(n){let e=n[g];if(e){for(let t in e){let o=e[t];if(o){let r=t.charAt(2).toLowerCase()+t.slice(3);n.removeEventListener(r,o)}}n[g]={}}}var z=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(z||{});function v(n,e,t){let o=ce(e);o!==t&&(n.className=o)}function ce(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++){let r=ce(n[o]);r&&(t+=(t?" ":"")+r)}return t}let e="";for(let t in n)n[t]&&(e+=(e?" ":"")+t);return e}return String(n)}function N(n,e,t){if(!e){n.style.cssText="";return}if(!t){typeof e=="string"?n.style.cssText=e:typeof e=="object"&&ae(n,e);return}if(typeof e!=typeof t){n.style.cssText="",typeof e=="string"?n.style.cssText=e:typeof e=="object"&&ae(n,e);return}if(typeof e=="string"){e!==t&&(n.style.cssText=e);return}if(typeof e=="object"&&typeof t=="object"){for(let o in t)o in e||(n.style[o]="");for(let o in e){let r=e[o],i=t[o];r!==i&&(n.style[o]=r==null?"":r)}}}function ae(n,e){for(let t in e)n.style[t]=e[t]===null||e[t]===void 0?"":e[t]}function le(n,e,t,o){L(n,"",e,t,o)}var Oe=new Set(["class","style","key","ref"]);function _e(n){return n.length>2&&(n[0]==="o"||n[0]==="O"||n[0]==="@")&&(n[1]==="n"||n[1]==="N")}function w(n,e,t,o,r){if(!Oe.has(e)){if(e==="class"){v(n,t,o);return}if(e==="style"){N(n,t,o);return}if(_e(e)){L(n,e,t,o,r);return}if(t===!1||t===null||t===void 0){n.removeAttribute(e);return}if(e in n)try{n[e]=t}catch(i){n.setAttribute(e,String(t))}else n.setAttribute(e,String(t))}}function y(n,e,t,o,r){w(n,e,t,o,r)}function T(n,e,t,o){if(t)for(let r in t){if(r==="key"||r==="ref")continue;let i=t[r],s=e?e[r]:void 0;i!==s&&y(n,r,i,s,o)}if(e)for(let r in e)r==="key"||r==="ref"||(!t||!(r in t))&&y(n,r,null,e[r],o)}function fe(n,e,t,o){let r=e.props||{},i=t.props||{},{patchFlag:s,dynamicProps:a}=t;if(!s||s===-1){T(n,r,i,o);return}if(s===-2){T(n,r,i,o);return}if(s&1&&e.children!==t.children&&(n.textContent=t.children),s&2&&r.class!==i.class&&v(n,i.class,r.class),s&4&&r.style!==i.style&&N(n,i.style,r.style),s&8&&a)for(let c=0;c<a.length;c++){let f=a[c],p=r[f],d=i[f];d!==p&&y(n,f,d,p,o)}s&16&&T(n,r,i,o)}var C=class{createElement(e){return _(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}createText(e){return document.createTextNode(e)}createComment(e){return document.createComment(e)}setAttribute(e,t,o){E(e,t,o)}removeAttribute(e,t){h(e,t)}setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let o in t)e.style[o]=t[o]}setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let o="";for(let r in t)t[r]&&(o+=(o?" ":"")+r);e.className=o}else e.className=""}insert(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}replace(e,t,o){e.replaceChild(o,t)}addEventListener(e,t,o,r){e.addEventListener(t,o,r)}removeEventListener(e,t,o){e.removeEventListener(t,o)}nextTick(e){Promise.resolve().then(e)}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}querySelector(e){return document.querySelector(e)}setClassWithOld(e,t,o){v(e,t,o)}setStyleWithOld(e,t,o){N(e,t,o)}setAttributeWithOld(e,t,o,r){y(e,t,o,r)}setElementText(e,t){e.textContent=t}setText(e,t){e.nodeValue=t}insertBefore(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}removeChild(e,t){e.removeChild(t)}setAnchor(e,t){e.anchor=t}getNextSibling(e){return e.nextSibling}cleanupEvents(e){D(e)}},pe=new C;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{registerDOMOperations as pe}from"@lytjs/vdom";var m=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(m||{}),S=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(S||{}),H=Symbol("Fragment"),j=Symbol("Text"),U=Symbol("Comment");function y(n){return n.type===H}function h(n){return n.type===j}function g(n){return n.type===U}function Y(n,e){return n.type===e.type&&n.key===e.key}function O(n){return Array.isArray(n.dynamicChildren)}function G(n,e,t,o){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o);else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();n.addEventListener(e,r,o)}else t==="key"||t==="ref"||n.setAttribute(e,t,o)}function _(n,e,t,o,r){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o||{});else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r&&n.removeEventListener(e,i,r),o&&n.addEventListener(e,i,o)}else n.setAttribute(e,t,o)}function I(n,e,t,o){for(let r in o){if(r==="key"||r==="ref")continue;let i=t[r],s=o[r];s!==i&&_(n,e,r,s,i)}for(let r in t)if(!(r==="key"||r==="ref")&&!(r in o))if(r==="class")n.setClass(e,"");else if(r==="style")n.setStyle(e,{});else if(r.startsWith("on")||r.startsWith("@")){let i=r.startsWith("@")?r.slice(1).toLowerCase():r.slice(2).toLowerCase();n.removeEventListener(e,i,t[r])}else n.removeAttribute(e,r)}function D(n,e,t,o,r,i){let{shapeFlag:s}=t;if(y(t)){oe(n,e,t,o,r,i);return}if(h(t)){let a=n.createText(t.children);t.el=a,n.insert(o,a,r);return}if(g(t)){let a=n.createComment(t.children);t.el=a,n.insert(o,a,r);return}if(s&1){ne(n,e,t,o,r,i);return}if(s&6){re(e,t,o,r,i);return}}function ne(n,e,t,o,r,i){let s=t.type,a=n.createElement(s);if(t.el=a,t.props)for(let d in t.props){let p=t.props[d];G(n,a,d,p)}let{shapeFlag:c,children:f}=t;c&8?a.textContent=f:c&16&&L(e,f,a,null,i),n.insert(o,a,r)}function L(n,e,t,o,r){for(let i=0;i<e.length;i++)n(null,e[i],t,o,r)}function oe(n,e,t,o,r,i){let{children:s}=t,a=n.createComment("");n.insert(o,a,r),Array.isArray(s)&&s.length>0&&L(e,s,o,a,i),t.el=a,t.anchor=a}function re(n,e,t,o,r){let i=e.component;i&&i.update&&i.update(),i&&i.subTree&&(n(null,i.subTree,t,o,i),e.el=i.subTree.el)}function B(n,e,t,o){let{shapeFlag:r,children:i}=t;if(y(t)){if(Array.isArray(i))for(let s=0;s<i.length;s++)e(i[s],o);t.anchor&&t.anchor.parentNode&&n.remove(t.anchor);return}if(r&6){t.component&&t.component.subTree&&e(t.component.subTree,o);return}t.el&&n.remove(t.el)}function T(n,e){for(let t=0;t<e.length;t++)n(e[t])}import{patchKeyedChildren as ie,patchUnkeyedChildren as se}from"@lytjs/vdom";function C(n,e,t,o,r,i=null,s=null){if(o==null){t&&e(t,r);return}if(t===null){D(n,M(n,e),o,r,i,s);return}if(O(o)&&O(t)){fe(n,e,t,o,r,s);return}if(!Y(t,o)){e(t,r),D(n,M(n,e),o,r,i,s);return}o.el=t.el,o.anchor=t.anchor;let{shapeFlag:a}=o;if(y(o)){le(n,e,t,o,r,i,s);return}if(h(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(g(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(a&1){ae(n,e,t,o,s);return}if(a&6){de(t,o,s);return}}function M(n,e){return(t,o,r,i,s)=>{C(n,e,t,o,r,i,s)}}function ae(n,e,t,o,r=null){let i=o.el=t.el,s=t.props||{},a=o.props||{},{patchFlag:c,dynamicProps:f}=o;if(c&&c>0){if(c&1&&t.children!==o.children&&(i.textContent=o.children),c&2&&s.class!==a.class&&n.setClass(i,a.class),c&4&&s.style!==a.style&&n.setStyle(i,a.style||{}),c&8&&f)for(let d=0;d<f.length;d++){let p=f[d],l=s[p],W=a[p];W!==l&&_(n,i,p,W,l)}c&16&&I(n,i,s,a)}else I(n,i,s,a);(!c||!(c&1))&&z(n,e,t,o,i,null,r)}function z(n,e,t,o,r,i,s){let a=t.shapeFlag,c=o.shapeFlag,f=t.children,d=o.children;if(c&8){a&16&&T(e,f),f!==d&&(r.textContent=d);return}if(c&16){a&16?ce(n,e,f,d,r,i,s):(a&8&&(r.textContent=""),L(M(n,e),d,r,i,s));return}d==null&&(a&8?r.textContent="":a&16&&T(e,f))}function ce(n,e,t,o,r,i,s){o.every(c=>c.key!==null&&c.key!==void 0)&&t.every(c=>c.key!==null&&c.key!==void 0)?ie(t,o,r,i,s,null,!1):se(t,o,r,i,s,null,!1)}function le(n,e,t,o,r,i,s){let a=t.children,c=o.children;Array.isArray(c)&&c.length>0?(z(n,e,t,o,r,i,s),o.el=c[0].el,o.anchor=c[c.length-1].el?n.nextSibling(c[c.length-1].el):i):Array.isArray(a)&&a.length>0&&c===null?(T(e,a),o.el=t.el,o.anchor=t.anchor):(o.el=t.el,o.anchor=t.anchor)}function fe(n,e,t,o,r,i){let s=t.dynamicChildren,a=o.dynamicChildren;for(let c=0;c<a.length;c++)C(n,e,s[c],a[c],r,null,i)}function de(n,e,t){e.component=n.component,e.el=n.el,e.component&&e.component.update&&e.component.update()}function ye(n){function e(r,i){B(n,e,r,i)}pe({insert(r,i,s){n.insert(i,r,s)},createElement(r){return n.createElement(r)},createText(r){return n.createText(r)},setText(r,i){r.nodeValue=i},setElementText(r,i){r.textContent=i},remove(r){n.remove(r)},createComment(r){return n.createComment(r)},mount(r,i,s,a,c,f,d){o(null,r,i,s,a)},patch(r,i,s,a,c,f,d,p){o(r,i,s,a,c)},unmount(r,i,s,a){e(r)},move(r,i,s){n.insert(i,r.el,s)}});function o(r,i,s,a,c){C(n,e,r,i,s,a,c)}return{mount(r,i){i.nodeType===1&&(i.textContent=""),o(null,r,i,null,null)},patch(r,i,s){var a;o(r,i,s||((a=r.el)==null?void 0:a.parentNode),null,null)},unmount(r,i){e(r,i)}}}var w={acceptCharset:"acceptCharset",accessKey:"accessKey",className:"className",htmlFor:"htmlFor",httpEquiv:"httpEquiv",tabIndex:"tabIndex"},q={allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,inert:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0},ue={"accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","baseline-shift":"baselineShift","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","paint-order":"paintOrder","pointer-events":"pointerEvents","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","transform-origin":"transformOrigin","word-spacing":"wordSpacing","writing-mode":"writingMode","xlink:href":"xlinkHref","xlink:title":"xlinkTitle","xml:lang":"xmlLang","xml:space":"xmlSpace"};function x(n,e,t){if(e==="class"){n.className=t==null?"":String(t);return}if(e==="style"){if(typeof t=="string")n.style.cssText=t;else if(t!=null&&typeof t=="object")for(let r in t)n.style[r]=t[r];else n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let r=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase();typeof t=="function"&&n.addEventListener(r,t);return}if(e in q){t?(n.setAttribute(e,""),e in n&&(n[e]=!0)):(n.removeAttribute(e),e in n&&(n[e]=!1));return}let o=w[e]||e;if(o in n){try{n[o]=t==null?"":t}catch(r){n.setAttribute(e,t==null?"":String(t))}return}t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,String(t))}function R(n,e){if(e==="class"){n.className="";return}if(e==="style"){n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let o=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase(),r=n._vei;if(r){let i="on"+o.charAt(0).toUpperCase()+o.slice(1),s=r[i];s&&(n.removeEventListener(o,s),r[i]=void 0)}return}if(e in q){n.removeAttribute(e),e in n&&(n[e]=!1);return}let t=w[e]||e;if(t in n){try{n[t]=""}catch(o){n.removeAttribute(e)}return}n.removeAttribute(e)}function X(n){return n.startsWith("on")||n.startsWith("@")}function me(n,e,t){let o=e?Object.keys(e):[],r=t?Object.keys(t):[];for(let i=0;i<r.length;i++){let s=r[i],a=t[s],c=e?e[s]:void 0;s==="key"||s==="ref"||a!==c&&(s==="class"?n.className=a==null?"":String(a):s==="style"?ve(n,a,c):X(s)||x(n,s,a))}for(let i=0;i<o.length;i++){let s=o[i];s==="key"||s==="ref"||(!t||!(s in t))&&(s==="class"?n.className="":s==="style"?n.style.cssText="":X(s)||R(n,s))}}function ve(n,e,t){if(!e||typeof e=="string"&&!e.trim()){n.style.cssText="";return}if(typeof e=="string"){n.style.cssText=e;return}if(typeof t=="object"&&t!==null)for(let o in t)o in e||(n.style[o]="");for(let o in e)n.style[o]=e[o]}function P(n){return n==="svg"||n==="path"||n==="circle"||n==="rect"||n==="line"||n==="polyline"||n==="polygon"||n==="ellipse"||n==="g"||n==="defs"||n==="use"||n==="text"||n==="tspan"||n==="clipPath"||n==="mask"||n==="filter"||n==="linearGradient"||n==="radialGradient"||n==="stop"||n==="pattern"||n==="symbol"||n==="image"||n==="foreignObject"||n==="animate"||n==="animateTransform"||n==="animateMotion"}function Ne(n){return ue[n]||n}var Ee=/^(?:@|on)/;function k(n){return n.replace(Ee,"").toLowerCase()}function F(n){let e=k(n);return"on"+e.charAt(0).toUpperCase()+e.slice(1)}var he={stop:"stop",prevent:"prevent",capture:"capture",once:"once",self:"self",passive:"passive"};function J(n){let e=n.split("."),o={name:e[0],stop:!1,prevent:!1,capture:!1,once:!1,self:!1,passive:!1};for(let r=1;r<e.length;r++){let i=e[r],s=he[i];s&&(o[s]=!0)}return o}function Q(n){let e=(t=>{e.value&&e.value(t)});return e.value=n,e}var v="_vei";function ge(n){return n[v]||null}function V(n,e,t,o,r){let i=F(e),s=J(k(e)),a=s.name,c=n[v];c||(c=n[v]={});let f=c[i];if(t&&f)f.value=t;else if(t&&!f){let d=Q(t);c[i]=d;let p={};s.capture&&(p.capture=!0),s.once&&(p.once=!0),s.passive&&(p.passive=!0),n.addEventListener(a,d,p)}else!t&&f&&(n.removeEventListener(a,f),c[i]=void 0)}function K(n){let e=n[v];if(e){for(let t in e){let o=e[t];if(o){let r=t.charAt(2).toLowerCase()+t.slice(3);n.removeEventListener(r,o)}}n[v]={}}}var $=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))($||{});function N(n,e,t){let o=ee(e);o!==t&&(n.className=o)}function ee(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++){let r=ee(n[o]);r&&(t+=(t?" ":"")+r)}return t}let e="";for(let t in n)n[t]&&(e+=(e?" ":"")+t);return e}return String(n)}function E(n,e,t){if(!e){n.style.cssText="";return}if(!t){typeof e=="string"?n.style.cssText=e:typeof e=="object"&&Z(n,e);return}if(typeof e!=typeof t){n.style.cssText="",typeof e=="string"?n.style.cssText=e:typeof e=="object"&&Z(n,e);return}if(typeof e=="string"){e!==t&&(n.style.cssText=e);return}if(typeof e=="object"&&typeof t=="object"){for(let o in t)o in e||(n.style[o]="");for(let o in e){let r=e[o],i=t[o];r!==i&&(n.style[o]=r==null?"":r)}}}function Z(n,e){for(let t in e)n.style[t]=e[t]===null||e[t]===void 0?"":e[t]}function Le(n,e,t,o){V(n,"",e,t,o)}var Te=new Set(["class","style","key","ref"]);function Ce(n){return n.length>2&&(n[0]==="o"||n[0]==="O"||n[0]==="@")&&(n[1]==="n"||n[1]==="N")}function te(n,e,t,o,r){if(!Te.has(e)){if(e==="class"){N(n,t,o);return}if(e==="style"){E(n,t,o);return}if(Ce(e)){V(n,e,t,o,r);return}if(t===!1||t===null||t===void 0){n.removeAttribute(e);return}if(e in n)try{n[e]=t}catch(i){n.setAttribute(e,String(t))}else n.setAttribute(e,String(t))}}function u(n,e,t,o,r){te(n,e,t,o,r)}function A(n,e,t,o){if(t)for(let r in t){if(r==="key"||r==="ref")continue;let i=t[r],s=e?e[r]:void 0;i!==s&&u(n,r,i,s,o)}if(e)for(let r in e)r==="key"||r==="ref"||(!t||!(r in t))&&u(n,r,null,e[r],o)}function xe(n,e,t,o){let r=e.props||{},i=t.props||{},{patchFlag:s,dynamicProps:a}=t;if(!s||s===-1){A(n,r,i,o);return}if(s===-2){A(n,r,i,o);return}if(s&1&&e.children!==t.children&&(n.textContent=t.children),s&2&&r.class!==i.class&&N(n,i.class,r.class),s&4&&r.style!==i.style&&E(n,i.style,r.style),s&8&&a)for(let c=0;c<a.length;c++){let f=a[c],d=r[f],p=i[f];p!==d&&u(n,f,p,d,o)}s&16&&A(n,r,i,o)}var b=class{createElement(e){return P(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}createText(e){return document.createTextNode(e)}createComment(e){return document.createComment(e)}setAttribute(e,t,o){x(e,t,o)}removeAttribute(e,t){R(e,t)}setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let o in t)e.style[o]=t[o]}setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let o="";for(let r in t)t[r]&&(o+=(o?" ":"")+r);e.className=o}else e.className=""}insert(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}replace(e,t,o){e.replaceChild(o,t)}addEventListener(e,t,o,r){e.addEventListener(t,o,r)}removeEventListener(e,t,o){e.removeEventListener(t,o)}nextTick(e){Promise.resolve().then(e)}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}querySelector(e){return document.querySelector(e)}setClassWithOld(e,t,o){N(e,t,o)}setStyleWithOld(e,t,o){E(e,t,o)}setAttributeWithOld(e,t,o,r){u(e,t,o,r)}setElementText(e,t){e.textContent=t}setText(e,t){e.nodeValue=t}insertBefore(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}removeChild(e,t){e.removeChild(t)}setAnchor(e,t){e.anchor=t}getNextSibling(e){return e.nextSibling}cleanupEvents(e){K(e)}},Re=new b;export{U as Comment,b as DOMRenderer,H as Fragment,S as PatchFlags,$ as PatchPropFlags,m as ShapeFlags,j as Text,Q as createInvoker,ye as createRenderer,Re as domRenderer,ge as getEventInvokers,F as getEventKey,Ne as getSVGPropName,P as isSVGElement,k as normalizeEventName,J as parseEventModifier,A as patchAllProps,N as patchClass,te as patchDOMProp,me as patchDOMProps,xe as patchElementProps,V as patchEvent,Le as patchEventOnElement,u as patchProp,E as patchStyle,K as removeAllEventListeners,R as removeDOMProp,x as setDOMProp};
|
|
1
|
+
import{registerDOMOperations as de}from"@lytjs/vdom";var m=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(m||{}),S=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(S||{}),H=Symbol("Fragment"),j=Symbol("Text"),U=Symbol("Comment");function y(n){return n.type===H}function h(n){return n.type===j}function g(n){return n.type===U}function Y(n,e){return n.type===e.type&&n.key===e.key}function O(n){return Array.isArray(n.dynamicChildren)}function G(n,e,t,o){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o);else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();n.addEventListener(e,r,o)}else t==="key"||t==="ref"||n.setAttribute(e,t,o)}function _(n,e,t,o,r){if(t==="class")n.setClass(e,o);else if(t==="style")n.setStyle(e,o||{});else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r&&n.removeEventListener(e,i,r),o&&n.addEventListener(e,i,o)}else n.setAttribute(e,t,o)}function I(n,e,t,o){for(let r in o){if(r==="key"||r==="ref")continue;let i=t[r],s=o[r];s!==i&&_(n,e,r,s,i)}for(let r in t)if(!(r==="key"||r==="ref")&&!(r in o))if(r==="class")n.setClass(e,"");else if(r==="style")n.setStyle(e,{});else if(r.startsWith("on")||r.startsWith("@")){let i=r.startsWith("@")?r.slice(1).toLowerCase():r.slice(2).toLowerCase();n.removeEventListener(e,i,t[r])}else n.removeAttribute(e,r)}function D(n,e,t,o,r,i){let{shapeFlag:s}=t;if(y(t)){oe(n,e,t,o,r,i);return}if(h(t)){let a=n.createText(t.children);t.el=a,n.insert(o,a,r);return}if(g(t)){let a=n.createComment(t.children);t.el=a,n.insert(o,a,r);return}if(s&1){ne(n,e,t,o,r,i);return}if(s&6){re(e,t,o,r,i);return}}function ne(n,e,t,o,r,i){let s=t.type,a=n.createElement(s);if(t.el=a,t.props)for(let p in t.props){let d=t.props[p];G(n,a,p,d)}let{shapeFlag:c,children:f}=t;c&8?a.textContent=f:c&16&&L(e,f,a,null,i),n.insert(o,a,r)}function L(n,e,t,o,r){for(let i=0;i<e.length;i++)n(null,e[i],t,o,r)}function oe(n,e,t,o,r,i){let{children:s}=t,a=n.createComment("");n.insert(o,a,r),Array.isArray(s)&&s.length>0&&L(e,s,o,a,i),t.el=a,t.anchor=a}function re(n,e,t,o,r){let i=e.component;i&&i.update&&i.update(),i&&i.subTree&&(n(null,i.subTree,t,o,i),e.el=i.subTree.el)}function B(n,e,t,o){let{shapeFlag:r,children:i}=t;if(y(t)){if(Array.isArray(i))for(let s=0;s<i.length;s++)e(i[s],o);t.anchor&&t.anchor.parentNode&&n.remove(t.anchor);return}if(r&6){t.component&&t.component.subTree&&e(t.component.subTree,o);return}t.el&&n.remove(t.el)}function T(n,e){for(let t=0;t<e.length;t++)n(e[t])}import{patchKeyedChildren as ie,patchUnkeyedChildren as se}from"@lytjs/vdom";function C(n,e,t,o,r,i=null,s=null){if(o==null){t&&e(t,r);return}if(t===null){D(n,M(n,e),o,r,i,s);return}if(O(o)&&O(t)){fe(n,e,t,o,r,s);return}if(!Y(t,o)){e(t,r),D(n,M(n,e),o,r,i,s);return}o.el=t.el,o.anchor=t.anchor;let{shapeFlag:a}=o;if(y(o)){le(n,e,t,o,r,i,s);return}if(h(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(g(o)){o.children!==t.children&&(o.el.nodeValue=o.children);return}if(a&1){ae(n,e,t,o,s);return}if(a&6){pe(t,o,s);return}}function M(n,e){return(t,o,r,i,s)=>{C(n,e,t,o,r,i,s)}}function ae(n,e,t,o,r=null){let i=o.el=t.el,s=t.props||{},a=o.props||{},{patchFlag:c,dynamicProps:f}=o;if(c&&c>0){if(c&1&&t.children!==o.children&&(i.textContent=o.children),c&2&&s.class!==a.class&&n.setClass(i,a.class),c&4&&s.style!==a.style&&n.setStyle(i,a.style||{}),c&8&&f)for(let p=0;p<f.length;p++){let d=f[p],l=s[d],W=a[d];W!==l&&_(n,i,d,W,l)}c&16&&I(n,i,s,a)}else I(n,i,s,a);(!c||!(c&1))&&X(n,e,t,o,i,null,r)}function X(n,e,t,o,r,i,s){let a=t.shapeFlag,c=o.shapeFlag,f=t.children,p=o.children;if(c&8){a&16&&T(e,f),f!==p&&(r.textContent=p);return}if(c&16){a&16?ce(n,e,f,p,r,i,s):(a&8&&(r.textContent=""),L(M(n,e),p,r,i,s));return}p==null&&(a&8?r.textContent="":a&16&&T(e,f))}function ce(n,e,t,o,r,i,s){o.every(c=>c.key!==null&&c.key!==void 0)&&t.every(c=>c.key!==null&&c.key!==void 0)?ie(t,o,r,i,s,null,!1):se(t,o,r,i,s,null,!1)}function le(n,e,t,o,r,i,s){let a=t.children,c=o.children;Array.isArray(c)&&c.length>0?(X(n,e,t,o,r,i,s),o.el=c[0].el,o.anchor=c[c.length-1].el?n.nextSibling(c[c.length-1].el):i):Array.isArray(a)&&a.length>0&&c===null?(T(e,a),o.el=t.el,o.anchor=t.anchor):(o.el=t.el,o.anchor=t.anchor)}function fe(n,e,t,o,r,i){let s=t.dynamicChildren,a=o.dynamicChildren;for(let c=0;c<a.length;c++)C(n,e,s[c],a[c],r,null,i)}function pe(n,e,t){e.component=n.component,e.el=n.el,e.component&&e.component.update&&e.component.update()}function ye(n){function e(r,i){B(n,e,r,i)}de({insert(r,i,s){n.insert(i,r,s)},createElement(r){return n.createElement(r)},createText(r){return n.createText(r)},setText(r,i){r.nodeValue=i},setElementText(r,i){r.textContent=i},remove(r){n.remove(r)},createComment(r){return n.createComment(r)},mount(r,i,s,a,c,f,p){o(null,r,i,s,a)},patch(r,i,s,a,c,f,p,d){o(r,i,s,a,c)},unmount(r,i,s,a){e(r)},move(r,i,s){n.insert(i,r.el,s)}});function o(r,i,s,a,c){C(n,e,r,i,s,a,c)}return{mount(r,i){i.nodeType===1&&(i.textContent=""),o(null,r,i,null,null)},patch(r,i,s){var a;o(r,i,s||((a=r.el)==null?void 0:a.parentNode),null,null)},unmount(r,i){e(r,i)}}}var w={acceptCharset:"acceptCharset",accessKey:"accessKey",className:"className",htmlFor:"htmlFor",httpEquiv:"httpEquiv",tabIndex:"tabIndex"},q={allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,inert:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0},ue={"accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","baseline-shift":"baselineShift","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","paint-order":"paintOrder","pointer-events":"pointerEvents","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","transform-origin":"transformOrigin","word-spacing":"wordSpacing","writing-mode":"writingMode","xlink:href":"xlinkHref","xlink:title":"xlinkTitle","xml:lang":"xmlLang","xml:space":"xmlSpace"};function x(n,e,t){if(e==="class"){n.className=t==null?"":String(t);return}if(e==="style"){if(typeof t=="string")n.style.cssText=t;else if(t!=null&&typeof t=="object")for(let r in t)n.style[r]=t[r];else n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let r=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase();typeof t=="function"&&n.addEventListener(r,t);return}if(e in q){t?(n.setAttribute(e,""),e in n&&(n[e]=!0)):(n.removeAttribute(e),e in n&&(n[e]=!1));return}let o=w[e]||e;if(o in n){try{n[o]=t==null?"":t}catch(r){n.setAttribute(e,t==null?"":String(t))}return}t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,String(t))}function R(n,e){if(e==="class"){n.className="";return}if(e==="style"){n.style.cssText="";return}if(e.startsWith("on")||e.startsWith("@")){let o=e.startsWith("@")?e.slice(1).toLowerCase():e.slice(2).toLowerCase(),r=n._vei;if(r){let i="on"+o.charAt(0).toUpperCase()+o.slice(1),s=r[i];s&&(n.removeEventListener(o,s),r[i]=void 0)}return}if(e in q){n.removeAttribute(e),e in n&&(n[e]=!1);return}let t=w[e]||e;if(t in n){try{n[t]=""}catch(o){n.removeAttribute(e)}return}n.removeAttribute(e)}function z(n){return n.startsWith("on")||n.startsWith("@")}function me(n,e,t){let o=e?Object.keys(e):[],r=t?Object.keys(t):[];for(let i=0;i<r.length;i++){let s=r[i],a=t[s],c=e?e[s]:void 0;s==="key"||s==="ref"||a!==c&&(s==="class"?n.className=a==null?"":String(a):s==="style"?ve(n,a,c):z(s)||x(n,s,a))}for(let i=0;i<o.length;i++){let s=o[i];s==="key"||s==="ref"||(!t||!(s in t))&&(s==="class"?n.className="":s==="style"?n.style.cssText="":z(s)||R(n,s))}}function ve(n,e,t){if(!e||typeof e=="string"&&!e.trim()){n.style.cssText="";return}if(typeof e=="string"){n.style.cssText=e;return}if(typeof t=="object"&&t!==null)for(let o in t)o in e||(n.style[o]="");for(let o in e)n.style[o]=e[o]}function P(n){return n==="svg"||n==="path"||n==="circle"||n==="rect"||n==="line"||n==="polyline"||n==="polygon"||n==="ellipse"||n==="g"||n==="defs"||n==="use"||n==="text"||n==="tspan"||n==="clipPath"||n==="mask"||n==="filter"||n==="linearGradient"||n==="radialGradient"||n==="stop"||n==="pattern"||n==="symbol"||n==="image"||n==="foreignObject"||n==="animate"||n==="animateTransform"||n==="animateMotion"}function Ne(n){return ue[n]||n}var Ee=/^(?:@|on)/;function k(n){return n.replace(Ee,"").toLowerCase()}function F(n){let e=k(n);return"on"+e.charAt(0).toUpperCase()+e.slice(1)}var he={stop:"stop",prevent:"prevent",capture:"capture",once:"once",self:"self",passive:"passive"};function J(n){let e=n.split("."),o={name:e[0],stop:!1,prevent:!1,capture:!1,once:!1,self:!1,passive:!1};for(let r=1;r<e.length;r++){let i=e[r],s=he[i];s&&(o[s]=!0)}return o}function Q(n){let e=(t=>{e.value&&e.value(t)});return e.value=n,e}var v="_vei";function ge(n){return n[v]||null}function V(n,e,t,o,r){let i=F(e),s=J(k(e)),a=s.name,c=n[v];c||(c=n[v]={});let f=c[i];if(t&&f)f.value=t;else if(t&&!f){let p=Q(t);c[i]=p;let d={};s.capture&&(d.capture=!0),s.once&&(d.once=!0),s.passive&&(d.passive=!0),n.addEventListener(a,p,d)}else!t&&f&&(n.removeEventListener(a,f),c[i]=void 0)}function K(n){let e=n[v];if(e){for(let t in e){let o=e[t];if(o){let r=t.charAt(2).toLowerCase()+t.slice(3);n.removeEventListener(r,o)}}n[v]={}}}var $=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))($||{});function N(n,e,t){let o=ee(e);o!==t&&(n.className=o)}function ee(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++){let r=ee(n[o]);r&&(t+=(t?" ":"")+r)}return t}let e="";for(let t in n)n[t]&&(e+=(e?" ":"")+t);return e}return String(n)}function E(n,e,t){if(!e){n.style.cssText="";return}if(!t){typeof e=="string"?n.style.cssText=e:typeof e=="object"&&Z(n,e);return}if(typeof e!=typeof t){n.style.cssText="",typeof e=="string"?n.style.cssText=e:typeof e=="object"&&Z(n,e);return}if(typeof e=="string"){e!==t&&(n.style.cssText=e);return}if(typeof e=="object"&&typeof t=="object"){for(let o in t)o in e||(n.style[o]="");for(let o in e){let r=e[o],i=t[o];r!==i&&(n.style[o]=r==null?"":r)}}}function Z(n,e){for(let t in e)n.style[t]=e[t]===null||e[t]===void 0?"":e[t]}function Le(n,e,t,o){V(n,"",e,t,o)}var Te=new Set(["class","style","key","ref"]);function Ce(n){return n.length>2&&(n[0]==="o"||n[0]==="O"||n[0]==="@")&&(n[1]==="n"||n[1]==="N")}function te(n,e,t,o,r){if(!Te.has(e)){if(e==="class"){N(n,t,o);return}if(e==="style"){E(n,t,o);return}if(Ce(e)){V(n,e,t,o,r);return}if(t===!1||t===null||t===void 0){n.removeAttribute(e);return}if(e in n)try{n[e]=t}catch(i){n.setAttribute(e,String(t))}else n.setAttribute(e,String(t))}}function u(n,e,t,o,r){te(n,e,t,o,r)}function A(n,e,t,o){if(t)for(let r in t){if(r==="key"||r==="ref")continue;let i=t[r],s=e?e[r]:void 0;i!==s&&u(n,r,i,s,o)}if(e)for(let r in e)r==="key"||r==="ref"||(!t||!(r in t))&&u(n,r,null,e[r],o)}function xe(n,e,t,o){let r=e.props||{},i=t.props||{},{patchFlag:s,dynamicProps:a}=t;if(!s||s===-1){A(n,r,i,o);return}if(s===-2){A(n,r,i,o);return}if(s&1&&e.children!==t.children&&(n.textContent=t.children),s&2&&r.class!==i.class&&N(n,i.class,r.class),s&4&&r.style!==i.style&&E(n,i.style,r.style),s&8&&a)for(let c=0;c<a.length;c++){let f=a[c],p=r[f],d=i[f];d!==p&&u(n,f,d,p,o)}s&16&&A(n,r,i,o)}var b=class{createElement(e){return P(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}createText(e){return document.createTextNode(e)}createComment(e){return document.createComment(e)}setAttribute(e,t,o){x(e,t,o)}removeAttribute(e,t){R(e,t)}setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let o in t)e.style[o]=t[o]}setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let o="";for(let r in t)t[r]&&(o+=(o?" ":"")+r);e.className=o}else e.className=""}insert(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}replace(e,t,o){e.replaceChild(o,t)}addEventListener(e,t,o,r){e.addEventListener(t,o,r)}removeEventListener(e,t,o){e.removeEventListener(t,o)}nextTick(e){Promise.resolve().then(e)}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}querySelector(e){return document.querySelector(e)}setClassWithOld(e,t,o){N(e,t,o)}setStyleWithOld(e,t,o){E(e,t,o)}setAttributeWithOld(e,t,o,r){u(e,t,o,r)}setElementText(e,t){e.textContent=t}setText(e,t){e.nodeValue=t}insertBefore(e,t,o){o!=null?e.insertBefore(t,o):e.appendChild(t)}removeChild(e,t){e.removeChild(t)}setAnchor(e,t){e.anchor=t}getNextSibling(e){return e.nextSibling}cleanupEvents(e){K(e)}},Re=new b;export{U as Comment,b as DOMRenderer,H as Fragment,S as PatchFlags,$ as PatchPropFlags,m as ShapeFlags,j as Text,Q as createInvoker,ye as createRenderer,Re as domRenderer,ge as getEventInvokers,F as getEventKey,Ne as getSVGPropName,P as isSVGElement,k as normalizeEventName,J as parseEventModifier,A as patchAllProps,N as patchClass,te as patchDOMProp,me as patchDOMProps,xe as patchElementProps,V as patchEvent,Le as patchEventOnElement,u as patchProp,E as patchStyle,K as removeAllEventListeners,R as removeDOMProp,x as setDOMProp};
|
package/dist/native.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var C=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var F=(o,e)=>{for(var t in e)C(o,t,{get:e[t],enumerable:!0})},K=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Y(e))!z.call(o,i)&&i!==t&&C(o,i,{get:()=>e[i],enumerable:!(n=B(e,i))||n.enumerable});return o};var X=o=>K(C({},"__esModule",{value:!0}),o);var se={};F(se,{Comment:()=>L,Fragment:()=>E,NativeRenderer:()=>u,PatchFlags:()=>N,ShapeFlags:()=>y,Text:()=>R,createRenderer:()=>U,nativeRenderer:()=>j});module.exports=X(se);var W=require("@lytjs/vdom");var y=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(y||{}),N=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(N||{}),E=Symbol("Fragment"),R=Symbol("Text"),L=Symbol("Comment");function m(o){return o.type===E}function h(o){return o.type===R}function g(o){return o.type===L}function D(o,e){return o.type===e.type&&o.key===e.key}function A(o){return Array.isArray(o.dynamicChildren)}function H(o,e,t,n){if(t==="class")o.setClass(e,n);else if(t==="style")o.setStyle(e,n);else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();o.addEventListener(e,i,n)}else t==="key"||t==="ref"||o.setAttribute(e,t,n)}function b(o,e,t,n,i){if(t==="class")o.setClass(e,n);else if(t==="style")o.setStyle(e,n||{});else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();i&&o.removeEventListener(e,r,i),n&&o.addEventListener(e,r,n)}else o.setAttribute(e,t,n)}function S(o,e,t,n){for(let i in n){if(i==="key"||i==="ref")continue;let r=t[i],s=n[i];s!==r&&b(o,e,i,s,r)}for(let i in t)if(!(i==="key"||i==="ref")&&!(i in n))if(i==="class")o.setClass(e,"");else if(i==="style")o.setStyle(e,{});else if(i.startsWith("on")||i.startsWith("@")){let r=i.startsWith("@")?i.slice(1).toLowerCase():i.slice(2).toLowerCase();o.removeEventListener(e,r,t[i])}else o.removeAttribute(e,i)}function _(o,e,t,n,i,r){let{shapeFlag:s}=t;if(m(t)){$(o,e,t,n,i,r);return}if(h(t)){let a=o.createText(t.children);t.el=a,o.insert(n,a,i);return}if(g(t)){let a=o.createComment(t.children);t.el=a,o.insert(n,a,i);return}if(s&1){G(o,e,t,n,i,r);return}if(s&6){q(e,t,n,i,r);return}}function G(o,e,t,n,i,r){let s=t.type,a=o.createElement(s);if(t.el=a,t.props)for(let c in t.props){let f=t.props[c];H(o,a,c,f)}let{shapeFlag:d,children:p}=t;d&8?a.textContent=p:d&16&&v(e,p,a,null,r),o.insert(n,a,i)}function v(o,e,t,n,i){for(let r=0;r<e.length;r++)o(null,e[r],t,n,i)}function $(o,e,t,n,i,r){let{children:s}=t,a=o.createComment("");o.insert(n,a,i),Array.isArray(s)&&s.length>0&&v(e,s,n,a,r),t.el=a,t.anchor=a}function q(o,e,t,n,i){let r=e.component;r&&r.update&&r.update(),r&&r.subTree&&(o(null,r.subTree,t,n,r),e.el=r.subTree.el)}function M(o,e,t,n){let{shapeFlag:i,children:r}=t;if(m(t)){if(Array.isArray(r))for(let s=0;s<r.length;s++)e(r[s],n);t.anchor&&t.anchor.parentNode&&o.remove(t.anchor);return}if(i&6){t.component&&t.component.subTree&&e(t.component.subTree,n);return}t.el&&o.remove(t.el)}function T(o,e){for(let t=0;t<e.length;t++)o(e[t])}var x=require("@lytjs/vdom");function V(o,e,t,n,i,r=null,s=null){if(n==null){t&&e(t,i);return}if(t===null){_(o,O(o,e),n,i,r,s);return}if(A(n)&&A(t)){k(o,e,t,n,i,s);return}if(!D(t,n)){e(t,i),_(o,O(o,e),n,i,r,s);return}n.el=t.el,n.anchor=t.anchor;let{shapeFlag:a}=n;if(m(n)){Z(o,e,t,n,i,r,s);return}if(h(n)){n.children!==t.children&&(n.el.nodeValue=n.children);return}if(g(n)){n.children!==t.children&&(n.el.nodeValue=n.children);return}if(a&1){J(o,e,t,n,s);return}if(a&6){ee(t,n,s);return}}function O(o,e){return(t,n,i,r,s)=>{V(o,e,t,n,i,r,s)}}function J(o,e,t,n,i=null){let r=n.el=t.el,s=t.props||{},a=n.props||{},{patchFlag:d,dynamicProps:p}=n;if(d&&d>0){if(d&1&&t.children!==n.children&&(r.textContent=n.children),d&2&&s.class!==a.class&&o.setClass(r,a.class),d&4&&s.style!==a.style&&o.setStyle(r,a.style||{}),d&8&&p)for(let c=0;c<p.length;c++){let f=p[c],l=s[f],w=a[f];w!==l&&b(o,r,f,w,l)}d&16&&S(o,r,s,a)}else S(o,r,s,a);(!d||!(d&1))&&P(o,e,t,n,r,null,i)}function P(o,e,t,n,i,r,s){let a=t.shapeFlag,d=n.shapeFlag,p=t.children,c=n.children;if(d&8){a&16&&T(e,p),p!==c&&(i.textContent=c);return}if(d&16){a&16?Q(o,e,p,c,i,r,s):(a&8&&(i.textContent=""),v(O(o,e),c,i,r,s));return}c==null&&(a&8?i.textContent="":a&16&&T(e,p))}function Q(o,e,t,n,i,r,s){n.every(d=>d.key!==null&&d.key!==void 0)&&t.every(d=>d.key!==null&&d.key!==void 0)?(0,x.patchKeyedChildren)(t,n,i,r,s,null,!1):(0,x.patchUnkeyedChildren)(t,n,i,r,s,null,!1)}function Z(o,e,t,n,i,r,s){let a=t.children,d=n.children;Array.isArray(d)&&d.length>0?(P(o,e,t,n,i,r,s),n.el=d[0].el,n.anchor=d[d.length-1].el?o.nextSibling(d[d.length-1].el):r):Array.isArray(a)&&a.length>0&&d===null?(T(e,a),n.el=t.el,n.anchor=t.anchor):(n.el=t.el,n.anchor=t.anchor)}function k(o,e,t,n,i,r){let s=t.dynamicChildren,a=n.dynamicChildren;for(let d=0;d<a.length;d++)V(o,e,s[d],a[d],i,null,r)}function ee(o,e,t){e.component=o.component,e.el=o.el,e.component&&e.component.update&&e.component.update()}function U(o){function e(i,r){M(o,e,i,r)}(0,W.registerDOMOperations)({insert(i,r,s){o.insert(r,i,s)},createElement(i){return o.createElement(i)},createText(i){return o.createText(i)},setText(i,r){i.nodeValue=r},setElementText(i,r){i.textContent=r},remove(i){o.remove(i)},createComment(i){return o.createComment(i)},mount(i,r,s,a,d,p,c){n(null,i,r,s,a)},patch(i,r,s,a,d,p,c,f){n(i,r,s,a,d)},unmount(i,r,s,a){e(i)},move(i,r,s){o.insert(r,i.el,s)}});function n(i,r,s,a,d){V(o,e,i,r,s,a,d)}return{mount(i,r){r.nodeType===1&&(r.textContent=""),n(null,i,r,null,null)},patch(i,r,s){var a;n(i,r,s||((a=i.el)==null?void 0:a.parentNode),null,null)},unmount(i,r){e(i,r)}}}var te={div:"View",span:"Text",p:"Text",h1:"Text",h2:"Text",h3:"Text",h4:"Text",h5:"Text",h6:"Text",img:"Image",input:"TextInput",textarea:"TextInput",button:"TouchableOpacity",scroll:"ScrollView",list:"FlatList",a:"TouchableOpacity",ul:"View",ol:"View",li:"View",form:"View",header:"View",footer:"View",nav:"View",main:"View",section:"View",article:"View",aside:"View"},ne={flexDirection:"flexDirection",justifyContent:"justifyContent",alignItems:"alignItems",alignSelf:"alignSelf",flexWrap:"flexWrap",flex:"flex",flexGrow:"flexGrow",flexShrink:"flexShrink",flexBasis:"flexBasis",backgroundColor:"backgroundColor",color:"color",fontSize:"fontSize",fontWeight:"fontWeight",fontStyle:"fontStyle",textAlign:"textAlign",lineHeight:"lineHeight",letterSpacing:"letterSpacing",padding:"padding",paddingTop:"paddingTop",paddingBottom:"paddingBottom",paddingLeft:"paddingLeft",paddingRight:"paddingRight",paddingHorizontal:"paddingHorizontal",paddingVertical:"paddingVertical",margin:"margin",marginTop:"marginTop",marginBottom:"marginBottom",marginLeft:"marginLeft",marginRight:"marginRight",marginHorizontal:"marginHorizontal",marginVertical:"marginVertical",width:"width",height:"height",minWidth:"minWidth",maxWidth:"maxWidth",minHeight:"minHeight",maxHeight:"maxHeight",borderRadius:"borderRadius",borderWidth:"borderWidth",borderColor:"borderColor",overflow:"overflow",opacity:"opacity",position:"position",top:"top",left:"left",right:"right",bottom:"bottom",zIndex:"zIndex",shadowColor:"shadowColor",shadowOffset:"shadowOffset",shadowOpacity:"shadowOpacity",shadowRadius:"shadowRadius"},ie={click:"onPress",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",change:"onChange",input:"onChangeText",focus:"onFocus",blur:"onBlur",submit:"onSubmitEditing",scroll:"onScroll",longpress:"onLongPress"},oe=0;function I(){return`native_${++oe}`}var u=class{createElement(e){return{type:this.getComponentType(e),props:{},children:[],nativeId:I()}}createText(e){return{type:"RawText",props:{text:e},children:[],nativeId:I()}}createComment(e){return{type:"__Comment",props:{text:e},children:[],nativeId:I()}}setAttribute(e,t,n){if(e){if(t==="style"&&typeof n=="object"&&n!==null){e.props.style={...e.props.style,...this.mapStyle(n)};return}if(t==="className"||t==="class"){e.props.className=n;return}if(t.startsWith("on")&&typeof n=="function"){let i=t.slice(2).toLowerCase(),r=this.mapEvent(i);e.props[r]=n;return}if(t==="src"&&e.type==="Image"){e.props.source={uri:n};return}if(t==="href"){e.props.href=n;return}if(t==="placeholder"){e.props.placeholder=n;return}e.props[t]=n}}removeAttribute(e,t){if(e)if(t==="style")delete e.props.style;else if(t.startsWith("on")){let n=t.slice(2).toLowerCase(),i=this.mapEvent(n);delete e.props[i]}else delete e.props[t]}setStyle(e,t){if(!e)return;let n=this.mapStyle(t);e.props.style={...e.props.style,...n}}setClass(e,t){if(e){if(typeof t=="string")e.props.className=t;else if(typeof t=="object"&&t!==null){let n=[];for(let[i,r]of Object.entries(t))r&&n.push(i);e.props.className=n.join(" ")}}}insert(e,t,n){if(!(!e||!t)){if(t._parent){let i=t._parent,r=i.children.indexOf(t);r!==-1&&i.children.splice(r,1)}if(t._parent=e,n){let i=e.children.indexOf(n);i!==-1?e.children.splice(i,0,t):e.children.push(t)}else e.children.push(t)}}remove(e){if(!e||!e._parent)return;let t=e._parent,n=t.children.indexOf(e);n!==-1&&t.children.splice(n,1),e._parent=void 0}replace(e,t,n){if(!e||!t||!n)return;let i=e.children.indexOf(t);i!==-1&&(t._parent=void 0,n._parent=e,e.children[i]=n)}addEventListener(e,t,n,i){if(!e)return;let r=this.mapEvent(t);e.props[r]=n}removeEventListener(e,t,n){if(!e)return;let i=this.mapEvent(t);e.props[i]===n&&delete e.props[i]}nextTick(e){Promise.resolve().then(()=>e())}parentNode(e){var t;return(t=e==null?void 0:e._parent)!=null?t:null}nextSibling(e){if(!e||!e._parent)return null;let t=e._parent.children,n=t.indexOf(e);return n!==-1&&n+1<t.length?t[n+1]:null}setText(e,t){e&&e.type==="RawText"&&(e.props.text=t)}patchProp(e,t,n,i){if(e){if(i==null){this.removeAttribute(e,t);return}if(t==="style")this.setStyle(e,i);else if(t==="class"||t==="className")this.setClass(e,i);else if(t.startsWith("on")&&typeof i=="function"){let r=t.slice(2).toLowerCase(),s=this.mapEvent(r);e.props[s]=i}else this.setAttribute(e,t,i)}}querySelector(e){let t=e.replace(/[.#\[\]]/g,"").trim();return null}renderToNativeTree(e){if(!e)return this.createComment("empty vnode");if(typeof e=="string")return this.createText(e);if(e.type===Symbol.for("lyt.comment")||e.type==="comment")return this.createComment(e.children||"");if(e.type===Symbol.for("lyt.text")||e.type==="text")return this.createText(e.children||"");if(e.type===Symbol.for("lyt.fragment")||e.type==="fragment"){let t=this.createElement("__Fragment");if(Array.isArray(e.children))for(let n of e.children){let i=this.renderToNativeTree(n);this.insert(t,i)}return t}if(typeof e.type=="string"){let t=this.createElement(e.type);if(e.props)for(let[n,i]of Object.entries(e.props))n==="key"||n==="ref"||this.setAttribute(t,n,i);if(e.children){if(typeof e.children=="string")this.insert(t,this.createText(e.children));else if(Array.isArray(e.children))for(let n of e.children)this.insert(t,this.renderToNativeTree(n))}return t}if(typeof e.type=="object"||typeof e.type=="function"){let t=this.createElement("div");if(Array.isArray(e.children))for(let n of e.children)this.insert(t,this.renderToNativeTree(n));return t}return this.createComment("unknown vnode type")}serializeToJSON(e){let t=n=>{let i={type:n.type,props:{...n.props},children:n.children.map(t)};return n.nativeId&&(i.nativeId=n.nativeId),i};return JSON.stringify(t(e),null,2)}getComponentType(e){return te[e]||re(e)}mapStyle(e){let t={};for(let[n,i]of Object.entries(e)){let r=ne[n]||n;typeof i=="string"&&/^\d+px$/.test(i)?t[r]=parseInt(i,10):t[r]=i}return t}mapEvent(e){return ie[e]||`on${e.charAt(0).toUpperCase()}${e.slice(1)}`}};function re(o){return o.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}var j=new u;
|
|
1
|
+
var C=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var F=(o,e)=>{for(var t in e)C(o,t,{get:e[t],enumerable:!0})},K=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Y(e))!z.call(o,i)&&i!==t&&C(o,i,{get:()=>e[i],enumerable:!(n=B(e,i))||n.enumerable});return o};var X=o=>K(C({},"__esModule",{value:!0}),o);var se={};F(se,{Comment:()=>L,Fragment:()=>E,NativeRenderer:()=>u,PatchFlags:()=>N,ShapeFlags:()=>y,Text:()=>R,createRenderer:()=>U,nativeRenderer:()=>j});module.exports=X(se);var W=require("@lytjs/vdom");var y=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(y||{}),N=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(N||{}),E=Symbol("Fragment"),R=Symbol("Text"),L=Symbol("Comment");function m(o){return o.type===E}function h(o){return o.type===R}function g(o){return o.type===L}function D(o,e){return o.type===e.type&&o.key===e.key}function A(o){return Array.isArray(o.dynamicChildren)}function H(o,e,t,n){if(t==="class")o.setClass(e,n);else if(t==="style")o.setStyle(e,n);else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();o.addEventListener(e,i,n)}else t==="key"||t==="ref"||o.setAttribute(e,t,n)}function b(o,e,t,n,i){if(t==="class")o.setClass(e,n);else if(t==="style")o.setStyle(e,n||{});else if(t.startsWith("on")||t.startsWith("@")){let r=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();i&&o.removeEventListener(e,r,i),n&&o.addEventListener(e,r,n)}else o.setAttribute(e,t,n)}function S(o,e,t,n){for(let i in n){if(i==="key"||i==="ref")continue;let r=t[i],s=n[i];s!==r&&b(o,e,i,s,r)}for(let i in t)if(!(i==="key"||i==="ref")&&!(i in n))if(i==="class")o.setClass(e,"");else if(i==="style")o.setStyle(e,{});else if(i.startsWith("on")||i.startsWith("@")){let r=i.startsWith("@")?i.slice(1).toLowerCase():i.slice(2).toLowerCase();o.removeEventListener(e,r,t[i])}else o.removeAttribute(e,i)}function _(o,e,t,n,i,r){let{shapeFlag:s}=t;if(m(t)){$(o,e,t,n,i,r);return}if(h(t)){let a=o.createText(t.children);t.el=a,o.insert(n,a,i);return}if(g(t)){let a=o.createComment(t.children);t.el=a,o.insert(n,a,i);return}if(s&1){G(o,e,t,n,i,r);return}if(s&6){q(e,t,n,i,r);return}}function G(o,e,t,n,i,r){let s=t.type,a=o.createElement(s);if(t.el=a,t.props)for(let c in t.props){let f=t.props[c];H(o,a,c,f)}let{shapeFlag:d,children:p}=t;d&8?a.textContent=p:d&16&&v(e,p,a,null,r),o.insert(n,a,i)}function v(o,e,t,n,i){for(let r=0;r<e.length;r++)o(null,e[r],t,n,i)}function $(o,e,t,n,i,r){let{children:s}=t,a=o.createComment("");o.insert(n,a,i),Array.isArray(s)&&s.length>0&&v(e,s,n,a,r),t.el=a,t.anchor=a}function q(o,e,t,n,i){let r=e.component;r&&r.update&&r.update(),r&&r.subTree&&(o(null,r.subTree,t,n,r),e.el=r.subTree.el)}function M(o,e,t,n){let{shapeFlag:i,children:r}=t;if(m(t)){if(Array.isArray(r))for(let s=0;s<r.length;s++)e(r[s],n);t.anchor&&t.anchor.parentNode&&o.remove(t.anchor);return}if(i&6){t.component&&t.component.subTree&&e(t.component.subTree,n);return}t.el&&o.remove(t.el)}function T(o,e){for(let t=0;t<e.length;t++)o(e[t])}var x=require("@lytjs/vdom");function V(o,e,t,n,i,r=null,s=null){if(n==null){t&&e(t,i);return}if(t===null){_(o,O(o,e),n,i,r,s);return}if(A(n)&&A(t)){k(o,e,t,n,i,s);return}if(!D(t,n)){e(t,i),_(o,O(o,e),n,i,r,s);return}n.el=t.el,n.anchor=t.anchor;let{shapeFlag:a}=n;if(m(n)){Z(o,e,t,n,i,r,s);return}if(h(n)){n.children!==t.children&&(n.el.nodeValue=n.children);return}if(g(n)){n.children!==t.children&&(n.el.nodeValue=n.children);return}if(a&1){J(o,e,t,n,s);return}if(a&6){ee(t,n,s);return}}function O(o,e){return(t,n,i,r,s)=>{V(o,e,t,n,i,r,s)}}function J(o,e,t,n,i=null){let r=n.el=t.el,s=t.props||{},a=n.props||{},{patchFlag:d,dynamicProps:p}=n;if(d&&d>0){if(d&1&&t.children!==n.children&&(r.textContent=n.children),d&2&&s.class!==a.class&&o.setClass(r,a.class),d&4&&s.style!==a.style&&o.setStyle(r,a.style||{}),d&8&&p)for(let c=0;c<p.length;c++){let f=p[c],l=s[f],w=a[f];w!==l&&b(o,r,f,w,l)}d&16&&S(o,r,s,a)}else S(o,r,s,a);(!d||!(d&1))&&P(o,e,t,n,r,null,i)}function P(o,e,t,n,i,r,s){let a=t.shapeFlag,d=n.shapeFlag,p=t.children,c=n.children;if(d&8){a&16&&T(e,p),p!==c&&(i.textContent=c);return}if(d&16){a&16?Q(o,e,p,c,i,r,s):(a&8&&(i.textContent=""),v(O(o,e),c,i,r,s));return}c==null&&(a&8?i.textContent="":a&16&&T(e,p))}function Q(o,e,t,n,i,r,s){n.every(d=>d.key!==null&&d.key!==void 0)&&t.every(d=>d.key!==null&&d.key!==void 0)?(0,x.patchKeyedChildren)(t,n,i,r,s,null,!1):(0,x.patchUnkeyedChildren)(t,n,i,r,s,null,!1)}function Z(o,e,t,n,i,r,s){let a=t.children,d=n.children;Array.isArray(d)&&d.length>0?(P(o,e,t,n,i,r,s),n.el=d[0].el,n.anchor=d[d.length-1].el?o.nextSibling(d[d.length-1].el):r):Array.isArray(a)&&a.length>0&&d===null?(T(e,a),n.el=t.el,n.anchor=t.anchor):(n.el=t.el,n.anchor=t.anchor)}function k(o,e,t,n,i,r){let s=t.dynamicChildren,a=n.dynamicChildren;for(let d=0;d<a.length;d++)V(o,e,s[d],a[d],i,null,r)}function ee(o,e,t){e.component=o.component,e.el=o.el,e.component&&e.component.update&&e.component.update()}function U(o){function e(i,r){M(o,e,i,r)}(0,W.registerDOMOperations)({insert(i,r,s){o.insert(r,i,s)},createElement(i){return o.createElement(i)},createText(i){return o.createText(i)},setText(i,r){i.nodeValue=r},setElementText(i,r){i.textContent=r},remove(i){o.remove(i)},createComment(i){return o.createComment(i)},mount(i,r,s,a,d,p,c){n(null,i,r,s,a)},patch(i,r,s,a,d,p,c,f){n(i,r,s,a,d)},unmount(i,r,s,a){e(i)},move(i,r,s){o.insert(r,i.el,s)}});function n(i,r,s,a,d){V(o,e,i,r,s,a,d)}return{mount(i,r){r.nodeType===1&&(r.textContent=""),n(null,i,r,null,null)},patch(i,r,s){var a;n(i,r,s||((a=i.el)==null?void 0:a.parentNode),null,null)},unmount(i,r){e(i,r)}}}var te={div:"View",span:"Text",p:"Text",h1:"Text",h2:"Text",h3:"Text",h4:"Text",h5:"Text",h6:"Text",img:"Image",input:"TextInput",textarea:"TextInput",button:"TouchableOpacity",scroll:"ScrollView",list:"FlatList",a:"TouchableOpacity",ul:"View",ol:"View",li:"View",form:"View",header:"View",footer:"View",nav:"View",main:"View",section:"View",article:"View",aside:"View"},ne={flexDirection:"flexDirection",justifyContent:"justifyContent",alignItems:"alignItems",alignSelf:"alignSelf",flexWrap:"flexWrap",flex:"flex",flexGrow:"flexGrow",flexShrink:"flexShrink",flexBasis:"flexBasis",backgroundColor:"backgroundColor",color:"color",fontSize:"fontSize",fontWeight:"fontWeight",fontStyle:"fontStyle",textAlign:"textAlign",lineHeight:"lineHeight",letterSpacing:"letterSpacing",padding:"padding",paddingTop:"paddingTop",paddingBottom:"paddingBottom",paddingLeft:"paddingLeft",paddingRight:"paddingRight",paddingHorizontal:"paddingHorizontal",paddingVertical:"paddingVertical",margin:"margin",marginTop:"marginTop",marginBottom:"marginBottom",marginLeft:"marginLeft",marginRight:"marginRight",marginHorizontal:"marginHorizontal",marginVertical:"marginVertical",width:"width",height:"height",minWidth:"minWidth",maxWidth:"maxWidth",minHeight:"minHeight",maxHeight:"maxHeight",borderRadius:"borderRadius",borderWidth:"borderWidth",borderColor:"borderColor",overflow:"overflow",opacity:"opacity",position:"position",top:"top",left:"left",right:"right",bottom:"bottom",zIndex:"zIndex",shadowColor:"shadowColor",shadowOffset:"shadowOffset",shadowOpacity:"shadowOpacity",shadowRadius:"shadowRadius"},ie={click:"onPress",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",change:"onChange",input:"onChangeText",focus:"onFocus",blur:"onBlur",submit:"onSubmitEditing",scroll:"onScroll",longpress:"onLongPress"},oe=0;function I(){return`native_${++oe}`}var u=class{createElement(e){return{type:this.getComponentType(e),props:{},children:[],nativeId:I()}}createText(e){return{type:"RawText",props:{text:e},children:[],nativeId:I()}}createComment(e){return{type:"__Comment",props:{text:e},children:[],nativeId:I()}}setAttribute(e,t,n){if(e){if(t==="style"&&typeof n=="object"&&n!==null){e.props.style={...e.props.style,...this.mapStyle(n)};return}if(t==="className"||t==="class"){e.props.className=n;return}if(t.startsWith("on")&&typeof n=="function"){let i=t.slice(2).toLowerCase(),r=this.mapEvent(i);e.props[r]=n;return}if(t==="src"&&e.type==="Image"){e.props.source={uri:n};return}if(t==="href"){e.props.href=n;return}if(t==="placeholder"){e.props.placeholder=n;return}e.props[t]=n}}removeAttribute(e,t){if(e)if(t==="style")delete e.props.style;else if(t.startsWith("on")){let n=t.slice(2).toLowerCase(),i=this.mapEvent(n);delete e.props[i]}else delete e.props[t]}setStyle(e,t){if(!e)return;let n=this.mapStyle(t);e.props.style={...e.props.style,...n}}setClass(e,t){if(e){if(typeof t=="string")e.props.className=t;else if(typeof t=="object"&&t!==null){let n=[];for(let[i,r]of Object.entries(t))r&&n.push(i);e.props.className=n.join(" ")}}}insert(e,t,n){if(!(!e||!t)){if(t._parent){let i=t._parent,r=i.children.indexOf(t);r!==-1&&i.children.splice(r,1)}if(t._parent=e,n){let i=e.children.indexOf(n);i!==-1?e.children.splice(i,0,t):e.children.push(t)}else e.children.push(t)}}remove(e){if(!e||!e._parent)return;let t=e._parent,n=t.children.indexOf(e);n!==-1&&t.children.splice(n,1),e._parent=void 0}replace(e,t,n){if(!e||!t||!n)return;let i=e.children.indexOf(t);i!==-1&&(t._parent=void 0,n._parent=e,e.children[i]=n)}addEventListener(e,t,n,i){if(!e)return;let r=this.mapEvent(t);e.props[r]=n}removeEventListener(e,t,n){if(!e)return;let i=this.mapEvent(t);e.props[i]===n&&delete e.props[i]}nextTick(e){Promise.resolve().then(()=>e())}parentNode(e){var t;return(t=e==null?void 0:e._parent)!=null?t:null}nextSibling(e){if(!e||!e._parent)return null;let t=e._parent.children,n=t.indexOf(e);return n!==-1&&n+1<t.length?t[n+1]:null}setText(e,t){e&&e.type==="RawText"&&(e.props.text=t)}patchProp(e,t,n,i){if(e){if(i==null){this.removeAttribute(e,t);return}if(t==="style")this.setStyle(e,i);else if(t==="class"||t==="className")this.setClass(e,i);else if(t.startsWith("on")&&typeof i=="function"){let r=t.slice(2).toLowerCase(),s=this.mapEvent(r);e.props[s]=i}else this.setAttribute(e,t,i)}}querySelector(e){return null}renderToNativeTree(e){if(!e)return this.createComment("empty vnode");if(typeof e=="string")return this.createText(e);if(e.type===Symbol.for("lyt.comment")||e.type==="comment")return this.createComment(e.children||"");if(e.type===Symbol.for("lyt.text")||e.type==="text")return this.createText(e.children||"");if(e.type===Symbol.for("lyt.fragment")||e.type==="fragment"){let t=this.createElement("__Fragment");if(Array.isArray(e.children))for(let n of e.children){let i=this.renderToNativeTree(n);this.insert(t,i)}return t}if(typeof e.type=="string"){let t=this.createElement(e.type);if(e.props)for(let[n,i]of Object.entries(e.props))n==="key"||n==="ref"||this.setAttribute(t,n,i);if(e.children){if(typeof e.children=="string")this.insert(t,this.createText(e.children));else if(Array.isArray(e.children))for(let n of e.children)this.insert(t,this.renderToNativeTree(n))}return t}if(typeof e.type=="object"||typeof e.type=="function"){let t=this.createElement("div");if(Array.isArray(e.children))for(let n of e.children)this.insert(t,this.renderToNativeTree(n));return t}return this.createComment("unknown vnode type")}serializeToJSON(e){let t=n=>{let i={type:n.type,props:{...n.props},children:n.children.map(t)};return n.nativeId&&(i.nativeId=n.nativeId),i};return JSON.stringify(t(e),null,2)}getComponentType(e){return te[e]||re(e)}mapStyle(e){let t={};for(let[n,i]of Object.entries(e)){let r=ne[n]||n;typeof i=="string"&&/^\d+px$/.test(i)?t[r]=parseInt(i,10):t[r]=i}return t}mapEvent(e){return ie[e]||`on${e.charAt(0).toUpperCase()}${e.slice(1)}`}};function re(o){return o.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}var j=new u;
|
package/dist/native.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{registerDOMOperations as X}from"@lytjs/vdom";var m=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(m||{}),x=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(x||{}),S=Symbol("Fragment"),_=Symbol("Text"),O=Symbol("Comment");function y(r){return r.type===S}function u(r){return r.type===_}function N(r){return r.type===O}function I(r,e){return r.type===e.type&&r.key===e.key}function V(r){return Array.isArray(r.dynamicChildren)}function w(r,e,t,n){if(t==="class")r.setClass(e,n);else if(t==="style")r.setStyle(e,n);else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r.addEventListener(e,i,n)}else t==="key"||t==="ref"||r.setAttribute(e,t,n)}function C(r,e,t,n,i){if(t==="class")r.setClass(e,n);else if(t==="style")r.setStyle(e,n||{});else if(t.startsWith("on")||t.startsWith("@")){let o=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();i&&r.removeEventListener(e,o,i),n&&r.addEventListener(e,o,n)}else r.setAttribute(e,t,n)}function E(r,e,t,n){for(let i in n){if(i==="key"||i==="ref")continue;let o=t[i],s=n[i];s!==o&&C(r,e,i,s,o)}for(let i in t)if(!(i==="key"||i==="ref")&&!(i in n))if(i==="class")r.setClass(e,"");else if(i==="style")r.setStyle(e,{});else if(i.startsWith("on")||i.startsWith("@")){let o=i.startsWith("@")?i.slice(1).toLowerCase():i.slice(2).toLowerCase();r.removeEventListener(e,o,t[i])}else r.removeAttribute(e,i)}function R(r,e,t,n,i,o){let{shapeFlag:s}=t;if(y(t)){P(r,e,t,n,i,o);return}if(u(t)){let a=r.createText(t.children);t.el=a,r.insert(n,a,i);return}if(N(t)){let a=r.createComment(t.children);t.el=a,r.insert(n,a,i);return}if(s&1){M(r,e,t,n,i,o);return}if(s&6){W(e,t,n,i,o);return}}function M(r,e,t,n,i,o){let s=t.type,a=r.createElement(s);if(t.el=a,t.props)for(let c in t.props){let f=t.props[c];w(r,a,c,f)}let{shapeFlag:d,children:p}=t;d&8?a.textContent=p:d&16&&h(e,p,a,null,o),r.insert(n,a,i)}function h(r,e,t,n,i){for(let o=0;o<e.length;o++)r(null,e[o],t,n,i)}function P(r,e,t,n,i,o){let{children:s}=t,a=r.createComment("");r.insert(n,a,i),Array.isArray(s)&&s.length>0&&h(e,s,n,a,o),t.el=a,t.anchor=a}function W(r,e,t,n,i){let o=e.component;o&&o.update&&o.update(),o&&o.subTree&&(r(null,o.subTree,t,n,o),e.el=o.subTree.el)}function D(r,e,t,n){let{shapeFlag:i,children:o}=t;if(y(t)){if(Array.isArray(o))for(let s=0;s<o.length;s++)e(o[s],n);t.anchor&&t.anchor.parentNode&&r.remove(t.anchor);return}if(i&6){t.component&&t.component.subTree&&e(t.component.subTree,n);return}t.el&&r.remove(t.el)}function g(r,e){for(let t=0;t<e.length;t++)r(e[t])}import{patchKeyedChildren as U,patchUnkeyedChildren as j}from"@lytjs/vdom";function v(r,e,t,n,i,o=null,s=null){if(n==null){t&&e(t,i);return}if(t===null){R(r,L(r,e),n,i,o,s);return}if(V(n)&&V(t)){F(r,e,t,n,i,s);return}if(!I(t,n)){e(t,i),R(r,L(r,e),n,i,o,s);return}n.el=t.el,n.anchor=t.anchor;let{shapeFlag:a}=n;if(y(n)){z(r,e,t,n,i,o,s);return}if(u(n)){n.children!==t.children&&(n.el.nodeValue=n.children);return}if(N(n)){n.children!==t.children&&(n.el.nodeValue=n.children);return}if(a&1){B(r,e,t,n,s);return}if(a&6){K(t,n,s);return}}function L(r,e){return(t,n,i,o,s)=>{v(r,e,t,n,i,o,s)}}function B(r,e,t,n,i=null){let o=n.el=t.el,s=t.props||{},a=n.props||{},{patchFlag:d,dynamicProps:p}=n;if(d&&d>0){if(d&1&&t.children!==n.children&&(o.textContent=n.children),d&2&&s.class!==a.class&&r.setClass(o,a.class),d&4&&s.style!==a.style&&r.setStyle(o,a.style||{}),d&8&&p)for(let c=0;c<p.length;c++){let f=p[c],l=s[f],b=a[f];b!==l&&C(r,o,f,b,l)}d&16&&E(r,o,s,a)}else E(r,o,s,a);(!d||!(d&1))&&H(r,e,t,n,o,null,i)}function H(r,e,t,n,i,o,s){let a=t.shapeFlag,d=n.shapeFlag,p=t.children,c=n.children;if(d&8){a&16&&g(e,p),p!==c&&(i.textContent=c);return}if(d&16){a&16?Y(r,e,p,c,i,o,s):(a&8&&(i.textContent=""),h(L(r,e),c,i,o,s));return}c==null&&(a&8?i.textContent="":a&16&&g(e,p))}function Y(r,e,t,n,i,o,s){n.every(d=>d.key!==null&&d.key!==void 0)&&t.every(d=>d.key!==null&&d.key!==void 0)?U(t,n,i,o,s,null,!1):j(t,n,i,o,s,null,!1)}function z(r,e,t,n,i,o,s){let a=t.children,d=n.children;Array.isArray(d)&&d.length>0?(H(r,e,t,n,i,o,s),n.el=d[0].el,n.anchor=d[d.length-1].el?r.nextSibling(d[d.length-1].el):o):Array.isArray(a)&&a.length>0&&d===null?(g(e,a),n.el=t.el,n.anchor=t.anchor):(n.el=t.el,n.anchor=t.anchor)}function F(r,e,t,n,i,o){let s=t.dynamicChildren,a=n.dynamicChildren;for(let d=0;d<a.length;d++)v(r,e,s[d],a[d],i,null,o)}function K(r,e,t){e.component=r.component,e.el=r.el,e.component&&e.component.update&&e.component.update()}function G(r){function e(i,o){D(r,e,i,o)}X({insert(i,o,s){r.insert(o,i,s)},createElement(i){return r.createElement(i)},createText(i){return r.createText(i)},setText(i,o){i.nodeValue=o},setElementText(i,o){i.textContent=o},remove(i){r.remove(i)},createComment(i){return r.createComment(i)},mount(i,o,s,a,d,p,c){n(null,i,o,s,a)},patch(i,o,s,a,d,p,c,f){n(i,o,s,a,d)},unmount(i,o,s,a){e(i)},move(i,o,s){r.insert(o,i.el,s)}});function n(i,o,s,a,d){v(r,e,i,o,s,a,d)}return{mount(i,o){o.nodeType===1&&(o.textContent=""),n(null,i,o,null,null)},patch(i,o,s){var a;n(i,o,s||((a=i.el)==null?void 0:a.parentNode),null,null)},unmount(i,o){e(i,o)}}}var $={div:"View",span:"Text",p:"Text",h1:"Text",h2:"Text",h3:"Text",h4:"Text",h5:"Text",h6:"Text",img:"Image",input:"TextInput",textarea:"TextInput",button:"TouchableOpacity",scroll:"ScrollView",list:"FlatList",a:"TouchableOpacity",ul:"View",ol:"View",li:"View",form:"View",header:"View",footer:"View",nav:"View",main:"View",section:"View",article:"View",aside:"View"},q={flexDirection:"flexDirection",justifyContent:"justifyContent",alignItems:"alignItems",alignSelf:"alignSelf",flexWrap:"flexWrap",flex:"flex",flexGrow:"flexGrow",flexShrink:"flexShrink",flexBasis:"flexBasis",backgroundColor:"backgroundColor",color:"color",fontSize:"fontSize",fontWeight:"fontWeight",fontStyle:"fontStyle",textAlign:"textAlign",lineHeight:"lineHeight",letterSpacing:"letterSpacing",padding:"padding",paddingTop:"paddingTop",paddingBottom:"paddingBottom",paddingLeft:"paddingLeft",paddingRight:"paddingRight",paddingHorizontal:"paddingHorizontal",paddingVertical:"paddingVertical",margin:"margin",marginTop:"marginTop",marginBottom:"marginBottom",marginLeft:"marginLeft",marginRight:"marginRight",marginHorizontal:"marginHorizontal",marginVertical:"marginVertical",width:"width",height:"height",minWidth:"minWidth",maxWidth:"maxWidth",minHeight:"minHeight",maxHeight:"maxHeight",borderRadius:"borderRadius",borderWidth:"borderWidth",borderColor:"borderColor",overflow:"overflow",opacity:"opacity",position:"position",top:"top",left:"left",right:"right",bottom:"bottom",zIndex:"zIndex",shadowColor:"shadowColor",shadowOffset:"shadowOffset",shadowOpacity:"shadowOpacity",shadowRadius:"shadowRadius"},J={click:"onPress",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",change:"onChange",input:"onChangeText",focus:"onFocus",blur:"onBlur",submit:"onSubmitEditing",scroll:"onScroll",longpress:"onLongPress"},Q=0;function A(){return`native_${++Q}`}var T=class{createElement(e){return{type:this.getComponentType(e),props:{},children:[],nativeId:A()}}createText(e){return{type:"RawText",props:{text:e},children:[],nativeId:A()}}createComment(e){return{type:"__Comment",props:{text:e},children:[],nativeId:A()}}setAttribute(e,t,n){if(e){if(t==="style"&&typeof n=="object"&&n!==null){e.props.style={...e.props.style,...this.mapStyle(n)};return}if(t==="className"||t==="class"){e.props.className=n;return}if(t.startsWith("on")&&typeof n=="function"){let i=t.slice(2).toLowerCase(),o=this.mapEvent(i);e.props[o]=n;return}if(t==="src"&&e.type==="Image"){e.props.source={uri:n};return}if(t==="href"){e.props.href=n;return}if(t==="placeholder"){e.props.placeholder=n;return}e.props[t]=n}}removeAttribute(e,t){if(e)if(t==="style")delete e.props.style;else if(t.startsWith("on")){let n=t.slice(2).toLowerCase(),i=this.mapEvent(n);delete e.props[i]}else delete e.props[t]}setStyle(e,t){if(!e)return;let n=this.mapStyle(t);e.props.style={...e.props.style,...n}}setClass(e,t){if(e){if(typeof t=="string")e.props.className=t;else if(typeof t=="object"&&t!==null){let n=[];for(let[i,o]of Object.entries(t))o&&n.push(i);e.props.className=n.join(" ")}}}insert(e,t,n){if(!(!e||!t)){if(t._parent){let i=t._parent,o=i.children.indexOf(t);o!==-1&&i.children.splice(o,1)}if(t._parent=e,n){let i=e.children.indexOf(n);i!==-1?e.children.splice(i,0,t):e.children.push(t)}else e.children.push(t)}}remove(e){if(!e||!e._parent)return;let t=e._parent,n=t.children.indexOf(e);n!==-1&&t.children.splice(n,1),e._parent=void 0}replace(e,t,n){if(!e||!t||!n)return;let i=e.children.indexOf(t);i!==-1&&(t._parent=void 0,n._parent=e,e.children[i]=n)}addEventListener(e,t,n,i){if(!e)return;let o=this.mapEvent(t);e.props[o]=n}removeEventListener(e,t,n){if(!e)return;let i=this.mapEvent(t);e.props[i]===n&&delete e.props[i]}nextTick(e){Promise.resolve().then(()=>e())}parentNode(e){var t;return(t=e==null?void 0:e._parent)!=null?t:null}nextSibling(e){if(!e||!e._parent)return null;let t=e._parent.children,n=t.indexOf(e);return n!==-1&&n+1<t.length?t[n+1]:null}setText(e,t){e&&e.type==="RawText"&&(e.props.text=t)}patchProp(e,t,n,i){if(e){if(i==null){this.removeAttribute(e,t);return}if(t==="style")this.setStyle(e,i);else if(t==="class"||t==="className")this.setClass(e,i);else if(t.startsWith("on")&&typeof i=="function"){let o=t.slice(2).toLowerCase(),s=this.mapEvent(o);e.props[s]=i}else this.setAttribute(e,t,i)}}querySelector(e){let t=e.replace(/[.#\[\]]/g,"").trim();return null}renderToNativeTree(e){if(!e)return this.createComment("empty vnode");if(typeof e=="string")return this.createText(e);if(e.type===Symbol.for("lyt.comment")||e.type==="comment")return this.createComment(e.children||"");if(e.type===Symbol.for("lyt.text")||e.type==="text")return this.createText(e.children||"");if(e.type===Symbol.for("lyt.fragment")||e.type==="fragment"){let t=this.createElement("__Fragment");if(Array.isArray(e.children))for(let n of e.children){let i=this.renderToNativeTree(n);this.insert(t,i)}return t}if(typeof e.type=="string"){let t=this.createElement(e.type);if(e.props)for(let[n,i]of Object.entries(e.props))n==="key"||n==="ref"||this.setAttribute(t,n,i);if(e.children){if(typeof e.children=="string")this.insert(t,this.createText(e.children));else if(Array.isArray(e.children))for(let n of e.children)this.insert(t,this.renderToNativeTree(n))}return t}if(typeof e.type=="object"||typeof e.type=="function"){let t=this.createElement("div");if(Array.isArray(e.children))for(let n of e.children)this.insert(t,this.renderToNativeTree(n));return t}return this.createComment("unknown vnode type")}serializeToJSON(e){let t=n=>{let i={type:n.type,props:{...n.props},children:n.children.map(t)};return n.nativeId&&(i.nativeId=n.nativeId),i};return JSON.stringify(t(e),null,2)}getComponentType(e){return $[e]||Z(e)}mapStyle(e){let t={};for(let[n,i]of Object.entries(e)){let o=q[n]||n;typeof i=="string"&&/^\d+px$/.test(i)?t[o]=parseInt(i,10):t[o]=i}return t}mapEvent(e){return J[e]||`on${e.charAt(0).toUpperCase()}${e.slice(1)}`}};function Z(r){return r.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}var k=new T;export{O as Comment,S as Fragment,T as NativeRenderer,x as PatchFlags,m as ShapeFlags,_ as Text,G as createRenderer,k as nativeRenderer};
|
|
1
|
+
import{registerDOMOperations as X}from"@lytjs/vdom";var m=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(m||{}),x=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.STABLE_FRAGMENT=32]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=64]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=128]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=256]="NEED_PATCH",l[l.DYNAMIC_SLOTS=512]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(x||{}),S=Symbol("Fragment"),_=Symbol("Text"),O=Symbol("Comment");function y(r){return r.type===S}function u(r){return r.type===_}function N(r){return r.type===O}function I(r,e){return r.type===e.type&&r.key===e.key}function V(r){return Array.isArray(r.dynamicChildren)}function w(r,e,t,n){if(t==="class")r.setClass(e,n);else if(t==="style")r.setStyle(e,n);else if(t.startsWith("on")||t.startsWith("@")){let i=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();r.addEventListener(e,i,n)}else t==="key"||t==="ref"||r.setAttribute(e,t,n)}function C(r,e,t,n,i){if(t==="class")r.setClass(e,n);else if(t==="style")r.setStyle(e,n||{});else if(t.startsWith("on")||t.startsWith("@")){let o=t.startsWith("@")?t.slice(1).toLowerCase():t.slice(2).toLowerCase();i&&r.removeEventListener(e,o,i),n&&r.addEventListener(e,o,n)}else r.setAttribute(e,t,n)}function E(r,e,t,n){for(let i in n){if(i==="key"||i==="ref")continue;let o=t[i],s=n[i];s!==o&&C(r,e,i,s,o)}for(let i in t)if(!(i==="key"||i==="ref")&&!(i in n))if(i==="class")r.setClass(e,"");else if(i==="style")r.setStyle(e,{});else if(i.startsWith("on")||i.startsWith("@")){let o=i.startsWith("@")?i.slice(1).toLowerCase():i.slice(2).toLowerCase();r.removeEventListener(e,o,t[i])}else r.removeAttribute(e,i)}function R(r,e,t,n,i,o){let{shapeFlag:s}=t;if(y(t)){P(r,e,t,n,i,o);return}if(u(t)){let a=r.createText(t.children);t.el=a,r.insert(n,a,i);return}if(N(t)){let a=r.createComment(t.children);t.el=a,r.insert(n,a,i);return}if(s&1){M(r,e,t,n,i,o);return}if(s&6){W(e,t,n,i,o);return}}function M(r,e,t,n,i,o){let s=t.type,a=r.createElement(s);if(t.el=a,t.props)for(let c in t.props){let f=t.props[c];w(r,a,c,f)}let{shapeFlag:d,children:p}=t;d&8?a.textContent=p:d&16&&h(e,p,a,null,o),r.insert(n,a,i)}function h(r,e,t,n,i){for(let o=0;o<e.length;o++)r(null,e[o],t,n,i)}function P(r,e,t,n,i,o){let{children:s}=t,a=r.createComment("");r.insert(n,a,i),Array.isArray(s)&&s.length>0&&h(e,s,n,a,o),t.el=a,t.anchor=a}function W(r,e,t,n,i){let o=e.component;o&&o.update&&o.update(),o&&o.subTree&&(r(null,o.subTree,t,n,o),e.el=o.subTree.el)}function D(r,e,t,n){let{shapeFlag:i,children:o}=t;if(y(t)){if(Array.isArray(o))for(let s=0;s<o.length;s++)e(o[s],n);t.anchor&&t.anchor.parentNode&&r.remove(t.anchor);return}if(i&6){t.component&&t.component.subTree&&e(t.component.subTree,n);return}t.el&&r.remove(t.el)}function g(r,e){for(let t=0;t<e.length;t++)r(e[t])}import{patchKeyedChildren as U,patchUnkeyedChildren as j}from"@lytjs/vdom";function v(r,e,t,n,i,o=null,s=null){if(n==null){t&&e(t,i);return}if(t===null){R(r,L(r,e),n,i,o,s);return}if(V(n)&&V(t)){F(r,e,t,n,i,s);return}if(!I(t,n)){e(t,i),R(r,L(r,e),n,i,o,s);return}n.el=t.el,n.anchor=t.anchor;let{shapeFlag:a}=n;if(y(n)){z(r,e,t,n,i,o,s);return}if(u(n)){n.children!==t.children&&(n.el.nodeValue=n.children);return}if(N(n)){n.children!==t.children&&(n.el.nodeValue=n.children);return}if(a&1){B(r,e,t,n,s);return}if(a&6){K(t,n,s);return}}function L(r,e){return(t,n,i,o,s)=>{v(r,e,t,n,i,o,s)}}function B(r,e,t,n,i=null){let o=n.el=t.el,s=t.props||{},a=n.props||{},{patchFlag:d,dynamicProps:p}=n;if(d&&d>0){if(d&1&&t.children!==n.children&&(o.textContent=n.children),d&2&&s.class!==a.class&&r.setClass(o,a.class),d&4&&s.style!==a.style&&r.setStyle(o,a.style||{}),d&8&&p)for(let c=0;c<p.length;c++){let f=p[c],l=s[f],b=a[f];b!==l&&C(r,o,f,b,l)}d&16&&E(r,o,s,a)}else E(r,o,s,a);(!d||!(d&1))&&H(r,e,t,n,o,null,i)}function H(r,e,t,n,i,o,s){let a=t.shapeFlag,d=n.shapeFlag,p=t.children,c=n.children;if(d&8){a&16&&g(e,p),p!==c&&(i.textContent=c);return}if(d&16){a&16?Y(r,e,p,c,i,o,s):(a&8&&(i.textContent=""),h(L(r,e),c,i,o,s));return}c==null&&(a&8?i.textContent="":a&16&&g(e,p))}function Y(r,e,t,n,i,o,s){n.every(d=>d.key!==null&&d.key!==void 0)&&t.every(d=>d.key!==null&&d.key!==void 0)?U(t,n,i,o,s,null,!1):j(t,n,i,o,s,null,!1)}function z(r,e,t,n,i,o,s){let a=t.children,d=n.children;Array.isArray(d)&&d.length>0?(H(r,e,t,n,i,o,s),n.el=d[0].el,n.anchor=d[d.length-1].el?r.nextSibling(d[d.length-1].el):o):Array.isArray(a)&&a.length>0&&d===null?(g(e,a),n.el=t.el,n.anchor=t.anchor):(n.el=t.el,n.anchor=t.anchor)}function F(r,e,t,n,i,o){let s=t.dynamicChildren,a=n.dynamicChildren;for(let d=0;d<a.length;d++)v(r,e,s[d],a[d],i,null,o)}function K(r,e,t){e.component=r.component,e.el=r.el,e.component&&e.component.update&&e.component.update()}function G(r){function e(i,o){D(r,e,i,o)}X({insert(i,o,s){r.insert(o,i,s)},createElement(i){return r.createElement(i)},createText(i){return r.createText(i)},setText(i,o){i.nodeValue=o},setElementText(i,o){i.textContent=o},remove(i){r.remove(i)},createComment(i){return r.createComment(i)},mount(i,o,s,a,d,p,c){n(null,i,o,s,a)},patch(i,o,s,a,d,p,c,f){n(i,o,s,a,d)},unmount(i,o,s,a){e(i)},move(i,o,s){r.insert(o,i.el,s)}});function n(i,o,s,a,d){v(r,e,i,o,s,a,d)}return{mount(i,o){o.nodeType===1&&(o.textContent=""),n(null,i,o,null,null)},patch(i,o,s){var a;n(i,o,s||((a=i.el)==null?void 0:a.parentNode),null,null)},unmount(i,o){e(i,o)}}}var $={div:"View",span:"Text",p:"Text",h1:"Text",h2:"Text",h3:"Text",h4:"Text",h5:"Text",h6:"Text",img:"Image",input:"TextInput",textarea:"TextInput",button:"TouchableOpacity",scroll:"ScrollView",list:"FlatList",a:"TouchableOpacity",ul:"View",ol:"View",li:"View",form:"View",header:"View",footer:"View",nav:"View",main:"View",section:"View",article:"View",aside:"View"},q={flexDirection:"flexDirection",justifyContent:"justifyContent",alignItems:"alignItems",alignSelf:"alignSelf",flexWrap:"flexWrap",flex:"flex",flexGrow:"flexGrow",flexShrink:"flexShrink",flexBasis:"flexBasis",backgroundColor:"backgroundColor",color:"color",fontSize:"fontSize",fontWeight:"fontWeight",fontStyle:"fontStyle",textAlign:"textAlign",lineHeight:"lineHeight",letterSpacing:"letterSpacing",padding:"padding",paddingTop:"paddingTop",paddingBottom:"paddingBottom",paddingLeft:"paddingLeft",paddingRight:"paddingRight",paddingHorizontal:"paddingHorizontal",paddingVertical:"paddingVertical",margin:"margin",marginTop:"marginTop",marginBottom:"marginBottom",marginLeft:"marginLeft",marginRight:"marginRight",marginHorizontal:"marginHorizontal",marginVertical:"marginVertical",width:"width",height:"height",minWidth:"minWidth",maxWidth:"maxWidth",minHeight:"minHeight",maxHeight:"maxHeight",borderRadius:"borderRadius",borderWidth:"borderWidth",borderColor:"borderColor",overflow:"overflow",opacity:"opacity",position:"position",top:"top",left:"left",right:"right",bottom:"bottom",zIndex:"zIndex",shadowColor:"shadowColor",shadowOffset:"shadowOffset",shadowOpacity:"shadowOpacity",shadowRadius:"shadowRadius"},J={click:"onPress",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",change:"onChange",input:"onChangeText",focus:"onFocus",blur:"onBlur",submit:"onSubmitEditing",scroll:"onScroll",longpress:"onLongPress"},Q=0;function A(){return`native_${++Q}`}var T=class{createElement(e){return{type:this.getComponentType(e),props:{},children:[],nativeId:A()}}createText(e){return{type:"RawText",props:{text:e},children:[],nativeId:A()}}createComment(e){return{type:"__Comment",props:{text:e},children:[],nativeId:A()}}setAttribute(e,t,n){if(e){if(t==="style"&&typeof n=="object"&&n!==null){e.props.style={...e.props.style,...this.mapStyle(n)};return}if(t==="className"||t==="class"){e.props.className=n;return}if(t.startsWith("on")&&typeof n=="function"){let i=t.slice(2).toLowerCase(),o=this.mapEvent(i);e.props[o]=n;return}if(t==="src"&&e.type==="Image"){e.props.source={uri:n};return}if(t==="href"){e.props.href=n;return}if(t==="placeholder"){e.props.placeholder=n;return}e.props[t]=n}}removeAttribute(e,t){if(e)if(t==="style")delete e.props.style;else if(t.startsWith("on")){let n=t.slice(2).toLowerCase(),i=this.mapEvent(n);delete e.props[i]}else delete e.props[t]}setStyle(e,t){if(!e)return;let n=this.mapStyle(t);e.props.style={...e.props.style,...n}}setClass(e,t){if(e){if(typeof t=="string")e.props.className=t;else if(typeof t=="object"&&t!==null){let n=[];for(let[i,o]of Object.entries(t))o&&n.push(i);e.props.className=n.join(" ")}}}insert(e,t,n){if(!(!e||!t)){if(t._parent){let i=t._parent,o=i.children.indexOf(t);o!==-1&&i.children.splice(o,1)}if(t._parent=e,n){let i=e.children.indexOf(n);i!==-1?e.children.splice(i,0,t):e.children.push(t)}else e.children.push(t)}}remove(e){if(!e||!e._parent)return;let t=e._parent,n=t.children.indexOf(e);n!==-1&&t.children.splice(n,1),e._parent=void 0}replace(e,t,n){if(!e||!t||!n)return;let i=e.children.indexOf(t);i!==-1&&(t._parent=void 0,n._parent=e,e.children[i]=n)}addEventListener(e,t,n,i){if(!e)return;let o=this.mapEvent(t);e.props[o]=n}removeEventListener(e,t,n){if(!e)return;let i=this.mapEvent(t);e.props[i]===n&&delete e.props[i]}nextTick(e){Promise.resolve().then(()=>e())}parentNode(e){var t;return(t=e==null?void 0:e._parent)!=null?t:null}nextSibling(e){if(!e||!e._parent)return null;let t=e._parent.children,n=t.indexOf(e);return n!==-1&&n+1<t.length?t[n+1]:null}setText(e,t){e&&e.type==="RawText"&&(e.props.text=t)}patchProp(e,t,n,i){if(e){if(i==null){this.removeAttribute(e,t);return}if(t==="style")this.setStyle(e,i);else if(t==="class"||t==="className")this.setClass(e,i);else if(t.startsWith("on")&&typeof i=="function"){let o=t.slice(2).toLowerCase(),s=this.mapEvent(o);e.props[s]=i}else this.setAttribute(e,t,i)}}querySelector(e){return null}renderToNativeTree(e){if(!e)return this.createComment("empty vnode");if(typeof e=="string")return this.createText(e);if(e.type===Symbol.for("lyt.comment")||e.type==="comment")return this.createComment(e.children||"");if(e.type===Symbol.for("lyt.text")||e.type==="text")return this.createText(e.children||"");if(e.type===Symbol.for("lyt.fragment")||e.type==="fragment"){let t=this.createElement("__Fragment");if(Array.isArray(e.children))for(let n of e.children){let i=this.renderToNativeTree(n);this.insert(t,i)}return t}if(typeof e.type=="string"){let t=this.createElement(e.type);if(e.props)for(let[n,i]of Object.entries(e.props))n==="key"||n==="ref"||this.setAttribute(t,n,i);if(e.children){if(typeof e.children=="string")this.insert(t,this.createText(e.children));else if(Array.isArray(e.children))for(let n of e.children)this.insert(t,this.renderToNativeTree(n))}return t}if(typeof e.type=="object"||typeof e.type=="function"){let t=this.createElement("div");if(Array.isArray(e.children))for(let n of e.children)this.insert(t,this.renderToNativeTree(n));return t}return this.createComment("unknown vnode type")}serializeToJSON(e){let t=n=>{let i={type:n.type,props:{...n.props},children:n.children.map(t)};return n.nativeId&&(i.nativeId=n.nativeId),i};return JSON.stringify(t(e),null,2)}getComponentType(e){return $[e]||Z(e)}mapStyle(e){let t={};for(let[n,i]of Object.entries(e)){let o=q[n]||n;typeof i=="string"&&/^\d+px$/.test(i)?t[o]=parseInt(i,10):t[o]=i}return t}mapEvent(e){return J[e]||`on${e.charAt(0).toUpperCase()}${e.slice(1)}`}};function Z(r){return r.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}var k=new T;export{O as Comment,S as Fragment,T as NativeRenderer,x as PatchFlags,m as ShapeFlags,_ as Text,G as createRenderer,k as nativeRenderer};
|