@janusui/janus-ui-library 0.0.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.
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Type, InjectionToken, Signal, WritableSignal, EnvironmentProviders, AfterViewInit, OnDestroy, ElementRef, OnInit } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Predefined color groups for symbol linking across widgets.
|
|
6
|
+
* Works like IB's color-linked groups: changing the symbol in one "red" widget
|
|
7
|
+
* updates all other "red" widgets automatically.
|
|
8
|
+
*/
|
|
9
|
+
type ColorGroup = 'red' | 'green' | 'blue' | 'yellow' | 'orange' | 'purple' | 'cyan' | 'magenta' | 'lime' | 'pink';
|
|
10
|
+
/** All available color groups for iterating in dropdowns / pickers. */
|
|
11
|
+
declare const COLOR_GROUPS: ColorGroup[];
|
|
12
|
+
/** CSS-friendly hex values for each color group. */
|
|
13
|
+
declare const COLOR_GROUP_HEX: Record<ColorGroup, string>;
|
|
14
|
+
|
|
15
|
+
/** Supported theme modes. */
|
|
16
|
+
type Theme = 'light' | 'dark';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Metadata that every widget panel registers at startup.
|
|
20
|
+
* Used by WidgetWindow to know default sizing and by WorkspaceService
|
|
21
|
+
* to reconstruct components from saved state.
|
|
22
|
+
*/
|
|
23
|
+
interface WidgetMeta {
|
|
24
|
+
/** Unique discriminator — matches WidgetPanelState.type. */
|
|
25
|
+
type: string;
|
|
26
|
+
/** The Angular standalone component class. */
|
|
27
|
+
component: Type<unknown>;
|
|
28
|
+
/** Display name shown in the "Add Widget" dropdown. */
|
|
29
|
+
label: string;
|
|
30
|
+
/** Default width in grid column units. */
|
|
31
|
+
defaultCols: number;
|
|
32
|
+
/** Default height in grid row units. */
|
|
33
|
+
defaultRows: number;
|
|
34
|
+
/** Minimum width in grid column units. */
|
|
35
|
+
minCols: number;
|
|
36
|
+
/** Minimum height in grid row units. */
|
|
37
|
+
minRows: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Serializable snapshot of a single widget panel within a WidgetWindow grid.
|
|
42
|
+
* Used for persistence to localStorage and cross-window state sync.
|
|
43
|
+
*/
|
|
44
|
+
interface WidgetPanelState {
|
|
45
|
+
/** Unique widget instance identifier. */
|
|
46
|
+
id: string;
|
|
47
|
+
/** Discriminator for component reconstruction (e.g. 'watchlist', 'portfolio'). */
|
|
48
|
+
type: string;
|
|
49
|
+
/** Gridstack column position. */
|
|
50
|
+
gridX: number;
|
|
51
|
+
/** Gridstack row position. */
|
|
52
|
+
gridY: number;
|
|
53
|
+
/** Width in grid column units. */
|
|
54
|
+
gridCols: number;
|
|
55
|
+
/** Height in grid row units. */
|
|
56
|
+
gridRows: number;
|
|
57
|
+
/** Color group this widget is linked to, if any. */
|
|
58
|
+
colorGroup?: ColorGroup;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Serializable snapshot of a single WidgetWindow.
|
|
63
|
+
* A workspace contains one or more WidgetWindows (for multi-monitor support).
|
|
64
|
+
*/
|
|
65
|
+
interface WidgetWindowState {
|
|
66
|
+
/** Unique window identifier. */
|
|
67
|
+
id: string;
|
|
68
|
+
/** Editable display title. */
|
|
69
|
+
title: string;
|
|
70
|
+
/** Screen position and size (for popup windows). */
|
|
71
|
+
bounds: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
width: number;
|
|
75
|
+
height: number;
|
|
76
|
+
};
|
|
77
|
+
/** Whether this window is minimized. */
|
|
78
|
+
minimized: boolean;
|
|
79
|
+
/** Current lifecycle state. */
|
|
80
|
+
state: 'open' | 'closed';
|
|
81
|
+
/** Gridstack layout — ordered array of widget panel placements. */
|
|
82
|
+
widgets: WidgetPanelState[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Public API surface that the ScreenWidgetComponent wrapper exposes
|
|
87
|
+
* to the inner content component via dependency injection.
|
|
88
|
+
*
|
|
89
|
+
* Inject `SCREEN_WIDGET_API` in your widget component to communicate
|
|
90
|
+
* with the wrapper (e.g. read/publish linked data, change the title).
|
|
91
|
+
*
|
|
92
|
+
* The wrapper owns all WidgetLinkService interaction — individual
|
|
93
|
+
* widgets never need to know about the linking service directly.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* private readonly api = inject(SCREEN_WIDGET_API);
|
|
98
|
+
*
|
|
99
|
+
* // Read the current accumulated data reactively
|
|
100
|
+
* const d = this.api.data();
|
|
101
|
+
*
|
|
102
|
+
* // Cherry-pick fields your widget cares about
|
|
103
|
+
* const sym = d?.['symbol'] as string | undefined;
|
|
104
|
+
*
|
|
105
|
+
* // Publish partial data to all widgets in the same color group
|
|
106
|
+
* this.api.publishData({ symbol: 'AAPL' });
|
|
107
|
+
*
|
|
108
|
+
* // Override the titlebar text
|
|
109
|
+
* api.setTitle('AAPL – Apple Inc.');
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
interface ScreenWidgetApi {
|
|
113
|
+
/** The unique widget instance ID. */
|
|
114
|
+
readonly widgetId: Signal<string>;
|
|
115
|
+
/** The parent window ID. */
|
|
116
|
+
readonly windowId: Signal<string>;
|
|
117
|
+
/** The color group this widget is linked to, or undefined if unlinked. */
|
|
118
|
+
readonly colorGroup: Signal<ColorGroup | undefined>;
|
|
119
|
+
/** The accumulated JSON data for this widget's color group (reactive). */
|
|
120
|
+
readonly data: Signal<Record<string, unknown>>;
|
|
121
|
+
/**
|
|
122
|
+
* Publish partial JSON data to all widgets sharing this widget's color group.
|
|
123
|
+
* Shallow-merged: keys you provide overwrite, keys you omit survive.
|
|
124
|
+
* Pass `null` as a value to remove a key.
|
|
125
|
+
*/
|
|
126
|
+
publishData(partial: Record<string, unknown>): void;
|
|
127
|
+
/** Update the title displayed in the widget header. */
|
|
128
|
+
setTitle(title: string): void;
|
|
129
|
+
}
|
|
130
|
+
/** Injection token for the ScreenWidgetApi. Provided by ScreenWidgetComponent. */
|
|
131
|
+
declare const SCREEN_WIDGET_API: InjectionToken<ScreenWidgetApi>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Multi-provider token. Each widget module provides its metadata via this token.
|
|
135
|
+
* WorkspaceService collects all provided values to populate the widget registry.
|
|
136
|
+
*/
|
|
137
|
+
declare const WIDGET_META: InjectionToken<WidgetMeta>;
|
|
138
|
+
|
|
139
|
+
interface GridConfig {
|
|
140
|
+
columns: number;
|
|
141
|
+
cellWidth: number;
|
|
142
|
+
cellHeight: number;
|
|
143
|
+
gap: number;
|
|
144
|
+
containerWidth: number;
|
|
145
|
+
}
|
|
146
|
+
interface PixelRect {
|
|
147
|
+
left: number;
|
|
148
|
+
top: number;
|
|
149
|
+
width: number;
|
|
150
|
+
height: number;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Pure grid math engine. No DOM manipulation — just calculations.
|
|
154
|
+
* Angular owns all rendering via templates.
|
|
155
|
+
*/
|
|
156
|
+
declare class LayoutEngine {
|
|
157
|
+
private readonly TARGET_CELL_WIDTH;
|
|
158
|
+
readonly MIN_COLUMNS = 6;
|
|
159
|
+
readonly MAX_COLUMNS = 36;
|
|
160
|
+
readonly CELL_HEIGHT = 20;
|
|
161
|
+
readonly GAP = 4;
|
|
162
|
+
readonly observers: WeakMap<HTMLElement, () => void>;
|
|
163
|
+
/** Compute column count for a given container width. */
|
|
164
|
+
computeColumns(containerWidth: number): number;
|
|
165
|
+
/** Build full grid config from container width. */
|
|
166
|
+
getConfig(containerWidth: number): GridConfig;
|
|
167
|
+
/** Convert grid units to pixel rectangle. All units share the same uniform step. */
|
|
168
|
+
rectToPixel(cfg: GridConfig, col: number, row: number, w: number, h: number): PixelRect;
|
|
169
|
+
/** Snap pixel position to nearest uniform grid cell. */
|
|
170
|
+
snapToGrid(cfg: GridConfig, px: number, py: number): {
|
|
171
|
+
col: number;
|
|
172
|
+
row: number;
|
|
173
|
+
};
|
|
174
|
+
/** Snap pixel size to nearest uniform grid size. */
|
|
175
|
+
snapSize(cfg: GridConfig, pw: number, ph: number, minCols: number, minRows: number): {
|
|
176
|
+
w: number;
|
|
177
|
+
h: number;
|
|
178
|
+
};
|
|
179
|
+
/** Observe container resizes and call back with new config. */
|
|
180
|
+
observe(container: HTMLElement, onResize: (cfg: GridConfig) => void): void;
|
|
181
|
+
/** Stop observing a container. */
|
|
182
|
+
unobserve(container: HTMLElement): void;
|
|
183
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<LayoutEngine, never>;
|
|
184
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<LayoutEngine>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Central singleton that tracks arbitrary JSON payloads per color group.
|
|
189
|
+
*
|
|
190
|
+
* Widgets assigned to the same color group all see the same accumulated
|
|
191
|
+
* data. Each widget publishes partial JSON — the service shallow-merges
|
|
192
|
+
* it into the group state. Keys a widget doesn't touch are left intact.
|
|
193
|
+
*
|
|
194
|
+
* To remove a key you previously set, publish it as `null`.
|
|
195
|
+
*
|
|
196
|
+
* Persistence is handled by WorkspaceService via {@link getAllData} /
|
|
197
|
+
* {@link setAllData}. This service does not touch localStorage directly.
|
|
198
|
+
*/
|
|
199
|
+
declare class WidgetLinkService {
|
|
200
|
+
private readonly state;
|
|
201
|
+
constructor();
|
|
202
|
+
/** Get the reactive data signal for a color group. */
|
|
203
|
+
getData(color: ColorGroup): WritableSignal<Record<string, unknown>>;
|
|
204
|
+
/** Read the current data value (non-reactive snapshot). */
|
|
205
|
+
getDataSnapshot(color: ColorGroup): Record<string, unknown>;
|
|
206
|
+
/**
|
|
207
|
+
* Publish a partial JSON payload to a color group.
|
|
208
|
+
*
|
|
209
|
+
* Shallow-merged with the existing state:
|
|
210
|
+
* - New keys are added.
|
|
211
|
+
* - Existing keys the caller provides are overwritten.
|
|
212
|
+
* - Keys the caller does NOT provide survive untouched.
|
|
213
|
+
* - Keys with `null` or `undefined` values are removed.
|
|
214
|
+
*/
|
|
215
|
+
publishData(color: ColorGroup, partial: Record<string, unknown>): void;
|
|
216
|
+
/** Reset all color groups to empty state. */
|
|
217
|
+
resetAll(): void;
|
|
218
|
+
/**
|
|
219
|
+
* Return a snapshot of all color group data for serialization.
|
|
220
|
+
* Called by WorkspaceService during save.
|
|
221
|
+
*/
|
|
222
|
+
getAllData(): Record<string, Record<string, unknown>>;
|
|
223
|
+
/**
|
|
224
|
+
* Restore color group data from a previously saved snapshot.
|
|
225
|
+
* Called by WorkspaceService during load.
|
|
226
|
+
*/
|
|
227
|
+
setAllData(data: Record<string, Record<string, unknown>>): void;
|
|
228
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetLinkService, never>;
|
|
229
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<WidgetLinkService>;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Central singleton that owns the full workspace state:
|
|
234
|
+
* an array of WidgetWindows, each containing a grid of widget panels.
|
|
235
|
+
*
|
|
236
|
+
* All mutations flow through this service so that persistence and
|
|
237
|
+
* cross-window sync (BroadcastChannel) stay consistent.
|
|
238
|
+
*/
|
|
239
|
+
declare class WorkspaceService {
|
|
240
|
+
#private;
|
|
241
|
+
/** All windows in the workspace. */
|
|
242
|
+
readonly windows: _angular_core.WritableSignal<WidgetWindowState[]>;
|
|
243
|
+
/** Reactive list of registered widget type strings (for dropdowns). */
|
|
244
|
+
readonly widgetTypes: _angular_core.WritableSignal<string[]>;
|
|
245
|
+
/** Reactive list of widget labels (for dropdown display). */
|
|
246
|
+
readonly widgetLabels: _angular_core.WritableSignal<string[]>;
|
|
247
|
+
/** Registry mapping widget type strings to their metadata + component class. */
|
|
248
|
+
readonly widgetRegistry: Map<string, WidgetMeta>;
|
|
249
|
+
constructor();
|
|
250
|
+
/** Get metadata for a widget type. */
|
|
251
|
+
getWidgetMeta(type: string): WidgetMeta | undefined;
|
|
252
|
+
/** Create a new empty WidgetWindow and add it to the workspace. */
|
|
253
|
+
addWindow(title?: string): WidgetWindowState;
|
|
254
|
+
/** Remove a window by ID. The last remaining window cannot be removed. */
|
|
255
|
+
removeWindow(windowId: string): void;
|
|
256
|
+
/** Update a window's screen bounds (position / size). */
|
|
257
|
+
updateWindowBounds(windowId: string, bounds: WidgetWindowState['bounds']): void;
|
|
258
|
+
/** Toggle minimized state. */
|
|
259
|
+
toggleMinimize(windowId: string): void;
|
|
260
|
+
/** Set a window's lifecycle state ('open' or 'closed'). */
|
|
261
|
+
setWindowState(windowId: string, state: 'open' | 'closed'): void;
|
|
262
|
+
/** Set a window's display title. Empty / blank titles default to 'My Window'. */
|
|
263
|
+
setWindowTitle(windowId: string, title: string): void;
|
|
264
|
+
/**
|
|
265
|
+
* Add a widget panel to a specific window.
|
|
266
|
+
* Uses the widget's registered metadata for default sizing.
|
|
267
|
+
*/
|
|
268
|
+
addWidget(windowId: string, type: string): WidgetPanelState | undefined;
|
|
269
|
+
/** Remove a widget panel by its ID. */
|
|
270
|
+
removeWidget(windowId: string, widgetId: string): void;
|
|
271
|
+
/** Update a widget's grid position and/or size. */
|
|
272
|
+
updateWidgetLayout(windowId: string, widgetId: string, patch: Partial<Pick<WidgetPanelState, 'gridX' | 'gridY' | 'gridCols' | 'gridRows'>>): void;
|
|
273
|
+
/** Set the color group for a widget panel. */
|
|
274
|
+
setWidgetColorGroup(windowId: string, widgetId: string, colorGroup: WidgetPanelState['colorGroup']): void;
|
|
275
|
+
/** Serialize the entire workspace to localStorage. */
|
|
276
|
+
save(): void;
|
|
277
|
+
/** Replace all windows with a previously saved snapshot. */
|
|
278
|
+
restore(snapshot: WidgetWindowState[]): void;
|
|
279
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WorkspaceService, never>;
|
|
280
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<WorkspaceService>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Format a number to a fixed number of decimal places.
|
|
285
|
+
*/
|
|
286
|
+
declare function fmt(value: number, decimals?: number): string;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Abstract base class for all screen widgets.
|
|
290
|
+
*
|
|
291
|
+
* Provides the shared state and logic that every widget needs:
|
|
292
|
+
* - Inputs: widgetId, windowId, meta
|
|
293
|
+
* - Reactive signals: title, colorGroup, data
|
|
294
|
+
* - Action methods: setTitle, publishData, onColorGroupChange, onRemove
|
|
295
|
+
* - Color picker data: colors, colorHex
|
|
296
|
+
*
|
|
297
|
+
* Concrete widgets extend this class and use {@link WidgetChromeComponent}
|
|
298
|
+
* in their template to render the common chrome (titlebar, color picker,
|
|
299
|
+
* remove button) while projecting their own content into the body slot.
|
|
300
|
+
*
|
|
301
|
+
* All members are `protected` so inheriting widgets can access them
|
|
302
|
+
* directly — no dependency injection token needed.
|
|
303
|
+
*/
|
|
304
|
+
declare abstract class ScreenWidgetBase {
|
|
305
|
+
#private;
|
|
306
|
+
/** Unique widget instance ID — provided by WidgetWindow. */
|
|
307
|
+
readonly widgetId: _angular_core.InputSignal<string>;
|
|
308
|
+
/** ID of the parent window — provided by WidgetWindow. */
|
|
309
|
+
readonly windowId: _angular_core.InputSignal<string>;
|
|
310
|
+
/** Widget metadata (type, label, default sizing, etc.). */
|
|
311
|
+
readonly meta: _angular_core.InputSignal<WidgetMeta>;
|
|
312
|
+
protected readonly workspace: WorkspaceService;
|
|
313
|
+
protected readonly widgetLink: WidgetLinkService;
|
|
314
|
+
/** Overridable title — starts from meta().label, settable via setTitle(). */
|
|
315
|
+
readonly title: Signal<string>;
|
|
316
|
+
/** The color group for this widget, read from the workspace state. */
|
|
317
|
+
readonly colorGroup: Signal<ColorGroup | undefined>;
|
|
318
|
+
/**
|
|
319
|
+
* The accumulated JSON data for this widget's color group.
|
|
320
|
+
* Automatically tracks the WidgetLinkService signal for whatever
|
|
321
|
+
* color group is currently assigned.
|
|
322
|
+
*/
|
|
323
|
+
readonly data: Signal<Record<string, unknown>>;
|
|
324
|
+
protected readonly colors: ColorGroup[];
|
|
325
|
+
protected readonly colorHex: Record<ColorGroup, string>;
|
|
326
|
+
/** Allow the widget to override the header title at runtime. */
|
|
327
|
+
setTitle(title: string): void;
|
|
328
|
+
/**
|
|
329
|
+
* Publish partial JSON data to all widgets sharing this widget's color group.
|
|
330
|
+
* Shallow-merged: keys you provide overwrite, keys you omit survive.
|
|
331
|
+
* Pass `null` as a value to remove a key. No-op if no color group assigned.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* this.publishData({ symbol: 'AAPL' });
|
|
335
|
+
* this.publishData({ resistance: 543.21 });
|
|
336
|
+
*/
|
|
337
|
+
publishData(partial: Record<string, unknown>): void;
|
|
338
|
+
/** Update the color group for this widget in the workspace. */
|
|
339
|
+
onColorGroupChange(cg: ColorGroup | undefined): void;
|
|
340
|
+
/** Remove this widget from its parent window. */
|
|
341
|
+
onRemove(): void;
|
|
342
|
+
/** Convenience alias for the color picker dropdown. */
|
|
343
|
+
selectColor(color: ColorGroup | undefined): void;
|
|
344
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScreenWidgetBase, never>;
|
|
345
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ScreenWidgetBase, never, never, { "widgetId": { "alias": "widgetId"; "required": true; "isSignal": true; }; "windowId": { "alias": "windowId"; "required": true; "isSignal": true; }; "meta": { "alias": "meta"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Register a widget via the WIDGET_META multi-provider token.
|
|
350
|
+
* Call this from a root-level provider factory to make the widget
|
|
351
|
+
* discoverable by WorkspaceService.
|
|
352
|
+
*
|
|
353
|
+
* The `component` field should point to the full widget component
|
|
354
|
+
* (the one that extends {@link ScreenWidgetBase} and includes
|
|
355
|
+
* the {@link WidgetChromeComponent} in its template).
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* export function provideWatchlistWidget(): EnvironmentProviders {
|
|
359
|
+
* return provideWidget({
|
|
360
|
+
* type: 'watchlist',
|
|
361
|
+
* component: Watchlist,
|
|
362
|
+
* label: 'Watchlist',
|
|
363
|
+
* defaultCols: 16,
|
|
364
|
+
* defaultRows: 6,
|
|
365
|
+
* minCols: 8,
|
|
366
|
+
* minRows: 3,
|
|
367
|
+
* });
|
|
368
|
+
* }
|
|
369
|
+
*/
|
|
370
|
+
declare function provideWidget(meta: WidgetMeta): EnvironmentProviders;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Reusable widget chrome component that renders the common titlebar:
|
|
374
|
+
* color-group picker, dynamic title, and remove button.
|
|
375
|
+
*
|
|
376
|
+
* Uses `<ng-content>` to project the widget-specific body content.
|
|
377
|
+
*
|
|
378
|
+
* This component is **purely presentational** — all business logic
|
|
379
|
+
* (workspace mutations, symbol linking) lives in {@link ScreenWidgetBase}
|
|
380
|
+
* and is wired up by the concrete widget's template.
|
|
381
|
+
*/
|
|
382
|
+
declare class WidgetChromeComponent {
|
|
383
|
+
/** The current title text to display in the header. */
|
|
384
|
+
readonly title: _angular_core.InputSignal<string>;
|
|
385
|
+
/** The current color group, or undefined if unlinked. */
|
|
386
|
+
readonly colorGroup: _angular_core.InputSignal<ColorGroup | undefined>;
|
|
387
|
+
/** Emitted when the user selects a different color group (or "No link"). */
|
|
388
|
+
readonly colorChange: _angular_core.OutputEmitterRef<ColorGroup | undefined>;
|
|
389
|
+
/** Emitted when the user clicks the remove (×) button. */
|
|
390
|
+
readonly remove: _angular_core.OutputEmitterRef<void>;
|
|
391
|
+
protected readonly colors: ColorGroup[];
|
|
392
|
+
protected readonly colorHex: Record<ColorGroup, string>;
|
|
393
|
+
protected selectColor(color: ColorGroup | undefined): void;
|
|
394
|
+
protected onRemove(): void;
|
|
395
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetChromeComponent, never>;
|
|
396
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WidgetChromeComponent, "janus-widget-chrome", never, { "title": { "alias": "title"; "required": true; "isSignal": true; }; "colorGroup": { "alias": "colorGroup"; "required": false; "isSignal": true; }; }, { "colorChange": "colorChange"; "remove": "remove"; }, never, ["*"], true, never>;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
declare class WidgetWindow implements AfterViewInit, OnDestroy {
|
|
400
|
+
readonly windowId: _angular_core.InputSignal<string>;
|
|
401
|
+
private readonly workspace;
|
|
402
|
+
private readonly engine;
|
|
403
|
+
readonly bodyEl: _angular_core.Signal<ElementRef<HTMLElement>>;
|
|
404
|
+
readonly availableTypes: _angular_core.WritableSignal<string[]>;
|
|
405
|
+
readonly availableLabels: _angular_core.WritableSignal<string[]>;
|
|
406
|
+
readonly cfg: _angular_core.WritableSignal<GridConfig>;
|
|
407
|
+
/** Active intervals for polling popup closure. */
|
|
408
|
+
private readonly popupIntervals;
|
|
409
|
+
/** Dynamic background grid that matches our uniform layout step. */
|
|
410
|
+
protected readonly gridBgSize: _angular_core.Signal<string>;
|
|
411
|
+
/** Offset the background so dots land at the center of gap intersections. */
|
|
412
|
+
protected readonly gridBgPosition: _angular_core.Signal<string>;
|
|
413
|
+
protected readonly widgets: _angular_core.Signal<WidgetPanelState[]>;
|
|
414
|
+
protected readonly widgetRects: _angular_core.Signal<Map<string, PixelRect>>;
|
|
415
|
+
/** All popup windows (open or closed), for the window dropdown. */
|
|
416
|
+
protected readonly popupWindows: _angular_core.Signal<WidgetWindowState[]>;
|
|
417
|
+
/** Popup windows the user has intentionally closed. */
|
|
418
|
+
protected readonly closedWindows: _angular_core.Signal<WidgetWindowState[]>;
|
|
419
|
+
/** Title of the current window (reactive). */
|
|
420
|
+
protected readonly windowTitle: _angular_core.Signal<string>;
|
|
421
|
+
/** Title text width estimate (14px font, ~8.4px avg char width, + 12px padding). */
|
|
422
|
+
protected readonly titleWidth: _angular_core.Signal<number>;
|
|
423
|
+
private editingTitle;
|
|
424
|
+
constructor();
|
|
425
|
+
ngAfterViewInit(): void;
|
|
426
|
+
ngOnDestroy(): void;
|
|
427
|
+
addWidget(type: string): void;
|
|
428
|
+
/** Create a new chromeless popup window containing a fresh WidgetWindow. */
|
|
429
|
+
protected openNewWindow(existingId?: string): void;
|
|
430
|
+
/** Reopen a previously closed popup window. */
|
|
431
|
+
protected reopenWindow(windowId: string): void;
|
|
432
|
+
/** Permanently discard a closed window and all its widgets. */
|
|
433
|
+
protected discardWindow(windowId: string): void;
|
|
434
|
+
/** Reopen all previously closed popup windows at once. */
|
|
435
|
+
protected reopenAllClosed(): void;
|
|
436
|
+
/**
|
|
437
|
+
* Handle popup closure: discard empty windows, keep windows with content
|
|
438
|
+
* saved in localStorage (hidden from the main workspace).
|
|
439
|
+
*/
|
|
440
|
+
private closePopupWindow;
|
|
441
|
+
protected onTitleFocus(event: FocusEvent): void;
|
|
442
|
+
protected onTitleEnter(event: Event): void;
|
|
443
|
+
protected onTitleBlur(event: FocusEvent): void;
|
|
444
|
+
protected getMeta(type: string): WidgetMeta | undefined;
|
|
445
|
+
protected getRect(widgetId: string): PixelRect;
|
|
446
|
+
protected onDragStart(event: MouseEvent, w: WidgetPanelState): void;
|
|
447
|
+
protected onResizeStart(event: MouseEvent, w: WidgetPanelState): void;
|
|
448
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetWindow, never>;
|
|
449
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WidgetWindow, "janus-widget-window", never, { "windowId": { "alias": "windowId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare class WindowOutlet implements OnInit, OnDestroy {
|
|
453
|
+
private readonly route;
|
|
454
|
+
protected windowId: string;
|
|
455
|
+
private heartbeatInterval;
|
|
456
|
+
ngOnInit(): void;
|
|
457
|
+
ngOnDestroy(): void;
|
|
458
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WindowOutlet, never>;
|
|
459
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WindowOutlet, "app-window-outlet", never, {}, {}, never, never, true, never>;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
declare class Janusui {
|
|
463
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<Janusui, never>;
|
|
464
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<Janusui, "lib-janusui", never, {}, {}, never, never, true, never>;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export { COLOR_GROUPS, COLOR_GROUP_HEX, Janusui, LayoutEngine, SCREEN_WIDGET_API, ScreenWidgetBase, WIDGET_META, WidgetChromeComponent, WidgetLinkService, WidgetWindow, WindowOutlet, WorkspaceService, fmt, provideWidget };
|
|
468
|
+
export type { ColorGroup, GridConfig, PixelRect, ScreenWidgetApi, Theme, WidgetMeta, WidgetPanelState, WidgetWindowState };
|