topside-arch 0.0.0-stage → 0.1.2

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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +217 -2
  3. package/contrib/aur/.SRCINFO +20 -0
  4. package/contrib/aur/PKGBUILD +35 -0
  5. package/contrib/aur/topside-arch.install +28 -0
  6. package/contrib/icons/hicolor/scalable/apps/topside.svg +28 -0
  7. package/contrib/systemd/topside.service +10 -0
  8. package/contrib/themes/sakura.json +31 -0
  9. package/dist/adapters/claude/attach.js +92 -0
  10. package/dist/adapters/claude/hook-event.js +173 -0
  11. package/dist/adapters/claude/one-shot.js +30 -0
  12. package/dist/adapters/claude/settings.js +78 -0
  13. package/dist/adapters/claude/usage.js +76 -0
  14. package/dist/adapters/codex/codex.js +73 -0
  15. package/dist/adapters/codex/patch.js +39 -0
  16. package/dist/adapters/codex/usage.js +77 -0
  17. package/dist/adapters/pi/extension.js +271 -0
  18. package/dist/adapters/pi/risk-gate.js +256 -0
  19. package/dist/cli/commands.js +615 -0
  20. package/dist/cli/hook-log.js +32 -0
  21. package/dist/cli/main.js +100 -0
  22. package/dist/daemon/preview.js +70 -0
  23. package/dist/daemon/processes.js +105 -0
  24. package/dist/daemon/server.js +437 -0
  25. package/dist/daemon/session-state.js +179 -0
  26. package/dist/daemon/store.js +176 -0
  27. package/dist/dms/setup.js +137 -0
  28. package/dist/hosts/hosts.js +39 -0
  29. package/dist/jump/jump.js +199 -0
  30. package/dist/pill/config.js +92 -0
  31. package/dist/pill/launch.js +38 -0
  32. package/dist/sekaipop/setup.js +267 -0
  33. package/dist/service/unit.js +77 -0
  34. package/dist/shared/ancestry.js +27 -0
  35. package/dist/shared/client.js +29 -0
  36. package/dist/shared/package.js +25 -0
  37. package/dist/shared/paths.js +69 -0
  38. package/dist/shared/protocol.js +35 -0
  39. package/dist/shared/qml-lib.js +33 -0
  40. package/dist/shared/result.js +6 -0
  41. package/dist/shared/terminal.js +42 -0
  42. package/dist/themes/themes.js +84 -0
  43. package/package.json +49 -4
  44. package/shell/core/AgentIcon.qml +24 -0
  45. package/shell/core/AppLogo.qml +48 -0
  46. package/shell/core/ApprovalRow.qml +197 -0
  47. package/shell/core/BoardDetail.qml +336 -0
  48. package/shell/core/BoardList.qml +419 -0
  49. package/shell/core/BoardNotice.qml +189 -0
  50. package/shell/core/CardButton.qml +55 -0
  51. package/shell/core/CardHeader.qml +46 -0
  52. package/shell/core/ChalkBoard.qml +99 -0
  53. package/shell/core/CompletionCard.qml +106 -0
  54. package/shell/core/FlapText.qml +110 -0
  55. package/shell/core/KeyCap.qml +72 -0
  56. package/shell/core/Mascot.qml +13 -0
  57. package/shell/core/MascotBadge.qml +40 -0
  58. package/shell/core/MascotEffect.qml +40 -0
  59. package/shell/core/Paper.qml +54 -0
  60. package/shell/core/PixelGrid.qml +40 -0
  61. package/shell/core/QuestionRow.qml +161 -0
  62. package/shell/core/SessionRow.qml +257 -0
  63. package/shell/core/Stamp.qml +62 -0
  64. package/shell/core/StatusDots.qml +33 -0
  65. package/shell/core/Surface.qml +32 -0
  66. package/shell/core/Tag.qml +22 -0
  67. package/shell/core/TerminalIcon.qml +34 -0
  68. package/shell/core/Theme.qml +100 -0
  69. package/shell/core/TicketDetail.qml +657 -0
  70. package/shell/core/TicketList.qml +717 -0
  71. package/shell/core/TicketNotice.qml +198 -0
  72. package/shell/core/TopsideClient.qml +201 -0
  73. package/shell/core/UsageLine.qml +106 -0
  74. package/shell/core/agents.js +79 -0
  75. package/shell/core/board.js +132 -0
  76. package/shell/core/hiding.js +68 -0
  77. package/shell/core/pixels.js +542 -0
  78. package/shell/core/qmldir +30 -0
  79. package/shell/core/sounds.js +31 -0
  80. package/shell/core/themes.js +195 -0
  81. package/shell/core/ticket.js +170 -0
  82. package/shell/dms-plugin/TopsideSettings.qml +696 -0
  83. package/shell/dms-plugin/TopsideWidget.qml +554 -0
  84. package/shell/dms-plugin/plugin.json +14 -0
  85. package/shell/pill.qml +279 -0
  86. package/shell/sekaipop-plugin/Bar.qml +150 -0
  87. package/shell/sekaipop-plugin/Card.qml +296 -0
  88. package/shell/sekaipop-plugin/Floating.qml +74 -0
  89. package/shell/sekaipop-plugin/ListWindow.qml +156 -0
  90. package/shell/sekaipop-plugin/Popup.qml +70 -0
  91. package/shell/sekaipop-plugin/Service.qml +418 -0
  92. package/shell/sekaipop-plugin/ShellLook.qml +43 -0
  93. package/shell/sekaipop-plugin/StyledCard.qml +194 -0
  94. package/shell/sekaipop-plugin/place.js +28 -0
  95. package/shell/sekaipop-plugin/plugin.json +109 -0
