pinokiod 8.3.26 → 8.3.29

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 (39) hide show
  1. package/kernel/shell.js +3 -0
  2. package/kernel/shell_size.js +99 -0
  3. package/kernel/shells.js +2 -0
  4. package/package.json +1 -1
  5. package/server/index.js +7 -3
  6. package/server/lib/app_run_tabs.js +29 -17
  7. package/server/public/agent-bar-about.css +67 -0
  8. package/server/public/agent-bar-about.js +205 -0
  9. package/server/public/agent-bar-compose.js +4 -1
  10. package/server/public/agent-bar-modes.css +78 -0
  11. package/server/public/agent-bar-modes.js +97 -0
  12. package/server/public/agent-bar-panel.js +41 -13
  13. package/server/public/agent-bar.css +7 -5
  14. package/server/public/agent-bar.js +37 -9
  15. package/server/public/app-run-tabs.js +0 -10
  16. package/server/public/files-app/open-folder.js +58 -41
  17. package/server/public/files-app/toolbar.css +27 -5
  18. package/server/public/git-page.css +0 -1
  19. package/server/public/git-page.js +269 -149
  20. package/server/public/home-actions-menu.css +188 -0
  21. package/server/public/home-actions-menu.js +135 -0
  22. package/server/public/home-shell.css +121 -0
  23. package/server/public/home-shell.js +290 -0
  24. package/server/routes/git_page.js +4 -6
  25. package/server/views/app.ejs +19 -5
  26. package/server/views/file_browser.ejs +3 -4
  27. package/server/views/index.ejs +42 -3
  28. package/server/views/partials/home_action_modal.ejs +1 -1
  29. package/server/views/partials/home_ask_button.ejs +15 -0
  30. package/server/views/partials/home_shell_button.ejs +21 -0
  31. package/server/views/partials/main_sidebar.ejs +5 -1
  32. package/server/views/pre.ejs +1 -1
  33. package/test/agent-bar-about.test.js +238 -0
  34. package/test/agent-bar-modes.test.js +191 -0
  35. package/test/agent-bar-new-tab.test.js +60 -0
  36. package/test/app-git-files-tabs.test.js +84 -0
  37. package/test/home-actions-menu.test.js +187 -0
  38. package/test/home-shell.test.js +358 -0
  39. package/test/shell-size.test.js +166 -0
