layerchart 2.0.0-next.3 → 2.0.0-next.30

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 (108) hide show
  1. package/dist/components/AnnotationPoint.svelte +16 -9
  2. package/dist/components/AnnotationRange.svelte +3 -3
  3. package/dist/components/Arc.svelte +2 -2
  4. package/dist/components/Axis.svelte +63 -14
  5. package/dist/components/Axis.svelte.d.ts +12 -2
  6. package/dist/components/Blur.svelte +5 -3
  7. package/dist/components/Blur.svelte.d.ts +2 -5
  8. package/dist/components/BrushContext.svelte +1 -1
  9. package/dist/components/Calendar.svelte +10 -6
  10. package/dist/components/Calendar.svelte.d.ts +2 -1
  11. package/dist/components/Chart.svelte +2 -2
  12. package/dist/components/Connector.svelte +2 -2
  13. package/dist/components/Connector.svelte.d.ts +1 -1
  14. package/dist/components/Ellipse.svelte +187 -0
  15. package/dist/components/Ellipse.svelte.d.ts +64 -0
  16. package/dist/components/ForceSimulation.svelte +168 -50
  17. package/dist/components/ForceSimulation.svelte.d.ts +80 -21
  18. package/dist/components/GeoPath.svelte +12 -5
  19. package/dist/components/GeoPoint.svelte +1 -2
  20. package/dist/components/GeoSpline.svelte +4 -4
  21. package/dist/components/GeoSpline.svelte.d.ts +1 -1
  22. package/dist/components/Group.svelte +2 -2
  23. package/dist/components/Highlight.svelte +2 -2
  24. package/dist/components/Hull.svelte +1 -1
  25. package/dist/components/Labels.svelte +3 -2
  26. package/dist/components/Labels.svelte.d.ts +2 -2
  27. package/dist/components/Legend.svelte +19 -12
  28. package/dist/components/Legend.svelte.d.ts +5 -5
  29. package/dist/components/MonthPath.svelte +14 -11
  30. package/dist/components/MonthPath.svelte.d.ts +4 -3
  31. package/dist/components/Polygon.svelte +285 -0
  32. package/dist/components/Polygon.svelte.d.ts +115 -0
  33. package/dist/components/RadialGradient.svelte +1 -3
  34. package/dist/components/Spline.svelte +30 -18
  35. package/dist/components/Spline.svelte.d.ts +12 -4
  36. package/dist/components/Text.svelte +62 -60
  37. package/dist/components/Text.svelte.d.ts +6 -0
  38. package/dist/components/TransformControls.svelte +16 -20
  39. package/dist/components/Treemap.svelte +63 -26
  40. package/dist/components/Treemap.svelte.d.ts +11 -11
  41. package/dist/components/Voronoi.svelte +51 -33
  42. package/dist/components/Voronoi.svelte.d.ts +3 -1
  43. package/dist/components/charts/ArcChart.svelte +5 -3
  44. package/dist/components/charts/AreaChart.svelte +11 -11
  45. package/dist/components/charts/BarChart.svelte +64 -53
  46. package/dist/components/charts/DefaultTooltip.svelte +1 -1
  47. package/dist/components/charts/LineChart.svelte +10 -6
  48. package/dist/components/charts/PieChart.svelte +5 -3
  49. package/dist/components/charts/ScatterChart.svelte +2 -3
  50. package/dist/components/charts/utils.svelte.d.ts +2 -2
  51. package/dist/components/charts/utils.svelte.js +5 -1
  52. package/dist/components/index.d.ts +4 -0
  53. package/dist/components/index.js +5 -1
  54. package/dist/components/layout/Canvas.svelte +67 -49
  55. package/dist/components/layout/Canvas.svelte.d.ts +6 -0
  56. package/dist/components/layout/Layer.svelte +6 -4
  57. package/dist/components/layout/Layer.svelte.d.ts +6 -4
  58. package/dist/components/tooltip/Tooltip.svelte +14 -7
  59. package/dist/components/tooltip/TooltipContext.svelte +78 -34
  60. package/dist/components/tooltip/TooltipContext.svelte.d.ts +3 -3
  61. package/dist/components/tooltip/TooltipHeader.svelte +5 -4
  62. package/dist/components/tooltip/TooltipHeader.svelte.d.ts +3 -3
  63. package/dist/components/tooltip/TooltipItem.svelte +5 -4
  64. package/dist/components/tooltip/TooltipItem.svelte.d.ts +3 -3
  65. package/dist/components/tooltip/TooltipList.svelte +1 -1
  66. package/dist/components/tooltip/tooltipMetaContext.d.ts +2 -2
  67. package/dist/docs/Blockquote.svelte +6 -4
  68. package/dist/docs/Blockquote.svelte.d.ts +4 -19
  69. package/dist/docs/Code.svelte +20 -12
  70. package/dist/docs/Code.svelte.d.ts +9 -23
  71. package/dist/docs/Header1.svelte +4 -2
  72. package/dist/docs/Header1.svelte.d.ts +4 -28
  73. package/dist/docs/Json.svelte +11 -3
  74. package/dist/docs/Json.svelte.d.ts +9 -21
  75. package/dist/docs/Layout.svelte +10 -7
  76. package/dist/docs/Layout.svelte.d.ts +4 -19
  77. package/dist/docs/Link.svelte +7 -3
  78. package/dist/docs/Link.svelte.d.ts +4 -38
  79. package/dist/docs/Preview.svelte +6 -3
  80. package/dist/docs/TilesetField.svelte +20 -19
  81. package/dist/docs/TilesetField.svelte.d.ts +5 -22
  82. package/dist/docs/ViewSourceButton.svelte +9 -6
  83. package/dist/docs/ViewSourceButton.svelte.d.ts +7 -21
  84. package/dist/utils/arcText.svelte.js +4 -4
  85. package/dist/utils/array.d.ts +11 -0
  86. package/dist/utils/array.js +23 -0
  87. package/dist/utils/array.test.d.ts +1 -0
  88. package/dist/utils/array.test.js +200 -0
  89. package/dist/utils/canvas.d.ts +77 -0
  90. package/dist/utils/canvas.js +105 -41
  91. package/dist/utils/genData.d.ts +14 -0
  92. package/dist/utils/genData.js +24 -6
  93. package/dist/utils/index.d.ts +1 -0
  94. package/dist/utils/index.js +1 -0
  95. package/dist/utils/path.d.ts +10 -0
  96. package/dist/utils/path.js +30 -0
  97. package/dist/utils/scales.svelte.d.ts +3 -2
  98. package/dist/utils/scales.svelte.js +7 -3
  99. package/dist/utils/shape.d.ts +43 -0
  100. package/dist/utils/shape.js +59 -0
  101. package/dist/utils/string.d.ts +49 -0
  102. package/dist/utils/string.js +4 -2
  103. package/dist/utils/ticks.d.ts +15 -4
  104. package/dist/utils/ticks.js +140 -159
  105. package/dist/utils/ticks.test.js +6 -16
  106. package/dist/utils/treemap.d.ts +1 -1
  107. package/package.json +27 -25
  108. package/dist/utils/object.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
