ajo 0.1.3 → 0.1.5

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