Socket
Socket
Sign inDemoInstall

@files-stack/client-redux

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@files-stack/client-redux - npm Package Compare versions

Comparing version 0.0.26 to 0.0.27-0

19

lib/actions/edit-actions.d.ts

@@ -20,3 +20,3 @@ import * as actionTypes from './types';

type: actionTypes.UPDATE_CONTENT;
newValue: string;
content: IContent;
}) | ({

@@ -27,3 +27,3 @@ type: actionTypes.ACTIVATE_EDITOR;

type: actionTypes.UPDATE_EDITORS_HEIGHT;
editorsHeight: any[];
editorWrappers: any[];
}) | ({

@@ -36,2 +36,10 @@ type: actionTypes.OPEN_MARKDOWN;

options: IFinderOptions;
}) | ({
type: actionTypes.SAVE_ALL_EDITORS;
allSave: boolean;
}) | ({
type: actionTypes.CLOSE_ALL_EDITORS;
}) | ({
type: actionTypes.KEEP_OPEN_EDITOR;
content: IContent;
});

@@ -43,6 +51,9 @@ export declare const openFileAction: (payload: any) => EditAction;

export declare const changeEditAction: (newValue: string) => EditAction;
export declare const updateContentAction: (newValue: string) => EditAction;
export declare const updateContentAction: (content: IContent) => EditAction;
export declare const activateEditorAction: (editorId: number) => EditAction;
export declare const updateEditorsHeightAction: (editorsHeight: any[]) => EditAction;
export declare const updateEditorsHeightAction: (editorWrappers: any[]) => EditAction;
export declare const openMarkdownAction: (content: IContent, previewEditorId: number) => EditAction;
export declare const setFinderOptionsAction: (options: IFinderOptions) => EditAction;
export declare const saveAllEditorAction: (allSave: boolean) => EditAction;
export declare const closeAllEditorAction: () => EditAction;
export declare const keepOpenAction: (content: IContent) => EditAction;

@@ -49,1 +49,7 @@ export declare type SET_ROOTPATH = '@@files-stack/SET_ROOTPATH';

export declare const SET_FINDER_OPTIONS: SET_FINDER_OPTIONS;
export declare type SAVE_ALL_EDITORS = '@@files-stack/SAVE_ALL_EDITORS';
export declare const SAVE_ALL_EDITORS: SAVE_ALL_EDITORS;
export declare type CLOSE_ALL_EDITORS = '@@files-stack/CLOSE_ALL_EDITORS';
export declare const CLOSE_ALL_EDITORS: CLOSE_ALL_EDITORS;
export declare type KEEP_OPEN_EDITOR = '@@files-stack/KEEP_OPEN_EDITOR';
export declare const KEEP_OPEN_EDITOR: KEEP_OPEN_EDITOR;

@@ -98,2 +98,5 @@ module.exports =

exports.SET_FINDER_OPTIONS = '@@files-stack/SET_FINDER_OPTIONS';
exports.SAVE_ALL_EDITORS = '@@files-stack/SAVE_ALL_EDITORS';
exports.CLOSE_ALL_EDITORS = '@@files-stack/CLOSE_ALL_EDITORS';
exports.KEEP_OPEN_EDITOR = '@@files-stack/KEEP_OPEN_EDITOR';

@@ -118,4 +121,4 @@

__export(__webpack_require__(0));
__export(__webpack_require__(8));
__export(__webpack_require__(9));
__export(__webpack_require__(10));
__export(__webpack_require__(11));

@@ -135,3 +138,3 @@

__export(__webpack_require__(2));
__export(__webpack_require__(10));
__export(__webpack_require__(12));

@@ -298,2 +301,4 @@

const lodash_1 = __webpack_require__(7);
const client_core_1 = __webpack_require__(8);
const core_1 = __webpack_require__(9);
const actionTypes = __webpack_require__(0);

