Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions examples/unocss-1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
node_modules

# Output
.output
.vercel
.netlify
.wrangler
/.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 examples/unocss-1/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
9 changes: 9 additions & 0 deletions examples/unocss-1/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
bun.lock
bun.lockb

# Miscellaneous
/static/
15 changes: 15 additions & 0 deletions examples/unocss-1/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
38 changes: 38 additions & 0 deletions examples/unocss-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# sv

Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```sh
# create a new project in the current directory
npx sv create

# create a new project in my-app
npx sv create my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```sh
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```sh
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
33 changes: 33 additions & 0 deletions examples/unocss-1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "standalone",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier --write .",
"lint": "prettier --check ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^7.0.0",
"@sveltejs/kit": "^2.49.2",
"@sveltejs/vite-plugin-svelte": "^6.2.1",
"@unocss/preset-wind4": "^66.5.10",
"@unocss/svelte-scoped": "^66.5.10",
"layerchart": "next",
"mode-watcher": "^1.1.0",
"prettier": "^3.7.4",
"prettier-plugin-svelte": "^3.3.3",
"svelte": "5.46.0",
"svelte-check": "^4.3.4",
"typescript": "^5.9.3",
"unocss": "^66.5.10",
"vite": "^7.2.7",
"vite-plugin-devtools-json": "^1.0.0"
}
}
24 changes: 24 additions & 0 deletions examples/unocss-1/src/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
body {
font-family: ui-sans-serif, system-ui, sans-serif;
}

.lc-root-container {
/* Default marks color when not using explicit color or color scale */
--color-primary: var(--colors-blue-500);

/* Progressively darker shades representing surfaces (backgrounds). */
--color-surface-100: var(--colors-white);
--color-surface-200: var(--colors-gray-100);
--color-surface-300: var(--colors-gray-300);

/* Content (text) color */
--color-surface-content: var(--colors-gray-900);

/* Dark mode */
html.dark & {
--color-surface-100: var(--colors-zinc-800);
--color-surface-200: var(--colors-zinc-900);
--color-surface-300: var(--colors-zinc-950);
--color-surface-content: var(--colors-zinc-100);
}
}
13 changes: 13 additions & 0 deletions examples/unocss-1/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// 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 examples/unocss-1/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% %unocss-svelte-scoped.global%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
1 change: 1 addition & 0 deletions examples/unocss-1/src/lib/assets/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/unocss-1/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.
24 changes: 24 additions & 0 deletions examples/unocss-1/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
import { ModeWatcher, mode, toggleMode } from 'mode-watcher';
import '../app.css';

import favicon from '$lib/assets/favicon.svg';

let { children } = $props();
</script>

<svelte:head>
<link rel="icon" href={favicon} />
</svelte:head>

<ModeWatcher />

<main class="p-4">
<div class="pb-4 text-right">
<button onclick={toggleMode}>
{mode.current === 'dark' ? '🌞' : '🌙'} Toggle mode
</button>
</div>

{@render children?.()}
</main>
67 changes: 67 additions & 0 deletions examples/unocss-1/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<script lang="ts">
import { ArcChart, AreaChart, BarChart, LineChart, PieChart, ScatterChart } from 'layerchart';

const data = [
{ date: new Date('2025-01-01T00:00'), value: 30 },
{ date: new Date('2025-02-01T00:00'), value: 50 },
{ date: new Date('2025-03-01T00:00'), value: 40 },
{ date: new Date('2025-04-01T00:00'), value: 70 },
{ date: new Date('2025-05-01T00:00'), value: 60 },
{ date: new Date('2025-06-01T00:00'), value: 90 }
];

const pieData = [
{
fruit: 'Apples',
value: 3840
},
{
fruit: 'Bananas',
value: 1920
},
{
fruit: 'Cherries',
value: 960
},
{
fruit: 'Grapes',
value: 400
}
];
</script>

<main class="grid grid-cols-2 gap-10">
<div class="h-[200px]">
<AreaChart
{data}
x="date"
y="value"
props={{ area: { class: 'fill-[var(--color-primary)]' } }}
/>
</div>

<div class="h-[200px]">
<LineChart {data} x="date" y="value" />
</div>

<div class="h-[200px]">
<BarChart {data} x="date" y="value" />
</div>

<div class="h-[200px]">
<ScatterChart {data} x="date" y="value" />
</div>

<div class="h-[200px]">
<PieChart data={pieData} key="fruit" value="value" />
</div>

<div class="h-[200px]">
<ArcChart
data={[{ key: 'Example', value: 70 }]}
maxValue={100}
innerRadius={-20}
cornerRadius={10}
/>
</div>
</main>
3 changes: 3 additions & 0 deletions examples/unocss-1/static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# allow crawling everything by default
User-agent: *
Disallow:
12 changes: 12 additions & 0 deletions examples/unocss-1/svelte.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

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

export default config;
19 changes: 19 additions & 0 deletions examples/unocss-1/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://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// To make changes to top-level options such as include and exclude, we recommend extending
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript
}
15 changes: 15 additions & 0 deletions examples/unocss-1/uno.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'unocss';
import { presetWind4 } from '@unocss/preset-wind4';

export default defineConfig({
presets: [
presetWind4({
preflights: {
reset: false,
theme: {
mode: true // Generate all theme CSS variables (or use 'on-demand')
}
}
})
]
});
8 changes: 8 additions & 0 deletions examples/unocss-1/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vite';
import devtoolsJson from 'vite-plugin-devtools-json';
import { sveltekit } from '@sveltejs/kit/vite';
import UnoCSS from '@unocss/svelte-scoped/vite';

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