ajo 0.1.23 → 0.1.25

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/html.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./context.cjs"),A=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),w=new Set(["key","skip","memo","ref"]),$=new Set(["nodeName","children",...w]),j=Symbol.for("ajo.args"),l=e=>e.replace(/[&<>"']/g,r=>`&#${r.charCodeAt(0)};`),m=(e,r)=>({nodeName:"div","data-ssr":e,children:r}),y=()=>{},x=e=>[...v(e)].join(""),v=function*(e,r=()=>"",i=y){yield*g(f(e,r,i))},f=(e,r,i)=>{if(!(e==null||typeof e=="boolean")){if(typeof e=="string"||typeof e=="number")return String(e);if(Array.isArray(e)){const n=[];for(e of e.flat(1/0)){const t=f(e,r,i);t!=null&&n.push(t)}return n.length===1?n[0]:n}if(typeof e=="object"&&"nodeName"in e){if(typeof e.nodeName=="function")return k(e,r,i);const n={nodeName:e.nodeName};for(const t in e)!$.has(t)&&!t.startsWith("set:")&&(n[t]=e[t]);return"children"in e&&(n.children=f(e.children,r,i)),n}return String(e)}},k=({nodeName:e,fallback:r=e.fallback,...i},n,t)=>{if(e.src){const o=n();return t({id:o,src:e.src,h:i,done:!0}),m(o,r)}const s=e.constructor.name;if(s==="GeneratorFunction")return p(e,i,n,t);if(s==="AsyncGeneratorFunction")return G(e,r,i,n,t);if(i=e(i),i instanceof Promise){if(t===y)return r;const o=n();return i.then(a=>t({id:o,h:f(a,(d=o)=>n(d),t),done:!0})),m(o,r)}return f(i,n,t)},p=(e,r,i,n)=>{var S,b;const t={...e.attrs},s={...e.args};for(const c in r)c.startsWith("attr:")?t[c.slice(5)]=r[c]:w.has(c)||c.startsWith("set:")?t[c]=r[c]:s[c]=r[c];const o={[u.Context]:Object.assign(Object.create(null),(S=u.current())==null?void 0:S[u.Context]),[j]:s,render:y,next:y,return:y,throw:c=>{throw c}},a=e.call(o,s),d=u.current();u.current(o);try{return{...t,nodeName:e.is??"div",children:f(a.next().value,i,n)}}finally{(b=a.return)==null||b.call(a),u.current(d)}},G=(e,r,i,n,t)=>{if(t===y)return r;const s=n();return Promise.resolve().then(async()=>{var a;n=(d=s)=>n(d);const o=e(i);try{for(i=await o.next();!i.done;)t({id:s,h:f(i.value,n,t),done:!1}),i=await o.next();t({id:s,h:f(i.value,n,t),done:!0})}catch(d){t({id:s,h:f(d,n,t),done:!0})}finally{(a=o.return)==null||a.call(o)}}),m(s,r)},g=function*(e){if(typeof e=="string")yield l(e);else if(Array.isArray(e))for(e of e)yield*g(e);else if(typeof e=="object"&&"nodeName"in e){const{nodeName:r,children:i}=e;let n="";for(const t in e)$.has(t)||t.startsWith("set:")||e[t]==null||e[t]===!1||(e[t]===!0?n+=` ${t}`:n+=` ${t}="${l(String(e[t]))}"`);A.has(r)?yield`<${r}${n}>`:(yield`<${r}${n}>`,i!=null&&(yield*g(i)),yield`</${r}>`)}else yield l(String(e))};exports.html=v;exports.render=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./context.cjs"),b=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),S=new Set(["key","skip","memo","ref"]),w=new Set(["nodeName","children"]),$=Symbol.for("ajo.args"),g=e=>e.replace(/[&<>"']/g,r=>`&#${r.charCodeAt(0)};`),u=()=>{},v=e=>[...y(e)].join(""),y=function*(e,{alloc:r=u,push:n=u,placeholder:t=u}={}){for(e of f(e,{alloc:r,push:n,placeholder:t}))typeof e=="string"?yield g(e):yield*x(e,{alloc:r,push:n,placeholder:t})},x=function*(e,r){const{nodeName:n,children:t}=e;let l="";for(const i in e)w.has(i)||i.startsWith("set:")||e[i]==null||e[i]===!1||(e[i]===!0?l+=` ${i}`:l+=` ${i}="${g(String(e[i]))}"`);b.has(n)?yield`<${n}${l}>`:(yield`<${n}${l}>`,t!=null&&(yield*y(t,r)),yield`</${n}>`)},f=function*(e,r){if(e==null)return;const n=typeof e;if(n!="boolean")if(n=="string")yield e;else if(n=="number"||n=="bigint")yield String(e);else if(Symbol.iterator in e)for(e of e)yield*f(e,r);else"nodeName"in e?typeof e.nodeName=="function"?yield*A(e,r):yield o(e,r):yield String(e)},A=function*({nodeName:e,fallback:r=e.fallback,...n},t){const l=e.constructor.name;e.src?yield j(e.src,n,t):l=="GeneratorFunction"?yield G(e,n,t):l=="AsyncGeneratorFunction"?yield C(e,r,n,t):(n=e(n),typeof(n==null?void 0:n.then)=="function"?yield O(r,n,t):yield*f(n,t))},j=(e,r,n)=>{const t=n.alloc();return n.push({id:t,src:e,h:o(r,n),done:!0}),n.placeholder(t)},G=(e,r,n)=>{var p,m;const t={...e.attrs},l={...e.args};for(const c in r)c.startsWith("attr:")?t[c.slice(5)]=r[c]:S.has(c)||c.startsWith("set:")?t[c]=r[c]:l[c]=r[c];const i={[a.Context]:Object.create(((p=a.current())==null?void 0:p[a.Context])??null),[$]:l,render:u,next:u,return:u,throw:c=>{throw c}},s=e.call(i,l),d=a.current();a.current(i);try{const c=[...f(s.next().value,n)];return{...t,nodeName:e.is??"div",children:c.length==1?c[0]:c}}finally{(m=s.return)==null||m.call(s),a.current(d)}},C=(e,r,n,t)=>{const l=t.alloc();return Promise.resolve().then(async()=>{var s;const i=e(n);t={...t,alloc:(d=l)=>t.alloc(d)};try{for(n=await i.next();!n.done;)t.push({id:l,h:o(n.value,t),done:!1}),n=await i.next();t.push({id:l,h:o(n.value,t),done:!0})}catch(d){t.push({id:l,h:o(d,t),done:!0})}finally{(s=i.return)==null||s.call(i)}}),t.placeholder(l,r)},O=(e,r,n)=>{const t=n.alloc();return r.then(l=>n.push({id:t,h:o(l,{...n,alloc:(i=t)=>n.alloc(i)}),done:!0})),n.placeholder(t,e)},o=({key:e,skip:r,memo:n,ref:t,...l},i)=>{if("children"in l){const s=[...f(l.children,i)];s.length?l.children=s.length==1?s[0]:s:delete l.children}return l};exports.html=y;exports.render=v;
package/dist/html.js CHANGED
@@ -1,90 +1,77 @@
1
- import { Context as $, current as u } from "./context.js";
2
- const v = /* @__PURE__ */ new Set(["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), b = /* @__PURE__ */ new Set(["key", "skip", "memo", "ref"]), A = /* @__PURE__ */ new Set(["nodeName", "children", ...b]), j = Symbol.for("ajo.args"), l = (e) => e.replace(/[&<>"']/g, (r) => `&#${r.charCodeAt(0)};`), m = (e, r) => ({ nodeName: "div", "data-ssr": e, children: r }), y = () => {
3
- }, N = (e) => [...k(e)].join(""), k = function* (e, r = () => "", i = y) {
4
- yield* g(f(e, r, i));
5
- }, f = (e, r, i) => {
6
- if (!(e == null || typeof e == "boolean")) {
7
- if (typeof e == "string" || typeof e == "number") return String(e);
8
- if (Array.isArray(e)) {
9
- const n = [];
10
- for (e of e.flat(1 / 0)) {
11
- const t = f(e, r, i);
12
- t != null && n.push(t);
13
- }
14
- return n.length === 1 ? n[0] : n;
15
- }
16
- if (typeof e == "object" && "nodeName" in e) {
17
- if (typeof e.nodeName == "function") return p(e, r, i);
18
- const n = { nodeName: e.nodeName };
19
- for (const t in e) !A.has(t) && !t.startsWith("set:") && (n[t] = e[t]);
20
- return "children" in e && (n.children = f(e.children, r, i)), n;
21
- }
22
- return String(e);
23
- }
24
- }, p = ({ nodeName: e, fallback: r = e.fallback, ...i }, n, t) => {
25
- if (e.src) {
26
- const o = n();
27
- return t({ id: o, src: e.src, h: i, done: !0 }), m(o, r);
28
- }
29
- const s = e.constructor.name;
30
- if (s === "GeneratorFunction") return x(e, i, n, t);
31
- if (s === "AsyncGeneratorFunction") return G(e, r, i, n, t);
32
- if (i = e(i), i instanceof Promise) {
33
- if (t === y) return r;
34
- const o = n();
35
- return i.then((a) => t({ id: o, h: f(a, (d = o) => n(d), t), done: !0 })), m(o, r);
36
- }
37
- return f(i, n, t);
38
- }, x = (e, r, i, n) => {
39
- var w, S;
40
- const t = { ...e.attrs }, s = { ...e.args };
1
+ import { Context as m, current as f } from "./context.js";
2
+ const w = /* @__PURE__ */ new Set(["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), S = /* @__PURE__ */ new Set(["key", "skip", "memo", "ref"]), $ = /* @__PURE__ */ new Set(["nodeName", "children"]), v = Symbol.for("ajo.args"), g = (e) => e.replace(/[&<>"']/g, (r) => `&#${r.charCodeAt(0)};`), a = () => {
3
+ }, O = (e) => [...b(e)].join(""), b = function* (e, { alloc: r = a, push: n = a, placeholder: t = a } = {}) {
4
+ for (e of u(e, { alloc: r, push: n, placeholder: t }))
5
+ typeof e == "string" ? yield g(e) : yield* x(e, { alloc: r, push: n, placeholder: t });
6
+ }, x = function* (e, r) {
7
+ const { nodeName: n, children: t } = e;
8
+ let l = "";
9
+ for (const i in e)
10
+ $.has(i) || i.startsWith("set:") || e[i] == null || e[i] === !1 || (e[i] === !0 ? l += ` ${i}` : l += ` ${i}="${g(String(e[i]))}"`);
11
+ w.has(n) ? yield `<${n}${l}>` : (yield `<${n}${l}>`, t != null && (yield* b(t, r)), yield `</${n}>`);
12
+ }, u = function* (e, r) {
13
+ if (e == null) return;
14
+ const n = typeof e;
15
+ if (n != "boolean")
16
+ if (n == "string") yield e;
17
+ else if (n == "number" || n == "bigint") yield String(e);
18
+ else if (Symbol.iterator in e) for (e of e) yield* u(e, r);
19
+ else "nodeName" in e ? typeof e.nodeName == "function" ? yield* A(e, r) : yield o(e, r) : yield String(e);
20
+ }, A = function* ({ nodeName: e, fallback: r = e.fallback, ...n }, t) {
21
+ const l = e.constructor.name;
22
+ e.src ? yield G(e.src, n, t) : l == "GeneratorFunction" ? yield j(e, n, t) : l == "AsyncGeneratorFunction" ? yield W(e, r, n, t) : (n = e(n), typeof (n == null ? void 0 : n.then) == "function" ? yield C(r, n, t) : yield* u(n, t));
23
+ }, G = (e, r, n) => {
24
+ const t = n.alloc();
25
+ return n.push({ id: t, src: e, h: o(r, n), done: !0 }), n.placeholder(t);
26
+ }, j = (e, r, n) => {
27
+ var y, p;
28
+ const t = { ...e.attrs }, l = { ...e.args };
41
29
  for (const c in r)
42
- c.startsWith("attr:") ? t[c.slice(5)] = r[c] : b.has(c) || c.startsWith("set:") ? t[c] = r[c] : s[c] = r[c];
43
- const o = {
44
- [$]: Object.assign(/* @__PURE__ */ Object.create(null), (w = u()) == null ? void 0 : w[$]),
45
- [j]: s,
46
- render: y,
47
- next: y,
48
- return: y,
30
+ c.startsWith("attr:") ? t[c.slice(5)] = r[c] : S.has(c) || c.startsWith("set:") ? t[c] = r[c] : l[c] = r[c];
31
+ const i = {
32
+ [m]: Object.create(((y = f()) == null ? void 0 : y[m]) ?? null),
33
+ [v]: l,
34
+ render: a,
35
+ next: a,
36
+ return: a,
49
37
  throw: (c) => {
50
38
  throw c;
51
39
  }
52
- }, a = e.call(o, s), d = u();
53
- u(o);
40
+ }, s = e.call(i, l), d = f();
41
+ f(i);
54
42
  try {
55
- return { ...t, nodeName: e.is ?? "div", children: f(a.next().value, i, n) };
43
+ const c = [...u(s.next().value, n)];
44
+ return { ...t, nodeName: e.is ?? "div", children: c.length == 1 ? c[0] : c };
56
45
  } finally {
57
- (S = a.return) == null || S.call(a), u(d);
46
+ (p = s.return) == null || p.call(s), f(d);
58
47
  }
59
- }, G = (e, r, i, n, t) => {
60
- if (t === y) return r;
61
- const s = n();
48
+ }, W = (e, r, n, t) => {
49
+ const l = t.alloc();
62
50
  return Promise.resolve().then(async () => {
63
- var a;
64
- n = (d = s) => n(d);
65
- const o = e(i);
51
+ var s;
52
+ const i = e(n);
53
+ t = { ...t, alloc: (d = l) => t.alloc(d) };
66
54
  try {
67
- for (i = await o.next(); !i.done; )
68
- t({ id: s, h: f(i.value, n, t), done: !1 }), i = await o.next();
69
- t({ id: s, h: f(i.value, n, t), done: !0 });
55
+ for (n = await i.next(); !n.done; )
56
+ t.push({ id: l, h: o(n.value, t), done: !1 }), n = await i.next();
57
+ t.push({ id: l, h: o(n.value, t), done: !0 });
70
58
  } catch (d) {
71
- t({ id: s, h: f(d, n, t), done: !0 });
59
+ t.push({ id: l, h: o(d, t), done: !0 });
72
60
  } finally {
73
- (a = o.return) == null || a.call(o);
61
+ (s = i.return) == null || s.call(i);
74
62
  }
75
- }), m(s, r);
76
- }, g = function* (e) {
77
- if (typeof e == "string") yield l(e);
78
- else if (Array.isArray(e)) for (e of e) yield* g(e);
79
- else if (typeof e == "object" && "nodeName" in e) {
80
- const { nodeName: r, children: i } = e;
81
- let n = "";
82
- for (const t in e)
83
- A.has(t) || t.startsWith("set:") || e[t] == null || e[t] === !1 || (e[t] === !0 ? n += ` ${t}` : n += ` ${t}="${l(String(e[t]))}"`);
84
- v.has(r) ? yield `<${r}${n}>` : (yield `<${r}${n}>`, i != null && (yield* g(i)), yield `</${r}>`);
85
- } else yield l(String(e));
63
+ }), t.placeholder(l, r);
64
+ }, C = (e, r, n) => {
65
+ const t = n.alloc();
66
+ return r.then((l) => n.push({ id: t, h: o(l, { ...n, alloc: (i = t) => n.alloc(i) }), done: !0 })), n.placeholder(t, e);
67
+ }, o = ({ key: e, skip: r, memo: n, ref: t, ...l }, i) => {
68
+ if ("children" in l) {
69
+ const s = [...u(l.children, i)];
70
+ s.length ? l.children = s.length == 1 ? s[0] : s : delete l.children;
71
+ }
72
+ return l;
86
73
  };
87
74
  export {
88
- k as html,
89
- N as render
75
+ b as html,
76
+ O as render
90
77
  };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./context.cjs"),a=Symbol.for("ajo.key"),b=Symbol.for("ajo.memo"),y=Symbol.for("ajo.ref"),S=Symbol.for("ajo.cache"),f=Symbol.for("ajo.generator"),o=Symbol.for("ajo.iterator"),u=Symbol.for("ajo.args"),p=t=>t.children,A=(t,r,...n)=>((r??(r={})).nodeName=t,!("children"in r)&&n.length&&(r.children=n.length==1?n[0]:n),r),l=(t,r,n=r.firstChild,s)=>{for(t of m(t)){const e=C(t,r,n);e===n?n=n.nextSibling:F(r,e,n)}for(;n&&n!=s;){const e=n.nextSibling;n.nodeType==1&&j(n),r.removeChild(n),n=e}},m=function*(t,r={h:""},n=!0){if(!(t==null||typeof t=="boolean")){if(Array.isArray(t))for(t of t.flat(1/0))yield*m(t,r,!1);else typeof t=="object"&&"nodeName"in t?(r.h&&(yield r.h,r.h=""),typeof t.nodeName=="function"?yield*v(t,r):yield t):r.h+=t;n&&r.h&&(yield r.h)}},v=function*({nodeName:t,...r},n){t.constructor.name=="GeneratorFunction"?yield h(t,r):yield*m(t(r),n,!1)},h=function(t,r){const n={...t.attrs},s={...t.args};for(const e in r)e.startsWith("attr:")?n[e.slice(5)]=r[e]:e=="key"||e=="memo"||e.startsWith("set:")?n[e]=r[e]:s[e]=r[e];return{...n,nodeName:t.is??"div",skip:!0,ref:W.bind(null,t,s)}},C=(t,r,n)=>typeof t=="string"?N(t,n):O(t,r,n),N=(t,r)=>{for(;r&&r.nodeType!=3;)r=r.nextSibling;return r?r.data!=t&&(r.data=t):r=document.createTextNode(t),r},O=({nodeName:t,children:r,key:n,skip:s,memo:e,ref:g,...x},w,i)=>{for(;i&&!(i.localName==t&&(i[a]??(i[a]=n))==n);)i=i.nextSibling;return i??(i=Object.assign(document.createElementNS(x.xmlns??w.namespaceURI,t),{[a]:n})),(e==null||E(i[b],i[b]=e))&&(k(i[S]??T(i),i[S]=x,i),s||l(r,i),typeof g=="function"&&(i[y]=g)(i)),i},k=(t,r,n)=>{for(const s in{...t,...r})t[s]!==r[s]&&(s.startsWith("set:")?n[s.slice(4)]=r[s]:r[s]==null||r[s]===!1?n.removeAttribute(s):n.setAttribute(s,r[s]===!0?"":r[s]))},E=(t,r)=>Array.isArray(t)&&Array.isArray(r)?t.some((n,s)=>n!==r[s]):t!==r,T=t=>Array.from(t.attributes).reduce((r,n)=>(r[n.name]=n.value,r),{}),F=(t,r,n)=>{if(!r.contains(document.activeElement))return t.insertBefore(r,n);const s=r.nextSibling;for(;n&&n!=r;){const e=n.nextSibling;t.insertBefore(n,s),n=e}},j=t=>{var r;for(const n of t.children)j(n);(r=t[y])==null||r.call(t,null)},W=(t,{skip:r,ref:n,...s},e)=>{e&&(e[f]??(e[f]=(B(e),t)),e[y]=M.bind(null,n,e),Object.assign(e[u]??(e[u]={}),s),r||e.next())},B=t=>{var r;Object.assign(t,R),t[c.Context]=Object.create(((r=c.current())==null?void 0:r[c.Context])??null)},M=(t,r,n)=>{typeof t=="function"&&t(n),n||r.return()},R={render(){var t;(t=c.current())!=null&&t.contains(this)||this.next()},next(){var r;const t=c.current();c.current(this);try{const{value:n,done:s}=(this[o]??(this[o]=this[f].call(this,this[u]))).next();l(n,this),(r=this[y])==null||r.call(this,this),s&&this.return()}catch(n){this.throw(n)}finally{c.current(t)}},throw(t){var r;for(let n=this;n;n=n.parentNode)if(typeof((r=n[o])==null?void 0:r.throw)=="function")try{return l(n[o].throw(t).value,n)}catch(s){t=new Error(s instanceof Error?s.message:s,{cause:t})}throw t},return(){var t;try{(t=this[o])==null||t.return()}catch(r){this.throw(r)}finally{this[o]=null}}};exports.Fragment=p;exports.h=A;exports.render=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./context.cjs"),u=Symbol.for("ajo.keyed"),b=Symbol.for("ajo.key"),j=Symbol.for("ajo.memo"),m=Symbol.for("ajo.ref"),v=Symbol.for("ajo.cache"),f=Symbol.for("ajo.generator"),o=Symbol.for("ajo.iterator"),l=Symbol.for("ajo.args"),p=t=>t.children,A=(t,r,...n)=>((r??(r={})).nodeName=t,!("children"in r)&&n.length&&(r.children=n.length==1?n[0]:n),r),y=(t,r)=>{let n=r.firstChild;for(t of S(t)){const e=O(t,r,n);n==null?g(r,e):e==n?n=n.nextSibling:g(r,e,e==n.nextSibling?n=C(r,n):n)}for(;n;){const e=n.nextSibling;r.removeChild(n),n=e}},C=(t,r)=>{const n=r.nextSibling;return g(t,r),n.nextSibling},S=function*(t){if(t==null)return;const r=typeof t;if(r!="boolean")if(r=="string")yield t;else if(r=="number"||r=="bigint")yield String(t);else if(Symbol.iterator in t)for(t of t)yield*S(t);else"nodeName"in t?typeof t.nodeName=="function"?yield*E(t):yield t:yield String(t)},E=function*({nodeName:t,...r}){t.constructor.name=="GeneratorFunction"?yield N(t,r):yield*S(t(r))},N=function(t,r){const n={...t.attrs},e={...t.args};for(const i in r)i.startsWith("attr:")?n[i.slice(5)]=r[i]:i=="key"||i=="memo"||i.startsWith("set:")?n[i]=r[i]:e[i]=r[i];return{...n,nodeName:t.is??"div",skip:!0,ref:B.bind(null,t,e)}},O=(t,r,n)=>typeof t=="string"?M(t,n):T(t,r,n),M=(t,r)=>{for(;r&&r.nodeType!=3;)r=r.nextSibling;return r?r.data!=t&&(r.data=t):r=document.createTextNode(t),r},T=({nodeName:t,children:r,key:n,skip:e,memo:i,ref:w,...h},a,s)=>{for(n!=null&&(s=(a[u]??(a[u]=new Map)).get(n)??s);s&&s.localName!=t;)s=s.nextSibling;return s??(s=document.createElementNS(h.xmlns??a.namespaceURI,t)),n!=s[b]&&(s[b]!=null&&x(s),a[u].set(s[b]=n,s)),(i==null||F(s[j],s[j]=i))&&(k(s[v]??W(s),s[v]=h,s),e||y(r,s),typeof w=="function"&&(s[m]=w)(s)),s},k=(t,r,n)=>{for(const e in{...t,...r})t[e]!==r[e]&&(e.startsWith("set:")?n[e.slice(4)]=r[e]:r[e]==null||r[e]===!1?n.removeAttribute(e):n.setAttribute(e,r[e]===!0?"":r[e]))},F=(t,r)=>Array.isArray(t)&&Array.isArray(r)?t.some((n,e)=>n!==r[e]):t!==r,W=t=>Array.from(t.attributes).reduce((r,n)=>(r[n.name]=n.value,r),{}),g=(t,r,n)=>{if(!r.contains(document.activeElement))return t.insertBefore(r,n);const e=r.nextSibling;for(;n&&n!=r;){const i=n.nextSibling;t.insertBefore(n,e),n=i}},x=t=>{var r,n;for(const e of t.children)x(e);(r=t[u])==null||r.clear(),t[f]&&(t[f]=null),(n=t[m])==null||n.call(t,null)},B=(t,{skip:r,ref:n,...e},i)=>{i&&(i[f]??(i[f]=(R(i),t)),i[m]=q.bind(null,n,i),Object.assign(i[l]??(i[l]={}),e),r||i.next())},R=t=>{var r;Object.assign(t,L),t[c.Context]=Object.create(((r=c.current())==null?void 0:r[c.Context])??null)},q=(t,r,n)=>{typeof t=="function"&&t(n),n||r.return()},L={render(){var t;(t=c.current())!=null&&t.contains(this)||this.next()},next(){var r;const t=c.current();c.current(this);try{const{value:n,done:e}=(this[o]??(this[o]=this[f].call(this,this[l]))).next();y(n,this),(r=this[m])==null||r.call(this,this),e&&this.return()}catch(n){this.throw(n)}finally{c.current(t)}},throw(t){var r;for(let n=this;n;n=n.parentNode)if(typeof((r=n[o])==null?void 0:r.throw)=="function")try{return y(n[o].throw(t).value,n)}catch(e){t=new Error(e instanceof Error?e.message:e,{cause:t})}throw t},return(){var t;try{(t=this[o])==null||t.return()}catch(r){this.throw(r)}finally{this[o]=null}}};"MutationObserver"in globalThis&&new MutationObserver(t=>t.forEach(r=>r.removedNodes.forEach(n=>n.isConnected||n.nodeType==1&&x(n)))).observe(document,{childList:!0,subtree:!0});exports.Fragment=p;exports.h=A;exports.render=y;
