@firsthandjs/dom 0.9.1 → 0.10.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/chunk-467WEPXM.js +1 -0
- package/dist/chunk-J5525WK6.js +1 -0
- package/dist/{chunk-6BRSYQCI.js → chunk-YX6HJXS6.js} +1 -1
- package/dist/{dev-chunk-6V32MCOI.js → dev-chunk-KJHYMOKB.js} +1 -1
- package/dist/{dev-chunk-MKONDKMD.js → dev-chunk-O5KFGWVZ.js} +87 -66
- package/dist/{dev-chunk-ADHDPKZW.js → dev-chunk-U46CIJCO.js} +221 -311
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.dev.js +28 -24
- package/dist/hydrate.js +1 -1
- package/dist/index.dev.js +3 -3
- package/dist/index.js +1 -1
- package/dist/insert.d.ts +41 -127
- package/dist/insert.d.ts.map +1 -1
- package/dist/internal.d.ts +5 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.dev.js +121 -11
- package/dist/internal.js +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/nodes.d.ts +36 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/props.d.ts.map +1 -1
- package/dist/reconcile.d.ts +30 -0
- package/dist/reconcile.d.ts.map +1 -0
- package/dist/store.d.ts +105 -0
- package/dist/store.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-E4GAI5XA.js +0 -1
- package/dist/chunk-P4PXTIUD.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function z(n,o,e){return n}var N={current:null};function K(n){let o=n.firstChild,e=N.current;return e===null?o:e.step(o)}function Q(n){let o=n.nextSibling,e=N.current;return e===null?o:e.step(o)}function m(n,o,e,t){let i=0,l=0,r=e.length-1,d=t.length-1;for(;i<=r&&l<=d&&e[i]===t[l];)i++,l++;for(;i<=r&&l<=d&&e[r]===t[d];)r--,d--;let u=d+1<t.length?t[d+1]:o;if(i>r){for(let s=l;s<=d;s++)n.insertBefore(t[s],u);return}if(l>d){for(let s=i;s<=r;s++)n.removeChild(e[s]);return}R(n,t,u,{a:e,aStart:i,aEnd:r,bStart:l,bEnd:d})}function R(n,o,e,t){let i=t.bEnd-t.bStart+1,l=k(n,o,t),r=P(l),d=r.length-1,u=e;for(let s=i-1;s>=0;s--){let a=o[t.bStart+s];d>=0&&r[d]===s?d--:n.insertBefore(a,u),u=a}}function k(n,o,e){let{a:t,aStart:i,aEnd:l,bStart:r,bEnd:d}=e,u=new Map;for(let f=i;f<=l;f++)u.set(t[f],f);let s=d-r+1,a=new Int32Array(s).fill(-1);for(let f=0;f<s;f++){let c=o[r+f],w=u.get(c);w!==void 0&&(a[f]=w,u.delete(c))}for(let f of u.keys())n.removeChild(f);return a}function P(n){let o=n.length,e=new Int32Array(o).fill(-1),t=[];for(let r=0;r<o;r++){let d=n[r];if(d===-1)continue;let u=0,s=t.length;for(;u<s;){let a=u+s>>1;n[t[a]]<d?u=a+1:s=a}u>0&&(e[r]=t[u-1]),t[u]=r}let i=[],l=t.length>0?t[t.length-1]:-1;for(;l!==-1;)i.push(l),l=e[l];return i.reverse()}import{bind as A,getOwner as _,onCleanup as j,runWithOwner as F}from"@firsthandjs/core";function g(n){return typeof n.nodeType=="number"}function S(n){let o=n.parentNode;o!==null&&o.removeChild(n)}function h(n,o,e){return o===null&&Array.isArray(e)&&e.length>1&&n.childNodes.length===e.length?(n.textContent="",null):p(e)}function p(n){if(n!==null)if(Array.isArray(n))for(let o=0;o<n.length;o++)S(n[o]);else S(n);return null}function x(n,o,e,t){return e===t?t:e!==null&&!Array.isArray(e)?(n.replaceChild(t,e),t):(p(e),n.insertBefore(t,o),t)}var C=0;function rn(n){C++;try{n()}finally{C--}}var E=Symbol("firsthand.part"),M=Symbol("firsthand.flat"),q=Symbol("firsthand.pending"),b=new WeakSet;function dn(n){return{[E]:!0,anchor:document.createTextNode(""),thunk:n,owner:_()}}function O(n){return E in n}function D(n,o,e=null,t){if(typeof o!="function"){y(n,e,null,o);return}let i=G(n,e,t?.seed),l=i===null?null:i.nodes,r=i?.text,d=i!==null,u=()=>{let a=o(),f=typeof a;if(f==="string"||f==="number"){let c=String(a);c!==r&&(r=c,l=y(n,e,l,c));return}if(r=void 0,f==="function"){l=d?null:p(l),D(n,a,e,{seed:d?i:null});return}l=y(n,e,l,a)},s=t?.report;H(i,s===void 0?u:()=>{u(),s(B(l,e))}),d=!1,j(()=>{l=C>0?null:p(l)})}function B(n,o){let e=n===null?[]:Array.isArray(n)?[...n]:[n];return e.push(o),e}function G(n,o,e){return e!==void 0?e:N.current===null?null:N.current.claim(n,o)}function H(n,o){if(n===null){A(o);return}N.current.within(n.region,()=>{A(o)})}function y(n,o,e,t){let i=typeof t;if(t==null||i==="boolean")return h(n,o,e);if(i==="string"||i==="number"){let l=String(t);return e!==null&&!Array.isArray(e)&&e.nodeType===3?(e.data=l,e):x(n,o,e,document.createTextNode(l))}return L(n,o,e,t)}function L(n,o,e,t){return typeof t=="function"?y(n,o,e,t()):Array.isArray(t)?T(n,o,e,t):O(t)?T(n,o,e,[t]):g(t)?x(n,o,e,t):y(n,o,e,String(t))}function v(n){return n===null?[]:Array.isArray(n)?n:[n]}function T(n,o,e,t){if(M in t){let r=t;return r.length===0?h(n,o,e):(m(n,o,v(e),r),t[q]?.(n),r)}let i=[],l=[];if(I(t,i,l),i.length===0)return h(n,o,e);m(n,o,v(e),i);for(let r=0;r<l.length;r++)X(l[r],n);return i}function X(n,o,e){b.has(n)||(b.add(n),F(n.owner??_(),()=>{D(o,n.thunk,n.anchor,e===void 0?void 0:{report:e}),j(()=>{b.delete(n)})}))}function I(n,o,e){for(let t=0;t<n.length;t++){let i=n[t];if(typeof i=="object"&&i!==null&&O(i)){o.push(i.anchor),e.push(i);continue}for(;typeof i=="function";)i=i();i==null||typeof i=="boolean"||(Array.isArray(i)?I(i,o,e):typeof i=="object"&&g(i)?o.push(i):o.push(document.createTextNode(String(i))))}}export{z as a,N as b,K as c,Q as d,m as e,rn as f,M as g,q as h,dn as i,O as j,D as k,y as l,X as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as E,f as P,g as x,h as T,i as f,j as v,l as O,m as $}from"./chunk-467WEPXM.js";var g=null,y=new WeakMap;function vn(n){g=n,y=new WeakMap}var h=class extends Error{constructor(e){super(`${e} is not a Firsthand component. If it is a React component, import '@firsthandjs/react/auto' once at startup to render React components directly, or wrap it with fromReact(). Otherwise, declare it with component().`),this.name="FirsthandComponentError"}};function A(n){let e=y.get(n);if(e!==void 0)return e;if(g===null){let o=typeof n=="function"&&n.name!==""?n.name:"The value";throw new h(o)}let t=g(n);return y.set(n,t),t}import{signal as tn,createOwner as N,devEnterSetup as S,devExitSetup as p,disposeOwner as on,getOwner as j,handleError as L,setOwner as a,untrack as H}from"@firsthandjs/core";var M=Symbol.for("firsthand.component"),D=Symbol.for("firsthand.view"),rn=0,V="firsthand";function Hn(n){V=n}function Mn(n,e,t,o){let s=Object.assign(i=>sn(s,i),{[M]:!0,setup:n,options:e,id:t??`c${String(++rn)}`,tag:void 0});return Object.defineProperty(s,"name",{configurable:!0,value:o??(n.name===""?"Component":n.name)}),t===void 0&&(`${s.name}`,void 0),(e?.tag!==void 0||e?.shadow===!0)&&un(s,typeof e.tag=="string"?e.tag:void 0),s}function Dn(n){return typeof n=="function"&&M in n}function Vn(n){return n[D]=!0,n}function sn(n,e){if(Object.freeze(e),n.setup===void 0)return D in n?f(()=>n(e)):A(n)(e);if(n.tag!==void 0)return an(n,e);let t=N(j());n.name;let o=a(t);try{S(n.id);let r=H(()=>n.setup(e));return p(),a(o),r}catch(r){return p(),a(o),L(r,t),null}}function dn(n){let e=n.name.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9-]/g,"-").toLowerCase();return`${V}-${e}`}function un(n,e){let t=n;if(t.tag!==void 0)return t.tag;let o=e??dn(t);return customElements.get(o)!==void 0&&(o=`${o}-${t.id.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}`),t.tag=o,customElements.define(o,cn(t)),o}function cn(n){let e=n.options?.shadow===!0,t=n.options?.attributes,o=t!==void 0?Object.keys(t):[];return class extends HTMLElement{static observedAttributes=o;constructor(){super(),this.$owner=null,this.$props=null,this.$attrs=null,this.$standalone=!1}connectedCallback(){this.$owner===null&&(this.$standalone=!0,this.$attrs={},this.$props=ln(this,t,this.$attrs),F(this,n,e))}disconnectedCallback(){!this.$standalone||this.$owner===null||(on(this.$owner),this.$owner=null)}attributeChangedCallback(s,i,d){let u=this.$attrs?.[s];u!==void 0&&(u.value=t[s]?.(d))}}}function ln(n,e,t){let o={};if(e!==void 0)for(let r in e){let s=tn(e[r](n.getAttribute(r)));t[r]=s,Object.defineProperty(o,r,{enumerable:!0,get:()=>s.value})}return Object.freeze(o)}function F(n,e,t){let o=N(j());e.name,n.$owner=o;let r=a(o);try{S(e.id);let s=t?n.attachShadow({mode:"open"}):n,i=H(()=>e.setup(n.$props));p(),O(s,null,null,i)}catch(s){p(),L(s,o)}finally{a(r)}}function an(n,e){let t=document.createElement(n.tag);return t.$props=e,F(t,n,n.options?.shadow===!0),t}import{batch as fn,createOwner as z,disposeOwner as pn,getOwner as mn,setOwner as W,signal as I,untrack as K}from"@firsthandjs/core";function Bn(n,e,t){let o=z(mn()),r=new Map,s,i=!1;return()=>{i&&s!==void 0&&wn(s,r);let d=[];d[x]=!0;let u={items:n(),rows:r,next:new Map,nodes:d,host:o,keyOf:e,render:t,pending:void 0,views:i};K(()=>{fn(()=>{gn(u)})}),i=u.views,r=u.next,s=d;let c=u.pending;return c!==void 0&&(d[T]=l=>{for(let en of c)q(en,l)}),d}}function wn(n,e){n.length=0;for(let t of e.values())for(let o of t.pieces===void 0?t.nodes:B(t))n.push(o)}function gn(n){let{items:e,rows:t,next:o,nodes:r}=n;for(let s=0;s<e.length;s++){let i=e[s],d=n.keyOf(i,s);if(o.has(d)){`${String(d)}`;continue}let u=t.get(d)??yn(n,i,s);t.delete(d)&&(u.item.value=i,u.index.value=s),o.set(d,u);let c=u.pieces===void 0?u.nodes:B(u);for(let l=0;l<c.length;l++)r.push(c[l])}P(()=>{for(let s of t.values())pn(s.owner)})}function yn(n,e,t){let o=hn(n.host,e,t,n.render);return o.pieces!==void 0&&(n.views=!0,q(o,null)||(n.pending=n.pending===void 0?[o]:[...n.pending,o])),o}function Z(n){return typeof n.nodeType=="number"}function q(n,e){let t=n.pieces;for(let o of t){if(Z(o))continue;let r=e??E.current?.place(o.child.anchor)??null;if(r===null)return!1;$(o.child,r,s=>{o.nodes=s})}return!0}function B(n){let e=[];for(let t of n.pieces)if(Z(t))e.push(t);else for(let o of t.nodes)e.push(o);return e}function hn(n,e,t,o){let r=z(n),s=I(e),i=I(t),d=W(r),u=[],c;try{c=G(K(()=>o(s,i)),u)}finally{W(d)}return c?{owner:r,item:s,index:i,nodes:[],pieces:u}:{owner:r,item:s,index:i,nodes:u}}function G(n,e){if(n==null||typeof n=="boolean")return!1;if(Array.isArray(n)){let t=!1;for(let o=0;o<n.length;o++)t=G(n[o],e)||t;return t}if(typeof n=="function"){let t=f(n);return e.push({child:t,nodes:[t.anchor]}),!0}if(typeof n=="object"){if(v(n))return e.push({child:n,nodes:[n.anchor]}),!0;if(typeof n.nodeType=="number")return e.push(n),!1}return e.push(document.createTextNode(String(n))),!1}var bn=new Set(["click","dblclick","contextmenu","input","beforeinput","change","keydown","keyup","keypress","pointerdown","pointerup","pointermove","mousedown","mouseup","mouseover","mouseout","submit","focusin","focusout","touchstart","touchend"]),_=new Set;function m(n){return`$firsthand$${n}`}function kn(n){let e=m(n.type),t=n.composedPath(),o=null;Object.defineProperty(n,"currentTarget",{configurable:!0,get:()=>o});for(let r=0;r<t.length;r++){let s=t[r],i=s[e];if(i!==void 0&&(o=s,i.call(s,n),n.cancelBubble)||s===document)break}o=null}function w(n,e,t,o){if(o!==void 0||!bn.has(e)){let r=n,s=o===!0?void 0:o,i=`${m(e)}$${s===void 0?"":Object.keys(s).sort().join(",")}`,d=r[i];d!==void 0&&n.removeEventListener(e,d.handler,d.options),r[i]={handler:t,options:s},n.addEventListener(e,t,s);return}n[m(e)]=t,_.has(e)||(_.add(e),document.addEventListener(e,kn))}function _n(n,e){n[m(e)]=void 0}var Rn={class:"className",for:"htmlFor"};function k(n,e,t){t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,t===!0?"":String(t))}function Un(n,e,t,o){o==null||o===!1?n.removeAttributeNS(e,t):n.setAttributeNS(e,t,o===!0?"":String(o))}function R(n,e,t){n[Rn[e]??e]=t}function Xn(n,e,t){n[e]=!!t}function C(n,e){e==null?n.removeAttribute("class"):n.className=String(e)}function J(n,e,t){let o=n.classList;if(t!==void 0)for(let r in t)r in e||o.remove(r);for(let r in e){let s=!!e[r];(t===void 0||!!t[r]!==s)&&o.toggle(r,s)}}function Q(n,e){e==null?n.style.cssText="":n.style.cssText=String(e)}function U(n,e,t){let o=n.style;if(t!==void 0)for(let r in t)r in e||o.removeProperty(b(r));for(let r in e){let s=e[r];(t===void 0||t[r]!==s)&&(s==null?o.removeProperty(b(r)):o.setProperty(b(r),String(s)))}}var Cn=/[A-Z]/g,Y=new Map;function b(n){let e=Y.get(n);return e===void 0&&(e=n.startsWith("--")?n:n.replace(Cn,t=>`-${t.toLowerCase()}`),Y.set(n,e)),e}function En(n,e,t){if(e==="class"||e==="className"){Pn(n,t);return}if(e==="style"){xn(n,t);return}if(e==="ref"){t(n);return}if(e.startsWith("prop:")){R(n,e.slice(5),t);return}if(e.startsWith("attr:")){k(n,e.slice(5),t);return}if(e.startsWith("on")&&e.length>2&&/[A-Z:]/.test(e[2])){Tn(n,e,t);return}if(e in n&&typeof t!="string"){R(n,e,t);return}k(n,e,t)}function Pn(n,e){if(Array.isArray(e)){C(n,e.filter(Boolean).join(" "));return}if(e!==null&&typeof e=="object"){J(n,e,nn(n,"class",e));return}C(n,e)}function xn(n,e){let t=n;if(e!==null&&typeof e=="object"){U(t,e,nn(n,"style",e));return}Q(t,e)}function Tn(n,e,t){let o=e.slice(2).split(":"),r=o[0]==="",s=r?o[1]:o[0].toLowerCase(),i=o[r?2:1];i===void 0?w(n,s,t):i==="native"?w(n,s,t,!0):w(n,s,t,{[i]:!0})}function oe(n,e){for(let t in e)t!=="children"&&En(n,t,e[t])}function re(...n){let e={};for(let t=0;t<n.length;t++){let o=n[t];for(let r of Object.keys(o))Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>o[r]})}return e}function se(n,e){let t={};for(let o of Object.keys(n))e.includes(o)||Object.defineProperty(t,o,{enumerable:!0,get:()=>n[o]});return Object.freeze(t)}var X=new WeakMap;function nn(n,e,t){let o=X.get(n);o===void 0&&(o={},X.set(n,o));let r=o[e];return o[e]=t,r}export{vn as a,h as b,M as c,D as d,Hn as e,Mn as f,Dn as g,Vn as h,sn as i,un as j,Bn as k,w as l,_n as m,k as n,Un as o,R as p,Xn as q,C as r,J as s,Q as t,U as u,En as v,oe as w,re as x,se as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{k as d,l as i}from"./chunk-467WEPXM.js";import{createRoot as r,onCleanup as s,untrack as u}from"@firsthandjs/core";function y(o,e=document.body){return f(o,e,null)}function f(o,e,l){let t;return r(n=>{t=n;let p=()=>{c(e,u(o),l!==null)};l===null?p():l(p)}),t}function c(o,e,l){if(typeof e=="function"){d(o,e);return}let t=null;if(l){let n=[...o.childNodes];t=n.length===1?n[0]:n}t=i(o,null,t,e),s(()=>{i(o,null,t,null)})}export{y as a,f as b};
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
hydration,
|
|
12
12
|
isDynamicChild,
|
|
13
13
|
part
|
|
14
|
-
} from "./dev-chunk-
|
|
14
|
+
} from "./dev-chunk-U46CIJCO.js";
|
|
15
15
|
|
|
16
16
|
// packages/dom/src/adapter.ts
|
|
17
17
|
var adapter = null;
|
|
@@ -233,28 +233,32 @@ function list(each, keyOf, render) {
|
|
|
233
233
|
let placed;
|
|
234
234
|
let views = false;
|
|
235
235
|
return () => {
|
|
236
|
-
const items = each();
|
|
237
236
|
if (views && placed !== void 0) {
|
|
238
|
-
placed
|
|
239
|
-
for (const row of rows.values()) {
|
|
240
|
-
for (const node of row.pieces === void 0 ? row.nodes : nodesOf(row)) {
|
|
241
|
-
placed.push(node);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
237
|
+
rewritePlaced(placed, rows);
|
|
244
238
|
}
|
|
245
|
-
const next = /* @__PURE__ */ new Map();
|
|
246
239
|
const nodes = [];
|
|
247
240
|
nodes[FLAT] = true;
|
|
248
|
-
|
|
241
|
+
const pass = {
|
|
242
|
+
items: each(),
|
|
243
|
+
rows,
|
|
244
|
+
next: /* @__PURE__ */ new Map(),
|
|
245
|
+
nodes,
|
|
246
|
+
host,
|
|
247
|
+
keyOf,
|
|
248
|
+
render,
|
|
249
|
+
pending: void 0,
|
|
250
|
+
views
|
|
251
|
+
};
|
|
249
252
|
untrack2(() => {
|
|
250
253
|
batch(() => {
|
|
251
|
-
buildRows();
|
|
254
|
+
buildRows(pass);
|
|
252
255
|
});
|
|
253
256
|
});
|
|
254
|
-
|
|
257
|
+
views = pass.views;
|
|
258
|
+
rows = pass.next;
|
|
255
259
|
placed = nodes;
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
const made = pass.pending;
|
|
261
|
+
if (made !== void 0) {
|
|
258
262
|
nodes[PENDING] = (parent) => {
|
|
259
263
|
for (const row of made) {
|
|
260
264
|
bindRow(row, parent);
|
|
@@ -262,44 +266,52 @@ function list(each, keyOf, render) {
|
|
|
262
266
|
};
|
|
263
267
|
}
|
|
264
268
|
return nodes;
|
|
265
|
-
function buildRows() {
|
|
266
|
-
for (let i = 0; i < items.length; i++) {
|
|
267
|
-
const item = items[i];
|
|
268
|
-
const key2 = keyOf(item, i);
|
|
269
|
-
if (next.has(key2)) {
|
|
270
|
-
devWarn(
|
|
271
|
-
`Duplicate list key ${String(key2)}. Keys must be unique, or rows will be dropped.`
|
|
272
|
-
);
|
|
273
|
-
continue;
|
|
274
|
-
}
|
|
275
|
-
let row = rows.get(key2);
|
|
276
|
-
if (row === void 0) {
|
|
277
|
-
row = createRow(host, item, i, render);
|
|
278
|
-
if (row.pieces !== void 0) {
|
|
279
|
-
views = true;
|
|
280
|
-
if (!bindRow(row, null)) {
|
|
281
|
-
pending = pending === void 0 ? [row] : [...pending, row];
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
} else {
|
|
285
|
-
rows.delete(key2);
|
|
286
|
-
row.item.value = item;
|
|
287
|
-
row.index.value = i;
|
|
288
|
-
}
|
|
289
|
-
next.set(key2, row);
|
|
290
|
-
const found = row.pieces === void 0 ? row.nodes : nodesOf(row);
|
|
291
|
-
for (let n = 0; n < found.length; n++) {
|
|
292
|
-
nodes.push(found[n]);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
discard(() => {
|
|
296
|
-
for (const row of rows.values()) {
|
|
297
|
-
disposeOwner2(row.owner);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
269
|
};
|
|
302
270
|
}
|
|
271
|
+
function rewritePlaced(placed, rows) {
|
|
272
|
+
placed.length = 0;
|
|
273
|
+
for (const row of rows.values()) {
|
|
274
|
+
for (const node of row.pieces === void 0 ? row.nodes : nodesOf(row)) {
|
|
275
|
+
placed.push(node);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function buildRows(pass) {
|
|
280
|
+
const { items, rows, next, nodes } = pass;
|
|
281
|
+
for (let i = 0; i < items.length; i++) {
|
|
282
|
+
const item = items[i];
|
|
283
|
+
const key2 = pass.keyOf(item, i);
|
|
284
|
+
if (next.has(key2)) {
|
|
285
|
+
devWarn(`Duplicate list key ${String(key2)}. Keys must be unique, or rows will be dropped.`);
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const row = rows.get(key2) ?? newRow(pass, item, i);
|
|
289
|
+
if (rows.delete(key2)) {
|
|
290
|
+
row.item.value = item;
|
|
291
|
+
row.index.value = i;
|
|
292
|
+
}
|
|
293
|
+
next.set(key2, row);
|
|
294
|
+
const found = row.pieces === void 0 ? row.nodes : nodesOf(row);
|
|
295
|
+
for (let n = 0; n < found.length; n++) {
|
|
296
|
+
nodes.push(found[n]);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
discard(() => {
|
|
300
|
+
for (const row of rows.values()) {
|
|
301
|
+
disposeOwner2(row.owner);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function newRow(pass, item, index) {
|
|
306
|
+
const row = createRow(pass.host, item, index, pass.render);
|
|
307
|
+
if (row.pieces !== void 0) {
|
|
308
|
+
pass.views = true;
|
|
309
|
+
if (!bindRow(row, null)) {
|
|
310
|
+
pass.pending = pass.pending === void 0 ? [row] : [...pass.pending, row];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return row;
|
|
314
|
+
}
|
|
303
315
|
function isNode(piece) {
|
|
304
316
|
return typeof piece.nodeType === "number";
|
|
305
317
|
}
|
|
@@ -548,25 +560,11 @@ function hyphenate(name) {
|
|
|
548
560
|
// packages/dom/src/props.ts
|
|
549
561
|
function applyProp(node, name, value) {
|
|
550
562
|
if (name === "class" || name === "className") {
|
|
551
|
-
|
|
552
|
-
setClass(node, value.filter(Boolean).join(" "));
|
|
553
|
-
} else if (value !== null && typeof value === "object") {
|
|
554
|
-
setClassList(node, value, remember(node, "class", value));
|
|
555
|
-
} else {
|
|
556
|
-
setClass(node, value);
|
|
557
|
-
}
|
|
563
|
+
applyClass(node, value);
|
|
558
564
|
return;
|
|
559
565
|
}
|
|
560
566
|
if (name === "style") {
|
|
561
|
-
|
|
562
|
-
setStyleObject(
|
|
563
|
-
node,
|
|
564
|
-
value,
|
|
565
|
-
remember(node, "style", value)
|
|
566
|
-
);
|
|
567
|
-
} else {
|
|
568
|
-
setStyle(node, value);
|
|
569
|
-
}
|
|
567
|
+
applyStyle(node, value);
|
|
570
568
|
return;
|
|
571
569
|
}
|
|
572
570
|
if (name === "ref") {
|
|
@@ -591,6 +589,29 @@ function applyProp(node, name, value) {
|
|
|
591
589
|
}
|
|
592
590
|
setAttribute(node, name, value);
|
|
593
591
|
}
|
|
592
|
+
function applyClass(node, value) {
|
|
593
|
+
if (Array.isArray(value)) {
|
|
594
|
+
setClass(node, value.filter(Boolean).join(" "));
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (value !== null && typeof value === "object") {
|
|
598
|
+
setClassList(node, value, remember(node, "class", value));
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
setClass(node, value);
|
|
602
|
+
}
|
|
603
|
+
function applyStyle(node, value) {
|
|
604
|
+
const style = node;
|
|
605
|
+
if (value !== null && typeof value === "object") {
|
|
606
|
+
setStyleObject(
|
|
607
|
+
style,
|
|
608
|
+
value,
|
|
609
|
+
remember(node, "style", value)
|
|
610
|
+
);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
setStyle(style, value);
|
|
614
|
+
}
|
|
594
615
|
function applyEvent(node, name, value) {
|
|
595
616
|
const parts = name.slice(2).split(":");
|
|
596
617
|
const literal = parts[0] === "";
|