@@ -304,3 +309,3 @@ const initialEditState = {

editors: [],
editorsHeight: [],
editorWrappers: [],
activeEditorId: 0,

@@ -310,2 +315,3 @@ readingFile: { resource: '' },

deleted: false,
allSave: false,
};

@@ -318,3 +324,3 @@ function edit(state = initialEditState, action) {

let editors;
let editorsHeight;
let editorWrappers;
let editorId;

@@ -325,38 +331,58 @@ let readingFile;

activeEditorId = state.activeEditorId;
editors = lodash_1.clone(state.editors);
editorsHeight = state.editorsHeight;
if (editors.length === 0) {
editors = [1];
editorsHeight = [{ editorId: 1, height: 80 }];
activeEditorId = 1;
editors = [...state.editors];
editorWrappers = [...state.editorWrappers];
openingFiles = [...state.openingFiles];
index = ramda_1.findIndex(ramda_1.whereEq({
resource: 'file://' + action.payload.resource,
editorId: activeEditorId,
}))(openingFiles);
if (index !== -1) {
openingFiles[index] = Object.assign({}, openingFiles[index], { preopen: false });
editingFiles = lodash_1.filter(state.editingFiles, item => item.editorId !== activeEditorId);
editingFiles.push(Object.assign({}, openingFiles[index]));
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, activeEditorId, 'file://' + action.payload.resource) });
}
if (action.payload.editorId) {
activeEditorId = action.payload.editorId;
index = editors.indexOf(action.payload.editorId);
if (index === -1) {
if (editors.length < 3) {
editors.push(action.payload.editorId);
editorsHeight.push({ editorId: action.payload.editorId, height: 80 });
else {
if (editors.length === 0) {
editors = [1];
editorWrappers = [{
editorId: 1,
height: client_core_1.EDITOR_DEFAULT_HEIGHT,
history: ['file://' + action.payload.resource],
}];
activeEditorId = 1;
}
if (action.payload.editorId) {
activeEditorId = action.payload.editorId;
index = editors.indexOf(action.payload.editorId);
if (index === -1) {
if (editors.length < 3) {
editors.push(action.payload.editorId);
editorWrappers.push({ editorId: action.payload.editorId, height: client_core_1.EDITOR_DEFAULT_HEIGHT });
}
else {
activeEditorId = editors[editors.length - 1];
}
}
else {
activeEditorId = editors[editors.length - 1];
}
}
readingFile = {
resource: action.payload.resource,
name: action.payload.name,
editorId: activeEditorId,
};
return Object.assign({}, state, { readingFile,
activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, activeEditorId, 'file://' + action.payload.resource), oldValue: action.payload ? action.payload.oldValue : null, deleted: action.payload ? action.payload.deleted : null, addIgnore: action.payload ? action.payload.addIgnore : null });
}
readingFile = {
resource: action.payload.resource,
name: action.payload.name,
editorId: activeEditorId,
};
return Object.assign({}, state, { readingFile,
activeEditorId, editors: [...editors], editorsHeight: [...editorsHeight], oldValue: action.payload ? action.payload.oldValue : null, deleted: action.payload ? action.payload.deleted : null, addIgnore: action.payload ? action.payload.addIgnore : null });
case actionTypes.ADD_EDIT:
if (action.content.editorId) {
editorId = action.content.editorId;
openingFiles = state.openingFiles;
editors = lodash_1.clone(state.editors);
editorsHeight = state.editorsHeight;
openingFiles = [...state.openingFiles];
editors = [...state.editors];
editorWrappers = [...state.editorWrappers];
if (action.content.preopen) {
openingFiles = lodash_1.filter(openingFiles, item => !(item.editorId === editorId && item.preopen));
}
if (editors.length === 0) {
editors = [editorId];
editorsHeight = [{ editorId: 1, height: 80 }];
editorWrappers = [{ editorId: 1, height: client_core_1.EDITOR_DEFAULT_HEIGHT, history: [] }];
}

@@ -368,3 +394,3 @@ activeEditorId = editorId;

editors.push(editorId);
editorsHeight.push({ editorId, height: 80 });
editorWrappers.push({ editorId, height: client_core_1.EDITOR_DEFAULT_HEIGHT, history: [] });
}

@@ -406,3 +432,3 @@ else {

editingFiles.push(Object.assign({}, action.content, { editorId: activeEditorId }));
return Object.assign({}, state, { readingFile: { resource: '' }, openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorsHeight: [...editorsHeight], oldValue: '', addIgnore: '' });
return Object.assign({}, state, { readingFile: { resource: '' }, openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, editorId, action.content.resource), oldValue: '', addIgnore: '' });
}

@@ -414,6 +440,6 @@ else {

editorId = action.content.editorId;
openingFiles = state.openingFiles;
editingFiles = state.editingFiles;
editors = lodash_1.clone(state.editors);
editorsHeight = state.editorsHeight;
openingFiles = [...state.openingFiles];
editingFiles = [...state.editingFiles];
editors = [...state.editors];
editorWrappers = [...state.editorWrappers];
activeEditorId = state.activeEditorId;

@@ -439,3 +465,8 @@ index = ramda_1.findIndex(ramda_1.whereEq({

if (activeEditorFiles.length) {
editingFiles.push(activeEditorFiles[0]);
editorWrappers = core_1.removeEditorHistory(editorWrappers, editorId, action.content.resource);
const lastResource = core_1.getLastEditorHistory(editorWrappers, editorId);
if (lastResource) {
const editingFile = ramda_1.find(ramda_1.whereEq({ resource: lastResource }))(activeEditorFiles);
editingFiles.push(editingFile);
}
}

@@ -446,3 +477,3 @@ else {

editors.splice(editorIndex, 1);
editorsHeight.splice(editorIndex, 1);
editorWrappers.splice(editorIndex, 1);
}

@@ -454,18 +485,45 @@ if (activeEditorId === editorId) {

}
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editors: [...editors], editorsHeight: [...editorsHeight], activeEditorId });
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editors: [...editors], editorWrappers: [...editorWrappers], activeEditorId });
}
case actionTypes.SELECT_EDIT:
editorId = action.content.editorId;
openingFiles = state.openingFiles;
activeEditorId = state.activeEditorId;
editingFiles = lodash_1.filter(state.editingFiles, item => item.editorId !== editorId);
editors = [...state.editors];
editorWrappers = [...state.editorWrappers];
openingFiles = [...state.openingFiles];
index = ramda_1.findIndex(ramda_1.whereEq({
resource: action.content.resource,
editorId,
editorId: action.content.editorId,
}))(openingFiles);
if (index !== -1) {
return Object.assign({}, state, { editingFiles: [...editingFiles, Object.assign({}, openingFiles[index])], activeEditorId: editorId });
editingFiles = lodash_1.filter(state.editingFiles, item => item.editorId !== action.content.editorId);
editingFiles.push(Object.assign({}, openingFiles[index]));
return Object.assign({}, state, { editingFiles: [...editingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) });
}
else {
return state;
if (editors.length === 0) {
editors = [1];
editorWrappers = [{ editorId: 1, height: client_core_1.EDITOR_DEFAULT_HEIGHT, history: [] }];
activeEditorId = 1;
}
if (action.content.editorId) {
activeEditorId = action.content.editorId;
index = editors.indexOf(action.content.editorId);
if (index === -1) {
if (editors.length < 3) {
editors.push(action.content.editorId);
editorWrappers.push({ editorId: action.content.editorId, height: client_core_1.EDITOR_DEFAULT_HEIGHT, history: [] });
}
else {
activeEditorId = editors[editors.length - 1];
}
}
}
readingFile = {
resource: core_1.getPath(action.content.resource),
name: action.content.name,
editorId: activeEditorId,
preopen: true,
};
return Object.assign({}, state, { readingFile,
activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource), openingFiles: [...openingFiles] });
}

@@ -483,2 +541,5 @@ case actionTypes.CHANGE_EDIT:

openingFiles[itemIndex] = Object.assign({}, openingFiles[itemIndex], { newValue: action.newValue });
if (item.editorId === activeEditorFile.editorId) {
openingFiles[itemIndex]['preopen'] = false;
}
}

@@ -491,20 +552,27 @@ });

}
case actionTypes.UPDATE_CONTENT:
case actionTypes.KEEP_OPEN_EDITOR:
openingFiles = state.openingFiles;
editingFiles = state.editingFiles;
index = ramda_1.findIndex(ramda_1.whereEq({ editorId: state.activeEditorId }))(editingFiles);
editorWrappers = [...state.editorWrappers];
index = ramda_1.findIndex(ramda_1.whereEq({
editorId: action.content.editorId,
resource: action.content.resource,
}))(openingFiles);
if (index !== -1) {
const activeEditorFile = state.editingFiles[index];
let items = lodash_1.filter(openingFiles, item => item.resource === activeEditorFile.resource && !item.deleted);
items.forEach(item => {
const itemIndex = openingFiles.indexOf(item);
if (itemIndex !== -1) {
openingFiles[itemIndex] = Object.assign({}, openingFiles[itemIndex], { newValue: action.newValue, value: action.newValue });
}
});
return Object.assign({}, state, { openingFiles: [...openingFiles] });
openingFiles[index] = Object.assign({}, openingFiles[index], { preopen: false });
return Object.assign({}, state, { openingFiles: [...openingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) });
}
else {
return state;
return Object.assign({}, state, { editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) });
}
case actionTypes.UPDATE_CONTENT:
openingFiles = state.openingFiles;
editorWrappers = [...state.editorWrappers];
let items = lodash_1.filter(openingFiles, item => item.resource === action.content.resource && !item.deleted);
items.forEach(item => {
const itemIndex = openingFiles.indexOf(item);
if (itemIndex !== -1) {
openingFiles[itemIndex] = Object.assign({}, openingFiles[itemIndex], { newValue: action.content.newValue, value: action.content.newValue });
}
});
return Object.assign({}, state, { openingFiles: [...openingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) });
case actionTypes.ACTIVATE_EDITOR:

