@windrun-huaiin/third-ui 25.0.0 → 27.0.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.
- package/dist/ai/ai-prompt-textarea.d.ts +72 -0
- package/dist/ai/ai-prompt-textarea.js +114 -0
- package/dist/ai/ai-prompt-textarea.mjs +112 -0
- package/dist/ai/index.d.ts +1 -0
- package/dist/ai/index.js +2 -0
- package/dist/ai/index.mjs +1 -0
- package/dist/clerk/clerk-provider-client.js +0 -1
- package/dist/clerk/clerk-provider-client.mjs +0 -1
- package/dist/clerk/fingerprint/fingerprint-client.js +0 -4
- package/dist/clerk/fingerprint/fingerprint-client.mjs +0 -4
- package/dist/clerk/fingerprint/use-fingerprint.js +0 -6
- package/dist/clerk/fingerprint/use-fingerprint.mjs +0 -6
- package/dist/clerk/signin-with-fingerprint-client.js +0 -9
- package/dist/clerk/signin-with-fingerprint-client.mjs +0 -9
- package/dist/clerk/signup-button-with-fingerprint-client.js +0 -16
- package/dist/clerk/signup-button-with-fingerprint-client.mjs +0 -16
- package/dist/clerk/signup-with-fingerprint-client.js +0 -9
- package/dist/clerk/signup-with-fingerprint-client.mjs +0 -9
- package/dist/fuma/base/custom-header.js +10 -8
- package/dist/fuma/base/custom-header.mjs +10 -8
- package/dist/fuma/base/custom-home-layout.d.ts +1 -0
- package/dist/fuma/base/index.d.ts +1 -0
- package/dist/fuma/base/index.js +4 -0
- package/dist/fuma/base/index.mjs +1 -0
- package/dist/fuma/base/nav-config.d.ts +10 -0
- package/dist/fuma/base/nav-config.js +32 -0
- package/dist/fuma/base/nav-config.mjs +28 -0
- package/dist/fuma/base/site-layout.d.ts +4 -0
- package/dist/fuma/base/site-layout.js +2 -2
- package/dist/fuma/base/site-layout.mjs +2 -2
- package/dist/fuma/fuma-page-genarator.d.ts +1 -1
- package/dist/fuma/fuma-page-genarator.js +60 -5
- package/dist/fuma/fuma-page-genarator.mjs +60 -5
- package/dist/fuma/llm-copy-handler.js +0 -9
- package/dist/fuma/llm-copy-handler.mjs +0 -9
- package/dist/fuma/mdx/index.d.ts +0 -1
- package/dist/fuma/mdx/index.js +0 -2
- package/dist/fuma/mdx/index.mjs +0 -1
- package/dist/fuma/mdx/suno-embed.js +3 -1
- package/dist/fuma/mdx/suno-embed.mjs +3 -1
- package/dist/fuma/mdx/toc-base.js +0 -1
- package/dist/fuma/mdx/toc-base.mjs +0 -1
- package/dist/fuma/server/features/widgets.js +5 -1
- package/dist/fuma/server/features/widgets.mjs +5 -1
- package/dist/lib/site-docs-helper.d.ts +51 -0
- package/dist/lib/site-docs-helper.js +68 -0
- package/dist/lib/site-docs-helper.mjs +66 -0
- package/dist/main/alert-dialog/index.js +14 -0
- package/dist/main/alert-dialog/index.mjs +5 -0
- package/dist/main/buttons/gradient-button.d.ts +20 -0
- package/dist/main/buttons/gradient-button.js +88 -0
- package/dist/main/buttons/gradient-button.mjs +86 -0
- package/dist/main/buttons/index.d.ts +3 -0
- package/dist/main/buttons/index.js +12 -0
- package/dist/main/buttons/index.mjs +4 -0
- package/dist/main/buttons/x-button.d.ts +39 -0
- package/dist/main/buttons/x-button.js +92 -0
- package/dist/main/buttons/x-button.mjs +90 -0
- package/dist/main/buttons/x-toggle-button.d.ts +32 -0
- package/dist/main/buttons/x-toggle-button.js +95 -0
- package/dist/main/buttons/x-toggle-button.mjs +74 -0
- package/dist/main/credit/credit-overview-client.js +3 -2
- package/dist/main/credit/credit-overview-client.mjs +3 -2
- package/dist/main/credit/index.d.ts +4 -0
- package/dist/main/credit/index.js +10 -0
- package/dist/main/credit/index.mjs +3 -0
- package/dist/main/credit/server.d.ts +2 -0
- package/dist/main/credit/server.js +7 -0
- package/dist/main/credit/server.mjs +1 -0
- package/dist/main/cta.js +4 -2
- package/dist/main/cta.mjs +4 -2
- package/dist/main/hero/index.d.ts +2 -0
- package/dist/main/hero/index.js +10 -0
- package/dist/main/hero/index.mjs +3 -0
- package/dist/main/home/server.d.ts +7 -0
- package/dist/main/home/server.js +19 -0
- package/dist/main/home/server.mjs +7 -0
- package/dist/main/index.d.ts +0 -15
- package/dist/main/index.js +0 -43
- package/dist/main/index.mjs +0 -21
- package/dist/main/loading/index.d.ts +1 -0
- package/dist/main/loading/index.js +9 -0
- package/dist/main/loading/index.mjs +2 -0
- package/dist/main/loading-frame/index.d.ts +1 -0
- package/dist/main/loading-frame/index.js +9 -0
- package/dist/main/loading-frame/index.mjs +2 -0
- package/dist/main/money-price/index.d.ts +4 -0
- package/dist/main/money-price/index.js +15 -0
- package/dist/main/money-price/index.mjs +4 -0
- package/dist/main/money-price/money-price-button.d.ts +1 -1
- package/dist/main/money-price/money-price-button.js +10 -7
- package/dist/main/money-price/money-price-button.mjs +10 -7
- package/dist/main/money-price/money-price-interactive.js +9 -8
- package/dist/main/money-price/money-price-interactive.mjs +9 -8
- package/dist/main/money-price/money-price-types.d.ts +1 -0
- package/dist/main/money-price/server.d.ts +5 -0
- package/dist/main/money-price/server.js +18 -0
- package/dist/main/money-price/server.mjs +4 -0
- package/package.json +54 -4
- package/src/ai/index.ts +1 -0
- package/src/clerk/clerk-provider-client.tsx +1 -3
- package/src/clerk/fingerprint/fingerprint-client.ts +0 -4
- package/src/clerk/fingerprint/use-fingerprint.ts +0 -6
- package/src/clerk/signin-with-fingerprint-client.tsx +0 -10
- package/src/clerk/signup-button-with-fingerprint-client.tsx +0 -17
- package/src/clerk/signup-with-fingerprint-client.tsx +0 -10
- package/src/fuma/base/custom-header.tsx +12 -8
- package/src/fuma/base/custom-home-layout.tsx +7 -4
- package/src/fuma/base/index.ts +1 -0
- package/src/fuma/base/nav-config.ts +81 -0
- package/src/fuma/base/site-layout.tsx +6 -0
- package/src/fuma/fuma-banner-suit.tsx +1 -1
- package/src/fuma/fuma-page-genarator.tsx +60 -7
- package/src/fuma/llm-copy-handler.ts +0 -11
- package/src/fuma/mdx/index.ts +0 -1
- package/src/fuma/mdx/suno-embed.tsx +1 -1
- package/src/fuma/mdx/toc-base.tsx +0 -1
- package/src/fuma/mdx/toc-footer-wrapper.tsx +2 -2
- package/src/fuma/server/features/widgets.tsx +1 -1
- package/src/lib/server.ts +1 -1
- package/src/{fuma/mdx → main/buttons}/gradient-button.tsx +10 -21
- package/src/main/buttons/index.ts +5 -0
- package/src/main/{x-button.tsx → buttons/x-button.tsx} +28 -42
- package/src/main/credit/credit-overview-client.tsx +1 -1
- package/src/main/credit/index.ts +11 -0
- package/src/main/credit/server.ts +7 -0
- package/src/main/cta.tsx +1 -1
- package/src/main/hero/index.ts +4 -0
- package/src/main/home/server.ts +7 -0
- package/src/main/index.ts +1 -20
- package/src/main/language-detector.tsx +0 -1
- package/src/main/loading/index.ts +3 -0
- package/src/main/loading-frame/index.ts +3 -0
- package/src/main/money-price/index.ts +18 -0
- package/src/main/money-price/money-price-button.tsx +12 -6
- package/src/main/money-price/money-price-interactive.tsx +17 -10
- package/src/main/money-price/money-price-types.ts +1 -0
- package/src/main/money-price/server.ts +22 -0
- package/dist/fuma/mdx/features.d.ts +0 -8
- package/dist/fuma/mdx/features.js +0 -92
- package/dist/fuma/mdx/features.mjs +0 -85
- package/dist/fuma/mdx/image-grid.d.ts +0 -6
- package/dist/fuma/mdx/image-grid.js +0 -17
- package/dist/fuma/mdx/image-grid.mjs +0 -15
- package/dist/fuma/mdx/image-zoom.d.ts +0 -22
- package/dist/fuma/mdx/image-zoom.js +0 -39
- package/dist/fuma/mdx/image-zoom.mjs +0 -37
- package/dist/fuma/mdx/markdown-component-map.d.ts +0 -3
- package/dist/fuma/mdx/markdown-component-map.js +0 -79
- package/dist/fuma/mdx/markdown-component-map.mjs +0 -77
- package/dist/fuma/mdx/math.d.ts +0 -17
- package/dist/fuma/mdx/math.js +0 -60
- package/dist/fuma/mdx/math.mjs +0 -57
- package/dist/fuma/mdx/mermaid.d.ts +0 -13
- package/dist/fuma/mdx/mermaid.js +0 -360
- package/dist/fuma/mdx/mermaid.mjs +0 -358
- package/dist/fuma/mdx/site-mdx-components.d.ts +0 -13
- package/dist/fuma/mdx/site-mdx-components.js +0 -19
- package/dist/fuma/mdx/site-mdx-components.mjs +0 -17
- package/dist/fuma/mdx/site-mdx-presets.d.ts +0 -13
- package/dist/fuma/mdx/site-mdx-presets.js +0 -49
- package/dist/fuma/mdx/site-mdx-presets.mjs +0 -45
- package/dist/fuma/server/optional-features.d.ts +0 -6
- package/dist/fuma/server/optional-features.js +0 -17
- package/dist/fuma/server/optional-features.mjs +0 -6
- package/dist/fuma/server/site-mdx-components.d.ts +0 -13
- package/dist/fuma/server/site-mdx-components.js +0 -18
- package/dist/fuma/server/site-mdx-components.mjs +0 -16
- package/dist/fuma/server/site-mdx-presets.d.ts +0 -195
- package/dist/fuma/server/site-mdx-presets.js +0 -55
- package/dist/fuma/server/site-mdx-presets.mjs +0 -52
- /package/src/{main → ai}/ai-prompt-textarea.tsx +0 -0
- /package/src/main/{x-toggle-button.tsx → buttons/x-toggle-button.tsx} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
export { CreditOverviewClient } from './credit-overview-client';
|
|
4
|
+
export { CreditNavButton } from './credit-nav-button';
|
|
5
|
+
export type { CreditOverviewTranslations } from './credit-overview-client';
|
|
6
|
+
export type {
|
|
7
|
+
CreditOverviewData,
|
|
8
|
+
CreditBucket,
|
|
9
|
+
CreditBucketStatus,
|
|
10
|
+
SubscriptionInfo,
|
|
11
|
+
} from './types';
|
package/src/main/cta.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getTranslations } from 'next-intl/server';
|
|
2
|
-
import { GradientButton } from "
|
|
2
|
+
import { GradientButton } from "./buttons";
|
|
3
3
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
4
4
|
import { themeIconColor } from '@windrun-huaiin/base-ui/lib';
|
|
5
5
|
import { richText } from './rich-text-expert';
|
package/src/main/index.ts
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// Lightweight common client components.
|
|
4
4
|
export * from './go-to-top';
|
|
5
5
|
export * from './loading';
|
|
6
6
|
export * from './nprogress-bar';
|
|
7
|
-
export * from './alert-dialog';
|
|
8
|
-
export * from './x-button'
|
|
9
|
-
export * from './x-toggle-button'
|
|
10
|
-
export * from './ai-prompt-textarea'
|
|
11
7
|
export * from './rich-text-expert'
|
|
12
8
|
export * from './faq-interactive'
|
|
13
|
-
export * from './price-plan-interactive'
|
|
14
|
-
export * from './gallery/gallery-interactive'
|
|
15
|
-
export * from './delayed-img'
|
|
16
|
-
export * from './snake-loading-frame'
|
|
17
|
-
export * from './pill-select'
|
|
18
|
-
// Money Price Client Components
|
|
19
|
-
export { MoneyPriceInteractive } from './money-price/money-price-interactive';
|
|
20
|
-
export { MoneyPriceButton } from './money-price/money-price-button';
|
|
21
|
-
|
|
22
|
-
export { CreditOverviewClient } from './credit/credit-overview-client';
|
|
23
|
-
export { CreditNavButton } from './credit/credit-nav-button';
|
|
24
|
-
|
|
25
|
-
export { HeroMedia } from './hero-media';
|
|
26
|
-
export { HeroSection } from './hero-section';
|
|
27
|
-
|
|
28
9
|
export { InfoTooltip } from './info-tooltip';
|
|
@@ -76,7 +76,6 @@ export function LanguageDetector({ i18nConfig }: LanguageDetectorProps) {
|
|
|
76
76
|
|
|
77
77
|
// Use the automatic closing time from the configuration
|
|
78
78
|
const timer = setTimeout(() => {
|
|
79
|
-
console.log('[LanguageDetector] Auto closing after timeout')
|
|
80
79
|
setShow(false)
|
|
81
80
|
// Save the rejected state when the automatic closing occurs
|
|
82
81
|
savePreference(browserLang, 'rejected')
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
export { MoneyPriceInteractive } from './money-price-interactive';
|
|
4
|
+
export { MoneyPriceButton } from './money-price-button';
|
|
5
|
+
export type {
|
|
6
|
+
MoneyPriceConfig,
|
|
7
|
+
MoneyPriceData,
|
|
8
|
+
InitUserContext,
|
|
9
|
+
MoneyPriceInteractiveProps,
|
|
10
|
+
MoneyPriceButtonProps,
|
|
11
|
+
PaymentProvider,
|
|
12
|
+
PaymentProviderConfig,
|
|
13
|
+
EnhancePricePlan,
|
|
14
|
+
SubscriptionProductConfig,
|
|
15
|
+
CreditPackProductConfig,
|
|
16
|
+
UserContext,
|
|
17
|
+
} from './money-price-types';
|
|
18
|
+
export { UserState } from './money-price-types';
|
|
@@ -14,6 +14,7 @@ export function MoneyPriceButton({
|
|
|
14
14
|
onAction,
|
|
15
15
|
texts,
|
|
16
16
|
isProcessing = false,
|
|
17
|
+
isAnyProcessing = false,
|
|
17
18
|
isInitLoading = false,
|
|
18
19
|
enableSubscriptionUpgrade = true
|
|
19
20
|
}: MoneyPriceButtonProps) {
|
|
@@ -224,19 +225,24 @@ export function MoneyPriceButton({
|
|
|
224
225
|
|
|
225
226
|
if (config.hidden) return null;
|
|
226
227
|
|
|
228
|
+
const hasActiveSubscription =
|
|
229
|
+
subscriptionStatus === UserState.ProUser ||
|
|
230
|
+
subscriptionStatus === UserState.UltraUser;
|
|
231
|
+
|
|
227
232
|
if (
|
|
228
233
|
!enableSubscriptionUpgrade &&
|
|
229
234
|
billingType !== 'onetime' &&
|
|
235
|
+
hasActiveSubscription &&
|
|
230
236
|
config.text === texts.upgrade &&
|
|
231
237
|
typeof config.onClick === 'function'
|
|
232
238
|
) {
|
|
233
239
|
return null;
|
|
234
240
|
}
|
|
235
241
|
|
|
236
|
-
const
|
|
237
|
-
const isDisabled = config.disabled ||
|
|
238
|
-
const displayText =
|
|
239
|
-
const isDisabledByConfigOnly = config.disabled && !
|
|
242
|
+
const isCurrentButtonBusy = isLoading || isProcessing;
|
|
243
|
+
const isDisabled = config.disabled || isCurrentButtonBusy || isAnyProcessing;
|
|
244
|
+
const displayText = isCurrentButtonBusy ? 'Processing...' : config.text;
|
|
245
|
+
const isDisabledByConfigOnly = config.disabled && !isCurrentButtonBusy && !isAnyProcessing;
|
|
240
246
|
|
|
241
247
|
const handleClick = async (e: React.MouseEvent) => {
|
|
242
248
|
if (isDisabled) {
|
|
@@ -265,9 +271,9 @@ export function MoneyPriceButton({
|
|
|
265
271
|
isDisabledByConfigOnly
|
|
266
272
|
? 'bg-gray-400 cursor-not-allowed'
|
|
267
273
|
: themeButtonGradientClass,
|
|
268
|
-
!isDisabledByConfigOnly && !
|
|
274
|
+
!isDisabledByConfigOnly && !isCurrentButtonBusy && !isAnyProcessing &&
|
|
269
275
|
themeButtonGradientHoverClass,
|
|
270
|
-
|
|
276
|
+
(isCurrentButtonBusy || isAnyProcessing) && !isDisabledByConfigOnly && 'opacity-70 cursor-not-allowed'
|
|
271
277
|
);
|
|
272
278
|
|
|
273
279
|
return (
|
|
@@ -21,6 +21,10 @@ import { redirectToCustomerPortal } from './customer-portal';
|
|
|
21
21
|
import { themeButtonGradientClass, themeButtonGradientHoverClass, themeIconColor } from '@windrun-huaiin/base-ui/lib';
|
|
22
22
|
|
|
23
23
|
type BillingType = string;
|
|
24
|
+
type ProcessingTarget = {
|
|
25
|
+
plan: string;
|
|
26
|
+
billing: string;
|
|
27
|
+
} | null;
|
|
24
28
|
|
|
25
29
|
interface BillingOption {
|
|
26
30
|
key: string;
|
|
@@ -161,7 +165,7 @@ export function MoneyPriceInteractive({
|
|
|
161
165
|
setBillingType(prev => (prev === initialBillingCandidate ? prev : initialBillingCandidate));
|
|
162
166
|
}, [initialBillingCandidate]);
|
|
163
167
|
|
|
164
|
-
const [
|
|
168
|
+
const [processingTarget, setProcessingTarget] = useState<ProcessingTarget>(null);
|
|
165
169
|
const [isTouchDevice, setIsTouchDevice] = useState(false);
|
|
166
170
|
|
|
167
171
|
useEffect(() => {
|
|
@@ -231,23 +235,22 @@ export function MoneyPriceInteractive({
|
|
|
231
235
|
|
|
232
236
|
const handleAction = useCallback(async (plan: string, billing: string) => {
|
|
233
237
|
const isSubscriptionFlow = billing !== 'onetime';
|
|
238
|
+
const hasActiveSubscription =
|
|
239
|
+
userContext.isAuthenticated &&
|
|
240
|
+
(userContext.subscriptionStatus === UserState.ProUser ||
|
|
241
|
+
userContext.subscriptionStatus === UserState.UltraUser);
|
|
234
242
|
|
|
235
|
-
if (isSubscriptionFlow && !enableSubscriptionUpgrade) {
|
|
243
|
+
if (isSubscriptionFlow && hasActiveSubscription && !enableSubscriptionUpgrade) {
|
|
236
244
|
return;
|
|
237
245
|
}
|
|
238
246
|
|
|
239
247
|
navigationLockRef.current = false;
|
|
240
|
-
|
|
248
|
+
setProcessingTarget({ plan, billing });
|
|
241
249
|
const markNavigating = () => {
|
|
242
250
|
navigationLockRef.current = true;
|
|
243
251
|
};
|
|
244
252
|
|
|
245
253
|
try {
|
|
246
|
-
const hasActiveSubscription =
|
|
247
|
-
userContext.isAuthenticated &&
|
|
248
|
-
(userContext.subscriptionStatus === UserState.ProUser ||
|
|
249
|
-
userContext.subscriptionStatus === UserState.UltraUser);
|
|
250
|
-
|
|
251
254
|
const shouldUsePortal = isSubscriptionFlow && hasActiveSubscription;
|
|
252
255
|
|
|
253
256
|
if (shouldUsePortal) {
|
|
@@ -327,7 +330,7 @@ export function MoneyPriceInteractive({
|
|
|
327
330
|
console.error('Error during upgrade:', error);
|
|
328
331
|
} finally {
|
|
329
332
|
if (!navigationLockRef.current) {
|
|
330
|
-
|
|
333
|
+
setProcessingTarget(null);
|
|
331
334
|
}
|
|
332
335
|
}
|
|
333
336
|
}, [
|
|
@@ -560,7 +563,11 @@ export function MoneyPriceInteractive({
|
|
|
560
563
|
onAuth={handleAuth}
|
|
561
564
|
onAction={handleAction}
|
|
562
565
|
texts={data.buttonTexts}
|
|
563
|
-
isProcessing={
|
|
566
|
+
isProcessing={
|
|
567
|
+
processingTarget?.plan === planKey &&
|
|
568
|
+
processingTarget?.billing === billingType
|
|
569
|
+
}
|
|
570
|
+
isAnyProcessing={!!processingTarget}
|
|
564
571
|
isInitLoading={false}
|
|
565
572
|
enableSubscriptionUpgrade={enableSubscriptionUpgrade}
|
|
566
573
|
/>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { MoneyPrice } from './money-price';
|
|
2
|
+
export {
|
|
3
|
+
getActiveProviderConfigUtil,
|
|
4
|
+
getCreditsFromPriceIdUtil,
|
|
5
|
+
getPriceConfigUtil,
|
|
6
|
+
} from './money-price-config-util';
|
|
7
|
+
export { buildMoneyPriceData } from './money-price-data';
|
|
8
|
+
export type {
|
|
9
|
+
MoneyPriceConfig,
|
|
10
|
+
MoneyPriceProps,
|
|
11
|
+
MoneyPriceInteractiveProps,
|
|
12
|
+
MoneyPriceButtonProps,
|
|
13
|
+
MoneyPriceData,
|
|
14
|
+
InitUserContext,
|
|
15
|
+
PaymentProvider,
|
|
16
|
+
PaymentProviderConfig,
|
|
17
|
+
EnhancePricePlan,
|
|
18
|
+
SubscriptionProductConfig,
|
|
19
|
+
CreditPackProductConfig,
|
|
20
|
+
UserContext,
|
|
21
|
+
} from './money-price-types';
|
|
22
|
+
export { UserState } from './money-price-types';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { MDXComponents } from 'mdx/types';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
export declare function createBaseMdxComponents(imageFallbackSrc?: string): MDXComponents;
|
|
4
|
-
export declare function createCodeMdxComponents(iconMap: Record<string, ReactNode>): MDXComponents;
|
|
5
|
-
export declare function createMathMdxComponents(): MDXComponents;
|
|
6
|
-
export declare function createMermaidMdxComponents(watermarkEnabled?: boolean, watermarkText?: string): MDXComponents;
|
|
7
|
-
export declare function createTypeTableMdxComponents(): MDXComponents;
|
|
8
|
-
export declare function createWidgetMdxComponents(cdnBaseUrl?: string, imageFallbackSrc?: string): MDXComponents;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var codeblock = require('fumadocs-ui/components/codeblock');
|
|
5
|
-
var typeTable = require('fumadocs-ui/components/type-table');
|
|
6
|
-
var fumadocsTypescript = require('fumadocs-typescript');
|
|
7
|
-
var ui = require('fumadocs-typescript/ui');
|
|
8
|
-
var markdownComponentMap = require('../share/markdown-component-map.js');
|
|
9
|
-
var imageZoom = require('../heavy/image-zoom.js');
|
|
10
|
-
var imageGrid = require('../heavy/image-grid.js');
|
|
11
|
-
var math = require('../heavy/math.js');
|
|
12
|
-
var mermaid = require('../heavy/mermaid.js');
|
|
13
|
-
var trophyCard = require('./trophy-card.js');
|
|
14
|
-
var ziaCard = require('./zia-card.js');
|
|
15
|
-
var gradientButton = require('./gradient-button.js');
|
|
16
|
-
var ziaFile = require('./zia-file.js');
|
|
17
|
-
var sunoEmbed = require('./suno-embed.js');
|
|
18
|
-
|
|
19
|
-
const typeTableGenerator = fumadocsTypescript.createGenerator();
|
|
20
|
-
function tryToMatchIcon(props, iconMap) {
|
|
21
|
-
var _a;
|
|
22
|
-
let lang;
|
|
23
|
-
const dataLanguage = props['data-language'];
|
|
24
|
-
if (dataLanguage && dataLanguage.trim() !== '') {
|
|
25
|
-
lang = dataLanguage.trim().toLowerCase();
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
const title = props.title;
|
|
29
|
-
if (title) {
|
|
30
|
-
const titleParts = title.split('.');
|
|
31
|
-
if (titleParts.length > 1 && titleParts[0] !== '') {
|
|
32
|
-
const extension = (_a = titleParts.pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
33
|
-
if (extension) {
|
|
34
|
-
lang = extension;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (lang && iconMap[lang]) {
|
|
40
|
-
return iconMap[lang];
|
|
41
|
-
}
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
function createBaseMdxComponents(imageFallbackSrc) {
|
|
45
|
-
return Object.assign(Object.assign({}, markdownComponentMap.baseMarkdownComponents), { img: (props) => (jsxRuntime.jsx(imageZoom.ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))) });
|
|
46
|
-
}
|
|
47
|
-
function createCodeMdxComponents(iconMap) {
|
|
48
|
-
return {
|
|
49
|
-
pre: (props) => {
|
|
50
|
-
const customIcon = tryToMatchIcon(props, iconMap);
|
|
51
|
-
return (jsxRuntime.jsx(codeblock.CodeBlock, Object.assign({}, props, (customIcon && { icon: customIcon }), { children: jsxRuntime.jsx(codeblock.Pre, { children: props.children }) })));
|
|
52
|
-
},
|
|
53
|
-
CodeBlock: codeblock.CodeBlock,
|
|
54
|
-
Pre: codeblock.Pre,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function createMathMdxComponents() {
|
|
58
|
-
return {
|
|
59
|
-
MathBlock: math.MathBlock,
|
|
60
|
-
InlineMath: math.InlineMath,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function createMermaidMdxComponents(watermarkEnabled, watermarkText) {
|
|
64
|
-
return {
|
|
65
|
-
Mermaid: (props) => (jsxRuntime.jsx(mermaid.Mermaid, Object.assign({}, props, { watermarkEnabled: watermarkEnabled, watermarkText: watermarkText }))),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function createTypeTableMdxComponents() {
|
|
69
|
-
return {
|
|
70
|
-
TypeTable: typeTable.TypeTable,
|
|
71
|
-
AutoTypeTable: (props) => (jsxRuntime.jsx(ui.AutoTypeTable, Object.assign({}, props, { generator: typeTableGenerator }))),
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function createWidgetMdxComponents(cdnBaseUrl, imageFallbackSrc) {
|
|
75
|
-
return {
|
|
76
|
-
TrophyCard: trophyCard.TrophyCard,
|
|
77
|
-
ZiaCard: ziaCard.ZiaCard,
|
|
78
|
-
GradientButton: gradientButton.GradientButton,
|
|
79
|
-
ZiaFile: ziaFile.ZiaFile,
|
|
80
|
-
ZiaFolder: ziaFile.ZiaFolder,
|
|
81
|
-
SunoEmbed: sunoEmbed.SunoEmbed,
|
|
82
|
-
ImageGrid: (props) => (jsxRuntime.jsx(imageGrid.ImageGrid, Object.assign({}, props, { cdnBaseUrl: cdnBaseUrl }))),
|
|
83
|
-
ImageZoom: (props) => (jsxRuntime.jsx(imageZoom.ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
exports.createBaseMdxComponents = createBaseMdxComponents;
|
|
88
|
-
exports.createCodeMdxComponents = createCodeMdxComponents;
|
|
89
|
-
exports.createMathMdxComponents = createMathMdxComponents;
|
|
90
|
-
exports.createMermaidMdxComponents = createMermaidMdxComponents;
|
|
91
|
-
exports.createTypeTableMdxComponents = createTypeTableMdxComponents;
|
|
92
|
-
exports.createWidgetMdxComponents = createWidgetMdxComponents;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Pre, CodeBlock } from 'fumadocs-ui/components/codeblock';
|
|
3
|
-
import { TypeTable } from 'fumadocs-ui/components/type-table';
|
|
4
|
-
import { createGenerator } from 'fumadocs-typescript';
|
|
5
|
-
import { AutoTypeTable } from 'fumadocs-typescript/ui';
|
|
6
|
-
import { baseMarkdownComponents } from '../share/markdown-component-map.mjs';
|
|
7
|
-
import { ImageZoom } from '../heavy/image-zoom.mjs';
|
|
8
|
-
import { ImageGrid } from '../heavy/image-grid.mjs';
|
|
9
|
-
import { InlineMath, MathBlock } from '../heavy/math.mjs';
|
|
10
|
-
import { Mermaid } from '../heavy/mermaid.mjs';
|
|
11
|
-
import { TrophyCard } from './trophy-card.mjs';
|
|
12
|
-
import { ZiaCard } from './zia-card.mjs';
|
|
13
|
-
import { GradientButton } from './gradient-button.mjs';
|
|
14
|
-
import { ZiaFolder, ZiaFile } from './zia-file.mjs';
|
|
15
|
-
import { SunoEmbed } from './suno-embed.mjs';
|
|
16
|
-
|
|
17
|
-
const typeTableGenerator = createGenerator();
|
|
18
|
-
function tryToMatchIcon(props, iconMap) {
|
|
19
|
-
var _a;
|
|
20
|
-
let lang;
|
|
21
|
-
const dataLanguage = props['data-language'];
|
|
22
|
-
if (dataLanguage && dataLanguage.trim() !== '') {
|
|
23
|
-
lang = dataLanguage.trim().toLowerCase();
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const title = props.title;
|
|
27
|
-
if (title) {
|
|
28
|
-
const titleParts = title.split('.');
|
|
29
|
-
if (titleParts.length > 1 && titleParts[0] !== '') {
|
|
30
|
-
const extension = (_a = titleParts.pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
31
|
-
if (extension) {
|
|
32
|
-
lang = extension;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (lang && iconMap[lang]) {
|
|
38
|
-
return iconMap[lang];
|
|
39
|
-
}
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
function createBaseMdxComponents(imageFallbackSrc) {
|
|
43
|
-
return Object.assign(Object.assign({}, baseMarkdownComponents), { img: (props) => (jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))) });
|
|
44
|
-
}
|
|
45
|
-
function createCodeMdxComponents(iconMap) {
|
|
46
|
-
return {
|
|
47
|
-
pre: (props) => {
|
|
48
|
-
const customIcon = tryToMatchIcon(props, iconMap);
|
|
49
|
-
return (jsx(CodeBlock, Object.assign({}, props, (customIcon && { icon: customIcon }), { children: jsx(Pre, { children: props.children }) })));
|
|
50
|
-
},
|
|
51
|
-
CodeBlock,
|
|
52
|
-
Pre,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function createMathMdxComponents() {
|
|
56
|
-
return {
|
|
57
|
-
MathBlock,
|
|
58
|
-
InlineMath,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function createMermaidMdxComponents(watermarkEnabled, watermarkText) {
|
|
62
|
-
return {
|
|
63
|
-
Mermaid: (props) => (jsx(Mermaid, Object.assign({}, props, { watermarkEnabled: watermarkEnabled, watermarkText: watermarkText }))),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function createTypeTableMdxComponents() {
|
|
67
|
-
return {
|
|
68
|
-
TypeTable,
|
|
69
|
-
AutoTypeTable: (props) => (jsx(AutoTypeTable, Object.assign({}, props, { generator: typeTableGenerator }))),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function createWidgetMdxComponents(cdnBaseUrl, imageFallbackSrc) {
|
|
73
|
-
return {
|
|
74
|
-
TrophyCard,
|
|
75
|
-
ZiaCard,
|
|
76
|
-
GradientButton,
|
|
77
|
-
ZiaFile,
|
|
78
|
-
ZiaFolder,
|
|
79
|
-
SunoEmbed,
|
|
80
|
-
ImageGrid: (props) => (jsx(ImageGrid, Object.assign({}, props, { cdnBaseUrl: cdnBaseUrl }))),
|
|
81
|
-
ImageZoom: (props) => (jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))),
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export { createBaseMdxComponents, createCodeMdxComponents, createMathMdxComponents, createMermaidMdxComponents, createTypeTableMdxComponents, createWidgetMdxComponents };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var imageZoom = require('./image-zoom.js');
|
|
6
|
-
|
|
7
|
-
function ImageGrid({ type = "url", images, altPrefix = '', cdnBaseUrl, }) {
|
|
8
|
-
return (jsxRuntime.jsx("div", { style: {
|
|
9
|
-
display: 'grid',
|
|
10
|
-
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
11
|
-
gap: '16px',
|
|
12
|
-
justifyItems: 'center',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
}, children: images.map((img, idx) => (jsxRuntime.jsx(imageZoom.ImageZoom, { src: img.startsWith('http://') || img.startsWith('https://') ? img : (type === "url" ? `${cdnBaseUrl === null || cdnBaseUrl === void 0 ? void 0 : cdnBaseUrl.replace(/\/+$/, '')}/${img.replace(/^\/+/, '')}` : img), alt: `${altPrefix}-${idx + 1}` }, img))) }));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.ImageGrid = ImageGrid;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { ImageZoom } from './image-zoom.mjs';
|
|
4
|
-
|
|
5
|
-
function ImageGrid({ type = "url", images, altPrefix = '', cdnBaseUrl, }) {
|
|
6
|
-
return (jsx("div", { style: {
|
|
7
|
-
display: 'grid',
|
|
8
|
-
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
9
|
-
gap: '16px',
|
|
10
|
-
justifyItems: 'center',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
}, children: images.map((img, idx) => (jsx(ImageZoom, { src: img.startsWith('http://') || img.startsWith('https://') ? img : (type === "url" ? `${cdnBaseUrl === null || cdnBaseUrl === void 0 ? void 0 : cdnBaseUrl.replace(/\/+$/, '')}/${img.replace(/^\/+/, '')}` : img), alt: `${altPrefix}-${idx + 1}` }, img))) }));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { ImageGrid };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type ImageProps } from 'fumadocs-core/framework';
|
|
2
|
-
import { type ImgHTMLAttributes } from 'react';
|
|
3
|
-
import { type UncontrolledProps } from 'react-medium-image-zoom';
|
|
4
|
-
export type ImageZoomProps = ImageProps & {
|
|
5
|
-
/**
|
|
6
|
-
* Image props when zoom in
|
|
7
|
-
*/
|
|
8
|
-
zoomInProps?: ImgHTMLAttributes<HTMLImageElement>;
|
|
9
|
-
/**
|
|
10
|
-
* Props for `react-medium-image-zoom`
|
|
11
|
-
*/
|
|
12
|
-
rmiz?: UncontrolledProps;
|
|
13
|
-
/**
|
|
14
|
-
* placeholder image path
|
|
15
|
-
*/
|
|
16
|
-
fallbackSrc?: string;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* @example
|
|
20
|
-
* <ImageZoom src="URL" fallbackSrc="/my-placeholder.png" />
|
|
21
|
-
*/
|
|
22
|
-
export declare function ImageZoom({ zoomInProps, children, rmiz, fallbackSrc, ...props }: ImageZoomProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var tslib = require('tslib');
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var framework = require('fumadocs-core/framework');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var Zoom = require('react-medium-image-zoom');
|
|
9
|
-
|
|
10
|
-
function getImageSrc(src) {
|
|
11
|
-
if (typeof src === 'string')
|
|
12
|
-
return src;
|
|
13
|
-
if (typeof src === 'object') {
|
|
14
|
-
// Next.js
|
|
15
|
-
if ('default' in src)
|
|
16
|
-
return src.default.src;
|
|
17
|
-
return src.src;
|
|
18
|
-
}
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @example
|
|
23
|
-
* <ImageZoom src="URL" fallbackSrc="/my-placeholder.png" />
|
|
24
|
-
*/
|
|
25
|
-
function ImageZoom(_a) {
|
|
26
|
-
var _b;
|
|
27
|
-
var { zoomInProps, children, rmiz, fallbackSrc = 'https://r2.d8ger.com/default.webp' } = _a, props = tslib.__rest(_a, ["zoomInProps", "children", "rmiz", "fallbackSrc"]);
|
|
28
|
-
const [imgSrc, setImgSrc] = React.useState(getImageSrc(props.src));
|
|
29
|
-
// fallback logic
|
|
30
|
-
const handleError = () => {
|
|
31
|
-
console.warn('ImageZoom check error:', imgSrc, fallbackSrc);
|
|
32
|
-
if (imgSrc !== fallbackSrc) {
|
|
33
|
-
setImgSrc(fallbackSrc);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
return (jsxRuntime.jsx(Zoom, Object.assign({ zoomMargin: 20, wrapElement: "span" }, rmiz, { zoomImg: Object.assign(Object.assign({ src: imgSrc, sizes: undefined }, zoomInProps), { onError: handleError }), children: children !== null && children !== void 0 ? children : (jsxRuntime.jsx(framework.Image, Object.assign({}, props, { src: imgSrc, onError: handleError, sizes: "(max-width: 400px) 100vw, 300px", style: { width: '100%', height: 'auto', maxWidth: 300 }, alt: (_b = props.alt) !== null && _b !== void 0 ? _b : '', width: 300, height: 225 }))) })));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
exports.ImageZoom = ImageZoom;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from 'tslib';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { Image } from 'fumadocs-core/framework';
|
|
5
|
-
import { useState } from 'react';
|
|
6
|
-
import Zoom from 'react-medium-image-zoom';
|
|
7
|
-
|
|
8
|
-
function getImageSrc(src) {
|
|
9
|
-
if (typeof src === 'string')
|
|
10
|
-
return src;
|
|
11
|
-
if (typeof src === 'object') {
|
|
12
|
-
// Next.js
|
|
13
|
-
if ('default' in src)
|
|
14
|
-
return src.default.src;
|
|
15
|
-
return src.src;
|
|
16
|
-
}
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* @example
|
|
21
|
-
* <ImageZoom src="URL" fallbackSrc="/my-placeholder.png" />
|
|
22
|
-
*/
|
|
23
|
-
function ImageZoom(_a) {
|
|
24
|
-
var _b;
|
|
25
|
-
var { zoomInProps, children, rmiz, fallbackSrc = 'https://r2.d8ger.com/default.webp' } = _a, props = __rest(_a, ["zoomInProps", "children", "rmiz", "fallbackSrc"]);
|
|
26
|
-
const [imgSrc, setImgSrc] = useState(getImageSrc(props.src));
|
|
27
|
-
// fallback logic
|
|
28
|
-
const handleError = () => {
|
|
29
|
-
console.warn('ImageZoom check error:', imgSrc, fallbackSrc);
|
|
30
|
-
if (imgSrc !== fallbackSrc) {
|
|
31
|
-
setImgSrc(fallbackSrc);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return (jsx(Zoom, Object.assign({ zoomMargin: 20, wrapElement: "span" }, rmiz, { zoomImg: Object.assign(Object.assign({ src: imgSrc, sizes: undefined }, zoomInProps), { onError: handleError }), children: children !== null && children !== void 0 ? children : (jsx(Image, Object.assign({}, props, { src: imgSrc, onError: handleError, sizes: "(max-width: 400px) 100vw, 300px", style: { width: '100%', height: 'auto', maxWidth: 300 }, alt: (_b = props.alt) !== null && _b !== void 0 ? _b : '', width: 300, height: 225 }))) })));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { ImageZoom };
|