@superbright/indexeddb-orm 0.1.9 → 1.0.1

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.
Files changed (119) hide show
  1. package/dist/_virtual/_commonjsHelpers.cjs +2 -0
  2. package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
  3. package/dist/_virtual/_commonjsHelpers.mjs +9 -0
  4. package/dist/_virtual/_commonjsHelpers.mjs.map +1 -0
  5. package/dist/_virtual/dexie.min.cjs +2 -0
  6. package/dist/_virtual/dexie.min.cjs.map +1 -0
  7. package/dist/_virtual/dexie.min.mjs +5 -0
  8. package/dist/_virtual/dexie.min.mjs.map +1 -0
  9. package/dist/adapters/dexie.cjs +2 -0
  10. package/dist/adapters/dexie.cjs.map +1 -0
  11. package/dist/adapters/dexie.mjs +14 -0
  12. package/dist/adapters/dexie.mjs.map +1 -0
  13. package/dist/adapters/structured-store.cjs +2 -0
  14. package/dist/adapters/structured-store.cjs.map +1 -0
  15. package/dist/adapters/structured-store.mjs +50 -0
  16. package/dist/adapters/structured-store.mjs.map +1 -0
  17. package/dist/adapters/zustand-store.cjs +2 -0
  18. package/dist/adapters/zustand-store.cjs.map +1 -0
  19. package/dist/adapters/zustand-store.mjs +169 -0
  20. package/dist/adapters/zustand-store.mjs.map +1 -0
  21. package/dist/api/favorites.cjs +2 -0
  22. package/dist/api/favorites.cjs.map +1 -0
  23. package/dist/api/favorites.mjs +34 -0
  24. package/dist/api/favorites.mjs.map +1 -0
  25. package/dist/api/properties.cjs +2 -0
  26. package/dist/api/properties.cjs.map +1 -0
  27. package/dist/api/properties.mjs +197 -0
  28. package/dist/api/properties.mjs.map +1 -0
  29. package/dist/api/users.cjs +2 -0
  30. package/dist/api/users.cjs.map +1 -0
  31. package/dist/api/users.mjs +54 -0
  32. package/dist/api/users.mjs.map +1 -0
  33. package/dist/db.cjs +2 -0
  34. package/dist/db.cjs.map +1 -0
  35. package/dist/db.mjs +116 -0
  36. package/dist/db.mjs.map +1 -0
  37. package/dist/debug.cjs +2 -0
  38. package/dist/debug.cjs.map +1 -0
  39. package/dist/debug.mjs +18 -0
  40. package/dist/debug.mjs.map +1 -0
  41. package/dist/errors.cjs +2 -0
  42. package/dist/errors.cjs.map +1 -0
  43. package/dist/errors.mjs +15 -0
  44. package/dist/errors.mjs.map +1 -0
  45. package/dist/features/analytics/analytics.d.ts +520 -397
  46. package/dist/features/units/transformers.cjs +2 -0
  47. package/dist/features/units/transformers.cjs.map +1 -0
  48. package/dist/features/units/transformers.mjs +69 -0
  49. package/dist/features/units/transformers.mjs.map +1 -0
  50. package/dist/index.cjs +1 -65
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.ts +1 -1
  53. package/dist/index.mjs +72 -14861
  54. package/dist/index.mjs.map +1 -1
  55. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.cjs +4 -0
  56. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.cjs.map +1 -0
  57. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.mjs +3048 -0
  58. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.mjs.map +1 -0
  59. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.cjs +2 -0
  60. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.cjs.map +1 -0
  61. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.mjs +33 -0
  62. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.mjs.map +1 -0
  63. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.cjs +2 -0
  64. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.cjs.map +1 -0
  65. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.mjs +88 -0
  66. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.mjs.map +1 -0
  67. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.cjs +2 -0
  68. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.cjs.map +1 -0
  69. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.mjs +10 -0
  70. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.mjs.map +1 -0
  71. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.cjs +2 -0
  72. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.cjs.map +1 -0
  73. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.mjs +8 -0
  74. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.mjs.map +1 -0
  75. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.cjs +2 -0
  76. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.cjs.map +1 -0
  77. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.mjs +98 -0
  78. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.mjs.map +1 -0
  79. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.cjs +2 -0
  80. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.cjs.map +1 -0
  81. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.mjs +95 -0
  82. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.mjs.map +1 -0
  83. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.cjs +2 -0
  84. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.cjs.map +1 -0
  85. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.mjs +62 -0
  86. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.mjs.map +1 -0
  87. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.cjs +2 -0
  88. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.cjs.map +1 -0
  89. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.mjs +2401 -0
  90. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.mjs.map +1 -0
  91. package/dist/schema.cjs +2 -0
  92. package/dist/schema.cjs.map +1 -0
  93. package/dist/schema.d.ts +165 -0
  94. package/dist/schema.mjs +209 -0
  95. package/dist/schema.mjs.map +1 -0
  96. package/dist/storage.cjs +2 -0
  97. package/dist/storage.cjs.map +1 -0
  98. package/dist/storage.mjs +54 -0
  99. package/dist/storage.mjs.map +1 -0
  100. package/dist/stores/store.cjs +2 -0
  101. package/dist/stores/store.cjs.map +1 -0
  102. package/dist/stores/store.mjs +607 -0
  103. package/dist/stores/store.mjs.map +1 -0
  104. package/dist/units/favorites.cjs +2 -0
  105. package/dist/units/favorites.cjs.map +1 -0
  106. package/dist/units/favorites.mjs +19 -0
  107. package/dist/units/favorites.mjs.map +1 -0
  108. package/dist/utils/casing.d.ts +6 -0
  109. package/dist/utils/collections.d.ts +1 -0
  110. package/dist/utils/dimensions.cjs +2 -0
  111. package/dist/utils/dimensions.cjs.map +1 -0
  112. package/dist/utils/dimensions.d.ts +26 -0
  113. package/dist/utils/dimensions.mjs +26 -0
  114. package/dist/utils/dimensions.mjs.map +1 -0
  115. package/dist/validation.cjs +2 -0
  116. package/dist/validation.cjs.map +1 -0
  117. package/dist/validation.mjs +18 -0
  118. package/dist/validation.mjs.map +1 -0
  119. package/package.json +23 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"favorites.cjs","sources":["../../src/units/favorites.ts"],"sourcesContent":["// src/units/favorites.ts\nimport * as api from \"../api/favorites\";\n\nconst favorites = {\n async isFavorite(propertyId: string | number, unitId: string): Promise<boolean> {\n return api.isUnitFavorited(propertyId, unitId);\n },\n async toggle(propertyId: string | number, unitId: string): Promise<string[]> {\n return api.toggleFavoriteUnit(propertyId, unitId);\n },\n async set(propertyId: string | number, unitId: string, on: boolean): Promise<string[]> {\n return api.setFavoriteUnit(propertyId, unitId, on);\n },\n async getAll(propertyId: string | number): Promise<string[]> {\n return api.getFavoritedUnitsForProperty(propertyId);\n },\n};\n\nexport {favorites}\n"],"names":["favorites","propertyId","unitId","api.isUnitFavorited","api.toggleFavoriteUnit","on","api.setFavoriteUnit","api.getFavoritedUnitsForProperty"],"mappings":"wHAGMA,EAAY,CAChB,MAAM,WAAWC,EAA6BC,EAAkC,CAC9E,OAAOC,EAAAA,gBAAoBF,EAAYC,CAAM,CAC/C,EACA,MAAM,OAAOD,EAA6BC,EAAmC,CAC3E,OAAOE,EAAAA,mBAAuBH,EAAYC,CAAM,CAClD,EACA,MAAM,IAAID,EAA6BC,EAAgBG,EAAgC,CACrF,OAAOC,kBAAoBL,EAAYC,EAAQG,CAAE,CACnD,EACA,MAAM,OAAOJ,EAAgD,CAC3D,OAAOM,EAAAA,6BAAiCN,CAAU,CACpD,CACF"}
