@windrun-huaiin/third-ui 20.1.0 → 22.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.
Files changed (123) hide show
  1. package/LICENSE +1 -1
  2. package/dist/ai/ai-markdown.js +1 -1
  3. package/dist/ai/ai-markdown.mjs +1 -1
  4. package/dist/clerk/clerk-page-context-generator.js +3 -2
  5. package/dist/clerk/clerk-page-context-generator.mjs +3 -2
  6. package/dist/clerk/clerk-page-generator.d.ts +0 -8
  7. package/dist/clerk/clerk-page-generator.js +4 -3
  8. package/dist/clerk/clerk-page-generator.mjs +4 -3
  9. package/dist/fuma/base/custom-header.d.ts +1 -1
  10. package/dist/fuma/base/custom-header.js +38 -36
  11. package/dist/fuma/base/custom-header.mjs +25 -23
  12. package/dist/fuma/base/custom-home-layout.d.ts +1 -1
  13. package/dist/fuma/base/custom-home-layout.js +1 -1
  14. package/dist/fuma/base/custom-home-layout.mjs +1 -1
  15. package/dist/fuma/base/header-theme-switch.d.ts +5 -0
  16. package/dist/fuma/base/header-theme-switch.js +42 -0
  17. package/dist/fuma/base/header-theme-switch.mjs +40 -0
  18. package/dist/fuma/base/index.d.ts +1 -0
  19. package/dist/fuma/base/index.js +7 -0
  20. package/dist/fuma/base/index.mjs +1 -0
  21. package/dist/fuma/base/site-layout.d.ts +116 -0
  22. package/dist/fuma/base/site-layout.js +72 -0
  23. package/dist/fuma/base/site-layout.mjs +65 -0
  24. package/dist/fuma/fuma-banner-suit.js +9 -6
  25. package/dist/fuma/fuma-banner-suit.mjs +10 -7
  26. package/dist/fuma/fuma-page-genarator.d.ts +2 -2
  27. package/dist/fuma/fuma-page-genarator.js +21 -8
  28. package/dist/fuma/fuma-page-genarator.mjs +21 -8
  29. package/dist/fuma/heavy/image-grid.d.ts +6 -0
  30. package/dist/fuma/heavy/image-grid.js +17 -0
  31. package/dist/fuma/heavy/image-grid.mjs +15 -0
  32. package/dist/fuma/heavy/image-zoom.d.ts +22 -0
  33. package/dist/fuma/heavy/image-zoom.js +39 -0
  34. package/dist/fuma/heavy/image-zoom.mjs +37 -0
  35. package/dist/fuma/heavy/index.d.ts +4 -0
  36. package/dist/fuma/heavy/index.js +15 -0
  37. package/dist/fuma/heavy/index.mjs +5 -0
  38. package/dist/fuma/heavy/math.d.ts +17 -0
  39. package/dist/fuma/heavy/math.js +60 -0
  40. package/dist/fuma/heavy/math.mjs +57 -0
  41. package/dist/fuma/heavy/mermaid.d.ts +13 -0
  42. package/dist/fuma/heavy/mermaid.js +360 -0
  43. package/dist/fuma/heavy/mermaid.mjs +358 -0
  44. package/dist/fuma/llm-copy-handler.js +3 -2
  45. package/dist/fuma/llm-copy-handler.mjs +3 -2
  46. package/dist/fuma/mdx/features.d.ts +8 -0
  47. package/dist/fuma/mdx/features.js +92 -0
  48. package/dist/fuma/mdx/features.mjs +85 -0
  49. package/dist/fuma/mdx/index.d.ts +0 -4
  50. package/dist/fuma/mdx/index.js +0 -8
  51. package/dist/fuma/mdx/index.mjs +0 -4
  52. package/dist/fuma/mdx/markdown-component-map.js +7 -1
  53. package/dist/fuma/mdx/markdown-component-map.mjs +7 -1
  54. package/dist/fuma/mdx/math.d.ts +17 -0
  55. package/dist/fuma/mdx/math.js +60 -0
  56. package/dist/fuma/mdx/math.mjs +57 -0
  57. package/dist/fuma/mdx/site-mdx-components.d.ts +13 -0
  58. package/dist/fuma/mdx/site-mdx-components.js +19 -0
  59. package/dist/fuma/mdx/site-mdx-components.mjs +17 -0
  60. package/dist/fuma/mdx/site-mdx-presets.d.ts +13 -0
  61. package/dist/fuma/mdx/site-mdx-presets.js +49 -0
  62. package/dist/fuma/mdx/site-mdx-presets.mjs +45 -0
  63. package/dist/fuma/mdx/toc-clerk-portable.js +9 -5
  64. package/dist/fuma/mdx/toc-clerk-portable.mjs +8 -4
  65. package/dist/fuma/mdx/zia-card.js +1 -1
  66. package/dist/fuma/mdx/zia-card.mjs +1 -1
  67. package/dist/fuma/mdx/zia-file.js +1 -0
  68. package/dist/fuma/mdx/zia-file.mjs +1 -0
  69. package/dist/fuma/server/optional-features.d.ts +8 -0
  70. package/dist/fuma/server/optional-features.js +111 -0
  71. package/dist/fuma/server/optional-features.mjs +104 -0
  72. package/dist/fuma/server/site-mdx-components.d.ts +13 -0
  73. package/dist/fuma/server/site-mdx-components.js +19 -0
  74. package/dist/fuma/server/site-mdx-components.mjs +17 -0
  75. package/dist/fuma/server/site-mdx-presets.d.ts +194 -0
  76. package/dist/fuma/server/site-mdx-presets.js +46 -0
  77. package/dist/fuma/server/site-mdx-presets.mjs +42 -0
  78. package/dist/fuma/share/index.d.ts +1 -0
  79. package/dist/fuma/share/index.js +7 -0
  80. package/dist/fuma/share/index.mjs +1 -0
  81. package/dist/fuma/share/markdown-component-map.d.ts +3 -0
  82. package/dist/fuma/share/markdown-component-map.js +79 -0
  83. package/dist/fuma/share/markdown-component-map.mjs +77 -0
  84. package/dist/lib/fuma-schema-check-util.js +19 -5
  85. package/dist/lib/fuma-schema-check-util.mjs +19 -5
  86. package/dist/lib/seo-metadata.d.ts +10 -0
  87. package/dist/main/x-button.js +2 -2
  88. package/dist/main/x-button.mjs +2 -2
  89. package/package.json +31 -8
  90. package/src/ai/ai-markdown.tsx +1 -1
  91. package/src/clerk/clerk-page-context-generator.tsx +6 -3
  92. package/src/clerk/clerk-page-generator.tsx +7 -13
  93. package/src/fuma/base/custom-header.tsx +32 -35
  94. package/src/fuma/base/custom-home-layout.tsx +2 -2
  95. package/src/fuma/base/header-theme-switch.tsx +88 -0
  96. package/src/fuma/base/index.ts +1 -0
  97. package/src/fuma/base/site-layout.tsx +289 -0
  98. package/src/fuma/fuma-banner-suit.tsx +30 -28
  99. package/src/fuma/fuma-page-genarator.tsx +27 -10
  100. package/src/fuma/{mdx → heavy}/image-grid.tsx +1 -1
  101. package/src/fuma/heavy/index.ts +7 -0
  102. package/src/fuma/heavy/math.tsx +130 -0
  103. package/src/fuma/llm-copy-handler.ts +3 -3
  104. package/src/fuma/mdx/index.ts +0 -4
  105. package/src/fuma/mdx/toc-clerk-portable.tsx +27 -24
  106. package/src/fuma/mdx/zia-card.tsx +1 -0
  107. package/src/fuma/mdx/zia-file.tsx +3 -1
  108. package/src/fuma/server/optional-features.tsx +168 -0
  109. package/src/fuma/server/site-mdx-components.tsx +48 -0
  110. package/src/fuma/server/site-mdx-presets.ts +80 -0
  111. package/src/fuma/share/index.ts +1 -0
  112. package/src/fuma/{mdx → share}/markdown-component-map.tsx +1 -1
  113. package/src/lib/fuma-schema-check-util.ts +22 -6
  114. package/src/lib/seo-metadata.ts +47 -0
  115. package/src/main/language-detector.tsx +0 -8
  116. package/src/main/x-button.tsx +2 -2
  117. package/src/styles/fuma.css +3 -7
  118. package/src/styles/third-ui.css +0 -4
  119. package/dist/main/ads-alert-dialog.d.ts +0 -15
  120. package/dist/main/ads-alert-dialog.js +0 -21
  121. package/dist/main/ads-alert-dialog.mjs +0 -19
  122. /package/src/fuma/{mdx → heavy}/image-zoom.tsx +0 -0
  123. /package/src/fuma/{mdx → heavy}/mermaid.tsx +0 -0
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { __rest } from 'tslib';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { cva } from 'class-variance-authority';
5
+ import { SunIcon, MoonIcon, AirplayIcon } from '@windrun-huaiin/base-ui/icons';
6
+ import { useTheme } from 'next-themes';
7
+ import { useState, useEffect } from 'react';
8
+ import { cn } from '@windrun-huaiin/lib/utils';
9
+
10
+ const itemVariants = cva('inline-flex size-6.5 items-center justify-center rounded-full p-1.5', {
11
+ variants: {
12
+ active: {
13
+ true: 'bg-fd-accent',
14
+ false: '',
15
+ },
16
+ },
17
+ });
18
+ const full = [['light', SunIcon], ['dark', MoonIcon], ['system', AirplayIcon]];
19
+ function HeaderThemeSwitch(_a) {
20
+ var { className, mode = 'light-dark' } = _a, props = __rest(_a, ["className", "mode"]);
21
+ const { setTheme, theme, resolvedTheme } = useTheme();
22
+ const [mounted, setMounted] = useState(false);
23
+ useEffect(() => {
24
+ setMounted(true);
25
+ }, []);
26
+ const container = cn('inline-flex items-center rounded-full border p-1 overflow-hidden *:rounded-full', className);
27
+ const iconClassName = 'size-3.5 text-neutral-600 dark:text-neutral-300';
28
+ if (mode === 'light-dark') {
29
+ const value = mounted ? resolvedTheme : null;
30
+ return (jsx("button", { type: "button", className: container, "aria-label": "Toggle Theme", onClick: () => setTheme(value === 'light' ? 'dark' : 'light'), "data-theme-toggle": "", children: full.map(([key, Icon]) => {
31
+ if (key === 'system')
32
+ return null;
33
+ return (jsx(Icon, { fill: "currentColor", className: cn(itemVariants({ active: value === key }), iconClassName) }, key));
34
+ }) }));
35
+ }
36
+ const value = mounted ? theme : null;
37
+ return (jsx("div", Object.assign({ className: container, "data-theme-toggle": "" }, props, { children: full.map(([key, Icon]) => (jsx("button", { type: "button", "aria-label": key, className: cn(itemVariants({ active: value === key })), onClick: () => setTheme(key), children: jsx(Icon, { className: iconClassName, fill: "currentColor" }) }, key))) })));
38
+ }
39
+
40
+ export { HeaderThemeSwitch };
@@ -1,2 +1,3 @@
1
1
  export * from './custom-header';
