ajo 0.1.4 → 0.1.6

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./jsx.cjs"),o=require("./util-f79f2bb8.cjs"),f=require("./html.cjs"),m=require("./dom.cjs");let v=0,w;const x=(n,{as:t}={})=>{var a;if(((a=n==null?void 0:n.constructor)==null?void 0:a.name)!=="GeneratorFunction")throw new TypeError("fn is not a generator function");const i=`host-${v++}`;if(!globalThis.document)return({attrs:s={},args:e={},...c})=>{y(s,e,c);let r,u;try{const h=n.call(r={args:e,*[Symbol.iterator](){for(;;)yield e},next(){u=f.render(h.next().value)},throw(p){u=f.render(h.throw(p).value)},return(){h.return()}},e);r.next()}catch(h){r.throw(h)}finally{r.return()}return d.h(t||i,o.assign(s,{is:t&&i}),u)};class l extends b(t){*[Symbol.iterator](){for(;;)yield this.args}next(){var e;try{m.render((this[e=o.Iterator]??(this[e]=n.call(this,this.args))).next().value,this),typeof this[o.Ref]=="function"&&this[o.Ref](this)}catch(c){this.throw(c)}}throw(e){var c;for(let r=this;r;r=r.parentNode)if(typeof((c=r[o.Iterator])==null?void 0:c.throw)=="function")try{m.render(r[o.Iterator].throw(e).value,r);return}catch{continue}throw e}return(){var e;try{(e=this[o.Iterator])==null||e.return()}catch(c){this.throw(c)}finally{this[o.Iterator]=null}}disconnectedCallback(){this.return()}}return customElements.define(i,l,{extends:t}),({attrs:s={},args:e={},ref:c,...r})=>(y(s,e,r),d.h(t||i,o.assign(s,{is:t&&i,skip:!0,ref:u=>o.assign(u,{[o.Ref]:c,args:e}).next()})))},b=n=>{let t=(w??(w=new Map)).get(n);return t||(t=document.createElement(n).constructor,t===HTMLUnknownElement&&(t=HTMLElement),w.set(n,t)),t},y=(n,t,i)=>{for(const l in i)l.startsWith("arg:")?t[l.slice(4)]=i[l]:l==="children"?t[l]=i[l]:n[l]=i[l]};exports.component=x;
@@ -0,0 +1,89 @@
1
+ import { h as d } from "./jsx.js";
2
+ import { a, I as u, R as m } from "./util-32b33d65.js";
3
+ import { render as w } from "./html.js";
4
+ import { render as p } from "./dom.js";
5
+ let E = 0, y;
6
+ const C = (n, { as: t } = {}) => {
7
+ var f;
8
+ if (((f = n == null ? void 0 : n.constructor) == null ? void 0 : f.name) !== "GeneratorFunction")
9
+ throw new TypeError("fn is not a generator function");
10
+ const o = `host-${E++}`;
11
+ if (!globalThis.document)
12
+ return ({ attrs: c = {}, args: e = {}, ...l }) => {
13
+ x(c, e, l);
14
+ let r, s;
15
+ try {
16
+ const h = n.call(r = {
17
+ args: e,
18
+ *[Symbol.iterator]() {
19
+ for (; ; )
20
+ yield e;
21
+ },
22
+ next() {
23
+ s = w(h.next().value);
24
+ },
25
+ throw(v) {
26
+ s = w(h.throw(v).value);
27
+ },
28
+ return() {
29
+ h.return();
30
+ }
31
+ }, e);
32
+ r.next();
33
+ } catch (h) {
34
+ r.throw(h);
35
+ } finally {
36
+ r.return();
37
+ }
38
+ return d(t || o, a(c, { is: t && o }), s);
39
+ };
40
+ class i extends b(t) {
41
+ *[Symbol.iterator]() {
42
+ for (; ; )
43
+ yield this.args;
44
+ }
45
+ next() {
46
+ var e;
47
+ try {
48
+ p((this[e = u] ?? (this[e] = n.call(this, this.args))).next().value, this), typeof this[m] == "function" && this[m](this);
49
+ } catch (l) {
50
+ this.throw(l);
51
+ }
52
+ }
53
+ throw(e) {
54
+ var l;
55
+ for (let r = this; r; r = r.parentNode)
56
+ if (typeof ((l = r[u]) == null ? void 0 : l.throw) == "function")
57
+ try {
58
+ p(r[u].throw(e).value, r);
59
+ return;
60
+ } catch {
61
+ continue;
62
+ }
63
+ throw e;
64
+ }
65
+ return() {
66
+ var e;
67
+ try {
68
+ (e = this[u]) == null || e.return();
69
+ } catch (l) {
70
+ this.throw(l);
71
+ } finally {
72
+ this[u] = null;
73
+ }
74
+ }
75
+ disconnectedCallback() {
76
+ this.return();
77
+ }
78
+ }
79
+ return customElements.define(o, i, { extends: t }), ({ attrs: c = {}, args: e = {}, ref: l, ...r }) => (x(c, e, r), d(t || o, a(c, { is: t && o, skip: !0, ref: (s) => a(s, { [m]: l, args: e }).next() })));
80
+ }, b = (n) => {
81
+ let t = (y ?? (y = /* @__PURE__ */ new Map())).get(n);
82
+ return t || (t = document.createElement(n).constructor, t === HTMLUnknownElement && (t = HTMLElement), y.set(n, t)), t;
83
+ }, x = (n, t, o) => {
84
+ for (const i in o)
85
+ i.startsWith("arg:") ? t[i.slice(4)] = o[i] : i === "children" ? t[i] = o[i] : n[i] = o[i];
86
+ };
87
+ export {
88
+ C as component
89
+ };
package/dist/dom.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./util-f79f2bb8.cjs"),a=(n,t,o)=>{var r;let i=t.firstChild;for(n of s.normalize(n)){let e=i;if(typeof n=="string"){for(;e&&e.nodeType!=3;)e=e.nextSibling;e?e.data!=n&&(e.data=n):e=document.createTextNode(n)}else{const{xmlns:c=o,nodeName:l,is:y,key:f,skip:b,memo:u,ref:m,children:x,...g}=n;for(;e&&!(e.localName===l&&(e[r=s.Key]??(e[r]=f))==f);)e=e.nextSibling;e??(e=v(c,l,y,f)),(u==null||S(e[s.Memo],e[s.Memo]=u))&&(A(g,e),b||a(x,e,c),typeof m=="function"&&(e[s.Ref]=m)(e))}e===i?i=i.nextSibling:p(t,e,i)}for(;i;){const e=i.nextSibling;t.removeChild(i),i.nodeType===1&&d(i),i=e}},S=(n,t)=>s.isArray(n)&&s.isArray(t)?n.some((o,i)=>o!==t[i]):n!==t,v=(n,t,o,i)=>{const r=n?document.createElementNS(n,t,{is:o}):document.createElement(t,{is:o});return r[s.Key]=i,r},A=(n,t)=>{var i;const o=t[i=s.Attrs]??(t[i]=s.slice.call(t.attributes).reduce((r,{name:e,value:c})=>(r[e]=c,r),{}));for(const r in{...o,...t[s.Attrs]=n}){const e=n[r];e!==o[r]&&(r.startsWith("set:")?t[r.slice(4)]=e:e==null||e===!1?t.removeAttribute(r):t.setAttribute(r,e===!0?"":e))}},p=(n,t,o)=>{if(t.contains(document.activeElement)){const i=t.nextSibling;for(;o&&o!=t;){const r=o.nextSibling;n.insertBefore(o,i),o=r}}else n.insertBefore(t,o)},d=n=>{var t;for(const o of n.children)d(o);(t=n[s.Ref])==null||t.call(n,null)};exports.render=a;
package/dist/dom.js ADDED
@@ -0,0 +1,50 @@
1
+ import { n as A, K as d, M as m, R as b, i as u, A as x, s as w } from "./util-32b33d65.js";
2
+ const N = (n, t, s) => {
3
+ var o;
4
+ let i = t.firstChild;
5
+ for (n of A(n)) {
6
+ let e = i;
7
+ if (typeof n == "string") {
8
+ for (; e && e.nodeType != 3; )
9
+ e = e.nextSibling;
10
+ e ? e.data != n && (e.data = n) : e = document.createTextNode(n);
11
+ } else {
12
+ const { xmlns: r = s, nodeName: f, is: y, key: c, skip: S, memo: a, ref: l, children: p, ...v } = n;
13
+ for (; e && !(e.localName === f && (e[o = d] ?? (e[o] = c)) == c); )
14
+ e = e.nextSibling;
15
+ e ?? (e = T(r, f, y, c)), (a == null || E(e[m], e[m] = a)) && (k(v, e), S || N(p, e, r), typeof l == "function" && (e[b] = l)(e));
16
+ }
17
+ e === i ? i = i.nextSibling : B(t, e, i);
18
+ }
19
+ for (; i; ) {
20
+ const e = i.nextSibling;
21
+ t.removeChild(i), i.nodeType === 1 && g(i), i = e;
22
+ }
23
+ }, E = (n, t) => u(n) && u(t) ? n.some((s, i) => s !== t[i]) : n !== t, T = (n, t, s, i) => {
24
+ const o = n ? document.createElementNS(n, t, { is: s }) : document.createElement(t, { is: s });
25
+ return o[d] = i, o;
26
+ }, k = (n, t) => {
27
+ var i;
28
+ const s = t[i = x] ?? (t[i] = w.call(t.attributes).reduce((o, { name: e, value: r }) => (o[e] = r, o), {}));
29
+ for (const o in { ...s, ...t[x] = n }) {
30
+ const e = n[o];
31
+ e !== s[o] && (o.startsWith("set:") ? t[o.slice(4)] = e : e == null || e === !1 ? t.removeAttribute(o) : t.setAttribute(o, e === !0 ? "" : e));
32
+ }
33
+ }, B = (n, t, s) => {
34
+ if (t.contains(document.activeElement)) {
35
+ const i = t.nextSibling;
36
+ for (; s && s != t; ) {
37
+ const o = s.nextSibling;
38
+ n.insertBefore(s, i), s = o;
39
+ }
40
+ } else
41
+ n.insertBefore(t, s);
42
+ }, g = (n) => {
43
+ var t;
44
+ for (const s of n.children)
45
+ g(s);
46
+ (t = n[b]) == null || t.call(n, null);
47
+ };
48
+ export {
49
+ N as render
50
+ };
package/dist/html.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./util-f79f2bb8.cjs"),$=new Set("area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",")),m=e=>e.replace(/[&<>"']/g,r=>`&#${r.charCodeAt(0)};`),s=function*(e){for(e of l.normalize(e))if(typeof e=="string")yield e;else{const{nodeName:r,key:u,skip:c,memo:y,ref:p,children:d,...a}=e,i=l.entries(a).reduce((n,[o,t])=>o.startsWith("set:")||t==null||t===!1?n:t===!0?`${n} ${o}`:`${n} ${o}="${m(String(t))}"`,"");$.has(r)?yield`<${r}${i}>`:c?yield`<${r}${i}></${r}>`:(yield`<${r}${i}>`,yield*s(d),yield`</${r}>`)}},f=e=>[...s(e)].join("");exports.html=s;exports.render=f;
package/dist/html.js ADDED
@@ -0,0 +1,14 @@
1
+ import { n as d, e as $ } from "./util-32b33d65.js";
2
+ const m = new Set("area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",")), f = (e) => e.replace(/[&<>"']/g, (r) => `&#${r.charCodeAt(0)};`), o = function* (e) {
3
+ for (e of d(e))
4
+ if (typeof e == "string")
5
+ yield e;
6
+ else {
7
+ const { nodeName: r, key: p, skip: c, memo: y, ref: u, children: l, ...a } = e, i = $(a).reduce((n, [s, t]) => s.startsWith("set:") || t == null || t === !1 ? n : t === !0 ? `${n} ${s}` : `${n} ${s}="${f(String(t))}"`, "");
8
+ m.has(r) ? yield `<${r}${i}>` : c ? yield `<${r}${i}></${r}>` : (yield `<${r}${i}>`, yield* o(l), yield `</${r}>`);
9
+ }
10
+ }, b = (e) => [...o(e)].join("");
11
+ export {
12
+ o as html,
13
+ b as render
14
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx.cjs"),r=require("./dom.cjs"),n=require("./component.cjs"),o=require("./schedule.cjs");require("./util-f79f2bb8.cjs");require("./html.cjs");exports.Fragment=e.Fragment;exports.h=e.h;exports.render=r.render;exports.component=n.component;exports.schedule=o.schedule;
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import { Fragment as t, h as p } from "./jsx.js";
2
+ import { render as n } from "./dom.js";
3
+ import { component as c } from "./component.js";
4
+ import { schedule as h } from "./schedule.js";
5
+ import "./util-32b33d65.js";
6
+ import "./html.js";
7
+ export {
8
+ t as Fragment,
9
+ c as component,
10
+ p as h,
11
+ n as render,
12
+ h as schedule
13
+ };
package/dist/jsx.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./util-f79f2bb8.cjs"),i=({children:e})=>e,l=function(e,r){const n={...r,nodeName:e},{length:t}=arguments;return"children"in n||t<3||(n.children=t===3?arguments[2]:c.slice.call(arguments,2)),n};exports.Fragment=i;exports.h=l;
package/dist/jsx.js ADDED
@@ -0,0 +1,9 @@
1
+ import { s } from "./util-32b33d65.js";
2
+ const o = ({ children: n }) => n, i = function(n, r) {
3
+ const t = { ...r, nodeName: n }, { length: e } = arguments;
4
+ return "children" in t || e < 3 || (t.children = e === 3 ? arguments[2] : s.call(arguments, 2)), t;
5
+ };
6
+ export {
7
+ o as Fragment,
8
+ i as h
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let t,r;const c=e=>{if(!(e instanceof HTMLElement&&typeof(e==null?void 0:e.next)=="function"))throw new TypeError("el must be a web component with a next method");t??(t=new Set),t.has(e)&&t.delete(e);for(const n of t){if(n.contains(e))return o(e);e.contains(n)&&t.delete(n)}return t.add(e),o(e)},o=e=>(r??(r=requestAnimationFrame(u)),()=>t.delete(e)),u=()=>{for(const e of t)e.isConnected&&e.next();t.clear(),r=null};exports.schedule=c;
@@ -0,0 +1,19 @@
1
+ let n, r;
2
+ const i = (e) => {
3
+ if (!(e instanceof HTMLElement && typeof (e == null ? void 0 : e.next) == "function"))
4
+ throw new TypeError("el must be a web component with a next method");
5
+ n ?? (n = /* @__PURE__ */ new Set()), n.has(e) && n.delete(e);
6
+ for (const t of n) {
7
+ if (t.contains(e))
8
+ return o(e);
9
+ e.contains(t) && n.delete(t);
10
+ }
11
+ return n.add(e), o(e);
12
+ }, o = (e) => (r ?? (r = requestAnimationFrame(c)), () => n.delete(e)), c = () => {
13
+ for (const e of n)
14
+ e.isConnected && e.next();
15
+ n.clear(), r = null;
16
+ };
17
+ export {
18
+ i as schedule
19
+ };
@@ -0,0 +1,21 @@
1
+ const { isArray: o, prototype: { slice: y } } = Array, { assign: c, entries: m } = Object, r = Symbol(), v = Symbol(), d = Symbol(), p = Symbol(), u = Symbol(), t = function* (e, a = { value: "" }, i = !0) {
2
+ for (e of o(e) ? e : [e]) {
3
+ if (e == null || typeof e == "boolean")
4
+ continue;
5
+ const { nodeName: s, ...n } = e, l = typeof s;
6
+ l === "string" ? (a.value && (yield a.value, a.value = ""), yield e) : l === "function" ? yield* t(s(n), a, !1) : o(e) ? yield* t(e, a, !1) : a.value += e;
7
+ }
8
+ i && a.value && (yield a.value);
9
+ };
10
+ export {
11
+ p as A,
12
+ u as I,
13
+ r as K,
14
+ v as M,
15
+ d as R,
16
+ c as a,
17
+ m as e,
18
+ o as i,
19
+ t as n,
20
+ y as s
21
+ };
@@ -0,0 +1 @@
1
+ "use strict";const{isArray:l,prototype:{slice:y}}=Array,{assign:r,entries:c}=Object,m=Symbol(),v=Symbol(),d=Symbol(),u=Symbol(),p=Symbol(),o=function*(e,t={value:""},a=!0){for(e of l(e)?e:[e]){if(e==null||typeof e=="boolean")continue;const{nodeName:i,...n}=e,s=typeof i;s==="string"?(t.value&&(yield t.value,t.value=""),yield e):s==="function"?yield*o(i(n),t,!1):l(e)?yield*o(e,t,!1):t.value+=e}a&&t.value&&(yield t.value)};exports.Attrs=u;exports.Iterator=p;exports.Key=m;exports.Memo=v;exports.Ref=d;exports.assign=r;exports.entries=c;exports.isArray=l;exports.normalize=o;exports.slice=y;
package/package.json CHANGED
@@ -1,14 +1,34 @@
1
1
  {
2
2
  "name": "ajo",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "ajo is a JavaScript view library for building user interfaces",
5
5
  "type": "module",
6
- "module": "./dist/ajo.js",
7
- "main": "./dist/ajo.umd.cjs",
6
+ "module": "./dist/index.js",
7
+ "main": "./dist/index.cjs",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/ajo.js",
11
- "require": "./dist/ajo.umd.cjs"
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./jsx": {
14
+ "import": "./dist/jsx.js",
15
+ "require": "./dist/jsx.umd.cjs"
16
+ },
17
+ "./dom": {
18
+ "import": "./dist/dom.js",
19
+ "require": "./dist/dom.umd.cjs"
20
+ },
21
+ "./html": {
22
+ "import": "./dist/html.js",
23
+ "require": "./dist/html.umd.cjs"
24
+ },
25
+ "./component": {
26
+ "import": "./dist/component.js",
27
+ "require": "./dist/component.umd.cjs"
28
+ },
29
+ "./schedule": {
30
+ "import": "./dist/schedule.js",
31
+ "require": "./dist/schedule.umd.cjs"
12
32
  }
13
33
  },
14
34
  "files": [
package/readme.md CHANGED
@@ -11,7 +11,8 @@ npm install ajo
11
11
 
12
12
  ```jsx
13
13
  /** @jsx h */
14
- import { h, render } from 'ajo'
14
+ import { h } from 'ajo'
15
+ import { render } from 'ajo/dom'
15
16
 
16
17
  document.body.innerHTML = '<div>Hello World</div>'
17
18
 
@@ -33,7 +34,9 @@ render(<Greet name="World" />, document.body)
33
34
 
34
35
  ```jsx
35
36
  /** @jsx h */
36
- import { h, render, component } from 'ajo'
37
+ import { h } from 'ajo'
38
+ import { render } from 'ajo/dom'
39
+ import { component } from 'ajo/component'
37
40
 
38
41
  const Counter = component(function* ({ init = 0 }) {
39
42
 
@@ -41,7 +44,7 @@ const Counter = component(function* ({ init = 0 }) {
41
44
 
42
45
  const handleClick = () => {
43
46
  count++
44
- this.refresh()
47
+ this.next()
45
48
  }
46
49
 
47
50
  while (true) yield (
package/dist/ajo.js DELETED
@@ -1,121 +0,0 @@
1
- var T = Object.defineProperty;
2
- var q = (t, e, i) => e in t ? T(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
- var u = (t, e, i) => (q(t, typeof e != "symbol" ? e + "" : e, i), i);
4
- const { isArray: d, prototype: { slice: E } } = Array, { assign: w, entries: z } = Object, G = ({ children: t }) => t, A = function(t, e) {
5
- const i = { ...e, nodeName: t }, { length: r } = arguments;
6
- return "children" in i || r < 3 || (i.children = r === 3 ? arguments[2] : E.call(arguments, 2)), i;
7
- }, p = function* (t, e = { value: "" }, i = !0) {
8
- for (t of d(t) ? t : [t]) {
9
- if (t == null || typeof t == "boolean")
10
- continue;
11
- const { nodeName: r, ...n } = t, l = typeof r;
12
- l === "string" ? (e.value && (yield e.value, e.value = ""), yield t) : l === "function" ? yield* p(r(n), e, !1) : d(t) ? yield* p(t, e, !1) : e.value += t;
13
- }
14
- i && e.value && (yield e.value);
15
- }, m = Symbol(), S = Symbol(), f = Symbol(), v = (t, e, i) => {
16
- let r = e.firstChild;
17
- for (t of p(t)) {
18
- let n = r;
19
- if (typeof t == "string") {
20
- for (; n && n.nodeType != 3; )
21
- n = n.nextSibling;
22
- n ? n.data != t && (n.data = t) : n = document.createTextNode(t);
23
- } else {
24
- const { xmlns: l = i, nodeName: a, is: s, key: c, skip: o, memo: y, ref: x, children: N, ...k } = t;
25
- for (; n && !(n.localName === a && (n[m] ?? (n[m] = c)) == c); )
26
- n = n.nextSibling;
27
- n ?? (n = M(l, a, s, c)), (y == null || C(n[S], n[S] = y)) && (F(k, n), o || v(N, n, l), typeof x == "function" && x(n));
28
- }
29
- n === r ? r = r.nextSibling : H(e, n, r);
30
- }
31
- for (; r; ) {
32
- const n = r.nextSibling;
33
- e.removeChild(r), r = n;
34
- }
35
- }, C = (t, e) => d(t) && d(e) ? t.some((i, r) => i !== e[r]) : t !== e, M = (t, e, i, r) => {
36
- const n = t ? document.createElementNS(t, e, { is: i }) : document.createElement(e, { is: i });
37
- return n[m] = r, n;
38
- }, F = (t, e) => {
39
- const i = e[f] ?? (e[f] = E.call(e.attributes).reduce((r, { name: n, value: l }) => (r[n] = l, r), {}));
40
- for (const r in { ...i, ...e[f] = t }) {
41
- const n = t[r];
42
- n !== i[r] && (r.startsWith("set:") ? e[r.slice(4)] = n : n == null || n === !1 ? e.removeAttribute(r) : e.setAttribute(r, n === !0 ? "" : n));
43
- }
44
- }, H = (t, e, i) => {
45
- if (e.contains(document.activeElement)) {
46
- const r = e.nextSibling;
47
- for (; i && i != e; ) {
48
- const n = i.nextSibling;
49
- t.insertBefore(i, r), i = n;
50
- }
51
- } else
52
- t.insertBefore(e, i);
53
- };
54
- let B = 0, h = null, g, b;
55
- const O = (t, { as: e } = {}) => {
56
- var n;
57
- if (((n = t == null ? void 0 : t.constructor) == null ? void 0 : n.name) !== "GeneratorFunction")
58
- throw new TypeError("fn is not a generator function");
59
- const i = `host-${B++}`;
60
- class r extends W(e) {
61
- constructor() {
62
- super(...arguments);
63
- u(this, "generator");
64
- u(this, "args");
65
- u(this, "ref");
66
- }
67
- refresh() {
68
- L(this);
69
- }
70
- next() {
71
- try {
72
- v((this.generator ?? (this.generator = t.call(this, this.args))).next().value, this), typeof this.ref == "function" && this.ref(this);
73
- } catch (s) {
74
- this.throw(s);
75
- }
76
- }
77
- throw(s) {
78
- var c;
79
- for (let o = this; o; o = o.parentNode)
80
- if (typeof ((c = o.generator) == null ? void 0 : c.throw) == "function")
81
- try {
82
- return v(o.generator.throw(s).value, o);
83
- } catch {
84
- continue;
85
- }
86
- throw s;
87
- }
88
- *[Symbol.iterator]() {
89
- for (; ; )
90
- yield this.args;
91
- }
92
- disconnectedCallback() {
93
- var s;
94
- try {
95
- (s = this.generator) == null || s.return(), typeof this.ref == "function" && this.ref(null);
96
- } finally {
97
- this.generator = null;
98
- }
99
- }
100
- }
101
- return customElements.define(i, r, { extends: e }), ({ attrs: l = {}, args: a = {}, ref: s, ...c }) => {
102
- for (const o in c)
103
- o.startsWith("arg:") ? a[o.slice(4)] = c[o] : (o === "children" ? a : l)[o] = c[o];
104
- return A(e || i, w(l, { is: e && i, skip: !0, ref: (o) => w(o, { args: a, ref: s }).refresh() }));
105
- };
106
- }, L = (t) => {
107
- (g ?? (g = /* @__PURE__ */ new Set())).add(t), h ?? (h = requestAnimationFrame(() => {
108
- for (const e of g)
109
- e.isConnected && e.next();
110
- g.clear(), h = null;
111
- }));
112
- }, W = (t) => {
113
- let e = (b ?? (b = /* @__PURE__ */ new Map())).get(t);
114
- return e || (e = document.createElement(t).constructor, e === HTMLUnknownElement && (e = HTMLElement), b.set(t, e)), e;
115
- };
116
- export {
117
- G as Fragment,
118
- O as component,
119
- A as h,
120
- v as render
121
- };
package/dist/ajo.umd.cjs DELETED
@@ -1 +0,0 @@
1
- (function(s,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(s=typeof globalThis<"u"?globalThis:s||self,l(s.ajo={}))})(this,function(s){"use strict";var W=Object.defineProperty;var z=(s,l,f)=>l in s?W(s,l,{enumerable:!0,configurable:!0,writable:!0,value:f}):s[l]=f;var p=(s,l,f)=>(z(s,typeof l!="symbol"?l+"":l,f),f);const{isArray:l,prototype:{slice:f}}=Array,{assign:x,entries:G}=Object,k=({children:t})=>t,S=function(t,e){const o={...e,nodeName:t},{length:i}=arguments;return"children"in o||i<3||(o.children=i===3?arguments[2]:f.call(arguments,2)),o},v=function*(t,e={value:""},o=!0){for(t of l(t)?t:[t]){if(t==null||typeof t=="boolean")continue;const{nodeName:i,...n}=t,c=typeof i;c==="string"?(e.value&&(yield e.value,e.value=""),yield t):c==="function"?yield*v(i(n),e,!1):l(t)?yield*v(t,e,!1):e.value+=t}o&&e.value&&(yield e.value)},m=Symbol(),b=Symbol(),y=Symbol(),g=(t,e,o)=>{let i=e.firstChild;for(t of v(t)){let n=i;if(typeof t=="string"){for(;n&&n.nodeType!=3;)n=n.nextSibling;n?n.data!=t&&(n.data=t):n=document.createTextNode(t)}else{const{xmlns:c=o,nodeName:d,is:a,key:u,skip:r,memo:w,ref:N,children:L,...O}=t;for(;n&&!(n.localName===d&&(n[m]??(n[m]=u))==u);)n=n.nextSibling;n??(n=j(c,d,a,u)),(w==null||M(n[b],n[b]=w))&&(q(O,n),r||g(L,n,c),typeof N=="function"&&N(n))}n===i?i=i.nextSibling:A(e,n,i)}for(;i;){const n=i.nextSibling;e.removeChild(i),i=n}},M=(t,e)=>l(t)&&l(e)?t.some((o,i)=>o!==e[i]):t!==e,j=(t,e,o,i)=>{const n=t?document.createElementNS(t,e,{is:o}):document.createElement(e,{is:o});return n[m]=i,n},q=(t,e)=>{const o=e[y]??(e[y]=f.call(e.attributes).reduce((i,{name:n,value:c})=>(i[n]=c,i),{}));for(const i in{...o,...e[y]=t}){const n=t[i];n!==o[i]&&(i.startsWith("set:")?e[i.slice(4)]=n:n==null||n===!1?e.removeAttribute(i):e.setAttribute(i,n===!0?"":n))}},A=(t,e,o)=>{if(e.contains(document.activeElement)){const i=e.nextSibling;for(;o&&o!=e;){const n=o.nextSibling;t.insertBefore(o,i),o=n}}else t.insertBefore(e,o)};let C=0,E=null,h,T;const F=(t,{as:e}={})=>{var n;if(((n=t==null?void 0:t.constructor)==null?void 0:n.name)!=="GeneratorFunction")throw new TypeError("fn is not a generator function");const o=`host-${C++}`;class i extends B(e){constructor(){super(...arguments);p(this,"generator");p(this,"args");p(this,"ref")}refresh(){H(this)}next(){try{g((this.generator??(this.generator=t.call(this,this.args))).next().value,this),typeof this.ref=="function"&&this.ref(this)}catch(a){this.throw(a)}}throw(a){var u;for(let r=this;r;r=r.parentNode)if(typeof((u=r.generator)==null?void 0:u.throw)=="function")try{return g(r.generator.throw(a).value,r)}catch{continue}throw a}*[Symbol.iterator](){for(;;)yield this.args}disconnectedCallback(){var a;try{(a=this.generator)==null||a.return(),typeof this.ref=="function"&&this.ref(null)}finally{this.generator=null}}}return customElements.define(o,i,{extends:e}),({attrs:c={},args:d={},ref:a,...u})=>{for(const r in u)r.startsWith("arg:")?d[r.slice(4)]=u[r]:(r==="children"?d:c)[r]=u[r];return S(e||o,x(c,{is:e&&o,skip:!0,ref:r=>x(r,{args:d,ref:a}).refresh()}))}},H=t=>{(h??(h=new Set)).add(t),E??(E=requestAnimationFrame(()=>{for(const e of h)e.isConnected&&e.next();h.clear(),E=null}))},B=t=>{let e=(T??(T=new Map)).get(t);return e||(e=document.createElement(t).constructor,e===HTMLUnknownElement&&(e=HTMLElement),T.set(t,e)),e};s.Fragment=k,s.component=F,s.h=S,s.render=g,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});