@windrun-huaiin/third-ui 5.11.4 → 5.11.5
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/dist/main/index.js +40 -30
- package/dist/main/index.js.map +1 -1
- package/dist/main/index.mjs +31 -21
- package/dist/main/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/main/gallery.tsx +24 -7
package/dist/main/index.js
CHANGED
|
@@ -3077,13 +3077,16 @@ function GradientButton({
|
|
|
3077
3077
|
}
|
|
3078
3078
|
|
|
3079
3079
|
// src/main/gallery.tsx
|
|
3080
|
+
var import_react36 = require("react");
|
|
3080
3081
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3081
3082
|
function Gallery({ sectionClassName }) {
|
|
3082
3083
|
const t = (0, import_next_intl.useTranslations)("gallery");
|
|
3083
3084
|
const galleryItems = t.raw("prompts");
|
|
3084
|
-
const
|
|
3085
|
+
const defaultImgUrl = t.raw("defaultImgUrl");
|
|
3086
|
+
const [imageErrors, setImageErrors] = (0, import_react36.useState)(/* @__PURE__ */ new Set());
|
|
3087
|
+
const handleDownload = (item, index) => __async(null, null, function* () {
|
|
3085
3088
|
try {
|
|
3086
|
-
const response = yield fetch(
|
|
3089
|
+
const response = yield fetch(item.url);
|
|
3087
3090
|
const blob = yield response.blob();
|
|
3088
3091
|
const url = window.URL.createObjectURL(blob);
|
|
3089
3092
|
const a = document.createElement("a");
|
|
@@ -3097,6 +3100,12 @@ function Gallery({ sectionClassName }) {
|
|
|
3097
3100
|
console.error("Download failed:", error);
|
|
3098
3101
|
}
|
|
3099
3102
|
});
|
|
3103
|
+
const handleImageError = (index) => {
|
|
3104
|
+
setImageErrors((prev) => new Set(prev).add(index));
|
|
3105
|
+
};
|
|
3106
|
+
const getImageSrc = (item, index) => {
|
|
3107
|
+
return imageErrors.has(index) ? defaultImgUrl : item.url;
|
|
3108
|
+
};
|
|
3100
3109
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { id: "gallery", className: cn("container mx-auto px-4 py-20 scroll-mt-20", sectionClassName), children: [
|
|
3101
3110
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("h2", { className: "text-3xl md:text-4xl font-bold text-center mb-6", children: [
|
|
3102
3111
|
t("titleL"),
|
|
@@ -3106,21 +3115,22 @@ function Gallery({ sectionClassName }) {
|
|
|
3106
3115
|
t("titleR")
|
|
3107
3116
|
] }),
|
|
3108
3117
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-center max-w-2xl mx-auto mb-16", children: t("description") }),
|
|
3109
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6", children: galleryItems.map((
|
|
3118
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6", children: galleryItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "group relative overflow-hidden rounded-xl", children: [
|
|
3110
3119
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3111
3120
|
import_image.default,
|
|
3112
3121
|
{
|
|
3113
|
-
src:
|
|
3114
|
-
alt:
|
|
3122
|
+
src: getImageSrc(item, index),
|
|
3123
|
+
alt: item.altMsg,
|
|
3115
3124
|
width: 600,
|
|
3116
3125
|
height: 600,
|
|
3117
|
-
className: "w-full h-80 object-cover transition duration-300 group-hover:scale-105"
|
|
3126
|
+
className: "w-full h-80 object-cover transition duration-300 group-hover:scale-105",
|
|
3127
|
+
onError: () => handleImageError(index)
|
|
3118
3128
|
}
|
|
3119
3129
|
),
|
|
3120
3130
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "absolute inset-0 flex items-end justify-end p-4 opacity-0 group-hover:opacity-100 transition duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3121
3131
|
"button",
|
|
3122
3132
|
{
|
|
3123
|
-
onClick: () => handleDownload(index),
|
|
3133
|
+
onClick: () => handleDownload(item, index),
|
|
3124
3134
|
className: "bg-black/50 hover:bg-black/70 p-2 rounded-full text-white/80 hover:text-white transition-all duration-300",
|
|
3125
3135
|
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(globalLucideIcons.Download, { className: "h-5 w-5 text-white" })
|
|
3126
3136
|
}
|
|
@@ -3217,13 +3227,13 @@ function Tips({ sectionClassName }) {
|
|
|
3217
3227
|
}
|
|
3218
3228
|
|
|
3219
3229
|
// src/main/faq.tsx
|
|
3220
|
-
var
|
|
3230
|
+
var import_react37 = require("react");
|
|
3221
3231
|
var import_next_intl5 = require("next-intl");
|
|
3222
3232
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3223
3233
|
function FAQ({ sectionClassName }) {
|
|
3224
3234
|
const t = (0, import_next_intl5.useTranslations)("faq");
|
|
3225
3235
|
const items = t.raw("items");
|
|
3226
|
-
const [openArr, setOpenArr] = (0,
|
|
3236
|
+
const [openArr, setOpenArr] = (0, import_react37.useState)(() => items.map(() => false));
|
|
3227
3237
|
const handleToggle = (idx) => {
|
|
3228
3238
|
setOpenArr((prev) => {
|
|
3229
3239
|
const next = [...prev];
|
|
@@ -3353,11 +3363,11 @@ function Footer() {
|
|
|
3353
3363
|
}
|
|
3354
3364
|
|
|
3355
3365
|
// src/main/go-to-top.tsx
|
|
3356
|
-
var
|
|
3366
|
+
var import_react38 = require("react");
|
|
3357
3367
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3358
3368
|
function GoToTop() {
|
|
3359
|
-
const [isVisible, setIsVisible] = (0,
|
|
3360
|
-
(0,
|
|
3369
|
+
const [isVisible, setIsVisible] = (0, import_react38.useState)(false);
|
|
3370
|
+
(0, import_react38.useEffect)(() => {
|
|
3361
3371
|
const toggleVisibility = () => {
|
|
3362
3372
|
if (window.scrollY > 300) {
|
|
3363
3373
|
setIsVisible(true);
|
|
@@ -3482,12 +3492,12 @@ function Loading() {
|
|
|
3482
3492
|
// src/main/nprogress-bar.tsx
|
|
3483
3493
|
var import_nprogress = __toESM(require("nprogress"));
|
|
3484
3494
|
var import_navigation = require("next/navigation");
|
|
3485
|
-
var
|
|
3495
|
+
var import_react39 = require("react");
|
|
3486
3496
|
import_nprogress.default.configure({ showSpinner: false });
|
|
3487
3497
|
function NProgressBar() {
|
|
3488
3498
|
const pathname = (0, import_navigation.usePathname)();
|
|
3489
|
-
const previousPath = (0,
|
|
3490
|
-
(0,
|
|
3499
|
+
const previousPath = (0, import_react39.useRef)(pathname);
|
|
3500
|
+
(0, import_react39.useEffect)(() => {
|
|
3491
3501
|
if (previousPath.current !== pathname) {
|
|
3492
3502
|
import_nprogress.default.start();
|
|
3493
3503
|
setTimeout(() => {
|
|
@@ -3500,7 +3510,7 @@ function NProgressBar() {
|
|
|
3500
3510
|
}
|
|
3501
3511
|
|
|
3502
3512
|
// src/main/price-plan.tsx
|
|
3503
|
-
var
|
|
3513
|
+
var import_react40 = require("react");
|
|
3504
3514
|
var import_next_intl9 = require("next-intl");
|
|
3505
3515
|
var import_navigation2 = require("next/navigation");
|
|
3506
3516
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
@@ -3513,8 +3523,8 @@ function PricePlan({ currency = "$", pricePlanConfig, sectionClassName }) {
|
|
|
3513
3523
|
const billingOptions = pricePlanConfig.billingOptions;
|
|
3514
3524
|
const prices = pricePlanConfig.prices;
|
|
3515
3525
|
const minPlanFeaturesCount = pricePlanConfig.minPlanFeaturesCount;
|
|
3516
|
-
const [billingKey, setBillingKey] = (0,
|
|
3517
|
-
const [tooltip, setTooltip] = (0,
|
|
3526
|
+
const [billingKey, setBillingKey] = (0, import_react40.useState)(billingSwitch.defaultKey);
|
|
3527
|
+
const [tooltip, setTooltip] = (0, import_react40.useState)({ show: false, content: "", x: 0, y: 0 });
|
|
3518
3528
|
const currentBilling = billingOptions.find((opt) => opt.key === billingKey) || billingOptions[0];
|
|
3519
3529
|
const currentBillingDisplay = billingSwitch.options.find((opt) => opt.key === billingKey) || billingSwitch.options[0];
|
|
3520
3530
|
const maxFeaturesCount = Math.max(
|
|
@@ -3723,7 +3733,7 @@ function PricePlan({ currency = "$", pricePlanConfig, sectionClassName }) {
|
|
|
3723
3733
|
}
|
|
3724
3734
|
|
|
3725
3735
|
// src/main/ads-alert-dialog.tsx
|
|
3726
|
-
var
|
|
3736
|
+
var import_react42 = require("react");
|
|
3727
3737
|
var import_image2 = __toESM(require("next/image"));
|
|
3728
3738
|
|
|
3729
3739
|
// ../base-ui/src/ui/alert-dialog.tsx
|
|
@@ -4631,9 +4641,9 @@ function assignRef(ref, value) {
|
|
|
4631
4641
|
}
|
|
4632
4642
|
|
|
4633
4643
|
// ../../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@19.1.2_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
4634
|
-
var
|
|
4644
|
+
var import_react41 = require("react");
|
|
4635
4645
|
function useCallbackRef2(initialValue, callback) {
|
|
4636
|
-
var ref = (0,
|
|
4646
|
+
var ref = (0, import_react41.useState)(function() {
|
|
4637
4647
|
return {
|
|
4638
4648
|
// value
|
|
4639
4649
|
value: initialValue,
|
|
@@ -5991,7 +6001,7 @@ function AdsAlertDialog({
|
|
|
5991
6001
|
confirmText,
|
|
5992
6002
|
onConfirm
|
|
5993
6003
|
}) {
|
|
5994
|
-
const [imgError, setImgError] = (0,
|
|
6004
|
+
const [imgError, setImgError] = (0, import_react42.useState)(false);
|
|
5995
6005
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(AlertDialog2, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
5996
6006
|
AlertDialogContent2,
|
|
5997
6007
|
{
|
|
@@ -6074,14 +6084,14 @@ function AdsAlertDialog({
|
|
|
6074
6084
|
}
|
|
6075
6085
|
|
|
6076
6086
|
// src/main/x-button.tsx
|
|
6077
|
-
var
|
|
6087
|
+
var import_react43 = require("react");
|
|
6078
6088
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6079
6089
|
function XButton(props) {
|
|
6080
6090
|
var _a, _b;
|
|
6081
|
-
const [isLoading, setIsLoading] = (0,
|
|
6082
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
6083
|
-
const menuRef = (0,
|
|
6084
|
-
(0,
|
|
6091
|
+
const [isLoading, setIsLoading] = (0, import_react43.useState)(false);
|
|
6092
|
+
const [menuOpen, setMenuOpen] = (0, import_react43.useState)(false);
|
|
6093
|
+
const menuRef = (0, import_react43.useRef)(null);
|
|
6094
|
+
(0, import_react43.useEffect)(() => {
|
|
6085
6095
|
if (props.type === "split") {
|
|
6086
6096
|
const handleClickOutside = (event) => {
|
|
6087
6097
|
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
@@ -6204,7 +6214,7 @@ function XButton(props) {
|
|
|
6204
6214
|
}
|
|
6205
6215
|
|
|
6206
6216
|
// src/main/ai-prompt-textarea.tsx
|
|
6207
|
-
var
|
|
6217
|
+
var import_react44 = require("react");
|
|
6208
6218
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6209
6219
|
function AIPromptTextarea({
|
|
6210
6220
|
value,
|
|
@@ -6225,7 +6235,7 @@ function AIPromptTextarea({
|
|
|
6225
6235
|
description,
|
|
6226
6236
|
embed = false
|
|
6227
6237
|
}) {
|
|
6228
|
-
const textareaRef = (0,
|
|
6238
|
+
const textareaRef = (0, import_react44.useRef)(null);
|
|
6229
6239
|
const wordArray = value.trim().split(/\s+/).filter(Boolean);
|
|
6230
6240
|
const wordCount = wordArray.length;
|
|
6231
6241
|
const adjustTextareaHeight = () => {
|
|
@@ -6253,7 +6263,7 @@ function AIPromptTextarea({
|
|
|
6253
6263
|
}
|
|
6254
6264
|
}
|
|
6255
6265
|
};
|
|
6256
|
-
(0,
|
|
6266
|
+
(0, import_react44.useEffect)(() => {
|
|
6257
6267
|
const timer = setTimeout(() => {
|
|
6258
6268
|
adjustTextareaHeight();
|
|
6259
6269
|
}, 0);
|