2
2
  export * from './custom-home-layout';
3
+ export * from './site-layout';
@@ -2,9 +2,16 @@
2
2
 
3
3
  var customHeader = require('./custom-header.js');
4
4
  var customHomeLayout = require('./custom-home-layout.js');
5
+ var siteLayout = require('./site-layout.js');
5
6
 
6
7
 
7
8
 
8
9
  exports.CustomHomeHeader = customHeader.CustomHomeHeader;
9
10
  exports.CustomHomeLayout = customHomeLayout.CustomHomeLayout;
10
11
  exports.HomeTitle = customHomeLayout.HomeTitle;
12
+ exports.DocsRootProvider = siteLayout.DocsRootProvider;
13
+ exports.SiteDocsLayout = siteLayout.SiteDocsLayout;
14
+ exports.SiteHomeLayout = siteLayout.SiteHomeLayout;
15
+ exports.createSiteBaseLayoutConfig = siteLayout.createSiteBaseLayoutConfig;
16
+ exports.createSiteNavGroup = siteLayout.createSiteNavGroup;
17
+ exports.createSiteNavLink = siteLayout.createSiteNavLink;
@@ -1,2 +1,3 @@
1
1
  export { CustomHomeHeader } from './custom-header.mjs';
2
2
  export { CustomHomeLayout, HomeTitle } from './custom-home-layout.mjs';
