lightnet 3.0.0 → 3.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # lightnet
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#238](https://github.com/LightNetDev/LightNet/pull/238) [`3f1cdbc`](https://github.com/LightNetDev/LightNet/commit/3f1cdbcbf83d20bec83a4c6d3bf1b97ec76e72ee) Thanks [@smn-cds](https://github.com/smn-cds)! - Add Audio details page.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#238](https://github.com/LightNetDev/LightNet/pull/238) [`3f1cdbc`](https://github.com/LightNetDev/LightNet/commit/3f1cdbcbf83d20bec83a4c6d3bf1b97ec76e72ee) Thanks [@smn-cds](https://github.com/smn-cds)! - Update dependencies.
12
+
13
+ ## 3.0.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [#236](https://github.com/LightNetDev/LightNet/pull/236) [`91776f2`](https://github.com/LightNetDev/LightNet/commit/91776f2998a5a98568b6d96815eeed44c03e0df5) Thanks [@smn-cds](https://github.com/smn-cds)! - Fix details components export.
18
+
3
19
  ## 3.0.0
4
20
 
5
21
  ### Major Changes
@@ -6,9 +6,9 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/LightNet/LightNet/node_modules/.pnpm/astro@5.5.3_@types+node@22.13.10_jiti@2.4.2_lightningcss@1.29.1_rollup@4.36.0_terser@5.39.0_typescript@5.8.2_yaml@2.7.0/node_modules/astro/node_modules:/home/runner/work/LightNet/LightNet/node_modules/.pnpm/astro@5.5.3_@types+node@22.13.10_jiti@2.4.2_lightningcss@1.29.1_rollup@4.36.0_terser@5.39.0_typescript@5.8.2_yaml@2.7.0/node_modules:/home/runner/work/LightNet/LightNet/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/LightNet/LightNet/node_modules/.pnpm/astro@5.5.6_@types+node@22.13.15_jiti@2.4.2_lightningcss@1.29.1_rollup@4.38.0_terser@5.39.0_typescript@5.8.2_yaml@2.7.1/node_modules/astro/node_modules:/home/runner/work/LightNet/LightNet/node_modules/.pnpm/astro@5.5.6_@types+node@22.13.15_jiti@2.4.2_lightningcss@1.29.1_rollup@4.38.0_terser@5.39.0_typescript@5.8.2_yaml@2.7.1/node_modules:/home/runner/work/LightNet/LightNet/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/home/runner/work/LightNet/LightNet/node_modules/.pnpm/astro@5.5.3_@types+node@22.13.10_jiti@2.4.2_lightningcss@1.29.1_rollup@4.36.0_terser@5.39.0_typescript@5.8.2_yaml@2.7.0/node_modules/astro/node_modules:/home/runner/work/LightNet/LightNet/node_modules/.pnpm/astro@5.5.3_@types+node@22.13.10_jiti@2.4.2_lightningcss@1.29.1_rollup@4.36.0_terser@5.39.0_typescript@5.8.2_yaml@2.7.0/node_modules:/home/runner/work/LightNet/LightNet/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/LightNet/LightNet/node_modules/.pnpm/astro@5.5.6_@types+node@22.13.15_jiti@2.4.2_lightningcss@1.29.1_rollup@4.38.0_terser@5.39.0_typescript@5.8.2_yaml@2.7.1/node_modules/astro/node_modules:/home/runner/work/LightNet/LightNet/node_modules/.pnpm/astro@5.5.6_@types+node@22.13.15_jiti@2.4.2_lightningcss@1.29.1_rollup@4.38.0_terser@5.39.0_typescript@5.8.2_yaml@2.7.1/node_modules:/home/runner/work/LightNet/LightNet/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../astro/astro.js" "$@"
@@ -4,13 +4,13 @@
4
4
  "version": "0.0.1",
5
5
  "private": "true",
