@trdrs/quickcharts 1.2.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 +120 -0
- package/README.md +742 -180
- 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-RDAK5MUM.js → chunk-6S6TO2N6.js} +41 -37
- 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 +51 -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 +599 -225
- package/dist/index.js +10110 -9106
- 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 +218 -205
- 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 +99 -11
- 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-KFBQSPNA.js.map +0 -1
- package/dist/chunk-RDAK5MUM.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 };
|
|
@@ -6049,7 +6049,11 @@ var SWATCH_BLOCKS = [[GREY_RAMP, HUE_BASES], HUE_RAMPS];
|
|
|
6049
6049
|
// src/ui/controls/dom.ts
|
|
6050
6050
|
function focusables(root) {
|
|
6051
6051
|
const nodes = root.querySelectorAll("button, [href], input, select, textarea, [tabindex]");
|
|
6052
|
-
return [...nodes].filter((n) => !n.hasAttribute("disabled") && n.tabIndex >= 0 && !n
|
|
6052
|
+
return [...nodes].filter((n) => !n.hasAttribute("disabled") && n.tabIndex >= 0 && !hiddenWithin(n, root) && n.getAttribute("aria-hidden") !== "true");
|
|
6053
|
+
}
|
|
6054
|
+
function hiddenWithin(node, root) {
|
|
6055
|
+
for (let el2 = node; el2 && el2 !== root; el2 = el2.parentElement) if (el2.hidden) return true;
|
|
6056
|
+
return false;
|
|
6053
6057
|
}
|
|
6054
6058
|
function isRtl(node) {
|
|
6055
6059
|
const dir = node.closest("[dir]")?.getAttribute("dir") ?? (typeof getComputedStyle === "function" ? getComputedStyle(node).direction : "ltr");
|
|
@@ -6561,7 +6565,7 @@ var DEFAULT_DRAWING_PREFERENCES = {
|
|
|
6561
6565
|
stayInDrawingMode: false,
|
|
6562
6566
|
removeLocked: false,
|
|
6563
6567
|
syncAcrossPanes: true,
|
|
6564
|
-
|
|
6568
|
+
drawingToolbarTools: {},
|
|
6565
6569
|
favorites: DEFAULT_FAVORITES,
|
|
6566
6570
|
settingsBarPosition: null,
|
|
6567
6571
|
recentGlyphs: [],
|
|
@@ -6603,7 +6607,7 @@ function parseDrawingPreferences(raw) {
|
|
|
6603
6607
|
stayInDrawingMode: bool(value.stayInDrawingMode, DEFAULT_DRAWING_PREFERENCES.stayInDrawingMode),
|
|
6604
6608
|
removeLocked: bool(value.removeLocked, DEFAULT_DRAWING_PREFERENCES.removeLocked),
|
|
6605
6609
|
syncAcrossPanes: bool(value.syncAcrossPanes, DEFAULT_DRAWING_PREFERENCES.syncAcrossPanes),
|
|
6606
|
-
|
|
6610
|
+
drawingToolbarTools: stringRecord(value.drawingToolbarTools),
|
|
6607
6611
|
favorites: favoritesOf(value.favorites),
|
|
6608
6612
|
settingsBarPosition: positionOf(value.settingsBarPosition),
|
|
6609
6613
|
recentGlyphs: Array.isArray(value.recentGlyphs) ? value.recentGlyphs.filter((g) => typeof g === "string").slice(0, RECENT_GLYPHS_MAX) : [],
|
|
@@ -6646,7 +6650,7 @@ var DrawingTemplates = class {
|
|
|
6646
6650
|
}
|
|
6647
6651
|
/** Every row of the family, defaults included, each with its preset. A host that has to answer
|
|
6648
6652
|
* synchronously (a placement path, a render) reads this once into a cache of its own rather
|
|
6649
|
-
* 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
|
|
6650
6654
|
* reads run together, `BODY_READS` at a time, and the answer keeps the store's order. */
|
|
6651
6655
|
async listAll(signal) {
|
|
6652
6656
|
const rows = await this.store.list(signal);
|
|
@@ -6697,7 +6701,7 @@ var DrawingTemplates = class {
|
|
|
6697
6701
|
return found ? decodePreset(found.body.content) : {};
|
|
6698
6702
|
}
|
|
6699
6703
|
/** Remember a tool's default. This runs after an ordinary style edit, so a CONFLICT here is not
|
|
6700
|
-
* 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
|
|
6701
6705
|
* writes again. It is returned rather than swallowed so a caller may still look. */
|
|
6702
6706
|
async rememberDefault(tool2, preset, signal) {
|
|
6703
6707
|
return this.save(tool2, DEFAULT_PRESET_NAME, preset, signal);
|
|
@@ -6845,7 +6849,7 @@ export {
|
|
|
6845
6849
|
parseCssColor,
|
|
6846
6850
|
DEFAULT_VISIBILITY,
|
|
6847
6851
|
visibilityPreset,
|
|
6848
|
-
|
|
6852
|
+
parseTimeframeContext,
|
|
6849
6853
|
normalizeVisibility,
|
|
6850
6854
|
visibleAt,
|
|
6851
6855
|
DEFAULT_STYLE,
|
|
@@ -6862,9 +6866,6 @@ export {
|
|
|
6862
6866
|
serializeDrawingsStore,
|
|
6863
6867
|
restoreDrawings,
|
|
6864
6868
|
drawingTools,
|
|
6865
|
-
editRefused,
|
|
6866
|
-
removableDrawings,
|
|
6867
|
-
removeRows,
|
|
6868
6869
|
CURSOR_MODES,
|
|
6869
6870
|
CURSOR_LABELS,
|
|
6870
6871
|
TRANSIENT_TOOLS,
|
|
@@ -6873,6 +6874,9 @@ export {
|
|
|
6873
6874
|
transientSurvives,
|
|
6874
6875
|
toolAfterPlacement,
|
|
6875
6876
|
cursorButtonArmed,
|
|
6877
|
+
editRefused,
|
|
6878
|
+
removableDrawings,
|
|
6879
|
+
removeRows,
|
|
6876
6880
|
CLONE_OFFSET_PX,
|
|
6877
6881
|
commitText,
|
|
6878
6882
|
cancelText,
|
|
@@ -6890,11 +6894,11 @@ export {
|
|
|
6890
6894
|
BRUSH_TYPES,
|
|
6891
6895
|
GLYPH_TYPES,
|
|
6892
6896
|
CARD_TYPES,
|
|
6893
|
-
|
|
6894
|
-
|
|
6897
|
+
DRAWING_TOOLBAR_PLAN,
|
|
6898
|
+
buildDrawingToolbarGroups,
|
|
6895
6899
|
groupOfTool,
|
|
6896
|
-
|
|
6897
|
-
|
|
6900
|
+
drawingToolbarFaceOf,
|
|
6901
|
+
rememberDrawingToolbarTool,
|
|
6898
6902
|
CHART_HIDE_LAYERS,
|
|
6899
6903
|
hideOrder,
|
|
6900
6904
|
DEFAULT_HIDE_STATE,
|
|
@@ -6956,4 +6960,4 @@ export {
|
|
|
6956
6960
|
NO_DASH,
|
|
6957
6961
|
INPUT_PROPS
|
|
6958
6962
|
};
|
|
6959
|
-
//# sourceMappingURL=chunk-
|
|
6963
|
+
//# sourceMappingURL=chunk-6S6TO2N6.js.map
|