asterui 0.10.3 → 0.12.0

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 (317) hide show
  1. package/README.md +1 -100
  2. package/dist/components/Anchor.d.ts +45 -0
  3. package/dist/components/Diff.d.ts +12 -0
  4. package/dist/components/Kbd.d.ts +8 -0
  5. package/dist/components/Segmented.d.ts +37 -0
  6. package/dist/components/TextRotate.d.ts +13 -0
  7. package/dist/components/Tour.d.ts +61 -0
  8. package/dist/hooks/useClickOutside.d.ts +17 -0
  9. package/dist/hooks/useClipboard.d.ts +20 -0
  10. package/dist/hooks/useDebounce.d.ts +18 -0
  11. package/dist/hooks/useDisclosure.d.ts +20 -0
  12. package/dist/hooks/useHover.d.ts +18 -0
  13. package/dist/hooks/useKeyPress.d.ts +40 -0
  14. package/dist/hooks/useLocalStorage.d.ts +12 -0
  15. package/dist/hooks/usePrevious.d.ts +15 -0
  16. package/dist/hooks/useWindowSize.d.ts +21 -0
  17. package/dist/index.d.ts +26 -0
  18. package/dist/index.js +205 -174
  19. package/dist/index.js.map +1 -1
  20. package/dist/index10.js +92 -30
  21. package/dist/index10.js.map +1 -1
  22. package/dist/index100.js +12 -20
  23. package/dist/index100.js.map +1 -1
  24. package/dist/index101.js +29 -22
  25. package/dist/index101.js.map +1 -1
  26. package/dist/index102.js +17 -19
  27. package/dist/index102.js.map +1 -1
  28. package/dist/index103.js +10788 -95
  29. package/dist/index103.js.map +1 -1
  30. package/dist/index104.js +5 -360
  31. package/dist/index104.js.map +1 -1
  32. package/dist/index105.js +40 -23
  33. package/dist/index105.js.map +1 -1
  34. package/dist/index106.js +2 -73
  35. package/dist/index106.js.map +1 -1
  36. package/dist/index107.js +6 -15
  37. package/dist/index107.js.map +1 -1
  38. package/dist/index108.js +147 -61
  39. package/dist/index108.js.map +1 -1
  40. package/dist/index109.js +26 -140
  41. package/dist/index109.js.map +1 -1
  42. package/dist/index11.js +28 -263
  43. package/dist/index11.js.map +1 -1
  44. package/dist/index110.js +30 -2
  45. package/dist/index110.js.map +1 -1
  46. package/dist/index111.js +2 -56
  47. package/dist/index111.js.map +1 -1
  48. package/dist/index112.js +72 -2
  49. package/dist/index112.js.map +1 -1
  50. package/dist/index113.js +39 -2
  51. package/dist/index113.js.map +1 -1
  52. package/dist/index114.js +26 -2
  53. package/dist/index114.js.map +1 -1
  54. package/dist/index115.js +21 -2
  55. package/dist/index115.js.map +1 -1
  56. package/dist/index116.js +24 -2
  57. package/dist/index116.js.map +1 -1
  58. package/dist/index117.js +20 -2
  59. package/dist/index117.js.map +1 -1
  60. package/dist/index118.js +100 -2
  61. package/dist/index118.js.map +1 -1
  62. package/dist/index119.js +359 -31
  63. package/dist/index119.js.map +1 -1
  64. package/dist/index12.js +259 -89
  65. package/dist/index12.js.map +1 -1
  66. package/dist/index120.js +25 -2
  67. package/dist/index120.js.map +1 -1
  68. package/dist/index121.js +72 -7
  69. package/dist/index121.js.map +1 -1
  70. package/dist/index122.js +16 -2
  71. package/dist/index122.js.map +1 -1
  72. package/dist/index123.js +66 -2
  73. package/dist/index123.js.map +1 -1
  74. package/dist/index124.js +143 -20
  75. package/dist/index124.js.map +1 -1
  76. package/dist/index125.js +2 -2
  77. package/dist/index126.js +55 -23
  78. package/dist/index126.js.map +1 -1
  79. package/dist/index127.js +2 -71
  80. package/dist/index127.js.map +1 -1
  81. package/dist/index128.js +2 -21
  82. package/dist/index128.js.map +1 -1
  83. package/dist/index129.js +2 -34
  84. package/dist/index129.js.map +1 -1
  85. package/dist/index13.js +90 -153
  86. package/dist/index13.js.map +1 -1
  87. package/dist/index130.js +2 -70
  88. package/dist/index130.js.map +1 -1
  89. package/dist/index131.js +2 -2
  90. package/dist/index132.js +2 -2
  91. package/dist/index133.js +2 -22
  92. package/dist/index133.js.map +1 -1
  93. package/dist/index134.js +2 -2
  94. package/dist/index135.js +32 -2
  95. package/dist/index135.js.map +1 -1
  96. package/dist/index136.js +2 -2
  97. package/dist/index137.js +8 -2
  98. package/dist/index137.js.map +1 -1
  99. package/dist/index138.js +2 -4
  100. package/dist/index138.js.map +1 -1
  101. package/dist/index139.js +5 -0
  102. package/dist/index139.js.map +1 -0
  103. package/dist/index14.js +154 -146
  104. package/dist/index14.js.map +1 -1
  105. package/dist/index140.js +24 -0
  106. package/dist/index140.js.map +1 -0
  107. package/dist/index141.js +5 -0
  108. package/dist/index141.js.map +1 -0
  109. package/dist/index142.js +27 -0
  110. package/dist/index142.js.map +1 -0
  111. package/dist/index143.js +74 -0
  112. package/dist/index143.js.map +1 -0
  113. package/dist/index144.js +24 -0
  114. package/dist/index144.js.map +1 -0
  115. package/dist/index145.js +37 -0
  116. package/dist/index145.js.map +1 -0
  117. package/dist/index146.js +73 -0
  118. package/dist/index146.js.map +1 -0
  119. package/dist/index147.js +5 -0
  120. package/dist/index147.js.map +1 -0
  121. package/dist/index148.js +25 -0
  122. package/dist/index148.js.map +1 -0
  123. package/dist/index149.js +5 -0
  124. package/dist/index149.js.map +1 -0
  125. package/dist/index15.js +150 -5
  126. package/dist/index15.js.map +1 -1
  127. package/dist/index150.js +5 -0
  128. package/dist/index150.js.map +1 -0
  129. package/dist/index151.js +5 -0
  130. package/dist/index151.js.map +1 -0
  131. package/dist/index152.js +5 -0
  132. package/dist/index152.js.map +1 -0
  133. package/dist/index153.js +7 -0
  134. package/dist/index153.js.map +1 -0
  135. package/dist/index16.js +5 -71
  136. package/dist/index16.js.map +1 -1
  137. package/dist/index17.js +71 -17
  138. package/dist/index17.js.map +1 -1
  139. package/dist/index18.js +15 -96
  140. package/dist/index18.js.map +1 -1
  141. package/dist/index19.js +89 -105
  142. package/dist/index19.js.map +1 -1
  143. package/dist/index20.js +107 -177
  144. package/dist/index20.js.map +1 -1
  145. package/dist/index21.js +181 -107
  146. package/dist/index21.js.map +1 -1
  147. package/dist/index22.js +107 -29
  148. package/dist/index22.js.map +1 -1
  149. package/dist/index23.js +19 -41
  150. package/dist/index23.js.map +1 -1
  151. package/dist/index24.js +31 -11
  152. package/dist/index24.js.map +1 -1
  153. package/dist/index25.js +41 -33
  154. package/dist/index25.js.map +1 -1
  155. package/dist/index26.js +12 -63
  156. package/dist/index26.js.map +1 -1
  157. package/dist/index27.js +33 -80
  158. package/dist/index27.js.map +1 -1
  159. package/dist/index28.js +63 -18
  160. package/dist/index28.js.map +1 -1
  161. package/dist/index29.js +78 -159
  162. package/dist/index29.js.map +1 -1
  163. package/dist/index3.js +96 -27
  164. package/dist/index3.js.map +1 -1
  165. package/dist/index30.js +16 -1080
  166. package/dist/index30.js.map +1 -1
  167. package/dist/index31.js +159 -16
  168. package/dist/index31.js.map +1 -1
  169. package/dist/index32.js +1081 -121
  170. package/dist/index32.js.map +1 -1
  171. package/dist/index33.js +17 -39
  172. package/dist/index33.js.map +1 -1
  173. package/dist/index34.js +121 -190
  174. package/dist/index34.js.map +1 -1
  175. package/dist/index35.js +37 -94
  176. package/dist/index35.js.map +1 -1
  177. package/dist/index36.js +186 -157
  178. package/dist/index36.js.map +1 -1
  179. package/dist/index37.js +89 -138
  180. package/dist/index37.js.map +1 -1
  181. package/dist/index38.js +161 -14
  182. package/dist/index38.js.map +1 -1
  183. package/dist/index39.js +146 -21
  184. package/dist/index39.js.map +1 -1
  185. package/dist/index4.js +26 -99
  186. package/dist/index4.js.map +1 -1
  187. package/dist/index40.js +12 -116
  188. package/dist/index40.js.map +1 -1
  189. package/dist/index41.js +18 -13
  190. package/dist/index41.js.map +1 -1
  191. package/dist/index42.js +21 -35
  192. package/dist/index42.js.map +1 -1
  193. package/dist/index43.js +117 -114
  194. package/dist/index43.js.map +1 -1
  195. package/dist/index44.js +13 -176
  196. package/dist/index44.js.map +1 -1
  197. package/dist/index45.js +34 -146
  198. package/dist/index45.js.map +1 -1
  199. package/dist/index46.js +116 -12
  200. package/dist/index46.js.map +1 -1
  201. package/dist/index47.js +176 -22
  202. package/dist/index47.js.map +1 -1
  203. package/dist/index48.js +147 -14
  204. package/dist/index48.js.map +1 -1
  205. package/dist/index49.js +10 -5
  206. package/dist/index49.js.map +1 -1
  207. package/dist/index5.js +100 -60
  208. package/dist/index5.js.map +1 -1
  209. package/dist/index50.js +21 -265
  210. package/dist/index50.js.map +1 -1
  211. package/dist/index51.js +10 -13
  212. package/dist/index51.js.map +1 -1
  213. package/dist/index52.js +7 -122
  214. package/dist/index52.js.map +1 -1
  215. package/dist/index53.js +262 -106
  216. package/dist/index53.js.map +1 -1
  217. package/dist/index54.js +14 -167
  218. package/dist/index54.js.map +1 -1
  219. package/dist/index55.js +121 -31
  220. package/dist/index55.js.map +1 -1
  221. package/dist/index56.js +107 -119
  222. package/dist/index56.js.map +1 -1
  223. package/dist/index57.js +161 -77
  224. package/dist/index57.js.map +1 -1
  225. package/dist/index58.js +31 -19
  226. package/dist/index58.js.map +1 -1
  227. package/dist/index59.js +117 -69
  228. package/dist/index59.js.map +1 -1
  229. package/dist/index6.js +61 -130
  230. package/dist/index6.js.map +1 -1
  231. package/dist/index60.js +82 -53
  232. package/dist/index60.js.map +1 -1
  233. package/dist/index61.js +19 -44
  234. package/dist/index61.js.map +1 -1
  235. package/dist/index62.js +70 -48
  236. package/dist/index62.js.map +1 -1
  237. package/dist/index63.js +55 -60
  238. package/dist/index63.js.map +1 -1
  239. package/dist/index64.js +39 -101
  240. package/dist/index64.js.map +1 -1
  241. package/dist/index65.js +52 -41
  242. package/dist/index65.js.map +1 -1
  243. package/dist/index66.js +62 -21
  244. package/dist/index66.js.map +1 -1
  245. package/dist/index67.js +104 -43
  246. package/dist/index67.js.map +1 -1
  247. package/dist/index68.js +41 -134
  248. package/dist/index68.js.map +1 -1
  249. package/dist/index69.js +65 -49
  250. package/dist/index69.js.map +1 -1
  251. package/dist/index7.js +130 -11
  252. package/dist/index7.js.map +1 -1
  253. package/dist/index70.js +21 -22
  254. package/dist/index70.js.map +1 -1
  255. package/dist/index71.js +46 -22
  256. package/dist/index71.js.map +1 -1
  257. package/dist/index72.js +126 -321
  258. package/dist/index72.js.map +1 -1
  259. package/dist/index73.js +52 -56
  260. package/dist/index73.js.map +1 -1
  261. package/dist/index74.js +22 -40
  262. package/dist/index74.js.map +1 -1
  263. package/dist/index75.js +22 -95
  264. package/dist/index75.js.map +1 -1
  265. package/dist/index76.js +311 -112
  266. package/dist/index76.js.map +1 -1
  267. package/dist/index77.js +52 -157
  268. package/dist/index77.js.map +1 -1
  269. package/dist/index78.js +40 -65
  270. package/dist/index78.js.map +1 -1
  271. package/dist/index79.js +23 -35
  272. package/dist/index79.js.map +1 -1
  273. package/dist/index8.js +11 -70
  274. package/dist/index8.js.map +1 -1
  275. package/dist/index80.js +92 -31
  276. package/dist/index80.js.map +1 -1
  277. package/dist/index81.js +116 -196
  278. package/dist/index81.js.map +1 -1
  279. package/dist/index82.js +155 -207
  280. package/dist/index82.js.map +1 -1
  281. package/dist/index83.js +60 -290
  282. package/dist/index83.js.map +1 -1
  283. package/dist/index84.js +34 -177
  284. package/dist/index84.js.map +1 -1
  285. package/dist/index85.js +227 -251
  286. package/dist/index85.js.map +1 -1
  287. package/dist/index86.js +34 -14
  288. package/dist/index86.js.map +1 -1
  289. package/dist/index87.js +208 -31
  290. package/dist/index87.js.map +1 -1
  291. package/dist/index88.js +206 -10786
  292. package/dist/index88.js.map +1 -1
  293. package/dist/index89.js +295 -5
  294. package/dist/index89.js.map +1 -1
  295. package/dist/index9.js +69 -91
  296. package/dist/index9.js.map +1 -1
  297. package/dist/index90.js +172 -36
  298. package/dist/index90.js.map +1 -1
  299. package/dist/index91.js +258 -2
  300. package/dist/index91.js.map +1 -1
  301. package/dist/index92.js +13 -6
  302. package/dist/index92.js.map +1 -1
  303. package/dist/index93.js +32 -151
  304. package/dist/index93.js.map +1 -1
  305. package/dist/index94.js +5 -29
  306. package/dist/index94.js.map +1 -1
  307. package/dist/index95.js +12 -28
  308. package/dist/index95.js.map +1 -1
  309. package/dist/index96.js +46 -2
  310. package/dist/index96.js.map +1 -1
  311. package/dist/index97.js +12 -71
  312. package/dist/index97.js.map +1 -1
  313. package/dist/index98.js +13 -37
  314. package/dist/index98.js.map +1 -1
  315. package/dist/index99.js +7 -25
  316. package/dist/index99.js.map +1 -1
  317. package/package.json +1 -1
