@mhmo91/schmancy 0.2.143 → 0.2.144

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 (33) hide show
  1. package/dist/card.cjs +1 -1
  2. package/dist/card.js +1 -1
  3. package/dist/content-drawer.cjs +1 -1
  4. package/dist/content-drawer.js +1 -1
  5. package/dist/{context-array-DpyA_ATT.js → context-object-CISes2bD.js} +172 -171
  6. package/dist/{context-array-Cpar9dLN.cjs.map → context-object-CISes2bD.js.map} +1 -1
  7. package/dist/{context-array-Cpar9dLN.cjs → context-object-CP7HbDFQ.cjs} +2 -2
  8. package/dist/context-object-CP7HbDFQ.cjs.map +1 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.js +89 -87
  11. package/dist/nav-drawer.cjs +1 -1
  12. package/dist/nav-drawer.js +1 -1
  13. package/dist/selector-hook-Bvne--oy.cjs +2 -0
  14. package/dist/selector-hook-Bvne--oy.cjs.map +1 -0
  15. package/dist/selector-hook-D_HTD-GV.js +344 -0
  16. package/dist/selector-hook-D_HTD-GV.js.map +1 -0
  17. package/dist/store.cjs +1 -1
  18. package/dist/store.js +40 -38
  19. package/dist/teleport.cjs +1 -1
  20. package/dist/{teleport.component-Dg62mNQm.js → teleport.component-B6W2UN_u.js} +2 -2
  21. package/dist/{teleport.component-Dg62mNQm.js.map → teleport.component-B6W2UN_u.js.map} +1 -1
  22. package/dist/{teleport.component-F3-R3PAX.cjs → teleport.component-Cgtrv4bU.cjs} +2 -2
  23. package/dist/{teleport.component-F3-R3PAX.cjs.map → teleport.component-Cgtrv4bU.cjs.map} +1 -1
  24. package/dist/teleport.js +1 -1
  25. package/package.json +1 -1
  26. package/types/src/store/context-create.d.ts +2 -2
  27. package/types/src/store/immer-integration.d.ts +1 -7
  28. package/types/src/store/index.d.ts +2 -0
  29. package/dist/context-array-DpyA_ATT.js.map +0 -1
  30. package/dist/selector-hook-CCTCDtVe.js +0 -323
  31. package/dist/selector-hook-CCTCDtVe.js.map +0 -1
  32. package/dist/selector-hook-DGMX3Yt0.cjs +0 -2
  33. package/dist/selector-hook-DGMX3Yt0.cjs.map +0 -1
package/dist/card.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";require("./teleport.component-F3-R3PAX.cjs");
1
+ "use strict";require("./teleport.component-Cgtrv4bU.cjs");
2
2
  //# sourceMappingURL=card.cjs.map
package/dist/card.js CHANGED
@@ -1,2 +1,2 @@
1
- import "./teleport.component-Dg62mNQm.js";
1
+ import "./teleport.component-B6W2UN_u.js";
2
2
  //# sourceMappingURL=card.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-F3-R3PAX.cjs");Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>e.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=e.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>e.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=e.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=e.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>e.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=e.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=e.SchmancyContentDrawerSheetState,exports.schmancyContentDrawer=e.schmancyContentDrawer;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-Cgtrv4bU.cjs");Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>e.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=e.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>e.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=e.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=e.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>e.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=e.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=e.SchmancyContentDrawerSheetState,exports.schmancyContentDrawer=e.schmancyContentDrawer;
2
2
  //# sourceMappingURL=content-drawer.cjs.map
@@ -1,4 +1,4 @@
1
- import { e as n, b as t, f as r, c, d as h, g as S, S as o, a as s, s as m } from "./teleport.component-Dg62mNQm.js";
1
+ import { e as n, b as t, f as r, c, d as h, g as S, S as o, a as s, s as m } from "./teleport.component-B6W2UN_u.js";
2
2
  export {
3
3
  n as SchmancyContentDrawer,
4
4
  t as SchmancyContentDrawerID,
@@ -638,10 +638,169 @@ class q {
638
638
  }
639
639
  }
