choropleth-kit 0.0.0-stage → 0.1.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.
package/dist/core.d.ts ADDED
@@ -0,0 +1,123 @@
1
+ export { B as BoundsToTransformParams, a as Bubble, b as BubbleScaling, c as BuildLegendOptions, d as BuildProjectionChainParams, C as CATEGORICAL_PALETTES, e as CameraOptions, f as CameraSample, g as CameraTransform, h as CategoricalPaletteName, i as CategoricalScale, j as CategorySpec, k as ChainLevel, l as ChoroplethLabels, m as ChoroplethTheme, n as Classification, o as ColorScale, p as ColorScaleOptions, q as ConstrainAxisParams, r as ConstrainTransformParams, s as Corner, t as CreateCategoricalScaleOptions, u as CreateProjectionOptions, D as DEFAULT_ASPECT_RATIO, v as DEFAULT_BUBBLE_FILL, w as DEFAULT_CLASSES, x as DEFAULT_EMPTY_FILL, y as DEFAULT_FLIGHT_CURVATURE, z as DEFAULT_FOCUS_BOUNDS, A as DEFAULT_LEVEL_CACHE_SIZE, E as DEFAULT_MAX_RADIUS, F as DEFAULT_PADDING, G as DEFAULT_PROJECTION, H as DEFAULT_ZOOM_MAX, I as DEFAULT_ZOOM_MIN, J as DIVERGING_PALETTES, K as DivergingPaletteName, L as DrillContext, M as DrillCrumb, N as DrillDirection, O as DrillLayer, P as DrillLayerRole, Q as DrillMachineEvent, R as DrillMachineState, S as DrillPhase, T as Extent, U as FIT_TRANSFORM, V as FlightDurationParams, W as GeographyData, X as GeographyInput, Y as GetFocusExtentParams, Z as GetFocusGeometryParams, _ as INERTIA_MIN_VELOCITY, $ as INERTIA_TAU_MS, a0 as INERTIA_WINDOW_MS, a1 as InertiaOffsetParams, a2 as JoinDataOptions, a3 as JoinResult, a4 as LegendItem, a5 as LevelShape, a6 as LonLatBounds, a7 as LruCache, a8 as MAX_FLIGHT_MS, a9 as MIN_FLIGHT_MS, aa as Padding, ab as Point, ac as PreserveViewParams, ad as ProjectionChain, ae as ProjectionName, af as RadiusScale, ag as RebaseParams, ah as RebaseResult, ai as ReleaseVelocityParams, aj as ResolveVariantOptions, ak as ResolveZoomTargetParams, al as ResolvedCategory, am as ResolvedZoom, an as SEQUENTIAL_PALETTES, ao as SequentialPaletteName, ap as Size, aq as SizeLegendItem, ar as THEMES, as as ThemeName, at as ToFeatureCollectionOptions, au as ToViewStateParams, av as TransitionResult, aw as VariantConfig, ax as VariantEntry, ay as VariantName, az as VariantResult, aA as ViewLevel, aB as ViewState, aC as ZoomControlsOptions, aD as ZoomEventLike, aE as ZoomFilterParams, aF as ZoomKeyAction, aG as ZoomOptions, aH as ZoomTarget, aI as applyTransform, aJ as boundsToTransform, aK as bubbleScale, aL as buildBreadcrumbs, aM as buildCategoricalLegend, aN as buildLegend, aO as buildProjectionChain, aP as buildSizeLegend, aQ as clampPath, aR as classIndex, aS as classifyDrill, aT as computeAspectRatio, aU as computeThresholds, aV as constrainAxis, aW as constrainTransform, aX as contextOf, aY as createCategoricalScale, aZ as createColorScale, a_ as createDrillState, a$ as createLruCache, b0 as createProjection, b1 as createRadiusScale, b2 as createZoomFilter, b3 as createZoomInterpolator, b4 as defaultFormatValue, b5 as defineTheme, b6 as drillDirectionBetween, b7 as drillReducer, b8 as en, b9 as es, ba as extendTheme, bb as finiteValues, bc as flightDuration, bd as geographyKeyFor, be as getAnchorPoint, bf as getFocusExtent, bg as getFocusGeometry, bh as inertiaOffset, bi as invertTransform, bj as isFitTransform, bk as isThemeName, bl as joinData, bm as layerKey, bn as normalizePadding, bo as preserveView, bp as projectBounds, bq as projectionFactory, br as rebaseProjection, bs as relativeTransform, bt as releaseVelocity, bu as resolveControls, bv as resolveDrillData, bw as resolveLabels, bx as resolveTheme, by as resolveVariant, bz as resolveZoomOptions, bA as resolveZoomTarget, bB as savedCameraFor, bC as themeToCssVars, bD as toFeatureCollection, bE as toViewState, bF as transformToZoomView, bG as unwrapGeography, bH as validateLevels, bI as zoomKeyAction } from './drill-chain-DCiuiZKK.js';
2
+ import { FeatureCollection, Feature, MultiLineString } from 'geojson';
3
+ import { Topology } from 'topojson-specification';
4
+ import 'd3-geo';
5
+ import 'd3-interpolate';
6
+ import 'd3-scale-chromatic';
7
+
8
+ type CreateBordersOptions = {
9
+ geography: Topology | FeatureCollection;
10
+ /** Same `objectName` that was passed to `toFeatureCollection`, so both read the same object. */
11
+ objectName?: string;
12
+ /**
13
+ * The same filter applied to the regions: a border is only drawn if BOTH sides are kept (otherwise
14
+ * the line of a country that is no longer there would remain).
15
+ */
16
+ filterFeatures?: (feature: Feature) => boolean;
17
+ };
18
+ /**
19
+ * INTERIOR borders as a single line (a shared border is drawn once).
20
+ *
21
+ * Only possible with TopoJSON: it knows which arcs two countries share. With GeoJSON each polygon
22
+ * carries its own outline and there is no reliable way to know which ones touch, so it returns `null`
23
+ * and the consumer must use `stroke` on each region.
24
+ *
25
+ * `a !== b` discards the arcs of the outer outline (coasts): a country's border with the sea is not
26
+ * a border and would duplicate the stroke of the silhouette.
27
+ */
28
+ declare const createBorders: ({ geography, objectName, filterFeatures, }: CreateBordersOptions) => MultiLineString | null;
29
+
30
+ type JoinDiagnosticsInput = {
31
+ unmatchedData: readonly string[];
32
+ featuresWithoutData: readonly string[];
33
+ duplicateDataIds: readonly string[];
34
+ /** Number of data rows. With 0 (still loading) there is nothing to diagnose. */
35
+ dataCount: number;
36
+ };
37
+ /**
38
+ * Turns the result of `joinData` into the warning text for the developer, or `null` if
39
+ * there is nothing to warn about. Pure: it does not write to the console, so it is tested without mocking it.
40
+ */
41
+ declare const formatJoinDiagnostics: ({ unmatchedData, featuresWithoutData, duplicateDataIds, dataCount, }: JoinDiagnosticsInput) => string | null;
42
+
43
+ /**
44
+ * Pure pieces of the drill's closing (step 34): the "intent" to go down (sustained hover) and the
45
+ * development warnings for navigation requests. No React or DOM: timers are injected.
46
+ */
47
+ /** How long the pointer must stay over a drillable region to count as intent. */
48
+ declare const DRILL_INTENT_MS = 150;
49
+ type IntentTimer = {
50
+ /**
51
+ * What the pointer is over now. A different `key` restarts the wait; the same one does not extend
52
+ * it; `null` cancels it. When it elapses, `onIntent(key)` is called ONCE per dwell.
53
+ */
54
+ hover: (key: string | null) => void;
55
+ /** Cancels any pending wait (on unmount). */
56
+ dispose: () => void;
57
+ };
58
+ type IntentTimerOptions = {
59
+ onIntent: (key: string) => void;
60
+ delay?: number;
61
+ /** Injectable for tests; the globals by default. */
62
+ setTimer?: (callback: () => void, ms: number) => unknown;
63
+ clearTimer?: (handle: unknown) => void;
64
+ };
65
+ /**
66
+ * Intent timer. "Once per dwell": leaving and re-entering the same region (via another one or via
67
+ * `null`) counts as a new dwell.
68
+ */
69
+ declare const createIntentTimer: ({ onIntent, delay, setTimer, clearTimer, }: IntentTimerOptions) => IntentTimer;
70
+ type DrillRequestProblem =
71
+ /** The id does not exist at the level being drilled from. */
72
+ {
73
+ kind: "unknown-id";
74
+ id: string;
75
+ depth: number;
76
+ levelId: string;
77
+ }
78
+ /** The level has `canDrill` set to `false` for that region. */
79
+ | {
80
+ kind: "cannot-drill";
81
+ id: string;
82
+ depth: number;
83
+ levelId: string;
84
+ };
85
+ /**
86
+ * Is it valid to go down to `id` from a level whose regions are `knownIds`? Returns the problem or
87
+ * `null`. `knownIds` is `undefined` if that level is not loaded yet: it cannot be judged and is let
88
+ * through. `drillable` is `undefined` if `canDrill` cannot be evaluated (no item with its datum).
89
+ */
90
+ declare const checkDrillStep: ({ id, depth, levelId, knownIds, drillable, }: {
91
+ id: string;
92
+ depth: number;
93
+ levelId: string;
94
+ knownIds: ReadonlySet<string> | undefined;
95
+ drillable: boolean | undefined;
96
+ }) => DrillRequestProblem | null;
97
+ /** Warning text (in English, for the developer). `source` says who requested the navigation. */
98
+ declare const formatDrillRequestProblem: (problem: DrillRequestProblem, source: string) => string;
99
+ /** Requesting a route deeper than the defined levels: ignored (the last level cannot be drilled into). */
100
+ declare const formatTooDeepRequest: (path: readonly string[], levelCount: number, source: string) => string;
101
+ /**
102
+ * Warning that NO region of the level has an id (so no datum can join): almost always a
103
+ * `getFeatureId` that reads a property that does not exist. `null` if there is nothing to warn about.
104
+ */
105
+ declare const formatNoIdsDiagnostic: ({ featureCount, idCount, levelId, customGetFeatureId, }: {
106
+ featureCount: number;
107
+ idCount: number;
108
+ levelId: string | null;
109
+ customGetFeatureId: boolean;
110
+ }) => string | null;
111
+ /**
112
+ * Extra hint for the join when there is a `drill` and NO datum joins with the displayed geometry: the
113
+ * usual cause is passing a fixed list from another level. `null` if it does not apply.
114
+ */
115
+ declare const formatWrongLevelDataHint: ({ drillActive, dataIsSelector, dataCount, unmatchedCount, levelId, }: {
116
+ drillActive: boolean;
117
+ dataIsSelector: boolean;
118
+ dataCount: number;
119
+ unmatchedCount: number;
120
+ levelId: string | null;
121
+ }) => string | null;
122
+
123
+ export { type CreateBordersOptions, DRILL_INTENT_MS, type DrillRequestProblem, type IntentTimer, type IntentTimerOptions, type JoinDiagnosticsInput, checkDrillStep, createBorders, createIntentTimer, formatDrillRequestProblem, formatJoinDiagnostics, formatNoIdsDiagnostic, formatTooDeepRequest, formatWrongLevelDataHint };
package/dist/core.js ADDED
@@ -0,0 +1,197 @@
1
+ import {
2
+ CATEGORICAL_PALETTES,
3
+ DEFAULT_ASPECT_RATIO,
4
+ DEFAULT_BUBBLE_FILL,
5
+ DEFAULT_CLASSES,
6
+ DEFAULT_EMPTY_FILL,
7
+ DEFAULT_FLIGHT_CURVATURE,
8
+ DEFAULT_FOCUS_BOUNDS,
9
+ DEFAULT_LEVEL_CACHE_SIZE,
10
+ DEFAULT_MAX_RADIUS,
11
+ DEFAULT_PADDING,
12
+ DEFAULT_PROJECTION,
13
+ DEFAULT_ZOOM_MAX,
14
+ DEFAULT_ZOOM_MIN,
15
+ DIVERGING_PALETTES,
16
+ DRILL_INTENT_MS,
17
+ FIT_TRANSFORM,
18
+ INERTIA_MIN_VELOCITY,
19
+ INERTIA_TAU_MS,
20
+ INERTIA_WINDOW_MS,
21
+ MAX_FLIGHT_MS,
22
+ MIN_FLIGHT_MS,
23
+ SEQUENTIAL_PALETTES,
24
+ THEMES,
25
+ applyTransform,
26
+ boundsToTransform,
27
+ bubbleScale,
28
+ buildBreadcrumbs,
29
+ buildCategoricalLegend,
30
+ buildLegend,
31
+ buildProjectionChain,
32
+ buildSizeLegend,
33
+ checkDrillStep,
34
+ clampPath,
35
+ classIndex,
36
+ classifyDrill,
37
+ computeAspectRatio,
38
+ computeThresholds,
39
+ constrainAxis,
40
+ constrainTransform,
41
+ contextOf,
42
+ createBorders,
43
+ createCategoricalScale,
44
+ createColorScale,
45
+ createDrillState,
46
+ createIntentTimer,
47
+ createLruCache,
48
+ createProjection,
49
+ createRadiusScale,
50
+ createZoomFilter,
51
+ createZoomInterpolator,
52
+ defaultFormatValue,
53
+ defineTheme,
54
+ drillDirectionBetween,
55
+ drillReducer,
56
+ en,
57
+ es,
58
+ extendTheme,
59
+ finiteValues,
60
+ flightDuration,
61
+ formatDrillRequestProblem,
62
+ formatJoinDiagnostics,
63
+ formatNoIdsDiagnostic,
64
+ formatTooDeepRequest,
65
+ formatWrongLevelDataHint,
66
+ geographyKeyFor,
67
+ getAnchorPoint,
68
+ getFocusExtent,
69
+ getFocusGeometry,
70
+ inertiaOffset,
71
+ invertTransform,
72
+ isFitTransform,
73
+ isThemeName,
74
+ joinData,
75
+ layerKey,
76
+ normalizePadding,
77
+ preserveView,
78
+ projectBounds,
79
+ projectionFactory,
80
+ rebaseProjection,
81
+ relativeTransform,
82
+ releaseVelocity,
83
+ resolveControls,
84
+ resolveDrillData,
85
+ resolveLabels,
86
+ resolveTheme,
87
+ resolveVariant,
88
+ resolveZoomOptions,
89
+ resolveZoomTarget,
90
+ savedCameraFor,
91
+ themeToCssVars,
92
+ toFeatureCollection,
93
+ toViewState,
94
+ transformToZoomView,
95
+ unwrapGeography,
96
+ validateLevels,
97
+ zoomKeyAction
98
+ } from "./chunk-R3XS6XPP.js";
99
+ export {
100
+ CATEGORICAL_PALETTES,
101
+ DEFAULT_ASPECT_RATIO,
102
+ DEFAULT_BUBBLE_FILL,
103
+ DEFAULT_CLASSES,
104
+ DEFAULT_EMPTY_FILL,
105
+ DEFAULT_FLIGHT_CURVATURE,
106
+ DEFAULT_FOCUS_BOUNDS,
107
+ DEFAULT_LEVEL_CACHE_SIZE,
108
+ DEFAULT_MAX_RADIUS,
109
+ DEFAULT_PADDING,
110
+ DEFAULT_PROJECTION,
111
+ DEFAULT_ZOOM_MAX,
112
+ DEFAULT_ZOOM_MIN,
113
+ DIVERGING_PALETTES,
114
+ DRILL_INTENT_MS,
115
+ FIT_TRANSFORM,
116
+ INERTIA_MIN_VELOCITY,
117
+ INERTIA_TAU_MS,
118
+ INERTIA_WINDOW_MS,
119
+ MAX_FLIGHT_MS,
120
+ MIN_FLIGHT_MS,
121
+ SEQUENTIAL_PALETTES,
122
+ THEMES,
123
+ applyTransform,
124
+ boundsToTransform,
125
+ bubbleScale,
126
+ buildBreadcrumbs,
127
+ buildCategoricalLegend,
128
+ buildLegend,
129
+ buildProjectionChain,
130
+ buildSizeLegend,
131
+ checkDrillStep,
132
+ clampPath,
133
+ classIndex,
134
+ classifyDrill,
135
+ computeAspectRatio,
136
+ computeThresholds,
137
+ constrainAxis,
138
+ constrainTransform,
139
+ contextOf,
140
+ createBorders,
141
+ createCategoricalScale,
142
+ createColorScale,
143
+ createDrillState,
144
+ createIntentTimer,
145
+ createLruCache,
146
+ createProjection,
147
+ createRadiusScale,
148
+ createZoomFilter,
149
+ createZoomInterpolator,
150
+ defaultFormatValue,
151
+ defineTheme,
152
+ drillDirectionBetween,
153
+ drillReducer,
154
+ en,
155
+ es,
156
+ extendTheme,
157
+ finiteValues,
158
+ flightDuration,
159
+ formatDrillRequestProblem,
160
+ formatJoinDiagnostics,
161
+ formatNoIdsDiagnostic,
162
+ formatTooDeepRequest,
163
+ formatWrongLevelDataHint,
164
+ geographyKeyFor,
165
+ getAnchorPoint,
166
+ getFocusExtent,
167
+ getFocusGeometry,
168
+ inertiaOffset,
169
+ invertTransform,
170
+ isFitTransform,
171
+ isThemeName,
172
+ joinData,
173
+ layerKey,
174
+ normalizePadding,
175
+ preserveView,
176
+ projectBounds,
177
+ projectionFactory,
178
+ rebaseProjection,
179
+ relativeTransform,
180
+ releaseVelocity,
181
+ resolveControls,
182
+ resolveDrillData,
183
+ resolveLabels,
184
+ resolveTheme,
185
+ resolveVariant,
186
+ resolveZoomOptions,
187
+ resolveZoomTarget,
188
+ savedCameraFor,
189
+ themeToCssVars,
190
+ toFeatureCollection,
191
+ toViewState,
192
+ transformToZoomView,
193
+ unwrapGeography,
194
+ validateLevels,
195
+ zoomKeyAction
196
+ };
197
+ //# sourceMappingURL=core.js.map