@jini-ai/ui 0.3.14 → 0.4.0
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/CHANGELOG.md +139 -0
- package/README.md +120 -26
- package/dist/browser/index.js +1 -1
- package/dist/browser/useDismissOnOutsideOrEscape.d.ts +10 -1
- package/dist/browser/useDismissOnOutsideOrEscape.js +7 -4
- package/dist/browser/useGlobalKeydown.d.ts +14 -2
- package/dist/browser/useGlobalKeydown.js +8 -17
- package/dist/features/a2ui/catalog-from-registry.d.ts +6 -3
- package/dist/features/a2ui/catalog-from-registry.js +1 -1
- package/dist/features/a2ui/index.d.ts +1 -1
- package/dist/features/a2ui/protocol.d.ts +1 -1
- package/dist/features/a2ui/renderer.js +23 -10
- package/dist/features/a2ui/use-a2ui-surface.d.ts +11 -6
- package/dist/features/a2ui/use-a2ui-surface.js +40 -10
- package/dist/features/admin-widgets/components/ComingSoonNotice.d.ts +11 -0
- package/dist/features/admin-widgets/components/ComingSoonNotice.js +7 -0
- package/dist/features/admin-widgets/components/ComingSoonPanel.d.ts +10 -0
- package/dist/features/admin-widgets/components/ComingSoonPanel.js +10 -0
- package/dist/features/admin-widgets/components/ImagePreviewModal.d.ts +16 -0
- package/dist/features/admin-widgets/components/ImagePreviewModal.hooks.d.ts +13 -0
- package/dist/features/admin-widgets/components/ImagePreviewModal.hooks.js +46 -0
- package/dist/features/admin-widgets/components/ImagePreviewModal.js +13 -0
- package/dist/features/admin-widgets/components/InfoTip.d.ts +18 -0
- package/dist/features/admin-widgets/components/InfoTip.hooks.d.ts +16 -0
- package/dist/features/admin-widgets/components/InfoTip.hooks.js +45 -0
- package/dist/features/admin-widgets/components/InfoTip.js +12 -0
- package/dist/features/admin-widgets/components/SeeMore/SeeMore.d.ts +41 -0
- package/dist/features/admin-widgets/components/SeeMore/SeeMore.hooks.d.ts +14 -0
- package/dist/features/admin-widgets/components/SeeMore/SeeMore.hooks.js +57 -0
- package/dist/features/admin-widgets/components/SeeMore/SeeMore.js +24 -0
- package/dist/features/admin-widgets/components/Select/Select.d.ts +39 -0
- package/dist/features/admin-widgets/components/Select/Select.hooks.d.ts +105 -0
- package/dist/features/admin-widgets/components/Select/Select.hooks.js +359 -0
- package/dist/features/admin-widgets/components/Select/Select.js +46 -0
- package/dist/features/admin-widgets/index.d.ts +20 -0
- package/dist/features/admin-widgets/index.js +11 -0
- package/dist/features/admin-widgets/styles/admin-widgets.css +2 -0
- package/dist/features/appearance/constants.d.ts +2 -2
- package/dist/features/appearance/constants.js +2 -1
- package/dist/features/appearance/react/components/AppearanceTab.js +5 -5
- package/dist/features/appearance/rules.d.ts +10 -4
- package/dist/features/appearance/rules.js +5 -5
- package/dist/features/appearance/types.d.ts +1 -1
- package/dist/features/appearance/types.js +1 -1
- package/dist/features/asset-grid/react/components/AssetGrid.js +1 -1
- package/dist/features/asset-grid/react/components/DeleteConfirmDialog.js +1 -1
- package/dist/features/asset-grid/react/hooks/useAssetGridKeyboardShortcuts.js +23 -21
- package/dist/features/asset-grid/react/hooks/useAssetGridLiveUpdates.d.ts +1 -1
- package/dist/features/asset-grid/react/hooks/useAssetGridLiveUpdates.js +1 -1
- package/dist/features/asset-tree-browser/ports.d.ts +3 -1
- package/dist/features/asset-tree-browser/react/hooks/useAssetTreeCopyLocalPath.js +1 -1
- package/dist/features/browser-chrome/react/components/BrowserViewportControls.js +1 -1
- package/dist/features/browser-chrome/types.js +1 -1
- package/dist/features/command-palette/ports.js +1 -1
- package/dist/features/connectors/ConnectorsBrowser.js +2 -2
- package/dist/features/connectors/components/ConnectorCard.js +3 -3
- package/dist/features/connectors/components/ConnectorDetailDrawer.js +1 -1
- package/dist/features/connectors/components/ConnectorGrid.js +2 -2
- package/dist/features/connectors/components/ConnectorSearchBar.js +2 -2
- package/dist/features/connectors/components/ProviderTabBar.js +2 -2
- package/dist/features/connectors/constants.d.ts +1 -1
- package/dist/features/connectors/constants.js +1 -1
- package/dist/features/connectors/hooks/useConnectorAuthorization.js +1 -1
- package/dist/features/connectors/rules.d.ts +2 -2
- package/dist/features/connectors/rules.js +1 -1
- package/dist/features/connectors/types.d.ts +2 -2
- package/dist/features/connectors/types.js +1 -1
- package/dist/features/execution/react/components/ByokProviderForm.js +3 -3
- package/dist/features/execution/react/components/ExecutionTab.js +2 -2
- package/dist/features/execution/react/components/LocalCliAgentCard.js +3 -3
- package/dist/features/execution/react/components/LocalCliAgentList.js +2 -2
- package/dist/features/execution/react/components/ProviderChipGroup.js +2 -2
- package/dist/features/execution/react/components/SearchableModelSelect.js +1 -1
- package/dist/features/execution/rules.js +1 -1
- package/dist/features/file-dropzone/react/components/FileDropzone.js +5 -3
- package/dist/features/file-dropzone/react/hooks/useFileDropzone.d.ts +1 -1
- package/dist/features/file-dropzone/react/hooks/useFileDropzone.js +1 -1
- package/dist/features/file-dropzone/types.d.ts +1 -1
- package/dist/features/file-dropzone/types.js +1 -1
- package/dist/features/folder-path-drop/react/hooks/useFolderPathDropCapture.js +6 -4
- package/dist/features/html-editor/canvas-content-wrapper.js +1 -1
- package/dist/features/html-editor/canvas-embed-placeholders.js +7 -7
- package/dist/features/html-editor/canvas-style.d.ts +4 -0
- package/dist/features/html-editor/canvas-style.js +6 -21
- package/dist/features/html-viewer/constants.d.ts +1 -1
- package/dist/features/html-viewer/constants.js +1 -1
- package/dist/features/html-viewer/react/components/PresentMenu.js +1 -1
- package/dist/features/html-viewer/react/components/ZoomMenu.js +1 -1
- package/dist/features/html-viewer/types.d.ts +1 -1
- package/dist/features/html-viewer/types.js +1 -1
- package/dist/features/i18n/dictionaries/index.d.ts +2 -3
- package/dist/features/i18n/dictionaries/settings-dialog.en.d.ts +1 -1
- package/dist/features/i18n/dictionary-translator.d.ts +16 -0
- package/dist/features/i18n/dictionary-translator.js +14 -0
- package/dist/features/i18n/index.d.ts +3 -0
- package/dist/features/i18n/index.js +2 -0
- package/dist/features/i18n/locale.d.ts +1 -1
- package/dist/features/i18n/template-i18n.d.ts +26 -0
- package/dist/features/i18n/template-i18n.js +36 -0
- package/dist/features/iframe-pool/react/components/IframeKeepAliveProvider.d.ts +1 -1
- package/dist/features/iframe-pool/react/components/IframeKeepAliveProvider.js +1 -1
- package/dist/features/instructions/react/components/InstructionsTab.js +1 -1
- package/dist/features/integrations/react/components/ClientPicker.js +4 -4
- package/dist/features/integrations/react/components/CodexInstallToggleButton.js +1 -1
- package/dist/features/integrations/react/components/IntegrationsTab.js +2 -2
- package/dist/features/integrations/react/components/SnippetBlock.js +1 -1
- package/dist/features/integrations/types.d.ts +1 -1
- package/dist/features/integrations/types.js +1 -1
- package/dist/features/interactive-ui/index.js +13 -13
- package/dist/features/interactive-ui/interactive-ui.css +1 -1
- package/dist/features/interactive-ui/providers/recharts/bar-chart.js +1 -1
- package/dist/features/interactive-ui/providers/recharts/line-chart.js +1 -1
- package/dist/features/interactive-ui/providers/recharts/pie-chart.js +2 -2
- package/dist/features/interactive-ui/providers/shadcn/lib/utils.d.ts +1 -1
- package/dist/features/interactive-ui/providers/shadcn/lib/utils.js +1 -1
- package/dist/features/interactive-ui/registry.d.ts +15 -4
- package/dist/features/interactive-ui/registry.js +5 -5
- package/dist/features/language/react/components/LanguageTab.js +2 -2
- package/dist/features/list-detail-panel/types.d.ts +1 -1
- package/dist/features/list-detail-panel/types.js +1 -1
- package/dist/features/mcp-ui/confirmation-store.js +2 -1
- package/dist/features/mcp-ui/surfaces/tokens.d.ts +17 -20
- package/dist/features/mcp-ui/surfaces/tokens.js +33 -35
- package/dist/features/media-providers/index.d.ts +1 -1
- package/dist/features/media-providers/index.js +1 -1
- package/dist/features/media-providers/react/components/MediaProvidersTab.js +4 -4
- package/dist/features/media-providers/rules.js +1 -1
- package/dist/features/memory/async-commit-guard.d.ts +1 -1
- package/dist/features/memory/constants.d.ts +1 -1
- package/dist/features/memory/constants.js +1 -1
- package/dist/features/memory/dependencies.d.ts +11 -23
- package/dist/features/memory/dependencies.js +116 -106
- package/dist/features/memory/index.d.ts +1 -1
- package/dist/features/memory/index.js +1 -1
- package/dist/features/memory/react/components/MemoryAdvancedModal.js +2 -2
- package/dist/features/memory/react/components/MemoryEntryCard.js +1 -1
- package/dist/features/memory/react/components/MemoryExtractionCard.js +1 -1
- package/dist/features/memory/react/components/MemoryHooksPanel.js +1 -1
- package/dist/features/memory/react/components/MemoryList.js +5 -5
- package/dist/features/memory/react/components/MemoryManualEditor.js +5 -5
- package/dist/features/memory/react/components/MemorySettingsPanel.js +1 -1
- package/dist/features/memory/react/hooks/useMemoryEntries.hooks.js +1 -1
- package/dist/features/memory/react/hooks/useMemoryNavigation.hooks.js +1 -1
- package/dist/features/memory/react/styles.js +1 -1
- package/dist/features/memory/rules.js +1 -1
- package/dist/features/memory/types.d.ts +1 -1
- package/dist/features/mention-autocomplete/react/hooks/useMentionAutocomplete.js +1 -1
- package/dist/features/notifications/react/components/NotificationsTab.js +7 -7
- package/dist/features/notifications/types.d.ts +1 -1
- package/dist/features/observability/boot-timing.js +2 -2
- package/dist/features/observability/stuck-run.js +1 -1
- package/dist/features/observability/white-screen.js +4 -4
- package/dist/features/panel-kit/fetch-query/adapter.react.d.ts +35 -0
- package/dist/features/panel-kit/fetch-query/adapter.react.js +122 -0
- package/dist/features/panel-kit/fetch-query/cache.d.ts +123 -0
- package/dist/features/panel-kit/fetch-query/cache.js +231 -0
- package/dist/features/panel-kit/fetch-query/environment.browser.d.ts +4 -0
- package/dist/features/panel-kit/fetch-query/environment.browser.js +25 -0
- package/dist/features/panel-kit/fetch-query/index.d.ts +4 -0
- package/dist/features/panel-kit/fetch-query/index.js +2 -0
- package/dist/features/panel-kit/fetch-query/types.d.ts +91 -0
- package/dist/features/panel-kit/fetch-query/types.js +2 -0
- package/dist/features/panel-kit/helpers/format-timestamp.d.ts +18 -0
- package/dist/features/panel-kit/helpers/format-timestamp.js +20 -0
- package/dist/features/panel-kit/helpers/permissions.d.ts +11 -0
- package/dist/features/panel-kit/helpers/permissions.js +10 -0
- package/dist/features/panel-kit/helpers/resolve-active-tab-id.d.ts +13 -0
- package/dist/features/panel-kit/helpers/resolve-active-tab-id.js +13 -0
- package/dist/features/panel-kit/helpers/retry-unreachable.d.ts +20 -0
- package/dist/features/panel-kit/helpers/retry-unreachable.js +39 -0
- package/dist/features/panel-kit/hooks/use-async-action.hooks.d.ts +13 -0
- package/dist/features/panel-kit/hooks/use-async-action.hooks.js +27 -0
- package/dist/features/panel-kit/hooks/use-dirty-guard.hooks.d.ts +18 -0
- package/dist/features/panel-kit/hooks/use-dirty-guard.hooks.js +33 -0
- package/dist/features/panel-kit/hooks/use-focus-trap.hooks.d.ts +8 -0
- package/dist/features/panel-kit/hooks/use-focus-trap.hooks.js +66 -0
- package/dist/features/panel-kit/hooks/use-serial-writes.hooks.d.ts +26 -0
- package/dist/features/panel-kit/hooks/use-serial-writes.hooks.js +41 -0
- package/dist/features/panel-kit/hooks/use-settlement-generation.hooks.d.ts +9 -0
- package/dist/features/panel-kit/hooks/use-settlement-generation.hooks.js +25 -0
- package/dist/features/panel-kit/index.d.ts +19 -0
- package/dist/features/panel-kit/index.js +13 -0
- package/dist/features/privacy/react/components/PrivacyTab.js +2 -2
- package/dist/features/privacy/types.d.ts +1 -1
- package/dist/features/privacy/types.js +1 -1
- package/dist/features/progress-card/reference-adapters.d.ts +1 -1
- package/dist/features/progress-card/rules.d.ts +1 -1
- package/dist/features/progress-card/rules.js +1 -1
- package/dist/features/progress-card/types.d.ts +1 -1
- package/dist/features/progress-card/types.js +1 -1
- package/dist/features/resource-dashboard/dependencies.d.ts +1 -1
- package/dist/features/resource-dashboard/ports.d.ts +1 -1
- package/dist/features/resource-dashboard/react/hooks/useResourceBoard.d.ts +1 -1
- package/dist/features/resource-dashboard/react/hooks/useResourceBoard.js +1 -1
- package/dist/features/resource-dashboard/rules.d.ts +1 -1
- package/dist/features/resource-dashboard/rules.js +2 -2
- package/dist/features/resource-dashboard/types.d.ts +4 -4
- package/dist/features/resource-dashboard/types.js +1 -1
- package/dist/features/schedule-picker/react/hooks/useRecurringSchedulePicker.js +1 -1
- package/dist/features/settings/dialog/styles/settings-dialog.css +62 -60
- package/dist/features/sketch-editor/constants.d.ts +1 -1
- package/dist/features/sketch-editor/constants.js +1 -1
- package/dist/features/sketch-editor/dom.d.ts +1 -1
- package/dist/features/sketch-editor/dom.js +1 -1
- package/dist/features/sketch-editor/react/hooks/useSketchDomEnhancements.d.ts +1 -1
- package/dist/features/sketch-editor/react/hooks/useSketchDomEnhancements.js +11 -9
- package/dist/features/sketch-editor/types.d.ts +1 -1
- package/dist/features/sketch-editor/types.js +1 -1
- package/dist/features/skills/react/components/SkillDraftForm.js +1 -1
- package/dist/features/skills/react/components/SkillRow.js +1 -1
- package/dist/features/skills/react/components/SkillsTab.js +2 -2
- package/dist/features/source-config-list/agent-handles.js +2 -2
- package/dist/features/source-config-list/react/hooks/useSourceConfigAddForm.d.ts +1 -1
- package/dist/features/source-config-list/react/hooks/useSourceConfigAddForm.js +1 -1
- package/dist/features/source-config-list/rules.d.ts +1 -1
- package/dist/features/source-config-list/rules.js +3 -3
- package/dist/features/source-config-list/types.d.ts +1 -1
- package/dist/features/source-config-list/types.js +1 -1
- package/dist/features/tab-launcher-menu/react/hooks/useTabLauncherMenu.js +1 -1
- package/dist/features/tab-strip/index.d.ts +4 -0
- package/dist/features/tab-strip/index.js +2 -0
- package/dist/features/tab-strip/react/components/TabBar.d.ts +23 -0
- package/dist/features/tab-strip/react/components/TabBar.hooks.d.ts +25 -0
- package/dist/features/tab-strip/react/components/TabBar.hooks.js +57 -0
- package/dist/features/tab-strip/react/components/TabBar.js +18 -0
- package/dist/features/tab-strip/react/components/TabStrip.js +2 -1
- package/dist/features/tab-strip/react/components/TabStripFrame.d.ts +3 -0
- package/dist/features/tab-strip/react/components/TabStripFrame.js +7 -0
- package/dist/features/tabbed-dialog/react/hooks/useTabbedDialog.js +1 -1
- package/dist/features/tabbed-dialog/styles/tabbed-dialog.css +8 -141
- package/dist/features/tabbed-dialog/types.d.ts +1 -1
- package/dist/features/tabbed-dialog/types.js +1 -1
- package/dist/features/version-manager/ports.d.ts +1 -1
- package/dist/features/version-manager/react/components/VersionPromptPopover.js +5 -3
- package/dist/features/version-manager/react/components/VersionRestoreControl.js +1 -1
- package/dist/features/version-manager/types.d.ts +1 -1
- package/dist/features/version-manager/types.js +1 -1
- package/dist/features/viewer-shell/dependencies.js +1 -1
- package/dist/features/viewer-shell/ports.d.ts +1 -1
- package/dist/features/viewer-shell/react/components/ViewportSwitcher.js +1 -1
- package/dist/features/viewer-shell/react/hooks/useMarkdownScrollSync.d.ts +1 -1
- package/dist/features/viewer-shell/react/hooks/useMarkdownScrollSync.js +1 -1
- package/dist/features/viewer-shell/types.d.ts +1 -1
- package/dist/features/viewer-shell/types.js +1 -1
- package/dist/index.d.ts +420 -0
- package/dist/index.js +421 -1
- package/dist/react/components/ComponentKitPreview.js +1 -1
- package/dist/react/components/EditorIcon.d.ts +1 -1
- package/dist/react/components/EditorIcon.js +22 -22
- package/dist/react/components/ExportDiagnosticsButton.d.ts +8 -1
- package/dist/react/components/ExportDiagnosticsButton.js +6 -6
- package/dist/react/components/PaletteTweaks.js +5 -5
- package/dist/react/hooks/useBrandFonts.d.ts +19 -4
- package/dist/react/hooks/useBrandFonts.js +11 -7
- package/dist/react/hooks/useDebouncedValue.d.ts +12 -1
- package/dist/react/hooks/useDebouncedValue.js +9 -4
- package/dist/react/hooks/useStableHandler.d.ts +3 -1
- package/dist/react/hooks/useStableHandler.js +1 -1
- package/dist/renderers/annotation-canvas/drawing.d.ts +4 -4
- package/dist/renderers/annotation-canvas/drawing.js +28 -15
- package/dist/renderers/annotation-canvas/react/components/AnnotationCanvas.js +2 -2
- package/dist/renderers/annotation-canvas/react/hooks/useAnnotationCanvas.js +4 -3
- package/dist/renderers/annotation-canvas/rules.d.ts +1 -1
- package/dist/renderers/annotation-canvas/theme.d.ts +13 -0
- package/dist/renderers/annotation-canvas/theme.js +16 -0
- package/dist/renderers/annotation-canvas/types.d.ts +1 -1
- package/dist/renderers/index.d.ts +1 -1
- package/dist/renderers/new-tab-preview.d.ts +3 -0
- package/dist/renderers/new-tab-preview.js +3 -1
- package/dist/renderers/preview-modal-shell/react/hooks/usePreviewModalShell.d.ts +1 -1
- package/dist/renderers/preview-modal-shell/react/hooks/usePreviewModalShell.js +1 -1
- package/dist/renderers/preview-modal-shell/rules.d.ts +1 -1
- package/dist/renderers/preview-modal-shell/types.d.ts +3 -3
- package/dist/renderers/preview-modal-shell/types.js +2 -2
- package/dist/renderers/react/components/ArtifactView.d.ts +1 -1
- package/dist/renderers/react/components/ArtifactView.js +1 -1
- package/dist/renderers/registry.d.ts +12 -6
- package/dist/renderers/registry.js +7 -9
- package/dist/renderers/renderers/html.js +2 -2
- package/dist/renderers/renderers/index.js +1 -1
- package/dist/renderers/renderers/markdown.js +2 -2
- package/dist/renderers/renderers/react-component.js +1 -1
- package/dist/renderers/renderers/svg.js +1 -1
- package/dist/renderers/shiki.js +1 -1
- package/dist/renderers/srcdoc/build.d.ts +1 -1
- package/dist/renderers/srcdoc/build.js +1 -1
- package/dist/renderers/url-load-decision.d.ts +1 -1
- package/dist/renderers/url-load-decision.js +1 -1
- package/dist/styles/admin.css +273 -0
- package/dist/styles/variables.css +117 -0
- package/dist/theme/apply.d.ts +9 -0
- package/dist/theme/apply.js +77 -0
- package/dist/theme/color-scheme.d.ts +8 -0
- package/dist/theme/color-scheme.js +9 -0
- package/dist/theme/default.d.ts +4 -0
- package/dist/theme/default.js +11 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/index.js +5 -0
- package/dist/theme/stylesheet.d.ts +8 -0
- package/dist/theme/stylesheet.js +14 -0
- package/dist/theme/types.d.ts +39 -0
- package/dist/theme/types.js +2 -0
- package/dist/theme/validation.d.ts +15 -0
- package/dist/theme/validation.js +55 -0
- package/dist/utils/appearance.js +1 -1
- package/dist/utils/browser-request.d.ts +12 -0
- package/dist/utils/browser-request.js +10 -0
- package/dist/utils/color-math.d.ts +20 -6
- package/dist/utils/color-math.js +12 -12
- package/dist/utils/copy-to-clipboard.d.ts +19 -8
- package/dist/utils/copy-to-clipboard.js +15 -11
- package/dist/utils/dom-subscriptions.js +1 -1
- package/dist/utils/endpoint-policy.d.ts +9 -3
- package/dist/utils/endpoint-policy.js +5 -5
- package/dist/utils/markdown-scroll-sync.js +3 -3
- package/dist/utils/notifications.d.ts +1 -1
- package/dist/utils/notifications.js +1 -1
- package/dist/utils/polygon-selection.d.ts +1 -1
- package/dist/utils/polygon-selection.js +1 -1
- package/dist/utils/scroll-tabs-with-wheel.d.ts +4 -1
- package/dist/utils/scroll-tabs-with-wheel.js +1 -1
- package/dist/utils/smooth-scroll-to-top.js +1 -1
- package/dist/utils/sse.d.ts +3 -1
- package/dist/utils/sse.js +1 -1
- package/package.json +105 -16
- package/dist/features/lexical-rich-text-editor/react/test-support/lexical-harness.d.ts +0 -11
- package/dist/features/lexical-rich-text-editor/react/test-support/lexical-harness.js +0 -35
|
@@ -11,11 +11,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
12
12
|
import { Icon } from './Icon.js';
|
|
13
13
|
export const PALETTE_TWEAKS_SWATCHES = [
|
|
14
|
-
{ id: 'coral', label: 'Coral - default', stripe: ['
|
|
15
|
-
{ id: 'electric', label: 'Electric', stripe: ['
|
|
16
|
-
{ id: 'acid-forest', label: 'Acid forest', stripe: ['
|
|
17
|
-
{ id: 'risograph', label: 'Risograph', stripe: ['
|
|
18
|
-
{ id: 'mono-noir', label: 'Mono noir', stripe: ['
|
|
14
|
+
{ id: 'coral', label: 'Coral - default', stripe: ['var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
|
|
15
|
+
{ id: 'electric', label: 'Electric', stripe: ['var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
|
|
16
|
+
{ id: 'acid-forest', label: 'Acid forest', stripe: ['var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
|
|
17
|
+
{ id: 'risograph', label: 'Risograph', stripe: ['var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
|
|
18
|
+
{ id: 'mono-noir', label: 'Mono noir', stripe: ['var(--jini-text)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
|
|
19
19
|
];
|
|
20
20
|
// --- Pure derivations (module-level, directly unit-testable) --------------
|
|
21
21
|
/**
|
|
@@ -9,14 +9,29 @@ export interface BrandFontManifest {
|
|
|
9
9
|
files?: BrandFontManifestFile[];
|
|
10
10
|
}
|
|
11
11
|
export interface UseBrandFontsOptions {
|
|
12
|
+
projectId?: string;
|
|
12
13
|
/**
|
|
13
14
|
* Builds the URL for a project asset path (e.g. `fonts/manifest.json`).
|
|
14
15
|
* Omit to skip the self-hosted-font-manifest stage entirely — this hook
|
|
15
16
|
* never hardcodes a font-service URL of its own.
|
|
16
17
|
*/
|
|
17
|
-
resolveProjectAssetUrl?: (
|
|
18
|
+
resolveProjectAssetUrl?: (requiredArgs: {
|
|
19
|
+
projectId: string;
|
|
20
|
+
path: string;
|
|
21
|
+
}) => string;
|
|
22
|
+
manifest?: BrandFontManifestPort;
|
|
23
|
+
/** Native fetch port used by the default manifest loader. */
|
|
24
|
+
fetch?: typeof globalThis.fetch;
|
|
25
|
+
document?: Document;
|
|
18
26
|
}
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
export interface BrandFontManifestPort {
|
|
28
|
+
load(requiredArgs: {
|
|
29
|
+
url: string;
|
|
30
|
+
}): Promise<Pick<Response, 'ok' | 'json'>>;
|
|
31
|
+
}
|
|
32
|
+
export declare function useBrandFonts({ fonts }: {
|
|
33
|
+
fonts: {
|
|
34
|
+
googleFontsUrl?: string;
|
|
35
|
+
}[];
|
|
36
|
+
}, options?: UseBrandFontsOptions): void;
|
|
22
37
|
//# sourceMappingURL=useBrandFonts.d.ts.map
|
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
// down on change. Not tied to any one feature domain — feature-local hooks
|
|
6
6
|
// live inside their own `features/<domain>/react/hooks/` instead.
|
|
7
7
|
import { useEffect, useMemo } from 'react';
|
|
8
|
-
import {
|
|
9
|
-
export function useBrandFonts(
|
|
10
|
-
const { resolveProjectAssetUrl } = options;
|
|
8
|
+
import { requestWithTimeout } from '../../utils/browser-request.js';
|
|
9
|
+
export function useBrandFonts({ fonts }, options = {}) {
|
|
10
|
+
const { projectId, resolveProjectAssetUrl, fetch, manifest: suppliedManifest } = options;
|
|
11
|
+
const manifest = useMemo(() => suppliedManifest ?? {
|
|
12
|
+
load: ({ url }) => requestWithTimeout({ url, timeoutMs: 15_000 }, { ...(fetch === undefined ? {} : { fetch }), init: { cache: 'no-store' } }),
|
|
13
|
+
}, [suppliedManifest, fetch]);
|
|
14
|
+
const document = options.document ?? globalThis.document;
|
|
11
15
|
const googleUrls = useMemo(() => {
|
|
12
16
|
const urls = fonts
|
|
13
17
|
.map((f) => f.googleFontsUrl)
|
|
@@ -26,7 +30,7 @@ export function useBrandFonts(projectId, fonts, options = {}) {
|
|
|
26
30
|
for (const link of links)
|
|
27
31
|
link.remove();
|
|
28
32
|
};
|
|
29
|
-
}, [googleUrls]);
|
|
33
|
+
}, [googleUrls, document]);
|
|
30
34
|
useEffect(() => {
|
|
31
35
|
if (!projectId || !resolveProjectAssetUrl)
|
|
32
36
|
return;
|
|
@@ -34,7 +38,7 @@ export function useBrandFonts(projectId, fonts, options = {}) {
|
|
|
34
38
|
let styleEl = null;
|
|
35
39
|
void (async () => {
|
|
36
40
|
try {
|
|
37
|
-
const resp = await
|
|
41
|
+
const resp = await manifest.load({ url: resolveProjectAssetUrl({ projectId, path: 'fonts/manifest.json' }) });
|
|
38
42
|
if (!resp.ok)
|
|
39
43
|
return;
|
|
40
44
|
const data = (await resp.json());
|
|
@@ -43,7 +47,7 @@ export function useBrandFonts(projectId, fonts, options = {}) {
|
|
|
43
47
|
return;
|
|
44
48
|
const css = files
|
|
45
49
|
.map((f) => {
|
|
46
|
-
const url = resolveProjectAssetUrl(projectId, `fonts/${f.file}`);
|
|
50
|
+
const url = resolveProjectAssetUrl({ projectId, path: `fonts/${f.file}` });
|
|
47
51
|
return [
|
|
48
52
|
'@font-face {',
|
|
49
53
|
` font-family: '${f.family.replace(/'/g, '')}';`,
|
|
@@ -69,6 +73,6 @@ export function useBrandFonts(projectId, fonts, options = {}) {
|
|
|
69
73
|
if (styleEl)
|
|
70
74
|
styleEl.remove();
|
|
71
75
|
};
|
|
72
|
-
}, [projectId, resolveProjectAssetUrl]);
|
|
76
|
+
}, [projectId, resolveProjectAssetUrl, manifest, document]);
|
|
73
77
|
}
|
|
74
78
|
//# sourceMappingURL=useBrandFonts.js.map
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface DebounceSchedulerPort {
|
|
2
|
+
schedule(requiredArgs: {
|
|
3
|
+
callback: () => void;
|
|
4
|
+
delayMs: number;
|
|
5
|
+
}): () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function useDebouncedValue<T>({ value, delayMs }: {
|
|
8
|
+
value: T;
|
|
9
|
+
delayMs: number;
|
|
10
|
+
}, { scheduler }?: {
|
|
11
|
+
scheduler?: DebounceSchedulerPort;
|
|
12
|
+
}): T;
|
|
2
13
|
//# sourceMappingURL=useDebouncedValue.d.ts.map
|
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
// one feature domain — feature-local hooks live inside their own
|
|
4
4
|
// `features/<domain>/react/hooks/` instead.
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
|
-
|
|
6
|
+
const browserScheduler = {
|
|
7
|
+
schedule: ({ callback, delayMs }) => {
|
|
8
|
+
const timer = setTimeout(callback, delayMs);
|
|
9
|
+
return () => clearTimeout(timer);
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export function useDebouncedValue({ value, delayMs }, { scheduler = browserScheduler } = {}) {
|
|
7
13
|
const [debounced, setDebounced] = useState(value);
|
|
8
14
|
useEffect(() => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, [value, delayMs]);
|
|
15
|
+
return scheduler.schedule({ callback: () => setDebounced(value), delayMs });
|
|
16
|
+
}, [value, delayMs, scheduler]);
|
|
12
17
|
return debounced;
|
|
13
18
|
}
|
|
14
19
|
//# sourceMappingURL=useDebouncedValue.js.map
|
|
@@ -6,5 +6,7 @@
|
|
|
6
6
|
* — safe for event handlers, which only fire after commit; do not call the
|
|
7
7
|
* result during render).
|
|
8
8
|
*/
|
|
9
|
-
export declare function useStableHandler<Args extends unknown[], Result>(handler
|
|
9
|
+
export declare function useStableHandler<Args extends unknown[], Result>({ handler }: {
|
|
10
|
+
handler: (...args: Args) => Result;
|
|
11
|
+
}): (...args: Args) => Result;
|
|
10
12
|
//# sourceMappingURL=useStableHandler.d.ts.map
|
|
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useRef } from 'react';
|
|
|
7
7
|
* — safe for event handlers, which only fire after commit; do not call the
|
|
8
8
|
* result during render).
|
|
9
9
|
*/
|
|
10
|
-
export function useStableHandler(handler) {
|
|
10
|
+
export function useStableHandler({ handler }) {
|
|
11
11
|
const ref = useRef(handler);
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
ref.current = handler;
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
* layer.
|
|
6
6
|
*
|
|
7
7
|
* Origin: `apps/web/src/components/PreviewDrawOverlay.tsx`. See
|
|
8
|
-
* `../
|
|
8
|
+
* `../archived provenance ledger`.
|
|
9
9
|
*/
|
|
10
10
|
import type { CaptureTarget, NormalizedRect, Stroke, TextMark } from './types.js';
|
|
11
|
-
export declare const STROKE_COLOR
|
|
11
|
+
export declare const STROKE_COLOR: string;
|
|
12
12
|
export declare const STROKE_WIDTH = 4;
|
|
13
|
-
export declare const TARGET_COLOR
|
|
13
|
+
export declare const TARGET_COLOR: string;
|
|
14
14
|
/** Text-annotation glyph height as a fraction of the frame height, so a dropped label reads at a consistent size across differently-sized frames and its on-screen size matches what gets baked into an exported screenshot. */
|
|
15
15
|
export declare const TEXT_FONT_FRACTION = 0.03;
|
|
16
16
|
export declare const TEXT_LINE_HEIGHT = 1.25;
|
|
17
17
|
export declare const TEXT_MIN_FONT_PX = 12;
|
|
18
|
-
export declare const TEXT_FONT_FAMILY
|
|
18
|
+
export declare const TEXT_FONT_FAMILY: string;
|
|
19
19
|
export declare function textFontSizePx(frameHeight: number): number;
|
|
20
20
|
export declare function drawNormalizedBox(ctx: CanvasRenderingContext2D, box: NormalizedRect, width: number, height: number): void;
|
|
21
21
|
/** Redraws every committed stroke, the in-progress draft stroke, committed selection boxes, and the in-progress box draft. Called on every pointer move (rAF-coalesced by the caller) and on every history mutation. */
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { defaultAdminTheme } from '../../theme/default.js';
|
|
2
|
+
import { resolveAnnotationTheme } from './theme.js';
|
|
3
|
+
export const STROKE_COLOR = defaultAdminTheme.light.danger;
|
|
2
4
|
export const STROKE_WIDTH = 4;
|
|
3
|
-
export const TARGET_COLOR =
|
|
5
|
+
export const TARGET_COLOR = defaultAdminTheme.light.primary;
|
|
4
6
|
/** Text-annotation glyph height as a fraction of the frame height, so a dropped label reads at a consistent size across differently-sized frames and its on-screen size matches what gets baked into an exported screenshot. */
|
|
5
7
|
export const TEXT_FONT_FRACTION = 0.03;
|
|
6
8
|
export const TEXT_LINE_HEIGHT = 1.25;
|
|
7
9
|
export const TEXT_MIN_FONT_PX = 12;
|
|
8
|
-
export const TEXT_FONT_FAMILY =
|
|
10
|
+
export const TEXT_FONT_FAMILY = defaultAdminTheme.fonts.body;
|
|
9
11
|
export function textFontSizePx(frameHeight) {
|
|
10
12
|
return Math.max(TEXT_MIN_FONT_PX, TEXT_FONT_FRACTION * frameHeight);
|
|
11
13
|
}
|
|
12
14
|
export function drawNormalizedBox(ctx, box, width, height) {
|
|
15
|
+
const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
|
|
13
16
|
const left = box.x * width;
|
|
14
17
|
const top = box.y * height;
|
|
15
18
|
const boxWidth = Math.max(1, box.width * width);
|
|
16
19
|
const boxHeight = Math.max(1, box.height * height);
|
|
17
20
|
ctx.save();
|
|
18
|
-
ctx.fillStyle =
|
|
19
|
-
|
|
21
|
+
ctx.fillStyle = theme.stroke;
|
|
22
|
+
const boxAlpha = ctx.globalAlpha;
|
|
23
|
+
ctx.globalAlpha = boxAlpha * 0.10;
|
|
24
|
+
ctx.strokeStyle = theme.stroke;
|
|
20
25
|
ctx.lineWidth = Math.max(2, Math.round(Math.min(width, height) * 0.002));
|
|
21
26
|
ctx.setLineDash([10, 6]);
|
|
22
27
|
ctx.fillRect(left, top, boxWidth, boxHeight);
|
|
28
|
+
ctx.globalAlpha = boxAlpha;
|
|
23
29
|
ctx.strokeRect(left, top, boxWidth, boxHeight);
|
|
24
30
|
ctx.restore();
|
|
25
31
|
}
|
|
26
32
|
/** Redraws every committed stroke, the in-progress draft stroke, committed selection boxes, and the in-progress box draft. Called on every pointer move (rAF-coalesced by the caller) and on every history mutation. */
|
|
27
33
|
export function redrawStrokesAndBoxes(ctx, input, width, height, dpr) {
|
|
34
|
+
const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
|
|
28
35
|
ctx.clearRect(0, 0, width, height);
|
|
29
|
-
ctx.strokeStyle =
|
|
36
|
+
ctx.strokeStyle = theme.stroke;
|
|
30
37
|
ctx.lineWidth = STROKE_WIDTH * dpr;
|
|
31
38
|
ctx.lineCap = 'round';
|
|
32
39
|
ctx.lineJoin = 'round';
|
|
@@ -50,14 +57,15 @@ export function redrawStrokesAndBoxes(ctx, input, width, height, dpr) {
|
|
|
50
57
|
}
|
|
51
58
|
/** Bakes the transparent on-screen text labels into an exported screenshot. Uses the same frame-height-fraction glyph size the DOM textareas use, so what the user typed lands at the same size/position in the captured image. */
|
|
52
59
|
export function drawTextMarks(ctx, marks, width, height) {
|
|
60
|
+
const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
|
|
53
61
|
const fontPx = textFontSizePx(height);
|
|
54
62
|
const lineHeight = fontPx * TEXT_LINE_HEIGHT;
|
|
55
63
|
const topPad = (lineHeight - fontPx) / 2;
|
|
56
64
|
ctx.save();
|
|
57
65
|
ctx.textBaseline = 'top';
|
|
58
|
-
ctx.font = `600 ${fontPx}px ${
|
|
59
|
-
ctx.fillStyle =
|
|
60
|
-
ctx.shadowColor =
|
|
66
|
+
ctx.font = `600 ${fontPx}px ${theme.font}`;
|
|
67
|
+
ctx.fillStyle = theme.stroke;
|
|
68
|
+
ctx.shadowColor = theme.bg;
|
|
61
69
|
ctx.shadowBlur = Math.max(1, fontPx * 0.14);
|
|
62
70
|
for (const mark of marks) {
|
|
63
71
|
if (mark.text.trim().length === 0)
|
|
@@ -79,21 +87,25 @@ export function drawCaptureTarget(ctx, scaleX, scaleY, target) {
|
|
|
79
87
|
return;
|
|
80
88
|
if (width <= 0 || height <= 0)
|
|
81
89
|
return;
|
|
90
|
+
const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
|
|
82
91
|
const left = x * scaleX;
|
|
83
92
|
const top = y * scaleY;
|
|
84
93
|
const boxWidth = Math.max(1, width * scaleX);
|
|
85
94
|
const boxHeight = Math.max(1, height * scaleY);
|
|
86
95
|
ctx.save();
|
|
87
|
-
ctx.fillStyle =
|
|
88
|
-
|
|
96
|
+
ctx.fillStyle = theme.target;
|
|
97
|
+
const targetAlpha = ctx.globalAlpha;
|
|
98
|
+
ctx.globalAlpha = targetAlpha * 0.12;
|
|
99
|
+
ctx.strokeStyle = theme.target;
|
|
89
100
|
ctx.lineWidth = Math.max(2, Math.round(Math.max(scaleX, scaleY) * 2));
|
|
90
101
|
ctx.setLineDash([Math.max(8, 8 * scaleX), Math.max(4, 4 * scaleX)]);
|
|
91
102
|
ctx.fillRect(left, top, boxWidth, boxHeight);
|
|
103
|
+
ctx.globalAlpha = targetAlpha;
|
|
92
104
|
ctx.strokeRect(left, top, boxWidth, boxHeight);
|
|
93
105
|
const label = (target.label || target.elementId || '').trim();
|
|
94
106
|
if (label) {
|
|
95
107
|
const fontSize = Math.max(12, Math.round(12 * Math.max(scaleX, scaleY)));
|
|
96
|
-
ctx.font = `600 ${fontSize}px ${
|
|
108
|
+
ctx.font = `600 ${fontSize}px ${theme.font}`;
|
|
97
109
|
const text = label.length > 42 ? `${label.slice(0, 39)}...` : label;
|
|
98
110
|
const metrics = ctx.measureText(text);
|
|
99
111
|
const padX = Math.max(6, Math.round(6 * scaleX));
|
|
@@ -102,19 +114,20 @@ export function drawCaptureTarget(ctx, scaleX, scaleY, target) {
|
|
|
102
114
|
const labelHeight = fontSize + padY * 2;
|
|
103
115
|
const labelTop = Math.max(0, top - labelHeight - Math.max(4, 4 * scaleY));
|
|
104
116
|
ctx.setLineDash([]);
|
|
105
|
-
ctx.fillStyle =
|
|
117
|
+
ctx.fillStyle = theme.target;
|
|
106
118
|
ctx.fillRect(left, labelTop, labelWidth, labelHeight);
|
|
107
|
-
ctx.fillStyle =
|
|
119
|
+
ctx.fillStyle = theme.ink;
|
|
108
120
|
ctx.fillText(text, left + padX, labelTop + padY + fontSize * 0.82);
|
|
109
121
|
}
|
|
110
122
|
ctx.restore();
|
|
111
123
|
}
|
|
112
124
|
/** Composites the current marks (capture-target highlight, selection boxes, strokes, text labels) onto an already-drawn background image at export resolution. */
|
|
113
125
|
export function compositeMarksOntoCanvas(ctx, input, outputWidth, outputHeight, scaleX, scaleY) {
|
|
126
|
+
const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
|
|
114
127
|
drawCaptureTarget(ctx, scaleX, scaleY, input.target);
|
|
115
128
|
for (const box of input.selectionBoxes)
|
|
116
129
|
drawNormalizedBox(ctx, box, outputWidth, outputHeight);
|
|
117
|
-
ctx.strokeStyle =
|
|
130
|
+
ctx.strokeStyle = theme.stroke;
|
|
118
131
|
ctx.lineWidth = STROKE_WIDTH * Math.max(scaleX, scaleY);
|
|
119
132
|
ctx.lineCap = 'round';
|
|
120
133
|
ctx.lineJoin = 'round';
|
|
@@ -66,8 +66,8 @@ export function AnnotationCanvas(props) {
|
|
|
66
66
|
resize: 'none',
|
|
67
67
|
overflow: 'hidden',
|
|
68
68
|
whiteSpace: 'pre',
|
|
69
|
-
color: '
|
|
70
|
-
caretColor: '
|
|
69
|
+
color: 'var(--jini-danger)',
|
|
70
|
+
caretColor: 'var(--jini-danger)',
|
|
71
71
|
fontWeight: 600,
|
|
72
72
|
fontSize: c.textFontPx,
|
|
73
73
|
lineHeight: 1.25,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveAnnotationTheme } from '../../theme.js';
|
|
1
2
|
/**
|
|
2
3
|
* Headless controller for the annotation-canvas engine: freehand/box/text
|
|
3
4
|
* drawing, undo/redo, canvas rAF/DPR redraw, the collision-avoiding floating
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
* Shift+Cmd/Ctrl+Z redo; Enter in the note input submits as Queue).
|
|
8
9
|
*
|
|
9
10
|
* Origin: `apps/web/src/components/PreviewDrawOverlay.tsx`. See
|
|
10
|
-
* `../../
|
|
11
|
+
* `../../archived provenance ledger` for the exact file-by-file port breakdown and what
|
|
11
12
|
* was intentionally left product-side (the `window` `CustomEvent` wire
|
|
12
13
|
* protocol, the compositor-iframe snapshot lookup, the composer's
|
|
13
14
|
* submission semantics).
|
|
@@ -621,7 +622,7 @@ export function useAnnotationCanvas(options) {
|
|
|
621
622
|
// ever reached via `send()`, itself only invocable from an event handler
|
|
622
623
|
// on an already-mounted, hydrated component — never during an SSR render
|
|
623
624
|
// pass, where `document` is provably defined. Proved dead and removed
|
|
624
|
-
// during the coverage pass (see `
|
|
625
|
+
// during the coverage pass (see `archived provenance ledger`); the guard is only
|
|
625
626
|
// meaningful at JSX-render time (portal / effect bodies), not inside an
|
|
626
627
|
// async handler like this one.
|
|
627
628
|
const out = document.createElement('canvas');
|
|
@@ -638,7 +639,7 @@ export function useAnnotationCanvas(options) {
|
|
|
638
639
|
});
|
|
639
640
|
if (!bg)
|
|
640
641
|
return null;
|
|
641
|
-
ctx.fillStyle =
|
|
642
|
+
ctx.fillStyle = resolveAnnotationTheme({ canvas: out }).bg;
|
|
642
643
|
ctx.fillRect(0, 0, out.width, out.height);
|
|
643
644
|
ctx.drawImage(bg, 0, 0, snap.w, snap.h);
|
|
644
645
|
const sx = snap.w / Math.max(1, frameRect.width);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* useAnnotationCanvas.ts`) measures from the live DOM and passes in.
|
|
7
7
|
*
|
|
8
8
|
* Origin: `apps/web/src/components/PreviewDrawOverlay.tsx`. See
|
|
9
|
-
* `../
|
|
9
|
+
* `../archived provenance ledger`.
|
|
10
10
|
*/
|
|
11
11
|
import type { AnnotationAction, CSSPropertiesLike, DockPlacement, NormalizedRect, Point, Rect } from './types.js';
|
|
12
12
|
export declare function clamp(value: number, min: number, max: number): number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Canvas requires resolved colors rather than var() strings. Its injected canvas owns the DOM. */
|
|
2
|
+
export declare function resolveAnnotationTheme({ canvas }: {
|
|
3
|
+
readonly canvas?: HTMLCanvasElement;
|
|
4
|
+
}, { getComputedStyle }?: {
|
|
5
|
+
readonly getComputedStyle?: (element: Element) => CSSStyleDeclaration;
|
|
6
|
+
}): {
|
|
7
|
+
stroke: string;
|
|
8
|
+
target: string;
|
|
9
|
+
bg: string;
|
|
10
|
+
ink: string;
|
|
11
|
+
font: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defaultAdminTheme } from '../../theme/default.js';
|
|
2
|
+
/** Canvas requires resolved colors rather than var() strings. Its injected canvas owns the DOM. */
|
|
3
|
+
export function resolveAnnotationTheme({ canvas }, { getComputedStyle } = {}) {
|
|
4
|
+
const document = canvas?.ownerDocument;
|
|
5
|
+
const readStyle = getComputedStyle ?? (document?.defaultView ? document.defaultView.getComputedStyle.bind(document.defaultView) : undefined);
|
|
6
|
+
const style = document && readStyle ? readStyle(canvas?.isConnected ? canvas : document.documentElement) : undefined;
|
|
7
|
+
const read = (name, fallback) => style?.getPropertyValue(name).trim() || fallback;
|
|
8
|
+
return {
|
|
9
|
+
stroke: read('--jini-danger', defaultAdminTheme.light.danger),
|
|
10
|
+
target: read('--jini-primary', defaultAdminTheme.light.primary),
|
|
11
|
+
bg: read('--jini-bg', defaultAdminTheme.light.bg),
|
|
12
|
+
ink: read('--jini-primary-ink', defaultAdminTheme.light.primaryInk),
|
|
13
|
+
font: read('--jini-font-body', defaultAdminTheme.fonts.body),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `children`), with a send/draft/queue submit-action picker.
|
|
5
5
|
*
|
|
6
6
|
* Origin: `apps/web/src/components/PreviewDrawOverlay.tsx` (the origin
|
|
7
|
-
* project, 2,158 lines). See `../
|
|
7
|
+
* project, 2,158 lines). See `../archived provenance ledger` for the full port writeup.
|
|
8
8
|
*/
|
|
9
9
|
export interface Point {
|
|
10
10
|
x: number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* srcDoc host. See `ADS-memory/reports/jini-port/extraction-plan.md` §3 and
|
|
4
4
|
* `ADS-memory/reports/jini-port/recon/r4b-webui-design.md` §1 ("@jini-ai/artifacts-react —
|
|
5
5
|
* RendererRegistry", the pre-lock name for this package) for the design
|
|
6
|
-
* this targets, and `
|
|
6
|
+
* this targets, and `archived provenance ledger` for exact provenance.
|
|
7
7
|
*/
|
|
8
8
|
export type { ArtifactFile, ArtifactManifest, ArtifactKind, ArtifactRendererId, ArtifactExportKind, ArtifactStatus } from './types.js';
|
|
9
9
|
export { RendererRegistry, resolveArtifactManifest, type ArtifactRenderer, type ArtifactRendererContext, type ArtifactRenderMatch, } from './registry.js';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { AdminTheme, ColorScheme } from '../theme/types.js';
|
|
1
2
|
import type { SandboxedDocumentOptions } from './types.js';
|
|
2
3
|
export interface NewTabPreviewOptions extends SandboxedDocumentOptions {
|
|
4
|
+
adminTheme?: AdminTheme;
|
|
5
|
+
colorScheme?: ColorScheme;
|
|
3
6
|
/** Allow `window.showModalDialog`-style native modals (`alert`/`confirm`/`prompt`) inside the sandboxed frame. Defaults to `false`. */
|
|
4
7
|
allowModals?: boolean;
|
|
5
8
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { defaultAdminTheme } from '../theme/default.js';
|
|
2
|
+
import { renderAdminThemeVariables } from '../theme/stylesheet.js';
|
|
1
3
|
import { escapeHtmlAttribute } from './html-utils.js';
|
|
2
4
|
import { buildSandboxedDocument } from './sandboxed-document.js';
|
|
3
5
|
/**
|
|
@@ -18,7 +20,7 @@ export function buildSandboxedPreviewPage(html, title, options = {}) {
|
|
|
18
20
|
<meta charset="utf-8" />
|
|
19
21
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
20
22
|
<title>${safeTitle}</title>
|
|
21
|
-
<style
|
|
23
|
+
<style>${renderAdminThemeVariables({ theme: options.adminTheme ?? defaultAdminTheme }, { ...(options.colorScheme ? { colorScheme: options.colorScheme } : {}) })}html,body,iframe{margin:0;width:100%;height:100%;border:0}body{overflow:hidden;background:var(--jini-bg)}</style>
|
|
22
24
|
</head>
|
|
23
25
|
<body>
|
|
24
26
|
<iframe title="${safeTitle}" sandbox="${sandbox}" srcdoc="${escapeHtmlAttribute(innerDoc)}"></iframe>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* consumer.
|
|
5
5
|
*
|
|
6
6
|
* Origin: `apps/web/src/components/PreviewModal.tsx`'s component body (the
|
|
7
|
-
* generic-chrome subset — see `../../
|
|
7
|
+
* generic-chrome subset — see `../../archived provenance ledger`'s classification). The
|
|
8
8
|
* merged Share/Export popover's state (`templateShareOpen`/
|
|
9
9
|
* `copyShareFeedback`/`socialShareTargets`/...) is deliberately not ported
|
|
10
10
|
* here; that block is OD-specific and out of scope for this shell.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* consumer.
|
|
5
5
|
*
|
|
6
6
|
* Origin: `apps/web/src/components/PreviewModal.tsx`'s component body (the
|
|
7
|
-
* generic-chrome subset — see `../../
|
|
7
|
+
* generic-chrome subset — see `../../archived provenance ledger`'s classification). The
|
|
8
8
|
* merged Share/Export popover's state (`templateShareOpen`/
|
|
9
9
|
* `copyShareFeedback`/`socialShareTargets`/...) is deliberately not ported
|
|
10
10
|
* here; that block is OD-specific and out of scope for this shell.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Origin: `apps/web/src/components/PreviewModal.tsx`'s inline derivations
|
|
8
8
|
* (the `initial` viewId ternary, `activeView`/`scale`/`scalerStyle` memos).
|
|
9
|
-
* See `../
|
|
9
|
+
* See `../archived provenance ledger`.
|
|
10
10
|
*/
|
|
11
11
|
import type { PreviewModalContentStatus, PreviewModalScalerStyle, PreviewModalUnavailable } from './types.js';
|
|
12
12
|
export interface PreviewModalViewLike {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* arbitrary preview content. No React import: React-specific prop shapes
|
|
5
5
|
* (anything carrying a `ReactNode`, e.g. the per-view `custom` stage or the
|
|
6
6
|
* sidebar's `content`) live in `react/components/PreviewModalShell.tsx`
|
|
7
|
-
* instead — see the React-layout policy note in `../
|
|
7
|
+
* instead — see the React-layout policy note in `../archived provenance ledger`.
|
|
8
8
|
*
|
|
9
9
|
* Origin: `apps/web/src/components/PreviewModal.tsx`. See
|
|
10
|
-
* `../
|
|
10
|
+
* `../archived provenance ledger`'s `preview-modal-shell` classification section for the
|
|
11
11
|
* full generic-vs-OD-specific breakdown.
|
|
12
12
|
*/
|
|
13
13
|
/** One item in a split-button primary action's secondary-options menu. */
|
|
@@ -35,7 +35,7 @@ export interface PreviewModalPrimaryAction {
|
|
|
35
35
|
* Shown in the content stage in place of the loading/error/rendered states
|
|
36
36
|
* when a view genuinely has nothing to preview (generalized from the
|
|
37
37
|
* origin's closed `'skill' | 'plugin' | 'template'` noun vocabulary — see
|
|
38
|
-
* `../
|
|
38
|
+
* `../archived provenance ledger`). The caller owns the copy; the shell just displays it.
|
|
39
39
|
*/
|
|
40
40
|
export interface PreviewModalUnavailable {
|
|
41
41
|
message: string;
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* arbitrary preview content. No React import: React-specific prop shapes
|
|
5
5
|
* (anything carrying a `ReactNode`, e.g. the per-view `custom` stage or the
|
|
6
6
|
* sidebar's `content`) live in `react/components/PreviewModalShell.tsx`
|
|
7
|
-
* instead — see the React-layout policy note in `../
|
|
7
|
+
* instead — see the React-layout policy note in `../archived provenance ledger`.
|
|
8
8
|
*
|
|
9
9
|
* Origin: `apps/web/src/components/PreviewModal.tsx`. See
|
|
10
|
-
* `../
|
|
10
|
+
* `../archived provenance ledger`'s `preview-modal-shell` classification section for the
|
|
11
11
|
* full generic-vs-OD-specific breakdown.
|
|
12
12
|
*/
|
|
13
13
|
export {};
|
|
@@ -26,7 +26,7 @@ export interface ArtifactViewSlots {
|
|
|
26
26
|
export interface ArtifactViewProps {
|
|
27
27
|
file: ArtifactFile;
|
|
28
28
|
registry: RendererRegistry;
|
|
29
|
-
/** Passed through to `registry.resolve({ file, hints })`. */
|
|
29
|
+
/** Passed through to `registry.resolve({ file }, { hints })`. */
|
|
30
30
|
hints?: Record<string, unknown> | undefined;
|
|
31
31
|
/** Passed through to `SrcDocSandbox` for the built-in `html`/`svg` rendering. */
|
|
32
32
|
srcDocOptions?: BuildSrcDocOptions | undefined;
|
|
@@ -7,7 +7,7 @@ import { SrcDocSandbox } from './SrcDocSandbox.js';
|
|
|
7
7
|
import { AnnotationCanvas } from '../../annotation-canvas/index.js';
|
|
8
8
|
export function ArtifactView({ file, registry, hints, srcDocOptions, slots, className, annotation }) {
|
|
9
9
|
const t = useT();
|
|
10
|
-
const match = useMemo(() => registry.resolve({ file, hints }), [registry, file, hints]);
|
|
10
|
+
const match = useMemo(() => registry.resolve({ file }, { hints }), [registry, file, hints]);
|
|
11
11
|
const wrap = (node) => (annotation ? _jsx(AnnotationCanvas, { ...annotation, children: node }) : node);
|
|
12
12
|
if (!match) {
|
|
13
13
|
return wrap(_jsx("div", { className: className, role: "status", children: t('No renderer is registered for this artifact.') }));
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* rendering needs a host-injected postMessage bridge (see
|
|
9
9
|
* `srcdoc/bridge.ts`), so a host registers its own `deck-html`
|
|
10
10
|
* {@link ArtifactRenderer} into the registry instance it constructs instead
|
|
11
|
-
* of this package shipping one. See `
|
|
11
|
+
* of this package shipping one. See `archived provenance ledger`.
|
|
12
12
|
*/
|
|
13
13
|
import type { ArtifactFile, ArtifactManifest } from './types.js';
|
|
14
14
|
export interface ArtifactRendererContext {
|
|
@@ -27,7 +27,7 @@ export interface ArtifactRenderer {
|
|
|
27
27
|
*/
|
|
28
28
|
supportsStreaming: boolean;
|
|
29
29
|
renderPartial?: ((content: string) => string) | undefined;
|
|
30
|
-
canRender: (
|
|
30
|
+
canRender: (required: Pick<ArtifactRendererContext, "file">, optional?: Omit<ArtifactRendererContext, "file">) => boolean;
|
|
31
31
|
}
|
|
32
32
|
export interface ArtifactRenderMatch {
|
|
33
33
|
renderer: ArtifactRenderer;
|
|
@@ -44,14 +44,20 @@ export interface ArtifactRenderMatch {
|
|
|
44
44
|
* resolve a manifest for the file itself — see `@jini-ai/chat`'s
|
|
45
45
|
* `inferLegacyManifest` — before handing the file to this registry.
|
|
46
46
|
*/
|
|
47
|
-
export declare function resolveArtifactManifest(file
|
|
47
|
+
export declare function resolveArtifactManifest({ file }: {
|
|
48
|
+
file: ArtifactFile;
|
|
49
|
+
}): ArtifactManifest | null;
|
|
48
50
|
export declare class RendererRegistry {
|
|
49
51
|
private readonly renderers;
|
|
50
|
-
constructor(renderers:
|
|
52
|
+
constructor({ renderers }: {
|
|
53
|
+
renderers: readonly ArtifactRenderer[];
|
|
54
|
+
});
|
|
51
55
|
/** Renderers currently registered, in resolution order. */
|
|
52
56
|
list(): readonly ArtifactRenderer[];
|
|
53
|
-
resolve(
|
|
57
|
+
resolve({ file }: Pick<ArtifactRendererContext, "file">, { hints }?: Omit<ArtifactRendererContext, "file">): ArtifactRenderMatch | null;
|
|
54
58
|
/** Returns a new registry with `renderer` appended (or replacing an existing renderer of the same id). */
|
|
55
|
-
register(renderer
|
|
59
|
+
register({ renderer }: {
|
|
60
|
+
renderer: ArtifactRenderer;
|
|
61
|
+
}): RendererRegistry;
|
|
56
62
|
}
|
|
57
63
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -9,31 +9,29 @@
|
|
|
9
9
|
* resolve a manifest for the file itself — see `@jini-ai/chat`'s
|
|
10
10
|
* `inferLegacyManifest` — before handing the file to this registry.
|
|
11
11
|
*/
|
|
12
|
-
export function resolveArtifactManifest(file) {
|
|
12
|
+
export function resolveArtifactManifest({ file }) {
|
|
13
13
|
return file.manifest ?? null;
|
|
14
14
|
}
|
|
15
15
|
export class RendererRegistry {
|
|
16
16
|
renderers;
|
|
17
|
-
constructor(renderers) {
|
|
18
|
-
this.renderers = renderers;
|
|
19
|
-
}
|
|
17
|
+
constructor({ renderers }) { this.renderers = renderers; }
|
|
20
18
|
/** Renderers currently registered, in resolution order. */
|
|
21
19
|
list() {
|
|
22
20
|
return this.renderers;
|
|
23
21
|
}
|
|
24
|
-
resolve(
|
|
25
|
-
const manifest = resolveArtifactManifest(
|
|
22
|
+
resolve({ file }, { hints } = {}) {
|
|
23
|
+
const manifest = resolveArtifactManifest({ file });
|
|
26
24
|
if (!manifest)
|
|
27
25
|
return null;
|
|
28
|
-
const renderer = this.renderers.find((item) => item.canRender(
|
|
26
|
+
const renderer = this.renderers.find((item) => item.canRender({ file }, { hints }));
|
|
29
27
|
if (!renderer)
|
|
30
28
|
return null;
|
|
31
29
|
return { renderer, manifest };
|
|
32
30
|
}
|
|
33
31
|
/** Returns a new registry with `renderer` appended (or replacing an existing renderer of the same id). */
|
|
34
|
-
register(renderer) {
|
|
32
|
+
register({ renderer }) {
|
|
35
33
|
const withoutExisting = this.renderers.filter((item) => item.id !== renderer.id);
|
|
36
|
-
return new RendererRegistry([...withoutExisting, renderer]);
|
|
34
|
+
return new RendererRegistry({ renderers: [...withoutExisting, renderer] });
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
//# sourceMappingURL=registry.js.map
|
|
@@ -9,8 +9,8 @@ import { resolveArtifactManifest } from '../registry.js';
|
|
|
9
9
|
export const HtmlRenderer = {
|
|
10
10
|
id: 'html',
|
|
11
11
|
supportsStreaming: false,
|
|
12
|
-
canRender: ({ file, hints }) => {
|
|
13
|
-
const manifest = resolveArtifactManifest(file);
|
|
12
|
+
canRender: ({ file }, { hints } = {}) => {
|
|
13
|
+
const manifest = resolveArtifactManifest({ file: file });
|
|
14
14
|
if (!manifest)
|
|
15
15
|
return false;
|
|
16
16
|
if (manifest.kind === 'deck' || manifest.renderer === 'deck-html')
|
|
@@ -13,6 +13,6 @@ export { ReactComponentRenderer } from './react-component.js';
|
|
|
13
13
|
* deck rendering registers its own via `.register(...)`.
|
|
14
14
|
*/
|
|
15
15
|
export function createDefaultRendererRegistry() {
|
|
16
|
-
return new RendererRegistry([HtmlRenderer, MarkdownRenderer, SvgRenderer, ReactComponentRenderer]);
|
|
16
|
+
return new RendererRegistry({ renderers: [HtmlRenderer, MarkdownRenderer, SvgRenderer, ReactComponentRenderer] });
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=index.js.map
|