svelteplot 0.0.1-alpha.16 → 0.0.1-alpha.18

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 (40) hide show
  1. package/dist/Plot.svelte.d.ts +2 -2
  2. package/dist/classes/Scale.svelte.js +1 -1
  3. package/dist/contants.d.ts +1 -1
  4. package/dist/helpers/GroupMultiple.svelte.d.ts +2 -2
  5. package/dist/helpers/autoTimeFormat.js +1 -1
  6. package/dist/marks/Area.svelte.d.ts +2 -2
  7. package/dist/marks/AreaX.svelte +4 -5
  8. package/dist/marks/AreaX.svelte.d.ts +2 -2
  9. package/dist/marks/AreaY.svelte +4 -5
  10. package/dist/marks/AreaY.svelte.d.ts +2 -2
  11. package/dist/marks/AxisX.svelte.d.ts +2 -2
  12. package/dist/marks/AxisY.svelte +0 -1
  13. package/dist/marks/AxisY.svelte.d.ts +2 -2
  14. package/dist/marks/BarX.svelte +2 -2
  15. package/dist/marks/BarX.svelte.d.ts +2 -2
  16. package/dist/marks/BarY.svelte.d.ts +2 -2
  17. package/dist/marks/BaseMark.svelte +1 -1
  18. package/dist/marks/BaseMark.svelte.d.ts +2 -2
  19. package/dist/marks/ColorLegend.svelte.d.ts +2 -2
  20. package/dist/marks/Dot.svelte.d.ts +2 -2
  21. package/dist/marks/DotX.svelte.d.ts +2 -2
  22. package/dist/marks/DotY.svelte.d.ts +2 -2
  23. package/dist/marks/Frame.svelte.d.ts +2 -2
  24. package/dist/marks/GridX.svelte.d.ts +2 -2
  25. package/dist/marks/GridY.svelte +0 -1
  26. package/dist/marks/GridY.svelte.d.ts +2 -2
  27. package/dist/marks/Line.svelte.d.ts +2 -2
  28. package/dist/marks/LineX.svelte.d.ts +2 -2
  29. package/dist/marks/LineY.svelte.d.ts +2 -2
  30. package/dist/marks/RuleX.svelte.d.ts +2 -2
  31. package/dist/marks/RuleY.svelte.d.ts +2 -2
  32. package/dist/marks/SymbolLegend.svelte.d.ts +2 -2
  33. package/dist/marks/TickX.svelte.d.ts +2 -2
  34. package/dist/marks/TickY.svelte.d.ts +2 -2
  35. package/dist/transforms/recordize.d.ts +1 -1
  36. package/dist/transforms/recordize.js +13 -5
  37. package/dist/transforms/rename.d.ts +1 -1
  38. package/dist/transforms/stack.js +11 -4
  39. package/dist/types.d.ts +1 -1
  40. package/package.json +2 -4
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { PlotProps } from './types.js';
3
3
  declare const __propDef: {
4
4
  props: PlotProps;
@@ -11,5 +11,5 @@ type PlotProps_ = typeof __propDef.props;
11
11
  export { PlotProps_ as PlotProps };
12
12
  export type PlotEvents = typeof __propDef.events;
13
13
  export type PlotSlots = typeof __propDef.slots;
14
- export default class Plot extends SvelteComponent<PlotProps, PlotEvents, PlotSlots> {
14
+ export default class Plot extends SvelteComponentTyped<PlotProps, PlotEvents, PlotSlots> {
15
15
  }
@@ -2,7 +2,7 @@ import resolveChannel from '../helpers/resolveChannel.js';
2
2
  import { extent } from 'd3-array';
3
3
  import { CHANNEL_SCALE } from '../contants.js';
4
4
  import { isDateOrNull, isNumberOrNull, isStringOrNull } from '../helpers/typeChecks.js';
5
- import { uniq } from 'underscore';
5
+ import uniq from 'underscore/modules/uniq.js';
6
6
  const FUNCTION = '(function)';
7
7
  export class Scale {
8
8
  name = undefined;
@@ -1,3 +1,3 @@
1
- import type { ScaleName, ChannelName } from './types';
1
+ import type { ScaleName, ChannelName } from './types.js';
2
2
  export declare const SCALE_TYPES: Record<ScaleName, symbol>;
3
3
  export declare const CHANNEL_SCALE: Record<ChannelName, ScaleName>;
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { DataRow } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: {
@@ -14,6 +14,6 @@ declare const __propDef: {
14
14
  export type GroupMultipleProps = typeof __propDef.props;
15
15
  export type GroupMultipleEvents = typeof __propDef.events;
16
16
  export type GroupMultipleSlots = typeof __propDef.slots;
17
- export default class GroupMultiple extends SvelteComponent<GroupMultipleProps, GroupMultipleEvents, GroupMultipleSlots> {
17
+ export default class GroupMultiple extends SvelteComponentTyped<GroupMultipleProps, GroupMultipleEvents, GroupMultipleSlots> {
18
18
  }
19
19
  export {};
@@ -1,5 +1,5 @@
1
1
  import dayjs from 'dayjs';
2
- import { isDate } from 'underscore';
2
+ import isDate from 'underscore/modules/isDate.js';
3
3
  export default function autoTimeFormat(x, plotWidth) {
4
4
  const daysPer100Px = ((toNumber(x.domain[1]) - toNumber(x.domain[0])) / plotWidth / 864e5) * 100;
5
5
  const format = daysPer100Px < 1 ? 'HH:mm\nMMM DD' : daysPer100Px < 30 ? 'DD\nMMM' : 'MMM\nYYYY';
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, Curve } from '../types.js';
3
3
  export type AreaMarkProps = MarkProps & BaseMarkStyleProps & {
4
4
  x1?: ChannelAccessor;
@@ -23,6 +23,6 @@ declare const __propDef: {
23
23
  export type AreaProps = typeof __propDef.props;
24
24
  export type AreaEvents = typeof __propDef.events;
25
25
  export type AreaSlots = typeof __propDef.slots;
26
- export default class Area extends SvelteComponent<AreaProps, AreaEvents, AreaSlots> {
26
+ export default class Area extends SvelteComponentTyped<AreaProps, AreaEvents, AreaSlots> {
27
27
  }
28
28
  export {};
@@ -3,10 +3,9 @@
3
3
  <script>import Area from "./Area.svelte";
4
4
  import { stackX, recordizeX, renameChannels } from "..";
5
5
  let { data: rawData, stack, ...rawChannels } = $props();
6
- let { data, ...channels } = $derived(renameChannels(stackX(recordizeX({ data: rawData, ...rawChannels }), stack), { y: "y1" }));
6
+ let { data, ...channels } = $derived(
7
+ renameChannels(stackX(recordizeX({ data: rawData, ...rawChannels }), stack), { y: "y1" })
8
+ );
7
9
  </script>
8
10
 
9
- <Area
10
- {data}
11
- {...channels}
12
- />
11
+ <Area {data} {...channels} />
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, Curve } from '../types.js';
3
3
  import type { CurveFactory } from 'd3-shape';
4
4
  import type { StackOptions } from '../transforms/stack.js';
@@ -25,6 +25,6 @@ declare const __propDef: {
25
25
  export type AreaXProps = typeof __propDef.props;
26
26
  export type AreaXEvents = typeof __propDef.events;
27
27
  export type AreaXSlots = typeof __propDef.slots;
28
- export default class AreaX extends SvelteComponent<AreaXProps, AreaXEvents, AreaXSlots> {
28
+ export default class AreaX extends SvelteComponentTyped<AreaXProps, AreaXEvents, AreaXSlots> {
29
29
  }
30
30
  export {};
@@ -3,11 +3,10 @@
3
3
  <script>import Area from "./Area.svelte";
4
4
  import { stackY, recordizeY, renameChannels } from "..";
5
5
  let { data: rawData, stack, ...rawChannels } = $props();
6
- let { data, ...channels } = $derived(renameChannels(stackY(recordizeY({ data: rawData, ...rawChannels }), stack), { x: "x1" }));
6
+ let { data, ...channels } = $derived(
7
+ renameChannels(stackY(recordizeY({ data: rawData, ...rawChannels }), stack), { x: "x1" })
8
+ );
7
9
  $inspect({ data, channels });
8
10
  </script>
9
11
 
10
- <Area
11
- {data}
12
- {...channels}
13
- />
12
+ <Area {data} {...channels} />
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, Curve } from '../types.js';
3
3
  import type { CurveFactory } from 'd3-shape';
4
4
  import type { StackOptions } from '../transforms/stack.js';
@@ -25,6 +25,6 @@ declare const __propDef: {
25
25
  export type AreaYProps = typeof __propDef.props;
26
26
  export type AreaYEvents = typeof __propDef.events;
27
27
  export type AreaYSlots = typeof __propDef.slots;
28
- export default class AreaY extends SvelteComponent<AreaYProps, AreaYEvents, AreaYSlots> {
28
+ export default class AreaY extends SvelteComponentTyped<AreaYProps, AreaYEvents, AreaYSlots> {
29
29
  }
30
30
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { AxisMarkOptions } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: AxisMarkOptions & {
@@ -12,6 +12,6 @@ declare const __propDef: {
12
12
  export type AxisXProps = typeof __propDef.props;
13
13
  export type AxisXEvents = typeof __propDef.events;
14
14
  export type AxisXSlots = typeof __propDef.slots;
15
- export default class AxisX extends SvelteComponent<AxisXProps, AxisXEvents, AxisXSlots> {
15
+ export default class AxisX extends SvelteComponentTyped<AxisXProps, AxisXEvents, AxisXSlots> {
16
16
  }
17
17
  export {};
@@ -1,5 +1,4 @@
1
1
  <script>import { getContext } from "svelte";
2
- import { get } from "underscore";
3
2
  import BaseMark from "./BaseMark.svelte";
4
3
  import getBaseStyles from "../helpers/getBaseStyles.js";
5
4
  import autoTimeFormat from "../helpers/autoTimeFormat.js";
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { AxisYMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: AxisYMarkProps;
@@ -10,6 +10,6 @@ declare const __propDef: {
10
10
  export type AxisYProps = typeof __propDef.props;
11
11
  export type AxisYEvents = typeof __propDef.events;
12
12
  export type AxisYSlots = typeof __propDef.slots;
13
- export default class AxisY extends SvelteComponent<AxisYProps, AxisYEvents, AxisYSlots> {
13
+ export default class AxisY extends SvelteComponentTyped<AxisYProps, AxisYEvents, AxisYSlots> {
14
14
  }
15
15
  export {};
@@ -34,9 +34,9 @@ function isValid(value) {
34
34
  ? null
35
35
  : 'currentColor'}
36
36
  style:stroke={maybeStrokeColor ? plot.colorScale(maybeStrokeColor) : null}
37
- transform="translate({[minx, plot.yScale(cy)+inset]})"
37
+ transform="translate({[minx, plot.yScale(cy) + inset]})"
38
38
  width={maxx - minx}
39
- height={plot.yScale.bandwidth()- inset*2}
39
+ height={plot.yScale.bandwidth() - inset * 2}
40
40
  />
41
41
  {/if}
42
42
  {/each}
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, DataRow } from '../types.js';
3
3
  import type { StackOptions } from '../transforms/stack.js';
4
4
  export type BarXMarkProps = MarkProps & BaseMarkStyleProps & {
@@ -20,6 +20,6 @@ declare const __propDef: {
20
20
  export type BarXProps = typeof __propDef.props;
21
21
  export type BarXEvents = typeof __propDef.events;
22
22
  export type BarXSlots = typeof __propDef.slots;
23
- export default class BarX extends SvelteComponent<BarXProps, BarXEvents, BarXSlots> {
23
+ export default class BarX extends SvelteComponentTyped<BarXProps, BarXEvents, BarXSlots> {
24
24
  }
25
25
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, DataRow } from '../types.js';
3
3
  import type { StackOptions } from '../transforms/stack.js';
4
4
  export type BarYMarkProps = MarkProps & BaseMarkStyleProps & {
@@ -20,6 +20,6 @@ declare const __propDef: {
20
20
  export type BarYProps = typeof __propDef.props;
21
21
  export type BarYEvents = typeof __propDef.events;
22
22
  export type BarYSlots = typeof __propDef.slots;
23
- export default class BarY extends SvelteComponent<BarYProps, BarYEvents, BarYSlots> {
23
+ export default class BarY extends SvelteComponentTyped<BarYProps, BarYEvents, BarYSlots> {
24
24
  }
25
25
  export {};
@@ -1,6 +1,6 @@
1
1
  <script context="module"></script>
2
2
 
3
- <script generics="T extends BaseMarkProps">import { Mark } from "../classes/Mark.svelte";
3
+ <script generics="T extends BaseMarkProps">import { Mark } from "../classes/Mark.svelte.js";
4
4
  import { getContext } from "svelte";
5
5
  const plot = getContext("svelteplot");
6
6
  let {
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { BaseMarkProps } from '../types.js';
3
3
  import { type Snippet } from 'svelte';
4
4
  declare class __sveltets_Render<T extends BaseMarkProps> {
@@ -15,6 +15,6 @@ declare class __sveltets_Render<T extends BaseMarkProps> {
15
15
  export type BaseMarkProps<T extends BaseMarkProps> = ReturnType<__sveltets_Render<T>['props']>;
16
16
  export type BaseMarkEvents<T extends BaseMarkProps> = ReturnType<__sveltets_Render<T>['events']>;
17
17
  export type BaseMarkSlots<T extends BaseMarkProps> = ReturnType<__sveltets_Render<T>['slots']>;
18
- export default class BaseMark<T extends BaseMarkProps> extends SvelteComponent<BaseMarkProps<T>, BaseMarkEvents<T>, BaseMarkSlots<T>> {
18
+ export default class BaseMark<T extends BaseMarkProps> extends SvelteComponentTyped<BaseMarkProps<T>, BaseMarkEvents<T>, BaseMarkSlots<T>> {
19
19
  }
20
20
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type ColorLegendProps = typeof __propDef.props;
10
10
  export type ColorLegendEvents = typeof __propDef.events;
11
11
  export type ColorLegendSlots = typeof __propDef.slots;
12
- export default class ColorLegend extends SvelteComponent<ColorLegendProps, ColorLegendEvents, ColorLegendSlots> {
12
+ export default class ColorLegend extends SvelteComponentTyped<ColorLegendProps, ColorLegendEvents, ColorLegendSlots> {
13
13
  }
14
14
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, DataRow } from '../types.js';
3
3
  export type DotMarkProps = MarkProps & BaseMarkStyleProps & {
4
4
  data: DataRow[];
@@ -18,6 +18,6 @@ declare const __propDef: {
18
18
  export type DotProps = typeof __propDef.props;
19
19
  export type DotEvents = typeof __propDef.events;
20
20
  export type DotSlots = typeof __propDef.slots;
21
- export default class Dot extends SvelteComponent<DotProps, DotEvents, DotSlots> {
21
+ export default class Dot extends SvelteComponentTyped<DotProps, DotEvents, DotSlots> {
22
22
  }
23
23
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { RawValue } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: {
@@ -12,6 +12,6 @@ declare const __propDef: {
12
12
  export type DotXProps = typeof __propDef.props;
13
13
  export type DotXEvents = typeof __propDef.events;
14
14
  export type DotXSlots = typeof __propDef.slots;
15
- export default class DotX extends SvelteComponent<DotXProps, DotXEvents, DotXSlots> {
15
+ export default class DotX extends SvelteComponentTyped<DotXProps, DotXEvents, DotXSlots> {
16
16
  }
17
17
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { RawValue } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: {
@@ -12,6 +12,6 @@ declare const __propDef: {
12
12
  export type DotYProps = typeof __propDef.props;
13
13
  export type DotYEvents = typeof __propDef.events;
14
14
  export type DotYSlots = typeof __propDef.slots;
15
- export default class DotY extends SvelteComponent<DotYProps, DotYEvents, DotYSlots> {
15
+ export default class DotY extends SvelteComponentTyped<DotYProps, DotYEvents, DotYSlots> {
16
16
  }
17
17
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { FrameProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: import("../types.js").BaseMarkStyleProps;
@@ -11,5 +11,5 @@ type FrameProps_ = typeof __propDef.props;
11
11
  export { FrameProps_ as FrameProps };
12
12
  export type FrameEvents = typeof __propDef.events;
13
13
  export type FrameSlots = typeof __propDef.slots;
14
- export default class Frame extends SvelteComponent<FrameProps, FrameEvents, FrameSlots> {
14
+ export default class Frame extends SvelteComponentTyped<FrameProps, FrameEvents, FrameSlots> {
15
15
  }
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { GridOptions, ChannelAccessor } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: Partial<import("../types.js").MarkProps> & GridOptions & {
@@ -14,6 +14,6 @@ declare const __propDef: {
14
14
  export type GridXProps = typeof __propDef.props;
15
15
  export type GridXEvents = typeof __propDef.events;
16
16
  export type GridXSlots = typeof __propDef.slots;
17
- export default class GridX extends SvelteComponent<GridXProps, GridXEvents, GridXSlots> {
17
+ export default class GridX extends SvelteComponentTyped<GridXProps, GridXEvents, GridXSlots> {
18
18
  }
19
19
  export {};
@@ -1,7 +1,6 @@
1
1
  <script>import { getContext } from "svelte";
2
2
  import BaseMark from "./BaseMark.svelte";
3
3
  import getBaseStyles from "../helpers/getBaseStyles.js";
4
- import { get } from "underscore";
5
4
  const plot = getContext("svelteplot");
6
5
  let { ticks = [], automatic = false, ...styleProps } = $props();
7
6
  let autoTickCount = $derived(plot.plotHeight / (plot.options.y?.tickSpacing || 80));
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { GridYMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: GridYMarkProps;
@@ -10,6 +10,6 @@ declare const __propDef: {
10
10
  export type GridYProps = typeof __propDef.props;
11
11
  export type GridYEvents = typeof __propDef.events;
12
12
  export type GridYSlots = typeof __propDef.slots;
13
- export default class GridY extends SvelteComponent<GridYProps, GridYEvents, GridYSlots> {
13
+ export default class GridY extends SvelteComponentTyped<GridYProps, GridYEvents, GridYSlots> {
14
14
  }
15
15
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, Curve, DataRow } from '../types.js';
3
3
  export type LineMarkProps = MarkProps & BaseMarkStyleProps & {
4
4
  data: DataRow[];
@@ -22,6 +22,6 @@ declare const __propDef: {
22
22
  export type LineProps = typeof __propDef.props;
23
23
  export type LineEvents = typeof __propDef.events;
24
24
  export type LineSlots = typeof __propDef.slots;
25
- export default class Line extends SvelteComponent<LineProps, LineEvents, LineSlots> {
25
+ export default class Line extends SvelteComponentTyped<LineProps, LineEvents, LineSlots> {
26
26
  }
27
27
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { CurveFactory } from 'd3-shape';
3
3
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, Curve, RawValue } from '../types.js';
4
4
  export type LineXMarkProps = MarkProps & BaseMarkStyleProps & {
@@ -19,6 +19,6 @@ declare const __propDef: {
19
19
  export type LineXProps = typeof __propDef.props;
20
20
  export type LineXEvents = typeof __propDef.events;
21
21
  export type LineXSlots = typeof __propDef.slots;
22
- export default class LineX extends SvelteComponent<LineXProps, LineXEvents, LineXSlots> {
22
+ export default class LineX extends SvelteComponentTyped<LineXProps, LineXEvents, LineXSlots> {
23
23
  }
24
24
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { MarkProps, BaseMarkStyleProps, ChannelAccessor, Curve } from '../types.js';
3
3
  export type LineYMarkProps = MarkProps & BaseMarkStyleProps & {
4
4
  data: RawValue[];
@@ -20,6 +20,6 @@ declare const __propDef: {
20
20
  export type LineYProps = typeof __propDef.props;
21
21
  export type LineYEvents = typeof __propDef.events;
22
22
  export type LineYSlots = typeof __propDef.slots;
23
- export default class LineY extends SvelteComponent<LineYProps, LineYEvents, LineYSlots> {
23
+ export default class LineY extends SvelteComponentTyped<LineYProps, LineYEvents, LineYSlots> {
24
24
  }
25
25
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { RuleXMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: RuleXMarkProps;
@@ -10,6 +10,6 @@ declare const __propDef: {
10
10
  export type RuleXProps = typeof __propDef.props;
11
11
  export type RuleXEvents = typeof __propDef.events;
12
12
  export type RuleXSlots = typeof __propDef.slots;
13
- export default class RuleX extends SvelteComponent<RuleXProps, RuleXEvents, RuleXSlots> {
13
+ export default class RuleX extends SvelteComponentTyped<RuleXProps, RuleXEvents, RuleXSlots> {
14
14
  }
15
15
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { RuleYMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: RuleYMarkProps;
@@ -10,6 +10,6 @@ declare const __propDef: {
10
10
  export type RuleYProps = typeof __propDef.props;
11
11
  export type RuleYEvents = typeof __propDef.events;
12
12
  export type RuleYSlots = typeof __propDef.slots;
13
- export default class RuleY extends SvelteComponent<RuleYProps, RuleYEvents, RuleYSlots> {
13
+ export default class RuleY extends SvelteComponentTyped<RuleYProps, RuleYEvents, RuleYSlots> {
14
14
  }
15
15
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type SymbolLegendProps = typeof __propDef.props;
10
10
  export type SymbolLegendEvents = typeof __propDef.events;
11
11
  export type SymbolLegendSlots = typeof __propDef.slots;
12
- export default class SymbolLegend extends SvelteComponent<SymbolLegendProps, SymbolLegendEvents, SymbolLegendSlots> {
12
+ export default class SymbolLegend extends SvelteComponentTyped<SymbolLegendProps, SymbolLegendEvents, SymbolLegendSlots> {
13
13
  }
14
14
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { TickMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: TickMarkProps;
@@ -10,6 +10,6 @@ declare const __propDef: {
10
10
  export type TickXProps = typeof __propDef.props;
11
11
  export type TickXEvents = typeof __propDef.events;
12
12
  export type TickXSlots = typeof __propDef.slots;
13
- export default class TickX extends SvelteComponent<TickXProps, TickXEvents, TickXSlots> {
13
+ export default class TickX extends SvelteComponentTyped<TickXProps, TickXEvents, TickXSlots> {
14
14
  }
15
15
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponent } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { TickMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: TickMarkProps;
@@ -10,6 +10,6 @@ declare const __propDef: {
10
10
  export type TickYProps = typeof __propDef.props;
11
11
  export type TickYEvents = typeof __propDef.events;
12
12
  export type TickYSlots = typeof __propDef.slots;
13
- export default class TickY extends SvelteComponent<TickYProps, TickYEvents, TickYSlots> {
13
+ export default class TickY extends SvelteComponentTyped<TickYProps, TickYEvents, TickYSlots> {
14
14
  }
15
15
  export {};
@@ -1,3 +1,3 @@
1
- import type { TransformArg } from "../types.js";
1
+ import type { TransformArg } from '../types.js';
2
2
  export declare function recordizeX({ data, ...channels }: TransformArg): TransformArg;
3
3
  export declare function recordizeY({ data, ...channels }: TransformArg): TransformArg;
@@ -1,13 +1,17 @@
1
- import isDataRecord from "../helpers/isDataRecord.js";
1
+ import isDataRecord from '../helpers/isDataRecord.js';
2
2
  // This transform takes an array of raw values as input and returns
3
3
  export function recordizeX({ data, ...channels }) {
4
4
  const dataIsRawValueArray = !isDataRecord(data[0]);
5
5
  if (dataIsRawValueArray) {
6
6
  return {
7
- data: data.map((value, index) => ({ __value: value, __index: index, ___orig___: value })),
7
+ data: data.map((value, index) => ({
8
+ __value: value,
9
+ __index: index,
10
+ ___orig___: value
11
+ })),
8
12
  ...channels,
9
13
  x: '__value',
10
- y: '__index',
14
+ y: '__index'
11
15
  };
12
16
  }
13
17
  return { data, ...channels };
@@ -18,10 +22,14 @@ export function recordizeY({ data, ...channels }) {
18
22
  const dataIsRawValueArray = !isDataRecord(data[0]);
19
23
  if (dataIsRawValueArray) {
20
24
  return {
21
- data: data.map((value, index) => ({ __value: value, __index: index, ___orig___: value })),
25
+ data: data.map((value, index) => ({
26
+ __value: value,
27
+ __index: index,
28
+ ___orig___: value
29
+ })),
22
30
  ...channels,
23
31
  x: '__index',
24
- y: '__value',
32
+ y: '__value'
25
33
  };
26
34
  }
27
35
  return { data, ...channels };
@@ -1,4 +1,4 @@
1
- import type { ChannelName, TransformArg } from "../types.js";
1
+ import type { ChannelName, TransformArg } from '../types.js';
2
2
  type RenameChannelsOptions = Record<ChannelName, ChannelName>;
3
3
  export declare function renameChannels({ data, ...channels }: TransformArg, options: RenameChannelsOptions): TransformArg;
4
4
  export {};
@@ -13,7 +13,7 @@ const STACK_ORDER = {
13
13
  none: stackOrderNone,
14
14
  sum: stackOrderAscending,
15
15
  appearance: stackOrderAppearance,
16
- "inside-out": stackOrderInsideOut,
16
+ 'inside-out': stackOrderInsideOut
17
17
  };
18
18
  const STACK_OFFSET = {
19
19
  none: null,
@@ -26,7 +26,9 @@ function stackXY(byDim, data, channels, options) {
26
26
  const secondDim = byDim === 'x' ? 'y' : 'x';
27
27
  const byLow = `${byDim}1`;
28
28
  const byHigh = `${byDim}2`;
29
- if (channels[byDim] !== undefined && channels[`${byLow}`] === undefined && channels[`${byHigh}`] === undefined) {
29
+ if (channels[byDim] !== undefined &&
30
+ channels[`${byLow}`] === undefined &&
31
+ channels[`${byHigh}`] === undefined) {
30
32
  const resolvedData = data.map((d) => ({
31
33
  ...(isDataRecord(d) ? d : { __orig: d }),
32
34
  [`__${secondDim}`]: resolveChannel(secondDim, d, channels),
@@ -42,7 +44,7 @@ function stackXY(byDim, data, channels, options) {
42
44
  .order(stackOrder)
43
45
  .offset(STACK_OFFSET[options.offset])
44
46
  .keys(union(resolvedData.map((d) => d.__group)))
45
- .value(([, group], key) => group.get(key) ? group.get(key)[`__${byDim}`] : 0)(indexed);
47
+ .value(([, group], key) => (group.get(key) ? group.get(key)[`__${byDim}`] : 0))(indexed);
46
48
  const newData = series
47
49
  .map((values) => {
48
50
  const groupKey = values.key;
@@ -55,7 +57,12 @@ function stackXY(byDim, data, channels, options) {
55
57
  })
56
58
  .flat(1);
57
59
  console.log({ newData });
58
- return { data: newData, ...channels, [byDim]: undefined, ...{ [byLow]: `__${byLow}`, [byHigh]: `__${byHigh}` } };
60
+ return {
61
+ data: newData,
62
+ ...channels,
63
+ [byDim]: undefined,
64
+ ...{ [byLow]: `__${byLow}`, [byHigh]: `__${byHigh}` }
65
+ };
59
66
  }
60
67
  return { data, ...channels };
61
68
  }
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { SCALE_TYPES } from './contants.js';
3
- import type { Plot } from './classes/Plot.svelte';
3
+ import type { Plot } from './classes/Plot.svelte.js';
4
4
  import type { MouseEventHandler } from 'svelte/elements';
5
5
  export type ScaleName = 'opacity' | 'color' | 'x' | 'y' | 'angle' | 'radius' | 'symbol' | 'width' | 'fontSize';
6
6
  export type Datasets = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.0.1-alpha.16",
3
+ "version": "0.0.1-alpha.18",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build",
@@ -26,14 +26,12 @@
26
26
  "!dist/**/*.test.*",
27
27
  "!dist/**/*.spec.*"
28
28
  ],
29
- "peerDependencies": {
30
- "svelte": "^4.0.0"
31
- },
32
29
  "devDependencies": {
33
30
  "@playwright/test": "^1.40.1",
34
31
  "@sveltejs/adapter-auto": "^3.1.0",
35
32
  "@sveltejs/kit": "^2.3.2",
36
33
  "@types/chroma-js": "^2.4.3",
34
+ "@types/d3-dsv": "^3.0.7",
37
35
  "@types/d3-interpolate": "^3.0.4",
38
36
  "@types/d3-random": "^3.0.3",
39
37
  "@types/d3-scale-chromatic": "^3.0.3",