@signal9/era-ui 3.17.1 → 4.0.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.
@@ -1,4 +1,4 @@
1
- import { type WindowManager } from './wm.svelte.js';
1
+ import { type PaneManager } from './pane-manager.svelte.js';
2
2
  export declare const WORKSPACE_STORAGE_KEY = "era-ui:workspace";
3
3
  /**
4
4
  * Read a saved snapshot and apply it. Returns whether anything was restored.
@@ -7,9 +7,9 @@ export declare const WORKSPACE_STORAGE_KEY = "era-ui:workspace";
7
7
  * seed (localStorage), so a reload is exact and a brand-new tab still opens on
8
8
  * your most recent arrangement.
9
9
  */
10
- export declare function loadWorkspace(wm: WindowManager, key?: string): boolean;
10
+ export declare function loadWorkspace(pm: PaneManager, key?: string): boolean;
11
11
  /** Write the current desktop to both stores. Returns false if neither accepted it. */
12
- export declare function saveWorkspace(wm: WindowManager, key?: string): boolean;
12
+ export declare function saveWorkspace(pm: PaneManager, key?: string): boolean;
13
13
  /** Forget the layout — this tab's and the shared seed. */
14
14
  export declare function clearWorkspace(key?: string): void;
15
15
  /**
@@ -19,12 +19,12 @@ export declare function clearWorkspace(key?: string): void;
19
19
  * component context). The load is synchronous and happens immediately, before
20
20
  * the first paint.
21
21
  *
22
- * Writes are debounced: dragging a window mutates `pos` on every pointer move,
22
+ * Writes are debounced: dragging a pane mutates `pos` on every pointer move,
23
23
  * and serialising the whole desktop per frame would be pointless work. The
24
24
  * trailing write always lands because the effect's teardown flushes a pending
25
25
  * timer.
26
26
  */
