layerchart 0.22.0 → 0.22.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.
@@ -2,7 +2,7 @@
2
2
  // export { Svg, Html };
3
3
  // TODO: Workaround for sveld error: `Cannot read properties of null (reading 'type')` in `ComponentParser`
4
4
  // See: https://github.com/carbon-design-system/sveld/issues/104
5
- import { LayerCake, Svg as _Svg, Html as _Html, Canvas as _Canvas, WebGL as _WebGL } from 'layercake';
5
+ import { LayerCake, Svg as _Svg, Html as _Html, Canvas as _Canvas, WebGL as _WebGL, } from 'layercake';
6
6
  export const Svg = _Svg;
7
7
  export const Html = _Html;
8
8
  export const Canvas = _Canvas;
@@ -80,6 +80,8 @@ export let geo = undefined;
80
80
  let:element
81
81
  let:xScale
82
82
  let:yScale
83
+ let:zScale
84
+ let:rScale
83
85
  >
84
86
  <GeoContext {...geo} let:projection>
85
87
  {#if tooltip}
@@ -95,6 +97,8 @@ export let geo = undefined;
95
97
  {tooltip}
96
98
  {xScale}
97
99
  {yScale}
100
+ {zScale}
101
+ {rScale}
98
102
  />
99
103
  </TooltipContext>
100
104
  {:else}
@@ -108,6 +112,8 @@ export let geo = undefined;
108
112
  {projection}
109
113
  {xScale}
110
114
  {yScale}
115
+ {zScale}
116
+ {rScale}
111
117
  />
112
118
  {/if}
113
119
  </GeoContext>
@@ -33,6 +33,8 @@ declare const __propDef: {
33
33
  projection: import("d3-geo").GeoProjection | import("d3-geo").GeoIdentityTransform;
34
34
  xScale: any;
35
35
  yScale: any;
36
+ zScale: any;
37
+ rScale: any;
36
38
  };
37
39
  };
38
40
  };
@@ -163,9 +163,9 @@ $: if ($tooltip.data) {
163
163
  <Rect
164
164
  spring
165
165
  {..._area}
166
- fill="rgba(0,0,0,.1)"
167
- on:click
168
166
  {...typeof area === 'object' ? area : null}
167
+ class={cls(!area.fill && 'fill-black/5', typeof area === 'object' ? area.class : null)}
168
+ on:click
169
169
  />
170
170
  </slot>
171
171
  {/if}
@@ -179,8 +179,11 @@ $: if ($tooltip.data) {
179
179
  y1={line.y1}
180
180
  x2={line.x2}
181
181
  y2={line.y2}
182
- class="stroke-black/50 stroke-2 [stroke-dasharray:2,2] pointer-events-none"
183
182
  {...typeof lines === 'object' ? lines : null}
183
+ class={cls(
184
+ 'stroke-black/20 stroke-2 [stroke-dasharray:2,2] pointer-events-none',
185
+ typeof lines === 'object' ? lines.class : null
186
+ )}
184
187
  />
185
188
  {/each}
186
189
  </slot>
@@ -197,11 +200,12 @@ $: if ($tooltip.data) {
197
200
  cy={point.y}
198
201
  r={4}
199
202
  {fill}
203
+ {...typeof points === 'object' ? points : null}
200
204
  class={cls(
201
205
  'stroke-[6] stroke-white [paint-order:stroke] drop-shadow',
202
- !fill && 'fill-accent-500'
206
+ !fill && 'fill-accent-500',
207
+ typeof points === 'object' ? points.class : null
203
208
  )}
204
- {...typeof points === 'object' ? points : null}
205
209
  />
206
210
  {/each}
207
211
  </slot>
@@ -3,7 +3,7 @@ import { motionStore } from '../stores/motionStore';
3
3
  export let x1;
4
4
  export let initialX1 = x1;
5
5
  export let y1;
6
- export let initialY1 = x1;
6
+ export let initialY1 = y1;
7
7
  export let x2;
8
8
  export let initialX2 = x2;
9
9
  export let y2;
@@ -3,3 +3,10 @@
3
3
  * see: https://svelte.dev/examples#easing
4
4
  */
5
5
  export declare function getEasingPath(easing: (t: number) => number, count?: number): string;
6
+ /** Create circle using path data. Useful for labels. See also d3-shape's arc */
7
+ export declare function circlePath(dimensions: {
8
+ cx: number;
9
+ cy: number;
10
+ r: number;
11
+ sweep?: 'inside' | 'outside';
12
+ }): string;
@@ -12,3 +12,13 @@ export function getEasingPath(easing, count = 1000) {
12
12
  }
13
13
  return pathData;
14
14
  }
15
+ /** Create circle using path data. Useful for labels. See also d3-shape's arc */
16
+ export function circlePath(dimensions) {
17
+ // sweep: 0 (inside), 1 (outside)
18
+ const { cx, cy, r, sweep = 'outside' } = dimensions;
19
+ return `
20
+ M ${cx - r} ${cy}
21
+ a ${r},${r} 0 1,${sweep} ${r * 2},0
22
+ a ${r},${r} 0 1,${sweep} -${r * 2},0
23
+ `;
24
+ }
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.22.0",
6
+ "version": "0.22.2",
7
7
  "scripts": {
8
8
  "dev": "vite dev",
9
9
  "build": "vite build",
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@rollup/plugin-dsv": "^3.0.2",
24
- "@sveltejs/adapter-vercel": "^3.0.2",
25
- "@sveltejs/kit": "^1.22.3",
24
+ "@sveltejs/adapter-vercel": "^3.0.3",
25
+ "@sveltejs/kit": "^1.22.4",
26
26
  "@sveltejs/package": "^2.2.0",
27
27
  "@svitejs/changesets-changelog-github-compact": "^1.1.0",
28
28
  "@tailwindcss/typography": "^0.5.9",
@@ -46,7 +46,7 @@
46
46
  "execa": "^7.2.0",
47
47
  "marked": "^5.1.2",
48
48
  "mdsvex": "^0.11.0",
49
- "prettier": "^3.0.0",
49
+ "prettier": "^3.0.1",
50
50
  "prettier-plugin-svelte": "^3.0.3",
51
51
  "prism-themes": "^1.9.0",
52
52
  "rehype-slug": "^5.1.0",
@@ -58,7 +58,7 @@
58
58
  "typescript": "^5.1.6",
59
59
  "unist-util-visit": "^5.0.0",
60
60
  "us-atlas": "^3.0.1",
61
- "vite": "^4.4.7",
61
+ "vite": "^4.4.9",
62
62
  "vite-plugin-sveld": "^1.1.0"
63
63
  },
64
64
  "type": "module",
@@ -85,7 +85,7 @@
85
85
  "lodash-es": "^4.17.21",
86
86
  "shapefile": "^0.6.6",
87
87
  "svelte": "^3.59.1",
88
- "svelte-ux": "^0.47.3",
88
+ "svelte-ux": "^0.47.4",
89
89
  "topojson-client": "^3.1.0"
90
90
  },
91
91
  "main": "./dist/index.js",