640
640
  const k = class k extends q {
641
- static getInstance(e, r, s) {
641
+ static getInstance(e, r, s = []) {
642
642
  const n = `${e}:${r}`;
643
643
  return this.instances.has(n) || this.instances.set(n, new k(e, r, s)), this.instances.get(n);
644
644
  }
645
+ constructor(e, r, s = []) {
646
+ super(e, r, s), e !== "memory" && this.setupPersistence();
647
+ }
648
+ setupPersistence() {
649
+ this.$.pipe(oe(100, void 0, { leading: !0, trailing: !0 })).subscribe((e) => {
650
+ this.storage.save(e).catch((r) => {
651
+ const s = new u(`Error saving to ${this.storageType} storage for ${this.key}`, r);
652
+ this.error$.next(s);
653
+ });
654
+ });
655
+ }
656
+ push(...e) {
657
+ try {
658
+ const r = d(this.value, (s) => {
659
+ s.push(...e.map((n) => n));
660
+ });
661
+ this.updateState(r), this.error$.next(null);
662
+ } catch (r) {
663
+ const s = new u(`Error pushing items in ${this.key}`, r);
664
+ this.error$.next(s);
665
+ }
666
+ }
667
+ pop() {
668
+ try {
669
+ const e = this.value.length > 0 ? this.value[this.value.length - 1] : void 0, r = d(this.value, (s) => {
670
+ s.pop();
671
+ });
672
+ return this.updateState(r), this.error$.next(null), e;
673
+ } catch (e) {
674
+ const r = new u(`Error popping item from ${this.key}`, e);
675
+ return void this.error$.next(r);
676
+ }
677
+ }
678
+ unshift(...e) {
679
+ try {
680
+ const r = d(this.value, (s) => {
681
+ s.unshift(...e.map((n) => n));
682
+ });
683
+ this.updateState(r), this.error$.next(null);
684
+ } catch (r) {
685
+ const s = new u(`Error unshifting items in ${this.key}`, r);
686
+ this.error$.next(s);
687
+ }
688
+ }
689
+ shift() {
690
+ try {
691
+ const e = this.value.length > 0 ? this.value[0] : void 0, r = d(this.value, (s) => {
692
+ s.shift();
693
+ });
694
+ return this.updateState(r), this.error$.next(null), e;
695
+ } catch (e) {
696
+ const r = new u(`Error shifting item from ${this.key}`, e);
697
+ return void this.error$.next(r);
698
+ }
699
+ }
700
+ set(e, r) {
701
+ try {
702
+ const s = d(this.value, (n) => {
703
+ if (!(e >= 0 && e < n.length)) throw new Error(`Index ${e} out of bounds (length: ${n.length})`);
704
+ n[e] = r;
705
+ });
706
+ this.updateState(s), this.error$.next(null);
707
+ } catch (s) {
708
+ const n = new u(`Error setting item at index ${e} in ${this.key}`, s);
709
+ this.error$.next(n);
710
+ }
711
+ }
712
+ get(e) {
713
+ return this.value[e];
714
+ }
715
+ splice(e, r, ...s) {
716
+ try {
717
+ const n = [...this.value].splice(e, r ?? 0, ...s), a = d(this.value, (h) => {
718
+ h.splice(e, r ?? 0, ...s.map((c) => c));
719
+ });
720
+ return this.updateState(a), this.error$.next(null), n;
721
+ } catch (n) {
722
+ const a = new u(`Error splicing items in ${this.key}`, n);
723
+ return this.error$.next(a), [];
724
+ }
725
+ }
726
+ remove(e, r) {
727
+ try {
728
+ const s = r || ((a, h) => a === h), n = this.value.findIndex((a) => s(a, e));
729
+ if (n !== -1) {
730
+ const a = d(this.value, (h) => {
731
+ h.splice(n, 1);
732
+ });
733
+ return this.updateState(a), this.error$.next(null), !0;
734
+ }
735
+ return this.error$.next(null), !1;
736
+ } catch (s) {
737
+ const n = new u(`Error removing item in ${this.key}`, s);
738
+ return this.error$.next(n), !1;
739
+ }
740
+ }
741
+ replace(e) {
742
+ try {
743
+ const r = d(e, (s) => s);
744
+ this.updateState(r), this.error$.next(null);
745
+ } catch (r) {
746
+ const s = new u(`Error replacing array in ${this.key}`, r);
747
+ this.error$.next(s);
748
+ }
749
+ }
750
+ filter(e) {
751
+ try {
752
+ const r = this.value.filter(e), s = d(this.value, (n) => {
753
+ n.length = 0, n.push(...r.map((a) => a));
754
+ });
755
+ this.updateState(s), this.error$.next(null);
756
+ } catch (r) {
757
+ const s = new u(`Error filtering array in ${this.key}`, r);
758
+ this.error$.next(s);
759
+ }
760
+ }
761
+ map(e) {
762
+ return this.value.map(e);
763
+ }
764
+ sort(e) {
765
+ try {
766
+ const r = [...this.value].sort(e), s = d(this.value, (n) => {
767
+ n.length = 0, n.push(...r.map((a) => a));
768
+ });
769
+ this.updateState(s), this.error$.next(null);
770
+ } catch (r) {
771
+ const s = new u(`Error sorting array in ${this.key}`, r);
772
+ this.error$.next(s);
773
+ }
774
+ }
775
+ update(e, r) {
776
+ try {
777
+ const s = d(this.value, (n) => {
778
+ if (!(e >= 0 && e < n.length)) throw new Error(`Index ${e} out of bounds (length: ${n.length})`);
779
+ r(n[e]);
780
+ });
781
+ this.updateState(s), this.error$.next(null);
782
+ } catch (s) {
783
+ const n = new u(`Error updating item at index ${e} in ${this.key}`, s);
784
+ this.error$.next(n);
785
+ }
786
+ }
787
+ clear() {
788
+ this.updateState([]);
789
+ }
790
+ setupDevTools() {
791
+ typeof window < "u" && (window.__STORES__ = window.__STORES__ || {}, window.__STORES__[this.key] = { getState: () => this.value, push: this.push.bind(this), pop: this.pop.bind(this), unshift: this.unshift.bind(this), shift: this.shift.bind(this), set: this.set.bind(this), get: this.get.bind(this), splice: this.splice.bind(this), remove: this.remove.bind(this), replace: this.replace.bind(this), filter: this.filter.bind(this), map: this.map.bind(this), sort: this.sort.bind(this), update: this.update.bind(this), clear: this.clear.bind(this), subscribe: (e) => {
792
+ const r = this.$.subscribe(e);
793
+ return () => r.unsubscribe();
794
+ } });
795
+ }
796
+ };
797
+ k.type = "array", k.instances = /* @__PURE__ */ new Map();
798
+ let ne = k;
799
+ const O = class O extends q {
800
+ static getInstance(e, r, s) {
801
+ const n = `${e}:${r}`;
802
+ return this.instances.has(n) || this.instances.set(n, new O(e, r, s)), this.instances.get(n);
803
+ }
645
804
  set(e, r) {
646
805
  try {
647
806
  const s = d(this.value, (n) => {
@@ -710,15 +869,15 @@ const k = class k extends q {
710
869
  } });
711
870
  }
712
871
  };
713
- k.type = "collection", k.instances = /* @__PURE__ */ new Map();
714
- let ne = k;
715
- const O = class O extends (se = q, re = $, se) {
872
+ O.type = "collection", O.instances = /* @__PURE__ */ new Map();
873
+ let ie = O;
874
+ const D = class D extends (se = q, re = $, se) {
716
875
  constructor() {
717
876
  super(...arguments), this[re] = !0;
718
877
  }
719
878
  static getInstance(e, r, s) {
720
879
  const n = `${e}:${r}`;
721
- return this.instances.has(n) || this.instances.set(n, new O(e, r, s)), this.instances.get(n);
880
+ return this.instances.has(n) || this.instances.set(n, new D(e, r, s)), this.instances.get(n);
722
881
  }
723
882
  set(e, r = !0) {
724
883
  try {
@@ -845,176 +1004,18 @@ const O = class O extends (se = q, re = $, se) {
845
1004
  return e !== null && typeof e == "object" && (super.isImmerDraftable(e) || e[$] === !0);
846
1005
  }
847
1006
  };
848
- O.type = "object", O.instances = /* @__PURE__ */ new Map();
849
- let ie = O;
850
- const D = class D extends q {
851
- static getInstance(e, r, s = []) {
852
- const n = `${e}:${r}`;
853
- return this.instances.has(n) || this.instances.set(n, new D(e, r, s)), this.instances.get(n);
854
- }
855
- constructor(e, r, s = []) {
856
- super(e, r, s), e !== "memory" && this.setupPersistence();
857
- }
858
- setupPersistence() {
859
- this.$.pipe(oe(100, void 0, { leading: !0, trailing: !0 })).subscribe((e) => {
860
- this.storage.save(e).catch((r) => {
861
- const s = new u(`Error saving to ${this.storageType} storage for ${this.key}`, r);
862
- this.error$.next(s);
863
- });
864
- });
865
- }
866
- push(...e) {
867
- try {
868
- const r = d(this.value, (s) => {
869
- s.push(...e.map((n) => n));
870
- });
871
- this.updateState(r), this.error$.next(null);
872
- } catch (r) {
873
- const s = new u(`Error pushing items in ${this.key}`, r);
874
- this.error$.next(s);
875
- }
876
- }
877
- pop() {
878
- try {
879
- const e = this.value.length > 0 ? this.value[this.value.length - 1] : void 0, r = d(this.value, (s) => {
880
- s.pop();
881
- });
882
- return this.updateState(r), this.error$.next(null), e;
883
- } catch (e) {
884
- const r = new u(`Error popping item from ${this.key}`, e);
885
- return void this.error$.next(r);
886
- }
887
- }
888
- unshift(...e) {
889
- try {
890
- const r = d(this.value, (s) => {
891
- s.unshift(...e.map((n) => n));
892
- });
893
- this.updateState(r), this.error$.next(null);
894
- } catch (r) {
895
- const s = new u(`Error unshifting items in ${this.key}`, r);
896
- this.error$.next(s);
897
- }
898
- }
899
- shift() {
900
- try {
901
- const e = this.value.length > 0 ? this.value[0] : void 0, r = d(this.value, (s) => {
902
- s.shift();
903
- });
904
- return this.updateState(r), this.error$.next(null), e;
905
- } catch (e) {
906
- const r = new u(`Error shifting item from ${this.key}`, e);
907
- return void this.error$.next(r);
908
- }
909
- }
910
- set(e, r) {
911
- try {
912
- const s = d(this.value, (n) => {
913
- if (!(e >= 0 && e < n.length)) throw new Error(`Index ${e} out of bounds (length: ${n.length})`);
914
- n[e] = r;
915
- });
916
- this.updateState(s), this.error$.next(null);
917
- } catch (s) {
918
- const n = new u(`Error setting item at index ${e} in ${this.key}`, s);
919
- this.error$.next(n);
920
- }
921
- }
922
- get(e) {
923
- return this.value[e];
924
- }
925
- splice(e, r, ...s) {
926
- try {
927
- const n = [...this.value].splice(e, r ?? 0, ...s), a = d(this.value, (h) => {
928
- h.splice(e, r ?? 0, ...s.map((c) => c));
929
- });
930
- return this.updateState(a), this.error$.next(null), n;
931
- } catch (n) {
932
- const a = new u(`Error splicing items in ${this.key}`, n);
933
- return this.error$.next(a), [];
934
- }
935
- }
936
- remove(e, r) {
937
- try {
938
- const s = r || ((a, h) => a === h), n = this.value.findIndex((a) => s(a, e));
939
- if (n !== -1) {
940
- const a = d(this.value, (h) => {
941
- h.splice(n, 1);
942
- });
943
- return this.updateState(a), this.error$.next(null), !0;
944
- }
945
- return this.error$.next(null), !1;
946
- } catch (s) {
947
- const n = new u(`Error removing item in ${this.key}`, s);
948
- return this.error$.next(n), !1;
949
- }
950
- }
951
- replace(e) {
952
- try {
953
- const r = d(e, (s) => s);
954
- this.updateState(r), this.error$.next(null);
955
- } catch (r) {
956
- const s = new u(`Error replacing array in ${this.key}`, r);
957
- this.error$.next(s);
958
- }
959
- }
960
- filter(e) {
961
- try {
962
- const r = this.value.filter(e), s = d(this.value, (n) => {
963
- n.length = 0, n.push(...r.map((a) => a));
964
- });
965
- this.updateState(s), this.error$.next(null);
966
- } catch (r) {
967
- const s = new u(`Error filtering array in ${this.key}`, r);
968
- this.error$.next(s);
969
- }
970
- }
971
- map(e) {
972
- return this.value.map(e);
973
- }
974
- sort(e) {
975
- try {
976
- const r = [...this.value].sort(e), s = d(this.value, (n) => {
977
- n.length = 0, n.push(...r.map((a) => a));
978
- });
979
- this.updateState(s), this.error$.next(null);
980
- } catch (r) {
981
- const s = new u(`Error sorting array in ${this.key}`, r);
982
- this.error$.next(s);
983
- }
984
- }
985
- update(e, r) {
986
- try {
987
- const s = d(this.value, (n) => {
988
- if (!(e >= 0 && e < n.length)) throw new Error(`Index ${e} out of bounds (length: ${n.length})`);
989
- r(n[e]);
990
- });
991
- this.updateState(s), this.error$.next(null);
992
- } catch (s) {
993
- const n = new u(`Error updating item at index ${e} in ${this.key}`, s);
994
- this.error$.next(n);
995
- }
996
- }
997
- clear() {
998
- this.updateState([]);
999
- }
1000
- setupDevTools() {
1001
- typeof window < "u" && (window.__STORES__ = window.__STORES__ || {}, window.__STORES__[this.key] = { getState: () => this.value, push: this.push.bind(this), pop: this.pop.bind(this), unshift: this.unshift.bind(this), shift: this.shift.bind(this), set: this.set.bind(this), get: this.get.bind(this), splice: this.splice.bind(this), remove: this.remove.bind(this), replace: this.replace.bind(this), filter: this.filter.bind(this), map: this.map.bind(this), sort: this.sort.bind(this), update: this.update.bind(this), clear: this.clear.bind(this), subscribe: (e) => {
1002
- const r = this.$.subscribe(e);
1003
- return () => r.unsubscribe();
1004
- } });
1005
- }
1006
- };
1007
- D.type = "array", D.instances = /* @__PURE__ */ new Map();
1007
+ D.type = "object", D.instances = /* @__PURE__ */ new Map();
1008
1008
  let ae = D;
1009
1009
  export {
1010
+ q as B,
1010
1011
  G as I,
1011
1012
  ge as L,
1012
1013
  me as M,
1013
- ie as S,
1014
- ve as a,
1015
- u as b,
1014
+ ne as S,
1015
+ ae as a,
1016
+ ve as b,
1016
1017
  Se as c,
1017
- ne as d,
1018
- ae as e
1018
+ u as d,
1019
+ ie as e
1019
1020
  };
1020
- //# sourceMappingURL=context-array-DpyA_ATT.js.map
1021
+ //# sourceMappingURL=context-object-CISes2bD.js.map