idcmd 0.0.1 → 0.0.3
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/LICENSE +21 -0
- package/README.md +96 -2
- package/package.json +53 -6
- package/public/_idcmd/live-reload.js +18 -0
- package/public/_idcmd/llm-menu.js +153 -0
- package/public/_idcmd/nav-prefetch.js +30 -0
- package/public/_idcmd/right-rail-scrollspy.js +262 -0
- package/public/anthropic-black.svg +16 -0
- package/public/anthropic-white.svg +16 -0
- package/public/favicon.svg +13 -0
- package/public/live-reload.js +18 -0
- package/public/llm-menu.js +153 -0
- package/public/openai-black.svg +15 -0
- package/public/openai-white.svg +15 -0
- package/public/right-rail-scrollspy.js +262 -0
- package/src/build.ts +230 -0
- package/src/cli/args.ts +101 -0
- package/src/cli/commands/build.ts +43 -0
- package/src/cli/commands/deploy.ts +82 -0
- package/src/cli/commands/dev.ts +79 -0
- package/src/cli/commands/init.ts +211 -0
- package/src/cli/commands/preview.ts +60 -0
- package/src/cli/fs.ts +47 -0
- package/src/cli/main.ts +120 -0
- package/src/cli/normalize.ts +26 -0
- package/src/cli/path.ts +30 -0
- package/src/cli/prompt.ts +74 -0
- package/src/cli/run.ts +17 -0
- package/src/cli/version.ts +12 -0
- package/src/cli.ts +6 -0
- package/src/client/index.ts +7 -0
- package/src/content/components/expand.ts +351 -0
- package/src/content/components/install-tabs.ts +120 -0
- package/src/content/components/registry.ts +12 -0
- package/src/content/components/types.ts +21 -0
- package/src/content/frontmatter.ts +89 -0
- package/src/content/icons.ts +78 -0
- package/src/content/llms.ts +93 -0
- package/src/content/meta.ts +92 -0
- package/src/content/navigation.ts +154 -0
- package/src/content/paths.ts +34 -0
- package/src/content/store.ts +10 -0
- package/src/project/paths.ts +86 -0
- package/src/render/layout-loader.ts +46 -0
- package/src/render/layout.tsx +339 -0
- package/src/render/markdown.ts +14 -0
- package/src/render/page-renderer.ts +320 -0
- package/src/render/right-rail.tsx +249 -0
- package/src/render/toc.ts +66 -0
- package/src/search/api.ts +75 -0
- package/src/search/contract.ts +44 -0
- package/src/search/index.ts +264 -0
- package/src/search/page.tsx +96 -0
- package/src/search/server-page.ts +97 -0
- package/src/seo/files.ts +124 -0
- package/src/seo/server.ts +102 -0
- package/src/server/headers.ts +10 -0
- package/src/server/live-reload.ts +121 -0
- package/src/server/static.ts +59 -0
- package/src/server/user-routes.ts +212 -0
- package/src/server.ts +234 -0
- package/src/site/config.ts +244 -0
- package/src/site/url-policy.ts +60 -0
- package/src/site/urls.ts +46 -0
- package/templates/default/README.md +26 -0
- package/templates/default/package.json +29 -0
- package/templates/default/site/client/layout.tsx +2 -0
- package/templates/default/site/client/right-rail.tsx +1 -0
- package/templates/default/site/client/search-page.tsx +1 -0
- package/templates/default/site/content/404.md +8 -0
- package/templates/default/site/content/about.md +10 -0
- package/templates/default/site/content/index.md +10 -0
- package/templates/default/site/icons/file.svg +1 -0
- package/templates/default/site/icons/home.svg +1 -0
- package/templates/default/site/icons/info.svg +1 -0
- package/templates/default/site/public/_idcmd/live-reload.js +18 -0
- package/templates/default/site/public/_idcmd/llm-menu.js +153 -0
- package/templates/default/site/public/_idcmd/nav-prefetch.js +30 -0
- package/templates/default/site/public/_idcmd/right-rail-scrollspy.js +262 -0
- package/templates/default/site/public/anthropic-white.svg +16 -0
- package/templates/default/site/public/favicon.svg +13 -0
- package/templates/default/site/public/openai-white.svg +15 -0
- package/templates/default/site/server/routes/api/hello.ts +2 -0
- package/templates/default/site/server/server.ts +4 -0
- package/templates/default/site/site.jsonc +21 -0
- package/templates/default/site/styles/tailwind.css +452 -0
- package/templates/default/tsconfig.json +23 -0
- package/templates/default/vercel.json +7 -0
- package/index.js +0 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const protocol = location.protocol === "https:" ? "wss:" : "ws:";
|
|
3
|
+
const socket = new WebSocket(
|
|
4
|
+
`${protocol}//${location.host}/_idcmd/live-reload`
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
socket.addEventListener("message", (event) => {
|
|
8
|
+
if (event.data === "reload") {
|
|
9
|
+
location.reload();
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
socket.addEventListener("close", () => {
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
location.reload();
|
|
16
|
+
}, 1000);
|
|
17
|
+
});
|
|
18
|
+
})();
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
const COPY_SELECTOR = 'a[data-copy-markdown="1"]';
|
|
2
|
+
const LABEL_SELECTOR = '[data-copy-markdown-label="1"]';
|
|
3
|
+
const RESET_DELAY_MS = 2000;
|
|
4
|
+
|
|
5
|
+
const setLinkDisabled = (link, disabled) => {
|
|
6
|
+
if (disabled) {
|
|
7
|
+
link.setAttribute("aria-disabled", "true");
|
|
8
|
+
link.style.pointerEvents = "none";
|
|
9
|
+
link.style.opacity = "0.8";
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
link.removeAttribute("aria-disabled");
|
|
14
|
+
link.style.pointerEvents = "";
|
|
15
|
+
link.style.opacity = "";
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const setLinkLabel = (link, next) => {
|
|
19
|
+
const label = link.querySelector(LABEL_SELECTOR);
|
|
20
|
+
if (label) {
|
|
21
|
+
label.textContent = next;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const toAbsoluteUrl = (href) => {
|
|
26
|
+
try {
|
|
27
|
+
return new URL(href, window.location.href).toString();
|
|
28
|
+
} catch {
|
|
29
|
+
return href;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const createHiddenTextarea = (text) => {
|
|
34
|
+
const textarea = document.createElement("textarea");
|
|
35
|
+
textarea.value = text;
|
|
36
|
+
textarea.setAttribute("readonly", "true");
|
|
37
|
+
textarea.style.position = "fixed";
|
|
38
|
+
textarea.style.left = "-9999px";
|
|
39
|
+
textarea.style.top = "0";
|
|
40
|
+
return textarea;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const safeExecCommandCopy = () => {
|
|
44
|
+
try {
|
|
45
|
+
return document.execCommand("copy");
|
|
46
|
+
} catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const copyViaExecCommand = (text) => {
|
|
52
|
+
const textarea = createHiddenTextarea(text);
|
|
53
|
+
document.body.append(textarea);
|
|
54
|
+
textarea.focus();
|
|
55
|
+
textarea.select();
|
|
56
|
+
const ok = safeExecCommandCopy();
|
|
57
|
+
textarea.remove();
|
|
58
|
+
return ok;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const copyText = async (text) => {
|
|
62
|
+
const { clipboard } = navigator;
|
|
63
|
+
if (clipboard?.writeText) {
|
|
64
|
+
try {
|
|
65
|
+
await clipboard.writeText(text);
|
|
66
|
+
return true;
|
|
67
|
+
} catch {
|
|
68
|
+
// Fall back below.
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return copyViaExecCommand(text);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const closeMenuIfPresent = (link) => {
|
|
76
|
+
const details = link.closest("details");
|
|
77
|
+
if (details instanceof HTMLDetailsElement) {
|
|
78
|
+
details.open = false;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const getOriginalLabel = (link) =>
|
|
83
|
+
link.querySelector(LABEL_SELECTOR)?.textContent ??
|
|
84
|
+
"Copy Markdown to Clipboard";
|
|
85
|
+
|
|
86
|
+
const fetchMarkdownText = async (href) => {
|
|
87
|
+
const res = await fetch(toAbsoluteUrl(href), { credentials: "same-origin" });
|
|
88
|
+
if (!res.ok) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return res.text();
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const copyMarkdownFromHref = async (href) => {
|
|
95
|
+
try {
|
|
96
|
+
const text = await fetchMarkdownText(href);
|
|
97
|
+
if (!text) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return copyText(text);
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const startCopyOperation = (link) => {
|
|
107
|
+
setLinkDisabled(link, true);
|
|
108
|
+
setLinkLabel(link, "Copying...");
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const finishCopyOperation = (link, ok) => {
|
|
112
|
+
setLinkLabel(link, ok ? "Copied" : "Copy failed");
|
|
113
|
+
closeMenuIfPresent(link);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const scheduleResetOperation = (link, originalLabel) => {
|
|
117
|
+
window.setTimeout(() => {
|
|
118
|
+
setLinkLabel(link, originalLabel);
|
|
119
|
+
setLinkDisabled(link, false);
|
|
120
|
+
}, RESET_DELAY_MS);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const handleCopyClick = async (link, originalLabel) => {
|
|
124
|
+
const href = link.getAttribute("href");
|
|
125
|
+
if (!href) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
startCopyOperation(link);
|
|
130
|
+
const ok = await copyMarkdownFromHref(href);
|
|
131
|
+
finishCopyOperation(link, ok);
|
|
132
|
+
scheduleResetOperation(link, originalLabel);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const attachCopyHandler = (link) => {
|
|
136
|
+
const originalLabel = getOriginalLabel(link);
|
|
137
|
+
link.addEventListener("click", async (event) => {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
if (link.getAttribute("aria-disabled") === "true") {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
await handleCopyClick(link, originalLabel);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const initCopyMarkdownButtons = () => {
|
|
147
|
+
const links = [...document.querySelectorAll(COPY_SELECTOR)];
|
|
148
|
+
for (const link of links) {
|
|
149
|
+
attachCopyHandler(link);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
initCopyMarkdownButtons();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const selector = 'a[data-prefetch="hover"][href]';
|
|
3
|
+
const prefetched = new Set();
|
|
4
|
+
|
|
5
|
+
const prefetch = (href) => {
|
|
6
|
+
if (!href || prefetched.has(href)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
prefetched.add(href);
|
|
10
|
+
|
|
11
|
+
const link = document.createElement("link");
|
|
12
|
+
link.rel = "prefetch";
|
|
13
|
+
link.href = href;
|
|
14
|
+
document.head.append(link);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const onOver = (event) => {
|
|
18
|
+
const { target } = event;
|
|
19
|
+
if (!(target instanceof Element)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const link = target.closest(selector);
|
|
23
|
+
if (!(link instanceof HTMLAnchorElement)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
prefetch(link.href);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
document.addEventListener("mouseover", onOver, { passive: true });
|
|
30
|
+
})();
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
const TOC_ROOT_SELECTOR = '[data-toc-root="1"]';
|
|
2
|
+
const TOC_LINK_SELECTOR = 'a[data-toc-link="1"][href^="#"]';
|
|
3
|
+
const TOC_SCROLL_CONTAINER_SELECTOR = '[data-toc-scroll-container="1"]';
|
|
4
|
+
|
|
5
|
+
const NAVBAR_GAP_PX = 16;
|
|
6
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
7
|
+
|
|
8
|
+
const getTopOffset = () => {
|
|
9
|
+
const header = document.querySelector("header");
|
|
10
|
+
const headerHeight = header?.getBoundingClientRect().height ?? 0;
|
|
11
|
+
return Math.ceil(headerHeight + NAVBAR_GAP_PX);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const decodeAnchorId = (href) => {
|
|
15
|
+
if (!href?.startsWith("#")) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const raw = href.slice(1);
|
|
20
|
+
if (!raw) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
return decodeURIComponent(raw);
|
|
26
|
+
} catch {
|
|
27
|
+
return raw;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const toEntry = (link) => {
|
|
32
|
+
const id = decodeAnchorId(link.getAttribute("href"));
|
|
33
|
+
if (!id) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ids like "11-overview" are valid HTML ids but invalid CSS selectors unless escaped.
|
|
38
|
+
// eslint-disable-next-line unicorn/prefer-query-selector
|
|
39
|
+
const heading = document.getElementById(id);
|
|
40
|
+
if (!heading) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return { heading, link, y: 0 };
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const buildEntries = (tocRoot) =>
|
|
48
|
+
[...tocRoot.querySelectorAll(TOC_LINK_SELECTOR)]
|
|
49
|
+
.map(toEntry)
|
|
50
|
+
.filter((entry) => entry !== null);
|
|
51
|
+
|
|
52
|
+
const measureEntries = (entries) => {
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
entry.y = entry.heading.getBoundingClientRect().top + window.scrollY;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const setScrollMarginTop = (topOffset) => {
|
|
59
|
+
document.documentElement.style.setProperty(
|
|
60
|
+
"--scroll-margin-top",
|
|
61
|
+
`${topOffset}px`
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const binarySearchLastAtOrAbove = (entries, anchorLine) => {
|
|
66
|
+
let lo = 0;
|
|
67
|
+
let hi = entries.length;
|
|
68
|
+
|
|
69
|
+
// Find the first entry with y > anchorLine, then step back one.
|
|
70
|
+
while (lo < hi) {
|
|
71
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
72
|
+
if (entries[mid].y <= anchorLine) {
|
|
73
|
+
lo = mid + 1;
|
|
74
|
+
} else {
|
|
75
|
+
hi = mid;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return lo - 1;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const findActiveIndex = (entries, topOffset) => {
|
|
83
|
+
const anchorLine = window.scrollY + topOffset + 1;
|
|
84
|
+
const best = binarySearchLastAtOrAbove(entries, anchorLine);
|
|
85
|
+
return Math.max(0, best);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const parseTransformValues = (transform, prefix) =>
|
|
89
|
+
transform
|
|
90
|
+
.slice(prefix.length, -1)
|
|
91
|
+
.split(",")
|
|
92
|
+
.map((value) => Number.parseFloat(value.trim()));
|
|
93
|
+
|
|
94
|
+
const getNumberAtIndex = (values, index) => {
|
|
95
|
+
const [value] = values.slice(index, index + 1);
|
|
96
|
+
return Number.isFinite(value) ? value : 0;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const getMatrix3dTranslateY = (values) => getNumberAtIndex(values, 13);
|
|
100
|
+
|
|
101
|
+
const getMatrixTranslateY = (values) => getNumberAtIndex(values, 5);
|
|
102
|
+
|
|
103
|
+
const getComputedTranslateY = (element) => {
|
|
104
|
+
const { transform } = window.getComputedStyle(element);
|
|
105
|
+
if (!transform || transform === "none") {
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (transform.startsWith("matrix3d(")) {
|
|
110
|
+
const values = parseTransformValues(transform, "matrix3d(");
|
|
111
|
+
return getMatrix3dTranslateY(values);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (transform.startsWith("matrix(")) {
|
|
115
|
+
const values = parseTransformValues(transform, "matrix(");
|
|
116
|
+
return getMatrixTranslateY(values);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return 0;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const setTranslateY = (element, next) => {
|
|
123
|
+
element.style.transform = `translate3d(0, ${next}px, 0)`;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const getElementCenterY = (element) => {
|
|
127
|
+
const rect = element.getBoundingClientRect();
|
|
128
|
+
return rect.top + rect.height / 2;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const getCenteredTranslateY = (scrollContainer, list, link) => {
|
|
132
|
+
const containerHeight = scrollContainer.clientHeight;
|
|
133
|
+
const listHeight = list.scrollHeight;
|
|
134
|
+
|
|
135
|
+
if (listHeight <= containerHeight + 1) {
|
|
136
|
+
return 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const delta = getElementCenterY(scrollContainer) - getElementCenterY(link);
|
|
140
|
+
const currentTranslate = getComputedTranslateY(list);
|
|
141
|
+
const minTranslate = containerHeight - listHeight;
|
|
142
|
+
return clamp(currentTranslate + delta, minTranslate, 0);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const centerLinkIfNeeded = (state, link) => {
|
|
146
|
+
const { scrollContainer, tocList } = state;
|
|
147
|
+
if (!scrollContainer || !tocList) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const next = getCenteredTranslateY(scrollContainer, tocList, link);
|
|
152
|
+
const current = getComputedTranslateY(tocList);
|
|
153
|
+
if (Math.abs(current - next) < 0.5) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
setTranslateY(tocList, next);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const setActiveLink = (state, index) => {
|
|
161
|
+
if (index === state.activeIndex) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const previous = state.entries[state.activeIndex];
|
|
166
|
+
previous?.link.removeAttribute("aria-current");
|
|
167
|
+
|
|
168
|
+
state.activeIndex = index;
|
|
169
|
+
const current = state.entries[state.activeIndex];
|
|
170
|
+
current.link.setAttribute("aria-current", "location");
|
|
171
|
+
|
|
172
|
+
if (state.centerActiveItem) {
|
|
173
|
+
centerLinkIfNeeded(state, current.link);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const updateActive = (state) => {
|
|
178
|
+
setActiveLink(state, findActiveIndex(state.entries, state.topOffset));
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const scheduleUpdate = (state) => {
|
|
182
|
+
if (state.isTicking) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
state.isTicking = true;
|
|
187
|
+
requestAnimationFrame(() => {
|
|
188
|
+
state.isTicking = false;
|
|
189
|
+
updateActive(state);
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const refreshLayout = (state) => {
|
|
194
|
+
state.topOffset = getTopOffset();
|
|
195
|
+
setScrollMarginTop(state.topOffset);
|
|
196
|
+
measureEntries(state.entries);
|
|
197
|
+
updateActive(state);
|
|
198
|
+
|
|
199
|
+
if (state.centerActiveItem) {
|
|
200
|
+
const current = state.entries[state.activeIndex];
|
|
201
|
+
if (current) {
|
|
202
|
+
centerLinkIfNeeded(state, current.link);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const createState = () => {
|
|
208
|
+
const { body } = document;
|
|
209
|
+
const tocRoot = document.querySelector(TOC_ROOT_SELECTOR);
|
|
210
|
+
const entries = tocRoot ? buildEntries(tocRoot) : [];
|
|
211
|
+
if (
|
|
212
|
+
!body ||
|
|
213
|
+
body.dataset.scrollspy !== "1" ||
|
|
214
|
+
!tocRoot ||
|
|
215
|
+
entries.length === 0
|
|
216
|
+
) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const centerActiveItem = body.dataset.scrollspyCenter === "1";
|
|
221
|
+
const scrollContainer = tocRoot.querySelector(TOC_SCROLL_CONTAINER_SELECTOR);
|
|
222
|
+
const tocList = scrollContainer?.querySelector("ul") ?? null;
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
activeIndex: -1,
|
|
226
|
+
centerActiveItem,
|
|
227
|
+
entries,
|
|
228
|
+
isTicking: false,
|
|
229
|
+
scrollContainer,
|
|
230
|
+
tocList,
|
|
231
|
+
topOffset: getTopOffset(),
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const start = (state) => {
|
|
236
|
+
// Disable independent TOC scrolling whenever scrollspy is active.
|
|
237
|
+
// The TOC list position is controlled by JS (either centered or left as-is).
|
|
238
|
+
document.body.dataset.tocFollow = "1";
|
|
239
|
+
|
|
240
|
+
window.addEventListener("scroll", () => scheduleUpdate(state), {
|
|
241
|
+
passive: true,
|
|
242
|
+
});
|
|
243
|
+
window.addEventListener("resize", () => refreshLayout(state));
|
|
244
|
+
window.addEventListener("load", () => {
|
|
245
|
+
refreshLayout(state);
|
|
246
|
+
setTimeout(() => refreshLayout(state), 250);
|
|
247
|
+
setTimeout(() => refreshLayout(state), 1000);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
refreshLayout(state);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const init = () => {
|
|
254
|
+
const state = createState();
|
|
255
|
+
if (!state) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
start(state);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
init();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<svg version="1.1" id="Layer_1" xmlns:x="ns_extend;" xmlns:i="ns_ai;" xmlns:graph="ns_graphs;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 92.2 65" style="enable-background:new 0 0 92.2 65;" xml:space="preserve">
|
|
2
|
+
<style type="text/css">
|
|
3
|
+
.st0{fill:#FFFFFF;}
|
|
4
|
+
</style>
|
|
5
|
+
<metadata>
|
|
6
|
+
<sfw xmlns="ns_sfw;">
|
|
7
|
+
<slices>
|
|
8
|
+
</slices>
|
|
9
|
+
<sliceSourceBounds bottomLeftOrigin="true" height="65" width="92.2" x="-43.7" y="-98">
|
|
10
|
+
</sliceSourceBounds>
|
|
11
|
+
</sfw>
|
|
12
|
+
</metadata>
|
|
13
|
+
<path class="st0" d="M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z
|
|
14
|
+
M24.3,39.3l8.8-22.8l8.8,22.8H24.3z">
|
|
15
|
+
</path>
|
|
16
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="IDC favicon">
|
|
2
|
+
<rect width="64" height="64" rx="12" fill="#0B0B0B" />
|
|
3
|
+
<text
|
|
4
|
+
x="32"
|
|
5
|
+
y="40"
|
|
6
|
+
font-family="JetBrains Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
7
|
+
font-size="22"
|
|
8
|
+
text-anchor="middle"
|
|
9
|
+
fill="#F9FAFB"
|
|
10
|
+
>
|
|
11
|
+
idc
|
|
12
|
+
</text>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg width="721" height="721" viewBox="0 0 721 721" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_1637_2935)">
|
|
3
|
+
<g clip-path="url(#clip1_1637_2935)">
|
|
4
|
+
<path d="M304.246 295.411V249.828C304.246 245.989 305.687 243.109 309.044 241.191L400.692 188.412C413.167 181.215 428.042 177.858 443.394 177.858C500.971 177.858 537.44 222.482 537.44 269.982C537.44 273.34 537.44 277.179 536.959 281.018L441.954 225.358C436.197 222 430.437 222 424.68 225.358L304.246 295.411ZM518.245 472.945V364.024C518.245 357.304 515.364 352.507 509.608 349.149L389.174 279.096L428.519 256.543C431.877 254.626 434.757 254.626 438.115 256.543L529.762 309.323C556.154 324.679 573.905 357.304 573.905 388.971C573.905 425.436 552.315 459.024 518.245 472.941V472.945ZM275.937 376.982L236.592 353.952C233.235 352.034 231.794 349.154 231.794 345.315V239.756C231.794 188.416 271.139 149.548 324.4 149.548C344.555 149.548 363.264 156.268 379.102 168.262L284.578 222.964C278.822 226.321 275.942 231.119 275.942 237.838V376.986L275.937 376.982ZM360.626 425.922L304.246 394.255V327.083L360.626 295.416L417.002 327.083V394.255L360.626 425.922ZM396.852 571.789C376.698 571.789 357.989 565.07 342.151 553.075L436.674 498.374C442.431 495.017 445.311 490.219 445.311 483.499V344.352L485.138 367.382C488.495 369.299 489.936 372.179 489.936 376.018V481.577C489.936 532.917 450.109 571.785 396.852 571.785V571.789ZM283.134 464.79L191.486 412.01C165.094 396.654 147.343 364.029 147.343 332.362C147.343 295.416 169.415 262.309 203.48 248.393V357.791C203.48 364.51 206.361 369.308 212.117 372.665L332.074 442.237L292.729 464.79C289.372 466.707 286.491 466.707 283.134 464.79ZM277.859 543.48C223.639 543.48 183.813 502.695 183.813 452.314C183.813 448.475 184.294 444.636 184.771 440.797L279.295 495.498C285.051 498.856 290.812 498.856 296.568 495.498L417.002 425.927V471.509C417.002 475.349 415.562 478.229 412.204 480.146L320.557 532.926C308.081 540.122 293.206 543.48 277.854 543.48H277.859ZM396.852 600.576C454.911 600.576 503.37 559.313 514.41 504.612C568.149 490.696 602.696 440.315 602.696 388.976C602.696 355.387 588.303 322.762 562.392 299.25C564.791 289.173 566.231 279.096 566.231 269.024C566.231 200.411 510.571 149.067 446.274 149.067C433.322 149.067 420.846 150.984 408.37 155.305C386.775 134.192 357.026 120.758 324.4 120.758C266.342 120.758 217.883 162.02 206.843 216.721C153.104 230.637 118.557 281.018 118.557 332.357C118.557 365.946 132.95 398.571 158.861 422.083C156.462 432.16 155.022 442.237 155.022 452.309C155.022 520.922 210.682 572.266 274.978 572.266C287.931 572.266 300.407 570.349 312.883 566.028C334.473 587.141 364.222 600.576 396.852 600.576Z" fill="white"/>
|
|
5
|
+
</g>
|
|
6
|
+
</g>
|
|
7
|
+
<defs>
|
|
8
|
+
<clipPath id="clip0_1637_2935">
|
|
9
|
+
<rect width="720" height="720" fill="white" transform="translate(0.606934 0.899902)"/>
|
|
10
|
+
</clipPath>
|
|
11
|
+
<clipPath id="clip1_1637_2935">
|
|
12
|
+
<rect width="484.139" height="479.818" fill="white" transform="translate(118.557 120.758)"/>
|
|
13
|
+
</clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__IDCMD_SITE_NAME__",
|
|
3
|
+
"description": "__IDCMD_SITE_DESCRIPTION__",
|
|
4
|
+
"baseUrl": "__IDCMD_SITE_BASE_URL__",
|
|
5
|
+
"groups": [{ "id": "main", "label": "Navigation", "order": 1 }],
|
|
6
|
+
"search": {
|
|
7
|
+
"scope": "full",
|
|
8
|
+
},
|
|
9
|
+
"rightRail": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"visibleFrom": "xl",
|
|
12
|
+
"placement": "viewport",
|
|
13
|
+
"tocLevels": [2, 3],
|
|
14
|
+
"smoothScroll": false,
|
|
15
|
+
"scrollSpy": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"centerActiveItem": true,
|
|
18
|
+
"updateHash": "never",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}
|