3
+ export { DocsRootProvider, SiteDocsLayout, SiteHomeLayout, createSiteBaseLayoutConfig, createSiteNavGroup, createSiteNavLink } from './site-layout.mjs';
@@ -0,0 +1,116 @@
1
+ import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
2
+ import { RootProvider } from 'fumadocs-ui/provider/next';
3
+ import { type DocsLayoutProps } from 'fumadocs-ui/layouts/docs';
4
+ import { type HomeLayoutProps } from 'fumadocs-ui/layouts/home';
5
+ import { type HeaderActionOrders } from './custom-home-layout';
6
+ type RootProviderI18n = NonNullable<ComponentProps<typeof RootProvider>['i18n']>;
7
+ export interface DocsRootProviderProps {
8
+ i18n: RootProviderI18n;
9
+ children: ReactNode;
10
+ }
11
+ type SiteMenuConfig = HTMLAttributes<HTMLElement> & {
12
+ banner?: ReactNode;
13
+ };
14
+ interface SiteNavSharedFields {
15
+ secondary?: boolean;
16
+ mobilePinned?: boolean;
17
+ }
18
+ export interface SiteNavLinkItemConfig extends SiteNavSharedFields {
19
+ type?: 'main' | 'icon' | 'button';
20
+ text: ReactNode;
21
+ url: string;
22
+ external?: boolean;
23
+ icon?: ReactNode;
24
+ description?: ReactNode;
25
+ menu?: SiteMenuConfig;
26
+ on?: 'nav' | 'menu' | 'all';
27
+ label?: string;
28
+ }
29
+ export interface SiteNavMenuItemConfig extends SiteNavSharedFields {
30
+ type: 'menu';
31
+ text: ReactNode;
32
+ url?: string;
33
+ external?: boolean;
34
+ icon?: ReactNode;
35
+ description?: ReactNode;
36
+ items: SiteNavItemConfig[];
37
+ menu?: SiteMenuConfig;
38
+ on?: 'nav' | 'menu' | 'all';
39
+ }
40
+ export interface SiteNavCustomItemConfig extends SiteNavSharedFields {
41
+ type: 'custom';
42
+ children: ReactNode;
43
+ }
44
+ export type SiteNavItemConfig = SiteNavLinkItemConfig | SiteNavMenuItemConfig | SiteNavCustomItemConfig;
45
+ export interface SiteBaseLayoutConfig {
46
+ nav?: HomeLayoutProps['nav'];
47
+ i18n?: HomeLayoutProps['i18n'];
48
+ githubUrl?: string;
49
+ links?: SiteNavItemConfig[];
50
+ searchToggle?: HomeLayoutProps['searchToggle'];
51
+ themeSwitch?: HomeLayoutProps['themeSwitch'];
52
+ }
53
+ export interface SiteHomeLayoutConfig extends SiteBaseLayoutConfig {
54
+ showBanner?: boolean;
55
+ bannerHeight?: number;
56
+ headerHeight?: number;
57
+ headerPaddingTop?: number;
58
+ navbarClassName?: string;
59
+ floatingNav?: boolean;
60
+ banner?: ReactNode;
61
+ footer?: ReactNode;
62
+ goToTop?: ReactNode;
63
+ showFooter?: boolean;
64
+ showGoToTop?: boolean;
65
+ actionOrders?: HeaderActionOrders;
66
+ localePrefixAsNeeded?: boolean;
67
+ defaultLocale?: string;
68
+ }
69
+ export interface SiteDocsLayoutConfig extends SiteBaseLayoutConfig {
70
+ tree: DocsLayoutProps['tree'];
71
+ sidebar?: DocsLayoutProps['sidebar'];
72
+ }
73
+ export interface SiteMenuLeafConfig {
74
+ text: ReactNode;
75
+ path: string;
76
+ description?: ReactNode;
77
+ icon?: ReactNode;
78
+ className?: string;
79
+ external?: boolean;
80
+ }
81
+ export interface SiteMenuGroupConfig {
82
+ text: ReactNode;
83
+ path?: string;
84
+ landing?: SiteMenuLeafConfig;
85
+ items: SiteMenuLeafConfig[];
86
+ }
87
+ export interface CreateSiteNavItemContext {
88
+ resolveUrl: (path: string) => string;
89
+ }
90
+ export interface CreateSiteNavGroupOptions {
91
+ featuredClassName?: string;
92
+ featuredBanner?: ReactNode;
93
+ }
94
+ export interface CreateSiteBaseLayoutOptions {
95
+ homeUrl: string;
96
+ title: ReactNode;
97
+ i18n?: HomeLayoutProps['i18n'];
98
+ githubUrl?: string;
99
+ transparentMode?: HomeLayoutProps['nav'] extends infer T ? T extends {
100
+ transparentMode?: infer U;
101
+ } ? U : never : never;
102
+ }
103
+ export declare function createSiteNavLink(item: SiteMenuLeafConfig, context: CreateSiteNavItemContext): SiteNavLinkItemConfig;
104
+ export declare function createSiteNavGroup(item: SiteMenuGroupConfig, context: CreateSiteNavItemContext, options?: CreateSiteNavGroupOptions): SiteNavMenuItemConfig;
105
+ export declare function createSiteBaseLayoutConfig(options: CreateSiteBaseLayoutOptions): SiteBaseLayoutConfig;
106
+ export declare function DocsRootProvider({ i18n, children }: DocsRootProviderProps): import("react/jsx-runtime").JSX.Element;
107
+ export declare function SiteHomeLayout({ locale, config, children, }: {
108
+ locale: string;
109
+ config: SiteHomeLayoutConfig;
110
+ children: ReactNode;
111
+ }): import("react/jsx-runtime").JSX.Element;
112
+ export declare function SiteDocsLayout({ config, children, }: {
113
+ config: SiteDocsLayoutConfig;
114
+ children: ReactNode;
115
+ }): import("react/jsx-runtime").JSX.Element;
116
+ export {};
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var next = require('fumadocs-ui/provider/next');
6
+ var docs = require('fumadocs-ui/layouts/docs');
7
+ var customHomeLayout = require('./custom-home-layout.js');
8
+
9
+ function normalizeNavItems(items) {
10
+ if (!items)
11
+ return undefined;
12
+ return items.map((item) => {
13
+ var _a;
14
+ if (item.type === 'menu') {
15
+ return Object.assign(Object.assign({}, item), { items: (_a = normalizeNavItems(item.items)) !== null && _a !== void 0 ? _a : [] });
16
+ }
17
+ return item;
18
+ });
19
+ }
20
+ function createSiteNavLink(item, context) {
21
+ return Object.assign(Object.assign(Object.assign(Object.assign({ type: 'main', text: item.text }, (item.description ? { description: item.description } : {})), { url: context.resolveUrl(item.path) }), (item.external ? { external: item.external } : {})), (item.icon || item.className
22
+ ? {
23
+ menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
24
+ }
25
+ : {}));
26
+ }
27
+ function createSiteNavGroup(item, context, options) {
28
+ var _a;
29
+ return Object.assign(Object.assign({ type: 'menu', text: item.text }, (item.path ? { url: context.resolveUrl(item.path) } : {})), { items: [
30
+ ...(item.landing
31
+ ? [
32
+ Object.assign(Object.assign({}, createSiteNavLink(item.landing, context)), { menu: Object.assign(Object.assign({}, ((options === null || options === void 0 ? void 0 : options.featuredBanner) ? { banner: options.featuredBanner } : {})), { className: (_a = options === null || options === void 0 ? void 0 : options.featuredClassName) !== null && _a !== void 0 ? _a : 'md:row-span-2' }) }),
33
+ ]
34
+ : []),
35
+ ...item.items.map((child) => createSiteNavLink(child, context)),
36
+ ] });
37
+ }
38
+ function createSiteBaseLayoutConfig(options) {
39
+ var _a;
40
+ return Object.assign(Object.assign({ nav: {
41
+ url: options.homeUrl,
42
+ title: options.title,
43
+ transparentMode: (_a = options.transparentMode) !== null && _a !== void 0 ? _a : 'none',
44
+ } }, (options.i18n ? { i18n: options.i18n } : {})), (options.githubUrl ? { githubUrl: options.githubUrl } : {}));
45
+ }
46
+ function toHomeLayoutOptions(config) {
47
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (config.nav ? { nav: config.nav } : {})), (config.i18n ? { i18n: config.i18n } : {})), (config.githubUrl ? { githubUrl: config.githubUrl } : {})), (config.links ? { links: normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {}));
48
+ }
49
+ function toDocsLayoutOptions(config) {
50
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (config.nav ? { nav: config.nav } : {})), (config.i18n ? { i18n: config.i18n } : {})), (config.githubUrl ? { githubUrl: config.githubUrl } : {})), (config.links ? { links: normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {})), (config.sidebar ? { sidebar: config.sidebar } : {})), { tree: config.tree });
51
+ }
52
+ function DocsRootProvider({ i18n, children }) {
53
+ return jsxRuntime.jsx(next.RootProvider, { i18n: i18n, children: children });
54
+ }
55
+ function SiteHomeLayout({ locale, config, children, }) {
56
+ const { actionOrders, banner, bannerHeight, defaultLocale, floatingNav, footer, goToTop, headerHeight, headerPaddingTop, localePrefixAsNeeded, navbarClassName, showBanner, showFooter, showGoToTop } = config, baseConfig = tslib.__rest(config, ["actionOrders", "banner", "bannerHeight", "defaultLocale", "floatingNav", "footer", "goToTop", "headerHeight", "headerPaddingTop", "localePrefixAsNeeded", "navbarClassName", "showBanner", "showFooter", "showGoToTop"]);
57
+ const options = toHomeLayoutOptions(baseConfig);
58
+ const layoutProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ locale,
59
+ options }, (actionOrders ? { actionOrders } : {})), (banner ? { banner } : {})), (bannerHeight != null ? { bannerHeight } : {})), (defaultLocale ? { defaultLocale } : {})), (floatingNav != null ? { floatingNav } : {})), (footer ? { footer } : {})), (goToTop ? { goToTop } : {})), (headerHeight != null ? { headerHeight } : {})), (headerPaddingTop != null ? { headerPaddingTop } : {})), (localePrefixAsNeeded != null ? { localePrefixAsNeeded } : {})), (navbarClassName ? { navbarClassName } : {})), (showBanner != null ? { showBanner } : {})), (showFooter != null ? { showFooter } : {})), (showGoToTop != null ? { showGoToTop } : {}));
60
+ return jsxRuntime.jsx(customHomeLayout.CustomHomeLayout, Object.assign({}, layoutProps, { children: children }));
61
+ }
62
+ function SiteDocsLayout({ config, children, }) {
63
+ const options = toDocsLayoutOptions(config);
64
+ return jsxRuntime.jsx(docs.DocsLayout, Object.assign({}, options, { children: children }));
65
+ }
66
+
67
+ exports.DocsRootProvider = DocsRootProvider;
68
+ exports.SiteDocsLayout = SiteDocsLayout;
69
+ exports.SiteHomeLayout = SiteHomeLayout;
70
+ exports.createSiteBaseLayoutConfig = createSiteBaseLayoutConfig;
71
+ exports.createSiteNavGroup = createSiteNavGroup;
72
+ exports.createSiteNavLink = createSiteNavLink;
@@ -0,0 +1,65 @@
1
+ import { __rest } from 'tslib';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { RootProvider } from 'fumadocs-ui/provider/next';
4
+ import { DocsLayout } from 'fumadocs-ui/layouts/docs';
5
+ import { CustomHomeLayout } from './custom-home-layout.mjs';
6
+
7
+ function normalizeNavItems(items) {
8
+ if (!items)
9
+ return undefined;
10
+ return items.map((item) => {
11
+ var _a;
12
+ if (item.type === 'menu') {
13
+ return Object.assign(Object.assign({}, item), { items: (_a = normalizeNavItems(item.items)) !== null && _a !== void 0 ? _a : [] });
14
+ }
15
+ return item;
16
+ });
17
+ }
18
+ function createSiteNavLink(item, context) {
19
+ return Object.assign(Object.assign(Object.assign(Object.assign({ type: 'main', text: item.text }, (item.description ? { description: item.description } : {})), { url: context.resolveUrl(item.path) }), (item.external ? { external: item.external } : {})), (item.icon || item.className
20
+ ? {
21
+ menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
22
+ }
23
+ : {}));
24
+ }
25
+ function createSiteNavGroup(item, context, options) {
26
+ var _a;
27
+ return Object.assign(Object.assign({ type: 'menu', text: item.text }, (item.path ? { url: context.resolveUrl(item.path) } : {})), { items: [
28
+ ...(item.landing
29
+ ? [
30
+ Object.assign(Object.assign({}, createSiteNavLink(item.landing, context)), { menu: Object.assign(Object.assign({}, ((options === null || options === void 0 ? void 0 : options.featuredBanner) ? { banner: options.featuredBanner } : {})), { className: (_a = options === null || options === void 0 ? void 0 : options.featuredClassName) !== null && _a !== void 0 ? _a : 'md:row-span-2' }) }),
31
+ ]
32
+ : []),
33
+ ...item.items.map((child) => createSiteNavLink(child, context)),
34
+ ] });
35
+ }
36
+ function createSiteBaseLayoutConfig(options) {
37
+ var _a;
38
+ return Object.assign(Object.assign({ nav: {
39
+ url: options.homeUrl,
40
+ title: options.title,
41
+ transparentMode: (_a = options.transparentMode) !== null && _a !== void 0 ? _a : 'none',
42
+ } }, (options.i18n ? { i18n: options.i18n } : {})), (options.githubUrl ? { githubUrl: options.githubUrl } : {}));
43
+ }
44
+ function toHomeLayoutOptions(config) {
45
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (config.nav ? { nav: config.nav } : {})), (config.i18n ? { i18n: config.i18n } : {})), (config.githubUrl ? { githubUrl: config.githubUrl } : {})), (config.links ? { links: normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {}));
46
+ }
47
+ function toDocsLayoutOptions(config) {
48
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (config.nav ? { nav: config.nav } : {})), (config.i18n ? { i18n: config.i18n } : {})), (config.githubUrl ? { githubUrl: config.githubUrl } : {})), (config.links ? { links: normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {})), (config.sidebar ? { sidebar: config.sidebar } : {})), { tree: config.tree });
49
+ }
50
+ function DocsRootProvider({ i18n, children }) {
51
+ return jsx(RootProvider, { i18n: i18n, children: children });
52
+ }
53
+ function SiteHomeLayout({ locale, config, children, }) {
54
+ const { actionOrders, banner, bannerHeight, defaultLocale, floatingNav, footer, goToTop, headerHeight, headerPaddingTop, localePrefixAsNeeded, navbarClassName, showBanner, showFooter, showGoToTop } = config, baseConfig = __rest(config, ["actionOrders", "banner", "bannerHeight", "defaultLocale", "floatingNav", "footer", "goToTop", "headerHeight", "headerPaddingTop", "localePrefixAsNeeded", "navbarClassName", "showBanner", "showFooter", "showGoToTop"]);
55
+ const options = toHomeLayoutOptions(baseConfig);
56
+ const layoutProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ locale,
57
+ options }, (actionOrders ? { actionOrders } : {})), (banner ? { banner } : {})), (bannerHeight != null ? { bannerHeight } : {})), (defaultLocale ? { defaultLocale } : {})), (floatingNav != null ? { floatingNav } : {})), (footer ? { footer } : {})), (goToTop ? { goToTop } : {})), (headerHeight != null ? { headerHeight } : {})), (headerPaddingTop != null ? { headerPaddingTop } : {})), (localePrefixAsNeeded != null ? { localePrefixAsNeeded } : {})), (navbarClassName ? { navbarClassName } : {})), (showBanner != null ? { showBanner } : {})), (showFooter != null ? { showFooter } : {})), (showGoToTop != null ? { showGoToTop } : {}));
58
+ return jsx(CustomHomeLayout, Object.assign({}, layoutProps, { children: children }));
59
+ }
60
+ function SiteDocsLayout({ config, children, }) {
61
+ const options = toDocsLayoutOptions(config);
62
+ return jsx(DocsLayout, Object.assign({}, options, { children: children }));
63
+ }
64
+
65
+ export { DocsRootProvider, SiteDocsLayout, SiteHomeLayout, createSiteBaseLayoutConfig, createSiteNavGroup, createSiteNavLink };
@@ -7,20 +7,23 @@ var banner = require('./mdx/banner.js');
7
7
 
