wacom 21.2.3 → 21.2.5

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.
@@ -50,9 +50,7 @@ class CoreService {
50
50
  const stored = localStorage.getItem('deviceID');
51
51
  this.deviceID =
52
52
  stored ||
53
- (typeof crypto?.randomUUID === 'function'
54
- ? crypto.randomUUID()
55
- : this.UUID());
53
+ (typeof crypto?.randomUUID === 'function' ? crypto.randomUUID() : this.UUID());
56
54
  localStorage.setItem('deviceID', this.deviceID);
57
55
  this.detectDevice();
58
56
  this.detectViewport();
@@ -100,9 +98,7 @@ class CoreService {
100
98
  const arr = [];
101
99
  for (const each in obj) {
102
100
  if (obj.hasOwnProperty(each) &&
103
- (obj[each] ||
104
- typeof obj[each] === 'number' ||
105
- typeof obj[each] === 'boolean')) {
101
+ (obj[each] || typeof obj[each] === 'number' || typeof obj[each] === 'boolean')) {
106
102
  if (holder) {
107
103
  arr.push(each);
108
104
  }
@@ -125,8 +121,8 @@ class CoreService {
125
121
  if (!Array.isArray(removeArray) || !Array.isArray(fromArray)) {
126
122
  return fromArray;
127
123
  }
128
- const removeSet = new Set(removeArray.map((item) => item[compareField]));
129
- return fromArray.filter((item) => !removeSet.has(item[compareField]));
124
+ const removeSet = new Set(removeArray.map(item => item[compareField]));
125
+ return fromArray.filter(item => !removeSet.has(item[compareField]));
130
126
  }
131
127
  /**
132
128
  * Unites multiple _id values into a single unique _id.
@@ -137,8 +133,7 @@ class CoreService {
137
133
  */
138
134
  ids2id(...args) {
139
135
  args.sort((a, b) => {
140
- if (Number(a.toString().substring(0, 8)) >
141
- Number(b.toString().substring(0, 8))) {
136
+ if (Number(a.toString().substring(0, 8)) > Number(b.toString().substring(0, 8))) {
142
137
  return 1;
143
138
  }
144
139
  return -1;
@@ -211,8 +206,7 @@ class CoreService {
211
206
  else if (/android/i.test(userAgent)) {
212
207
  this.device = 'Android';
213
208
  }
214
- else if (/iPad|iPhone|iPod/.test(userAgent) &&
215
- !window.MSStream) {
209
+ else if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
216
210
  this.device = 'iOS';
217
211
  }
218
212
  else {
@@ -224,9 +218,7 @@ class CoreService {
224
218
  * @returns {boolean} - Returns true if the device is a mobile device.
225
219
  */
226
220
  isMobile() {
227
- return (this.device === 'Windows Phone' ||
228
- this.device === 'Android' ||
229
- this.device === 'iOS');
221
+ return (this.device === 'Windows Phone' || this.device === 'Android' || this.device === 'iOS');
230
222
  }
231
223
  /**
232
224
  * Checks if the device is a tablet.
@@ -324,7 +316,7 @@ class CoreService {
324
316
  unlock(which) {
325
317
  this._locked[which] = false;
326
318
  if (this._unlockResolvers[which]) {
327
- this._unlockResolvers[which].forEach((resolve) => resolve());
319
+ this._unlockResolvers[which].forEach(resolve => resolve());
328
320
  this._unlockResolvers[which] = [];
329
321
  }
330
322
  }
@@ -337,7 +329,7 @@ class CoreService {
337
329
  if (!this._locked[which]) {
338
330
  return Promise.resolve();
339
331
  }
340
- return new Promise((resolve) => {
332
+ return new Promise(resolve => {
341
333
  if (!this._unlockResolvers[which]) {
342
334
  this._unlockResolvers[which] = [];
343
335
  }
@@ -406,7 +398,7 @@ class CoreService {
406
398
  * });
407
399
  */
408
400
  toSignalsArray(arr, signalFields = {}) {
409
- return arr.map((obj) => this.toSignal(obj, signalFields));
401
+ return arr.map(obj => this.toSignal(obj, signalFields));
410
402
  }
411
403
  /**
412
404
  * Adds a new object to the signals array.
@@ -432,7 +424,7 @@ class CoreService {
432
424
  * @returns {void}
433
425
  */
434
426
  removeSignalByField(signals, value, field = '_id') {
435
- const idx = signals.findIndex((sig) => sig()[field] === value);
427
+ const idx = signals.findIndex(sig => sig()[field] === value);
436
428
  if (idx > -1)
437
429
  signals.splice(idx, 1);
438
430
  }
@@ -454,7 +446,7 @@ class CoreService {
454
446
  * @returns {Signal<Document> | undefined} The found signal or undefined if not found.
455
447
  */
456
448
  findSignalByField(signals, value, field = '_id') {
457
- return signals.find((sig) => sig()[field] === value);
449
+ return signals.find(sig => sig()[field] === value);
458
450
  }
459
451
  /**
460
452
  * Updates the first writable signal in the array whose object's field matches the provided value.
@@ -530,14 +522,14 @@ class CrudComponent {
530
522
  */
531
523
  setDocuments(page = this.page, query = '') {
532
524
  query = this.setDocumentsQuery(query);
533
- return new Promise((resolve) => {
525
+ return new Promise(resolve => {
534
526
  if (this.configType === 'server') {
535
527
  this.page = page;
536
528
  this.__core.afterWhile(this, () => {
537
529
  this.crudService
538
530
  .get({ page, query }, this.getOptions())
539
531
  .subscribe((docs) => {
540
- this.documents.update(() => (docs || []).map((doc) => this.crudService.getSignal(doc)));
532
+ this.documents.update(() => (docs || []).map(doc => this.crudService.getSignal(doc)));
541
533
  resolve();
542
534
  this.__cdr.markForCheck();
543
535
  });
@@ -547,7 +539,7 @@ class CrudComponent {
547
539
  this.documents.update(() => this.crudService
548
540
  .getDocs()
549
541
  .filter(this.localDocumentsFilter)
550
- .map((doc) => this.crudService.getSignal(doc)));
542
+ .map(doc => this.crudService.getSignal(doc)));
551
543
  this.crudService.loaded.pipe(take(1)).subscribe(() => {
552
544
  resolve();
553
545
  this.__cdr.markForCheck();
@@ -599,10 +591,7 @@ class CrudComponent {
599
591
  this.__formService
600
592
  .modalDocs(isCreateFlow
601
593
  ? []
602
- : this.documents().map((obj) => Object.fromEntries(this.updatableFields.map((key) => [
603
- key,
604
- obj()[key],
605
- ]))))
594
+ : this.documents().map((obj) => Object.fromEntries(this.updatableFields.map(key => [key, obj()[key]]))))
606
595
  .then(async (docs) => {
607
596
  if (isCreateFlow) {
608
597
  for (const doc of docs) {
@@ -612,14 +601,14 @@ class CrudComponent {
612
601
  }
613
602
  else {
614
603
  for (const document of this.documents()) {
615
- if (!docs.find((d) => d._id === document()._id)) {
604
+ if (!docs.find(d => d._id === document()._id)) {
616
605
  await firstValueFrom(this.crudService.delete(document()));
617
606
  }
618
607
  }
619
608
  for (const doc of docs) {
620
- const local = this.documents().find((document) => document()._id === doc._id);
609
+ const local = this.documents().find(document => document()._id === doc._id);
621
610
  if (local) {
622
- local.update((document) => {
611
+ local.update(document => {
623
612
  this.__core.copy(doc, document);
624
613
  return document;
625
614
  });
@@ -673,9 +662,9 @@ class CrudComponent {
673
662
  }
674
663
  /** Moves the given document one position up and updates ordering. */
675
664
  moveUp(doc) {
676
- const index = this.documents().findIndex((document) => document()._id === doc._id);
665
+ const index = this.documents().findIndex(document => document()._id === doc._id);
677
666
  if (index) {
678
- this.documents.update((documents) => {
667
+ this.documents.update(documents => {
679
668
  documents.splice(index, 1);
680
669
  documents.splice(index - 1, 0, this.crudService.getSignal(doc));
681
670
  return documents;
@@ -843,7 +832,7 @@ class EmitterService {
843
832
  }
844
833
  onComplete(tasks, opts) {
845
834
  const list = (Array.isArray(tasks) ? tasks : [tasks]).filter(Boolean);
846
- const streams = list.map((id) => toObservable(this._getDoneSignal(id)).pipe(filter((v) => v !== undefined), map((v) => v)));
835
+ const streams = list.map(id => toObservable(this._getDoneSignal(id)).pipe(filter((v) => v !== undefined), map(v => v)));
847
836
  let source$;
848
837
  if (list.length <= 1) {
849
838
  // single-task await
@@ -859,7 +848,7 @@ class EmitterService {
859
848
  source$ = source$.pipe(timeout({ first: opts.timeoutMs }));
860
849
  }
861
850
  if (opts?.abort) {
862
- const abort$ = new Observable((sub) => {
851
+ const abort$ = new Observable(sub => {
863
852
  const handler = () => {
864
853
  sub.next();
865
854
  sub.complete();
@@ -1025,7 +1014,7 @@ class HttpService {
1025
1014
  }
1026
1015
  // Handle request locking to avoid multiple simultaneous requests
1027
1016
  if (this.locked && !opts.skipLock) {
1028
- return new Observable((observer) => {
1017
+ return new Observable(observer => {
1029
1018
  const wait = setTimeout(() => {
1030
1019
  this._post(url, doc, callback, opts, method).subscribe(observer);
1031
1020
  }, 100);
@@ -1046,8 +1035,7 @@ class HttpService {
1046
1035
  }))
1047
1036
  .subscribe({
1048
1037
  next: (resp) => {
1049
- if (opts.acceptance &&
1050
- typeof opts.acceptance === 'function') {
1038
+ if (opts.acceptance && typeof opts.acceptance === 'function') {
1051
1039
  if (!opts.acceptance(resp)) {
1052
1040
  const error = new HttpErrorResponse({
1053
1041
  error: 'Acceptance failed',
@@ -1086,7 +1074,7 @@ class HttpService {
1086
1074
  responseSubject.next(resp);
1087
1075
  responseSubject.complete();
1088
1076
  },
1089
- error: (err) => responseSubject.error(err),
1077
+ error: err => responseSubject.error(err),
1090
1078
  complete: () => responseSubject.complete(),
1091
1079
  });
1092
1080
  return responseSubject.asObservable();
@@ -1152,7 +1140,7 @@ class HttpService {
1152
1140
  */
1153
1141
  handleError(callback, retry) {
1154
1142
  return (error) => {
1155
- return new Promise((resolve) => {
1143
+ return new Promise(resolve => {
1156
1144
  this.err_handle(error, callback, retry);
1157
1145
  resolve();
1158
1146
  });
@@ -1324,8 +1312,7 @@ class NetworkService {
1324
1312
  * - otherwise 'poor'.
1325
1313
  */
1326
1314
  _updateClassification() {
1327
- if (!this._isOnline() ||
1328
- this._fails >= this._config.maxConsecutiveFails) {
1315
+ if (!this._isOnline() || this._fails >= this._config.maxConsecutiveFails) {
1329
1316
  if (this._status() !== 'none') {
1330
1317
  this._status.set('none');
1331
1318
  this._emitterService.emit('wacom_offline');
@@ -1677,8 +1664,7 @@ class CrudService {
1677
1664
  }
1678
1665
  else if (this._isBrowser && localStorage.getItem('waw_user')) {
1679
1666
  const user = JSON.parse(localStorage.getItem('waw_user'));
1680
- if (user._id ===
1681
- localStorage.getItem(this._config.name + 'waw_user_id')) {
1667
+ if (user._id === localStorage.getItem(this._config.name + 'waw_user_id')) {
1682
1668
  this.restoreDocs();
1683
1669
  }
1684
1670
  }
@@ -1880,7 +1866,7 @@ class CrudService {
1880
1866
  if (this._config.replace) {
1881
1867
  this._config.replace(doc);
1882
1868
  }
1883
- const existingDoc = this._docs.find((d) => (this._id(doc) && this._id(d) === this._id(doc)) ||
1869
+ const existingDoc = this._docs.find(d => (this._id(doc) && this._id(d) === this._id(doc)) ||
1884
1870
  (doc._localId && d._localId === doc._localId));
1885
1871
  if (existingDoc) {
1886
1872
  this.__coreService.copy(doc, existingDoc);
@@ -1919,16 +1905,14 @@ class CrudService {
1919
1905
  if (this._signal[_id]) {
1920
1906
  return this._signal[_id]();
1921
1907
  }
1922
- let doc = this._docs.find((d) => this._id(d) === _id ||
1923
- (d._localId && d._localId === Number(_id))) || null;
1908
+ let doc = this._docs.find(d => this._id(d) === _id || (d._localId && d._localId === Number(_id))) || null;
1924
1909
  // If doc not found, create + push into _docs so it is not detached
1925
1910
  if (!doc) {
1926
1911
  doc = this.new({ _id });
1927
1912
  this._docs.push(doc);
1928
1913
  this.setDocs();
1929
1914
  }
1930
- if (!this._docs.find((d) => this._id(d) === _id) &&
1931
- !this._fetchingId[_id]) {
1915
+ if (!this._docs.find(d => this._id(d) === _id) && !this._fetchingId[_id]) {
1932
1916
  this._fetchingId[_id] = true;
1933
1917
  setTimeout(() => {
1934
1918
  this.fetch({ _id }).subscribe((_doc) => {
@@ -1989,15 +1973,13 @@ class CrudService {
1989
1973
  */
1990
1974
  get(config = {}, options = {}) {
1991
1975
  if (!this.__networkService.isOnline()) {
1992
- return new Observable((observer) => {
1976
+ return new Observable(observer => {
1993
1977
  this._onOnline.push(() => {
1994
1978
  this.get(config, options).subscribe(observer);
1995
1979
  });
1996
1980
  });
1997
1981
  }
1998
- if (this._isBrowser &&
1999
- !this._config.unauthorized &&
2000
- localStorage.getItem('waw_user')) {
1982
+ if (this._isBrowser && !this._config.unauthorized && localStorage.getItem('waw_user')) {
2001
1983
  const user = JSON.parse(localStorage.getItem('waw_user'));
2002
1984
  localStorage.setItem(this._config.name + 'waw_user_id', user._id);
2003
1985
  }
@@ -2014,7 +1996,7 @@ class CrudService {
2014
1996
  if (typeof config.page !== 'number') {
2015
1997
  this.clearDocs();
2016
1998
  }
2017
- resp.forEach((doc) => this.addDoc(doc));
1999
+ resp.forEach(doc => this.addDoc(doc));
2018
2000
  if (options.callback) {
2019
2001
  options.callback(resp);
2020
2002
  }
@@ -2041,7 +2023,7 @@ class CrudService {
2041
2023
  * @returns An observable that resolves with the created document, or emits an error if already created.
2042
2024
  */
2043
2025
  create(doc = {}, options = {}) {
2044
- return defer(() => from(this._mw(this.beforeCreate(doc, options))).pipe(switchMap((mwDoc) => {
2026
+ return defer(() => from(this._mw(this.beforeCreate(doc, options))).pipe(switchMap(mwDoc => {
2045
2027
  doc = (mwDoc || doc);
2046
2028
  if (doc._id) {
2047
2029
  return this.update(doc, options);
@@ -2052,14 +2034,14 @@ class CrudService {
2052
2034
  this.addDoc(doc);
2053
2035
  this._filterDocuments();
2054
2036
  if (!this.__networkService.isOnline()) {
2055
- return new Observable((observer) => {
2037
+ return new Observable(observer => {
2056
2038
  this._onOnline.push(() => {
2057
2039
  this.create(doc, options).subscribe(observer);
2058
2040
  });
2059
2041
  });
2060
2042
  }
2061
2043
  if (doc.__creating) {
2062
- return new Observable((observer) => {
2044
+ return new Observable(observer => {
2063
2045
  observer.error(new Error('Document is currently already creating.'));
2064
2046
  });
2065
2047
  }
@@ -2104,10 +2086,10 @@ class CrudService {
2104
2086
  * @returns An observable that resolves with the fetched document.
2105
2087
  */
2106
2088
  fetch(query = {}, options = {}) {
2107
- return defer(() => from(this._mw(this.beforeFetch(query, options))).pipe(switchMap((mwQuery) => {
2089
+ return defer(() => from(this._mw(this.beforeFetch(query, options))).pipe(switchMap(mwQuery => {
2108
2090
  query = (mwQuery || query);
2109
2091
  if (!this.__networkService.isOnline()) {
2110
- return new Observable((observer) => {
2092
+ return new Observable(observer => {
2111
2093
  this._onOnline.push(() => {
2112
2094
  this.fetch(query, options).subscribe(observer);
2113
2095
  });
@@ -2145,13 +2127,13 @@ class CrudService {
2145
2127
  * @returns An observable that emits the updated document.
2146
2128
  */
2147
2129
  updateAfterWhile(doc, options = {}) {
2148
- return new Observable((observer) => {
2130
+ return new Observable(observer => {
2149
2131
  this.__coreService.afterWhile(this._id(doc), () => {
2150
2132
  this.update(doc, options).subscribe({
2151
- next: (updatedDoc) => {
2133
+ next: updatedDoc => {
2152
2134
  observer.next(updatedDoc); // Emit the updated document
2153
2135
  },
2154
- error: (err) => {
2136
+ error: err => {
2155
2137
  observer.error(err); // Forward the error
2156
2138
  },
2157
2139
  complete: () => {
@@ -2169,11 +2151,11 @@ class CrudService {
2169
2151
  * @returns An observable that resolves with the updated document.
2170
2152
  */
2171
2153
  update(doc, options = {}) {
2172
- return defer(() => from(this._mw(this.beforeUpdate(doc, options))).pipe(switchMap((mwDoc) => {
2154
+ return defer(() => from(this._mw(this.beforeUpdate(doc, options))).pipe(switchMap(mwDoc => {
2173
2155
  doc = (mwDoc || doc);
2174
2156
  this._updateModified(doc, 'up' + (options.name || ''), options);
2175
2157
  if (!this.__networkService.isOnline()) {
2176
- return new Observable((observer) => {
2158
+ return new Observable(observer => {
2177
2159
  this._onOnline.push(() => {
2178
2160
  this.update(doc, options).subscribe(observer);
2179
2161
  });
@@ -2215,11 +2197,11 @@ class CrudService {
2215
2197
  * @returns An observable that resolves with the updated document.
2216
2198
  */
2217
2199
  unique(doc, options = {}) {
2218
- return defer(() => from(this._mw(this.beforeUnique(doc, options))).pipe(switchMap((mwDoc) => {
2200
+ return defer(() => from(this._mw(this.beforeUnique(doc, options))).pipe(switchMap(mwDoc => {
2219
2201
  doc = (mwDoc || doc);
2220
2202
  this._updateModified(doc, 'un' + (options.name || ''), options);
2221
2203
  if (!this.__networkService.isOnline()) {
2222
- return new Observable((observer) => {
2204
+ return new Observable(observer => {
2223
2205
  this._onOnline.push(() => {
2224
2206
  this.unique(doc, options).subscribe(observer);
2225
2207
  });
@@ -2259,7 +2241,7 @@ class CrudService {
2259
2241
  * @returns An observable that resolves with the deleted document.
2260
2242
  */
2261
2243
  delete(doc, options = {}) {
2262
- return defer(() => from(this._mw(this.beforeDelete(doc, options))).pipe(switchMap((mwDoc) => {
2244
+ return defer(() => from(this._mw(this.beforeDelete(doc, options))).pipe(switchMap(mwDoc => {
2263
2245
  doc = (mwDoc || doc);
2264
2246
  doc.__deleted = true;
2265
2247
  doc.__options ||= {};
@@ -2267,7 +2249,7 @@ class CrudService {
2267
2249
  this.addDoc(doc);
2268
2250
  this._filterDocuments();
2269
2251
  if (!this.__networkService.isOnline()) {
2270
- return new Observable((observer) => {
2252
+ return new Observable(observer => {
2271
2253
  this._onOnline.push(() => {
2272
2254
  this.delete(doc, options).subscribe(observer);
2273
2255
  });
@@ -2277,7 +2259,7 @@ class CrudService {
2277
2259
  obs.subscribe({
2278
2260
  next: async (resp) => {
2279
2261
  if (resp) {
2280
- const idx = this._docs.findIndex((d) => this._id(d) === this._id(doc));
2262
+ const idx = this._docs.findIndex(d => this._id(d) === this._id(doc));
2281
2263
  if (idx !== -1)
2282
2264
  this._docs.splice(idx, 1);
2283
2265
  this.setDocs();
@@ -2314,7 +2296,7 @@ class CrudService {
2314
2296
  const callback = () => {
2315
2297
  if (Array.isArray(storeObjectOrArray)) {
2316
2298
  let result = this._docs
2317
- .filter((doc) => !doc.__deleted)
2299
+ .filter(doc => !doc.__deleted)
2318
2300
  .filter(config.valid ?? (() => true));
2319
2301
  storeObjectOrArray.length = 0;
2320
2302
  if (typeof config.sort === 'function') {
@@ -2354,22 +2336,21 @@ class CrudService {
2354
2336
  }
2355
2337
  if (typeof config.field === 'function') {
2356
2338
  if (config.field(doc) &&
2357
- !storeObject[doc[_field]].find((c) => c._id === doc._id)) {
2339
+ !storeObject[doc[_field]].find(c => c._id === doc._id)) {
2358
2340
  storeObject[doc[_field]].push(doc);
2359
2341
  }
2360
2342
  }
2361
2343
  else if (Array.isArray(doc[_field])) {
2362
2344
  doc[_field].forEach((_field) => {
2363
2345
  storeObject[_field] = storeObject[_field] || [];
2364
- if (!storeObject[_field].find((c) => c._id === doc._id)) {
2346
+ if (!storeObject[_field].find(c => c._id === doc._id)) {
2365
2347
  storeObject[_field].push(doc);
2366
2348
  }
2367
2349
  });
2368
2350
  }
2369
2351
  else {
2370
- storeObject[doc[_field]] =
2371
- storeObject[doc[_field]] || [];
2372
- if (!storeObject[doc[_field]].find((c) => c._id === doc._id)) {
2352
+ storeObject[doc[_field]] = storeObject[doc[_field]] || [];
2353
+ if (!storeObject[doc[_field]].find(c => c._id === doc._id)) {
2373
2354
  storeObject[doc[_field]].push(doc);
2374
2355
  }
2375
2356
  }
@@ -2421,7 +2402,7 @@ class CrudService {
2421
2402
  doc.__modified ||= [];
2422
2403
  doc.__options ||= {};
2423
2404
  doc.__options[id] = options;
2424
- if (!doc.__modified.find((m) => m === id)) {
2405
+ if (!doc.__modified.find(m => m === id)) {
2425
2406
  doc.__modified.push(id);
2426
2407
  this.addDoc(doc);
2427
2408
  }
@@ -2432,8 +2413,8 @@ class CrudService {
2432
2413
  */
2433
2414
  _removeModified(doc, id) {
2434
2415
  doc.__modified ||= [];
2435
- if (doc.__modified.find((m) => m === id)) {
2436
- doc.__modified.splice(doc.__modified.findIndex((m) => m === id), 1);
2416
+ if (doc.__modified.find(m => m === id)) {
2417
+ doc.__modified.splice(doc.__modified.findIndex(m => m === id), 1);
2437
2418
  this.addDoc(doc);
2438
2419
  }
2439
2420
  }
@@ -2525,8 +2506,7 @@ class ThemeService {
2525
2506
  ? localStorage.getItem('theme.mode') || 'light'
2526
2507
  : 'light';
2527
2508
  const density = this._isBrowser
2528
- ? localStorage.getItem('theme.density') ||
2529
- 'comfortable'
2509
+ ? localStorage.getItem('theme.density') || 'comfortable'
2530
2510
  : 'comfortable';
2531
2511
  const radius = this._isBrowser
2532
2512
  ? localStorage.getItem('theme.radius') || 'rounded'
@@ -2534,9 +2514,7 @@ class ThemeService {
2534
2514
  this.mode.set(mode);
2535
2515
  this.density.set(density);
2536
2516
  this.radius.set(radius);
2537
- this.themeIndex.set(this._isBrowser
2538
- ? Number(localStorage.getItem('theme.index')) || 0
2539
- : 0);
2517
+ this.themeIndex.set(this._isBrowser ? Number(localStorage.getItem('theme.index')) || 0 : 0);
2540
2518
  if (this._isBrowser) {
2541
2519
  this._doc.documentElement.dataset['mode'] = mode;
2542
2520
  this._doc.documentElement.dataset['density'] = density;
@@ -2617,12 +2595,9 @@ class MetaService {
2617
2595
  this._config = this._config || DEFAULT_CONFIG;
2618
2596
  this._metaConfig = this._config.meta || {};
2619
2597
  // Recommended default: keep meta in sync with route changes automatically.
2620
- const applyFromRoutes = !isDefined(this._metaConfig.applyFromRoutes) ||
2621
- !!this._metaConfig.applyFromRoutes;
2598
+ const applyFromRoutes = !isDefined(this._metaConfig.applyFromRoutes) || !!this._metaConfig.applyFromRoutes;
2622
2599
  if (applyFromRoutes) {
2623
- this._router.events
2624
- .pipe(filter$1((e) => e instanceof NavigationEnd))
2625
- .subscribe(() => {
2600
+ this._router.events.pipe(filter$1(e => e instanceof NavigationEnd)).subscribe(() => {
2626
2601
  const page = this._readDeepestRouteMeta();
2627
2602
  if (page)
2628
2603
  this.applyMeta(page);
@@ -2730,7 +2705,7 @@ class MetaService {
2730
2705
  return;
2731
2706
  for (const rel of this._managedLinkRels) {
2732
2707
  const all = Array.from(this._doc.head.querySelectorAll(`link[rel="${rel}"]`));
2733
- all.forEach((it) => it.remove());
2708
+ all.forEach(it => it.remove());
2734
2709
  }
2735
2710
  this._managedLinkRels.clear();
2736
2711
  }
@@ -2758,9 +2733,7 @@ class MetaService {
2758
2733
  _resolveTitle(page, defaults) {
2759
2734
  let titleContent = this._resolveValue(page.title, defaults.title) || '';
2760
2735
  if (this._metaConfig.useTitleSuffix) {
2761
- const suffix = isDefined(page.titleSuffix)
2762
- ? page.titleSuffix
2763
- : defaults.titleSuffix;
2736
+ const suffix = isDefined(page.titleSuffix) ? page.titleSuffix : defaults.titleSuffix;
2764
2737
  titleContent += suffix || '';
2765
2738
  }
2766
2739
  return titleContent;
@@ -2918,7 +2891,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
2918
2891
  args: [{ providedIn: 'root' }]
2919
2892
  }], ctorParameters: () => [{ type: MetaService }] });
2920
2893
 
2921
- class TranslationService {
2894
+ class TranslateService {
2922
2895
  constructor() {
2923
2896
  this._storeService = inject(StoreService);
2924
2897
  /**
@@ -2937,19 +2910,18 @@ class TranslationService {
2937
2910
  /**
2938
2911
  * Hydrates translations from the internal persistent store (if present).
2939
2912
  *
2940
- * This runs once at service construction time and calls `setMany()` to:
2941
- * - populate/update known translation signals
2942
- * - persist the normalized set back to storage (via `setMany()` side effect)
2913
+ * This runs once at service construction time and merges stored values into
2914
+ * fallback signals only.
2943
2915
  *
2944
2916
  * Notes:
2945
- * - The stored payload is expected to be an array of `Translation`.
2946
- * - Signals for keys not yet requested via `translate()` will not exist,
2947
- * so `setMany()` assumes signals are already registered (strict mode).
2917
+ * - The stored payload is expected to be an array of `Translate`.
2918
+ * - Storage hydration is async, so runtime translations may already be set
2919
+ * by the time this resolves. In that case, the runtime value must win.
2948
2920
  */
2949
2921
  this._storeService.getJson('translations', {
2950
- onSuccess: (translations) => {
2922
+ onSuccess: translations => {
2951
2923
  if (Array.isArray(translations)) {
2952
- this.setMany(translations);
2924
+ this._hydrateTranslations(translations);
2953
2925
  }
2954
2926
  },
2955
2927
  });
@@ -2991,7 +2963,7 @@ class TranslationService {
2991
2963
  * containing sourceText and translated text.
2992
2964
  */
2993
2965
  setMany(translations) {
2994
- const sourceTexts = translations.map((t) => t.sourceText);
2966
+ const sourceTexts = translations.map(t => t.sourceText);
2995
2967
  const sourceSet = new Set(sourceTexts);
2996
2968
  // Reset removed translations back to original text
2997
2969
  for (const sourceText in this._signalTranslates) {
@@ -3015,7 +2987,7 @@ class TranslationService {
3015
2987
  * The signal must already exist (created via `translate()`),
3016
2988
  * otherwise this will throw an error.
3017
2989
  *
3018
- * @param translation - Translation object containing
2990
+ * @param translation - Translate object containing
3019
2991
  * sourceText and translated text.
3020
2992
  */
3021
2993
  setOne(translation) {
@@ -3032,6 +3004,16 @@ class TranslationService {
3032
3004
  get() {
3033
3005
  return this._signalTranslates;
3034
3006
  }
3007
+ _hydrateTranslations(translations) {
3008
+ for (const translation of translations) {
3009
+ const existing = this._signalTranslates[translation.sourceText];
3010
+ // Do not let stale async storage overwrite an already translated runtime value.
3011
+ if (existing && existing() !== translation.sourceText) {
3012
+ continue;
3013
+ }
3014
+ this._setTranslation(translation.sourceText, translation.text);
3015
+ }
3016
+ }
3035
3017
  _setTranslation(sourceText, text) {
3036
3018
  if (!this._signalTranslates[sourceText]) {
3037
3019
  this._signalTranslates[sourceText] = signal(sourceText);
@@ -3060,21 +3042,21 @@ class TranslationService {
3060
3042
  }
3061
3043
  this._storeService.setJson('translations', translations);
3062
3044
  }
3063
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3064
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslationService, providedIn: 'root' }); }
3045
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3046
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslateService, providedIn: 'root' }); }
3065
3047
  }
3066
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslationService, decorators: [{
3048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslateService, decorators: [{
3067
3049
  type: Injectable,
3068
3050
  args: [{ providedIn: 'root' }]
3069
3051
  }], ctorParameters: () => [] });
3070
3052
 
3071
- function provideTranslation(translations = []) {
3053
+ function provideTranslate(translations = []) {
3072
3054
  return makeEnvironmentProviders([
3073
3055
  provideEnvironmentInitializer(() => {
3074
3056
  if (!translations.length) {
3075
3057
  return;
3076
3058
  }
3077
- inject(TranslationService).setMany(translations);
3059
+ inject(TranslateService).setMany(translations);
3078
3060
  }),
3079
3061
  ]);
3080
3062
  }
@@ -3096,7 +3078,7 @@ class TranslateDirective {
3096
3078
  */
3097
3079
  this.translate = input('', ...(ngDevMode ? [{ debugName: "translate" }] : []));
3098
3080
  this._el = inject((ElementRef));
3099
- this._translationService = inject(TranslationService);
3081
+ this._translateService = inject(TranslateService);
3100
3082
  /**
3101
3083
  * Captures the element's original rendered text (trimmed) after the first render.
3102
3084
  *
@@ -3126,7 +3108,7 @@ class TranslateDirective {
3126
3108
  // Only swap signal when key changes
3127
3109
  if (key !== this._lastKey) {
3128
3110
  this._lastKey = key;
3129
- this._lastSignal = this._translationService.translate(key);
3111
+ this._lastSignal = this._translateService.translate(key);
3130
3112
  }
3131
3113
  // If no translation exists, service returns key (origin), so this keeps origin text.
3132
3114
  this._el.nativeElement.textContent = this._lastSignal();
@@ -3145,7 +3127,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
3145
3127
 
3146
3128
  class TranslatePipe {
3147
3129
  constructor() {
3148
- this._translationService = inject(TranslationService);
3130
+ this._translateService = inject(TranslateService);
3149
3131
  }
3150
3132
  /**
3151
3133
  * Transforms a translation key into the currently resolved translated string.
@@ -3155,11 +3137,11 @@ class TranslatePipe {
3155
3137
  * - The returned value is reactive via signals: when `setMany()` / `setOne()`
3156
3138
  * updates the underlying signal, templates re-render automatically.
3157
3139
  *
3158
- * @param text - Translation key (typically the source text).
3140
+ * @param text - Translate key (typically the source text).
3159
3141
  * @returns The translated string for the current in-memory/store state.
3160
3142
  */
3161
3143
  transform(text) {
3162
- return this._translationService.translate(text)();
3144
+ return this._translateService.translate(text)();
3163
3145
  }
3164
3146
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3165
3147
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: TranslatePipe, isStandalone: true, name: "translate" }); }
@@ -3446,24 +3428,20 @@ class SearchPipe {
3446
3428
  if (ignore || !q)
3447
3429
  return limit ? docs.slice(0, limit) : docs;
3448
3430
  /* normalise fields */
3449
- const paths = !f
3450
- ? ['name']
3451
- : Array.isArray(f)
3452
- ? f
3453
- : f.trim().split(/\s+/);
3431
+ const paths = !f ? ['name'] : Array.isArray(f) ? f : f.trim().split(/\s+/);
3454
3432
  /* normalise query */
3455
3433
  const needles = Array.isArray(q)
3456
- ? q.map((s) => s.toLowerCase())
3434
+ ? q.map(s => s.toLowerCase())
3457
3435
  : typeof q === 'object'
3458
3436
  ? Object.keys(q)
3459
- .filter((k) => q[k])
3460
- .map((k) => k.toLowerCase())
3437
+ .filter(k => q[k])
3438
+ .map(k => k.toLowerCase())
3461
3439
  : [q.toLowerCase()];
3462
3440
  const txtMatches = (val) => {
3463
3441
  if (val == null)
3464
3442
  return false;
3465
3443
  const hay = val.toString().toLowerCase();
3466
- return needles.some((n) => hay.includes(n) || n.includes(hay));
3444
+ return needles.some(n => hay.includes(n) || n.includes(hay));
3467
3445
  };
3468
3446
  const walk = (obj, parts) => {
3469
3447
  if (!obj)
@@ -3471,7 +3449,7 @@ class SearchPipe {
3471
3449
  const [head, ...rest] = parts;
3472
3450
  const next = obj[head];
3473
3451
  if (Array.isArray(next))
3474
- return next.some((v) => rest.length ? walk(v, rest) : txtMatches(v));
3452
+ return next.some(v => (rest.length ? walk(v, rest) : txtMatches(v)));
3475
3453
  return rest.length ? walk(next, rest) : txtMatches(next);
3476
3454
  };
3477
3455
  const out = [];
@@ -3613,12 +3591,9 @@ class DomService {
3613
3591
  });
3614
3592
  this.projectComponentInputs(componentRef, options);
3615
3593
  this._appRef.attachView(componentRef.hostView);
3616
- const domElem = componentRef.hostView
3617
- .rootNodes[0];
3594
+ const domElem = componentRef.hostView.rootNodes[0];
3618
3595
  const element = this._doc.getElementById(id);
3619
- if (this._isBrowser &&
3620
- element &&
3621
- typeof element.appendChild === 'function') {
3596
+ if (this._isBrowser && element && typeof element.appendChild === 'function') {
3622
3597
  element.appendChild(domElem);
3623
3598
  }
3624
3599
  componentRef.changeDetectorRef.detectChanges();
@@ -3648,12 +3623,9 @@ class DomService {
3648
3623
  });
3649
3624
  this.projectComponentInputs(componentRef, options);
3650
3625
  this._appRef.attachView(componentRef.hostView);
3651
- const domElem = componentRef.hostView
3652
- .rootNodes[0];
3626
+ const domElem = componentRef.hostView.rootNodes[0];
3653
3627
  const target = element || this._doc.body;
3654
- if (this._isBrowser &&
3655
- target &&
3656
- typeof target.appendChild === 'function') {
3628
+ if (this._isBrowser && target && typeof target.appendChild === 'function') {
3657
3629
  target.appendChild(domElem);
3658
3630
  }
3659
3631
  componentRef.changeDetectorRef.detectChanges();
@@ -3760,9 +3732,7 @@ class RtcService {
3760
3732
  throw new Error('RTC is not available during SSR.');
3761
3733
  }
3762
3734
  const peer = new RTCPeerConnection();
3763
- this._localStream
3764
- ?.getTracks()
3765
- .forEach((track) => peer.addTrack(track, this._localStream));
3735
+ this._localStream?.getTracks().forEach(track => peer.addTrack(track, this._localStream));
3766
3736
  this._peers.set(id, peer);
3767
3737
  return peer;
3768
3738
  }
@@ -3843,9 +3813,9 @@ class RtcService {
3843
3813
  * Closes all peer connections and stops the local media stream.
3844
3814
  */
3845
3815
  closeAll() {
3846
- this._peers.forEach((peer) => peer.close());
3816
+ this._peers.forEach(peer => peer.close());
3847
3817
  this._peers.clear();
3848
- this._localStream?.getTracks().forEach((track) => track.stop());
3818
+ this._localStream?.getTracks().forEach(track => track.stop());
3849
3819
  this._localStream = null;
3850
3820
  }
3851
3821
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: RtcService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -3908,9 +3878,7 @@ class SocketService {
3908
3878
  if (!this._isBrowser)
3909
3879
  return;
3910
3880
  if (this._config.io) {
3911
- const ioFunc = this._config.io.default
3912
- ? this._config.io.default
3913
- : this._config.io;
3881
+ const ioFunc = this._config.io.default ? this._config.io.default : this._config.io;
3914
3882
  this._io = ioFunc(this._url, this._opts);
3915
3883
  this._io.on('connect', () => {
3916
3884
  this._connected = true;
@@ -4043,9 +4011,7 @@ class TimeService {
4043
4011
  * @returns The name of the month.
4044
4012
  */
4045
4013
  getMonthName(monthIndex, format = 'long') {
4046
- if (!Number.isInteger(monthIndex) ||
4047
- monthIndex < 0 ||
4048
- monthIndex > 11) {
4014
+ if (!Number.isInteger(monthIndex) || monthIndex < 0 || monthIndex > 11) {
4049
4015
  throw new RangeError('monthIndex must be an integer between 0 and 11');
4050
4016
  }
4051
4017
  return format === 'short'
@@ -4513,9 +4479,7 @@ class UtilService {
4513
4479
  case 'array':
4514
4480
  return Array.isArray(value);
4515
4481
  case 'object':
4516
- return (typeof value === 'object' &&
4517
- !Array.isArray(value) &&
4518
- value !== null);
4482
+ return typeof value === 'object' && !Array.isArray(value) && value !== null;
4519
4483
  case 'number':
4520
4484
  return typeof value === 'number' && Number.isFinite(value);
4521
4485
  case 'password':
@@ -4559,9 +4523,7 @@ class UtilService {
4559
4523
  opts = opts === 'local' ? { local: true } : { host: opts };
4560
4524
  }
4561
4525
  const { local = false, host } = opts;
4562
- if (host &&
4563
- typeof window !== 'undefined' &&
4564
- window.location.host !== host)
4526
+ if (host && typeof window !== 'undefined' && window.location.host !== host)
4565
4527
  return;
4566
4528
  for (const k of Object.keys(vars)) {
4567
4529
  const v = vars[k];
@@ -4753,5 +4715,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
4753
4715
  * Generated bundle index. Do not edit.
4754
4716
  */
4755
4717
 
4756
- export { ArrPipe, CONFIG_TOKEN, ClickOutsideDirective, CoreService, CrudComponent, CrudService, DEFAULT_CONFIG, DEFAULT_HTTP_CONFIG, DEFAULT_NETWORK_CONFIG, DomService, EmitterService, HttpService, ManualDisabledDirective, ManualNameDirective, ManualReadonlyDirective, ManualTypeDirective, MetaGuard, MetaService, MongodatePipe, NETWORK_CONFIG, NetworkService, NumberPipe, PaginationPipe, RtcService, SafePipe, SearchPipe, SocketService, SplicePipe, SplitPipe, StoreService, ThemeService, TimeService, TranslateDirective, TranslatePipe, TranslationService, UtilService, WacomModule, provideTranslation, provideWacom };
4718
+ export { ArrPipe, CONFIG_TOKEN, ClickOutsideDirective, CoreService, CrudComponent, CrudService, DEFAULT_CONFIG, DEFAULT_HTTP_CONFIG, DEFAULT_NETWORK_CONFIG, DomService, EmitterService, HttpService, ManualDisabledDirective, ManualNameDirective, ManualReadonlyDirective, ManualTypeDirective, MetaGuard, MetaService, MongodatePipe, NETWORK_CONFIG, NetworkService, NumberPipe, PaginationPipe, RtcService, SafePipe, SearchPipe, SocketService, SplicePipe, SplitPipe, StoreService, ThemeService, TimeService, TranslateDirective, TranslatePipe, TranslateService, UtilService, WacomModule, provideTranslate, provideWacom };
4757
4719
  //# sourceMappingURL=wacom.mjs.map