lutra 0.0.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.
Files changed (153) hide show
  1. package/README.md +29 -0
  2. package/dist/Data/Stat.svelte +89 -0
  3. package/dist/Data/Stat.svelte.d.ts +33 -0
  4. package/dist/DataTable/DataTable.svelte +36 -0
  5. package/dist/DataTable/DataTable.svelte.d.ts +19 -0
  6. package/dist/DataTable/DataTableColumn.svelte +20 -0
  7. package/dist/DataTable/DataTableColumn.svelte.d.ts +18 -0
  8. package/dist/DataTable/DataTableRow.svelte +28 -0
  9. package/dist/DataTable/DataTableRow.svelte.d.ts +18 -0
  10. package/dist/Display/Avatar.svelte +61 -0
  11. package/dist/Display/Avatar.svelte.d.ts +18 -0
  12. package/dist/Display/Badge.svelte +93 -0
  13. package/dist/Display/Badge.svelte.d.ts +30 -0
  14. package/dist/Display/Callout.svelte +105 -0
  15. package/dist/Display/Callout.svelte.d.ts +34 -0
  16. package/dist/Display/Code.svelte +195 -0
  17. package/dist/Display/Code.svelte.d.ts +29 -0
  18. package/dist/Display/ContextTip.svelte +23 -0
  19. package/dist/Display/ContextTip.svelte.d.ts +17 -0
  20. package/dist/Display/Details.svelte +49 -0
  21. package/dist/Display/Details.svelte.d.ts +26 -0
  22. package/dist/Display/Hero.svelte +50 -0
  23. package/dist/Display/Hero.svelte.d.ts +25 -0
  24. package/dist/Display/Icon.svelte +35 -0
  25. package/dist/Display/Icon.svelte.d.ts +18 -0
  26. package/dist/Display/IconButton.svelte +85 -0
  27. package/dist/Display/IconButton.svelte.d.ts +28 -0
  28. package/dist/Display/Indicator.svelte +352 -0
  29. package/dist/Display/Indicator.svelte.d.ts +22 -0
  30. package/dist/Display/Popup.svelte +111 -0
  31. package/dist/Display/Popup.svelte.d.ts +26 -0
  32. package/dist/Display/Tag.svelte +90 -0
  33. package/dist/Display/Tag.svelte.d.ts +31 -0
  34. package/dist/Display/Tooltip.svelte +96 -0
  35. package/dist/Display/Tooltip.svelte.d.ts +22 -0
  36. package/dist/Form/Button.svelte +34 -0
  37. package/dist/Form/Button.svelte.d.ts +24 -0
  38. package/dist/Form/FieldActions.svelte +25 -0
  39. package/dist/Form/FieldActions.svelte.d.ts +17 -0
  40. package/dist/Form/FieldContainer.svelte +31 -0
  41. package/dist/Form/FieldContainer.svelte.d.ts +18 -0
  42. package/dist/Form/FieldContent.svelte +78 -0
  43. package/dist/Form/FieldContent.svelte.d.ts +32 -0
  44. package/dist/Form/FieldSection.svelte +97 -0
  45. package/dist/Form/FieldSection.svelte.d.ts +23 -0
  46. package/dist/Form/Fieldset.svelte +63 -0
  47. package/dist/Form/Fieldset.svelte.d.ts +32 -0
  48. package/dist/Form/Form.svelte +19 -0
  49. package/dist/Form/Form.svelte.d.ts +18 -0
  50. package/dist/Form/Input.svelte +266 -0
  51. package/dist/Form/Input.svelte.d.ts +113 -0
  52. package/dist/Form/InputLength.svelte +32 -0
  53. package/dist/Form/InputLength.svelte.d.ts +19 -0
  54. package/dist/Form/Label.svelte +26 -0
  55. package/dist/Form/Label.svelte.d.ts +25 -0
  56. package/dist/Form/Select.svelte +24 -0
  57. package/dist/Form/Select.svelte.d.ts +28 -0
  58. package/dist/Form/form.d.ts +34 -0
  59. package/dist/Form/form.js +31 -0
  60. package/dist/Form/types.d.ts +4 -0
  61. package/dist/Form/types.js +1 -0
  62. package/dist/Grid/Column.svelte +11 -0
  63. package/dist/Grid/Column.svelte.d.ts +17 -0
  64. package/dist/Grid/Grid.svelte +19 -0
  65. package/dist/Grid/Grid.svelte.d.ts +18 -0
  66. package/dist/Grid/Row.svelte +44 -0
  67. package/dist/Grid/Row.svelte.d.ts +19 -0
  68. package/dist/Icons/Alert.svelte +3 -0
  69. package/dist/Icons/Alert.svelte.d.ts +23 -0
  70. package/dist/Icons/Copy.svelte +3 -0
  71. package/dist/Icons/Copy.svelte.d.ts +23 -0
  72. package/dist/Icons/Done.svelte +3 -0
  73. package/dist/Icons/Done.svelte.d.ts +23 -0
  74. package/dist/Icons/Error.svelte +3 -0
  75. package/dist/Icons/Error.svelte.d.ts +23 -0
  76. package/dist/Icons/Help.svelte +3 -0
  77. package/dist/Icons/Help.svelte.d.ts +23 -0
  78. package/dist/Icons/Hide.svelte +3 -0
  79. package/dist/Icons/Hide.svelte.d.ts +23 -0
  80. package/dist/Icons/Info.svelte +3 -0
  81. package/dist/Icons/Info.svelte.d.ts +23 -0
  82. package/dist/Icons/Link.svelte +3 -0
  83. package/dist/Icons/Link.svelte.d.ts +23 -0
  84. package/dist/Icons/Show.svelte +3 -0
  85. package/dist/Icons/Show.svelte.d.ts +23 -0
  86. package/dist/Icons/Success.svelte +3 -0
  87. package/dist/Icons/Success.svelte.d.ts +23 -0
  88. package/dist/Icons/Warning.svelte +3 -0
  89. package/dist/Icons/Warning.svelte.d.ts +23 -0
  90. package/dist/Layout/Layout.svelte +43 -0
  91. package/dist/Layout/Layout.svelte.d.ts +21 -0
  92. package/dist/Layout/LayoutFooter.svelte +21 -0
  93. package/dist/Layout/LayoutFooter.svelte.d.ts +17 -0
  94. package/dist/Layout/LayoutGrid.svelte +51 -0
  95. package/dist/Layout/LayoutGrid.svelte.d.ts +30 -0
  96. package/dist/Layout/LayoutHeader.svelte +94 -0
  97. package/dist/Layout/LayoutHeader.svelte.d.ts +38 -0
  98. package/dist/Layout/LayoutTypes.svelte.d.ts +15 -0
  99. package/dist/Layout/LayoutTypes.svelte.js +9 -0
  100. package/dist/Layout/PageContent.svelte +89 -0
  101. package/dist/Layout/PageContent.svelte.d.ts +23 -0
  102. package/dist/Layout/Theme.svelte +215 -0
  103. package/dist/Layout/Theme.svelte.d.ts +18 -0
  104. package/dist/Layout/UIContent.svelte +15 -0
  105. package/dist/Layout/UIContent.svelte.d.ts +17 -0
  106. package/dist/Navigation/Breadcrumb.svelte +82 -0
  107. package/dist/Navigation/Breadcrumb.svelte.d.ts +29 -0
  108. package/dist/Navigation/Menu.svelte +180 -0
  109. package/dist/Navigation/Menu.svelte.d.ts +18 -0
  110. package/dist/Navigation/MenuTypes.svelte.d.ts +37 -0
  111. package/dist/Navigation/MenuTypes.svelte.js +1 -0
  112. package/dist/Navigation/TabbedContent.svelte +43 -0
  113. package/dist/Navigation/TabbedContent.svelte.d.ts +22 -0
  114. package/dist/Navigation/Tabs.svelte +118 -0
  115. package/dist/Navigation/Tabs.svelte.d.ts +24 -0
  116. package/dist/Pages/LoginPage.svelte +32 -0
  117. package/dist/Pages/LoginPage.svelte.d.ts +14 -0
  118. package/dist/Typography/Clamp.svelte +25 -0
  119. package/dist/Typography/Clamp.svelte.d.ts +23 -0
  120. package/dist/Typography/H.svelte +51 -0
  121. package/dist/Typography/H.svelte.d.ts +25 -0
  122. package/dist/Typography/H1.svelte +14 -0
  123. package/dist/Typography/H1.svelte.d.ts +23 -0
  124. package/dist/Typography/H2.svelte +13 -0
  125. package/dist/Typography/H2.svelte.d.ts +23 -0
  126. package/dist/Typography/H3.svelte +13 -0
  127. package/dist/Typography/H3.svelte.d.ts +23 -0
  128. package/dist/Typography/H4.svelte +13 -0
  129. package/dist/Typography/H4.svelte.d.ts +23 -0
  130. package/dist/Typography/H5.svelte +13 -0
  131. package/dist/Typography/H5.svelte.d.ts +23 -0
  132. package/dist/Typography/H6.svelte +13 -0
  133. package/dist/Typography/H6.svelte.d.ts +23 -0
  134. package/dist/Typography/P.svelte +32 -0
  135. package/dist/Typography/P.svelte.d.ts +23 -0
  136. package/dist/index.d.ts +1 -0
  137. package/dist/index.js +2 -0
  138. package/dist/style.css +787 -0
  139. package/dist/utils/attr.d.ts +5 -0
  140. package/dist/utils/attr.js +21 -0
  141. package/dist/utils/color.d.ts +51 -0
  142. package/dist/utils/color.js +97 -0
  143. package/dist/utils/defaults.d.ts +4 -0
  144. package/dist/utils/defaults.js +1 -0
  145. package/dist/utils/hooks.server.d.ts +2 -0
  146. package/dist/utils/hooks.server.js +16 -0
  147. package/dist/utils/id.d.ts +1 -0
  148. package/dist/utils/id.js +3 -0
  149. package/dist/utils/isSnippet.d.ts +5 -0
  150. package/dist/utils/isSnippet.js +6 -0
  151. package/dist/utils/transitions.d.ts +29 -0
  152. package/dist/utils/transitions.js +66 -0
  153. package/package.json +58 -0
