commit 64a177062ba58185715aaa83d15579561c575fc6
parent 897a779ae1fbfc50542fe52744d471711060ce21
Author: triesap <137732411+triesap@users.noreply.github.com>
Date: Sat, 31 Aug 2024 10:44:31 +0000
apps-lib: adjust svelte to version 4, change ndk store to ndksvelte
Diffstat:
7 files changed, 30 insertions(+), 34 deletions(-)
diff --git a/apps-lib/package.json b/apps-lib/package.json
@@ -27,15 +27,15 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"peerDependencies": {
- "svelte": "^5.0.0-next.1"
+ "svelte": "^4.2.19"
},
"devDependencies": {
"@sveltejs/kit": "^2.0.0",
"@sveltejs/package": "^2.0.0",
"@types/luxon": "^3.4.2",
"publint": "^0.1.9",
- "svelte": "^5.0.0-next.1",
- "svelte-check": "^3.6.0",
+ "svelte": "^4.2.19",
+ "svelte-check": "^3.8.6",
"svelte-preprocess": "^5.1.0",
"tslib": "^2.4.1",
"typescript": "^5.3.3",
@@ -44,6 +44,8 @@
"dependencies": {
"@nostr-dev-kit/ndk": "^2.7.1",
"@nostr-dev-kit/ndk-cache-dexie": "^2.3.1",
+ "@nostr-dev-kit/ndk-svelte": "^2.2.18",
+ "@radroots/sveltekit-i18n": "workspace:*",
"@radroots/sveltekit-search-params": "workspace:*",
"@radroots/theme": "workspace:*",
"@sveltekit-i18n/base": "^1.3.7",
diff --git a/apps-lib/src/lib/components/tabs.svelte b/apps-lib/src/lib/components/tabs.svelte
@@ -1,13 +1,10 @@
<script lang="ts">
import { glyph, type ITabsBasis } from "..";
- let {
- basis,
- }: {
- basis: ITabsBasis;
- } = $props();
+ export let basis: ITabsBasis;
+ $: basis = basis;
- let classes_blur = $derived(basis.blur ? `bg-layer-1-surface/30` : ``);
+ $: classes_blur = basis.blur ? `bg-layer-1-surface/30` : ``;
let el: HTMLElement | null;
let el_inner: HTMLElement | null;
@@ -27,7 +24,7 @@
{#each basis.list as tab, tab_i}
<button
class={`col-span-3 flex flex-col h-full justify-start items-center transition-all`}
- onclick={async () => {
+ on:click={async () => {
await tab.callback(tab_i);
}}
>
diff --git a/apps-lib/src/lib/locales/i18n.ts b/apps-lib/src/lib/locales/i18n.ts
@@ -1,13 +1,16 @@
-import i18n from '@sveltekit-i18n/base';
-import type { Config } from '@sveltekit-i18n/parser-icu';
-import parser from '@sveltekit-i18n/parser-icu';
+//import i18n from '@sveltekit-i18n/base';
+import i18n, { type Config } from '@radroots/sveltekit-i18n';
+
+//import type { Config } from '@sveltekit-i18n/parser-icu';
+//import parser from '@sveltekit-i18n/parser-icu';
import locales_keys from './locales.json';
type Locale = keyof typeof locales_keys;
+
type LanguageConfig = {
default?: string;
- value?: string;
};
+
const locales_files = [`app`] as const;
const translations_keys: Record<Locale, any> = {
en: { locales_keys },
@@ -16,7 +19,7 @@ export const default_locale: Locale = `en`;
const config: Config<LanguageConfig> = {
initLocale: default_locale,
- parser: parser(),
+ //parser: parser(),
translations: translations_keys,
loaders: [
...Object.keys(translations_keys).map((locale) => locales_files.map(key => ({
diff --git a/apps-lib/src/lib/stores/ndk.ts b/apps-lib/src/lib/stores/ndk.ts
@@ -1,14 +1,15 @@
-import NDK, { type NDKCacheAdapter, type NDKUser } from "@nostr-dev-kit/ndk";
+import { type NDKCacheAdapter, type NDKUser } from "@nostr-dev-kit/ndk";
import NDKCacheAdapterDexie from "@nostr-dev-kit/ndk-cache-dexie";
+import NDKSvelte from "@nostr-dev-kit/ndk-svelte";
import { writable } from "svelte/store";
let cacheAdapter: NDKCacheAdapter | undefined;
if (typeof window !== `undefined`) cacheAdapter = new NDKCacheAdapterDexie({ dbName: "-radroots-app-ndk" });
-const _ndk = new NDK({
- cacheAdapter,
+const _ndk = new NDKSvelte({
+ //cacheAdapter,
clientName: "ยป--`--,---",
});
-export const ndk = writable<NDK>(_ndk);
+export const ndk = writable<NDKSvelte>(_ndk);
export const ndk_user = writable<NDKUser>();
diff --git a/apps-lib/src/lib/types/client.ts b/apps-lib/src/lib/types/client.ts
@@ -1,11 +1,6 @@
import type { ThemeLayer } from "@radroots/theme";
-import type { Snippet } from "svelte";
import type { IGlyph } from "./ui";
-export type PropChildren = {
- children: Snippet;
-};
-
export type AppLayoutKey = 'lg' | 'base';
type NavigationRouteBasis = string;
export type AnchorRoute = `/${string}`;
diff --git a/apps-lib/src/lib/types/trellis.ts b/apps-lib/src/lib/types/trellis.ts
@@ -1,5 +1,5 @@
-import type { GlyphKey, ICbGOpt, ICbOpt, ICbROpt, IClOpt, IGlyphOpt, ILabel, ILabelTup, ILy } from "./client";
-import type { IGlyph } from "./ui";
+import type { ICbGOpt, ICbOpt, ICbROpt, IClOpt, IGlyphOpt, ILabel, ILabelTup, ILy } from "./client";
+import type { GlyphKey, IGlyph } from "./ui";
export type ITrellis = ILy &
IClOpt &
diff --git a/apps-lib/src/lib/ui/glyph.svelte b/apps-lib/src/lib/ui/glyph.svelte
@@ -16,20 +16,18 @@
[`xl`, `text-[30px]`],
]);
- let { basis }: { basis: IGlyph } = $props();
+ export let basis: IGlyph;
+ $: basis = basis;
- let weight = $derived(
- !basis?.weight || basis?.weight === `regular` ? `` : `-${basis.weight}`,
- );
+ $: weight =
+ !basis?.weight || basis?.weight === `regular` ? `` : `-${basis.weight}`;
- let dimension = $derived(
- basis?.dim ? glyph_map.get(basis.dim) : glyph_map.get(`sm`),
- );
+ $: dimension = basis?.dim ? glyph_map.get(basis.dim) : glyph_map.get(`sm`);
</script>
<button
class={`${fmt_cl(basis.classes)} flex flex-row justify-center items-center transition-all ${dimension}`}
- onclick={async () => {
+ on:click={async () => {
if (basis.callback) await basis.callback();
}}
>