@opengeni/react 1.0.1 → 1.0.2-canary.37202341988001
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 +660 -21
- package/dist/accounts.d.ts +64 -0
- package/dist/accounts.js +822 -0
- package/dist/accounts.js.map +1 -0
- package/dist/approvals.d.ts +2 -1
- package/dist/artifacts-document.js +3 -2
- package/dist/artifacts-presentation.js +3 -2
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +4 -1
- package/dist/artifacts.js +518 -42
- package/dist/artifacts.js.map +1 -1
- package/dist/browser-viewer-SHYKQRNX.js +16 -0
- package/dist/capability-catalog-row.d.ts +20 -0
- package/dist/capability-logo-fallback.d.ts +3 -0
- package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
- package/dist/chat-interactive-block-UGBTNB3L.js.map +1 -0
- package/dist/chunk-26ZNDDLZ.js +453 -0
- package/dist/chunk-26ZNDDLZ.js.map +1 -0
- package/dist/chunk-3CTRFMAK.js +359 -0
- package/dist/chunk-3CTRFMAK.js.map +1 -0
- package/dist/chunk-447JLCBU.js +209 -0
- package/dist/chunk-447JLCBU.js.map +1 -0
- package/dist/chunk-4RVYOY4O.js +379 -0
- package/dist/chunk-4RVYOY4O.js.map +1 -0
- package/dist/chunk-5CVXZA3Y.js +292 -0
- package/dist/chunk-5CVXZA3Y.js.map +1 -0
- package/dist/chunk-5J4FOW6Q.js +108 -0
- package/dist/chunk-5J4FOW6Q.js.map +1 -0
- package/dist/chunk-742CZ3L3.js +481 -0
- package/dist/chunk-742CZ3L3.js.map +1 -0
- package/dist/chunk-A2PI6UMY.js +41 -0
- package/dist/chunk-A2PI6UMY.js.map +1 -0
- package/dist/{chunk-7WCLAEFV.js → chunk-A4UJB2MM.js} +37 -27
- package/dist/chunk-A4UJB2MM.js.map +1 -0
- package/dist/chunk-B3V6TG77.js +41 -0
- package/dist/chunk-B3V6TG77.js.map +1 -0
- package/dist/chunk-BRM6FVZA.js +302 -0
- package/dist/chunk-BRM6FVZA.js.map +1 -0
- package/dist/chunk-C5X5AJXK.js +182 -0
- package/dist/chunk-C5X5AJXK.js.map +1 -0
- package/dist/{chunk-6KLX2RH5.js → chunk-DO544OSV.js} +1075 -79
- package/dist/chunk-DO544OSV.js.map +1 -0
- package/dist/{chunk-R3AZOAB5.js → chunk-DYWBUX5Q.js} +29 -123
- package/dist/chunk-DYWBUX5Q.js.map +1 -0
- package/dist/{chunk-HA46CYQK.js → chunk-EESD3PY3.js} +792 -537
- package/dist/chunk-EESD3PY3.js.map +1 -0
- package/dist/{chunk-5UQPNLIO.js → chunk-EN3YTHKR.js} +4117 -3896
- package/dist/chunk-EN3YTHKR.js.map +1 -0
- package/dist/chunk-ERGYJIBB.js +21 -0
- package/dist/chunk-ERGYJIBB.js.map +1 -0
- package/dist/chunk-FZCP527Y.js +116 -0
- package/dist/chunk-FZCP527Y.js.map +1 -0
- package/dist/chunk-GIMRELBW.js +14 -0
- package/dist/chunk-GIMRELBW.js.map +1 -0
- package/dist/chunk-GYVRFZDY.js +2733 -0
- package/dist/chunk-GYVRFZDY.js.map +1 -0
- package/dist/{chunk-LLOLUHVG.js → chunk-HDJWDK7W.js} +1358 -2746
- package/dist/chunk-HDJWDK7W.js.map +1 -0
- package/dist/chunk-I7IWRQLN.js +1608 -0
- package/dist/chunk-I7IWRQLN.js.map +1 -0
- package/dist/chunk-IT4BJUGF.js +13055 -0
- package/dist/chunk-IT4BJUGF.js.map +1 -0
- package/dist/chunk-IWIDV7SB.js +1 -0
- package/dist/chunk-IWIDV7SB.js.map +1 -0
- package/dist/chunk-J2QWVSQY.js +312 -0
- package/dist/chunk-J2QWVSQY.js.map +1 -0
- package/dist/chunk-J6DBS4T3.js +371 -0
- package/dist/chunk-J6DBS4T3.js.map +1 -0
- package/dist/{chunk-B6WPZSTT.js → chunk-JIQYUGVL.js} +1331 -1163
- package/dist/chunk-JIQYUGVL.js.map +1 -0
- package/dist/chunk-JT4JW7BC.js +54 -0
- package/dist/chunk-JT4JW7BC.js.map +1 -0
- package/dist/chunk-K3HQAKQX.js +24 -0
- package/dist/chunk-K3HQAKQX.js.map +1 -0
- package/dist/{chunk-PEI6RANI.js → chunk-PNY3JKBJ.js} +309 -74
- package/dist/chunk-PNY3JKBJ.js.map +1 -0
- package/dist/chunk-RHREZ7BO.js +11 -0
- package/dist/chunk-RHREZ7BO.js.map +1 -0
- package/dist/chunk-RLUSC2WA.js +299 -0
- package/dist/chunk-RLUSC2WA.js.map +1 -0
- package/dist/{chunk-IGC6A2ZI.js → chunk-RSI7XYXL.js} +777 -246
- package/dist/chunk-RSI7XYXL.js.map +1 -0
- package/dist/chunk-SCOTPE2I.js +589 -0
- package/dist/chunk-SCOTPE2I.js.map +1 -0
- package/dist/{chunk-C5ZPSSS5.js → chunk-TKOTKRWY.js} +5 -4
- package/dist/{chunk-C5ZPSSS5.js.map → chunk-TKOTKRWY.js.map} +1 -1
- package/dist/chunk-TMYGL6X5.js +742 -0
- package/dist/chunk-TMYGL6X5.js.map +1 -0
- package/dist/chunk-UGLEYEMP.js +33 -0
- package/dist/chunk-UGLEYEMP.js.map +1 -0
- package/dist/chunk-UK4TINKT.js +27 -0
- package/dist/chunk-UK4TINKT.js.map +1 -0
- package/dist/chunk-UTRTG6LH.js +220 -0
- package/dist/chunk-UTRTG6LH.js.map +1 -0
- package/dist/chunk-WEHMPOXK.js +39 -0
- package/dist/chunk-WEHMPOXK.js.map +1 -0
- package/dist/chunk-WGXVEJO5.js +319 -0
- package/dist/chunk-WGXVEJO5.js.map +1 -0
- package/dist/chunk-WRHIZYZF.js +988 -0
- package/dist/chunk-WRHIZYZF.js.map +1 -0
- package/dist/{chunk-HUIKIDM5.js → chunk-WUISZ3WU.js} +223 -115
- package/dist/chunk-WUISZ3WU.js.map +1 -0
- package/dist/chunk-XCHWDJ22.js +107 -0
- package/dist/chunk-XCHWDJ22.js.map +1 -0
- package/dist/{chunk-KCGXPP5V.js → chunk-Y2PRMYLC.js} +11 -6
- package/dist/chunk-Y2PRMYLC.js.map +1 -0
- package/dist/chunk-YBXQDQFX.js +1772 -0
- package/dist/chunk-YBXQDQFX.js.map +1 -0
- package/dist/chunk-YM2DE7BQ.js +3124 -0
- package/dist/chunk-YM2DE7BQ.js.map +1 -0
- package/dist/{chunk-KZ73RL76.js → chunk-YQEAA6LT.js} +7 -3
- package/dist/chunk-YQEAA6LT.js.map +1 -0
- package/dist/chunk-YV4L3ILF.js +9 -0
- package/dist/chunk-YV4L3ILF.js.map +1 -0
- package/dist/chunk-ZYRGEKWS.js +216 -0
- package/dist/chunk-ZYRGEKWS.js.map +1 -0
- package/dist/client.d.ts +7 -4
- package/dist/clipboard.js +1 -0
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/anthropic-mark.d.ts +3 -0
- package/dist/components/approval-surface.d.ts +15 -0
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
- package/dist/components/artifacts/artifact-surface.d.ts +3 -1
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/document-editor.d.ts +4 -2
- package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
- package/dist/components/artifacts/editable-document.d.ts +1 -1
- package/dist/components/artifacts/editable-presentation.d.ts +2 -2
- package/dist/components/artifacts/editable-spreadsheet.d.ts +2 -1
- package/dist/components/artifacts/index.d.ts +8 -1
- package/dist/components/artifacts/inline-html-document.d.ts +2 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/presentation-editor.d.ts +6 -2
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +48 -3
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +23 -0
- package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
- package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
- package/dist/components/browser-select-control.d.ts +16 -0
- package/dist/components/browser-viewer.d.ts +10 -1
- package/dist/components/chat-composer.d.ts +21 -3
- package/dist/components/child-session-link.d.ts +5 -0
- package/dist/components/claude-mark.d.ts +3 -0
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/composer.d.ts +45 -4
- package/dist/components/computer-viewer.d.ts +4 -1
- package/dist/components/copy-button.d.ts +3 -1
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/enrollment-consent.d.ts +6 -3
- package/dist/components/file-browser.d.ts +10 -1
- package/dist/components/fleet-tile.d.ts +2 -2
- package/dist/components/grok-mark.d.ts +26 -0
- package/dist/components/human-input-form.d.ts +21 -2
- package/dist/components/human-input-surface.d.ts +6 -3
- package/dist/components/machine-card.d.ts +4 -1
- package/dist/components/machines/machine-detail.d.ts +4 -1
- package/dist/components/machines/machine-operation-policy.d.ts +11 -0
- package/dist/components/machines-dashboard.d.ts +3 -1
- package/dist/components/markdown-table-layout.d.ts +12 -0
- package/dist/components/markdown.d.ts +47 -3
- package/dist/components/message-timeline.d.ts +72 -9
- package/dist/components/model-mark.d.ts +29 -0
- package/dist/components/model-policy-picker-menu.d.ts +9 -0
- package/dist/components/model-policy-picker.d.ts +62 -13
- package/dist/components/open-geni-chat.d.ts +58 -0
- package/dist/components/open-geni-links.d.ts +68 -0
- package/dist/components/openrouter-mark.d.ts +6 -0
- package/dist/components/pierre-file.d.ts +1 -1
- package/dist/components/preview-loading.d.ts +2 -0
- package/dist/components/queue-item-content.d.ts +9 -0
- package/dist/components/sandbox-files.d.ts +13 -2
- package/dist/components/sandbox-workspace.d.ts +43 -3
- package/dist/components/session-capability-frame.d.ts +35 -0
- package/dist/components/session-chrome.d.ts +66 -8
- package/dist/components/session-commands-panel.d.ts +6 -0
- package/dist/components/session-commands.d.ts +6 -0
- package/dist/components/session-connection-request.d.ts +8 -0
- package/dist/components/session-conversation.d.ts +89 -0
- package/dist/components/session-list.d.ts +36 -0
- package/dist/components/session-mcp-capability-card.d.ts +41 -0
- package/dist/components/session-proxy-scope.d.ts +21 -0
- package/dist/components/timeline-anchor.d.ts +24 -0
- package/dist/components/timeline-annotation-chrome.d.ts +25 -0
- package/dist/components/timeline-annotation-layout.d.ts +42 -0
- package/dist/components/timeline-annotation-markers.d.ts +8 -0
- package/dist/components/timeline-annotation-reveal-context.d.ts +4 -0
- package/dist/components/timeline-annotation-shared.d.ts +31 -0
- package/dist/components/timeline-annotations-dialog.d.ts +3 -2
- package/dist/components/timeline-annotations.d.ts +13 -3
- package/dist/components/timeline-reading-progress.d.ts +11 -0
- package/dist/components/timeline-search.d.ts +34 -0
- package/dist/components/timeline-settlement.d.ts +16 -0
- package/dist/components/tip-follow.d.ts +16 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
- package/dist/components/user-message-body.d.ts +10 -1
- package/dist/components/workspace-dock.d.ts +6 -2
- package/dist/composer.d.ts +5 -4
- package/dist/composer.js +15 -9
- package/dist/computer-viewer-6SRGWRUX.js +19 -0
- package/dist/computer-viewer-6SRGWRUX.js.map +1 -0
- package/dist/connect-account-identity.d.ts +8 -0
- package/dist/connect-accounts.d.ts +15 -0
- package/dist/connect-chooser.d.ts +18 -0
- package/dist/connect-panel.d.ts +18 -0
- package/dist/connect-setup.d.ts +16 -0
- package/dist/connect.d.ts +21 -0
- package/dist/connect.js +2129 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-catalog.d.ts +38 -0
- package/dist/connection-discovery.d.ts +12 -0
- package/dist/connection-installed.d.ts +17 -0
- package/dist/connection-logo.d.ts +9 -0
- package/dist/connection-service-logo.d.ts +8 -0
- package/dist/connection-service-presentation.d.ts +13 -0
- package/dist/connection-skeleton.d.ts +5 -0
- package/dist/connection-type-picker.d.ts +6 -0
- package/dist/conversation-timeline.d.ts +5 -0
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +26 -0
- package/dist/desktop.js.map +1 -0
- package/dist/device-authorization.d.ts +23 -0
- package/dist/diffs.d.ts +8 -0
- package/dist/diffs.js +14 -0
- package/dist/diffs.js.map +1 -0
- package/dist/discovery-cache.d.ts +5 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/embedded-session-client.d.ts +23 -0
- package/dist/file-node-visibility.d.ts +15 -0
- package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
- package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
- package/dist/hooks/channel-cache.d.ts +23 -0
- package/dist/hooks/latest-question.d.ts +25 -0
- package/dist/hooks/shared-machines-list.d.ts +14 -0
- package/dist/hooks/use-attached-browsers.d.ts +2 -1
- package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
- package/dist/hooks/use-browser-session.d.ts +12 -1
- package/dist/hooks/use-channels.d.ts +1 -0
- package/dist/hooks/use-codex-accounts.d.ts +25 -7
- package/dist/hooks/use-composer.d.ts +45 -9
- package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
- package/dist/hooks/use-computer-input-posture.d.ts +13 -0
- package/dist/hooks/use-computer-session.d.ts +2 -0
- package/dist/hooks/use-connect.d.ts +22 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-file-attachments.d.ts +21 -2
- package/dist/hooks/use-machine-chip.d.ts +3 -3
- package/dist/hooks/use-machines.d.ts +19 -1
- package/dist/hooks/use-sandbox-files.d.ts +5 -1
- package/dist/hooks/use-session-background-commands.d.ts +14 -0
- package/dist/hooks/use-session-events.d.ts +30 -8
- package/dist/hooks/use-session-lineage.d.ts +4 -0
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
- package/dist/hooks/use-session.d.ts +6 -0
- package/dist/hooks/use-turn-queue.d.ts +12 -0
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/hooks/use-workspace-edit.d.ts +4 -0
- package/dist/hooks/use-workspace-sessions.d.ts +27 -5
- package/dist/human-input.d.ts +3 -1
- package/dist/identity-link-accounts.d.ts +11 -0
- package/dist/identity-link-consent.d.ts +18 -0
- package/dist/index.d.ts +60 -17
- package/dist/index.js +2238 -6201
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.js +35 -184
- package/dist/interaction.js.map +1 -1
- package/dist/latest-question-HTRIS4KJ.js +117 -0
- package/dist/latest-question-HTRIS4KJ.js.map +1 -0
- package/dist/lib/error-message.d.ts +7 -0
- package/dist/lib/format.d.ts +36 -2
- package/dist/lib/host-theme.d.ts +70 -0
- package/dist/lib/interaction-errors.d.ts +6 -0
- package/dist/lib/menu-styles.d.ts +22 -0
- package/dist/lib/pierre-diffs-loader.d.ts +20 -0
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/lib/xterm-theme.d.ts +7 -5
- package/dist/machines.d.ts +4 -2
- package/dist/machines.js +14 -4
- package/dist/markdown-table-layout-QXSLK4BY.js +106 -0
- package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
- package/dist/mcp-connection-status.d.ts +14 -0
- package/dist/model-policy-picker-menu-M54ISBMN.js +14 -0
- package/dist/model-policy-picker-menu-M54ISBMN.js.map +1 -0
- package/dist/model-policy.d.ts +19 -3
- package/dist/model-policy.js +9 -1
- package/dist/older-history.d.ts +30 -0
- package/dist/platform-activity-row-627BFZ46.js +182 -0
- package/dist/platform-activity-row-627BFZ46.js.map +1 -0
- package/dist/plugin-details.d.ts +14 -0
- package/dist/plugin-discovery.d.ts +25 -0
- package/dist/provider.d.ts +13 -1
- package/dist/{queue-surface-implementation-2KVJTYXH.js → queue-surface-implementation-ZHFI5JBP.js} +131 -44
- package/dist/queue-surface-implementation-ZHFI5JBP.js.map +1 -0
- package/dist/realtime/realtime-control.d.ts +6 -3
- package/dist/realtime.js +133 -74
- package/dist/realtime.js.map +1 -1
- package/dist/sandbox-files-GORZOUUJ.js +20 -0
- package/dist/sandbox-files-GORZOUUJ.js.map +1 -0
- package/dist/session-auth-recommendation.d.ts +5 -0
- package/dist/session-capability-policy.d.ts +12 -0
- package/dist/session-ui.d.ts +30 -2
- package/dist/session-ui.js +85 -7
- package/dist/session-ui.js.map +1 -1
- package/dist/session.d.ts +8 -2
- package/dist/session.js +30 -19
- package/dist/sites-ui.d.ts +34 -0
- package/dist/sites.d.ts +3 -0
- package/dist/sites.js +11 -0
- package/dist/sites.js.map +1 -0
- package/dist/skill-discovery.d.ts +47 -0
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +31 -0
- package/dist/terminal.js.map +1 -0
- package/dist/timeline/activity-rail.d.ts +11 -2
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/compaction-copy.d.ts +10 -0
- package/dist/timeline/entrance.d.ts +13 -1
- package/dist/timeline/genie-loading.d.ts +34 -0
- package/dist/timeline/index.d.ts +6 -2
- package/dist/timeline/knowledge-receipt.d.ts +17 -0
- package/dist/timeline/platform-activity-row.d.ts +14 -0
- package/dist/timeline/presented-image.d.ts +6 -0
- package/dist/timeline/projection.d.ts +31 -2
- package/dist/timeline/registry.d.ts +2 -0
- package/dist/timeline/retained-image.d.ts +18 -0
- package/dist/timeline/rolling-activity.d.ts +11 -0
- package/dist/timeline/screenshot-lightbox.d.ts +16 -1
- package/dist/timeline/shared.d.ts +8 -3
- package/dist/timeline/startup-preference.d.ts +3 -0
- package/dist/timeline/startup-timings.d.ts +4 -0
- package/dist/timeline/tool-display-name.d.ts +2 -1
- package/dist/timeline/turn-summary.d.ts +34 -3
- package/dist/timeline/types.d.ts +147 -7
- package/dist/timeline-annotation-markers-GNDHTGBD.js +165 -0
- package/dist/timeline-annotation-markers-GNDHTGBD.js.map +1 -0
- package/dist/timeline-annotation-selection-DMLMM2TX.js +241 -0
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
- package/dist/timeline-annotations-dialog-ELRDBHTS.js +273 -0
- package/dist/timeline-annotations-dialog-ELRDBHTS.js.map +1 -0
- package/dist/types/machines.d.ts +2 -2
- package/dist/usage/allowance-copy.d.ts +25 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +1074 -0
- package/dist/usage.js.map +1 -0
- package/package.json +44 -4
- package/src/accounts.tsx +1072 -0
- package/src/approvals.ts +8 -1
- package/src/artifacts.ts +42 -0
- package/src/assets/README.md +8 -0
- package/src/assets/gmail.ico +0 -0
- package/src/assets/outlook.ico +0 -0
- package/src/capability-catalog-row.tsx +94 -0
- package/src/capability-logo-fallback.ts +22 -0
- package/src/client.ts +22 -13
- package/src/commands/registry.ts +18 -15
- package/src/commands/types.ts +2 -0
- package/src/components/anthropic-mark.tsx +10 -0
- package/src/components/approval-surface.tsx +171 -37
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +185 -0
- package/src/components/artifacts/artifact-surface.tsx +39 -19
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/document-editor.tsx +141 -16
- package/src/components/artifacts/editable-artifact-ui.tsx +4 -2
- package/src/components/artifacts/editable-artifact-view.tsx +187 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +37 -36
- package/src/components/artifacts/editable-presentation.tsx +36 -18
- package/src/components/artifacts/editable-spreadsheet.tsx +5 -2
- package/src/components/artifacts/index.ts +44 -0
- package/src/components/artifacts/inline-html-document.ts +24 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/presentation-editor.tsx +323 -67
- package/src/components/artifacts/published-html-artifact-frame.tsx +338 -5
- package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
- package/src/components/artifacts/site-view.tsx +116 -0
- package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
- package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +12 -13
- package/src/components/artifacts/visualization-assets/base.css +1015 -0
- package/src/components/artifacts/visualization-assets/helpers.html +349 -0
- package/src/components/artifacts/visualization-assets.gen.ts +3 -0
- package/src/components/browser-select-control.tsx +312 -0
- package/src/components/browser-viewer.tsx +1054 -314
- package/src/components/chat-composer.tsx +131 -85
- package/src/components/child-session-link.tsx +27 -0
- package/src/components/claude-mark.tsx +10 -0
- package/src/components/code-editor.tsx +13 -16
- package/src/components/composer-transcription-control.tsx +7 -5
- package/src/components/composer.tsx +376 -49
- package/src/components/computer-viewer.tsx +1041 -329
- package/src/components/copy-button.tsx +13 -5
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/enrollment-consent.tsx +65 -7
- package/src/components/enrollment-device-flow.tsx +1 -1
- package/src/components/file-browser.tsx +158 -34
- package/src/components/fleet-tile.tsx +8 -16
- package/src/components/generated-video-player.tsx +4 -2
- package/src/components/grok-mark.tsx +33 -0
- package/src/components/human-input-form.tsx +455 -114
- package/src/components/human-input-surface.tsx +18 -7
- package/src/components/interaction-intervention-banner.tsx +2 -2
- package/src/components/machine-card.tsx +119 -4
- package/src/components/machine-dock-bar.tsx +1 -1
- package/src/components/machine-input-display.ts +23 -2
- package/src/components/machines/machine-detail.tsx +52 -2
- package/src/components/machines/machine-operation-policy.tsx +179 -0
- package/src/components/machines-dashboard.tsx +8 -17
- package/src/components/markdown-table-layout.ts +132 -0
- package/src/components/markdown.tsx +473 -44
- package/src/components/message-timeline.tsx +2754 -665
- package/src/components/model-mark.tsx +90 -0
- package/src/components/model-picker.tsx +15 -4
- package/src/components/model-policy-picker-menu.tsx +424 -0
- package/src/components/model-policy-picker.tsx +337 -381
- package/src/components/open-geni-chat.tsx +338 -0
- package/src/components/open-geni-links.tsx +179 -0
- package/src/components/openrouter-mark.tsx +13 -0
- package/src/components/pierre-diff.tsx +41 -16
- package/src/components/pierre-file.tsx +36 -11
- package/src/components/preview-loading.tsx +154 -0
- package/src/components/queue-item-content.ts +14 -0
- package/src/components/queue-surface-implementation.tsx +132 -42
- package/src/components/queue-surface-state.tsx +3 -1
- package/src/components/sandbox-files.tsx +267 -35
- package/src/components/sandbox-terminal.tsx +48 -11
- package/src/components/sandbox-workspace.tsx +337 -135
- package/src/components/session-capability-frame.tsx +192 -0
- package/src/components/session-chrome.tsx +1027 -328
- package/src/components/session-commands-panel.tsx +126 -0
- package/src/components/session-commands.tsx +18 -0
- package/src/components/session-connection-request.tsx +97 -0
- package/src/components/session-conversation.tsx +526 -0
- package/src/components/session-list.tsx +250 -0
- package/src/components/session-mcp-capability-card.tsx +680 -0
- package/src/components/session-proxy-scope.tsx +92 -0
- package/src/components/session-status.tsx +1 -1
- package/src/components/timeline-anchor.tsx +119 -0
- package/src/components/timeline-annotation-chrome.tsx +196 -0
- package/src/components/timeline-annotation-layout.ts +268 -0
- package/src/components/timeline-annotation-markers.tsx +185 -0
- package/src/components/timeline-annotation-reveal-context.ts +9 -0
- package/src/components/timeline-annotation-selection.tsx +106 -54
- package/src/components/timeline-annotation-shared.ts +245 -0
- package/src/components/timeline-annotations-dialog.tsx +185 -128
- package/src/components/timeline-annotations.tsx +189 -45
- package/src/components/timeline-reading-progress.ts +80 -0
- package/src/components/timeline-search.tsx +168 -0
- package/src/components/timeline-settlement.ts +60 -0
- package/src/components/tip-follow.ts +70 -7
- package/src/components/tooltip.tsx +38 -5
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/components/use-viewer-menu-dismiss.ts +33 -0
- package/src/components/user-message-body.tsx +194 -49
- package/src/components/workspace-dock.tsx +141 -175
- package/src/composer.ts +6 -1
- package/src/connect-account-identity.tsx +34 -0
- package/src/connect-accounts.tsx +233 -0
- package/src/connect-chooser.tsx +336 -0
- package/src/connect-panel.tsx +99 -0
- package/src/connect-setup.tsx +307 -0
- package/src/connect.ts +60 -0
- package/src/connection-assets.d.ts +4 -0
- package/src/connection-catalog.tsx +162 -0
- package/src/connection-discovery.tsx +235 -0
- package/src/connection-installed.tsx +51 -0
- package/src/connection-logo.tsx +37 -0
- package/src/connection-service-logo.tsx +55 -0
- package/src/connection-service-presentation.ts +46 -0
- package/src/connection-skeleton.tsx +16 -0
- package/src/connection-type-picker.tsx +36 -0
- package/src/conversation-timeline.ts +92 -0
- package/src/desktop.ts +24 -0
- package/src/device-authorization.tsx +98 -0
- package/src/diffs.ts +16 -0
- package/src/discovery-cache.ts +42 -0
- package/src/editor.ts +13 -0
- package/src/embedded-session-client.ts +104 -0
- package/src/file-node-visibility.ts +66 -0
- package/src/hooks/channel-cache.ts +104 -0
- package/src/hooks/internal.ts +3 -2
- package/src/hooks/latest-question.ts +164 -0
- package/src/hooks/shared-machines-list.ts +239 -0
- package/src/hooks/use-attached-browsers.ts +5 -1
- package/src/hooks/use-available-models.ts +20 -14
- package/src/hooks/use-browser-frame-stream.ts +25 -3
- package/src/hooks/use-browser-session.ts +271 -71
- package/src/hooks/use-browser-sessions.ts +7 -1
- package/src/hooks/use-channels.ts +32 -10
- package/src/hooks/use-codex-accounts.ts +78 -21
- package/src/hooks/use-composer.ts +1034 -320
- package/src/hooks/use-computer-frame-stream.ts +39 -16
- package/src/hooks/use-computer-input-posture.ts +94 -0
- package/src/hooks/use-computer-session.ts +110 -32
- package/src/hooks/use-computer-sessions.ts +8 -1
- package/src/hooks/use-connect.ts +23 -0
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-file-attachments.ts +118 -10
- package/src/hooks/use-goal.ts +36 -9
- package/src/hooks/use-human-input.ts +31 -4
- package/src/hooks/use-last-started-turn-policy.ts +15 -13
- package/src/hooks/use-machine-chip.ts +23 -6
- package/src/hooks/use-machines.ts +104 -6
- package/src/hooks/use-sandbox-files.ts +253 -150
- package/src/hooks/use-sandbox-git.ts +58 -29
- package/src/hooks/use-session-background-commands.ts +67 -0
- package/src/hooks/use-session-capabilities.ts +21 -2
- package/src/hooks/use-session-events.ts +759 -433
- package/src/hooks/use-session-lineage.ts +28 -6
- package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
- package/src/hooks/use-session.ts +75 -16
- package/src/hooks/use-slash-commands.ts +6 -11
- package/src/hooks/use-turn-queue.ts +113 -13
- package/src/hooks/use-usage.ts +100 -0
- package/src/hooks/use-video-artifact-playback.ts +1 -1
- package/src/hooks/use-voice-input.ts +12 -1
- package/src/hooks/use-workspace-capture.ts +3 -2
- package/src/hooks/use-workspace-edit.ts +23 -5
- package/src/hooks/use-workspace-sessions.ts +99 -11
- package/src/human-input.ts +12 -1
- package/src/identity-link-accounts.tsx +148 -0
- package/src/identity-link-consent.tsx +192 -0
- package/src/index.ts +157 -12
- package/src/interaction.ts +1 -0
- package/src/lib/error-message.ts +37 -0
- package/src/lib/format.ts +150 -14
- package/src/lib/host-theme.ts +511 -0
- package/src/lib/interaction-errors.ts +33 -0
- package/src/lib/menu-styles.ts +44 -0
- package/src/lib/pierre-diffs-loader.ts +53 -0
- package/src/lib/workbench-peers.ts +62 -0
- package/src/lib/xterm-theme.ts +23 -21
- package/src/machines.ts +9 -1
- package/src/mcp-connection-status.ts +35 -0
- package/src/model-policy.ts +223 -69
- package/src/older-history.ts +87 -0
- package/src/plugin-details.tsx +185 -0
- package/src/plugin-discovery.tsx +196 -0
- package/src/provider.tsx +55 -14
- package/src/realtime/dropdown-menu.tsx +19 -12
- package/src/realtime/realtime-control.tsx +133 -46
- package/src/session-auth-recommendation.ts +48 -0
- package/src/session-capability-policy.ts +83 -0
- package/src/session-context.ts +4 -3
- package/src/session-ui.ts +66 -2
- package/src/session.ts +18 -1
- package/src/sites-ui.tsx +402 -0
- package/src/sites.ts +3 -0
- package/src/skill-discovery.tsx +208 -0
- package/src/terminal.ts +26 -0
- package/src/timeline/activity-rail.tsx +171 -80
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/compaction-copy.ts +42 -0
- package/src/timeline/entrance.tsx +28 -3
- package/src/timeline/fleet-decision-projection.ts +2 -1
- package/src/timeline/fleet-decision-row.tsx +1 -0
- package/src/timeline/genie-loading.tsx +136 -0
- package/src/timeline/index.ts +11 -0
- package/src/timeline/knowledge-receipt.tsx +100 -0
- package/src/timeline/parsers.ts +2 -2
- package/src/timeline/platform-activity-row.tsx +216 -0
- package/src/timeline/presented-image.ts +49 -0
- package/src/timeline/projection.ts +1609 -84
- package/src/timeline/registry.ts +15 -3
- package/src/timeline/retained-image.ts +97 -0
- package/src/timeline/rolling-activity.tsx +92 -0
- package/src/timeline/screenshot-lightbox.tsx +115 -17
- package/src/timeline/shared.tsx +47 -15
- package/src/timeline/startup-preference.ts +33 -0
- package/src/timeline/startup-timings.tsx +145 -0
- package/src/timeline/tool-display-name.ts +8 -6
- package/src/timeline/tool-renderers.tsx +497 -128
- package/src/timeline/turn-summary.tsx +218 -44
- package/src/timeline/types.ts +192 -7
- package/src/types/machines.ts +10 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +50 -0
- package/styles/compiled.css +2098 -757
- package/styles/connect.css +284 -0
- package/styles/connect.d.ts +1 -0
- package/styles/effective-tokens.css +1 -0
- package/styles/index.css +201 -9
- package/styles/responsive.css +27 -1
- package/styles/session-capability.css +44 -0
- package/styles/tokens.css +135 -65
- package/dist/chunk-5UQPNLIO.js.map +0 -1
- package/dist/chunk-6KLX2RH5.js.map +0 -1
- package/dist/chunk-7WCLAEFV.js.map +0 -1
- package/dist/chunk-B6WPZSTT.js.map +0 -1
- package/dist/chunk-FK6VG4LL.js +0 -90
- package/dist/chunk-FK6VG4LL.js.map +0 -1
- package/dist/chunk-HA46CYQK.js.map +0 -1
- package/dist/chunk-HUIKIDM5.js.map +0 -1
- package/dist/chunk-IGC6A2ZI.js.map +0 -1
- package/dist/chunk-KCGXPP5V.js.map +0 -1
- package/dist/chunk-KZ73RL76.js.map +0 -1
- package/dist/chunk-LAKLF4PA.js +0 -141
- package/dist/chunk-LAKLF4PA.js.map +0 -1
- package/dist/chunk-LLOLUHVG.js.map +0 -1
- package/dist/chunk-MKPIAGVL.js +0 -465
- package/dist/chunk-MKPIAGVL.js.map +0 -1
- package/dist/chunk-PEI6RANI.js.map +0 -1
- package/dist/chunk-R3AZOAB5.js.map +0 -1
- package/dist/chunk-WSK7G5LE.js +0 -170
- package/dist/chunk-WSK7G5LE.js.map +0 -1
- package/dist/chunk-XBZWOM2K.js +0 -218
- package/dist/chunk-XBZWOM2K.js.map +0 -1
- package/dist/chunk-Y7OEDUJ5.js +0 -8810
- package/dist/chunk-Y7OEDUJ5.js.map +0 -1
- package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
- package/dist/hooks/use-packs.d.ts +0 -32
- package/dist/interactive-workbench-viewers-TOHBXJEE.js +0 -15
- package/dist/queue-surface-implementation-2KVJTYXH.js.map +0 -1
- package/dist/timeline-annotation-selection-3L7LHGG2.js +0 -187
- package/dist/timeline-annotation-selection-3L7LHGG2.js.map +0 -1
- package/dist/timeline-annotations-dialog-U7EVLR75.js +0 -196
- package/dist/timeline-annotations-dialog-U7EVLR75.js.map +0 -1
- package/src/hooks/use-packs.ts +0 -157
- /package/dist/{interactive-workbench-viewers-TOHBXJEE.js.map → browser-viewer-SHYKQRNX.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/timeline-annotation-markers.tsx"],"sourcesContent":["import type { DraftTimelineAnnotation } from \"@opengeni/sdk\";\nimport { useLayoutEffect, useState, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../lib/cn\";\nimport {\n annotationBoxIntersects,\n annotationViewportBox,\n layoutAnnotationBadges,\n type AnnotationBadgeAnchor,\n type AnnotationBox,\n} from \"./timeline-annotation-layout\";\nimport {\n annotationDisplayOrdinal,\n annotationHasNote,\n annotatableText,\n buildQuoteRange,\n cssEscapeAttribute,\n matchingQuoteInSource,\n occurrenceOffsets,\n} from \"./timeline-annotation-shared\";\n\nfunction lastVisibleRect(range: Range): DOMRect | null {\n try {\n const rects = range.getClientRects();\n for (let index = rects.length - 1; index >= 0; index--) {\n const rect = rects.item(index);\n if (rect && (rect.width > 0 || rect.height > 0)) return rect;\n }\n } catch {\n // jsdom ranges may omit client rects.\n }\n try {\n const bounding = range.getBoundingClientRect();\n if (bounding.width > 0 || bounding.height > 0) return bounding;\n } catch {\n // jsdom ranges may omit layout geometry.\n }\n return null;\n}\n\nfunction occurrenceForAnnotation(\n sourceEl: HTMLElement,\n annotation: DraftTimelineAnnotation,\n): number {\n const { text } = annotatableText(sourceEl);\n const quote = matchingQuoteInSource(text, annotation.quote) ?? annotation.quote;\n const offsets = occurrenceOffsets(text, quote);\n if (offsets.length <= 1) return 0;\n let best = 0;\n let bestDistance = Number.POSITIVE_INFINITY;\n offsets.forEach((offset, index) => {\n const distance = Math.abs(offset - annotation.source.startOffset);\n if (distance < bestDistance) {\n best = index;\n bestDistance = distance;\n }\n });\n return best;\n}\n\nfunction timelineScroller(root: HTMLElement): HTMLElement {\n if (root.matches(\"[data-og-timeline-scroller]\")) return root;\n const nested = root.querySelector(\"[data-og-timeline-scroller]\");\n return nested instanceof HTMLElement ? nested : root;\n}\n\nfunction currentAnnotationViewport(root: HTMLElement): AnnotationBox {\n const scroller = timelineScroller(root);\n const rect = scroller.getBoundingClientRect();\n const scrollerBox = {\n left: rect.left,\n right: rect.right,\n top: rect.top,\n bottom: rect.bottom,\n } satisfies AnnotationBox;\n return annotationViewportBox(window.innerWidth || 1024, window.innerHeight || 768, scrollerBox);\n}\n\nfunction sourceInTimeline(root: HTMLElement, eventId: string): HTMLElement | null {\n const source = root.querySelector(\n `[data-og-annotation-source-key=\"${cssEscapeAttribute(eventId)}\"]`,\n );\n return source instanceof HTMLElement ? source : null;\n}\n\nfunction collectMarkers(\n root: HTMLElement | null,\n annotations: readonly DraftTimelineAnnotation[],\n): AnnotationBadgeAnchor[] {\n if (!root) return [];\n const viewport = currentAnnotationViewport(root);\n const next: AnnotationBadgeAnchor[] = [];\n for (const [index, annotation] of annotations.entries()) {\n const source = sourceInTimeline(root, annotation.source.eventId);\n if (!source) continue;\n const quote =\n matchingQuoteInSource(annotatableText(source).text, annotation.quote) ?? annotation.quote;\n const range = buildQuoteRange(source, quote, occurrenceForAnnotation(source, annotation));\n if (!range) continue;\n const rect = lastVisibleRect(range);\n if (!rect) continue;\n if (\n !annotationBoxIntersects(\n { left: rect.left, right: rect.right, top: rect.top, bottom: rect.bottom },\n viewport,\n )\n ) {\n continue;\n }\n next.push({\n id: annotation.id,\n ordinal: annotationDisplayOrdinal(annotation, index),\n left: rect.right,\n top: rect.top,\n incomplete: !annotationHasNote(annotation.note),\n });\n }\n return layoutAnnotationBadges(next, viewport);\n}\n\nexport function TimelineAnnotationMarkers({\n annotations,\n onSelect,\n rootRef,\n}: {\n annotations: readonly DraftTimelineAnnotation[];\n onSelect?: ((id: string) => void) | undefined;\n rootRef: RefObject<HTMLElement | null>;\n}) {\n const [markers, setMarkers] = useState<AnnotationBadgeAnchor[]>([]);\n\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root || annotations.length === 0) {\n setMarkers([]);\n return;\n }\n const update = () => setMarkers(collectMarkers(root, annotations));\n update();\n window.addEventListener(\"resize\", update);\n window.addEventListener(\"scroll\", update, true);\n const observer = typeof ResizeObserver === \"function\" ? new ResizeObserver(update) : null;\n observer?.observe(root);\n for (const annotation of annotations) {\n const source = sourceInTimeline(root, annotation.source.eventId);\n if (source) observer?.observe(source);\n }\n return () => {\n window.removeEventListener(\"resize\", update);\n window.removeEventListener(\"scroll\", update, true);\n observer?.disconnect();\n };\n }, [annotations, rootRef]);\n\n if (markers.length === 0 || typeof document === \"undefined\") return null;\n return createPortal(\n <div className=\"og-root pointer-events-none fixed inset-0 z-[35]\">\n {markers.map((marker) => (\n <button\n key={marker.id}\n type=\"button\"\n data-og-annotation-badge=\"\"\n data-og-annotation-badge-ordinal={marker.ordinal}\n style={{ left: marker.left, top: marker.top, zIndex: marker.ordinal }}\n className={cn(\n \"pointer-events-auto absolute flex h-4 min-w-4 -translate-x-1/2 -translate-y-[110%] items-center justify-center rounded-full bg-og-accent px-0.5 text-[10px] font-semibold tabular-nums text-og-accent-fg shadow-sm outline-hidden select-none after:absolute after:-inset-2 after:content-[''] focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:after:-inset-2.5\",\n marker.incomplete && \"ring-1 ring-og-accent-fg/35\",\n )}\n aria-label={`Annotation ${marker.ordinal}`}\n onMouseDown={(event) => event.preventDefault()}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onSelect?.(marker.id);\n }}\n >\n {marker.ordinal}\n </button>\n ))}\n </div>,\n document.body,\n );\n}\n\nexport default TimelineAnnotationMarkers;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,SAAS,iBAAiB,gBAAgC;AAC1D,SAAS,oBAAoB;AA4JrB;AAzIR,SAAS,gBAAgB,OAA8B;AACrD,MAAI;AACF,UAAM,QAAQ,MAAM,eAAe;AACnC,aAAS,QAAQ,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS;AACtD,YAAM,OAAO,MAAM,KAAK,KAAK;AAC7B,UAAI,SAAS,KAAK,QAAQ,KAAK,KAAK,SAAS,GAAI,QAAO;AAAA,IAC1D;AAAA,EACF,QAAQ;AAAA,EAER;AACA,MAAI;AACF,UAAM,WAAW,MAAM,sBAAsB;AAC7C,QAAI,SAAS,QAAQ,KAAK,SAAS,SAAS,EAAG,QAAO;AAAA,EACxD,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAEA,SAAS,wBACP,UACA,YACQ;AACR,QAAM,EAAE,KAAK,IAAI,gBAAgB,QAAQ;AACzC,QAAM,QAAQ,sBAAsB,MAAM,WAAW,KAAK,KAAK,WAAW;AAC1E,QAAM,UAAU,kBAAkB,MAAM,KAAK;AAC7C,MAAI,QAAQ,UAAU,E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I,QAAQ,WAAW,KAAK,OAAO,aAAa,YAAa,QAAO;AACpE,SAAO;AAAA,IACL,oBAAC,SAAI,WAAU,oDACZ,kBAAQ,IAAI,CAAC,WACZ;AAAA,MAAC;AAAA;AAAA,QAEC,MAAK;AAAA,QACL,4BAAyB;AAAA,QACzB,oCAAkC,OAAO;AAAA,QACzC,OAAO,EAAE,MAAM,OAAO,MAAM,KAAK,OAAO,KAAK,QAAQ,OAAO,QAAQ;AAAA,QACpE,WAAW;AAAA,UACT;AAAA,UACA,OAAO,cAAc;AAAA,QACvB;AAAA,QACA,cAAY,cAAc,OAAO,OAAO;AAAA,QACxC,aAAa,CAAC,UAAU,MAAM,eAAe;AAAA,QAC7C,SAAS,CAAC,UAAU;AAClB,gBAAM,eAAe;AACrB,gBAAM,gBAAgB;AACtB,qBAAW,OAAO,EAAE;AAAA,QACtB;AAAA,QAEC,iBAAO;AAAA;AAAA,MAjBH,OAAO;AAAA,IAkBd,CACD,GACH;AAAA,IACA,SAAS;AAAA,EACX;AACF;AAEA,IAAO,sCAAQ;","names":[]}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clipRangeToSource,
|
|
3
|
+
matchingQuoteInSource,
|
|
4
|
+
occurrenceOffsets,
|
|
5
|
+
quoteOccurrenceIndex,
|
|
6
|
+
truncateAnnotationQuote,
|
|
7
|
+
visibleClientRect
|
|
8
|
+
} from "./chunk-447JLCBU.js";
|
|
9
|
+
import {
|
|
10
|
+
usePortalTokenStyle
|
|
11
|
+
} from "./chunk-VZTQ73XT.js";
|
|
12
|
+
|
|
13
|
+
// src/components/timeline-annotation-selection.tsx
|
|
14
|
+
import { QuoteIcon } from "lucide-react";
|
|
15
|
+
import { useEffect, useRef, useState } from "react";
|
|
16
|
+
import { createPortal } from "react-dom";
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
var CONTROL_SELECTOR = "button,input,textarea,select,summary,[contenteditable='true']";
|
|
19
|
+
var SOURCE_CONTEXT_BYTES = 160;
|
|
20
|
+
var MAX_QUOTE_BYTES = 16 * 1024;
|
|
21
|
+
var POPOVER_WIDTH = 280;
|
|
22
|
+
var POPOVER_HEIGHT = 64;
|
|
23
|
+
function utf8Prefix(value, maxBytes) {
|
|
24
|
+
let output = "";
|
|
25
|
+
let bytes = 0;
|
|
26
|
+
for (const character of value) {
|
|
27
|
+
const next = new TextEncoder().encode(character).byteLength;
|
|
28
|
+
if (bytes + next > maxBytes) break;
|
|
29
|
+
output += character;
|
|
30
|
+
bytes += next;
|
|
31
|
+
}
|
|
32
|
+
return output;
|
|
33
|
+
}
|
|
34
|
+
function utf8Suffix(value, maxBytes) {
|
|
35
|
+
let output = "";
|
|
36
|
+
let bytes = 0;
|
|
37
|
+
for (const character of [...value].reverse()) {
|
|
38
|
+
const next = new TextEncoder().encode(character).byteLength;
|
|
39
|
+
if (bytes + next > maxBytes) break;
|
|
40
|
+
output = character + output;
|
|
41
|
+
bytes += next;
|
|
42
|
+
}
|
|
43
|
+
return output;
|
|
44
|
+
}
|
|
45
|
+
function selectionElement(node) {
|
|
46
|
+
return node instanceof Element ? node : node?.parentElement ?? null;
|
|
47
|
+
}
|
|
48
|
+
function containingSource(node) {
|
|
49
|
+
const element = selectionElement(node);
|
|
50
|
+
const source = element?.closest("[data-og-annotation-source-key]");
|
|
51
|
+
return source instanceof HTMLElement ? source : null;
|
|
52
|
+
}
|
|
53
|
+
function resolveSourceBoundary(range, root) {
|
|
54
|
+
const start = containingSource(range.startContainer);
|
|
55
|
+
const end = containingSource(range.endContainer);
|
|
56
|
+
if (start && end && start !== end) return null;
|
|
57
|
+
const boundary = start ?? end;
|
|
58
|
+
if (!boundary || !root.contains(boundary)) return null;
|
|
59
|
+
return boundary;
|
|
60
|
+
}
|
|
61
|
+
function isWhollyInsideControl(range, boundary) {
|
|
62
|
+
const start = selectionElement(range.startContainer)?.closest(CONTROL_SELECTOR);
|
|
63
|
+
const end = selectionElement(range.endContainer)?.closest(CONTROL_SELECTOR);
|
|
64
|
+
return start instanceof Element && start === end && boundary.contains(start) && start !== boundary;
|
|
65
|
+
}
|
|
66
|
+
function annotationId() {
|
|
67
|
+
if (typeof globalThis.crypto?.randomUUID === "function") {
|
|
68
|
+
return globalThis.crypto.randomUUID();
|
|
69
|
+
}
|
|
70
|
+
return `annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
71
|
+
}
|
|
72
|
+
function clamp(value, min, max) {
|
|
73
|
+
return Math.min(Math.max(value, min), max);
|
|
74
|
+
}
|
|
75
|
+
function popoverPosition(rect) {
|
|
76
|
+
const half = POPOVER_WIDTH / 2;
|
|
77
|
+
const left = clamp(rect.left + rect.width / 2, 12 + half, window.innerWidth - 12 - half);
|
|
78
|
+
const preferBelow = rect.bottom + 8 + POPOVER_HEIGHT <= window.innerHeight - 12;
|
|
79
|
+
const top = preferBelow ? rect.bottom + 8 : Math.max(12, rect.top - POPOVER_HEIGHT - 8);
|
|
80
|
+
return { left, top };
|
|
81
|
+
}
|
|
82
|
+
function buildCandidate(root, sources, keyboard) {
|
|
83
|
+
const selection = document.getSelection();
|
|
84
|
+
if (!selection || selection.rangeCount !== 1 || selection.isCollapsed) return null;
|
|
85
|
+
const range = selection.getRangeAt(0);
|
|
86
|
+
const startBoundary = resolveSourceBoundary(range, root);
|
|
87
|
+
if (!startBoundary) return null;
|
|
88
|
+
if (isWhollyInsideControl(range, startBoundary)) return null;
|
|
89
|
+
const clipped = clipRangeToSource(range, startBoundary);
|
|
90
|
+
if (!clipped) return null;
|
|
91
|
+
const sourceKey = startBoundary.dataset.ogAnnotationSourceKey;
|
|
92
|
+
const source = sourceKey ? sources.get(sourceKey) : void 0;
|
|
93
|
+
const rawQuote = clipped.toString();
|
|
94
|
+
const quote = (source ? matchingQuoteInSource(source.text, rawQuote) : null) ?? rawQuote;
|
|
95
|
+
if (!source || quote.trim().length === 0 || new TextEncoder().encode(quote).byteLength > MAX_QUOTE_BYTES) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const sourceOffsets = occurrenceOffsets(source.text, quote);
|
|
99
|
+
if (sourceOffsets.length === 0) return null;
|
|
100
|
+
const occurrence = quoteOccurrenceIndex(startBoundary, clipped, quote);
|
|
101
|
+
const startOffset = sourceOffsets[Math.min(occurrence, sourceOffsets.length - 1)];
|
|
102
|
+
const endOffset = startOffset + quote.length;
|
|
103
|
+
const rect = visibleClientRect(range) ?? visibleClientRect(clipped);
|
|
104
|
+
if (!rect) return null;
|
|
105
|
+
const position = popoverPosition(rect);
|
|
106
|
+
return {
|
|
107
|
+
annotation: {
|
|
108
|
+
id: annotationId(),
|
|
109
|
+
quote,
|
|
110
|
+
note: "",
|
|
111
|
+
source: {
|
|
112
|
+
kind: source.kind,
|
|
113
|
+
eventId: source.eventId,
|
|
114
|
+
eventType: source.eventType,
|
|
115
|
+
sequence: source.sequence,
|
|
116
|
+
turnId: source.turnId,
|
|
117
|
+
startOffset,
|
|
118
|
+
endOffset,
|
|
119
|
+
contextBefore: utf8Suffix(source.text.slice(0, startOffset), SOURCE_CONTEXT_BYTES),
|
|
120
|
+
contextAfter: utf8Prefix(source.text.slice(endOffset), SOURCE_CONTEXT_BYTES),
|
|
121
|
+
...source.label ? { label: source.label } : {}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
left: position.left,
|
|
125
|
+
top: position.top,
|
|
126
|
+
keyboard
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function TimelineAnnotationSelection({
|
|
130
|
+
rootRef,
|
|
131
|
+
sources,
|
|
132
|
+
onAnnotate
|
|
133
|
+
}) {
|
|
134
|
+
const [candidate, setCandidate] = useState(null);
|
|
135
|
+
const buttonRef = useRef(null);
|
|
136
|
+
const initialSelectionObservedRef = useRef(false);
|
|
137
|
+
const pointerOriginRef = useRef("unset");
|
|
138
|
+
const portalStyle = usePortalTokenStyle(rootRef.current);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
const root = rootRef.current;
|
|
141
|
+
if (!root || !onAnnotate) {
|
|
142
|
+
setCandidate(null);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const update = (keyboard) => {
|
|
146
|
+
setCandidate(buildCandidate(root, sources, keyboard));
|
|
147
|
+
};
|
|
148
|
+
if (!initialSelectionObservedRef.current) {
|
|
149
|
+
initialSelectionObservedRef.current = true;
|
|
150
|
+
update(false);
|
|
151
|
+
}
|
|
152
|
+
const onRootPointerUp = (event) => {
|
|
153
|
+
if (event.target instanceof Node && buttonRef.current?.contains(event.target)) return;
|
|
154
|
+
if (pointerOriginRef.current === "outside") return;
|
|
155
|
+
window.setTimeout(() => update(false), 0);
|
|
156
|
+
};
|
|
157
|
+
const onDocumentPointerUp = (event) => {
|
|
158
|
+
if (event.target instanceof Node && buttonRef.current?.contains(event.target)) return;
|
|
159
|
+
const startedInRoot = pointerOriginRef.current === "inside";
|
|
160
|
+
pointerOriginRef.current = "unset";
|
|
161
|
+
if (!startedInRoot) return;
|
|
162
|
+
window.setTimeout(() => update(false), 0);
|
|
163
|
+
};
|
|
164
|
+
const onKeyUp = (event) => {
|
|
165
|
+
if (event.key === "Escape") {
|
|
166
|
+
setCandidate(null);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
window.setTimeout(() => update(true), 0);
|
|
170
|
+
};
|
|
171
|
+
const onPointerDown = (event) => {
|
|
172
|
+
if (event.target instanceof Node && buttonRef.current?.contains(event.target)) {
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
pointerOriginRef.current = event.target instanceof Node && root.contains(event.target) ? "inside" : "outside";
|
|
177
|
+
setCandidate(null);
|
|
178
|
+
};
|
|
179
|
+
const onDocumentKeyDown = (event) => {
|
|
180
|
+
if (event.key === "Escape") setCandidate(null);
|
|
181
|
+
};
|
|
182
|
+
const onSelectionChange = () => {
|
|
183
|
+
if (buttonRef.current && document.activeElement === buttonRef.current) return;
|
|
184
|
+
const selection = document.getSelection();
|
|
185
|
+
if (!selection || selection.isCollapsed) setCandidate(null);
|
|
186
|
+
};
|
|
187
|
+
root.addEventListener("pointerup", onRootPointerUp);
|
|
188
|
+
root.addEventListener("keyup", onKeyUp);
|
|
189
|
+
document.addEventListener("pointerup", onDocumentPointerUp);
|
|
190
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
191
|
+
document.addEventListener("keydown", onDocumentKeyDown);
|
|
192
|
+
document.addEventListener("selectionchange", onSelectionChange);
|
|
193
|
+
return () => {
|
|
194
|
+
root.removeEventListener("pointerup", onRootPointerUp);
|
|
195
|
+
root.removeEventListener("keyup", onKeyUp);
|
|
196
|
+
document.removeEventListener("pointerup", onDocumentPointerUp);
|
|
197
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
198
|
+
document.removeEventListener("keydown", onDocumentKeyDown);
|
|
199
|
+
document.removeEventListener("selectionchange", onSelectionChange);
|
|
200
|
+
};
|
|
201
|
+
}, [onAnnotate, rootRef, sources]);
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
if (candidate?.keyboard) buttonRef.current?.focus();
|
|
204
|
+
}, [candidate]);
|
|
205
|
+
if (!candidate || !onAnnotate || typeof document === "undefined") return null;
|
|
206
|
+
const preview = truncateAnnotationQuote(candidate.annotation.quote, 72);
|
|
207
|
+
return createPortal(
|
|
208
|
+
/* @__PURE__ */ jsxs(
|
|
209
|
+
"button",
|
|
210
|
+
{
|
|
211
|
+
ref: buttonRef,
|
|
212
|
+
type: "button",
|
|
213
|
+
"data-og-annotation-popover": "",
|
|
214
|
+
style: { left: candidate.left, top: candidate.top, ...portalStyle },
|
|
215
|
+
className: "og-root fixed z-[80] flex max-w-[min(18rem,calc(100vw-1.5rem))] -translate-x-1/2 items-start gap-2 rounded-2xl border border-og-border bg-og-surface-1 px-3 py-2 text-og-sm font-medium text-og-fg shadow-xl outline-hidden transition hover:border-og-accent/40 hover:bg-og-surface-2 focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-[44px]",
|
|
216
|
+
"aria-label": `Add a note about \u201C${preview}\u201D`,
|
|
217
|
+
title: candidate.annotation.quote,
|
|
218
|
+
onPointerDown: (event) => event.preventDefault(),
|
|
219
|
+
onClick: () => {
|
|
220
|
+
onAnnotate(candidate.annotation);
|
|
221
|
+
document.getSelection()?.removeAllRanges();
|
|
222
|
+
setCandidate(null);
|
|
223
|
+
},
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx(QuoteIcon, { className: "mt-0.5 size-3.5 shrink-0 text-og-accent", "aria-hidden": "true" }),
|
|
226
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 text-left", children: [
|
|
227
|
+
/* @__PURE__ */ jsx("span", { className: "block leading-5", children: "Add note" }),
|
|
228
|
+
/* @__PURE__ */ jsx("span", { className: "mt-0.5 block truncate text-og-xs font-normal text-og-fg-muted", children: preview })
|
|
229
|
+
] })
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
document.body
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
var timeline_annotation_selection_default = TimelineAnnotationSelection;
|
|
237
|
+
export {
|
|
238
|
+
TimelineAnnotationSelection,
|
|
239
|
+
timeline_annotation_selection_default as default
|
|
240
|
+
};
|
|
241
|
+
//# sourceMappingURL=timeline-annotation-selection-DMLMM2TX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/timeline-annotation-selection.tsx"],"sourcesContent":["import type { DraftTimelineAnnotation } from \"@opengeni/sdk\";\nimport { QuoteIcon } from \"lucide-react\";\nimport { useEffect, useRef, useState, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { usePortalTokenStyle } from \"../lib/use-portal-token-style\";\nimport type { TimelineAnnotationSourceDescriptor } from \"../timeline\";\nimport {\n clipRangeToSource,\n matchingQuoteInSource,\n occurrenceOffsets,\n quoteOccurrenceIndex,\n truncateAnnotationQuote,\n visibleClientRect,\n} from \"./timeline-annotation-shared\";\n\ntype SelectionCandidate = {\n annotation: DraftTimelineAnnotation;\n left: number;\n top: number;\n keyboard: boolean;\n};\n\nconst CONTROL_SELECTOR = \"button,input,textarea,select,summary,[contenteditable='true']\";\nconst SOURCE_CONTEXT_BYTES = 160;\nconst MAX_QUOTE_BYTES = 16 * 1024;\nconst POPOVER_WIDTH = 280;\nconst POPOVER_HEIGHT = 64;\n\nfunction utf8Prefix(value: string, maxBytes: number): string {\n let output = \"\";\n let bytes = 0;\n for (const character of value) {\n const next = new TextEncoder().encode(character).byteLength;\n if (bytes + next > maxBytes) break;\n output += character;\n bytes += next;\n }\n return output;\n}\n\nfunction utf8Suffix(value: string, maxBytes: number): string {\n let output = \"\";\n let bytes = 0;\n for (const character of [...value].reverse()) {\n const next = new TextEncoder().encode(character).byteLength;\n if (bytes + next > maxBytes) break;\n output = character + output;\n bytes += next;\n }\n return output;\n}\n\nfunction selectionElement(node: Node | null): Element | null {\n return node instanceof Element ? node : (node?.parentElement ?? null);\n}\n\nfunction containingSource(node: Node | null): HTMLElement | null {\n const element = selectionElement(node);\n const source = element?.closest(\"[data-og-annotation-source-key]\");\n return source instanceof HTMLElement ? source : null;\n}\n\nfunction resolveSourceBoundary(range: Range, root: HTMLElement): HTMLElement | null {\n const start = containingSource(range.startContainer);\n const end = containingSource(range.endContainer);\n if (start && end && start !== end) return null;\n const boundary = start ?? end;\n if (!boundary || !root.contains(boundary)) return null;\n return boundary;\n}\n\nfunction isWhollyInsideControl(range: Range, boundary: HTMLElement): boolean {\n const start = selectionElement(range.startContainer)?.closest(CONTROL_SELECTOR);\n const end = selectionElement(range.endContainer)?.closest(CONTROL_SELECTOR);\n return (\n start instanceof Element && start === end && boundary.contains(start) && start !== boundary\n );\n}\n\nfunction annotationId(): string {\n if (typeof globalThis.crypto?.randomUUID === \"function\") {\n return globalThis.crypto.randomUUID();\n }\n return `annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\nfunction popoverPosition(rect: DOMRect): { left: number; top: number } {\n const half = POPOVER_WIDTH / 2;\n const left = clamp(rect.left + rect.width / 2, 12 + half, window.innerWidth - 12 - half);\n const preferBelow = rect.bottom + 8 + POPOVER_HEIGHT <= window.innerHeight - 12;\n const top = preferBelow ? rect.bottom + 8 : Math.max(12, rect.top - POPOVER_HEIGHT - 8);\n return { left, top };\n}\n\nfunction buildCandidate(\n root: HTMLElement,\n sources: ReadonlyMap<string, TimelineAnnotationSourceDescriptor>,\n keyboard: boolean,\n): SelectionCandidate | null {\n const selection = document.getSelection();\n if (!selection || selection.rangeCount !== 1 || selection.isCollapsed) return null;\n const range = selection.getRangeAt(0);\n const startBoundary = resolveSourceBoundary(range, root);\n if (!startBoundary) return null;\n if (isWhollyInsideControl(range, startBoundary)) return null;\n const clipped = clipRangeToSource(range, startBoundary);\n if (!clipped) return null;\n const sourceKey = startBoundary.dataset.ogAnnotationSourceKey;\n const source = sourceKey ? sources.get(sourceKey) : undefined;\n const rawQuote = clipped.toString();\n const quote = (source ? matchingQuoteInSource(source.text, rawQuote) : null) ?? rawQuote;\n if (\n !source ||\n quote.trim().length === 0 ||\n new TextEncoder().encode(quote).byteLength > MAX_QUOTE_BYTES\n ) {\n return null;\n }\n const sourceOffsets = occurrenceOffsets(source.text, quote);\n if (sourceOffsets.length === 0) return null;\n const occurrence = quoteOccurrenceIndex(startBoundary, clipped, quote);\n const startOffset = sourceOffsets[Math.min(occurrence, sourceOffsets.length - 1)]!;\n const endOffset = startOffset + quote.length;\n const rect = visibleClientRect(range) ?? visibleClientRect(clipped);\n if (!rect) return null;\n const position = popoverPosition(rect);\n return {\n annotation: {\n id: annotationId(),\n quote,\n note: \"\",\n source: {\n kind: source.kind,\n eventId: source.eventId,\n eventType: source.eventType,\n sequence: source.sequence,\n turnId: source.turnId,\n startOffset,\n endOffset,\n contextBefore: utf8Suffix(source.text.slice(0, startOffset), SOURCE_CONTEXT_BYTES),\n contextAfter: utf8Prefix(source.text.slice(endOffset), SOURCE_CONTEXT_BYTES),\n ...(source.label ? { label: source.label } : {}),\n },\n },\n left: position.left,\n top: position.top,\n keyboard,\n };\n}\n\nexport function TimelineAnnotationSelection({\n rootRef,\n sources,\n onAnnotate,\n}: {\n rootRef: RefObject<HTMLElement | null>;\n sources: ReadonlyMap<string, TimelineAnnotationSourceDescriptor>;\n onAnnotate?: ((annotation: DraftTimelineAnnotation) => void) | undefined;\n}) {\n const [candidate, setCandidate] = useState<SelectionCandidate | null>(null);\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n const initialSelectionObservedRef = useRef(false);\n const pointerOriginRef = useRef<\"unset\" | \"inside\" | \"outside\">(\"unset\");\n const portalStyle = usePortalTokenStyle(rootRef.current);\n\n useEffect(() => {\n const root = rootRef.current;\n if (!root || !onAnnotate) {\n setCandidate(null);\n return;\n }\n const update = (keyboard: boolean) => {\n setCandidate(buildCandidate(root, sources, keyboard));\n };\n // A user may finish selecting text before this lazy component arrives.\n // Reconcile once; later prop changes must not revive dismissed selections.\n if (!initialSelectionObservedRef.current) {\n initialSelectionObservedRef.current = true;\n update(false);\n }\n const onRootPointerUp = (event: PointerEvent) => {\n if (event.target instanceof Node && buttonRef.current?.contains(event.target)) return;\n // Tests may fire only pointerup on the source. A real click that started\n // outside the timeline must not resurrect leftover selection.\n if (pointerOriginRef.current === \"outside\") return;\n window.setTimeout(() => update(false), 0);\n };\n const onDocumentPointerUp = (event: PointerEvent) => {\n if (event.target instanceof Node && buttonRef.current?.contains(event.target)) return;\n const startedInRoot = pointerOriginRef.current === \"inside\";\n pointerOriginRef.current = \"unset\";\n if (!startedInRoot) return;\n window.setTimeout(() => update(false), 0);\n };\n const onKeyUp = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n setCandidate(null);\n return;\n }\n window.setTimeout(() => update(true), 0);\n };\n const onPointerDown = (event: PointerEvent) => {\n if (event.target instanceof Node && buttonRef.current?.contains(event.target)) {\n event.preventDefault();\n return;\n }\n pointerOriginRef.current =\n event.target instanceof Node && root.contains(event.target) ? \"inside\" : \"outside\";\n setCandidate(null);\n };\n const onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") setCandidate(null);\n };\n const onSelectionChange = () => {\n if (buttonRef.current && document.activeElement === buttonRef.current) return;\n const selection = document.getSelection();\n if (!selection || selection.isCollapsed) setCandidate(null);\n };\n root.addEventListener(\"pointerup\", onRootPointerUp);\n root.addEventListener(\"keyup\", onKeyUp);\n document.addEventListener(\"pointerup\", onDocumentPointerUp);\n document.addEventListener(\"pointerdown\", onPointerDown);\n document.addEventListener(\"keydown\", onDocumentKeyDown);\n document.addEventListener(\"selectionchange\", onSelectionChange);\n return () => {\n root.removeEventListener(\"pointerup\", onRootPointerUp);\n root.removeEventListener(\"keyup\", onKeyUp);\n document.removeEventListener(\"pointerup\", onDocumentPointerUp);\n document.removeEventListener(\"pointerdown\", onPointerDown);\n document.removeEventListener(\"keydown\", onDocumentKeyDown);\n document.removeEventListener(\"selectionchange\", onSelectionChange);\n };\n }, [onAnnotate, rootRef, sources]);\n\n useEffect(() => {\n if (candidate?.keyboard) buttonRef.current?.focus();\n }, [candidate]);\n\n if (!candidate || !onAnnotate || typeof document === \"undefined\") return null;\n const preview = truncateAnnotationQuote(candidate.annotation.quote, 72);\n return createPortal(\n <button\n ref={buttonRef}\n type=\"button\"\n data-og-annotation-popover=\"\"\n style={{ left: candidate.left, top: candidate.top, ...portalStyle }}\n className=\"og-root fixed z-[80] flex max-w-[min(18rem,calc(100vw-1.5rem))] -translate-x-1/2 items-start gap-2 rounded-2xl border border-og-border bg-og-surface-1 px-3 py-2 text-og-sm font-medium text-og-fg shadow-xl outline-hidden transition hover:border-og-accent/40 hover:bg-og-surface-2 focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-[44px]\"\n aria-label={`Add a note about “${preview}”`}\n title={candidate.annotation.quote}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => {\n onAnnotate(candidate.annotation);\n document.getSelection()?.removeAllRanges();\n setCandidate(null);\n }}\n >\n <QuoteIcon className=\"mt-0.5 size-3.5 shrink-0 text-og-accent\" aria-hidden=\"true\" />\n <span className=\"min-w-0 text-left\">\n <span className=\"block leading-5\">Add note</span>\n <span className=\"mt-0.5 block truncate text-og-xs font-normal text-og-fg-muted\">\n {preview}\n </span>\n </span>\n </button>,\n document.body,\n );\n}\n\nexport default TimelineAnnotationSelection;\n"],"mappings":";;;;;;;;;;;;;AACA,SAAS,iBAAiB;AAC1B,SAAS,WAAW,QAAQ,gBAAgC;AAC5D,SAAS,oBAAoB;AAiQvB,cACA,YADA;AA9ON,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;AAC7B,IAAM,kBAAkB,KAAK;AAC7B,IAAM,gBAAgB;AACtB,IAAM,iBAAiB;AAEvB,SAAS,WAAW,OAAe,UAA0B;AAC3D,MAAI,SAAS;AACb,MAAI,QAAQ;AACZ,aAAW,aAAa,OAAO;AAC7B,UAAM,OAAO,IAAI,YAAY,EAAE,OAAO,SAAS,EAAE;AACjD,QAAI,QAAQ,OAAO,SAAU;AAC7B,cAAU;AACV,aAAS;AAAA,EACX;AACA,SAAO;AACT;AAEA,SAAS,WAAW,OAAe,UAA0B;AAC3D,MAAI,SAAS;AACb,MAAI,QAAQ;AACZ,aAAW,aAAa,CAAC,GAAG,KAAK,EAAE,QAAQ,GAAG;AAC5C,UAAM,OAAO,IAAI,YAAY,EAAE,OAAO,SAAS,EAAE;AACjD,QAAI,QAAQ,OAAO,SAAU;AAC7B,aAAS,YAAY;AACrB,aAAS;AAAA,EACX;AACA,SAAO;AACT;AAEA,SAAS,iBAAiB,MAAmC;AAC3D,SAAO,gBAAgB,UAAU,OAAQ,MAAM,iBAAiB;AAClE;AAEA,SAAS,iBAAiB,MAAuC;AAC/D,QAAM,UAAU,iBAAiB,IAAI;AACrC,QAAM,SAAS,SAAS,QAAQ,iCAAiC;AACjE,SAAO,kBAAkB,cAAc,SAAS;AAClD;AAEA,S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a,QAAO;AACzE,QAAM,UAAU,wBAAwB,UAAU,WAAW,OAAO,EAAE;AACtE,SAAO;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,MAAK;AAAA,QACL,8BAA2B;AAAA,QAC3B,OAAO,EAAE,MAAM,UAAU,MAAM,KAAK,UAAU,KAAK,GAAG,YAAY;AAAA,QAClE,WAAU;AAAA,QACV,cAAY,0BAAqB,OAAO;AAAA,QACxC,OAAO,UAAU,WAAW;AAAA,QAC5B,eAAe,CAAC,UAAU,MAAM,eAAe;AAAA,QAC/C,SAAS,MAAM;AACb,qBAAW,UAAU,UAAU;AAC/B,mBAAS,aAAa,GAAG,gBAAgB;AACzC,uBAAa,IAAI;AAAA,QACnB;AAAA,QAEA;AAAA,8BAAC,aAAU,WAAU,2CAA0C,eAAY,QAAO;AAAA,UAClF,qBAAC,UAAK,WAAU,qBACd;AAAA,gCAAC,UAAK,WAAU,mBAAkB,sBAAQ;AAAA,YAC1C,oBAAC,UAAK,WAAU,iEACb,mBACH;AAAA,aACF;AAAA;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;AAEA,IAAO,wCAAQ;","names":[]}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnnotationAccentRow,
|
|
3
|
+
AnnotationNoteField,
|
|
4
|
+
AnnotationNotePreview,
|
|
5
|
+
AnnotationQuoteSourceButton
|
|
6
|
+
} from "./chunk-C5X5AJXK.js";
|
|
7
|
+
import {
|
|
8
|
+
ANNOTATION_REVIEW_DIALOG_WIDTH_PX,
|
|
9
|
+
clampAnnotationDialogPlacement,
|
|
10
|
+
scrollAnnotationRowIntoList
|
|
11
|
+
} from "./chunk-ZYRGEKWS.js";
|
|
12
|
+
import {
|
|
13
|
+
annotationDisplayOrdinal,
|
|
14
|
+
cssEscapeAttribute
|
|
15
|
+
} from "./chunk-447JLCBU.js";
|
|
16
|
+
import {
|
|
17
|
+
usePortalTokenStyle
|
|
18
|
+
} from "./chunk-VZTQ73XT.js";
|
|
19
|
+
import "./chunk-22KP6LR5.js";
|
|
20
|
+
|
|
21
|
+
// src/components/timeline-annotations-dialog.tsx
|
|
22
|
+
import { XIcon } from "lucide-react";
|
|
23
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
24
|
+
import { createPortal } from "react-dom";
|
|
25
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
function focusableElements(root) {
|
|
27
|
+
return [
|
|
28
|
+
...root.querySelectorAll(
|
|
29
|
+
'button:not([disabled]),textarea:not([disabled]),input:not([disabled]),[href],[tabindex]:not([tabindex="-1"])'
|
|
30
|
+
)
|
|
31
|
+
].filter((element) => element.tabIndex >= 0 && !element.closest("[inert]"));
|
|
32
|
+
}
|
|
33
|
+
function TimelineAnnotationsDialog({
|
|
34
|
+
annotations,
|
|
35
|
+
editable,
|
|
36
|
+
focusAnnotationId,
|
|
37
|
+
onFocusConsumed,
|
|
38
|
+
onUpdate,
|
|
39
|
+
onRemove,
|
|
40
|
+
onRevealSource,
|
|
41
|
+
triggerRef,
|
|
42
|
+
countLabel,
|
|
43
|
+
onDismiss,
|
|
44
|
+
onCommit
|
|
45
|
+
}) {
|
|
46
|
+
const [unavailableId, setUnavailableId] = useState(null);
|
|
47
|
+
const [position, setPosition] = useState({ left: 12, top: 12, maxHeight: 0 });
|
|
48
|
+
const panelRef = useRef(null);
|
|
49
|
+
const headerRef = useRef(null);
|
|
50
|
+
const listRef = useRef(null);
|
|
51
|
+
const noteRefs = useRef(/* @__PURE__ */ new Map());
|
|
52
|
+
const focusedAnnotationIdRef = useRef(null);
|
|
53
|
+
const portalStyle = usePortalTokenStyle(triggerRef.current);
|
|
54
|
+
const revealNote = (id) => {
|
|
55
|
+
const row = listRef.current?.querySelector(
|
|
56
|
+
`[data-og-annotation-id="${cssEscapeAttribute(id)}"]`
|
|
57
|
+
);
|
|
58
|
+
scrollAnnotationRowIntoList(listRef.current, row);
|
|
59
|
+
noteRefs.current.get(id)?.focus();
|
|
60
|
+
};
|
|
61
|
+
const commitNotes = (fromId) => {
|
|
62
|
+
const incomplete = annotations.filter((annotation) => {
|
|
63
|
+
const live = noteRefs.current.get(annotation.id);
|
|
64
|
+
return (live?.value ?? annotation.note).trim().length === 0;
|
|
65
|
+
});
|
|
66
|
+
if (incomplete.length === 0) {
|
|
67
|
+
onCommit();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const fromIndex = annotations.findIndex((annotation) => annotation.id === fromId);
|
|
71
|
+
const next = incomplete.find(
|
|
72
|
+
(item) => annotations.findIndex((annotation) => annotation.id === item.id) > fromIndex
|
|
73
|
+
) ?? incomplete[0];
|
|
74
|
+
revealNote(next.id);
|
|
75
|
+
};
|
|
76
|
+
useLayoutEffect(() => {
|
|
77
|
+
const updatePosition = () => {
|
|
78
|
+
const rect = triggerRef.current?.getBoundingClientRect();
|
|
79
|
+
if (!rect) return;
|
|
80
|
+
const contentHeight = (headerRef.current?.offsetHeight ?? 44) + (listRef.current?.scrollHeight ?? 200);
|
|
81
|
+
setPosition(
|
|
82
|
+
clampAnnotationDialogPlacement({
|
|
83
|
+
triggerLeft: rect.left,
|
|
84
|
+
triggerTop: rect.top,
|
|
85
|
+
triggerBottom: rect.bottom,
|
|
86
|
+
contentHeight,
|
|
87
|
+
viewportWidth: window.innerWidth,
|
|
88
|
+
viewportHeight: window.innerHeight,
|
|
89
|
+
panelWidth: ANNOTATION_REVIEW_DIALOG_WIDTH_PX
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
updatePosition();
|
|
94
|
+
window.addEventListener("resize", updatePosition);
|
|
95
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
96
|
+
return () => {
|
|
97
|
+
window.removeEventListener("resize", updatePosition);
|
|
98
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
99
|
+
};
|
|
100
|
+
}, [annotations, triggerRef]);
|
|
101
|
+
useLayoutEffect(() => {
|
|
102
|
+
if (!focusAnnotationId) {
|
|
103
|
+
focusedAnnotationIdRef.current = null;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (focusedAnnotationIdRef.current === focusAnnotationId) return;
|
|
107
|
+
focusedAnnotationIdRef.current = null;
|
|
108
|
+
if (position.maxHeight <= 0) return;
|
|
109
|
+
revealNote(focusAnnotationId);
|
|
110
|
+
const note = noteRefs.current.get(focusAnnotationId);
|
|
111
|
+
if (note && document.activeElement === note) {
|
|
112
|
+
focusedAnnotationIdRef.current = focusAnnotationId;
|
|
113
|
+
onFocusConsumed?.();
|
|
114
|
+
}
|
|
115
|
+
}, [focusAnnotationId, onFocusConsumed, annotations.length, position.maxHeight]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
const onKeyDown = (event) => {
|
|
118
|
+
if (event.key === "Escape") {
|
|
119
|
+
event.stopPropagation();
|
|
120
|
+
onDismiss(true);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (event.key !== "Tab" || !panelRef.current) return;
|
|
124
|
+
const focusable = focusableElements(panelRef.current);
|
|
125
|
+
if (focusable.length === 0) return;
|
|
126
|
+
const first = focusable[0];
|
|
127
|
+
const last = focusable[focusable.length - 1];
|
|
128
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
last.focus();
|
|
131
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
first.focus();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const onPointerDown = (event) => {
|
|
137
|
+
if (!(event.target instanceof Node)) return;
|
|
138
|
+
if (panelRef.current?.contains(event.target) || triggerRef.current?.contains(event.target)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
onDismiss(false);
|
|
142
|
+
};
|
|
143
|
+
document.addEventListener("keydown", onKeyDown);
|
|
144
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
145
|
+
if (!focusAnnotationId) {
|
|
146
|
+
window.setTimeout(() => {
|
|
147
|
+
if (document.activeElement === triggerRef.current) panelRef.current?.focus();
|
|
148
|
+
}, 0);
|
|
149
|
+
}
|
|
150
|
+
return () => {
|
|
151
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
152
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
153
|
+
};
|
|
154
|
+
}, [focusAnnotationId, onDismiss, triggerRef]);
|
|
155
|
+
if (typeof document === "undefined") return null;
|
|
156
|
+
return createPortal(
|
|
157
|
+
/* @__PURE__ */ jsxs(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
ref: panelRef,
|
|
161
|
+
role: "dialog",
|
|
162
|
+
tabIndex: -1,
|
|
163
|
+
"data-og-annotation-review": "",
|
|
164
|
+
style: {
|
|
165
|
+
left: position.left,
|
|
166
|
+
top: position.top,
|
|
167
|
+
maxHeight: position.maxHeight,
|
|
168
|
+
...portalStyle
|
|
169
|
+
},
|
|
170
|
+
className: "og-root fixed z-[75] box-border flex w-[min(25rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-og-lg border border-og-border bg-og-surface-1 text-og-fg shadow-xl outline-hidden",
|
|
171
|
+
"aria-label": editable ? "Edit quoted notes" : "Quoted notes",
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ jsxs(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
ref: headerRef,
|
|
177
|
+
"data-og-annotation-review-header": "",
|
|
178
|
+
className: "flex shrink-0 items-start justify-between gap-3 px-3 pt-3 pb-2",
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ jsx("p", { className: "min-w-0 pt-0.5 text-og-sm font-medium text-og-fg-muted", children: countLabel }),
|
|
181
|
+
/* @__PURE__ */ jsx(
|
|
182
|
+
"button",
|
|
183
|
+
{
|
|
184
|
+
type: "button",
|
|
185
|
+
className: "inline-flex size-8 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-og-fg-muted outline-hidden hover:bg-og-surface-2 hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:size-11",
|
|
186
|
+
"aria-label": "Close",
|
|
187
|
+
onClick: () => onDismiss(true),
|
|
188
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5", "aria-hidden": "true" })
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
/* @__PURE__ */ jsx(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
ref: listRef,
|
|
198
|
+
"data-og-annotation-review-list": "",
|
|
199
|
+
className: "grid min-h-0 flex-1 gap-2.5 overflow-x-hidden overflow-y-auto overscroll-contain px-3 pb-3",
|
|
200
|
+
children: annotations.map((annotation, index) => {
|
|
201
|
+
const ordinal = annotationDisplayOrdinal(annotation, index);
|
|
202
|
+
return /* @__PURE__ */ jsx(
|
|
203
|
+
"section",
|
|
204
|
+
{
|
|
205
|
+
"data-og-annotation-id": annotation.id,
|
|
206
|
+
"aria-label": `Annotation ${ordinal}`,
|
|
207
|
+
children: /* @__PURE__ */ jsxs(AnnotationAccentRow, { children: [
|
|
208
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-1", children: [
|
|
209
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
210
|
+
/* @__PURE__ */ jsxs("p", { className: "mb-0.5 text-og-xs font-medium tabular-nums text-og-fg-subtle", children: [
|
|
211
|
+
"Annotation ",
|
|
212
|
+
ordinal
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ jsx(
|
|
215
|
+
AnnotationQuoteSourceButton,
|
|
216
|
+
{
|
|
217
|
+
annotation,
|
|
218
|
+
lines: 2,
|
|
219
|
+
onRevealSource,
|
|
220
|
+
onUnavailable: setUnavailableId
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] }),
|
|
224
|
+
editable && onRemove ? /* @__PURE__ */ jsx(
|
|
225
|
+
"button",
|
|
226
|
+
{
|
|
227
|
+
type: "button",
|
|
228
|
+
className: "inline-flex size-7 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-og-fg-subtle outline-hidden hover:bg-og-surface-1 hover:text-og-status-failed focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:size-11",
|
|
229
|
+
"aria-label": `Remove annotation ${ordinal}`,
|
|
230
|
+
onClick: () => onRemove(annotation.id),
|
|
231
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5", "aria-hidden": "true" })
|
|
232
|
+
}
|
|
233
|
+
) : null
|
|
234
|
+
] }),
|
|
235
|
+
unavailableId === annotation.id ? /* @__PURE__ */ jsx("p", { role: "status", className: "text-og-xs text-og-status-waiting", children: "Source is outside the loaded timeline window." }) : null,
|
|
236
|
+
editable && onUpdate ? /* @__PURE__ */ jsx(
|
|
237
|
+
AnnotationNoteField,
|
|
238
|
+
{
|
|
239
|
+
annotation,
|
|
240
|
+
inputRef: (node) => {
|
|
241
|
+
if (node) noteRefs.current.set(annotation.id, node);
|
|
242
|
+
else noteRefs.current.delete(annotation.id);
|
|
243
|
+
},
|
|
244
|
+
onUpdate,
|
|
245
|
+
onCommit: () => commitNotes(annotation.id)
|
|
246
|
+
}
|
|
247
|
+
) : /* @__PURE__ */ jsx(
|
|
248
|
+
AnnotationNotePreview,
|
|
249
|
+
{
|
|
250
|
+
note: annotation.note,
|
|
251
|
+
annotationId: annotation.id,
|
|
252
|
+
ordinal
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] })
|
|
256
|
+
},
|
|
257
|
+
annotation.id
|
|
258
|
+
);
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
document.body
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
var timeline_annotations_dialog_default = TimelineAnnotationsDialog;
|
|
269
|
+
export {
|
|
270
|
+
TimelineAnnotationsDialog,
|
|
271
|
+
timeline_annotations_dialog_default as default
|
|
272
|
+
};
|
|
273
|
+
//# sourceMappingURL=timeline-annotations-dialog-ELRDBHTS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/timeline-annotations-dialog.tsx"],"sourcesContent":["import type { TimelineAnnotationSource } from \"@opengeni/sdk\";\nimport { XIcon } from \"lucide-react\";\nimport { useEffect, useLayoutEffect, useRef, useState, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { usePortalTokenStyle } from \"../lib/use-portal-token-style\";\nimport {\n AnnotationAccentRow,\n AnnotationNoteField,\n AnnotationNotePreview,\n AnnotationQuoteSourceButton,\n type TimelineAnnotationLike,\n} from \"./timeline-annotation-chrome\";\nimport {\n ANNOTATION_REVIEW_DIALOG_WIDTH_PX,\n clampAnnotationDialogPlacement,\n scrollAnnotationRowIntoList,\n} from \"./timeline-annotation-layout\";\nimport { annotationDisplayOrdinal, cssEscapeAttribute } from \"./timeline-annotation-shared\";\n\nfunction focusableElements(root: HTMLElement): HTMLElement[] {\n return [\n ...root.querySelectorAll<HTMLElement>(\n 'button:not([disabled]),textarea:not([disabled]),input:not([disabled]),[href],[tabindex]:not([tabindex=\"-1\"])',\n ),\n ].filter((element) => element.tabIndex >= 0 && !element.closest(\"[inert]\"));\n}\n\nexport function TimelineAnnotationsDialog({\n annotations,\n editable,\n focusAnnotationId,\n onFocusConsumed,\n onUpdate,\n onRemove,\n onRevealSource,\n triggerRef,\n countLabel,\n onDismiss,\n onCommit,\n}: {\n annotations: readonly TimelineAnnotationLike[];\n editable: boolean;\n focusAnnotationId?: string | null | undefined;\n onFocusConsumed?: (() => void) | undefined;\n onUpdate?: ((id: string, note: string) => void) | undefined;\n onRemove?: ((id: string) => void) | undefined;\n onRevealSource?: ((source: TimelineAnnotationSource) => boolean) | undefined;\n triggerRef: RefObject<HTMLButtonElement | null>;\n countLabel: string;\n onDismiss: (restoreFocus: boolean) => void;\n onCommit: () => void;\n}) {\n const [unavailableId, setUnavailableId] = useState<string | null>(null);\n const [position, setPosition] = useState({ left: 12, top: 12, maxHeight: 0 });\n const panelRef = useRef<HTMLDivElement | null>(null);\n const headerRef = useRef<HTMLDivElement | null>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const noteRefs = useRef(new Map<string, HTMLTextAreaElement>());\n const focusedAnnotationIdRef = useRef<string | null>(null);\n const portalStyle = usePortalTokenStyle(triggerRef.current);\n const revealNote = (id: string) => {\n const row = listRef.current?.querySelector<HTMLElement>(\n `[data-og-annotation-id=\"${cssEscapeAttribute(id)}\"]`,\n );\n scrollAnnotationRowIntoList(listRef.current, row);\n noteRefs.current.get(id)?.focus();\n };\n\n const commitNotes = (fromId: string) => {\n const incomplete = annotations.filter((annotation) => {\n const live = noteRefs.current.get(annotation.id);\n return (live?.value ?? annotation.note).trim().length === 0;\n });\n if (incomplete.length === 0) {\n onCommit();\n return;\n }\n const fromIndex = annotations.findIndex((annotation) => annotation.id === fromId);\n const next =\n incomplete.find(\n (item) => annotations.findIndex((annotation) => annotation.id === item.id) > fromIndex,\n ) ?? incomplete[0]!;\n revealNote(next.id);\n };\n\n useLayoutEffect(() => {\n const updatePosition = () => {\n const rect = triggerRef.current?.getBoundingClientRect();\n if (!rect) return;\n const contentHeight =\n (headerRef.current?.offsetHeight ?? 44) + (listRef.current?.scrollHeight ?? 200);\n setPosition(\n clampAnnotationDialogPlacement({\n triggerLeft: rect.left,\n triggerTop: rect.top,\n triggerBottom: rect.bottom,\n contentHeight,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n panelWidth: ANNOTATION_REVIEW_DIALOG_WIDTH_PX,\n }),\n );\n };\n updatePosition();\n window.addEventListener(\"resize\", updatePosition);\n window.addEventListener(\"scroll\", updatePosition, true);\n return () => {\n window.removeEventListener(\"resize\", updatePosition);\n window.removeEventListener(\"scroll\", updatePosition, true);\n };\n }, [annotations, triggerRef]);\n\n useLayoutEffect(() => {\n if (!focusAnnotationId) {\n focusedAnnotationIdRef.current = null;\n return;\n }\n // A consumed request must not reclaim focus or scroll on layout/callback updates.\n if (focusedAnnotationIdRef.current === focusAnnotationId) return;\n focusedAnnotationIdRef.current = null;\n if (position.maxHeight <= 0) return;\n revealNote(focusAnnotationId);\n const note = noteRefs.current.get(focusAnnotationId);\n if (note && document.activeElement === note) {\n focusedAnnotationIdRef.current = focusAnnotationId;\n onFocusConsumed?.();\n }\n }, [focusAnnotationId, onFocusConsumed, annotations.length, position.maxHeight]);\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.stopPropagation();\n onDismiss(true);\n return;\n }\n if (event.key !== \"Tab\" || !panelRef.current) return;\n const focusable = focusableElements(panelRef.current);\n if (focusable.length === 0) return;\n const first = focusable[0]!;\n const last = focusable[focusable.length - 1]!;\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n };\n const onPointerDown = (event: PointerEvent) => {\n if (!(event.target instanceof Node)) return;\n if (panelRef.current?.contains(event.target) || triggerRef.current?.contains(event.target)) {\n return;\n }\n onDismiss(false);\n };\n document.addEventListener(\"keydown\", onKeyDown);\n document.addEventListener(\"pointerdown\", onPointerDown);\n if (!focusAnnotationId) {\n window.setTimeout(() => {\n if (document.activeElement === triggerRef.current) panelRef.current?.focus();\n }, 0);\n }\n return () => {\n document.removeEventListener(\"keydown\", onKeyDown);\n document.removeEventListener(\"pointerdown\", onPointerDown);\n };\n }, [focusAnnotationId, onDismiss, triggerRef]);\n\n if (typeof document === \"undefined\") return null;\n return createPortal(\n <div\n ref={panelRef}\n role=\"dialog\"\n tabIndex={-1}\n data-og-annotation-review=\"\"\n style={{\n left: position.left,\n top: position.top,\n maxHeight: position.maxHeight,\n ...portalStyle,\n }}\n className=\"og-root fixed z-[75] box-border flex w-[min(25rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-og-lg border border-og-border bg-og-surface-1 text-og-fg shadow-xl outline-hidden\"\n aria-label={editable ? \"Edit quoted notes\" : \"Quoted notes\"}\n >\n <div\n ref={headerRef}\n data-og-annotation-review-header=\"\"\n className=\"flex shrink-0 items-start justify-between gap-3 px-3 pt-3 pb-2\"\n >\n <p className=\"min-w-0 pt-0.5 text-og-sm font-medium text-og-fg-muted\">{countLabel}</p>\n <button\n type=\"button\"\n className=\"inline-flex size-8 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-og-fg-muted outline-hidden hover:bg-og-surface-2 hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:size-11\"\n aria-label=\"Close\"\n onClick={() => onDismiss(true)}\n >\n <XIcon className=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n </div>\n <div\n ref={listRef}\n data-og-annotation-review-list=\"\"\n className=\"grid min-h-0 flex-1 gap-2.5 overflow-x-hidden overflow-y-auto overscroll-contain px-3 pb-3\"\n >\n {annotations.map((annotation, index) => {\n const ordinal = annotationDisplayOrdinal(annotation, index);\n return (\n <section\n key={annotation.id}\n data-og-annotation-id={annotation.id}\n aria-label={`Annotation ${ordinal}`}\n >\n <AnnotationAccentRow>\n <div className=\"flex items-start gap-1\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"mb-0.5 text-og-xs font-medium tabular-nums text-og-fg-subtle\">\n Annotation {ordinal}\n </p>\n <AnnotationQuoteSourceButton\n annotation={annotation}\n lines={2}\n onRevealSource={onRevealSource}\n onUnavailable={setUnavailableId}\n />\n </div>\n {editable && onRemove ? (\n <button\n type=\"button\"\n className=\"inline-flex size-7 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-og-fg-subtle outline-hidden hover:bg-og-surface-1 hover:text-og-status-failed focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:size-11\"\n aria-label={`Remove annotation ${ordinal}`}\n onClick={() => onRemove(annotation.id)}\n >\n <XIcon className=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n ) : null}\n </div>\n {unavailableId === annotation.id ? (\n <p role=\"status\" className=\"text-og-xs text-og-status-waiting\">\n Source is outside the loaded timeline window.\n </p>\n ) : null}\n {editable && onUpdate ? (\n <AnnotationNoteField\n annotation={annotation}\n inputRef={(node) => {\n if (node) noteRefs.current.set(annotation.id, node);\n else noteRefs.current.delete(annotation.id);\n }}\n onUpdate={onUpdate}\n onCommit={() => commitNotes(annotation.id)}\n />\n ) : (\n <AnnotationNotePreview\n note={annotation.note}\n annotationId={annotation.id}\n ordinal={ordinal}\n />\n )}\n </AnnotationAccentRow>\n </section>\n );\n })}\n </div>\n </div>,\n document.body,\n );\n}\n\nexport default TimelineAnnotationsDialog;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,SAAS,aAAa;AACtB,SAAS,WAAW,iBAAiB,QAAQ,gBAAgC;AAC7E,SAAS,oBAAoB;AAsLvB,SAKE,KALF;AAtKN,SAAS,kBAAkB,MAAkC;AAC3D,SAAO;AAAA,IACL,GAAG,KAAK;AAAA,MACN;AAAA,IACF;AAAA,EACF,EAAE,OAAO,CAAC,YAAY,QAAQ,YAAY,KAAK,CAAC,QAAQ,QAAQ,SAAS,CAAC;AAC5E;AAEO,SAAS,0BAA0B;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAYG;AACD,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAwB,IAAI;AACtE,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,EAAE,MAAM,IAAI,KAAK,IAAI,WAAW,EAAE,CAAC;AAC5E,QAAM,WAAW,OAA8B,IAAI;AACnD,QAAM,YAAY,OAA8B,IAAI;AACpD,QAAM,UAAU,OAA8B,IAAI;AAClD,QAAM,WAAW,OAAO,oBAAI,IAAiC,CAAC;AAC9D,QAAM,yBAAyB,OAAsB,IAAI;AACzD,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ist/types/machines.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MachineKind, MachineMetricsSeriesResponse, MachinesResponse, MachineState, MachineView, MetricSample } from "@opengeni/sdk";
|
|
2
|
-
export type { MachineKind, MachineMetricsSeriesResponse, MachinesResponse, MachineState, MachineView, MetricSample, };
|
|
1
|
+
import type { MachineKind, MachineMetricsSeriesResponse, MachinesResponse, MachineState, MachineView, MachineRuntime, MachineRuntimeCapabilities, MachineOperationPolicy, MachineUpdateState, MachineUpdateStatus, MetricSample } from "@opengeni/sdk";
|
|
2
|
+
export type { MachineKind, MachineMetricsSeriesResponse, MachinesResponse, MachineState, MachineView, MachineRuntime, MachineRuntimeCapabilities, MachineOperationPolicy, MachineUpdateState, MachineUpdateStatus, MetricSample, };
|
|
3
3
|
/**
|
|
4
4
|
* The three connection-status pill values the UI surfaces across the dashboard,
|
|
5
5
|
* the dock, and the timeline. `consent_required` / `display_unavailable` /
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Which ceiling ran out: the shared workspace pool, or one member's share of it. */
|
|
2
|
+
export type AllowanceScope = "workspace" | "member";
|
|
3
|
+
export type AllowanceLabels = {
|
|
4
|
+
/** "Usage limit reached" for a member ceiling. */
|
|
5
|
+
memberLimitReachedTitle: string;
|
|
6
|
+
/** "Workspace usage limit reached" for the shared pool. */
|
|
7
|
+
workspaceLimitReachedTitle: string;
|
|
8
|
+
/** Who can fix a member ceiling. */
|
|
9
|
+
memberRemedy: string;
|
|
10
|
+
/** Who can fix the workspace pool. */
|
|
11
|
+
workspaceRemedy: string;
|
|
12
|
+
/** "Resets Nov 1". `date` is already formatted by `formatDate`. */
|
|
13
|
+
resets: (date: string) => string;
|
|
14
|
+
/** Shown when a ceiling has no automatic reset. */
|
|
15
|
+
noReset: string;
|
|
16
|
+
/** Formats a reset instant for `resets`. Defaults to a short local date. */
|
|
17
|
+
formatDate: (iso: string) => string;
|
|
18
|
+
};
|
|
19
|
+
export declare function formatAllowanceDate(iso: string, now?: Date): string;
|
|
20
|
+
/** Full local date and time, for a title/tooltip next to the short date. */
|
|
21
|
+
export declare function formatAllowanceInstant(iso: string): string;
|
|
22
|
+
export declare const DEFAULT_ALLOWANCE_LABELS: AllowanceLabels;
|
|
23
|
+
export declare function allowanceLabels(overrides?: Partial<AllowanceLabels>): AllowanceLabels;
|
|
24
|
+
/** "Resets Nov 1." or the no-reset sentence. */
|
|
25
|
+
export declare function allowanceResetSentence(labels: AllowanceLabels, resetsAt: string | null): string;
|