@fgv/ts-app-shell 5.1.0-31 → 5.1.0-32
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.
- package/dist/packlets/messages/MessagesContext.js +2 -2
- package/dist/packlets/messages/MessagesContext.js.map +1 -1
- package/dist/packlets/messages/MessagesLogger.js +10 -31
- package/dist/packlets/messages/MessagesLogger.js.map +1 -1
- package/dist/packlets/messages/StatusBar.js +36 -23
- package/dist/packlets/messages/StatusBar.js.map +1 -1
- package/dist/packlets/messages/Toast.js +5 -3
- package/dist/packlets/messages/Toast.js.map +1 -1
- package/dist/packlets/messages/index.js +1 -1
- package/dist/packlets/messages/index.js.map +1 -1
- package/dist/packlets/messages/model.js +31 -4
- package/dist/packlets/messages/model.js.map +1 -1
- package/lib/packlets/messages/MessagesContext.d.ts +7 -3
- package/lib/packlets/messages/MessagesContext.d.ts.map +1 -1
- package/lib/packlets/messages/MessagesContext.js +2 -2
- package/lib/packlets/messages/MessagesContext.js.map +1 -1
- package/lib/packlets/messages/MessagesLogger.d.ts +8 -3
- package/lib/packlets/messages/MessagesLogger.d.ts.map +1 -1
- package/lib/packlets/messages/MessagesLogger.js +10 -31
- package/lib/packlets/messages/MessagesLogger.js.map +1 -1
- package/lib/packlets/messages/StatusBar.d.ts +10 -1
- package/lib/packlets/messages/StatusBar.d.ts.map +1 -1
- package/lib/packlets/messages/StatusBar.js +35 -22
- package/lib/packlets/messages/StatusBar.js.map +1 -1
- package/lib/packlets/messages/Toast.d.ts.map +1 -1
- package/lib/packlets/messages/Toast.js +4 -2
- package/lib/packlets/messages/Toast.js.map +1 -1
- package/lib/packlets/messages/index.d.ts +1 -1
- package/lib/packlets/messages/index.d.ts.map +1 -1
- package/lib/packlets/messages/index.js +2 -1
- package/lib/packlets/messages/index.js.map +1 -1
- package/lib/packlets/messages/model.d.ts +47 -5
- package/lib/packlets/messages/model.d.ts.map +1 -1
- package/lib/packlets/messages/model.js +32 -4
- package/lib/packlets/messages/model.js.map +1 -1
- package/package.json +5 -5
|
@@ -2,11 +2,25 @@
|
|
|
2
2
|
* Message model types for the observability system.
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
|
+
import { type MessageLogLevel } from '@fgv/ts-utils';
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Display styling levels for messages — drives color, icon, and toast behavior.
|
|
8
|
+
*
|
|
9
|
+
* This is the styling axis, orthogonal to the {@link @fgv/ts-utils#MessageLogLevel | log level}
|
|
10
|
+
* filter axis on {@link IMessage.level}. `'success'` lives here (a UI affordance with no
|
|
11
|
+
* log-level analog) and is only ever set explicitly — never derived from a logger bridge.
|
|
7
12
|
* @public
|
|
8
13
|
*/
|
|
9
14
|
export type MessageSeverity = 'info' | 'success' | 'warning' | 'error';
|
|
15
|
+
/**
|
|
16
|
+
* Derives a display {@link MessageSeverity} from a canonical
|
|
17
|
+
* {@link @fgv/ts-utils#MessageLogLevel | log level}, used when a message carries no explicit
|
|
18
|
+
* `severity` styling override. `'success'` is never derived — it is a UI-only affordance.
|
|
19
|
+
* @param level - The canonical log level.
|
|
20
|
+
* @returns The styling severity to use for display.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare function deriveSeverityFromLevel(level: MessageLogLevel): MessageSeverity;
|
|
10
24
|
/**
|
|
11
25
|
* A single message in the observability stream.
|
|
12
26
|
* @public
|
|
@@ -14,8 +28,17 @@ export type MessageSeverity = 'info' | 'success' | 'warning' | 'error';
|
|
|
14
28
|
export interface IMessage {
|
|
15
29
|
/** Unique message ID */
|
|
16
30
|
readonly id: string;
|
|
17
|
-
/**
|
|
18
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Canonical {@link @fgv/ts-utils#MessageLogLevel | log level} — drives FILTERING.
|
|
33
|
+
* Set losslessly from a ts-utils logger when a message originates from the logger bridge.
|
|
34
|
+
*/
|
|
35
|
+
readonly level: MessageLogLevel;
|
|
36
|
+
/**
|
|
37
|
+
* Display styling override (color / icon / toast). Optional; when absent, styling is
|
|
38
|
+
* derived from {@link IMessage.level} via {@link deriveSeverityFromLevel}. `'success'`
|
|
39
|
+
* lives here — set explicitly for UI-originated messages, never from a logger bridge.
|
|
40
|
+
*/
|
|
41
|
+
readonly severity?: MessageSeverity;
|
|
19
42
|
/** Message text */
|
|
20
43
|
readonly text: string;
|
|
21
44
|
/** Timestamp (ms since epoch) */
|
|
@@ -52,8 +75,27 @@ export declare const DEFAULT_TOAST_CONFIG: Record<MessageSeverity, IToastConfig>
|
|
|
52
75
|
*/
|
|
53
76
|
export declare function generateMessageId(): string;
|
|
54
77
|
/**
|
|
55
|
-
*
|
|
78
|
+
* Options for {@link createMessage} (and `addMessage`).
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export interface ICreateMessageOptions {
|
|
82
|
+
/**
|
|
83
|
+
* Explicit display styling override. Omit to derive styling from the level via
|
|
84
|
+
* {@link deriveSeverityFromLevel}. Set to `'success'` for UI-originated success messages.
|
|
85
|
+
*/
|
|
86
|
+
readonly severity?: MessageSeverity;
|
|
87
|
+
/** Optional action (e.g., a link or callback). */
|
|
88
|
+
readonly action?: IMessageAction;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Creates a new message at the given canonical {@link @fgv/ts-utils#MessageLogLevel | log level}.
|
|
92
|
+
* The level drives filtering; pass `options.severity` only to override display styling
|
|
93
|
+
* (e.g. `'success'`).
|
|
94
|
+
* @param level - The canonical log level (filter axis).
|
|
95
|
+
* @param text - The message text.
|
|
96
|
+
* @param options - Optional styling severity and action.
|
|
97
|
+
* @returns The created message.
|
|
56
98
|
* @public
|
|
57
99
|
*/
|
|
58
|
-
export declare function createMessage(
|
|
100
|
+
export declare function createMessage(level: MessageLogLevel, text: string, options?: ICreateMessageOptions): IMessage;
|
|
59
101
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/packlets/messages/model.ts"],"names":[],"mappings":"AAsBA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/packlets/messages/model.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAMrD;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe,CAW/E;AAMD;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;IACpC,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iDAAiD;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC/B;AAMD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,eAAe,EAAE,YAAY,CAK7D,CAAC;AAQX;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;IACpC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,qBAAqB,GAC9B,QAAQ,CASV"}
|
|
@@ -22,8 +22,29 @@
|
|
|
22
22
|
*/
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.DEFAULT_TOAST_CONFIG = void 0;
|
|
25
|
+
exports.deriveSeverityFromLevel = deriveSeverityFromLevel;
|
|
25
26
|
exports.generateMessageId = generateMessageId;
|
|
26
27
|
exports.createMessage = createMessage;
|
|
28
|
+
/**
|
|
29
|
+
* Derives a display {@link MessageSeverity} from a canonical
|
|
30
|
+
* {@link @fgv/ts-utils#MessageLogLevel | log level}, used when a message carries no explicit
|
|
31
|
+
* `severity` styling override. `'success'` is never derived — it is a UI-only affordance.
|
|
32
|
+
* @param level - The canonical log level.
|
|
33
|
+
* @returns The styling severity to use for display.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
function deriveSeverityFromLevel(level) {
|
|
37
|
+
switch (level) {
|
|
38
|
+
case 'warning':
|
|
39
|
+
return 'warning';
|
|
40
|
+
case 'error':
|
|
41
|
+
return 'error';
|
|
42
|
+
case 'quiet':
|
|
43
|
+
case 'detail':
|
|
44
|
+
case 'info':
|
|
45
|
+
return 'info';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
27
48
|
/**
|
|
28
49
|
* Default toast configuration by severity.
|
|
29
50
|
* @public
|
|
@@ -46,16 +67,23 @@ function generateMessageId() {
|
|
|
46
67
|
return `msg-${++_nextId}-${Date.now().toString(36)}`;
|
|
47
68
|
}
|
|
48
69
|
/**
|
|
49
|
-
* Creates a new message.
|
|
70
|
+
* Creates a new message at the given canonical {@link @fgv/ts-utils#MessageLogLevel | log level}.
|
|
71
|
+
* The level drives filtering; pass `options.severity` only to override display styling
|
|
72
|
+
* (e.g. `'success'`).
|
|
73
|
+
* @param level - The canonical log level (filter axis).
|
|
74
|
+
* @param text - The message text.
|
|
75
|
+
* @param options - Optional styling severity and action.
|
|
76
|
+
* @returns The created message.
|
|
50
77
|
* @public
|
|
51
78
|
*/
|
|
52
|
-
function createMessage(
|
|
79
|
+
function createMessage(level, text, options) {
|
|
53
80
|
return {
|
|
54
81
|
id: generateMessageId(),
|
|
55
|
-
|
|
82
|
+
level,
|
|
83
|
+
severity: options === null || options === void 0 ? void 0 : options.severity,
|
|
56
84
|
text,
|
|
57
85
|
timestamp: Date.now(),
|
|
58
|
-
action
|
|
86
|
+
action: options === null || options === void 0 ? void 0 : options.action
|
|
59
87
|
};
|
|
60
88
|
}
|
|
61
89
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/packlets/messages/model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/packlets/messages/model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AA+BH,0DAWC;AA6ED,8CAEC;AA0BD,sCAaC;AAzID;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,KAAsB;IAC5D,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAwDD;;;GAGG;AACU,QAAA,oBAAoB,GAA0C;IACzE,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;IAC7B,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;IAChC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;IAChC,KAAK,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;CACnB,CAAC;AAEX,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,IAAI,OAAO,GAAW,CAAC,CAAC;AAExB;;;GAGG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AACvD,CAAC;AAgBD;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAC3B,KAAsB,EACtB,IAAY,EACZ,OAA+B;IAE/B,OAAO;QACL,EAAE,EAAE,iBAAiB,EAAE;QACvB,KAAK;QACL,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ;QAC3B,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,MAAM,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM;KACxB,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright (c) 2026 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Message model types for the observability system.\n * @packageDocumentation\n */\n\nimport { type MessageLogLevel } from '@fgv/ts-utils';\n\n// ============================================================================\n// Message Severity\n// ============================================================================\n\n/**\n * Display styling levels for messages — drives color, icon, and toast behavior.\n *\n * This is the styling axis, orthogonal to the {@link @fgv/ts-utils#MessageLogLevel | log level}\n * filter axis on {@link IMessage.level}. `'success'` lives here (a UI affordance with no\n * log-level analog) and is only ever set explicitly — never derived from a logger bridge.\n * @public\n */\nexport type MessageSeverity = 'info' | 'success' | 'warning' | 'error';\n\n/**\n * Derives a display {@link MessageSeverity} from a canonical\n * {@link @fgv/ts-utils#MessageLogLevel | log level}, used when a message carries no explicit\n * `severity` styling override. `'success'` is never derived — it is a UI-only affordance.\n * @param level - The canonical log level.\n * @returns The styling severity to use for display.\n * @public\n */\nexport function deriveSeverityFromLevel(level: MessageLogLevel): MessageSeverity {\n switch (level) {\n case 'warning':\n return 'warning';\n case 'error':\n return 'error';\n case 'quiet':\n case 'detail':\n case 'info':\n return 'info';\n }\n}\n\n// ============================================================================\n// Message\n// ============================================================================\n\n/**\n * A single message in the observability stream.\n * @public\n */\nexport interface IMessage {\n /** Unique message ID */\n readonly id: string;\n /**\n * Canonical {@link @fgv/ts-utils#MessageLogLevel | log level} — drives FILTERING.\n * Set losslessly from a ts-utils logger when a message originates from the logger bridge.\n */\n readonly level: MessageLogLevel;\n /**\n * Display styling override (color / icon / toast). Optional; when absent, styling is\n * derived from {@link IMessage.level} via {@link deriveSeverityFromLevel}. `'success'`\n * lives here — set explicitly for UI-originated messages, never from a logger bridge.\n */\n readonly severity?: MessageSeverity;\n /** Message text */\n readonly text: string;\n /** Timestamp (ms since epoch) */\n readonly timestamp: number;\n /** Optional action (e.g., a link or callback) */\n readonly action?: IMessageAction;\n}\n\n/**\n * An actionable element attached to a message (e.g., \"Go to Session\" link).\n * @public\n */\nexport interface IMessageAction {\n /** Action label */\n readonly label: string;\n /** Callback when the action is triggered */\n readonly onAction: () => void;\n}\n\n// ============================================================================\n// Toast Configuration\n// ============================================================================\n\n/**\n * Configuration for toast auto-dismiss behavior.\n * @public\n */\nexport interface IToastConfig {\n /** Auto-dismiss duration in ms. 0 = no auto-dismiss. */\n readonly autoDismissMs: number;\n}\n\n/**\n * Default toast configuration by severity.\n * @public\n */\nexport const DEFAULT_TOAST_CONFIG: Record<MessageSeverity, IToastConfig> = {\n info: { autoDismissMs: 3000 },\n success: { autoDismissMs: 3000 },\n warning: { autoDismissMs: 5000 },\n error: { autoDismissMs: 0 }\n} as const;\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nlet _nextId: number = 0;\n\n/**\n * Generates a unique message ID.\n * @internal\n */\nexport function generateMessageId(): string {\n return `msg-${++_nextId}-${Date.now().toString(36)}`;\n}\n\n/**\n * Options for {@link createMessage} (and `addMessage`).\n * @public\n */\nexport interface ICreateMessageOptions {\n /**\n * Explicit display styling override. Omit to derive styling from the level via\n * {@link deriveSeverityFromLevel}. Set to `'success'` for UI-originated success messages.\n */\n readonly severity?: MessageSeverity;\n /** Optional action (e.g., a link or callback). */\n readonly action?: IMessageAction;\n}\n\n/**\n * Creates a new message at the given canonical {@link @fgv/ts-utils#MessageLogLevel | log level}.\n * The level drives filtering; pass `options.severity` only to override display styling\n * (e.g. `'success'`).\n * @param level - The canonical log level (filter axis).\n * @param text - The message text.\n * @param options - Optional styling severity and action.\n * @returns The created message.\n * @public\n */\nexport function createMessage(\n level: MessageLogLevel,\n text: string,\n options?: ICreateMessageOptions\n): IMessage {\n return {\n id: generateMessageId(),\n level,\n severity: options?.severity,\n text,\n timestamp: Date.now(),\n action: options?.action\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fgv/ts-app-shell",
|
|
3
|
-
"version": "5.1.0-
|
|
3
|
+
"version": "5.1.0-32",
|
|
4
4
|
"description": "Shared React UI primitives for application shells: column cascade, sidebar, toast/log messages, command palette, keybinding registry",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@heroicons/react": "~2.2.0",
|
|
21
21
|
"tslib": "^2.8.1",
|
|
22
|
-
"@fgv/ts-utils": "5.1.0-
|
|
23
|
-
"@fgv/ts-extras": "5.1.0-
|
|
22
|
+
"@fgv/ts-utils": "5.1.0-32",
|
|
23
|
+
"@fgv/ts-extras": "5.1.0-32"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": ">=18.0.0",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@rushstack/heft-jest-plugin": "1.2.6",
|
|
54
54
|
"@testing-library/dom": "^10.4.0",
|
|
55
55
|
"@rushstack/heft-node-rig": "2.11.27",
|
|
56
|
-
"@fgv/
|
|
57
|
-
"@fgv/
|
|
56
|
+
"@fgv/ts-utils-jest": "5.1.0-32",
|
|
57
|
+
"@fgv/heft-dual-rig": "5.1.0-32"
|
|
58
58
|
},
|
|
59
59
|
"exports": {
|
|
60
60
|
".": {
|