@cscfi/csc-ui 4.0.0-alpha.15 → 4.0.0-alpha.16

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.
@@ -163,15 +163,15 @@ c-autocomplete::part(list) {
163
163
  ## Narrow viewports
164
164
 
165
165
  On a viewport narrower than 760px the panel opens as a **fullscreen panel**
166
- instead of anchoring under the field: a heading row with the field's `label` and a
167
- close button, the search input beneath it, then the options filling the rest of
168
- the screen. The rows above the options stay in view while the on-screen
169
- keyboard is open; the close button and Escape both return focus to the field;
170
- the page behind the panel is inert until it closes, and the list has no
171
- half-row cut — the screen edge is the cue. The threshold is the viewport's
172
- width, never the field's, so a narrow field on a desktop keeps its anchored
173
- panel. The close button's label is the `closePanel` text, and the row's
174
- parts are `heading-row`, `heading` and `close`:
166
+ instead of anchoring under the field: a heading row with the field's `label` and
167
+ a close button, the search input beneath it, then the options filling the rest
168
+ of the screen. The panel keeps covering the screen and the rows above the
169
+ options stay in view while the on-screen keyboard is open; the close button and
170
+ Escape both return focus to the field; the page behind the panel is inert until
171
+ it closes, and the list has no half-row cut — the screen edge is the cue. The
172
+ threshold is the viewport's width, never the field's, so a narrow field on a
173
+ desktop keeps its anchored panel. The close button's label is the `closePanel`
174
+ text, and the row's parts are `heading-row`, `heading` and `close`:
175
175
 
176
176
  ```css
177
177
  c-autocomplete::part(heading-row) {
@@ -110,15 +110,15 @@ c-select::part(list) {
110
110
  ## Narrow viewports
111
111
 
112
112
  On a viewport narrower than 760px the panel opens as a **fullscreen panel**
113
- instead of dropping under the field: a heading row with the field's `label` and a
114
- close button, the field itself beneath it, then the options filling the rest of
115
- the screen. The rows above the options stay in view while the on-screen
116
- keyboard is open; the close button and Escape both return focus to the field;
117
- the page behind the panel is inert until it closes, and the list has no
118
- half-row cut — the screen edge is the cue. The threshold is the viewport's
119
- width, never the field's, so a narrow field on a desktop keeps its anchored
120
- panel. The close button's label is the `closePanel` text, and the row's
121
- parts are `heading-row`, `heading` and `close`:
113
+ instead of dropping under the field: a heading row with the field's `label` and
114
+ a close button, the field itself beneath it, then the options filling the rest
115
+ of the screen. The panel keeps covering the screen and the rows above the
116
+ options stay in view while the on-screen keyboard is open; the close button and
117
+ Escape both return focus to the field; the page behind the panel is inert until
118
+ it closes, and the list has no half-row cut — the screen edge is the cue. The
119
+ threshold is the viewport's width, never the field's, so a narrow field on a
120
+ desktop keeps its anchored panel. The close button's label is the `closePanel`
121
+ text, and the row's parts are `heading-row`, `heading` and `close`:
122
122
 
123
123
  ```css
124
124
  c-select::part(heading-row) {
@@ -130,15 +130,15 @@ c-tree-select::part(list) {
130
130
  ## Narrow viewports
131
131
 
132
132
  On a viewport narrower than 760px the panel opens as a **fullscreen panel**
133
- instead of anchoring under the field: a heading row with the field's `label` and a
134
- close button, the search input beneath it, then the items filling the rest of
135
- the screen. The rows above the items stay in view while the on-screen
136
- keyboard is open; the close button and Escape both return focus to the field;
137
- the page behind the panel is inert until it closes, and the list has no
138
- half-row cut — the screen edge is the cue. The threshold is the viewport's
139
- width, never the field's, so a narrow field on a desktop keeps its anchored
140
- panel. The close button's label is the `closePanel` text, and the row's
141
- parts are `heading-row`, `heading` and `close`:
133
+ instead of anchoring under the field: a heading row with the field's `label` and
134
+ a close button, the search input beneath it, then the items filling the rest of
135
+ the screen. The panel keeps covering the screen and the rows above the items
136
+ stay in view while the on-screen keyboard is open; the close button and Escape
137
+ both return focus to the field; the page behind the panel is inert until it
138
+ closes, and the list has no half-row cut — the screen edge is the cue. The
139
+ threshold is the viewport's width, never the field's, so a narrow field on a
140
+ desktop keeps its anchored panel. The close button's label is the `closePanel`
141
+ text, and the row's parts are `heading-row`, `heading` and `close`:
142
142
 
143
143
  ```css
144
144
  c-tree-select::part(heading-row) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@cscfi/csc-ui",
4
- "version": "4.0.0-alpha.15",
4
+ "version": "4.0.0-alpha.16",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -19,11 +19,13 @@
19
19
  * back with a negative block-start margin;
20
20
  * - the fullscreen layout: chosen at `open()` from the `fullscreen`
21
21
  * predicate and kept for the whole open (crossing the threshold while open
22
- * closes the panel). The panel drops anchor positioning and follows the
23
- * *visual* viewport — `visualViewport` resize / scroll while open — so the
24
- * heading row and search input stay above the on-screen keyboard;
25
- * `100dvh` where the API is missing. The page behind it is locked
26
- * (`pageLock.ts`: inert except toasts, no document scroll);
22
+ * closes the panel). The panel drops anchor positioning and becomes the
23
+ * surface — `position: fixed; inset: 0`, the layout viewport, which the
24
+ * on-screen keyboard overlays but never shrinks — while the card inside it
25
+ * follows the *visual* viewport (`visualViewport` resize / scroll while
26
+ * open; `cardStyle`), so the heading row and search input stay above the
27
+ * keyboard and the page never shows beside them. The page behind it is
28
+ * locked (`pageLock.ts`: inert except toasts, no document scroll);
27
29
  * - open / close through `showPopover()` / `hidePopover()` on a
28
30
  * `popover="manual"` panel, with the native `toggle` event as the single
29
31
  * source of truth for `isOpen` (browser-initiated closes included);
@@ -37,10 +39,10 @@
37
39
  * `--c-field-panel-above-left` flip rules and `position-try-fallbacks` —
38
40
  * per-shadow-root escape-hatch CSS (ADR-0007; each element type has its own
39
41
  * adopted sheet, so the block is copy-identical in every consumer) — the
40
- * fullscreen `tv` variant (card fills the panel, list takes the rest, the
41
- * heading row) and the open sequence (peek cap, focus, highlight seed,
42
- * announcement), run from `onOpened` synchronously inside the `toggle`
43
- * handler.
42
+ * fullscreen `tv` variant (the panel paints the surface, the card sheds its
43
+ * anchored chrome, the list takes the rest, the heading row) and the open
44
+ * sequence (peek cap, focus, highlight seed, announcement), run from
45
+ * `onOpened` synchronously inside the `toggle` handler.
44
46
  */
45
47
  import { type ComputedRef, type MaybeRefOrGetter, type Ref } from 'vue';
46
48
  /**
@@ -51,6 +53,8 @@ export declare const FIELD_PANEL_ANCHOR = "--c-field-panel-anchor";
51
53
  export interface AnchoredPanel {
52
54
  /** Inline style for the anchor wrapper: `anchor-name: --c-field-panel-anchor`. */
53
55
  anchorStyle: string;
56
+ /** Inline style for the card inside the panel: empty while anchored; fullscreen — the visual viewport's box inside the surface (the whole surface with no API). */
57
+ cardStyle: ComputedRef<string>;
54
58
  /** Hide the panel; `returnFocus` moves focus to `returnFocusTo` once the `toggle` event confirms the close. */
55
59
  close(returnFocus?: boolean): void;
56
60
  /** Open state — written only by the native `toggle` event (single source of truth, browser-initiated closes included). */
@@ -61,7 +65,7 @@ export interface AnchoredPanel {
61
65
  onToggle(event: Event): void;
62
66
  /** Choose the layout, measure (anchored: the anchor width and the field's message height), then `showPopover()`. */
63
67
  open(): void;
64
- /** Inline style for the panel: anchored — `position-anchor`, `position-area: bottom span-right`, `inset: auto`, the pinned width and the message pull-back; fullscreen — the visual viewport's box. */
68
+ /** Inline style for the panel: anchored — `position-anchor`, `position-area: bottom span-right`, `inset: auto`, the pinned width and the message pull-back; fullscreen — the surface, the layout viewport's box. */
65
69
  panelStyle: ComputedRef<string>;
66
70
  }
67
71
  /** The two layouts one field panel takes (CONTEXT.md "Fullscreen panel"). */
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * Visual viewport tracking for the **fullscreen panel** (CONTEXT.md,
3
- * ADR-0050). A `position: fixed` top-layer surface sized with `100dvh` does
4
- * not shrink when the on-screen keyboard opens on iOS — only the
5
- * `visualViewport` API reports the visible box there. Both fullscreen
6
- * implementations (the anchored-panel composable and `c-dropdown`'s dialog)
7
- * follow it through this one helper while they are open.
3
+ * ADR-0050). Two layers. The *surface* — the panel element itself,
4
+ * `position: fixed; inset: 0` — spans the layout viewport, which the
5
+ * on-screen keyboard overlays but never shrinks, so it covers everything
6
+ * visible whatever the keyboard does. The *content box* inside it (heading
7
+ * row, search input, list) follows `visualViewport` — the only API that sees
8
+ * the iOS keyboard — so it ends above the keyboard. A late or wrong box then
9
+ * shows more surface, never the page. Both fullscreen implementations (the
10
+ * anchored-panel composable and `c-dropdown`'s dialog) go through this one
11
+ * helper while they are open.
8
12
  */
9
13
  /** Stop following the visual viewport. Idempotent. */
10
14
  export type StopTracking = () => void;
@@ -15,7 +19,7 @@ export interface ViewportBox {
15
19
  top: number;
16
20
  width: number;
17
21
  }
18
- /** The current visual viewport box; `null` where the API is missing (then size with `100dvh`). */
22
+ /** The current visual viewport box; `null` where the API is missing (then the content box fills the surface). */
19
23
  export declare const readVisualViewport: () => null | ViewportBox;
20
24
  /**
21
25
  * Report the visual viewport's box now and on every resize / scroll of it
@@ -25,11 +29,23 @@ export declare const readVisualViewport: () => null | ViewportBox;
25
29
  */
26
30
  export declare const trackVisualViewport: (onBox: (box: null | ViewportBox) => void) => StopTracking;
27
31
  /**
28
- * Inline declarations that make a `position: fixed` surface the visual
29
- * viewport's box — or, with no box, the layout viewport (`100dvh`). Both
30
- * override the UA popover / dialog defaults (`inset: 0`, fit-content sizing,
31
- * auto margins).
32
+ * Inline declarations that make a top-layer element the surface: the layout
33
+ * viewport's box. Overrides the UA popover / dialog defaults (`inset: 0` is
34
+ * theirs too, but with fit-content sizing and auto margins).
32
35
  */
33
- export declare const fullscreenBoxStyle: (box: null | ViewportBox) => string;
34
- /** The same box written straight onto an element's inline style (for a surface whose placement is imperative, like `c-dropdown`'s dialog). */
35
- export declare const applyFullscreenBox: (el: HTMLElement, box: null | ViewportBox) => void;
36
+ export declare const FULLSCREEN_SURFACE_STYLE = "position:fixed;inset:0;margin:0;width:auto;height:auto;";
37
+ /**
38
+ * Inline declarations placing the content box inside the surface on the
39
+ * visual viewport's box; with no box (no API) it fills the surface.
40
+ */
41
+ export declare const contentBoxStyle: (box: null | ViewportBox) => string;
42
+ /**
43
+ * `FULLSCREEN_SURFACE_STYLE` written straight onto an element's inline style,
44
+ * for a surface whose placement is imperative (`c-dropdown`'s dialog). Margins
45
+ * are left to its classes.
46
+ */
47
+ export declare const applyFullscreenSurface: (el: HTMLElement) => void;
48
+ /** `contentBoxStyle(box)` written straight onto an element's inline style. */
49
+ export declare const applyContentBox: (el: HTMLElement, box: null | ViewportBox) => void;
50
+ /** Remove exactly what `applyContentBox` set. */
51
+ export declare const clearContentBox: (el: HTMLElement) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cscfi/csc-ui",
3
- "version": "4.0.0-alpha.15",
3
+ "version": "4.0.0-alpha.16",
4
4
  "description": "Vue 3-based replacement for @cscfi/csc-ui — same custom element tag names, Vue v-model contract.",
5
5
  "type": "module",
6
6
  "main": "./dist/csc-ui.js",