layerchart 2.0.0-next.4 → 2.0.0-next.41

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 (180) hide show
  1. package/dist/components/AnnotationLine.svelte +15 -2
  2. package/dist/components/AnnotationPoint.svelte +29 -11
  3. package/dist/components/AnnotationRange.svelte +18 -4
  4. package/dist/components/Arc.svelte +5 -5
  5. package/dist/components/Area.svelte +10 -2
  6. package/dist/components/Axis.svelte +175 -58
  7. package/dist/components/Axis.svelte.d.ts +23 -6
  8. package/dist/components/Bar.svelte +20 -15
  9. package/dist/components/Bar.svelte.d.ts +2 -2
  10. package/dist/components/Bars.svelte +4 -4
  11. package/dist/components/Blur.svelte +7 -6
  12. package/dist/components/Blur.svelte.d.ts +2 -5
  13. package/dist/components/BrushContext.svelte +45 -45
  14. package/dist/components/Calendar.svelte +31 -10
  15. package/dist/components/Calendar.svelte.d.ts +2 -1
  16. package/dist/components/Chart.svelte +76 -27
  17. package/dist/components/Chart.svelte.d.ts +26 -8
  18. package/dist/components/ChartClipPath.svelte +1 -1
  19. package/dist/components/Circle.svelte +44 -3
  20. package/dist/components/CircleClipPath.svelte +8 -1
  21. package/dist/components/ClipPath.svelte +1 -2
  22. package/dist/components/ColorRamp.svelte +1 -1
  23. package/dist/components/ComputedStyles.svelte +9 -2
  24. package/dist/components/Connector.svelte +3 -3
  25. package/dist/components/Connector.svelte.d.ts +1 -1
  26. package/dist/components/Ellipse.svelte +228 -0
  27. package/dist/components/Ellipse.svelte.d.ts +64 -0
  28. package/dist/components/ForceSimulation.svelte +184 -50
  29. package/dist/components/ForceSimulation.svelte.d.ts +95 -21
  30. package/dist/components/Frame.svelte +1 -1
  31. package/dist/components/GeoCircle.svelte +1 -1
  32. package/dist/components/GeoEdgeFade.svelte +1 -1
  33. package/dist/components/GeoPath.svelte +30 -8
  34. package/dist/components/GeoPoint.svelte +4 -5
  35. package/dist/components/GeoSpline.svelte +5 -5
  36. package/dist/components/GeoSpline.svelte.d.ts +1 -1
  37. package/dist/components/GeoTile.svelte +1 -1
  38. package/dist/components/Graticule.svelte +5 -5
  39. package/dist/components/Grid.svelte +60 -63
  40. package/dist/components/Group.svelte +13 -8
  41. package/dist/components/Group.svelte.d.ts +10 -3
  42. package/dist/components/Highlight.svelte +55 -28
  43. package/dist/components/Highlight.svelte.d.ts +4 -0
  44. package/dist/components/Hull.svelte +12 -5
  45. package/dist/components/Labels.svelte +24 -13
  46. package/dist/components/Labels.svelte.d.ts +12 -5
  47. package/dist/components/Legend.svelte +143 -70
  48. package/dist/components/Legend.svelte.d.ts +12 -8
  49. package/dist/components/Line.svelte +40 -3
  50. package/dist/components/LinearGradient.svelte +35 -4
  51. package/dist/components/Link.svelte +1 -1
  52. package/dist/components/Marker.svelte +37 -26
  53. package/dist/components/MonthPath.svelte +26 -12
  54. package/dist/components/MonthPath.svelte.d.ts +4 -3
  55. package/dist/components/MotionPath.svelte +1 -1
  56. package/dist/components/Pack.svelte.d.ts +10 -3
  57. package/dist/components/Partition.svelte.d.ts +10 -3
  58. package/dist/components/Pattern.svelte +5 -5
  59. package/dist/components/Pie.svelte +1 -2
  60. package/dist/components/Points.svelte +11 -72
  61. package/dist/components/Points.svelte.d.ts +1 -8
  62. package/dist/components/Polygon.svelte +309 -0
  63. package/dist/components/Polygon.svelte.d.ts +115 -0
  64. package/dist/components/RadialGradient.svelte +4 -6
  65. package/dist/components/Rect.svelte +55 -5
  66. package/dist/components/Rect.svelte.d.ts +2 -2
  67. package/dist/components/RectClipPath.svelte +4 -3
  68. package/dist/components/RectClipPath.svelte.d.ts +2 -2
  69. package/dist/components/Rule.svelte +167 -77
  70. package/dist/components/Rule.svelte.d.ts +7 -2
  71. package/dist/components/Spline.svelte +59 -28
  72. package/dist/components/Spline.svelte.d.ts +12 -4
  73. package/dist/components/Text.svelte +121 -73
  74. package/dist/components/Text.svelte.d.ts +6 -0
  75. package/dist/components/TileImage.svelte +19 -4
  76. package/dist/components/TransformContext.svelte +9 -3
  77. package/dist/components/TransformControls.svelte +89 -38
  78. package/dist/components/Tree.svelte.d.ts +10 -3
  79. package/dist/components/Treemap.svelte +63 -26
  80. package/dist/components/Treemap.svelte.d.ts +21 -14
  81. package/dist/components/Voronoi.svelte +12 -13
  82. package/dist/components/charts/ArcChart.svelte +43 -71
  83. package/dist/components/charts/ArcChart.svelte.d.ts +10 -3
  84. package/dist/components/charts/AreaChart.svelte +29 -59
  85. package/dist/components/charts/AreaChart.svelte.d.ts +10 -3
  86. package/dist/components/charts/BarChart.svelte +79 -71
  87. package/dist/components/charts/BarChart.svelte.d.ts +10 -3
  88. package/dist/components/charts/DefaultTooltip.svelte +3 -3
  89. package/dist/components/charts/DefaultTooltip.svelte.d.ts +1 -1
  90. package/dist/components/charts/LineChart.svelte +69 -75
  91. package/dist/components/charts/LineChart.svelte.d.ts +21 -8
  92. package/dist/components/charts/PieChart.svelte +44 -71
  93. package/dist/components/charts/PieChart.svelte.d.ts +10 -3
  94. package/dist/components/charts/ScatterChart.svelte +10 -39
  95. package/dist/components/charts/ScatterChart.svelte.d.ts +10 -3
  96. package/dist/components/charts/utils.svelte.d.ts +1 -19
  97. package/dist/components/charts/utils.svelte.js +7 -35
  98. package/dist/components/index.d.ts +4 -0
  99. package/dist/components/index.js +5 -1
  100. package/dist/components/layout/Canvas.svelte +96 -69
  101. package/dist/components/layout/Canvas.svelte.d.ts +6 -0
  102. package/dist/components/layout/Html.svelte +15 -9
  103. package/dist/components/layout/Layer.svelte +6 -4
  104. package/dist/components/layout/Layer.svelte.d.ts +6 -4
  105. package/dist/components/layout/Svg.svelte +19 -11
  106. package/dist/components/layout/WebGL.svelte +26 -6
  107. package/dist/components/layout/WebGL.svelte.d.ts +5 -2
  108. package/dist/components/tooltip/Tooltip.svelte +73 -36
  109. package/dist/components/tooltip/Tooltip.svelte.d.ts +10 -3
  110. package/dist/components/tooltip/TooltipContext.svelte +167 -54
  111. package/dist/components/tooltip/TooltipContext.svelte.d.ts +19 -5
  112. package/dist/components/tooltip/TooltipHeader.svelte +32 -18
  113. package/dist/components/tooltip/TooltipHeader.svelte.d.ts +3 -3
  114. package/dist/components/tooltip/TooltipItem.svelte +46 -37
  115. package/dist/components/tooltip/TooltipItem.svelte.d.ts +3 -3
  116. package/dist/components/tooltip/TooltipList.svelte +12 -10
  117. package/dist/components/tooltip/TooltipSeparator.svelte +18 -10
  118. package/dist/components/tooltip/tooltipMetaContext.d.ts +2 -2
  119. package/dist/docs/Blockquote.svelte +6 -4
  120. package/dist/docs/Blockquote.svelte.d.ts +4 -19
  121. package/dist/docs/Code.svelte +70 -28
  122. package/dist/docs/Code.svelte.d.ts +9 -24
  123. package/dist/docs/Header1.svelte +4 -2
  124. package/dist/docs/Header1.svelte.d.ts +4 -28
  125. package/dist/docs/Json.svelte +11 -3
  126. package/dist/docs/Json.svelte.d.ts +9 -21
  127. package/dist/docs/Layout.svelte +10 -7
  128. package/dist/docs/Layout.svelte.d.ts +4 -19
  129. package/dist/docs/Link.svelte +7 -3
  130. package/dist/docs/Link.svelte.d.ts +4 -38
  131. package/dist/docs/Preview.svelte +22 -23
  132. package/dist/docs/Preview.svelte.d.ts +5 -6
  133. package/dist/docs/TilesetField.svelte +20 -19
  134. package/dist/docs/TilesetField.svelte.d.ts +5 -22
  135. package/dist/docs/ViewSourceButton.svelte +10 -7
  136. package/dist/docs/ViewSourceButton.svelte.d.ts +7 -21
  137. package/dist/states/series.svelte.d.ts +30 -0
  138. package/dist/states/series.svelte.js +54 -0
  139. package/dist/styles/daisyui-5.css +6 -0
  140. package/dist/styles/shadcn-svelte.css +11 -0
  141. package/dist/styles/skeleton-3.css +15 -0
  142. package/dist/utils/arcText.svelte.js +4 -4
  143. package/dist/utils/array.d.ts +11 -0
  144. package/dist/utils/array.js +23 -0
  145. package/dist/utils/array.test.d.ts +1 -0
  146. package/dist/utils/array.test.js +200 -0
  147. package/dist/utils/attributes.d.ts +3 -13
  148. package/dist/utils/attributes.js +4 -18
  149. package/dist/utils/canvas.d.ts +77 -0
  150. package/dist/utils/canvas.js +105 -41
  151. package/dist/utils/common.d.ts +9 -0
  152. package/dist/utils/common.js +18 -1
  153. package/dist/utils/common.test.js +26 -1
  154. package/dist/utils/genData.d.ts +22 -8
  155. package/dist/utils/genData.js +34 -14
  156. package/dist/utils/graph/dagre.d.ts +4 -4
  157. package/dist/utils/graph/dagre.js +5 -7
  158. package/dist/utils/index.d.ts +1 -0
  159. package/dist/utils/index.js +1 -0
  160. package/dist/utils/math.d.ts +17 -0
  161. package/dist/utils/math.js +17 -0
  162. package/dist/utils/motion.svelte.js +1 -1
  163. package/dist/utils/path.d.ts +10 -0
  164. package/dist/utils/path.js +30 -0
  165. package/dist/utils/rect.svelte.d.ts +2 -2
  166. package/dist/utils/rect.svelte.js +73 -1
  167. package/dist/utils/scales.svelte.d.ts +9 -3
  168. package/dist/utils/scales.svelte.js +47 -4
  169. package/dist/utils/shape.d.ts +43 -0
  170. package/dist/utils/shape.js +59 -0
  171. package/dist/utils/stack.js +1 -1
  172. package/dist/utils/string.d.ts +49 -0
  173. package/dist/utils/string.js +4 -2
  174. package/dist/utils/ticks.d.ts +15 -4
  175. package/dist/utils/ticks.js +140 -159
  176. package/dist/utils/ticks.test.js +16 -26
  177. package/dist/utils/treemap.d.ts +1 -1
  178. package/dist/utils/types.d.ts +15 -2
  179. package/package.json +36 -35
  180. package/dist/utils/object.js +0 -2
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" module>
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
- import type { Without } from '../../utils/types.js';
3
+ import { asAny, type Without } from '../../utils/types.js';
4
4
 
