opin-ui 0.0.1
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/README.md +5 -0
- package/css/aspen.css +39 -0
- package/css/black.css +39 -0
- package/css/catppuccin.css +49 -0
- package/css/dusk.css +47 -0
- package/css/emerald.css +39 -0
- package/css/generated/docs.css +1 -0
- package/css/generated/flux.css +1 -0
- package/css/generated/home.css +1 -0
- package/css/generated/notebook.css +1 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +314 -0
- package/css/lib/default-colors.css +51 -0
- package/css/lib/shiki.css +108 -0
- package/css/neutral.css +7 -0
- package/css/ocean.css +44 -0
- package/css/preset-legacy.css +43 -0
- package/css/preset.css +11 -0
- package/css/purple.css +39 -0
- package/css/ruby.css +39 -0
- package/css/shadcn.css +36 -0
- package/css/solar.css +75 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +65 -0
- package/dist/.translations/index.d.ts +49 -0
- package/dist/.translations/keys.js +49 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +23 -0
- package/dist/components/accordion.js +68 -0
- package/dist/components/banner.d.ts +33 -0
- package/dist/components/banner.js +85 -0
- package/dist/components/callout.d.ts +41 -0
- package/dist/components/callout.js +53 -0
- package/dist/components/card.d.ts +19 -0
- package/dist/components/card.js +38 -0
- package/dist/components/codeblock.d.ts +61 -0
- package/dist/components/codeblock.js +173 -0
- package/dist/components/codeblock.rsc.d.ts +20 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +36 -0
- package/dist/components/dialog/search-algolia.js +64 -0
- package/dist/components/dialog/search-default.d.ts +36 -0
- package/dist/components/dialog/search-default.js +58 -0
- package/dist/components/dialog/search-orama.d.ts +43 -0
- package/dist/components/dialog/search-orama.js +69 -0
- package/dist/components/dialog/search.d.ts +112 -0
- package/dist/components/dialog/search.js +350 -0
- package/dist/components/dynamic-codeblock.core.d.ts +34 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +9 -0
- package/dist/components/dynamic-codeblock.js +17 -0
- package/dist/components/files.d.ts +34 -0
- package/dist/components/files.js +40 -0
- package/dist/components/github-info.d.ts +35 -0
- package/dist/components/github-info.js +75 -0
- package/dist/components/heading.d.ts +13 -0
- package/dist/components/heading.js +38 -0
- package/dist/components/image-zoom.d.ts +23 -0
- package/dist/components/image-zoom.js +32 -0
- package/dist/components/image-zoom2.css +71 -0
- package/dist/components/inline-toc.d.ts +14 -0
- package/dist/components/inline-toc.js +28 -0
- package/dist/components/sidebar/base.d.ts +131 -0
- package/dist/components/sidebar/base.js +274 -0
- package/dist/components/sidebar/link-item.d.ts +22 -0
- package/dist/components/sidebar/link-item.js +38 -0
- package/dist/components/sidebar/page-tree.d.ts +28 -0
- package/dist/components/sidebar/page-tree.js +71 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +16 -0
- package/dist/components/sidebar/tabs/dropdown.js +71 -0
- package/dist/components/sidebar/tabs/index.d.ts +11 -0
- package/dist/components/sidebar/tabs/index.js +46 -0
- package/dist/components/steps.d.ts +15 -0
- package/dist/components/steps.js +16 -0
- package/dist/components/tabs.d.ts +49 -0
- package/dist/components/tabs.js +88 -0
- package/dist/components/toc/clerk.d.ts +20 -0
- package/dist/components/toc/clerk.js +226 -0
- package/dist/components/toc/default.d.ts +23 -0
- package/dist/components/toc/default.js +259 -0
- package/dist/components/toc/index.d.ts +19 -0
- package/dist/components/toc/index.js +45 -0
- package/dist/components/type-table.d.ts +43 -0
- package/dist/components/type-table.js +117 -0
- package/dist/components/ui/accordion.d.ts +30 -0
- package/dist/components/ui/accordion.js +42 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +15 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/navigation-menu.d.ts +30 -0
- package/dist/components/ui/navigation-menu.js +41 -0
- package/dist/components/ui/popover.d.ts +15 -0
- package/dist/components/ui/popover.js +20 -0
- package/dist/components/ui/scroll-area.d.ts +22 -0
- package/dist/components/ui/scroll-area.js +34 -0
- package/dist/components/ui/tabs.d.ts +36 -0
- package/dist/components/ui/tabs.js +77 -0
- package/dist/contexts/i18n.d.ts +41 -0
- package/dist/contexts/i18n.js +37 -0
- package/dist/contexts/search.d.ts +73 -0
- package/dist/contexts/search.js +68 -0
- package/dist/contexts/tree.d.ts +20 -0
- package/dist/contexts/tree.js +38 -0
- package/dist/i18n.d.ts +16 -0
- package/dist/i18n.js +38 -0
- package/dist/layouts/docs/client.d.ts +34 -0
- package/dist/layouts/docs/client.js +92 -0
- package/dist/layouts/docs/index.d.ts +44 -0
- package/dist/layouts/docs/index.js +22 -0
- package/dist/layouts/docs/page/index.d.ts +115 -0
- package/dist/layouts/docs/page/index.js +124 -0
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +6 -0
- package/dist/layouts/docs/page/slots/container.js +17 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +22 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +62 -0
- package/dist/layouts/docs/page/slots/toc.js +182 -0
- package/dist/layouts/docs/slots/container.d.ts +6 -0
- package/dist/layouts/docs/slots/container.js +36 -0
- package/dist/layouts/docs/slots/header.d.ts +6 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +29 -0
- package/dist/layouts/docs/slots/sidebar.js +326 -0
- package/dist/layouts/flux/index.d.ts +73 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +102 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +6 -0
- package/dist/layouts/flux/page/slots/container.js +17 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +22 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +38 -0
- package/dist/layouts/flux/page/slots/toc.js +181 -0
- package/dist/layouts/flux/slots/container.d.ts +6 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +22 -0
- package/dist/layouts/flux/slots/sidebar.js +237 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +16 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +85 -0
- package/dist/layouts/home/index.d.ts +28 -0
- package/dist/layouts/home/index.js +40 -0
- package/dist/layouts/home/navbar.d.ts +10 -0
- package/dist/layouts/home/navbar.js +34 -0
- package/dist/layouts/home/not-found.d.ts +7 -0
- package/dist/layouts/home/not-found.js +41 -0
- package/dist/layouts/home/slots/container.d.ts +6 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +9 -0
- package/dist/layouts/home/slots/header.js +239 -0
- package/dist/layouts/notebook/client.d.ts +36 -0
- package/dist/layouts/notebook/client.js +69 -0
- package/dist/layouts/notebook/index.d.ts +37 -0
- package/dist/layouts/notebook/index.js +22 -0
- package/dist/layouts/notebook/page/index.d.ts +115 -0
- package/dist/layouts/notebook/page/index.js +124 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +6 -0
- package/dist/layouts/notebook/page/slots/container.js +17 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +22 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +62 -0
- package/dist/layouts/notebook/page/slots/toc.js +181 -0
- package/dist/layouts/notebook/slots/container.d.ts +6 -0
- package/dist/layouts/notebook/slots/container.js +38 -0
- package/dist/layouts/notebook/slots/header.d.ts +6 -0
- package/dist/layouts/notebook/slots/header.js +194 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +30 -0
- package/dist/layouts/notebook/slots/sidebar.js +298 -0
- package/dist/layouts/shared/client.d.ts +44 -0
- package/dist/layouts/shared/client.js +84 -0
- package/dist/layouts/shared/index.d.ts +178 -0
- package/dist/layouts/shared/index.js +98 -0
- package/dist/layouts/shared/page-actions.d.ts +35 -0
- package/dist/layouts/shared/page-actions.js +195 -0
- package/dist/layouts/shared/slots/language-select.d.ts +18 -0
- package/dist/layouts/shared/slots/language-select.js +43 -0
- package/dist/layouts/shared/slots/search-trigger.d.ts +22 -0
- package/dist/layouts/shared/slots/search-trigger.js +53 -0
- package/dist/layouts/shared/slots/theme-switch.d.ts +13 -0
- package/dist/layouts/shared/slots/theme-switch.js +65 -0
- package/dist/legacy/layout.d.ts +36 -0
- package/dist/legacy/layout.js +44 -0
- package/dist/legacy/sidebar.d.ts +17 -0
- package/dist/legacy/sidebar.js +33 -0
- package/dist/mdx.d.ts +45 -0
- package/dist/mdx.js +70 -0
- package/dist/mdx.server.d.ts +15 -0
- package/dist/mdx.server.js +20 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.d.ts +31 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/index.d.ts +2 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +7 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +8 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +55 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
- package/dist/og/takumi.d.ts +21 -0
- package/dist/og/takumi.js +91 -0
- package/dist/og.d.ts +22 -0
- package/dist/og.js +91 -0
- package/dist/page.d.ts +35 -0
- package/dist/page.js +33 -0
- package/dist/provider/base.d.ts +49 -0
- package/dist/provider/base.js +32 -0
- package/dist/provider/next.d.ts +20 -0
- package/dist/provider/next.js +17 -0
- package/dist/provider/react-router.d.ts +20 -0
- package/dist/provider/react-router.js +17 -0
- package/dist/provider/tanstack.d.ts +20 -0
- package/dist/provider/tanstack.js +17 -0
- package/dist/provider/waku.d.ts +20 -0
- package/dist/provider/waku.js +17 -0
- package/dist/style.css +3534 -0
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/urls.js +15 -0
- package/dist/utils/use-copy-button.d.ts +6 -0
- package/dist/utils/use-copy-button.js +26 -0
- package/dist/utils/use-footer-items.d.ts +9 -0
- package/dist/utils/use-footer-items.js +24 -0
- package/dist/utils/use-is-scroll-top.d.ts +8 -0
- package/dist/utils/use-is-scroll-top.js +20 -0
- package/package.json +200 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getScale } from "./get-scale.js";
|
|
2
|
+
import { computePositionedStyle } from "./compute-positioned-style.js";
|
|
3
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js
|
|
4
|
+
const getImgObjectFitStyle = ({ containerHeight, containerLeft, containerTop, containerWidth, hasScalableSrc, objectFit: objectFitParam, objectPosition, offset, targetHeight, targetWidth }) => {
|
|
5
|
+
let resolvedObjectFit = objectFitParam;
|
|
6
|
+
if (resolvedObjectFit === "scale-down") if (targetWidth <= containerWidth && targetHeight <= containerHeight) resolvedObjectFit = "none";
|
|
7
|
+
else resolvedObjectFit = "contain";
|
|
8
|
+
const base = {
|
|
9
|
+
containerHeight,
|
|
10
|
+
containerLeft,
|
|
11
|
+
containerTop,
|
|
12
|
+
containerWidth,
|
|
13
|
+
hasScalableSrc,
|
|
14
|
+
offset,
|
|
15
|
+
position: objectPosition,
|
|
16
|
+
targetHeight,
|
|
17
|
+
targetWidth
|
|
18
|
+
};
|
|
19
|
+
if (resolvedObjectFit === "cover" || resolvedObjectFit === "contain") {
|
|
20
|
+
const widthRatio = containerWidth / targetWidth;
|
|
21
|
+
const heightRatio = containerHeight / targetHeight;
|
|
22
|
+
const ratio = resolvedObjectFit === "cover" ? Math.max(widthRatio, heightRatio) : Math.min(widthRatio, heightRatio);
|
|
23
|
+
return computePositionedStyle({
|
|
24
|
+
...base,
|
|
25
|
+
visibleWidth: targetWidth * ratio,
|
|
26
|
+
visibleHeight: targetHeight * ratio
|
|
27
|
+
});
|
|
28
|
+
} else if (resolvedObjectFit === "none") return computePositionedStyle({
|
|
29
|
+
...base,
|
|
30
|
+
visibleWidth: targetWidth,
|
|
31
|
+
visibleHeight: targetHeight
|
|
32
|
+
});
|
|
33
|
+
else {
|
|
34
|
+
const widthRatio = containerWidth / targetWidth;
|
|
35
|
+
const heightRatio = containerHeight / targetHeight;
|
|
36
|
+
const ratio = Math.max(widthRatio, heightRatio);
|
|
37
|
+
const scale = getScale({
|
|
38
|
+
containerHeight: targetHeight * ratio,
|
|
39
|
+
containerWidth: targetWidth * ratio,
|
|
40
|
+
hasScalableSrc,
|
|
41
|
+
offset,
|
|
42
|
+
targetHeight,
|
|
43
|
+
targetWidth
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
top: containerTop,
|
|
47
|
+
left: containerLeft,
|
|
48
|
+
width: containerWidth * scale,
|
|
49
|
+
height: containerHeight * scale,
|
|
50
|
+
initialTransform: `translate(0,0) scale(${1 / scale})`
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { getImgObjectFitStyle };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getScale } from "./get-scale.js";
|
|
2
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js
|
|
3
|
+
const getImgRegularStyle = ({ containerHeight, containerLeft, containerTop, containerWidth, hasScalableSrc, offset, targetHeight, targetWidth }) => {
|
|
4
|
+
const scale = getScale({
|
|
5
|
+
containerHeight,
|
|
6
|
+
containerWidth,
|
|
7
|
+
hasScalableSrc,
|
|
8
|
+
offset,
|
|
9
|
+
targetHeight,
|
|
10
|
+
targetWidth
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
top: containerTop,
|
|
14
|
+
left: containerLeft,
|
|
15
|
+
width: containerWidth * scale,
|
|
16
|
+
height: containerHeight * scale,
|
|
17
|
+
initialTransform: `translate(0,0) scale(${1 / scale})`
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getImgRegularStyle };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { testDiv, testImg } from "./element-tests.js";
|
|
2
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js
|
|
3
|
+
const URL_REGEX = /url(?:\(['"]?)(?<url>.*?)(?:['"]?\))/;
|
|
4
|
+
const getImgSrc = (imgEl) => {
|
|
5
|
+
if (imgEl !== null) {
|
|
6
|
+
if (testImg(imgEl)) return imgEl.currentSrc === "" ? void 0 : imgEl.currentSrc;
|
|
7
|
+
else if (testDiv(imgEl)) {
|
|
8
|
+
const { backgroundImage: bgImg } = window.getComputedStyle(imgEl);
|
|
9
|
+
if (bgImg !== "") return URL_REGEX.exec(bgImg)?.[1];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { getImgSrc };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js
|
|
2
|
+
const getModalImgTransform = ({ height, initialTransform, isZoomed, left, top, userTransform, width }) => {
|
|
3
|
+
let centeredUserTransform = "";
|
|
4
|
+
if (userTransform !== "none" && userTransform !== "") {
|
|
5
|
+
const halfWidth = width / 2;
|
|
6
|
+
const halfHeight = height / 2;
|
|
7
|
+
centeredUserTransform = `translate(${halfWidth}px,${halfHeight}px) ${userTransform} translate(${-halfWidth}px,${-halfHeight}px)`;
|
|
8
|
+
}
|
|
9
|
+
if (!isZoomed) {
|
|
10
|
+
if (centeredUserTransform === "") return initialTransform;
|
|
11
|
+
return `${initialTransform} ${centeredUserTransform}`;
|
|
12
|
+
}
|
|
13
|
+
const viewportX = window.innerWidth / 2;
|
|
14
|
+
const viewportY = window.innerHeight / 2;
|
|
15
|
+
const childCenterX = left + width / 2;
|
|
16
|
+
const childCenterY = top + height / 2;
|
|
17
|
+
const base = `translate(${viewportX - childCenterX}px,${viewportY - childCenterY}px) scale(1)`;
|
|
18
|
+
if (centeredUserTransform === "") return base;
|
|
19
|
+
return `${base} ${centeredUserTransform}`;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { getModalImgTransform };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-scale.js
|
|
2
|
+
const getScaleToWindow = ({ height, offset, width }) => Math.min((window.innerWidth - offset * 2) / width, (window.innerHeight - offset * 2) / height);
|
|
3
|
+
const getScaleToWindowMax = ({ containerHeight, containerWidth, offset, targetHeight, targetWidth }) => {
|
|
4
|
+
const scale = getScaleToWindow({
|
|
5
|
+
height: targetHeight,
|
|
6
|
+
offset,
|
|
7
|
+
width: targetWidth
|
|
8
|
+
});
|
|
9
|
+
const ratio = targetWidth > targetHeight ? targetWidth / containerWidth : targetHeight / containerHeight;
|
|
10
|
+
return scale > 1 ? ratio : scale * ratio;
|
|
11
|
+
};
|
|
12
|
+
const getScale = ({ containerHeight, containerWidth, hasScalableSrc, offset, targetHeight, targetWidth }) => {
|
|
13
|
+
if (containerHeight === 0 || containerWidth === 0) return 1;
|
|
14
|
+
return !hasScalableSrc && targetHeight !== 0 && targetWidth !== 0 ? getScaleToWindowMax({
|
|
15
|
+
containerHeight,
|
|
16
|
+
containerWidth,
|
|
17
|
+
offset,
|
|
18
|
+
targetHeight,
|
|
19
|
+
targetWidth
|
|
20
|
+
}) : getScaleToWindow({
|
|
21
|
+
height: containerHeight,
|
|
22
|
+
offset,
|
|
23
|
+
width: containerWidth
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { getScale };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { testSvg } from "./element-tests.js";
|
|
2
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js
|
|
3
|
+
const getStyleGhost = (imgEl) => {
|
|
4
|
+
if (imgEl == null) return {};
|
|
5
|
+
if (testSvg(imgEl)) {
|
|
6
|
+
const { parentElement: parentEl } = imgEl;
|
|
7
|
+
const rect = imgEl.getBoundingClientRect();
|
|
8
|
+
if (parentEl == null) return {
|
|
9
|
+
height: rect.height,
|
|
10
|
+
left: rect.left,
|
|
11
|
+
width: rect.width,
|
|
12
|
+
top: rect.top
|
|
13
|
+
};
|
|
14
|
+
else {
|
|
15
|
+
const parentRect = parentEl.getBoundingClientRect();
|
|
16
|
+
return {
|
|
17
|
+
height: rect.height,
|
|
18
|
+
left: parentRect.left - rect.left,
|
|
19
|
+
top: parentRect.top - rect.top,
|
|
20
|
+
width: rect.width
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
} else return {
|
|
24
|
+
height: imgEl.offsetHeight,
|
|
25
|
+
left: imgEl.offsetLeft,
|
|
26
|
+
width: imgEl.offsetWidth,
|
|
27
|
+
top: imgEl.offsetTop
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { getStyleGhost };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { testDiv } from "./element-tests.js";
|
|
2
|
+
import { getImgRegularStyle } from "./get-img-regular-style.js";
|
|
3
|
+
import { getImgObjectFitStyle } from "./get-img-object-fit-style.js";
|
|
4
|
+
import { getDivImgStyle } from "./get-div-img-style.js";
|
|
5
|
+
import { getModalImgTransform } from "./get-modal-img-transform.js";
|
|
6
|
+
import { getTargetDimension } from "./get-target-dimension.js";
|
|
7
|
+
import { testHasScalableSrc } from "./test-has-scalable-src.js";
|
|
8
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js
|
|
9
|
+
const getStyleModalImg = ({ hasZoomImg, imgSrc, isSvg, isZoomed, loadedImgEl, offset, shouldRefresh, targetEl }) => {
|
|
10
|
+
const hasScalableSrc = testHasScalableSrc({
|
|
11
|
+
hasZoomImg,
|
|
12
|
+
imgSrc,
|
|
13
|
+
isSvg
|
|
14
|
+
});
|
|
15
|
+
const imgRect = targetEl.getBoundingClientRect();
|
|
16
|
+
const targetElComputedStyle = window.getComputedStyle(targetEl);
|
|
17
|
+
const isDivImg = loadedImgEl != null && testDiv(targetEl);
|
|
18
|
+
const isImgObjectFit = loadedImgEl != null && !isDivImg;
|
|
19
|
+
const targetHeight = getTargetDimension({
|
|
20
|
+
fallback: imgRect.height,
|
|
21
|
+
natural: loadedImgEl?.naturalHeight
|
|
22
|
+
});
|
|
23
|
+
const targetWidth = getTargetDimension({
|
|
24
|
+
fallback: imgRect.width,
|
|
25
|
+
natural: loadedImgEl?.naturalWidth
|
|
26
|
+
});
|
|
27
|
+
const { height: containerHeight, left: containerLeft, top: containerTop, width: containerWidth } = imgRect;
|
|
28
|
+
const position = isDivImg ? getDivImgStyle({
|
|
29
|
+
backgroundPosition: targetElComputedStyle.backgroundPosition,
|
|
30
|
+
backgroundSize: targetElComputedStyle.backgroundSize,
|
|
31
|
+
containerHeight,
|
|
32
|
+
containerLeft,
|
|
33
|
+
containerTop,
|
|
34
|
+
containerWidth,
|
|
35
|
+
hasScalableSrc,
|
|
36
|
+
offset,
|
|
37
|
+
targetHeight,
|
|
38
|
+
targetWidth
|
|
39
|
+
}) : isImgObjectFit ? getImgObjectFitStyle({
|
|
40
|
+
containerHeight,
|
|
41
|
+
containerLeft,
|
|
42
|
+
containerTop,
|
|
43
|
+
containerWidth,
|
|
44
|
+
hasScalableSrc,
|
|
45
|
+
objectFit: targetElComputedStyle.objectFit,
|
|
46
|
+
objectPosition: targetElComputedStyle.objectPosition,
|
|
47
|
+
offset,
|
|
48
|
+
targetHeight,
|
|
49
|
+
targetWidth
|
|
50
|
+
}) : getImgRegularStyle({
|
|
51
|
+
containerHeight,
|
|
52
|
+
containerLeft,
|
|
53
|
+
containerTop,
|
|
54
|
+
containerWidth,
|
|
55
|
+
hasScalableSrc,
|
|
56
|
+
offset,
|
|
57
|
+
targetHeight,
|
|
58
|
+
targetWidth
|
|
59
|
+
});
|
|
60
|
+
const result = {
|
|
61
|
+
top: position.top,
|
|
62
|
+
left: position.left,
|
|
63
|
+
width: position.width,
|
|
64
|
+
height: position.height,
|
|
65
|
+
transform: getModalImgTransform({
|
|
66
|
+
...position,
|
|
67
|
+
isZoomed,
|
|
68
|
+
userTransform: targetElComputedStyle.transform
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
if (isZoomed && shouldRefresh) result.transitionDuration = "0.01ms";
|
|
72
|
+
return result;
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { getStyleModalImg };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js
|
|
2
|
+
const getTargetDimension = ({ fallback, natural }) => natural !== void 0 && natural !== 0 ? natural : fallback;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { getTargetDimension };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/parse-position.js
|
|
2
|
+
const parsePosition = (position, relativeNum) => {
|
|
3
|
+
const positionNum = parseFloat(position);
|
|
4
|
+
return position.endsWith("%") ? relativeNum * positionNum / 100 : positionNum;
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { parsePosition };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js
|
|
2
|
+
const SRC_SVG_REGEX = /\.svg$/i;
|
|
3
|
+
const testHasScalableSrc = ({ hasZoomImg, imgSrc, isSvg }) => isSvg || imgSrc?.slice(0, 18) === "data:image/svg+xml" || hasZoomImg || imgSrc !== void 0 && SRC_SVG_REGEX.test(imgSrc);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { testHasScalableSrc };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { ImageResponse, ImageResponseOptions } from "@takumi-rs/image-response";
|
|
3
|
+
|
|
4
|
+
//#region src/og/takumi.d.ts
|
|
5
|
+
interface GenerateProps {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
primaryColor?: string;
|
|
10
|
+
primaryTextColor?: string;
|
|
11
|
+
site?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare function generateOGImage(options: GenerateProps & ImageResponseOptions): ImageResponse;
|
|
14
|
+
declare function generate({
|
|
15
|
+
primaryColor,
|
|
16
|
+
primaryTextColor,
|
|
17
|
+
icon,
|
|
18
|
+
...props
|
|
19
|
+
}: GenerateProps): import("react").JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { GenerateProps, generate, generateOGImage };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ImageResponse } from "@takumi-rs/image-response";
|
|
3
|
+
//#region src/og/takumi.tsx
|
|
4
|
+
function generateOGImage(options) {
|
|
5
|
+
const { title, description, icon, site, primaryColor, primaryTextColor, ...rest } = options;
|
|
6
|
+
return new ImageResponse(generate({
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
icon,
|
|
10
|
+
site,
|
|
11
|
+
primaryTextColor,
|
|
12
|
+
primaryColor
|
|
13
|
+
}), {
|
|
14
|
+
width: 1200,
|
|
15
|
+
height: 630,
|
|
16
|
+
...rest
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function generate({ primaryColor = "rgba(255,150,255,0.3)", primaryTextColor = "rgb(255,150,255)", icon = /* @__PURE__ */ jsx("svg", {
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
+
width: "56",
|
|
22
|
+
height: "56",
|
|
23
|
+
viewBox: "0 0 24 24",
|
|
24
|
+
fill: "none",
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeWidth: "2",
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
strokeLinejoin: "round",
|
|
29
|
+
className: "lucide lucide-book-icon lucide-book",
|
|
30
|
+
children: /* @__PURE__ */ jsx("circle", {
|
|
31
|
+
cx: "12",
|
|
32
|
+
cy: "12",
|
|
33
|
+
r: "11",
|
|
34
|
+
stroke: primaryTextColor,
|
|
35
|
+
strokeWidth: "2"
|
|
36
|
+
})
|
|
37
|
+
}), ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
style: {
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
width: "100%",
|
|
43
|
+
height: "100%",
|
|
44
|
+
color: "white",
|
|
45
|
+
padding: "4rem",
|
|
46
|
+
backgroundColor: "#0c0c0c",
|
|
47
|
+
borderBottom: `18px solid ${primaryColor}`
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx("p", {
|
|
51
|
+
style: {
|
|
52
|
+
fontWeight: 800,
|
|
53
|
+
fontSize: "82px",
|
|
54
|
+
margin: 0
|
|
55
|
+
},
|
|
56
|
+
children: props.title
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx("p", {
|
|
59
|
+
style: {
|
|
60
|
+
fontSize: "52px",
|
|
61
|
+
color: "rgba(240,240,240,0.8)",
|
|
62
|
+
margin: 0,
|
|
63
|
+
marginTop: "16px",
|
|
64
|
+
paddingBottom: "28px",
|
|
65
|
+
borderBottom: `10px dashed ${primaryColor}`
|
|
66
|
+
},
|
|
67
|
+
children: props.description
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsxs("div", {
|
|
70
|
+
style: {
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: "row",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
gap: "20px",
|
|
75
|
+
marginTop: "auto",
|
|
76
|
+
color: primaryTextColor
|
|
77
|
+
},
|
|
78
|
+
children: [icon, props.site && /* @__PURE__ */ jsx("p", {
|
|
79
|
+
style: {
|
|
80
|
+
fontSize: "56px",
|
|
81
|
+
fontWeight: 600,
|
|
82
|
+
margin: 0
|
|
83
|
+
},
|
|
84
|
+
children: props.site
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { generate, generateOGImage };
|
package/dist/og.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { ImageResponse } from "next/og.js";
|
|
3
|
+
import { ImageResponseOptions } from "next/dist/compiled/@vercel/og/types";
|
|
4
|
+
|
|
5
|
+
//#region src/og.d.ts
|
|
6
|
+
interface GenerateProps {
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
primaryColor?: string;
|
|
11
|
+
primaryTextColor?: string;
|
|
12
|
+
site?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare function generateOGImage(options: GenerateProps & ImageResponseOptions): ImageResponse;
|
|
15
|
+
declare function generate({
|
|
16
|
+
primaryColor,
|
|
17
|
+
primaryTextColor,
|
|
18
|
+
icon,
|
|
19
|
+
...props
|
|
20
|
+
}: GenerateProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { generate, generateOGImage };
|
package/dist/og.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ImageResponse } from "next/og.js";
|
|
3
|
+
//#region src/og.tsx
|
|
4
|
+
function generateOGImage(options) {
|
|
5
|
+
const { title, description, icon, site, primaryColor, primaryTextColor, ...rest } = options;
|
|
6
|
+
return new ImageResponse(generate({
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
icon,
|
|
10
|
+
site,
|
|
11
|
+
primaryTextColor,
|
|
12
|
+
primaryColor
|
|
13
|
+
}), {
|
|
14
|
+
width: 1200,
|
|
15
|
+
height: 630,
|
|
16
|
+
...rest
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function generate({ primaryColor = "rgba(255,150,255,0.3)", primaryTextColor = "rgb(255,150,255)", icon = /* @__PURE__ */ jsx("svg", {
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
+
width: "56",
|
|
22
|
+
height: "56",
|
|
23
|
+
viewBox: "0 0 24 24",
|
|
24
|
+
fill: "none",
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeWidth: "2",
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
strokeLinejoin: "round",
|
|
29
|
+
className: "lucide lucide-book-icon lucide-book",
|
|
30
|
+
children: /* @__PURE__ */ jsx("circle", {
|
|
31
|
+
cx: "12",
|
|
32
|
+
cy: "12",
|
|
33
|
+
r: "11",
|
|
34
|
+
stroke: primaryTextColor,
|
|
35
|
+
strokeWidth: "2"
|
|
36
|
+
})
|
|
37
|
+
}), ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
style: {
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
width: "100%",
|
|
43
|
+
height: "100%",
|
|
44
|
+
color: "white",
|
|
45
|
+
padding: "4rem",
|
|
46
|
+
backgroundColor: "#0c0c0c",
|
|
47
|
+
borderBottom: `18px solid ${primaryColor}`
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx("p", {
|
|
51
|
+
style: {
|
|
52
|
+
fontWeight: 800,
|
|
53
|
+
fontSize: "82px",
|
|
54
|
+
margin: 0
|
|
55
|
+
},
|
|
56
|
+
children: props.title
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx("p", {
|
|
59
|
+
style: {
|
|
60
|
+
fontSize: "52px",
|
|
61
|
+
color: "rgba(240,240,240,0.8)",
|
|
62
|
+
margin: 0,
|
|
63
|
+
marginTop: "16px",
|
|
64
|
+
paddingBottom: "28px",
|
|
65
|
+
borderBottom: `10px dashed ${primaryColor}`
|
|
66
|
+
},
|
|
67
|
+
children: props.description
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsxs("div", {
|
|
70
|
+
style: {
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: "row",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
gap: "20px",
|
|
75
|
+
marginTop: "auto",
|
|
76
|
+
color: primaryTextColor
|
|
77
|
+
},
|
|
78
|
+
children: [icon, props.site && /* @__PURE__ */ jsx("p", {
|
|
79
|
+
style: {
|
|
80
|
+
fontSize: "56px",
|
|
81
|
+
fontWeight: 600,
|
|
82
|
+
margin: 0
|
|
83
|
+
},
|
|
84
|
+
children: props.site
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { generate, generateOGImage };
|
package/dist/page.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Breadcrumb } from "./layouts/docs/page/slots/breadcrumb.js";
|
|
2
|
+
import { DocsBody, DocsDescription, DocsPageProps as DocsPageProps$1, DocsTitle, EditOnGitHub, PageLastUpdate } from "./layouts/docs/page/index.js";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/page.d.ts
|
|
6
|
+
interface EditOnGitHubOptions extends Omit<ComponentProps<'a'>, 'href' | 'children'> {
|
|
7
|
+
owner: string;
|
|
8
|
+
repo: string;
|
|
9
|
+
/**
|
|
10
|
+
* SHA or ref (branch or tag) name.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue main
|
|
13
|
+
*/
|
|
14
|
+
sha?: string;
|
|
15
|
+
/**
|
|
16
|
+
* File path in the repo
|
|
17
|
+
*/
|
|
18
|
+
path: string;
|
|
19
|
+
}
|
|
20
|
+
interface DocsPageProps extends DocsPageProps$1 {
|
|
21
|
+
editOnGithub?: EditOnGitHubOptions;
|
|
22
|
+
lastUpdate?: Date | string | number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* For separate MDX page
|
|
26
|
+
*/
|
|
27
|
+
declare function withArticle(props: ComponentProps<'main'>): import("react").JSX.Element;
|
|
28
|
+
declare function DocsPage({
|
|
29
|
+
lastUpdate,
|
|
30
|
+
editOnGithub,
|
|
31
|
+
children,
|
|
32
|
+
...props
|
|
33
|
+
}: DocsPageProps): import("react").JSX.Element;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, Breadcrumb as PageBreadcrumb, PageLastUpdate, withArticle };
|
package/dist/page.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "./utils/cn.js";
|
|
3
|
+
import { useIsDocsLayout } from "./layouts/docs/client.js";
|
|
4
|
+
import { Breadcrumb } from "./layouts/docs/page/slots/breadcrumb.js";
|
|
5
|
+
import { DocsBody, DocsDescription, DocsTitle, EditOnGitHub, PageLastUpdate, page_exports } from "./layouts/docs/page/index.js";
|
|
6
|
+
import { page_exports as page_exports$1 } from "./layouts/notebook/page/index.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/page.tsx
|
|
9
|
+
/**
|
|
10
|
+
* For separate MDX page
|
|
11
|
+
*/
|
|
12
|
+
function withArticle(props) {
|
|
13
|
+
return /* @__PURE__ */ jsx("main", {
|
|
14
|
+
...props,
|
|
15
|
+
className: cn("w-full max-w-[1400px] mx-auto px-4 py-12", props.className),
|
|
16
|
+
children: /* @__PURE__ */ jsx("article", {
|
|
17
|
+
className: "prose",
|
|
18
|
+
children: props.children
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function DocsPage({ lastUpdate, editOnGithub, children, ...props }) {
|
|
23
|
+
const { DocsPage, EditOnGitHub, PageLastUpdate } = useIsDocsLayout() ? page_exports : page_exports$1;
|
|
24
|
+
return /* @__PURE__ */ jsxs(DocsPage, {
|
|
25
|
+
...props,
|
|
26
|
+
children: [children, /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden",
|
|
28
|
+
children: [editOnGithub && /* @__PURE__ */ jsx(EditOnGitHub, { href: `https://github.com/${editOnGithub.owner}/${editOnGithub.repo}/blob/${editOnGithub.sha}/${editOnGithub.path.startsWith("/") ? editOnGithub.path.slice(1) : editOnGithub.path}` }), lastUpdate && /* @__PURE__ */ jsx(PageLastUpdate, { date: new Date(lastUpdate) })]
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, Breadcrumb as PageBreadcrumb, PageLastUpdate, withArticle };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SearchProviderProps } from "../contexts/search.js";
|
|
2
|
+
import { DefaultSearchDialogProps } from "../components/dialog/search-default.js";
|
|
3
|
+
import { I18nProviderProps } from "../contexts/i18n.js";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
import { ThemeProviderProps, UseThemeProps, useTheme } from "next-themes";
|
|
6
|
+
|
|
7
|
+
//#region src/provider/base.d.ts
|
|
8
|
+
interface SearchOptions extends Omit<SearchProviderProps, 'options' | 'children'> {
|
|
9
|
+
options?: Partial<DefaultSearchDialogProps>;
|
|
10
|
+
/**
|
|
11
|
+
* Enable search functionality
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue `true`
|
|
14
|
+
*/
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface ThemeOptions extends ThemeProviderProps {
|
|
18
|
+
/**
|
|
19
|
+
* Enable `next-themes`
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue true
|
|
22
|
+
*/
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface RootProviderProps {
|
|
26
|
+
/**
|
|
27
|
+
* `dir` option for Radix UI
|
|
28
|
+
*/
|
|
29
|
+
dir?: 'rtl' | 'ltr';
|
|
30
|
+
/**
|
|
31
|
+
* @remarks `SearchProviderProps`
|
|
32
|
+
*/
|
|
33
|
+
search?: Partial<SearchOptions>;
|
|
34
|
+
/**
|
|
35
|
+
* Customize options for `next-themes`
|
|
36
|
+
*/
|
|
37
|
+
theme?: ThemeOptions;
|
|
38
|
+
i18n?: Omit<I18nProviderProps, 'children'>;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
declare function RootProvider({
|
|
42
|
+
children,
|
|
43
|
+
dir,
|
|
44
|
+
theme,
|
|
45
|
+
search,
|
|
46
|
+
i18n
|
|
47
|
+
}: RootProviderProps): import("react").JSX.Element;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { RootProvider, RootProviderProps, type UseThemeProps, useTheme };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { I18nProvider } from "../contexts/i18n.js";
|
|
3
|
+
import { SearchProvider } from "../contexts/search.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { ThemeProvider, useTheme } from "next-themes";
|
|
6
|
+
import { DirectionProvider } from "@radix-ui/react-direction";
|
|
7
|
+
//#region src/provider/base.tsx
|
|
8
|
+
function RootProvider({ children, dir = "ltr", theme = {}, search, i18n }) {
|
|
9
|
+
let body = children;
|
|
10
|
+
if (search?.enabled !== false) body = /* @__PURE__ */ jsx(SearchProvider, {
|
|
11
|
+
...search,
|
|
12
|
+
children: body
|
|
13
|
+
});
|
|
14
|
+
if (theme?.enabled !== false) body = /* @__PURE__ */ jsx(ThemeProvider, {
|
|
15
|
+
attribute: "class",
|
|
16
|
+
defaultTheme: "system",
|
|
17
|
+
enableSystem: true,
|
|
18
|
+
disableTransitionOnChange: true,
|
|
19
|
+
...theme,
|
|
20
|
+
children: body
|
|
21
|
+
});
|
|
22
|
+
if (i18n) body = /* @__PURE__ */ jsx(I18nProvider, {
|
|
23
|
+
...i18n,
|
|
24
|
+
children: body
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsx(DirectionProvider, {
|
|
27
|
+
dir,
|
|
28
|
+
children: body
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { RootProvider, useTheme };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RootProvider as RootProvider$1 } from "./base.js";
|
|
2
|
+
import { Framework } from "fumadocs-core/framework";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/provider/next.d.ts
|
|
6
|
+
interface RootProviderProps extends ComponentProps<typeof RootProvider$1> {
|
|
7
|
+
/**
|
|
8
|
+
* Custom framework components to override Next.js defaults
|
|
9
|
+
*/
|
|
10
|
+
components?: {
|
|
11
|
+
Link?: Framework['Link'];
|
|
12
|
+
Image?: Framework['Image'];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare function RootProvider({
|
|
16
|
+
components,
|
|
17
|
+
...props
|
|
18
|
+
}: RootProviderProps): import("react").JSX.Element;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { RootProvider, RootProviderProps };
|