qstd 0.2.7 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.8] - 2025-11-26
11
+
12
+ ### Changed
13
+
14
+ - Enhanced TypeScript strictness with additional compiler options:
15
+ - `noUncheckedIndexedAccess: true` - Forces checking if array/object access might be undefined
16
+ - `exactOptionalPropertyTypes: true` - Stricter handling of optional properties
17
+ - `noImplicitReturns: true` - All code paths must explicitly return
18
+ - `noFallthroughCasesInSwitch: true` - Prevents switch fallthrough bugs
19
+ - `verbatimModuleSyntax: true` - Stricter import/export syntax
20
+ - `noUncheckedSideEffectImports: true` - Requires explicit side-effect imports
21
+ - `moduleDetection: "force"` - Treats all files as modules
22
+ - Fixed drawer component to comply with stricter TypeScript rules
23
+ - Removed unused `@ts-expect-error` directives in drawer component
24
+
10
25
  ## [0.2.7] - 2025-11-25
11
26
 
12
27
  ### Changed
@@ -87,4 +102,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
87
102
  - React hooks placeholder: useDebounce, useToggle, useLocalStorage
88
103
  - Panda CSS preset placeholder
89
104
  - Block component placeholder
90
-
@@ -60,27 +60,27 @@ __export(dict_exports, {
60
60
  function byteSizeOfObj(o) {
61
61
  const objectList = [];
62
62
  const stack = [o];
63
- const bytes = [0];
63
+ let bytes = 0;
64
64
  while (stack.length) {
65
65
  const value = stack.pop();
66
- if (value == null) bytes[0] += 4;
67
- else if (typeof value === "boolean") bytes[0] += 4;
68
- else if (typeof value === "string") bytes[0] += value.length * 2;
69
- else if (typeof value === "number") bytes[0] += 8;
66
+ if (value == null) bytes += 4;
67
+ else if (typeof value === "boolean") bytes += 4;
68
+ else if (typeof value === "string") bytes += value.length * 2;
69
+ else if (typeof value === "number") bytes += 8;
70
70
  else if (typeof value === "object" && objectList.indexOf(value) === -1) {
71
71
  objectList.push(value);
72
- if (typeof value.byteLength === "number") bytes[0] += value.byteLength;
72
+ if (typeof value.byteLength === "number") bytes += value.byteLength;
73
73
  else if (value[Symbol.iterator]) {
74
74
  for (const v of value) stack.push(v);
75
75
  } else {
76
76
  Object.keys(value).forEach((k) => {
77
- bytes[0] += k.length * 2;
77
+ bytes += k.length * 2;
78
78
  stack.push(value[k]);
79
79
  });
80
80
  }
81
81
  }
82
82
  }
83
- return bytes[0];
83
+ return bytes;
84
84
  }
85
85
  var filter = (r, predicate) => Object.entries(r).reduce(
86
86
  (store, [key, value]) => predicate(value) ? { ...store, [key]: value } : store,
@@ -129,11 +129,11 @@ var omit = (r, paths) => {
129
129
  // src/shared/str.ts
130
130
  var str_exports = {};
131
131
  __export(str_exports, {
132
+ changeCase: () => changeCase,
132
133
  concat: () => concat,
133
134
  countChar: () => countChar,
134
135
  countWords: () => countWords,
135
- createSentences: () => createSentences,
136
- toCase: () => toCase
136
+ createSentences: () => createSentences
137
137
  });
138
138
  var createSentences = (text) => {
139
139
  if (!text) return [];
@@ -154,7 +154,7 @@ var concat = (xs, delimiter) => {
154
154
  var countChar = (str, ch) => {
155
155
  return str.split("").reduce((x, y) => y === ch ? x + 1 : x, 0);
156
156
  };
157
- var toCase = (text, opts) => {
157
+ var changeCase = (text, opts) => {
158
158
  switch (opts.to) {
159
159
  case "title":
160
160
  return text.charAt(0).toUpperCase() + text.slice(1);
@@ -1,4 +1,4 @@
1
- export { d as Dict, f as Flow, i as Int, l as List, a as Log, m as Money, r as Random, s as Str, t as Time } from '../log-DPBPow2d.cjs';
1
+ export { d as Dict, f as Flow, i as Int, l as List, a as Log, m as Money, r as Random, s as Str, t as Time } from '../log-ERvLs2Dx.cjs';
2
2
  import 'date-fns';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- export { d as Dict, f as Flow, i as Int, l as List, a as Log, m as Money, r as Random, s as Str, t as Time } from '../log-DPBPow2d.js';
1
+ export { d as Dict, f as Flow, i as Int, l as List, a as Log, m as Money, r as Random, s as Str, t as Time } from '../log-ERvLs2Dx.js';
2
2
  import 'date-fns';
3
3
 
4
4
  /**
@@ -58,27 +58,27 @@ __export(dict_exports, {
58
58
  function byteSizeOfObj(o) {
59
59
  const objectList = [];
60
60
  const stack = [o];
61
- const bytes = [0];
61
+ let bytes = 0;
62
62
  while (stack.length) {
63
63
  const value = stack.pop();
64
- if (value == null) bytes[0] += 4;
65
- else if (typeof value === "boolean") bytes[0] += 4;
66
- else if (typeof value === "string") bytes[0] += value.length * 2;
67
- else if (typeof value === "number") bytes[0] += 8;
64
+ if (value == null) bytes += 4;
65
+ else if (typeof value === "boolean") bytes += 4;
66
+ else if (typeof value === "string") bytes += value.length * 2;
67
+ else if (typeof value === "number") bytes += 8;
68
68
  else if (typeof value === "object" && objectList.indexOf(value) === -1) {
69
69
  objectList.push(value);
70
- if (typeof value.byteLength === "number") bytes[0] += value.byteLength;
70
+ if (typeof value.byteLength === "number") bytes += value.byteLength;
71
71
  else if (value[Symbol.iterator]) {
72
72
  for (const v of value) stack.push(v);
73
73
  } else {
74
74
  Object.keys(value).forEach((k) => {
75
- bytes[0] += k.length * 2;
75
+ bytes += k.length * 2;
76
76
  stack.push(value[k]);
77
77
  });
78
78
  }
79
79
  }
80
80
  }
81
- return bytes[0];
81
+ return bytes;
82
82
  }
83
83
  var filter = (r, predicate) => Object.entries(r).reduce(
84
84
  (store, [key, value]) => predicate(value) ? { ...store, [key]: value } : store,
@@ -127,11 +127,11 @@ var omit = (r, paths) => {
127
127
  // src/shared/str.ts
128
128
  var str_exports = {};
129
129
  __export(str_exports, {
130
+ changeCase: () => changeCase,
130
131
  concat: () => concat,
131
132
  countChar: () => countChar,
132
133
  countWords: () => countWords,
133
- createSentences: () => createSentences,
134
- toCase: () => toCase
134
+ createSentences: () => createSentences
135
135
  });
136
136
  var createSentences = (text) => {
137
137
  if (!text) return [];
@@ -152,7 +152,7 @@ var concat = (xs, delimiter) => {
152
152
  var countChar = (str, ch) => {
153
153
  return str.split("").reduce((x, y) => y === ch ? x + 1 : x, 0);
154
154
  };
155
- var toCase = (text, opts) => {
155
+ var changeCase = (text, opts) => {
156
156
  switch (opts.to) {
157
157
  case "title":
158
158
  return text.charAt(0).toUpperCase() + text.slice(1);
@@ -140,15 +140,15 @@ declare const countChar: (str: string, ch: string) => number;
140
140
  * @param opts
141
141
  * @returns
142
142
  */
143
- declare const toCase: <T extends string>(text: string, opts: CaseOpts) => string;
143
+ declare const changeCase: <T extends string>(text: string, opts: CaseOpts) => string;
144
144
 
145
+ declare const str_changeCase: typeof changeCase;
145
146
  declare const str_concat: typeof concat;
146
147
  declare const str_countChar: typeof countChar;
147
148
  declare const str_countWords: typeof countWords;
148
149
  declare const str_createSentences: typeof createSentences;
149
- declare const str_toCase: typeof toCase;
150
150
  declare namespace str {
151
- export { str_concat as concat, str_countChar as countChar, str_countWords as countWords, str_createSentences as createSentences, str_toCase as toCase };
151
+ export { str_changeCase as changeCase, str_concat as concat, str_countChar as countChar, str_countWords as countWords, str_createSentences as createSentences };
152
152
  }
153
153
 
154
154
  type Range = {
@@ -195,7 +195,7 @@ declare const formatBytes: (bytes?: number, decimals?: number, binaryUnits?: boo
195
195
  display?: undefined;
196
196
  } | {
197
197
  value: number;
198
- unit: string;
198
+ unit: string | undefined;
199
199
  display: string;
200
200
  };
201
201
 
@@ -256,7 +256,7 @@ type DurationOptions = {
256
256
  * formatDuration(45300, { format: "fractional" }) // "45.3s"
257
257
  * formatDuration(64400, { format: "fractional" }) // "1m 4.4s"
258
258
  */
259
- declare const formatDuration: (ms: number | null, options?: DurationOptions) => string;
259
+ declare const formatDuration: (ms: number | null | undefined, options?: DurationOptions) => string;
260
260
  type DateInput = Date | string | number;
261
261
  type DateFormatStyle = "iso" | "short" | "medium" | "long" | "relative" | "year";
262
262
  type DateOptions = {
@@ -399,7 +399,7 @@ declare namespace flow {
399
399
  * @param xs
400
400
  * @returns
401
401
  */
402
- declare const item: <T>(xs: T[]) => T;
402
+ declare const item: <T>(xs: T[]) => T | undefined;
403
403
  type RandProps = {
404
404
  min?: number;
405
405
  max?: number;
@@ -140,15 +140,15 @@ declare const countChar: (str: string, ch: string) => number;
140
140
  * @param opts
141
141
  * @returns
142
142
  */
143
- declare const toCase: <T extends string>(text: string, opts: CaseOpts) => string;
143
+ declare const changeCase: <T extends string>(text: string, opts: CaseOpts) => string;
144
144
 
145
+ declare const str_changeCase: typeof changeCase;
145
146
  declare const str_concat: typeof concat;
146
147
  declare const str_countChar: typeof countChar;
147
148
  declare const str_countWords: typeof countWords;
148
149
  declare const str_createSentences: typeof createSentences;
149
- declare const str_toCase: typeof toCase;
150
150
  declare namespace str {
151
- export { str_concat as concat, str_countChar as countChar, str_countWords as countWords, str_createSentences as createSentences, str_toCase as toCase };
151
+ export { str_changeCase as changeCase, str_concat as concat, str_countChar as countChar, str_countWords as countWords, str_createSentences as createSentences };
152
152
  }
153
153
 
154
154
  type Range = {
@@ -195,7 +195,7 @@ declare const formatBytes: (bytes?: number, decimals?: number, binaryUnits?: boo
195
195
  display?: undefined;
196
196
  } | {
197
197
  value: number;
198
- unit: string;
198
+ unit: string | undefined;
199
199
  display: string;
200
200
  };
201
201
 
@@ -256,7 +256,7 @@ type DurationOptions = {
256
256
  * formatDuration(45300, { format: "fractional" }) // "45.3s"
257
257
  * formatDuration(64400, { format: "fractional" }) // "1m 4.4s"
258
258
  */
259
- declare const formatDuration: (ms: number | null, options?: DurationOptions) => string;
259
+ declare const formatDuration: (ms: number | null | undefined, options?: DurationOptions) => string;
260
260
  type DateInput = Date | string | number;
261
261
  type DateFormatStyle = "iso" | "short" | "medium" | "long" | "relative" | "year";
262
262
  type DateOptions = {
@@ -399,7 +399,7 @@ declare namespace flow {
399
399
  * @param xs
400
400
  * @returns
401
401
  */
402
- declare const item: <T>(xs: T[]) => T;
402
+ declare const item: <T>(xs: T[]) => T | undefined;
403
403
  type RandProps = {
404
404
  min?: number;
405
405
  max?: number;
@@ -261,12 +261,13 @@ var preset = {
261
261
  cols: {
262
262
  transform(value) {
263
263
  if (typeof value !== "string") return {};
264
- const [templatePart, gapPart] = value.split("/").map((s) => s.trim());
264
+ const [templatePart = "", gapPart] = value.split("/").map((s) => s.trim());
265
265
  const templateWords = templatePart.split(/\s+/);
266
266
  let alignContent = "", gridTemplate = "", columnGap = "";
267
267
  const alignmentValues = ["start", "center", "end"];
268
- if (alignmentValues.includes(templateWords[0])) {
269
- alignContent = templateWords[0];
268
+ const firstWord = templateWords[0];
269
+ if (firstWord && alignmentValues.includes(firstWord)) {
270
+ alignContent = firstWord;
270
271
  if (templateWords.length > 1)
271
272
  gridTemplate = templateWords.slice(1).join(" ");
272
273
  } else gridTemplate = templateWords.join(" ");
@@ -294,11 +295,12 @@ var preset = {
294
295
  rows: {
295
296
  transform(value) {
296
297
  if (typeof value !== "string") return {};
297
- const [templatePart, gapPart] = value.split("/").map((s) => s.trim());
298
+ const [templatePart = "", gapPart] = value.split("/").map((s) => s.trim());
298
299
  const templateWords = templatePart.split(/\s+/);
299
300
  let justifyContent = "", gridTemplate = "", rowGap = "";
300
301
  const justifyValues = ["start", "end", "between", "center"];
301
- const justifyValue = justifyValues.includes(templateWords[0]) ? templateWords[0] : "";
302
+ const firstWord = templateWords[0];
303
+ const justifyValue = firstWord && justifyValues.includes(firstWord) ? firstWord : "";
302
304
  if (justifyValue) {
303
305
  justifyContent = justifyValue === "between" ? "space-between" : justifyValue;
304
306
  if (templateWords.length > 1)
@@ -259,12 +259,13 @@ var preset = {
259
259
  cols: {
260
260
  transform(value) {
261
261
  if (typeof value !== "string") return {};
262
- const [templatePart, gapPart] = value.split("/").map((s) => s.trim());
262
+ const [templatePart = "", gapPart] = value.split("/").map((s) => s.trim());
263
263
  const templateWords = templatePart.split(/\s+/);
264
264
  let alignContent = "", gridTemplate = "", columnGap = "";
265
265
  const alignmentValues = ["start", "center", "end"];
266
- if (alignmentValues.includes(templateWords[0])) {
267
- alignContent = templateWords[0];
266
+ const firstWord = templateWords[0];
267
+ if (firstWord && alignmentValues.includes(firstWord)) {
268
+ alignContent = firstWord;
268
269
  if (templateWords.length > 1)
269
270
  gridTemplate = templateWords.slice(1).join(" ");
270
271
  } else gridTemplate = templateWords.join(" ");
@@ -292,11 +293,12 @@ var preset = {
292
293
  rows: {
293
294
  transform(value) {
294
295
  if (typeof value !== "string") return {};
295
- const [templatePart, gapPart] = value.split("/").map((s) => s.trim());
296
+ const [templatePart = "", gapPart] = value.split("/").map((s) => s.trim());
296
297
  const templateWords = templatePart.split(/\s+/);
297
298
  let justifyContent = "", gridTemplate = "", rowGap = "";
298
299
  const justifyValues = ["start", "end", "between", "center"];
299
- const justifyValue = justifyValues.includes(templateWords[0]) ? templateWords[0] : "";
300
+ const firstWord = templateWords[0];
301
+ const justifyValue = firstWord && justifyValues.includes(firstWord) ? firstWord : "";
300
302
  if (justifyValue) {
301
303
  justifyContent = justifyValue === "between" ? "space-between" : justifyValue;
302
304
  if (templateWords.length > 1)