for-humanity 0.4.4 → 0.6.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/CHANGELOG.md +21 -0
- package/README.md +6 -5
- package/dist/browser.js +39 -0
- package/dist/cli.css +350 -262
- package/dist/cli.js +1174 -364
- package/package.json +8 -11
- package/src/component/widget/{shell → cursor-face}/_constant/cursor-face.ts +5 -0
- package/src/component/widget/cursor-face/wg-cursor-face.css +15 -0
- package/src/component/widget/cursor-face/wg-cursor-face.tsx +153 -0
- package/src/component/widget/navigation/_constant/navigation-data-schema.ts +35 -0
- package/src/component/widget/navigation/_constant/navigation.ts +9 -0
- package/src/component/widget/navigation/_function/restore-navigation-scroll.ts +59 -0
- package/src/{content → component/widget/navigation/_function}/to-doc-groups/_to-doc-branches.ts +2 -2
- package/src/{content → component/widget/navigation/_function}/to-doc-groups/_to-doc-group-branches.ts +3 -3
- package/src/{content → component/widget/navigation/_function}/to-doc-groups/to-doc-groups.ts +1 -1
- package/src/component/widget/navigation/_function/to-navigation-branch-id.ts +6 -0
- package/src/component/widget/navigation/_function/to-navigation-data/_to-navigation-document.ts +14 -0
- package/src/component/widget/navigation/_function/to-navigation-data/_to-navigation-group.ts +14 -0
- package/src/component/widget/navigation/_function/to-navigation-data/to-navigation-data.ts +25 -0
- package/src/component/widget/navigation/_function/to-navigation-json.ts +8 -0
- package/src/component/widget/{shell → navigation}/_function/to-toc-groups.ts +2 -2
- package/src/{type → component/widget/navigation/_type}/doc-group.ts +1 -1
- package/src/component/widget/navigation/_type/navigation-data.ts +83 -0
- package/src/component/widget/navigation/_type/navigation-focus-snapshot.ts +21 -0
- package/src/component/widget/navigation/_wg-navigation-branch-toggle.css +28 -0
- package/src/component/widget/navigation/_wg-navigation-branch-toggle.tsx +48 -0
- package/src/component/widget/{shell/_wg-shell-nav-list.css → navigation/_wg-navigation-nav-list.css} +24 -16
- package/src/component/widget/navigation/_wg-navigation-nav-list.tsx +106 -0
- package/src/component/widget/{shell/_wg-shell-nav.css → navigation/_wg-navigation-nav.css} +9 -3
- package/src/component/widget/navigation/_wg-navigation-nav.tsx +43 -0
- package/src/component/widget/navigation/_wg-navigation-scroll.tsx +117 -0
- package/src/component/widget/{shell/_wg-shell-toc.css → navigation/_wg-navigation-toc.css} +39 -24
- package/src/component/widget/navigation/_wg-navigation-toc.tsx +155 -0
- package/src/component/widget/navigation/wg-navigation.css +282 -0
- package/src/component/widget/navigation/wg-navigation.tsx +479 -0
- package/src/component/widget/prose/_function/rehype-sections/rehype-sections.ts +1 -1
- package/src/component/widget/shell/wg-shell.css +13 -269
- package/src/component/widget/shell/wg-shell.tsx +16 -97
- package/src/component/widget/shell-controls/wg-shell-controls.css +4 -0
- package/src/component/widget/shell-controls/wg-shell-controls.tsx +170 -0
- package/src/constant/asset.ts +0 -5
- package/src/constant/copy.ts +5 -0
- package/src/entry/browser/browser.tsx +22 -0
- package/src/entry/cli/_constant/crawling.ts +14 -0
- package/src/{app.tsx → entry/cli/_function/create-app.tsx} +6 -6
- package/src/{dev.ts → entry/cli/_function/create-dev-app.ts} +9 -1
- package/src/{content → entry/cli/_function/create-processor}/create-processor.ts +3 -3
- package/src/{content → entry/cli/_function}/read-docs.ts +21 -2
- package/src/{content → entry/cli/_function}/read-home.ts +1 -1
- package/src/entry/cli/_function/to-crawling-app.ts +42 -0
- package/src/{content/read-docs.test.ts → entry/cli/cli.test.ts} +211 -31
- package/src/{cli.ts → entry/cli/cli.ts} +31 -15
- package/src/store/navigation/_constant/tree.ts +6 -0
- package/src/store/navigation/create-navigation-stores.test.ts +92 -0
- package/src/store/navigation/create-navigation-stores.ts +73 -0
- package/src/store/navigation/navigation-state.ts +46 -0
- package/src/store/navigation/navigation-storage.ts +14 -0
- package/src/store/navigation/to-navigation-scroll-state.ts +42 -0
- package/src/store/navigation/to-navigation-tree-state.ts +19 -0
- package/src/store/navigation/use-navigation-tree-store.ts +12 -0
- package/src/style/token.css +3 -2
- package/src/type/doc-content.ts +1 -1
- package/src/type/doc-file-data.ts +1 -1
- package/src/{component/widget/shell/_type → type}/doc-outline.ts +1 -1
- package/src/type/site-assets.ts +2 -2
- package/src/type/site-config.ts +10 -1
- package/dist/client.js +0 -7
- package/src/client.ts +0 -335
- package/src/component/widget/shell/_constant/navigation.ts +0 -9
- package/src/component/widget/shell/_function/bind-mobile-navigation.ts +0 -147
- package/src/component/widget/shell/_function/bind-navigation-overflow.ts +0 -47
- package/src/component/widget/shell/_function/bind-navigation-scroll.ts +0 -84
- package/src/component/widget/shell/_function/restore-navigation-scroll.ts +0 -47
- package/src/component/widget/shell/_wg-shell-nav-list.tsx +0 -87
- package/src/component/widget/shell/_wg-shell-nav.tsx +0 -49
- package/src/component/widget/shell/_wg-shell-toc.tsx +0 -57
- /package/src/{constant → component/widget/navigation/_constant}/locale.ts +0 -0
- /package/src/component/widget/{shell → navigation}/_constant/reading-line.ts +0 -0
- /package/src/{type → component/widget/navigation/_type}/doc-branch.ts +0 -0
- /package/src/component/widget/{shell → navigation}/_type/toc-group.ts +0 -0
- /package/src/{constant → entry/cli/_constant}/cli.ts +0 -0
- /package/src/{content/rehype-assets.ts → entry/cli/_function/create-processor/_rehype-assets.ts} +0 -0
- /package/src/{content/rehype-heading-ids.ts → entry/cli/_function/create-processor/_rehype-heading-ids.ts} +0 -0
- /package/src/{content/remark-report.ts → entry/cli/_function/create-processor/_remark-report.ts} +0 -0
- /package/src/{component/widget/prose/_type → type}/doc-section.ts +0 -0
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import {Fragment} from "react";
|
|
3
|
-
import type {Doc} from "@/type/doc";
|
|
4
|
-
import type {DocGroup} from "@/type/doc-group";
|
|
5
|
-
import "./_wg-shell-nav-list.css";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 한 단계의 문서 목록과 하위 묶음 · 재귀에서도 같은 탐색 표현 유지
|
|
9
|
-
*/
|
|
10
|
-
export interface WgShellNavListProps {
|
|
11
|
-
/**
|
|
12
|
-
* 현재 단계의 문서와 하위 묶음
|
|
13
|
-
*/
|
|
14
|
-
group: DocGroup;
|
|
15
|
-
/**
|
|
16
|
-
* 현재 문서 · 조상 묶음의 경로까지 표시
|
|
17
|
-
*/
|
|
18
|
-
currentDoc?: Doc;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const WgShellNavList = (props: WgShellNavListProps) => {
|
|
22
|
-
const currentAncestors = new Set(props.currentDoc?.ancestors);
|
|
23
|
-
const entries = [
|
|
24
|
-
...props.group.docs.map((doc) => {
|
|
25
|
-
const active = doc.id === props.currentDoc?.id;
|
|
26
|
-
return {kind: "document" as const, key: `doc:${doc.id}`, doc, active, current: active || currentAncestors.has(doc.id)};
|
|
27
|
-
}),
|
|
28
|
-
...props.group.groups.map((group) => ({
|
|
29
|
-
kind: "group" as const,
|
|
30
|
-
key: `group:${JSON.stringify(group.path)}`,
|
|
31
|
-
group,
|
|
32
|
-
current: group.path.every((name, index) => name === props.currentDoc?.data.group[index]),
|
|
33
|
-
})),
|
|
34
|
-
];
|
|
35
|
-
const currentIndex = entries.findIndex((entry) => entry.current);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<ul className={clsx("wg_shellNavList__root")} aria-label={props.group.name}>
|
|
39
|
-
{/**
|
|
40
|
-
* 현재 경로 앞의 줄기와 도착 가지 · 문서 링크는 원래 파일 URL 사용
|
|
41
|
-
*/}
|
|
42
|
-
{entries.map((entry, index) => (
|
|
43
|
-
<li
|
|
44
|
-
className={clsx("wg_shellNavList__item", {
|
|
45
|
-
"wg_shellNavList__item--trail": index < currentIndex,
|
|
46
|
-
"wg_shellNavList__item--current": entry.current,
|
|
47
|
-
})}
|
|
48
|
-
key={entry.key}
|
|
49
|
-
>
|
|
50
|
-
{/**
|
|
51
|
-
* 문서 링크 · 부모도 독립 페이지, 현재 한 문서에만 페이지 상태 부여
|
|
52
|
-
*/}
|
|
53
|
-
{entry.kind === "document" && (
|
|
54
|
-
<Fragment>
|
|
55
|
-
<a
|
|
56
|
-
className={clsx("wg_shellNavList__link", {"wg_shellNavList__link--active": entry.active})}
|
|
57
|
-
href={`/${entry.doc.id}/`}
|
|
58
|
-
title={entry.doc.data.label}
|
|
59
|
-
aria-current={entry.active ? "page" : undefined}
|
|
60
|
-
>
|
|
61
|
-
{entry.doc.data.name}
|
|
62
|
-
</a>
|
|
63
|
-
{/**
|
|
64
|
-
* 하위 문서 · 부모 아래에서도 기존 목록의 들여쓰기와 키보드 이동 유지
|
|
65
|
-
*/}
|
|
66
|
-
{entry.doc.children !== undefined && (
|
|
67
|
-
<WgShellNavList
|
|
68
|
-
group={{name: entry.doc.data.name, path: entry.doc.data.group, docs: entry.doc.children, groups: []}}
|
|
69
|
-
currentDoc={props.currentDoc}
|
|
70
|
-
/>
|
|
71
|
-
)}
|
|
72
|
-
</Fragment>
|
|
73
|
-
)}
|
|
74
|
-
{/**
|
|
75
|
-
* 하위 묶음 · 같은 목록을 재귀로 이어 깊이에 따라 들여쓰기
|
|
76
|
-
*/}
|
|
77
|
-
{entry.kind === "group" && (
|
|
78
|
-
<Fragment>
|
|
79
|
-
<span className={clsx("wg_shellNavList__branch")}>{entry.group.name}</span>
|
|
80
|
-
<WgShellNavList group={entry.group} currentDoc={props.currentDoc} />
|
|
81
|
-
</Fragment>
|
|
82
|
-
)}
|
|
83
|
-
</li>
|
|
84
|
-
))}
|
|
85
|
-
</ul>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import {WgShellNavList} from "@/component/widget/shell/_wg-shell-nav-list";
|
|
3
|
-
import {copy_nav_aria_label} from "@/constant/copy";
|
|
4
|
-
import {toDocGroups} from "@/content/to-doc-groups/to-doc-groups";
|
|
5
|
-
import type {Doc} from "@/type/doc";
|
|
6
|
-
import type {SiteConfig} from "@/type/site-config";
|
|
7
|
-
import "./_wg-shell-nav.css";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 서버 사이드바 입력 · 읽는 순서의 문서 묶음
|
|
11
|
-
*/
|
|
12
|
-
export interface WgShellNavProps {
|
|
13
|
-
/**
|
|
14
|
-
* 문서 묶음 순서
|
|
15
|
-
*/
|
|
16
|
-
site: SiteConfig;
|
|
17
|
-
/**
|
|
18
|
-
* 전체 문서 목록
|
|
19
|
-
*/
|
|
20
|
-
docs: Doc[];
|
|
21
|
-
/**
|
|
22
|
-
* 현재 문서 id · 첫 화면 생략
|
|
23
|
-
*/
|
|
24
|
-
current?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const WgShellNav = (props: WgShellNavProps) => {
|
|
28
|
-
const docGroups = toDocGroups({docs: props.docs, navigation: props.site.navigation});
|
|
29
|
-
const currentDoc = props.docs.find((doc) => doc.id === props.current);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<nav className={clsx("wg_shellNav__root")} aria-label={copy_nav_aria_label}>
|
|
33
|
-
{/**
|
|
34
|
-
* 문서 이동 · 독자 목적별 묶음
|
|
35
|
-
*/}
|
|
36
|
-
<div className={clsx("wg_shellNav__docs")}>
|
|
37
|
-
{/**
|
|
38
|
-
* 묶음 이름과 독립 문서 · 제목이 링크의 접근 가능한 이름
|
|
39
|
-
*/}
|
|
40
|
-
{docGroups.map((group) => (
|
|
41
|
-
<section className={clsx("wg_shellNav__docGroup")} key={group.name} aria-label={group.name}>
|
|
42
|
-
<div className={clsx("wg_shellNav__group")}>{group.name}</div>
|
|
43
|
-
<WgShellNavList group={group} currentDoc={currentDoc} />
|
|
44
|
-
</section>
|
|
45
|
-
))}
|
|
46
|
-
</div>
|
|
47
|
-
</nav>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import {Fragment} from "react";
|
|
3
|
-
import type {TocGroup} from "@/component/widget/shell/_type/toc-group";
|
|
4
|
-
import {copy_nav_toc_label} from "@/constant/copy";
|
|
5
|
-
import "./_wg-shell-toc.css";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 문서 탐색 아래의 현재 문서 목차 · client.ts에서 읽는 위치 표시
|
|
9
|
-
*/
|
|
10
|
-
export interface WgShellTocProps {
|
|
11
|
-
/**
|
|
12
|
-
* 본문 순서의 가름·절·소제목 · 전체 펼침
|
|
13
|
-
*/
|
|
14
|
-
groups: TocGroup[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const WgShellToc = (props: WgShellTocProps) => {
|
|
18
|
-
return (
|
|
19
|
-
<nav className={clsx("wg_shellToc__root")} aria-label={copy_nav_toc_label}>
|
|
20
|
-
<div className={clsx("wg_shellToc__label")}>{copy_nav_toc_label}</div>
|
|
21
|
-
{/**
|
|
22
|
-
* 가름별 제목 이동 · 작성한 제목을 본문과 동일하게 표시
|
|
23
|
-
*/}
|
|
24
|
-
{props.groups.map((group) => (
|
|
25
|
-
<Fragment key={group.sections[0].heading.slug}>
|
|
26
|
-
{group.part !== undefined && <div className={clsx("wg_shellToc__group")}>{group.part}</div>}
|
|
27
|
-
{/**
|
|
28
|
-
* 현재 위치와 무관하게 모든 소제목 표시
|
|
29
|
-
*/}
|
|
30
|
-
<ul className={clsx("wg_shellToc__list")}>
|
|
31
|
-
{group.sections.map((section) => (
|
|
32
|
-
<li className={clsx("wg_shellToc__item")} key={section.heading.slug}>
|
|
33
|
-
<a className={clsx("wg_shellToc__link")} href={`#${section.heading.slug}`} data-toc-link="">
|
|
34
|
-
{section.heading.text}
|
|
35
|
-
</a>
|
|
36
|
-
{/**
|
|
37
|
-
* 소제목의 들여쓰기 · JavaScript 없이도 제목 이동 가능
|
|
38
|
-
*/}
|
|
39
|
-
{section.subs.length > 0 && (
|
|
40
|
-
<ul className={clsx("wg_shellToc__sub")}>
|
|
41
|
-
{section.subs.map((sub) => (
|
|
42
|
-
<li className={clsx("wg_shellToc__subItem")} key={sub.heading.slug}>
|
|
43
|
-
<a className={clsx("wg_shellToc__subLink")} href={`#${sub.heading.slug}`} data-toc-sub-link="">
|
|
44
|
-
{sub.heading.text}
|
|
45
|
-
</a>
|
|
46
|
-
</li>
|
|
47
|
-
))}
|
|
48
|
-
</ul>
|
|
49
|
-
)}
|
|
50
|
-
</li>
|
|
51
|
-
))}
|
|
52
|
-
</ul>
|
|
53
|
-
</Fragment>
|
|
54
|
-
))}
|
|
55
|
-
</nav>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{content/rehype-assets.ts → entry/cli/_function/create-processor/_rehype-assets.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/{content/remark-report.ts → entry/cli/_function/create-processor/_remark-report.ts}
RENAMED
|
File without changes
|
|
File without changes
|