ajo 0.1.5 → 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.5",
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 A = Object.defineProperty;
2
- var C = (t, e, o) => e in t ? A(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var y = (t, e, o) => (C(t, typeof e != "symbol" ? e + "" : e, o), o);
4
- const { isArray: v, prototype: { slice: T } } = Array, { assign: b, entries: O } = Object, R = ({ children: t }) => t, M = function(t, e) {
5
- const o = { ...e, nodeName: t }, { length: i } = arguments;
6
- return "children" in o || i < 3 || (o.children = i === 3 ? arguments[2] : T.call(arguments, 2)), o;
7
- }, w = function* (t, e = { value: "" }, o = !0) {
8
- for (t of v(t) ? t : [t]) {
9
- if (t == null || typeof t == "boolean")
10
- continue;
11
- const { nodeName: i, ...n } = t, s = typeof i;
12
- s === "string" ? (e.value && (yield e.value, e.value = ""), yield t) : s === "function" ? yield* w(i(n), e, !1) : v(t) ? yield* w(t, e, !1) : e.value += t;
13
- }
14
- o && e.value && (yield e.value);
15
- }, g = Symbol(), E = Symbol(), p = Symbol(), u = Symbol(), m = Symbol(), S = (t, e, o) => {
16
- let i = e.firstChild;
17
- for (t of w(t)) {
18
- let n = i;
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: s = o, nodeName: d, is: f, key: a, skip: r, memo: c, ref: l, children: h, ...q } = t;
25
- for (; n && !(n.localName === d && (n[g] ?? (n[g] = a)) == a); )
26
- n = n.nextSibling;
27
- n ?? (n = H(s, d, f, a)), (c == null || F(n[E], n[E] = c)) && (B(q, n), r || S(h, n, s), typeof l == "function" && l(n));
28
- }
29
- n === i ? i = i.nextSibling : L(e, n, i);
30
- }
31
- for (; i; ) {
32
- const n = i.nextSibling;
33
- e.removeChild(i), i = n;
34
- }
35
- }, F = (t, e) => v(t) && v(e) ? t.some((o, i) => o !== e[i]) : t !== e, H = (t, e, o, i) => {
36
- const n = t ? document.createElementNS(t, e, { is: o }) : document.createElement(e, { is: o });
37
- return n[g] = i, n;
38
- }, B = (t, e) => {
39
- const o = e[p] ?? (e[p] = T.call(e.attributes).reduce((i, { name: n, value: s }) => (i[n] = s, i), {}));
40
- for (const i in { ...o, ...e[p] = t }) {
41
- const n = t[i];
42
- n !== o[i] && (i.startsWith("set:") ? e[i.slice(4)] = n : n == null || n === !1 ? e.removeAttribute(i) : e.setAttribute(i, n === !0 ? "" : n));
43
- }
44
- }, L = (t, e, o) => {
45
- if (e.contains(document.activeElement)) {
46
- const i = e.nextSibling;
47
- for (; o && o != e; ) {
48
- const n = o.nextSibling;
49
- t.insertBefore(o, i), o = n;
50
- }
51
- } else
52
- t.insertBefore(e, o);
53
- };
54
- let W = 0, N = null, x, k;
55
- const U = (t, { as: e } = {}) => {
56
- var n, s, d;
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 o = `host-${W++}`;
60
- class i extends z(e) {
61
- constructor() {
62
- super(...arguments);
63
- y(this, s);
64
- y(this, d);
65
- y(this, "args");
66
- }
67
- refresh() {
68
- j(this);
69
- }
70
- next() {
71
- try {
72
- S((this[u] ?? (this[u] = t.call(this, this.args))).next().value, this), typeof this[m] == "function" && this[m](this);
73
- } catch (r) {
74
- this.throw(r);
75
- }
76
- }
77
- throw(r) {
78
- var c;
79
- for (let l = this; l; l = l.parentNode)
80
- if (typeof ((c = l[u]) == null ? void 0 : c.throw) == "function")
81
- try {
82
- return S(l[u].throw(r).value, l);
83
- } catch {
84
- continue;
85
- }
86
- throw r;
87
- }
88
- *[(s = u, d = m, Symbol.iterator)]() {
89
- for (; ; )
90
- yield this.args;
91
- }
92
- disconnectedCallback() {
93
- var r;
94
- try {
95
- (r = this[u]) == null || r.return(), typeof this[m] == "function" && this[m](null);
96
- } finally {
97
- this[u] = null;
98
- }
99
- }
100
- }
101
- return customElements.define(o, i, { extends: e }), ({ attrs: f = {}, args: a = {}, ref: r, ...c }) => {
102
- for (const l in c)
103
- l.startsWith("arg:") ? a[l.slice(4)] = c[l] : (l === "children" ? a : f)[l] = c[l];
104
- return M(e || o, b(f, { is: e && o, skip: !0, ref: (l) => b(l, { args: a, ref: r }).refresh() }));
105
- };
106
- }, j = (t) => {
107
- (x ?? (x = /* @__PURE__ */ new Set())).add(t), N ?? (N = requestAnimationFrame(() => {
108
- for (const e of x)
109
- e.isConnected && e.next();
110
- x.clear(), N = null;
111
- }));
112
- }, z = (t) => {
113
- let e = (k ?? (k = /* @__PURE__ */ new Map())).get(t);
114
- return e || (e = document.createElement(t).constructor, e === HTMLUnknownElement && (e = HTMLElement), k.set(t, e)), e;
115
- };
116
- export {
117
- R as Fragment,
118
- U as component,
119
- M as h,
120
- S as render
121
- };
package/dist/ajo.umd.cjs DELETED
@@ -1 +0,0 @@
1
- (function(s,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.ajo={}))})(this,function(s){"use strict";var G=Object.defineProperty;var P=(s,r,f)=>r in s?G(s,r,{enumerable:!0,configurable:!0,writable:!0,value:f}):s[r]=f;var w=(s,r,f)=>(P(s,typeof r!="symbol"?r+"":r,f),f);const{isArray:r,prototype:{slice:f}}=Array,{assign:E,entries:R}=Object,q=({children:t})=>t,T=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},x=function*(t,e={value:""},o=!0){for(t of r(t)?t:[t]){if(t==null||typeof t=="boolean")continue;const{nodeName:i,...n}=t,u=typeof i;u==="string"?(e.value&&(yield e.value,e.value=""),yield t):u==="function"?yield*x(i(n),e,!1):r(t)?yield*x(t,e,!1):e.value+=t}o&&e.value&&(yield e.value)},g=Symbol(),N=Symbol(),v=Symbol(),m=Symbol(),y=Symbol(),S=(t,e,o)=>{let i=e.firstChild;for(t of x(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:u=o,nodeName:h,is:p,key:d,skip:c,memo:a,ref:l,children:j,...z}=t;for(;n&&!(n.localName===h&&(n[g]??(n[g]=d))==d);)n=n.nextSibling;n??(n=C(u,h,p,d)),(a==null||A(n[N],n[N]=a))&&(F(z,n),c||S(j,n,u),typeof l=="function"&&l(n))}n===i?i=i.nextSibling:H(e,n,i)}for(;i;){const n=i.nextSibling;e.removeChild(i),i=n}},A=(t,e)=>r(t)&&r(e)?t.some((o,i)=>o!==e[i]):t!==e,C=(t,e,o,i)=>{const n=t?document.createElementNS(t,e,{is:o}):document.createElement(e,{is:o});return n[g]=i,n},F=(t,e)=>{const o=e[v]??(e[v]=f.call(e.attributes).reduce((i,{name:n,value:u})=>(i[n]=u,i),{}));for(const i in{...o,...e[v]=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))}},H=(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 B=0,k=null,b,M;const L=(t,{as:e}={})=>{var n,u,h;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-${B++}`;class i extends W(e){constructor(){super(...arguments);w(this,u);w(this,h);w(this,"args")}refresh(){O(this)}next(){try{S((this[m]??(this[m]=t.call(this,this.args))).next().value,this),typeof this[y]=="function"&&this[y](this)}catch(c){this.throw(c)}}throw(c){var a;for(let l=this;l;l=l.parentNode)if(typeof((a=l[m])==null?void 0:a.throw)=="function")try{return S(l[m].throw(c).value,l)}catch{continue}throw c}*[(u=m,h=y,Symbol.iterator)](){for(;;)yield this.args}disconnectedCallback(){var c;try{(c=this[m])==null||c.return(),typeof this[y]=="function"&&this[y](null)}finally{this[m]=null}}}return customElements.define(o,i,{extends:e}),({attrs:p={},args:d={},ref:c,...a})=>{for(const l in a)l.startsWith("arg:")?d[l.slice(4)]=a[l]:(l==="children"?d:p)[l]=a[l];return T(e||o,E(p,{is:e&&o,skip:!0,ref:l=>E(l,{args:d,ref:c}).refresh()}))}},O=t=>{(b??(b=new Set)).add(t),k??(k=requestAnimationFrame(()=>{for(const e of b)e.isConnected&&e.next();b.clear(),k=null}))},W=t=>{let e=(M??(M=new Map)).get(t);return e||(e=document.createElement(t).constructor,e===HTMLUnknownElement&&(e=HTMLElement),M.set(t,e)),e};s.Fragment=q,s.component=L,s.h=T,s.render=S,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});