Skip to content

Commit

Permalink
Map types to html types (#754)
Browse files Browse the repository at this point in the history
* fix insert step button

* add dist

* add new function

* remove console logs

* refactor

* Setup UI testing (#720)

* default sequencer ui test

* default step ui test suite

* intermediate step ui test

* preview ui test suite

* url methods test suite

* add set url params method test suite

* argument call tests

* test directory refactor

* travis fix

* CLI code refactor (#665)

* CLI refactor

* es6 rollback

* Travis fix

* syntax fix

* clustered require statements

* travis debug

* travis debug

* Added line that selects the "More modules..." after adding a step. (#713)

* Added line making module selection correct after adding a step

* Added line with appropriate module selection

* Add: Module tests (#748)

* WIP

* module testing harness

* adjustments

* Update package-lock.json

* Bump jsqr from 1.1.1 to 1.2.0 (#749)

Bumps [jsqr](https://github.com/cozmo/jsQR) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/cozmo/jsQR/releases)
- [Commits](https://github.com/cozmo/jsQR/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* refactor without spread syntax
  • Loading branch information
harshkhandeparkar authored and jywarren committed Mar 4, 2019
1 parent ac57b32 commit 1e08d7c
Show file tree
Hide file tree
Showing 22 changed files with 168 additions and 97 deletions.
45 changes: 38 additions & 7 deletions dist/image-sequencer-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ window.onload = function() {
insertPreview.updatePreviews("images/tulips.png",'addStep');
}
};
},{"./lib/cache.js":2,"./lib/defaultHtmlSequencerUi.js":3,"./lib/defaultHtmlStepUi.js":4,"./lib/insertPreview.js":5,"./lib/intermediateHtmlStepUi.js":6,"./lib/urlHash.js":7}],2:[function(require,module,exports){
},{"./lib/cache.js":2,"./lib/defaultHtmlSequencerUi.js":3,"./lib/defaultHtmlStepUi.js":4,"./lib/insertPreview.js":5,"./lib/intermediateHtmlStepUi.js":6,"./lib/urlHash.js":8}],2:[function(require,module,exports){
var setupCache = function() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js', { scope: '/examples/' })
Expand Down Expand Up @@ -342,7 +342,7 @@ function DefaultHtmlSequencerUi(_sequencer, options) {
module.exports = DefaultHtmlSequencerUi;


},{"./urlHash.js":7}],4:[function(require,module,exports){
},{"./urlHash.js":8}],4:[function(require,module,exports){
// Set the UI in sequencer. This Will generate HTML based on
// Image Sequencer events :
// onSetup : Called every time a step is added
Expand All @@ -356,6 +356,7 @@ module.exports = DefaultHtmlSequencerUi;
var intermediateHtmlStepUi = require('./intermediateHtmlStepUi.js');
var urlHash = require('./urlHash.js');
var _ = require('lodash');
var mapHtmlTypes = require('./mapHtmltypes');

function DefaultHtmlStepUi(_sequencer, options) {

Expand Down Expand Up @@ -416,7 +417,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
for (var paramName in merged) {
var isInput = inputs.hasOwnProperty(paramName);
var html = "";
var inputDesc = isInput ? inputs[paramName] : {};
var inputDesc = isInput ? mapHtmlTypes(inputs[paramName]) : {};
if (!isInput) {
html += '<span class="output"></span>';
} else if (inputDesc.type.toLowerCase() == "select") {
Expand Down Expand Up @@ -444,7 +445,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
'"max="' +
inputDesc.max +
'"step="' +
inputDesc.step + '">' + '<span>' + paramVal + '</span>';
(inputDesc.step ? inputDesc.step : 1)+ '">' + '<span>' + paramVal + '</span>';

}
else html += '">';
Expand Down Expand Up @@ -682,7 +683,7 @@ if(typeof window === "undefined"){
module.exports = DefaultHtmlStepUi;


},{"./intermediateHtmlStepUi.js":6,"./urlHash.js":7,"lodash":8}],5:[function(require,module,exports){
},{"./intermediateHtmlStepUi.js":6,"./mapHtmltypes":7,"./urlHash.js":8,"lodash":9}],5:[function(require,module,exports){
function generatePreview(previewStepName, customValues, path, selector) {

var previewSequencer = ImageSequencer();
Expand Down Expand Up @@ -874,7 +875,37 @@ function IntermediateHtmlStepUi(_sequencer, step, options) {
module.exports = IntermediateHtmlStepUi;


},{"./insertPreview.js":5,"./urlHash.js":7}],7:[function(require,module,exports){
},{"./insertPreview.js":5,"./urlHash.js":8}],7:[function(require,module,exports){
function mapHtmlTypes(inputInfo){
var htmlType;
switch(inputInfo.type.toLowerCase()){
case 'integer':
htmlType = inputInfo.min != undefined ? 'range' : 'number';
break;
case 'string':
htmlType = 'text';
break;
case 'select':
htmlType = 'select';
break;
case 'percentage':
htmlType = 'number';
break;
case 'float':
htmlType = inputInfo.min != undefined ? 'range' : 'text';
break;
default:
htmlType = 'text';
break;
}
var response = inputInfo;
response.type = htmlType;
return response;
}

module.exports = mapHtmlTypes;

},{}],8:[function(require,module,exports){
function getUrlHashParameter(param) {

var params = getUrlHashParameters();
Expand Down Expand Up @@ -925,7 +956,7 @@ module.exports = {
setUrlHashParameters: setUrlHashParameters
}

},{}],8:[function(require,module,exports){
},{}],9:[function(require,module,exports){
(function (global){
/**
* @license
Expand Down
2 changes: 1 addition & 1 deletion dist/image-sequencer-ui.min.js

Large diffs are not rendered by default.

91 changes: 48 additions & 43 deletions dist/image-sequencer.js
Original file line number Diff line number Diff line change
Expand Up @@ -69026,7 +69026,6 @@ module.exports = {
'tint': require('./modules/Tint'),
'white-balance': require('./modules/WhiteBalance')
}

},{"./modules/AddQR":193,"./modules/Average":196,"./modules/Blend":199,"./modules/Blur":203,"./modules/Brightness":206,"./modules/Channel":209,"./modules/Colorbar":212,"./modules/Colormap":216,"./modules/Contrast":220,"./modules/Convolution":224,"./modules/Crop":229,"./modules/DecodeQr":232,"./modules/Dither":236,"./modules/DrawRectangle":240,"./modules/Dynamic":243,"./modules/EdgeDetect":247,"./modules/FisheyeGl":250,"./modules/FlipImage":254,"./modules/GammaCorrection":257,"./modules/Gradient":260,"./modules/Histogram":263,"./modules/ImportImage":267,"./modules/Ndvi":271,"./modules/NdviColormap":274,"./modules/Overlay":277,"./modules/PaintBucket":281,"./modules/Resize":284,"./modules/Rotate":287,"./modules/Saturation":290,"./modules/Threshold":294,"./modules/Tint":297,"./modules/WhiteBalance":300,"image-sequencer-invert":62}],187:[function(require,module,exports){
// Uses a given image as input and replaces it with the output.
// Works only in the browser.
Expand Down Expand Up @@ -69505,7 +69504,7 @@ module.exports={
"default": -2
},
"blend": {
"type": "input",
"type": "string",
"desc": "Function to use to blend the two images.",
"default": "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"
}
Expand Down Expand Up @@ -69652,12 +69651,12 @@ module.exports={
"description": "Applies a Gaussian blur given by the intensity value",
"inputs": {
"blur": {
"type": "range",
"type": "float",
"desc": "Amount of gaussian blur(Less blur gives more detail, typically 0-5)",
"default": "2",
"min": "0",
"max": "5",
"step": "0.25"
"default": 2,
"min": 0,
"max": 5,
"step": 0.25
}
},
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"
Expand Down Expand Up @@ -69730,12 +69729,11 @@ module.exports={
"description": "Change the brightness of the image by given percent value",
"inputs": {
"brightness": {
"type": "range",
"type": "integer",
"desc": "% brightness for the new image",
"default": "175",
"min": "0",
"max": "200",
"step": "1"
"max": "200"
}
},
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"
Expand Down Expand Up @@ -69855,7 +69853,7 @@ module.exports={
"default": 0
},
"h": {
"type": "iinteger",
"type": "integer",
"desc": "height of the colorbar",
"default": 10
}
Expand Down Expand Up @@ -70224,12 +70222,11 @@ module.exports={
"description": "Change the contrast of the image by given value",
"inputs": {
"contrast": {
"type": "range",
"type": "integer",
"desc": "contrast for the new image, typically -100 to 100",
"default": "70",
"min": "-100",
"max": "100",
"step": "1"
"default": 70,
"min": -100,
"max": 100
}
},
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"
Expand Down Expand Up @@ -70359,14 +70356,14 @@ module.exports={
"description": "Image Convolution using a given 3x3 kernel matrix <a href='https://en.wikipedia.org/wiki/Kernel_(image_processing)'>Read more</a>",
"inputs": {
"constantFactor":{
"type": "Float",
"type": "float",
"desc": "a constant factor, multiplies all the kernel values by that factor",
"default": 0.1111,
"placeholder": 0.1111
},

"kernelValues": {
"type": "String",
"type": "string",
"desc": "nine space separated numbers representing the kernel values in left to right and top to bottom format.",
"default": "1 1 1 1 1 1 1 1 1",
"placeholder": "1 1 1 1 1 1 1 1 1"
Expand Down Expand Up @@ -70647,7 +70644,7 @@ module.exports={
"default": "(50%)"
},
"backgroundColor": {
"type": "String",
"type": "string",
"desc": "Background Color (Four space separated RGBA values)",
"default": "255 255 255 255",
"placeholder": "255 255 255 255"
Expand Down Expand Up @@ -70721,7 +70718,7 @@ module.exports={
},
"outputs": {
"qrval": {
"type": "text"
"type": "string"
}
},
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"
Expand Down Expand Up @@ -70947,13 +70944,13 @@ module.exports={
"description": "It draws a rectangle on the image",
"inputs": {
"startingX":{
"type": "Number",
"type": "integer",
"desc": "starting x position of the rectangle",
"default": 0
},

"startingY": {
"type": "Number",
"type": "integer",
"desc": "starting y position of the rectangle",
"default": 0
},
Expand All @@ -70977,7 +70974,7 @@ module.exports={
},

"color":{
"type": "String",
"type": "string",
"desc": "RGBA values separated by a space",
"default": "0 0 0 255"
}
Expand Down Expand Up @@ -71093,22 +71090,22 @@ module.exports={
"description": "A module which accepts JavaScript math expressions to produce each color channel based on the original image's color. See <a href='https://publiclab.org/wiki/infragram-sandbox'>Infragrammar</a>.",
"inputs": {
"red": {
"type": "input",
"type": "string",
"desc": "Expression to return for red channel with R, G, B, and A inputs",
"default": "r"
},
"green": {
"type": "input",
"type": "string",
"desc": "Expression to return for green channel with R, G, B, and A inputs",
"default": "g"
},
"blue": {
"type": "input",
"type": "string",
"desc": "Expression to return for blue channel with R, G, B, and A inputs",
"default": "b"
},
"monochrome (fallback)": {
"type": "input",
"type": "string",
"desc": "Expression to return with R, G, B, and A inputs; fallback for other channels if none provided",
"default": "r + g + b"
}
Expand Down Expand Up @@ -71360,22 +71357,28 @@ module.exports={
"description": "This module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge.<a href='https://en.wikipedia.org/wiki/Canny_edge_detector'> Read more. </a>",
"inputs": {
"blur": {
"type": "range",
"type": "float",
"desc": "Amount of gaussian blur(Less blur gives more detail, typically 0-5)",
"default": "2",
"min": "0",
"max": "5",
"step": "0.25"
"default": 2,
"min": 0,
"max": 5,
"step": 0.25
},
"highThresholdRatio":{
"type": "float",
"desc": "The high threshold ratio for the image",
"default": 0.2
"default": 0.2,
"min": 0,
"max": 1,
"step": 0.25
},
"lowThresholdRatio": {
"type": "float",
"desc": "The low threshold value for the image",
"default": 0.15
"default": 0.15,
"min": 0,
"max": 1,
"step": 0.05
}
},
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"
Expand Down Expand Up @@ -71684,7 +71687,9 @@ module.exports={
"adjustment": {
"type": "float",
"desc": "gamma correction (inverse of actual gamma factor) for the new image",
"default": 0.2
"default": 0.2,
"min": 2,
"max": 1
}
},
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"
Expand Down Expand Up @@ -72573,7 +72578,7 @@ module.exports={
"description": "Rotates image by specified degrees",
"inputs": {
"rotate": {
"type": "range",
"type": "integer",
"desc": "Angular value for rotation in degrees",
"default": "90",
"min": "0",
Expand Down Expand Up @@ -72653,12 +72658,12 @@ module.exports={
"description": "Change the saturation of the image by given value, from 0-1, with 1 being 100% saturated.",
"inputs": {
"saturation": {
"type": "range",
"type": "float",
"desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being highly saturated",
"default": "0.5",
"min": "0",
"max": "2",
"step": "0.1"
"default": 0.5,
"min": 0,
"max": 2,
"step": 0.1
}
},
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"
Expand Down Expand Up @@ -72968,9 +72973,9 @@ module.exports={
"description": "Change the colour balance of the image by adjusting the colour temperature.",
"inputs": {
"temperature": {
"type": "string",
"type": "integer",
"desc": "Temperature between 0 - 40,000 Kelvin",
"default": "6000"
"default": 6000
}
},
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"
Expand Down
2 changes: 1 addition & 1 deletion dist/image-sequencer.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions examples/lib/defaultHtmlStepUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
var intermediateHtmlStepUi = require('./intermediateHtmlStepUi.js');
var urlHash = require('./urlHash.js');
var _ = require('lodash');
var mapHtmlTypes = require('./mapHtmltypes');

function DefaultHtmlStepUi(_sequencer, options) {

Expand Down Expand Up @@ -71,7 +72,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
for (var paramName in merged) {
var isInput = inputs.hasOwnProperty(paramName);
var html = "";
var inputDesc = isInput ? inputs[paramName] : {};
var inputDesc = isInput ? mapHtmlTypes(inputs[paramName]) : {};
if (!isInput) {
html += '<span class="output"></span>';
} else if (inputDesc.type.toLowerCase() == "select") {
Expand Down Expand Up @@ -99,7 +100,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
'"max="' +
inputDesc.max +
'"step="' +
inputDesc.step + '">' + '<span>' + paramVal + '</span>';
(inputDesc.step ? inputDesc.step : 1)+ '">' + '<span>' + paramVal + '</span>';

}
else html += '">';
Expand Down
Loading

0 comments on commit 1e08d7c

Please sign in to comment.