6
6
  "dependencies": {
7
- "@astrojs/react": "^4.2.1",
8
- "@astrojs/tailwind": "^6.0.0",
9
- "@lightnet/decap-admin": "^3.0.0",
10
- "astro": "^5.5.3",
11
- "lightnet": "^3.0.0",
12
- "react": "^19.0.0",
13
- "react-dom": "^19.0.0",
7
+ "@astrojs/react": "^4.2.3",
8
+ "@astrojs/tailwind": "^6.0.2",
9
+ "@lightnet/decap-admin": "^3.1.0",
10
+ "astro": "^5.5.6",
11
+ "lightnet": "^3.1.0",
12
+ "react": "^19.1.0",
13
+ "react-dom": "^19.1.0",
14
14
  "sharp": "^0.33.5",
15
15
  "tailwindcss": "^3.4.17",
16
16
  "typescript": "^5.8.2"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "lightnet",
3
3
  "type": "module",
4
4
  "license": "MIT",
5
- "version": "3.0.0",
5
+ "version": "3.1.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/LightNetDev/lightnet",
@@ -20,7 +20,7 @@
20
20
  "./content": "./exports/content.ts",
21
21
  "./utils": "./exports/utils.ts",
22
22
  "./components": "./exports/components.ts",
23
- "./details-page": "./exports/details-page.ts",
23
+ "./experimental-details-page": "./exports/details-page.ts",
24
24
  "./i18n": "./exports/i18n.ts",
25
25
  "./locals": "./src/i18n/locals.ts",
26
26
  "./tailwind.config.ts": "./tailwind.config.ts",
@@ -50,13 +50,13 @@
50
50
  "fuse.js": "^7.1.0",
51
51
  "i18next": "^24.2.3",
52
52
  "marked": "^15.0.7",
53
- "yaml": "^2.7.0",
53
+ "yaml": "^2.7.1",
54
54
  "zod-validation-error": "^3.4.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@playwright/test": "^1.51.1",
58
- "@types/node": "^22.13.10",
59
- "vitest": "^3.0.9"
58
+ "@types/node": "^22.13.15",
59
+ "vitest": "^3.1.1"
60
60
  },