@@ -519,3 +587,3 @@ index = state.editors.indexOf(action.editorId);

case actionTypes.UPDATE_EDITORS_HEIGHT:
return Object.assign({}, state, { editorsHeight: [...action.editorsHeight] });
return Object.assign({}, state, { editorWrappers: [...action.editorWrappers] });
case actionTypes.OPEN_MARKDOWN:

@@ -525,3 +593,3 @@ editorId = action.previewEditorId;

editors = lodash_1.clone(state.editors);
editorsHeight = state.editorsHeight;
editorWrappers = [...state.editorWrappers];
activeEditorId = editorId;

@@ -532,3 +600,3 @@ index = editors.indexOf(editorId);

editors.push(editorId);
editorsHeight.push({ editorId, height: 80 });
editorWrappers.push({ editorId, height: client_core_1.EDITOR_DEFAULT_HEIGHT });
}

@@ -549,3 +617,7 @@ else {

editingFiles.push(Object.assign({}, action.content, { name: `Preview ${action.content.name}`, preview: true, editorId }));
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorsHeight: [...editorsHeight] });
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) });
case actionTypes.CLOSE_ALL_EDITORS:
return initialEditState;
case actionTypes.SAVE_ALL_EDITORS:
return Object.assign({}, state, { allSave: action.allSave });
default:

@@ -581,2 +653,14 @@ return state;

