@gentleduck/docs 0.0.14 → 0.1.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/arrow-CU5T6t_D-BA13FgoC.js +2 -0
- package/dist/arrow-CU5T6t_D-BA13FgoC.js.map +1 -0
- package/dist/{callout-C_FrO3-r.d.ts → callout-BljL1am5.d.ts} +6 -3
- package/dist/callout-BljL1am5.d.ts.map +1 -0
- package/dist/callout-DkKMc7na.js +2 -0
- package/dist/callout-DkKMc7na.js.map +1 -0
- package/dist/client.d.ts +35 -35
- package/dist/client.js +1 -1
- package/dist/{code-block-B-PLa30f.d.ts → code-block-m30mdI9p.d.ts} +3 -3
- package/dist/{code-block-B-PLa30f.d.ts.map → code-block-m30mdI9p.d.ts.map} +1 -1
- package/dist/{code-block-wrapper-BM4jRJHq.d.ts → code-block-wrapper-B03D2UFo.d.ts} +3 -3
- package/dist/{code-block-wrapper-BM4jRJHq.d.ts.map → code-block-wrapper-B03D2UFo.d.ts.map} +1 -1
- package/dist/{code-preview-DST_xvt7.d.ts → code-preview-C_w-RQJy.d.ts} +3 -3
- package/dist/{code-preview-DST_xvt7.d.ts.map → code-preview-C_w-RQJy.d.ts.map} +1 -1
- package/dist/code-preview-CosZjiht.js +2 -0
- package/dist/code-preview-CosZjiht.js.map +1 -0
- package/dist/command-menu-Da3HJhYE.d.ts +7 -0
- package/dist/command-menu-Da3HJhYE.d.ts.map +1 -0
- package/dist/{component-preview-K8cndl5t.d.ts → component-preview-BFirIcu2.d.ts} +4 -4
- package/dist/{component-preview-K8cndl5t.d.ts.map → component-preview-BFirIcu2.d.ts.map} +1 -1
- package/dist/{component-source-Ch59vA1U.d.ts → component-source-BV9w0kxF.d.ts} +3 -3
- package/dist/{component-source-Ch59vA1U.d.ts.map → component-source-BV9w0kxF.d.ts.map} +1 -1
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/docs/docs-copy-page.d.ts +1 -1
- package/dist/components/docs/docs-copy-page.js +1 -1
- package/dist/components/docs/docs-pager.d.ts +2 -2
- package/dist/components/docs/docs-sidebar.d.ts +2 -2
- package/dist/components/docs/docs-toc.d.ts +2 -2
- package/dist/components/docs/docs-toc.js +1 -1
- package/dist/components/docs/index.d.ts +5 -5
- package/dist/components/docs/index.js +1 -1
- package/dist/components/icons.d.ts +1 -1
- package/dist/components/index.d.ts +32 -32
- package/dist/components/index.js +1 -1
- package/dist/components/layouts/command-menu.d.ts +1 -1
- package/dist/components/layouts/header-shell.d.ts +1 -1
- package/dist/components/layouts/index.d.ts +5 -5
- package/dist/components/layouts/site-footer.d.ts +1 -1
- package/dist/components/layouts/site-header.d.ts +2 -2
- package/dist/components/layouts/tailwind-indicator.d.ts +1 -1
- package/dist/components/main-nav.d.ts +1 -1
- package/dist/components/mdx/mdx-components/callout.d.ts +1 -1
- package/dist/components/mdx/mdx-components/callout.js +1 -1
- package/dist/components/mdx/mdx-components/code/code-block-wrapper.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/code-block.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/code-preview.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/code-preview.js +1 -1
- package/dist/components/mdx/mdx-components/code/component-preview.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/component-source.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/figcaption-block.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/index.d.ts +8 -8
- package/dist/components/mdx/mdx-components/code/index.js +1 -1
- package/dist/components/mdx/mdx-components/code/mermaid-block.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/mermaid-block.js +1 -1
- package/dist/components/mdx/mdx-components/code/pre-block/index.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/pre-block/pre-block.d.ts +1 -1
- package/dist/components/mdx/mdx-components/code/pre-block/shell-command.d.ts +2 -2
- package/dist/components/mdx/mdx-components/code/span-block.d.ts +2 -2
- package/dist/components/mdx/mdx-components/components-list.d.ts +2 -2
- package/dist/components/mdx/mdx-components/exalidraw.d.ts +2 -2
- package/dist/components/mdx/mdx-components/exalidraw.d.ts.map +1 -1
- package/dist/components/mdx/mdx-components/index.d.ts +14 -14
- package/dist/components/mdx/mdx-components/index.js +1 -1
- package/dist/components/mdx/mdx-components/table.d.ts +1 -1
- package/dist/components/mdx/mdx-components/tabs.d.ts +1 -1
- package/dist/components/mdx/mdx-components/typepography.d.ts +1 -1
- package/dist/components/mdx/mdx-components/typography.d.ts +1 -1
- package/dist/components/mdx/mdx-components-base.d.ts +35 -35
- package/dist/components/mdx/mdx-components-base.d.ts.map +1 -1
- package/dist/components/mdx/mdx-components-base.js +1 -1
- package/dist/components/mdx/mdx-components-registry.d.ts +54 -54
- package/dist/components/mdx/mdx-components-registry.js +1 -1
- package/dist/components/mdx/mdx-components-ui.d.ts +17 -17
- package/dist/components/mdx/mdx-icons.d.ts +9 -9
- package/dist/components/mdx/mdx-icons.d.ts.map +1 -1
- package/dist/components/mdx/mdx.d.ts +1 -1
- package/dist/components/mdx/mdx.js +1 -1
- package/dist/components/mobile-nav.d.ts +1 -1
- package/dist/components/mode-toggle.d.ts +1 -1
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/providers.d.ts +1 -1
- package/dist/components/style-switcher.d.ts +1 -1
- package/dist/components/style-switcher.js +1 -1
- package/dist/{components-list-COrPlZeD.d.ts → components-list-C67E8feA.d.ts} +3 -3
- package/dist/{components-list-COrPlZeD.d.ts.map → components-list-C67E8feA.d.ts.map} +1 -1
- package/dist/context/context.d.ts +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/{context-jLJ1ef7m.d.ts → context-G6fO8z8e.d.ts} +3 -3
- package/dist/{context-jLJ1ef7m.d.ts.map → context-G6fO8z8e.d.ts.map} +1 -1
- package/dist/{copy-button-CCqEsELt.d.ts → copy-button-DTBIjulx.d.ts} +3 -3
- package/dist/{copy-button-CCqEsELt.d.ts.map → copy-button-DTBIjulx.d.ts.map} +1 -1
- package/dist/{docs-copy-page-Dr_nxgGI.d.ts → docs-copy-page-B2M0pWVO.d.ts} +3 -3
- package/dist/{docs-copy-page-Dr_nxgGI.d.ts.map → docs-copy-page-B2M0pWVO.d.ts.map} +1 -1
- package/dist/{docs-copy-page-CPk7TsfY.js → docs-copy-page-QXgUbioW.js} +2 -2
- package/dist/{docs-copy-page-CPk7TsfY.js.map → docs-copy-page-QXgUbioW.js.map} +1 -1
- package/dist/{docs-pager-B8tRIKlg.d.ts → docs-pager-DJz0NlHj.d.ts} +4 -4
- package/dist/{docs-pager-B8tRIKlg.d.ts.map → docs-pager-DJz0NlHj.d.ts.map} +1 -1
- package/dist/{docs-sidebar-DfybXB8i.d.ts → docs-sidebar-COOZU42U.d.ts} +5 -5
- package/dist/{docs-sidebar-DfybXB8i.d.ts.map → docs-sidebar-COOZU42U.d.ts.map} +1 -1
- package/dist/docs-toc-Bjmkbd6l.js +2 -0
- package/dist/docs-toc-Bjmkbd6l.js.map +1 -0
- package/dist/{docs-toc-D-y66YCw.d.ts → docs-toc-DFIdveuV.d.ts} +3 -3
- package/dist/docs-toc-DFIdveuV.d.ts.map +1 -0
- package/dist/drawer-kwSiurIF.js.map +1 -1
- package/dist/{figcaption-block-BywypQCe.d.ts → figcaption-block-CE5oSXqV.d.ts} +3 -3
- package/dist/{figcaption-block-BywypQCe.d.ts.map → figcaption-block-CE5oSXqV.d.ts.map} +1 -1
- package/dist/{header-shell-DkmS4hnL.d.ts → header-shell-BD_KZp5P.d.ts} +6 -6
- package/dist/{header-shell-DkmS4hnL.d.ts.map → header-shell-BD_KZp5P.d.ts.map} +1 -1
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/use-colors.d.ts +1 -1
- package/dist/hooks/use-config.d.ts +1 -1
- package/dist/hooks/use-themes-config.d.ts +1 -1
- package/dist/icons-CEKc8KIK.d.ts +33 -0
- package/dist/{icons-DyZHG9BC.d.ts.map → icons-CEKc8KIK.d.ts.map} +1 -1
- package/dist/main-nav-Ctrj2x2N.d.ts +7 -0
- package/dist/main-nav-Ctrj2x2N.d.ts.map +1 -0
- package/dist/{mdx-D0Kp6lsv.js → mdx-CpGlQTio.js} +2 -2
- package/dist/{mdx-D0Kp6lsv.js.map → mdx-CpGlQTio.js.map} +1 -1
- package/dist/{mdx-components-base-CXqWNN8M.js → mdx-components-base-ByG7D4Kc.js} +2 -2
- package/dist/{mdx-components-base-CXqWNN8M.js.map → mdx-components-base-ByG7D4Kc.js.map} +1 -1
- package/dist/mdx-components-registry-H3xD8Epe.js +2 -0
- package/dist/{mdx-components-registry-C12f6wSV.js.map → mdx-components-registry-H3xD8Epe.js.map} +1 -1
- package/dist/mdx-h6JettMS.d.ts +12 -0
- package/dist/{mdx-Cjg68fQA.d.ts.map → mdx-h6JettMS.d.ts.map} +1 -1
- package/dist/{mermaid-block-zasLfGio.js → mermaid-block-BfbjIpjJ.js} +2 -2
- package/dist/{mermaid-block-zasLfGio.js.map → mermaid-block-BfbjIpjJ.js.map} +1 -1
- package/dist/{mermaid-block--sl7UWp2.d.ts → mermaid-block-rybOJWpg.d.ts} +3 -3
- package/dist/{mermaid-block--sl7UWp2.d.ts.map → mermaid-block-rybOJWpg.d.ts.map} +1 -1
- package/dist/mobile-nav-AFA-q06-.d.ts +7 -0
- package/dist/mobile-nav-AFA-q06-.d.ts.map +1 -0
- package/dist/mode-toggle-DWWbLZRs.d.ts +7 -0
- package/dist/mode-toggle-DWWbLZRs.d.ts.map +1 -0
- package/dist/{page-header-BNqr7gpZ.d.ts → page-header-DQCmkWDX.d.ts} +6 -6
- package/dist/{page-header-BNqr7gpZ.d.ts.map → page-header-DQCmkWDX.d.ts.map} +1 -1
- package/dist/{pre-block-DvvPHwIA.d.ts → pre-block-F_4-UA8l.d.ts} +3 -3
- package/dist/{pre-block-DvvPHwIA.d.ts.map → pre-block-F_4-UA8l.d.ts.map} +1 -1
- package/dist/{providers-BI7hm1su.d.ts → providers-B0ODnIm1.d.ts} +3 -3
- package/dist/providers-B0ODnIm1.d.ts.map +1 -0
- package/dist/rehype-mermaid-Be9A3aSw.js +17 -0
- package/dist/rehype-mermaid-Be9A3aSw.js.map +1 -0
- package/dist/rehype-mermaid-DPZ6UzOu.d.ts.map +1 -1
- package/dist/site-footer-w_qK7a_h.d.ts +8 -0
- package/dist/site-footer-w_qK7a_h.d.ts.map +1 -0
- package/dist/site-header-O1FU0XVF.d.ts +8 -0
- package/dist/site-header-O1FU0XVF.d.ts.map +1 -0
- package/dist/{style-switcher-BFkgsXlx.js → style-switcher--saWXPVm.js} +2 -2
- package/dist/{style-switcher-BFkgsXlx.js.map → style-switcher--saWXPVm.js.map} +1 -1
- package/dist/{style-switcher-B0i_slue.d.ts → style-switcher-DNuoC5KO.d.ts} +3 -3
- package/dist/{style-switcher-B0i_slue.d.ts.map → style-switcher-DNuoC5KO.d.ts.map} +1 -1
- package/dist/{table-5xep6A9Y.d.ts → table-DRHiU2Ab.d.ts} +6 -6
- package/dist/table-DRHiU2Ab.d.ts.map +1 -0
- package/dist/{tabs-BJcH-Dvh.d.ts → tabs-DwusxM55.d.ts} +6 -6
- package/dist/{tabs-BJcH-Dvh.d.ts.map → tabs-DwusxM55.d.ts.map} +1 -1
- package/dist/tailwind-indicator-BffzhANl.d.ts +7 -0
- package/dist/tailwind-indicator-BffzhANl.d.ts.map +1 -0
- package/dist/{typepography-D0UONiAu.d.ts → typepography-DMTlGGcT.d.ts} +13 -13
- package/dist/typepography-DMTlGGcT.d.ts.map +1 -0
- package/dist/{use-colors-BF9FOADD.d.ts → use-colors-CBAXuqtP.d.ts} +2 -2
- package/dist/use-colors-CBAXuqtP.d.ts.map +1 -0
- package/dist/{use-config-DKOEW76q.d.ts → use-config-3gNoFPn6.d.ts} +3 -3
- package/dist/{use-config-DKOEW76q.d.ts.map → use-config-3gNoFPn6.d.ts.map} +1 -1
- package/dist/{use-themes-config-I8d5A3YB.d.ts → use-themes-config-DfxLBbQI.d.ts} +3 -3
- package/dist/use-themes-config-DfxLBbQI.d.ts.map +1 -0
- package/dist/velite/config.d.ts.map +1 -1
- package/dist/velite/config.js +1 -1
- package/dist/velite/config.js.map +1 -1
- package/dist/velite/index.js +1 -1
- package/dist/velite/plugins/index.js +1 -1
- package/dist/velite/plugins/rehype-mermaid.js +1 -1
- package/package.json +15 -15
- package/src/components/docs/docs-toc.tsx +41 -39
- package/src/components/mdx/mdx-components/callout.tsx +21 -1
- package/src/components/mdx/mdx-components/code/code-preview.tsx +4 -4
- package/src/velite/config.ts +5 -1
- package/src/velite/plugins/rehype-mermaid.ts +17 -2
- package/dist/arrow-CU5T6t_D-Cs2Ykttv.js +0 -2
- package/dist/arrow-CU5T6t_D-Cs2Ykttv.js.map +0 -1
- package/dist/callout-C_FrO3-r.d.ts.map +0 -1
- package/dist/callout-WZt8I4Tj.js +0 -2
- package/dist/callout-WZt8I4Tj.js.map +0 -1
- package/dist/code-preview--lq9QGa0.js +0 -2
- package/dist/code-preview--lq9QGa0.js.map +0 -1
- package/dist/command-menu-D4LwSLnr.d.ts +0 -7
- package/dist/command-menu-D4LwSLnr.d.ts.map +0 -1
- package/dist/docs-toc-D-y66YCw.d.ts.map +0 -1
- package/dist/docs-toc-hcordVHk.js +0 -2
- package/dist/docs-toc-hcordVHk.js.map +0 -1
- package/dist/icons-DyZHG9BC.d.ts +0 -33
- package/dist/main-nav-vyEIJEhN.d.ts +0 -7
- package/dist/main-nav-vyEIJEhN.d.ts.map +0 -1
- package/dist/mdx-Cjg68fQA.d.ts +0 -12
- package/dist/mdx-components-registry-C12f6wSV.js +0 -2
- package/dist/mobile-nav-CRH545YU.d.ts +0 -7
- package/dist/mobile-nav-CRH545YU.d.ts.map +0 -1
- package/dist/mode-toggle-CNBqTwkg.d.ts +0 -7
- package/dist/mode-toggle-CNBqTwkg.d.ts.map +0 -1
- package/dist/providers-BI7hm1su.d.ts.map +0 -1
- package/dist/rehype-mermaid-Ctag2Ywx.js +0 -17
- package/dist/rehype-mermaid-Ctag2Ywx.js.map +0 -1
- package/dist/site-footer-By5G_jLv.d.ts +0 -8
- package/dist/site-footer-By5G_jLv.d.ts.map +0 -1
- package/dist/site-header-lVtvm8N5.d.ts +0 -8
- package/dist/site-header-lVtvm8N5.d.ts.map +0 -1
- package/dist/table-5xep6A9Y.d.ts.map +0 -1
- package/dist/tailwind-indicator-DoT2AWBN.d.ts +0 -7
- package/dist/tailwind-indicator-DoT2AWBN.d.ts.map +0 -1
- package/dist/typepography-D0UONiAu.d.ts.map +0 -1
- package/dist/use-colors-BF9FOADD.d.ts.map +0 -1
- package/dist/use-themes-config-I8d5A3YB.d.ts.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { n as Theme } from "./themes-M1nDuQoV.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as jotai_utils1 from "jotai/utils";
|
|
3
3
|
|
|
4
4
|
//#region src/hooks/use-themes-config.d.ts
|
|
5
5
|
type ThemesConfig = {
|
|
6
6
|
activeTheme: Theme;
|
|
7
7
|
};
|
|
8
8
|
declare function useThemesConfig(): {
|
|
9
|
-
setThemesConfig: (args_0:
|
|
9
|
+
setThemesConfig: (args_0: typeof jotai_utils1.RESET | ThemesConfig | ((prev: ThemesConfig) => typeof jotai_utils1.RESET | ThemesConfig)) => void;
|
|
10
10
|
themesConfig: ThemesConfig;
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
13
|
export { useThemesConfig as t };
|
|
14
|
-
//# sourceMappingURL=use-themes-config-
|
|
14
|
+
//# sourceMappingURL=use-themes-config-DfxLBbQI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-themes-config-DfxLBbQI.d.ts","names":[],"sources":["../src/hooks/use-themes-config.ts"],"sourcesContent":[],"mappings":";;;;KAIK,YAAA;eACU;;AADV,iBAQW,eAAA,CAAA,CAPI,EAAA;EAOJ,eAAA,EAAA,CAAe,MAAA,EAAA,OAAA,YAAA,CAAA,KAAA,eAAA,GAAA,CAAA,CAAA,IAAA,cAAA,EAAA,GAAA,yBAAA,eAAA,CAAA,EAAA,GAAA,IAAA;EAAA,YAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","names":[],"sources":["../../src/velite/config.ts"],"sourcesContent":[],"mappings":";;;KAaY,uBAAA;;EAAA,aAAA,CAAA,EAEM,SAFN,EAAuB;EAEjB,mBAAA,CAAA,EACM,SADN,EAAA;EACM,aAAA,CAAA,EACN,SADM,EAAA;EACN,mBAAA,CAAA,EACM,SADN,EAAA;CACM;AAAS,
|
|
1
|
+
{"version":3,"file":"config.d.ts","names":[],"sources":["../../src/velite/config.ts"],"sourcesContent":[],"mappings":";;;KAaY,uBAAA;;EAAA,aAAA,CAAA,EAEM,SAFN,EAAuB;EAEjB,mBAAA,CAAA,EACM,SADN,EAAA;EACM,aAAA,CAAA,EACN,SADM,EAAA;EACN,mBAAA,CAAA,EACM,SADN,EAAA;CACM;AAAS,iBA4DjB,sBAAA,CA5DiB;EAAA,WAAA;EAAA,aAAA;EAAA,mBAAA;EAAA,aAAA;EAAA;AAAA,CAAA,CAAA,EAkE9B,uBAlE8B,CAAA,EAAA,GAAA;AA4DjB,cA6DH,gBA7DyB,EAAA,GAAA"}
|
package/dist/velite/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"../metadata-plugin-DA7OesoA.js";import{t}from"../rehype-mermaid-
|
|
1
|
+
import{t as e}from"../metadata-plugin-DA7OesoA.js";import{t}from"../rehype-mermaid-Be9A3aSw.js";import{t as n}from"../rehype-npm-command-0W5WqcQY.js";import{t as r}from"../rehype-pre-block-source-paX7yPQ4.js";import{t as i}from"../rehype-title-CB9V-h9I.js";import"./plugins/index.js";import{cleanTocItems as a}from"./utils.js";import o from"rehype-autolink-headings";import s from"rehype-pretty-code";import c from"rehype-slug";import{codeImport as l}from"remark-code-import";import u from"remark-gfm";import{createHighlighter as d}from"shiki";import{defineConfig as f,s as p}from"velite";function m({rehypePlugins:a=[],rehypePluginsBefore:l=[]}){return[...l,c,e,[s,{getHighlighter:d,onVisitHighlightedLine(e){e.properties||={},e.properties.className||(e.properties.className=[]),e.properties.className.push(`line--highlighted`)},onVisitHighlightedWord(e){e.properties.className=[`word--highlighted`]},onVisitLine(e){e.children?.length===0&&(e.children=[{type:`text`,value:` `}])},theme:{dark:`catppuccin-mocha`,light:`github-light`}}],i,r,t,n,[o,{properties:{ariaLabel:`Link to section`,className:[`subheading-anchor`]}}],...a]}function h({remarkPlugins:e=[],remarkPluginsBefore:t=[]}){return[...t,u,l,...e]}function g({docsPattern:e=`docs/**/*.mdx`,rehypePlugins:t=[],rehypePluginsBefore:n=[],remarkPlugins:r=[],remarkPluginsBefore:i=[]}={}){return f({collections:{docs:{name:`Docs`,pattern:e,schema:p.object({body:p.mdx(),component:p.boolean().default(!1),content:p.markdown(),description:p.string(),excerpt:p.excerpt(),links:p.object({api:p.string().optional(),doc:p.string().optional()}).optional(),metadata:p.metadata(),title:p.string().max(99),toc:p.toc()}).transform((e,{path:t,meta:n})=>{let r=n;return{...e,contentType:r.path.split(`.`).pop(),flattenedPath:r.path.split(`/`).slice(-2,-1).join(`/`).replace(/\.mdx$/,``),permalink:r.path.replace(/^.*docs\//,``).replace(/\.mdx$/,``),slug:r.path.split(`docs/`).pop()?.replace(/\.mdx$/,``).replace(/^\/+/,``)?`docs/${r.path.split(`docs/`).pop()?.replace(/\.mdx$/,``).replace(/^\/+/,``)}`:`docs`,sourceFileDir:r.path.split(`/`).slice(-3,-1).join(`/`),sourceFileName:r.path.split(`/`).pop(),sourceFilePath:t,toc:a(e.toc)}})}},mdx:{rehypePlugins:m({rehypePlugins:t,rehypePluginsBefore:n}),remarkPlugins:h({remarkPlugins:r,remarkPluginsBefore:i})}})}const _=g();export{g as createDocsVeliteConfig,_ as docsVeliteConfig};
|
|
2
2
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../../src/velite/config.ts"],"sourcesContent":["import type { UnistNode } from '@duck-docs/types'\nimport
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../src/velite/config.ts"],"sourcesContent":["import type { UnistNode } from '@duck-docs/types'\nimport rehypeAutolinkHeadings from 'rehype-autolink-headings'\n// @ts-ignore\nimport rehypePrettyCode from 'rehype-pretty-code'\nimport rehypeSlug from 'rehype-slug'\nimport { codeImport } from 'remark-code-import'\nimport remarkGfm from 'remark-gfm'\nimport { createHighlighter as getHighlighter } from 'shiki'\nimport type { Pluggable } from 'unified'\nimport { defineConfig, s, type ZodMeta } from 'velite'\nimport { rehypeMermaid, rehypeMetadataPlugin, rehypeNpmCommand, rehypePreBlockSource, rehypeTitle } from './plugins'\nimport { cleanTocItems } from './utils'\n\nexport type DocsVeliteConfigOptions = {\n docsPattern?: string\n rehypePlugins?: Pluggable[]\n rehypePluginsBefore?: Pluggable[]\n remarkPlugins?: Pluggable[]\n remarkPluginsBefore?: Pluggable[]\n}\n\nfunction buildDefaultRehypePlugins({\n rehypePlugins = [],\n rehypePluginsBefore = [],\n}: Pick<DocsVeliteConfigOptions, 'rehypePlugins' | 'rehypePluginsBefore'>): Pluggable[] {\n return [\n ...rehypePluginsBefore,\n // 1) Structural transforms.\n // @ts-ignore\n rehypeSlug,\n rehypeMetadataPlugin,\n // 2) Syntax highlighting.\n [\n rehypePrettyCode,\n {\n getHighlighter,\n onVisitHighlightedLine(node: UnistNode) {\n // @ts-ignore\n if (!node.properties) node.properties = {}\n // @ts-ignore\n if (!node.properties.className) node.properties.className = []\n // @ts-ignore\n node.properties.className.push('line--highlighted')\n },\n onVisitHighlightedWord(node: UnistNode) {\n // @ts-ignore\n node.properties.className = ['word--highlighted']\n },\n onVisitLine(node: UnistNode) {\n if (node.children?.length === 0) {\n node.children = [{ type: 'text', value: ' ' }]\n }\n },\n theme: {\n dark: 'catppuccin-mocha',\n light: 'github-light',\n },\n },\n ],\n // 3) Post-highlight enrichments and specialized transforms.\n rehypeTitle,\n rehypePreBlockSource,\n rehypeMermaid,\n rehypeNpmCommand,\n // 4) Heading links for docs navigation.\n // @ts-ignore\n [rehypeAutolinkHeadings, { properties: { ariaLabel: 'Link to section', className: ['subheading-anchor'] } }],\n ...rehypePlugins,\n ]\n}\n\nfunction buildDefaultRemarkPlugins({\n remarkPlugins = [],\n remarkPluginsBefore = [],\n}: Pick<DocsVeliteConfigOptions, 'remarkPlugins' | 'remarkPluginsBefore'>): Pluggable[] {\n return [...remarkPluginsBefore, remarkGfm, codeImport, ...remarkPlugins]\n}\n\nexport function createDocsVeliteConfig({\n docsPattern = 'docs/**/*.mdx',\n rehypePlugins = [],\n rehypePluginsBefore = [],\n remarkPlugins = [],\n remarkPluginsBefore = [],\n}: DocsVeliteConfigOptions = {}) {\n return defineConfig({\n collections: {\n docs: {\n name: 'Docs',\n pattern: docsPattern,\n schema: s\n .object({\n body: s.mdx(),\n component: s.boolean().default(false),\n content: s.markdown(),\n description: s.string(),\n excerpt: s.excerpt(),\n links: s.object({ api: s.string().optional(), doc: s.string().optional() }).optional(),\n metadata: s.metadata(),\n title: s.string().max(99),\n toc: s.toc(),\n })\n .transform((data, { path, meta }) => {\n const _meta = meta as ZodMeta & { path: string }\n return {\n ...data,\n contentType: _meta.path.split('.').pop(),\n flattenedPath: _meta.path\n .split('/')\n .slice(-2, -1)\n .join('/')\n .replace(/\\.mdx$/, ''),\n permalink: _meta.path.replace(/^.*docs\\//, '').replace(/\\.mdx$/, ''),\n slug: _meta.path\n .split('docs/')\n .pop()\n ?.replace(/\\.mdx$/, '')\n .replace(/^\\/+/, '')\n ? `docs/${_meta.path\n .split('docs/')\n .pop()\n ?.replace(/\\.mdx$/, '')\n .replace(/^\\/+/, '')}`\n : 'docs',\n sourceFileDir: _meta.path.split('/').slice(-3, -1).join('/'),\n sourceFileName: _meta.path.split('/').pop(),\n sourceFilePath: path,\n toc: cleanTocItems(data.toc),\n }\n }),\n },\n },\n mdx: {\n rehypePlugins: buildDefaultRehypePlugins({ rehypePlugins, rehypePluginsBefore }),\n remarkPlugins: buildDefaultRemarkPlugins({ remarkPlugins, remarkPluginsBefore }),\n },\n }) as any\n}\n\nexport const docsVeliteConfig = createDocsVeliteConfig()\n"],"mappings":"6kBAqBA,SAAS,EAA0B,CACjC,gBAAgB,EAAE,CAClB,sBAAsB,EAAE,EAC8D,CACtF,MAAO,CACL,GAAG,EAGH,EACA,EAEA,CACE,EACA,CACE,eAAA,EACA,uBAAuB,EAAiB,CAEtC,AAAsB,EAAK,aAAa,EAAE,CAErC,EAAK,WAAW,YAAW,EAAK,WAAW,UAAY,EAAE,EAE9D,EAAK,WAAW,UAAU,KAAK,oBAAoB,EAErD,uBAAuB,EAAiB,CAEtC,EAAK,WAAW,UAAY,CAAC,oBAAoB,EAEnD,YAAY,EAAiB,CACvB,EAAK,UAAU,SAAW,IAC5B,EAAK,SAAW,CAAC,CAAE,KAAM,OAAQ,MAAO,IAAK,CAAC,GAGlD,MAAO,CACL,KAAM,mBACN,MAAO,eACR,CACF,CACF,CAED,EACA,EACA,EACA,EAGA,CAAC,EAAwB,CAAE,WAAY,CAAE,UAAW,kBAAmB,UAAW,CAAC,oBAAoB,CAAE,CAAE,CAAC,CAC5G,GAAG,EACJ,CAGH,SAAS,EAA0B,CACjC,gBAAgB,EAAE,CAClB,sBAAsB,EAAE,EAC8D,CACtF,MAAO,CAAC,GAAG,EAAqB,EAAW,EAAY,GAAG,EAAc,CAG1E,SAAgB,EAAuB,CACrC,cAAc,gBACd,gBAAgB,EAAE,CAClB,sBAAsB,EAAE,CACxB,gBAAgB,EAAE,CAClB,sBAAsB,EAAE,EACG,EAAE,CAAE,CAC/B,OAAO,EAAa,CAClB,YAAa,CACX,KAAM,CACJ,KAAM,OACN,QAAS,EACT,OAAQ,EACL,OAAO,CACN,KAAM,EAAE,KAAK,CACb,UAAW,EAAE,SAAS,CAAC,QAAQ,GAAM,CACrC,QAAS,EAAE,UAAU,CACrB,YAAa,EAAE,QAAQ,CACvB,QAAS,EAAE,SAAS,CACpB,MAAO,EAAE,OAAO,CAAE,IAAK,EAAE,QAAQ,CAAC,UAAU,CAAE,IAAK,EAAE,QAAQ,CAAC,UAAU,CAAE,CAAC,CAAC,UAAU,CACtF,SAAU,EAAE,UAAU,CACtB,MAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,CACzB,IAAK,EAAE,KAAK,CACb,CAAC,CACD,WAAW,EAAM,CAAE,OAAM,UAAW,CACnC,IAAM,EAAQ,EACd,MAAO,CACL,GAAG,EACH,YAAa,EAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CACxC,cAAe,EAAM,KAClB,MAAM,IAAI,CACV,MAAM,GAAI,GAAG,CACb,KAAK,IAAI,CACT,QAAQ,SAAU,GAAG,CACxB,UAAW,EAAM,KAAK,QAAQ,YAAa,GAAG,CAAC,QAAQ,SAAU,GAAG,CACpE,KAAM,EAAM,KACT,MAAM,QAAQ,CACd,KAAK,EACJ,QAAQ,SAAU,GAAG,CACtB,QAAQ,OAAQ,GAAG,CAClB,QAAQ,EAAM,KACX,MAAM,QAAQ,CACd,KAAK,EACJ,QAAQ,SAAU,GAAG,CACtB,QAAQ,OAAQ,GAAG,GACtB,OACJ,cAAe,EAAM,KAAK,MAAM,IAAI,CAAC,MAAM,GAAI,GAAG,CAAC,KAAK,IAAI,CAC5D,eAAgB,EAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CAC3C,eAAgB,EAChB,IAAK,EAAc,EAAK,IAAI,CAC7B,EACD,CACL,CACF,CACD,IAAK,CACH,cAAe,EAA0B,CAAE,gBAAe,sBAAqB,CAAC,CAChF,cAAe,EAA0B,CAAE,gBAAe,sBAAqB,CAAC,CACjF,CACF,CAAC,CAGJ,MAAa,EAAmB,GAAwB"}
|
package/dist/velite/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"../metadata-plugin-DA7OesoA.js";import{t as n}from"../rehype-mermaid-
|
|
1
|
+
import{n as e,t}from"../metadata-plugin-DA7OesoA.js";import{t as n}from"../rehype-mermaid-Be9A3aSw.js";import{t as r}from"../rehype-npm-command-0W5WqcQY.js";import{t as i}from"../rehype-pre-block-source-paX7yPQ4.js";import{t as a}from"../rehype-title-CB9V-h9I.js";import"./plugins/index.js";import{cleanTocItems as o}from"./utils.js";import{createDocsVeliteConfig as s,docsVeliteConfig as c}from"./config.js";export{o as cleanTocItems,s as createDocsVeliteConfig,c as docsVeliteConfig,n as rehypeMermaid,t as rehypeMetadataPlugin,r as rehypeNpmCommand,i as rehypePreBlockSource,a as rehypeTitle,e as rhypeMetadataPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"../../metadata-plugin-DA7OesoA.js";import{t as n}from"../../rehype-mermaid-
|
|
1
|
+
import{n as e,t}from"../../metadata-plugin-DA7OesoA.js";import{t as n}from"../../rehype-mermaid-Be9A3aSw.js";import{t as r}from"../../rehype-npm-command-0W5WqcQY.js";import{t as i}from"../../rehype-pre-block-source-paX7yPQ4.js";import{t as a}from"../../rehype-title-CB9V-h9I.js";export{n as rehypeMermaid,t as rehypeMetadataPlugin,r as rehypeNpmCommand,i as rehypePreBlockSource,a as rehypeTitle,e as rhypeMetadataPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../../rehype-mermaid-
|
|
1
|
+
import{t as e}from"../../rehype-mermaid-Be9A3aSw.js";export{e as rehypeMermaid};
|
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
"node": ">=22.0.0"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@shikijs/compat": "^1.12.1",
|
|
8
7
|
"@tanstack/react-virtual": "^3.13.19",
|
|
9
8
|
"@types/unist": "^3.0.3",
|
|
10
9
|
"aria-hidden": "^1.2.6",
|
|
@@ -14,21 +13,22 @@
|
|
|
14
13
|
"mdast-util-toc": "^7.1.0",
|
|
15
14
|
"react-remove-scroll": "^2.7.2",
|
|
16
15
|
"rehype-autolink-headings": "^7.1.0",
|
|
17
|
-
"rehype-pretty-code": "^0.
|
|
16
|
+
"rehype-pretty-code": "^0.14.3",
|
|
18
17
|
"rehype-slug": "^6.0.0",
|
|
19
18
|
"remark": "^15.0.1",
|
|
20
19
|
"remark-code-import": "^1.2.0",
|
|
21
20
|
"remark-gfm": "^4.0.0",
|
|
21
|
+
"shiki": "^2.5.0",
|
|
22
22
|
"tabbable": "6.2.0",
|
|
23
23
|
"tw-animate-css": "^1.2.4",
|
|
24
24
|
"unified": "^11.0.5",
|
|
25
25
|
"unist-builder": "4.0.0",
|
|
26
26
|
"unist-util-visit": "^5.0.0",
|
|
27
27
|
"velite": "^0.3.1",
|
|
28
|
-
"zod": "4.
|
|
28
|
+
"zod": "4.3.6"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@excalidraw/excalidraw": "^0.
|
|
31
|
+
"@excalidraw/excalidraw": "^0.18.0",
|
|
32
32
|
"@gentleduck/hooks": "workspace:*",
|
|
33
33
|
"@gentleduck/libs": "workspace:*",
|
|
34
34
|
"@gentleduck/registry-ui": "workspace:*",
|
|
@@ -37,33 +37,33 @@
|
|
|
37
37
|
"@types/hast": "^3.0.4",
|
|
38
38
|
"@types/lunr": "^2.3.7",
|
|
39
39
|
"@types/node": "^25.3.0",
|
|
40
|
-
"@types/react": "19.2.
|
|
40
|
+
"@types/react": "19.2.14",
|
|
41
41
|
"@types/react-dom": "19.2.3",
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"jotai": "^2.16.2",
|
|
44
|
-
"lucide-react": "0.
|
|
44
|
+
"lucide-react": "0.576.0",
|
|
45
45
|
"next": "^16.1.1",
|
|
46
46
|
"next-themes": "^0.4.6",
|
|
47
|
-
"react": "^19.2.
|
|
48
|
-
"react-dom": "^19.2.
|
|
49
|
-
"react-resizable-panels": "^
|
|
47
|
+
"react": "^19.2.4",
|
|
48
|
+
"react-dom": "^19.2.4",
|
|
49
|
+
"react-resizable-panels": "^4.7.0",
|
|
50
50
|
"rimraf": "^6.0.1",
|
|
51
51
|
"tailwind-merge": "^3.4.0",
|
|
52
52
|
"tsdown": "0.18.3",
|
|
53
53
|
"typescript": "5.9.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@excalidraw/excalidraw": "^0.
|
|
56
|
+
"@excalidraw/excalidraw": "^0.18.0",
|
|
57
57
|
"@gentleduck/hooks": "workspace:*",
|
|
58
58
|
"@gentleduck/libs": "workspace:*",
|
|
59
59
|
"@gentleduck/vim": "workspace:*",
|
|
60
60
|
"jotai": "^2.14.0",
|
|
61
|
-
"lucide-react": "0.
|
|
61
|
+
"lucide-react": "0.576.0",
|
|
62
62
|
"next": "^16.1.1",
|
|
63
63
|
"next-themes": "^0.4.6",
|
|
64
|
-
"react": "^19.2.
|
|
65
|
-
"react-dom": "^19.2.
|
|
66
|
-
"react-resizable-panels": "^
|
|
64
|
+
"react": "^19.2.4",
|
|
65
|
+
"react-dom": "^19.2.4",
|
|
66
|
+
"react-resizable-panels": "^4.7.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependenciesMeta": {
|
|
69
69
|
"@excalidraw/excalidraw": {
|
|
@@ -163,5 +163,5 @@
|
|
|
163
163
|
},
|
|
164
164
|
"type": "module",
|
|
165
165
|
"types": "./dist/index.d.ts",
|
|
166
|
-
"version": "0.0
|
|
166
|
+
"version": "0.1.0"
|
|
167
167
|
}
|
|
@@ -111,9 +111,11 @@ function useTocSvg(containerRef: React.RefObject<HTMLDivElement | null>, items:
|
|
|
111
111
|
let w = 0
|
|
112
112
|
let h = 0
|
|
113
113
|
const d: string[] = []
|
|
114
|
+
let previousOffset = 0
|
|
115
|
+
let previousBottom = 0
|
|
116
|
+
let hasStarted = false
|
|
114
117
|
|
|
115
|
-
for (
|
|
116
|
-
const item = items[i]!
|
|
118
|
+
for (const item of items) {
|
|
117
119
|
const el = container.querySelector<HTMLElement>(`a[href="${item.url}"]`)
|
|
118
120
|
if (!el) continue
|
|
119
121
|
|
|
@@ -125,11 +127,23 @@ function useTocSvg(containerRef: React.RefObject<HTMLDivElement | null>, items:
|
|
|
125
127
|
w = Math.max(offset, w)
|
|
126
128
|
h = Math.max(h, bottom)
|
|
127
129
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
if (!hasStarted) {
|
|
131
|
+
d.push(`M${offset} ${top}`)
|
|
132
|
+
d.push(`L${offset} ${bottom}`)
|
|
133
|
+
hasStarted = true
|
|
134
|
+
} else {
|
|
135
|
+
// Connect stacked items (including depth changes) with one continuous path.
|
|
136
|
+
if (top !== previousBottom || offset !== previousOffset) {
|
|
137
|
+
d.push(`L${offset} ${top}`)
|
|
138
|
+
}
|
|
139
|
+
d.push(`L${offset} ${bottom}`)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
previousOffset = offset
|
|
143
|
+
previousBottom = bottom
|
|
130
144
|
}
|
|
131
145
|
|
|
132
|
-
setSvg({ path: d.join(' '), width: w + 1, height: h })
|
|
146
|
+
setSvg(d.length > 0 ? { path: d.join(' '), width: w + 1, height: h } : null)
|
|
133
147
|
}
|
|
134
148
|
|
|
135
149
|
const observer = new ResizeObserver(compute)
|
|
@@ -179,14 +193,29 @@ function TocTree({ items, activeItem }: { items: FlatTocItem[]; activeItem: stri
|
|
|
179
193
|
|
|
180
194
|
return (
|
|
181
195
|
<div ref={containerRef} className="relative">
|
|
182
|
-
{/*
|
|
183
|
-
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
196
|
+
{/* Shared SVG track for smoother joins and anti-aliased rendering */}
|
|
197
|
+
{svg ? (
|
|
198
|
+
<svg
|
|
199
|
+
aria-hidden="true"
|
|
200
|
+
className="pointer-events-none absolute start-0 top-0"
|
|
201
|
+
height={svg.height}
|
|
202
|
+
style={{ width: svg.width }}
|
|
203
|
+
viewBox={`0 0 ${svg.width} ${svg.height}`}
|
|
204
|
+
width={svg.width}>
|
|
205
|
+
<path
|
|
206
|
+
d={svg.path}
|
|
207
|
+
fill="none"
|
|
208
|
+
stroke="currentColor"
|
|
209
|
+
strokeLinecap="round"
|
|
210
|
+
strokeLinejoin="round"
|
|
211
|
+
strokeWidth={1}
|
|
212
|
+
className="text-muted-foreground/20"
|
|
213
|
+
/>
|
|
214
|
+
</svg>
|
|
215
|
+
) : null}
|
|
189
216
|
|
|
217
|
+
{/* Link labels */}
|
|
218
|
+
{items.map((item, i) => {
|
|
190
219
|
return (
|
|
191
220
|
<a
|
|
192
221
|
key={i}
|
|
@@ -198,33 +227,6 @@ function TocTree({ items, activeItem }: { items: FlatTocItem[]; activeItem: stri
|
|
|
198
227
|
: 'text-muted-foreground text-sm hover:text-foreground',
|
|
199
228
|
)}
|
|
200
229
|
style={{ paddingInlineStart: `${itemPadding(item.depth)}px` }}>
|
|
201
|
-
{/* Diagonal connector when depth changes */}
|
|
202
|
-
{offset !== upperOffset ? (
|
|
203
|
-
<svg
|
|
204
|
-
aria-hidden="true"
|
|
205
|
-
className="absolute start-0 -top-1.5 size-3"
|
|
206
|
-
viewBox="0 0 16 16"
|
|
207
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
208
|
-
<line
|
|
209
|
-
className="stroke-muted-foreground/15"
|
|
210
|
-
strokeWidth={1}
|
|
211
|
-
x1={upperOffset + 1}
|
|
212
|
-
x2={offset + 1}
|
|
213
|
-
y1={0}
|
|
214
|
-
y2={16}
|
|
215
|
-
/>
|
|
216
|
-
</svg>
|
|
217
|
-
) : null}
|
|
218
|
-
|
|
219
|
-
{/* Vertical line segment */}
|
|
220
|
-
<div
|
|
221
|
-
className={cn(
|
|
222
|
-
'absolute inset-y-0 w-px bg-muted-foreground/15',
|
|
223
|
-
offset !== upperOffset && 'top-1.5',
|
|
224
|
-
offset !== lowerOffset && 'bottom-1.5',
|
|
225
|
-
)}
|
|
226
|
-
style={{ insetInlineStart: offset + 1 }}
|
|
227
|
-
/>
|
|
228
230
|
{item.title}
|
|
229
231
|
</a>
|
|
230
232
|
)
|
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
import { cn } from '@gentleduck/libs/cn'
|
|
2
2
|
import { Alert, AlertDescription, AlertTitle } from '@gentleduck/registry-ui/alert'
|
|
3
3
|
|
|
4
|
+
type CalloutTone = 'default' | 'info' | 'warning' | 'deprecated'
|
|
5
|
+
|
|
6
|
+
const CALLOUT_TONE_CLASSES: Record<CalloutTone, string> = {
|
|
7
|
+
default: '',
|
|
8
|
+
info: 'border-sky-300/80 bg-gradient-to-br from-cyan-50 to-sky-50 text-sky-950 dark:border-sky-900 dark:from-cyan-950/35 dark:to-sky-950/30 dark:text-sky-100 [&_svg]:text-sky-600 dark:[&_svg]:text-sky-300',
|
|
9
|
+
warning:
|
|
10
|
+
'border-yellow-300/80 bg-gradient-to-br from-yellow-50 to-amber-50 text-yellow-950 dark:border-yellow-900 dark:from-yellow-950/35 dark:to-amber-950/30 dark:text-yellow-100 [&_svg]:text-yellow-600 dark:[&_svg]:text-yellow-300',
|
|
11
|
+
deprecated:
|
|
12
|
+
'border-rose-300/85 bg-gradient-to-br from-rose-50 to-pink-50 text-rose-950 dark:border-rose-900 dark:from-rose-950/40 dark:to-pink-950/30 dark:text-rose-100 [&_svg]:text-rose-600 dark:[&_svg]:text-rose-300',
|
|
13
|
+
}
|
|
14
|
+
|
|
4
15
|
export function Callout({
|
|
5
16
|
title,
|
|
6
17
|
children,
|
|
7
18
|
icon,
|
|
19
|
+
tone,
|
|
8
20
|
className,
|
|
9
21
|
...props
|
|
10
22
|
}: React.ComponentPropsWithoutRef<typeof Alert> & {
|
|
11
23
|
icon?: React.ReactNode
|
|
24
|
+
tone?: CalloutTone
|
|
12
25
|
}) {
|
|
13
26
|
return (
|
|
14
|
-
<Alert
|
|
27
|
+
<Alert
|
|
28
|
+
className={cn(
|
|
29
|
+
'my-6',
|
|
30
|
+
icon && 'grid-cols-[calc(var(--spacing)*4)_1fr] gap-x-3',
|
|
31
|
+
CALLOUT_TONE_CLASSES[tone ?? 'default'],
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}>
|
|
15
35
|
{icon && (
|
|
16
36
|
<span className="row-span-2 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:translate-y-0.5 [&_svg]:text-current">
|
|
17
37
|
{icon}
|
|
@@ -6,7 +6,7 @@ import { cn } from '@gentleduck/libs/cn'
|
|
|
6
6
|
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@gentleduck/registry-ui/resizable'
|
|
7
7
|
import { Tabs, TabsContent } from '@gentleduck/registry-ui/tabs'
|
|
8
8
|
import React from 'react'
|
|
9
|
-
import type {
|
|
9
|
+
import type { PanelImperativeHandle } from 'react-resizable-panels'
|
|
10
10
|
|
|
11
11
|
type Block = {
|
|
12
12
|
name: string
|
|
@@ -19,7 +19,7 @@ type Block = {
|
|
|
19
19
|
export function CodePreview({ block }: { block: Block & { hasLiftMode: boolean } }) {
|
|
20
20
|
const { isLiftMode } = useLiftMode(block.name)
|
|
21
21
|
const [isLoading, setIsLoading] = React.useState(true)
|
|
22
|
-
const ref = React.useRef<
|
|
22
|
+
const ref = React.useRef<PanelImperativeHandle>(null)
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<Tabs
|
|
@@ -34,7 +34,7 @@ export function CodePreview({ block }: { block: Block & { hasLiftMode: boolean }
|
|
|
34
34
|
<TabsContent
|
|
35
35
|
className="relative after:absolute after:inset-0 after:right-3 after:z-0 after:rounded-lg after:bg-muted"
|
|
36
36
|
value="preview">
|
|
37
|
-
<ResizablePanelGroup className="relative z-10"
|
|
37
|
+
<ResizablePanelGroup className="relative z-10" orientation="horizontal">
|
|
38
38
|
<ResizablePanel
|
|
39
39
|
className={cn(
|
|
40
40
|
'relative rounded-lg border bg-background',
|
|
@@ -42,7 +42,7 @@ export function CodePreview({ block }: { block: Block & { hasLiftMode: boolean }
|
|
|
42
42
|
)}
|
|
43
43
|
defaultSize={100}
|
|
44
44
|
minSize={30}
|
|
45
|
-
|
|
45
|
+
panelRef={ref}>
|
|
46
46
|
{isLoading ? (
|
|
47
47
|
<div
|
|
48
48
|
className="absolute inset-0 z-10 flex h-[--container-height] w-full items-center justify-center gap-2 bg-background text-muted-foreground text-sm"
|
package/src/velite/config.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { UnistNode } from '@duck-docs/types'
|
|
2
|
-
import { getHighlighter } from '@shikijs/compat'
|
|
3
2
|
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
|
|
4
3
|
// @ts-ignore
|
|
5
4
|
import rehypePrettyCode from 'rehype-pretty-code'
|
|
6
5
|
import rehypeSlug from 'rehype-slug'
|
|
7
6
|
import { codeImport } from 'remark-code-import'
|
|
8
7
|
import remarkGfm from 'remark-gfm'
|
|
8
|
+
import { createHighlighter as getHighlighter } from 'shiki'
|
|
9
9
|
import type { Pluggable } from 'unified'
|
|
10
10
|
import { defineConfig, s, type ZodMeta } from 'velite'
|
|
11
11
|
import { rehypeMermaid, rehypeMetadataPlugin, rehypeNpmCommand, rehypePreBlockSource, rehypeTitle } from './plugins'
|
|
@@ -35,6 +35,10 @@ function buildDefaultRehypePlugins({
|
|
|
35
35
|
{
|
|
36
36
|
getHighlighter,
|
|
37
37
|
onVisitHighlightedLine(node: UnistNode) {
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
if (!node.properties) node.properties = {}
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
if (!node.properties.className) node.properties.className = []
|
|
38
42
|
// @ts-ignore
|
|
39
43
|
node.properties.className.push('line--highlighted')
|
|
40
44
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execSync } from 'node:child_process'
|
|
2
2
|
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
3
4
|
import { tmpdir } from 'node:os'
|
|
4
5
|
import { join } from 'node:path'
|
|
5
6
|
import type { UnistNode, UnistTree } from '@duck-docs/types'
|
|
@@ -78,10 +79,24 @@ function findChromium(): string {
|
|
|
78
79
|
|
|
79
80
|
let chromiumPath: string | null = null
|
|
80
81
|
|
|
82
|
+
function resolveMermaidPath(): string {
|
|
83
|
+
try {
|
|
84
|
+
const req = createRequire(import.meta.url)
|
|
85
|
+
const pkgPath = req.resolve('mermaid/package.json')
|
|
86
|
+
return join(pkgPath, '..', 'dist', 'mermaid.esm.min.mjs')
|
|
87
|
+
} catch {
|
|
88
|
+
return ''
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
function buildRenderHtml(diagrams: { source: string; id: string; theme: 'default' | 'dark' }[]): string {
|
|
93
|
+
const localMermaid = resolveMermaidPath()
|
|
94
|
+
const mermaidSrc = localMermaid
|
|
95
|
+
? `file://${localMermaid}`
|
|
96
|
+
: 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs'
|
|
82
97
|
return `<!DOCTYPE html><html><head>
|
|
83
98
|
<script type="module">
|
|
84
|
-
import mermaid from '
|
|
99
|
+
import mermaid from '${mermaidSrc}';
|
|
85
100
|
const diagrams = ${JSON.stringify(diagrams)};
|
|
86
101
|
const results = {};
|
|
87
102
|
for (const d of diagrams) {
|
|
@@ -108,7 +123,7 @@ async function renderSvgBatch(
|
|
|
108
123
|
writeFileSync(htmlFile, buildRenderHtml(diagrams))
|
|
109
124
|
|
|
110
125
|
const output = execSync(
|
|
111
|
-
`"${chromiumPath}" --headless --disable-gpu --no-sandbox --virtual-time-budget=15000 --dump-dom "file://${htmlFile}"`,
|
|
126
|
+
`"${chromiumPath}" --headless --disable-gpu --no-sandbox --allow-file-access-from-files --virtual-time-budget=15000 --dump-dom "file://${htmlFile}"`,
|
|
112
127
|
{ timeout: 60000, encoding: 'utf-8', maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'] },
|
|
113
128
|
)
|
|
114
129
|
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./slot-B-X2-pKU-DOhFF3E_.js";import{f as t,l as n,p as r,s as i}from"./portal-BNuCvTAR-DDrsnIMA.js";import*as a from"react";import{useLayoutEffect as o}from"react";import{jsx as s}from"react/jsx-runtime";import*as c from"react-dom";const l=a.forwardRef((e,t)=>{let{children:n,width:i=10,height:a=5,...o}=e;return s(r.svg,{"data-slot":`arrow`,...o,ref:t,width:i,height:a,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:s(`polygon`,{points:`0,0 30,0 15,10`})})});l.displayName=`Arrow`;const u=`Popper`,[d,f]=n(u),[p,m]=d(u);function h(e){let{__scopePopper:t,children:n}=e,[r,i]=a.useState(null);return s(p,{scope:t,anchor:r,onAnchorChange:i,children:n})}h.displayName=u;const g=`PopperAnchor`,_=({ref:t,...n})=>{let{__scopePopper:i,virtualRef:o,...c}=n,l=m(g,i),u=a.useRef(null),d=e(t,u);return a.useEffect(()=>{l.onAnchorChange(o?.current??u.current)}),o?null:s(r.div,{"data-slot":`popper-anchor`,...c,ref:d})};_.displayName=g;function v(e){let[n,r]=a.useState(void 0);return t(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n=t[0],i,a;if(`borderBoxSize`in n){let e=Array.isArray(n.borderBoxSize)?n.borderBoxSize[0]:n.borderBoxSize;i=e.inlineSize,a=e.blockSize}else i=e.offsetWidth,a=e.offsetHeight;r({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else r(void 0)},[e]),n}const y=[`top`,`right`,`bottom`,`left`],b=Math.min,x=Math.max,S=Math.round,C=Math.floor,w=e=>({x:e,y:e}),T={left:`right`,right:`left`,bottom:`top`,top:`bottom`},E={start:`end`,end:`start`};function D(e,t,n){return x(e,b(t,n))}function O(e,t){return typeof e==`function`?e(t):e}function k(e){return e.split(`-`)[0]}function A(e){return e.split(`-`)[1]}function j(e){return e===`x`?`y`:`x`}function M(e){return e===`y`?`height`:`width`}const N=new Set([`top`,`bottom`]);function P(e){return N.has(k(e))?`y`:`x`}function F(e){return j(P(e))}function I(e,t,n){n===void 0&&(n=!1);let r=A(e),i=F(e),a=M(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=H(o)),[o,H(o)]}function L(e){let t=H(e);return[R(e),t,R(t)]}function R(e){return e.replace(/start|end/g,e=>E[e])}const z=[`left`,`right`],ee=[`right`,`left`],B=[`top`,`bottom`],V=[`bottom`,`top`];function te(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ee:z:t?z:ee;case`left`:case`right`:return t?B:V;default:return[]}}function ne(e,t,n,r){let i=A(e),a=te(k(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(R)))),a}function H(e){return e.replace(/left|right|bottom|top/g,e=>T[e])}function re(e){return{top:0,right:0,bottom:0,left:0,...e}}function ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:re(e)}function U(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ae(e,t,n){let{reference:r,floating:i}=e,a=P(t),o=F(t),s=M(o),c=k(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(A(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function oe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=O(t,e),p=ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=U(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=U(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}const se=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ae(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??oe},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=ae(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},ce=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=O(e,t)||{};if(l==null)return{};let d=ie(u),f={x:n,y:r},p=F(i),m=M(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[y]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[y]||a.floating[m]);let T=x/2-S/2,E=w/2-h[m]/2-1,k=b(d[_],E),j=b(d[v],E),N=k,P=w-h[m]-j,I=w/2-h[m]/2+T,L=D(N,I,P),R=!c.arrow&&A(i)!=null&&I!==L&&a.reference[m]/2-(I<N?k:j)-h[m]/2<0,z=R?I<N?I-N:I-P:0;return{[p]:f[p]+z,data:{[p]:L,centerOffset:I-L-z,...R&&{alignmentOffset:z}},reset:R}}}),le=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=O(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=k(r),_=P(o),v=k(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[H(o)]:L(o)),x=p!==`none`;!d&&x&&b.push(...ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=I(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==P(t))||T.every(e=>P(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=P(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ue(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function de(e){return y.some(t=>e[t]>=0)}const fe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=O(e,t);switch(i){case`referenceHidden`:{let e=ue(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:de(e)}}}case`escaped`:{let e=ue(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:de(e)}}}default:return{}}}}},pe=new Set([`left`,`top`]);async function me(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=k(n),s=A(n),c=P(n)===`y`,l=pe.has(o)?-1:1,u=a&&c?-1:1,d=O(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}const he=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await me(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ge=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=O(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=P(k(i)),p=j(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=D(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=D(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},_e=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=O(e,t),u={x:n,y:r},d=P(i),f=j(d),p=u[f],m=u[d],h=O(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=pe.has(k(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ve=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=O(e,t),u=await o.detectOverflow(t,l),d=k(i),f=A(i),p=P(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,S=b(h-u[g],v),C=b(m-u[_],y),w=!t.middlewareData.shift,T=S,E=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=v),w&&!f){let e=x(u.left,0),t=x(u.right,0),n=x(u.top,0),r=x(u.bottom,0);p?E=m-2*(e!==0||t!==0?e+t:x(u.left,u.right)):T=h-2*(n!==0||r!==0?n+r:x(u.top,u.bottom))}await c({...t,availableWidth:E,availableHeight:T});let D=await o.getDimensions(s.floating);return m!==D.width||h!==D.height?{reset:{rects:!0}}:{}}}};function ye(){return typeof window<`u`}function W(e){return be(e)?(e.nodeName||``).toLowerCase():`#document`}function G(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function K(e){return((be(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function be(e){return ye()?e instanceof Node||e instanceof G(e).Node:!1}function q(e){return ye()?e instanceof Element||e instanceof G(e).Element:!1}function J(e){return ye()?e instanceof HTMLElement||e instanceof G(e).HTMLElement:!1}function xe(e){return!ye()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof G(e).ShadowRoot}const Se=new Set([`inline`,`contents`]);function Ce(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Se.has(i)}const we=new Set([`table`,`td`,`th`]);function Te(e){return we.has(W(e))}const Ee=[`:popover-open`,`:modal`];function De(e){return Ee.some(t=>{try{return e.matches(t)}catch{return!1}})}const Oe=[`transform`,`translate`,`scale`,`rotate`,`perspective`],ke=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],Ae=[`paint`,`layout`,`strict`,`content`];function je(e){let t=Ne(),n=q(e)?X(e):e;return Oe.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||ke.some(e=>(n.willChange||``).includes(e))||Ae.some(e=>(n.contain||``).includes(e))}function Me(e){let t=Z(e);for(;J(t)&&!Y(t);){if(je(t))return t;if(De(t))return null;t=Z(t)}return null}function Ne(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}const Pe=new Set([`html`,`body`,`#document`]);function Y(e){return Pe.has(W(e))}function X(e){return G(e).getComputedStyle(e)}function Fe(e){return q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(W(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||xe(e)&&e.host||K(e);return xe(t)?t.host:t}function Ie(e){let t=Z(e);return Y(t)?e.ownerDocument?e.ownerDocument.body:e.body:J(t)&&Ce(t)?t:Ie(t)}function Le(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ie(e),i=r===e.ownerDocument?.body,a=G(r);if(i){let e=Re(a);return t.concat(a,a.visualViewport||[],Ce(r)?r:[],e&&n?Le(e):[])}return t.concat(r,Le(r,[],n))}function Re(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ze(e){let t=X(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=J(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=S(n)!==a||S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Be(e){return q(e)?e:e.contextElement}function Q(e){let t=Be(e);if(!J(t))return w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ze(t),o=(a?S(n.width):n.width)/r,s=(a?S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const Ve=w(0);function He(e){let t=G(e);return!Ne()||!t.visualViewport?Ve:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ue(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==G(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Be(e),o=w(1);t&&(r?q(r)&&(o=Q(r)):o=Q(e));let s=Ue(a,n,r)?He(a):w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=G(a),t=r&&q(r)?G(r):r,n=e,i=Re(n);for(;i&&r&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=X(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=G(i),i=Re(n)}}return U({width:u,height:d,x:c,y:l})}function We(e,t){let n=Fe(e).scrollLeft;return t?t.left+n:$(K(e)).left+n}function Ge(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-We(e,n),y:n.top+t.scrollTop}}function Ke(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=K(r),s=t?De(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=w(1),u=w(0),d=J(r);if((d||!d&&!a)&&((W(r)!==`body`||Ce(o))&&(c=Fe(r)),J(r))){let e=$(r);l=Q(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ge(o,c):w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function qe(e){return Array.from(e.getClientRects())}function Je(e){let t=K(e),n=Fe(e),r=e.ownerDocument.body,i=x(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=x(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+We(e),s=-n.scrollTop;return X(r).direction===`rtl`&&(o+=x(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Ye(e,t){let n=G(e),r=K(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ne();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=We(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}const Xe=new Set([`absolute`,`fixed`]);function Ze(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=J(e)?Q(e):w(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Qe(e,t,n){let r;if(t===`viewport`)r=Ye(e,n);else if(t===`document`)r=Je(K(e));else if(q(t))r=Ze(t,n);else{let n=He(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return U(r)}function $e(e,t){let n=Z(e);return n===t||!q(n)||Y(n)?!1:X(n).position===`fixed`||$e(n,t)}function et(e,t){let n=t.get(e);if(n)return n;let r=Le(e,[],!1).filter(e=>q(e)&&W(e)!==`body`),i=null,a=X(e).position===`fixed`,o=a?Z(e):e;for(;q(o)&&!Y(o);){let t=X(o),n=je(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Xe.has(i.position)||Ce(o)&&!n&&$e(e,o))?r=r.filter(e=>e!==o):i=t,o=Z(o)}return t.set(e,r),r}function tt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?De(t)?[]:et(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Qe(t,n,i);return e.top=x(r.top,e.top),e.right=b(r.right,e.right),e.bottom=b(r.bottom,e.bottom),e.left=x(r.left,e.left),e},Qe(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function nt(e){let{width:t,height:n}=ze(e);return{width:t,height:n}}function rt(e,t,n){let r=J(t),i=K(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=w(0);function l(){c.x=We(i)}if(r||!r&&!a)if((W(t)!==`body`||Ce(i))&&(s=Fe(t)),r){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ge(i,s):w(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function it(e){return X(e).position===`static`}function at(e,t){if(!J(e)||X(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function ot(e,t){let n=G(e);if(De(e))return n;if(!J(e)){let t=Z(e);for(;t&&!Y(t);){if(q(t)&&!it(t))return t;t=Z(t)}return n}let r=at(e,t);for(;r&&Te(r)&&it(r);)r=at(r,t);return r&&Y(r)&&it(r)&&!je(r)?n:r||Me(e)||n}const st=async function(e){let t=this.getOffsetParent||ot,n=this.getDimensions,r=await n(e.floating);return{reference:rt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ct(e){return X(e).direction===`rtl`}const lt={convertOffsetParentRelativeRectToViewportRelativeRect:Ke,getDocumentElement:K,getClippingRect:tt,getOffsetParent:ot,getElementRects:st,getClientRects:qe,getDimensions:nt,getScale:Q,isElement:q,isRTL:ct};function ut(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dt(e,t){let n=null,r,i=K(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=C(d),h=C(i.clientWidth-(u+f)),g=C(i.clientHeight-(d+p)),_=C(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:x(0,b(1,c))||1},y=!0;function S(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ut(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(S,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,v)}n.observe(e)}return o(!0),a}function ft(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Be(e),u=i||a?[...l?Le(l):[],...Le(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?dt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!ut(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}const pt=he,mt=ge,ht=le,gt=ve,_t=fe,vt=ce,yt=_e,bt=(e,t,n)=>{let r=new Map,i={platform:lt,...n},a={...i.platform,_c:r};return se(e,t,{...i,platform:a})};var xt=typeof document<`u`?o:function(){};function St(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!St(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!St(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Ct(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wt(e,t){let n=Ct(e);return Math.round(t*n)/n}function Tt(e){let t=a.useRef(e);return xt(()=>{t.current=e}),t}function Et(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[f,p]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(r);St(m,r)||h(r);let[g,_]=a.useState(null),[v,y]=a.useState(null),b=a.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=o||g,C=s||v,w=a.useRef(null),T=a.useRef(null),E=a.useRef(f),D=u!=null,O=Tt(u),k=Tt(i),A=Tt(d),j=a.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};k.current&&(e.platform=k.current),bt(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!St(E.current,t)&&(E.current=t,c.flushSync(()=>{p(t)}))})},[m,t,n,k,A]);xt(()=>{d===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[d]);let M=a.useRef(!1);xt(()=>(M.current=!0,()=>{M.current=!1}),[]),xt(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=a.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=a.useMemo(()=>({reference:S,floating:C}),[S,C]),F=a.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=wt(P.floating,f.x),r=wt(P.floating,f.y);return l?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ct(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,l,P.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:j,refs:N,elements:P,floatingStyles:F}),[f,j,N,P,F])}const Dt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:vt({element:r.current,padding:i}).fn(n):r?vt({element:r,padding:i}).fn(n):{}}}},Ot=(e,t)=>({...pt(e),options:[e,t]}),kt=(e,t)=>({...mt(e),options:[e,t]}),At=(e,t)=>({...yt(e),options:[e,t]}),jt=(e,t)=>({...ht(e),options:[e,t]}),Mt=(e,t)=>({...gt(e),options:[e,t]}),Nt=(e,t)=>({..._t(e),options:[e,t]}),Pt=(e,t)=>({...Dt(e),options:[e,t]}),Ft=`PopperContent`,[It,Lt]=d(Ft),Rt=({ref:n,...o})=>{let{__scopePopper:c,side:l=`bottom`,sideOffset:u=0,align:d=`center`,alignOffset:f=0,arrowPadding:p=0,avoidCollisions:h=!0,collisionBoundary:g=[],collisionPadding:_=0,sticky:y=`partial`,hideWhenDetached:b=!1,updatePositionStrategy:x=`optimized`,onPlaced:S,...C}=o,w=m(Ft,c),[T,E]=a.useState(null),D=e(n,e=>E(e)),[O,k]=a.useState(null),A=v(O),j=A?.width??0,M=A?.height??0,N=l+(d===`center`?``:`-${d}`),P=typeof _==`number`?_:{top:0,right:0,bottom:0,left:0,..._},F=Array.isArray(g)?g:[g],I=F.length>0,L={padding:P,boundary:F.filter(zt),altBoundary:I},{refs:R,floatingStyles:z,placement:ee,isPositioned:B,middlewareData:V}=Et({strategy:`fixed`,placement:N,whileElementsMounted:(...e)=>ft(...e,{animationFrame:x===`always`}),elements:{reference:w.anchor},middleware:[Ot({mainAxis:u+M,alignmentAxis:f}),h&&kt({mainAxis:!0,crossAxis:!1,limiter:y===`partial`?At():void 0,...L}),h&&jt({...L}),Mt({...L,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--gentleduck-popper-available-width`,`${n}px`),o.setProperty(`--gentleduck-popper-available-height`,`${r}px`),o.setProperty(`--gentleduck-popper-anchor-width`,`${i}px`),o.setProperty(`--gentleduck-popper-anchor-height`,`${a}px`)}}),O&&Pt({element:O,padding:p}),Bt({arrowWidth:j,arrowHeight:M}),b&&Nt({strategy:`referenceHidden`,...L})]}),[te,ne]=Vt(ee),H=i(S);t(()=>{B&&H?.()},[B,H]);let re=V.arrow?.x,ie=V.arrow?.y,U=V.arrow?.centerOffset!==0,[ae,oe]=a.useState();return t(()=>{T&&oe(window.getComputedStyle(T).zIndex)},[T]),s(r.div,{ref:R.setFloating,"data-slot":`popper-content-wrapper`,style:{...z,transform:B?z.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--gentleduck-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(` `),...V.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:o.dir,children:s(It,{scope:c,placedSide:te,onArrowChange:k,arrowX:re,arrowY:ie,shouldHideArrow:U,children:s(r.div,{"data-slot":`popper-content`,"data-side":te,"data-align":ne,...C,ref:D,style:{...C.style,animation:B?void 0:`none`}})})})};Rt.displayName=Ft;function zt(e){return e!==null}const Bt=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Vt(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Vt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}const Ht=`PopperArrow`,Ut={top:`bottom`,right:`left`,bottom:`top`,left:`right`};function Wt({ref:e,...t}){let{__scopePopper:n,...r}=t,i=Lt(Ht,n),a=Ut[i.placedSide];return s(`span`,{"data-slot":`popper-arrow`,ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:s(l,{...r,ref:e,style:{...r.style,display:`block`}})})}Wt.displayName=Ht;export{h as a,f as i,Rt as n,_ as r,Wt as t};
|
|
2
|
-
//# sourceMappingURL=arrow-CU5T6t_D-Cs2Ykttv.js.map
|