Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte 5 #50

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/kitbook-svelte-5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.svelte-kit
dist
14 changes: 14 additions & 0 deletions packages/kitbook-svelte-5/.stackblitz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { promises as fsPromises } from 'node:fs'

updateDependencyLinksToLatest('./package.json')

async function updateDependencyLinksToLatest(filename) {
try {
const contents = await fsPromises.readFile(filename, 'utf-8')
const updatedContent = contents.replace(/"workspace:\*"/gi, '"latest"')
await fsPromises.writeFile(filename, updatedContent)
}
catch (err) {
console.error(err)
}
}
21 changes: 21 additions & 0 deletions packages/kitbook-svelte-5/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-PRESENT Jacob Bowdoin <https://github.com/jacob-8>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions packages/kitbook-svelte-5/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<p align="center">
<a href="https://kitbook.vercel.app/">
<img src="https://raw.githubusercontent.com/jacob-8/kitbook/b96f77da81309a6ccd06693beb0f06ba8fdc0a2b/packages/kitbook/static/kitbook.svg" height="80" style="padding: 20px 0;">
</a>
</p>

<p align="center">
Documentation, Prototyping, Inspection & Testing Workbench Tool for SvelteKit apps built with SvelteKit.
<p>

<p align="center">
<a href="https://www.npmjs.com/package/kitbook"><img alt="version" src="https://img.shields.io/npm/v/kitbook?color=729B1B&label="></a>
<p>

<p align="center">
<a href="https://kitbook.vercel.app/">View the Kitbook Docs (and demo)</a>
</p>

## Svelte 5

This is an in-progress version for use with Svelte 5. Can be installed using `"kitbook": "https://pkg.pr.new/kitbook@49"` in your package.json.

## Contributing

Would love to have you help! Read the [[0-roadmap|Roadmap]] for good places to start. We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).

[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https:///pr.new/jacob-8/kitbook)

Or work on Kitbook locally:

- `pnpm install`
- `pnpm stub`
- `pnpm dev`

To update the Kitbook code while using it in your own app, you can change your `devDependency` to point to it instead of npm by using something like `"kitbook": "link:../kitbook/packages/kitbook",` then run `pnpm package:watch` in Kitbook to keep it updating on changes.

[//begin]: # "Autogenerated link references for markdown compatibility"
[0-roadmap|Roadmap]: src/docs/9-maintainer-notes/0-roadmap.md "Roadmap"
[//end]: # "Autogenerated link references"
125 changes: 125 additions & 0 deletions packages/kitbook-svelte-5/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"name": "kitbook",
"type": "module",
"version": "2.0.0-alpha.1",
"description": "Svelte Component Documentation and Prototyping Workbench built using SvelteKit",
"author": "Jacob Bowdoin",
"license": "MIT",
"homepage": "https://kitbook.vercel.app",
"repository": {
"type": "git",
"url": "git+https://github.com/jacob-8/kitbook.git",
"directory": "packages/kitbook"
},
"bugs": {
"url": "https://github.com/jacob-8/kitbook/issues"
},
"keywords": [
"Kitbook",
"Svelte",
"SvelteKit",
"Typescript",
"UI",
"Component library",
"Documentation",
"Prototyping",
"Workbench",
"Stories"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"svelte": "./dist/index.js",
"default": "./dist/index.js"
},
"./viewer/load-viewer": {
"types": "./dist/viewer/load-viewer.d.ts",
"default": "./dist/viewer/load-viewer.js"
},
"./plugins/vite": {
"types": "./dist/plugins/vite.d.ts",
"default": "./dist/plugins/vite.js"
},
"./test": {
"types": "./dist/test.d.ts",
"default": "./dist/test.js"
},
"./defineConfig": {
"types": "./dist/defineConfig.d.ts",
"default": "./dist/defineConfig.js"
}
},
"types": "./dist/index.d.ts",
"typesVersions": {
">4.0": {
"*": [
"./dist/*.d.ts"
]
}
},
"files": [
"dist"
],
"scripts": {
"dev": "vite dev --host",
"build": "vite build",
"build:ci": "cd ../.. && pnpm build:deps && cd packages/kitbook-svelte-5 && pnpm build",
"preview": "vite preview",
"sync": "svelte-kit sync",
"package": "svelte-kit sync && svelte-package && publint",
"package:watch": "svelte-kit sync && svelte-package --watch",
"prepublishOnly": "svelte-kit sync && vitest run && npm run package",
"check": "svelte-check --tsconfig ./tsconfig.json --threshold error --diagnostic-sources js,svelte",
"check:watch": "svelte-check --tsconfig ./jsconfig.json --threshold warning --diagnostic-sources js,svelte --watch",
"test": "vitest"
},
"svelte": "./dist/index.js",
"peerDependencies": {
"@sveltejs/kit": "^2.0.0",
"svelte": "^5.0.0",
"typescript": "^5.0.0"
},
"dependencies": {
"@kitbook/mdsvex-shiki-twoslash": "workspace:*",
"@kitbook/rehype-display-link-titles": "workspace:*",
"birpc": "^0.2.17",
"qrcode-terminal": "^0.12.0",
"rehype-autolink-headings": "^6.1.1",
"rehype-format": "^4.0.1",
"rehype-slug": "^5.1.0",
"rehype-stringify": "^9.0.3",
"rehype-urls": "^1.1.1",
"remark-gfm": "3.0.1",
"remark-parse": "^10.0.1",
"remark-rehype": "^10.1.0",
"remark-toc": "^8.0.1",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.1",
"vite-dev-rpc": "^0.1.4",
"vite-hot-client": "^0.2.3"
},
"devDependencies": {
"@iconify/json": "^2.2.203",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.9.0",
"@sveltejs/package": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^5.0.0",
"@types/mdast": "^4.0.2",
"@types/node": "^20.11.30",
"@types/qrcode-terminal": "^0.12.2",
"@unocss/svelte-scoped": "^0.65.1",
"prettier": "^3.4.2",
"publint": "^0.2.8",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"tslib": "^2.6.2",
"typescript": "^5.0.0",
"unocss": "^0.65.1",
"vite": "^6.0.0",
"vitest": "^2.0.0"
},
"stackblitz": {
"installDependencies": false,
"startCommand": "node .stackblitz.js && npm install && npm run dev"
}
}
24 changes: 24 additions & 0 deletions packages/kitbook-svelte-5/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// See https://svelte.dev/docs/kit/types#app.d.ts

declare global {
namespace App {
// interface Error { }
// interface Locals { }
// interface PageData {}
// interface PageState {}
// interface Platform {}
}

interface ViewTransition {
updateCallbackDone: Promise<void>
ready: Promise<void>
finished: Promise<void>
skipTransition: () => void
}

interface Document {
startViewTransition: (updateCallback: () => Promise<void>) => ViewTransition
}
}

export {}
16 changes: 16 additions & 0 deletions packages/kitbook-svelte-5/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/icons/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="%sveltekit.assets%/styles/tw-reset.css">
%sveltekit.head%
</head>

<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hi Svelte 5
8 changes: 8 additions & 0 deletions packages/kitbook-svelte-5/static/icons/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading