qstd 0.2.14 → 0.2.16

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 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/block/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,QAAA,MAAM,SAAS,sKAAoB,CAAC;AACpC,QAAA,MAAM,SAAS,4KAAuB,CAAC;AA0TvC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,2CAMxD;AAID,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,2CAYrE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,uDAuDrE"}
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/block/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,QAAA,MAAM,SAAS,sKAAoB,CAAC;AACpC,QAAA,MAAM,SAAS,4KAAuB,CAAC;AAuUvC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,2CAMxD;AAID,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,2CAYrE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,uDAuDrE"}
@@ -2496,6 +2496,7 @@ function DrawerComponent(props) {
2496
2496
  const dragHandleRef = React12__namespace.default.useRef(null);
2497
2497
  const [isDesktop] = useMatchMedia(breakpoint);
2498
2498
  const closeFnRef = React12__namespace.default.useRef(null);
2499
+ const prevOpenRef = React12__namespace.default.useRef(null);
2499
2500
  const dragControls = framerMotion.useDragControls();
2500
2501
  const { open, setOpen } = useDrawer();
2501
2502
  const { onClose, ...rest } = props;
@@ -2527,8 +2528,14 @@ function DrawerComponent(props) {
2527
2528
  }
2528
2529
  };
2529
2530
  React12__namespace.default.useEffect(() => {
2530
- if (props.open) openDrawer();
2531
- else closeFnRef.current?.();
2531
+ const wasOpen = prevOpenRef.current;
2532
+ const isOpen = props.open;
2533
+ if (isOpen) {
2534
+ openDrawer();
2535
+ } else if (wasOpen === true) {
2536
+ closeFnRef.current?.();
2537
+ }
2538
+ prevOpenRef.current = isOpen;
2532
2539
  }, [props.open]);
2533
2540
  React12__namespace.default.useEffect(() => {
2534
2541
  const container = ref.current;
@@ -2807,19 +2814,21 @@ function Backdrop(props) {
2807
2814
  );
2808
2815
  }
2809
2816
  function useMatchMedia(queries, defaultValues = []) {
2810
- const initialValues = defaultValues.length ? defaultValues : Array(queries.length).fill(false);
2811
- const mediaQueryLists = queries.map((q) => window.matchMedia(q));
2812
- const getValue = () => {
2813
- const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
2814
- return matchedQueries;
2815
- };
2816
- const [value, setValue] = React12__namespace.default.useState(getValue);
2817
+ defaultValues.length ? defaultValues : Array(queries.length).fill(false);
2818
+ const [value, setValue] = React12__namespace.default.useState(() => {
2819
+ return queries.map((q) => window.matchMedia(q).matches);
2820
+ });
2817
2821
  React12__namespace.default.useLayoutEffect(() => {
2818
- const handler = () => setValue(getValue);
2819
- mediaQueryLists.forEach((mql) => mql.addListener(handler));
2820
- return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
2821
- }, []);
2822
- if (typeof window === "undefined") return initialValues;
2822
+ const mediaQueryLists = queries.map((q) => window.matchMedia(q));
2823
+ const handler = () => {
2824
+ setValue(mediaQueryLists.map((mql) => mql.matches));
2825
+ };
2826
+ handler();
2827
+ mediaQueryLists.forEach((mql) => mql.addEventListener("change", handler));
2828
+ return () => mediaQueryLists.forEach(
2829
+ (mql) => mql.removeEventListener("change", handler)
2830
+ );
2831
+ }, [queries]);
2823
2832
  return value;
2824
2833
  }
2825
2834
  var MotionDiv5 = motionTags.div;
@@ -2473,6 +2473,7 @@ function DrawerComponent(props) {
2473
2473
  const dragHandleRef = React12__default.useRef(null);
2474
2474
  const [isDesktop] = useMatchMedia(breakpoint);
2475
2475
  const closeFnRef = React12__default.useRef(null);
2476
+ const prevOpenRef = React12__default.useRef(null);
2476
2477
  const dragControls = useDragControls();
2477
2478
  const { open, setOpen } = useDrawer();
2478
2479
  const { onClose, ...rest } = props;
@@ -2504,8 +2505,14 @@ function DrawerComponent(props) {
2504
2505
  }
2505
2506
  };
2506
2507
  React12__default.useEffect(() => {
2507
- if (props.open) openDrawer();
2508
- else closeFnRef.current?.();
2508
+ const wasOpen = prevOpenRef.current;
2509
+ const isOpen = props.open;
2510
+ if (isOpen) {
2511
+ openDrawer();
2512
+ } else if (wasOpen === true) {
2513
+ closeFnRef.current?.();
2514
+ }
2515
+ prevOpenRef.current = isOpen;
2509
2516
  }, [props.open]);
