tina4js 1.0.4 → 1.0.5

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/core.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./signal.cjs.js"),_=require("./component.cjs.js"),h=new WeakMap,d="t4:";function A(t,...e){let n=h.get(t);if(!n){n=document.createElement("template");let c="";for(let s=0;s<t.length;s++)c+=t[s],s<e.length&&(T(c)?c+=`__t4_${s}__`:c+=`<!--${d}${s}-->`);n.innerHTML=c,h.set(t,n)}const o=n.content.cloneNode(!0),i=N(o);for(const{marker:c,index:s}of i)y(c,e[s]);const f=b(o);for(const c of f)S(c,e);return o}function N(t){const e=[];return u(t,n=>{if(n.nodeType===8){const o=n.data;if(o&&o.startsWith(d)){const i=parseInt(o.slice(d.length),10);e.push({marker:n,index:i})}}}),e}function b(t){const e=[];return u(t,n=>{n.nodeType===1&&e.push(n)}),e}function u(t,e){const n=t.childNodes;for(let o=0;o<n.length;o++){const i=n[o];e(i),u(i,e)}}function y(t,e){const n=t.parentNode;if(n)if(a.isSignal(e)){const o=document.createTextNode("");n.replaceChild(o,t),a.effect(()=>{o.data=String(e.value??"")})}else if(typeof e=="function"){const o=document.createComment("");n.replaceChild(o,t);let i=[];a.effect(()=>{var l;const f=e();for(const r of i)(l=r.parentNode)==null||l.removeChild(r);i=[];const c=m(f),s=o.parentNode;for(const r of c)s.insertBefore(r,o),i.push(r)})}else if(p(e))n.replaceChild(e,t);else if(e instanceof Node)n.replaceChild(e,t);else if(Array.isArray(e)){const o=document.createDocumentFragment();for(const i of e){const f=m(i);for(const c of f)o.appendChild(c)}n.replaceChild(o,t)}else{const o=document.createTextNode(String(e??""));n.replaceChild(o,t)}}function S(t,e){const n=[];for(const o of Array.from(t.attributes)){const i=o.name,f=o.value;if(i.startsWith("@")){const s=i.slice(1),l=f.match(/__t4_(\d+)__/);if(l){const r=e[parseInt(l[1],10)];typeof r=="function"&&t.addEventListener(s,r)}n.push(i);continue}if(i.startsWith("?")){const s=i.slice(1),l=f.match(/__t4_(\d+)__/);if(l){const r=e[parseInt(l[1],10)];if(a.isSignal(r)){const g=r;a.effect(()=>{g.value?t.setAttribute(s,""):t.removeAttribute(s)})}else r&&t.setAttribute(s,"")}n.push(i);continue}if(i.startsWith(".")){const s=i.slice(1),l=f.match(/__t4_(\d+)__/);if(l){const r=e[parseInt(l[1],10)];a.isSignal(r)?a.effect(()=>{t[s]=r.value}):t[s]=r}n.push(i);continue}const c=f.match(/__t4_(\d+)__/);if(c){const s=e[parseInt(c[1],10)];if(a.isSignal(s)){const l=s;a.effect(()=>{t.setAttribute(i,String(l.value??""))})}else typeof s=="function"?a.effect(()=>{t.setAttribute(i,String(s()??""))}):t.setAttribute(i,String(s??""))}}for(const o of n)t.removeAttribute(o)}function m(t){if(t==null||t===!1)return[];if(p(t))return Array.from(t.childNodes);if(t instanceof Node)return[t];if(Array.isArray(t)){const e=[];for(const n of t)e.push(...m(n));return e}return[document.createTextNode(String(t))]}function p(t){return t!=null&&typeof t=="object"&&t.nodeType===11}function T(t){let e=!1,n=!1,o=!1;for(let i=0;i<t.length;i++){const f=t[i];f==="<"&&!e&&!n&&(o=!0),f===">"&&!e&&!n&&(o=!1),o&&(f==='"'&&!e&&(n=!n),f==="'"&&!n&&(e=!e))}return o}exports.batch=a.batch;exports.computed=a.computed;exports.effect=a.effect;exports.isSignal=a.isSignal;exports.signal=a.signal;exports.Tina4Element=_.Tina4Element;exports.html=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./signal.cjs.js"),N=require("./component.cjs.js"),_=new WeakMap,m="t4:";function b(t,...e){let n=_.get(t);if(!n){n=document.createElement("template");let f="";for(let i=0;i<t.length;i++)f+=t[i],i<e.length&&(E(f)?f+=`__t4_${i}__`:f+=`<!--${m}${i}-->`);n.innerHTML=f,_.set(t,n)}const o=n.content.cloneNode(!0),c=C(o);for(const{marker:f,index:i}of c)S(f,e[i]);const r=y(o);for(const f of r)T(f,e);return o}function C(t){const e=[];return p(t,n=>{if(n.nodeType===8){const o=n.data;if(o&&o.startsWith(m)){const c=parseInt(o.slice(m.length),10);e.push({marker:n,index:c})}}}),e}function y(t){const e=[];return p(t,n=>{n.nodeType===1&&e.push(n)}),e}function p(t,e){const n=t.childNodes;for(let o=0;o<n.length;o++){const c=n[o];e(c),p(c,e)}}function S(t,e){const n=t.parentNode;if(n)if(s.isSignal(e)){const o=document.createTextNode("");n.replaceChild(o,t),s.effect(()=>{o.data=String(e.value??"")})}else if(typeof e=="function"){const o=document.createComment("");n.replaceChild(o,t);let c=[],r=[];s.effect(()=>{var g;for(const d of r)d();r=[];const f=[],i=s._getEffectCollector();s._setEffectCollector(f);const l=e();s._setEffectCollector(i),r=f;for(const d of c)(g=d.parentNode)==null||g.removeChild(d);c=[];const a=h(l),u=o.parentNode;if(u)for(const d of a)u.insertBefore(d,o),c.push(d)})}else if(A(e))n.replaceChild(e,t);else if(e instanceof Node)n.replaceChild(e,t);else if(Array.isArray(e)){const o=document.createDocumentFragment();for(const c of e){const r=h(c);for(const f of r)o.appendChild(f)}n.replaceChild(o,t)}else{const o=document.createTextNode(String(e??""));n.replaceChild(o,t)}}function T(t,e){const n=[];for(const o of Array.from(t.attributes)){const c=o.name,r=o.value;if(c.startsWith("@")){const i=c.slice(1),l=r.match(/__t4_(\d+)__/);if(l){const a=e[parseInt(l[1],10)];typeof a=="function"&&t.addEventListener(i,a)}n.push(c);continue}if(c.startsWith("?")){const i=c.slice(1),l=r.match(/__t4_(\d+)__/);if(l){const a=e[parseInt(l[1],10)];if(s.isSignal(a)){const u=a;s.effect(()=>{u.value?t.setAttribute(i,""):t.removeAttribute(i)})}else a&&t.setAttribute(i,"")}n.push(c);continue}if(c.startsWith(".")){const i=c.slice(1),l=r.match(/__t4_(\d+)__/);if(l){const a=e[parseInt(l[1],10)];s.isSignal(a)?s.effect(()=>{t[i]=a.value}):t[i]=a}n.push(c);continue}const f=r.match(/__t4_(\d+)__/);if(f){const i=e[parseInt(f[1],10)];if(s.isSignal(i)){const l=i;s.effect(()=>{t.setAttribute(c,String(l.value??""))})}else typeof i=="function"?s.effect(()=>{t.setAttribute(c,String(i()??""))}):t.setAttribute(c,String(i??""))}}for(const o of n)t.removeAttribute(o)}function h(t){if(t==null||t===!1)return[];if(A(t))return Array.from(t.childNodes);if(t instanceof Node)return[t];if(Array.isArray(t)){const e=[];for(const n of t)e.push(...h(n));return e}return[document.createTextNode(String(t))]}function A(t){return t!=null&&typeof t=="object"&&t.nodeType===11}function E(t){let e=!1,n=!1,o=!1;for(let c=0;c<t.length;c++){const r=t[c];r==="<"&&!e&&!n&&(o=!0),r===">"&&!e&&!n&&(o=!1),o&&(r==='"'&&!e&&(n=!n),r==="'"&&!n&&(e=!e))}return o}exports.batch=s.batch;exports.computed=s.computed;exports.effect=s.effect;exports.isSignal=s.isSignal;exports.signal=s.signal;exports.Tina4Element=N.Tina4Element;exports.html=b;
package/dist/core.es.js CHANGED
@@ -1,53 +1,53 @@
1
- import { i as l, e as d } from "./signal.es.js";
2
- import { b as I, c as W, s as V } from "./signal.es.js";
3
- import { T as D } from "./component.es.js";
4
- const u = /* @__PURE__ */ new WeakMap(), m = "t4:";
5
- function x(t, ...e) {
6
- let n = u.get(t);
1
+ import { i as p, e as d, a as b, d as A } from "./signal.es.js";
2
+ import { b as w, c as M, s as R } from "./signal.es.js";
3
+ import { T as F } from "./component.es.js";
4
+ const N = /* @__PURE__ */ new WeakMap(), u = "t4:";
5
+ function W(t, ...e) {
6
+ let n = N.get(t);
7
7
  if (!n) {
8
8
  n = document.createElement("template");
9
- let r = "";
10
- for (let i = 0; i < t.length; i++)
11
- r += t[i], i < e.length && (T(r) ? r += `__t4_${i}__` : r += `<!--${m}${i}-->`);
12
- n.innerHTML = r, u.set(t, n);
9
+ let i = "";
10
+ for (let r = 0; r < t.length; r++)
11
+ i += t[r], r < e.length && (S(i) ? i += `__t4_${r}__` : i += `<!--${u}${r}-->`);
12
+ n.innerHTML = i, N.set(t, n);
13
13
  }
14
- const o = n.content.cloneNode(!0), s = A(o);
15
- for (const { marker: r, index: i } of s)
16
- b(r, e[i]);
17
- const f = N(o);
18
- for (const r of f)
19
- y(r, e);
14
+ const o = n.content.cloneNode(!0), s = y(o);
15
+ for (const { marker: i, index: r } of s)
16
+ x(i, e[r]);
17
+ const c = T(o);
18
+ for (const i of c)
19
+ E(i, e);
20
20
  return o;
21
21
  }
22
- function A(t) {
22
+ function y(t) {
23
23
  const e = [];
24
- return h(t, (n) => {
24
+ return _(t, (n) => {
25
25
  if (n.nodeType === 8) {
26
26
  const o = n.data;
27
- if (o && o.startsWith(m)) {
28
- const s = parseInt(o.slice(m.length), 10);
27
+ if (o && o.startsWith(u)) {
28
+ const s = parseInt(o.slice(u.length), 10);
29
29
  e.push({ marker: n, index: s });
30
30
  }
31
31
  }
32
32
  }), e;
33
33
  }
34
- function N(t) {
34
+ function T(t) {
35
35
  const e = [];
36
- return h(t, (n) => {
36
+ return _(t, (n) => {
37
37
  n.nodeType === 1 && e.push(n);
38
38
  }), e;
39
39
  }
40
- function h(t, e) {
40
+ function _(t, e) {
41
41
  const n = t.childNodes;
42
42
  for (let o = 0; o < n.length; o++) {
43
43
  const s = n[o];
44
- e(s), h(s, e);
44
+ e(s), _(s, e);
45
45
  }
46
46
  }
47
- function b(t, e) {
47
+ function x(t, e) {
48
48
  const n = t.parentNode;
49
49
  if (n)
50
- if (l(e)) {
50
+ if (p(e)) {
51
51
  const o = document.createTextNode("");
52
52
  n.replaceChild(o, t), d(() => {
53
53
  o.data = String(e.value ?? "");
@@ -55,25 +55,31 @@ function b(t, e) {
55
55
  } else if (typeof e == "function") {
56
56
  const o = document.createComment("");
57
57
  n.replaceChild(o, t);
58
- let s = [];
58
+ let s = [], c = [];
59
59
  d(() => {
60
- var a;
60
+ var g;
61
+ for (const l of c) l();
62
+ c = [];
63
+ const i = [], r = b();
64
+ A(i);
61
65
  const f = e();
62
- for (const c of s) (a = c.parentNode) == null || a.removeChild(c);
66
+ A(r), c = i;
67
+ for (const l of s) (g = l.parentNode) == null || g.removeChild(l);
63
68
  s = [];
64
- const r = p(f), i = o.parentNode;
65
- for (const c of r)
66
- i.insertBefore(c, o), s.push(c);
69
+ const a = h(f), m = o.parentNode;
70
+ if (m)
71
+ for (const l of a)
72
+ m.insertBefore(l, o), s.push(l);
67
73
  });
68
- } else if (_(e))
74
+ } else if (C(e))
69
75
  n.replaceChild(e, t);
70
76
  else if (e instanceof Node)
71
77
  n.replaceChild(e, t);
72
78
  else if (Array.isArray(e)) {
73
79
  const o = document.createDocumentFragment();
74
80
  for (const s of e) {
75
- const f = p(s);
76
- for (const r of f) o.appendChild(r);
81
+ const c = h(s);
82
+ for (const i of c) o.appendChild(i);
77
83
  }
78
84
  n.replaceChild(o, t);
79
85
  } else {
@@ -81,88 +87,88 @@ function b(t, e) {
81
87
  n.replaceChild(o, t);
82
88
  }
83
89
  }
84
- function y(t, e) {
90
+ function E(t, e) {
85
91
  const n = [];
86
92
  for (const o of Array.from(t.attributes)) {
87
- const s = o.name, f = o.value;
93
+ const s = o.name, c = o.value;
88
94
  if (s.startsWith("@")) {
89
- const i = s.slice(1), a = f.match(/__t4_(\d+)__/);
90
- if (a) {
91
- const c = e[parseInt(a[1], 10)];
92
- typeof c == "function" && t.addEventListener(i, c);
95
+ const r = s.slice(1), f = c.match(/__t4_(\d+)__/);
96
+ if (f) {
97
+ const a = e[parseInt(f[1], 10)];
98
+ typeof a == "function" && t.addEventListener(r, a);
93
99
  }
94
100
  n.push(s);
95
101
  continue;
96
102
  }
97
103
  if (s.startsWith("?")) {
98
- const i = s.slice(1), a = f.match(/__t4_(\d+)__/);
99
- if (a) {
100
- const c = e[parseInt(a[1], 10)];
101
- if (l(c)) {
102
- const g = c;
104
+ const r = s.slice(1), f = c.match(/__t4_(\d+)__/);
105
+ if (f) {
106
+ const a = e[parseInt(f[1], 10)];
107
+ if (p(a)) {
108
+ const m = a;
103
109
  d(() => {
104
- g.value ? t.setAttribute(i, "") : t.removeAttribute(i);
110
+ m.value ? t.setAttribute(r, "") : t.removeAttribute(r);
105
111
  });
106
112
  } else
107
- c && t.setAttribute(i, "");
113
+ a && t.setAttribute(r, "");
108
114
  }
109
115
  n.push(s);
110
116
  continue;
111
117
  }
112
118
  if (s.startsWith(".")) {
113
- const i = s.slice(1), a = f.match(/__t4_(\d+)__/);
114
- if (a) {
115
- const c = e[parseInt(a[1], 10)];
116
- l(c) ? d(() => {
117
- t[i] = c.value;
118
- }) : t[i] = c;
119
+ const r = s.slice(1), f = c.match(/__t4_(\d+)__/);
120
+ if (f) {
121
+ const a = e[parseInt(f[1], 10)];
122
+ p(a) ? d(() => {
123
+ t[r] = a.value;
124
+ }) : t[r] = a;
119
125
  }
120
126
  n.push(s);
121
127
  continue;
122
128
  }
123
- const r = f.match(/__t4_(\d+)__/);
124
- if (r) {
125
- const i = e[parseInt(r[1], 10)];
126
- if (l(i)) {
127
- const a = i;
129
+ const i = c.match(/__t4_(\d+)__/);
130
+ if (i) {
131
+ const r = e[parseInt(i[1], 10)];
132
+ if (p(r)) {
133
+ const f = r;
128
134
  d(() => {
129
- t.setAttribute(s, String(a.value ?? ""));
135
+ t.setAttribute(s, String(f.value ?? ""));
130
136
  });
131
- } else typeof i == "function" ? d(() => {
132
- t.setAttribute(s, String(i() ?? ""));
133
- }) : t.setAttribute(s, String(i ?? ""));
137
+ } else typeof r == "function" ? d(() => {
138
+ t.setAttribute(s, String(r() ?? ""));
139
+ }) : t.setAttribute(s, String(r ?? ""));
134
140
  }
135
141
  }
136
142
  for (const o of n) t.removeAttribute(o);
137
143
  }
138
- function p(t) {
144
+ function h(t) {
139
145
  if (t == null || t === !1) return [];
140
- if (_(t)) return Array.from(t.childNodes);
146
+ if (C(t)) return Array.from(t.childNodes);
141
147
  if (t instanceof Node) return [t];
142
148
  if (Array.isArray(t)) {
143
149
  const e = [];
144
- for (const n of t) e.push(...p(n));
150
+ for (const n of t) e.push(...h(n));
145
151
  return e;
146
152
  }
147
153
  return [document.createTextNode(String(t))];
148
154
  }
149
- function _(t) {
155
+ function C(t) {
150
156
  return t != null && typeof t == "object" && t.nodeType === 11;
151
157
  }
152
- function T(t) {
158
+ function S(t) {
153
159
  let e = !1, n = !1, o = !1;
154
160
  for (let s = 0; s < t.length; s++) {
155
- const f = t[s];
156
- f === "<" && !e && !n && (o = !0), f === ">" && !e && !n && (o = !1), o && (f === '"' && !e && (n = !n), f === "'" && !n && (e = !e));
161
+ const c = t[s];
162
+ c === "<" && !e && !n && (o = !0), c === ">" && !e && !n && (o = !1), o && (c === '"' && !e && (n = !n), c === "'" && !n && (e = !e));
157
163
  }
158
164
  return o;
159
165
  }
160
166
  export {
161
- D as Tina4Element,
162
- I as batch,
163
- W as computed,
167
+ F as Tina4Element,
168
+ w as batch,
169
+ M as computed,
164
170
  d as effect,
165
- x as html,
166
- l as isSignal,
167
- V as signal
171
+ W as html,
172
+ p as isSignal,
173
+ R as signal
168
174
  };
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as y } from "./signal.es.js";
1
+ import { d as y } from "./signal.es.js";
2
2
  let p = [], a = null, u = "history";
3
3
  const c = [];
4
4
  let l = [], w = 0;
@@ -1 +1 @@
1
- "use strict";let s=null,f=null;function p(e){f=e}let i=null,a=null;function S(e,t){i=e,a=t}let c=0;const d=new Set;function b(e,t){let n=e;const u=new Set,o={_t4:!0,get value(){return s&&u.add(s),n},set value(r){if(Object.is(r,n))return;const g=n;if(n=r,o._debugInfo&&o._debugInfo.updateCount++,a&&a(o,g,r),c>0)for(const l of u)d.add(l);else for(const l of[...u])l()},_subscribe(r){return u.add(r),()=>{u.delete(r)}},peek(){return n}};return i&&(o._debugInfo={label:t,createdAt:Date.now(),updateCount:0,subs:u},i(o,t)),o}function h(e){const t=b(void 0);return _(()=>{t.value=e()}),{_t4:!0,get value(){return t.value},set value(n){throw new Error("[tina4] computed signals are read-only")},_subscribe(n){return t._subscribe(n)},peek(){return t.peek()}}}function _(e){let t=!1;const n=()=>{if(t)return;const o=s;s=n;try{e()}finally{s=o}};n();const u=()=>{t=!0};return f&&f.push(u),u}function v(e){c++;try{e()}finally{if(c--,c===0){const t=[...d];d.clear();for(const n of t)n()}}}function y(e){return e!==null&&typeof e=="object"&&e._t4===!0}exports.__setDebugSignalHooks=S;exports._setEffectCollector=p;exports.batch=v;exports.computed=h;exports.effect=_;exports.isSignal=y;exports.signal=b;
1
+ "use strict";let c=null,s=null,i=null;function C(t){i=t}function h(){return i}let d=null,_=null;function v(t,n){d=t,_=n}let f=0;const b=new Set;function g(t,n){let e=t;const o=new Set,r={_t4:!0,get value(){if(c&&(o.add(c),s)){const u=c;s.push(()=>o.delete(u))}return e},set value(u){if(Object.is(u,e))return;const a=e;if(e=u,r._debugInfo&&r._debugInfo.updateCount++,_&&_(r,a,u),f>0)for(const l of o)b.add(l);else for(const l of[...o])l()},_subscribe(u){return o.add(u),()=>{o.delete(u)}},peek(){return e}};return d&&(r._debugInfo={label:n,createdAt:Date.now(),updateCount:0,subs:o},d(r,n)),r}function S(t){const n=g(void 0);return p(()=>{n.value=t()}),{_t4:!0,get value(){return n.value},set value(e){throw new Error("[tina4] computed signals are read-only")},_subscribe(e){return n._subscribe(e)},peek(){return n.peek()}}}function p(t){let n=!1,e=[];const o=()=>{if(n)return;for(const l of e)l();e=[];const u=c,a=s;c=o,s=e;try{t()}finally{c=u,s=a}};o();const r=()=>{n=!0;for(const u of e)u();e=[]};return i&&i.push(r),r}function y(t){f++;try{t()}finally{if(f--,f===0){const n=[...b];b.clear();for(const e of n)e()}}}function E(t){return t!==null&&typeof t=="object"&&t._t4===!0}exports.__setDebugSignalHooks=v;exports._getEffectCollector=h;exports._setEffectCollector=C;exports.batch=y;exports.computed=S;exports.effect=p;exports.isSignal=E;exports.signal=g;
package/dist/signal.es.js CHANGED
@@ -1,98 +1,110 @@
1
- let s = null, a = null;
2
- function g(e) {
3
- a = e;
1
+ let s = null, l = null, a = null;
2
+ function v(t) {
3
+ a = t;
4
4
  }
5
- let f = null, i = null;
6
- function v(e, t) {
7
- f = e, i = t;
5
+ function C() {
6
+ return a;
8
7
  }
9
- let c = 0;
10
- const d = /* @__PURE__ */ new Set();
11
- function _(e, t) {
12
- let n = e;
13
- const u = /* @__PURE__ */ new Set(), r = {
8
+ let d = null, b = null;
9
+ function h(t, n) {
10
+ d = t, b = n;
11
+ }
12
+ let f = 0;
13
+ const p = /* @__PURE__ */ new Set();
14
+ function _(t, n) {
15
+ let e = t;
16
+ const o = /* @__PURE__ */ new Set(), r = {
14
17
  _t4: !0,
15
18
  get value() {
16
- return s && u.add(s), n;
19
+ if (s && (o.add(s), l)) {
20
+ const u = s;
21
+ l.push(() => o.delete(u));
22
+ }
23
+ return e;
17
24
  },
18
- set value(o) {
19
- if (Object.is(o, n)) return;
20
- const b = n;
21
- if (n = o, r._debugInfo && r._debugInfo.updateCount++, i && i(r, b, o), c > 0)
22
- for (const l of u) d.add(l);
25
+ set value(u) {
26
+ if (Object.is(u, e)) return;
27
+ const i = e;
28
+ if (e = u, r._debugInfo && r._debugInfo.updateCount++, b && b(r, i, u), f > 0)
29
+ for (const c of o) p.add(c);
23
30
  else
24
- for (const l of [...u]) l();
31
+ for (const c of [...o]) c();
25
32
  },
26
- _subscribe(o) {
27
- return u.add(o), () => {
28
- u.delete(o);
33
+ _subscribe(u) {
34
+ return o.add(u), () => {
35
+ o.delete(u);
29
36
  };
30
37
  },
31
38
  peek() {
32
- return n;
39
+ return e;
33
40
  }
34
41
  };
35
- return f && (r._debugInfo = { label: t, createdAt: Date.now(), updateCount: 0, subs: u }, f(r, t)), r;
42
+ return d && (r._debugInfo = { label: n, createdAt: Date.now(), updateCount: 0, subs: o }, d(r, n)), r;
36
43
  }
37
- function h(e) {
38
- const t = _(void 0);
39
- return p(() => {
40
- t.value = e();
44
+ function y(t) {
45
+ const n = _(void 0);
46
+ return g(() => {
47
+ n.value = t();
41
48
  }), {
42
49
  _t4: !0,
43
50
  get value() {
44
- return t.value;
51
+ return n.value;
45
52
  },
46
- set value(n) {
53
+ set value(e) {
47
54
  throw new Error("[tina4] computed signals are read-only");
48
55
  },
49
- _subscribe(n) {
50
- return t._subscribe(n);
56
+ _subscribe(e) {
57
+ return n._subscribe(e);
51
58
  },
52
59
  peek() {
53
- return t.peek();
60
+ return n.peek();
54
61
  }
55
62
  };
56
63
  }
57
- function p(e) {
58
- let t = !1;
59
- const n = () => {
60
- if (t) return;
61
- const r = s;
62
- s = n;
64
+ function g(t) {
65
+ let n = !1, e = [];
66
+ const o = () => {
67
+ if (n) return;
68
+ for (const c of e) c();
69
+ e = [];
70
+ const u = s, i = l;
71
+ s = o, l = e;
63
72
  try {
64
- e();
73
+ t();
65
74
  } finally {
66
- s = r;
75
+ s = u, l = i;
67
76
  }
68
77
  };
69
- n();
70
- const u = () => {
71
- t = !0;
78
+ o();
79
+ const r = () => {
80
+ n = !0;
81
+ for (const u of e) u();
82
+ e = [];
72
83
  };
73
- return a && a.push(u), u;
84
+ return a && a.push(r), r;
74
85
  }
75
- function y(e) {
76
- c++;
86
+ function S(t) {
87
+ f++;
77
88
  try {
78
- e();
89
+ t();
79
90
  } finally {
80
- if (c--, c === 0) {
81
- const t = [...d];
82
- d.clear();
83
- for (const n of t) n();
91
+ if (f--, f === 0) {
92
+ const n = [...p];
93
+ p.clear();
94
+ for (const e of n) e();
84
95
  }
85
96
  }
86
97
  }
87
- function S(e) {
88
- return e !== null && typeof e == "object" && e._t4 === !0;
98
+ function w(t) {
99
+ return t !== null && typeof t == "object" && t._t4 === !0;
89
100
  }
90
101
  export {
91
- v as _,
92
- g as a,
93
- y as b,
94
- h as c,
95
- p as e,
96
- S as i,
102
+ h as _,
103
+ C as a,
104
+ S as b,
105
+ y as c,
106
+ v as d,
107
+ g as e,
108
+ w as i,
97
109
  _ as s
98
110
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tina4js",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Sub-3KB reactive framework — signals, web components, routing, PWA",
5
5
  "type": "module",
6
6
  "main": "dist/tina4.cjs.js",
package/readme.md CHANGED
@@ -240,6 +240,11 @@ npm run dev # dev server
240
240
 
241
241
  ## Changelog
242
242
 
243
+ ### 1.0.5
244
+ - **Fix:** Effects now properly unsubscribe from signals on dispose — prevents stale subscriptions accumulating in signal subscriber sets across navigations
245
+ - **Fix:** Function bindings in `html` templates now dispose inner effects when re-evaluated — fixes duplicate DOM nodes from nested reactive lists and conditionals
246
+ - Added 9 new tests covering effect subscription cleanup, inner effect disposal, and multi-navigation accumulation (116 total)
247
+
243
248
  ### 1.0.4
244
249
  - Added router reactive effect cleanup tests (navigate away/back, stale effects, async handlers, stale async discard)
245
250
  - Added debug overlay documentation to README and TINA4.md