svelteplot 0.5.0-pr-233.0 → 0.5.0-pr-236.0

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.
@@ -1,6 +1,5 @@
1
1
  import type { ChannelName, Channels, RawValue } from '../types/index.js';
2
2
  import type { Snippet } from 'svelte';
3
- import type { TransitionConfig } from 'svelte/transition';
4
3
  /**
5
4
  * Returns first argument that is not null or undefined
6
5
  */
@@ -17,4 +16,3 @@ export declare function parseInset(inset: number | string, width: number): numbe
17
16
  export declare function omit<T extends {}, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
18
17
  export declare function identity<T>(x: T): T;
19
18
  export declare const GEOJSON_PREFER_STROKE: Set<string>;
20
- export declare function noTransition(node: Element): TransitionConfig;
@@ -61,14 +61,3 @@ export function identity(x) {
61
61
  return x;
62
62
  }
63
63
  export const GEOJSON_PREFER_STROKE = new Set(['MultiLineString', 'LineString']);
64
- export function noTransition(node) {
65
- node.dispatchEvent(new CustomEvent('introstart'));
66
- node.dispatchEvent(new CustomEvent('introend'));
67
- node.dispatchEvent(new CustomEvent('outrostart'));
68
- node.dispatchEvent(new CustomEvent('outroend'));
69
- return {
70
- duration: 0,
71
- delay: 0,
72
- css: () => ''
73
- };
74
- }
@@ -18,7 +18,6 @@
18
18
  import { autoTicks } from '../helpers/autoTicks.js';
19
19
  import { resolveScaledStyles } from '../helpers/resolve.js';
20
20
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
21
- import { identity, noTransition } from '../helpers';
22
21
 
23
22
  interface AxisXMarkProps
24
23
  extends Omit<
@@ -64,8 +63,6 @@
64
63
  textAnchor: 'auto',
65
64
  opacity: 0.8,
66
65
  anchor: 'bottom',
67
- tIn: [noTransition, {}],
68
- tOut: [noTransition, {}],
69
66
  ...getPlotDefaults().axis,
70
67
  ...getPlotDefaults().axisX
71
68
  };
@@ -239,9 +236,7 @@
239
236
  scaleFn={plot.scales.x.fn}
240
237
  scaleType={plot.scales.x.type}
241
238
  tickFormat={useTickFormat}
242
- title={useTitle}
243
- tIn={DEFAULTS.tIn}
244
- tOut={DEFAULTS.tOut} />
239
+ title={useTitle} />
245
240
  {/if}
246
241
  </Mark>
247
242
 
@@ -17,7 +17,6 @@
17
17
  import { autoTicks } from '../helpers/autoTicks.js';
18
18
  import { resolveScaledStyles } from '../helpers/resolve.js';
19
19
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
20
- import { noTransition } from '../helpers';
21
20
 
22
21
  interface AxisYMarkProps
23
22
  extends Omit<
@@ -62,8 +61,6 @@
62
61
  opacity: 0.8,
63
62
  anchor: 'left',
64
63
  textAnchor: 'auto',
65
- tIn: [noTransition, {}],
66
- tOut: [noTransition, {}],
67
64
  ...getPlotDefaults().axis,
68
65
  ...getPlotDefaults().axisY
69
66
  };
@@ -228,9 +225,7 @@
228
225
  scaleType={plot.scales.y.type}
229
226
  tickFormat={useTickFormat}
230
227
  title={useTitle}
231
- width={plot.facetWidth}
232
- tIn={DEFAULTS.tIn}
233
- tOut={DEFAULTS.tOut} />
228
+ width={plot.facetWidth} />
234
229
  {/if}
235
230
  </Mark>
236
231
 
@@ -19,7 +19,7 @@
19
19
  } from '../types/index.js';
20
20
  import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
21
21
  import { autoTicks } from '../helpers/autoTicks.js';
22
- import { noTransition, testFilter } from '../helpers/index.js';
22
+ import { testFilter } from '../helpers/index.js';
23
23
  import { RAW_VALUE } from '../transforms/recordize.js';
24
24
  import isDataRecord from '../helpers/isDataRecord';
25
25
  import { INDEX } from '../constants';
@@ -28,8 +28,6 @@
28
28
  let markProps: GridXMarkProps = $props();
29
29
 