8
8
  function FumaBannerSuit(_a) {
9
9
  return tslib.__awaiter(this, arguments, void 0, function* ({ locale, showBanner, floating = true, }) {
10
- const t = yield server.getTranslations({ locale, namespace: 'home' });
11
- const heightValue = showBanner ? 3 : 0.5;
10
+ const heightValue = 3;
12
11
  const height = `${heightValue}rem`;
13
- const bannerText = t('banner');
14
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: showBanner ? (jsxRuntime.jsx(banner.Banner, { variant: "rainbow", changeLayout: true, height: heightValue, floating: floating, children: jsxRuntime.jsx("p", { className: "text-sm sm:text-xl md:text-xl", children: bannerText }) })) : (jsxRuntime.jsx("div", { className: "m-0 rounded-none bg-neutral-100 dark:bg-neutral-900", style: {
12
+ if (!showBanner) {
13
+ return (jsxRuntime.jsx("div", { "aria-hidden": "true", className: "m-0 rounded-none bg-neutral-100 dark:bg-neutral-900", style: {
15
14
  position: floating ? 'fixed' : 'relative',
16
15
  top: floating ? 0 : undefined,
17
16
  left: floating ? 0 : undefined,
18
17
  width: floating ? '100vw' : '100%',
19
18
  zIndex: floating ? 1001 : undefined,
20
- height: height,
19
+ height,
21
20
  minHeight: height,
22
21
  maxHeight: height,
23
- } })) }));
22
+ } }));
23
+ }
24
+ const t = yield server.getTranslations({ locale, namespace: 'home' });
25
+ const bannerText = t('banner');
26
+ return (jsxRuntime.jsx(banner.Banner, { variant: "rainbow", changeLayout: true, height: heightValue, floating: floating, children: jsxRuntime.jsx("p", { className: "text-sm sm:text-xl md:text-xl", children: bannerText }) }));
24
27
  });
