lightnet 4.0.2 → 4.0.4
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 +16 -0
- package/exports/index.ts +5 -1
- package/package.json +9 -9
- package/src/astro-integration/vite-plugin-lightnet-config.ts +3 -11
- package/src/components/Toast.tsx +2 -2
- package/src/components/showToast.ts +2 -0
- package/src/i18n/translate.ts +6 -2
- package/src/pages/details-page/components/main-details/ShareButton.astro +4 -2
- package/src/pages/search-page/hooks/use-search.ts +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# lightnet
|
|
2
2
|
|
|
3
|
+
## 4.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#374](https://github.com/LightNetDev/LightNet/pull/374) [`efcedcf`](https://github.com/LightNetDev/LightNet/commit/efcedcf6ef06e16e2b9151e14de8dd8337ff76da) Thanks [@smn-cds](https://github.com/smn-cds)! - Update dependencies
|
|
8
|
+
|
|
9
|
+
- [#374](https://github.com/LightNetDev/LightNet/pull/374) [`efcedcf`](https://github.com/LightNetDev/LightNet/commit/efcedcf6ef06e16e2b9151e14de8dd8337ff76da) Thanks [@smn-cds](https://github.com/smn-cds)! - Fix "Powered by LightNet" button is not clickable on details page.
|
|
10
|
+
|
|
11
|
+
## 4.0.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#372](https://github.com/LightNetDev/LightNet/pull/372) [`e5eb8b0`](https://github.com/LightNetDev/LightNet/commit/e5eb8b06a7684bf5d9090f885e04fcc5eea417ac) Thanks [@smn-cds](https://github.com/smn-cds)! - Fix dev translation HMR so editing `src/translations/*.yml` invalidates the full SSR importer chain and refreshes translated UI content.
|
|
16
|
+
|
|
17
|
+
- [#372](https://github.com/LightNetDev/LightNet/pull/372) [`e5eb8b0`](https://github.com/LightNetDev/LightNet/commit/e5eb8b06a7684bf5d9090f885e04fcc5eea417ac) Thanks [@smn-cds](https://github.com/smn-cds)! - Restore Language type export from "lightnet"
|
|
18
|
+
|
|
3
19
|
## 4.0.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/exports/index.ts
CHANGED
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.0.
|
|
6
|
+
"version": "4.0.4",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/LightNetDev/lightnet",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"tailwindcss": ">=3.4.0 <4.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@astrojs/react": "^5.0.
|
|
55
|
-
"@iconify-json/lucide": "^1.2.
|
|
54
|
+
"@astrojs/react": "^5.0.3",
|
|
55
|
+
"@iconify-json/lucide": "^1.2.101",
|
|
56
56
|
"@iconify-json/mdi": "^1.2.3",
|
|
57
57
|
"@iconify/tailwind": "^1.2.0",
|
|
58
58
|
"@tailwindcss/typography": "^0.5.19",
|
|
@@ -60,21 +60,21 @@
|
|
|
60
60
|
"autoprefixer": "^10.4.27",
|
|
61
61
|
"embla-carousel": "^8.6.0",
|
|
62
62
|
"embla-carousel-wheel-gestures": "^8.1.0",
|
|
63
|
-
"fuse.js": "^7.
|
|
63
|
+
"fuse.js": "^7.3.0",
|
|
64
64
|
"i18next": "^25.10.10",
|
|
65
65
|
"lucide-react": "^1.7.0",
|
|
66
|
-
"marked": "^17.0.
|
|
67
|
-
"postcss": "^8.5.
|
|
66
|
+
"marked": "^17.0.6",
|
|
67
|
+
"postcss": "^8.5.9",
|
|
68
68
|
"postcss-load-config": "^6.0.1",
|
|
69
69
|
"yaml": "^2.8.3"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@internal/e2e-test-utils": "^0.0.1",
|
|
73
|
-
"@playwright/test": "^1.
|
|
73
|
+
"@playwright/test": "^1.59.1",
|
|
74
74
|
"@types/react": "^19.2.14",
|
|
75
|
-
"astro": "^6.1.
|
|
75
|
+
"astro": "^6.1.4",
|
|
76
76
|
"typescript": "^5.9.3",
|
|
77
|
-
"vitest": "^4.1.
|
|
77
|
+
"vitest": "^4.1.3"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": ">=22"
|
|
@@ -40,22 +40,14 @@ export function vitePluginLightnetConfig(
|
|
|
40
40
|
const module = VIRTUAL_MODULES.find((m) => m === id)
|
|
41
41
|
if (module) return `\0${module}`
|
|
42
42
|
},
|
|
43
|
-
handleHotUpdate({ file,
|
|
43
|
+
handleHotUpdate({ file, server }) {
|
|
44
44
|
const srcPath = resolve(fileURLToPath(root), "src/translations/")
|
|
45
45
|
if (
|
|
46
46
|
(file.endsWith(".yml") || file.endsWith(".yaml")) &&
|
|
47
47
|
file.startsWith(srcPath)
|
|
48
48
|
) {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
...TRANSLATION_RUNTIME_MODULES.flatMap((id) => {
|
|
52
|
-
const module = server.moduleGraph.getModuleById(id)
|
|
53
|
-
return module ? [module] : []
|
|
54
|
-
}),
|
|
55
|
-
]
|
|
56
|
-
|
|
57
|
-
for (const module of affectedModules) {
|
|
58
|
-
server.moduleGraph.invalidateModule(module)
|
|
49
|
+
for (const filePath of [file, ...TRANSLATION_RUNTIME_MODULES]) {
|
|
50
|
+
server.moduleGraph.onFileChange(filePath)
|
|
59
51
|
}
|
|
60
52
|
|
|
61
53
|
logger.info(`Update translations ${file.slice(srcPath.length)}`)
|
package/src/components/Toast.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export default function Toast({
|
|
|
31
31
|
return (
|
|
32
32
|
<div
|
|
33
33
|
id={id}
|
|
34
|
-
className={`pointer-events-none fixed bottom-4 end-0
|
|
34
|
+
className={`pointer-events-none fixed bottom-4 end-0 hidden justify-end px-4 opacity-0 transition duration-300 will-change-transform ${className}`}
|
|
35
35
|
data-toast="true"
|
|
36
36
|
data-variant={variant}
|
|
37
37
|
data-toast-hidden-transform={hiddenTransform}
|
|
@@ -46,7 +46,7 @@ export default function Toast({
|
|
|
46
46
|
}}
|
|
47
47
|
>
|
|
48
48
|
<div
|
|
49
|
-
className={`
|
|
49
|
+
className={`flex max-w-sm flex-col items-start gap-1 rounded-md border p-4 text-base shadow-md backdrop-blur-sm ${alertClasses}`}
|
|
50
50
|
>
|
|
51
51
|
{children}
|
|
52
52
|
</div>
|
|
@@ -29,6 +29,7 @@ export function showToast(
|
|
|
29
29
|
window.clearTimeout(Number(existingTimeoutId))
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
element.style.display = "flex"
|
|
32
33
|
element.style.opacity = "100%"
|
|
33
34
|
element.style.transform = overshootTransform
|
|
34
35
|
element.dataset.toastVisible = "true"
|
|
@@ -45,6 +46,7 @@ export function showToast(
|
|
|
45
46
|
element.style.opacity = "0%"
|
|
46
47
|
element.style.transform = hiddenTransform
|
|
47
48
|
element.dataset.toastVisible = "false"
|
|
49
|
+
element.style.display = "hidden"
|
|
48
50
|
delete element.dataset[TIMEOUT_DATA_KEY]
|
|
49
51
|
}, duration)
|
|
50
52
|
|
package/src/i18n/translate.ts
CHANGED
|
@@ -31,7 +31,11 @@ const languageCodes = [
|
|
|
31
31
|
),
|
|
32
32
|
]
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
// In dev we avoid memoizing translations so YAML edits are reflected after HMR.
|
|
35
|
+
const cacheInProduction = <TReturn>(compute: () => TReturn) =>
|
|
36
|
+
import.meta.env.DEV ? { get: compute } : lazy(compute)
|
|
37
|
+
|
|
38
|
+
const i18nextTranslations = cacheInProduction(async () => {
|
|
35
39
|
const result: Record<string, { translation: Record<string, string> }> = {}
|
|
36
40
|
for (const bcp47 of languageCodes) {
|
|
37
41
|
result[bcp47] = {
|
|
@@ -41,7 +45,7 @@ const i18nextTranslations = lazy(async () => {
|
|
|
41
45
|
return result
|
|
42
46
|
})
|
|
43
47
|
|
|
44
|
-
const translationKeys =
|
|
48
|
+
const translationKeys = cacheInProduction(async () => {
|
|
45
49
|
const translations = await i18nextTranslations.get()
|
|
46
50
|
return [
|
|
47
51
|
...new Set(
|
|
@@ -6,6 +6,8 @@ import Toast from "../../../../components/Toast"
|
|
|
6
6
|
interface Props {
|
|
7
7
|
className?: string
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
const { t } = Astro.locals.i18n
|
|
9
11
|
---
|
|
10
12
|
|
|
11
13
|
<button
|
|
@@ -13,10 +15,10 @@ interface Props {
|
|
|
13
15
|
class:list={[Astro.props.className]}
|
|
14
16
|
id="share-btn"
|
|
15
17
|
><ForwardIcon />
|
|
16
|
-
{
|
|
18
|
+
{t("ln.details.share")}</button
|
|
17
19
|
>
|
|
18
20
|
<Toast id="share-success" variant="success">
|
|
19
|
-
{
|
|
21
|
+
{t("ln.share.url-copied-to-clipboard")}
|
|
20
22
|
</Toast>
|
|
21
23
|
<script>
|
|
22
24
|
import { showToastById } from "../../../../components/showToast"
|
|
@@ -11,10 +11,16 @@ interface Context {
|
|
|
11
11
|
languages: Record<string, { labelText: string }>
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
type EnrichedSearchItem = SearchItem & {
|
|
15
|
+
translatedCategories: string[] | null | undefined
|
|
16
|
+
translatedType: string
|
|
17
|
+
translatedLanguage: string
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
const SEARCH_API_PATH = pathWithBase("/api/internal/search.json")
|
|
15
21
|
|
|
16
22
|
export function useSearch({ categories, mediaTypes, languages }: Context) {
|
|
17
|
-
const fuse = useRef<Fuse<
|
|
23
|
+
const fuse = useRef<Fuse<EnrichedSearchItem>>(undefined)
|
|
18
24
|
const [allItems, setAllItems] = useState<SearchItem[]>([])
|
|
19
25
|
const [isLoading, setIsLoading] = useState(true)
|
|
20
26
|
const [query, setQuery] = useState<Partial<SearchQuery>>({})
|