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

@annotation-studio/redux

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@annotation-studio/redux - npm Package Compare versions

Comparing version 1.0.0-pr.7445e434 to 1.0.0-pr.745a720b

30

es/actions/drafts.js

@@ -11,3 +11,2 @@ import _extends from 'babel-runtime/helpers/extends';

import { isSelecting, getCurrentSelector } from '../query/selectorQuery';
import { reset, moveForward } from './resources';

@@ -376,9 +375,2 @@ export var DRAFT_CREATE = 'DRAFT_CREATE';

markDraftAs(id, DRAFT_LIFECYCLE_NEW, DRAFT_LIFECYCLE_READ)(dispatch, getState);
var state = getState();
var draft = getDraftById(state, id);
// Cancel any previous selectors.
dispatch(cancelSelector());
// Select draft.
dispatch({ type: DRAFT_SELECT, payload: { id: id, scope: scope } });

@@ -388,24 +380,2 @@ };

export function selectDraftAndNavigate(id) {
return function (dispatch, getState) {
var state = getState();
var draft = getDraftById(state, id);
// Error.
if (!draft) {
return null;
}
// Go to path.
if (draft.fingerprint.path.length) {
dispatch(reset(draft.fingerprint.scope));
draft.fingerprint.path.forEach(function (forward) {
return dispatch(moveForward(draft.fingerprint.scope, forward));
});
}
// select draft.
dispatch(selectDraft(draft.fingerprint.scope, id));
};
}
export function previewDraft(id) {

@@ -412,0 +382,0 @@ return function (dispatch, getState) {

4

es/actions/manifest.js

@@ -12,5 +12,3 @@ export var MANIFEST_ADD = 'MANIFEST_ADD';

dispatch({ type: MANIFEST_REQUEST, payload: { url: url } });
return fetch(url, {
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache'
}).then(function (response) {
return fetch(url).then(function (response) {
return response.json();

@@ -17,0 +15,0 @@ }).then(function (body) {

@@ -1,4 +0,2 @@

import _regeneratorRuntime from 'babel-runtime/regenerator';
import _extends from 'babel-runtime/helpers/extends';
import _asyncToGenerator from 'babel-runtime/helpers/asyncToGenerator';
import { addSelectorToDraft, addSelectorToDraftFieldFromViewer, addSelectorToDraftFromViewer, discardCurrentDraft, removeSelectorFromDraft, removeSelectorFromDraftField } from './drafts';

@@ -22,4 +20,2 @@ import { getCurrentDraft, getDraftById } from '../query/draftQuery';

export function chooseSelector(type, source, defaults, done) {
var _this = this;
var immediate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;

@@ -42,47 +38,29 @@

}
return withViewer(function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(Canvas, dispatch) {
var _Canvas$createViewpor, x, y, _Canvas$createViewpor2, maxX, maxY;
return withViewer(function (Canvas, dispatch) {
var _Canvas$createViewpor = Canvas.createViewportPoint(defaults.x, defaults.y),
x = _Canvas$createViewpor.x,
y = _Canvas$createViewpor.y;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return Canvas.viewerReady;
var _Canvas$createViewpor2 = Canvas.createViewportPoint(defaults.x + defaults.width, defaults.y + defaults.height),
maxX = _Canvas$createViewpor2.x,
maxY = _Canvas$createViewpor2.y;
case 2:
_Canvas$createViewpor = Canvas.createViewportPoint(defaults.x, defaults.y), x = _Canvas$createViewpor.x, y = _Canvas$createViewpor.y;
_Canvas$createViewpor2 = Canvas.createViewportPoint(defaults.x + defaults.width, defaults.y + defaults.height), maxX = _Canvas$createViewpor2.x, maxY = _Canvas$createViewpor2.y;
dispatch({
type: SELECTOR_CHOOSE,
meta: { fromViewer: true },
payload: {
type: type,
source: source,
defaults: selectorCompat(_extends({}, defaults, {
x: x,
y: y,
width: maxX - x,
height: maxY - y
}))
}
});
if (done) {
done();
}
case 6:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
}));
return function (_x2, _x3) {
return _ref.apply(this, arguments);
};
}());
dispatch({
type: SELECTOR_CHOOSE,
meta: { fromViewer: true },
payload: {
type: type,
source: source,
defaults: selectorCompat(_extends({}, defaults, {
x: x,
y: y,
width: maxX - x,
height: maxY - y
}))
}
});
if (done) {
done();
}
});
}

@@ -139,3 +117,2 @@

if (selector.type === 'WholeCanvasSelector') {
console.warn('WARNING: `editCurrentDraftSelector` should never be called when whole canvas selector is chosen');
return dispatch(discardCurrentDraft(scope));

@@ -142,0 +119,0 @@ }

@@ -14,3 +14,3 @@ import _extends from 'babel-runtime/helpers/extends';

import { richAnnotationList } from './query/elucidateQuery';
import { currentManifest, currentCanvas } from './query/manifestQuery';
import { currentManifest } from './query/manifestQuery';
import { setViewer, withViewer } from './actions/viewer';

@@ -69,4 +69,2 @@ import { currentSelectorIsSecondary, isSelecting } from './query/selectorQuery';

currentSelector: currentSelector,
elucidateServer: props.elucidateServer ? props.elucidateServer : state.elucidate ? state.elucidate.server : null,
currentCanvas: currentCanvas(state),
currentDraft: currentDraft,

@@ -73,0 +71,0 @@ currentDrafts: state.drafts.currentDrafts,

@@ -200,3 +200,6 @@ import _extends from 'babel-runtime/helpers/extends';

var captureModelField = captureModel.fields[field.id];
var captureModelField = Object.values(captureModel.fields).find(function (_ref2) {
var id = _ref2.id;
return id === field.id;
});
if (!(captureModelField && (captureModelField.metaData || captureModelField.omekaMeta))) {

@@ -288,8 +291,8 @@ console.warn('createMultipleAnnotations', 'Looks like you have set derivedAnnoCombine to "False" without selectors on the fields, are you sure this is correct?', captureModelField);

export function createAnnotationFromCaptureModelAndDraft(_ref2) {
var target = _ref2.target,
captureModel = _ref2.captureModel,
draft = _ref2.draft,
customDraftSelector = _ref2.customDraftSelector,
partOf = _ref2.partOf;
export function createAnnotationFromCaptureModelAndDraft(_ref3) {
var target = _ref3.target,
captureModel = _ref3.captureModel,
draft = _ref3.draft,
customDraftSelector = _ref3.customDraftSelector,
partOf = _ref3.partOf;

@@ -296,0 +299,0 @@ var bodies = [];

@@ -111,3 +111,2 @@ import _asyncIterator from 'babel-runtime/helpers/asyncIterator';

credentials: withoutCredentials ? 'omit' : process.env.NODE_ENV === 'production' ? 'include' : 'omit',
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache',
redirect: 'follow'

@@ -114,0 +113,0 @@ }).then(function (response) {

@@ -13,10 +13,9 @@ import thunk from 'redux-thunk';

};
var ViewerStore = { viewer: null, resolve: null, err: null };
var viewerReady = new Promise(function (resolve, err) {
ViewerStore.resolve = resolve;
ViewerStore.err = err;
});
var viewerAware = function viewerAware(store) {
var ViewerStore = { viewer: null, resolve: null, err: null };
var viewerReady = new Promise(function (resolve, err) {
ViewerStore.resolve = resolve;
ViewerStore.err = err;
});
return function (next) {

@@ -37,4 +36,5 @@ return function (action) {

var showUntilQueue = {};
var showUntil = function showUntil(store) {
var showUntilQueue = {};
return function (next) {

@@ -41,0 +41,0 @@ return function (action) {

@@ -41,3 +41,2 @@ 'use strict';

exports.selectDraft = selectDraft;
exports.selectDraftAndNavigate = selectDraftAndNavigate;
exports.previewDraft = previewDraft;

@@ -66,4 +65,2 @@ exports.unpreviewDraft = unpreviewDraft;

var _resources = require('./resources');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -433,9 +430,2 @@

markDraftAs(id, DRAFT_LIFECYCLE_NEW, DRAFT_LIFECYCLE_READ)(dispatch, getState);
var state = getState();
var draft = (0, _draftQuery.getDraftById)(state, id);
// Cancel any previous selectors.
dispatch((0, _selectors2.cancelSelector)());
// Select draft.
dispatch({ type: DRAFT_SELECT, payload: { id: id, scope: scope } });

@@ -445,24 +435,2 @@ };

function selectDraftAndNavigate(id) {
return function (dispatch, getState) {
var state = getState();
var draft = (0, _draftQuery.getDraftById)(state, id);
// Error.
if (!draft) {
return null;
}
// Go to path.
if (draft.fingerprint.path.length) {
dispatch((0, _resources.reset)(draft.fingerprint.scope));
draft.fingerprint.path.forEach(function (forward) {
return dispatch((0, _resources.moveForward)(draft.fingerprint.scope, forward));
});
}
// select draft.
dispatch(selectDraft(draft.fingerprint.scope, id));
};
}
function previewDraft(id) {

@@ -469,0 +437,0 @@ return function (dispatch, getState) {

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

dispatch({ type: MANIFEST_REQUEST, payload: { url: url } });
return fetch(url, {
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache'
}).then(function (response) {
return fetch(url).then(function (response) {
return response.json();

@@ -25,0 +23,0 @@ }).then(function (body) {

@@ -6,6 +6,2 @@ 'use strict';

var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _extends2 = require('babel-runtime/helpers/extends');

@@ -15,6 +11,2 @@

var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
exports.setAvailableSelectors = setAvailableSelectors;

@@ -54,4 +46,2 @@ exports.chooseSelector = chooseSelector;

function chooseSelector(type, source, defaults, done) {
var _this = this;
var immediate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;

@@ -74,47 +64,29 @@

}
return (0, _viewer.withViewer)(function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(Canvas, dispatch) {
var _Canvas$createViewpor, x, y, _Canvas$createViewpor2, maxX, maxY;
return (0, _viewer.withViewer)(function (Canvas, dispatch) {
var _Canvas$createViewpor = Canvas.createViewportPoint(defaults.x, defaults.y),
x = _Canvas$createViewpor.x,
y = _Canvas$createViewpor.y;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return Canvas.viewerReady;
var _Canvas$createViewpor2 = Canvas.createViewportPoint(defaults.x + defaults.width, defaults.y + defaults.height),
maxX = _Canvas$createViewpor2.x,
maxY = _Canvas$createViewpor2.y;
case 2:
_Canvas$createViewpor = Canvas.createViewportPoint(defaults.x, defaults.y), x = _Canvas$createViewpor.x, y = _Canvas$createViewpor.y;
_Canvas$createViewpor2 = Canvas.createViewportPoint(defaults.x + defaults.width, defaults.y + defaults.height), maxX = _Canvas$createViewpor2.x, maxY = _Canvas$createViewpor2.y;
dispatch({
type: SELECTOR_CHOOSE,
meta: { fromViewer: true },
payload: {
type: type,
source: source,
defaults: (0, _utility.selectorCompat)((0, _extends3.default)({}, defaults, {
x: x,
y: y,
width: maxX - x,
height: maxY - y
}))
}
});
if (done) {
done();
}
case 6:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
}));
return function (_x2, _x3) {
return _ref.apply(this, arguments);
};
}());
dispatch({
type: SELECTOR_CHOOSE,
meta: { fromViewer: true },
payload: {
type: type,
source: source,
defaults: (0, _utility.selectorCompat)((0, _extends3.default)({}, defaults, {
x: x,
y: y,
width: maxX - x,
height: maxY - y
}))
}
});
if (done) {
done();
}
});
}

@@ -171,3 +143,2 @@

if (selector.type === 'WholeCanvasSelector') {
console.warn('WARNING: `editCurrentDraftSelector` should never be called when whole canvas selector is chosen');
return dispatch((0, _drafts.discardCurrentDraft)(scope));

@@ -174,0 +145,0 @@ }

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

currentSelector: currentSelector,
elucidateServer: props.elucidateServer ? props.elucidateServer : state.elucidate ? state.elucidate.server : null,
currentCanvas: (0, _manifestQuery.currentCanvas)(state),
currentDraft: currentDraft,

@@ -97,0 +95,0 @@ currentDrafts: state.drafts.currentDrafts,

@@ -238,3 +238,6 @@ 'use strict';

var captureModelField = captureModel.fields[field.id];
var captureModelField = Object.values(captureModel.fields).find(function (_ref2) {
var id = _ref2.id;
return id === field.id;
});
if (!(captureModelField && (captureModelField.metaData || captureModelField.omekaMeta))) {

@@ -326,8 +329,8 @@ console.warn('createMultipleAnnotations', 'Looks like you have set derivedAnnoCombine to "False" without selectors on the fields, are you sure this is correct?', captureModelField);

function createAnnotationFromCaptureModelAndDraft(_ref2) {
var target = _ref2.target,
captureModel = _ref2.captureModel,
draft = _ref2.draft,
customDraftSelector = _ref2.customDraftSelector,
partOf = _ref2.partOf;
function createAnnotationFromCaptureModelAndDraft(_ref3) {
var target = _ref3.target,
captureModel = _ref3.captureModel,
draft = _ref3.draft,
customDraftSelector = _ref3.customDraftSelector,
partOf = _ref3.partOf;

@@ -334,0 +337,0 @@ var bodies = [];

@@ -252,3 +252,2 @@ 'use strict';

credentials: withoutCredentials ? 'omit' : process.env.NODE_ENV === 'production' ? 'include' : 'omit',
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache',
redirect: 'follow'

@@ -255,0 +254,0 @@ }).then(function (response) {

@@ -21,10 +21,9 @@ 'use strict';

};
var ViewerStore = { viewer: null, resolve: null, err: null };
var viewerReady = new Promise(function (resolve, err) {
ViewerStore.resolve = resolve;
ViewerStore.err = err;
});
var viewerAware = function viewerAware(store) {
var ViewerStore = { viewer: null, resolve: null, err: null };
var viewerReady = new Promise(function (resolve, err) {
ViewerStore.resolve = resolve;
ViewerStore.err = err;
});
return function (next) {

@@ -45,4 +44,5 @@ return function (action) {

var showUntilQueue = {};
var showUntil = function showUntil(store) {
var showUntilQueue = {};
return function (next) {

@@ -49,0 +49,0 @@ return function (action) {

{
"name": "@annotation-studio/redux",
"version": "1.0.0-pr.7445e434",
"version": "1.0.0-pr.745a720b",
"description": "Describe annotation-redux here",

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

"devDependencies": {
"@fesk/test-environment": "1.0.0-pr.7445e434",
"@fesk/test-environment": "1.0.0-pr.745a720b",
"babel-jest": "^20.0.3",

@@ -47,5 +47,5 @@ "babel-plugin-transform-async-to-generator": "^6.24.1",

"fetch-mock": "^6.5.1",
"jest": "^20.0.0",
"jest": "^23.6.0",
"nwb": "^0.21.5",
"nwb-watch": "1.0.0-pr.7445e434",
"nwb-watch": "1.0.0-pr.745a720b",
"react-intl": "^2.2.2",

@@ -52,0 +52,0 @@ "react-intl-redux": "^0.7.0",

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