@book.dev/ui 1.60.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/LICENSE +21 -0
- package/dist/EmojiGrid-xK5mPJPo.js +205 -0
- package/dist/blockeditor/BlockEditor.d.ts +68 -0
- package/dist/blockeditor/CodeBlockView.d.ts +19 -0
- package/dist/blockeditor/InlineToolbar.d.ts +18 -0
- package/dist/blockeditor/LinkPicker.d.ts +16 -0
- package/dist/blockeditor/MentionMenu.d.ts +14 -0
- package/dist/blockeditor/PresentBlocks.d.ts +21 -0
- package/dist/blockeditor/RichTextEditor.d.ts +29 -0
- package/dist/blockeditor/SlashMenu.d.ts +49 -0
- package/dist/blockeditor/TextBlockView.d.ts +9 -0
- package/dist/blockeditor/__tests__/LinkPicker.test.d.ts +1 -0
- package/dist/blockeditor/__tests__/SlashMenu.test.d.ts +1 -0
- package/dist/blockeditor/__tests__/aiApply.test.d.ts +1 -0
- package/dist/blockeditor/__tests__/groupLock.test.d.ts +1 -0
- package/dist/blockeditor/__tests__/highlight.test.d.ts +1 -0
- package/dist/blockeditor/__tests__/mergeUp.test.d.ts +1 -0
- package/dist/blockeditor/__tests__/present.test.d.ts +1 -0
- package/dist/blockeditor/aiBlocks.d.ts +9 -0
- package/dist/blockeditor/colors.d.ts +23 -0
- package/dist/blockeditor/exportBlocks.d.ts +25 -0
- package/dist/blockeditor/highlight.d.ts +25 -0
- package/dist/blockeditor/index.d.ts +8 -0
- package/dist/blockeditor/kit/KitFrame.d.ts +95 -0
- package/dist/blockeditor/kit/KitSettings.d.ts +18 -0
- package/dist/blockeditor/kit/OptionsEditor.d.ts +8 -0
- package/dist/blockeditor/kit/__tests__/chartMath.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/dataflow.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/exportKit.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/exportKit2.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/groupSync.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/inputs2Render.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/inputs2Scope.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/inputsRender.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/kitConfig.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/kitPanel.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/options.test.d.ts +1 -0
- package/dist/blockeditor/kit/__tests__/scope.test.d.ts +1 -0
- package/dist/blockeditor/kit/cards.d.ts +51 -0
- package/dist/blockeditor/kit/chartMath.d.ts +62 -0
- package/dist/blockeditor/kit/charts.d.ts +27 -0
- package/dist/blockeditor/kit/completion.d.ts +45 -0
- package/dist/blockeditor/kit/dataflow.d.ts +68 -0
- package/dist/blockeditor/kit/groupSync.d.ts +23 -0
- package/dist/blockeditor/kit/index.d.ts +11 -0
- package/dist/blockeditor/kit/inputs.d.ts +135 -0
- package/dist/blockeditor/kit/inputs2.d.ts +86 -0
- package/dist/blockeditor/kit/kitConfig.d.ts +5 -0
- package/dist/blockeditor/kit/kitPanel.d.ts +31 -0
- package/dist/blockeditor/kit/lock.d.ts +12 -0
- package/dist/blockeditor/kit/options.d.ts +60 -0
- package/dist/blockeditor/kit/progress.d.ts +20 -0
- package/dist/blockeditor/kit/scope.d.ts +100 -0
- package/dist/blockeditor/model.d.ts +236 -0
- package/dist/blockeditor/present.d.ts +18 -0
- package/dist/blockeditor/provider.d.ts +16 -0
- package/dist/blockeditor/reactiveBlocks.d.ts +2 -0
- package/dist/blockeditor/registry.d.ts +38 -0
- package/dist/blockeditor/richtext.d.ts +48 -0
- package/dist/blockeditor/useBlockEditor.d.ts +45 -0
- package/dist/components/AboutDialog.d.ts +9 -0
- package/dist/components/AgentPanel.d.ts +2 -0
- package/dist/components/AiBridgeHost.d.ts +14 -0
- package/dist/components/AiSearchDialog.d.ts +8 -0
- package/dist/components/AiSettings.d.ts +7 -0
- package/dist/components/AppearanceSettings.d.ts +3 -0
- package/dist/components/BackForwardCluster.d.ts +1 -0
- package/dist/components/BackupSettings.d.ts +2 -0
- package/dist/components/BreadcrumbCluster.d.ts +1 -0
- package/dist/components/ColorSchemeMenu.d.ts +1 -0
- package/dist/components/CommandMenu.d.ts +1 -0
- package/dist/components/CommandToggle.d.ts +3 -0
- package/dist/components/DocumentArea.d.ts +8 -0
- package/dist/components/Drawer.d.ts +7 -0
- package/dist/components/EmojiGrid.d.ts +16 -0
- package/dist/components/EmojiPickerHost.d.ts +8 -0
- package/dist/components/ExtensionsSettings.d.ts +7 -0
- package/dist/components/FavoritesNav.d.ts +8 -0
- package/dist/components/GeneralSettings.d.ts +2 -0
- package/dist/components/GlobalShortcuts.d.ts +9 -0
- package/dist/components/HomeButton.d.ts +2 -0
- package/dist/components/IconPicker.d.ts +17 -0
- package/dist/components/NavBar.d.ts +1 -0
- package/dist/components/NavContextMenu.d.ts +7 -0
- package/dist/components/PageActionsCluster.d.ts +9 -0
- package/dist/components/PageAppearanceHost.d.ts +9 -0
- package/dist/components/PageContextMenu.d.ts +17 -0
- package/dist/components/PageCover.d.ts +18 -0
- package/dist/components/PageHeaderControls.d.ts +13 -0
- package/dist/components/PageIcon.d.ts +16 -0
- package/dist/components/PageProperties.d.ts +53 -0
- package/dist/components/PluginBoot.d.ts +2 -0
- package/dist/components/PresentMode.d.ts +7 -0
- package/dist/components/ProfileAvatar.d.ts +17 -0
- package/dist/components/ProfileMenu.d.ts +6 -0
- package/dist/components/Settings.d.ts +7 -0
- package/dist/components/SettingsButton.d.ts +2 -0
- package/dist/components/SettingsPanel.d.ts +14 -0
- package/dist/components/SideNav.d.ts +1 -0
- package/dist/components/SideNavToggle.d.ts +3 -0
- package/dist/components/SidebarSections.d.ts +17 -0
- package/dist/components/SplitPane.d.ts +9 -0
- package/dist/components/TemplateGallery.d.ts +8 -0
- package/dist/components/TitlebarTabs.d.ts +10 -0
- package/dist/components/TrashDialog.d.ts +7 -0
- package/dist/components/WindowActionsCluster.d.ts +6 -0
- package/dist/components/WindowControls.d.ts +6 -0
- package/dist/components/WindowTitle.d.ts +7 -0
- package/dist/components/WorkspaceInfo.d.ts +6 -0
- package/dist/components/WorkspaceNavigationTree.d.ts +14 -0
- package/dist/components/WorkspaceSelectMenu.d.ts +10 -0
- package/dist/components/__tests__/AppearanceSettings.test.d.ts +1 -0
- package/dist/components/__tests__/PageIcon.test.d.ts +1 -0
- package/dist/components/__tests__/SettingsPanel.test.d.ts +1 -0
- package/dist/components/__tests__/buildTree.test.d.ts +1 -0
- package/dist/components/__tests__/profileAvatar.test.d.ts +1 -0
- package/dist/components/appearance/AppearanceControls.d.ts +33 -0
- package/dist/components/appearance/PageCustomiseBody.d.ts +29 -0
- package/dist/components/brand/OpenBookLogo.d.ts +11 -0
- package/dist/components/brand/index.d.ts +1 -0
- package/dist/components/database/DatabaseCard.d.ts +36 -0
- package/dist/components/database/DatabasePicker.d.ts +12 -0
- package/dist/components/database/DatabaseRowProperties.d.ts +13 -0
- package/dist/components/database/DatabaseView.d.ts +9 -0
- package/dist/components/database/InlineDatabaseBlock.d.ts +3 -0
- package/dist/components/database/__tests__/InlineDatabaseBlock.test.d.ts +1 -0
- package/dist/components/database/databaseCells.d.ts +57 -0
- package/dist/components/database/databaseCharts.d.ts +28 -0
- package/dist/components/database/databaseColors.d.ts +12 -0
- package/dist/components/database/databaseGraph.d.ts +16 -0
- package/dist/components/database/databaseLayouts.d.ts +84 -0
- package/dist/components/database/databaseMap.d.ts +21 -0
- package/dist/components/database/databaseMapLeaflet.d.ts +26 -0
- package/dist/components/database/databaseMenus.d.ts +97 -0
- package/dist/components/database/databaseTimeline.d.ts +27 -0
- package/dist/components/database/geocode.d.ts +24 -0
- package/dist/components/database/useDatabase.d.ts +129 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/review/BlockReviewMarkers.d.ts +19 -0
- package/dist/components/review/CommentThread.d.ts +20 -0
- package/dist/components/review/ReviewPaneBody.d.ts +12 -0
- package/dist/components/review/SuggestHost.d.ts +13 -0
- package/dist/components/review/SuggestionCard.d.ts +21 -0
- package/dist/components/review/__tests__/review.test.d.ts +1 -0
- package/dist/components/review/useReview.d.ts +27 -0
- package/dist/components/settings/AccountSettings.d.ts +6 -0
- package/dist/components/settings/AdminSettings.d.ts +2 -0
- package/dist/components/settings/ConnectionSettings.d.ts +7 -0
- package/dist/components/settings/CustomisationSettings.d.ts +2 -0
- package/dist/components/settings/ProfileSettings.d.ts +2 -0
- package/dist/components/settings/primitives.d.ts +47 -0
- package/dist/components/settings/stubs.d.ts +8 -0
- package/dist/components/ui/__tests__/kbd.test.d.ts +1 -0
- package/dist/components/ui/__tests__/markdown.test.d.ts +1 -0
- package/dist/components/ui/__tests__/select.test.d.ts +1 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/command.d.ts +86 -0
- package/dist/components/ui/context-menu.d.ts +24 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/icon-button.d.ts +16 -0
- package/dist/components/ui/input.d.ts +9 -0
- package/dist/components/ui/kbd.d.ts +31 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/markdown.d.ts +19 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/popover.d.ts +6 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +42 -0
- package/dist/components/ui/skeleton.d.ts +6 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tree.d.ts +37 -0
- package/dist/components/useAppCommands.d.ts +25 -0
- package/dist/data/DataProvider.d.ts +30 -0
- package/dist/data/index.d.ts +1 -0
- package/dist/databaseMapLeaflet-8LYcHcR6.js +87 -0
- package/dist/export/__tests__/chartNormalize.test.d.ts +1 -0
- package/dist/export/__tests__/export.test.d.ts +1 -0
- package/dist/export/__tests__/exportReactive.test.d.ts +1 -0
- package/dist/export/chartNormalize.d.ts +22 -0
- package/dist/export/chartSvg.d.ts +2 -0
- package/dist/export/documentModel.d.ts +136 -0
- package/dist/export/exportSite.d.ts +40 -0
- package/dist/export/format.d.ts +2 -0
- package/dist/export/kitChart.d.ts +21 -0
- package/dist/export/toHtml.d.ts +25 -0
- package/dist/export/toMarkdown.d.ts +7 -0
- package/dist/export/toPdf.d.ts +14 -0
- package/dist/exportBlocks-33D7P_8Q.js +987 -0
- package/dist/exportSite-DlRm4u7W.js +50 -0
- package/dist/format-CLQoRoYP.js +1646 -0
- package/dist/i18n/__tests__/i18n.test.d.ts +1 -0
- package/dist/i18n/index.d.ts +24 -0
- package/dist/i18n/messages/de.d.ts +2 -0
- package/dist/i18n/messages/en.d.ts +977 -0
- package/dist/i18n/messages/ja.d.ts +2 -0
- package/dist/i18n/messages/zh.d.ts +2 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +20915 -0
- package/dist/layouts/DefaultLayout.d.ts +4 -0
- package/dist/layouts/index.d.ts +1 -0
- package/dist/lib/__tests__/accountClient.test.d.ts +1 -0
- package/dist/lib/__tests__/backlinks.test.d.ts +1 -0
- package/dist/lib/__tests__/backupBundle.test.d.ts +1 -0
- package/dist/lib/__tests__/blockExport.test.d.ts +1 -0
- package/dist/lib/__tests__/blockModel.test.d.ts +1 -0
- package/dist/lib/__tests__/databaseFormula.test.d.ts +1 -0
- package/dist/lib/__tests__/databaseTypes.test.d.ts +1 -0
- package/dist/lib/__tests__/favorites.test.d.ts +1 -0
- package/dist/lib/__tests__/homePage.test.d.ts +1 -0
- package/dist/lib/__tests__/hud.test.d.ts +1 -0
- package/dist/lib/__tests__/icons.test.d.ts +1 -0
- package/dist/lib/__tests__/mixedContent.test.d.ts +1 -0
- package/dist/lib/__tests__/pageAppearance.test.d.ts +1 -0
- package/dist/lib/__tests__/pageIcon.test.d.ts +1 -0
- package/dist/lib/__tests__/pageLayout.test.d.ts +1 -0
- package/dist/lib/__tests__/pageSaveStatus.test.d.ts +1 -0
- package/dist/lib/__tests__/pageTheme.test.d.ts +1 -0
- package/dist/lib/__tests__/parentGrouping.test.d.ts +1 -0
- package/dist/lib/__tests__/pluginSdk.test.d.ts +1 -0
- package/dist/lib/__tests__/recents.test.d.ts +1 -0
- package/dist/lib/__tests__/relations.test.d.ts +1 -0
- package/dist/lib/__tests__/templates.test.d.ts +1 -0
- package/dist/lib/__tests__/textMerge.test.d.ts +1 -0
- package/dist/lib/__tests__/themes.test.d.ts +1 -0
- package/dist/lib/__tests__/treeMove.test.d.ts +1 -0
- package/dist/lib/aiBridge.d.ts +67 -0
- package/dist/lib/aiFeatures.d.ts +31 -0
- package/dist/lib/aiSettingsNav.d.ts +14 -0
- package/dist/lib/backupBundle.d.ts +23 -0
- package/dist/lib/bookFolderTransfer.d.ts +15 -0
- package/dist/lib/download.d.ts +10 -0
- package/dist/lib/editorChrome.d.ts +14 -0
- package/dist/lib/emoji.d.ts +10 -0
- package/dist/lib/emojiData.d.ts +21 -0
- package/dist/lib/emojiPicker.d.ts +31 -0
- package/dist/lib/favorites.d.ts +11 -0
- package/dist/lib/homePage.d.ts +53 -0
- package/dist/lib/hud.d.ts +70 -0
- package/dist/lib/iconRecents.d.ts +3 -0
- package/dist/lib/iconValue.d.ts +19 -0
- package/dist/lib/lucideIcons.d.ts +21 -0
- package/dist/lib/openDocs.d.ts +5 -0
- package/dist/lib/pageActions.d.ts +17 -0
- package/dist/lib/pageAppearance.d.ts +20 -0
- package/dist/lib/pageCover.d.ts +21 -0
- package/dist/lib/pageCustomise.d.ts +6 -0
- package/dist/lib/pageDocActions.d.ts +20 -0
- package/dist/lib/pageFont.d.ts +25 -0
- package/dist/lib/pageFullWidth.d.ts +10 -0
- package/dist/lib/pageIcon.d.ts +25 -0
- package/dist/lib/pageLinks.d.ts +41 -0
- package/dist/lib/pageSaveStatus.d.ts +14 -0
- package/dist/lib/pageTheme.d.ts +15 -0
- package/dist/lib/pageThemePresets.d.ts +23 -0
- package/dist/lib/recents.d.ts +9 -0
- package/dist/lib/reviewPane.d.ts +23 -0
- package/dist/lib/selection.d.ts +2 -0
- package/dist/lib/shortcuts.d.ts +79 -0
- package/dist/lib/sidebarStyles.d.ts +10 -0
- package/dist/lib/suggestBridge.d.ts +33 -0
- package/dist/lib/textMerge.d.ts +19 -0
- package/dist/lib/themes.d.ts +137 -0
- package/dist/lib/treeMove.d.ts +24 -0
- package/dist/lib/useModifierHeld.d.ts +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lucideIcons-B6pmC-WQ.js +5003 -0
- package/dist/model-CBxw8JNb.js +734 -0
- package/dist/pageIcon-BWTy7hAh.js +32 -0
- package/dist/plugins/__tests__/host.test.d.ts +1 -0
- package/dist/plugins/__tests__/loader.test.d.ts +1 -0
- package/dist/plugins/__tests__/pagePlugin.test.d.ts +1 -0
- package/dist/plugins/api.d.ts +67 -0
- package/dist/plugins/commandRegistry.d.ts +15 -0
- package/dist/plugins/host.d.ts +32 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/loader.d.ts +19 -0
- package/dist/plugins/pagePlugin.d.ts +21 -0
- package/dist/providers/AccountProvider.d.ts +67 -0
- package/dist/providers/ConfirmProvider.d.ts +30 -0
- package/dist/providers/ForwardingProvider.d.ts +23 -0
- package/dist/providers/HudProvider.d.ts +9 -0
- package/dist/providers/I18nProvider.d.ts +23 -0
- package/dist/providers/NavigationProvider.d.ts +89 -0
- package/dist/providers/PlatformLibraryProvider.d.ts +107 -0
- package/dist/providers/PreferencesProvider.d.ts +47 -0
- package/dist/providers/ThemeProvider.d.ts +26 -0
- package/dist/providers/WorkspaceProvider.d.ts +40 -0
- package/dist/providers/__tests__/PreferencesProvider.test.d.ts +1 -0
- package/dist/providers/__tests__/extractToken.test.d.ts +1 -0
- package/dist/providers/__tests__/windowModel.test.d.ts +1 -0
- package/dist/providers/index.d.ts +10 -0
- package/dist/providers/windowModel.d.ts +69 -0
- package/dist/screens/BlockPageDocument.d.ts +4 -0
- package/dist/screens/ConnectedPageDocument.d.ts +14 -0
- package/dist/screens/DataflowView.d.ts +2 -0
- package/dist/screens/HomeScreen.d.ts +7 -0
- package/dist/screens/index.d.ts +3 -0
- package/dist/screens/pageChrome.d.ts +46 -0
- package/dist/style.css +3 -0
- package/dist/toHtml-BoPr8Ce4.js +394 -0
- package/dist/toPdf-DGtKQSRA.js +133 -0
- package/package.json +94 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface PageFonts {
|
|
2
|
+
/** Primary typeface — body / prose text. */
|
|
3
|
+
body?: string;
|
|
4
|
+
/** Secondary typeface — the title and headings. */
|
|
5
|
+
heading?: string;
|
|
6
|
+
}
|
|
7
|
+
/** The built-in typeface presets offered in the customisation pane. */
|
|
8
|
+
export declare const FONT_PRESETS: ReadonlyArray<{
|
|
9
|
+
id: 'sans' | 'serif' | 'mono';
|
|
10
|
+
labelKey: string;
|
|
11
|
+
css: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Resolve a stored choice (preset id or custom family) to a CSS font-family. */
|
|
14
|
+
export declare function fontCss(choice: string | undefined | null): string | undefined;
|
|
15
|
+
/** Subscribe to per-page font changes (any page). Returns an unsubscribe fn. */
|
|
16
|
+
export declare const subscribePageFonts: (cb: () => void) => (() => void);
|
|
17
|
+
/** The fonts stored for a page, or `null` when it follows the app default. */
|
|
18
|
+
export declare function readPageFonts(pageId: string): PageFonts | null;
|
|
19
|
+
/** Persist (or clear, when empty) a page's font override. */
|
|
20
|
+
export declare function writePageFonts(pageId: string, fonts: PageFonts | null): void;
|
|
21
|
+
/** A page's fonts as scoped CSS variables, or `undefined` when none are set
|
|
22
|
+
* (so callers can skip the wrapper class entirely). */
|
|
23
|
+
export declare function pageFontStyle(fonts: PageFonts | null): Record<string, string> | undefined;
|
|
24
|
+
/** React-subscribe to one page's fonts; re-renders when they change. */
|
|
25
|
+
export declare function usePageFonts(pageId: string): PageFonts | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Subscribe to full-width changes (any page). Returns an unsubscribe fn. */
|
|
2
|
+
export declare const subscribePageFullWidth: (cb: () => void) => (() => void);
|
|
3
|
+
/** Whether a page is set to full width (defaults to the centered column). */
|
|
4
|
+
export declare function readPageFullWidth(pageId: string): boolean;
|
|
5
|
+
/** Persist (or clear, when false) a page's full-width preference. */
|
|
6
|
+
export declare function writePageFullWidth(pageId: string, value: boolean): void;
|
|
7
|
+
/** Flip a page between full-width and the centered column. */
|
|
8
|
+
export declare function togglePageFullWidth(pageId: string): void;
|
|
9
|
+
/** React-subscribe to one page's full-width flag; re-renders when it changes. */
|
|
10
|
+
export declare function usePageFullWidth(pageId: string): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ICON_PROPERTY_ID } from '@book.dev/sdk';
|
|
2
|
+
/** The default page icon when none has been chosen. */
|
|
3
|
+
export declare const DEFAULT_PAGE_ICON = "\uD83D\uDCC4";
|
|
4
|
+
/** Subscribe to icon changes (any page). Returns an unsubscribe fn. */
|
|
5
|
+
export declare const subscribePageIcon: (cb: () => void) => (() => void);
|
|
6
|
+
export declare function setIconPersister(fn: ((pageId: string, emoji: string | null) => void) | null): void;
|
|
7
|
+
/** The emoji a page has been given, or `null` when none is set. Lets callers
|
|
8
|
+
* (e.g. the sidebar tree) fall back to their own glyph instead of the default. */
|
|
9
|
+
export declare const readStoredPageIcon: (pageId: string) => string | null;
|
|
10
|
+
export declare const readPageIcon: (pageId: string) => string;
|
|
11
|
+
export declare const writePageIcon: (pageId: string, emoji: string) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Bulk-hydrate icons from a list projection — {@link PageMeta} entries
|
|
14
|
+
* (`{id, icon}`) or database rows (`{id, icon: properties[sys_icon]}`). Lifts any
|
|
15
|
+
* legacy localStorage icon into the document the first time a page is seen
|
|
16
|
+
* without a stored one. The list is authoritative for the pages it names.
|
|
17
|
+
*/
|
|
18
|
+
export declare function hydratePageIcons(entries: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
icon?: string | null;
|
|
21
|
+
}>): void;
|
|
22
|
+
/** React-subscribe to one page's icon; re-renders when it changes. */
|
|
23
|
+
export declare function usePageIcon(pageId: string): string;
|
|
24
|
+
/** The reserved property id icons persist under (re-exported for hydration). */
|
|
25
|
+
export { ICON_PROPERTY_ID };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small bridge between the EditorJS subpage/database blocks and the app's
|
|
3
|
+
* navigation. EditorJS instantiates block tools outside React's context (each
|
|
4
|
+
* block mounts its own React root), so the blocks can't use `useNavigation`.
|
|
5
|
+
* Instead {@link NavigationProvider} registers its actions here — the same
|
|
6
|
+
* singleton pattern the reactive store uses — and the blocks call them.
|
|
7
|
+
*/
|
|
8
|
+
export type SubpageKind = 'page' | 'database';
|
|
9
|
+
/** A page candidate for the `@` link menu. */
|
|
10
|
+
export interface PageLinkResult {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PageLinkBridge {
|
|
16
|
+
/** Create a child page nested under `parentId`; resolves to the new page id. */
|
|
17
|
+
createSubpage: (parentId: string, kind: SubpageKind) => Promise<string>;
|
|
18
|
+
/** Navigate to a page. Pass `pane` to drive a specific pane (the one the link
|
|
19
|
+
* was clicked in) rather than whichever pane is focused. */
|
|
20
|
+
openPage: (id: string, pane?: 'primary' | 'secondary') => void;
|
|
21
|
+
/** A display title for a page id. */
|
|
22
|
+
label: (id: string) => string;
|
|
23
|
+
/** The emoji icon for a page id. */
|
|
24
|
+
icon: (id: string) => string;
|
|
25
|
+
/** Pages whose title matches `query` (best matches first). Pass
|
|
26
|
+
* `{databasesOnly: true}` to restrict to pages that host a database. */
|
|
27
|
+
searchPages: (query: string, opts?: {
|
|
28
|
+
databasesOnly?: boolean;
|
|
29
|
+
}) => PageLinkResult[];
|
|
30
|
+
/** Create a new page titled `name` (no navigation); resolves its id. */
|
|
31
|
+
createPage: (name: string) => Promise<string>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Install (or clear) the live bridge. Re-installing also notifies subscribers,
|
|
35
|
+
* so the provider re-calling this when page titles change refreshes the blocks.
|
|
36
|
+
*/
|
|
37
|
+
export declare const setPageLinkBridge: (next: PageLinkBridge | null) => void;
|
|
38
|
+
/** Subscribe to bridge changes (title/icon updates). Returns an unsubscribe. */
|
|
39
|
+
export declare const subscribePageLinks: (cb: () => void) => (() => void);
|
|
40
|
+
/** The bridge actions, safe to call before the provider mounts (they no-op). */
|
|
41
|
+
export declare const pageLinks: PageLinkBridge;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-page save status, published by the open document(s) and read by the shell
|
|
3
|
+
* chrome (the page-actions cluster shows the *targeted* page's status). A module
|
|
4
|
+
* singleton with a small listener registry — same bridge pattern as
|
|
5
|
+
* {@link lib/pageDocActions} — so the documents and the chrome never reference
|
|
6
|
+
* each other, and a split view can show each pane's page status independently.
|
|
7
|
+
*/
|
|
8
|
+
export type SaveStatus = 'idle' | 'saving' | 'saved' | 'save failed';
|
|
9
|
+
/** Publish a page's save status (call from the document; clears on unmount). */
|
|
10
|
+
export declare function setPageSaveStatus(pageId: string | null | undefined, status: SaveStatus | null): void;
|
|
11
|
+
export declare const pageSaveStatus: (pageId: string | null | undefined) => SaveStatus;
|
|
12
|
+
export declare const subscribePageSaveStatus: (cb: () => void) => (() => void);
|
|
13
|
+
/** Monotonic change counter — pair with useSyncExternalStore. */
|
|
14
|
+
export declare const pageSaveStatusVersion: () => number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AppearanceOptions, type AppearanceOverride } from '@/lib/themes';
|
|
2
|
+
/** Subscribe to per-page theme changes (any page). Returns an unsubscribe fn. */
|
|
3
|
+
export declare const subscribePageTheme: (cb: () => void) => (() => void);
|
|
4
|
+
/** The override stored for a page, or `null` when the page follows the app. */
|
|
5
|
+
export declare function readPageTheme(pageId: string): AppearanceOverride | null;
|
|
6
|
+
/** Persist (or, with `null`/empty, clear) a page's override. */
|
|
7
|
+
export declare function writePageTheme(pageId: string, override: AppearanceOverride | null): void;
|
|
8
|
+
/** Whether a page carries any override (i.e. doesn't simply follow the app). */
|
|
9
|
+
export declare const hasPageTheme: (pageId: string) => boolean;
|
|
10
|
+
/** React-subscribe to one page's override; re-renders when it changes. */
|
|
11
|
+
export declare function usePageTheme(pageId: string): AppearanceOverride | null;
|
|
12
|
+
/** Merge a page's override over the global appearance for the active scheme,
|
|
13
|
+
* returning a CSS-variable style map — or `undefined` when there's no override
|
|
14
|
+
* (so callers can skip the scoped wrapper entirely). */
|
|
15
|
+
export declare function composePageAppearance(global: AppearanceOptions, override: AppearanceOverride | null, scheme: 'light' | 'dark'): Record<string, string> | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whole-page theme presets: one click sets a page's accent (control colour),
|
|
3
|
+
* background tint, typefaces, and cover together — a coordinated look you can
|
|
4
|
+
* then fine-tune with the individual pickers. Applied per page through the same
|
|
5
|
+
* localStorage stores as the manual controls ({@link writePageTheme} /
|
|
6
|
+
* {@link writePageFonts} / {@link writePageCover}), so a preset is just a bundle
|
|
7
|
+
* of those writes.
|
|
8
|
+
*/
|
|
9
|
+
import type { AppearanceOverride } from '@/lib/themes';
|
|
10
|
+
import type { PageFonts } from '@/lib/pageFont';
|
|
11
|
+
import { type PageCover } from '@/lib/pageCover';
|
|
12
|
+
export interface PageThemePreset {
|
|
13
|
+
id: string;
|
|
14
|
+
/** i18n key for the display name (see messages `appearance.preset.*`). */
|
|
15
|
+
labelKey: string;
|
|
16
|
+
/** Accent + background (an empty override means "follow the app" — a reset). */
|
|
17
|
+
override: AppearanceOverride;
|
|
18
|
+
/** Body / heading typefaces, or null to clear them. */
|
|
19
|
+
fonts: PageFonts | null;
|
|
20
|
+
/** A curated gradient cover, or null to clear it. */
|
|
21
|
+
cover: PageCover | null;
|
|
22
|
+
}
|
|
23
|
+
export declare const PAGE_THEME_PRESETS: PageThemePreset[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const MAX_RECENTS = 12;
|
|
2
|
+
/** Pure: move `id` to the front (deduped), capped to `max`. */
|
|
3
|
+
export declare function recordRecentId(list: string[], id: string, max?: number): string[];
|
|
4
|
+
/** The current recents, most-recent first. */
|
|
5
|
+
export declare const readRecents: () => string[];
|
|
6
|
+
/** Record a visit to `id` (moves it to the front). */
|
|
7
|
+
export declare const recordRecent: (id: string) => void;
|
|
8
|
+
/** Subscribe to recents changes. Returns an unsubscribe fn. */
|
|
9
|
+
export declare const subscribeRecents: (cb: () => void) => (() => void);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Subscribe to review-target changes. Returns an unsubscribe fn. */
|
|
2
|
+
export declare const subscribeReviewPane: (cb: () => void) => (() => void);
|
|
3
|
+
export interface ReviewTarget {
|
|
4
|
+
pageId: string | null;
|
|
5
|
+
focusSuggestionId: string | null;
|
|
6
|
+
focusBlockId: string | null;
|
|
7
|
+
revision: number;
|
|
8
|
+
}
|
|
9
|
+
/** The page currently under review (plus any focused suggestion/block), or null. */
|
|
10
|
+
export declare const getReviewTarget: () => ReviewTarget;
|
|
11
|
+
/**
|
|
12
|
+
* Point the Review side pane at a page (does NOT open the pane itself — the
|
|
13
|
+
* caller also calls `openInSplit(REVIEW_PANE_ID)`). Optionally focuses a
|
|
14
|
+
* suggestion or a block's comment thread.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setReviewTarget(pageId: string | null, opts?: {
|
|
17
|
+
suggestionId?: string | null;
|
|
18
|
+
blockId?: string | null;
|
|
19
|
+
}): void;
|
|
20
|
+
/** Subscribe to "a suggestion/comment changed" pings. Returns an unsubscribe fn. */
|
|
21
|
+
export declare const subscribeReviewData: (cb: () => void) => (() => void);
|
|
22
|
+
/** Notify every review surface that suggestions/comments changed (refetch). */
|
|
23
|
+
export declare const pingReviewData: () => void;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keyboard-shortcut vocabulary, shared by the global key handler
|
|
3
|
+
* ({@link useGlobalShortcuts}), the command palette, and the menus — so a
|
|
4
|
+
* shortcut is defined once and every surface that displays or fires it stays in
|
|
5
|
+
* sync.
|
|
6
|
+
*
|
|
7
|
+
* A {@link ShortcutCombo} is platform-neutral: `mod` means ⌘ on macOS and Ctrl
|
|
8
|
+
* elsewhere. {@link formatShortcut} renders it for display (`⌘K` vs `Ctrl+K`)
|
|
9
|
+
* and {@link matchShortcut} tests a `KeyboardEvent` against it.
|
|
10
|
+
*/
|
|
11
|
+
export interface ShortcutCombo {
|
|
12
|
+
/** The `KeyboardEvent.key` to match (compared case-insensitively). */
|
|
13
|
+
key: string;
|
|
14
|
+
/** ⌘ on macOS, Ctrl elsewhere. */
|
|
15
|
+
mod?: boolean;
|
|
16
|
+
shift?: boolean;
|
|
17
|
+
alt?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Client-side platform flag. Surfaces rendered during SSR (e.g. the sidebar
|
|
21
|
+
* search button) should prefer {@link useIsMac} so the first client render
|
|
22
|
+
* matches the server HTML; menus and the palette open only after mount, so the
|
|
23
|
+
* module-level value is correct for them.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isMacPlatform: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Render a combo for display: macOS stacks symbols with no separator (`⌘⇧L`),
|
|
28
|
+
* other platforms join with `+` (`Ctrl+Shift+L`). The modifier order follows
|
|
29
|
+
* each platform's convention.
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatShortcut(combo: ShortcutCombo, mac?: boolean): string;
|
|
32
|
+
/** True when `e` is exactly this combo (modifiers must match, not just be present). */
|
|
33
|
+
export declare function matchShortcut(e: KeyboardEvent, combo: ShortcutCombo): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The canonical shortcut for each app command, keyed by command id. Every combo
|
|
36
|
+
* here uses a modifier, so the global handler can fire it even while a text
|
|
37
|
+
* field or the editor has focus without stealing ordinary typing.
|
|
38
|
+
*/
|
|
39
|
+
export declare const SHORTCUTS: {
|
|
40
|
+
readonly commandPalette: {
|
|
41
|
+
readonly key: "k";
|
|
42
|
+
readonly mod: true;
|
|
43
|
+
};
|
|
44
|
+
readonly newPage: {
|
|
45
|
+
readonly key: "n";
|
|
46
|
+
readonly mod: true;
|
|
47
|
+
};
|
|
48
|
+
readonly toggleSidebar: {
|
|
49
|
+
readonly key: "\\";
|
|
50
|
+
readonly mod: true;
|
|
51
|
+
};
|
|
52
|
+
readonly openSettings: {
|
|
53
|
+
readonly key: ",";
|
|
54
|
+
readonly mod: true;
|
|
55
|
+
};
|
|
56
|
+
readonly goBack: {
|
|
57
|
+
readonly key: "[";
|
|
58
|
+
readonly mod: true;
|
|
59
|
+
};
|
|
60
|
+
readonly goForward: {
|
|
61
|
+
readonly key: "]";
|
|
62
|
+
readonly mod: true;
|
|
63
|
+
};
|
|
64
|
+
readonly toggleFullWidth: {
|
|
65
|
+
readonly key: ".";
|
|
66
|
+
readonly mod: true;
|
|
67
|
+
};
|
|
68
|
+
readonly toggleTheme: {
|
|
69
|
+
readonly key: "l";
|
|
70
|
+
readonly mod: true;
|
|
71
|
+
readonly shift: true;
|
|
72
|
+
};
|
|
73
|
+
readonly openTrash: {
|
|
74
|
+
readonly key: "delete";
|
|
75
|
+
readonly mod: true;
|
|
76
|
+
readonly shift: true;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export type ShortcutId = keyof typeof SHORTCUTS;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared sidebar item styling. The old hover was `bg-accent` — a neutral gray
|
|
3
|
+
* on the (also-neutral) sheet, so the highlight barely read. These tint the
|
|
4
|
+
* highlight with the theme colour instead: still subtle, but with real contrast
|
|
5
|
+
* against the surface. Applied via `cn`, so they override a Button variant's
|
|
6
|
+
* own `hover:bg-accent` through tailwind-merge.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SIDEBAR_HOVER = "hover:bg-primary/10 hover:text-foreground dark:hover:bg-primary/20";
|
|
9
|
+
/** The selected / active sidebar item — a stronger tint of the same colour. */
|
|
10
|
+
export declare const SIDEBAR_ACTIVE = "bg-primary/15 text-foreground dark:bg-primary/25";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tiny in-memory bridge for human-authored suggestions + block comments from
|
|
3
|
+
* inside the (provider-less) block editor. The editor's row menu calls
|
|
4
|
+
* `requestSuggestEdit` / `requestComment` with the target block; a host
|
|
5
|
+
* portaled from `BlockPageDocument` (which DOES sit inside the app providers /
|
|
6
|
+
* data client — the editor's own React root does not) renders the composer and
|
|
7
|
+
* persists through the data client. Mirrors the `kitPanel` / `aiBridge`
|
|
8
|
+
* singleton pattern.
|
|
9
|
+
*/
|
|
10
|
+
export interface SuggestEditRequest {
|
|
11
|
+
pageId: string;
|
|
12
|
+
blockId: string;
|
|
13
|
+
/** The block's current plain text (the suggestion's "before"). */
|
|
14
|
+
before: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CommentRequest {
|
|
17
|
+
pageId: string;
|
|
18
|
+
blockId: string;
|
|
19
|
+
}
|
|
20
|
+
type SuggestHandler = (req: SuggestEditRequest) => void;
|
|
21
|
+
type CommentHandler = (req: CommentRequest) => void;
|
|
22
|
+
/** The host (BlockPageDocument) registers how to open each composer. */
|
|
23
|
+
export declare const registerSuggestHost: (handlers: {
|
|
24
|
+
onSuggestEdit: SuggestHandler;
|
|
25
|
+
onComment: CommentHandler;
|
|
26
|
+
}) => (() => void);
|
|
27
|
+
/** Whether a host is mounted (gate the menu items so they don't no-op). */
|
|
28
|
+
export declare const suggestHostReady: () => boolean;
|
|
29
|
+
/** Open the "Suggest edit" composer for a block (from the editor row menu). */
|
|
30
|
+
export declare const requestSuggestEdit: (req: SuggestEditRequest) => void;
|
|
31
|
+
/** Open the comment composer/thread for a block (from the editor row menu). */
|
|
32
|
+
export declare const requestComment: (req: CommentRequest) => void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Three-way plain-text merge (a word-level diff3), used when accepting a
|
|
3
|
+
* suggestion whose target text has changed since the suggestion was made —
|
|
4
|
+
* e.g. two suggestions edit the SAME block and both are accepted. Replaying the
|
|
5
|
+
* second as a full-text replacement would clobber the first; merging it against
|
|
6
|
+
* the common ancestor keeps both edits when they touch different regions.
|
|
7
|
+
*
|
|
8
|
+
* Granularity is the token (a whitespace run, a word, or a single punctuation
|
|
9
|
+
* char), so disjoint word edits merge cleanly. When both sides changed the same
|
|
10
|
+
* region differently it is a true conflict, resolved in favour of `theirs` (the
|
|
11
|
+
* change being accepted) — the closest match to the prior "last write wins"
|
|
12
|
+
* behaviour, but now confined to the genuinely-overlapping span.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Merge `theirs` into `ours` relative to their common ancestor `base`. Edits the
|
|
16
|
+
* two sides make in different regions are both kept; a region both sides changed
|
|
17
|
+
* differently resolves to `theirs`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function merge3(base: string, ours: string, theirs: string): string;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Named color themes + a small parametric appearance model on top of them.
|
|
3
|
+
*
|
|
4
|
+
* Like zxcv's, each theme keeps the shared warm-minimal neutral base and swaps
|
|
5
|
+
* the *accent* family (`--primary` / `--ring` plus open-book's `--brand*`), so
|
|
6
|
+
* the design language stays consistent while the highlight color changes.
|
|
7
|
+
*
|
|
8
|
+
* On top of the accent palette the user controls a couple of knobs (see
|
|
9
|
+
* {@link AppearanceOptions}): the **interface intensity** (how saturated the
|
|
10
|
+
* neutral gray surfaces read — and how strongly the sidebar adopts the accent
|
|
11
|
+
* tint) and the **control intensity** of the faded control accent (`--accent`).
|
|
12
|
+
* The neutral *temperature* (warm / cool / neutral gray) rides on the accent
|
|
13
|
+
* theme rather than being a separate control. {@link composeAppearance} folds an
|
|
14
|
+
* accent palette + those knobs into one token set; {@link applyAppearance}
|
|
15
|
+
* writes it onto an element (the document root globally, or a page wrapper for a
|
|
16
|
+
* per-page override).
|
|
17
|
+
*
|
|
18
|
+
* The content surfaces of {@link DEFAULT_APPEARANCE} match the legacy palette
|
|
19
|
+
* (verbatim from index.css) in both schemes; the one intended departure is the
|
|
20
|
+
* sidebar, which is always tinted (the sheets adopt the accent hue, with a
|
|
21
|
+
* strength that follows the interface intensity — level 0 falls back to a flat
|
|
22
|
+
* neutral panel).
|
|
23
|
+
*
|
|
24
|
+
* `--radius` is intentionally not themed (it's part of the brand geometry).
|
|
25
|
+
*/
|
|
26
|
+
/** One palette: every themable token as an `H S% L%` triple (no `hsl(...)`). */
|
|
27
|
+
export interface ThemeTokens {
|
|
28
|
+
background: string;
|
|
29
|
+
foreground: string;
|
|
30
|
+
card: string;
|
|
31
|
+
cardForeground: string;
|
|
32
|
+
popover: string;
|
|
33
|
+
popoverForeground: string;
|
|
34
|
+
primary: string;
|
|
35
|
+
primaryForeground: string;
|
|
36
|
+
secondary: string;
|
|
37
|
+
secondaryForeground: string;
|
|
38
|
+
muted: string;
|
|
39
|
+
mutedForeground: string;
|
|
40
|
+
accent: string;
|
|
41
|
+
accentForeground: string;
|
|
42
|
+
destructive: string;
|
|
43
|
+
destructiveForeground: string;
|
|
44
|
+
border: string;
|
|
45
|
+
input: string;
|
|
46
|
+
ring: string;
|
|
47
|
+
sheet1: string;
|
|
48
|
+
sheet1Foreground: string;
|
|
49
|
+
sheet2: string;
|
|
50
|
+
sheet2Foreground: string;
|
|
51
|
+
brand: string;
|
|
52
|
+
brandForeground: string;
|
|
53
|
+
brandSubtle: string;
|
|
54
|
+
}
|
|
55
|
+
/** Accent palettes are grouped in the picker so bold and soft hues don't mix.
|
|
56
|
+
* `gray` holds the whole-application gray accents (warm / neutral / cool). */
|
|
57
|
+
export type AccentGroup = 'gray' | 'bold' | 'pastel';
|
|
58
|
+
export interface Theme {
|
|
59
|
+
id: string;
|
|
60
|
+
/** i18n key for the display name (see messages `theme.*`). */
|
|
61
|
+
nameKey: string;
|
|
62
|
+
/** Picker grouping (default `bold`). */
|
|
63
|
+
group?: AccentGroup;
|
|
64
|
+
/** The neutral gray *temperature* this accent carries (warm / neutral / cool).
|
|
65
|
+
* Gray accents set it explicitly; coloured accents leave it `warm` (the
|
|
66
|
+
* warm-minimal brand). It's a property of the accent now, not a separate
|
|
67
|
+
* control — so picking "Cool" makes the whole app a cool gray. */
|
|
68
|
+
neutral?: NeutralFamily;
|
|
69
|
+
light: ThemeTokens;
|
|
70
|
+
dark: ThemeTokens;
|
|
71
|
+
}
|
|
72
|
+
export declare const DEFAULT_THEME_ID = "default";
|
|
73
|
+
export declare const themes: Theme[];
|
|
74
|
+
export declare const getTheme: (id: string) => Theme;
|
|
75
|
+
/** Resolve the OS color-scheme preference. */
|
|
76
|
+
export declare function getSystemColorScheme(): 'light' | 'dark';
|
|
77
|
+
/**
|
|
78
|
+
* The temperature of the neutral grays. The interface is always a gray; this
|
|
79
|
+
* only leans it warm or cool (or keeps it dead neutral). There's no longer a
|
|
80
|
+
* "tint the whole UI with the accent" option — that mechanism was removed.
|
|
81
|
+
*/
|
|
82
|
+
export type NeutralFamily = 'warm' | 'cool' | 'neutral';
|
|
83
|
+
/** 0 = off … 3 = strong. Shared scale for the interface- and control-intensity knobs. */
|
|
84
|
+
export type Level = 0 | 1 | 2 | 3;
|
|
85
|
+
/**
|
|
86
|
+
* The user's full appearance choice. `DEFAULT_APPEARANCE` reproduces the legacy
|
|
87
|
+
* palette exactly, so any field left at its default is a visual no-op.
|
|
88
|
+
*/
|
|
89
|
+
export interface AppearanceOptions {
|
|
90
|
+
/** Accent palette id (see {@link themes}). The accent also carries the neutral
|
|
91
|
+
* gray temperature — the gray accents (warm / neutral / cool) make the whole
|
|
92
|
+
* app that temperature; coloured accents stay warm. */
|
|
93
|
+
themeId: string;
|
|
94
|
+
/** How saturated the neutral surfaces are — also how strongly the sidebar
|
|
95
|
+
* sheets take the accent tint (the sidebar is always tinted; level 0 falls
|
|
96
|
+
* back to a flat neutral panel). */
|
|
97
|
+
interfaceIntensity: Level;
|
|
98
|
+
/** How colored the faded control surface (`--accent`) is. */
|
|
99
|
+
controlIntensity: Level;
|
|
100
|
+
/** Blur the canvas behind modal/search overlays. Off by default — it's a
|
|
101
|
+
* global preference, not a per-page one. */
|
|
102
|
+
blurOverlays?: boolean;
|
|
103
|
+
/** Optional page-canvas tint (a {@link PAGE_BACKGROUNDS} token). Mostly used
|
|
104
|
+
* per page; unset means the canvas keeps the theme's default `--background`. */
|
|
105
|
+
background?: string;
|
|
106
|
+
}
|
|
107
|
+
/** Soft full-canvas tints for the per-page "Background" control (token → HSL). */
|
|
108
|
+
export declare const PAGE_BACKGROUNDS: Record<string, {
|
|
109
|
+
light: string;
|
|
110
|
+
dark: string;
|
|
111
|
+
}>;
|
|
112
|
+
export declare const DEFAULT_APPEARANCE: AppearanceOptions;
|
|
113
|
+
/** A per-page override: any subset of the global appearance. */
|
|
114
|
+
export type AppearanceOverride = Partial<AppearanceOptions>;
|
|
115
|
+
/**
|
|
116
|
+
* Migrate a persisted (possibly older-shape) appearance to the current model:
|
|
117
|
+
* `tint`→`interfaceIntensity`, `accentIntensity`→`controlIntensity`, and the
|
|
118
|
+
* renamed gray theme ids. The old `neutral` temperature knob and the retired
|
|
119
|
+
* `tintedSidebar` toggle are dropped (the sidebar is always tinted now). Unknown
|
|
120
|
+
* keys are dropped by the `{...DEFAULT_APPEARANCE, ...}` merge at the call site.
|
|
121
|
+
*/
|
|
122
|
+
export declare function normalizeAppearance(raw: Record<string, unknown>): AppearanceOverride;
|
|
123
|
+
/** Merge a (possibly partial) override over a base, dropping undefined keys. */
|
|
124
|
+
export declare function mergeAppearance(base: AppearanceOptions, override?: AppearanceOverride | null): AppearanceOptions;
|
|
125
|
+
/**
|
|
126
|
+
* Fold an accent palette + the appearance knobs into a full token set for one
|
|
127
|
+
* color scheme. Pure (no DOM) so it powers both the global apply and the inline
|
|
128
|
+
* per-page style, and is unit-testable.
|
|
129
|
+
*/
|
|
130
|
+
export declare function composeAppearance(opts: AppearanceOptions, scheme: 'light' | 'dark'): ThemeTokens;
|
|
131
|
+
/** A composed appearance as a CSS-variable map, for use as an inline `style`. */
|
|
132
|
+
export declare function appearanceStyle(opts: AppearanceOptions, scheme: 'light' | 'dark'): Record<string, string>;
|
|
133
|
+
/** Write a composed appearance onto an element (defaults to the document root). */
|
|
134
|
+
export declare function applyAppearance(opts: AppearanceOptions, scheme: 'light' | 'dark', target?: HTMLElement): void;
|
|
135
|
+
/** Write a theme's palette (for the given scheme) onto the document root.
|
|
136
|
+
* Legacy entry point — prefer {@link applyAppearance}. */
|
|
137
|
+
export declare function applyTheme(theme: Theme, scheme: 'light' | 'dark'): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure logic for sidebar drag-and-drop: given the flat page list and a drop
|
|
3
|
+
* (drag page X onto page Y, `before` / `after` / `inside`), compute the new
|
|
4
|
+
* parent and the reordered sibling list to send to the server's `movePage`.
|
|
5
|
+
*
|
|
6
|
+
* Kept free of React/DOM so it can be unit-tested directly (`treeMove.test.ts`);
|
|
7
|
+
* the DnD glue lives in `components/ui/tree.tsx`.
|
|
8
|
+
*/
|
|
9
|
+
import type { PageMeta } from '@book.dev/sdk';
|
|
10
|
+
/** Where a row was dropped relative to the target row. */
|
|
11
|
+
export type DropWhere = 'before' | 'after' | 'inside';
|
|
12
|
+
export interface MovePlan {
|
|
13
|
+
/** The dragged page's new parent (`null` = top level). */
|
|
14
|
+
parentId: string | null;
|
|
15
|
+
/** The full ordered list of sibling ids under `parentId`, including the dragged page. */
|
|
16
|
+
orderedIds: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the move, or `null` when it's invalid (dropping a page onto itself, or
|
|
20
|
+
* nesting it inside its own subtree — which would create a cycle). The server
|
|
21
|
+
* enforces the same cycle rule; this just avoids a doomed round-trip and lets
|
|
22
|
+
* the UI suppress the drop indicator.
|
|
23
|
+
*/
|
|
24
|
+
export declare function planTreeMove(pages: PageMeta[], draggedId: string, targetId: string, where: DropWhere): MovePlan | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useModifierHeld(): boolean;
|