@mcp-b/char 0.0.6 → 0.1.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.
- package/README.md +76 -362
- package/dist/custom-elements.json +2180 -0
- package/dist/display-mode-policy.d.ts +82 -0
- package/dist/display-mode-policy.d.ts.map +1 -0
- package/dist/display-mode-policy.js +87 -0
- package/dist/display-mode-policy.js.map +1 -0
- package/dist/index.d.ts +707 -326
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2370 -15521
- package/dist/index.js.map +1 -1
- package/dist/shell-component.d.ts +379 -0
- package/dist/shell-component.d.ts.map +1 -0
- package/dist/shell-component.js +2504 -0
- package/dist/shell-component.js.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/utils.d.ts +161 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +393 -0
- package/dist/utils.js.map +1 -0
- package/dist/web-component-standalone.iife.js +1255 -2358
- package/dist/web-component-standalone.iife.js.map +1 -1
- package/dist/web-component.d.ts +381 -180
- package/dist/web-component.d.ts.map +1 -1
- package/dist/web-component.js +1138 -15740
- package/dist/web-component.js.map +1 -1
- package/package.json +23 -115
- package/THIRD_PARTY_NOTICES.md +0 -52
- package/dist/VoiceHandoffPanel-CIFIJSDs.js +0 -244
- package/dist/VoiceHandoffPanel-CIFIJSDs.js.map +0 -1
- package/dist/button-BLnLZvxR.js +0 -105
- package/dist/button-BLnLZvxR.js.map +0 -1
- package/dist/realtimekit.d.ts +0 -15
- package/dist/realtimekit.d.ts.map +0 -1
- package/dist/realtimekit.js +0 -89
- package/dist/realtimekit.js.map +0 -1
- package/dist/styles/globals.css +0 -2
- package/dist/styles.d.ts +0 -2
- package/dist/web-component-standalone.css +0 -37
- package/dist/web-component-standalone.css.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Allowed display modes for the host shell and embedded runtime.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
type CharDisplayMode = 'inline' | 'fullscreen' | 'pip';
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/display-mode-policy.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Default display modes advertised by Char hosts.
|
|
13
|
+
*
|
|
14
|
+
* Order matters for fallback behavior. When a preferred mode is unavailable,
|
|
15
|
+
* the first available mode is selected.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
declare const DEFAULT_AVAILABLE_DISPLAY_MODES: readonly ["inline", "fullscreen", "pip"];
|
|
20
|
+
/**
|
|
21
|
+
* Runtime guard for Char display mode values.
|
|
22
|
+
*
|
|
23
|
+
* @param value - Raw value from host attributes, events, or external input.
|
|
24
|
+
* @returns `true` when the value is one of `inline`, `fullscreen`, or `pip`.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
declare function isDisplayMode(value: string | null | undefined): value is CharDisplayMode;
|
|
29
|
+
/**
|
|
30
|
+
* Checks whether a display mode represents an expanded agent surface.
|
|
31
|
+
*
|
|
32
|
+
* Expanded modes are:
|
|
33
|
+
* - `inline` (panel-style)
|
|
34
|
+
* - `fullscreen` (viewport-filling)
|
|
35
|
+
*
|
|
36
|
+
* Collapsed mode is:
|
|
37
|
+
* - `pip` (launcher-only)
|
|
38
|
+
*
|
|
39
|
+
* @param mode - Current display mode from host context.
|
|
40
|
+
* @returns `true` for expanded modes and `false` for collapsed/undefined modes.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
declare function isExpandedDisplayMode(mode: CharDisplayMode | undefined): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a preferred display mode against host-supported modes.
|
|
47
|
+
*
|
|
48
|
+
* An empty `availableModes` array means "no constraint" — the preferred mode
|
|
49
|
+
* is returned unconditionally. This is intentional: it allows callers to opt
|
|
50
|
+
* out of mode filtering without a separate code path.
|
|
51
|
+
*
|
|
52
|
+
* @param preferred - Preferred mode requested by host policy.
|
|
53
|
+
* @param availableModes - Supported modes advertised by the host.
|
|
54
|
+
* @returns Preferred mode when supported, otherwise the first available mode.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
declare function resolveSupportedDisplayMode(preferred: CharDisplayMode, availableModes?: readonly CharDisplayMode[]): CharDisplayMode;
|
|
59
|
+
/**
|
|
60
|
+
* Resolves Char's standard host display-mode policy.
|
|
61
|
+
*
|
|
62
|
+
* Policy:
|
|
63
|
+
* - Closed state to `pip`
|
|
64
|
+
* - Open on desktop to `inline`
|
|
65
|
+
* - Open on narrow viewport to `fullscreen`
|
|
66
|
+
*
|
|
67
|
+
* The resolved mode is then constrained to `availableModes`.
|
|
68
|
+
*
|
|
69
|
+
* @param options - Host orchestration inputs: `open`, `isNarrowViewport`,
|
|
70
|
+
* and optional `availableModes`.
|
|
71
|
+
* @returns Final mode that satisfies policy and availability constraints.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
declare function resolvePolicyDisplayMode(options: {
|
|
76
|
+
open: boolean;
|
|
77
|
+
isNarrowViewport: boolean;
|
|
78
|
+
availableModes?: readonly CharDisplayMode[];
|
|
79
|
+
}): CharDisplayMode;
|
|
80
|
+
//#endregion
|
|
81
|
+
export { type CharDisplayMode, DEFAULT_AVAILABLE_DISPLAY_MODES, isDisplayMode, isExpandedDisplayMode, resolvePolicyDisplayMode, resolveSupportedDisplayMode };
|
|
82
|
+
//# sourceMappingURL=display-mode-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-mode-policy.d.ts","names":[],"sources":["../src/types.ts","../src/display-mode-policy.ts"],"mappings":";;;;;;;KAwEY,eAAA;;;;;;;;;;AC3DZ;cAAa,+BAAA;;;;AA2Bb;;;;;iBAAgB,aAAA,CACf,KAAA,8BACE,KAAA,IAAS,eAAA;;;;AAmBZ;;;;;AAiBA;;;;;;;iBAjBgB,qBAAA,CAAsB,IAAA,EAAM,eAAA;;;;;;;;AAiD5C;;;;;;iBAhCgB,2BAAA,CACf,SAAA,EAAW,eAAA,EACX,cAAA,YAAyB,eAAA,KACvB,eAAA;;;;;;;;;;;;;;;;;iBA6Ba,wBAAA,CAAyB,OAAA;EACxC,IAAA;EACA,gBAAA;EACA,cAAA,YAA0B,eAAA;AAAA,IACvB,eAAA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*! @mcp-b/char | Copyright (c) 2025 Kukumis Inc. All rights reserved. | UNLICENSED */
|
|
2
|
+
//#region src/display-mode-policy.ts
|
|
3
|
+
/**
|
|
4
|
+
* Default display modes advertised by Char hosts.
|
|
5
|
+
*
|
|
6
|
+
* Order matters for fallback behavior. When a preferred mode is unavailable,
|
|
7
|
+
* the first available mode is selected.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_AVAILABLE_DISPLAY_MODES = [
|
|
12
|
+
"inline",
|
|
13
|
+
"fullscreen",
|
|
14
|
+
"pip"
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Runtime guard for Char display mode values.
|
|
18
|
+
*
|
|
19
|
+
* @param value - Raw value from host attributes, events, or external input.
|
|
20
|
+
* @returns `true` when the value is one of `inline`, `fullscreen`, or `pip`.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
function isDisplayMode(value) {
|
|
25
|
+
return value === "inline" || value === "fullscreen" || value === "pip";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Checks whether a display mode represents an expanded agent surface.
|
|
29
|
+
*
|
|
30
|
+
* Expanded modes are:
|
|
31
|
+
* - `inline` (panel-style)
|
|
32
|
+
* - `fullscreen` (viewport-filling)
|
|
33
|
+
*
|
|
34
|
+
* Collapsed mode is:
|
|
35
|
+
* - `pip` (launcher-only)
|
|
36
|
+
*
|
|
37
|
+
* @param mode - Current display mode from host context.
|
|
38
|
+
* @returns `true` for expanded modes and `false` for collapsed/undefined modes.
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
function isExpandedDisplayMode(mode) {
|
|
43
|
+
return mode === "inline" || mode === "fullscreen";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a preferred display mode against host-supported modes.
|
|
47
|
+
*
|
|
48
|
+
* An empty `availableModes` array means "no constraint" — the preferred mode
|
|
49
|
+
* is returned unconditionally. This is intentional: it allows callers to opt
|
|
50
|
+
* out of mode filtering without a separate code path.
|
|
51
|
+
*
|
|
52
|
+
* @param preferred - Preferred mode requested by host policy.
|
|
53
|
+
* @param availableModes - Supported modes advertised by the host.
|
|
54
|
+
* @returns Preferred mode when supported, otherwise the first available mode.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
function resolveSupportedDisplayMode(preferred, availableModes = DEFAULT_AVAILABLE_DISPLAY_MODES) {
|
|
59
|
+
if (availableModes.length === 0) return preferred;
|
|
60
|
+
if (availableModes.includes(preferred)) return preferred;
|
|
61
|
+
console.debug(`[Char] Display mode "${preferred}" not in available modes [${availableModes.join(", ")}], using "${availableModes[0]}"`);
|
|
62
|
+
return availableModes[0];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Resolves Char's standard host display-mode policy.
|
|
66
|
+
*
|
|
67
|
+
* Policy:
|
|
68
|
+
* - Closed state to `pip`
|
|
69
|
+
* - Open on desktop to `inline`
|
|
70
|
+
* - Open on narrow viewport to `fullscreen`
|
|
71
|
+
*
|
|
72
|
+
* The resolved mode is then constrained to `availableModes`.
|
|
73
|
+
*
|
|
74
|
+
* @param options - Host orchestration inputs: `open`, `isNarrowViewport`,
|
|
75
|
+
* and optional `availableModes`.
|
|
76
|
+
* @returns Final mode that satisfies policy and availability constraints.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
function resolvePolicyDisplayMode(options) {
|
|
81
|
+
const availableModes = options.availableModes ?? DEFAULT_AVAILABLE_DISPLAY_MODES;
|
|
82
|
+
return resolveSupportedDisplayMode(options.open ? options.isNarrowViewport ? "fullscreen" : "inline" : "pip", availableModes);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { DEFAULT_AVAILABLE_DISPLAY_MODES, isDisplayMode, isExpandedDisplayMode, resolvePolicyDisplayMode, resolveSupportedDisplayMode };
|
|
87
|
+
//# sourceMappingURL=display-mode-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-mode-policy.js","names":[],"sources":["../src/display-mode-policy.ts"],"sourcesContent":["import type { CharDisplayMode } from './types'\nexport type { CharDisplayMode } from './types'\n\ntype AssertTrue<T extends true> = T\n\n/**\n * Default display modes advertised by Char hosts.\n *\n * Order matters for fallback behavior. When a preferred mode is unavailable,\n * the first available mode is selected.\n *\n * @public\n */\nexport const DEFAULT_AVAILABLE_DISPLAY_MODES = [\n\t'inline',\n\t'fullscreen',\n\t'pip',\n] as const satisfies readonly CharDisplayMode[]\n\n/**\n * Allowed display mode values for Char host policy resolution.\n */\ntype DisplayModesFromDefaults = (typeof DEFAULT_AVAILABLE_DISPLAY_MODES)[number]\n\ntype _AssertDisplayModesStayInSync = AssertTrue<\n\t[DisplayModesFromDefaults] extends [CharDisplayMode]\n\t\t? [CharDisplayMode] extends [DisplayModesFromDefaults]\n\t\t\t? true\n\t\t\t: false\n\t\t: false\n>\n\n/**\n * Runtime guard for Char display mode values.\n *\n * @param value - Raw value from host attributes, events, or external input.\n * @returns `true` when the value is one of `inline`, `fullscreen`, or `pip`.\n *\n * @public\n */\nexport function isDisplayMode(\n\tvalue: string | null | undefined,\n): value is CharDisplayMode {\n\treturn value === 'inline' || value === 'fullscreen' || value === 'pip'\n}\n\n/**\n * Checks whether a display mode represents an expanded agent surface.\n *\n * Expanded modes are:\n * - `inline` (panel-style)\n * - `fullscreen` (viewport-filling)\n *\n * Collapsed mode is:\n * - `pip` (launcher-only)\n *\n * @param mode - Current display mode from host context.\n * @returns `true` for expanded modes and `false` for collapsed/undefined modes.\n *\n * @public\n */\nexport function isExpandedDisplayMode(mode: CharDisplayMode | undefined): boolean {\n\treturn mode === 'inline' || mode === 'fullscreen'\n}\n\n/**\n * Resolves a preferred display mode against host-supported modes.\n *\n * An empty `availableModes` array means \"no constraint\" — the preferred mode\n * is returned unconditionally. This is intentional: it allows callers to opt\n * out of mode filtering without a separate code path.\n *\n * @param preferred - Preferred mode requested by host policy.\n * @param availableModes - Supported modes advertised by the host.\n * @returns Preferred mode when supported, otherwise the first available mode.\n *\n * @public\n */\nexport function resolveSupportedDisplayMode(\n\tpreferred: CharDisplayMode,\n\tavailableModes: readonly CharDisplayMode[] = DEFAULT_AVAILABLE_DISPLAY_MODES,\n): CharDisplayMode {\n\tif (availableModes.length === 0) {\n\t\treturn preferred\n\t}\n\n\tif (availableModes.includes(preferred)) {\n\t\treturn preferred\n\t}\n\n\tconsole.debug(`[Char] Display mode \"${preferred}\" not in available modes [${availableModes.join(', ')}], using \"${availableModes[0]}\"`)\n\treturn availableModes[0]\n}\n\n/**\n * Resolves Char's standard host display-mode policy.\n *\n * Policy:\n * - Closed state to `pip`\n * - Open on desktop to `inline`\n * - Open on narrow viewport to `fullscreen`\n *\n * The resolved mode is then constrained to `availableModes`.\n *\n * @param options - Host orchestration inputs: `open`, `isNarrowViewport`,\n * and optional `availableModes`.\n * @returns Final mode that satisfies policy and availability constraints.\n *\n * @public\n */\nexport function resolvePolicyDisplayMode(options: {\n\topen: boolean\n\tisNarrowViewport: boolean\n\tavailableModes?: readonly CharDisplayMode[]\n}): CharDisplayMode {\n\tconst availableModes = options.availableModes ?? DEFAULT_AVAILABLE_DISPLAY_MODES\n\tconst preferred: CharDisplayMode = options.open\n\t\t? options.isNarrowViewport\n\t\t\t? 'fullscreen'\n\t\t\t: 'inline'\n\t\t: 'pip'\n\n\treturn resolveSupportedDisplayMode(preferred, availableModes)\n}\n"],"mappings":";;;;;;;;;;AAaA,MAAa,kCAAkC;CAC9C;CACA;CACA;CACA;;;;;;;;;AAuBD,SAAgB,cACf,OAC2B;AAC3B,QAAO,UAAU,YAAY,UAAU,gBAAgB,UAAU;;;;;;;;;;;;;;;;;AAkBlE,SAAgB,sBAAsB,MAA4C;AACjF,QAAO,SAAS,YAAY,SAAS;;;;;;;;;;;;;;;AAgBtC,SAAgB,4BACf,WACA,iBAA6C,iCAC3B;AAClB,KAAI,eAAe,WAAW,EAC7B,QAAO;AAGR,KAAI,eAAe,SAAS,UAAU,CACrC,QAAO;AAGR,SAAQ,MAAM,wBAAwB,UAAU,4BAA4B,eAAe,KAAK,KAAK,CAAC,YAAY,eAAe,GAAG,GAAG;AACvI,QAAO,eAAe;;;;;;;;;;;;;;;;;;AAmBvB,SAAgB,yBAAyB,SAIrB;CACnB,MAAM,iBAAiB,QAAQ,kBAAkB;AAOjD,QAAO,4BAN4B,QAAQ,OACxC,QAAQ,mBACP,eACA,WACD,OAE2C,eAAe"}
|