sveltacular 0.0.26 → 0.0.28

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,10 +1,10 @@
1
- <script>import Heading from "../typography/heading.svelte";
1
+ <script>import Headline from "../typography/headline.svelte";
2
2
  export let title;
3
3
  export let level = 4;
4
4
  </script>
5
5
 
6
6
  <div>
7
- <Heading {level}>{title}</Heading>
7
+ <Headline {level}>{title}</Headline>
8
8
  </div>
9
9
 
10
10
  <style>div {
@@ -1,8 +1,9 @@
1
1
  import { SvelteComponent } from "svelte";
2
+ import type { SectionLevel } from '../types/generic.js';
2
3
  declare const __propDef: {
3
4
  props: {
4
5
  title: string;
5
- level?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
6
+ level?: SectionLevel | undefined;
6
7
  };
7
8
  events: {
8
9
  [evt: string]: CustomEvent<any>;
@@ -1,5 +1,8 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
- export let action = "get";
2
+ import Section from "../generic/section/section.svelte";
3
+ export let method = "get";
4
+ export let title = void 0;
5
+ export let action = void 0;
3
6
  const dispatch = createEventDispatcher();
4
7
  const onSubmit = (e) => {
5
8
  e.preventDefault();
@@ -7,6 +10,8 @@ const onSubmit = (e) => {
7
10
  };
8
11
  </script>
9
12
 
10
- <form {action} on:submit={onSubmit}>
11
- <slot />
12
- </form>
13
+ <Section {title}>
14
+ <form {method} {action} on:submit={onSubmit}>
15
+ <slot />
16
+ </form>
17
+ </Section>
@@ -1,7 +1,9 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
- action?: "get" | "post" | "put" | "delete" | undefined;
4
+ method?: "get" | "post" | "put" | "delete" | undefined;
5
+ title?: string | undefined;
6
+ action?: string | undefined;
5
7
  };
6
8
  events: {
7
9
  submit: CustomEvent<void>;
@@ -67,7 +67,7 @@ const onInputKeyPress = (e) => {
67
67
  }
68
68
  };
69
69
  const triggerSearch = debounce(async () => {
70
- if (search) {
70
+ if (search && searchable) {
71
71
  items = await search(text);
72
72
  }
73
73
  updateText();
@@ -75,7 +75,7 @@ const triggerSearch = debounce(async () => {
75
75
  }, 300);
76
76
  const applyFilter = () => {
77
77
  const searchText = text.trim().toLowerCase();
78
- filteredItems = searchText ? items.map((item, index) => ({ ...item, index })).filter((item) => item.name.toLowerCase().includes(searchText)) : items.map((item, index) => ({ ...item, index }));
78
+ filteredItems = searchText && searchable ? items.map((item, index) => ({ ...item, index })).filter((item) => item.name.toLowerCase().includes(searchText)) : items.map((item, index) => ({ ...item, index }));
79
79
  };
80
80
  const clear = () => {
81
81
  text = "";
@@ -3,8 +3,7 @@
3
3
  <style>hr {
4
4
  border: 0;
5
5
  height: 0.1rem;
6
- background: #333;
7
- background-image: linear-gradient(to right, #ccc, #333, #ccc);
6
+ background: var(--divider-color, rgba(127, 127, 127, 0.5));
8
7
  margin-top: 0.5rem;
9
8
  margin-bottom: 0.5rem;
10
9
  }</style>
@@ -1,16 +1,18 @@
1
1
  <script>import FlexRow from "../../layout/flex-row.svelte";
2
- import Heading from "../../typography/heading.svelte";
2
+ import Headline from "../../typography/headline.svelte";
3
3
  import Subtitle from "../../typography/subtitle.svelte";
4
- export let level = 1;
5
- export let title;
4
+ import { getContext } from "svelte";
5
+ const section = getContext("section");
6
+ export let level = section?.level || 2;
7
+ export let title = section?.title || "";
6
8
  export let subtitle = "";
7
9
  export let underline = false;
8
10
  </script>
9
11
 
10
- <header class:underline>
12
+ <header class:underline data-level={level}>
11
13
  <FlexRow>
12
14
  <hgroup>
13
- <Heading {level}>{title}</Heading>
15
+ <Headline {level}>{title}</Headline>
14
16
  {#if subtitle}
15
17
  <Subtitle {level}>{subtitle}</Subtitle>
16
18
  {/if}
@@ -1,8 +1,9 @@
1
1
  import { SvelteComponent } from "svelte";
2
+ import type { SectionLevel } from '../../types/generic.js';
2
3
  declare const __propDef: {
3
4
  props: {
4
- level?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
5
- title: string;
5
+ level?: SectionLevel | undefined;
6
+ title?: string | undefined;
6
7
  subtitle?: string | undefined;
7
8
  underline?: boolean | undefined;
8
9
  };
@@ -1,9 +1,20 @@
1
- <section>
1
+ <script>import { setContext } from "svelte";
2
+ import Header from "../header/header.svelte";
3
+ export let title = void 0;
4
+ export let level = 2;
5
+ setContext("section", { level, title });
6
+ </script>
7
+
8
+ <section class="level-{level}">
9
+ {#if title}
10
+ <Header />
11
+ {/if}
2
12
  <slot />
3
13
  </section>
4
14
 
5
15
  <style>section {
6
16
  padding: 0;
7
- margin: 1rem 1rem;
17
+ margin-top: 1rem;
18
+ margin-bottom: 1rem;
8
19
  font-family: var(--base-font-family, sans-serif);
9
20
  }</style>
@@ -1,21 +1,9 @@
1
- /** @typedef {typeof __propDef.props} SectionProps */
2
- /** @typedef {typeof __propDef.events} SectionEvents */
3
- /** @typedef {typeof __propDef.slots} SectionSlots */
4
- export default class Section extends SvelteComponent<{
5
- [x: string]: never;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> {
11
- }
12
- export type SectionProps = typeof __propDef.props;
13
- export type SectionEvents = typeof __propDef.events;
14
- export type SectionSlots = typeof __propDef.slots;
15
1
  import { SvelteComponent } from "svelte";
2
+ import type { SectionLevel } from '../../types/generic.js';
16
3
  declare const __propDef: {
17
4
  props: {
18
- [x: string]: never;
5
+ title?: string | undefined;
6
+ level?: SectionLevel | undefined;
19
7
  };
20
8
  events: {
21
9
  [evt: string]: CustomEvent<any>;
@@ -24,4 +12,9 @@ declare const __propDef: {
24
12
  default: {};
25
13
  };
26
14
  };
15
+ export type SectionProps = typeof __propDef.props;
16
+ export type SectionEvents = typeof __propDef.events;
17
+ export type SectionSlots = typeof __propDef.slots;
18
+ export default class Section extends SvelteComponent<SectionProps, SectionEvents, SectionSlots> {
19
+ }
27
20
  export {};
package/dist/index.d.ts CHANGED
@@ -62,7 +62,7 @@ export { default as TableFooter } from './tables/table-footer.svelte';
62
62
  export { default as TableFooterCell } from './tables/table-footer-cell.svelte';
63
63
  export { default as TableFooterRow } from './tables/table-footer-row.svelte';
64
64
  export { default as TableRow } from './tables/table-row.svelte';
65
- export { default as Heading } from './typography/heading.svelte';
65
+ export { default as Headline } from './typography/headline.svelte';
66
66
  export { default as Subtitle } from './typography/subtitle.svelte';
67
67
  export { default as Text } from './typography/text.svelte';
68
68
  export { default as CodeBlock } from './typography/code-block.svelte';
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@ export { default as TableFooterCell } from './tables/table-footer-cell.svelte';
69
69
  export { default as TableFooterRow } from './tables/table-footer-row.svelte';
70
70
  export { default as TableRow } from './tables/table-row.svelte';
71
71
  // Typography
72
- export { default as Heading } from './typography/heading.svelte';
72
+ export { default as Headline } from './typography/headline.svelte';
73
73
  export { default as Subtitle } from './typography/subtitle.svelte';
74
74
  export { default as Text } from './typography/text.svelte';
75
75
  export { default as CodeBlock } from './typography/code-block.svelte';
@@ -1,7 +1,10 @@
1
1
  <script>export let size = "md";
2
+ const captureClick = (e) => {
3
+ e.stopPropagation();
4
+ };
2
5
  </script>
3
6
 
4
- <div class={size}>
7
+ <div class={size} on:click={captureClick}>
5
8
  <slot />
6
9
  </div>
7
10
 
@@ -1,8 +1,8 @@
1
- <script>import AngleRightIcon from "../../icons/angle-right-icon.svelte";
2
- import HomeIcon from "../../icons/home-icon.svelte";
1
+ <script>import HomeIcon from "../../icons/home-icon.svelte";
3
2
  export let homeUrl = null;
4
3
  export let crumbs = [];
5
4
  export let size = "md";
5
+ export let separator = "/";
6
6
  const getCrumLabel = (crumb) => {
7
7
  if (typeof crumb === "string")
8
8
  return crumb;
@@ -12,8 +12,8 @@ const getCrumLabel = (crumb) => {
12
12
 
13
13
  <nav class={size}>
14
14
  {#if homeUrl}
15
- <li class="icon">
16
- <a href={homeUrl} class="home"><HomeIcon /></a>
15
+ <li class="home">
16
+ <a href={homeUrl}><HomeIcon /></a>
17
17
  </li>
18
18
  {/if}
19
19
  {#each crumbs as crumb, i}
@@ -27,9 +27,7 @@ const getCrumLabel = (crumb) => {
27
27
  </li>
28
28
  {/if}
29
29
  {#if i < crumbs.length - 1}
30
- <li class="icon">
31
- <AngleRightIcon />
32
- </li>
30
+ <li class="separator">{separator}</li>
33
31
  {/if}
34
32
  {/each}
35
33
  </nav>
@@ -38,44 +36,41 @@ const getCrumLabel = (crumb) => {
38
36
  display: flex;
39
37
  align-items: center;
40
38
  list-style: none;
39
+ gap: 0.5rem;
41
40
  padding: 0;
42
41
  margin: 0;
43
42
  line-height: 1.5rem;
44
43
  font-family: var(--breadcrumbs-font-family, sans-serif);
45
44
  }
46
45
  nav li {
47
- display: flex;
48
- align-items: center;
49
- vertical-align: middle;
50
- margin-left: 0.5rem;
51
46
  color: var(--breadcrumbs-fg, #333);
47
+ padding: 0;
48
+ margin: 0;
52
49
  }
53
50
  nav li a {
54
51
  color: var(--breadcrumbs-link-fg, #333);
55
52
  text-decoration: none;
53
+ width: 100%;
56
54
  }
57
55
  nav li a:hover {
58
56
  color: var(--breadcrumbs-link-hover-fg, black);
59
57
  text-decoration: underline;
60
58
  }
61
- nav li a.home {
62
- width: 100%;
63
- }
64
- nav li:first-child {
65
- margin-left: 0;
66
- }
67
- nav li.icon {
68
- padding-top: 2px;
69
- }
70
59
  nav.sm li {
71
60
  font-size: 0.75rem;
72
- min-width: 12px;
61
+ }
62
+ nav.sm li.home {
63
+ width: 12px;
73
64
  }
74
65
  nav.md li {
75
66
  font-size: 0.875rem;
76
- min-width: 14px;
67
+ }
68
+ nav.md li.home {
69
+ width: 14px;
77
70
  }
78
71
  nav.lg li {
79
72
  font-size: 1rem;
80
- min-width: 16px;
73
+ }
74
+ nav.lg li.home {
75
+ width: 16px;
81
76
  }</style>
@@ -7,6 +7,7 @@ declare const __propDef: {
7
7
  href?: string | undefined;
8
8
  })[] | undefined;
9
9
  size?: "sm" | "md" | "lg" | undefined;
10
+ separator?: string | undefined;
10
11
  };
11
12
  events: {
12
13
  [evt: string]: CustomEvent<any>;
@@ -0,0 +1 @@
1
+ export type SectionLevel = 1 | 2 | 3 | 4 | 5 | 6;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { SectionLevel } from '../types/generic.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ transform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
6
+ level?: SectionLevel | undefined;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {
12
+ default: {};
13
+ };
14
+ };
15
+ export type HeadlineProps = typeof __propDef.props;
16
+ export type HeadlineEvents = typeof __propDef.events;
17
+ export type HeadlineSlots = typeof __propDef.slots;
18
+ export default class Headline extends SvelteComponent<HeadlineProps, HeadlineEvents, HeadlineSlots> {
19
+ }
20
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltacular",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "scripts": {
5
5
  "watch": "npm run dev -- --open",
6
6
  "dev": "vite dev",
@@ -1,19 +0,0 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- transform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
5
- level?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type HeadingProps = typeof __propDef.props;
15
- export type HeadingEvents = typeof __propDef.events;
16
- export type HeadingSlots = typeof __propDef.slots;
17
- export default class Heading extends SvelteComponent<HeadingProps, HeadingEvents, HeadingSlots> {
18
- }
19
- export {};