@leaflink/stash 42.4.3 → 42.4.4

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.
@@ -1,32 +1,33 @@
1
- import { toValue as a, ref as o, watch as d, onScopeDispose as m, computed as u } from "vue";
1
+ import { toValue as t, ref as h, watch as d, onScopeDispose as m, computed as u } from "vue";
2
2
  const s = /* @__PURE__ */ new Map();
3
- function M(e) {
4
- s.has(a(e)) || s.set(a(e), {
5
- hasMatches: o(!1),
6
- mediaQueryList: window.matchMedia(a(e))
3
+ function f(e) {
4
+ s.has(t(e)) || s.set(t(e), {
5
+ hasMatches: h(!1),
6
+ mediaQueryList: window.matchMedia(t(e))
7
7
  });
8
- const t = s.get(a(e));
9
- function c(i) {
10
- t.hasMatches.value = i.matches;
8
+ const a = s.get(t(e));
9
+ function n(i) {
10
+ a.hasMatches.value = i.matches;
11
11
  }
12
- function n() {
13
- t.mediaQueryList.removeEventListener("change", c);
12
+ function c() {
13
+ var i;
14
+ typeof ((i = a.mediaQueryList) == null ? void 0 : i.removeEventListener) == "function" && a.mediaQueryList.removeEventListener("change", n);
14
15
  }
15
- const h = d(
16
- () => a(e),
16
+ const o = d(
17
+ () => t(e),
17
18
  () => {
18
- n(), t.mediaQueryList = window.matchMedia(a(e)), t.mediaQueryList.addEventListener("change", c), t.hasMatches.value = t.mediaQueryList.matches;
19
+ c(), a.mediaQueryList = window.matchMedia(t(e)), a.mediaQueryList.addEventListener("change", n), a.hasMatches.value = a.mediaQueryList.matches;
19
20
  },
20
21
  { immediate: !0 }
21
22
  );
22
23
  return m(() => {
23
- h(), n(), s.delete(a(e));
24
+ o(), c(), s.delete(t(e));
24
25
  }), u(() => {
25
26
  var i;
26
- return !!((i = s.get(a(e))) != null && i.hasMatches.value);
27
+ return !!((i = s.get(t(e))) != null && i.hasMatches.value);
27
28
  });
28
29
  }
29
30
  export {
30
- M as default
31
+ f as default
31
32
  };
32
33
  //# sourceMappingURL=useMediaQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMediaQuery.js","sources":["../src/composables/useMediaQuery/useMediaQuery.ts"],"sourcesContent":["import { computed, MaybeRefOrGetter, onScopeDispose, Ref, ref, toValue, watch } from 'vue';\n\nexport interface QueryCacheItem {\n hasMatches: Ref<boolean>;\n mediaQueryList: MediaQueryList;\n}\n\nconst queryCache = new Map<string, QueryCacheItem>();\n\n/**\n * Given a media query, this composable returns a reactive boolean indicating if the current window dimensions match the media query.\n */\nexport default function useMediaQuery(query: MaybeRefOrGetter<string>) {\n if (!queryCache.has(toValue(query))) {\n queryCache.set(toValue(query), {\n hasMatches: ref(false),\n mediaQueryList: window.matchMedia(toValue(query)),\n });\n }\n\n const queryCacheItem = queryCache.get(toValue(query)) as QueryCacheItem;\n\n function onMediaChange(event: MediaQueryListEvent) {\n queryCacheItem.hasMatches.value = event.matches;\n }\n\n function cleanup() {\n queryCacheItem.mediaQueryList.removeEventListener('change', onMediaChange);\n }\n\n const stopWatch = watch(\n () => toValue(query),\n () => {\n cleanup();\n\n queryCacheItem.mediaQueryList = window.matchMedia(toValue(query));\n queryCacheItem.mediaQueryList.addEventListener('change', onMediaChange);\n queryCacheItem.hasMatches.value = queryCacheItem.mediaQueryList.matches;\n },\n { immediate: true },\n );\n\n onScopeDispose(() => {\n stopWatch();\n cleanup();\n queryCache.delete(toValue(query));\n });\n\n return computed(() => !!queryCache.get(toValue(query))?.hasMatches.value);\n}\n"],"names":["queryCache","useMediaQuery","query","toValue","ref","queryCacheItem","onMediaChange","event","cleanup","stopWatch","watch","onScopeDispose","computed","_a"],"mappings":";AAOA,MAAMA,wBAAiB;AAKvB,SAAwBC,EAAcC,GAAiC;AACrE,EAAKF,EAAW,IAAIG,EAAQD,CAAK,CAAC,KACrBF,EAAA,IAAIG,EAAQD,CAAK,GAAG;AAAA,IAC7B,YAAYE,EAAI,EAAK;AAAA,IACrB,gBAAgB,OAAO,WAAWD,EAAQD,CAAK,CAAC;AAAA,EAAA,CACjD;AAGH,QAAMG,IAAiBL,EAAW,IAAIG,EAAQD,CAAK,CAAC;AAEpD,WAASI,EAAcC,GAA4B;AAClC,IAAAF,EAAA,WAAW,QAAQE,EAAM;AAAA,EAC1C;AAEA,WAASC,IAAU;AACF,IAAAH,EAAA,eAAe,oBAAoB,UAAUC,CAAa;AAAA,EAC3E;AAEA,QAAMG,IAAYC;AAAA,IAChB,MAAMP,EAAQD,CAAK;AAAA,IACnB,MAAM;AACI,MAAAM,KAERH,EAAe,iBAAiB,OAAO,WAAWF,EAAQD,CAAK,CAAC,GACjDG,EAAA,eAAe,iBAAiB,UAAUC,CAAa,GACvDD,EAAA,WAAW,QAAQA,EAAe,eAAe;AAAA,IAClE;AAAA,IACA,EAAE,WAAW,GAAK;AAAA,EAAA;AAGpB,SAAAM,EAAe,MAAM;AACT,IAAAF,KACFD,KACGR,EAAA,OAAOG,EAAQD,CAAK,CAAC;AAAA,EAAA,CACjC,GAEMU,EAAS,MAAA;;AAAM,YAAC,GAACC,IAAAb,EAAW,IAAIG,EAAQD,CAAK,CAAC,MAA7B,QAAAW,EAAgC,WAAW;AAAA,GAAK;AAC1E;"}
1
+ {"version":3,"file":"useMediaQuery.js","sources":["../src/composables/useMediaQuery/useMediaQuery.ts"],"sourcesContent":["import { computed, MaybeRefOrGetter, onScopeDispose, Ref, ref, toValue, watch } from 'vue';\n\nexport interface QueryCacheItem {\n hasMatches: Ref<boolean>;\n mediaQueryList: MediaQueryList;\n}\n\nconst queryCache = new Map<string, QueryCacheItem>();\n\n/**\n * Given a media query, this composable returns a reactive boolean indicating if the current window dimensions match the media query.\n */\nexport default function useMediaQuery(query: MaybeRefOrGetter<string>) {\n if (!queryCache.has(toValue(query))) {\n queryCache.set(toValue(query), {\n hasMatches: ref(false),\n mediaQueryList: window.matchMedia(toValue(query)),\n });\n }\n\n const queryCacheItem = queryCache.get(toValue(query)) as QueryCacheItem;\n\n function onMediaChange(event: MediaQueryListEvent) {\n queryCacheItem.hasMatches.value = event.matches;\n }\n\n function cleanup() {\n if (typeof queryCacheItem.mediaQueryList?.removeEventListener === 'function') {\n queryCacheItem.mediaQueryList.removeEventListener('change', onMediaChange);\n }\n }\n\n const stopWatch = watch(\n () => toValue(query),\n () => {\n cleanup();\n\n queryCacheItem.mediaQueryList = window.matchMedia(toValue(query));\n queryCacheItem.mediaQueryList.addEventListener('change', onMediaChange);\n queryCacheItem.hasMatches.value = queryCacheItem.mediaQueryList.matches;\n },\n { immediate: true },\n );\n\n onScopeDispose(() => {\n stopWatch();\n cleanup();\n queryCache.delete(toValue(query));\n });\n\n return computed(() => !!queryCache.get(toValue(query))?.hasMatches.value);\n}\n"],"names":["queryCache","useMediaQuery","query","toValue","ref","queryCacheItem","onMediaChange","event","cleanup","_a","stopWatch","watch","onScopeDispose","computed"],"mappings":";AAOA,MAAMA,wBAAiB;AAKvB,SAAwBC,EAAcC,GAAiC;AACrE,EAAKF,EAAW,IAAIG,EAAQD,CAAK,CAAC,KACrBF,EAAA,IAAIG,EAAQD,CAAK,GAAG;AAAA,IAC7B,YAAYE,EAAI,EAAK;AAAA,IACrB,gBAAgB,OAAO,WAAWD,EAAQD,CAAK,CAAC;AAAA,EAAA,CACjD;AAGH,QAAMG,IAAiBL,EAAW,IAAIG,EAAQD,CAAK,CAAC;AAEpD,WAASI,EAAcC,GAA4B;AAClC,IAAAF,EAAA,WAAW,QAAQE,EAAM;AAAA,EAC1C;AAEA,WAASC,IAAU;;AACjB,IAAI,SAAOC,IAAAJ,EAAe,mBAAf,gBAAAI,EAA+B,wBAAwB,cACjDJ,EAAA,eAAe,oBAAoB,UAAUC,CAAa;AAAA,EAE7E;AAEA,QAAMI,IAAYC;AAAA,IAChB,MAAMR,EAAQD,CAAK;AAAA,IACnB,MAAM;AACI,MAAAM,KAERH,EAAe,iBAAiB,OAAO,WAAWF,EAAQD,CAAK,CAAC,GACjDG,EAAA,eAAe,iBAAiB,UAAUC,CAAa,GACvDD,EAAA,WAAW,QAAQA,EAAe,eAAe;AAAA,IAClE;AAAA,IACA,EAAE,WAAW,GAAK;AAAA,EAAA;AAGpB,SAAAO,EAAe,MAAM;AACT,IAAAF,KACFF,KACGR,EAAA,OAAOG,EAAQD,CAAK,CAAC;AAAA,EAAA,CACjC,GAEMW,EAAS,MAAA;;AAAM,YAAC,GAACJ,IAAAT,EAAW,IAAIG,EAAQD,CAAK,CAAC,MAA7B,QAAAO,EAAgC,WAAW;AAAA,GAAK;AAC1E;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflink/stash",
3
- "version": "42.4.3",
3
+ "version": "42.4.4",
4
4
  "description": "LeafLink's design system.",
5
5
  "homepage": "https://stash.leaflink.com",
6
6
  "main": "./dist/index.ts",