├── .eslintrc.cjs
├── .gitattributes
├── .gitignore
├── .npmrc
├── .prettierignore
├── .prettierrc
├── .stackblitzrc
├── CODE_OF_CONDUCT.md
├── README.md
├── UNLICENSE
├── create-sveltepress-app
├── .npmignore
├── README.md
├── createSveltepressApp.js
├── package.json
├── pnpm-lock.yaml
└── ui
│ ├── .eslintrc.cjs
│ ├── .gitignore
│ ├── .npmignore
│ ├── .prettierrc
│ ├── README.md
│ ├── jsconfig.json
│ ├── package.json
│ ├── pnpm-lock.yaml
│ ├── server
│ └── server.js
│ ├── src
│ ├── app.html
│ ├── global.d.ts
│ ├── lib
│ │ ├── Theme.svelte
│ │ ├── components
│ │ │ ├── content.svelte
│ │ │ ├── modal.svelte
│ │ │ ├── nav.svelte
│ │ │ └── sidebar.svelte
│ │ └── styles
│ │ │ ├── global.scss
│ │ │ └── patches.scss
│ ├── routes
│ │ ├── __error.svelte
│ │ ├── __layout.svelte
│ │ ├── create.svelte
│ │ ├── dashboard.svelte
│ │ ├── features.svelte
│ │ └── index.svelte
│ └── stores.js
│ ├── static
│ └── favicon.png
│ └── svelte.config.js
├── degit.json
├── gui
├── Flutter
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── android
│ │ ├── .gitignore
│ │ ├── app
│ │ │ ├── build.gradle
│ │ │ └── src
│ │ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ │ ├── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── AndroidManifest.xml.hbs
│ │ │ │ ├── java
│ │ │ │ │ └── dev
│ │ │ │ │ │ └── geopjr
│ │ │ │ │ │ └── sveltepress
│ │ │ │ │ │ └── sveltepress
│ │ │ │ │ │ └── MainActivity.java
│ │ │ │ └── res
│ │ │ │ │ ├── drawable-v21
│ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── values-night
│ │ │ │ │ └── styles.xml
│ │ │ │ │ └── values
│ │ │ │ │ └── styles.xml
│ │ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ └── settings.gradle
│ ├── ios
│ │ ├── .gitignore
│ │ ├── Flutter
│ │ │ ├── AppFrameworkInfo.plist.hbs
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Runner.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ ├── contents.xcworkspacedata
│ │ │ │ └── xcshareddata
│ │ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ │ └── WorkspaceSettings.xcsettings
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── Runner
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── main.m
│ ├── lib
│ │ ├── main.dart
│ │ └── title.dart.hbs
│ ├── linux
│ │ ├── .gitignore
│ │ ├── CMakeLists.txt
│ │ ├── default.desktop.hbs
│ │ ├── flutter
│ │ │ ├── CMakeLists.txt
│ │ │ ├── generated_plugin_registrant.cc
│ │ │ ├── generated_plugin_registrant.h
│ │ │ └── generated_plugins.cmake
│ │ ├── main.cc
│ │ ├── my_application.cc
│ │ └── my_application.h
│ ├── macos
│ │ ├── .gitignore
│ │ ├── Flutter
│ │ │ ├── Flutter-Debug.xcconfig
│ │ │ ├── Flutter-Release.xcconfig
│ │ │ └── GeneratedPluginRegistrant.swift
│ │ ├── Runner.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── xcshareddata
│ │ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── Runner
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ │ ├── Base.lproj
│ │ │ └── MainMenu.xib
│ │ │ ├── Configs
│ │ │ ├── AppInfo.xcconfig
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ └── Warnings.xcconfig
│ │ │ ├── DebugProfile.entitlements
│ │ │ ├── Info.plist
│ │ │ ├── MainFlutterWindow.swift
│ │ │ └── Release.entitlements
│ ├── package.json
│ ├── pubspec.lock
│ ├── pubspec.yaml
│ ├── scripts
│ │ ├── prepareParents.js
│ │ ├── prepareTitle.js
│ │ └── renamePackage.js
│ ├── test
│ │ └── widget_test.dart
│ ├── web
│ │ ├── index.html
│ │ └── manifest.json.hbs
│ └── windows
│ │ ├── .gitignore
│ │ ├── CMakeLists.txt
│ │ ├── flutter
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ │ └── runner
│ │ ├── CMakeLists.txt
│ │ ├── Runner.rc
│ │ ├── flutter_window.cpp
│ │ ├── flutter_window.h
│ │ ├── main.cpp
│ │ ├── resource.h
│ │ ├── resources
│ │ └── app_icon.ico
│ │ ├── runner.exe.manifest
│ │ ├── utils.cpp
│ │ ├── utils.h
│ │ ├── win32_window.cpp
│ │ └── win32_window.h
├── GTK
│ ├── .gitignore
│ ├── README.md
│ ├── esbuild.cjs
│ ├── extra
│ │ └── app.desktop
│ ├── package.json
│ ├── scripts
│ │ ├── generateFlatpak.js
│ │ └── prepareGlade.js
│ ├── src
│ │ └── index.js
│ └── ui.glade.hbs
├── QT
│ ├── .gitignore
│ ├── README.md
│ ├── assets.d.ts
│ ├── bullet.svg
│ ├── deploy
│ │ ├── config.json
│ │ ├── darwin
│ │ │ └── SveltePress
│ │ │ │ └── Contents
│ │ │ │ ├── Info.plist.hbs
│ │ │ │ ├── MacOS
│ │ │ │ └── qode.json
│ │ │ │ ├── PkgInfo
│ │ │ │ └── Resources
│ │ │ │ ├── entitlements.plist
│ │ │ │ └── index.js
│ │ ├── linux
│ │ │ └── SveltePress
│ │ │ │ ├── default.desktop.hbs
│ │ │ │ ├── index.js
│ │ │ │ └── qode.json
│ │ └── win32
│ │ │ └── SveltePress
│ │ │ ├── platforms
│ │ │ └── .gitkeep
│ │ │ ├── qode.json
│ │ │ └── styles
│ │ │ └── .gitkeep
│ ├── esbuild.js
│ ├── package.json
│ ├── scripts
│ │ ├── prepareAssets.js
│ │ └── prepareMeta.mjs
│ └── src
│ │ └── index.js
├── README.md
├── generateSymlinks.mjs
└── sveltepresslogo.png
├── jsconfig.json
├── netlify.toml
├── package.json
├── pages
├── guide
│ ├── 01 - getting_started
│ │ ├── 01 - installation.md
│ │ ├── 02 - config.md
│ │ └── readme.md
│ ├── 02 - writing
│ │ ├── 01 - structure.md
│ │ ├── 02 - naming.md
│ │ ├── 03 - images.md
│ │ ├── 04 - drafts.md
│ │ └── readme.md
│ ├── 03 - extending
│ │ ├── 01 - posts.md
│ │ ├── 02 - theme.md
│ │ ├── 03 - markdown.md
│ │ └── readme.md
│ ├── 04 - gui
│ │ ├── 01 - Warning.md
│ │ ├── 02 - Installation.md
│ │ └── readme.md
│ ├── Introduction.md
│ └── readme.md
└── internals
│ ├── 01 - SveltePress
│ ├── 01 - DataGenerator.md
│ ├── 02 - SidebarGenerator.md
│ ├── 03 - NavGenerator.md
│ ├── 04 - hooksStores.md
│ ├── 05 - slug.md
│ ├── 06 - Theme.md
│ ├── 07 - search.md
│ ├── 08 - production.md
│ └── readme.md
│ ├── 02 - SveltePress-Native
│ ├── 01 - GTK.md
│ ├── 02 - QT.md
│ ├── 03 - Flutter.md
│ └── readme.md
│ └── readme.md
├── pandoc
├── .gitignore
├── README.md
├── input
│ └── .gitkeep
├── output
│ └── .gitkeep
├── package.json
├── pnpm-lock.yaml
├── preparePosts.js
└── runPandoc.js
├── renovate.json
├── scripts
├── generateProdData.js
├── generateSymlinks.js
└── prepareTheme.js
├── src
├── app.html
├── global.d.ts
├── hooks.js
├── lib
│ └── SveltePress
│ │ ├── SveltePressData.js
│ │ ├── Theme.svelte
│ │ ├── components
│ │ ├── content.svelte
│ │ ├── navbar.svelte
│ │ ├── search.svelte
│ │ ├── sidebar.js
│ │ └── sidebar.svelte
│ │ ├── db
│ │ └── .gitkeep
│ │ ├── functions
│ │ ├── dataGenerator.js
│ │ ├── navGenerator.js
│ │ └── sidebarGenerator.js
│ │ ├── markdown
│ │ ├── MD2FM.js
│ │ ├── MD2HTML.js
│ │ └── MDConverter.js
│ │ ├── sveltePress.config.js
│ │ └── theme
│ │ ├── components
│ │ ├── content.svelte
│ │ ├── navbar.svelte
│ │ ├── search.svelte
│ │ └── sidebar.svelte
│ │ ├── index.svelte
│ │ ├── meta
│ │ ├── package.json
│ │ ├── root
│ │ │ └── .gitkeep
│ │ └── svelte.config.js
│ │ └── styles
│ │ ├── global.scss
│ │ └── patches.scss
├── routes
│ ├── [...group]
│ │ ├── [slug].json.js
│ │ └── [slug].svelte
│ ├── __error.svelte
│ └── __layout.svelte
└── stores.js
├── static
├── android-chrome-192x192.png
├── android-chrome-512x512.png
├── apple-touch-icon.png
├── browserconfig.xml
├── favicon-16x16.png
├── favicon-32x32.png
├── favicon.ico
├── mstile-144x144.png
├── mstile-150x150.png
├── mstile-310x150.png
├── mstile-310x310.png
├── mstile-70x70.png
├── safari-pinned-tab.svg
└── site.webmanifest
└── svelte.config.js
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ['eslint:recommended', 'prettier'],
4 | plugins: ['svelte3'],
5 | overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
6 | parserOptions: {
7 | sourceType: 'module'
8 | },
9 | env: {
10 | browser: true,
11 | es2020: true,
12 | node: true
13 | }
14 | };
15 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # SveltePress is a Svelte project
2 | # The following extensions do not
3 | # represent code related directly
4 | # to it so they are getting igno-
5 | # red from the language stats.
6 |
7 | # gui/**/*.cc linguist-vendored
8 | # gui/**/*.h linguist-vendored
9 | # gui/**/*.cpp linguist-vendored
10 | # gui/**/*.xml linguist-vendored
11 | # gui/**/*.glade linguist-vendored
12 | # gui/**/*.xcworkspacedata linguist-vendored
13 | # gui/**/*.entitlements linguist-vendored
14 | # gui/**/*.xib linguist-vendored
15 | # gui/**/*.xcscheme linguist-vendored
16 | # gui/**/*.storyboard linguist-vendored
17 | # gui/**/*.xcsettings linguist-vendored
18 | # gui/**/*.manifest linguist-vendored
19 | # gui/**/*.xbs linguist-vendored
20 | # gui/**/*.js linguist-vendored
21 | # gui/**/CMakeLists.txt linguist-vendored
22 | # gui/**/*.cmake linguist-vendored
23 | # gui/*/test/* linguist-vendored
24 | # gui/*/tests/* linguist-vendored
25 | # # Don't js in ignore top-lever or
26 | # # in src/
27 | # gui/*/*.js -linguist-vendored
28 | # gui/*/src/*.js -linguist-vendored
29 |
30 | # Change of plans: don't count
31 | # gui at all except sample fi-
32 | # es to show that it uses that
33 | # language too
34 |
35 | gui/** linguist-vendored
36 | gui/**/lib/*.dart -linguist-vendored
37 |
38 | src/**/*.html linguist-vendored
39 | src/**/*.css linguist-vendored
40 | # src/**/*.scss linguist-vendored
41 |
42 | pandoc/** linguist-vendored
43 |
44 | create-sveltepress-app/** linguist-vendored
45 |
46 | scripts/* linguist-vendored
47 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /.svelte-kit
4 | /package
5 | /.vercel_build_output
6 | /.svelte
7 | /build
8 | .pnpm-debug.log*
9 | *.log
10 | npm-debug.log*
11 | .AppleDouble
12 | .LSOverride
13 | .idea
14 | .cloud
15 | .project
16 | tmp/
17 | typings/
18 | /.gitkeep
19 | /pnpm-lock.yaml
20 | /yarn.lock
21 | /package-lock.json
22 |
23 | # DB
24 | /src/lib/SveltePress/db/*.js
25 |
26 | # Symlinks
27 | /sveltePress.config.js
28 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | engine-strict=true
2 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | .svelte-kit/**
2 | static/**
3 | build/**
4 | node_modules/**
5 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "useTabs": true,
3 | "singleQuote": true,
4 | "trailingComma": "none",
5 | "printWidth": 100
6 | }
7 |
--------------------------------------------------------------------------------
/.stackblitzrc:
--------------------------------------------------------------------------------
1 | {
2 | "installDependencies": false,
3 | "startCommand": "npm run preinstall && npm install --ignore-scripts && node scripts/generateSymlinks.js && npm run dev"
4 | }
5 |
--------------------------------------------------------------------------------
/UNLICENSE:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
25 |
--------------------------------------------------------------------------------
/create-sveltepress-app/.npmignore:
--------------------------------------------------------------------------------
1 | /ui/
2 |
--------------------------------------------------------------------------------
/create-sveltepress-app/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | create-sveltepress-app
5 | Documentation for humans.
6 |
7 |
8 |
9 |
10 |
11 |
12 | #
13 |
14 | ## What is create-sveltepress-app?
15 |
16 | create-sveltepress-app is a wrapper around degit for easier installation of [SveltePress](https://github.com/GeopJr/SveltePress).
17 | It also has some adders, check them out on the help page!
18 |
19 | #
20 |
21 | ## Usage
22 |
23 | ```bash
24 | # Replace `my-sveltepress-project` with the name you desire
25 | npx create-sveltepress-app create my-sveltepress-project
26 |
27 | # Change directory to the folder from the previous step
28 | cd my-sveltepress-project
29 |
30 | # Install dependencies
31 | # PNPM is recommended but both YARN and NPM will do
32 | pnpm install
33 | ```
34 |
35 | ```bash
36 | # All available commands
37 | npx create-sveltepress-app -h
38 | ```
39 |
40 | > For more info on how SveltePress works, how to set it up & more, visit [https://sveltepress.geopjr.dev/](https://sveltepress.geopjr.dev/)
41 |
42 | #
43 |
44 | ## Contributing
45 |
46 | 1. Read the [Code of Conduct](https://github.com/GeopJr/SveltePress/blob/main/CODE_OF_CONDUCT.md)
47 | 2. Fork it ( https://github.com/GeopJr/SveltePress/fork )
48 | 3. Create your feature branch (git checkout -b my-new-feature)
49 | 4. Commit your changes (git commit -am 'Add some feature')
50 | 5. Push to the branch (git push origin my-new-feature)
51 | 6. Create a new Pull Request
52 |
--------------------------------------------------------------------------------
/create-sveltepress-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create-sveltepress-app",
3 | "version": "2.0.2",
4 | "description": "Documentation for humans.",
5 | "bin": {
6 | "create-sveltepress-app": "createSveltepressApp.js"
7 | },
8 | "repository": {
9 | "type": "git",
10 | "url": "git+https://github.com/GeopJr/SveltePress.git"
11 | },
12 | "keywords": [
13 | "svelte",
14 | "documentation",
15 | "sveltepress",
16 | "sveltekit"
17 | ],
18 | "author": "GeopJr",
19 | "license": "Unlicense",
20 | "type": "module",
21 | "bugs": {
22 | "url": "https://github.com/GeopJr/SveltePress/issues"
23 | },
24 | "homepage": "https://github.com/GeopJr/SveltePress#readme",
25 | "dependencies": {
26 | "chalk": "5.0.1",
27 | "degit": "2.8.4",
28 | "minimist": "1.2.6"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/create-sveltepress-app/pnpm-lock.yaml:
--------------------------------------------------------------------------------
1 | lockfileVersion: 5.3
2 |
3 | specifiers:
4 | chalk: 5.0.1
5 | degit: 2.8.4
6 | minimist: 1.2.6
7 |
8 | dependencies:
9 | chalk: 5.0.1
10 | degit: 2.8.4
11 | minimist: 1.2.6
12 |
13 | packages:
14 |
15 | /chalk/5.0.1:
16 | resolution: {integrity: sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==}
17 | engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
18 | dev: false
19 |
20 | /degit/2.8.4:
21 | resolution: {integrity: sha512-vqYuzmSA5I50J882jd+AbAhQtgK6bdKUJIex1JNfEUPENCgYsxugzKVZlFyMwV4i06MmnV47/Iqi5Io86zf3Ng==}
22 | engines: {node: '>=8.0.0'}
23 | hasBin: true
24 | dev: false
25 |
26 | /minimist/1.2.6:
27 | resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==}
28 | dev: false
29 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ['eslint:recommended', 'prettier'],
4 | plugins: ['svelte3'],
5 | overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
6 | parserOptions: {
7 | sourceType: 'module',
8 | ecmaVersion: 2019
9 | },
10 | env: {
11 | browser: true,
12 | es2017: true,
13 | node: true
14 | }
15 | };
16 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /build
4 | /.svelte-kit
5 | /package
6 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/.npmignore:
--------------------------------------------------------------------------------
1 | *
2 |
3 | !package.json
4 | !pnpm-lock.yaml
5 | !build/**
6 | !server/**
7 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "useTabs": true,
3 | "singleQuote": true,
4 | "trailingComma": "none",
5 | "printWidth": 100
6 | }
7 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | sveltepress-ui
5 | Documentation for humans.
6 |
7 |
8 |
9 |
10 |
11 |
12 | #
13 |
14 | ## What is sveltepress-ui?
15 |
16 | sveltepress-ui is a user interface for SveltePress that allows you to see stats about your instance, create new posts and toggle features!
17 |
18 | It's inspired by Vue CLI's ui tool.
19 |
20 | #
21 |
22 | ## Usage
23 |
24 | ```bash
25 | npx sveltepress-ui
26 | ```
27 |
28 | > For more info on how SveltePress works, how to set it up & more, visit [https://sveltepress.geopjr.dev/](https://sveltepress.geopjr.dev/)
29 |
30 | #
31 |
32 | ## Screenshots
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | #
47 |
48 | ## Contributing
49 |
50 | 1. Read the [Code of Conduct](https://github.com/GeopJr/SveltePress/blob/main/CODE_OF_CONDUCT.md)
51 | 2. Fork it ( https://github.com/GeopJr/SveltePress/fork )
52 | 3. Create your feature branch (git checkout -b my-new-feature)
53 | 4. Commit your changes (git commit -am 'Add some feature')
54 | 5. Push to the branch (git push origin my-new-feature)
55 | 6. Create a new Pull Request
56 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "paths": {
5 | "$lib": ["src/lib"],
6 | "$lib/*": ["src/lib/*"]
7 | }
8 | },
9 | "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
10 | }
11 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sveltepress-ui",
3 | "version": "1.0.0",
4 | "description": "Documentation for humans with a friendly UI.",
5 | "bin": {
6 | "sveltepress-ui": "server/server.js"
7 | },
8 | "repository": {
9 | "type": "git",
10 | "url": "git+https://github.com/GeopJr/SveltePress.git"
11 | },
12 | "keywords": [
13 | "svelte",
14 | "documentation",
15 | "sveltepress",
16 | "sveltekit",
17 | "ui"
18 | ],
19 | "author": "GeopJr",
20 | "license": "Unlicense",
21 | "bugs": {
22 | "url": "https://github.com/GeopJr/SveltePress/issues"
23 | },
24 | "homepage": "https://github.com/GeopJr/SveltePress#readme",
25 | "scripts": {
26 | "dev": "svelte-kit dev",
27 | "build": "svelte-kit build",
28 | "preview": "svelte-kit preview",
29 | "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
30 | "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
31 | },
32 | "devDependencies": {
33 | "@carbon/themes": "11.2.0",
34 | "@sveltejs/adapter-node": "1.0.0-next.73",
35 | "@sveltejs/kit": "1.0.0-next.324",
36 | "carbon-components": "10.56.0",
37 | "carbon-components-svelte": "0.63.3",
38 | "carbon-icons-svelte": "11.0.1",
39 | "carbon-preprocess-svelte": "0.9.0",
40 | "cl-editor": "2.3.0",
41 | "eslint": "8.14.0",
42 | "eslint-config-prettier": "8.5.0",
43 | "eslint-plugin-svelte3": "3.4.1",
44 | "prettier": "2.6.2",
45 | "prettier-plugin-svelte": "2.7.0",
46 | "sass": "1.51.0",
47 | "svelte": "3.47.0",
48 | "svelte-preprocess": "4.10.6"
49 | },
50 | "type": "module",
51 | "dependencies": {
52 | "express": "4.18.1",
53 | "open": "8.4.0",
54 | "turndown": "7.1.1"
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | SveltePress UI
8 | %svelte.head%
9 |
10 |
11 | %svelte.body%
12 |
13 |
14 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/global.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/lib/Theme.svelte:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/lib/components/content.svelte:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/lib/components/modal.svelte:
--------------------------------------------------------------------------------
1 |
11 |
12 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/lib/components/nav.svelte:
--------------------------------------------------------------------------------
1 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | setTheme(false)}
52 | />
53 | setTheme()}
58 | tooltipAlignment="end"
59 | />
60 |
61 | {#if hasSidebar}
62 |
63 | {/if}
64 |
65 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/lib/components/sidebar.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
20 |
27 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/lib/styles/global.scss:
--------------------------------------------------------------------------------
1 | $feature-flags: (
2 | enable-css-custom-properties: true,
3 | grid-columns-16: true
4 | );
5 |
6 | @import '@carbon/themes/scss/themes';
7 |
8 | :root {
9 | @include carbon--theme($carbon--theme--white, true);
10 | }
11 |
12 | :root[theme='g10'] {
13 | @include carbon--theme($carbon--theme--g10, true);
14 | }
15 |
16 | :root[theme='g90'] {
17 | @include carbon--theme($carbon--theme--g90, true);
18 | }
19 |
20 | :root[theme='g100'] {
21 | @include carbon--theme($carbon--theme--g100, true);
22 | }
23 |
24 | $css--font-face: true;
25 | $css--helpers: true;
26 | $css--body: true;
27 | $css--use-layer: true;
28 | $css--reset: true;
29 | $css--default-type: true;
30 | $css--plex: true;
31 |
32 | @import 'carbon-components/scss/globals/scss/_css--reset.scss';
33 | @import 'carbon-components/scss/globals/scss/_css--font-face.scss';
34 | @import 'carbon-components/scss/globals/scss/_css--helpers.scss';
35 | @import 'carbon-components/scss/globals/scss/_css--body.scss';
36 | @import 'carbon-components/scss/globals/grid/_grid.scss';
37 |
38 | /* import individual components SCSS */
39 | @import 'carbon-components/scss/components/button/button';
40 | @import 'carbon-components/scss/components/ui-shell/ui-shell';
41 | @import 'carbon-components/scss/components/tile/tile';
42 | @import 'carbon-components/scss/components/modal/modal';
43 | @import 'carbon-components/scss/components/loading/loading';
44 | @import 'carbon-components/scss/components/overflow-menu/overflow-menu';
45 | @import 'carbon-components/scss/components/data-table/data-table';
46 | @import 'carbon-components/scss/components/select/select';
47 | @import 'carbon-components/scss/components/breadcrumb/breadcrumb';
48 | @import 'carbon-components/scss/components/code-snippet/code-snippet';
49 | @import 'carbon-components/scss/components/text-input/text-input';
50 |
51 | /* import patches */
52 | @import './patches.scss';
53 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/lib/styles/patches.scss:
--------------------------------------------------------------------------------
1 | .sp--sidebar-grandparent {
2 | pointer-events: none;
3 | }
4 | .bx--btn {
5 | overflow-wrap: anywhere;
6 | /* Safari & Opera */
7 | word-break: break-word;
8 | }
9 | .bx--switcher__item-link:focus {
10 | outline-color: var(--cds-button-primary);
11 | }
12 | #main-content ul {
13 | list-style-type: square;
14 | }
15 | li {
16 | line-height: var(--cds-body-long-02-line-height, 1.5);
17 | }
18 | a {
19 | color: var(--cds-button-primary);
20 | line-height: var(--cds-body-long-02-line-height, 1.5);
21 | }
22 | blockquote {
23 | background-color: var(--cds-ui-background);
24 | padding: 0.2rem 1rem;
25 | margin: 1rem 0;
26 | }
27 | p {
28 | > img {
29 | max-width: 100%;
30 | }
31 |
32 | > code {
33 | background-color: var(--cds-ui-background);
34 | }
35 | }
36 |
37 | pre {
38 | background-color: var(--cds-ui-background);
39 | margin: 1.2rem 0;
40 | padding: 1rem;
41 | }
42 |
43 | :root[theme='g10'],
44 | :root[theme='white'] {
45 | pre {
46 | background-color: var(--cds-ui-03);
47 | }
48 | }
49 |
50 | pre,
51 | code {
52 | white-space: pre-wrap;
53 | }
54 |
55 | .bx--btn--primary:hover {
56 | background-color: var(--cds-button-primary-hover);
57 | }
58 | .bx--side-nav ~ .bx--content {
59 | margin-left: 0;
60 | }
61 |
62 | :root,
63 | :root[theme='g10'],
64 | :root[theme='g100'],
65 | :root[theme='g90'],
66 | :root[theme='white'] {
67 | --cds-body-long-02-line-height: 1.8;
68 | --cds-interactive-01: #ff3e00;
69 | --cds-button-primary: #ff3e00;
70 | --cds-button-primary-hover: #e23900;
71 | --cds-button-primary-active: #c23000;
72 | --cds-focus: var(--cds-button-primary);
73 | }
74 |
75 | a.bx--side-nav__link[aria-current='page'],
76 | a.bx--side-nav__link--current {
77 | &::before {
78 | background-color: var(--cds-button-primary);
79 | }
80 | }
81 |
82 | a.bx--header__name,
83 | .bx--header__action,
84 | a.bx--header__menu-item,
85 | .bx--skip-to-content {
86 | &:focus {
87 | border-color: var(--cds-button-primary);
88 | }
89 | }
90 |
91 | [role='search'].active {
92 | outline-color: var(--cds-button-primary) !important;
93 | }
94 |
95 | .bx--side-nav.bx--side-nav--expanded ~ .bx--content {
96 | @media only screen and (max-width: 1056px) {
97 | margin-left: 0rem;
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/routes/__error.svelte:
--------------------------------------------------------------------------------
1 |
11 |
12 |
16 |
17 |
18 | {status}
19 | {error}
20 |
21 |
22 |
29 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/routes/__layout.svelte:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/routes/dashboard.svelte:
--------------------------------------------------------------------------------
1 |
22 |
23 |
30 |
31 | Dashboard
32 |
33 |
34 |
35 | Total GRANDPARENTs
38 | {dashboard.data.stats.grandParents.toLocaleString()}
41 | Total PARENTs
44 | {dashboard.data.stats.parents.toLocaleString()}
47 | Total Posts
50 | {dashboard.data.stats.posts.toLocaleString()}
53 |
54 |
55 | Project Directory
58 |
63 |
65 |
66 |
67 | GUIs
70 |
71 |
72 |
75 | Pandoc
78 |
79 |
80 |
83 | Theme
86 |
87 | {dashboard.data.theme}
88 |
91 |
92 |
93 |
94 |
107 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/src/stores.js:
--------------------------------------------------------------------------------
1 | import { writable } from 'svelte/store';
2 |
3 | // default theme color
4 | export const theme = writable('g100');
5 |
6 | export const workDir = writable()
7 |
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/static/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/create-sveltepress-app/ui/static/favicon.png
--------------------------------------------------------------------------------
/create-sveltepress-app/ui/svelte.config.js:
--------------------------------------------------------------------------------
1 | import { optimizeImports } from 'carbon-preprocess-svelte';
2 | import sveltePreprocess from 'svelte-preprocess';
3 | import node from '@sveltejs/adapter-node';
4 |
5 | /** @type {import('@sveltejs/kit').Config} */
6 | const config = {
7 | kit: {
8 | adapter: node(),
9 | },
10 | preprocess: [
11 | optimizeImports(),
12 | sveltePreprocess({
13 | scss: true,
14 | sass: true,
15 | replace: [
16 | [
17 | "import '$lib/styles/global.scss'",
18 | process.env.NODE_ENV === 'production'
19 | ? "import '$lib/styles/global.scss'"
20 | : "import 'carbon-components-svelte/css/all.css';import '$lib/styles/patches.scss'"
21 | ]
22 | ]
23 | })
24 | ]
25 | };
26 |
27 | export default config;
28 |
--------------------------------------------------------------------------------
/degit.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "action": "remove",
4 | "files": ["UNLICENSE", "CODE_OF_CONDUCT.md", "create-sveltepress-app/", "gui/", "pandoc/"]
5 | }
6 | ]
7 |
--------------------------------------------------------------------------------
/gui/Flutter/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
48 | lib/title.dart
49 | *.png
50 | index.json
51 | web/manifest.json
52 |
53 | /pnpm-lock.yaml
54 | /yarn.lock
55 | /package-lock.json
56 |
57 | # Symlinks
58 | /assets
59 |
--------------------------------------------------------------------------------
/gui/Flutter/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: f4abaa0735eba4dfd8f33f73363911d63931fe03
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/gui/Flutter/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | #include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/gui/Flutter/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
13 | #app/src/main/AndroidManifest.xml
14 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 30
29 |
30 | defaultConfig {
31 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
32 | applicationId "dev.geopjr.sveltepress.sveltepress"
33 | minSdkVersion 19
34 | targetSdkVersion 30
35 | versionCode flutterVersionCode.toInteger()
36 | versionName flutterVersionName
37 | }
38 |
39 | buildTypes {
40 | release {
41 | // TODO: Add your own signing config for the release build.
42 | // Signing with the debug keys for now, so `flutter run --release` works.
43 | signingConfig signingConfigs.debug
44 | }
45 | }
46 | }
47 |
48 | flutter {
49 | source '../..'
50 | }
51 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
13 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/main/AndroidManifest.xml.hbs:
--------------------------------------------------------------------------------
1 |
3 |
6 |
13 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/main/java/dev/geopjr/sveltepress/sveltepress/MainActivity.java:
--------------------------------------------------------------------------------
1 | package dev.geopjr.sveltepress.sveltepress;
2 |
3 | import io.flutter.embedding.android.FlutterActivity;
4 |
5 | public class MainActivity extends FlutterActivity {
6 | }
7 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/gui/Flutter/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gui/Flutter/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:4.1.0'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | project.evaluationDependsOn(':app')
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gui/Flutter/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/gui/Flutter/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/gui/Flutter/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/ephemeral/
22 | Flutter/app.flx
23 | Flutter/app.zip
24 | Flutter/flutter_assets/
25 | Flutter/flutter_export_environment.sh
26 | ServiceDefinitions.json
27 | Runner/GeneratedPluginRegistrant.*
28 |
29 | # Exceptions to above rules.
30 | !default.mode1v3
31 | !default.mode2v3
32 | !default.pbxuser
33 | !default.perspectivev3
34 |
35 | Flutter/AppFrameworkInfo.plist
36 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Flutter/AppFrameworkInfo.plist.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | {{title}}
9 | CFBundleIdentifier
10 | {{bundle}}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 | #import "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | sveltepress
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/gui/Flutter/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/gui/Flutter/lib/title.dart.hbs:
--------------------------------------------------------------------------------
1 | class SveltePressMeta {
2 | static const String title = "{{title}}";
3 | }
4 |
--------------------------------------------------------------------------------
/gui/Flutter/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
3 | default.desktop
4 |
--------------------------------------------------------------------------------
/gui/Flutter/linux/default.desktop.hbs:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name={{title}}
4 | Exec={{exec}} %F
5 | Icon=default
6 | Comment=A Flutter based GUI from SveltePress
7 | Terminal=true
8 | Categories=Utility;
--------------------------------------------------------------------------------
/gui/Flutter/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 |
11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
12 | # which isn't available in 3.10.
13 | function(list_prepend LIST_NAME PREFIX)
14 | set(NEW_LIST "")
15 | foreach(element ${${LIST_NAME}})
16 | list(APPEND NEW_LIST "${PREFIX}${element}")
17 | endforeach(element)
18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
19 | endfunction()
20 |
21 | # === Flutter Library ===
22 | # System-level dependencies.
23 | find_package(PkgConfig REQUIRED)
24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
27 |
28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
29 |
30 | # Published to parent scope for install step.
31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
35 |
36 | list(APPEND FLUTTER_LIBRARY_HEADERS
37 | "fl_basic_message_channel.h"
38 | "fl_binary_codec.h"
39 | "fl_binary_messenger.h"
40 | "fl_dart_project.h"
41 | "fl_engine.h"
42 | "fl_json_message_codec.h"
43 | "fl_json_method_codec.h"
44 | "fl_message_codec.h"
45 | "fl_method_call.h"
46 | "fl_method_channel.h"
47 | "fl_method_codec.h"
48 | "fl_method_response.h"
49 | "fl_plugin_registrar.h"
50 | "fl_plugin_registry.h"
51 | "fl_standard_message_codec.h"
52 | "fl_standard_method_codec.h"
53 | "fl_string_codec.h"
54 | "fl_value.h"
55 | "fl_view.h"
56 | "flutter_linux.h"
57 | )
58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
59 | add_library(flutter INTERFACE)
60 | target_include_directories(flutter INTERFACE
61 | "${EPHEMERAL_DIR}"
62 | )
63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
64 | target_link_libraries(flutter INTERFACE
65 | PkgConfig::GTK
66 | PkgConfig::GLIB
67 | PkgConfig::GIO
68 | )
69 | add_dependencies(flutter flutter_assemble)
70 |
71 | # === Flutter tool backend ===
72 | # _phony_ is a non-existent file to force this command to run every time,
73 | # since currently there's no way to get a full input/output list from the
74 | # flutter tool.
75 | add_custom_command(
76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
78 | COMMAND ${CMAKE_COMMAND} -E env
79 | ${FLUTTER_TOOL_ENVIRONMENT}
80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
82 | VERBATIM
83 | )
84 | add_custom_target(flutter_assemble DEPENDS
85 | "${FLUTTER_LIBRARY}"
86 | ${FLUTTER_LIBRARY_HEADERS}
87 | )
88 |
--------------------------------------------------------------------------------
/gui/Flutter/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/gui/Flutter/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/gui/Flutter/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | set(PLUGIN_BUNDLED_LIBRARIES)
9 |
10 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
11 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
12 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
15 | endforeach(plugin)
16 |
--------------------------------------------------------------------------------
/gui/Flutter/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/gui/Flutter/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/xcuserdata/
7 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import wakelock_macos
9 |
10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
11 | WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
12 | }
13 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
64 |
65 |
71 |
73 |
79 |
80 |
81 |
82 |
84 |
85 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = sveltepress
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = dev.geopjr.sveltepress.sveltepress
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2021 dev.geopjr.sveltepress. All rights reserved.
15 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/gui/Flutter/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gui/Flutter/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sveltepress-flutter",
3 | "version": "0.0.1",
4 | "description": "A Flutter based GUI from SveltePress",
5 | "type": "module",
6 | "scripts": {
7 | "start": "flutter run",
8 | "start:linux": "pnpm run start -- -d linux",
9 | "start:macos": "pnpm run start -- -d macos",
10 | "start:web": "pnpm run start -- -d chrome",
11 | "start:web:html": "pnpm run start -- -d chrome --web-renderer html",
12 | "start:web:canvaskit": "pnpm run start -- -d chrome --web-renderer canvaskit",
13 | "start:windows": "pnpm run start -- -d windows",
14 | "prepare": "node scripts/prepareParents.js && node scripts/prepareTitle.js",
15 | "rename": "node scripts/renamePackage.js",
16 | "icongen": "flutter pub run flutter_launcher_icons:main",
17 | "build": "flutter build",
18 | "build:aab": "pnpm run build -- appbundle",
19 | "build:apk": "pnpm run build -- apk --split-per-abi",
20 | "build:ipa": "pnpm run build -- ipa --release",
21 | "build:app": "pnpm run build -- macos --release",
22 | "build:linux": "pnpm run build -- linux --release",
23 | "build:windows": "pnpm run build -- windows --release",
24 | "build:web:html": "pnpm run build -- web --web-renderer html",
25 | "build:web:canvaskit": "pnpm run build -- web --web-renderer canvaskit",
26 | "preinstall": "node ../generateSymlinks.mjs"
27 | },
28 | "license": "Unlicense",
29 | "devDependencies": {
30 | "handlebars": "4.7.7",
31 | "uuid": "8.3.2"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/gui/Flutter/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: sveltepress
2 | description: A new Flutter project.
3 | publish_to: 'none'
4 | version: 1.0.0+1
5 | environment:
6 | sdk: '>=2.12.0 <3.0.0'
7 | dependencies:
8 | flutter:
9 | sdk: flutter
10 | cupertino_icons: ^1.0.2
11 | flutter_html: ^2.1.1
12 | dev_dependencies:
13 | flutter_test:
14 | sdk: flutter
15 | change_app_package_name: ^1.0.0
16 | flutter_launcher_icons: '^0.9.1'
17 | flutter:
18 | assets:
19 | - index.json
20 | - assets/
21 | uses-material-design: true
22 | flutter_icons:
23 | android: true
24 | ios: true
25 | macos: true
26 | windows: true
27 | web: true
28 | image_path: '../sveltepresslogo.png'
29 |
--------------------------------------------------------------------------------
/gui/Flutter/scripts/prepareParents.js:
--------------------------------------------------------------------------------
1 | import { writeFileSync } from 'fs';
2 | import { v4 as uuidv4 } from 'uuid';
3 | import Sidebar from '../../../src/lib/SveltePress/db/sveltePressSidebar.js';
4 | import Index from '../../../src/lib/SveltePress/db/sveltePressIndex.js';
5 | import { mdConverter } from '../../../src/lib/SveltePress/markdown/MDConverter.js';
6 |
7 | const finArr = [];
8 |
9 | for (const [key, value] of Sidebar) {
10 | const obj = {};
11 | const postsArr = [];
12 | let name = key;
13 | for (const [keyP, valueP] of value) {
14 | if (keyP.toLowerCase() === key + '/readme.md') {
15 | name = valueP.name;
16 | } else {
17 | postsArr.push({
18 | parent: true,
19 | name: valueP.name,
20 | html: '',
21 | id: ''
22 | });
23 | }
24 | for (const [keyC, valueC] of valueP.files) {
25 | postsArr.push({
26 | parent: false,
27 | name: valueC,
28 | html: mdConverter(Index.get(keyC)).replace(
29 | /\:_DEBUG>")
39 | endfunction()
40 |
41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42 |
43 | # Flutter library and tool build rules.
44 | add_subdirectory(${FLUTTER_MANAGED_DIR})
45 |
46 | # Application build
47 | add_subdirectory("runner")
48 |
49 | # Generated plugin build rules, which manage building the plugins and adding
50 | # them to the application.
51 | include(flutter/generated_plugins.cmake)
52 |
53 |
54 | # === Installation ===
55 | # Support files are copied into place next to the executable, so that it can
56 | # run in place. This is done instead of making a separate bundle (as on Linux)
57 | # so that building and running from within Visual Studio will work.
58 | set(BUILD_BUNDLE_DIR "$")
59 | # Make the "install" step default, as it's required to run.
60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
63 | endif()
64 |
65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
67 |
68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
69 | COMPONENT Runtime)
70 |
71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
72 | COMPONENT Runtime)
73 |
74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
75 | COMPONENT Runtime)
76 |
77 | if(PLUGIN_BUNDLED_LIBRARIES)
78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
80 | COMPONENT Runtime)
81 | endif()
82 |
83 | # Fully re-copy the assets directory on each build to avoid having stale files
84 | # from a previous install.
85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
86 | install(CODE "
87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
88 | " COMPONENT Runtime)
89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
91 |
92 | # Install the AOT library on non-Debug builds only.
93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
94 | CONFIGURATIONS Profile;Release
95 | COMPONENT Runtime)
96 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
11 |
12 | # === Flutter Library ===
13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
14 |
15 | # Published to parent scope for install step.
16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
20 |
21 | list(APPEND FLUTTER_LIBRARY_HEADERS
22 | "flutter_export.h"
23 | "flutter_windows.h"
24 | "flutter_messenger.h"
25 | "flutter_plugin_registrar.h"
26 | "flutter_texture_registrar.h"
27 | )
28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
29 | add_library(flutter INTERFACE)
30 | target_include_directories(flutter INTERFACE
31 | "${EPHEMERAL_DIR}"
32 | )
33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
34 | add_dependencies(flutter flutter_assemble)
35 |
36 | # === Wrapper ===
37 | list(APPEND CPP_WRAPPER_SOURCES_CORE
38 | "core_implementations.cc"
39 | "standard_codec.cc"
40 | )
41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
43 | "plugin_registrar.cc"
44 | )
45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
46 | list(APPEND CPP_WRAPPER_SOURCES_APP
47 | "flutter_engine.cc"
48 | "flutter_view_controller.cc"
49 | )
50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
51 |
52 | # Wrapper sources needed for a plugin.
53 | add_library(flutter_wrapper_plugin STATIC
54 | ${CPP_WRAPPER_SOURCES_CORE}
55 | ${CPP_WRAPPER_SOURCES_PLUGIN}
56 | )
57 | apply_standard_settings(flutter_wrapper_plugin)
58 | set_target_properties(flutter_wrapper_plugin PROPERTIES
59 | POSITION_INDEPENDENT_CODE ON)
60 | set_target_properties(flutter_wrapper_plugin PROPERTIES
61 | CXX_VISIBILITY_PRESET hidden)
62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
63 | target_include_directories(flutter_wrapper_plugin PUBLIC
64 | "${WRAPPER_ROOT}/include"
65 | )
66 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
67 |
68 | # Wrapper sources needed for the runner.
69 | add_library(flutter_wrapper_app STATIC
70 | ${CPP_WRAPPER_SOURCES_CORE}
71 | ${CPP_WRAPPER_SOURCES_APP}
72 | )
73 | apply_standard_settings(flutter_wrapper_app)
74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
75 | target_include_directories(flutter_wrapper_app PUBLIC
76 | "${WRAPPER_ROOT}/include"
77 | )
78 | add_dependencies(flutter_wrapper_app flutter_assemble)
79 |
80 | # === Flutter tool backend ===
81 | # _phony_ is a non-existent file to force this command to run every time,
82 | # since currently there's no way to get a full input/output list from the
83 | # flutter tool.
84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
86 | add_custom_command(
87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
89 | ${CPP_WRAPPER_SOURCES_APP}
90 | ${PHONY_OUTPUT}
91 | COMMAND ${CMAKE_COMMAND} -E env
92 | ${FLUTTER_TOOL_ENVIRONMENT}
93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
94 | windows-x64 $
95 | VERBATIM
96 | )
97 | add_custom_target(flutter_assemble DEPENDS
98 | "${FLUTTER_LIBRARY}"
99 | ${FLUTTER_LIBRARY_HEADERS}
100 | ${CPP_WRAPPER_SOURCES_CORE}
101 | ${CPP_WRAPPER_SOURCES_PLUGIN}
102 | ${CPP_WRAPPER_SOURCES_APP}
103 | )
104 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | set(PLUGIN_BUNDLED_LIBRARIES)
9 |
10 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
11 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
12 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
15 | endforeach(plugin)
16 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(runner LANGUAGES CXX)
3 |
4 | add_executable(${BINARY_NAME} WIN32
5 | "flutter_window.cpp"
6 | "main.cpp"
7 | "utils.cpp"
8 | "win32_window.cpp"
9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
10 | "Runner.rc"
11 | "runner.exe.manifest"
12 | )
13 | apply_standard_settings(${BINARY_NAME})
14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
17 | add_dependencies(${BINARY_NAME} flutter_assemble)
18 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "dev.geopjr.sveltepress" "\0"
93 | VALUE "FileDescription", "A new Flutter project." "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "sveltepress" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2021 dev.geopjr.sveltepress. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "sveltepress.exe" "\0"
98 | VALUE "ProductName", "sveltepress" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 | return true;
30 | }
31 |
32 | void FlutterWindow::OnDestroy() {
33 | if (flutter_controller_) {
34 | flutter_controller_ = nullptr;
35 | }
36 |
37 | Win32Window::OnDestroy();
38 | }
39 |
40 | LRESULT
41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
42 | WPARAM const wparam,
43 | LPARAM const lparam) noexcept {
44 | // Give Flutter, including plugins, an opportunity to handle window messages.
45 | if (flutter_controller_) {
46 | std::optional result =
47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
48 | lparam);
49 | if (result) {
50 | return *result;
51 | }
52 | }
53 |
54 | switch (message) {
55 | case WM_FONTCHANGE:
56 | flutter_controller_->engine()->ReloadSystemFonts();
57 | break;
58 | }
59 |
60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
61 | }
62 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.CreateAndShow(L"sveltepress", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/gui/Flutter/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | if (target_length == 0) {
52 | return std::string();
53 | }
54 | std::string utf8_string;
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/gui/Flutter/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------
/gui/GTK/.gitignore:
--------------------------------------------------------------------------------
1 | .flatpak-builder/
2 | build/
3 | dist/
4 | src/ui.glade
5 | /pnpm-lock.yaml
6 | /yarn.lock
7 | /package-lock.json
8 |
9 | # Symlinks
10 | /assets
11 |
--------------------------------------------------------------------------------
/gui/GTK/esbuild.cjs:
--------------------------------------------------------------------------------
1 | const fs = require('fs-extra');
2 |
3 | const prod = process.argv.includes('--prod');
4 |
5 | /** @type {import('esbuild').BuildOptions} */
6 | const options = {
7 | entryPoints: ['src/index.js'],
8 | bundle: true,
9 | platform: 'node',
10 | outdir: 'dist',
11 | loader: Object.fromEntries(
12 | ['png', 'svg', 'jpg', 'jpeg', 'gif', 'glade'].map((ext) => [`.${ext}`, 'file'])
13 | ),
14 | minify: prod,
15 | external: ['nock', 'aws-sdk', 'mock-aws-s3', 'node-gtk'],
16 | format: 'cjs',
17 | outExtension: { '.js': '.cjs' }
18 | };
19 |
20 | fs.emptyDirSync(options.outdir);
21 |
22 | require('esbuild')
23 | .build(options)
24 | .catch(() => process.exit(1));
25 |
--------------------------------------------------------------------------------
/gui/GTK/extra/app.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=SP__CUSTOM__NAME
4 | Exec=run.sh %F
5 | Icon=default
6 | Comment=A GTK based GUI from SveltePress
7 | Terminal=true
8 | Categories=Utility;
9 |
--------------------------------------------------------------------------------
/gui/GTK/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sveltepress-gtk",
3 | "version": "0.0.1",
4 | "description": "A GTK based GUI from SveltePress",
5 | "main": "src/index.js",
6 | "type": "module",
7 | "scripts": {
8 | "build": "node ./esbuild.cjs --prod",
9 | "dev": "node ./esbuild.cjs && node ./dist/index.cjs",
10 | "dev:watch": "nodemon -e js,ts,tsx,svg,glade --ignore node_modules/ --exec pnpm start",
11 | "prepare": "node scripts/prepareGlade.js",
12 | "start": "node dist/index.cjs",
13 | "preinstall": "node ../generateSymlinks.mjs"
14 | },
15 | "dependencies": {
16 | "node-gtk": "^0.10.0"
17 | },
18 | "devDependencies": {
19 | "esbuild": "0.14.38",
20 | "fs-extra": "10.1.0",
21 | "handlebars": "4.7.7",
22 | "nodemon": "2.0.16"
23 | },
24 | "license": "Unlicense"
25 | }
26 |
--------------------------------------------------------------------------------
/gui/GTK/scripts/generateFlatpak.js:
--------------------------------------------------------------------------------
1 | import Config from '../../../sveltePress.config.js';
2 | import { writeFileSync } from 'fs';
3 | const name = Config.title.replace(/[^a-z0-9]/gi, '');
4 | const nameSafe = name.replace(/[^a-z]/gi, '').toLowerCase();
5 |
6 | const recipe = {
7 | 'app-id': `dev.geopjr.sveltepress.${nameSafe}`,
8 | runtime: 'org.gnome.Platform',
9 | 'runtime-version': '40',
10 | sdk: 'org.gnome.Sdk',
11 | command: `${nameSafe}.sh`,
12 | 'finish-args': ['--socket=wayland', '--socket=fallback-x11', '--share=ipc'],
13 | modules: [
14 | {
15 | name: 'nodejs',
16 | cleanup: [
17 | '/include',
18 | '/share',
19 | '/app/lib/node_modules/npm/changelogs',
20 | '/app/lib/node_modules/npm/doc',
21 | '/app/lib/node_modules/npm/html',
22 | '/app/lib/node_modules/npm/man',
23 | '/app/lib/node_modules/npm/scripts'
24 | ],
25 | sources: [
26 | {
27 | type: 'archive',
28 | url: 'https://nodejs.org/dist/v16.6.2/node-v16.6.2-linux-x64.tar.xz',
29 | sha256: '90c88cf6ca06dcd6d20c2b6dba5ff84d1f831446c25ef650f86e86bb94239353'
30 | }
31 | ]
32 | },
33 | {
34 | name: 'sveltepress-gtk',
35 | buildsystem: 'simple',
36 | 'build-commands': [
37 | 'npm install --prefix=electron-quick-start --offline --cache=$FLATPAK_BUILDER_BUILDDIR/flatpak-node/npm-cache',
38 | 'npm run build',
39 | 'mkdir /app/bin',
40 | 'cp -ra dist/* /app/main/',
41 | `desktop-file-edit --set-key=Name --set-value='${name}' /app/share/applications/dev.geopjr.sveltepress.${nameSafe}.desktop`,
42 | `desktop-file-edit --set-key=Exec --set-value='${nameSafe}.sh %F' /app/share/applications/dev.geopjr.sveltepress.${nameSafe}.desktop`,
43 | 'install -D -m 0755 dist/ /app/bin/dist/',
44 | `install -D -m 0644 dev.geopjr.sveltepress.${nameSafe}.png /app/share/icons/hicolor/0x0/apps/dev.geopjr.sveltepress.${nameSafe}.png`
45 | ],
46 | sources: [
47 | {
48 | type: 'script',
49 | 'dest-filename': `${nameSafe}.sh`,
50 | commands: ['node /app/main/index.cjs']
51 | },
52 | 'generated-sources.json',
53 | {
54 | type: 'file',
55 | path: '../../sveltepresslogo.png',
56 | 'dest-filename': `dev.geopjr.sveltepress.${nameSafe}.png`
57 | },
58 | {
59 | type: 'file',
60 | path: 'extra/app.desktop',
61 | 'dest-filename': `dev.geopjr.sveltepress.${nameSafe}.desktop`
62 | }
63 | ]
64 | }
65 | ]
66 | };
67 |
68 | writeFileSync(`dev.geopjr.sveltepress.${nameSafe}.json`, JSON.stringify(recipe, null, 2));
69 |
--------------------------------------------------------------------------------
/gui/GTK/scripts/prepareGlade.js:
--------------------------------------------------------------------------------
1 | import Handlebars from 'handlebars';
2 | import { readFileSync, writeFileSync } from 'fs';
3 | import Sidebar from '../../../src/lib/SveltePress/db/sveltePressSidebar.js';
4 | import Config from '../../../sveltePress.config.js';
5 |
6 | const title = Config.title;
7 |
8 | const hbsArr = [];
9 |
10 | let id = 0;
11 |
12 | for (const [key, value] of Sidebar) {
13 | const hbsObj = {};
14 | const posts = [];
15 | let name = key;
16 | for (const [keyP, valueP] of value) {
17 | if (keyP.toLowerCase() === key + '/readme.md') {
18 | name = valueP.name;
19 | } else {
20 | posts.push({
21 | parent: true,
22 | name: valueP.name,
23 | path: keyP, // useless
24 | pID: ++id
25 | });
26 | }
27 | for (const [keyC, valueC] of valueP.files) {
28 | posts.push({
29 | name: valueC,
30 | path: keyC,
31 | pID: ++id
32 | });
33 | }
34 | }
35 | hbsObj.name = name;
36 | hbsObj.posts = posts;
37 | hbsArr.push(hbsObj);
38 | }
39 |
40 | const glade = readFileSync('./ui.glade.hbs', 'utf8');
41 | const template = Handlebars.compile(glade);
42 | const compiled = template({ grandparents: hbsArr, title: title });
43 |
44 | writeFileSync('./src/ui.glade', compiled);
45 |
--------------------------------------------------------------------------------
/gui/GTK/src/index.js:
--------------------------------------------------------------------------------
1 | import gi from 'node-gtk';
2 | const Gtk = gi.require('Gtk', '3.0');
3 | import Index from '../../../src/lib/SveltePress/db/sveltePressIndex.js';
4 | import { mdConverter } from '../../../src/lib/SveltePress/markdown/MDConverter.js';
5 | import Config from '../../../sveltePress.config.js';
6 | import gladeFile from './ui.glade';
7 |
8 | const title = Config.title;
9 |
10 | const WebKit2 = gi.require('WebKit2');
11 | new WebKit2.WebView()
12 |
13 | gi.startLoop();
14 | Gtk.init();
15 |
16 | const builder = Gtk.Builder.newFromString(gladeFile, -1);
17 | const win = builder.getObject('mainwindow');
18 | const webkitview = builder.getObject('webkit');
19 | const webkitParent = builder.getObject('webkitParent');
20 |
21 | function injectKitFix(content) {
22 | const head =
23 | '';
24 | const body = `${content}`;
25 | return head + body;
26 | }
27 |
28 | const webSettings = webkitview.getSettings();
29 | webSettings.allowFileAccessFromFileUrls = true;
30 | webkitview.loadHtmlString(
31 | injectKitFix(`Welcome to ${title} `),
32 | 'text/html',
33 | 'utf-8',
34 | 'file://'
35 | );
36 |
37 | const handlers = {
38 | onWindowShow: Gtk.main,
39 | onWindowDestroy: Gtk.mainQuit,
40 | renderWebview: function (x) {
41 | webkitParent.setPolicy(2, 2);
42 | webkitParent.unsetPlacement();
43 | const path = builder.getObject(x.getName().replace('__ROW__', '__DATA__'));
44 |
45 | const html = mdConverter(Index.get(path.getText())).replace(
46 | /\
--------------------------------------------------------------------------------
/gui/QT/deploy/config.json:
--------------------------------------------------------------------------------
1 | {"appName":"SveltePress"}
--------------------------------------------------------------------------------
/gui/QT/deploy/darwin/SveltePress/Contents/Info.plist.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | qode
9 | CFBundleIdentifier
10 | dev.geopjr.sveltepress.{{bundle}}
11 | CFBundleSignature
12 | ????
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | SP__CUSTOM__NAME
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | CFBundleSupportedPlatforms
24 |
25 | MacOSX
26 |
27 | LSMinimumSystemVersion
28 | 10.15
29 | NSHighResolutionCapable
30 | True
31 |
32 |
33 |
--------------------------------------------------------------------------------
/gui/QT/deploy/darwin/SveltePress/Contents/MacOS/qode.json:
--------------------------------------------------------------------------------
1 | {
2 | "distPath": "../Resources/"
3 | }
4 |
--------------------------------------------------------------------------------
/gui/QT/deploy/darwin/SveltePress/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPL????
--------------------------------------------------------------------------------
/gui/QT/deploy/darwin/SveltePress/Contents/Resources/entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.cs.allow-dyld-environment-variables
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.cs.allow-unsigned-executable-memory
10 |
11 | com.apple.security.cs.disable-executable-page-protection
12 |
13 | com.apple.security.cs.disable-library-validation
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/gui/QT/deploy/darwin/SveltePress/Contents/Resources/index.js:
--------------------------------------------------------------------------------
1 | const path = require("path");
2 | // Fix so that macos resources are found correctly
3 | // since webpack will bundle them such that the expected path is /dist from cwd
4 | process.chdir(path.resolve(path.dirname(process.execPath), "..", "Resources"));
5 | // Now start loading the actual bundle
6 | require("./dist");
7 |
--------------------------------------------------------------------------------
/gui/QT/deploy/linux/SveltePress/default.desktop.hbs:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name={{title}}
4 | Exec=AppRun %F
5 | Icon=default
6 | Comment=A QT based GUI from SveltePress
7 | Terminal=true
8 | Categories=Utility;
--------------------------------------------------------------------------------
/gui/QT/deploy/linux/SveltePress/index.js:
--------------------------------------------------------------------------------
1 | const path = require("path");
2 | // Fix so that linux resources are found correctly
3 | // since webpack will bundle them such that the expected path is /dist from cwd
4 | process.chdir(path.resolve(path.dirname(process.execPath)));
5 | // Now start loading the actual bundle
6 | require("./dist");
7 |
--------------------------------------------------------------------------------
/gui/QT/deploy/linux/SveltePress/qode.json:
--------------------------------------------------------------------------------
1 | {
2 | "distPath": "./index.js"
3 | }
4 |
--------------------------------------------------------------------------------
/gui/QT/deploy/win32/SveltePress/platforms/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/gui/QT/deploy/win32/SveltePress/platforms/.gitkeep
--------------------------------------------------------------------------------
/gui/QT/deploy/win32/SveltePress/qode.json:
--------------------------------------------------------------------------------
1 | {
2 | "distPath": ".\\dist"
3 | }
4 |
--------------------------------------------------------------------------------
/gui/QT/deploy/win32/SveltePress/styles/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/gui/QT/deploy/win32/SveltePress/styles/.gitkeep
--------------------------------------------------------------------------------
/gui/QT/esbuild.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs-extra');
2 |
3 | /** @type {import('esbuild').Plugin} */
4 | const nativeNodeModulesPlugin = {
5 | name: 'native-node-modules',
6 | setup(build) {
7 | // If a ".node" file is imported within a module in the "file" namespace, resolve
8 | // it to an absolute path and put it into the "node-file" virtual namespace.
9 | build.onResolve({ filter: /\.node$/, namespace: 'file' }, (args) => ({
10 | path: require.resolve(args.path, { paths: [args.resolveDir] }),
11 | namespace: 'node-file'
12 | }));
13 |
14 | // Files in the "node-file" virtual namespace call "require()" on the
15 | // path from esbuild of the ".node" file in the output directory.
16 | build.onLoad({ filter: /.*/, namespace: 'node-file' }, (args) => ({
17 | contents: `
18 | import path from ${JSON.stringify(args.path)}
19 | try { module.exports = require(path) }
20 | catch {}
21 | `
22 | }));
23 |
24 | // If a ".node" file is imported within a module in the "node-file" namespace, put
25 | // it in the "file" namespace where esbuild's default loading behavior will handle
26 | // it. It is already an absolute path since we resolved it to one above.
27 | build.onResolve({ filter: /\.node$/, namespace: 'node-file' }, (args) => ({
28 | path: args.path,
29 | namespace: 'file'
30 | }));
31 |
32 | // Tell esbuild's default loading behavior to use the "file" loader for
33 | // these ".node" files.
34 | let opts = build.initialOptions;
35 | opts.loader = opts.loader || {};
36 | opts.loader['.node'] = 'file';
37 | }
38 | };
39 |
40 | const prod = process.argv.includes('--prod');
41 |
42 | /** @type {import('esbuild').BuildOptions} */
43 | const options = {
44 | entryPoints: ['src/index.js'],
45 | bundle: true,
46 | platform: 'node',
47 | outdir: 'dist',
48 | loader: Object.fromEntries(
49 | ['png', 'svg', 'jpg', 'jpeg', 'gif'].map((ext) => [`.${ext}`, 'file'])
50 | ),
51 | minify: prod,
52 | plugins: [nativeNodeModulesPlugin]
53 | };
54 |
55 | fs.emptyDirSync(options.outdir);
56 |
57 | require('esbuild')
58 | .build(options)
59 | .catch(() => process.exit(1));
60 |
--------------------------------------------------------------------------------
/gui/QT/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sveltepress-qt",
3 | "version": "0.0.1",
4 | "description": "A QT based GUI from SveltePress",
5 | "license": "Unlicense",
6 | "private": true,
7 | "scripts": {
8 | "build": "node ./esbuild.js --prod",
9 | "build:dev": "node ./esbuild.js",
10 | "prepare": "node scripts/prepareMeta.mjs",
11 | "dev": "pnpm build:dev && cd dist && qode ./index.js",
12 | "debug": "pnpm build:dev && cd dist && qode --inspect ./index.js",
13 | "dev:watch": "nodemon -e js,ts,tsx,svg --ignore dist/ --ignore node_modules/ --exec pnpm dev",
14 | "pack": "pnpm run build && pnpm run prepare && node scripts/prepareAssets.js && nodegui-packer --pack ./dist",
15 | "preinstall": "node ../generateSymlinks.mjs"
16 | },
17 | "dependencies": {
18 | "@nodegui/nodegui": "0.45.4"
19 | },
20 | "devDependencies": {
21 | "@nodegui/packer": "1.5.0",
22 | "esbuild": "0.14.38",
23 | "fs-extra": "10.1.0",
24 | "handlebars": "4.7.7",
25 | "nodemon": "2.0.16"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/gui/QT/scripts/prepareAssets.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs-extra');
2 |
3 | const name = fs.readJsonSync('./deploy/config.json').appName;
4 |
5 | const platforms = ['linux', 'win32', 'darwin'];
6 | for (const folder of platforms) {
7 | if (!fs.pathExistsSync('./deploy/' + folder + '/' + name + '/')) break;
8 | const assetsFolder = `./deploy/${folder}/${name}/${
9 | folder === 'darwin' ? 'Contents/' : ''
10 | }assets/`;
11 | if (fs.pathExistsSync(assetsFolder)) {
12 | fs.removeSync(assetsFolder);
13 | }
14 | fs.copySync('./assets/', assetsFolder);
15 | }
16 |
--------------------------------------------------------------------------------
/gui/QT/scripts/prepareMeta.mjs:
--------------------------------------------------------------------------------
1 | import fs from 'fs';
2 | import Handlebars from 'handlebars';
3 | import { readFileSync, writeFileSync } from 'fs';
4 | import Config from '../../../sveltePress.config.js';
5 |
6 | const currentName = JSON.parse(readFileSync('./deploy/config.json', 'utf8')).appName;
7 | const title = Config.title;
8 | const safeTitle = title.replace(/[^a-z]/gi, '').toLowerCase();
9 |
10 | const editables = [
11 | {
12 | input: `./deploy/linux/${currentName}/default.desktop`,
13 | template: { title: title }
14 | },
15 | {
16 | input: `./deploy/darwin/${currentName}/Contents/Info.plist`,
17 | template: { bundle: safeTitle }
18 | }
19 | ];
20 |
21 | for (let i = 0; i < editables.length; i++) {
22 | const hbsString = readFileSync(editables[i].input + '.hbs', 'utf8');
23 | const template = Handlebars.compile(hbsString);
24 | const compiled = template(editables[i].template);
25 |
26 | writeFileSync(editables[i].input, compiled);
27 | }
28 |
29 | writeFileSync('./deploy/config.json', JSON.stringify({ appName: title }));
30 |
31 | const platforms = ['linux', 'win32', 'darwin'];
32 | for (const folder of platforms) {
33 | // const mac = folder === "darwin" ? "/Contents" : ""
34 | fs.renameSync(
35 | `./deploy/${folder}/${currentName}/`,
36 | `./deploy/${folder}/${title.replace(/[^a-z0-9]/gi, '')}/`
37 | );
38 | }
39 |
--------------------------------------------------------------------------------
/gui/QT/src/index.js:
--------------------------------------------------------------------------------
1 | import {
2 | QMainWindow,
3 | QWidget,
4 | FlexLayout,
5 | QIcon,
6 | QListWidget,
7 | QListWidgetItem,
8 | ItemFlag,
9 | QTextBrowser,
10 | QVariant,
11 | QTabWidget
12 | } from '@nodegui/nodegui';
13 | import Config from '../../../sveltePress.config';
14 | import Sidebar from '../../../src/lib/SveltePress/db/sveltePressSidebar';
15 | import Index from '../../../src/lib/SveltePress/db/sveltePressIndex';
16 | import { mdConverter } from '../../../src/lib/SveltePress/markdown/MDConverter.js';
17 |
18 | import bullet from '../bullet.svg';
19 | import SveltePressLogo from '../../sveltepresslogo.png';
20 |
21 | const win = new QMainWindow();
22 | const centralWidget = new QWidget();
23 | const rootLayout = new FlexLayout();
24 | const tabWidget = new QTabWidget();
25 | const textBrowser = new QTextBrowser();
26 |
27 | textBrowser.setHtml(`Welcome to ${Config.title} `);
28 |
29 | for (const [key, value] of Sidebar) {
30 | const listWidget = new QListWidget();
31 | let name = key;
32 | for (const [keyP, valueP] of value) {
33 | let listWidgetItem = new QListWidgetItem();
34 | if (keyP.toLowerCase() === key + '/readme.md') {
35 | name = valueP.name;
36 | } else {
37 | listWidgetItem.setText(valueP.name);
38 | listWidgetItem.setFlags(listWidgetItem.flags() & ~ItemFlag.ItemIsSelectable);
39 | listWidget.addItem(listWidgetItem);
40 | }
41 | for (const [keyC, valueC] of valueP.files) {
42 | listWidgetItem = new QListWidgetItem();
43 | listWidgetItem.setText(valueC);
44 | listWidgetItem.setIcon(new QIcon(bullet));
45 | listWidgetItem.setData(256, new QVariant(keyC));
46 | listWidget.addItem(listWidgetItem);
47 | }
48 | }
49 | // Create Tabs
50 | // [TODO]: get a cool icon
51 | tabWidget.addTab(listWidget, new QIcon(), name);
52 | // Add event listener for posts
53 | listWidget.addEventListener('itemActivated', (item) => {
54 | if (!item.isSelected()) return;
55 | const path = item.data(256).toString();
56 | textBrowser.setHtml(
57 | mdConverter(Index.get(path)).replace(
58 | /\ that checks if symlinks are correct
2 | import { createSymLinks } from '../scripts/generateSymlinks.js';
3 | //
4 |
--------------------------------------------------------------------------------
/gui/sveltepresslogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/gui/sveltepresslogo.png
--------------------------------------------------------------------------------
/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "paths": {
5 | "$lib/*": ["src/lib/*"]
6 | }
7 | },
8 | "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
9 | }
10 |
--------------------------------------------------------------------------------
/netlify.toml:
--------------------------------------------------------------------------------
1 | [build]
2 | command = "npm run build"
3 | publish = "build/"
4 | functions = "functions/"
5 |
6 | [[headers]]
7 | for = "/*"
8 | [headers.values]
9 | Permissions-Policy = "interest-cohort=()"
10 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sveltepress",
3 | "version": "1.0.0",
4 | "scripts": {
5 | "dev": "node scripts/generateProdData.js && svelte-kit dev",
6 | "build": "node scripts/generateProdData.js && svelte-kit build",
7 | "preview": "svelte-kit preview",
8 | "postinstall": "ni svelte -D --ignore-scripts && node scripts/generateSymlinks.js",
9 | "lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
10 | "format": "prettier --write --plugin-search-dir=. .",
11 | "preinstall": "node scripts/prepareTheme.js"
12 | },
13 | "devDependencies": {
14 | "@antfu/ni": "0.14.0",
15 | "@sveltejs/adapter-netlify": "1.0.0-next.56",
16 | "@sveltejs/adapter-node": "1.0.0-next.73",
17 | "@sveltejs/adapter-static": "1.0.0-next.29",
18 | "@sveltejs/adapter-vercel": "1.0.0-next.50",
19 | "@sveltejs/kit": "1.0.0-next.324",
20 | "eslint": "8.14.0",
21 | "eslint-config-prettier": "8.5.0",
22 | "eslint-plugin-svelte3": "3.4.1",
23 | "flexsearch": "0.7.21",
24 | "front-matter": "4.0.2",
25 | "highlight.js": "11.5.1",
26 | "jsesc": "3.0.2",
27 | "marked": "4.0.14",
28 | "prettier": "2.6.2",
29 | "prettier-plugin-svelte": "2.7.0",
30 | "sass": "1.51.0",
31 | "svelte": "3.47.0",
32 | "svelte-preprocess": "4.10.6"
33 | },
34 | "type": "module",
35 | "dependencies": {
36 | "sanitize-html": "2.7.0"
37 | },
38 | "license": "Unlicense"
39 | }
--------------------------------------------------------------------------------
/pages/guide/01 - getting_started/01 - installation.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Installation, Running & Building
3 | ---
4 |
5 | # Installation
6 |
7 | The best way to install SveltePress is by using [degit](https://github.com/Rich-Harris/degit). degit works similarly to git but uses only the latest commit (plus can be configured to delete some files), you can read more about it on its repo page.
8 |
9 | ```bash
10 | # Replace `my-sveltepress-project` with the name you desire
11 | npx degit GeopJr/SveltePress my-sveltepress-project
12 | # or by using create-sveltepress-app (which wraps the above)
13 | npx create-sveltepress-app create my-sveltepress-project
14 |
15 | # Change directory to the folder from the previous step
16 | cd my-sveltepress-project
17 |
18 | # Install dependencies
19 | # PNPM is recommended but both YARN and NPM will do
20 | pnpm install
21 | ```
22 |
23 | > Note: `src/routes/index.svelte` is self-contained, feel free to delete, modify or leave it as is.
24 |
25 | # Running
26 |
27 | > Handled by SvelteKit
28 |
29 | ```bash
30 | # PNPM/YARN/NPM
31 | pnpm run dev -- --open
32 | ```
33 |
34 | # Building
35 |
36 | > Handled by SvelteKit
37 |
38 | Open `svelte.config.js` and choose your preferred adapter (the comments will guide you).
39 |
40 | ```bash
41 | # PNPM/YARN/NPM
42 | pnpm run build
43 |
44 | # Preview your build
45 | pnpm run preview
46 | ```
47 |
48 | > Note: Both `pnpm/yarn/npm run build` & `pnpm/yarn/npm run dev` run a small script that generates some index databases before running the svelte-kit command.
49 |
--------------------------------------------------------------------------------
/pages/guide/01 - getting_started/02 - config.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Config
3 | ---
4 |
5 | # Config
6 |
7 | ```js
8 | // sveltePress.config.js
9 |
10 | export default {
11 | // Nav Items shown at the navbar/app menu
12 | // overwrite => false [default]
13 | // If overwrite is true, then the `items` will
14 | // overwrite the auto-generated ones.
15 | // If overwrite is false, then the `items` will
16 | // be merged with the default ones.
17 | // TIP: you can use overwrite: true to hide
18 | // GRANDPARENTs by including the public ones
19 | // to `items` like so:
20 | // items: [{ link: "/guide", name: "Guide" }]
21 | nav: {
22 | overwrite: false,
23 | items: [
24 | {
25 | link: 'https://github.com/GeopJr/SveltePress',
26 | name: 'GitHub'
27 | }
28 | ]
29 | },
30 | // Used in title meta tag
31 | title: 'SveltePress',
32 | // Sorting method
33 | // Types: alphabetically, modified
34 | // alphabetically => A-Z (reverse: Z-A) [default]
35 | // modified => last modified (reverse: first modified)
36 | sorting: {
37 | type: 'alphabetically',
38 | reverse: false
39 | }
40 | };
41 | ```
42 |
43 | # Video (YouTube)
44 |
45 | [](https://www.youtube.com/watch?v=OhVTF6IxOAY&list=PLahj1xcdBwiHRLLS3ZPUoPLVNz6Fh3SnH&index=2)
46 |
--------------------------------------------------------------------------------
/pages/guide/01 - getting_started/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | groupName: Getting Started
3 | ---
4 |
--------------------------------------------------------------------------------
/pages/guide/02 - writing/01 - structure.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Structure
3 | ---
4 |
5 | # Structure
6 |
7 | All markdown files **must** be inside the `posts/` folder and follow the following structure:
8 |
9 | ```bash
10 | pages
11 | └── GRANDPARENT
12 | ├── CHILD.md
13 | ├── PARENT
14 | │ ├── CHILD.md
15 | │ ├── CHILD.md
16 | │ ├── CHILD.md
17 | │ ├── PARENT
18 | │ │ ├── CHILD.md
19 | │ │ └── CHILD.md
20 | │ └── CHILD.md
21 | └── CHILD.md
22 | ```
23 |
24 | At the root of the `pages` folder, there must be only GRANDPARENTs aka folders that act as bigger categories. Those are isolated allowing you to have setups likes: `blog, music_reviews, recipes` or `guide_en, guide_el, guide_it, guide_es`.
25 |
26 | In the following screenshot, `Blog` is a GRANDPARENT, the active document is a CHILD.md in the root of GRANDPARENT, `music` is a PARENT and the items under it are CHILD.md.
27 |
28 | 
29 |
30 | And the structure in file manager:
31 |
32 | 
33 |
34 | 
35 |
36 | 
37 |
38 | > Note: PARENTs can have other PARENTs as children. SveltePress will handle them correctly.
39 |
--------------------------------------------------------------------------------
/pages/guide/02 - writing/02 - naming.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Naming
3 | ---
4 |
5 | # Naming
6 |
7 | As mentioned before, (GRAND)PARENT and CHILD.md names don't only depend on their file names. This means that a file can be named `salad-review-01.md` but have it displayed as `Greek Salad Review` on the sidebar.
8 |
9 | Filenames are being used for **sorting** (and if there isn't a custom name set). For example, the following two files, `salad-review-01.md`, `salad-review-02.md`, will be displayed in the following order on the sidebar:
10 |
11 | ```md
12 | - salad-review-01
13 | - salad-review-02
14 | ```
15 |
16 | However their names can be:
17 |
18 | ```md
19 | - Greek Salad Review
20 | - Caesar Salad Review
21 | ```
22 |
23 | They are sorted based on their filenames and not their custom names.
24 |
25 | ## CHILD.md - Post custom names
26 |
27 | Markdown files can have metadata using Front Matter. In general, it's just a YAML object at the top of your file. SveltePress uses `postName` as the custom name for CHILD.md.
28 |
29 | Eg.
30 |
31 | ```md
32 | ---
33 | postName: Greek Salad Review
34 | ---
35 |
36 | I liked it
37 | ```
38 |
39 | ## (GRAND)PARENT - Category custom names
40 |
41 | Just like above, but there are 2 differences:
42 |
43 | - It has to be in a file named `readme.md` at the root of the folder
44 | - Instead of `postName` the key is `groupName`
45 |
46 | #### Why readme.md?
47 |
48 | Readme.md is a popular file name for a "cover" of a git repo. Usually it gets rendered along-side the client's explorer. This means that if the content is on a git repo, the user will be able to see this file rendered.
49 |
50 | Eg. in the following sidebar
51 |
52 | 
53 |
54 | inside the `posts/blog/` folder there's a readme with the following content:
55 |
56 | ```md
57 | ---
58 | groupName: Blog
59 | ---
60 |
61 | This folder contains random blog posts I wrote!
62 | ```
63 |
64 | apart from setting the custom name, it will look like this on a git client:
65 | 
66 |
--------------------------------------------------------------------------------
/pages/guide/02 - writing/03 - images.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Images
3 | ---
4 |
5 | # Images
6 |
7 | Thanks to SvelteKit, using images is super easy, just place them inside the `static/` folder and they will be accessible at the root of your domain.
8 |
9 | Eg. if I place `logo.png` inside `static/assets/logo.png`
10 |
11 | Then I'll be able to access it on markdown like so:
12 |
13 | ```md
14 | 
15 | ```
16 |
17 | # Video (YouTube)
18 |
19 | [](https://www.youtube.com/watch?v=mzZETq1VvtY&list=PLahj1xcdBwiHRLLS3ZPUoPLVNz6Fh3SnH&index=3)
20 |
--------------------------------------------------------------------------------
/pages/guide/02 - writing/04 - drafts.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Drafts
3 | ---
4 |
5 | # Drafts
6 |
7 | You can mark a post or a group as a draft by setting the `draft` frontmatter key to true.
8 |
9 | E.g.
10 |
11 | Post:
12 | ```md
13 | ---
14 | postName: Drafts
15 | draft: true
16 | ---
17 | ```
18 |
19 | Group:
20 | ```md
21 | ---
22 | groupName: Writing
23 | draft: true
24 | ---
25 | ```
26 |
27 | Doing so will remove the post (or the group & all its sub-groups and their posts) from everywhere.
28 |
29 | > Note: In dev mode, files are being read from disk (to avoid reloading and generating index), which means that a draft might be accessible from the address bar.
30 |
--------------------------------------------------------------------------------
/pages/guide/02 - writing/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | groupName: Writing
3 | ---
4 |
--------------------------------------------------------------------------------
/pages/guide/03 - extending/01 - posts.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Posts
3 | ---
4 |
5 | # Extending Posts
6 |
7 | As mentioned before, markdown files can have metadata using Front Matter.
8 |
9 | SveltePress directly makes them available alongside the post. So let's add some stuff!
10 |
11 | ## Tags
12 |
13 | Let's say we want to add tags on a post, we firstly need to add it to the markdown metadata:
14 |
15 | ```md
16 | ---
17 | postName: Posts
18 | tags:
19 | - Svelte
20 | - Press
21 | - JS
22 | - Vite
23 | ---
24 | ```
25 |
26 | Inside `src/routes/[...group]/[slug].svelte` the tags will be available by calling `post.meta.tags`.
27 |
28 | Let's now display them at the top, by creating a Svelte loop that will display each one:
29 |
30 | ```svelte
31 |
32 | {#each post.meta.tags || [] as tag}
33 | {tag}
34 | {/each}
35 | {@html post.body}
36 |
37 | ```
38 |
39 | This will instantly have the following outcome:
40 |
41 | 
42 |
43 | ## Date
44 |
45 | Similarly, we can also do the same for the date the file was modified or made. SveltePress already passes the last modified date in metadata. However, this can get overwritten if eg. this is an old blog post.
46 |
47 | ```svelte
48 |
49 | {post.meta.date}
50 | {@html post.body}
51 |
52 | ```
53 |
54 | 
55 |
56 | ### Other metadata ideas
57 |
58 | - Last commit
59 | - Last editor
60 | - Original author
61 | - Time to read
62 | - Rating
63 | - Edit on Git button
64 |
65 | > Note: Obviously this is a bit more advanced. The built-in theme doesn't have any extra components for most metadata ideas. The `Content` component passes all metadata to theme, you can manually use them there.
66 |
--------------------------------------------------------------------------------
/pages/guide/03 - extending/03 - markdown.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Marked
3 | ---
4 |
5 | # Markdown to HTML
6 |
7 | SveltePress uses 3 tools to deal with markdown: Marked, front-matter & sanitize-html.
8 |
9 | The only thing SveltePress depends on is the existence of Front Matter parse (handled in `MD2FM.js`). This means that you can replace everything with any tool you want, as long as Front Matter is parsed and returned in `MD2FM.js`. You can replace Marked and sanitize-html in the `MDConverter.js` file.
10 |
11 | # Video (YouTube)
12 |
13 | [](https://www.youtube.com/watch?v=8sZrkXx0Iww&list=PLahj1xcdBwiHRLLS3ZPUoPLVNz6Fh3SnH&index=4)
14 |
--------------------------------------------------------------------------------
/pages/guide/03 - extending/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | groupName: Extending
3 | ---
4 |
--------------------------------------------------------------------------------
/pages/guide/04 - gui/01 - Warning.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Warning
3 | ---
4 |
5 | # Warning
6 |
7 | The tooling is a bit more difficult to handle, especially for newcomers to those libraries. Each folder in the repo includes specific instructions, dependencies and requirements. Please read them carefully!
8 |
9 | Keep in mind that each one of them has its advantages and disadvantages. Each readme on the repo contains a table with what's available and what has been tested.
10 |
--------------------------------------------------------------------------------
/pages/guide/04 - gui/02 - Installation.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Installing
3 | ---
4 |
5 | # Installing
6 |
7 | You can either add the GUIs to your existing project or create a new one with them pre-included!
8 |
9 | > Note: if your SveltePress is older, you will need to pass some settings to Vite so it doesn't watch this huge folder! See: `svelte.config.js`.
10 |
11 | Using create-sveltepress-app:
12 |
13 | ```bash
14 | # If you have SveltePress installed already
15 | npx create-sveltepress-app add --gui
16 |
17 | # If you don't have SveltePress installed you
18 | # can include this by adding the `--gui` flag
19 | # eg.
20 | npx create-sveltepress-app create my-sveltepress-project --gui
21 | ```
22 |
23 | Using degit:
24 |
25 | ```bash
26 | # has to be done after installing SveltePress
27 | # aka this is only for adding it
28 | npx degit GeopJr/SveltePress/gui ./gui
29 | ```
30 |
--------------------------------------------------------------------------------
/pages/guide/04 - gui/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | groupName: GUIs
3 | ---
4 |
--------------------------------------------------------------------------------
/pages/guide/Introduction.md:
--------------------------------------------------------------------------------
1 | # What's SveltePress?
2 |
3 | SveltePress is a documentation tool built on top of [SvelteKit](https://kit.svelte.dev/), a "serverless-first" framework for building web applications for [Svelte](https://svelte.dev/).
4 |
5 | SvelteKit & Svelte's simplicity allow the user to modify SveltePress to fit their needs with little to no effort while taking advantage of the incredible performance of both of them.
6 |
7 | # How does SveltePress differ from other documentation tools?
8 |
9 | Apart from all the super powers inherited from Svelte & SvelteKit, the main point of SveltePress is to allow less knowledgeable users to create and publish content. To achieve that, SveltePress uses a filesystem-based structure.
10 |
11 | For example the following structure...
12 |
13 | ```bash
14 | pages
15 | └── cooking
16 | ├── allergies.md
17 | ├── main_dish
18 | │ ├── pizza.md
19 | │ └── spaghetti.md
20 | └── readme.md
21 | ```
22 |
23 | will generate the following sidebar:
24 |
25 | ```md
26 | - Cooking
27 | - Allergies
28 | - Main Dish
29 | - Pizza
30 | - Spaghetti
31 | ```
32 |
33 | As shown above, the sidebar is sorted alphabetically (or last modified) and categorized based on the folder structure. However, both category and post names do not only depend on the filename. This allows you to eg. have the following file names:
34 |
35 | ```md
36 | 01 - cream.md
37 | 02 - choco.md
38 | ```
39 |
40 | but have them displayed as:
41 |
42 | ```md
43 | - Ice Cream
44 | - Chocolate
45 | ```
46 |
47 | on the sidebar. More on that later.
48 |
49 | # How does SveltePress work?
50 |
51 | SveltePress relies on SvelteKit's [dynamic parameters](https://kit.svelte.dev/docs#routing-pages) to get the correct markdown file which then converts to HTML using [marked](https://github.com/markedjs/marked).
52 |
53 | In production mode, all markdown files, get indexed for max performance while also enabling the search function powered by [FlexSearch](https://github.com/nextapps-de/flexsearch).
54 |
55 | Deploying is handled by SvelteKit, which allows you to choose from a plethora of [adapters](https://kit.svelte.dev/docs#adapters) including node, Netlify, Vercel...
56 |
57 | At the moment using the `static` adapter is not possible, as the dynamic routes won't get rendered.
58 |
59 | # Credits
60 |
61 | SveltePress wouldn't exist without the following:
62 |
63 | - [Svelte](https://svelte.dev/)
64 | - [SvelteKit](https://kit.svelte.dev/)
65 | - [VuePress](https://vuepress.vuejs.org/)
66 | - [Carbon Design System](https://www.carbondesignsystem.com/)
67 |
68 | # Video (YouTube)
69 |
70 | [](https://www.youtube.com/watch?v=P23AeugwIFo&list=PLahj1xcdBwiHRLLS3ZPUoPLVNz6Fh3SnH)
71 |
--------------------------------------------------------------------------------
/pages/guide/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | groupName: Guide
3 | ---
4 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/01 - DataGenerator.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Data Generator
3 | ---
4 |
5 | # Data Generator
6 |
7 | The main "magic" of SveltePress happens in `dataGenerator.js` and specifically the `createPressData` function.
8 | `createPressData` is a recursive action that goes through all posts in `posts/` and creates the base structure that is being used internally to create the sidebar, index and everything else.
9 | It generates a nested Map that gets quite complex. Thankfully, with the power of [jsesc](https://www.npmjs.com/package/jsesc) (more on jsesc later) we can have a look at it with ease by opening the `db/sveltePressData.js` file (it gets generated when you first run one of the `package.json` scripts).
10 | Being recursive allows SveltePress to handle infinite-deep folders and display them correctly.
11 |
12 | Lastly, `createPressData` is responsible for other stuff like ignoring posts that are marked as drafts and sorting the files based on the selecting sorting method.
13 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/02 - SidebarGenerator.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Sidebar Generator
3 | ---
4 |
5 | # Sidebar Generator
6 |
7 | `sidebarGenerator.js` is responsible for generating the sidebars. Those are incredibly important too since many other functions depend on them.
8 | sidebarGenerator's `createSidebar` function, also creates its own Map. That map makes it easy to handle relationships between `GRANDPARENTs`, `PARENTs` and `CHILD.md` and their desired names from FrontMatter. Just like in dataGenerator, you can see the structure at `db/sveltePressSidebar.js`.
9 |
10 | You might wonder how are all those infinite-deep folders handled... It's easy, they get flattened! The main reason being that anything deeper than 2 levels is extremely difficult to display while still being easy to use.
11 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/03 - NavGenerator.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Nav Generator
3 | ---
4 |
5 | # Nav Generator
6 |
7 | `navGenerator.js` just takes the sidebar as input and returns the `GRANDPARENTs`.
8 | The use-case is showing all the grandparents in the navbar when it's set to automatic mode.
9 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/04 - hooksStores.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Hooks & Stores
3 | ---
4 |
5 | # Hooks & Stores
6 |
7 | ## Hooks
8 |
9 | `hooks.js` sets the session which contains the current sidebar and navbar for easier handling.
10 |
11 | ## Stores
12 |
13 | `stores.js` contains the current theme.
14 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/05 - slug.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Slug Route
3 | ---
4 |
5 | # Slug Route
6 |
7 | `[slug].svelte` on load reads the group and slug/post that got passed to it.
8 |
9 | If there's not group but only a slug, that means that the url is probably something like `/guide`. So it needs to get the first available post. It does so by looping the sidebar until it finds a post. If it doesn't it redirects to 400. If it does it loads it (it will go through the same process and continue with the following case).
10 |
11 | If a group was also available, it sends a POST request with all params to `${slug}.json`.
12 |
13 | `${slug}.json` is responsible for generating pagination and converting markdown to html. It also handles the post attributes like dates and names. Then it returns it back to `[slug].svelte`.
14 |
15 | `[slug].svelte` then (if it didn't error) renders the component.
16 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/06 - Theme.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Theme
3 | ---
4 |
5 | # Theme
6 |
7 | `Theme.svelte` is responsible for setting the initial theme and handling changes. On mount it gets the current theme from localStorage (if set), checks if the theme is one of ours, if it is it sets it, if it's not, it then sets one based on the browser's prefers-color-scheme media query. On theme change, it adds it to the body element of the document and saves it in localStorage.
8 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/07 - search.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Search
3 | ---
4 |
5 | # Search
6 |
7 | `dataGenerator.js` takes an argument that instructs it to generate an index. That index is a Map of Path => Markdown Body. As always you can see it by opening the `db/sveltePressIndex.js` file.
8 |
9 | That Index is being used with [FlexSearch](https://github.com/nextapps-de/flexsearch) so it can quickly look through everything!
10 | Obviously since this is a "heavy" function, it only runs once per script run and parts of it are disabled in dev.
11 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/08 - production.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Production
3 | ---
4 |
5 | # Production
6 |
7 | So what's the point of these "databases" in the `db/` folder?
8 | They are getting generated so we don't waste time and resources running all the generators in production every time a user accesses the website. They are being used in `SveltePressData.js` which returns them based on the build mode.
9 |
10 | All functions that depend on them, they actually call the wrappers in `SveltePressData.js`.
11 |
12 | They are being generated with [jsesc](https://www.npmjs.com/package/jsesc), which exports them into their own ES Modules.
13 |
--------------------------------------------------------------------------------
/pages/internals/01 - SveltePress/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | groupName: SveltePress
3 | ---
4 |
--------------------------------------------------------------------------------
/pages/internals/02 - SveltePress-Native/01 - GTK.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: GTK
3 | ---
4 |
5 | # GTK
6 |
7 | The GTK version uses [node-gtk](https://github.com/romgrk/node-gtk) along with a Glade file to generate the UI. The Widgets in Glade get populated with SveltePress data using handlebars.
8 |
9 | `prepareGlade.js` reads the Sidebar from SveltePress and gives handlebars a correctly formatted object to build the Glade file.
10 |
11 | Markdown gets converted by calling `MDConverter.js` real-time! The HTML then gets sent to the WebView which renders it.
12 |
13 | That's pretty much all there is to this. There's also tiny webpack config used when running and building.
14 |
--------------------------------------------------------------------------------
/pages/internals/02 - SveltePress-Native/02 - QT.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: QT
3 | ---
4 |
5 | # QT
6 |
7 | The QT version uses [NodeGui](https://github.com/nodegui/). Similarly to GTK, it uses the Sidebar to populate the widgets.
8 |
9 | `prepareMeta.mjs` renames files and folders using handlebars, to match the current title from the SveltePress config.
10 |
11 | `prepareAssets.js` copies the `static/` folder to the QT directories so they get included in the builds.
12 |
13 | Markdown gets converted by calling `MDConverter.js` real-time! The HTML then gets sent to the QTextBrowser which renders it.
14 |
15 | `package.json` includes many scripts that help with packing and building, read the readme for more!
16 |
--------------------------------------------------------------------------------
/pages/internals/02 - SveltePress-Native/03 - Flutter.md:
--------------------------------------------------------------------------------
1 | ---
2 | postName: Flutter
3 | ---
4 |
5 | # Flutter
6 |
7 | Just like the others, there are functions that prepare the index from the sidebar as well as importing the current title from the SveltePress config.
8 |
9 | Flutter lazy loads the ListView items allowing it to handle long Lists with ease.
10 |
11 | Flutter uses `flutter_html` to render the HTML which supports both local and external assets with little to no modifications.
12 |
13 | Html gets updated using `ValueListenableBuilder` so we avoid rebuilding the whole widget.
14 |
15 | Lastly, using `flutter_launcher_icons` it auto generates all the icons needed from the root one!
16 |
--------------------------------------------------------------------------------
/pages/internals/02 - SveltePress-Native/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | groupName: SveltePress-Native
3 | ---
4 |
--------------------------------------------------------------------------------
/pages/internals/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | groupName: Internals
3 | ---
4 |
--------------------------------------------------------------------------------
/pandoc/.gitignore:
--------------------------------------------------------------------------------
1 | input/*
2 | output/*
3 | !.gitkeep
4 |
--------------------------------------------------------------------------------
/pandoc/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SveltePress-Pandoc
5 | Documentation for humans in more formats.
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | #
14 |
15 | ## Warning
16 |
17 | Just like the GUIs, this uses parts created during **production builds**. You need to have done at least one prod build of SveltePress.
18 |
19 | #
20 |
21 | ## Dependencies
22 |
23 | The main one is pandoc: https://pandoc.org/installing.html
24 |
25 | Apart from that, additional dependencies might be required based on the desired output (eg. pdf).
26 |
27 | #
28 |
29 | ## Installing
30 |
31 | Using create-sveltepress-app:
32 |
33 | ```bash
34 | # If you have SveltePress installed already
35 | npx create-sveltepress-app add --pandoc
36 |
37 | # If you don't have SveltePress installed you
38 | # can include this by adding the `--pandoc` flag
39 | # eg.
40 | npx create-sveltepress-app create my-sveltepress-project --pandoc
41 | ```
42 |
43 | Using degit:
44 |
45 | ```bash
46 | # has to be done after installing SveltePress
47 | # aka this is only for adding it
48 | npx degit GeopJr/SveltePress/pandoc ./pandoc
49 | ```
50 |
51 | After adding:
52 |
53 | ```bash
54 | # Use of PNPM is encouraged
55 | pnpm i
56 | # Build epubs
57 | pnpm run pandoc
58 | ```
59 |
60 | #
61 |
62 | ## Info Tables
63 |
64 | Additional Scripts:
65 |
66 | | Name | Description |
67 | | ----------------- | ---------------------------------------------------- |
68 | | `preparePosts.js` | Compiles posts into a unified HTML (per GRANDPARENT) |
69 | | `runPandoc.js` | Runs pandoc for you with some defaults |
70 |
71 | NPM Scripts:
72 |
73 | | Name | Description |
74 | | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
75 | | `prepare` | Runs `preparePosts.js` |
76 | | `pandoc` | Runs `runPandoc.js`. It accepts a `-o` flag used to specify output type (eg. `pnpm run pandoc -- -o .epub` or `-o something.epub` or `-o epub`) |
77 |
78 | > Run using `pnpm run {Script Name}`
79 |
80 | #
81 |
82 | ## Notes
83 |
84 | - Feel free to modify the `runPandoc.js` file to meet your desired outcome.
85 |
86 | #
87 |
88 | ## Contributing
89 |
90 | 1. Read the [Code of Conduct](https://github.com/GeopJr/SveltePress/blob/main/CODE_OF_CONDUCT.md)
91 | 2. Fork it ( https://github.com/GeopJr/SveltePress/fork )
92 | 3. Create your feature branch (git checkout -b my-new-feature)
93 | 4. Commit your changes (git commit -am 'Add some feature')
94 | 5. Push to the branch (git push origin my-new-feature)
95 | 6. Create a new Pull Request
96 |
--------------------------------------------------------------------------------
/pandoc/input/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/pandoc/input/.gitkeep
--------------------------------------------------------------------------------
/pandoc/output/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/pandoc/output/.gitkeep
--------------------------------------------------------------------------------
/pandoc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sveltepress-pandoc",
3 | "version": "1.0.0",
4 | "description": "Script that prepares posts to be handled by pandoc",
5 | "type": "module",
6 | "scripts": {
7 | "prepare": "node preparePosts.js",
8 | "pandoc": "node runPandoc.js"
9 | },
10 | "license": "Unlicense",
11 | "dependencies": {
12 | "minimist": "1.2.6"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/pandoc/pnpm-lock.yaml:
--------------------------------------------------------------------------------
1 | lockfileVersion: 5.3
2 |
3 | specifiers:
4 | minimist: 1.2.6
5 |
6 | dependencies:
7 | minimist: 1.2.6
8 |
9 | packages:
10 |
11 | /minimist/1.2.6:
12 | resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==}
13 | dev: false
14 |
--------------------------------------------------------------------------------
/pandoc/preparePosts.js:
--------------------------------------------------------------------------------
1 | import Sidebar from '../src/lib/SveltePress/db/sveltePressSidebar.js';
2 | import Index from '../src/lib/SveltePress/db/sveltePressIndex.js';
3 | import { mdConverter } from '../src/lib/SveltePress/markdown/MDConverter.js';
4 |
5 | import { writeFileSync } from 'fs';
6 |
7 | const combinedGrandparents = [];
8 |
9 | for (const [key, value] of Sidebar) {
10 | let grandparent = '';
11 | for (const [keyP, valueP] of value) {
12 | let isGrandparent = false;
13 | if (keyP.toLowerCase() !== key + '/readme.md') {
14 | grandparent += `${valueP.name} `;
15 | } else {
16 | isGrandparent = true;
17 | }
18 | for (const [keyC, valueC] of valueP.files) {
19 | // Used for top level posts
20 | if (isGrandparent == true) {
21 | isGrandparent = false;
22 | grandparent += `${valueC} `;
23 | }
24 | // Every Hx has to become H(x+1) for a better table of contents
25 | grandparent += mdConverter(Index.get(keyC).replace(/^(#{1,5})/gm, '$1#')).replace(
26 | /\ x.toLowerCase().endsWith('.html'));
12 |
13 | for (let i = 0; i < pages.length; i++) {
14 | execSync(
15 | `pandoc ./input/${pages[i]} -o ./output/${pages[i]
16 | .split('.')
17 | .shift()}.${output} --toc --self-contained --metadata title="${title}"`,
18 | { stdio: 'inherit' }
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "config:base"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/scripts/generateProdData.js:
--------------------------------------------------------------------------------
1 | import createPressData from '../src/lib/SveltePress/functions/dataGenerator.js';
2 | import createSidebar from '../src/lib/SveltePress/functions/sidebarGenerator.js';
3 |
4 | // This function generated the following databases
5 | // - Index
6 | // - SearchIndex
7 | // - Sidebar
8 |
9 | // Should be run at least once on dev
10 | // and before every prod build
11 | // package.json has been modified to do so.
12 |
13 | createPressData('./pages/', true, true);
14 | console.log('\x1b[33m%s\x1b[0m', '[SveltePress]: Generated pressData');
15 | createSidebar(true);
16 | console.log('\x1b[33m%s\x1b[0m', '[SveltePress]: Generated sidebar');
17 |
--------------------------------------------------------------------------------
/scripts/generateSymlinks.js:
--------------------------------------------------------------------------------
1 | import { symlinkSync, existsSync } from 'fs';
2 | import { resolve, join, dirname, sep } from 'path';
3 | import { fileURLToPath } from 'url';
4 |
5 | const __dirname = dirname(fileURLToPath(import.meta.url));
6 |
7 | const paths = {
8 | '../sveltePress.config.js': './src/lib/SveltePress/sveltePress.config.js',
9 | '../gui/Flutter/assets': '../../static/',
10 | '../gui/QT/assets': '../../static/',
11 | '../gui/GTK/assets': '../../static/'
12 | };
13 |
14 | export function createSymLinks(win = process.platform === 'win32') {
15 | Object.keys(paths).forEach((key) => {
16 | paths[resolve(join(__dirname, key))] = paths[key];
17 | delete paths[key];
18 | });
19 | for (const dest of Object.keys(paths)) {
20 | const target = paths[dest];
21 | const isFolder = target.endsWith('/');
22 | if (isFolder && !existsSync(dest.split(sep).slice(0, -1).join(sep))) continue;
23 |
24 | try {
25 | symlinkSync(target, dest, isFolder ? 'dir' : 'file');
26 | } catch (e) {
27 | if (e.code === 'EPERM' && win) {
28 | console.log('\x1b[31m%s\x1b[0m', `Windows requires Admin to make symlinks`);
29 | console.log(
30 | '\x1b[31m%s\x1b[0m',
31 | `Please run 'node scripts/generateSymlinks.js' on a terminal with Admin Privileges from your SveltePress project root`
32 | );
33 |
34 | // Removed because admin requires a password (blank doesnt work)
35 | // execSync(
36 | // 'runas /user:Administrator "node scripts/generateSymlinks.js"',
37 | // { stdio: 'inherit' }
38 | // );
39 | process.exit(1);
40 | } else if (e.code === 'EEXIST') {
41 | console.log(`Symlink '${dest}' already exists, skipped.`);
42 | }
43 | }
44 | }
45 | }
46 |
47 | createSymLinks();
48 |
--------------------------------------------------------------------------------
/scripts/prepareTheme.js:
--------------------------------------------------------------------------------
1 | // Require it all so we use exp functions
2 | // only available in > 16
3 | import fs from 'fs';
4 | import { join, relative } from 'path';
5 | // Combine package jsons
6 | if (fs.existsSync('./src/lib/SveltePress/theme/meta/package.json')) {
7 | const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
8 |
9 | const themePakcageJson = JSON.parse(
10 | fs.readFileSync('./src/lib/SveltePress/theme/meta/package.json', 'utf8')
11 | );
12 |
13 | ['devDependencies', 'dependencies'].forEach((x) => {
14 | if (themePakcageJson.hasOwnProperty(x))
15 | packageJson[x] = { ...packageJson[x], ...themePakcageJson[x] };
16 | });
17 |
18 | fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));
19 | }
20 |
21 | // Write index.svelte
22 | if (fs.existsSync('./src/lib/SveltePress/theme/index.svelte'))
23 | fs.writeFileSync(
24 | './src/routes/index.svelte',
25 | fs.readFileSync('./src/lib/SveltePress/theme/index.svelte', 'utf8')
26 | );
27 |
28 | if (fs.existsSync('./src/lib/SveltePress/theme/meta/root/')) {
29 | // if cpSync is available
30 | if (typeof fs.cpSync === 'function') {
31 | // Don't override anything.
32 | fs.cpSync('./src/lib/SveltePress/theme/meta/root/', './', { force: false, recursive: true });
33 | } else {
34 | // < 16
35 | copyFiles('./src/lib/SveltePress/theme/meta/root/');
36 |
37 | // Recursive function
38 | function copyFiles(source) {
39 | const files = fs.readdirSync(source, { withFileTypes: true });
40 | for (const item of files) {
41 | const fullPath = join(source, item.name);
42 | const rootRelative = join(
43 | './',
44 | relative('./src/lib/SveltePress/theme/meta/root/', fullPath)
45 | );
46 | if (item.isDirectory()) {
47 | if (!fs.existsSync(rootRelative)) fs.mkdirSync(rootRelative);
48 | copyFiles(fullPath);
49 | } else {
50 | try {
51 | fs.copyFileSync(fullPath, rootRelative, fs.constants.COPYFILE_EXCL);
52 | } catch (e) {
53 | if (e.code === 'EEXIST') {
54 | console.log(`File '${rootRelative}' already exists, skipped.`);
55 | }
56 | }
57 | }
58 | }
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | SveltePress
17 | %svelte.head%
18 |
19 |
20 | %svelte.body%
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/global.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/src/hooks.js:
--------------------------------------------------------------------------------
1 | import { getSide, getNav } from '$lib/SveltePress/SveltePressData';
2 |
3 | // Sidebar & navbar gets saved in session
4 | export function getSession() {
5 | return new Map([
6 | ['sidebar', getSide()],
7 | ['navbar', getNav()]
8 | ]);
9 | }
10 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/SveltePressData.js:
--------------------------------------------------------------------------------
1 | import createPressData from '$lib/SveltePress/functions/dataGenerator';
2 | import createSidebar from '$lib/SveltePress/functions/sidebarGenerator';
3 | import navData from '$lib/SveltePress/functions/navGenerator';
4 | import pressData from '$lib/SveltePress/db/sveltePressData';
5 | import sidebar from '$lib/SveltePress/db/sveltePressSidebar';
6 | import index from '$lib/SveltePress/db/sveltePressIndex';
7 | import { dev } from '$app/env';
8 |
9 | // These are responsible for supplying data
10 | // if on dev mode, it will generate the data
11 | // every time, but on prod, it will use the databases
12 | // generated by generateProdData
13 |
14 | export function getSide() {
15 | return dev ? createSidebar() : sidebar;
16 | }
17 |
18 | export function getData() {
19 | return dev ? createPressData()[0] : pressData;
20 | }
21 |
22 | export function getContent() {
23 | return dev ? false : index;
24 | }
25 |
26 | export function getNav() {
27 | return navData(getSide());
28 | }
29 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/Theme.svelte:
--------------------------------------------------------------------------------
1 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/components/content.svelte:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/components/navbar.svelte:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/components/search.svelte:
--------------------------------------------------------------------------------
1 |
11 |
12 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/components/sidebar.js:
--------------------------------------------------------------------------------
1 | // Sidebar functions used to get the name and url of
2 | // a sidebar item
3 |
4 | export function getName(value) {
5 | let name = value;
6 | if (typeof value === 'object' && value !== null && value.isGroup) {
7 | name = value.name;
8 | }
9 | return name;
10 | }
11 | export function getUrl(key, value) {
12 | let shouldRemove = key.toLowerCase().endsWith('/readme.md') ? 'readme.md' : '.';
13 | if (shouldRemove === '/readme.md' || (typeof value === 'object' && value !== null)) return null;
14 | const url = '/' + key.split(shouldRemove).slice(0, -1).join(shouldRemove);
15 | return url;
16 | }
17 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/components/sidebar.svelte:
--------------------------------------------------------------------------------
1 |
12 |
13 | {#if groupMap.length > 0}
14 |
15 | {/if}
16 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/db/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/src/lib/SveltePress/db/.gitkeep
--------------------------------------------------------------------------------
/src/lib/SveltePress/functions/navGenerator.js:
--------------------------------------------------------------------------------
1 | export default function generateNav(input) {
2 | const grandparents = [];
3 |
4 | for (const [key, value] of input) {
5 | let name = key.charAt(0).toUpperCase() + key.slice(1);
6 | for (const [, valueC] of value) {
7 | name = valueC.name ?? name;
8 | break;
9 | }
10 | grandparents.push({ link: '/' + key, name });
11 | }
12 |
13 | return grandparents;
14 | }
15 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/functions/sidebarGenerator.js:
--------------------------------------------------------------------------------
1 | import createPressData from './dataGenerator.js';
2 | import { writeFileSync } from 'fs';
3 | import path from 'path';
4 | import Jsesc from 'jsesc';
5 |
6 | function createSidebarFolder(folder) {
7 | let response = new Map();
8 | const defaultBody = folder.get('default');
9 | if (defaultBody.size > 0) {
10 | const defaultPath = defaultBody.get('relativePath');
11 |
12 | const body = {};
13 | body['isGroup'] = true;
14 |
15 | const pathGroups = defaultPath.split('/');
16 | const index = pathGroups.length + (pathGroups.length > 1 ? -2 : -1);
17 | body['name'] = defaultBody.get('name') || pathGroups[index];
18 |
19 | response.set(defaultPath, body);
20 | }
21 |
22 | for (const [, value] of folder.get('files')) {
23 | response.set(value.get('relativePath'), value.get('postName'));
24 | }
25 |
26 | for (const [, value] of folder.get('folders')) {
27 | response = new Map([...response, ...createSidebarFolder(value)]);
28 | }
29 |
30 | return response;
31 | }
32 |
33 | export default function createSidebar(generateIndex = false) {
34 | const data = createPressData(path.resolve('pages/'))[0];
35 | const parentMap = new Map();
36 | const sidebar = new Map();
37 |
38 | for (const [key, value] of data.get('folders')) {
39 | parentMap.set(key, createSidebarFolder(value));
40 | }
41 |
42 | for (const [keyP, valueP] of parentMap) {
43 | let lastFolder;
44 | const tmpMap = new Map();
45 |
46 | for (const [key, value] of valueP) {
47 | const filePath = key.toLowerCase();
48 | if (
49 | (filePath.endsWith('/readme.md') || (typeof value === 'object' && value !== null)) &&
50 | lastFolder !== key
51 | ) {
52 | value['files'] = new Map();
53 | tmpMap.set(key, value);
54 | lastFolder = key;
55 | } else {
56 | tmpMap.get(lastFolder)['files'].set(key, value);
57 | }
58 | }
59 | sidebar.set(keyP, tmpMap);
60 | }
61 | if (generateIndex) {
62 | writeFileSync(
63 | './src/lib/SveltePress/db/sveltePressSidebar.js',
64 | 'export default ' + Jsesc(sidebar, { compact: true, es6: true })
65 | );
66 | }
67 | return sidebar;
68 | }
69 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/markdown/MD2FM.js:
--------------------------------------------------------------------------------
1 | import fm from 'front-matter';
2 |
3 | export default function md2fm(content) {
4 | return fm(content);
5 | }
6 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/markdown/MD2HTML.js:
--------------------------------------------------------------------------------
1 | import md2fm from '$lib/SveltePress/markdown/MD2FM';
2 | import { mdConverter } from '$lib/SveltePress/markdown/MDConverter';
3 | import { getContent } from '$lib/SveltePress/SveltePressData';
4 |
5 | import { readFileSync, existsSync } from 'fs';
6 | import path from 'path';
7 |
8 | export function md2html(post) {
9 | try {
10 | let md = '';
11 |
12 | // First block handles dev mode
13 | // reads the file directly from disk
14 | // allowing md modifications without
15 | // the need to HMR
16 | // Second block handles prod
17 | // reads files from db
18 | if (!getContent()) {
19 | let fullPath = path.resolve(`pages/${post}.md`);
20 | if (!existsSync(fullPath)) {
21 | return {
22 | error: true,
23 | status: 404
24 | };
25 | }
26 | md = readFileSync(fullPath).toString();
27 | } else {
28 | let fullPath = getContent().has(`${post}.md`);
29 | if (!fullPath) {
30 | return {
31 | error: true,
32 | status: 404
33 | };
34 | }
35 | md = getContent().get(`${post}.md`);
36 | }
37 |
38 | const frontmatter = md2fm(md);
39 | const content = mdConverter(frontmatter.body);
40 | // meta includes ALL fm attributes
41 | return {
42 | body: content,
43 | meta: frontmatter.attributes || {}
44 | };
45 | } catch (e) {
46 | return {
47 | error: true,
48 | status: 500
49 | };
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/markdown/MDConverter.js:
--------------------------------------------------------------------------------
1 | import { marked } from 'marked';
2 | import sanitizeHtml from 'sanitize-html';
3 | import hljs from 'highlight.js';
4 |
5 | // sanitize-html options
6 | const sanitizeOptions = {
7 | allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']),
8 | allowedClasses: {
9 | code: ['language-*', 'lang-*'],
10 | span: ['hljs-*']
11 | },
12 | selfClosing: []
13 | };
14 |
15 | // Marked options
16 | marked.setOptions({
17 | renderer: new marked.Renderer(),
18 | highlight: function (code, lang) {
19 | const language = hljs.getLanguage(lang) ? lang : 'plaintext';
20 | return hljs.highlight(code, { language }).value;
21 | },
22 | pedantic: false,
23 | gfm: true,
24 | breaks: false,
25 | sanitize: false,
26 | smartLists: true,
27 | smartypants: false,
28 | xhtml: false
29 | });
30 |
31 | // Here you can change the default markdown converter
32 | export function mdConverter(content) {
33 | const html = marked(content);
34 | // Sanitize it
35 | return sanitizeHtml(html, sanitizeOptions);
36 | }
--------------------------------------------------------------------------------
/src/lib/SveltePress/sveltePress.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | // Nav Items shown at the navbar/app menu
3 | // overwrite => false [default]
4 | // If overwrite is true, then the `items` will
5 | // overwrite the auto-generated ones.
6 | // If overwrite is false, then the `items` will
7 | // be merged with the default ones.
8 | // TIP: you can use overwrite: true to hide
9 | // GRANDPARENTs by including the public ones
10 | // to `items` like so:
11 | // items: [{ link: "/guide", name: "Guide" }]
12 | nav: {
13 | overwrite: false,
14 | items: [
15 | {
16 | link: 'https://cakepop.vercel.app/',
17 | name: 'cakepop'
18 | },
19 | {
20 | link: 'https://github.com/GeopJr/SveltePress',
21 | name: 'GitHub'
22 | }
23 | ]
24 | },
25 | // Used in title meta tag
26 | title: 'SveltePress',
27 | // Sorting method
28 | // Types: alphabetically, modified
29 | // alphabetically => A-Z (reverse: Z-A) [default]
30 | // modified => last modified (reverse: first modified)
31 | sorting: {
32 | type: 'alphabetically',
33 | reverse: false
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/theme/components/content.svelte:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
41 |
42 |
52 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/theme/components/search.svelte:
--------------------------------------------------------------------------------
1 |
8 |
9 | {
14 | selectedHref = e.detail.selectedResult.href;
15 | }}
16 | />
17 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/theme/components/sidebar.svelte:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 | {#each groupMap as [, valueP], i}
27 | {#if i === 0}
28 |
29 | {#if valueP && [...valueP.files].length > 0}
30 |
31 | {#each [...valueP.files] as [key, value]}
32 |
38 | {/each}
39 | {/if}
40 | {:else}
41 |
42 | {#each [...valueP.files] as [key, value]}
43 |
49 | {/each}
50 |
51 | {/if}
52 |
53 | {/each}
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/theme/meta/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sveltepress-carbon",
3 | "version": "1.0.0",
4 | "type": "module",
5 | "devDependencies": {
6 | "@carbon/themes": "11.2.0",
7 | "carbon-components": "10.56.0",
8 | "carbon-components-svelte": "0.63.3",
9 | "carbon-icons-svelte": "11.0.1",
10 | "carbon-preprocess-svelte": "0.9.0",
11 | "svelte-typewriter": "2.4.5"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/theme/meta/root/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/src/lib/SveltePress/theme/meta/root/.gitkeep
--------------------------------------------------------------------------------
/src/lib/SveltePress/theme/meta/svelte.config.js:
--------------------------------------------------------------------------------
1 | // Use this file to override the main config
2 | import { optimizeImports } from 'carbon-preprocess-svelte';
3 | import sveltePreprocess from 'svelte-preprocess';
4 |
5 | export const config = {
6 | preprocess: [
7 | optimizeImports(),
8 | sveltePreprocess({
9 | scss: true,
10 | sass: true,
11 | replace: [
12 | [
13 | 'import \'$lib/SveltePress/theme/styles/global.scss\'',
14 | process.env.NODE_ENV === 'production'
15 | ? 'import \'$lib/SveltePress/theme/styles/global.scss\''
16 | : 'import \'carbon-components-svelte/css/all.css\';import \'$lib/SveltePress/theme/styles/patches.scss\''
17 | ]
18 | ]
19 | })
20 | ]
21 | };
--------------------------------------------------------------------------------
/src/lib/SveltePress/theme/styles/global.scss:
--------------------------------------------------------------------------------
1 | $feature-flags: (
2 | enable-css-custom-properties: true,
3 | grid-columns-16: true
4 | );
5 |
6 | @import '@carbon/themes/scss/themes';
7 |
8 | :root {
9 | @include carbon--theme($carbon--theme--white, true);
10 | }
11 |
12 | :root[theme='g10'] {
13 | @include carbon--theme($carbon--theme--g10, true);
14 | }
15 |
16 | :root[theme='g90'] {
17 | @include carbon--theme($carbon--theme--g90, true);
18 | }
19 |
20 | :root[theme='g100'] {
21 | @include carbon--theme($carbon--theme--g100, true);
22 | }
23 |
24 | $css--font-face: true;
25 | $css--helpers: true;
26 | $css--body: true;
27 | $css--use-layer: true;
28 | $css--reset: true;
29 | $css--default-type: true;
30 | $css--plex: true;
31 |
32 | @import 'carbon-components/scss/globals/scss/_css--reset.scss';
33 | @import 'carbon-components/scss/globals/scss/_css--font-face.scss';
34 | @import 'carbon-components/scss/globals/scss/_css--helpers.scss';
35 | @import 'carbon-components/scss/globals/scss/_css--body.scss';
36 | @import 'carbon-components/scss/globals/grid/_grid.scss';
37 |
38 | /* import individual components SCSS */
39 | @import 'carbon-components/scss/components/button/button';
40 | @import 'carbon-components/scss/components/ui-shell/ui-shell';
41 | @import 'carbon-components/scss/components/tile/tile';
42 |
43 | /* import patches */
44 | @import './patches.scss';
45 |
--------------------------------------------------------------------------------
/src/lib/SveltePress/theme/styles/patches.scss:
--------------------------------------------------------------------------------
1 | .sp--sidebar-grandparent {
2 | pointer-events: none;
3 | }
4 | .bx--btn {
5 | overflow-wrap: anywhere;
6 | /* Safari & Opera */
7 | word-break: break-word;
8 | }
9 | .bx--switcher__item-link:focus {
10 | outline-color: var(--cds-button-primary);
11 | }
12 | #main-content ul {
13 | list-style-type: square;
14 | }
15 | li {
16 | line-height: var(--cds-body-long-02-line-height, 1.5);
17 | }
18 | a {
19 | color: var(--cds-button-primary);
20 | line-height: var(--cds-body-long-02-line-height, 1.5);
21 | }
22 | blockquote {
23 | background-color: var(--cds-ui-background);
24 | padding: 0.2rem 1rem;
25 | margin: 1rem 0;
26 | }
27 | p {
28 | > img {
29 | max-width: 100%;
30 | }
31 |
32 | > code {
33 | background-color: var(--cds-ui-background);
34 | }
35 | }
36 |
37 | pre {
38 | background-color: var(--cds-ui-background);
39 | padding: 1rem;
40 | }
41 |
42 | :root[theme='g10'],
43 | :root[theme='white'] {
44 | pre {
45 | background-color: var(--cds-ui-03);
46 | }
47 | }
48 |
49 | pre,
50 | code {
51 | white-space: pre-wrap;
52 | }
53 |
54 | .bx--btn--primary:hover {
55 | background-color: var(--cds-button-primary-hover);
56 | }
57 | .bx--side-nav ~ .bx--content {
58 | margin-left: 0;
59 | }
60 |
61 | :root,
62 | :root[theme='g10'],
63 | :root[theme='g100'],
64 | :root[theme='g90'],
65 | :root[theme='white'] {
66 | --cds-body-long-02-line-height: 1.8;
67 | --cds-interactive-01: #ff3e00;
68 | --cds-button-primary: #ff3e00;
69 | --cds-button-primary-hover: #e23900;
70 | --cds-button-primary-active: #c23000;
71 | --cds-focus: var(--cds-button-primary);
72 | }
73 |
74 | a.bx--side-nav__link[aria-current='page'],
75 | a.bx--side-nav__link--current {
76 | &::before {
77 | background-color: var(--cds-button-primary);
78 | }
79 | }
80 |
81 | a.bx--header__name,
82 | .bx--header__action,
83 | a.bx--header__menu-item,
84 | .bx--skip-to-content {
85 | &:focus {
86 | border-color: var(--cds-button-primary);
87 | }
88 | }
89 |
90 | [role='search'].active {
91 | outline-color: var(--cds-button-primary) !important;
92 | }
93 |
94 | .bx--side-nav.bx--side-nav--expanded ~ .bx--content {
95 | @media only screen and (max-width: 1056px) {
96 | margin-left: 0rem;
97 | }
98 | }
99 |
100 | #main-content .bx--col {
101 | span,
102 | h1,
103 | h2,
104 | h3,
105 | h4,
106 | h5,
107 | h6,
108 | blockquote,
109 | pre,
110 | img,
111 | dl,
112 | form,
113 | table,
114 | canvas,
115 | embed,
116 | figure,
117 | audio,
118 | video {
119 | margin: 1.5rem 0;
120 | }
121 |
122 | ol,
123 | ul {
124 | margin: 1rem 0;
125 | }
126 |
127 | h1:first-child {
128 | margin-top: 0;
129 | }
130 |
131 | code {
132 | line-height: var(--cds-code-01-line-height, 1.34);
133 | }
134 | }
135 |
136 | .bx--side-nav {
137 | z-index: 50;
138 | }
139 |
--------------------------------------------------------------------------------
/src/routes/[...group]/[slug].json.js:
--------------------------------------------------------------------------------
1 | import { md2html } from '$lib/SveltePress/markdown/MD2HTML';
2 | import { getData } from '$lib/SveltePress/SveltePressData';
3 |
4 | // Gets current folder from spData used to get the file
5 | function getFolder(folderStructure) {
6 | let folder = getData();
7 | if (folderStructure.length > 0) {
8 | const folders = folderStructure.split('/');
9 | for (let i = 0; i < folders.length; i++) {
10 | folder = folder.get('folders').get(folders[i]);
11 | if (folder === undefined) break;
12 | }
13 | if (folder === undefined) return;
14 | }
15 | return folder;
16 | }
17 |
18 | // Gets the file based on the folder returned from getFolder
19 | // and the slug
20 | function getFile(folder, slug) {
21 | if (folder && folder.get('files').has(slug + '.md')) {
22 | return folder.get('files').get(slug + '.md');
23 | } else {
24 | return;
25 | }
26 | }
27 |
28 | // Creates pagination based on the folder returned from getFolder
29 | function getPagination(folder, slug) {
30 | if (folder && folder.get('files').has(slug + '.md')) {
31 | const files = folder.get('files').entries();
32 |
33 | let previous, next;
34 | let found = false;
35 | for (const [, value] of files) {
36 | if (found) {
37 | next = value;
38 | break;
39 | }
40 | if (value.get('name') === slug) {
41 | found = true;
42 | } else {
43 | previous = value;
44 | }
45 | }
46 |
47 | return {
48 | previous,
49 | next
50 | };
51 | }
52 | return;
53 | }
54 |
55 | // Handle post request
56 | export async function post({ params, request }) {
57 | const body = await request.json();
58 | // Get slug and group either from post body
59 | // if avaliable, else from params (not always correct)
60 | const { slug, group } = body ?? params;
61 |
62 | let post = group + '/' + slug;
63 |
64 | const content = md2html(post);
65 |
66 | if (content.error) {
67 | return { body: content };
68 | }
69 |
70 | let folder = getFolder(group);
71 |
72 | let file = getFile(folder, slug);
73 |
74 | // Injects file date if not manually defined
75 | // this can be used in [slug].svelte
76 | if (!Object.prototype.hasOwnProperty.call(content.meta, 'date') && file) {
77 | content.meta.date = file.get('date');
78 | }
79 |
80 | // Same for postName
81 | if (!Object.prototype.hasOwnProperty.call(content.meta, 'postName') && file) {
82 | content.meta.postName = file.get('postName');
83 | }
84 |
85 | const pagination = getPagination(folder, slug);
86 |
87 | // Pagination can return undefined
88 | // if so, use the exact next available file for next
89 | let paginationBody = {
90 | previous: null,
91 | next: Object.fromEntries(folder.get('files').values().next().value ?? [])
92 | };
93 |
94 | if (pagination) {
95 | paginationBody = {
96 | previous: Object.fromEntries(pagination.previous ?? []),
97 | next: Object.fromEntries(pagination.next ?? [])
98 | };
99 | }
100 |
101 | // meta is all fm metadata
102 | const responseBody = {
103 | body: content.body,
104 | meta: content.meta,
105 |
106 | pagination: paginationBody
107 | };
108 |
109 | return {
110 | body: responseBody
111 | };
112 | }
113 |
--------------------------------------------------------------------------------
/src/routes/[...group]/[slug].svelte:
--------------------------------------------------------------------------------
1 |
51 |
52 |
58 |
59 |
60 |
61 | {post.meta.postName + ' - ' + Config.title}
62 |
63 |
64 |
65 | {@html post.body}
66 |
67 |
--------------------------------------------------------------------------------
/src/routes/__error.svelte:
--------------------------------------------------------------------------------
1 |
11 |
12 |
16 |
17 |
18 | {status}
19 | {error}
20 |
21 |
22 |
29 |
--------------------------------------------------------------------------------
/src/routes/__layout.svelte:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 |
22 |
23 | {#if sidebar}
24 |
25 | {/if}
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/stores.js:
--------------------------------------------------------------------------------
1 | import { writable } from 'svelte/store';
2 |
3 | // default theme color
4 | export const theme = writable('g100');
5 |
--------------------------------------------------------------------------------
/static/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/android-chrome-192x192.png
--------------------------------------------------------------------------------
/static/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/android-chrome-512x512.png
--------------------------------------------------------------------------------
/static/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/apple-touch-icon.png
--------------------------------------------------------------------------------
/static/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #ffffff
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/static/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/favicon-16x16.png
--------------------------------------------------------------------------------
/static/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/favicon-32x32.png
--------------------------------------------------------------------------------
/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/favicon.ico
--------------------------------------------------------------------------------
/static/mstile-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/mstile-144x144.png
--------------------------------------------------------------------------------
/static/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/mstile-150x150.png
--------------------------------------------------------------------------------
/static/mstile-310x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/mstile-310x150.png
--------------------------------------------------------------------------------
/static/mstile-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/mstile-310x310.png
--------------------------------------------------------------------------------
/static/mstile-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeopJr/SveltePress/8694218d15ccf440af86ba270c9a6c65cdfaa8e6/static/mstile-70x70.png
--------------------------------------------------------------------------------
/static/safari-pinned-tab.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 | Created by potrace 1.14, written by Peter Selinger 2001-2017
9 |
10 |
12 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/static/site.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SveltePress",
3 | "short_name": "SveltePress",
4 | "icons": [
5 | {
6 | "src": "/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "theme_color": "#ffffff",
17 | "background_color": "#ffffff",
18 | "display": "standalone"
19 | }
20 |
--------------------------------------------------------------------------------
/svelte.config.js:
--------------------------------------------------------------------------------
1 | import sveltePreprocess from 'svelte-preprocess';
2 | import { config as themeConfig } from './src/lib/SveltePress/theme/meta/svelte.config.js';
3 | // Pick one of the adapters listed below
4 | // or install and use others
5 | import node from '@sveltejs/adapter-node';
6 | import vercel from '@sveltejs/adapter-vercel';
7 | import netlify from '@sveltejs/adapter-netlify';
8 | import staticAdptr from '@sveltejs/adapter-static';
9 |
10 | /** @type {import('@sveltejs/kit').Config} */
11 | const config = {
12 | kit: {
13 | // Use your desired adapter
14 | adapter: vercel(),
15 | vite: () => ({
16 | // Purges too much, disabled for now
17 | // plugins: [process.env.NODE_ENV === 'production' && optimizeCss()],
18 | server: {
19 | watch: {
20 | ignored: ['./gui/', './create-sveltepress-app', './pandoc/']
21 | }
22 | },
23 | ...themeConfig.kit?.vite?.()
24 | })
25 | },
26 | preprocess: [
27 | sveltePreprocess({
28 | scss: true,
29 | sass: true
30 | }),
31 | ...themeConfig.preprocess
32 | ]
33 | };
34 |
35 | if (config.kit?.adapter?.name === '@sveltejs/adapter-static') {
36 | config.kit.prerender = {
37 | crawl: true,
38 | enabled: true
39 | };
40 | }
41 |
42 | export default config;
43 |
--------------------------------------------------------------------------------