reburn-ui 0.4.4 → 0.4.5

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 (47) hide show
  1. package/dist/adapter/adapter-bun/adapter.js +2 -2
  2. package/dist/adapter/adapter-bun/index.d.ts +6 -0
  3. package/dist/core/CodeHighlight/CodeHighlight.context.svelte.d.ts +13 -0
  4. package/dist/core/CodeHighlight/CodeHighlight.context.svelte.js +13 -0
  5. package/dist/core/CodeHighlight/CodeHighlight.svelte +196 -0
  6. package/dist/core/CodeHighlight/CodeHighlight.svelte.d.ts +48 -0
  7. package/dist/core/CodeHighlight/CodeHighlightAdapterProvider.context.svelte.d.ts +17 -0
  8. package/dist/core/CodeHighlight/CodeHighlightAdapterProvider.context.svelte.js +20 -0
  9. package/dist/core/CodeHighlight/CodeHighlightControl.svelte +37 -0
  10. package/dist/core/CodeHighlight/CodeHighlightControl.svelte.d.ts +11 -0
  11. package/dist/core/CodeHighlight/CopyCodeButton/CopyCodeButton.svelte +23 -0
  12. package/dist/core/CodeHighlight/CopyCodeButton/CopyCodeButton.svelte.d.ts +8 -0
  13. package/dist/core/CodeHighlight/CopyCodeButton/CopyIcon.svelte +31 -0
  14. package/dist/core/CodeHighlight/CopyCodeButton/CopyIcon.svelte.d.ts +8 -0
  15. package/dist/core/CodeHighlight/ExpandCodeButton/ExpandCodeButton.svelte +23 -0
  16. package/dist/core/CodeHighlight/ExpandCodeButton/ExpandCodeButton.svelte.d.ts +9 -0
  17. package/dist/core/CodeHighlight/ExpandCodeButton/ExpandIcon.svelte +32 -0
  18. package/dist/core/CodeHighlight/ExpandCodeButton/ExpandIcon.svelte.d.ts +8 -0
  19. package/dist/core/CodeHighlight/code-highlight.css +93 -0
  20. package/dist/core/CodeHighlight/index.d.ts +2 -0
  21. package/dist/core/CodeHighlight/index.js +2 -0
  22. package/dist/core/Notifications/NotificationContainer.svelte +2 -2
  23. package/dist/core/Notifications/Notifications.svelte +2 -2
  24. package/dist/core/charts/ChartRoot/ChartRoot.svelte +3 -3
  25. package/dist/core/charts/ChartRoot/ChartRoot.svelte.d.ts +5 -5
  26. package/dist/core/charts/ChartRoot/ChartXGrid.svelte +2 -2
  27. package/dist/core/charts/ChartRoot/ChartXLabels.svelte +3 -3
  28. package/dist/core/charts/ChartRoot/ChartYGrid.svelte +2 -2
  29. package/dist/core/charts/ChartRoot/ChartYLabels.svelte +3 -3
  30. package/dist/core/charts/ChartTooltip/ChartTooltip.svelte +45 -47
  31. package/dist/core/charts/LineChart/LineChart.svelte +1 -1
  32. package/dist/core/charts/LineChart/LineChartInner.svelte +1 -1
  33. package/dist/core/charts/ScatterChart/ScatterChartInner.svelte +1 -1
  34. package/dist/core/components/ColorPicker/ColorSlider.svelte +0 -1
  35. package/dist/core/components/Floating/CreateFloating.svelte.d.ts +0 -1
  36. package/dist/core/components/Floating/CreateFloating.svelte.js +4 -4
  37. package/dist/core/components/Pill/Pill.svelte +3 -1
  38. package/dist/core/components/Tooltip/Tooltip.svelte +3 -5
  39. package/dist/core/index.d.ts +1 -0
  40. package/dist/core/index.js +1 -0
  41. package/dist/docs/UsageDemo.svelte +113 -0
  42. package/dist/docs/UsageDemo.svelte.d.ts +41 -0
  43. package/dist/styles/_mixins.scss +1 -1
  44. package/dist/styles/_variables.scss +145 -5
  45. package/package.json +34 -25
  46. package/dist/tools/icon-vite-plugin/icon-vite-plugin.d.ts +0 -10
  47. package/dist/tools/icon-vite-plugin/icon-vite-plugin.js +0 -407
