remove deprecated .observe() from components (#246)
This commit is contained in:
parent
c309e5842d
commit
f9792ae3d8
|
@ -44,7 +44,7 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import { splice, push } from 'svelte-extras'
|
import { splice, push, observe } from 'svelte-extras'
|
||||||
|
|
||||||
const TIME_TO_SHOW_TOAST = 5000
|
const TIME_TO_SHOW_TOAST = 5000
|
||||||
const DELAY_BETWEEN_TOASTS = 1000
|
const DELAY_BETWEEN_TOASTS = 1000
|
||||||
|
@ -65,6 +65,7 @@
|
||||||
messages: []
|
messages: []
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
push,
|
push,
|
||||||
splice,
|
splice,
|
||||||
say (text) {
|
say (text) {
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
import {
|
import {
|
||||||
searchAccountsByUsername as searchAccountsByUsernameInDatabase
|
searchAccountsByUsername as searchAccountsByUsernameInDatabase
|
||||||
} from '../../_database/accountsAndRelationships'
|
} from '../../_database/accountsAndRelationships'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
const SEARCH_RESULTS_LIMIT = 4
|
const SEARCH_RESULTS_LIMIT = 4
|
||||||
const DATABASE_SEARCH_RESULTS_LIMIT = 30
|
const DATABASE_SEARCH_RESULTS_LIMIT = 30
|
||||||
|
@ -107,6 +108,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
once,
|
once,
|
||||||
onClick (item) {
|
onClick (item) {
|
||||||
this.fire('autosuggestItemSelected')
|
this.fire('autosuggestItemSelected')
|
||||||
|
|
|
@ -115,6 +115,7 @@
|
||||||
import { postStatus, insertHandleForReply, setReplySpoiler, setReplyVisibility } from '../../_actions/compose'
|
import { postStatus, insertHandleForReply, setReplySpoiler, setReplyVisibility } from '../../_actions/compose'
|
||||||
import { importShowComposeDialog } from '../dialog/asyncDialogs'
|
import { importShowComposeDialog } from '../dialog/asyncDialogs'
|
||||||
import { classname } from '../../_utils/classname'
|
import { classname } from '../../_utils/classname'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -191,6 +192,7 @@
|
||||||
slide
|
slide
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
async onClickPostButton () {
|
async onClickPostButton () {
|
||||||
let { sticky } = this.get()
|
let { sticky } = this.get()
|
||||||
if (sticky) {
|
if (sticky) {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
import { store } from '../../_store/store'
|
import { store } from '../../_store/store'
|
||||||
import debounce from 'lodash-es/debounce'
|
import debounce from 'lodash-es/debounce'
|
||||||
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
rawText: ''
|
rawText: ''
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
setupSyncFromStore () {
|
setupSyncFromStore () {
|
||||||
this.observe('contentWarning', contentWarning => {
|
this.observe('contentWarning', contentWarning => {
|
||||||
this.set({rawText: contentWarning})
|
this.set({rawText: contentWarning})
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
import { selectionChange } from '../../_utils/events'
|
import { selectionChange } from '../../_utils/events'
|
||||||
import { clickSelectedAutosuggestionUsername } from '../../_actions/compose'
|
import { clickSelectedAutosuggestionUsername } from '../../_actions/compose'
|
||||||
import { clickSelectedAutosuggestionEmoji } from '../../_actions/emoji'
|
import { clickSelectedAutosuggestionEmoji } from '../../_actions/emoji'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
this.teardownAutosize()
|
this.teardownAutosize()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
setupSyncFromStore () {
|
setupSyncFromStore () {
|
||||||
let textarea = this.refs.textarea
|
let textarea = this.refs.textarea
|
||||||
let firstTime = true
|
let firstTime = true
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
import { store } from '../../_store/store'
|
import { store } from '../../_store/store'
|
||||||
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -49,6 +50,9 @@
|
||||||
let int = Math.round(Math.min(CHAR_LIMIT, length) / CHAR_LIMIT * 100)
|
let int = Math.round(Math.min(CHAR_LIMIT, length) / CHAR_LIMIT * 100)
|
||||||
return (int - (int % 2)) / 100
|
return (int - (int % 2)) / 100
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
observe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -20,6 +20,7 @@
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
import { store } from '../../_store/store'
|
import { store } from '../../_store/store'
|
||||||
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -48,6 +49,9 @@
|
||||||
return `${lengthToDisplayDeferred} characters remaining`
|
return `${lengthToDisplayDeferred} characters remaining`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
observe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -79,6 +79,7 @@
|
||||||
import { deleteMedia } from '../../_actions/media'
|
import { deleteMedia } from '../../_actions/media'
|
||||||
import debounce from 'lodash-es/debounce'
|
import debounce from 'lodash-es/debounce'
|
||||||
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -90,6 +91,7 @@
|
||||||
}),
|
}),
|
||||||
store: () => store,
|
store: () => store,
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
setupSyncFromStore () {
|
setupSyncFromStore () {
|
||||||
this.observe('mediaDescriptions', mediaDescriptions => {
|
this.observe('mediaDescriptions', mediaDescriptions => {
|
||||||
mediaDescriptions = mediaDescriptions || []
|
mediaDescriptions = mediaDescriptions || []
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
import { getRectFromEntry } from '../../_utils/getRectFromEntry'
|
import { getRectFromEntry } from '../../_utils/getRectFromEntry'
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
import { pseudoVirtualListStore } from './pseudoVirtualListStore'
|
import { pseudoVirtualListStore } from './pseudoVirtualListStore'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -75,6 +76,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
scrollToPosition (element) {
|
scrollToPosition (element) {
|
||||||
let { scrolledToPosition } = this.get()
|
let { scrolledToPosition } = this.get()
|
||||||
if (scrolledToPosition) {
|
if (scrolledToPosition) {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -48,6 +49,9 @@
|
||||||
}
|
}
|
||||||
return !isIntersecting && hide
|
return !isIntersecting && hide
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
observe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
import debounce from 'lodash-es/debounce'
|
import debounce from 'lodash-es/debounce'
|
||||||
import throttle from 'lodash-es/throttle'
|
import throttle from 'lodash-es/throttle'
|
||||||
import { on } from '../../_utils/eventBus'
|
import { on } from '../../_utils/eventBus'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
const DEBOUNCE_DELAY = 400
|
const DEBOUNCE_DELAY = 400
|
||||||
const THROTTLE_DELAY = 150
|
const THROTTLE_DELAY = 150
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
composeData: ($currentComposeData, originalStatusId) => $currentComposeData[originalStatusId] || {}
|
composeData: ($currentComposeData, originalStatusId) => $currentComposeData[originalStatusId] || {}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
onPostedStatus (realm) {
|
onPostedStatus (realm) {
|
||||||
let { originalStatusId } = this.get()
|
let { originalStatusId } = this.get()
|
||||||
if (realm !== originalStatusId) {
|
if (realm !== originalStatusId) {
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
import isEqual from 'lodash-es/isEqual'
|
import isEqual from 'lodash-es/isEqual'
|
||||||
import { doubleRAF } from '../../_utils/doubleRAF'
|
import { doubleRAF } from '../../_utils/doubleRAF'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -150,6 +151,7 @@
|
||||||
blurWithCapture
|
blurWithCapture
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
initialize () {
|
initialize () {
|
||||||
let { initializeStarted } = this.get()
|
let { initializeStarted } = this.get()
|
||||||
if (initializeStarted) {
|
if (initializeStarted) {
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
import throttle from 'lodash-es/throttle'
|
import throttle from 'lodash-es/throttle'
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
import isEqual from 'lodash-es/isEqual'
|
import isEqual from 'lodash-es/isEqual'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
const DISTANCE_FROM_BOTTOM_TO_FIRE = 800
|
const DISTANCE_FROM_BOTTOM_TO_FIRE = 800
|
||||||
const SCROLL_EVENT_THROTTLE = 1000
|
const SCROLL_EVENT_THROTTLE = 1000
|
||||||
|
@ -108,6 +109,7 @@
|
||||||
allVisibleItemsHaveHeight: ($allVisibleItemsHaveHeight) => $allVisibleItemsHaveHeight
|
allVisibleItemsHaveHeight: ($allVisibleItemsHaveHeight) => $allVisibleItemsHaveHeight
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
calculateListOffset () {
|
calculateListOffset () {
|
||||||
// TODO: better way to get the offset top?
|
// TODO: better way to get the offset top?
|
||||||
let node = this.refs.node
|
let node = this.refs.node
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
|
||||||
import { isMobile } from '../../_utils/isMobile'
|
import { isMobile } from '../../_utils/isMobile'
|
||||||
import { doubleRAF } from '../../_utils/doubleRAF'
|
import { doubleRAF } from '../../_utils/doubleRAF'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
const SCROLL_EVENT_DELAY = 300
|
const SCROLL_EVENT_DELAY = 300
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
},
|
},
|
||||||
store: () => virtualListStore,
|
store: () => virtualListStore,
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
setupScroll (node) {
|
setupScroll (node) {
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return
|
return
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
import { virtualListStore } from './virtualListStore'
|
import { virtualListStore } from './virtualListStore'
|
||||||
import { doubleRAF } from '../../_utils/doubleRAF'
|
import { doubleRAF } from '../../_utils/doubleRAF'
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks'
|
||||||
|
import { observe } from 'svelte-extras'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -41,6 +42,7 @@
|
||||||
}),
|
}),
|
||||||
store: () => virtualListStore,
|
store: () => virtualListStore,
|
||||||
methods: {
|
methods: {
|
||||||
|
observe,
|
||||||
doCalculateHeight () {
|
doCalculateHeight () {
|
||||||
let { heightCalculated } = this.get()
|
let { heightCalculated } = this.get()
|
||||||
if (heightCalculated) { // only need to calculate once, it never changes
|
if (heightCalculated) { // only need to calculate once, it never changes
|
||||||
|
|
Loading…
Reference in a new issue