@acmekit/docs-ui 2.13.41
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/Items-YPPZD6C6.mjs +312 -0
- package/dist/chunk-JD7BP7O5.mjs +13144 -0
- package/dist/index.d.mts +1550 -0
- package/dist/index.d.ts +1550 -0
- package/dist/index.js +15218 -0
- package/dist/index.mjs +366 -0
- package/package.json +58 -0
- package/src/components/Badge/index.tsx +74 -0
- package/src/components/BadgesList/index.tsx +18 -0
- package/src/components/BetaBadge/index.tsx +24 -0
- package/src/components/Bordered/index.tsx +21 -0
- package/src/components/BorderedIcon/index.tsx +60 -0
- package/src/components/Breadcrumbs/index.tsx +83 -0
- package/src/components/Button/index.tsx +100 -0
- package/src/components/Card/Layout/Default/index.tsx +124 -0
- package/src/components/Card/Layout/Filler/index.tsx +30 -0
- package/src/components/Card/Layout/Large/index.tsx +88 -0
- package/src/components/Card/Layout/Mini/index.tsx +142 -0
- package/src/components/Card/index.tsx +50 -0
- package/src/components/CardList/index.tsx +40 -0
- package/src/components/ChildDocs/index.tsx +9 -0
- package/src/components/CodeBlock/Actions/AskAi/index.tsx +10 -0
- package/src/components/CodeBlock/Actions/Copy/index.tsx +59 -0
- package/src/components/CodeBlock/Actions/index.tsx +137 -0
- package/src/components/CodeBlock/Collapsible/Button/index.tsx +58 -0
- package/src/components/CodeBlock/Collapsible/Fade/index.tsx +55 -0
- package/src/components/CodeBlock/Collapsible/Lines/index.tsx +22 -0
- package/src/components/CodeBlock/Header/Wrapper/index.tsx +46 -0
- package/src/components/CodeBlock/Header/index.tsx +67 -0
- package/src/components/CodeBlock/Inline/index.tsx +20 -0
- package/src/components/CodeBlock/Line/index.tsx +331 -0
- package/src/components/CodeBlock/index.tsx +510 -0
- package/src/components/CodeMdx/index.tsx +45 -0
- package/src/components/CodeTabs/Item/index.tsx +67 -0
- package/src/components/CodeTabs/index.tsx +319 -0
- package/src/components/ContentMenu/Actions/index.tsx +7 -0
- package/src/components/ContentMenu/Products/index.tsx +64 -0
- package/src/components/ContentMenu/Toc/index.tsx +148 -0
- package/src/components/ContentMenu/Version/index.tsx +77 -0
- package/src/components/ContentMenu/index.tsx +31 -0
- package/src/components/CopyButton/index.tsx +76 -0
- package/src/components/Details/Summary/index.tsx +75 -0
- package/src/components/Details/index.tsx +98 -0
- package/src/components/DetailsList/index.tsx +32 -0
- package/src/components/DottedSeparator/index.tsx +30 -0
- package/src/components/EditButton/index.tsx +32 -0
- package/src/components/EditDate/index.tsx +33 -0
- package/src/components/ErrorPage/Icon/index.tsx +428 -0
- package/src/components/ErrorPage/index.tsx +32 -0
- package/src/components/Feedback/Solutions/index.tsx +105 -0
- package/src/components/Feedback/index.tsx +304 -0
- package/src/components/Footer/index.tsx +23 -0
- package/src/components/Heading/H1/index.tsx +21 -0
- package/src/components/Heading/H2/index.tsx +47 -0
- package/src/components/Heading/H3/index.tsx +42 -0
- package/src/components/Heading/H4/index.tsx +14 -0
- package/src/components/Heading/index.tsx +4 -0
- package/src/components/IconHeadline/index.tsx +15 -0
- package/src/components/Icons/AiAssistant/index.tsx +462 -0
- package/src/components/Icons/ArrowRightDown/index.tsx +30 -0
- package/src/components/Icons/BundledProduct/index.tsx +72 -0
- package/src/components/Icons/CalendarRefresh/index.tsx +70 -0
- package/src/components/Icons/ChefHat/index.tsx +65 -0
- package/src/components/Icons/CircleDottedLine/index.tsx +60 -0
- package/src/components/Icons/CloudSolid/index.tsx +47 -0
- package/src/components/Icons/ColoredAcmeKit/index.tsx +13 -0
- package/src/components/Icons/DecisionProcess/index.tsx +58 -0
- package/src/components/Icons/Erp/index.tsx +92 -0
- package/src/components/Icons/Github/index.tsx +22 -0
- package/src/components/Icons/House/index.tsx +23 -0
- package/src/components/Icons/ImageBinary/index.tsx +69 -0
- package/src/components/Icons/Kapa/index.tsx +22 -0
- package/src/components/Icons/Markdown/index.tsx +25 -0
- package/src/components/Icons/NavigationDropdown/Admin/index.tsx +33 -0
- package/src/components/Icons/NavigationDropdown/Doc/index.tsx +41 -0
- package/src/components/Icons/NavigationDropdown/DocV1/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Modules/index.tsx +33 -0
- package/src/components/Icons/NavigationDropdown/Resources/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Store/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Ui/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/User/index.tsx +37 -0
- package/src/components/Icons/PuzzleColored/index.tsx +35 -0
- package/src/components/Icons/QuestionMark/index.tsx +23 -0
- package/src/components/Icons/Restock/index.tsx +55 -0
- package/src/components/Icons/ScrollText/index.tsx +68 -0
- package/src/components/Icons/ShadedBg/index.tsx +334 -0
- package/src/components/Icons/Shop/index.tsx +68 -0
- package/src/components/Icons/SidebarLeft/index.tsx +42 -0
- package/src/components/Icons/StripeColored/index.tsx +60 -0
- package/src/components/Icons/ThumbDown/index.tsx +23 -0
- package/src/components/Icons/ThumbUp/index.tsx +23 -0
- package/src/components/Icons/WindowPaintbrush/index.tsx +57 -0
- package/src/components/Icons/index.tsx +20 -0
- package/src/components/InlineCode/index.tsx +42 -0
- package/src/components/InlineIcon/index.tsx +21 -0
- package/src/components/InlineThemeImage/index.tsx +14 -0
- package/src/components/Input/Search/index.tsx +64 -0
- package/src/components/Input/Text/index.tsx +39 -0
- package/src/components/Kbd/index.tsx +33 -0
- package/src/components/Label/index.tsx +19 -0
- package/src/components/Link/index.tsx +67 -0
- package/src/components/LinkButton/index.tsx +43 -0
- package/src/components/Loading/Dots/index.tsx +16 -0
- package/src/components/Loading/Spinner/index.tsx +19 -0
- package/src/components/Loading/index.tsx +43 -0
- package/src/components/MDXComponents/index.tsx +209 -0
- package/src/components/MainNav/DesktopMenu/ThemeMenu/index.tsx +76 -0
- package/src/components/MainNav/DesktopMenu/index.tsx +100 -0
- package/src/components/MainNav/Items/Dropdown/index.tsx +88 -0
- package/src/components/MainNav/Items/Link/index.tsx +34 -0
- package/src/components/MainNav/Items/index.tsx +61 -0
- package/src/components/MainNav/MobileMenu/Main/index.tsx +67 -0
- package/src/components/MainNav/MobileMenu/SubMenu/index.tsx +77 -0
- package/src/components/MainNav/MobileMenu/index.tsx +103 -0
- package/src/components/MainNav/Version/index.tsx +33 -0
- package/src/components/MainNav/index.tsx +153 -0
- package/src/components/MarkdownContent/index.tsx +41 -0
- package/src/components/Menu/Action/index.tsx +43 -0
- package/src/components/Menu/Divider/index.tsx +35 -0
- package/src/components/Menu/Dropdown/index.tsx +78 -0
- package/src/components/Menu/Item/index.tsx +36 -0
- package/src/components/Menu/SubMenu/index.tsx +47 -0
- package/src/components/Menu/index.tsx +44 -0
- package/src/components/Modal/Footer/index.tsx +29 -0
- package/src/components/Modal/Header/index.tsx +33 -0
- package/src/components/Modal/index.tsx +124 -0
- package/src/components/Note/Layout/index.tsx +139 -0
- package/src/components/Note/Types/checks.tsx +7 -0
- package/src/components/Note/Types/default.tsx +7 -0
- package/src/components/Note/Types/error.tsx +7 -0
- package/src/components/Note/Types/soon.tsx +7 -0
- package/src/components/Note/Types/sucess.tsx +7 -0
- package/src/components/Note/Types/warning.tsx +7 -0
- package/src/components/Note/index.tsx +32 -0
- package/src/components/Notices/DeprecatedNotice/index.tsx +33 -0
- package/src/components/Notices/ExpandableNotice/index.tsx +36 -0
- package/src/components/Notices/FeatureFlagNotice/index.tsx +36 -0
- package/src/components/Notices/VersionNotice/index.tsx +37 -0
- package/src/components/Notification/Item/Layout/Default/index.tsx +89 -0
- package/src/components/Notification/Item/index.tsx +88 -0
- package/src/components/Notification/index.tsx +65 -0
- package/src/components/Pagination/Card/index.tsx +80 -0
- package/src/components/Pagination/index.tsx +35 -0
- package/src/components/Prerequisites/Item/index.tsx +43 -0
- package/src/components/Prerequisites/index.tsx +94 -0
- package/src/components/RadioItem/index.tsx +38 -0
- package/src/components/Rating/index.tsx +133 -0
- package/src/components/RootProviders/index.tsx +31 -0
- package/src/components/Select/Badge/index.tsx +122 -0
- package/src/components/Select/Dropdown/index.tsx +188 -0
- package/src/components/Select/Input/index.tsx +123 -0
- package/src/components/Select/index.ts +13 -0
- package/src/components/Sidebar/Child/index.tsx +43 -0
- package/src/components/Sidebar/Item/Category/index.tsx +151 -0
- package/src/components/Sidebar/Item/Link/index.tsx +174 -0
- package/src/components/Sidebar/Item/Sidebar/index.tsx +67 -0
- package/src/components/Sidebar/Item/SubCategory/index.tsx +83 -0
- package/src/components/Sidebar/Item/index.tsx +41 -0
- package/src/components/Sidebar/Top/MobileClose/index.tsx +21 -0
- package/src/components/Sidebar/Top/index.tsx +33 -0
- package/src/components/Sidebar/index.tsx +153 -0
- package/src/components/SourceCodeLink/index.tsx +37 -0
- package/src/components/SplitLists/index.tsx +58 -0
- package/src/components/Table/index.tsx +87 -0
- package/src/components/Tabs/index.tsx +106 -0
- package/src/components/TextArea/index.tsx +30 -0
- package/src/components/ThemeImage/index.tsx +26 -0
- package/src/components/Toggle/index.tsx +28 -0
- package/src/components/Tooltip/index.tsx +65 -0
- package/src/components/TypeList/Items/index.tsx +337 -0
- package/src/components/TypeList/index.tsx +63 -0
- package/src/components/WideSection/index.tsx +25 -0
- package/src/components/ZoomImg/index.tsx +17 -0
- package/src/components/index.ts +75 -0
- package/src/constants.tsx +261 -0
- package/src/global-config.ts +11 -0
- package/src/hooks/index.ts +14 -0
- package/src/hooks/use-active-on-scroll/index.tsx +223 -0
- package/src/hooks/use-click-outside/index.tsx +37 -0
- package/src/hooks/use-collapsible/index.tsx +128 -0
- package/src/hooks/use-collapsible-code-lines/index.tsx +149 -0
- package/src/hooks/use-copy/index.tsx +28 -0
- package/src/hooks/use-heading-url/index.tsx +32 -0
- package/src/hooks/use-is-external-link/index.tsx +19 -0
- package/src/hooks/use-keyboard-shortcut/index.tsx +71 -0
- package/src/hooks/use-mutation-observer/index.ts +32 -0
- package/src/hooks/use-page-scroll-manager/index.tsx +82 -0
- package/src/hooks/use-resize-observer/index.ts +20 -0
- package/src/hooks/use-scroll-utils/index.tsx +372 -0
- package/src/hooks/use-select/index.tsx +99 -0
- package/src/hooks/use-tabs/index.tsx +94 -0
- package/src/index.ts +8 -0
- package/src/layouts/barebone.tsx +18 -0
- package/src/layouts/index.ts +4 -0
- package/src/layouts/main-content.tsx +86 -0
- package/src/layouts/root.tsx +43 -0
- package/src/layouts/tight.tsx +29 -0
- package/src/layouts/wide.tsx +25 -0
- package/src/providers/AiAssistant/index.tsx +65 -0
- package/src/providers/BrowserProvider/index.tsx +40 -0
- package/src/providers/ColorMode/index.tsx +73 -0
- package/src/providers/Layout/index.tsx +52 -0
- package/src/providers/MainNav/index.tsx +134 -0
- package/src/providers/Mobile/index.tsx +62 -0
- package/src/providers/Modal/index.tsx +52 -0
- package/src/providers/Notification/index.tsx +149 -0
- package/src/providers/Pagination/index.tsx +230 -0
- package/src/providers/Search/index.tsx +91 -0
- package/src/providers/Sidebar/index.tsx +745 -0
- package/src/providers/SiteConfig/index.tsx +70 -0
- package/src/providers/index.ts +13 -0
- package/src/types/config.ts +34 -0
- package/src/types/frontmatter.ts +23 -0
- package/src/types/general.ts +1 -0
- package/src/types/index.ts +9 -0
- package/src/types/menu.ts +40 -0
- package/src/types/navigation-dropdown.ts +16 -0
- package/src/types/navigation.ts +21 -0
- package/src/types/sidebar.ts +109 -0
- package/src/types/toc.ts +19 -0
- package/src/types/ui.ts +9 -0
- package/src/utils/array-same-elms.ts +10 -0
- package/src/utils/capitalize.ts +3 -0
- package/src/utils/check-sidebar-item-visibility.ts +47 -0
- package/src/utils/decode-str.ts +8 -0
- package/src/utils/dom-utils.ts +29 -0
- package/src/utils/event-parser.ts +54 -0
- package/src/utils/get-link-with-base-path.ts +3 -0
- package/src/utils/get-navbar-items.ts +55 -0
- package/src/utils/get-scrolled-top.ts +8 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/is-elm-window.ts +3 -0
- package/src/utils/is-in-view.ts +10 -0
- package/src/utils/os-browser-utils.ts +39 -0
- package/src/utils/set-obj-value.ts +38 -0
- package/src/utils/sidebar-utils.ts +129 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type Params = {
|
|
2
|
+
obj: Record<string, unknown>
|
|
3
|
+
value: unknown
|
|
4
|
+
path: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default function setObjValue({
|
|
8
|
+
obj,
|
|
9
|
+
value,
|
|
10
|
+
path,
|
|
11
|
+
}: Params): Record<string, unknown> {
|
|
12
|
+
// split path by delimiter
|
|
13
|
+
const splitPath = path.split(".")
|
|
14
|
+
const targetKey = splitPath[0]
|
|
15
|
+
|
|
16
|
+
if (!Object.hasOwn(obj, targetKey)) {
|
|
17
|
+
obj[targetKey] = {}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (splitPath.length === 1) {
|
|
21
|
+
obj[targetKey] = value
|
|
22
|
+
return obj
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (typeof obj[targetKey] !== "object") {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`value of ${targetKey} is not an object, so can't set nested value`
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setObjValue({
|
|
32
|
+
obj: obj[targetKey] as Record<string, unknown>,
|
|
33
|
+
value,
|
|
34
|
+
path: splitPath.slice(1).join("."),
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
return obj
|
|
38
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Sidebar } from "../types"
|
|
2
|
+
|
|
3
|
+
export const isSidebarItemLink = (
|
|
4
|
+
item: Sidebar.SidebarItem | undefined,
|
|
5
|
+
options?: {
|
|
6
|
+
checkRef?: boolean
|
|
7
|
+
checkExternal?: boolean
|
|
8
|
+
}
|
|
9
|
+
): item is Sidebar.SidebarItemLink => {
|
|
10
|
+
const { checkRef = true, checkExternal = true } = options || {}
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
item !== undefined &&
|
|
14
|
+
(item.type === "link" ||
|
|
15
|
+
(checkRef && item.type === "ref") ||
|
|
16
|
+
(checkExternal && item.type === "external"))
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const areSidebarItemsEqual = ({
|
|
21
|
+
itemA,
|
|
22
|
+
itemB,
|
|
23
|
+
compareTitles = true,
|
|
24
|
+
}: {
|
|
25
|
+
itemA: Sidebar.SidebarItem
|
|
26
|
+
itemB: Sidebar.SidebarItem
|
|
27
|
+
compareTitles?: boolean
|
|
28
|
+
}): boolean => {
|
|
29
|
+
if (itemA.type !== itemB.type) {
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
// after this, we know that itemA and itemB have the same type
|
|
33
|
+
switch (itemA.type) {
|
|
34
|
+
case "separator":
|
|
35
|
+
return true
|
|
36
|
+
case "sidebar":
|
|
37
|
+
return (
|
|
38
|
+
itemA.sidebar_id === (itemB as Sidebar.SidebarItemSidebar).sidebar_id
|
|
39
|
+
)
|
|
40
|
+
case "category":
|
|
41
|
+
case "sub-category":
|
|
42
|
+
return compareTitles
|
|
43
|
+
? itemA.title === (itemB as Sidebar.SidebarItemCategory).title
|
|
44
|
+
: false
|
|
45
|
+
case "link":
|
|
46
|
+
case "ref":
|
|
47
|
+
case "external": {
|
|
48
|
+
const hasSameTitle =
|
|
49
|
+
!compareTitles ||
|
|
50
|
+
itemA.title === (itemB as Sidebar.SidebarItemLink).title
|
|
51
|
+
const hasSamePath = itemA.path === (itemB as Sidebar.SidebarItemLink).path
|
|
52
|
+
|
|
53
|
+
return hasSameTitle && hasSamePath
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const findSidebarItem = ({
|
|
59
|
+
sidebarItems,
|
|
60
|
+
item,
|
|
61
|
+
checkChildren = true,
|
|
62
|
+
compareTitles = true,
|
|
63
|
+
}: {
|
|
64
|
+
sidebarItems: Sidebar.SidebarItem[]
|
|
65
|
+
item: Sidebar.SidebarItem
|
|
66
|
+
checkChildren?: boolean
|
|
67
|
+
compareTitles?: boolean
|
|
68
|
+
}): Sidebar.SidebarItem | undefined => {
|
|
69
|
+
let foundItem: Sidebar.SidebarItem | undefined
|
|
70
|
+
sidebarItems.some((i) => {
|
|
71
|
+
if (areSidebarItemsEqual({ itemA: i, itemB: item, compareTitles })) {
|
|
72
|
+
foundItem = i
|
|
73
|
+
} else if (checkChildren && "children" in i && i.children) {
|
|
74
|
+
foundItem = findSidebarItem({
|
|
75
|
+
sidebarItems: i.children,
|
|
76
|
+
item,
|
|
77
|
+
checkChildren,
|
|
78
|
+
compareTitles,
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return foundItem !== undefined
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
return foundItem
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const getSidebarItemWithHistory = ({
|
|
89
|
+
sidebarItems,
|
|
90
|
+
item,
|
|
91
|
+
sidebarHistory = [],
|
|
92
|
+
checkChildren = true,
|
|
93
|
+
compareTitles = true,
|
|
94
|
+
}: {
|
|
95
|
+
sidebarItems: Sidebar.SidebarItem[]
|
|
96
|
+
item: Sidebar.SidebarItem
|
|
97
|
+
sidebarHistory?: string[]
|
|
98
|
+
checkChildren?: boolean
|
|
99
|
+
compareTitles?: boolean
|
|
100
|
+
}): {
|
|
101
|
+
item: Sidebar.SidebarItem | undefined
|
|
102
|
+
sidebarHistory: string[]
|
|
103
|
+
} => {
|
|
104
|
+
let foundItem: Sidebar.SidebarItem | undefined
|
|
105
|
+
sidebarItems.some((i) => {
|
|
106
|
+
if (areSidebarItemsEqual({ itemA: i, itemB: item, compareTitles })) {
|
|
107
|
+
foundItem = i
|
|
108
|
+
} else if (checkChildren && "children" in i && i.children) {
|
|
109
|
+
const result = getSidebarItemWithHistory({
|
|
110
|
+
sidebarItems: i.children,
|
|
111
|
+
item,
|
|
112
|
+
checkChildren,
|
|
113
|
+
compareTitles,
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
if (result.item) {
|
|
117
|
+
foundItem = result.item
|
|
118
|
+
if (i.type === "sidebar") {
|
|
119
|
+
sidebarHistory.push(i.sidebar_id)
|
|
120
|
+
}
|
|
121
|
+
sidebarHistory.push(...result.sidebarHistory)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return foundItem !== undefined
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
return { item: foundItem, sidebarHistory }
|
|
129
|
+
}
|