fuma 2.0.31 → 2.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,56 +1,3 @@
|
|
|
1
1
|
# fuma
|
|
2
2
|
|
|
3
3
|
My fullstack material build with sveltekit, daisyui, zod and more ...
|
|
4
|
-
|
|
5
|
-
## Fast setup
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
echo "Enter project's name : " && read project_name
|
|
9
|
-
echo "Enter mysql username : " && read mysql_username
|
|
10
|
-
|
|
11
|
-
pn create svelte@latest $project_name
|
|
12
|
-
cd $project_name
|
|
13
|
-
px svelte-add@latest tailwindcss --tailwindcss-daisyui --tailwindcss-typography
|
|
14
|
-
pn install
|
|
15
|
-
pn install fuma prisma lucia oslo @lucia-auth/adapter-prisma
|
|
16
|
-
sed -i "s|\}'\],|\}', './node_modules/**/fuma/dist/**/*.svelte'\],|g" tailwind.config.cjs
|
|
17
|
-
# TODO: tailwind.config {darkMode: 'class', }
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
sed -i 's|"singleQuote": true,|"singleQuote": true,\n\t"semi": false,|g' .prettierrc
|
|
21
|
-
|
|
22
|
-
# Prisma
|
|
23
|
-
px prisma init --datasource-provider mysql
|
|
24
|
-
|
|
25
|
-
mkdir -p ./src/lib/server
|
|
26
|
-
source="https://raw.githubusercontent.com/peufo/fuma/main"
|
|
27
|
-
curl "$source/prisma/schema.prisma" -o ./prisma/schema.prisma
|
|
28
|
-
curl "$source/src/lib/private/prisma.ts" -o ./src/lib/server/prisma.ts
|
|
29
|
-
|
|
30
|
-
echo "DATABASE_URL=\"mysql://$mysql_username@localhost:3306/$project_name\"" > .env
|
|
31
|
-
cp .env .env.example
|
|
32
|
-
px prisma migrate dev --name init
|
|
33
|
-
node -e "\
|
|
34
|
-
const pkg = require('./package.json'); \
|
|
35
|
-
pkg.scripts.migrate = 'prisma migrate dev'; \
|
|
36
|
-
pkg.scripts.generate = 'prisma generate'; \
|
|
37
|
-
pkg.scripts.studio = 'prisma studio'; \
|
|
38
|
-
pkg.scripts.postinstall = 'prisma migrate deploy && prisma generate'; \
|
|
39
|
-
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, ' ')); \
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
# Authentication
|
|
43
|
-
auth="src/routes/auth"
|
|
44
|
-
mkdir -p "./$auth"
|
|
45
|
-
curl "$source/src/app.d.ts" -o ./src/app.d.ts
|
|
46
|
-
curl "$source/src/hooks.server.ts" -o ./src/hooks.server.ts
|
|
47
|
-
curl "$source/src/lib/server/auth.ts" -o ./src/lib/server/auth.ts
|
|
48
|
-
curl "$source/$auth/+page.svelte" -o "./$auth/+page.svelte"
|
|
49
|
-
curl "$source/$auth/+page.server.ts" -o "./$auth/+page.server.ts"
|
|
50
|
-
|
|
51
|
-
sed -i 's|import Login .*|import { Login } from "fuma"|g' "./$auth/+page.svelte"
|
|
52
|
-
sed -i 's|$lib/validation/zod.js|fuma|g' "./$auth/+page.server.ts"
|
|
53
|
-
sed -i 's|$lib/server/index.js|fuma/server|g' "./$auth/+page.server.ts"
|
|
54
|
-
|
|
55
|
-
git init && git add -A && git commit -m "Initial commit"
|
|
56
|
-
```
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { browser } from '$app/environment'
|
|
3
2
|
import { ModeWatcher, toggleMode, mode } from 'mode-watcher'
|
|
4
3
|
import { mdiWeatherNight, mdiWhiteBalanceSunny } from '@mdi/js'
|
|
5
4
|
|
|
6
5
|
import { Icon } from '../icon/index.js'
|
|
7
|
-
import { onMount } from 'svelte'
|
|
8
6
|
|
|
9
7
|
let klass = ''
|
|
10
8
|
export { klass as class }
|
|
11
9
|
export let defaultMode: 'dark' | 'light' | 'system' | undefined = undefined
|
|
12
10
|
|
|
13
|
-
onMount(() => {
|
|
14
|
-
const [html] = document.getElementsByTagName('html')
|
|
15
|
-
if (!html || !$mode) return
|
|
16
|
-
html.setAttribute('data-theme', $mode)
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
mode.subscribe((_mode) => {
|
|
20
|
-
if (!browser) return
|
|
21
|
-
const [html] = document.getElementsByTagName('html')
|
|
22
|
-
if (!html || !_mode) return
|
|
23
|
-
html.setAttribute('data-theme', _mode)
|
|
24
|
-
})
|
|
25
|
-
|
|
26
11
|
$: path = $mode === 'light' ? mdiWhiteBalanceSunny : mdiWeatherNight
|
|
27
12
|
</script>
|
|
28
13
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" generics="Item extends ItemBase">
|
|
2
2
|
import { afterNavigate } from '$app/navigation'
|
|
3
|
+
import { maxHeightScreen } from '../../action/maxHeightScreen.js'
|
|
3
4
|
import { Placeholder } from '../placeholder/index.js'
|
|
4
5
|
|
|
5
6
|
import {
|
|
@@ -23,7 +24,8 @@
|
|
|
23
24
|
classRow,
|
|
24
25
|
hideBody = false,
|
|
25
26
|
onCreateField,
|
|
26
|
-
onclick
|
|
27
|
+
onclick,
|
|
28
|
+
screenPadding = 16
|
|
27
29
|
}: {
|
|
28
30
|
key?: string
|
|
29
31
|
fields: TableField<Item>[]
|
|
@@ -35,6 +37,7 @@
|
|
|
35
37
|
hideBody?: boolean
|
|
36
38
|
onCreateField?: () => void
|
|
37
39
|
onclick?: (item?: Item) => void
|
|
40
|
+
screenPadding?: number
|
|
38
41
|
} = $props()
|
|
39
42
|
|
|
40
43
|
const { KEY_FIELDS_VISIBLE, KEY_FIELDS_HIDDEN, KEY_FIELDS_ORDER } = createKeys(key)
|
|
@@ -49,7 +52,11 @@
|
|
|
49
52
|
afterNavigate(initFields)
|
|
50
53
|
</script>
|
|
51
54
|
|
|
52
|
-
<div
|
|
55
|
+
<div
|
|
56
|
+
class="{klass} bg-base-100 overflow-x-auto rounded-lg border"
|
|
57
|
+
class:min-h-[320px]={!hideBody}
|
|
58
|
+
use:maxHeightScreen={{ padding: screenPadding }}
|
|
59
|
+
>
|
|
53
60
|
<table class="relative table">
|
|
54
61
|
<TableHead {fields} {key} {onCreateField} />
|
|
55
62
|
{#if !hideBody && items.length}
|