@stacksjs/components 0.2.785 → 0.2.788

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 (35) hide show
  1. package/dist/AddressField-gcydmvkf.stx +33 -0
  2. package/dist/CommandBar-k35nsefs.stx +34 -0
  3. package/dist/ContentCard-gjsm9qrr.stx +19 -0
  4. package/dist/FloatingPanel-qp8cq8hz.stx +21 -0
  5. package/dist/{List-dpvcp0z1.stx → List-q8ff8gdr.stx} +12 -2
  6. package/dist/SidebarDivider-6whech7a.stx +19 -0
  7. package/dist/SidebarRow-301dd797.stx +51 -0
  8. package/dist/SpaceSwitcher-297p5gnb.stx +22 -0
  9. package/dist/TileGrid-nne4x506.stx +47 -0
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.js +7 -7
  12. package/dist/ui/app-frame/AddressField.d.ts +4 -0
  13. package/dist/ui/app-frame/CommandBar.d.ts +4 -0
  14. package/dist/ui/app-frame/ContentCard.d.ts +4 -0
  15. package/dist/ui/app-frame/FloatingPanel.d.ts +4 -0
  16. package/dist/ui/app-frame/SidebarDivider.d.ts +4 -0
  17. package/dist/ui/app-frame/SidebarRow.d.ts +4 -0
  18. package/dist/ui/app-frame/SpaceSwitcher.d.ts +4 -0
  19. package/dist/ui/app-frame/TileGrid.d.ts +4 -0
  20. package/dist/ui/app-frame/index.d.ts +69 -0
  21. package/dist/ui/list/index.d.ts +1 -0
  22. package/package.json +3 -3
  23. package/src/index.ts +1 -0
  24. package/src/ui/app-frame/AddressField.stx +33 -0
  25. package/src/ui/app-frame/CommandBar.stx +34 -0
  26. package/src/ui/app-frame/ContentCard.stx +19 -0
  27. package/src/ui/app-frame/FloatingPanel.stx +21 -0
  28. package/src/ui/app-frame/README.md +42 -0
  29. package/src/ui/app-frame/SidebarDivider.stx +19 -0
  30. package/src/ui/app-frame/SidebarRow.stx +51 -0
  31. package/src/ui/app-frame/SpaceSwitcher.stx +22 -0
  32. package/src/ui/app-frame/TileGrid.stx +47 -0
  33. package/src/ui/app-frame/index.ts +87 -0
  34. package/src/ui/list/List.stx +12 -2
  35. package/src/ui/list/index.ts +3 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.785",
4
+ "version": "0.2.788",
5
5
  "description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -77,8 +77,8 @@
77
77
  "dependencies": {
78
78
  "@iconify-json/f7": "^1.2.2",
79
79
  "@stacksjs/ts-css": "^0.3.11",
80
- "@stacksjs/stx": "0.2.785",
81
- "bun-plugin-stx": "0.2.785",
80
+ "@stacksjs/stx": "0.2.788",
81
+ "bun-plugin-stx": "0.2.788",
82
82
  "ts-syntax-highlighter": "^0.2.17",
83
83
  "ts-video-player": "^0.1.11"
84
84
  },
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ export * from './utils/overlays'
12
12
  export * from './theme'
13
13
  // Export UI components
14
14
  export * from './ui/accordion'
15
+ export * from './ui/app-frame'
15
16
  export * from './ui/audio'
16
17
  export * from './ui/auth'
17
18
  export * from './ui/avatar'
