ajo 0.1.5 → 0.1.7
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/component.cjs +1 -0
- package/dist/component.js +86 -0
- package/dist/dom.cjs +1 -0
- package/dist/dom.js +50 -0
- package/dist/html.cjs +1 -0
- package/dist/html.js +14 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +13 -0
- package/dist/jsx.cjs +1 -0
- package/dist/jsx.js +9 -0
- package/dist/schedule.cjs +1 -0
- package/dist/schedule.js +19 -0
- package/dist/util-32b33d65.js +21 -0
- package/dist/util-f79f2bb8.cjs +1 -0
- package/package.json +25 -5
- package/readme.md +1 -1
- package/dist/ajo.js +0 -121
- package/dist/ajo.umd.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx.cjs"),l=require("./util-f79f2bb8.cjs"),f=require("./html.cjs"),d=require("./dom.cjs");let p=0,m;const v=(n,{as:t}={})=>{var o;if(((o=n==null?void 0:n.constructor)==null?void 0:o.name)!=="GeneratorFunction")throw new TypeError("fn is not a generator function");const c=`host-${p++}`;return globalThis.document?(customElements.define(c,class extends x(t){*[Symbol.iterator](){for(;;)yield this.args}next(){var e;try{d.render((this[e=l.Iterator]??(this[e]=n.call(this,this.args))).next().value,this),typeof this[l.Ref]=="function"&&this[l.Ref](this)}catch(r){this.throw(r)}}throw(e){var r;for(let i=this;i;i=i.parentNode)if(typeof((r=i[l.Iterator])==null?void 0:r.throw)=="function")try{return d.render(i[l.Iterator].throw(e).value,i)}catch{continue}throw e}return(){var e;try{(e=this[l.Iterator])==null||e.return()}catch(r){this.throw(r)}finally{this[l.Iterator]=null}}},{extends:t}),({attrs:e={},args:r={},ref:i,...u})=>(w(e,r,u),a.h(t||c,l.assign(e,{is:t&&c,skip:!0,ref:h=>h&&l.assign(h,{[l.Ref]:s=>(s||h.return(),typeof i=="function"&&i(s)),args:r}).next()})))):({attrs:e={},args:r={},...i})=>{w(e,r,i);let u,h;try{const s=n.call(u={args:r,*[Symbol.iterator](){for(;;)yield r},next(){h=f.render(s.next().value)},throw(y){h=f.render(s.throw(y).value)},return(){s.return()}},r);u.next()}catch(s){u.throw(s)}finally{u.return()}return a.h(t||c,l.assign(e,{is:t&&c}),h)}},x=n=>{let t=(m??(m=new Map)).get(n);return t||(t=document.createElement(n).constructor,t===HTMLUnknownElement&&(t=HTMLElement),m.set(n,t)),t},w=(n,t,c)=>{for(const o in c)o.startsWith("arg:")?t[o.slice(4)]=c[o]:o==="children"?t[o]=c[o]:n[o]=c[o]};exports.component=v;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { h as m } from "./jsx.js";
|
|
2
|
+
import { a, I as u, R as f } from "./util-32b33d65.js";
|
|
3
|
+
import { render as w } from "./html.js";
|
|
4
|
+
import { render as d } from "./dom.js";
|
|
5
|
+
let v = 0, y;
|
|
6
|
+
const k = (n, { as: t } = {}) => {
|
|
7
|
+
var o;
|
|
8
|
+
if (((o = n == null ? void 0 : n.constructor) == null ? void 0 : o.name) !== "GeneratorFunction")
|
|
9
|
+
throw new TypeError("fn is not a generator function");
|
|
10
|
+
const l = `host-${v++}`;
|
|
11
|
+
return globalThis.document ? (customElements.define(
|
|
12
|
+
l,
|
|
13
|
+
class extends E(t) {
|
|
14
|
+
*[Symbol.iterator]() {
|
|
15
|
+
for (; ; )
|
|
16
|
+
yield this.args;
|
|
17
|
+
}
|
|
18
|
+
next() {
|
|
19
|
+
var e;
|
|
20
|
+
try {
|
|
21
|
+
d((this[e = u] ?? (this[e] = n.call(this, this.args))).next().value, this), typeof this[f] == "function" && this[f](this);
|
|
22
|
+
} catch (r) {
|
|
23
|
+
this.throw(r);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
throw(e) {
|
|
27
|
+
var r;
|
|
28
|
+
for (let i = this; i; i = i.parentNode)
|
|
29
|
+
if (typeof ((r = i[u]) == null ? void 0 : r.throw) == "function")
|
|
30
|
+
try {
|
|
31
|
+
return d(i[u].throw(e).value, i);
|
|
32
|
+
} catch {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
return() {
|
|
38
|
+
var e;
|
|
39
|
+
try {
|
|
40
|
+
(e = this[u]) == null || e.return();
|
|
41
|
+
} catch (r) {
|
|
42
|
+
this.throw(r);
|
|
43
|
+
} finally {
|
|
44
|
+
this[u] = null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{ extends: t }
|
|
49
|
+
), ({ attrs: e = {}, args: r = {}, ref: i, ...s }) => (p(e, r, s), m(t || l, a(e, { is: t && l, skip: !0, ref: (h) => h && a(h, { [f]: (c) => (c || h.return(), typeof i == "function" && i(c)), args: r }).next() })))) : ({ attrs: e = {}, args: r = {}, ...i }) => {
|
|
50
|
+
p(e, r, i);
|
|
51
|
+
let s, h;
|
|
52
|
+
try {
|
|
53
|
+
const c = n.call(s = {
|
|
54
|
+
args: r,
|
|
55
|
+
*[Symbol.iterator]() {
|
|
56
|
+
for (; ; )
|
|
57
|
+
yield r;
|
|
58
|
+
},
|
|
59
|
+
next() {
|
|
60
|
+
h = w(c.next().value);
|
|
61
|
+
},
|
|
62
|
+
throw(x) {
|
|
63
|
+
h = w(c.throw(x).value);
|
|
64
|
+
},
|
|
65
|
+
return() {
|
|
66
|
+
c.return();
|
|
67
|
+
}
|
|
68
|
+
}, r);
|
|
69
|
+
s.next();
|
|
70
|
+
} catch (c) {
|
|
71
|
+
s.throw(c);
|
|
72
|
+
} finally {
|
|
73
|
+
s.return();
|
|
74
|
+
}
|
|
75
|
+
return m(t || l, a(e, { is: t && l }), h);
|
|
76
|
+
};
|
|
77
|
+
}, E = (n) => {
|
|
78
|
+
let t = (y ?? (y = /* @__PURE__ */ new Map())).get(n);
|
|
79
|
+
return t || (t = document.createElement(n).constructor, t === HTMLUnknownElement && (t = HTMLElement), y.set(n, t)), t;
|
|
80
|
+
}, p = (n, t, l) => {
|
|
81
|
+
for (const o in l)
|
|
82
|
+
o.startsWith("arg:") ? t[o.slice(4)] = l[o] : o === "children" ? t[o] = l[o] : n[o] = l[o];
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
k as component
|
|
86
|
+
};
|
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;
|
package/dist/schedule.js
ADDED
|
@@ -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.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "ajo is a JavaScript view library for building user interfaces",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"module": "./dist/
|
|
7
|
-
"main": "./dist/
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import": "./dist/
|
|
11
|
-
"require": "./dist/
|
|
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
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"})});
|