@trdrs/quickcharts 1.3.0 → 2.0.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/CHANGELOG.md +84 -0
- package/README.md +209 -200
- package/dist/adapters/rest.d.ts +3 -3
- package/dist/adapters/rest.js +2 -2
- package/dist/adapters/rest.js.map +1 -1
- package/dist/{ar-G7MVXRE4.js → ar-KSXQ2USS.js} +20 -20
- package/dist/ar-KSXQ2USS.js.map +1 -0
- package/dist/{assets-ySndlUS3.d.ts → assets-DOuBBsOp.d.ts} +50 -50
- package/dist/{ca_ES-EUSRU4VG.js → ca_ES-JG4FM55E.js} +20 -20
- package/dist/ca_ES-JG4FM55E.js.map +1 -0
- package/dist/{chunk-AA7XKXH4.js → chunk-6S6TO2N6.js} +33 -33
- package/dist/chunk-6S6TO2N6.js.map +1 -0
- package/dist/{chunk-KFBQSPNA.js → chunk-D3S26ARP.js} +2 -2
- package/dist/chunk-D3S26ARP.js.map +1 -0
- package/dist/{chunk-AKXIFHQN.js → chunk-KLPTCWA2.js} +1 -1
- package/dist/{chunk-AKXIFHQN.js.map → chunk-KLPTCWA2.js.map} +1 -1
- package/dist/{de-2SVTG25S.js → de-VSW2LHNF.js} +20 -20
- package/dist/de-VSW2LHNF.js.map +1 -0
- package/dist/drawings.d.ts +16 -16
- package/dist/drawings.js +12 -12
- package/dist/{es-UDHZM4W7.js → es-5ZXIPVOB.js} +20 -20
- package/dist/es-5ZXIPVOB.js.map +1 -0
- package/dist/feature-manifest.json +3 -3
- package/dist/{fr-35VN4G4S.js → fr-4F6DAWGD.js} +20 -20
- package/dist/fr-4F6DAWGD.js.map +1 -0
- package/dist/{he_IL-JPZMCURP.js → he_IL-B7PBQUEV.js} +20 -20
- package/dist/he_IL-B7PBQUEV.js.map +1 -0
- package/dist/{id_ID-XSTFHHJQ.js → id_ID-CYJRMXPC.js} +20 -20
- package/dist/id_ID-CYJRMXPC.js.map +1 -0
- package/dist/index.d.ts +167 -163
- package/dist/index.js +248 -237
- package/dist/index.js.map +1 -1
- package/dist/{it-EIY6JESQ.js → it-KTX4SG5P.js} +20 -20
- package/dist/it-KTX4SG5P.js.map +1 -0
- package/dist/{ja-42N4XRCW.js → ja-V7OURU5D.js} +20 -20
- package/dist/ja-V7OURU5D.js.map +1 -0
- package/dist/{ko-3VRPTIP3.js → ko-2RNEBYVE.js} +20 -20
- package/dist/ko-2RNEBYVE.js.map +1 -0
- package/dist/{ms_MY-SKN7O6M5.js → ms_MY-EY235E7Q.js} +20 -20
- package/dist/ms_MY-EY235E7Q.js.map +1 -0
- package/dist/{pl-TYARHCLT.js → pl-ADNVRP55.js} +20 -20
- package/dist/pl-ADNVRP55.js.map +1 -0
- package/dist/{pt-72IIFLL4.js → pt-OL2DR3DO.js} +20 -20
- package/dist/pt-OL2DR3DO.js.map +1 -0
- package/dist/quickcharts.css +97 -96
- package/dist/{resources-Ch8eA1Mw.d.ts → resources-Le6flcEn.d.ts} +3 -3
- package/dist/rest-openapi.json +11 -11
- package/dist/{ru-TPH4F7IB.js → ru-V6YFEPAF.js} +20 -20
- package/dist/ru-V6YFEPAF.js.map +1 -0
- package/dist/{sv-DC5RS67Z.js → sv-TORXQVE7.js} +20 -20
- package/dist/sv-TORXQVE7.js.map +1 -0
- package/dist/{th-I6H6AOZ3.js → th-K6SJSYSY.js} +20 -20
- package/dist/th-K6SJSYSY.js.map +1 -0
- package/dist/theme-manifest.json +10 -10
- package/dist/{tr-7FSUVCNW.js → tr-4AEM66KW.js} +20 -20
- package/dist/tr-4AEM66KW.js.map +1 -0
- package/dist/{vi-DLRPHLLH.js → vi-YU5XCEUU.js} +20 -20
- package/dist/vi-YU5XCEUU.js.map +1 -0
- package/dist/{zh-ZXIQBBEP.js → zh-QXKRYHU5.js} +20 -20
- package/dist/zh-QXKRYHU5.js.map +1 -0
- package/dist/{zh_TW-TYNUJU7U.js → zh_TW-AYPDKG4Q.js} +20 -20
- package/dist/zh_TW-AYPDKG4Q.js.map +1 -0
- package/package.json +1 -1
- package/dist/ar-G7MVXRE4.js.map +0 -1
- package/dist/ca_ES-EUSRU4VG.js.map +0 -1
- package/dist/chunk-AA7XKXH4.js.map +0 -1
- package/dist/chunk-KFBQSPNA.js.map +0 -1
- package/dist/de-2SVTG25S.js.map +0 -1
- package/dist/es-UDHZM4W7.js.map +0 -1
- package/dist/fr-35VN4G4S.js.map +0 -1
- package/dist/he_IL-JPZMCURP.js.map +0 -1
- package/dist/id_ID-XSTFHHJQ.js.map +0 -1
- package/dist/it-EIY6JESQ.js.map +0 -1
- package/dist/ja-42N4XRCW.js.map +0 -1
- package/dist/ko-3VRPTIP3.js.map +0 -1
- package/dist/ms_MY-SKN7O6M5.js.map +0 -1
- package/dist/pl-TYARHCLT.js.map +0 -1
- package/dist/pt-72IIFLL4.js.map +0 -1
- package/dist/ru-TPH4F7IB.js.map +0 -1
- package/dist/sv-DC5RS67Z.js.map +0 -1
- package/dist/th-I6H6AOZ3.js.map +0 -1
- package/dist/tr-7FSUVCNW.js.map +0 -1
- package/dist/vi-DLRPHLLH.js.map +0 -1
- package/dist/zh-ZXIQBBEP.js.map +0 -1
- package/dist/zh_TW-TYNUJU7U.js.map +0 -1
|
@@ -46,7 +46,7 @@ function visibilityPreset(kind, ctx) {
|
|
|
46
46
|
}
|
|
47
47
|
return out;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function parseTimeframeContext(tf) {
|
|
50
50
|
const match = /^(\d+)(t|s|m|h|d|w|mo)$/.exec(tf.trim().toLowerCase());
|
|
51
51
|
if (!match) return null;
|
|
52
52
|
let value = Number(match[1]);
|
|
@@ -340,9 +340,9 @@ function viewportOf(chart, series) {
|
|
|
340
340
|
const firstTime = data.length > 0 ? numTime(0) : null;
|
|
341
341
|
const lastTime = data.length > 0 ? numTime(lastIndex) : null;
|
|
342
342
|
const prevTime = numTime(lastIndex - 1);
|
|
343
|
-
const
|
|
343
|
+
const trailStep = lastTime !== null && prevTime !== null && lastTime > prevTime ? lastTime - prevTime : null;
|
|
344
344
|
const secondTime = numTime(1);
|
|
345
|
-
const
|
|
345
|
+
const leadStep = firstTime !== null && secondTime !== null && secondTime > firstTime ? secondTime - firstTime : null;
|
|
346
346
|
const logicalOfTime = (time) => {
|
|
347
347
|
const x = ts.timeToCoordinate(time);
|
|
348
348
|
if (x !== null) {
|
|
@@ -350,8 +350,8 @@ function viewportOf(chart, series) {
|
|
|
350
350
|
if (logical !== null) return logical;
|
|
351
351
|
}
|
|
352
352
|
if (typeof time !== "number" || firstTime === null || lastTime === null) return null;
|
|
353
|
-
if (time >= lastTime) return
|
|
354
|
-
if (time <= firstTime) return
|
|
353
|
+
if (time >= lastTime) return trailStep === null ? lastIndex : lastIndex + (time - lastTime) / trailStep;
|
|
354
|
+
if (time <= firstTime) return leadStep === null ? 0 : (time - firstTime) / leadStep;
|
|
355
355
|
let lo = 0;
|
|
356
356
|
let hi = lastIndex;
|
|
357
357
|
while (hi - lo > 1) {
|
|
@@ -368,8 +368,8 @@ function viewportOf(chart, series) {
|
|
|
368
368
|
};
|
|
369
369
|
const timeOfLogicalIndex = (logical) => {
|
|
370
370
|
if (firstTime === null || lastTime === null) return null;
|
|
371
|
-
if (logical >= lastIndex) return
|
|
372
|
-
if (logical <= 0) return
|
|
371
|
+
if (logical >= lastIndex) return trailStep === null ? lastTime : lastTime + (logical - lastIndex) * trailStep;
|
|
372
|
+
if (logical <= 0) return leadStep === null ? firstTime : firstTime + logical * leadStep;
|
|
373
373
|
const i = Math.floor(logical);
|
|
374
374
|
const tLo = numTime(i);
|
|
375
375
|
const tHi = numTime(i + 1);
|
|
@@ -422,7 +422,7 @@ var Drawing = class {
|
|
|
422
422
|
_options;
|
|
423
423
|
_props;
|
|
424
424
|
_state = "normal";
|
|
425
|
-
|
|
425
|
+
_timeframeContext = null;
|
|
426
426
|
_globalHidden = false;
|
|
427
427
|
_barSource = null;
|
|
428
428
|
_chart = null;
|
|
@@ -534,8 +534,8 @@ var Drawing = class {
|
|
|
534
534
|
};
|
|
535
535
|
this.requestUpdate();
|
|
536
536
|
}
|
|
537
|
-
|
|
538
|
-
this.
|
|
537
|
+
setTimeframeContext(context) {
|
|
538
|
+
this._timeframeContext = context;
|
|
539
539
|
this.requestUpdate();
|
|
540
540
|
}
|
|
541
541
|
/** Chart-wide hide-all switch (transient view state — never serialized). */
|
|
@@ -583,7 +583,7 @@ var Drawing = class {
|
|
|
583
583
|
return this._glyphSource ? this._glyphSource(glyph) : null;
|
|
584
584
|
}
|
|
585
585
|
isVisibleNow() {
|
|
586
|
-
return !this._globalHidden && this._options.visible && visibleAt(this._options.visibility, this.
|
|
586
|
+
return !this._globalHidden && this._options.visible && visibleAt(this._options.visibility, this._timeframeContext);
|
|
587
587
|
}
|
|
588
588
|
applyProps(patch) {
|
|
589
589
|
this._props = { ...this._props, ...patch };
|
|
@@ -746,7 +746,7 @@ var DrawingManager = class {
|
|
|
746
746
|
_selectedId = null;
|
|
747
747
|
_chart = null;
|
|
748
748
|
_series = null;
|
|
749
|
-
|
|
749
|
+
_timeframeContext = null;
|
|
750
750
|
_allHidden = false;
|
|
751
751
|
_barSource = null;
|
|
752
752
|
_tickSize = null;
|
|
@@ -775,10 +775,10 @@ var DrawingManager = class {
|
|
|
775
775
|
this._glyphSource = source;
|
|
776
776
|
for (const drawing of this._drawings.values()) drawing.setGlyphSource(source);
|
|
777
777
|
}
|
|
778
|
-
/** Broadcast the chart's
|
|
779
|
-
|
|
780
|
-
this.
|
|
781
|
-
for (const drawing of this._drawings.values()) drawing.
|
|
778
|
+
/** Broadcast the chart's timeframe so per-timeframe visibility rules apply. */
|
|
779
|
+
setTimeframeContext(context) {
|
|
780
|
+
this._timeframeContext = context;
|
|
781
|
+
for (const drawing of this._drawings.values()) drawing.setTimeframeContext(context);
|
|
782
782
|
}
|
|
783
783
|
/** Chart-wide hide-all: every drawing (and its axis pills) disappears until toggled back. */
|
|
784
784
|
setAllHidden(hidden) {
|
|
@@ -816,7 +816,7 @@ var DrawingManager = class {
|
|
|
816
816
|
add(drawing) {
|
|
817
817
|
if (this._drawings.has(drawing.id)) return;
|
|
818
818
|
const concrete = drawing;
|
|
819
|
-
concrete.
|
|
819
|
+
concrete.setTimeframeContext(this._timeframeContext);
|
|
820
820
|
concrete.setGlobalHidden(this._allHidden);
|
|
821
821
|
concrete.setBarSource(this._barSource);
|
|
822
822
|
concrete.setTickSize(this._tickSize);
|
|
@@ -5752,12 +5752,12 @@ function chooseMagnetStrength(mode, strength) {
|
|
|
5752
5752
|
}
|
|
5753
5753
|
var magnetActive = (mode) => mode !== "off";
|
|
5754
5754
|
|
|
5755
|
-
// src/drawings/
|
|
5755
|
+
// src/drawings/drawingToolbarModel.ts
|
|
5756
5756
|
var ARROW_TYPES = ["arrow_marker", "arrow", "arrow_up", "arrow_down"];
|
|
5757
5757
|
var BRUSH_TYPES = ["brush", "highlighter"];
|
|
5758
5758
|
var GLYPH_TYPES = ["emoji", "sticker", "icon"];
|
|
5759
5759
|
var CARD_TYPES = ["image", "content_card"];
|
|
5760
|
-
var
|
|
5760
|
+
var DRAWING_TOOLBAR_PLAN = [
|
|
5761
5761
|
{
|
|
5762
5762
|
id: "trend",
|
|
5763
5763
|
label: "drawing.groupTrend",
|
|
@@ -5818,9 +5818,9 @@ var RAIL_PLAN = [
|
|
|
5818
5818
|
}
|
|
5819
5819
|
];
|
|
5820
5820
|
var isTypeSection = (section) => "types" in section;
|
|
5821
|
-
function
|
|
5821
|
+
function buildDrawingToolbarGroups(catalog2 = drawingTools) {
|
|
5822
5822
|
const toolsOf = (section) => isTypeSection(section) ? section.types.map((type) => catalog2.get(type)).filter((tool2) => !!tool2) : catalog2.byCategory(section.category).filter((tool2) => !(section.exclude ?? []).includes(tool2.type));
|
|
5823
|
-
return
|
|
5823
|
+
return DRAWING_TOOLBAR_PLAN.map((group) => ({
|
|
5824
5824
|
id: group.id,
|
|
5825
5825
|
label: group.label,
|
|
5826
5826
|
sections: group.sections.map((section) => ({ label: section.label, tools: toolsOf(section) })).filter((section) => section.tools.length > 0)
|
|
@@ -5830,12 +5830,12 @@ function groupOfTool(groups, type) {
|
|
|
5830
5830
|
if (!type) return null;
|
|
5831
5831
|
return groups.find((group) => group.sections.some((section) => section.tools.some((tool2) => tool2.type === type)))?.id ?? null;
|
|
5832
5832
|
}
|
|
5833
|
-
function
|
|
5833
|
+
function drawingToolbarFaceOf(group, lastTools) {
|
|
5834
5834
|
const remembered = lastTools[group.id];
|
|
5835
5835
|
if (remembered && group.sections.some((section) => section.tools.some((tool2) => tool2.type === remembered))) return remembered;
|
|
5836
5836
|
return group.sections[0]?.tools[0]?.type ?? null;
|
|
5837
5837
|
}
|
|
5838
|
-
function
|
|
5838
|
+
function rememberDrawingToolbarTool(groups, lastTools, type) {
|
|
5839
5839
|
const group = groupOfTool(groups, type);
|
|
5840
5840
|
if (!group) return { ...lastTools };
|
|
5841
5841
|
return { ...lastTools, [group]: type };
|
|
@@ -6565,7 +6565,7 @@ var DEFAULT_DRAWING_PREFERENCES = {
|
|
|
6565
6565
|
stayInDrawingMode: false,
|
|
6566
6566
|
removeLocked: false,
|
|
6567
6567
|
syncAcrossPanes: true,
|
|
6568
|
-
|
|
6568
|
+
drawingToolbarTools: {},
|
|
6569
6569
|
favorites: DEFAULT_FAVORITES,
|
|
6570
6570
|
settingsBarPosition: null,
|
|
6571
6571
|
recentGlyphs: [],
|
|
@@ -6607,7 +6607,7 @@ function parseDrawingPreferences(raw) {
|
|
|
6607
6607
|
stayInDrawingMode: bool(value.stayInDrawingMode, DEFAULT_DRAWING_PREFERENCES.stayInDrawingMode),
|
|
6608
6608
|
removeLocked: bool(value.removeLocked, DEFAULT_DRAWING_PREFERENCES.removeLocked),
|
|
6609
6609
|
syncAcrossPanes: bool(value.syncAcrossPanes, DEFAULT_DRAWING_PREFERENCES.syncAcrossPanes),
|
|
6610
|
-
|
|
6610
|
+
drawingToolbarTools: stringRecord(value.drawingToolbarTools),
|
|
6611
6611
|
favorites: favoritesOf(value.favorites),
|
|
6612
6612
|
settingsBarPosition: positionOf(value.settingsBarPosition),
|
|
6613
6613
|
recentGlyphs: Array.isArray(value.recentGlyphs) ? value.recentGlyphs.filter((g) => typeof g === "string").slice(0, RECENT_GLYPHS_MAX) : [],
|
|
@@ -6650,7 +6650,7 @@ var DrawingTemplates = class {
|
|
|
6650
6650
|
}
|
|
6651
6651
|
/** Every row of the family, defaults included, each with its preset. A host that has to answer
|
|
6652
6652
|
* synchronously (a placement path, a render) reads this once into a cache of its own rather
|
|
6653
|
-
* fetched: one read per saved setup, once, against a family a
|
|
6653
|
+
* fetched: one read per saved setup, once, against a family a viewer keeps in the dozens. The
|
|
6654
6654
|
* reads run together, `BODY_READS` at a time, and the answer keeps the store's order. */
|
|
6655
6655
|
async listAll(signal) {
|
|
6656
6656
|
const rows = await this.store.list(signal);
|
|
@@ -6701,7 +6701,7 @@ var DrawingTemplates = class {
|
|
|
6701
6701
|
return found ? decodePreset(found.body.content) : {};
|
|
6702
6702
|
}
|
|
6703
6703
|
/** Remember a tool's default. This runs after an ordinary style edit, so a CONFLICT here is not
|
|
6704
|
-
* worth surfacing: another surface already wrote a newer default and the
|
|
6704
|
+
* worth surfacing: another surface already wrote a newer default and the viewer's next edit
|
|
6705
6705
|
* writes again. It is returned rather than swallowed so a caller may still look. */
|
|
6706
6706
|
async rememberDefault(tool2, preset, signal) {
|
|
6707
6707
|
return this.save(tool2, DEFAULT_PRESET_NAME, preset, signal);
|
|
@@ -6849,7 +6849,7 @@ export {
|
|
|
6849
6849
|
parseCssColor,
|
|
6850
6850
|
DEFAULT_VISIBILITY,
|
|
6851
6851
|
visibilityPreset,
|
|
6852
|
-
|
|
6852
|
+
parseTimeframeContext,
|
|
6853
6853
|
normalizeVisibility,
|
|
6854
6854
|
visibleAt,
|
|
6855
6855
|
DEFAULT_STYLE,
|
|
@@ -6894,11 +6894,11 @@ export {
|
|
|
6894
6894
|
BRUSH_TYPES,
|
|
6895
6895
|
GLYPH_TYPES,
|
|
6896
6896
|
CARD_TYPES,
|
|
6897
|
-
|
|
6898
|
-
|
|
6897
|
+
DRAWING_TOOLBAR_PLAN,
|
|
6898
|
+
buildDrawingToolbarGroups,
|
|
6899
6899
|
groupOfTool,
|
|
6900
|
-
|
|
6901
|
-
|
|
6900
|
+
drawingToolbarFaceOf,
|
|
6901
|
+
rememberDrawingToolbarTool,
|
|
6902
6902
|
CHART_HIDE_LAYERS,
|
|
6903
6903
|
hideOrder,
|
|
6904
6904
|
DEFAULT_HIDE_STATE,
|
|
@@ -6960,4 +6960,4 @@ export {
|
|
|
6960
6960
|
NO_DASH,
|
|
6961
6961
|
INPUT_PROPS
|
|
6962
6962
|
};
|
|
6963
|
-
//# sourceMappingURL=chunk-
|
|
6963
|
+
//# sourceMappingURL=chunk-6S6TO2N6.js.map
|