@open-spreadsheet/core 0.4.0 → 0.4.1
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/app/book.ts +11 -1
- package/app/style.css +24 -4
- package/package.json +1 -1
package/app/book.ts
CHANGED
|
@@ -159,6 +159,9 @@ export async function openBook(app: HTMLElement, id: string): Promise<void> {
|
|
|
159
159
|
render();
|
|
160
160
|
});
|
|
161
161
|
const helpBtn = iconButton('keyboard', T.shortcuts, () => showShortcuts());
|
|
162
|
+
// Also in ⌘K: the first to go when the header is narrow (an editor side panel).
|
|
163
|
+
helpBtn.classList.add('head-extra');
|
|
164
|
+
themeBtn.classList.add('head-extra');
|
|
162
165
|
const paletteBtn = iconButton('list', `${T.palette.replace('…', '')} (${MOD}K)`, () => void openPalette());
|
|
163
166
|
const notesBtn = iconButton('pencil', T.notes, () => notesMenu());
|
|
164
167
|
// Sheet · Assets · Notes: one workbook, three views of it.
|
|
@@ -181,7 +184,10 @@ export async function openBook(app: HTMLElement, id: string): Promise<void> {
|
|
|
181
184
|
notesBtn.append(notesBadge);
|
|
182
185
|
const downloadBtn = el('button', 'btn primary');
|
|
183
186
|
downloadBtn.type = 'button';
|
|
184
|
-
|
|
187
|
+
const downloadChevron = icon('chevronDown', 14);
|
|
188
|
+
downloadChevron.classList.add('btn-chevron');
|
|
189
|
+
downloadBtn.append(icon('download', 15), el('span', 'btn-label', T.download), downloadChevron);
|
|
190
|
+
downloadBtn.title = T.download;
|
|
185
191
|
const fileMark = el('span', 'brand-mark');
|
|
186
192
|
fileMark.append(icon('sheet', 14));
|
|
187
193
|
head.append(back, fileMark, titleBtn, status, viewSwitch, el('div', 'grow'), notesBtn, paletteBtn, findBtn, helpBtn, themeBtn, downloadBtn);
|
|
@@ -327,6 +333,10 @@ export async function openBook(app: HTMLElement, id: string): Promise<void> {
|
|
|
327
333
|
notes.el.hidden = true;
|
|
328
334
|
gridWrap.append(grid, findbar);
|
|
329
335
|
root.append(head, toolbar, fbar, legacyBar, gridWrap, tabsBar, assets.el, notes.el);
|
|
336
|
+
// A toolbar wider than the window scrolls; fade its edge while there is more to the right.
|
|
337
|
+
const toolbarEdge = () => toolbar.classList.toggle('more-right', toolbar.scrollLeft + toolbar.clientWidth < toolbar.scrollWidth - 1);
|
|
338
|
+
toolbar.addEventListener('scroll', toolbarEdge, { passive: true });
|
|
339
|
+
new ResizeObserver(toolbarEdge).observe(toolbar);
|
|
330
340
|
/** Switches what the workbook shows; leaving Notes saves the note being written. */
|
|
331
341
|
async function setView(next: View) {
|
|
332
342
|
if (next === view) return;
|
package/app/style.css
CHANGED
|
@@ -161,16 +161,36 @@ kbd { font: 10.5px var(--mono); color: var(--muted-foreground); border: 1px soli
|
|
|
161
161
|
.empty-actions { display: flex; gap: 8px; }
|
|
162
162
|
|
|
163
163
|
/* ---------- workbook ---------- */
|
|
164
|
-
.book { height: 100%; display: flex; flex-direction: column; background: var(--background); }
|
|
164
|
+
.book { height: 100%; display: flex; flex-direction: column; background: var(--background); container: book / inline-size; }
|
|
165
165
|
.book-head { flex: none; height: 48px; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 8px; border-bottom: 1px solid var(--border); }
|
|
166
166
|
.book-head .brand-mark { margin: 0 2px 0 4px; }
|
|
167
167
|
.book-title { border: 0; background: none; font-size: 14.5px; font-weight: 600; padding: 4px 6px; border-radius: 6px; max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
168
168
|
.book-title:hover { background: var(--accent); }
|
|
169
|
-
.book-status { font-size: 12px; color: var(--muted-foreground); margin-left: 4px; }
|
|
169
|
+
.book-status { font-size: 12px; color: var(--muted-foreground); margin-left: 4px; white-space: nowrap; }
|
|
170
170
|
.book-status.warn { color: var(--danger); }
|
|
171
171
|
.book-head .btn { margin-left: 6px; height: 30px; }
|
|
172
|
+
/* Narrow (an editor side panel): only the title shrinks, and the extras step aside in turn. */
|
|
173
|
+
.book-head > * { flex: none; }
|
|
174
|
+
.book-head .book-title { flex: 0 1 auto; min-width: 3em; }
|
|
175
|
+
.book-head .grow { flex: 1 1 0; min-width: 0; }
|
|
176
|
+
@container book (max-width: 860px) {
|
|
177
|
+
.book-status:not(.warn) { display: none; }
|
|
178
|
+
}
|
|
179
|
+
@container book (max-width: 720px) {
|
|
180
|
+
.book-head .head-extra { display: none; }
|
|
181
|
+
.book-head .btn.primary { padding: 0 8px; }
|
|
182
|
+
.book-head .btn.primary .btn-label, .book-head .btn.primary .btn-chevron { display: none; }
|
|
183
|
+
.view-switch { margin-left: 4px; }
|
|
184
|
+
.view-switch button { padding: 0 10px; }
|
|
185
|
+
}
|
|
186
|
+
@container book (max-width: 520px) {
|
|
187
|
+
.book-head .brand-mark { display: none; }
|
|
188
|
+
.view-switch button { padding: 0 8px; }
|
|
189
|
+
}
|
|
172
190
|
|
|
173
191
|
.toolbar { flex: none; height: 40px; display: flex; align-items: center; gap: 1px; padding: 0 8px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
|
|
192
|
+
.toolbar > * { flex: none; }
|
|
193
|
+
.toolbar.more-right { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
|
|
174
194
|
.toolbar .ibtn { width: 30px; height: 30px; }
|
|
175
195
|
.tsep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; flex: none; }
|
|
176
196
|
.tbtn.select {
|
|
@@ -191,8 +211,8 @@ kbd { font: 10.5px var(--mono); color: var(--muted-foreground); border: 1px soli
|
|
|
191
211
|
.grid-wrap { flex: 1; min-height: 0; position: relative; }
|
|
192
212
|
|
|
193
213
|
/* Sheet · Assets · Notes */
|
|
194
|
-
.view-switch { display: inline-flex; margin-left: 10px; padding: 2px; border-radius: 8px; background: var(--muted); }
|
|
195
|
-
.view-switch button { height: 26px; padding: 0 14px; border: 0; border-radius: 6px; background: none; color: var(--muted-foreground); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: color 120ms; }
|
|
214
|
+
.view-switch { display: inline-flex; flex: none; margin-left: 10px; padding: 2px; border-radius: 8px; background: var(--muted); }
|
|
215
|
+
.view-switch button { height: 26px; padding: 0 14px; border: 0; border-radius: 6px; background: none; color: var(--muted-foreground); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: color 120ms; white-space: nowrap; }
|
|
196
216
|
.view-switch button:hover { color: var(--foreground); }
|
|
197
217
|
.view-switch button[aria-selected='true'] { background: var(--background); color: var(--foreground); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 0 0 0.5px var(--border); }
|
|
198
218
|
.book > [hidden] { display: none !important; }
|
package/package.json
CHANGED