@bicharts/chart-host 0.6.117 → 0.6.118
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/adapters.mjs +3 -3
- package/dist/category-colours.mjs +2 -2
- package/dist/{chunk-EFKGSDFF.mjs → chunk-4AJYIAAJ.mjs} +1 -1
- package/dist/{chunk-JTZTTJJK.mjs → chunk-CMZCRLIX.mjs} +1 -1
- package/dist/{chunk-IW6BKFF5.mjs → chunk-DM74ZXKA.mjs} +1 -1
- package/dist/{chunk-RLOIA7QK.mjs → chunk-HEXJGF42.mjs} +1 -1
- package/dist/{chunk-TUZCM7SX.mjs → chunk-HW3WK7SL.mjs} +2 -2
- package/dist/{chunk-VGJH63LZ.mjs → chunk-NEICPMG7.mjs} +1 -1
- package/dist/{chunk-GZSYTDFN.mjs → chunk-TNFUHR2L.mjs} +6 -6
- package/dist/{chunk-QG5TENI3.mjs → chunk-WK5PLWHT.mjs} +1 -1
- package/dist/{chunk-63IUMWY2.mjs → chunk-XFPHTQ7P.mjs} +1 -1
- package/dist/index.mjs +8 -8
- package/dist/legend-fit.mjs +3 -3
- package/dist/page.mjs +4 -4
- package/dist/react.mjs +8 -8
- package/dist/testing.mjs +1 -1
- package/dist/types/contract.d.ts +1 -1
- package/dist/types/host/services.d.ts +8 -0
- package/dist/types/viewState.d.ts +23 -11
- package/dist/view-state.mjs +22 -6
- package/package.json +1 -1
package/dist/adapters.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
censusHitBands,
|
|
4
4
|
ensureCrossfilterHitTargets,
|
|
5
5
|
hitBandFlag
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4AJYIAAJ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
clickWasDrag,
|
|
9
9
|
collectD3GlyphCenters,
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
markKeyOf,
|
|
13
13
|
rowIdxsFromMark,
|
|
14
14
|
selectionRuleOf
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HEXJGF42.mjs";
|
|
16
16
|
import {
|
|
17
17
|
AXIS_FILTER_CLASS,
|
|
18
18
|
LEGEND_MARK_CLASS,
|
|
19
19
|
MARK_CLASS,
|
|
20
20
|
ROW_IDX_ATTR
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-WK5PLWHT.mjs";
|
|
22
22
|
import "./chunk-GHODWOAL.mjs";
|
|
23
23
|
|
|
24
24
|
// src/adapters/types.ts
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
deltaE2000,
|
|
6
6
|
hexToLab,
|
|
7
7
|
rgbToLab
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CMZCRLIX.mjs";
|
|
9
9
|
import {
|
|
10
10
|
CATEGORY_DELTA_E_FLOOR,
|
|
11
11
|
DIM_OPACITY_DEFAULT,
|
|
12
12
|
LEGEND_MARK_CLASS,
|
|
13
13
|
MARK_CLASS,
|
|
14
14
|
ROW_IDX_ATTR
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WK5PLWHT.mjs";
|
|
16
16
|
import "./chunk-GHODWOAL.mjs";
|
|
17
17
|
|
|
18
18
|
// src/categoryColours.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! @bicharts/chart-host — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; Natural Earth and US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
2
|
import {
|
|
3
3
|
SNAPSHOT_SVG_ATTR
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WK5PLWHT.mjs";
|
|
5
5
|
|
|
6
6
|
// src/snapshot.ts
|
|
7
7
|
var DEFAULT_TIMEOUT_MS = 2e3;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
gestureWasDrag,
|
|
5
5
|
isInsideControl,
|
|
6
6
|
rowIdxsFromMark
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HEXJGF42.mjs";
|
|
8
8
|
import {
|
|
9
9
|
AXIS_FILTER_CLASS,
|
|
10
10
|
CONTROL_CLASS,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
MARK_CLASS,
|
|
13
13
|
ROW_IDX_ATTR,
|
|
14
14
|
SNAPSHOT_SVG_ATTR
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WK5PLWHT.mjs";
|
|
16
16
|
|
|
17
17
|
// src/lasso.ts
|
|
18
18
|
var LASSO_ROW_CAP = 5e3;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! @bicharts/chart-host — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; Natural Earth and US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
2
|
import {
|
|
3
3
|
LASSO_KNOB_KEY
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HW3WK7SL.mjs";
|
|
5
5
|
|
|
6
6
|
// src/controls.ts
|
|
7
7
|
var isKnob = (key) => key !== LASSO_KNOB_KEY;
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
claimParkedLasso,
|
|
5
5
|
installLasso,
|
|
6
6
|
lassoEffect
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HW3WK7SL.mjs";
|
|
8
8
|
import {
|
|
9
9
|
censusHitBands,
|
|
10
10
|
ensureCrossfilterHitTargets
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4AJYIAAJ.mjs";
|
|
12
12
|
import {
|
|
13
13
|
clearPress,
|
|
14
14
|
clearSelectionGlyphs,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
selectionRuleOf,
|
|
25
25
|
trackPress,
|
|
26
26
|
validRowSet
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-HEXJGF42.mjs";
|
|
28
28
|
import {
|
|
29
29
|
clipWindowOf,
|
|
30
30
|
fitRenderedChart,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
restoreInnerScroll,
|
|
33
33
|
takeScroll,
|
|
34
34
|
unpinScrolledAxis
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-XFPHTQ7P.mjs";
|
|
36
36
|
import {
|
|
37
37
|
geoFromCache
|
|
38
38
|
} from "./chunk-LXTW6YII.mjs";
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
deltaE2000,
|
|
52
52
|
hexToLab,
|
|
53
53
|
labToHex
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-CMZCRLIX.mjs";
|
|
55
55
|
import {
|
|
56
56
|
ACTIVE_TICK_CLASS,
|
|
57
57
|
ANIM_LOOP_DELAY_DEFAULT,
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
XFILTER_REFRESH_EVENT,
|
|
97
97
|
chartOwnsTimeline,
|
|
98
98
|
periodTickSuppressesFeedback
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-WK5PLWHT.mjs";
|
|
100
100
|
|
|
101
101
|
// src/labelContrast.ts
|
|
102
102
|
function parseRGBA(c) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! @bicharts/chart-host — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; Natural Earth and US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
2
|
|
|
3
3
|
// src/contract.ts
|
|
4
|
-
var HOST_CONTRACT_VERSION = "1.
|
|
4
|
+
var HOST_CONTRACT_VERSION = "1.25.0";
|
|
5
5
|
var GEO_POINT_PRECISIONS = ["latlon", "city", "zip3", "state", "country"];
|
|
6
6
|
var MARK_CLASS = "d3-mark";
|
|
7
7
|
var LEGEND_MARK_CLASS = "d3-legend-mark";
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
svgNaturalSize,
|
|
16
16
|
svgToDataUrl,
|
|
17
17
|
tableHostOf
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DM74ZXKA.mjs";
|
|
19
19
|
import {
|
|
20
20
|
ANNOTATION_CLASS,
|
|
21
21
|
ANNOTATION_LAYER_CLASS,
|
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
toSourceRows,
|
|
132
132
|
trackFocus,
|
|
133
133
|
valuePlacementFlag
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-TNFUHR2L.mjs";
|
|
135
135
|
import {
|
|
136
136
|
LASSO_AXES_SLOT,
|
|
137
137
|
LASSO_COUNT_CLASS,
|
|
@@ -158,13 +158,13 @@ import {
|
|
|
158
158
|
lassoVerdict,
|
|
159
159
|
pointInShape,
|
|
160
160
|
registerLassoAction
|
|
161
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-HW3WK7SL.mjs";
|
|
162
162
|
import {
|
|
163
163
|
MIN_HIT_BAND_PX,
|
|
164
164
|
censusHitBands,
|
|
165
165
|
ensureCrossfilterHitTargets,
|
|
166
166
|
hitBandFlag
|
|
167
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-4AJYIAAJ.mjs";
|
|
168
168
|
import {
|
|
169
169
|
CONTAINER_SLOT_PRESS_AT,
|
|
170
170
|
DRAG_NOT_CLICK_PX,
|
|
@@ -189,7 +189,7 @@ import {
|
|
|
189
189
|
selectionRuleOf,
|
|
190
190
|
trackPress,
|
|
191
191
|
validRowSet
|
|
192
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-HEXJGF42.mjs";
|
|
193
193
|
import {
|
|
194
194
|
AXIS_PIN_BAND_PAD_PX,
|
|
195
195
|
AXIS_PIN_MAX_BAND_FRACTION,
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
svgInkReach,
|
|
220
220
|
takeScroll,
|
|
221
221
|
unpinScrolledAxis
|
|
222
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-XFPHTQ7P.mjs";
|
|
223
223
|
import {
|
|
224
224
|
clearGeoCache,
|
|
225
225
|
geoAssetFor,
|
|
@@ -239,7 +239,7 @@ import {
|
|
|
239
239
|
censusColourSpread,
|
|
240
240
|
colourSpreadFlag,
|
|
241
241
|
deltaEHex
|
|
242
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-CMZCRLIX.mjs";
|
|
243
243
|
import "./chunk-A2GMXZP7.mjs";
|
|
244
244
|
import {
|
|
245
245
|
ACTIVE_TICK_CLASS,
|
|
@@ -298,7 +298,7 @@ import {
|
|
|
298
298
|
chartOwnsTimeline,
|
|
299
299
|
periodTickSuppressesFeedback,
|
|
300
300
|
withoutViewOnlyKeys
|
|
301
|
-
} from "./chunk-
|
|
301
|
+
} from "./chunk-WK5PLWHT.mjs";
|
|
302
302
|
import "./chunk-GHODWOAL.mjs";
|
|
303
303
|
|
|
304
304
|
// src/hostLinks.ts
|
package/dist/legend-fit.mjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
chartSvgOf,
|
|
4
4
|
tableHostOf
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DM74ZXKA.mjs";
|
|
6
6
|
import {
|
|
7
7
|
FIT_CONTENT_SELECTOR,
|
|
8
8
|
ctmScaleOf,
|
|
9
9
|
isPhantomBox
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-XFPHTQ7P.mjs";
|
|
11
|
+
import "./chunk-WK5PLWHT.mjs";
|
|
12
12
|
import "./chunk-GHODWOAL.mjs";
|
|
13
13
|
|
|
14
14
|
// src/legendFit/legendReconcile.ts
|
package/dist/page.mjs
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
noteBadges,
|
|
7
7
|
notesFor,
|
|
8
8
|
readControls
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-NEICPMG7.mjs";
|
|
10
|
+
import "./chunk-HW3WK7SL.mjs";
|
|
11
|
+
import "./chunk-HEXJGF42.mjs";
|
|
12
|
+
import "./chunk-WK5PLWHT.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ANY_VALUE,
|
|
15
15
|
LINKED_HOVER_CLASS,
|
package/dist/react.mjs
CHANGED
|
@@ -5,26 +5,26 @@ import {
|
|
|
5
5
|
createControls,
|
|
6
6
|
noteBadges,
|
|
7
7
|
notesFor
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NEICPMG7.mjs";
|
|
9
9
|
import {
|
|
10
10
|
assembleD3,
|
|
11
11
|
createChartGroup,
|
|
12
12
|
createChartHost,
|
|
13
13
|
syncMemberSelection,
|
|
14
14
|
toSourceRows
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-TNFUHR2L.mjs";
|
|
16
|
+
import "./chunk-HW3WK7SL.mjs";
|
|
17
|
+
import "./chunk-4AJYIAAJ.mjs";
|
|
18
|
+
import "./chunk-HEXJGF42.mjs";
|
|
19
|
+
import "./chunk-XFPHTQ7P.mjs";
|
|
20
20
|
import {
|
|
21
21
|
geoFromCache,
|
|
22
22
|
loadGeo
|
|
23
23
|
} from "./chunk-LXTW6YII.mjs";
|
|
24
24
|
import "./chunk-K2TH7D5V.mjs";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-CMZCRLIX.mjs";
|
|
26
26
|
import "./chunk-A2GMXZP7.mjs";
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-WK5PLWHT.mjs";
|
|
28
28
|
import {
|
|
29
29
|
ANY_VALUE,
|
|
30
30
|
LINKED_HOVER_CLASS,
|
package/dist/testing.mjs
CHANGED
package/dist/types/contract.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExportFormat, ExportTableService, SaveFileService } from "./exportTable";
|
|
2
|
-
export declare const HOST_CONTRACT_VERSION = "1.
|
|
2
|
+
export declare const HOST_CONTRACT_VERSION = "1.25.0";
|
|
3
3
|
export type GeoPointPrecision = "latlon" | "city" | "zip3" | "state" | "country";
|
|
4
4
|
/** Every valid tier, ordered most precise → coarsest. Runtime form of GeoPointPrecision. */
|
|
5
5
|
export declare const GEO_POINT_PRECISIONS: readonly GeoPointPrecision[];
|
|
@@ -156,6 +156,14 @@ export interface ViewStateService {
|
|
|
156
156
|
viewing: ViewStateProvider;
|
|
157
157
|
/** Survives close and reopen (a report file, a workbook). Absent or null: this host cannot. */
|
|
158
158
|
durable?: ViewStateProvider | null;
|
|
159
|
+
/**
|
|
160
|
+
* The reader's OWN copy, kept for this person only (a browser store on their machine, an app's
|
|
161
|
+
* per-user record). It is written with the durable store's rules (lifetime, `durableWhen`, the size
|
|
162
|
+
* cap), and on a fresh viewing it is read BEFORE the durable store: the person sees their own view, and
|
|
163
|
+
* anyone without one sees the shared one. "Reset view" needs nothing of its own: the chart's cleared
|
|
164
|
+
* bag is written to every store. Absent or null: this host keeps no per-person view.
|
|
165
|
+
*/
|
|
166
|
+
personal?: ViewStateProvider | null;
|
|
159
167
|
/** The keys the HOST writes or scopes, by name. */
|
|
160
168
|
policy: Readonly<Record<string, ViewStateKeyPolicy>>;
|
|
161
169
|
/**
|
|
@@ -12,6 +12,11 @@ export declare function noopViewStateService(): ViewStateService;
|
|
|
12
12
|
* a host cannot claim it without a durable store to back the claim.
|
|
13
13
|
*/
|
|
14
14
|
export declare function viewStateIsDurable(service: ViewStateService | null | undefined): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether this host keeps a view for each person apart from the shared one. Derived from the service,
|
|
17
|
+
* like `viewStateIsDurable`: a host has a personal view exactly when it supplies a personal store.
|
|
18
|
+
*/
|
|
19
|
+
export declare function viewStateIsPersonal(service: ViewStateService | null | undefined): boolean;
|
|
15
20
|
/**
|
|
16
21
|
* The rule for a key the chart's own code writes, when a service names no other. The chart keeps it:
|
|
17
22
|
* it reaches the durable store, and it survives a new version of the chart and a fresh viewing.
|
|
@@ -38,8 +43,8 @@ export interface ResolveViewStateOptions {
|
|
|
38
43
|
export interface ResolvedViewState {
|
|
39
44
|
/** The bag to hand the chart as `options.uiState`. The caller's own copy: nothing in a store aliases it. */
|
|
40
45
|
bag: Record<string, unknown>;
|
|
41
|
-
/** Where the bag was read from. `"none"`:
|
|
42
|
-
source: "viewing" | "durable" | "none";
|
|
46
|
+
/** Where the bag was read from. `"none"`: no store held anything. */
|
|
47
|
+
source: "viewing" | "personal" | "durable" | "none";
|
|
43
48
|
/** Every key a rule took out, in the order the rules ran, so a host can log what it did. */
|
|
44
49
|
dropped: ViewStateDrop[];
|
|
45
50
|
}
|
|
@@ -47,10 +52,11 @@ export interface ResolvedViewState {
|
|
|
47
52
|
* BUILD THE BAG A CHART IS HANDED.
|
|
48
53
|
*
|
|
49
54
|
* Read order: the viewing store when it holds anything (or when the viewing has already written, see
|
|
50
|
-
* `freshViewing`), otherwise the
|
|
51
|
-
* the
|
|
52
|
-
* that window must see the write, not the state before it.
|
|
53
|
-
*
|
|
55
|
+
* `freshViewing`), otherwise the personal store, otherwise the durable store, otherwise nothing. The
|
|
56
|
+
* viewing store is the newest within a viewing: a stored copy can lag its own writes by a round trip,
|
|
57
|
+
* and a redraw in that window must see the write, not the state before it. The personal store comes
|
|
58
|
+
* before the durable one because it is this reader's own view, and the durable one is everyone's. A key
|
|
59
|
+
* whose lifetime is `"viewing"` is never believed from either stored copy.
|
|
54
60
|
*
|
|
55
61
|
* Then two rules run, in this order, each over the keys a service's policy names (and, for the keys
|
|
56
62
|
* it doesn't, over `chartKeys`):
|
|
@@ -88,13 +94,15 @@ export interface CommitViewStateResult {
|
|
|
88
94
|
viewingSaved: boolean;
|
|
89
95
|
/** The durable store's `save` ran without throwing. False too when the service has no durable store. */
|
|
90
96
|
durableSaved: boolean;
|
|
91
|
-
/**
|
|
97
|
+
/** The personal store's `save` ran without throwing. False too when the service has no personal store. */
|
|
98
|
+
personalSaved: boolean;
|
|
99
|
+
/** Keys kept out of the stored copies (durable and personal) because their `durableWhen` preference is off, in policy order. */
|
|
92
100
|
withheld: string[];
|
|
93
|
-
/** Characters of JSON in the durable
|
|
101
|
+
/** Characters of JSON in the stored payload (durable and personal), measured only when the service sets a limit. */
|
|
94
102
|
durableChars: number | null;
|
|
95
|
-
/** A store that threw. The other
|
|
103
|
+
/** A store that threw. The other stores are still written, and the write never throws out of the chart. */
|
|
96
104
|
errors: Array<{
|
|
97
|
-
store: "viewing" | "durable";
|
|
105
|
+
store: "viewing" | "durable" | "personal";
|
|
98
106
|
error: unknown;
|
|
99
107
|
}>;
|
|
100
108
|
}
|
|
@@ -120,6 +128,10 @@ export interface ViewStatePreferences {
|
|
|
120
128
|
* session the new pose. The one case where neither store is written is a refusal: a durable payload
|
|
121
129
|
* over `durableMaxChars` is dropped whole, so the next read sees the state before it.
|
|
122
130
|
*
|
|
123
|
-
*
|
|
131
|
+
* A personal store gets exactly what the durable store gets, and is written after it: a reader's own
|
|
132
|
+
* copy and the shared copy hold the same thing after every write, so "Reset view" (the chart writing
|
|
133
|
+
* its cleared bag) clears both, and the size cap covers both.
|
|
134
|
+
*
|
|
135
|
+
* Never throws. A store that throws is reported in `errors` and the other stores are still written.
|
|
124
136
|
*/
|
|
125
137
|
export declare function commitViewState(next: unknown, service: ViewStateService, prefs?: ViewStatePreferences | null): CommitViewStateResult;
|
package/dist/view-state.mjs
CHANGED
|
@@ -10,6 +10,9 @@ function noopViewStateService() {
|
|
|
10
10
|
function viewStateIsDurable(service) {
|
|
11
11
|
return !!service && !!service.durable;
|
|
12
12
|
}
|
|
13
|
+
function viewStateIsPersonal(service) {
|
|
14
|
+
return !!service && !!service.personal;
|
|
15
|
+
}
|
|
13
16
|
var CHART_OWNED_KEY_POLICY = Object.freeze({
|
|
14
17
|
lifetime: "durable",
|
|
15
18
|
dropOnNewVersion: false,
|
|
@@ -54,8 +57,9 @@ function resolveViewState(service, options = {}) {
|
|
|
54
57
|
source = "viewing";
|
|
55
58
|
raw = holds(viewed) ? viewed : {};
|
|
56
59
|
} else {
|
|
57
|
-
const
|
|
58
|
-
|
|
60
|
+
const mine = loadOrEmpty(service.personal);
|
|
61
|
+
const stored = holds(mine) ? mine : loadOrEmpty(service.durable);
|
|
62
|
+
source = holds(mine) ? "personal" : holds(stored) ? "durable" : "none";
|
|
59
63
|
raw = holds(stored) ? stored : {};
|
|
60
64
|
if (isBag(raw)) {
|
|
61
65
|
const believed = {};
|
|
@@ -113,6 +117,7 @@ function commitViewState(next, service, prefs) {
|
|
|
113
117
|
outcome: "saved",
|
|
114
118
|
viewingSaved: false,
|
|
115
119
|
durableSaved: false,
|
|
120
|
+
personalSaved: false,
|
|
116
121
|
withheld: [],
|
|
117
122
|
durableChars: null,
|
|
118
123
|
errors: []
|
|
@@ -120,8 +125,10 @@ function commitViewState(next, service, prefs) {
|
|
|
120
125
|
if (next == null || typeof next !== "object") return { ...result, outcome: "ignored" };
|
|
121
126
|
const bag = next;
|
|
122
127
|
const durable = service.durable || null;
|
|
128
|
+
const personal = service.personal || null;
|
|
129
|
+
const kept = !!(durable || personal);
|
|
123
130
|
let forFile = bag;
|
|
124
|
-
if (
|
|
131
|
+
if (kept && isBag(bag)) {
|
|
125
132
|
let trimmed = null;
|
|
126
133
|
const withheld = /* @__PURE__ */ new Set();
|
|
127
134
|
for (const key of Object.keys(bag)) {
|
|
@@ -136,11 +143,11 @@ function commitViewState(next, service, prefs) {
|
|
|
136
143
|
const declared = Object.keys(service.policy || {});
|
|
137
144
|
result.withheld = [...declared.filter((k) => withheld.has(k)), ...[...withheld].filter((k) => !declared.includes(k))];
|
|
138
145
|
}
|
|
139
|
-
if (
|
|
146
|
+
if (kept && service.durableMaxChars) {
|
|
140
147
|
try {
|
|
141
148
|
result.durableChars = JSON.stringify(forFile).length;
|
|
142
149
|
} catch (error) {
|
|
143
|
-
result.errors.push({ store: "durable", error });
|
|
150
|
+
result.errors.push({ store: durable ? "durable" : "personal", error });
|
|
144
151
|
return { ...result, outcome: "ignored" };
|
|
145
152
|
}
|
|
146
153
|
if (result.durableChars > service.durableMaxChars) return { ...result, outcome: "too-large" };
|
|
@@ -159,6 +166,14 @@ function commitViewState(next, service, prefs) {
|
|
|
159
166
|
result.errors.push({ store: "durable", error });
|
|
160
167
|
}
|
|
161
168
|
}
|
|
169
|
+
if (personal) {
|
|
170
|
+
try {
|
|
171
|
+
personal.save(forFile);
|
|
172
|
+
result.personalSaved = true;
|
|
173
|
+
} catch (error) {
|
|
174
|
+
result.errors.push({ store: "personal", error });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
162
177
|
return result;
|
|
163
178
|
}
|
|
164
179
|
export {
|
|
@@ -167,5 +182,6 @@ export {
|
|
|
167
182
|
noopViewStateService,
|
|
168
183
|
resolveViewState,
|
|
169
184
|
viewStateAfterSwap,
|
|
170
|
-
viewStateIsDurable
|
|
185
|
+
viewStateIsDurable,
|
|
186
|
+
viewStateIsPersonal
|
|
171
187
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.118",
|
|
4
4
|
"description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|