lightnet 3.2.0 → 3.3.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,32 @@
1
1
  # lightnet
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#250](https://github.com/LightNetDev/LightNet/pull/250) [`bc728aa`](https://github.com/LightNetDev/LightNet/commit/bc728aae93cdba4383167488536e5c6ab3654523) Thanks [@smn-cds](https://github.com/smn-cds)! - Introduce DetailsPage wrapper component
8
+
9
+ ‼️ BREAKING CHANGE on experimental custom details page API.
10
+
11
+ With this change all custom details pages need to be wrapped by
12
+ a `DetailsPage` component. This component is exported by `@lightnet/experimental-details-page`.
13
+ Previously custom details pages were automatically wrapped by LightNet.
14
+
15
+ This is how to create a custom details page:
16
+
17
+ ```astro
18
+ ---
19
+ import { DetailsPage } from "@lightNet/experimental-details-page"
20
+ type Props = {
21
+ mediaId
22
+ }
23
+ ---
24
+
25
+ <DetailsPage mediaId={Astro.props.mediaId}>
26
+ {/* Your custom details page components go here */}
27
+ </DetailsPage>
28
+ ```
29
+
3
30
  ## 3.2.0
4
31
 
5
32
  ### Minor Changes
@@ -8,7 +8,7 @@
8
8
  "@astrojs/tailwind": "^6.0.2",
9
9
  "@lightnet/decap-admin": "^3.1.0",
10
10
  "astro": "^5.6.1",
11
- "lightnet": "^3.2.0",
11
+ "lightnet": "^3.3.0",
12
12
  "react": "^19.1.0",
13
13
  "react-dom": "^19.1.0",
14
14
  "sharp": "^0.33.5",
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export { default as ContentSection } from "../src/pages/details-page/components/ContentSection.astro"
6
6
  export { default as DescriptionSection } from "../src/pages/details-page/components/DescriptionSection.astro"
7
+ export { default as DetailsPage } from "../src/pages/details-page/components/DetailsPage.astro"
7
8
  export { default as OpenButton } from "../src/pages/details-page/components/main-details/OpenButton.astro"
8
9
  export { default as ShareButton } from "../src/pages/details-page/components/main-details/ShareButton.astro"
9
10
  export { default as MainDetailsSection } from "../src/pages/details-page/components/MainDetailsSection.astro"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "lightnet",
3
3
  "type": "module",
4
4
  "license": "MIT",
5
- "version": "3.2.0",
5
+ "version": "3.3.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/LightNetDev/lightnet",
@@ -25,10 +25,10 @@
25
25
  "./locals": "./src/i18n/locals.ts",
26
26
  "./tailwind.config.ts": "./tailwind.config.ts",
27
27
  "./layouts/MarkdownPage.astro": "./src/layouts/MarkdownPage.astro",
28
- "./pages/404.astro": "./src/pages/404.astro",
29
- "./pages/RedirectToDefaultLocale.astro": "./src/pages/RedirectToDefaultLocale.astro",
30
- "./pages/SearchPage.astro": "./src/pages/search-page/SearchPage.astro",
31
- "./pages/DetailsPage.astro": "./src/pages/details-page/DetailsPage.astro",
28
+ "./pages/404Route.astro": "./src/pages/404Route.astro",
29
+ "./pages/RootRoute.astro": "./src/pages/RootRoute.astro",
30
+ "./pages/SearchPageRoute.astro": "./src/pages/search-page/SearchPageRoute.astro",
31
+ "./pages/DetailsPageRoute.astro": "./src/pages/details-page/DetailsPageRoute.astro",
32
32
  "./pages/api/search.ts": "./src/pages/api/search.ts"
33
33
  },
