@hanzo/ui 5.3.35 → 5.3.36

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 (254) hide show
  1. package/bin/create-registry.js +0 -0
  2. package/bin/npx-registry-mcp.js +0 -0
  3. package/bin/registry-mcp-wrapper.sh +0 -0
  4. package/bin/registry-mcp.js +0 -0
  5. package/bin/start-mcp-server.sh +0 -0
  6. package/bin/test-mcp.sh +0 -0
  7. package/dist/3d/button.js +1 -297
  8. package/dist/3d/button.mjs +1 -272
  9. package/dist/3d/card.js +1 -233
  10. package/dist/3d/card.mjs +1 -206
  11. package/dist/3d/carousel.js +1 -370
  12. package/dist/3d/carousel.mjs +1 -343
  13. package/dist/3d/grid.js +1 -361
  14. package/dist/3d/grid.mjs +1 -336
  15. package/dist/3d/index.js +1 -1517
  16. package/dist/3d/index.mjs +1 -1471
  17. package/dist/3d/marquee.js +1 -351
  18. package/dist/3d/marquee.mjs +1 -326
  19. package/dist/3d/pin.js +1 -45
  20. package/dist/3d/pin.mjs +1 -23
  21. package/dist/accordion.js +1 -79
  22. package/dist/accordion.mjs +1 -54
  23. package/dist/alert-dialog.js +1 -224
  24. package/dist/alert-dialog.mjs +1 -191
  25. package/dist/alert.js +1 -97
  26. package/dist/alert.mjs +1 -91
  27. package/dist/animation/animated-background.js +1 -423
  28. package/dist/animation/animated-background.mjs +1 -417
  29. package/dist/animation/animated-beam.js +1 -118
  30. package/dist/animation/animated-beam.mjs +1 -96
  31. package/dist/animation/animated-cursor.js +1 -274
  32. package/dist/animation/animated-cursor.mjs +1 -269
  33. package/dist/animation/animated-icon.js +2 -356
  34. package/dist/animation/animated-icon.mjs +2 -350
  35. package/dist/animation/animated-list.js +1 -338
  36. package/dist/animation/animated-list.mjs +1 -332
  37. package/dist/animation/animated-number.js +1 -282
  38. package/dist/animation/animated-number.mjs +1 -276
  39. package/dist/animation/animated-testimonials.js +1 -96
  40. package/dist/animation/animated-testimonials.mjs +1 -74
  41. package/dist/animation/animated-tooltip.js +1 -66
  42. package/dist/animation/animated-tooltip.mjs +1 -44
  43. package/dist/animation/apple-cards-carousel.js +1 -307
  44. package/dist/animation/apple-cards-carousel.mjs +1 -284
  45. package/dist/animation/apple-hello-effect.js +1 -59
  46. package/dist/animation/apple-hello-effect.mjs +1 -37
  47. package/dist/animation/index.js +2 -1951
  48. package/dist/animation/index.mjs +2 -1920
  49. package/dist/avatar.js +1 -70
  50. package/dist/avatar.mjs +1 -46
  51. package/dist/badge.js +1 -60
  52. package/dist/badge.mjs +1 -54
  53. package/dist/blocks/index.js +2 -1684
  54. package/dist/blocks/index.mjs +2 -1645
  55. package/dist/breadcrumb.js +1 -106
  56. package/dist/breadcrumb.mjs +1 -98
  57. package/dist/calendar-ext/index.js +1 -207
  58. package/dist/calendar-ext/index.mjs +1 -169
  59. package/dist/calendar.js +1 -193
  60. package/dist/calendar.mjs +1 -168
  61. package/dist/carousel.js +1 -282
  62. package/dist/carousel.mjs +1 -253
  63. package/dist/charts/index.js +6 -5840
  64. package/dist/charts/index.mjs +6 -5749
  65. package/dist/checkbox.js +1 -59
  66. package/dist/checkbox.mjs +1 -34
  67. package/dist/code/block.js +2 -225
  68. package/dist/code/block.mjs +2 -202
  69. package/dist/code/compare.js +5 -444
  70. package/dist/code/compare.mjs +5 -421
  71. package/dist/code/diff.js +12 -429
  72. package/dist/code/diff.mjs +11 -405
  73. package/dist/code/editor.js +1 -242
  74. package/dist/code/editor.mjs +1 -217
  75. package/dist/code/explorer.js +1 -290
  76. package/dist/code/explorer.mjs +1 -267
  77. package/dist/code/index.js +26 -2514
  78. package/dist/code/index.mjs +24 -2471
  79. package/dist/code/preview.js +6 -363
  80. package/dist/code/preview.mjs +6 -340
  81. package/dist/code/snippet.js +2 -273
  82. package/dist/code/snippet.mjs +2 -249
  83. package/dist/code/tabs.js +1 -74
  84. package/dist/code/tabs.mjs +1 -52
  85. package/dist/code/terminal.js +3 -436
  86. package/dist/code/terminal.mjs +3 -413
  87. package/dist/collapsible.js +1 -32
  88. package/dist/collapsible.mjs +1 -8
  89. package/dist/command.js +1 -282
  90. package/dist/command.mjs +1 -251
  91. package/dist/context-menu.js +1 -206
  92. package/dist/context-menu.mjs +1 -170
  93. package/dist/desktop/hooks.js +1 -223
  94. package/dist/desktop/hooks.mjs +1 -198
  95. package/dist/desktop/index.js +1 -685
  96. package/dist/desktop/index.mjs +1 -657
  97. package/dist/desktop/spotlight.js +1 -260
  98. package/dist/desktop/spotlight.mjs +1 -235
  99. package/dist/desktop/window.js +1 -273
  100. package/dist/desktop/window.mjs +1 -247
  101. package/dist/device/index.js +1 -2
  102. package/dist/device/index.mjs +0 -1
  103. package/dist/dialog.js +1 -245
  104. package/dist/dialog.mjs +1 -213
  105. package/dist/dock/basic.js +1 -173
  106. package/dist/dock/basic.mjs +1 -150
  107. package/dist/dock/index.js +1 -647
  108. package/dist/dock/index.mjs +1 -620
  109. package/dist/dock/limelight-nav.js +1 -314
  110. package/dist/dock/limelight-nav.mjs +1 -293
  111. package/dist/dock/macos.js +1 -140
  112. package/dist/dock/macos.mjs +1 -117
  113. package/dist/dock/menu.js +1 -69
  114. package/dist/dock/menu.mjs +1 -47
  115. package/dist/dock/message.js +1 -148
  116. package/dist/dock/message.mjs +1 -126
  117. package/dist/drawer.js +1 -114
  118. package/dist/drawer.mjs +1 -102
  119. package/dist/dropdown-menu.js +1 -201
  120. package/dist/dropdown-menu.mjs +1 -165
  121. package/dist/finance/AdvancedChart.js +2 -47
  122. package/dist/finance/AdvancedChart.mjs +2 -45
  123. package/dist/finance/CompanyProfile.js +2 -47
  124. package/dist/finance/CompanyProfile.mjs +2 -45
  125. package/dist/finance/CryptoScreener.js +2 -44
  126. package/dist/finance/CryptoScreener.mjs +2 -42
  127. package/dist/finance/Financials.js +2 -51
  128. package/dist/finance/Financials.mjs +2 -49
  129. package/dist/finance/ForexScreener.js +2 -45
  130. package/dist/finance/ForexScreener.mjs +2 -43
  131. package/dist/finance/MarketOverview.js +2 -103
  132. package/dist/finance/MarketOverview.mjs +2 -101
  133. package/dist/finance/NewsTimeline.js +2 -43
  134. package/dist/finance/NewsTimeline.mjs +2 -41
  135. package/dist/finance/OrderEntry.js +1 -130
  136. package/dist/finance/OrderEntry.mjs +1 -128
  137. package/dist/finance/OrdersHistory.js +1 -63
  138. package/dist/finance/OrdersHistory.mjs +1 -61
  139. package/dist/finance/PositionsList.js +1 -79
  140. package/dist/finance/PositionsList.mjs +1 -77
  141. package/dist/finance/StockScreener.js +2 -45
  142. package/dist/finance/StockScreener.mjs +2 -43
  143. package/dist/finance/SymbolInfo.js +2 -45
  144. package/dist/finance/SymbolInfo.mjs +2 -43
  145. package/dist/finance/TechnicalAnalysis.js +2 -53
  146. package/dist/finance/TechnicalAnalysis.mjs +2 -51
  147. package/dist/finance/TickerTape.js +2 -55
  148. package/dist/finance/TickerTape.mjs +2 -53
  149. package/dist/finance/TradingPanel.js +1 -190
  150. package/dist/finance/TradingPanel.mjs +1 -188
  151. package/dist/finance/index.js +2 -929
  152. package/dist/finance/index.mjs +2 -913
  153. package/dist/form/index.js +1 -153
  154. package/dist/form/index.mjs +1 -123
  155. package/dist/form.js +1 -171
  156. package/dist/form.mjs +1 -141
  157. package/dist/hover-card.js +1 -57
  158. package/dist/hover-card.mjs +1 -33
  159. package/dist/index.js +192 -9618
  160. package/dist/index.mjs +192 -9202
  161. package/dist/input-otp.js +1 -78
  162. package/dist/input-otp.mjs +1 -53
  163. package/dist/kanban/index.js +1 -593
  164. package/dist/kanban/index.mjs +1 -571
  165. package/dist/lib/utils.js +1 -28
  166. package/dist/lib/utils.mjs +1 -24
  167. package/dist/mermaid/index.js +1 -280
  168. package/dist/mermaid/index.mjs +1 -253
  169. package/dist/navigation/index.js +1 -97
  170. package/dist/navigation/index.mjs +1 -78
  171. package/dist/navigation-menu.js +1 -148
  172. package/dist/navigation-menu.mjs +1 -115
  173. package/dist/pattern/grid-pattern.js +3 -325
  174. package/dist/pattern/grid-pattern.mjs +3 -302
  175. package/dist/pattern/index.js +3 -325
  176. package/dist/pattern/index.mjs +3 -302
  177. package/dist/popover.js +1 -62
  178. package/dist/popover.mjs +1 -36
  179. package/dist/progress.js +1 -61
  180. package/dist/progress.mjs +1 -36
  181. package/dist/project/gantt.js +1 -64
  182. package/dist/project/gantt.mjs +1 -42
  183. package/dist/project/index.js +1 -635
  184. package/dist/project/index.mjs +1 -610
  185. package/dist/project/kanban.js +1 -596
  186. package/dist/project/kanban.mjs +1 -571
  187. package/dist/project/list.js +1 -34
  188. package/dist/project/list.mjs +1 -11
  189. package/dist/radio-group.js +1 -67
  190. package/dist/radio-group.mjs +1 -44
  191. package/dist/resizable.js +1 -71
  192. package/dist/resizable.mjs +1 -47
  193. package/dist/scroll-area.js +1 -88
  194. package/dist/scroll-area.mjs +1 -65
  195. package/dist/select.js +1 -139
  196. package/dist/select.mjs +1 -110
  197. package/dist/separator.js +1 -58
  198. package/dist/separator.mjs +1 -33
  199. package/dist/sheet.js +1 -147
  200. package/dist/sheet.mjs +1 -116
  201. package/dist/skeleton.js +1 -31
  202. package/dist/skeleton.mjs +1 -26
  203. package/dist/slider.js +1 -98
  204. package/dist/slider.mjs +1 -72
  205. package/dist/sonner.js +1 -33
  206. package/dist/sonner.mjs +1 -28
  207. package/dist/spline/index.js +1 -210
  208. package/dist/spline/index.mjs +1 -201
  209. package/dist/spline/media-stack.js +1 -192
  210. package/dist/spline/media-stack.mjs +1 -184
  211. package/dist/spline/player.js +1 -36
  212. package/dist/spline/player.mjs +1 -30
  213. package/dist/switch.js +1 -61
  214. package/dist/switch.mjs +1 -36
  215. package/dist/table.js +1 -109
  216. package/dist/table.mjs +1 -100
  217. package/dist/tabs.js +1 -127
  218. package/dist/tabs.mjs +1 -101
  219. package/dist/tailwind/index.mjs +1 -2011
  220. package/dist/textarea.js +1 -77
  221. package/dist/textarea.mjs +1 -55
  222. package/dist/toggle-group.js +1 -117
  223. package/dist/toggle-group.mjs +1 -92
  224. package/dist/toggle.js +1 -70
  225. package/dist/toggle.mjs +1 -47
  226. package/dist/tooltip.js +1 -66
  227. package/dist/tooltip.mjs +1 -39
  228. package/dist/types/index.mjs +1 -51
  229. package/dist/ui/announcement.js +1 -133
  230. package/dist/ui/announcement.mjs +1 -111
  231. package/dist/ui/avatar-group.js +1 -87
  232. package/dist/ui/avatar-group.mjs +1 -64
  233. package/dist/ui/banner.js +1 -84
  234. package/dist/ui/banner.mjs +1 -61
  235. package/dist/ui/cursor.js +1 -77
  236. package/dist/ui/cursor.mjs +1 -55
  237. package/dist/ui/index.js +1 -494
  238. package/dist/ui/index.mjs +1 -461
  239. package/dist/ui/marquee.js +1 -73
  240. package/dist/ui/marquee.mjs +1 -51
  241. package/dist/ui/pill.js +1 -84
  242. package/dist/ui/pill.mjs +1 -61
  243. package/dist/ui/spinner.js +1 -27
  244. package/dist/ui/spinner.mjs +1 -25
  245. package/dist/ui/tags.js +1 -116
  246. package/dist/ui/tags.mjs +1 -94
  247. package/dist/ui/ticker.js +1 -72
  248. package/dist/ui/ticker.mjs +1 -50
  249. package/dist/util/index.mjs +1 -404
  250. package/package.json +28 -27
  251. package/dist/primitives/index.js +0 -9619
  252. package/dist/primitives/index.mjs +0 -9203
  253. package/dist/primitives-export.js +0 -9619
  254. package/dist/primitives-export.mjs +0 -9203
