@swiftbrowser/web 0.26.4 → 0.26.5
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.
- package/package.json +1 -1
- package/src/deviceFrame.ts +2 -2
- package/src/layout/engine.ts +365 -172
- package/src/layoutDom.ts +8 -2
- package/src/protocol.ts +8 -0
- package/src/renderer.ts +4 -1
- package/src/styles.css +391 -146
- package/src/symbols.ts +3 -0
package/src/layoutDom.ts
CHANGED
|
@@ -161,7 +161,7 @@ function applyFrames(ctx: LayoutDomContext, result: LayoutResult, changes: BoxCh
|
|
|
161
161
|
applyChrome(result, node, el, box, frame, scrollBottomInset(ctx, result, node, frame), previous === null, changes);
|
|
162
162
|
if (node.kind === 'tab') setTabHidden(el, result.hidden.has(id));
|
|
163
163
|
// A `sidebar` list draws as one (no cards or hairlines) in a regular width; in a compact one it looks like `insetGrouped`.
|
|
164
|
-
if (node.kind === 'list') setFlag(el, 'sbListLook', node.props['style'] === 'sidebar' && isRegularWidth(ctx.env.screen) ? 'sidebar' : null);
|
|
164
|
+
if (node.kind === 'list') setFlag(el, 'sbListLook', (node.props['style'] === 'sidebar' || result.chrome.get(id)?.['sidebarLook']) && isRegularWidth(ctx.env.screen) ? 'sidebar' : null);
|
|
165
165
|
// A child the engine did not touch kept its screen frame, but if this
|
|
166
166
|
// element's box moved, the child's `left`/`top` (relative to it) did
|
|
167
167
|
// not: the plus button at the bottom of a chat's composer stays put on
|
|
@@ -343,6 +343,8 @@ function placeEditControl(node: HTMLElement | null, rect: Rect | undefined, orig
|
|
|
343
343
|
* goes, scales and fades as the items do (`TOOLBAR_TRANSITION`), in the
|
|
344
344
|
* toolbar's own spring.
|
|
345
345
|
*/
|
|
346
|
+
const BAR_PLACEMENTS = new Set(['leading', 'trailing', 'bottom']);
|
|
347
|
+
|
|
346
348
|
function syncBarGlass(
|
|
347
349
|
result: LayoutResult,
|
|
348
350
|
node: LayoutNode,
|
|
@@ -354,7 +356,9 @@ function syncBarGlass(
|
|
|
354
356
|
): void {
|
|
355
357
|
for (const placement of ['leading', 'trailing', 'bottom'] as const) {
|
|
356
358
|
const unmatched = new Set(screen.querySelectorAll<HTMLElement>(`:scope > .sb-bar-glass[data-sb-placement="${placement}"]:not([data-sb-exiting])`));
|
|
357
|
-
|
|
359
|
+
// A capsule's toolbars are those whose frames lie in it, of any bar
|
|
360
|
+
// placement: on a Mac a bottom toolbar's items are on the trailing capsules.
|
|
361
|
+
const toolbars = node.children.filter((child) => child.kind === 'toolbar' && BAR_PLACEMENTS.has(String(child.props['placement'])));
|
|
358
362
|
for (let count = 0, rect = chrome?.[`${placement}Glass0`]; rect; rect = chrome?.[`${placement}Glass${++count}`]) {
|
|
359
363
|
const capsule = rect;
|
|
360
364
|
const ids = toolbars.filter((toolbar) => centeredIn(result.frames.get(toolbar.id), capsule)).map((toolbar) => String(toolbar.id));
|
|
@@ -881,6 +885,7 @@ function applyChrome(
|
|
|
881
885
|
// the label column's texts (chrome `formLabel<i>`) as spans in the
|
|
882
886
|
// content, as many as the engine placed.
|
|
883
887
|
setFlag(el, 'sbFormColumns', chrome?.['columns'] ? '' : null);
|
|
888
|
+
setFlag(el, 'sbFormGrouped', chrome?.['grouped'] ? '' : null);
|
|
884
889
|
if (content) {
|
|
885
890
|
const texts = result.chromeText.get(node.id);
|
|
886
891
|
const labels = content.querySelectorAll<HTMLElement>(':scope > .sb-form-label');
|
|
@@ -1064,6 +1069,7 @@ function applyChrome(
|
|
|
1064
1069
|
case 'navsplit': {
|
|
1065
1070
|
// Phase 7: the sidebar toggle (the sidebar column draws the hairline).
|
|
1066
1071
|
placeChrome(el.querySelector<HTMLElement>(':scope > .sb-navsplit-toggle'), chrome?.['toggle'], box);
|
|
1072
|
+
placeChrome(el.querySelector<HTMLElement>(':scope > .sb-navsplit-panel'), chrome?.['panel'], box);
|
|
1067
1073
|
setFlag(el, 'sbSidebarHidden', node.props['sidebarVisible'] === false ? '' : null);
|
|
1068
1074
|
return;
|
|
1069
1075
|
}
|
package/src/protocol.ts
CHANGED
|
@@ -625,6 +625,14 @@ export interface ListProps {
|
|
|
625
625
|
style?: ListStyle;
|
|
626
626
|
/** A `Form`: on a Mac the page lays its rows out in the columns style (labels in a column before their controls). */
|
|
627
627
|
form?: boolean;
|
|
628
|
+
/** `.formStyle(_:)` other than `automatic`: on a Mac `grouped` lays the form out in grouped sections. */
|
|
629
|
+
formStyle?: 'grouped' | 'columns';
|
|
630
|
+
/**
|
|
631
|
+
* `.environment(\.defaultMinListRowHeight, _)`: the rows are at least
|
|
632
|
+
* this tall (points). Absent, the platform's default: 44 on iOS, 24 on a
|
|
633
|
+
* Mac. A Mac app spaces a content list's rows like a sidebar's, 32.
|
|
634
|
+
*/
|
|
635
|
+
minRowHeight?: number;
|
|
628
636
|
}
|
|
629
637
|
export interface SectionProps {
|
|
630
638
|
header: string | null;
|
package/src/renderer.ts
CHANGED
|
@@ -3372,7 +3372,10 @@ function createShell(kind: ElementKind): HTMLElement {
|
|
|
3372
3372
|
toggle.setAttribute('aria-label', 'Toggle Sidebar');
|
|
3373
3373
|
const symbol = renderSymbol('sidebar.left');
|
|
3374
3374
|
if (symbol) toggle.append(symbol);
|
|
3375
|
-
|
|
3375
|
+
// The Mac's floating sidebar panel, under the columns (the engine's `panel` rect).
|
|
3376
|
+
const panel = div('sb-navsplit-panel');
|
|
3377
|
+
panel.hidden = true;
|
|
3378
|
+
el.append(panel, slot, toggle);
|
|
3376
3379
|
SLOTS.set(el, slot);
|
|
3377
3380
|
return el;
|
|
3378
3381
|
}
|