27
- export declare function persistWorkspace(wm: WindowManager, options?: {
27
+ export declare function persistWorkspace(pm: PaneManager, options?: {
28
28
  key?: string;
29
29
  debounce?: number;
30
30
  }): {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * WHERE IT IS STORED, AND WHY IT IS TWO PLACES
5
5
  * --------------------------------------------
6
- * A window layout is VIEW state, not document state — the same kind of thing as
6
+ * A pane layout is VIEW state, not document state — the same kind of thing as
7
7
  * scroll position. Nobody expects scrolling one tab to scroll another, and the
8
8
  * same holds here: two tabs of the same app are two workspaces, not two views of
9
9
  * one workspace. That observation decides the whole design.
@@ -25,7 +25,7 @@
25
25
  * The alternatives, and why not:
26
26
  *
27
27
  * `storage` event / BroadcastChannel — mirror every tab to one shared layout.
28
- * Both work, and both are wrong HERE: dragging a window in one tab would move
28
+ * Both work, and both are wrong HERE: dragging a pane in one tab would move
29
29
  * it in the other. That is the correct design for a synced setting (theme,
30
30
  * auth), not for a workspace.
31
31
  * Web Locks leader election — `navigator.locks.request()` held forever elects
@@ -40,7 +40,7 @@
40
40
  * The payload is a few kB of JSON that must be read BEFORE the first paint, which
41
41
  * rules out every modern alternative, because they are all async: IndexedDB,
42
42
  * OPFS, and Storage Buckets alike would paint an empty desktop and pop the
43
- * windows in a frame later. Synchronous access is the feature here, not the
43
+ * panes in a frame later. Synchronous access is the feature here, not the
44
44
  * compromise. Their real strengths do not apply either — OPFS is for large or
45
45
  * binary files with read/write handles, and Storage Buckets exists for per-bucket
46
46
  * eviction policy across several competing stores (and is Chromium-only). One
@@ -51,7 +51,7 @@
51
51
  * once, non-blocking, and a refusal is harmless.
52
52
  */
53
53
  import { untrack } from 'svelte';
54
- import { readSnapshot } from './wm.svelte.js';
54
+ import { readSnapshot } from './pane-manager.svelte.js';
55
55
  export const WORKSPACE_STORAGE_KEY = 'era-ui:workspace';
56
56
  /** Both stores, newest-first: this tab's own layout, then the new-tab seed. */
57
57
  function stores() {
@@ -79,7 +79,7 @@ function stores() {
79
79
  * seed (localStorage), so a reload is exact and a brand-new tab still opens on
80
80
  * your most recent arrangement.
81
81
  */
82
- export function loadWorkspace(wm, key = WORKSPACE_STORAGE_KEY) {
82
+ export function loadWorkspace(pm, key = WORKSPACE_STORAGE_KEY) {
83
83
  for (const store of stores()) {
84
84
  let raw = null;
85
85
  try {
@@ -95,14 +95,14 @@ export function loadWorkspace(wm, key = WORKSPACE_STORAGE_KEY) {
95
95
  const snapshot = readSnapshot(raw);
96
96
  if (!snapshot)
97
97
  continue;
98
- wm.applySnapshot(snapshot);
98
+ pm.applySnapshot(snapshot);
99
99
  return true;
100
100
  }
101
101
  return false;
102
102
  }
103
103
  /** Write the current desktop to both stores. Returns false if neither accepted it. */
104
- export function saveWorkspace(wm, key = WORKSPACE_STORAGE_KEY) {
105
- const json = JSON.stringify(wm.snapshot());
104
+ export function saveWorkspace(pm, key = WORKSPACE_STORAGE_KEY) {
105
+ const json = JSON.stringify(pm.snapshot());
106
106
  let ok = false;
107
107
  for (const store of stores()) {
108
108
  try {
@@ -135,22 +135,22 @@ export function clearWorkspace(key = WORKSPACE_STORAGE_KEY) {
135
135
  * component context). The load is synchronous and happens immediately, before
136
136
  * the first paint.
137
137
  *
138
- * Writes are debounced: dragging a window mutates `pos` on every pointer move,
138
+ * Writes are debounced: dragging a pane mutates `pos` on every pointer move,
139
139
  * and serialising the whole desktop per frame would be pointless work. The
140
140
  * trailing write always lands because the effect's teardown flushes a pending
141
141
  * timer.
142
142
  */
143
- export function persistWorkspace(wm, options = {}) {
143
+ export function persistWorkspace(pm, options = {}) {
144
144
  const key = options.key ?? WORKSPACE_STORAGE_KEY;
145
145
  const wait = options.debounce ?? 400;
146
- const restored = loadWorkspace(wm, key);
146
+ const restored = loadWorkspace(pm, key);
147
147
  // Fire-and-forget: a refusal (or an engine without the API) just leaves the
148
148
  // default best-effort behaviour.
149
149
  void navigator?.storage?.persist?.().catch(() => { });
150
150
  $effect(() => {
151
151
  // Touch what a snapshot is made of, so the effect re-runs when any of it
152
152
  // changes. Reading these is the subscription.
153
- wm.windows.forEach((w) => {
153
+ pm.panes.forEach((w) => {
154
154
  void w.pos.x;
155
155
  void w.pos.y;
156
156
  void w.size?.width;
@@ -161,12 +161,12 @@ export function persistWorkspace(wm, options = {}) {
161
161
  void w.workspaceId;
162
162
  void w.props;
163
163
  });
164
- void wm.workspaces.length;
165
- void wm.activeWorkspaceId;
164
+ void pm.workspaces.length;
165
+ void pm.activeWorkspaceId;
166
166
  const timer = setTimeout(() => {
167
167
  // untrack: snapshot() reads the same state this effect depends on, and
168
168
  // re-reading it inside would re-subscribe on every write.
169
- untrack(() => saveWorkspace(wm, key));
169
+ untrack(() => saveWorkspace(pm, key));
170
170
  }, wait);
171
171
  return () => clearTimeout(timer);
172
172
  });
@@ -7,7 +7,7 @@
7
7
  import Handle from './pane-handle.svelte';
8
8
  import Content from './pane-content.svelte';
9
9
  import Close from './pane-close.svelte';
10
- import AppWindow from '@lucide/svelte/icons/app-window';
10
+ import AppPane from '@lucide/svelte/icons/app-window';
11
11
 
12
12
  let {
13
13
  ref = $bindable(null),
@@ -15,7 +15,7 @@
15
15
  size = $bindable(null),
16
16
  resizable = false,
17
17
  title,
18
- icon = AppWindow,
18
+ icon = AppPane,
19
19
  disabled = false,
20
20
  plugins = [],
21
21
  onDragStart,
@@ -791,7 +791,7 @@
791
791
 
792
792
  const playLabel = $derived(ended ? 'Replay' : paused ? 'Play' : 'Pause');
793
793
  const muteLabel = $derived(mutedState || volumeState === 0 ? 'Unmute' : 'Mute');
794
- // Prefer seekable.end when smaller than duration (HLS live windows); fall
794
+ // Prefer seekable.end when smaller than duration (HLS live panes); fall
795
795
  // back to duration for VOD where the engine may report seekable === duration.
796
796
  const timeMax = $derived(
797
797
  seekableEnd > 0 && seekableEnd < (duration || Infinity)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signal9/era-ui",
3
- "version": "3.17.1",
3
+ "version": "4.0.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev --host",
6
6
  "build": "vite build && npm run prepack",
@@ -1,7 +0,0 @@
1
- import { type AppWindow } from './wm.svelte.js';
2
- type $$ComponentProps = {
3
- window: AppWindow;
4
- };
5
- declare const Window: import("svelte").Component<$$ComponentProps, {}, "">;
6
- type Window = ReturnType<typeof Window>;
7
- export default Window;