@@ -1,404 +1 @@
1
- import { createRoot } from 'react-dom/client';
2
- import { Buffer } from 'buffer';
3
- import { toast } from 'sonner';
4
- import { jsx } from 'react/jsx-runtime';
5
- import * as React from 'react';
6
- import { useRef, useEffect } from 'react';
7
- import { clsx } from 'clsx';
8
- import { twMerge } from 'tailwind-merge';
9
- import { reaction, computed, makeObservable, action, observable } from 'mobx';
10
-
11
- var __defProp = Object.defineProperty;
12
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
-
14
- // util/date.ts
15
- var formatDateToUSLocaleString = /* @__PURE__ */ __name((date) => {
16
- if (!date) return "-";
17
- return new Date(date).toLocaleDateString("en-US", {
18
- year: "numeric",
19
- month: "numeric",
20
- day: "numeric"
21
- });
22
- }, "formatDateToUSLocaleString");
23
- var formatDateToLocaleStringWithTime = /* @__PURE__ */ __name((date) => {
24
- if (!date) return "-";
25
- return new Date(date).toLocaleDateString("en-US", {
26
- year: "numeric",
27
- month: "numeric",
28
- day: "numeric",
29
- hour: "numeric",
30
- minute: "numeric"
31
- });
32
- }, "formatDateToLocaleStringWithTime");
33
- var getRelativeDateLabel = /* @__PURE__ */ __name((date) => {
34
- const today = /* @__PURE__ */ new Date();
35
- const yesterday = /* @__PURE__ */ new Date();
36
- yesterday.setDate(today.getDate() - 1);
37
- if (date.toDateString() === today.toDateString()) {
38
- return "today";
39
- } else if (date.toDateString() === yesterday.toDateString()) {
40
- return "yesterday";
41
- } else {
42
- return date.toDateString();
43
- }
44
- }, "getRelativeDateLabel");
45
- var groupMessagesByDate = /* @__PURE__ */ __name((messages) => {
46
- const groupedMessages = {};
47
- for (const message of messages) {
48
- const date = new Date(message.createdAt ?? "").toDateString();
49
- if (!groupedMessages[date]) {
50
- groupedMessages[date] = [];
51
- }
52
- groupedMessages[date].push(message);
53
- }
54
- return groupedMessages;
55
- }, "groupMessagesByDate");
56
- var formatDateToMonthAndDay = /* @__PURE__ */ __name((date) => {
57
- const today = /* @__PURE__ */ new Date();
58
- if (date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear()) {
59
- return date.toLocaleTimeString("en-US", {
60
- hour: "numeric",
61
- minute: "numeric",
62
- hour12: true
63
- });
64
- }
65
- const month = date.getMonth() + 1;
66
- const day = date.getDate();
67
- return `${month}/${day}`;
68
- }, "formatDateToMonthAndDay");
69
-
70
- // util/file.ts
71
- var getFileName = /* @__PURE__ */ __name((fileName) => {
72
- const nameParts = fileName.split(".");
73
- return nameParts.slice(0, -1).join(".");
74
- }, "getFileName");
75
- var getFileExt = /* @__PURE__ */ __name((fileName) => {
76
- const nameParts = fileName.split(".");
77
- return nameParts.pop() || "";
78
- }, "getFileExt");
79
- var isFileTypeImageOrPdf = /* @__PURE__ */ __name((file) => {
80
- if (!file) return false;
81
- return file?.type.startsWith("image/") || file?.type.startsWith("application/pdf");
82
- }, "isFileTypeImageOrPdf");
83
- function createShadowRoot(tagName, styles) {
84
- const container = document.createElement(tagName);
85
- const shadow = container.attachShadow({ mode: "open" });
86
- const globalStyleSheet = new CSSStyleSheet();
87
- globalStyleSheet.replaceSync(styles);
88
- shadow.adoptedStyleSheets = [globalStyleSheet];
89
- const html = document.querySelector("html");
90
- html.prepend(container);
91
- return createRoot(shadow);
92
- }
93
- __name(createShadowRoot, "createShadowRoot");
94
-
95
- // util/timing.ts
96
- function delay(e = 1e3) {
97
- return new Promise((t) => setTimeout(t, e));
98
- }
99
- __name(delay, "delay");
100
- var blobToBase64 = /* @__PURE__ */ __name((blob) => {
101
- const reader = new FileReader();
102
- reader.readAsDataURL(blob);
103
- return new Promise((resolve) => {
104
- reader.onloadend = () => {
105
- resolve(reader.result);
106
- };
107
- });
108
- }, "blobToBase64");
109
- var dataUrlToFile = /* @__PURE__ */ __name((dataUrl, filename) => {
110
- const arr = dataUrl.split(",");
111
- if (arr.length < 2) {
112
- return void 0;
113
- }
114
- const mimeArr = arr[0].match(/:(.*?);/);
115
- if (!mimeArr || mimeArr.length < 2) {
116
- return void 0;
117
- }
118
- const mime = mimeArr[1];
119
- const buff = Buffer.from(arr[1], "base64");
120
- return new File([buff], filename, { type: mime });
121
- }, "dataUrlToFile");
122
-
123
- // util/copy-to-clipboard.ts
124
- async function copyToClipboard(text) {
125
- try {
126
- await navigator.clipboard.writeText(text);
127
- } catch {
128
- const textarea = document.createElement("textarea");
129
- textarea.style.position = "fixed";
130
- textarea.style.top = "-9999px";
131
- textarea.style.left = "-9999px";
132
- textarea.innerText = text;
133
- document.body.appendChild(textarea);
134
- textarea.focus();
135
- textarea.select();
136
- document.execCommand("copy");
137
- textarea.remove();
138
- }
139
- }
140
- __name(copyToClipboard, "copyToClipboard");
141
-
142
- // util/format-text.ts
143
- var formatText = /* @__PURE__ */ __name((text) => {
144
- const camelToSpaces = text.replace(/([a-z])([A-Z])/g, "$1 $2");
145
- const snakeToSpaces = camelToSpaces.replace(/_/g, " ");
146
- return snakeToSpaces.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
147
- }, "formatText");
148
- var formatCamelCaseText = /* @__PURE__ */ __name((text) => {
149
- const words = text.split(/(?=[A-Z])/);
150
- const formattedWords = words.map((word) => {
151
- return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
152
- });
153
- const result = formattedWords.join(" ");
154
- return result.charAt(0).toUpperCase() + result.slice(1);
155
- }, "formatCamelCaseText");
156
- var getVersionFromTool = /* @__PURE__ */ __name((toolRouterKey) => {
157
- if (toolRouterKey.version) {
158
- return toolRouterKey.version;
159
- }
160
- const parts = toolRouterKey.name.split(":::");
161
- if (parts.length === 4) {
162
- return parts[3];
163
- }
164
- return "latest";
165
- }, "getVersionFromTool");
166
- var submitRegistrationNoCodeNonPristineError = /* @__PURE__ */ __name(() => {
167
- return toast.error(
168
- /* @__PURE__ */ jsx("div", { children: "Your Hanzo Node is currently locked by existing keys, please restore your connection or reset your Hanzo Node Storage" }),
169
- { position: "bottom-center" }
170
- );
171
- }, "submitRegistrationNoCodeNonPristineError");
172
- var submitRegistrationNoCodeError = /* @__PURE__ */ __name(() => {
173
- return toast.error(/* @__PURE__ */ jsx("div", { children: "Error connecting to your Hanzo Node" }), {
174
- position: "bottom-center"
175
- });
176
- }, "submitRegistrationNoCodeError");
177
-
178
- // util/debounce.ts
179
- var debounce = /* @__PURE__ */ __name((func, delay2) => {
180
- let timeoutId = null;
181
- return (...args) => {
182
- if (timeoutId) {
183
- clearTimeout(timeoutId);
184
- }
185
- timeoutId = setTimeout(() => {
186
- func(...args);
187
- }, delay2);
188
- };
189
- }, "debounce");
190
-
191
- // util/spread-to-transform.ts
192
- function spreadToTransform(t) {
193
- let transformStrings = [];
194
- const scaleVal = "scale" in t ? t.scale : void 0;
195
- if (scaleVal) {
196
- if (typeof scaleVal === "number") {
197
- transformStrings.push(`scale(${scaleVal})`);
198
- } else if (Array.isArray(scaleVal) && scaleVal.length == 2 && typeof scaleVal[0] === "number") {
199
- transformStrings.push(`scale(${scaleVal[0]}, ${scaleVal[1]})`);
200
- } else {
201
- throw new Error("parsing MediaTransform: Unrecognized value for 'scale'!");
202
- }
203
- }
204
- return transformStrings.length > 0 ? { transform: transformStrings.join(" ") } : {};
205
- }
206
- __name(spreadToTransform, "spreadToTransform");
207
- var spread_to_transform_default = spreadToTransform;
208
-
209
- // util/specifier.ts
210
- var getPrimaryStartingWith = /* @__PURE__ */ __name((s, toFind) => {
211
- const tokenArray = s.split(" ");
212
- return tokenArray.find((tok) => tok.startsWith(`${toFind}-`));
213
- }, "getPrimaryStartingWith");
214
- var getTShirtSize = /* @__PURE__ */ __name((s) => {
215
- const subTokenArray = s.split("-");
216
- return subTokenArray[subTokenArray.length - 1];
217
- }, "getTShirtSize");
218
- var getTypographySize = /* @__PURE__ */ __name((s) => {
219
- const subTokenArray = s.split("-");
220
- return subTokenArray[subTokenArray.length - 1];
221
- }, "getTypographySize");
222
- var getDim = /* @__PURE__ */ __name((s) => {
223
- const subTokenArray = s.split("-");
224
- const dimStr = subTokenArray[subTokenArray.length - 1];
225
- if (dimStr) {
226
- const dimTokenArray = s.split("x");
227
- return dimTokenArray ? {
228
- w: Number(dimTokenArray[0]),
229
- h: Number(dimTokenArray[1])
230
- } : void 0;
231
- }
232
- return void 0;
233
- }, "getDim");
234
- function getSpecifierData(main, getPrimary, getData, def) {
235
- const primary = getPrimary(main);
236
- if (primary) {
237
- return getData(primary) ?? def;
238
- }
239
- return def ?? void 0;
240
- }
241
- __name(getSpecifierData, "getSpecifierData");
242
-
243
- // util/number-abbreviate.ts
244
- var ABBR_SYMBOLS_ARRAY = ["K", "M", "B", "T"];
245
- var MOBILE_BREAKPOINT = 768;
246
- function useIsMobile() {
247
- const [isMobile, setIsMobile] = React.useState(void 0);
248
- React.useEffect(() => {
249
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
250
- const onChange = /* @__PURE__ */ __name(() => {
251
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
252
- }, "onChange");
253
- mql.addEventListener("change", onChange);
254
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
255
- return () => mql.removeEventListener("change", onChange);
256
- }, []);
257
- return !!isMobile;
258
- }
259
- __name(useIsMobile, "useIsMobile");
260
- function cn(...inputs) {
261
- return twMerge(clsx(inputs));
262
- }
263
- __name(cn, "cn");
264
- function formatDate(input) {
265
- const date = new Date(input);
266
- return date.toLocaleDateString("en-US", {
267
- month: "long",
268
- day: "numeric",
269
- year: "numeric"
270
- });
271
- }
272
- __name(formatDate, "formatDate");
273
- function absoluteUrl(path) {
274
- return `${process.env.NEXT_PUBLIC_APP_URL || ""}${path}`;
275
- }
276
- __name(absoluteUrl, "absoluteUrl");
277
-
278
- // util/index.ts
279
- function constrain(value, minOrConstrainTo, max) {
280
- if (typeof value === "number" && typeof minOrConstrainTo === "number" && typeof max === "number") {
281
- return Math.min(Math.max(value, minOrConstrainTo), max);
282
- }
283
- if (typeof value === "object" && typeof minOrConstrainTo === "object") {
284
- const dim = value;
285
- const constrainTo = minOrConstrainTo;
286
- const aspectRatio = dim.w / dim.h;
287
- const constrainAspectRatio = constrainTo.w / constrainTo.h;
288
- if (aspectRatio > constrainAspectRatio) {
289
- return {
290
- w: constrainTo.w,
291
- h: constrainTo.w / aspectRatio
292
- };
293
- } else {
294
- return {
295
- w: constrainTo.h * aspectRatio,
296
- h: constrainTo.h
297
- };
298
- }
299
- }
300
- throw new Error("Invalid parameters for constrain function");
301
- }
302
- __name(constrain, "constrain");
303
- function round(value) {
304
- return Math.round(value * 100) / 100;
305
- }
306
- __name(round, "round");
307
- function pxToRem(px, base = 16) {
308
- return `${px / base}rem`;
309
- }
310
- __name(pxToRem, "pxToRem");
311
- function pxToEm(px, base = 16) {
312
- return `${px / base}em`;
313
- }
314
- __name(pxToEm, "pxToEm");
315
- function containsToken(text, token) {
316
- if (!text) return false;
317
- return text.toLowerCase().includes(token.toLowerCase());
318
- }
319
- __name(containsToken, "containsToken");
320
- function ldMerge(...objects) {
321
- const result = {};
322
- for (const obj of objects) {
323
- if (obj && typeof obj === "object") {
324
- Object.assign(result, obj);
325
- }
326
- }
327
- return result;
328
- }
329
- __name(ldMerge, "ldMerge");
330
- function asNum(value, defaultValue = 0) {
331
- const num = Number(value);
332
- return isNaN(num) ? defaultValue : num;
333
- }
334
- __name(asNum, "asNum");
335
- function capitalize(str) {
336
- if (!str) return str;
337
- return str.charAt(0).toUpperCase() + str.slice(1);
338
- }
339
- __name(capitalize, "capitalize");
340
- var _MyStepAnimation = class _MyStepAnimation {
341
- /** initialStep: false -> true: step 0
342
- true -> false: step 1
343
- after intervals[0] : step 2
344
- after intervals[1] : step 3
345
-
346
- initialStep must contain at least one mobx observable and return boolean
347
- see: https://mobx.js.org/reactions.html#reaction
348
- */
349
- constructor(initialStep, intervals) {
350
- this._step = -1;
351
- this._reactionDisposer = void 0;
352
- // This is separated out because reactions have to be created
353
- // once we have a valid doc / window etc. (mobx internals)
354
- // Can't just do it in constructor and assign to ref
355
- this.initialize = /* @__PURE__ */ __name(() => {
356
- const fireNext = /* @__PURE__ */ __name(() => {
357
- this._setStep(this._step + 1);
358
- if (this._step <= this._intervals.length) {
359
- setTimeout(() => {
360
- fireNext();
361
- }, this._intervals[this._step - 1]);
362
- }
363
- }, "fireNext");
364
- this._reactionDisposer = reaction(
365
- this._initialStep,
366
- (triggered) => {
367
- if (triggered && this._step === -1) {
368
- this._setStep(0);
369
- } else if (this._step === 0) {
370
- fireNext();
371
- }
372
- }
373
- );
374
- }, "initialize");
375
- this._setStep = /* @__PURE__ */ __name((v) => {
376
- this._step = v;
377
- }, "_setStep");
378
- this.dispose = /* @__PURE__ */ __name(() => {
379
- if (this._reactionDisposer) {
380
- this._reactionDisposer();
381
- }
382
- }, "dispose");
383
- // https://mobx.js.org/computeds-with-args.html#2-close-over-the-arguments
384
- this.notPast = /* @__PURE__ */ __name((step) => computed(() => this._step > -1 && this._step <= step).get(), "notPast");
385
- this._initialStep = initialStep;
386
- this._intervals = intervals;
387
- makeObservable(this, {
388
- _step: observable,
389
- _setStep: action
390
- });
391
- }
392
- };
393
- __name(_MyStepAnimation, "MyStepAnimation");
394
- var MyStepAnimation = _MyStepAnimation;
395
- var useStepAnimation = /* @__PURE__ */ __name((initialStep, intervals) => {
396
- const animRef = useRef(new MyStepAnimation(initialStep, intervals));
397
- useEffect(() => {
398
- animRef.current.initialize();
399
- return animRef.current.dispose;
400
- }, []);
401
- return animRef.current;
402
- }, "useStepAnimation");
403
-
404
- export { ABBR_SYMBOLS_ARRAY, absoluteUrl, asNum, blobToBase64, capitalize, cn, constrain, containsToken, copyToClipboard, createShadowRoot, dataUrlToFile, debounce, delay, formatCamelCaseText, formatDate, formatDateToLocaleStringWithTime, formatDateToMonthAndDay, formatDateToUSLocaleString, formatText, getDim, getFileExt, getFileName, getPrimaryStartingWith, getRelativeDateLabel, getSpecifierData, getTShirtSize, getTypographySize, getVersionFromTool, groupMessagesByDate, isFileTypeImageOrPdf, ldMerge, pxToEm, pxToRem, round, spread_to_transform_default as spreadToTransform, submitRegistrationNoCodeError, submitRegistrationNoCodeNonPristineError, useIsMobile, useStepAnimation };
1
+ import {createRoot}from'react-dom/client';import {Buffer}from'buffer';import {toast}from'sonner';import {jsx}from'react/jsx-runtime';import*as a from'react';import {useRef,useEffect}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {reaction,computed,makeObservable,action,observable}from'mobx';var d=Object.defineProperty;var r=(e,t)=>d(e,"name",{value:t,configurable:true});var P=r(e=>e?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"numeric",day:"numeric"}):"-","formatDateToUSLocaleString"),E=r(e=>e?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}):"-","formatDateToLocaleStringWithTime"),N=r(e=>{let t=new Date,n=new Date;return n.setDate(t.getDate()-1),e.toDateString()===t.toDateString()?"today":e.toDateString()===n.toDateString()?"yesterday":e.toDateString()},"getRelativeDateLabel"),U=r(e=>{let t={};for(let n of e){let o=new Date(n.createdAt??"").toDateString();t[o]||(t[o]=[]),t[o].push(n);}return t},"groupMessagesByDate"),F=r(e=>{let t=new Date;if(e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear())return e.toLocaleTimeString("en-US",{hour:"numeric",minute:"numeric",hour12:true});let n=e.getMonth()+1,o=e.getDate();return `${n}/${o}`},"formatDateToMonthAndDay");var B=r(e=>e.split(".").slice(0,-1).join("."),"getFileName"),I=r(e=>e.split(".").pop()||"","getFileExt"),H=r(e=>e?e?.type.startsWith("image/")||e?.type.startsWith("application/pdf"):false,"isFileTypeImageOrPdf");function V(e,t){let n=document.createElement(e),o=n.attachShadow({mode:"open"}),i=new CSSStyleSheet;return i.replaceSync(t),o.adoptedStyleSheets=[i],document.querySelector("html").prepend(n),createRoot(o)}r(V,"createShadowRoot");function q(e=1e3){return new Promise(t=>setTimeout(t,e))}r(q,"delay");var K=r(e=>{let t=new FileReader;return t.readAsDataURL(e),new Promise(n=>{t.onloadend=()=>{n(t.result);};})},"blobToBase64"),X=r((e,t)=>{let n=e.split(",");if(n.length<2)return;let o=n[0].match(/:(.*?);/);if(!o||o.length<2)return;let i=o[1],s=Buffer.from(n[1],"base64");return new File([s],t,{type:i})},"dataUrlToFile");async function re(e){try{await navigator.clipboard.writeText(e);}catch{let t=document.createElement("textarea");t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.innerText=e,document.body.appendChild(t),t.focus(),t.select(),document.execCommand("copy"),t.remove();}}r(re,"copyToClipboard");var ie=r(e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ").split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),"formatText"),se=r(e=>{let o=e.split(/(?=[A-Z])/).map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ");return o.charAt(0).toUpperCase()+o.slice(1)},"formatCamelCaseText"),ae=r(e=>{if(e.version)return e.version;let t=e.name.split(":::");return t.length===4?t[3]:"latest"},"getVersionFromTool");var me=r(()=>toast.error(jsx("div",{children:"Your Hanzo Node is currently locked by existing keys, please restore your connection or reset your Hanzo Node Storage"}),{position:"bottom-center"}),"submitRegistrationNoCodeNonPristineError"),le=r(()=>toast.error(jsx("div",{children:"Error connecting to your Hanzo Node"}),{position:"bottom-center"}),"submitRegistrationNoCodeError");var he=r((e,t)=>{let n=null;return (...o)=>{n&&clearTimeout(n),n=setTimeout(()=>{e(...o);},t);}},"debounce");function b(e){let t=[],n="scale"in e?e.scale:void 0;if(n)if(typeof n=="number")t.push(`scale(${n})`);else if(Array.isArray(n)&&n.length==2&&typeof n[0]=="number")t.push(`scale(${n[0]}, ${n[1]})`);else throw new Error("parsing MediaTransform: Unrecognized value for 'scale'!");return t.length>0?{transform:t.join(" ")}:{}}r(b,"spreadToTransform");var y=b;var Te=r((e,t)=>e.split(" ").find(o=>o.startsWith(`${t}-`)),"getPrimaryStartingWith"),we=r(e=>{let t=e.split("-");return t[t.length-1]},"getTShirtSize"),De=r(e=>{let t=e.split("-");return t[t.length-1]},"getTypographySize"),_e=r(e=>{let t=e.split("-");if(t[t.length-1]){let o=e.split("x");return o?{w:Number(o[0]),h:Number(o[1])}:void 0}},"getDim");function ve(e,t,n,o){let i=t(e);return i?n(i)??o:o??void 0}r(ve,"getSpecifierData");var Ce=["K","M","B","T"];var u=768;function Le(){let[e,t]=a.useState(void 0);return a.useEffect(()=>{let n=window.matchMedia(`(max-width: ${u-1}px)`),o=r(()=>{t(window.innerWidth<u);},"onChange");return n.addEventListener("change",o),t(window.innerWidth<u),()=>n.removeEventListener("change",o)},[]),!!e}r(Le,"useIsMobile");function T(...e){return twMerge(clsx(e))}r(T,"cn");function w(e){return new Date(e).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}r(w,"formatDate");function D(e){return `${process.env.NEXT_PUBLIC_APP_URL||""}${e}`}r(D,"absoluteUrl");function $e(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Math.min(Math.max(e,t),n);if(typeof e=="object"&&typeof t=="object"){let o=e,i=t,s=o.w/o.h,f=i.w/i.h;return s>f?{w:i.w,h:i.w/s}:{w:i.h*s,h:i.h}}throw new Error("Invalid parameters for constrain function")}r($e,"constrain");function Be(e){return Math.round(e*100)/100}r(Be,"round");function Ie(e,t=16){return `${e/t}rem`}r(Ie,"pxToRem");function He(e,t=16){return `${e/t}em`}r(He,"pxToEm");function We(e,t){return e?e.toLowerCase().includes(t.toLowerCase()):false}r(We,"containsToken");function je(...e){let t={};for(let n of e)n&&typeof n=="object"&&Object.assign(t,n);return t}r(je,"ldMerge");function Qe(e,t=0){let n=Number(e);return isNaN(n)?t:n}r(Qe,"asNum");function Ve(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}r(Ve,"capitalize");var p=class p{constructor(t,n){this._step=-1;this._reactionDisposer=void 0;this.initialize=r(()=>{let t=r(()=>{this._setStep(this._step+1),this._step<=this._intervals.length&&setTimeout(()=>{t();},this._intervals[this._step-1]);},"fireNext");this._reactionDisposer=reaction(this._initialStep,n=>{n&&this._step===-1?this._setStep(0):this._step===0&&t();});},"initialize");this._setStep=r(t=>{this._step=t;},"_setStep");this.dispose=r(()=>{this._reactionDisposer&&this._reactionDisposer();},"dispose");this.notPast=r(t=>computed(()=>this._step>-1&&this._step<=t).get(),"notPast");this._initialStep=t,this._intervals=n,makeObservable(this,{_step:observable,_setStep:action});}};r(p,"MyStepAnimation");var c=p,ft=r((e,t)=>{let n=useRef(new c(e,t));return useEffect(()=>(n.current.initialize(),n.current.dispose),[]),n.current},"useStepAnimation");export{Ce as ABBR_SYMBOLS_ARRAY,D as absoluteUrl,Qe as asNum,K as blobToBase64,Ve as capitalize,T as cn,$e as constrain,We as containsToken,re as copyToClipboard,V as createShadowRoot,X as dataUrlToFile,he as debounce,q as delay,se as formatCamelCaseText,w as formatDate,E as formatDateToLocaleStringWithTime,F as formatDateToMonthAndDay,P as formatDateToUSLocaleString,ie as formatText,_e as getDim,I as getFileExt,B as getFileName,Te as getPrimaryStartingWith,N as getRelativeDateLabel,ve as getSpecifierData,we as getTShirtSize,De as getTypographySize,ae as getVersionFromTool,U as groupMessagesByDate,H as isFileTypeImageOrPdf,je as ldMerge,He as pxToEm,Ie as pxToRem,Be as round,y as spreadToTransform,le as submitRegistrationNoCodeError,me as submitRegistrationNoCodeNonPristineError,Le as useIsMobile,ft as useStepAnimation};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "5.3.35",
3
+ "version": "5.3.36",
4
4
  "description": "Multi-framework UI library with React, Vue, Svelte, and React Native support. Based on shadcn/ui with comprehensive framework coverage.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -45,6 +45,29 @@
