@pokit/reporter-web 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.
- package/LICENSE +21 -0
- package/dist/adapter.d.ts +37 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +53 -0
- package/dist/components/CommandBlock.d.ts +35 -0
- package/dist/components/CommandBlock.d.ts.map +1 -0
- package/dist/components/CommandBlock.js +15 -0
- package/dist/components/ContentBox.d.ts +23 -0
- package/dist/components/ContentBox.d.ts.map +1 -0
- package/dist/components/ContentBox.js +4 -0
- package/dist/components/FilePreview.d.ts +38 -0
- package/dist/components/FilePreview.d.ts.map +1 -0
- package/dist/components/FilePreview.js +15 -0
- package/dist/components/ProgressIndicator.d.ts +21 -0
- package/dist/components/ProgressIndicator.d.ts.map +1 -0
- package/dist/components/ProgressIndicator.js +7 -0
- package/dist/components/TutorialStep.d.ts +28 -0
- package/dist/components/TutorialStep.d.ts.map +1 -0
- package/dist/components/TutorialStep.js +4 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +29 -0
- package/dist/hooks.d.ts +94 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +201 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/store.d.ts +31 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +345 -0
- package/dist/types.d.ts +131 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/package.json +58 -0
- package/src/index.ts +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Daniel Grant
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Reporter Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements the ReporterAdapter interface for web/React environments.
|
|
5
|
+
* Connects the EventBus to a ReporterStore for state management.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReporterAdapter } from '@pokit/core';
|
|
8
|
+
import type { ReporterStoreWithHandler } from './store';
|
|
9
|
+
/**
|
|
10
|
+
* Create a web reporter adapter that pipes events to a store
|
|
11
|
+
*
|
|
12
|
+
* @param store - The reporter store (must be created with createReporterStore)
|
|
13
|
+
* @returns ReporterAdapter instance
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createReporterStore, createWebReporterAdapter } from '@pokit/reporter-web';
|
|
18
|
+
* import { createEventBus } from '@pokit/core';
|
|
19
|
+
*
|
|
20
|
+
* const store = createReporterStore();
|
|
21
|
+
* const adapter = createWebReporterAdapter(store);
|
|
22
|
+
* const bus = createEventBus();
|
|
23
|
+
*
|
|
24
|
+
* const controller = adapter.start(bus);
|
|
25
|
+
*
|
|
26
|
+
* // Events emitted to the bus will update the store
|
|
27
|
+
* bus.emit({ type: 'root:start', appName: 'my-app' });
|
|
28
|
+
*
|
|
29
|
+
* // In React:
|
|
30
|
+
* // const state = useReporterState(store);
|
|
31
|
+
*
|
|
32
|
+
* // Cleanup
|
|
33
|
+
* controller.stop();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function createWebReporterAdapter(store: ReporterStoreWithHandler): ReporterAdapter;
|
|
37
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAuC,MAAM,aAAa,CAAC;AACxF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,wBAAwB,GAAG,eAAe,CAmBzF"}
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Reporter Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements the ReporterAdapter interface for web/React environments.
|
|
5
|
+
* Connects the EventBus to a ReporterStore for state management.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Create a web reporter adapter that pipes events to a store
|
|
9
|
+
*
|
|
10
|
+
* @param store - The reporter store (must be created with createReporterStore)
|
|
11
|
+
* @returns ReporterAdapter instance
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { createReporterStore, createWebReporterAdapter } from '@pokit/reporter-web';
|
|
16
|
+
* import { createEventBus } from '@pokit/core';
|
|
17
|
+
*
|
|
18
|
+
* const store = createReporterStore();
|
|
19
|
+
* const adapter = createWebReporterAdapter(store);
|
|
20
|
+
* const bus = createEventBus();
|
|
21
|
+
*
|
|
22
|
+
* const controller = adapter.start(bus);
|
|
23
|
+
*
|
|
24
|
+
* // Events emitted to the bus will update the store
|
|
25
|
+
* bus.emit({ type: 'root:start', appName: 'my-app' });
|
|
26
|
+
*
|
|
27
|
+
* // In React:
|
|
28
|
+
* // const state = useReporterState(store);
|
|
29
|
+
*
|
|
30
|
+
* // Cleanup
|
|
31
|
+
* controller.stop();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function createWebReporterAdapter(store) {
|
|
35
|
+
return {
|
|
36
|
+
start(bus) {
|
|
37
|
+
let stopped = false;
|
|
38
|
+
const unsubscribe = bus.on((event) => {
|
|
39
|
+
if (stopped)
|
|
40
|
+
return;
|
|
41
|
+
store._handleEvent(event);
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
stop() {
|
|
45
|
+
if (stopped)
|
|
46
|
+
return;
|
|
47
|
+
stopped = true;
|
|
48
|
+
unsubscribe();
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommandBlock - A headless component for displaying shell commands with output.
|
|
3
|
+
*
|
|
4
|
+
* CSS Variables Contract:
|
|
5
|
+
* - --tutorial-code-bg: Background color for command/output area
|
|
6
|
+
* - --tutorial-bg: Default background color
|
|
7
|
+
* - --tutorial-text: Primary text color
|
|
8
|
+
* - --tutorial-text-muted: Secondary/muted text color
|
|
9
|
+
* - --tutorial-border: Border color
|
|
10
|
+
* - --tutorial-action-bg: Action button background
|
|
11
|
+
* - --tutorial-action-hover: Action button hover background
|
|
12
|
+
*
|
|
13
|
+
* Data Attributes:
|
|
14
|
+
* - [data-status="idle|running|complete|failed"]: Command status for styling
|
|
15
|
+
*/
|
|
16
|
+
export type CommandBlockStatus = 'idle' | 'running' | 'complete' | 'failed';
|
|
17
|
+
export type CommandBlockActionProps = {
|
|
18
|
+
onClick: () => void;
|
|
19
|
+
status: CommandBlockStatus;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type CommandBlockProps = {
|
|
23
|
+
/** Command to display */
|
|
24
|
+
command: string;
|
|
25
|
+
/** Current status of the command execution */
|
|
26
|
+
status: CommandBlockStatus;
|
|
27
|
+
/** Output lines from the command */
|
|
28
|
+
output?: string[];
|
|
29
|
+
/** Callback when run action is triggered (if no renderAction provided) */
|
|
30
|
+
onRun?: () => void;
|
|
31
|
+
/** Render prop for custom action button */
|
|
32
|
+
renderAction?: (props: CommandBlockActionProps) => React.ReactNode;
|
|
33
|
+
};
|
|
34
|
+
export declare function CommandBlock({ command, status, output, onRun, renderAction, }: CommandBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=CommandBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandBlock.d.ts","sourceRoot":"","sources":["../../src/components/CommandBlock.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE5E,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,MAAM,EAAE,kBAAkB,CAAC;IAC3B,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,KAAK,CAAC,SAAS,CAAC;CACpE,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,YAAY,GACb,EAAE,iBAAiB,2CAkDnB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function CommandBlock({ command, status, output, onRun, renderAction, }) {
|
|
3
|
+
const disabled = status === 'running';
|
|
4
|
+
const handleClick = () => {
|
|
5
|
+
if (!disabled && onRun) {
|
|
6
|
+
onRun();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
const actionProps = {
|
|
10
|
+
onClick: handleClick,
|
|
11
|
+
status,
|
|
12
|
+
disabled,
|
|
13
|
+
};
|
|
14
|
+
return (_jsxs("div", { className: "command-block", "data-status": status, children: [_jsxs("div", { className: "command-block-command", children: [_jsx("span", { className: "command-block-prompt", children: "$" }), _jsx("span", { className: "command-block-text", children: command })] }), output && output.length > 0 && (_jsx("div", { className: "command-block-output", children: output.map((line, index) => (_jsx("div", { className: "command-block-output-line", children: line }, index))) })), (renderAction || onRun) && (_jsx("div", { className: "command-block-actions", children: renderAction ? (renderAction(actionProps)) : (_jsxs("button", { className: "command-block-action-button", onClick: handleClick, disabled: disabled, "data-status": status, children: [status === 'idle' && 'Run', status === 'running' && 'Running...', status === 'complete' && 'Run Again', status === 'failed' && 'Retry'] })) }))] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContentBox - A headless container component for info/tip/warning content.
|
|
3
|
+
*
|
|
4
|
+
* CSS Variables Contract:
|
|
5
|
+
* - --tutorial-bg: Default background color
|
|
6
|
+
* - --tutorial-text: Primary text color
|
|
7
|
+
* - --tutorial-text-muted: Secondary/muted text color
|
|
8
|
+
* - --tutorial-border: Border color
|
|
9
|
+
*
|
|
10
|
+
* Data Attributes:
|
|
11
|
+
* - [data-variant="info|tip|warning"]: Content variant for styling
|
|
12
|
+
*/
|
|
13
|
+
export type ContentBoxVariant = 'info' | 'tip' | 'warning';
|
|
14
|
+
export type ContentBoxProps = {
|
|
15
|
+
/** Visual variant of the content box */
|
|
16
|
+
variant: ContentBoxVariant;
|
|
17
|
+
/** Optional title for the content box */
|
|
18
|
+
title?: string;
|
|
19
|
+
/** Content to display inside the box */
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
export declare function ContentBox({ variant, title, children }: ContentBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=ContentBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentBox.d.ts","sourceRoot":"","sources":["../../src/components/ContentBox.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAE3D,MAAM,MAAM,eAAe,GAAG;IAC5B,wCAAwC;IACxC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,eAAe,2CAOvE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function ContentBox({ variant, title, children }) {
|
|
3
|
+
return (_jsxs("div", { className: "content-box", "data-variant": variant, children: [title && _jsx("div", { className: "content-box-title", children: title }), _jsx("div", { className: "content-box-content", children: children })] }));
|
|
4
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FilePreview - A headless component for displaying file content with action slot.
|
|
3
|
+
*
|
|
4
|
+
* CSS Variables Contract:
|
|
5
|
+
* - --tutorial-code-bg: Background color for code/file content area
|
|
6
|
+
* - --tutorial-bg: Default background color
|
|
7
|
+
* - --tutorial-text: Primary text color
|
|
8
|
+
* - --tutorial-text-muted: Secondary/muted text color
|
|
9
|
+
* - --tutorial-border: Border color
|
|
10
|
+
* - --tutorial-action-bg: Action button background
|
|
11
|
+
* - --tutorial-action-hover: Action button hover background
|
|
12
|
+
*
|
|
13
|
+
* Data Attributes:
|
|
14
|
+
* - [data-status="pending|creating|created"]: File status for styling
|
|
15
|
+
* - [data-language="..."]: Language hint for syntax highlighting
|
|
16
|
+
*/
|
|
17
|
+
export type FilePreviewStatus = 'pending' | 'creating' | 'created';
|
|
18
|
+
export type FilePreviewActionProps = {
|
|
19
|
+
onClick: () => void;
|
|
20
|
+
status: FilePreviewStatus;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type FilePreviewProps = {
|
|
24
|
+
/** File path to display in header */
|
|
25
|
+
path: string;
|
|
26
|
+
/** File content to display */
|
|
27
|
+
content: string;
|
|
28
|
+
/** Language for syntax highlighting hint */
|
|
29
|
+
language?: string;
|
|
30
|
+
/** Current status of the file operation */
|
|
31
|
+
status: FilePreviewStatus;
|
|
32
|
+
/** Callback when action is triggered (if no renderAction provided) */
|
|
33
|
+
onAction?: () => void;
|
|
34
|
+
/** Render prop for custom action button */
|
|
35
|
+
renderAction?: (props: FilePreviewActionProps) => React.ReactNode;
|
|
36
|
+
};
|
|
37
|
+
export declare function FilePreview({ path, content, language, status, onAction, renderAction, }: FilePreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=FilePreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilePreview.d.ts","sourceRoot":"","sources":["../../src/components/FilePreview.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAEnE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,MAAM,EAAE,iBAAiB,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC;CACnE,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,GACb,EAAE,gBAAgB,2CAmDlB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function FilePreview({ path, content, language, status, onAction, renderAction, }) {
|
|
3
|
+
const disabled = status === 'creating' || status === 'created';
|
|
4
|
+
const handleClick = () => {
|
|
5
|
+
if (!disabled && onAction) {
|
|
6
|
+
onAction();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
const actionProps = {
|
|
10
|
+
onClick: handleClick,
|
|
11
|
+
status,
|
|
12
|
+
disabled,
|
|
13
|
+
};
|
|
14
|
+
return (_jsxs("div", { className: "file-preview", "data-status": status, "data-language": language, children: [_jsxs("div", { className: "file-preview-header", children: [_jsx("span", { className: "file-preview-path", children: path }), language && (_jsx("span", { className: "file-preview-language", children: language }))] }), _jsx("div", { className: "file-preview-content", children: _jsx("pre", { className: "file-preview-code", children: _jsx("code", { children: content }) }) }), (renderAction || onAction) && (_jsx("div", { className: "file-preview-actions", children: renderAction ? (renderAction(actionProps)) : (_jsxs("button", { className: "file-preview-action-button", onClick: handleClick, disabled: disabled, "data-status": status, children: [status === 'pending' && 'Create', status === 'creating' && 'Creating...', status === 'created' && 'Created'] })) }))] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProgressIndicator - A headless component for displaying tutorial progress.
|
|
3
|
+
*
|
|
4
|
+
* CSS Variables Contract:
|
|
5
|
+
* - --tutorial-text: Primary text color
|
|
6
|
+
* - --tutorial-text-muted: Secondary/muted text color
|
|
7
|
+
*
|
|
8
|
+
* Data Attributes:
|
|
9
|
+
* - [data-progress]: Current progress ratio (0-1) as data attribute
|
|
10
|
+
* - [data-complete="true"]: When current equals total
|
|
11
|
+
*/
|
|
12
|
+
export type ProgressIndicatorProps = {
|
|
13
|
+
/** Current step number (1-indexed) */
|
|
14
|
+
current: number;
|
|
15
|
+
/** Total number of steps */
|
|
16
|
+
total: number;
|
|
17
|
+
/** Optional custom label (defaults to "Step X of Y") */
|
|
18
|
+
label?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function ProgressIndicator({ current, total, label, }: ProgressIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=ProgressIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressIndicator.d.ts","sourceRoot":"","sources":["../../src/components/ProgressIndicator.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,sBAAsB,GAAG;IACnC,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,KAAK,EACL,KAAK,GACN,EAAE,sBAAsB,2CAoBxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function ProgressIndicator({ current, total, label, }) {
|
|
3
|
+
const progress = total > 0 ? current / total : 0;
|
|
4
|
+
const isComplete = current >= total;
|
|
5
|
+
const displayLabel = label ?? `Step ${current} of ${total}`;
|
|
6
|
+
return (_jsxs("div", { className: "progress-indicator", "data-progress": progress.toFixed(2), "data-complete": isComplete ? 'true' : undefined, children: [_jsx("span", { className: "progress-indicator-label", children: displayLabel }), _jsx("div", { className: "progress-indicator-bar", children: _jsx("div", { className: "progress-indicator-fill", style: { width: `${progress * 100}%` } }) })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TutorialStep - A headless component for rendering tutorial step containers.
|
|
3
|
+
*
|
|
4
|
+
* CSS Variables Contract:
|
|
5
|
+
* - --tutorial-step-active: Background/border color for active step
|
|
6
|
+
* - --tutorial-step-complete: Background/border color for complete step
|
|
7
|
+
* - --tutorial-step-pending: Background/border color for pending step
|
|
8
|
+
* - --tutorial-bg: Default background color
|
|
9
|
+
* - --tutorial-text: Primary text color
|
|
10
|
+
* - --tutorial-text-muted: Secondary/muted text color
|
|
11
|
+
* - --tutorial-border: Border color
|
|
12
|
+
*
|
|
13
|
+
* Data Attributes:
|
|
14
|
+
* - [data-status="pending|active|complete"]: Step status for styling
|
|
15
|
+
*/
|
|
16
|
+
export type TutorialStepStatus = 'pending' | 'active' | 'complete';
|
|
17
|
+
export type TutorialStepProps = {
|
|
18
|
+
/** Step number displayed in the header */
|
|
19
|
+
number: number;
|
|
20
|
+
/** Step title */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Current status of the step */
|
|
23
|
+
status: TutorialStepStatus;
|
|
24
|
+
/** Step content */
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export declare function TutorialStep({ number, title, status, children, }: TutorialStepProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=TutorialStep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TutorialStep.d.ts","sourceRoot":"","sources":["../../src/components/TutorialStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,mBAAmB;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,GACT,EAAE,iBAAiB,2CAUnB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function TutorialStep({ number, title, status, children, }) {
|
|
3
|
+
return (_jsxs("div", { className: "tutorial-step", "data-status": status, children: [_jsxs("div", { className: "tutorial-step-header", children: [_jsx("span", { className: "tutorial-step-number", children: number }), _jsx("span", { className: "tutorial-step-title", children: title })] }), _jsx("div", { className: "tutorial-step-content", children: children })] }));
|
|
4
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tutorial Renderer Components
|
|
3
|
+
*
|
|
4
|
+
* Headless React components for rendering tutorial content.
|
|
5
|
+
* All components use CSS variables and data attributes for styling,
|
|
6
|
+
* allowing full customization by the consuming application.
|
|
7
|
+
*
|
|
8
|
+
* CSS Variables Contract:
|
|
9
|
+
* --tutorial-bg Default background color
|
|
10
|
+
* --tutorial-step-active Background/border for active step
|
|
11
|
+
* --tutorial-step-complete Background/border for complete step
|
|
12
|
+
* --tutorial-step-pending Background/border for pending step
|
|
13
|
+
* --tutorial-code-bg Background for code/command blocks
|
|
14
|
+
* --tutorial-action-bg Action button background
|
|
15
|
+
* --tutorial-action-hover Action button hover background
|
|
16
|
+
* --tutorial-border Border color
|
|
17
|
+
* --tutorial-text Primary text color
|
|
18
|
+
* --tutorial-text-muted Secondary/muted text color
|
|
19
|
+
*/
|
|
20
|
+
export { TutorialStep } from './TutorialStep';
|
|
21
|
+
export type { TutorialStepProps, TutorialStepStatus, } from './TutorialStep';
|
|
22
|
+
export { FilePreview } from './FilePreview';
|
|
23
|
+
export type { FilePreviewProps, FilePreviewStatus, FilePreviewActionProps, } from './FilePreview';
|
|
24
|
+
export { CommandBlock } from './CommandBlock';
|
|
25
|
+
export type { CommandBlockProps, CommandBlockStatus, CommandBlockActionProps, } from './CommandBlock';
|
|
26
|
+
export { ProgressIndicator } from './ProgressIndicator';
|
|
27
|
+
export type { ProgressIndicatorProps } from './ProgressIndicator';
|
|
28
|
+
export { ContentBox } from './ContentBox';
|
|
29
|
+
export type { ContentBoxProps, ContentBoxVariant, } from './ContentBox';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EACV,eAAe,EACf,iBAAiB,GAClB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tutorial Renderer Components
|
|
3
|
+
*
|
|
4
|
+
* Headless React components for rendering tutorial content.
|
|
5
|
+
* All components use CSS variables and data attributes for styling,
|
|
6
|
+
* allowing full customization by the consuming application.
|
|
7
|
+
*
|
|
8
|
+
* CSS Variables Contract:
|
|
9
|
+
* --tutorial-bg Default background color
|
|
10
|
+
* --tutorial-step-active Background/border for active step
|
|
11
|
+
* --tutorial-step-complete Background/border for complete step
|
|
12
|
+
* --tutorial-step-pending Background/border for pending step
|
|
13
|
+
* --tutorial-code-bg Background for code/command blocks
|
|
14
|
+
* --tutorial-action-bg Action button background
|
|
15
|
+
* --tutorial-action-hover Action button hover background
|
|
16
|
+
* --tutorial-border Border color
|
|
17
|
+
* --tutorial-text Primary text color
|
|
18
|
+
* --tutorial-text-muted Secondary/muted text color
|
|
19
|
+
*/
|
|
20
|
+
// TutorialStep
|
|
21
|
+
export { TutorialStep } from './TutorialStep';
|
|
22
|
+
// FilePreview
|
|
23
|
+
export { FilePreview } from './FilePreview';
|
|
24
|
+
// CommandBlock
|
|
25
|
+
export { CommandBlock } from './CommandBlock';
|
|
26
|
+
// ProgressIndicator
|
|
27
|
+
export { ProgressIndicator } from './ProgressIndicator';
|
|
28
|
+
// ContentBox
|
|
29
|
+
export { ContentBox } from './ContentBox';
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reporter Web React Hooks
|
|
3
|
+
*
|
|
4
|
+
* React hooks for subscribing to reporter state using useSyncExternalStore.
|
|
5
|
+
* Provides full state subscription and selective subscriptions for individual
|
|
6
|
+
* activities and groups.
|
|
7
|
+
*/
|
|
8
|
+
import type { ActivityId, GroupId } from '@pokit/core';
|
|
9
|
+
import type { ReporterStore, ReporterState, ActivityState, GroupState } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Subscribe to the full reporter state
|
|
12
|
+
*
|
|
13
|
+
* @param store - The reporter store
|
|
14
|
+
* @returns Current reporter state
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const state = useReporterState(store);
|
|
19
|
+
* return <div>Status: {state.root.status}</div>;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useReporterState(store: ReporterStore): ReporterState;
|
|
23
|
+
/**
|
|
24
|
+
* Subscribe to a single activity by ID
|
|
25
|
+
* Returns undefined if activity doesn't exist
|
|
26
|
+
*
|
|
27
|
+
* @param store - The reporter store
|
|
28
|
+
* @param id - Activity ID to subscribe to
|
|
29
|
+
* @returns Activity state or undefined
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const activity = useActivity(store, 'task-1');
|
|
34
|
+
* if (!activity) return null;
|
|
35
|
+
* return <div>{activity.label}: {activity.status}</div>;
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function useActivity(store: ReporterStore, id: ActivityId): ActivityState | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Subscribe to a single group by ID
|
|
41
|
+
* Returns undefined if group doesn't exist
|
|
42
|
+
*
|
|
43
|
+
* @param store - The reporter store
|
|
44
|
+
* @param id - Group ID to subscribe to
|
|
45
|
+
* @returns Group state or undefined
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* const group = useGroup(store, 'checks');
|
|
50
|
+
* if (!group) return null;
|
|
51
|
+
* return <div>{group.label} ({group.activityIds.length} tasks)</div>;
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function useGroup(store: ReporterStore, id: GroupId): GroupState | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe to root state only
|
|
57
|
+
* More efficient than useReporterState when you only need root info
|
|
58
|
+
*
|
|
59
|
+
* @param store - The reporter store
|
|
60
|
+
* @returns Root state
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* const root = useRootState(store);
|
|
65
|
+
* return <div>App: {root.appName} - {root.status}</div>;
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function useRootState(store: ReporterStore): ReporterState['root'];
|
|
69
|
+
/**
|
|
70
|
+
* Subscribe to logs
|
|
71
|
+
* Returns the full log array
|
|
72
|
+
*
|
|
73
|
+
* @param store - The reporter store
|
|
74
|
+
* @returns Array of log entries
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* const logs = useLogs(store);
|
|
79
|
+
* return (
|
|
80
|
+
* <ul>
|
|
81
|
+
* {logs.map(log => <li key={log.id}>{log.message}</li>)}
|
|
82
|
+
* </ul>
|
|
83
|
+
* );
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function useLogs(store: ReporterStore): ReporterState['logs'];
|
|
87
|
+
/**
|
|
88
|
+
* Subscribe to suspended state
|
|
89
|
+
*
|
|
90
|
+
* @param store - The reporter store
|
|
91
|
+
* @returns Whether reporter is suspended
|
|
92
|
+
*/
|
|
93
|
+
export declare function useSuspended(store: ReporterStore): boolean;
|
|
94
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvF;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAEpE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,UAAU,GAAG,aAAa,GAAG,SAAS,CAsC3F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAsClF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CA0BxE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CA2BnE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAU1D"}
|