@meridianlabs/log-viewer 0.3.259 → 0.3.261
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 +109 -0
- package/lib/{AsciinemaPlayerImpl-D25m6trA.js → AsciinemaPlayerImpl-BG5NPs0z.js} +157 -96
- package/lib/AsciinemaPlayerImpl-BG5NPs0z.js.map +1 -0
- package/lib/e2e/fixtures/serve-log.d.ts +8 -0
- package/lib/e2e/fixtures/serve-log.d.ts.map +1 -0
- package/lib/e2e/fixtures/test-data.d.ts +1 -0
- package/lib/e2e/fixtures/test-data.d.ts.map +1 -1
- package/lib/e2e/metadata-record-tree.spec.d.ts +10 -0
- package/lib/e2e/metadata-record-tree.spec.d.ts.map +1 -0
- package/lib/e2e/metrics-overflow.spec.d.ts +2 -0
- package/lib/e2e/metrics-overflow.spec.d.ts.map +1 -0
- package/lib/index.js +72989 -46493
- package/lib/index.js.map +1 -1
- package/lib/src/app/App.d.ts.map +1 -1
- package/lib/src/app/log-list/LogsPanel.d.ts.map +1 -1
- package/lib/src/app/log-list/ViewerOptionsPopover.d.ts.map +1 -1
- package/lib/src/app/log-list/fileLogItem.d.ts.map +1 -1
- package/lib/src/app/log-list/grid/columns/hooks.d.ts.map +1 -1
- package/lib/src/app/log-list/grid/logListRow.d.ts.map +1 -1
- package/lib/src/app/log-list/grid/useLogListData.d.ts.map +1 -1
- package/lib/src/app/log-list/listing/evaluator.d.ts +5 -3
- package/lib/src/app/log-list/listing/evaluator.d.ts.map +1 -1
- package/lib/src/app/log-view/LogSampleDetailView.d.ts.map +1 -1
- package/lib/src/app/log-view/LogView.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/InfoTab.d.ts +116 -1
- package/lib/src/app/log-view/tabs/InfoTab.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/ModelsTab.d.ts +110 -1
- package/lib/src/app/log-view/tabs/ModelsTab.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/SamplesTab.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/TaskTab.d.ts +110 -1
- package/lib/src/app/log-view/tabs/TaskTab.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/timeline/HistoryList.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/timeline/TimelineChart.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/timeline/TimelineTab.d.ts +110 -1
- package/lib/src/app/log-view/tabs/timeline/TimelineTab.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/timeline/timelineData.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/CollapsedTitleBar.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/EditMetadataDialog.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/EditTagsDialog.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/ModelRolesView.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/PrimaryBar.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/ResultsPanel.d.ts +4 -0
- package/lib/src/app/log-view/title-view/ResultsPanel.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/ScoreGrid.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/TagStrip.d.ts +18 -0
- package/lib/src/app/log-view/title-view/TagStrip.d.ts.map +1 -1
- package/lib/src/app/log-view/useShowTimeline.d.ts.map +1 -1
- package/lib/src/app/navbar/Navbar.d.ts.map +1 -1
- package/lib/src/app/plan/DatasetDetailView.d.ts.map +1 -1
- package/lib/src/app/routing/loaders/SampleLoadController.d.ts.map +1 -1
- package/lib/src/app/routing/loaders/SampleRouteSelectionController.d.ts.map +1 -1
- package/lib/src/app/routing/url.d.ts.map +1 -1
- package/lib/src/app/samples/SampleDisplay.d.ts.map +1 -1
- package/lib/src/app/samples/SampleSummaryView.d.ts.map +1 -1
- package/lib/src/app/samples/descriptor/score/ListScoreDescriptor.d.ts.map +1 -1
- package/lib/src/app/samples/descriptor/score/ObjectScoreDescriptor.d.ts.map +1 -1
- package/lib/src/app/samples/descriptor/testDescriptors.d.ts +7 -0
- package/lib/src/app/samples/descriptor/testDescriptors.d.ts.map +1 -0
- package/lib/src/app/samples/descriptor/types.d.ts +3 -2
- package/lib/src/app/samples/descriptor/types.d.ts.map +1 -1
- package/lib/src/app/samples/error/error.d.ts +1 -1
- package/lib/src/app/samples/error/error.d.ts.map +1 -1
- package/lib/src/app/samples/header-v2/ScorePanel.d.ts.map +1 -1
- package/lib/src/app/samples/header-v2/ScoreValueDisplay.d.ts +1 -1
- package/lib/src/app/samples/header-v2/ScoreValueDisplay.d.ts.map +1 -1
- package/lib/src/app/samples/header-v2/scoreTone.d.ts +1 -1
- package/lib/src/app/samples/header-v2/scoreTone.d.ts.map +1 -1
- package/lib/src/app/samples/list/SamplesViewOptionsPopover.d.ts.map +1 -1
- package/lib/src/app/samples/list/samplesView.converters.d.ts.map +1 -1
- package/lib/src/app/samples/print/SamplePrintView.d.ts.map +1 -1
- package/lib/src/app/samples/retry-display/RetryTerminalAnchor.d.ts.map +1 -1
- package/lib/src/app/samples/sample-tools/SelectScorer.d.ts.map +1 -1
- package/lib/src/app/samples/sample-tools/filters.d.ts +1 -1
- package/lib/src/app/samples/sample-tools/filters.d.ts.map +1 -1
- package/lib/src/app/samples/sample-tools/sample-filter/completions.d.ts.map +1 -1
- package/lib/src/app/samples/scores/SampleScoresView.d.ts.map +1 -1
- package/lib/src/app/samples/status/status.d.ts +2 -2
- package/lib/src/app/samples/status/status.d.ts.map +1 -1
- package/lib/src/app/samples/transcript/TranscriptFilter.d.ts +2 -0
- package/lib/src/app/samples/transcript/TranscriptFilter.d.ts.map +1 -1
- package/lib/src/app/samples/transcript/TranscriptPanel.d.ts +3 -0
- package/lib/src/app/samples/transcript/TranscriptPanel.d.ts.map +1 -1
- package/lib/src/app/samples/transcript/chunked/ChunkedTranscriptPanel.d.ts.map +1 -1
- package/lib/src/app/samples/transcript/hooks.d.ts +1 -1
- package/lib/src/app/samples/transcript/hooks.d.ts.map +1 -1
- package/lib/src/app/samples-panel/SampleDetailView.d.ts.map +1 -1
- package/lib/src/app/samples-panel/SamplesPanel.d.ts.map +1 -1
- package/lib/src/app/shared/ColumnSelectorPopover.d.ts.map +1 -1
- package/lib/src/app/shared/data-grid/DataGrid.d.ts +4 -4
- package/lib/src/app/shared/data-grid/DataGrid.d.ts.map +1 -1
- package/lib/src/app/shared/data-grid/columnTypes.d.ts +4 -3
- package/lib/src/app/shared/data-grid/columnTypes.d.ts.map +1 -1
- package/lib/src/app/shared/data-grid/findMatches.d.ts +3 -2
- package/lib/src/app/shared/data-grid/findMatches.d.ts.map +1 -1
- package/lib/src/app/shared/data-grid/tableFeatures.d.ts +10 -0
- package/lib/src/app/shared/data-grid/tableFeatures.d.ts.map +1 -0
- package/lib/src/app/shared/samples-grid/SamplesGrid.d.ts.map +1 -1
- package/lib/src/app/shared/samples-grid/colorScale.d.ts.map +1 -1
- package/lib/src/app/shared/samples-grid/columns.d.ts.map +1 -1
- package/lib/src/app/shared/samples-grid/types.d.ts +4 -3
- package/lib/src/app/shared/samples-grid/types.d.ts.map +1 -1
- package/lib/src/app/types.d.ts +2 -1
- package/lib/src/app/types.d.ts.map +1 -1
- package/lib/src/app_config/index.d.ts +1 -1
- package/lib/src/app_config/index.d.ts.map +1 -1
- package/lib/src/app_config/resolveBackend.d.ts.map +1 -1
- package/lib/src/client/api/client-api.d.ts.map +1 -1
- package/lib/src/client/api/static-http/api-static-http.d.ts.map +1 -1
- package/lib/src/client/api/static-http/fetch.d.ts.map +1 -1
- package/lib/src/client/api/testClientApi.d.ts +13 -0
- package/lib/src/client/api/testClientApi.d.ts.map +1 -0
- package/lib/src/client/api/types.d.ts +17 -8
- package/lib/src/client/api/types.d.ts.map +1 -1
- package/lib/src/client/api/view-server/api-view-server.d.ts.map +1 -1
- package/lib/src/client/database/schema.d.ts.map +1 -1
- package/lib/src/client/database/utils.d.ts.map +1 -1
- package/lib/src/client/remote/remoteLogFile.d.ts.map +1 -1
- package/lib/src/client/remote/zstd-worker.d.ts.map +1 -1
- package/lib/src/client/utils/derive.d.ts.map +1 -1
- package/lib/src/client/utils/normalize.d.ts +23 -0
- package/lib/src/client/utils/normalize.d.ts.map +1 -0
- package/lib/src/client/utils/type-utils.d.ts.map +1 -1
- package/lib/src/components/DownloadButton.d.ts.map +1 -1
- package/lib/src/components/DownloadLogButton.d.ts.map +1 -1
- package/lib/src/components/DownloadPanel.d.ts.map +1 -1
- package/lib/src/components/MessageBand.d.ts.map +1 -1
- package/lib/src/embed.d.ts +26 -0
- package/lib/src/embed.d.ts.map +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/log_data/chunked/syntheticEvents.d.ts.map +1 -1
- package/lib/src/log_data/chunkedAttachments.d.ts +9 -2
- package/lib/src/log_data/chunkedAttachments.d.ts.map +1 -1
- package/lib/src/log_data/chunkedSampleQuery.d.ts.map +1 -1
- package/lib/src/log_data/fetchEngine.d.ts +5 -5
- package/lib/src/log_data/listingSync.d.ts.map +1 -1
- package/lib/src/log_data/logsListingRead.d.ts.map +1 -1
- package/lib/src/log_data/messagesExport.d.ts.map +1 -1
- package/lib/src/log_data/sampleData.d.ts.map +1 -1
- package/lib/src/log_data/sampleFetch.d.ts +5 -2
- package/lib/src/log_data/sampleFetch.d.ts.map +1 -1
- package/lib/src/log_data/sampleStream.d.ts.map +1 -1
- package/lib/src/log_data/scoreSchema.d.ts.map +1 -1
- package/lib/src/log_data/testFixtures.d.ts +11 -2
- package/lib/src/log_data/testFixtures.d.ts.map +1 -1
- package/lib/src/scoring/headline.d.ts +20 -0
- package/lib/src/scoring/headline.d.ts.map +1 -0
- package/lib/src/scoring/metrics.d.ts +9 -13
- package/lib/src/scoring/metrics.d.ts.map +1 -1
- package/lib/src/scoring/scores.d.ts +8 -0
- package/lib/src/scoring/scores.d.ts.map +1 -1
- package/lib/src/scoring/types.d.ts +12 -0
- package/lib/src/scoring/types.d.ts.map +1 -1
- package/lib/src/state/appSlice.d.ts.map +1 -1
- package/lib/src/state/hooks.d.ts +110 -1
- package/lib/src/state/hooks.d.ts.map +1 -1
- package/lib/src/state/logSlice.d.ts.map +1 -1
- package/lib/src/state/logsSlice.d.ts.map +1 -1
- package/lib/src/state/sampleSlice.d.ts +1 -1
- package/lib/src/state/sampleSlice.d.ts.map +1 -1
- package/lib/src/state/store.d.ts.map +1 -1
- package/lib/src/state/testStore.d.ts +3 -0
- package/lib/src/state/testStore.d.ts.map +1 -0
- package/lib/src/utils/attachments.d.ts.map +1 -1
- package/lib/src/utils/evalModel.d.ts +3 -1
- package/lib/src/utils/evalModel.d.ts.map +1 -1
- package/lib/src/utils/workQueue.d.ts +5 -0
- package/lib/src/utils/workQueue.d.ts.map +1 -1
- package/lib/styles/index.css +3830 -4411
- package/package.json +19 -24
- package/lib/AsciinemaPlayerImpl-D25m6trA.js.map +0 -1
- package/lib/src/app/log-list/listing/combineFilters.d.ts +0 -10
- package/lib/src/app/log-list/listing/combineFilters.d.ts.map +0 -1
- package/lib/src/app/plan/ModelCard.d.ts +0 -11
- package/lib/src/app/plan/ModelCard.d.ts.map +0 -1
- package/lib/src/components/ActivityBar.d.ts +0 -8
- package/lib/src/components/ActivityBar.d.ts.map +0 -1
- package/lib/src/components/AsciinemaPlayer.d.ts +0 -20
- package/lib/src/components/AsciinemaPlayer.d.ts.map +0 -1
- package/lib/src/utils/react.d.ts +0 -2
- package/lib/src/utils/react.d.ts.map +0 -1
- package/lib/src/utils/uri.d.ts +0 -22
- package/lib/src/utils/uri.d.ts.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Inspect Log Viewer
|
|
2
|
+
|
|
3
|
+
React app for viewing eval logs produced by
|
|
4
|
+
[Inspect AI](https://inspect.aisi.org.uk/). It runs standalone (served by
|
|
5
|
+
`inspect view`), against statically hosted log directories, inside the
|
|
6
|
+
Inspect VS Code extension, and can be embedded in external applications via
|
|
7
|
+
the [`@meridianlabs/log-viewer`](https://www.npmjs.com/package/@meridianlabs/log-viewer)
|
|
8
|
+
npm package.
|
|
9
|
+
|
|
10
|
+
For repo setup (corepack, pnpm, install), see the
|
|
11
|
+
[root README](../../README.md).
|
|
12
|
+
|
|
13
|
+
## Development
|
|
14
|
+
|
|
15
|
+
Run commands from this directory, or from the repo root with
|
|
16
|
+
`pnpm <command> --filter=@meridianlabs/log-viewer` (the root scripts pass the
|
|
17
|
+
filter through to `turbo run`, preserving task dependencies — see
|
|
18
|
+
[scripts.md](../../docs/scripts.md)):
|
|
19
|
+
|
|
20
|
+
| Command | Description |
|
|
21
|
+
| ---------------- | ----------------------------------------- |
|
|
22
|
+
| `pnpm dev` | Start the Vite dev server on :5173 |
|
|
23
|
+
| `pnpm build` | Build the bundled app |
|
|
24
|
+
| `pnpm build:lib` | Build the embeddable library into `lib/` |
|
|
25
|
+
| `pnpm test` | Run unit/integration tests (vitest) |
|
|
26
|
+
| `pnpm e2e` | Run Playwright e2e tests |
|
|
27
|
+
| `pnpm check-all` | Type check, lint, format, test, and build |
|
|
28
|
+
|
|
29
|
+
Built output is not committed; the library is built at publish time
|
|
30
|
+
(`prepublishOnly`).
|
|
31
|
+
|
|
32
|
+
You may optionally set the `VIEW_SERVER_API_URL` environment variable at
|
|
33
|
+
build time to use an API server running on a different host.
|
|
34
|
+
|
|
35
|
+
## Embedding (`@meridianlabs/log-viewer`)
|
|
36
|
+
|
|
37
|
+
> **Versioning disclaimer**: this package does NOT use semantic versioning.
|
|
38
|
+
> The public surface evolves with the host application's needs — expect
|
|
39
|
+
> breaking changes in any release and adapt accordingly.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install @meridianlabs/log-viewer
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The viewer requires its bundled CSS:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import "@meridianlabs/log-viewer/styles/index.css";
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example Usage
|
|
52
|
+
|
|
53
|
+
An embedder installs a per-dir API factory with `setApiFactory` **before**
|
|
54
|
+
initializing the store and rendering `<App />`. The viewer resolves the log
|
|
55
|
+
directory (from `initialLogDir` or a `?log_dir=` URL param), calls your
|
|
56
|
+
factory with it, and renders:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import {
|
|
60
|
+
App,
|
|
61
|
+
clientApi,
|
|
62
|
+
createViewServerApi,
|
|
63
|
+
initializeStore,
|
|
64
|
+
setApiFactory,
|
|
65
|
+
} from "@meridianlabs/log-viewer";
|
|
66
|
+
import type { Capabilities } from "@meridianlabs/log-viewer";
|
|
67
|
+
|
|
68
|
+
import "@meridianlabs/log-viewer/styles/index.css";
|
|
69
|
+
|
|
70
|
+
// Install the API factory first — installing after the backend has
|
|
71
|
+
// resolved throws.
|
|
72
|
+
setApiFactory(
|
|
73
|
+
(logDir) =>
|
|
74
|
+
clientApi(
|
|
75
|
+
createViewServerApi({
|
|
76
|
+
logDir,
|
|
77
|
+
// Optional transport options: apiBaseUrl, headerProvider, customFetch
|
|
78
|
+
apiBaseUrl: "https://mycompany.com/api",
|
|
79
|
+
})
|
|
80
|
+
),
|
|
81
|
+
"s3://my-bucket/logs" // initialLogDir; omit to require ?log_dir= in the URL
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const capabilities: Capabilities = {
|
|
85
|
+
downloadFiles: true,
|
|
86
|
+
downloadLogs: false,
|
|
87
|
+
webWorkers: true,
|
|
88
|
+
streamSamples: false,
|
|
89
|
+
};
|
|
90
|
+
initializeStore(capabilities);
|
|
91
|
+
|
|
92
|
+
export function MyApp() {
|
|
93
|
+
return <App />;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
To re-point the viewer at a different log directory after boot, call
|
|
98
|
+
`setLogRoot(dir)` — it rebuilds the API through the same factory.
|
|
99
|
+
|
|
100
|
+
### Embedder chrome
|
|
101
|
+
|
|
102
|
+
If your own UI (rendered as a sibling of `<App />`, not a descendant) calls
|
|
103
|
+
the viewer's selection hooks (`useSelectedSampleSummary`,
|
|
104
|
+
`useSelectedScores`, `useLogSelection`), wrap that chrome in
|
|
105
|
+
`<InspectQueryClientProvider>` so the hooks resolve the viewer's
|
|
106
|
+
react-query client, and gate it on `useViewerReady()` — the hooks throw
|
|
107
|
+
before the viewer's app config resolves.
|
|
108
|
+
|
|
109
|
+
See [src/index.ts](src/index.ts) for the full public surface.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
3
4
|
//#region ../../node_modules/.pnpm/asciinema-player@3.17.0/node_modules/asciinema-player/dist/logging-DeB0koVt.js
|
|
4
5
|
function parseNpt(time) {
|
|
5
6
|
if (typeof time === "number") return time;
|
|
@@ -2961,25 +2962,29 @@ var PARSERS = /* @__PURE__ */ new Map([
|
|
|
2961
2962
|
]);
|
|
2962
2963
|
function getDriver(src) {
|
|
2963
2964
|
if (typeof src === "function") return src;
|
|
2964
|
-
if (typeof src === "string")
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2965
|
+
if (typeof src === "string") {
|
|
2966
|
+
if (src.substring(0, 5) == "ws://" || src.substring(0, 6) == "wss://") src = {
|
|
2967
|
+
driver: "websocket",
|
|
2968
|
+
url: src
|
|
2969
|
+
};
|
|
2970
|
+
else if (src.substring(0, 6) == "clock:") src = { driver: "clock" };
|
|
2971
|
+
else if (src.substring(0, 7) == "random:") src = { driver: "random" };
|
|
2972
|
+
else if (src.substring(0, 10) == "benchmark:") src = {
|
|
2973
|
+
driver: "benchmark",
|
|
2974
|
+
url: src.substring(10)
|
|
2975
|
+
};
|
|
2976
|
+
else src = {
|
|
2977
|
+
driver: "recording",
|
|
2978
|
+
url: src
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2978
2981
|
if (src.driver === void 0) src.driver = "recording";
|
|
2979
2982
|
if (src.driver == "recording") {
|
|
2980
2983
|
if (src.format !== "segmented" && src.parser === void 0) src.parser = "asciicast";
|
|
2981
|
-
if (typeof src.parser === "string")
|
|
2982
|
-
|
|
2984
|
+
if (typeof src.parser === "string") {
|
|
2985
|
+
if (PARSERS.has(src.parser)) src.parser = PARSERS.get(src.parser);
|
|
2986
|
+
else throw new Error(`unknown parser: ${src.parser}`);
|
|
2987
|
+
}
|
|
2983
2988
|
}
|
|
2984
2989
|
if (DRIVERS.has(src.driver)) {
|
|
2985
2990
|
const driver = DRIVERS.get(src.driver);
|
|
@@ -3102,12 +3107,14 @@ function children(fn) {
|
|
|
3102
3107
|
return memo;
|
|
3103
3108
|
}
|
|
3104
3109
|
function readSignal() {
|
|
3105
|
-
if (this.sources && this.state)
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3110
|
+
if (this.sources && this.state) {
|
|
3111
|
+
if (this.state === STALE) updateComputation(this);
|
|
3112
|
+
else {
|
|
3113
|
+
const updates = Updates;
|
|
3114
|
+
Updates = null;
|
|
3115
|
+
runUpdates(() => lookUpstream(this), false);
|
|
3116
|
+
Updates = updates;
|
|
3117
|
+
}
|
|
3111
3118
|
}
|
|
3112
3119
|
if (Listener) {
|
|
3113
3120
|
const sSlot = this.observers ? this.observers.length : 0;
|
|
@@ -3195,8 +3202,10 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
3195
3202
|
pure
|
|
3196
3203
|
};
|
|
3197
3204
|
if (Owner === null);
|
|
3198
|
-
else if (Owner !== UNOWNED)
|
|
3199
|
-
|
|
3205
|
+
else if (Owner !== UNOWNED) {
|
|
3206
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
3207
|
+
else Owner.owned.push(c);
|
|
3208
|
+
}
|
|
3200
3209
|
return c;
|
|
3201
3210
|
}
|
|
3202
3211
|
function runTop(node) {
|
|
@@ -3502,18 +3511,19 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
3502
3511
|
while (i < bEnd) map.set(b[i], i++);
|
|
3503
3512
|
}
|
|
3504
3513
|
const index = map.get(a[aStart]);
|
|
3505
|
-
if (index != null)
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3514
|
+
if (index != null) {
|
|
3515
|
+
if (bStart < index && index < bEnd) {
|
|
3516
|
+
let i = aStart, sequence = 1, t;
|
|
3517
|
+
while (++i < aEnd && i < bEnd) {
|
|
3518
|
+
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
3519
|
+
sequence++;
|
|
3520
|
+
}
|
|
3521
|
+
if (sequence > index - bStart) {
|
|
3522
|
+
const node = a[aStart];
|
|
3523
|
+
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
3524
|
+
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
3525
|
+
} else aStart++;
|
|
3526
|
+
} else a[aStart++].remove();
|
|
3517
3527
|
}
|
|
3518
3528
|
}
|
|
3519
3529
|
}
|
|
@@ -3672,9 +3682,10 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
3672
3682
|
if (array.length === 0) {
|
|
3673
3683
|
current = cleanChildren(parent, current, marker);
|
|
3674
3684
|
if (multi) return current;
|
|
3675
|
-
} else if (currentArray)
|
|
3676
|
-
|
|
3677
|
-
|
|
3685
|
+
} else if (currentArray) {
|
|
3686
|
+
if (current.length === 0) appendNodes(parent, array, marker);
|
|
3687
|
+
else reconcileArrays(parent, current, array);
|
|
3688
|
+
} else {
|
|
3678
3689
|
current && cleanChildren(parent);
|
|
3679
3690
|
appendNodes(parent, array);
|
|
3680
3691
|
}
|
|
@@ -3696,14 +3707,15 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
3696
3707
|
if (item == null || item === true || item === false);
|
|
3697
3708
|
else if ((t = typeof item) === "object" && item.nodeType) normalized.push(item);
|
|
3698
3709
|
else if (Array.isArray(item)) dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
3699
|
-
else if (t === "function")
|
|
3700
|
-
|
|
3701
|
-
|
|
3710
|
+
else if (t === "function") {
|
|
3711
|
+
if (unwrap) {
|
|
3712
|
+
while (typeof item === "function") item = item();
|
|
3713
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
3714
|
+
} else {
|
|
3715
|
+
normalized.push(item);
|
|
3716
|
+
dynamic = true;
|
|
3717
|
+
}
|
|
3702
3718
|
} else {
|
|
3703
|
-
normalized.push(item);
|
|
3704
|
-
dynamic = true;
|
|
3705
|
-
}
|
|
3706
|
-
else {
|
|
3707
3719
|
const value = String(item);
|
|
3708
3720
|
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
3709
3721
|
else normalized.push(document.createTextNode(value));
|
|
@@ -4217,16 +4229,20 @@ function __wbg_finalize_init(instance, module) {
|
|
|
4217
4229
|
}
|
|
4218
4230
|
function initSync(module) {
|
|
4219
4231
|
if (wasm !== void 0) return wasm;
|
|
4220
|
-
if (typeof module !== "undefined")
|
|
4221
|
-
|
|
4232
|
+
if (typeof module !== "undefined") {
|
|
4233
|
+
if (Object.getPrototypeOf(module) === Object.prototype) ({module} = module);
|
|
4234
|
+
else console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
|
|
4235
|
+
}
|
|
4222
4236
|
const imports = __wbg_get_imports();
|
|
4223
4237
|
if (!(module instanceof WebAssembly.Module)) module = new WebAssembly.Module(module);
|
|
4224
4238
|
return __wbg_finalize_init(new WebAssembly.Instance(module, imports), module);
|
|
4225
4239
|
}
|
|
4226
4240
|
async function __wbg_init(module_or_path) {
|
|
4227
4241
|
if (wasm !== void 0) return wasm;
|
|
4228
|
-
if (typeof module_or_path !== "undefined")
|
|
4229
|
-
|
|
4242
|
+
if (typeof module_or_path !== "undefined") {
|
|
4243
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) ({module_or_path} = module_or_path);
|
|
4244
|
+
else console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
4245
|
+
}
|
|
4230
4246
|
const imports = __wbg_get_imports();
|
|
4231
4247
|
if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) module_or_path = fetch(module_or_path);
|
|
4232
4248
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
@@ -6124,8 +6140,10 @@ var Player = (props) => {
|
|
|
6124
6140
|
const terminalH = charH * terminalRows() + bordersH;
|
|
6125
6141
|
let fit = props.fit ?? "width";
|
|
6126
6142
|
const currentContainerSize = containerSize();
|
|
6127
|
-
if (fit === "both" || isFullscreen())
|
|
6128
|
-
|
|
6143
|
+
if (fit === "both" || isFullscreen()) {
|
|
6144
|
+
if (currentContainerSize.width / (currentContainerSize.height - controlBarHeight()) > terminalW / terminalH) fit = "height";
|
|
6145
|
+
else fit = "width";
|
|
6146
|
+
}
|
|
6129
6147
|
if (fit === false || fit === "none") return {};
|
|
6130
6148
|
else if (fit === "width") {
|
|
6131
6149
|
const scale = currentContainerSize.width / terminalW;
|
|
@@ -6178,11 +6196,13 @@ var Player = (props) => {
|
|
|
6178
6196
|
core.seek(`${pos * 100}%`);
|
|
6179
6197
|
} else if (e.key == "?") toggleHelp();
|
|
6180
6198
|
else if (e.key == "k") toggleKeystrokeOverlay();
|
|
6181
|
-
else if (e.key == "ArrowLeft")
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
else
|
|
6185
|
-
|
|
6199
|
+
else if (e.key == "ArrowLeft") {
|
|
6200
|
+
if (e.shiftKey) core.seek("<<<");
|
|
6201
|
+
else core.seek("<<");
|
|
6202
|
+
} else if (e.key == "ArrowRight") {
|
|
6203
|
+
if (e.shiftKey) core.seek(">>>");
|
|
6204
|
+
else core.seek(">>");
|
|
6205
|
+
} else if (e.key == "Escape") setIsHelpVisible(false);
|
|
6186
6206
|
else return;
|
|
6187
6207
|
e.stopPropagation();
|
|
6188
6208
|
e.preventDefault();
|
|
@@ -6218,10 +6238,12 @@ var Player = (props) => {
|
|
|
6218
6238
|
const embeddedTheme = createMemo(() => preferEmbeddedTheme ? originalTheme() : null);
|
|
6219
6239
|
const playerStyle = () => {
|
|
6220
6240
|
const style = {};
|
|
6221
|
-
if ((props.fit === false || props.fit === "none") && props.terminalFontSize !== void 0)
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6241
|
+
if ((props.fit === false || props.fit === "none") && props.terminalFontSize !== void 0) {
|
|
6242
|
+
if (props.terminalFontSize === "small") style["font-size"] = "12px";
|
|
6243
|
+
else if (props.terminalFontSize === "medium") style["font-size"] = "18px";
|
|
6244
|
+
else if (props.terminalFontSize === "big") style["font-size"] = "24px";
|
|
6245
|
+
else style["font-size"] = props.terminalFontSize;
|
|
6246
|
+
}
|
|
6225
6247
|
const size = terminalElementSize();
|
|
6226
6248
|
if (size.width !== void 0) {
|
|
6227
6249
|
style["width"] = `${size.width}px`;
|
|
@@ -6594,18 +6616,42 @@ function create(src, elem, opts = {}) {
|
|
|
6594
6616
|
}
|
|
6595
6617
|
//#endregion
|
|
6596
6618
|
//#region ../../packages/react/src/components/AsciinemaPlayerImpl.tsx
|
|
6597
|
-
var AsciinemaPlayerImpl = (
|
|
6619
|
+
var AsciinemaPlayerImpl = (t0) => {
|
|
6620
|
+
const $ = c(18);
|
|
6621
|
+
const { id, rows, cols, inputUrl, outputUrl, timingUrl, fit, speed, autoPlay, loop, theme, idleTimeLimit: t1, style } = t0;
|
|
6622
|
+
const idleTimeLimit = t1 === void 0 ? 2 : t1;
|
|
6598
6623
|
const playerContainerRef = useRef(null);
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6624
|
+
let t2;
|
|
6625
|
+
let t3;
|
|
6626
|
+
if ($[0] !== autoPlay || $[1] !== cols || $[2] !== fit || $[3] !== idleTimeLimit || $[4] !== inputUrl || $[5] !== loop || $[6] !== outputUrl || $[7] !== rows || $[8] !== speed || $[9] !== theme || $[10] !== timingUrl) {
|
|
6627
|
+
t2 = () => {
|
|
6628
|
+
if (!playerContainerRef.current) return;
|
|
6629
|
+
const player = create({
|
|
6630
|
+
url: [
|
|
6631
|
+
timingUrl,
|
|
6632
|
+
outputUrl,
|
|
6633
|
+
inputUrl
|
|
6634
|
+
],
|
|
6635
|
+
parser: "typescript"
|
|
6636
|
+
}, playerContainerRef.current, {
|
|
6637
|
+
rows,
|
|
6638
|
+
cols,
|
|
6639
|
+
autoPlay,
|
|
6640
|
+
loop,
|
|
6641
|
+
theme,
|
|
6642
|
+
speed,
|
|
6643
|
+
idleTimeLimit,
|
|
6644
|
+
fit
|
|
6645
|
+
});
|
|
6646
|
+
player.play();
|
|
6647
|
+
return () => {
|
|
6648
|
+
player.dispose();
|
|
6649
|
+
};
|
|
6650
|
+
};
|
|
6651
|
+
t3 = [
|
|
6652
|
+
timingUrl,
|
|
6653
|
+
outputUrl,
|
|
6654
|
+
inputUrl,
|
|
6609
6655
|
rows,
|
|
6610
6656
|
cols,
|
|
6611
6657
|
autoPlay,
|
|
@@ -6614,31 +6660,46 @@ var AsciinemaPlayerImpl = ({ id, rows, cols, inputUrl, outputUrl, timingUrl, fit
|
|
|
6614
6660
|
speed,
|
|
6615
6661
|
idleTimeLimit,
|
|
6616
6662
|
fit
|
|
6663
|
+
];
|
|
6664
|
+
$[0] = autoPlay;
|
|
6665
|
+
$[1] = cols;
|
|
6666
|
+
$[2] = fit;
|
|
6667
|
+
$[3] = idleTimeLimit;
|
|
6668
|
+
$[4] = inputUrl;
|
|
6669
|
+
$[5] = loop;
|
|
6670
|
+
$[6] = outputUrl;
|
|
6671
|
+
$[7] = rows;
|
|
6672
|
+
$[8] = speed;
|
|
6673
|
+
$[9] = theme;
|
|
6674
|
+
$[10] = timingUrl;
|
|
6675
|
+
$[11] = t2;
|
|
6676
|
+
$[12] = t3;
|
|
6677
|
+
} else {
|
|
6678
|
+
t2 = $[11];
|
|
6679
|
+
t3 = $[12];
|
|
6680
|
+
}
|
|
6681
|
+
useEffect(t2, t3);
|
|
6682
|
+
const t4 = `asciinema-player-${id || "default"}`;
|
|
6683
|
+
let t5;
|
|
6684
|
+
if ($[13] !== style) {
|
|
6685
|
+
t5 = { ...style };
|
|
6686
|
+
$[13] = style;
|
|
6687
|
+
$[14] = t5;
|
|
6688
|
+
} else t5 = $[14];
|
|
6689
|
+
let t6;
|
|
6690
|
+
if ($[15] !== t4 || $[16] !== t5) {
|
|
6691
|
+
t6 = /*#__PURE__*/ jsx("div", {
|
|
6692
|
+
id: t4,
|
|
6693
|
+
ref: playerContainerRef,
|
|
6694
|
+
style: t5
|
|
6617
6695
|
});
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
timingUrl,
|
|
6624
|
-
outputUrl,
|
|
6625
|
-
inputUrl,
|
|
6626
|
-
rows,
|
|
6627
|
-
cols,
|
|
6628
|
-
autoPlay,
|
|
6629
|
-
loop,
|
|
6630
|
-
theme,
|
|
6631
|
-
speed,
|
|
6632
|
-
idleTimeLimit,
|
|
6633
|
-
fit
|
|
6634
|
-
]);
|
|
6635
|
-
return /* @__PURE__ */ jsx("div", {
|
|
6636
|
-
id: `asciinema-player-${id || "default"}`,
|
|
6637
|
-
ref: playerContainerRef,
|
|
6638
|
-
style: { ...style }
|
|
6639
|
-
});
|
|
6696
|
+
$[15] = t4;
|
|
6697
|
+
$[16] = t5;
|
|
6698
|
+
$[17] = t6;
|
|
6699
|
+
} else t6 = $[17];
|
|
6700
|
+
return t6;
|
|
6640
6701
|
};
|
|
6641
6702
|
//#endregion
|
|
6642
6703
|
export { AsciinemaPlayerImpl as default };
|
|
6643
6704
|
|
|
6644
|
-
//# sourceMappingURL=AsciinemaPlayerImpl-
|
|
6705
|
+
//# sourceMappingURL=AsciinemaPlayerImpl-BG5NPs0z.js.map
|