@@ -0,0 +1,19 @@
1
+ import { getFavoritedUnitsForProperty as o, setFavoriteUnit as i, toggleFavoriteUnit as n, isUnitFavorited as s } from "../api/favorites.mjs";
2
+ const g = {
3
+ async isFavorite(t, r) {
4
+ return s(t, r);
5
+ },
6
+ async toggle(t, r) {
7
+ return n(t, r);
8
+ },
9
+ async set(t, r, e) {
10
+ return i(t, r, e);
11
+ },
12
+ async getAll(t) {
13
+ return o(t);
14
+ }
15
+ };
16
+ export {
17
+ g as favorites
18
+ };
19
+ //# sourceMappingURL=favorites.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"favorites.mjs","sources":["../../src/units/favorites.ts"],"sourcesContent":["// src/units/favorites.ts\nimport * as api from \"../api/favorites\";\n\nconst favorites = {\n async isFavorite(propertyId: string | number, unitId: string): Promise<boolean> {\n return api.isUnitFavorited(propertyId, unitId);\n },\n async toggle(propertyId: string | number, unitId: string): Promise<string[]> {\n return api.toggleFavoriteUnit(propertyId, unitId);\n },\n async set(propertyId: string | number, unitId: string, on: boolean): Promise<string[]> {\n return api.setFavoriteUnit(propertyId, unitId, on);\n },\n async getAll(propertyId: string | number): Promise<string[]> {\n return api.getFavoritedUnitsForProperty(propertyId);\n },\n};\n\nexport {favorites}\n"],"names":["favorites","propertyId","unitId","api.isUnitFavorited","api.toggleFavoriteUnit","on","api.setFavoriteUnit","api.getFavoritedUnitsForProperty"],"mappings":";AAGA,MAAMA,IAAY;AAAA,EAChB,MAAM,WAAWC,GAA6BC,GAAkC;AAC9E,WAAOC,EAAoBF,GAAYC,CAAM;AAAA,EAC/C;AAAA,EACA,MAAM,OAAOD,GAA6BC,GAAmC;AAC3E,WAAOE,EAAuBH,GAAYC,CAAM;AAAA,EAClD;AAAA,EACA,MAAM,IAAID,GAA6BC,GAAgBG,GAAgC;AACrF,WAAOC,EAAoBL,GAAYC,GAAQG,CAAE;AAAA,EACnD;AAAA,EACA,MAAM,OAAOJ,GAAgD;AAC3D,WAAOM,EAAiCN,CAAU;AAAA,EACpD;AACF;"}
@@ -0,0 +1,6 @@
1
+ declare const toSnakeCase: (input: string) => string;
2
+ declare const toCamelCase: (input: string) => string;
3
+ declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
4
+ export declare const convertKeysToSnakeCase: (value: unknown) => unknown;
5
+ export declare const convertKeysToCamelCase: (value: unknown) => unknown;
6
+ export { toSnakeCase, toCamelCase, isPlainObject };
@@ -0,0 +1 @@
1
+ export declare const normalizeToStringArray: (input: unknown) => string[];
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=25.4;function m(t,n=1,i=!1){const e=t/f,o=Math.max(0,n),s=Math.pow(10,o),r=Math.round(e*s)/s;return i?`${r}"`:r}function h(t){return t*f}function p(t){var c,u,l,a;if(typeof t!="string")return null;let n=t.trim();if(!n)return null;n=n.replace(/[’′‵`]/g,"'").replace(/[”″˝❞]/g,'"').toLowerCase();const i=/^(?:\s*(?<feet>\d+(?:\.\d+)?)\s*(?:'|ft|feet))?\s*(?:\s*(?<inches>\d+(?:\.\d+)?)\s*(?:\"|in\b|inch(?:es)?\b))?\s*$/i,e=n.match(i);if(!e||!((c=e.groups)!=null&&c.feet)&&!((u=e.groups)!=null&&u.inches))return null;const o=(l=e.groups)!=null&&l.feet?parseFloat(e.groups.feet):0,s=(a=e.groups)!=null&&a.inches?parseFloat(e.groups.inches):0;if(!isFinite(o)||!isFinite(s))return null;const r=o*12+s;return h(r)}exports.imperialToMm=p;exports.inchesToMm=h;exports.mmToInches=m;
2
+ //# sourceMappingURL=dimensions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dimensions.cjs","sources":["../../src/utils/dimensions.ts"],"sourcesContent":["/**\n * Units + formatting helpers for converting millimeters to US customary units.\n */\n\nconst MM_PER_INCH = 25.4;\n// Note: feet/inches helpers removed to keep API minimal\n\n/**\n * Convert millimeters to inches.\n * @param mm - Value in millimeters\n * @param precision - Optional decimal places to round to (no rounding if undefined)\n */\nexport function mmToInches(mm: number, precision: number = 1, appendSymbol = false): number | string {\n const inches = mm / MM_PER_INCH;\n const p = Math.max(0, precision);\n const factor = Math.pow(10, p);\n const value = Math.round(inches * factor) / factor;\n return appendSymbol ? `${value}\\\"` : value;\n}\n\n// Feet/inches helpers were intentionally removed. Use mmToInches with append flag for display.\n\n/**\n * Convert inches to millimeters.\n * Always returns the full-precision value without rounding.\n * @param inches - Value in inches\n */\nexport function inchesToMm(inches: number): number {\n return inches * MM_PER_INCH;\n}\n\n/**\n * Parse a human-entered imperial dimension like:\n * - 15' 4\" (feet and inches with symbols)\n * - 6ft 2in (text units)\n * - 72\" (inches only)\n * - 10' (feet only)\n * and convert it to millimeters.\n *\n * Returns null when the input doesn't contain recognizable feet/inches values.\n */\nexport function imperialToMm(input: string): number | null {\n if (typeof input !== 'string') return null;\n let s = input.trim();\n if (!s) return null;\n\n // Normalize various quote characters to plain ASCII ' and \"\n s = s\n .replace(/[’′‵`]/g, \"'\") // single-quote variants\n .replace(/[”″˝❞]/g, '\"') // double-quote variants\n .toLowerCase();\n\n // Regex to capture optional feet and inches components (decimals allowed)\n // Examples matched: 15' 4\", 6ft 2in, 72\", 10'\n const re = /^(?:\\s*(?<feet>\\d+(?:\\.\\d+)?)\\s*(?:'|ft|feet))?\\s*(?:\\s*(?<inches>\\d+(?:\\.\\d+)?)\\s*(?:\\\"|in\\b|inch(?:es)?\\b))?\\s*$/i;\n const m = s.match(re);\n if (!m || (!m.groups?.feet && !m.groups?.inches)) return null;\n\n const feet = m.groups?.feet ? parseFloat(m.groups.feet) : 0;\n const inches = m.groups?.inches ? parseFloat(m.groups.inches) : 0;\n if (!isFinite(feet) || !isFinite(inches)) return null;\n\n const totalInches = feet * 12 + inches;\n return inchesToMm(totalInches);\n}\n"],"names":["MM_PER_INCH","mmToInches","mm","precision","appendSymbol","inches","p","factor","value","inchesToMm","imperialToMm","input","s","re","m","_a","_b","feet","_c","_d","totalInches"],"mappings":"gFAIA,MAAMA,EAAc,KAQb,SAASC,EAAWC,EAAYC,EAAoB,EAAGC,EAAe,GAAwB,CACnG,MAAMC,EAASH,EAAKF,EACdM,EAAI,KAAK,IAAI,EAAGH,CAAS,EACzBI,EAAS,KAAK,IAAI,GAAID,CAAC,EACvBE,EAAQ,KAAK,MAAMH,EAASE,CAAM,EAAIA,EAC5C,OAAOH,EAAe,GAAGI,CAAK,IAAOA,CACvC,CASO,SAASC,EAAWJ,EAAwB,CACjD,OAAOA,EAASL,CAClB,CAYO,SAASU,EAAaC,EAA8B,aACzD,GAAI,OAAOA,GAAU,SAAU,OAAO,KACtC,IAAIC,EAAID,EAAM,KAAA,EACd,GAAI,CAACC,EAAG,OAAO,KAGfA,EAAIA,EACD,QAAQ,UAAW,GAAG,EACtB,QAAQ,UAAW,GAAG,EACtB,YAAA,EAIH,MAAMC,EAAK,sHACLC,EAAIF,EAAE,MAAMC,CAAE,EACpB,GAAI,CAACC,GAAM,GAACC,EAAAD,EAAE,SAAF,MAAAC,EAAU,OAAQ,GAACC,EAAAF,EAAE,SAAF,MAAAE,EAAU,QAAS,OAAO,KAEzD,MAAMC,GAAOC,EAAAJ,EAAE,SAAF,MAAAI,EAAU,KAAO,WAAWJ,EAAE,OAAO,IAAI,EAAI,EACpDT,GAASc,EAAAL,EAAE,SAAF,MAAAK,EAAU,OAAS,WAAWL,EAAE,OAAO,MAAM,EAAI,EAChE,GAAI,CAAC,SAASG,CAAI,GAAK,CAAC,SAASZ,CAAM,EAAG,OAAO,KAEjD,MAAMe,EAAcH,EAAO,GAAKZ,EAChC,OAAOI,EAAWW,CAAW,CAC/B"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Units + formatting helpers for converting millimeters to US customary units.
3
+ */
4
+ /**
5
+ * Convert millimeters to inches.
6
+ * @param mm - Value in millimeters
7
+ * @param precision - Optional decimal places to round to (no rounding if undefined)
8
+ */
9
+ export declare function mmToInches(mm: number, precision?: number, appendSymbol?: boolean): number | string;
10
+ /**
11
+ * Convert inches to millimeters.
12
+ * Always returns the full-precision value without rounding.
13
+ * @param inches - Value in inches
14
+ */
15
+ export declare function inchesToMm(inches: number): number;
16
+ /**
17
+ * Parse a human-entered imperial dimension like:
18
+ * - 15' 4" (feet and inches with symbols)
19
+ * - 6ft 2in (text units)
20
+ * - 72" (inches only)
21
+ * - 10' (feet only)
22
+ * and convert it to millimeters.
23
+ *
24
+ * Returns null when the input doesn't contain recognizable feet/inches values.
25
+ */
26
+ export declare function imperialToMm(input: string): number | null;
@@ -0,0 +1,26 @@
1
+ function h(t, n = 1, c = !1) {
2
+ const e = t / 25.4, o = Math.max(0, n), s = Math.pow(10, o), r = Math.round(e * s) / s;
3
+ return c ? `${r}"` : r;
4
+ }
5
+ function l(t) {
6
+ return t * 25.4;
7
+ }
8
+ function p(t) {
9
+ var i, u, a, f;
10
+ if (typeof t != "string") return null;
11
+ let n = t.trim();
12
+ if (!n) return null;
13
+ n = n.replace(/[’′‵`]/g, "'").replace(/[”″˝❞]/g, '"').toLowerCase();
14
+ const c = /^(?:\s*(?<feet>\d+(?:\.\d+)?)\s*(?:'|ft|feet))?\s*(?:\s*(?<inches>\d+(?:\.\d+)?)\s*(?:\"|in\b|inch(?:es)?\b))?\s*$/i, e = n.match(c);
15
+ if (!e || !((i = e.groups) != null && i.feet) && !((u = e.groups) != null && u.inches)) return null;
16
+ const o = (a = e.groups) != null && a.feet ? parseFloat(e.groups.feet) : 0, s = (f = e.groups) != null && f.inches ? parseFloat(e.groups.inches) : 0;
17
+ if (!isFinite(o) || !isFinite(s)) return null;
18
+ const r = o * 12 + s;
19
+ return l(r);
20
+ }
21
+ export {
22
+ p as imperialToMm,
23
+ l as inchesToMm,
24
+ h as mmToInches
25
+ };
26
+ //# sourceMappingURL=dimensions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dimensions.mjs","sources":["../../src/utils/dimensions.ts"],"sourcesContent":["/**\n * Units + formatting helpers for converting millimeters to US customary units.\n */\n\nconst MM_PER_INCH = 25.4;\n// Note: feet/inches helpers removed to keep API minimal\n\n/**\n * Convert millimeters to inches.\n * @param mm - Value in millimeters\n * @param precision - Optional decimal places to round to (no rounding if undefined)\n */\nexport function mmToInches(mm: number, precision: number = 1, appendSymbol = false): number | string {\n const inches = mm / MM_PER_INCH;\n const p = Math.max(0, precision);\n const factor = Math.pow(10, p);\n const value = Math.round(inches * factor) / factor;\n return appendSymbol ? `${value}\\\"` : value;\n}\n\n// Feet/inches helpers were intentionally removed. Use mmToInches with append flag for display.\n\n/**\n * Convert inches to millimeters.\n * Always returns the full-precision value without rounding.\n * @param inches - Value in inches\n */\nexport function inchesToMm(inches: number): number {\n return inches * MM_PER_INCH;\n}\n\n/**\n * Parse a human-entered imperial dimension like:\n * - 15' 4\" (feet and inches with symbols)\n * - 6ft 2in (text units)\n * - 72\" (inches only)\n * - 10' (feet only)\n * and convert it to millimeters.\n *\n * Returns null when the input doesn't contain recognizable feet/inches values.\n */\nexport function imperialToMm(input: string): number | null {\n if (typeof input !== 'string') return null;\n let s = input.trim();\n if (!s) return null;\n\n // Normalize various quote characters to plain ASCII ' and \"\n s = s\n .replace(/[’′‵`]/g, \"'\") // single-quote variants\n .replace(/[”″˝❞]/g, '\"') // double-quote variants\n .toLowerCase();\n\n // Regex to capture optional feet and inches components (decimals allowed)\n // Examples matched: 15' 4\", 6ft 2in, 72\", 10'\n const re = /^(?:\\s*(?<feet>\\d+(?:\\.\\d+)?)\\s*(?:'|ft|feet))?\\s*(?:\\s*(?<inches>\\d+(?:\\.\\d+)?)\\s*(?:\\\"|in\\b|inch(?:es)?\\b))?\\s*$/i;\n const m = s.match(re);\n if (!m || (!m.groups?.feet && !m.groups?.inches)) return null;\n\n const feet = m.groups?.feet ? parseFloat(m.groups.feet) : 0;\n const inches = m.groups?.inches ? parseFloat(m.groups.inches) : 0;\n if (!isFinite(feet) || !isFinite(inches)) return null;\n\n const totalInches = feet * 12 + inches;\n return inchesToMm(totalInches);\n}\n"],"names":["mmToInches","mm","precision","appendSymbol","inches","p","factor","value","inchesToMm","imperialToMm","input","_a","_b","_c","_d","s","re","m","feet","totalInches"],"mappings":"AAYO,SAASA,EAAWC,GAAYC,IAAoB,GAAGC,IAAe,IAAwB;AACnG,QAAMC,IAASH,IAAK,MACdI,IAAI,KAAK,IAAI,GAAGH,CAAS,GACzBI,IAAS,KAAK,IAAI,IAAID,CAAC,GACvBE,IAAQ,KAAK,MAAMH,IAASE,CAAM,IAAIA;AAC5C,SAAOH,IAAe,GAAGI,CAAK,MAAOA;AACvC;AASO,SAASC,EAAWJ,GAAwB;AACjD,SAAOA,IAAS;AAClB;AAYO,SAASK,EAAaC,GAA8B;AArC3D,MAAAC,GAAAC,GAAAC,GAAAC;AAsCE,MAAI,OAAOJ,KAAU,SAAU,QAAO;AACtC,MAAIK,IAAIL,EAAM,KAAA;AACd,MAAI,CAACK,EAAG,QAAO;AAGf,EAAAA,IAAIA,EACD,QAAQ,WAAW,GAAG,EACtB,QAAQ,WAAW,GAAG,EACtB,YAAA;AAIH,QAAMC,IAAK,uHACLC,IAAIF,EAAE,MAAMC,CAAE;AACpB,MAAI,CAACC,KAAM,GAACN,IAAAM,EAAE,WAAF,QAAAN,EAAU,SAAQ,GAACC,IAAAK,EAAE,WAAF,QAAAL,EAAU,QAAS,QAAO;AAEzD,QAAMM,KAAOL,IAAAI,EAAE,WAAF,QAAAJ,EAAU,OAAO,WAAWI,EAAE,OAAO,IAAI,IAAI,GACpDb,KAASU,IAAAG,EAAE,WAAF,QAAAH,EAAU,SAAS,WAAWG,EAAE,OAAO,MAAM,IAAI;AAChE,MAAI,CAAC,SAASC,CAAI,KAAK,CAAC,SAASd,CAAM,EAAG,QAAO;AAEjD,QAAMe,IAAcD,IAAO,KAAKd;AAChC,SAAOI,EAAWW,CAAW;AAC/B;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./errors.cjs");let n="strict",r;function c(e){e.mode&&(n=e.mode),r=e.onIssue}function l(e,o,t){const i=e.safeParse(o);if(i.success)return i.data;const a=i.error.flatten();if(r==null||r(t,a),n==="strict")throw new s.SchemaMismatchError(`ORM schema mismatch in ${t}`,a);return n==="warn"&&console.warn(`ORM schema mismatch in ${t}`,a),null}exports.configureValidation=c;exports.validate=l;
2
+ //# sourceMappingURL=validation.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.cjs","sources":["../src/validation.ts"],"sourcesContent":["// src/validation.ts\nimport type { z } from \"zod\";\nimport { SchemaMismatchError } from \"./errors\";\n\nexport type ValidationMode = \"strict\" | \"warn\" | \"silent\";\nlet mode: ValidationMode = \"strict\";\nlet onIssue: ((ctx: string, details: unknown) => void) | undefined;\n\nexport function configureValidation(opts: {\n mode?: ValidationMode;\n onIssue?: (ctx: string, details: unknown) => void;\n}) {\n if (opts.mode) mode = opts.mode;\n onIssue = opts.onIssue;\n}\n\nexport function validate<T>(\n schema: z.ZodType<T>,\n value: unknown,\n ctx: string,\n): T | null {\n const res = schema.safeParse(value);\n if (res.success) return res.data;\n\n const details = res.error.flatten();\n onIssue?.(ctx, details);\n\n if (mode === \"strict\")\n throw new SchemaMismatchError(`ORM schema mismatch in ${ctx}`, details);\n if (mode === \"warn\") console.warn(`ORM schema mismatch in ${ctx}`, details); // eslint-disable-line no-console\n return null; // silent/warn → let caller decide how to proceed\n}\n"],"names":["mode","onIssue","configureValidation","opts","validate","schema","value","ctx","res","details","SchemaMismatchError"],"mappings":"gHAKA,IAAIA,EAAuB,SACvBC,EAEG,SAASC,EAAoBC,EAGjC,CACGA,EAAK,OAAMH,EAAOG,EAAK,MAC3BF,EAAUE,EAAK,OACjB,CAEO,SAASC,EACdC,EACAC,EACAC,EACU,CACV,MAAMC,EAAMH,EAAO,UAAUC,CAAK,EAClC,GAAIE,EAAI,QAAS,OAAOA,EAAI,KAE5B,MAAMC,EAAUD,EAAI,MAAM,QAAA,EAG1B,GAFAP,GAAA,MAAAA,EAAUM,EAAKE,GAEXT,IAAS,SACX,MAAM,IAAIU,EAAAA,oBAAoB,0BAA0BH,CAAG,GAAIE,CAAO,EACxE,OAAIT,IAAS,QAAQ,QAAQ,KAAK,0BAA0BO,CAAG,GAAIE,CAAO,EACnE,IACT"}
@@ -0,0 +1,18 @@
1
+ import { SchemaMismatchError as s } from "./errors.mjs";
2
+ let n = "strict", r;
3
+ function m(e) {
4
+ e.mode && (n = e.mode), r = e.onIssue;
5
+ }
6
+ function f(e, o, t) {
7
+ const i = e.safeParse(o);
8
+ if (i.success) return i.data;
9
+ const a = i.error.flatten();
10
+ if (r == null || r(t, a), n === "strict")
11
+ throw new s(`ORM schema mismatch in ${t}`, a);
12
+ return n === "warn" && console.warn(`ORM schema mismatch in ${t}`, a), null;
13
+ }
14
+ export {
15
+ m as configureValidation,
16
+ f as validate
17
+ };
18
+ //# sourceMappingURL=validation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.mjs","sources":["../src/validation.ts"],"sourcesContent":["// src/validation.ts\nimport type { z } from \"zod\";\nimport { SchemaMismatchError } from \"./errors\";\n\nexport type ValidationMode = \"strict\" | \"warn\" | \"silent\";\nlet mode: ValidationMode = \"strict\";\nlet onIssue: ((ctx: string, details: unknown) => void) | undefined;\n\nexport function configureValidation(opts: {\n mode?: ValidationMode;\n onIssue?: (ctx: string, details: unknown) => void;\n}) {\n if (opts.mode) mode = opts.mode;\n onIssue = opts.onIssue;\n}\n\nexport function validate<T>(\n schema: z.ZodType<T>,\n value: unknown,\n ctx: string,\n): T | null {\n const res = schema.safeParse(value);\n if (res.success) return res.data;\n\n const details = res.error.flatten();\n onIssue?.(ctx, details);\n\n if (mode === \"strict\")\n throw new SchemaMismatchError(`ORM schema mismatch in ${ctx}`, details);\n if (mode === \"warn\") console.warn(`ORM schema mismatch in ${ctx}`, details); // eslint-disable-line no-console\n return null; // silent/warn → let caller decide how to proceed\n}\n"],"names":["mode","onIssue","configureValidation","opts","validate","schema","value","ctx","res","details","SchemaMismatchError"],"mappings":";AAKA,IAAIA,IAAuB,UACvBC;AAEG,SAASC,EAAoBC,GAGjC;AACD,EAAIA,EAAK,SAAMH,IAAOG,EAAK,OAC3BF,IAAUE,EAAK;AACjB;AAEO,SAASC,EACdC,GACAC,GACAC,GACU;AACV,QAAMC,IAAMH,EAAO,UAAUC,CAAK;AAClC,MAAIE,EAAI,QAAS,QAAOA,EAAI;AAE5B,QAAMC,IAAUD,EAAI,MAAM,QAAA;AAG1B,MAFAP,KAAA,QAAAA,EAAUM,GAAKE,IAEXT,MAAS;AACX,UAAM,IAAIU,EAAoB,0BAA0BH,CAAG,IAAIE,CAAO;AACxE,SAAIT,MAAS,UAAQ,QAAQ,KAAK,0BAA0BO,CAAG,IAAIE,CAAO,GACnE;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superbright/indexeddb-orm",
3
- "version": "0.1.9",
3
+ "version": "1.0.1",
4
4
  "description": "Vite + TypeScript starter for an IndexedDB ORM (Dexie + Zod) with playground.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -12,6 +12,16 @@
12
12
  "types": "./dist/index.d.ts",
13
13
  "import": "./dist/index.mjs",
14
14
  "require": "./dist/index.cjs"
15
+ },
16
+ "./utils/dimensions": {
17
+ "types": "./dist/utils/dimensions.d.ts",
18
+ "import": "./dist/utils/dimensions.mjs",
19
+ "require": "./dist/utils/dimensions.cjs"
20
+ },
21
+ "./analytics": {
22
+ "types": "./dist/features/analytics/index.d.ts",
23
+ "import": "./dist/features/analytics/index.mjs",
24
+ "require": "./dist/features/analytics/index.cjs"
15
25
  }
16
26
  },
17
27
  "sideEffects": false,
@@ -20,7 +30,6 @@
20
30
  ],
