layerchart 0.14.1 → 0.14.2

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.
@@ -11,8 +11,8 @@ export let title = '';
11
11
  export let width = 320;
12
12
  export let height = 10;
13
13
  export let ticks = width / 64;
14
- export let tickFormat;
15
- export let tickValues;
14
+ export let tickFormat = undefined;
15
+ export let tickValues = undefined;
16
16
  export let tickFontSize = 10;
17
17
  export let tickSize = 4;
18
18
  export let placement = undefined;
@@ -120,44 +120,46 @@ else {
120
120
  {...$$restProps}
121
121
  >
122
122
  <div class={cls('text-[10px] font-semibold', classes.title)}>{title}</div>
123
- <svg
124
- {width}
125
- height={height + tickSize + tickFontSize}
126
- viewBox="0 0 {width} {height + tickSize + tickFontSize}"
127
- class="overflow-visible"
128
- >
129
- <g>
130
- {#if interpolator}
131
- <ColorRamp {width} {height} {interpolator} />
132
- {:else if swatches}
133
- {#each swatches as swatch, i}
134
- <rect {...swatch} />
135
- {/each}
136
- {/if}
137
- </g>
123
+ <slot values={tickValues} {scale}>
124
+ <svg
125
+ {width}
126
+ height={height + tickSize + tickFontSize}
127
+ viewBox="0 0 {width} {height + tickSize + tickFontSize}"
128
+ class="overflow-visible"
129
+ >
130
+ <g>
131
+ {#if interpolator}
132
+ <ColorRamp {width} {height} {interpolator} />
133
+ {:else if swatches}
134
+ {#each swatches as swatch, i}
135
+ <rect {...swatch} />
136
+ {/each}
137
+ {/if}
138
+ </g>
138
139
 
139
- <g>
140
- {#each tickValues ?? xScale?.ticks?.(ticks) ?? [] as tick, i}
141
- <text
142
- text-anchor="middle"
143
- x={xScale(tick) + tickLabelOffset}
144
- y={height + tickSize + tickFontSize}
145
- style:font-size={tickFontSize}
146
- class={classes.label}
147
- >
148
- {tickFormat ? format(tick, tickFormat) : tick}
149
- </text>
140
+ <g>
141
+ {#each tickValues ?? xScale?.ticks?.(ticks) ?? [] as tick, i}
142
+ <text
143
+ text-anchor="middle"
144
+ x={xScale(tick) + tickLabelOffset}
145
+ y={height + tickSize + tickFontSize}
146
+ style:font-size={tickFontSize}
147
+ class={classes.label}
148
+ >
149
+ {tickFormat ? format(tick, tickFormat) : tick}
150
+ </text>
150
151
 
151
- {#if tickLine}
152
- <line
153
- x1={xScale(tick)}
154
- y1={0}
155
- x2={xScale(tick)}
156
- y2={height + tickSize}
157
- class={cls('stroke-black', classes.tick)}
158
- />
159
- {/if}
160
- {/each}
161
- </g>
162
- </svg>
152
+ {#if tickLine}
153
+ <line
154
+ x1={xScale(tick)}
155
+ y1={0}
156
+ x2={xScale(tick)}
157
+ y2={height + tickSize}
158
+ class={cls('stroke-black', classes.tick)}
159
+ />
160
+ {/if}
161
+ {/each}
162
+ </g>
163
+ </svg>
164
+ </slot>
163
165
  </div>
@@ -7,8 +7,8 @@ declare const __propDef: {
7
7
  width?: number | undefined;
8
8
  height?: number | undefined;
9
9
  ticks?: number | undefined;
10
- tickFormat: FormatType;
11
- tickValues: any[];
10
+ tickFormat?: any;
11
+ tickValues?: any[] | undefined;
12
12
  tickFontSize?: number | undefined;
13
13
  tickSize?: number | undefined;
14
14
  placement?: ("left" | "right" | "top" | "center" | "top-left" | "top-right" | "bottom-left" | "bottom" | "bottom-right") | undefined;
@@ -22,7 +22,12 @@ declare const __propDef: {
22
22
  events: {
23
23
  [evt: string]: CustomEvent<any>;
24
24
  };
25
- slots: {};
25
+ slots: {
26
+ default: {
27
+ values: any[] | undefined;
28
+ scale: any;
29
+ };
30
+ };
26
31
  };
27
32
  export type LegendProps = typeof __propDef.props;
28
33
  export type LegendEvents = typeof __propDef.events;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Sean Lynch <techniq35@gmail.com>",
4
4
  "license": "MIT",
5
5
  "repository": "techniq/layerchart",
6
- "version": "0.14.1",
6
+ "version": "0.14.2",
7
7
  "scripts": {
8
8
  "dev": "vite dev",
9
9
  "build": "vite build",