Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: publish v1.10.20 #1015

Merged
merged 4 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## v1.10.19

- fix(types): import plugins for module augmentations #933

## v1.10.19

- fix(core/scope): remove duplicate Interactable super.unset
- fix(utils/pointerExtend): skip all vendor-prefixed props. Close #978

Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interactjs/_dev",
"version": "1.10.19",
"version": "1.10.20",
"private": true,
"directories": {
"bin": "./bin"
Expand Down Expand Up @@ -34,16 +34,17 @@
"@types/node": "^17.0.42",
"@types/react": "^18.0.12",
"@types/shelljs": "^0.8.11",
"@types/symbol-tree": "^3.2.3",
"@types/tape": "^4.13.2",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/eslint-plugin-tslint": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"@vitejs/plugin-vue": "^2.3.3",
"@vue/babel-plugin-jsx": "^1.1.1",
"@vue/compiler-sfc": "^3.2.37",
"@vue/reactivity": "^3.2.37",
"@vue/runtime-dom": "^3.2.37",
"@vue/test-utils": "^2.0.0",
"@vue/compiler-sfc": "^3.3.4",
"@vue/reactivity": "^3.3.4",
"@vue/runtime-dom": "^3.3.4",
"@vue/test-utils": "^2.4.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-plugin-syntax-jsx": "^6.18.0",
"babelify": "^10.0.0",
Expand Down Expand Up @@ -96,15 +97,16 @@
"typescript": "^4.7.3",
"vijest": "^0.0.1",
"vite": "^4.1.4",
"vue": "^3.2.37",
"vue": "^3.3.4",
"yargs": "^17.5.1"
},
"engines": {
"node": ">=8"
},
"sideEffects": false,
"lint-staged": {
"**/*.((ts|js)?(x)|vue|md)": "bin/_lint --fix"
"**/*.((ts|js)?(x)|vue|md)": "bin/_lint --fix",
"**/*.(yaml|json|css)": "prettier --write"
},
"license": "MIT"
}
4 changes: 2 additions & 2 deletions packages/@interactjs/actions/drop/drop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('actions/drop', () => {
})

