bt-core-app 1.4.113 → 1.4.115

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.
@@ -98,6 +98,9 @@ var Re = function() {
98
98
  }
99
99
  return S.firstBy = S, S;
100
100
  }();
101
+ function Yn(e) {
102
+ return e.reduce((t, l) => t += l, 0);
103
+ }
101
104
  function Ue(e, t) {
102
105
  let l = e ?? "", S = t ?? "";
103
106
  if (l.endsWith("/"))
@@ -110,10 +113,10 @@ function Ue(e, t) {
110
113
  while (S.startsWith("/"));
111
114
  return `${l}/${S}`;
112
115
  }
113
- function Yn(e) {
116
+ function Jn(e) {
114
117
  return e == null || !Array.isArray(e) ? e : [...new Set(e.map((t) => t))];
115
118
  }
116
- function Jn(e = "blitzItExtensionExists") {
119
+ function jn(e = "blitzItExtensionExists") {
117
120
  try {
118
121
  var t = document.getElementById(e);
119
122
  return t != null;
@@ -121,7 +124,7 @@ function Jn(e = "blitzItExtensionExists") {
121
124
  return console.log(sn(l)), !1;
122
125
  }
123
126
  }
124
- function jn(e, t) {
127
+ function Kn(e, t) {
125
128
  return [
126
129
  { lat: e.lat - t, lng: e.lng + t },
127
130
  { lat: e.lat - t, lng: e.lng - t },
@@ -129,7 +132,7 @@ function jn(e, t) {
129
132
  { lat: e.lat + t, lng: e.lng + t }
130
133
  ];
131
134
  }
132
- function Kn(e, t) {
135
+ function Qn(e, t) {
133
136
  return [
134
137
  { lat: e.lat - t * 2, lng: e.lng + t },
135
138
  { lat: e.lat - t * 2, lng: e.lng - t },
@@ -137,7 +140,7 @@ function Kn(e, t) {
137
140
  { lat: e.lat, lng: e.lng + t }
138
141
  ];
139
142
  }
140
- function Qn(e, t) {
143
+ function Xn(e, t) {
141
144
  return [
142
145
  { lat: e.lat, lng: e.lng + t },
143
146
  { lat: e.lat, lng: e.lng - t },
@@ -145,7 +148,7 @@ function Qn(e, t) {
145
148
  { lat: e.lat + t * 2, lng: e.lng + t }
146
149
  ];
147
150
  }
148
- function Xn(e) {
151
+ function On(e) {
149
152
  var t = rt(e, !0);
150
153
  return t = t.toLowerCase(), t = t.replace(" victoria ", "vic"), t = t.replace(" queensland ", "qld"), t = t.replace(" new south wales ", "nsw"), t = t.replace(" northern territory ", "nt"), t = t.replace(" western australia ", "wa"), t = t.replace(" tasmania ", "tas"), t = t.replace(" south australia ", "sa"), t = t.replace(" australian captial territory ", "act"), t = t.replace(" & ", " and "), t = t.replace(" road", " rd"), t = t.replace(" street", " st"), t = t.replace(" lane", " ln"), t = t.replace(" alley", " aly"), t = t.replace(" arcade", " arc"), t = t.replace(" boulevard", " blvd"), t = t.replace(" court", " ct"), t = t.replace(" cove", " cv"), t = t.replace(" highway", " hwy"), t.replaceAll(" ", "");
151
154
  }
@@ -157,13 +160,13 @@ function rt(e, t = !1) {
157
160
  var l = "";
158
161
  return e.addressLineOne != null && !t && (l = e.addressLineOne + " "), e.streetNumber != null && (l = l + e.streetNumber + " "), e.streetName != null && (l = l + e.streetName + ", "), e.suburb != null && (l = l + e.suburb + " "), e.state != null && (l = l + e.state + " "), e.postcode != null && (l = l + e.postcode), l;
159
162
  }
160
- function On(e, t, l) {
163
+ function pn(e, t, l) {
161
164
  if (e) {
162
165
  var S = new Image();
163
166
  S.onload = t, S.onerror = l, S.src = e;
164
167
  }
165
168
  }
166
- async function pn(e, t = !0) {
169
+ async function ea(e, t = !0) {
167
170
  return new Promise((l, S) => {
168
171
  e == null && S("no url given");
169
172
  var s = new Image();
@@ -180,7 +183,7 @@ async function pn(e, t = !0) {
180
183
  function tn(e) {
181
184
  return e && e.replace(/([A-Z])/g, " $1").replace(/^./, (t) => t.toUpperCase());
182
185
  }
183
- function ea(e) {
186
+ function ra(e) {
184
187
  if (e != null && typeof e == "object")
185
188
  for (var t in e)
186
189
  /^[A-Z]/.test(t) && Object.hasOwnProperty.call(e, t) && (e[t.charAt(0).toLowerCase() + t.substring(1)] = e[t], delete e[t]);
@@ -199,25 +202,25 @@ const Ye = [
199
202
  { value: 7, short: "sat", values: ["sat", "saturday"] },
200
203
  { value: 0, short: "always", values: ["always", null, void 0] }
201
204
  ];
202
- function ra(e) {
205
+ function ta(e) {
203
206
  if (e == null)
204
207
  return 0;
205
208
  const t = e.replaceAll(" ", "").split(",").map((S) => S.toLowerCase()), l = Ye.filter((S) => S.values.some((s) => t.some((g) => s == g))).map((S) => S.value);
206
209
  return l.length == 0 ? 8 : Math.min(...l);
207
210
  }
208
- function ta(e) {
211
+ function na(e) {
209
212
  return e == null ? e : e.toLowerCase().replaceAll(" ", "").split(",").map((t) => {
210
213
  let l = Ye.find((S) => S.values.some((s) => s == t));
211
214
  return l != null ? l.short : "";
212
215
  }).filter((t) => t != null && t.length > 0).toString();
213
216
  }
214
- function na(e, t) {
217
+ function aa(e, t) {
215
218
  if (e == null || t == null)
216
219
  return !0;
217
220
  const l = e.replaceAll(" ", "").split(",").map((g) => g.toLowerCase()), S = t.replaceAll(" ", "").toLowerCase(), s = Ye.find((g) => g.values.some((I) => I == S));
218
221
  return s != null && l.some((g) => g == s.short || s.values.some((I) => I == g));
219
222
  }
220
- function aa(e, t) {
223
+ function la(e, t) {
221
224
  if (t == null)
222
225
  return e;
223
226
  let l = e ?? "";
@@ -225,13 +228,13 @@ function aa(e, t) {
225
228
  let S = [...new Set(l.replaceAll(" ", "").toLowerCase().split(",").map((s) => Ye.find((g) => g.values.some((I) => I == s))).filter((s) => s != null).sort(Re.firstBy((s) => (s == null ? void 0 : s.value) ?? 0)).map((s) => s == null ? void 0 : s.short))].toString();
226
229
  return S.length > 0 ? S : void 0;
227
230
  }
228
- function la(e, t) {
231
+ function ua(e, t) {
229
232
  if (t == null || e == null)
230
233
  return e;
231
234
  let l = e ?? "", S = t.replaceAll(" ", "").toLowerCase(), s = [...new Set(l.replaceAll(" ", "").toLowerCase().split(",").map((g) => Ye.find((I) => I.values.some((P) => P == g && P != S))).filter((g) => g != null).sort(Re.firstBy((g) => (g == null ? void 0 : g.value) ?? 0)).map((g) => g == null ? void 0 : g.short))].toString();
232
235
  return s.length > 0 ? s : void 0;
233
236
  }
234
- function ua(e, t) {
237
+ function ia(e, t) {
235
238
  return e != null && Array.isArray(e) && e.length == t;
236
239
  }
237
240
  function _e(e, t = 0) {
@@ -240,13 +243,13 @@ function _e(e, t = 0) {
240
243
  function an(e) {
241
244
  return e == "0001-01-01T00:00:00Z";
242
245
  }
243
- function ia() {
246
+ function ca() {
244
247
  return (/* @__PURE__ */ new Date("0001-01-01T00:00:00Z")).getTime();
245
248
  }
246
249
  function ln() {
247
250
  return "0001-01-01T00:00:00Z";
248
251
  }
249
- function ca(e, t) {
252
+ function fa(e, t) {
250
253
  let l = "1", S = 0;
251
254
  if (S < t)
252
255
  do
@@ -255,7 +258,7 @@ function ca(e, t) {
255
258
  let s = Number.parseInt(l);
256
259
  return Math.round(e * s) / s;
257
260
  }
258
- function fa(e, t) {
261
+ function sa(e, t) {
259
262
  let l = e ?? "";
260
263
  return t != null && (un(l, t) ? l = l.split(",").filter((S) => S != t).toString() : l != null ? l = `${l},${t}` : l = t), l != null && l.length > 0 ? l : null;
261
264
  }
@@ -294,7 +297,7 @@ function tt(e, t = (l) => l) {
294
297
  return _e(g) && S.push(...g), S;
295
298
  }, [])] : [];
296
299
  }
297
- function sa(e) {
300
+ function oa(e) {
298
301
  const t = e.split(","), l = t[0].indexOf("base64") >= 0 ? atob(t[1]) : decodeURI(t[1]), S = t[0].split(":")[1].split(";")[0], s = new Uint8Array(l.length);
299
302
  for (let g = 0; g < l.length; g++)
300
303
  s[g] = l.charCodeAt(g);
@@ -330,10 +333,10 @@ function dn(e, t, l) {
330
333
  }
331
334
  return !1;
332
335
  }
333
- function oa(e) {
336
+ function da(e) {
334
337
  return e != null ? e.replaceAll(" ", "").toLowerCase() : null;
335
338
  }
336
- function da(e = 2e3) {
339
+ function ha(e = 2e3) {
337
340
  return new Promise((t) => {
338
341
  setTimeout(() => t(), e);
339
342
  });
@@ -1822,7 +1825,7 @@ function gn(e) {
1822
1825
  const l = le[t] ?? le.development;
1823
1826
  return e == null ? l.data ?? "" : l.other[e] ?? l.data ?? "";
1824
1827
  }
1825
- function ha() {
1828
+ function ma() {
1826
1829
  return le;
1827
1830
  }
1828
1831
  function yn(e) {
@@ -1836,7 +1839,7 @@ function ve() {
1836
1839
  const e = lt();
1837
1840
  return (pe == null || pe.config.name != e) && (pe = at.createInstance({ name: e })), pe;
1838
1841
  }
1839
- function ma() {
1842
+ function va() {
1840
1843
  async function e(s) {
1841
1844
  const g = ve();
1842
1845
  (await g.keys()).filter((_) => _.startsWith(s)).forEach((_) => {
@@ -1860,7 +1863,7 @@ function ma() {
1860
1863
  };
1861
1864
  }
1862
1865
  let rr;
1863
- function va(e) {
1866
+ function ga(e) {
1864
1867
  return rr(e)();
1865
1868
  }
1866
1869
  function Ne(e) {
@@ -3066,10 +3069,10 @@ const mr = {
3066
3069
  warning: "#FB8C00"
3067
3070
  };
3068
3071
  let Dr;
3069
- function ga() {
3072
+ function ya() {
3070
3073
  return Dr;
3071
3074
  }
3072
- function ya(e) {
3075
+ function wa(e) {
3073
3076
  const t = localStorage.getItem("cosmetics");
3074
3077
  let l;
3075
3078
  return t != null && t.length > 0 && (l = JSON.parse(t)), l ?? (l = {}), l.dark ?? (l.dark = e == null ? void 0 : e.dark), l.light ?? (l.light = e == null ? void 0 : e.light), l.theme ?? (l.theme = e == null ? void 0 : e.defaultTheme), {
@@ -3150,7 +3153,7 @@ function Pn(e) {
3150
3153
  undoTemporaryColor: $
3151
3154
  }, Dr;
3152
3155
  }
3153
- const wa = {
3156
+ const ba = {
3154
3157
  canExportCSV: !1
3155
3158
  };
3156
3159
  function Ln() {
@@ -3207,7 +3210,7 @@ function Ln() {
3207
3210
  };
3208
3211
  }
3209
3212
  let xr;
3210
- function ba() {
3213
+ function Sa() {
3211
3214
  return xr;
3212
3215
  }
3213
3216
  function Nn(e) {
@@ -3252,7 +3255,7 @@ function Nn(e) {
3252
3255
  }, xr;
3253
3256
  }
3254
3257
  let Tr;
3255
- function Sa() {
3258
+ function Aa() {
3256
3259
  return Tr;
3257
3260
  }
3258
3261
  function Mn(e) {
@@ -3364,7 +3367,7 @@ function Mn(e) {
3364
3367
  }, Tr;
3365
3368
  }
3366
3369
  var Rn = { BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
3367
- function Aa(e) {
3370
+ function Ea(e) {
3368
3371
  function t(l) {
3369
3372
  var s;
3370
3373
  const S = l.matched.slice().reverse().find((g) => g.meta && g.meta.title);
@@ -3381,7 +3384,7 @@ function Aa(e) {
3381
3384
  };
3382
3385
  }
3383
3386
  let _r;
3384
- function Ea() {
3387
+ function Ia() {
3385
3388
  return _r;
3386
3389
  }
3387
3390
  function Un(e) {
@@ -3534,7 +3537,7 @@ function Bn(e, t) {
3534
3537
  restartTracker: I
3535
3538
  };
3536
3539
  }
3537
- function Ia(e, t) {
3540
+ function Da(e, t) {
3538
3541
  var Y;
3539
3542
  const {
3540
3543
  // useBladeSrc = true,
@@ -3776,7 +3779,7 @@ function $n(e) {
3776
3779
  updateNavigationProperties: d
3777
3780
  }, Cr;
3778
3781
  }
3779
- function Da(e, t, l) {
3782
+ function xa(e, t, l) {
3780
3783
  var He, Ve;
3781
3784
  const S = Ln(), s = it(), g = Nr(), I = et(), { bladeData: P } = Cn({}), _ = e.useBladeSrc ?? !0, N = e.useRouteSrc ?? !0, $ = e.nav ?? e.bladeName ?? e.itemBladeName ?? "basic", d = e.storeMode ?? ((He = s.findItem($)) == null ? void 0 : He.storeMode), h = e.storageMode ?? ((Ve = s.findItem($)) == null ? void 0 : Ve.storageMode), u = J(e.customFilters) ?? [], r = z([]), w = ee(() => Kt([
3782
3785
  ...u.filter((U) => U.name != null).map((U) => U.name),
@@ -3964,7 +3967,7 @@ function Da(e, t, l) {
3964
3967
  ...Q,
3965
3968
  onGetSuccessAsync: async (O, de) => {
3966
3969
  let ye = O == null ? void 0 : O.data;
3967
- return r.value = (O == null ? void 0 : O.filters) ?? [], e.useServerPagination === !0 && e.itemsPerPage && O.count && (Be.value = Math.ceil(O.count / e.itemsPerPage)), e.onGetSuccessAsync != null && (ye = await e.onGetSuccessAsync(ye, de)), ye;
3970
+ return r.value = (O == null ? void 0 : O.filters) ?? [], d != "whole-last-updated" && e.useServerPagination === !0 && e.itemsPerPage && O.count && (Be.value = Math.ceil(O.count / e.itemsPerPage)), e.onGetSuccessAsync != null && (ye = await e.onGetSuccessAsync(ye, de)), ye;
3968
3971
  }
3969
3972
  });
3970
3973
  E.value = V, c.value = [...D.value];
@@ -4026,7 +4029,6 @@ function Da(e, t, l) {
4026
4029
  searchString: T,
4027
4030
  selectedFilters: D,
4028
4031
  selectItem: je,
4029
- // serverFilters,
4030
4032
  showError: se,
4031
4033
  showInactive: C,
4032
4034
  showSearch: ge,
@@ -4046,7 +4048,7 @@ function Fn(e) {
4046
4048
  useRoutes: e == null ? void 0 : e.useRoutes
4047
4049
  }, We;
4048
4050
  }
4049
- function xa() {
4051
+ function Ta() {
4050
4052
  const e = Nr(), t = it(), l = In();
4051
4053
  let S = e.getRoutes();
4052
4054
  return {
@@ -4081,7 +4083,7 @@ function xa() {
4081
4083
  };
4082
4084
  }
4083
4085
  let Pr;
4084
- function Ta(e) {
4086
+ function _a(e) {
4085
4087
  return Pr.usePresets(e);
4086
4088
  }
4087
4089
  function kn(e) {
@@ -4098,7 +4100,7 @@ function kn(e) {
4098
4100
  let Yr, Jr, jr, Kr = !1;
4099
4101
  const wr = z(!1), br = z(!1), Qr = z(), er = z();
4100
4102
  let Lr;
4101
- function _a() {
4103
+ function Ca() {
4102
4104
  return Lr;
4103
4105
  }
4104
4106
  function Gn() {
@@ -4131,11 +4133,11 @@ function Gn() {
4131
4133
  updateApp: g
4132
4134
  }, Lr;
4133
4135
  }
4134
- function Ca(e) {
4136
+ function Pa(e) {
4135
4137
  const t = [];
4136
4138
  return (e == null ? void 0 : e.required) == !0 && t.push((l) => !!l || "Field is required"), (e == null ? void 0 : e.otherRules) != null && (Array.isArray(e == null ? void 0 : e.otherRules) ? t.push(...e.otherRules) : t.push(e.otherRules)), (e == null ? void 0 : e.forPassword) == !0 && (t.push((l) => !!l || "Password is required"), t.push((l) => l != null && l.length > 9 || "Password must be 10 or more characters"), t.push((l) => /^(.*[a-z].*)$/.test(l) || "Password must contain a lowercase letter"), t.push((l) => /^(.*[A-Z].*)$/.test(l) || "Password must contain an uppercase letter"), t.push((l) => /^(.*\d.*)$/.test(l) || "Password must contain a number")), (e == null ? void 0 : e.forEmail) == !0 && (t.push((l) => !!l || "Email is required"), t.push((l) => hn(l) || "Email must be valid")), t;
4137
4139
  }
4138
- function Pa(e) {
4140
+ function La(e) {
4139
4141
  return {
4140
4142
  install(t, l) {
4141
4143
  var _;
@@ -4162,18 +4164,18 @@ function Pa(e) {
4162
4164
  };
4163
4165
  }
4164
4166
  export {
4165
- sa as DataURIToBlob,
4166
- aa as addWeekday,
4167
+ oa as DataURIToBlob,
4168
+ la as addWeekday,
4167
4169
  Ue as appendUrl,
4168
4170
  nn as capitalizeWords,
4169
- On as checkImage,
4171
+ pn as checkImage,
4170
4172
  fn as containsSearch,
4171
- na as containsWeekday,
4173
+ aa as containsWeekday,
4172
4174
  Mr as copyDeep,
4173
4175
  cn as copyItemByAlphabet,
4174
4176
  En as createApi,
4175
4177
  Dn as createAuth,
4176
- Pa as createCore,
4178
+ La as createCore,
4177
4179
  Pn as createCosmetics,
4178
4180
  Nn as createDates,
4179
4181
  Mn as createDemo,
@@ -4187,33 +4189,34 @@ export {
4187
4189
  yn as createUrl,
4188
4190
  qr as createWholeLastUpdateStoreDefinition,
4189
4191
  un as csvContains,
4190
- wa as csvDefaults,
4192
+ ba as csvDefaults,
4191
4193
  tt as deepSelect,
4192
- Yn as distinct,
4193
- Jn as extensionExists,
4194
+ Jn as distinct,
4195
+ jn as extensionExists,
4194
4196
  sn as extractErrorDescription,
4195
4197
  tn as fromCamelCase,
4196
- jn as getAreaAround,
4197
- Kn as getAreaToLeft,
4198
- Qn as getAreaToRight,
4199
- Xn as getGoogleMapsLocationLine,
4200
- pn as getImageData,
4198
+ Kn as getAreaAround,
4199
+ Qn as getAreaToLeft,
4200
+ Xn as getAreaToRight,
4201
+ On as getGoogleMapsLocationLine,
4202
+ ea as getImageData,
4201
4203
  rt as getLocationLine,
4202
- ia as getMinDate,
4204
+ ca as getMinDate,
4203
4205
  ln as getMinDateString,
4204
4206
  on as getRandomColor,
4205
4207
  dn as hasSearch,
4206
- ua as isArrayOfLength,
4208
+ ia as isArrayOfLength,
4207
4209
  _e as isLengthyArray,
4208
4210
  an as isMinDate,
4209
4211
  Sr as nestedValue,
4210
- la as removeWeekday,
4211
- ca as roundTo,
4212
+ ua as removeWeekday,
4213
+ fa as roundTo,
4212
4214
  mn as singularize,
4213
- ea as toCamelCase,
4214
- oa as toCompareString,
4215
- fa as toggleCSV,
4216
- da as twiddleThumbs,
4215
+ Yn as sum,
4216
+ ra as toCamelCase,
4217
+ da as toCompareString,
4218
+ sa as toggleCSV,
4219
+ ha as twiddleThumbs,
4217
4220
  ut as useActions,
4218
4221
  en as useActionsTracker,
4219
4222
  Er as useApi,
@@ -4221,32 +4224,32 @@ export {
4221
4224
  Wr as useAuthUrl,
4222
4225
  Cn as useBlade,
4223
4226
  Ln as useCSV,
4224
- ga as useCosmetics,
4227
+ ya as useCosmetics,
4225
4228
  gn as useDataUrl,
4226
- ba as useDates,
4229
+ Sa as useDates,
4227
4230
  lt as useDbName,
4228
- Sa as useDemo,
4229
- Aa as useDocumentMeta,
4231
+ Aa as useDemo,
4232
+ Ea as useDocumentMeta,
4230
4233
  xn as useDraggable,
4231
- Ea as useFilters,
4234
+ Ia as useFilters,
4232
4235
  Ot as useId,
4233
- Ia as useItem,
4234
- Da as useList,
4235
- ma as useLocalCache,
4236
- ya as useLocalCosmetics,
4236
+ Da as useItem,
4237
+ xa as useList,
4238
+ va as useLocalCache,
4239
+ wa as useLocalCosmetics,
4237
4240
  ve as useLocalDb,
4238
- xa as useMenu,
4241
+ Ta as useMenu,
4239
4242
  it as useNavigation,
4240
- _a as usePWA,
4241
- Ta as usePresets,
4243
+ Ca as usePWA,
4244
+ _a as usePresets,
4242
4245
  _n as useResizable,
4243
- Ca as useRules,
4244
- va as useStore,
4246
+ Pa as useRules,
4247
+ ga as useStore,
4245
4248
  Ne as useStoreDefinition,
4246
4249
  Bn as useTracker,
4247
- ha as useUrls,
4250
+ ma as useUrls,
4248
4251
  hn as validEmail,
4249
4252
  Ye as weekdayPairs,
4250
- ta as weekdayShortName,
4251
- ra as weekdayValue
4253
+ na as weekdayShortName,
4254
+ ta as weekdayValue
4252
4255
  };
package/dist/index.d.ts CHANGED
@@ -971,6 +971,8 @@ export declare interface StoreGetReturn<T> {
971
971
 
972
972
  export declare type StoreMode = 'whole-last-updated' | 'partial-last-updated' | 'session';
973
973
 
974
+ export declare function sum(array: number[]): number;
975
+
974
976
  export declare interface SWEvent extends Event {
975
977
  detail: any;
976
978
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bt-core-app",
3
- "version": "1.4.113",
3
+ "version": "1.4.115",
4
4
  "description": "Core app tools for some basic features like navigation, authentication, server apis, and cosmetics",
5
5
  "homepage": "https://github.com/BlitzItTech/bt-core",
6
6
  "bugs": {