canvasxpress-cli 63.2.0 → 63.3.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/cmds/help.js +7 -8
- package/cmds/io.js +17 -22
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/canvasXpress.css +3 -1
- package/src/canvasXpress.js +4 -4
package/cmds/help.js
CHANGED
|
@@ -22,7 +22,7 @@ const menus = {
|
|
|
22
22
|
--graph, -g ........ [optional] graph name
|
|
23
23
|
--number, -n ....... [optional] number for the graph
|
|
24
24
|
--timeout, -t ...... [optional] timeout in millisecods to close browser
|
|
25
|
-
{default}
|
|
25
|
+
{default} 2500
|
|
26
26
|
--browser, -b ...... [optional] boolean to do not run headless and pause for debugging
|
|
27
27
|
|
|
28
28
|
Examples:
|
|
@@ -46,7 +46,7 @@ const menus = {
|
|
|
46
46
|
--data, -d ......... [optional - required] json string with the data for CanvasXpress
|
|
47
47
|
--config, -c ....... [optional] json string with configuration for CanvasXpress
|
|
48
48
|
--timeout, -t ...... [optional] timeout in millisecods to close browser
|
|
49
|
-
{default}
|
|
49
|
+
{default} 2500
|
|
50
50
|
--browser, -b ...... [optional] boolean to do not run headless and pause for debugging
|
|
51
51
|
|
|
52
52
|
Examples:
|
|
@@ -68,7 +68,7 @@ const menus = {
|
|
|
68
68
|
--output, -o ....... [optional] directory path to save image
|
|
69
69
|
{default} './'
|
|
70
70
|
--timeout, -t ...... [optional] timeout in millisecods to close browser
|
|
71
|
-
{default}
|
|
71
|
+
{default} 2500
|
|
72
72
|
--browser, -b ...... [optional] boolean to do not run headless and pause for debugging
|
|
73
73
|
|
|
74
74
|
Examples:
|
|
@@ -92,10 +92,9 @@ const menus = {
|
|
|
92
92
|
--height, -y ....... [optional] integer for image height
|
|
93
93
|
{default} 800
|
|
94
94
|
--data, -d ......... [optional - required] json string with the data for CanvasXpress
|
|
95
|
-
--config, -c ....... [optional] json string with configuration for CanvasXpress
|
|
96
|
-
{default} 500
|
|
95
|
+
--config, -c ....... [optional] json string with configuration for CanvasXpress
|
|
97
96
|
--timeout, -t ...... [optional] timeout in millisecods to close browser
|
|
98
|
-
{default}
|
|
97
|
+
{default} 2500
|
|
99
98
|
--browser, -b ...... [optional] boolean to do not run headless and pause for debugging
|
|
100
99
|
|
|
101
100
|
Examples:
|
|
@@ -124,7 +123,7 @@ const menus = {
|
|
|
124
123
|
--data, -d ......... [optional - required] json string with the data for CanvasXpress
|
|
125
124
|
--config, -c ....... [optional] json string with configuration for CanvasXpress
|
|
126
125
|
--timeout, -t ...... [optional] timeout in millisecods to close browser
|
|
127
|
-
{default}
|
|
126
|
+
{default} 2500
|
|
128
127
|
--browser, -b ...... [optional] boolean to do not run headless and pause for debugging
|
|
129
128
|
|
|
130
129
|
Examples:
|
|
@@ -153,7 +152,7 @@ const menus = {
|
|
|
153
152
|
--data, -d ......... [optional - required] json string with the data for CanvasXpress
|
|
154
153
|
--config, -c ....... [optional] json string with configuration for CanvasXpress
|
|
155
154
|
--timeout, -t ...... [optional] timeout in millisecods to close browser
|
|
156
|
-
{default}
|
|
155
|
+
{default} 2500
|
|
157
156
|
--browser, -b ...... [optional] boolean to do not run headless and pause for debugging
|
|
158
157
|
|
|
159
158
|
Examples:
|
package/cmds/io.js
CHANGED
|
@@ -42,13 +42,13 @@ module.exports = async (obj) => {
|
|
|
42
42
|
viewport: { width: 1000, height: 1000 }
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
await context.route('**/*', route => {
|
|
46
|
-
route.continue({ headers: { ...route.request().headers() } });
|
|
47
|
-
});
|
|
48
|
-
|
|
49
45
|
const page = await context.newPage();
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
const downloadDir = path.resolve(obj.output);
|
|
48
|
+
const downloads = [];
|
|
49
|
+
page.on('download', (dl) => {
|
|
50
|
+
downloads.push(dl.saveAs(path.join(downloadDir, dl.suggestedFilename())));
|
|
51
|
+
});
|
|
52
52
|
|
|
53
53
|
page.on('console', consoleObj => {
|
|
54
54
|
if (consoleObj.type() !== 'warning') {
|
|
@@ -120,35 +120,30 @@ module.exports = async (obj) => {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const downloadDir = path.resolve(obj.output);
|
|
124
|
-
await page.route('**/*', async route => {
|
|
125
|
-
const response = await route.fetch();
|
|
126
|
-
const headers = response.headers();
|
|
127
|
-
if (headers['content-disposition'] && headers['content-disposition'].includes('attachment')) {
|
|
128
|
-
const buffer = await response.body();
|
|
129
|
-
const disposition = headers['content-disposition'];
|
|
130
|
-
const match = disposition.match(/filename="?([^"]+)"?/);
|
|
131
|
-
const filename = match ? match[1] : 'download';
|
|
132
|
-
fs.writeFileSync(path.join(downloadDir, filename), buffer);
|
|
133
|
-
route.abort();
|
|
134
|
-
} else {
|
|
135
|
-
route.continue();
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
123
|
const targetUrl = obj.input
|
|
140
124
|
? (obj.cmd == 'csv' ? defhtml : obj.cmd == 'reproduce' ? obj.input + '?showTransition=false' : obj.input)
|
|
141
125
|
: defhtml;
|
|
142
126
|
|
|
143
127
|
await page.goto(targetUrl, { waitUntil: 'networkidle' });
|
|
144
128
|
|
|
145
|
-
await page.waitForFunction(() => typeof CanvasXpress !== 'undefined'
|
|
129
|
+
await page.waitForFunction(() => typeof CanvasXpress !== 'undefined');
|
|
130
|
+
|
|
131
|
+
// Create a CX instance if one doesn't already exist (onReady in template
|
|
132
|
+
// has a circular dependency that prevents auto-instantiation in headless)
|
|
133
|
+
await page.evaluate(() => {
|
|
134
|
+
if (!CanvasXpress.instances || CanvasXpress.instances.length === 0) {
|
|
135
|
+
new CanvasXpress("cX", {y:{vars:["V"],smps:["S"],data:[[0]]}}, {});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
await page.waitForFunction(() => CanvasXpress.ready);
|
|
146
139
|
|
|
147
140
|
await page.evaluate(`(${func.toString()})(${JSON.stringify(obj)})`);
|
|
148
141
|
|
|
149
142
|
const delay = obj.cmd == 'csv' || obj.cmd == 'reproduce' ? obj.tmout + 2500 : obj.tmout;
|
|
150
143
|
await page.waitForTimeout(delay);
|
|
151
144
|
|
|
145
|
+
await Promise.all(downloads);
|
|
146
|
+
|
|
152
147
|
await browser.close();
|
|
153
148
|
spinner.stop();
|
|
154
149
|
|
package/index.js
CHANGED
package/package.json
CHANGED
package/src/canvasXpress.css
CHANGED
|
@@ -2780,6 +2780,8 @@ span.CanvasXpressMousePosition {
|
|
|
2780
2780
|
.cX-Workflow-Slider-Area {
|
|
2781
2781
|
flex-grow: 1;
|
|
2782
2782
|
position: relative;
|
|
2783
|
+
margin-right: 15px;
|
|
2784
|
+
margin-left: 5px;
|
|
2783
2785
|
}
|
|
2784
2786
|
|
|
2785
2787
|
.cX-Workflow-Slider-Track {
|
|
@@ -2815,7 +2817,7 @@ span.CanvasXpressMousePosition {
|
|
|
2815
2817
|
border: 1px var(--cx-border-style) var(--cx-workflow-timeline-border-color);
|
|
2816
2818
|
border-radius: var(--cx-border-radius);
|
|
2817
2819
|
margin-top: 10px;
|
|
2818
|
-
padding-top: 10px;
|
|
2820
|
+
/* padding-top: 10px; */
|
|
2819
2821
|
max-height: 200px;
|
|
2820
2822
|
overflow-y: auto;
|
|
2821
2823
|
}
|