vintage-frames 0.19.1 → 0.20.0

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 (55) hide show
  1. package/README.md +1 -18
  2. package/custom-elements.json +8 -8
  3. package/dist/text-control.d.ts +3 -3
  4. package/docs/SPEC.md +3 -3
  5. package/editor/vscode.html-custom-data.json +3 -3
  6. package/editor/web-types.json +7 -7
  7. package/package.json +4 -34
  8. package/dist/build/app-file.d.ts +0 -21
  9. package/dist/build/app-file.js +0 -42
  10. package/dist/build/box.d.ts +0 -57
  11. package/dist/build/box.js +0 -93
  12. package/dist/build/client.d.ts +0 -12
  13. package/dist/build/frame-picture.d.ts +0 -6
  14. package/dist/build/frame-picture.js +0 -4
  15. package/dist/build/frame.d.ts +0 -11
  16. package/dist/build/frame.js +0 -44
  17. package/dist/build/index.d.ts +0 -14
  18. package/dist/build/index.js +0 -4
  19. package/dist/build/plugins.d.ts +0 -41
  20. package/dist/build/plugins.js +0 -134
  21. package/dist/build/png.d.ts +0 -24
  22. package/dist/build/png.js +0 -116
  23. package/dist/shell/alert.d.ts +0 -40
  24. package/dist/shell/alert.js +0 -41
  25. package/dist/shell/app-file.d.ts +0 -115
  26. package/dist/shell/app-file.js +0 -189
  27. package/dist/shell/catalog.d.ts +0 -250
  28. package/dist/shell/catalog.js +0 -349
  29. package/dist/shell/clock.d.ts +0 -16
  30. package/dist/shell/clock.js +0 -36
  31. package/dist/shell/filing.d.ts +0 -39
  32. package/dist/shell/filing.js +0 -68
  33. package/dist/shell/finder.d.ts +0 -180
  34. package/dist/shell/finder.js +0 -676
  35. package/dist/shell/geometry.d.ts +0 -203
  36. package/dist/shell/geometry.js +0 -257
  37. package/dist/shell/index.d.ts +0 -30
  38. package/dist/shell/index.js +0 -12
  39. package/dist/shell/pure.d.ts +0 -13
  40. package/dist/shell/pure.js +0 -6
  41. package/dist/shell/shell.d.ts +0 -177
  42. package/dist/shell/shell.js +0 -277
  43. package/dist/shell/state.d.ts +0 -88
  44. package/dist/shell/state.js +0 -103
  45. package/dist/shell/storage.d.ts +0 -14
  46. package/dist/shell/storage.js +0 -41
  47. package/dist/shell/version.d.ts +0 -2
  48. package/dist/shell/version.js +0 -4
  49. package/dist/shell/windows.d.ts +0 -278
  50. package/dist/shell/windows.js +0 -447
  51. package/dist/styles/body-strike.d.ts +0 -12
  52. package/dist/styles/body-strike.js +0 -3961
  53. package/dist/styles/display-strike.d.ts +0 -12
  54. package/dist/styles/display-strike.js +0 -4343
  55. package/dist/styles/strike.d.ts +0 -30
