@functionalcms/svelte-components 3.2.5 → 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.
@@ -1,34 +1,40 @@
1
- <style>
2
- div {
3
- width: var(--functional-mobile-content-width, 95%);
4
- margin: var(--functional-mobile-content-margin, var(--fluid-8));
5
- }
6
-
7
- @media (min-width: 960px) {
8
- div {
9
- width: var(--functional-content-width, 95%);
10
- margin: var(--functional-content-margin, var(--fluid-8));
11
- }
12
- }
13
- </style>
14
-
15
- <script lang='ts'>
16
- import { AlignItmes, Justify, Orientation } from "./Styling.js"
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { mergedClasses } from './CssHelper.js';
4
+ import { AlignItmes, Justify, Orientation } from './Styling.js';
17
5
 
18
- export let css: string = ""
19
- export let orientation: Orientation = Orientation.Column
20
- export let justify: Justify = Justify.Start
21
- export let alignItems: AlignItmes = AlignItmes.Start
6
+ interface WellProps {
7
+ css: string;
8
+ orientation: Orientation;
9
+ justify: Justify;
10
+ alignItems: AlignItmes;
11
+ mainRender: Snippet;
12
+ }
13
+ let {
14
+ mainRender,
15
+ css = '',
16
+ orientation = Orientation.Column,
17
+ justify = Justify.Start,
18
+ alignItems = AlignItmes.Start
19
+ }: WellProps = $props();
22
20
 
23
- $: klasses = [
24
- 'flex',
25
- `${orientation}`,
26
- `${justify}`,
27
- `${alignItems}`,
28
- css ? css : ''
29
- ].filter(c => c).join(" ")
21
+ let klasses = mergedClasses('flex', `${orientation}`, `${justify}`, `${alignItems}`, css ? css : '');
30
22
  </script>
31
23
 
32
24
  <div class={klasses}>
33
- <slot />
34
- </div>
25
+ {@render mainRender()}
26
+ </div>
27
+
28
+ <style>
29
+ div {
30
+ width: var(--functional-mobile-content-width, 95%);
31
+ margin: var(--functional-mobile-content-margin, var(--fluid-8));
32
+ }
33
+
34
+ @media (min-width: 960px) {
35
+ div {
36
+ width: var(--functional-content-width, 95%);
37
+ margin: var(--functional-content-margin, var(--fluid-8));
38
+ }
39
+ }
40
+ </style>
@@ -1,22 +1,14 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { AlignItmes, Justify, Orientation } from "./Styling.js";
3
2
  declare const __propDef: {
4
- props: {
5
- css?: string;
6
- orientation?: Orientation;
7
- justify?: Justify;
8
- alignItems?: AlignItmes;
9
- };
3
+ props: Record<string, never>;
10
4
  events: {
11
5
  [evt: string]: CustomEvent<any>;
12
6
  };
13
- slots: {
14
- default: {};
15
- };
7
+ slots: {};
16
8
  };
17
- export type WellProps = typeof __propDef.props;
9
+ type WellProps_ = typeof __propDef.props;
10
+ export { WellProps_ as WellProps };
18
11
  export type WellEvents = typeof __propDef.events;
19
12
  export type WellSlots = typeof __propDef.slots;