@@ -2,7 +2,7 @@ import { writeFileSync } from 'node:fs';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  const files = fileURLToPath(new URL('./files', import.meta.url).href);
4
4
  export default function (opts = {}) {
5
- const { out = 'build', precompress = false, envPrefix = '' } = opts;
5
+ const { out = 'build', precompress = false, envPrefix = '', sourceMap = false } = opts;
6
6
  return {
7
7
  name: 'svelte-adapter-bun',
8
8
  async adapt(builder) {
@@ -32,7 +32,7 @@ export default function (opts = {}) {
32
32
  entrypoints: [`${tmp}/index.js`, `${tmp}/manifest.js`],
33
33
  format: 'esm',
34
34
  target: 'bun',
35
- sourcemap: 'inline',
35
+ sourcemap: sourceMap,
36
36
  outdir: `${out}/server`,
37
37
  splitting: true,
38
38
  naming: {
@@ -25,6 +25,12 @@ export interface AdapterOptions {
25
25
  * @default ''
26
26
  */
27
27
  envPrefix?: string;
28
+
29
+ /**
30
+ * Enables source mapping for the server. It defaults to false.
31
+ * @default false
32
+ */
33
+ sourceMap?: boolean | 'inline' | 'external' | 'none' | 'linked';
28
34
  }
29
35
 
30
36
  export default function plugin(options?: AdapterOptions): Adapter;
@@ -0,0 +1,13 @@
1
+ import { type Getter } from '../context/extract.js';
2
+ import type { CodeHighlightSettings } from './CodeHighlight.svelte';
3
+ export declare const CODE_HIGHLIGHT_CONTEXT_KEY: unique symbol;
4
+ interface CodeHighlightContextProps {
5
+ codeColorScheme: Getter<CodeHighlightSettings['codeColorScheme']>;
6
+ }
7
+ export declare class CodeHighlightContext {
8
+ #private;
9
+ codeColorScheme: "dark" | "light" | undefined;
10
+ constructor(props: CodeHighlightContextProps);
11
+ }
12
+ export declare function getCodeHighlightContext(): CodeHighlightContext;
13
+ export {};
@@ -0,0 +1,13 @@
1
+ import { getContext } from 'svelte';
2
+ import { extract } from '../context/extract.js';
3
+ export const CODE_HIGHLIGHT_CONTEXT_KEY = Symbol();
4
+ export class CodeHighlightContext {
5
+ #props;
6
+ codeColorScheme = $derived(extract(this.#props.codeColorScheme));
7
+ constructor(props) {
8
+ this.#props = props;
9
+ }
10
+ }
11
+ export function getCodeHighlightContext() {
12
+ return getContext(CODE_HIGHLIGHT_CONTEXT_KEY);
13
+ }
@@ -0,0 +1,196 @@
1
+ <script lang="ts" module>
2
+ import { type Snippet } from 'svelte';
3
+ import type { DivElement } from '../element-types.js';
4
+ import type { MantineColor, MantineRadius } from '../MantineProvider/theme.types.js';
5
+
6
+ export interface CodeHighlightSettings {
7
+ /** Label for copy button in default state, `'Copy'` by default */
8
+ copyLabel?: string;
9
+
10
+ /** Label for copy button in copied state, `'Copied'` by default */
11
+ copiedLabel?: string;
12
+
13
+ /** Uncontrolled expanded default state */
14
+ defaultExpanded?: boolean;
15
+
16
+ /** Controlled expanded state */
17
+ expanded?: boolean;
18
+
19
+ /** Called when expanded state changes */
20
+ onExpandedChange?: (expanded: boolean) => void;
21
+
22
+ /** Max height of collapsed state, `180px` by default */
23
+ maxCollapsedHeight?: number | string;
24
+
25
+ /** Determines whether the copy button should be displayed, `true` by default */
26
+ withCopyButton?: boolean;
27
+
28
+ /** Determines whether the expand/collapse button should be displayed, `false` by default */
29
+ withExpandButton?: boolean;
30
+
31
+ /** Label for expand button, `'Expand code'` by default */
32
+ expandCodeLabel?: string;
33
+
34
+ /** Label for collapse button, `'Collapse code'` by default */
35
+ collapseCodeLabel?: string;
36
+
37
+ /** Controls background color of the code. By default, the value depends on color scheme. */
38
+ background?: MantineColor;
39
+
40
+ /** Key of `theme.radius` or any valid CSS value to set border-radius, `0` by default */
41
+ radius?: MantineRadius;
42
+
43
+ /** Determines whether the code block should have a border, `false` by default */
44
+ withBorder?: boolean;
45
+
46
+ /** Extra controls to display in the controls list */
47
+ controls?: Snippet[];
48
+
49
+ /** Set to change contrast of controls and other elements if you prefer to use dark code color scheme in light mode or light code color scheme in dark mode */
50
+ codeColorScheme?: 'dark' | 'light';
51
+ }
52
+
53
+ export interface CodeHighlightProps extends CodeHighlightSettings, DivElement {
54
+ __withOffset?: boolean;
55
+ __staticSelector?: string;
56
+
57
+ /** If set, the code will be rendered as inline element without `<pre>`, `false` by default */
58
+ __inline?: boolean;
59
+
60
+ /** Code to highlight */
61
+ code: string;
62
+
63
+ /** Language of the code, used for syntax highlighting */
64
+ language?: string;
65
+ }
66
+ </script>
67
+
68
+ <script lang="ts">
69
+ import { setContext } from 'svelte';
70
+ import ScrollArea from '../components/ScrollArea/ScrollArea.svelte';
71
+ import { CODE_HIGHLIGHT_CONTEXT_KEY, CodeHighlightContext } from './CodeHighlight.context.svelte.js';
72
+ import { useHighlight } from './CodeHighlightAdapterProvider.context.svelte.js';
73
+ import CopyCodeButton from './CopyCodeButton/CopyCodeButton.svelte';
74
+ import ExpandCodeButton from './ExpandCodeButton/ExpandCodeButton.svelte';
75
+
76
+ let {
77
+ code,
78
+ codeColorScheme,
79
+ collapseCodeLabel,
80
+ controls,
81
+ copiedLabel,
82
+ copyLabel,
83
+ defaultExpanded = false,
84
+ expandCodeLabel = 'Expand code',
85
+ expanded = $bindable(defaultExpanded),
86
+ onExpandedChange,
87
+ withBorder,
88
+ withCopyButton = true,
89
+ withExpandButton,
90
+ language,
91
+ __withOffset,
92
+ __inline,
93
+ }: CodeHighlightProps = $props();
94
+
95
+ const context = new CodeHighlightContext({ codeColorScheme: () => codeColorScheme });
96
+
97
+ setContext(CODE_HIGHLIGHT_CONTEXT_KEY, context);
98
+
99
+ const shouldDisplayControls = $derived((controls && controls.length > 0) || withExpandButton || withCopyButton);
100
+
101
+ function handleExpand(value: boolean) {
102
+ expanded = value;
103
+ onExpandedChange?.(value);
104
+ }
105
+
106
+ const highlight = useHighlight();
107
+
108
+ const highlightedCode = $derived(highlight(code.trim(), { language: language ?? 'text' }).value);
109
+ </script>
110
+
111
+ {#if __inline}
112
+ <code class="code-highlight">
113
+ {@html highlightedCode}
114
+ </code>
115
+ {:else}
116
+ <div class="code-highlight" data-code-color-scheme={codeColorScheme || undefined} data-with-border={withBorder || undefined}>
117
+ {#if shouldDisplayControls}
118
+ <div class="controls" data-with-offset={__withOffset || undefined}>
119
+ {controls}
120
+
121
+ {#if withExpandButton}
122
+ <ExpandCodeButton {expanded} onExpand={handleExpand} {expandCodeLabel} {collapseCodeLabel} />
123
+ {/if}
124
+ {#if withCopyButton}
125
+ <CopyCodeButton {code} {copiedLabel} {copyLabel} />
126
+ {/if}
127
+ </div>
128
+ {/if}
129
+
130
+ <ScrollArea type="hover" scrollbarSize={4} dir="ltr" offsetScrollbars={false} data-collapsed={!expanded || undefined} class="scrollarea">
131
+ <pre class="pre" data-with-offset={__withOffset || undefined}><code class="code">{@html highlightedCode}</code>
132
+ </pre>
133
+ </ScrollArea>
134
+ </div>
135
+ {/if}
136
+
137
+ <style>.code-highlight {
138
+ position: relative;
139
+ border-radius: var(--ch-radius, 0px);
140
+ overflow: hidden;
141
+ }
142
+ :global(:where([data-mantine-color-scheme="light"])) .code-highlight:where([data-with-border]) {
143
+ border: 1px solid var(--mantine-color-gray-2);
144
+ }
145
+ :global(:where([data-mantine-color-scheme="dark"])) .code-highlight:where([data-with-border]) {
146
+ border: 1px solid var(--mantine-color-dark-6);
147
+ }
148
+ .code-highlight:where([data-with-border]):where([data-code-color-scheme=dark]) {
149
+ border: 1px solid var(--mantine-color-dark-6);
150
+ }
151
+ .code-highlight:where([data-with-border]):where([data-code-color-scheme=light]) {
152
+ border: 1px solid var(--mantine-color-gray-2);
153
+ }
154
+ :global(:where([data-mantine-color-scheme="light"])) .code-highlight {
155
+ --ch-background: var(--mantine-color-gray-0);
156
+ }
157
+ :global(:where([data-mantine-color-scheme="dark"])) .code-highlight {
158
+ --ch-background: var(--mantine-color-dark-8);
159
+ }
160
+
161
+ .pre {
162
+ --code-line-height: 1.7;
163
+ display: block;
164
+ margin: 0;
165
+ }
166
+ .pre[data-with-offset] .code {
167
+ padding-top: calc(3.125rem * var(--mantine-scale));
168
+ }
169
+
170
+ .code {
171
+ display: block;
172
+ padding: var(--mantine-spacing-xs) var(--mantine-spacing-md);
173
+ background-color: var(--ch-background);
174
+ font-size: calc(0.8125rem * var(--mantine-scale));
175
+ line-height: var(--code-line-height, var(--mantine-line-height));
176
+ font-family: var(--mantine-font-family-monospace);
177
+ width: fit-content;
178
+ min-width: 100%;
179
+ }
180
+ .code:where([data-inline]) {
181
+ display: inline-block;
182
+ padding: calc(0.1875rem * var(--mantine-scale)) calc(0.3125rem * var(--mantine-scale));
183
+ background-color: var(--ch-background);
184
+ }
185
+
186
+ .controls {
187
+ position: absolute;
188
+ top: calc(0.5rem * var(--mantine-scale));
189
+ right: calc(0.5rem * var(--mantine-scale));
190
+ z-index: 1;
191
+ background-color: var(--ch-background);
192
+ border-bottom-left-radius: var(--mantine-radius-md);
193
+ }
194
+ .controls:where([data-with-offset]) {
195
+ top: calc(0.75rem * var(--mantine-scale));
196
+ }</style>
@@ -0,0 +1,48 @@
1
+ import { type Snippet } from 'svelte';
2
+ import type { DivElement } from '../element-types.js';
3
+ import type { MantineColor, MantineRadius } from '../MantineProvider/theme.types.js';
4
+ export interface CodeHighlightSettings {
5
+ /** Label for copy button in default state, `'Copy'` by default */
6
+ copyLabel?: string;
7
+ /** Label for copy button in copied state, `'Copied'` by default */
8
+ copiedLabel?: string;
9
+ /** Uncontrolled expanded default state */
10
+ defaultExpanded?: boolean;
11
+ /** Controlled expanded state */
12
+ expanded?: boolean;
13
+ /** Called when expanded state changes */
14
+ onExpandedChange?: (expanded: boolean) => void;
15
+ /** Max height of collapsed state, `180px` by default */
16
+ maxCollapsedHeight?: number | string;
17
+ /** Determines whether the copy button should be displayed, `true` by default */
18
+ withCopyButton?: boolean;
19
+ /** Determines whether the expand/collapse button should be displayed, `false` by default */
20
+ withExpandButton?: boolean;
21
+ /** Label for expand button, `'Expand code'` by default */
22
+ expandCodeLabel?: string;
23
+ /** Label for collapse button, `'Collapse code'` by default */
24
+ collapseCodeLabel?: string;
25
+ /** Controls background color of the code. By default, the value depends on color scheme. */
26
+ background?: MantineColor;
27
+ /** Key of `theme.radius` or any valid CSS value to set border-radius, `0` by default */
28
+ radius?: MantineRadius;
29
+ /** Determines whether the code block should have a border, `false` by default */
30
+ withBorder?: boolean;
31
+ /** Extra controls to display in the controls list */
32
+ controls?: Snippet[];
33
+ /** Set to change contrast of controls and other elements if you prefer to use dark code color scheme in light mode or light code color scheme in dark mode */
34
+ codeColorScheme?: 'dark' | 'light';
35
+ }
36
+ export interface CodeHighlightProps extends CodeHighlightSettings, DivElement {
37
+ __withOffset?: boolean;
38
+ __staticSelector?: string;
39
+ /** If set, the code will be rendered as inline element without `<pre>`, `false` by default */
40
+ __inline?: boolean;
41
+ /** Code to highlight */
42
+ code: string;
43
+ /** Language of the code, used for syntax highlighting */
44
+ language?: string;
45
+ }
46
+ declare const CodeHighlight: import("svelte").Component<CodeHighlightProps, {}, "expanded">;
47
+ type CodeHighlight = ReturnType<typeof CodeHighlight>;
48
+ export default CodeHighlight;
@@ -0,0 +1,17 @@
1
+ import type { LanguageFn } from 'highlight.js';
2
+ import hljs from 'highlight.js/lib/core';
3
+ interface Language {
4
+ name: string;
5
+ language: LanguageFn;
6
+ }
7
+ interface CodeHighlightAdapterProviderContextProps {
8
+ languages: Language[];
9
+ }
10
+ export declare class CodeHighlightAdapterProviderContext {
11
+ #private;
12
+ highlighter: typeof hljs.highlight;
13
+ languages: Language[];
14
+ constructor(props: CodeHighlightAdapterProviderContextProps);
15
+ }
16
+ export declare function useHighlight(): any;
17
+ export {};
@@ -0,0 +1,20 @@
1
+ import hljs from 'highlight.js/lib/core';
2
+ import { getContext, setContext } from 'svelte';
3
+ export class CodeHighlightAdapterProviderContext {
4
+ #props;
5
+ highlighter = $state(hljs.highlight);
6
+ languages = $derived(this.#props.languages);
7
+ constructor(props) {
8
+ this.#props = props;
9
+ for (let i = 0; i < this.languages.length; i++) {
10
+ hljs.registerLanguage(this.languages[i].name, this.languages[i].language);
11
+ }
12
+ this.highlighter = hljs.highlight;
13
+ setContext(CODE_HIGHLIGHT_ADAPTER_PROVIDER_CONTEXT_KEY, this);
14
+ }
15
+ }
16
+ const CODE_HIGHLIGHT_ADAPTER_PROVIDER_CONTEXT_KEY = Symbol();
17
+ export function useHighlight() {
18
+ const ctx = getContext(CODE_HIGHLIGHT_ADAPTER_PROVIDER_CONTEXT_KEY);
19
+ return ctx.highlighter;
20
+ }
@@ -0,0 +1,37 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from 'svelte';
3
+ import ActionIcon, { type ActionIconProps } from '../components/ActionIcon/ActionIcon.svelte';
4
+ import { getCodeHighlightContext } from './CodeHighlight.context.svelte.js';
5
+
6
+ export interface CodeHighlightControlProps extends ActionIconProps {
7
+ /** Control icon */
8
+ children?: Snippet;
9
+
10
+ /** Label displayed in the tooltip when the control is hovered */
11
+ tooltipLabel?: string;
12
+ }
13
+ </script>
14
+
15
+ <script lang="ts">
16
+ import Tooltip from '../components/Tooltip/Tooltip.svelte';
17
+
18
+ let { children, tooltipLabel, ...props }: CodeHighlightControlProps = $props();
19
+
20
+ const ctx = getCodeHighlightContext();
21
+ </script>
22
+
23
+ {#snippet control(tooltipProps?: Record<string, unknown>)}
24
+ <ActionIcon {...props} {...tooltipProps} variant="transparent" data-code-color-scheme={ctx.codeColorScheme} size="xs">
25
+ {@render children?.()}
26
+ </ActionIcon>
27
+ {/snippet}
28
+
29
+ {#if tooltipLabel}
30
+ <Tooltip label={tooltipLabel} transitionProps={{ transition: 'fade', options: { duration: 0 } }}>
31
+ {#snippet children(tooltipProps)}
32
+ {@render control(tooltipProps)}
33
+ {/snippet}
34
+ </Tooltip>
35
+ {:else}
36
+ {@render control()}
37
+ {/if}
@@ -0,0 +1,11 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { type ActionIconProps } from '../components/ActionIcon/ActionIcon.svelte';
3
+ export interface CodeHighlightControlProps extends ActionIconProps {
4
+ /** Control icon */
5
+ children?: Snippet;
6
+ /** Label displayed in the tooltip when the control is hovered */
7
+ tooltipLabel?: string;
8
+ }
9
+ declare const CodeHighlightControl: import("svelte").Component<CodeHighlightControlProps, {}, "">;
10
+ type CodeHighlightControl = ReturnType<typeof CodeHighlightControl>;
11
+ export default CodeHighlightControl;
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { Clipboard } from '../../hooks/use-clipboard.svelte.js';
3
+ import CodeHighlightControl from '../CodeHighlightControl.svelte';
4
+ import CopyIcon from './CopyIcon.svelte';
5
+
6
+ interface CopyCodeButtonProps {
7
+ code: string;
8
+ copiedLabel?: string;
9
+ copyLabel?: string;
10
+ }
11
+
12
+ let { code, copiedLabel = 'Copied', copyLabel = 'Copy' }: CopyCodeButtonProps = $props();
13
+
14
+ const clipboard = new Clipboard();
15
+
16
+ function handleClick() {
17
+ clipboard.copy(code.trim());
18
+ }
19
+ </script>
20
+
21
+ <CodeHighlightControl onclick={handleClick} variant="transparent" tooltipLabel={clipboard.copied ? copiedLabel : copyLabel}>
22
+ <CopyIcon copied={clipboard.copied} />
23
+ </CodeHighlightControl>
@@ -0,0 +1,8 @@
1
+ interface CopyCodeButtonProps {
2
+ code: string;
3
+ copiedLabel?: string;
4
+ copyLabel?: string;
5
+ }
6
+ declare const CopyCodeButton: import("svelte").Component<CopyCodeButtonProps, {}, "">;
7
+ type CopyCodeButton = ReturnType<typeof CopyCodeButton>;
8
+ export default CopyCodeButton;
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ import type { SvelteHTMLElements } from 'svelte/elements';
3
+
4
+ type SVGProps = SvelteHTMLElements['svg'];
5
+
6
+ interface CopyIconProps extends SVGProps {
7
+ copied: boolean;
8
+ }
9
+
10
+ let { copied, ...props }: CopyIconProps = $props();
11
+ </script>
12
+
13
+ <svg
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ width="100%"
16
+ height="100%"
17
+ fill="none"
18
+ stroke="currentColor"
19
+ stroke-width="2"
20
+ stroke-linecap="round"
21
+ stroke-linejoin="round"
22
+ viewBox="0 0 24 24"
23
+ {...props}
24
+ >
25
+ {#if copied}
26
+ <path d="M5 12l5 5L20 7" />
27
+ {:else}
28
+ <path d="M7 9.667A2.667 2.667 0 019.667 7h8.666A2.667 2.667 0 0121 9.667v8.666A2.667 2.667 0 0118.333 21H9.667A2.667 2.667 0 017 18.333z" />
29
+ <path d="M4.012 16.737A2.005 2.005 0 013 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1" />
30
+ {/if}
31
+ </svg>
@@ -0,0 +1,8 @@
1
+ import type { SvelteHTMLElements } from 'svelte/elements';
2
+ type SVGProps = SvelteHTMLElements['svg'];
3
+ interface CopyIconProps extends SVGProps {
4
+ copied: boolean;
5
+ }
6
+ declare const CopyIcon: import("svelte").Component<CopyIconProps, {}, "">;
7
+ type CopyIcon = ReturnType<typeof CopyIcon>;
8
+ export default CopyIcon;
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import CodeHighlightControl from '../CodeHighlightControl.svelte';
3
+ import ExpandIcon from './ExpandIcon.svelte';
4
+
5
+ interface ExpandCodeButtonProps {
6
+ expanded: boolean;
7
+ onExpand: (value: boolean) => void;
8
+ collapseCodeLabel?: string;
9
+ expandCodeLabel?: string;
10
+ }
11
+
12
+ let { expanded, onExpand, collapseCodeLabel = 'Collapse code', expandCodeLabel = 'Expand code' }: ExpandCodeButtonProps = $props();
13
+
14
+ function handleClick() {
15
+ onExpand(!expanded);
16
+ }
17
+ </script>
18
+
19
+ <CodeHighlightControl onclick={handleClick} tooltipLabel={expanded ? collapseCodeLabel : expandCodeLabel}>
20
+ <ExpandIcon {expanded} />
21
+ </CodeHighlightControl>
22
+
23
+ <style></style>
@@ -0,0 +1,9 @@
1
+ interface ExpandCodeButtonProps {
2
+ expanded: boolean;
3
+ onExpand: (value: boolean) => void;
4
+ collapseCodeLabel?: string;
5
+ expandCodeLabel?: string;
6
+ }
7
+ declare const ExpandCodeButton: import("svelte").Component<ExpandCodeButtonProps, {}, "">;
8
+ type ExpandCodeButton = ReturnType<typeof ExpandCodeButton>;
9
+ export default ExpandCodeButton;
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import type { SvelteHTMLElements } from 'svelte/elements';
3
+
4
+ type SVGProps = SvelteHTMLElements['svg'];
5
+
6
+ interface ExpandIconProps extends SVGProps {
7
+ expanded: boolean;
8
+ }
9
+
10
+ let { expanded, ...props }: ExpandIconProps = $props();
11
+ </script>
12
+
13
+ <svg
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ width="100%"
16
+ height="100%"
17
+ fill="none"
18
+ stroke="currentColor"
19
+ stroke-width="2"
20
+ stroke-linecap="round"
21
+ stroke-linejoin="round"
22
+ viewBox="0 0 24 24"
23
+ {...props}
24
+ >
25
+ {#if expanded}
26
+ <path d="M12 13V5L9 8m6 0l-3-3M9 17h1M14 17h1M19 17h1M4 17h1" />
27
+ {:else}
28
+ <path d="M12 11v8l3-3m-6 0l3 3M9 7h1M14 7h1M19 7h1M4 7h1" />
29
+ {/if}
30
+ </svg>
31
+
32
+ <style></style>
@@ -0,0 +1,8 @@
1
+ import type { SvelteHTMLElements } from 'svelte/elements';
2
+ type SVGProps = SvelteHTMLElements['svg'];
3
+ interface ExpandIconProps extends SVGProps {
4
+ expanded: boolean;
5
+ }
6
+ declare const ExpandIcon: import("svelte").Component<ExpandIconProps, {}, "">;
7
+ type ExpandIcon = ReturnType<typeof ExpandIcon>;
8
+ export default ExpandIcon;
@@ -0,0 +1,93 @@
1
+ .hljs {
2
+ background: #f3f3f3;
3
+ color: #444;
4
+ }
5
+ /* .hljs-subst {} */
6
+
7
+ .hljs-formula,
8
+ .hljs-attr,
9
+ .hljs-property,
10
+ .hljs-params {
11
+ color: var(--mantine-color-orange-5);
12
+ }
13
+
14
+ .hljs-comment {
15
+ color: var(--mantine-color-gray-6);
16
+ }
17
+ .hljs-tag,
18
+ .hljs-punctuation {
19
+ color: var(--mantine-color-gray-5);
20
+ }
21
+
22
+ /* .hljs-tag .hljs-name,
23
+ .hljs-tag .hljs-attr {
24
+ color: var(--mantine-color-red-5);
25
+ } */
26
+
27
+ .hljs-tag .hljs-name {
28
+ color: var(--mantine-color-red-5);
29
+ }
30
+
31
+ .hljs-tag .hljs-attr {
32
+ color: var(--mantine-color-yellow-5);
33
+ }
34
+
35
+ .hljs-keyword,
36
+ .hljs-attribute,
37
+ .hljs-selector-tag,
38
+ .hljs-meta .hljs-keyword,
39
+ .hljs-doctag,
40
+ .hljs-name {
41
+ color: var(--mantine-color-grape-5);
42
+ }
43
+
44
+ .hljs-type,
45
+ .hljs-string,
46
+ .hljs-number,
47
+ .hljs-selector-id,
48
+ .hljs-selector-class,
49
+ .hljs-quote,
50
+ .hljs-template-tag,
51
+ .hljs-deletion {
52
+ color: var(--mantine-color-green-5);
53
+ }
54
+ .hljs-title,
55
+ .hljs-section {
56
+ color: var(--mantine-color-yellow-5);
57
+ }
58
+ .hljs-regexp,
59
+ .hljs-symbol,
60
+ .hljs-variable,
61
+ .hljs-template-variable,
62
+ .hljs-link,
63
+ .hljs-selector-attr,
64
+ .hljs-operator,
65
+ .hljs-selector-pseudo {
66
+ color: var(--mantine-color-green-5);
67
+ }
68
+ /* Language color: hue: 90; */
69
+ .hljs-literal {
70
+ color: var(--mantine-color-cyan-5);
71
+ }
72
+ .hljs-built_in,
73
+ .hljs-bullet,
74
+ .hljs-code,
75
+ .hljs-addition {
76
+ color: var(--mantine-color-yellow-5);
77
+ }
78
+ .hljs-meta {
79
+ color: var(--mantine-color-blue-5);
80
+ }
81
+ .hljs-meta .hljs-string {
82
+ color: var(--mantine-color-blue-7);
83
+ }
84
+ /* Misc effects */
85
+ .hljs-emphasis {
86
+ font-style: italic;
87
+ }
88
+ .hljs-strong {
89
+ font-weight: bold;
90
+ }
91
+ .hljs-title.function_ {
92
+ color: var(--mantine-color-blue-5);
93
+ }
@@ -0,0 +1,2 @@
1
+ export { default as CodeHighlight } from './CodeHighlight.svelte';
2
+ export { CodeHighlightAdapterProviderContext } from './CodeHighlightAdapterProvider.context.svelte.js';
@@ -0,0 +1,2 @@
1
+ export { default as CodeHighlight } from './CodeHighlight.svelte';
2
+ export { CodeHighlightAdapterProviderContext } from './CodeHighlightAdapterProvider.context.svelte.js';
@@ -15,7 +15,7 @@
15
15
  <script lang="ts">
16
16
  let { data, onHide, autoClose, ...props }: NotificationContainerProps = $props();
17
17
 
18
- const { autoClose: _autoClose, message, children, ...notificationProps } = $derived(data);
18
+ const { message, children, ...notificationProps } = $derived(data);
19
19
 
20
20
  const autoCloseDuration = $derived(getAutoClose(autoClose, data.autoClose));
21
21
 
@@ -50,7 +50,7 @@
50
50
  </script>
51
51
 
52
52
  <Notification {...props} {...notificationProps} onclose={handleHide} onmouseenter={cancelAutoClose} onmouseleave={handleAutoClose}>
53
- {data.message}
53
+ {message}
54
54
 
55
55
  {@render children?.()}
56
56
  </Notification>