package/dist/index.js CHANGED
@@ -1,54 +1,60 @@
1
- import { Context as b, current as a } from "./context.js";
2
- const c = Symbol.for("ajo.key"), S = Symbol.for("ajo.memo"), l = Symbol.for("ajo.ref"), j = Symbol.for("ajo.cache"), f = Symbol.for("ajo.generator"), o = Symbol.for("ajo.iterator"), u = Symbol.for("ajo.args"), I = (t) => t.children, M = (t, r, ...n) => ((r ?? (r = {})).nodeName = t, !("children" in r) && n.length && (r.children = n.length == 1 ? n[0] : n), r), y = (t, r, n = r.firstChild, s) => {
3
- for (t of m(t)) {
4
- const e = h(t, r, n);
5
- e === n ? n = n.nextSibling : T(r, e, n);
1
+ import { Context as j, current as a } from "./context.js";
2
+ const u = Symbol.for("ajo.keyed"), y = Symbol.for("ajo.key"), p = Symbol.for("ajo.memo"), m = Symbol.for("ajo.ref"), v = Symbol.for("ajo.cache"), c = Symbol.for("ajo.generator"), o = Symbol.for("ajo.iterator"), l = Symbol.for("ajo.args"), q = (t) => t.children, z = (t, r, ...n) => ((r ?? (r = {})).nodeName = t, !("children" in r) && n.length && (r.children = n.length == 1 ? n[0] : n), r), b = (t, r) => {
3
+ let n = r.firstChild;
4
+ for (t of x(t)) {
5
+ const i = C(t, r, n);
6
+ n == null ? g(r, i) : i == n ? n = n.nextSibling : g(r, i, i == n.nextSibling ? n = A(r, n) : n);
6
7
  }
7
- for (; n && n != s; ) {
8
- const e = n.nextSibling;
9
- n.nodeType == 1 && w(n), r.removeChild(n), n = e;
10
- }
11
- }, m = function* (t, r = { h: "" }, n = !0) {
12
- if (!(t == null || typeof t == "boolean")) {
13
- if (Array.isArray(t)) for (t of t.flat(1 / 0)) yield* m(t, r, !1);
14
- else typeof t == "object" && "nodeName" in t ? (r.h && (yield r.h, r.h = ""), typeof t.nodeName == "function" ? yield* A(t, r) : yield t) : r.h += t;
15
- n && r.h && (yield r.h);
8
+ for (; n; ) {
9
+ const i = n.nextSibling;
10
+ r.removeChild(n), n = i;
16
11
  }
17
- }, A = function* ({ nodeName: t, ...r }, n) {
18
- t.constructor.name == "GeneratorFunction" ? yield v(t, r) : yield* m(t(r), n, !1);
19
- }, v = function(t, r) {
20
- const n = { ...t.attrs }, s = { ...t.args };
12
+ }, A = (t, r) => {
13
+ const n = r.nextSibling;
14
+ return g(t, r), n.nextSibling;
15
+ }, x = function* (t) {
16
+ if (t == null) return;
17
+ const r = typeof t;
18
+ if (r != "boolean")
19
+ if (r == "string") yield t;
20
+ else if (r == "number" || r == "bigint") yield String(t);
21
+ else if (Symbol.iterator in t) for (t of t) yield* x(t);
22
+ else "nodeName" in t ? typeof t.nodeName == "function" ? yield* E(t) : yield t : yield String(t);
23
+ }, E = function* ({ nodeName: t, ...r }) {
24
+ t.constructor.name == "GeneratorFunction" ? yield N(t, r) : yield* x(t(r));
25
+ }, N = function(t, r) {
26
+ const n = { ...t.attrs }, i = { ...t.args };
21
27
  for (const e in r)
22
- e.startsWith("attr:") ? n[e.slice(5)] = r[e] : e == "key" || e == "memo" || e.startsWith("set:") ? n[e] = r[e] : s[e] = r[e];
23
- return { ...n, nodeName: t.is ?? "div", skip: !0, ref: W.bind(null, t, s) };
24
- }, h = (t, r, n) => typeof t == "string" ? N(t, n) : k(t, r, n), N = (t, r) => {
28
+ e.startsWith("attr:") ? n[e.slice(5)] = r[e] : e == "key" || e == "memo" || e.startsWith("set:") ? n[e] = r[e] : i[e] = r[e];
29
+ return { ...n, nodeName: t.is ?? "div", skip: !0, ref: B.bind(null, t, i) };
30
+ }, C = (t, r, n) => typeof t == "string" ? O(t, n) : k(t, r, n), O = (t, r) => {
25
31
  for (; r && r.nodeType != 3; ) r = r.nextSibling;
26
32
  return r ? r.data != t && (r.data = t) : r = document.createTextNode(t), r;
27
- }, k = ({ nodeName: t, children: r, key: n, skip: s, memo: e, ref: x, ...g }, p, i) => {
28
- for (; i && !(i.localName == t && (i[c] ?? (i[c] = n)) == n); ) i = i.nextSibling;
29
- return i ?? (i = Object.assign(document.createElementNS(g.xmlns ?? p.namespaceURI, t), { [c]: n })), (e == null || E(i[S], i[S] = e)) && (C(i[j] ?? O(i), i[j] = g, i), s || y(r, i), typeof x == "function" && (i[l] = x)(i)), i;
30
- }, C = (t, r, n) => {
31
- for (const s in { ...t, ...r })
32
- t[s] !== r[s] && (s.startsWith("set:") ? n[s.slice(4)] = r[s] : r[s] == null || r[s] === !1 ? n.removeAttribute(s) : n.setAttribute(s, r[s] === !0 ? "" : r[s]));
33
- }, E = (t, r) => Array.isArray(t) && Array.isArray(r) ? t.some((n, s) => n !== r[s]) : t !== r, O = (t) => Array.from(t.attributes).reduce((r, n) => (r[n.name] = n.value, r), {}), T = (t, r, n) => {
33
+ }, k = ({ nodeName: t, children: r, key: n, skip: i, memo: e, ref: w, ...h }, f, s) => {
34
+ for (n != null && (s = (f[u] ?? (f[u] = /* @__PURE__ */ new Map())).get(n) ?? s); s && s.localName != t; ) s = s.nextSibling;
35
+ return s ?? (s = document.createElementNS(h.xmlns ?? f.namespaceURI, t)), n != s[y] && (s[y] != null && S(s), f[u].set(s[y] = n, s)), (e == null || T(s[p], s[p] = e)) && (M(s[v] ?? W(s), s[v] = h, s), i || b(r, s), typeof w == "function" && (s[m] = w)(s)), s;
36
+ }, M = (t, r, n) => {
37
+ for (const i in { ...t, ...r })
38
+ t[i] !== r[i] && (i.startsWith("set:") ? n[i.slice(4)] = r[i] : r[i] == null || r[i] === !1 ? n.removeAttribute(i) : n.setAttribute(i, r[i] === !0 ? "" : r[i]));
39
+ }, T = (t, r) => Array.isArray(t) && Array.isArray(r) ? t.some((n, i) => n !== r[i]) : t !== r, W = (t) => Array.from(t.attributes).reduce((r, n) => (r[n.name] = n.value, r), {}), g = (t, r, n) => {
34
40
  if (!r.contains(document.activeElement)) return t.insertBefore(r, n);
35
- const s = r.nextSibling;
41
+ const i = r.nextSibling;
36
42
  for (; n && n != r; ) {
37
43
  const e = n.nextSibling;
38
- t.insertBefore(n, s), n = e;
44
+ t.insertBefore(n, i), n = e;
39
45
  }
40
- }, w = (t) => {
41
- var r;
42
- for (const n of t.children) w(n);
43
- (r = t[l]) == null || r.call(t, null);
44
- }, W = (t, { skip: r, ref: n, ...s }, e) => {
45
- e && (e[f] ?? (e[f] = (B(e), t)), e[l] = F.bind(null, n, e), Object.assign(e[u] ?? (e[u] = {}), s), r || e.next());
46
- }, B = (t) => {
46
+ }, S = (t) => {
47
+ var r, n;
48
+ for (const i of t.children) S(i);
49
+ (r = t[u]) == null || r.clear(), t[c] && (t[c] = null), (n = t[m]) == null || n.call(t, null);
50
+ }, B = (t, { skip: r, ref: n, ...i }, e) => {
51
+ e && (e[c] ?? (e[c] = (F(e), t)), e[m] = R.bind(null, n, e), Object.assign(e[l] ?? (e[l] = {}), i), r || e.next());
52
+ }, F = (t) => {
47
53
  var r;
48
- Object.assign(t, R), t[b] = Object.create(((r = a()) == null ? void 0 : r[b]) ?? null);
49
- }, F = (t, r, n) => {
54
+ Object.assign(t, L), t[j] = Object.create(((r = a()) == null ? void 0 : r[j]) ?? null);
55
+ }, R = (t, r, n) => {
50
56
  typeof t == "function" && t(n), n || r.return();
51
- }, R = {
57
+ }, L = {
52
58
  render() {
53
59
  var t;
54
60
  (t = a()) != null && t.contains(this) || this.next();
@@ -58,8 +64,8 @@ const c = Symbol.for("ajo.key"), S = Symbol.for("ajo.memo"), l = Symbol.for("ajo
58
64
  const t = a();
59
65
  a(this);
60
66
  try {
61
- const { value: n, done: s } = (this[o] ?? (this[o] = this[f].call(this, this[u]))).next();
62
- y(n, this), (r = this[l]) == null || r.call(this, this), s && this.return();
67
+ const { value: n, done: i } = (this[o] ?? (this[o] = this[c].call(this, this[l]))).next();
68
+ b(n, this), (r = this[m]) == null || r.call(this, this), i && this.return();
63
69
  } catch (n) {
64
70
  this.throw(n);
65
71
  } finally {
@@ -69,9 +75,9 @@ const c = Symbol.for("ajo.key"), S = Symbol.for("ajo.memo"), l = Symbol.for("ajo
69
75
  throw(t) {
70
76
  var r;
71
77
  for (let n = this; n; n = n.parentNode) if (typeof ((r = n[o]) == null ? void 0 : r.throw) == "function") try {
72
- return y(n[o].throw(t).value, n);
73
- } catch (s) {
74
- t = new Error(s instanceof Error ? s.message : s, { cause: t });
78
+ return b(n[o].throw(t).value, n);
79
+ } catch (i) {
80
+ t = new Error(i instanceof Error ? i.message : i, { cause: t });
75
81
  }
76
82
  throw t;
77
83
  },
@@ -86,8 +92,11 @@ const c = Symbol.for("ajo.key"), S = Symbol.for("ajo.memo"), l = Symbol.for("ajo
86
92
  }
87
93
  }
88
94
  };
95
+ "MutationObserver" in globalThis && new MutationObserver(
96
+ (t) => t.forEach((r) => r.removedNodes.forEach((n) => n.isConnected || n.nodeType == 1 && S(n)))
97
+ ).observe(document, { childList: !0, subtree: !0 });
89
98
  export {
90
- I as Fragment,
91
- M as h,
92
- y as render
99
+ q as Fragment,
100
+ z as h,
101
+ b as render
93
102
  };
package/dist/stream.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index.cjs"),d=require("./html.cjs"),h=async function*(n){const t=new Set,e=[],s=new Map,l=(i="")=>{const r=s.get(i)??(s.set(i,0),0);return s.set(i,r+1),i?`${i}:${r}`:String(r)},c=i=>{const r=Promise.resolve(`<script>window.$stream?.push(${JSON.stringify(i)})<\/script>`);t.add(r),r.then(a=>e.push(a)).finally(()=>t.delete(r))};for(n of d.html(n,l,c))yield n;for(;t.size;)for(await Promise.race(t);e.length;)yield e.shift();for(;e.length;)yield e.shift()},u=async({id:n,src:t,h:e})=>{const s=document.querySelector(`[data-ssr="${n}"]`);s&&(t?o.render(o.h((await import(t)).default,e),s):o.render(e,s))};exports.hydrate=u;exports.stream=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index.cjs"),m=require("./html.cjs"),y=async function*(o,n=""){const s=new Map([[n,0]]),t=new Set,i=[],r=(e=n)=>(s.set(e,(s.get(e)??0)+1),e?`${e}:${s.get(e)-1}`:String(s.get(e)-1)),h=(e,c)=>({nodeName:"div","data-ssr":e,children:c}),f=e=>{const c=Promise.resolve(`<script>window.$stream?.push(${JSON.stringify(e)})<\/script>`);t.add(c),c.then(u=>i.push(u)).finally(()=>t.delete(c))};for(const e of m.html(o,{alloc:r,placeholder:h,push:f}))yield e;for(;t.size||i.length;){for(;i.length;)yield i.shift();t.size&&await Promise.race(t)}},d=new Set;async function l({id:o,src:n,h:s}){const t=document.querySelector(`[data-ssr="${o}"]`);if(!t)return d.add({id:o,src:n,h:s});n?a.render(a.h((await import(n)).default,s),t):a.render(s,t);const i=o+":";for(const r of d)r.id.startsWith(i)&&(d.delete(r),l(r))}exports.hydrate=l;exports.stream=y;
package/dist/stream.js CHANGED
@@ -1,22 +1,24 @@
1
- import { render as n, h as d } from "./index.js";
2
- import { html as h } from "./html.js";
3
- const u = async function* (r) {
4
- const e = /* @__PURE__ */ new Set(), t = [], s = /* @__PURE__ */ new Map(), l = (i = "") => {
5
- const o = s.get(i) ?? (s.set(i, 0), 0);
6
- return s.set(i, o + 1), i ? `${i}:${o}` : String(o);
7
- }, c = (i) => {
8
- const o = Promise.resolve(`<script>window.$stream?.push(${JSON.stringify(i)})<\/script>`);
9
- e.add(o), o.then((a) => t.push(a)).finally(() => e.delete(o));
1
+ import { render as l, h as m } from "./index.js";
2
+ import { html as u } from "./html.js";
3
+ const y = async function* (i, n = "") {
4
+ const s = /* @__PURE__ */ new Map([[n, 0]]), e = /* @__PURE__ */ new Set(), o = [], c = (t = n) => (s.set(t, (s.get(t) ?? 0) + 1), t ? `${t}:${s.get(t) - 1}` : String(s.get(t) - 1)), d = (t, r) => ({ nodeName: "div", "data-ssr": t, children: r }), f = (t) => {
5
+ const r = Promise.resolve(`<script>window.$stream?.push(${JSON.stringify(t)})<\/script>`);
6
+ e.add(r), r.then((h) => o.push(h)).finally(() => e.delete(r));
10
7
  };
11
- for (r of h(r, l, c)) yield r;
12
- for (; e.size; )
13
- for (await Promise.race(e); t.length; ) yield t.shift();
14
- for (; t.length; ) yield t.shift();
15
- }, w = async ({ id: r, src: e, h: t }) => {
16
- const s = document.querySelector(`[data-ssr="${r}"]`);
17
- s && (e ? n(d((await import(e)).default, t), s) : n(t, s));
18
- };
8
+ for (const t of u(i, { alloc: c, placeholder: d, push: f })) yield t;
9
+ for (; e.size || o.length; ) {
10
+ for (; o.length; ) yield o.shift();
11
+ e.size && await Promise.race(e);
12
+ }
13
+ }, a = /* @__PURE__ */ new Set();
14
+ async function p({ id: i, src: n, h: s }) {
15
+ const e = document.querySelector(`[data-ssr="${i}"]`);
16
+ if (!e) return a.add({ id: i, src: n, h: s });
17
+ n ? l(m((await import(n)).default, s), e) : l(s, e);
18
+ const o = i + ":";
19
+ for (const c of a) c.id.startsWith(o) && (a.delete(c), p(c));
20
+ }
19
21
  export {
20
- w as hydrate,
21
- u as stream
22
+ p as hydrate,
23
+ y as stream
22
24
  };
package/package.json CHANGED
@@ -1,24 +1,27 @@
1
1
  {
2
2
  "name": "ajo",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "ajo is a JavaScript view library for building user interfaces",
5
5
  "type": "module",
6
+ "types": "./types.ts",
7
+ "module": "./dist/index.js",
8
+ "main": "./dist/index.cjs",
6
9
  "exports": {
7
10
  ".": {
8
11
  "types": "./types.ts",
9
12
  "import": "./dist/index.js",
10
13
  "require": "./dist/index.cjs"
11
14
  },
12
- "./html": {
13
- "types": "./types.ts",
14
- "import": "./dist/html.js",
15
- "require": "./dist/html.cjs"
16
- },
17
15
  "./context": {
18
16
  "types": "./types.ts",
19
17
  "import": "./dist/context.js",
20
18
  "require": "./dist/context.cjs"
21
19
  },
20
+ "./html": {
21
+ "types": "./types.ts",
22
+ "import": "./dist/html.js",
23
+ "require": "./dist/html.cjs"
24
+ },
22
25
  "./stream": {
23
26
  "types": "./types.ts",
24
27
  "import": "./dist/stream.js",
@@ -29,12 +32,6 @@
29
32
  "dist",
30
33
  "types.ts"
31
34
  ],
32
- "scripts": {
33
- "test": "vitest --run",
34
- "build": "vite build",
35
- "bump": "pnpm version patch && git push && git push --tags",
36
- "release": "pnpm test && pnpm build && pnpm bump && pnpm publish"
37
- },
38
35
  "devDependencies": {
39
36
  "@types/node": "24.0.0",
40
37
  "happy-dom": "18.0.1",
@@ -53,5 +50,11 @@
53
50
  "author": "Cristian Falcone",
54
51
  "license": "ISC",
55
52
  "bugs": "https://github.com/cristianfalcone/ajo/issues",
56
- "homepage": "https://github.com/cristianfalcone/ajo#readme"
57
- }
53
+ "homepage": "https://github.com/cristianfalcone/ajo#readme",
54
+ "scripts": {
55
+ "test": "vitest --run",
56
+ "build": "vite build",
57
+ "bump": "pnpm version patch && git push && git push --tags",
58
+ "release": "pnpm test && pnpm build && pnpm bump && pnpm publish"
59
+ }
60
+ }
package/types.ts CHANGED
@@ -1,88 +1,99 @@
1
1
  declare module 'ajo' {
2
2
 
3
- type Tag = keyof (HTMLElementTagNameMap & SVGElementTagNameMap)
3
+ type Tag = keyof (HTMLElementTagNameMap & SVGElementTagNameMap)
4
4
 
5
- type Type = Tag | Stateless | Stateful
5
+ type Type = Tag | Stateless | Stateful
6
6
 
7
- type Component<TProps extends Props = {}> = Stateless<TProps> | Stateful<TProps>
7
+ type Component<TProps extends Props = {}> = Stateless<TProps> | Stateful<TProps>
8
8
 
9
- type Props = Record<string, unknown>
9
+ type Props = Record<string, unknown>
10
10
 
11
- type VNode<TTag extends Type, TProps extends Props> = TProps & {
12
- nodeName: TTag,
13
- children?: Children,
14
- }
11
+ type VNode<TTag extends Type, TProps extends Props> = TProps & {
12
+ nodeName: TTag,
13
+ children?: Children,
14
+ }
15
15
 
16
- type Children = unknown
16
+ type Children = unknown
17
17
 
18
- type ElementType<TTag> = TTag extends keyof HTMLElementTagNameMap
19
- ? HTMLElementTagNameMap[TTag]
20
- : TTag extends keyof SVGElementTagNameMap
21
- ? SVGElementTagNameMap[TTag]
22
- : never
18
+ type ElementType<TTag> = TTag extends keyof HTMLElementTagNameMap
19
+ ? HTMLElementTagNameMap[TTag]
20
+ : TTag extends keyof SVGElementTagNameMap
21
+ ? SVGElementTagNameMap[TTag]
22
+ : never
23
23
 
24
- type SpecialProps<TElement> = {
25
- key: unknown,
26
- skip: boolean,
27
- memo: unknown,
28
- ref: (el: TElement | null) => void,
29
- } & ElementChildrenAttribute
24
+ type SpecialProps<TElement> = {
25
+ key: unknown,
26
+ skip: boolean,
27
+ memo: unknown,
28
+ ref: (el: TElement | null) => void,
29
+ } & ElementChildrenAttribute
30
30
 
31
- type PropSetter<TTag> = {
32
- [K in keyof ElementType<TTag> as `set:${Exclude<K, symbol>}`]: ElementType<TTag>[K]
33
- }
31
+ type PropSetter<TTag> = {
32
+ [K in keyof ElementType<TTag> as `set:${Exclude<K, symbol>}`]: ElementType<TTag>[K]
33
+ }
34
34
 
35
- type AttrSetter = {
36
- [key: `attr:${string}`]: unknown
37
- }
35
+ type AttrSetter = {
36
+ [key: `attr:${string}`]: unknown
37
+ }
38
38
 
39
- type Stateless<TArguments extends Props = {}> = (args: TArguments) => Children
39
+ type Stateless<TArguments extends Props = {}> = (args: TArguments) => Children
40
40
 
41
- type Stateful<TArguments extends Props = {}, TTag extends Tag = 'div'> = {
42
- (this: StatefulElement<TTag>, args: StatefulProps<TArguments, TTag>): Iterator<Children>
43
- } & (TTag extends 'div' ? { is?: TTag } : { is: TTag }) & { attrs?: Partial<PropSetter<TTag>> & Props, args?: Partial<TArguments> }
41
+ type Stateful<TArguments extends Props = {}, TTag extends Tag = 'div'> = {
42
+ (this: StatefulElement<TTag>, args: StatefulProps<TArguments, TTag>): Iterator<Children>
43
+ } & (TTag extends 'div' ? { is?: TTag } : { is: TTag }) & { attrs?: Partial<PropSetter<TTag>> & Props, args?: Partial<TArguments> }
44
44
 
45
- type StatefulProps<TArguments, TTag> =
46
- Partial<SpecialProps<StatefulElement<TTag>> & PropSetter<TTag>> &
47
- AttrSetter &
48
- TArguments
45
+ type StatefulProps<TArguments, TTag> =
46
+ Partial<SpecialProps<StatefulElement<TTag>> & PropSetter<TTag>> &
47
+ AttrSetter &
48
+ TArguments
49
49
 
50
- type StatefulElement<TTag> = ElementType<TTag> & {
51
- render: () => void,
52
- next: () => void,
53
- throw: (value?: unknown) => void,
54
- return: () => void,
55
- }
50
+ type StatefulElement<TTag> = ElementType<TTag> & {
51
+ render: () => void,
52
+ next: () => void,
53
+ throw: (value?: unknown) => void,
54
+ return: () => void,
55
+ }
56
56
 
57
- type IntrinsicElements = {
58
- [TTag in Tag]: Partial<PropSetter<TTag> & SpecialProps<ElementType<TTag>>> & Props
59
- }
57
+ type IntrinsicElements = {
58
+ [TTag in Tag]: Partial<PropSetter<TTag> & SpecialProps<ElementType<TTag>>> & Props
59
+ }
60
60
 
61
- type ElementChildrenAttribute = { children: Children }
61
+ type ElementChildrenAttribute = { children: Children }
62
62
 
63
- function Fragment({ children }: ElementChildrenAttribute): typeof children
64
- function h(tag: Type, props?: Props | null, ...children: Children[]): VNode<Type, Props>
65
- function render(h: Children, el: Element, child?: Node, ref?: Node): void
63
+ function Fragment({ children }: ElementChildrenAttribute): typeof children
64
+ function h(tag: Type, props?: Props | null, ...children: Children[]): VNode<Type, Props>
65
+ function render(h: Children, el: Element, child?: Node, ref?: Node): void
66
66
  }
67
67
 
68
- declare module 'ajo/html' {
68
+ declare module 'ajo/context' {
69
+ function context<T>(fallback?: T): (value?: T) => T
70
+ }
69
71
 
70
- type Patch = { id: string, h?: import('ajo').Children, src?: string, done?: boolean }
72
+ declare module 'ajo/html' {
71
73
 
72
- function render(h: import('ajo').Children): string
73
- function html(h: import('ajo').Children, alloc?: (parentId: string) => string, push?: (patch: Patch) => void): IterableIterator<string>
74
+ type Patch = {
75
+ id: string,
76
+ h: import('ajo').Children,
77
+ src?: string,
78
+ done: boolean,
79
+ }
80
+
81
+ type Hooks = {
82
+ alloc?: (parentId: string) => string,
83
+ placeholder?: (id: string, children: import('ajo').Children) => unknown,
84
+ push?: (patch: Patch) => void,
85
+ }
86
+
87
+ function render(h: import('ajo').Children): string
88
+ function html(h: import('ajo').Children, hooks?: Hooks): IterableIterator<string>
74
89
  }
75
90
 
76
91
  declare module 'ajo/stream' {
77
- function stream(h: import('ajo').Children): AsyncIterableIterator<string>
78
- function hydrate(patch: import('ajo/html').Patch): Promise<void>
79
- }
80
-
81
- declare module 'ajo/context' {
82
- function context<T>(fallback?: T): (value?: T) => T
92
+ function stream(h: import('ajo').Children): AsyncIterableIterator<string>
93
+ function hydrate(patch: import('ajo/html').Patch): Promise<void>
83
94
  }
84
95
 
85
96
  declare namespace JSX {
86
- type ElementChildrenAttribute = import('ajo').ElementChildrenAttribute
87
- type IntrinsicElements = import('ajo').IntrinsicElements
97
+ type ElementChildrenAttribute = import('ajo').ElementChildrenAttribute
98
+ type IntrinsicElements = import('ajo').IntrinsicElements
88
99
  }