layerchart 2.0.0-next.35 → 2.0.0-next.37
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.
- package/dist/components/charts/ArcChart.svelte +0 -1
- package/dist/components/charts/PieChart.svelte +0 -1
- package/dist/docs/Code.svelte +66 -32
- package/dist/docs/Code.svelte.d.ts +5 -6
- package/dist/docs/Preview.svelte +17 -21
- package/dist/docs/Preview.svelte.d.ts +5 -6
- package/dist/docs/ViewSourceButton.svelte +1 -1
- package/package.json +2 -5
package/dist/docs/Code.svelte
CHANGED
|
@@ -1,46 +1,80 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { createHighlighter } from 'shiki';
|
|
3
|
+
|
|
4
|
+
const highlighter = createHighlighter({
|
|
5
|
+
themes: ['github-light-default', 'github-dark-default'],
|
|
6
|
+
langs: ['svelte', 'javascript', 'ts', 'typescript', 'json', 'sh'],
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
1
10
|
<script lang="ts">
|
|
2
|
-
import Prism from 'prismjs';
|
|
3
|
-
import 'prism-svelte';
|
|
4
11
|
import { CopyButton } from 'svelte-ux';
|
|
5
12
|
import { cls } from '@layerstack/tailwind';
|
|
13
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
source?: string | null;
|
|
17
|
+
language?: string;
|
|
18
|
+
classes?: { root?: string; pre?: string; code?: string };
|
|
19
|
+
}
|
|
6
20
|
|
|
7
|
-
|
|
21
|
+
let {
|
|
8
22
|
source = null,
|
|
9
23
|
language = 'svelte',
|
|
10
|
-
highlightedSource = source
|
|
11
|
-
? Prism.highlight(source, Prism.languages[language] ?? Prism.languages.text, language)
|
|
12
|
-
: '',
|
|
13
24
|
classes = {},
|
|
14
25
|
class: className,
|
|
15
|
-
}:
|
|
16
|
-
source: string | null;
|
|
17
|
-
language?: string;
|
|
18
|
-
highlightedSource?: string;
|
|
19
|
-
classes?: {
|
|
20
|
-
root?: string;
|
|
21
|
-
pre?: string;
|
|
22
|
-
code?: string;
|
|
23
|
-
};
|
|
24
|
-
class?: string;
|
|
25
|
-
} = $props();
|
|
26
|
+
}: Props & HTMLAttributes<HTMLDivElement> = $props();
|
|
26
27
|
</script>
|
|
27
28
|
|
|
28
|
-
<div
|
|
29
|
+
<div
|
|
30
|
+
class={cls(
|
|
31
|
+
'Code',
|
|
32
|
+
'relative bg-surface-200 dark:bg-surface-300 p-4 overflow-auto not-prose',
|
|
33
|
+
classes.root,
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
29
37
|
{#if source}
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
<pre class={cls('whitespace-normal overflow-auto', classes.pre)}>
|
|
39
|
+
<code class={cls('text-xs', classes.code)}>
|
|
40
|
+
{#await highlighter}
|
|
41
|
+
<div>Loading...</div>
|
|
42
|
+
{:then h}
|
|
43
|
+
{@html h.codeToHtml(source, {
|
|
44
|
+
lang: language,
|
|
45
|
+
themes: {
|
|
46
|
+
light: 'github-light-default',
|
|
47
|
+
dark: 'github-dark-default',
|
|
48
|
+
},
|
|
49
|
+
})}
|
|
50
|
+
{:catch error}
|
|
51
|
+
<div class="text-red-500">Error loading code highlighting: {error.message}</div>
|
|
52
|
+
{/await}
|
|
53
|
+
|
|
54
|
+
</code>
|
|
55
|
+
</pre>
|
|
56
|
+
|
|
57
|
+
<div class="absolute top-0 right-0 p-2 z-10">
|
|
58
|
+
<CopyButton
|
|
59
|
+
value={source ?? ''}
|
|
60
|
+
class="text-surface-content/70 hover:bg-surface-100/20 py-1 backdrop-blur-md"
|
|
61
|
+
size="sm"
|
|
62
|
+
/>
|
|
44
63
|
</div>
|
|
45
64
|
{/if}
|
|
46
65
|
</div>
|
|
66
|
+
|
|
67
|
+
<style>
|
|
68
|
+
:global(.shiki) {
|
|
69
|
+
background-color: transparent !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(html.dark .shiki),
|
|
73
|
+
:global(html.dark .shiki span) {
|
|
74
|
+
color: var(--shiki-dark) !important;
|
|
75
|
+
/* background-color: var(--shiki-dark-bg) !important; */
|
|
76
|
+
font-style: var(--shiki-dark-font-style) !important;
|
|
77
|
+
font-weight: var(--shiki-dark-font-weight) !important;
|
|
78
|
+
text-decoration: var(--shiki-dark-text-decoration) !important;
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import '
|
|
2
|
-
|
|
3
|
-
source
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
interface Props {
|
|
3
|
+
source?: string | null;
|
|
4
4
|
language?: string;
|
|
5
|
-
highlightedSource?: string;
|
|
6
5
|
classes?: {
|
|
7
6
|
root?: string;
|
|
8
7
|
pre?: string;
|
|
9
8
|
code?: string;
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
type $$ComponentProps = Props & HTMLAttributes<HTMLDivElement>;
|
|
13
12
|
declare const Code: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
13
|
type Code = ReturnType<typeof Code>;
|
|
15
14
|
export default Code;
|
package/dist/docs/Preview.svelte
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { slide } from 'svelte/transition';
|
|
3
|
-
// TODO: No longer copy from svelte-ux after prismjs is migrated to ESM (commonjs causes issue with Vite from another library)
|
|
4
|
-
import Prism from 'prismjs';
|
|
5
|
-
import 'prism-svelte';
|
|
6
|
-
|
|
7
3
|
import LucideCode from '~icons/lucide/code';
|
|
8
4
|
import LucideTable from '~icons/lucide/table';
|
|
9
5
|
|
|
@@ -12,25 +8,25 @@
|
|
|
12
8
|
|
|
13
9
|
import Code from './Code.svelte';
|
|
14
10
|
import Json from './Json.svelte';
|
|
11
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
15
12
|
import type { Snippet } from 'svelte';
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
data,
|
|
20
|
-
language = 'svelte',
|
|
21
|
-
highlightedCode = code ? Prism.highlight(code, Prism.languages.svelte, language) : '',
|
|
22
|
-
showCode = false,
|
|
23
|
-
class: className,
|
|
24
|
-
children,
|
|
25
|
-
}: {
|
|
14
|
+
interface Props {
|
|
15
|
+
children: Snippet;
|
|
26
16
|
code?: string;
|
|
27
17
|
data?: any;
|
|
28
18
|
language?: string;
|
|
29
|
-
highlightedCode?: string;
|
|
30
19
|
showCode?: boolean;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
children,
|
|
24
|
+
code = undefined,
|
|
25
|
+
data = undefined,
|
|
26
|
+
language = 'svelte',
|
|
27
|
+
showCode = false,
|
|
28
|
+
class: className,
|
|
29
|
+
}: Props & HTMLAttributes<HTMLDivElement> = $props();
|
|
34
30
|
|
|
35
31
|
/**
|
|
36
32
|
* Custom JSON replacer (to use with JSON.stringify()) to convert `Date` instances to `new Date()`
|
|
@@ -56,14 +52,14 @@
|
|
|
56
52
|
}
|
|
57
53
|
</script>
|
|
58
54
|
|
|
59
|
-
<div class={cls('Preview border rounded
|
|
55
|
+
<div class={cls('Preview border rounded bg-surface-100', className)}>
|
|
60
56
|
<div class="p-4">
|
|
61
|
-
{@render children
|
|
57
|
+
{@render children()}
|
|
62
58
|
</div>
|
|
63
59
|
|
|
64
60
|
{#if code && showCode}
|
|
65
|
-
<div transition:slide class="
|
|
66
|
-
<Code source={code}
|
|
61
|
+
<div transition:slide class="border-t">
|
|
62
|
+
<Code source={code} {language} />
|
|
67
63
|
</div>
|
|
68
64
|
{/if}
|
|
69
65
|
</div>
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
3
|
+
interface Props {
|
|
4
|
+
children: Snippet;
|
|
4
5
|
code?: string;
|
|
5
6
|
data?: any;
|
|
6
7
|
language?: string;
|
|
7
|
-
highlightedCode?: string;
|
|
8
8
|
showCode?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
9
|
+
}
|
|
10
|
+
type $$ComponentProps = Props & HTMLAttributes<HTMLDivElement>;
|
|
12
11
|
declare const Preview: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
12
|
type Preview = ReturnType<typeof Preview>;
|
|
14
13
|
export default Preview;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "2.0.0-next.
|
|
7
|
+
"version": "2.0.0-next.37",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@changesets/cli": "^2.29.4",
|
|
10
10
|
"@iconify-json/lucide": "^1.2.48",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"@types/d3-shape": "^3.1.7",
|
|
36
36
|
"@types/d3-time": "^3.0.4",
|
|
37
37
|
"@types/lodash-es": "^4.17.12",
|
|
38
|
-
"@types/prismjs": "^1.26.5",
|
|
39
38
|
"@types/shapefile": "^0.6.4",
|
|
40
39
|
"@types/topojson-client": "^3.1.5",
|
|
41
40
|
"@types/topojson-simplify": "^3.0.3",
|
|
@@ -45,12 +44,10 @@
|
|
|
45
44
|
"posthog-js": "^1.252.0",
|
|
46
45
|
"prettier": "^3.5.3",
|
|
47
46
|
"prettier-plugin-svelte": "^3.4.0",
|
|
48
|
-
"prism-svelte": "^0.5.0",
|
|
49
|
-
"prism-themes": "^1.9.0",
|
|
50
|
-
"prismjs": "^1.30.0",
|
|
51
47
|
"rehype-slug": "^6.0.0",
|
|
52
48
|
"rollup-plugin-visualizer": "^6.0.3",
|
|
53
49
|
"shapefile": "^0.6.6",
|
|
50
|
+
"shiki": "^3.9.2",
|
|
54
51
|
"solar-calculator": "^0.3.0",
|
|
55
52
|
"svelte": "5.34.1",
|
|
56
53
|
"svelte-check": "^4.2.1",
|