layerchart 0.28.0-next.3 → 0.30.1

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,4 +1,5 @@
1
1
  <script>import { tick } from 'svelte';
2
+ import { cls } from 'svelte-ux';
2
3
  import { motionStore } from '../stores/motionStore';
3
4
  export let cx = 0;
4
5
  export let initialCx = cx;
@@ -22,7 +23,7 @@ $: tick().then(() => {
22
23
  cx={$tweened_cx}
23
24
  cy={$tweened_cy}
24
25
  r={$tweened_r}
25
- class="fill-surface-content"
26
+ class={cls($$props.fill === undefined && 'fill-surface-content')}
26
27
  {...$$restProps}
27
28
  on:click
28
29
  on:mousemove
@@ -3,6 +3,8 @@
3
3
  export let id = uniqueId('clipPath-');
4
4
  /** Use existing path or shape (by id) for clipPath */
5
5
  export let useId = undefined;
6
+ /** Disable clipping (show all) */
7
+ export let disabled = false;
6
8
  </script>
7
9
 
8
10
  <defs>
@@ -16,7 +18,11 @@ export let useId = undefined;
16
18
  </defs>
17
19
 
18
20
  {#if $$slots.default}
19
- <g style:clip-path="url(#{id})" on:click on:mousemove on:mouseleave on:keydown>
20
- <slot {id} url="url(#{id})" {useId} />
21
- </g>
21
+ {#if disabled}
22
+ <slot />
23
+ {:else}
24
+ <g style:clip-path="url(#{id})" on:click on:mousemove on:mouseleave on:keydown>
25
+ <slot {id} url="url(#{id})" {useId} />
26
+ </g>
27
+ {/if}
22
28
  {/if}
@@ -4,6 +4,7 @@ declare const __propDef: {
4
4
  [x: string]: any;
5
5
  id?: string | undefined;
6
6
  useId?: string | undefined;
7
+ disabled?: boolean | undefined;
7
8
  };
8
9
  events: {
9
10
  click: MouseEvent;
@@ -0,0 +1,12 @@
1
+ <script>import { geoCircle } from 'd3-geo';
2
+ import GeoPath from './GeoPath.svelte';
3
+ /** Radius in degrees. Default: 90 */
4
+ export let radius = 90;
5
+ /** Center point of circle in degree ([longitude, latitude]). Default [0, 0] */
6
+ export let center = [0, 0];
7
+ /** sets the circle precision to the specified angle in degrees */
8
+ export let precision = 6;
9
+ $: geojson = geoCircle().radius(radius).center(center).precision(precision)();
10
+ </script>
11
+
12
+ <GeoPath {geojson} {...$$restProps} />
@@ -0,0 +1,19 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ radius?: number | undefined;
6
+ center?: [number, number] | undefined;
7
+ precision?: number | undefined;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {};
13
+ };
14
+ export type GeoCircleProps = typeof __propDef.props;
15
+ export type GeoCircleEvents = typeof __propDef.events;
16
+ export type GeoCircleSlots = typeof __propDef.slots;
17
+ export default class GeoCircle extends SvelteComponentTyped<GeoCircleProps, GeoCircleEvents, GeoCircleSlots> {
18
+ }
19
+ export {};
@@ -1,4 +1,5 @@
1
1
  <script>import { tick } from 'svelte';
2
+ import { cls } from 'svelte-ux';
2
3
  import { motionStore } from '../stores/motionStore';
3
4
  export let x1;
4
5
  export let initialX1 = x1;
@@ -27,7 +28,7 @@ $: tick().then(() => {
27
28
  y1={$tweened_y1}
28
29
  x2={$tweened_x2}
29
30
  y2={$tweened_y2}
30
- class="stroke-surface-content"
31
+ class={cls($$props.stroke === undefined && 'stroke-surface-content')}
31
32
  {...$$restProps}
32
33
  on:click
33
34
  on:mousemove
@@ -19,10 +19,10 @@ declare const __propDef: {
19
19
  * value > 0: percent of `outerRadius`
20
20
  * value < 0: offset of `outerRadius`
21
21
  * default: yRange min
22
- */ innerRadius?: undefined;
22
+ */ innerRadius?: number | undefined;
23
23
  /**
24
24
  * Define outerRadius. Defaults to yRange max/2 (ie. chart height / 2)
25
- */ outerRadius?: undefined;
25
+ */ outerRadius?: number | undefined;
26
26
  cornerRadius?: number | undefined;
27
27
  padAngle?: number | undefined;
28
28
  spring?: boolean | Parameters<typeof springStore>[1];
@@ -1,4 +1,5 @@
1
1
  <script>import { tick } from 'svelte';
2
+ import { cls } from 'svelte-ux';
2
3
  import { motionStore, resolveOptions, } from '../stores/motionStore';
3
4
  export let x = 0;
4
5
  export let initialX = x;
@@ -28,7 +29,7 @@ $: tick().then(() => {
28
29
  y={$tweened_y}
29
30
  width={$tweened_width}
30
31
  height={$tweened_height}
31
- class="fill-surface-content"
32
+ class={cls($$props.fill === undefined && 'fill-surface-content')}
32
33
  {...$$restProps}
33
34
  on:click
34
35
  on:mouseover
@@ -130,7 +130,7 @@ function isValidXOrY(xOrY) {
130
130
  {transform}
131
131
  text-anchor={textAnchor}
132
132
  {...$$restProps}
133
- class={cls('fill-surface-content', $$props.class)}
133
+ class={cls($$props.fill === undefined && 'fill-surface-content', $$props.class)}
134
134
  >
135
135
  {#each wordsByLines as line, index}
136
136
  <tspan {x} dy={index === 0 ? startDy : lineHeight}>
@@ -13,6 +13,7 @@ export { default as CircleClipPath } from './CircleClipPath.svelte';
13
13
  export { default as ClipPath } from './ClipPath.svelte';
14
14
  export { default as ColorRamp } from './ColorRamp.svelte';
15
15
  export { default as Frame } from './Frame.svelte';
16
+ export { default as GeoCircle } from './GeoCircle.svelte';
16
17
  export { default as GeoContext, geoContext } from './GeoContext.svelte';
17
18
  export { default as GeoPath } from './GeoPath.svelte';
18
19
  export { default as GeoPoint } from './GeoPoint.svelte';
@@ -13,6 +13,7 @@ export { default as CircleClipPath } from './CircleClipPath.svelte';
13
13
  export { default as ClipPath } from './ClipPath.svelte';
14
14
  export { default as ColorRamp } from './ColorRamp.svelte';
15
15
  export { default as Frame } from './Frame.svelte';
16
+ export { default as GeoCircle } from './GeoCircle.svelte';
16
17
  export { default as GeoContext, geoContext } from './GeoContext.svelte';
17
18
  export { default as GeoPath } from './GeoPath.svelte';
18
19
  export { default as GeoPoint } from './GeoPoint.svelte';
@@ -1,4 +1,4 @@
1
- <script>import { Field, Switch } from 'svelte-ux';
1
+ <script>import { SelectField, Switch } from 'svelte-ux';
2
2
  export let doubleScale = devicePixelRatio > 1;
3
3
  // TODO: Access via context, or possibly global state
4
4
  const ACCESS_TOKEN = 'pk.eyJ1IjoidGVjaG5pcTM1IiwiYSI6ImNsZTR5cDd0ZjAyNm8zdnFvczhzdnFpcXkifQ.-LAr8sl5BZ3y-H0pDyD1qA';
@@ -25,7 +25,7 @@ const arcgisVector = (tileset) => (x, y, z) => {
25
25
  return `https://basemaps.arcgis.com/arcgis/rest/services/${tileset}/VectorTileServer/tile/${z}/${y}/${x}.pbf`;
26
26
  // https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/12/1572/1108.pbf
27
27
  };
28
- $: serviceOptions = {
28
+ $: services = {
29
29
  'mapbox v1': {
30
30
  'streets-v11': mapboxv1('streets-v11'),
31
31
  'light-v10': mapboxv1('light-v10'),
@@ -66,28 +66,31 @@ $: serviceOptions = {
66
66
  // 'Community Map', url: arcgisVector('World_Basemap_v2'),
67
67
  // }
68
68
  };
69
- $: defaultServiceUrl = serviceOptions['mapbox v1']['streets-v11'];
69
+ $: serviceOptions = Object.entries(services).flatMap(([group, service]) => {
70
+ return Object.entries(service).map(([label, value]) => {
71
+ return { label, value: `${group}:${label}`, group, serviceUrl: value };
72
+ });
73
+ });
74
+ $: defaultServiceUrl = services['mapbox v1']['streets-v11'];
70
75
  export let serviceUrl = defaultServiceUrl;
71
76
  $: getServiceUrl = (option) => {
72
77
  const [selectedService, selectedTileset] = selected.split(':');
73
- return serviceOptions[selectedService][selectedTileset];
78
+ return services[selectedService][selectedTileset];
74
79
  };
75
80
  let selected = 'mapbox v1:streets-v11';
76
81
  $: serviceUrl = getServiceUrl(selected);
77
82
  </script>
78
83
 
79
- <Field label="Tileset" let:id>
80
- <select bind:value={selected} class="w-full outline-none appearance-none text-sm" {id}>
81
- {#each Object.entries(serviceOptions) as [group, options]}
82
- <optgroup label={group}>
83
- {#each Object.keys(options) as option}
84
- <option value="{group}:{option}">{option}</option>
85
- {/each}
86
- </optgroup>
87
- {/each}
88
- </select>
89
- <div slot="append">
84
+ <SelectField
85
+ label="Tileset"
86
+ options={serviceOptions}
87
+ bind:value={selected}
88
+ clearable={false}
89
+ toggleIcon={null}
90
+ stepper
91
+ >
92
+ <div slot="append" on:click|stopPropagation>
90
93
  <div class="text-[10px] text-surface-content/50 text-center">2x</div>
91
94
  <Switch bind:checked={doubleScale} size="md" />
92
95
  </div>
93
- </Field>
96
+ </SelectField>
@@ -5,6 +5,8 @@ declare const __propDef: {
5
5
  serviceUrl?: ((x: number, y: number, z: number) => string) | undefined;
6
6
  };
7
7
  events: {
8
+ click: MouseEvent;
9
+ } & {
8
10
  [evt: string]: CustomEvent<any>;
9
11
  };
10
12
  slots: {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Return the point on Earth's surface that is diametrically opposite to another point
3
+ * @see: https://en.wikipedia.org/wiki/Antipodes
4
+ */
5
+ export declare function antipode([longitude, latitude]: [number, number]): [number, number];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Return the point on Earth's surface that is diametrically opposite to another point
3
+ * @see: https://en.wikipedia.org/wiki/Antipodes
4
+ */
5
+ export function antipode([longitude, latitude]) {
6
+ return [longitude + 180, -latitude];
7
+ }
@@ -1,3 +1,4 @@
1
+ export * from './geo';
1
2
  export * from './graph';
2
3
  export * from './hierarchy';
3
4
  export * from './math';
@@ -1,3 +1,4 @@
1
+ export * from './geo';
1
2
  export * from './graph';
2
3
  export * from './hierarchy';
3
4
  export * from './math';
package/package.json CHANGED
@@ -4,14 +4,14 @@
4
4
  "author": "Sean Lynch <techniq35@gmail.com>",
5
5
  "license": "MIT",
6
6
  "repository": "techniq/layerchart",
7
- "version": "0.28.0-next.3",
7
+ "version": "0.30.1",
8
8
  "devDependencies": {
9
9
  "@changesets/cli": "^2.27.1",
10
10
  "@mdi/js": "^7.4.47",
11
11
  "@rollup/plugin-dsv": "^3.0.4",
12
- "@sveltejs/adapter-auto": "^3.1.0",
13
- "@sveltejs/kit": "^2.3.2",
14
- "@sveltejs/package": "^2.2.5",
12
+ "@sveltejs/adapter-auto": "^3.1.1",
13
+ "@sveltejs/kit": "^2.5.0",
14
+ "@sveltejs/package": "^2.2.6",
15
15
  "@svitejs/changesets-changelog-github-compact": "^1.1.0",
16
16
  "@tailwindcss/typography": "^0.5.10",
17
17
  "@types/d3-array": "^3.2.1",
@@ -29,39 +29,39 @@
29
29
  "@types/d3-shape": "^3.1.6",
30
30
  "@types/d3-time": "^3.0.2",
31
31
  "@types/lodash-es": "^4.17.12",
32
- "@types/marked": "^6.0.0",
33
32
  "@types/prismjs": "^1.26.3",
34
33
  "@types/shapefile": "^0.6.4",
35
34
  "@types/topojson-client": "^3.1.4",
36
- "autoprefixer": "^10.4.16",
35
+ "autoprefixer": "^10.4.17",
37
36
  "d3-color": "^3.1.0",
38
37
  "execa": "^8.0.1",
39
- "marked": "^11.1.1",
38
+ "marked": "^12.0.0",
40
39
  "mdsvex": "^0.11.0",
41
40
  "posthog-js": "^1.95.1",
42
- "prettier": "^3.2.2",
43
- "prettier-plugin-svelte": "^3.1.2",
41
+ "prettier": "^3.2.5",
42
+ "prettier-plugin-svelte": "^3.2.1",
44
43
  "prism-svelte": "^0.5.0",
45
44
  "prism-themes": "^1.9.0",
46
45
  "prismjs": "^1.29.0",
47
46
  "rehype-slug": "^6.0.0",
48
47
  "shapefile": "^0.6.6",
49
- "svelte": "^4.2.8",
50
- "svelte-check": "^3.6.3",
48
+ "solar-calculator": "^0.3.0",
49
+ "svelte": "^4.2.10",
50
+ "svelte-check": "^3.6.4",
51
51
  "svelte-json-tree": "^2.2.0",
52
52
  "svelte-preprocess": "^5.1.3",
53
- "svelte2tsx": "^0.7.0",
53
+ "svelte2tsx": "^0.7.1",
54
54
  "tailwindcss": "^3.4.1",
55
55
  "topojson-client": "^3.1.0",
56
56
  "tslib": "^2.6.2",
57
57
  "typescript": "^5.3.3",
58
58
  "unist-util-visit": "^5.0.0",
59
59
  "us-atlas": "^3.0.1",
60
- "vite": "^5.0.11"
60
+ "vite": "^5.1.1"
61
61
  },
62
62
  "type": "module",
63
63
  "dependencies": {
64
- "@sveltejs/vite-plugin-svelte": "^3.0.1",
64
+ "@sveltejs/vite-plugin-svelte": "^3.0.2",
65
65
  "d3-array": "^3.2.4",
66
66
  "d3-color": "^3.1.0",
67
67
  "d3-delaunay": "^6.0.4",
@@ -78,12 +78,12 @@
78
78
  "d3-shape": "^3.2.0",
79
79
  "d3-tile": "^1.0.0",
80
80
  "d3-time": "^3.1.0",
81
- "date-fns": "^3.2.0",
81
+ "date-fns": "^3.3.1",
82
82
  "layercake": "^8.0.2",
83
83
  "lodash-es": "^4.17.21",
84
- "posthog-js": "^1.100.0",
84
+ "posthog-js": "^1.105.8",
85
85
  "shapefile": "^0.6.6",
86
- "svelte-ux": "0.58.0-next.13",
86
+ "svelte-ux": "0.60.2",
87
87
  "topojson-client": "^3.1.0"
88
88
  },
89
89
  "peerDependencies": {