@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/dist/types.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reporter Web Types
|
|
3
|
+
*
|
|
4
|
+
* State shape definitions for the web reporter store.
|
|
5
|
+
* Designed for React integration via useSyncExternalStore.
|
|
6
|
+
*/
|
|
7
|
+
import type { ActivityId, GroupId, GroupLayout, LogLevel } from '@pokit/core';
|
|
8
|
+
/**
|
|
9
|
+
* Root lifecycle status
|
|
10
|
+
*/
|
|
11
|
+
export type RootStatus = 'idle' | 'running' | 'complete' | 'error';
|
|
12
|
+
/**
|
|
13
|
+
* Activity status
|
|
14
|
+
*/
|
|
15
|
+
export type ActivityStatus = 'pending' | 'running' | 'success' | 'failure';
|
|
16
|
+
/**
|
|
17
|
+
* Temporal markers for animation hints
|
|
18
|
+
* These auto-clear after a short delay (600ms) to enable smooth UI transitions
|
|
19
|
+
*/
|
|
20
|
+
export type TemporalMarkers = {
|
|
21
|
+
/** Activity just started (for entrance animations) */
|
|
22
|
+
justStarted?: boolean;
|
|
23
|
+
/** Activity just completed successfully (for success animations) */
|
|
24
|
+
justCompleted?: boolean;
|
|
25
|
+
/** Activity just failed (for error animations) */
|
|
26
|
+
justFailed?: boolean;
|
|
27
|
+
/** Group just started */
|
|
28
|
+
justStarted_group?: boolean;
|
|
29
|
+
/** Group just ended */
|
|
30
|
+
justEnded?: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Activity state - represents a unit of work
|
|
34
|
+
*/
|
|
35
|
+
export type ActivityState = TemporalMarkers & {
|
|
36
|
+
id: ActivityId;
|
|
37
|
+
parentId?: GroupId | ActivityId;
|
|
38
|
+
label: string;
|
|
39
|
+
status: ActivityStatus;
|
|
40
|
+
/** Progress 0-100 */
|
|
41
|
+
progress?: number;
|
|
42
|
+
/** Current status message */
|
|
43
|
+
message?: string;
|
|
44
|
+
/** Custom metadata */
|
|
45
|
+
meta?: Record<string, unknown>;
|
|
46
|
+
/** Error information if failed */
|
|
47
|
+
error?: {
|
|
48
|
+
message: string;
|
|
49
|
+
remediation?: string[];
|
|
50
|
+
documentationUrl?: string;
|
|
51
|
+
};
|
|
52
|
+
/** Custom payload data from updates */
|
|
53
|
+
payload?: Record<string, unknown>;
|
|
54
|
+
/** Timestamp when started */
|
|
55
|
+
startedAt: number;
|
|
56
|
+
/** Timestamp when completed (success or failure) */
|
|
57
|
+
completedAt?: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Group state - represents a container for activities
|
|
61
|
+
*/
|
|
62
|
+
export type GroupState = TemporalMarkers & {
|
|
63
|
+
id: GroupId;
|
|
64
|
+
parentId?: GroupId;
|
|
65
|
+
label: string;
|
|
66
|
+
layout: GroupLayout;
|
|
67
|
+
/** Child activity IDs in order */
|
|
68
|
+
activityIds: ActivityId[];
|
|
69
|
+
/** Child group IDs in order */
|
|
70
|
+
childGroupIds: GroupId[];
|
|
71
|
+
/** Whether any child has failed */
|
|
72
|
+
hasFailure: boolean;
|
|
73
|
+
/** Timestamp when started */
|
|
74
|
+
startedAt: number;
|
|
75
|
+
/** Timestamp when ended */
|
|
76
|
+
endedAt?: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Log entry
|
|
80
|
+
*/
|
|
81
|
+
export type LogEntry = {
|
|
82
|
+
id: string;
|
|
83
|
+
activityId?: ActivityId;
|
|
84
|
+
level: LogLevel;
|
|
85
|
+
message: string;
|
|
86
|
+
timestamp: number;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Root state for the reporter
|
|
90
|
+
*/
|
|
91
|
+
export type RootState = {
|
|
92
|
+
appName?: string;
|
|
93
|
+
version?: string;
|
|
94
|
+
status: RootStatus;
|
|
95
|
+
startedAt?: number;
|
|
96
|
+
endedAt?: number;
|
|
97
|
+
exitCode?: number;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Complete reporter state
|
|
101
|
+
*/
|
|
102
|
+
export type ReporterState = {
|
|
103
|
+
/** Root lifecycle state */
|
|
104
|
+
root: RootState;
|
|
105
|
+
/** Groups indexed by ID */
|
|
106
|
+
groups: Map<GroupId, GroupState>;
|
|
107
|
+
/** Activities indexed by ID */
|
|
108
|
+
activities: Map<ActivityId, ActivityState>;
|
|
109
|
+
/** Log entries in chronological order */
|
|
110
|
+
logs: LogEntry[];
|
|
111
|
+
/** Whether reporter output is suspended */
|
|
112
|
+
suspended: boolean;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Subscription callback type
|
|
116
|
+
*/
|
|
117
|
+
export type StateListener = () => void;
|
|
118
|
+
/**
|
|
119
|
+
* Reporter store interface compatible with useSyncExternalStore
|
|
120
|
+
*/
|
|
121
|
+
export type ReporterStore = {
|
|
122
|
+
/** Get current state snapshot */
|
|
123
|
+
getState(): ReporterState;
|
|
124
|
+
/** Get snapshot for useSyncExternalStore (same as getState for immutable updates) */
|
|
125
|
+
getSnapshot(): ReporterState;
|
|
126
|
+
/** Subscribe to state changes */
|
|
127
|
+
subscribe(listener: StateListener): () => void;
|
|
128
|
+
/** Get server snapshot for SSR (returns same as getSnapshot) */
|
|
129
|
+
getServerSnapshot(): ReporterState;
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3E;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,sDAAsD;IACtD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oEAAoE;IACpE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yBAAyB;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uBAAuB;IACvB,SAAS,CAAC,EAAE,OAAO,CA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0.0.1",
|
|
4
|
+
"description": "Web/React event reporter for pok CLI applications",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"command-line",
|
|
8
|
+
"typescript",
|
|
9
|
+
"bun",
|
|
10
|
+
"terminal",
|
|
11
|
+
"pok",
|
|
12
|
+
"pokjs",
|
|
13
|
+
"reporter",
|
|
14
|
+
"react",
|
|
15
|
+
"web"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/notation-dev/openpok.git",
|
|
22
|
+
"directory": "packages/reporter-web"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/notation-dev/openpok#readme",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/notation-dev/openpok/issues"
|
|
27
|
+
},
|
|
28
|
+
"main": "./src/index.ts",
|
|
29
|
+
"module": "./src/index.ts",
|
|
30
|
+
"types": "./src/index.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"bun": "./src/index.ts",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"import": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/bun": "latest",
|
|
48
|
+
"@types/react": "^18.2.0",
|
|
49
|
+
"@pokit/core": "0.0.1"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
53
|
+
"@pokit/core": "0.0.1"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"bun": ">=1.0.0"
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pokit/reporter-web
|
|
3
|
+
*
|
|
4
|
+
* Web/React implementation of the ReporterAdapter interface.
|
|
5
|
+
* Provides a store for state management and React hooks for subscription.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Store
|
|
9
|
+
export { createReporterStore } from './store';
|
|
10
|
+
export type { CreateReporterStoreOptions, ReporterStoreWithHandler } from './store';
|
|
11
|
+
|
|
12
|
+
// Adapter
|
|
13
|
+
export { createWebReporterAdapter } from './adapter';
|
|
14
|
+
|
|
15
|
+
// Hooks
|
|
16
|
+
export {
|
|
17
|
+
useReporterState,
|
|
18
|
+
useActivity,
|
|
19
|
+
useGroup,
|
|
20
|
+
useRootState,
|
|
21
|
+
useLogs,
|
|
22
|
+
useSuspended,
|
|
23
|
+
} from './hooks';
|
|
24
|
+
|
|
25
|
+
// Types
|
|
26
|
+
export type {
|
|
27
|
+
RootStatus,
|
|
28
|
+
ActivityStatus,
|
|
29
|
+
TemporalMarkers,
|
|
30
|
+
ActivityState,
|
|
31
|
+
GroupState,
|
|
32
|
+
LogEntry,
|
|
33
|
+
RootState,
|
|
34
|
+
ReporterState,
|
|
35
|
+
StateListener,
|
|
36
|
+
ReporterStore,
|
|
37
|
+
} from './types';
|
|
38
|
+
|
|
39
|
+
// Components
|
|
40
|
+
export {
|
|
41
|
+
TutorialStep,
|
|
42
|
+
FilePreview,
|
|
43
|
+
CommandBlock,
|
|
44
|
+
ProgressIndicator,
|
|
45
|
+
ContentBox,
|
|
46
|
+
} from './components';
|
|
47
|
+
export type {
|
|
48
|
+
TutorialStepProps,
|
|
49
|
+
TutorialStepStatus,
|
|
50
|
+
FilePreviewProps,
|
|
51
|
+
FilePreviewStatus,
|
|
52
|
+
FilePreviewActionProps,
|
|
53
|
+
CommandBlockProps,
|
|
54
|
+
CommandBlockStatus,
|
|
55
|
+
CommandBlockActionProps,
|
|
56
|
+
ProgressIndicatorProps,
|
|
57
|
+
ContentBoxProps,
|
|
58
|
+
ContentBoxVariant,
|
|
59
|
+
} from './components';
|