From d482f4c74b3d6b7ace2899db75b428084a74d2b8 Mon Sep 17 00:00:00 2001 From: konojunya Date: Sun, 6 Sep 2026 12:22:00 +0900 Subject: [PATCH] Expand built-in documentation examples in an accessible dialog --- README.md | 2 +- .../theme/components/ExampleGallery.vue | 44 +----- .../theme/components/ExampleLightbox.vue | 56 +++++++ .../theme/components/ExamplePreview.vue | 25 ++- docs/.vitepress/theme/style.css | 145 +++++++++++------- scripts/docs-source.json | 4 +- scripts/image-dialog.mjs | 31 ++++ scripts/image-dialog.test.mjs | 77 ++++++++++ scripts/runtime-examples.test.mjs | 15 ++ scripts/validate-docs-output.mjs | 16 +- 10 files changed, 311 insertions(+), 104 deletions(-) create mode 100644 docs/.vitepress/theme/components/ExampleLightbox.vue create mode 100644 scripts/image-dialog.mjs create mode 100644 scripts/image-dialog.test.mjs diff --git a/README.md b/README.md index 02e2f9b..74d262a 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ Authentication, persistence, collaboration, and paid themes remain outside this The editor keeps a native textarea as the input surface and layers Shiki presentation behind it. Highlighting consumes the raw `@stack-sh/language/grammar` export and does not determine whether source is valid. The Web-owned Shiki themes map grammar scopes to accessible light and dark colors. Validation and diagnostic guidance continue to come only from `@stack-sh/engine`. -Language intelligence runs locally through `@stack-sh/engine` 0.7.0 WebAssembly; it does not start an LSP server or send source to a server. Suggestions follow typing or `Ctrl Space`; use arrow keys to choose, `Enter` or `Tab` to accept, and `Escape` to dismiss. The Context panel follows the caret or pointer. Imported provider packs supply their icon catalog to the same engine APIs. The adapter converts browser UTF-16 selections to engine source positions, rejects stale document results, and suspends completion during IME composition. Diagnostics and preview refresh from the same source snapshot after editing, while explicit actions remain available. +Language intelligence runs locally through the pinned `@stack-sh/engine` WebAssembly package; it does not start an LSP server or send source to a server. Suggestions follow typing or `Ctrl Space`; use arrow keys to choose, `Enter` or `Tab` to accept, and `Escape` to dismiss. The Context panel follows the caret or pointer. Imported provider packs supply their icon catalog to the same engine APIs. The adapter converts browser UTF-16 selections to engine source positions, rejects stale document results, and suspends completion during IME composition. Diagnostics and preview refresh from the same source snapshot after editing, while explicit actions remain available. ## License diff --git a/docs/.vitepress/theme/components/ExampleGallery.vue b/docs/.vitepress/theme/components/ExampleGallery.vue index 356d142..ee74dbd 100644 --- a/docs/.vitepress/theme/components/ExampleGallery.vue +++ b/docs/.vitepress/theme/components/ExampleGallery.vue @@ -12,57 +12,39 @@ const stages: LearningStage[] = ["starter", "intermediate", "advanced"] const labels = { en: { stage: { starter: "Start small", intermediate: "Build fluency", advanced: "Model systems" }, - packs: "Icon packs", - core: "Built-in icons", - expected: "Expected output", structure: { nodes: "nodes", groups: "groups", edges: "edges" }, - features: "Syntax features", source: "View canonical .stack source", contract: "Pinned source", }, ja: { stage: { starter: "小さく始める", intermediate: "表現を広げる", advanced: "Systemを描く" }, - packs: "Icon pack", - core: "組み込みicon", - expected: "期待する出力", structure: { nodes: "node", groups: "group", edges: "edge" }, - features: "Syntax feature", source: "Canonical .stack sourceを見る", contract: "Pin済みsource", }, zh: { stage: { starter: "从小处开始", intermediate: "扩展表达", advanced: "描述系统" }, - packs: "图标包", - core: "内置图标", - expected: "预期输出", structure: { nodes: "节点", groups: "分组", edges: "连线" }, - features: "语法特性", source: "查看规范 .stack 源码", contract: "固定源版本", }, ko: { stage: { starter: "작게 시작하기", intermediate: "표현 넓히기", advanced: "시스템 모델링" }, - packs: "아이콘 팩", - core: "기본 아이콘", - expected: "예상 출력", structure: { nodes: "노드", groups: "그룹", edges: "엣지" }, - features: "문법 기능", source: "Canonical .stack 소스 보기", contract: "고정된 소스", }, } as const function examplesFor(stage: LearningStage) { - return corpus.examples.filter((example) => example.learningStage === stage) + return corpus.examples.filter( + (example) => example.learningStage === stage && example.providers.length === 0, + ) } function sourceUrl(source: string) { return `https://raw.githubusercontent.com/${exampleCorpusSource.repository}/${exampleCorpusSource.revision}/examples/${source}` } - -function featureLabel(feature: string) { - return feature.replaceAll("-", " ") -}