@workbench-kit/react 0.0.2-prototype.0.1.4 → 0.0.2-prototype.0.2.11
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 +87 -0
- package/package.json +37 -27
- package/src/brand/TilepaperAppIcon.tsx +181 -0
- package/src/brand/index.ts +2 -0
- package/src/brand/tilepaper-app-icon-geometry.ts +201 -0
- package/src/icons/WorkbenchIcon.tsx +57 -0
- package/src/icons/WorkbenchIconContext.tsx +25 -0
- package/src/icons/file-icon.ts +154 -0
- package/src/icons/index.ts +17 -0
- package/src/icons/resolveWorkbenchIcon.ts +48 -0
- package/src/icons/types.ts +28 -0
- package/src/index.ts +292 -88
- package/src/jdw/JdwPreview.tsx +165 -8
- package/src/jdw/JdwPreviewViewport.tsx +190 -0
- package/src/jdw/JsonCodeEditorPane.tsx +172 -21
- package/src/jdw/builtins/renderBuiltinWidgetLeaf.tsx +101 -0
- package/src/jdw/createBuiltinJdwRegistry.ts +330 -5
- package/src/jdw/cssRenderBackend.tsx +96 -7
- package/src/jdw/document.ts +0 -3
- package/src/jdw/fixtures/jdw-sample-screens.ts +10 -8
- package/src/jdw/index.ts +9 -4
- package/src/jdw/jdw-preview-viewport.css +41 -0
- package/src/jdw/renderJdw.tsx +49 -8
- package/src/json-config/JsonConfigWorkbench.tsx +12 -15
- package/src/layout/ViewEmptyState.tsx +14 -0
- package/src/layout/WorkbenchCanvas.tsx +113 -6
- package/src/layout/WorkbenchLayout.tsx +3 -0
- package/src/layout/WorkbenchLayoutBase.tsx +43 -2
- package/src/layout/WorkbenchMediaPreviewViewport.tsx +122 -0
- package/src/layout/WorkbenchPropertyOverrideLabel.tsx +90 -0
- package/src/layout/WorkbenchPropertyPanel.tsx +153 -17
- package/src/layout/WorkbenchPropertySearch.tsx +51 -0
- package/src/layout/WorkbenchTree.tsx +9 -10
- package/src/layout/canvas/canvas-drag-ghost.css +21 -0
- package/src/layout/canvas/canvas-drag-preview-frame.css +15 -0
- package/src/layout/canvas/canvas-drop-indicator.css +16 -0
- package/src/layout/canvas/canvas-frame-handle.css +37 -0
- package/src/layout/canvas/canvas-frame-surface.css +24 -0
- package/src/layout/canvas/canvas-guide-block.css +17 -0
- package/src/layout/canvas/canvas-guide-layer.css +6 -0
- package/src/layout/canvas/canvas-guide-line.css +22 -0
- package/src/layout/canvas/canvas-item-badge.css +23 -0
- package/src/layout/canvas/canvas-item-frame.css +54 -0
- package/src/layout/canvas/canvas-pane-surface.css +9 -0
- package/src/layout/canvas/canvas-placeholder.css +21 -0
- package/src/layout/canvas/canvas-resize-frame.css +9 -0
- package/src/layout/canvas/canvas-resize-handle.css +74 -0
- package/src/layout/canvas/canvas-resize-preview.css +11 -0
- package/src/layout/canvas/canvas-selection-marquee.css +14 -0
- package/src/layout/canvas/canvas-viewport.css +18 -0
- package/src/layout/canvas/index.css +19 -0
- package/src/layout/canvas/preview-canvas.css +144 -0
- package/src/layout/editor/editor-body.css +9 -0
- package/src/layout/editor/editor-bottom-panel.css +44 -0
- package/src/layout/editor/editor-frame.css +14 -0
- package/src/layout/editor/editor-viewport.css +7 -0
- package/src/layout/editor/floating-menu.css +91 -0
- package/src/layout/editor/index.css +10 -0
- package/src/layout/editor/parse-error.css +9 -0
- package/src/layout/editor/problem-item.css +52 -0
- package/src/layout/editor/problem-list.css +7 -0
- package/src/layout/editor/render-surface.css +13 -0
- package/src/layout/fillScrollContract.ts +49 -0
- package/src/layout/fullscreen/fullscreen-backdrop.css +31 -0
- package/src/layout/fullscreen/fullscreen-button.css +44 -0
- package/src/layout/fullscreen/fullscreen-carousel.css +20 -0
- package/src/layout/fullscreen/fullscreen-content.css +8 -0
- package/src/layout/fullscreen/fullscreen-empty.css +16 -0
- package/src/layout/fullscreen/fullscreen-header.css +77 -0
- package/src/layout/fullscreen/fullscreen-hero.css +41 -0
- package/src/layout/fullscreen/fullscreen-nav-button.css +29 -0
- package/src/layout/fullscreen/fullscreen-option.css +83 -0
- package/src/layout/fullscreen/fullscreen-pill-row.css +6 -0
- package/src/layout/fullscreen/fullscreen-pill.css +10 -0
- package/src/layout/fullscreen/fullscreen-root.css +11 -0
- package/src/layout/fullscreen/index.css +13 -0
- package/src/layout/index.ts +165 -0
- package/src/layout/layout-base/banner.css +32 -0
- package/src/layout/layout-base/center.css +7 -0
- package/src/layout/layout-base/column.css +7 -0
- package/src/layout/layout-base/divider.css +5 -0
- package/src/layout/layout-base/empty.css +12 -0
- package/src/layout/layout-base/fill-scroll.css +36 -0
- package/src/layout/layout-base/fill.css +18 -0
- package/src/layout/layout-base/index.css +13 -0
- package/src/layout/layout-base/pane.css +6 -0
- package/src/layout/layout-base/panel-scroll.css +5 -0
- package/src/layout/layout-base/panel-surface.css +14 -0
- package/src/layout/layout-base/root.css +9 -0
- package/src/layout/layout-base/section-title.css +8 -0
- package/src/layout/layout.css +10 -0
- package/src/layout/layoutHelpers.ts +4 -2
- package/src/layout/media/index.css +2 -0
- package/src/layout/media/media-preview-viewport.css +69 -0
- package/src/layout/{Panel.tsx → panel/Panel.tsx} +29 -40
- package/src/layout/panel/TemplateGallery.tsx +90 -0
- package/src/layout/panel/WorkbenchAuthoringShell.tsx +57 -0
- package/src/layout/panel/WorkbenchLabeledPane.tsx +81 -0
- package/src/layout/panel/WorkbenchSidebarStack.tsx +15 -0
- package/src/layout/panel/filter-bar.css +59 -0
- package/src/layout/panel/index.css +7 -0
- package/src/layout/panel/index.ts +70 -0
- package/src/layout/panel/preview-pane.css +63 -0
- package/src/layout/panel/template-gallery.css +131 -0
- package/src/layout/panel/workbench-authoring-shell.css +48 -0
- package/src/layout/panel/workbench-labeled-pane.css +69 -0
- package/src/layout/panel/workbench-sidebar-stack.css +18 -0
- package/src/layout/property/color-input.css +8 -0
- package/src/layout/property/color-row.css +6 -0
- package/src/layout/property/index.css +15 -0
- package/src/layout/property/property-card.css +8 -0
- package/src/layout/property/property-grid.css +24 -0
- package/src/layout/property/property-hint.css +4 -0
- package/src/layout/property/property-inline.css +10 -0
- package/src/layout/property/property-key-value.css +29 -0
- package/src/layout/property/property-override-label.css +34 -0
- package/src/layout/property/property-panel.css +20 -0
- package/src/layout/property/property-row.css +17 -0
- package/src/layout/property/property-search.css +43 -0
- package/src/layout/property/property-section.css +97 -0
- package/src/layout/property/property-stack.css +11 -0
- package/src/layout/property/property-toggle.css +14 -0
- package/src/layout/propertyFieldFilter.ts +84 -0
- package/src/layout/sidebar/SideBarTree.tsx +301 -0
- package/src/layout/sidebar/SideBarViewFrame.tsx +235 -0
- package/src/layout/sidebar/SideBarViewTabStrip.tsx +60 -0
- package/src/layout/sidebar/SideBarViewTitleMenu.tsx +75 -0
- package/src/layout/sidebar/SidebarActionIconBar.tsx +242 -0
- package/src/layout/sidebar/SidebarSectionNestingContext.tsx +21 -0
- package/src/layout/sidebar/SidebarSlotChrome.tsx +32 -0
- package/src/layout/sidebar/SidebarToolbar.tsx +10 -0
- package/src/layout/sidebar/WorkbenchActionSidebar.tsx +73 -0
- package/src/layout/{WorkbenchSidebarActions.tsx → sidebar/WorkbenchSidebarActions.tsx} +105 -51
- package/src/layout/sidebar/WorkbenchSidebarSectionStack.tsx +165 -0
- package/src/layout/sidebar/index.css +5 -0
- package/src/layout/sidebar/index.ts +68 -0
- package/src/layout/sidebar/sidebar-chrome.css +95 -0
- package/src/layout/sidebar/sidebar-section-stack.css +25 -0
- package/src/layout/sidebar/sidebar-section.css +124 -0
- package/src/layout/sidebar/sidebar-view.css +290 -0
- package/src/layout/tree/drag-preview.css +25 -0
- package/src/layout/tree/index.css +10 -0
- package/src/layout/tree/template-glyph.css +96 -0
- package/src/layout/tree/tree-action.css +20 -0
- package/src/layout/tree/tree-drag-overlay.css +13 -0
- package/src/layout/tree/tree-drop-line.css +17 -0
- package/src/layout/tree/tree-drop-zone.css +13 -0
- package/src/layout/tree/tree-expander.css +23 -0
- package/src/layout/tree/tree-item.css +93 -0
- package/src/layout/tree/tree.css +49 -0
- package/src/layout/usePreviewViewport.ts +428 -0
- package/src/modal/ConfirmDialog.tsx +1 -1
- package/src/modal/Modal.tsx +184 -311
- package/src/modal/ModalResizeHandles.tsx +40 -0
- package/src/modal/ModalTitlebar.tsx +86 -0
- package/src/modal/modal.css +291 -0
- package/src/modal/modalContainer.ts +36 -0
- package/src/modal/modalPosition.ts +36 -0
- package/src/modal/modalSize.ts +84 -0
- package/src/modal/modalTypes.ts +13 -0
- package/src/modal/useModalContainerViewport.ts +41 -0
- package/src/modal/useModalDrag.ts +118 -0
- package/src/modal/useModalFocusTrap.ts +142 -0
- package/src/modal/useModalResize.ts +122 -0
- package/src/modal/useModalWindowFrame.ts +122 -0
- package/src/overlay/ContextMenu.tsx +139 -54
- package/src/overlay/clampFixedOverlayPosition.ts +22 -0
- package/src/overlay/context-menu.css +129 -0
- package/src/overlay/index.ts +31 -0
- package/src/overlay/measureAnchoredOverlayPanel.ts +107 -0
- package/src/overlay/overlay.css +2 -0
- package/src/overlay/pointerPassthroughRegion.ts +83 -0
- package/src/overlay/useAnchoredOverlayPanel.ts +222 -0
- package/src/overlay/useClampedFixedOverlayPosition.ts +27 -0
- package/src/overlay/useContextMenuState.ts +59 -0
- package/src/overlay/useFixedOverlayDismiss.ts +49 -0
- package/src/overlay/usePointerPassthroughRegion.ts +87 -0
- package/src/primitives/{AbsoluteBox.tsx → absolute-box/AbsoluteBox.tsx} +5 -5
- package/src/primitives/absolute-box/index.ts +1 -0
- package/src/primitives/{Badge.tsx → badge/Badge.tsx} +4 -2
- package/src/primitives/badge/badge.css +20 -0
- package/src/primitives/badge/index.ts +1 -0
- package/src/primitives/{Button.tsx → button/Button.tsx} +7 -6
- package/src/primitives/button/button.css +76 -0
- package/src/primitives/button/index.ts +1 -0
- package/src/primitives/catalog-browse-card/CatalogBrowseCard.tsx +121 -0
- package/src/primitives/catalog-browse-card/catalog-browse-card.css +175 -0
- package/src/primitives/catalog-browse-card/index.ts +1 -0
- package/src/primitives/catalog-browse-pane/CatalogBrowseFacetChips.tsx +59 -0
- package/src/primitives/catalog-browse-pane/CatalogBrowsePane.tsx +360 -0
- package/src/primitives/catalog-browse-pane/catalog-browse-facet-chips.css +8 -0
- package/src/primitives/catalog-browse-pane/catalog-browse-pane.css +84 -0
- package/src/primitives/catalog-browse-pane/filterCatalogBrowseItems.ts +27 -0
- package/src/primitives/catalog-browse-pane/index.ts +3 -0
- package/src/primitives/catalog-filter-overlay/CatalogFilterOverlay.tsx +73 -0
- package/src/primitives/catalog-filter-overlay/catalog-filter-overlay.css +65 -0
- package/src/primitives/catalog-filter-overlay/index.ts +1 -0
- package/src/primitives/checkbox/Checkbox.tsx +40 -0
- package/src/primitives/checkbox/checkbox.css +81 -0
- package/src/primitives/checkbox/index.ts +1 -0
- package/src/primitives/chip/Chip.tsx +43 -0
- package/src/primitives/chip/chip.css +110 -0
- package/src/primitives/chip/index.ts +2 -0
- package/src/primitives/clearable-text-input/ClearableTextInput.tsx +78 -0
- package/src/primitives/clearable-text-input/clearable-text-input.css +15 -0
- package/src/primitives/clearable-text-input/index.ts +1 -0
- package/src/primitives/codicon/Codicon.tsx +20 -0
- package/src/primitives/codicon/index.ts +1 -0
- package/src/primitives/{EmptyState.tsx → empty-state/EmptyState.tsx} +9 -3
- package/src/primitives/empty-state/empty-state.css +20 -0
- package/src/primitives/empty-state/index.ts +1 -0
- package/src/primitives/external-link-button/ExternalLinkButton.tsx +56 -0
- package/src/primitives/external-link-button/index.ts +1 -0
- package/src/primitives/{Field.tsx → field/Field.tsx} +2 -1
- package/src/primitives/field/field.css +51 -0
- package/src/primitives/field/index.ts +1 -0
- package/src/primitives/file-icon/FileIcon.tsx +21 -0
- package/src/primitives/file-icon/index.ts +1 -0
- package/src/primitives/{IconButton.tsx → icon-button/IconButton.tsx} +7 -5
- package/src/primitives/icon-button/icon-button.css +46 -0
- package/src/primitives/icon-button/index.ts +1 -0
- package/src/primitives/index.ts +215 -50
- package/src/primitives/library-detail-layout/LibraryDetailLayout.tsx +249 -0
- package/src/primitives/library-detail-layout/index.ts +6 -0
- package/src/primitives/library-detail-layout/library-detail-layout.css +226 -0
- package/src/primitives/library-detail-layout/resolve-hero-cover-media.ts +80 -0
- package/src/primitives/library-facet-filter-panel/LibraryFacetFilterPanel.tsx +454 -0
- package/src/primitives/library-facet-filter-panel/index.ts +1 -0
- package/src/primitives/library-facet-filter-panel/library-facet-filter-panel.css +205 -0
- package/src/primitives/library-facet-filter-strip/LibraryFacetFilterStrip.tsx +527 -0
- package/src/primitives/library-facet-filter-strip/index.ts +1 -0
- package/src/primitives/library-facet-filter-strip/library-facet-filter-strip.css +31 -0
- package/src/primitives/{List.tsx → list/List.tsx} +15 -6
- package/src/primitives/list/index.ts +1 -0
- package/src/primitives/list/list-empty-state.css +10 -0
- package/src/primitives/list/list-item.css +93 -0
- package/src/primitives/list/list.css +6 -0
- package/src/primitives/number-input/NumberInput.tsx +235 -0
- package/src/primitives/number-input/index.ts +1 -0
- package/src/primitives/number-input/number-input.css +105 -0
- package/src/primitives/panel-loading/PanelLoading.tsx +29 -0
- package/src/primitives/panel-loading/index.ts +1 -0
- package/src/primitives/panel-loading/panel-loading.css +16 -0
- package/src/primitives/panel-surface/panel-surface.css +77 -0
- package/src/primitives/primitives.css +36 -0
- package/src/primitives/record-media-hero/RecordMediaHero.tsx +85 -0
- package/src/primitives/record-media-hero/index.ts +1 -0
- package/src/primitives/record-media-hero/record-media-hero.css +84 -0
- package/src/primitives/scroll-area/ScrollArea.tsx +200 -0
- package/src/primitives/scroll-area/index.ts +1 -0
- package/src/primitives/scroll-area/scroll-area-overlay.css +69 -0
- package/src/primitives/scroll-area-infinite-load/ScrollAreaInfiniteSentinel.tsx +22 -0
- package/src/primitives/scroll-area-infinite-load/index.ts +2 -0
- package/src/primitives/scroll-area-infinite-load/scroll-area-infinite-sentinel.css +6 -0
- package/src/primitives/scroll-area-infinite-load/useScrollAreaInfiniteLoad.ts +84 -0
- package/src/primitives/searchable-multi-select/SearchableMultiSelect.tsx +378 -0
- package/src/primitives/searchable-multi-select/index.ts +9 -0
- package/src/primitives/searchable-multi-select/overlay.ts +125 -0
- package/src/primitives/searchable-multi-select/searchable-multi-select.css +129 -0
- package/src/primitives/select/Select.tsx +21 -3
- package/src/primitives/select/overlay.ts +23 -4
- package/src/primitives/select/select.app.css +5 -2
- package/src/primitives/select/select.css +49 -12
- package/src/primitives/styles.css +3 -952
- package/src/primitives/tabbed-panels/TabbedPanels.tsx +68 -0
- package/src/primitives/tabbed-panels/index.ts +2 -0
- package/src/primitives/tabbed-panels/tabbed-panels.css +58 -0
- package/src/primitives/{TextArea.tsx → text-area/TextArea.tsx} +3 -2
- package/src/primitives/text-area/index.ts +1 -0
- package/src/primitives/{TextInput.tsx → text-input/TextInput.tsx} +3 -2
- package/src/primitives/text-input/index.ts +1 -0
- package/src/primitives/text-input/input.css +54 -0
- package/src/primitives/{Toolbar.tsx → toolbar/Toolbar.tsx} +1 -1
- package/src/primitives/toolbar/index.ts +1 -0
- package/src/primitives/visually-hidden/visually-hidden.css +11 -0
- package/src/primitives/{WorkbenchEditor.tsx → workbench-editor/WorkbenchEditor.tsx} +81 -43
- package/src/primitives/workbench-editor/button-group.css +10 -0
- package/src/primitives/workbench-editor/editor-tabs.css +201 -0
- package/src/primitives/workbench-editor/index.ts +1 -0
- package/src/primitives/workbench-editor/resizable-panels.css +53 -0
- package/src/primitives/workbench-editor/segmented-control.css +98 -0
- package/src/primitives/workbench-media-slot/WorkbenchMediaPlaceholder.tsx +25 -0
- package/src/primitives/workbench-media-slot/WorkbenchMediaSlot.tsx +66 -0
- package/src/primitives/workbench-media-slot/index.ts +2 -0
- package/src/primitives/workbench-media-slot/media-slot.css +72 -0
- package/src/primitives/workbench-thumbnail/WorkbenchThumbnail.tsx +38 -0
- package/src/primitives/workbench-thumbnail/index.ts +1 -0
- package/src/primitives/workbench-thumbnail/thumbnail.css +69 -0
- package/src/scrollbars.css +77 -2
- package/src/styles.css +13 -7735
- package/src/test-utils/workbenchMonacoMock.tsx +37 -0
- package/src/utils/dragMime.ts +89 -0
- package/src/utils/useWorkbenchMediaImage.ts +37 -0
- package/src/widget-asset/WidgetAssetEditor.tsx +9 -7
- package/src/widget-asset/WidgetAssetModeControls.tsx +1 -1
- package/src/widget-asset/WidgetAssetWorkbench.tsx +5 -6
- package/src/widget-studio/create-widget-studio-workspace-editor.tsx +1 -2
- package/src/widget-studio/index.ts +4 -1
- package/src/widget-studio/resolve-widget-studio-asset-catalog.ts +27 -10
- package/src/widget-tree/WidgetAssetPalette.tsx +35 -7
- package/src/widget-tree/WidgetInspectorPanel.tsx +53 -3
- package/src/widget-tree/WidgetSourceEditor.tsx +90 -3
- package/src/widget-tree/WidgetTreeCanvasPreview.tsx +875 -0
- package/src/widget-tree/WidgetTreeLab.tsx +411 -83
- package/src/widget-tree/WidgetTreeModeControls.tsx +30 -1
- package/src/widget-tree/WidgetTreeSidePanel.tsx +24 -34
- package/src/widget-tree/WidgetTreeView.tsx +711 -11
- package/src/widget-tree/WidgetTreeWorkbench.tsx +59 -15
- package/src/widget-tree/WidgetTreeWorkspaceShell.tsx +28 -10
- package/src/widget-tree/index.ts +22 -4
- package/src/widget-tree/widget-placement-asset-dnd.ts +35 -0
- package/src/widget-tree/widget-tree-document.ts +3 -9
- package/src/widget-tree/widget-tree-editor-state.ts +40 -0
- package/src/widget-tree/widget-tree-layout.ts +48 -3
- package/src/widget-tree/widget-tree-play-helpers.ts +69 -58
- package/src/workbench/auth/WorkbenchLoginView.tsx +4 -6
- package/src/workbench/auth/auth-flows.css +440 -0
- package/src/workbench/auth/auth.css +3 -0
- package/src/workbench/auth/profile-modals.css +115 -0
- package/src/workbench/bootstrap/WorkbenchBootstrapGate.tsx +45 -0
- package/src/workbench/bootstrap/WorkbenchBootstrapView.tsx +100 -0
- package/src/workbench/bootstrap/index.ts +12 -0
- package/src/workbench/bootstrap/useWorkbenchBootstrap.ts +130 -0
- package/src/workbench/chat/ChatCommandProposalCard.tsx +115 -0
- package/src/workbench/chat/ChatComposer.tsx +32 -34
- package/src/workbench/chat/ChatConversationBar.tsx +134 -0
- package/src/workbench/chat/ChatHistoryMenu.tsx +171 -0
- package/src/workbench/chat/ChatHistoryMenuRow.tsx +74 -0
- package/src/workbench/chat/ChatMessageCollapsible.tsx +119 -0
- package/src/workbench/chat/ChatMessageItem.tsx +351 -19
- package/src/workbench/chat/ChatMessageList.tsx +109 -24
- package/src/workbench/chat/ChatPanel.tsx +141 -19
- package/src/workbench/chat/ChatPhasedRunProgress.tsx +275 -0
- package/src/workbench/chat/ChatRenameDialog.tsx +77 -0
- package/src/workbench/chat/chat-conversation.css +273 -0
- package/src/workbench/chat/chat-ui.css +1132 -0
- package/src/workbench/chat/chat.css +3 -0
- package/src/workbench/chat/chatConversation.ts +46 -0
- package/src/workbench/chat/chatHistoryRowMenuItems.ts +29 -0
- package/src/workbench/chat/chatMessageMeta.tsx +252 -0
- package/src/workbench/chat/chatScroll.ts +22 -0
- package/src/workbench/chat/index.ts +48 -1
- package/src/workbench/chat/slashCommand.ts +5 -7
- package/src/workbench/chat/types.ts +35 -0
- package/src/workbench/chat/useCancelRuntimeOnUnmount.ts +60 -0
- package/src/workbench/chat/useChatPrependPagination.ts +233 -0
- package/src/workbench/chat/useChatRuntimeState.ts +3 -15
- package/src/workbench/chat/useSlashCommandSuggest.ts +77 -24
- package/src/workbench/chrome/WorkbenchModalPortal.tsx +52 -0
- package/src/workbench/chrome/WorkbenchPlatformContext.tsx +31 -0
- package/src/workbench/chrome/index.css +6 -0
- package/src/workbench/chrome/workbench-chrome.css +4 -0
- package/src/workbench/chrome/workbench-desktop-titlebar.css +60 -0
- package/src/workbench/chrome/workbench-host.css +85 -0
- package/src/workbench/chrome/workbench-layout-regions.css +42 -0
- package/src/workbench/chrome/workbench-platform-chrome.css +142 -0
- package/src/workbench/chrome/workbench-shell-titlebar.css +124 -0
- package/src/workbench/chrome/workbenchModalViewState.ts +52 -0
- package/src/workbench/chrome/workbenchOverlaysContext.tsx +21 -0
- package/src/workbench/chrome/workbenchPlatformChrome.ts +40 -0
- package/src/workbench/command-palette/command-palette.css +156 -0
- package/src/workbench/commands/CommandGroupShell.tsx +131 -0
- package/src/workbench/commands/CommandList.tsx +167 -0
- package/src/workbench/commands/CommandPalette.tsx +391 -0
- package/src/workbench/{ConfirmationFlow.tsx → commands/ConfirmationFlow.tsx} +6 -8
- package/src/workbench/{ShortcutCommandBridge.tsx → commands/ShortcutCommandBridge.tsx} +1 -4
- package/src/workbench/commands/command-execution-policy.ts +61 -0
- package/src/workbench/commands/command-model.ts +279 -0
- package/src/workbench/{commands.ts → commands/commands.ts} +63 -7
- package/src/workbench/commands/workbenchContextMenu.ts +18 -0
- package/src/workbench/editor/WorkbenchEditorTabs.tsx +52 -0
- package/src/workbench/editor/editor-tabs-dnd.ts +162 -0
- package/src/workbench/editor/editorTabContextMenu.ts +111 -0
- package/src/workbench/editor/useEditorTabsStripDnd.ts +262 -0
- package/src/workbench/editor/useWorkbenchEditorTabContextMenu.tsx +66 -0
- package/src/workbench/editor-tabs/index.ts +22 -0
- package/src/workbench/index.ts +288 -37
- package/src/workbench/management/AccountManagementPanel.tsx +82 -0
- package/src/workbench/management/CommandInspectorPanel.tsx +127 -0
- package/src/workbench/management/CommandManagementPanel.tsx +129 -0
- package/src/workbench/management/CommandManagementSidebar.tsx +318 -0
- package/src/workbench/management/ExtensionManagementPanel.tsx +527 -0
- package/src/workbench/management/ExtensionManagementSidebar.tsx +509 -0
- package/src/workbench/management/IntegrationCommandActions.tsx +78 -0
- package/src/workbench/management/IntegrationSettingsSurface.tsx +290 -0
- package/src/workbench/management/IntegrationsShell.tsx +53 -0
- package/src/workbench/management/KeybindingCaptureField.tsx +142 -0
- package/src/workbench/management/KeybindingManagementPanel.tsx +120 -0
- package/src/workbench/management/LibraryCatalogPickerDialog.tsx +208 -0
- package/src/workbench/management/LibraryFacetFilterDialog.tsx +62 -0
- package/src/workbench/management/ManagementCard.tsx +89 -0
- package/src/workbench/management/ManagementFilterChips.tsx +41 -0
- package/src/workbench/management/ManagementGroup.tsx +56 -0
- package/src/workbench/management/ManagementPanelControls.tsx +43 -0
- package/src/workbench/management/ManagementPanelFrame.tsx +109 -0
- package/src/workbench/management/WorkbenchDialogFrame.tsx +148 -0
- package/src/workbench/management/WorkbenchNotice.tsx +211 -0
- package/src/workbench/management/build-command-management-groups.ts +157 -0
- package/src/workbench/management/command-inspector-uri.ts +26 -0
- package/src/workbench/management/createWorkbenchNotify.tsx +88 -0
- package/src/workbench/management/extension-category-display.ts +42 -0
- package/src/workbench/management/extension-install-approval.ts +72 -0
- package/src/workbench/management/format-command-run-state.ts +19 -0
- package/src/workbench/management/index.ts +144 -0
- package/src/workbench/management/integration-command-action.ts +25 -0
- package/src/workbench/management/library-catalog-picker-dialog.css +56 -0
- package/src/workbench/management/library-facet-filter-dialog.css +8 -0
- package/src/workbench/management/management-panel.css +444 -0
- package/src/workbench/management/management.css +32 -0
- package/src/workbench/management/types.ts +139 -0
- package/src/workbench/management/useWorkbenchNotify.ts +10 -0
- package/src/workbench/{MarkdownPreview.tsx → markdown/MarkdownPreview.tsx} +26 -15
- package/src/workbench/markdown/markdownRemarkPlugins.ts +12 -0
- package/src/workbench/markdown/sanitizeMarkdownHref.ts +29 -0
- package/src/workbench/schema/index.ts +0 -1
- package/src/workbench/settings/NavigationPanel.tsx +41 -2
- package/src/workbench/settings/SchemaForm.tsx +20 -7
- package/src/workbench/settings/SectionTabPanel.tsx +172 -0
- package/src/workbench/settings/SectionedPanel.tsx +40 -286
- package/src/workbench/settings/StructuredDataForm.tsx +106 -26
- package/src/workbench/settings/StructuredDataSchemaPanel.tsx +345 -93
- package/src/workbench/settings/StructuredDataTableView.tsx +2 -2
- package/src/workbench/settings/WorkbenchPanelRegion.tsx +1 -1
- package/src/workbench/settings/WorkbenchSettingsModal.tsx +116 -62
- package/src/workbench/settings/WorkbenchSettingsNav.tsx +3 -3
- package/src/workbench/settings/extensionSettingsForm.ts +34 -0
- package/src/workbench/settings/index.ts +36 -1
- package/src/workbench/settings/navigation-panel.css +59 -0
- package/src/workbench/settings/panel-region.css +3 -2
- package/src/workbench/settings/schema-form.css +36 -0
- package/src/workbench/settings/schemaFormSettingSpec.ts +177 -0
- package/src/workbench/settings/schemaFormSettingsCategory.tsx +21 -0
- package/src/workbench/settings/section-tab-panel.css +157 -0
- package/src/workbench/settings/sectionScrollSpyDom.ts +139 -0
- package/src/workbench/settings/sectioned-panel.css +162 -0
- package/src/workbench/settings/sectionedPanelScrollSpy.ts +158 -28
- package/src/workbench/settings/settings-responsive.css +58 -0
- package/src/workbench/settings/settings.css +11 -0
- package/src/workbench/settings/settingsCommit.tsx +55 -0
- package/src/workbench/settings/structured-data-form.css +114 -0
- package/src/workbench/settings/structured-data-schema-panel.css +33 -19
- package/src/workbench/settings/structuredDataFormModel.ts +140 -0
- package/src/workbench/settings/structuredDataSchema.ts +111 -658
- package/src/workbench/settings/structuredDataSchemaDate.ts +197 -0
- package/src/workbench/settings/structuredDataSchemaField.ts +105 -0
- package/src/workbench/settings/structuredDataSchemaSection.ts +74 -0
- package/src/workbench/settings/structuredDataSchemaTable.ts +120 -0
- package/src/workbench/settings/structuredDataSchemaTypes.ts +308 -0
- package/src/workbench/settings/structuredDataSchemaValidation.ts +166 -0
- package/src/workbench/settings/useSectionScrollSpy.ts +420 -0
- package/src/workbench/settings/workbench-settings-modal.css +273 -0
- package/src/workbench/shell/ActivityBar.tsx +159 -0
- package/src/workbench/{ArtifactShell.tsx → shell/ArtifactShell.tsx} +30 -30
- package/src/workbench/shell/SplitView.tsx +485 -0
- package/src/workbench/{StatusBar.tsx → shell/StatusBar.tsx} +10 -8
- package/src/workbench/{StructuredArtifactEditor.tsx → shell/StructuredArtifactEditor.tsx} +9 -9
- package/src/workbench/{Timeline.tsx → shell/Timeline.tsx} +19 -24
- package/src/workbench/shell/WorkbenchCanvasShell.defaults.ts +106 -0
- package/src/workbench/shell/WorkbenchCanvasShell.model.ts +46 -0
- package/src/workbench/{WorkbenchCanvasShell.tsx → shell/WorkbenchCanvasShell.tsx} +34 -148
- package/src/workbench/shell/WorkbenchDesktopTitleBar.tsx +126 -0
- package/src/workbench/shell/WorkbenchShell.tsx +192 -0
- package/src/workbench/shell/WorkbenchShellTitleBarLayoutControls.tsx +80 -0
- package/src/workbench/shell/WorkbenchStandaloneShell.tsx +604 -0
- package/src/workbench/shell/WorkbenchViewEditor.tsx +75 -0
- package/src/workbench/shell/WorkbenchViewSidebar.tsx +85 -0
- package/src/workbench/shell/WorkbenchWindowChromeControls.tsx +293 -0
- package/src/workbench/shell/activity-bar.css +245 -0
- package/src/workbench/shell/activityBarOrder.ts +98 -0
- package/src/workbench/shell/appearanceLabels.ts +28 -0
- package/src/workbench/shell/confirmation-flow.css +87 -0
- package/src/workbench/shell/hardReset.ts +64 -0
- package/src/workbench/shell/index.css +5 -0
- package/src/workbench/shell/shell.ts +152 -0
- package/src/workbench/shell/shellPresets.ts +36 -0
- package/src/workbench/{shellState.ts → shell/shellState.ts} +16 -23
- package/src/workbench/shell/shellViewModel.ts +160 -0
- package/src/workbench/shell/sidebarViewPlacementDnd.ts +61 -0
- package/src/workbench/shell/split-view.css +188 -0
- package/src/workbench/{standalone.ts → shell/standalone.ts} +11 -11
- package/src/workbench/shell/status-bar.css +141 -0
- package/src/workbench/{status.ts → shell/status.ts} +10 -6
- package/src/workbench/shell/useDeferredWorkbenchMount.ts +71 -0
- package/src/workbench/shell/useWorkbenchAppearanceDocumentSync.tsx +17 -0
- package/src/workbench/shell/useWorkbenchSidebarActionBarDnd.ts +227 -0
- package/src/workbench/shell/useWorkbenchSidebarLayout.tsx +232 -0
- package/src/workbench/shell/useWorkbenchSidebarViewPlacementDropZone.ts +194 -0
- package/src/workbench/shell/useWorkbenchStandaloneShellStateSync.tsx +112 -0
- package/src/workbench/shell/workbenchSidebarLayoutContext.ts +46 -0
- package/src/workbench/shell/workbenchStandaloneShellReactContext.tsx +80 -0
- package/src/workbench/shell/workbenchViewRouteState.ts +151 -0
- package/src/workbench/theme/WorkbenchThemeProvider.tsx +142 -0
- package/src/workbench/{theme.ts → theme/theme.ts} +9 -3
- package/src/workbench/theme/themePresets.ts +192 -0
- package/src/workbench/views/action-list.css +144 -0
- package/src/workbench/views/artifact-preview.css +184 -0
- package/src/workbench/views/command-inspector.css +98 -0
- package/src/workbench/views/command-list.css +356 -0
- package/src/workbench/views/commands-sidebar.css +51 -0
- package/src/workbench/views/extensions-sidebar.css +175 -0
- package/src/workbench/views/multi-provider-explorer.css +182 -0
- package/src/workbench/views/search.css +10 -0
- package/src/workbench/views/timeline.css +239 -0
- package/src/workbench/views/view-hosts.css +37 -0
- package/src/workbench/views/view-sidebar.css +21 -0
- package/src/workbench/views/views.css +12 -0
- package/src/workbench/widgets/widget-tree.css +598 -0
- package/src/workbench/widgets/widgets.css +2 -0
- package/src/workbench/workspace/WorkspaceDraftsContext.tsx +59 -71
- package/src/workbench/workspace/WorkspaceEditor.tsx +27 -123
- package/src/workbench/workspace/WorkspaceEditorPanel.tsx +68 -9
- package/src/workbench/workspace/WorkspaceExplorer.tsx +252 -53
- package/src/workbench/workspace/WorkspaceExplorerPanel.tsx +73 -0
- package/src/workbench/workspace/WorkspaceFileIcon.tsx +4 -160
- package/src/workbench/workspace/WorkspacePathLabel.tsx +42 -0
- package/src/workbench/workspace/WorkspaceSearchPanel.tsx +18 -15
- package/src/workbench/workspace/WorkspaceSearchResults.tsx +6 -2
- package/src/workbench/workspace/build-workspace-explorer-nodes.ts +44 -0
- package/src/workbench/workspace/createVirtualWorkspaceExplorerPort.ts +141 -0
- package/src/workbench/workspace/explorer-tree-style.ts +18 -0
- package/src/workbench/workspace/index.ts +45 -32
- package/src/workbench/workspace/json-config-workbench.css +57 -0
- package/src/workbench/workspace/monaco-panel.css +71 -0
- package/src/workbench/workspace/path.ts +2 -0
- package/src/workbench/workspace/useWorkspaceExplorerController.ts +490 -0
- package/src/workbench/workspace/workspace-editor.css +235 -0
- package/src/workbench/workspace/workspace-explorer-panel.css +33 -0
- package/src/workbench/workspace/workspace.css +5 -0
- package/src/workbench/workspace/workspaceExplorerController.ts +193 -0
- package/src/workbench/workspace/workspaceExplorerKeyboard.ts +109 -0
- package/src/workbench/workspace/workspaceJsonDiagnostics.ts +8 -7
- package/src/workbench-menu-surfaces.css +57 -0
- package/src/jdw/builtins/renderBuiltinWidgetNode.tsx +0 -126
- package/src/layout/SideBarViewFrame.tsx +0 -367
- package/src/primitives/Checkbox.tsx +0 -21
- package/src/primitives/NumberInput.tsx +0 -38
- package/src/primitives/ScrollArea.tsx +0 -42
- package/src/primitives/Select.tsx +0 -1
- package/src/primitives/StatusBar.tsx +0 -46
- package/src/primitives/WorkbenchChrome.tsx +0 -424
- package/src/workbench/ActivityBar.tsx +0 -52
- package/src/workbench/CommandPalette.tsx +0 -819
- package/src/workbench/SplitView.tsx +0 -136
- package/src/workbench/WorkbenchShell.tsx +0 -74
- package/src/workbench/WorkbenchStandaloneShell.tsx +0 -318
- package/src/workbench/shell.ts +0 -15
- package/src/workbench/workspace/MultiProviderExplorer.tsx +0 -625
- /package/src/workbench/{keyboard.ts → commands/keyboard.ts} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# `@workbench-kit/react`
|
|
2
|
+
|
|
3
|
+
React primitives and workbench chrome for integrating hosts (browser, desktop
|
|
4
|
+
shells, and other React hosts).
|
|
5
|
+
|
|
6
|
+
Published on npm with the **`prototype`** dist tag.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```powershell
|
|
11
|
+
pnpm add @workbench-kit/react@prototype @workbench-kit/tokens@prototype
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Peer: React 19.
|
|
15
|
+
|
|
16
|
+
## Styles
|
|
17
|
+
|
|
18
|
+
Import once at app entry:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import '@workbench-kit/tokens/styles.css';
|
|
22
|
+
import '@workbench-kit/react/styles.css';
|
|
23
|
+
import '@workbench-kit/react/primitives.css';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { WorkbenchShell } from '@workbench-kit/react/workbench/shell';
|
|
30
|
+
|
|
31
|
+
export function AppShell() {
|
|
32
|
+
return (
|
|
33
|
+
<div className="ui-workbench-host-root" style={{ height: '100vh' }}>
|
|
34
|
+
<WorkbenchShell
|
|
35
|
+
activityBar={{
|
|
36
|
+
items: [
|
|
37
|
+
{ id: 'explorer', icon: <i className="codicon codicon-files" />, label: 'Explorer' },
|
|
38
|
+
],
|
|
39
|
+
}}
|
|
40
|
+
rootClassName="ide-root"
|
|
41
|
+
secondaryArea={<main>Editor region</main>}
|
|
42
|
+
statusSections={[]}
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Full walkthrough: [Getting Started](../../docs/guides/getting-started.md).
|
|
50
|
+
|
|
51
|
+
## Common subpaths
|
|
52
|
+
|
|
53
|
+
| Subpath | Purpose |
|
|
54
|
+
| ------------------------------------------ | --------------------------------------- |
|
|
55
|
+
| `@workbench-kit/react/primitives` | Buttons, editor chrome, library layouts |
|
|
56
|
+
| `@workbench-kit/react/workbench/shell` | Workbench shell / activity bar |
|
|
57
|
+
| `@workbench-kit/react/workbench/workspace` | Explorer, workspace editor panel |
|
|
58
|
+
| `@workbench-kit/react/workbench/chat` | Chat panel and message surfaces |
|
|
59
|
+
| `@workbench-kit/react/overlay` | Context menus, anchored overlays |
|
|
60
|
+
| `@workbench-kit/react/modal` | Low-level modal frame |
|
|
61
|
+
| `@workbench-kit/react/jdw` | JDW preview bridges |
|
|
62
|
+
| `@workbench-kit/react/styles.css` | Shell chrome CSS |
|
|
63
|
+
|
|
64
|
+
Import **only** through `exports`. Do not deep-import `src/` paths.
|
|
65
|
+
|
|
66
|
+
## Learn more
|
|
67
|
+
|
|
68
|
+
| Doc | Purpose |
|
|
69
|
+
| ---------------------------------------------------------------------- | ----------------------------- |
|
|
70
|
+
| [Getting Started](../../docs/guides/getting-started.md) | Install + minimal shell |
|
|
71
|
+
| [Component Map](../../docs/guides/component-map.md) | Surface → Storybook / sample |
|
|
72
|
+
| [Sample Screens](../../docs/guides/sample-screens.md) | Example screen recipes |
|
|
73
|
+
| [Consumer Capabilities](../../docs/workbench/consumer-capabilities.md) | Props / when-to-use contracts |
|
|
74
|
+
| [API Reference](../../docs/guides/api-reference.md) | Package export index |
|
|
75
|
+
|
|
76
|
+
## Local verification (this monorepo)
|
|
77
|
+
|
|
78
|
+
```powershell
|
|
79
|
+
pnpm install
|
|
80
|
+
pnpm build:workbench-extensions
|
|
81
|
+
pnpm dev
|
|
82
|
+
pnpm dev:storybook
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Storybook stays a curated set of interaction stories — not a full package gallery.
|
|
86
|
+
Demo and story modules under this package are for development; published consumers
|
|
87
|
+
rely on the `exports` map and CSS entry points above.
|
package/package.json
CHANGED
|
@@ -1,39 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workbench-kit/react",
|
|
3
|
-
"version": "0.0.2-prototype.0.
|
|
3
|
+
"version": "0.0.2-prototype.0.2.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./src/index.ts",
|
|
8
|
+
"./drag-mime": "./src/utils/dragMime.ts",
|
|
8
9
|
"./modal": "./src/modal/Modal.tsx",
|
|
9
|
-
"./
|
|
10
|
+
"./layout": "./src/layout/index.ts",
|
|
11
|
+
"./editor-tabs": "./src/workbench/editor-tabs/index.ts",
|
|
12
|
+
"./icons": "./src/icons/index.ts",
|
|
13
|
+
"./overlay": "./src/overlay/index.ts",
|
|
14
|
+
"./brand": "./src/brand/index.ts",
|
|
10
15
|
"./primitives": "./src/primitives/index.ts",
|
|
11
16
|
"./primitives.css": "./src/primitives/styles.css",
|
|
12
17
|
"./workbench/auth": "./src/workbench/auth/index.ts",
|
|
18
|
+
"./workbench/bootstrap": "./src/workbench/bootstrap/index.ts",
|
|
13
19
|
"./workbench/chat": "./src/workbench/chat/index.ts",
|
|
20
|
+
"./workbench/management": "./src/workbench/management/index.ts",
|
|
14
21
|
"./workbench/settings": "./src/workbench/settings/index.ts",
|
|
15
22
|
"./workbench": "./src/workbench/index.ts",
|
|
16
|
-
"./workbench/
|
|
17
|
-
"./workbench/
|
|
18
|
-
"./workbench/
|
|
23
|
+
"./workbench/activityBarOrder": "./src/workbench/shell/activityBarOrder.ts",
|
|
24
|
+
"./workbench/markdown-preview": "./src/workbench/markdown/MarkdownPreview.tsx",
|
|
25
|
+
"./workbench/shell": "./src/workbench/shell/shell.ts",
|
|
26
|
+
"./workbench/theme-provider": "./src/workbench/theme/WorkbenchThemeProvider.tsx",
|
|
27
|
+
"./workbench/themePresets": "./src/workbench/theme/themePresets.ts",
|
|
28
|
+
"./workbench/split-view": "./src/workbench/shell/SplitView.tsx",
|
|
19
29
|
"./workbench/workspace": "./src/workbench/workspace/index.ts",
|
|
20
30
|
"./workbench/workspace/editor": "./src/workbench/workspace/WorkspaceEditor.tsx",
|
|
21
31
|
"./workbench/workspace/explorer": "./src/workbench/workspace/WorkspaceExplorer.tsx",
|
|
22
|
-
"./workbench/workspace/file-icon": "./src/
|
|
32
|
+
"./workbench/workspace/file-icon": "./src/icons/file-icon.ts",
|
|
33
|
+
"./workbench/commands": "./src/workbench/commands/commands.ts",
|
|
23
34
|
"./jdw": "./src/jdw/index.ts",
|
|
24
35
|
"./jdw/document": "./src/jdw/document.ts",
|
|
25
36
|
"./jdw/parse": "./src/jdw/parse.ts",
|
|
26
37
|
"./jdw/preview": "./src/jdw/JdwPreview.tsx",
|
|
38
|
+
"./jdw/preview-viewport": "./src/jdw/JdwPreviewViewport.tsx",
|
|
27
39
|
"./jdw/samples": "./src/jdw/fixtures/jdw-sample-screens.ts",
|
|
28
|
-
"./
|
|
40
|
+
"./json-config": "./src/json-config/index.ts",
|
|
29
41
|
"./widget-tree": "./src/widget-tree/index.ts",
|
|
30
42
|
"./widget-asset": "./src/widget-asset/index.ts",
|
|
31
43
|
"./widget-studio": "./src/widget-studio/index.ts",
|
|
32
|
-
"./styles.css": "./src/styles.css"
|
|
44
|
+
"./styles.css": "./src/styles.css",
|
|
45
|
+
"./workbench-menu-surfaces.css": "./src/workbench-menu-surfaces.css"
|
|
33
46
|
},
|
|
34
47
|
"files": [
|
|
35
48
|
"src",
|
|
36
49
|
"!src/workbench/demo",
|
|
50
|
+
"!src/workbench/story",
|
|
37
51
|
"!src/**/*.test.ts",
|
|
38
52
|
"!src/**/*.test.tsx",
|
|
39
53
|
"!src/**/*.stories.ts",
|
|
@@ -42,28 +56,23 @@
|
|
|
42
56
|
"dependencies": {
|
|
43
57
|
"@dnd-kit/core": "^6.3.1",
|
|
44
58
|
"@vscode/codicons": "^0.0.45",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"@workbench-kit/
|
|
48
|
-
"@workbench-kit/
|
|
49
|
-
"@workbench-kit/
|
|
50
|
-
"@workbench-kit/
|
|
51
|
-
"@workbench-kit/
|
|
52
|
-
"@workbench-kit/
|
|
59
|
+
"remark-gfm": "^4.0.1",
|
|
60
|
+
"rehype-sanitize": "^6.0.0",
|
|
61
|
+
"@workbench-kit/adapters": "0.0.2-prototype.0.2.11",
|
|
62
|
+
"@workbench-kit/monaco": "0.0.2-prototype.0.2.11",
|
|
63
|
+
"@workbench-kit/contracts": "0.0.2-prototype.0.2.11",
|
|
64
|
+
"@workbench-kit/platform": "0.0.2-prototype.0.2.11",
|
|
65
|
+
"@workbench-kit/runtime": "0.0.2-prototype.0.2.11",
|
|
66
|
+
"@workbench-kit/services": "0.0.2-prototype.0.2.11",
|
|
67
|
+
"@workbench-kit/tokens": "0.0.2-prototype.0.2.11",
|
|
68
|
+
"@workbench-kit/workspace": "0.0.2-prototype.0.2.11",
|
|
69
|
+
"@workbench-kit/jdw": "0.0.2-prototype.0.2.11"
|
|
53
70
|
},
|
|
54
71
|
"peerDependencies": {
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"react-markdown": "^10.1.0",
|
|
58
|
-
"react": "^19.0.0"
|
|
72
|
+
"react": "^19.0.0",
|
|
73
|
+
"react-markdown": "^10.1.0"
|
|
59
74
|
},
|
|
60
75
|
"peerDependenciesMeta": {
|
|
61
|
-
"@monaco-editor/react": {
|
|
62
|
-
"optional": true
|
|
63
|
-
},
|
|
64
|
-
"monaco-editor": {
|
|
65
|
-
"optional": true
|
|
66
|
-
},
|
|
67
76
|
"react-markdown": {
|
|
68
77
|
"optional": true
|
|
69
78
|
}
|
|
@@ -81,6 +90,7 @@
|
|
|
81
90
|
},
|
|
82
91
|
"scripts": {
|
|
83
92
|
"test": "pnpm exec vitest run --config ../../vitest.config.ts src/widget-tree",
|
|
84
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
93
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
94
|
+
"typecheck:exact-optional": "tsc -p typecheck-exact-optional/tsconfig.emit.json && tsc -p typecheck-exact-optional/tsconfig.json --noEmit"
|
|
85
95
|
}
|
|
86
96
|
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { useId, type SVGProps } from 'react';
|
|
2
|
+
import { cx } from '../utils/cx';
|
|
3
|
+
import {
|
|
4
|
+
TILEPAPER_ICON_CANVAS,
|
|
5
|
+
TILEPAPER_ICON_GRADIENTS,
|
|
6
|
+
TILEPAPER_ICON_GRID,
|
|
7
|
+
TILEPAPER_ICON_ROOT_ELEVATION,
|
|
8
|
+
TILEPAPER_ICON_ROOT_PANEL,
|
|
9
|
+
TILEPAPER_ICON_TILES,
|
|
10
|
+
tilepaperPaperFoldPaths,
|
|
11
|
+
} from './tilepaper-app-icon-geometry.js';
|
|
12
|
+
|
|
13
|
+
export type TilepaperAppIconProps = Omit<SVGProps<SVGSVGElement>, 'viewBox'> & {
|
|
14
|
+
/** Flat rendering for small surfaces (e.g. titlebar) where elevation blur reads muddy. */
|
|
15
|
+
compact?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function TilepaperAppIcon({ className, compact = false, ...props }: TilepaperAppIconProps) {
|
|
19
|
+
const idPrefix = `tilepaper-icon-${useId().replace(/:/g, '')}`;
|
|
20
|
+
const bgId = `${idPrefix}-bg`;
|
|
21
|
+
const panelId = `${idPrefix}-panel`;
|
|
22
|
+
const elevationId = `${idPrefix}-elevation`;
|
|
23
|
+
const blueId = `${idPrefix}-blue`;
|
|
24
|
+
const paperId = `${idPrefix}-paper`;
|
|
25
|
+
const tealId = `${idPrefix}-teal`;
|
|
26
|
+
const violetId = `${idPrefix}-violet`;
|
|
27
|
+
const { tileRx, tileSize } = TILEPAPER_ICON_GRID;
|
|
28
|
+
const fold = tilepaperPaperFoldPaths(
|
|
29
|
+
TILEPAPER_ICON_TILES.paper.x,
|
|
30
|
+
TILEPAPER_ICON_TILES.paper.y,
|
|
31
|
+
tileSize,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<svg
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
className={cx('tilepaper-app-icon', className)}
|
|
38
|
+
fill="none"
|
|
39
|
+
viewBox={`0 0 ${TILEPAPER_ICON_CANVAS.size} ${TILEPAPER_ICON_CANVAS.size}`}
|
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
<defs>
|
|
44
|
+
{compact ? null : (
|
|
45
|
+
<filter
|
|
46
|
+
id={elevationId}
|
|
47
|
+
x="-12%"
|
|
48
|
+
y="-8%"
|
|
49
|
+
width="124%"
|
|
50
|
+
height="128%"
|
|
51
|
+
colorInterpolationFilters="sRGB"
|
|
52
|
+
>
|
|
53
|
+
<feDropShadow
|
|
54
|
+
dx="0"
|
|
55
|
+
dy={TILEPAPER_ICON_ROOT_ELEVATION.dy}
|
|
56
|
+
floodColor={TILEPAPER_ICON_ROOT_ELEVATION.floodColor}
|
|
57
|
+
floodOpacity={TILEPAPER_ICON_ROOT_ELEVATION.floodOpacity}
|
|
58
|
+
stdDeviation={TILEPAPER_ICON_ROOT_ELEVATION.stdDeviation}
|
|
59
|
+
/>
|
|
60
|
+
</filter>
|
|
61
|
+
)}
|
|
62
|
+
<linearGradient
|
|
63
|
+
id={bgId}
|
|
64
|
+
x1={TILEPAPER_ICON_GRADIENTS.bg.x1}
|
|
65
|
+
x2={TILEPAPER_ICON_GRADIENTS.bg.x2}
|
|
66
|
+
y1={TILEPAPER_ICON_GRADIENTS.bg.y1}
|
|
67
|
+
y2={TILEPAPER_ICON_GRADIENTS.bg.y2}
|
|
68
|
+
gradientUnits="userSpaceOnUse"
|
|
69
|
+
>
|
|
70
|
+
<stop offset="0" stopColor="#0A1020" />
|
|
71
|
+
<stop offset="1" stopColor="#121C33" />
|
|
72
|
+
</linearGradient>
|
|
73
|
+
<linearGradient
|
|
74
|
+
id={panelId}
|
|
75
|
+
x1={TILEPAPER_ICON_GRADIENTS.panel.x1}
|
|
76
|
+
x2={TILEPAPER_ICON_GRADIENTS.panel.x2}
|
|
77
|
+
y1={TILEPAPER_ICON_GRADIENTS.panel.y1}
|
|
78
|
+
y2={TILEPAPER_ICON_GRADIENTS.panel.y2}
|
|
79
|
+
gradientUnits="userSpaceOnUse"
|
|
80
|
+
>
|
|
81
|
+
<stop offset="0" stopColor="#1A2C4D" />
|
|
82
|
+
<stop offset="0.42" stopColor="#162844" />
|
|
83
|
+
<stop offset="1" stopColor="#111D35" />
|
|
84
|
+
</linearGradient>
|
|
85
|
+
<linearGradient
|
|
86
|
+
id={blueId}
|
|
87
|
+
x1={TILEPAPER_ICON_GRADIENTS.blue.x1}
|
|
88
|
+
x2={TILEPAPER_ICON_GRADIENTS.blue.x2}
|
|
89
|
+
y1={TILEPAPER_ICON_GRADIENTS.blue.y1}
|
|
90
|
+
y2={TILEPAPER_ICON_GRADIENTS.blue.y2}
|
|
91
|
+
gradientUnits="userSpaceOnUse"
|
|
92
|
+
>
|
|
93
|
+
<stop offset="0" stopColor="#5D88FF" />
|
|
94
|
+
<stop offset="1" stopColor="#3158D6" />
|
|
95
|
+
</linearGradient>
|
|
96
|
+
<linearGradient
|
|
97
|
+
id={paperId}
|
|
98
|
+
x1={TILEPAPER_ICON_GRADIENTS.paper.x1}
|
|
99
|
+
x2={TILEPAPER_ICON_GRADIENTS.paper.x2}
|
|
100
|
+
y1={TILEPAPER_ICON_GRADIENTS.paper.y1}
|
|
101
|
+
y2={TILEPAPER_ICON_GRADIENTS.paper.y2}
|
|
102
|
+
gradientUnits="userSpaceOnUse"
|
|
103
|
+
>
|
|
104
|
+
<stop offset="0" stopColor="#FFF9EE" />
|
|
105
|
+
<stop offset="1" stopColor="#DDD9D1" />
|
|
106
|
+
</linearGradient>
|
|
107
|
+
<linearGradient
|
|
108
|
+
id={tealId}
|
|
109
|
+
x1={TILEPAPER_ICON_GRADIENTS.teal.x1}
|
|
110
|
+
x2={TILEPAPER_ICON_GRADIENTS.teal.x2}
|
|
111
|
+
y1={TILEPAPER_ICON_GRADIENTS.teal.y1}
|
|
112
|
+
y2={TILEPAPER_ICON_GRADIENTS.teal.y2}
|
|
113
|
+
gradientUnits="userSpaceOnUse"
|
|
114
|
+
>
|
|
115
|
+
<stop offset="0" stopColor="#2FD6C1" />
|
|
116
|
+
<stop offset="1" stopColor="#149685" />
|
|
117
|
+
</linearGradient>
|
|
118
|
+
<linearGradient
|
|
119
|
+
id={violetId}
|
|
120
|
+
x1={TILEPAPER_ICON_GRADIENTS.violet.x1}
|
|
121
|
+
x2={TILEPAPER_ICON_GRADIENTS.violet.x2}
|
|
122
|
+
y1={TILEPAPER_ICON_GRADIENTS.violet.y1}
|
|
123
|
+
y2={TILEPAPER_ICON_GRADIENTS.violet.y2}
|
|
124
|
+
gradientUnits="userSpaceOnUse"
|
|
125
|
+
>
|
|
126
|
+
<stop offset="0" stopColor="#8A67FF" />
|
|
127
|
+
<stop offset="1" stopColor="#5D3AC8" />
|
|
128
|
+
</linearGradient>
|
|
129
|
+
</defs>
|
|
130
|
+
<rect
|
|
131
|
+
width={TILEPAPER_ICON_CANVAS.size}
|
|
132
|
+
height={TILEPAPER_ICON_CANVAS.size}
|
|
133
|
+
rx={TILEPAPER_ICON_CANVAS.rx}
|
|
134
|
+
fill={`url(#${bgId})`}
|
|
135
|
+
/>
|
|
136
|
+
<rect
|
|
137
|
+
filter={compact ? undefined : `url(#${elevationId})`}
|
|
138
|
+
fill={`url(#${panelId})`}
|
|
139
|
+
height={TILEPAPER_ICON_ROOT_PANEL.size}
|
|
140
|
+
rx={TILEPAPER_ICON_ROOT_PANEL.rx}
|
|
141
|
+
width={TILEPAPER_ICON_ROOT_PANEL.size}
|
|
142
|
+
x={TILEPAPER_ICON_ROOT_PANEL.x}
|
|
143
|
+
y={TILEPAPER_ICON_ROOT_PANEL.y}
|
|
144
|
+
/>
|
|
145
|
+
<rect
|
|
146
|
+
x={TILEPAPER_ICON_TILES.blue.x}
|
|
147
|
+
y={TILEPAPER_ICON_TILES.blue.y}
|
|
148
|
+
width={tileSize}
|
|
149
|
+
height={tileSize}
|
|
150
|
+
rx={tileRx}
|
|
151
|
+
fill={`url(#${blueId})`}
|
|
152
|
+
/>
|
|
153
|
+
<rect
|
|
154
|
+
x={TILEPAPER_ICON_TILES.teal.x}
|
|
155
|
+
y={TILEPAPER_ICON_TILES.teal.y}
|
|
156
|
+
width={tileSize}
|
|
157
|
+
height={tileSize}
|
|
158
|
+
rx={tileRx}
|
|
159
|
+
fill={`url(#${tealId})`}
|
|
160
|
+
/>
|
|
161
|
+
<rect
|
|
162
|
+
x={TILEPAPER_ICON_TILES.violet.x}
|
|
163
|
+
y={TILEPAPER_ICON_TILES.violet.y}
|
|
164
|
+
width={tileSize}
|
|
165
|
+
height={tileSize}
|
|
166
|
+
rx={tileRx}
|
|
167
|
+
fill={`url(#${violetId})`}
|
|
168
|
+
/>
|
|
169
|
+
<rect
|
|
170
|
+
x={TILEPAPER_ICON_TILES.paper.x}
|
|
171
|
+
y={TILEPAPER_ICON_TILES.paper.y}
|
|
172
|
+
width={tileSize}
|
|
173
|
+
height={tileSize}
|
|
174
|
+
rx={tileRx}
|
|
175
|
+
fill={`url(#${paperId})`}
|
|
176
|
+
/>
|
|
177
|
+
<path d={fold.highlight} fill="white" fillOpacity="0.92" />
|
|
178
|
+
<path d={fold.shadow} fill="#C9C3B7" fillOpacity="0.74" />
|
|
179
|
+
</svg>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/** Shared workbench app icon layout (1024 canvas, Material-style root surface). */
|
|
2
|
+
export const TILEPAPER_ICON_CANVAS_SIZE = 1024;
|
|
3
|
+
|
|
4
|
+
const REFERENCE_TILE_SIZE = 314;
|
|
5
|
+
/** Unified squircle radius — bumped for a softer, rounder Material feel. */
|
|
6
|
+
const REFERENCE_TILE_RX = 116;
|
|
7
|
+
|
|
8
|
+
/** Base rhythm for canvas → root panel inset. */
|
|
9
|
+
export const TILEPAPER_ICON_SPACING = 48;
|
|
10
|
+
|
|
11
|
+
/** Pulls the motif slightly toward the canvas center (px): wider outer rim, tighter tile grid. */
|
|
12
|
+
export const TILEPAPER_ICON_CENTER_CLUSTER = 8;
|
|
13
|
+
|
|
14
|
+
/** Ambient backdrop around the elevated root surface. */
|
|
15
|
+
export const TILEPAPER_ICON_CANVAS_MARGIN =
|
|
16
|
+
TILEPAPER_ICON_SPACING + TILEPAPER_ICON_CENTER_CLUSTER / 2;
|
|
17
|
+
|
|
18
|
+
/** Inset of the 4 tiles inside the root surface. */
|
|
19
|
+
export const TILEPAPER_ICON_GRID_MARGIN = TILEPAPER_ICON_SPACING - TILEPAPER_ICON_CENTER_CLUSTER;
|
|
20
|
+
export const TILEPAPER_ICON_GRID_GAP = TILEPAPER_ICON_SPACING - TILEPAPER_ICON_CENTER_CLUSTER;
|
|
21
|
+
|
|
22
|
+
/** Material-style elevation for the root surface panel. */
|
|
23
|
+
export const TILEPAPER_ICON_ROOT_ELEVATION = {
|
|
24
|
+
dy: 8,
|
|
25
|
+
floodColor: '#020617',
|
|
26
|
+
floodOpacity: 0.42,
|
|
27
|
+
stdDeviation: 12,
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
const TILE_GRADIENT_OFFSETS = {
|
|
31
|
+
x1: 20,
|
|
32
|
+
x2: 250,
|
|
33
|
+
y1: 22,
|
|
34
|
+
y2: 262,
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
const panelSize = TILEPAPER_ICON_CANVAS_SIZE - TILEPAPER_ICON_CANVAS_MARGIN * 2;
|
|
38
|
+
const panelX = TILEPAPER_ICON_CANVAS_MARGIN;
|
|
39
|
+
const panelY = TILEPAPER_ICON_CANVAS_MARGIN;
|
|
40
|
+
const tileSize = (panelSize - TILEPAPER_ICON_GRID_MARGIN * 2 - TILEPAPER_ICON_GRID_GAP) / 2;
|
|
41
|
+
|
|
42
|
+
/** Same absolute corner radius on every rounded rect (matches the 4 tiles). */
|
|
43
|
+
export const TILEPAPER_ICON_UNIFIED_RX = REFERENCE_TILE_RX;
|
|
44
|
+
|
|
45
|
+
const panelRx = TILEPAPER_ICON_UNIFIED_RX;
|
|
46
|
+
const tileRx = TILEPAPER_ICON_UNIFIED_RX;
|
|
47
|
+
const tileOrigin = panelX + TILEPAPER_ICON_GRID_MARGIN;
|
|
48
|
+
|
|
49
|
+
const gradientOffsetScale = tileSize / REFERENCE_TILE_SIZE;
|
|
50
|
+
const gradientOffsets = {
|
|
51
|
+
x1: Math.round(TILE_GRADIENT_OFFSETS.x1 * gradientOffsetScale),
|
|
52
|
+
x2: Math.round(TILE_GRADIENT_OFFSETS.x2 * gradientOffsetScale),
|
|
53
|
+
y1: Math.round(TILE_GRADIENT_OFFSETS.y1 * gradientOffsetScale),
|
|
54
|
+
y2: Math.round(TILE_GRADIENT_OFFSETS.y2 * gradientOffsetScale),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const TILEPAPER_ICON_CANVAS = {
|
|
58
|
+
size: TILEPAPER_ICON_CANVAS_SIZE,
|
|
59
|
+
rx: TILEPAPER_ICON_UNIFIED_RX,
|
|
60
|
+
} as const;
|
|
61
|
+
|
|
62
|
+
/** Material root surface — the primary app panel sitting above the backdrop. */
|
|
63
|
+
export const TILEPAPER_ICON_ROOT_PANEL = {
|
|
64
|
+
x: panelX,
|
|
65
|
+
y: panelY,
|
|
66
|
+
size: panelSize,
|
|
67
|
+
rx: panelRx,
|
|
68
|
+
} as const;
|
|
69
|
+
|
|
70
|
+
export const TILEPAPER_ICON_GRID = {
|
|
71
|
+
margin: TILEPAPER_ICON_GRID_MARGIN,
|
|
72
|
+
gap: TILEPAPER_ICON_GRID_GAP,
|
|
73
|
+
tileSize,
|
|
74
|
+
tileRx,
|
|
75
|
+
} as const;
|
|
76
|
+
|
|
77
|
+
export const TILEPAPER_ICON_TILES = {
|
|
78
|
+
blue: { x: tileOrigin, y: tileOrigin },
|
|
79
|
+
paper: { x: tileOrigin + tileSize + TILEPAPER_ICON_GRID_GAP, y: tileOrigin },
|
|
80
|
+
teal: { x: tileOrigin, y: tileOrigin + tileSize + TILEPAPER_ICON_GRID_GAP },
|
|
81
|
+
violet: {
|
|
82
|
+
x: tileOrigin + tileSize + TILEPAPER_ICON_GRID_GAP,
|
|
83
|
+
y: tileOrigin + tileSize + TILEPAPER_ICON_GRID_GAP,
|
|
84
|
+
},
|
|
85
|
+
} as const;
|
|
86
|
+
|
|
87
|
+
export function tilepaperRootElevationFilterMarkup(filterId = 'root-elevation'): string {
|
|
88
|
+
const { dy, floodColor, floodOpacity, stdDeviation } = TILEPAPER_ICON_ROOT_ELEVATION;
|
|
89
|
+
|
|
90
|
+
return `<filter id="${filterId}" x="-12%" y="-8%" width="124%" height="128%" color-interpolation-filters="sRGB">
|
|
91
|
+
<feDropShadow dx="0" dy="${dy}" stdDeviation="${stdDeviation}" flood-color="${floodColor}" flood-opacity="${floodOpacity}" />
|
|
92
|
+
</filter>`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Scale fold geometry from the original 286px tile art. */
|
|
96
|
+
export function tilepaperPaperFoldPaths(paperX: number, paperY: number, tileSizePx: number) {
|
|
97
|
+
const scale = tileSizePx / 286;
|
|
98
|
+
const inset = Math.round(84 * scale);
|
|
99
|
+
const foldStart = Math.round(88 * scale);
|
|
100
|
+
const shadowStart = Math.round(103 * scale);
|
|
101
|
+
const curveOffset = Math.round(37.608 * scale);
|
|
102
|
+
|
|
103
|
+
const right = paperX + tileSizePx;
|
|
104
|
+
const foldX = right - foldStart;
|
|
105
|
+
const shadowX = right - shadowStart;
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
highlight: `M${foldX} ${paperY}H${foldX + 4}C${right - curveOffset} ${paperY} ${right} ${paperY + curveOffset} ${right} ${paperY + inset}V${paperY + inset + 4}L${foldX} ${paperY}Z`,
|
|
109
|
+
shadow: `M${shadowX} ${paperY}H${foldX}L${right} ${paperY + inset}V${paperY + shadowStart}L${shadowX} ${paperY}Z`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const panelGradientInset = 18;
|
|
114
|
+
|
|
115
|
+
export const TILEPAPER_ICON_GRADIENTS = {
|
|
116
|
+
/** Dark ambient behind the elevated root surface. */
|
|
117
|
+
bg: { x1: 512, x2: 512, y1: 72, y2: 952 },
|
|
118
|
+
/** Material surface — slightly brighter toward the top edge. */
|
|
119
|
+
panel: {
|
|
120
|
+
x1: 512,
|
|
121
|
+
x2: 512,
|
|
122
|
+
y1: panelY + panelGradientInset,
|
|
123
|
+
y2: panelY + panelSize - panelGradientInset,
|
|
124
|
+
},
|
|
125
|
+
blue: {
|
|
126
|
+
x1: TILEPAPER_ICON_TILES.blue.x + gradientOffsets.x1,
|
|
127
|
+
x2: TILEPAPER_ICON_TILES.blue.x + gradientOffsets.x2,
|
|
128
|
+
y1: TILEPAPER_ICON_TILES.blue.y + gradientOffsets.y1,
|
|
129
|
+
y2: TILEPAPER_ICON_TILES.blue.y + gradientOffsets.y2,
|
|
130
|
+
},
|
|
131
|
+
paper: {
|
|
132
|
+
x1: 512 + (512 - (TILEPAPER_ICON_TILES.blue.x + gradientOffsets.x2)),
|
|
133
|
+
x2: 512 + (512 - (TILEPAPER_ICON_TILES.blue.x + gradientOffsets.x1)),
|
|
134
|
+
y1: TILEPAPER_ICON_TILES.blue.y + gradientOffsets.y1,
|
|
135
|
+
y2: TILEPAPER_ICON_TILES.blue.y + gradientOffsets.y2,
|
|
136
|
+
},
|
|
137
|
+
teal: {
|
|
138
|
+
x1: TILEPAPER_ICON_TILES.blue.x + gradientOffsets.x1,
|
|
139
|
+
x2: TILEPAPER_ICON_TILES.blue.x + gradientOffsets.x2,
|
|
140
|
+
y1: 512 + (512 - (TILEPAPER_ICON_TILES.blue.y + gradientOffsets.y2)),
|
|
141
|
+
y2: 512 + (512 - (TILEPAPER_ICON_TILES.blue.y + gradientOffsets.y1)),
|
|
142
|
+
},
|
|
143
|
+
violet: {
|
|
144
|
+
x1: 512 + (512 - (TILEPAPER_ICON_TILES.blue.x + gradientOffsets.x2)),
|
|
145
|
+
x2: 512 + (512 - (TILEPAPER_ICON_TILES.blue.x + gradientOffsets.x1)),
|
|
146
|
+
y1: 512 + (512 - (TILEPAPER_ICON_TILES.blue.y + gradientOffsets.y2)),
|
|
147
|
+
y2: 512 + (512 - (TILEPAPER_ICON_TILES.blue.y + gradientOffsets.y1)),
|
|
148
|
+
},
|
|
149
|
+
} as const;
|
|
150
|
+
|
|
151
|
+
/** Static favicon snapshot (keep in sync with geometry helpers above). */
|
|
152
|
+
export function renderTilepaperAppIconSvgMarkup(): string {
|
|
153
|
+
const fold = tilepaperPaperFoldPaths(
|
|
154
|
+
TILEPAPER_ICON_TILES.paper.x,
|
|
155
|
+
TILEPAPER_ICON_TILES.paper.y,
|
|
156
|
+
TILEPAPER_ICON_GRID.tileSize,
|
|
157
|
+
);
|
|
158
|
+
const { bg, panel, blue, paper, teal, violet } = TILEPAPER_ICON_GRADIENTS;
|
|
159
|
+
const { tileSize: t, tileRx: tr } = TILEPAPER_ICON_GRID;
|
|
160
|
+
const root = TILEPAPER_ICON_ROOT_PANEL;
|
|
161
|
+
|
|
162
|
+
return `<svg fill="none" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
|
163
|
+
<defs>
|
|
164
|
+
${tilepaperRootElevationFilterMarkup('root-elevation')}
|
|
165
|
+
<linearGradient id="bg" x1="${bg.x1}" x2="${bg.x2}" y1="${bg.y1}" y2="${bg.y2}" gradientUnits="userSpaceOnUse">
|
|
166
|
+
<stop offset="0" stop-color="#0A1020" />
|
|
167
|
+
<stop offset="1" stop-color="#121C33" />
|
|
168
|
+
</linearGradient>
|
|
169
|
+
<linearGradient id="panel" x1="${panel.x1}" x2="${panel.x2}" y1="${panel.y1}" y2="${panel.y2}" gradientUnits="userSpaceOnUse">
|
|
170
|
+
<stop offset="0" stop-color="#1A2C4D" />
|
|
171
|
+
<stop offset="0.42" stop-color="#162844" />
|
|
172
|
+
<stop offset="1" stop-color="#111D35" />
|
|
173
|
+
</linearGradient>
|
|
174
|
+
<linearGradient id="blue" x1="${blue.x1}" x2="${blue.x2}" y1="${blue.y1}" y2="${blue.y2}" gradientUnits="userSpaceOnUse">
|
|
175
|
+
<stop offset="0" stop-color="#5D88FF" />
|
|
176
|
+
<stop offset="1" stop-color="#3158D6" />
|
|
177
|
+
</linearGradient>
|
|
178
|
+
<linearGradient id="paper" x1="${paper.x1}" x2="${paper.x2}" y1="${paper.y1}" y2="${paper.y2}" gradientUnits="userSpaceOnUse">
|
|
179
|
+
<stop offset="0" stop-color="#FFF9EE" />
|
|
180
|
+
<stop offset="1" stop-color="#DDD9D1" />
|
|
181
|
+
</linearGradient>
|
|
182
|
+
<linearGradient id="teal" x1="${teal.x1}" x2="${teal.x2}" y1="${teal.y1}" y2="${teal.y2}" gradientUnits="userSpaceOnUse">
|
|
183
|
+
<stop offset="0" stop-color="#2FD6C1" />
|
|
184
|
+
<stop offset="1" stop-color="#149685" />
|
|
185
|
+
</linearGradient>
|
|
186
|
+
<linearGradient id="violet" x1="${violet.x1}" x2="${violet.x2}" y1="${violet.y1}" y2="${violet.y2}" gradientUnits="userSpaceOnUse">
|
|
187
|
+
<stop offset="0" stop-color="#8A67FF" />
|
|
188
|
+
<stop offset="1" stop-color="#5D3AC8" />
|
|
189
|
+
</linearGradient>
|
|
190
|
+
</defs>
|
|
191
|
+
<rect width="${TILEPAPER_ICON_CANVAS.size}" height="${TILEPAPER_ICON_CANVAS.size}" rx="${TILEPAPER_ICON_CANVAS.rx}" fill="url(#bg)" />
|
|
192
|
+
<rect x="${root.x}" y="${root.y}" width="${root.size}" height="${root.size}" rx="${root.rx}" fill="url(#panel)" filter="url(#root-elevation)" />
|
|
193
|
+
<rect x="${TILEPAPER_ICON_TILES.blue.x}" y="${TILEPAPER_ICON_TILES.blue.y}" width="${t}" height="${t}" rx="${tr}" fill="url(#blue)" />
|
|
194
|
+
<rect x="${TILEPAPER_ICON_TILES.teal.x}" y="${TILEPAPER_ICON_TILES.teal.y}" width="${t}" height="${t}" rx="${tr}" fill="url(#teal)" />
|
|
195
|
+
<rect x="${TILEPAPER_ICON_TILES.violet.x}" y="${TILEPAPER_ICON_TILES.violet.y}" width="${t}" height="${t}" rx="${tr}" fill="url(#violet)" />
|
|
196
|
+
<rect x="${TILEPAPER_ICON_TILES.paper.x}" y="${TILEPAPER_ICON_TILES.paper.y}" width="${t}" height="${t}" rx="${tr}" fill="url(#paper)" />
|
|
197
|
+
<path d="${fold.highlight}" fill="white" fill-opacity="0.92" />
|
|
198
|
+
<path d="${fold.shadow}" fill="#C9C3B7" fill-opacity="0.74" />
|
|
199
|
+
</svg>
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import { Codicon } from '../primitives/codicon/Codicon';
|
|
3
|
+
import { useWorkbenchIconResolver } from './WorkbenchIconContext';
|
|
4
|
+
import {
|
|
5
|
+
isWorkbenchIconDescriptor,
|
|
6
|
+
normalizeWorkbenchIconDescriptor,
|
|
7
|
+
} from './resolveWorkbenchIcon';
|
|
8
|
+
import type { WorkbenchIconInput } from './types';
|
|
9
|
+
|
|
10
|
+
export interface WorkbenchIconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
11
|
+
icon: WorkbenchIconInput;
|
|
12
|
+
/** When set, exposes the icon to assistive tech instead of aria-hidden. */
|
|
13
|
+
label?: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Renders a workbench icon. String ids default to codicon; hosts may override
|
|
18
|
+
* string resolution via `WorkbenchIconProvider`.
|
|
19
|
+
*/
|
|
20
|
+
export function WorkbenchIcon({ className, icon, label, ...props }: WorkbenchIconProps) {
|
|
21
|
+
const resolveStringIcon = useWorkbenchIconResolver();
|
|
22
|
+
const normalized = normalizeWorkbenchIconDescriptor(icon);
|
|
23
|
+
|
|
24
|
+
if (isWorkbenchIconDescriptor(normalized)) {
|
|
25
|
+
if (normalized.kind === 'node') {
|
|
26
|
+
return (
|
|
27
|
+
<span
|
|
28
|
+
aria-hidden={label ? undefined : true}
|
|
29
|
+
aria-label={label}
|
|
30
|
+
className={className}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{normalized.node}
|
|
34
|
+
</span>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const codiconName = normalized.name;
|
|
39
|
+
const resolved = resolveStringIcon?.(codiconName, { className, label });
|
|
40
|
+
if (resolved !== undefined) {
|
|
41
|
+
return <>{resolved}</>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return <Codicon className={className} icon={codiconName} label={label} />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<span
|
|
49
|
+
aria-hidden={label ? undefined : true}
|
|
50
|
+
aria-label={label}
|
|
51
|
+
className={className}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
{normalized}
|
|
55
|
+
</span>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createContext, useContext, type ReactNode } from 'react';
|
|
2
|
+
import type { WorkbenchIconResolver } from './types';
|
|
3
|
+
|
|
4
|
+
export interface WorkbenchIconProviderProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* When set, maps string icon ids to render output.
|
|
8
|
+
* Unhandled ids should fall back to codicon rendering (see `WorkbenchIcon`).
|
|
9
|
+
*/
|
|
10
|
+
resolveStringIcon?: WorkbenchIconResolver | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const WorkbenchIconContext = createContext<WorkbenchIconResolver | undefined>(undefined);
|
|
14
|
+
|
|
15
|
+
export function WorkbenchIconProvider({ children, resolveStringIcon }: WorkbenchIconProviderProps) {
|
|
16
|
+
return (
|
|
17
|
+
<WorkbenchIconContext.Provider value={resolveStringIcon}>
|
|
18
|
+
{children}
|
|
19
|
+
</WorkbenchIconContext.Provider>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function useWorkbenchIconResolver(): WorkbenchIconResolver | undefined {
|
|
24
|
+
return useContext(WorkbenchIconContext);
|
|
25
|
+
}
|