lightnet 4.1.1 → 4.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # lightnet
2
2
 
3
+ ## 4.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#401](https://github.com/LightNetDev/LightNet/pull/401) [`b3db519`](https://github.com/LightNetDev/LightNet/commit/b3db519e7c0492b66f6aa26875cb91fe841fcdd5) - Adjusted footer link separator and wrapping behavior to use the updated CSS-only footer layout.
8
+
9
+ - [#404](https://github.com/LightNetDev/LightNet/pull/404) [`5acab49`](https://github.com/LightNetDev/LightNet/commit/5acab49ca79078edbba3868b9b7bce249b2fca8a) - Update dependencies.
10
+
11
+ ## 4.2.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#394](https://github.com/LightNetDev/LightNet/pull/394) [`d8a1a2d`](https://github.com/LightNetDev/LightNet/commit/d8a1a2d9049b0fe0d37402f9e2435480fcaa0e15) - LightNet now adds a `data-should-track` attribute to the root `html` element
16
+ for `Page` and `MarkdownPage` layouts by default. Analytics integrations can
17
+ use this attribute to decide whether a page should be tracked.
18
+
19
+ You can opt out for an individual page by passing `disableShouldTrack` to
20
+ `Page` or `MarkdownPage`. This change does not add analytics on its own; it
21
+ only exposes a per-page signal for integrations such as `@lightnet/plausible`.
22
+
23
+ ### Patch Changes
24
+
25
+ - [#394](https://github.com/LightNetDev/LightNet/pull/394) [`d8a1a2d`](https://github.com/LightNetDev/LightNet/commit/d8a1a2d9049b0fe0d37402f9e2435480fcaa0e15) - Update dependencies
26
+
3
27
  ## 4.1.1
4
28
 
5
29
  ### Patch Changes
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "LightNet makes it easy to run your own digital media library.",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
- "version": "4.1.1",
6
+ "version": "4.2.1",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/LightNetDev/lightnet",
@@ -51,29 +51,29 @@
51
51
  "tailwindcss": ">=3.4.0 <4.0.0"
52
52
  },
53
53
  "dependencies": {
54
- "@astrojs/react": "^5.0.4",
55
- "@iconify-json/lucide": "^1.2.106",
54
+ "@astrojs/react": "^5.0.6",
55
+ "@iconify-json/lucide": "^1.2.111",
56
56
  "@iconify-json/mdi": "^1.2.3",
57
57
  "@iconify/tailwind": "^1.2.0",
58
58
  "@tailwindcss/typography": "^0.5.19",
59
- "@tanstack/react-virtual": "^3.13.24",
59
+ "@tanstack/react-virtual": "^3.13.26",
60
60
  "autoprefixer": "^10.5.0",
61
61
  "embla-carousel": "^8.6.0",
62
62
  "embla-carousel-wheel-gestures": "^8.1.0",
63
63
  "fuse.js": "^7.3.0",
64
- "i18next": "^26.0.10",
65
- "lucide-react": "^1.14.0",
66
- "marked": "^18.0.3",
67
- "postcss": "^8.5.14",
64
+ "i18next": "^26.3.0",
65
+ "lucide-react": "^1.17.0",
66
+ "marked": "^18.0.4",
67
+ "postcss": "^8.5.15",
68
68
  "postcss-load-config": "^6.0.1",
69
- "yaml": "^2.8.4"
69
+ "yaml": "^2.9.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@playwright/test": "^1.59.1",
73
- "@types/react": "^19.2.14",
74
- "astro": "^6.3.1",
72
+ "@playwright/test": "^1.60.0",
73
+ "@types/react": "^19.2.15",
74
+ "astro": "^6.4.2",
75
75
  "typescript": "^6.0.3",
76
- "vitest": "^4.1.5",
76
+ "vitest": "^4.1.7",
77
77
  "@internal/e2e-test-utils": "^0.0.1"
78
78
  },
79
79
  "engines": {
@@ -1,16 +1,16 @@
1
1
  ---
2
- import Page from "./Page.astro"
2
+ import Page, { type Props as PageProps } from "./Page.astro"
3
3
 
4
- // prettier-ignore
5
- type Props = {
4
+ type Props = PageProps & {
6
5
  className?: string
7
- };
6
+ }
7
+ const { className, ...pageProps } = Astro.props
8
8
  ---
9
9
 
10
- <Page>
10
+ <Page {...pageProps}>
11
11
  <article
12
12
  class="prose mx-auto mt-8 max-w-screen-md px-4 prose-img:rounded-md sm:mt-16 md:px-8"
13
- class:list={[Astro.props.className]}
13
+ class:list={[className]}
14
14
  >
15
15
  <slot />
16
16
  </article>
@@ -12,14 +12,35 @@ import Footer from "./components/Footer.astro"
12
12
  import Header from "./components/Header.astro"
13
13
  import ViewTransition from "./components/ViewTransition.astro"
14
14
 
15
- interface Props {
15
+ export interface Props {
16
+ /**
17
+ * Title of the page to be shown in browser tab.
18
+ */
16
19
  title?: string
20
+ /**
21
+ * Meta description for the page.
22
+ */
17
23
  description?: string
24
+ /**
25
+ * Css classes to apply to main element.
26
+ */
18
27
  mainClass?: string
28
+ /**
29
+ * Locale to override current locale from path.
30
+ */
19
31
  locale?: string
32
+ /**
33
+ * Disables the `should-track` attribute on the root `html` element for
34
+ * pages that should be excluded from analytics tracking.
35
+ *
36
+ * The `should-track`` attribute does not enable tracking on its own; it is intended to be picked up by
37
+ * analytics providers that choose to respect it. e.g. @lightnet/plausible-analytics
38
+ */
39
+ disableShouldTrack?: boolean
20
40
  }
21
41
 
22
- const { title, description, mainClass, locale } = Astro.props
42
+ const { title, description, mainClass, locale, disableShouldTrack } =
43
+ Astro.props
23
44
  const { currentLocale: pathCurrentLocale, tConfigField } = Astro.locals.i18n
24
45
  const currentLocale = locale ?? pathCurrentLocale
25
46
  const configTitle = tConfigField(config.title, config)
@@ -27,7 +48,11 @@ const { direction } = resolveLanguage(currentLocale)
27
48
  ---
28
49
 
29
50
  <!doctype html>
30
- <html lang={currentLocale} dir={direction}>
51
+ <html
52
+ lang={currentLocale}
53
+ dir={direction}
54
+ data-ln-should-track={disableShouldTrack ? undefined : true}
55
+ >
31
56
  <head>
32
57
  <meta charset="UTF-8" />
33
58
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -12,6 +12,17 @@ const footerText = config.footerText
12
12
  ? tConfigField(config.footerText, config)
13
13
  : undefined
14
14
 
15
+ type FooterTextItem = {
16
+ label: string
17
+ type: "text"
18
+ }
19
+
20
+ type FooterLinkItem = {
21
+ href: string
22
+ label: string
23
+ type: "link"
24
+ }
25
+
15
26
  // Prepare footer links using the same locale rules as the main menu.
16
27
  const footerLinks = (config.footerLinks ?? []).map(
17
28
  ({ href, label, requiresLocale }) => {
@@ -29,49 +40,71 @@ const shouldRenderFooter =
29
40
  if (!shouldRenderFooter) {
30
41
  return
31
42
  }
43
+
44
+ const footerItems: Array<FooterTextItem | FooterLinkItem> = [
45
+ ...(footerText ? [{ type: "text" as const, label: footerText }] : []),
46
+ ...footerLinks.map((link): FooterLinkItem => ({ type: "link", ...link })),
47
+ ]
32
48
  ---
33
49
 
34
50
  <footer class="w-full border-t border-gray-200 bg-white">
35
- <div
36
- class="mx-auto flex w-full max-w-screen-xl flex-col items-center justify-between gap-4 px-4 py-6 md:flex-row md:px-8"
37
- >
51
+ <div class="mx-auto w-full max-w-screen-xl px-4 md:px-8">
38
52
  <div
39
- class="flex flex-wrap items-center justify-center gap-2 text-sm text-gray-700 md:justify-start"
53
+ class="flex flex-col items-start justify-between gap-6 py-6 sm:flex-row sm:items-start"
40
54
  >
41
- {footerText && <span>{footerText}</span>}
55
+ <div
56
+ class="flex w-full flex-col items-start gap-3 text-sm text-gray-800 sm:min-w-0 sm:flex-1 sm:flex-row sm:flex-wrap sm:items-center sm:gap-2"
57
+ >
58
+ {
59
+ footerItems.length > 0 && (
60
+ <div class="flex w-full flex-row flex-wrap items-center gap-x-2 gap-y-1 sm:w-auto">
61
+ {footerItems.map((item, index) => (
62
+ <span class="inline-flex items-center gap-1.5">
63
+ <span class="text-gray-800">
64
+ {item.type === "text" ? (
65
+ item.label
66
+ ) : (
67
+ <a
68
+ {...getLinkAttributes(item.href)}
69
+ class="underline-offset-4 hover:underline"
70
+ >
71
+ {item.label}
72
+ </a>
73
+ )}
74
+ </span>
75
+ {index < footerItems.length - 1 && (
76
+ <span
77
+ class="text-[0.8em] leading-none text-gray-400"
78
+ aria-hidden="true"
79
+ >
80
+ &middot;
81
+ </span>
82
+ )}
83
+ </span>
84
+ ))}
85
+ </div>
86
+ )
87
+ }
88
+ </div>
42
89
 
43
90
  {
44
- footerLinks.map((link, index) => (
45
- <Fragment>
46
- {(footerText || index > 0) && <span class="text-gray-400">·</span>}
91
+ config.credits && (
92
+ <div class="flex w-full items-center text-sm sm:w-auto sm:flex-none sm:justify-end">
47
93
  <a
48
- {...getLinkAttributes(link.href)}
49
- class="underline-offset-4 hover:underline"
94
+ class="flex items-center gap-2 whitespace-nowrap text-gray-800 underline-offset-4 hover:underline"
95
+ {...getLinkAttributes("https://lightnet.community")}
50
96
  >
51
- {link.label}
97
+ <img
98
+ src={LightNetLogo.src}
99
+ alt=""
100
+ class="h-5 w-auto"
101
+ loading="lazy"
102
+ />
103
+ <span>{t("ln.footer.powered-by-lightnet")}</span>
52
104
  </a>
53
- </Fragment>
54
- ))
105
+ </div>
106
+ )
55
107
  }
56
108
  </div>
57
-
58
- {
59
- config.credits && (
60
- <div class="flex items-center text-sm">
61
- <a
62
- class="flex items-center gap-2 text-gray-800 underline-offset-4 hover:underline"
63
- {...getLinkAttributes("https://lightnet.community")}
64
- >
65
- <img
66
- src={LightNetLogo.src}
67
- alt=""
68
- class="h-5 w-auto"
69
- loading="lazy"
70
- />
71
- <span>{t("ln.footer.powered-by-lightnet")}</span>
72
- </a>
73
- </div>
74
- )
75
- }
76
109
  </div>
77
110
  </footer>