@noya-app/noya-designsystem 0.1.8 → 0.1.9

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.
@@ -5,13 +5,13 @@
5
5
  CLI Target: esnext
6
6
  CJS Build start
7
7
  ESM Build start
8
- ESM dist/index.mjs 183.55 KB
9
- ESM dist/index.mjs.map 407.50 KB
10
- ESM ⚡️ Build success in 103ms
11
- CJS dist/index.js 199.76 KB
12
- CJS dist/index.js.map 407.69 KB
13
- CJS ⚡️ Build success in 103ms
8
+ ESM dist/index.mjs 185.59 KB
9
+ ESM dist/index.mjs.map 411.74 KB
10
+ ESM ⚡️ Build success in 79ms
11
+ CJS dist/index.js 201.80 KB
12
+ CJS dist/index.js.map 411.93 KB
13
+ CJS ⚡️ Build success in 80ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 5984ms
15
+ DTS ⚡️ Build success in 6041ms
16
16
  DTS dist/index.d.ts 54.34 KB
17
17
  DTS dist/index.d.mts 54.34 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @noya-app/noya-designsystem
2
2
 
3
+ ## 0.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - @noya-app/noya-colorpicker@0.1.7
8
+
3
9
  ## 0.1.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -791,6 +791,85 @@ var import_react22 = require("react");
791
791
  var import_noya_utils4 = require("@noya-app/noya-utils");
792
792
  var import_react23 = require("react");
793
793
 
794
+ // ../emitter/src/index.ts
795
+ var Emitter = class {
796
+ constructor(options = {}) {
797
+ this.bufferEventsIfNoListeners = options.bufferEventsIfNoListeners ?? false;
798
+ }
799
+ bufferEventsIfNoListeners;
800
+ listeners = [];
801
+ addListener = (f, options = {}) => {
802
+ if (options.once) {
803
+ const handler = (...args) => {
804
+ this.removeListener(handler);
805
+ return f(...args);
806
+ };
807
+ this.listeners.push(handler);
808
+ } else {
809
+ this.listeners.push(f);
810
+ }
811
+ if (this.bufferedEvents.length > 0) {
812
+ const eventsToEmit = this.bufferedEvents;
813
+ this.bufferedEvents = [];
814
+ eventsToEmit.forEach((event) => {
815
+ this.emit(...event);
816
+ });
817
+ }
818
+ return () => this.removeListener(f);
819
+ };
820
+ removeListener = (f) => {
821
+ const index = this.listeners.indexOf(f);
822
+ if (index === -1)
823
+ return;
824
+ this.listeners.splice(index, 1);
825
+ };
826
+ emit = (...args) => {
827
+ if (this.bufferEventsIfNoListeners && this.listeners.length === 0) {
828
+ this.bufferedEvents.push(args);
829
+ return;
830
+ }
831
+ this.listeners.forEach((l) => l(...args));
832
+ };
833
+ bufferedEvents = [];
834
+ };
835
+
836
+ // ../noya-react-utils/src/utils/ClientStorage.ts
837
+ var ClientStorage = class {
838
+ getItem(storageKey) {
839
+ if (typeof localStorage === "undefined") {
840
+ return null;
841
+ }
842
+ return localStorage.getItem(storageKey);
843
+ }
844
+ setItem(storageKey, value) {
845
+ if (typeof localStorage === "undefined") {
846
+ return;
847
+ }
848
+ if (value === null) {
849
+ localStorage.removeItem(storageKey);
850
+ } else {
851
+ localStorage.setItem(storageKey, value);
852
+ }
853
+ this.emitter.emit(storageKey, value);
854
+ }
855
+ emitter = new Emitter();
856
+ _isListening = false;
857
+ addListener(storageKey, listener) {
858
+ if (!this._isListening && typeof window !== "undefined") {
859
+ this._isListening = true;
860
+ window.addEventListener("storage", (event) => {
861
+ this.emitter.emit(event.key, event.newValue);
862
+ });
863
+ }
864
+ return this.emitter.addListener((key, value) => {
865
+ if (key === storageKey) {
866
+ listener(value);
867
+ }
868
+ });
869
+ }
870
+ };
871
+ var clientStorage = new ClientStorage();
872
+
794
873
  // ../noya-react-utils/src/utils/assignRef.ts
795
874
  function assignRef(ref, value) {
796
875
  if (typeof ref === "function") {