cosmolo 0.3.8 → 0.3.9
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/dist/loaders.d.ts +3 -0
- package/dist/loaders.js +7 -2
- package/dist/types.d.ts +0 -3
- package/package.json +2 -1
- package/templates/full/lib/components/Callout.svelte +44 -0
- package/templates/full/routes/+page.svelte +1 -1
- package/templates/full/routes/categories/[slug]/+page.svelte +1 -1
- package/templates/full/routes/tags/[tag]/+page.svelte +1 -1
- package/templates/shared/config/site.json +1 -2
package/dist/loaders.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { Article, ResolvedCosmoloConfig } from './types.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function createArticlesLoader(config: ResolvedCosmoloConfig): () => {
|
|
12
12
|
articles: Article[];
|
|
13
|
+
articlesPerPage: number;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Factory for a single article page load function.
|
|
@@ -55,6 +56,7 @@ export declare function createCategoryLoader(config: ResolvedCosmoloConfig): ({
|
|
|
55
56
|
label: string;
|
|
56
57
|
description: string;
|
|
57
58
|
articles: Article[];
|
|
59
|
+
articlesPerPage: number;
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
* Factory for the tag listing page load function.
|
|
@@ -73,6 +75,7 @@ export declare function createTagLoader(config: ResolvedCosmoloConfig): ({ param
|
|
|
73
75
|
}) => {
|
|
74
76
|
tag: string;
|
|
75
77
|
articles: Article[];
|
|
78
|
+
articlesPerPage: number;
|
|
76
79
|
};
|
|
77
80
|
/**
|
|
78
81
|
* Factory for the static page load function.
|
package/dist/loaders.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getArticle, getArticles, getArticlesByCategory, getArticlesBySeries, getArticlesByTag, getSlugs, getTags } from './articles.js';
|
|
2
|
-
import { getCategorySlugs, getCategoryLabel, getCategoryDescription } from './categories.js';
|
|
2
|
+
import { getCategorySlugs, getCategoryLabel, getCategoryDescription, loadSiteConfig } from './categories.js';
|
|
3
3
|
import { getPage, getPageSlugs } from './pages.js';
|
|
4
4
|
/**
|
|
5
5
|
* Factory for the article listing page load function.
|
|
@@ -11,7 +11,10 @@ import { getPage, getPageSlugs } from './pages.js';
|
|
|
11
11
|
* export const load = createArticlesLoader(config);
|
|
12
12
|
*/
|
|
13
13
|
export function createArticlesLoader(config) {
|
|
14
|
-
return () => ({
|
|
14
|
+
return () => ({
|
|
15
|
+
articles: getArticles(config),
|
|
16
|
+
articlesPerPage: loadSiteConfig(config).articlesPerPage,
|
|
17
|
+
});
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* Factory for a single article page load function.
|
|
@@ -70,6 +73,7 @@ export function createCategoryLoader(config) {
|
|
|
70
73
|
label: getCategoryLabel(config, slug),
|
|
71
74
|
description: getCategoryDescription(config, slug),
|
|
72
75
|
articles: getArticlesByCategory(config, slug),
|
|
76
|
+
articlesPerPage: loadSiteConfig(config).articlesPerPage,
|
|
73
77
|
};
|
|
74
78
|
};
|
|
75
79
|
}
|
|
@@ -87,6 +91,7 @@ export function createTagLoader(config) {
|
|
|
87
91
|
return ({ params }) => ({
|
|
88
92
|
tag: params.tag,
|
|
89
93
|
articles: getArticlesByTag(config, params.tag),
|
|
94
|
+
articlesPerPage: loadSiteConfig(config).articlesPerPage,
|
|
90
95
|
});
|
|
91
96
|
}
|
|
92
97
|
/**
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cosmolo",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cosmolo": "./dist/cli/index.js"
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc && cp src/virtual.d.ts dist/virtual.d.ts && chmod +x dist/cli/index.js",
|
|
26
|
+
"test": "bun test src/**/*.test.ts",
|
|
26
27
|
"prepublishOnly": "npm run build"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
type?: 'info' | 'tip' | 'warning' | 'danger';
|
|
6
|
+
title?: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { type = 'info', title, children }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<aside class="callout callout-{type}">
|
|
14
|
+
{#if title}
|
|
15
|
+
<p class="callout-title">{title}</p>
|
|
16
|
+
{/if}
|
|
17
|
+
<div class="callout-body">
|
|
18
|
+
{@render children()}
|
|
19
|
+
</div>
|
|
20
|
+
</aside>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
.callout {
|
|
24
|
+
border-left: 4px solid;
|
|
25
|
+
padding: 0.75rem 1rem;
|
|
26
|
+
margin: 1.25rem 0;
|
|
27
|
+
border-radius: 0 4px 4px 0;
|
|
28
|
+
background-color: var(--callout-bg, #f8f9fa);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.callout-info { border-color: #3b82f6; }
|
|
32
|
+
.callout-tip { border-color: #10b981; }
|
|
33
|
+
.callout-warning { border-color: #f59e0b; }
|
|
34
|
+
.callout-danger { border-color: #ef4444; }
|
|
35
|
+
|
|
36
|
+
.callout-title {
|
|
37
|
+
font-weight: 600;
|
|
38
|
+
margin: 0 0 0.25rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.callout-body :global(p:last-child) {
|
|
42
|
+
margin-bottom: 0;
|
|
43
|
+
}
|
|
44
|
+
</style>
|