@@ -0,0 +1,188 @@
1
+ /* Home: an app row's actions as a dropdown (see home-actions-menu.js).
2
+ On a wide window the page opens the row's actions dialog "docked"; here that
3
+ is drawn as a small menu under the row's button instead of a panel down the
4
+ side of the page. The script puts it in place (left / top). It matches the
5
+ row's shell menu. A narrow window keeps the dialog as it was. */
6
+ @media only screen and (min-width: 961px) {
7
+ @keyframes homeActionsMenuIn {
8
+ from { opacity: 0; transform: translateY(-3px); }
9
+ to { opacity: 1; transform: translateY(0); }
10
+ }
11
+ @keyframes homeActionsMenuOut {
12
+ from { opacity: 1; }
13
+ to { opacity: 0; }
14
+ }
15
+ body.home-actions-menu .home-actions-dialog.is-docked[open] {
16
+ --home-actions-menu-text: #111827;
17
+ --home-actions-menu-muted: rgba(55, 65, 81, 0.78);
18
+ --home-actions-menu-border: rgba(15, 23, 42, 0.16);
19
+ --home-actions-menu-line: rgba(15, 23, 42, 0.09);
20
+ --home-actions-menu-surface: #ffffff;
21
+ --home-actions-menu-hover: rgba(15, 23, 42, 0.06);
22
+ top: 0;
23
+ right: auto;
24
+ bottom: auto;
25
+ left: 0;
26
+ width: 280px;
27
+ max-width: calc(100vw - 16px);
28
+ height: auto;
29
+ max-height: min(70vh, 560px);
30
+ overflow-y: auto;
31
+ box-sizing: border-box;
32
+ padding: 6px;
33
+ border: 1px solid var(--home-actions-menu-border);
34
+ border-radius: 12px;
35
+ background: var(--home-actions-menu-surface);
36
+ box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.08);
37
+ font: 400 13px system-ui, -apple-system, "Segoe UI", sans-serif;
38
+ letter-spacing: 0;
39
+ color: var(--home-actions-menu-text);
40
+ text-align: left;
41
+ animation: homeActionsMenuIn 100ms ease-out;
42
+ will-change: auto;
43
+ }
44
+ body.dark.home-actions-menu .home-actions-dialog.is-docked[open] {
45
+ --home-actions-menu-text: rgba(250, 250, 250, 0.96);
46
+ --home-actions-menu-muted: rgba(161, 161, 170, 0.92);
47
+ --home-actions-menu-border: rgba(255, 255, 255, 0.16);
48
+ --home-actions-menu-line: rgba(255, 255, 255, 0.1);
49
+ --home-actions-menu-surface: #323334;
50
+ --home-actions-menu-hover: rgba(255, 255, 255, 0.08);
51
+ box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
52
+ }
53
+ body.home-actions-menu .home-actions-dialog.is-docked.is-closing[open] {
54
+ animation: homeActionsMenuOut 80ms ease-in forwards;
55
+ }
56
+ @media (prefers-reduced-motion: reduce) {
57
+ body.home-actions-menu .home-actions-dialog.is-docked[open],
58
+ body.home-actions-menu .home-actions-dialog.is-docked.is-closing[open] {
59
+ animation: none;
60
+ }
61
+ }
62
+
63
+ /* the row the menu hangs from already shows the app's icon, name and folder,
64
+ and has the "Open on another device" button */
65
+ body.home-actions-menu .home-actions-dialog.is-docked .home-actions-header,
66
+ body.home-actions-menu .home-actions-dialog.is-docked .home-actions-section--share {
67
+ display: none;
68
+ }
69
+
70
+ body.home-actions-menu .home-actions-dialog.is-docked .home-actions-shell {
71
+ display: block;
72
+ height: auto;
73
+ min-height: 0;
74
+ overflow: visible;
75
+ }
76
+ body.home-actions-menu .home-actions-dialog.is-docked .home-actions-body {
77
+ padding: 0;
78
+ overflow: visible;
79
+ }
80
+ /* sections: a small heading, and a line between them */
81
+ body.home-actions-menu .home-actions-dialog.is-docked .home-actions-section + .home-actions-section {
82
+ margin-top: 5px;
83
+ padding-top: 5px;
84
+ border-top: 1px solid var(--home-actions-menu-line);
85
+ }
86
+ /* (the Share section is not shown, so the one after it needs no second line) */
87
+ body.home-actions-menu .home-actions-dialog.is-docked .home-actions-section--share:first-child + .home-actions-section {
88
+ margin-top: 0;
89
+ padding-top: 0;
90
+ border-top: 0;
91
+ }
92
+ body.home-actions-menu .home-actions-dialog.is-docked .home-actions-section-title {
93
+ margin: 0;
94
+ padding: 7px 8px 4px;
95
+ font-size: 11px;
96
+ font-weight: 600;
97
+ line-height: 1.2;
98
+ letter-spacing: 0.04em;
99
+ text-transform: uppercase;
100
+ color: var(--home-actions-menu-muted);
101
+ }
102
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-menu-list,
103
+ body.home-actions-menu .home-actions-dialog.is-docked .home-actions-command-list,
104
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-menu-children {
105
+ gap: 1px;
106
+ }
107
+
108
+ /* rows: no box of their own, a soft background under the pointer */
109
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-command,
110
+ body.home-actions-menu .home-actions-dialog.is-docked .home-mode-command {
111
+ min-height: 32px;
112
+ gap: 9px;
113
+ padding: 0 8px;
114
+ border: 0;
115
+ border-radius: 7px;
116
+ background: transparent;
117
+ font: inherit;
118
+ color: inherit;
119
+ }
120
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-command:hover,
121
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-command:focus-visible,
122
+ body.home-actions-menu .home-actions-dialog.is-docked .home-mode-command:hover,
123
+ body.home-actions-menu .home-actions-dialog.is-docked .home-mode-command:focus-visible,
124
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-stop:hover,
125
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-stop:focus-visible,
126
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-menu-summary:hover {
127
+ border-color: transparent;
128
+ background: var(--home-actions-menu-hover);
129
+ }
130
+ body.home-actions-menu .home-actions-dialog.is-docked .home-mode-command > i,
131
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-menu-label > i:first-child {
132
+ width: 18px;
133
+ font-size: 12px;
134
+ color: var(--home-actions-menu-muted);
135
+ }
136
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-command > i:last-child {
137
+ font-size: 10px;
138
+ color: var(--home-actions-menu-muted);
139
+ }
140
+ /* a launcher item that is running: its Stop beside it */
141
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-menu-row {
142
+ gap: 2px;
143
+ }
144
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-stop {
145
+ width: 32px;
146
+ min-height: 32px;
147
+ border: 0;
148
+ border-radius: 7px;
149
+ background: transparent;
150
+ }
151
+ /* a launcher's group of items: its name, and the items a step in */
152
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-menu-group {
153
+ border: 0;
154
+ border-radius: 0;
155
+ overflow: visible;
156
+ }
157
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-menu-summary {
158
+ min-height: 30px;
159
+ padding: 0 8px;
160
+ border-radius: 7px;
161
+ background: transparent;
162
+ color: var(--home-actions-menu-muted);
163
+ }
164
+ body.home-actions-menu .home-actions-dialog.is-docked .home-run-menu-children {
165
+ padding: 0 0 0 12px;
166
+ }
167
+ /* Delete: set apart from the commands above it */
168
+ body.home-actions-menu .home-actions-dialog.is-docked .home-mode-command.is-danger {
169
+ position: relative;
170
+ margin-top: 10px;
171
+ color: #b42318;
172
+ }
173
+ body.home-actions-menu .home-actions-dialog.is-docked .home-mode-command.is-danger::before {
174
+ content: "";
175
+ position: absolute;
176
+ left: 0;
177
+ right: 0;
178
+ top: -6px;
179
+ border-top: 1px solid var(--home-actions-menu-line);
180
+ pointer-events: none;
181
+ }
182
+ body.dark.home-actions-menu .home-actions-dialog.is-docked .home-mode-command.is-danger {
183
+ color: #f97066;
184
+ }
185
+ body.home-actions-menu .home-actions-dialog.is-docked .home-mode-command.is-danger > i {
186
+ color: inherit;
187
+ }
188
+ }
@@ -0,0 +1,135 @@
1
+ // Home: an app row's actions as a dropdown.
2
+ //
3
+ // The actions button on a row of My Apps (the list icon) opens the row's
4
+ // actions: what the app's launcher offers, and the app's own commands (Settings,
5
+ // Edit launcher, Copy, Move, Delete ...). On a wide window that used to be a
6
+ // panel down the right side of the page. With this file it is a small menu
7
+ // under the button, like the row's other buttons open.
8
+ //
9
+ // The menu is the page's own actions dialog (partials/home_action_modal.ejs),
10
+ // opened and closed by the page's own code, with every button in it working as
11
+ // before. This file only:
12
+ // - marks the page (body.home-actions-menu), which the stylesheet uses to
13
+ // draw the opened dialog as a menu: no header (the row it hangs from already
14
+ // names the app), no Share section (the row has that button), compact rows;
15
+ // - puts the dialog under the button that opened it;
16
+ // - closes it on a press outside it (which does not also open the row under
17
+ // the pointer), when the page scrolls or the window is resized, and once
18
+ // one of its commands has been clicked.
19
+ // A narrow window keeps the dialog as it was: the page does not open it
20
+ // "docked" there, and only a docked dialog is treated as a menu.
21
+ (function (window, document) {
22
+ 'use strict';
23
+
24
+ if (window.PinokioHomeActionsMenu || !document.body) return;
25
+ window.PinokioHomeActionsMenu = true;
26
+ document.body.classList.add('home-actions-menu');
27
+
28
+ const DIALOG = '.home-actions-dialog';
29
+ // what the menu offers: a launcher item, an app command, a Stop
30
+ const COMMAND = '.home-run-command, .home-mode-command, .home-run-stop';
31
+
32
+ const openMenu = () => document.querySelector(`${DIALOG}.is-docked[open]`);
33
+
34
+ function triggerOf(dialog) {
35
+ if (!dialog.id) return null;
36
+ return Array.from(document.querySelectorAll('.open-actions-modal'))
37
+ .find((button) => button.getAttribute('data-dialog-id') === dialog.id) || null;
38
+ }
39
+
40
+ function close(dialog) {
41
+ if (!dialog || !dialog.open) return;
42
+ if (typeof dialog.close === 'function') dialog.close();
43
+ else dialog.removeAttribute('open');
44
+ }
45
+
46
+ // Under the button, its left edge on the button's; kept on screen. With no
47
+ // room below it goes above the button; with no room there either, as low as
48
+ // it fits.
49
+ function place(dialog) {
50
+ const button = triggerOf(dialog);
51
+ if (!button) return;
52
+ const rect = button.getBoundingClientRect();
53
+ const gap = 6;
54
+ const edge = 8;
55
+ const width = dialog.offsetWidth;
56
+ const height = dialog.offsetHeight;
57
+ let left = Math.min(rect.left, window.innerWidth - width - edge);
58
+ left = Math.max(edge, left);
59
+ let top = rect.bottom + gap;
60
+ if (top + height > window.innerHeight - edge) {
61
+ const above = rect.top - gap - height;
62
+ top = above >= edge ? above : Math.max(edge, window.innerHeight - height - edge);
63
+ }
64
+ dialog.style.left = `${Math.round(left)}px`;
65
+ dialog.style.top = `${Math.round(top)}px`;
66
+ }
67
+
68
+ // The page opens a dialog by giving it `open`. A dialog that is not docked
69
+ // (a narrow window) is the page's own centred one: its place is not this
70
+ // file's, so what was set for a menu is taken off.
71
+ function opened(dialog) {
72
+ if (!dialog.matches || !dialog.matches(DIALOG)) return;
73
+ if (dialog.open && dialog.classList.contains('is-docked')) {
74
+ place(dialog);
75
+ } else {
76
+ dialog.style.left = '';
77
+ dialog.style.top = '';
78
+ }
79
+ }
80
+ new MutationObserver((records) => {
81
+ records.forEach((record) => opened(record.target));
82
+ }).observe(document.body, { attributes: true, attributeFilter: ['open'], subtree: true });
83
+
84
+ // A row of My Apps opens its app on a click anywhere on it, and the rows fill
85
+ // the page. The press that closes the menu must not also be that click: the
86
+ // click that follows it is cancelled when it would open a row. A click on a
87
+ // button or a link is left alone.
88
+ function keepRowShut() {
89
+ const done = () => {
90
+ document.removeEventListener('click', cancel, true);
91
+ document.removeEventListener('pointerdown', done, true);
92
+ };
93
+ function cancel(event) {
94
+ done();
95
+ const target = event.target;
96
+ if (!(target instanceof Element) || !target.closest('.home-app-line')) return;
97
+ if (target.closest('button, a, input, select, textarea, label, summary, dialog')) return;
98
+ event.preventDefault();
99
+ event.stopPropagation();
100
+ }
101
+ document.addEventListener('click', cancel, true);
102
+ // (the next press is something else: a press that was not followed by a click)
103
+ document.addEventListener('pointerdown', done, true);
104
+ }
105
+
106
+ // a press anywhere else closes it; a press on its own button is the page's (it toggles)
107
+ document.addEventListener('pointerdown', (event) => {
108
+ const dialog = openMenu();
109
+ if (!dialog) return;
110
+ const target = event.target;
111
+ if (!(target instanceof Node) || dialog.contains(target)) return;
112
+ const button = triggerOf(dialog);
113
+ if (button && button.contains(target)) return;
114
+ // a question the page is asking over the menu (a confirm, an editor)
115
+ if (target.closest && target.closest('.swal2-container')) return;
116
+ close(dialog);
117
+ keepRowShut();
118
+ }, true);
119
+
120
+ // The button moves with the page; the menu does not follow it.
121
+ window.addEventListener('scroll', (event) => {
122
+ const dialog = openMenu();
123
+ if (dialog && !(event.target instanceof Node && dialog.contains(event.target))) close(dialog);
124
+ }, true);
125
+ window.addEventListener('resize', () => close(openMenu()));
126
+
127
+ // A command was picked: the menu has done its job. After the page's own
128
+ // handlers, which read the row from where the button is.
129
+ document.addEventListener('click', (event) => {
130
+ const dialog = openMenu();
131
+ if (!dialog || !(event.target instanceof Element) || !dialog.contains(event.target)) return;
132
+ if (!event.target.closest(COMMAND)) return;
133
+ window.setTimeout(() => close(dialog), 0);
134
+ }, true);
135
+ })(window, document);
@@ -0,0 +1,121 @@
1
+ /* "Open a shell" on home (see home-shell.js): the terminal icon on each row of
2
+ My Apps and in the top bar, and the one menu they share. The row's button is
3
+ one of the row's own icon buttons, so only what is particular to it is set
4
+ here; the menu matches the app page's shell menu. */
5
+ .home-shell-button.is-open {
6
+ color: var(--home-page-accent);
7
+ }
8
+ /* the top bar's button: the size and hover of the Home Server button beside it */
9
+ .navheader .home-shell-button--navbar {
10
+ width: 40px;
11
+ height: 30px;
12
+ min-width: 40px;
13
+ min-height: 30px;
14
+ padding: 0;
15
+ border-radius: 9px;
16
+ box-sizing: border-box;
17
+ -webkit-app-region: no-drag;
18
+ }
19
+ .navheader .home-shell-button--navbar:hover,
20
+ .navheader .home-shell-button--navbar:focus-visible,
21
+ .navheader .home-shell-button--navbar.is-open {
22
+ background: rgba(15, 23, 42, 0.055);
23
+ color: inherit;
24
+ }
25
+ body.dark .navheader .home-shell-button--navbar:hover,
26
+ body.dark .navheader .home-shell-button--navbar:focus-visible,
27
+ body.dark .navheader .home-shell-button--navbar.is-open {
28
+ background: rgba(255, 255, 255, 0.08);
29
+ }
30
+
31
+ .home-shell-menu {
32
+ --home-shell-text: #111827;
33
+ --home-shell-muted: rgba(55, 65, 81, 0.78);
34
+ --home-shell-border: rgba(15, 23, 42, 0.16);
35
+ --home-shell-surface: #ffffff;
36
+ --home-shell-hover: rgba(15, 23, 42, 0.06);
37
+ --home-shell-shadow: 0 12px 24px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.08);
38
+ position: fixed;
39
+ top: 0;
40
+ left: 0;
41
+ z-index: 100001;
42
+ box-sizing: border-box;
43
+ width: 300px;
44
+ max-width: calc(100vw - 16px);
45
+ max-height: min(60vh, 420px);
46
+ overflow-y: auto;
47
+ padding: 6px;
48
+ border: 1px solid var(--home-shell-border);
49
+ border-radius: 12px;
50
+ background: var(--home-shell-surface);
51
+ box-shadow: var(--home-shell-shadow);
52
+ font: 400 13px system-ui, -apple-system, "Segoe UI", sans-serif;
53
+ letter-spacing: 0;
54
+ color: var(--home-shell-text);
55
+ text-align: left;
56
+ -webkit-app-region: no-drag;
57
+ }
58
+ body.dark .home-shell-menu {
59
+ --home-shell-text: rgba(250, 250, 250, 0.96);
60
+ --home-shell-muted: rgba(161, 161, 170, 0.92);
61
+ --home-shell-border: rgba(255, 255, 255, 0.16);
62
+ --home-shell-surface: #323334;
63
+ --home-shell-hover: rgba(255, 255, 255, 0.08);
64
+ --home-shell-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
65
+ }
66
+ .home-shell-menu[hidden] {
67
+ display: none !important;
68
+ }
69
+ .home-shell-menu__title {
70
+ padding: 7px 8px 4px;
71
+ font-size: 11px;
72
+ font-weight: 600;
73
+ letter-spacing: 0.04em;
74
+ text-transform: uppercase;
75
+ color: var(--home-shell-muted);
76
+ }
77
+ .home-shell-menu__empty {
78
+ padding: 6px 8px;
79
+ font-size: 12px;
80
+ color: var(--home-shell-muted);
81
+ }
82
+ .home-shell-menu__row {
83
+ width: 100%;
84
+ height: 32px;
85
+ display: flex;
86
+ align-items: center;
87
+ gap: 9px;
88
+ padding: 0 8px;
89
+ border: 0;
90
+ border-radius: 7px;
91
+ background: transparent;
92
+ font: inherit;
93
+ color: inherit;
94
+ text-align: left;
95
+ cursor: pointer;
96
+ }
97
+ .home-shell-menu__row:hover,
98
+ .home-shell-menu__row:focus-visible {
99
+ background: var(--home-shell-hover);
100
+ }
101
+ .home-shell-menu__row-icon {
102
+ flex: none;
103
+ width: 18px;
104
+ text-align: center;
105
+ font-size: 12px;
106
+ color: var(--home-shell-muted);
107
+ }
108
+ .home-shell-menu__row-label {
109
+ flex: none;
110
+ white-space: nowrap;
111
+ }
112
+ .home-shell-menu__row-note {
113
+ flex: 1 1 auto;
114
+ min-width: 0;
115
+ white-space: nowrap;
116
+ overflow: hidden;
117
+ text-overflow: ellipsis;
118
+ text-align: right;
119
+ font-size: 12px;
120
+ color: var(--home-shell-muted);
121
+ }