30
30
  const DEFAULTS = {
31
- tIn: [noTransition, {}],
32
- tOut: [noTransition, {}],
33
31
  ...getPlotDefaults().grid,
34
32
  ...getPlotDefaults().gridX
35
33
  };
@@ -67,9 +65,6 @@
67
65
  isDataRecord(d) ? { ...d, [INDEX]: i } : { [RAW_VALUE]: d, [INDEX]: i }
68
66
  ) as DataRecord[]
69
67
  );
70
-
71
- const tInF = $derived(DEFAULTS.tIn?.[0] ?? noTransition);
72
- const tOutF = $derived(DEFAULTS.tOut?.[0] ?? noTransition);
73
68
  </script>
74
69
 
75
70
  <Mark
@@ -80,7 +75,7 @@
80
75
  {automatic}>
81
76
  {#snippet children({ usedScales })}
82
77
  <g class="grid-x">
83
- {#each ticks as tick (tick[RAW_VALUE])}
78
+ {#each ticks as tick, t (t)}
84
79
  {#if testFilter(tick, options)}
85
80
  {@const x =
86
81
  plot.scales.x.fn(tick[RAW_VALUE]) +
@@ -104,8 +99,6 @@
104
99
  true
105
100
  )}
106
101
  <line
107
- in:tInF|global={{ ...(DEFAULTS.tIn?.[1] ?? {}) }}
108
- out:tOutF|global={{ ...(DEFAULTS.tOut?.[1] ?? {}) }}
109
102
  class={styleClass}
110
103
  transform="translate({x + dx},{dy})"
111
104
  {style}
@@ -13,16 +13,13 @@
13
13
  import type { PlotContext, BaseMarkProps, RawValue, ChannelAccessor } from '../types/index.js';
14
14
  import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
15
15
  import { autoTicks } from '../helpers/autoTicks.js';
16
- import { noTransition, testFilter } from '../helpers/index.js';
16
+ import { testFilter } from '../helpers/index.js';
17
17
  import { RAW_VALUE } from '../transforms/recordize.js';
18
18
  import { getPlotDefaults } from '../hooks/plotDefaults.js';
19
- import { uniqBy } from 'es-toolkit';
20
19
 
21
20
  let markProps: GridYMarkProps = $props();
22
21
 
23
22
  const DEFAULTS = {
24
- tIn: [noTransition, {}],
25
- tOut: [noTransition, {}],
26
23
  ...getPlotDefaults().grid,
27
24
  ...getPlotDefaults().gridY
28
25
  };
@@ -57,9 +54,6 @@
57
54
  autoTickCount
58
55
  )
59
56
  );
60
-
61
- const tInF = $derived(DEFAULTS.tIn?.[0] ?? noTransition);
62
- const tOutF = $derived(DEFAULTS.tOut?.[0] ?? noTransition);
63
57
  </script>
64
58
 
65
59
  <Mark
@@ -70,7 +64,7 @@
70
64
  {automatic}>
71
65
  {#snippet children({ usedScales })}
72
66
  <g class="grid-y">
73
- {#each ticks as tick (tick)}
67
+ {#each ticks as tick, t (t)}
74
68
  {#if testFilter(tick, options)}
75
69
  {@const y =
76
70
  plot.scales.y.fn(tick) +
@@ -94,8 +88,6 @@
94
88
  true
95
89
  )}
96
90
  <line
97
- in:tInF|global={{ ...(DEFAULTS.tIn?.[1] ?? {}) }}
98
- out:tOutF|global={{ ...(DEFAULTS.tOut?.[1] ?? {}) }}
99
91
  {style}
100
92
  class={styleClass}
101
93
  transform="translate({dx},{y + dy})"
@@ -216,7 +216,7 @@
216
216
  markerEnd={args.markerEnd}
217
217
  marker={args.marker}
218
218
  strokeWidth={args.strokeWidth}
219
- datum={lineData[0]}
219
+ datum={lineData[0].datum}
220
220
  d={pathString}
221
221
  dInv={text ? linePath(lineData.toReversed()) : null}
222
222
  color={lineData[0].stroke || 'currentColor'}
@@ -225,7 +225,7 @@
225
225
  text={text ? resolveProp(text, lineData[0]) : null}
226
226
  startOffset={resolveProp(
227
227
  args.textStartOffset,
228
- lineData[0],
228
+ lineData[0].datum,
229
229
  '50%'
230
230
  )}
231
231
  {textStyle}
@@ -10,17 +10,13 @@
10
10
  PlotState,
11
11
  RawValue,
12
12
  ScaledDataRecord,
13
- ScaleType,
14
- TransitionArgs,
15
- TransitionFunction
13
+ ScaleType
16
14
  } from '../../types/index.js';
17
15
  import { resolveProp, resolveStyles } from '../../helpers/resolve.js';
18
16
  import { max } from 'd3-array';
19
- import { identity, noTransition, randomId, testFilter } from '../../helpers/index.js';
17
+ import { randomId, testFilter } from '../../helpers/index.js';
20
18
  import { INDEX } from '../../constants';
21
19
  import { RAW_VALUE } from '../../transforms/recordize';
22
- import { fade } from 'svelte/transition';
23
- import Transition from '../../../routes/examples/axis/transition.svelte';
24
20
 
25
21
  type BaseAxisXProps = {
26
22
  scaleFn: (d: RawValue) => number;
@@ -43,8 +39,6 @@
43
39
  };
44
40
  text: boolean;
45
41
  plot: PlotState;
46
- tIn?: [TransitionFunction?, TransitionArgs?];
47
- tOut?: [TransitionFunction?, TransitionArgs?];
48
42
  };
49
43
 
50
44
  let {
@@ -62,9 +56,7 @@
62
56
  options,
63
57
  plot,
64
58
  title,
65
- text = true,
66
- tIn = [],
67
- tOut = []
59
+ text = true
68
60
  }: BaseAxisXProps = $props();
69
61
 
70
62
  function splitTick(tick: string | string[]) {
@@ -157,9 +149,6 @@
157
149
  if ($autoMarginTop.has(id)) $autoMarginTop.delete(id);
158
150
  };
159
151
  });