5
5
  export type TooltipItemPropsWithoutHTML = {
6
6
  /**
@@ -16,7 +16,7 @@
16
16
  /**
17
17
  * Format to use when displaying the value.
18
18
  */
19
- format?: FormatType;
19
+ format?: FormatType | FormatConfig;
20
20
 
21
21
  /**
22
22
  * Alignment of the value.
@@ -75,10 +75,9 @@
75
75
  </script>
76
76
 
77
77
  <script lang="ts">
78
- import { format as formatUtil, type FormatType } from '@layerstack/utils';
78
+ import { format as formatUtil, type FormatType, type FormatConfig } from '@layerstack/utils';
79
79
  import { cls } from '@layerstack/tailwind';
80
80
  import type { Snippet } from 'svelte';
81
- import { layerClass } from '../../utils/attributes.js';
82
81
 
83
82
  let {
84
83
  ref: refProp = $bindable(),
@@ -129,37 +128,19 @@
129
128
 
130
129
  <div
131
130
  {...props.root}
132
- class={cls(
133
- layerClass('tooltip-item-root'),
134
- 'contents',
135
- classes.root,
136
- className,
137
- props.root?.class
138
- )}
131
+ class={cls('lc-tooltip-item-root', classes.root, className, props.root?.class)}
139
132
  {...restProps}
140
133
  bind:this={ref}
141
134
  >
142
135
  <div
143
136
  {...props.label}
144
- class={cls(
145
- layerClass('tooltip-item-label'),
146
- 'label',
147
- 'flex items-center gap-2 whitespace-nowrap',
148
- classes.label,
149
- props.label?.class
150
- )}
137
+ class={cls('lc-tooltip-item-label', 'label', classes.label, props.label?.class)}
151
138
  bind:this={labelRef}
152
139
  >
153
140
  {#if color}
154
141
  <div
155
142
  {...props.color}
156
- class={cls(
157
- layerClass('tooltip-item-color'),
158
- 'color',
159
- 'inline-block size-2 rounded-full bg-[var(--color)]',
160
- classes.color,
161
- props.color?.class
162
- )}
143
+ class={cls('lc-tooltip-item-color', 'color', classes.color, props.color?.class)}
163
144
  style:--color={color}
164
145
  bind:this={colorRef}
165
146
  ></div>
@@ -174,22 +155,50 @@
174
155
  <div
175
156
  bind:this={valueRef}
176
157
  {...props.value}
177
- class={cls(
178
- layerClass('tooltip-item-value'),
179
- 'value',
180
- 'tabular-nums',
181
- {
182
- 'text-right': valueAlign === 'right',
183
- 'text-center': valueAlign === 'center',
184
- },
185
- classes.value,
186
- props.value?.class
187
- )}
158
+ class={cls('lc-tooltip-item-value', 'value', classes.value, props.value?.class)}
159
+ data-align={valueAlign}
188
160
  >
189
161
  {#if children}
190
162
  {@render children()}
191
163
  {:else}
192
- {format ? formatUtil(value, format) : value}
164
+ <!-- @ts-expect-error - improve types -->
165
+ {format ? formatUtil(value, asAny(format)) : value}
193
166
  {/if}
194
167
  </div>
195
168
  </div>
169
+
170
+ <style>
171
+ @layer component {
172
+ :where(.lc-tooltip-item-root) {
173
+ display: contents;
174
+ }
175
+
176
+ :where(.lc-tooltip-item-color) {
177
+ display: inline-block;
178
+ width: 8px;
179
+ height: 8px;
180
+ border-radius: 9999px; /* full */
181
+ background-color: var(--color);
182
+ }
183
+
184
+ :where(.lc-tooltip-item-label) {
185
+ display: flex;
186
+ align-items: center;
187
+ gap: 8px;
188
+ white-space: nowrap;
189
+ }
190
+
191
+ :where(.lc-tooltip-item-value) {
192
+ /* tabular-nums */
193
+ font-variant-numeric: tabular-nums;
194
+
195
+ &[data-align='right'] {
196
+ text-align: right;
197
+ }
198
+
199
+ &[data-align='center'] {
200
+ text-align: center;
201
+ }
202
+ }
203
+ }
204
+ </style>
@@ -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>;
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import { cls } from '@layerstack/tailwind';
3
- import { layerClass } from '../../utils/attributes.js';
4
3
  import type { HTMLAttributes } from 'svelte/elements';