2510
2517
  React12__default.useEffect(() => {
2511
2518
  const container = ref.current;
@@ -2784,19 +2791,21 @@ function Backdrop(props) {
2784
2791
  );
2785
2792
  }
2786
2793
  function useMatchMedia(queries, defaultValues = []) {
2787
- const initialValues = defaultValues.length ? defaultValues : Array(queries.length).fill(false);
2788
- const mediaQueryLists = queries.map((q) => window.matchMedia(q));
2789
- const getValue = () => {
2790
- const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
2791
- return matchedQueries;
2792
- };
2793
- const [value, setValue] = React12__default.useState(getValue);
2794
+ defaultValues.length ? defaultValues : Array(queries.length).fill(false);
2795
+ const [value, setValue] = React12__default.useState(() => {
2796
+ return queries.map((q) => window.matchMedia(q).matches);
2797
+ });
2794
2798
  React12__default.useLayoutEffect(() => {
2795
- const handler = () => setValue(getValue);
2796
- mediaQueryLists.forEach((mql) => mql.addListener(handler));
2797
- return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
2798
- }, []);
2799
- if (typeof window === "undefined") return initialValues;
2799
+ const mediaQueryLists = queries.map((q) => window.matchMedia(q));
2800
+ const handler = () => {
2801
+ setValue(mediaQueryLists.map((mql) => mql.matches));
2802
+ };
2803
+ handler();
2804
+ mediaQueryLists.forEach((mql) => mql.addEventListener("change", handler));
2805
+ return () => mediaQueryLists.forEach(
2806
+ (mql) => mql.removeEventListener("change", handler)
2807
+ );
2808
+ }, [queries]);
2800
2809
  return value;
2801
2810
  }
2802
2811
  var MotionDiv5 = motionTags.div;
@@ -12,4 +12,10 @@ export declare const readFile: (filePath: string, encoding?: BufferEncoding) =>
12
12
  * @param buffer - Readable stream to write
13
13
  */
14
14
  export declare const writeBufferToFile: (filepath: string, buffer: Readable | undefined) => Promise<void>;
15
+ /**
16
+ * Write string content to a file
17
+ * @param filepath - Path to write the file to
18
+ * @param content - String content to write
19
+ */
20
+ export declare const writeFile: (filepath: string, content: string) => Promise<void>;
15
21
  //# sourceMappingURL=file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/server/file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GACnB,UAAU,MAAM,EAChB,WAAU,cAAwB,KACjC,OAAO,CAAC,MAAM,CAEhB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,MAAM,EAChB,QAAQ,QAAQ,GAAG,SAAS,kBAQ7B,CAAC"}
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/server/file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GACnB,UAAU,MAAM,EAChB,WAAU,cAAwB,KACjC,OAAO,CAAC,MAAM,CAEhB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,MAAM,EAChB,QAAQ,QAAQ,GAAG,SAAS,kBAQ7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,UAAU,MAAM,EAAE,SAAS,MAAM,kBAEhE,CAAC"}
@@ -598,7 +598,8 @@ var label = (name) => ({
598
598
  var file_exports = {};
599
599
  __export(file_exports, {
600
600
  readFile: () => readFile,
601
- writeBufferToFile: () => writeBufferToFile
601
+ writeBufferToFile: () => writeBufferToFile,
602
+ writeFile: () => writeFile
602
603
  });
603
604
  var readFile = async (filePath, encoding = "utf-8") => {
604
605
  return fs.promises.readFile(filePath, encoding);
@@ -611,6 +612,9 @@ var writeBufferToFile = async (filepath, buffer) => {
611
612
  }
612
613
  await fs.promises.writeFile(filepath, Buffer.concat(chunks));
613
614
  };
615
+ var writeFile = async (filepath, content) => {
616
+ return fs.promises.writeFile(filepath, content);
617
+ };
614
618
 
615
619
  exports.Dict = dict_exports;
616
620
  exports.File = file_exports;
@@ -596,7 +596,8 @@ var label = (name) => ({
596
596
  var file_exports = {};
597
597
  __export(file_exports, {
598
598
  readFile: () => readFile,
599
- writeBufferToFile: () => writeBufferToFile
599
+ writeBufferToFile: () => writeBufferToFile,
600
+ writeFile: () => writeFile
600
601
  });
601
602
  var readFile = async (filePath, encoding = "utf-8") => {
602
603
  return promises.readFile(filePath, encoding);
@@ -609,5 +610,8 @@ var writeBufferToFile = async (filepath, buffer) => {
609
610
  }
610
611
  await promises.writeFile(filepath, Buffer.concat(chunks));
611
612
  };
613
+ var writeFile = async (filepath, content) => {
614
+ return promises.writeFile(filepath, content);
615
+ };
612
616
 
613
617
  export { dict_exports as Dict, file_exports as File, flow_exports as Flow, int_exports as Int, list_exports as List, log_exports as Log, money_exports as Money, random_exports as Random, str_exports as Str, time_exports as Time };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qstd",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "Standard Block component and utilities library with Panda CSS",
5
5
  "author": "malin1",
6
6
  "license": "MIT",