jails.stdlib 2.0.0 → 2.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jails.stdlib",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "The Jails Standard Library",
5
5
  "types": "index.d.ts",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  "build": "node build && tsc"
14
14
  },
15
15
  "dependencies": {
16
- "@javiani/onijs": "^1.0.7",
16
+ "@javiani/onijs": "^1.0.8",
17
17
  "@types/node": "^20.10.7",
18
18
  "glob": "^10.3.10",
19
19
  "grapnel": "0.6.4",
package/store/index.js CHANGED
@@ -1,50 +1,47 @@
1
- function S(e, d) {
2
- let r = [];
3
- const l = /* @__PURE__ */ new Set(), c = g(e), p = () => c, s = (a) => {
4
- if (a.call)
5
- return l.add(a), () => {
6
- l.delete(a);
1
+ function S(l, d) {
2
+ let s = [], r = !1;
3
+ const n = /* @__PURE__ */ new Set(), c = h(l), u = () => c, f = (t) => {
4
+ if (t.call)
5
+ return n.add(t), () => {
6
+ n.delete(t);
7
7
  };
8
8
  {
9
- const n = (t, { action: o, payload: i }) => {
10
- o in a && a[o].call(null, t, { action: o, payload: i });
9
+ const a = (o, { action: e, payload: i }) => {
10
+ e in t && t[e].call(null, o, { action: e, payload: i });
11
11
  };
12
- return l.add(n), () => {
13
- l.delete(n);
12
+ return n.add(a), () => {
13
+ n.delete(a);
14
14
  };
15
15
  }
16
- }, u = (a, n) => (r.push({ action: a, payload: n }), new Promise(
17
- (t) => f({ action: a, payload: n }, t)
18
- )), y = (a) => new Promise((n) => {
19
- s((t, { action: o, payload: i }) => {
20
- o in a && w((h) => {
21
- a[o].call(null, t, { action: o, payload: i }), n(t);
22
- });
23
- });
24
- }), f = ({ action: a, payload: n = {} }, t) => {
25
- r.forEach(({ action: o, payload: i = {} }) => {
26
- if (!(o in d))
27
- console.log(`[Oni] Error -> No action [ ${o} ] found.`);
28
- else {
29
- const h = d[o].call(null, c, i, {
30
- getState: p,
31
- subscribe: s,
32
- dispatch: u,
33
- patternMatch: y
16
+ }, p = (t, a = {}) => (s.push({ action: t, payload: a }), new Promise((o) => {
17
+ r || y(o);
18
+ })), y = (t) => {
19
+ for (r = !0; s.length; ) {
20
+ const a = s.slice();
21
+ s = [];
22
+ for (const { action: o, payload: e } of a) {
23
+ if (!(o in d)) {
24
+ console.log(`[Oni] Error -> No action [ ${o} ] found.`);
25
+ continue;
26
+ }
27
+ const i = d[o].call(null, c, e, {
28
+ getState: u,
29
+ subscribe: f,
30
+ dispatch: p
34
31
  });
35
- Object.assign(c, h);
32
+ Object.assign(c, i), n.forEach((g) => g(c, { action: o, payload: e }));
36
33
  }
37
- }), r.length && (l.forEach((o) => o(c, { action: a, payload: n })), r = []), t(c);
34
+ }
35
+ r = !1, t(c);
38
36
  };
39
37
  return {
40
- getState: p,
41
- subscribe: s,
42
- dispatch: u,
43
- patternMatch: y,
44
- destroy: () => l.clear()
38
+ getState: u,
39
+ subscribe: f,
40
+ dispatch: p,
41
+ destroy: () => n.clear()
45
42
  };
46
43
  }
47
- const g = (e) => JSON.parse(JSON.stringify(e)), w = typeof window > "u" ? (e) => e() : (e) => requestAnimationFrame(e);
44
+ const h = (l) => JSON.parse(JSON.stringify(l));
48
45
  export {
49
46
  S as Store
50
47
  };
@@ -1 +1 @@
1
- (function(i,c){typeof exports=="object"&&typeof module!="undefined"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis!="undefined"?globalThis:i||self,c(i.store={}))})(this,(function(i){"use strict";function c(a,u){let s=[];const l=new Set,d=b(a),f=()=>d,p=e=>{if(e.call)return l.add(e),()=>{l.delete(e)};{const o=(t,{action:n,payload:r})=>{n in e&&e[n].call(null,t,{action:n,payload:r})};return l.add(o),()=>{l.delete(o)}}},y=(e,o)=>(s.push({action:e,payload:o}),new Promise(t=>S({action:e,payload:o},t))),h=e=>new Promise(o=>{p((t,{action:n,payload:r})=>{n in e&&m(g=>{e[n].call(null,t,{action:n,payload:r}),o(t)})})}),S=({action:e,payload:o={}},t)=>{s.forEach(({action:n,payload:r={}})=>{if(!(n in u))console.log(`[Oni] Error -> No action [ ${n} ] found.`);else{const g=u[n].call(null,d,r,{getState:f,subscribe:p,dispatch:y,patternMatch:h});Object.assign(d,g)}}),s.length&&(l.forEach(n=>n(d,{action:e,payload:o})),s=[]),t(d)};return{getState:f,subscribe:p,dispatch:y,patternMatch:h,destroy:()=>l.clear()}}const b=a=>JSON.parse(JSON.stringify(a)),m=typeof window>"u"?a=>a():a=>requestAnimationFrame(a);i.Store=c,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(n,a){typeof exports=="object"&&typeof module!="undefined"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(n=typeof globalThis!="undefined"?globalThis:n||self,a(n.store={}))})(this,(function(n){"use strict";function a(d,u){let l=[],r=!1;const o=new Set,c=b(d),p=()=>c,y=e=>{if(e.call)return o.add(e),()=>{o.delete(e)};{const i=(t,{action:s,payload:f})=>{s in e&&e[s].call(null,t,{action:s,payload:f})};return o.add(i),()=>{o.delete(i)}}},h=(e,i={})=>(l.push({action:e,payload:i}),new Promise(t=>{r||g(t)})),g=e=>{for(r=!0;l.length;){const i=l.slice();l=[];for(const{action:t,payload:s}of i){if(!(t in u)){console.log(`[Oni] Error -> No action [ ${t} ] found.`);continue}const f=u[t].call(null,c,s,{getState:p,subscribe:y,dispatch:h});Object.assign(c,f),o.forEach(S=>S(c,{action:t,payload:s}))}}r=!1,e(c)};return{getState:p,subscribe:y,dispatch:h,destroy:()=>o.clear()}}const b=d=>JSON.parse(JSON.stringify(d));n.Store=a,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
@@ -1 +1 @@
1
- export declare const throttle: (fn: Function, wait?: number) => () => void;
1
+ export declare const throttle: (fn: Function, wait?: number) => (...args: any[]) => void;
package/throttle/index.js CHANGED
@@ -1,9 +1,9 @@
1
- const n = (e, o = 100) => {
1
+ const r = (e, o = 100) => {
2
2
  let t = Date.now();
3
- return () => {
4
- t + o - Date.now() < 0 && (e(), t = Date.now());
3
+ return (...n) => {
4
+ t + o - Date.now() < 0 && (e(...n), t = Date.now());
5
5
  };
6
6
  };
7
7
  export {
8
- n as throttle
8
+ r as throttle
9
9
  };
package/throttle/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
 
2
2
  export const throttle = (fn:Function, wait:number = 100) => {
3
3
  let time = Date.now()
4
- return () => {
4
+ return (...args) => {
5
5
  if ((time + wait - Date.now()) < 0) {
6
- fn()
6
+ fn(...args)
7
7
  time = Date.now()
8
8
  }
9
9
  }
@@ -1 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e.throttle={}))})(this,(function(e){"use strict";const t=(o,i=100)=>{let n=Date.now();return()=>{n+i-Date.now()<0&&(o(),n=Date.now())}};e.throttle=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e.throttle={}))})(this,(function(e){"use strict";const t=(o,i=100)=>{let n=Date.now();return(...f)=>{n+i-Date.now()<0&&(o(...f),n=Date.now())}};e.throttle=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));