34
34
  "peerDependencies": {
@@ -28,19 +28,19 @@ export function lightnet(lightnetConfig: LightnetConfig): AstroIntegration {
28
28
 
29
29
  injectRoute({
30
30
  pattern: "404",
31
- entrypoint: "lightnet/pages/404.astro",
31
+ entrypoint: "lightnet/pages/404Route.astro",
32
32
  prerender: true,
33
33
  })
34
34
 
35
35
  injectRoute({
36
36
  pattern: "",
37
- entrypoint: "lightnet/pages/RedirectToDefaultLocale.astro",
37
+ entrypoint: "lightnet/pages/RootRoute.astro",
38
38
  prerender: true,
39
39
  })
40
40
 
41
41
  injectRoute({
42
42
  pattern: "/[locale]/media",
43
- entrypoint: "lightnet/pages/SearchPage.astro",
43
+ entrypoint: "lightnet/pages/SearchPageRoute.astro",
44
44
  prerender: true,
45
45
  })
46
46
 
@@ -52,7 +52,7 @@ export function lightnet(lightnetConfig: LightnetConfig): AstroIntegration {
52
52
 
53
53
  injectRoute({
54
54
  pattern: "/[locale]/media/[mediaId]",
55
- entrypoint: "lightnet/pages/DetailsPage.astro",
55
+ entrypoint: "lightnet/pages/DetailsPageRoute.astro",
56
56
  prerender: true,
57
57
  })
58
58
 
@@ -2,6 +2,7 @@
2
2
  import { getMediaItem } from "../../content/get-media-items"
3
3
  import ContentSection from "./components/ContentSection.astro"
4
4
  import DescriptionSection from "./components/DescriptionSection.astro"
5
+ import DetailsPage from "./components/DetailsPage.astro"
5
6
  import AudioPlayer from "./components/main-details/AudioPlayer.astro"
6
7
  import ShareButton from "./components/main-details/ShareButton.astro"
7
8
  import MainDetailsSection from "./components/MainDetailsSection.astro"
@@ -16,11 +17,13 @@ const { mediaId } = Astro.props
16
17
  const audioSrc = (await getMediaItem(mediaId)).data.content[0].url
17
18
  ---
18
19
 
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} />
20
+ <DetailsPage mediaId={mediaId}>
21
+ <MainDetailsSection mediaId={mediaId}>
22
+ <AudioPlayer src={audioSrc} className="mt-10 w-full" />
23
+ <ShareButton className="mt-4 min-w-40" />
24
+ </MainDetailsSection>
25
+ <DescriptionSection mediaId={mediaId} />
26
+ <ContentSection mediaId={mediaId} />
27
+ <MediaCollectionsSection mediaId={mediaId} />
28
+ <MoreDetailsSection mediaId={mediaId} />
29
+ </DetailsPage>
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import ContentSection from "./components/ContentSection.astro"
3
3
  import DescriptionSection from "./components/DescriptionSection.astro"
4
+ import DetailsPage from "./components/DetailsPage.astro"
4
5
  import OpenButton from "./components/main-details/OpenButton.astro"
5
6
  import ShareButton from "./components/main-details/ShareButton.astro"
6
7
  import MainDetailsSection from "./components/MainDetailsSection.astro"
@@ -16,13 +17,15 @@ export type Props = {
16
17
  const { mediaId, coverStyle, openActionLabel = "ln.details.open" } = Astro.props
17
18
  ---
18
19
 
19
- <MainDetailsSection mediaId={mediaId} coverStyle={coverStyle}>
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>
24
- </MainDetailsSection>
25
- <DescriptionSection mediaId={mediaId} />
26
- <ContentSection mediaId={mediaId} />
27
- <MediaCollectionsSection mediaId={mediaId} />
28
- <MoreDetailsSection mediaId={mediaId} />
20
+ <DetailsPage mediaId={mediaId}>
21
+ <MainDetailsSection mediaId={mediaId} coverStyle={coverStyle}>
22
+ <div class="mt-10 flex flex-col justify-center gap-4 sm:justify-start">
23
+ <OpenButton mediaId={mediaId} openActionLabel={openActionLabel} />
24
+ <ShareButton />
25
+ </div>
26
+ </MainDetailsSection>
27
+ <DescriptionSection mediaId={mediaId} />
28
+ <ContentSection mediaId={mediaId} />
29
+ <MediaCollectionsSection mediaId={mediaId} />
30
+ <MoreDetailsSection mediaId={mediaId} />
31
+ </DetailsPage>
@@ -6,8 +6,6 @@ import config from "virtual:lightnet/config"
6
6
  import { getMediaItem, getMediaItems } from "../../content/get-media-items"
7
7
  import { getMediaType } from "../../content/get-media-types"
8
8
  import { resolveLocales } from "../../i18n/resolve-locales"
9
- import Page from "../../layouts/Page.astro"
10
- import { markdownToText } from "../../utils/markdown"
11
9
  import AudioDetailsPage from "./AudioDetailsPage.astro"
12
10
  import DefaultDetailsPage from "./DefaultDetailsPage.astro"
13
11
  import VideoDetailsPage from "./VideoDetailsPage.astro"
@@ -43,24 +41,11 @@ if (detailsPage?.layout === "custom") {
43
41
  }
44
42
  ---
45
43
 
46
- <Page
47
- title={mediaItem.title}
48
- description={markdownToText(mediaItem.description)}
49
- >
50
- {
51
- layout === "default" && (
52
- <DefaultDetailsPage mediaId={mediaId} {...detailsPage} />
53
- )
54
- }
55
- {
56
- layout === "video" && (
57
- <VideoDetailsPage mediaId={mediaId} {...detailsPage} />
58
- )
59
- }
60
- {
61
- layout === "audio" && (
62
- <AudioDetailsPage mediaId={mediaId} {...detailsPage} />
63
- )
64
- }
65
- {CustomDetails && <CustomDetails mediaId={mediaId} {...detailsPage} />}
66
- </Page>
44
+ {
45
+ layout === "default" && (
46
+ <DefaultDetailsPage mediaId={mediaId} {...detailsPage} />
47
+ )
48
+ }
49
+ {layout === "video" && <VideoDetailsPage mediaId={mediaId} {...detailsPage} />}
50
+ {layout === "audio" && <AudioDetailsPage mediaId={mediaId} {...detailsPage} />}
51
+ {CustomDetails && <CustomDetails mediaId={mediaId} {...detailsPage} />}
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import ContentSection from "./components/ContentSection.astro"
3
3
  import DescriptionSection from "./components/DescriptionSection.astro"
4
+ import DetailsPage from "./components/DetailsPage.astro"
4
5
  import MediaCollectionsSection from "./components/MediaCollectionsSection.astro"
5
6
  import MoreDetailsSection from "./components/MoreDetailsSection.astro"
6
7
  import VideoDetailsSection from "./components/VideoDetailsSection.astro"
@@ -12,8 +13,10 @@ export type Props = {
12
13
  const { mediaId } = Astro.props
13
14
  ---
14
15
 
15
- <VideoDetailsSection mediaId={mediaId} />
16
- <DescriptionSection mediaId={mediaId} />
17
- <ContentSection mediaId={mediaId} />
18
- <MediaCollectionsSection mediaId={mediaId} />
19
- <MoreDetailsSection mediaId={mediaId} />
16
+ <DetailsPage mediaId={mediaId}>
17
+ <VideoDetailsSection mediaId={mediaId} />
18
+ <DescriptionSection mediaId={mediaId} />
19
+ <ContentSection mediaId={mediaId} />
20
+ <MediaCollectionsSection mediaId={mediaId} />
21
+ <MoreDetailsSection mediaId={mediaId} />
22
+ </DetailsPage>
@@ -0,0 +1,18 @@
1
+ ---
2
+ import { getMediaItem } from "../../../content/get-media-items"
3
+ import Page from "../../../layouts/Page.astro"
4
+ import { markdownToText } from "../../../utils/markdown"
5
+
6
+ type Props = {
7
+ mediaId: string
8
+ }
9
+
10
+ const mediaItem = (await getMediaItem(Astro.props.mediaId)).data
11
+ ---
12
+
13
+ <Page
14
+ title={mediaItem.title}
15
+ description={markdownToText(mediaItem.description)}
16
+ >
17
+ <slot />
18
+ </Page>
File without changes