ajo 0.1.3 → 0.1.4

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,18 +1,18 @@
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) {
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
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;
6
+ return "children" in i || r < 3 || (i.children = r === 3 ? arguments[2] : E.call(arguments, 2)), i;
7
7
  }, p = function* (t, e = { value: "" }, i = !0) {
8
- for (t of g(t) ? t : [t]) {
8
+ for (t of d(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: 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
13
  }
14
14
  i && e.value && (yield e.value);
15
- }, d = Symbol(), v = Symbol(), m = Symbol(), E = (t, e, i) => {
15
+ }, m = Symbol(), S = Symbol(), f = Symbol(), v = (t, e, i) => {
16
16
  let r = e.firstChild;
17
17
  for (t of p(t)) {
18
18
  let n = r;
@@ -21,10 +21,10 @@ const { isArray: g, prototype: { slice: b } } = Array, { assign: w, entries: z }
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: 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
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 = 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
28
  }
29
29
  n === r ? r = r.nextSibling : H(e, n, r);
30
30
  }
@@ -32,12 +32,12 @@ const { isArray: g, prototype: { slice: b } } = Array, { assign: w, entries: z }
32
32
  const n = r.nextSibling;
33
33
  e.removeChild(r), r = 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) => {
35
+ }, C = (t, e) => d(t) && d(e) ? t.some((i, r) => i !== e[r]) : t !== e, M = (t, e, i, r) => {
36
36
  const n = t ? document.createElementNS(t, e, { is: i }) : document.createElement(e, { is: i });
37
- return n[d] = r, n;
37
+ return n[m] = r, n;
38
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 }) {
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
41
  const n = t[r];
42
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
43
  }
@@ -51,7 +51,7 @@ const { isArray: g, prototype: { slice: b } } = Array, { assign: w, entries: z }
51
51
  } else
52
52
  t.insertBefore(e, i);
53
53
  };
54
- let B = 0, h = null, y, S;
54
+ let B = 0, h = null, g, b;
55
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")
@@ -60,63 +60,62 @@ const O = (t, { as: e } = {}) => {
60
60
  class r extends W(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
+ u(this, "generator");
64
+ u(this, "args");
65
+ u(this, "ref");
69
66
  }
70
67
  refresh() {
71
68
  L(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
+ 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);
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(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;
89
91
  }
90
- return(c) {
92
+ disconnectedCallback() {
93
+ var s;
91
94
  try {
92
- this.next({ method: "return", argument: c });
95
+ (s = this.generator) == null || s.return(), typeof this.ref == "function" && this.ref(null);
93
96
  } finally {
94
97
  this.generator = 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(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() }));
106
105
  };
107
106
  }, L = (t) => {
108
- (y ?? (y = /* @__PURE__ */ new Set())).add(t), h ?? (h = requestAnimationFrame(() => {
109
- for (const e of y)
107
+ (g ?? (g = /* @__PURE__ */ new Set())).add(t), h ?? (h = requestAnimationFrame(() => {
108
+ for (const e of g)
110
109
  e.isConnected && e.next();
111
- y.clear(), h = null;
110
+ g.clear(), h = null;
112
111
  }));
113
112
  }, 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;
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;
116
115
  };
117
116
  export {
118
117
  G as Fragment,
119
118
  O as component,
120
- q as h,
121
- E as render
119
+ A as h,
120
+ v 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,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"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ajo",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
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