You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TODO.md
+75-6Lines changed: 75 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,31 @@ Stop relying on memo stuff.
3
3
If react's render loop triggers, communicate to outside fn's via refs and the like.
4
4
A change to snap points affects how far one can drag.
5
5
6
-
- minHeight should be renamed safeHeight or similar, as it denotes the smallest height while still being able to render the drag handle. Isn't it header height technically?
7
-
- maxHeight renamed to contentHeight, as that's what it is.
8
-
- rename initialHeight to initialSnapPoint.
9
-
- rename viewportHeight to maxHeight?
10
-
- rename isOpen to open, like the <details> tag works.
11
-
- rename setHeight to setSnapPoint
6
+
```
7
+
max-content
8
+
The intrinsic preferred width.
9
+
min-content
10
+
The intrinsic minimum width.
11
+
fit-content(<length-percentage>)
12
+
Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, <length-percentage>)).
13
+
14
+
```
15
+
16
+
hmmmm
17
+
18
+
- currentHeight => height
19
+
- footerHeight => added
20
+
- headerHeight => added
21
+
- maxHeight => minHeight, includes header and footer heights, it tries to avoid a scrollbar
22
+
- minHeight => gone, used to be header + footer
23
+
- viewportHeight => maxHeight
24
+
- snap points array is optional
25
+
26
+
footerHeight
27
+
headerHeight
28
+
height
29
+
maxHeight
30
+
minHeight
12
31
13
32
## package.json stuffs
14
33
@@ -21,3 +40,53 @@ A change to snap points affects how far one can drag.
21
40
- Play icon: https://fontawesome.com/icons/play-circle?style=regular
22
41
- Phone frame used in logo: https://www.figma.com/community/file/896042888090872154/Mono-Devices-1.0
23
42
- iPhone frame used to wrap examples: https://www.figma.com/community/file/858143367356468985/(Variants)-iOS-%26-iPadOS-14-UI-Kit-for-Figma
43
+
44
+
# Ok let's map this nonsense
45
+
46
+
Consider using a
47
+
48
+
```js
49
+
const [, nextTick] =useState(0)
50
+
nextTick((_) =>++_)
51
+
```
52
+
53
+
to force updates.
54
+
Fast way to check if there's new snapPoints generated:
55
+
56
+
```js
57
+
var arr1 = [1, 2, 3, 4, 5]
58
+
var arr2 = [1, 2, 3, 4, 5]
59
+
60
+
if (JSON.stringify(arr1) ===JSON.stringify(arr2)) {
61
+
console.log('They are equal!')
62
+
}
63
+
```
64
+
65
+
Faux plugin architecture. "Plugins" or "hooks" can register in an es6 map if they want to do work before the animation starts, while the bottom sheet is resting in the final state but opacity: 0. This allows setting up focus lock, scroll lock and more ahead of time. Hopefully alleviating a lot of jank.
66
+
67
+
a transition to close can be cancelled if the open state is changed back to `true`.
68
+
open/close is fairly easy and stabl. snap to snap on the other hand, require diligence in making sure whoever cancels a snap transition, makes sure to send the animation on the right direction.
69
+
70
+
## Changes that can happen from React's side of things at any time by means of a prop change
71
+
72
+
And that may affect side effects that are running atm
73
+
74
+
- isOpen
75
+
- snapPoints
76
+
- initialHeight
77
+
78
+
## Big picture state machines
79
+
80
+
- transitioning from closed to open.
81
+
- transition to closed while opening but not open.
82
+
- transition to open while closing.
83
+
- transition to closed after finished opening.
84
+
- while opening the user interrupts and starts dragging (should be fine, all work should be done by now.).
85
+
- while opening the user keyboard navs, maybe even fucks the scroll.
86
+
87
+
- Some hooks care only about if we're on our way to open, or on our way to close.
88
+
- Other hooks care about the current drag state.
89
+
- Dragging is king, should not be interruptible, but may allow side effects that affect where/how dragging happens.
90
+
- Except if the window changes height, maybe respond to header and footer height changes too by interrupting.
91
+
- Focus set by keyboard nav or a screen reader can fuck things up.
92
+
- Consider two drag modes? One fast, but can get scroll fuckups, one that's like the current one, safe because it changes the height property.
0 commit comments