@@ -0,0 +1,195 @@
1
+ <script>import Copy from "../Icons/Copy.svelte";
2
+ import Done from "../Icons/Done.svelte";
3
+ import IconButton from "./IconButton.svelte";
4
+ import Tooltip from "./Tooltip.svelte";
5
+ let {
6
+ code = $bindable(""),
7
+ highlight,
8
+ copyable,
9
+ contained,
10
+ rounded,
11
+ lineNumbers,
12
+ readonly
13
+ } = $props();
14
+ const numberOfLines = $derived(code.split("\n").length);
15
+ let title = $state("Copy");
16
+ let open = $state(false);
17
+ let btnIcon = $state(Copy);
18
+ let el = $state(null);
19
+ let scrollTop = $state(0);
20
+ let scrollLeft = $state(0);
21
+ function copy() {
22
+ if (!el)
23
+ return;
24
+ if (navigator.clipboard) {
25
+ navigator.clipboard.writeText(code);
26
+ } else {
27
+ el.focus();
28
+ el.select();
29
+ document.execCommand("copy");
30
+ }
31
+ btnIcon = Done;
32
+ title = "Copied!";
33
+ open = true;
34
+ setTimeout(() => {
35
+ btnIcon = Copy;
36
+ title = "Copy";
37
+ open = false;
38
+ }, 1500);
39
+ }
40
+ function onscroll(e) {
41
+ scrollTop = e.target.scrollTop;
42
+ scrollLeft = e.target.scrollLeft;
43
+ }
44
+ let codeLines = $derived.by(() => {
45
+ return (highlight ? highlight(code) : code).split("\n") || [];
46
+ });
47
+ </script>
48
+
49
+ <div class="Code" class:lineNumbers class:singleLine={numberOfLines === 1} class:rounded class:copyable class:contained class:hasOverlay={highlight}>
50
+ {#if numberOfLines === 1}
51
+ <input class="CodeInput" spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" {readonly} bind:this={el} bind:value={code} title={copyable ? code : undefined} {onscroll} />
52
+ {:else}
53
+ <textarea class="CodeInput" spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" {readonly} bind:this={el} bind:value={code} {onscroll}></textarea>
54
+ {/if}
55
+ <div class="Overlay" tabindex="-1" aria-hidden="true" style="top: {-scrollTop}px; left: {-scrollLeft}px;">
56
+ {#each codeLines as line, index}
57
+ <div class="Line">
58
+ {#if lineNumbers}
59
+ <div class="Number">
60
+ <span>{index + 1}</span>
61
+ </div>
62
+ {/if}
63
+ <div class="Content">
64
+ {@html line}
65
+ </div>
66
+ </div>
67
+ {/each}
68
+ </div>
69
+ {#if copyable}
70
+ <Tooltip tip={title} {open}>
71
+ <IconButton icon={btnIcon} onclick={copy} disabled={open} />
72
+ </Tooltip>
73
+ {/if}
74
+ </div>
75
+
76
+ <style>
77
+ .Code {
78
+ display: grid;
79
+ align-items: start;
80
+ grid-template-areas: "content";
81
+ }
82
+ .Code.lineNumbers {
83
+ grid-template-columns: auto 1fr;
84
+ grid-template-areas: "lines content";
85
+ margin-inline-start: -2rem;
86
+ width: calc(100% + 2rem);
87
+ }
88
+ .CodeInput,
89
+ .Overlay {
90
+ font-family: var(--font-family-mono);
91
+ font-size: var(--font-size, 1em);
92
+ line-height: 1.5;
93
+ margin: 0;
94
+ border: 0;
95
+ grid-area: content;
96
+ background: var(--field-bg);
97
+ }
98
+ textarea {
99
+ width: 100%;
100
+ height: 100%;
101
+ white-space: pre-wrap;
102
+ word-break: normal;
103
+ overflow-wrap: anywhere;
104
+ direction: ltr;
105
+ writing-mode: lr;
106
+ resize: none;
107
+ z-index: -1;
108
+ }
109
+ .Code.lineNumbers textarea {
110
+ padding-inline-start: 2rem;
111
+ width: calc(100% - 2rem);
112
+ }
113
+ .Code.hasOverlay .CodeInput {
114
+ color: transparent;
115
+ caret-color: var(--text);
116
+ }
117
+ .Code.rounded,
118
+ .Code.rounded .CodeInput {
119
+ border-radius: var(--border-radius);
120
+ }
121
+ .Code.singleLine.copyable .CodeInput {
122
+ border-top-right-radius: 0;
123
+ border-bottom-right-radius: 0;
124
+ }
125
+
126
+ /**
127
+ * Contained
128
+ */
129
+
130
+ .Code.contained {
131
+ border: var(--border);
132
+ }
133
+ .Code.contained .CodeInput,
134
+ .Code.contained .Overlay {
135
+ height: auto;
136
+ min-height: auto;
137
+ padding: var(--padding, 0.5rem 1rem);
138
+ }
139
+ .Code.contained:focus-within {
140
+ outline: var(--focus-outline);
141
+ }
142
+ .Code.contained:focus-within .CodeInput {
143
+ outline: none;
144
+ }
145
+ .Code.contained:focus-within:has(:focus:not(.CodeInput)) {
146
+ outline: none;
147
+ }
148
+
149
+ /**
150
+ * Single line
151
+ */
152
+
153
+ .Code.singleLine {
154
+ align-items: center;
155
+ overflow-inline: clip;
156
+ }
157
+ .Code.singleLine.copyable {
158
+ grid-template-columns: 1fr auto;
159
+ grid-template-areas: "content button";
160
+ }
161
+ .Code.singleLine.copyable .CodeInput,
162
+ .Code.singleLine.copyable .Overlay {
163
+ text-overflow: ellipsis;
164
+ white-space: nowrap;
165
+ padding: var(--padding, 0.35rem 0.75rem);
166
+ }
167
+ .Code.singleLine .CodeInput,
168
+ .Code.singleLine .Overlay {
169
+ resize: none;
170
+ line-height: 1;
171
+ }
172
+
173
+ .LineNumbers {
174
+ grid-area: lines;
175
+ display: grid;
176
+ padding-right: 0.5rem;
177
+ width: 2rem;
178
+ font-size: var(--font-size, 1em);
179
+ line-height: 1.5;
180
+ text-align: end;
181
+ justify-content: end;
182
+ font-family: var(--font-family-mono);
183
+ font-size: var(--font-size, 1em);
184
+ color: var(--text-subtle);
185
+ opacity: 0.75;
186
+ }
187
+ .Line {
188
+ display: grid;
189
+ grid-template-columns: 2rem 1fr;
190
+ }
191
+ .Line .Number {
192
+ text-align: end;
193
+ padding-inline-end: 0.5rem;
194
+ }
195
+ </style>
@@ -0,0 +1,29 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ /** The code to display. */
5
+ code: string;
6
+ /** A function to highlight parts of the code. */
7
+ highlight?: ((code: string) => string) | undefined;
8
+ /** Whether the code is copyable. */
9
+ copyable?: boolean | undefined;
10
+ /** Whether to contain the element in a box. */
11
+ contained?: boolean | undefined;
12
+ /** Whether to round the corners of the element. */
13
+ rounded?: boolean | undefined;
14
+ /** Whether to show line numbers. */
15
+ lineNumbers?: boolean | undefined;
16
+ /** Whether the code is readonly. */
17
+ readonly?: boolean | undefined;
18
+ };
19
+ events: {
20
+ [evt: string]: CustomEvent<any>;
21
+ };
22
+ slots: {};
23
+ };
24
+ export type CodeProps = typeof __propDef.props;
25
+ export type CodeEvents = typeof __propDef.events;
26
+ export type CodeSlots = typeof __propDef.slots;
27
+ export default class Code extends SvelteComponent<CodeProps, CodeEvents, CodeSlots> {
28
+ }
29
+ export {};
@@ -0,0 +1,23 @@
1
+ <script>import Tooltip from "./Tooltip.svelte";
2
+ import Help from "../Icons/Help.svelte";
3
+ import Icon from "./Icon.svelte";
4
+ let {
5
+ tip
6
+ } = $props();
7
+ </script>
8
+
9
+ <Tooltip {tip}>
10
+ <button onclick={(e) => e.preventDefault()}>
11
+ <Icon icon={Help} />
12
+ </button>
13
+ </Tooltip>
14
+
15
+ <style>
16
+ button {
17
+ border-radius: 50%;
18
+ }
19
+ button:focus,
20
+ button:active {
21
+ outline-offset: -3px;
22
+ }
23
+ </style>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { Snippet } from "svelte";
3
+ declare const __propDef: {
4
+ props: {
5
+ tip: string | Snippet;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type ContextTipProps = typeof __propDef.props;
13
+ export type ContextTipEvents = typeof __propDef.events;
14
+ export type ContextTipSlots = typeof __propDef.slots;
15
+ export default class ContextTip extends SvelteComponent<ContextTipProps, ContextTipEvents, ContextTipSlots> {
16
+ }
17
+ export {};
@@ -0,0 +1,49 @@
1
+ <script>let {
2
+ summary,
3
+ contained,
4
+ rounded,
5
+ open,
6
+ children
7
+ } = $props();
8
+ </script>
9
+
10
+ <details class:contained class:rounded bind:open>
11
+ <summary>
12
+ {#if typeof summary === 'string'}
13
+ <span>{summary}</span>
14
+ {:else}
15
+ {@render summary()}
16
+ {/if}
17
+ </summary>
18
+ <section>
19
+ {@render children()}
20
+ </section>
21
+ </details>
22
+
23
+ <style>
24
+ summary {
25
+ font-weight: 600;
26
+ font-size: var(--font-size, 1em);
27
+ cursor: pointer;
28
+ padding-block-end: 0.5rem;
29
+ }
30
+ details.rounded {
31
+ border-radius: var(--border-radius);
32
+ }
33
+ details.contained {
34
+ border: var(--border);
35
+ overflow: hidden;
36
+ }
37
+ details.contained[open] summary {
38
+ border-block-end: var(--border);
39
+ }
40
+ details.contained summary {
41
+ padding: var(--padding, 0.5em 1em);
42
+ background-color: var(--summary-bg, var(--bg-subtle));
43
+ }
44
+ details.contained section {
45
+ font-size: var(--font-size, 1em);
46
+ padding: var(--padding, 0.5em 1em);
47
+ background-color: var(--content-bg, transparent);
48
+ }
49
+ </style>
@@ -0,0 +1,26 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { Snippet } from "svelte";
3
+ declare const __propDef: {
4
+ props: {
5
+ /** The summary of the element. Can be a string or a snippet. */
6
+ summary: string | Snippet;
7
+ /** Contain the element in a box. */
8
+ contained?: boolean | undefined;
9
+ /** Round the corners of the element if contained. */
10
+ rounded?: boolean | undefined;
11
+ /** Whether the details are open. */
12
+ open?: boolean | undefined;
13
+ /** The content of the element. */
14
+ children: Snippet;
15
+ };
16
+ events: {
17
+ [evt: string]: CustomEvent<any>;
18
+ };
19
+ slots: {};
20
+ };
21
+ export type DetailsProps = typeof __propDef.props;
22
+ export type DetailsEvents = typeof __propDef.events;
23
+ export type DetailsSlots = typeof __propDef.slots;
24
+ export default class Details extends SvelteComponent<DetailsProps, DetailsEvents, DetailsSlots> {
25
+ }
26
+ export {};
@@ -0,0 +1,50 @@
1
+ <script>import { setContext } from "svelte";
2
+ let {
3
+ children,
4
+ pad = true,
5
+ center = false,
6
+ fullWidth = false,
7
+ contained = false
8
+ } = $props();
9
+ </script>
10
+
11
+ <section class="Hero" class:pad class:fullWidth class:center class:contained>
12
+ <main>
13
+ {@render children()}
14
+ </main>
15
+ </section>
16
+
17
+ <style>
18
+ .Hero {
19
+ background: var(--bg, var(--bg-subtle));
20
+ container-type: inline-size;
21
+ text-wrap: balance;
22
+ }
23
+ .Hero.contained main {
24
+ max-inline-size: var(--max-inline-size, 1560px);
25
+ }
26
+ /** Header areas where h1 is followed by h2 */
27
+ .Hero :global(h1:has(+ h2)) {
28
+ margin-block-end: 1rem;
29
+ }
30
+ .Hero :global(h1 + h2) {
31
+ color: var(--text-subtle);
32
+ margin-block-start: 0rem;
33
+ }
34
+ .Hero {
35
+ block-size: 100%;
36
+ margin-inline: 0;
37
+ }
38
+ .Hero.fullWidth {
39
+ inline-size: 100cqi;
40
+ margin-inline: calc(50% - 50cqi);
41
+ min-inline-size: 100%;
42
+ }
43
+ .Hero.center main {
44
+ margin-inline: auto;
45
+ }
46
+ .Hero.pad {
47
+ padding-block: var(--padding, var(--padding-block, 4rem));
48
+ padding-inline: var(--padding, var(--padding-inline, 4rem));
49
+ }
50
+ </style>
@@ -0,0 +1,25 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type Snippet } from "svelte";
3
+ declare const __propDef: {
4
+ props: {
5
+ children: Snippet;
6
+ /** Add padding to the container. Pass in either a boolean or an array of booleans to specify padding on the block and inline axes. */
7
+ pad?: string | boolean | [boolean, boolean] | [boolean, boolean, boolean] | [boolean, boolean, boolean, boolean] | [string, string] | [string, string, string] | [string, string, string, string] | undefined;
8
+ /** Center the content. */
9
+ center?: boolean | undefined;
10
+ /** Make the hero full width to the container (nearest element with `container-type: inline-size;`) */
11
+ fullWidth?: boolean | undefined;
12
+ /** Contain the hero to the container (nearest element with `container-type: inline-size;`) */
13
+ contained?: boolean | undefined;
14
+ };
15
+ events: {
16
+ [evt: string]: CustomEvent<any>;
17
+ };
18
+ slots: {};
19
+ };
20
+ export type HeroProps = typeof __propDef.props;
21
+ export type HeroEvents = typeof __propDef.events;
22
+ export type HeroSlots = typeof __propDef.slots;
23
+ export default class Hero extends SvelteComponent<HeroProps, HeroEvents, HeroSlots> {
24
+ }
25
+ export {};
@@ -0,0 +1,35 @@
1
+ <script>import { isComponent, isSnippet } from "../utils/isSnippet.js";
2
+ let {
3
+ icon,
4
+ alt
5
+ } = $props();
6
+ </script>
7
+
8
+ <span class="Icon" aria-label="icon">
9
+ {#if typeof icon === "string"}
10
+ <img src={icon} alt={alt ? alt : 'Icon'} width="100%" height="100%" />
11
+ {:else if isComponent(icon)}
12
+ <svelte:component this={icon} />
13
+ {:else if isSnippet(icon)}
14
+ {@render icon()}
15
+ {/if}
16
+ </span>
17
+
18
+ <style>
19
+ .Icon {
20
+ display: inline-flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: 1em;
24
+ width: var(--icon-width, var(--font-size, 1em));
25
+ height: var(--icon-height, var(--font-size, 1em));
26
+ overflow: clip;
27
+ vertical-align: var(--vertical-align, baseline);
28
+ cursor: var(--cursor, default);
29
+ }
30
+ .Icon :global(svg) {
31
+ width: 100%;
32
+ height: 100%;
33
+ display: inline-block;
34
+ }
35
+ </style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { ComponentType, Snippet } from "svelte";
3
+ declare const __propDef: {
4
+ props: {
5
+ icon: string | Snippet | ComponentType;
6
+ alt?: string | undefined;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type IconProps = typeof __propDef.props;
14
+ export type IconEvents = typeof __propDef.events;
15
+ export type IconSlots = typeof __propDef.slots;
16
+ export default class Icon extends SvelteComponent<IconProps, IconEvents, IconSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,85 @@
1
+ <script>import Icon from "./Icon.svelte";
2
+ import { fade, fly, slide } from "svelte/transition";
3
+ import { popBezier, popBezierInverse } from "../utils/transitions.js";
4
+ import { cubicIn, cubicOut } from "svelte/easing";
5
+ let {
6
+ icon,
7
+ hang,
8
+ disabled,
9
+ children,
10
+ onclick
11
+ } = $props();
12
+ </script>
13
+
14
+ {#snippet inside()}
15
+ <span class="IconMask">
16
+ {#key icon}
17
+ <span class="IconContent" in:fly={{ duration: 250, y: -32, easing: popBezier }} out:fly={{ duration: 250, y: 32, easing: popBezierInverse }}>
18
+ <Icon {icon} />
19
+ {#if children}
20
+ {@render children()}
21
+ {/if}
22
+ </span>
23
+ {/key}
24
+ </span>
25
+ {/snippet}
26
+
27
+ {#if onclick}
28
+ <button {disabled} class="IconButton" class:hang {onclick}>
29
+ {@render inside()}
30
+ </button>
31
+ {:else}
32
+ <span class="IconButton" class:hang>
33
+ {@render inside()}
34
+ </span>
35
+ {/if}
36
+
37
+ <style>
38
+ .IconButton {
39
+ display: inline-flex;
40
+ align-items: stretch;
41
+ color: inherit;
42
+ opacity: 1;
43
+ background-color: var(--field-bg);
44
+ transition: background-color 0.1s;
45
+ }
46
+ .IconButton:active {
47
+ scale: 1;
48
+ }
49
+ .IconButton.hang {
50
+ margin-inline-start: calc(-1 * var(--padding, 0.75rem));
51
+ }
52
+ button.IconButton {
53
+ border: none;
54
+ background: none;
55
+ cursor: pointer;
56
+ color: var(--text);
57
+ }
58
+ .IconMask {
59
+ height: 100%;
60
+ padding-inline: var(--padding, 0.75em);
61
+ padding-block: var(--padding, 0.75em);
62
+ display: inline-grid;
63
+ gap: 0.5rem;
64
+ grid-template: "icon";
65
+ align-items: center;
66
+ -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 35%, rgba(0, 0, 0, 1) 65%, rgba(0, 0, 0, 0));
67
+ mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 35%, rgba(0, 0, 0, 1) 65%, rgba(0, 0, 0, 0));
68
+ }
69
+ .IconContent {
70
+ grid-area: icon;
71
+ display: inline-flex;
72
+ }
73
+ @media(max-width: 640px) {
74
+ .IconMask {
75
+ padding-inline: calc(var(--padding, 0.75em) * 0.75);
76
+ padding-block: calc(var(--padding, 0.75em) * 0.75);
77
+ }
78
+ }
79
+ @media(max-width: 320px) {
80
+ .IconMask {
81
+ padding-inline: calc(var(--padding, 0.75em) * 0.6);
82
+ padding-block: calc(var(--padding, 0.75em) * 0.6);
83
+ }
84
+ }
85
+ </style>
@@ -0,0 +1,28 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { ComponentType } from "svelte";
3
+ declare const __propDef: {
4
+ props: {
5
+ /** The icon to display. */
6
+ icon: string | ComponentType;
7
+ /** Whether the button should hang to the inline start to line up with other elements. The amount of hanging is the same as the padding. */
8
+ hang?: boolean | undefined;
9
+ /** The children to display. */
10
+ children?: ((this: void) => typeof import("svelte").SnippetReturn & {
11
+ _: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
12
+ }) | undefined;
13
+ /** The onclick event. */
14
+ onclick?: ((event: MouseEvent) => void) | undefined;
15
+ /** Whether the button is disabled. */
16
+ disabled?: boolean | undefined;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export type IconButtonProps = typeof __propDef.props;
24
+ export type IconButtonEvents = typeof __propDef.events;
25
+ export type IconButtonSlots = typeof __propDef.slots;
26
+ export default class IconButton extends SvelteComponent<IconButtonProps, IconButtonEvents, IconButtonSlots> {
27
+ }
28
+ export {};