@frui.ts/helpers
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0-rc.1
var P = Object.defineProperty; | ||
var m = (t, e, s) => e in t ? P(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s; | ||
var i = (t, e, s) => (m(t, typeof e != "symbol" ? e + "" : e, s), s); | ||
import { action as a, ObservableMap as _, makeObservable as h, computed as j, observable as g, isObservable as B, makeAutoObservable as M, set as D, isObservableArray as k, isObservableSet as A, isObservableMap as T } from "mobx"; | ||
function S(t, e, s) { | ||
import { action as a, ObservableMap as _, makeObservable as h, computed as j, observable as g, isObservable as B, makeAutoObservable as M, set as D, isObservableArray as S, isObservableSet as k, isObservableMap as A } from "mobx"; | ||
function N(t, e, s) { | ||
const n = s.value; | ||
@@ -24,6 +24,6 @@ if (typeof n != "function") | ||
} | ||
var $ = Object.defineProperty, E = Object.getOwnPropertyDescriptor, v = (t, e, s, n) => { | ||
for (var r = n > 1 ? void 0 : n ? E(e, s) : e, o = t.length - 1, u; o >= 0; o--) | ||
var T = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, v = (t, e, s, n) => { | ||
for (var r = n > 1 ? void 0 : n ? $(e, s) : e, o = t.length - 1, u; o >= 0; o--) | ||
(u = t[o]) && (r = (n ? u(e, s, r) : u(r)) || r); | ||
return n && r && $(e, s, r), r; | ||
return n && r && T(e, s, r), r; | ||
}; | ||
@@ -64,10 +64,10 @@ class C { | ||
function V(t, e, s) { | ||
const n = typeof t != "object", r = n ? t : Symbol(), o = (u, K, p) => { | ||
const n = typeof t != "object", r = n ? t : Symbol(), o = (u, z, p) => { | ||
const O = p.value; | ||
p.value = function(...d) { | ||
var y; | ||
const c = (y = this.busyWatcher) == null ? void 0 : y.getBusyTicket(r), b = O.apply(this, d); | ||
return c && (W(b) ? b.then(c, (w) => { | ||
const c = (y = this.busyWatcher) == null ? void 0 : y.getBusyTicket(r), l = O.apply(this, d); | ||
return c && (E(l) ? l.then(c, (w) => { | ||
console.error(w), c(); | ||
}) : c()), b; | ||
}) : c()), l; | ||
}; | ||
@@ -81,3 +81,3 @@ }; | ||
} | ||
function W(t) { | ||
function E(t) { | ||
return typeof (t == null ? void 0 : t.then) == "function"; | ||
@@ -90,3 +90,3 @@ } | ||
function x(t, e, s) { | ||
const n = s != null ? s : (o) => o, r = /* @__PURE__ */ new Map(); | ||
const n = s ?? ((o) => o), r = /* @__PURE__ */ new Map(); | ||
return t.forEach((o) => r.set(e(o), n(o))), r; | ||
@@ -105,8 +105,8 @@ } | ||
} | ||
var F = Object.defineProperty, z = Object.getOwnPropertyDescriptor, f = (t, e, s, n) => { | ||
for (var r = n > 1 ? void 0 : n ? z(e, s) : e, o = t.length - 1, u; o >= 0; o--) | ||
var W = Object.defineProperty, F = Object.getOwnPropertyDescriptor, b = (t, e, s, n) => { | ||
for (var r = n > 1 ? void 0 : n ? F(e, s) : e, o = t.length - 1, u; o >= 0; o--) | ||
(u = t[o]) && (r = (n ? u(e, s, r) : u(r)) || r); | ||
return n && r && F(e, s, r), r; | ||
return n && r && W(e, s, r), r; | ||
}; | ||
class l { | ||
class f { | ||
constructor() { | ||
@@ -128,11 +128,11 @@ i(this, "promise"); | ||
} | ||
f([ | ||
b([ | ||
g | ||
], l.prototype, "status", 2); | ||
f([ | ||
], f.prototype, "status", 2); | ||
b([ | ||
a.bound | ||
], l.prototype, "resolve", 1); | ||
f([ | ||
], f.prototype, "resolve", 1); | ||
b([ | ||
a.bound | ||
], l.prototype, "reject", 1); | ||
], f.prototype, "reject", 1); | ||
const I = (t) => t; | ||
@@ -143,9 +143,9 @@ function J(t, e, s) { | ||
function Q(t) { | ||
return Array.isArray(t) || k(t); | ||
return Array.isArray(t) || S(t); | ||
} | ||
function R(t) { | ||
return !!t && (t instanceof Set || A(t)); | ||
return !!t && (t instanceof Set || k(t)); | ||
} | ||
function U(t) { | ||
return !!t && (t instanceof Map || T(t)); | ||
return !!t && (t instanceof Map || A(t)); | ||
} | ||
@@ -157,5 +157,5 @@ function X(t) { | ||
C as BusyWatcher, | ||
l as ManualPromise, | ||
f as ManualPromise, | ||
G as bind, | ||
S as bound, | ||
N as bound, | ||
q as combineClassNames, | ||
@@ -162,0 +162,0 @@ x as createMap, |
@@ -1,2 +0,2 @@ | ||
(function(i,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("mobx")):typeof define=="function"&&define.amd?define(["exports","mobx"],o):(i=typeof globalThis<"u"?globalThis:i||self,o(i["fruits-helpers"]={},i.mobx))})(this,function(i,o){"use strict";var N=Object.defineProperty;var q=(i,o,a)=>o in i?N(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var f=(i,o,a)=>(q(i,typeof o!="symbol"?o+"":o,a),a);function a(t,e,r){const s=r.value;if(typeof s!="function")throw new Error(`@bound decorator can only be applied to methods, not ${typeof s}`);let n=!1;return{configurable:!0,get(){if(n||this===t.prototype||Object.prototype.hasOwnProperty.call(this,e))return s;const u=s.bind(this);return n=!0,Object.defineProperty(this,e,{value:u,configurable:!0,writable:!0}),n=!1,u}}}var O=Object.defineProperty,P=Object.getOwnPropertyDescriptor,d=(t,e,r,s)=>{for(var n=s>1?void 0:s?P(e,r):e,u=t.length-1,c;u>=0;u--)(c=t[u])&&(n=(s?c(e,r,n):c(n))||n);return s&&n&&O(e,r,n),n};class y{constructor(){f(this,"busyCounter",new o.ObservableMap);o.makeObservable(this)}get isBusy(){return this.busyCounter.size>0}checkBusy(e){return this.busyCounter.has(e)}getBusyTicket(e=Symbol()){const r=this.busyCounter.get(e);r?this.busyCounter.set(e,r+1):this.busyCounter.set(e,1);let s=!1;return o.action(()=>{if(!s){const n=this.busyCounter.get(e);!n||n===1?this.busyCounter.delete(e):this.busyCounter.set(e,n-1),s=!0}})}watch(e){const r=this.getBusyTicket();return e.then(r,r),e}}d([o.computed],y.prototype,"isBusy",1),d([o.action.bound],y.prototype,"getBusyTicket",1);function w(t,e,r){const s=typeof t!="object",n=s?t:Symbol(),u=(c,z,v)=>{const E=v.value;v.value=function(...F){var C;const b=(C=this.busyWatcher)==null?void 0:C.getBusyTicket(n),p=E.apply(this,F);return b&&(_(p)?p.then(b,L=>{console.error(L),b()}):b()),p}};if(s)return u;if(!e||!r)throw new Error("Wrong decorator use. PropertyKey and Descriptor must be provided");return u(t,e,r)}function _(t){return typeof(t==null?void 0:t.then)=="function"}function j(t,e,r,s){let n=t;return e&&(n=n?n+" "+e:e),r&&(n=n?n+" "+r:r),s&&(n=n?n+" "+s:s),n}function g(t,e,r){const s=r!=null?r:u=>u,n=new Map;return t.forEach(u=>n.set(e(u),s(u))),n}function B(t,e){return t.bind(e)}function M(t,e){const r=new Map;for(const s of t){const n=e(s),u=r.get(n);u?u.push(s):r.set(n,[s])}return r}var m=Object.defineProperty,D=Object.getOwnPropertyDescriptor,h=(t,e,r,s)=>{for(var n=s>1?void 0:s?D(e,r):e,u=t.length-1,c;u>=0;u--)(c=t[u])&&(n=(s?c(e,r,n):c(n))||n);return s&&n&&m(e,r,n),n};class l{constructor(){f(this,"promise");f(this,"status","new");f(this,"resolveCallback");f(this,"rejectCallback");o.makeObservable(this),this.promise=new Promise((e,r)=>{this.resolveCallback=e,this.rejectCallback=r})}resolve(e){this.resolveCallback(e),this.status="resolved"}reject(e){this.rejectCallback(e),this.status="rejected"}}h([o.observable],l.prototype,"status",2),h([o.action.bound],l.prototype,"resolve",1),h([o.action.bound],l.prototype,"reject",1);const T=t=>t;function k(t,e,r){o.isObservable(t)?o.set(t,e,r):(t[e]=r,o.makeAutoObservable(t))}function A(t){return Array.isArray(t)||o.isObservableArray(t)}function S(t){return!!t&&(t instanceof Set||o.isObservableSet(t))}function W(t){return!!t&&(t instanceof Map||o.isObservableMap(t))}function $(t){return!!t}i.BusyWatcher=y,i.ManualPromise=l,i.bind=B,i.bound=a,i.combineClassNames=j,i.createMap=g,i.ensureObservableProperty=k,i.groupBy=M,i.isArrayLike=A,i.isMap=W,i.isSet=S,i.nameof=T,i.onlyDefined=$,i.watchBusy=w,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(u,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("mobx")):typeof define=="function"&&define.amd?define(["exports","mobx"],o):(u=typeof globalThis<"u"?globalThis:u||self,o(u["fruits-helpers"]={},u.mobx))})(this,function(u,o){"use strict";var N=Object.defineProperty;var q=(u,o,a)=>o in u?N(u,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[o]=a;var f=(u,o,a)=>(q(u,typeof o!="symbol"?o+"":o,a),a);function a(t,e,n){const s=n.value;if(typeof s!="function")throw new Error(`@bound decorator can only be applied to methods, not ${typeof s}`);let r=!1;return{configurable:!0,get(){if(r||this===t.prototype||Object.prototype.hasOwnProperty.call(this,e))return s;const i=s.bind(this);return r=!0,Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0}),r=!1,i}}}var O=Object.defineProperty,P=Object.getOwnPropertyDescriptor,d=(t,e,n,s)=>{for(var r=s>1?void 0:s?P(e,n):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(r=(s?c(e,n,r):c(r))||r);return s&&r&&O(e,n,r),r};class y{constructor(){f(this,"busyCounter",new o.ObservableMap);o.makeObservable(this)}get isBusy(){return this.busyCounter.size>0}checkBusy(e){return this.busyCounter.has(e)}getBusyTicket(e=Symbol()){const n=this.busyCounter.get(e);n?this.busyCounter.set(e,n+1):this.busyCounter.set(e,1);let s=!1;return o.action(()=>{if(!s){const r=this.busyCounter.get(e);!r||r===1?this.busyCounter.delete(e):this.busyCounter.set(e,r-1),s=!0}})}watch(e){const n=this.getBusyTicket();return e.then(n,n),e}}d([o.computed],y.prototype,"isBusy",1),d([o.action.bound],y.prototype,"getBusyTicket",1);function w(t,e,n){const s=typeof t!="object",r=s?t:Symbol(),i=(c,z,v)=>{const E=v.value;v.value=function(...F){var C;const b=(C=this.busyWatcher)==null?void 0:C.getBusyTicket(r),p=E.apply(this,F);return b&&(j(p)?p.then(b,L=>{console.error(L),b()}):b()),p}};if(s)return i;if(!e||!n)throw new Error("Wrong decorator use. PropertyKey and Descriptor must be provided");return i(t,e,n)}function j(t){return typeof(t==null?void 0:t.then)=="function"}function g(t,e,n,s){let r=t;return e&&(r=r?r+" "+e:e),n&&(r=r?r+" "+n:n),s&&(r=r?r+" "+s:s),r}function _(t,e,n){const s=n??(i=>i),r=new Map;return t.forEach(i=>r.set(e(i),s(i))),r}function B(t,e){return t.bind(e)}function M(t,e){const n=new Map;for(const s of t){const r=e(s),i=n.get(r);i?i.push(s):n.set(r,[s])}return n}var m=Object.defineProperty,S=Object.getOwnPropertyDescriptor,h=(t,e,n,s)=>{for(var r=s>1?void 0:s?S(e,n):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(r=(s?c(e,n,r):c(r))||r);return s&&r&&m(e,n,r),r};class l{constructor(){f(this,"promise");f(this,"status","new");f(this,"resolveCallback");f(this,"rejectCallback");o.makeObservable(this),this.promise=new Promise((e,n)=>{this.resolveCallback=e,this.rejectCallback=n})}resolve(e){this.resolveCallback(e),this.status="resolved"}reject(e){this.rejectCallback(e),this.status="rejected"}}h([o.observable],l.prototype,"status",2),h([o.action.bound],l.prototype,"resolve",1),h([o.action.bound],l.prototype,"reject",1);const D=t=>t;function T(t,e,n){o.isObservable(t)?o.set(t,e,n):(t[e]=n,o.makeAutoObservable(t))}function k(t){return Array.isArray(t)||o.isObservableArray(t)}function A(t){return!!t&&(t instanceof Set||o.isObservableSet(t))}function W(t){return!!t&&(t instanceof Map||o.isObservableMap(t))}function $(t){return!!t}u.BusyWatcher=y,u.ManualPromise=l,u.bind=B,u.bound=a,u.combineClassNames=g,u.createMap=_,u.ensureObservableProperty=T,u.groupBy=M,u.isArrayLike=k,u.isMap=W,u.isSet=A,u.nameof=D,u.onlyDefined=$,u.watchBusy=w,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=fruits-helpers.umd.js.map |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0-rc.1", | ||
"description": "Frui.ts helper functions", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "adf52b1d60660fc686182547cca34af079bdecf4" | ||
"gitHead": "c17e77c7246207827d09d34cadbb54b07ebbd82e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48425