velo-plot 2.20.0 → 3.1.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 +26 -12
- package/dist/ChartCore-AnR_3Xkb.js +7338 -0
- package/dist/ChartCore-AnR_3Xkb.js.map +1 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js +75 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js.map +1 -0
- package/dist/{index.core-COREBDNq.js → PluginRegistry-CzMHebYP.js} +24 -38
- package/dist/PluginRegistry-CzMHebYP.js.map +1 -0
- package/dist/a11y-Bw6urYpr.js +105 -0
- package/dist/a11y-Bw6urYpr.js.map +1 -0
- package/dist/angular/hooks-entry.d.ts +1 -0
- package/dist/angular/hooks.d.ts +26 -0
- package/dist/angular/index.d.ts +8 -0
- package/dist/angular/velo-plot.component.d.ts +46 -0
- package/dist/angular-hooks.d.ts +1 -0
- package/dist/angular-hooks.js +9 -0
- package/dist/angular-hooks.js.map +1 -0
- package/dist/angular.d.ts +1 -0
- package/dist/angular.js +166 -0
- package/dist/angular.js.map +1 -0
- package/dist/assets/indicator.worker-bv0zC4EX.js.map +1 -1
- package/dist/astro/StackedPlot.astro +19 -0
- package/dist/astro/VeloPlot.astro +23 -0
- package/dist/{axisFormat-CzumxpCL.js → axisFormat-Sz4WIJfQ.js} +2 -2
- package/dist/{axisFormat-CzumxpCL.js.map → axisFormat-Sz4WIJfQ.js.map} +1 -1
- package/dist/bindings/shared/a11y.d.ts +26 -0
- package/dist/bindings/shared/chartLifecycle.d.ts +16 -0
- package/dist/bindings/shared/chartSyncBridge.d.ts +8 -0
- package/dist/bindings/shared/dimensions.d.ts +1 -0
- package/dist/bindings/shared/index.d.ts +9 -0
- package/dist/bindings/shared/indicatorBridge.d.ts +11 -0
- package/dist/bindings/shared/optionsSync.d.ts +7 -0
- package/dist/bindings/shared/seriesDiff.d.ts +8 -0
- package/dist/bindings/shared/stackedSync.d.ts +9 -0
- package/dist/bindings/shared/types.d.ts +46 -0
- package/dist/bindings/test-utils/index.d.ts +35 -0
- package/dist/bindings/test-utils/mockLifecycle.d.ts +120 -0
- package/dist/bindings/test-utils/vitestSveltePlugin.d.ts +3 -0
- package/dist/chartSyncBridge-D_rCtbFq.js +58 -0
- package/dist/chartSyncBridge-D_rCtbFq.js.map +1 -0
- package/dist/core/Chart.d.ts +1 -1
- package/dist/core/ChartStatistics.d.ts +1 -1
- package/dist/core/InteractionManager.d.ts +7 -1
- package/dist/core/OverlayRenderer.d.ts +5 -0
- package/dist/core/annotations/types.d.ts +1 -1
- package/dist/core/chart/ChartCore.d.ts +14 -19
- package/dist/core/chart/ChartFeatureHooks.d.ts +7 -0
- package/dist/core/chart/chartExportPatch.d.ts +2 -0
- package/dist/core/chart/overlaySeriesRegistry.d.ts +7 -0
- package/dist/core/chart/series/SeriesActions.d.ts +1 -0
- package/dist/core/chart/series/SeriesBufferLite.d.ts +13 -0
- package/dist/core/chart/series/seriesOptionsRegistry.d.ts +8 -0
- package/dist/core/chart/series/seriesTypeRegistry.d.ts +5 -0
- package/dist/core/chart/types.d.ts +1 -1
- package/dist/core/clipboard/index.d.ts +1 -1
- package/dist/core/debug/index.d.ts +1 -1
- package/dist/core/keybindings/index.d.ts +1 -1
- package/dist/core/loading/index.d.ts +1 -1
- package/dist/core/locale/index.d.ts +1 -1
- package/dist/core/stacked/paneResize.d.ts +3 -0
- package/dist/core/stacked/types.d.ts +10 -0
- package/dist/core/theme-editor/index.d.ts +1 -1
- package/dist/createStackedChart-DqcLCFGS.js +1338 -0
- package/dist/createStackedChart-DqcLCFGS.js.map +1 -0
- package/dist/examples/PluginDemonstration.d.ts +1 -1
- package/dist/hooks-DH-3bewj.js +69 -0
- package/dist/hooks-DH-3bewj.js.map +1 -0
- package/dist/{index-BBpJwOct.js → index-0InEyj0q.js} +119 -121
- package/dist/index-0InEyj0q.js.map +1 -0
- package/dist/{index-qunX30Xu.js → index-B7PTX94B.js} +2133 -2133
- package/dist/index-B7PTX94B.js.map +1 -0
- package/dist/{index-BMiZoKmm.js → index-BgrvqltV.js} +67 -67
- package/dist/index-BgrvqltV.js.map +1 -0
- package/dist/{index-DoYxf1cV.js → index-CWxIHdwX.js} +38 -98
- package/dist/index-CWxIHdwX.js.map +1 -0
- package/dist/index-CaXWSOTk.js.map +1 -1
- package/dist/{mockDatafeed-927foCM4.js → index-Cv6ZDLWf.js} +227 -217
- package/dist/index-Cv6ZDLWf.js.map +1 -0
- package/dist/index-Dag88bW4.js.map +1 -1
- package/dist/index-qhscKTDy.js.map +1 -1
- package/dist/index.core.d.ts +9 -7
- package/dist/index.d.ts +2 -15
- package/dist/indicators--eJGmVox.js.map +1 -1
- package/dist/optionsSync-QUiN4Inw.js +119 -0
- package/dist/optionsSync-QUiN4Inw.js.map +1 -0
- package/dist/plugins/3d/index.d.ts +2 -2
- package/dist/plugins/3d.d.ts +2 -2
- package/dist/plugins/3d.js +3 -1
- package/dist/plugins/3d.js.map +1 -1
- package/dist/plugins/analysis/index.d.ts +1 -1
- package/dist/plugins/analysis/indicators.d.ts +1 -1
- package/dist/plugins/analysis.d.ts +2 -2
- package/dist/plugins/analysis.js +2 -2
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/annotations/index.d.ts +1 -1
- package/dist/plugins/annotations.d.ts +2 -2
- package/dist/plugins/annotations.js.map +1 -1
- package/dist/plugins/anomaly-detection.js +1 -1
- package/dist/plugins/anomaly-detection.js.map +1 -1
- package/dist/plugins/broken-axis.d.ts +2 -2
- package/dist/plugins/builtins/crosshair/CrosshairPlugin.d.ts +1 -1
- package/dist/plugins/builtins/index.d.ts +1 -1
- package/dist/plugins/caching.d.ts +2 -2
- package/dist/plugins/clipboard/index.d.ts +2 -2
- package/dist/plugins/clipboard.d.ts +2 -2
- package/dist/plugins/clipboard.js.map +1 -1
- package/dist/plugins/context-menu/index.d.ts +1 -1
- package/dist/plugins/context-menu.d.ts +2 -2
- package/dist/plugins/context-menu.js +1 -1
- package/dist/plugins/context-menu.js.map +1 -1
- package/dist/plugins/createPlugin.d.ts +8 -0
- package/dist/plugins/data-export/index.d.ts +1 -1
- package/dist/plugins/data-export.d.ts +2 -2
- package/dist/plugins/data-export.js +2 -2
- package/dist/plugins/data-export.js.map +1 -1
- package/dist/plugins/data-transform.d.ts +2 -2
- package/dist/plugins/data-transform.js +19 -19
- package/dist/plugins/data-transform.js.map +1 -1
- package/dist/plugins/debug/index.d.ts +2 -2
- package/dist/plugins/debug.d.ts +2 -2
- package/dist/plugins/debug.js +33 -33
- package/dist/plugins/debug.js.map +1 -1
- package/dist/plugins/forecasting/index.d.ts +1 -1
- package/dist/plugins/forecasting.js.map +1 -1
- package/dist/plugins/gpu/index.d.ts +2 -2
- package/dist/plugins/gpu.d.ts +2 -2
- package/dist/plugins/gpu.js +2033 -209
- package/dist/plugins/gpu.js.map +1 -1
- package/dist/plugins/i18n/index.d.ts +2 -2
- package/dist/plugins/i18n.d.ts +2 -2
- package/dist/plugins/i18n.js +286 -23
- package/dist/plugins/i18n.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/keyboard.d.ts +2 -2
- package/dist/plugins/keyboard.js +65 -5
- package/dist/plugins/keyboard.js.map +1 -1
- package/dist/plugins/latex.js +766 -207
- package/dist/plugins/latex.js.map +1 -1
- package/dist/plugins/lazy-load.d.ts +2 -2
- package/dist/plugins/loading/index.d.ts +2 -3
- package/dist/plugins/loading.d.ts +2 -2
- package/dist/plugins/loading.js +3 -4
- package/dist/plugins/ml-integration.d.ts +2 -2
- package/dist/plugins/ml-integration.js +5 -5
- package/dist/plugins/ml-integration.js.map +1 -1
- package/dist/plugins/offscreen.d.ts +2 -2
- package/dist/plugins/offscreen.js +11 -10
- package/dist/plugins/offscreen.js.map +1 -1
- package/dist/plugins/pattern-recognition.d.ts +2 -2
- package/dist/plugins/pattern-recognition.js +1 -1
- package/dist/plugins/pattern-recognition.js.map +1 -1
- package/dist/plugins/radar.d.ts +2 -2
- package/dist/plugins/regression.d.ts +2 -2
- package/dist/plugins/regression.js +255 -257
- package/dist/plugins/regression.js.map +1 -1
- package/dist/plugins/roi.js +9 -9
- package/dist/plugins/roi.js.map +1 -1
- package/dist/plugins/snapshot/index.d.ts +1 -1
- package/dist/plugins/snapshot/types.d.ts +1 -1
- package/dist/plugins/snapshot.d.ts +2 -2
- package/dist/plugins/snapshot.js.map +1 -1
- package/dist/plugins/streaming/index.d.ts +2 -2
- package/dist/plugins/streaming.d.ts +2 -2
- package/dist/plugins/streaming.js +1 -1
- package/dist/plugins/sync/index.d.ts +3 -2
- package/dist/plugins/sync.d.ts +2 -2
- package/dist/plugins/sync.js.map +1 -1
- package/dist/plugins/theme-editor/index.d.ts +1 -1
- package/dist/plugins/theme-editor.d.ts +2 -2
- package/dist/plugins/tools/index.d.ts +1 -1
- package/dist/plugins/tools/tooltip/index.d.ts +1 -1
- package/dist/plugins/tools.d.ts +2 -2
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/plugins/video-recorder.d.ts +2 -2
- package/dist/plugins/virtualization.d.ts +2 -2
- package/dist/plugins/virtualization.js +1 -1
- package/dist/pool-DZ8shSqv.js +109 -0
- package/dist/pool-DZ8shSqv.js.map +1 -0
- package/dist/react/StackedPlot.d.ts +31 -0
- package/dist/react/VeloPlot.d.ts +29 -0
- package/dist/react/index.d.ts +25 -3
- package/dist/react/useChartSync.d.ts +8 -0
- package/dist/react/useIndicator.d.ts +12 -0
- package/dist/react/useVeloPlot.d.ts +19 -0
- package/dist/react.js +325 -24
- package/dist/react.js.map +1 -1
- package/dist/renderer/NativeWebGLRenderer.d.ts +2 -1
- package/dist/renderer/native/NativeWebGLRenderer.d.ts +5 -1
- package/dist/renderer/native/draw.d.ts +2 -47
- package/dist/renderer/native/drawCore.d.ts +27 -0
- package/dist/renderer/native/drawExtended.d.ts +29 -0
- package/dist/renderer/native/frameRenderExtended.d.ts +1 -0
- package/dist/renderer/native/frameRenderRegistry.d.ts +27 -0
- package/dist/renderer/native/programFactoryCore.d.ts +6 -0
- package/dist/renderer/native/programFactoryExtended.d.ts +4 -0
- package/dist/renderer/native/utils.d.ts +3 -29
- package/dist/renderer/native/utilsCore.d.ts +14 -0
- package/dist/renderer/native/utilsExtended.d.ts +17 -0
- package/dist/renderer/overlaySeriesExtended.d.ts +1 -0
- package/dist/renderer/registerExtendedSeries.d.ts +1 -0
- package/dist/renderer/registerWebGPU.d.ts +2 -0
- package/dist/renderer/seriesBufferExtended.d.ts +4 -0
- package/dist/scientific/index.d.ts +44 -0
- package/dist/scientific/registerScientific.d.ts +1 -0
- package/dist/scientific.d.ts +1 -0
- package/dist/scientific.js +91 -0
- package/dist/scientific.js.map +1 -0
- package/dist/solid/VeloPlot.d.ts +16 -0
- package/dist/solid/index.d.ts +13 -0
- package/dist/solid/useChartSync.d.ts +6 -0
- package/dist/solid/useIndicator.d.ts +11 -0
- package/dist/solid/useStackedPlot.d.ts +14 -0
- package/dist/solid/useVeloPlot.d.ts +18 -0
- package/dist/solid.d.ts +1 -0
- package/dist/solid.js +169 -0
- package/dist/solid.js.map +1 -0
- package/dist/stackedSync-tnrunZMt.js +100 -0
- package/dist/stackedSync-tnrunZMt.js.map +1 -0
- package/dist/svelte/StackedPlot.svelte +29 -0
- package/dist/svelte/StackedPlot.test.ts +114 -0
- package/dist/svelte/VeloPlot.svelte +44 -0
- package/dist/svelte/VeloPlot.test.ts +105 -0
- package/dist/svelte/index.d.ts +11 -0
- package/dist/svelte/index.test.ts +20 -0
- package/dist/svelte/index.ts +15 -0
- package/dist/svelte/useChartSync.d.ts +8 -0
- package/dist/svelte/useChartSync.test.ts +49 -0
- package/dist/svelte/useChartSync.ts +29 -0
- package/dist/svelte/useIndicator.d.ts +13 -0
- package/dist/svelte/useIndicator.test.ts +67 -0
- package/dist/svelte/useIndicator.ts +43 -0
- package/dist/svelte/useStackedPlot.d.ts +16 -0
- package/dist/svelte/useStackedPlot.test.ts +76 -0
- package/dist/svelte/useStackedPlot.ts +54 -0
- package/dist/svelte/useVeloPlot.d.ts +21 -0
- package/dist/svelte/useVeloPlot.test.ts +100 -0
- package/dist/svelte/useVeloPlot.ts +81 -0
- package/dist/svelte.d.ts +1 -0
- package/dist/svelte.js +140 -0
- package/dist/svelte.js.map +1 -0
- package/dist/testing/index.d.ts +1 -1
- package/dist/theme/index.d.ts +2 -1
- package/dist/trading/index.d.ts +1 -4
- package/dist/trading/registerTrading.d.ts +3 -0
- package/dist/trading.js +42 -42
- package/dist/types.d.ts +4 -4
- package/dist/{utils-BK5UUXxj.js → utils-Dx0h0bgQ.js} +9 -9
- package/dist/{utils-BK5UUXxj.js.map → utils-Dx0h0bgQ.js.map} +1 -1
- package/dist/velo-plot.full.js +2216 -1346
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +33 -28
- package/dist/velo-plot.js.map +1 -1
- package/dist/vue/StackedPlot.vue.d.ts +48 -0
- package/dist/vue/VeloPlot.vue.d.ts +64 -0
- package/dist/vue/index.d.ts +250 -0
- package/dist/vue/useChartSync.d.ts +52 -0
- package/dist/vue/useIndicator.d.ts +23 -0
- package/dist/vue/useStackedPlot.d.ts +15 -0
- package/dist/vue/useVeloPlot.d.ts +20 -0
- package/dist/vue.d.ts +1 -0
- package/dist/vue.js +309 -0
- package/dist/vue.js.map +1 -0
- package/dist/workers/indicatorsAsync.d.ts +2 -0
- package/dist/workers/pool.d.ts +9 -0
- package/package.json +96 -10
- package/dist/ChartCore-ivzLqxVb.js +0 -8350
- package/dist/ChartCore-ivzLqxVb.js.map +0 -1
- package/dist/SciPlot-CEU4ApgD.js +0 -463
- package/dist/SciPlot-CEU4ApgD.js.map +0 -1
- package/dist/createStackedChart-DxNW0VkF.js +0 -705
- package/dist/createStackedChart-DxNW0VkF.js.map +0 -1
- package/dist/gpuRenderer-BpaMYz-k.js +0 -1848
- package/dist/gpuRenderer-BpaMYz-k.js.map +0 -1
- package/dist/index-BBpJwOct.js.map +0 -1
- package/dist/index-BMiZoKmm.js.map +0 -1
- package/dist/index-DoYxf1cV.js.map +0 -1
- package/dist/index-qunX30Xu.js.map +0 -1
- package/dist/index-x4stH3jD.js +0 -282
- package/dist/index-x4stH3jD.js.map +0 -1
- package/dist/index.core-COREBDNq.js.map +0 -1
- package/dist/mockDatafeed-927foCM4.js.map +0 -1
- package/dist/pool-15HMCNv8.js +0 -88
- package/dist/pool-15HMCNv8.js.map +0 -1
- package/dist/react/SciPlot.d.ts +0 -60
- package/dist/react/useSciPlot.d.ts +0 -56
- package/dist/symbols-DT0eLlpW.js +0 -568
- package/dist/symbols-DT0eLlpW.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartPlugin } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* VeloPlot Engine - Internationalization (i18n) Plugin
|
|
4
4
|
*
|
|
5
5
|
* Provides localization support for dates, numbers, and strings.
|
|
6
6
|
*
|
|
@@ -14,7 +14,7 @@ export interface PluginI18nConfig {
|
|
|
14
14
|
customLocales?: Record<string, any>;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* VeloPlot i18n Plugin
|
|
18
18
|
*
|
|
19
19
|
* Adds support for multiple languages and local data formatting.
|
|
20
20
|
*/
|
package/dist/plugins/i18n.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './i18n/index'
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
2
|
+
import VeloPlot from './i18n/index'
|
|
3
|
+
export default VeloPlot
|
package/dist/plugins/i18n.js
CHANGED
|
@@ -1,37 +1,300 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const l = {
|
|
2
|
+
locale: "en-US",
|
|
3
|
+
decimalSeparator: ".",
|
|
4
|
+
thousandsSeparator: ",",
|
|
5
|
+
dateFormat: "MM/DD/YYYY",
|
|
6
|
+
timeFormat: "hh:mm:ss a",
|
|
7
|
+
labels: {
|
|
8
|
+
start: "Start",
|
|
9
|
+
pause: "Pause",
|
|
10
|
+
reset: "Reset",
|
|
11
|
+
export: "Export",
|
|
12
|
+
autoScale: "Auto Scale",
|
|
13
|
+
pan: "Pan",
|
|
14
|
+
zoom: "Zoom",
|
|
15
|
+
select: "Select",
|
|
16
|
+
legend: "Legend",
|
|
17
|
+
fps: "FPS",
|
|
18
|
+
points: "points",
|
|
19
|
+
loading: "Loading...",
|
|
20
|
+
noData: "No data",
|
|
21
|
+
error: "Error"
|
|
22
|
+
}
|
|
23
|
+
}, f = {
|
|
24
|
+
locale: "es-ES",
|
|
25
|
+
decimalSeparator: ",",
|
|
26
|
+
thousandsSeparator: ".",
|
|
27
|
+
dateFormat: "DD/MM/YYYY",
|
|
28
|
+
timeFormat: "HH:mm:ss",
|
|
29
|
+
labels: {
|
|
30
|
+
start: "Iniciar",
|
|
31
|
+
pause: "Pausar",
|
|
32
|
+
reset: "Reiniciar",
|
|
33
|
+
export: "Exportar",
|
|
34
|
+
autoScale: "Auto Escala",
|
|
35
|
+
pan: "Mover",
|
|
36
|
+
zoom: "Zoom",
|
|
37
|
+
select: "Seleccionar",
|
|
38
|
+
legend: "Leyenda",
|
|
39
|
+
fps: "FPS",
|
|
40
|
+
points: "puntos",
|
|
41
|
+
loading: "Cargando...",
|
|
42
|
+
noData: "Sin datos",
|
|
43
|
+
error: "Error"
|
|
44
|
+
}
|
|
45
|
+
}, g = {
|
|
46
|
+
locale: "de-DE",
|
|
47
|
+
decimalSeparator: ",",
|
|
48
|
+
thousandsSeparator: ".",
|
|
49
|
+
dateFormat: "DD.MM.YYYY",
|
|
50
|
+
timeFormat: "HH:mm:ss",
|
|
51
|
+
labels: {
|
|
52
|
+
start: "Start",
|
|
53
|
+
pause: "Pause",
|
|
54
|
+
reset: "Zurücksetzen",
|
|
55
|
+
export: "Exportieren",
|
|
56
|
+
autoScale: "Auto-Skalierung",
|
|
57
|
+
pan: "Verschieben",
|
|
58
|
+
zoom: "Zoom",
|
|
59
|
+
select: "Auswählen",
|
|
60
|
+
legend: "Legende",
|
|
61
|
+
fps: "FPS",
|
|
62
|
+
points: "Punkte",
|
|
63
|
+
loading: "Laden...",
|
|
64
|
+
noData: "Keine Daten",
|
|
65
|
+
error: "Fehler"
|
|
66
|
+
}
|
|
67
|
+
}, F = {
|
|
68
|
+
locale: "fr-FR",
|
|
69
|
+
decimalSeparator: ",",
|
|
70
|
+
thousandsSeparator: " ",
|
|
71
|
+
dateFormat: "DD/MM/YYYY",
|
|
72
|
+
timeFormat: "HH:mm:ss",
|
|
73
|
+
labels: {
|
|
74
|
+
start: "Démarrer",
|
|
75
|
+
pause: "Pause",
|
|
76
|
+
reset: "Réinitialiser",
|
|
77
|
+
export: "Exporter",
|
|
78
|
+
autoScale: "Échelle auto",
|
|
79
|
+
pan: "Déplacer",
|
|
80
|
+
zoom: "Zoom",
|
|
81
|
+
select: "Sélectionner",
|
|
82
|
+
legend: "Légende",
|
|
83
|
+
fps: "FPS",
|
|
84
|
+
points: "points",
|
|
85
|
+
loading: "Chargement...",
|
|
86
|
+
noData: "Aucune donnée",
|
|
87
|
+
error: "Erreur"
|
|
88
|
+
}
|
|
89
|
+
}, D = {
|
|
90
|
+
locale: "pt-BR",
|
|
91
|
+
decimalSeparator: ",",
|
|
92
|
+
thousandsSeparator: ".",
|
|
93
|
+
dateFormat: "DD/MM/YYYY",
|
|
94
|
+
timeFormat: "HH:mm:ss",
|
|
95
|
+
labels: {
|
|
96
|
+
start: "Iniciar",
|
|
97
|
+
pause: "Pausar",
|
|
98
|
+
reset: "Reiniciar",
|
|
99
|
+
export: "Exportar",
|
|
100
|
+
autoScale: "Escala Auto",
|
|
101
|
+
pan: "Mover",
|
|
102
|
+
zoom: "Zoom",
|
|
103
|
+
select: "Selecionar",
|
|
104
|
+
legend: "Legenda",
|
|
105
|
+
fps: "FPS",
|
|
106
|
+
points: "pontos",
|
|
107
|
+
loading: "Carregando...",
|
|
108
|
+
noData: "Sem dados",
|
|
109
|
+
error: "Erro"
|
|
110
|
+
}
|
|
111
|
+
}, h = {
|
|
112
|
+
locale: "zh-CN",
|
|
113
|
+
decimalSeparator: ".",
|
|
114
|
+
thousandsSeparator: ",",
|
|
115
|
+
dateFormat: "YYYY/MM/DD",
|
|
116
|
+
timeFormat: "HH:mm:ss",
|
|
117
|
+
labels: {
|
|
118
|
+
start: "开始",
|
|
119
|
+
pause: "暂停",
|
|
120
|
+
reset: "重置",
|
|
121
|
+
export: "导出",
|
|
122
|
+
autoScale: "自动缩放",
|
|
123
|
+
pan: "平移",
|
|
124
|
+
zoom: "缩放",
|
|
125
|
+
select: "选择",
|
|
126
|
+
legend: "图例",
|
|
127
|
+
fps: "FPS",
|
|
128
|
+
points: "点",
|
|
129
|
+
loading: "加载中...",
|
|
130
|
+
noData: "无数据",
|
|
131
|
+
error: "错误"
|
|
132
|
+
}
|
|
133
|
+
}, Y = {
|
|
134
|
+
locale: "ja-JP",
|
|
135
|
+
decimalSeparator: ".",
|
|
136
|
+
thousandsSeparator: ",",
|
|
137
|
+
dateFormat: "YYYY/MM/DD",
|
|
138
|
+
timeFormat: "HH:mm:ss",
|
|
139
|
+
labels: {
|
|
140
|
+
start: "開始",
|
|
141
|
+
pause: "一時停止",
|
|
142
|
+
reset: "リセット",
|
|
143
|
+
export: "エクスポート",
|
|
144
|
+
autoScale: "自動スケール",
|
|
145
|
+
pan: "パン",
|
|
146
|
+
zoom: "ズーム",
|
|
147
|
+
select: "選択",
|
|
148
|
+
legend: "凡例",
|
|
149
|
+
fps: "FPS",
|
|
150
|
+
points: "ポイント",
|
|
151
|
+
loading: "読み込み中...",
|
|
152
|
+
noData: "データなし",
|
|
153
|
+
error: "エラー"
|
|
154
|
+
}
|
|
155
|
+
}, S = {
|
|
156
|
+
"en-US": l,
|
|
157
|
+
en: l,
|
|
158
|
+
"es-ES": f,
|
|
159
|
+
es: f,
|
|
160
|
+
"de-DE": g,
|
|
161
|
+
de: g,
|
|
162
|
+
"fr-FR": F,
|
|
163
|
+
fr: F,
|
|
164
|
+
"pt-BR": D,
|
|
165
|
+
pt: D,
|
|
166
|
+
"zh-CN": h,
|
|
167
|
+
zh: h,
|
|
168
|
+
"ja-JP": Y,
|
|
169
|
+
ja: Y
|
|
170
|
+
}, d = [
|
|
171
|
+
{ value: 1e-15, symbol: "f" },
|
|
172
|
+
{ value: 1e-12, symbol: "p" },
|
|
173
|
+
{ value: 1e-9, symbol: "n" },
|
|
174
|
+
{ value: 1e-6, symbol: "µ" },
|
|
175
|
+
{ value: 1e-3, symbol: "m" },
|
|
176
|
+
{ value: 1, symbol: "" },
|
|
177
|
+
{ value: 1e3, symbol: "k" },
|
|
178
|
+
{ value: 1e6, symbol: "M" },
|
|
179
|
+
{ value: 1e9, symbol: "G" },
|
|
180
|
+
{ value: 1e12, symbol: "T" },
|
|
181
|
+
{ value: 1e15, symbol: "P" }
|
|
182
|
+
];
|
|
183
|
+
let m = l;
|
|
184
|
+
function L(a) {
|
|
185
|
+
if (typeof a == "string") {
|
|
186
|
+
const t = S[a];
|
|
187
|
+
t ? m = t : m = { ...l, locale: a };
|
|
188
|
+
} else
|
|
189
|
+
m = { ...l, ...a };
|
|
190
|
+
}
|
|
191
|
+
function H() {
|
|
192
|
+
return m;
|
|
193
|
+
}
|
|
194
|
+
function _(a) {
|
|
195
|
+
return S[a];
|
|
196
|
+
}
|
|
197
|
+
function y(a, t) {
|
|
198
|
+
S[a] = t;
|
|
199
|
+
}
|
|
200
|
+
function M(a) {
|
|
201
|
+
let t;
|
|
202
|
+
a ? typeof a == "string" ? t = S[a] || { ...l, locale: a } : t = { ...l, ...a } : t = m;
|
|
203
|
+
const p = t.decimalSeparator || ".", b = t.thousandsSeparator || ",", E = { ...l.labels, ...t.labels };
|
|
204
|
+
return {
|
|
205
|
+
formatNumber(e, o = 2) {
|
|
206
|
+
if (t.numberFormatter)
|
|
207
|
+
return t.numberFormatter(e, o);
|
|
208
|
+
if (!isFinite(e))
|
|
209
|
+
return e.toString();
|
|
210
|
+
const r = Math.abs(e).toFixed(o).split("."), s = r[0].replace(/\B(?=(\d{3})+(?!\d))/g, b), n = r[1];
|
|
211
|
+
let i = s;
|
|
212
|
+
return n && (i += p + n), e < 0 ? "-" + i : i;
|
|
213
|
+
},
|
|
214
|
+
formatDate(e) {
|
|
215
|
+
if (t.dateFormatter)
|
|
216
|
+
return t.dateFormatter(e);
|
|
217
|
+
const o = t.dateFormat || "YYYY-MM-DD", r = String(e.getDate()).padStart(2, "0"), s = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getFullYear());
|
|
218
|
+
return o.replace("YYYY", n).replace("MM", s).replace("DD", r);
|
|
219
|
+
},
|
|
220
|
+
formatTime(e) {
|
|
221
|
+
const o = t.timeFormat || "HH:mm:ss", r = e.getHours(), s = r % 12 || 12, n = String(e.getMinutes()).padStart(2, "0"), i = String(e.getSeconds()).padStart(2, "0"), c = r >= 12 ? "PM" : "AM";
|
|
222
|
+
return o.replace("HH", String(r).padStart(2, "0")).replace("hh", String(s).padStart(2, "0")).replace("mm", n).replace("ss", i).replace("a", c.toLowerCase()).replace("A", c);
|
|
223
|
+
},
|
|
224
|
+
formatDateTime(e) {
|
|
225
|
+
return this.formatDate(e) + " " + this.formatTime(e);
|
|
226
|
+
},
|
|
227
|
+
formatWithPrefix(e, o = "") {
|
|
228
|
+
if (e === 0) return "0" + (o ? " " + o : "");
|
|
229
|
+
const r = Math.abs(e);
|
|
230
|
+
let s = d[5];
|
|
231
|
+
for (let u = d.length - 1; u >= 0; u--)
|
|
232
|
+
if (r >= d[u].value * 0.9999) {
|
|
233
|
+
s = d[u];
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
const n = e / s.value, i = this.formatNumber(n, 2), c = s.symbol + o;
|
|
237
|
+
return i + (c ? " " + c : "");
|
|
238
|
+
},
|
|
239
|
+
formatScientific(e, o = 2) {
|
|
240
|
+
if (e === 0) return "0";
|
|
241
|
+
if (!isFinite(e)) return e.toString();
|
|
242
|
+
const r = Math.floor(Math.log10(Math.abs(e))), s = e / Math.pow(10, r);
|
|
243
|
+
return this.formatNumber(s, o) + " × 10" + P(r);
|
|
244
|
+
},
|
|
245
|
+
getLabel(e) {
|
|
246
|
+
return E[e] || e;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function P(a) {
|
|
251
|
+
const t = {
|
|
252
|
+
"-": "⁻",
|
|
253
|
+
0: "⁰",
|
|
254
|
+
1: "¹",
|
|
255
|
+
2: "²",
|
|
256
|
+
3: "³",
|
|
257
|
+
4: "⁴",
|
|
258
|
+
5: "⁵",
|
|
259
|
+
6: "⁶",
|
|
260
|
+
7: "⁷",
|
|
261
|
+
8: "⁸",
|
|
262
|
+
9: "⁹"
|
|
263
|
+
};
|
|
264
|
+
return String(a).split("").map((p) => t[p] || p).join("");
|
|
265
|
+
}
|
|
266
|
+
const A = M(), x = {
|
|
4
267
|
name: "velo-plot-i18n",
|
|
5
268
|
version: "1.0.0",
|
|
6
269
|
description: "Internationalization and localization for velo-plot",
|
|
7
270
|
provides: ["ui"],
|
|
8
271
|
tags: ["i18n", "l10n", "locale", "language"]
|
|
9
272
|
};
|
|
10
|
-
function
|
|
273
|
+
function z(a = {}) {
|
|
11
274
|
return {
|
|
12
|
-
manifest:
|
|
13
|
-
onInit(
|
|
14
|
-
a.locale &&
|
|
275
|
+
manifest: x,
|
|
276
|
+
onInit(t) {
|
|
277
|
+
a.locale && L(a.locale);
|
|
15
278
|
},
|
|
16
|
-
onDestroy(
|
|
279
|
+
onDestroy(t) {
|
|
17
280
|
}
|
|
18
281
|
};
|
|
19
282
|
}
|
|
20
283
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
284
|
+
g as LOCALE_DE_DE,
|
|
285
|
+
l as LOCALE_EN_US,
|
|
286
|
+
f as LOCALE_ES_ES,
|
|
287
|
+
F as LOCALE_FR_FR,
|
|
288
|
+
Y as LOCALE_JA_JP,
|
|
289
|
+
D as LOCALE_PT_BR,
|
|
290
|
+
h as LOCALE_ZH_CN,
|
|
291
|
+
z as PluginI18n,
|
|
292
|
+
M as createLocaleFormatter,
|
|
293
|
+
z as default,
|
|
294
|
+
A as defaultFormatter,
|
|
295
|
+
H as getGlobalLocale,
|
|
296
|
+
_ as getLocale,
|
|
297
|
+
y as registerLocale,
|
|
298
|
+
L as setGlobalLocale
|
|
36
299
|
};
|
|
37
300
|
//# sourceMappingURL=i18n.js.map
|
package/dist/plugins/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sources":["../../src/plugins/i18n/index.ts"],"sourcesContent":["/**\n * SciPlot Engine - Internationalization (i18n) Plugin\n * \n * Provides localization support for dates, numbers, and strings.\n * \n * @module plugins/i18n\n */\n\nexport * from \"../../core/locale\";\n\nimport type { PluginManifest, ChartPlugin, PluginContext } from \"../types\";\nimport { setGlobalLocale } from \"../../core/locale\";\n\nexport interface PluginI18nConfig {\n /** Default locale to use */\n locale?: string;\n /** Custom locale definitions */\n customLocales?: Record<string, any>;\n}\n\nconst manifestI18n: PluginManifest = {\n name: \"velo-plot-i18n\",\n version: \"1.0.0\",\n description: \"Internationalization and localization for velo-plot\",\n provides: [\"ui\"],\n tags: [\"i18n\", \"l10n\", \"locale\", \"language\"],\n};\n\n/**\n * SciPlot i18n Plugin\n * \n * Adds support for multiple languages and local data formatting.\n */\nexport function PluginI18n(config: PluginI18nConfig = {}): ChartPlugin<PluginI18nConfig> {\n return {\n manifest: manifestI18n,\n\n onInit(_ctx: PluginContext) {\n if (config.locale) {\n setGlobalLocale(config.locale);\n }\n },\n\n onDestroy(_ctx: PluginContext) {\n }\n };\n}\n\nexport default PluginI18n;\n"],"names":["manifestI18n","PluginI18n","config","_ctx","setGlobalLocale"],"mappings":";;AAoBA,MAAMA,IAA+B;AAAA,EACjC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU,CAAC,IAAI;AAAA,EACf,MAAM,CAAC,QAAQ,QAAQ,UAAU,UAAU;AAC/C;AAOO,SAASC,EAAWC,IAA2B,IAAmC;AACrF,SAAO;AAAA,IACH,UAAUF;AAAA,IAEV,OAAOG,GAAqB;AACxB,MAAID,EAAO,UACPE,EAAgBF,EAAO,MAAM;AAAA,IAErC;AAAA,IAEA,UAAUC,GAAqB;AAAA,IAC/B;AAAA,EAAA;AAER;"}
|
|
1
|
+
{"version":3,"file":"i18n.js","sources":["../../src/core/locale/index.ts","../../src/plugins/i18n/index.ts"],"sourcesContent":["/**\n * Velo Plot - Internationalization (i18n) Module\n * \n * Provides locale-aware formatting for numbers, dates, and chart UI.\n * Supports custom format functions and predefined locales.\n * \n * @module locale\n */\n\n// ============================================\n// Types\n// ============================================\n\nexport interface LocaleConfig {\n /** Locale identifier (e.g., 'en-US', 'es-ES', 'de-DE') */\n locale: string;\n /** Decimal separator override (auto-detected if not specified) */\n decimalSeparator?: string;\n /** Thousands separator override (auto-detected if not specified) */\n thousandsSeparator?: string;\n /** Date format pattern (e.g., 'DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY-MM-DD') */\n dateFormat?: string;\n /** Time format pattern (e.g., 'HH:mm:ss', 'hh:mm:ss a') */\n timeFormat?: string;\n /** Custom number formatter */\n numberFormatter?: (value: number, decimals?: number) => string;\n /** Custom date formatter */\n dateFormatter?: (date: Date) => string;\n /** Short form labels (used in axis labels) */\n shortLabels?: {\n time?: string;\n value?: string;\n points?: string;\n };\n /** Full form labels (used in tooltips/panels) */\n labels?: {\n start?: string;\n pause?: string;\n reset?: string;\n export?: string;\n autoScale?: string;\n pan?: string;\n zoom?: string;\n select?: string;\n legend?: string;\n fps?: string;\n points?: string;\n loading?: string;\n noData?: string;\n error?: string;\n };\n}\n\nexport interface LocaleFormatter {\n /** Format a number with the locale settings */\n formatNumber(value: number, decimals?: number): string;\n /** Format a date with the locale settings */\n formatDate(date: Date): string;\n /** Format a time with the locale settings */\n formatTime(date: Date): string;\n /** Format a date and time with the locale settings */\n formatDateTime(date: Date): string;\n /** Format a number with SI prefix (k, M, G, etc.) */\n formatWithPrefix(value: number, unit?: string): string;\n /** Format a number in scientific notation */\n formatScientific(value: number, decimals?: number): string;\n /** Get a localized label */\n getLabel(key: keyof NonNullable<LocaleConfig['labels']>): string;\n}\n\n// ============================================\n// Predefined Locales\n// ============================================\n\nexport const LOCALE_EN_US: LocaleConfig = {\n locale: 'en-US',\n decimalSeparator: '.',\n thousandsSeparator: ',',\n dateFormat: 'MM/DD/YYYY',\n timeFormat: 'hh:mm:ss a',\n labels: {\n start: 'Start',\n pause: 'Pause',\n reset: 'Reset',\n export: 'Export',\n autoScale: 'Auto Scale',\n pan: 'Pan',\n zoom: 'Zoom',\n select: 'Select',\n legend: 'Legend',\n fps: 'FPS',\n points: 'points',\n loading: 'Loading...',\n noData: 'No data',\n error: 'Error',\n },\n};\n\nexport const LOCALE_ES_ES: LocaleConfig = {\n locale: 'es-ES',\n decimalSeparator: ',',\n thousandsSeparator: '.',\n dateFormat: 'DD/MM/YYYY',\n timeFormat: 'HH:mm:ss',\n labels: {\n start: 'Iniciar',\n pause: 'Pausar',\n reset: 'Reiniciar',\n export: 'Exportar',\n autoScale: 'Auto Escala',\n pan: 'Mover',\n zoom: 'Zoom',\n select: 'Seleccionar',\n legend: 'Leyenda',\n fps: 'FPS',\n points: 'puntos',\n loading: 'Cargando...',\n noData: 'Sin datos',\n error: 'Error',\n },\n};\n\nexport const LOCALE_DE_DE: LocaleConfig = {\n locale: 'de-DE',\n decimalSeparator: ',',\n thousandsSeparator: '.',\n dateFormat: 'DD.MM.YYYY',\n timeFormat: 'HH:mm:ss',\n labels: {\n start: 'Start',\n pause: 'Pause',\n reset: 'Zurücksetzen',\n export: 'Exportieren',\n autoScale: 'Auto-Skalierung',\n pan: 'Verschieben',\n zoom: 'Zoom',\n select: 'Auswählen',\n legend: 'Legende',\n fps: 'FPS',\n points: 'Punkte',\n loading: 'Laden...',\n noData: 'Keine Daten',\n error: 'Fehler',\n },\n};\n\nexport const LOCALE_FR_FR: LocaleConfig = {\n locale: 'fr-FR',\n decimalSeparator: ',',\n thousandsSeparator: ' ',\n dateFormat: 'DD/MM/YYYY',\n timeFormat: 'HH:mm:ss',\n labels: {\n start: 'Démarrer',\n pause: 'Pause',\n reset: 'Réinitialiser',\n export: 'Exporter',\n autoScale: 'Échelle auto',\n pan: 'Déplacer',\n zoom: 'Zoom',\n select: 'Sélectionner',\n legend: 'Légende',\n fps: 'FPS',\n points: 'points',\n loading: 'Chargement...',\n noData: 'Aucune donnée',\n error: 'Erreur',\n },\n};\n\nexport const LOCALE_PT_BR: LocaleConfig = {\n locale: 'pt-BR',\n decimalSeparator: ',',\n thousandsSeparator: '.',\n dateFormat: 'DD/MM/YYYY',\n timeFormat: 'HH:mm:ss',\n labels: {\n start: 'Iniciar',\n pause: 'Pausar',\n reset: 'Reiniciar',\n export: 'Exportar',\n autoScale: 'Escala Auto',\n pan: 'Mover',\n zoom: 'Zoom',\n select: 'Selecionar',\n legend: 'Legenda',\n fps: 'FPS',\n points: 'pontos',\n loading: 'Carregando...',\n noData: 'Sem dados',\n error: 'Erro',\n },\n};\n\nexport const LOCALE_ZH_CN: LocaleConfig = {\n locale: 'zh-CN',\n decimalSeparator: '.',\n thousandsSeparator: ',',\n dateFormat: 'YYYY/MM/DD',\n timeFormat: 'HH:mm:ss',\n labels: {\n start: '开始',\n pause: '暂停',\n reset: '重置',\n export: '导出',\n autoScale: '自动缩放',\n pan: '平移',\n zoom: '缩放',\n select: '选择',\n legend: '图例',\n fps: 'FPS',\n points: '点',\n loading: '加载中...',\n noData: '无数据',\n error: '错误',\n },\n};\n\nexport const LOCALE_JA_JP: LocaleConfig = {\n locale: 'ja-JP',\n decimalSeparator: '.',\n thousandsSeparator: ',',\n dateFormat: 'YYYY/MM/DD',\n timeFormat: 'HH:mm:ss',\n labels: {\n start: '開始',\n pause: '一時停止',\n reset: 'リセット',\n export: 'エクスポート',\n autoScale: '自動スケール',\n pan: 'パン',\n zoom: 'ズーム',\n select: '選択',\n legend: '凡例',\n fps: 'FPS',\n points: 'ポイント',\n loading: '読み込み中...',\n noData: 'データなし',\n error: 'エラー',\n },\n};\n\n// Predefined locales map\nconst PREDEFINED_LOCALES: Record<string, LocaleConfig> = {\n 'en-US': LOCALE_EN_US,\n 'en': LOCALE_EN_US,\n 'es-ES': LOCALE_ES_ES,\n 'es': LOCALE_ES_ES,\n 'de-DE': LOCALE_DE_DE,\n 'de': LOCALE_DE_DE,\n 'fr-FR': LOCALE_FR_FR,\n 'fr': LOCALE_FR_FR,\n 'pt-BR': LOCALE_PT_BR,\n 'pt': LOCALE_PT_BR,\n 'zh-CN': LOCALE_ZH_CN,\n 'zh': LOCALE_ZH_CN,\n 'ja-JP': LOCALE_JA_JP,\n 'ja': LOCALE_JA_JP,\n};\n\n// ============================================\n// SI Prefixes\n// ============================================\n\nconst SI_PREFIXES = [\n { value: 1e-15, symbol: 'f' },\n { value: 1e-12, symbol: 'p' },\n { value: 1e-9, symbol: 'n' },\n { value: 1e-6, symbol: 'µ' },\n { value: 1e-3, symbol: 'm' },\n { value: 1, symbol: '' },\n { value: 1e3, symbol: 'k' },\n { value: 1e6, symbol: 'M' },\n { value: 1e9, symbol: 'G' },\n { value: 1e12, symbol: 'T' },\n { value: 1e15, symbol: 'P' },\n];\n\n// ============================================\n// Locale Manager\n// ============================================\n\n/** Current global locale */\nlet currentLocale: LocaleConfig = LOCALE_EN_US;\n\n/**\n * Set the global locale for all charts\n */\nexport function setGlobalLocale(localeOrConfig: string | LocaleConfig): void {\n if (typeof localeOrConfig === 'string') {\n const predefined = PREDEFINED_LOCALES[localeOrConfig];\n if (predefined) {\n currentLocale = predefined;\n } else {\n // Try to create a basic locale from the string\n currentLocale = { ...LOCALE_EN_US, locale: localeOrConfig };\n }\n } else {\n currentLocale = { ...LOCALE_EN_US, ...localeOrConfig };\n }\n}\n\n/**\n * Get the current global locale\n */\nexport function getGlobalLocale(): LocaleConfig {\n return currentLocale;\n}\n\n/**\n * Get a predefined locale by name\n */\nexport function getLocale(name: string): LocaleConfig | undefined {\n return PREDEFINED_LOCALES[name];\n}\n\n/**\n * Register a custom locale\n */\nexport function registerLocale(name: string, config: LocaleConfig): void {\n PREDEFINED_LOCALES[name] = config;\n}\n\n// ============================================\n// Locale Formatter Implementation\n// ============================================\n\n/**\n * Create a locale formatter from a configuration\n */\nexport function createLocaleFormatter(config?: LocaleConfig | string): LocaleFormatter {\n let localeConfig: LocaleConfig;\n \n if (!config) {\n localeConfig = currentLocale;\n } else if (typeof config === 'string') {\n localeConfig = PREDEFINED_LOCALES[config] || { ...LOCALE_EN_US, locale: config };\n } else {\n localeConfig = { ...LOCALE_EN_US, ...config };\n }\n\n const decSep = localeConfig.decimalSeparator || '.';\n const thousandsSep = localeConfig.thousandsSeparator || ',';\n const labels = { ...LOCALE_EN_US.labels, ...localeConfig.labels };\n\n return {\n formatNumber(value: number, decimals: number = 2): string {\n if (localeConfig.numberFormatter) {\n return localeConfig.numberFormatter(value, decimals);\n }\n\n if (!isFinite(value)) {\n return value.toString();\n }\n\n // Format the number\n const parts = Math.abs(value).toFixed(decimals).split('.');\n const integerPart = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandsSep);\n const decimalPart = parts[1];\n\n let result = integerPart;\n if (decimalPart) {\n result += decSep + decimalPart;\n }\n\n return value < 0 ? '-' + result : result;\n },\n\n formatDate(date: Date): string {\n if (localeConfig.dateFormatter) {\n return localeConfig.dateFormatter(date);\n }\n\n const format = localeConfig.dateFormat || 'YYYY-MM-DD';\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const year = String(date.getFullYear());\n\n return format\n .replace('YYYY', year)\n .replace('MM', month)\n .replace('DD', day);\n },\n\n formatTime(date: Date): string {\n const format = localeConfig.timeFormat || 'HH:mm:ss';\n const hours24 = date.getHours();\n const hours12 = hours24 % 12 || 12;\n const minutes = String(date.getMinutes()).padStart(2, '0');\n const seconds = String(date.getSeconds()).padStart(2, '0');\n const ampm = hours24 >= 12 ? 'PM' : 'AM';\n\n return format\n .replace('HH', String(hours24).padStart(2, '0'))\n .replace('hh', String(hours12).padStart(2, '0'))\n .replace('mm', minutes)\n .replace('ss', seconds)\n .replace('a', ampm.toLowerCase())\n .replace('A', ampm);\n },\n\n formatDateTime(date: Date): string {\n return this.formatDate(date) + ' ' + this.formatTime(date);\n },\n\n formatWithPrefix(value: number, unit: string = ''): string {\n if (value === 0) return '0' + (unit ? ' ' + unit : '');\n\n const absValue = Math.abs(value);\n \n // Find appropriate prefix\n let selectedPrefix = SI_PREFIXES[5]; // Default to '' (1)\n for (let i = SI_PREFIXES.length - 1; i >= 0; i--) {\n if (absValue >= SI_PREFIXES[i].value * 0.9999) {\n selectedPrefix = SI_PREFIXES[i];\n break;\n }\n }\n\n const scaledValue = value / selectedPrefix.value;\n const formatted = this.formatNumber(scaledValue, 2);\n \n const suffix = selectedPrefix.symbol + unit;\n return formatted + (suffix ? ' ' + suffix : '');\n },\n\n formatScientific(value: number, decimals: number = 2): string {\n if (value === 0) return '0';\n if (!isFinite(value)) return value.toString();\n\n const exp = Math.floor(Math.log10(Math.abs(value)));\n const mantissa = value / Math.pow(10, exp);\n \n return this.formatNumber(mantissa, decimals) + ' × 10' + formatSuperscript(exp);\n },\n\n getLabel(key: keyof NonNullable<LocaleConfig['labels']>): string {\n return labels[key] || key;\n },\n };\n}\n\n/**\n * Format a number as superscript for scientific notation\n */\nfunction formatSuperscript(num: number): string {\n const superscripts: Record<string, string> = {\n '-': '⁻',\n '0': '⁰',\n '1': '¹',\n '2': '²',\n '3': '³',\n '4': '⁴',\n '5': '⁵',\n '6': '⁶',\n '7': '⁷',\n '8': '⁸',\n '9': '⁹',\n };\n return String(num).split('').map(c => superscripts[c] || c).join('');\n}\n\n// ============================================\n// Default Export\n// ============================================\n\nexport const defaultFormatter = createLocaleFormatter();\n","/**\n * VeloPlot Engine - Internationalization (i18n) Plugin\n * \n * Provides localization support for dates, numbers, and strings.\n * \n * @module plugins/i18n\n */\n\nexport * from \"../../core/locale\";\n\nimport type { PluginManifest, ChartPlugin, PluginContext } from \"../types\";\nimport { setGlobalLocale } from \"../../core/locale\";\n\nexport interface PluginI18nConfig {\n /** Default locale to use */\n locale?: string;\n /** Custom locale definitions */\n customLocales?: Record<string, any>;\n}\n\nconst manifestI18n: PluginManifest = {\n name: \"velo-plot-i18n\",\n version: \"1.0.0\",\n description: \"Internationalization and localization for velo-plot\",\n provides: [\"ui\"],\n tags: [\"i18n\", \"l10n\", \"locale\", \"language\"],\n};\n\n/**\n * VeloPlot i18n Plugin\n * \n * Adds support for multiple languages and local data formatting.\n */\nexport function PluginI18n(config: PluginI18nConfig = {}): ChartPlugin<PluginI18nConfig> {\n return {\n manifest: manifestI18n,\n\n onInit(_ctx: PluginContext) {\n if (config.locale) {\n setGlobalLocale(config.locale);\n }\n },\n\n onDestroy(_ctx: PluginContext) {\n }\n };\n}\n\nexport default PluginI18n;\n"],"names":["LOCALE_EN_US","LOCALE_ES_ES","LOCALE_DE_DE","LOCALE_FR_FR","LOCALE_PT_BR","LOCALE_ZH_CN","LOCALE_JA_JP","PREDEFINED_LOCALES","SI_PREFIXES","currentLocale","setGlobalLocale","localeOrConfig","predefined","getGlobalLocale","getLocale","name","registerLocale","config","createLocaleFormatter","localeConfig","decSep","thousandsSep","labels","value","decimals","parts","integerPart","decimalPart","result","date","format","day","month","year","hours24","hours12","minutes","seconds","ampm","unit","absValue","selectedPrefix","i","scaledValue","formatted","suffix","exp","mantissa","formatSuperscript","key","num","superscripts","c","defaultFormatter","manifestI18n","PluginI18n","_ctx"],"mappings":"AA0EO,MAAMA,IAA6B;AAAA,EACxC,QAAQ;AAAA,EACR,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,YAAY;AAAA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
|
1
1
|
export * from './keyboard/index'
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
2
|
+
import VeloPlot from './keyboard/index'
|
|
3
|
+
export default VeloPlot
|
package/dist/plugins/keyboard.js
CHANGED
|
@@ -1,8 +1,68 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as c } from "../index-CWxIHdwX.js";
|
|
2
|
+
import { D as y } from "../index-CWxIHdwX.js";
|
|
3
|
+
const u = {
|
|
4
|
+
name: "velo-plot-keyboard",
|
|
5
|
+
version: "1.0.0",
|
|
6
|
+
description: "Keyboard shortcut management for velo-plot",
|
|
7
|
+
provides: ["interaction"],
|
|
8
|
+
tags: ["keyboard", "shortcuts", "interaction", "accessibility"]
|
|
9
|
+
};
|
|
10
|
+
function p(s = {}) {
|
|
11
|
+
let a = null;
|
|
12
|
+
return {
|
|
13
|
+
manifest: u,
|
|
14
|
+
onInit(l) {
|
|
15
|
+
var i;
|
|
16
|
+
const o = l.chart, t = (i = l.getPlugin) == null ? void 0 : i.call(l, "velo-plot-drawing-tools");
|
|
17
|
+
a = new c({
|
|
18
|
+
target: l.ui.container,
|
|
19
|
+
bindings: [...s.bindings ?? [], ...s.extraShortcuts ?? []],
|
|
20
|
+
replaceDefaults: s.replaceDefaults,
|
|
21
|
+
callbacks: {
|
|
22
|
+
onResetZoom: () => {
|
|
23
|
+
var e;
|
|
24
|
+
return (e = o.resetZoom) == null ? void 0 : e.call(o);
|
|
25
|
+
},
|
|
26
|
+
onAutoScale: () => {
|
|
27
|
+
var e;
|
|
28
|
+
return (e = o.autoScale) == null ? void 0 : e.call(o, !1);
|
|
29
|
+
},
|
|
30
|
+
onEscape: () => {
|
|
31
|
+
var e;
|
|
32
|
+
return (e = o.clearSelection) == null ? void 0 : e.call(o);
|
|
33
|
+
},
|
|
34
|
+
onExportImage: () => {
|
|
35
|
+
var e;
|
|
36
|
+
try {
|
|
37
|
+
const n = (e = o.exportImage) == null ? void 0 : e.call(o, "png");
|
|
38
|
+
if (n) {
|
|
39
|
+
const r = document.createElement("a");
|
|
40
|
+
r.href = n, r.download = "chart.png", r.click();
|
|
41
|
+
}
|
|
42
|
+
} catch {
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
onUndo: () => {
|
|
46
|
+
var e, n;
|
|
47
|
+
return (n = (e = t == null ? void 0 : t.api) == null ? void 0 : e.undo) == null ? void 0 : n.call(e);
|
|
48
|
+
},
|
|
49
|
+
onRedo: () => {
|
|
50
|
+
var e, n;
|
|
51
|
+
return (n = (e = t == null ? void 0 : t.api) == null ? void 0 : e.redo) == null ? void 0 : n.call(e);
|
|
52
|
+
},
|
|
53
|
+
...s.callbacks
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
onDestroy() {
|
|
58
|
+
a == null || a.destroy(), a = null;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
2
62
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
63
|
+
y as DEFAULT_KEY_BINDINGS,
|
|
64
|
+
c as KeyBindingManager,
|
|
65
|
+
p as PluginKeyboard,
|
|
66
|
+
p as default
|
|
7
67
|
};
|
|
8
68
|
//# sourceMappingURL=keyboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"keyboard.js","sources":["../../src/plugins/keyboard/index.ts"],"sourcesContent":["/**\n * Velo Plot - Keyboard Shortcuts Plugin\n */\n\nimport { KeyBindingManager, DEFAULT_KEY_BINDINGS } from \"../../core/keybindings\";\nimport type { KeyBinding, KeyBindingManagerOptions } from \"../../core/keybindings\";\nimport type { PluginManifest, ChartPlugin, PluginContext } from \"../types\";\n\nexport interface PluginKeyboardConfig extends Partial<KeyBindingManagerOptions> {\n extraShortcuts?: KeyBinding[];\n}\n\nconst manifestKeyboard: PluginManifest = {\n name: \"velo-plot-keyboard\",\n version: \"1.0.0\",\n description: \"Keyboard shortcut management for velo-plot\",\n provides: [\"interaction\"],\n tags: [\"keyboard\", \"shortcuts\", \"interaction\", \"accessibility\"],\n};\n\nexport function PluginKeyboard(config: PluginKeyboardConfig = {}): ChartPlugin<PluginKeyboardConfig> {\n let manager: KeyBindingManager | null = null;\n\n return {\n manifest: manifestKeyboard,\n\n onInit(ctx: PluginContext) {\n const chart = ctx.chart as any;\n const drawing = ctx.getPlugin?.(\"velo-plot-drawing-tools\") as { api?: { undo?: () => boolean; redo?: () => boolean } } | undefined;\n\n manager = new KeyBindingManager({\n target: ctx.ui.container,\n bindings: [...(config.bindings ?? []), ...(config.extraShortcuts ?? [])],\n replaceDefaults: config.replaceDefaults,\n callbacks: {\n onResetZoom: () => chart.resetZoom?.(),\n onAutoScale: () => chart.autoScale?.(false),\n onEscape: () => chart.clearSelection?.(),\n onExportImage: () => {\n try {\n const url = chart.exportImage?.(\"png\");\n if (url) {\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = \"chart.png\";\n a.click();\n }\n } catch {\n /* ignore */\n }\n },\n onUndo: () => drawing?.api?.undo?.(),\n onRedo: () => drawing?.api?.redo?.(),\n ...config.callbacks,\n },\n });\n },\n\n onDestroy() {\n manager?.destroy();\n manager = null;\n },\n };\n}\n\nexport { KeyBindingManager, DEFAULT_KEY_BINDINGS };\nexport default PluginKeyboard;\n"],"names":["manifestKeyboard","PluginKeyboard","config","manager","ctx","chart","drawing","_a","KeyBindingManager","url","a","_b"],"mappings":";;AAYA,MAAMA,IAAmC;AAAA,EACvC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU,CAAC,aAAa;AAAA,EACxB,MAAM,CAAC,YAAY,aAAa,eAAe,eAAe;AAChE;AAEO,SAASC,EAAeC,IAA+B,IAAuC;AACnG,MAAIC,IAAoC;AAExC,SAAO;AAAA,IACL,UAAUH;AAAA,IAEV,OAAOI,GAAoB;;AACzB,YAAMC,IAAQD,EAAI,OACZ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