@@ -1,41 +0,0 @@
1
- //#region src/shell/storage.ts
2
- var e = "items", t = (e) => new Promise((t, n) => {
3
- e.onsuccess = () => t(e.result), e.onerror = () => n(e.error ?? /* @__PURE__ */ Error("IndexedDB request failed"));
4
- });
5
- function n(t, n, r) {
6
- return new Promise((i, a) => {
7
- let o = n == null ? indexedDB.open(t) : indexedDB.open(t, n);
8
- o.onupgradeneeded = () => {
9
- o.result.objectStoreNames.contains(e) || o.result.createObjectStore(e, { keyPath: "id" });
10
- }, o.onsuccess = () => {
11
- let e = o.result;
12
- e.onversionchange = () => {
13
- r(), e.close();
14
- }, i(e);
15
- }, o.onerror = () => a(o.error ?? /* @__PURE__ */ Error("IndexedDB open failed")), o.onblocked = () => {
16
- console.warn(`vintage-frames/shell: waiting for another tab to let go of the "${t}" database`);
17
- };
18
- });
19
- }
20
- async function r(t, r) {
21
- let i = await n(t, void 0, r);
22
- if (!i.objectStoreNames.contains(e)) {
23
- let e = i.version + 1;
24
- i.close(), i = await n(t, e, r);
25
- }
26
- return i;
27
- }
28
- function i(n) {
29
- let i = null, a = () => typeof indexedDB > "u" ? Promise.reject(/* @__PURE__ */ Error("IndexedDB is unavailable")) : (i ??= r(n, () => {
30
- i = null;
31
- }).catch((e) => {
32
- throw i = null, e;
33
- }), i), o = async (n, r) => t(r((await a()).transaction(e, n).objectStore(e)));
34
- return {
35
- list: () => o("readonly", (e) => e.getAll()),
36
- put: (e) => o("readwrite", (t) => t.put(e)),
37
- remove: (e) => o("readwrite", (t) => t.delete(e))
38
- };
39
- }
40
- //#endregion
41
- export { i as indexedDbStorage };
@@ -1,2 +0,0 @@
1
- /** The kit's version, as published: package.json's `version`. `npm version` rewrites it (the `version` script). */
2
- export declare const VERSION = "0.19.1";
@@ -1,4 +0,0 @@
1
- //#region src/shell/version.ts
2
- var e = "0.19.1";
3
- //#endregion
4
- export { e as VERSION };
@@ -1,278 +0,0 @@
1
- /**
2
- * The window manager. Applications make their windows; the manager places
3
- * them, opens and closes them, follows the front application, carries them
4
- * through a raster resize and arranges them.
5
- *
6
- * - `adopt()` takes a window an application made and appended: its
7
- * application, the item it shows, how to place it, its resize policy, and
8
- * what its close box means. `open()` raises the window for an item if one
9
- * is open, and otherwise makes, appends, adopts and places one, and shows
10
- * it out of `from`. `close()` hides a window into `to` — by default its
11
- * home box, which the Finder provides: the item's icon, or the
12
- * application's — then releases and removes it.
13
- * - Placement, in order: this session's pin for the item, the saved pin,
14
- * then the `place` policy — by default the first cascade slot no open
15
- * window holds. The result is clamped into the desktop's window area.
16
- * - The front application is the active window's, or the default one while
17
- * none is active. `beforeFront` runs before a change, `onFront` reports it.
18
- * - Palettes are an application's utility windows: shown while it is front
19
- * and hidden otherwise, never closed or removed.
20
- * - Opening a window moves keyboard focus into it, and a new window's field
21
- * marked `autoselect` opens with its text selected; closing the active one
22
- * moves focus to the window that becomes active, else to the closed
23
- * window's icon, else to the desktop's icons. Focus left behind in a
24
- * window that is no longer active — a title-bar press moves none — goes
25
- * to the active window too.
26
- * - `onWindows` reports a window opened or closed and a close's zoom rects
27
- * landing, palettes aside; `isOpen()` and `hasWindows()` hold until they
28
- * land, which is what the Finder's open ghost follows.
29
- * - The resize rule re-pins every window with the nine-slice pin, re-reads a
30
- * resizable window's pin when its size changed, floors it at the window's
31
- * own size limits and caps it to the window area, so growing back restores
32
- * every place.
33
- * - The zoom box, for a window adopted with `zoom`: the window goes to its
34
- * zoomed box and back to the box it had, kept as a pin; a zoomed window
35
- * stays zoomed across a resize.
36
- * - Dialogs: `holdDialog()` holds an application's dialog under it, in the
37
- * desktop. The manager follows each held dialog's `open` attribute, and
38
- * `asking` is the application of the one opened last and still open.
39
- */
40
- import { VfWindow } from '../index.js';
41
- import type { VfCloseKeys, VfDesktop, VfViewportBox } from '../index.js';
42
- import type { Bands, Box, Pin, Policy, Size } from './geometry.js';
43
- /** A box to write, any edge optional. */
44
- export interface BoxInput {
45
- left?: number;
46
- top?: number;
47
- width?: number;
48
- height?: number;
49
- }
50
- /** A placement: a position, and a size where one is stated. */
51
- export interface Placed extends BoxInput {
52
- left: number;
53
- top: number;
54
- }
55
- /** How a window is placed: its box on the desktop's live window area. */
56
- export type PlacePolicy = (area: Box) => BoxInput & Point;
57
- type Point = {
58
- left: number;
59
- top: number;
60
- };
61
- /** What adopting a window declares. */
62
- export interface AdoptOptions {
63
- /** The application shown while the window is active. */
64
- app: string;
65
- /** The item it shows: a catalog id, or an application's own key. */
66
- item?: string | null;
67
- /** Its placement on the live window area; adopt() and arrange() apply it. Unset, the owner places it. */
68
- place?: PlacePolicy | null;
69
- /** A saved pin to open at instead. */
70
- pin?: Pin | null;
71
- /** Its resize policy for the re-pin. Default: a resizable window floored at its size limits, else fixed. */
72
- policy?: ((cur: Box) => Policy) | null;
73
- /** A box held across a raster resize while the window is near it. */
74
- keep?: ((area: Box) => Box) | null;
75
- /**
76
- * Its zoom box: the window's zoomed box on the window area, given its
77
- * current box (to keep its top-left, say). Set, the manager runs the zoom
78
- * box: it goes to this box and back to the box the user had, and a window
79
- * at it stays zoomed across a raster resize.
80
- */
81
- zoom?: ((area: Box, box: Box) => BoxInput) | null;
82
- /**
83
- * A palette: shown while its application is front — and while the
84
- * predicate holds, for one the application hides for its own reasons —
85
- * and hidden otherwise. Never closed by the manager.
86
- */
87
- palette?: boolean | (() => boolean);
88
- /**
89
- * What the close box means. Unset, it closes the window. Set, the close box
90
- * asks the application, which calls `close()` once it decides — after a
91
- * Save prompt, say — or never. It gets the modifier keys held on the
92
- * close box's click; a close from a menu or code holds none. A handler
93
- * that decides later returns its promise, so `closeAll()` waits for it.
94
- */
95
- close?: CloseHandler | null;
96
- }
97
- /** A window's close handler: decides whether it closes, and calls `close()` if so. */
98
- export type CloseHandler = (win: VfWindow, keys: Partial<VfCloseKeys>) => void | Promise<void>;
99
- /** What opening a window for an item declares. */
100
- export interface OpenOptions extends Omit<AdoptOptions, 'pin' | 'palette'> {
101
- /** Makes the window, not yet appended. */
102
- create: () => VfWindow;
103
- /** The box it opens out of, in viewport CSS px: an icon's `cellRect()`. */
104
- from?: VfViewportBox | null;
105
- }
106
- /** An application's arrangement group, for windows it places itself. */
107
- export interface ArrangeGroup {
108
- arrange(): void;
109
- arranged(): boolean;
110
- }
111
- /**
112
- * The box a closing window shrinks into, in viewport CSS px: `item` is the
113
- * window's item, or null, and `app` its application. The Finder answers with
114
- * the item's icon, the nearest open folder around it, or the application's
115
- * icon.
116
- */
117
- export type HomeBox = (item: string | null, app: string) => VfViewportBox | null;
118
- /** Move the focus to the closed window's icon (`item` null: the desktop's first); resolves whether it moved. */
119
- export type FocusHome = (item: string | null, app: string | null) => boolean;
120
- export interface WindowManagerOptions {
121
- /** The application front while no window is active. */
122
- defaultApp: string;
123
- /** A saved pin by item — the session the boot read. */
124
- savedPin?: (item: string) => Pin | null;
125
- }
126
- /** Settles once the desktop and its menu bar have rendered, so `workArea` measures the bar. */
127
- export declare function desktopRendered(desktop: VfDesktop): Promise<void>;
128
- /** The innermost focused element, through open shadow roots. */
129
- export declare function deepActiveElement(): Element | null;
130
- /**
131
- * Move keyboard focus into `win`'s content once that content has rendered —
132
- * and then only if `when`, read at that point, still holds: to the first
133
- * descendant marked `autofocus` or `autoselect`, else to the first thing that
134
- * takes the focus. With `select`, a control marked `autoselect` has its text
135
- * selected too; the window manager passes it on a window's first open only,
136
- * so a caret placed in the window survives a return to it. An element whose
137
- * `tabindex` is negative is passed over: a roving cell parked off the tab
138
- * order, a disabled control. A kit host with no `tabindex` goes through,
139
- * since it hands the focus on inside itself. Resolves whether the focus
140
- * moved: a window with nothing focusable in its content keeps the focus where
141
- * it was.
142
- */
143
- export declare function focusInto(win: Element, { when, select }?: {
144
- when?: () => boolean;
145
- select?: boolean;
146
- }): Promise<boolean>;
147
- /** The window manager over a desktop. */
148
- export declare function createWindowManager(desktop: VfDesktop, options: WindowManagerOptions): {
149
- /** The desktop's window area, system px. */
150
- readonly area: Box;
151
- /** The front application's id. */
152
- readonly front: string;
153
- /**
154
- * Take a window an application made and appended (a slotted child of the
155
- * desktop: the clamp reads its lattice). It opens at the saved `pin`, or
156
- * at its `place`; without either the owner placed it.
157
- */
158
- adopt(win: VfWindow, opts: AdoptOptions): void;
159
- /**
160
- * Open the window for `item`: raise it if one is open, else make it,
161
- * append it, adopt it and place it — this session's pin, then the saved
162
- * one, then `place`, by default the first free cascade slot — and show it
163
- * out of `from`. Keyboard focus moves into it, and a new window's field
164
- * marked `autoselect` has its text selected. Returns the window.
165
- */
166
- open(opts: OpenOptions): VfWindow;
167
- /**
168
- * Close a window into `to` — by default its home box, the Finder's icon
169
- * for it — then release and remove it. The item's box is remembered for
170
- * the session. Resolves when the zoom rects have landed.
171
- */
172
- close(win: VfWindow, { to }?: {
173
- to?: VfViewportBox | null;
174
- }): Promise<boolean>;
175
- /**
176
- * The close box's route: the window's own close, given the modifier keys
177
- * held, or a plain close. Resolves whether the window closed, once its
178
- * close handler has settled.
179
- */
180
- requestClose(win: VfWindow, keys?: Partial<VfCloseKeys>): Promise<boolean>;
181
- /**
182
- * Ask each of an application's windows to close, front to back, palettes
183
- * aside: a Quit. Resolves false at the first window still open once its
184
- * handler has settled — a Cancel — and true when all have closed.
185
- */
186
- closeAll(app: string, keys?: Partial<VfCloseKeys>): Promise<boolean>;
187
- /** The window showing `item`, or null. */
188
- windowFor(item: string): VfWindow | null;
189
- /** Every window of an application, back to front. */
190
- windowsOf(app: string): VfWindow[];
191
- /** A window's item, or null. */
192
- itemOf(win: Element | null): string | null;
193
- /** A window's or a held dialog's application, or null when the manager doesn't hold it. */
194
- appOf(el: Element | null): string | null;
195
- /**
196
- * Hold an application's dialog: a `vf-dialog`, or an element that renders
197
- * one inside itself. It is appended to the desktop unless it is already
198
- * in it, and its `open` is followed from then on.
199
- */
200
- holdDialog(dialog: Element, { app }: {
201
- app: string;
202
- }): void;
203
- /** Let a held dialog go. It stays where it is; the caller removes it. */
204
- releaseDialog(dialog: Element): void;
205
- /** An application's held dialogs. */
206
- dialogsOf(app: string): Element[];
207
- /** The application of the held dialog opened last and still open, or null. */
208
- readonly asking: string | null;
209
- /** Whether `win` is a palette. */
210
- isPalette(win: Element | null): boolean;
211
- /** Change the item a window shows: an untitled document's first save, say. */
212
- setItem(win: VfWindow, item: string | null): void;
213
- /** Whether a window shows `item`, or is still closing into its icon. */
214
- isOpen(item: string): boolean;
215
- /** Whether an application has a window open, palettes aside, or one still closing. */
216
- hasWindows(app: string): boolean;
217
- /** Re-read every palette's predicate: an application hid or showed one. */
218
- palettesChanged(): void;
219
- /** Write a box for a gesture the owner runs itself — its group's arrange, a zoom of its own. */
220
- write(win: VfWindow, box: Placed): void;
221
- /**
222
- * The zoom box, for a window adopted with a `zoom`: away from its zoomed
223
- * box, the window goes there, its box remembered; at it, the window goes
224
- * back to that box, carried by its pin through any raster resize since,
225
- * or to its `place` with none remembered. The zoom box's press runs it;
226
- * so can a menu command.
227
- */
228
- zoom(win: VfWindow): void;
229
- /** The box a placement would write, not written. */
230
- clamped(win: VfWindow, box: BoxInput): Placed;
231
- /** A window's `place` on the live area, clamped, or null. */
232
- placed(win: VfWindow): Placed | null;
233
- /** A window's pin on the current raster, for an owner that saves it. */
234
- pinOf(win: VfWindow): Pin;
235
- /** A pin on the live raster, clamped, under the window's policy or `policy`. */
236
- fromPin(win: VfWindow, pin: Pin, policy?: Policy): Placed;
237
- /** Widen the frame's bands, for an application whose windows dock along the edges. */
238
- setFrameBands(next: Partial<Bands>): void;
239
- /** Register an application's arrangement group. Returns the unregister. */
240
- arrangeWith(app: string, group: ArrangeGroup): () => void;
241
- /** View → Arrange Windows: every group's arrange, then every `place`. Nothing is raised. */
242
- arrange(): void;
243
- /** Whether every group is arranged and every shown window sits at its `place`. */
244
- arranged(): boolean;
245
- /**
246
- * Carry every window from the `before` raster to the live one with the
247
- * nine-slice pin, then tell the onRaster listeners. Nothing clamps a
248
- * window's position, so growing back restores it.
249
- */
250
- resized(before: Size): void;
251
- /** The windows' saved boxes: each open one with its depth, the palettes as boxes alone. */
252
- snapshot(): Record<string, {
253
- app: string;
254
- pin: Pin;
255
- z?: number;
256
- }>;
257
- /** This session's pin for an item whose window closed, or null. */
258
- rememberedPin(item: string): Pin | null;
259
- /** Notify layout of a change the owner made itself. */
260
- layoutChanged(): void;
261
- /** Set where a window closes into and where focus goes after it: the Finder's. */
262
- setHome(box: HomeBox, focus: FocusHome): () => void;
263
- /** The layout signal: any geometry write, drag, grow or arrange. Returns the unsubscribe. */
264
- onLayout(fn: () => void): () => void;
265
- /** A window opened or closed, or finished closing, palettes aside; a window's item changed. */
266
- onWindows(fn: () => void): () => void;
267
- /** A raster resize, after every window has re-pinned. */
268
- onRaster(fn: (before: Size, after: Size) => void): () => void;
269
- /** An activation, before the front application changes: `fn(win)`, the new active window or null. */
270
- beforeFront(fn: (win: HTMLElement | null) => void): () => void;
271
- /** The front application changed. */
272
- onFront(fn: (app: string) => void): () => void;
273
- /** A held dialog opened or closed, so `asking` may have changed. */
274
- onDialogs(fn: () => void): () => void;
275
- dispose(): void;
276
- };
277
- export type WindowManager = ReturnType<typeof createWindowManager>;
278
- export {};