@@ -0,0 +1,33 @@
1
+ <script client>
2
+ /**
3
+ * The page's address as a pill you press to edit: the address bar of a
4
+ * sidebar browser, or a search field that opens a search screen.
5
+ *
6
+ * Arc's: 36pt tall, 10pt corners, a fill a shade darker than the sidebar, the
7
+ * host in the sidebar's colour at three-quarters strength, and two buttons at
8
+ * the right end (copy the link, the site's controls) that come in under the
9
+ * pointer. A touch screen has no pointer, so there they stay.
10
+ */
11
+ const text = useReactiveProp('text', '')
12
+ const placeholder = useReactiveProp('placeholder', 'Search or enter address')
13
+ /** A lock before the text, for a secure page. */
14
+ const secure = useReactiveProp('secure', false)
15
+ const tint = useReactiveProp('tint', '#1b1d3a')
16
+ const fill = useReactiveProp('fill', '#0000000d')
17
+ /** Shows the copy-link button. */
18
+ const copyable = useReactiveProp('copyable', true)
19
+ /** Shows the site-controls button. */
20
+ const controls = useReactiveProp('controls', false)
21
+ const testId = useReactiveProp('testId', 'address')
22
+ const emit = defineEmits(['open', 'copylink', 'controls'])
23
+ const touch = useMediaQuery('(hover: none)')
24
+ const hovered = state(false)
25
+ const actionsShown = derived(() => touch() || hovered())
26
+ </script>
27
+
28
+ <Pressable class="flex-row gap-[6px] items-center pl-[12px] pr-[3px] h-[36px] rounded-[10px] duration-150 transition" :style="{ backgroundColor: fill() }" :testID="testId()" @press="emit('open')" @hover-change="hovered.set($event.hovered)">
29
+ <Icon :if="secure()" symbol="lock.fill" class="h-[11px] w-[11px]" :style="{ color: tint(), opacity: 0.55 }" />
30
+ <Text class="flex-1 font-medium text-[14px]" :style="{ color: tint(), opacity: text() ? 0.75 : 0.45 }" :numberOfLines="1">{{ text() || placeholder() }}</Text>
31
+ <Button :if="actionsShown() && text() && copyable()" symbol="link" variant="ghost" iconOnly class="text-[12px]" :style="{ color: tint() }" :testID="testId() + '-copy'" @click.stop="emit('copylink')" />
32
+ <Button :if="actionsShown() && controls()" symbol="slider.horizontal.3" variant="ghost" iconOnly class="text-[12px]" :style="{ color: tint() }" testID="site-controls" @click.stop="emit('controls')" />
33
+ </Pressable>
@@ -0,0 +1,34 @@
1
+ <script client>
2
+ /**
3
+ * A search field with its results under it, for jumping anywhere by typing:
4
+ * Arc's command bar, a launcher, a palette of actions.
5
+ *
6
+ * It owns no state: the parent keeps the text and which result is
7
+ * highlighted, and hears `input`, `keydown` (arrows, Escape), `submit` and
8
+ * `pick` (a result's index). On a narrow screen it takes the full width.
9
+ *
10
+ * `results`: `{ key, title, detail?, image?, symbol? }`.
11
+ */
12
+ const value = useReactiveProp('value', '')
13
+ const placeholder = useReactiveProp('placeholder', 'Search or enter address')
14
+ const results = useReactiveProp('results', [])
15
+ const highlighted = useReactiveProp('highlighted', 0)
16
+ const accent = useReactiveProp('accent', '#3b5bfd')
17
+ const testId = useReactiveProp('testId', 'command')
18
+ const emit = defineEmits(['input', 'keydown', 'submit', 'pick'])
19
+ const narrow = useMediaQuery('(max-width: 720px)')
20
+ </script>
21
+
22
+ <View class="overflow-hidden gap-[4px] p-[8px] bg-white/90 rounded-[16px] shadow-2xl" material="hud" :style="{ width: narrow() ? '94%' : 680 }">
23
+ <View class="flex-row gap-[10px] items-center px-[10px] h-[48px]">
24
+ <Icon symbol="magnifyingglass" class="h-[17px] w-[17px]" :style="{ color: '#6b6e8f' }" />
25
+ <TextInput class="flex-1 text-[19px]" :bordered="false" :value="value()" autofocus select-text-on-focus :placeholder="placeholder()" :testID="testId()" @input="emit('input', $event)" @keydown="emit('keydown', $event)" @submit="emit('submit')" />
26
+ </View>
27
+ <View :if="results().length" class="mx-[6px] h-[1px] bg-black/10"></View>
28
+ <Pressable :for="(result, index) in results()" :key="result.key" class="flex-row gap-[10px] items-center px-[12px] h-[40px] rounded-[10px]" :style="index === highlighted() ? { backgroundColor: accent() } : {}" :testID="'result-' + index" @press="emit('pick', index)">
29
+ <Image :if="result.image" :src="result.image" class="h-[16px] w-[16px] rounded-[3px]" />
30
+ <Icon :if="!result.image" :symbol="result.symbol || 'globe'" class="h-[16px] w-[16px]" :style="{ color: index === highlighted() ? '#ffffff' : '#3a3d5c' }" />
31
+ <Text class="flex-1 text-[14px]" :style="{ color: index === highlighted() ? '#ffffff' : '#1b1d3a' }" :numberOfLines="1">{{ result.title }}</Text>
32
+ <Text :if="result.detail" class="text-[12px]" :style="{ color: index === highlighted() ? '#ffffffcc' : '#6b6e8f' }">{{ result.detail }}</Text>
33
+ </Pressable>
34
+ </View>
@@ -0,0 +1,19 @@
1
+ <script client>
2
+ /**
3
+ * The card a document sits on beside a sidebar: Arc's web page, rounded and
4
+ * lifted off the window's colour by a soft shadow, with a hairline across the
5
+ * top while it loads. The page goes in the default slot.
6
+ */
7
+ /** 0 to 1 while loading; 0 hides the line. */
8
+ const progress = useReactiveProp('progress', 0)
9
+ const dark = useReactiveProp('dark', false)
10
+ const accent = useReactiveProp('accent', '#3b5bfd')
11
+ /** A ring round the card: the chosen pane of a split view. */
12
+ const ring = useReactiveProp('ring', false)
13
+ const testId = useReactiveProp('testId', '')
14
+ </script>
15
+
16
+ <View class="overflow-hidden flex-1 rounded-[10px]" :style="{ backgroundColor: dark() ? '#1d1e24' : '#ffffff', shadowColor: '#000000', shadowOpacity: 0.14, shadowRadius: 4, shadowOffset: { width: 0, height: 1 }, borderWidth: ring() ? 2 : 0, borderColor: ring() ? accent() : '#00000000' }" :testID="testId()">
17
+ <slot />
18
+ <View :if="progress() > 0" class="absolute left-0 top-0 h-[2px] duration-200 transition" :style="{ width: (progress() * 100) + '%', backgroundColor: accent() }"></View>
19
+ </View>
@@ -0,0 +1,21 @@
1
+ <script client>
2
+ /**
3
+ * A panel that floats over the window on the system's HUD material: a
4
+ * popover's body, a find bar, a permission prompt. What it holds goes in the
5
+ * default slot; `place` positions it (`{ left: 14, top: 86 }`, or `right`,
6
+ * `bottom`), and without one it sits where its parent lays it out.
7
+ */
8
+ const width = useReactiveProp('width', 300)
9
+ const place = useReactiveProp('place', null)
10
+ const padding = useReactiveProp('padding', 14)
11
+ const testId = useReactiveProp('testId', '')
12
+ const panelStyle = derived(() => ({
13
+ width: width(),
14
+ padding: padding(),
15
+ ...(place() ? { position: 'absolute', zIndex: 30, ...place() } : {}),
16
+ }))
17
+ </script>
18
+
19
+ <View class="gap-[10px] bg-white/95 rounded-[14px] shadow-2xl" material="hud" :style="panelStyle()" :testID="testId()">
20
+ <slot />
21
+ </View>
@@ -0,0 +1,42 @@
1
+ # App frame
2
+
3
+ The frame of a document app: a sidebar of rows and tiles, the card the
4
+ document sits on, a command bar, and panels that float over the window. Built
5
+ to Arc's measurements (a 228pt sidebar, 36pt address field, 47pt favourites
6
+ four across, 40pt rows, a card inset 10pt), from the native primitives, so the
7
+ same component renders:
8
+
9
+ - on the web, where `View`, `Text` and `Pressable` render as HTML;
10
+ - in a native Mac window (Craft's AppKit host), with hover handled by the host;
11
+ - on a phone or tablet, where nothing hovers: rows grow to the 44pt touch
12
+ target and show their buttons, and the command bar takes the full width
13
+ under 720pt.
14
+
15
+ Every value a component draws is a prop it reads live (`useReactiveProp`), so
16
+ a component can stand in a `:for`. The ones that come in dozens (`SidebarRow`,
17
+ `TileGrid`'s tiles) take one object rather than a prop per field, since every
18
+ prop is a binding and a signal of its own.
19
+
20
+ | Component | What it is | Emits |
21
+ |---|---|---|
22
+ | `SidebarRow` | A tab, folder or action row: `:item`, `:theme` | `select`, `close`, `menu`, `drop`, `rename`, `imageerror` |
23
+ | `TileGrid` | Favourites: `:items`, `:columns` (4) | `select`, `menu`, `drop`, `imageerror` |
24
+ | `AddressField` | The address as a pill: `:text`, `:secure`, `:controls` | `open`, `copylink`, `controls` |
25
+ | `SidebarDivider` | A hairline with a quiet action: `:action` | `action` |
26
+ | `SpaceSwitcher` | A row of icons, one current: `:items`, `:active` | `select`, `menu` |
27
+ | `ContentCard` | The document's card: `:progress`, `:ring`, default slot | |
28
+ | `FloatingPanel` | A HUD panel: `:width`, `:place`, default slot | |
29
+ | `CommandBar` | Search field and results: `:value`, `:results`, `:highlighted` | `input`, `keydown`, `submit`, `pick` |
30
+
31
+ ```stx
32
+ <script client>
33
+ const rows = state([{ label: 'Inbox', symbol: 'tray', active: true }])
34
+ const touch = useMediaQuery('(hover: none)')
35
+ </script>
36
+
37
+ <SidebarRow :for="row in rows()" :key="row.label" :item="row" :theme="{ tint: '#11143f', touch: touch() }" @select="open(row)" />
38
+ ```
39
+
40
+ The types for `item`, `items`, `results` and `place` are exported beside the
41
+ components: `SidebarRowItem`, `TileGridItem`, `SpaceSwitcherItem`,
42
+ `CommandBarResult`, `FloatingPanelPlace`.
@@ -0,0 +1,19 @@
1
+ <script client>
2
+ /**
3
+ * A hairline between two parts of a sidebar, with an optional quiet action at
4
+ * its end: Arc's line between pinned tabs and Today, and its "↓ Clear".
5
+ */
6
+ const action = useReactiveProp('action', '')
7
+ const actionSymbol = useReactiveProp('actionSymbol', 'arrow.down')
8
+ const tint = useReactiveProp('tint', '#1b1d3a')
9
+ const testId = useReactiveProp('testId', '')
10
+ const emit = defineEmits(['action'])
11
+ </script>
12
+
13
+ <View class="flex-row gap-[8px] items-center pl-[10px] pr-[4px] h-[17px]">
14
+ <View class="flex-1 h-[1px]" :style="{ backgroundColor: tint(), opacity: 0.12 }"></View>
15
+ <Pressable :if="action()" class="flex-row gap-[3px] items-center px-[5px] h-[17px] hover:bg-black/5 rounded-[5px]" :testID="testId()" @press="emit('action')">
16
+ <Icon :symbol="actionSymbol()" class="h-[9px] w-[9px]" :style="{ color: tint(), opacity: 0.45 }" />
17
+ <Text class="font-semibold text-[11px]" :style="{ color: tint(), opacity: 0.45 }">{{ action() }}</Text>
18
+ </Pressable>
19
+ </View>
@@ -0,0 +1,51 @@
1
+ <script client>
2
+ /**
3
+ * One row of an app's sidebar: a tab, a folder, a pinned page, an action.
4
+ *
5
+ * Measured off Arc: 40pt tall, the icon's 18pt box at 9pt in, the label at
6
+ * 35pt, a 10pt radius, and the chosen row lifted out as a white card. A close
7
+ * button shows where a pointer hovers. On a touch screen (no hover) the row is
8
+ * 44pt, the touch target the platform asks for, and the button always shows.
9
+ *
10
+ * `item` is the row, read live so the component can stand in a `:for`:
11
+ * `{ label, image?, symbol?, emoji?, active?, strong?, muted?, depth?,
12
+ * closable?, closeSymbol?, editing?, highlighted?, dragData?, dragUrl?,
13
+ * dropInside?, testId? }`. One object rather than a prop each: every prop is a
14
+ * binding and a signal of its own, and a sidebar has dozens of rows.
15
+ * `theme`: `{ tint, activeBackground?, hoverBackground?, touch? }`, shared by every row; `touch`
16
+ * (no hovering pointer) makes the row 44pt and always shows its button.
17
+ */
18
+ const item = useReactiveProp('item', {})
19
+ const theme = useReactiveProp('theme', {})
20
+ const emit = defineEmits(['select', 'close', 'menu', 'drop', 'rename', 'imageerror'])
21
+ // Kept lean on purpose: a sidebar holds dozens of these, and every signal,
22
+ // derived value and effect is a few objects more per row for the collector.
23
+ // The theme carries `touch` (computed once by the parent) for the same reason.
24
+ const hovered = state(false)
25
+ let draft = null
26
+
27
+ function rowStyle(row, look, over) {
28
+ return {
29
+ height: look.touch ? 44 : 40,
30
+ paddingLeft: 9 + (row.depth || 0) * 16,
31
+ backgroundColor: row.active ? look.activeBackground || '#ffffffd9' : over ? look.hoverBackground || '#0000000d' : '#00000000',
32
+ shadowColor: '#000000',
33
+ shadowOpacity: row.active ? 0.08 : 0,
34
+ shadowRadius: row.active ? 2 : 0,
35
+ shadowOffset: { width: 0, height: row.active ? 1 : 0 },
36
+ borderWidth: row.highlighted ? 2 : 0,
37
+ borderColor: row.highlighted ? '#3b5bfd' : '#00000000',
38
+ }
39
+ }
40
+ function finish() { emit('rename', (draft ?? item().label ?? '').trim()); draft = null }
41
+ function typed(event) { draft = String(event?.text ?? event?.value ?? event?.target?.value ?? '') }
42
+ </script>
43
+
44
+ <Pressable class="flex-row gap-[8px] items-center pr-[5px] rounded-[10px] duration-100 transition" :style="rowStyle(item(), theme(), hovered())" :draggable="Boolean(item().dragData)" :drag-data="item().dragData || ''" :drag-url="item().dragUrl || ''" :drop-inside="Boolean(item().dropInside)" :testID="item().testId || ''" @press="emit('select')" @contextmenu="emit('menu')" @drop="emit('drop', $event)" @hover-change="hovered.set($event.hovered)">
45
+ <Image :if="item().image" :src="item().image" class="h-[18px] w-[18px] rounded-[4px]" @error="emit('imageerror', item().image)" />
46
+ <Icon :if="!item().image && item().symbol" :symbol="item().symbol" class="h-[17px] w-[18px]" :style="{ color: theme().tint || '#1b1d3a', opacity: item().muted ? 0.5 : 1 }" />
47
+ <Text :if="!item().image && !item().symbol && item().emoji" class="w-[18px] text-[14px] text-center">{{ item().emoji }}</Text>
48
+ <Text :if="!item().editing" class="flex-1 text-[14px]" :class="item().strong ? 'font-semibold' : 'font-medium'" :style="{ color: theme().tint || '#1b1d3a', opacity: item().muted ? 0.5 : 1 }" :numberOfLines="1">{{ item().label }}</Text>
49
+ <TextInput :if="item().editing" class="flex-1 font-medium text-[14px]" :bordered="false" :value="item().label" autofocus select-text-on-focus :testID="(item().testId || '') + '-rename'" @input="typed($event)" @submit="finish()" @blur="finish()" />
50
+ <Button :if="item().closable && !item().editing && (theme().touch || hovered())" :symbol="item().closeSymbol || 'xmark'" variant="ghost" iconOnly class="text-[11px]" :style="{ color: theme().tint || '#1b1d3a', opacity: item().muted ? 0.5 : 1 }" :testID="(item().testId || '') + '-close'" @click.stop="emit('close')" />
51
+ </Pressable>
@@ -0,0 +1,22 @@
1
+ <script client>
2
+ /**
3
+ * A row of icons that each switch the view to one of several spaces,
4
+ * workspaces or accounts: the foot of Arc's sidebar.
5
+ *
6
+ * Each icon is a 36 by 34pt target; the current one is drawn at full strength
7
+ * and the rest faded, as Arc does.
8
+ *
9
+ * `items`: `{ id, label?, symbol?, emoji?, testId? }`; `active` is the current id.
10
+ */
11
+ const items = useReactiveProp('items', [])
12
+ const active = useReactiveProp('active', '')
13
+ const tint = useReactiveProp('tint', '#1b1d3a')
14
+ const emit = defineEmits(['select', 'menu'])
15
+ </script>
16
+
17
+ <View class="flex-row items-center justify-center">
18
+ <Pressable :for="item in items()" :key="item.id" class="items-center justify-center h-[34px] w-[36px] hover:bg-black/5 rounded-[8px]" :testID="item.testId || ''" :accessibilityLabel="item.label || ''" @press="emit('select', item.id)" @contextmenu="emit('menu', item.id)">
19
+ <Icon :if="item.symbol" :symbol="item.symbol" class="h-[14px] w-[16px]" :style="{ color: tint(), opacity: item.id === active() ? 0.85 : 0.35 }" />
20
+ <Text :if="!item.symbol" class="text-[13px]" :style="{ color: tint(), opacity: item.id === active() ? 1 : 0.5 }">{{ item.emoji || '●' }}</Text>
21
+ </Pressable>
22
+ </View>
@@ -0,0 +1,47 @@
1
+ <script client>
2
+ /**
3
+ * A grid of square-ish tiles: an app's favourites, pinned apps, shortcuts.
4
+ *
5
+ * Arc's favourites: four columns across the sidebar, 8pt apart, 12pt corners,
6
+ * an 18pt icon in the middle, a faint fill that darkens under the pointer (the
7
+ * host applies `hover:` itself, so hovering costs no script) and
8
+ * turns white for the open one. A short last row keeps its tiles the width of
9
+ * the others rather than stretching them. `columns` sets how many fit across,
10
+ * which a phone or a wide sidebar can raise.
11
+ *
12
+ * `items`: `{ id, label?, image?, symbol?, emoji?, active?, dragData?, dragUrl?, testId? }`.
13
+ */
14
+ const items = useReactiveProp('items', [])
15
+ const columns = useReactiveProp('columns', 4)
16
+ const tint = useReactiveProp('tint', '#1b1d3a')
17
+ const fill = useReactiveProp('fill', '#0000000d')
18
+ const activeFill = useReactiveProp('activeFill', '#ffffffd9')
19
+ /** The tile height; the width is the column's. */
20
+ const height = useReactiveProp('height', 47)
21
+ const emit = defineEmits(['select', 'menu', 'drop', 'imageerror'])
22
+
23
+ /** The items in rows of `columns`, the last one padded with empty cells. */
24
+ const grid = derived(() => {
25
+ const across = Math.max(1, Number(columns()) || 4)
26
+ const list = items() || []
27
+ const out = []
28
+ for (let start = 0; start < list.length; start += across) {
29
+ const row = list.slice(start, start + across).map(item => ({ key: item.id, item }))
30
+ while (row.length < across) row.push({ key: `pad-${start}-${row.length}`, item: null })
31
+ out.push({ key: `row-${start}`, cells: row })
32
+ }
33
+ return out
34
+ })
35
+ </script>
36
+
37
+ <View class="gap-[8px]" @drop="emit('drop', $event)">
38
+ <View :for="row in grid()" :key="row.key" class="flex-row gap-[8px]">
39
+ <View :for="cell in row.cells" :key="cell.key" class="flex-1">
40
+ <Pressable :if="cell.item" class="items-center justify-center hover:bg-black/10 rounded-[12px] duration-150 transition" :style="{ height: height(), backgroundColor: cell.item.active ? activeFill() : fill(), shadowColor: '#000000', shadowOpacity: cell.item.active ? 0.08 : 0, shadowRadius: cell.item.active ? 2 : 0, shadowOffset: { width: 0, height: cell.item.active ? 1 : 0 } }" :draggable="Boolean(cell.item.dragData)" :drag-data="cell.item.dragData || ''" :drag-url="cell.item.dragUrl || ''" :testID="cell.item.testId || ''" :accessibilityLabel="cell.item.label || ''" @press="emit('select', cell.item.id)" @contextmenu="emit('menu', cell.item.id)">
41
+ <Image :if="cell.item.image" :src="cell.item.image" class="h-[18px] w-[18px] rounded-[4px]" @error="emit('imageerror', cell.item.image)" />
42
+ <Icon :if="!cell.item.image && cell.item.symbol" :symbol="cell.item.symbol" class="h-[18px] w-[18px]" :style="{ color: tint() }" />
43
+ <Text :if="!cell.item.image && !cell.item.symbol" class="text-[16px]">{{ cell.item.emoji || (cell.item.label || '?').slice(0, 1).toUpperCase() }}</Text>
44
+ </Pressable>
45
+ </View>
46
+ </View>
47
+ </View>
@@ -0,0 +1,87 @@
1
+ export { default as AddressField } from './AddressField.stx'
2
+ export { default as CommandBar } from './CommandBar.stx'
3
+ export { default as ContentCard } from './ContentCard.stx'
4
+ export { default as FloatingPanel } from './FloatingPanel.stx'
5
+ export { default as SidebarDivider } from './SidebarDivider.stx'
6
+ export { default as SidebarRow } from './SidebarRow.stx'
7
+ export { default as SpaceSwitcher } from './SpaceSwitcher.stx'
8
+ export { default as TileGrid } from './TileGrid.stx'
9
+
10
+ /** What one sidebar row shows: `<SidebarRow :item="..." />`. */
11
+ export interface SidebarRowItem {
12
+ label: string
13
+ /** A picture for the leading box (a favicon); wins over `symbol` and `emoji`. */
14
+ image?: string
15
+ /** A system symbol name (`folder.fill`, `plus`). */
16
+ symbol?: string
17
+ emoji?: string
18
+ /** The open row, drawn as a white card. */
19
+ active?: boolean
20
+ /** A heading row (a folder): the label in semibold. */
21
+ strong?: boolean
22
+ /** A quiet row (New Tab): the label at half strength. */
23
+ muted?: boolean
24
+ /** Nesting level; each one indents 16pt. */
25
+ depth?: number
26
+ /** Offers a close button (on hover with a pointer, always on touch). */
27
+ closable?: boolean
28
+ closeSymbol?: string
29
+ /** Edits the label in place; the row emits `rename` with the new text. */
30
+ editing?: boolean
31
+ /** A ring for a drop about to land here. */
32
+ highlighted?: boolean
33
+ dragData?: string
34
+ dragUrl?: string
35
+ /** A folder takes drops inside it. */
36
+ dropInside?: boolean
37
+ testId?: string
38
+ }
39
+
40
+ /** Shared by every row: `<SidebarRow :theme="..." />`. */
41
+ export interface SidebarRowTheme {
42
+ tint?: string
43
+ activeBackground?: string
44
+ hoverBackground?: string
45
+ /** No hovering pointer: 44pt rows with their buttons always shown. */
46
+ touch?: boolean
47
+ }
48
+
49
+ /** One tile of a `<TileGrid :items="..." />`. */
50
+ export interface TileGridItem {
51
+ id: string
52
+ label?: string
53
+ image?: string
54
+ symbol?: string
55
+ emoji?: string
56
+ active?: boolean
57
+ dragData?: string
58
+ dragUrl?: string
59
+ testId?: string
60
+ }
61
+
62
+ /** One icon of a `<SpaceSwitcher :items="..." />`. */
63
+ export interface SpaceSwitcherItem {
64
+ id: string
65
+ label?: string
66
+ symbol?: string
67
+ emoji?: string
68
+ testId?: string
69
+ }
70
+
71
+ /** One result of a `<CommandBar :results="..." />`. */
72
+ export interface CommandBarResult {
73
+ key: string
74
+ title: string
75
+ /** Right-aligned, quieter: "Switch to Tab", a shortcut, a kind. */
76
+ detail?: string
77
+ image?: string
78
+ symbol?: string
79
+ }
80
+
81
+ /** Where a `<FloatingPanel>` sits, in points from the window's edges. */
82
+ export interface FloatingPanelPlace {
83
+ left?: number
84
+ right?: number
85
+ top?: number
86
+ bottom?: number
87
+ }
@@ -46,7 +46,7 @@ const webPadding = derived(() => {
46
46
  const vertical = style.paddingVertical ?? all
47
47
  const across = style.paddingHorizontal ?? all
48
48
  const px = value => `${Math.max(0, Number(value) || 0)}px`
49
- return { maxHeight: horizontal() ? 'none' : '100dvh', maxWidth: '100%', boxSizing: 'border-box', ...(horizontal() ? { display: 'flex', flexDirection: 'row', overflowX: 'auto', overflowY: 'hidden' } : {}), paddingTop: px(style.paddingTop ?? vertical), paddingBottom: px(style.paddingBottom ?? vertical), paddingLeft: px(style.paddingLeft ?? across), paddingRight: px(style.paddingRight ?? across) }
49
+ return { maxWidth: '100%', boxSizing: 'border-box', ...(horizontal() ? { display: 'flex', flexDirection: 'row', overflowX: 'auto', overflowY: 'hidden' } : {}), paddingTop: px(style.paddingTop ?? vertical), paddingBottom: px(style.paddingBottom ?? vertical), paddingLeft: px(style.paddingLeft ?? across), paddingRight: px(style.paddingRight ?? across) }
50
50
  })
51
51
  onMount(() => {
52
52
  if (nativeHost || typeof IntersectionObserver !== 'function') return
@@ -76,9 +76,19 @@ onMount(() => {
76
76
  return () => { stop(); changes.disconnect(); observer.disconnect() }
77
77
  })
78
78
  </script>
79
- <div data-native="FlatList" ref="listRef" role="list" class="{{ viewportClasses }} {{ className }}" :horizontal="horizontal()" :contentContainerStyle="contentStyle()" :style="nativeHost ? {} : webPadding()" data-stx-list data-stx-layout-root @end-reached="reachedEnd()" @refresh="emit('refresh')">
79
+ <div data-native="FlatList" ref="listRef" role="list" class="{{ viewportClasses }} {{ className }}" :horizontal="horizontal()" :contentContainerStyle="contentStyle()" :style="nativeHost ? {} : webPadding()" :data-stx-list-direction="horizontal ? 'horizontal' : 'vertical'" data-stx-list data-stx-layout-root @end-reached="reachedEnd()" @refresh="emit('refresh')">
80
80
  <slot />
81
81
  @if(!nativeHost)
82
82
  <div ref="endRef" aria-hidden="true" style="height:1px;width:1px;flex-shrink:0"></div>
83
83
  @endif
84
84
  </div>
85
+
86
+ @if(!nativeHost)
87
+ <style>
88
+ /* A page list needs a fallback bound, but authored viewport classes win.
89
+ Keeping the fallback at zero specificity also works when it follows the
90
+ application's stylesheet, including during SPA navigation. */
91
+ :where([data-stx-list]) { max-height: 100dvh; }
92
+ :where([data-stx-list][data-stx-list-direction="horizontal"]) { max-height: none; }
93
+ </style>
94
+ @endif
@@ -2,7 +2,9 @@ export { default as List } from './List.stx'
2
2
 
3
3
  /** A bounded scrolling collection. Keep keyed data rows as direct children. */
4
4
  export interface ListProps {
5
+ /** Viewport utilities, including bounds that override the browser's one-viewport default. */
5
6
  className?: string
7
+ horizontal?: boolean
6
8
  testID?: string
7
9
  refreshing?: boolean
8
10
  onRefresh?: () => void
@@ -10,5 +12,6 @@ export interface ListProps {
10
12
  /** Block paging during a request; hasMore stops it after the final page. */
11
13
  loading?: boolean
12
14
  hasMore?: boolean
15
+ /** Content padding shared by browsers and native hosts. */
13
16
  contentContainerStyle?: Record<string, number>
14
17
  }