25
28
  }
26
29
 
@@ -1,24 +1,27 @@
1
1
  import { __awaiter } from 'tslib';
2
- import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { jsx } from 'react/jsx-runtime';
3
3
  import { getTranslations } from 'next-intl/server';
4
4
  import { Banner } from './mdx/banner.mjs';
5
5
 
6
6
  function FumaBannerSuit(_a) {
7
7
  return __awaiter(this, arguments, void 0, function* ({ locale, showBanner, floating = true, }) {
8
- const t = yield getTranslations({ locale, namespace: 'home' });
9
- const heightValue = showBanner ? 3 : 0.5;
8
+ const heightValue = 3;
10
9
  const height = `${heightValue}rem`;
11
- const bannerText = t('banner');
12
- return (jsx(Fragment, { children: showBanner ? (jsx(Banner, { variant: "rainbow", changeLayout: true, height: heightValue, floating: floating, children: jsx("p", { className: "text-sm sm:text-xl md:text-xl", children: bannerText }) })) : (jsx("div", { className: "m-0 rounded-none bg-neutral-100 dark:bg-neutral-900", style: {
10
+ if (!showBanner) {
11
+ return (jsx("div", { "aria-hidden": "true", className: "m-0 rounded-none bg-neutral-100 dark:bg-neutral-900", style: {
13
12
  position: floating ? 'fixed' : 'relative',
14
13
  top: floating ? 0 : undefined,
15
14
  left: floating ? 0 : undefined,
16
15
  width: floating ? '100vw' : '100%',
17
16
  zIndex: floating ? 1001 : undefined,
18
- height: height,
17
+ height,
19
18
  minHeight: height,
20
19
  maxHeight: height,
21
- } })) }));
20
+ } }));
21
+ }
22
+ const t = yield getTranslations({ locale, namespace: 'home' });
23
+ const bannerText = t('banner');
24
+ return (jsx(Banner, { variant: "rainbow", changeLayout: true, height: heightValue, floating: floating, children: jsx("p", { className: "text-sm sm:text-xl md:text-xl", children: bannerText }) }));
22
25
  });
23
26
  }
