@rokkit/chart 1.0.0-next.32 → 1.0.0-next.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/chart",
3
- "version": "1.0.0-next.32",
3
+ "version": "1.0.0-next.35",
4
4
  "description": "Components for making interactive charts.",
5
5
  "author": "Jerry Thomas <me@jerrythomas.name>",
6
6
  "license": "MIT",
@@ -13,26 +13,27 @@
13
13
  "access": "public"
14
14
  },
15
15
  "devDependencies": {
16
- "@sveltejs/vite-plugin-svelte": "^2.4.1",
17
- "@testing-library/svelte": "^3.2.2",
18
- "@vitest/ui": "~0.31.1",
16
+ "@sveltejs/vite-plugin-svelte": "^2.4.2",
17
+ "@testing-library/svelte": "^4.0.3",
18
+ "@vitest/ui": "~0.32.3",
19
19
  "js-yaml": "^4.1.0",
20
20
  "jsdom": "^22.1.0",
21
- "svelte": "^3.59.1",
22
- "typescript": "^5.0.4",
21
+ "svelte": "^4.0.1",
22
+ "typescript": "^5.1.6",
23
23
  "vite": "^4.3.9",
24
- "vitest": "~0.31.1",
25
- "shared-config": "1.0.0-next.32"
24
+ "vitest": "~0.32.3",
25
+ "shared-config": "1.0.0-next.35"
26
26
  },
27
27
  "dependencies": {
28
- "d3-array": "^3.2.3",
28
+ "d3-array": "^3.2.4",
29
29
  "d3-collection": "^1.0.7",
30
30
  "d3-scale": "^4.0.2",
31
31
  "d3-shape": "^3.2.0",
32
32
  "date-fns": "^2.30.0",
33
33
  "ramda": "^0.29.0",
34
+ "rokkit": "latest",
34
35
  "yootils": "^0.3.1",
35
- "@rokkit/core": "1.0.0-next.32"
36
+ "@rokkit/core": "1.0.0-next.35"
36
37
  },
37
38
  "files": [
38
39
  "src/**/*.js",
@@ -73,7 +73,7 @@
73
73
  <title>A swatch with label {label}</title>
74
74
  {/if}
75
75
 
76
- {#each data as { cx, cy, r, type }, i}
76
+ {#each data as { cx, cy, type }, i}
77
77
  <Symbol
78
78
  x={cx}
79
79
  y={cy}
@@ -34,4 +34,7 @@
34
34
  on:mouseover
35
35
  on:mouseleave
36
36
  on:focus
37
+ role="option"
38
+ aria-selected={false}
39
+ tabindex="0"
37
40
  />
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { createEventDispatcher } from 'svelte'
3
- import { elapsed, timer } from '../lib/timer.js'
3
+ import { elapsed, timer } from '@rokkit/stores'
4
4
 
5
5
  const dispatch = createEventDispatcher()
6
6
 
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // export { aes } from './lib/aes'
2
2
  // export { timelapse } from './lib/timelapse'
3
3
  // export { axisTicks } from './lib/axis'
4
- export { timer, elapsed } from './lib/timer'
4
+ // export { timer, elapsed } from './lib/timer'
5
5
  // export { default as Chart } from './chart/Chart.svelte'
6
6
  // export { default as Axis } from './chart/Axis.svelte'
7
7
  export { default as Swatch } from './chart/Swatch.svelte'
@@ -29,7 +29,7 @@
29
29
 
30
30
  <svg viewBox="0 0 {width} {height}">
31
31
  {#if Array.isArray(data)}
32
- {#each data as item, i}
32
+ {#each data as item}
33
33
  {#if item.rank < limit}
34
34
  <Bar {...item} fill={colors[item.name]} {scales} />
35
35
  {/if}
@@ -6,6 +6,6 @@
6
6
  // $: console.log(data)
7
7
  </script>
8
8
 
9
- {#each data as { x, curve }, i}
9
+ {#each data as { x, curve }}
10
10
  <path d={curve} transform="translate({x},0)" fill="gray" stroke="none" />
11
11
  {/each}
package/src/lib/timer.js DELETED
@@ -1,44 +0,0 @@
1
- import { writable } from 'svelte/store'
2
-
3
- let req
4
- let prev
5
- const elapsed = writable(0)
6
-
7
- const tick = (timestamp) => {
8
- if (!prev) prev = timestamp
9
- const diff = Math.round(timestamp - prev)
10
-
11
- if (diff > 0) {
12
- prev = timestamp
13
- }
14
- elapsed.update((e) => e + diff)
15
- req = window.requestAnimationFrame(tick)
16
- }
17
-
18
- const timer = {
19
- start() {
20
- if (typeof window === 'undefined') return
21
- else if (!req) {
22
- prev = null
23
- req = window.requestAnimationFrame(tick)
24
- }
25
- },
26
- stop() {
27
- if (typeof window === 'undefined') return
28
- else if (req) {
29
- window.cancelAnimationFrame(req)
30
- req = null
31
- }
32
- },
33
- toggle() {
34
- req ? timer.stop() : timer.start()
35
- },
36
- set(val) {
37
- if (typeof val === 'number') elapsed.set(val)
38
- },
39
- reset() {
40
- timer.set(0)
41
- }
42
- }
43
-
44
- export { timer, elapsed }