160
-
161
- const tInF = $derived(tIn?.[0] ?? noTransition);
162
- const tOutF = $derived(tOut?.[0] ?? noTransition);
163
152
  </script>
164
153
 
165
154
  <g class="axis-x">
@@ -168,8 +157,6 @@
168
157
  {@const tickClass_ = resolveProp(tickClass, tick)}
169
158
  {@const tickFontSize_ = +resolveProp(tickFontSize, tick, 10)}
170
159
  <g
171
- in:tInF|global={{ ...(tIn?.[1] ?? {}) }}
172
- out:tOutF|global={{ ...(tOut?.[1] ?? {}) }}
173
160
  class="tick {tickClass_ || ''}"
174
161
  transform="translate({tick.x + tick.dx}, {tickY + tick.dy})"
175
162
  text-anchor={tickRotate < 0 ? 'end' : tickRotate > 0 ? 'start' : 'middle'}>
@@ -1,4 +1,4 @@
1
- import type { ChannelAccessor, ConstantAccessor, PlotState, RawValue, ScaleType, TransitionArgs, TransitionFunction } from '../../types/index.js';
1
+ import type { ChannelAccessor, ConstantAccessor, PlotState, RawValue, ScaleType } from '../../types/index.js';
2
2
  type BaseAxisXProps = {
3
3
  scaleFn: (d: RawValue) => number;
4
4
  scaleType: ScaleType;
@@ -20,8 +20,6 @@ type BaseAxisXProps = {
20
20
  };
21
21
  text: boolean;
22
22
  plot: PlotState;
23
- tIn?: [TransitionFunction?, TransitionArgs?];
24
- tOut?: [TransitionFunction?, TransitionArgs?];
25
23
  };
26
24
  declare const BaseAxisX: import("svelte").Component<BaseAxisXProps, {}, "">;
27
25
  type BaseAxisX = ReturnType<typeof BaseAxisX>;
@@ -1,16 +1,16 @@
1
1
  <script lang="ts">
2
2
  import { getContext, untrack } from 'svelte';
3
- import { identity, noTransition, randomId, testFilter } from '../../helpers/index.js';
3
+ import { randomId, testFilter } from '../../helpers/index.js';
4
4
  import { resolveProp, resolveStyles } from '../../helpers/resolve.js';
5
5
  import { max } from 'd3-array';
6
6
  import type {
7
7
  AutoMarginStores,
8
8
  ConstantAccessor,
9
+ DataRecord,
9
10
  PlotState,
10
11
  RawValue,
11
- ScaleType,
12
- TransitionArgs,
13
- TransitionFunction
12
+ ScaledDataRecord,
13
+ ScaleType
14
14
  } from '../../types/index.js';
