Skip to content

Commit

Permalink
wip: update sorensen and re-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Oct 22, 2024
1 parent d0a0326 commit 1d6f3a3
Show file tree
Hide file tree
Showing 10 changed files with 706 additions and 78 deletions.

This file was deleted.

651 changes: 651 additions & 0 deletions .yarn/patches/@sofie-automation-sorensen-npm-1.5.0-88bfc56810.patch

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@shared/models": "^0.12.0-alpha.5",
"@shared/server-lib": "^0.12.0-alpha.5",
"@shared/tsr-bridge": "^0.12.0-alpha.5",
"@sofie-automation/sorensen": "patch:@sofie-automation/sorensen@npm%3A1.4.3#~/.yarn/patches/@sofie-automation-sorensen-npm-1.4.3-a11a53b994.patch",
"@sofie-automation/sorensen": "patch:@sofie-automation/sorensen@npm%3A1.5.0#~/.yarn/patches/@sofie-automation-sorensen-npm-1.5.0-88bfc56810.patch",
"axios": "^1.7.7",
"bufferutil": "^4.0.8",
"classnames": "^2.5.1",
Expand Down
29 changes: 14 additions & 15 deletions apps/app/src/react/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '@fontsource/barlow-condensed/500.css'
import './styles/app.scss'
import { RundownView } from './components/rundown/RundownView.js'
import { Sidebar } from './components/sidebar/Sidebar.js'
import { sorensen } from '@sofie-automation/sorensen'
import { Sorensen } from '@sofie-automation/sorensen'
import { RealtimeDataProvider } from './api/RealtimeDataProvider.js'
import { ApiClient } from './api/ApiClient.js'
import { Project, SpecialLedgers } from '../models/project/Project.js'
Expand Down Expand Up @@ -245,14 +245,14 @@ export const App = observer(function App() {

debugKeyPressesLastTime.current = Date.now()
}
sorensen.bind('F12', onF12Key, {
Sorensen.bind('F12', onF12Key, {
up: false,
global: true,
exclusive: true,
preventDefaultPartials: false,
})
return () => {
sorensen.unbind('F12', onF12Key)
Sorensen.unbind('F12', onF12Key)
}
}, [sorensenInitialized, handleError, serverAPI])

Expand All @@ -265,13 +265,13 @@ export const App = observer(function App() {
if (document.activeElement?.tagName === 'INPUT') return
}

const activeKeys = sorensen.getPressedKeys().map<ActiveTrigger>((code) => {
const activeKeys = Sorensen.getPressedKeys().map<ActiveTrigger>((code) => {
return {
fullIdentifier: `keyboard-${code}`,
bridgeId: protectString(''),
deviceId: PERIPHERAL_KEYBOARD,
deviceName: '',
identifier: sorensen.getKeyForCode(code),
identifier: Sorensen.getKeyForCode(code),
}
})
triggers.setActiveKeys(activeKeys)
Expand Down Expand Up @@ -321,8 +321,7 @@ export const App = observer(function App() {

/* eslint-disable @typescript-eslint/unbound-method */
useEffect(() => {
sorensen
.init()
Sorensen.init()
.then(() => {
setSorensenInitialized(true)
})
Expand Down Expand Up @@ -479,15 +478,15 @@ export const App = observer(function App() {
}
}

sorensen.bind('Delete', onDeleteKey, {
Sorensen.bind('Delete', onDeleteKey, {
up: false,
global: true,
exclusive: true,
preventDefaultPartials: false,
})

return () => {
sorensen.unbind('Delete', onDeleteKey)
Sorensen.unbind('Delete', onDeleteKey)
}
}, [sorensenInitialized, handleError, gui, currentRundownId, deleteSelectedTimelineObjs])

Expand Down Expand Up @@ -534,24 +533,24 @@ export const App = observer(function App() {
setUserAgreementScreenOpen(false)
if (undoLedgerKey) serverAPI.redo({ key: undoLedgerKey }).catch(handleError)
}
sorensen.bind('Escape', onEscapeKey, {
Sorensen.bind('Escape', onEscapeKey, {
up: false,
global: true,
exclusive: true,
preventDefaultPartials: false,
})
sorensen.bind('Control+KeyZ', onUndo, {
Sorensen.bind('Control+KeyZ', onUndo, {
up: false,
global: true,
})
sorensen.bind('Control+KeyY', onRedo, {
Sorensen.bind('Control+KeyY', onRedo, {
up: false,
global: true,
})
return () => {
sorensen.unbind('Escape', onEscapeKey)
sorensen.unbind('Control+KeyZ', onUndo)
sorensen.unbind('Control+KeyY', onRedo)
Sorensen.unbind('Escape', onEscapeKey)
Sorensen.unbind('Control+KeyZ', onUndo)
Sorensen.unbind('Control+KeyY', onRedo)
}
}, [sorensenInitialized, handleError, gui, currentRundownId, serverAPI, undoLedgerKey])

Expand Down
8 changes: 4 additions & 4 deletions apps/app/src/react/components/rundown/GroupView/GroupView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useRef, useState, useContext, useCallback } from 'react'
import { sorensen } from '@sofie-automation/sorensen'
import { Sorensen } from '@sofie-automation/sorensen'
import { TrashBtn } from '../../inputs/TrashBtn.js'
import { GroupBase, GroupGUI } from '../../../../models/rundown/Group.js'
import { PartView } from './PartView.js'
Expand Down Expand Up @@ -146,7 +146,7 @@ export const GroupView: React.FC<{
)
return

const pressed = sorensen.getPressedKeys()
const pressed = Sorensen.getPressedKeys()
if (pressed.includes('ControlLeft') || pressed.includes('ControlRight')) {
// Add this group to the selection:
store.guiStore.toggleAddSelected({
Expand Down Expand Up @@ -416,7 +416,7 @@ export const GroupView: React.FC<{
ipcServer.deleteGroup({ rundownId, groupId: group.id }).catch(handleError)
}, [group.id, handleError, ipcServer, rundownId])
const handleDeleteClick = useCallback(() => {
const pressedKeys = sorensen.getPressedKeys()
const pressedKeys = Sorensen.getPressedKeys()
if (pressedKeys.includes('ControlLeft') || pressedKeys.includes('ControlRight')) {
// Delete immediately with no confirmation dialog.
handleDelete()
Expand All @@ -432,7 +432,7 @@ export const GroupView: React.FC<{

// Collapse button:
const handleCollapse = useCallback(() => {
const pressed = sorensen.getPressedKeys()
const pressed = Sorensen.getPressedKeys()
if (pressed.includes('AltLeft') || pressed.includes('AltRight')) {
ipcServer
.toggleAllGroupsCollapse({
Expand Down
18 changes: 9 additions & 9 deletions apps/app/src/react/components/rundown/GroupView/PartView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext, useLayoutEffect, useMemo, useRef, useState, useEffect, useCallback } from 'react'
import { isEmpty } from 'lodash-es'
import { sorensen } from '@sofie-automation/sorensen'
import { Sorensen } from '@sofie-automation/sorensen'
import { PlayHead } from './PlayHead.js'
import { Layer, LayerEmpty } from './Layer.js'
import {
Expand Down Expand Up @@ -125,7 +125,7 @@ export const PartView: React.FC<{
)
return

const pressed = sorensen.getPressedKeys()
const pressed = Sorensen.getPressedKeys()
if (pressed.includes('ControlLeft') || pressed.includes('ControlRight')) {
// Add this part to the selection:
store.guiStore.toggleAddSelected({
Expand Down Expand Up @@ -575,25 +575,25 @@ export const PartView: React.FC<{

useEffect(() => {
const onKey = () => {
const pressed = sorensen.getPressedKeys()
const pressed = Sorensen.getPressedKeys()
setBypassSnapping(pressed.includes('ShiftLeft') || pressed.includes('ShiftRight'))
}
onKey()

sorensen.bind('Shift', onKey, {
Sorensen.bind('Shift', onKey, {
up: false,
global: true,
})
sorensen.bind('Shift', onKey, {
Sorensen.bind('Shift', onKey, {
up: true,
global: true,
})

sorensen.addEventListener('keycancel', onKey)
Sorensen.addEventListener('keycancel', onKey)

return () => {
sorensen.unbind('Shift', onKey)
sorensen.removeEventListener('keycancel', onKey)
Sorensen.unbind('Shift', onKey)
Sorensen.removeEventListener('keycancel', onKey)
}
}, [hotkeyContext])

Expand Down Expand Up @@ -1360,7 +1360,7 @@ const EndCapHover: React.FC<{
disabled={groupOrPartLocked}
title={'Delete Part' + (groupOrPartLocked ? ' (disabled due to locked Part or Group)' : '')}
onClick={() => {
const pressedKeys = sorensen.getPressedKeys()
const pressedKeys = Sorensen.getPressedKeys()
if (pressedKeys.includes('ControlLeft') || pressedKeys.includes('ControlRight')) {
// Delete immediately with no confirmation dialog.
handleDelete()
Expand Down
22 changes: 11 additions & 11 deletions apps/app/src/react/components/rundown/GroupView/TimelineObject.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sorensen } from '@sofie-automation/sorensen'
import { Sorensen } from '@sofie-automation/sorensen'
import { describeTimelineObject } from '../../../../lib/TimelineObj.js'
import { DeltaPosition, Position, useMovable } from '../../../../lib/useMovable.js'
import { TimelineObj } from '../../../../models/rundown/TimelineObj.js'
Expand Down Expand Up @@ -203,7 +203,7 @@ export const TimelineObject: React.FC<{

useEffect(() => {
const onKey = () => {
const pressed = sorensen.getPressedKeys()
const pressed = Sorensen.getPressedKeys()
setAllowDuplicate(pressed.includes('AltLeft') || pressed.includes('AltRight'))

// Debounce to let setAllowDuplicate update:
Expand All @@ -214,30 +214,30 @@ export const TimelineObject: React.FC<{
}
onKey()

sorensen.bind('Shift', onKey, {
Sorensen.bind('Shift', onKey, {
up: false,
global: true,
})
sorensen.bind('Shift', onKey, {
Sorensen.bind('Shift', onKey, {
up: true,
global: true,
})

sorensen.bind('Alt', onKey, {
Sorensen.bind('Alt', onKey, {
up: false,
global: true,
})
sorensen.bind('Alt', onKey, {
Sorensen.bind('Alt', onKey, {
up: true,
global: true,
})

sorensen.addEventListener('keycancel', onKey)
Sorensen.addEventListener('keycancel', onKey)

return () => {
sorensen.unbind('Shift', onKey)
sorensen.unbind('Alt', onKey)
sorensen.removeEventListener('keycancel', onKey)
Sorensen.unbind('Shift', onKey)
Sorensen.unbind('Alt', onKey)
Sorensen.removeEventListener('keycancel', onKey)
}
}, [hotkeyContext, move])

Expand All @@ -251,7 +251,7 @@ export const TimelineObject: React.FC<{
wasMoving.current = false
}

const pressed = sorensen.getPressedKeys()
const pressed = Sorensen.getPressedKeys()
if (pressed.includes('ControlLeft') || pressed.includes('ControlRight')) {
// Add this timline-object to the selection:
store.guiStore.toggleAddSelected({
Expand Down
10 changes: 5 additions & 5 deletions apps/app/src/react/components/rundown/RundownView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'
import { sorensen } from '@sofie-automation/sorensen'
import { Sorensen } from '@sofie-automation/sorensen'
import { GroupView } from './GroupView/GroupView.js'
import { IPCServerContext } from '../../contexts/IPCServer.js'
import { useDrop } from 'react-dnd'
Expand Down Expand Up @@ -148,18 +148,18 @@ export const RundownView: React.FC<{ mappings: Mappings }> = observer(function R
}
}
// Select All
sorensen.bind('Control+KeyA', onKeySelectAll, {
Sorensen.bind('Control+KeyA', onKeySelectAll, {
up: false,
global: true,
})
sorensen.bind('Command+KeyA', onKeySelectAll, {
Sorensen.bind('Command+KeyA', onKeySelectAll, {
up: false,
global: true,
})

return () => {
sorensen.unbind('Control+KeyA', onKeySelectAll)
sorensen.unbind('Command+KeyA', onKeySelectAll)
Sorensen.unbind('Control+KeyA', onKeySelectAll)
Sorensen.unbind('Command+KeyA', onKeySelectAll)
}
}, [currentRundownId])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { useMemoComputedArray, useMemoComputedObject, useMemoComputedValue } fro
import classNames from 'classnames'
import { ScrollWatcher } from '../rundown/ScrollWatcher/ScrollWatcher.js'
import { computed } from 'mobx'
import { sorensen } from '@sofie-automation/sorensen'
import { Sorensen } from '@sofie-automation/sorensen'
import { CB } from '../../lib/errorHandling.js'
import { SmallCheckbox } from '../util/SmallCheckbox.js'

Expand Down Expand Up @@ -245,7 +245,7 @@ export const SidebarResourceLibrary: React.FC = observer(function SidebarResourc
const selectedResourceIds = store.guiStore.resourceLibrary.selectedResourceIds
let lastSelectedResourceId = store.guiStore.resourceLibrary.lastSelectedResourceId

const pressed = sorensen.getPressedKeys()
const pressed = Sorensen.getPressedKeys()
if (pressed.includes('ControlLeft') || pressed.includes('ControlRight')) {
// Add this group to the selection, or remove it if it's already there:
const foundIndex = selectedResourceIds.indexOf(resource.id)
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2869,17 +2869,17 @@ __metadata:
languageName: node
linkType: hard

"@sofie-automation/sorensen@npm:1.4.3":
version: 1.4.3
resolution: "@sofie-automation/sorensen@npm:1.4.3"
checksum: 10c0/d9b9d739acd009a3ca1b3025d10cca7e152ae244795faf7019e6616ad6f442aff2d8b58ca48487bd9d9d170703458fc46e370523607cd1ce9d73c0af6e428c36
"@sofie-automation/sorensen@npm:1.5.0":
version: 1.5.0
resolution: "@sofie-automation/sorensen@npm:1.5.0"
checksum: 10c0/bf4815ae54c1cbbe0faefca94519675a038a19458b3fd4f07d4c28f9729c1bbcc006e51e27a22ec7cc974c3d333ec3d01b2ae775ae2fd77a72cf625a8874d571
languageName: node
linkType: hard

"@sofie-automation/sorensen@patch:@sofie-automation/sorensen@npm%3A1.4.3#~/.yarn/patches/@sofie-automation-sorensen-npm-1.4.3-a11a53b994.patch":
version: 1.4.3
resolution: "@sofie-automation/sorensen@patch:@sofie-automation/sorensen@npm%3A1.4.3#~/.yarn/patches/@sofie-automation-sorensen-npm-1.4.3-a11a53b994.patch::version=1.4.3&hash=41d8d9"
checksum: 10c0/c707b79aad46291a350ef3fc763d40ef9bfc052a72c5b5eefaaef35512e650a7ca740e65183aaa5e53fb8c1300ce3facd209f186acc8d964f7832ef60f48f483
"@sofie-automation/sorensen@patch:@sofie-automation/sorensen@npm%3A1.5.0#~/.yarn/patches/@sofie-automation-sorensen-npm-1.5.0-88bfc56810.patch":
version: 1.5.0
resolution: "@sofie-automation/sorensen@patch:@sofie-automation/sorensen@npm%3A1.5.0#~/.yarn/patches/@sofie-automation-sorensen-npm-1.5.0-88bfc56810.patch::version=1.5.0&hash=ae12e3"
checksum: 10c0/bccb0edd166b8ea619692410c91cf1c2ce1d6a64f5bb92be392c81334a1b9478ad6490f15eee9760b88050f0e72a04c12d3df371fea89de207602634e555d01e
languageName: node
linkType: hard

Expand Down Expand Up @@ -14535,7 +14535,7 @@ asn1@evs-broadcast/node-asn1:
"@shared/models": "npm:^0.12.0-alpha.5"
"@shared/server-lib": "npm:^0.12.0-alpha.5"
"@shared/tsr-bridge": "npm:^0.12.0-alpha.5"
"@sofie-automation/sorensen": "patch:@sofie-automation/sorensen@npm%3A1.4.3#~/.yarn/patches/@sofie-automation-sorensen-npm-1.4.3-a11a53b994.patch"
"@sofie-automation/sorensen": "patch:@sofie-automation/sorensen@npm%3A1.5.0#~/.yarn/patches/@sofie-automation-sorensen-npm-1.5.0-88bfc56810.patch"
"@types/deep-extend": "npm:0.6.2"
"@types/jest": "npm:^29.5.13"
"@types/koa": "npm:^2.15.0"
Expand Down

0 comments on commit 1d6f3a3

Please sign in to comment.