@marianmeres/stuic 1.3.0 → 1.4.0

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.
@@ -11,4 +11,13 @@ export declare const windowSize: {
11
11
  scale: number;
12
12
  }> | undefined): import("svelte/store").Unsubscriber;
13
13
  };
14
- export declare const breakpoint: import("svelte/store").Readable<string | null>;
14
+ interface Breakpoint {
15
+ __current__: null | string;
16
+ sm: boolean;
17
+ md: boolean;
18
+ lg: boolean;
19
+ xl: boolean;
20
+ '2xl': boolean;
21
+ }
22
+ export declare const breakpoint: import("svelte/store").Readable<Breakpoint>;
23
+ export {};
@@ -17,7 +17,6 @@ windowSize.touch();
17
17
  // intentionally not debounced
18
18
  window?.visualViewport?.addEventListener('resize', windowSize.touch);
19
19
  window?.visualViewport?.addEventListener('scroll', windowSize.touch);
20
- // https://tailwindcss.com/docs/responsive-design
21
20
  export const breakpoint = derived([windowSize], ([{ width: w }]) => {
22
21
  const list = [
23
22
  ['sm', 640],
@@ -26,5 +25,10 @@ export const breakpoint = derived([windowSize], ([{ width: w }]) => {
26
25
  ['xl', 1280],
27
26
  ['2xl', 1536],
28
27
  ];
29
- return list.reduce((m, [k, v]) => (w && w >= v ? k : m), null);
28
+ // return list.reduce<string | null>((m, [k, v]) => (w && w >= v ? k : m), null);
29
+ return list.reduce((m, [k, v]) => {
30
+ const flag = w && w >= v;
31
+ m = { ...m, [k]: flag, __current__: flag ? k : m.__current__ };
32
+ return m;
33
+ }, { __current__: null, sm: false, md: false, lg: false, xl: false, '2xl': false });
30
34
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",