15
15
  import { RAW_VALUE } from '../../transforms/recordize';
16
16
  import { INDEX } from '../../constants';
@@ -36,8 +36,6 @@
36
36
  };
37
37
  plot: PlotState;
38
38
  text: boolean | null;
39
- tIn?: [TransitionFunction?, TransitionArgs?];
40
- tOut?: [TransitionFunction?, TransitionArgs?];
41
39
  };
42
40
 
43
41
  let {
@@ -56,9 +54,7 @@
56
54
  title,
57
55
  plot,
58
56
  options,
59
- text = true,
60
- tIn = [],
61
- tOut = []
57
+ text = true
62
58
  }: BaseAxisYProps = $props();
63
59
 
64
60
  const LINE_ANCHOR = {
@@ -155,9 +151,6 @@
155
151
  if ($autoMarginTop.has(id)) $autoMarginTop.delete(id);
156
152
  };
157
153
  });
158
-
159
- const tInF = $derived(tIn?.[0] ?? noTransition);
160
- const tOutF = $derived(tOut?.[0] ?? noTransition);
161
154
  </script>
162
155
 
163
156
  <g class="axis-y">
@@ -178,8 +171,6 @@
178
171
  true
179
172
  )}
180
173
  <g
181
- in:tInF|global={{ ...(tIn?.[1] ?? {}) }}
182
- out:tOutF|global={{ ...(tOut?.[1] ?? {}) }}
183
174
  class="tick {tickClass_ || ''}"
184
175
  transform="translate({tick.dx +
185
176
  marginLeft +
@@ -1,4 +1,4 @@
1
- import type { ConstantAccessor, PlotState, RawValue, ScaleType, TransitionArgs, TransitionFunction } from '../../types/index.js';
1
+ import type { ConstantAccessor, PlotState, RawValue, ScaleType } from '../../types/index.js';
2
2
  type BaseAxisYProps = {
3
3
  scaleFn: (d: RawValue) => number;
4
4
  scaleType: ScaleType;
@@ -20,8 +20,6 @@ type BaseAxisYProps = {
20
20
  };
21
21
  plot: PlotState;
22
22
  text: boolean | null;
23
- tIn?: [TransitionFunction?, TransitionArgs?];
24
- tOut?: [TransitionFunction?, TransitionArgs?];
25
23
  };
26
24
  declare const BaseAxisY: import("svelte").Component<BaseAxisYProps, {}, "">;
27
25
  type BaseAxisY = ReturnType<typeof BaseAxisY>;
@@ -4,7 +4,6 @@ import type { MarkerShape } from '../marks/helpers/Marker.svelte';
4
4
  import type { Channels, ScaledChannelName } from './channel.js';
5
5
  import type { RawValue } from './data.js';
6
6
  import type { BaseMarkProps } from './mark.js';
7
- import type { TransitionConfig } from 'svelte/transition';
8
7
  export type GenericMarkOptions = Record<string | symbol, any>;
9
8
  export type CurveName = 'basis' | 'basis-closed' | 'basis-open' | 'bundle' | 'bump-x' | 'bump-y' | 'cardinal' | 'cardinal-closed' | 'cardinal-open' | 'catmull-rom' | 'catmull-rom-closed' | 'catmull-rom-open' | 'linear' | 'linear-closed' | 'monotone-x' | 'monotone-y' | 'natural' | 'step' | 'step-after' | 'step-before';
10
9
  export type MarkerOptions = {
@@ -50,12 +49,6 @@ export type MapIndexObject = {
50
49
  export type MapMethod = 'cumsum' | 'rank' | 'quantile' | ((I: number[], S: number[]) => number[]) | MapIndexObject;
51
50
  export type MapOptions = Partial<Record<ScaledChannelName, MapMethod>>;
52
51
  export type UsedScales = Record<ScaledChannelName, boolean>;
53
- export type TransitionFunction = (node: Element, params: any) => TransitionConfig;
54
- export type TransitionArgs = {
55
- delay?: number;
56
- duration?: number;
57
- easing?: (t: number) => number;
58
- };
59
52
  export * from './channel';
60
53
  export * from './colorScheme';
61
54
  export * from './data';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.5.0-pr-233.0",
3
+ "version": "0.5.0-pr-236.0",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",