docblocks-react-ui 0.6.6 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/README.md +53 -3
- package/dist/{Editor-D_TogV4X.mjs → Editor-3Oh9KNyH.mjs} +3716 -3332
- package/dist/{constants-OOBlKSTr.mjs → constants-D8PSgkwi.mjs} +6 -6
- package/dist/{index-CeuUfoao.d.mts → index-B72m5FmT.d.mts} +47 -2
- package/dist/index.d.mts +18 -3
- package/dist/index.mjs +42 -3
- package/dist/mermaid/index.mjs +2 -2
- package/dist/pdf/index.d.mts +1 -1
- package/dist/pdf/index.mjs +2 -2
- package/dist/styles.css +25 -18
- package/package.json +1 -1
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
|
-
//#region src/shared/ui/cn.ts
|
|
5
|
-
function cn(...inputs) {
|
|
6
|
-
return twMerge(clsx(inputs));
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
4
|
//#region src/shared/ui/icons/ChevronLeft.tsx
|
|
10
5
|
function ChevronLeft(props) {
|
|
11
6
|
return /* @__PURE__ */ jsx("svg", {
|
|
@@ -129,6 +124,11 @@ function X(props) {
|
|
|
129
124
|
});
|
|
130
125
|
}
|
|
131
126
|
//#endregion
|
|
127
|
+
//#region src/shared/ui/cn.ts
|
|
128
|
+
function cn(...inputs) {
|
|
129
|
+
return twMerge(clsx(inputs));
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
132
|
//#region src/shared/utils.ts
|
|
133
133
|
/** Clamps a value into the inclusive [min, max] range. */
|
|
134
134
|
function clamp(value, min, max) {
|
|
@@ -179,4 +179,4 @@ function isEmbeddablePdfUrl(url) {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
//#endregion
|
|
182
|
-
export { preventDefault as a,
|
|
182
|
+
export { preventDefault as a, X as c, Minus as d, LoaderCircle as f, isSafeDownloadHref as i, TriangleAlert as l, ChevronLeft as m, assertNever as n, stopPropagation as o, ChevronRight as p, clamp as r, cn as s, isEmbeddablePdfUrl as t, Plus as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as BlockRendererMap } from "./index-YJcgf8Hh.mjs";
|
|
2
2
|
import { ComponentType, ReactNode } from "react";
|
|
3
|
-
import { Block, BlockContent, BlockId, BlockType, CanvasTextAttrs, Change, ConnectorAttrs, DatabaseFilterPayload, Doc, DocMeta, Geometry, PresenceSelection, PresenceState, Selection, SelectionView, ShapeAttrs, SyncEmbedRef, SyncProvider } from "docblocks-core";
|
|
3
|
+
import { Block, BlockContent, BlockId, BlockType, CanvasTextAttrs, Change, ConnectorAttrs, DatabaseFilterPayload, Doc, DocMeta, Geometry, MentionMark, PresenceSelection, PresenceState, Selection, SelectionView, ShapeAttrs, SyncEmbedRef, SyncProvider } from "docblocks-core";
|
|
4
4
|
import { StoreApi } from "zustand/vanilla";
|
|
5
5
|
//#region src/blob-store.d.ts
|
|
6
6
|
/**
|
|
@@ -32,6 +32,18 @@ interface BlobStore {
|
|
|
32
32
|
subscribe(fileId: string, onChange: () => void): () => void;
|
|
33
33
|
/** Optional garbage collection. */
|
|
34
34
|
remove?(fileId: string): Promise<void>;
|
|
35
|
+
/** Optional lightweight display resolution: file id → the metadata WITHOUT
|
|
36
|
+
* the bytes (the cheap head stand, no body transfer). The built-in
|
|
37
|
+
* file / image blocks resolve the bytes over `get` only when they render
|
|
38
|
+
* the payload (the pdf preview, the `<img>`); any other MIME stands the
|
|
39
|
+
* meta card with the `downloadUrl`'s href. Without the member the blocks
|
|
40
|
+
* keep the legacy stand (the bytes over `get`). Rejects an unknown id
|
|
41
|
+
* (the missing's stand). */
|
|
42
|
+
getMeta?(fileId: string): Promise<BlobMeta>;
|
|
43
|
+
/** Optional direct download URL for a file id (the meta card's href — no
|
|
44
|
+
* object URL stands). Without the member the download's href stands the
|
|
45
|
+
* object URL resolved over `get` (the legacy's path). */
|
|
46
|
+
downloadUrl?(fileId: string): string;
|
|
35
47
|
}
|
|
36
48
|
/** The default in-memory store: blobs live for the JS session only. */
|
|
37
49
|
declare function createMemoryBlobStore(): BlobStore;
|
|
@@ -1004,6 +1016,26 @@ interface MentionProvider {
|
|
|
1004
1016
|
/** The documents matching the query (the `doc` mention kind). */
|
|
1005
1017
|
searchDocs(query: string): Promise<MentionEntry[]>;
|
|
1006
1018
|
}
|
|
1019
|
+
/**
|
|
1020
|
+
* The mention interactions: the consumer's hover card (the design + the
|
|
1021
|
+
* data — the package stands the position and the lifecycle only, over a
|
|
1022
|
+
* plain portaled host) and the chip's click (the consumer decides what
|
|
1023
|
+
* opens). The target stands the document's `mention` mark (the core's
|
|
1024
|
+
* `MentionMark`: the kind, the stable id, and the label snapshot) — the
|
|
1025
|
+
* consumer resolves the current data over the id (the catalog, the URL).
|
|
1026
|
+
* Optional over the provider: without it the chip stands as before (no
|
|
1027
|
+
* card, the click is the browser's stand).
|
|
1028
|
+
*/
|
|
1029
|
+
interface MentionInteractions {
|
|
1030
|
+
/** The hover card's content (the consumer's design + data); `null`
|
|
1031
|
+
* stands no card for this target (e.g. the removed's target stand). */
|
|
1032
|
+
renderCard: (mention: MentionMark) => ReactNode | null;
|
|
1033
|
+
/** The chip's click: the consumer decides what opens (the navigation,
|
|
1034
|
+
* the modal). The native event — the consumer's `preventDefault()`
|
|
1035
|
+
* keeps the caret in place (the atomic chip's default stand moves it).
|
|
1036
|
+
* The package stands no default behavior and opens nothing. */
|
|
1037
|
+
onClick?: (mention: MentionMark, event: MouseEvent) => void;
|
|
1038
|
+
}
|
|
1007
1039
|
/** The per-instance selection view; null before the mount effect ran and after unmount. */
|
|
1008
1040
|
interface SelectionRef {
|
|
1009
1041
|
view: SelectionView | null;
|
|
@@ -1063,6 +1095,8 @@ interface EditorContextValue {
|
|
|
1063
1095
|
pdfPreview: PdfPreview | null;
|
|
1064
1096
|
/** The consumer's mention search provider; null when none was supplied (`@` stays plain text). */
|
|
1065
1097
|
mentionProvider: MentionProvider | null;
|
|
1098
|
+
/** The consumer's mention interactions (the hover card + the click); null when none was supplied (the chip stands inert). */
|
|
1099
|
+
mentionInteractions: MentionInteractions | null;
|
|
1066
1100
|
/** The effective embed sandbox policy (the consumer's, or the safe default) — always present. */
|
|
1067
1101
|
embedSandbox: EmbedSandboxPolicy;
|
|
1068
1102
|
/** The entry-list root: the document root by default, a subtree block otherwise. */
|
|
@@ -1179,6 +1213,17 @@ interface EditorProviderProps {
|
|
|
1179
1213
|
* supplies none inherits the enclosing one.
|
|
1180
1214
|
*/
|
|
1181
1215
|
mentionProvider?: MentionProvider;
|
|
1216
|
+
/**
|
|
1217
|
+
* Optional mention interactions: the hover card's content
|
|
1218
|
+
* (`renderCard`) and the chip's click's delivery (`onClick`). The
|
|
1219
|
+
* package stands the card's position + lifecycle only (the portaled
|
|
1220
|
+
* host, the hover's delay/grace, the Escape's close, the anchor's
|
|
1221
|
+
* removal's close) — the design and the data are the consumer's, the
|
|
1222
|
+
* click's stand is the consumer's. Like `mentionProvider`, the value is
|
|
1223
|
+
* read per render into the provider context: pass a stable reference.
|
|
1224
|
+
* A nested provider that supplies none inherits the enclosing one.
|
|
1225
|
+
*/
|
|
1226
|
+
mentionInteractions?: MentionInteractions;
|
|
1182
1227
|
/**
|
|
1183
1228
|
* Optional embed sandbox policy: the iframe's `sandbox` value for a given
|
|
1184
1229
|
* embed src; `null` stands no sandbox (a fully trusted embed). Without it
|
|
@@ -1255,4 +1300,4 @@ declare const DEFAULT_EMBED_SANDBOX = "allow-scripts allow-same-origin allow-for
|
|
|
1255
1300
|
/** Read the per-instance editor context; throws outside an EditorProvider. */
|
|
1256
1301
|
declare function useEditorContext(): EditorContextValue;
|
|
1257
1302
|
//#endregion
|
|
1258
|
-
export {
|
|
1303
|
+
export { ProtocolDescriptor as $, emptyFilter as A, Column as B, DatabaseTableProps as C, BlobStore as Ct, DatabaseTablePhase as D, useDatabaseTable as E, BridgeColumnAnnotation as F, Id as G, DomainEvent as H, BridgeTableDescription as I, MutationReceipt as J, IsoInstant as K, BridgeValueInput as L, FilterBuilder as M, BatchOp as N, DatabaseTableRow as O, BridgeColumn as P, ProtocolCapability as Q, CellMap as R, DatabaseTable as S, BlobRef as St, UseTableList as T, FilterConditionInput as U, DatabaseBridge as V, FilterInput as W, PageQuery as X, OperationStatus as Y, PageSnapshot as Z, PresenceIdentity as _, BridgeErrorCode as _t, EditorContextValue as a, RowWire as at, PresenceSharingMode as b, toBridgeError as bt, EmbedSandboxPolicy as c, SubscriptionObserver as ct, MentionProvider as d, TableEnvelopeBase as dt, ProtocolLimits as et, PdfPreview as f, TableEvent as ft, PresenceCrypto as g, BridgeError as gt, SyncEmbedResolver as h, BRIDGE_ERROR_CODES as ht, AccessLevel as i, RowPage as it, filterIsComplete as j, UseDatabaseTable as k, MentionEntry as l, SubscriptionStatus as lt, PresenceConfig as m, TableSnapshot as mt, DEFAULT_EMBED_SANDBOX as n, QuerySemantics as nt, EditorMode as o, SortInput as ot, PdfPreviewProps as p, TableRef as pt, MutationContext as q, EditorProvider as r, Revision as rt, EditorProviderProps as s, SubscriptionHandle as st, useEditorContext as t, QueryOperator as tt, MentionInteractions as u, TableDescription as ut, PresencePeer as v, isBridgeError as vt, DatabaseTableView as w, createMemoryBlobStore as wt, useTableList as x, BlobMeta as xt, PresenceSharing as y, isBridgeErrorCode as yt, CellValueParse as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as BlockRendererMap, r as BlockRendererProps, t as BlockRenderer } from "./index-YJcgf8Hh.mjs";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as ProtocolDescriptor, A as emptyFilter, B as Column, C as DatabaseTableProps, Ct as BlobStore, D as DatabaseTablePhase, E as useDatabaseTable, F as BridgeColumnAnnotation, G as Id, H as DomainEvent, I as BridgeTableDescription, J as MutationReceipt, K as IsoInstant, L as BridgeValueInput, M as FilterBuilder, N as BatchOp, O as DatabaseTableRow, P as BridgeColumn, Q as ProtocolCapability, R as CellMap, S as DatabaseTable, St as BlobRef, T as UseTableList, U as FilterConditionInput, V as DatabaseBridge, W as FilterInput, X as PageQuery, Y as OperationStatus, Z as PageSnapshot, _ as PresenceIdentity, _t as BridgeErrorCode, a as EditorContextValue, at as RowWire, b as PresenceSharingMode, bt as toBridgeError, c as EmbedSandboxPolicy, ct as SubscriptionObserver, d as MentionProvider, dt as TableEnvelopeBase, et as ProtocolLimits, f as PdfPreview, ft as TableEvent, g as PresenceCrypto, gt as BridgeError, h as SyncEmbedResolver, ht as BRIDGE_ERROR_CODES, i as AccessLevel, it as RowPage, j as filterIsComplete, k as UseDatabaseTable, l as MentionEntry, lt as SubscriptionStatus, m as PresenceConfig, mt as TableSnapshot, n as DEFAULT_EMBED_SANDBOX, nt as QuerySemantics, o as EditorMode, ot as SortInput, p as PdfPreviewProps, pt as TableRef, q as MutationContext, r as EditorProvider, rt as Revision, s as EditorProviderProps, st as SubscriptionHandle, t as useEditorContext, tt as QueryOperator, u as MentionInteractions, ut as TableDescription, v as PresencePeer, vt as isBridgeError, w as DatabaseTableView, wt as createMemoryBlobStore, x as useTableList, xt as BlobMeta, y as PresenceSharing, yt as isBridgeErrorCode, z as CellValueParse } from "./index-B72m5FmT.mjs";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { ComponentType, ReactNode } from "react";
|
|
5
|
-
import { Block, BlockId, BlockType, Doc, DocMeta, PresenceState, Selection, SelectionView, SyncEmbedRef, TextRun } from "docblocks-core";
|
|
5
|
+
import { Block, BlockId, BlockType, Doc, DocMeta, MentionMark, PresenceState, Selection, SelectionView, SyncEmbedRef, TextRun } from "docblocks-core";
|
|
6
6
|
import "i18next";
|
|
7
7
|
import { VariantProps } from "class-variance-authority";
|
|
8
8
|
import { ClassValue } from "clsx";
|
|
@@ -259,6 +259,21 @@ declare function markToggleAction(doc: Doc, blockId: BlockId, from: number, to:
|
|
|
259
259
|
* through the editor's `formatPalette` prop — a `string[]` of hex or var). */
|
|
260
260
|
declare const FORMAT_PALETTE: readonly string[];
|
|
261
261
|
//#endregion
|
|
262
|
+
//#region src/editing/import.d.ts
|
|
263
|
+
/** The import payload kind (the parser dispatch). */
|
|
264
|
+
type ImportKind = "markdown" | "html";
|
|
265
|
+
/** The document is not fresh: the import requires the empty root. */
|
|
266
|
+
declare class ImportDocumentError extends Error {
|
|
267
|
+
constructor(message: string);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Import a markdown / HTML payload into a fresh document (the empty root):
|
|
271
|
+
* the parsed blocks fill the root in one transaction (one undo step, one
|
|
272
|
+
* wire update). An empty (or whitespace-only) payload is a no-op. Throws
|
|
273
|
+
* `ImportDocumentError` when the root already has children.
|
|
274
|
+
*/
|
|
275
|
+
declare function importDocument(doc: Doc, source: string, kind: ImportKind): void;
|
|
276
|
+
//#endregion
|
|
262
277
|
//#region src/text/runs.d.ts
|
|
263
278
|
/**
|
|
264
279
|
* Render inline text runs with their marks (lenient reader contract:
|
|
@@ -467,4 +482,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
|
|
|
467
482
|
//#region src/shared/ui/cn.d.ts
|
|
468
483
|
declare function cn(...inputs: ClassValue[]): string;
|
|
469
484
|
//#endregion
|
|
470
|
-
export { type AccessLevel, Alert, AlertDescription, AlertTitle, BASELINE_CAPABILITIES, BRIDGE_ERROR_CODES, Badge, BareSelect, type BatchOp, type BlobMeta, type BlobRef, type BlobStore, type BlockRenderer, type BlockRendererMap, type BlockRendererProps, type BridgeColumn, type BridgeColumnAnnotation, BridgeError, type BridgeErrorCode, type BridgeTableDescription, type BridgeValueInput, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellMap, type CellValueParse, Checkbox, type Column, DEFAULT_EMBED_SANDBOX, type DatabaseBridge, DatabaseTable, type DatabaseTablePhase, type DatabaseTableProps, type DatabaseTableRow, type DatabaseTableView, DocHeader, DocblocksI18nProvider, type DocblocksI18nProviderProps, type DomainEvent, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Editor, type EditorContextValue, type EditorMode, EditorProvider, type EditorProviderProps, type EditorView, type EmbedSandboxPolicy, FORMAT_PALETTE, FilterBuilder, type FilterConditionInput, type FilterInput, type FormatMark, type Id, Input, type IsoInstant, Label, MONO_FONT_STACK, type MentionEntry, type MentionProvider, type MutationContext, type MutationReceipt, type OperationStatus, PROTOCOL_VERSION, type PageQuery, type PageSnapshot, type PdfPreview, type PdfPreviewProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, type PresenceConfig, type PresenceCrypto, type PresenceIdentity, type PresencePeer, type PresenceSharing, type PresenceSharingMode, type ProtocolCapability, type ProtocolDescriptor, type ProtocolLimits, type QueryOperator, type QuerySemantics, type Revision, type RowPage, type RowWire, SHAPE_FONT_OPTIONS, SHAPE_FONT_STACKS, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Skeleton, type SortInput, type SubscriptionHandle, type SubscriptionObserver, type SubscriptionStatus, type SyncEmbedRef, type SyncEmbedResolver, TEXT_TYPES, type TableDescription, type TableEnvelopeBase, type TableEvent, type TableRef, type TableSnapshot, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UI_FONT_ID, UI_FONT_STACK, type UseDatabaseTable, type UseTableList, badgeVariants, buttonVariants, cellValueEqual, cn, columnAnnotation, conditionMatches, createMemoryBlobStore, emptyFilter, filterIsComplete, isBridgeError, isBridgeErrorCode, isDatabaseBridge, markToggleAction, newMutationContext, parseCellValue, renderRuns, toBridgeError, useBlock, useDatabaseTable, useDoc, useEditorContext, useMeta, usePresence, usePresenceSharing, useSelection, useSelectionView, useTableList, useText, validateProtocolDescriptor };
|
|
485
|
+
export { type AccessLevel, Alert, AlertDescription, AlertTitle, BASELINE_CAPABILITIES, BRIDGE_ERROR_CODES, Badge, BareSelect, type BatchOp, type BlobMeta, type BlobRef, type BlobStore, type BlockRenderer, type BlockRendererMap, type BlockRendererProps, type BridgeColumn, type BridgeColumnAnnotation, BridgeError, type BridgeErrorCode, type BridgeTableDescription, type BridgeValueInput, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellMap, type CellValueParse, Checkbox, type Column, DEFAULT_EMBED_SANDBOX, type DatabaseBridge, DatabaseTable, type DatabaseTablePhase, type DatabaseTableProps, type DatabaseTableRow, type DatabaseTableView, DocHeader, DocblocksI18nProvider, type DocblocksI18nProviderProps, type DomainEvent, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Editor, type EditorContextValue, type EditorMode, EditorProvider, type EditorProviderProps, type EditorView, type EmbedSandboxPolicy, FORMAT_PALETTE, FilterBuilder, type FilterConditionInput, type FilterInput, type FormatMark, type Id, ImportDocumentError, Input, type IsoInstant, Label, MONO_FONT_STACK, type MentionEntry, type MentionInteractions, type MentionMark, type MentionProvider, type MutationContext, type MutationReceipt, type OperationStatus, PROTOCOL_VERSION, type PageQuery, type PageSnapshot, type PdfPreview, type PdfPreviewProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, type PresenceConfig, type PresenceCrypto, type PresenceIdentity, type PresencePeer, type PresenceSharing, type PresenceSharingMode, type ProtocolCapability, type ProtocolDescriptor, type ProtocolLimits, type QueryOperator, type QuerySemantics, type Revision, type RowPage, type RowWire, SHAPE_FONT_OPTIONS, SHAPE_FONT_STACKS, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Skeleton, type SortInput, type SubscriptionHandle, type SubscriptionObserver, type SubscriptionStatus, type SyncEmbedRef, type SyncEmbedResolver, TEXT_TYPES, type TableDescription, type TableEnvelopeBase, type TableEvent, type TableRef, type TableSnapshot, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UI_FONT_ID, UI_FONT_STACK, type UseDatabaseTable, type UseTableList, badgeVariants, buttonVariants, cellValueEqual, cn, columnAnnotation, conditionMatches, createMemoryBlobStore, emptyFilter, filterIsComplete, importDocument, isBridgeError, isBridgeErrorCode, isDatabaseBridge, markToggleAction, newMutationContext, parseCellValue, renderRuns, toBridgeError, useBlock, useDatabaseTable, useDoc, useEditorContext, useMeta, usePresence, usePresenceSharing, useSelection, useSelectionView, useTableList, useText, validateProtocolDescriptor };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { a as preventDefault,
|
|
1
|
+
import { $ as SelectScrollUpButton, A as parseCellValue, At as CardAction, B as useText, Bt as badgeVariants, C as validateProtocolDescriptor, Ct as PopoverDescription, D as isBridgeErrorCode, Dt as Input, E as isBridgeError, Et as PopoverTrigger, F as useMeta, Ft as CardTitle, G as SegmentSelector, H as useEditorContext, Ht as AlertDescription, I as usePresence, It as Button, J as SelectContent, Jt as Eye, K as ScrollArea, Kt as renderRuns, L as usePresenceSharing, Lt as buttonVariants, M as columnAnnotation, Mt as CardDescription, N as useBlock, Nt as CardFooter, O as toBridgeError, Ot as Checkbox, P as useDoc, Pt as CardHeader, Q as SelectScrollDownButton, R as useSelection, Rt as BareSelect, S as isDatabaseBridge, St as PopoverContent, T as BridgeError, Tt as PopoverTitle, U as DEFAULT_EMBED_SANDBOX, Ut as AlertTitle, V as EditorProvider, Vt as Alert, W as Skeleton, Wt as DocblocksI18nProvider, X as SelectItem, Xt as BookOpen, Y as SelectGroup, Z as SelectLabel, Zt as createMemoryBlobStore, _ as FilterBuilder, _t as DropdownMenuSubTrigger, a as SHAPE_FONT_STACKS, at as DropdownMenuCheckboxItem, b as BASELINE_CAPABILITIES, bt as Popover, ct as DropdownMenuItem, d as insertNative, dt as DropdownMenuRadioGroup, et as SelectSeparator, f as mdToBlocks, ft as DropdownMenuRadioItem, g as newMutationContext, gt as DropdownMenuSubContent, h as cellValueEqual, ht as DropdownMenuSub, i as SHAPE_FONT_OPTIONS, it as DropdownMenu, j as TEXT_TYPES, jt as CardContent, k as conditionMatches, kt as Card, l as markToggleAction, lt as DropdownMenuLabel, m as useDatabaseTable, mt as DropdownMenuShortcut, nt as SelectValue, ot as DropdownMenuContent, p as GridBody, pt as DropdownMenuSeparator, q as Select, qt as Pen, rt as Label, s as FORMAT_PALETTE, st as DropdownMenuGroup, t as Editor, tt as SelectTrigger, u as htmlToBlocks, ut as DropdownMenuPortal, v as emptyFilter, vt as DropdownMenuTrigger, w as BRIDGE_ERROR_CODES, wt as PopoverHeader, x as PROTOCOL_VERSION, xt as PopoverAnchor, y as filterIsComplete, yt as Separator, z as useSelectionView, zt as Badge } from "./Editor-3Oh9KNyH.mjs";
|
|
2
|
+
import { a as preventDefault, s as cn } from "./constants-D8PSgkwi.mjs";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
@@ -712,6 +712,45 @@ function DocHeaderInner({ doc, view, onViewChange, accessLevel = "editor", mode
|
|
|
712
712
|
});
|
|
713
713
|
}
|
|
714
714
|
//#endregion
|
|
715
|
+
//#region src/editing/import.ts
|
|
716
|
+
/** The document is not fresh: the import requires the empty root. */
|
|
717
|
+
var ImportDocumentError = class extends Error {
|
|
718
|
+
constructor(message) {
|
|
719
|
+
super(message);
|
|
720
|
+
this.name = "ImportDocumentError";
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
/**
|
|
724
|
+
* Import a markdown / HTML payload into a fresh document (the empty root):
|
|
725
|
+
* the parsed blocks fill the root in one transaction (one undo step, one
|
|
726
|
+
* wire update). An empty (or whitespace-only) payload is a no-op. Throws
|
|
727
|
+
* `ImportDocumentError` when the root already has children.
|
|
728
|
+
*/
|
|
729
|
+
function importDocument(doc, source, kind) {
|
|
730
|
+
const rootId = doc.meta.id;
|
|
731
|
+
const existing = doc.getChildren(rootId);
|
|
732
|
+
if (existing.length > 0) throw new ImportDocumentError(`importDocument: the document is not fresh (the root has ${existing.length} children) — the import requires the empty root.`);
|
|
733
|
+
const parsed = kind === "markdown" ? mdToBlocks(source) : htmlToBlocks(source);
|
|
734
|
+
if (parsed.length === 0) return;
|
|
735
|
+
doc.transact(() => materializeImport(doc, parsed));
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* The materialization into the root: the blocks append in the parser's
|
|
739
|
+
* order (each after the previous), the indents absolute (the jump-rule
|
|
740
|
+
* clamp only — the insertion's `after` chain makes every landing a tail
|
|
741
|
+
* append, so no block is displaced).
|
|
742
|
+
*/
|
|
743
|
+
function materializeImport(doc, parsed) {
|
|
744
|
+
const rootId = doc.meta.id;
|
|
745
|
+
let after;
|
|
746
|
+
let prevIndent = 0;
|
|
747
|
+
for (const block of parsed) {
|
|
748
|
+
const indent = after === void 0 ? 0 : Math.min(block.indent, prevIndent + 1);
|
|
749
|
+
after = insertNative(doc, block, rootId, after, indent);
|
|
750
|
+
prevIndent = indent;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
//#endregion
|
|
715
754
|
//#region src/fonts.ts
|
|
716
755
|
/**
|
|
717
756
|
* The package's font subsystem — the single place for the package's fonts.
|
|
@@ -756,4 +795,4 @@ const UI_FONT_STACK = "'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif
|
|
|
756
795
|
*/
|
|
757
796
|
const MONO_FONT_STACK = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
758
797
|
//#endregion
|
|
759
|
-
export { Alert, AlertDescription, AlertTitle, BASELINE_CAPABILITIES, BRIDGE_ERROR_CODES, Badge, BareSelect, BridgeError, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DEFAULT_EMBED_SANDBOX, DatabaseTable, DocHeader, DocblocksI18nProvider, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Editor, EditorProvider, FORMAT_PALETTE, FilterBuilder, Input, Label, MONO_FONT_STACK, PROTOCOL_VERSION, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, SHAPE_FONT_OPTIONS, SHAPE_FONT_STACKS, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Skeleton, TEXT_TYPES, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UI_FONT_ID, UI_FONT_STACK, badgeVariants, buttonVariants, cellValueEqual, cn, columnAnnotation, conditionMatches, createMemoryBlobStore, emptyFilter, filterIsComplete, isBridgeError, isBridgeErrorCode, isDatabaseBridge, markToggleAction, newMutationContext, parseCellValue, renderRuns, toBridgeError, useBlock, useDatabaseTable, useDoc, useEditorContext, useMeta, usePresence, usePresenceSharing, useSelection, useSelectionView, useTableList, useText, validateProtocolDescriptor };
|
|
798
|
+
export { Alert, AlertDescription, AlertTitle, BASELINE_CAPABILITIES, BRIDGE_ERROR_CODES, Badge, BareSelect, BridgeError, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DEFAULT_EMBED_SANDBOX, DatabaseTable, DocHeader, DocblocksI18nProvider, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Editor, EditorProvider, FORMAT_PALETTE, FilterBuilder, ImportDocumentError, Input, Label, MONO_FONT_STACK, PROTOCOL_VERSION, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, SHAPE_FONT_OPTIONS, SHAPE_FONT_STACKS, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Skeleton, TEXT_TYPES, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UI_FONT_ID, UI_FONT_STACK, badgeVariants, buttonVariants, cellValueEqual, cn, columnAnnotation, conditionMatches, createMemoryBlobStore, emptyFilter, filterIsComplete, importDocument, isBridgeError, isBridgeErrorCode, isDatabaseBridge, markToggleAction, newMutationContext, parseCellValue, renderRuns, toBridgeError, useBlock, useDatabaseTable, useDoc, useEditorContext, useMeta, usePresence, usePresenceSharing, useSelection, useSelectionView, useTableList, useText, validateProtocolDescriptor };
|
package/dist/mermaid/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { G as SegmentSelector, Gt as INLINE_CODE_CLASS, H as useEditorContext, Ht as AlertDescription, Jt as Eye, Ut as AlertTitle, Vt as Alert, W as Skeleton, Yt as CodeXml, c as textOf, n as childrenSlot, o as TextBlock, r as CodeHeader } from "../Editor-3Oh9KNyH.mjs";
|
|
2
|
+
import { f as LoaderCircle, l as TriangleAlert } from "../constants-D8PSgkwi.mjs";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
package/dist/pdf/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as PdfPreviewProps } from "../index-B72m5FmT.mjs";
|
|
2
2
|
//#region src/pdf/PdfFirstPage.d.ts
|
|
3
3
|
declare function PdfFirstPage({ id, blockType, url, name }: PdfPreviewProps): import("react").JSX.Element;
|
|
4
4
|
//#endregion
|
package/dist/pdf/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as X, d as Minus, f as LoaderCircle, i as isSafeDownloadHref, l as TriangleAlert, m as ChevronLeft, p as ChevronRight, r as clamp, s as cn, t as isEmbeddablePdfUrl, u as Plus } from "../constants-D8PSgkwi.mjs";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { GlobalWorkerOptions, RenderingCancelledException, getDocument } from "pdfjs-dist";
|
|
6
5
|
import { createPortal } from "react-dom";
|
|
6
|
+
import { GlobalWorkerOptions, RenderingCancelledException, getDocument } from "pdfjs-dist";
|
|
7
7
|
//#region src/shared/ui/icons/Maximize.tsx
|
|
8
8
|
function Maximize(props) {
|
|
9
9
|
return /* @__PURE__ */ jsxs("svg", {
|
package/dist/styles.css
CHANGED
|
@@ -1492,6 +1492,9 @@
|
|
|
1492
1492
|
.pt-2 {
|
|
1493
1493
|
padding-top: calc(var(--spacing) * 2);
|
|
1494
1494
|
}
|
|
1495
|
+
.pt-2\.5 {
|
|
1496
|
+
padding-top: calc(var(--spacing) * 2.5);
|
|
1497
|
+
}
|
|
1495
1498
|
.pt-5 {
|
|
1496
1499
|
padding-top: calc(var(--spacing) * 5);
|
|
1497
1500
|
}
|
|
@@ -2231,6 +2234,9 @@
|
|
|
2231
2234
|
color: color-mix(in oklab, var(--muted-foreground) 50%, transparent);
|
|
2232
2235
|
}
|
|
2233
2236
|
}
|
|
2237
|
+
.hover\:text-primary-foreground:hover {
|
|
2238
|
+
color: var(--primary-foreground);
|
|
2239
|
+
}
|
|
2234
2240
|
.hover\:underline:hover {
|
|
2235
2241
|
text-decoration-line: underline;
|
|
2236
2242
|
}
|
|
@@ -3474,9 +3480,8 @@
|
|
|
3474
3480
|
--docblocks-selection-background: #b6d7fe;
|
|
3475
3481
|
--docblocks-inline-code-background: var(--muted, rgba(175, 184, 193, 0.2));
|
|
3476
3482
|
|
|
3477
|
-
/* The mention chip (an atomic, display-only inline run):
|
|
3478
|
-
|
|
3479
|
-
--docblocks-mention-background: color-mix(in srgb, var(--primary, #0969da) 14%, transparent);
|
|
3483
|
+
/* The mention chip (an atomic, display-only inline run): the
|
|
3484
|
+
brand-colored label. */
|
|
3480
3485
|
--docblocks-mention-color: var(--primary, #0969da);
|
|
3481
3486
|
|
|
3482
3487
|
/* Callout borders / backgrounds per variant (info/danger follow the
|
|
@@ -3700,7 +3705,6 @@
|
|
|
3700
3705
|
--docblocks-link-color: #58a6ff;
|
|
3701
3706
|
--docblocks-selection-background: rgba(56, 139, 253, 0.4);
|
|
3702
3707
|
--docblocks-inline-code-background: var(--muted, rgba(110, 118, 129, 0.4));
|
|
3703
|
-
--docblocks-mention-background: color-mix(in srgb, var(--primary, #58a6ff) 22%, transparent);
|
|
3704
3708
|
--docblocks-mention-color: var(--primary, #58a6ff);
|
|
3705
3709
|
|
|
3706
3710
|
--docblocks-code-background: var(--muted, rgba(110, 118, 129, 0.35));
|
|
@@ -3985,22 +3989,25 @@
|
|
|
3985
3989
|
pointer-events: none;
|
|
3986
3990
|
}
|
|
3987
3991
|
|
|
3988
|
-
/* The mention chip: an atomic inline run (contenteditable="false")
|
|
3989
|
-
|
|
3992
|
+
/* The mention chip: an atomic inline run (contenteditable="false"), the
|
|
3993
|
+
plain-text stand — the semibold + the underline + the kind's inline
|
|
3994
|
+
icon (1em, no box of its own: the row keeps its plain-text height). */
|
|
3990
3995
|
[data-slot="docblocks/mention"] {
|
|
3991
|
-
|
|
3992
|
-
max-width: 100%;
|
|
3993
|
-
margin: 0 1px;
|
|
3994
|
-
padding: 0.05em 0.4em;
|
|
3995
|
-
border-radius: var(--radius, 0.375rem);
|
|
3996
|
-
background: var(--docblocks-mention-background, color-mix(in srgb, var(--primary, #0969da) 14%, transparent));
|
|
3996
|
+
font-weight: 600;
|
|
3997
3997
|
color: var(--docblocks-mention-color, var(--primary, #0969da));
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
3998
|
+
text-decoration: underline;
|
|
3999
|
+
text-underline-offset: 2px;
|
|
4000
|
+
}
|
|
4001
|
+
|
|
4002
|
+
[data-slot="docblocks/mention"] svg {
|
|
4003
|
+
/* The consumer page's global reset (e.g. Tailwind's preflight's
|
|
4004
|
+
`svg { display: block }`) must not break the icon onto its own line —
|
|
4005
|
+
the chip is an inline run over the text line. */
|
|
4006
|
+
display: inline;
|
|
4007
|
+
width: 1em;
|
|
4008
|
+
height: 1em;
|
|
4009
|
+
margin-right: 0.25em;
|
|
4010
|
+
vertical-align: -0.125em;
|
|
4004
4011
|
}
|
|
4005
4012
|
|
|
4006
4013
|
/* The flat grid has no row element: the pending row's outline is composed
|
package/package.json
CHANGED