@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Eliot Lim
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { J as e, Mt as t, i as n, n as r, t as i } from "./lucideIcons-B6pmC-WQ.js";
|
|
2
|
+
import { useMemo as a, useRef as o, useState as s } from "react";
|
|
3
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
4
|
+
import { search as d } from "node-emoji";
|
|
5
|
+
//#region src/lib/emoji.ts
|
|
6
|
+
function f(e, t = 8) {
|
|
7
|
+
let n = e.trim().toLowerCase();
|
|
8
|
+
return n ? d(n).slice().sort((e, t) => p(e.name, n) - p(t.name, n)).slice(0, t) : [];
|
|
9
|
+
}
|
|
10
|
+
function p(e, t) {
|
|
11
|
+
return e === t ? 0 : e.startsWith(t) ? 1 : 2;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/lib/emojiData.ts
|
|
15
|
+
var m = [
|
|
16
|
+
{
|
|
17
|
+
id: "smileys",
|
|
18
|
+
icon: "😀",
|
|
19
|
+
emojis: /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😙.😋.😛.😜.🤪.😝.🤑.🤗.🤭.🤫.🤔.🤐.🤨.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🤧.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.😻.😼.🙀".split(".")
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "people",
|
|
23
|
+
icon: "👋",
|
|
24
|
+
emojis: /* @__PURE__ */ "👋.🤚.🖐️.✋.🖖.👌.🤏.✌️.🤞.🤟.🤘.🤙.👈.👉.👆.👇.☝️.👍.👎.✊.👊.🤛.🤜.👏.🙌.👐.🤲.🤝.🙏.✍️.💪.🦾.🧠.👀.👁️.👂.👃.👄.👶.🧒.👦.👧.🧑.👨.👩.🧓.👴.👵.🙇.🙆.🙅.💁.🙋.🤦.🤷.👮.🕵️.💂.👷.🤴.👸.🧑🎓.🧑🏫.🧑💻.🧑🔬.🧑🎨.🧑🚀.🧑🚒.🦸.🦹.🧙.🧚.👼.🎅.🤶.💃.🕺.👯.🚶.🏃.🧗.🏌️.🏄.🚴".split(".")
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "nature",
|
|
28
|
+
icon: "🐶",
|
|
29
|
+
emojis: /* @__PURE__ */ "🐶.🐱.🐭.🐹.🐰.🦊.🐻.🐼.🐨.🐯.🦁.🐮.🐷.🐸.🐵.🐔.🐧.🐦.🐤.🦆.🦅.🦉.🦇.🐺.🐗.🐴.🦄.🐝.🐛.🦋.🐌.🐞.🐜.🦗.🕷️.🦂.🐢.🐍.🦎.🦖.🦕.🐙.🦑.🦐.🦀.🐡.🐠.🐟.🐬.🐳.🐋.🦈.🐊.🐅.🐆.🦓.🦍.🐘.🦏.🐪.🐫.🦒.🐃.🐄.🐎.🐖.🐏.🐑.🐐.🦌.🐕.🐈.🌵.🎄.🌲.🌳.🌴.🌱.🌿.☘️.🍀.🎍.🍂.🍁.🍄.🌾.💐.🌷.🌹.🌺.🌸.🌼.🌻.🌞.🌝.🌛.⭐.🌟.✨.⚡.☄️.🔥.🌈.☀️.⛅.☁️.❄️.💧".split(".")
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "food",
|
|
33
|
+
icon: "🍎",
|
|
34
|
+
emojis: /* @__PURE__ */ "🍏.🍎.🍐.🍊.🍋.🍌.🍉.🍇.🍓.🫐.🍈.🍒.🍑.🥭.🍍.🥥.🥝.🍅.🍆.🥑.🥦.🥬.🥒.🌶️.🌽.🥕.🧄.🧅.🥔.🍠.🥐.🍞.🥖.🥨.🧀.🥚.🍳.🧈.🥞.🧇.🥓.🥩.🍗.🍖.🌭.🍔.🍟.🍕.🥪.🌮.🌯.🥙.🍜.🍲.🍛.🍣.🍱.🥟.🍤.🍙.🍚.🍘.🍥.🥠.🍢.🍡.🍧.🍨.🍦.🥧.🧁.🍰.🎂.🍮.🍭.🍬.🍫.🍿.🍩.🍪.🌰.🥜.🍯.🥛.☕.🍵.🧃.🥤.🍶.🍺.🍻.🥂.🍷.🥃.🍸.🍹".split(".")
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "activity",
|
|
38
|
+
icon: "⚽",
|
|
39
|
+
emojis: /* @__PURE__ */ "⚽.🏀.🏈.⚾.🥎.🎾.🏐.🏉.🥏.🎱.🏓.🏸.🥅.🏒.🏑.🥍.🏏.⛳.🏹.🎣.🥊.🥋.🎽.⛸️.🥌.🛷.🎿.⛷️.🏂.🏋️.🤼.🤸.⛹️.🤾.🏌️.🏇.🧘.🏄.🏊.🤽.🚣.🧗.🚵.🚴.🏆.🥇.🥈.🥉.🏅.🎖️.🏵️.🎗️.🎫.🎟️.🎪.🤹.🎭.🎨.🎬.🎤.🎧.🎼.🎹.🥁.🎷.🎺.🎸.🪕.🎻.🎲.♟️.🎯.🎳.🎮.🎰.🧩.🎈.🎉.🎊.🎁.🎀.🪅.🎏.🎐".split(".")
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "travel",
|
|
43
|
+
icon: "🚀",
|
|
44
|
+
emojis: /* @__PURE__ */ "🚗.🚕.🚙.🚌.🚎.🏎️.🚓.🚑.🚒.🚐.🚚.🚛.🚜.🛴.🚲.🛵.🏍️.🚨.🚔.🚍.🚘.🚖.🚡.🚠.🚟.🚃.🚋.🚞.🚝.🚄.🚅.🚈.🚂.🚆.🚇.🚊.🚉.✈️.🛫.🛬.🛩️.💺.🛰️.🚀.🛸.🚁.🛶.⛵.🚤.🛥️.🛳️.⛴️.🚢.⚓.🚧.⛽.🚏.🗺️.🗿.🗽.🗼.🏰.🏯.🏟️.🎡.🎢.🎠.⛲.⛱️.🏖️.🏝️.🏜️.🌋.⛰️.🏔️.🗻.🏕️.⛺.🏠.🏡.🏘️.🏚️.🏗️.🏭.🏢.🏬.🏣.🏤.🏥.🏦.🏨.🏪.🏫.🏩.💒.🏛️.⛪.🕌.🕍.🛕.🌃.🌆.🌇.🌉.🌁.🌐.🗾.🧭".split(".")
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "objects",
|
|
48
|
+
icon: "💡",
|
|
49
|
+
emojis: /* @__PURE__ */ "⌚.📱.💻.⌨️.🖥️.🖨️.🖱️.💽.💾.💿.📀.🎥.📷.📸.📹.📼.🔍.🔎.🕯️.💡.🔦.🏮.📔.📕.📖.📗.📘.📙.📚.📓.📒.📃.📜.📄.📰.🗞️.📑.🔖.🏷️.💰.💴.💵.💶.💷.💸.💳.🧾.✉️.📧.📨.📩.📤.📥.📦.📫.📪.📬.📭.📮.✏️.✒️.🖋️.🖊️.🖌️.🖍️.📝.💼.📁.📂.🗂️.📅.📆.🗒️.🗓️.📇.📈.📉.📊.📋.📌.📍.📎.🖇️.📏.📐.✂️.🗃️.🗄️.🗑️.🔒.🔓.🔏.🔐.🔑.🗝️.🔨.🪓.⛏️.⚒️.🛠️.🗡️.⚔️.🔧.🔩.⚙️.🧰.🧲.⚗️.🧪.🧫.🧬.🔬.🔭.📡.💉.🩺.💊.🩹.🚪.🛏️".split(".")
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "symbols",
|
|
53
|
+
icon: "❤️",
|
|
54
|
+
emojis: /* @__PURE__ */ "❤️.🧡.💛.💚.💙.💜.🖤.🤍.🤎.💔.❣️.💕.💞.💓.💗.💖.💘.💝.💟.☮️.✝️.☪️.🕉️.☸️.✡️.🔯.🕎.☯️.☦️.⛎.♈.♉.♊.♋.♌.♍.♎.♏.♐.♑.♒.♓.🆔.⚛️.🉑.☢️.☣️.📴.✅.❌.❎.➕.➖.➗.✖️.♾️.‼️.⁉️.❓.❔.❕.❗.〰️.⚠️.🚸.🔱.⚜️.🔰.♻️.✳️.❇️.⭐.🌟.💫.⭕.🔴.🟠.🟡.🟢.🔵.🟣.🟤.⚫.⚪.🔺.🔻.🔸.🔹.🔶.🔷.🔳.🔲.▪️.▫️.◼️.◻️.🏁.🚩.🎌.🏴.🏳️.🏳️🌈.🔔.🔕.🎵.🎶.💬.💭".split(".")
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
Array.from(new Set(m.flatMap((e) => e.emojis)));
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/lib/iconRecents.ts
|
|
60
|
+
var h = "openbook.iconRecents", g = 24;
|
|
61
|
+
function _() {
|
|
62
|
+
if (typeof localStorage > "u") return [];
|
|
63
|
+
try {
|
|
64
|
+
let e = localStorage.getItem(h), t = e ? JSON.parse(e) : [];
|
|
65
|
+
return Array.isArray(t) ? t.filter((e) => typeof e == "string").slice(0, g) : [];
|
|
66
|
+
} catch {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function v(e) {
|
|
71
|
+
if (!(typeof localStorage > "u" || !e)) try {
|
|
72
|
+
let t = [e, ..._().filter((t) => t !== e)].slice(0, g);
|
|
73
|
+
localStorage.setItem(h, JSON.stringify(t));
|
|
74
|
+
} catch {}
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/components/EmojiGrid.tsx
|
|
78
|
+
function y({ value: t, onPick: n }) {
|
|
79
|
+
let { t: r } = e(), [i, a] = s(t?.startsWith("lucide:") ? "icon" : "emoji"), [c, d] = s(""), f = o(_()).current;
|
|
80
|
+
return /* @__PURE__ */ u("div", {
|
|
81
|
+
className: "flex h-[372px] w-[332px] flex-col bg-popover text-popover-foreground",
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ u("div", {
|
|
84
|
+
className: "flex items-center gap-1 p-2 pb-1.5",
|
|
85
|
+
children: [/* @__PURE__ */ l(b, {
|
|
86
|
+
active: i === "emoji",
|
|
87
|
+
onClick: () => a("emoji"),
|
|
88
|
+
label: r("emoji.tabEmoji")
|
|
89
|
+
}), /* @__PURE__ */ l(b, {
|
|
90
|
+
active: i === "icon",
|
|
91
|
+
onClick: () => a("icon"),
|
|
92
|
+
label: r("emoji.tabIcons")
|
|
93
|
+
})]
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ l("div", {
|
|
96
|
+
className: "px-2 pb-2",
|
|
97
|
+
children: /* @__PURE__ */ l("input", {
|
|
98
|
+
autoFocus: !0,
|
|
99
|
+
value: c,
|
|
100
|
+
onChange: (e) => d(e.target.value),
|
|
101
|
+
placeholder: r(i === "emoji" ? "emoji.searchEmoji" : "emoji.searchIcons"),
|
|
102
|
+
className: "h-8 w-full rounded-md border border-input bg-background px-2.5 text-sm outline-hidden placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
103
|
+
"aria-label": r("emoji.search")
|
|
104
|
+
})
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ l("div", {
|
|
107
|
+
className: "min-h-0 flex-1 overflow-y-auto px-2 pb-2",
|
|
108
|
+
children: l(i === "emoji" ? w : E, {
|
|
109
|
+
query: c,
|
|
110
|
+
recents: f,
|
|
111
|
+
current: t,
|
|
112
|
+
onPick: (e) => {
|
|
113
|
+
v(e), n(e);
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function b({ active: e, onClick: n, label: r }) {
|
|
121
|
+
return /* @__PURE__ */ l("button", {
|
|
122
|
+
type: "button",
|
|
123
|
+
onClick: n,
|
|
124
|
+
className: t("flex-1 cursor-pointer rounded-md px-2.5 py-1 text-sm font-medium transition-colors", e ? "bg-accent text-accent-foreground" : "text-muted-foreground hover:bg-hover"),
|
|
125
|
+
children: r
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function x({ children: e }) {
|
|
129
|
+
return /* @__PURE__ */ l("div", {
|
|
130
|
+
className: "sticky top-0 z-10 bg-popover px-1 pb-1 pt-1.5 text-xs font-medium uppercase tracking-wide text-muted-foreground/70",
|
|
131
|
+
children: e
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
var S = "grid grid-cols-8 gap-0.5";
|
|
135
|
+
function C({ glyph: e, active: n, onPick: r }) {
|
|
136
|
+
return /* @__PURE__ */ l("button", {
|
|
137
|
+
type: "button",
|
|
138
|
+
onClick: () => r(e),
|
|
139
|
+
className: t("flex h-9 w-9 items-center justify-center rounded-md text-[20px] leading-none transition-colors hover:bg-hover", n && "bg-accent ring-1 ring-primary"),
|
|
140
|
+
title: e,
|
|
141
|
+
children: e
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function w({ query: t, recents: r, current: i, onPick: o }) {
|
|
145
|
+
let { t: s } = e(), d = a(() => t.trim() ? f(t, 64).map((e) => e.emoji) : null, [t]), p = r.filter((e) => !e.startsWith(n));
|
|
146
|
+
return d ? d.length === 0 ? /* @__PURE__ */ l(D, { text: s("emoji.noResults") }) : /* @__PURE__ */ l("div", {
|
|
147
|
+
className: S,
|
|
148
|
+
children: d.map((e, t) => /* @__PURE__ */ l(C, {
|
|
149
|
+
glyph: e,
|
|
150
|
+
active: e === i,
|
|
151
|
+
onPick: o
|
|
152
|
+
}, `${e}-${t}`))
|
|
153
|
+
}) : /* @__PURE__ */ u(c, { children: [p.length > 0 && /* @__PURE__ */ u("section", { children: [/* @__PURE__ */ l(x, { children: s("emoji.recent") }), /* @__PURE__ */ l("div", {
|
|
154
|
+
className: S,
|
|
155
|
+
children: p.map((e, t) => /* @__PURE__ */ l(C, {
|
|
156
|
+
glyph: e,
|
|
157
|
+
active: e === i,
|
|
158
|
+
onPick: o
|
|
159
|
+
}, `r-${e}-${t}`))
|
|
160
|
+
})] }), m.map((e) => /* @__PURE__ */ u("section", { children: [/* @__PURE__ */ l(x, { children: s(`emoji.cat.${e.id}`) }), /* @__PURE__ */ l("div", {
|
|
161
|
+
className: S,
|
|
162
|
+
children: e.emojis.map((t, n) => /* @__PURE__ */ l(C, {
|
|
163
|
+
glyph: t,
|
|
164
|
+
active: t === i,
|
|
165
|
+
onPick: o
|
|
166
|
+
}, `${e.id}-${t}-${n}`))
|
|
167
|
+
})] }, e.id))] });
|
|
168
|
+
}
|
|
169
|
+
function T({ name: e, active: r, onPick: a }) {
|
|
170
|
+
let o = i[e];
|
|
171
|
+
return o ? /* @__PURE__ */ l("button", {
|
|
172
|
+
type: "button",
|
|
173
|
+
onClick: () => a(`${n}${e}`),
|
|
174
|
+
className: t("flex h-9 w-9 items-center justify-center rounded-md text-foreground transition-colors hover:bg-hover", r && "bg-accent ring-1 ring-primary"),
|
|
175
|
+
title: e,
|
|
176
|
+
"aria-label": e,
|
|
177
|
+
children: /* @__PURE__ */ l(o, { className: "h-[18px] w-[18px]" })
|
|
178
|
+
}) : null;
|
|
179
|
+
}
|
|
180
|
+
function E({ query: t, recents: o, current: s, onPick: d }) {
|
|
181
|
+
let { t: f } = e(), p = t.trim().toLowerCase(), m = a(() => p ? r.filter((e) => e.toLowerCase().includes(p)) : r, [p]), h = s?.startsWith("lucide:") ? s.slice(n.length) : void 0, g = o.filter((e) => e.startsWith(n)).map((e) => e.slice(n.length)).filter((e) => i[e]);
|
|
182
|
+
return m.length === 0 ? /* @__PURE__ */ l(D, { text: f("emoji.noResults") }) : /* @__PURE__ */ u(c, { children: [!p && g.length > 0 && /* @__PURE__ */ u("section", { children: [/* @__PURE__ */ l(x, { children: f("emoji.recent") }), /* @__PURE__ */ l("div", {
|
|
183
|
+
className: S,
|
|
184
|
+
children: g.map((e, t) => /* @__PURE__ */ l(T, {
|
|
185
|
+
name: e,
|
|
186
|
+
active: e === h,
|
|
187
|
+
onPick: d
|
|
188
|
+
}, `r-${e}-${t}`))
|
|
189
|
+
})] }), /* @__PURE__ */ u("section", { children: [!p && /* @__PURE__ */ l(x, { children: f("emoji.tabIcons") }), /* @__PURE__ */ l("div", {
|
|
190
|
+
className: S,
|
|
191
|
+
children: m.map((e) => /* @__PURE__ */ l(T, {
|
|
192
|
+
name: e,
|
|
193
|
+
active: e === h,
|
|
194
|
+
onPick: d
|
|
195
|
+
}, e))
|
|
196
|
+
})] })] });
|
|
197
|
+
}
|
|
198
|
+
function D({ text: e }) {
|
|
199
|
+
return /* @__PURE__ */ l("div", {
|
|
200
|
+
className: "flex h-24 items-center justify-center text-sm text-muted-foreground",
|
|
201
|
+
children: e
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
export { y as default };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type * as Y from 'yjs';
|
|
3
|
+
import { type BlockMap, type BlockType } from './model';
|
|
4
|
+
import { type SlashState } from './SlashMenu';
|
|
5
|
+
import { type BlockEditorController } from './useBlockEditor';
|
|
6
|
+
import type { InlineAttrs } from './model';
|
|
7
|
+
/**
|
|
8
|
+
* The block editor root: renders the block tree, owns the transient UI
|
|
9
|
+
* (slash menu, inline toolbar, drag state, block selection), and routes
|
|
10
|
+
* structural keyboard commands. Pure UI — all document state lives in the
|
|
11
|
+
* Y.Doc handed in by the caller.
|
|
12
|
+
*/
|
|
13
|
+
/** Shared UI surface text blocks call into (menus, formatting, drag). */
|
|
14
|
+
export interface EditorUI {
|
|
15
|
+
slash: SlashState;
|
|
16
|
+
mention: SlashState;
|
|
17
|
+
spellcheck: boolean;
|
|
18
|
+
openSlash(blockId: string, anchorOffset: number): void;
|
|
19
|
+
updateSlash(caret: number): void;
|
|
20
|
+
closeSlash(): void;
|
|
21
|
+
slashKey(key: string): void;
|
|
22
|
+
openMention(blockId: string, anchorOffset: number): void;
|
|
23
|
+
updateMention(caret: number): void;
|
|
24
|
+
closeMention(): void;
|
|
25
|
+
mentionKey(key: string): void;
|
|
26
|
+
toggleFormat(key: keyof InlineAttrs, value?: string): void;
|
|
27
|
+
scheduleToolbar(): void;
|
|
28
|
+
}
|
|
29
|
+
export type DropRegion = 'above' | 'below' | 'left' | 'right';
|
|
30
|
+
interface DragState {
|
|
31
|
+
id: string;
|
|
32
|
+
over: {
|
|
33
|
+
id: string;
|
|
34
|
+
region: DropRegion;
|
|
35
|
+
} | null;
|
|
36
|
+
}
|
|
37
|
+
export declare const BlockEditor: React.FC<{
|
|
38
|
+
doc: Y.Doc;
|
|
39
|
+
readOnly?: boolean;
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
/** Widen the content column to the container (page "full width" mode). */
|
|
42
|
+
fullWidth?: boolean;
|
|
43
|
+
/** Trim the tall click-to-append bottom padding (pages with content below
|
|
44
|
+
* the editor, e.g. a hosted database view). */
|
|
45
|
+
compact?: boolean;
|
|
46
|
+
/** Spellcheck text blocks while typing (user preference). */
|
|
47
|
+
spellcheck?: boolean;
|
|
48
|
+
/** The page hosting this editor — powers the "New page/database" commands. */
|
|
49
|
+
pageId?: string;
|
|
50
|
+
}>;
|
|
51
|
+
export interface RowShared {
|
|
52
|
+
editor: BlockEditorController;
|
|
53
|
+
ui: EditorUI;
|
|
54
|
+
drag: DragState | null;
|
|
55
|
+
setDrag: React.Dispatch<React.SetStateAction<DragState | null>>;
|
|
56
|
+
performDrop: (sourceId: string, targetId: string, region: DropRegion) => void;
|
|
57
|
+
computeRegion: (e: React.DragEvent | React.PointerEvent, el: HTMLElement, allowSides: boolean) => DropRegion;
|
|
58
|
+
depth: number;
|
|
59
|
+
/** Type of the block whose children these rows are (null at the root) — a
|
|
60
|
+
* side-drop is offered at the root and inside columns (to create / grow a
|
|
61
|
+
* columns layout), but not inside groups or tables. */
|
|
62
|
+
container: BlockType | null;
|
|
63
|
+
}
|
|
64
|
+
/** One block row: hover gutter (add + drag handle), drop targeting, dispatch. */
|
|
65
|
+
export declare const BlockRow: React.FC<RowShared & {
|
|
66
|
+
block: BlockMap;
|
|
67
|
+
}>;
|
|
68
|
+
export default BlockEditor;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type BlockMap } from './model';
|
|
3
|
+
import type { BlockEditorController } from './useBlockEditor';
|
|
4
|
+
import type { EditorUI } from './BlockEditor';
|
|
5
|
+
/**
|
|
6
|
+
* The code block, unified with live computation (the old formula block): a
|
|
7
|
+
* toolbar with show/hide · run · copy, and a ⚙ that opens the same settings
|
|
8
|
+
* popover every kit block uses — variable name, language, and the *live* toggle.
|
|
9
|
+
* Live = the code evaluates over the document's reactive scope (inputs + every
|
|
10
|
+
* named live block above it) and publishes under a name later live blocks,
|
|
11
|
+
* charts, status lights and formulas can reference. Off = an ordinary snippet,
|
|
12
|
+
* whose name (if any) is a *filename* — name one `openbook.json` and the page
|
|
13
|
+
* becomes an exportable plugin (see plugins/pagePlugin.ts).
|
|
14
|
+
*/
|
|
15
|
+
export declare const CodeBlockView: React.FC<{
|
|
16
|
+
block: BlockMap;
|
|
17
|
+
editor: BlockEditorController;
|
|
18
|
+
ui: EditorUI;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InlineAttrs } from './model';
|
|
3
|
+
/**
|
|
4
|
+
* The floating formatting toolbar shown over a non-collapsed text selection.
|
|
5
|
+
* Buttons use mousedown + preventDefault so the document selection survives
|
|
6
|
+
* the click (the toolbar lives outside the contenteditable).
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolbarState {
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
active: Partial<Record<keyof InlineAttrs, boolean>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const InlineToolbar: React.FC<{
|
|
14
|
+
state: ToolbarState;
|
|
15
|
+
onToggle: (key: keyof InlineAttrs, value?: string) => void;
|
|
16
|
+
/** Set (or, with `null`, clear) a colour on the selection. */
|
|
17
|
+
onColor: (key: 'tc' | 'hl', token: string | null) => void;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type PageLinkResult } from '@/lib/pageLinks';
|
|
3
|
+
/**
|
|
4
|
+
* The page/database link picker: a small search popover that the "Link to
|
|
5
|
+
* page" / "Link to database" slash commands open. It searches existing pages
|
|
6
|
+
* (optionally only those hosting a database) through the {@link pageLinks}
|
|
7
|
+
* bridge — the same source the EditorJS `@`-mention uses — so it works whether
|
|
8
|
+
* or not the editor sits inside the navigation provider. Picking inserts an
|
|
9
|
+
* inline page-link mention where the command was typed.
|
|
10
|
+
*/
|
|
11
|
+
export declare const LinkPicker: React.FC<{
|
|
12
|
+
kind: 'page' | 'database';
|
|
13
|
+
anchorEl: HTMLElement | null;
|
|
14
|
+
onPick: (result: PageLinkResult) => void;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type PageLinkResult } from '@/lib/pageLinks';
|
|
3
|
+
import type { SlashState } from './SlashMenu';
|
|
4
|
+
import type { BlockEditorController } from './useBlockEditor';
|
|
5
|
+
export declare const MentionMenu: React.FC<{
|
|
6
|
+
state: SlashState;
|
|
7
|
+
editor: BlockEditorController;
|
|
8
|
+
anchorEl: HTMLElement | null;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
/** Insert a page mention chip at the offset where "@" was typed. */
|
|
11
|
+
onMentionPage: (blockId: string, anchorOffset: number, page: PageLinkResult) => void;
|
|
12
|
+
/** Insert plain text (a date or a person name) at that offset. */
|
|
13
|
+
onInsertText: (blockId: string, anchorOffset: number, text: string) => void;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Y from 'yjs';
|
|
3
|
+
import { type BlockMap } from './model';
|
|
4
|
+
/**
|
|
5
|
+
* Render a list of blocks from a page's live doc, read-only but with interactive
|
|
6
|
+
* widgets still operable — the surface Present mode uses for slides, the next-
|
|
7
|
+
* slide preview, and the speaker-notes panel.
|
|
8
|
+
*
|
|
9
|
+
* It reuses the editor's {@link BlockRow} (every block type, widgets, reactivity)
|
|
10
|
+
* inside a locked {@link KitLockContext}: `BlockBody` makes text and structure
|
|
11
|
+
* read-only while widgets carrying `interactive` (the default) stay live.
|
|
12
|
+
* Reactivity is doc-global (`computeScope` reads the doc), so charts and formulas
|
|
13
|
+
* track widget changes across the whole deck. Editing chrome (gutters, the kit
|
|
14
|
+
* gear, slash) is hidden by `.ob-present` CSS.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PresentBlocks: React.FC<{
|
|
17
|
+
doc: Y.Doc;
|
|
18
|
+
blocks: BlockMap[];
|
|
19
|
+
className?: string;
|
|
20
|
+
}>;
|
|
21
|
+
export default PresentBlocks;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TextRun } from './model';
|
|
3
|
+
export interface RichTextEditorProps {
|
|
4
|
+
/** Current value as runs. Re-seeds the surface only when `seed` changes. */
|
|
5
|
+
value: TextRun[];
|
|
6
|
+
onChange: (runs: TextRun[]) => void;
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Identity token: the surface re-renders its HTML from `value` whenever this
|
|
12
|
+
* changes (e.g. bump it to clear the composer after posting a comment). When
|
|
13
|
+
* stable, the DOM stays the source of truth while editing.
|
|
14
|
+
*/
|
|
15
|
+
seed?: string | number;
|
|
16
|
+
}
|
|
17
|
+
export declare const RichTextEditor: React.FC<RichTextEditorProps>;
|
|
18
|
+
/** TextRun[] → simple inline HTML (b/i/u/links) for the editable surface. */
|
|
19
|
+
export declare function runsToHtml(runs: TextRun[]): string;
|
|
20
|
+
/** Read a contentEditable surface back into TextRun[] (b/i/u/links survive). */
|
|
21
|
+
export declare function domToRuns(root: HTMLElement): TextRun[];
|
|
22
|
+
/** Whether a runs array has any visible text (for "post" button enablement). */
|
|
23
|
+
export declare const runsHaveText: (runs: TextRun[]) => boolean;
|
|
24
|
+
/** Render runs to read-only inline HTML for displaying a posted comment. */
|
|
25
|
+
export declare const RichTextView: React.FC<{
|
|
26
|
+
runs: TextRun[];
|
|
27
|
+
className?: string;
|
|
28
|
+
}>;
|
|
29
|
+
export default RichTextEditor;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BlockEditorController } from './useBlockEditor';
|
|
3
|
+
type IconComp = React.ComponentType<{
|
|
4
|
+
className?: string;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* The “/” command menu: filters as the user keeps typing after the slash,
|
|
8
|
+
* arrow keys + Enter pick (keys are forwarded from the focused text block via
|
|
9
|
+
* `state.keyEvent` so the caret never leaves the document), and applying a
|
|
10
|
+
* command removes the typed “/query” before transforming or inserting.
|
|
11
|
+
*/
|
|
12
|
+
export interface SlashState {
|
|
13
|
+
open: boolean;
|
|
14
|
+
blockId: string;
|
|
15
|
+
/** Offset of the '/' character inside the block's text. */
|
|
16
|
+
anchorOffset: number;
|
|
17
|
+
query: string;
|
|
18
|
+
index: number;
|
|
19
|
+
keyEvent?: {
|
|
20
|
+
key: string;
|
|
21
|
+
n: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Slash-menu categories, in display order. */
|
|
25
|
+
export type SlashGroup = 'pages' | 'basic' | 'interactive' | 'extensions' | 'ai';
|
|
26
|
+
interface SlashItem {
|
|
27
|
+
id: string;
|
|
28
|
+
label: string;
|
|
29
|
+
hint: string;
|
|
30
|
+
keywords: string;
|
|
31
|
+
group: SlashGroup;
|
|
32
|
+
apply: (editor: BlockEditorController, blockId: string) => void;
|
|
33
|
+
/** When set, the command opens the link picker instead of applying inline. */
|
|
34
|
+
picker?: 'page' | 'database';
|
|
35
|
+
icon?: IconComp;
|
|
36
|
+
}
|
|
37
|
+
export declare const SLASH_ITEMS: SlashItem[];
|
|
38
|
+
export declare const SlashMenu: React.FC<{
|
|
39
|
+
state: SlashState;
|
|
40
|
+
editor: BlockEditorController;
|
|
41
|
+
anchorEl: HTMLElement | null;
|
|
42
|
+
rootEl: HTMLElement | null;
|
|
43
|
+
onClose: () => void;
|
|
44
|
+
/** The page hosting this editor — enables the "New page/database" commands. */
|
|
45
|
+
pageId?: string;
|
|
46
|
+
/** Open the link picker for a "Link to page/database" command. */
|
|
47
|
+
onLink?: (kind: 'page' | 'database', blockId: string, anchorOffset: number) => void;
|
|
48
|
+
}>;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type BlockMap } from './model';
|
|
3
|
+
import type { BlockEditorController } from './useBlockEditor';
|
|
4
|
+
import type { EditorUI } from './BlockEditor';
|
|
5
|
+
export declare const TextBlockView: React.FC<{
|
|
6
|
+
block: BlockMap;
|
|
7
|
+
editor: BlockEditorController;
|
|
8
|
+
ui: EditorUI;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockEditorController } from './useBlockEditor';
|
|
2
|
+
export interface AiSlashItem {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
hint: string;
|
|
6
|
+
keywords: string;
|
|
7
|
+
apply: (editor: BlockEditorController, blockId: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function aiSlashItems(): AiSlashItem[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared editor colour palette — a small set of named tints used for both
|
|
3
|
+
* block colours (background `bg` / text `fg` props) and inline text runs
|
|
4
|
+
* (highlight `hl` / text-colour `tc` attributes). Tokens (not raw hex) are
|
|
5
|
+
* stored in the document and rendered as CSS classes (`obe-fg-*`, `obe-bg-*`,
|
|
6
|
+
* `obe-hl-*`), so every colour adapts to light and dark themes via index.css.
|
|
7
|
+
*/
|
|
8
|
+
export interface ColorToken {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const COLOR_TOKENS: readonly ColorToken[];
|
|
13
|
+
/** Whether `v` is one of the known palette tokens (guards class names). */
|
|
14
|
+
export declare const isColorToken: (v: string | undefined | null) => v is string;
|
|
15
|
+
/**
|
|
16
|
+
* Concrete light-theme hex for each token — used by the **exports** (HTML/PDF),
|
|
17
|
+
* which are self-contained and can't reference the editor's theme-adaptive CSS
|
|
18
|
+
* classes. `fg` colours text (`tc`); `hl` tints a highlight (`hl`).
|
|
19
|
+
*/
|
|
20
|
+
export declare const COLOR_EXPORT_HEX: Record<string, {
|
|
21
|
+
fg: string;
|
|
22
|
+
hl: string;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BlockJSON } from './model';
|
|
2
|
+
import { type ExportCell } from './kit/scope';
|
|
3
|
+
/** Render block JSON to clean semantic HTML (one string, no wrapper). */
|
|
4
|
+
export declare function blocksToHtml(blocks: BlockJSON[]): string;
|
|
5
|
+
/** Render block JSON to GitHub-flavoured Markdown. */
|
|
6
|
+
export declare function blocksToMarkdown(blocks: BlockJSON[]): string;
|
|
7
|
+
interface EditorJsOut {
|
|
8
|
+
blocks: Array<{
|
|
9
|
+
id?: string;
|
|
10
|
+
type: string;
|
|
11
|
+
data: Record<string, unknown>;
|
|
12
|
+
}>;
|
|
13
|
+
values: Array<[string, unknown]>;
|
|
14
|
+
names: Array<[string, string]>;
|
|
15
|
+
}
|
|
16
|
+
export declare function blocksToEditorJs(blocks: BlockJSON[], computed?: Map<string, ExportCell>): EditorJsOut;
|
|
17
|
+
/** Snapshot-level normalization: pages written by the block editor project
|
|
18
|
+
* into the EditorJS shape; everything else passes through untouched. Export
|
|
19
|
+
* entry points call this so mixed trees (an EditorJS parent linking block
|
|
20
|
+
* subpages, or vice versa) export every page faithfully. */
|
|
21
|
+
export declare function blockSnapshotToEditorJs<T extends {
|
|
22
|
+
editor?: string;
|
|
23
|
+
blockdoc?: unknown;
|
|
24
|
+
}>(snapshot: T): T;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight, dependency-free syntax highlighting for code blocks.
|
|
3
|
+
*
|
|
4
|
+
* The editor owns the contenteditable DOM imperatively (see richtext.ts): the
|
|
5
|
+
* rendered HTML's character stream has to stay an exact image of the Y.Text
|
|
6
|
+
* string, because a caret is just "the number of characters before it". So the
|
|
7
|
+
* highlighter only ever *wraps* runs in `<span>` — it never adds, drops, or
|
|
8
|
+
* reorders a character — and newlines stay `<br>` (which the caret mapping
|
|
9
|
+
* counts as one char). Tokenising is deliberately approximate: one pass of a
|
|
10
|
+
* few regexes over a broad keyword union. A mis-tinted identifier is harmless;
|
|
11
|
+
* a shifted caret is not.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Escape text for `innerHTML` so it round-trips the browser's own serializer:
|
|
15
|
+
* `&`, `<`, `>` and U+00A0 are escaped and newlines become `<br>`, but quotes
|
|
16
|
+
* are left alone. Browsers do *not* entity-escape quotes inside text content,
|
|
17
|
+
* so escaping them here would make our generated HTML differ from `el.innerHTML`
|
|
18
|
+
* on every render — which, on a caret-less re-render (a live recompute, an
|
|
19
|
+
* autosave), would needlessly rewrite the DOM and drop the caret to the start.
|
|
20
|
+
*/
|
|
21
|
+
export declare function escapeText(s: string): string;
|
|
22
|
+
/** Escape a value destined for a double-quoted HTML attribute. */
|
|
23
|
+
export declare function escapeAttr(s: string): string;
|
|
24
|
+
/** Render `src` to highlighted HTML whose character stream equals `src` exactly. */
|
|
25
|
+
export declare function highlightCode(src: string, language?: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { BlockEditor } from './BlockEditor';
|
|
2
|
+
export { useBlockEditor } from './useBlockEditor';
|
|
3
|
+
export { connectBroadcast, type BroadcastConnection, type PresencePeer } from './provider';
|
|
4
|
+
export { createDoc, createSeededDoc, decodeSnapshot, docToJSON, encodeSnapshot, migrateEditorJs, rootBlocks, type BlockDocSnapshot, type BlockJSON, type BlockType, } from './model';
|
|
5
|
+
export { registerCustomBlock, getCustomBlock, type CustomBlockDef, type CustomBlockProps } from './registry';
|
|
6
|
+
export { registerReactiveBlocks } from './reactiveBlocks';
|
|
7
|
+
export { registerArtifactKit } from './kit';
|
|
8
|
+
export { blocksToHtml, blocksToMarkdown } from './exportBlocks';
|