@jini-ai/ui 0.7.3-next.2 → 0.7.3-next.3
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 +3 -3
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/mount-renderer.d.ts +33 -0
- package/dist/browser/mount-renderer.js +14 -0
- package/dist/browser/useDismissibleDropdown.d.ts +50 -0
- package/dist/browser/useDismissibleDropdown.js +49 -0
- package/dist/core.d.ts +4 -4
- package/dist/core.js +4 -1
- package/dist/features/admin-widgets/components/InfoTip.js +5 -5
- package/dist/features/admin-widgets/components/InfoTip.rules.d.ts +1 -1
- package/dist/features/admin-widgets/components/InfoTip.rules.js +1 -1
- package/dist/features/admin-widgets/components/SeeMore/SeeMore.js +3 -3
- package/dist/features/admin-widgets/components/Select/Select.js +7 -7
- package/dist/features/app-shell/SiteToast.d.ts +24 -0
- package/dist/features/app-shell/SiteToast.js +9 -0
- package/dist/features/app-shell/copyable-details.d.ts +12 -0
- package/dist/features/app-shell/copyable-details.js +17 -0
- package/dist/features/app-shell/expanded-mode.d.ts +76 -0
- package/dist/features/app-shell/expanded-mode.js +70 -0
- package/dist/features/app-shell/index.d.ts +8 -0
- package/dist/features/app-shell/index.js +8 -0
- package/dist/features/app-shell/use-delete-confirmation.hooks.d.ts +48 -0
- package/dist/features/app-shell/use-delete-confirmation.hooks.js +57 -0
- package/dist/features/app-shell/use-expanded-mode.hooks.d.ts +19 -0
- package/dist/features/app-shell/use-expanded-mode.hooks.js +39 -0
- package/dist/features/app-shell/use-site-toast.hooks.d.ts +56 -0
- package/dist/features/app-shell/use-site-toast.hooks.js +44 -0
- package/dist/features/app-shell/use-theme-preference.hooks.d.ts +30 -0
- package/dist/features/app-shell/use-theme-preference.hooks.js +42 -0
- package/dist/features/app-version/use-app-version.d.ts +53 -0
- package/dist/features/app-version/use-app-version.js +42 -0
- package/dist/features/asset-grid/react/components/AssetGrid.d.ts +1 -1
- package/dist/features/asset-grid/react/components/AssetGrid.js +1 -1
- package/dist/features/asset-grid/react/components/DeleteConfirmDialog.d.ts +1 -1
- package/dist/features/asset-grid/react/components/DeleteConfirmDialog.js +1 -1
- package/dist/features/asset-tree-browser/react/components/AssetTreeBrowser.d.ts +2 -2
- package/dist/features/asset-tree-browser/react/components/AssetTreeBrowser.js +1 -1
- package/dist/features/asset-tree-browser/react/components/FilePreviewPane.d.ts +1 -1
- package/dist/features/browser-chrome/react/components/BrowserViewportControls.d.ts +1 -1
- package/dist/features/browser-chrome/react/components/BrowserViewportControls.js +1 -1
- package/dist/features/charts/table.js +4 -4
- package/dist/features/command-palette/index.d.ts +1 -0
- package/dist/features/command-palette/index.js +1 -0
- package/dist/features/command-palette/react/components/CommandPalette.d.ts +9 -9
- package/dist/features/command-palette/react/components/CommandPalette.hooks.js +28 -1
- package/dist/features/command-palette/react/components/CommandPalette.js +3 -5
- package/dist/features/connectors/ConnectorsBrowser.d.ts +1 -1
- package/dist/features/connectors/ConnectorsBrowser.js +2 -2
- package/dist/features/connectors/components/ConnectorCard.hooks.js +2 -2
- package/dist/features/connectors/components/ConnectorCard.js +4 -4
- package/dist/features/connectors/components/ConnectorDetailDrawer.d.ts +1 -1
- package/dist/features/connectors/components/ConnectorDetailDrawer.js +7 -7
- package/dist/features/connectors/components/ConnectorGrid.js +1 -1
- package/dist/features/connectors/components/ConnectorLogo.js +1 -1
- package/dist/features/connectors/components/ConnectorSearchBar.js +1 -1
- package/dist/features/connectors/components/ProviderTabBar.js +1 -1
- package/dist/features/execution/claude/env-fields.d.ts +1 -1
- package/dist/features/execution/codex/env-fields.d.ts +1 -1
- package/dist/features/execution/constants.d.ts +2 -2
- package/dist/features/execution/constants.js +1 -1
- package/dist/features/execution/dependencies.d.ts +2 -3
- package/dist/features/execution/http-adapter.d.ts +2 -3
- package/dist/features/execution/index.d.ts +0 -2
- package/dist/features/execution/react/components/AgentCliEnvFields.d.ts +1 -1
- package/dist/features/execution/react/components/AgentDiagnosticRow.d.ts +1 -1
- package/dist/features/execution/react/components/AgentDiagnosticRow.js +3 -1
- package/dist/features/execution/react/components/ByokProviderForm.d.ts +10 -2
- package/dist/features/execution/react/components/ByokProviderForm.hooks.d.ts +2 -2
- package/dist/features/execution/react/components/ByokProviderForm.js +15 -4
- package/dist/features/execution/react/components/ExecutionTab.d.ts +2 -3
- package/dist/features/execution/react/components/ExecutionTab.hooks.d.ts +14 -4
- package/dist/features/execution/react/components/ExecutionTab.hooks.js +66 -9
- package/dist/features/execution/react/components/ExecutionTab.js +27 -10
- package/dist/features/execution/react/components/LocalCliAgentCard.d.ts +4 -4
- package/dist/features/execution/react/components/LocalCliAgentList.d.ts +4 -4
- package/dist/features/execution/react/components/LocalCliAgentList.hooks.d.ts +3 -3
- package/dist/features/execution/react/components/LocalCliAgentSettings.d.ts +2 -2
- package/dist/features/execution/react/components/ProviderChipGroup.d.ts +1 -1
- package/dist/features/execution/react/components/SearchableModelSelect.d.ts +1 -1
- package/dist/features/execution/react/hooks/use-byok-field-validation.hooks.d.ts +2 -2
- package/dist/features/execution/react/hooks/use-execution-credential.hooks.d.ts +1 -1
- package/dist/features/execution/react/hooks/useExecutionTab.d.ts +2 -3
- package/dist/features/execution/react/hooks/useLocalCliAgentCard.d.ts +4 -4
- package/dist/features/execution/react/hooks/useLocalCliAgentList.d.ts +4 -4
- package/dist/features/execution/react/hooks/useReasoningControl.d.ts +3 -3
- package/dist/features/execution/rules.d.ts +6 -6
- package/dist/features/execution/rules.js +1 -1
- package/dist/features/external-mcp/react/components/ExternalMcpTab.js +4 -4
- package/dist/features/file-dropzone/react/components/FileDropzone.d.ts +1 -1
- package/dist/features/file-dropzone/react/components/FileDropzone.js +1 -1
- package/dist/features/find/find-bar-state.d.ts +58 -0
- package/dist/features/find/find-bar-state.js +45 -0
- package/dist/features/find/find-focus-clock.d.ts +19 -0
- package/dist/features/find/find-focus-clock.js +9 -0
- package/dist/features/find/find-input-focus.d.ts +88 -0
- package/dist/features/find/find-input-focus.js +88 -0
- package/dist/features/find/find-target.d.ts +141 -0
- package/dist/features/find/find-target.js +160 -0
- package/dist/features/find/index.d.ts +10 -0
- package/dist/features/find/index.js +10 -0
- package/dist/features/find/use-find-bar-effects.hooks.d.ts +14 -0
- package/dist/features/find/use-find-bar-effects.hooks.js +92 -0
- package/dist/features/find/use-find-bar-state.hooks.d.ts +43 -0
- package/dist/features/find/use-find-bar-state.hooks.js +49 -0
- package/dist/features/find/use-find-focus-reclaim.hooks.d.ts +21 -0
- package/dist/features/find/use-find-focus-reclaim.hooks.js +64 -0
- package/dist/features/find/use-find-input-binding.hooks.d.ts +18 -0
- package/dist/features/find/use-find-input-binding.hooks.js +76 -0
- package/dist/features/find-bar/FindBar.d.ts +41 -0
- package/dist/features/find-bar/FindBar.js +31 -0
- package/dist/features/find-bar/index.d.ts +2 -0
- package/dist/features/find-bar/index.js +2 -0
- package/dist/features/folder-path-drop/index.d.ts +3 -1
- package/dist/features/folder-path-drop/index.js +1 -0
- package/dist/features/folder-path-drop/react/hooks/useClassifiedPathDrop.d.ts +50 -0
- package/dist/features/folder-path-drop/react/hooks/useClassifiedPathDrop.js +50 -0
- package/dist/features/folder-path-drop/types.d.ts +14 -0
- package/dist/features/i18n/context.d.ts +1 -1
- package/dist/features/i18n/context.js +1 -1
- package/dist/features/iframe-pool/react/dom-sync.d.ts +13 -3
- package/dist/features/iframe-pool/react/dom-sync.js +7 -7
- package/dist/features/import-handoff/use-import-handoff.d.ts +38 -0
- package/dist/features/import-handoff/use-import-handoff.js +40 -0
- package/dist/features/integrations/rules.js +39 -41
- package/dist/features/interactive-ui/interactive-ui.css +1 -1
- package/dist/features/interactive-ui/providers/native/data-table.js +1 -1
- package/dist/features/interactive-ui/providers/shadcn/checkbox-field.js +1 -1
- package/dist/features/interactive-ui/providers/shadcn/data-table.js +3 -3
- package/dist/features/interactive-ui/providers/shadcn/radio-group-field.js +1 -1
- package/dist/features/live-views/index.d.ts +6 -0
- package/dist/features/live-views/index.js +6 -0
- package/dist/features/live-views/use-live-views.d.ts +31 -0
- package/dist/features/live-views/use-live-views.js +88 -0
- package/dist/features/live-views/use-site-view-preference.d.ts +33 -0
- package/dist/features/live-views/use-site-view-preference.js +32 -0
- package/dist/features/live-views/use-webview-load-failure.d.ts +90 -0
- package/dist/features/live-views/use-webview-load-failure.js +122 -0
- package/dist/features/mcp-ui/credential-card.d.ts +1 -0
- package/dist/features/mcp-ui/credential-card.js +1 -1
- package/dist/features/mcp-ui/surfaces/tool-approval.d.ts +10 -0
- package/dist/features/mcp-ui/surfaces/tool-approval.js +15 -0
- package/dist/features/media-providers/dependencies.d.ts +7 -1
- package/dist/features/media-providers/dependencies.js +43 -0
- package/dist/features/media-providers/index.d.ts +2 -2
- package/dist/features/media-providers/index.js +1 -1
- package/dist/features/media-providers/ports.d.ts +39 -5
- package/dist/features/media-providers/react/components/MediaProvidersTab.d.ts +4 -3
- package/dist/features/media-providers/react/components/MediaProvidersTab.js +1 -1
- package/dist/features/media-providers/react/hooks/useMediaProvidersTab.d.ts +3 -2
- package/dist/features/media-providers/react/hooks/useMediaProvidersTab.js +41 -3
- package/dist/features/memory/react/components/MemoryConnectedPanel.js +2 -2
- package/dist/features/memory/react/components/MemoryEntryCard.js +1 -1
- package/dist/features/memory/react/components/MemoryHooksPanel.js +2 -2
- package/dist/features/memory/react/components/MemoryList.js +2 -2
- package/dist/features/memory/react/components/MemorySettingsPanel.js +2 -2
- package/dist/features/memory/react/components/MemorySuggestionPanel.js +1 -1
- package/dist/features/memory/react/hooks/useMemoryConnectors.hooks.js +3 -3
- package/dist/features/memory/react/hooks/useMemoryConnectors.rules.d.ts +4 -1
- package/dist/features/memory/react/hooks/useMemoryConnectors.rules.js +1 -1
- package/dist/features/memory/react/render-markdown.js +1 -1
- package/dist/features/nav-availability/nav-availability.d.ts +18 -0
- package/dist/features/nav-availability/nav-availability.js +12 -0
- package/dist/features/number-stepper/NumberStepper.d.ts +39 -0
- package/dist/features/number-stepper/NumberStepper.js +16 -0
- package/dist/features/number-stepper/index.d.ts +5 -0
- package/dist/features/number-stepper/index.js +5 -0
- package/dist/features/number-stepper/number-stepper.d.ts +34 -0
- package/dist/features/number-stepper/number-stepper.js +32 -0
- package/dist/features/number-stepper/use-number-stepper.hooks.d.ts +20 -0
- package/dist/features/number-stepper/use-number-stepper.hooks.js +29 -0
- package/dist/features/number-stepper/use-optimistic-number-setting.hooks.d.ts +36 -0
- package/dist/features/number-stepper/use-optimistic-number-setting.hooks.js +25 -0
- package/dist/features/panel-kit/ErrorNotice.js +8 -1
- package/dist/features/panel-kit/helpers/standing-draft-local-backup.d.ts +1 -1
- package/dist/features/panel-kit/helpers/standing-draft-recovery-message.d.ts +1 -1
- package/dist/features/panel-kit/hooks/use-standing-draft-autosave.hooks.d.ts +1 -37
- package/dist/features/panel-kit/hooks/use-standing-draft-recovery.hooks.d.ts +2 -1
- package/dist/features/panel-kit/hooks/use-standing-draft-state.hooks.d.ts +2 -1
- package/dist/features/panel-kit/hooks/use-standing-draft-writes.hooks.d.ts +2 -1
- package/dist/features/panel-kit/index.d.ts +2 -1
- package/dist/features/privacy/react/components/PrivacyTab.d.ts +1 -1
- package/dist/features/privacy/react/components/PrivacyTab.js +1 -1
- package/dist/features/progress-card/components/ProgressCard.d.ts +1 -1
- package/dist/features/progress-card/components/ProgressCard.js +1 -1
- package/dist/features/resource-dashboard/react/components/ResourceBoard.d.ts +1 -1
- package/dist/features/resource-dashboard/react/components/ResourceBoardToolbar.d.ts +1 -1
- package/dist/features/resource-dashboard/react/components/ResourceBoardToolbar.js +1 -1
- package/dist/features/resource-dashboard/react/components/ResourceCardParts.d.ts +1 -1
- package/dist/features/resource-dashboard/react/components/ResourceCardParts.js +7 -2
- package/dist/features/resource-dashboard/react/components/ResourceRowListView.d.ts +1 -1
- package/dist/features/resource-dashboard/react/components/ResourceRowListView.js +1 -1
- package/dist/features/resource-dashboard/react/components/ResourceRunHistoryList.d.ts +1 -1
- package/dist/features/resource-dashboard/react/components/ResourceRunHistoryList.js +1 -1
- package/dist/features/resource-dashboard/react/components/StatusPill.d.ts +1 -1
- package/dist/features/resource-dashboard/react/components/StatusPill.js +1 -1
- package/dist/features/resource-dashboard/react/hooks/useResourceBoard.js +6 -1
- package/dist/features/resource-monitor/ResourceTable.d.ts +67 -0
- package/dist/features/resource-monitor/ResourceTable.js +25 -0
- package/dist/features/resource-monitor/index.d.ts +4 -0
- package/dist/features/resource-monitor/index.js +4 -0
- package/dist/features/resource-monitor/resource-stop.d.ts +16 -0
- package/dist/features/resource-monitor/resource-stop.js +11 -0
- package/dist/features/resource-monitor/use-resource-readings.hooks.d.ts +44 -0
- package/dist/features/resource-monitor/use-resource-readings.hooks.js +91 -0
- package/dist/features/settings/dialog/styles/settings-dialog.css +251 -251
- package/dist/features/site-card/index.d.ts +4 -1
- package/dist/features/site-card/index.js +3 -0
- package/dist/features/site-card/use-created-site-return.hooks.d.ts +36 -0
- package/dist/features/site-card/use-created-site-return.hooks.js +43 -0
- package/dist/features/site-card/use-site-card-preview.hooks.d.ts +39 -0
- package/dist/features/site-card/use-site-card-preview.hooks.js +31 -0
- package/dist/features/site-card/use-site-list-prefs.hooks.d.ts +29 -8
- package/dist/features/site-card/use-site-list-prefs.hooks.js +56 -9
- package/dist/features/site-card/use-site-preview.hooks.d.ts +67 -0
- package/dist/features/site-card/use-site-preview.hooks.js +94 -0
- package/dist/features/sketch-editor/react/components/SketchEditor.d.ts +2 -2
- package/dist/features/sketch-editor/react/components/SketchEditor.js +1 -1
- package/dist/features/skills/react/components/SkillRow.js +1 -1
- package/dist/features/source-config-list/react/components/SourceConfigAddForm.js +2 -2
- package/dist/features/source-config-list/react/components/SourceConfigField.js +1 -1
- package/dist/features/source-config-list/react/components/SourceConfigItemCard.js +5 -5
- package/dist/features/source-config-list/react/components/SourceConfigList.d.ts +1 -1
- package/dist/features/source-config-list/react/components/SourceConfigList.js +1 -1
- package/dist/features/source-config-list/react/components/SourceConfigListView.js +3 -3
- package/dist/features/source-config-list/react/components/SourceConfigTestControl.d.ts +1 -1
- package/dist/features/source-config-list/react/components/SourceConfigTestControl.js +1 -1
- package/dist/features/tab-launcher-menu/react/components/TabLauncherMenu.d.ts +1 -1
- package/dist/features/tab-launcher-menu/react/components/TabLauncherMenu.js +1 -1
- package/dist/features/tab-strip/react/components/TabBar.js +2 -2
- package/dist/features/tab-strip/react/components/TabStrip.d.ts +1 -1
- package/dist/features/tab-strip/react/components/TabStrip.js +1 -1
- package/dist/features/tab-strip/scrollable.js +0 -2
- package/dist/features/tabbed-dialog/react/components/TabbedDialog.d.ts +1 -1
- package/dist/features/tabbed-dialog/react/components/TabbedDialog.js +1 -1
- package/dist/features/version-manager/react/components/VersionManagerModal.d.ts +1 -1
- package/dist/features/version-manager/react/components/VersionManagerModal.js +1 -1
- package/dist/features/viewer-shell/react/components/CommentSidePanel.d.ts +2 -2
- package/dist/features/viewer-shell/react/components/CommentSidePanel.js +1 -1
- package/dist/features/viewer-shell/react/components/MarkdownSplitPane.d.ts +1 -1
- package/dist/features/viewer-shell/react/components/MarkdownSplitPane.js +1 -1
- package/dist/features/viewer-shell/react/components/SegmentedToggle.d.ts +1 -1
- package/dist/features/viewer-shell/react/components/SegmentedToggle.js +1 -1
- package/dist/features/viewer-shell/react/components/ViewportSwitcher.d.ts +1 -1
- package/dist/features/viewer-shell/react/components/ViewportSwitcher.js +1 -1
- package/dist/features/viewer-shell/react/components/ViewportToggleGroup.d.ts +1 -1
- package/dist/features/viewer-shell/react/components/ViewportToggleGroup.js +1 -1
- package/dist/features/zoom/use-zoom.d.ts +141 -0
- package/dist/features/zoom/use-zoom.js +204 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/react/components/ComponentKitPreview.d.ts +1 -1
- package/dist/react/components/ComponentKitPreview.js +1 -1
- package/dist/react/components/CustomSelect.js +1 -1
- package/dist/react/components/ExportDiagnosticsButton.d.ts +6 -2
- package/dist/react/components/ExportDiagnosticsButton.js +3 -3
- package/dist/react/components/FileImportPanel.js +1 -1
- package/dist/react/components/IconFrame.d.ts +15 -0
- package/dist/react/components/IconFrame.js +11 -0
- package/dist/react/components/ImportChoice.js +1 -1
- package/dist/react/components/Notice.js +1 -1
- package/dist/react/components/OnboardingDropdown.js +1 -1
- package/dist/react/components/PaletteTweaks.js +1 -1
- package/dist/react/components/TooltipLayer.d.ts +13 -3
- package/dist/react/components/TooltipLayer.js +12 -12
- package/dist/react/mcp-ui/host-message-source.d.ts +3 -1
- package/dist/react/mcp-ui/host-message-source.js +1 -1
- package/dist/react/testing.js +3 -1
- package/dist/renderers/annotation-canvas/rules.js +30 -27
- package/dist/renderers/react/components/ArtifactView.js +1 -1
- package/dist/renderers/renderers/markdown.d.ts +3 -1
- package/dist/renderers/renderers/markdown.js +2 -2
- package/dist/styles/admin.css +54 -54
- package/dist/utils/zip.js +43 -36
- package/package.json +66 -9
- package/dist/features/execution/ports.d.ts +0 -71
- package/dist/features/execution/ports.js +0 -2
- package/dist/features/execution/types.d.ts +0 -472
- package/dist/features/execution/types.js +0 -2
- package/dist/react/components/CustomSelectMarkup.d.ts +0 -27
- package/dist/react/components/CustomSelectMarkup.js +0 -35
|
@@ -13,7 +13,7 @@ import { SourceConfigItemCard } from './SourceConfigItemCard.js';
|
|
|
13
13
|
export function SourceConfigListView(props) {
|
|
14
14
|
const { title, subtitle, fieldSpecs, trustOptions, addForm, agentHandle } = props;
|
|
15
15
|
const resolvedAddFormHandle = addForm.agentHandle ?? (agentHandle ? sourceConfigAddFormHandle({ listBase: agentHandle }) : undefined);
|
|
16
|
-
return (_jsxs("section", { className: "source-config-list", children: [_jsx(SourceConfigListHead, { title: title, subtitle: subtitle }), _jsx(SourceConfigAddForm, { ...addForm, fieldSpecs: fieldSpecs, ...(trustOptions ? { trustOptions } : {}), ...(resolvedAddFormHandle ? { agentHandle: resolvedAddFormHandle } : {}) }), _jsx(SourceConfigListError, { loadError: props.loadError }), _jsx(SourceConfigListBody, { ...props })] }));
|
|
16
|
+
return (_jsxs("section", { className: "jini-ui-source-config-list", children: [_jsx(SourceConfigListHead, { title: title, subtitle: subtitle }), _jsx(SourceConfigAddForm, { ...addForm, fieldSpecs: fieldSpecs, ...(trustOptions ? { trustOptions } : {}), ...(resolvedAddFormHandle ? { agentHandle: resolvedAddFormHandle } : {}) }), _jsx(SourceConfigListError, { loadError: props.loadError }), _jsx(SourceConfigListBody, { ...props })] }));
|
|
17
17
|
}
|
|
18
18
|
/** The optional title/subtitle block — omitted entirely when neither is given. */
|
|
19
19
|
function SourceConfigListHead({ title, subtitle, useTHook = useT }) {
|
|
@@ -33,7 +33,7 @@ function SourceConfigListBody({ useTHook = useT, ...props }) {
|
|
|
33
33
|
const t = useTHook();
|
|
34
34
|
const { sources, loading, emptyMessage, agentHandle } = props;
|
|
35
35
|
if (loading) {
|
|
36
|
-
return (_jsx("div", { className: "source-config-list-loading", role: "status", children: t('Loading…') }));
|
|
36
|
+
return (_jsx("div", { className: "jini-ui-source-config-list-loading", role: "status", children: t('Loading…') }));
|
|
37
37
|
}
|
|
38
38
|
if (sources.length === 0) {
|
|
39
39
|
return _jsx("div", { className: "jini-source-config-list-empty", children: emptyMessage ? t(emptyMessage) : t('No sources configured yet.') });
|
|
@@ -42,7 +42,7 @@ function SourceConfigListBody({ useTHook = useT, ...props }) {
|
|
|
42
42
|
// the O(n) suffix-search dedup in `buildAgentListHandles` runs once for the whole list, not once
|
|
43
43
|
// per item.
|
|
44
44
|
const itemHandles = agentHandle ? sourceConfigItemHandles({ listBase: agentHandle, sourceIds: sources.map((source) => source.id) }) : undefined;
|
|
45
|
-
return (_jsx("div", { className: "source-config-list-items", children: sources.map((source, index) => (_jsx(SourceConfigListItem, { ...props, source: source, ...(itemHandles ? { itemHandle: itemHandles[index] } : {}) }, source.id))) }));
|
|
45
|
+
return (_jsx("div", { className: "jini-ui-source-config-list-items", children: sources.map((source, index) => (_jsx(SourceConfigListItem, { ...props, source: source, ...(itemHandles ? { itemHandle: itemHandles[index] } : {}) }, source.id))) }));
|
|
46
46
|
}
|
|
47
47
|
/** One source's card, with the list-level per-id callbacks and pending state bound to that source. */
|
|
48
48
|
function SourceConfigListItem({ source, itemHandle, fieldSpecs, trustOptions, capabilities, pendingKeys, testResults, onRefresh, onRemove, onTrustChange, onTest, onUpdate, }) {
|
|
@@ -23,7 +23,7 @@ export interface SourceConfigTestControlProps {
|
|
|
23
23
|
* and `McpClientSection.tsx`'s `McpOAuthControl` status/action shape, but
|
|
24
24
|
* deliberately simplified — the OAuth-specific postMessage/polling handshake
|
|
25
25
|
* and the "ready to test" pre-flight hint are origin-source-specific UX, not
|
|
26
|
-
* part of this generic primitive. See `
|
|
26
|
+
* part of this generic primitive. See `070311a07^:packages/ui/source-map.md` (section "features/source-config-list/").
|
|
27
27
|
*
|
|
28
28
|
* ## Agent handles
|
|
29
29
|
*
|
|
@@ -7,7 +7,7 @@ import { sourceConfigAgentProps } from '../../agent-handles.js';
|
|
|
7
7
|
* and `McpClientSection.tsx`'s `McpOAuthControl` status/action shape, but
|
|
8
8
|
* deliberately simplified — the OAuth-specific postMessage/polling handshake
|
|
9
9
|
* and the "ready to test" pre-flight hint are origin-source-specific UX, not
|
|
10
|
-
* part of this generic primitive. See `
|
|
10
|
+
* part of this generic primitive. See `070311a07^:packages/ui/source-map.md` (section "features/source-config-list/").
|
|
11
11
|
*
|
|
12
12
|
* ## Agent handles
|
|
13
13
|
*
|
|
@@ -20,7 +20,7 @@ export interface TabLauncherMenuProps<TActionCtx = void> extends UseTabLauncherM
|
|
|
20
20
|
* `TabLauncherResultItem`; `LauncherAction`/`LauncherContext` become
|
|
21
21
|
* `TabLauncherAction<TActionCtx>` generic over whatever context the host's
|
|
22
22
|
* actions need; the OD analytics contract (`TabLauncherClickProps`) becomes
|
|
23
|
-
* a generic `TabLauncherTrackEvent` union. See `
|
|
23
|
+
* a generic `TabLauncherTrackEvent` union. See `070311a07^:packages/ui/source-map.md` (section "features/tab-launcher-menu/")
|
|
24
24
|
* for the full genericization writeup, including why this is a distinct
|
|
25
25
|
* primitive from `features/command-palette/`.
|
|
26
26
|
*/
|
|
@@ -54,7 +54,7 @@ function TabLauncherScrollBody({ menu, renderIcon, useTHook = useT }) {
|
|
|
54
54
|
* `TabLauncherResultItem`; `LauncherAction`/`LauncherContext` become
|
|
55
55
|
* `TabLauncherAction<TActionCtx>` generic over whatever context the host's
|
|
56
56
|
* actions need; the OD analytics contract (`TabLauncherClickProps`) becomes
|
|
57
|
-
* a generic `TabLauncherTrackEvent` union. See `
|
|
57
|
+
* a generic `TabLauncherTrackEvent` union. See `070311a07^:packages/ui/source-map.md` (section "features/tab-launcher-menu/")
|
|
58
58
|
* for the full genericization writeup, including why this is a distinct
|
|
59
59
|
* primitive from `features/command-palette/`.
|
|
60
60
|
*/
|
|
@@ -26,12 +26,12 @@ function tabAccessibleLabel({ tab }, _optional = {}) {
|
|
|
26
26
|
* an inline map callback under the cyclomatic/cognitive complexity gate. Derived props live in
|
|
27
27
|
* TabBar.hooks.tsx; tabDotAccessibleSuffix stays here because it renders JSX. */
|
|
28
28
|
function TabBarButton({ tab, active, tabIndex, onChange, }) {
|
|
29
|
-
return (_jsxs("button", { type: "button", role: "tab", className: "tab-bar-item", "aria-selected": active, "aria-label": tabAccessibleLabel({ tab }), "aria-disabled": tab.disabled || undefined, disabled: tab.disabled, tabIndex: tabIndex, onClick: tab.disabled ? undefined : () => onChange(tab.id), ...tabHandleProps({ tab: tab }), children: [tab.dot ? _jsx("span", { className: "tab-bar-dot", "aria-hidden": "true" }) : null, tab.icon ? (_jsx("span", { className: "tab-bar-icon", "aria-hidden": "true", children: tab.icon })) : null, tab.label, tabDotAccessibleSuffix(tab), tab.tag ? _jsx("span", { className: "tab-bar-tag", children: tab.tag }) : null, tab.count !== undefined ? _jsx("span", { className: "tab-bar-count", children: tab.count }) : null] }));
|
|
29
|
+
return (_jsxs("button", { type: "button", role: "tab", className: "jini-ui-tab-bar-item", "aria-selected": active, "aria-label": tabAccessibleLabel({ tab }), "aria-disabled": tab.disabled || undefined, disabled: tab.disabled, tabIndex: tabIndex, onClick: tab.disabled ? undefined : () => onChange(tab.id), ...tabHandleProps({ tab: tab }), children: [tab.dot ? _jsx("span", { className: "jini-tab-bar-dot", "aria-hidden": "true" }) : null, tab.icon ? (_jsx("span", { className: "jini-ui-tab-bar-icon", "aria-hidden": "true", children: tab.icon })) : null, tab.label, tabDotAccessibleSuffix(tab), tab.tag ? _jsx("span", { className: "jini-tab-bar-tag", children: tab.tag }) : null, tab.count !== undefined ? _jsx("span", { className: "jini-ui-tab-bar-count", children: tab.count }) : null] }));
|
|
30
30
|
}
|
|
31
31
|
/** Controlled button-based selection strip, including roving focus and optional agent handles. */
|
|
32
32
|
export function TabBar({ tabs, activeId, onChange, ariaLabel, containerHandle, useTabBarKeyboardHook = useTabBarKeyboard, useActiveTabInViewHook = useActiveTabInView, }) {
|
|
33
33
|
const { onKeyDown } = useTabBarKeyboardHook({ tabs: tabs, activeId: activeId, onChange: onChange });
|
|
34
34
|
const stripRef = useActiveTabInViewHook({ activeId: activeId });
|
|
35
|
-
return (_jsx(TabStripFrame, { ref: stripRef, className: "tab-bar", role: "tablist", "aria-label": ariaLabel, onKeyDown: onKeyDown, ...(containerHandle ? agentHandle({ handle: containerHandle }, { role: "region", label: ariaLabel }) : {}), children: tabs.map((tab) => (_jsx(TabBarButton, { tab: tab, active: activeId === tab.id, tabIndex: resolveTabBarTabIndex({ tabs: tabs, activeId: activeId, tab: tab }), onChange: onChange }, tab.id))) }));
|
|
35
|
+
return (_jsx(TabStripFrame, { ref: stripRef, className: "jini-ui-tab-bar", role: "tablist", "aria-label": ariaLabel, onKeyDown: onKeyDown, ...(containerHandle ? agentHandle({ handle: containerHandle }, { role: "region", label: ariaLabel }) : {}), children: tabs.map((tab) => (_jsx(TabBarButton, { tab: tab, active: activeId === tab.id, tabIndex: resolveTabBarTabIndex({ tabs: tabs, activeId: activeId, tab: tab }), onChange: onChange }, tab.id))) }));
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=TabBar.js.map
|
|
@@ -31,7 +31,7 @@ export interface TabStripProps extends AgentControlProps {
|
|
|
31
31
|
* `FileWorkspace.tsx` (a project's file/terminal/browser tab strip)
|
|
32
32
|
* independently hand-rolled. Tab content, order (`tabs`), and active id are
|
|
33
33
|
* fully host-owned; this component only supplies the shared drag/reorder/
|
|
34
|
-
* active/close-button chrome. See `
|
|
34
|
+
* active/close-button chrome. See `070311a07^:packages/ui/source-map.md` (section "features/tab-strip/"), its
|
|
35
35
|
* `features/tab-strip/` section for what each source shape contributed and
|
|
36
36
|
* what stayed host-specific (hover-preview popover, search-tabs popover,
|
|
37
37
|
* global keyboard shortcuts, and localStorage/route-sync persistence are
|
|
@@ -12,7 +12,7 @@ import { TabStripFrame } from './TabStripFrame.js';
|
|
|
12
12
|
* `FileWorkspace.tsx` (a project's file/terminal/browser tab strip)
|
|
13
13
|
* independently hand-rolled. Tab content, order (`tabs`), and active id are
|
|
14
14
|
* fully host-owned; this component only supplies the shared drag/reorder/
|
|
15
|
-
* active/close-button chrome. See `
|
|
15
|
+
* active/close-button chrome. See `070311a07^:packages/ui/source-map.md` (section "features/tab-strip/"), its
|
|
16
16
|
* `features/tab-strip/` section for what each source shape contributed and
|
|
17
17
|
* what stayed host-specific (hover-preview popover, search-tabs popover,
|
|
18
18
|
* global keyboard shortcuts, and localStorage/route-sync persistence are
|
|
@@ -36,8 +36,6 @@ export function navigateTabList({ strip, event }, _optional = {}) {
|
|
|
36
36
|
if (next === undefined)
|
|
37
37
|
return;
|
|
38
38
|
const tab = tabs[next];
|
|
39
|
-
if (!tab)
|
|
40
|
-
throw new Error('tab strip navigation has no target tab');
|
|
41
39
|
event.preventDefault();
|
|
42
40
|
tab.focus();
|
|
43
41
|
tab.click();
|
|
@@ -65,7 +65,7 @@ export interface TabbedDialogProps<T extends TabbedDialogTab = TabbedDialogTab>
|
|
|
65
65
|
* it as the reference host, not a special case this component needs to know about.
|
|
66
66
|
*
|
|
67
67
|
* Proof this is separable from any one tab's content: in the origin `SettingsDialog.tsx`
|
|
68
|
-
* (the 8,538-line vendored OD reference — see `
|
|
68
|
+
* (the 8,538-line vendored OD reference — see `070311a07^:packages/ui/source-map.md` (section "features/settings-dialog/")), 8 of its 17
|
|
69
69
|
* real tabs were already separate files the original component merely mounted — the shell
|
|
70
70
|
* itself never reached into a tab's internals.
|
|
71
71
|
*/
|
|
@@ -21,7 +21,7 @@ import { buildTabbedDialogClassName, dialogRootRoleProps, resolveIsModal, resolv
|
|
|
21
21
|
* it as the reference host, not a special case this component needs to know about.
|
|
22
22
|
*
|
|
23
23
|
* Proof this is separable from any one tab's content: in the origin `SettingsDialog.tsx`
|
|
24
|
-
* (the 8,538-line vendored OD reference — see `
|
|
24
|
+
* (the 8,538-line vendored OD reference — see `070311a07^:packages/ui/source-map.md` (section "features/settings-dialog/")), 8 of its 17
|
|
25
25
|
* real tabs were already separate files the original component merely mounted — the shell
|
|
26
26
|
* itself never reached into a tab's internals.
|
|
27
27
|
*/
|
|
@@ -21,7 +21,7 @@ export interface VersionManagerModalProps<TVersion extends VersionRecord> {
|
|
|
21
21
|
/**
|
|
22
22
|
* The generic slice of the source's `FileVersionManagerModal`: a list +
|
|
23
23
|
* cached-preview + restore + search modal shell. See
|
|
24
|
-
* `
|
|
24
|
+
* `070311a07^:packages/ui/source-map.md` (section "`html-viewer` — classification of `HtmlViewer` + `FileVersionManagerModal`") for
|
|
25
25
|
* what was dropped (deploy/analytics calls — there were none; the actual
|
|
26
26
|
* fetch/restore/preview-resolution calls became the injected
|
|
27
27
|
* `VersionManagerPort`).
|
|
@@ -34,7 +34,7 @@ function VersionManagerHeader({ controller, fileName, copied, onCopy, onClose, p
|
|
|
34
34
|
/**
|
|
35
35
|
* The generic slice of the source's `FileVersionManagerModal`: a list +
|
|
36
36
|
* cached-preview + restore + search modal shell. See
|
|
37
|
-
* `
|
|
37
|
+
* `070311a07^:packages/ui/source-map.md` (section "`html-viewer` — classification of `HtmlViewer` + `FileVersionManagerModal`") for
|
|
38
38
|
* what was dropped (deploy/analytics calls — there were none; the actual
|
|
39
39
|
* fetch/restore/preview-resolution calls became the injected
|
|
40
40
|
* `VersionManagerPort`).
|
|
@@ -26,7 +26,7 @@ export interface CommentSidePanelProps<TComment extends ViewerCommentBase> {
|
|
|
26
26
|
* `elementId`/`label`/`htmlHint` conventions (regex-matching HTML tag
|
|
27
27
|
* names embedded in a board-annotation payload) — that heuristic is not
|
|
28
28
|
* generic, so it's a required host-supplied function here rather than
|
|
29
|
-
* baked in. See `
|
|
29
|
+
* baked in. See `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/") for the full discrepancy
|
|
30
30
|
* writeup.
|
|
31
31
|
*/
|
|
32
32
|
getCommentLabel: (comment: TComment, index: number) => string;
|
|
@@ -58,7 +58,7 @@ export interface CommentSidePanelProps<TComment extends ViewerCommentBase> {
|
|
|
58
58
|
* this extraction) is that the comment-label and timestamp derivation are
|
|
59
59
|
* OD-specific logic, not just an OD-specific *type* — see
|
|
60
60
|
* `getCommentLabel`/`getCommentTimestamp` above and
|
|
61
|
-
* `
|
|
61
|
+
* `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/").
|
|
62
62
|
*/
|
|
63
63
|
export declare function CommentSidePanel<TComment extends ViewerCommentBase>({ useCommentReorder: useCommentReorderHook, useTHook, useCommentTimestampFormatterHook, useCollapseToggleFocusHook, ...props }: CommentSidePanelProps<TComment>): import("react").JSX.Element;
|
|
64
64
|
type ToggleFocusTarget = 'collapsed' | 'expanded';
|
|
@@ -14,7 +14,7 @@ import { CommentSideAttachments, CommentSideCreateForm, CommentSideSelectBar } f
|
|
|
14
14
|
* this extraction) is that the comment-label and timestamp derivation are
|
|
15
15
|
* OD-specific logic, not just an OD-specific *type* — see
|
|
16
16
|
* `getCommentLabel`/`getCommentTimestamp` above and
|
|
17
|
-
* `
|
|
17
|
+
* `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/").
|
|
18
18
|
*/
|
|
19
19
|
export function CommentSidePanel({ useCommentReorder: useCommentReorderHook = useCommentReorder, useTHook = useT, useCommentTimestampFormatterHook = useCommentTimestampFormatter, useCollapseToggleFocusHook = useCollapseToggleFocus, ...props }) {
|
|
20
20
|
const { comments, selectedIds, collapsed, onCollapsedChange, onReorder } = props;
|
|
@@ -53,7 +53,7 @@ export type MarkdownSplitPaneHooks = typeof defaultMarkdownSplitPaneHooks;
|
|
|
53
53
|
* one-line description, also without the autosave/debounce-write pipeline,
|
|
54
54
|
* image paste/drop upload, and shiki-based code-block syntax highlighting,
|
|
55
55
|
* all of which are genuinely product/daemon-specific (see
|
|
56
|
-
* `
|
|
56
|
+
* `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/") for the full disclosure). A host renders its
|
|
57
57
|
* own markdown-to-HTML pipeline and passes the result as `previewHtml`.
|
|
58
58
|
*/
|
|
59
59
|
export declare function MarkdownSplitPane({ mode, onModeChange, sourceText, onSourceChange, previewHtml, previewSelector, loading, loadingLabel, sourceLabel, splitLabel, previewLabel, editorAriaLabel, previewAriaLabel, modeAriaLabel, toolbarLeftExtra, toolbarActions, editorTextareaProps, onPreviewClick, hooks, }: MarkdownSplitPaneProps): import("react").JSX.Element;
|
|
@@ -19,7 +19,7 @@ function MarkdownToolbarLeft({ extra, ...tabsProps }) {
|
|
|
19
19
|
* one-line description, also without the autosave/debounce-write pipeline,
|
|
20
20
|
* image paste/drop upload, and shiki-based code-block syntax highlighting,
|
|
21
21
|
* all of which are genuinely product/daemon-specific (see
|
|
22
|
-
* `
|
|
22
|
+
* `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/") for the full disclosure). A host renders its
|
|
23
23
|
* own markdown-to-HTML pipeline and passes the result as `previewHtml`.
|
|
24
24
|
*/
|
|
25
25
|
export function MarkdownSplitPane({ mode, onModeChange, sourceText, onSourceChange, previewHtml, previewSelector, loading = false, loadingLabel, sourceLabel, splitLabel, previewLabel, editorAriaLabel, previewAriaLabel, modeAriaLabel, toolbarLeftExtra, toolbarActions, editorTextareaProps, onPreviewClick, hooks = defaultMarkdownSplitPaneHooks, }) {
|
|
@@ -16,7 +16,7 @@ export interface SegmentedToggleProps<TValue extends string> {
|
|
|
16
16
|
* `aria-pressed` for the viewport toggle vs. an implicit tab-like button
|
|
17
17
|
* group for the mode tabs) — this version standardizes on
|
|
18
18
|
* `role="group"`/`aria-pressed` for both, a disclosed simplification (see
|
|
19
|
-
* `
|
|
19
|
+
* `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/")) rather than shipping two near-identical
|
|
20
20
|
* primitives for a minor ARIA-pattern difference.
|
|
21
21
|
*/
|
|
22
22
|
export declare function SegmentedToggle<TValue extends string>({ options, value, onChange, ariaLabel, className, }: SegmentedToggleProps<TValue>): import("react").JSX.Element;
|
|
@@ -11,7 +11,7 @@ import { withClassName } from '../../../../utils/class-names.js';
|
|
|
11
11
|
* `aria-pressed` for the viewport toggle vs. an implicit tab-like button
|
|
12
12
|
* group for the mode tabs) — this version standardizes on
|
|
13
13
|
* `role="group"`/`aria-pressed` for both, a disclosed simplification (see
|
|
14
|
-
* `
|
|
14
|
+
* `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/")) rather than shipping two near-identical
|
|
15
15
|
* primitives for a minor ARIA-pattern difference.
|
|
16
16
|
*/
|
|
17
17
|
export function SegmentedToggle({ options, value, onChange, ariaLabel, className, }) {
|
|
@@ -23,7 +23,7 @@ export interface ViewportSwitcherProps {
|
|
|
23
23
|
* the other component didn't have. This component is that shared primitive
|
|
24
24
|
* — when that other file's extraction happens, it should bind to this
|
|
25
25
|
* component rather than re-implement its own dropdown switcher. See
|
|
26
|
-
* `
|
|
26
|
+
* `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/") for the full comparison.
|
|
27
27
|
*/
|
|
28
28
|
export declare function ViewportSwitcher({ presets, viewport, onViewport, ariaLabel, tabIndex, useDismissOnOutsideOrEscapeHook }: ViewportSwitcherProps): import("react").JSX.Element | null;
|
|
29
29
|
//# sourceMappingURL=ViewportSwitcher.d.ts.map
|
|
@@ -18,7 +18,7 @@ import { useDismissOnOutsideOrEscape } from '../../../../browser/useDismissOnOut
|
|
|
18
18
|
* the other component didn't have. This component is that shared primitive
|
|
19
19
|
* — when that other file's extraction happens, it should bind to this
|
|
20
20
|
* component rather than re-implement its own dropdown switcher. See
|
|
21
|
-
* `
|
|
21
|
+
* `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/") for the full comparison.
|
|
22
22
|
*/
|
|
23
23
|
export function ViewportSwitcher({ presets, viewport, onViewport, ariaLabel, tabIndex, useDismissOnOutsideOrEscapeHook = useDismissOnOutsideOrEscape }) {
|
|
24
24
|
const [open, setOpen] = useState(false);
|
|
@@ -10,7 +10,7 @@ export interface ViewportToggleGroupProps {
|
|
|
10
10
|
* source component's `FileVersionViewportControls` (used in its file-version
|
|
11
11
|
* manager's tighter toolbar, where a dropdown menu didn't fit). See
|
|
12
12
|
* `ViewportSwitcher` for the dropdown-menu variant used by the main preview
|
|
13
|
-
* toolbar (`PreviewViewportControls`), and `
|
|
13
|
+
* toolbar (`PreviewViewportControls`), and `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/") for
|
|
14
14
|
* why both ship rather than just one.
|
|
15
15
|
*/
|
|
16
16
|
export declare function ViewportToggleGroup({ presets, viewport, onViewport, ariaLabel }: ViewportToggleGroupProps): import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { SegmentedToggle } from './SegmentedToggle.js';
|
|
|
5
5
|
* source component's `FileVersionViewportControls` (used in its file-version
|
|
6
6
|
* manager's tighter toolbar, where a dropdown menu didn't fit). See
|
|
7
7
|
* `ViewportSwitcher` for the dropdown-menu variant used by the main preview
|
|
8
|
-
* toolbar (`PreviewViewportControls`), and `
|
|
8
|
+
* toolbar (`PreviewViewportControls`), and `070311a07^:packages/ui/source-map.md` (section "features/viewer-shell/") for
|
|
9
9
|
* why both ship rather than just one.
|
|
10
10
|
*/
|
|
11
11
|
export function ViewportToggleGroup({ presets, viewport, onViewport, ariaLabel }) {
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { ZoomDirection } from '@jini-ai/core/contracts/desktop-zoom';
|
|
2
|
+
/** The slice of Electron's `<webview>` this file drives. A fake of it is what tests pass.
|
|
3
|
+
*
|
|
4
|
+
* Structural rather than Electron's own type, so this browser package never imports Electron. The
|
|
5
|
+
* two listener methods are spelled out for `'dom-ready'` alone: Electron's `addEventListener` is an
|
|
6
|
+
* OVERLOAD SET covering every webview event, and copying it would oblige a fake to satisfy all of
|
|
7
|
+
* them. A real `<webview>` still satisfies this narrower pair, and it says exactly what zoom listens
|
|
8
|
+
* for — see {@link applyStoredZoom}. */
|
|
9
|
+
export interface ZoomableGuest {
|
|
10
|
+
getZoomLevel(): number;
|
|
11
|
+
setZoomLevel(level: number): void;
|
|
12
|
+
addEventListener(event: 'dom-ready', listener: (event: Event) => void): void;
|
|
13
|
+
removeEventListener(event: 'dom-ready', listener: (event: Event) => void): void;
|
|
14
|
+
}
|
|
15
|
+
/** The preload bridge slice this file drives: the menu's command push and the top page's zoom. */
|
|
16
|
+
export interface ZoomBridge {
|
|
17
|
+
onZoomCommand(required: {
|
|
18
|
+
listener: (direction: ZoomDirection) => void;
|
|
19
|
+
}): () => void;
|
|
20
|
+
getZoomLevel(): number;
|
|
21
|
+
setZoomLevel(required: {
|
|
22
|
+
level: number;
|
|
23
|
+
}): void;
|
|
24
|
+
}
|
|
25
|
+
/** The slice of `Storage` this file drives — narrow enough that a plain object satisfies it in
|
|
26
|
+
* tests, and permissive about a call that throws (a private window, or storage disabled). */
|
|
27
|
+
export type ZoomStorage = Pick<Storage, 'getItem' | 'setItem'>;
|
|
28
|
+
/** The window's own `localStorage`, resolved at each call rather than once at render. Reading the
|
|
29
|
+
* `window.localStorage` getter can itself throw (storage denied, a sandboxed origin), so it must
|
|
30
|
+
* never run during a render — a throw there would blank the whole window even when no guest or
|
|
31
|
+
* zoom command is in play. Resolved here instead, inside {@link readStoredZoom} /
|
|
32
|
+
* {@link writeStoredZoom}'s own `try`, a denied store degrades to session-only zoom. A module-level
|
|
33
|
+
* constant, so its identity is stable across renders and never re-runs the hook's effects. */
|
|
34
|
+
export declare const windowZoomStorage: ZoomStorage;
|
|
35
|
+
/** Which surface a zoom command should run against right now. Mirrors the host's Find target, one
|
|
36
|
+
* target kind narrower: there is no `'none'` id to carry for `'guest'` here, so the element itself
|
|
37
|
+
* doubles as its own key via the caller's own `projectId`. */
|
|
38
|
+
export type ZoomTarget = {
|
|
39
|
+
kind: 'guest';
|
|
40
|
+
element: ZoomableGuest;
|
|
41
|
+
projectId: string;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'top';
|
|
44
|
+
} | {
|
|
45
|
+
kind: 'none';
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Decides {@link ZoomTarget}: the visible tab's guest when one is on screen and its element has
|
|
49
|
+
* actually mounted, otherwise the window's own top-level page — as long as a bridge exists to reach
|
|
50
|
+
* it (never true outside a real desktop window). `'none'` only when neither is available.
|
|
51
|
+
*
|
|
52
|
+
* @complexity O(1) — one `Map.get`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveZoomTarget(input: {
|
|
55
|
+
activeGuestId: string | null;
|
|
56
|
+
guests: ReadonlyMap<string, ZoomableGuest>;
|
|
57
|
+
bridge: ZoomBridge | undefined;
|
|
58
|
+
}, _options?: Record<string, never>): ZoomTarget;
|
|
59
|
+
/** One command's new zoom level. `'reset'` returns to 0 (100%) outright; `'in'`/`'out'` step by
|
|
60
|
+
* {@link ZOOM_STEP} from `current`. Chromium itself clamps the result to its own zoom range, so
|
|
61
|
+
* this does not — a cap here could only ever be looser or stricter than the real one underneath. */
|
|
62
|
+
export declare function nextZoomLevel({ current, direction }: {
|
|
63
|
+
current: number;
|
|
64
|
+
direction: ZoomDirection;
|
|
65
|
+
}, _options?: Record<string, never>): number;
|
|
66
|
+
/** Reads a persisted per-guest zoom level, defaulting to 0 (100%) for an unset, corrupt, or
|
|
67
|
+
* unreadable entry — never throws, since a lost preference is a cosmetic regression and a thrown
|
|
68
|
+
* read must not be.
|
|
69
|
+
* @complexity O(1). */
|
|
70
|
+
export declare function readStoredZoom({ storage, projectId, keyPrefix }: {
|
|
71
|
+
storage: ZoomStorage;
|
|
72
|
+
projectId: string;
|
|
73
|
+
keyPrefix: string;
|
|
74
|
+
}, _options?: Record<string, never>): number;
|
|
75
|
+
/** Persists one guest's zoom level. Best-effort: a full or disabled store must not break zooming
|
|
76
|
+
* for the rest of the session, only the memory of it.
|
|
77
|
+
* @complexity O(1). */
|
|
78
|
+
export declare function writeStoredZoom({ storage, projectId, keyPrefix, level }: {
|
|
79
|
+
storage: ZoomStorage;
|
|
80
|
+
projectId: string;
|
|
81
|
+
keyPrefix: string;
|
|
82
|
+
level: number;
|
|
83
|
+
}, _options?: Record<string, never>): void;
|
|
84
|
+
/**
|
|
85
|
+
* Applies a guest's remembered zoom to a guest that has just (re)registered, deferring to the
|
|
86
|
+
* guest's `dom-ready` when it is not attached yet.
|
|
87
|
+
*
|
|
88
|
+
* **This runs inside a React ref callback, so it must not throw.** A `<webview>` is attached to the
|
|
89
|
+
* DOM before it is usable, and the ref fires at attach — every method on it throws until
|
|
90
|
+
* `dom-ready`, and a throw escaping a ref callback unmounts the tree, blanking the whole window the
|
|
91
|
+
* moment a tab mounts. Swallowing alone would not do, either: the ref is the ONLY moment a
|
|
92
|
+
* registration happens, so a swallowed first attempt would quietly retire per-guest zoom memory
|
|
93
|
+
* altogether. Hence the one-shot `dom-ready` wait — the level is deferred, not lost.
|
|
94
|
+
*
|
|
95
|
+
* @complexity O(1). At most one listener per registration, removed the first time it fires.
|
|
96
|
+
*/
|
|
97
|
+
export declare function applyStoredZoom({ element, projectId, storage, keyPrefix }: {
|
|
98
|
+
element: ZoomableGuest;
|
|
99
|
+
projectId: string;
|
|
100
|
+
storage: ZoomStorage;
|
|
101
|
+
keyPrefix: string;
|
|
102
|
+
}, _options?: Record<string, never>): void;
|
|
103
|
+
/**
|
|
104
|
+
* Runs one zoom command against `target`, persisting the result when the target is a guest.
|
|
105
|
+
*
|
|
106
|
+
* @complexity O(1).
|
|
107
|
+
*/
|
|
108
|
+
export declare function applyZoomCommand({ target, bridge, direction, storage, keyPrefix }: {
|
|
109
|
+
target: ZoomTarget;
|
|
110
|
+
bridge: ZoomBridge | undefined;
|
|
111
|
+
direction: ZoomDirection;
|
|
112
|
+
storage: ZoomStorage;
|
|
113
|
+
keyPrefix: string;
|
|
114
|
+
}, _options?: Record<string, never>): void;
|
|
115
|
+
export interface UseZoom {
|
|
116
|
+
/** Wired into every mounted tab's `<webview>` ref, composed with the host's other guest refs.
|
|
117
|
+
* `null` deregisters (the tab closed or its guest remounted); a non-null registration
|
|
118
|
+
* immediately re-applies that guest's stored zoom, which is what makes a remembered zoom survive
|
|
119
|
+
* a recovery reload's fresh `<webview>` instance. */
|
|
120
|
+
registerGuest: (projectId: string, element: ZoomableGuest | null) => void;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The Zoom feature's whole runtime behaviour: subscribing to the app menu's command and routing it
|
|
124
|
+
* to whichever surface is on screen, plus re-applying a guest's remembered zoom whenever it
|
|
125
|
+
* (re)mounts.
|
|
126
|
+
*
|
|
127
|
+
* @param input.activeGuestId the visible tab's id, or `null` when the window's own screen is on
|
|
128
|
+
* display (the same argument the host gives its Find-in-page hook).
|
|
129
|
+
* @param input.bridge the preload bridge port, or `undefined` outside a desktop window.
|
|
130
|
+
* @param input.keyPrefix the host's `localStorage` key prefix for per-guest levels.
|
|
131
|
+
* @param options.storage where per-guest zoom levels persist; defaults to {@link windowZoomStorage}.
|
|
132
|
+
* @complexity O(1) per command, beyond `applyZoomCommand`'s own cost.
|
|
133
|
+
*/
|
|
134
|
+
export declare function useZoom({ activeGuestId, bridge, keyPrefix }: {
|
|
135
|
+
activeGuestId: string | null;
|
|
136
|
+
bridge: ZoomBridge | undefined;
|
|
137
|
+
keyPrefix: string;
|
|
138
|
+
}, { storage }?: {
|
|
139
|
+
storage?: ZoomStorage;
|
|
140
|
+
}): UseZoom;
|
|
141
|
+
//# sourceMappingURL=use-zoom.d.ts.map
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file A desktop window's Zoom In / Zoom Out / Actual Size (Cmd+Plus / Cmd+- / Cmd+0): routing a
|
|
3
|
+
* command to whichever surface is actually on screen, and remembering an embedded guest's own zoom
|
|
4
|
+
* level across reloads and relaunches.
|
|
5
|
+
*
|
|
6
|
+
* **Two different targets, the same split the host's Find-in-page documents.** When an embedded tab
|
|
7
|
+
* is the visible surface, its `<webview>` guest is the target — Electron's `WebviewTag` exposes
|
|
8
|
+
* `getZoomLevel`/`setZoomLevel` directly on that DOM element, no IPC needed. When the window's own
|
|
9
|
+
* screen is on display, the target is the window's OWN top-level page, reached through
|
|
10
|
+
* {@link ZoomBridge}'s `getZoomLevel`/`setZoomLevel` — synchronous calls into the preload's own
|
|
11
|
+
* `webFrame`, not a main-process round trip (`webFrame` is the renderer-process API for a frame's
|
|
12
|
+
* OWN zoom, so that target needs no IPC here, unlike Find's). {@link resolveZoomTarget} is the one
|
|
13
|
+
* place that decides which.
|
|
14
|
+
*
|
|
15
|
+
* **Per-guest zoom persists in `localStorage`, keyed by the guest's id.** A `<webview>`'s own zoom
|
|
16
|
+
* level lives on its Chromium WebContents instance, which a host that keys the element on a reload
|
|
17
|
+
* nonce discards and recreates on every recovery reload — so without this, a remembered zoom would
|
|
18
|
+
* reset the moment a stalled guest gets rebuilt, let alone across an app relaunch. `localStorage` is
|
|
19
|
+
* the window's OWN per-origin storage (a stable `file://` origin when the window is loaded from a
|
|
20
|
+
* file), so no new main-process store or IPC channel earns its cost for ten bytes per guest;
|
|
21
|
+
* `registerGuest` re-applies the stored level every time a guest (re)registers, which covers both a
|
|
22
|
+
* tab switch back to an already-zoomed guest and a fresh WebContents after a recovery reload —
|
|
23
|
+
* waiting on that guest's `dom-ready` when it is not attached yet, since a ref callback fires at
|
|
24
|
+
* attach and every `<webview>` method throws until then ({@link applyStoredZoom}). The window's own
|
|
25
|
+
* top-level zoom is deliberately NOT persisted — it is shell chrome, not site content, and always
|
|
26
|
+
* starting a fresh session at 100% is the same convention Chrome itself follows for its own UI zoom.
|
|
27
|
+
*/
|
|
28
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
29
|
+
/** The window's own `localStorage`, resolved at each call rather than once at render. Reading the
|
|
30
|
+
* `window.localStorage` getter can itself throw (storage denied, a sandboxed origin), so it must
|
|
31
|
+
* never run during a render — a throw there would blank the whole window even when no guest or
|
|
32
|
+
* zoom command is in play. Resolved here instead, inside {@link readStoredZoom} /
|
|
33
|
+
* {@link writeStoredZoom}'s own `try`, a denied store degrades to session-only zoom. A module-level
|
|
34
|
+
* constant, so its identity is stable across renders and never re-runs the hook's effects. */
|
|
35
|
+
export const windowZoomStorage = {
|
|
36
|
+
getItem: (key) => window.localStorage.getItem(key),
|
|
37
|
+
setItem: (key, value) => window.localStorage.setItem(key, value),
|
|
38
|
+
};
|
|
39
|
+
/** Electron's own zoom-level step (`webContents.zoomIn`/`zoomOut`'s default), kept identical so a
|
|
40
|
+
* host's custom Zoom menu feels like the built-in one it replaces. Each step is roughly a 20%
|
|
41
|
+
* factor change; see Electron's own `WebContents.zoomLevel` doc. */
|
|
42
|
+
const ZOOM_STEP = 0.5;
|
|
43
|
+
/** `localStorage` key for one guest's remembered zoom level, under the host's own prefix. */
|
|
44
|
+
function zoomStorageKey({ projectId, keyPrefix }, _options = {}) {
|
|
45
|
+
return `${keyPrefix}${projectId}`;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Decides {@link ZoomTarget}: the visible tab's guest when one is on screen and its element has
|
|
49
|
+
* actually mounted, otherwise the window's own top-level page — as long as a bridge exists to reach
|
|
50
|
+
* it (never true outside a real desktop window). `'none'` only when neither is available.
|
|
51
|
+
*
|
|
52
|
+
* @complexity O(1) — one `Map.get`.
|
|
53
|
+
*/
|
|
54
|
+
export function resolveZoomTarget(input, _options = {}) {
|
|
55
|
+
if (input.activeGuestId !== null) {
|
|
56
|
+
const element = input.guests.get(input.activeGuestId);
|
|
57
|
+
if (element)
|
|
58
|
+
return { kind: 'guest', element, projectId: input.activeGuestId };
|
|
59
|
+
}
|
|
60
|
+
return input.bridge ? { kind: 'top' } : { kind: 'none' };
|
|
61
|
+
}
|
|
62
|
+
/** One command's new zoom level. `'reset'` returns to 0 (100%) outright; `'in'`/`'out'` step by
|
|
63
|
+
* {@link ZOOM_STEP} from `current`. Chromium itself clamps the result to its own zoom range, so
|
|
64
|
+
* this does not — a cap here could only ever be looser or stricter than the real one underneath. */
|
|
65
|
+
export function nextZoomLevel({ current, direction }, _options = {}) {
|
|
66
|
+
if (direction === 'reset')
|
|
67
|
+
return 0;
|
|
68
|
+
return direction === 'in' ? current + ZOOM_STEP : current - ZOOM_STEP;
|
|
69
|
+
}
|
|
70
|
+
/** Reads a persisted per-guest zoom level, defaulting to 0 (100%) for an unset, corrupt, or
|
|
71
|
+
* unreadable entry — never throws, since a lost preference is a cosmetic regression and a thrown
|
|
72
|
+
* read must not be.
|
|
73
|
+
* @complexity O(1). */
|
|
74
|
+
export function readStoredZoom({ storage, projectId, keyPrefix }, _options = {}) {
|
|
75
|
+
try {
|
|
76
|
+
const raw = storage.getItem(zoomStorageKey({ projectId, keyPrefix }));
|
|
77
|
+
const parsed = raw === null ? NaN : Number(raw);
|
|
78
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** Persists one guest's zoom level. Best-effort: a full or disabled store must not break zooming
|
|
85
|
+
* for the rest of the session, only the memory of it.
|
|
86
|
+
* @complexity O(1). */
|
|
87
|
+
export function writeStoredZoom({ storage, projectId, keyPrefix, level }, _options = {}) {
|
|
88
|
+
try {
|
|
89
|
+
storage.setItem(zoomStorageKey({ projectId, keyPrefix }), String(level));
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// Storage full, disabled, or a private window with no persistence — zoom still applies this
|
|
93
|
+
// session; there is nothing more useful to do with the failure.
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** Sets a guest's zoom level, reporting whether it landed rather than throwing when it did not.
|
|
97
|
+
* Electron's `<webview>` throws from EVERY method until the guest is attached to the DOM and has
|
|
98
|
+
* emitted `dom-ready` — the same tolerance the host's other guest calls are wrapped in. */
|
|
99
|
+
function setGuestZoom({ element, level }, _options = {}) {
|
|
100
|
+
try {
|
|
101
|
+
element.setZoomLevel(level);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** A guest's current zoom level, or `null` when it cannot answer yet — same not-attached-yet gate
|
|
109
|
+
* as {@link setGuestZoom}. */
|
|
110
|
+
function readGuestZoom({ element }, _options = {}) {
|
|
111
|
+
try {
|
|
112
|
+
return element.getZoomLevel();
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Applies a guest's remembered zoom to a guest that has just (re)registered, deferring to the
|
|
120
|
+
* guest's `dom-ready` when it is not attached yet.
|
|
121
|
+
*
|
|
122
|
+
* **This runs inside a React ref callback, so it must not throw.** A `<webview>` is attached to the
|
|
123
|
+
* DOM before it is usable, and the ref fires at attach — every method on it throws until
|
|
124
|
+
* `dom-ready`, and a throw escaping a ref callback unmounts the tree, blanking the whole window the
|
|
125
|
+
* moment a tab mounts. Swallowing alone would not do, either: the ref is the ONLY moment a
|
|
126
|
+
* registration happens, so a swallowed first attempt would quietly retire per-guest zoom memory
|
|
127
|
+
* altogether. Hence the one-shot `dom-ready` wait — the level is deferred, not lost.
|
|
128
|
+
*
|
|
129
|
+
* @complexity O(1). At most one listener per registration, removed the first time it fires.
|
|
130
|
+
*/
|
|
131
|
+
export function applyStoredZoom({ element, projectId, storage, keyPrefix }, _options = {}) {
|
|
132
|
+
const level = readStoredZoom({ storage, projectId, keyPrefix });
|
|
133
|
+
if (setGuestZoom({ element, level }))
|
|
134
|
+
return;
|
|
135
|
+
const onReady = () => {
|
|
136
|
+
element.removeEventListener('dom-ready', onReady);
|
|
137
|
+
setGuestZoom({ element, level });
|
|
138
|
+
};
|
|
139
|
+
element.addEventListener('dom-ready', onReady);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Runs one zoom command against `target`, persisting the result when the target is a guest.
|
|
143
|
+
*
|
|
144
|
+
* @complexity O(1).
|
|
145
|
+
*/
|
|
146
|
+
export function applyZoomCommand({ target, bridge, direction, storage, keyPrefix }, _options = {}) {
|
|
147
|
+
if (target.kind === 'guest') {
|
|
148
|
+
// A command that arrives before the guest is attached does nothing — see {@link setGuestZoom}.
|
|
149
|
+
// Nothing is persisted in that case either: a remembered level the guest never took would be
|
|
150
|
+
// re-applied on its next registration and silently shift the site under the owner.
|
|
151
|
+
const current = readGuestZoom({ element: target.element });
|
|
152
|
+
if (current === null)
|
|
153
|
+
return;
|
|
154
|
+
const level = nextZoomLevel({ current, direction });
|
|
155
|
+
if (setGuestZoom({ element: target.element, level }))
|
|
156
|
+
writeStoredZoom({ storage, projectId: target.projectId, keyPrefix, level });
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (target.kind === 'top' && bridge) {
|
|
160
|
+
bridge.setZoomLevel({ level: nextZoomLevel({ current: bridge.getZoomLevel(), direction }) });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The Zoom feature's whole runtime behaviour: subscribing to the app menu's command and routing it
|
|
165
|
+
* to whichever surface is on screen, plus re-applying a guest's remembered zoom whenever it
|
|
166
|
+
* (re)mounts.
|
|
167
|
+
*
|
|
168
|
+
* @param input.activeGuestId the visible tab's id, or `null` when the window's own screen is on
|
|
169
|
+
* display (the same argument the host gives its Find-in-page hook).
|
|
170
|
+
* @param input.bridge the preload bridge port, or `undefined` outside a desktop window.
|
|
171
|
+
* @param input.keyPrefix the host's `localStorage` key prefix for per-guest levels.
|
|
172
|
+
* @param options.storage where per-guest zoom levels persist; defaults to {@link windowZoomStorage}.
|
|
173
|
+
* @complexity O(1) per command, beyond `applyZoomCommand`'s own cost.
|
|
174
|
+
*/
|
|
175
|
+
export function useZoom({ activeGuestId, bridge, keyPrefix }, { storage = windowZoomStorage } = {}) {
|
|
176
|
+
// A ref, not state, for the same reason Find's own guests map is: registering a guest must never
|
|
177
|
+
// itself trigger a render, and the map's contents are only ever read at the moment a command
|
|
178
|
+
// actually runs.
|
|
179
|
+
const guests = useRef(new Map()).current;
|
|
180
|
+
const registerGuest = useCallback((projectId, element) => {
|
|
181
|
+
if (element) {
|
|
182
|
+
guests.set(projectId, element);
|
|
183
|
+
applyStoredZoom({ element, projectId, storage, keyPrefix });
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
guests.delete(projectId);
|
|
187
|
+
}
|
|
188
|
+
}, [guests, storage, keyPrefix]);
|
|
189
|
+
// The app menu's Zoom In / Zoom Out / Actual Size: resolve the live target at the moment the
|
|
190
|
+
// command fires (not when this effect was set up), so a tab switch since the last render is
|
|
191
|
+
// still honored.
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
if (!bridge)
|
|
194
|
+
return undefined;
|
|
195
|
+
return bridge.onZoomCommand({ listener: (direction) => {
|
|
196
|
+
const target = resolveZoomTarget({ activeGuestId, guests, bridge });
|
|
197
|
+
applyZoomCommand({ target, bridge, direction, storage, keyPrefix });
|
|
198
|
+
} });
|
|
199
|
+
// `guests` is a ref (stable identity, never itself a trigger); `activeGuestId` is what actually
|
|
200
|
+
// changes which entry a fired command should resolve to.
|
|
201
|
+
}, [bridge, activeGuestId, guests, storage, keyPrefix]);
|
|
202
|
+
return { registerGuest };
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=use-zoom.js.map
|