package/dist/index101.js CHANGED
@@ -1,27 +1,34 @@
1
- import { __exports as u } from "./index115.js";
2
- import { __require as a } from "./index97.js";
3
- var l;
4
- function p() {
5
- return l ? u : (l = 1, (function(s) {
6
- const c = a().getSymbolSize;
7
- s.getRowColCoords = function(r) {
8
- if (r === 1) return [];
9
- const i = Math.floor(r / 7) + 2, e = c(r), n = e === 145 ? 26 : Math.ceil((e - 13) / (2 * i - 2)) * 2, t = [e - 7];
10
- for (let o = 1; o < i - 1; o++)
11
- t[o] = t[o - 1] - n;
12
- return t.push(6), t.reverse();
13
- }, s.getPositions = function(r) {
14
- const i = [], e = s.getRowColCoords(r), n = e.length;
15
- for (let t = 0; t < n; t++)
16
- for (let o = 0; o < n; o++)
17
- t === 0 && o === 0 || // top-left
18
- t === 0 && o === n - 1 || // bottom-left
19
- t === n - 1 && o === 0 || i.push([e[t], e[o]]);
20
- return i;
1
+ import { useState as v, useCallback as i, useEffect as l } from "react";
2
+ function c(n, f = {}) {
3
+ const { target: u, event: o = "keydown", preventDefault: r = !1 } = f, [a, d] = v(!1), t = i(
4
+ (e) => {
5
+ e.key === n && (r && e.preventDefault(), d(!0));
6
+ },
7
+ [n, r]
8
+ ), s = i(
9
+ (e) => {
10
+ e.key === n && d(!1);
11
+ },
12
+ [n]
13
+ );
14
+ return l(() => {
15
+ const e = u ?? window;
16
+ return o === "keydown" ? (e.addEventListener("keydown", t), e.addEventListener("keyup", s)) : e.addEventListener("keyup", t), () => {
17
+ e.removeEventListener("keydown", t), e.removeEventListener("keyup", s);
21
18
  };
22
- })(u), u);
19
+ }, [u, o, t, s]), a;
20
+ }
21
+ function y(n, f, u = {}) {
22
+ const { target: o, event: r = "keydown", preventDefault: a = !1 } = u;
23
+ l(() => {
24
+ const d = o ?? window, t = (s) => {
25
+ s.key === n && (a && s.preventDefault(), f(s));
26
+ };
27
+ return d.addEventListener(r, t), () => d.removeEventListener(r, t);
28
+ }, [o, n, f, r, a]);
23
29
  }
24
30
  export {
25
- p as __require
31
+ c as useKeyPress,
32
+ y as useKeyPressCallback
26
33
  };
27
34
  //# sourceMappingURL=index101.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index101.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js"],"sourcesContent":["/**\n * Alignment pattern are fixed reference pattern in defined positions\n * in a matrix symbology, which enables the decode software to re-synchronise\n * the coordinate mapping of the image modules in the event of moderate amounts\n * of distortion of the image.\n *\n * Alignment patterns are present only in QR Code symbols of version 2 or larger\n * and their number depends on the symbol version.\n */\n\nconst getSymbolSize = require('./utils').getSymbolSize\n\n/**\n * Calculate the row/column coordinates of the center module of each alignment pattern\n * for the specified QR Code version.\n *\n * The alignment patterns are positioned symmetrically on either side of the diagonal\n * running from the top left corner of the symbol to the bottom right corner.\n *\n * Since positions are simmetrical only half of the coordinates are returned.\n * Each item of the array will represent in turn the x and y coordinate.\n * @see {@link getPositions}\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinate\n */\nexports.getRowColCoords = function getRowColCoords (version) {\n if (version === 1) return []\n\n const posCount = Math.floor(version / 7) + 2\n const size = getSymbolSize(version)\n const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2\n const positions = [size - 7] // Last coord is always (size - 7)\n\n for (let i = 1; i < posCount - 1; i++) {\n positions[i] = positions[i - 1] - intervals\n }\n\n positions.push(6) // First coord is always 6\n\n return positions.reverse()\n}\n\n/**\n * Returns an array containing the positions of each alignment pattern.\n * Each array's element represent the center point of the pattern as (x, y) coordinates\n *\n * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}\n * and filtering out the items that overlaps with finder pattern\n *\n * @example\n * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.\n * The alignment patterns, therefore, are to be centered on (row, column)\n * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).\n * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns\n * and are not therefore used for alignment patterns.\n *\n * let pos = getPositions(7)\n * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\nexports.getPositions = function getPositions (version) {\n const coords = []\n const pos = exports.getRowColCoords(version)\n const posLength = pos.length\n\n for (let i = 0; i < posLength; i++) {\n for (let j = 0; j < posLength; j++) {\n // Skip if position is occupied by finder patterns\n if ((i === 0 && j === 0) || // top-left\n (i === 0 && j === posLength - 1) || // bottom-left\n (i === posLength - 1 && j === 0)) { // top-right\n continue\n }\n\n coords.push([pos[i], pos[j]])\n }\n }\n\n return coords\n}\n"],"names":["getSymbolSize","require$$0","exports","version","posCount","size","intervals","positions","i","coords","pos","posLength","j"],"mappings":";;;;;AAUA,UAAMA,IAAgBC,IAAmB;AAgBzCC,IAAAA,EAAA,kBAA0B,SAA0BC,GAAS;AAC3D,UAAIA,MAAY,EAAG,QAAO,CAAA;AAE1B,YAAMC,IAAW,KAAK,MAAMD,IAAU,CAAC,IAAI,GACrCE,IAAOL,EAAcG,CAAO,GAC5BG,IAAYD,MAAS,MAAM,KAAK,KAAK,MAAMA,IAAO,OAAO,IAAID,IAAW,EAAE,IAAI,GAC9EG,IAAY,CAACF,IAAO,CAAC;AAE3B,eAASG,IAAI,GAAGA,IAAIJ,IAAW,GAAGI;AAChC,QAAAD,EAAUC,CAAC,IAAID,EAAUC,IAAI,CAAC,IAAIF;AAGpC,aAAAC,EAAU,KAAK,CAAC,GAETA,EAAU,QAAO;AAAA,IAC1B,GAsBAL,EAAA,eAAuB,SAAuBC,GAAS;AACrD,YAAMM,IAAS,CAAA,GACTC,IAAMR,EAAQ,gBAAgBC,CAAO,GACrCQ,IAAYD,EAAI;AAEtB,eAASF,IAAI,GAAGA,IAAIG,GAAWH;AAC7B,iBAASI,IAAI,GAAGA,IAAID,GAAWC;AAE7B,UAAKJ,MAAM,KAAKI,MAAM;AAAA,UACjBJ,MAAM,KAAKI,MAAMD,IAAY;AAAA,UAC7BH,MAAMG,IAAY,KAAKC,MAAM,KAIlCH,EAAO,KAAK,CAACC,EAAIF,CAAC,GAAGE,EAAIE,CAAC,CAAC,CAAC;AAIhC,aAAOH;AAAA,IACT;AAAA;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index101.js","sources":["../src/hooks/useKeyPress.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\n\nexport interface UseKeyPressOptions {\n /** Target element (default: window) */\n target?: HTMLElement | Window | null\n /** Event type: 'keydown' | 'keyup' (default: 'keydown') */\n event?: 'keydown' | 'keyup'\n /** Prevent default browser behavior */\n preventDefault?: boolean\n}\n\n/**\n * Hook that detects when a specific key is pressed.\n *\n * @param targetKey - Key to detect (e.g., 'Enter', 'Escape', 'a')\n * @param options - Configuration options\n * @returns Whether the key is currently pressed\n *\n * @example\n * const enterPressed = useKeyPress('Enter')\n * const escapePressed = useKeyPress('Escape')\n *\n * useEffect(() => {\n * if (escapePressed) closeModal()\n * }, [escapePressed])\n *\n * @example\n * // With callback for immediate action\n * useKeyPress('Escape', { preventDefault: true })\n */\nexport function useKeyPress(\n targetKey: string,\n options: UseKeyPressOptions = {}\n): boolean {\n const { target, event = 'keydown', preventDefault = false } = options\n const [keyPressed, setKeyPressed] = useState(false)\n\n const downHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n setKeyPressed(true)\n }\n },\n [targetKey, preventDefault]\n )\n\n const upHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n setKeyPressed(false)\n }\n },\n [targetKey]\n )\n\n useEffect(() => {\n const targetElement = target ?? window\n\n if (event === 'keydown') {\n targetElement.addEventListener('keydown', downHandler as EventListener)\n targetElement.addEventListener('keyup', upHandler as EventListener)\n } else {\n targetElement.addEventListener('keyup', downHandler as EventListener)\n }\n\n return () => {\n targetElement.removeEventListener('keydown', downHandler as EventListener)\n targetElement.removeEventListener('keyup', upHandler as EventListener)\n }\n }, [target, event, downHandler, upHandler])\n\n return keyPressed\n}\n\n/**\n * Hook that calls a callback when a specific key is pressed.\n *\n * @param targetKey - Key to detect\n * @param callback - Function to call when key is pressed\n * @param options - Configuration options\n *\n * @example\n * useKeyPressCallback('Escape', () => closeModal())\n * useKeyPressCallback('Enter', () => submitForm(), { preventDefault: true })\n */\nexport function useKeyPressCallback(\n targetKey: string,\n callback: (event: KeyboardEvent) => void,\n options: UseKeyPressOptions = {}\n): void {\n const { target, event = 'keydown', preventDefault = false } = options\n\n useEffect(() => {\n const targetElement = target ?? window\n\n const handler = (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n callback(e)\n }\n }\n\n targetElement.addEventListener(event, handler as EventListener)\n return () => targetElement.removeEventListener(event, handler as EventListener)\n }, [target, targetKey, callback, event, preventDefault])\n}\n"],"names":["useKeyPress","targetKey","options","target","event","preventDefault","keyPressed","setKeyPressed","useState","downHandler","useCallback","upHandler","useEffect","targetElement","useKeyPressCallback","callback","handler","e"],"mappings":";AA8BO,SAASA,EACdC,GACAC,IAA8B,IACrB;AACT,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH,GACxD,CAACI,GAAYC,CAAa,IAAIC,EAAS,EAAK,GAE5CC,IAAcC;AAAA,IAClB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,MACRI,OAAkB,eAAA,GACtBE,EAAc,EAAI;AAAA,IAEtB;AAAA,IACA,CAACN,GAAWI,CAAc;AAAA,EAAA,GAGtBM,IAAYD;AAAA,IAChB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,KACZM,EAAc,EAAK;AAAA,IAEvB;AAAA,IACA,CAACN,CAAS;AAAA,EAAA;AAGZ,SAAAW,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU;AAEhC,WAAIC,MAAU,aACZS,EAAc,iBAAiB,WAAWJ,CAA4B,GACtEI,EAAc,iBAAiB,SAASF,CAA0B,KAElEE,EAAc,iBAAiB,SAASJ,CAA4B,GAG/D,MAAM;AACX,MAAAI,EAAc,oBAAoB,WAAWJ,CAA4B,GACzEI,EAAc,oBAAoB,SAASF,CAA0B;AAAA,IACvE;AAAA,EACF,GAAG,CAACR,GAAQC,GAAOK,GAAaE,CAAS,CAAC,GAEnCL;AACT;AAaO,SAASQ,EACdb,GACAc,GACAb,IAA8B,CAAA,GACxB;AACN,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH;AAE9D,EAAAU,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU,QAE1Ba,IAAU,CAACC,MAAqB;AACpC,MAAIA,EAAE,QAAQhB,MACRI,OAAkB,eAAA,GACtBU,EAASE,CAAC;AAAA,IAEd;AAEA,WAAAJ,EAAc,iBAAiBT,GAAOY,CAAwB,GACvD,MAAMH,EAAc,oBAAoBT,GAAOY,CAAwB;AAAA,EAChF,GAAG,CAACb,GAAQF,GAAWc,GAAUX,GAAOC,CAAc,CAAC;AACzD;"}
package/dist/index102.js CHANGED
@@ -1,23 +1,21 @@
1
- import { __exports as e } from "./index116.js";
2
- import { __require as s } from "./index97.js";
3
- var i;
4
- function f() {
5
- if (i) return e;
6
- i = 1;
7
- const n = s().getSymbolSize, r = 7;
8
- return e.getPositions = function(o) {
9
- const t = n(o);
10
- return [
11
- // top-left
12
- [0, 0],
13
- // top-right
14
- [t - r, 0],
15
- // bottom-left
16
- [0, t - r]
17
- ];
18
- }, e;
1
+ import { useState as t, useEffect as d } from "react";
2
+ function r() {
3
+ const [i, n] = t(() => typeof window > "u" ? { width: 0, height: 0 } : {
4
+ width: window.innerWidth,
5
+ height: window.innerHeight
6
+ });
7
+ return d(() => {
8
+ if (typeof window > "u") return;
9
+ const e = () => {
10
+ n({
11
+ width: window.innerWidth,
12
+ height: window.innerHeight
13
+ });
14
+ };
15
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
16
+ }, []), i;
19
17
  }
20
18
  export {
21
- f as __require
19
+ r as useWindowSize
22
20
  };
23
21
  //# sourceMappingURL=index102.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index102.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"],"sourcesContent":["const getSymbolSize = require('./utils').getSymbolSize\nconst FINDER_PATTERN_SIZE = 7\n\n/**\n * Returns an array containing the positions of each finder pattern.\n * Each array's element represent the top-left point of the pattern as (x, y) coordinates\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\nexports.getPositions = function getPositions (version) {\n const size = getSymbolSize(version)\n\n return [\n // top-left\n [0, 0],\n // top-right\n [size - FINDER_PATTERN_SIZE, 0],\n // bottom-left\n [0, size - FINDER_PATTERN_SIZE]\n ]\n}\n"],"names":["getSymbolSize","require$$0","FINDER_PATTERN_SIZE","finderPattern","version","size"],"mappings":";;;;;;AAAA,QAAMA,IAAgBC,IAAmB,eACnCC,IAAsB;AAS5B,SAAAC,EAAA,eAAuB,SAAuBC,GAAS;AACrD,UAAMC,IAAOL,EAAcI,CAAO;AAElC,WAAO;AAAA;AAAA,MAEL,CAAC,GAAG,CAAC;AAAA;AAAA,MAEL,CAACC,IAAOH,GAAqB,CAAC;AAAA;AAAA,MAE9B,CAAC,GAAGG,IAAOH,CAAmB;AAAA,IAClC;AAAA,EACA;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index102.js","sources":["../src/hooks/useWindowSize.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport interface WindowSize {\n width: number\n height: number\n}\n\n/**\n * Hook that tracks window dimensions.\n * Updates on window resize.\n *\n * @returns Object with current width and height\n *\n * @example\n * const { width, height } = useWindowSize()\n *\n * return (\n * <div>\n * Window: {width} x {height}\n * {width < 768 && <MobileNav />}\n * </div>\n * )\n */\nexport function useWindowSize(): WindowSize {\n const [windowSize, setWindowSize] = useState<WindowSize>(() => {\n if (typeof window === 'undefined') {\n return { width: 0, height: 0 }\n }\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n })\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const handleResize = () => {\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n })\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n return windowSize\n}\n"],"names":["useWindowSize","windowSize","setWindowSize","useState","useEffect","handleResize"],"mappings":";AAuBO,SAASA,IAA4B;AAC1C,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAqB,MACnD,OAAO,SAAW,MACb,EAAE,OAAO,GAAG,QAAQ,EAAA,IAEtB;AAAA,IACL,OAAO,OAAO;AAAA,IACd,QAAQ,OAAO;AAAA,EAAA,CAElB;AAED,SAAAC,EAAU,MAAM;AACd,QAAI,OAAO,SAAW,IAAa;AAEnC,UAAMC,IAAe,MAAM;AACzB,MAAAH,EAAc;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA,CAChB;AAAA,IACH;AAEA,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE,GAEEJ;AACT;"}