@coxwave/tap-kit-types 2.0.4 → 2.0.6
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/index.d.ts +323 -95
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import * as CSS from 'csstype';
|
|
|
2
2
|
import { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Alarm display duration (
|
|
6
|
-
*
|
|
5
|
+
* Alarm display duration (16 seconds total)
|
|
6
|
+
* 12초 유지 + 4초 fade out = 16초 total
|
|
7
7
|
*/
|
|
8
|
-
declare const ALARM_DURATION =
|
|
8
|
+
declare const ALARM_DURATION = 16000;
|
|
9
9
|
/**
|
|
10
10
|
* Base style type for all elements
|
|
11
11
|
* Uses csstype for accurate CSS property types
|
|
@@ -85,15 +85,101 @@ type AlarmType = "basic:welcome" | "basic:default" | "feat:quiz" | "feat:guide"
|
|
|
85
85
|
* Complete alarm message definition
|
|
86
86
|
* UI is fully defined via JSON Component Descriptor
|
|
87
87
|
* Click behavior is simple: open chat + send message (if provided in content.payload)
|
|
88
|
-
* Duration is always
|
|
88
|
+
* Duration is always 16 seconds (12s visible + 4s fade, handled in useAlarmEffects)
|
|
89
89
|
*/
|
|
90
90
|
interface AlarmMessageInstanceType {
|
|
91
91
|
type: AlarmType;
|
|
92
92
|
content: AlarmElement;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Styling Types
|
|
97
|
+
*/
|
|
98
|
+
/**
|
|
99
|
+
* Display mode for TapKit container (user-facing configuration)
|
|
100
|
+
*
|
|
101
|
+
* - "inline": Embedded at element position
|
|
102
|
+
* - "floating": Compact widget floating in document.body
|
|
103
|
+
* - "sidebar": Full-height sidebar in document.body
|
|
104
|
+
*/
|
|
105
|
+
type DisplayMode = "inline" | "floating" | "sidebar";
|
|
106
|
+
/**
|
|
107
|
+
* Layout mode for runtime layout switching
|
|
108
|
+
*
|
|
109
|
+
* Excludes "inline" because inline mode doesn't participate in layout toggling.
|
|
110
|
+
* Used by ContainerStateStore, localStorage persistence, and layout manager.
|
|
111
|
+
*/
|
|
112
|
+
type LayoutMode = "floating" | "sidebar";
|
|
113
|
+
type PositionType = {
|
|
114
|
+
top?: string;
|
|
115
|
+
left?: string;
|
|
116
|
+
right?: string;
|
|
117
|
+
bottom?: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Floating mode configuration
|
|
121
|
+
* Includes position, size, and style settings for floating container
|
|
122
|
+
*/
|
|
123
|
+
type FloatingConfig = {
|
|
124
|
+
/** Position (default: top: "50px", right: "24px") */
|
|
125
|
+
position?: PositionType;
|
|
126
|
+
/** Width (default: "340px") */
|
|
127
|
+
width?: string;
|
|
128
|
+
/** Height (default: "calc(100% - 116px)") */
|
|
129
|
+
height?: string;
|
|
130
|
+
/** Border radius (default: "16px") */
|
|
131
|
+
borderRadius?: string;
|
|
132
|
+
/** Expanded width for PDF viewer (default: "min(90vw, 1200px)") */
|
|
133
|
+
expandedWidth?: string;
|
|
134
|
+
/** Expanded height for PDF viewer (default: "90vh") */
|
|
135
|
+
expandedHeight?: string;
|
|
136
|
+
/** Expanded top position for PDF viewer (default: "5vh") */
|
|
137
|
+
expandedTop?: string;
|
|
138
|
+
/** Expanded right position for PDF viewer (default: "5vw") */
|
|
139
|
+
expandedRight?: string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Sidebar Configuration
|
|
143
|
+
*/
|
|
144
|
+
type SidebarConfig = {
|
|
145
|
+
/** Maximum width of the sidebar (default: "min(50%, 1000px)") */
|
|
146
|
+
maxWidth?: string;
|
|
147
|
+
/** Expanded maximum width for PDF viewer (default: "min(70%, 1400px)") */
|
|
148
|
+
expandedMaxWidth?: string;
|
|
149
|
+
/** Minimum viewport width to enable sidebar mode (default: 768) */
|
|
150
|
+
minViewportWidth?: number;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Container Configuration (SSOT - Type Level)
|
|
154
|
+
*
|
|
155
|
+
* This is the SINGLE SOURCE OF TRUTH for container configuration at the TYPE level.
|
|
156
|
+
* - Public API: TapKitInitParams.container
|
|
157
|
+
* - Internal: Container class configuration
|
|
158
|
+
* - Protocol: ConfigUpdateMessage.container mirrors this structure
|
|
159
|
+
*
|
|
160
|
+
* When modifying this type, also update ConfigUpdateMessage.container in @coxwave/tap-messages
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* // Custom styling for floating/sidebar modes
|
|
164
|
+
* const config: ContainerConfig = {
|
|
165
|
+
* floatingConfig: { width: "400px", position: { top: "80px" } },
|
|
166
|
+
* sidebarConfig: { maxWidth: "800px" }
|
|
167
|
+
* }
|
|
168
|
+
*/
|
|
169
|
+
type ContainerConfig = {
|
|
170
|
+
/**
|
|
171
|
+
* Display mode
|
|
172
|
+
* @see DisplayMode
|
|
173
|
+
*/
|
|
174
|
+
mode?: DisplayMode;
|
|
175
|
+
/** Floating layout configuration (applied when SDK auto-creates container in floating layout) */
|
|
176
|
+
floatingConfig?: FloatingConfig;
|
|
177
|
+
/** Sidebar layout configuration (applied when SDK auto-creates container in sidebar layout) */
|
|
178
|
+
sidebarConfig?: SidebarConfig;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
type TapMessageType = "tap:ready" | "tap:close" | "timeline:seek" | "alarm:click" | "alarm:fadeIn" | "popUp:open" | "popUp:close" | "material:view:open" | "material:view:close" | "material:view:error" | "html:view:open" | "html:view:close" | "container:mode:change" | "container:mode:change:ack" | "container:layout:state:changed" | "viewport:resize" | "config:update" | "GA_EVENT";
|
|
182
|
+
type TapMessage = TapReadyMessage | TapCloseMessage | TimelineSeekMessage | AlarmClickMessage | AlarmFadeInMessage | PopUpOpenMessage | PopUpCloseMessage | MaterialViewOpenMessage | MaterialViewCloseMessage | MaterialViewErrorMessage | HtmlViewOpenMessage | HtmlViewCloseMessage | ContainerModeChangeMessage | ContainerModeChangeAckMessage | ContainerLayoutStateChangedMessage | ViewportResizeMessage | ConfigUpdateMessage | GAEventMessage;
|
|
97
183
|
interface TapReadyMessage {
|
|
98
184
|
type: "tap:ready";
|
|
99
185
|
gaId: string;
|
|
@@ -155,6 +241,30 @@ interface MaterialViewErrorMessage {
|
|
|
155
241
|
error: "fetch_failed" | "expired_url" | "extraction_failed" | "unknown";
|
|
156
242
|
message?: string;
|
|
157
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* HTML View Open Request (iframe → parent, simple post pattern)
|
|
246
|
+
* Requests parent to open HTML viewer overlay
|
|
247
|
+
*
|
|
248
|
+
* Supports two content sources:
|
|
249
|
+
* - htmlUrl: Load HTML from URL (iframe src)
|
|
250
|
+
* - htmlContent: Render HTML string directly (iframe srcdoc)
|
|
251
|
+
*/
|
|
252
|
+
interface HtmlViewOpenMessage {
|
|
253
|
+
type: "html:view:open";
|
|
254
|
+
/** URL to load HTML content from */
|
|
255
|
+
htmlUrl?: string;
|
|
256
|
+
/** HTML string to render directly */
|
|
257
|
+
htmlContent?: string;
|
|
258
|
+
/** Optional title for the viewer header */
|
|
259
|
+
title?: string;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* HTML View Close Request (iframe → parent, simple post pattern)
|
|
263
|
+
* Requests parent to close HTML viewer overlay
|
|
264
|
+
*/
|
|
265
|
+
interface HtmlViewCloseMessage {
|
|
266
|
+
type: "html:view:close";
|
|
267
|
+
}
|
|
158
268
|
/**
|
|
159
269
|
* Container Mode Change Request (iframe → parent, call/handle pattern)
|
|
160
270
|
*
|
|
@@ -226,14 +336,7 @@ interface ConfigUpdateMessage {
|
|
|
226
336
|
courseId?: string;
|
|
227
337
|
clipId?: string;
|
|
228
338
|
clipPlayHead?: number;
|
|
229
|
-
|
|
230
|
-
* Display mode
|
|
231
|
-
* - "inline": Container rendered at <tap-kit> position (embedded in page)
|
|
232
|
-
* - "floating": Container floats in document.body as compact widget
|
|
233
|
-
* - "sidebar": Container floats in document.body as full-height sidebar
|
|
234
|
-
* Default: "inline"
|
|
235
|
-
*/
|
|
236
|
-
mode?: "inline" | "floating" | "sidebar";
|
|
339
|
+
mode?: DisplayMode;
|
|
237
340
|
/**
|
|
238
341
|
* Allow user to toggle between floating and sidebar layouts
|
|
239
342
|
* @default true
|
|
@@ -2038,6 +2141,15 @@ declare const MaterialViewErrorSchema: ObjectSchema<{
|
|
|
2038
2141
|
readonly error: UnionSchema<[LiteralSchema<"fetch_failed", undefined>, LiteralSchema<"expired_url", undefined>, LiteralSchema<"extraction_failed", undefined>, LiteralSchema<"unknown", undefined>], undefined>;
|
|
2039
2142
|
readonly message: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
2040
2143
|
}, undefined>;
|
|
2144
|
+
declare const HtmlViewOpenSchema: ObjectSchema<{
|
|
2145
|
+
readonly type: LiteralSchema<"html:view:open", undefined>;
|
|
2146
|
+
readonly htmlUrl: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
2147
|
+
readonly htmlContent: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
2148
|
+
readonly title: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
2149
|
+
}, undefined>;
|
|
2150
|
+
declare const HtmlViewCloseSchema: ObjectSchema<{
|
|
2151
|
+
readonly type: LiteralSchema<"html:view:close", undefined>;
|
|
2152
|
+
}, undefined>;
|
|
2041
2153
|
declare const ContainerModeChangeSchema: ObjectSchema<{
|
|
2042
2154
|
readonly type: LiteralSchema<"container:mode:change", undefined>;
|
|
2043
2155
|
readonly mode: UnionSchema<[LiteralSchema<"floating", undefined>, LiteralSchema<"sidebar", undefined>], undefined>;
|
|
@@ -2137,6 +2249,13 @@ declare const TapMessageSchema: UnionSchema<[ObjectSchema<{
|
|
|
2137
2249
|
readonly materialId: StringSchema<undefined>;
|
|
2138
2250
|
readonly error: UnionSchema<[LiteralSchema<"fetch_failed", undefined>, LiteralSchema<"expired_url", undefined>, LiteralSchema<"extraction_failed", undefined>, LiteralSchema<"unknown", undefined>], undefined>;
|
|
2139
2251
|
readonly message: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
2252
|
+
}, undefined>, ObjectSchema<{
|
|
2253
|
+
readonly type: LiteralSchema<"html:view:open", undefined>;
|
|
2254
|
+
readonly htmlUrl: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
2255
|
+
readonly htmlContent: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
2256
|
+
readonly title: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
2257
|
+
}, undefined>, ObjectSchema<{
|
|
2258
|
+
readonly type: LiteralSchema<"html:view:close", undefined>;
|
|
2140
2259
|
}, undefined>, ObjectSchema<{
|
|
2141
2260
|
readonly type: LiteralSchema<"container:mode:change", undefined>;
|
|
2142
2261
|
readonly mode: UnionSchema<[LiteralSchema<"floating", undefined>, LiteralSchema<"sidebar", undefined>], undefined>;
|
|
@@ -2481,16 +2600,19 @@ interface VideoPlayerAdapter {
|
|
|
2481
2600
|
*
|
|
2482
2601
|
* @example
|
|
2483
2602
|
* ```typescript
|
|
2484
|
-
* // HTML5 Video
|
|
2603
|
+
* // HTML5 Video (recommended - clipId auto-tracked)
|
|
2485
2604
|
* const videoElement = document.querySelector('video');
|
|
2486
|
-
* sdk.video.bind(videoElement,
|
|
2605
|
+
* sdk.video.bind(videoElement); // clipId from SDK config, auto-updates with setCourse()
|
|
2487
2606
|
*
|
|
2488
2607
|
* // Custom Adapter
|
|
2489
2608
|
* const adapter = {
|
|
2490
2609
|
* getCurrentTime: () => player.currentTime,
|
|
2491
2610
|
* setCurrentTime: (time) => { player.currentTime = time; }
|
|
2492
2611
|
* };
|
|
2493
|
-
* sdk.video.bind(adapter
|
|
2612
|
+
* sdk.video.bind(adapter);
|
|
2613
|
+
*
|
|
2614
|
+
* // Manual clipId (for special cases)
|
|
2615
|
+
* sdk.video.bind(videoElement, 'specific-clip-id');
|
|
2494
2616
|
* ```
|
|
2495
2617
|
*/
|
|
2496
2618
|
type VideoPlayerConfig = HTMLVideoElement | VideoPlayerAdapter;
|
|
@@ -2523,87 +2645,17 @@ interface TapKitInstance {
|
|
|
2523
2645
|
/** Hide chat container */
|
|
2524
2646
|
hide(): void;
|
|
2525
2647
|
/**
|
|
2526
|
-
*
|
|
2527
|
-
*
|
|
2528
|
-
* Accepts any config key-value pairs for advanced configuration.
|
|
2529
|
-
* Type is intentionally generic to hide implementation details.
|
|
2530
|
-
*
|
|
2531
|
-
* @deprecated Use public APIs instead. This is kept for backward compatibility.
|
|
2532
|
-
* Prefer using Symbol API via Symbol.for("tapkit.config") for advanced config.
|
|
2533
|
-
*
|
|
2534
|
-
* @internal Soft-private method (starts with _)
|
|
2648
|
+
* Update course information
|
|
2649
|
+
* @param course - Course info (courseId and clipId required, userId and clipPlayHead optional)
|
|
2535
2650
|
*/
|
|
2536
|
-
|
|
2651
|
+
setCourse(course: Partial<Course> & {
|
|
2652
|
+
courseId: string;
|
|
2653
|
+
clipId: string;
|
|
2654
|
+
}): void;
|
|
2537
2655
|
}
|
|
2538
2656
|
/** TapKit constructor type */
|
|
2539
2657
|
type TapKitConstructor = new (config: TapKitConfig) => TapKitInstance;
|
|
2540
2658
|
|
|
2541
|
-
/**
|
|
2542
|
-
* Styling Types
|
|
2543
|
-
*/
|
|
2544
|
-
type PositionType = {
|
|
2545
|
-
top?: string;
|
|
2546
|
-
left?: string;
|
|
2547
|
-
right?: string;
|
|
2548
|
-
bottom?: string;
|
|
2549
|
-
};
|
|
2550
|
-
/**
|
|
2551
|
-
* Floating mode configuration
|
|
2552
|
-
* Includes position, size, and style settings for floating container
|
|
2553
|
-
*/
|
|
2554
|
-
type FloatingConfig = {
|
|
2555
|
-
/** Position (default: top: "50px", right: "24px") */
|
|
2556
|
-
position?: PositionType;
|
|
2557
|
-
/** Width (default: "340px") */
|
|
2558
|
-
width?: string;
|
|
2559
|
-
/** Height (default: "calc(100% - 116px)") */
|
|
2560
|
-
height?: string;
|
|
2561
|
-
/** Border radius (default: "16px") */
|
|
2562
|
-
borderRadius?: string;
|
|
2563
|
-
/** Expanded width for PDF viewer (default: "min(90vw, 1200px)") */
|
|
2564
|
-
expandedWidth?: string;
|
|
2565
|
-
/** Expanded height for PDF viewer (default: "90vh") */
|
|
2566
|
-
expandedHeight?: string;
|
|
2567
|
-
/** Expanded top position for PDF viewer (default: "5vh") */
|
|
2568
|
-
expandedTop?: string;
|
|
2569
|
-
/** Expanded right position for PDF viewer (default: "5vw") */
|
|
2570
|
-
expandedRight?: string;
|
|
2571
|
-
};
|
|
2572
|
-
/**
|
|
2573
|
-
* Sidebar Configuration
|
|
2574
|
-
*/
|
|
2575
|
-
type SidebarConfig = {
|
|
2576
|
-
/** Maximum width of the sidebar (default: "min(50%, 1000px)") */
|
|
2577
|
-
maxWidth?: string;
|
|
2578
|
-
/** Expanded maximum width for PDF viewer (default: "min(70%, 1400px)") */
|
|
2579
|
-
expandedMaxWidth?: string;
|
|
2580
|
-
/** Minimum viewport width to enable sidebar mode (default: 768) */
|
|
2581
|
-
minViewportWidth?: number;
|
|
2582
|
-
};
|
|
2583
|
-
/**
|
|
2584
|
-
* Container Configuration (SSOT - Type Level)
|
|
2585
|
-
*
|
|
2586
|
-
* This is the SINGLE SOURCE OF TRUTH for container configuration at the TYPE level.
|
|
2587
|
-
* - Public API: TapKitInitParams.container
|
|
2588
|
-
* - Internal: Container class configuration
|
|
2589
|
-
* - Protocol: ConfigUpdateMessage.container mirrors this structure
|
|
2590
|
-
*
|
|
2591
|
-
* When modifying this type, also update ConfigUpdateMessage.container in @coxwave/tap-messages
|
|
2592
|
-
*
|
|
2593
|
-
* @example
|
|
2594
|
-
* // Custom styling for floating/sidebar modes
|
|
2595
|
-
* const config: ContainerConfig = {
|
|
2596
|
-
* floatingConfig: { width: "400px", position: { top: "80px" } },
|
|
2597
|
-
* sidebarConfig: { maxWidth: "800px" }
|
|
2598
|
-
* }
|
|
2599
|
-
*/
|
|
2600
|
-
type ContainerConfig = {
|
|
2601
|
-
/** Floating layout configuration (applied when SDK auto-creates container in floating layout) */
|
|
2602
|
-
floatingConfig?: FloatingConfig;
|
|
2603
|
-
/** Sidebar layout configuration (applied when SDK auto-creates container in sidebar layout) */
|
|
2604
|
-
sidebarConfig?: SidebarConfig;
|
|
2605
|
-
};
|
|
2606
|
-
|
|
2607
2659
|
/**
|
|
2608
2660
|
* Type declarations for <tap-button> Web Component
|
|
2609
2661
|
*
|
|
@@ -2904,6 +2956,167 @@ interface TapContainerAttributes {
|
|
|
2904
2956
|
onDestroy?: () => void;
|
|
2905
2957
|
}
|
|
2906
2958
|
|
|
2959
|
+
/**
|
|
2960
|
+
* Type declarations for <tap-html-viewer> Web Component
|
|
2961
|
+
*
|
|
2962
|
+
* Provides TypeScript support for using <tap-html-viewer> in JSX/TSX.
|
|
2963
|
+
* The actual Web Component is registered by tap-kit-core when loaded.
|
|
2964
|
+
*/
|
|
2965
|
+
|
|
2966
|
+
|
|
2967
|
+
|
|
2968
|
+
// React 19 requires module augmentation based on tsconfig jsx setting
|
|
2969
|
+
// - "jsx": "react-jsx" → augment "react/jsx-runtime"
|
|
2970
|
+
// - "jsx": "preserve" → augment "react" (Next.js default)
|
|
2971
|
+
|
|
2972
|
+
// For Next.js (jsx: preserve)
|
|
2973
|
+
declare module "react" {
|
|
2974
|
+
namespace JSX {
|
|
2975
|
+
interface IntrinsicElements {
|
|
2976
|
+
"tap-html-viewer": TapHtmlViewerAttributes;
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
// For CRA, Vite (jsx: react-jsx)
|
|
2982
|
+
declare module "react/jsx-runtime" {
|
|
2983
|
+
namespace JSX {
|
|
2984
|
+
interface IntrinsicElements {
|
|
2985
|
+
"tap-html-viewer": TapHtmlViewerAttributes;
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
/**
|
|
2991
|
+
* Configuration for opening HTML viewer
|
|
2992
|
+
*/
|
|
2993
|
+
interface HtmlViewConfig {
|
|
2994
|
+
/**
|
|
2995
|
+
* URL to load HTML content from (uses iframe src)
|
|
2996
|
+
*/
|
|
2997
|
+
htmlUrl?: string;
|
|
2998
|
+
|
|
2999
|
+
/**
|
|
3000
|
+
* HTML string to render directly (uses iframe srcdoc)
|
|
3001
|
+
*/
|
|
3002
|
+
htmlContent?: string;
|
|
3003
|
+
|
|
3004
|
+
/**
|
|
3005
|
+
* Optional title for the viewer header
|
|
3006
|
+
*/
|
|
3007
|
+
title?: string;
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
/**
|
|
3011
|
+
* Public API interface for TapHtmlViewerElement Web Component
|
|
3012
|
+
*
|
|
3013
|
+
* This interface defines the contract that tap-kit-core's TapHtmlViewerElement must implement.
|
|
3014
|
+
* It provides type-safe access to the Web Component's public API.
|
|
3015
|
+
*
|
|
3016
|
+
* The HTML viewer displays HTML content in a sandboxed iframe overlay
|
|
3017
|
+
* positioned relative to a container element.
|
|
3018
|
+
*/
|
|
3019
|
+
interface ITapHtmlViewerElement extends HTMLElement {
|
|
3020
|
+
/**
|
|
3021
|
+
* Container element reference for positioning
|
|
3022
|
+
* Must be set before calling open()
|
|
3023
|
+
*/
|
|
3024
|
+
containerElement: HTMLElement | null;
|
|
3025
|
+
|
|
3026
|
+
/**
|
|
3027
|
+
* Open HTML viewer with configuration
|
|
3028
|
+
*
|
|
3029
|
+
* Displays HTML content in a sandboxed iframe overlay.
|
|
3030
|
+
* Content source: htmlUrl (external) or htmlContent (inline).
|
|
3031
|
+
*
|
|
3032
|
+
* @param config - HTML view configuration
|
|
3033
|
+
* @fires open - When viewer is successfully displayed
|
|
3034
|
+
*/
|
|
3035
|
+
open(config: HtmlViewConfig): void;
|
|
3036
|
+
|
|
3037
|
+
/**
|
|
3038
|
+
* Close HTML viewer and cleanup
|
|
3039
|
+
*
|
|
3040
|
+
* Hides overlay and resets state.
|
|
3041
|
+
*
|
|
3042
|
+
* @fires close - When viewer is closed
|
|
3043
|
+
*/
|
|
3044
|
+
close(): void;
|
|
3045
|
+
|
|
3046
|
+
/**
|
|
3047
|
+
* Update overlay position relative to container
|
|
3048
|
+
*
|
|
3049
|
+
* Automatically called on container resize/move.
|
|
3050
|
+
* Can be manually triggered if needed.
|
|
3051
|
+
*/
|
|
3052
|
+
updatePosition(): void;
|
|
3053
|
+
|
|
3054
|
+
/**
|
|
3055
|
+
* Hide overlay without closing viewer
|
|
3056
|
+
*
|
|
3057
|
+
* Called when container is hidden. Preserves viewer state
|
|
3058
|
+
* so it can be shown again when container becomes visible.
|
|
3059
|
+
*/
|
|
3060
|
+
hideOverlay(): void;
|
|
3061
|
+
|
|
3062
|
+
/**
|
|
3063
|
+
* Show overlay (if viewer has content)
|
|
3064
|
+
*
|
|
3065
|
+
* Called when container is shown. Only displays overlay
|
|
3066
|
+
* if viewer has content loaded.
|
|
3067
|
+
*/
|
|
3068
|
+
showOverlay(): void;
|
|
3069
|
+
|
|
3070
|
+
/**
|
|
3071
|
+
* Check if viewer is currently visible
|
|
3072
|
+
*
|
|
3073
|
+
* @returns true if visible, false otherwise
|
|
3074
|
+
*/
|
|
3075
|
+
readonly isVisible: boolean;
|
|
3076
|
+
}
|
|
3077
|
+
|
|
3078
|
+
/**
|
|
3079
|
+
* Props/Attributes for <tap-html-viewer> Web Component
|
|
3080
|
+
*/
|
|
3081
|
+
interface TapHtmlViewerAttributes {
|
|
3082
|
+
/**
|
|
3083
|
+
* Element ID attribute
|
|
3084
|
+
*/
|
|
3085
|
+
id?: string;
|
|
3086
|
+
|
|
3087
|
+
/**
|
|
3088
|
+
* CSS class name(s)
|
|
3089
|
+
*/
|
|
3090
|
+
className?: string;
|
|
3091
|
+
|
|
3092
|
+
/**
|
|
3093
|
+
* Container element reference for positioning
|
|
3094
|
+
* Required before calling open()
|
|
3095
|
+
*/
|
|
3096
|
+
containerElement?: HTMLElement | null;
|
|
3097
|
+
|
|
3098
|
+
/**
|
|
3099
|
+
* Child content (not typically used for tap-html-viewer)
|
|
3100
|
+
* The component automatically creates overlay content
|
|
3101
|
+
*/
|
|
3102
|
+
children?: ReactNode;
|
|
3103
|
+
|
|
3104
|
+
/**
|
|
3105
|
+
* Custom inline styles
|
|
3106
|
+
*/
|
|
3107
|
+
style?: CSSProperties;
|
|
3108
|
+
|
|
3109
|
+
/**
|
|
3110
|
+
* Event handler for when viewer is successfully displayed
|
|
3111
|
+
*/
|
|
3112
|
+
onOpen?: () => void;
|
|
3113
|
+
|
|
3114
|
+
/**
|
|
3115
|
+
* Event handler for when viewer is closed
|
|
3116
|
+
*/
|
|
3117
|
+
onClose?: () => void;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
2907
3120
|
/**
|
|
2908
3121
|
* TapKit Web Component Type Definitions
|
|
2909
3122
|
*
|
|
@@ -2929,7 +3142,22 @@ interface EventManager {
|
|
|
2929
3142
|
* VideoController type (matches TapKitInstance.video)
|
|
2930
3143
|
*/
|
|
2931
3144
|
interface VideoController {
|
|
2932
|
-
|
|
3145
|
+
/**
|
|
3146
|
+
* Bind video player for timeline synchronization
|
|
3147
|
+
*
|
|
3148
|
+
* @param config - HTMLVideoElement or VideoPlayerAdapter
|
|
3149
|
+
* @param clipId - Optional clipId. If not provided, uses SDK config (auto-tracks changes from setCourse)
|
|
3150
|
+
*
|
|
3151
|
+
* @example
|
|
3152
|
+
* ```typescript
|
|
3153
|
+
* // Auto-tracking (recommended) - clipId syncs with setCourse()
|
|
3154
|
+
* kit.video.bind(videoElement);
|
|
3155
|
+
*
|
|
3156
|
+
* // Manual clipId (for special cases)
|
|
3157
|
+
* kit.video.bind(videoElement, 'specific-clip-id');
|
|
3158
|
+
* ```
|
|
3159
|
+
*/
|
|
3160
|
+
bind: (config: VideoPlayerConfig, clipId?: string) => void;
|
|
2933
3161
|
unbind: () => void;
|
|
2934
3162
|
}
|
|
2935
3163
|
|
|
@@ -3473,4 +3701,4 @@ declare global {
|
|
|
3473
3701
|
function cancelIdleCallback(handle: number): void;
|
|
3474
3702
|
}
|
|
3475
3703
|
|
|
3476
|
-
export { ALARM_DURATION, type AlarmClickMessage, AlarmClickSchema, type AlarmElement, type AlarmElementProps, AlarmElementPropsSchema, AlarmElementSchema, type AlarmFadeInMessage, AlarmFadeInSchema, AlarmMessageInstanceSchema, type AlarmMessageInstanceType, type AlarmPayload, type AlarmType, type CSSStyle, CSSStyleSchema, type ConfigUpdateMessage, ConfigUpdateSchema, type ContainerConfig, type ContainerLayoutStateChangedMessage, ContainerLayoutStateChangedSchema, type ContainerModeChangeAckMessage, ContainerModeChangeAckSchema, type ContainerModeChangeMessage, ContainerModeChangeSchema, type ContainerVisibility, type Course, type EventManager, type FloatingConfig, type GAEventMessage, GAEventSchema, type ITapButtonElement, type ITapContainerElement, type ITapKitElement, type ITapMaterialViewerElement, TapKitInitializationError as InitializationError, type MaterialViewCloseMessage, MaterialViewCloseSchema, type MaterialViewConfig, type MaterialViewErrorMessage, MaterialViewErrorSchema, type MaterialViewOpenMessage, MaterialViewOpenSchema, MaterialViewerError, type PopUpCloseMessage, PopUpCloseSchema, type PopUpOpenMessage, PopUpOpenSchema, type PositionType, type SeekTimelineParamsType, type ShortcutKeyPropertiesType, type SidebarConfig, TAP_BUTTON_CLICK_EVENT, TAP_ERROR_MARKER, type TapButtonAttributes, type TapButtonClickEventDetail, type TapCloseMessage, TapCloseSchema, type TapContainerAttributes, type TapErrorOptions, type TapKitConfig, type TapKitConfigOptions, TapKitConfigurationError, type TapKitConstructor, type TapKitElement, type TapKitElementEventMap, TapKitError, TapKitIframeError, type TapKitInitParams, TapKitInitializationError, type TapKitInstance, TapKitLoaderError, TapKitMessageError, type TapKitRuntimeConfig, type TapMaterialViewerAttributes, type TapMessage, type TapMessageRecord, TapMessageSchema, type TapMessageType, type TapReadyMessage, TapReadySchema, type TimelineSeekMessage, TimelineSeekSchema, type VideoController, type VideoPlayerAdapter, type VideoPlayerConfig, type ViewportResizeMessage, ViewportResizeSchema };
|
|
3704
|
+
export { ALARM_DURATION, type AlarmClickMessage, AlarmClickSchema, type AlarmElement, type AlarmElementProps, AlarmElementPropsSchema, AlarmElementSchema, type AlarmFadeInMessage, AlarmFadeInSchema, AlarmMessageInstanceSchema, type AlarmMessageInstanceType, type AlarmPayload, type AlarmType, type CSSStyle, CSSStyleSchema, type ConfigUpdateMessage, ConfigUpdateSchema, type ContainerConfig, type ContainerLayoutStateChangedMessage, ContainerLayoutStateChangedSchema, type ContainerModeChangeAckMessage, ContainerModeChangeAckSchema, type ContainerModeChangeMessage, ContainerModeChangeSchema, type ContainerVisibility, type Course, type DisplayMode, type EventManager, type FloatingConfig, type GAEventMessage, GAEventSchema, type HtmlViewCloseMessage, HtmlViewCloseSchema, type HtmlViewConfig, type HtmlViewOpenMessage, HtmlViewOpenSchema, type ITapButtonElement, type ITapContainerElement, type ITapHtmlViewerElement, type ITapKitElement, type ITapMaterialViewerElement, TapKitInitializationError as InitializationError, type LayoutMode, type MaterialViewCloseMessage, MaterialViewCloseSchema, type MaterialViewConfig, type MaterialViewErrorMessage, MaterialViewErrorSchema, type MaterialViewOpenMessage, MaterialViewOpenSchema, MaterialViewerError, type PopUpCloseMessage, PopUpCloseSchema, type PopUpOpenMessage, PopUpOpenSchema, type PositionType, type SeekTimelineParamsType, type ShortcutKeyPropertiesType, type SidebarConfig, TAP_BUTTON_CLICK_EVENT, TAP_ERROR_MARKER, type TapButtonAttributes, type TapButtonClickEventDetail, type TapCloseMessage, TapCloseSchema, type TapContainerAttributes, type TapErrorOptions, type TapHtmlViewerAttributes, type TapKitConfig, type TapKitConfigOptions, TapKitConfigurationError, type TapKitConstructor, type TapKitElement, type TapKitElementEventMap, TapKitError, TapKitIframeError, type TapKitInitParams, TapKitInitializationError, type TapKitInstance, TapKitLoaderError, TapKitMessageError, type TapKitRuntimeConfig, type TapMaterialViewerAttributes, type TapMessage, type TapMessageRecord, TapMessageSchema, type TapMessageType, type TapReadyMessage, TapReadySchema, type TimelineSeekMessage, TimelineSeekSchema, type VideoController, type VideoPlayerAdapter, type VideoPlayerConfig, type ViewportResizeMessage, ViewportResizeSchema };
|
package/dist/index.js
CHANGED
|
@@ -158,7 +158,7 @@ var MaterialViewerError = class _MaterialViewerError extends TapKitError {
|
|
|
158
158
|
};
|
|
159
159
|
|
|
160
160
|
// src/protocol/alarm.ts
|
|
161
|
-
var ALARM_DURATION =
|
|
161
|
+
var ALARM_DURATION = 16e3;
|
|
162
162
|
|
|
163
163
|
// ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.2/node_modules/valibot/dist/index.js
|
|
164
164
|
var store;
|
|
@@ -819,6 +819,15 @@ var MaterialViewErrorSchema = object({
|
|
|
819
819
|
]),
|
|
820
820
|
message: optional(string())
|
|
821
821
|
});
|
|
822
|
+
var HtmlViewOpenSchema = object({
|
|
823
|
+
type: literal("html:view:open"),
|
|
824
|
+
htmlUrl: optional(string()),
|
|
825
|
+
htmlContent: optional(string()),
|
|
826
|
+
title: optional(string())
|
|
827
|
+
});
|
|
828
|
+
var HtmlViewCloseSchema = object({
|
|
829
|
+
type: literal("html:view:close")
|
|
830
|
+
});
|
|
822
831
|
var ContainerModeChangeSchema = object({
|
|
823
832
|
type: literal("container:mode:change"),
|
|
824
833
|
mode: union([literal("floating"), literal("sidebar")]),
|
|
@@ -908,6 +917,8 @@ var TapMessageSchema = union([
|
|
|
908
917
|
MaterialViewOpenSchema,
|
|
909
918
|
MaterialViewCloseSchema,
|
|
910
919
|
MaterialViewErrorSchema,
|
|
920
|
+
HtmlViewOpenSchema,
|
|
921
|
+
HtmlViewCloseSchema,
|
|
911
922
|
ContainerModeChangeSchema,
|
|
912
923
|
ContainerModeChangeAckSchema,
|
|
913
924
|
ContainerLayoutStateChangedSchema,
|
|
@@ -919,6 +930,6 @@ var TapMessageSchema = union([
|
|
|
919
930
|
// src/tap-button.d.ts
|
|
920
931
|
var TAP_BUTTON_CLICK_EVENT = "tap-button:click";
|
|
921
932
|
|
|
922
|
-
export { ALARM_DURATION, AlarmClickSchema, AlarmElementPropsSchema, AlarmElementSchema, AlarmFadeInSchema, AlarmMessageInstanceSchema, CSSStyleSchema, ConfigUpdateSchema, ContainerLayoutStateChangedSchema, ContainerModeChangeAckSchema, ContainerModeChangeSchema, GAEventSchema, TapKitInitializationError as InitializationError, MaterialViewCloseSchema, MaterialViewErrorSchema, MaterialViewOpenSchema, MaterialViewerError, PopUpCloseSchema, PopUpOpenSchema, TAP_BUTTON_CLICK_EVENT, TAP_ERROR_MARKER, TapCloseSchema, TapKitConfigurationError, TapKitError, TapKitIframeError, TapKitInitializationError, TapKitLoaderError, TapKitMessageError, TapMessageSchema, TapReadySchema, TimelineSeekSchema, ViewportResizeSchema };
|
|
933
|
+
export { ALARM_DURATION, AlarmClickSchema, AlarmElementPropsSchema, AlarmElementSchema, AlarmFadeInSchema, AlarmMessageInstanceSchema, CSSStyleSchema, ConfigUpdateSchema, ContainerLayoutStateChangedSchema, ContainerModeChangeAckSchema, ContainerModeChangeSchema, GAEventSchema, HtmlViewCloseSchema, HtmlViewOpenSchema, TapKitInitializationError as InitializationError, MaterialViewCloseSchema, MaterialViewErrorSchema, MaterialViewOpenSchema, MaterialViewerError, PopUpCloseSchema, PopUpOpenSchema, TAP_BUTTON_CLICK_EVENT, TAP_ERROR_MARKER, TapCloseSchema, TapKitConfigurationError, TapKitError, TapKitIframeError, TapKitInitializationError, TapKitLoaderError, TapKitMessageError, TapMessageSchema, TapReadySchema, TimelineSeekSchema, ViewportResizeSchema };
|
|
923
934
|
//# sourceMappingURL=index.js.map
|
|
924
935
|
//# sourceMappingURL=index.js.map
|