@haiilo/catalyst 3.0.0 → 3.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.
Files changed (80) hide show
  1. package/dist/catalyst/catalyst.css +22 -22
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/p-1c6eace6.js +3 -0
  5. package/dist/catalyst/p-1c6eace6.js.map +1 -0
  6. package/dist/catalyst/p-6865acc8.entry.js +10 -0
  7. package/dist/catalyst/p-6865acc8.entry.js.map +1 -0
  8. package/dist/catalyst/scss/core/_dialog.scss +1 -1
  9. package/dist/catalyst/scss/core/_notification.scss +10 -10
  10. package/dist/catalyst/scss/core/_typography.scss +1 -1
  11. package/dist/cjs/cat-alert_24.cjs.entry.js +1365 -39
  12. package/dist/cjs/cat-alert_24.cjs.entry.js.map +1 -1
  13. package/dist/cjs/catalyst.cjs.js +2 -2
  14. package/dist/cjs/{index-e540e911.js → index-22e41d18.js} +1 -4
  15. package/dist/cjs/index-22e41d18.js.map +1 -0
  16. package/dist/cjs/loader.cjs.js +2 -2
  17. package/dist/collection/collection-manifest.json +0 -1
  18. package/dist/collection/components/cat-input/cat-input.css +10 -0
  19. package/dist/collection/components/cat-scrollable/cat-scrollable.js +18 -14
  20. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
  21. package/dist/collection/components/cat-select/cat-select.js +14 -10
  22. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  23. package/dist/collection/components/cat-textarea/cat-textarea.css +5 -0
  24. package/dist/collection/scss/core/_dialog.scss +1 -1
  25. package/dist/collection/scss/core/_notification.scss +10 -10
  26. package/dist/collection/scss/core/_typography.scss +1 -1
  27. package/dist/components/cat-badge.js.map +1 -1
  28. package/dist/components/cat-button2.js.map +1 -1
  29. package/dist/components/cat-card.js.map +1 -1
  30. package/dist/components/cat-dropdown2.js +759 -2
  31. package/dist/components/cat-dropdown2.js.map +1 -1
  32. package/dist/components/cat-input.js +1 -1
  33. package/dist/components/cat-input.js.map +1 -1
  34. package/dist/components/cat-scrollable2.js +241 -14
  35. package/dist/components/cat-scrollable2.js.map +1 -1
  36. package/dist/components/cat-select-demo.js +2 -2
  37. package/dist/components/cat-select2.js +13 -194
  38. package/dist/components/cat-select2.js.map +1 -1
  39. package/dist/components/cat-textarea.js +1 -1
  40. package/dist/components/cat-textarea.js.map +1 -1
  41. package/dist/components/index.d.ts +0 -1
  42. package/dist/components/index.js +0 -1
  43. package/dist/components/index.js.map +1 -1
  44. package/dist/esm/cat-alert_24.entry.js +1359 -33
  45. package/dist/esm/cat-alert_24.entry.js.map +1 -1
  46. package/dist/esm/catalyst.js +2 -2
  47. package/dist/esm/{index-c2a28ebb.js → index-7b85fb91.js} +1 -4
  48. package/dist/esm/index-7b85fb91.js.map +1 -0
  49. package/dist/esm/loader.js +2 -2
  50. package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +3 -0
  51. package/dist/types/components/cat-select/cat-select.d.ts +1 -0
  52. package/dist/types/components.d.ts +0 -25
  53. package/package.json +2 -2
  54. package/dist/catalyst/p-52f9fea7.entry.js +0 -2
  55. package/dist/catalyst/p-52f9fea7.entry.js.map +0 -1
  56. package/dist/catalyst/p-53a1db22.js +0 -3
  57. package/dist/catalyst/p-53a1db22.js.map +0 -1
  58. package/dist/catalyst/p-557c8009.entry.js +0 -2
  59. package/dist/catalyst/p-557c8009.entry.js.map +0 -1
  60. package/dist/catalyst/p-60a20ebe.js +0 -10
  61. package/dist/catalyst/p-60a20ebe.js.map +0 -1
  62. package/dist/cjs/cat-modal.cjs.entry.js +0 -74
  63. package/dist/cjs/cat-modal.cjs.entry.js.map +0 -1
  64. package/dist/cjs/first-tabbable-7966cf1c.js +0 -1288
  65. package/dist/cjs/first-tabbable-7966cf1c.js.map +0 -1
  66. package/dist/cjs/index-e540e911.js.map +0 -1
  67. package/dist/collection/components/cat-modal/cat-modal.css +0 -65
  68. package/dist/collection/components/cat-modal/cat-modal.js +0 -117
  69. package/dist/collection/components/cat-modal/cat-modal.js.map +0 -1
  70. package/dist/components/cat-modal.d.ts +0 -11
  71. package/dist/components/cat-modal.js +0 -111
  72. package/dist/components/cat-modal.js.map +0 -1
  73. package/dist/components/focus-trap.esm.js +0 -763
  74. package/dist/components/focus-trap.esm.js.map +0 -1
  75. package/dist/esm/cat-modal.entry.js +0 -70
  76. package/dist/esm/cat-modal.entry.js.map +0 -1
  77. package/dist/esm/first-tabbable-4a00de61.js +0 -1284
  78. package/dist/esm/first-tabbable-4a00de61.js.map +0 -1
  79. package/dist/esm/index-c2a28ebb.js.map +0 -1
  80. package/dist/types/components/cat-modal/cat-modal.d.ts +0 -20