/* 8 */
/***/ (function(module, exports) {
module.exports = require("@files-stack/client-core");
/***/ }),
/* 9 */
/***/ (function(module, exports) {
module.exports = require("@files-stack/core");
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {

@@ -636,3 +720,3 @@

/***/ }),
/* 9 */
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

@@ -659,4 +743,4 @@

});
exports.updateContentAction = (newValue) => ({
type: actionTypes.UPDATE_CONTENT, newValue,
exports.updateContentAction = (content) => ({
type: actionTypes.UPDATE_CONTENT, content,
});

@@ -666,4 +750,4 @@ exports.activateEditorAction = (editorId) => ({

});
exports.updateEditorsHeightAction = (editorsHeight) => ({
type: actionTypes.UPDATE_EDITORS_HEIGHT, editorsHeight,
exports.updateEditorsHeightAction = (editorWrappers) => ({
type: actionTypes.UPDATE_EDITORS_HEIGHT, editorWrappers,
});

@@ -676,6 +760,15 @@ exports.openMarkdownAction = (content, previewEditorId) => ({

});
exports.saveAllEditorAction = (allSave) => ({
type: actionTypes.SAVE_ALL_EDITORS, allSave,
});
exports.closeAllEditorAction = () => ({
type: actionTypes.CLOSE_ALL_EDITORS,
});
exports.keepOpenAction = (content) => ({
type: actionTypes.KEEP_OPEN_EDITOR, content,
});
/***/ }),
/* 10 */
/* 12 */
/***/ (function(module, exports, __webpack_require__) {

@@ -689,7 +782,7 @@

Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(11));
__export(__webpack_require__(13));
/***/ }),
/* 11 */
/* 13 */
/***/ (function(module, exports, __webpack_require__) {

@@ -696,0 +789,0 @@

@@ -21,3 +21,3 @@ export { Store } from './Store';

type: "@@files-stack/UPDATE_CONTENT";
newValue: string;
content: IContent;
} | {

@@ -28,3 +28,3 @@ type: "@@files-stack/ACTIVATE_EDITOR";

type: "@@files-stack/UPDATE_EDITORS_HEIGHT";
editorsHeight: any[];
editorWrappers: any[];
} | {

@@ -37,2 +37,10 @@ type: "@@files-stack/OPEN_MARKDOWN";

options: IFinderOptions;
} | {
type: "@@files-stack/SAVE_ALL_EDITORS";
allSave: boolean;
} | {
type: "@@files-stack/CLOSE_ALL_EDITORS";
} | {
type: "@@files-stack/KEEP_OPEN_EDITOR";
content: IContent;
}) => IEdit;

@@ -56,3 +64,3 @@ '@files/finderOptions': (state: IFinderOptions, action: {

type: "@@files-stack/UPDATE_CONTENT";
newValue: string;
content: IContent;
} | {

@@ -63,3 +71,3 @@ type: "@@files-stack/ACTIVATE_EDITOR";

type: "@@files-stack/UPDATE_EDITORS_HEIGHT";
editorsHeight: any[];
editorWrappers: any[];
} | {

@@ -72,2 +80,10 @@ type: "@@files-stack/OPEN_MARKDOWN";

options: IFinderOptions;
} | {
type: "@@files-stack/SAVE_ALL_EDITORS";
allSave: boolean;
} | {
type: "@@files-stack/CLOSE_ALL_EDITORS";
} | {
type: "@@files-stack/KEEP_OPEN_EDITOR";
content: IContent;
}) => IFinderOptions;

@@ -74,0 +90,0 @@ '@files/expand': (state: IFileExpand[], action: {

{
"name": "@files-stack/client-redux",
"version": "0.0.26",
"version": "0.0.27-0",
"description": "Files Redux consists of reducers and actions",

@@ -56,4 +56,4 @@ "main": "lib/index.js",

"dependencies": {
"@files-stack/client-core": "^0.0.26",
"@files-stack/core": "^0.0.26"
"@files-stack/client-core": "^0.0.27-0",
"@files-stack/core": "^0.0.27-0"
},

@@ -60,0 +60,0 @@ "peerDependencies": {

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