Skip to content

Commit

Permalink
Open-sourcing
Browse files Browse the repository at this point in the history
  • Loading branch information
gxres042 committed Jul 24, 2024
0 parents commit 85d7952
Show file tree
Hide file tree
Showing 23 changed files with 351 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules

# Output
.output
.vercel
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Sliver Complex - Landing Site

The landing site of Sliver Complex, powered by SvelteKit.
Binary file added bun.lockb
Binary file not shown.
33 changes: 33 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
];
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "s-complex",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.2",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/eslint": "^8.56.7",
"@unocss/extractor-svelte": "^0.61.3",
"@unocss/transformer-compile-class": "^0.61.3",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0-alpha.20",
"unocss": "^0.61.3",
"vite": "^5.0.3"
},
"type": "module",
"dependencies": {
"@unocss/reset": "^0.61.3",
"svelte-theme-select": "^0.0.7"
}
}
13 changes: 13 additions & 0 deletions src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
11 changes: 11 additions & 0 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
7 changes: 7 additions & 0 deletions src/components/Footer.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script lang="ts">
</script>

<footer class=":uno: p-4 text-center">
<p>© 2022 - {@html new Date().getFullYear()} <a href="/">Sliver Complex</a>. Powered by SvelteKit.</p>
</footer>
10 changes: 10 additions & 0 deletions src/components/Header.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<header class=":uno: shadow-md bg-white dark:bg-neutral-700 px-2">
<nav class=":uno: flex justify-center gap-1">
<a class=":uno: nav-item" href="/">
<img width="32" height="32" src="https://library.gxres.net/images/icons/favicon.webp" alt="Site favicon" />
</a>
<a class=":uno: nav-item" href="/">Index</a>
<a class=":uno: nav-item" href="/project">Project</a>
<a class=":uno: nav-item" href="/about">About</a>
</nav>
</header>
1 change: 1 addition & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.
39 changes: 39 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<script lang="ts">
import 'uno.css';
import Header from '../components/Header.svelte';
import Footer from '../components/Footer.svelte';
import { createThemeSwitcher, Theme } from 'svelte-theme-select';
createThemeSwitcher();
</script>

<svelte:head>
<title>Sliver Complex</title>
<meta name="description" content="The landing site of Sliver Complex.">
<link rel="icon" href="https://library.gxres.net/images/icons/favicon.webp">
</svelte:head>

<div>
<Header />
<main class=":uno: max-w-4xl mx-auto p-4">
<slot />
</main>
<Footer />
</div>

<Theme />

<style>
:global(body) {
--apply: m-0 bg-white dark:bg-neutral-800;
font-family: 'Noto Sans';
}
:global(h1, h2, h3, h4, h5, h6, p) {
--apply: text-black dark:text-white;
}
:global(a) {
--apply: text-sky-600 no-underline;
}
:global(code) {
--apply: text-red font-family: 'Jetbrains Mono';
}
</style>
1 change: 1 addition & 0 deletions src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const prerender = true;
23 changes: 23 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<section class=":uno: flex justify-center text-center space-y-4">
<div>
<span class=":uno: flex justify-center">
<img
class=":uno: rounded-full"
width="128"
height="128"
src="https://library.gxres.net/images/icons/big-favicon.webp"
alt="Sliver Complex logo"
/>
</span>
<hgroup>
<h1>Sliver Complex</h1>
<p>
Personal lab of <a target="_blank" href="https://github.com/gxres042">@gxres042</a> and
<a target="_blank" href="https://github.com/slivermoe">slivermoe</a>
</p>
</hgroup>
<br>
<p class=":uno: text-sm">* We use domain <code>slirv.vip</code> to serve some services, such as the comment system and the self-hosted analysis service.</p>
<p></p>
</div>
</section>
22 changes: 22 additions & 0 deletions src/routes/about/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<h1>About</h1>
<p>Sliver Complex is a personal lab belongs to Restent Ou and SliverRiver.</p>
<h2>Direction</h2>
<p>
We focus on the production of every front-end project, which will finally be used on our website
or others.
</p>
<p>
We usually use Vue as the main front-end framework. At the same time, we sometimes use React and
Svelte in other projects.
</p>
<h2>Services</h2>
<p>
Now, the GitHub organization of Sliver Complex hosts our website project, and its associated
domain, <code>slirv.vip</code>, also provides some of the services that complement our website.
</p>
<p>
However, we are glad to help others building their websites, such as personal homepage and blog,
although our current capacity is still limited. <a
href="https://library.gxres.net/social/for-contact">Contact us</a
> if you are interested.
</p>
43 changes: 43 additions & 0 deletions src/routes/project/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<script lang="ts">
import { onMount } from 'svelte';
interface Repo {
name: string;
html_url: string;
description: string;
}
let repos: Repo[] = [];
let isLoading = true;
onMount(async () => {
const response = await fetch('https://api.slirv.vip/org-projects');
const data: Repo[] = await response.json();
repos = data.map((repo) => ({
name: repo.name,
html_url: repo.html_url,
description: repo.description
}));
isLoading = false;
});
</script>

<hgroup>
<h1>Project</h1>
<p>List of projects that are visible to everyone in this lab.</p>
</hgroup>

{#if isLoading}
<p>Loading...</p>
{:else}
<div class=":uno: grid grid-cols-1 sm:grid-cols-2 gap-4">
{#each repos as repo (repo.name)}
<a href={repo.html_url}>
<div class=":uno: px-4 py-2 shadow-md hover:shadow-lg rounded">
<p class=":uno: text-2xl font-semibold">{repo.name}</p>
<p>{repo.description}</p>
</div>
</a>
{/each}
</div>
{/if}
Binary file added static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import adapter from '@sveltejs/adapter-static'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),

kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
},

};

export default config;
19 changes: 19 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
25 changes: 25 additions & 0 deletions uno.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { defineConfig, presetUno, presetWebFonts, transformerDirectives } from 'unocss';
import transformerCompileClass from '@unocss/transformer-compile-class';

export default defineConfig({
presets: [
presetUno(),
presetWebFonts({
provider: 'bunny',
fonts: {
sans: 'Noto Sans',
mono: 'Jetbrains Mono'
}
})
],
shortcuts: {
'nav-item':
'px-2 py-3 hover:bg-neutral-100 dark:hover:bg-neutral-600 flex items-center text-black dark:text-white no-underline'
},
transformers: [
transformerCompileClass(),
transformerDirectives({
applyVariable: ['--apply']
})
]
});
7 changes: 7 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import UnoCSS from 'unocss/vite';

export default defineConfig({
plugins: [UnoCSS(), sveltekit()]
});

0 comments on commit 85d7952

Please sign in to comment.