ajo 0.1.1 → 0.1.3
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/ajo.js +15 -15
- package/dist/ajo.umd.cjs +1 -1
- package/package.json +7 -6
- package/readme.md +3 -3
package/dist/ajo.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
var C = Object.defineProperty;
|
|
2
2
|
var T = (t, e, i) => e in t ? C(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
3
|
var f = (t, e, i) => (T(t, typeof e != "symbol" ? e + "" : e, i), i);
|
|
4
|
-
const
|
|
4
|
+
const { isArray: g, prototype: { slice: b } } = Array, { assign: w, entries: z } = Object, G = ({ children: t }) => t, q = function(t, e) {
|
|
5
5
|
const i = { ...e, nodeName: t }, { length: r } = arguments;
|
|
6
6
|
return "children" in i || r < 3 || (i.children = r === 3 ? arguments[2] : b.call(arguments, 2)), i;
|
|
7
|
-
},
|
|
7
|
+
}, p = function* (t, e = { value: "" }, i = !0) {
|
|
8
|
+
for (t of g(t) ? t : [t]) {
|
|
9
|
+
if (t == null || typeof t == "boolean")
|
|
10
|
+
continue;
|
|
11
|
+
const { nodeName: r, ...n } = t, s = typeof r;
|
|
12
|
+
s === "string" ? (e.value && (yield e.value, e.value = ""), yield t) : s === "function" ? yield* p(r(n), e, !1) : g(t) ? yield* p(t, e, !1) : e.value += t;
|
|
13
|
+
}
|
|
14
|
+
i && e.value && (yield e.value);
|
|
15
|
+
}, d = Symbol(), v = Symbol(), m = Symbol(), E = (t, e, i) => {
|
|
8
16
|
let r = e.firstChild;
|
|
9
17
|
for (t of p(t)) {
|
|
10
18
|
let n = r;
|
|
@@ -16,7 +24,7 @@ const d = Symbol(), w = Symbol(), m = Symbol(), { isArray: g, prototype: { slice
|
|
|
16
24
|
const { xmlns: s = i, nodeName: a, is: c, key: l, skip: o, memo: u, ref: x, children: N, ...k } = t;
|
|
17
25
|
for (; n && !(n.localName === a && (n[d] ?? (n[d] = l)) == l); )
|
|
18
26
|
n = n.nextSibling;
|
|
19
|
-
n ?? (n = M(s, a, c, l)), (u == null || A(n[
|
|
27
|
+
n ?? (n = M(s, a, c, l)), (u == null || A(n[v], n[v] = u)) && (F(k, n), o || E(N, n, s), typeof x == "function" && x(n));
|
|
20
28
|
}
|
|
21
29
|
n === r ? r = r.nextSibling : H(e, n, r);
|
|
22
30
|
}
|
|
@@ -42,17 +50,9 @@ const d = Symbol(), w = Symbol(), m = Symbol(), { isArray: g, prototype: { slice
|
|
|
42
50
|
}
|
|
43
51
|
} else
|
|
44
52
|
t.insertBefore(e, i);
|
|
45
|
-
}, p = function* (t, e = { value: "" }, i = !0) {
|
|
46
|
-
for (t of g(t) ? t : [t]) {
|
|
47
|
-
if (t == null || typeof t == "boolean")
|
|
48
|
-
continue;
|
|
49
|
-
const { nodeName: r, ...n } = t, s = typeof r;
|
|
50
|
-
s === "string" ? (e.value && (yield e.value, e.value = ""), yield t) : s === "function" ? yield* p(r(n), e, !1) : g(t) ? yield* p(t, e, !1) : e.value += t;
|
|
51
|
-
}
|
|
52
|
-
i && e.value && (yield e.value);
|
|
53
53
|
};
|
|
54
54
|
let B = 0, h = null, y, S;
|
|
55
|
-
const
|
|
55
|
+
const O = (t, { as: e } = {}) => {
|
|
56
56
|
var n;
|
|
57
57
|
if (((n = t == null ? void 0 : t.constructor) == null ? void 0 : n.name) !== "GeneratorFunction")
|
|
58
58
|
throw new TypeError("fn is not a generator function");
|
|
@@ -102,7 +102,7 @@ const G = (t, { as: e } = {}) => {
|
|
|
102
102
|
return customElements.define(i, r, { extends: e }), ({ attrs: s = {}, args: a = {}, ref: c, ...l }) => {
|
|
103
103
|
for (const o in l)
|
|
104
104
|
o.startsWith("arg:") ? a[o.slice(4)] = l[o] : (o === "children" ? a : s)[o] = l[o];
|
|
105
|
-
return q(e || i,
|
|
105
|
+
return q(e || i, w(s, { is: e && i, skip: !0, ref: (o) => w(o, { args: a, ref: c }).refresh() }));
|
|
106
106
|
};
|
|
107
107
|
}, L = (t) => {
|
|
108
108
|
(y ?? (y = /* @__PURE__ */ new Set())).add(t), h ?? (h = requestAnimationFrame(() => {
|
|
@@ -115,8 +115,8 @@ const G = (t, { as: e } = {}) => {
|
|
|
115
115
|
return e || (e = document.createElement(t).constructor, e === HTMLUnknownElement && (e = HTMLElement), S.set(t, e)), e;
|
|
116
116
|
};
|
|
117
117
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
G as Fragment,
|
|
119
|
+
O as component,
|
|
120
120
|
q as h,
|
|
121
121
|
E as render
|
|
122
122
|
};
|
package/dist/ajo.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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.
|
|
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:w,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},h=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,u=typeof i;u==="string"?(e.value&&(yield e.value,e.value=""),yield t):u==="function"?yield*h(i(n),e,!1):l(t)?yield*h(t,e,!1):e.value+=t}o&&e.value&&(yield e.value)},y=Symbol(),b=Symbol(),g=Symbol(),x=(t,e,o)=>{let i=e.firstChild;for(t of h(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:d,is:a,key:c,skip:r,memo:m,ref:N,children:L,...O}=t;for(;n&&!(n.localName===d&&(n[y]??(n[y]=c))==c);)n=n.nextSibling;n??(n=M(u,d,a,c)),(m==null||C(n[b],n[b]=m))&&(j(O,n),r||x(L,n,u),typeof N=="function"&&N(n))}n===i?i=i.nextSibling:q(e,n,i)}for(;i;){const n=i.nextSibling;e.removeChild(i),i=n}},C=(t,e)=>l(t)&&l(e)?t.some((o,i)=>o!==e[i]):t!==e,M=(t,e,o,i)=>{const n=t?document.createElementNS(t,e,{is:o}):document.createElement(e,{is:o});return n[y]=i,n},j=(t,e)=>{const o=e[g]??(e[g]=f.call(e.attributes).reduce((i,{name:n,value:u})=>(i[n]=u,i),{}));for(const i in{...o,...e[g]=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))}},q=(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 A=0,E=null,v,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-${A++}`;class i extends B(e){constructor(){super(...arguments);p(this,"generator");p(this,"args");p(this,"ref")}disconnectedCallback(){this.return()}refresh(){H(this)}next({method:a="next",argument:c}={}){try{const{done:r,value:m}=(this.generator??(this.generator=t.call(this,this.args)))[a](c);if(r)return a!=="return"&&this.return(m);x(m,this),typeof this.ref=="function"&&this.ref(this)}catch(r){this.throw(r)}}throw(a){var c;for(let r=this.parentNode;r;r=r.parentNode)if(typeof((c=r.generator)==null?void 0:c.throw)=="function")return r.next({method:"throw",argument:a});throw a}return(a){try{this.next({method:"return",argument:a})}finally{this.generator=null}}*[Symbol.iterator](){for(;this.isConnected;)yield this.args}}return customElements.define(o,i,{extends:e}),({attrs:u={},args:d={},ref:a,...c})=>{for(const r in c)r.startsWith("arg:")?d[r.slice(4)]=c[r]:(r==="children"?d:u)[r]=c[r];return S(e||o,w(u,{is:e&&o,skip:!0,ref:r=>w(r,{args:d,ref:a}).refresh()}))}},H=t=>{(v??(v=new Set)).add(t),E??(E=requestAnimationFrame(()=>{for(const e of v)e.isConnected&&e.next();v.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=x,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ajo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "ajo is a JavaScript view library for building user interfaces",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
9
|
-
"main": "./dist/ajo.umd.cjs",
|
|
10
6
|
"module": "./dist/ajo.js",
|
|
7
|
+
"main": "./dist/ajo.umd.cjs",
|
|
11
8
|
"exports": {
|
|
12
9
|
".": {
|
|
13
10
|
"import": "./dist/ajo.js",
|
|
14
11
|
"require": "./dist/ajo.umd.cjs"
|
|
15
12
|
}
|
|
16
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"jsdom": "^22.1.0",
|
|
19
19
|
"vite": "^4.5.0",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"test": "vitest --run",
|
|
36
36
|
"build": "vite build",
|
|
37
|
-
"
|
|
37
|
+
"bump": "pnpm version patch && git push && git push --tags",
|
|
38
|
+
"release": "pnpm test && pnpm build && pnpm bump && pnpm publish"
|
|
38
39
|
}
|
|
39
40
|
}
|
package/readme.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# ajo
|
|
2
|
+
ajo is a JavaScript view library for building user interfaces
|
|
3
3
|
|
|
4
4
|
## install
|
|
5
5
|
|
|
@@ -55,4 +55,4 @@ render(<Counter init={5} />, document.body)
|
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
## acknowledgments
|
|
58
|
-
|
|
58
|
+
ajo takes heavy inspiration from [Incremental DOM](https://github.com/google/incremental-dom) and [Crank.js](https://github.com/bikeshaving/crank)
|