24
27
 
@@ -2,7 +2,7 @@ import { ReactNode, ReactElement } from 'react';
2
2
  import type { LLMCopyButtonProps, LLMCopyButton } from '@third-ui/fuma/mdx/toc-base';
3
3
  interface FumaPageParams {
4
4
  sourceKey: string;
5
- mdxContentSource: any;
5
+ mdxContentSource: any | (() => Promise<any>);
6
6
  getMDXComponents: () => any;
7
7
  mdxSourceDir: string;
8
8
  githubBaseUrl?: string;
@@ -25,7 +25,7 @@ export declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComp
25
25
  slug?: string[];
26
26
  }>;
27
27
  }) => Promise<import("react/jsx-runtime").JSX.Element>;
28
- generateStaticParams: () => any;
28
+ generateStaticParams: () => Promise<any>;
29
29
  generateMetadata: (props: {
30
30
  params: Promise<{
31
31
  slug?: string[];
@@ -9,36 +9,49 @@ var lib = require('@windrun-huaiin/lib');
9
9
  var tocClerkPortable = require('./mdx/toc-clerk-portable.js');
10
10
 
11
11
  function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, supportedLocales = ['en'], showBreadcrumb = true, showTableOfContent = true, showTableOfContentPopover = false, localePrefixAsNeeded = true, defaultLocale = 'en', }) {
12
+ const getSource = () => tslib.__awaiter(this, void 0, void 0, function* () {
13
+ if (typeof mdxContentSource === 'function') {
14
+ return yield mdxContentSource();
15
+ }
16
+ return mdxContentSource;
17
+ });
12
18
  const Page = function Page(_a) {
13
19
  return tslib.__awaiter(this, arguments, void 0, function* ({ params }) {
14
- var _b, _c, _d;
20
+ var _b, _c, _d, _e;
15
21
  const { slug, locale } = yield params;
16
- const page$1 = mdxContentSource.getPage(slug, locale);
22
+ const source = yield getSource();
23
+ const page$1 = source.getPage(slug, locale);
17
24
  if (!page$1) {
18
- console.log('[FumaPage] missing page', { slug, locale, available: (_d = (_c = (_b = mdxContentSource.pageTree) === null || _b === void 0 ? void 0 : _b[locale]) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((c) => c.url) });
25
+ console.log('[FumaPage] missing page', { slug, locale, available: (_d = (_c = (_b = source.pageTree) === null || _b === void 0 ? void 0 : _b[locale]) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((c) => c.url) });
19
26
  return jsxRuntime.jsx(FallbackPage, { siteIcon: siteIcon });
20
27
  }
21
28
  const path = githubBaseUrl ? `${mdxSourceDir}/${page$1.path}` : undefined;
22
29
  const tocFooterElement = (jsxRuntime.jsx(tocFooterWrapper.TocFooterWrapper, { lastModified: page$1.data.date, copyButtonComponent: copyButtonComponent
23
30
  ? React.cloneElement(copyButtonComponent, { sourceKey })
24
31
  : undefined, editPath: path, githubBaseUrl: githubBaseUrl }));
25
- const MDX = page$1.data.body;
32
+ const content = typeof page$1.data.load === 'function'
33
+ ? yield page$1.data.load(getMDXComponents())
34
+ : {
35
+ body: yield page$1.data.body({ components: getMDXComponents() }),
36
+ toc: (_e = page$1.data.toc) !== null && _e !== void 0 ? _e : [],
37
+ };
26
38
  return (jsxRuntime.jsxs(page.DocsPage, { breadcrumb: { enabled: showBreadcrumb }, tableOfContent: {
27
39
  enabled: showTableOfContent,
28
40
  single: false,
29
- component: (jsxRuntime.jsx(tocClerkPortable.PortableClerkTOC, { toc: page$1.data.toc, footer: tocFooterElement })),
41
+ component: (jsxRuntime.jsx(tocClerkPortable.PortableClerkTOC, { toc: content.toc, footer: tocFooterElement })),
30
42
  }, tableOfContentPopover: {
31
43
  enabled: false,
32
- }, toc: page$1.data.toc, article: { className: 'max-sm:pb-16' }, children: [jsxRuntime.jsx(page.DocsTitle, { children: page$1.data.title }), jsxRuntime.jsx(page.DocsDescription, { className: "mb-2", children: page$1.data.description }), jsxRuntime.jsx(page.DocsBody, { className: "text-fd-foreground/80", children: jsxRuntime.jsx(MDX, { components: getMDXComponents() }) })] }));
44
+ }, toc: content.toc, className: "max-sm:pb-16", children: [jsxRuntime.jsx(page.DocsTitle, { children: page$1.data.title }), jsxRuntime.jsx(page.DocsDescription, { className: "mb-2", children: page$1.data.description }), jsxRuntime.jsx(page.DocsBody, { className: "text-fd-foreground/80", children: content.body })] }));
33
45
  });
34
46
  };
