Skip to content

Commit 1e1f03f

Browse files
committed
Rework stylesheet and add gulp task for generate icons.ts and update yaml file
1 parent 8d4bab3 commit 1e1f03f

22 files changed

Lines changed: 545 additions & 287 deletions

.github/workflows/publish.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ jobs:
7171
name: ${{ matrix.id }}
7272
path: |
7373
src-tauri/target/**/release/bundle/dmg/*.dmg
74-
src-tauri/target/**/release/bundle/macos/*.app
7574
if-no-files-found: warn
7675

7776
- name: Upload Linux bundles
@@ -113,6 +112,27 @@ jobs:
113112
- name: Show collected files
114113
run: find release-assets -type f | sort
115114

115+
- name: Sort files into OS folders
116+
run: |
117+
mkdir -p \
118+
release-assets/by-os/macos \
119+
release-assets/by-os/linux \
120+
release-assets/by-os/windows
121+
122+
find release-assets/macos-aarch64 -type f \( -name '*.dmg' \) -exec cp {} release-assets/by-os/macos/ \;
123+
find release-assets/linux -type f \( -name '*.AppImage' -o -name '*.deb' -o -name '*.rpm' \) -exec cp {} release-assets/by-os/linux/ \;
124+
find release-assets/windows -type f \( -name '*.msi' -o -name '*.exe' \) -exec cp {} release-assets/by-os/windows/ \;
125+
126+
- name: Show sorted files
127+
run: find release-assets/by-os -type f | sort
128+
129+
- name: Create per-OS archives
130+
run: |
131+
cd release-assets/by-os
132+
zip -r ../spcd3-macos.zip macos
133+
zip -r ../spcd3-linux.zip linux
134+
zip -r ../spcd3-windows.zip windows
135+
116136
- name: Create or update draft release
117137
env:
118138
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -139,4 +159,4 @@ jobs:
139159
run: |
140160
VERSION=$(node -p "require('./package.json').version")
141161
TAG="app-v$VERSION"
142-
find release-assets -type f -print0 | xargs -0 gh release upload "$TAG" --clobber
162+
find release-assets -maxdepth 1 -type f -name 'spcd3-*.zip' -print0 | xargs -0 gh release upload "$TAG" --clobber

README.md

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Steerable Parallel Coordinates in D3 (SPCD3)
32

43
SPCD3 is an open-source JavaScript library which implements a
@@ -17,6 +16,7 @@ deployment can be found at
1716
## Dependencies
1817

1918
The SPCD3 library uses the following D3v7 modules:
19+
2020
- d3-dsv
2121
- d3-selection
2222
- d3-drag
@@ -26,25 +26,23 @@ The SPCD3 library uses the following D3v7 modules:
2626
- d3-transition
2727

2828
In addition to D3, the following JavaScript libraries are used:
29-
- [Mini SVG data: URI](https://github.com/tigt/mini-svg-data-uri#readme):
30-
To convert SVGs into data URIs.
31-
- [xml-formatter](https://github.com/chrisbottin/xml-formatter#readme):
32-
To prettify the SVG file of the parallel coordinate plot for download.
29+
30+
- [Mini SVG data: URI](https://github.com/tigt/mini-svg-data-uri#readme):
31+
To convert SVGs into data URIs.
32+
- [xml-formatter](https://github.com/chrisbottin/xml-formatter#readme):
33+
To prettify the SVG file of the parallel coordinate plot for download.
3334

3435
The task runner [Gulp](https://gulpjs.com/) is used to automate
3536
repeatable tasks and [Rollup](https://rollupjs.org/)
3637
is used to bundle and build the library.
3738

38-
39-
4039
## Getting Started
4140

4241
### Prerequisites
4342

4443
Open terminal and execute the following command to install all the dependencies:
4544

46-
47-
```
45+
```
4846
yarn
4947
```
5048

@@ -57,6 +55,7 @@ defines four public tasks:
5755

5856
`clean` removes the existing `dist/` directory in
5957
order to enable a clean rebuild of the project:
58+
6059
```
6160
npx gulp clean
6261
```
@@ -66,6 +65,7 @@ npx gulp clean
6665
`cleanAll` restores the project folder to its virgin state,
6766
by deleting the existing `dist/`, `package/` and `node_modules/` directories
6867
and the `yarn.lock` file:
68+
6969
```
7070
npx gulp cleanAll
7171
```
@@ -75,16 +75,19 @@ npx gulp cleanAll
7575
`build` creates a new build of the library in three formats (CJS, ESM, IIFE)
7676
and stores the generated library packages into the `dist/library/` folder.
7777
Additionally, the example folder is copied to `dist/example/`:
78+
7879
```
7980
npx gulp build
8081
```
82+
8183
To run the example, a live web server must be started in the
8284
folder `dist/example/`.
8385

8486
<br/>
8587

8688
`dev` executes the build task, and then additionally executes a private task
8789
called watcher, which starts a live web server in the `dist/example/` folder:
90+
8891
```
8992
npx gulp dev
9093
```
@@ -94,18 +97,16 @@ npx gulp dev
9497
Each of the public Gulp tasks can also be invoked by running the
9598
equivalent yarn script defined in `package.json`.
9699

97-
98-
99100
### Build a native desktop app
100101

101102
Prerequisites: To build a native desktop app, Rust, Cargo and Tauri 2.0 needs to be installed.
102103

103104
`tauri` builds a native desktop app with Tauri 2.0 and copies the executable to `package/`:
105+
104106
```
105107
npx gulp tauri
106108
```
107109

108-
109110
## Usage
110111

111112
As mentioned in the beginning, an example was implemented to show how
@@ -119,8 +120,10 @@ An example application was built to illustrate the use of the SPCD3
119120
library. It is described in the [Example Application
120121
Guide](./README-EXAMPLE.md).
121122

122-
123-
123+
Note: SPCD3 includes its own [`reset.css`](./src/lib/reset.css), which is
124+
imported by the library together with [`stylesheet.css`](./src/lib/stylesheet.css).
125+
This means the library also applies baseline reset styles to standard HTML
126+
elements.
124127

125128
## Data-Handling
126129

@@ -131,16 +134,11 @@ numerical. Three example datasets can be found in folder
131134
[data](./src/example/data/). Other datasets should have the same
132135
structure.
133136

134-
135-
136137
## License
137138

138139
SPCD3 is distributed under the MIT License. See [LICENSE](LICENSE) for
139140
more information.
140141

141-
142-
143-
144142
## Contributors
145143

146144
- Keith Andrews [kandrews@iicm.edu](mailto:kandrews@iicm.edu?subject=Rslidy)
@@ -151,5 +149,3 @@ more information.
151149

152150
- Philipp Drescher, Jeremias Kleinschuster, Sebastian Schreiner, Burim Vrella
153151
InfoVis SS 2023 G1
154-
155-

gulp-tasks/generate-icons.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
4+
const ICON_SVG_DIR = path.resolve(__dirname, "../src/lib/icons/svg");
5+
const OUTPUT_FILE = path.resolve(__dirname, "../src/lib/icons/icons.ts");
6+
7+
const ICON_MANIFEST = [
8+
["getArrowBottomCursor", "arrow-bottom-cursor.svg"],
9+
["getArrowBottom", "arrow-bottom.svg"],
10+
["getArrowBottomActive", "arrow-bottom-active.svg"],
11+
["getArrowDown", "arrow-down.svg"],
12+
["getArrowDownCursor", "arrow-down-cursor.svg"],
13+
["getArrowLeftAndRight", "arrow-left-and-right.svg"],
14+
["getArrowLeft", "arrow-left.svg"],
15+
["getArrowRight", "arrow-right.svg"],
16+
["getArrowTopAndBottom", "arrow-top-and-bottom.svg"],
17+
["getArrowTopCursor", "arrow-top-cursor.svg"],
18+
["getArrowTop", "arrow-top.svg"],
19+
["getArrowTopActive", "arrow-top-active.svg"],
20+
["getArrowUp", "arrow-up.svg"],
21+
["getArrowUpCursor", "arrow-up-cursor.svg"],
22+
["getRefreshIcon", "refresh.svg"],
23+
["getTableIcon", "table.svg"],
24+
["getExpandToolbarIcon", "toolbar_expand.svg"],
25+
["getCollapseToolbarIcon", "toolbar_collapse.svg"],
26+
["getResetIcon", "reset.svg"],
27+
["getDownloadButton", "download.svg"],
28+
];
29+
30+
function readSvg(filename) {
31+
const filePath = path.join(ICON_SVG_DIR, filename);
32+
const svg = fs.readFileSync(filePath, "utf8").replace(/\r\n/g, "\n").trim();
33+
34+
if (filename === "toolbar_expand.svg" || filename === "toolbar_collapse.svg") {
35+
return svg.replace('viewBox="0 0 6 6"', 'viewBox="0 -0.5 6 6"');
36+
}
37+
38+
return svg;
39+
}
40+
41+
function createIconModule() {
42+
const lines = [
43+
"// This file is auto-generated by `gulp icons`.",
44+
"// Edit the SVG files in `src/lib/icons/svg` instead.",
45+
"",
46+
];
47+
48+
ICON_MANIFEST.forEach(([exportName, filename]) => {
49+
lines.push(`export function ${exportName}(): string {`);
50+
lines.push(` return ${JSON.stringify(readSvg(filename))};`);
51+
lines.push("}");
52+
lines.push("");
53+
});
54+
55+
return `${lines.join("\n").trimEnd()}\n`;
56+
}
57+
58+
function generateIcons(done) {
59+
fs.writeFileSync(OUTPUT_FILE, createIconModule());
60+
done();
61+
}
62+
63+
module.exports = { generateIcons };

gulpfile.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const del = require("del");
33
const { bundle } = require("./gulp-tasks/bundle");
44
const { watcher } = require("./gulp-tasks/watch");
55
const { tauriBuild } = require("./gulp-tasks/tauri");
6+
const { generateIcons } = require("./gulp-tasks/generate-icons");
67
const path = require("path");
78
const fs = require("fs");
89
const ts = require("gulp-typescript");
@@ -45,6 +46,7 @@ function copyLibFileToExample() {
4546
}
4647

4748
exports.clean = cleanDistFolder;
49+
exports.icons = generateIcons;
4850

4951
exports.cleanAll = parallel(
5052
cleanDistFolder,
@@ -55,6 +57,7 @@ exports.cleanAll = parallel(
5557

5658
exports.build = series(
5759
cleanDistFolder,
60+
generateIcons,
5861
buildExampleTS,
5962
copyExampleFolder,
6063
bundle,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"clean": "npx gulp clean",
1313
"build": "npx gulp build",
1414
"dev": "npx gulp dev",
15+
"icons": "npx gulp icons",
1516
"tauri": "npx gulp tauri"
1617
},
1718
"repository": "git+https://github.com/tugraz-isds/spcd3",

src/example/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222

2323
<body>
2424
<header>
25-
<h1>Steerable Parallel Coordinates</h1>
26-
<div id="repolink">
27-
An Example of <a href="https://github.com/tugraz-isds/spcd3">SPCD3</a>
25+
<div class="page-header-row">
26+
<h1>Steerable Parallel Coordinates</h1>
27+
<div id="repolink">
28+
An Example of <a href="https://github.com/tugraz-isds/spcd3">SPCD3</a>
29+
</div>
2830
</div>
2931
</header>
3032

@@ -66,8 +68,7 @@ <h1>Steerable Parallel Coordinates</h1>
6668
</button>
6769
</div>
6870

69-
<div id="parallelcoords"></div>
70-
<div id="border"></div>
71+
<div id="spcd3-parallelcoords"></div>
7172

7273
<div id="bottom-controls">
7374
<div id="hideDimensionContainer" class="item1"></div>

src/example/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ function generateDropdownForSelectRecords() {
12451245
}
12461246

12471247
function clearPlot() {
1248-
const parentElement = elementById<HTMLElement>("parallelcoords");
1248+
const parentElement = elementById<HTMLElement>("spcd3-parallelcoords");
12491249
const invertContainer = elementById<HTMLElement>("invDimensionContainer");
12501250
const hideContainer = elementById<HTMLElement>("hideDimensionContainer");
12511251
const moveContainer = elementById<HTMLElement>("moDimensionContainer");

0 commit comments

Comments
 (0)