for-humanity 0.11.0 → 0.13.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 +33 -0
- package/README.md +16 -9
- package/dist/browser.js +16 -16
- package/dist/cli.css +2 -941
- package/dist/cli.js +92 -2290
- package/dist/config.js +1 -0
- package/dist/constant/copy.d.ts +100 -0
- package/dist/constant/site.d.ts +20 -0
- package/dist/constant/status.d.ts +19 -0
- package/dist/copy-C1uzvEnr.js +103 -0
- package/dist/group-path-XAThmzvC.js +10 -0
- package/dist/load-site-CbpLEhwu.js +2379 -0
- package/dist/logger-Dv1i9xSV.js +9 -0
- package/dist/mermaid/THIRD-PARTY-NOTICES.txt +3134 -0
- package/dist/mermaid/chunk--TN-qHgG.js +2 -0
- package/dist/mermaid/chunk-0kM1Lv4D.js +2 -0
- package/dist/mermaid/chunk-3FHei3pH.js +2001 -0
- package/dist/mermaid/chunk-3_2p2GqN.js +2 -0
- package/dist/mermaid/chunk-6HLei9i0.js +84 -0
- package/dist/mermaid/chunk-7Sz3kAwl.js +2214 -0
- package/dist/mermaid/chunk-7Tarqbpa.js +18047 -0
- package/dist/mermaid/chunk-9kkt8lzL.js +10 -0
- package/dist/mermaid/chunk-B--pNBQF.js +884 -0
- package/dist/mermaid/chunk-B4F-pysn.js +4241 -0
- package/dist/mermaid/chunk-B58sEIY_.js +14 -0
- package/dist/mermaid/chunk-B9_UWzSH.js +1517 -0
- package/dist/mermaid/chunk-BB8uZHwY.js +75 -0
- package/dist/mermaid/chunk-BFfk0LEc.js +717 -0
- package/dist/mermaid/chunk-BKri0qr7.js +89 -0
- package/dist/mermaid/chunk-BL404pH5.js +26 -0
- package/dist/mermaid/chunk-BLeiQSWo.js +354 -0
- package/dist/mermaid/chunk-BOmH_UFd.js +2 -0
- package/dist/mermaid/chunk-BSej9Nhy.js +1361 -0
- package/dist/mermaid/chunk-BYzrzvCI.js +12 -0
- package/dist/mermaid/chunk-BariMtWr.js +3020 -0
- package/dist/mermaid/chunk-BcrBoMwH.js +2352 -0
- package/dist/mermaid/chunk-Bok8z-Yo.js +67 -0
- package/dist/mermaid/chunk-BpTHLKQM.js +1970 -0
- package/dist/mermaid/chunk-BqjuxRsC.js +733 -0
- package/dist/mermaid/chunk-BuvPd-s5.js +1073 -0
- package/dist/mermaid/chunk-BvVehae3.js +5069 -0
- package/dist/mermaid/chunk-C-JABYpd.js +3075 -0
- package/dist/mermaid/chunk-C9XlTm4w.js +2 -0
- package/dist/mermaid/chunk-CApNbSU9.js +6 -0
- package/dist/mermaid/chunk-CCM2AH-C.js +9 -0
- package/dist/mermaid/chunk-CD1E0F_N.js +2 -0
- package/dist/mermaid/chunk-CDWvKG7D.js +2 -0
- package/dist/mermaid/chunk-CEVPpC1F.js +34 -0
- package/dist/mermaid/chunk-CLDr12lf.js +47504 -0
- package/dist/mermaid/chunk-CLVYqOBI.js +61 -0
- package/dist/mermaid/chunk-CLeOkFb5.js +15 -0
- package/dist/mermaid/chunk-CLgRAtOz.js +37 -0
- package/dist/mermaid/chunk-CMqFNUBl.js +134 -0
- package/dist/mermaid/chunk-CTPaBJXB.js +2 -0
- package/dist/mermaid/chunk-CVi6IGBL.js +2 -0
- package/dist/mermaid/chunk-CWV_EN-4.js +4745 -0
- package/dist/mermaid/chunk-CZ0dAs3g.js +2 -0
- package/dist/mermaid/chunk-C_YGy4Fn.js +236 -0
- package/dist/mermaid/chunk-CcVH22Yt.js +100 -0
- package/dist/mermaid/chunk-CgG6CD9_.js +7175 -0
- package/dist/mermaid/chunk-CgOP6IDB.js +3397 -0
- package/dist/mermaid/chunk-Cgg2UTSf.js +13 -0
- package/dist/mermaid/chunk-ChJfJJ1A.js +214 -0
- package/dist/mermaid/chunk-Ck5XRA46.js +447 -0
- package/dist/mermaid/chunk-Ckuw16cl.js +203 -0
- package/dist/mermaid/chunk-CpAbRCbF.js +1880 -0
- package/dist/mermaid/chunk-CuYekbSv.js +2 -0
- package/dist/mermaid/chunk-CwS4wZ5a.js +2 -0
- package/dist/mermaid/chunk-D-bcrBO3.js +82 -0
- package/dist/mermaid/chunk-D3IEAkCW.js +76 -0
- package/dist/mermaid/chunk-D8XfBJ_K.js +645 -0
- package/dist/mermaid/chunk-D9Ddd9y4.js +2228 -0
- package/dist/mermaid/chunk-DBh1mIbK.js +12 -0
- package/dist/mermaid/chunk-DD6Df6Ic.js +5 -0
- package/dist/mermaid/chunk-DGVDaXjx.js +8 -0
- package/dist/mermaid/chunk-DK9KqIXj.js +632 -0
- package/dist/mermaid/chunk-DORnIAsy.js +4487 -0
- package/dist/mermaid/chunk-DU69_VcF.js +363 -0
- package/dist/mermaid/chunk-DVNvSFoz.js +2144 -0
- package/dist/mermaid/chunk-DZe-4kde.js +20 -0
- package/dist/mermaid/chunk-D_a06Rz4.js +287 -0
- package/dist/mermaid/chunk-DfyFJJi2.js +972 -0
- package/dist/mermaid/chunk-DhKYPp1Z.js +2 -0
- package/dist/mermaid/chunk-DjFqgNTG.js +94 -0
- package/dist/mermaid/chunk-DmbDDrr-.js +65 -0
- package/dist/mermaid/chunk-DpuxlyL_.js +696 -0
- package/dist/mermaid/chunk-DqGhppWe.js +2 -0
- package/dist/mermaid/chunk-DqPZxHXa.js +5 -0
- package/dist/mermaid/chunk-Dt_1Jyif.js +293 -0
- package/dist/mermaid/chunk-DyQBE_NW.js +1935 -0
- package/dist/mermaid/chunk-JckyC4mW.js +1009 -0
- package/dist/mermaid/chunk-K7Myuj2-.js +1334 -0
- package/dist/mermaid/chunk-KuPYb48V.js +275 -0
- package/dist/mermaid/chunk-MFVRUoO0.js +4020 -0
- package/dist/mermaid/chunk-MbInCS_6.js +28 -0
- package/dist/mermaid/chunk-MexOLyKV.js +355 -0
- package/dist/mermaid/chunk-NnbDtJzg.js +21856 -0
- package/dist/mermaid/chunk-SGpOYZbI.js +2139 -0
- package/dist/mermaid/chunk-TbxLDlcU.js +198 -0
- package/dist/mermaid/chunk-TftHqGLg.js +490 -0
- package/dist/mermaid/chunk-UjQ8vA_Z.js +4138 -0
- package/dist/mermaid/chunk-YgmVTKqc.js +16 -0
- package/dist/mermaid/chunk-_a9EZE1v.js +1798 -0
- package/dist/mermaid/chunk-dTb8jqeP.js +2 -0
- package/dist/mermaid/chunk-fFdMfF8S.js +2240 -0
- package/dist/mermaid/chunk-feYbMzBj.js +1267 -0
- package/dist/mermaid/chunk-g3Pn8DkW.js +46 -0
- package/dist/mermaid/chunk-hM77LvCb.js +19832 -0
- package/dist/mermaid/chunk-hUDb-eAW.js +527 -0
- package/dist/mermaid/chunk-tpABtZ-3.js +4252 -0
- package/dist/mermaid/chunk-xIbz3oFK.js +59 -0
- package/dist/mermaid/chunk-yBz-vst0.js +976 -0
- package/dist/mermaid/mermaid-BhtR3wyB.js +1145 -0
- package/dist/run-site-command-C80YoNOe.js +129 -0
- package/dist/site-config-bllORGpm.js +90 -0
- package/dist/site.js +1 -0
- package/dist/start-dev-server-C4_Lu1nZ.js +176 -0
- package/dist/to-change-queue-DbEnZGNK.js +34 -0
- package/dist/to-error-message-pF6_7wGK.js +16 -0
- package/dist/type/group-path.d.ts +7 -0
- package/dist/type/site-config.d.ts +57 -0
- package/package.json +34 -17
- package/src/component/widget/cursor-face/_constant/cursor-face.ts +0 -14
- package/src/component/widget/cursor-face/wg-cursor-face.css +0 -15
- package/src/component/widget/cursor-face/wg-cursor-face.tsx +0 -153
- package/src/component/widget/navigation/_constant/locale.ts +0 -9
- package/src/component/widget/navigation/_constant/navigation-data-schema.ts +0 -33
- package/src/component/widget/navigation/_constant/navigation.ts +0 -9
- package/src/component/widget/navigation/_constant/reading-line.ts +0 -4
- package/src/component/widget/navigation/_function/restore-navigation-scroll.ts +0 -59
- package/src/component/widget/navigation/_function/to-doc-groups/_to-doc-branches.ts +0 -15
- package/src/component/widget/navigation/_function/to-doc-groups/_to-doc-group-branches.ts +0 -70
- package/src/component/widget/navigation/_function/to-doc-groups/to-doc-groups.ts +0 -15
- package/src/component/widget/navigation/_function/to-navigation-data/_to-navigation-document.ts +0 -13
- package/src/component/widget/navigation/_function/to-navigation-data/_to-navigation-group.ts +0 -13
- package/src/component/widget/navigation/_function/to-navigation-data/to-navigation-data.ts +0 -18
- package/src/component/widget/navigation/_function/to-navigation-json.ts +0 -8
- package/src/component/widget/navigation/_function/to-toc-groups.ts +0 -38
- package/src/component/widget/navigation/_type/doc-branch.ts +0 -11
- package/src/component/widget/navigation/_type/doc-group.ts +0 -24
- package/src/component/widget/navigation/_type/navigation-data.ts +0 -75
- package/src/component/widget/navigation/_type/navigation-focus-snapshot.ts +0 -17
- package/src/component/widget/navigation/_type/toc-group.ts +0 -39
- package/src/component/widget/navigation/_wg-navigation-nav-list.css +0 -48
- package/src/component/widget/navigation/_wg-navigation-nav-list.tsx +0 -61
- package/src/component/widget/navigation/_wg-navigation-nav.css +0 -21
- package/src/component/widget/navigation/_wg-navigation-nav.tsx +0 -33
- package/src/component/widget/navigation/_wg-navigation-scroll.tsx +0 -117
- package/src/component/widget/navigation/_wg-navigation-toc.css +0 -91
- package/src/component/widget/navigation/_wg-navigation-toc.tsx +0 -114
- package/src/component/widget/navigation/wg-navigation.css +0 -282
- package/src/component/widget/navigation/wg-navigation.tsx +0 -420
- package/src/component/widget/prose/_constant/heading-highlight.ts +0 -4
- package/src/component/widget/prose/_constant/section.ts +0 -7
- package/src/component/widget/prose/_constant/status.ts +0 -9
- package/src/component/widget/prose/_function/has-block-content.ts +0 -30
- package/src/component/widget/prose/_function/rehype-head.ts +0 -31
- package/src/component/widget/prose/_function/rehype-sections/_to-section-headings.ts +0 -20
- package/src/component/widget/prose/_function/rehype-sections/rehype-sections.ts +0 -21
- package/src/component/widget/prose/_function/rehype-tables.ts +0 -22
- package/src/component/widget/prose/_function/remark-blocks.ts +0 -112
- package/src/component/widget/prose/_function/remark-flow.ts +0 -26
- package/src/component/widget/prose/_function/remark-links.ts +0 -33
- package/src/component/widget/prose/_function/remark-parts.ts +0 -26
- package/src/component/widget/prose/_function/remark-status.ts +0 -59
- package/src/component/widget/prose/_function/remark-swatch.ts +0 -16
- package/src/component/widget/prose/_function/remark-unknown-directives.ts +0 -25
- package/src/component/widget/prose/wg-prose.css +0 -454
- package/src/component/widget/prose/wg-prose.tsx +0 -43
- package/src/component/widget/shell/wg-shell.css +0 -63
- package/src/component/widget/shell/wg-shell.tsx +0 -88
- package/src/component/widget/shell-controls/wg-shell-controls.css +0 -4
- package/src/component/widget/shell-controls/wg-shell-controls.tsx +0 -170
- package/src/constant/asset.ts +0 -63
- package/src/constant/copy.ts +0 -133
- package/src/constant/doc.ts +0 -13
- package/src/constant/font.ts +0 -34
- package/src/constant/site.ts +0 -24
- package/src/constant/status.ts +0 -15
- package/src/entry/browser/browser.tsx +0 -22
- package/src/entry/cli/_constant/cli.ts +0 -19
- package/src/entry/cli/_constant/crawling.ts +0 -14
- package/src/entry/cli/_constant/snippet.ts +0 -21
- package/src/entry/cli/_function/create-app.tsx +0 -57
- package/src/entry/cli/_function/create-dev-app.ts +0 -87
- package/src/entry/cli/_function/create-processor/_rehype-assets.ts +0 -70
- package/src/entry/cli/_function/create-processor/_rehype-heading-ids.ts +0 -34
- package/src/entry/cli/_function/create-processor/_remark-report.ts +0 -15
- package/src/entry/cli/_function/create-processor/_remark-snippets.ts +0 -117
- package/src/entry/cli/_function/create-processor/_shiki-transformers.ts +0 -55
- package/src/entry/cli/_function/create-processor/create-processor.ts +0 -64
- package/src/entry/cli/_function/read-docs.ts +0 -128
- package/src/entry/cli/_function/read-home.ts +0 -32
- package/src/entry/cli/_function/to-crawling-app.ts +0 -42
- package/src/entry/cli/cli.test.ts +0 -782
- package/src/entry/cli/cli.ts +0 -206
- package/src/env.d.ts +0 -6
- package/src/page/doc/pg-doc.tsx +0 -35
- package/src/page/home/pg-home.tsx +0 -40
- package/src/store/navigation/create-navigation-stores.test.ts +0 -74
- package/src/store/navigation/create-navigation-stores.ts +0 -59
- package/src/store/navigation/navigation-state.ts +0 -36
- package/src/store/navigation/navigation-storage.ts +0 -9
- package/src/store/navigation/to-navigation-scroll-state.ts +0 -42
- package/src/style/base.css +0 -28
- package/src/style/token.css +0 -186
- package/src/type/doc-content.ts +0 -15
- package/src/type/doc-data.ts +0 -38
- package/src/type/doc-file-data.ts +0 -21
- package/src/type/doc-heading.ts +0 -17
- package/src/type/doc-outline.ts +0 -16
- package/src/type/doc-section.ts +0 -9
- package/src/type/doc.ts +0 -20
- package/src/type/group-path.ts +0 -7
- package/src/type/site-assets.ts +0 -25
- package/src/type/site-config.ts +0 -73
- package/src/type/vfile-data.d.ts +0 -10
- package/src/util/async/to-change-queue.test.ts +0 -58
- package/src/util/async/to-change-queue.ts +0 -43
- package/src/util/dom/find-hash-target.ts +0 -18
- package/src/util/dom/reveal-hash-target.ts +0 -15
- package/src/util/error/to-error-message.ts +0 -10
- package/src/util/file/to-asset-path.ts +0 -26
- package/src/util/font/to-font-css.test.ts +0 -41
- package/src/util/font/to-font-css.ts +0 -28
- package/src/util/mermaid/render-flow.js +0 -321
package/src/style/token.css
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* 공통 토큰의 단일 출처 · --app-종류-쓰임
|
|
3
|
-
* 사용 기준: templates/document/design.md · 테마 분기는 color-scheme에 한정
|
|
4
|
-
* 폭 기준 1360px·1024px·640px · 양쪽 탐색과 본문 배치
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
:root {
|
|
8
|
-
/* 시스템의 밝게·어둡게 설정을 그대로 따름 */
|
|
9
|
-
color-scheme: light dark;
|
|
10
|
-
|
|
11
|
-
/* 바탕 · ground 페이지, surface 상자, code 코드 */
|
|
12
|
-
--app-color-ground: light-dark(#fff, #181818);
|
|
13
|
-
--app-color-surface: light-dark(#fff, #181818);
|
|
14
|
-
--app-color-code: light-dark(#f1f1eb, #22221f);
|
|
15
|
-
--app-color-backdrop: light-dark(rgb(0 0 0 / 30%), rgb(0 0 0 / 55%));
|
|
16
|
-
|
|
17
|
-
/* 글 · text 본문, strong 강조, muted 라벨 */
|
|
18
|
-
--app-color-text: light-dark(#333, #d5d5d5);
|
|
19
|
-
--app-color-text-strong: light-dark(#222, #eee);
|
|
20
|
-
--app-color-text-muted: light-dark(#666, #aaa);
|
|
21
|
-
|
|
22
|
-
/* 앵커로 도착한 제목 · 형광펜 바탕과 테마별 읽기 대비 */
|
|
23
|
-
--app-color-anchor-highlight: light-dark(#f4f58a, #666322);
|
|
24
|
-
|
|
25
|
-
/* 제목 강조 해제 · 움직임 감소는 base.css에서 일괄 차단 */
|
|
26
|
-
--app-motion-duration-highlight-fade: 600ms;
|
|
27
|
-
--app-motion-easing-out: ease-out;
|
|
28
|
-
|
|
29
|
-
/* 선 · border 상자·목록, soft 표 구분, layout 열 경계 */
|
|
30
|
-
--app-color-border: light-dark(#aaa, #555);
|
|
31
|
-
--app-color-border-soft: light-dark(#ddd, #333);
|
|
32
|
-
--app-color-border-layout: light-dark(#eee, #2b2b2b);
|
|
33
|
-
|
|
34
|
-
/* 강조 · 현재 절·코드 · soft 행 hover 바탕 */
|
|
35
|
-
--app-color-accent: light-dark(#555, #b5b5b5);
|
|
36
|
-
--app-color-accent-soft: light-dark(#f5f5f2, #222);
|
|
37
|
-
|
|
38
|
-
/* 코드 판정 색 · soft 는 블록 바탕(메타 bad·good), mark 는 그 위의 줄 표기 · warn 은 줄 표기만 */
|
|
39
|
-
--app-color-bad: light-dark(#b2412e, #ff9b8a);
|
|
40
|
-
--app-color-bad-soft: light-dark(#f9ebe8, #3a2522);
|
|
41
|
-
--app-color-bad-mark: light-dark(#f1cdc6, #5b322c);
|
|
42
|
-
--app-color-good: light-dark(#2f7a47, #8bd3a3);
|
|
43
|
-
--app-color-good-soft: light-dark(#e4f3ed, #1c342c);
|
|
44
|
-
--app-color-good-mark: light-dark(#c4e4d4, #27503f);
|
|
45
|
-
--app-color-warn: light-dark(#8a6400, #e6c46a);
|
|
46
|
-
--app-color-warn-soft: light-dark(#fbf3d9, #3d3418);
|
|
47
|
-
|
|
48
|
-
/* 링크 · 기본·방문·hover */
|
|
49
|
-
--app-color-link: light-dark(#11a, #9db8ff);
|
|
50
|
-
--app-color-link-visited: light-dark(#51a, #c5a5ed);
|
|
51
|
-
--app-color-link-hover: light-dark(#44d, #c1d1ff);
|
|
52
|
-
|
|
53
|
-
/* 상태 표지 · verified 초록, unverified amber */
|
|
54
|
-
--app-color-verified: light-dark(#176b36, #82cf95);
|
|
55
|
-
--app-color-verified-soft: light-dark(#edf5ed, #1d2c20);
|
|
56
|
-
--app-color-unverified: light-dark(#855700, #dfb26c);
|
|
57
|
-
--app-color-unverified-soft: light-dark(#faf2df, #30291c);
|
|
58
|
-
|
|
59
|
-
/*
|
|
60
|
-
* 내장 글꼴 · CLI는 @font-face와 자원 URL 생성
|
|
61
|
-
* 본문·라벨·인라인 코드 한글 IBM Plex Sans KR·영문 Monoplex KR · 코드 블록·흐름도 Monoplex KR · 사이트 이름 Architects Daughter
|
|
62
|
-
* 영문 폭 0.528em = 흐름도 12px 격자의 6.336px · 코드 블록·흐름도의 한글은 정확히 2칸
|
|
63
|
-
* 본문 맨 앞의 IBM Plex Sans KR은 한글 unicode-range만 담당 · 영문·숫자·기호는 다음 순서의 Monoplex KR
|
|
64
|
-
*/
|
|
65
|
-
--app-font-mono: "Monoplex KR", ui-monospace, monospace;
|
|
66
|
-
--app-font-body: "IBM Plex Sans KR", var(--app-font-mono);
|
|
67
|
-
--app-font-brand: "Architects Daughter", var(--app-font-body);
|
|
68
|
-
|
|
69
|
-
/* 글자 크기 · 11px 비상호작용 묶음 · 12px 기본과 역할별 제목 크기 */
|
|
70
|
-
--app-font-size-group: 11px;
|
|
71
|
-
--app-font-size-detail: 12px;
|
|
72
|
-
--app-font-size-dense: 12px;
|
|
73
|
-
--app-font-size-body: 12px;
|
|
74
|
-
--app-font-size-lead: 12px;
|
|
75
|
-
--app-font-size-part: 13px;
|
|
76
|
-
--app-font-size-section: 15px;
|
|
77
|
-
--app-font-size-title: 16px;
|
|
78
|
-
|
|
79
|
-
/* 굵기 · 기본 400 · 현재 위치·제목·강조 600 */
|
|
80
|
-
--app-font-weight-mark: 400;
|
|
81
|
-
--app-font-weight-active: 600;
|
|
82
|
-
--app-font-weight-strong: 600;
|
|
83
|
-
--app-font-weight-title: 600;
|
|
84
|
-
|
|
85
|
-
/* 행간 · 작은 제목·탐색은 1.4, 본문은 한글 획 사이 여유 확보 */
|
|
86
|
-
--app-line-height-title: 1.5;
|
|
87
|
-
--app-line-height-heading: 1.5;
|
|
88
|
-
--app-line-height-tight: 1.4;
|
|
89
|
-
--app-line-height-code: 1.65;
|
|
90
|
-
--app-line-height-body: 1.7;
|
|
91
|
-
|
|
92
|
-
/* 자간 · 본문·라벨·인라인 코드를 조이고 제목은 그보다 조금 더 · 사이트 이름은 기본 폭 · 코드 블록·흐름도는 격자를 위해 0 */
|
|
93
|
-
--app-letter-spacing-body: -0.03em;
|
|
94
|
-
--app-letter-spacing-brand: 0;
|
|
95
|
-
--app-letter-spacing-heading: -0.04em;
|
|
96
|
-
--app-letter-spacing-title: -0.045em;
|
|
97
|
-
|
|
98
|
-
/* 공통 간격 · margin·padding·gap의 리듬 · 단독 보정은 지역 값 */
|
|
99
|
-
--app-space-inline: 6px;
|
|
100
|
-
--app-space-stack: 10px;
|
|
101
|
-
--app-space-block: 14px;
|
|
102
|
-
--app-space-group: 20px;
|
|
103
|
-
--app-space-subsection: 28px;
|
|
104
|
-
--app-space-section: 64px;
|
|
105
|
-
|
|
106
|
-
/* 탐색 트리 · 항목 위아래 여백·묶음 사이·묶음 라벨 아래·중첩 들여쓰기 */
|
|
107
|
-
--app-space-tree-row: 0px;
|
|
108
|
-
--app-space-tree-group: 16px;
|
|
109
|
-
--app-space-tree-label: 2px;
|
|
110
|
-
--app-space-tree-indent: 12px;
|
|
111
|
-
|
|
112
|
-
/* 페이지 틀 · 좁은 화면 값은 아래 @media */
|
|
113
|
-
--app-space-page-top: 28px;
|
|
114
|
-
--app-space-gutter: 28px;
|
|
115
|
-
--app-space-column: 32px;
|
|
116
|
-
--app-space-sidebar-gap: 32px;
|
|
117
|
-
--app-size-sidebar: 200px;
|
|
118
|
-
|
|
119
|
-
/* 페이지 최대 폭 · 본문은 사이드바·간격을 뺀 나머지 전체 */
|
|
120
|
-
--app-size-page: 1920px;
|
|
121
|
-
--app-size-brand: calc(var(--app-font-size-title) * var(--app-line-height-title) + var(--app-space-page-top) + var(--app-space-group));
|
|
122
|
-
--app-size-mobile-header: 56px;
|
|
123
|
-
--app-size-menu-button: 44px;
|
|
124
|
-
--app-size-drawer: 320px;
|
|
125
|
-
--app-size-navigation-fade: 28px;
|
|
126
|
-
|
|
127
|
-
/* 화면 위쪽 제목 여백 · hash 도착점과 목차 읽는 선의 공통 기준 */
|
|
128
|
-
--app-space-anchor: 80px;
|
|
129
|
-
|
|
130
|
-
/* 모서리 · 직각 기본값 */
|
|
131
|
-
--app-radius-pill: 0;
|
|
132
|
-
--app-radius-card: 0;
|
|
133
|
-
--app-radius-box: 0;
|
|
134
|
-
--app-radius-inline: 0;
|
|
135
|
-
--app-radius-mark: 0;
|
|
136
|
-
|
|
137
|
-
/* 키보드 포커스 표시 */
|
|
138
|
-
--app-outline-focus: 2px solid var(--app-color-link);
|
|
139
|
-
--app-outline-focus-offset: 2px;
|
|
140
|
-
|
|
141
|
-
/* 사이드바 사이트 이름 · 커서 장식 */
|
|
142
|
-
--app-z-index-sticky: 100;
|
|
143
|
-
--app-z-index-popper: 300;
|
|
144
|
-
|
|
145
|
-
/*
|
|
146
|
-
* Shiki CSS 변수 · 기존 역할색 재사용
|
|
147
|
-
* 키워드 strong · 함수 accent
|
|
148
|
-
*/
|
|
149
|
-
--app-code-foreground: var(--app-color-text);
|
|
150
|
-
--app-code-background: var(--app-color-code);
|
|
151
|
-
--app-code-token-keyword: var(--app-color-text-strong);
|
|
152
|
-
--app-code-token-function: var(--app-color-accent);
|
|
153
|
-
--app-code-token-string: var(--app-color-verified);
|
|
154
|
-
--app-code-token-string-expression: var(--app-color-verified);
|
|
155
|
-
--app-code-token-constant: var(--app-color-unverified);
|
|
156
|
-
--app-code-token-parameter: var(--app-color-text);
|
|
157
|
-
--app-code-token-comment: var(--app-color-text-muted);
|
|
158
|
-
--app-code-token-punctuation: var(--app-color-text-muted);
|
|
159
|
-
--app-code-token-link: var(--app-color-link);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/* 폭 조건 · shell의 breakpoint와 일치 */
|
|
163
|
-
@media (width < 1024px) {
|
|
164
|
-
:root {
|
|
165
|
-
--app-space-page-top: 24px;
|
|
166
|
-
--app-space-gutter: 20px;
|
|
167
|
-
--app-space-tree-row: 7px;
|
|
168
|
-
--app-space-anchor: calc(var(--app-size-mobile-header) + var(--app-space-block));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
@media (width < 640px) {
|
|
173
|
-
:root {
|
|
174
|
-
--app-space-page-top: 20px;
|
|
175
|
-
--app-space-gutter: 16px;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/* 블록 색 · 펜스 메타 bad·good · Shiki 가 pre 에 인라인으로 쓰는 코드 바탕을 바꿈 */
|
|
180
|
-
.wg_prose__code--bad {
|
|
181
|
-
--app-code-background: var(--app-color-bad-soft);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.wg_prose__code--good {
|
|
185
|
-
--app-code-background: var(--app-color-good-soft);
|
|
186
|
-
}
|
package/src/type/doc-content.ts
DELETED
package/src/type/doc-data.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {z} from "zod";
|
|
2
|
-
import {doc_order_default, doc_type} from "@/constant/doc";
|
|
3
|
-
import {groupPathSchema} from "@/type/group-path";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 문서 frontmatter 스키마 · 검증 실패 시 빌드 중단
|
|
7
|
-
*/
|
|
8
|
-
export const docDataSchema = z.object({
|
|
9
|
-
/**
|
|
10
|
-
* 문서 이름 · 제목·목록 · 같은 첫 글자 허용
|
|
11
|
-
*/
|
|
12
|
-
name: z.string().trim().min(1),
|
|
13
|
-
/**
|
|
14
|
-
* 짧은 문서 설명 · 사이드바 툴팁
|
|
15
|
-
*/
|
|
16
|
-
label: z.string(),
|
|
17
|
-
/**
|
|
18
|
-
* 기존 type 값 호환 · 생략 권장, 렌더링 차이 없음
|
|
19
|
-
*/
|
|
20
|
-
type: z.enum(doc_type).default(doc_type.document),
|
|
21
|
-
/**
|
|
22
|
-
* 사이드바의 문서 묶음 경로 · 문자열도 배열로 정규화
|
|
23
|
-
*/
|
|
24
|
-
group: groupPathSchema,
|
|
25
|
-
/**
|
|
26
|
-
* 같은 묶음 안의 부모 문서 id · 확장자 제외, ./·../ 상대 경로도 허용
|
|
27
|
-
*/
|
|
28
|
-
parent: z.string().trim().min(1).optional(),
|
|
29
|
-
/**
|
|
30
|
-
* 묶음 안의 읽는 순서 · 미지정 문서는 뒤에서 이름순
|
|
31
|
-
*/
|
|
32
|
-
order: z.number().int().nonnegative().default(doc_order_default),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 기본값을 적용한 문서 frontmatter
|
|
37
|
-
*/
|
|
38
|
-
export type DocData = z.infer<typeof docDataSchema>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type {DocData} from "@/type/doc-data";
|
|
2
|
-
import type {DocHeading} from "@/type/doc-heading";
|
|
3
|
-
import type {DocSection} from "@/type/doc-section";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 문서 처리 중간 계약 · read-docs의 머리말과 rehype의 제목·절 정보
|
|
7
|
-
*/
|
|
8
|
-
export interface DocFileData {
|
|
9
|
-
/**
|
|
10
|
-
* 일반 문서의 검증된 머리말 · README 홈은 생략
|
|
11
|
-
*/
|
|
12
|
-
frontmatter?: DocData;
|
|
13
|
-
/**
|
|
14
|
-
* 작성한 제목 · 문서 순서
|
|
15
|
-
*/
|
|
16
|
-
headings: DocHeading[];
|
|
17
|
-
/**
|
|
18
|
-
* 제목별 가름 · headings의 h2·h3 순서와 일치
|
|
19
|
-
*/
|
|
20
|
-
sections: DocSection[];
|
|
21
|
-
}
|
package/src/type/doc-heading.ts
DELETED
package/src/type/doc-outline.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type {DocHeading} from "@/type/doc-heading";
|
|
2
|
-
import type {DocSection} from "@/type/doc-section";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 문서 렌더링 결과의 목차 입력
|
|
6
|
-
*/
|
|
7
|
-
export interface DocOutline {
|
|
8
|
-
/**
|
|
9
|
-
* 작성한 제목의 id와 텍스트 · 문서 순서
|
|
10
|
-
*/
|
|
11
|
-
headings: DocHeading[];
|
|
12
|
-
/**
|
|
13
|
-
* 제목별 가름 · headings의 h2·h3 순서와 일치
|
|
14
|
-
*/
|
|
15
|
-
sections: DocSection[];
|
|
16
|
-
}
|
package/src/type/doc-section.ts
DELETED
package/src/type/doc.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type {DocContent} from "@/type/doc-content";
|
|
2
|
-
import type {DocData} from "@/type/doc-data";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Markdown 파일 하나의 렌더링 결과
|
|
6
|
-
*/
|
|
7
|
-
export interface Doc extends DocContent {
|
|
8
|
-
/**
|
|
9
|
-
* 문서 URL id · 확장자 제외 소문자 경로 · 하위 폴더 포함
|
|
10
|
-
*/
|
|
11
|
-
id: string;
|
|
12
|
-
/**
|
|
13
|
-
* 검증된 머리말
|
|
14
|
-
*/
|
|
15
|
-
data: DocData;
|
|
16
|
-
/**
|
|
17
|
-
* 검증된 부모 문서 경로 · 최상위부터 직접 부모까지, 자신은 제외
|
|
18
|
-
*/
|
|
19
|
-
ancestors: string[];
|
|
20
|
-
}
|
package/src/type/group-path.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import {z} from "zod";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 탐색 묶음 경로 · 기존 단일 이름과 중첩 배열을 한 번만 정규화
|
|
5
|
-
* 쉼표·슬래시는 이름 그대로 유지하며 빈 경로·단계는 거부
|
|
6
|
-
*/
|
|
7
|
-
export const groupPathSchema = z.union([z.string().trim().min(1), z.array(z.string().trim().min(1)).min(1)]).transform((path) => (typeof path === "string" ? [path] : path));
|
package/src/type/site-assets.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 모든 페이지가 공유하는 HTML 머리 자원
|
|
3
|
-
*/
|
|
4
|
-
export interface SiteAssets {
|
|
5
|
-
/**
|
|
6
|
-
* 내용 지문으로 구분한 스타일시트 URL
|
|
7
|
-
*/
|
|
8
|
-
stylePath: string;
|
|
9
|
-
/**
|
|
10
|
-
* 셸 DOM 뒤에서 동기 실행할 단일 Hono JSX 브라우저 번들
|
|
11
|
-
*/
|
|
12
|
-
browserScript: string;
|
|
13
|
-
/**
|
|
14
|
-
* 내장 @font-face · head의 style 내용
|
|
15
|
-
*/
|
|
16
|
-
fontCss: string;
|
|
17
|
-
/**
|
|
18
|
-
* 선요청 글꼴 URL · 사이트 이름·본문 공통 조각·코드
|
|
19
|
-
*/
|
|
20
|
-
preload: string[];
|
|
21
|
-
/**
|
|
22
|
-
* dev 전용 문서 새로고침 스크립트 포함 여부
|
|
23
|
-
*/
|
|
24
|
-
reload: boolean;
|
|
25
|
-
}
|
package/src/type/site-config.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import {z} from "zod";
|
|
2
|
-
import {copy_error_navigation_clash, copy_error_site_url, copy_site_title_default} from "@/constant/copy";
|
|
3
|
-
import {site_navigation_default, site_port_default, site_port_max, site_port_min} from "@/constant/site";
|
|
4
|
-
import {status_default_phrases, status_kind} from "@/constant/status";
|
|
5
|
-
import {groupPathSchema} from "@/type/group-path";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* for-humanity.config.mjs 설정 스키마
|
|
9
|
-
* 명령 시작 시 검증과 기본값 적용 · 앱은 검증 결과만 사용
|
|
10
|
-
*/
|
|
11
|
-
export const siteConfigSchema = z.object({
|
|
12
|
-
/**
|
|
13
|
-
* 사이드바 이름과 탭 제목
|
|
14
|
-
*/
|
|
15
|
-
title: z.string().default(copy_site_title_default),
|
|
16
|
-
/**
|
|
17
|
-
* HTML 설명 메타데이터 · 선택
|
|
18
|
-
*/
|
|
19
|
-
description: z.string().optional(),
|
|
20
|
-
/**
|
|
21
|
-
* 공개 사이트 루트 URL · 지정할 때만 robots.txt와 sitemap.xml 생성
|
|
22
|
-
*/
|
|
23
|
-
url: z
|
|
24
|
-
.url({protocol: /^https?$/})
|
|
25
|
-
.transform((value) => new URL(value))
|
|
26
|
-
.refine((value) => value.username === "" && value.password === "" && value.pathname === "/" && value.search === "" && value.hash === "", copy_error_site_url)
|
|
27
|
-
.transform((value) => value.origin)
|
|
28
|
-
.optional(),
|
|
29
|
-
/**
|
|
30
|
-
* dev·preview 서버 포트 · 같은 기계에서 문서 프로젝트 둘을 나란히 띄울 때 한쪽에 지정
|
|
31
|
-
*/
|
|
32
|
-
port: z.int().min(site_port_min).max(site_port_max).default(site_port_default),
|
|
33
|
-
/**
|
|
34
|
-
* 데스크톱 커서 옆 픽셀 얼굴 · 기본 꺼짐 · favicon 은 설정과 무관
|
|
35
|
-
*/
|
|
36
|
-
cursorFace: z.boolean().default(false),
|
|
37
|
-
/**
|
|
38
|
-
* 탐색 묶음 경로의 읽는 순서 · 미지정 형제 묶음은 뒤에서 이름순
|
|
39
|
-
*/
|
|
40
|
-
navigation: z
|
|
41
|
-
.array(groupPathSchema)
|
|
42
|
-
.refine((groups) => new Set(groups.map((path) => JSON.stringify(path))).size === groups.length, copy_error_navigation_clash)
|
|
43
|
-
.default(site_navigation_default.map((name) => [name])),
|
|
44
|
-
/**
|
|
45
|
-
* 본문에서 상태 표지로 표시할 문구
|
|
46
|
-
*/
|
|
47
|
-
status: z
|
|
48
|
-
.array(
|
|
49
|
-
z.object({
|
|
50
|
-
/**
|
|
51
|
-
* 찾을 문구 원문
|
|
52
|
-
*/
|
|
53
|
-
phrase: z
|
|
54
|
-
.string()
|
|
55
|
-
.min(1)
|
|
56
|
-
.refine((phrase) => phrase.trim().length > 0),
|
|
57
|
-
/**
|
|
58
|
-
* 상태 표지의 색 종류
|
|
59
|
-
*/
|
|
60
|
-
kind: z.enum(status_kind),
|
|
61
|
-
/**
|
|
62
|
-
* 문구 뒤의 YYYY-MM-DD 날짜 포함 여부
|
|
63
|
-
*/
|
|
64
|
-
date: z.boolean().optional(),
|
|
65
|
-
}),
|
|
66
|
-
)
|
|
67
|
-
.default(status_default_phrases),
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 기본값을 적용한 사이트 설정
|
|
72
|
-
*/
|
|
73
|
-
export type SiteConfig = z.infer<typeof siteConfigSchema>;
|
package/src/type/vfile-data.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import {test} from "node:test";
|
|
3
|
-
import {toChangeQueue} from "@/util/async/to-change-queue";
|
|
4
|
-
|
|
5
|
-
test("coalesces changes during an active render and never overlaps work", async () => {
|
|
6
|
-
const gate = Promise.withResolvers<void>();
|
|
7
|
-
const renders: number[] = [];
|
|
8
|
-
const errors: unknown[] = [];
|
|
9
|
-
let version = 1;
|
|
10
|
-
let running = 0;
|
|
11
|
-
const queue = toChangeQueue({
|
|
12
|
-
run: async () => {
|
|
13
|
-
running += 1;
|
|
14
|
-
assert.equal(running, 1);
|
|
15
|
-
const current = version;
|
|
16
|
-
if (current === 1) await gate.promise;
|
|
17
|
-
renders.push(current);
|
|
18
|
-
running -= 1;
|
|
19
|
-
},
|
|
20
|
-
onError: (error) => errors.push(error),
|
|
21
|
-
});
|
|
22
|
-
const first = queue();
|
|
23
|
-
for (const next of [2, 3, 4, 5]) {
|
|
24
|
-
version = next;
|
|
25
|
-
await queue();
|
|
26
|
-
}
|
|
27
|
-
gate.resolve();
|
|
28
|
-
await first;
|
|
29
|
-
assert.deepEqual(renders, [1, 5]);
|
|
30
|
-
assert.deepEqual(errors, []);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test("a failed render does not lose a queued recovery or block later edits", async () => {
|
|
34
|
-
const gate = Promise.withResolvers<void>();
|
|
35
|
-
const errors: unknown[] = [];
|
|
36
|
-
const renders: number[] = [];
|
|
37
|
-
let version = 1;
|
|
38
|
-
const queue = toChangeQueue({
|
|
39
|
-
run: async () => {
|
|
40
|
-
const current = version;
|
|
41
|
-
if (current === 1) {
|
|
42
|
-
await gate.promise;
|
|
43
|
-
throw new Error("Invalid source");
|
|
44
|
-
}
|
|
45
|
-
renders.push(current);
|
|
46
|
-
},
|
|
47
|
-
onError: (error) => errors.push(error),
|
|
48
|
-
});
|
|
49
|
-
const first = queue();
|
|
50
|
-
version = 2;
|
|
51
|
-
await queue();
|
|
52
|
-
gate.resolve();
|
|
53
|
-
await first;
|
|
54
|
-
version = 3;
|
|
55
|
-
await queue();
|
|
56
|
-
assert.deepEqual(renders, [2, 3]);
|
|
57
|
-
assert.equal(errors.length, 1);
|
|
58
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 변경 재처리의 실행과 오류 보고 계약
|
|
3
|
-
*/
|
|
4
|
-
export interface ChangeQueueOptions {
|
|
5
|
-
/**
|
|
6
|
-
* 한 번의 최신 입력 처리 · 이전 실행이 끝난 뒤 호출
|
|
7
|
-
*/
|
|
8
|
-
run: () => Promise<void>;
|
|
9
|
-
/**
|
|
10
|
-
* 실패 보고 · 대기 중인 변경과 다음 실행은 유지
|
|
11
|
-
*/
|
|
12
|
-
onError: (error: unknown) => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 동시에 하나만 실행하는 변경 요청 함수 · 실행 중 요청은 다음 한 번으로 합침
|
|
17
|
-
* 활성 실행의 반환 Promise는 대기 요청까지 끝나면 완료, 중첩 요청은 즉시 반환
|
|
18
|
-
*/
|
|
19
|
-
export const toChangeQueue = (options: ChangeQueueOptions) => {
|
|
20
|
-
const state = {requested: 0, completed: 0, running: false};
|
|
21
|
-
|
|
22
|
-
return async () => {
|
|
23
|
-
state.requested += 1;
|
|
24
|
-
if (state.running) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
state.running = true;
|
|
28
|
-
try {
|
|
29
|
-
while (state.completed !== state.requested) {
|
|
30
|
-
const requested = state.requested;
|
|
31
|
-
try {
|
|
32
|
-
await options.run();
|
|
33
|
-
} catch (error) {
|
|
34
|
-
options.onError(error);
|
|
35
|
-
} finally {
|
|
36
|
-
state.completed = requested;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
} finally {
|
|
40
|
-
state.running = false;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* URL hash 대상 · 한국어 제목의 percent encoding 해석
|
|
3
|
-
*/
|
|
4
|
-
export const findHashTarget = (hash: string): HTMLElement | null => {
|
|
5
|
-
if (!hash) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
return document.getElementById(decodeURIComponent(hash.slice(1)));
|
|
11
|
-
} catch (error) {
|
|
12
|
-
if (error instanceof URIError) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
throw error;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {findHashTarget} from "@/util/dom/find-hash-target";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 접힌 내용의 hash 대상과 상위 Details 공개
|
|
5
|
-
* 초기 접속·문서 안 링크·hash 변경에 동일 적용
|
|
6
|
-
*/
|
|
7
|
-
export const revealHashTarget = (hash: string): HTMLElement | null => {
|
|
8
|
-
const target = findHashTarget(hash);
|
|
9
|
-
|
|
10
|
-
for (let fold = target?.closest("details"); fold; fold = fold.parentElement?.closest("details")) {
|
|
11
|
-
fold.open = true;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI·dev 공통 오류 문구 · 문법 오류의 파일과 줄 번호 포함
|
|
3
|
-
*/
|
|
4
|
-
export const toErrorMessage = (error: unknown): string => {
|
|
5
|
-
if (error instanceof Error && "file" in error && typeof error.file === "string" && "line" in error && typeof error.line === "number") {
|
|
6
|
-
return `${error.file}:${error.line}: ${error.message}`;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return error instanceof Error ? error.message : String(error);
|
|
10
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {createHash} from "node:crypto";
|
|
2
|
-
import {readFileSync} from "node:fs";
|
|
3
|
-
import {posix} from "node:path";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 파일 내용으로 자원 URL을 구분하는 입력
|
|
7
|
-
*/
|
|
8
|
-
export interface AssetPathOptions {
|
|
9
|
-
/**
|
|
10
|
-
* 사이트 루트 기준 기본 자원 경로
|
|
11
|
-
*/
|
|
12
|
-
path: string;
|
|
13
|
-
/**
|
|
14
|
-
* 배포할 실제 파일 경로
|
|
15
|
-
*/
|
|
16
|
-
file: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 파일명에 내용 지문 추가 · 같은 내용은 같은 URL, 변경한 내용은 새 캐시 키 사용
|
|
21
|
-
*/
|
|
22
|
-
export const toAssetPath = (options: AssetPathOptions) => {
|
|
23
|
-
const extension = posix.extname(options.path);
|
|
24
|
-
|
|
25
|
-
return `${posix.dirname(options.path)}/${posix.basename(options.path, extension)}.${createHash("sha256").update(readFileSync(options.file)).digest("hex")}${extension}`;
|
|
26
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import {mkdtempSync, rmSync, writeFileSync} from "node:fs";
|
|
3
|
-
import {tmpdir} from "node:os";
|
|
4
|
-
import {join} from "node:path";
|
|
5
|
-
import {test} from "node:test";
|
|
6
|
-
import {asset_font_dir} from "@/constant/asset";
|
|
7
|
-
import {font_body_css, font_brand_css, font_mono_css} from "@/constant/font";
|
|
8
|
-
import {toFontCss} from "@/util/font/to-font-css";
|
|
9
|
-
|
|
10
|
-
test("bundled fonts prevent a late swap after fallback text is visible", () => {
|
|
11
|
-
for (const css of [font_mono_css, font_body_css, font_brand_css]) {
|
|
12
|
-
const result = toFontCss({css: join(process.cwd(), css), fontDir: asset_font_dir});
|
|
13
|
-
|
|
14
|
-
assert.match(result.css, /font-display:\s*optional;/);
|
|
15
|
-
assert.doesNotMatch(result.css, /font-display:\s*swap;/);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test("font URLs stay stable for unchanged bytes and change when the font changes", (t) => {
|
|
20
|
-
const root = mkdtempSync(join(tmpdir(), "for-humanity-font-"));
|
|
21
|
-
const file = join(root, "example.woff2");
|
|
22
|
-
const css = join(root, "font.css");
|
|
23
|
-
|
|
24
|
-
t.after(() => rmSync(root, {recursive: true, force: true}));
|
|
25
|
-
writeFileSync(css, "@font-face { font-family: Example; font-display: swap; src: url(./example.woff2); }");
|
|
26
|
-
writeFileSync(file, "first font bytes");
|
|
27
|
-
|
|
28
|
-
const first = toFontCss({css, fontDir: asset_font_dir});
|
|
29
|
-
const repeated = toFontCss({css, fontDir: asset_font_dir});
|
|
30
|
-
|
|
31
|
-
assert.deepEqual([...first.files], [...repeated.files]);
|
|
32
|
-
assert.match(first.css, /example\.[a-f0-9]+\.woff2/);
|
|
33
|
-
assert.deepEqual([...first.files.values()], [file]);
|
|
34
|
-
|
|
35
|
-
writeFileSync(file, "changed font bytes");
|
|
36
|
-
|
|
37
|
-
const changed = toFontCss({css, fontDir: asset_font_dir});
|
|
38
|
-
|
|
39
|
-
assert.notDeepEqual([...first.files.keys()], [...changed.files.keys()]);
|
|
40
|
-
assert.notEqual(first.css, changed.css);
|
|
41
|
-
});
|