pwa-auth 3.6.0 → 3.7.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.
Files changed (90) hide show
  1. package/README.md +139 -484
  2. package/base/export/drawer.d.ts +2 -0
  3. package/base/export/drawer.d.ts.map +1 -0
  4. package/base/export/drawer.js +2 -0
  5. package/base/export/drawer.js.map +1 -0
  6. package/base/export/icon.d.ts +2 -0
  7. package/base/export/icon.d.ts.map +1 -0
  8. package/base/export/icon.js +2 -0
  9. package/base/export/icon.js.map +1 -0
  10. package/base/export/login.d.ts +2 -0
  11. package/base/export/login.d.ts.map +1 -0
  12. package/base/export/login.js +2 -0
  13. package/base/export/login.js.map +1 -0
  14. package/base/export/reset.d.ts +2 -0
  15. package/base/export/reset.d.ts.map +1 -0
  16. package/base/export/reset.js +2 -0
  17. package/base/export/reset.js.map +1 -0
  18. package/base/export/settings.d.ts +2 -0
  19. package/base/export/settings.d.ts.map +1 -0
  20. package/base/export/settings.js +2 -0
  21. package/base/export/settings.js.map +1 -0
  22. package/base/webcomponents/css/animation.d.ts.map +1 -1
  23. package/base/webcomponents/css/animation.js +35 -63
  24. package/base/webcomponents/css/animation.js.map +1 -1
  25. package/base/webcomponents/drawer/css/drawer.d.ts.map +1 -1
  26. package/base/webcomponents/drawer/css/drawer.js +11 -7
  27. package/base/webcomponents/drawer/css/drawer.js.map +1 -1
  28. package/base/webcomponents/drawer/css/exit.js +1 -1
  29. package/base/webcomponents/drawer/css/paragraph.d.ts.map +1 -1
  30. package/base/webcomponents/drawer/css/paragraph.js +10 -3
  31. package/base/webcomponents/drawer/css/paragraph.js.map +1 -1
  32. package/base/webcomponents/drawer/drawer.d.ts +24 -0
  33. package/base/webcomponents/drawer/drawer.d.ts.map +1 -1
  34. package/base/webcomponents/drawer/drawer.js +265 -17
  35. package/base/webcomponents/drawer/drawer.js.map +1 -1
  36. package/base/webcomponents/form/css/button.d.ts.map +1 -1
  37. package/base/webcomponents/form/css/button.js +15 -16
  38. package/base/webcomponents/form/css/button.js.map +1 -1
  39. package/base/webcomponents/form/css/input.d.ts.map +1 -1
  40. package/base/webcomponents/form/css/input.js +10 -1
  41. package/base/webcomponents/form/css/input.js.map +1 -1
  42. package/base/webcomponents/form/css/label.d.ts.map +1 -1
  43. package/base/webcomponents/form/css/label.js +19 -1
  44. package/base/webcomponents/form/css/label.js.map +1 -1
  45. package/base/webcomponents/form/css/list.d.ts.map +1 -1
  46. package/base/webcomponents/form/css/list.js +2 -1
  47. package/base/webcomponents/form/css/list.js.map +1 -1
  48. package/base/webcomponents/form/css/notice.js +3 -3
  49. package/base/webcomponents/form/css/status.d.ts.map +1 -1
  50. package/base/webcomponents/form/css/status.js +18 -5
  51. package/base/webcomponents/form/css/status.js.map +1 -1
  52. package/base/webcomponents/form/css/toggle.d.ts.map +1 -1
  53. package/base/webcomponents/form/css/toggle.js +7 -0
  54. package/base/webcomponents/form/css/toggle.js.map +1 -1
  55. package/base/webcomponents/form/forgot.d.ts.map +1 -1
  56. package/base/webcomponents/form/forgot.js +5 -4
  57. package/base/webcomponents/form/forgot.js.map +1 -1
  58. package/base/webcomponents/form/login.js +1 -1
  59. package/base/webcomponents/form/signup.js +1 -1
  60. package/base/webcomponents/icon/css/icon.d.ts.map +1 -1
  61. package/base/webcomponents/icon/css/icon.js +9 -0
  62. package/base/webcomponents/icon/css/icon.js.map +1 -1
  63. package/base/webcomponents/login/css/auth.d.ts.map +1 -1
  64. package/base/webcomponents/login/css/auth.js +9 -4
  65. package/base/webcomponents/login/css/auth.js.map +1 -1
  66. package/base/webcomponents/login/page.d.ts +20 -1
  67. package/base/webcomponents/login/page.d.ts.map +1 -1
  68. package/base/webcomponents/login/page.js +182 -6
  69. package/base/webcomponents/login/page.js.map +1 -1
  70. package/base/webcomponents/settings/css/navigation.js +3 -3
  71. package/base/webcomponents/settings/input/delete.d.ts.map +1 -1
  72. package/base/webcomponents/settings/input/delete.js +7 -1
  73. package/base/webcomponents/settings/input/delete.js.map +1 -1
  74. package/base/webcomponents/settings/input/uploader.d.ts.map +1 -1
  75. package/base/webcomponents/settings/input/uploader.js +8 -4
  76. package/base/webcomponents/settings/input/uploader.js.map +1 -1
  77. package/base/webcomponents/settings/input/verify.d.ts.map +1 -1
  78. package/base/webcomponents/settings/input/verify.js +24 -7
  79. package/base/webcomponents/settings/input/verify.js.map +1 -1
  80. package/base/webcomponents/settings/settings.d.ts +19 -1
  81. package/base/webcomponents/settings/settings.d.ts.map +1 -1
  82. package/base/webcomponents/settings/settings.js +177 -12
  83. package/base/webcomponents/settings/settings.js.map +1 -1
  84. package/docs/drawer-slide.md +206 -0
  85. package/docs/sliders.md +38 -31
  86. package/package.json +48 -10
  87. package/source/pwa-auth.js +400 -260
  88. package/source/pwa-styles.css +0 -7
  89. package/firebase.md +0 -125
  90. package/intro.md +0 -19
@@ -0,0 +1,206 @@
1
+ # Drawer login and sign-up slide
2
+
3
+ The drawer unrolls downward and its buttons ride the bottom edge. Nothing animates when the page first loads. Login and sign-up then trade places in the same space.
4
+
5
+ The controls sit on the host edge. `--pwa_inset` defaults to `0`. `--pwa_max_width` defaults to `400px`: the form column fills a narrow host, then centers at that cap. Signed-in drawer links use that same column. The drawer header stays full width. The host is `display: block`, `width: 100%`, `min-width: 0`, so it follows a flex or grid track. A page sets either variable on `user-drawer`, `user-login`, `user-settings`, and `email-reset`. Do not set `--pwa_max_width` on `:host` inside the component; that would beat the page.
6
+
7
+ The form swap is a transform inside `.inner`. The drawer rolls open and closed on its own: `.drawer-clip` eases `height` and `max-height` between `0px` and the measured content height, and `section.userDrawer` translates so its bottom stays on the clip's bottom. Both use this component's `--pwa_slide` (`2s`, `ease-in-out`). The page login and the settings tabs roll the same way, each inside its own file. There is no shared roll module.
8
+
9
+ ## How the form swap works
10
+
11
+ `form-login` and `form-signup` share one grid cell. `.inner` is a grid with `grid-template-areas: 'pages'`. Both forms have `grid-area: pages`, so they occupy the same cell. `.inner` is `overflow: hidden`, which clips anything that leaves that cell.
12
+
13
+ The open form (class `opened`) is `position: relative` and `transform: translate3d(0, 0, 0)`. It is the only one in flow, so it sets the panel height.
14
+
15
+ The closed form (class `closed`) is `position: absolute` at `top: 0; left: 0`, with `width: 100%` and `height: auto`. Absolute removes it from the row, so it does not stretch the panel. It is translated `translate3d(0, -100%, 0)`. A percentage in `translate` is a percentage of the element itself, so `-100%` moves it up by its own height, just outside the clip.
16
+
17
+ The transform runs for `var(--pwa_slide, 2s)` with `ease-in-out` in both directions. The arriving form moves from `-100%` to `0`. The leaving form moves from `0` to `-100%`. Both travel upward through the same cell. `opened` is `z-index: 3` and `closed` is `z-index: 2`, so the arriving form paints on top.
18
+
19
+ The leaving form is hidden when that transform ends. `.content` sets `transition: transform var(--pwa_slide, 2s) ease-in-out, visibility 0s linear var(--pwa_slide, 2s)`. Visibility duration is `0s` and its delay is the slide, so visibility snaps to `hidden` at the same moment the transform finishes. `.opened` overrides that with `visibility 0s linear 0s`, so the arriving form is shown immediately. `pointer-events: none` and the `inert` attribute are separate from the paint. `inert` keeps the off-screen form out of the tab order.
20
+
21
+ `prefers-reduced-motion: reduce` sets `--pwa_slide` to `0s` on that component's `:host`. The swap is instant, and the visibility wait does not linger.
22
+
23
+ The form transition is off until `.inner` also has class `motion`. The first render binds `opened` and `closed` with `classMap`, and `.content` has `transition: none`. After that paint, `motion` is added on that component's `.inner` only. A later change of those classes is what runs the swap. The closed form does not slide into place at load.
24
+
25
+ ### What toggles it
26
+
27
+ The buttons are `part="switch"`.
28
+
29
+ - `form-login` label: `create a new account`. File: `typescript/webcomponents/form/login.ts`.
30
+ - `form-signup` label: `login with existing email`. File: `typescript/webcomponents/form/signup.ts`.
31
+
32
+ Each `change()` dispatches `universalToggle(this.source)`. Inside the drawer, `source` is `"drawer"`. `universalToggle` in `typescript/redux/frontend.ts` flips `frontend.registerOne`.
33
+
34
+ `UserDrawer.stateChanged` copies `registerOne` onto `this.signup`. The render in `typescript/webcomponents/drawer/drawer.ts` then sets the classes:
35
+
36
+ - `form-login` is `opened` when `this.signup === this.subscribe`, otherwise `closed`.
37
+ - `form-signup` is `opened` when `!this.signup === this.subscribe`, otherwise `closed`.
38
+
39
+ `subscribe` is the boolean attribute on `user-drawer`. It flips which form is open for a given `registerOne`. The closed form also gets `inert`.
40
+
41
+ These do not run the form swap:
42
+
43
+ - Attribute `drawer`, class `out` / `in` on `.userDrawer`, and attribute `sliding` open and close the shell. See below.
44
+ - Classes `spec-in` and `spec-out` follow the open flag. They do not transform.
45
+ - Attribute `on` on `.spec` is `display`. It shows the logged-out block. It is not a slide.
46
+
47
+ ## The roll
48
+
49
+ What you see: the drawer's bottom edge moves down on open and up on close. The last control stays on that edge, like the roller of a scroll. The title and the top of the form come into view from above the clip, and leave the same way. The page heading does not move.
50
+
51
+ Two boxes, one clock, and they belong to one component.
52
+
53
+ ```
54
+ clip .drawer-clip overflow hidden, height and max-height ease
55
+ sheet section.userDrawer translateY eases, holds header + forms
56
+ ```
57
+
58
+ `.wrapper` starts under the header. Rolling only `.inner` would leave the title stuck while the form rode the edge. The sheet is the whole `section.userDrawer`.
59
+
60
+ The same picture, with different elements, lives in the other two components. Nothing is shared.
61
+
62
+ | Component | Clip | Sheet | Clock |
63
+ |---|---|---|---|
64
+ | `user-drawer` | `.drawer-clip` | `section.userDrawer` | `:host` `--pwa_slide` from `animation.ts` |
65
+ | `user-login` | `.login-clip` | `section.service` | that host's own `--pwa_slide` |
66
+ | `user-settings` | `.settings-clip` | `.settings-sheet` | that host's own `--pwa_slide` in `settings.ts` |
67
+
68
+ `--pwa_slide` (`2s`, `ease-in-out`) is a custom property on that component's `:host`. It inherits into that shadow tree and stops there. A sibling `user-login` does not see the drawer's variable, classes, or events. The clip is `display: block`. A grid clip would stretch the sheet to the clip's height and the bottom would no longer be the content's bottom.
69
+
70
+ ### No shared roll
71
+
72
+ `typescript/webcomponents/css/roll.ts` is gone. Each component keeps its own `rollBetween`, its own clip and sheet class names, and its own `transitionend` listener. The listener ignores any event whose target is not the clip itself, so a form transform inside the sheet cannot finish another component's roll, or even this one early.
73
+
74
+ A shared `.roll` class, a shared `:host { transition: height, max-height }`, or one helper that wrote those inline styles was enough to ease a component that had not been asked to move. The drawer shell no longer transitions `height`, `max-height`, or `transform`. `drawerShell` only holds the closed backstop: `max-height: 0`, `visibility: hidden`, `pointer-events: none`, with no transition. `sliding` lifts that backstop. The motion itself is the style binding below.
75
+
76
+ ### Lit bindings, and no animation at boot
77
+
78
+ The clip and the sheet read their box from the template. `styleMap` writes `height`, `max-height`, `transform`, and `transition` from component state. `classMap` writes `opened` and `closed` on the forms.
79
+
80
+ The first render binds the resting state and `transition: none`:
81
+
82
+ - Drawer shut: clip `0px`, sheet `translate3d(0, -100%, 0)`. `.inner` has no `motion` class, so the forms do not transition either.
83
+ - Page login: clip `auto`, sheet `none`. The open form is `opened`. The other is `closed` and already at `-100%`.
84
+ - Settings: the signed-out line, or the active tab at `auto`, with the sheet at `none`. Inactive panels are `hidden`. They are not `closed`.
85
+
86
+ That paint is static. `motion` is reflected only after it, and the roll's `transition` string is written only inside `rollBetween`, which runs from a later update (the drawer attribute, `registerOne` / `registerTwo`, or a settings tab). Load does not play an open-to-closed ease.
87
+
88
+ `rollBetween` then eases. It locks the start px with `transition: none`, reads `offsetHeight` so the next change has a from-value, and writes the end px with `transition` set to `var(--pwa_slide, 2s) ease-in-out`. `height` and `max-height` are the same px, because `max-height` only caps and cannot hold a shorter sheet open.
89
+
90
+ ### Lockstep at progress p
91
+
92
+ `p` runs 0 → 1 with `ease-in-out`. `H` is the sheet's height in px. Open from a closed drawer:
93
+
94
+ - clip height = `p * H`
95
+ - sheet `translateY` = `(p - 1) * H` (start `-H`, which is `-100%`, end `0`)
96
+ - sheet bottom = clip top + translateY + H = clip top + `p * H` = clip bottom
97
+
98
+ Close swaps the ends: translateY runs `0` → `-H` while the clip runs `H` → `0`. The same identity holds.
99
+
100
+ A height change that does not start at 0 (a taller form, a settings tab) uses the sheet's real height `S` and clip ends `A` → `B`:
101
+
102
+ - clip = `A + (B - A) * p`
103
+ - translateY = clip − S
104
+ - start `A - S`, end `B - S`
105
+
106
+ When the new sheet is the thing on screen, `S = B`, so it finishes at `translateY: 0` and starts at `A - B`. Each component's `rollBetween` writes those pixel values through the same `styleMap` the first paint used. Open from 0 is the `-100%` case of the same formula. The resting closed sheet can stay at `-100%` so boot does not have to measure.
107
+
108
+ ### Why the px value has to be measured
109
+
110
+ `max-height` only eases between two lengths, and it only caps. It cannot hold a box open taller than its content, so a shrink would drop the bottom immediately. `rollBetween` sets `height` and `max-height` to the same px value. `none` and `auto` have no midpoint, so they snap. A cap of `100dvh` or `9999px` does ease, but the timing function is spread across that whole range. A 480px drawer inside a 1000px range is fully open at 48% of the time, and the named ease is not what you see. The open path reads the sheet once with the clip cap released (no paint), and that integer is the end of the animation. After the clip's own `max-height` `transitionend`, the binding goes back to `height: auto` and `max-height: none` so a later reflow is not stuck. The next close, or the next height change, measures again.
111
+
112
+ ### Visibility, inert, reduced motion
113
+
114
+ `sliding` turns on in the same turn as the open. `visibility` and `pointer-events` come on with it, and `inert` comes off. It turns off only when this drawer's clip fires `max-height` `transitionend` and the box is shorter than 2px. A bubbled transform from a form does not qualify (`event.target` must be the clip). That is the close, not a second timer. `prefers-reduced-motion: reduce` sets `--pwa_slide` to `0s` on that host, and `rollBetween` snaps to the end state with `transition: none`.
115
+
116
+ ### Where it is used
117
+
118
+ | Place | Clip | Sheet | When it rolls |
119
+ |---|---|---|---|
120
+ | `user-drawer` | `.drawer-clip` | `section.userDrawer` | open, close, and a form swap that changes height |
121
+ | `user-login` | `.login-clip` | `section.service` | `registerTwo` (login ↔ sign-up) and sign-in ↔ signed-in |
122
+ | `user-settings` | `.settings-clip` | `.settings-sheet` | tab change, after the panels are already on screen. The nav stays put |
123
+
124
+ The drawer's login/sign-up pair still slides inside `.inner` with `.opened` / `.closed`. That is a different motion (two forms, one cell). The page login keeps that inner swap and also rolls the card. Settings tabs do not use `.opened` / `.closed`; the roll is the only motion, and settings does not import `animation.ts`. `.in`, `.out`, `.spec-in`, and `.spec-out` are gone.
125
+
126
+ ### Apply it to a new component
127
+
128
+ Copy the roll into that component. Do not import a shared helper, and do not reuse `.drawer-clip`, `.login-clip`, `.settings-clip`, or `.settings-sheet`.
129
+
130
+ 1. Put `--pwa_slide: 2s` on that component's `:host`, and `0s` inside `prefers-reduced-motion`. Give the clip a class that exists only in this file. `display: block`, `overflow: hidden`.
131
+ 2. Bind the clip and the sheet with `styleMap`. The first render is the resting state and `transition: none`.
132
+ 3. On a user change after that first update, remember the clip's height, render the new sheet, measure its height, and run this component's own from/to ease. `height` and `max-height` share the px value. `translateY` is clip minus sheet height.
133
+ 4. On that clip's `max-height` `transitionend`, and only when `event.target` is the clip, set the binding back to `auto` / `none`.
134
+ 5. Do not put a height transition on `:host` in a stylesheet other components import. Do not translate a sheet that leaves out an element that should ride the edge.
135
+
136
+ ### Files
137
+
138
+ - `typescript/webcomponents/drawer/drawer.ts` — drawer roll, open, close, form-swap height.
139
+ - `typescript/webcomponents/login/page.ts` — page-login roll and `registerTwo`.
140
+ - `typescript/webcomponents/settings/settings.ts` — settings roll and tab panels.
141
+ - `typescript/webcomponents/css/animation.ts` — `--pwa_slide` and the form-swap `.opened` / `.closed` rules. Class `motion` on `.inner` arms the form transition. The drawer shell has no height transition.
142
+ - `typescript/webcomponents/form/login.ts` and `signup.ts` — the switch buttons.
143
+ - `typescript/redux/frontend.ts` — `universalToggle`, `registerOne`, `registerTwo`, `navigateAuth`.
144
+ - Built copies: `base/webcomponents/css/animation.js`, `source/pwa-auth.js`, `website/javascript/pwa-auth.js`. There is no `roll.js`.
145
+
146
+ `@keyframes slide-out` is still in the file. It is not applied. Do not put it on `.closed`.
147
+
148
+ ## History
149
+
150
+ - `97c7256` introduced the slide. `.closed` became `position: absolute` in the same cell, `translate3d(0, -100%, 0)`, with a `0.8s` transform. Before that, `.closed` was `height: 0`, `width: 0`, and `transform: none`, so the swap was instant.
151
+ - `8868da7` timed the swap from one variable: `1.4s * 1.429`, about `2s` `ease-in-out`. Visibility on the way out waits for that transform. Visibility on the way in is immediate.
152
+ - `15b3ed6` is the last commit where that mechanism was intact in the shared rule (`height: auto` and `align-self: start` on `.closed`, so a stretched row does not pull controls to the top).
153
+ - `f607737` broke the drawer. It added a more specific `.userDrawer .content.closed`: `position: relative`, `visibility: visible`, and `animation: slide-out 2s`. The shell timings were being put back on Jack's elements. The form override went with them.
154
+ - `19dfd75` copied that override into the shared `.closed` rule. The drawer, the page login, and the settings tabs all snapped.
155
+
156
+ `slide-out` only animates `max-height` from `100%` to `100dvh`. With `.closed` back in flow, the row changes size while the transform runs. The panels no longer pass through one clipped cell.
157
+
158
+ ## How max-height behaves
159
+
160
+ A transition or animation of `max-height` interpolates `max-height` only. The used height is the content height capped by that value. The border box grows or shrinks, and overflow clips the content. The element does not move sideways or upward. A second form in the same cell does not travel in from outside the clip.
161
+
162
+ That is why a `max-height` animation cannot produce the form swap. The forms need one shared cell and a transform. It does produce the unroll, because the unroll is the border box growing. `slide-out` is still a poor cap: `100%` often does not resolve, and `100dvh` is a viewport, not the drawer.
163
+
164
+ ### `none` and `auto` do not animate
165
+
166
+ A transition needs two computed values it can blend. `max-height: none` is not a length. `height: auto` is not a length. There is no midpoint between `none` and `400px`, or between `auto` and `0`. The property snaps. This codebase does not use `interpolate-size` or `calc-size()`. Do not switch the form swap over to `height: auto` and expect it to ease.
167
+
168
+ Two lengths do interpolate. `0px` to `240px` animates. `0px` to `100%` animates only when the percentage resolves against a definite containing-block height. If it does not, the open snaps.
169
+
170
+ ### A large max-height skews the ease
171
+
172
+ People sometimes animate `max-height` from `0` to a huge length (`9999px`, `100dvh`) to fake `height: auto`. The timing function is applied across the whole range, not across the content. A 400px form inside a 10000px range reaches its real height about 4% of the way through the duration. The rest of the time `max-height` is above the content and nothing visible happens.
173
+
174
+ On the way open, the panel appears to finish early, and the named ease is not the ease you see. On the way closed, most of the duration is spent shrinking empty space above the content, then the content collapses in a rush at the end. `ease-in-out` over that range does not look like `ease-in-out` over the form. That is another reason `slide-out` (`100%` to `100dvh`, 2s) cannot stand in for the 2s transform.
175
+
176
+ ### What the drawer open and close uses
177
+
178
+ The drawer clip's bound `height` and `max-height`, and the sheet's bound `transform`, ease with `var(--pwa_slide, 2s) ease-in-out` only while that roll is running. At rest the transition is `none`. `drawerShell` does not ease `:host`. After the open (and after a form-swap glide) the binding becomes `height: auto` and `max-height: none`, which does not animate. The timings table in [Slides](sliders.md) lists the one duration.
179
+
180
+ ## Pitfalls
181
+
182
+ - `position: relative` on `.closed` puts the form back in the row. The clip no longer shows one panel replacing the other.
183
+ - `animation: slide-out` on `.closed` does not slide the form. Starting an animation on that element can also drop the transform transition, so the swap snaps.
184
+ - Do not transition `height` or `max-height` to `auto` or `none`. It will snap.
185
+ - Do not fake the form swap with a large `max-height`. The visible motion will be shorter than the duration, and the ease will look wrong.
186
+ - The visibility delay on `.content` must be `var(--pwa_slide)`, not a different literal. Shorter, and the leaving form vanishes mid-slide. Longer, and it stays painted after it is off screen. The visibility duration stays `0s`. It snaps. It does not fade.
187
+ - `.opened` must set its own transition with a `0s` visibility delay. If it inherits the close delay, the arriving form is invisible for the whole slide.
188
+ - Do not give `.spec`, `.inner`, or `.wrapper` their own height or transform duration. The drawer's clip is `.drawer-clip`. The roller is `.userDrawer`. A second clock drifts. The header is outside `.wrapper`, so rolling only `.inner` leaves the header behind.
189
+ - Do not animate `max-height` to `none`, `auto`, or a viewport-sized cap. Measure px, ease between those two lengths, then set `none` only after the clip's own `transitionend`.
190
+ - Do not share the roll. A `:host` height transition, or a class name used by more than one component, eases something that should have stayed still. One component's `transitionend` must not call another component's release.
191
+ - The first render binds the resting state with `transition: none`. Turning the transition on in that same first paint, or writing the closed px after an open first frame, is the open-then-shut flicker.
192
+ - `sliding` has to stay up until the close `max-height` reaches 0. Clearing it when `drawer` flips hides the roll-up. The host backstop is `max-height: 0` with no transition, so it cannot play that flicker by itself.
193
+ - Focusing a control inside the unrolling box scrolls it. `.focus({ preventScroll: true })` keeps the header at the top edge. Reset `scrollTop` when the open starts.
194
+ - Reduced motion has to set `--pwa_slide: 0s`. Zeroing only `transition-duration` leaves a delay that still uses the variable.
195
+ - A more specific `.userDrawer .content.closed` rule is how `f607737` broke the drawer while the shared rule still looked right.
196
+ - `-100%` is the element's own height. `height: 0` on `.closed` makes that distance zero, so nothing moves.
197
+ - `.inner` clips the forms. `:host` clips the drawer. Removing either shows the parked piece.
198
+ - Do not bring back `--pwa_slide_time` or `calc()` on the transform. `6959a29` removed that. `--pwa_slide` is a single time, not a formula.
199
+
200
+ ## Changing the duration
201
+
202
+ Change `--pwa_slide` on the component you are timing. The drawer's and the page login's variable is on `:host` in `animation.ts`. Settings sets its own on `:host` in `settings.ts`. That component's roll, its form-swap height glide, its form transform, and its form visibility delay read that variable. `sliding` ends on the clip's `transitionend`, so it follows whatever that time is. Leave the visibility duration at `0s`, and leave `.motion .opened` at `visibility 0s linear 0s`. Do not hardcode a second duration in `rollBetween`.
203
+
204
+ Update the `2s` figures in `docs/sliders.md` and in this file. Rebuild so `base/webcomponents/` matches `typescript/`, then `source/pwa-auth.js` and `website/javascript/pwa-auth.js`.
205
+
206
+ Then open the drawer and close it. The top edge should stay put, the bottom edge should take the new time, and the host should collapse only at the end. Click `login with existing email` and `create a new account`. The forms should slide, and if the open form is taller the bottom edge should ease to the new height instead of jumping.
package/docs/sliders.md CHANGED
@@ -1,22 +1,33 @@
1
1
  # Slides
2
2
 
3
- The slide is one module: `typescript/webcomponents/css/animation.ts`. `user-drawer`, `user-login`, and `user-settings` import it.
3
+ The drawer, the page login, and settings each slide on their own. Opening one does not move the others. Nothing moves on the first paint.
4
4
 
5
- Three parts.
5
+ Three components slide, and each one owns its roll. `user-drawer` (`typescript/webcomponents/drawer/drawer.ts`), `user-login` (`typescript/webcomponents/login/page.ts`), and `user-settings` (`typescript/webcomponents/settings/settings.ts`) do not import a shared roll helper. There is no `css/roll.ts`.
6
6
 
7
- - The container carries `max-height`.
8
- - The moving child carries `transform`.
9
- - Closed content runs both. Class `closed` translates `translate3d(0, -102%, 0)` and plays `slide-out`, which animates `max-height`.
7
+ `animation.ts` is the form swap only: `--pwa_slide`, `.opened` / `.closed`, and the drawer shell's closed backstop. Settings does not import it. The full roll write-up is [The roll](drawer-slide.md#the-roll).
8
+
9
+ The fields are flush with the element. Spacing belongs to the page: `--pwa_inset` defaults to `0`. The form column fills a narrow host and, once the host is wider than `--pwa_max_width` (`400px`), stays that wide and centers. The page login column centers under the full-width heading. Signed-in drawer links use that same column. Set either variable on `user-drawer`, `user-login`, `user-settings`, or `email-reset`. The drawer header and the settings tabs stay full width. Each host is `display: block` with `width: 100%` and `min-width: 0` (`user-icon` is `width: fit-content`, `max-width: 100%`). A resize while a roll is in motion remeasures that component and eases from the current clip height with the sheet bottom still on the clip.
10
+
11
+ Two motions, one duration, per component.
12
+
13
+ - The drawer rolls. `.drawer-clip` eases `height` and `max-height` from `0px` to the measured content height and back. `section.userDrawer` translates on that same clock, so the sheet's bottom stays on the clip's bottom.
14
+ - Closed forms share one grid cell. Class `closed` is `position: absolute` and translates `translate3d(0, -100%, 0)`. Once `.inner` has class `motion`, `visibility` waits out `--pwa_slide`, then hides. Settings panels do not use these classes.
10
15
 
11
16
  ## How it works
12
17
 
13
- The slide is two motions that run together. The container's `max-height` grows or shrinks the space. The child's `transform` slides the panel into that space. `inner` clips, so it looks like it comes from behind an edge.
18
+ The clip is an element in that component's template (`overflow: hidden`, `display: block`). The sheet is the block that should ride the bottom edge. `styleMap` binds `height`, `max-height`, `transform`, and `transition` from that component's state. `classMap` binds `opened` and `closed`.
19
+
20
+ The first render is the resting state and `transition: none`. The drawer binds shut (`0px`, sheet `-100%`). The page login binds the card at `height: auto` with the signup form already `closed`. Settings binds the active tab at `auto`, or the signed-out line when nobody is logged in. Nothing eases on that paint. Class `motion` is added on that component's `.inner` afterwards, and it only arms the form swap. The roll's transition is written later, inside that component's own ease, when the user actually changes something.
14
21
 
15
- On close, visibility is held for `1.4s`, so the panel does not vanish before the motion ends.
22
+ JS measures the height in px and the binding eases from the current px to the next px. The range is the real height, so the ease is not crushed into the start of a huge range. At progress `p`, open from 0, the clip is `p` times the height and the sheet is shifted `(p - 1)` times its height. A height change that is not from 0 uses clip `A + (B - A) * p` and `translateY = clip − sheetHeight`.
16
23
 
17
- Closed content translates to `-102%` and runs `slide-out`, so height and position change together.
24
+ After the clip's own `max-height` `transitionend`, the binding becomes `height: auto` and `max-height: none`. The listener requires `event.target` to be that clip. Closing measures again, locks that px, and eases both heights to `0` and the transform back to `-100%`. A drawer form swap, a page-login switch, and a settings tab each run only their own ease.
18
25
 
19
- If either motion loses its timing, they fall out of step and the slide snaps.
26
+ `sliding` on the drawer turns on as the open starts. It turns off when the drawer's clip reaches 0. That same moment drops `visibility`, `pointer-events`, and `inert`. The host's `max-height: 0` backstop has no transition, so it cannot play an open-to-closed ease at load.
27
+
28
+ The drawer and the page login still swap login and sign-up inside `.inner`. That pair shares one grid cell: the open form is `position: relative` and sets the height, the closed form is absolute and translated up. `.inner` clips it. Settings tabs do not use that pair. Their panel area is their own roll. The nav stays outside it.
29
+
30
+ `@keyframes slide-out` only changes `max-height`. It is not the form swap. Playing it on `.closed`, or leaving `.closed` in flow with `position: relative`, moves the row while the transform runs and the forms snap instead of sliding past each other.
20
31
 
21
32
  ## Elements
22
33
 
@@ -24,43 +35,39 @@ On the drawer, inside `.userDrawer`:
24
35
 
25
36
  `spec` → `wrapper` → `inner` → `content`
26
37
 
27
- `wrapper` does not transition. `inner` clips the slide.
38
+ `wrapper` does not transition. `inner` clips the form swap. `.drawer-clip` clips the roll.
28
39
 
29
40
  | Piece | Element | What moves |
30
41
  |---|---|---|
31
- | Shell | `:host`, and `.userDrawer` with `in` / `out` | `max-height` |
32
- | Sheet | `.spec` with `spec-in` / `spec-out` | `transform` |
33
- | Forms and settings panels | `.content` with `opened` / `closed` | `transform`, and `slide-out` on `closed` |
42
+ | Drawer clip | `.drawer-clip` | `0px` ↔ measured px, this host's `--pwa_slide` |
43
+ | Drawer sheet | `section.userDrawer` | lockstep `translateY`, same clock |
44
+ | Drawer and page forms | `.content` with `opened` / `closed` | `transform` `--pwa_slide` after `motion`, then `visibility` |
45
+ | Settings panels | `.settings-clip` / `.settings-sheet` | that component's own roll |
46
+ | Page login card | `.login-clip` / `section.service` | that component's own roll, on `registerTwo` |
34
47
 
35
- Page login uses `spec` / `wrapper` / `inner` / `content` for the form swap. It has no collapsing shell. The four settings panels (`profile`, `verification`, `password`, `delete`) are `.content` inside `wrapper` / `inner`. They have no `.spec`.
36
-
37
- `user-login` host uses the same max-height timing as the drawer shell. Nothing sets the `animation` attribute, so that host does not collapse.
48
+ Page login uses `spec` / `wrapper` / `inner` / `content` for the form swap, and rolls `section.service` when that swap changes the card height. The four settings panels (`profile`, `verification`, `password`, `delete`) sit in `.settings-sheet`. The inactive ones are `hidden`. The nav is outside the roll.
38
49
 
39
50
  ## Triggers
40
51
 
41
- - Attribute `drawer` on `user-drawer`. Classes `in` and `out` on `.userDrawer`. That opens and closes the shell.
42
- - Classes `spec-in` and `spec-out` on `.spec`. Same flag. The sheet moves.
43
- - Classes `opened` and `closed` on `.content`. Drawer and page forms follow sign-in versus sign-up. Settings panels follow the tab.
52
+ - Attribute `drawer` on `user-drawer`, after the first update, rolls `.drawer-clip`. Attribute `sliding` holds `visibility`, `pointer-events`, and `inert` until that clip's `max-height` `transitionend`. The `[drawer]` attribute does not set a transform.
53
+ - Class `motion` on `.inner` arms `.content` transitions. It is absent on the first paint. The drawer and the page login each set their own.
54
+ - Classes `opened` and `closed` on `.content`, bound with `classMap`. Drawer forms follow `registerOne`. Page forms follow `registerTwo`. Settings panels follow the tab by rolling `.settings-clip`, not by those classes.
44
55
  - Attribute `on` on `.spec` is `display`. It is not a slide.
45
- - Attribute `animation` on `user-login` would open the host `max-height`. It is not set.
46
56
 
47
57
  ## Timings
48
58
 
49
- Durations are literals. The shell beat is `1.4s`. Leave it there.
59
+ `--pwa_slide` is `2s` on each component's `:host`. The drawer and the page login set it in `animation.ts`. Settings sets it in `settings.ts`. Every transform duration and every close delay in that component reads its own variable. Do not add a second number, and do not put the variable on `:root`.
50
60
 
51
61
  | Piece | Duration | Easing |
52
62
  |---|---|---|
53
- | Host and `.in` / `.out` `max-height` | `1.4s` | `ease-in-out` |
54
- | `.in` visibility delay | `1.4s` | `linear` |
55
- | `.spec-out` transform, open | `2.2s` | `ease` |
56
- | `.spec-in` transform, close | `1.5s` | `ease` |
57
- | `.content` transform | `2s` | `ease-in-out` |
58
- | `slide-out` on `.closed` | `2s` | `ease-out` |
59
-
60
- The sheet moves from `translate3d(0, -100%, 0)` to `translate3d(0, 0, 0)`. Opening was measured at `2.2s` (`.spec-out`). Closing uses `.spec-in` at `1.5s`.
63
+ | Clip `height` / `max-height` and sheet transform | `--pwa_slide` (`2s`) | `ease-in-out` |
64
+ | Form-swap height glide | `--pwa_slide` (`2s`) | `ease-in-out` |
65
+ | `sliding` drop (`visibility`, `pointer-events`, `inert`) | on the clip's `transitionend` | n/a |
66
+ | `.content` transform, after `motion` | `--pwa_slide` (`2s`) | `ease-in-out` |
67
+ | `.content` visibility delay when closing | `--pwa_slide` (`2s`) | `linear` |
61
68
 
62
- No slide timing is a custom property. Hosts do not set one.
69
+ Open and close are the same duration. The first paint uses neither.
63
70
 
64
71
  ## Reduced motion
65
72
 
66
- `prefers-reduced-motion: reduce` sets `transition-duration` and `animation-duration` to `0s` on the shell, the sheet, and `.content`. Only inside that media query. It does not go through a custom property.
73
+ `prefers-reduced-motion: reduce` sets that host's `--pwa_slide` to `0s`. The roll also skips the ease and writes the resting binding with `transition: none`. Only inside that media query, and only on that host.
package/package.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://www.jackspublishing.com",
7
7
  "email": "jack.solutionbox@gmail.com"
8
8
  },
9
- "version": "3.6.0",
9
+ "version": "3.7.0",
10
10
  "description": "Five elements: user-icon, user-drawer, user-login, user-settings, and email-reset. pwa- events, a small API, and --pwa_ theme variables.",
11
11
  "homepage": "https://pwa-authentic.firebaseapp.com",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/busynest/user"
14
+ "url": "git+https://github.com/busynest/user.git"
15
15
  },
16
16
  "bugs": {
17
17
  "url": "https://github.com/busynest/user/issues"
@@ -31,9 +31,11 @@
31
31
  "user-login",
32
32
  "user-settings",
33
33
  "email-reset",
34
- "web components"
34
+ "web components",
35
+ "custom elements"
35
36
  ],
36
37
  "main": "./base/export/pwa-auth.js",
38
+ "module": "./base/export/pwa-auth.js",
37
39
  "types": "./base/export/pwa-auth.d.ts",
38
40
  "exports": {
39
41
  ".": {
@@ -41,33 +43,69 @@
41
43
  "import": "./base/export/pwa-auth.js",
42
44
  "default": "./base/export/pwa-auth.js"
43
45
  },
46
+ "./drawer": {
47
+ "types": "./base/export/drawer.d.ts",
48
+ "import": "./base/export/drawer.js",
49
+ "default": "./base/export/drawer.js"
50
+ },
51
+ "./login": {
52
+ "types": "./base/export/login.d.ts",
53
+ "import": "./base/export/login.js",
54
+ "default": "./base/export/login.js"
55
+ },
56
+ "./settings": {
57
+ "types": "./base/export/settings.d.ts",
58
+ "import": "./base/export/settings.js",
59
+ "default": "./base/export/settings.js"
60
+ },
61
+ "./icon": {
62
+ "types": "./base/export/icon.d.ts",
63
+ "import": "./base/export/icon.js",
64
+ "default": "./base/export/icon.js"
65
+ },
66
+ "./reset": {
67
+ "types": "./base/export/reset.d.ts",
68
+ "import": "./base/export/reset.js",
69
+ "default": "./base/export/reset.js"
70
+ },
44
71
  "./production": {
45
72
  "types": "./base/export/pwa-auth.d.ts",
46
73
  "import": "./source/pwa-auth.js",
47
74
  "default": "./source/pwa-auth.js"
48
75
  }
49
76
  },
50
- "sideEffects": true,
77
+ "sideEffects": [
78
+ "./base/export/pwa-auth.js",
79
+ "./base/export/drawer.js",
80
+ "./base/export/login.js",
81
+ "./base/export/settings.js",
82
+ "./base/export/icon.js",
83
+ "./base/export/reset.js",
84
+ "./base/webcomponents/**/*.js",
85
+ "./source/pwa-auth.js"
86
+ ],
51
87
  "files": [
52
88
  "base",
53
89
  "source/pwa-auth.js",
54
90
  "source/pwa-styles.css",
55
91
  "source/empty.jpg",
56
92
  "README.md",
57
- "intro.md",
58
- "firebase.md",
93
+ "docs/drawer-slide.md",
59
94
  "docs/sliders.md",
60
95
  "license",
61
96
  "LICENSES.txt"
62
97
  ],
63
98
  "typesVersions": {
64
99
  "*": {
65
- "production": [
66
- "./base/export/pwa-auth.d.ts"
67
- ]
100
+ "drawer": ["./base/export/drawer.d.ts"],
101
+ "login": ["./base/export/login.d.ts"],
102
+ "settings": ["./base/export/settings.d.ts"],
103
+ "icon": ["./base/export/icon.d.ts"],
104
+ "reset": ["./base/export/reset.d.ts"],
105
+ "production": ["./base/export/pwa-auth.d.ts"]
68
106
  }
69
107
  },
70
- "license": "SEE LICENSES.txt",
108
+ "license": "MIT",
71
109
  "scripts": {
72
110
  "server": "web-dev-server --node-resolve --watch --open",
73
111
  "demo": "web-dev-server --node-resolve --watch --open --app-index demonstration/index.html",