zengeld-canvas 0.1.2

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/LICENSE-APACHE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 zengeld
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 zengeld
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # zengeld-canvas
2
+
3
+ **High-performance SVG chart rendering engine for financial data visualization**
4
+
5
+ [![Crates.io](https://img.shields.io/crates/v/zengeld-canvas.svg)](https://crates.io/crates/zengeld-canvas)
6
+ [![PyPI](https://img.shields.io/pypi/v/zengeld-canvas.svg)](https://pypi.org/project/zengeld-canvas/)
7
+ [![npm](https://img.shields.io/npm/v/zengeld-canvas.svg)](https://www.npmjs.com/package/zengeld-canvas)
8
+
9
+ WebAssembly bindings for the high-performance zengeld-canvas chart rendering engine. Built in Rust with zero runtime dependencies.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install zengeld-canvas
15
+ ```
16
+
17
+ ## Examples
18
+
19
+ <table>
20
+ <tr>
21
+ <td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/09_dark_theme.svg" width="400"/><br/><b>Dark Theme</b></td>
22
+ <td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/05_with_macd.svg" width="400"/><br/><b>MACD Indicator</b></td>
23
+ </tr>
24
+ <tr>
25
+ <td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/14_multichart_1_3.svg" width="400"/><br/><b>Multi-Chart Layout</b></td>
26
+ <td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/19_primitives_channels.svg" width="400"/><br/><b>Channels</b></td>
27
+ </tr>
28
+ <tr>
29
+ <td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/22_primitives_gann.svg" width="400"/><br/><b>Gann Tools</b></td>
30
+ <td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/25_primitives_patterns.svg" width="400"/><br/><b>Chart Patterns</b></td>
31
+ </tr>
32
+ </table>
33
+
34
+ ## Features
35
+
36
+ - **80+ Drawing Primitives** - Fibonacci, Gann, Pitchforks, Patterns, Elliott Waves, and more
37
+ - **12 Series Types** - Candlestick, Line, Area, Histogram, and more
38
+ - **Platform Agnostic** - `RenderContext` trait for any rendering backend
39
+ - **Zero Dependencies** - Only serde for serialization
40
+ - **High Performance** - Optimized for real-time chart rendering
41
+
42
+ ## Quick Start
43
+
44
+ ```javascript
45
+ import init, { JsBar, JsViewport, JsPriceScale, JsTheme } from 'zengeld-canvas';
46
+
47
+ async function main() {
48
+ await init();
49
+
50
+ // Create bars
51
+ const bar = new JsBar(1703721600, 100.0, 105.0, 98.0, 103.0, 1000000);
52
+ console.log(`Bullish: ${bar.isBullish()}`);
53
+
54
+ // Create viewport
55
+ const viewport = new JsViewport(800.0, 600.0);
56
+ viewport.firstBar = 0.0;
57
+ viewport.lastBar = 100.0;
58
+
59
+ // Create price scale
60
+ const priceScale = new JsPriceScale();
61
+ priceScale.setRange(95.0, 110.0);
62
+
63
+ // Use dark theme
64
+ const theme = JsTheme.dark();
65
+ console.log(`Background: ${theme.background}`);
66
+ }
67
+
68
+ main();
69
+ ```
70
+
71
+ ## License
72
+
73
+ MIT OR Apache-2.0
74
+
75
+ ## Support the Project
76
+
77
+ If you find this library useful, consider supporting development:
78
+
79
+ | Currency | Network | Address |
80
+ |----------|---------|---------|
81
+ | USDT | TRC20 | `TNxMKsvVLYViQ5X5sgCYmkzH4qjhhh5U7X` |
82
+ | USDC | Arbitrum | `0xEF3B94Fe845E21371b4C4C5F2032E1f23A13Aa6e` |
83
+ | ETH | Ethereum | `0xEF3B94Fe845E21371b4C4C5F2032E1f23A13Aa6e` |
84
+ | BTC | Bitcoin | `bc1qjgzthxja8umt5tvrp5tfcf9zeepmhn0f6mnt40` |
85
+ | SOL | Solana | `DZJjmH8Cs5wEafz5Ua86wBBkurSA4xdWXa3LWnBUR94c` |
86
+
87
+ ---
88
+
89
+ <p align="center">
90
+ <a href="https://zen-geldmaschine.net/">
91
+ <img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/assets/author.svg" alt="zengeld" />
92
+ </a>
93
+ </p>
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "zengeld-canvas",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "zengeld"
6
+ ],
7
+ "description": "WebAssembly bindings for zengeld-canvas chart rendering engine",
8
+ "version": "0.1.2",
9
+ "license": "MIT OR Apache-2.0",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/zengeld/zengeld-canvas"
13
+ },
14
+ "files": [
15
+ "zengeld_canvas_wasm_bg.wasm",
16
+ "zengeld_canvas_wasm.js",
17
+ "zengeld_canvas_wasm.d.ts",
18
+ "LICENSE-APACHE",
19
+ "LICENSE-MIT"
20
+ ],
21
+ "main": "zengeld_canvas_wasm.js",
22
+ "types": "zengeld_canvas_wasm.d.ts",
23
+ "sideEffects": [
24
+ "./snippets/*"
25
+ ]
26
+ }
@@ -0,0 +1,112 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class JsBar {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ isBullish(): boolean;
8
+ constructor(timestamp: bigint, open: number, high: number, low: number, close: number, volume: number);
9
+ readonly low: number;
10
+ readonly high: number;
11
+ readonly open: number;
12
+ readonly close: number;
13
+ readonly volume: number;
14
+ readonly timestamp: bigint;
15
+ }
16
+
17
+ export class JsChartConfig {
18
+ free(): void;
19
+ [Symbol.dispose](): void;
20
+ constructor();
21
+ }
22
+
23
+ export class JsTheme {
24
+ private constructor();
25
+ free(): void;
26
+ [Symbol.dispose](): void;
27
+ static dark(): JsTheme;
28
+ static light(): JsTheme;
29
+ readonly gridColor: string;
30
+ readonly textColor: string;
31
+ readonly candleDown: string;
32
+ readonly bgColor: string;
33
+ readonly candleUp: string;
34
+ }
35
+
36
+ export class JsViewport {
37
+ free(): void;
38
+ [Symbol.dispose](): void;
39
+ scrollToEnd(): void;
40
+ setBarCount(count: number): void;
41
+ scrollToStart(): void;
42
+ constructor(width: number, height: number);
43
+ setSize(width: number, height: number): void;
44
+ readonly chartWidth: number;
45
+ readonly chartHeight: number;
46
+ readonly barWidth: number;
47
+ }
48
+
49
+ /**
50
+ * Get library version
51
+ */
52
+ export function version(): string;
53
+
54
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
55
+
56
+ export interface InitOutput {
57
+ readonly memory: WebAssembly.Memory;
58
+ readonly __wbg_jsbar_free: (a: number, b: number) => void;
59
+ readonly __wbg_jschartconfig_free: (a: number, b: number) => void;
60
+ readonly __wbg_jstheme_free: (a: number, b: number) => void;
61
+ readonly __wbg_jsviewport_free: (a: number, b: number) => void;
62
+ readonly jsbar_close: (a: number) => number;
63
+ readonly jsbar_high: (a: number) => number;
64
+ readonly jsbar_isBullish: (a: number) => number;
65
+ readonly jsbar_low: (a: number) => number;
66
+ readonly jsbar_new: (a: bigint, b: number, c: number, d: number, e: number, f: number) => number;
67
+ readonly jsbar_open: (a: number) => number;
68
+ readonly jsbar_timestamp: (a: number) => bigint;
69
+ readonly jsbar_volume: (a: number) => number;
70
+ readonly jschartconfig_new: () => number;
71
+ readonly jstheme_bgColor: (a: number) => [number, number];
72
+ readonly jstheme_candleDown: (a: number) => [number, number];
73
+ readonly jstheme_candleUp: (a: number) => [number, number];
74
+ readonly jstheme_dark: () => number;
75
+ readonly jstheme_gridColor: (a: number) => [number, number];
76
+ readonly jstheme_light: () => number;
77
+ readonly jstheme_textColor: (a: number) => [number, number];
78
+ readonly jsviewport_barWidth: (a: number) => number;
79
+ readonly jsviewport_chartHeight: (a: number) => number;
80
+ readonly jsviewport_chartWidth: (a: number) => number;
81
+ readonly jsviewport_new: (a: number, b: number) => number;
82
+ readonly jsviewport_scrollToEnd: (a: number) => void;
83
+ readonly jsviewport_scrollToStart: (a: number) => void;
84
+ readonly jsviewport_setBarCount: (a: number, b: number) => void;
85
+ readonly jsviewport_setSize: (a: number, b: number, c: number) => void;
86
+ readonly version: () => [number, number];
87
+ readonly __wbindgen_externrefs: WebAssembly.Table;
88
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
89
+ readonly __wbindgen_start: () => void;
90
+ }
91
+
92
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
93
+
94
+ /**
95
+ * Instantiates the given `module`, which can either be bytes or
96
+ * a precompiled `WebAssembly.Module`.
97
+ *
98
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
99
+ *
100
+ * @returns {InitOutput}
101
+ */
102
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
103
+
104
+ /**
105
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
106
+ * for everything else, calls `WebAssembly.instantiate` directly.
107
+ *
108
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
109
+ *
110
+ * @returns {Promise<InitOutput>}
111
+ */
112
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,454 @@
1
+ let wasm;
2
+
3
+ function getStringFromWasm0(ptr, len) {
4
+ ptr = ptr >>> 0;
5
+ return decodeText(ptr, len);
6
+ }
7
+
8
+ let cachedUint8ArrayMemory0 = null;
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
15
+
16
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
+ cachedTextDecoder.decode();
18
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
19
+ let numBytesDecoded = 0;
20
+ function decodeText(ptr, len) {
21
+ numBytesDecoded += len;
22
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
23
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
24
+ cachedTextDecoder.decode();
25
+ numBytesDecoded = len;
26
+ }
27
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
28
+ }
29
+
30
+ const JsBarFinalization = (typeof FinalizationRegistry === 'undefined')
31
+ ? { register: () => {}, unregister: () => {} }
32
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsbar_free(ptr >>> 0, 1));
33
+
34
+ const JsChartConfigFinalization = (typeof FinalizationRegistry === 'undefined')
35
+ ? { register: () => {}, unregister: () => {} }
36
+ : new FinalizationRegistry(ptr => wasm.__wbg_jschartconfig_free(ptr >>> 0, 1));
37
+
38
+ const JsThemeFinalization = (typeof FinalizationRegistry === 'undefined')
39
+ ? { register: () => {}, unregister: () => {} }
40
+ : new FinalizationRegistry(ptr => wasm.__wbg_jstheme_free(ptr >>> 0, 1));
41
+
42
+ const JsViewportFinalization = (typeof FinalizationRegistry === 'undefined')
43
+ ? { register: () => {}, unregister: () => {} }
44
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsviewport_free(ptr >>> 0, 1));
45
+
46
+ /**
47
+ * A single OHLCV bar
48
+ */
49
+ export class JsBar {
50
+ __destroy_into_raw() {
51
+ const ptr = this.__wbg_ptr;
52
+ this.__wbg_ptr = 0;
53
+ JsBarFinalization.unregister(this);
54
+ return ptr;
55
+ }
56
+ free() {
57
+ const ptr = this.__destroy_into_raw();
58
+ wasm.__wbg_jsbar_free(ptr, 0);
59
+ }
60
+ /**
61
+ * @returns {boolean}
62
+ */
63
+ isBullish() {
64
+ const ret = wasm.jsbar_isBullish(this.__wbg_ptr);
65
+ return ret !== 0;
66
+ }
67
+ /**
68
+ * @returns {number}
69
+ */
70
+ get low() {
71
+ const ret = wasm.jsbar_low(this.__wbg_ptr);
72
+ return ret;
73
+ }
74
+ /**
75
+ * @param {bigint} timestamp
76
+ * @param {number} open
77
+ * @param {number} high
78
+ * @param {number} low
79
+ * @param {number} close
80
+ * @param {number} volume
81
+ */
82
+ constructor(timestamp, open, high, low, close, volume) {
83
+ const ret = wasm.jsbar_new(timestamp, open, high, low, close, volume);
84
+ this.__wbg_ptr = ret >>> 0;
85
+ JsBarFinalization.register(this, this.__wbg_ptr, this);
86
+ return this;
87
+ }
88
+ /**
89
+ * @returns {number}
90
+ */
91
+ get high() {
92
+ const ret = wasm.jsbar_high(this.__wbg_ptr);
93
+ return ret;
94
+ }
95
+ /**
96
+ * @returns {number}
97
+ */
98
+ get open() {
99
+ const ret = wasm.jsbar_open(this.__wbg_ptr);
100
+ return ret;
101
+ }
102
+ /**
103
+ * @returns {number}
104
+ */
105
+ get close() {
106
+ const ret = wasm.jsbar_close(this.__wbg_ptr);
107
+ return ret;
108
+ }
109
+ /**
110
+ * @returns {number}
111
+ */
112
+ get volume() {
113
+ const ret = wasm.jsbar_volume(this.__wbg_ptr);
114
+ return ret;
115
+ }
116
+ /**
117
+ * @returns {bigint}
118
+ */
119
+ get timestamp() {
120
+ const ret = wasm.jsbar_timestamp(this.__wbg_ptr);
121
+ return ret;
122
+ }
123
+ }
124
+ if (Symbol.dispose) JsBar.prototype[Symbol.dispose] = JsBar.prototype.free;
125
+
126
+ /**
127
+ * Chart configuration
128
+ */
129
+ export class JsChartConfig {
130
+ __destroy_into_raw() {
131
+ const ptr = this.__wbg_ptr;
132
+ this.__wbg_ptr = 0;
133
+ JsChartConfigFinalization.unregister(this);
134
+ return ptr;
135
+ }
136
+ free() {
137
+ const ptr = this.__destroy_into_raw();
138
+ wasm.__wbg_jschartconfig_free(ptr, 0);
139
+ }
140
+ constructor() {
141
+ const ret = wasm.jschartconfig_new();
142
+ this.__wbg_ptr = ret >>> 0;
143
+ JsChartConfigFinalization.register(this, this.__wbg_ptr, this);
144
+ return this;
145
+ }
146
+ }
147
+ if (Symbol.dispose) JsChartConfig.prototype[Symbol.dispose] = JsChartConfig.prototype.free;
148
+
149
+ /**
150
+ * Chart theme (colors)
151
+ */
152
+ export class JsTheme {
153
+ static __wrap(ptr) {
154
+ ptr = ptr >>> 0;
155
+ const obj = Object.create(JsTheme.prototype);
156
+ obj.__wbg_ptr = ptr;
157
+ JsThemeFinalization.register(obj, obj.__wbg_ptr, obj);
158
+ return obj;
159
+ }
160
+ __destroy_into_raw() {
161
+ const ptr = this.__wbg_ptr;
162
+ this.__wbg_ptr = 0;
163
+ JsThemeFinalization.unregister(this);
164
+ return ptr;
165
+ }
166
+ free() {
167
+ const ptr = this.__destroy_into_raw();
168
+ wasm.__wbg_jstheme_free(ptr, 0);
169
+ }
170
+ /**
171
+ * @returns {string}
172
+ */
173
+ get gridColor() {
174
+ let deferred1_0;
175
+ let deferred1_1;
176
+ try {
177
+ const ret = wasm.jstheme_gridColor(this.__wbg_ptr);
178
+ deferred1_0 = ret[0];
179
+ deferred1_1 = ret[1];
180
+ return getStringFromWasm0(ret[0], ret[1]);
181
+ } finally {
182
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
183
+ }
184
+ }
185
+ /**
186
+ * @returns {string}
187
+ */
188
+ get textColor() {
189
+ let deferred1_0;
190
+ let deferred1_1;
191
+ try {
192
+ const ret = wasm.jstheme_textColor(this.__wbg_ptr);
193
+ deferred1_0 = ret[0];
194
+ deferred1_1 = ret[1];
195
+ return getStringFromWasm0(ret[0], ret[1]);
196
+ } finally {
197
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
198
+ }
199
+ }
200
+ /**
201
+ * @returns {string}
202
+ */
203
+ get candleDown() {
204
+ let deferred1_0;
205
+ let deferred1_1;
206
+ try {
207
+ const ret = wasm.jstheme_candleDown(this.__wbg_ptr);
208
+ deferred1_0 = ret[0];
209
+ deferred1_1 = ret[1];
210
+ return getStringFromWasm0(ret[0], ret[1]);
211
+ } finally {
212
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
213
+ }
214
+ }
215
+ /**
216
+ * @returns {JsTheme}
217
+ */
218
+ static dark() {
219
+ const ret = wasm.jstheme_dark();
220
+ return JsTheme.__wrap(ret);
221
+ }
222
+ /**
223
+ * @returns {JsTheme}
224
+ */
225
+ static light() {
226
+ const ret = wasm.jstheme_light();
227
+ return JsTheme.__wrap(ret);
228
+ }
229
+ /**
230
+ * @returns {string}
231
+ */
232
+ get bgColor() {
233
+ let deferred1_0;
234
+ let deferred1_1;
235
+ try {
236
+ const ret = wasm.jstheme_bgColor(this.__wbg_ptr);
237
+ deferred1_0 = ret[0];
238
+ deferred1_1 = ret[1];
239
+ return getStringFromWasm0(ret[0], ret[1]);
240
+ } finally {
241
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
242
+ }
243
+ }
244
+ /**
245
+ * @returns {string}
246
+ */
247
+ get candleUp() {
248
+ let deferred1_0;
249
+ let deferred1_1;
250
+ try {
251
+ const ret = wasm.jstheme_candleUp(this.__wbg_ptr);
252
+ deferred1_0 = ret[0];
253
+ deferred1_1 = ret[1];
254
+ return getStringFromWasm0(ret[0], ret[1]);
255
+ } finally {
256
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
257
+ }
258
+ }
259
+ }
260
+ if (Symbol.dispose) JsTheme.prototype[Symbol.dispose] = JsTheme.prototype.free;
261
+
262
+ /**
263
+ * Chart viewport managing visible area
264
+ */
265
+ export class JsViewport {
266
+ __destroy_into_raw() {
267
+ const ptr = this.__wbg_ptr;
268
+ this.__wbg_ptr = 0;
269
+ JsViewportFinalization.unregister(this);
270
+ return ptr;
271
+ }
272
+ free() {
273
+ const ptr = this.__destroy_into_raw();
274
+ wasm.__wbg_jsviewport_free(ptr, 0);
275
+ }
276
+ /**
277
+ * @returns {number}
278
+ */
279
+ get chartWidth() {
280
+ const ret = wasm.jsviewport_chartWidth(this.__wbg_ptr);
281
+ return ret;
282
+ }
283
+ /**
284
+ * @returns {number}
285
+ */
286
+ get chartHeight() {
287
+ const ret = wasm.jsviewport_chartHeight(this.__wbg_ptr);
288
+ return ret;
289
+ }
290
+ scrollToEnd() {
291
+ wasm.jsviewport_scrollToEnd(this.__wbg_ptr);
292
+ }
293
+ /**
294
+ * @param {number} count
295
+ */
296
+ setBarCount(count) {
297
+ wasm.jsviewport_setBarCount(this.__wbg_ptr, count);
298
+ }
299
+ scrollToStart() {
300
+ wasm.jsviewport_scrollToStart(this.__wbg_ptr);
301
+ }
302
+ /**
303
+ * @param {number} width
304
+ * @param {number} height
305
+ */
306
+ constructor(width, height) {
307
+ const ret = wasm.jsviewport_new(width, height);
308
+ this.__wbg_ptr = ret >>> 0;
309
+ JsViewportFinalization.register(this, this.__wbg_ptr, this);
310
+ return this;
311
+ }
312
+ /**
313
+ * @param {number} width
314
+ * @param {number} height
315
+ */
316
+ setSize(width, height) {
317
+ wasm.jsviewport_setSize(this.__wbg_ptr, width, height);
318
+ }
319
+ /**
320
+ * @returns {number}
321
+ */
322
+ get barWidth() {
323
+ const ret = wasm.jsviewport_barWidth(this.__wbg_ptr);
324
+ return ret;
325
+ }
326
+ }
327
+ if (Symbol.dispose) JsViewport.prototype[Symbol.dispose] = JsViewport.prototype.free;
328
+
329
+ /**
330
+ * Get library version
331
+ * @returns {string}
332
+ */
333
+ export function version() {
334
+ let deferred1_0;
335
+ let deferred1_1;
336
+ try {
337
+ const ret = wasm.version();
338
+ deferred1_0 = ret[0];
339
+ deferred1_1 = ret[1];
340
+ return getStringFromWasm0(ret[0], ret[1]);
341
+ } finally {
342
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
343
+ }
344
+ }
345
+
346
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
347
+
348
+ async function __wbg_load(module, imports) {
349
+ if (typeof Response === 'function' && module instanceof Response) {
350
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
351
+ try {
352
+ return await WebAssembly.instantiateStreaming(module, imports);
353
+ } catch (e) {
354
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
355
+
356
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
357
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
358
+
359
+ } else {
360
+ throw e;
361
+ }
362
+ }
363
+ }
364
+
365
+ const bytes = await module.arrayBuffer();
366
+ return await WebAssembly.instantiate(bytes, imports);
367
+ } else {
368
+ const instance = await WebAssembly.instantiate(module, imports);
369
+
370
+ if (instance instanceof WebAssembly.Instance) {
371
+ return { instance, module };
372
+ } else {
373
+ return instance;
374
+ }
375
+ }
376
+ }
377
+
378
+ function __wbg_get_imports() {
379
+ const imports = {};
380
+ imports.wbg = {};
381
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
382
+ throw new Error(getStringFromWasm0(arg0, arg1));
383
+ };
384
+ imports.wbg.__wbindgen_init_externref_table = function() {
385
+ const table = wasm.__wbindgen_externrefs;
386
+ const offset = table.grow(4);
387
+ table.set(0, undefined);
388
+ table.set(offset + 0, undefined);
389
+ table.set(offset + 1, null);
390
+ table.set(offset + 2, true);
391
+ table.set(offset + 3, false);
392
+ };
393
+
394
+ return imports;
395
+ }
396
+
397
+ function __wbg_finalize_init(instance, module) {
398
+ wasm = instance.exports;
399
+ __wbg_init.__wbindgen_wasm_module = module;
400
+ cachedUint8ArrayMemory0 = null;
401
+
402
+
403
+ wasm.__wbindgen_start();
404
+ return wasm;
405
+ }
406
+
407
+ function initSync(module) {
408
+ if (wasm !== undefined) return wasm;
409
+
410
+
411
+ if (typeof module !== 'undefined') {
412
+ if (Object.getPrototypeOf(module) === Object.prototype) {
413
+ ({module} = module)
414
+ } else {
415
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
416
+ }
417
+ }
418
+
419
+ const imports = __wbg_get_imports();
420
+ if (!(module instanceof WebAssembly.Module)) {
421
+ module = new WebAssembly.Module(module);
422
+ }
423
+ const instance = new WebAssembly.Instance(module, imports);
424
+ return __wbg_finalize_init(instance, module);
425
+ }
426
+
427
+ async function __wbg_init(module_or_path) {
428
+ if (wasm !== undefined) return wasm;
429
+
430
+
431
+ if (typeof module_or_path !== 'undefined') {
432
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
433
+ ({module_or_path} = module_or_path)
434
+ } else {
435
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
436
+ }
437
+ }
438
+
439
+ if (typeof module_or_path === 'undefined') {
440
+ module_or_path = new URL('zengeld_canvas_wasm_bg.wasm', import.meta.url);
441
+ }
442
+ const imports = __wbg_get_imports();
443
+
444
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
445
+ module_or_path = fetch(module_or_path);
446
+ }
447
+
448
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
449
+
450
+ return __wbg_finalize_init(instance, module);
451
+ }
452
+
453
+ export { initSync };
454
+ export default __wbg_init;
Binary file