@mintlify/msft-sdk 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/README.md +23 -0
- package/dist/components/content-components/all-components.js +27 -0
- package/dist/components/content-components/all-components.js.map +1 -0
- package/dist/components/content-components/callouts.js +50 -0
- package/dist/components/content-components/callouts.js.map +1 -0
- package/dist/components/content-components/callouts.module.css.js +26 -0
- package/dist/components/content-components/callouts.module.css.js.map +1 -0
- package/dist/components/content-components/code-block.js +86 -0
- package/dist/components/content-components/code-block.js.map +1 -0
- package/dist/components/content-components/code-block.module.css.js +28 -0
- package/dist/components/content-components/code-block.module.css.js.map +1 -0
- package/dist/components/content-components/default-components.js +36 -0
- package/dist/components/content-components/default-components.js.map +1 -0
- package/dist/components/content-components/default-components.module.css.js +12 -0
- package/dist/components/content-components/default-components.module.css.js.map +1 -0
- package/dist/components/content-components/details/details.js +42 -0
- package/dist/components/content-components/details/details.js.map +1 -0
- package/dist/components/content-components/details/details.module.css.js +20 -0
- package/dist/components/content-components/details/details.module.css.js.map +1 -0
- package/dist/components/content-components/heading.js +9 -0
- package/dist/components/content-components/heading.js.map +1 -0
- package/dist/components/content-components/link.js +23 -0
- package/dist/components/content-components/link.js.map +1 -0
- package/dist/components/content-components/link.module.css.js +10 -0
- package/dist/components/content-components/link.module.css.js.map +1 -0
- package/dist/components/content-components/param-name.js +9 -0
- package/dist/components/content-components/param-name.js.map +1 -0
- package/dist/components/content-components/param-name.module.css.js +8 -0
- package/dist/components/content-components/param-name.module.css.js.map +1 -0
- package/dist/components/content-components/table/index.js +122 -0
- package/dist/components/content-components/table/index.js.map +1 -0
- package/dist/components/content-components/table/table-modal.js +64 -0
- package/dist/components/content-components/table/table-modal.js.map +1 -0
- package/dist/components/content-components/table/table-modal.module.css.js +18 -0
- package/dist/components/content-components/table/table-modal.module.css.js.map +1 -0
- package/dist/components/content-components/table/table.module.css.js +30 -0
- package/dist/components/content-components/table/table.module.css.js.map +1 -0
- package/dist/components/content-components/tabs/tab.js +8 -0
- package/dist/components/content-components/tabs/tab.js.map +1 -0
- package/dist/components/content-components/tabs/tabs.js +87 -0
- package/dist/components/content-components/tabs/tabs.js.map +1 -0
- package/dist/components/content-components/tabs/tabs.module.css.js +24 -0
- package/dist/components/content-components/tabs/tabs.module.css.js.map +1 -0
- package/dist/components/content-components/zone-pivots/zone-pivot-context.js +52 -0
- package/dist/components/content-components/zone-pivots/zone-pivot-context.js.map +1 -0
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.js +74 -0
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.js.map +1 -0
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.module.css.js +14 -0
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.module.css.js.map +1 -0
- package/dist/components/content-components/zone-pivots/zone-pivot.js +25 -0
- package/dist/components/content-components/zone-pivots/zone-pivot.js.map +1 -0
- package/dist/components/content-components/zone-pivots/zone-target.js +8 -0
- package/dist/components/content-components/zone-pivots/zone-target.js.map +1 -0
- package/dist/components/mdx-renderer.js +13 -0
- package/dist/components/mdx-renderer.js.map +1 -0
- package/dist/components/mdx-renderer.module.css.js +8 -0
- package/dist/components/mdx-renderer.module.css.js.map +1 -0
- package/dist/components/nav-tree/dropdown-menu.js +68 -0
- package/dist/components/nav-tree/dropdown-menu.js.map +1 -0
- package/dist/components/nav-tree/dropdown-menu.module.css.js +52 -0
- package/dist/components/nav-tree/dropdown-menu.module.css.js.map +1 -0
- package/dist/components/nav-tree/index.js +126 -0
- package/dist/components/nav-tree/index.js.map +1 -0
- package/dist/components/nav-tree/mobile-nav.js +60 -0
- package/dist/components/nav-tree/mobile-nav.js.map +1 -0
- package/dist/components/nav-tree/mobile-nav.module.css.js +22 -0
- package/dist/components/nav-tree/mobile-nav.module.css.js.map +1 -0
- package/dist/components/nav-tree/nav-tree.module.css.js +34 -0
- package/dist/components/nav-tree/nav-tree.module.css.js.map +1 -0
- package/dist/components/page-context-menu.js +123 -0
- package/dist/components/page-context-menu.js.map +1 -0
- package/dist/components/page-context-menu.module.css.js +42 -0
- package/dist/components/page-context-menu.module.css.js.map +1 -0
- package/dist/components/page.js +85 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/page.module.css.js +48 -0
- package/dist/components/page.module.css.js.map +1 -0
- package/dist/components/prose.module.css.js +8 -0
- package/dist/components/prose.module.css.js.map +1 -0
- package/dist/components/toc/index.js +65 -0
- package/dist/components/toc/index.js.map +1 -0
- package/dist/components/toc/pivot-aware-toc.js +23 -0
- package/dist/components/toc/pivot-aware-toc.js.map +1 -0
- package/dist/components/toc/toc.module.css.js +18 -0
- package/dist/components/toc/toc.module.css.js.map +1 -0
- package/dist/hooks/useMarkdownCopy.js +50 -0
- package/dist/hooks/useMarkdownCopy.js.map +1 -0
- package/dist/index.d.ts +313 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/convert-html-to-mdx.js +28 -0
- package/dist/parser/convert-html-to-mdx.js.map +1 -0
- package/dist/parser/serialize-mdx.js +36 -0
- package/dist/parser/serialize-mdx.js.map +1 -0
- package/dist/plugins/rehype/rehype-code-blocks.js +44 -0
- package/dist/plugins/rehype/rehype-code-blocks.js.map +1 -0
- package/dist/plugins/remark/remark-heading-ids.js +23 -0
- package/dist/plugins/remark/remark-heading-ids.js.map +1 -0
- package/dist/plugins/sanitize/rehype-callouts.js +32 -0
- package/dist/plugins/sanitize/rehype-callouts.js.map +1 -0
- package/dist/plugins/sanitize/rehype-details.js +18 -0
- package/dist/plugins/sanitize/rehype-details.js.map +1 -0
- package/dist/plugins/sanitize/rehype-heading-ids.js +22 -0
- package/dist/plugins/sanitize/rehype-heading-ids.js.map +1 -0
- package/dist/plugins/sanitize/rehype-param-name.js +11 -0
- package/dist/plugins/sanitize/rehype-param-name.js.map +1 -0
- package/dist/plugins/sanitize/rehype-pre-to-mdx-fence.js +29 -0
- package/dist/plugins/sanitize/rehype-pre-to-mdx-fence.js.map +1 -0
- package/dist/plugins/sanitize/rehype-remark.js +50 -0
- package/dist/plugins/sanitize/rehype-remark.js.map +1 -0
- package/dist/plugins/sanitize/rehype-table-align.js +52 -0
- package/dist/plugins/sanitize/rehype-table-align.js.map +1 -0
- package/dist/plugins/sanitize/rehype-tabs.js +51 -0
- package/dist/plugins/sanitize/rehype-tabs.js.map +1 -0
- package/dist/plugins/sanitize/rehype-zone-pivots.js +106 -0
- package/dist/plugins/sanitize/rehype-zone-pivots.js.map +1 -0
- package/dist/plugins/sanitize/remove-html-comments.js +17 -0
- package/dist/plugins/sanitize/remove-html-comments.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/utils/get-node-text.js +5 -0
- package/dist/utils/get-node-text.js.map +1 -0
- package/dist/utils/rehype.js +17 -0
- package/dist/utils/rehype.js.map +1 -0
- package/dist/utils/string.js +5 -0
- package/dist/utils/string.js.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sources":["../../../src/components/nav-tree/dropdown-menu.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { CheckmarkFilled, DocumentRegular } from \"@fluentui/react-icons\";\nimport styles from \"./dropdown-menu.module.css\";\n\nexport interface DropdownConfig {\n title: string;\n description: string;\n icon?: React.ComponentType<{ className?: string }>;\n color?: {\n light?: string;\n dark?: string;\n };\n items?: DropdownItem[];\n}\n\nexport interface DropdownItem {\n title: string;\n href?: string;\n description?: string;\n icon?: React.ComponentType<{ className?: string }>;\n}\n\ninterface DropdownMenuProps {\n dropdown: DropdownConfig;\n isActive?: boolean;\n activeHref?: string;\n className?: string;\n}\n\nexport function DropdownMenu({\n dropdown,\n isActive = false,\n activeHref,\n className = \"\",\n}: DropdownMenuProps) {\n const [isExpanded, setIsExpanded] = useState(false);\n const Icon = dropdown.icon || DocumentRegular;\n\n return (\n <div className={`${styles.container} ${className}`}>\n <button\n onClick={() => setIsExpanded(!isExpanded)}\n aria-expanded={isExpanded}\n aria-label={`${isExpanded ? \"Collapse\" : \"Expand\"} ${\n dropdown.title\n } dropdown`}\n className={`${styles.button} ${isActive ? styles.buttonActive : \"\"}`}\n >\n <div className={styles.buttonContent}>\n <div className={styles.iconContainer}>\n <div className={styles.iconWrapper}>\n <Icon className={styles.icon} />\n </div>\n </div>\n\n <div className={styles.textContainer}>\n <div className={styles.title}>{dropdown.title}</div>\n <div className={styles.description}>{dropdown.description}</div>\n </div>\n\n <div className={styles.chevronContainer}>\n <svg\n className={`${styles.chevron} ${\n isExpanded ? styles.chevronExpanded : styles.chevronCollapsed\n }`}\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n </div>\n </button>\n\n {isExpanded && dropdown.items && dropdown.items.length > 0 && (\n <div className={styles.dropdownContainer}>\n <div className={styles.dropdown}>\n <div className={styles.dropdownList}>\n {dropdown.items.map((item, index) => (\n <a\n key={`${item.href}-${index}`}\n href={item.href}\n className={styles.dropdownItem}\n >\n <div className={styles.dropdownItemContent}>\n {item.icon && (\n <div className={styles.dropdownItemIconWrapper}>\n <item.icon className={styles.dropdownItemIcon} />\n </div>\n )}\n <span className={styles.dropdownItemTitle}>\n {item.title}\n </span>\n </div>\n {item.href && activeHref === item.href && (\n <CheckmarkFilled className={styles.checkmark} />\n )}\n </a>\n ))}\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"names":["DropdownMenu","dropdown","isActive","activeHref","className","isExpanded","setIsExpanded","useState","Icon","DocumentRegular","jsxs","styles","jsx","item","index","CheckmarkFilled"],"mappings":";;;;AA6BO,SAASA,EAAa;AAAA,EAC3B,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAsB;AACpB,QAAM,CAACC,GAAYC,CAAa,IAA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A,EACF,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,IAGDP,KAAcJ,EAAS,SAASA,EAAS,MAAM,SAAS,KACvD,gBAAAW,EAAC,OAAA,EAAI,WAAWD,EAAO,mBACrB,UAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWD,EAAO,UACrB,UAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWD,EAAO,cACpB,UAAAV,EAAS,MAAM,IAAI,CAACY,GAAMC,MACzB,gBAAAJ;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC,MAAMG,EAAK;AAAA,QACX,WAAWF,EAAO;AAAA,QAElB,UAAA;AAAA,UAAA,gBAAAD,EAAC,OAAA,EAAI,WAAWC,EAAO,qBACpB,UAAA;AAAA,YAAAE,EAAK,QACJ,gBAAAD,EAAC,OAAA,EAAI,WAAWD,EAAO,yBACrB,UAAA,gBAAAC,EAACC,EAAK,MAAL,EAAU,WAAWF,EAAO,kBAAkB,GACjD;AAAA,8BAED,QAAA,EAAK,WAAWA,EAAO,mBACrB,YAAK,MAAA,CACR;AAAA,UAAA,GACF;AAAA,UACCE,EAAK,QAAQV,MAAeU,EAAK,QAChC,gBAAAD,EAACG,GAAA,EAAgB,WAAWJ,EAAO,UAAA,CAAW;AAAA,QAAA;AAAA,MAAA;AAAA,MAf3C,GAAGE,EAAK,IAAI,IAAIC,CAAK;AAAA,IAAA,CAkB7B,EAAA,CACH,EAAA,CACF,EAAA,CACF;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const o = "_container_1hsqx_1", n = "_button_1hsqx_11", t = "_buttonActive_1hsqx_40", e = "_buttonContent_1hsqx_45", r = "_iconContainer_1hsqx_51", _ = "_iconWrapper_1hsqx_55", c = "_icon_1hsqx_51", d = "_textContainer_1hsqx_81", s = "_title_1hsqx_87", p = "_description_1hsqx_97", i = "_chevronContainer_1hsqx_110", h = "_chevron_1hsqx_110", a = "_chevronExpanded_1hsqx_125", x = "_chevronCollapsed_1hsqx_129", w = "_dropdownContainer_1hsqx_133", q = "_dropdown_1hsqx_133", C = "_dropdownList_1hsqx_158", I = "_dropdownItem_1hsqx_164", m = "_dropdownItemContent_1hsqx_195", v = "_dropdownItemIconWrapper_1hsqx_201", l = "_dropdownItemIcon_1hsqx_201", u = "_dropdownItemTitle_1hsqx_227", b = "_checkmark_1hsqx_231", k = {
|
|
2
|
+
container: o,
|
|
3
|
+
button: n,
|
|
4
|
+
buttonActive: t,
|
|
5
|
+
buttonContent: e,
|
|
6
|
+
iconContainer: r,
|
|
7
|
+
iconWrapper: _,
|
|
8
|
+
icon: c,
|
|
9
|
+
textContainer: d,
|
|
10
|
+
title: s,
|
|
11
|
+
description: p,
|
|
12
|
+
chevronContainer: i,
|
|
13
|
+
chevron: h,
|
|
14
|
+
chevronExpanded: a,
|
|
15
|
+
chevronCollapsed: x,
|
|
16
|
+
dropdownContainer: w,
|
|
17
|
+
dropdown: q,
|
|
18
|
+
dropdownList: C,
|
|
19
|
+
dropdownItem: I,
|
|
20
|
+
dropdownItemContent: m,
|
|
21
|
+
dropdownItemIconWrapper: v,
|
|
22
|
+
dropdownItemIcon: l,
|
|
23
|
+
dropdownItemTitle: u,
|
|
24
|
+
checkmark: b
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
n as button,
|
|
28
|
+
t as buttonActive,
|
|
29
|
+
e as buttonContent,
|
|
30
|
+
b as checkmark,
|
|
31
|
+
h as chevron,
|
|
32
|
+
x as chevronCollapsed,
|
|
33
|
+
i as chevronContainer,
|
|
34
|
+
a as chevronExpanded,
|
|
35
|
+
o as container,
|
|
36
|
+
k as default,
|
|
37
|
+
p as description,
|
|
38
|
+
q as dropdown,
|
|
39
|
+
w as dropdownContainer,
|
|
40
|
+
I as dropdownItem,
|
|
41
|
+
m as dropdownItemContent,
|
|
42
|
+
l as dropdownItemIcon,
|
|
43
|
+
v as dropdownItemIconWrapper,
|
|
44
|
+
u as dropdownItemTitle,
|
|
45
|
+
C as dropdownList,
|
|
46
|
+
c as icon,
|
|
47
|
+
r as iconContainer,
|
|
48
|
+
_ as iconWrapper,
|
|
49
|
+
d as textContainer,
|
|
50
|
+
s as title
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=dropdown-menu.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as $ } from "react";
|
|
3
|
+
import { DropdownMenu as N } from "./dropdown-menu.js";
|
|
4
|
+
import r from "./nav-tree.module.css.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
function p({ item: e, activeId: c, level: a = 0 }) {
|
|
7
|
+
const d = a === 0 ? !0 : e.expanded ?? !1, [l, u] = $(d), o = e.children && e.children.length > 0, h = o && !e.href, f = e.href && c === e.href, m = e.icon;
|
|
8
|
+
return h && a === 0 ? /* @__PURE__ */ i("div", { className: r.group, role: "group", "aria-label": e.toc_title, children: [
|
|
9
|
+
/* @__PURE__ */ i("div", { className: r.groupHeader, children: [
|
|
10
|
+
m && /* @__PURE__ */ n(m, { className: r.groupIcon, "aria-hidden": "true" }),
|
|
11
|
+
/* @__PURE__ */ n("span", { children: e.toc_title })
|
|
12
|
+
] }),
|
|
13
|
+
o && e.children && /* @__PURE__ */ n("ul", { className: r.list, role: "list", children: e.children.map((s, t) => /* @__PURE__ */ n(
|
|
14
|
+
p,
|
|
15
|
+
{
|
|
16
|
+
item: s,
|
|
17
|
+
activeId: c,
|
|
18
|
+
level: a + 1
|
|
19
|
+
},
|
|
20
|
+
`${s.href}-${t}`
|
|
21
|
+
)) })
|
|
22
|
+
] }) : h && a > 0 ? /* @__PURE__ */ i("li", { className: r.listItem, children: [
|
|
23
|
+
/* @__PURE__ */ i(
|
|
24
|
+
"button",
|
|
25
|
+
{
|
|
26
|
+
onClick: () => u(!l),
|
|
27
|
+
"aria-expanded": l,
|
|
28
|
+
"aria-label": `${l ? "Collapse" : "Expand"} ${e.toc_title} section`,
|
|
29
|
+
className: r.expandButton,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ n("div", { className: r.hoverIndicator }),
|
|
32
|
+
/* @__PURE__ */ n("span", { children: e.toc_title }),
|
|
33
|
+
/* @__PURE__ */ n(
|
|
34
|
+
"svg",
|
|
35
|
+
{
|
|
36
|
+
className: `${r.chevron} ${l ? r.chevronExpanded : r.chevronCollapsed}`,
|
|
37
|
+
fill: "none",
|
|
38
|
+
stroke: "currentColor",
|
|
39
|
+
viewBox: "0 0 24 24",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
children: /* @__PURE__ */ n(
|
|
42
|
+
"path",
|
|
43
|
+
{
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeLinejoin: "round",
|
|
46
|
+
strokeWidth: 2,
|
|
47
|
+
d: "M9 5l7 7-7 7"
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
o && l && e.children && /* @__PURE__ */ n("ul", { className: r.nestedList, role: "group", children: e.children.map((s, t) => /* @__PURE__ */ n(
|
|
56
|
+
p,
|
|
57
|
+
{
|
|
58
|
+
item: s,
|
|
59
|
+
activeId: c,
|
|
60
|
+
level: a + 1
|
|
61
|
+
},
|
|
62
|
+
`${s.href}-${t}`
|
|
63
|
+
)) })
|
|
64
|
+
] }) : /* @__PURE__ */ i("li", { className: r.listItem, children: [
|
|
65
|
+
/* @__PURE__ */ i(
|
|
66
|
+
"a",
|
|
67
|
+
{
|
|
68
|
+
href: e.href,
|
|
69
|
+
"aria-current": f ? "page" : void 0,
|
|
70
|
+
className: `${r.link} ${f ? r.linkActive : ""}`,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ n("div", { className: r.hoverIndicator }),
|
|
73
|
+
e.toc_title
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
o && l && e.children && /* @__PURE__ */ n("ul", { className: r.nestedList, role: "group", children: e.children.map((s, t) => /* @__PURE__ */ n(
|
|
78
|
+
p,
|
|
79
|
+
{
|
|
80
|
+
item: s,
|
|
81
|
+
activeId: c,
|
|
82
|
+
level: a + 1
|
|
83
|
+
},
|
|
84
|
+
`${s.href}-${t}`
|
|
85
|
+
)) })
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
function E({
|
|
89
|
+
navTree: e,
|
|
90
|
+
activeId: c,
|
|
91
|
+
className: a = "",
|
|
92
|
+
dropdown: d,
|
|
93
|
+
activeHref: l,
|
|
94
|
+
theme: u
|
|
95
|
+
}) {
|
|
96
|
+
return !e || e.items.length === 0 ? null : /* @__PURE__ */ i(
|
|
97
|
+
"nav",
|
|
98
|
+
{
|
|
99
|
+
className: `${r.nav} ${a} ${u === "dark" ? "dark" : ""}`,
|
|
100
|
+
"aria-label": "Documentation navigation",
|
|
101
|
+
children: [
|
|
102
|
+
d && /* @__PURE__ */ n(
|
|
103
|
+
N,
|
|
104
|
+
{
|
|
105
|
+
dropdown: d,
|
|
106
|
+
activeHref: l,
|
|
107
|
+
className: r.group
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
e.items.map((o, h) => /* @__PURE__ */ n(
|
|
111
|
+
p,
|
|
112
|
+
{
|
|
113
|
+
item: o,
|
|
114
|
+
activeId: c
|
|
115
|
+
},
|
|
116
|
+
`${o.href}-${h}`
|
|
117
|
+
))
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
N as DropdownMenu,
|
|
124
|
+
E as NavTree
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/nav-tree/index.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport type { NavItem, NavTreeData } from \"../../types\";\nimport { DropdownConfig, DropdownMenu } from \"./dropdown-menu\";\nimport styles from \"./nav-tree.module.css\";\nexport { DropdownMenu } from \"./dropdown-menu\";\nexport type { DropdownConfig, DropdownItem } from \"./dropdown-menu\";\nexport { MobileNavTree } from \"./mobile-nav\";\nexport type { MobileNavTreeProps } from \"./mobile-nav\";\nimport \"../../styles.css\";\n\ninterface NavTreeProps {\n navTree: NavTreeData;\n activeId?: string;\n className?: string;\n dropdown?: DropdownConfig;\n activeHref?: string;\n theme?: \"light\" | \"dark\" | \"system\";\n}\n\ninterface TreeItemProps {\n item: NavItem;\n activeId?: string;\n level?: number;\n}\n\nfunction TreeItemComponent({ item, activeId, level = 0 }: TreeItemProps) {\n const defaultExpanded = level === 0 ? true : item.expanded ?? false;\n const [isExpanded, setIsExpanded] = useState(defaultExpanded);\n const hasChildren = item.children && item.children.length > 0;\n const isGroup = hasChildren && !item.href;\n const isActive = item.href && activeId === item.href;\n const Icon = item.icon;\n\n if (isGroup && level === 0) {\n return (\n <div className={styles.group} role=\"group\" aria-label={item.toc_title}>\n <div className={styles.groupHeader}>\n {Icon && <Icon className={styles.groupIcon} aria-hidden=\"true\" />}\n <span>{item.toc_title}</span>\n </div>\n {hasChildren && item.children && (\n <ul className={styles.list} role=\"list\">\n {item.children.map((child, index) => (\n <TreeItemComponent\n key={`${child.href}-${index}`}\n item={child}\n activeId={activeId}\n level={level + 1}\n />\n ))}\n </ul>\n )}\n </div>\n );\n }\n\n if (isGroup && level > 0) {\n return (\n <li className={styles.listItem}>\n <button\n onClick={() => setIsExpanded(!isExpanded)}\n aria-expanded={isExpanded}\n aria-label={`${isExpanded ? \"Collapse\" : \"Expand\"} ${\n item.toc_title\n } section`}\n className={styles.expandButton}\n >\n <div className={styles.hoverIndicator} />\n <span>{item.toc_title}</span>\n <svg\n className={`${styles.chevron} ${\n isExpanded ? styles.chevronExpanded : styles.chevronCollapsed\n }`}\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M9 5l7 7-7 7\"\n />\n </svg>\n </button>\n {hasChildren && isExpanded && item.children && (\n <ul className={styles.nestedList} role=\"group\">\n {item.children.map((child, index) => (\n <TreeItemComponent\n key={`${child.href}-${index}`}\n item={child}\n activeId={activeId}\n level={level + 1}\n />\n ))}\n </ul>\n )}\n </li>\n );\n }\n\n return (\n <li className={styles.listItem}>\n <a\n href={item.href}\n aria-current={isActive ? \"page\" : undefined}\n className={`${styles.link} ${isActive ? styles.linkActive : \"\"}`}\n >\n <div className={styles.hoverIndicator} />\n {item.toc_title}\n </a>\n {hasChildren && isExpanded && item.children && (\n <ul className={styles.nestedList} role=\"group\">\n {item.children.map((child, index) => (\n <TreeItemComponent\n key={`${child.href}-${index}`}\n item={child}\n activeId={activeId}\n level={level + 1}\n />\n ))}\n </ul>\n )}\n </li>\n );\n}\n\nexport function NavTree({\n navTree,\n activeId,\n className = \"\",\n dropdown,\n activeHref,\n theme,\n}: NavTreeProps) {\n if (!navTree || navTree.items.length === 0) {\n return null;\n }\n\n return (\n <nav\n className={`${styles.nav} ${className} ${theme === \"dark\" ? \"dark\" : \"\"}`}\n aria-label=\"Documentation navigation\"\n >\n {dropdown && (\n <DropdownMenu\n dropdown={dropdown}\n activeHref={activeHref}\n className={styles.group}\n />\n )}\n {navTree.items.map((item, index) => (\n <TreeItemComponent\n key={`${item.href}-${index}`}\n item={item}\n activeId={activeId}\n />\n ))}\n </nav>\n );\n}\n"],"names":["TreeItemComponent","item","activeId","level","defaultExpanded","isExpanded","setIsExpanded","useState","hasChildren","isGroup","isActive","Icon","jsxs","styles","jsx","child","index","NavTree","navTree","className","dropdown","activeHref","theme","DropdownMenu"],"m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, DialogBackdrop as p, DialogPanel as u } from "@headlessui/react";
|
|
3
|
+
import { NavTree as N } from "./index.js";
|
|
4
|
+
import { Dismiss16Regular as f } from "@fluentui/react-icons";
|
|
5
|
+
import o from "./mobile-nav.module.css.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
function x({
|
|
8
|
+
isOpen: e,
|
|
9
|
+
setIsOpen: l,
|
|
10
|
+
navTree: n,
|
|
11
|
+
activeId: i,
|
|
12
|
+
className: t = "",
|
|
13
|
+
theme: s,
|
|
14
|
+
dropdown: c,
|
|
15
|
+
activeHref: m
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */ r(
|
|
18
|
+
d,
|
|
19
|
+
{
|
|
20
|
+
open: e,
|
|
21
|
+
onClose: () => l(!1),
|
|
22
|
+
className: `${o.dialog} ${s === "dark" ? "dark" : ""}`,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ a(p, { transition: !0, className: o.backdrop }),
|
|
25
|
+
/* @__PURE__ */ r("div", { className: o.container, children: [
|
|
26
|
+
e && /* @__PURE__ */ a(g, { setIsOpen: l }),
|
|
27
|
+
/* @__PURE__ */ a(u, { id: "mobile-nav", transition: !0, className: o.panel, children: /* @__PURE__ */ a("div", { className: o.content, children: /* @__PURE__ */ a(
|
|
28
|
+
N,
|
|
29
|
+
{
|
|
30
|
+
navTree: n,
|
|
31
|
+
activeId: i,
|
|
32
|
+
className: t,
|
|
33
|
+
dropdown: c,
|
|
34
|
+
activeHref: m,
|
|
35
|
+
theme: s
|
|
36
|
+
}
|
|
37
|
+
) }) })
|
|
38
|
+
] })
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
const g = ({
|
|
44
|
+
setIsOpen: e
|
|
45
|
+
}) => /* @__PURE__ */ r(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
onClick: () => e(!1),
|
|
50
|
+
className: o.closeButton,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ a("span", { className: o.srOnly, children: "Close navigation" }),
|
|
53
|
+
/* @__PURE__ */ a(f, { className: o.closeIcon })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
export {
|
|
58
|
+
x as MobileNavTree
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=mobile-nav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-nav.js","sources":["../../../src/components/nav-tree/mobile-nav.tsx"],"sourcesContent":["import { NavTreeData } from \"../../types\";\nimport { Dialog, DialogBackdrop, DialogPanel } from \"@headlessui/react\";\nimport { DropdownConfig, NavTree } from \"./index\";\nimport { Dismiss16Regular } from \"@fluentui/react-icons\";\nimport styles from \"./mobile-nav.module.css\";\nimport \"../../styles.css\";\n\nexport interface MobileNavTreeProps {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n navTree: NavTreeData;\n activeId?: string;\n className?: string;\n theme?: \"light\" | \"dark\" | \"system\";\n dropdown?: DropdownConfig;\n activeHref?: string;\n}\n\nexport function MobileNavTree({\n isOpen,\n setIsOpen,\n navTree,\n activeId,\n className = \"\",\n theme,\n dropdown,\n activeHref,\n}: MobileNavTreeProps) {\n return (\n <Dialog\n open={isOpen}\n onClose={() => setIsOpen(false)}\n className={`${styles.dialog} ${theme === \"dark\" ? \"dark\" : \"\"}`}\n >\n <DialogBackdrop transition className={styles.backdrop} />\n <div className={styles.container}>\n {isOpen && <CloseButton setIsOpen={setIsOpen} />}\n <DialogPanel id=\"mobile-nav\" transition className={styles.panel}>\n <div className={styles.content}>\n <NavTree\n navTree={navTree}\n activeId={activeId}\n className={className}\n dropdown={dropdown}\n activeHref={activeHref}\n theme={theme}\n />\n </div>\n </DialogPanel>\n </div>\n </Dialog>\n );\n}\n\nconst CloseButton = ({\n setIsOpen,\n}: {\n setIsOpen: (isOpen: boolean) => void;\n}) => {\n return (\n <button\n type=\"button\"\n onClick={() => setIsOpen(false)}\n className={styles.closeButton}\n >\n <span className={styles.srOnly}>Close navigation</span>\n <Dismiss16Regular className={styles.closeIcon} />\n </button>\n );\n};\n"],"names":["MobileNavTree","isOpen","setIsOpen","navTree","activeId","className","theme","dropdown","activeHref","jsxs","Dialog","styles","jsx","DialogBackdrop","CloseButton","DialogPanel","NavTree","Dismiss16Regular"],"mappings":";;;;;;AAkBO,SAASA,EAAc;AAAA,EAC5B,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AACF,GAAuB;AACrB,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAMT;AAAA,MACN,SAAS,MAAMC,EAAU,EAAK;AAAA,MAC9B,WAAW,GAAGS,EAAO,MAAM,IAAIL,MAAU,SAAS,SAAS,EAAE;AAAA,MAE7D,UAAA;AAAA,QAAA,gBAAAM,EAACC,GAAA,EAAe,YAAU,IAAC,WAAWF,EAAO,UAAU;AAAA,QACvD,gBAAAF,EAAC,OAAA,EAAI,WAAWE,EAAO,WACpB,UAAA;AAAA,UAAAV,KAAU,gBAAAW,EAACE,KAAY,WAAAZ,EAAA,CAAsB;AAAA,UAC9C,gBAAAU,EAACG,GAAA,EAAY,IAAG,cAAa,YAAU,IAAC,WAAWJ,EAAO,OACxD,UAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWD,EAAO,SACrB,UAAA,gBAAAC;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,SAAAb;AAAA,cACA,UAAAC;AAAA,cACA,WAAAC;AAAA,cACA,UAAAE;AAAA,cACA,YAAAC;AAAA,cACA,OAAAF;AAAA,YAAA;AAAA,UAAA,GAEJ,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,MAAMQ,IAAc,CAAC;AAAA,EACnB,WAAAZ;AACF,MAII,gBAAAO;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAAS,MAAMP,EAAU,EAAK;AAAA,IAC9B,WAAWS,EAAO;AAAA,IAElB,UAAA;AAAA,MAAA,gBAAAC,EAAC,QAAA,EAAK,WAAWD,EAAO,QAAQ,UAAA,oBAAgB;AAAA,MAChD,gBAAAC,EAACK,GAAA,EAAiB,WAAWN,EAAO,UAAA,CAAW;AAAA,IAAA;AAAA,EAAA;AAAA;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const o = "_dialog_1y5d2_1", n = "_backdrop_1y5d2_14", c = "_container_1y5d2_30", t = "_panel_1y5d2_36", _ = "_content_1y5d2_56", s = "_closeButton_1y5d2_67", e = "_closeIcon_1y5d2_86", l = "_srOnly_1y5d2_104", d = {
|
|
2
|
+
dialog: o,
|
|
3
|
+
backdrop: n,
|
|
4
|
+
container: c,
|
|
5
|
+
panel: t,
|
|
6
|
+
content: _,
|
|
7
|
+
closeButton: s,
|
|
8
|
+
closeIcon: e,
|
|
9
|
+
srOnly: l
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
n as backdrop,
|
|
13
|
+
s as closeButton,
|
|
14
|
+
e as closeIcon,
|
|
15
|
+
c as container,
|
|
16
|
+
_ as content,
|
|
17
|
+
d as default,
|
|
18
|
+
o as dialog,
|
|
19
|
+
t as panel,
|
|
20
|
+
l as srOnly
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=mobile-nav.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-nav.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const n = "_nav_2wanx_1", o = "_group_2wanx_7", t = "_groupHeader_2wanx_11", e = "_groupIcon_2wanx_25", _ = "_list_2wanx_30", a = "_listItem_2wanx_36", c = "_expandButton_2wanx_40", s = "_hoverIndicator_2wanx_76", r = "_chevron_2wanx_97", d = "_chevronExpanded_2wanx_108", i = "_chevronCollapsed_2wanx_112", x = "_link_2wanx_116", l = "_linkActive_2wanx_146", p = "_nestedList_2wanx_156", v = {
|
|
2
|
+
nav: n,
|
|
3
|
+
group: o,
|
|
4
|
+
groupHeader: t,
|
|
5
|
+
groupIcon: e,
|
|
6
|
+
list: _,
|
|
7
|
+
listItem: a,
|
|
8
|
+
expandButton: c,
|
|
9
|
+
hoverIndicator: s,
|
|
10
|
+
chevron: r,
|
|
11
|
+
chevronExpanded: d,
|
|
12
|
+
chevronCollapsed: i,
|
|
13
|
+
link: x,
|
|
14
|
+
linkActive: l,
|
|
15
|
+
nestedList: p
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
r as chevron,
|
|
19
|
+
i as chevronCollapsed,
|
|
20
|
+
d as chevronExpanded,
|
|
21
|
+
v as default,
|
|
22
|
+
c as expandButton,
|
|
23
|
+
o as group,
|
|
24
|
+
t as groupHeader,
|
|
25
|
+
e as groupIcon,
|
|
26
|
+
s as hoverIndicator,
|
|
27
|
+
x as link,
|
|
28
|
+
l as linkActive,
|
|
29
|
+
_ as list,
|
|
30
|
+
a as listItem,
|
|
31
|
+
n as nav,
|
|
32
|
+
p as nestedList
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=nav-tree.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-tree.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsxs as n, jsx as i, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useRef as C, useEffect as N } from "react";
|
|
3
|
+
import { CopyRegular as I, MarkdownRegular as R, ChevronDownRegular as T, ArrowUpRightRegular as k } from "@fluentui/react-icons";
|
|
4
|
+
import { copyMarkdownToClipboard as y } from "../hooks/useMarkdownCopy.js";
|
|
5
|
+
import e from "./page-context-menu.module.css.js";
|
|
6
|
+
const j = ({
|
|
7
|
+
className: b,
|
|
8
|
+
pathname: l,
|
|
9
|
+
markdownContent: u,
|
|
10
|
+
onCopyMarkdown: s,
|
|
11
|
+
onViewMarkdown: f
|
|
12
|
+
}) => {
|
|
13
|
+
const [o, d] = v(!1), [r, w] = v(!1), m = C(null);
|
|
14
|
+
N(() => {
|
|
15
|
+
if (r) {
|
|
16
|
+
const t = setTimeout(() => {
|
|
17
|
+
w(!1);
|
|
18
|
+
}, 2e3);
|
|
19
|
+
return () => clearTimeout(t);
|
|
20
|
+
}
|
|
21
|
+
}, [r]), N(() => {
|
|
22
|
+
const t = (p) => {
|
|
23
|
+
m.current && !m.current.contains(p.target) && d(!1);
|
|
24
|
+
};
|
|
25
|
+
return o && document.addEventListener("mousedown", t), () => {
|
|
26
|
+
document.removeEventListener("mousedown", t);
|
|
27
|
+
};
|
|
28
|
+
}, [o]);
|
|
29
|
+
const x = async () => {
|
|
30
|
+
w(!0);
|
|
31
|
+
try {
|
|
32
|
+
if (u) {
|
|
33
|
+
const t = new ClipboardItem({
|
|
34
|
+
"text/plain": new Blob([u], { type: "text/plain" })
|
|
35
|
+
});
|
|
36
|
+
await navigator.clipboard.write([t]), s == null || s();
|
|
37
|
+
} else
|
|
38
|
+
y({
|
|
39
|
+
pathname: l,
|
|
40
|
+
onSuccess: () => {
|
|
41
|
+
s == null || s();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
} catch (t) {
|
|
45
|
+
console.error("Failed to copy markdown:", t);
|
|
46
|
+
}
|
|
47
|
+
}, $ = () => {
|
|
48
|
+
f ? f(l) : window.open(`${l}.md`, "_blank");
|
|
49
|
+
}, h = (t) => () => {
|
|
50
|
+
d(!1), t();
|
|
51
|
+
}, c = [
|
|
52
|
+
{
|
|
53
|
+
id: "copy",
|
|
54
|
+
title: "Copy Page",
|
|
55
|
+
description: "Copy page as markdown",
|
|
56
|
+
icon: I,
|
|
57
|
+
action: h(x)
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "view",
|
|
61
|
+
title: "View as Markdown",
|
|
62
|
+
description: "View page as markdown",
|
|
63
|
+
icon: R,
|
|
64
|
+
action: h($),
|
|
65
|
+
externalLink: !0
|
|
66
|
+
}
|
|
67
|
+
], a = c[0];
|
|
68
|
+
return /* @__PURE__ */ n("div", { className: `${e.container} ${b || ""}`, ref: m, children: [
|
|
69
|
+
/* @__PURE__ */ i(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
className: `${e.mainButton} ${c.length > 1 ? e.split : ""} ${r ? e.copied : ""}`,
|
|
73
|
+
onClick: () => {
|
|
74
|
+
a.action();
|
|
75
|
+
},
|
|
76
|
+
children: /* @__PURE__ */ i("div", { className: e.buttonContent, children: a.id === "copy" ? /* @__PURE__ */ n(g, { children: [
|
|
77
|
+
/* @__PURE__ */ i(I, { className: e.icon }),
|
|
78
|
+
/* @__PURE__ */ i("span", { children: r ? "Copied" : "Copy Page" })
|
|
79
|
+
] }) : /* @__PURE__ */ n(g, { children: [
|
|
80
|
+
/* @__PURE__ */ i(a.icon, { className: e.icon }),
|
|
81
|
+
/* @__PURE__ */ i("span", { children: a.title })
|
|
82
|
+
] }) })
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
c.length > 1 && /* @__PURE__ */ n("div", { className: e.dropdownWrapper, children: [
|
|
86
|
+
/* @__PURE__ */ i(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
className: e.dropdownToggle,
|
|
90
|
+
onClick: () => d(!o),
|
|
91
|
+
children: /* @__PURE__ */ i(
|
|
92
|
+
T,
|
|
93
|
+
{
|
|
94
|
+
className: `${e.chevron} ${o ? e.open : ""}`
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
o && /* @__PURE__ */ i("div", { className: e.dropdown, children: c.map((t, p) => /* @__PURE__ */ n(
|
|
100
|
+
"button",
|
|
101
|
+
{
|
|
102
|
+
onClick: t.action,
|
|
103
|
+
className: e.dropdownItem,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ i("div", { className: e.dropdownIconWrapper, children: /* @__PURE__ */ i(t.icon, { className: e.dropdownIcon }) }),
|
|
106
|
+
/* @__PURE__ */ n("div", { className: e.dropdownItemContent, children: [
|
|
107
|
+
/* @__PURE__ */ n("div", { className: e.dropdownItemTitle, children: [
|
|
108
|
+
t.title,
|
|
109
|
+
t.externalLink && /* @__PURE__ */ i(k, { className: e.externalIcon })
|
|
110
|
+
] }),
|
|
111
|
+
/* @__PURE__ */ i("div", { className: e.dropdownItemDescription, children: t.description })
|
|
112
|
+
] })
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
t.id + p
|
|
116
|
+
)) })
|
|
117
|
+
] })
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
j as PageContextMenu
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=page-context-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-context-menu.js","sources":["../../src/components/page-context-menu.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from \"react\";\nimport {\n CopyRegular,\n MarkdownRegular,\n ChevronDownRegular,\n ArrowUpRightRegular,\n} from \"@fluentui/react-icons\";\nimport { copyMarkdownToClipboard } from \"../hooks/useMarkdownCopy\";\nimport styles from \"./page-context-menu.module.css\";\n\ntype ContextualOption = {\n id: string;\n title: string;\n description: string;\n icon: React.ElementType;\n action: () => void;\n externalLink?: boolean;\n};\n\nexport interface PageContextMenuProps {\n className?: string;\n pathname: string;\n markdownContent?: string;\n onCopyMarkdown?: () => void;\n onViewMarkdown?: (pathname: string) => void;\n}\n\nexport const PageContextMenu = ({\n className,\n pathname,\n markdownContent,\n onCopyMarkdown,\n onViewMarkdown,\n}: PageContextMenuProps) => {\n const [isOpen, setIsOpen] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (isCopied) {\n const timeout = setTimeout(() => {\n setIsCopied(false);\n }, 2000);\n return () => clearTimeout(timeout);\n }\n }, [isCopied]);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node)\n ) {\n setIsOpen(false);\n }\n };\n\n if (isOpen) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [isOpen]);\n\n const copyPageAsMarkdown = async () => {\n setIsCopied(true);\n try {\n if (markdownContent) {\n const clipboardItem = new ClipboardItem({\n \"text/plain\": new Blob([markdownContent], { type: \"text/plain\" }),\n });\n await navigator.clipboard.write([clipboardItem]);\n onCopyMarkdown?.();\n } else {\n copyMarkdownToClipboard({\n pathname,\n onSuccess: () => {\n onCopyMarkdown?.();\n },\n });\n }\n } catch (error) {\n console.error(\"Failed to copy markdown:\", error);\n }\n };\n\n const viewAsMarkdown = () => {\n if (onViewMarkdown) {\n onViewMarkdown(pathname);\n } else {\n window.open(`${pathname}.md`, \"_blank\");\n }\n };\n\n const wrapAction = (actionFn: () => void) => {\n return () => {\n setIsOpen(false);\n actionFn();\n };\n };\n\n const options: ContextualOption[] = [\n {\n id: \"copy\",\n title: \"Copy Page\",\n description: \"Copy page as markdown\",\n icon: CopyRegular,\n action: wrapAction(copyPageAsMarkdown),\n },\n {\n id: \"view\",\n title: \"View as Markdown\",\n description: \"View page as markdown\",\n icon: MarkdownRegular,\n action: wrapAction(viewAsMarkdown),\n externalLink: true,\n },\n ];\n\n const firstOption = options[0];\n\n return (\n <div className={`${styles.container} ${className || \"\"}`} ref={dropdownRef}>\n <button\n className={`${styles.mainButton} ${\n options.length > 1 ? styles.split : \"\"\n } ${isCopied ? styles.copied : \"\"}`}\n onClick={() => {\n void firstOption.action();\n }}\n >\n <div className={styles.buttonContent}>\n {firstOption.id === \"copy\" ? (\n <>\n <CopyRegular className={styles.icon} />\n <span>{isCopied ? \"Copied\" : \"Copy Page\"}</span>\n </>\n ) : (\n <>\n <firstOption.icon className={styles.icon} />\n <span>{firstOption.title}</span>\n </>\n )}\n </div>\n </button>\n\n {options.length > 1 && (\n <div className={styles.dropdownWrapper}>\n <button\n className={styles.dropdownToggle}\n onClick={() => setIsOpen(!isOpen)}\n >\n <ChevronDownRegular\n className={`${styles.chevron} ${isOpen ? styles.open : \"\"}`}\n />\n </button>\n\n {isOpen && (\n <div className={styles.dropdown}>\n {options.map((option, index) => (\n <button\n key={option.id + index}\n onClick={option.action}\n className={styles.dropdownItem}\n >\n <div className={styles.dropdownIconWrapper}>\n <option.icon className={styles.dropdownIcon} />\n </div>\n <div className={styles.dropdownItemContent}>\n <div className={styles.dropdownItemTitle}>\n {option.title}\n {option.externalLink && (\n <ArrowUpRightRegular className={styles.externalIcon} />\n )}\n </div>\n <div className={styles.dropdownItemDescription}>\n {option.description}\n </div>\n </div>\n </button>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n );\n};\n"],"names":["PageContextMenu","className","pathname","markdownContent","onCopyMarkdown","onViewMarkdown","isOpen","setIsOpen","useState","isCopied","setIsCopied","dropdownRef","useRef","useEffect","timeout","handleClickOutside","event","copyPageAsMarkdown","clipboardItem","copyMarkdownToClipboard","error","viewAsMarkdown","wrapAction","actionFn","options","CopyRegular","MarkdownRegular","firstOption","jsxs","styles","jsx","Fragment","ChevronDownRegular","option","index","ArrowUpRightRegular"],"mappings":";;;;;AA2BO,MAAMA,IAAkB,CAAC;AAAA,EAC9B,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AACF,MAA4B;AAC1B,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAUC,CAAW,IAAIF,EAAS,EAAK,GACxCG,IAAcC,E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QAAA;AAAA,UACC,WAAWD,EAAO;AAAA,UAClB,SAAS,MAAMtB,EAAU,CAACD,CAAM;AAAA,UAEhC,UAAA,gBAAAwB;AAAA,YAACE;AAAA,YAAA;AAAA,cACC,WAAW,GAAGH,EAAO,OAAO,IAAIvB,IAASuB,EAAO,OAAO,EAAE;AAAA,YAAA;AAAA,UAAA;AAAA,QAC3D;AAAA,MAAA;AAAA,MAGDvB,KACC,gBAAAwB,EAAC,OAAA,EAAI,WAAWD,EAAO,UACpB,UAAAL,EAAQ,IAAI,CAACS,GAAQC,MACpB,gBAAAN;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,SAASK,EAAO;AAAA,UAChB,WAAWJ,EAAO;AAAA,UAElB,UAAA;AAAA,YAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWD,EAAO,qBACrB,UAAA,gBAAAC,EAACG,EAAO,MAAP,EAAY,WAAWJ,EAAO,aAAA,CAAc,EAAA,CAC/C;AAAA,YACA,gBAAAD,EAAC,OAAA,EAAI,WAAWC,EAAO,qBACrB,UAAA;AAAA,cAAA,gBAAAD,EAAC,OAAA,EAAI,WAAWC,EAAO,mBACpB,UAAA;AAAA,gBAAAI,EAAO;AAAA,gBACPA,EAAO,gBACN,gBAAAH,EAACK,GAAA,EAAoB,WAAWN,EAAO,aAAA,CAAc;AAAA,cAAA,GAEzD;AAAA,gCACC,OAAA,EAAI,WAAWA,EAAO,yBACpB,YAAO,YAAA,CACV;AAAA,YAAA,EAAA,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,QAjBKI,EAAO,KAAKC;AAAA,MAAA,CAmBpB,EAAA,CACH;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const o = "_container_19j54_1", n = "_mainButton_19j54_7", t = "_split_19j54_35", d = "_copied_19j54_41", e = "_buttonContent_19j54_49", _ = "_icon_19j54_62", p = "_dropdownToggle_19j54_72", r = "_chevron_19j54_97", c = "_open_19j54_103", s = "_dropdownWrapper_19j54_107", w = "_dropdown_19j54_72", i = "_dropdownItem_19j54_133", I = "_dropdownIconWrapper_19j54_154", j = "_dropdownIcon_19j54_154", a = "_dropdownItemContent_19j54_175", m = "_dropdownItemTitle_19j54_183", l = "_externalIcon_19j54_196", u = "_dropdownItemDescription_19j54_207", g = {
|
|
2
|
+
container: o,
|
|
3
|
+
mainButton: n,
|
|
4
|
+
split: t,
|
|
5
|
+
copied: d,
|
|
6
|
+
buttonContent: e,
|
|
7
|
+
icon: _,
|
|
8
|
+
dropdownToggle: p,
|
|
9
|
+
chevron: r,
|
|
10
|
+
open: c,
|
|
11
|
+
dropdownWrapper: s,
|
|
12
|
+
dropdown: w,
|
|
13
|
+
dropdownItem: i,
|
|
14
|
+
dropdownIconWrapper: I,
|
|
15
|
+
dropdownIcon: j,
|
|
16
|
+
dropdownItemContent: a,
|
|
17
|
+
dropdownItemTitle: m,
|
|
18
|
+
externalIcon: l,
|
|
19
|
+
dropdownItemDescription: u
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
e as buttonContent,
|
|
23
|
+
r as chevron,
|
|
24
|
+
o as container,
|
|
25
|
+
d as copied,
|
|
26
|
+
g as default,
|
|
27
|
+
w as dropdown,
|
|
28
|
+
j as dropdownIcon,
|
|
29
|
+
I as dropdownIconWrapper,
|
|
30
|
+
i as dropdownItem,
|
|
31
|
+
a as dropdownItemContent,
|
|
32
|
+
u as dropdownItemDescription,
|
|
33
|
+
m as dropdownItemTitle,
|
|
34
|
+
p as dropdownToggle,
|
|
35
|
+
s as dropdownWrapper,
|
|
36
|
+
l as externalIcon,
|
|
37
|
+
_ as icon,
|
|
38
|
+
n as mainButton,
|
|
39
|
+
c as open,
|
|
40
|
+
t as split
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=page-context-menu.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-context-menu.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { MDXRenderer as x } from "./mdx-renderer.js";
|
|
3
|
+
import { NavTree as C } from "./nav-tree/index.js";
|
|
4
|
+
import { TableOfContents as b } from "./toc/index.js";
|
|
5
|
+
import { PivotAwareTOC as P } from "./toc/pivot-aware-toc.js";
|
|
6
|
+
import { TextAlignLeftFilled as T } from "@fluentui/react-icons";
|
|
7
|
+
import { PageContextMenu as u } from "./page-context-menu.js";
|
|
8
|
+
import i from "./page.module.css.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import { ZonePivotProvider as I } from "./content-components/zone-pivots/zone-pivot-context.js";
|
|
11
|
+
import { ZonePivotSelector as O } from "./content-components/zone-pivots/zone-pivot-selector.js";
|
|
12
|
+
function $({
|
|
13
|
+
payload: r,
|
|
14
|
+
toc: n,
|
|
15
|
+
navTree: c,
|
|
16
|
+
dropdown: h,
|
|
17
|
+
activeHref: v,
|
|
18
|
+
theme: p,
|
|
19
|
+
className: N = "",
|
|
20
|
+
pathname: o,
|
|
21
|
+
markdownContent: f
|
|
22
|
+
}) {
|
|
23
|
+
var l, d;
|
|
24
|
+
const g = r.serializedContent, s = ((l = r.mdxExtracts) == null ? void 0 : l.zonePivotGroups) || [], a = (d = r.mdxExtracts) == null ? void 0 : d.pivotTocItems;
|
|
25
|
+
return /* @__PURE__ */ e("div", { className: `${p === "dark" ? "dark" : ""} ${N}`, children: /* @__PURE__ */ t("div", { id: "page-container", className: i.pageContainer, children: [
|
|
26
|
+
c && /* @__PURE__ */ e("aside", { className: i.sidebar, "aria-label": "Sidebar navigation", children: /* @__PURE__ */ e("div", { className: i.sidebarInner, children: /* @__PURE__ */ e(
|
|
27
|
+
C,
|
|
28
|
+
{
|
|
29
|
+
navTree: c,
|
|
30
|
+
dropdown: h,
|
|
31
|
+
activeHref: v
|
|
32
|
+
}
|
|
33
|
+
) }) }),
|
|
34
|
+
/* @__PURE__ */ e("div", { className: i.mainWrapper, children: /* @__PURE__ */ e("div", { id: "main-content", className: i.mainContent, children: /* @__PURE__ */ e(I, { groups: s, children: /* @__PURE__ */ t("div", { className: i.contentWrapper, children: [
|
|
35
|
+
n && n.length > 0 && /* @__PURE__ */ e("aside", { className: i.tocSidebar, children: /* @__PURE__ */ t("div", { className: i.tocInner, children: [
|
|
36
|
+
/* @__PURE__ */ t("div", { className: i.tocHeader, children: [
|
|
37
|
+
/* @__PURE__ */ e(T, { className: i.tocIcon }),
|
|
38
|
+
/* @__PURE__ */ e("h2", { className: i.tocTitle, children: "On this page" })
|
|
39
|
+
] }),
|
|
40
|
+
a && Object.keys(a).length > 0 ? /* @__PURE__ */ e(
|
|
41
|
+
P,
|
|
42
|
+
{
|
|
43
|
+
baseToc: n,
|
|
44
|
+
pivotTocItems: a
|
|
45
|
+
}
|
|
46
|
+
) : /* @__PURE__ */ e(b, { toc: n })
|
|
47
|
+
] }) }),
|
|
48
|
+
/* @__PURE__ */ t("div", { className: i.contentArea, children: [
|
|
49
|
+
r.title && /* @__PURE__ */ e("header", { className: i.header, children: /* @__PURE__ */ t("div", { className: i.headerInner, children: [
|
|
50
|
+
/* @__PURE__ */ t("div", { className: i.headerContent, children: [
|
|
51
|
+
/* @__PURE__ */ e("h1", { className: i.title, children: r.title }),
|
|
52
|
+
o && /* @__PURE__ */ e(
|
|
53
|
+
u,
|
|
54
|
+
{
|
|
55
|
+
className: i.contextMenu,
|
|
56
|
+
pathname: o,
|
|
57
|
+
markdownContent: f
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
] }),
|
|
61
|
+
r.description && /* @__PURE__ */ e("p", { className: i.description, children: r.description })
|
|
62
|
+
] }) }),
|
|
63
|
+
s.length > 0 && /* @__PURE__ */ e("div", { className: i.pivotContainer, children: s.map((m) => /* @__PURE__ */ e(
|
|
64
|
+
O,
|
|
65
|
+
{
|
|
66
|
+
group: m,
|
|
67
|
+
className: i.pivotSelector
|
|
68
|
+
},
|
|
69
|
+
m.id
|
|
70
|
+
)) }),
|
|
71
|
+
/* @__PURE__ */ e("div", { className: i.mdxContent, children: /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(g, {}) }) }),
|
|
72
|
+
/* @__PURE__ */ e("style", { children: `
|
|
73
|
+
div h2,
|
|
74
|
+
div h3 {
|
|
75
|
+
scroll-margin-top: var(--scroll-mt);
|
|
76
|
+
}
|
|
77
|
+
` })
|
|
78
|
+
] })
|
|
79
|
+
] }) }) }) })
|
|
80
|
+
] }) });
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
$ as DocsPage
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sources":["../../src/components/page.tsx"],"sourcesContent":["import { MDXRenderer } from \"./mdx-renderer\";\nimport { NavTree } from \"./nav-tree\";\nimport type { DocsPageProps } from \"../types\";\nimport { TableOfContents } from \"./toc\";\nimport { PivotAwareTOC } from \"./toc/pivot-aware-toc\";\nimport { TextAlignLeftFilled } from \"@fluentui/react-icons\";\nimport {\n ZonePivotProvider,\n ZonePivotSelector,\n} from \"./content-components/zone-pivots\";\nimport { PageContextMenu } from \"./page-context-menu\";\nimport styles from \"./page.module.css\";\nimport \"../styles.css\";\n\nexport function DocsPage({\n payload,\n toc,\n navTree,\n dropdown,\n activeHref,\n theme,\n className = \"\",\n pathname,\n markdownContent,\n}: DocsPageProps) {\n const Content = payload.serializedContent;\n const zonePivotGroups = payload.mdxExtracts?.zonePivotGroups || [];\n const pivotTocItems = payload.mdxExtracts?.pivotTocItems;\n\n return (\n <div className={`${theme === \"dark\" ? \"dark\" : \"\"} ${className}`}>\n <div id=\"page-container\" className={styles.pageContainer}>\n {navTree && (\n <aside className={styles.sidebar} aria-label=\"Sidebar navigation\">\n <div className={styles.sidebarInner}>\n <NavTree\n navTree={navTree}\n dropdown={dropdown}\n activeHref={activeHref}\n />\n </div>\n </aside>\n )}\n\n <div className={styles.mainWrapper}>\n <div id=\"main-content\" className={styles.mainContent}>\n <ZonePivotProvider groups={zonePivotGroups}>\n <div className={styles.contentWrapper}>\n {toc && toc.length > 0 && (\n <aside className={styles.tocSidebar}>\n <div className={styles.tocInner}>\n <div className={styles.tocHeader}>\n <TextAlignLeftFilled className={styles.tocIcon} />\n <h2 className={styles.tocTitle}>On this page</h2>\n </div>\n {pivotTocItems &&\n Object.keys(pivotTocItems).length > 0 ? (\n <PivotAwareTOC\n baseToc={toc}\n pivotTocItems={pivotTocItems}\n />\n ) : (\n <TableOfContents toc={toc} />\n )}\n </div>\n </aside>\n )}\n\n <div className={styles.contentArea}>\n {payload.title && (\n <header className={styles.header}>\n <div className={styles.headerInner}>\n <div className={styles.headerContent}>\n <h1 className={styles.title}>{payload.title}</h1>\n {pathname && (\n <PageContextMenu\n className={styles.contextMenu}\n pathname={pathname}\n markdownContent={markdownContent}\n />\n )}\n </div>\n {payload.description && (\n <p className={styles.description}>\n {payload.description}\n </p>\n )}\n </div>\n </header>\n )}\n\n {zonePivotGroups.length > 0 && (\n <div className={styles.pivotContainer}>\n {zonePivotGroups.map((group) => (\n <ZonePivotSelector\n key={group.id}\n group={group}\n className={styles.pivotSelector}\n />\n ))}\n </div>\n )}\n\n <div className={styles.mdxContent}>\n <MDXRenderer>\n <Content />\n </MDXRenderer>\n </div>\n <style>{`\n div h2,\n div h3 {\n scroll-margin-top: var(--scroll-mt);\n }\n `}</style>\n </div>\n </div>\n </ZonePivotProvider>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"names":["DocsPage","payload","toc","navTree","dropdown","activeHref","theme","className","pathname","markdownContent","Content","zonePivotGroups","_a","pivotTocItems","_b","jsxs","styles","jsx","NavTree","ZonePivotProvider","TextAlignLeftFilled","PivotAwareTOC","TableOfContents","PageContextMenu","group","ZonePivotSelector","MDXRenderer"],"mappings":";;;;;;;;;;;AAcO,S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