35
47
  function generateStaticParams() {
36
- return mdxContentSource.generateParams('slug', 'locale');
48
+ return getSource().then((source) => source.generateParams('slug', 'locale'));
37
49
  }
38
50
  function generateMetadata(props) {
39
51
  return tslib.__awaiter(this, void 0, void 0, function* () {
40
52
  const { slug, locale } = yield props.params;
41
- const page = mdxContentSource.getPage(slug, locale);
53
+ const source = yield getSource();
54
+ const page = source.getPage(slug, locale);
42
55
  if (!page) {
43
56
  return {
44
57
  title: '404 - Page Not Found',
@@ -7,36 +7,49 @@ import { getAsNeededLocalizedUrl } from '@windrun-huaiin/lib';
7
7
  import { PortableClerkTOC } from './mdx/toc-clerk-portable.mjs';
8
8
 
9
9
  function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, supportedLocales = ['en'], showBreadcrumb = true, showTableOfContent = true, showTableOfContentPopover = false, localePrefixAsNeeded = true, defaultLocale = 'en', }) {
10
+ const getSource = () => __awaiter(this, void 0, void 0, function* () {
11
+ if (typeof mdxContentSource === 'function') {
12
+ return yield mdxContentSource();
13
+ }
14
+ return mdxContentSource;
15
+ });
10
16
  const Page = function Page(_a) {
11
17
  return __awaiter(this, arguments, void 0, function* ({ params }) {
12
- var _b, _c, _d;
18
+ var _b, _c, _d, _e;
13
19
  const { slug, locale } = yield params;
14
- const page = mdxContentSource.getPage(slug, locale);
20
+ const source = yield getSource();
21
+ const page = source.getPage(slug, locale);
15
22
  if (!page) {
16
- console.log('[FumaPage] missing page', { slug, locale, available: (_d = (_c = (_b = mdxContentSource.pageTree) === null || _b === void 0 ? void 0 : _b[locale]) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((c) => c.url) });
23
+ console.log('[FumaPage] missing page', { slug, locale, available: (_d = (_c = (_b = source.pageTree) === null || _b === void 0 ? void 0 : _b[locale]) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((c) => c.url) });
17
24
  return jsx(FallbackPage, { siteIcon: siteIcon });
18
25
  }
19
26
  const path = githubBaseUrl ? `${mdxSourceDir}/${page.path}` : undefined;
20
27
  const tocFooterElement = (jsx(TocFooterWrapper, { lastModified: page.data.date, copyButtonComponent: copyButtonComponent
21
28
  ? cloneElement(copyButtonComponent, { sourceKey })
22
29
  : undefined, editPath: path, githubBaseUrl: githubBaseUrl }));
23
- const MDX = page.data.body;
30
+ const content = typeof page.data.load === 'function'
31
+ ? yield page.data.load(getMDXComponents())
32
+ : {
33
+ body: yield page.data.body({ components: getMDXComponents() }),
34
+ toc: (_e = page.data.toc) !== null && _e !== void 0 ? _e : [],
35
+ };
24
36
  return (jsxs(DocsPage, { breadcrumb: { enabled: showBreadcrumb }, tableOfContent: {
25
37
  enabled: showTableOfContent,
26
38
  single: false,
27
- component: (jsx(PortableClerkTOC, { toc: page.data.toc, footer: tocFooterElement })),
39
+ component: (jsx(PortableClerkTOC, { toc: content.toc, footer: tocFooterElement })),
28
40
  }, tableOfContentPopover: {
29
41
  enabled: false,
30
- }, toc: page.data.toc, article: { className: 'max-sm:pb-16' }, children: [jsx(DocsTitle, { children: page.data.title }), jsx(DocsDescription, { className: "mb-2", children: page.data.description }), jsx(DocsBody, { className: "text-fd-foreground/80", children: jsx(MDX, { components: getMDXComponents() }) })] }));
42
+ }, toc: content.toc, className: "max-sm:pb-16", children: [jsx(DocsTitle, { children: page.data.title }), jsx(DocsDescription, { className: "mb-2", children: page.data.description }), jsx(DocsBody, { className: "text-fd-foreground/80", children: content.body })] }));
31
43
  });
32
44
  };
33
45
  function generateStaticParams() {
34
- return mdxContentSource.generateParams('slug', 'locale');
46
+ return getSource().then((source) => source.generateParams('slug', 'locale'));
35
47
  }
36
48
  function generateMetadata(props) {
37
49
  return __awaiter(this, void 0, void 0, function* () {
38
50
  const { slug, locale } = yield props.params;
39
- const page = mdxContentSource.getPage(slug, locale);
51
+ const source = yield getSource();
52
+ const page = source.getPage(slug, locale);
40
53
  if (!page) {
41
54
  return {
42
55
  title: '404 - Page Not Found',
@@ -0,0 +1,6 @@
1
+ export declare function ImageGrid({ type, images, altPrefix, cdnBaseUrl, }: {
2
+ type: "url" | "local";
3
+ images: string[];
4
+ altPrefix?: string;
5
+ cdnBaseUrl?: string;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
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;
@@ -0,0 +1,15 @@
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 };
@@ -0,0 +1,22 @@
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;
@@ -0,0 +1,39 @@
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;