@baron1996/klinecharts-runtime 0.2.3 → 0.4.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/README.md +1 -1
- package/dist/drawing/capabilities.d.ts +36 -0
- package/dist/drawing/capabilities.d.ts.map +1 -0
- package/dist/drawing/capabilities.js +1 -0
- package/dist/drawing/legacy-runtime-capability.d.ts +8 -0
- package/dist/drawing/legacy-runtime-capability.d.ts.map +1 -0
- package/dist/drawing/legacy-runtime-capability.js +92 -0
- package/dist/drawing/projection-service.d.ts +80 -0
- package/dist/drawing/projection-service.d.ts.map +1 -0
- package/dist/drawing/projection-service.js +523 -0
- package/dist/drawing/runtime-capability-descriptor.d.ts +28 -0
- package/dist/drawing/runtime-capability-descriptor.d.ts.map +1 -0
- package/dist/drawing/runtime-capability-descriptor.js +1 -0
- package/dist/drawing/scene-runtime-factory.d.ts +15 -0
- package/dist/drawing/scene-runtime-factory.d.ts.map +1 -0
- package/dist/drawing/scene-runtime-factory.js +27 -0
- package/dist/drawing/session-controller.d.ts +53 -0
- package/dist/drawing/session-controller.d.ts.map +1 -0
- package/dist/drawing/session-controller.js +339 -0
- package/dist/drawing/workspace-events.d.ts +66 -0
- package/dist/drawing/workspace-events.d.ts.map +1 -0
- package/dist/drawing/workspace-events.js +12 -0
- package/dist/drawing/workspace-runtime.d.ts +60 -0
- package/dist/drawing/workspace-runtime.d.ts.map +1 -0
- package/dist/drawing/workspace-runtime.js +328 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/runtime.d.ts +29 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +97 -1
- package/dist/time-series-runtime-styles.d.ts +2 -0
- package/dist/time-series-runtime-styles.d.ts.map +1 -0
- package/dist/time-series-runtime-styles.js +98 -0
- package/dist/time-series-runtime.d.ts +3 -0
- package/dist/time-series-runtime.d.ts.map +1 -0
- package/dist/time-series-runtime.js +301 -0
- package/dist/time-series-types.d.ts +42 -0
- package/dist/time-series-types.d.ts.map +1 -0
- package/dist/time-series-types.js +1 -0
- package/dist/toolbar/standard-toolbar-styles.d.ts.map +1 -1
- package/dist/toolbar/standard-toolbar-styles.js +18 -0
- package/dist/toolbar/standard-toolbar.d.ts +4 -2
- package/dist/toolbar/standard-toolbar.d.ts.map +1 -1
- package/dist/toolbar/standard-toolbar.js +187 -31
- package/dist/toolbar/toolbar-icons.d.ts +26 -0
- package/dist/toolbar/toolbar-icons.d.ts.map +1 -1
- package/dist/toolbar/toolbar-icons.js +13 -0
- package/dist/toolbar/toolbar-tools.d.ts +6 -1
- package/dist/toolbar/toolbar-tools.d.ts.map +1 -1
- package/dist/toolbar/toolbar-tools.js +6 -0
- package/dist/types.d.ts +7 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { parseTimeSeriesScene, TimeSeriesSceneError, } from '@baron1996/kline-scene-schema';
|
|
2
|
+
import { TimeSeriesChartsAdapter, } from '@baron1996/klinecharts-adapter';
|
|
3
|
+
import { TIME_SERIES_RUNTIME_STYLES } from './time-series-runtime-styles.js';
|
|
4
|
+
function runtimeError() {
|
|
5
|
+
return new TimeSeriesSceneError('TIME_SERIES_RUNTIME_DESTROYED', '/runtime', 'The Time Series Runtime has been destroyed.');
|
|
6
|
+
}
|
|
7
|
+
function adapterError(error) {
|
|
8
|
+
if (error instanceof TimeSeriesSceneError) {
|
|
9
|
+
return error;
|
|
10
|
+
}
|
|
11
|
+
return new TimeSeriesSceneError('TIME_SERIES_ADAPTER_FAILED', '/runtime/adapter', 'The Time Series Adapter operation failed.');
|
|
12
|
+
}
|
|
13
|
+
function exportError(error) {
|
|
14
|
+
const issues = error instanceof TimeSeriesSceneError
|
|
15
|
+
? error.issues.map((issue) => ({
|
|
16
|
+
...issue,
|
|
17
|
+
code: 'TIME_SERIES_EXPORT_INVALID',
|
|
18
|
+
}))
|
|
19
|
+
: [{
|
|
20
|
+
code: 'TIME_SERIES_EXPORT_INVALID',
|
|
21
|
+
path: '/',
|
|
22
|
+
message: 'Time Series Scene export validation failed.',
|
|
23
|
+
}];
|
|
24
|
+
return new TimeSeriesSceneError('TIME_SERIES_EXPORT_INVALID', '/', 'Time Series Scene export validation failed.', issues);
|
|
25
|
+
}
|
|
26
|
+
function createSwatch(color) {
|
|
27
|
+
const swatch = document.createElement('span');
|
|
28
|
+
swatch.className = 'baron-time-series-runtime__swatch';
|
|
29
|
+
swatch.setAttribute('aria-hidden', 'true');
|
|
30
|
+
swatch.style.setProperty('--baron-time-series-color', color);
|
|
31
|
+
return swatch;
|
|
32
|
+
}
|
|
33
|
+
function notifyRuntimeListener(listener, event) {
|
|
34
|
+
try {
|
|
35
|
+
listener(structuredClone(event));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// 宿主回调异常不得改变 Runtime 已完成的状态变更或错误语义。
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** 独立的通用时间序列 Runtime,不公开或复用旧 K 线 Runtime 状态。 */
|
|
42
|
+
class TimeSeriesRuntimeImplementation {
|
|
43
|
+
/** 唯一受控的时间序列 Adapter。 */
|
|
44
|
+
#adapter;
|
|
45
|
+
/** Runtime 纯数据事件监听器。 */
|
|
46
|
+
#listeners = new Set();
|
|
47
|
+
/** 图例按钮,按 Scene 中 series 的声明顺序保存。 */
|
|
48
|
+
#legendButtons = new Map();
|
|
49
|
+
/** 图例按钮事件解绑函数。 */
|
|
50
|
+
#legendCleanups = [];
|
|
51
|
+
/** Runtime 自有覆盖层根节点。 */
|
|
52
|
+
#root;
|
|
53
|
+
/** Runtime 自有样式节点。 */
|
|
54
|
+
#styleElement;
|
|
55
|
+
/** 十字线 Tooltip 节点。 */
|
|
56
|
+
#tooltip;
|
|
57
|
+
/** Adapter 十字线监听器解绑函数。 */
|
|
58
|
+
#unsubscribeCrosshair;
|
|
59
|
+
/** Adapter 容器。 */
|
|
60
|
+
#container;
|
|
61
|
+
/** 创建前容器内联 position,销毁时精确恢复。 */
|
|
62
|
+
#originalPosition;
|
|
63
|
+
/** 当前完整且通过校验的 Scene。 */
|
|
64
|
+
#scene;
|
|
65
|
+
/** 防止销毁后继续访问 Adapter。 */
|
|
66
|
+
#destroyed = false;
|
|
67
|
+
constructor(container, scene, adapter, options) {
|
|
68
|
+
this.#container = container;
|
|
69
|
+
this.#scene = scene;
|
|
70
|
+
this.#adapter = adapter;
|
|
71
|
+
this.#originalPosition = container.style.position;
|
|
72
|
+
if (getComputedStyle(container).position === 'static') {
|
|
73
|
+
container.style.position = 'relative';
|
|
74
|
+
}
|
|
75
|
+
if (options.onEvent !== undefined) {
|
|
76
|
+
this.#listeners.add(options.onEvent);
|
|
77
|
+
}
|
|
78
|
+
this.#styleElement = document.createElement('style');
|
|
79
|
+
this.#styleElement.dataset.baronTimeSeriesStyle = 'true';
|
|
80
|
+
this.#styleElement.textContent = TIME_SERIES_RUNTIME_STYLES;
|
|
81
|
+
this.#root = document.createElement('div');
|
|
82
|
+
this.#root.className = 'baron-time-series-runtime';
|
|
83
|
+
this.#root.style.setProperty('--baron-time-series-text', scene.chart.layout.textColor);
|
|
84
|
+
this.#root.style.setProperty('--baron-time-series-background', scene.chart.layout.backgroundColor);
|
|
85
|
+
this.#root.style.setProperty('--baron-time-series-font', scene.chart.layout.fontFamily);
|
|
86
|
+
const legend = document.createElement('div');
|
|
87
|
+
legend.className = 'baron-time-series-runtime__legend';
|
|
88
|
+
legend.setAttribute('aria-label', '时间序列图例');
|
|
89
|
+
for (const series of scene.series) {
|
|
90
|
+
const button = document.createElement('button');
|
|
91
|
+
button.type = 'button';
|
|
92
|
+
button.className = 'baron-time-series-runtime__legend-button';
|
|
93
|
+
button.dataset.timeSeriesId = series.id;
|
|
94
|
+
button.setAttribute('aria-pressed', String(series.visible));
|
|
95
|
+
button.append(createSwatch(series.style.color), series.name);
|
|
96
|
+
const handleClick = () => {
|
|
97
|
+
this.setSeriesVisible(series.id, button.getAttribute('aria-pressed') !== 'true');
|
|
98
|
+
};
|
|
99
|
+
button.addEventListener('click', handleClick);
|
|
100
|
+
this.#legendCleanups.push(() => button.removeEventListener('click', handleClick));
|
|
101
|
+
this.#legendButtons.set(series.id, button);
|
|
102
|
+
legend.append(button);
|
|
103
|
+
}
|
|
104
|
+
this.#tooltip = document.createElement('div');
|
|
105
|
+
this.#tooltip.className = 'baron-time-series-runtime__tooltip';
|
|
106
|
+
this.#tooltip.hidden = true;
|
|
107
|
+
this.#tooltip.setAttribute('role', 'status');
|
|
108
|
+
this.#root.append(legend, this.#tooltip);
|
|
109
|
+
container.append(this.#styleElement, this.#root);
|
|
110
|
+
this.#unsubscribeCrosshair = adapter.subscribeCrosshair((event) => this.#handleCrosshair(event));
|
|
111
|
+
}
|
|
112
|
+
static async create(container, value, options = {}) {
|
|
113
|
+
let adapter = null;
|
|
114
|
+
try {
|
|
115
|
+
const scene = parseTimeSeriesScene(value);
|
|
116
|
+
adapter = await TimeSeriesChartsAdapter.create(container, scene);
|
|
117
|
+
const runtime = new TimeSeriesRuntimeImplementation(container, scene, adapter, options);
|
|
118
|
+
runtime.#emit({ type: 'scene-ready', scene: runtime.exportScene() });
|
|
119
|
+
return runtime;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
adapter?.dispose();
|
|
123
|
+
const normalized = adapterError(error);
|
|
124
|
+
if (options.onEvent !== undefined) {
|
|
125
|
+
notifyRuntimeListener(options.onEvent, {
|
|
126
|
+
type: 'scene-error',
|
|
127
|
+
issues: structuredClone(normalized.issues),
|
|
128
|
+
sceneVersion: 1,
|
|
129
|
+
runtimeVersion: '0.1.0',
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
throw normalized;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
#assertActive() {
|
|
136
|
+
if (this.#destroyed) {
|
|
137
|
+
throw runtimeError();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
#emit(payload) {
|
|
141
|
+
const event = {
|
|
142
|
+
...structuredClone(payload),
|
|
143
|
+
sceneVersion: 1,
|
|
144
|
+
runtimeVersion: '0.1.0',
|
|
145
|
+
};
|
|
146
|
+
for (const listener of this.#listeners) {
|
|
147
|
+
notifyRuntimeListener(listener, event);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
#emitError(error) {
|
|
151
|
+
this.#emit({ type: 'scene-error', issues: structuredClone(error.issues) });
|
|
152
|
+
}
|
|
153
|
+
#handleCrosshair(event) {
|
|
154
|
+
const tooltip = this.#tooltip;
|
|
155
|
+
const scene = this.#scene;
|
|
156
|
+
if (this.#destroyed || tooltip === null || scene === null) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
tooltip.replaceChildren();
|
|
160
|
+
if (event.timestamp === null || event.values === null) {
|
|
161
|
+
tooltip.hidden = true;
|
|
162
|
+
this.#emit({
|
|
163
|
+
type: 'crosshair-changed',
|
|
164
|
+
timestamp: null,
|
|
165
|
+
values: null,
|
|
166
|
+
});
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const time = document.createElement('div');
|
|
170
|
+
time.className = 'baron-time-series-runtime__tooltip-time';
|
|
171
|
+
time.textContent = new Intl.DateTimeFormat(scene.chart.locale, {
|
|
172
|
+
timeZone: scene.chart.timezone,
|
|
173
|
+
year: 'numeric',
|
|
174
|
+
month: '2-digit',
|
|
175
|
+
day: '2-digit',
|
|
176
|
+
}).format(new Date(event.timestamp));
|
|
177
|
+
tooltip.append(time);
|
|
178
|
+
for (const series of scene.series) {
|
|
179
|
+
if (!series.visible) {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const row = document.createElement('div');
|
|
183
|
+
row.className = 'baron-time-series-runtime__tooltip-row';
|
|
184
|
+
const name = document.createElement('span');
|
|
185
|
+
name.className = 'baron-time-series-runtime__tooltip-name';
|
|
186
|
+
name.append(createSwatch(series.style.color), series.name);
|
|
187
|
+
const value = document.createElement('span');
|
|
188
|
+
value.className = 'baron-time-series-runtime__tooltip-value';
|
|
189
|
+
const raw = event.values[series.id];
|
|
190
|
+
value.textContent = raw === null || raw === undefined
|
|
191
|
+
? '—'
|
|
192
|
+
: `${raw.toFixed(series.precision)} ${series.unit}`;
|
|
193
|
+
row.append(name, value);
|
|
194
|
+
tooltip.append(row);
|
|
195
|
+
}
|
|
196
|
+
tooltip.hidden = false;
|
|
197
|
+
this.#emit({
|
|
198
|
+
type: 'crosshair-changed',
|
|
199
|
+
timestamp: event.timestamp,
|
|
200
|
+
values: structuredClone(event.values),
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
setSeriesVisible(seriesId, visible) {
|
|
204
|
+
try {
|
|
205
|
+
this.#assertActive();
|
|
206
|
+
const adapter = this.#adapter;
|
|
207
|
+
if (adapter === null) {
|
|
208
|
+
throw runtimeError();
|
|
209
|
+
}
|
|
210
|
+
const scene = adapter.setSeriesVisible(seriesId, visible);
|
|
211
|
+
this.#scene = scene;
|
|
212
|
+
this.#legendButtons.get(seriesId)?.setAttribute('aria-pressed', String(visible));
|
|
213
|
+
const result = structuredClone(scene);
|
|
214
|
+
this.#emit({
|
|
215
|
+
type: 'series-visibility-changed',
|
|
216
|
+
seriesId,
|
|
217
|
+
visible,
|
|
218
|
+
scene: result,
|
|
219
|
+
});
|
|
220
|
+
return structuredClone(result);
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
const normalized = adapterError(error);
|
|
224
|
+
this.#emitError(normalized);
|
|
225
|
+
throw normalized;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async replaceData(data) {
|
|
229
|
+
try {
|
|
230
|
+
this.#assertActive();
|
|
231
|
+
const adapter = this.#adapter;
|
|
232
|
+
if (adapter === null) {
|
|
233
|
+
throw runtimeError();
|
|
234
|
+
}
|
|
235
|
+
const scene = adapter.replaceData(structuredClone(data));
|
|
236
|
+
this.#scene = scene;
|
|
237
|
+
const result = structuredClone(scene);
|
|
238
|
+
this.#emit({
|
|
239
|
+
type: 'data-replaced',
|
|
240
|
+
dataCount: result.data.length,
|
|
241
|
+
scene: result,
|
|
242
|
+
});
|
|
243
|
+
return structuredClone(result);
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
const normalized = adapterError(error);
|
|
247
|
+
this.#emitError(normalized);
|
|
248
|
+
throw normalized;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
exportScene() {
|
|
252
|
+
this.#assertActive();
|
|
253
|
+
try {
|
|
254
|
+
const scene = this.#scene;
|
|
255
|
+
if (scene === null) {
|
|
256
|
+
throw runtimeError();
|
|
257
|
+
}
|
|
258
|
+
return parseTimeSeriesScene(structuredClone(scene));
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
const normalized = exportError(error);
|
|
262
|
+
this.#emitError(normalized);
|
|
263
|
+
throw normalized;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
subscribe(listener) {
|
|
267
|
+
this.#assertActive();
|
|
268
|
+
this.#listeners.add(listener);
|
|
269
|
+
return () => this.#listeners.delete(listener);
|
|
270
|
+
}
|
|
271
|
+
destroy() {
|
|
272
|
+
if (this.#destroyed) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
this.#destroyed = true;
|
|
276
|
+
this.#unsubscribeCrosshair?.();
|
|
277
|
+
for (const cleanup of this.#legendCleanups) {
|
|
278
|
+
cleanup();
|
|
279
|
+
}
|
|
280
|
+
this.#legendCleanups.length = 0;
|
|
281
|
+
this.#legendButtons.clear();
|
|
282
|
+
this.#root?.remove();
|
|
283
|
+
this.#styleElement?.remove();
|
|
284
|
+
this.#adapter?.dispose();
|
|
285
|
+
this.#listeners.clear();
|
|
286
|
+
if (this.#container !== null && this.#originalPosition !== null) {
|
|
287
|
+
this.#container.style.position = this.#originalPosition;
|
|
288
|
+
}
|
|
289
|
+
this.#unsubscribeCrosshair = null;
|
|
290
|
+
this.#tooltip = null;
|
|
291
|
+
this.#root = null;
|
|
292
|
+
this.#styleElement = null;
|
|
293
|
+
this.#adapter = null;
|
|
294
|
+
this.#scene = null;
|
|
295
|
+
this.#container = null;
|
|
296
|
+
this.#originalPosition = null;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
export async function createTimeSeriesRuntime(container, scene, options = {}) {
|
|
300
|
+
return TimeSeriesRuntimeImplementation.create(container, scene, options);
|
|
301
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TimeSeriesPoint, TimeSeriesScene, TimeSeriesSceneIssue } from '@baron1996/kline-scene-schema';
|
|
2
|
+
export interface TimeSeriesRuntimeEventEnvelope {
|
|
3
|
+
readonly sceneVersion: 1;
|
|
4
|
+
readonly runtimeVersion: '0.1.0';
|
|
5
|
+
}
|
|
6
|
+
export type TimeSeriesRuntimeEventPayload = {
|
|
7
|
+
readonly type: 'scene-ready';
|
|
8
|
+
readonly scene: TimeSeriesScene;
|
|
9
|
+
} | {
|
|
10
|
+
readonly type: 'series-visibility-changed';
|
|
11
|
+
readonly seriesId: string;
|
|
12
|
+
readonly visible: boolean;
|
|
13
|
+
readonly scene: TimeSeriesScene;
|
|
14
|
+
} | {
|
|
15
|
+
readonly type: 'data-replaced';
|
|
16
|
+
readonly dataCount: number;
|
|
17
|
+
readonly scene: TimeSeriesScene;
|
|
18
|
+
} | {
|
|
19
|
+
readonly type: 'crosshair-changed';
|
|
20
|
+
readonly timestamp: number;
|
|
21
|
+
readonly values: Readonly<Record<string, number | null>>;
|
|
22
|
+
} | {
|
|
23
|
+
readonly type: 'crosshair-changed';
|
|
24
|
+
readonly timestamp: null;
|
|
25
|
+
readonly values: null;
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: 'scene-error';
|
|
28
|
+
readonly issues: readonly TimeSeriesSceneIssue[];
|
|
29
|
+
};
|
|
30
|
+
export type TimeSeriesRuntimeEvent = TimeSeriesRuntimeEventPayload & TimeSeriesRuntimeEventEnvelope;
|
|
31
|
+
export type TimeSeriesRuntimeListener = (event: TimeSeriesRuntimeEvent) => void;
|
|
32
|
+
export interface TimeSeriesRuntimeOptions {
|
|
33
|
+
readonly onEvent?: TimeSeriesRuntimeListener;
|
|
34
|
+
}
|
|
35
|
+
export interface TimeSeriesRuntime {
|
|
36
|
+
setSeriesVisible(seriesId: string, visible: boolean): TimeSeriesScene;
|
|
37
|
+
replaceData(data: readonly TimeSeriesPoint[]): Promise<TimeSeriesScene>;
|
|
38
|
+
exportScene(): TimeSeriesScene;
|
|
39
|
+
subscribe(listener: TimeSeriesRuntimeListener): () => void;
|
|
40
|
+
destroy(): void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=time-series-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-series-types.d.ts","sourceRoot":"","sources":["../src/time-series-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,8BAA8B;IAC9C,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,MAAM,6BAA6B,GACtC;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GACjE;IACD,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CAChC,GACC;IACD,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CAChC,GACC;IACD,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CACzD,GACC;IACD,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;CACtB,GACC;IACD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACjD,CAAC;AAEH,MAAM,MAAM,sBAAsB,GACjC,6BAA6B,GAAG,8BAA8B,CAAC;AAEhE,MAAM,MAAM,yBAAyB,GAAG,CACvC,KAAK,EAAE,sBAAsB,KACzB,IAAI,CAAC;AAEV,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,yBAAyB,CAAC;CAC7C;AAED,MAAM,WAAW,iBAAiB;IACjC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC;IACtE,WAAW,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACxE,WAAW,IAAI,eAAe,CAAC;IAC/B,SAAS,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,IAAI,CAAC;IAC3D,OAAO,IAAI,IAAI,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard-toolbar-styles.d.ts","sourceRoot":"","sources":["../../src/toolbar/standard-toolbar-styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"standard-toolbar-styles.d.ts","sourceRoot":"","sources":["../../src/toolbar/standard-toolbar-styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,QA8QnC,CAAC"}
|
|
@@ -250,4 +250,22 @@ export const STANDARD_TOOLBAR_STYLES = String.raw `
|
|
|
250
250
|
transition: none;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
+
|
|
254
|
+
.baron-kline-context-menu {
|
|
255
|
+
position: fixed;
|
|
256
|
+
z-index: 1000;
|
|
257
|
+
display: none;
|
|
258
|
+
flex-direction: column;
|
|
259
|
+
gap: 8px;
|
|
260
|
+
min-width: 180px;
|
|
261
|
+
padding: 10px;
|
|
262
|
+
border: 1px solid rgba(203, 210, 224, 1);
|
|
263
|
+
border-radius: 10px;
|
|
264
|
+
background: rgba(255, 255, 255, 0.98);
|
|
265
|
+
box-shadow: 0 12px 32px rgba(23, 32, 51, 0.16);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.baron-kline-context-menu--visible {
|
|
269
|
+
display: flex;
|
|
270
|
+
}
|
|
253
271
|
`;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DrawingRuntimeCapability, RuntimeAuxiliaryCapability } from '../drawing/capabilities.js';
|
|
2
2
|
import type { StandardToolbar, StandardToolbarOptions } from '../types.js';
|
|
3
|
+
type StandardDrawingRuntime = DrawingRuntimeCapability & RuntimeAuxiliaryCapability;
|
|
3
4
|
/** 创建不含撤销/重做的标准离线编辑工具栏。 */
|
|
4
|
-
export declare function createStandardToolbar(container: HTMLElement, runtime:
|
|
5
|
+
export declare function createStandardToolbar(container: HTMLElement, runtime: StandardDrawingRuntime, options?: StandardToolbarOptions): StandardToolbar;
|
|
6
|
+
export {};
|
|
5
7
|
//# sourceMappingURL=standard-toolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard-toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/standard-toolbar.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"standard-toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/standard-toolbar.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACX,eAAe,EACf,sBAAsB,EAEtB,MAAM,aAAa,CAAC;AAyCrB,KAAK,sBAAsB,GAAG,wBAAwB,GAAG,0BAA0B,CAAC;AA0LpF,2BAA2B;AAC3B,wBAAgB,qBAAqB,CACpC,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,sBAAsB,EAC/B,OAAO,GAAE,sBAA2B,GAClC,eAAe,CA2YjB"}
|