@swiftbrowser/web 0.5.3 → 0.5.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftbrowser/web",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "type": "module",
5
5
  "description": "SwiftBrowser web renderer and dev server: applies render ops from a Swift/Wasm app to the DOM inside an iPhone frame.",
6
6
  "repository": {
@@ -252,6 +252,11 @@ const NAV_GLASS_SIZE = 44;
252
252
  const NAV_GLASS_PAD_H = 12;
253
253
  const NAV_GROUP_SPACING = 8;
254
254
 
255
+ /** Whether any text is laid out in an item (a bottom bar pads text items as text). */
256
+ function hasText(item: LayoutNode): boolean {
257
+ return item.kind === 'text' || item.children.some(hasText);
258
+ }
259
+
255
260
  /** A bar item that is only a symbol (an `image`, or a button, menu or link around one). */
256
261
  function isSymbolItem(item: LayoutNode): boolean {
257
262
  const inner = unwrapStyled(item);
@@ -268,11 +273,15 @@ function navSlot(item: LayoutNode, width: number): number {
268
273
  // bottom toolbar's items float on Liquid Glass in a 48 row 28 above the
269
274
  // screen bottom (as the search field does) and 28 in from the sides.
270
275
  // Consecutive items share a capsule: an icon takes a 50 slot, text its width
271
- // and 18 either side, 6 between slots; a lone icon is a 48 circle.
276
+ // and 18 either side, 6 between slots; a lone icon is a 48 circle. An item
277
+ // with no text (symbols, a symbol and a chevron, a custom view) is an icon
278
+ // at any width: at least 50, else its width and 8 either side, so a little
279
+ // more width gives it a little more room (not text's 18 a side).
272
280
  const BOTTOM_GLASS_HEIGHT = 48;
273
281
  const BOTTOM_GLASS_MARGIN_H = 28;
274
282
  const BOTTOM_ICON_SLOT = 50;
275
283
  const BOTTOM_TEXT_PAD_H = 18;
284
+ const BOTTOM_ICON_PAD_H = 8;
276
285
  const BOTTOM_ITEM_GAP = 6;
277
286
  /** A fixed `ToolbarSpacer` between two bottom groups. */
278
287
  const BOTTOM_FIXED_SPACER = 8;
@@ -3435,7 +3444,11 @@ export class LayoutPass {
3435
3444
  const itemCtx = this.childContext(toolbar, cctx);
3436
3445
  for (const node of toolbar.children) {
3437
3446
  const size = this.measure(node, itemCtx, { width: null, height: null });
3438
- const slot = size.width < NAV_GLASS_SIZE ? BOTTOM_ICON_SLOT : size.width + 2 * BOTTOM_TEXT_PAD_H;
3447
+ const slot = !hasText(node)
3448
+ ? Math.max(BOTTOM_ICON_SLOT, size.width + 2 * BOTTOM_ICON_PAD_H)
3449
+ : size.width < NAV_GLASS_SIZE
3450
+ ? BOTTOM_ICON_SLOT
3451
+ : size.width + 2 * BOTTOM_TEXT_PAD_H;
3439
3452
  open.push({ node, toolbar, size, slot });
3440
3453
  }
3441
3454
  }
package/src/symbols.ts CHANGED
@@ -141,6 +141,7 @@ import {
141
141
  Crown,
142
142
  Database,
143
143
  Delete,
144
+ Eraser,
144
145
  Diamond,
145
146
  Dices,
146
147
  Dog,
@@ -251,6 +252,7 @@ import {
251
252
  MonitorPlay,
252
253
  Moon,
253
254
  Mountain,
255
+ MousePointer2,
254
256
  Music,
255
257
  Navigation2,
256
258
  Network,
@@ -343,6 +345,7 @@ import {
343
345
  SquareMinus,
344
346
  SquareParking,
345
347
  SquarePen,
348
+ SquareDashed,
346
349
  SquarePlay,
347
350
  SquarePlus,
348
351
  SquareUser,
@@ -558,6 +561,10 @@ export const SF_SYMBOLS: Readonly<Record<string, SymbolGlyph>> = {
558
561
  trash: outline(Trash),
559
562
  'trash.fill': outline(Trash),
560
563
  pencil: outline(Pencil),
564
+ // The editing tools of a drawing app: the pointer (macOS's arrow), a marquee, the eraser.
565
+ cursorarrow: outline(MousePointer2),
566
+ 'square.dashed': outline(SquareDashed),
567
+ eraser: outline(Eraser),
561
568
  'square.and.pencil': outline(SquarePen),
562
569
  'doc.on.doc': outline(Copy),
563
570
  'doc.on.clipboard': outline(Clipboard),