Skip to content

Commit

Permalink
Merge branch 'master' into #736-block-some-tools-if-they-are-applied-…
Browse files Browse the repository at this point in the history
…to-FG

# Conflicts:
#	packages/ketcher-react/src/script/editor/tool/apoint.js
#	packages/ketcher-react/src/script/editor/tool/chain.js
#	packages/ketcher-react/src/script/editor/tool/charge.js
#	packages/ketcher-react/src/script/editor/tool/eraser.js
#	packages/ketcher-react/src/script/editor/tool/rgroupatom.js
  • Loading branch information
Kirill Kapytov authored and Kirill Kapytov committed Oct 18, 2021
2 parents 3eca8a4 + 0974cf0 commit f235308
Show file tree
Hide file tree
Showing 87 changed files with 738 additions and 172 deletions.
2 changes: 1 addition & 1 deletion packages/ketcher-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"node": ">=10"
},
"scripts": {
"build": "cross-env NODE_ENV=production rollup -c -m true --silent",
"build": "cross-env NODE_ENV=production rollup -c -m true",
"start": "cross-env NODE_ENV=development rollup -c -m true -w",
"test": "run-s prettier test:lint test:unit",
"test:lint": "eslint src --ext .ts,.tsx,.js,.jsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
***************************************************************************/

import { BaseOperation } from '../operations/base'
import { ReStruct } from 'ketcher-core'
import { ReStruct } from '../../render'
//
// Undo/redo actions
//
class Action {
export class Action {
operations: BaseOperation[]

constructor(operations = []) {
Expand Down Expand Up @@ -62,5 +62,3 @@ class Action {
)
}
}

export default Action
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
***************************************************************************/

import { Bond, MolSerializer } from 'ketcher-core'

import Action from '../shared/action'
import { Action } from './action'
import { Bond } from 'domain/entities'
import { BondAttr } from '../operations'
import { MolSerializer } from 'domain/serializers'

/**
* @param restruct { ReStruct }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/

import { Atom, Bond, RGroup } from 'ketcher-core'
import { Atom, Bond, RGroup } from 'domain/entities'
import {
AtomAdd,
AtomAttr,
Expand All @@ -33,7 +33,7 @@ import { atomGetAttr, atomGetDegree, atomGetSGroups } from './utils'
import { fromRGroupFragment, fromUpdateIfThen } from './rgroup'
import { removeAtomFromSgroupIfNeeded, removeSgroupIfNeeded } from './sgroup'

import Action from '../shared/action'
import { Action } from './action'
import { fromBondStereoUpdate } from './bond'
import { without } from 'lodash/fp'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { AlignDescriptors, CanvasLoad } from '../operations'

import Action from '../shared/action'
import { Action } from './action'

export function fromNewCanvas(restruct, struct) {
var action = new Action()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ import {
Atom,
Bond,
Neighbor,
ReStruct,
StereoLabel,
StereoValidator,
Struct,
Vec2
} from 'ketcher-core'
} from 'domain/entities'
import {
AtomAdd,
AtomAttr,
Expand All @@ -42,7 +40,9 @@ import {
mergeSgroups
} from './atom'

import Action from '../shared/action'
import { Action } from './action'
import { ReStruct } from '../../render'
import { StereoValidator } from 'domain/helpers'
import utils from '../shared/utils'

export function fromBondAddition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import { AtomAdd, FragmentAdd } from '../operations'

import Action from '../shared/action'
import { Vec2 } from 'ketcher-core'
import { Action } from './action'
import { Vec2 } from 'domain/entities'
import { atomGetAttr } from './utils'
import { fromBondAddition } from './bond'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/

import Action from '../shared/action'
import { Action } from './action'
import { fromAtomMerge } from './atom'
import { fromBondsMerge } from './bond'
import utils from '../shared/utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/

import { Atom, Bond, RGroup } from 'ketcher-core'
import { Atom, Bond, RGroup } from 'domain/entities'
import {
AtomAttr,
AtomDelete,
Expand All @@ -31,7 +31,7 @@ import {
removeSgroupIfNeeded
} from './sgroup'

import Action from '../shared/action'
import { Action } from './action'
import { Pile } from 'ketcher-core'
import { atomGetDegree } from './utils'
import { fromBondStereoUpdate } from '../actions/bond'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import {
SimpleObjectMove,
TextMove
} from '../operations'
import { Pile, RGroup, Vec2 } from 'ketcher-core'
import { Pile, RGroup, Vec2 } from 'domain/entities'
import { fromRGroupFragment, fromUpdateIfThen } from './rgroup'

import Action from '../shared/action'
import { Action } from './action'
import { fromAtomsFragmentAttr } from './atom'
import { getRelSgroupsBySelection } from './utils'

Expand Down Expand Up @@ -129,7 +129,7 @@ export function fromMultipleMove(restruct, lists, d) {
return action.perform(restruct)
}

export function fromStereoFlagUpdate(restruct, frid, flag) {
export function fromStereoFlagUpdate(restruct, frid, flag = null) {
const action = new Action()

if (!flag) {
Expand Down
18 changes: 18 additions & 0 deletions packages/ketcher-core/src/application/editor/actions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export * from './action'
export * from './aromatic-fusing'
export * from './atom'
export * from './basic'
export * from './bond'
export * from './chain'
export * from './closely-fusing'
export * from './erase'
export * from './fragment'
export * from './paste'
export * from './reaction'
export * from './rgroup'
export * from './rotate'
export * from './sgroup'
export * from './simpleobject'
export * from './template'
export * from './text'
export * from './utils'
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
} from '../operations'
import { fromRGroupAttrs, fromUpdateIfThen } from './rgroup'

import Action from '../shared/action'
import { Vec2 } from 'ketcher-core'
import { Action } from './action'
import { Vec2 } from 'domain/entities'
import { fromSgroupAddition } from './sgroup'

export function fromPaste(restruct, pstruct, point, angle = 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
RxnPlusDelete
} from '../operations'

import Action from '../shared/action'
import { Action } from './action'

export function fromArrowAddition(restruct, pos, mode) {
const action = new Action()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { RGroupAttr, RGroupFragment, UpdateIfThen } from '../operations'

import Action from '../shared/action'
import { Action } from './action'

export function fromRGroupAttrs(restruct, id, attrs) {
const action = new Action()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ import {
RxnPlusMove,
SGroupDataMove
} from '../operations'
import { Bond, Pile, Vec2 } from 'ketcher-core'
import { Bond, Fragment, Pile, Vec2 } from 'domain/entities'
import { getRelSgroupsBySelection, structSelection } from './utils'

import Action from '../shared/action'
import { Fragment } from 'ketcher-core'
import { Action } from './action'
import utils from '../shared/utils'

export function fromFlip(restruct, selection, dir, center) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import {
SGroupDelete,
SGroupRemoveFromHierarchy
} from '../operations'
import { Pile, SGroup } from 'ketcher-core'
import { Pile, SGroup } from 'domain/entities'
import { atomGetAttr, atomGetDegree, atomGetSGroups } from './utils'

import Action from '../shared/action'
import { Action } from './action'
import { SgContexts } from '../shared/constants'
import { uniq } from 'lodash/fp'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
SimpleObjectResize
} from '../operations'

import Action from '../shared/action'
import { Action } from './action'

export function fromSimpleObjectDeletion(restruct, id) {
const action = new Action()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
***************************************************************************/

import { Atom, Vec2 } from 'ketcher-core'
import { Atom, Vec2 } from 'domain/entities'
import { AtomAdd, BondAdd, CalcImplicitH } from '../operations'
import { atomForNewBond, atomGetAttr } from './utils'
import { fromAtomsAttrs, mergeSgroups } from './atom'
import { fromBondAddition, fromBondStereoUpdate, fromBondsAttrs } from './bond'

import Action from '../shared/action'
import { Action } from './action'
import closest from '../shared/closest'
import { fromAromaticTemplateOnBond } from './aromatic-fusing'
import { fromPaste } from './paste'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
* limitations under the License.
***************************************************************************/

import { ReStruct, Vec2 } from 'ketcher-core'
import { TextCreate, TextDelete, TextUpdate } from '../operations'

import Action from '../shared/action'
import { Action } from './action'
import { ReStruct } from '../../render'
import { Vec2 } from 'domain/entities'

export function fromTextCreation(
restruct: ReStruct,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
***************************************************************************/

import { Bond } from 'ketcher-core'
import { Vec2 } from 'ketcher-core'
import { Bond, Vec2 } from 'domain/entities'

import closest from '../shared/closest'
import { difference } from 'lodash'

Expand Down
4 changes: 3 additions & 1 deletion packages/ketcher-core/src/application/editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/

export * from './operations'
export * from './actions'
export * from './shared/constants'
export * from './editor.types'
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
***************************************************************************/

import { ReStruct, Struct } from 'ketcher-core'

import { BaseOperation } from './base'
import { OperationType } from './OperationType'
import { ReStruct } from '../../render'
import { Struct } from 'domain/entities'

export class CanvasLoad extends BaseOperation {
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
* limitations under the License.
***************************************************************************/

import { Fragment, ReStruct, Vec2 } from 'ketcher-core'
import { Fragment, Vec2 } from 'domain/entities'

import { BaseOperation } from './base'
import { OperationType } from './OperationType'
import { ReStruct } from '../../render'

export class EnhancedFlagMove extends BaseOperation {
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { BaseOperation } from './base'
import { OperationType } from './OperationType'
import { ReStruct } from 'ketcher-core'
import { ReStruct } from '../../render'

export class FragmentStereoFlag extends BaseOperation {
frid: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
***************************************************************************/

import { ReStruct, Scale } from 'ketcher-core'

import { BaseOperation } from './base'
import { OperationType } from './OperationType'
import { ReStruct } from '../../render'
import { Scale } from 'domain/helpers'

export class LoopMove extends BaseOperation {
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
***************************************************************************/

import { ReStruct, ReText, Text, Vec2 } from 'ketcher-core'
import { ReStruct, ReText } from '../../../render'
import { Text, Vec2 } from 'domain/entities'

import { BaseOperation } from '../base'
import { OperationType } from '../OperationType'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
***************************************************************************/

import { ReStruct, Scale } from 'ketcher-core'

import { BaseOperation } from '../base'
import { OperationType } from '../OperationType'
import { ReStruct } from '../../../render'
import { Scale } from 'domain/helpers'

interface TextMoveData {
id: any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { BaseOperation } from '../base'
import { OperationType } from '../OperationType'
import { ReStruct } from 'ketcher-core'
import { ReStruct } from '../../../render'

interface TextUpdateData {
id: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { BaseOperation } from '../base'
import { OperationType } from '../OperationType'
import { ReStruct } from 'ketcher-core'
import { ReStruct } from '../../../render'

type Data = {
aid?: any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
***************************************************************************/

import { ReStruct, Scale } from 'ketcher-core'

import { BaseOperation } from '../base'
import { OperationType } from '../OperationType'
import { ReStruct } from '../../../render'
import { Scale } from 'domain/helpers'

export class AtomMove extends BaseOperation {
data: {
Expand Down
Loading

0 comments on commit f235308

Please sign in to comment.