@baron1996/klinecharts-runtime 0.9.13 → 0.9.15
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/README.md +37 -2
- package/dist/drawing/capabilities.d.ts +13 -1
- package/dist/drawing/capabilities.d.ts.map +1 -1
- package/dist/drawing/progressive-workspace-runtime.d.ts +10 -2
- package/dist/drawing/progressive-workspace-runtime.d.ts.map +1 -1
- package/dist/drawing/progressive-workspace-runtime.js +32 -5
- package/dist/drawing/session-controller.d.ts.map +1 -1
- package/dist/drawing/session-controller.js +9 -1
- package/dist/drawing/workspace-events.d.ts +10 -1
- package/dist/drawing/workspace-events.d.ts.map +1 -1
- package/dist/drawing/workspace-runtime.d.ts +12 -4
- package/dist/drawing/workspace-runtime.d.ts.map +1 -1
- package/dist/drawing/workspace-runtime.js +125 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/indicator-presentation.d.ts +34 -0
- package/dist/indicator-presentation.d.ts.map +1 -0
- package/dist/indicator-presentation.js +53 -0
- package/dist/toolbar/chart-workspace-toolbar-styles.d.ts +2 -0
- package/dist/toolbar/chart-workspace-toolbar-styles.d.ts.map +1 -0
- package/dist/toolbar/chart-workspace-toolbar-styles.js +213 -0
- package/dist/toolbar/chart-workspace-toolbar.d.ts +46 -0
- package/dist/toolbar/chart-workspace-toolbar.d.ts.map +1 -0
- package/dist/toolbar/chart-workspace-toolbar.js +684 -0
- package/dist/toolbar/drawing-floating-toolbar.d.ts +2 -2
- package/dist/toolbar/drawing-floating-toolbar.d.ts.map +1 -1
- package/dist/toolbar/drawing-floating-toolbar.js +18 -3
- package/dist/toolbar/toolbar-icons.d.ts +89 -0
- package/dist/toolbar/toolbar-icons.d.ts.map +1 -1
- package/dist/toolbar/toolbar-icons.js +26 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawing-floating-toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/drawing-floating-toolbar.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EACX,sBAAsB,EACtB,6BAA6B,EAC7B,MAAM,aAAa,CAAC;AAgFrB;;;GAGG;AACH,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,wBAAwB,EACjC,OAAO,GAAE,6BAAkC,GACzC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"drawing-floating-toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/drawing-floating-toolbar.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EACX,sBAAsB,EACtB,6BAA6B,EAC7B,MAAM,aAAa,CAAC;AAgFrB;;;GAGG;AACH,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,wBAAwB,EACjC,OAAO,GAAE,6BAAkC,GACzC,sBAAsB,CA4XxB"}
|
|
@@ -62,8 +62,8 @@ function selectedDrawing(runtime) {
|
|
|
62
62
|
return id === undefined ? undefined : runtime.getDrawing(id);
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* 创建选中 Drawing
|
|
66
|
-
*
|
|
65
|
+
* 创建选中 Drawing 的对象级浮动工具栏。普通模式使用 body portal,目标图表所属工作区
|
|
66
|
+
* 进入元素全屏时迁入对应全屏子树;拖动位置只保存在当前实例内,刷新后回到图表顶部中央。
|
|
67
67
|
*/
|
|
68
68
|
export function createDrawingFloatingToolbar(target, runtime, options = {}) {
|
|
69
69
|
const style = document.createElement('style');
|
|
@@ -125,7 +125,13 @@ export function createDrawingFloatingToolbar(target, runtime, options = {}) {
|
|
|
125
125
|
status.hidden = true;
|
|
126
126
|
root.append(grip, type, createSeparator(), color, lineStyle.label, lineWidth.label, textInput, createSeparator(), lock, remove, status);
|
|
127
127
|
document.head.append(style);
|
|
128
|
-
|
|
128
|
+
const resolvePortalHost = () => {
|
|
129
|
+
const fullscreenElement = document.fullscreenElement;
|
|
130
|
+
return fullscreenElement !== null && fullscreenElement.contains(target)
|
|
131
|
+
? fullscreenElement
|
|
132
|
+
: document.body;
|
|
133
|
+
};
|
|
134
|
+
resolvePortalHost().append(root);
|
|
129
135
|
let destroyed = false;
|
|
130
136
|
let userPositioned = false;
|
|
131
137
|
let dragging = null;
|
|
@@ -327,8 +333,16 @@ export function createDrawingFloatingToolbar(target, runtime, options = {}) {
|
|
|
327
333
|
grip.addEventListener('pointercancel', finishDrag);
|
|
328
334
|
const unsubscribe = runtime.subscribeDrawingChanges(render);
|
|
329
335
|
const handleViewportChange = () => clampCurrentPosition();
|
|
336
|
+
const handleFullscreenChange = () => {
|
|
337
|
+
const portalHost = resolvePortalHost();
|
|
338
|
+
if (root.parentNode !== portalHost) {
|
|
339
|
+
portalHost.append(root);
|
|
340
|
+
}
|
|
341
|
+
clampCurrentPosition();
|
|
342
|
+
};
|
|
330
343
|
window.addEventListener('resize', handleViewportChange);
|
|
331
344
|
window.addEventListener('scroll', handleViewportChange, true);
|
|
345
|
+
document.addEventListener('fullscreenchange', handleFullscreenChange);
|
|
332
346
|
const resizeObserver = typeof ResizeObserver === 'undefined'
|
|
333
347
|
? null
|
|
334
348
|
: new ResizeObserver(handleViewportChange);
|
|
@@ -354,6 +368,7 @@ export function createDrawingFloatingToolbar(target, runtime, options = {}) {
|
|
|
354
368
|
resizeObserver?.disconnect();
|
|
355
369
|
window.removeEventListener('resize', handleViewportChange);
|
|
356
370
|
window.removeEventListener('scroll', handleViewportChange, true);
|
|
371
|
+
document.removeEventListener('fullscreenchange', handleFullscreenChange);
|
|
357
372
|
colorInput.removeEventListener('change', handleColorChange);
|
|
358
373
|
lineStyle.select.removeEventListener('change', handleLineStyleChange);
|
|
359
374
|
lineWidth.select.removeEventListener('change', handleLineWidthChange);
|
|
@@ -507,6 +507,95 @@ declare const ICON_SPECS: {
|
|
|
507
507
|
readonly d: "M11.5 21h-4.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v5m-5 6h7m-3 -3l3 3l-3 3";
|
|
508
508
|
};
|
|
509
509
|
}];
|
|
510
|
+
readonly indicator: readonly [{
|
|
511
|
+
readonly name: "path";
|
|
512
|
+
readonly attributes: {
|
|
513
|
+
readonly d: "M3 17l5 -5l4 4l8 -10";
|
|
514
|
+
};
|
|
515
|
+
}, {
|
|
516
|
+
readonly name: "path";
|
|
517
|
+
readonly attributes: {
|
|
518
|
+
readonly d: "M17 6h3v3";
|
|
519
|
+
};
|
|
520
|
+
}];
|
|
521
|
+
readonly timezone: readonly [{
|
|
522
|
+
readonly name: "circle";
|
|
523
|
+
readonly attributes: {
|
|
524
|
+
readonly cx: "12";
|
|
525
|
+
readonly cy: "12";
|
|
526
|
+
readonly r: "9";
|
|
527
|
+
};
|
|
528
|
+
}, {
|
|
529
|
+
readonly name: "path";
|
|
530
|
+
readonly attributes: {
|
|
531
|
+
readonly d: "M3 12h18";
|
|
532
|
+
};
|
|
533
|
+
}, {
|
|
534
|
+
readonly name: "path";
|
|
535
|
+
readonly attributes: {
|
|
536
|
+
readonly d: "M12 3a14 14 0 0 1 0 18";
|
|
537
|
+
};
|
|
538
|
+
}, {
|
|
539
|
+
readonly name: "path";
|
|
540
|
+
readonly attributes: {
|
|
541
|
+
readonly d: "M12 3a14 14 0 0 0 0 18";
|
|
542
|
+
};
|
|
543
|
+
}];
|
|
544
|
+
readonly settings: readonly [{
|
|
545
|
+
readonly name: "circle";
|
|
546
|
+
readonly attributes: {
|
|
547
|
+
readonly cx: "12";
|
|
548
|
+
readonly cy: "12";
|
|
549
|
+
readonly r: "3";
|
|
550
|
+
};
|
|
551
|
+
}, {
|
|
552
|
+
readonly name: "path";
|
|
553
|
+
readonly attributes: {
|
|
554
|
+
readonly d: "M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06 .06l-2.83 2.83l-.06 -.06a1.7 1.7 0 0 0 -1.88 -.34a1.7 1.7 0 0 0 -1.03 1.56v.17h-4v-.17a1.7 1.7 0 0 0 -1.03 -1.56a1.7 1.7 0 0 0 -1.88 .34l-.06 .06l-2.83 -2.83l.06 -.06a1.7 1.7 0 0 0 .34 -1.88a1.7 1.7 0 0 0 -1.56 -1.03h-.17v-4h.17a1.7 1.7 0 0 0 1.56 -1.03a1.7 1.7 0 0 0 -.34 -1.88l-.06 -.06l2.83 -2.83l.06 .06a1.7 1.7 0 0 0 1.88 .34h.01a1.7 1.7 0 0 0 1.02 -1.56v-.17h4v.17a1.7 1.7 0 0 0 1.03 1.56a1.7 1.7 0 0 0 1.88 -.34l.06 -.06l2.83 2.83l-.06 .06a1.7 1.7 0 0 0 -.34 1.88v.01a1.7 1.7 0 0 0 1.56 1.02h.17v4h-.17a1.7 1.7 0 0 0 -1.56 1.03";
|
|
555
|
+
};
|
|
556
|
+
}];
|
|
557
|
+
readonly fullscreen: readonly [{
|
|
558
|
+
readonly name: "path";
|
|
559
|
+
readonly attributes: {
|
|
560
|
+
readonly d: "M4 8v-4h4";
|
|
561
|
+
};
|
|
562
|
+
}, {
|
|
563
|
+
readonly name: "path";
|
|
564
|
+
readonly attributes: {
|
|
565
|
+
readonly d: "M16 4h4v4";
|
|
566
|
+
};
|
|
567
|
+
}, {
|
|
568
|
+
readonly name: "path";
|
|
569
|
+
readonly attributes: {
|
|
570
|
+
readonly d: "M20 16v4h-4";
|
|
571
|
+
};
|
|
572
|
+
}, {
|
|
573
|
+
readonly name: "path";
|
|
574
|
+
readonly attributes: {
|
|
575
|
+
readonly d: "M8 20h-4v-4";
|
|
576
|
+
};
|
|
577
|
+
}];
|
|
578
|
+
readonly fullscreenExit: readonly [{
|
|
579
|
+
readonly name: "path";
|
|
580
|
+
readonly attributes: {
|
|
581
|
+
readonly d: "M8 4v4h-4";
|
|
582
|
+
};
|
|
583
|
+
}, {
|
|
584
|
+
readonly name: "path";
|
|
585
|
+
readonly attributes: {
|
|
586
|
+
readonly d: "M16 4v4h4";
|
|
587
|
+
};
|
|
588
|
+
}, {
|
|
589
|
+
readonly name: "path";
|
|
590
|
+
readonly attributes: {
|
|
591
|
+
readonly d: "M20 16h-4v4";
|
|
592
|
+
};
|
|
593
|
+
}, {
|
|
594
|
+
readonly name: "path";
|
|
595
|
+
readonly attributes: {
|
|
596
|
+
readonly d: "M4 16h4v4";
|
|
597
|
+
};
|
|
598
|
+
}];
|
|
510
599
|
};
|
|
511
600
|
export type ToolbarIconName = keyof typeof ICON_SPECS;
|
|
512
601
|
/** 使用 DOM API 创建符合 24×24 / 2px 规范的工具栏图标。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar-icons.d.ts","sourceRoot":"","sources":["../../src/toolbar/toolbar-icons.ts"],"names":[],"mappings":"AAcA,QAAA,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"toolbar-icons.d.ts","sourceRoot":"","sources":["../../src/toolbar/toolbar-icons.ts"],"names":[],"mappings":"AAcA,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgO2C,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,UAAU,CAAC;AAEtD,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,aAAa,CAoBtE"}
|
|
@@ -201,6 +201,32 @@ const ICON_SPECS = {
|
|
|
201
201
|
},
|
|
202
202
|
},
|
|
203
203
|
],
|
|
204
|
+
indicator: [
|
|
205
|
+
{ name: 'path', attributes: { d: 'M3 17l5 -5l4 4l8 -10' } },
|
|
206
|
+
{ name: 'path', attributes: { d: 'M17 6h3v3' } },
|
|
207
|
+
],
|
|
208
|
+
timezone: [
|
|
209
|
+
{ name: 'circle', attributes: { cx: '12', cy: '12', r: '9' } },
|
|
210
|
+
{ name: 'path', attributes: { d: 'M3 12h18' } },
|
|
211
|
+
{ name: 'path', attributes: { d: 'M12 3a14 14 0 0 1 0 18' } },
|
|
212
|
+
{ name: 'path', attributes: { d: 'M12 3a14 14 0 0 0 0 18' } },
|
|
213
|
+
],
|
|
214
|
+
settings: [
|
|
215
|
+
{ name: 'circle', attributes: { cx: '12', cy: '12', r: '3' } },
|
|
216
|
+
{ name: 'path', attributes: { d: 'M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06 .06l-2.83 2.83l-.06 -.06a1.7 1.7 0 0 0 -1.88 -.34a1.7 1.7 0 0 0 -1.03 1.56v.17h-4v-.17a1.7 1.7 0 0 0 -1.03 -1.56a1.7 1.7 0 0 0 -1.88 .34l-.06 .06l-2.83 -2.83l.06 -.06a1.7 1.7 0 0 0 .34 -1.88a1.7 1.7 0 0 0 -1.56 -1.03h-.17v-4h.17a1.7 1.7 0 0 0 1.56 -1.03a1.7 1.7 0 0 0 -.34 -1.88l-.06 -.06l2.83 -2.83l.06 .06a1.7 1.7 0 0 0 1.88 .34h.01a1.7 1.7 0 0 0 1.02 -1.56v-.17h4v.17a1.7 1.7 0 0 0 1.03 1.56a1.7 1.7 0 0 0 1.88 -.34l.06 -.06l2.83 2.83l-.06 .06a1.7 1.7 0 0 0 -.34 1.88v.01a1.7 1.7 0 0 0 1.56 1.02h.17v4h-.17a1.7 1.7 0 0 0 -1.56 1.03' } },
|
|
217
|
+
],
|
|
218
|
+
fullscreen: [
|
|
219
|
+
{ name: 'path', attributes: { d: 'M4 8v-4h4' } },
|
|
220
|
+
{ name: 'path', attributes: { d: 'M16 4h4v4' } },
|
|
221
|
+
{ name: 'path', attributes: { d: 'M20 16v4h-4' } },
|
|
222
|
+
{ name: 'path', attributes: { d: 'M8 20h-4v-4' } },
|
|
223
|
+
],
|
|
224
|
+
fullscreenExit: [
|
|
225
|
+
{ name: 'path', attributes: { d: 'M8 4v4h-4' } },
|
|
226
|
+
{ name: 'path', attributes: { d: 'M16 4v4h4' } },
|
|
227
|
+
{ name: 'path', attributes: { d: 'M20 16h-4v4' } },
|
|
228
|
+
{ name: 'path', attributes: { d: 'M4 16h4v4' } },
|
|
229
|
+
],
|
|
204
230
|
};
|
|
205
231
|
/** 使用 DOM API 创建符合 24×24 / 2px 规范的工具栏图标。 */
|
|
206
232
|
export function createToolbarIcon(name) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baron1996/klinecharts-runtime",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.15",
|
|
4
4
|
"description": "Web runtime for deterministic KLineCharts scenes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@baron1996/kline-scene-schema": "0.9.
|
|
43
|
-
"@baron1996/klinecharts-adapter": "0.9.
|
|
42
|
+
"@baron1996/kline-scene-schema": "0.9.15",
|
|
43
|
+
"@baron1996/klinecharts-adapter": "0.9.15",
|
|
44
44
|
"@js-temporal/polyfill": "0.5.1"
|
|
45
45
|
}
|
|
46
46
|
}
|