21
31
  "dependencies": {
22
32
  "dexie": "^4.0.8",
23
- "mixpanel-browser": "^2.67.0",
24
33
  "zod": "^3.23.8"
25
34
  },
26
35
  "devDependencies": {
@@ -29,6 +38,7 @@
29
38
  "concurrently": "^9.0.0",
30
39
  "docusaurus-plugin-typedoc": "^1.4.2",
31
40
  "fake-indexeddb": "^5.0.2",
41
+ "mixpanel-browser": "^2.67.0",
32
42
  "prettier": "^3.6.2",
33
43
  "prettier-plugin-packagejson": "^2.5.19",
34
44
  "react": "^18.3.1",
@@ -37,11 +47,18 @@
37
47
  "typedoc-plugin-markdown": "^4.9.0",
38
48
  "typescript": "^5.4.5",
39
49
  "vite": "^5.4.0",
50
+ "vite-bundle-analyzer": "^1.2.3",
40
51
  "vitest": "^2.0.5",
41
52
  "zustand": "^5.0.8"
42
53
  },
43
54
  "peerDependencies": {
44
- "react": "^18.0.0"
55
+ "react": "^18.0.0",
56
+ "mixpanel-browser": "^2.67.0"
57
+ },
58
+ "peerDependenciesMeta": {
59
+ "mixpanel-browser": {
60
+ "optional": true
61
+ }
45
62
  },
46
63
  "scripts": {
47
64
  "clean": "rimraf dist",
@@ -55,6 +72,8 @@
55
72
  "test:watch": "vitest",
56
73
  "format": "pnpm format:write",
57
74
  "format:write": "prettier --write .",
58
- "format:check": "prettier --check ."
75
+ "format:check": "prettier --check .",
76
+ "docs:api": "typedoc --plugin typedoc-plugin-markdown --entryPoints src/docs/property.ts src/docs/unit.ts src/docs/filters.ts --tsconfig tsconfig.json --out autodocs/docs/api/schema --readme none",
77
+ "analyze": "pnpm clean && ANALYZE=1 vite build && tsc -p tsconfig.build.json"
59
78
  }
60
79
  }