vintage-frames 0.14.1 → 0.16.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/custom-elements.json +770 -74
  2. package/dist/chrome.d.ts +10 -1
  3. package/dist/chrome.js +8 -3
  4. package/dist/components/vf-button.d.ts +5 -1
  5. package/dist/components/vf-button.js +1 -1
  6. package/dist/components/vf-desktop.d.ts +5 -2
  7. package/dist/components/vf-desktop.js +5 -5
  8. package/dist/components/vf-dialog.d.ts +13 -2
  9. package/dist/components/vf-dialog.js +27 -27
  10. package/dist/components/vf-menu-bar.js +9 -10
  11. package/dist/components/vf-menu-item.js +18 -13
  12. package/dist/components/vf-menu.d.ts +8 -3
  13. package/dist/components/vf-menu.js +85 -61
  14. package/dist/components/vf-number-field.d.ts +4 -0
  15. package/dist/components/vf-number-field.js +28 -25
  16. package/dist/components/vf-paragraph.d.ts +3 -1
  17. package/dist/components/vf-paragraph.js +7 -0
  18. package/dist/components/vf-scroll-area.d.ts +16 -1
  19. package/dist/components/vf-scroll-area.js +39 -29
  20. package/dist/components/vf-select.d.ts +5 -4
  21. package/dist/components/vf-select.js +26 -17
  22. package/dist/components/vf-text-field.d.ts +5 -5
  23. package/dist/components/vf-text-field.js +1 -1
  24. package/dist/components/vf-window.d.ts +22 -5
  25. package/dist/components/vf-window.js +113 -98
  26. package/dist/cursor.d.ts +8 -0
  27. package/dist/cursor.js +70 -73
  28. package/dist/events.d.ts +3 -2
  29. package/dist/events.js +3 -3
  30. package/dist/index.d.ts +2 -1
  31. package/dist/modal-dialog.d.ts +49 -4
  32. package/dist/modal-dialog.js +115 -87
  33. package/dist/position.js +25 -20
  34. package/dist/shell/alert.d.ts +17 -9
  35. package/dist/shell/alert.js +25 -28
  36. package/dist/shell/catalog.d.ts +1 -1
  37. package/dist/shell/catalog.js +32 -18
  38. package/dist/shell/finder.d.ts +46 -1
  39. package/dist/shell/finder.js +166 -126
  40. package/dist/shell/index.d.ts +2 -4
  41. package/dist/shell/index.js +5 -6
  42. package/dist/shell/pure.d.ts +10 -0
  43. package/dist/shell/pure.js +4 -0
  44. package/dist/shell/shell.d.ts +40 -13
  45. package/dist/shell/shell.js +87 -51
  46. package/dist/shell/windows.d.ts +69 -12
  47. package/dist/shell/windows.js +245 -144
  48. package/dist/text-control.d.ts +30 -1
  49. package/dist/text-control.js +27 -6
  50. package/dist/top-layer.d.ts +13 -0
  51. package/dist/top-layer.js +16 -0
  52. package/docs/SPEC.md +25 -24
  53. package/editor/vscode.html-custom-data.json +22 -12
  54. package/editor/web-types.json +58 -25
  55. package/package.json +5 -1
@@ -23,6 +23,9 @@
23
23
  * View (Arrange Windows), Special (Clean Up, Empty Trash…), each disabled
24
24
  * while it has nothing to act on. A site switches commands off and adds
25
25
  * its own.
26
+ * - Alerts are the Finder's own, composed with the site's caution art and
27
+ * held by it while they are up. A site answers any of them with its own
28
+ * dialog through `alertWith`.
26
29
  */
27
30
  import type { VfIcon, VfMenuItem, VfViewportBox } from '../index.js';
28
31
  import type { Catalog, CatalogStorage, Item, Volumes } from './catalog.js';
@@ -43,7 +46,40 @@ export interface FinderArt {
43
46
  disk?: string;
44
47
  /** 12×12: the mark before the item count in the Trash's window and trashed folders. */
45
48
  trashMark?: string;
49
+ /** 32×32: beside the message in the Finder's alerts. Without it they have no art. */
50
+ caution?: string;
46
51
  }
52
+ /** What a failed command was, in the `failed` alert. */
53
+ export type FinderFailedAction = 'new-folder' | 'empty-trash' | 'paste' | 'add-file';
54
+ /** The Finder's alerts, by id, with the details each one's handler gets. */
55
+ export interface FinderAlerts {
56
+ /** Special → Empty Trash…: an answer of `'ok'` empties the Trash. */
57
+ 'empty-trash': {
58
+ count: number;
59
+ bytes: number;
60
+ };
61
+ /** New Folder, Paste, a dropped file or `storageReady()`, without storage. */
62
+ 'storage-unavailable': Record<string, never>;
63
+ /** A rename past the limit. */
64
+ 'name-too-long': {
65
+ limit: number;
66
+ };
67
+ /** A rename to nothing. */
68
+ 'name-rejected': Record<string, never>;
69
+ /** A filing storage refused. */
70
+ 'move-failed': {
71
+ error: Error;
72
+ };
73
+ /** New Folder, Empty Trash, Paste or a dropped file failed. */
74
+ failed: {
75
+ action: FinderFailedAction;
76
+ error: Error;
77
+ };
78
+ }
79
+ /** One of the Finder's alerts. */
80
+ export type FinderAlert = keyof FinderAlerts;
81
+ /** Answers one of the Finder's alerts: resolves the answer, or null. */
82
+ export type FinderAlertHandler<K extends FinderAlert> = (details: FinderAlerts[K]) => string | null | Promise<string | null>;
47
83
  /** The Finder's own commands, each of which a site can switch off. */
48
84
  export type FinderCommand = 'open' | 'new-folder' | 'close' | 'copy' | 'paste' | 'select-all' | 'arrange' | 'clean-up' | 'empty-trash';
49
85
  /** The Finder's menus, by `data-menu`. */
@@ -85,6 +121,13 @@ export interface FinderApi {
85
121
  iconFor(id: string): VfIcon | null;
86
122
  /** Add a command to the Finder's menus. Call it from `extend`, before the menus first reach the bar. */
87
123
  addCommand(spec: FinderCommandSpec): VfMenuItem;
124
+ /** Answer one of the Finder's alerts with the site's own dialog. Call it from `extend`. */
125
+ alertWith<K extends FinderAlert>(id: K, handler: FinderAlertHandler<K>): void;
126
+ /**
127
+ * Whether storage answers. When it doesn't, raises Storage Unavailable —
128
+ * the site's answer to it, where `alertWith` gave one — and returns false.
129
+ */
130
+ storageReady(): boolean;
88
131
  }
89
132
  export interface FinderOptions {
90
133
  /** Where the catalog is kept: `memoryStorage()`, `indexedDbStorage(name)`, the site's own, or null for nothing. */
@@ -107,7 +150,9 @@ export interface FinderOptions {
107
150
  cleanUpAfterResize?: boolean;
108
151
  /** Switch commands off: `{ 'empty-trash': false }`. */
109
152
  commands?: Partial<Record<FinderCommand, boolean>>;
110
- /** Add the site's own commands. */
153
+ /** The site's dialogs for the Finder, each with a `data-dialog` name, held by it: `ctx.dialog(name)` in `extend`. */
154
+ dialogs?: string;
155
+ /** Add the site's own commands, and answer the Finder's alerts. */
111
156
  extend?(finder: FinderApi, ctx: AppContext): void;
112
157
  /** A folder window's size, system px. Default 320 × 223: three columns and two rows of icons. */
113
158
  window?: Size;