5
4
 
6
5
  let {
@@ -19,14 +18,17 @@
19
18
  });
20
19
  </script>
21
20
 
22
- <div
23
- bind:this={ref}
24
- class={cls(
25
- layerClass('tooltip-list'),
26
- 'grid grid-cols-[1fr_auto] gap-x-2 gap-y-1 items-center',
27
- className
28
- )}
29
- {...restProps}
30
- >
21
+ <div bind:this={ref} class={cls('lc-tooltip-list', className)} {...restProps}>
31
22
  {@render children?.()}
32
23
  </div>
24
+
25
+ <style>
26
+ @layer component {
27
+ :where(.lc-tooltip-list) {
28
+ display: grid;
29
+ grid-template-columns: 1fr auto;
30
+ gap: 4px 8px;
31
+ align-items: start;
32
+ }
33
+ }
34
+ </style>
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import { cls } from '@layerstack/tailwind';
3
- import { layerClass } from '../../utils/attributes.js';
4
3
  import type { HTMLAttributes } from 'svelte/elements';
5
4
 
6
5
  let {
@@ -18,14 +17,23 @@
18
17
  });
19
18
  </script>
20
19
 
21
- <div
22
- bind:this={ref}
23
- class={cls(
24
- layerClass('tooltip-separator'),
25
- 'rounded-sm bg-surface-content/20 my-1 col-span-full h-px',
26
- className
27
- )}
28
- {...restProps}
29
- >
20
+ <div bind:this={ref} class={cls('lc-tooltip-separator', className)} {...restProps}>
30
21
  {@render children?.()}
