Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@annotation-studio/components

Package Overview
Dependencies
Maintainers
1
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@annotation-studio/components - npm Package Compare versions

Comparing version 1.0.0-next.060662c8 to 1.0.0-next.71c723e9

13

es/components/composites/Canvas.js

@@ -91,5 +91,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

, meta: _extends({
name: region.name || null,
isSecondary: region.isSecondary || false,
isSelected: region.selected || false,
focused: region.focused || false
focused: region.focused || false,
isHidden: !_this.state.showAnnotations
}, region)

@@ -138,5 +140,7 @@ });

var type = selector.type,
position = _objectWithoutProperties(selector, ['type']);
source = selector.source,
position = _objectWithoutProperties(selector, ['type', 'source']);
var scale = displayWidth / width;
var name = source && source.name ? source.name : null;

@@ -170,2 +174,3 @@ var isInitial = type === 'madoc:boxdraw' ? !position.x && !position.y : false;

, meta: {
name: name || null,
isSecondary: position.isSecondary || false,

@@ -242,5 +247,5 @@ isSelected: position.isSelected || false,

var regionRender = this.state.showAnnotations ? Object.keys(regions).reverse().map(function (r) {
var regionRender = Object.keys(regions).reverse().map(function (r) {
return regions[r];
}).map(this.mapRegion) : null;
}).map(this.mapRegion);

@@ -247,0 +252,0 @@ var currentSelectorPropsViewport = {

@@ -56,3 +56,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

update(value);
fetch(printf(this.props.autocomplete, value)).then(function (f) {
fetch(printf(this.props.autocomplete, value), { cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache' }).then(function (f) {
return f.json();

@@ -59,0 +59,0 @@ }).then(function (data) {

@@ -26,3 +26,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

return _ret = (_temp = (_this = _possibleConstructorReturn(this, _BaseInputType.call.apply(_BaseInputType, [this].concat(args))), _this), _this.state = { isLoaded: false, isLoading: false }, _this.renderCurrentValue = function (value, props, style) {
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _BaseInputType.call.apply(_BaseInputType, [this].concat(args))), _this), _this.state = { isLoaded: false, isLoading: false, error: false }, _this.renderCurrentValue = function (value, props, style) {
var renderResource = _this.props.renderResource;

@@ -48,4 +48,17 @@

isLoaded = _this$state.isLoaded,
captureModelId = _this$state.captureModelId;
captureModelId = _this$state.captureModelId,
error = _this$state.error;
if (error) {
return React.createElement(
'div',
null,
'Sorry we are having trouble displaying this capture model. ',
React.createElement(
'button',
{ onClick: onBack },
'Back'
)
);
}
if (isLoading) {

@@ -55,3 +68,3 @@ return 'loading...';

if (isLoaded) {
return renderResourceEditor(captureModelId, postSave, props, style, onBack);
return renderResourceEditor(captureModel, postSave, props, style, onBack);
}

@@ -70,3 +83,5 @@ }, _temp), _possibleConstructorReturn(_this, _ret);

captureModel = _props.captureModel,
importCaptureModel = _props.importCaptureModel;
importCaptureModel = _props.importCaptureModel,
createDraftFromCaptureModel = _props.createDraftFromCaptureModel,
styleModifier = _props.styleModifier;
var _state = this.state,

@@ -81,2 +96,10 @@ isLoading = _state.isLoading,

Promise.resolve(importCaptureModel(captureModel)).then(function (resourceTemplate) {
if ((resourceTemplate['crowds:uiChoice'] || '').toLowerCase() === 'true') {
console.warn('Embedded capture models shouldn\'t be choices');
_this2.setState({ error: true });
return;
}
createDraftFromCaptureModel(resourceTemplate['@id'], resourceTemplate['@id'], {}, 'tagging', [], styleModifier);
// Since Promise resolve might not deffer, we need to call setState as

@@ -102,2 +125,3 @@ // a function.

return React.createElement(

@@ -104,0 +128,0 @@ 'div',

@@ -36,3 +36,4 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

creatingNew: false,
fallbackValue: null
fallbackValue: null,
loading: false
}, _this.handleNotFound = function () {

@@ -51,5 +52,11 @@ _this.setState({

}, _this.postSave = function (prom, annotation) {
_this.setState({ loading: true });
prom.then(function (val) {
var url = val.payload.annotation.canonicalUrl ? val.payload.annotation.canonicalUrl : val.payload.id;
_this.setState({ creatingNew: false, previousValue: null, fallbackValue: { url: url, label: annotation.label } });
_this.setState({
creatingNew: false,
loading: false,
previousValue: null,
fallbackValue: { url: url, label: annotation.label }
});
_this.props.update({ url: val.payload.id, label: annotation.label });

@@ -73,3 +80,9 @@ });

Fallback.prototype.shouldComponentUpdate = function shouldComponentUpdate(newProps, newState) {
return newProps.value !== this.props.value || newProps.preview !== this.props.preview || newState !== this.state;
};
Fallback.prototype.render = function render() {
var loading = this.state.loading;
var _props = this.props,

@@ -83,2 +96,28 @@ captureModel = _props.captureModel,

if (loading) {
return React.createElement(
'div',
null,
metaData ? React.createElement(
'div',
null,
metaData.title
) : null,
React.createElement(
'a',
{ className: style.element('entity') },
React.createElement(
'div',
{ className: style.element('preview-label') },
'Processing the item you added...'
),
React.createElement(
'div',
{ className: style.element('preview-url') },
'This process may take a moment, then you can continue with your form.'
)
)
);
}
if (preview || this.state.fallbackValue) {

@@ -132,3 +171,3 @@ return React.createElement(

Portal,
{ ref: this.setPortal, isOpened: this.state.creatingNew },
{ ref: this.setPortal, isOpened: this.state.creatingNew || loading },
React.createElement(

@@ -135,0 +174,0 @@ 'div',

@@ -66,2 +66,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var name = this.props.name;
return React.createElement(

@@ -79,3 +81,3 @@ Rnd,

},
className: style,
className: name ? style.modifier(name) : style,
bounds: 'parent' },

@@ -82,0 +84,0 @@ React.createElement(

@@ -37,3 +37,5 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

if (image['@id']) {
return fetch(getCanonicalImage(image['@id'])).then(function (r) {
return fetch(getCanonicalImage(image['@id']), {
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache'
}).then(function (r) {
return r.json();

@@ -40,0 +42,0 @@ }).then(function (tileSource) {

@@ -270,3 +270,5 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

if (image['@id']) {
return fetch(this.getCanonicalImage(image['@id'])).then(function (r) {
return fetch(this.getCanonicalImage(image['@id']), {
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache'
}).then(function (r) {
return r.json();

@@ -273,0 +275,0 @@ }).then(function (tileSource) {

@@ -41,3 +41,5 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

isSecondary = meta.isSecondary,
focused = meta.focused;
focused = meta.focused,
name = meta.name,
isHidden = meta.isHidden;

@@ -48,3 +50,3 @@ return React.createElement(

key: id,
className: style,
className: name ? style.modifier(name) : style,
onClick: function onClick() {

@@ -65,4 +67,5 @@ var el = document.getElementById(id);

editing: editing,
hidden: isHidden,
selected: isSelected
}, _style$element$modifi[type.replace(/:/, '-')] = true, _style$element$modifi), true) })
}, _style$element$modifi[name ? name : 'unnamed'] = true, _style$element$modifi[type.replace(/:/, '-')] = true, _style$element$modifi), true) })
);

@@ -122,3 +125,4 @@ };

canvasScale: canvasScale,
isSecondary: meta ? meta.isSecondary : false
isSecondary: meta ? meta.isSecondary : false,
name: meta.name
});

@@ -125,0 +129,0 @@ };

@@ -113,5 +113,7 @@ 'use strict';

, meta: _extends({
name: region.name || null,
isSecondary: region.isSecondary || false,
isSelected: region.selected || false,
focused: region.focused || false
focused: region.focused || false,
isHidden: !_this.state.showAnnotations
}, region)

@@ -160,5 +162,7 @@ });

var type = selector.type,
position = _objectWithoutProperties(selector, ['type']);
source = selector.source,
position = _objectWithoutProperties(selector, ['type', 'source']);
var scale = displayWidth / width;
var name = source && source.name ? source.name : null;

@@ -192,2 +196,3 @@ var isInitial = type === 'madoc:boxdraw' ? !position.x && !position.y : false;

, meta: {
name: name || null,
isSecondary: position.isSecondary || false,

@@ -264,5 +269,5 @@ isSelected: position.isSelected || false,

var regionRender = this.state.showAnnotations ? Object.keys(regions).reverse().map(function (r) {
var regionRender = Object.keys(regions).reverse().map(function (r) {
return regions[r];
}).map(this.mapRegion) : null;
}).map(this.mapRegion);

@@ -269,0 +274,0 @@ var currentSelectorPropsViewport = {

@@ -71,3 +71,3 @@ 'use strict';

update(value);
fetch(printf(this.props.autocomplete, value)).then(function (f) {
fetch(printf(this.props.autocomplete, value), { cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache' }).then(function (f) {
return f.json();

@@ -74,0 +74,0 @@ }).then(function (data) {

@@ -42,3 +42,3 @@ 'use strict';

return _ret = (_temp = (_this = _possibleConstructorReturn(this, _BaseInputType.call.apply(_BaseInputType, [this].concat(args))), _this), _this.state = { isLoaded: false, isLoading: false }, _this.renderCurrentValue = function (value, props, style) {
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _BaseInputType.call.apply(_BaseInputType, [this].concat(args))), _this), _this.state = { isLoaded: false, isLoading: false, error: false }, _this.renderCurrentValue = function (value, props, style) {
var renderResource = _this.props.renderResource;

@@ -64,4 +64,17 @@

isLoaded = _this$state.isLoaded,
captureModelId = _this$state.captureModelId;
captureModelId = _this$state.captureModelId,
error = _this$state.error;
if (error) {
return _react2.default.createElement(
'div',
null,
'Sorry we are having trouble displaying this capture model. ',
_react2.default.createElement(
'button',
{ onClick: onBack },
'Back'
)
);
}
if (isLoading) {

@@ -71,3 +84,3 @@ return 'loading...';

if (isLoaded) {
return renderResourceEditor(captureModelId, postSave, props, style, onBack);
return renderResourceEditor(captureModel, postSave, props, style, onBack);
}

@@ -86,3 +99,5 @@ }, _temp), _possibleConstructorReturn(_this, _ret);

captureModel = _props.captureModel,
importCaptureModel = _props.importCaptureModel;
importCaptureModel = _props.importCaptureModel,
createDraftFromCaptureModel = _props.createDraftFromCaptureModel,
styleModifier = _props.styleModifier;
var _state = this.state,

@@ -97,2 +112,10 @@ isLoading = _state.isLoading,

Promise.resolve(importCaptureModel(captureModel)).then(function (resourceTemplate) {
if ((resourceTemplate['crowds:uiChoice'] || '').toLowerCase() === 'true') {
console.warn('Embedded capture models shouldn\'t be choices');
_this2.setState({ error: true });
return;
}
createDraftFromCaptureModel(resourceTemplate['@id'], resourceTemplate['@id'], {}, 'tagging', [], styleModifier);
// Since Promise resolve might not deffer, we need to call setState as

@@ -118,2 +141,3 @@ // a function.

return _react2.default.createElement(

@@ -120,0 +144,0 @@ 'div',

@@ -60,3 +60,4 @@ 'use strict';

creatingNew: false,
fallbackValue: null
fallbackValue: null,
loading: false
}, _this.handleNotFound = function () {

@@ -75,5 +76,11 @@ _this.setState({

}, _this.postSave = function (prom, annotation) {
_this.setState({ loading: true });
prom.then(function (val) {
var url = val.payload.annotation.canonicalUrl ? val.payload.annotation.canonicalUrl : val.payload.id;
_this.setState({ creatingNew: false, previousValue: null, fallbackValue: { url: url, label: annotation.label } });
_this.setState({
creatingNew: false,
loading: false,
previousValue: null,
fallbackValue: { url: url, label: annotation.label }
});
_this.props.update({ url: val.payload.id, label: annotation.label });

@@ -97,3 +104,9 @@ });

Fallback.prototype.shouldComponentUpdate = function shouldComponentUpdate(newProps, newState) {
return newProps.value !== this.props.value || newProps.preview !== this.props.preview || newState !== this.state;
};
Fallback.prototype.render = function render() {
var loading = this.state.loading;
var _props = this.props,

@@ -107,2 +120,28 @@ captureModel = _props.captureModel,

if (loading) {
return _react2.default.createElement(
'div',
null,
metaData ? _react2.default.createElement(
'div',
null,
metaData.title
) : null,
_react2.default.createElement(
'a',
{ className: style.element('entity') },
_react2.default.createElement(
'div',
{ className: style.element('preview-label') },
'Processing the item you added...'
),
_react2.default.createElement(
'div',
{ className: style.element('preview-url') },
'This process may take a moment, then you can continue with your form.'
)
)
);
}
if (preview || this.state.fallbackValue) {

@@ -156,3 +195,3 @@ return _react2.default.createElement(

_reactPortal2.default,
{ ref: this.setPortal, isOpened: this.state.creatingNew },
{ ref: this.setPortal, isOpened: this.state.creatingNew || loading },
_react2.default.createElement(

@@ -159,0 +198,0 @@ 'div',

@@ -84,2 +84,4 @@ 'use strict';

var name = this.props.name;
return _react2.default.createElement(

@@ -97,3 +99,3 @@ _reactRnd2.default,

},
className: style,
className: name ? style.modifier(name) : style,
bounds: 'parent' },

@@ -100,0 +102,0 @@ _react2.default.createElement(

@@ -56,3 +56,5 @@ 'use strict';

if (image['@id']) {
return fetch(getCanonicalImage(image['@id'])).then(function (r) {
return fetch(getCanonicalImage(image['@id']), {
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache'
}).then(function (r) {
return r.json();

@@ -59,0 +61,0 @@ }).then(function (tileSource) {

@@ -291,3 +291,5 @@ 'use strict';

if (image['@id']) {
return fetch(this.getCanonicalImage(image['@id'])).then(function (r) {
return fetch(this.getCanonicalImage(image['@id']), {
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache'
}).then(function (r) {
return r.json();

@@ -294,0 +296,0 @@ }).then(function (tileSource) {

@@ -58,3 +58,5 @@ 'use strict';

isSecondary = meta.isSecondary,
focused = meta.focused;
focused = meta.focused,
name = meta.name,
isHidden = meta.isHidden;

@@ -65,3 +67,3 @@ return _react2.default.createElement(

key: id,
className: style,
className: name ? style.modifier(name) : style,
onClick: function onClick() {

@@ -82,4 +84,5 @@ var el = document.getElementById(id);

editing: editing,
hidden: isHidden,
selected: isSelected
}, _style$element$modifi[type.replace(/:/, '-')] = true, _style$element$modifi), true) })
}, _style$element$modifi[name ? name : 'unnamed'] = true, _style$element$modifi[type.replace(/:/, '-')] = true, _style$element$modifi), true) })
);

@@ -139,3 +142,4 @@ };

canvasScale: canvasScale,
isSecondary: meta ? meta.isSecondary : false
isSecondary: meta ? meta.isSecondary : false,
name: meta.name
});

@@ -142,0 +146,0 @@ };

{
"name": "@annotation-studio/components",
"version": "1.0.0-next.060662c8",
"version": "1.0.0-next.71c723e9",
"description": "annotation-components React component",

@@ -43,3 +43,3 @@ "main": "lib/index.js",

"devDependencies": {
"@fesk/test-environment": "^1.0.0-next.060662c8",
"@fesk/test-environment": "^1.0.0-next.71c723e9",
"@insin/extract-text-webpack-plugin": "2.0.0-beta.5.1b711fa5",

@@ -46,0 +46,0 @@ "babel-jest": "^20.0.3",

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 not supported yet

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc