@stacksjs/defaults 0.75.105 → 0.75.106

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.
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.105",
5
+ "version": "0.75.106",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.105",
5
+ "version": "0.75.106",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@iconify-json/f7": "^1.2.2",
57
57
  "@iconify-json/hugeicons": "^1.2.35",
58
- "@stacksjs/mobile": "^0.75.105",
58
+ "@stacksjs/mobile": "^0.75.106",
59
59
  "@stacksjs/sanitizer": "^0.2.419",
60
60
  "@xterm/addon-fit": "^0.11.0",
61
61
  "@xterm/xterm": "^6.0.0",
@@ -258,6 +258,15 @@ describe('Native components feel native', () => {
258
258
  expect(sheet).toContain('putBack ??= liftToBody(element)')
259
259
  })
260
260
 
261
+ it('slides a sheet up from where it was lifted to, rather than appearing up', () => {
262
+ const sheet = read('NativeSheet')
263
+ // is-open follows `shown`, which present() sets only after the lifted
264
+ // sheet's closed style is worked out in the body.
265
+ expect(sheet).toContain("const sheetClass = derived(() => `${shown() ? 'is-open' : ''}")
266
+ expect(sheet).toContain('getComputedStyle(sheetPanel).transform')
267
+ expect(sheet.indexOf('putBack ??= liftToBody(element)')).toBeLessThan(sheet.indexOf('shown.set(true)'))
268
+ })
269
+
261
270
  it('presses the page back into a card behind a large sheet, unless motion is reduced', () => {
262
271
  const sheet = read('NativeSheet')
263
272
  expect(sheet).toContain('presentPageAsCard(element.ownerDocument, want)')
@@ -34,6 +34,10 @@ const detents = derived<SheetDetent[]>(() => {
34
34
  })
35
35
  const hasDetents = derived(() => Boolean(detentsProp()) && detentsProp().length > 0)
36
36
  const detent = state<SheetDetent>('large')
37
+ // Whether the sheet is drawn up. It follows `open`, but only once the sheet
38
+ // sits in the body with its closed position worked out there (present()), so
39
+ // it has somewhere to slide up from.
40
+ const shown = state(false)
37
41
 
38
42
  const sheetRoot = useRef('nativeSheet')
39
43
  const panel = useRef('nativeSheetPanel')
@@ -69,10 +73,18 @@ function present(): void {
69
73
  releaseBackground = lockBackground(element)
70
74
  openedOn = currentPath()
71
75
  coverTabBar(element, true)
76
+ // A node moved in the document starts over with no style to transition
77
+ // from, so a sheet lifted and marked open in one go appears already up.
78
+ // Work its closed style out where it now is, then open it: the panel
79
+ // slides from there.
80
+ const sheetPanel = panel.current as HTMLElement | null
81
+ if (sheetPanel) void element.ownerDocument.defaultView?.getComputedStyle(sheetPanel).transform
82
+ shown.set(true)
72
83
  void nextTick(() => (panel.current as HTMLElement | null)?.focus())
73
84
  }
74
85
 
75
86
  function dismissed(): void {
87
+ shown.set(false)
76
88
  const element = root()
77
89
  if (element) coverTabBar(element, false)
78
90
  releaseBackground?.()
@@ -153,7 +165,7 @@ useEventListener('keydown', (event: KeyboardEvent) => {
153
165
  else if (panel.current) trapFocus(panel.current as HTMLElement, event)
154
166
  })
155
167
 
156
- const sheetClass = derived(() => `${open() ? 'is-open' : ''}${hasDetents() ? ' has-detents' : ''}${detent() === 'medium' ? ' is-medium' : ''}`.trim())
168
+ const sheetClass = derived(() => `${shown() ? 'is-open' : ''}${hasDetents() ? ' has-detents' : ''}${detent() === 'medium' ? ' is-medium' : ''}`.trim())
157
169
  </script>
158
170
 
159
171
  <div ref="nativeSheet" class="native-sheet" :class="sheetClass()" :aria-hidden="open() ? 'false' : 'true'" data-native-sheet>