qstd 0.2.12 → 0.2.14

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":"fns.d.ts","sourceRoot":"","sources":["../../src/block/fns.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,GAAG,IAAI,uBAsC3C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,GAAG,IAAI,uBA6BjD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,GAAG,IAAI,kBAsB3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,SAAS,IAAI,EAAE,eAAe,IAAI,EAAE,iBA4BvE,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,EAAE,EACpD,UAAU,KAAK,CAAC,SAAS,EACzB,aAAa,MAAM,KAClB,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,SAW1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;CAgEvE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,UAAU,CAAC,OAAO,aAAa,CAAC,EACzC,UAAU,GAAG,UA6Ed,CAAC;AAiGF,eAAO,MAAM,QAAQ,GACnB,SAAS,UAAU,CAAC,OAAO,aAAa,CAAC,EACzC,UAAU,GAAG;;;CA+Bd,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,KAAK,GAAG,EAAE,MAAM,SAAS,MAAM,EAAE,OAkBrD,CAAC"}
1
+ {"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../src/block/fns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EACnC,KAAK,CAAC,EACN,MAAM,SAAS,MAAM,EAAE,KACtB,OAAO,CAAC,CAAC,CAkBX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-resize-observer.d.ts","sourceRoot":"","sources":["../../src/block/use-resize-observer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;AAEzD,KAAK,YAAY,CAAC,CAAC,SAAS,OAAO,IAAI;IACrC,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAC3B,GAAG,YAAY,CAAC;AAIjB,MAAM,MAAM,wBAAwB,GAChC,YAAY,GACZ,aAAa,GACb,0BAA0B,CAAC;AAE/B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,mBAAmB;QAC3B,QAAQ,CAAC,yBAAyB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;KACvE;CACF;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAOrD,iBAAS,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAC1C,IAAI,GAAE;IACJ,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,GAAG,CAAC,EAAE,wBAAwB,CAAC;IAC/B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACrB,GACL,YAAY,CAAC,CAAC,CAAC,CAqIjB;AAwID,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"use-resize-observer.d.ts","sourceRoot":"","sources":["../../src/block/use-resize-observer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;AAEzD,KAAK,YAAY,CAAC,CAAC,SAAS,OAAO,IAAI;IACrC,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAC3B,GAAG,YAAY,CAAC;AAIjB,MAAM,MAAM,wBAAwB,GAChC,YAAY,GACZ,aAAa,GACb,0BAA0B,CAAC;AAE/B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,mBAAmB;QAC3B,QAAQ,CAAC,yBAAyB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;KACvE;CACF;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAOrD,iBAAS,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAC1C,IAAI,GAAE;IACJ,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,GAAG,CAAC,EAAE,wBAAwB,CAAC;IAC/B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACrB,GACL,YAAY,CAAC,CAAC,CAAC,CAuIjB;AAsID,eAAe,iBAAiB,CAAC"}
@@ -878,7 +878,7 @@ function useOutsideClick(ref, handler, enabled = true) {
878
878
  }
879
879
  var extractImageMetadata = (f) => {
880
880
  return new Promise((res, rej) => {
881
- if (!f) rej("No image file provided.");
881
+ if (!f) rej(new Error("No image file provided."));
882
882
  const ext = f.type.split("/").pop();
883
883
  const id = `${ext}_${nanoid.nanoid()}.${ext}`;
884
884
  const preview = URL.createObjectURL(f);
@@ -891,7 +891,7 @@ var extractImageMetadata = (f) => {
891
891
  else orientation = "landscape";
892
892
  res({ id, preview, orientation, height, width });
893
893
  };
894
- image.onerror = (e, x, y, z, a) => {
894
+ image.onerror = () => {
895
895
  if (ext?.includes("tif")) {
896
896
  const { height, width } = image;
897
897
  let orientation = "";
@@ -901,7 +901,7 @@ var extractImageMetadata = (f) => {
901
901
  res({ id, preview, orientation, height, width });
902
902
  } else {
903
903
  console.log("image error");
904
- rej("Image failed to load.");
904
+ rej(new Error("Image failed to load."));
905
905
  }
906
906
  };
907
907
  image.src = preview;
@@ -911,7 +911,7 @@ var extractAudioMetadata = async (f) => {
911
911
  const mmb = await import('music-metadata-browser');
912
912
  const meta = await mmb.parseBlob(f, { duration: true });
913
913
  return new Promise((res, rej) => {
914
- if (!f) rej("No audio file provided.");
914
+ if (!f) rej(new Error("No audio file provided."));
915
915
  const ext = f.name.split(".").pop();
916
916
  const id = `${ext}_${nanoid.nanoid()}.${ext}`;
917
917
  const [cover] = meta.common.picture ?? [];
@@ -928,7 +928,7 @@ var extractAudioMetadata = async (f) => {
928
928
  };
929
929
  var extractVideoMetadata = (f) => {
930
930
  return new Promise((res, rej) => {
931
- if (!f) rej("No video file provided.");
931
+ if (!f) rej(new Error("No video file provided."));
932
932
  const ext = f.type.split("/").pop();
933
933
  const id = `${ext}_${nanoid.nanoid()}.${ext}`;
934
934
  const video = document.createElement("video");
@@ -1052,7 +1052,7 @@ var extractElAndStyles = (extract, anyProps) => {
1052
1052
  } = anyProps;
1053
1053
  const StdComp = tags[extract.el] || tags.div;
1054
1054
  const MotionComp = motionTags[extract.el] || motionTags.div;
1055
- const hasMotionProps = layout !== void 0 || initial !== void 0 || animate !== void 0 || exit !== void 0 || whileHover !== void 0 || whileTap !== void 0 || whileFocus !== void 0 || variants !== void 0 || transition !== void 0;
1055
+ const hasMotionProps = _motion !== void 0 || layout !== void 0 || initial !== void 0 || animate !== void 0 || exit !== void 0 || whileHover !== void 0 || whileTap !== void 0 || whileFocus !== void 0 || variants !== void 0 || transition !== void 0;
1056
1056
  const comp = hasMotionProps ? MotionComp : StdComp;
1057
1057
  const motionProps = hasMotionProps ? {
1058
1058
  layout,
@@ -1063,7 +1063,7 @@ var extractElAndStyles = (extract, anyProps) => {
1063
1063
  whileTap,
1064
1064
  whileFocus,
1065
1065
  variants,
1066
- transition
1066
+ transition: _motion ?? transition
1067
1067
  } : void 0;
1068
1068
  const remaining = omit(rest, ["loadingPosition", "loadingIcon", "isLoading"]);
1069
1069
  const cursor = anyProps.isLoading ? "not-allowed" : "pointer";
@@ -1106,7 +1106,7 @@ function getIcon(position, Icon2, props) {
1106
1106
  return chosen;
1107
1107
  } else if (typeof chosen === "function") {
1108
1108
  return chosen();
1109
- } else if (chosen?.iconName) {
1109
+ } else if (typeof chosen === "object" && chosen !== null && "iconName" in chosen) {
1110
1110
  return /* @__PURE__ */ jsxRuntime.jsx(
1111
1111
  reactFontawesome.FontAwesomeIcon,
1112
1112
  {
@@ -1169,10 +1169,11 @@ var getIcons = (extract, anyProps) => {
1169
1169
  loadingIcon = loadingProps.loadingIcon;
1170
1170
  isLoading = loadingProps.isLoading;
1171
1171
  }
1172
- const leftArg = isLoading && loadingPosition === "start" ? loadingIcon ?? null : icon ?? startIcon;
1172
+ const leftArg = isLoading && loadingPosition === "start" ? loadingIcon ?? null : icon ?? startIcon ?? null;
1173
1173
  const rightArg = isLoading && loadingPosition === "end" ? loadingIcon ?? null : endIcon ?? null;
1174
- const leftIcon = getIcon("start", leftArg, anyProps);
1175
- const rightIcon = getIcon("end", rightArg, anyProps);
1174
+ const iconProps = anyProps;
1175
+ const leftIcon = getIcon("start", leftArg, iconProps);
1176
+ const rightIcon = getIcon("end", rightArg, iconProps);
1176
1177
  return { leftIcon, rightIcon };
1177
1178
  };
1178
1179
  var omit = (obj, keys) => {
@@ -2223,7 +2224,9 @@ Label2.displayName = LabelNameKey2;
2223
2224
  function useResizeObserver(opts = {}) {
2224
2225
  const onResize = opts.onResize;
2225
2226
  const onResizeRef = React12__namespace.default.useRef(void 0);
2226
- onResizeRef.current = onResize;
2227
+ React12__namespace.default.useLayoutEffect(() => {
2228
+ onResizeRef.current = onResize;
2229
+ }, [onResize]);
2227
2230
  const round = opts.round || Math.round;
2228
2231
  const resizeObserverRef = React12__namespace.default.useRef(null);
2229
2232
  const [size, setSize] = React12__namespace.default.useState({
@@ -2296,12 +2299,11 @@ function useResizeObserver(opts = {}) {
2296
2299
  function useResolvedElement(subscriber, refOrElement) {
2297
2300
  const lastReportRef = React12__namespace.default.useRef(null);
2298
2301
  const refOrElementRef = React12__namespace.default.useRef(null);
2299
- refOrElementRef.current = refOrElement;
2302
+ React12__namespace.default.useLayoutEffect(() => {
2303
+ refOrElementRef.current = refOrElement;
2304
+ }, [refOrElement]);
2300
2305
  const cbElementRef = React12__namespace.default.useRef(null);
2301
- React12__namespace.default.useEffect(() => {
2302
- evaluateSubscription();
2303
- });
2304
- const evaluateSubscription = React12__namespace.default.useCallback(() => {
2306
+ const evaluateSubscription = () => {
2305
2307
  const cbElement = cbElementRef.current;
2306
2308
  const refOrElement2 = refOrElementRef.current;
2307
2309
  const element = cbElement ? cbElement : refOrElement2 ? refOrElement2 instanceof Element ? refOrElement2 : refOrElement2.current : null;
@@ -2318,7 +2320,10 @@ function useResolvedElement(subscriber, refOrElement) {
2318
2320
  // Setting cleanup to undefined unless a subscriber returns one, as an existing cleanup function would've been just called.
2319
2321
  cleanup: element ? subscriber(element) : void 0
2320
2322
  };
2321
- }, [subscriber]);
2323
+ };
2324
+ React12__namespace.default.useEffect(() => {
2325
+ evaluateSubscription();
2326
+ });
2322
2327
  React12__namespace.default.useEffect(() => {
2323
2328
  return () => {
2324
2329
  if (lastReportRef.current && lastReportRef.current.cleanup) {
@@ -2327,13 +2332,10 @@ function useResolvedElement(subscriber, refOrElement) {
2327
2332
  }
2328
2333
  };
2329
2334
  }, []);
2330
- return React12__namespace.default.useCallback(
2331
- (element) => {
2332
- cbElementRef.current = element;
2333
- evaluateSubscription();
2334
- },
2335
- [evaluateSubscription]
2336
- );
2335
+ return (element) => {
2336
+ cbElementRef.current = element;
2337
+ evaluateSubscription();
2338
+ };
2337
2339
  }
2338
2340
  function extractSize(entry, boxProp, sizeType) {
2339
2341
  if (!entry[boxProp]) {
@@ -2342,12 +2344,7 @@ function extractSize(entry, boxProp, sizeType) {
2342
2344
  }
2343
2345
  return void 0;
2344
2346
  }
2345
- return entry[boxProp][0] ? entry[boxProp][0][sizeType] : (
2346
- // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current
2347
- // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.
2348
- // @ts-ignore
2349
- entry[boxProp][sizeType]
2350
- );
2347
+ return entry[boxProp][0] ? entry[boxProp][0][sizeType] : entry[boxProp][sizeType];
2351
2348
  }
2352
2349
  var use_resize_observer_default = useResizeObserver;
2353
2350
  var MotionDiv3 = motionTags.div;
@@ -2387,21 +2384,22 @@ function AccordionComponent(props) {
2387
2384
  if (!React12__namespace.default.isValidElement(child)) return child;
2388
2385
  return React12__namespace.default.cloneElement(child, { idx: i });
2389
2386
  });
2390
- React12__namespace.default.useEffect(() => {
2391
- if (accordionState.open.length === children.length) return;
2392
- const defaultOpenIdx = props.defaultOpenIdx;
2393
- const items = new Array(children.length).fill(null).map((x, i) => {
2394
- if (defaultOpenIdx) return defaultOpenIdx.includes(i);
2395
- else return false;
2396
- });
2397
- accordion.setState((draft) => {
2398
- draft.open = items;
2399
- });
2400
- }, [
2401
- accordionState.open.length,
2402
- children.length,
2403
- props.defaultOpenIdx?.length
2404
- ]);
2387
+ const defaultOpenIdxList = JSON.stringify(props.defaultOpenIdx ?? []);
2388
+ React12__namespace.default.useEffect(
2389
+ () => {
2390
+ if (accordionState.open.length === children.length) return;
2391
+ const defaultOpenIdx = props.defaultOpenIdx;
2392
+ const items = new Array(children.length).fill(null).map((x, i) => {
2393
+ if (defaultOpenIdx) return defaultOpenIdx.includes(i);
2394
+ else return false;
2395
+ });
2396
+ accordion.setState((draft) => {
2397
+ draft.open = items;
2398
+ });
2399
+ },
2400
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2401
+ [accordionState.open.length, children.length, defaultOpenIdxList]
2402
+ );
2405
2403
  return /* @__PURE__ */ jsxRuntime.jsx(MotionDiv3, { grid: true, children });
2406
2404
  }
2407
2405
  function Accordion(props) {
@@ -2430,8 +2428,8 @@ function Item2(props) {
2430
2428
  alignC: "start",
2431
2429
  overflow: "auto",
2432
2430
  style: {
2433
- borderBottom: isLastItem ? `1px solid ${props.borderBottomColor ?? props.borderColor ?? "var(--colors-neutral-300)!"}` : void 0,
2434
- borderTop: `1px solid ${props.borderTopColor ?? props.borderColor ?? "var(--colors-neutral-300)!"}`
2431
+ borderBottom: isLastItem ? `1px solid ${typeof props.borderBottomColor === "string" && props.borderBottomColor || typeof props.borderColor === "string" && props.borderColor || "var(--colors-neutral-300)!"}` : void 0,
2432
+ borderTop: `1px solid ${typeof props.borderTopColor === "string" && props.borderTopColor || typeof props.borderColor === "string" && props.borderColor || "var(--colors-neutral-300)!"}`
2435
2433
  },
2436
2434
  children: [
2437
2435
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -855,7 +855,7 @@ function useOutsideClick(ref, handler, enabled = true) {
855
855
  }
856
856
  var extractImageMetadata = (f) => {
857
857
  return new Promise((res, rej) => {
858
- if (!f) rej("No image file provided.");
858
+ if (!f) rej(new Error("No image file provided."));
859
859
  const ext = f.type.split("/").pop();
860
860
  const id = `${ext}_${nanoid()}.${ext}`;
861
861
  const preview = URL.createObjectURL(f);
@@ -868,7 +868,7 @@ var extractImageMetadata = (f) => {
868
868
  else orientation = "landscape";
869
869
  res({ id, preview, orientation, height, width });
870
870
  };
871
- image.onerror = (e, x, y, z, a) => {
871
+ image.onerror = () => {
872
872
  if (ext?.includes("tif")) {
873
873
  const { height, width } = image;
874
874
  let orientation = "";
@@ -878,7 +878,7 @@ var extractImageMetadata = (f) => {
878
878
  res({ id, preview, orientation, height, width });
879
879
  } else {
880
880
  console.log("image error");
881
- rej("Image failed to load.");
881
+ rej(new Error("Image failed to load."));
882
882
  }
883
883
  };
884
884
  image.src = preview;
@@ -888,7 +888,7 @@ var extractAudioMetadata = async (f) => {
888
888
  const mmb = await import('music-metadata-browser');
889
889
  const meta = await mmb.parseBlob(f, { duration: true });
890
890
  return new Promise((res, rej) => {
891
- if (!f) rej("No audio file provided.");
891
+ if (!f) rej(new Error("No audio file provided."));
892
892
  const ext = f.name.split(".").pop();
893
893
  const id = `${ext}_${nanoid()}.${ext}`;
894
894
  const [cover] = meta.common.picture ?? [];
@@ -905,7 +905,7 @@ var extractAudioMetadata = async (f) => {
905
905
  };
906
906
  var extractVideoMetadata = (f) => {
907
907
  return new Promise((res, rej) => {
908
- if (!f) rej("No video file provided.");
908
+ if (!f) rej(new Error("No video file provided."));
909
909
  const ext = f.type.split("/").pop();
910
910
  const id = `${ext}_${nanoid()}.${ext}`;
911
911
  const video = document.createElement("video");
@@ -1029,7 +1029,7 @@ var extractElAndStyles = (extract, anyProps) => {
1029
1029
  } = anyProps;
1030
1030
  const StdComp = tags[extract.el] || tags.div;
1031
1031
  const MotionComp = motionTags[extract.el] || motionTags.div;
1032
- const hasMotionProps = layout !== void 0 || initial !== void 0 || animate !== void 0 || exit !== void 0 || whileHover !== void 0 || whileTap !== void 0 || whileFocus !== void 0 || variants !== void 0 || transition !== void 0;
1032
+ const hasMotionProps = _motion !== void 0 || layout !== void 0 || initial !== void 0 || animate !== void 0 || exit !== void 0 || whileHover !== void 0 || whileTap !== void 0 || whileFocus !== void 0 || variants !== void 0 || transition !== void 0;
1033
1033
  const comp = hasMotionProps ? MotionComp : StdComp;
1034
1034
  const motionProps = hasMotionProps ? {
1035
1035
  layout,
@@ -1040,7 +1040,7 @@ var extractElAndStyles = (extract, anyProps) => {
1040
1040
  whileTap,
1041
1041
  whileFocus,
1042
1042
  variants,
1043
- transition
1043
+ transition: _motion ?? transition
1044
1044
  } : void 0;
1045
1045
  const remaining = omit(rest, ["loadingPosition", "loadingIcon", "isLoading"]);
1046
1046
  const cursor = anyProps.isLoading ? "not-allowed" : "pointer";
@@ -1083,7 +1083,7 @@ function getIcon(position, Icon2, props) {
1083
1083
  return chosen;
1084
1084
  } else if (typeof chosen === "function") {
1085
1085
  return chosen();
1086
- } else if (chosen?.iconName) {
1086
+ } else if (typeof chosen === "object" && chosen !== null && "iconName" in chosen) {
1087
1087
  return /* @__PURE__ */ jsx(
1088
1088
  FontAwesomeIcon,
1089
1089
  {
@@ -1146,10 +1146,11 @@ var getIcons = (extract, anyProps) => {
1146
1146
  loadingIcon = loadingProps.loadingIcon;
1147
1147
  isLoading = loadingProps.isLoading;
1148
1148
  }
1149
- const leftArg = isLoading && loadingPosition === "start" ? loadingIcon ?? null : icon ?? startIcon;
1149
+ const leftArg = isLoading && loadingPosition === "start" ? loadingIcon ?? null : icon ?? startIcon ?? null;
1150
1150
  const rightArg = isLoading && loadingPosition === "end" ? loadingIcon ?? null : endIcon ?? null;
1151
- const leftIcon = getIcon("start", leftArg, anyProps);
1152
- const rightIcon = getIcon("end", rightArg, anyProps);
1151
+ const iconProps = anyProps;
1152
+ const leftIcon = getIcon("start", leftArg, iconProps);
1153
+ const rightIcon = getIcon("end", rightArg, iconProps);
1153
1154
  return { leftIcon, rightIcon };
1154
1155
  };
1155
1156
  var omit = (obj, keys) => {
@@ -2200,7 +2201,9 @@ Label2.displayName = LabelNameKey2;
2200
2201
  function useResizeObserver(opts = {}) {
2201
2202
  const onResize = opts.onResize;
2202
2203
  const onResizeRef = React12__default.useRef(void 0);
2203
- onResizeRef.current = onResize;
2204
+ React12__default.useLayoutEffect(() => {
2205
+ onResizeRef.current = onResize;
2206
+ }, [onResize]);
2204
2207
  const round = opts.round || Math.round;
2205
2208
  const resizeObserverRef = React12__default.useRef(null);
2206
2209
  const [size, setSize] = React12__default.useState({
@@ -2273,12 +2276,11 @@ function useResizeObserver(opts = {}) {
2273
2276
  function useResolvedElement(subscriber, refOrElement) {
2274
2277
  const lastReportRef = React12__default.useRef(null);
2275
2278
  const refOrElementRef = React12__default.useRef(null);
2276
- refOrElementRef.current = refOrElement;
2279
+ React12__default.useLayoutEffect(() => {
2280
+ refOrElementRef.current = refOrElement;
2281
+ }, [refOrElement]);
2277
2282
  const cbElementRef = React12__default.useRef(null);
2278
- React12__default.useEffect(() => {
2279
- evaluateSubscription();
2280
- });
2281
- const evaluateSubscription = React12__default.useCallback(() => {
2283
+ const evaluateSubscription = () => {
2282
2284
  const cbElement = cbElementRef.current;
2283
2285
  const refOrElement2 = refOrElementRef.current;
2284
2286
  const element = cbElement ? cbElement : refOrElement2 ? refOrElement2 instanceof Element ? refOrElement2 : refOrElement2.current : null;
@@ -2295,7 +2297,10 @@ function useResolvedElement(subscriber, refOrElement) {
2295
2297
  // Setting cleanup to undefined unless a subscriber returns one, as an existing cleanup function would've been just called.
2296
2298
  cleanup: element ? subscriber(element) : void 0
2297
2299
  };
2298
- }, [subscriber]);
2300
+ };
2301
+ React12__default.useEffect(() => {
2302
+ evaluateSubscription();
2303
+ });
2299
2304
  React12__default.useEffect(() => {
2300
2305
  return () => {
2301
2306
  if (lastReportRef.current && lastReportRef.current.cleanup) {
@@ -2304,13 +2309,10 @@ function useResolvedElement(subscriber, refOrElement) {
2304
2309
  }
2305
2310
  };
2306
2311
  }, []);
2307
- return React12__default.useCallback(
2308
- (element) => {
2309
- cbElementRef.current = element;
2310
- evaluateSubscription();
2311
- },
2312
- [evaluateSubscription]
2313
- );
2312
+ return (element) => {
2313
+ cbElementRef.current = element;
2314
+ evaluateSubscription();
2315
+ };
2314
2316
  }
2315
2317
  function extractSize(entry, boxProp, sizeType) {
2316
2318
  if (!entry[boxProp]) {
@@ -2319,12 +2321,7 @@ function extractSize(entry, boxProp, sizeType) {
2319
2321
  }
2320
2322
  return void 0;
2321
2323
  }
2322
- return entry[boxProp][0] ? entry[boxProp][0][sizeType] : (
2323
- // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current
2324
- // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.
2325
- // @ts-ignore
2326
- entry[boxProp][sizeType]
2327
- );
2324
+ return entry[boxProp][0] ? entry[boxProp][0][sizeType] : entry[boxProp][sizeType];
2328
2325
  }
2329
2326
  var use_resize_observer_default = useResizeObserver;
2330
2327
  var MotionDiv3 = motionTags.div;
@@ -2364,21 +2361,22 @@ function AccordionComponent(props) {
2364
2361
  if (!React12__default.isValidElement(child)) return child;
2365
2362
  return React12__default.cloneElement(child, { idx: i });
2366
2363
  });
2367
- React12__default.useEffect(() => {
2368
- if (accordionState.open.length === children.length) return;
2369
- const defaultOpenIdx = props.defaultOpenIdx;
2370
- const items = new Array(children.length).fill(null).map((x, i) => {
2371
- if (defaultOpenIdx) return defaultOpenIdx.includes(i);
2372
- else return false;
2373
- });
2374
- accordion.setState((draft) => {
2375
- draft.open = items;
2376
- });
2377
- }, [
2378
- accordionState.open.length,
2379
- children.length,
2380
- props.defaultOpenIdx?.length
2381
- ]);
2364
+ const defaultOpenIdxList = JSON.stringify(props.defaultOpenIdx ?? []);
2365
+ React12__default.useEffect(
2366
+ () => {
2367
+ if (accordionState.open.length === children.length) return;
2368
+ const defaultOpenIdx = props.defaultOpenIdx;
2369
+ const items = new Array(children.length).fill(null).map((x, i) => {
2370
+ if (defaultOpenIdx) return defaultOpenIdx.includes(i);
2371
+ else return false;
2372
+ });
2373
+ accordion.setState((draft) => {
2374
+ draft.open = items;
2375
+ });
2376
+ },
2377
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2378
+ [accordionState.open.length, children.length, defaultOpenIdxList]
2379
+ );
2382
2380
  return /* @__PURE__ */ jsx(MotionDiv3, { grid: true, children });
2383
2381
  }
2384
2382
  function Accordion(props) {
@@ -2407,8 +2405,8 @@ function Item2(props) {
2407
2405
  alignC: "start",
2408
2406
  overflow: "auto",
2409
2407
  style: {
2410
- borderBottom: isLastItem ? `1px solid ${props.borderBottomColor ?? props.borderColor ?? "var(--colors-neutral-300)!"}` : void 0,
2411
- borderTop: `1px solid ${props.borderTopColor ?? props.borderColor ?? "var(--colors-neutral-300)!"}`
2408
+ borderBottom: isLastItem ? `1px solid ${typeof props.borderBottomColor === "string" && props.borderBottomColor || typeof props.borderColor === "string" && props.borderColor || "var(--colors-neutral-300)!"}` : void 0,
2409
+ borderTop: `1px solid ${typeof props.borderTopColor === "string" && props.borderTopColor || typeof props.borderColor === "string" && props.borderColor || "var(--colors-neutral-300)!"}`
2412
2410
  },
2413
2411
  children: [
2414
2412
  /* @__PURE__ */ jsxs(
@@ -1,7 +1,7 @@
1
1
  import * as _t from "./types";
2
2
  export type { Theme, ThemeStore } from "./types";
3
3
  /**
4
- * Hook to manage light/dark theme
4
+ * Hook to manage light/dark theme only using localStorage and no global store
5
5
  * Syncs with localStorage and across components using events
6
6
  */
7
7
  export declare function useTheme(): {
@@ -1,8 +1,15 @@
1
+ import type { Readable } from "node:stream";
1
2
  /**
2
3
  * Read file contents as string
3
4
  * @param filePath
4
5
  * @param encoding
5
6
  * @returns
6
7
  */
7
- export declare const readFile: (filePath: string, encoding?: BufferEncoding) => string;
8
+ export declare const readFile: (filePath: string, encoding?: BufferEncoding) => Promise<string>;
9
+ /**
10
+ * Write a readable stream to a file
11
+ * @param filepath - Path to write the file to
12
+ * @param buffer - Readable stream to write
13
+ */
14
+ export declare const writeBufferToFile: (filepath: string, buffer: Readable | undefined) => Promise<void>;
8
15
  //# sourceMappingURL=file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/server/file.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GACnB,UAAU,MAAM,EAChB,WAAU,cAAwB,KACjC,MAEF,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"}
@@ -3,10 +3,6 @@
3
3
  var dateFns = require('date-fns');
4
4
  var fs = require('fs');
5
5
 
6
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
-
8
- var fs__default = /*#__PURE__*/_interopDefault(fs);
9
-
10
6
  var __defProp = Object.defineProperty;
11
7
  var __export = (target, all) => {
12
8
  for (var name in all)
@@ -601,10 +597,19 @@ var label = (name) => ({
601
597
  // src/server/file.ts
602
598
  var file_exports = {};
603
599
  __export(file_exports, {
604
- readFile: () => readFile
600
+ readFile: () => readFile,
601
+ writeBufferToFile: () => writeBufferToFile
605
602
  });
606
- var readFile = (filePath, encoding = "utf-8") => {
607
- return fs__default.default.readFileSync(filePath, encoding);
603
+ var readFile = async (filePath, encoding = "utf-8") => {
604
+ return fs.promises.readFile(filePath, encoding);
605
+ };
606
+ var writeBufferToFile = async (filepath, buffer) => {
607
+ if (!buffer) return;
608
+ const chunks = [];
609
+ for await (const chunk2 of buffer) {
610
+ chunks.push(chunk2);
611
+ }
612
+ await fs.promises.writeFile(filepath, Buffer.concat(chunks));
608
613
  };
609
614
 
610
615
  exports.Dict = dict_exports;
@@ -1,5 +1,5 @@
1
1
  import { format, formatDistanceToNow, formatISO, isSameYear, isSameMonth, isSameDay, addSeconds, addMinutes, addHours, addDays, addWeeks, addBusinessDays, addMonths, addYears } from 'date-fns';
2
- import fs from 'fs';
2
+ import { promises } from 'fs';
3
3
 
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -595,10 +595,19 @@ var label = (name) => ({
595
595
  // src/server/file.ts
596
596
  var file_exports = {};
597
597
  __export(file_exports, {
598
- readFile: () => readFile
598
+ readFile: () => readFile,
599
+ writeBufferToFile: () => writeBufferToFile
599
600
  });
600
- var readFile = (filePath, encoding = "utf-8") => {
601
- return fs.readFileSync(filePath, encoding);
601
+ var readFile = async (filePath, encoding = "utf-8") => {
602
+ return promises.readFile(filePath, encoding);
603
+ };
604
+ var writeBufferToFile = async (filepath, buffer) => {
605
+ if (!buffer) return;
606
+ const chunks = [];
607
+ for await (const chunk2 of buffer) {
608
+ chunks.push(chunk2);
609
+ }
610
+ await promises.writeFile(filepath, Buffer.concat(chunks));
602
611
  };
603
612
 
604
613
  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 };
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/shared/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,oBAGtB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,GAAI,GAAG,QAAQ,OAAO,EAAE,SAEvC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,QAAQ,OAAO,EAAE,SAExC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,QAAQ,OAAO,EAAE,SAExC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAAI,GAAG,QAAQ,OAAO,EAAE,SAEzC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,SAErC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM;IAChC,iEAAiE;sBAC/C,OAAO,EAAE;IAG3B,+EAA+E;sBAC7D,OAAO,EAAE;IAG3B,iFAAiF;uBAC9D,OAAO,EAAE;IAG5B,iGAAiG;sBAC/E,MAAM;CAGxB,CAAC"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/shared/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,oBAWtB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,GAAI,GAAG,QAAQ,OAAO,EAAE,SAEvC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,QAAQ,OAAO,EAAE,SAExC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,QAAQ,OAAO,EAAE,SAExC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAAI,GAAG,QAAQ,OAAO,EAAE,SAEzC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,SAErC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM;IAChC,iEAAiE;sBAC/C,OAAO,EAAE;IAG3B,+EAA+E;sBAC7D,OAAO,EAAE;IAG3B,iFAAiF;uBAC9D,OAAO,EAAE;IAG5B,iGAAiG;sBAC/E,MAAM;CAGxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qstd",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Standard Block component and utilities library with Panda CSS",
5
5
  "author": "malin1",
6
6
  "license": "MIT",