@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,1646 @@
|
|
|
1
|
+
import { B as e, G as t, Mt as n, V as r, a as i, g as a, kt as o, p as s, r as c } from "./lucideIcons-B6pmC-WQ.js";
|
|
2
|
+
import { i as l } from "./pageIcon-BWTy7hAh.js";
|
|
3
|
+
import { t as u } from "./exportBlocks-33D7P_8Q.js";
|
|
4
|
+
import * as d from "react";
|
|
5
|
+
import f, { useEffect as p, useRef as m, useState as h, useSyncExternalStore as g } from "react";
|
|
6
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
7
|
+
import { CheckIcon as b, ChevronRightIcon as x, DotFilledIcon as ee } from "@radix-ui/react-icons";
|
|
8
|
+
import { COVER_PROPERTY_ID as te, FONTS_PROPERTY_ID as ne, FULLWIDTH_PROPERTY_ID as S, FormulaError as C, STATUS_GROUPS as re, THEME_PROPERTY_ID as w, TITLE_PROPERTY_ID as ie, asLocation as ae, dateEnd as oe, dateStart as se, formatNumber as T, formatUniqueId as ce, isImageUrl as le, isVerified as ue, makeVerification as de, numberProgress as fe, rowValue as pe } from "@book.dev/sdk";
|
|
9
|
+
import { Slot as me } from "@radix-ui/react-slot";
|
|
10
|
+
import { cva as he } from "class-variance-authority";
|
|
11
|
+
import { BadgeCheck as ge, Check as _e, ChevronDown as ve, ExternalLink as ye, MapPin as be, Plus as E, X as D } from "lucide-react";
|
|
12
|
+
import * as O from "@radix-ui/react-dropdown-menu";
|
|
13
|
+
import * as k from "@radix-ui/react-popover";
|
|
14
|
+
//#region src/components/PageIcon.tsx
|
|
15
|
+
function A({ value: e, fallback: t = "📄", className: r }) {
|
|
16
|
+
if (e && i(e)) {
|
|
17
|
+
let i = c(e);
|
|
18
|
+
return i ? /* @__PURE__ */ v(i, {
|
|
19
|
+
"aria-hidden": !0,
|
|
20
|
+
className: n("inline-block shrink-0 align-[-0.125em]", r),
|
|
21
|
+
style: {
|
|
22
|
+
width: "1em",
|
|
23
|
+
height: "1em"
|
|
24
|
+
}
|
|
25
|
+
}) : t ? /* @__PURE__ */ v("span", {
|
|
26
|
+
className: r,
|
|
27
|
+
children: t
|
|
28
|
+
}) : null;
|
|
29
|
+
}
|
|
30
|
+
let a = e || t;
|
|
31
|
+
return a ? /* @__PURE__ */ v("span", {
|
|
32
|
+
className: r,
|
|
33
|
+
children: a
|
|
34
|
+
}) : null;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/components/ui/icon-button.tsx
|
|
38
|
+
var xe = he("inline-flex shrink-0 items-center justify-center rounded-md text-muted-foreground transition-[color,background-color,transform] active:scale-[0.94] hover:bg-hover hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100", {
|
|
39
|
+
variants: { size: {
|
|
40
|
+
sm: "p-1",
|
|
41
|
+
md: "p-1.5"
|
|
42
|
+
} },
|
|
43
|
+
defaultVariants: { size: "md" }
|
|
44
|
+
}), j = d.forwardRef(({ className: e, size: t, asChild: r = !1, type: i, ...a }, o) => /* @__PURE__ */ v(r ? me : "button", {
|
|
45
|
+
ref: o,
|
|
46
|
+
type: r ? void 0 : i ?? "button",
|
|
47
|
+
className: n(xe({ size: t }), e),
|
|
48
|
+
...a
|
|
49
|
+
}));
|
|
50
|
+
j.displayName = "IconButton";
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/components/ui/dropdown-menu.tsx
|
|
53
|
+
var M = O.Root, N = O.Trigger, Se = O.Sub, Ce = O.RadioGroup, we = d.forwardRef(({ className: e, inset: t, children: r, ...i }, a) => /* @__PURE__ */ y(O.SubTrigger, {
|
|
54
|
+
ref: a,
|
|
55
|
+
className: n("flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden focus:bg-hover data-[state=open]:bg-hover", t && "pl-8", e),
|
|
56
|
+
...i,
|
|
57
|
+
children: [r, /* @__PURE__ */ v(x, { className: "ml-auto h-4 w-4" })]
|
|
58
|
+
}));
|
|
59
|
+
we.displayName = O.SubTrigger.displayName;
|
|
60
|
+
var Te = d.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ v(O.SubContent, {
|
|
61
|
+
ref: r,
|
|
62
|
+
className: n("z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", e),
|
|
63
|
+
...t
|
|
64
|
+
}));
|
|
65
|
+
Te.displayName = O.SubContent.displayName;
|
|
66
|
+
var P = d.forwardRef(({ className: e, sideOffset: t = 4, ...r }, i) => /* @__PURE__ */ v(O.Portal, { children: /* @__PURE__ */ v(O.Content, {
|
|
67
|
+
ref: i,
|
|
68
|
+
sideOffset: t,
|
|
69
|
+
className: n("z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-overlay", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", e),
|
|
70
|
+
...r
|
|
71
|
+
}) }));
|
|
72
|
+
P.displayName = O.Content.displayName;
|
|
73
|
+
var F = d.forwardRef(({ className: e, inset: t, ...r }, i) => /* @__PURE__ */ v(O.Item, {
|
|
74
|
+
ref: i,
|
|
75
|
+
className: n("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors focus:bg-hover focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", t && "pl-8", e),
|
|
76
|
+
...r
|
|
77
|
+
}));
|
|
78
|
+
F.displayName = O.Item.displayName;
|
|
79
|
+
var Ee = d.forwardRef(({ className: e, children: t, checked: r, ...i }, a) => /* @__PURE__ */ y(O.CheckboxItem, {
|
|
80
|
+
ref: a,
|
|
81
|
+
className: n("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-hover focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", e),
|
|
82
|
+
checked: r,
|
|
83
|
+
...i,
|
|
84
|
+
children: [/* @__PURE__ */ v("span", {
|
|
85
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
86
|
+
children: /* @__PURE__ */ v(O.ItemIndicator, { children: /* @__PURE__ */ v(b, { className: "h-4 w-4" }) })
|
|
87
|
+
}), t]
|
|
88
|
+
}));
|
|
89
|
+
Ee.displayName = O.CheckboxItem.displayName;
|
|
90
|
+
var De = d.forwardRef(({ className: e, children: t, ...r }, i) => /* @__PURE__ */ y(O.RadioItem, {
|
|
91
|
+
ref: i,
|
|
92
|
+
className: n("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-hover focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", e),
|
|
93
|
+
...r,
|
|
94
|
+
children: [/* @__PURE__ */ v("span", {
|
|
95
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
96
|
+
children: /* @__PURE__ */ v(O.ItemIndicator, { children: /* @__PURE__ */ v(ee, { className: "h-4 w-4 fill-current" }) })
|
|
97
|
+
}), t]
|
|
98
|
+
}));
|
|
99
|
+
De.displayName = O.RadioItem.displayName;
|
|
100
|
+
var Oe = d.forwardRef(({ className: e, inset: t, ...r }, i) => /* @__PURE__ */ v(O.Label, {
|
|
101
|
+
ref: i,
|
|
102
|
+
className: n("px-2 py-1.5 text-sm font-semibold", t && "pl-8", e),
|
|
103
|
+
...r
|
|
104
|
+
}));
|
|
105
|
+
Oe.displayName = O.Label.displayName;
|
|
106
|
+
var I = d.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ v(O.Separator, {
|
|
107
|
+
ref: r,
|
|
108
|
+
className: n("-mx-1 my-1 h-px bg-muted", e),
|
|
109
|
+
...t
|
|
110
|
+
}));
|
|
111
|
+
I.displayName = O.Separator.displayName;
|
|
112
|
+
var ke = ({ className: e, ...t }) => /* @__PURE__ */ v("span", {
|
|
113
|
+
className: n("ml-auto text-xs tracking-widest opacity-60", e),
|
|
114
|
+
...t
|
|
115
|
+
});
|
|
116
|
+
ke.displayName = "DropdownMenuShortcut";
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/lib/pageAppearance.ts
|
|
119
|
+
var L = {
|
|
120
|
+
theme: w,
|
|
121
|
+
cover: te,
|
|
122
|
+
fonts: ne,
|
|
123
|
+
fullWidth: S
|
|
124
|
+
}, Ae = {
|
|
125
|
+
theme: (e) => `openbook.pagetheme.${e}`,
|
|
126
|
+
cover: (e) => `openbook.cover.${e}`,
|
|
127
|
+
fonts: (e) => `openbook.pagefont.${e}`,
|
|
128
|
+
fullWidth: (e) => `openbook.fullwidth.${e}`
|
|
129
|
+
}, je = [
|
|
130
|
+
"theme",
|
|
131
|
+
"cover",
|
|
132
|
+
"fonts",
|
|
133
|
+
"fullWidth"
|
|
134
|
+
], Me = () => ({
|
|
135
|
+
theme: null,
|
|
136
|
+
cover: null,
|
|
137
|
+
fonts: null,
|
|
138
|
+
fullWidth: null
|
|
139
|
+
}), R = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Set(), B = /* @__PURE__ */ new Set(), Ne = () => B.forEach((e) => e()), Pe = (e) => (B.add(e), () => B.delete(e)), V = null;
|
|
140
|
+
function Fe(e) {
|
|
141
|
+
V = e;
|
|
142
|
+
}
|
|
143
|
+
function Ie(e) {
|
|
144
|
+
!e || R.has(e) || z.has(e) || !V || (z.add(e), V.load(e));
|
|
145
|
+
}
|
|
146
|
+
function Le(e) {
|
|
147
|
+
if (!e || typeof e != "object") return null;
|
|
148
|
+
let t = e;
|
|
149
|
+
return t.kind === "gradient" && typeof t.css == "string" ? {
|
|
150
|
+
kind: "gradient",
|
|
151
|
+
css: t.css
|
|
152
|
+
} : t.kind === "image" && typeof t.url == "string" ? {
|
|
153
|
+
kind: "image",
|
|
154
|
+
url: t.url,
|
|
155
|
+
...typeof t.position == "number" ? { position: t.position } : {}
|
|
156
|
+
} : null;
|
|
157
|
+
}
|
|
158
|
+
function Re(e) {
|
|
159
|
+
if (!e || typeof e != "object") return null;
|
|
160
|
+
let t = e, n = {};
|
|
161
|
+
return typeof t.body == "string" && t.body && (n.body = t.body), typeof t.heading == "string" && t.heading && (n.heading = t.heading), n.body || n.heading ? n : null;
|
|
162
|
+
}
|
|
163
|
+
function ze(e) {
|
|
164
|
+
if (!e || typeof e != "object") return null;
|
|
165
|
+
let t = s(e);
|
|
166
|
+
return t && Object.keys(t).length > 0 ? t : null;
|
|
167
|
+
}
|
|
168
|
+
function Be(e, t) {
|
|
169
|
+
return e === "theme" ? ze(t) : e === "cover" ? Le(t) : e === "fonts" ? Re(t) : t ? !0 : null;
|
|
170
|
+
}
|
|
171
|
+
var H = (e) => e == null ? "null" : JSON.stringify(e);
|
|
172
|
+
function Ve(e, t) {
|
|
173
|
+
if (!e) return;
|
|
174
|
+
z.add(e);
|
|
175
|
+
let n = t ?? {}, r = R.get(e) ?? Me(), i = { ...r }, a = !R.has(e);
|
|
176
|
+
for (let e of je) {
|
|
177
|
+
let t = Be(e, n[L[e]]);
|
|
178
|
+
H(t) !== H(r[e]) && (i[e] = t, a = !0);
|
|
179
|
+
}
|
|
180
|
+
R.set(e, i), a && Ne(), He(e, n);
|
|
181
|
+
}
|
|
182
|
+
function He(e, t) {
|
|
183
|
+
if (!(typeof localStorage > "u")) for (let n of je) {
|
|
184
|
+
if (t[L[n]] != null) continue;
|
|
185
|
+
let r = Ae[n](e), i = localStorage.getItem(r);
|
|
186
|
+
if (!i) continue;
|
|
187
|
+
let a = null;
|
|
188
|
+
try {
|
|
189
|
+
a = Be(n, JSON.parse(i));
|
|
190
|
+
} catch {
|
|
191
|
+
a = null;
|
|
192
|
+
}
|
|
193
|
+
localStorage.removeItem(r), a && U(e, n, a);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function Ue(e, t) {
|
|
197
|
+
return Ie(e), R.get(e)?.[t] ?? null;
|
|
198
|
+
}
|
|
199
|
+
function U(e, t, n) {
|
|
200
|
+
if (!e) return;
|
|
201
|
+
let r = n == null || typeof n == "object" && Object.keys(n).length === 0 ? null : n, i = { ...R.get(e) ?? Me() };
|
|
202
|
+
H(r) !== H(i[t]) && (i[t] = r, R.set(e, i), V?.persist(e, L[t], r), Ne());
|
|
203
|
+
}
|
|
204
|
+
function We(e, t) {
|
|
205
|
+
return p(() => {
|
|
206
|
+
Ie(e);
|
|
207
|
+
}, [e]), g(Pe, () => R.get(e)?.[t] ?? null, () => null);
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/components/ui/popover.tsx
|
|
211
|
+
var W = k.Root, G = k.Trigger, K = d.forwardRef(({ className: e, align: t = "center", sideOffset: r = 4, collisionPadding: i = 8, ...a }, o) => /* @__PURE__ */ v(k.Portal, { children: /* @__PURE__ */ v(k.Content, {
|
|
212
|
+
ref: o,
|
|
213
|
+
align: t,
|
|
214
|
+
sideOffset: r,
|
|
215
|
+
collisionPadding: i,
|
|
216
|
+
className: n("z-50 max-h-[var(--radix-popover-content-available-height)] w-72 max-w-[calc(100vw-1rem)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-overlay outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", e),
|
|
217
|
+
...a
|
|
218
|
+
}) }));
|
|
219
|
+
K.displayName = k.Content.displayName;
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/components/database/databaseColors.ts
|
|
222
|
+
var q = {
|
|
223
|
+
gray: "#9ca3af",
|
|
224
|
+
brown: "#b08968",
|
|
225
|
+
orange: "#f59e0b",
|
|
226
|
+
yellow: "#eab308",
|
|
227
|
+
green: "#22c55e",
|
|
228
|
+
blue: "#3b82f6",
|
|
229
|
+
purple: "#a855f7",
|
|
230
|
+
pink: "#ec4899",
|
|
231
|
+
red: "#ef4444"
|
|
232
|
+
}, Ge = [
|
|
233
|
+
"#3b82f6",
|
|
234
|
+
"#22c55e",
|
|
235
|
+
"#f59e0b",
|
|
236
|
+
"#a855f7",
|
|
237
|
+
"#ec4899",
|
|
238
|
+
"#ef4444",
|
|
239
|
+
"#14b8a6",
|
|
240
|
+
"#eab308",
|
|
241
|
+
"#6366f1",
|
|
242
|
+
"#f97316"
|
|
243
|
+
], Ke = (e, t) => e.color && q[e.color] || Ge[t % Ge.length], qe = [
|
|
244
|
+
{
|
|
245
|
+
id: "dawn",
|
|
246
|
+
css: "linear-gradient(120deg, #f6d365 0%, #fda085 100%)"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
id: "ocean",
|
|
250
|
+
css: "linear-gradient(120deg, #4facfe 0%, #00f2fe 100%)"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: "dusk",
|
|
254
|
+
css: "linear-gradient(120deg, #a18cd1 0%, #fbc2eb 100%)"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
id: "forest",
|
|
258
|
+
css: "linear-gradient(120deg, #0ba360 0%, #3cba92 100%)"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
id: "ember",
|
|
262
|
+
css: "linear-gradient(120deg, #ff6a88 0%, #ff99ac 60%, #ffc3a0 100%)"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: "slate",
|
|
266
|
+
css: "linear-gradient(120deg, #2b5876 0%, #4e4376 100%)"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: "citrus",
|
|
270
|
+
css: "linear-gradient(120deg, #f7971e 0%, #ffd200 100%)"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
id: "mint",
|
|
274
|
+
css: "linear-gradient(120deg, #43e97b 0%, #38f9d7 100%)"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: "grape",
|
|
278
|
+
css: "linear-gradient(120deg, #667eea 0%, #764ba2 100%)"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
id: "sand",
|
|
282
|
+
css: "linear-gradient(120deg, #e6dada 0%, #d3a17b 100%)"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: "rose",
|
|
286
|
+
css: "linear-gradient(120deg, #ee9ca7 0%, #ffdde1 100%)"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
id: "night",
|
|
290
|
+
css: "linear-gradient(120deg, #232526 0%, #414345 100%)"
|
|
291
|
+
}
|
|
292
|
+
];
|
|
293
|
+
function Je(e) {
|
|
294
|
+
return Ue(e, "cover");
|
|
295
|
+
}
|
|
296
|
+
function Ye(e, t) {
|
|
297
|
+
U(e, "cover", t);
|
|
298
|
+
}
|
|
299
|
+
function Xe(e) {
|
|
300
|
+
return We(e, "cover");
|
|
301
|
+
}
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/components/database/DatabaseCard.tsx
|
|
304
|
+
var Ze = ({ data: e, onOpen: t }) => /* @__PURE__ */ y("div", {
|
|
305
|
+
className: "w-full overflow-hidden",
|
|
306
|
+
children: [e.cover && /* @__PURE__ */ v("div", {
|
|
307
|
+
className: "h-14 w-full",
|
|
308
|
+
style: e.cover,
|
|
309
|
+
"aria-hidden": !0
|
|
310
|
+
}), /* @__PURE__ */ y("div", {
|
|
311
|
+
className: "flex flex-col gap-2 p-3",
|
|
312
|
+
children: [/* @__PURE__ */ y("button", {
|
|
313
|
+
type: "button",
|
|
314
|
+
onClick: t,
|
|
315
|
+
disabled: !t,
|
|
316
|
+
className: n("flex items-center gap-1.5 text-left text-sm font-medium", t && "cursor-pointer hover:underline"),
|
|
317
|
+
children: [e.icon && /* @__PURE__ */ v(A, {
|
|
318
|
+
value: e.icon,
|
|
319
|
+
className: "shrink-0 leading-none"
|
|
320
|
+
}), /* @__PURE__ */ v("span", {
|
|
321
|
+
className: "min-w-0 truncate",
|
|
322
|
+
children: e.title
|
|
323
|
+
})]
|
|
324
|
+
}), e.fields.length > 0 ? /* @__PURE__ */ v("dl", {
|
|
325
|
+
className: "flex flex-col gap-1",
|
|
326
|
+
children: e.fields.map((e) => /* @__PURE__ */ y("div", {
|
|
327
|
+
className: "flex items-center gap-2 text-xs",
|
|
328
|
+
children: [/* @__PURE__ */ v("dt", {
|
|
329
|
+
className: "w-20 shrink-0 truncate text-muted-foreground",
|
|
330
|
+
children: e.label
|
|
331
|
+
}), /* @__PURE__ */ v("dd", {
|
|
332
|
+
className: "min-w-0 flex-1 truncate",
|
|
333
|
+
children: e.node
|
|
334
|
+
})]
|
|
335
|
+
}, e.id))
|
|
336
|
+
}) : /* @__PURE__ */ v("p", {
|
|
337
|
+
className: "text-xs text-muted-foreground",
|
|
338
|
+
children: "No properties"
|
|
339
|
+
})]
|
|
340
|
+
})]
|
|
341
|
+
}), Qe = ({ label: e, color: t }) => /* @__PURE__ */ y("span", {
|
|
342
|
+
className: "inline-flex items-center gap-1",
|
|
343
|
+
children: [t && /* @__PURE__ */ v("span", {
|
|
344
|
+
className: "h-2 w-2 shrink-0 rounded-full",
|
|
345
|
+
style: { backgroundColor: q[t] ?? t }
|
|
346
|
+
}), /* @__PURE__ */ v("span", {
|
|
347
|
+
className: "truncate",
|
|
348
|
+
children: e
|
|
349
|
+
})]
|
|
350
|
+
});
|
|
351
|
+
function $e(t, n) {
|
|
352
|
+
if (n == null || n === "" || Array.isArray(n) && n.length === 0) return null;
|
|
353
|
+
switch (t.type) {
|
|
354
|
+
case "select":
|
|
355
|
+
case "status": {
|
|
356
|
+
let e = t.options?.find((e) => e.id === n);
|
|
357
|
+
return e ? /* @__PURE__ */ v(Qe, {
|
|
358
|
+
label: e.label,
|
|
359
|
+
color: e.color
|
|
360
|
+
}) : null;
|
|
361
|
+
}
|
|
362
|
+
case "multi_select": {
|
|
363
|
+
let e = Array.isArray(n) ? n : [], r = (t.options ?? []).filter((t) => e.includes(t.id));
|
|
364
|
+
return r.length ? /* @__PURE__ */ v("span", {
|
|
365
|
+
className: "truncate",
|
|
366
|
+
children: r.map((e) => e.label).join(", ")
|
|
367
|
+
}) : null;
|
|
368
|
+
}
|
|
369
|
+
case "relation":
|
|
370
|
+
case "dependency": {
|
|
371
|
+
let t = Array.isArray(n) ? n : [];
|
|
372
|
+
return t.length ? /* @__PURE__ */ v("span", {
|
|
373
|
+
className: "truncate",
|
|
374
|
+
children: t.map((t) => e.label(t)).join(", ")
|
|
375
|
+
}) : null;
|
|
376
|
+
}
|
|
377
|
+
case "checkbox": return n === !0 ? "✓" : null;
|
|
378
|
+
case "date": {
|
|
379
|
+
let e = n;
|
|
380
|
+
return typeof e == "string" ? e : e.start ? e.end ? `${e.start} → ${e.end}` : e.start : null;
|
|
381
|
+
}
|
|
382
|
+
default: return /* @__PURE__ */ v("span", {
|
|
383
|
+
className: "truncate",
|
|
384
|
+
children: String(n)
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
var et = /* @__PURE__ */ new Map();
|
|
389
|
+
function tt(e, n) {
|
|
390
|
+
let r = t(), [i, a] = h(() => et.get(e) ?? null);
|
|
391
|
+
return p(() => {
|
|
392
|
+
if (!n || i) return;
|
|
393
|
+
let t = !0;
|
|
394
|
+
return (async () => {
|
|
395
|
+
let n = await r.getPage(e);
|
|
396
|
+
if (!n || !t) return;
|
|
397
|
+
let i = n.databaseId ? (await r.getDatabase(n.databaseId))?.schema.properties ?? [] : [], o = Je(e), s = [];
|
|
398
|
+
for (let e of i) {
|
|
399
|
+
if (s.length >= 5) break;
|
|
400
|
+
if (e.id === ie || e.pageHidden) continue;
|
|
401
|
+
let t = $e(e, n.properties[e.id]);
|
|
402
|
+
t != null && s.push({
|
|
403
|
+
id: e.id,
|
|
404
|
+
label: e.name,
|
|
405
|
+
node: t
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
let c = {
|
|
409
|
+
title: n.name?.trim() || "Untitled",
|
|
410
|
+
icon: l(e),
|
|
411
|
+
cover: o?.kind === "gradient" ? { background: o.css } : o?.kind === "image" ? {
|
|
412
|
+
backgroundImage: `url("${o.url}")`,
|
|
413
|
+
backgroundSize: "cover",
|
|
414
|
+
backgroundPosition: `50% ${o.position ?? 50}%`
|
|
415
|
+
} : void 0,
|
|
416
|
+
fields: s
|
|
417
|
+
};
|
|
418
|
+
et.set(e, c), t && a(c);
|
|
419
|
+
})(), () => {
|
|
420
|
+
t = !1;
|
|
421
|
+
};
|
|
422
|
+
}, [
|
|
423
|
+
n,
|
|
424
|
+
e,
|
|
425
|
+
i,
|
|
426
|
+
r
|
|
427
|
+
]), i;
|
|
428
|
+
}
|
|
429
|
+
var nt = ({ rowId: t, children: n, openDelay: r = 280 }) => {
|
|
430
|
+
let [i, a] = h(!1), o = m(void 0), s = tt(t, i), c = () => {
|
|
431
|
+
clearTimeout(o.current), o.current = setTimeout(() => a(!0), r);
|
|
432
|
+
}, l = () => {
|
|
433
|
+
clearTimeout(o.current), o.current = setTimeout(() => a(!1), 140);
|
|
434
|
+
};
|
|
435
|
+
return p(() => () => clearTimeout(o.current), []), /* @__PURE__ */ y(W, {
|
|
436
|
+
open: i,
|
|
437
|
+
onOpenChange: a,
|
|
438
|
+
children: [/* @__PURE__ */ v(G, {
|
|
439
|
+
asChild: !0,
|
|
440
|
+
children: /* @__PURE__ */ v("span", {
|
|
441
|
+
onMouseEnter: c,
|
|
442
|
+
onMouseLeave: l,
|
|
443
|
+
children: n
|
|
444
|
+
})
|
|
445
|
+
}), /* @__PURE__ */ v(K, {
|
|
446
|
+
align: "start",
|
|
447
|
+
className: "w-64 p-0",
|
|
448
|
+
onMouseEnter: c,
|
|
449
|
+
onMouseLeave: l,
|
|
450
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
451
|
+
children: s ? /* @__PURE__ */ v(Ze, {
|
|
452
|
+
data: s,
|
|
453
|
+
onOpen: () => e.openPage(t)
|
|
454
|
+
}) : /* @__PURE__ */ v("div", {
|
|
455
|
+
className: "p-3 text-xs text-muted-foreground",
|
|
456
|
+
children: "Loading…"
|
|
457
|
+
})
|
|
458
|
+
})]
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/components/database/databaseCells.tsx
|
|
463
|
+
function rt(e, t, n, r) {
|
|
464
|
+
return t.type === "expr" ? e.exports[t.cellName ?? t.name] : t.type === "formula" || t.type === "rollup" ? pe(e, t, n, r) : t.type === "created_time" ? e.createdAt : t.type === "last_edited_time" ? e.updatedAt : e.properties[t.id];
|
|
465
|
+
}
|
|
466
|
+
function it() {
|
|
467
|
+
let { preferences: e } = o();
|
|
468
|
+
return e.profile.displayName.trim() || e.profile.name.trim() || "You";
|
|
469
|
+
}
|
|
470
|
+
var at = ({ name: e }) => /* @__PURE__ */ y("span", {
|
|
471
|
+
className: "inline-flex max-w-full items-center gap-1 truncate rounded-full bg-muted px-2 py-0.5 text-xs",
|
|
472
|
+
children: [/* @__PURE__ */ v("span", {
|
|
473
|
+
className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-brand/15 text-[9px] font-semibold uppercase text-brand",
|
|
474
|
+
children: e.slice(0, 1) || "?"
|
|
475
|
+
}), /* @__PURE__ */ v("span", {
|
|
476
|
+
className: "truncate",
|
|
477
|
+
children: e
|
|
478
|
+
})]
|
|
479
|
+
}), ot = ({ value: e }) => {
|
|
480
|
+
let t = ue(e);
|
|
481
|
+
return /* @__PURE__ */ y("span", {
|
|
482
|
+
className: n("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs", t ? "text-green-700 dark:text-green-300" : "text-muted-foreground"),
|
|
483
|
+
children: [/* @__PURE__ */ v(ge, { className: n("h-3.5 w-3.5", t ? "text-green-600 dark:text-green-400" : "text-muted-foreground/50") }), t ? "Verified" : "Unverified"]
|
|
484
|
+
});
|
|
485
|
+
}, st = {
|
|
486
|
+
gray: "bg-zinc-200 text-zinc-700 dark:bg-zinc-700/60 dark:text-zinc-200",
|
|
487
|
+
brown: "bg-amber-200/70 text-amber-900 dark:bg-amber-900/40 dark:text-amber-200",
|
|
488
|
+
orange: "bg-orange-200 text-orange-800 dark:bg-orange-900/40 dark:text-orange-200",
|
|
489
|
+
yellow: "bg-yellow-200 text-yellow-800 dark:bg-yellow-900/40 dark:text-yellow-200",
|
|
490
|
+
green: "bg-green-200 text-green-800 dark:bg-green-900/40 dark:text-green-200",
|
|
491
|
+
blue: "bg-blue-200 text-blue-800 dark:bg-blue-900/40 dark:text-blue-200",
|
|
492
|
+
purple: "bg-purple-200 text-purple-800 dark:bg-purple-900/40 dark:text-purple-200",
|
|
493
|
+
pink: "bg-pink-200 text-pink-800 dark:bg-pink-900/40 dark:text-pink-200",
|
|
494
|
+
red: "bg-red-200 text-red-800 dark:bg-red-900/40 dark:text-red-200"
|
|
495
|
+
}, ct = (e) => st[e ?? "gray"] ?? st.gray, lt = (e, t) => e.options?.find((e) => e.id === t), J = ({ option: e }) => /* @__PURE__ */ v("span", {
|
|
496
|
+
className: n("inline-flex max-w-full items-center truncate rounded px-1.5 py-0.5 text-xs", ct(e.color)),
|
|
497
|
+
children: e.label
|
|
498
|
+
});
|
|
499
|
+
function ut(e) {
|
|
500
|
+
let t = e.includes("T"), n = new Date(t ? e : `${e}T00:00:00`);
|
|
501
|
+
return Number.isNaN(n.getTime()) ? e : t ? n.toLocaleString(void 0, {
|
|
502
|
+
dateStyle: "medium",
|
|
503
|
+
timeStyle: "short"
|
|
504
|
+
}) : n.toLocaleDateString();
|
|
505
|
+
}
|
|
506
|
+
function dt(e) {
|
|
507
|
+
let t = e.includes("T"), n = new Date(t ? e : `${e}T00:00:00`);
|
|
508
|
+
if (Number.isNaN(n.getTime())) return e;
|
|
509
|
+
let r = /* @__PURE__ */ new Date(), i = new Date(r.getFullYear(), r.getMonth(), r.getDate()).getTime(), a = new Date(n.getFullYear(), n.getMonth(), n.getDate()).getTime(), o = Math.round((a - i) / 864e5), s;
|
|
510
|
+
if (o === 0) s = "Today";
|
|
511
|
+
else if (o === 1) s = "Tomorrow";
|
|
512
|
+
else if (o === -1) s = "Yesterday";
|
|
513
|
+
else if (o > 1 && o < 7) s = `In ${o} days`;
|
|
514
|
+
else if (o < -1 && o > -7) s = `${-o} days ago`;
|
|
515
|
+
else return ut(e);
|
|
516
|
+
return t ? `${s}, ${n.toLocaleTimeString(void 0, {
|
|
517
|
+
hour: "numeric",
|
|
518
|
+
minute: "2-digit"
|
|
519
|
+
})}` : s;
|
|
520
|
+
}
|
|
521
|
+
function Y(e, t) {
|
|
522
|
+
if (e.type === "verification") return ue(t) ? "Verified" : "";
|
|
523
|
+
if (e.type === "backlinks" || e.type === "relation" || e.type === "dependency" || e.type === "files") return "";
|
|
524
|
+
if (e.type === "created_time" || e.type === "last_edited_time") return t ? new Date(String(t)).toLocaleDateString() : "";
|
|
525
|
+
if (e.type === "date") {
|
|
526
|
+
let n = se(t);
|
|
527
|
+
if (!n) return "";
|
|
528
|
+
let r = oe(t), i = (t) => e.dateDisplay === "relative" ? dt(t) : ut(t);
|
|
529
|
+
return r ? `${i(n)} → ${i(r)}` : i(n);
|
|
530
|
+
}
|
|
531
|
+
if (e.type === "unique_id") return ce(t, e.idPrefix);
|
|
532
|
+
if (e.type === "formula") return pt(t, e.numberFormat);
|
|
533
|
+
if (e.type === "rollup") return ft(e, t);
|
|
534
|
+
if (e.type === "multi_select") return (Array.isArray(t) ? t : []).map((t) => e.options?.find((e) => e.id === t)?.label).filter(Boolean).join(", ");
|
|
535
|
+
if (e.type === "rating") {
|
|
536
|
+
let e = typeof t == "number" ? t : Number(t);
|
|
537
|
+
return Number.isFinite(e) && e > 0 ? "★".repeat(Math.round(e)) : "";
|
|
538
|
+
}
|
|
539
|
+
if (e.type === "location") {
|
|
540
|
+
let e = ae(t);
|
|
541
|
+
return e ? e.label ?? e.address ?? `${e.lat.toFixed(4)}, ${e.lng.toFixed(4)}` : "";
|
|
542
|
+
}
|
|
543
|
+
return t == null || t === "" ? "" : e.type === "checkbox" ? t ? "✓" : "" : e.type === "select" || e.type === "status" ? lt(e, t)?.label ?? "" : e.type === "number" ? T(t, e.numberFormat) : e.type === "expr" ? mt(t, e.numberFormat) : String(t);
|
|
544
|
+
}
|
|
545
|
+
function ft(e, t) {
|
|
546
|
+
return Array.isArray(t) ? t.map((e) => String(e ?? "")).filter(Boolean).join(", ") : t == null || t === "" ? "" : e.rollup?.function === "percent_checked" ? `${t}%` : typeof t == "number" ? T(t, e.numberFormat) : String(t);
|
|
547
|
+
}
|
|
548
|
+
function pt(e, t) {
|
|
549
|
+
return e instanceof C ? `⚠ ${e.message}` : typeof e == "number" ? T(e, t) : typeof e == "boolean" ? e ? "✓" : "✗" : mt(e, t);
|
|
550
|
+
}
|
|
551
|
+
function mt(e, t) {
|
|
552
|
+
if (e == null) return "";
|
|
553
|
+
if (e instanceof C) return `⚠ ${e.message}`;
|
|
554
|
+
if (typeof e == "number") return T(e, t);
|
|
555
|
+
if (typeof e == "boolean") return e ? "true" : "false";
|
|
556
|
+
if (typeof e == "string") return e;
|
|
557
|
+
if (Array.isArray(e)) return `[${e.length}]`;
|
|
558
|
+
try {
|
|
559
|
+
return JSON.stringify(e);
|
|
560
|
+
} catch {
|
|
561
|
+
return String(e);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
function ht(t, n, r, i) {
|
|
565
|
+
let a = rt(t, n, r, i);
|
|
566
|
+
return n.type === "relation" ? (Array.isArray(a) ? a : []).map((t) => e.label(t)).join("; ") : n.type === "dependency" ? (Array.isArray(a) ? a : []).map((e) => i.find((t) => t.id === e)?.name?.trim() || "Untitled").join("; ") : n.type === "files" ? (Array.isArray(a) ? a : []).join("; ") : Y(n, a);
|
|
567
|
+
}
|
|
568
|
+
function gt(e, t, n) {
|
|
569
|
+
let r = (e) => /[",\n]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e, i = [["Name", ...t.map((e) => e.name)].map(r).join(",")];
|
|
570
|
+
for (let a of e) {
|
|
571
|
+
let o = [a.name ?? "", ...t.map((t) => ht(a, t, n, e))];
|
|
572
|
+
i.push(o.map(r).join(","));
|
|
573
|
+
}
|
|
574
|
+
return i.join("\n");
|
|
575
|
+
}
|
|
576
|
+
function _t(e) {
|
|
577
|
+
let t = e.replace(/\r\n?/g, "\n"), n = [], r = [], i = "", a = !1;
|
|
578
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
579
|
+
let o = t[e];
|
|
580
|
+
a ? o === "\"" ? t[e + 1] === "\"" ? (i += "\"", e += 1) : a = !1 : i += o : o === "\"" ? a = !0 : o === "," ? (r.push(i), i = "") : o === "\n" ? (r.push(i), n.push(r), r = [], i = "") : i += o;
|
|
581
|
+
}
|
|
582
|
+
return (i !== "" || r.length > 0) && (r.push(i), n.push(r)), n.filter((e) => e.some((e) => e !== ""));
|
|
583
|
+
}
|
|
584
|
+
var X = "w-full bg-transparent px-2 py-1 text-sm outline-hidden placeholder:text-muted-foreground/40 placeholder:opacity-0 placeholder:transition-opacity group-hover:placeholder:opacity-100 focus:placeholder:opacity-100 focus:bg-hover", Z = "text-muted-foreground/40 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100", vt = ({ property: e, value: t, exprValue: r, onChange: i, onAddOption: a, rowOptions: o }) => {
|
|
585
|
+
switch (e.type) {
|
|
586
|
+
case "expr": return /* @__PURE__ */ v("div", {
|
|
587
|
+
className: "px-2 py-1 text-sm tabular-nums text-foreground/80",
|
|
588
|
+
title: "Computed from the row's exported cell",
|
|
589
|
+
children: mt(r, e.numberFormat)
|
|
590
|
+
});
|
|
591
|
+
case "formula": return /* @__PURE__ */ v("div", {
|
|
592
|
+
className: n("px-2 py-1 text-sm tabular-nums", t instanceof C ? "text-destructive" : "text-foreground/80"),
|
|
593
|
+
title: t instanceof C ? t.message : "Computed from other properties",
|
|
594
|
+
children: pt(t, e.numberFormat)
|
|
595
|
+
});
|
|
596
|
+
case "rollup": return /* @__PURE__ */ v("div", {
|
|
597
|
+
className: "px-2 py-1 text-sm tabular-nums text-foreground/80",
|
|
598
|
+
title: "Rolled up from related rows",
|
|
599
|
+
children: ft(e, t) || /* @__PURE__ */ v("span", {
|
|
600
|
+
className: "text-muted-foreground/40",
|
|
601
|
+
children: "—"
|
|
602
|
+
})
|
|
603
|
+
});
|
|
604
|
+
case "checkbox": return /* @__PURE__ */ v("div", {
|
|
605
|
+
className: "flex items-center px-2 py-1",
|
|
606
|
+
children: /* @__PURE__ */ v("input", {
|
|
607
|
+
type: "checkbox",
|
|
608
|
+
checked: t === !0,
|
|
609
|
+
onChange: (e) => i(e.target.checked),
|
|
610
|
+
className: "h-4 w-4 cursor-pointer accent-primary",
|
|
611
|
+
"aria-label": e.name
|
|
612
|
+
})
|
|
613
|
+
});
|
|
614
|
+
case "number": return /* @__PURE__ */ v(xt, {
|
|
615
|
+
property: e,
|
|
616
|
+
value: t,
|
|
617
|
+
onChange: i
|
|
618
|
+
});
|
|
619
|
+
case "rating": return /* @__PURE__ */ v(St, {
|
|
620
|
+
property: e,
|
|
621
|
+
value: t,
|
|
622
|
+
onChange: i
|
|
623
|
+
});
|
|
624
|
+
case "date": return /* @__PURE__ */ v(Tt, {
|
|
625
|
+
property: e,
|
|
626
|
+
value: t,
|
|
627
|
+
onChange: i
|
|
628
|
+
});
|
|
629
|
+
case "select": return /* @__PURE__ */ v(Nt, {
|
|
630
|
+
property: e,
|
|
631
|
+
value: t,
|
|
632
|
+
onChange: i,
|
|
633
|
+
onAddOption: a
|
|
634
|
+
});
|
|
635
|
+
case "status": return /* @__PURE__ */ v(Pt, {
|
|
636
|
+
property: e,
|
|
637
|
+
value: t,
|
|
638
|
+
onChange: i
|
|
639
|
+
});
|
|
640
|
+
case "multi_select": return /* @__PURE__ */ v(jt, {
|
|
641
|
+
property: e,
|
|
642
|
+
value: t,
|
|
643
|
+
onChange: i,
|
|
644
|
+
onAddOption: a
|
|
645
|
+
});
|
|
646
|
+
case "relation": return /* @__PURE__ */ v(Mt, {
|
|
647
|
+
property: e,
|
|
648
|
+
value: t,
|
|
649
|
+
onChange: i
|
|
650
|
+
});
|
|
651
|
+
case "dependency": return /* @__PURE__ */ v(Et, {
|
|
652
|
+
value: t,
|
|
653
|
+
onChange: i,
|
|
654
|
+
rowOptions: o ?? []
|
|
655
|
+
});
|
|
656
|
+
case "files": return /* @__PURE__ */ v(Ot, {
|
|
657
|
+
value: t,
|
|
658
|
+
onChange: i
|
|
659
|
+
});
|
|
660
|
+
case "url":
|
|
661
|
+
case "email":
|
|
662
|
+
case "phone": return /* @__PURE__ */ v(kt, {
|
|
663
|
+
kind: e.type,
|
|
664
|
+
value: t,
|
|
665
|
+
onChange: i
|
|
666
|
+
});
|
|
667
|
+
case "location": return /* @__PURE__ */ v(At, {
|
|
668
|
+
value: t,
|
|
669
|
+
onChange: i
|
|
670
|
+
});
|
|
671
|
+
case "created_time":
|
|
672
|
+
case "last_edited_time": return /* @__PURE__ */ v("div", {
|
|
673
|
+
className: "px-2 py-1 text-sm text-muted-foreground/80",
|
|
674
|
+
title: "Set automatically",
|
|
675
|
+
children: Y(e, t)
|
|
676
|
+
});
|
|
677
|
+
case "unique_id": return /* @__PURE__ */ v("div", {
|
|
678
|
+
className: "px-2 py-1 font-mono text-xs text-muted-foreground/80 tabular-nums",
|
|
679
|
+
title: "Assigned automatically",
|
|
680
|
+
children: ce(t, e.idPrefix) || /* @__PURE__ */ v("span", {
|
|
681
|
+
className: "text-muted-foreground/40",
|
|
682
|
+
children: "—"
|
|
683
|
+
})
|
|
684
|
+
});
|
|
685
|
+
case "person": return /* @__PURE__ */ v("input", {
|
|
686
|
+
type: "text",
|
|
687
|
+
defaultValue: typeof t == "string" ? t : t == null ? "" : String(t),
|
|
688
|
+
onBlur: (e) => i(e.target.value.trim() || null),
|
|
689
|
+
className: X,
|
|
690
|
+
placeholder: "Add a person…",
|
|
691
|
+
"aria-label": e.name
|
|
692
|
+
});
|
|
693
|
+
case "verification": return /* @__PURE__ */ v(Ct, {
|
|
694
|
+
value: t,
|
|
695
|
+
onChange: i
|
|
696
|
+
});
|
|
697
|
+
case "backlinks": return /* @__PURE__ */ v("div", {
|
|
698
|
+
className: "px-2 py-1 text-xs text-muted-foreground/50",
|
|
699
|
+
children: "—"
|
|
700
|
+
});
|
|
701
|
+
default: return /* @__PURE__ */ v("input", {
|
|
702
|
+
type: "text",
|
|
703
|
+
defaultValue: typeof t == "string" ? t : t == null ? "" : String(t),
|
|
704
|
+
onBlur: (e) => i(e.target.value),
|
|
705
|
+
className: X,
|
|
706
|
+
placeholder: "Empty"
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
}, yt = ({ frac: e }) => /* @__PURE__ */ v("div", {
|
|
710
|
+
className: "h-1.5 min-w-10 flex-1 overflow-hidden rounded-full bg-muted",
|
|
711
|
+
"aria-hidden": !0,
|
|
712
|
+
children: /* @__PURE__ */ v("div", {
|
|
713
|
+
className: "h-full rounded-full bg-primary transition-[width]",
|
|
714
|
+
style: { width: `${e * 100}%` }
|
|
715
|
+
})
|
|
716
|
+
}), bt = ({ frac: e }) => {
|
|
717
|
+
let t = 2 * Math.PI * 6;
|
|
718
|
+
return /* @__PURE__ */ y("svg", {
|
|
719
|
+
width: 16,
|
|
720
|
+
height: 16,
|
|
721
|
+
viewBox: "0 0 16 16",
|
|
722
|
+
className: "shrink-0 -rotate-90",
|
|
723
|
+
"aria-hidden": !0,
|
|
724
|
+
children: [/* @__PURE__ */ v("circle", {
|
|
725
|
+
cx: 8,
|
|
726
|
+
cy: 8,
|
|
727
|
+
r: 6,
|
|
728
|
+
fill: "none",
|
|
729
|
+
strokeWidth: 2,
|
|
730
|
+
className: "stroke-muted"
|
|
731
|
+
}), /* @__PURE__ */ v("circle", {
|
|
732
|
+
cx: 8,
|
|
733
|
+
cy: 8,
|
|
734
|
+
r: 6,
|
|
735
|
+
fill: "none",
|
|
736
|
+
strokeWidth: 2,
|
|
737
|
+
strokeLinecap: "round",
|
|
738
|
+
className: "stroke-primary transition-[stroke-dashoffset]",
|
|
739
|
+
strokeDasharray: t,
|
|
740
|
+
strokeDashoffset: t * (1 - e)
|
|
741
|
+
})]
|
|
742
|
+
});
|
|
743
|
+
}, xt = ({ property: e, value: t, onChange: r }) => {
|
|
744
|
+
let i = /* @__PURE__ */ v("input", {
|
|
745
|
+
type: "number",
|
|
746
|
+
defaultValue: t == null ? "" : String(t),
|
|
747
|
+
onBlur: (e) => r(e.target.value === "" ? null : Number(e.target.value)),
|
|
748
|
+
className: n(X, "tabular-nums", e.numberDisplay === "bar" && "w-14 flex-none", e.numberDisplay === "ring" && "flex-1"),
|
|
749
|
+
placeholder: "—",
|
|
750
|
+
"aria-label": e.name
|
|
751
|
+
});
|
|
752
|
+
if (e.numberDisplay !== "bar" && e.numberDisplay !== "ring") return i;
|
|
753
|
+
let a = fe(t, e.numberTarget);
|
|
754
|
+
return /* @__PURE__ */ y("div", {
|
|
755
|
+
className: "flex items-center gap-2 pr-2",
|
|
756
|
+
"data-number-display": e.numberDisplay,
|
|
757
|
+
children: [
|
|
758
|
+
e.numberDisplay === "ring" && /* @__PURE__ */ v("span", {
|
|
759
|
+
className: "pl-2",
|
|
760
|
+
children: /* @__PURE__ */ v(bt, { frac: a })
|
|
761
|
+
}),
|
|
762
|
+
i,
|
|
763
|
+
e.numberDisplay === "bar" && /* @__PURE__ */ v(yt, { frac: a })
|
|
764
|
+
]
|
|
765
|
+
});
|
|
766
|
+
}, St = ({ property: e, value: t, onChange: r }) => {
|
|
767
|
+
let i = e.numberTarget && e.numberTarget > 0 ? Math.min(10, Math.round(e.numberTarget)) : 5, a = typeof t == "number" ? t : typeof t == "string" && t.trim() !== "" ? Number(t) : 0;
|
|
768
|
+
return /* @__PURE__ */ v("div", {
|
|
769
|
+
className: "flex items-center gap-0.5 px-2 py-1",
|
|
770
|
+
role: "group",
|
|
771
|
+
"aria-label": e.name,
|
|
772
|
+
children: Array.from({ length: i }, (e, t) => t + 1).map((e) => /* @__PURE__ */ v("button", {
|
|
773
|
+
type: "button",
|
|
774
|
+
onClick: () => r(a === e ? null : e),
|
|
775
|
+
className: n("text-base leading-none transition-colors", e <= a ? "text-amber-400" : "text-muted-foreground/30 hover:text-amber-400/60"),
|
|
776
|
+
"aria-label": `${e} ${e === 1 ? "star" : "stars"}`,
|
|
777
|
+
"aria-pressed": e <= a,
|
|
778
|
+
children: "★"
|
|
779
|
+
}, e))
|
|
780
|
+
});
|
|
781
|
+
}, Ct = ({ value: e, onChange: t }) => {
|
|
782
|
+
let n = it(), r = ue(e);
|
|
783
|
+
return /* @__PURE__ */ v("button", {
|
|
784
|
+
type: "button",
|
|
785
|
+
onClick: () => {
|
|
786
|
+
t(r ? { verified: !1 } : de(n, (/* @__PURE__ */ new Date()).toISOString()));
|
|
787
|
+
},
|
|
788
|
+
className: "flex w-full items-center px-2 py-1 text-left hover:bg-hover",
|
|
789
|
+
title: r && e.by ? `Verified by ${e.by}` : "Toggle verification",
|
|
790
|
+
children: /* @__PURE__ */ v(ot, { value: e })
|
|
791
|
+
});
|
|
792
|
+
}, wt = {
|
|
793
|
+
url: (e) => /^https?:\/\//i.test(e) ? e : `https://${e}`,
|
|
794
|
+
email: (e) => `mailto:${e}`,
|
|
795
|
+
phone: (e) => `tel:${e}`
|
|
796
|
+
}, Tt = ({ property: e, value: t, onChange: r }) => {
|
|
797
|
+
let i = e.includeTime ? "datetime-local" : "date", [a, o] = h(!1), s = se(t), c = oe(t);
|
|
798
|
+
if ((s ?? c) && !a) {
|
|
799
|
+
let n = Y(e, t);
|
|
800
|
+
return /* @__PURE__ */ v("button", {
|
|
801
|
+
onClick: () => o(!0),
|
|
802
|
+
className: "flex w-full items-center px-2 py-1 text-left text-sm outline-hidden hover:bg-hover",
|
|
803
|
+
"aria-label": e.name,
|
|
804
|
+
children: n || /* @__PURE__ */ v("span", {
|
|
805
|
+
className: Z,
|
|
806
|
+
children: "Empty"
|
|
807
|
+
})
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
let l = () => o(!0), u = () => o(!1);
|
|
811
|
+
if (!e.dateRange) return /* @__PURE__ */ v("input", {
|
|
812
|
+
type: i,
|
|
813
|
+
autoFocus: a,
|
|
814
|
+
required: !s,
|
|
815
|
+
defaultValue: s ?? "",
|
|
816
|
+
onFocus: l,
|
|
817
|
+
onChange: (e) => r(e.target.value || null),
|
|
818
|
+
onBlur: u,
|
|
819
|
+
className: n(X, "ob-date-empty"),
|
|
820
|
+
"aria-label": e.name
|
|
821
|
+
});
|
|
822
|
+
let d = (e) => r(e.start || e.end ? e : null);
|
|
823
|
+
return /* @__PURE__ */ y("div", {
|
|
824
|
+
className: "group/dates flex items-center gap-1 px-1 text-sm",
|
|
825
|
+
onFocus: l,
|
|
826
|
+
onBlur: (e) => !e.currentTarget.contains(e.relatedTarget) && u(),
|
|
827
|
+
children: [
|
|
828
|
+
/* @__PURE__ */ v("input", {
|
|
829
|
+
type: i,
|
|
830
|
+
autoFocus: a,
|
|
831
|
+
required: !s,
|
|
832
|
+
defaultValue: s ?? "",
|
|
833
|
+
onChange: (e) => d({
|
|
834
|
+
start: e.target.value || null,
|
|
835
|
+
end: c
|
|
836
|
+
}),
|
|
837
|
+
className: "ob-date-empty bg-transparent py-1 outline-hidden focus:bg-hover",
|
|
838
|
+
"aria-label": `${e.name} start`
|
|
839
|
+
}),
|
|
840
|
+
/* @__PURE__ */ v("span", {
|
|
841
|
+
className: n("text-muted-foreground/50", !s && !c && "opacity-0 transition-opacity group-hover:opacity-100 group-focus-within/dates:opacity-100"),
|
|
842
|
+
children: "→"
|
|
843
|
+
}),
|
|
844
|
+
/* @__PURE__ */ v("input", {
|
|
845
|
+
type: i,
|
|
846
|
+
required: !c,
|
|
847
|
+
defaultValue: c ?? "",
|
|
848
|
+
onChange: (e) => d({
|
|
849
|
+
start: s,
|
|
850
|
+
end: e.target.value || null
|
|
851
|
+
}),
|
|
852
|
+
className: "ob-date-empty bg-transparent py-1 outline-hidden focus:bg-hover",
|
|
853
|
+
"aria-label": `${e.name} end`
|
|
854
|
+
})
|
|
855
|
+
]
|
|
856
|
+
});
|
|
857
|
+
}, Et = ({ value: e, onChange: t, rowOptions: n }) => {
|
|
858
|
+
let r = Array.isArray(e) ? e : [], [i, a] = h(""), o = m(null), s = (e) => n.find((t) => t.id === e)?.label ?? "Untitled", c = n.filter((e) => !r.includes(e.id)).filter((e) => i ? e.label.toLowerCase().includes(i.toLowerCase()) : !0);
|
|
859
|
+
return /* @__PURE__ */ y("div", {
|
|
860
|
+
className: "flex min-h-[28px] flex-wrap items-center gap-1 px-2 py-1",
|
|
861
|
+
children: [r.map((e) => /* @__PURE__ */ y("span", {
|
|
862
|
+
className: "inline-flex max-w-full items-center gap-1 rounded-md border border-border/60 px-1.5 py-0.5 text-xs",
|
|
863
|
+
children: [/* @__PURE__ */ v("span", {
|
|
864
|
+
className: "max-w-[120px] truncate",
|
|
865
|
+
children: s(e)
|
|
866
|
+
}), /* @__PURE__ */ v("button", {
|
|
867
|
+
type: "button",
|
|
868
|
+
onClick: () => t(r.filter((t) => t !== e)),
|
|
869
|
+
className: "text-muted-foreground/70 transition-colors hover:text-destructive",
|
|
870
|
+
"aria-label": "Remove dependency",
|
|
871
|
+
children: /* @__PURE__ */ v(D, { className: "h-3 w-3" })
|
|
872
|
+
})]
|
|
873
|
+
}, e)), /* @__PURE__ */ y(W, { children: [/* @__PURE__ */ v(G, {
|
|
874
|
+
asChild: !0,
|
|
875
|
+
children: /* @__PURE__ */ v("button", {
|
|
876
|
+
type: "button",
|
|
877
|
+
className: "rounded p-0.5 text-muted-foreground transition-colors hover:bg-hover hover:text-foreground",
|
|
878
|
+
"aria-label": "Add dependency",
|
|
879
|
+
children: /* @__PURE__ */ v(E, { className: "h-3.5 w-3.5" })
|
|
880
|
+
})
|
|
881
|
+
}), /* @__PURE__ */ y(K, {
|
|
882
|
+
align: "start",
|
|
883
|
+
className: "w-60 p-1",
|
|
884
|
+
onOpenAutoFocus: (e) => {
|
|
885
|
+
e.preventDefault(), o.current?.focus({ preventScroll: !0 });
|
|
886
|
+
},
|
|
887
|
+
children: [/* @__PURE__ */ v("input", {
|
|
888
|
+
ref: o,
|
|
889
|
+
value: i,
|
|
890
|
+
onChange: (e) => a(e.target.value),
|
|
891
|
+
placeholder: "Depends on…",
|
|
892
|
+
className: "mb-1 w-full rounded bg-accent/40 px-1.5 py-1 text-sm outline-hidden"
|
|
893
|
+
}), /* @__PURE__ */ y("div", {
|
|
894
|
+
className: "max-h-52 overflow-y-auto",
|
|
895
|
+
children: [c.length === 0 && /* @__PURE__ */ v("div", {
|
|
896
|
+
className: "px-1.5 py-1.5 text-xs text-muted-foreground",
|
|
897
|
+
children: "No other rows"
|
|
898
|
+
}), c.map((e) => /* @__PURE__ */ y("button", {
|
|
899
|
+
type: "button",
|
|
900
|
+
onClick: () => {
|
|
901
|
+
t([...r, e.id]), a("");
|
|
902
|
+
},
|
|
903
|
+
className: "flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-left text-sm transition-colors hover:bg-hover",
|
|
904
|
+
children: [e.icon && /* @__PURE__ */ v(A, {
|
|
905
|
+
value: e.icon,
|
|
906
|
+
className: "leading-none"
|
|
907
|
+
}), /* @__PURE__ */ v("span", {
|
|
908
|
+
className: "truncate",
|
|
909
|
+
children: e.label
|
|
910
|
+
})]
|
|
911
|
+
}, e.id))]
|
|
912
|
+
})]
|
|
913
|
+
})] })]
|
|
914
|
+
});
|
|
915
|
+
}, Dt = (e) => {
|
|
916
|
+
try {
|
|
917
|
+
let t = new URL(e).pathname;
|
|
918
|
+
return decodeURIComponent(t.split("/").filter(Boolean).pop() || e);
|
|
919
|
+
} catch {
|
|
920
|
+
return e.split("/").filter(Boolean).pop() || e;
|
|
921
|
+
}
|
|
922
|
+
}, Ot = ({ value: e, onChange: t }) => {
|
|
923
|
+
let n = Array.isArray(e) ? e : [], [r, i] = h(""), a = () => {
|
|
924
|
+
let e = r.trim();
|
|
925
|
+
e && (t([...n, e]), i(""));
|
|
926
|
+
}, o = (e) => t(n.filter((t, n) => n !== e));
|
|
927
|
+
return /* @__PURE__ */ y("div", {
|
|
928
|
+
className: "flex min-h-[28px] flex-wrap items-center gap-1 px-2 py-1",
|
|
929
|
+
children: [n.map((e, t) => le(e) ? /* @__PURE__ */ y("span", {
|
|
930
|
+
className: "group/file relative inline-block",
|
|
931
|
+
children: [/* @__PURE__ */ v("a", {
|
|
932
|
+
href: e,
|
|
933
|
+
target: "_blank",
|
|
934
|
+
rel: "noopener noreferrer",
|
|
935
|
+
onClick: (e) => e.stopPropagation(),
|
|
936
|
+
children: /* @__PURE__ */ v("img", {
|
|
937
|
+
src: e,
|
|
938
|
+
alt: "",
|
|
939
|
+
className: "h-7 w-7 rounded border border-border object-cover"
|
|
940
|
+
})
|
|
941
|
+
}), /* @__PURE__ */ v("button", {
|
|
942
|
+
type: "button",
|
|
943
|
+
onClick: () => o(t),
|
|
944
|
+
className: "absolute -right-1 -top-1 hidden rounded-full bg-background text-muted-foreground shadow group-hover/file:block hover:text-destructive",
|
|
945
|
+
"aria-label": "Remove file",
|
|
946
|
+
children: /* @__PURE__ */ v(D, { className: "h-3 w-3" })
|
|
947
|
+
})]
|
|
948
|
+
}, t) : /* @__PURE__ */ y("span", {
|
|
949
|
+
className: "inline-flex max-w-full items-center gap-1 rounded-md border border-border/60 px-1.5 py-0.5 text-xs",
|
|
950
|
+
children: [/* @__PURE__ */ v("a", {
|
|
951
|
+
href: e,
|
|
952
|
+
target: "_blank",
|
|
953
|
+
rel: "noopener noreferrer",
|
|
954
|
+
onClick: (e) => e.stopPropagation(),
|
|
955
|
+
className: "max-w-[120px] truncate hover:text-foreground",
|
|
956
|
+
children: Dt(e)
|
|
957
|
+
}), /* @__PURE__ */ v("button", {
|
|
958
|
+
type: "button",
|
|
959
|
+
onClick: () => o(t),
|
|
960
|
+
className: "text-muted-foreground/70 transition-colors hover:text-destructive",
|
|
961
|
+
"aria-label": "Remove file",
|
|
962
|
+
children: /* @__PURE__ */ v(D, { className: "h-3 w-3" })
|
|
963
|
+
})]
|
|
964
|
+
}, t)), /* @__PURE__ */ y(W, { children: [/* @__PURE__ */ v(G, {
|
|
965
|
+
asChild: !0,
|
|
966
|
+
children: /* @__PURE__ */ v("button", {
|
|
967
|
+
type: "button",
|
|
968
|
+
className: "rounded p-0.5 text-muted-foreground transition-colors hover:bg-hover hover:text-foreground",
|
|
969
|
+
"aria-label": "Add file",
|
|
970
|
+
children: /* @__PURE__ */ v(E, { className: "h-3.5 w-3.5" })
|
|
971
|
+
})
|
|
972
|
+
}), /* @__PURE__ */ v(K, {
|
|
973
|
+
align: "start",
|
|
974
|
+
className: "w-64 p-1.5",
|
|
975
|
+
children: /* @__PURE__ */ y("div", {
|
|
976
|
+
className: "flex items-center gap-1",
|
|
977
|
+
children: [/* @__PURE__ */ v("input", {
|
|
978
|
+
autoFocus: !0,
|
|
979
|
+
value: r,
|
|
980
|
+
onChange: (e) => i(e.target.value),
|
|
981
|
+
onKeyDown: (e) => e.key === "Enter" && a(),
|
|
982
|
+
placeholder: "Image or file URL…",
|
|
983
|
+
className: "w-full rounded bg-accent/40 px-1.5 py-1 text-sm outline-hidden"
|
|
984
|
+
}), /* @__PURE__ */ v(j, {
|
|
985
|
+
size: "sm",
|
|
986
|
+
onClick: a,
|
|
987
|
+
"aria-label": "Add file URL",
|
|
988
|
+
children: /* @__PURE__ */ v(E, { className: "h-3.5 w-3.5" })
|
|
989
|
+
})]
|
|
990
|
+
})
|
|
991
|
+
})] })]
|
|
992
|
+
});
|
|
993
|
+
}, kt = ({ kind: e, value: t, onChange: n }) => {
|
|
994
|
+
let r = typeof t == "string" ? t : "";
|
|
995
|
+
return /* @__PURE__ */ y("div", {
|
|
996
|
+
className: "flex items-center",
|
|
997
|
+
children: [/* @__PURE__ */ v("input", {
|
|
998
|
+
type: e === "phone" ? "tel" : e,
|
|
999
|
+
defaultValue: r,
|
|
1000
|
+
onBlur: (e) => n(e.target.value.trim() || null),
|
|
1001
|
+
className: X,
|
|
1002
|
+
placeholder: "Empty",
|
|
1003
|
+
"aria-label": e
|
|
1004
|
+
}), r && /* @__PURE__ */ v("a", {
|
|
1005
|
+
href: wt[e](r),
|
|
1006
|
+
target: "_blank",
|
|
1007
|
+
rel: "noopener noreferrer",
|
|
1008
|
+
onClick: (e) => e.stopPropagation(),
|
|
1009
|
+
className: "px-1.5 text-muted-foreground transition-colors hover:text-foreground",
|
|
1010
|
+
title: "Open",
|
|
1011
|
+
children: /* @__PURE__ */ v(ye, { className: "h-3.5 w-3.5" })
|
|
1012
|
+
})]
|
|
1013
|
+
});
|
|
1014
|
+
}, At = ({ value: e, onChange: t }) => {
|
|
1015
|
+
let n = ae(e), r = e && typeof e == "object" ? e : {}, [i, a] = h(r.lat == null ? "" : String(r.lat)), [o, s] = h(r.lng == null ? "" : String(r.lng)), [c, l] = h(r.label ?? ""), [u, d] = h(r.address ?? ""), f = () => {
|
|
1016
|
+
let e = Number(i), n = Number(o);
|
|
1017
|
+
if (i.trim() === "" && o.trim() === "") {
|
|
1018
|
+
t(null);
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
!Number.isFinite(e) || !Number.isFinite(n) || t({
|
|
1022
|
+
lat: e,
|
|
1023
|
+
lng: n,
|
|
1024
|
+
...c.trim() ? { label: c.trim() } : {},
|
|
1025
|
+
...u.trim() ? { address: u.trim() } : {}
|
|
1026
|
+
});
|
|
1027
|
+
}, p = n ? n.label ?? n.address ?? `${n.lat.toFixed(4)}, ${n.lng.toFixed(4)}` : "";
|
|
1028
|
+
return /* @__PURE__ */ y(W, { children: [/* @__PURE__ */ v(G, {
|
|
1029
|
+
asChild: !0,
|
|
1030
|
+
children: /* @__PURE__ */ y("button", {
|
|
1031
|
+
type: "button",
|
|
1032
|
+
className: "group flex w-full items-center gap-1.5 px-2 py-1 text-left text-sm transition-colors hover:bg-hover",
|
|
1033
|
+
"aria-label": "Location",
|
|
1034
|
+
children: [/* @__PURE__ */ v(be, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/70" }), p ? /* @__PURE__ */ v("span", {
|
|
1035
|
+
className: "truncate",
|
|
1036
|
+
children: p
|
|
1037
|
+
}) : /* @__PURE__ */ v("span", {
|
|
1038
|
+
className: Z,
|
|
1039
|
+
children: "Empty"
|
|
1040
|
+
})]
|
|
1041
|
+
})
|
|
1042
|
+
}), /* @__PURE__ */ y(K, {
|
|
1043
|
+
align: "start",
|
|
1044
|
+
className: "w-64 space-y-2 p-2.5",
|
|
1045
|
+
children: [
|
|
1046
|
+
/* @__PURE__ */ y("div", {
|
|
1047
|
+
className: "flex gap-1.5",
|
|
1048
|
+
children: [/* @__PURE__ */ y("label", {
|
|
1049
|
+
className: "flex-1",
|
|
1050
|
+
children: [/* @__PURE__ */ v("span", {
|
|
1051
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground/70",
|
|
1052
|
+
children: "Latitude"
|
|
1053
|
+
}), /* @__PURE__ */ v("input", {
|
|
1054
|
+
value: i,
|
|
1055
|
+
onChange: (e) => a(e.target.value),
|
|
1056
|
+
onBlur: f,
|
|
1057
|
+
inputMode: "decimal",
|
|
1058
|
+
placeholder: "51.5074",
|
|
1059
|
+
className: "mt-1 w-full rounded border border-border bg-background px-1.5 py-1 text-xs outline-hidden"
|
|
1060
|
+
})]
|
|
1061
|
+
}), /* @__PURE__ */ y("label", {
|
|
1062
|
+
className: "flex-1",
|
|
1063
|
+
children: [/* @__PURE__ */ v("span", {
|
|
1064
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground/70",
|
|
1065
|
+
children: "Longitude"
|
|
1066
|
+
}), /* @__PURE__ */ v("input", {
|
|
1067
|
+
value: o,
|
|
1068
|
+
onChange: (e) => s(e.target.value),
|
|
1069
|
+
onBlur: f,
|
|
1070
|
+
inputMode: "decimal",
|
|
1071
|
+
placeholder: "-0.1278",
|
|
1072
|
+
className: "mt-1 w-full rounded border border-border bg-background px-1.5 py-1 text-xs outline-hidden"
|
|
1073
|
+
})]
|
|
1074
|
+
})]
|
|
1075
|
+
}),
|
|
1076
|
+
/* @__PURE__ */ y("label", {
|
|
1077
|
+
className: "block",
|
|
1078
|
+
children: [/* @__PURE__ */ v("span", {
|
|
1079
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground/70",
|
|
1080
|
+
children: "Label"
|
|
1081
|
+
}), /* @__PURE__ */ v("input", {
|
|
1082
|
+
value: c,
|
|
1083
|
+
onChange: (e) => l(e.target.value),
|
|
1084
|
+
onBlur: f,
|
|
1085
|
+
placeholder: "Optional name",
|
|
1086
|
+
className: "mt-1 w-full rounded border border-border bg-background px-1.5 py-1 text-xs outline-hidden"
|
|
1087
|
+
})]
|
|
1088
|
+
}),
|
|
1089
|
+
/* @__PURE__ */ y("label", {
|
|
1090
|
+
className: "block",
|
|
1091
|
+
children: [/* @__PURE__ */ v("span", {
|
|
1092
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground/70",
|
|
1093
|
+
children: "Address"
|
|
1094
|
+
}), /* @__PURE__ */ v("input", {
|
|
1095
|
+
value: u,
|
|
1096
|
+
onChange: (e) => d(e.target.value),
|
|
1097
|
+
onBlur: f,
|
|
1098
|
+
placeholder: "Optional address",
|
|
1099
|
+
className: "mt-1 w-full rounded border border-border bg-background px-1.5 py-1 text-xs outline-hidden"
|
|
1100
|
+
})]
|
|
1101
|
+
})
|
|
1102
|
+
]
|
|
1103
|
+
})] });
|
|
1104
|
+
}, jt = ({ property: e, value: t, onChange: n, onAddOption: r }) => {
|
|
1105
|
+
let [i, a] = h(""), o = Array.isArray(t) ? t : [], s = (e.options ?? []).filter((e) => o.includes(e.id)), c = (e) => n(o.includes(e) ? o.filter((t) => t !== e) : [...o, e]), l = async () => {
|
|
1106
|
+
let e = await r?.(i);
|
|
1107
|
+
a(""), e && n([...o, e.id]);
|
|
1108
|
+
};
|
|
1109
|
+
return /* @__PURE__ */ y(M, { children: [/* @__PURE__ */ v(N, {
|
|
1110
|
+
asChild: !0,
|
|
1111
|
+
children: /* @__PURE__ */ v("button", {
|
|
1112
|
+
className: "flex min-h-[28px] w-full flex-wrap items-center gap-1 px-2 py-1 text-left text-sm hover:bg-hover",
|
|
1113
|
+
children: s.length > 0 ? s.map((e) => /* @__PURE__ */ v(J, { option: e }, e.id)) : /* @__PURE__ */ v("span", {
|
|
1114
|
+
className: Z,
|
|
1115
|
+
children: "Empty"
|
|
1116
|
+
})
|
|
1117
|
+
})
|
|
1118
|
+
}), /* @__PURE__ */ y(P, {
|
|
1119
|
+
align: "start",
|
|
1120
|
+
className: "w-52",
|
|
1121
|
+
children: [(e.options ?? []).map((e) => /* @__PURE__ */ y(F, {
|
|
1122
|
+
onSelect: (e) => e.preventDefault(),
|
|
1123
|
+
onClick: () => c(e.id),
|
|
1124
|
+
className: "gap-2",
|
|
1125
|
+
children: [/* @__PURE__ */ v(J, { option: e }), o.includes(e.id) && /* @__PURE__ */ v(_e, { className: "ml-auto h-3.5 w-3.5" })]
|
|
1126
|
+
}, e.id)), r && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(I, {}), /* @__PURE__ */ y("div", {
|
|
1127
|
+
className: "flex items-center gap-1 px-1.5 py-1",
|
|
1128
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1129
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1130
|
+
value: i,
|
|
1131
|
+
onChange: (e) => a(e.target.value),
|
|
1132
|
+
onKeyDown: (e) => {
|
|
1133
|
+
e.key === "Enter" && l();
|
|
1134
|
+
},
|
|
1135
|
+
onClick: (e) => e.stopPropagation(),
|
|
1136
|
+
placeholder: "New option…",
|
|
1137
|
+
className: "w-full rounded bg-accent/40 px-1.5 py-1 text-xs outline-hidden"
|
|
1138
|
+
}), /* @__PURE__ */ v(j, {
|
|
1139
|
+
size: "sm",
|
|
1140
|
+
onClick: (e) => {
|
|
1141
|
+
e.stopPropagation(), l();
|
|
1142
|
+
},
|
|
1143
|
+
"aria-label": "Add option",
|
|
1144
|
+
children: /* @__PURE__ */ v(E, { className: "h-3.5 w-3.5" })
|
|
1145
|
+
})]
|
|
1146
|
+
})] })]
|
|
1147
|
+
})] });
|
|
1148
|
+
}, Mt = ({ property: n, value: i, onChange: o }) => {
|
|
1149
|
+
let s = Array.isArray(i) ? i : [], [c, l] = h(""), [u, d] = h(!1), [p, m] = h(null), g = t(), { setPageHint: _ } = a(), b = n.relationDatabaseId, x = !!n.relationSingle, [, ee] = f.useReducer((e) => e + 1, 0);
|
|
1150
|
+
f.useEffect(() => r(ee), []), f.useEffect(() => {
|
|
1151
|
+
if (!b || p !== null || !u && s.length === 0) return;
|
|
1152
|
+
let t = !0;
|
|
1153
|
+
return g.listRows(b).then((n) => {
|
|
1154
|
+
if (!t) return;
|
|
1155
|
+
let r = n.map((t) => ({
|
|
1156
|
+
id: t.id,
|
|
1157
|
+
label: t.name?.trim() || e.label(t.id),
|
|
1158
|
+
icon: e.icon(t.id)
|
|
1159
|
+
}));
|
|
1160
|
+
m(r), r.forEach((e) => _(e.id, e.label));
|
|
1161
|
+
}).catch(() => t && m([])), () => {
|
|
1162
|
+
t = !1;
|
|
1163
|
+
};
|
|
1164
|
+
}, [
|
|
1165
|
+
u,
|
|
1166
|
+
b,
|
|
1167
|
+
s.length,
|
|
1168
|
+
p,
|
|
1169
|
+
g,
|
|
1170
|
+
_
|
|
1171
|
+
]);
|
|
1172
|
+
let te = (t) => p?.find((e) => e.id === t)?.label ?? e.label(t), ne = c.trim().toLowerCase(), S = b ? (p ?? []).filter((e) => !s.includes(e.id) && (!ne || e.label.toLowerCase().includes(ne))) : e.searchPages(c).filter((e) => !s.includes(e.id)), C = (e) => {
|
|
1173
|
+
o(x ? [e] : [...s, e]), l(""), x && d(!1);
|
|
1174
|
+
}, re = (e) => o(s.filter((t) => t !== e)), w = b ? "row" : "page";
|
|
1175
|
+
return /* @__PURE__ */ y("div", {
|
|
1176
|
+
className: "flex min-h-[28px] flex-wrap items-center gap-1 px-2 py-1",
|
|
1177
|
+
children: [s.map((t) => /* @__PURE__ */ y("span", {
|
|
1178
|
+
className: "inline-flex max-w-full items-center gap-1 rounded-md border border-border/60 px-1.5 py-0.5 text-xs",
|
|
1179
|
+
children: [/* @__PURE__ */ v(nt, {
|
|
1180
|
+
rowId: t,
|
|
1181
|
+
children: /* @__PURE__ */ y("span", {
|
|
1182
|
+
className: "inline-flex min-w-0 items-center gap-1",
|
|
1183
|
+
children: [/* @__PURE__ */ v("span", {
|
|
1184
|
+
className: "leading-none",
|
|
1185
|
+
children: e.icon(t)
|
|
1186
|
+
}), /* @__PURE__ */ v("span", {
|
|
1187
|
+
className: "max-w-[120px] truncate",
|
|
1188
|
+
children: te(t)
|
|
1189
|
+
})]
|
|
1190
|
+
})
|
|
1191
|
+
}), /* @__PURE__ */ v("button", {
|
|
1192
|
+
type: "button",
|
|
1193
|
+
onClick: () => re(t),
|
|
1194
|
+
className: "text-muted-foreground/70 transition-colors hover:text-destructive",
|
|
1195
|
+
"aria-label": "Remove link",
|
|
1196
|
+
children: /* @__PURE__ */ v(D, { className: "h-3 w-3" })
|
|
1197
|
+
})]
|
|
1198
|
+
}, t)), (!x || s.length === 0) && /* @__PURE__ */ y(W, {
|
|
1199
|
+
open: u,
|
|
1200
|
+
onOpenChange: d,
|
|
1201
|
+
children: [/* @__PURE__ */ v(G, {
|
|
1202
|
+
asChild: !0,
|
|
1203
|
+
children: /* @__PURE__ */ v("button", {
|
|
1204
|
+
type: "button",
|
|
1205
|
+
className: "rounded p-0.5 text-muted-foreground transition-colors hover:bg-hover hover:text-foreground",
|
|
1206
|
+
"aria-label": `Link a ${w}`,
|
|
1207
|
+
children: /* @__PURE__ */ v(E, { className: "h-3.5 w-3.5" })
|
|
1208
|
+
})
|
|
1209
|
+
}), /* @__PURE__ */ y(K, {
|
|
1210
|
+
align: "start",
|
|
1211
|
+
className: "w-60 p-1",
|
|
1212
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1213
|
+
autoFocus: !0,
|
|
1214
|
+
value: c,
|
|
1215
|
+
onChange: (e) => l(e.target.value),
|
|
1216
|
+
placeholder: `Link a ${w}…`,
|
|
1217
|
+
className: "mb-1 w-full rounded bg-accent/40 px-1.5 py-1 text-sm outline-hidden"
|
|
1218
|
+
}), /* @__PURE__ */ y("div", {
|
|
1219
|
+
className: "max-h-52 overflow-y-auto",
|
|
1220
|
+
children: [S.length === 0 && /* @__PURE__ */ v("div", {
|
|
1221
|
+
className: "px-1.5 py-1.5 text-xs text-muted-foreground",
|
|
1222
|
+
children: b && p === null ? "Loading…" : `No ${w}s found`
|
|
1223
|
+
}), S.map((e) => /* @__PURE__ */ y("button", {
|
|
1224
|
+
type: "button",
|
|
1225
|
+
onClick: () => C(e.id),
|
|
1226
|
+
className: "flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-left text-sm transition-colors hover:bg-hover",
|
|
1227
|
+
children: [/* @__PURE__ */ v(A, {
|
|
1228
|
+
value: e.icon,
|
|
1229
|
+
className: "leading-none"
|
|
1230
|
+
}), /* @__PURE__ */ v("span", {
|
|
1231
|
+
className: "truncate",
|
|
1232
|
+
children: e.label
|
|
1233
|
+
})]
|
|
1234
|
+
}, e.id))]
|
|
1235
|
+
})]
|
|
1236
|
+
})]
|
|
1237
|
+
})]
|
|
1238
|
+
});
|
|
1239
|
+
}, Nt = ({ property: e, value: t, onChange: n, onAddOption: r }) => {
|
|
1240
|
+
let [i, a] = h(""), o = lt(e, t), s = async () => {
|
|
1241
|
+
let e = await r?.(i);
|
|
1242
|
+
a(""), e && n(e.id);
|
|
1243
|
+
};
|
|
1244
|
+
return /* @__PURE__ */ y(M, { children: [/* @__PURE__ */ v(N, {
|
|
1245
|
+
asChild: !0,
|
|
1246
|
+
children: /* @__PURE__ */ y("button", {
|
|
1247
|
+
className: "flex w-full items-center justify-between gap-1 px-2 py-1 text-left text-sm hover:bg-hover",
|
|
1248
|
+
children: [o ? /* @__PURE__ */ v(J, { option: o }) : /* @__PURE__ */ v("span", {
|
|
1249
|
+
className: Z,
|
|
1250
|
+
children: "Empty"
|
|
1251
|
+
}), /* @__PURE__ */ v(ve, { className: "h-3 w-3 shrink-0 text-muted-foreground/60 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100" })]
|
|
1252
|
+
})
|
|
1253
|
+
}), /* @__PURE__ */ y(P, {
|
|
1254
|
+
align: "start",
|
|
1255
|
+
className: "w-52",
|
|
1256
|
+
children: [
|
|
1257
|
+
(e.options ?? []).map((e) => /* @__PURE__ */ y(F, {
|
|
1258
|
+
onClick: () => n(e.id),
|
|
1259
|
+
className: "gap-2",
|
|
1260
|
+
children: [/* @__PURE__ */ v(J, { option: e }), e.id === t && /* @__PURE__ */ v(_e, { className: "ml-auto h-3.5 w-3.5" })]
|
|
1261
|
+
}, e.id)),
|
|
1262
|
+
t != null && /* @__PURE__ */ v(F, {
|
|
1263
|
+
onClick: () => n(null),
|
|
1264
|
+
className: "text-muted-foreground",
|
|
1265
|
+
children: "Clear"
|
|
1266
|
+
}),
|
|
1267
|
+
r && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(I, {}), /* @__PURE__ */ y("div", {
|
|
1268
|
+
className: "flex items-center gap-1 px-1.5 py-1",
|
|
1269
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1270
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1271
|
+
value: i,
|
|
1272
|
+
onChange: (e) => a(e.target.value),
|
|
1273
|
+
onKeyDown: (e) => {
|
|
1274
|
+
e.key === "Enter" && s();
|
|
1275
|
+
},
|
|
1276
|
+
onClick: (e) => e.stopPropagation(),
|
|
1277
|
+
placeholder: "New option…",
|
|
1278
|
+
className: "w-full rounded bg-accent/40 px-1.5 py-1 text-xs outline-hidden"
|
|
1279
|
+
}), /* @__PURE__ */ v(j, {
|
|
1280
|
+
size: "sm",
|
|
1281
|
+
onClick: (e) => {
|
|
1282
|
+
e.stopPropagation(), s();
|
|
1283
|
+
},
|
|
1284
|
+
"aria-label": "Add option",
|
|
1285
|
+
children: /* @__PURE__ */ v(E, { className: "h-3.5 w-3.5" })
|
|
1286
|
+
})]
|
|
1287
|
+
})] })
|
|
1288
|
+
]
|
|
1289
|
+
})] });
|
|
1290
|
+
}, Pt = ({ property: e, value: t, onChange: n }) => {
|
|
1291
|
+
let r = lt(e, t), i = e.options ?? [], a = (e) => /* @__PURE__ */ v("span", {
|
|
1292
|
+
className: "h-2.5 w-2.5 shrink-0 rounded-full",
|
|
1293
|
+
style: { backgroundColor: q[e ?? "gray"] ?? q.gray }
|
|
1294
|
+
});
|
|
1295
|
+
return /* @__PURE__ */ y(M, { children: [/* @__PURE__ */ v(N, {
|
|
1296
|
+
asChild: !0,
|
|
1297
|
+
children: /* @__PURE__ */ y("button", {
|
|
1298
|
+
className: "flex w-full items-center justify-between gap-1 px-2 py-1 text-left text-sm hover:bg-hover",
|
|
1299
|
+
children: [r ? /* @__PURE__ */ y("span", {
|
|
1300
|
+
className: "inline-flex items-center gap-1.5 text-xs",
|
|
1301
|
+
children: [a(r.color), r.label]
|
|
1302
|
+
}) : /* @__PURE__ */ v("span", {
|
|
1303
|
+
className: Z,
|
|
1304
|
+
children: "Empty"
|
|
1305
|
+
}), /* @__PURE__ */ v(ve, { className: "h-3 w-3 shrink-0 text-muted-foreground/60 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100" })]
|
|
1306
|
+
})
|
|
1307
|
+
}), /* @__PURE__ */ y(P, {
|
|
1308
|
+
align: "start",
|
|
1309
|
+
className: "w-56",
|
|
1310
|
+
children: [re.map((e) => {
|
|
1311
|
+
let r = i.filter((t) => (t.group ?? "todo") === e.id);
|
|
1312
|
+
return r.length === 0 ? null : /* @__PURE__ */ y(f.Fragment, { children: [/* @__PURE__ */ v("div", {
|
|
1313
|
+
className: "px-2 pb-0.5 pt-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",
|
|
1314
|
+
children: e.label
|
|
1315
|
+
}), r.map((e) => /* @__PURE__ */ y(F, {
|
|
1316
|
+
onClick: () => n(e.id),
|
|
1317
|
+
className: "gap-2",
|
|
1318
|
+
children: [
|
|
1319
|
+
a(e.color),
|
|
1320
|
+
/* @__PURE__ */ v("span", {
|
|
1321
|
+
className: "truncate",
|
|
1322
|
+
children: e.label
|
|
1323
|
+
}),
|
|
1324
|
+
e.id === t && /* @__PURE__ */ v(_e, { className: "ml-auto h-3.5 w-3.5" })
|
|
1325
|
+
]
|
|
1326
|
+
}, e.id))] }, e.id);
|
|
1327
|
+
}), t != null && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(I, {}), /* @__PURE__ */ v(F, {
|
|
1328
|
+
onClick: () => n(null),
|
|
1329
|
+
className: "text-muted-foreground",
|
|
1330
|
+
children: "Clear"
|
|
1331
|
+
})] })]
|
|
1332
|
+
})] });
|
|
1333
|
+
};
|
|
1334
|
+
//#endregion
|
|
1335
|
+
//#region src/export/chartNormalize.ts
|
|
1336
|
+
function Ft(e, t) {
|
|
1337
|
+
if (Array.isArray(e)) {
|
|
1338
|
+
let n = e.filter((e) => typeof e == "number");
|
|
1339
|
+
return n.length === 0 ? [] : [{
|
|
1340
|
+
name: t,
|
|
1341
|
+
data: n
|
|
1342
|
+
}];
|
|
1343
|
+
}
|
|
1344
|
+
if (e && typeof e == "object" && "series" in e) {
|
|
1345
|
+
let n = e.series;
|
|
1346
|
+
if (!Array.isArray(n)) return [];
|
|
1347
|
+
let r = [];
|
|
1348
|
+
return n.forEach((e, n) => {
|
|
1349
|
+
if (!e || typeof e != "object") return;
|
|
1350
|
+
let i = e, a = typeof i.name == "string" ? i.name : `${t}.${n}`, o = Array.isArray(i.data) ? i.data.filter((e) => typeof e == "number") : [];
|
|
1351
|
+
o.length > 0 && r.push({
|
|
1352
|
+
name: a,
|
|
1353
|
+
data: o
|
|
1354
|
+
});
|
|
1355
|
+
}), r;
|
|
1356
|
+
}
|
|
1357
|
+
return [];
|
|
1358
|
+
}
|
|
1359
|
+
//#endregion
|
|
1360
|
+
//#region src/export/documentModel.ts
|
|
1361
|
+
var Q = (e) => typeof e == "string" ? e : "";
|
|
1362
|
+
function It(e) {
|
|
1363
|
+
let t = [];
|
|
1364
|
+
for (let n of e) if (n.type === "columns" && Array.isArray(n.data?.columns)) for (let e of n.data.columns) t.push(...It(e));
|
|
1365
|
+
else t.push(n);
|
|
1366
|
+
return t;
|
|
1367
|
+
}
|
|
1368
|
+
function $(e) {
|
|
1369
|
+
if (typeof DOMParser > "u") return e ? [{ text: Lt(e) }] : [];
|
|
1370
|
+
let t = new DOMParser().parseFromString(`<body>${e}</body>`, "text/html"), n = [], r = (e, t) => {
|
|
1371
|
+
if (e.nodeType === 3) {
|
|
1372
|
+
let r = e.textContent ?? "";
|
|
1373
|
+
r && n.push({
|
|
1374
|
+
...t,
|
|
1375
|
+
text: r
|
|
1376
|
+
});
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
if (e.nodeType !== 1) return;
|
|
1380
|
+
let i = e, a = i.tagName.toLowerCase();
|
|
1381
|
+
if (a === "a" && i.classList.contains("ob-mention")) {
|
|
1382
|
+
let e = i.textContent ?? "";
|
|
1383
|
+
n.push({
|
|
1384
|
+
text: e,
|
|
1385
|
+
mention: {
|
|
1386
|
+
pageId: i.getAttribute("data-page-id") ?? "",
|
|
1387
|
+
label: e
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
if (a === "br") {
|
|
1393
|
+
n.push({
|
|
1394
|
+
...t,
|
|
1395
|
+
text: "\n"
|
|
1396
|
+
});
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
let o = { ...t }, s = i.getAttribute("style") ?? "";
|
|
1400
|
+
if (a === "b" || a === "strong") o.bold = !0;
|
|
1401
|
+
else if (a === "i" || a === "em") o.italic = !0;
|
|
1402
|
+
else if (a === "u") o.underline = !0;
|
|
1403
|
+
else if (a === "s" || a === "del" || a === "strike") o.strike = !0;
|
|
1404
|
+
else if (a === "mark") {
|
|
1405
|
+
o.marker = !0;
|
|
1406
|
+
let e = s.match(/background(?:-color)?:\s*([^;]+)/i);
|
|
1407
|
+
e && (o.markerColor = e[1].trim());
|
|
1408
|
+
} else if (a === "code") o.code = !0;
|
|
1409
|
+
else if (a === "span") {
|
|
1410
|
+
let e = s.match(/(?:^|[^-])color:\s*([^;]+)/i);
|
|
1411
|
+
e && (o.color = e[1].trim());
|
|
1412
|
+
} else a === "a" && (o.link = i.getAttribute("href") ?? void 0);
|
|
1413
|
+
i.childNodes.forEach((e) => r(e, o));
|
|
1414
|
+
};
|
|
1415
|
+
return t.body.childNodes.forEach((e) => r(e, {})), n;
|
|
1416
|
+
}
|
|
1417
|
+
function Lt(e) {
|
|
1418
|
+
return e.replace(/<[^>]*>/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/ /g, " ");
|
|
1419
|
+
}
|
|
1420
|
+
function Rt(e) {
|
|
1421
|
+
return Array.isArray(e) ? e.map((e) => {
|
|
1422
|
+
if (typeof e == "string") return {
|
|
1423
|
+
runs: $(e),
|
|
1424
|
+
items: []
|
|
1425
|
+
};
|
|
1426
|
+
let t = e ?? {};
|
|
1427
|
+
return {
|
|
1428
|
+
runs: $(Q(t.content ?? t.text)),
|
|
1429
|
+
items: Rt(t.items)
|
|
1430
|
+
};
|
|
1431
|
+
}) : [];
|
|
1432
|
+
}
|
|
1433
|
+
function zt(e) {
|
|
1434
|
+
return e.map((e) => e.text).join("");
|
|
1435
|
+
}
|
|
1436
|
+
function Bt({ title: e, icon: t, snapshot: n }) {
|
|
1437
|
+
let r = u(n), i = It(r.editorjs?.blocks ?? []), a = new Map(r.values), o = /* @__PURE__ */ new Map();
|
|
1438
|
+
for (let [e, t] of r.names) o.set(t, e);
|
|
1439
|
+
let s = [];
|
|
1440
|
+
for (let e of i) {
|
|
1441
|
+
let t = e.data ?? {}, n = e.id ?? "";
|
|
1442
|
+
switch (e.type) {
|
|
1443
|
+
case "paragraph":
|
|
1444
|
+
s.push({
|
|
1445
|
+
type: "paragraph",
|
|
1446
|
+
runs: $(Q(t.text))
|
|
1447
|
+
});
|
|
1448
|
+
break;
|
|
1449
|
+
case "header": {
|
|
1450
|
+
let e = typeof t.level == "number" ? Math.min(6, Math.max(1, t.level)) : 2;
|
|
1451
|
+
s.push({
|
|
1452
|
+
type: "header",
|
|
1453
|
+
level: e,
|
|
1454
|
+
runs: $(Q(t.text))
|
|
1455
|
+
});
|
|
1456
|
+
break;
|
|
1457
|
+
}
|
|
1458
|
+
case "list":
|
|
1459
|
+
s.push({
|
|
1460
|
+
type: "list",
|
|
1461
|
+
ordered: t.style === "ordered",
|
|
1462
|
+
items: Rt(t.items)
|
|
1463
|
+
});
|
|
1464
|
+
break;
|
|
1465
|
+
case "quote":
|
|
1466
|
+
s.push({
|
|
1467
|
+
type: "quote",
|
|
1468
|
+
runs: $(Q(t.text)),
|
|
1469
|
+
caption: Lt(Q(t.caption))
|
|
1470
|
+
});
|
|
1471
|
+
break;
|
|
1472
|
+
case "code":
|
|
1473
|
+
s.push({
|
|
1474
|
+
type: "code",
|
|
1475
|
+
code: Q(t.code)
|
|
1476
|
+
});
|
|
1477
|
+
break;
|
|
1478
|
+
case "delimiter":
|
|
1479
|
+
s.push({ type: "delimiter" });
|
|
1480
|
+
break;
|
|
1481
|
+
case "table": {
|
|
1482
|
+
let e = (Array.isArray(t.content) ? t.content : []).map((e) => (Array.isArray(e) ? e : []).map((e) => $(Q(e))));
|
|
1483
|
+
s.push({
|
|
1484
|
+
type: "table",
|
|
1485
|
+
withHeadings: t.withHeadings === !0,
|
|
1486
|
+
rows: e
|
|
1487
|
+
});
|
|
1488
|
+
break;
|
|
1489
|
+
}
|
|
1490
|
+
case "callout":
|
|
1491
|
+
s.push({
|
|
1492
|
+
type: "callout",
|
|
1493
|
+
variant: Q(t.variant) || "info",
|
|
1494
|
+
runs: $(Q(t.text))
|
|
1495
|
+
});
|
|
1496
|
+
break;
|
|
1497
|
+
case "accordion":
|
|
1498
|
+
s.push({
|
|
1499
|
+
type: "accordion",
|
|
1500
|
+
title: $(Q(t.title)),
|
|
1501
|
+
content: $(Q(t.content)),
|
|
1502
|
+
open: t.open !== !1
|
|
1503
|
+
});
|
|
1504
|
+
break;
|
|
1505
|
+
case "checklist": {
|
|
1506
|
+
let e = Array.isArray(t.items) ? t.items : [];
|
|
1507
|
+
s.push({
|
|
1508
|
+
type: "checklist",
|
|
1509
|
+
items: e.map((e) => ({
|
|
1510
|
+
runs: $(Q(e.text)),
|
|
1511
|
+
checked: e.checked === !0
|
|
1512
|
+
}))
|
|
1513
|
+
});
|
|
1514
|
+
break;
|
|
1515
|
+
}
|
|
1516
|
+
case "toc":
|
|
1517
|
+
s.push({
|
|
1518
|
+
type: "toc",
|
|
1519
|
+
entries: []
|
|
1520
|
+
});
|
|
1521
|
+
break;
|
|
1522
|
+
case "button":
|
|
1523
|
+
s.push({
|
|
1524
|
+
type: "button",
|
|
1525
|
+
label: Q(t.label),
|
|
1526
|
+
url: Q(t.url)
|
|
1527
|
+
});
|
|
1528
|
+
break;
|
|
1529
|
+
case "divider":
|
|
1530
|
+
s.push({
|
|
1531
|
+
type: "divider",
|
|
1532
|
+
style: Q(t.style) || "line",
|
|
1533
|
+
label: Q(t.label)
|
|
1534
|
+
});
|
|
1535
|
+
break;
|
|
1536
|
+
case "slider":
|
|
1537
|
+
s.push({
|
|
1538
|
+
type: "slider",
|
|
1539
|
+
name: Q(t.name) || o.get(n) || "value",
|
|
1540
|
+
value: a.get(n)
|
|
1541
|
+
});
|
|
1542
|
+
break;
|
|
1543
|
+
case "expr":
|
|
1544
|
+
if (t.hidden === !0) break;
|
|
1545
|
+
s.push({
|
|
1546
|
+
type: "expr",
|
|
1547
|
+
name: Q(t.name) || o.get(n) || "expr",
|
|
1548
|
+
value: a.get(n),
|
|
1549
|
+
source: Q(t.source)
|
|
1550
|
+
});
|
|
1551
|
+
break;
|
|
1552
|
+
case "chart": {
|
|
1553
|
+
let e = Array.isArray(t.refCellIds) ? t.refCellIds : t.refCellId ? [String(t.refCellId)] : [], n = [];
|
|
1554
|
+
for (let t of e) n.push(...Ft(a.get(t), o.get(t) ?? t));
|
|
1555
|
+
let r = Q(t.labels).split(",").map((e) => e.trim()).filter(Boolean);
|
|
1556
|
+
s.push({
|
|
1557
|
+
type: "chart",
|
|
1558
|
+
series: n,
|
|
1559
|
+
kind: Q(t.kind) || "line",
|
|
1560
|
+
labels: r,
|
|
1561
|
+
title: Q(t.title),
|
|
1562
|
+
value: e.length ? a.get(e[0]) : void 0
|
|
1563
|
+
});
|
|
1564
|
+
break;
|
|
1565
|
+
}
|
|
1566
|
+
case "kitinput":
|
|
1567
|
+
s.push({
|
|
1568
|
+
type: "kvalue",
|
|
1569
|
+
label: Q(t.label) || Q(t.name) || "Field",
|
|
1570
|
+
value: a.has(n) ? a.get(n) : t.value
|
|
1571
|
+
});
|
|
1572
|
+
break;
|
|
1573
|
+
case "kitlight":
|
|
1574
|
+
s.push({
|
|
1575
|
+
type: "light",
|
|
1576
|
+
label: Q(t.label) || "Status",
|
|
1577
|
+
status: Q(t.status) || "off",
|
|
1578
|
+
value: a.get(Q(t.refCellId))
|
|
1579
|
+
});
|
|
1580
|
+
break;
|
|
1581
|
+
case "kitprogress": {
|
|
1582
|
+
let e = Q(t.refCellId), n = Number(t.max ?? 100) || 100, r = Q(t.format) || "percent", i = typeof a.get(e) == "boolean" ? a.get(e) ? n : 0 : Number(a.get(e) ?? 0), o = Number.isFinite(i) ? Math.max(0, Math.min(1, n === 0 ? 0 : i / n)) : 0, c = Math.round(o * 100), l = (e) => String(Number.isInteger(e) ? e : Math.round(e * 100) / 100);
|
|
1583
|
+
s.push({
|
|
1584
|
+
type: "progress",
|
|
1585
|
+
label: Q(t.label) || "Progress",
|
|
1586
|
+
pct: c,
|
|
1587
|
+
readout: r === "fraction" ? `${l(i)} / ${l(n)}` : `${c}%`
|
|
1588
|
+
});
|
|
1589
|
+
break;
|
|
1590
|
+
}
|
|
1591
|
+
case "kitbutton":
|
|
1592
|
+
Q(t.action) === "link" && Q(t.url) && s.push({
|
|
1593
|
+
type: "button",
|
|
1594
|
+
label: Q(t.label) || Q(t.url),
|
|
1595
|
+
url: Q(t.url)
|
|
1596
|
+
});
|
|
1597
|
+
break;
|
|
1598
|
+
case "subpage":
|
|
1599
|
+
s.push({
|
|
1600
|
+
type: "paragraph",
|
|
1601
|
+
runs: [{
|
|
1602
|
+
text: Q(t.pageId),
|
|
1603
|
+
mention: {
|
|
1604
|
+
pageId: Q(t.pageId),
|
|
1605
|
+
label: Q(t.pageId)
|
|
1606
|
+
}
|
|
1607
|
+
}]
|
|
1608
|
+
});
|
|
1609
|
+
break;
|
|
1610
|
+
default:
|
|
1611
|
+
s.push({
|
|
1612
|
+
type: "unknown",
|
|
1613
|
+
raw: e.type ?? "unknown"
|
|
1614
|
+
});
|
|
1615
|
+
break;
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
let c = s.filter((e) => e.type === "header").map((e) => ({
|
|
1619
|
+
level: e.level,
|
|
1620
|
+
text: zt(e.runs)
|
|
1621
|
+
}));
|
|
1622
|
+
for (let e of s) e.type === "toc" && (e.entries = c);
|
|
1623
|
+
return {
|
|
1624
|
+
title: e.trim() || "Untitled",
|
|
1625
|
+
icon: t,
|
|
1626
|
+
blocks: s
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
//#endregion
|
|
1630
|
+
//#region src/export/format.ts
|
|
1631
|
+
function Vt(e) {
|
|
1632
|
+
if (e === void 0) return "—";
|
|
1633
|
+
if (e === null) return "null";
|
|
1634
|
+
if (Array.isArray(e)) return e.length > 8 ? `[${e.slice(0, 8).map(Ht).join(", ")}, … (${e.length})]` : `[${e.map(Ht).join(", ")}]`;
|
|
1635
|
+
if (typeof e == "object") try {
|
|
1636
|
+
return JSON.stringify(e);
|
|
1637
|
+
} catch {
|
|
1638
|
+
return String(e);
|
|
1639
|
+
}
|
|
1640
|
+
return Ht(e);
|
|
1641
|
+
}
|
|
1642
|
+
function Ht(e) {
|
|
1643
|
+
return String(typeof e == "number" ? Number.isInteger(e) ? e : Math.round(e * 1e3) / 1e3 : e);
|
|
1644
|
+
}
|
|
1645
|
+
//#endregion
|
|
1646
|
+
export { Oe as A, A as B, Fe as C, Ee as D, M as E, Se as F, Te as I, we as L, De as M, I as N, P as O, ke as P, N as R, Ue as S, U as T, Ke as _, vt as a, G as b, Y as c, it as d, nt as f, q as g, Ye as h, at as i, Ce as j, F as k, _t as l, Xe as m, Bt as n, J as o, qe as p, $ as r, rt as s, Vt as t, gt as u, W as v, We as w, Ve as x, K as y, j as z };
|