Skip to content

Commit

Permalink
fix(core): export patterns as strings of svgs (#227)
Browse files Browse the repository at this point in the history
* fix(core): export patterns as strings of svgs

* remove console log

* add publishConfig to vue
  • Loading branch information
cal-smith authored Mar 26, 2019
1 parent 93e0ff7 commit 14391ae
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 40 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ node_js:
before_install: .travis/before_install.sh
install:
- npm install
after_success: "npm run build-all"
script: lerna run lint
sudo: false
deploy:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate",
"build-all": "bash scripts/build-packages-and-demos.sh",
"build-all-demos": "bash scripts/build-demos.sh"
"build-all-demos": "bash scripts/build-demos.sh",
"deploy": "bash scripts/deploy.sh"
},
"husky": {
"hooks": {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"author": "IBM",
"license": "Apache-2.0",
"dependencies": {
"resize-observer-polyfill": "1.5.0"
"resize-observer-polyfill": "1.5.0",
"d3": "4.13.0"
},
"peerDependencies": {
"d3": ">=4.11.0 <=5.7.0"
Expand Down
22 changes: 11 additions & 11 deletions packages/core/src/assets/patterns/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const PATTERN_1 = require("./pattern-1.svg");
const PATTERN_2 = require("./pattern-2.svg");
const PATTERN_3 = require("./pattern-3.svg");
const PATTERN_4 = require("./pattern-4.svg");
const PATTERN_5 = require("./pattern-5.svg");
const PATTERN_6 = require("./pattern-6.svg");
const PATTERN_7 = require("./pattern-7.svg");
const PATTERN_8 = require("./pattern-8.svg");
const PATTERN_9 = require("./pattern-9.svg");
const PATTERN_10 = require("./pattern-10.svg");
const PATTERN_11 = require("./pattern-11.svg");
const PATTERN_1 = require("./pattern-1.ts");
const PATTERN_2 = require("./pattern-2.ts");
const PATTERN_3 = require("./pattern-3.ts");
const PATTERN_4 = require("./pattern-4.ts");
const PATTERN_5 = require("./pattern-5.ts");
const PATTERN_6 = require("./pattern-6.ts");
const PATTERN_7 = require("./pattern-7.ts");
const PATTERN_8 = require("./pattern-8.ts");
const PATTERN_9 = require("./pattern-9.ts");
const PATTERN_10 = require("./pattern-10.ts");
const PATTERN_11 = require("./pattern-11.ts");

export default [
PATTERN_1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -7,7 +7,8 @@
.st1{fill:#231F20;}
.st2{fill:url(#lines_-_right_to_left);}
</style>
<pattern width="50" height="50" patternUnits="userSpaceOnUse" id="lines_-_right_to_left" viewBox="97.78 -148.535 50 50" style="overflow:visible;">
<pattern width="50" height="50"
patternUnits="userSpaceOnUse" id="lines_-_right_to_left" viewBox="97.78 -148.535 50 50" style="overflow:visible;">
<g id="XMLID_16_">
<polygon id="XMLID_26_" class="st0" points="97.78,-148.535 147.78,-148.535 147.78,-98.535 97.78,-98.535 "/>
<polygon id="XMLID_25_" class="st1" points="110.606,0 100,-10.607 214.117,-124.724 224.723,-114.117 "/>
Expand All @@ -22,4 +23,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -20,4 +20,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -18,4 +18,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -20,4 +20,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -14,4 +14,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -20,4 +20,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand Down Expand Up @@ -26,4 +26,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st1" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -20,4 +20,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -7,7 +7,8 @@
.st1{fill:#231F20;}
.st2{fill:url(#lines_-_left_to_right);}
</style>
<pattern width="50" height="50" patternUnits="userSpaceOnUse" id="lines_-_left_to_right" viewBox="101.277 -147.008 50 50" style="overflow:visible;">
<pattern width="50" height="50"
patternUnits="userSpaceOnUse" id="lines_-_left_to_right" viewBox="101.277 -147.008 50 50" style="overflow:visible;">
<g id="XMLID_8_">
<polygon id="XMLID_32_" class="st0" points="101.277,-147.008 151.277,-147.008 151.277,-97.008 101.277,-97.008 "/>
<polygon id="XMLID_31_" class="st1" points="264.058,0 150,-114.058 160.606,-124.665 274.665,-10.607 "/>
Expand All @@ -25,4 +26,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand All @@ -7,7 +7,8 @@
.st1{fill:#231F20;}
.st2{fill:url(#hex_pattern);}
</style>
<pattern width="100" height="100" patternUnits="userSpaceOnUse" id="hex_pattern" viewBox="20 -117.32 100 100" style="overflow:visible;">
<pattern width="100" height="100"
patternUnits="userSpaceOnUse" id="hex_pattern" viewBox="20 -117.32 100 100" style="overflow:visible;">
<g id="XMLID_10_">
<polygon id="XMLID_23_" class="st0" points="20,-117.32 120,-117.32 120,-17.32 20,-17.32 "/>
<polygon id="XMLID_21_" class="st1" points="110,-25 100,-42.32 110,-59.641 130,-59.641 140,-42.32 130,-25 "/>
Expand All @@ -20,4 +21,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
export default `<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
Expand Down Expand Up @@ -41,4 +41,4 @@
</g>
</pattern>
<rect id="XMLID_1_" class="st2" width="100" height="100"/>
</svg>
</svg>`;
2 changes: 1 addition & 1 deletion packages/core/src/services/patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class PatternsService {
const id = ++this.idAccum;

if (!datasetPattern || legendType === Configuration.legend.basedOn.LABELS) {
datasetPattern = PATTERN_SVGS[this.patternAccum++];
datasetPattern = PATTERN_SVGS[this.patternAccum++].default;
}

// Create SVG container div
Expand Down
3 changes: 3 additions & 0 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"prettier": "1.16.4",
"vue-template-compiler": "2.5.21"
},
"publishConfig": {
"access": "public"
},
"lint-staged": {
"*.{scss,css,js,md,vue}": [
"yarn format",
Expand Down

0 comments on commit 14391ae

Please sign in to comment.