@functionalcms/svelte-components 2.14.4 → 2.15.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.
@@ -0,0 +1,9 @@
1
+ <script>import Link from "../Link.svelte";
2
+ import { Justify } from "../Styling.js";
3
+ export let description;
4
+ </script>
5
+
6
+ <p>
7
+ {description}
8
+ <slot name="readMore"></slot>
9
+ </p>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ description: string;
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {
10
+ readMore: {};
11
+ };
12
+ };
13
+ export type BlogDescriptionProps = typeof __propDef.props;
14
+ export type BlogDescriptionEvents = typeof __propDef.events;
15
+ export type BlogDescriptionSlots = typeof __propDef.slots;
16
+ export default class BlogDescription extends SvelteComponent<BlogDescriptionProps, BlogDescriptionEvents, BlogDescriptionSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface BlogPost {
2
+ slug: string;
3
+ title: string;
4
+ author: string;
5
+ description: string;
6
+ date: string;
7
+ published: boolean;
8
+ }
9
+ export interface MdsvexFile {
10
+ default: import('svelte/internal').SvelteComponent;
11
+ metadata: Record<string, string>;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ <script>export let slug = "";
2
+ export let path = "";
3
+ export let title;
4
+ const href = `${path}/${slug}`;
5
+ const isLink = slug != "";
6
+ </script>
7
+
8
+ <h1>
9
+ {#if isLink}
10
+ <a {href}>
11
+ {title}
12
+ </a>
13
+ {:else}
14
+ {title}
15
+ {/if}
16
+ </h1>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ slug?: string | undefined;
5
+ path?: string | undefined;
6
+ title: string;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type BlogTitleProps = typeof __propDef.props;
14
+ export type BlogTitleEvents = typeof __propDef.events;
15
+ export type BlogTitleSlots = typeof __propDef.slots;
16
+ export default class BlogTitle extends SvelteComponent<BlogTitleProps, BlogTitleEvents, BlogTitleSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare function listAllPosts(page?: number, postCount?: number): Promise<{
2
+ posts: any;
3
+ }>;
@@ -0,0 +1,13 @@
1
+ const MAX_POSTS = 25;
2
+ const slugFromPath = (path) => path.match(/([\w-]+)\.(svelte\.md|md|svx)/i)?.[1] ?? null;
3
+ export async function listAllPosts(page = 0, postCount = MAX_POSTS) {
4
+ const modules = import.meta.glob(`/src/posts/*.{md,svx,svelte.md}`);
5
+ const postPromises = Object.entries(modules).map(([path, resolver]) => resolver().then((post) => ({
6
+ slug: slugFromPath(path),
7
+ ...post.metadata
8
+ })));
9
+ const posts = await Promise.all(postPromises);
10
+ const publishedPosts = posts.filter((post) => post.published).slice(page, postCount);
11
+ publishedPosts.sort((a, b) => (new Date(a.date) > new Date(b.date) ? -1 : 1));
12
+ return { posts: publishedPosts };
13
+ }
package/dist/index.d.ts CHANGED
@@ -14,6 +14,10 @@ import Link from './components/Link.svelte';
14
14
  import Gallery from './components/presentation/Gallery.svelte';
15
15
  import Carusel from './components/presentation/Carusel.svelte';
16
16
  import { CaruseleItem } from './components/presentation/Carusele.js';
17
+ import BlogDescription from './components/blog/BlogDescription.svelte';
18
+ import BlogTitle from './components/blog/BlogTitle.svelte';
19
+ import type { BlogPost } from './components/blog/BlogPost.js';
20
+ import { listAllPosts } from './components/blog/blog.js';
17
21
  import { convertShowItemsToNavigationItems } from './components/converters/ShowItemToNavigationItems.js';
18
22
  import { ShowItem } from './components/presentation/ShowItem.js';
19
23
  import { title, suffix } from './stores/title.js';
@@ -21,4 +25,5 @@ import { pages } from './stores/pages.js';
21
25
  import { metaDescription, metaKeywords } from './stores/meta.js';
22
26
  import { Justify, Placement, Orientation, Position, Sizes, AlignItmes } from './components/Styling.js';
23
27
  import { Alert, Avatar, AvatarGroup, Breadcrumb, Button, ButtonGroup, Card, ChoiceInput, Close, Dialog, Disclose, Divider, Drawer, EmptyState, Header, HeaderNav, HeaderNavItem, Icon, IconSvg, Input, InputAddonItem, Loader, Pagination, Progress, Select, Spinner, Switch, Table, Tabs, Tag, Toast, Toasts } from 'agnostic-svelte';
24
- export { Visiblity, HeaderNavigationItem, DynamicMenu, FlatMenu, ColumnMenu, HamburgerMenu, DefaultLayout, TwoColumnsLayout, Banner, Link, Logo, SimpleFooter, Gallery, Carusel, CaruseleItem, Spacer, Well, Justify, Placement, Orientation, AlignItmes, Position, Sizes, ShowItem, convertShowItemsToNavigationItems, title, suffix, pages, metaDescription, metaKeywords, Alert, Avatar, AvatarGroup, Breadcrumb, Button, ButtonGroup, Card, ChoiceInput, Close, Dialog, Disclose, Divider, Drawer, EmptyState, Header, HeaderNav, HeaderNavItem, Icon, IconSvg, Input, InputAddonItem, Loader, Pagination, Progress, Select, Spinner, Switch, Table, Tabs, Tag, Toast, Toasts };
28
+ export { Visiblity, HeaderNavigationItem, DynamicMenu, FlatMenu, ColumnMenu, HamburgerMenu, BlogTitle, BlogDescription, listAllPosts, DefaultLayout, TwoColumnsLayout, Banner, Link, Logo, SimpleFooter, Gallery, Carusel, CaruseleItem, Spacer, Well, Justify, Placement, Orientation, AlignItmes, Position, Sizes, ShowItem, convertShowItemsToNavigationItems, title, suffix, pages, metaDescription, metaKeywords, Alert, Avatar, AvatarGroup, Breadcrumb, Button, ButtonGroup, Card, ChoiceInput, Close, Dialog, Disclose, Divider, Drawer, EmptyState, Header, HeaderNav, HeaderNavItem, Icon, IconSvg, Input, InputAddonItem, Loader, Pagination, Progress, Select, Spinner, Switch, Table, Tabs, Tag, Toast, Toasts };
29
+ export type { BlogPost };
package/dist/index.js CHANGED
@@ -14,6 +14,9 @@ import Link from './components/Link.svelte';
14
14
  import Gallery from './components/presentation/Gallery.svelte';
15
15
  import Carusel from './components/presentation/Carusel.svelte';
16
16
  import { CaruseleItem } from './components/presentation/Carusele.js';
17
+ import BlogDescription from './components/blog/BlogDescription.svelte';
18
+ import BlogTitle from './components/blog/BlogTitle.svelte';
19
+ import { listAllPosts } from './components/blog/blog.js';
17
20
  import { convertShowItemsToNavigationItems } from './components/converters/ShowItemToNavigationItems.js';
18
21
  import { ShowItem } from './components/presentation/ShowItem.js';
19
22
  import { title, suffix } from './stores/title.js';
@@ -21,4 +24,4 @@ import { pages } from './stores/pages.js';
21
24
  import { metaDescription, metaKeywords } from './stores/meta.js';
22
25
  import { Justify, Placement, Orientation, Position, Sizes, AlignItmes } from './components/Styling.js';
23
26
  import { Alert, Avatar, AvatarGroup, Breadcrumb, Button, ButtonGroup, Card, ChoiceInput, Close, Dialog, Disclose, Divider, Drawer, EmptyState, Header, HeaderNav, HeaderNavItem, Icon, IconSvg, Input, InputAddonItem, Loader, Pagination, Progress, Select, Spinner, Switch, Table, Tabs, Tag, Toast, Toasts } from 'agnostic-svelte';
24
- export { Visiblity, HeaderNavigationItem, DynamicMenu, FlatMenu, ColumnMenu, HamburgerMenu, DefaultLayout, TwoColumnsLayout, Banner, Link, Logo, SimpleFooter, Gallery, Carusel, CaruseleItem, Spacer, Well, Justify, Placement, Orientation, AlignItmes, Position, Sizes, ShowItem, convertShowItemsToNavigationItems, title, suffix, pages, metaDescription, metaKeywords, Alert, Avatar, AvatarGroup, Breadcrumb, Button, ButtonGroup, Card, ChoiceInput, Close, Dialog, Disclose, Divider, Drawer, EmptyState, Header, HeaderNav, HeaderNavItem, Icon, IconSvg, Input, InputAddonItem, Loader, Pagination, Progress, Select, Spinner, Switch, Table, Tabs, Tag, Toast, Toasts };
27
+ export { Visiblity, HeaderNavigationItem, DynamicMenu, FlatMenu, ColumnMenu, HamburgerMenu, BlogTitle, BlogDescription, listAllPosts, DefaultLayout, TwoColumnsLayout, Banner, Link, Logo, SimpleFooter, Gallery, Carusel, CaruseleItem, Spacer, Well, Justify, Placement, Orientation, AlignItmes, Position, Sizes, ShowItem, convertShowItemsToNavigationItems, title, suffix, pages, metaDescription, metaKeywords, Alert, Avatar, AvatarGroup, Breadcrumb, Button, ButtonGroup, Card, ChoiceInput, Close, Dialog, Disclose, Divider, Drawer, EmptyState, Header, HeaderNav, HeaderNavItem, Icon, IconSvg, Input, InputAddonItem, Loader, Pagination, Progress, Select, Spinner, Switch, Table, Tabs, Tag, Toast, Toasts };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "2.14.4",
3
+ "version": "2.15.1",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [
@@ -50,7 +50,7 @@
50
50
  "npm-watch": "^0.11.0",
51
51
  "publint": "^0.2.7",
52
52
  "sass": "^1.69.7",
53
- "svelte": "^4.2.8",
53
+ "svelte": "^4.2.18",
54
54
  "svelte-check": "^3.6.2",
55
55
  "tslib": "^2.6.2",
56
56
  "typescript": "^5.3.3",