45
45
  "sdk",
46
46
  "ui"
47
47
  ],
48
+ "scripts": {
49
+ "lat": "npm show @hanzo/ui version",
50
+ "pub": "npm publish",
51
+ "tc": "tsc --project tsconfig.build.json",
52
+ "build": "npm run clean && npm run build:minimal && npm run tc",
53
+ "build:minimal": "tsup --config tsup.config.minimal.ts",
54
+ "build:namespaces": "tsup --config tsup.config.namespaces.ts",
55
+ "build:full": "tsup --config tsup.config.production.ts",
56
+ "build:frameworks": "npm run build",
57
+ "build:watch": "tsup --watch",
58
+ "build:check": "tsc --project tsconfig.build.json --noEmit",
59
+ "clean": "rm -rf dist",
60
+ "prepublishOnly": "npm run build",
61
+ "update-registry": "node ./bin/update-registry.js",
62
+ "registry:mcp": "node ./bin/cli.js registry:mcp",
63
+ "registry:mcp:http": "node ./bin/cli.js registry:mcp --http",
64
+ "analyze:frameworks": "node analyze-frameworks.js",
65
+ "test": "vitest",
66
+ "test:ui": "vitest --ui",
67
+ "test:coverage": "vitest --coverage",
68
+ "test:jest": "jest test/multi-framework.test.js",
69
+ "test:frameworks": "jest test/multi-framework.test.js --verbose"
70
+ },
48
71
  "bin": {
49
72
  "hanzo-ui": "./bin/cli.js"
50
73
  },