20
- export default class Well extends SvelteComponentTyped<WellProps, WellEvents, WellSlots> {
13
+ export default class Well extends SvelteComponentTyped<WellProps_, WellEvents, WellSlots> {
21
14
  }
22
- export {};
@@ -1,46 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { mergedClasses } from '../CssHelper';
3
3
 
4
- // Looks like the way to propogate boilerplate events is to
5
- // just declare in template like on:blur on:focus and so on
6
- // https://github.com/sveltejs/svelte/issues/585
7
- // Looks like this is what smelte is doing:
8
- // https://github.com/matyunya/smelte/blob/master/src/components/TextField/TextField.svelte
9
- // export let label = '';
10
- // export let id = '';
11
- // export let labelCss = '';
12
- // export let isLabelHidden = false;
13
- // export let helpText = '';
14
- // export let invalidText = '';
15
- // export let hasLeftAddon = false;
16
- // export let hasRightAddon = false;
17
- // export let isInvalid = false;
18
- // export let isInline = false;
19
- // export let isRounded = false;
20
- // export let isDisabled = undefined;
21
- // export let css = '';
22
- // export let isSkinned = true;
23
- // export let isUnderlinedWithBackground = false;
24
- // export let isUnderlined = false;
25
- // export let size: 'small' | 'large' | '' = '';
26
- // export let type:
27
- // | 'text'
28
- // | 'textarea'
29
- // | 'email'
30
- // | 'search'
31
- // | 'password'
32
- // | 'tel'
33
- // | 'number'
34
- // | 'url'
35
- // | 'month'
36
- // | 'time'
37
- // | 'week'
38
- // | 'date'
39
- // | 'datetime-local'
40
- // | 'color' = 'text';
41
-
42
- // export let value = '';
43
-
44
4
  let {
45
5
  label = '',
46
6
  id = '',
@@ -1,10 +1,26 @@
1
1
  <script lang="ts">
2
2
  import { page } from '$app/state';
3
+ import type { Snippet } from 'svelte';
3
4
 
4
- export let headerIsSticky: boolean = false;
5
- export let canonicalUrl: string = '';
5
+ interface DefaultLayoutProps {
6
+ headerIsSticky: boolean;
7
+ canonicalUrl: string;
8
+ header?: Snippet;
9
+ footer?: Snippet;
10
+ stickyFooter?: Snippet;
11
+ main: Snippet;
12
+ }
13
+
14
+ let {
15
+ main,
16
+ header,
17
+ footer,
18
+ stickyFooter,
19
+ headerIsSticky = false,
20
+ canonicalUrl = ''
21
+ }: DefaultLayoutProps = $props();
6
22
 
7
- $: headerCss = headerIsSticky ? 'sticky' : '';
23
+ let headerCss = $derived(headerIsSticky ? 'sticky' : '');
8
24
  </script>
9
25
 
10
26
  <svelte:head>
@@ -12,25 +28,25 @@
12
28
  </svelte:head>
13
29
 
14
30
  <div id="defaultLayout">
15
- {#if $$slots.header}
31
+ {#if header}
16
32
  <header class={headerCss}>
17
- <slot name="header" />
33
+ {@render header()}
18
34
  </header>
19
35
  {/if}
20
36
  <main>
21
- <slot />
37
+ {@render main()}
22
38
  </main>
23
- {#if $$slots.footer}
39
+ {#if footer}
24
40
  <footer>
25
- <slot name="footer" />
41
+ {@render footer()}
26
42
  </footer>
27
43
  {/if}
28
44
  <div id="drawer-root"></div>
29
45
  </div>
30
46
 
31
- {#if $$slots.sticky_footer}
47
+ {#if stickyFooter}
32
48
  <footer class="sticky">
33
- <slot name="sticky_footer" />
49
+ {@render stickyFooter()}
34
50
  </footer>
35
51
  {/if}
36
52
 
@@ -1,22 +1,14 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
- props: {
4
- headerIsSticky?: boolean;
5
- canonicalUrl?: string;
6
- };
3
+ props: Record<string, never>;
7
4
  events: {
8
5
  [evt: string]: CustomEvent<any>;
9
6
  };
10
- slots: {
11
- header: {};
12
- default: {};
13
- footer: {};
14
- sticky_footer: {};
15
- };
7
+ slots: {};
16
8
  };
17
- export type DefaultLayoutProps = typeof __propDef.props;
9
+ type DefaultLayoutProps_ = typeof __propDef.props;
10
+ export { DefaultLayoutProps_ as DefaultLayoutProps };
18
11
  export type DefaultLayoutEvents = typeof __propDef.events;
19
12
  export type DefaultLayoutSlots = typeof __propDef.slots;
20
- export default class DefaultLayout extends SvelteComponentTyped<DefaultLayoutProps, DefaultLayoutEvents, DefaultLayoutSlots> {
13
+ export default class DefaultLayout extends SvelteComponentTyped<DefaultLayoutProps_, DefaultLayoutEvents, DefaultLayoutSlots> {
21
14
  }
22
- export {};
@@ -1,17 +1,28 @@
1
1
  <script lang="ts">
2
- export let title = "";
3
- export let description = "";
4
- export let keywords = "";
5
- export let robots = "index, follow";
6
- export let charset = "UTF-8";
7
- export let viewport = "width=device-width, initial-scale=1.0";
2
+ interface MetaProps {
3
+ title: string;
4
+ description: string;
5
+ keywords: string;
6
+ robots: string;
7
+ charset: string;
8
+ viewport: string;
9
+ }
10
+
11
+ let {
12
+ title = '',
13
+ description = '',
14
+ keywords = '',
15
+ robots = 'index, follow',
16
+ charset = 'UTF-8',
17
+ viewport = 'width=device-width, initial-scale=1.0'
18
+ }: MetaProps = $props();
8
19
  </script>
9
20
 
10
21
  <svelte:head>
11
- <title>{title}</title>
12
- <meta name="description" content={description}>
13
- <meta name="keywords" content={keywords}>
14
- <meta name="robots" content={robots}>
15
- <meta name="viewport" content={viewport}>
16
- <meta charset={charset}>
17
- </svelte:head>
22
+ <title>{title}</title>
23
+ <meta name="description" content={description} />
24
+ <meta name="keywords" content={keywords} />
25
+ <meta name="robots" content={robots} />
26
+ <meta name="viewport" content={viewport} />
27
+ <meta {charset} />
28
+ </svelte:head>
@@ -1,21 +1,14 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
- props: {
4
- title?: string;
5
- description?: string;
6
- keywords?: string;
7
- robots?: string;
8
- charset?: string;
9
- viewport?: string;
10
- };
3
+ props: Record<string, never>;
11
4
  events: {
12
5
  [evt: string]: CustomEvent<any>;
13
6
  };
14
7
  slots: {};
15
8
  };
16
- export type MetaProps = typeof __propDef.props;
9
+ type MetaProps_ = typeof __propDef.props;
10
+ export { MetaProps_ as MetaProps };
17
11
  export type MetaEvents = typeof __propDef.events;
18
12
  export type MetaSlots = typeof __propDef.slots;
19
- export default class Meta extends SvelteComponentTyped<MetaProps, MetaEvents, MetaSlots> {
13
+ export default class Meta extends SvelteComponentTyped<MetaProps_, MetaEvents, MetaSlots> {
20
14
  }
21
- export {};
@@ -1,28 +1,23 @@
1
- <style>
2
- aside {
3
- text-align: center;
4
- font-size: smaller;
5
- }
6
- </style>
1
+ <script lang="ts">
2
+ interface SimpleFooterProps {
3
+ companyName: string;
4
+ motto: string;
5
+ logoUrl?: string;
6
+ }
7
7
 
8
- <script lang='ts'>
9
- /**
10
- * @type {string}
11
- */
12
- export let companyName = ""
13
- /**
14
- * @type {string}
15
- */
16
- export let motto = ""
17
- /**
18
- * @type {string}
19
- */
20
- export let logoUrl: string
8
+ let { companyName = '', motto = '', logoUrl }: SimpleFooterProps = $props();
21
9
  </script>
22
10
 
23
11
  <aside class="items-center grid-flow-col">
24
- <img src={logoUrl} alt={companyName} />
25
- <p>{motto}</p>
26
- <p>Copyright © 2024 - All right reserved by {companyName}</p>
27
- <p>Powerd by <a href="https://functional-cms.com">Functional CMS</a></p>
28
- </aside>
12
+ <img src={logoUrl} alt={companyName} />
13
+ <p>{motto}</p>
14
+ <p>Copyright © 2025 - All right reserved by {companyName}</p>
15
+ <p>Powerd by <a href="https://functional-cms.com">Functional CMS</a></p>
16
+ </aside>
17
+
18
+ <style>
19
+ aside {
20
+ text-align: center;
21
+ font-size: smaller;
22
+ }
23
+ </style>
@@ -1,24 +1,14 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
- props: {
4
- /**
5
- * @type {string}
6
- */ companyName?: string;
7
- /**
8
- * @type {string}
9
- */ motto?: string;
10
- /**
11
- * @type {string}
12
- */ logoUrl: string;
13
- };
3
+ props: Record<string, never>;
14
4
  events: {
15
5
  [evt: string]: CustomEvent<any>;
16
6
  };
17
7
  slots: {};
18
8
  };
19
- export type SimpleFooterProps = typeof __propDef.props;
9
+ type SimpleFooterProps_ = typeof __propDef.props;
10
+ export { SimpleFooterProps_ as SimpleFooterProps };
20
11
  export type SimpleFooterEvents = typeof __propDef.events;
21
12
  export type SimpleFooterSlots = typeof __propDef.slots;
22
- export default class SimpleFooter extends SvelteComponentTyped<SimpleFooterProps, SimpleFooterEvents, SimpleFooterSlots> {
13
+ export default class SimpleFooter extends SvelteComponentTyped<SimpleFooterProps_, SimpleFooterEvents, SimpleFooterSlots> {
23
14
  }
24
- export {};
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- export let domain;
2
+ let { domain }: { domain: string } = $props();
3
3
  </script>
4
4
 
5
5
  <svelte:head>
@@ -1,8 +1,6 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
- props: {
4
- domain: any;
5
- };
3
+ props: Record<string, never>;
6
4
  events: {
7
5
  [evt: string]: CustomEvent<any>;
8
6
  };
@@ -1,15 +1,23 @@
1
- <style></style>
2
-
3
1
  <script lang="ts">
4
- export let leftCss: string = 'w50p'
5
- export let rightCss: string = 'w50p'
2
+ import type { Snippet } from "svelte";
3
+
4
+ interface TwoColumnLayoutProps {
5
+ leftRender: Snippet;
6
+ rightRender: Snippet;
7
+ leftCss: string;
8
+ rightCss: string;
9
+ }
10
+
11
+ let { leftRender, rightRender, leftCss = 'w50p', rightCss = 'w50p' } = $props();
6
12
  </script>
7
13
 
8
14
  <section class="flex flex-row-dynamic fw">
9
15
  <div class="left {leftCss}">
10
- <slot name="left" />
11
- </div>
12
- <div class="right {rightCss}">
13
- <slot name="right" />
14
- </div>
15
- </section>
16
+ {@render leftRender()}
17
+ </div>
18
+ <div class="right {rightCss}">
19
+ {@render rightRender()}
20
+ </div>
21
+ </section>
22
+
23
+ <style></style>
@@ -1,16 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
- props: {
4
- leftCss?: string;
5
- rightCss?: string;
6
- };
3
+ props: Record<string, never>;
7
4
  events: {
8
5
  [evt: string]: CustomEvent<any>;
9
6
  };
10
- slots: {
11
- left: {};
12
- right: {};
13
- };
7
+ slots: {};
14
8
  };
15
9
  export type TwoColumnsLayoutProps = typeof __propDef.props;
16
10
  export type TwoColumnsLayoutEvents = typeof __propDef.events;
@@ -20,7 +20,7 @@
20
20
  <ul class={containerCss} role="menu" aria-label="menu">
21
21
  {#each localPages as pageItem}
22
22
  <li
23
- aria-current={isSelected(includeSubpagesForSelect, page, pageItem)}
23
+ data-selected={isSelected(includeSubpagesForSelect, page, pageItem)}
24
24
  class={linkCss}
25
25
  role="none"
26
26
  >
@@ -28,7 +28,7 @@
28
28
  <a href={pageItem.path} role="menuitem">
29
29
  {pageItem.name}
30
30
  </a>
31
- {#if pageItem.subItems?.length > 0}
31
+ {#if pageItem?.subItems?.length > 0}
32
32
  <slot name="subItems" subpages={pageItem.subItems} />
33
33
  {/if}
34
34
  </li>
@@ -1,8 +1,10 @@
1
1
  <script lang="ts">
2
- import { mergedClasses } from '../../CssHelper';
3
- import { Orientation } from '../../Styling';
2
+ import { mergedClasses } from '../CssHelper';
3
+ import type { Snippet } from 'svelte';
4
+ import { Orientation } from '../Styling';
4
5
 
5
6
  interface Props {
7
+ mainRender: Snippet;
6
8
  isAnimated?: boolean;
7
9
  isSkinned?: boolean;
8
10
  isStacked?: boolean;
@@ -16,6 +18,7 @@
16
18
  }
17
19
 
18
20
  const {
21
+ mainRender,
19
22
  isAnimated = false,
20
23
  isSkinned = true,
21
24
  isStacked = false,
@@ -42,8 +45,8 @@
42
45
  );
43
46
  </script>
44
47
 
45
- <div class={klasses} on:click on:focus on:blur>
46
- <slot />
48
+ <div class={klasses}>
49
+ {@render mainRender()}
47
50
  </div>
48
51
 
49
52
  <style>
@@ -2,15 +2,9 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
5
- click: MouseEvent;
6
- focus: FocusEvent;
7
- blur: FocusEvent;
8
- } & {
9
5
  [evt: string]: CustomEvent<any>;
10
6
  };
11
- slots: {
12
- default: {};
13
- };
7
+ slots: {};
14
8
  };
15
9
  export type CardProps = typeof __propDef.props;
16
10
  export type CardEvents = typeof __propDef.events;
@@ -1,17 +1,18 @@
1
1
  <script lang="ts">
2
- import Card from '../agnostic/Card/Card.svelte';
2
+ import Card from './Card.svelte';
3
3
  import type { ShowItem } from './ShowItem.js';
4
4
  import { AlignItmes, Justify, Orientation } from '../Styling.js';
5
5
  import { mergedClasses } from '../CssHelper';
6
+ import type { Snippet } from 'svelte';
6
7
 
7
8
  interface GaleryProps {
8
9
  items: Array<ShowItem>;
9
- renderItem: any;
10
- css: string;
10
+ renderItem: Snippet<[ShowItem]>;
11
11
  justify: Justify;
12
12
  alignItems: AlignItmes;
13
13
  orientation: Orientation;
14
14
  restProps: any;
15
+ css: string;
15
16
  }
16
17
 
17
18
  let {
package/dist/index.d.ts CHANGED
@@ -32,7 +32,7 @@ export { default as AvatarGroup } from './components/agnostic/Avatar/AvatarGroup
32
32
  export { default as Breadcrumb } from './components/agnostic/Breadcrumb/Breadcrumb.svelte';
33
33
  export { default as Button } from './components/agnostic/Button/Button.svelte';
34
34
  export { default as ButtonGroup } from './components/agnostic/Button/ButtonGroup.svelte';
35
- export { default as Card } from './components/agnostic/Card/Card.svelte';
35
+ export { default as Card } from './components/presentation/Card.svelte';
36
36
  export { default as ChoiceInput } from './components/agnostic/ChoiceInput/ChoiceInput.svelte';
37
37
  export { default as Close } from './components/agnostic/Close/Close.svelte';
38
38
  export { default as Dialog } from './components/agnostic/Dialog/Dialog.svelte';
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ export { default as AvatarGroup } from './components/agnostic/Avatar/AvatarGroup
31
31
  export { default as Breadcrumb } from './components/agnostic/Breadcrumb/Breadcrumb.svelte';
32
32
  export { default as Button } from './components/agnostic/Button/Button.svelte';
33
33
  export { default as ButtonGroup } from './components/agnostic/Button/ButtonGroup.svelte';
34
- export { default as Card } from './components/agnostic/Card/Card.svelte';
34
+ export { default as Card } from './components/presentation/Card.svelte';
35
35
  export { default as ChoiceInput } from './components/agnostic/ChoiceInput/ChoiceInput.svelte';
36
36
  export { default as Close } from './components/agnostic/Close/Close.svelte';
37
37
  export { default as Dialog } from './components/agnostic/Dialog/Dialog.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "3.2.5",
3
+ "version": "3.3.0",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [