aberdeen 0.4.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,188 @@
1
+ type Item<T> = T & {[idx: symbol]: Item<T>}
2
+
3
+ /**
4
+ * A set-like collection of objects that can do iteration sorted by a specified index property.
5
+ * It also allows retrieving an object by its index property, and quickly getting the object
6
+ * that comes immediately after a given object.
7
+ *
8
+ * It's implemented as a skiplist, maintaining all meta-data as part of the objects that it
9
+ * is tracking, for performance.
10
+ */
11
+ export class ReverseSortedSet<T extends object> {
12
+ // A fake item, that is not actually T, but *does* contain symbols pointing at the first item for each level.
13
+ private tail: Item<T>
14
+ // As every SkipList instance has its own symbols, an object can be included in more than one SkipList.
15
+ private symbols: symbol[]
16
+
17
+ /**
18
+ * Create an empty SortedSet.
19
+ *
20
+ * @param keyProp The name of the property that should be used as the index of this collection. Comparison
21
+ * using `<` will be done on this property, so it should probably be a number or a string (or something that
22
+ * has a useful toString-conversion).
23
+ */
24
+ constructor(private keyProp: keyof T) {
25
+ this.tail = {} as Item<T>
26
+ this.symbols = [Symbol(0)]
27
+ }
28
+
29
+ /**
30
+ * Add an object to the `SortedSet`.
31
+ *
32
+ * @param item The object to be added to the set. One or more properties with
33
+ * `Symbol` keys will be added to it, for `SortedSet` internals.
34
+ * @returns `true` if the item was added, or `false` if it was *not* added
35
+ * because the item already was part of this set.
36
+ *
37
+ * Note that though an item object may only be part of a particular `SortedSet`
38
+ * once, index properties may be duplicate and an item object may be part of
39
+ * more than one `SortedSet`.
40
+ *
41
+ * **IMPORTANT:** After adding an object, do not modify its index property,
42
+ * as this will lead to undefined (broken) behavior on the entire set.
43
+ *
44
+ * Time complexity: O(log n)
45
+ */
46
+ add(item: T): boolean {
47
+ if (this.symbols[0] in item) return false // Already included
48
+
49
+ // Start at level 1. Keep upping the level by 1 with 1/8 chance.
50
+ const level = 1 + (Math.clz32(Math.random() * 0xFFFFFFFF) >> 2)
51
+ for(let l = this.symbols.length; l < level; l++) this.symbols.push(Symbol(l))
52
+
53
+ const keyProp = this.keyProp
54
+ const key = item[keyProp]
55
+
56
+ let prev: Item<T> | undefined
57
+ let current: Item<T> = this.tail;
58
+ for (let l = this.symbols.length-1; l>=0; l--) {
59
+ const symbol = this.symbols[l]
60
+ while ((prev = current[symbol] as Item<T>) && prev[keyProp] > key) current = prev;
61
+ if (l < level) {
62
+ (item as any)[symbol] = current[symbol];
63
+ (current as any)[symbol] = item;
64
+ }
65
+ }
66
+
67
+ return true // Added
68
+ }
69
+
70
+ /**
71
+ * @param item An object to test for inclusion in the set.
72
+ * @returns true if this object item is already part of the set.
73
+ */
74
+ has(item: T): boolean {
75
+ return this.symbols[0] in item;
76
+ }
77
+
78
+ /**
79
+ * Remove and return the last item.
80
+ * @returns what was previously the last item in the sorted set, or `undefined` if the set was empty.
81
+ */
82
+ fetchLast(): T | undefined {
83
+ let item = this.tail[this.symbols[0]];
84
+ if (item) {
85
+ this.remove(item);
86
+ return item;
87
+ }
88
+ }
89
+
90
+ /**
91
+ * @returns whether the set is empty (`true`) or has at least one item (`false`).
92
+ */
93
+ isEmpty(): boolean {
94
+ return this.tail[this.symbols[0]] === undefined;
95
+ }
96
+
97
+ /**
98
+ * Retrieve an item object based on its index property value.
99
+ *
100
+ * @param indexValue The index property value to search for.
101
+ * @returns `undefined` if the index property value does not exist in the `SortedSet` or
102
+ * otherwise the *first* item object that has this index value (meaning any further
103
+ * instances can be iterated using `next()`).
104
+ *
105
+ * Time complexity: O(log n)
106
+ */
107
+ get(indexValue: string|number): T | undefined {
108
+ const keyProp = this.keyProp
109
+ let current = this.tail;
110
+ let prev
111
+ for (let l = this.symbols.length-1; l>=0; l--) {
112
+ const symbol = this.symbols[l]
113
+ while ((prev = current[symbol] as Item<T>) && prev[keyProp] > indexValue) current = prev;
114
+ }
115
+ return current[this.symbols[0]]?.[keyProp] === indexValue ? current[this.symbols[0]] : undefined;
116
+ }
117
+
118
+ /**
119
+ * The iterator will go through the items in reverse index-order.
120
+ */
121
+ *[Symbol.iterator](): IterableIterator<T> {
122
+ let symbol = this.symbols[0]
123
+ let node: Item<T> | undefined = this.tail[symbol] as Item<T>;
124
+ while (node) {
125
+ yield node;
126
+ node = node[symbol] as Item<T> | undefined;
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Given an item object, returns the one that comes right before in the set.
132
+ * @param item The object to start from.
133
+ * @returns The next object, or `undefined` if there is none.
134
+ *
135
+ * Time complexity: O(1)
136
+ */
137
+ prev(item: T): T | undefined {
138
+ return (item as Item<T>)[this.symbols[0]]
139
+ }
140
+
141
+ /**
142
+ * Remove an item object from the set, deleting all meta-data keys that
143
+ * were created on `add()`.
144
+ * @param item The object to be removed.
145
+ * @returns `true` on success or `false` when the item was not part of the set.
146
+ *
147
+ * Time complexity: O(log n)
148
+ */
149
+ remove(item: T): boolean {
150
+ if (!(this.symbols[0] in item)) return false;
151
+ const keyProp = this.keyProp
152
+ const prop = item[keyProp];
153
+
154
+ let prev: Item<T> | undefined
155
+ let current: Item<T> = this.tail;
156
+
157
+ for (let l = this.symbols.length - 1; l >= 0; l--) {
158
+ const symbol = this.symbols[l];
159
+ while ((prev = current[symbol] as Item<T>) && prev[keyProp] >= prop && prev !== item) current = prev
160
+ if (prev === item) {
161
+ (current as any)[symbol] = prev[symbol]
162
+ delete prev[symbol]
163
+ }
164
+ }
165
+
166
+ return prev === item
167
+ }
168
+
169
+ /**
170
+ * Remove all items for the set.
171
+ *
172
+ * Time complexity: O(n)
173
+ */
174
+ clear(): void {
175
+ const symbol = this.symbols[0];
176
+ let current: Item<T> | undefined = this.tail;
177
+ while (current) {
178
+ const prev = current[symbol] as Item<T> | undefined
179
+ for (const symbol of this.symbols) {
180
+ if (!(symbol in current)) break
181
+ delete current[symbol];
182
+ }
183
+ current = prev
184
+ }
185
+ this.tail = {} as Item<T>;
186
+ }
187
+ }
188
+
package/src/prediction.ts CHANGED
@@ -1,18 +1,23 @@
1
- import {withEmitHandler} from './aberdeen.js'
1
+ import {withEmitHandler, defaultEmitHandler} from './aberdeen.js'
2
+ import type { DatumType, TargetType } from './aberdeen.js';
2
3
 
3
- type ObsCollection = any
4
- type Patch = Map<ObsCollection, Map<any, [any, any]>>;
4
+ /**
5
+ * Represents a set of changes that can be applied to proxied objects.
6
+ * This is an opaque type - its internal structure is not part of the public API.
7
+ * @private
8
+ */
9
+ export type Patch = Map<TargetType, Map<any, [DatumType, DatumType]>>;
5
10
 
6
11
 
7
12
  function recordPatch(func: () => void): Patch {
8
13
  const recordingPatch = new Map()
9
- withEmitHandler(function(index, newData, oldData) {
10
- addToPatch(recordingPatch, this, index, newData, oldData)
14
+ withEmitHandler(function(target, index, newData, oldData) {
15
+ addToPatch(recordingPatch, target, index, newData, oldData)
11
16
  }, func)
12
17
  return recordingPatch
13
18
  }
14
19
 
15
- function addToPatch(patch: Patch, collection: ObsCollection, index: any, newData: any, oldData: any) {
20
+ function addToPatch(patch: Patch, collection: TargetType, index: any, newData: DatumType, oldData: DatumType) {
16
21
  let collectionMap = patch.get(collection)
17
22
  if (!collectionMap) {
18
23
  collectionMap = new Map()
@@ -27,7 +32,7 @@ function addToPatch(patch: Patch, collection: ObsCollection, index: any, newData
27
32
  function emitPatch(patch: Patch) {
28
33
  for(let [collection, collectionMap] of patch) {
29
34
  for(let [index, [newData, oldData]] of collectionMap) {
30
- collection.emitChange(index, newData, oldData)
35
+ defaultEmitHandler(collection, index, newData, oldData);
31
36
  }
32
37
  }
33
38
  }
@@ -43,7 +48,7 @@ function mergePatch(target: Patch, source: Patch, reverse: boolean = false) {
43
48
  function silentlyApplyPatch(patch: Patch, force: boolean = false): boolean {
44
49
  for(let [collection, collectionMap] of patch) {
45
50
  for(let [index, [newData, oldData]] of collectionMap) {
46
- let actualData = collection.rawGet(index)
51
+ let actualData = (collection as any)[index]
47
52
  if (actualData !== oldData) {
48
53
  if (force) setTimeout(() => { throw new Error(`Applying invalid patch: data ${actualData} is unequal to expected old data ${oldData} for index ${index}`)}, 0)
49
54
  else return false
@@ -52,7 +57,7 @@ function silentlyApplyPatch(patch: Patch, force: boolean = false): boolean {
52
57
  }
53
58
  for(let [collection, collectionMap] of patch) {
54
59
  for(let [index, [newData, oldData]] of collectionMap) {
55
- collection.rawSet(index, newData)
60
+ (collection as any)[index] = newData
56
61
  }
57
62
  }
58
63
  return true
package/src/route.ts CHANGED
@@ -1,30 +1,44 @@
1
- import {Store, observe, immediateObserve, runQueue, getParentElement, clean} from './aberdeen.js'
1
+ import {getParentElement, runQueue, clean, proxy, observe, immediateObserve, unproxy, clone} from './aberdeen.js'
2
2
 
3
3
  /**
4
- * A `Store` object that holds the following keys:
5
- * - `path`: The current path of the URL split into components. For instance `/` or `/users/123/feed`. Updates will be reflected in the URL and will *push* a new entry to the browser history.
6
- * - `p`: Array containing the path segments. For instance `[]` or `['users', 123, 'feed']`. Updates will be reflected in the URL and will *push* a new entry to the browser history. Also, the values of `p` and `path` will be synced.
7
- * - `search`: An observable object containing search parameters (a split up query string). For instance `{order: "date", title: "something"}` or just `{}`. By default, updates will be reflected in the URL, replacing the current history state.
8
- * - `hash`: The document hash part of the URL. For instance `"#section-title"`. It can also be an empty string. Updates will be reflected in the URL, modifying the current history state.
9
- * - `id`: A part of the browser history *state* that is considered part of the page *identify*, meaning changes will (by default) cause a history push, and when going *back*, it must match.
10
- * - `aux`: The auxiliary part of the browser history *state*, not considered part of the page *identity*. Changes will be reflected in the browser history using a replace.
11
- * - `depth`: The navigation depth of the current session. Starts at 1. Writing to this property has no effect.
12
- * - `nav`: The navigation action that got us to this page. Writing to this property has no effect.
13
- * - `"load"`: An initial page load.
14
- * - `"back"` or `"forward"`: When we navigated backwards or forwards in the stack.
15
- * - `"push"`: When we added a new page on top of the stack.
4
+ * The class for the singleton `route` object.
16
5
  *
17
- * The following key may also be written to `route` but will be immediately and silently removed:
18
- * - `mode`: As described above, this library takes a best guess about whether pushing an item to the browser history makes sense or not. When `mode` is...
19
- * - `"push"`: Force creation of a new browser history entry.
20
- * - `"replace"`: Update the current history entry, even when updates to other keys would normally cause a *push*.
21
- * - `"back"`: Unwind the history (like repeatedly pressing the *back* button) until we find a page that matches the given `path` and `id`, and then *replace* that state by the full given state.
22
6
  */
23
7
 
24
- // Idea: split `state` into `pstate` (primary) and `astate` (auxilary). The former is used to determine if new pages should be pushed and if, when moving back, a page matches.
25
- // Moving back is done by just doing history.back() while depth > 1, and repeating in handleLocationUpdate until matching page is found (or overriding base page).
8
+ export class Route {
9
+ /** The current path of the URL split into components. For instance `/` or `/users/123/feed`. Updates will be reflected in the URL and will *push* a new entry to the browser history. */
10
+ path!: string
11
+ /** Array containing the path segments. For instance `[]` or `['users', 123, 'feed']`. Updates will be reflected in the URL and will *push* a new entry to the browser history. Also, the values of `p` and `path` will be synced. */
12
+ p!: string[]
13
+ /** An observable object containing search parameters (a split up query string). For instance `{order: "date", title: "something"}` or just `{}`. By default, updates will be reflected in the URL, replacing the current history state. */
14
+ hash!: string
15
+ /** A part of the browser history *state* that is considered part of the page *identify*, meaning changes will (by default) cause a history push, and when going *back*, it must match. */
16
+ search!: Record<string, string>
17
+ /** The `hash` interpreted as search parameters. So `"a=x&b=y"` becomes `{a: "x", b: "y"}`. */
18
+ id!: Record<string, any>
19
+ /** The auxiliary part of the browser history *state*, not considered part of the page *identity*. Changes will be reflected in the browser history using a replace. */
20
+ aux!: Record<string, any>
21
+ /** The navigation depth of the current session. Starts at 1. Writing to this property has no effect. */
22
+ depth: number = 1
23
+ /** The navigation action that got us to this page. Writing to this property has no effect.
24
+ - `"load"`: An initial page load.
25
+ - `"back"` or `"forward"`: When we navigated backwards or forwards in the stack.
26
+ - `"push"`: When we added a new page on top of the stack.
27
+ */
28
+ nav: 'load' | 'back' | 'forward' | 'push' = 'load'
29
+ /** As described above, this library takes a best guess about whether pushing an item to the browser history makes sense or not. When `mode` is...
30
+ - `"push"`: Force creation of a new browser history entry.
31
+ - `"replace"`: Update the current history entry, even when updates to other keys would normally cause a *push*.
32
+ - `"back"`: Unwind the history (like repeatedly pressing the *back* button) until we find a page that matches the given `path` and `id` (or that is the first page in our stack), and then *replace* that state by the full given state.
33
+ The `mode` key can be written to `route` but will be immediately and silently removed.
34
+ */
35
+ mode: 'push' | 'replace' | 'back' | undefined
36
+ }
26
37
 
27
- export const route = new Store()
38
+ /**
39
+ * The singleton {@link Route} object reflecting the current URL and browser history state. You can make changes to it to affect the URL and browser history. See {@link Route} for details.
40
+ */
41
+ export const route = proxy(new Route())
28
42
 
29
43
  let stateRoute = {
30
44
  nonce: -1,
@@ -34,7 +48,7 @@ let stateRoute = {
34
48
  // Reflect changes to the browser URL (back/forward navigation) in the `route` and `stack`.
35
49
  function handleLocationUpdate(event?: PopStateEvent) {
36
50
  let state = event?.state || {}
37
- let nav = 'load'
51
+ let nav: 'load' | 'back' | 'forward' | 'push' = 'load'
38
52
  if (state.route?.nonce == null) {
39
53
  state.route = {
40
54
  nonce: Math.floor(Math.random() * Number.MAX_SAFE_INTEGER),
@@ -46,8 +60,8 @@ function handleLocationUpdate(event?: PopStateEvent) {
46
60
  }
47
61
  stateRoute = state.route
48
62
 
49
- if (route('mode').peek() === 'back') {
50
- route('depth').set(stateRoute.depth)
63
+ if (unproxy(route).mode === 'back') {
64
+ route.depth = stateRoute.depth
51
65
  // We are still in the process of searching for a page in our navigation history..
52
66
  updateHistory()
53
67
  return
@@ -58,16 +72,14 @@ function handleLocationUpdate(event?: PopStateEvent) {
58
72
  search[k] = v
59
73
  }
60
74
 
61
- route.set({
62
- path: location.pathname,
63
- p: location.pathname.slice(1).split('/'),
64
- search: search,
65
- hash: location.hash,
66
- id: state.id,
67
- aux: state.aux,
68
- depth: stateRoute.depth,
69
- nav,
70
- })
75
+ route.path = location.pathname
76
+ route.p = location.pathname.slice(1).split('/')
77
+ route.search = search
78
+ route.hash = location.hash
79
+ route.id = state.id
80
+ route.aux = state.aux
81
+ route.depth = stateRoute.depth
82
+ route.nav = nav
71
83
 
72
84
  // Forward or back event. Redraw synchronously, because we can!
73
85
  if (event) runQueue();
@@ -80,45 +92,49 @@ window.addEventListener("popstate", handleLocationUpdate);
80
92
  // initiated `set` will see the canonical form (instead of doing a rerender shortly after,
81
93
  // or crashing due to non-canonical data).
82
94
  function updatePath(): void {
83
- let path = route('path').get()
84
- if (path == null && route('p').peek()) {
85
- return updateP();
95
+ let path = route.path
96
+ if (path == null && unproxy(route).p) {
97
+ return updateP()
86
98
  }
87
- path = ''+path
99
+ path = ''+(path || '/')
88
100
  if (!path.startsWith('/')) path = '/'+path
89
- route('path').set(path)
90
- route('p').set(path.slice(1).split('/'))
101
+ route.path = path
102
+ route.p = path.slice(1).split('/')
91
103
  }
92
104
  immediateObserve(updatePath)
93
105
 
94
106
  function updateP(): void {
95
- const p = route('p').get()
96
- if (p == null && route('path').peek()) {
107
+ const p = route.p
108
+ if (p == null && unproxy(route).path) {
97
109
  return updatePath()
98
110
  }
99
111
  if (!(p instanceof Array)) {
100
112
  console.error(`aberdeen route: 'p' must be a non-empty array, not ${JSON.stringify(p)}`)
101
- route('p').set(['']) // This will cause a recursive call this observer.
113
+ route.p = [''] // This will cause a recursive call this observer.
102
114
  } else if (p.length == 0) {
103
- route('p').set(['']) // This will cause a recursive call this observer.
115
+ route.p = [''] // This will cause a recursive call this observer.
104
116
  } else {
105
- route('path').set('/' + p.join('/'))
117
+ route.path = '/' + p.join('/')
106
118
  }
107
119
  }
108
120
  immediateObserve(updateP)
109
121
 
110
122
  immediateObserve(() => {
111
- if (route('search').getType() !== 'object') route('search').set({})
123
+ if (!route.search || typeof route.search !== 'object') route.search = {}
112
124
  })
113
125
 
114
126
  immediateObserve(() => {
115
- if (route('state').getType() !== 'object') route('state').set({})
127
+ if (!route.id || typeof route.id !== 'object') route.id = {}
116
128
  })
117
129
 
118
130
  immediateObserve(() => {
119
- let hash = ''+(route('hash').get() || '')
131
+ if (!route.aux || typeof route.aux !== 'object') route.aux = {}
132
+ })
133
+
134
+ immediateObserve(() => {
135
+ let hash = ''+(route.hash || '')
120
136
  if (hash && !hash.startsWith('#')) hash = '#'+hash
121
- route('hash').set(hash)
137
+ route.hash = hash
122
138
  })
123
139
 
124
140
  function isSamePage(path: string, state: any): boolean {
@@ -127,19 +143,19 @@ function isSamePage(path: string, state: any): boolean {
127
143
 
128
144
  function updateHistory() {
129
145
  // Get and delete mode without triggering anything.
130
- let mode = route('mode').get()
146
+ let mode = route.mode
131
147
  const state = {
132
- id: route('id').get(),
133
- aux: route('aux').get(),
148
+ id: clone(route.id),
149
+ aux: clone(route.aux),
134
150
  route: stateRoute,
135
151
  }
136
152
 
137
153
  // Construct the URL.
138
- const path = route('path').get()
154
+ const path = route.path
139
155
 
140
156
  // Change browser state, according to `mode`.
141
157
  if (mode === 'back') {
142
- route('nav').set('back')
158
+ route.nav = 'back'
143
159
  if (!isSamePage(path, state) && (history.state.route?.depth||0) > 1) {
144
160
  history.back()
145
161
  return
@@ -149,17 +165,15 @@ function updateHistory() {
149
165
  //setTimeout(() => history.replaceState(state, '', url), 0)
150
166
  }
151
167
 
152
- if (mode) route('mode').delete()
153
- const search = new URLSearchParams(route('search').get()).toString()
154
- const url = (search ? path+'?'+search : path) + route('hash').get()
168
+ if (mode) route.mode = undefined
169
+ const search = new URLSearchParams(route.search).toString()
170
+ const url = (search ? path+'?'+search : path) + route.hash
155
171
 
156
172
  if (mode === 'push' || (!mode && !isSamePage(path, state))) {
157
173
  stateRoute.depth++ // stateRoute === state.route
158
174
  history.pushState(state, '', url)
159
- route.merge({
160
- nav: 'push',
161
- depth: stateRoute.depth
162
- })
175
+ route.nav = 'push'
176
+ route.depth = stateRoute.depth
163
177
  } else {
164
178
  // Default to `push` when the URL changed or top-level state keys changed.
165
179
  history.replaceState(state, '', url)
@@ -176,19 +190,22 @@ observe(updateHistory)
176
190
  *
177
191
  * @param {string} name - A unique (within this page) name for this
178
192
  * scrollable element. Defaults to 'main'.
193
+ *
194
+ * The scroll position will be persisted in `route.aux.scroll.<name>`.
179
195
  */
180
196
  export function persistScroll(name: string = 'main') {
181
197
  const el = getParentElement()
182
198
  el.addEventListener('scroll', onScroll)
183
199
  clean(() => el.removeEventListener('scroll', onScroll))
184
200
 
185
- let restore = route('state', 'scroll', name).peek()
201
+ let restore = unproxy(route).aux.scroll?.name
186
202
  if (restore) {
187
203
  Object.assign(el, restore)
188
204
  }
189
205
 
190
206
  function onScroll() {
191
- route('mode').set('replace')
192
- route('state', 'scroll', name).set({scrollTop: el.scrollTop, scrollLeft: el.scrollLeft})
207
+ route.mode = 'replace'
208
+ if (!route.aux.scroll) route.aux.scroll = {}
209
+ route.aux.scroll[name] = {scrollTop: el.scrollTop, scrollLeft: el.scrollLeft}
193
210
  }
194
211
  }
@@ -1,5 +1,3 @@
1
- import {DOM_READ_PHASE, DOM_WRITE_PHASE} from './aberdeen.js'
2
-
3
1
  const FADE_TIME = 400
4
2
  const GROW_SHRINK_TRANSITION = `margin ${FADE_TIME}ms ease-out, transform ${FADE_TIME}ms ease-out`
5
3
 
@@ -21,21 +19,12 @@ function getGrowShrinkProps(el: HTMLElement) {
21
19
  * for other specific cases as well.
22
20
  */
23
21
  export async function grow(el: HTMLElement) {
24
- // Wait until all DOM updates have been done. Then get info from the computed layout.
25
- await DOM_READ_PHASE
26
22
  let props = getGrowShrinkProps(el)
27
-
28
- // In the write phase, make the element size 0 using transforms and negative margins.
29
- await DOM_WRITE_PHASE
30
23
  Object.assign(el.style, props)
31
24
 
32
- // Await read phase, to combine multiple transitions into a single browser layout
33
- await DOM_READ_PHASE
34
25
  // Make sure the layouting has been performed, to cause transitions to trigger
35
26
  el.offsetHeight
36
27
 
37
- // In the next write phase, do the transitions
38
- await DOM_WRITE_PHASE
39
28
  el.style.transition = GROW_SHRINK_TRANSITION
40
29
  for(let prop in props) el.style[prop as any] = ''
41
30
  setTimeout(() => {
@@ -53,12 +42,10 @@ export async function grow(el: HTMLElement) {
53
42
  * for other specific cases as well.
54
43
  */
55
44
  export async function shrink(el: HTMLElement) {
56
- // Wait until all DOM updates have been done. Then get info from the computed layout.
57
- await DOM_READ_PHASE
45
+ // Get original layout info
58
46
  const props = getGrowShrinkProps(el)
59
47
 
60
48
  // Batch starting transitions in the write phase.
61
- await DOM_WRITE_PHASE
62
49
  el.style.transition = GROW_SHRINK_TRANSITION
63
50
  Object.assign(el.style, props)
64
51