@flourish/legend
Advanced tools
Comparing version 6.5.0 to 6.5.1
{ | ||
"plugins": [ | ||
"@flourish/flourish" | ||
], | ||
"extends": "plugin:@flourish/flourish/flourish", | ||
"env": { "browser": true } | ||
} | ||
"extends": "../../.eslintrc" | ||
} |
## Migration Guide | ||
### Migrating to v6.5.1 | ||
You can now make use of `layout.prepareScreenshotSVG()` and `layout.clearScreenshotSVG()` in the template's `screenshot()` function. | ||
### Migrating to v6.0.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "@flourish/legend", | ||
"version": "6.5.0", | ||
"version": "6.5.1", | ||
"description": "Flourish module for making legend", | ||
@@ -10,5 +10,7 @@ "main": "legend.js", | ||
"build": "rollup -c", | ||
"watch": "rollup -cw", | ||
"prepare": "npm run build && npm run minify", | ||
"minify": "terser -m -o legend.min.js legend.js", | ||
"precommit": "lint-staged" | ||
"cypress": "cypress open", | ||
"test": "flcypress run" | ||
}, | ||
@@ -19,2 +21,3 @@ "author": "Kiln Enterprises Ltd", | ||
"@flourish/js2css": "^1.0.0", | ||
"@flourish/pocket-knife": "workspace:^1.2.1", | ||
"d3-array": "^1.0.0", | ||
@@ -25,8 +28,6 @@ "d3-scale": "^2.2.2", | ||
"devDependencies": { | ||
"@flourish/cypress": "^2.12.1", | ||
"@flourish/cypress": "^8.0.0", | ||
"@flourish/eslint-plugin-flourish": "^0.7.2", | ||
"cypress": "^7.2.0", | ||
"eslint": "^5.16.0", | ||
"husky": "^1.3.1", | ||
"lint-staged": "^8.1.3", | ||
"cypress": "^12.6.0", | ||
"eslint": "^8.35.0", | ||
"rollup": "^1.1.2", | ||
@@ -39,11 +40,3 @@ "rollup-plugin-node-resolve": "^4.0.0", | ||
"url": "git://github.com/kiln/flourish-legend.git" | ||
}, | ||
"lint-staged": { | ||
"*.js": "npm run lint --" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
} | ||
} |
@@ -0,1 +1,4 @@ | ||
# 6.5.1 | ||
* Add `prepareScreenshotSVG` and `clearScreenshotSVG` methods | ||
# 6.5.0 | ||
@@ -2,0 +5,0 @@ * Add various fill and stroke style options to discrete legend icons |
@@ -25,2 +25,2 @@ import nodeResolve from "rollup-plugin-node-resolve"; | ||
} | ||
}; | ||
}; |
@@ -0,1 +1,2 @@ | ||
import { createScreenshotSVG } from "@flourish/pocket-knife"; | ||
import { select } from "d3-selection"; | ||
@@ -358,2 +359,17 @@ import { scaleLinear } from "d3-scale"; | ||
ContinuousColorLegend.prototype.prepareScreenshotSVG = function() { | ||
if (!this._state.show_legend || !this._visible || !this._legend_domain.length) return; | ||
createScreenshotSVG("#fl-layout-wrapper", this._id + "-svg-screenshot-container") | ||
.addTextElements(".fl-legend-title") | ||
.addGradient(".color-range", this._colorFunction, this._legend_domain) | ||
.addTextElements(".min.label") | ||
.addTextElements(".max.label"); | ||
}; | ||
ContinuousColorLegend.prototype.clearScreenshotSVG = function() { | ||
const container = document.getElementById(this._id + "-svg-screenshot-container"); | ||
if (container) container.remove(); | ||
}; | ||
export default ContinuousColorLegend; |
@@ -0,1 +1,2 @@ | ||
import { createScreenshotSVG } from "@flourish/pocket-knife"; | ||
import { select } from "d3-selection"; | ||
@@ -247,2 +248,17 @@ import { appendTo, format, getContainer, visible, autoTitle, _updateTitle, small_gap } from "../common"; | ||
ContinuousSizeLegend.prototype.prepareScreenshotSVG = function() { | ||
if (!this._state.show_legend || !this._visible) return; | ||
createScreenshotSVG("#fl-layout-wrapper", this._id + "-svg-screenshot-container") | ||
.addTextElements(".min.label") | ||
.addCircleElements(".min.symbol") | ||
.addCircleElements(".max.symbol") | ||
.addTextElements(".max.label"); | ||
}; | ||
ContinuousSizeLegend.prototype.clearScreenshotSVG = function() { | ||
const container = document.getElementById(this._id + "-svg-screenshot-container"); | ||
if (container) container.remove(); | ||
}; | ||
export default ContinuousSizeLegend; |
@@ -0,1 +1,2 @@ | ||
import { createScreenshotSVG } from "@flourish/pocket-knife"; | ||
import { select, event as d3_event } from "d3-selection"; | ||
@@ -291,2 +292,16 @@ import { appendTo, format, getContainer, visible, autoTitle, _updateTitle, small_gap } from "../common"; | ||
DiscreteColorLegend.prototype.prepareScreenshotSVG = function() { | ||
if (!this._state.show_legend || !this._visible || !this._legend_items.length) return; | ||
createScreenshotSVG("#fl-layout-wrapper", this._id + "-svg-screenshot-container") | ||
.addTextElements(".fl-legend-title") | ||
.addCircleElements(".fl-legend-swatch") | ||
.addTextElements(".fl-legend-label"); | ||
}; | ||
DiscreteColorLegend.prototype.clearScreenshotSVG = function() { | ||
const container = document.getElementById(this._id + "-svg-screenshot-container"); | ||
if (container) container.remove(); | ||
}; | ||
export default DiscreteColorLegend; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
215443
7
5320
0
5