@nekm/svelte-core 1.9.3 → 1.10.0

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/dist/index.d.ts CHANGED
@@ -14,3 +14,4 @@ export * from "./ld-json.svelte";
14
14
  export { default as ExternalLink } from "./external-link.svelte";
15
15
  export * from "./external-link.svelte";
16
16
  export * from "./hooks.js";
17
+ export * from "./timer.svelte.js";
package/dist/index.js CHANGED
@@ -14,3 +14,4 @@ export * from "./ld-json.svelte";
14
14
  export { default as ExternalLink } from "./external-link.svelte";
15
15
  export * from "./external-link.svelte";
16
16
  export * from "./hooks.js";
17
+ export * from "./timer.svelte.js";
package/dist/seo.svelte CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  export interface SeoIcon {
16
16
  readonly href: string;
17
+ readonly mimeContentType: string;
17
18
  readonly height: number;
18
19
  readonly width: number;
19
- readonly mimeContentType: string;
20
20
  }
21
21
 
22
22
  export interface SeoTwitter {
@@ -42,9 +42,9 @@
42
42
  description,
43
43
  icon,
44
44
  additionalIcons = [],
45
- canonical,
45
+ canonical = { path: page.url.pathname },
46
46
  next,
47
- origin: propsOrigin,
47
+ origin = page.url.origin,
48
48
  twitter,
49
49
  }: SeoProps = $props();
50
50
 
@@ -52,18 +52,16 @@
52
52
  if (!canonical.path) return origin;
53
53
 
54
54
  const path = strTrimStart(canonical.path, "/");
55
- const canonicalWithPath = `${origin}/${path}`;
55
+ if (path.length <= 0) return origin;
56
56
 
57
+ const canonicalWithPath = `${origin}/${path}`;
57
58
  if (!canonical.queryParams) return canonicalWithPath;
58
59
 
59
60
  return `${canonicalWithPath}?${queryParamsCreate(canonical.queryParams)}`;
60
61
  }
61
62
 
62
- const origin = $derived(propsOrigin ?? page.url.origin);
63
63
  const iconHref = $derived(urlSetOrigin(origin, icon.href));
64
- const canonicalUrl = $derived(
65
- !canonical ? origin : createCanonical(canonical),
66
- );
64
+ const canonicalUrl = $derived(createCanonical(canonical));
67
65
  const nextUrl = $derived(!next ? undefined : createCanonical(next));
68
66
  const additionalAppleIcons = $derived(
69
67
  additionalIcons.filter((i) => i.mimeContentType === "image/png"),
@@ -5,9 +5,9 @@ export interface SeoCanonical {
5
5
  }
6
6
  export interface SeoIcon {
7
7
  readonly href: string;
8
+ readonly mimeContentType: string;
8
9
  readonly height: number;
9
10
  readonly width: number;
10
- readonly mimeContentType: string;
11
11
  }
12
12
  export interface SeoTwitter {
13
13
  readonly creator?: string;
@@ -0,0 +1,2 @@
1
+ export declare function effectTimer(waitMs: number, fn: () => void | Promise<void>): void;
2
+ export declare function effectInterval(waitMs: number, fn: () => void | Promise<void>): void;
@@ -0,0 +1,17 @@
1
+ import { interval, timer } from "@nekm/core";
2
+ export function effectTimer(waitMs, fn) {
3
+ $effect(() => {
4
+ let stop = false;
5
+ timer(waitMs).then(async () => {
6
+ if (!stop) {
7
+ await fn();
8
+ }
9
+ });
10
+ return () => {
11
+ stop = true;
12
+ };
13
+ });
14
+ }
15
+ export function effectInterval(waitMs, fn) {
16
+ $effect(() => interval(waitMs, fn));
17
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nekm/svelte-core",
3
3
  "description": "Code I find myself re-writing over-and-over, Svelte edition.",
4
4
  "license": "MIT",
5
- "version": "1.9.3",
5
+ "version": "1.10.0",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",