@@ -0,0 +1,296 @@
1
+ import QtQuick
2
+ import QtQuick.Layouts
3
+ import "core" as Topside
4
+ import "core/hiding.js" as Hiding
5
+
6
+ // Topside's card on SekaiPop, drawn in Topside's theme: the logotype
7
+ // header, then a completion card, the questions and requests, and the
8
+ // sessions. Popup.qml puts it on SekaiPop's own popup (opened by a click,
9
+ // with keys); Floating.qml puts it in Topside's own window for the cards
10
+ // that open by themselves, which never takes the keyboard.
11
+ Item {
12
+ id: root
13
+ required property var service
14
+ // Hiding asks first (VIA-PARITY §29): a hide asked from a row, not yet
15
+ // confirmed, { folder, text, sessionId }. It recounts on every snapshot
16
+ // and goes with its session, Keep, or the card closing.
17
+ property var hideAsk: null
18
+ readonly property var hideRule: hideAsk ? Hiding.question(hideAsk, hideAsk.sessionId, service.listed) : null
19
+ onVisibleChanged: hideAsk = null
20
+ // The popup's card is built once and kept, so its own `visible` never
21
+ // changes when SekaiPop closes the popup; the service says so instead.
22
+ Connections {
23
+ target: root.service
24
+ function onPopupOpenChanged() {
25
+ if (!root.service.popupOpen) root.hideAsk = null;
26
+ }
27
+ function onFloatingOpenChanged() {
28
+ if (!root.service.floatingOpen) root.hideAsk = null;
29
+ }
30
+ }
31
+ readonly property var client: service.client
32
+ // The shell's icon font, for the header keys.
33
+ property string iconFont: ""
34
+ property real maxHeight: 700
35
+ // In Topside's own window: a ✕ closes it, since no click away does.
36
+ property bool floating: false
37
+ signal closeRequested()
38
+
39
+ // On SekaiPop's popup with its look matched, the shell's own face shows
40
+ // through; elsewhere the card draws one, with room for its shadow.
41
+ readonly property bool shellFace: !floating && service.matchShell
42
+ readonly property int shadowRoom: shellFace ? 0 : Topside.Theme.shadowOffset
43
+
44
+ // SekaiPop keeps a popup between 280 and 480 wide; take all of it.
45
+ implicitWidth: 480
46
+ implicitHeight: Math.min(root.maxHeight, body.implicitHeight + 28 + shadowRoom)
47
+
48
+ // The first question's card, for ⌃1…⌃9.
49
+ function firstQuestion() {
50
+ return questionCards.count > 0 ? questionCards.itemAt(0) : null;
51
+ }
52
+
53
+ Topside.Surface {
54
+ visible: !root.shellFace
55
+ anchors.fill: parent
56
+ anchors.rightMargin: root.shadowRoom
57
+ anchors.bottomMargin: root.shadowRoom
58
+ radius: Topside.Theme.panelRadius
59
+ color: Topside.Theme.bg
60
+ }
61
+
62
+ // A small icon key in the header, drawn with the shell's icon font.
63
+ component HeaderKey: Text {
64
+ id: key
65
+ signal clicked()
66
+ property string help: ""
67
+ font.family: root.iconFont
68
+ font.pixelSize: 18
69
+ color: keyHover.hovered ? Topside.Theme.fg : Topside.Theme.fgDim
70
+ HoverHandler {
71
+ id: keyHover
72
+ cursorShape: Qt.PointingHandCursor
73
+ }
74
+ TapHandler {
75
+ onTapped: key.clicked()
76
+ }
77
+ }
78
+
79
+ // The list clips, so it reaches nearly to the sides and the content sits
80
+ // `inset` in from there: a session row's highlight runs 10 past the row
81
+ // and would otherwise be cut off square.
82
+ readonly property int inset: 10
83
+
84
+ Flickable {
85
+ anchors.fill: parent
86
+ anchors.topMargin: 14
87
+ anchors.leftMargin: 14 - root.inset
88
+ anchors.rightMargin: 14 - root.inset + root.shadowRoom
89
+ anchors.bottomMargin: 14 + root.shadowRoom
90
+ clip: true
91
+ contentHeight: body.implicitHeight
92
+ boundsBehavior: Flickable.StopAtBounds
93
+
94
+ ColumnLayout {
95
+ id: body
96
+ x: root.inset
97
+ width: parent.width - 2 * root.inset
98
+ spacing: 10
99
+
100
+ RowLayout {
101
+ spacing: 10
102
+ Layout.fillWidth: true
103
+
104
+ Topside.AppLogo {
105
+ cell: 2
106
+ color: Topside.Theme.fg
107
+ Layout.alignment: Qt.AlignVCenter
108
+ }
109
+
110
+ // Plan usage while nothing waits and the agent has reported it; the summary otherwise.
111
+ Item { Layout.fillWidth: true; visible: usageLine.visible }
112
+
113
+ Topside.UsageLine {
114
+ id: usageLine
115
+ usage: root.client.usage[root.service.usageAgent] || null
116
+ // pi and omp: what the session has cost, in place of plan windows.
117
+ spend: root.client.spend[root.service.usageSession] || null
118
+ agent: root.service.usageAgent
119
+ visible: root.service.waitingCount === 0 && !empty
120
+ Layout.alignment: Qt.AlignVCenter
121
+ }
122
+
123
+ Text {
124
+ visible: !usageLine.visible
125
+ text: root.service.summary
126
+ color: root.service.waitingCount > 0 ? Topside.Theme.waiting : Topside.Theme.fgDim
127
+ font.family: Topside.Theme.font
128
+ font.pixelSize: Topside.Theme.content
129
+ elide: Text.ElideRight
130
+ horizontalAlignment: Text.AlignRight
131
+ Layout.fillWidth: true
132
+ }
133
+
134
+ HeaderKey {
135
+ text: root.service.sounds ? "volume_up" : "volume_off"
136
+ onClicked: root.service.toggleSounds()
137
+ }
138
+
139
+ HeaderKey {
140
+ text: "settings"
141
+ onClicked: root.service.openSettings()
142
+ }
143
+
144
+ HeaderKey {
145
+ visible: root.client.connected
146
+ text: "power_settings_new"
147
+ onClicked: {
148
+ root.closeRequested();
149
+ root.service.controlDaemon("stop");
150
+ }
151
+ }
152
+
153
+ HeaderKey {
154
+ visible: root.floating
155
+ text: "close"
156
+ onClicked: root.closeRequested()
157
+ }
158
+ }
159
+
160
+ Loader {
161
+ active: root.service.showCompletion
162
+ visible: active
163
+ Layout.fillWidth: true
164
+ sourceComponent: Topside.CompletionCard {
165
+ session: root.service.finishedSession
166
+ onJump: root.client.jump(root.service.finishedId)
167
+ HoverHandler {
168
+ onHoveredChanged: root.service.cardHovered = hovered
169
+ }
170
+ }
171
+ }
172
+
173
+ Repeater {
174
+ id: questionCards
175
+ model: root.client.questions
176
+ delegate: Topside.QuestionRow {
177
+ required property var modelData
178
+ required property int index
179
+ // Keys only work on SekaiPop's popup, not in the floating window.
180
+ shortcuts: index === 0 && !root.floating
181
+ question: modelData
182
+ session: root.service.sessionFor(modelData.sessionId)
183
+ Layout.fillWidth: true
184
+ onAnswered: answers => root.client.answer(modelData.id, answers)
185
+ onOpenTerminal: root.client.jump(modelData.sessionId)
186
+ }
187
+ }
188
+
189
+ Repeater {
190
+ model: root.client.approvals
191
+ delegate: Topside.ApprovalRow {
192
+ required property var modelData
193
+ required property int index
194
+ shortcuts: index === 0 && root.client.questions.length === 0 && !root.floating
195
+ approval: modelData
196
+ session: root.service.sessionFor(modelData.sessionId)
197
+ Layout.fillWidth: true
198
+ onDecided: decision => root.client.decide(modelData.id, decision)
199
+ onJump: root.client.jump(modelData.sessionId)
200
+ }
201
+ }
202
+
203
+ ColumnLayout {
204
+ visible: !root.service.showCompletion
205
+ spacing: 2
206
+ Layout.fillWidth: true
207
+ Repeater {
208
+ model: root.service.listed
209
+ delegate: Topside.SessionRow {
210
+ required property var modelData
211
+ session: modelData
212
+ canHide: true
213
+ hideQuestion: root.hideRule && root.hideRule.sessionId === modelData.id ? Hiding.questionText(root.hideRule, "session") : ""
214
+ hideCount: root.hideRule ? root.hideRule.caught.length : 0
215
+ willHide: root.hideRule !== null && root.hideRule.caught.indexOf(modelData.id) >= 0
216
+ Layout.fillWidth: true
217
+ onActivated: root.client.jump(modelData.id)
218
+ onHoveredChanged: if (hovered) root.service.hoveredSession = modelData.id; else if (root.service.hoveredSession === modelData.id) root.service.hoveredSession = ""
219
+ onHideFolder: root.hideAsk = { folder: true, text: modelData.cwd || "", sessionId: modelData.id }
220
+ onHidePrompt: root.hideAsk = { folder: false, text: modelData.title || "", sessionId: modelData.id }
221
+ onHideKept: root.hideAsk = null
222
+ onHideConfirmed: {
223
+ const q = root.hideRule;
224
+ root.hideAsk = null;
225
+ if (q) root.service.hide(q.folder ? "hiddenFolders" : "hiddenPrompts", q.text);
226
+ }
227
+ }
228
+ }
229
+ }
230
+
231
+ Text {
232
+ visible: !root.service.showCompletion && root.service.moreCount > 0
233
+ text: "+ " + root.service.moreCount + " more"
234
+ color: moreHover.hovered ? Topside.Theme.fg : Topside.Theme.fgDim
235
+ font.family: Topside.Theme.font
236
+ font.pixelSize: Topside.Theme.content
237
+ Layout.leftMargin: 54
238
+ HoverHandler {
239
+ id: moreHover
240
+ cursorShape: Qt.PointingHandCursor
241
+ }
242
+ TapHandler {
243
+ onTapped: root.service.showAll = true
244
+ }
245
+ }
246
+
247
+ Text {
248
+ visible: root.client.jumpError !== ""
249
+ text: root.client.jumpError
250
+ color: Topside.Theme.reminder
251
+ font.family: Topside.Theme.font
252
+ font.pixelSize: Topside.Theme.content
253
+ wrapMode: Text.Wrap
254
+ Layout.fillWidth: true
255
+ }
256
+
257
+ // Quit, or never started: one button brings it back.
258
+ Rectangle {
259
+ visible: !root.client.connected
260
+ Layout.alignment: Qt.AlignHCenter
261
+ implicitWidth: startLabel.implicitWidth + 28
262
+ implicitHeight: 30
263
+ radius: 15
264
+ color: startHover.hovered ? Topside.Theme.fg : Topside.Theme.bgRaised
265
+ Text {
266
+ id: startLabel
267
+ anchors.centerIn: parent
268
+ text: "Start Topside"
269
+ color: startHover.hovered ? Topside.Theme.bg : Topside.Theme.fg
270
+ font.family: Topside.Theme.font
271
+ font.pixelSize: Topside.Theme.s(12)
272
+ font.weight: Font.DemiBold
273
+ }
274
+ HoverHandler {
275
+ id: startHover
276
+ cursorShape: Qt.PointingHandCursor
277
+ }
278
+ TapHandler {
279
+ onTapped: root.service.controlDaemon("start")
280
+ }
281
+ }
282
+
283
+ Text {
284
+ visible: root.client.sessions.length === 0
285
+ text: root.client.connected ? "No sessions yet. Start claude, codex, pi or omp in a terminal." : "Topside is off."
286
+ color: Topside.Theme.fgDim
287
+ font.family: Topside.Theme.font
288
+ font.pixelSize: Topside.Theme.s(13)
289
+ horizontalAlignment: Text.AlignHCenter
290
+ Layout.fillWidth: true
291
+ Layout.minimumHeight: 56
292
+ verticalAlignment: Text.AlignVCenter
293
+ }
294
+ }
295
+ }
296
+ }
@@ -0,0 +1,74 @@
1
+ import QtQuick
2
+ import Quickshell
3
+ import Quickshell.Wayland
4
+ import "place.js" as Place
5
+
6
+ // Topside's own window for the cards that open by themselves on SekaiPop: a
7
+ // request, a question, a finished turn, a reminder. SekaiPop's popup would
8
+ // take the keyboard (its bar asks for it while a plugin popup is open), so
9
+ // these never use it: this window takes no keys and you keep typing. A click
10
+ // on the bar entry still opens SekaiPop's popup, with the keys.
11
+ PanelWindow {
12
+ id: window
13
+ required property var service
14
+ // The bar entry it sits by: { item, edge } from Bar.qml, or null.
15
+ readonly property var entry: service.entryOn(service.floatingScreen)
16
+
17
+ screen: Quickshell.screens.find(s => s.name === service.floatingScreen) ?? null
18
+ visible: service.floatingOpen && screen !== null
19
+ color: "transparent"
20
+ exclusionMode: ExclusionMode.Ignore
21
+ WlrLayershell.namespace: "topside-card"
22
+ WlrLayershell.layer: WlrLayer.Overlay
23
+ WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
24
+
25
+ implicitWidth: card.implicitWidth
26
+ implicitHeight: card.implicitHeight
27
+
28
+ // Placed as the list is (place.js). The entry's spot is measured when the
29
+ // card opens, so it reads the service's flag, never this window's own
30
+ // `visible`: that made a binding loop, Qt stopped the evaluation, and the
31
+ // card sat in the top left corner (CR-20261118-001).
32
+ readonly property string edge: entry ? entry.edge : "top"
33
+ readonly property var spot: {
34
+ if (!entry || !entry.item || !entry.item.visible || !service.floatingOpen) return null;
35
+ const a = entry.item.mapToItem(null, 0, 0);
36
+ const b = entry.item.mapToItem(null, entry.item.width, entry.item.height);
37
+ return { x: a.x, y: a.y, w: b.x - a.x, h: b.y - a.y };
38
+ }
39
+ readonly property int gap: 10
40
+ readonly property real screenWidth: screen ? screen.width : 1920
41
+
42
+ anchors.top: true
43
+ anchors.left: true
44
+ margins.top: Place.top(edge, spot, gap, 0)
45
+ margins.left: Place.left(edge, spot, screenWidth, card.implicitWidth, gap)
46
+
47
+ // The classic card or the board or ticket, as Settings > Style says.
48
+ Loader {
49
+ id: card
50
+ anchors.fill: parent
51
+ sourceComponent: window.service.styled ? styledCard : classicCard
52
+ }
53
+ Component {
54
+ id: classicCard
55
+ Card {
56
+ service: window.service
57
+ iconFont: window.service.iconFont
58
+ maxHeight: window.screen ? Math.floor(window.screen.height * 0.7) : 700
59
+ floating: true
60
+ onCloseRequested: window.service.closeFloating()
61
+ }
62
+ }
63
+ Component {
64
+ id: styledCard
65
+ StyledCard {
66
+ service: window.service
67
+ iconFont: window.service.iconFont
68
+ maxHeight: window.screen ? Math.floor(window.screen.height * 0.7) : 700
69
+ floating: true
70
+ screenWidth: window.screenWidth
71
+ onCloseRequested: window.service.closeFloating()
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,156 @@
1
+ import QtQuick
2
+ import Quickshell
3
+ import Quickshell.Wayland
4
+ import "core/board.js" as Board
5
+ import "place.js" as Place
6
+
7
+ // The list in Topside's own window, for Style: Board (the departures) and
8
+ // Ticket (the kitchen rail): the screen dims, and under the bar entry, with
9
+ // no SekaiPop frame around it, the board lowers from the top with a small
10
+ // bounce, or the rail fades in and its tickets swing onto it. It takes the keyboard while open,
11
+ // since you opened it with a click: ⌃Y ⌃N ⌃A ⌃1…⌃9 ⌃J as on the popup, Esc
12
+ // or a click outside closes it, a jump closes it too (Service.qml).
13
+ PanelWindow {
14
+ id: window
15
+ required property var service
16
+ readonly property var entry: service.entryOn(service.listScreen)
17
+
18
+ screen: Quickshell.screens.find(s => s.name === service.listScreen) ?? null
19
+ // Set by hand when the list opens and once it has raised away, never
20
+ // bound: showing the window moves the keyboard and SekaiPop's popup
21
+ // reacts, which fed back into a `visible` binding (a loop Qt stopped,
22
+ // leaving the board misplaced).
23
+ visible: false
24
+ color: "transparent"
25
+ // Normal: the window stays out of the bar's zone, so the board and the
26
+ // dim start under the bar and never cover it (as in the prototype).
27
+ exclusionMode: ExclusionMode.Normal
28
+ WlrLayershell.namespace: "topside-list"
29
+ WlrLayershell.layer: WlrLayer.Overlay
30
+ WlrLayershell.keyboardFocus: service.listOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
31
+ anchors.top: true
32
+ anchors.bottom: true
33
+ anchors.left: true
34
+ anchors.right: true
35
+
36
+ // Where the entry is, as Floating.qml measures it: in its bar window,
37
+ // which spans its edge of the screen. Nothing here reads this window's own
38
+ // size or `visible`: that made a binding loop on `visible`, Qt stopped
39
+ // evaluating, and the board sat at the top over the bar (as in
40
+ // CR-20261118-001). Sizes come from `area`, an item, instead.
41
+ readonly property string edge: entry ? entry.edge : "top"
42
+ // Measured once as the list opens and kept while it raises away: a
43
+ // binding on `listOpen` went null on close and slid the board to the
44
+ // screen's centre on its way out.
45
+ property var spot: null
46
+ function measure() {
47
+ if (!entry || !entry.item || !entry.item.visible) return null;
48
+ const a = entry.item.mapToItem(null, 0, 0);
49
+ const b = entry.item.mapToItem(null, entry.item.width, entry.item.height);
50
+ return { x: a.x, y: a.y, w: b.x - a.x, h: b.y - a.y };
51
+ }
52
+ readonly property int gap: 10
53
+
54
+ Item {
55
+ id: area
56
+ anchors.fill: parent
57
+ // How much of the screen's top the window starts below: the bar's
58
+ // zone when it keeps one, 0 for a bar that doesn't (one that hides).
59
+ readonly property real startsAt: window.screen ? Math.max(0, window.screen.height - height) : 0
60
+
61
+ // The screen behind, dimmed. A click on it closes the list; a press on
62
+ // the board is left alone, so the board's own taps get it the first time.
63
+ Rectangle {
64
+ anchors.fill: parent
65
+ color: "#05060a"
66
+ opacity: 0.5 * window.shown
67
+ }
68
+ MouseArea {
69
+ anchors.fill: parent
70
+ onPressed: mouse => {
71
+ const p = mapToItem(holder, mouse.x, mouse.y);
72
+ mouse.accepted = p.x < 0 || p.y < 0 || p.x > holder.width || p.y > holder.height;
73
+ }
74
+ onClicked: window.service.closeList()
75
+ }
76
+
77
+ Item {
78
+ id: holder
79
+ width: card.implicitWidth
80
+ height: card.implicitHeight
81
+ // Placed as the floating card is (place.js).
82
+ x: Place.left(window.edge, window.spot, area.width, width, window.gap)
83
+ y: Place.top(window.edge, window.spot, window.gap, area.startsAt)
84
+ transform: Translate {
85
+ y: -(holder.y + holder.height + 20) * (1 - window.drop)
86
+ }
87
+
88
+ StyledCard {
89
+ id: card
90
+ anchors.fill: parent
91
+ service: window.service
92
+ iconFont: window.service.iconFont
93
+ floating: false
94
+ listWidth: Math.min(window.service.style === "kitchen" ? 900 : window.service.boardWidth(window.screen ? window.screen.width : 1920), area.width - 2 * window.gap)
95
+ maxHeight: Board.listRoom(area.height, holder.y)
96
+ onCloseRequested: window.service.closeList()
97
+ }
98
+ }
99
+ }
100
+
101
+ // The keys: Esc closes, the rest go to the service as on the popup.
102
+ Item {
103
+ id: keys
104
+ focus: true
105
+ Keys.onPressed: event => {
106
+ if (event.key === Qt.Key_Escape) {
107
+ // An open hide question goes first; the list stays.
108
+ if (card.cancelHide()) {
109
+ event.accepted = true;
110
+ return;
111
+ }
112
+ window.service.closeList();
113
+ event.accepted = true;
114
+ return;
115
+ }
116
+ event.accepted = window.service.handleKey(event, card.firstQuestion(), (id, decision) => card.stampKey(id, decision));
117
+ }
118
+ }
119
+
120
+ // 0 → 1 as the board lowers (with the prototype's overshoot), the dim
121
+ // with it; back to 0 as it raises away.
122
+ property real drop: 0
123
+ property real shown: 0
124
+ ParallelAnimation {
125
+ id: lower
126
+ // The rail doesn't drop: it's there, and its tickets swing in.
127
+ NumberAnimation { target: window; property: "drop"; to: 1; duration: window.service.style === "kitchen" ? 0 : 500; easing.type: Easing.OutBack; easing.overshoot: 1.3 }
128
+ NumberAnimation { target: window; property: "shown"; to: 1; duration: 300 }
129
+ }
130
+ SequentialAnimation {
131
+ id: raise
132
+ ParallelAnimation {
133
+ NumberAnimation { target: window; property: "drop"; to: 0; duration: 260; easing.type: Easing.InQuad }
134
+ NumberAnimation { target: window; property: "shown"; to: 0; duration: 260 }
135
+ }
136
+ ScriptAction { script: window.visible = false }
137
+ }
138
+ Connections {
139
+ target: window.service
140
+ function onListOpenChanged() {
141
+ if (window.service.listOpen) {
142
+ raise.stop();
143
+ window.spot = window.measure();
144
+ window.visible = window.screen !== null;
145
+ window.drop = 0;
146
+ window.shown = 0;
147
+ card.reset();
148
+ lower.restart();
149
+ keys.forceActiveFocus();
150
+ } else {
151
+ lower.stop();
152
+ raise.restart();
153
+ }
154
+ }
155
+ }
156
+ }
@@ -0,0 +1,70 @@
1
+ import QtQuick
2
+
3
+ // The card under Topside's bar entry, on SekaiPop's own popup: opened by a
4
+ // click on the entry, and it takes the keyboard (SekaiPop's bar asks for it
5
+ // while a plugin popup is open). Cards that open by themselves go to
6
+ // Floating.qml instead, so they never take what you type.
7
+ Item {
8
+ id: root
9
+ required property var host
10
+
11
+ implicitWidth: card.implicitWidth
12
+ implicitHeight: card.implicitHeight
13
+
14
+ // The classic card, the departures or the rail, as Settings > Style says.
15
+ Loader {
16
+ id: card
17
+ anchors.fill: parent
18
+ sourceComponent: root.host.service.styled ? null : classicCard
19
+ }
20
+ Component {
21
+ id: classicCard
22
+ Card {
23
+ service: root.host.service
24
+ iconFont: root.host.theme.iconFont
25
+ maxHeight: root.host.popup.maxHeight
26
+ onCloseRequested: root.host.popup.close()
27
+ }
28
+ }
29
+
30
+ Connections {
31
+ target: root.host.service
32
+ function onCloseWanted() {
33
+ if (root.host.popup.open) root.host.popup.close();
34
+ }
35
+ }
36
+
37
+ // Style: Board and Ticket list in Topside's own window (ListWindow.qml): the popup
38
+ // that just opened goes away again, and a click on the entry while the
39
+ // list is up puts the list away. Popup.qml is built on its first open,
40
+ // then kept, so both the first open and later ones count.
41
+ readonly property bool redirecting: root.host.service.styled
42
+ // Done a beat later, never inside SekaiPop's own change of `open`: closing
43
+ // it there looped its binding, and the list window showing up looped ours.
44
+ function redirect() {
45
+ if (!root.redirecting) return;
46
+ if (root.host.popup.open) root.host.popup.close();
47
+ if (root.host.service.listOpen) root.host.service.closeList();
48
+ else root.host.service.openList();
49
+ }
50
+ Component.onCompleted: if (root.host.popup.open) Qt.callLater(redirect)
51
+ Connections {
52
+ target: root.host.popup
53
+ function onOpenChanged() {
54
+ if (root.host.popup.open) Qt.callLater(root.redirect);
55
+ }
56
+ }
57
+ // SekaiPop may still be popping it in when it's asked to close: ask again
58
+ // until it's gone.
59
+ Timer {
60
+ interval: 60
61
+ repeat: true
62
+ running: root.redirecting && root.host.popup.open
63
+ onTriggered: root.host.popup.close()
64
+ }
65
+
66
+ // The shell hands over every key but Escape (which closes the popup).
67
+ function keyed(event) {
68
+ event.accepted = root.host.service.handleKey(event, card.item ? card.item.firstQuestion() : null);
69
+ }
70
+ }