@hanzo/ui 4.7.0 → 4.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/ai-icons.tsx +207 -0
- package/assets/crypto.tsx +33 -0
- package/assets/file-type-icon.tsx +66 -0
- package/assets/file.tsx +45 -0
- package/assets/general.tsx +2318 -0
- package/assets/hanzo-logo.svg +9 -0
- package/assets/hanzo-logo.tsx +17 -0
- package/assets/index.ts +122 -0
- package/assets/index.tsx +4 -0
- package/assets/llm-provider.tsx +1094 -0
- package/blocks/auth/index.ts +6 -0
- package/blocks/auth/login-2fa.tsx +165 -0
- package/blocks/auth/login-basic.tsx +94 -0
- package/blocks/auth/login-social.tsx +148 -0
- package/blocks/auth/magic-link.tsx +129 -0
- package/blocks/auth/password-reset.tsx +97 -0
- package/blocks/auth/signup.tsx +157 -0
- package/blocks/components/accordian-block.tsx +48 -0
- package/blocks/components/block-component-props.ts +11 -0
- package/blocks/components/bullet-cards-block.tsx +46 -0
- package/blocks/components/card-block/index.tsx +171 -0
- package/blocks/components/card-block/link-out-button.tsx +20 -0
- package/blocks/components/card-block/util.ts +28 -0
- package/blocks/components/carte-blanche-block/index.tsx +127 -0
- package/blocks/components/carte-blanche-block/variant-content-left.tsx +49 -0
- package/blocks/components/content.tsx +70 -0
- package/blocks/components/cta-block.tsx +115 -0
- package/blocks/components/enh-heading-block.tsx +204 -0
- package/blocks/components/grid-block/grid-block-mutator.ts +12 -0
- package/blocks/components/grid-block/index.tsx +83 -0
- package/blocks/components/grid-block/mutator-registry.ts +10 -0
- package/blocks/components/grid-block/table-borders.mutator.ts +47 -0
- package/blocks/components/group-block.tsx +83 -0
- package/blocks/components/heading-block.tsx +88 -0
- package/blocks/components/image-block.tsx +111 -0
- package/blocks/components/index.ts +30 -0
- package/blocks/components/screenful-block/content.tsx +123 -0
- package/blocks/components/screenful-block/index.tsx +107 -0
- package/blocks/components/screenful-block/poster-background.tsx +34 -0
- package/blocks/components/screenful-block/video-background.tsx +45 -0
- package/blocks/components/space-block.tsx +66 -0
- package/blocks/components/video-block.tsx +138 -0
- package/blocks/data-display/activity-feed.tsx +242 -0
- package/blocks/data-display/data-table.tsx +235 -0
- package/blocks/data-display/stats-grid.tsx +194 -0
- package/blocks/def/accordian-block.ts +14 -0
- package/blocks/def/block.ts +7 -0
- package/blocks/def/bullet-cards-block.ts +22 -0
- package/blocks/def/card-block.ts +22 -0
- package/blocks/def/carte-blanche-block.ts +21 -0
- package/blocks/def/cta-block.ts +19 -0
- package/blocks/def/element-block.ts +11 -0
- package/blocks/def/enh-heading-block.ts +44 -0
- package/blocks/def/grid-block.ts +16 -0
- package/blocks/def/group-block.ts +11 -0
- package/blocks/def/heading-block.ts +15 -0
- package/blocks/def/image-block.ts +31 -0
- package/blocks/def/index.ts +35 -0
- package/blocks/def/screenful-block.ts +54 -0
- package/blocks/def/space-block.ts +64 -0
- package/blocks/def/video-block.ts +9 -0
- package/blocks/ecommerce/checkout.tsx +242 -0
- package/blocks/ecommerce/index.ts +7 -0
- package/blocks/ecommerce/product-detail.tsx +257 -0
- package/blocks/ecommerce/product-grid.tsx +148 -0
- package/blocks/ecommerce/shopping-cart.tsx +181 -0
- package/blocks/index.ts +2 -0
- package/blocks/marketing/cta-section.tsx +207 -0
- package/blocks/marketing/faq.tsx +159 -0
- package/blocks/marketing/features-grid.tsx +156 -0
- package/blocks/marketing/hero-section.tsx +192 -0
- package/blocks/marketing/index.ts +6 -0
- package/blocks/marketing/pricing-table.tsx +121 -0
- package/blocks/marketing/testimonials.tsx +196 -0
- package/components/index.ts +9 -0
- package/dist/index.js +1408 -1514
- package/dist/index.mjs +1364 -1472
- package/dist/lib/utils.js +1 -0
- package/dist/lib/utils.mjs +1 -0
- package/dist/src/utils.js +1 -0
- package/dist/src/utils.mjs +1 -0
- package/dist/tailwind/index.js +4 -1
- package/dist/tailwind/index.mjs +4 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/util/format-text.js +52 -0
- package/dist/util/format-text.mjs +33 -0
- package/dist/util/index.js +385 -0
- package/dist/util/index.mjs +364 -0
- package/frameworks/core/index.ts +6 -0
- package/frameworks/core/utils/index.ts +64 -0
- package/frameworks/react/components/button.tsx +26 -0
- package/frameworks/react/components/index.ts +5 -0
- package/frameworks/react/hooks/index.ts +5 -0
- package/frameworks/react/index.ts +9 -0
- package/frameworks/react/package.json +8 -0
- package/frameworks/react/utils/index.ts +2 -0
- package/frameworks/react-native/index.ts +9 -0
- package/frameworks/react-native/package.json +8 -0
- package/frameworks/registry.json +371 -0
- package/frameworks/setup.sh +69 -0
- package/frameworks/svelte/index.ts +9 -0
- package/frameworks/svelte/package.json +8 -0
- package/frameworks/tracker.json +1854 -0
- package/frameworks/vue/index.ts +9 -0
- package/frameworks/vue/package.json +8 -0
- package/helpers/file.ts +33 -0
- package/helpers/memoization.ts +40 -0
- package/package.json +49 -11
- package/primitives/accordion.tsx +74 -0
- package/primitives/action-button.tsx +42 -0
- package/primitives/alert-dialog.tsx +185 -0
- package/primitives/alert.tsx +74 -0
- package/primitives/apply-typography.tsx +55 -0
- package/primitives/aspect-ratio.tsx +5 -0
- package/primitives/avatar.tsx +57 -0
- package/primitives/background-beams.tsx +142 -0
- package/primitives/badge.tsx +45 -0
- package/primitives/breadcrumb.tsx +130 -0
- package/primitives/breakpoint-indicator.tsx +19 -0
- package/primitives/button.tsx +72 -0
- package/primitives/calendar.tsx +72 -0
- package/primitives/card.tsx +97 -0
- package/primitives/carousel.tsx +238 -0
- package/primitives/chat/chat-input-area.tsx +88 -0
- package/primitives/chat/chat-input.tsx +71 -0
- package/primitives/chat/files-preview.tsx +331 -0
- package/primitives/chat/index.ts +6 -0
- package/primitives/chat/json-form.tsx +8 -0
- package/primitives/chat/message-list.tsx +308 -0
- package/primitives/chat/message.tsx +569 -0
- package/primitives/chat/sqlite-preview.tsx +215 -0
- package/primitives/checkbox.tsx +32 -0
- package/primitives/collapsible.tsx +9 -0
- package/primitives/combobox.tsx +239 -0
- package/primitives/command.tsx +151 -0
- package/primitives/context-menu.tsx +206 -0
- package/primitives/copy-to-clipboard-icon.tsx +60 -0
- package/primitives/dialog-video-controller.tsx +38 -0
- package/primitives/dialog.tsx +128 -0
- package/primitives/dot-pattern.tsx +57 -0
- package/primitives/dots-loader.tsx +13 -0
- package/primitives/drawer.tsx +113 -0
- package/primitives/dropdown-menu.tsx +199 -0
- package/primitives/error-message.tsx +19 -0
- package/primitives/file-uploader.tsx +202 -0
- package/primitives/form.tsx +185 -0
- package/primitives/hover-card.tsx +28 -0
- package/primitives/icons/github.tsx +14 -0
- package/primitives/icons/index.ts +18 -0
- package/primitives/icons/youtube-logo.tsx +59 -0
- package/primitives/index-common.ts +304 -0
- package/primitives/index-next.ts +4 -0
- package/primitives/input-otp.tsx +65 -0
- package/primitives/input.tsx +128 -0
- package/primitives/label.tsx +21 -0
- package/primitives/list-adaptor.ts +12 -0
- package/primitives/list-box.tsx +74 -0
- package/primitives/loading-spinner.tsx +33 -0
- package/primitives/markdown-preview.tsx +612 -0
- package/primitives/mermaid.tsx +191 -0
- package/primitives/navigation-menu.tsx +147 -0
- package/primitives/next/image.tsx +91 -0
- package/primitives/next/index.ts +7 -0
- package/primitives/next/inline-icon.tsx +36 -0
- package/primitives/next/link-element.tsx +109 -0
- package/primitives/next/mdx-link.tsx +22 -0
- package/primitives/next/media-stack.tsx +52 -0
- package/primitives/next/nav-items.tsx +45 -0
- package/primitives/next/youtube-embed.tsx +83 -0
- package/primitives/pagination.tsx +117 -0
- package/primitives/popover.tsx +34 -0
- package/primitives/pretty-json-print.tsx +28 -0
- package/primitives/progress.tsx +27 -0
- package/primitives/prompt-textarea.tsx +72 -0
- package/primitives/qr-code.tsx +112 -0
- package/primitives/radio-group.tsx +42 -0
- package/primitives/resizable.tsx +47 -0
- package/primitives/scroll-area.tsx +57 -0
- package/primitives/search-input.tsx +66 -0
- package/primitives/select.tsx +122 -0
- package/primitives/separator.tsx +26 -0
- package/primitives/sheet.tsx +139 -0
- package/primitives/skeleton.tsx +18 -0
- package/primitives/slider.tsx +63 -0
- package/primitives/sonner.tsx +35 -0
- package/primitives/step-indicator.tsx +69 -0
- package/primitives/stepper.tsx +272 -0
- package/primitives/switch.tsx +27 -0
- package/primitives/table.tsx +105 -0
- package/primitives/tabs.tsx +50 -0
- package/primitives/text-area.tsx +26 -0
- package/primitives/text-link.tsx +25 -0
- package/primitives/textarea.tsx +64 -0
- package/primitives/textfield.tsx +78 -0
- package/primitives/toast.tsx +30 -0
- package/primitives/toggle-group.tsx +63 -0
- package/primitives/toggle.tsx +44 -0
- package/primitives/tooltip.tsx +47 -0
- package/primitives/video-player.tsx +23 -0
- package/src/button.ts +1 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/use-click-away.ts +31 -0
- package/src/hooks/use-combined-refs.ts +22 -0
- package/src/hooks/use-copy-clipboard.ts +30 -0
- package/src/hooks/use-debounce.ts +17 -0
- package/src/hooks/use-fill-ids.ts +25 -0
- package/src/hooks/use-map.ts +26 -0
- package/src/hooks/use-measure.ts +42 -0
- package/src/hooks/use-reverse-video-playback.ts +43 -0
- package/src/hooks/use-scroll-restoration.ts +50 -0
- package/src/index-lean.ts +87 -0
- package/src/index.ts +54 -0
- package/src/mcp/README.md +141 -0
- package/src/mcp/enhanced-server.ts +1208 -0
- package/src/mcp/index.ts +518 -0
- package/src/mcp/package.json +10 -0
- package/src/registry/api.ts +164 -0
- package/src/registry/index.ts +60 -0
- package/src/registry/package.json +10 -0
- package/src/utils.ts +19 -0
- package/tailwind/colors.tailwind.js +53 -0
- package/tailwind/fontFamily.tailwind.ts +7 -0
- package/tailwind/fontSize.tailwind.ts +13 -0
- package/tailwind/index.ts +7 -0
- package/tailwind/safelist.tailwind.js +26 -0
- package/tailwind/screens.tailwind.js +8 -0
- package/tailwind/spacing.tailwind.js +65 -0
- package/tailwind/tailwind.config.hanzo-preset.d.ts +5 -0
- package/tailwind/tailwind.config.hanzo-preset.js +915 -0
- package/tailwind/tw-font-desc.ts +15 -0
- package/tailwind/typo-plugin/get-plugin-styles.js +679 -0
- package/tailwind/typo-plugin/index.d.ts +9 -0
- package/tailwind/typo-plugin/index.js +141 -0
- package/tailwind/typo-plugin/utils.js +60 -0
- package/tailwind/typography-test.mdx +35 -0
- package/tailwind/z-index.tailwind.js +71 -0
- package/types/animation-def.ts +3 -0
- package/types/breakpoints.ts +11 -0
- package/types/bullet-item.ts +10 -0
- package/types/button-def.ts +39 -0
- package/types/dimensions.ts +8 -0
- package/types/grid-def.ts +56 -0
- package/types/image-def.ts +32 -0
- package/types/index.ts +30 -0
- package/types/link-def.ts +56 -0
- package/types/media-stack-def.ts +31 -0
- package/types/t-shirt-size.ts +5 -0
- package/types/tshirt-dimensions.ts +20 -0
- package/types/video-def.ts +25 -0
- package/util/blob.ts +33 -0
- package/util/copy-to-clipboard.ts +17 -0
- package/util/create-shadow-root.ts +22 -0
- package/util/date.ts +84 -0
- package/util/debounce.ts +11 -0
- package/util/file.ts +15 -0
- package/util/format-and-abbreviate-as-currency.ts +125 -0
- package/util/format-text.ts +34 -0
- package/util/format-to-max-char.ts +68 -0
- package/util/index-client.ts +3 -0
- package/util/index.ts +112 -0
- package/util/number-abbreviate.ts +49 -0
- package/util/specifier.ts +43 -0
- package/util/spread-to-transform.ts +25 -0
- package/util/step-animation.ts +90 -0
- package/util/timing.ts +3 -0
- package/util/toasts.tsx +17 -0
- package/util/two-way-map.ts +19 -0
- package/dist/index.d.mts +0 -16
- package/dist/index.d.ts +0 -16
- package/dist/lib/utils.d.mts +0 -2
- package/dist/lib/utils.d.ts +0 -2
- package/dist/src/utils.d.mts +0 -7
- package/dist/src/utils.d.ts +0 -7
- package/dist/tailwind/index.d.mts +0 -2
- package/dist/tailwind/index.d.ts +0 -2
- package/dist/types/index.d.mts +0 -12
- package/dist/types/index.d.ts +0 -12
package/dist/lib/utils.js
CHANGED
package/dist/lib/utils.mjs
CHANGED
package/dist/src/utils.js
CHANGED
package/dist/src/utils.mjs
CHANGED
package/dist/tailwind/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -305,11 +306,13 @@ for (let i = 0; i <= 50; i++) {
|
|
|
305
306
|
var z_index_tailwind_default = zIndex;
|
|
306
307
|
|
|
307
308
|
// tailwind/typo-plugin/index.js
|
|
308
|
-
var import_plugin = __toESM(require("tailwindcss/plugin"));
|
|
309
|
+
var import_plugin = __toESM(require("tailwindcss/plugin.js"));
|
|
309
310
|
var import_lodash2 = __toESM(require("lodash.merge"));
|
|
310
311
|
var import_lodash3 = __toESM(require("lodash.castarray"));
|
|
311
312
|
|
|
312
313
|
// util/index.ts
|
|
314
|
+
var import_clsx = require("clsx");
|
|
315
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
313
316
|
function round(value) {
|
|
314
317
|
return Math.round(value * 100) / 100;
|
|
315
318
|
}
|
package/dist/tailwind/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
4
|
|
|
@@ -271,11 +272,13 @@ for (let i = 0; i <= 50; i++) {
|
|
|
271
272
|
var z_index_tailwind_default = zIndex;
|
|
272
273
|
|
|
273
274
|
// tailwind/typo-plugin/index.js
|
|
274
|
-
import plugin from "tailwindcss/plugin";
|
|
275
|
+
import plugin from "tailwindcss/plugin.js";
|
|
275
276
|
import merge from "lodash.merge";
|
|
276
277
|
import castArray from "lodash.castarray";
|
|
277
278
|
|
|
278
279
|
// util/index.ts
|
|
280
|
+
import { clsx } from "clsx";
|
|
281
|
+
import { twMerge } from "tailwind-merge";
|
|
279
282
|
function round(value) {
|
|
280
283
|
return Math.round(value * 100) / 100;
|
|
281
284
|
}
|
package/dist/types/index.js
CHANGED
package/dist/types/index.mjs
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// util/format-text.ts
|
|
23
|
+
var format_text_exports = {};
|
|
24
|
+
__export(format_text_exports, {
|
|
25
|
+
formatCamelCaseText: () => formatCamelCaseText,
|
|
26
|
+
formatText: () => formatText,
|
|
27
|
+
getVersionFromTool: () => getVersionFromTool
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(format_text_exports);
|
|
30
|
+
var formatText = /* @__PURE__ */ __name((text) => {
|
|
31
|
+
const camelToSpaces = text.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
32
|
+
const snakeToSpaces = camelToSpaces.replace(/_/g, " ");
|
|
33
|
+
return snakeToSpaces.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
34
|
+
}, "formatText");
|
|
35
|
+
var formatCamelCaseText = /* @__PURE__ */ __name((text) => {
|
|
36
|
+
const words = text.split(/(?=[A-Z])/);
|
|
37
|
+
const formattedWords = words.map((word) => {
|
|
38
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
39
|
+
});
|
|
40
|
+
const result = formattedWords.join(" ");
|
|
41
|
+
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
42
|
+
}, "formatCamelCaseText");
|
|
43
|
+
var getVersionFromTool = /* @__PURE__ */ __name((toolRouterKey) => {
|
|
44
|
+
if (toolRouterKey.version) {
|
|
45
|
+
return toolRouterKey.version;
|
|
46
|
+
}
|
|
47
|
+
const parts = toolRouterKey.name.split(":::");
|
|
48
|
+
if (parts.length === 4) {
|
|
49
|
+
return parts[3];
|
|
50
|
+
}
|
|
51
|
+
return "latest";
|
|
52
|
+
}, "getVersionFromTool");
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
|
|
5
|
+
// util/format-text.ts
|
|
6
|
+
var formatText = /* @__PURE__ */ __name((text) => {
|
|
7
|
+
const camelToSpaces = text.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
8
|
+
const snakeToSpaces = camelToSpaces.replace(/_/g, " ");
|
|
9
|
+
return snakeToSpaces.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
10
|
+
}, "formatText");
|
|
11
|
+
var formatCamelCaseText = /* @__PURE__ */ __name((text) => {
|
|
12
|
+
const words = text.split(/(?=[A-Z])/);
|
|
13
|
+
const formattedWords = words.map((word) => {
|
|
14
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
15
|
+
});
|
|
16
|
+
const result = formattedWords.join(" ");
|
|
17
|
+
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
18
|
+
}, "formatCamelCaseText");
|
|
19
|
+
var getVersionFromTool = /* @__PURE__ */ __name((toolRouterKey) => {
|
|
20
|
+
if (toolRouterKey.version) {
|
|
21
|
+
return toolRouterKey.version;
|
|
22
|
+
}
|
|
23
|
+
const parts = toolRouterKey.name.split(":::");
|
|
24
|
+
if (parts.length === 4) {
|
|
25
|
+
return parts[3];
|
|
26
|
+
}
|
|
27
|
+
return "latest";
|
|
28
|
+
}, "getVersionFromTool");
|
|
29
|
+
export {
|
|
30
|
+
formatCamelCaseText,
|
|
31
|
+
formatText,
|
|
32
|
+
getVersionFromTool
|
|
33
|
+
};
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// util/index.ts
|
|
23
|
+
var util_exports = {};
|
|
24
|
+
__export(util_exports, {
|
|
25
|
+
ABBR_SYMBOLS_ARRAY: () => ABBR_SYMBOLS_ARRAY,
|
|
26
|
+
absoluteUrl: () => absoluteUrl,
|
|
27
|
+
asNum: () => asNum,
|
|
28
|
+
blobToBase64: () => blobToBase64,
|
|
29
|
+
cn: () => cn,
|
|
30
|
+
constrain: () => constrain,
|
|
31
|
+
containsToken: () => containsToken,
|
|
32
|
+
copyToClipboard: () => copyToClipboard,
|
|
33
|
+
createShadowRoot: () => createShadowRoot,
|
|
34
|
+
dataUrlToFile: () => dataUrlToFile,
|
|
35
|
+
debounce: () => debounce,
|
|
36
|
+
delay: () => delay,
|
|
37
|
+
formatCamelCaseText: () => formatCamelCaseText,
|
|
38
|
+
formatDate: () => formatDate,
|
|
39
|
+
formatDateToLocaleStringWithTime: () => formatDateToLocaleStringWithTime,
|
|
40
|
+
formatDateToMonthAndDay: () => formatDateToMonthAndDay,
|
|
41
|
+
formatDateToUSLocaleString: () => formatDateToUSLocaleString,
|
|
42
|
+
formatText: () => formatText,
|
|
43
|
+
getDim: () => getDim,
|
|
44
|
+
getFileExt: () => getFileExt,
|
|
45
|
+
getFileName: () => getFileName,
|
|
46
|
+
getPrimaryStartingWith: () => getPrimaryStartingWith,
|
|
47
|
+
getRelativeDateLabel: () => getRelativeDateLabel,
|
|
48
|
+
getSpecifierData: () => getSpecifierData,
|
|
49
|
+
getTShirtSize: () => getTShirtSize,
|
|
50
|
+
getTypographySize: () => getTypographySize,
|
|
51
|
+
getVersionFromTool: () => getVersionFromTool,
|
|
52
|
+
groupMessagesByDate: () => groupMessagesByDate,
|
|
53
|
+
isFileTypeImageOrPdf: () => isFileTypeImageOrPdf,
|
|
54
|
+
ldMerge: () => ldMerge,
|
|
55
|
+
pxToEm: () => pxToEm,
|
|
56
|
+
pxToRem: () => pxToRem,
|
|
57
|
+
round: () => round,
|
|
58
|
+
spreadToTransform: () => spread_to_transform_default,
|
|
59
|
+
submitRegistrationNoCodeError: () => submitRegistrationNoCodeError,
|
|
60
|
+
submitRegistrationNoCodeNonPristineError: () => submitRegistrationNoCodeNonPristineError
|
|
61
|
+
});
|
|
62
|
+
module.exports = __toCommonJS(util_exports);
|
|
63
|
+
|
|
64
|
+
// util/date.ts
|
|
65
|
+
var formatDateToUSLocaleString = /* @__PURE__ */ __name((date) => {
|
|
66
|
+
if (!date) return "-";
|
|
67
|
+
return new Date(date).toLocaleDateString("en-US", {
|
|
68
|
+
year: "numeric",
|
|
69
|
+
month: "numeric",
|
|
70
|
+
day: "numeric"
|
|
71
|
+
});
|
|
72
|
+
}, "formatDateToUSLocaleString");
|
|
73
|
+
var formatDateToLocaleStringWithTime = /* @__PURE__ */ __name((date) => {
|
|
74
|
+
if (!date) return "-";
|
|
75
|
+
return new Date(date).toLocaleDateString("en-US", {
|
|
76
|
+
year: "numeric",
|
|
77
|
+
month: "numeric",
|
|
78
|
+
day: "numeric",
|
|
79
|
+
hour: "numeric",
|
|
80
|
+
minute: "numeric"
|
|
81
|
+
});
|
|
82
|
+
}, "formatDateToLocaleStringWithTime");
|
|
83
|
+
var getRelativeDateLabel = /* @__PURE__ */ __name((date) => {
|
|
84
|
+
const today = /* @__PURE__ */ new Date();
|
|
85
|
+
const yesterday = /* @__PURE__ */ new Date();
|
|
86
|
+
yesterday.setDate(today.getDate() - 1);
|
|
87
|
+
if (date.toDateString() === today.toDateString()) {
|
|
88
|
+
return "today";
|
|
89
|
+
} else if (date.toDateString() === yesterday.toDateString()) {
|
|
90
|
+
return "yesterday";
|
|
91
|
+
} else {
|
|
92
|
+
return date.toDateString();
|
|
93
|
+
}
|
|
94
|
+
}, "getRelativeDateLabel");
|
|
95
|
+
var groupMessagesByDate = /* @__PURE__ */ __name((messages) => {
|
|
96
|
+
const groupedMessages = {};
|
|
97
|
+
for (const message of messages) {
|
|
98
|
+
const date = new Date(message.createdAt ?? "").toDateString();
|
|
99
|
+
if (!groupedMessages[date]) {
|
|
100
|
+
groupedMessages[date] = [];
|
|
101
|
+
}
|
|
102
|
+
groupedMessages[date].push(message);
|
|
103
|
+
}
|
|
104
|
+
return groupedMessages;
|
|
105
|
+
}, "groupMessagesByDate");
|
|
106
|
+
var formatDateToMonthAndDay = /* @__PURE__ */ __name((date) => {
|
|
107
|
+
const today = /* @__PURE__ */ new Date();
|
|
108
|
+
if (date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear()) {
|
|
109
|
+
return date.toLocaleTimeString("en-US", {
|
|
110
|
+
hour: "numeric",
|
|
111
|
+
minute: "numeric",
|
|
112
|
+
hour12: true
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const month = date.getMonth() + 1;
|
|
116
|
+
const day = date.getDate();
|
|
117
|
+
return `${month}/${day}`;
|
|
118
|
+
}, "formatDateToMonthAndDay");
|
|
119
|
+
|
|
120
|
+
// util/file.ts
|
|
121
|
+
var getFileName = /* @__PURE__ */ __name((fileName) => {
|
|
122
|
+
const nameParts = fileName.split(".");
|
|
123
|
+
return nameParts.slice(0, -1).join(".");
|
|
124
|
+
}, "getFileName");
|
|
125
|
+
var getFileExt = /* @__PURE__ */ __name((fileName) => {
|
|
126
|
+
const nameParts = fileName.split(".");
|
|
127
|
+
return nameParts.pop() || "";
|
|
128
|
+
}, "getFileExt");
|
|
129
|
+
var isFileTypeImageOrPdf = /* @__PURE__ */ __name((file) => {
|
|
130
|
+
if (!file) return false;
|
|
131
|
+
return file?.type.startsWith("image/") || file?.type.startsWith("application/pdf");
|
|
132
|
+
}, "isFileTypeImageOrPdf");
|
|
133
|
+
|
|
134
|
+
// util/create-shadow-root.ts
|
|
135
|
+
var import_client = require("react-dom/client");
|
|
136
|
+
function createShadowRoot(tagName, styles) {
|
|
137
|
+
const container = document.createElement(tagName);
|
|
138
|
+
const shadow = container.attachShadow({ mode: "open" });
|
|
139
|
+
const globalStyleSheet = new CSSStyleSheet();
|
|
140
|
+
globalStyleSheet.replaceSync(styles);
|
|
141
|
+
shadow.adoptedStyleSheets = [globalStyleSheet];
|
|
142
|
+
const html = document.querySelector("html");
|
|
143
|
+
html.prepend(container);
|
|
144
|
+
return (0, import_client.createRoot)(shadow);
|
|
145
|
+
}
|
|
146
|
+
__name(createShadowRoot, "createShadowRoot");
|
|
147
|
+
|
|
148
|
+
// util/timing.ts
|
|
149
|
+
function delay(e = 1e3) {
|
|
150
|
+
return new Promise((t) => setTimeout(t, e));
|
|
151
|
+
}
|
|
152
|
+
__name(delay, "delay");
|
|
153
|
+
|
|
154
|
+
// util/blob.ts
|
|
155
|
+
var blobToBase64 = /* @__PURE__ */ __name((blob) => {
|
|
156
|
+
const reader = new FileReader();
|
|
157
|
+
reader.readAsDataURL(blob);
|
|
158
|
+
return new Promise((resolve) => {
|
|
159
|
+
reader.onloadend = () => {
|
|
160
|
+
resolve(reader.result);
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}, "blobToBase64");
|
|
164
|
+
var dataUrlToFile = /* @__PURE__ */ __name((dataUrl, filename) => {
|
|
165
|
+
const arr = dataUrl.split(",");
|
|
166
|
+
if (arr.length < 2) {
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
169
|
+
const mimeArr = arr[0].match(/:(.*?);/);
|
|
170
|
+
if (!mimeArr || mimeArr.length < 2) {
|
|
171
|
+
return void 0;
|
|
172
|
+
}
|
|
173
|
+
const mime = mimeArr[1];
|
|
174
|
+
const binaryString = atob(arr[1]);
|
|
175
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
176
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
177
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
178
|
+
}
|
|
179
|
+
return new File([bytes], filename, { type: mime });
|
|
180
|
+
}, "dataUrlToFile");
|
|
181
|
+
|
|
182
|
+
// util/copy-to-clipboard.ts
|
|
183
|
+
async function copyToClipboard(text) {
|
|
184
|
+
try {
|
|
185
|
+
await navigator.clipboard.writeText(text);
|
|
186
|
+
} catch {
|
|
187
|
+
const textarea = document.createElement("textarea");
|
|
188
|
+
textarea.style.position = "fixed";
|
|
189
|
+
textarea.style.top = "-9999px";
|
|
190
|
+
textarea.style.left = "-9999px";
|
|
191
|
+
textarea.innerText = text;
|
|
192
|
+
document.body.appendChild(textarea);
|
|
193
|
+
textarea.focus();
|
|
194
|
+
textarea.select();
|
|
195
|
+
document.execCommand("copy");
|
|
196
|
+
textarea.remove();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
__name(copyToClipboard, "copyToClipboard");
|
|
200
|
+
|
|
201
|
+
// util/format-text.ts
|
|
202
|
+
var formatText = /* @__PURE__ */ __name((text) => {
|
|
203
|
+
const camelToSpaces = text.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
204
|
+
const snakeToSpaces = camelToSpaces.replace(/_/g, " ");
|
|
205
|
+
return snakeToSpaces.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
206
|
+
}, "formatText");
|
|
207
|
+
var formatCamelCaseText = /* @__PURE__ */ __name((text) => {
|
|
208
|
+
const words = text.split(/(?=[A-Z])/);
|
|
209
|
+
const formattedWords = words.map((word) => {
|
|
210
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
211
|
+
});
|
|
212
|
+
const result = formattedWords.join(" ");
|
|
213
|
+
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
214
|
+
}, "formatCamelCaseText");
|
|
215
|
+
var getVersionFromTool = /* @__PURE__ */ __name((toolRouterKey) => {
|
|
216
|
+
if (toolRouterKey.version) {
|
|
217
|
+
return toolRouterKey.version;
|
|
218
|
+
}
|
|
219
|
+
const parts = toolRouterKey.name.split(":::");
|
|
220
|
+
if (parts.length === 4) {
|
|
221
|
+
return parts[3];
|
|
222
|
+
}
|
|
223
|
+
return "latest";
|
|
224
|
+
}, "getVersionFromTool");
|
|
225
|
+
|
|
226
|
+
// util/toasts.tsx
|
|
227
|
+
var import_sonner = require("sonner");
|
|
228
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
229
|
+
var submitRegistrationNoCodeNonPristineError = /* @__PURE__ */ __name(() => {
|
|
230
|
+
return import_sonner.toast.error(
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Your Hanzo Node is currently locked by existing keys, please restore your connection or reset your Hanzo Node Storage" }),
|
|
232
|
+
{ position: "bottom-center" }
|
|
233
|
+
);
|
|
234
|
+
}, "submitRegistrationNoCodeNonPristineError");
|
|
235
|
+
var submitRegistrationNoCodeError = /* @__PURE__ */ __name(() => {
|
|
236
|
+
return import_sonner.toast.error(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Error connecting to your Hanzo Node" }), {
|
|
237
|
+
position: "bottom-center"
|
|
238
|
+
});
|
|
239
|
+
}, "submitRegistrationNoCodeError");
|
|
240
|
+
|
|
241
|
+
// util/debounce.ts
|
|
242
|
+
var debounce = /* @__PURE__ */ __name((func, delay2) => {
|
|
243
|
+
let timeoutId = null;
|
|
244
|
+
return (...args) => {
|
|
245
|
+
if (timeoutId) {
|
|
246
|
+
clearTimeout(timeoutId);
|
|
247
|
+
}
|
|
248
|
+
timeoutId = setTimeout(() => {
|
|
249
|
+
func(...args);
|
|
250
|
+
}, delay2);
|
|
251
|
+
};
|
|
252
|
+
}, "debounce");
|
|
253
|
+
|
|
254
|
+
// util/spread-to-transform.ts
|
|
255
|
+
function spreadToTransform(t) {
|
|
256
|
+
let transformStrings = [];
|
|
257
|
+
const scaleVal = "scale" in t ? t.scale : void 0;
|
|
258
|
+
if (scaleVal) {
|
|
259
|
+
if (typeof scaleVal === "number") {
|
|
260
|
+
transformStrings.push(`scale(${scaleVal})`);
|
|
261
|
+
} else if (Array.isArray(scaleVal) && scaleVal.length == 2 && typeof scaleVal[0] === "number") {
|
|
262
|
+
transformStrings.push(`scale(${scaleVal[0]}, ${scaleVal[1]})`);
|
|
263
|
+
} else {
|
|
264
|
+
throw new Error("parsing MediaTransform: Unrecognized value for 'scale'!");
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return transformStrings.length > 0 ? { transform: transformStrings.join(" ") } : {};
|
|
268
|
+
}
|
|
269
|
+
__name(spreadToTransform, "spreadToTransform");
|
|
270
|
+
var spread_to_transform_default = spreadToTransform;
|
|
271
|
+
|
|
272
|
+
// util/specifier.ts
|
|
273
|
+
var getPrimaryStartingWith = /* @__PURE__ */ __name((s, toFind) => {
|
|
274
|
+
const tokenArray = s.split(" ");
|
|
275
|
+
return tokenArray.find((tok) => tok.startsWith(`${toFind}-`));
|
|
276
|
+
}, "getPrimaryStartingWith");
|
|
277
|
+
var getTShirtSize = /* @__PURE__ */ __name((s) => {
|
|
278
|
+
const subTokenArray = s.split("-");
|
|
279
|
+
return subTokenArray[subTokenArray.length - 1];
|
|
280
|
+
}, "getTShirtSize");
|
|
281
|
+
var getTypographySize = /* @__PURE__ */ __name((s) => {
|
|
282
|
+
const subTokenArray = s.split("-");
|
|
283
|
+
return subTokenArray[subTokenArray.length - 1];
|
|
284
|
+
}, "getTypographySize");
|
|
285
|
+
var getDim = /* @__PURE__ */ __name((s) => {
|
|
286
|
+
const subTokenArray = s.split("-");
|
|
287
|
+
const dimStr = subTokenArray[subTokenArray.length - 1];
|
|
288
|
+
if (dimStr) {
|
|
289
|
+
const dimTokenArray = s.split("x");
|
|
290
|
+
return dimTokenArray ? {
|
|
291
|
+
w: Number(dimTokenArray[0]),
|
|
292
|
+
h: Number(dimTokenArray[1])
|
|
293
|
+
} : void 0;
|
|
294
|
+
}
|
|
295
|
+
return void 0;
|
|
296
|
+
}, "getDim");
|
|
297
|
+
function getSpecifierData(main, getPrimary, getData, def) {
|
|
298
|
+
const primary = getPrimary(main);
|
|
299
|
+
if (primary) {
|
|
300
|
+
return getData(primary) ?? def;
|
|
301
|
+
}
|
|
302
|
+
return def ?? void 0;
|
|
303
|
+
}
|
|
304
|
+
__name(getSpecifierData, "getSpecifierData");
|
|
305
|
+
|
|
306
|
+
// util/number-abbreviate.ts
|
|
307
|
+
var ABBR_SYMBOLS_ARRAY = ["K", "M", "B", "T"];
|
|
308
|
+
|
|
309
|
+
// util/index.ts
|
|
310
|
+
var import_clsx = require("clsx");
|
|
311
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
312
|
+
function cn(...inputs) {
|
|
313
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
314
|
+
}
|
|
315
|
+
__name(cn, "cn");
|
|
316
|
+
function formatDate(input) {
|
|
317
|
+
const date = new Date(input);
|
|
318
|
+
return date.toLocaleDateString("en-US", {
|
|
319
|
+
month: "long",
|
|
320
|
+
day: "numeric",
|
|
321
|
+
year: "numeric"
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
__name(formatDate, "formatDate");
|
|
325
|
+
function absoluteUrl(path) {
|
|
326
|
+
if (typeof window !== "undefined") return path;
|
|
327
|
+
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}${path}`;
|
|
328
|
+
return `http://localhost:${process.env.PORT ?? 3e3}${path}`;
|
|
329
|
+
}
|
|
330
|
+
__name(absoluteUrl, "absoluteUrl");
|
|
331
|
+
function constrain(value, minOrConstrainTo, max) {
|
|
332
|
+
if (typeof value === "number" && typeof minOrConstrainTo === "number" && typeof max === "number") {
|
|
333
|
+
return Math.min(Math.max(value, minOrConstrainTo), max);
|
|
334
|
+
}
|
|
335
|
+
if (typeof value === "object" && typeof minOrConstrainTo === "object") {
|
|
336
|
+
const dim = value;
|
|
337
|
+
const constrainTo = minOrConstrainTo;
|
|
338
|
+
const aspectRatio = dim.w / dim.h;
|
|
339
|
+
const constrainAspectRatio = constrainTo.w / constrainTo.h;
|
|
340
|
+
if (aspectRatio > constrainAspectRatio) {
|
|
341
|
+
return {
|
|
342
|
+
w: constrainTo.w,
|
|
343
|
+
h: constrainTo.w / aspectRatio
|
|
344
|
+
};
|
|
345
|
+
} else {
|
|
346
|
+
return {
|
|
347
|
+
w: constrainTo.h * aspectRatio,
|
|
348
|
+
h: constrainTo.h
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
throw new Error("Invalid parameters for constrain function");
|
|
353
|
+
}
|
|
354
|
+
__name(constrain, "constrain");
|
|
355
|
+
function round(value) {
|
|
356
|
+
return Math.round(value * 100) / 100;
|
|
357
|
+
}
|
|
358
|
+
__name(round, "round");
|
|
359
|
+
function pxToRem(px, base = 16) {
|
|
360
|
+
return `${px / base}rem`;
|
|
361
|
+
}
|
|
362
|
+
__name(pxToRem, "pxToRem");
|
|
363
|
+
function pxToEm(px, base = 16) {
|
|
364
|
+
return `${px / base}em`;
|
|
365
|
+
}
|
|
366
|
+
__name(pxToEm, "pxToEm");
|
|
367
|
+
function containsToken(text, token) {
|
|
368
|
+
return text.toLowerCase().includes(token.toLowerCase());
|
|
369
|
+
}
|
|
370
|
+
__name(containsToken, "containsToken");
|
|
371
|
+
function ldMerge(...objects) {
|
|
372
|
+
const result = {};
|
|
373
|
+
for (const obj of objects) {
|
|
374
|
+
if (obj && typeof obj === "object") {
|
|
375
|
+
Object.assign(result, obj);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return result;
|
|
379
|
+
}
|
|
380
|
+
__name(ldMerge, "ldMerge");
|
|
381
|
+
function asNum(value, defaultValue = 0) {
|
|
382
|
+
const num = Number(value);
|
|
383
|
+
return isNaN(num) ? defaultValue : num;
|
|
384
|
+
}
|
|
385
|
+
__name(asNum, "asNum");
|