const onActionsDropStart = jest.fn((arg: { interaction: Interaction }) => {
const activeDrops = [...arg.interaction.dropState.activeDrops]
const activeDrops = [...arg.interaction.dropState!.activeDrops]
// actions/drop:start is fired with all activeDrops
expect(activeDrops.map((activeDrop) => activeDrop.element)).toEqual([dropEl3])
})
Expand All @@ -92,7 +92,7 @@ describe('actions/drop', () => {
expect(onActionsDropStart).toHaveBeenCalledTimes(1)

// rejected dropzones are removed from activeDrops,
expect(interaction.dropState.activeDrops.map((d) => d.element)).toEqual([dropEl3])
expect(interaction.dropState!.activeDrops.map((d) => d.element)).toEqual([dropEl3])

// rejected dropzones are deactivated,
expect(onDeactivate).toHaveBeenNthCalledWith(1, expect.objectContaining({ target: dropEl1 }))
Expand Down
74 changes: 39 additions & 35 deletions packages/@interactjs/actions/drop/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ import is from '@interactjs/utils/is'
import normalizeListeners from '@interactjs/utils/normalizeListeners'
import * as pointerUtils from '@interactjs/utils/pointerUtils'

/* eslint-disable import/no-duplicates -- for typescript module augmentations */
import '../drag/plugin'

import type { DragEvent } from '../drag/plugin'
import drag from '../drag/plugin'
/* eslint-enable import/no-duplicates */

import { DropEvent } from './DropEvent'

Expand Down Expand Up @@ -239,7 +243,7 @@ function install (scope: Scope) {

return interact
}
return scope.dynamicDrop
return scope.dynamicDrop!
}

extend(actions.phaselessTypes, {
Expand Down Expand Up @@ -327,30 +331,28 @@ function getActiveDrops (scope: Scope, dragElement: Element) {
}

function getDrop (
{ dropState, interactable: draggable, element: dragElement }: Partial<Interaction>,
{ dropState, interactable: draggable, element: dragElement }: Interaction,
dragEvent,
pointerEvent,
) {
const validDrops = []
const validDrops: Element[] = []

// collect all dropzones and their elements which qualify for a drop
for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {
validDrops.push(
dropzone.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, rect)
? dropzoneElement
: null,
)
for (const { dropzone, element: dropzoneElement, rect } of dropState!.activeDrops) {
if (dropzone.dropCheck(dragEvent, pointerEvent, draggable!, dragElement!, dropzoneElement, rect)) {
validDrops.push(dropzoneElement)
}
}

// get the most appropriate dropzone based on DOM depth and order
const dropIndex = domUtils.indexOfDeepestElement(validDrops)

return dropState.activeDrops[dropIndex] || null
return dropState!.activeDrops[dropIndex] || null
}

function getDropEvents (interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {
const { dropState } = interaction
const dropEvents = {
const dropState = interaction.dropState!
const dropEvents: Record<string, DropEvent | null> = {
enter: null,
leave: null,
activate: null,
Expand All @@ -362,14 +364,14 @@ function getDropEvents (interaction: Interaction, _pointerEvent, dragEvent: Drag
if (dragEvent.type === 'dragstart') {
dropEvents.activate = new DropEvent(dropState, dragEvent, 'dropactivate')

dropEvents.activate.target = null
dropEvents.activate.dropzone = null
dropEvents.activate.target = null as never
dropEvents.activate.dropzone = null as never
}
if (dragEvent.type === 'dragend') {
dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')

dropEvents.deactivate.target = null
dropEvents.deactivate.dropzone = null
dropEvents.deactivate.target = null as never
dropEvents.deactivate.dropzone = null as never
}

if (dropState.rejected) {
Expand Down Expand Up @@ -402,7 +404,6 @@ function getDropEvents (interaction: Interaction, _pointerEvent, dragEvent: Drag
if (dragEvent.type === 'dragmove' && dropState.cur.dropzone) {
dropEvents.move = new DropEvent(dropState, dragEvent, 'dropmove')

dropEvents.move.dragmove = dragEvent
dragEvent.dropzone = dropState.cur.dropzone
}

Expand All @@ -414,7 +415,7 @@ Record<'leave' | 'enter' | 'move' | 'drop' | 'activate' | 'deactivate', DropEven
>

function fireDropEvents (interaction: Interaction, events: FiredDropEvents) {
const { dropState } = interaction
const dropState = interaction.dropState!
const { activeDrops, cur, prev } = dropState

if (events.leave) {
Expand Down Expand Up @@ -443,10 +444,10 @@ function onEventCreated ({ interaction, iEvent, event }: DoPhaseArg<'drag', Even
return
}

const { dropState } = interaction
const dropState = interaction.dropState!

if (scope.dynamicDrop) {
dropState.activeDrops = getActiveDrops(scope, interaction.element)
dropState.activeDrops = getActiveDrops(scope, interaction.element!)
}

const dragEvent = iEvent
Expand Down Expand Up @@ -486,7 +487,9 @@ function dropzoneMethod (interactable: Interactable, options?: DropzoneOptions |
return acc
}, {})

interactable.off(interactable.options.drop.listeners)
const prevListeners = interactable.options.drop.listeners
prevListeners && interactable.off(prevListeners)

interactable.on(corrected)
interactable.options.drop.listeners = corrected
}
Expand Down Expand Up @@ -642,12 +645,12 @@ const drop: Plugin = {
return
}

const { dropState } = interaction
const dropState = interaction.dropState!

// reset active dropzones
dropState.activeDrops = null
dropState.events = null
dropState.activeDrops = getActiveDrops(scope, interaction.element)
dropState.activeDrops = []
dropState.events = {}
dropState.activeDrops = getActiveDrops(scope, interaction.element!)
dropState.events = getDropEvents(interaction, event, dragEvent)

if (dropState.events.activate) {
Expand All @@ -666,10 +669,11 @@ const drop: Plugin = {
return
}

fireDropEvents(interaction, interaction.dropState.events)
const dropState = interaction.dropState!
fireDropEvents(interaction, dropState.events)

scope.fire('actions/drop:move', { interaction, dragEvent })
interaction.dropState.events = {}
dropState.events = {}
},

'interactions:action-end': (arg: DoPhaseArg<'drag', EventPhase>, scope) => {
Expand All @@ -680,7 +684,7 @@ const drop: Plugin = {
const { interaction, iEvent: dragEvent } = arg

onEventCreated(arg, scope)
fireDropEvents(interaction, interaction.dropState.events)
fireDropEvents(interaction, interaction.dropState!.events)
scope.fire('actions/drop:end', { interaction, dragEvent })
},

Expand All @@ -692,12 +696,12 @@ const drop: Plugin = {
const { dropState } = interaction

if (dropState) {
dropState.activeDrops = null
dropState.events = null
dropState.cur.dropzone = null
dropState.cur.element = null
dropState.prev.dropzone = null
dropState.prev.element = null
dropState.activeDrops = null as never
dropState.events = null as never
dropState.cur.dropzone = null as never
dropState.cur.element = null as never
dropState.prev.dropzone = null as never
dropState.prev.element = null as never
dropState.rejected = false
}
},
Expand All @@ -708,7 +712,7 @@ const drop: Plugin = {
fireDropEvents,
defaults: {
enabled: false,
accept: null,
accept: null as never,
overlap: 'pointer',
} as DropzoneOptions,
}
Expand Down
8 changes: 4 additions & 4 deletions packages/@interactjs/actions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interactjs/actions",
"version": "1.10.19",
"version": "1.10.20",
"main": "index",
"module": "index",
"type": "module",
Expand All @@ -10,11 +10,11 @@
"directory": "packages/@interactjs/actions"
},
"peerDependencies": {
"@interactjs/core": "1.10.19",
"@interactjs/utils": "1.10.19"
"@interactjs/core": "1.10.20",
"@interactjs/utils": "1.10.20"
},
"optionalDependencies": {
"@interactjs/interact": "1.10.19"
"@interactjs/interact": "1.10.20"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/@interactjs/actions/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Scope } from '@interactjs/core/scope'

/* eslint-disable import/no-duplicates */
/* eslint-disable import/no-duplicates -- for typescript module augmentations */
import './drag/plugin'
import './drop/plugin'
import './gesture/plugin'
Expand Down
6 changes: 3 additions & 3 deletions packages/@interactjs/auto-scroll/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interactjs/auto-scroll",
"version": "1.10.19",
"version": "1.10.20",
"main": "index",
"module": "index",
"type": "module",
Expand All @@ -10,10 +10,10 @@
"directory": "packages/@interactjs/auto-scroll"
},
"peerDependencies": {
"@interactjs/utils": "1.10.19"
"@interactjs/utils": "1.10.20"
},
"optionalDependencies": {
"@interactjs/interact": "1.10.19"
"@interactjs/interact": "1.10.20"
},
"publishConfig": {
"access": "public"
Expand Down
3 changes: 3 additions & 0 deletions packages/@interactjs/auto-start/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import extend from '@interactjs/utils/extend'
import is from '@interactjs/utils/is'
import { copyAction } from '@interactjs/utils/misc'

/* eslint-disable import/no-duplicates -- for typescript module augmentations */
import './InteractableMethods'
import InteractableMethods from './InteractableMethods'
/* eslint-enable import/no-duplicates */

declare module '@interactjs/core/InteractStatic' {
export interface InteractStatic {
Expand Down
3 changes: 3 additions & 0 deletions packages/@interactjs/auto-start/hold.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type Interaction from '@interactjs/core/Interaction'
import type { Scope, Plugin } from '@interactjs/core/scope'

/* eslint-disable import/no-duplicates -- for typescript module augmentations */
import './base'
import basePlugin from './base'
/* eslint-enable */

declare module '@interactjs/core/options' {
interface PerActionDefaults {
Expand Down
8 changes: 4 additions & 4 deletions packages/@interactjs/auto-start/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interactjs/auto-start",
"version": "1.10.19",
"version": "1.10.20",
"main": "index",
"module": "index",
"type": "module",
Expand All @@ -10,11 +10,11 @@
"directory": "packages/@interactjs/auto-start"
},
"peerDependencies": {
"@interactjs/core": "1.10.19",
"@interactjs/utils": "1.10.19"
"@interactjs/core": "1.10.20",
"@interactjs/utils": "1.10.20"
},
"optionalDependencies": {
"@interactjs/interact": "1.10.19"
"@interactjs/interact": "1.10.20"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 6 additions & 0 deletions packages/@interactjs/auto-start/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import type { Scope } from '@interactjs/core/scope'

/* eslint-disable import/no-duplicates -- for typescript module augmentations */
import './base'
import './dragAxis'
import './hold'

import autoStart from './base'
import dragAxis from './dragAxis'
import hold from './hold'
/* eslint-enable import/no-duplicates */

export default {
id: 'auto-start',
Expand Down
Loading