├── .npmrc ├── packages ├── kitbook │ ├── .npmrc │ ├── .gitignore │ ├── .npmignore │ ├── src │ │ ├── lib │ │ │ ├── viewer │ │ │ │ ├── EdgeDraggable.md │ │ │ │ ├── focused │ │ │ │ │ ├── editor │ │ │ │ │ │ ├── ts │ │ │ │ │ │ │ ├── types.ts │ │ │ │ │ │ │ ├── autocomplete │ │ │ │ │ │ │ │ ├── ensureAnchor.ts │ │ │ │ │ │ │ │ └── symbols.ts │ │ │ │ │ │ │ ├── sync.ts │ │ │ │ │ │ │ └── linter.ts │ │ │ │ │ │ ├── CodeMirror.md │ │ │ │ │ │ ├── CodeMirror.variants.ts │ │ │ │ │ │ └── getComponentPropsType.ts │ │ │ │ │ ├── active.ts │ │ │ │ │ ├── Tabs.svelte │ │ │ │ │ ├── DocumentInPicture.onMount.composition │ │ │ │ │ ├── DocumentInPicture.md │ │ │ │ │ ├── Props.variants.ts │ │ │ │ │ ├── DocumentInPicture.composition │ │ │ │ │ └── LoadVariants.svelte │ │ │ │ ├── EdgeDraggable.composition │ │ │ │ ├── ConnectToTools.md │ │ │ │ ├── Viewer.md │ │ │ │ ├── tree │ │ │ │ │ ├── Element.svelte │ │ │ │ │ └── Tree.svelte │ │ │ │ ├── Viewer.variants.ts │ │ │ │ ├── load-viewer.ts │ │ │ │ └── ConnectToTools.variants2.ts │ │ │ ├── routes │ │ │ │ ├── [...file] │ │ │ │ │ ├── mockComponents │ │ │ │ │ │ ├── Hi.svelte │ │ │ │ │ │ ├── Hi.md │ │ │ │ │ │ └── Hi.variants.ts │ │ │ │ │ ├── Routes.md │ │ │ │ │ ├── +page.ts │ │ │ │ │ ├── MainPage.md │ │ │ │ │ ├── frame │ │ │ │ │ │ ├── sidebar │ │ │ │ │ │ │ ├── Sidebar.md │ │ │ │ │ │ │ ├── Page.variants.ts │ │ │ │ │ │ │ ├── Sidebar.variants.ts │ │ │ │ │ │ │ ├── Folder.variants.ts │ │ │ │ │ │ │ ├── Header.variants.ts │ │ │ │ │ │ │ ├── Page.svelte │ │ │ │ │ │ │ └── Header.svelte │ │ │ │ │ │ ├── frame.css │ │ │ │ │ │ ├── Frame.variants.ts │ │ │ │ │ │ ├── parseUpdatedPath.ts │ │ │ │ │ │ └── FramePanes.svelte │ │ │ │ │ ├── +page.svelte │ │ │ │ │ ├── Routes.svelte │ │ │ │ │ ├── Routes.variants.ts │ │ │ │ │ └── relative-names.ts │ │ │ │ ├── sandbox │ │ │ │ │ └── [...file] │ │ │ │ │ │ ├── +page.ts │ │ │ │ │ │ ├── mockComponents │ │ │ │ │ │ ├── IndividualComponent.svelte │ │ │ │ │ │ ├── NeedsPropsToNotError.svelte │ │ │ │ │ │ └── NeedsPropsToNotError.variants.ts │ │ │ │ │ │ ├── SandboxPage.md │ │ │ │ │ │ ├── +page.svelte │ │ │ │ │ │ ├── Composition.svelte │ │ │ │ │ │ ├── SandboxPage.variants.ts │ │ │ │ │ │ ├── SandboxPage.svelte │ │ │ │ │ │ └── Variant.svelte │ │ │ │ ├── tools │ │ │ │ │ ├── +page.svelte │ │ │ │ │ ├── Tools.variants.ts │ │ │ │ │ ├── _page.md │ │ │ │ │ └── ToolsPage.svelte │ │ │ │ ├── layoutLoad.ts │ │ │ │ └── +layout.ts │ │ │ ├── plugins │ │ │ │ ├── main │ │ │ │ │ ├── markdown │ │ │ │ │ │ ├── cases │ │ │ │ │ │ │ ├── js.md │ │ │ │ │ │ │ ├── twoslash.md │ │ │ │ │ │ │ ├── toc.md │ │ │ │ │ │ │ ├── index.md │ │ │ │ │ │ │ ├── link.md │ │ │ │ │ │ │ ├── js.html │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ ├── toc.html │ │ │ │ │ │ │ ├── twoslash.html │ │ │ │ │ │ │ ├── gfm.md │ │ │ │ │ │ │ └── link.html │ │ │ │ │ │ ├── markdownToHtml.test.ts │ │ │ │ │ │ ├── remarkHighlighter.ts │ │ │ │ │ │ └── markdownToHtml.ts │ │ │ │ │ ├── kitbook-virtual-module.d.ts │ │ │ │ │ └── modifyViteConfigForKitbook.ts │ │ │ │ ├── utils │ │ │ │ │ ├── colors.ts │ │ │ │ │ └── immutableDeepMerge.ts │ │ │ │ ├── virtual │ │ │ │ │ ├── Template.svelte │ │ │ │ │ └── Template.variants.ts.txt │ │ │ │ ├── rpc │ │ │ │ │ ├── get-sfc-list.ts │ │ │ │ │ ├── get-svelte-modules.ts │ │ │ │ │ └── rpc.plugin.ts │ │ │ │ ├── context │ │ │ │ │ ├── copy-kitbook-routes.test.ts │ │ │ │ │ └── merge-user-settings-with-defaults.ts │ │ │ │ ├── constants.ts │ │ │ │ └── vite.ts │ │ │ ├── defineConfig.ts │ │ │ ├── modules │ │ │ │ ├── hmrUpdatedModules.ts │ │ │ │ ├── parseModules │ │ │ │ │ ├── utils │ │ │ │ │ │ └── removeInitialDigitAndHyphens.ts │ │ │ │ │ ├── putPagesIntoFolders.test.ts │ │ │ │ │ ├── putPagesIntoFolders.ts │ │ │ │ │ └── groupColocatedModulesIntoPages.ts │ │ │ │ └── rpc-client.ts │ │ │ ├── components │ │ │ │ ├── errorBoundary │ │ │ │ │ ├── ErrorBoundary.ts │ │ │ │ │ ├── CustomErrorBoundary.svelte │ │ │ │ │ └── createBoundary.ts │ │ │ │ ├── search │ │ │ │ │ ├── SearchResult.md │ │ │ │ │ ├── LaunchSearch.svelte │ │ │ │ │ ├── SearchModal.variants.ts │ │ │ │ │ ├── SearchResult.svelte │ │ │ │ │ ├── SearchResult.composition │ │ │ │ │ ├── filterPages.ts │ │ │ │ │ └── SearchResult.variants.ts │ │ │ │ ├── EditInGithub.svelte │ │ │ │ ├── EditInGithub.variants.ts │ │ │ │ ├── Toast.dismissable.composition │ │ │ │ ├── Toast.variants.ts │ │ │ │ └── Toast.svelte │ │ │ ├── test.ts │ │ │ ├── view │ │ │ │ ├── Iframe.svelte │ │ │ │ ├── ViewBody.variants.ts │ │ │ │ ├── Iframe.md │ │ │ │ └── ViewHeader.variants.ts │ │ │ ├── test │ │ │ │ ├── clearSnapshots.ts │ │ │ │ └── preparePath.ts │ │ │ ├── server-events.d.ts │ │ │ └── index.ts │ │ ├── docs │ │ │ ├── 1-variants │ │ │ │ ├── DefaultSlot.svelte │ │ │ │ ├── PassIntoDefaultSlot.svelte │ │ │ │ ├── SSR.svelte │ │ │ │ ├── DefaultSlot.md │ │ │ │ ├── DefaultSlot.variants.ts │ │ │ │ ├── SSR.variants.ts │ │ │ │ └── Rendering-Platform.md │ │ │ ├── 9-maintainer-notes │ │ │ │ ├── 3-release.md │ │ │ │ ├── 1-contributing.md │ │ │ │ └── 2-add-vitest.md │ │ │ ├── 6-easy-wikilinks.after.composition │ │ │ ├── 6-easy-wikilinks.composition │ │ │ ├── 3-customizations │ │ │ │ ├── 4-styles.md │ │ │ │ ├── 1-use-by-itself-(for-a-library).md │ │ │ │ └── 0-config.md │ │ │ ├── 4-component-compositions.composition │ │ │ ├── 8-i18n.composition │ │ │ ├── 2-viewer.md │ │ │ ├── 9-examples.md │ │ │ └── 7a-additional-component-tests.md │ │ ├── app.html │ │ └── app.d.ts │ ├── vitest.config.ts │ ├── uno.config.ts │ ├── static │ │ └── icons │ │ │ ├── orange-favicon.svg │ │ │ └── kitbook-editable-text.svg │ ├── .stackblitz.js │ ├── e2e │ │ └── kitbook.spec.ts │ ├── playwright.config.ts │ ├── tsconfig.json │ ├── vite.config.ts │ ├── svelte.config.js │ ├── LICENSE │ ├── kitbook.config.ts │ └── README.md ├── mdsvex-shiki-twoslash │ ├── .gitignore │ ├── src │ │ ├── fixtures │ │ │ ├── no-codefence.txt │ │ │ ├── lang-no-meta.txt │ │ │ ├── cut.txt │ │ │ ├── highlight-normal.txt │ │ │ ├── title.txt │ │ │ ├── highlight-twoslash.txt │ │ │ ├── basic.txt │ │ │ ├── has-error.txt │ │ │ ├── get-posts.txt │ │ │ ├── multi-file.txt │ │ │ ├── multi-highlights.txt │ │ │ ├── no-codefence.html │ │ │ ├── lang-no-meta.html │ │ │ ├── get-posts.html │ │ │ ├── cut.html │ │ │ ├── highlight-normal.html │ │ │ └── highlight-twoslash.html │ │ ├── setLineNumberBaseTo1.ts │ │ ├── setLineNumberBaseTo1.test.ts │ │ └── index.test.ts │ ├── vitest.config.ts │ ├── build.config.ts │ ├── tsconfig.json │ ├── LICENSE │ ├── mdsvex.js │ └── package.json ├── template │ ├── .npmrc │ ├── .gitignore │ ├── src │ │ ├── routes │ │ │ ├── (app) │ │ │ │ ├── _page.md │ │ │ │ ├── about │ │ │ │ │ └── +page.svelte │ │ │ │ ├── +page.ts │ │ │ │ ├── _page.variants.ts │ │ │ │ └── +page.svelte │ │ │ ├── kitbook │ │ │ │ ├── [...file] │ │ │ │ │ ├── +page.js │ │ │ │ │ └── +page.svelte │ │ │ │ ├── sandbox │ │ │ │ │ └── [...file] │ │ │ │ │ │ ├── +page.js │ │ │ │ │ │ └── +page.svelte │ │ │ │ ├── tools │ │ │ │ │ └── +page.svelte │ │ │ │ └── +layout.js │ │ │ └── +layout.ts │ │ ├── lib │ │ │ ├── Image.md │ │ │ ├── Image.svelte │ │ │ └── Image.variants.ts │ │ ├── docs │ │ │ ├── 1-b.md │ │ │ └── 0-file-ordering.md │ │ ├── app.d.ts │ │ ├── app.html │ │ └── index.md │ ├── README.md │ ├── e2e │ │ └── kitbook.spec.ts │ ├── vite.config.js │ ├── .stackblitz.js │ ├── svelte.config.js │ ├── tsconfig.json │ ├── kitbook.config.ts │ ├── playwright.config.ts │ └── package.json ├── rehype-display-link-titles │ ├── .gitignore │ ├── vitest.config.ts │ ├── build.config.ts │ ├── tsconfig.json │ ├── README.md │ └── LICENSE └── format-snapshot-results-action │ ├── src │ ├── index.ts │ ├── main.ts │ └── makeComment.snap.md │ ├── vitest.config.ts │ ├── package.json │ ├── tsconfig.json │ ├── README.md │ ├── action.yml │ └── LICENSE ├── pnpm-workspace.yaml ├── .prettierrc ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── config.yml │ └── feature_request.yml └── workflows │ ├── pkg.pr.new.yml │ ├── lint.yml │ ├── svelte-check-unit-test.yml │ └── release.yml ├── .vscode ├── foam.json └── extensions.json ├── .gitignore ├── .foam └── templates │ └── new-note.md ├── vitest.workspace.ts ├── fiveserver.config.cjs ├── LICENSE ├── .gitpod.yml ├── README.md └── package.json /.npmrc: -------------------------------------------------------------------------------- 1 | # link-workspace-packages=false -------------------------------------------------------------------------------- /packages/kitbook/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/.gitignore: -------------------------------------------------------------------------------- 1 | dist -------------------------------------------------------------------------------- /packages/template/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /packages/kitbook/.gitignore: -------------------------------------------------------------------------------- 1 | /.svelte-kit 2 | dist 3 | -------------------------------------------------------------------------------- /packages/rehype-display-link-titles/.gitignore: -------------------------------------------------------------------------------- 1 | dist -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | -------------------------------------------------------------------------------- /packages/kitbook/.npmignore: -------------------------------------------------------------------------------- 1 | /mockComponents 2 | *.variants.ts 3 | **/*.md -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/no-codefence.txt: -------------------------------------------------------------------------------- 1 | 2 | const foo = 2 -------------------------------------------------------------------------------- /packages/kitbook/src/lib/viewer/EdgeDraggable.md: -------------------------------------------------------------------------------- 1 | Remembers postion in localStorage -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/lang-no-meta.txt: -------------------------------------------------------------------------------- 1 | js 2 | const foo = 2 -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/[...file]/mockComponents/Hi.svelte: -------------------------------------------------------------------------------- 1 |
Hi
2 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/plugins/main/markdown/cases/js.md: -------------------------------------------------------------------------------- 1 | ```js 2 | const a = 2 3 | ``` 4 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/[...file]/Routes.md: -------------------------------------------------------------------------------- 1 | Currently this is dev-only feature. 2 | -------------------------------------------------------------------------------- /packages/template/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package -------------------------------------------------------------------------------- /packages/format-snapshot-results-action/src/index.ts: -------------------------------------------------------------------------------- 1 | import { run } from './main' 2 | 3 | run() 4 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/[...file]/+page.ts: -------------------------------------------------------------------------------- 1 | export { mainPageLoad as load } from 'kitbook' 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 100, 4 | "bracketSameLine": false 5 | } 6 | -------------------------------------------------------------------------------- /packages/template/src/routes/(app)/_page.md: -------------------------------------------------------------------------------- 1 | This page relies on name and image_seeds "data" being passed in. -------------------------------------------------------------------------------- /packages/template/src/routes/(app)/about/+page.svelte: -------------------------------------------------------------------------------- 1 | Sample route with no variants or markdown file. 2 | -------------------------------------------------------------------------------- /packages/template/src/routes/kitbook/[...file]/+page.js: -------------------------------------------------------------------------------- 1 | export { mainPageLoad as load } from 'kitbook'; 2 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/sandbox/[...file]/+page.ts: -------------------------------------------------------------------------------- 1 | export { sandboxPageLoad as load } from 'kitbook' 2 | -------------------------------------------------------------------------------- /packages/template/src/routes/kitbook/sandbox/[...file]/+page.js: -------------------------------------------------------------------------------- 1 | export { sandboxPageLoad as load } from 'kitbook'; 2 | -------------------------------------------------------------------------------- /packages/kitbook/src/docs/1-variants/DefaultSlot.svelte: -------------------------------------------------------------------------------- 1 | Before 2 |
3 | After 4 | -------------------------------------------------------------------------------- /packages/kitbook/src/docs/1-variants/PassIntoDefaultSlot.svelte: -------------------------------------------------------------------------------- 1 | I'm just here to be passed in as a default slot contents. 2 | -------------------------------------------------------------------------------- /packages/template/src/lib/Image.md: -------------------------------------------------------------------------------- 1 | The image will be a random Unsplash image. If we want to it be fixed, we can pass in a seed. -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/cut.txt: -------------------------------------------------------------------------------- 1 | ts twoslash 2 | const level: string = "Danger" 3 | // ---cut--- 4 | console.log(level) -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/highlight-normal.txt: -------------------------------------------------------------------------------- 1 | ts title="examples/index.ts" {1, 3-4} 2 | // 1 3 | // 2 4 | // 3 5 | // 4 6 | // 5 7 | // 6 -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/title.txt: -------------------------------------------------------------------------------- 1 | ts twoslash {3} title="some-file.ts" 2 | type Post = { 3 | title: string; 4 | description: string; 5 | }; -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/[...file]/mockComponents/Hi.md: -------------------------------------------------------------------------------- 1 | # IGNORE THIS 2 | 3 | This mock component is just for being fed to the Main Page for demoing i18n. 4 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/highlight-twoslash.txt: -------------------------------------------------------------------------------- 1 | ts twoslash title="examples/index.ts" {1, 3-4} 2 | // 1 3 | // 2 4 | // 3 5 | // 4 6 | // 5 7 | // 6 -------------------------------------------------------------------------------- /packages/template/src/routes/kitbook/tools/+page.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/kitbook/src/docs/9-maintainer-notes/3-release.md: -------------------------------------------------------------------------------- 1 | # Release Instructions 2 | 3 | - run `pnpm release` 4 | - commit 5 | - GitHub action will build and publish to npm 6 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | - [ ] Lint the project with `pnpm lint` 2 | - [ ] Write your commits using [Convential Commits](https://www.conventionalcommits.org/en/v1.0.0/). 3 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/sandbox/[...file]/mockComponents/IndividualComponent.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | I'm {name}. 6 | -------------------------------------------------------------------------------- /packages/kitbook/src/docs/6-easy-wikilinks.after.composition: -------------------------------------------------------------------------------- 1 | I'm a composition that was never wiki-linked to in my companion markdown and so I'm placed after the markdown by default. 2 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/plugins/utils/colors.ts: -------------------------------------------------------------------------------- 1 | export const green = '\x1B[32m' 2 | export const red = '\x1B[31m' 3 | export const bold = '\x1B[1m' 4 | export const reset = '\x1B[0m' 5 | -------------------------------------------------------------------------------- /packages/template/src/routes/kitbook/sandbox/[...file]/+page.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/[...file]/MainPage.md: -------------------------------------------------------------------------------- 1 | This is the page where all routes go through. Corresponding stories and component modules are displayed. Variants are iterated through. 2 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/sandbox/[...file]/mockComponents/NeedsPropsToNotError.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | I'm {name.foo}. 6 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/basic.txt: -------------------------------------------------------------------------------- 1 | ts twoslash {1, 3-4} title="examples/index.ts" 2 | const foo = 2 // highlight 3 | // nope 4 | // highlight 5 | // highlight me 6 | // not me -------------------------------------------------------------------------------- /.vscode/foam.json: -------------------------------------------------------------------------------- 1 | { 2 | "purpose": "this file exists to tell the foam-vscode plugin that it's currently in a foam workspace", 3 | "future": "we may use this for custom configuration" 4 | } 5 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/plugins/virtual/Template.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | I'm just here to mock an import for the variants template. {foo} 6 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/defineConfig.ts: -------------------------------------------------------------------------------- 1 | import type { KitbookSettings } from './kitbook-types' 2 | 3 | export function defineConfig(config: KitbookSettings): KitbookSettings { 4 | return config 5 | } 6 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/modules/hmrUpdatedModules.ts: -------------------------------------------------------------------------------- 1 | import { writable } from 'svelte/store' 2 | import type { GroupedPageMap } from 'kitbook' 3 | 4 | export const pagesStore = writable({}) 5 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/plugins/main/kitbook-virtual-module.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'virtual:kitbook' { 2 | import type { KitbookSettings } from 'kitbook' 3 | 4 | export const settings: KitbookSettings 5 | } 6 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/has-error.txt: -------------------------------------------------------------------------------- 1 | ts twoslash 2 | const welcome = "Tudo bem gente?" 3 | const words = welcome.contains(" ") 4 | 5 | // @errors: 2339 2588 6 | const a = "123" 7 | a = 132 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | ins.md 4 | key.json 5 | 6 | playwright-report 7 | test-results 8 | 9 | # ensure locally create snapshots are not committed 10 | **/e2e/snapshots/* 11 | .eslintcache -------------------------------------------------------------------------------- /.foam/templates/new-note.md: -------------------------------------------------------------------------------- 1 | --- 2 | foam_template: 3 | name: Markdown 4 | description: Use this for pure documentation 5 | --- 6 | 7 | # ${FOAM_TITLE} 8 | 9 | ${1} 10 | 11 | ## ${2: First subsection} 12 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/plugins/main/markdown/cases/twoslash.md: -------------------------------------------------------------------------------- 1 | ```ts twoslash {1, 3-4} title="examples/index.ts" 2 | const foo = 2 // highlight 3 | // nope 4 | // highlight 5 | // highlight me 6 | // not me 7 | ``` 8 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/components/errorBoundary/ErrorBoundary.ts: -------------------------------------------------------------------------------- 1 | import { createBoundary } from './createBoundary' 2 | import Component from './CustomErrorBoundary.svelte' 3 | 4 | export default createBoundary(Component) 5 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/plugins/main/markdown/cases/toc.md: -------------------------------------------------------------------------------- 1 | # Hello World 2 | 3 | ## Table of Contents 4 | 5 | ## Install 6 | 7 | A **example**. 8 | 9 | ## Use 10 | 11 | More `text`. 12 | 13 | ## License 14 | 15 | MIT -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/sandbox/[...file]/SandboxPage.md: -------------------------------------------------------------------------------- 1 | # Sandbox 2 | 3 | This is a page which does not inherit the (main) group layout so it can display components and stories in isolation when loaded via an iframe. 4 | -------------------------------------------------------------------------------- /packages/template/README.md: -------------------------------------------------------------------------------- 1 | # Kitbook Template 2 | 3 | A simple template that you can use to get started with Kitbook. See the [Kitbook docs](https://kitbook.vercel.app/) for examples and information on how to build a Kitbook. 4 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/tools/+page.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/viewer/focused/editor/ts/types.ts: -------------------------------------------------------------------------------- 1 | import type { VirtualTypeScriptEnvironment } from '@typescript/vfs' 2 | 3 | export interface TypeScriptConfig { 4 | path: string 5 | env: VirtualTypeScriptEnvironment 6 | } 7 | -------------------------------------------------------------------------------- /packages/rehype-display-link-titles/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config' 2 | 3 | export default defineProject({ 4 | test: { 5 | name: 'rehype-display-link-titles:unit', 6 | globals: true, 7 | }, 8 | }) 9 | -------------------------------------------------------------------------------- /packages/format-snapshot-results-action/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config' 2 | 3 | export default defineProject({ 4 | test: { 5 | name: 'format-snapshot-results-action:unit', 6 | globals: true, 7 | }, 8 | }) 9 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/components/search/SearchResult.md: -------------------------------------------------------------------------------- 1 | You'll recognize this component from the search modal. If you're running Kitbook locally you can add another composition or just to the specific composition and variant files by clicking their headings. -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/sandbox/[...file]/+page.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/get-posts.txt: -------------------------------------------------------------------------------- 1 | ts twoslash {3} 2 | type Post = { 3 | title: string; 4 | description: string; 5 | }; 6 | 7 | function getPosts(): Array{ 8 | return [] 9 | } 10 | // ---cut--- 11 | const posts = getPosts(); -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Questions & Discussions 4 | url: https://github.com/jacob-8/kitbook/discussions 5 | about: Use GitHub discussions for message-board style questions and discussions. 6 | -------------------------------------------------------------------------------- /packages/template/src/docs/1-b.md: -------------------------------------------------------------------------------- 1 | I'm here just to be ordered after [[0-file-ordering]]. 2 | 3 | [//begin]: # "Autogenerated link references for markdown compatibility" 4 | [0-file-ordering]: 0-file-ordering.md "File Ordering" 5 | [//end]: # "Autogenerated link references" -------------------------------------------------------------------------------- /packages/kitbook/src/lib/test.ts: -------------------------------------------------------------------------------- 1 | export { clearSnapshots } from './test/clearSnapshots.js' 2 | export { getVariants } from './test/getVariants.js' 3 | export { runComponentTests } from './test/runComponentTests.js' 4 | export { preparePath } from './test/preparePath.js' 5 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from 'vitest/config' 2 | 3 | export default defineProject({ 4 | test: { 5 | name: 'mdsvex-shiki-twoslash:unit', 6 | globals: true, 7 | includeSource: ['src/**/*.ts'], 8 | }, 9 | }) 10 | -------------------------------------------------------------------------------- /packages/kitbook/src/docs/1-variants/SSR.svelte: -------------------------------------------------------------------------------- 1 | 5 | 6 | {#if browser} 7 | I show up on browser. Refresh me or hit the 'CSR' button to toggle me between SSR/CSR. 8 | {:else} 9 | I show up on server. 10 | {/if} 11 | -------------------------------------------------------------------------------- /packages/template/src/app.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | // See https://kit.svelte.dev/docs/types#app 4 | // for information about these interfaces 5 | declare namespace App { 6 | // interface Locals {} 7 | // interface Platform {} 8 | // interface Session {} 9 | } 10 | -------------------------------------------------------------------------------- /packages/kitbook/src/docs/6-easy-wikilinks.composition: -------------------------------------------------------------------------------- 1 | 8 | 9 | I'm a composition placed inline! 10 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/routes/[...file]/frame/sidebar/Sidebar.md: -------------------------------------------------------------------------------- 1 | Currently developing this component in tandem with the [[Layout]] component. Go there instead. 2 | 3 | [//begin]: # "Autogenerated link references for markdown compatibility" 4 | [Layout]: ../Layout.md "Layout" 5 | [//end]: # "Autogenerated link references" -------------------------------------------------------------------------------- /packages/template/e2e/kitbook.spec.ts: -------------------------------------------------------------------------------- 1 | import { getVariants, runComponentTests } from 'kitbook/test' 2 | import { expect, test } from '@playwright/test' 3 | import kitbookConfig from '../kitbook.config' 4 | 5 | const variantModules = await getVariants() 6 | runComponentTests({ test, expect, kitbookConfig, variantModules }) 7 | -------------------------------------------------------------------------------- /packages/template/src/routes/kitbook/[...file]/+page.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/multi-file.txt: -------------------------------------------------------------------------------- 1 | ts twoslash 2 | // @module: esnext 3 | // @filename: maths.ts 4 | export function absolute(num: number) { 5 | if (num < 0) return num * -1; 6 | return num; 7 | } 8 | // @filename: index.ts 9 | import {absolute} from "./maths" 10 | const value = absolute(-1) 11 | // ^? -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/build.config.ts: -------------------------------------------------------------------------------- 1 | import { defineBuildConfig } from 'unbuild' 2 | 3 | export default defineBuildConfig({ 4 | entries: [ 5 | 'src/index', 6 | ], 7 | clean: true, 8 | declaration: true, 9 | externals: [ 10 | 'shiki', 11 | ], 12 | rollup: { 13 | emitCJS: true, 14 | }, 15 | }) 16 | -------------------------------------------------------------------------------- /vitest.workspace.ts: -------------------------------------------------------------------------------- 1 | import { defineWorkspace } from 'vitest/config' 2 | 3 | export default defineWorkspace([ 4 | 'packages/kitbook/vitest.config.ts', 5 | 'packages/mdsvex-shiki-twoslash/vitest.config.ts', 6 | 'packages/rehype-display-link-titles/vitest.config.ts', 7 | 'packages/format-snapshot-results-action/vitest.config.ts', 8 | ]) 9 | -------------------------------------------------------------------------------- /packages/kitbook/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defaultExclude, defineProject } from 'vitest/config' 2 | 3 | export default defineProject({ 4 | test: { 5 | name: 'kitbook:unit', 6 | globals: true, 7 | includeSource: ['src/**/*.ts'], 8 | exclude: [...defaultExclude, 'dist', '.svelte-kit', 'e2e/*.spec.ts'], 9 | }, 10 | }) 11 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/src/fixtures/multi-highlights.txt: -------------------------------------------------------------------------------- 1 | js title="vite.config.js" {5} 2 | import { sveltekit } from '@sveltejs/kit/vite'; 3 | import { kitbook } from 'kitbook/plugins/vite'; 4 | 5 | const config = { 6 | plugins: [ 7 | kitbook({routes: 'src/routes'}), 8 | sveltekit(), 9 | ], 10 | }; 11 | 12 | export default config; -------------------------------------------------------------------------------- /packages/rehype-display-link-titles/build.config.ts: -------------------------------------------------------------------------------- 1 | import { defineBuildConfig } from 'unbuild' 2 | 3 | export default defineBuildConfig({ 4 | entries: [ 5 | 'src/index', 6 | ], 7 | // clean: true, 8 | declaration: true, 9 | externals: [ 10 | 'unified', 11 | 'hast', 12 | ], 13 | rollup: { 14 | emitCJS: true, 15 | }, 16 | }) 17 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/plugins/virtual/Template.variants.ts.txt: -------------------------------------------------------------------------------- 1 | import type { Variant, VariantMeta } from 'kitbook' 2 | import type Component from './Template.svelte' 3 | 4 | export const shared_meta: VariantMeta = {} 5 | 6 | const shared = {} satisfies Partial> 7 | 8 | export const First: Variant = { 9 | ...shared, 10 | } 11 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/viewer/focused/active.ts: -------------------------------------------------------------------------------- 1 | import { writable } from 'svelte/store' 2 | 3 | export const selectedComponent = writable() 4 | export const hoveredComponent = writable() 5 | 6 | export const selectedElement = writable() 7 | export const hoveredElement = writable() 8 | -------------------------------------------------------------------------------- /packages/template/vite.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | import { defineConfig } from 'vite' 3 | import { sveltekit } from '@sveltejs/kit/vite' 4 | import { kitbook } from 'kitbook/plugins/vite' 5 | import kitbookConfig from './kitbook.config' 6 | 7 | export default defineConfig({ 8 | plugins: [ 9 | kitbook(kitbookConfig), 10 | sveltekit(), 11 | ], 12 | }) 13 | -------------------------------------------------------------------------------- /packages/kitbook/uno.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig, presetIcons, presetUno } from 'unocss' 2 | 3 | export default defineConfig({ 4 | presets: [ 5 | presetUno(), 6 | presetIcons({ 7 | prefix: 'i-', 8 | extraProperties: { 9 | 'display': 'inline-block', 10 | 'vertical-align': 'middle', 11 | }, 12 | }), 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /packages/template/src/routes/(app)/+page.ts: -------------------------------------------------------------------------------- 1 | import type { PageLoad } from './$types' 2 | 3 | export const load: PageLoad = async () => { 4 | return { 5 | name: 'Svelte Community', 6 | image_seeds: ['svelte-society'], 7 | save_to_db: (order_count: number) => alert(`This is pretending to be a real db, and it saved ${order_count} orders.`), 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/mdsvex-shiki-twoslash/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "types": [ 7 | "vitest/globals", 8 | "vitest/importMeta" 9 | ], 10 | "strict": true, 11 | "esModuleInterop": true 12 | }, 13 | "include": [ 14 | "src" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/rehype-display-link-titles/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "types": [ 7 | "vitest/globals", 8 | "vitest/importMeta" 9 | ], 10 | "strict": true, 11 | "esModuleInterop": true 12 | }, 13 | "include": [ 14 | "src" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /fiveserver.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | highlight: true, // enable highlight feature 3 | injectBody: true, // enable instant update 4 | remoteLogs: true, // enable remoteLogs 5 | navigate: true, // enable auto-navigation 6 | } 7 | 8 | // https://marketplace.visualstudio.com/items?itemName=yandeu.five-server 9 | // https://github.com/yandeu/five-server#documentation 10 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/plugins/main/modifyViteConfigForKitbook.ts: -------------------------------------------------------------------------------- 1 | import type { UserConfig } from 'vite' 2 | 3 | /** Modify server.fs.allow one level up from the project root for displaying README.md */ 4 | export function modifyViteConfigForKitbook(): UserConfig { 5 | return { 6 | server: { 7 | fs: { 8 | allow: ['..'], 9 | }, 10 | }, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/kitbook/src/lib/view/Iframe.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 | {#if blockScripts} 9 |