61
61
  "scripts": {
62
62
  "test": "vitest",
@@ -134,6 +134,7 @@ export const mediaItemSchema = z.object({
134
134
  * - links to youtube videos
135
135
  * - links to vimeo videos
136
136
  * - links to .mp4 video files
137
+ * - links to .mp3 audio files
137
138
  * - links to external websites
138
139
  * - links to pdfs (might be hosted inside the public/files/ folder)
139
140
  * - links to epubs (might be hosted inside the public/files/ folder)
@@ -223,6 +224,14 @@ export const mediaTypeSchema = z.object({
223
224
  */
224
225
  layout: z.literal("video"),
225
226
  }),
227
+ z.object({
228
+ /**
229
+ * Detail page for audio files.
230
+ *
231
+ * This only supports mp3 files.
232
+ */
233
+ layout: z.literal("audio"),
234
+ }),
226
235
  ])
227
236
  .optional(),
228
237
  /**
@@ -0,0 +1,26 @@
1
+ ---
2
+ import { getMediaItem } from "../../content/get-media-items"
3
+ import ContentSection from "./components/ContentSection.astro"
4
+ import DescriptionSection from "./components/DescriptionSection.astro"
5
+ import AudioPlayer from "./components/main-details/AudioPlayer.astro"
6
+ import ShareButton from "./components/main-details/ShareButton.astro"
7
+ import MainDetailsSection from "./components/MainDetailsSection.astro"
8
+ import MediaCollectionsSection from "./components/MediaCollectionsSection.astro"
9
+ import MoreDetailsSection from "./components/MoreDetailsSection.astro"
10
+
11
+ export type Props = {
12
+ mediaId: string
13
+ }
14
+
15
+ const { mediaId } = Astro.props
16
+ const audioSrc = (await getMediaItem(mediaId)).data.content[0].url
17
+ ---
18
+
19
+ <MainDetailsSection mediaId={mediaId}>
20
+ <AudioPlayer src={audioSrc} className="mt-10 w-full" />
21
+ <ShareButton className="mt-4 min-w-40" />
22
+ </MainDetailsSection>
23
+ <DescriptionSection mediaId={mediaId} />
24
+ <ContentSection mediaId={mediaId} />
25
+ <MediaCollectionsSection mediaId={mediaId} />
26
+ <MoreDetailsSection mediaId={mediaId} />
@@ -17,8 +17,10 @@ const { mediaId, coverStyle, openActionLabel = "ln.details.open" } = Astro.props
17
17
  ---
18
18
 
19
19
  <MainDetailsSection mediaId={mediaId} coverStyle={coverStyle}>
20
- <OpenButton mediaId={mediaId} openActionLabel={openActionLabel} />
21
- <ShareButton />
20
+ <div class="mt-10 flex flex-col justify-center gap-4 sm:justify-start">
21
+ <OpenButton mediaId={mediaId} openActionLabel={openActionLabel} />
22
+ <ShareButton />
23
+ </div>
22
24
  </MainDetailsSection>
23
25
  <DescriptionSection mediaId={mediaId} />
24
26
  <ContentSection mediaId={mediaId} />
@@ -8,6 +8,7 @@ import { getMediaType } from "../../content/get-media-types"
8
8
  import { resolveLocales } from "../../i18n/resolve-locales"
9
9
  import Page from "../../layouts/Page.astro"
10
10
  import { markdownToText } from "../../utils/markdown"
11
+ import AudioDetailsPage from "./AudioDetailsPage.astro"
11
12
  import DefaultDetailsPage from "./DefaultDetailsPage.astro"
12
13
  import VideoDetailsPage from "./VideoDetailsPage.astro"
13
14
 
@@ -56,5 +57,10 @@ if (detailsPage?.layout === "custom") {
56
57
  <VideoDetailsPage mediaId={mediaId} {...detailsPage} />
57
58
  )
58
59
  }
60
+ {
61
+ layout === "audio" && (
62
+ <AudioDetailsPage mediaId={mediaId} {...detailsPage} />
63
+ )
64
+ }
59
65
  {CustomDetails && <CustomDetails mediaId={mediaId} {...detailsPage} />}
60
66
  </Page>
@@ -15,12 +15,9 @@ const { mediaId, coverStyle = "default" } = Astro.props
15
15
  class="mx-auto mt-10 flex max-w-screen-md flex-col items-center gap-8 px-4 sm:mt-20 sm:flex-row sm:items-start sm:gap-14 md:px-8"
16
16
  >
17
17
  <Cover mediaId={mediaId} style={coverStyle} />
18
- <div class="flex flex-col items-center sm:items-start">
18
+ <div class="flex w-full grow flex-col items-center sm:items-start">
19
19
  <Title className="text-center sm:text-start" mediaId={mediaId} />
20
20
  <Authors className="text-center sm:text-start" mediaId={mediaId} />
21
-
22
- <div class="mt-10 flex flex-col justify-center gap-4 sm:justify-start">
23
- <slot />
24
- </div>
21
+ <slot />
25
22
  </div>
26
23
  </div>
@@ -0,0 +1,23 @@
1
+ ---
2
+ import { AstroError } from "astro/errors"
3
+
4
+ type Props = {
5
+ src: string
6
+ className?: string
7
+ }
8
+ const { src, className } = Astro.props
9
+ if (!src.endsWith(".mp3")) {
10
+ throw new AstroError(
11
+ `Unsupported audio file ${src}`,
12
+ "Mp3 is the only supported format.",
13
+ )
14
+ }
15
+ ---
16
+
17
+ <audio class="rounded-xl" class:list={[className]} src={src} controls></audio>
18
+
19
+ <style>
20
+ audio::-webkit-media-controls-enclosure {
21
+ border-radius: 0;
22
+ }
23
+ </style>