ShtukbaseStandard

The basic layout

layout-basic · 版本 0.1.0
其他

The app shell of a space in the browser: a top bar with the space name and a light/dark switch, a sidebar with the space tree, the lens area with lens tabs for a collection, and an empty right panel. Lenses run in sandboxed frames and talk to the shell through lens.js (window.shtuk). The shell loads once; a lens is swapped in only after it has drawn.

关于该包

这段内容尚未翻译,下面是英文原文。

The layout package of the prototype cloud app. It brings no pages; its files are laid into .shtukbase/packages/layout-basic/ and served at /_pkg/layout-basic/.

  • shell.html, shell.css, shell.js: the shell served at /. Slots: top (space name, theme), sidebar (the tree), main (the lens area; tabs of the Collection lenses above it), panel (right, hidden for now).
  • lens.js: the client every lens links; it gives the page window.shtuk (path, call, open, ready, on('changed')). In a frame it talks to the shell by postMessage; standalone it calls POST /_api itself.

How it stays fast

  • The shell loads once. Navigation is history.pushState with ?path=<page>&lens=<id>; back and forward work, a reload opens the same view.
  • A lens loads in a hidden frame (visibility: hidden) and is swapped in after shtuk.ready() or after 800 ms. Until then the previous lens stays on screen, so nothing flashes.
  • The last 6 frames stay alive, hidden; going back to them is instant. Hovering a sidebar row starts loading its lens; the other lenses of an open collection are loaded after it draws.
  • The shell passes the theme in the frame URL (&skin=calm&theme=dark), so lens.js sets data-skin and data-theme on <html> before the first paint; later changes come as {type: 'theme'} messages.
  • After a records.write through the shell, and when the tree poll (every 5 s) sees a change, the shell posts {type: 'changed'} to every frame. The sidebar is updated in place, row by row.
  • Timings go to window.__shellTimings (firstOpen, switches) and console.debug.

Test without a host

bun apps/standard/packages/layout-basic/test/fake-host.ts serves the shell, the kit, a fake /_api with a "Заявки" collection and a demo lens (or lenses-records when it exists).

包文件 7

它们会放到 .shtukbase/packages/layout-basic/,动作从那里运行。