@nekm/svelte-core 1.1.1 → 1.1.2

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.
@@ -8,10 +8,12 @@
8
8
 
9
9
  const { date }: Props = $props();
10
10
 
11
- const isoString = date.toISOString();
12
- let formatted = $state(isoString);
11
+ const isoString = $derived(date.toISOString());
12
+ let formatted = $state(localeFormatDate(date));
13
13
 
14
14
  onMount(() => {
15
+ // Want to rerun this on mount as we want to use the browser
16
+ // locale.
15
17
  formatted = localeFormatDate(date);
16
18
  })
17
19
  </script>
@@ -22,12 +22,12 @@
22
22
 
23
23
  const { id, productionDomain }: GoogleAnalyticsProps = $props();
24
24
 
25
+ const productionDomainStr = $derived(productionDomain instanceof URL ? productionDomain.hostname : productionDomain);
26
+
25
27
  onMount(() => {
26
28
  let config: GoogleAnalyticsConfig = { debug_mode: true };
27
29
 
28
30
  if (productionDomain) {
29
- const productionDomainStr = productionDomain instanceof URL ? productionDomain.hostname : productionDomain;
30
-
31
31
  if (page.url.hostname === productionDomainStr) {
32
32
  config = {};
33
33
  }
package/dist/seo.svelte CHANGED
@@ -45,20 +45,14 @@
45
45
  }
46
46
 
47
47
  // Starts with http or https. I.e, is an absolute URL.
48
- const iconHref = !icon.href.match(/^https?:\/\//ig)
49
- ? `${strTrimEnd(origin, "/")}/${strTrimStart(icon.href, "/")}`
50
- : icon.href;
51
-
52
- let canonicalUrl = $state(createCanonical(canonical, true));
53
- let nextUrl = $state(createCanonical(next));
54
-
55
- $effect(() => {
56
- canonicalUrl = createCanonical(canonical, true);
48
+ const iconHref = $derived.by(() => {
49
+ return !icon.href.match(/^https?:\/\//ig)
50
+ ? `${strTrimEnd(origin, "/")}/${strTrimStart(icon.href, "/")}`
51
+ : icon.href;
57
52
  });
58
53
 
59
- $effect(() => {
60
- nextUrl = createCanonical(next);
61
- });
54
+ const canonicalUrl = $derived(createCanonical(canonical, true));
55
+ const nextUrl = $derived(createCanonical(next));
62
56
  </script>
63
57
 
64
58
  <svelte:head>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nekm/svelte-core",
3
3
  "description": "Code I find myself re-writing over-and-over, Svelte edition.",
4
- "version": "1.1.1",
4
+ "version": "1.1.2",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run prepack",