pantheon-opencode 1.6.3-beta.11 → 1.6.3-beta.13

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.
@@ -10,8 +10,13 @@
10
10
  * awaited — startup must never block). The decision lives in
11
11
  * whats-new-open.ts; this file is only the host glue + view:
12
12
  * `context.ui.dialog.show` plus a keymap layer gated on the open signal so
13
- * `escape`/`q` dismiss while (and only while) the window is up — the same
14
- * gated-layer pattern as the dispatch panel.
13
+ * `escape`/`q` dismiss and `n`/`p` flip pages while (and only while) the
14
+ * window is up — the same gated-layer pattern as the dispatch panel.
15
+ *
16
+ * The window shows the curated 🆕 What's New summary (whats-new-highlights
17
+ * prefers it), hard-wrapped to the window width and sliced into fixed-size
18
+ * pages — a big changelog can never overflow the terminal; the footer points
19
+ * at the complete CHANGELOG.md.
15
20
  *
16
21
  * Deliberately V2-only: the two dist entries are self-contained (the V1
17
22
  * sidebar mirrors the preset resolver rather than importing it) because any
@@ -29,22 +34,37 @@
29
34
  import type { Context } from '@opencode/plugin/tui/context'
30
35
  import { createSignal, For } from 'solid-js'
31
36
  import { readChangelogForBundle, resolveRunningVersion } from './whats-new-highlights.ts'
32
- import { openWhatsNew, type WhatsNewViewData } from './whats-new-open.ts'
37
+ import { openWhatsNew, type WhatsNewViewData, wrapWhatsNewLine } from './whats-new-open.ts'
33
38
  import { defaultWhatsNewStatePath } from './whats-new-state.ts'
34
39
 
35
- /** Window body: title, rule, bounded highlight lines, dismiss hint. */
36
- export function WhatsNewContent(props: { data: WhatsNewViewData; fg?: any; muted?: any }) {
40
+ /** Window body: title, rule, the current page (wrapped), footer hint. */
41
+ export function WhatsNewContent(props: {
42
+ data: WhatsNewViewData
43
+ page: () => number
44
+ pageCount: () => number
45
+ fg?: any
46
+ muted?: any
47
+ }) {
48
+ const rows = () => {
49
+ const current = props.data.pages[Math.min(props.page(), props.pageCount() - 1)] ?? []
50
+ const wrapped: string[] = []
51
+ for (const line of current) wrapped.push(...wrapWhatsNewLine(line, 76))
52
+ return wrapped
53
+ }
37
54
  return (
38
55
  <box flexDirection="column" paddingLeft={1} paddingRight={1} paddingTop={1}>
39
56
  <text attributes={1} fg={props.fg}>
40
57
  {props.data.title}
41
58
  </text>
42
59
  <text fg={props.muted}>{'─'.repeat(38)}</text>
43
- <For each={props.data.lines}>
60
+ <For each={rows()}>
44
61
  {(line: string) => <text fg={line.startsWith('• ') ? props.fg : props.muted}>{line}</text>}
45
62
  </For>
46
63
  <box height={1} />
47
- <text fg={props.muted}>{props.data.hint}</text>
64
+ <text fg={props.muted}>
65
+ {props.pageCount() > 1 ? `${props.page() + 1}/${props.pageCount()} · ` : ''}
66
+ {props.data.hint}
67
+ </text>
48
68
  </box>
49
69
  )
50
70
  }
@@ -61,6 +81,9 @@ export async function maybeShowWhatsNewV2(context: Context): Promise<void> {
61
81
  const changelogText = await readChangelogForBundle(import.meta.url)
62
82
 
63
83
  const [open, setOpen] = createSignal(false)
84
+ const [page, setPage] = createSignal(0)
85
+ let viewData: WhatsNewViewData | undefined
86
+ const pageCount = () => Math.max(1, Math.ceil(viewData?.pages.length ?? 1))
64
87
  let dismiss: () => void = () => {}
65
88
  try {
66
89
  // Gated layer: inert (all keys fall through) while the window is closed.
@@ -78,6 +101,26 @@ export async function maybeShowWhatsNewV2(context: Context): Promise<void> {
78
101
  return undefined
79
102
  },
80
103
  },
104
+ {
105
+ id: 'pantheon.whats-new.next',
106
+ title: 'Próxima página',
107
+ bind: 'n,right',
108
+ run: () => {
109
+ if (!open()) return false
110
+ setPage((current) => Math.min(current + 1, pageCount() - 1))
111
+ return undefined
112
+ },
113
+ },
114
+ {
115
+ id: 'pantheon.whats-new.prev',
116
+ title: 'Página anterior',
117
+ bind: 'p,left',
118
+ run: () => {
119
+ if (!open()) return false
120
+ setPage((current) => Math.max(current - 1, 0))
121
+ return undefined
122
+ },
123
+ },
81
124
  ],
82
125
  }))
83
126
  } catch {
@@ -101,11 +144,21 @@ export async function maybeShowWhatsNewV2(context: Context): Promise<void> {
101
144
  }
102
145
  close()
103
146
  }
147
+ viewData = render()
148
+ setPage(0)
104
149
  setOpen(true)
105
150
  try {
106
151
  const theme = context.theme?.text ?? {}
107
152
  context.ui.dialog.show(
108
- () => <WhatsNewContent data={render()} fg={theme.base} muted={theme.muted} />,
153
+ () => (
154
+ <WhatsNewContent
155
+ data={viewData as WhatsNewViewData}
156
+ page={page}
157
+ pageCount={pageCount}
158
+ fg={theme.base}
159
+ muted={theme.muted}
160
+ />
161
+ ),
109
162
  close,
110
163
  )
111
164
  } catch {