@@ -682,6 +682,157 @@ class AnonymousSubject extends Subject {
682
682
  }
683
683
  }
684
684
 
685
+ const dateTimestampProvider = {
686
+ now() {
687
+ return (dateTimestampProvider.delegate || Date).now();
688
+ },
689
+ delegate: undefined,
690
+ };
691
+
692
+ class Action extends Subscription {
693
+ constructor(scheduler, work) {
694
+ super();
695
+ }
696
+ schedule(state, delay = 0) {
697
+ return this;
698
+ }
699
+ }
700
+
701
+ const intervalProvider = {
702
+ setInterval(handler, timeout, ...args) {
703
+ const { delegate } = intervalProvider;
704
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
705
+ return delegate.setInterval(handler, timeout, ...args);
706
+ }
707
+ return setInterval(handler, timeout, ...args);
708
+ },
709
+ clearInterval(handle) {
710
+ const { delegate } = intervalProvider;
711
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
712
+ },
713
+ delegate: undefined,
714
+ };
715
+
716
+ class AsyncAction extends Action {
717
+ constructor(scheduler, work) {
718
+ super(scheduler, work);
719
+ this.scheduler = scheduler;
720
+ this.work = work;
721
+ this.pending = false;
722
+ }
723
+ schedule(state, delay = 0) {
724
+ if (this.closed) {
725
+ return this;
726
+ }
727
+ this.state = state;
728
+ const id = this.id;
729
+ const scheduler = this.scheduler;
730
+ if (id != null) {
731
+ this.id = this.recycleAsyncId(scheduler, id, delay);
732
+ }
733
+ this.pending = true;
734
+ this.delay = delay;
735
+ this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
736
+ return this;
737
+ }
738
+ requestAsyncId(scheduler, _id, delay = 0) {
739
+ return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
740
+ }
741
+ recycleAsyncId(_scheduler, id, delay = 0) {
742
+ if (delay != null && this.delay === delay && this.pending === false) {
743
+ return id;
744
+ }
745
+ intervalProvider.clearInterval(id);
746
+ return undefined;
747
+ }
748
+ execute(state, delay) {
749
+ if (this.closed) {
750
+ return new Error('executing a cancelled action');
751
+ }
752
+ this.pending = false;
753
+ const error = this._execute(state, delay);
754
+ if (error) {
755
+ return error;
756
+ }
757
+ else if (this.pending === false && this.id != null) {
758
+ this.id = this.recycleAsyncId(this.scheduler, this.id, null);
759
+ }
760
+ }
761
+ _execute(state, _delay) {
762
+ let errored = false;
763
+ let errorValue;
764
+ try {
765
+ this.work(state);
766
+ }
767
+ catch (e) {
768
+ errored = true;
769
+ errorValue = e ? e : new Error('Scheduled action threw falsy error');
770
+ }
771
+ if (errored) {
772
+ this.unsubscribe();
773
+ return errorValue;
774
+ }
775
+ }
776
+ unsubscribe() {
777
+ if (!this.closed) {
778
+ const { id, scheduler } = this;
779
+ const { actions } = scheduler;
780
+ this.work = this.state = this.scheduler = null;
781
+ this.pending = false;
782
+ arrRemove(actions, this);
783
+ if (id != null) {
784
+ this.id = this.recycleAsyncId(scheduler, id, null);
785
+ }
786
+ this.delay = null;
787
+ super.unsubscribe();
788
+ }
789
+ }
790
+ }
791
+
792
+ class Scheduler {
793
+ constructor(schedulerActionCtor, now = Scheduler.now) {
794
+ this.schedulerActionCtor = schedulerActionCtor;
795
+ this.now = now;
796
+ }
797
+ schedule(work, delay = 0, state) {
798
+ return new this.schedulerActionCtor(this, work).schedule(state, delay);
799
+ }
800
+ }
801
+ Scheduler.now = dateTimestampProvider.now;
802
+
803
+ class AsyncScheduler extends Scheduler {
804
+ constructor(SchedulerAction, now = Scheduler.now) {
805
+ super(SchedulerAction, now);
806
+ this.actions = [];
807
+ this._active = false;
808
+ this._scheduled = undefined;
809
+ }
810
+ flush(action) {
811
+ const { actions } = this;
812
+ if (this._active) {
813
+ actions.push(action);
814
+ return;
815
+ }
816
+ let error;
817
+ this._active = true;
818
+ do {
819
+ if ((error = action.execute(action.state, action.delay))) {
820
+ break;
821
+ }
822
+ } while ((action = actions.shift()));
823
+ this._active = false;
824
+ if (error) {
825
+ while ((action = actions.shift())) {
826
+ action.unsubscribe();
827
+ }
828
+ throw error;
829
+ }
830
+ }
831
+ }
832
+
833
+ const asyncScheduler = new AsyncScheduler(AsyncAction);
834
+ const async = asyncScheduler;
835
+
685
836
  const EMPTY = new Observable((subscriber) => subscriber.complete());