31
22
  </div>
23
+
24
+ <style>
25
+ @layer component {
26
+ :where(.lc-tooltip-separator) {
27
+ height: 1px;
28
+ border-radius: 4px;
29
+ background-color: color-mix(
30
+ in oklab,
31
+ var(--color-surface-content, currentColor) 20%,
32
+ transparent
33
+ );
34
+ margin-top: 4px;
35
+ margin-bottom: 4px;
36
+ grid-column: 1 / -1; /* col-span-full */
37
+ }
38
+ }
39
+ </style>
@@ -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;
@@ -1,38 +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
- 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
- } = {};
21
+ let {
22
+ source = null,
23
+ language = 'svelte',
24
+ classes = {},
25
+ class: className,
26
+ }: Props & HTMLAttributes<HTMLDivElement> = $props();
18
27
  </script>
19
28
 
20
- <div class={cls('Code', 'rounded-sm', classes.root, $$props.class)}>
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
+ >
21
37
  {#if source}
22
- <div class="relative">
23
- <pre
24
- class={cls('language-{language} rounded-sm', classes.pre)}
25
- style="margin: 0; white-space: normal;">
26
- <code class={cls('language-{language}', classes.code)}>{@html highlightedSource}</code>
27
- </pre>
28
-
29
- <div class="absolute top-0 right-0 p-2 z-10">
30
- <CopyButton
31
- value={source ?? ''}
32
- class="text-white/70 hover:bg-surface-100/20 py-1 backdrop-blur-md"
33
- size="sm"
34
- />
35
- </div>
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
+ />
36
63
  </div>
37
64
  {/if}
38
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,29 +1,14 @@
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;
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ interface Props {
3
+ source?: string | null;
4
+ language?: string;
20
5
  classes?: {
21
6
  root?: string;
22
7
  pre?: string;
23
8
  code?: string;
24
- } | undefined;
25
- }, {
26
- [evt: string]: CustomEvent<any>;
27
- }, {}, {}, string>;
28
- type Code = InstanceType<typeof Code>;
9
+ };
10
+ }
11
+ type $$ComponentProps = Props & HTMLAttributes<HTMLDivElement>;
12
+ declare const Code: import("svelte").Component<$$ComponentProps, {}, "">;
13
+ type Code = ReturnType<typeof Code>;
29
14
  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
- }