svelteplot 0.0.1-alpha.6 → 0.0.1-alpha.7

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/Plot.svelte CHANGED
@@ -1,11 +1,7 @@
1
1
  <script>import { setContext } from "svelte";
2
- import { Frame, GridX, GridY } from "./";
2
+ import { Frame, GridX, GridY, AxisX, AxisY, ColorLegend, SymbolLegend } from "./index.js";
3
3
  import { DEFAULT_PLOT_OPTIONS, Plot } from "./classes/Plot.svelte";
4
4
  import mergeDeep from "./helpers/mergeDeep.js";
5
- import AxisX from "./marks/AxisX.svelte";
6
- import AxisY from "./marks/AxisY.svelte";
7
- import ColorLegend from "./marks/ColorLegend.svelte";
8
- import SymbolLegend from "./marks/SymbolLegend.svelte";
9
5
  let {
10
6
  // snippets
11
7
  header,
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { PlotProps } from './types';
2
+ import type { PlotProps } from './types.js';
3
3
  declare const __propDef: {
4
4
  props: PlotProps;
5
5
  events: {
@@ -1,6 +1,6 @@
1
1
  import resolveChannel from '../helpers/resolveChannel.js';
2
2
  import { extent } from 'd3-array';
3
- import { MARK_PROP_CHANNEL, CHANNEL_TYPES } from '../contants';
3
+ import { MARK_PROP_CHANNEL } from '../contants.js';
4
4
  import { isBooleanOrNull, isColorOrNull, isDateOrNull, isNumberOrNull, isStringOrNull } from '../helpers/typeChecks.js';
5
5
  import { uniq } from 'underscore';
6
6
  export class Channel {
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { DataRow } from '../types';
2
+ import type { DataRow } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  data: DataRow[];
@@ -1,5 +1,5 @@
1
1
  import { interpolateBrBG } from 'd3-scale-chromatic';
2
- import type { ColorScheme } from '../types';
2
+ import type { ColorScheme } from '../types.js';
3
3
  export declare const categoricalSchemes: Map<string, readonly string[]>;
4
4
  export declare function isCategoricalScheme(scheme: string): boolean;
5
5
  type SchemeGetter = (n: number) => readonly string[];
@@ -1,2 +1,2 @@
1
- import type { ChannelAccessor, MarkStyleProps, DataRow } from '../types';
1
+ import type { ChannelAccessor, MarkStyleProps, DataRow } from '../types.js';
2
2
  export default function (datum: DataRow, props: Partial<Record<MarkStyleProps, ChannelAccessor>>): string;
@@ -1,2 +1,2 @@
1
- import type { DataRecord } from '../types';
1
+ import type { DataRecord } from '../types.js';
2
2
  export default function (value: any): value is DataRecord;
@@ -1,4 +1,4 @@
1
- import type { RawValue } from '../types';
1
+ import type { RawValue } from '../types.js';
2
2
  export declare function isBooleanOrNull(v: RawValue): boolean;
3
3
  export declare function isDateOrNull(v: RawValue): boolean;
4
4
  export declare function isNumberOrNull(v: RawValue): boolean;
@@ -1,2 +1,2 @@
1
- import type { DataRow } from '../types';
2
- export default function (data: DataRow[]): (Date | [number, number] | import("../types").DataRecord)[];
1
+ import type { DataRow } from '../types.js';
2
+ export default function (data: DataRow[]): (Date | [number, number] | import("../types.js").DataRecord)[];
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { AxisMarkOptions } from '../types';
2
+ import type { AxisMarkOptions } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: AxisMarkOptions & {
5
5
  anchor?: "bottom" | "top" | undefined;
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { AxisYMarkProps } from '../types';
2
+ import type { AxisYMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: AxisYMarkProps;
5
5
  events: {
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { BaseMarkProps } from '../types';
2
+ import type { BaseMarkProps } from '../types.js';
3
3
  declare class __sveltets_Render<T extends BaseMarkProps> {
4
4
  props(): T & {
5
5
  children?: Function | undefined;
@@ -5,29 +5,29 @@ const plot = getContext("svelteplot");
5
5
  </script>
6
6
 
7
7
  {#if plot.color.manualActiveMarks.length > 0}
8
- <div class="color-legend">
9
- {#each plot.colorScale.domain() as value}
10
- {@const symbolV = plot.symbolScale(value)}
11
- {@const symbolType = maybeSymbol(symbolV)}
12
- <div class="item">
13
- <div class="swatch">
14
- <svg width="15" height="15"
15
- >{#if plot.colorSymbolRedundant}
16
- <path
17
- transform="translate(7.5,7.5)"
18
- fill={plot.hasFilledDotMarks ? plot.colorScale(value) : 'none'}
19
- stroke={plot.hasFilledDotMarks ? null : plot.colorScale(value)}
20
- d={d3Symbol(symbolType, 40)()}
21
- />
22
- {:else}
23
- <rect fill={plot.colorScale(value)} width="15" height="15" />
24
- {/if}</svg
25
- >
8
+ <div class="color-legend">
9
+ {#each plot.colorScale.domain() as value}
10
+ {@const symbolV = plot.symbolScale(value)}
11
+ {@const symbolType = maybeSymbol(symbolV)}
12
+ <div class="item">
13
+ <div class="swatch">
14
+ <svg width="15" height="15"
15
+ >{#if plot.colorSymbolRedundant}
16
+ <path
17
+ transform="translate(7.5,7.5)"
18
+ fill={plot.hasFilledDotMarks ? plot.colorScale(value) : 'none'}
19
+ stroke={plot.hasFilledDotMarks ? null : plot.colorScale(value)}
20
+ d={d3Symbol(symbolType, 40)()}
21
+ />
22
+ {:else}
23
+ <rect fill={plot.colorScale(value)} width="15" height="15" />
24
+ {/if}</svg
25
+ >
26
+ </div>
27
+ <span class="item-label">{value}</span>
26
28
  </div>
27
- <span class="item-label">{value}</span>
28
- </div>
29
- {/each}
30
- </div>
29
+ {/each}
30
+ </div>
31
31
  {/if}
32
32
 
33
33
  <style>
@@ -40,7 +40,9 @@ const plot = getContext("svelteplot");
40
40
  .item {
41
41
  margin: 0 1em 0.5ex 0;
42
42
  }
43
- path { stroke-width: 1.5;}
43
+ path {
44
+ stroke-width: 1.5;
45
+ }
44
46
  .item,
45
47
  .item-label,
46
48
  .swatch {
@@ -30,10 +30,10 @@ function isValid(value) {
30
30
  {data}
31
31
  channels={[
32
32
  ...(x ? ['x'] : []),
33
- ...(y ? ['y'] : []),
34
- ...(r ? ['radius'] : []),
35
- ...(symbol ? ['symbol'] : []),
36
- ...(fill || stroke ? ['color']: [])
33
+ ...(y ? ['y'] : []),
34
+ ...(r ? ['radius'] : []),
35
+ ...(symbol ? ['symbol'] : []),
36
+ ...(fill || stroke ? ['color'] : [])
37
37
  ]}
38
38
  {x}
39
39
  {y}
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { DotMarkProps } from '../types';
2
+ import type { DotMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: DotMarkProps;
5
5
  events: {
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { RawValue } from '../types';
2
+ import type { RawValue } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  data: RawValue[];
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { RawValue } from '../types';
2
+ import type { RawValue } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  data: RawValue[];
@@ -1,7 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { FrameProps } from '../types';
2
+ import type { FrameProps } from '../types.js';
3
3
  declare const __propDef: {
4
- props: import("../types").BaseMarkStyleProps;
4
+ props: import("../types.js").BaseMarkStyleProps;
5
5
  events: {
6
6
  [evt: string]: CustomEvent<any>;
7
7
  };
@@ -1,8 +1,8 @@
1
1
  <script>import { getContext } from "svelte";
2
+ import { get } from "underscore";
2
3
  import BaseMark from "./BaseMark.svelte";
3
4
  import resolveChannel from "../helpers/resolveChannel.js";
4
5
  import getBaseStyles from "../helpers/getBaseStyles.js";
5
- import { get } from "underscore";
6
6
  const BaseMark_GridX = BaseMark;
7
7
  const plot = getContext("svelteplot");
8
8
  let {
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { GridOptions } from '../types';
2
+ import type { GridOptions } from '../types.js';
3
3
  declare const __propDef: {
4
- props: Partial<import("../types").MarkProps> & GridOptions & {
5
- y1?: import("../types").ChannelAccessor | undefined;
6
- y2?: import("../types").ChannelAccessor | undefined;
4
+ props: Partial<import("../types.js").MarkProps> & GridOptions & {
5
+ y1?: import("../types.js").ChannelAccessor | undefined;
6
+ y2?: import("../types.js").ChannelAccessor | undefined;
7
7
  automatic?: boolean | undefined;
8
8
  };
9
9
  events: {
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { GridYMarkProps } from '../types';
2
+ import type { GridYMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: GridYMarkProps;
5
5
  events: {
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { LineMarkProps } from '../types';
2
+ import type { LineMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: LineMarkProps;
5
5
  events: {
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { RawValue } from '../types';
2
+ import type { RawValue } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  data: RawValue[];
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { RawValue } from '../types';
2
+ import type { RawValue } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  data: RawValue[];
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { RuleXMarkProps } from '../types';
2
+ import type { RuleXMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: RuleXMarkProps;
5
5
  events: {
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { RuleYMarkProps } from '../types';
2
+ import type { RuleYMarkProps } from '../types.js';
3
3
  declare const __propDef: {
4
4
  props: RuleYMarkProps;
5
5
  events: {
@@ -5,28 +5,26 @@ const plot = getContext("svelteplot");
5
5
  </script>
6
6
 
7
7
  {#if plot.color.manualActiveMarks.length > 0 && !(plot.options.color?.legend && plot.colorSymbolRedundant)}
8
- <div class="symbol-legend">
9
- {#each plot.symbolScale.domain() as value}
10
- {@const symbolV = plot.symbolScale(value)}
11
- {@const symbolType = maybeSymbol(symbolV)}
12
- {@const color = plot.colorSymbolRedundant ? plot.colorScale(value) : 'currentColor'}
13
- <div class="item">
14
- <div class="swatch">
15
- <svg width="15" height="15"
16
- >
8
+ <div class="symbol-legend">
9
+ {#each plot.symbolScale.domain() as value}
10
+ {@const symbolV = plot.symbolScale(value)}
11
+ {@const symbolType = maybeSymbol(symbolV)}
12
+ {@const color = plot.colorSymbolRedundant ? plot.colorScale(value) : 'currentColor'}
13
+ <div class="item">
14
+ <div class="swatch">
15
+ <svg width="15" height="15">
17
16
  <path
18
17
  transform="translate(7.5,7.5)"
19
18
  fill={plot.hasFilledDotMarks ? color : 'none'}
20
19
  stroke={plot.hasFilledDotMarks ? null : color}
21
20
  d={d3Symbol(symbolType, 40)()}
22
21
  />
23
- </svg
24
- >
22
+ </svg>
23
+ </div>
24
+ <span class="item-label">{value}</span>
25
25
  </div>
26
- <span class="item-label">{value}</span>
27
- </div>
28
- {/each}
29
- </div>
26
+ {/each}
27
+ </div>
30
28
  {/if}
31
29
 
32
30
  <style>
@@ -38,7 +36,9 @@ const plot = getContext("svelteplot");
38
36
  .item {
39
37
  margin: 0 1em 0.5ex 0;
40
38
  }
41
- path { stroke-width: 1.5;}
39
+ path {
40
+ stroke-width: 1.5;
41
+ }
42
42
  .item,
43
43
  .item-label,
44
44
  .swatch {
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
- import type { CHANNEL_TYPES } from './contants';
2
+ import type { CHANNEL_TYPES } from './contants.js';
3
3
  import type { Plot } from './classes/Plot.svelte';
4
4
  import type { MouseEventHandler } from 'svelte/elements';
5
5
  export type Datasets = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.7",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build",