- import type { Without } from '../../utils/types.js';
2
+ import { type Without } from '../../utils/types.js';
3
3
  export type TooltipItemPropsWithoutHTML = {
4
4
  /**
5
5
  * The label to display in the tooltip item.
@@ -13,7 +13,7 @@ export type TooltipItemPropsWithoutHTML = {
13
13
  /**
14
14
  * Format to use when displaying the value.
15
15
  */
16
- format?: FormatType;
16
+ format?: FormatType | FormatConfig;
17
17
  /**
18
18
  * Alignment of the value.
19
19
  *
@@ -59,7 +59,7 @@ export type TooltipItemPropsWithoutHTML = {
59
59
  colorRef?: HTMLElement;
60
60
  };
61
61
  export type TooltipItemProps = TooltipItemPropsWithoutHTML & Without<HTMLAttributes<HTMLElement>, TooltipItemPropsWithoutHTML>;
62
- import { type FormatType } from '@layerstack/utils';
62
+ import { type FormatType, type FormatConfig } from '@layerstack/utils';
63
63
  import type { Snippet } from 'svelte';
64
64
  declare const TooltipItem: import("svelte").Component<TooltipItemProps, {}, "ref" | "colorRef" | "labelRef" | "valueRef">;
65
65
  type TooltipItem = ReturnType<typeof TooltipItem>;
@@ -23,7 +23,7 @@
23
23
  bind:this={ref}
24
24
  class={cls(
25
25
  layerClass('tooltip-list'),
26
- 'grid grid-cols-[1fr_auto] gap-x-2 gap-y-1 items-center',
26
+ 'grid grid-cols-[1fr_auto] gap-x-2 gap-y-1 items-start',
27
27
  className
28
28
  )}
29
29
  {...restProps}
@@ -1,7 +1,7 @@
1
1
  import { type Accessor } from '../../utils/common.js';
2
2
  import type { SeriesData } from '../charts/index.js';
3
3
  import type { ChartContextValue } from '../Chart.svelte';
4
- import { type FormatType } from '@layerstack/utils';
4
+ import { type FormatType, type FormatConfig } from '@layerstack/utils';
5
5
  export type SimplifiedChartType = 'bar' | 'area' | 'line' | 'pie' | 'scatter';
6
6
  export type BarTooltipMetaContextValue = {
7
7
  type: 'bar';
@@ -52,7 +52,7 @@ export type TooltipPayload = {
52
52
  chartType?: SimplifiedChartType;
53
53
  payload: any;
54
54
  rawSeriesData?: SeriesData<any, any>;
55
- formatter?: FormatType;
55
+ formatter?: FormatType | FormatConfig;
56
56
  };
57
57
  type BasePayloadHandlerProps = {
58
58
  ctx: ChartContextValue;
@@ -1,7 +1,9 @@
1
1
  <script lang="ts">
2
- import { mdiInformation } from '@mdi/js';
3
- import { Icon } from 'svelte-ux';
4
2
  import { cls } from '@layerstack/tailwind';
3
+
4
+ import LucideInfo from '~icons/lucide/info';
5
+
6
+ const { children } = $props();
5
7
  </script>
6
8
 
7
9
  <div
@@ -10,6 +12,6 @@
10
12
  '[&>a]:font-medium [&>a]:underline [&>a]:decoration-dashed [&>a]:decoration-primary/50 [&>a]:underline-offset-2'
11
13
  )}
12
14
  >
13
- <Icon data={mdiInformation} class="text-primary" />
14
- <slot />
15
+ <LucideInfo class="text-primary" />
16
+ {@render children()}
15
17
  </div>
@@ -1,20 +1,5 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const Blockquote: $$__sveltets_2_IsomorphicComponent<any, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {
17
- default: {};
18
- }, {}, string>;
19
- type Blockquote = InstanceType<typeof Blockquote>;
1
+ declare const Blockquote: import("svelte").Component<{
2
+ children: any;
3
+ }, {}, "">;
4
+ type Blockquote = ReturnType<typeof Blockquote>;
20
5
  export default Blockquote;
@@ -4,20 +4,28 @@
4
4
  import { CopyButton } from 'svelte-ux';
5
5
  import { cls } from '@layerstack/tailwind';
6
6
 
7
- export let source: string | null = null;
8
- export let language = 'svelte';
9
- export let highlightedSource = source
10
- ? Prism.highlight(source, Prism.languages[language] ?? Prism.languages.text, language)
11
- : '';
12
-
13
- export let classes: {
14
- root?: string;
15
- pre?: string;
16
- code?: string;
17
- } = {};
7
+ const {
8
+ source = null,
9
+ language = 'svelte',
10
+ highlightedSource = source
11
+ ? Prism.highlight(source, Prism.languages[language] ?? Prism.languages.text, language)
12
+ : '',
13
+ classes = {},
14
+ 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();
18
26
  </script>
19
27
 
20
- <div class={cls('Code', 'rounded-sm', classes.root, $$props.class)}>
28
+ <div class={cls('Code', 'rounded-sm', classes.root, className)}>
21
29
  {#if source}
22
30
  <div class="relative">
23
31
  <pre
@@ -1,29 +1,15 @@
1
1
  import 'prism-svelte';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const Code: $$__sveltets_2_IsomorphicComponent<{
16
- [x: string]: any;
17
- source?: string | null | undefined;
18
- language?: string | undefined;
19
- highlightedSource?: string | undefined;
2
+ type $$ComponentProps = {
3
+ source: string | null;
4
+ language?: string;
5
+ highlightedSource?: string;
20
6
  classes?: {
21
7
  root?: string;
22
8
  pre?: string;
23
9
  code?: string;
24
- } | undefined;
25
- }, {
26
- [evt: string]: CustomEvent<any>;
27
- }, {}, {}, string>;
28
- type Code = InstanceType<typeof Code>;
10
+ };
11
+ class?: string;
12
+ };
13
+ declare const Code: import("svelte").Component<$$ComponentProps, {}, "">;
14
+ type Code = ReturnType<typeof Code>;
29
15
  export default Code;
@@ -1,5 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { SectionDivider } from 'svelte-ux';
3
+
4
+ let { children, ...restProps } = $props();
3
5
  </script>
4
6
 
5
7
  <!--
@@ -9,6 +11,6 @@
9
11
  - Maybe possible to set/get props from markdown/mdsvex
10
12
  - Example: `#API { id: 'api' }
11
13
  -->
12
- <SectionDivider {...$$restProps}>
13
- <slot />
14
+ <SectionDivider {...restProps}>
15
+ {@render children()}
14
16
  </SectionDivider>
@@ -1,29 +1,5 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: Props & {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
15
- default: any;
16
- } ? Props extends Record<string, never> ? any : {
17
- children?: any;
18
- } : {});
19
- declare const Header1: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
20
- [x: string]: any;
21
- }, {
22
- default: {};
23
- }>, {
24
- [evt: string]: CustomEvent<any>;
25
- }, {
26
- default: {};
27
- }, {}, string>;
28
- type Header1 = InstanceType<typeof Header1>;
1
+ declare const Header1: import("svelte").Component<{
2
+ children: any;
3
+ } & Record<string, any>, {}, "">;
4
+ type Header1 = ReturnType<typeof Header1>;
29
5
  export default Header1;
@@ -1,12 +1,20 @@
1
1
  <script lang="ts">
2
+ import { type ComponentProps } from 'svelte';
2
3
  import JsonTree from 'svelte-json-tree';
3
4
  import { cls } from '@layerstack/tailwind';
4
5
 
5
- export let value: any;
6
- export let defaultExpandedPaths = ['$'];
6
+ const {
7
+ value,
8
+ defaultExpandedPaths = ['$'],
9
+ class: className,
10
+ }: {
11
+ value: ComponentProps<JsonTree>['value'];
12
+ defaultExpandedPaths?: ComponentProps<JsonTree>['defaultExpandedPaths'];
13
+ class?: string;
14
+ } = $props();
7
15
  </script>
8
16
 
9
- <div class={cls('overflow-auto px-4 py-2 bg-[#1e1e1e]', $$props.class)}>
17
+ <div class={cls('overflow-auto px-4 py-2 bg-[#1e1e1e]', className)}>
10
18
  <JsonTree
11
19
  {value}
12
20
  {defaultExpandedPaths}
@@ -1,22 +1,10 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: Props & {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const Json: $$__sveltets_2_IsomorphicComponent<{
15
- [x: string]: any;
16
- value: any;
17
- defaultExpandedPaths?: string[] | undefined;
18
- }, {
19
- [evt: string]: CustomEvent<any>;
20
- }, {}, {}, string>;
21
- type Json = InstanceType<typeof Json>;
1
+ import { type ComponentProps } from 'svelte';
2
+ import JsonTree from 'svelte-json-tree';
3
+ type $$ComponentProps = {
4
+ value: ComponentProps<JsonTree>['value'];
5
+ defaultExpandedPaths?: ComponentProps<JsonTree>['defaultExpandedPaths'];
6
+ class?: string;
7
+ };
8
+ declare const Json: import("svelte").Component<$$ComponentProps, {}, "">;
9
+ type Json = ReturnType<typeof Json>;
22
10
  export default Json;
@@ -1,4 +1,4 @@
1
- <script context="module">
1
+ <script module>
2
2
  // Custom components: https://mdsvex.com/docs#custom-components
3
3
  import blockquote from './Blockquote.svelte';
4
4
  import a from './Link.svelte';
@@ -8,11 +8,14 @@
8
8
  </script>
9
9
 
10
10
  <script lang="ts">
11
- // frontmatter: https://mdsvex.com/docs#frontmatter-1
12
- // export let name = undefined;
13
- // export let sourceUrl = undefined;
14
- // export let docUrl = undefined;
15
- // export let description = undefined;
11
+ let {
12
+ // frontmatter: https://mdsvex.com/docs#frontmatter-1
13
+ // name,
14
+ // sourceUrl,
15
+ // docUrl,
16
+ // description,
17
+ children,
18
+ } = $props();
16
19
  </script>
17
20
 
18
- <slot />
21
+ {@render children()}
@@ -1,23 +1,8 @@
1
1
  import blockquote from './Blockquote.svelte';
2
2
  import a from './Link.svelte';
3
3
  export { a, blockquote };
4
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
5
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
- $$bindings?: Bindings;
7
- } & Exports;
8
- (internal: unknown, props: {
9
- $$events?: Events;
10
- $$slots?: Slots;
11
- }): Exports & {
12
- $set?: any;
13
- $on?: any;
14
- };
15
- z_$$bindings?: Bindings;
16
- }
17
- declare const Layout: $$__sveltets_2_IsomorphicComponent<any, {
18
- [evt: string]: CustomEvent<any>;
19
- }, {
20
- default: {};
21
- }, {}, string>;
22
- type Layout = InstanceType<typeof Layout>;
4
+ declare const Layout: import("svelte").Component<{
5
+ children: any;
6
+ }, {}, "">;
7
+ type Layout = ReturnType<typeof Layout>;
23
8
  export default Layout;
@@ -1,5 +1,9 @@
1
+ <script lang="ts">
2
+ let { children, ...restProps } = $props();
3
+ </script>
4
+
1
5
  <!-- href provided by markdown/mdsvex -->
2
- <!-- svelte-ignore a11y-missing-attribute -->
3
- <a class="text-primary font-medium" {...$$restProps}>
4
- <slot />
6
+ <!-- svelte-ignore a11y_missing_attribute -->
7
+ <a class="text-primary font-medium" {...restProps}>
8
+ {@render children()}
5
9
  </a>
@@ -1,39 +1,5 @@
1
+ declare const Link: import("svelte").Component<{
2
+ children: any;
3
+ } & Record<string, any>, {}, "">;
4
+ type Link = ReturnType<typeof Link>;
1
5
  export default Link;
2
- type Link = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- [x: string]: any;
4
- }, {
5
- default: {};
6
- }>, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> & {
11
- $$bindings?: string | undefined;
12
- };
13
- declare const Link: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
14
- [x: string]: any;
15
- }, {
16
- default: {};
17
- }>, {
18
- [evt: string]: CustomEvent<any>;
19
- }, {
20
- default: {};
21
- }, {}, string>;
22
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
23
- default: any;
24
- } ? Props extends Record<string, never> ? any : {
25
- children?: any;
26
- } : {});
27
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
28
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
29
- $$bindings?: Bindings;
30
- } & Exports;
31
- (internal: unknown, props: Props & {
32
- $$events?: Events;
33
- $$slots?: Slots;
34
- }): Exports & {
35
- $set?: any;
36
- $on?: any;
37
- };
38
- z_$$bindings?: Bindings;
39
- }
@@ -3,7 +3,9 @@
3
3
  // TODO: No longer copy from svelte-ux after prismjs is migrated to ESM (commonjs causes issue with Vite from another library)
4
4
  import Prism from 'prismjs';
5
5
  import 'prism-svelte';
6
- import { mdiCodeTags, mdiTable } from '@mdi/js';
6
+
7
+ import LucideCode from '~icons/lucide/code';
8
+ import LucideTable from '~icons/lucide/table';
7
9
 
8
10
  import { Button, CopyButton, Dialog, Toggle, Tooltip } from 'svelte-ux';
9
11
  import { cls } from '@layerstack/tailwind';
@@ -68,7 +70,7 @@
68
70
 
69
71
  {#if code}
70
72
  <Button
71
- icon={mdiCodeTags}
73
+ icon={LucideCode}
72
74
  class="text-surface-content/70 py-1"
73
75
  on:click={() => (showCode = !showCode)}
74
76
  >
@@ -78,7 +80,8 @@
78
80
 
79
81
  {#if data}
80
82
  <Toggle let:on={open} let:toggle let:toggleOff>
81
- <Button icon={mdiTable} class="text-surface-content/70 py-1" on:click={toggle}>View data</Button
83
+ <Button icon={LucideTable} class="text-surface-content/70 py-1" on:click={toggle}
84
+ >View data</Button
82
85
  >
83
86
  <Dialog
84
87
  {open}
@@ -1,26 +1,26 @@
1
1
  <script lang="ts">
2
2
  import { SelectField, Switch } from 'svelte-ux';
3
3
 
4
- export let doubleScale = devicePixelRatio > 1;
4
+ let { doubleScale = $bindable(devicePixelRatio > 1), serviceUrl = $bindable() } = $props();
5
5
 
6
6
  // TODO: Access via context, or possibly global state
7
7
  const ACCESS_TOKEN =
8
8
  'pk.eyJ1IjoidGVjaG5pcTM1IiwiYSI6ImNsZTR5cDd0ZjAyNm8zdnFvczhzdnFpcXkifQ.-LAr8sl5BZ3y-H0pDyD1qA';
9
9
 
10
10
  // https://docs.mapbox.com/api/maps/styles/
11
- $: mapboxv1 = (style: string) => (x: number, y: number, z: number) => {
11
+ const mapboxv1 = $derived((style: string) => (x: number, y: number, z: number) => {
12
12
  return `https://api.mapbox.com/styles/v1/mapbox/${style}/tiles/${z}/${x}/${y}${
13
13
  doubleScale ? '@2x' : ''
14
14
  }?access_token=${ACCESS_TOKEN}`;
15
- };
15
+ });
16
16
 
17
17
  // https://docs.mapbox.com/api/maps/raster-tiles/
18
18
  // https://docs.mapbox.com/data/tilesets/reference/mapbox-streets-v8/
19
- $: mapboxv4 = (tileset: string) => (x: number, y: number, z: number) => {
19
+ const mapboxv4 = $derived((tileset: string) => (x: number, y: number, z: number) => {
20
20
  return `https://${'abc'[Math.abs(x + y) % 3]}.tiles.mapbox.com/v4/${tileset}/${z}/${x}/${y}${
21
21
  doubleScale ? '@2x' : ''
22
22
  }.png?access_token=${ACCESS_TOKEN}`;
23
- };
23
+ });
24
24
 
25
25
  // https://apps.nationalmap.gov/services/
26
26
  const nationalmap = (tileset: string) => (x: number, y: number, z: number) => {
@@ -54,7 +54,7 @@
54
54
  return `https://${s}.tile.opentopomap.org/${z}/${x}/${y}.png`;
55
55
  };
56
56
 
57
- $: services = {
57
+ const services = $derived<Record<string, Record<string, Function>>>({
58
58
  'mapbox v1': {
59
59
  'streets-v11': mapboxv1('streets-v11'),
60
60
  'light-v10': mapboxv1('light-v10'),
@@ -100,24 +100,25 @@
100
100
  // 'ArcGIS Vector': {
101
101
  // 'Community Map', url: arcgisVector('World_Basemap_v2'),
102
102
  // }
103
- } as Record<string, Record<string, Function>>;
104
-
105
- $: serviceOptions = Object.entries(services).flatMap(([group, service]) => {
106
- return Object.entries(service).map(([label, value]) => {
107
- return { label, value: `${group}:${label}`, group, serviceUrl: value };
108
- });
109
103
  });
110
104
 
111
- $: defaultServiceUrl = services['mapbox v1']['streets-v11'];
112
- export let serviceUrl = defaultServiceUrl;
105
+ const serviceOptions = $derived(
106
+ Object.entries(services).flatMap(([group, service]) => {
107
+ return Object.entries(service).map(([label, value]) => {
108
+ return { label, value: `${group}:${label}`, group, serviceUrl: value };
109
+ });
110
+ })
111
+ );
113
112
 
114
- $: getServiceUrl = (option: string) => {
113
+ const getServiceUrl = $derived((option: string) => {
115
114
  const [selectedService, selectedTileset] = selected.split(':');
116
115
  return services[selectedService][selectedTileset];
117
- };
116
+ });
118
117
 
119
- let selected = 'mapbox v1:streets-v11';
120
- $: serviceUrl = getServiceUrl(selected);
118
+ let selected = $state('mapbox v1:streets-v11');
119
+ $effect(() => {
120
+ serviceUrl = getServiceUrl(selected);
121
+ });
121
122
  </script>
122
123
 
123
124
  <SelectField
@@ -128,7 +129,7 @@
128
129
  toggleIcon={null}
129
130
  stepper
130
131
  >
131
- <div slot="append" on:click|stopPropagation role="none">
132
+ <div slot="append" onclick={(e) => e.stopPropagation()} role="none">
132
133
  <div class="text-[10px] text-surface-content/50 text-center">2x</div>
133
134
  <Switch bind:checked={doubleScale} size="md" />
134
135
  </div>
@@ -1,23 +1,6 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: Props & {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const TilesetField: $$__sveltets_2_IsomorphicComponent<{
15
- doubleScale?: boolean;
16
- serviceUrl?: Function;
17
- }, {
18
- click: MouseEvent;
19
- } & {
20
- [evt: string]: CustomEvent<any>;
21
- }, {}, {}, string>;
22
- type TilesetField = InstanceType<typeof TilesetField>;
1
+ declare const TilesetField: import("svelte").Component<{
2
+ doubleScale?: any;
3
+ serviceUrl?: any;
4
+ }, {}, "doubleScale" | "serviceUrl">;
5
+ type TilesetField = ReturnType<typeof TilesetField>;
23
6
  export default TilesetField;
@@ -1,14 +1,17 @@
1
1
  <script lang="ts">
2
2
  import type { ComponentProps } from 'svelte';
3
3
  import { Button, Dialog, Toggle, Tooltip } from 'svelte-ux';
4
- import { mdiGithub } from '@mdi/js';
4
+ import LucideGithub from '~icons/lucide/github.svelte';
5
5
 
6
6
  import Code from './Code.svelte';
7
7
 
8
- export let label: string;
9
- export let source: string | undefined = undefined;
10
- export let href: string | undefined = undefined;
11
- export let icon: ComponentProps<Button>['icon'];
8
+ const {
9
+ label,
10
+ source,
11
+ href,
12
+ icon,
13
+ }: { label: string; source?: string; href?: string; icon: ComponentProps<Button>['icon'] } =
14
+ $props();
12
15
  </script>
13
16
 
14
17
  {#if source}
@@ -26,7 +29,7 @@
26
29
  </div>
27
30
 
28
31
  {#if href}
29
- <Button icon={mdiGithub} variant="fill-light" color="primary" {href} target="_blank">
32
+ <Button icon={LucideGithub} variant="fill-light" color="primary" {href} target="_blank">
30
33
  View on Github
31
34
  </Button>
32
35
  {/if}
@@ -1,25 +1,11 @@
1
1
  import type { ComponentProps } from 'svelte';
2
2
  import { Button } from 'svelte-ux';
3
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
4
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
5
- $$bindings?: Bindings;
6
- } & Exports;
7
- (internal: unknown, props: Props & {
8
- $$events?: Events;
9
- $$slots?: Slots;
10
- }): Exports & {
11
- $set?: any;
12
- $on?: any;
13
- };
14
- z_$$bindings?: Bindings;
15
- }
16
- declare const ViewSourceButton: $$__sveltets_2_IsomorphicComponent<{
3
+ type $$ComponentProps = {
17
4
  label: string;
18
- source?: string | undefined;
19
- href?: string | undefined;
20
- icon: ComponentProps<Button>["icon"];
21
- }, {
22
- [evt: string]: CustomEvent<any>;
23
- }, {}, {}, string>;
24
- type ViewSourceButton = InstanceType<typeof ViewSourceButton>;
5
+ source?: string;
6
+ href?: string;
7
+ icon: ComponentProps<Button>['icon'];
8
+ };
9
+ declare const ViewSourceButton: import("svelte").Component<$$ComponentProps, {}, "">;
10
+ type ViewSourceButton = ReturnType<typeof ViewSourceButton>;
25
11
  export default ViewSourceButton;
@@ -216,7 +216,7 @@ export function createArcTextProps(props, opts = {}, position) {
216
216
  x: x,
217
217
  y: y,
218
218
  textAnchor,
219
- 'dominant-baseline': 'middle',
219
+ dominantBaseline: 'middle',
220
220
  };
221
221
  });
222
222
  const current = $derived.by(() => {
@@ -224,21 +224,21 @@ export function createArcTextProps(props, opts = {}, position) {
224
224
  return {
225
225
  path: innerPath.current,
226
226
  ...sharedProps,
227
- 'dominant-baseline': innerDominantBaseline,
227
+ dominantBaseline: innerDominantBaseline,
228
228
  };
229
229
  }
230
230
  else if (position === 'outer') {
231
231
  return {
232
232
  path: outerPath.current,
233
233
  ...sharedProps,
234
- 'dominant-baseline': outerDominantBaseline,
234
+ dominantBaseline: outerDominantBaseline,
235
235
  };
236
236
  }
237
237
  else if (position === 'middle') {
238
238
  return {
239
239
  path: middlePath.current,
240
240
  ...sharedProps,
241
- 'dominant-baseline': 'middle',
241
+ dominantBaseline: 'middle',
242
242
  };
243
243
  }
244
244
  else if (position === 'centroid') {