Skip to content

Commit b5b1eb7

Browse files
authored
"Updated GitHub workflow, package dependencies, and code files for Svelte app" (#2)
* "Updated GitHub workflow, package dependencies, and code files for Svelte app" * fix lockfile * fix typesafe
1 parent 0195929 commit b5b1eb7

11 files changed

+106
-115
lines changed

.github/release.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# .github/release.yml
2+
3+
changelog:
4+
categories:
5+
- title: 🏕 Features
6+
labels:
7+
- '*'
8+
exclude:
9+
labels:
10+
- dependencies
11+
- title: 👒 Dependencies
12+
labels:
13+
- dependencies

.github/workflows/deploy.yml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
push:
1010
branches:
1111
- main
12+
paths:
13+
- src/**
1214
workflow_dispatch:
1315

1416
jobs:

bun.lockb

11.3 KB
Binary file not shown.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,17 @@
4141
"@sveltejs/kit": "^2.5.27",
4242
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.7",
4343
"@tailwindcss/typography": "^0.5.15",
44+
"@tailwindcss/vite": "^4.0.0-alpha.24",
4445
"@types/bun": "latest",
4546
"@types/node": "^22.5.5",
4647
"autoprefixer": "^10.4.20",
4748
"eslint-plugin-svelte": "^2.44.0",
4849
"svelte": "^5.0.0-next.257",
4950
"svelte-check": "^4.0.2",
50-
"tailwindcss": "^3.4.11",
51+
"tailwindcss": "^4.0.0-alpha.24",
5152
"tslib": "^2.4.1",
5253
"typescript": "^5.6.2",
53-
"vite": "^5.4.5"
54+
"vite": "^5.4.7"
5455
},
5556
"module": "index.ts"
5657
}

postcss.config.cjs

-6
This file was deleted.

src/app.css

+66-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import "tailwindcss";
42

53
@layer base {
64
:root {
@@ -25,30 +23,74 @@
2523
--ring: 194 54.5% 61.2%;
2624
--radius: 0.75rem;
2725
}
28-
.dark {
29-
--background: 194 10% 5%;
30-
--foreground: 194 0% 90%;
31-
--card: 194 0% 0%;
32-
--card-foreground: 194 0% 90%;
33-
--popover: 194 10% 5%;
34-
--popover-foreground: 194 0% 90%;
35-
--primary: 194 54.5% 61.2%;
36-
--primary-foreground: 0 0% 0%;
37-
--secondary: 194 10% 10%;
38-
--secondary-foreground: 0 0% 100%;
39-
--muted: 156 10% 15%;
40-
--muted-foreground: 194 0% 60%;
41-
--accent: 156 10% 15%;
42-
--accent-foreground: 194 0% 90%;
43-
--destructive: 0 50% 30%;
44-
--destructive-foreground: 194 0% 90%;
45-
--border: 194 20% 18%;
46-
--input: 194 20% 18%;
47-
--ring: 194 54.5% 61.2%;
48-
--radius: 0.75rem;
26+
}
27+
28+
@theme {
29+
--color-border: hsl(var(--border));
30+
--color-input: hsl(var(--input));
31+
--color-ring: hsl(var(--ring));
32+
--color-background: hsl(var(--background));
33+
--color-foreground: hsl(var(--foreground));
34+
35+
--color-primary: hsl(var(--primary));
36+
--color-primary-foreground: hsl(var(--primary-foreground));
37+
38+
--color-secondary: hsl(var(--secondary));
39+
--color-secondary-foreground: hsl(var(--secondary-foreground));
40+
41+
--color-destructive: hsl(var(--destructive));
42+
--color-destructive-foreground: hsl(var(--destructive-foreground));
43+
44+
--color-muted: hsl(var(--muted));
45+
--color-muted-foreground: hsl(var(--muted-foreground));
46+
47+
--color-accent: hsl(var(--accent));
48+
--color-accent-foreground: hsl(var(--accent-foreground));
49+
50+
--color-popover: hsl(var(--popover));
51+
--color-popover-foreground: hsl(var(--popover-foreground));
52+
53+
--color-card: hsl(var(--card));
54+
--color-card-foreground: hsl(var(--card-foreground));
55+
56+
--radius-sm: calc(var(--radius) - 4px);
57+
--radius-md: calc(var(--radius) - 2px);
58+
--radius-lg: var(--radius);
59+
60+
--font-family: "M PLUS 2 Variable", var(--font-sans);
61+
62+
--animate-accordion-down: accordion-down 0.2s ease-out;
63+
--animate-accordion-up: accordion-up 0.2s ease-out;
64+
65+
@keyframes accordion-down {
66+
from {
67+
height: 0;
68+
}
69+
70+
to {
71+
height: var(--radix-accordion-content-height);
72+
}
73+
}
74+
75+
@keyframes accordion-up {
76+
from {
77+
height: var(--radix-accordion-content-height);
78+
}
79+
80+
to {
81+
height: "0";
82+
}
4983
}
5084
}
5185

86+
.border {
87+
border-color: #e4e5e9;
88+
}
89+
90+
button {
91+
cursor: pointer;
92+
}
93+
5294
@layer base {
5395
* {
5496
@apply border-border;

src/routes/+layout.svelte

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ import { page } from "$app/stores";
1010
</svelte:head>
1111

1212
<Toaster />
13-
<slot />
13+
<slot />
14+
15+
<style>
16+
:global(body) {
17+
font-family: "M PLUS 2 Variable", var(--font-sans);
18+
}
19+
</style>

src/routes/+page.svelte

+8-10
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ let inputText: PersistentStore<string> = persist(
3333
createLocalStorage(),
3434
"inputText",
3535
);
36-
let preview: string = "";
36+
let preview = "";
3737
let textarea: Textarea;
38-
let open: boolean = true;
38+
let open = true;
3939
let fileInput: HTMLInputElement;
4040
4141
let urlSearchParams = $page.url.searchParams;
@@ -104,7 +104,7 @@ if (isTauriApp()) {
104104
/>
105105

106106
<main class="h-screen">
107-
{#if $inputText === "" || !inputText}
107+
{#if ($inputText === "" || !inputText) && !isTauriApp() }
108108
<Dialog.Root bind:open>
109109
<Dialog.Content>
110110
<Dialog.Header>
@@ -115,13 +115,11 @@ if (isTauriApp()) {
115115
</Dialog.Description>
116116
</Dialog.Header>
117117
<Button on:click={() => open = false}><FilePlus2 class="mr-2" />新しく書く</Button>
118-
{#if !isTauriApp()}
119-
<Button on:click={() => fileInput.click()}>
120-
<FilePen class="mr-2" />
121-
ファイルを開く
122-
<input type="file" accept=".txt" class="hidden" bind:this={fileInput} on:change={handleFileChange} />
123-
</Button>
124-
{/if}
118+
<Button on:click={() => fileInput.click()}>
119+
<FilePen class="mr-2" />
120+
ファイルを開く
121+
<input type="file" accept=".txt" class="hidden" bind:this={fileInput} on:change={handleFileChange} />
122+
</Button>
125123
</Dialog.Content>
126124
</Dialog.Root>
127125
{/if}

src/routes/utils/insert-ruby-to-textarea.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ export function insertRubyToTextarea(
99
return null;
1010
}
1111
const selectionStart: number =
12-
(textarea as HTMLTextAreaElement).selectionStart ?? undefined;
12+
(textarea as unknown as HTMLTextAreaElement).selectionStart ?? undefined;
1313
const selectionEnd: number =
14-
(textarea as HTMLTextAreaElement).selectionEnd ?? undefined;
14+
(textarea as unknown as HTMLTextAreaElement).selectionEnd ?? undefined;
1515

1616
if (selectionStart === undefined || selectionEnd === undefined) {
17-
return null; // 何かしらの対応をここで追加
17+
return null;
1818
}
1919

20-
return (
21-
inputText.slice(0, selectionStart) + "|《》" + inputText.slice(selectionEnd)
22-
);
20+
return `${inputText.slice(0, selectionStart)}|《》${inputText.slice(selectionEnd)}`;
2321
}

tailwind.config.ts

-64
This file was deleted.

vite.config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { defineConfig } from "vite";
22
import { sveltekit } from "@sveltejs/kit/vite";
33
// @ts-ignore
4-
import { fileURLToPath } from "url";
4+
import { fileURLToPath } from "node:url";
5+
import tailwindcss from "@tailwindcss/vite";
56

67
const host = process.env.TAURI_DEV_HOST;
78

89
// https://vitejs.dev/config/
910
export default defineConfig(async () => ({
1011
exclude: ["svelte-codemirror-editor", "codemirror"],
11-
plugins: [sveltekit()],
12+
plugins: [tailwindcss(), sveltekit()],
1213

1314
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
1415
//

0 commit comments

Comments
 (0)