@mcp-b/char 0.1.2 → 0.1.4
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/LICENSE +23 -0
- package/README.md +11 -13
- package/dist/custom-elements.json +491 -141
- package/dist/display-mode-policy.d.ts.map +1 -1
- package/dist/index.d.ts +89 -114
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +702 -279
- package/dist/index.js.map +1 -1
- package/dist/shell-component.d.ts +79 -86
- package/dist/shell-component.d.ts.map +1 -1
- package/dist/shell-component.js +692 -279
- package/dist/shell-component.js.map +1 -1
- package/dist/shell-standalone.iife.js +2928 -0
- package/dist/shell-standalone.iife.js.map +1 -0
- package/dist/utils.d.ts +0 -13
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -2
- package/dist/utils.js.map +1 -1
- package/dist/web-component-standalone.iife.js +28 -87
- package/dist/web-component-standalone.iife.js.map +1 -1
- package/dist/web-component.d.ts +20 -83
- package/dist/web-component.d.ts.map +1 -1
- package/dist/web-component.js +28 -87
- package/dist/web-component.js.map +1 -1
- package/package.json +13 -13
|
@@ -1,52 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/types.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* Server-issued ticket auth payload.
|
|
5
|
-
* Used for SSR-friendly authentication flows.
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
interface TicketAuth {
|
|
10
|
-
/** Short-lived server-issued ticket used to start an authenticated session. */
|
|
11
|
-
ticket: string;
|
|
12
|
-
/** End-user identifier associated with the issued ticket. */
|
|
13
|
-
userId: string;
|
|
14
|
-
/** Organization identifier used to scope the authenticated session. */
|
|
15
|
-
orgId: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Development-only embed controls used by local host integrations.
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
interface DevModeConfig {
|
|
23
|
-
anthropicApiKey?: string;
|
|
24
|
-
openaiApiKey?: string;
|
|
25
|
-
useLocalApi?: boolean;
|
|
26
|
-
}
|
|
27
3
|
/**
|
|
28
4
|
* Connection options for the imperative connect() method.
|
|
29
5
|
*
|
|
30
|
-
*
|
|
31
|
-
* - `
|
|
32
|
-
* - `
|
|
33
|
-
*
|
|
34
|
-
* Exactly one strategy must be provided. The discriminated union prevents
|
|
35
|
-
* combining `idToken` and `ticketAuth` at the type level.
|
|
6
|
+
* Publishable-key auth:
|
|
7
|
+
* - `publishableKey` is required and identifies the organization
|
|
8
|
+
* - `idToken` is optional and enables per-user identity
|
|
36
9
|
*
|
|
37
10
|
* @public
|
|
38
11
|
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
/** Pre-fetched ticket for SSR-friendly authentication. */ticketAuth: TicketAuth; /** Must not be provided when using `ticketAuth` authentication. */
|
|
46
|
-
idToken?: never; /** Must not be provided when using `ticketAuth` authentication. */
|
|
47
|
-
clientId?: never; /** Must not be provided when using `ticketAuth` authentication. */
|
|
48
|
-
organizationId?: never;
|
|
49
|
-
};
|
|
12
|
+
interface ConnectOptions {
|
|
13
|
+
/** Publishable key for org identification. */
|
|
14
|
+
publishableKey: string;
|
|
15
|
+
/** Optional IDP token for per-user identity. */
|
|
16
|
+
idToken?: string;
|
|
17
|
+
}
|
|
50
18
|
/**
|
|
51
19
|
* Host visual theme hint.
|
|
52
20
|
*
|
|
@@ -106,17 +74,6 @@ interface CharSafeAreaInsets {
|
|
|
106
74
|
bottom?: number;
|
|
107
75
|
left?: number;
|
|
108
76
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Host shell capability flags advertised to the iframe runtime.
|
|
111
|
-
*
|
|
112
|
-
* @public
|
|
113
|
-
*/
|
|
114
|
-
interface CharHostCapabilities {
|
|
115
|
-
supportedDisplayModes?: CharDisplayMode[];
|
|
116
|
-
supportsOpenLink?: boolean;
|
|
117
|
-
supportsTeardown?: boolean;
|
|
118
|
-
maxContainerWidth?: number;
|
|
119
|
-
}
|
|
120
77
|
/**
|
|
121
78
|
* Host context payload sent from the embedding page to the iframe runtime.
|
|
122
79
|
*
|
|
@@ -133,8 +90,6 @@ interface CharHostContext {
|
|
|
133
90
|
platform?: CharPlatform;
|
|
134
91
|
deviceCapabilities?: CharDeviceCapabilities;
|
|
135
92
|
safeAreaInsets?: CharSafeAreaInsets;
|
|
136
|
-
userAgent?: string;
|
|
137
|
-
hostCapabilities?: CharHostCapabilities;
|
|
138
93
|
}
|
|
139
94
|
//#endregion
|
|
140
95
|
//#region src/shell-component.d.ts
|
|
@@ -169,18 +124,26 @@ interface CharShellOpenChangeDetail {
|
|
|
169
124
|
*/
|
|
170
125
|
declare class CharAgentShellElement extends HTMLElement {
|
|
171
126
|
static observedAttributes: string[];
|
|
172
|
-
devMode?: DevModeConfig;
|
|
173
127
|
apiBase?: string;
|
|
174
128
|
private _agent;
|
|
175
129
|
private _open;
|
|
176
|
-
private
|
|
177
|
-
private
|
|
178
|
-
private
|
|
179
|
-
private
|
|
180
|
-
private
|
|
130
|
+
private _savedBodyTransition;
|
|
131
|
+
private _bodyMarginTimeoutId;
|
|
132
|
+
private _currentPanelWidth;
|
|
133
|
+
private _resizeNubElement;
|
|
134
|
+
private _edgeTabElement;
|
|
135
|
+
private _resizeDragging;
|
|
136
|
+
private _resizeDragOverlay;
|
|
137
|
+
private _resizeStartX;
|
|
138
|
+
private _resizeStartWidth;
|
|
139
|
+
private _edgeTabDragStartX;
|
|
140
|
+
private _edgeTabDragging;
|
|
181
141
|
private _isNarrowViewport;
|
|
182
142
|
private _mediaQuery;
|
|
183
143
|
private _mediaQueryHandler;
|
|
144
|
+
private _themeObserver;
|
|
145
|
+
private _themeMediaQuery;
|
|
146
|
+
private _themeMediaHandler;
|
|
184
147
|
private _pendingConnectOptions;
|
|
185
148
|
private _pendingHostContext;
|
|
186
149
|
private _isApplyingOpenAttribute;
|
|
@@ -198,6 +161,7 @@ declare class CharAgentShellElement extends HTMLElement {
|
|
|
198
161
|
private _pipAnimationTimeoutId;
|
|
199
162
|
private _pendingPipMeasuredHeight;
|
|
200
163
|
private _tapOutsideListener;
|
|
164
|
+
private _lastAppliedDisplayMode;
|
|
201
165
|
private _pipHiddenByScroll;
|
|
202
166
|
private _scrollListener;
|
|
203
167
|
private _scrollRafId;
|
|
@@ -213,23 +177,13 @@ declare class CharAgentShellElement extends HTMLElement {
|
|
|
213
177
|
private _wheelDelta;
|
|
214
178
|
get open(): boolean;
|
|
215
179
|
set open(value: boolean);
|
|
216
|
-
get fullscreenBreakpoint(): number;
|
|
217
|
-
set fullscreenBreakpoint(value: number);
|
|
218
|
-
get panelWidth(): number;
|
|
219
|
-
set panelWidth(value: number);
|
|
220
|
-
get pipWidth(): number;
|
|
221
|
-
set pipWidth(value: number);
|
|
222
|
-
get pipHeight(): number;
|
|
223
|
-
set pipHeight(value: number);
|
|
224
|
-
get pipPosition(): CharPipPosition;
|
|
225
|
-
set pipPosition(value: CharPipPosition);
|
|
226
180
|
connectedCallback(): void;
|
|
227
181
|
disconnectedCallback(): void;
|
|
228
182
|
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
229
183
|
/**
|
|
230
184
|
* Connects shell authentication and starts availability health checks.
|
|
231
185
|
*
|
|
232
|
-
* @param options - Authentication payload
|
|
186
|
+
* @param options - Authentication payload (`publishableKey` + optional `idToken`).
|
|
233
187
|
* @returns `true` when connect is accepted by the inner element.
|
|
234
188
|
*/
|
|
235
189
|
connect(options: ConnectOptions): boolean;
|
|
@@ -274,7 +228,60 @@ declare class CharAgentShellElement extends HTMLElement {
|
|
|
274
228
|
private _setupViewportObserver;
|
|
275
229
|
private _teardownViewportObserver;
|
|
276
230
|
private _applyDisplayModeAndLayout;
|
|
231
|
+
private _isParentFlex;
|
|
232
|
+
private _isDarkMode;
|
|
233
|
+
/**
|
|
234
|
+
* Read a `--char-color-*` variable from the shell element. If the host
|
|
235
|
+
* page has set it (directly or via inheritance) use that value; otherwise
|
|
236
|
+
* fall back to the char design-system default for the current light/dark mode.
|
|
237
|
+
*/
|
|
238
|
+
private _resolveColor;
|
|
239
|
+
private _panelBorder;
|
|
240
|
+
private _setupThemeObserver;
|
|
241
|
+
private _teardownThemeObserver;
|
|
277
242
|
private _applyHostLayout;
|
|
243
|
+
private _applyBodyMargin;
|
|
244
|
+
private _removeBodyMargin;
|
|
245
|
+
private _ensureResizeNub;
|
|
246
|
+
private _applyResizeNubColors;
|
|
247
|
+
private _refreshResizeNubColors;
|
|
248
|
+
private _showResizeNub;
|
|
249
|
+
private _hideResizeNub;
|
|
250
|
+
private _ensureEdgeTab;
|
|
251
|
+
/** Apply visual style (colors, shadow) based on open state — no position change. */
|
|
252
|
+
private _applyEdgeTabVisual;
|
|
253
|
+
/** Set the tab's `right` position immediately (no transition). */
|
|
254
|
+
private _positionEdgeTab;
|
|
255
|
+
private _showEdgeTab;
|
|
256
|
+
private _hideEdgeTab;
|
|
257
|
+
private _removeEdgeTab;
|
|
258
|
+
private _onEdgeTabMouseDown;
|
|
259
|
+
private _onEdgeTabTouchStart;
|
|
260
|
+
private _onEdgeTabMouseMove;
|
|
261
|
+
private _onEdgeTabTouchMove;
|
|
262
|
+
private _onEdgeTabMouseUp;
|
|
263
|
+
private _onEdgeTabTouchEnd;
|
|
264
|
+
/**
|
|
265
|
+
* Once the edge tab drag crosses the threshold, hand off to the existing
|
|
266
|
+
* resize machinery so the panel tracks the pointer smoothly.
|
|
267
|
+
*/
|
|
268
|
+
private _promoteEdgeTabDragToResize;
|
|
269
|
+
/**
|
|
270
|
+
* Run a rAF loop that reads the shell element's actual rendered width
|
|
271
|
+
* and pins the edge tab to it. Used during flex layout transitions so
|
|
272
|
+
* the tab tracks the animated flex-basis exactly, frame by frame.
|
|
273
|
+
*/
|
|
274
|
+
private _syncEdgeTabWithPanelTransition;
|
|
275
|
+
private _showResizeDragOverlay;
|
|
276
|
+
private _removeResizeDragOverlay;
|
|
277
|
+
private _onResizeStart;
|
|
278
|
+
private _onResizeTouchStart;
|
|
279
|
+
private _onResizeMove;
|
|
280
|
+
private _onResizeTouchMove;
|
|
281
|
+
private _applyResizeWidth;
|
|
282
|
+
private _onResizeEnd;
|
|
283
|
+
private _onResizeTouchEnd;
|
|
284
|
+
private _finishResize;
|
|
278
285
|
private _composePipTransform;
|
|
279
286
|
private _applyAgentLayout;
|
|
280
287
|
private _ensurePipPill;
|
|
@@ -337,13 +344,6 @@ declare global {
|
|
|
337
344
|
interface IntrinsicElements {
|
|
338
345
|
'char-agent-shell': {
|
|
339
346
|
open?: boolean;
|
|
340
|
-
'fullscreen-breakpoint'?: number;
|
|
341
|
-
'panel-width'?: number;
|
|
342
|
-
'pip-position'?: CharPipPosition;
|
|
343
|
-
'pip-width'?: number;
|
|
344
|
-
'pip-height'?: number;
|
|
345
|
-
'dev-mode'?: string;
|
|
346
|
-
devMode?: DevModeConfig;
|
|
347
347
|
'api-base'?: string;
|
|
348
348
|
apiBase?: string;
|
|
349
349
|
'enable-debug-tools'?: boolean;
|
|
@@ -358,13 +358,6 @@ declare module 'react/jsx-runtime' {
|
|
|
358
358
|
interface IntrinsicElements {
|
|
359
359
|
'char-agent-shell': {
|
|
360
360
|
open?: boolean;
|
|
361
|
-
'fullscreen-breakpoint'?: number;
|
|
362
|
-
'panel-width'?: number;
|
|
363
|
-
'pip-position'?: CharPipPosition;
|
|
364
|
-
'pip-width'?: number;
|
|
365
|
-
'pip-height'?: number;
|
|
366
|
-
'dev-mode'?: string;
|
|
367
|
-
devMode?: DevModeConfig;
|
|
368
361
|
'api-base'?: string;
|
|
369
362
|
apiBase?: string;
|
|
370
363
|
'enable-debug-tools'?: boolean;
|
|
@@ -375,5 +368,5 @@ declare module 'react/jsx-runtime' {
|
|
|
375
368
|
}
|
|
376
369
|
} //# sourceMappingURL=shell-component.d.ts.map
|
|
377
370
|
//#endregion
|
|
378
|
-
export { CharAgentShellElement, type CharContainerDimensions, type CharDeviceCapabilities, type CharDisplayMode, type
|
|
371
|
+
export { CharAgentShellElement, type CharContainerDimensions, type CharDeviceCapabilities, type CharDisplayMode, type CharHostContext, type CharHostStyles, CharPipPosition, type CharPlatform, type CharSafeAreaInsets, CharShellOpenChangeDetail, type CharTheme, type ConnectOptions, registerCharShell };
|
|
379
372
|
//# sourceMappingURL=shell-component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-component.d.ts","names":[],"sources":["../src/types.ts","../src/shell-component.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shell-component.d.ts","names":[],"sources":["../src/types.ts","../src/shell-component.ts"],"mappings":";;;AASA;;;;;AAYA;;;UAZiB,cAAA;EAYI;EAVpB,cAAA;EAiB0B;EAf1B,OAAA;AAAA;;AAsBD;;;;KAdY,SAAA;AAqBZ;;;;;AAAA,KAdY,eAAA;;;;AAwBZ;;KAjBY,YAAA;;;;;;UAOK,cAAA;EAChB,SAAA,GAAY,MAAA;EACZ,KAAA;AAAA;;;;;;UAQgB,uBAAA;EAChB,KAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;AAAA;;;;;;UAQgB,sBAAA;EAChB,KAAA;EACA,KAAA;EACA,WAAA;AAAA;;;;;;UAQgB,kBAAA;EAChB,GAAA;EACA,KAAA;EACA,MAAA;EACA,IAAA;AAAA;;;;;;UAQgB,eAAA;EAChB,KAAA,GAAQ,SAAA;EACR,MAAA,GAAS,cAAA;EACT,WAAA,GAAc,eAAA;EACd,qBAAA,GAAwB,eAAA;EACxB,mBAAA,GAAsB,uBAAA;EACtB,MAAA;EACA,QAAA;EACA,QAAA,GAAW,YAAA;EACX,kBAAA,GAAqB,sBAAA;EACrB,cAAA,GAAiB,kBAAA;AAAA;;;AAxFlB;;;;;AAAA,KCiEY,eAAA;;;;;AD9CZ;UCqDiB,yBAAA;EAChB,IAAA;AAAA;AD/CD;;;;;AAOA;;;;;;;;;AAUA;AAjBA,cCkIa,qBAAA,S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