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 +2 -2
- package/store/index.js +33 -36
- package/store/index.umd.js +1 -1
- package/throttle/index.d.ts +1 -1
- package/throttle/index.js +4 -4
- package/throttle/index.ts +2 -2
- package/throttle/index.umd.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jails.stdlib",
|
|
3
|
-
"version": "2.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.
|
|
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(
|
|
2
|
-
let
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
5
|
-
return
|
|
6
|
-
|
|
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
|
|
10
|
-
|
|
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
|
|
13
|
-
|
|
12
|
+
return n.add(a), () => {
|
|
13
|
+
n.delete(a);
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
)), y = (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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,
|
|
32
|
+
Object.assign(c, i), n.forEach((g) => g(c, { action: o, payload: e }));
|
|
36
33
|
}
|
|
37
|
-
}
|
|
34
|
+
}
|
|
35
|
+
r = !1, t(c);
|
|
38
36
|
};
|
|
39
37
|
return {
|
|
40
|
-
getState:
|
|
41
|
-
subscribe:
|
|
42
|
-
dispatch:
|
|
43
|
-
|
|
44
|
-
destroy: () => l.clear()
|
|
38
|
+
getState: u,
|
|
39
|
+
subscribe: f,
|
|
40
|
+
dispatch: p,
|
|
41
|
+
destroy: () => n.clear()
|
|
45
42
|
};
|
|
46
43
|
}
|
|
47
|
-
const
|
|
44
|
+
const h = (l) => JSON.parse(JSON.stringify(l));
|
|
48
45
|
export {
|
|
49
46
|
S as Store
|
|
50
47
|
};
|
package/store/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
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"})}));
|
package/throttle/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
8
|
+
r as throttle
|
|
9
9
|
};
|
package/throttle/index.ts
CHANGED
package/throttle/index.umd.js
CHANGED
|
@@ -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"})}));
|