686
837
 
687
838
  function isScheduler(value) {
@@ -1041,6 +1192,10 @@ function from(input, scheduler) {
1041
1192
  return scheduler ? scheduled(input, scheduler) : innerFrom(input);
1042
1193
  }
1043
1194
 
1195
+ function isValidDate(value) {
1196
+ return value instanceof Date && !isNaN(value);
1197
+ }
1198
+
1044
1199
  function map(project, thisArg) {
1045
1200
  return operate((source, subscriber) => {
1046
1201
  let index = 0;
@@ -1173,6 +1328,36 @@ function isEventTarget(target) {
1173
1328
  return isFunction(target.addEventListener) && isFunction(target.removeEventListener);
1174
1329
  }
1175
1330
 
1331
+ function timer(dueTime = 0, intervalOrScheduler, scheduler = async) {
1332
+ let intervalDuration = -1;
1333
+ if (intervalOrScheduler != null) {
1334
+ if (isScheduler(intervalOrScheduler)) {
1335
+ scheduler = intervalOrScheduler;
1336
+ }
1337
+ else {
1338
+ intervalDuration = intervalOrScheduler;
1339
+ }
1340
+ }
1341
+ return new Observable((subscriber) => {
1342
+ let due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
1343
+ if (due < 0) {
1344
+ due = 0;
1345
+ }
1346
+ let n = 0;
1347
+ return scheduler.schedule(function () {
1348
+ if (!subscriber.closed) {
1349
+ subscriber.next(n++);
1350
+ if (0 <= intervalDuration) {
1351
+ this.schedule(undefined, intervalDuration);
1352
+ }
1353
+ else {
1354
+ subscriber.complete();
1355
+ }
1356
+ }
1357
+ }, due);
1358
+ });
1359
+ }
1360
+
1176
1361
  function merge(...args) {
1177
1362
  const scheduler = popScheduler(args);
1178
1363
  const concurrent = popNumber(args, Infinity);
@@ -1194,6 +1379,44 @@ function filter(predicate, thisArg) {
1194
1379
  });
1195
1380
  }
1196
1381
 
1382
+ function audit(durationSelector) {
1383
+ return operate((source, subscriber) => {
1384
+ let hasValue = false;
1385
+ let lastValue = null;
1386
+ let durationSubscriber = null;
1387
+ let isComplete = false;
1388
+ const endDuration = () => {
1389
+ durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
1390
+ durationSubscriber = null;
1391
+ if (hasValue) {
1392
+ hasValue = false;
1393
+ const value = lastValue;
1394
+ lastValue = null;
1395
+ subscriber.next(value);
1396
+ }
1397
+ isComplete && subscriber.complete();
1398
+ };
1399
+ const cleanupDuration = () => {
1400
+ durationSubscriber = null;
1401
+ isComplete && subscriber.complete();
1402
+ };
1403
+ source.subscribe(createOperatorSubscriber(subscriber, (value) => {
1404
+ hasValue = true;
1405
+ lastValue = value;
1406
+ if (!durationSubscriber) {
1407
+ innerFrom(durationSelector(value)).subscribe((durationSubscriber = createOperatorSubscriber(subscriber, endDuration, cleanupDuration)));
1408
+ }
1409
+ }, () => {
1410
+ isComplete = true;
1411
+ (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
1412
+ }));
1413
+ });
1414
+ }
1415
+
1416
+ function auditTime(duration, scheduler = asyncScheduler) {
1417
+ return audit(() => timer(duration, scheduler));
1418
+ }
1419
+
1197
1420
  function distinctUntilChanged(comparator, keySelector = identity) {
1198
1421
  comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
1199
1422
  return operate((source, subscriber) => {
@@ -1233,6 +1456,8 @@ const CatScrollable = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
1233
1456
  this.scrolledBottom = createEvent(this, "scrolledBottom", 7);
1234
1457
  this.init = new Subject();
1235
1458
  this.destroyed = new Subject();
1459
+ this.resizedEntries = new Subject();
1460
+ this.resizedObserver = new ResizeObserver(entries => this.resizedEntries.next(entries));
1236
1461
  /** Flags to disable/enable scroll shadowX. */
1237
1462
  this.noShadowX = false;
1238
1463
  /** Flags to disable/enable scroll shadowY. */
@@ -1255,13 +1480,17 @@ const CatScrollable = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
1255
1480
  componentDidRender() {
1256
1481
  if (this.scrollElement) {
1257
1482
  this.scrolled = fromEvent(this.scrollElement, 'scroll').pipe(takeUntil(this.destroyed));
1483
+ this.resizedObserver.observe(this.scrollElement);
1484
+ }
1485
+ if (this.scrollWrapperElement) {
1486
+ this.resizedObserver.observe(this.scrollWrapperElement);
1258
1487
  }
1259
- this.attachEmitter('left', this.scrolledLeft, this.scrolledBuffer);
1260
- this.attachEmitter('right', this.scrolledRight, this.scrolledBuffer);
1261
- this.attachEmitter('bottom', this.scrolledBottom, this.scrolledBuffer);
1262
- this.attachEmitter('top', this.scrolledTop, this.scrolledBuffer);
1263
- merge(this.init, this.scrolled)
1264
- .pipe(map(() => ({
1488
+ this.attachEmitter('left', this.scrolledLeft);
1489
+ this.attachEmitter('right', this.scrolledRight);
1490
+ this.attachEmitter('bottom', this.scrolledBottom);
1491
+ this.attachEmitter('top', this.scrolledTop);
1492
+ merge(this.init, this.scrolled, this.resizedEntries)
1493
+ .pipe(auditTime(CatScrollable.THROTTLE), map(() => ({
1265
1494
  top: this.getScrollOffset('top') > 0,
1266
1495
  left: this.getScrollOffset('left') > 0,
1267
1496
  right: this.getScrollOffset('right') > 0,
@@ -1283,6 +1512,7 @@ const CatScrollable = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
1283
1512
  this.init.complete();
1284
1513
  this.destroyed.next();
1285
1514
  this.destroyed.complete();
1515
+ this.resizedObserver.disconnect();
1286
1516
  }
1287
1517
  render() {
1288
1518
  return [
@@ -1295,13 +1525,9 @@ const CatScrollable = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
1295
1525
  } }, h("slot", null))
1296
1526
  ];
1297
1527
  }
1298
- attachEmitter(from, emitter, buffer) {
1299
- merge(this.init, this.scrolled)
1300
- .pipe(map(() => this.getScrollOffset(from)))
1301
- .pipe(map(offset => offset <= buffer))
1302
- .pipe(distinctUntilChanged())
1303
- .pipe(filter(isLower => isLower))
1304
- .pipe(takeUntil(this.destroyed))
1528
+ attachEmitter(from, emitter) {
1529
+ merge(this.init, this.scrolled, this.resizedEntries)
1530
+ .pipe(auditTime(CatScrollable.THROTTLE), map(() => this.getScrollOffset(from)), map(offset => offset <= this.scrolledBuffer), distinctUntilChanged(), filter(isLower => isLower), takeUntil(this.destroyed))
1305
1531
  .subscribe(() => emitter.emit());
1306
1532
  }
1307
1533
  getScrollOffset(from) {
@@ -1340,6 +1566,7 @@ const CatScrollable = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
1340
1566
  "noScrolledInit": [4, "no-scrolled-init"],
1341
1567
  "scrolledBuffer": [2, "scrolled-buffer"]
1342
1568
  }]);
1569
+ CatScrollable.THROTTLE = 50;
1343
1570
  function defineCustomElement() {
1344
1571
  if (typeof customElements === "undefined") {
1345
1572
  return;
@@ -1354,6 +1581,6 @@ function defineCustomElement() {
1354
1581
  } });
1355
1582
  }
1356
1583
 
1357
- export { CatScrollable as C, EMPTY as E, Observable as O, Subscription as S, mergeMap as a, arrRemove as b, createOperatorSubscriber as c, defineCustomElement as d, createErrorClass as e, from as f, mergeAll as g, innerFrom as h, isScheduler as i, filter as j, identity as k, isFunction as l, map as m, noop as n, operate as o, popScheduler as p, Subject as q, distinctUntilChanged as r };
1584
+ export { CatScrollable as C, EMPTY as E, Subject as S, mergeMap as a, asyncScheduler as b, createOperatorSubscriber as c, defineCustomElement as d, createErrorClass as e, from as f, mergeAll as g, filter as h, innerFrom as i, identity as j, isFunction as k, distinctUntilChanged as l, map as m, noop as n, operate as o, popScheduler as p, timer as t };
1358
1585
 
1359
1586
  //# sourceMappingURL=cat-scrollable2.js.map