digirati-annotation-bridge
Advanced tools
Comparing version 0.2.20-alpha.8fb426d4 to 0.2.20-alpha.c44cd58b
@@ -6,3 +6,3 @@ import { addCaptureModel, addInteractiveResource, addResourceTemplate } from 'digirati-annotation-redux/es/actions/resourceTemplate'; | ||
import { BODY_TYPE, COMBINE, CONFORMS_TO, DESCRIPTION, EXTERNALISE, FORM_FIELDS, HAS_PART, HUMAN_READABLE, ID, INPUT_TYPE, LABEL_PARTS, MOTIVATED_BY, MULTIPLE, PURPOSE, RDFS_LABEL, SELECTOR, SELECTOR_VALUE, SERIALIZE, TITLE, TYPE, UI_CHOICE, UI_GROUP } from './vocab'; | ||
import { BODY_TYPE, COMBINE, CONFORMS_TO, DESCRIPTION, EXTERNALISE, FORM_FIELDS, HAS_PART, HUMAN_READABLE, ID, INPUT_TYPE, LABEL_PARTS, MOTIVATED_BY, MULTIPLE, PURPOSE, RDFS_LABEL, SELECTOR, SERIALIZE, TITLE, TYPE, UI_CHOICE, UI_GROUP } from './vocab'; | ||
@@ -132,3 +132,2 @@ import { castBool, labelId } from './helpers'; | ||
multiple: castBool(resourceTemplateValues(MULTIPLE)), | ||
selectorValue: resourceTemplateValues(), | ||
selector: resourceTemplateValues(SELECTOR) ? resourceTemplateValues(SELECTOR)[ID] ? resourceTemplateValues(SELECTOR)[ID] : resourceTemplateValues(SELECTOR) : null, | ||
@@ -154,5 +153,3 @@ motivatedBy: motivationFromForm(labelId(resourceTemplateValues(MOTIVATED_BY))), | ||
description: fieldValues(DESCRIPTION), | ||
conformsTo: labelId(fieldValues(CONFORMS_TO)), | ||
selector: fieldValues(SELECTOR) ? fieldValues(SELECTOR)[ID] : null, | ||
selectorValue: parseSelectorTarget(fieldValues(SELECTOR_VALUE)) | ||
conformsTo: labelId(fieldValues(CONFORMS_TO)) | ||
} | ||
@@ -165,29 +162,2 @@ })); | ||
function parseSelectorTarget(toParse) { | ||
var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
if (!toParse) { | ||
return toParse; | ||
} | ||
var W3C_SELECTOR = /[#&?](xywh=)?(pixel:|percent:)?([0-9]+(\.[0-9]+)?),([0-9]+(\.[0-9]+)?),([0-9]+(\.[0-9]+)?),([0-9]+(\.[0-9]+)?)/; | ||
var match = W3C_SELECTOR.exec(toParse); | ||
if (match) { | ||
return { | ||
unit: match[2] === 'percent:' ? 'percent' : 'pixel', | ||
scale: scale, | ||
expanded: true, | ||
x: parseFloat(match[3]) * scale, | ||
y: parseFloat(match[5]) * scale, | ||
width: parseFloat(match[7]) * scale, | ||
height: parseFloat(match[9]) * scale, | ||
toString: function toString() { | ||
// @todo maybe something else? | ||
return toParse.split('#')[0]; | ||
} | ||
}; | ||
} | ||
return toParse; | ||
} | ||
export default function omekaCreateStore(createStore, reducers, resourceTemplate) { | ||
@@ -194,0 +164,0 @@ var middleware = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; |
@@ -5,3 +5,2 @@ // DUBLIN CORE CONSTANTS | ||
export var TYPE = '@type'; | ||
export var VALUE = '@value'; | ||
export var DESCRIPTION = 'dcterms:description'; | ||
@@ -28,3 +27,2 @@ export var TITLE = 'dcterms:title'; | ||
export var SELECTOR = 'crowds:uiSelectorType'; | ||
export var SELECTOR_VALUE = 'crowds:uiSelectorValue'; | ||
@@ -31,0 +29,0 @@ export var BODY_TYPE = 'crowds:derivedAnnoBodyType'; |
@@ -147,3 +147,2 @@ 'use strict'; | ||
multiple: (0, _helpers.castBool)(resourceTemplateValues(_vocab.MULTIPLE)), | ||
selectorValue: resourceTemplateValues(), | ||
selector: resourceTemplateValues(_vocab.SELECTOR) ? resourceTemplateValues(_vocab.SELECTOR)[_vocab.ID] ? resourceTemplateValues(_vocab.SELECTOR)[_vocab.ID] : resourceTemplateValues(_vocab.SELECTOR) : null, | ||
@@ -169,5 +168,3 @@ motivatedBy: motivationFromForm((0, _helpers.labelId)(resourceTemplateValues(_vocab.MOTIVATED_BY))), | ||
description: fieldValues(_vocab.DESCRIPTION), | ||
conformsTo: (0, _helpers.labelId)(fieldValues(_vocab.CONFORMS_TO)), | ||
selector: fieldValues(_vocab.SELECTOR) ? fieldValues(_vocab.SELECTOR)[_vocab.ID] : null, | ||
selectorValue: parseSelectorTarget(fieldValues(_vocab.SELECTOR_VALUE)) | ||
conformsTo: (0, _helpers.labelId)(fieldValues(_vocab.CONFORMS_TO)) | ||
} | ||
@@ -180,29 +177,2 @@ })); | ||
function parseSelectorTarget(toParse) { | ||
var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
if (!toParse) { | ||
return toParse; | ||
} | ||
var W3C_SELECTOR = /[#&?](xywh=)?(pixel:|percent:)?([0-9]+(\.[0-9]+)?),([0-9]+(\.[0-9]+)?),([0-9]+(\.[0-9]+)?),([0-9]+(\.[0-9]+)?)/; | ||
var match = W3C_SELECTOR.exec(toParse); | ||
if (match) { | ||
return { | ||
unit: match[2] === 'percent:' ? 'percent' : 'pixel', | ||
scale: scale, | ||
expanded: true, | ||
x: parseFloat(match[3]) * scale, | ||
y: parseFloat(match[5]) * scale, | ||
width: parseFloat(match[7]) * scale, | ||
height: parseFloat(match[9]) * scale, | ||
toString: function toString() { | ||
// @todo maybe something else? | ||
return toParse.split('#')[0]; | ||
} | ||
}; | ||
} | ||
return toParse; | ||
} | ||
function omekaCreateStore(createStore, reducers, resourceTemplate) { | ||
@@ -209,0 +179,0 @@ var middleware = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; |
@@ -8,3 +8,2 @@ 'use strict'; | ||
var TYPE = exports.TYPE = '@type'; | ||
var VALUE = exports.VALUE = '@value'; | ||
var DESCRIPTION = exports.DESCRIPTION = 'dcterms:description'; | ||
@@ -31,3 +30,2 @@ var TITLE = exports.TITLE = 'dcterms:title'; | ||
var SELECTOR = exports.SELECTOR = 'crowds:uiSelectorType'; | ||
var SELECTOR_VALUE = exports.SELECTOR_VALUE = 'crowds:uiSelectorValue'; | ||
@@ -34,0 +32,0 @@ var BODY_TYPE = exports.BODY_TYPE = 'crowds:derivedAnnoBodyType'; |
{ | ||
"name": "digirati-annotation-bridge", | ||
"version": "0.2.20-alpha.8fb426d4", | ||
"version": "0.2.20-alpha.c44cd58b", | ||
"description": "Describe annotation-bridge here", | ||
@@ -21,3 +21,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"digirati-annotation-redux": "^0.2.20-alpha.8fb426d4" | ||
"digirati-annotation-redux": "^0.2.20-alpha.c44cd58b" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35365
795