@@ -326,9 +349,9 @@
326
349
  "require": "./dist/components/*.js"
327
350
  },
328
351
  "./primitives": {
329
- "types": "./dist/primitives-export.d.ts",
330
- "import": "./dist/primitives-export.mjs",
331
- "require": "./dist/primitives-export.js"
352
+ "types": "./dist/index.d.ts",
353
+ "import": "./dist/index.mjs",
354
+ "require": "./dist/index.js"
332
355
  },
333
356
  "./primitives/*": {
334
357
  "types": "./dist/primitives/*.d.ts",
@@ -807,27 +830,5 @@
807
830
  "tw-animate-css": "^1.2.9",
808
831
  "typescript": "5.6.3",
809
832
  "vitest": "4.0.6"
810
- },
811
- "scripts": {
812
- "lat": "npm show @hanzo/ui version",
813
- "pub": "npm publish",
814
- "tc": "tsc --project tsconfig.build.json",
815
- "build": "npm run clean && npm run build:minimal && npm run tc",
816
- "build:minimal": "tsup --config tsup.config.minimal.ts",
817
- "build:namespaces": "tsup --config tsup.config.namespaces.ts",
818
- "build:full": "tsup --config tsup.config.production.ts",
819
- "build:frameworks": "npm run build",
820
- "build:watch": "tsup --watch",
821
- "build:check": "tsc --project tsconfig.build.json --noEmit",
822
- "clean": "rm -rf dist",
823
- "update-registry": "node ./bin/update-registry.js",
824
- "registry:mcp": "node ./bin/cli.js registry:mcp",
825
- "registry:mcp:http": "node ./bin/cli.js registry:mcp --http",
826
- "analyze:frameworks": "node analyze-frameworks.js",
827
- "test": "vitest",
828
- "test:ui": "vitest --ui",
829
- "test:coverage": "vitest --coverage",
830
- "test:jest": "jest test/multi-framework.test.js",
831
- "test:frameworks": "jest test/multi-framework.test.js --verbose"
832
833
  }
833
- }
834
+ }