@zephytiju/prism-main-editor 0.1.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.
Files changed (69) hide show
  1. package/README.md +252 -0
  2. package/dist/CommentsPane.d.ts +32 -0
  3. package/dist/CommentsPane.d.ts.map +1 -0
  4. package/dist/CommentsPane.js +85 -0
  5. package/dist/MainEditor.d.ts +59 -0
  6. package/dist/MainEditor.d.ts.map +1 -0
  7. package/dist/MainEditor.js +102 -0
  8. package/dist/TitleBar.d.ts +28 -0
  9. package/dist/TitleBar.d.ts.map +1 -0
  10. package/dist/TitleBar.js +55 -0
  11. package/dist/blocks/AssessmentBlockView.d.ts +21 -0
  12. package/dist/blocks/AssessmentBlockView.d.ts.map +1 -0
  13. package/dist/blocks/AssessmentBlockView.js +34 -0
  14. package/dist/blocks/BlockRow.d.ts +33 -0
  15. package/dist/blocks/BlockRow.d.ts.map +1 -0
  16. package/dist/blocks/BlockRow.js +56 -0
  17. package/dist/blocks/BlockStack.d.ts +27 -0
  18. package/dist/blocks/BlockStack.d.ts.map +1 -0
  19. package/dist/blocks/BlockStack.js +75 -0
  20. package/dist/blocks/DragMenu.d.ts +22 -0
  21. package/dist/blocks/DragMenu.d.ts.map +1 -0
  22. package/dist/blocks/DragMenu.js +219 -0
  23. package/dist/blocks/EmbeddedBlockChrome.d.ts +34 -0
  24. package/dist/blocks/EmbeddedBlockChrome.d.ts.map +1 -0
  25. package/dist/blocks/EmbeddedBlockChrome.js +81 -0
  26. package/dist/blocks/EvidenceTableView.d.ts +25 -0
  27. package/dist/blocks/EvidenceTableView.d.ts.map +1 -0
  28. package/dist/blocks/EvidenceTableView.js +30 -0
  29. package/dist/blocks/GeovisionEmbedView.d.ts +28 -0
  30. package/dist/blocks/GeovisionEmbedView.d.ts.map +1 -0
  31. package/dist/blocks/GeovisionEmbedView.js +33 -0
  32. package/dist/blocks/InsertMenu.d.ts +22 -0
  33. package/dist/blocks/InsertMenu.d.ts.map +1 -0
  34. package/dist/blocks/InsertMenu.js +59 -0
  35. package/dist/blocks/InsertRail.d.ts +28 -0
  36. package/dist/blocks/InsertRail.d.ts.map +1 -0
  37. package/dist/blocks/InsertRail.js +29 -0
  38. package/dist/blocks/NarrativeBlockView.d.ts +22 -0
  39. package/dist/blocks/NarrativeBlockView.d.ts.map +1 -0
  40. package/dist/blocks/NarrativeBlockView.js +44 -0
  41. package/dist/blocks/NativeTableView.d.ts +12 -0
  42. package/dist/blocks/NativeTableView.d.ts.map +1 -0
  43. package/dist/blocks/NativeTableView.js +36 -0
  44. package/dist/blocks/SavedViewDropdown.d.ts +17 -0
  45. package/dist/blocks/SavedViewDropdown.d.ts.map +1 -0
  46. package/dist/blocks/SavedViewDropdown.js +85 -0
  47. package/dist/blocks/SelectionToolbar.d.ts +25 -0
  48. package/dist/blocks/SelectionToolbar.d.ts.map +1 -0
  49. package/dist/blocks/SelectionToolbar.js +175 -0
  50. package/dist/blocks/menuStyles.d.ts +32 -0
  51. package/dist/blocks/menuStyles.d.ts.map +1 -0
  52. package/dist/blocks/menuStyles.js +32 -0
  53. package/dist/index.d.ts +26 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +11 -0
  56. package/dist/locales/en.json +37 -0
  57. package/dist/locales/index.d.ts +105 -0
  58. package/dist/locales/index.d.ts.map +1 -0
  59. package/dist/locales/index.js +27 -0
  60. package/dist/locales/zh-CN.json +37 -0
  61. package/dist/tokens.d.ts +42 -0
  62. package/dist/tokens.d.ts.map +1 -0
  63. package/dist/tokens.js +43 -0
  64. package/dist/types.d.ts +207 -0
  65. package/dist/types.d.ts.map +1 -0
  66. package/dist/types.js +1 -0
  67. package/locales/en.json +37 -0
  68. package/locales/zh-CN.json +37 -0
  69. package/package.json +79 -0
@@ -0,0 +1,25 @@
1
+ import type { MainEditorLocale } from "../locales/index.js";
2
+ import type { EvidenceTableBlock as EvidenceTableBlockModel } from "../types.js";
3
+ export interface EvidenceTableViewProps {
4
+ readonly block: EvidenceTableBlockModel;
5
+ readonly locale: MainEditorLocale;
6
+ }
7
+ /**
8
+ * Embedded block — Evidence Table (D10): the block row HOSTS the real
9
+ * published table component `@zephytiju/prism-evidence-table` (0.1.0). The
10
+ * hosted component provides its own card chrome — kind tag EVIDENCE TABLE,
11
+ * SRC FILE chip, VIEW ▾ variant dropdown, ↗ open arrow — and renders the
12
+ * previewed saved view's IEvidenceSource-shaped rows (source / observation /
13
+ * confidence / audit locator) with row separators and per-row audit drill
14
+ * links. Its variant state lives on the "evidence-table.selected-view"
15
+ * channel (file-level selection). Being a table does NOT make a block
16
+ * embedded — only file-preview blocks are (D10).
17
+ *
18
+ * The editor contributes NO synthetic table rendering — only the hosting
19
+ * configuration from the block model (sourceFileRef, savedViews, optional
20
+ * controlled selection / layout / columns) plus the locale and the
21
+ * translation of the ↗ arrow's open intent into the editor's
22
+ * "main-editor.open-view-requested" channel.
23
+ */
24
+ export declare function EvidenceTableView({ block, locale }: EvidenceTableViewProps): import("react").JSX.Element;
25
+ //# sourceMappingURL=EvidenceTableView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EvidenceTableView.d.ts","sourceRoot":"","sources":["../../src/blocks/EvidenceTableView.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EACV,kBAAkB,IAAI,uBAAuB,EAE9C,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,uBAAuB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,sBAAsB,+BAoB1E"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from "@mantine/core";
3
+ import { emitPrismEvent } from "@zephytiju/prism-react";
4
+ import { EvidenceTable } from "@zephytiju/prism-evidence-table";
5
+ /**
6
+ * Embedded block — Evidence Table (D10): the block row HOSTS the real
7
+ * published table component `@zephytiju/prism-evidence-table` (0.1.0). The
8
+ * hosted component provides its own card chrome — kind tag EVIDENCE TABLE,
9
+ * SRC FILE chip, VIEW ▾ variant dropdown, ↗ open arrow — and renders the
10
+ * previewed saved view's IEvidenceSource-shaped rows (source / observation /
11
+ * confidence / audit locator) with row separators and per-row audit drill
12
+ * links. Its variant state lives on the "evidence-table.selected-view"
13
+ * channel (file-level selection). Being a table does NOT make a block
14
+ * embedded — only file-preview blocks are (D10).
15
+ *
16
+ * The editor contributes NO synthetic table rendering — only the hosting
17
+ * configuration from the block model (sourceFileRef, savedViews, optional
18
+ * controlled selection / layout / columns) plus the locale and the
19
+ * translation of the ↗ arrow's open intent into the editor's
20
+ * "main-editor.open-view-requested" channel.
21
+ */
22
+ export function EvidenceTableView({ block, locale }) {
23
+ return (_jsx(Box, { "data-testid": `main-editor-block-${block.id}`, children: _jsx(EvidenceTable, { sourceFileRef: block.sourceFileRef, savedViews: block.savedViews, selectedViewId: block.selectedViewId, layout: block.layout, columns: block.columns, locale: locale, onOpenView: (intent) => {
24
+ const request = {
25
+ sourceFileRef: intent.sourceFileRef,
26
+ viewId: intent.viewId,
27
+ };
28
+ emitPrismEvent("main-editor.open-view-requested", request);
29
+ } }) }));
30
+ }
@@ -0,0 +1,28 @@
1
+ import type { MainEditorLocale } from "../locales/index.js";
2
+ import type { GeovisionEmbedBlock as GeovisionEmbedBlockModel } from "../types.js";
3
+ export interface GeovisionEmbedViewProps {
4
+ readonly block: GeovisionEmbedBlockModel;
5
+ readonly locale: MainEditorLocale;
6
+ }
7
+ /**
8
+ * Embedded block — Geovision Embed (D10): the block row HOSTS the real
9
+ * published chrome component `@zephytiju/prism-geovision-embed-block`
10
+ * (0.2.0). The hosted block provides the full D10 card chrome — kind tag
11
+ * GEOVISION, SRC FILE chip, VIEW ▾ variant dropdown fed by the render
12
+ * package's describeViews(sourceFileRef) through the host Lattice transport,
13
+ * and the ↗ open arrow — and itself hosts the real render dispatcher
14
+ * (`@zephytiju/prism-geovision-embed`) in its body slot, rendering exactly
15
+ * the ONE variant the current viewId (`${fileRef}#${previewKind}`) selects.
16
+ * The variant state is owned by the block through its
17
+ * "geovision-embed.selected-view" channel (file-level selection — every
18
+ * embed of the same source file re-previews the picked variant).
19
+ *
20
+ * The editor contributes NO synthetic preview — only the hosting
21
+ * configuration from the block model (sourceFileRef, optional explicit views
22
+ * / controlled selection / engine passthrough) plus the locale and the
23
+ * translation of the ↗ arrow's open intent into the editor's
24
+ * "main-editor.open-view-requested" channel, so hosts keep ONE open-intent
25
+ * contract for every embedded block.
26
+ */
27
+ export declare function GeovisionEmbedView({ block, locale }: GeovisionEmbedViewProps): import("react").JSX.Element;
28
+ //# sourceMappingURL=GeovisionEmbedView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeovisionEmbedView.d.ts","sourceRoot":"","sources":["../../src/blocks/GeovisionEmbedView.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EACV,mBAAmB,IAAI,wBAAwB,EAEhD,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,uBAAuB,+BAmB5E"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from "@mantine/core";
3
+ import { emitPrismEvent } from "@zephytiju/prism-react";
4
+ import { GeovisionEmbedBlock } from "@zephytiju/prism-geovision-embed-block";
5
+ /**
6
+ * Embedded block — Geovision Embed (D10): the block row HOSTS the real
7
+ * published chrome component `@zephytiju/prism-geovision-embed-block`
8
+ * (0.2.0). The hosted block provides the full D10 card chrome — kind tag
9
+ * GEOVISION, SRC FILE chip, VIEW ▾ variant dropdown fed by the render
10
+ * package's describeViews(sourceFileRef) through the host Lattice transport,
11
+ * and the ↗ open arrow — and itself hosts the real render dispatcher
12
+ * (`@zephytiju/prism-geovision-embed`) in its body slot, rendering exactly
13
+ * the ONE variant the current viewId (`${fileRef}#${previewKind}`) selects.
14
+ * The variant state is owned by the block through its
15
+ * "geovision-embed.selected-view" channel (file-level selection — every
16
+ * embed of the same source file re-previews the picked variant).
17
+ *
18
+ * The editor contributes NO synthetic preview — only the hosting
19
+ * configuration from the block model (sourceFileRef, optional explicit views
20
+ * / controlled selection / engine passthrough) plus the locale and the
21
+ * translation of the ↗ arrow's open intent into the editor's
22
+ * "main-editor.open-view-requested" channel, so hosts keep ONE open-intent
23
+ * contract for every embedded block.
24
+ */
25
+ export function GeovisionEmbedView({ block, locale }) {
26
+ return (_jsx(Box, { "data-testid": `main-editor-block-${block.id}`, children: _jsx(GeovisionEmbedBlock, { sourceFileRef: block.sourceFileRef, views: block.views, selectedViewId: block.selectedViewId, engine: block.engine, locale: locale, onOpenView: (intent) => {
27
+ const request = {
28
+ sourceFileRef: intent.sourceFileRef,
29
+ viewId: intent.viewId,
30
+ };
31
+ emitPrismEvent("main-editor.open-view-requested", request);
32
+ } }) }));
33
+ }
@@ -0,0 +1,22 @@
1
+ import type { MainEditorLocale } from "../locales/index.js";
2
+ import type { MainEditorBlockKind } from "../types.js";
3
+ /** Label resolver: block kind → localized menu label. */
4
+ export type KindLabelFn = (kind: MainEditorBlockKind) => string;
5
+ export interface InsertMenuProps {
6
+ readonly buttonTestId: string;
7
+ readonly kinds: readonly MainEditorBlockKind[];
8
+ readonly kindLabel: KindLabelFn;
9
+ readonly afterBlockId: string | null;
10
+ readonly locale: MainEditorLocale;
11
+ readonly compact?: boolean;
12
+ }
13
+ /**
14
+ * The block gutter's insert control (D3/D10): the circular + button that
15
+ * opens the block-kind menu. Picking a kind emits
16
+ * "main-editor.insert-block-requested" (an IDossierDoc ACTION the host
17
+ * applies — blocks are added at app runtime, never composition mutations)
18
+ * and inserts AFTER afterBlockId (null = top of the stack). Also used
19
+ * compact at the end-of-stack affordance.
20
+ */
21
+ export declare function InsertMenu({ buttonTestId, kinds, kindLabel, afterBlockId, locale, compact, }: InsertMenuProps): import("react").JSX.Element;
22
+ //# sourceMappingURL=InsertMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InsertMenu.d.ts","sourceRoot":"","sources":["../../src/blocks/InsertMenu.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,aAAa,CAAC;AAIrB,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,mBAAmB,KAAK,MAAM,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,YAAY,EACZ,KAAK,EACL,SAAS,EACT,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE,eAAe,+BAyFjB"}
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Box } from "@mantine/core";
4
+ import { emitPrismEvent } from "@zephytiju/prism-react";
5
+ import { stringsForLocale } from "../locales/index.js";
6
+ import { ACCENT, BORDER, CARD, LINE } from "../tokens.js";
7
+ import { menuHeaderStyle, menuOptionStyle } from "./menuStyles.js";
8
+ /**
9
+ * The block gutter's insert control (D3/D10): the circular + button that
10
+ * opens the block-kind menu. Picking a kind emits
11
+ * "main-editor.insert-block-requested" (an IDossierDoc ACTION the host
12
+ * applies — blocks are added at app runtime, never composition mutations)
13
+ * and inserts AFTER afterBlockId (null = top of the stack). Also used
14
+ * compact at the end-of-stack affordance.
15
+ */
16
+ export function InsertMenu({ buttonTestId, kinds, kindLabel, afterBlockId, locale, compact, }) {
17
+ const strings = stringsForLocale(locale);
18
+ const [open, setOpen] = useState(false);
19
+ return (_jsxs(Box, { style: { position: "relative", flexShrink: 0 }, children: [_jsx("button", { type: "button", style: {
20
+ width: 30,
21
+ height: 30,
22
+ borderRadius: 15,
23
+ background: CARD,
24
+ border: `1px solid ${ACCENT}`,
25
+ fontSize: compact ? 16 : 18,
26
+ fontWeight: 500,
27
+ color: ACCENT,
28
+ display: "inline-flex",
29
+ alignItems: "center",
30
+ justifyContent: "center",
31
+ cursor: "pointer",
32
+ lineHeight: 1,
33
+ }, title: strings.insertMenuTitle, "data-testid": buttonTestId, onClick: () => {
34
+ setOpen((value) => !value);
35
+ }, children: "+" }), open ? (_jsxs(_Fragment, { children: [_jsx("div", { style: { position: "fixed", inset: 0, zIndex: 8 }, onClick: () => {
36
+ setOpen(false);
37
+ } }), _jsxs(Box, { component: "ul", w: 228, py: 4, style: {
38
+ position: "absolute",
39
+ top: 34,
40
+ left: 0,
41
+ background: CARD,
42
+ border: `1px solid ${LINE}`,
43
+ borderRadius: 6,
44
+ boxShadow: "0 8px 24px rgba(0,0,0,.55)",
45
+ zIndex: 9,
46
+ listStyle: "none",
47
+ margin: 0,
48
+ }, "data-testid": `${buttonTestId}-menu`, role: "menu", children: [_jsx("li", { style: menuHeaderStyle, children: strings.insertMenuTitle }), kinds.map((kind) => (_jsx("li", { children: _jsxs("button", { type: "button", role: "menuitem", style: menuOptionStyle, "data-testid": `${buttonTestId}-option-${kind}`, onClick: () => {
49
+ const request = { afterBlockId, kind };
50
+ emitPrismEvent("main-editor.insert-block-requested", request);
51
+ setOpen(false);
52
+ }, children: [_jsx("span", { style: {
53
+ width: 5,
54
+ height: 5,
55
+ borderRadius: "50%",
56
+ background: BORDER,
57
+ flexShrink: 0,
58
+ } }), kindLabel(kind)] }) }, kind)))] })] })) : null] }));
59
+ }
@@ -0,0 +1,28 @@
1
+ import type { MainEditorLocale } from "../locales/index.js";
2
+ import type { MainEditorBlockKind } from "../types.js";
3
+ import type { KindLabelFn } from "./InsertMenu.js";
4
+ export interface InsertRailProps {
5
+ readonly blockId: string;
6
+ readonly kinds: readonly MainEditorBlockKind[];
7
+ readonly kindLabel: KindLabelFn;
8
+ readonly canMoveUp: boolean;
9
+ readonly canMoveDown: boolean;
10
+ readonly locale: MainEditorLocale;
11
+ readonly showInsert: boolean;
12
+ /**
13
+ * D11: the gutter renders ONLY while its row is hovered (or focused within,
14
+ * keeping keyboard access) — the 120ms opacity fade is driven by the row's
15
+ * hover/focus state, never an always-visible rail.
16
+ */
17
+ readonly revealed: boolean;
18
+ }
19
+ /**
20
+ * The left rail (block gutter) of one block row (D3/D11): the + insert control
21
+ * opening the block-kind menu, the ⠿ drag/reorder handle with its click-open
22
+ * block popover, and the dashed guide line filling the remaining width. The
23
+ * whole gutter fades in on row hover (opacity transition ~120ms) and out when
24
+ * the pointer leaves — it is invisible in the resting document. Clicks never
25
+ * propagate to the block surface behind it.
26
+ */
27
+ export declare function InsertRail({ blockId, kinds, kindLabel, canMoveUp, canMoveDown, locale, showInsert, revealed, }: InsertRailProps): import("react").JSX.Element;
28
+ //# sourceMappingURL=InsertRail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InsertRail.d.ts","sourceRoot":"","sources":["../../src/blocks/InsertRail.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,MAAM,EACN,UAAU,EACV,QAAQ,GACT,EAAE,eAAe,+BA8CjB"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box } from "@mantine/core";
3
+ import { BORDER } from "../tokens.js";
4
+ import { DragMenu } from "./DragMenu.js";
5
+ import { InsertMenu } from "./InsertMenu.js";
6
+ /**
7
+ * The left rail (block gutter) of one block row (D3/D11): the + insert control
8
+ * opening the block-kind menu, the ⠿ drag/reorder handle with its click-open
9
+ * block popover, and the dashed guide line filling the remaining width. The
10
+ * whole gutter fades in on row hover (opacity transition ~120ms) and out when
11
+ * the pointer leaves — it is invisible in the resting document. Clicks never
12
+ * propagate to the block surface behind it.
13
+ */
14
+ export function InsertRail({ blockId, kinds, kindLabel, canMoveUp, canMoveDown, locale, showInsert, revealed, }) {
15
+ return (_jsx(Box, { w: 72, style: { display: "flex", alignItems: "center", gap: 6, paddingTop: 8, flexShrink: 0 }, onClick: (event) => {
16
+ event.stopPropagation();
17
+ }, children: _jsxs(Box, { style: {
18
+ display: "flex",
19
+ alignItems: "center",
20
+ gap: 6,
21
+ flex: 1,
22
+ opacity: revealed ? 1 : 0,
23
+ transition: "opacity .12s ease",
24
+ }, "data-testid": `main-editor-gutter-${blockId}`, children: [showInsert ? (_jsx(InsertMenu, { buttonTestId: `main-editor-insert-${blockId}`, kinds: kinds, kindLabel: kindLabel, afterBlockId: blockId, locale: locale })) : null, _jsx(DragMenu, { blockId: blockId, canMoveUp: canMoveUp, canMoveDown: canMoveDown, locale: locale }), _jsx("span", { style: {
25
+ flex: 1,
26
+ borderTop: `1px dashed ${BORDER}`,
27
+ marginTop: 2,
28
+ }, "aria-hidden": "true" })] }) }));
29
+ }
@@ -0,0 +1,22 @@
1
+ import type { NarrativeBlock as NarrativeBlockModel } from "../types.js";
2
+ export interface NarrativeBlockViewProps {
3
+ readonly block: NarrativeBlockModel;
4
+ /**
5
+ * D11: in the editor variant the heading and paragraph are editable text
6
+ * surfaces — selecting inside them opens the floating selection toolbar.
7
+ */
8
+ readonly editable?: boolean;
9
+ }
10
+ /**
11
+ * Normal document block — narrative (D10): a plain document element with NO
12
+ * outlining box, no card background, no kind pill. Source links are ordinary
13
+ * inline hyperlinks embedded inside the paragraph text — accent-colored,
14
+ * underlined, preceded by the ↗ glyph — never standalone link blocks.
15
+ *
16
+ * D11: when editable, the heading and paragraph carry the
17
+ * data-main-editor-editable attribute the selection toolbar anchors to; the
18
+ * DOM is the editing surface (style mutations apply in place), the channel
19
+ * projection stays authoritative for content.
20
+ */
21
+ export declare function NarrativeBlockView({ block, editable }: NarrativeBlockViewProps): import("react").JSX.Element;
22
+ //# sourceMappingURL=NarrativeBlockView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NarrativeBlockView.d.ts","sourceRoot":"","sources":["../../src/blocks/NarrativeBlockView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE,uBAAuB,+BA6EtF"}
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Stack, Text } from "@mantine/core";
3
+ /**
4
+ * Normal document block — narrative (D10): a plain document element with NO
5
+ * outlining box, no card background, no kind pill. Source links are ordinary
6
+ * inline hyperlinks embedded inside the paragraph text — accent-colored,
7
+ * underlined, preceded by the ↗ glyph — never standalone link blocks.
8
+ *
9
+ * D11: when editable, the heading and paragraph carry the
10
+ * data-main-editor-editable attribute the selection toolbar anchors to; the
11
+ * DOM is the editing surface (style mutations apply in place), the channel
12
+ * projection stays authoritative for content.
13
+ */
14
+ export function NarrativeBlockView({ block, editable = false }) {
15
+ const editableDataProps = editable
16
+ ? {
17
+ contentEditable: true,
18
+ suppressContentEditableWarning: true,
19
+ spellCheck: false,
20
+ "data-main-editor-editable": block.id,
21
+ }
22
+ : {};
23
+ return (_jsxs(Stack, { gap: 10, "data-testid": `main-editor-block-${block.id}`, children: [block.heading ? (_jsx(Text, { fz: 16, fw: 600, c: "text", style: {
24
+ lineHeight: 1.4,
25
+ letterSpacing: "0.01em",
26
+ ...(editable ? { cursor: "text", outline: "none" } : {}),
27
+ }, "data-testid": `main-editor-narrative-heading-${block.id}`, ...editableDataProps, children: block.heading })) : null, _jsx(Text, { fz: 12, style: {
28
+ lineHeight: 1.6,
29
+ color: "var(--mantine-color-muted-filled)",
30
+ ...(editable ? { cursor: "text", outline: "none" } : {}),
31
+ }, "data-testid": `main-editor-narrative-paragraph-${block.id}`, ...editableDataProps, children: block.spans.map((span, index) => span.kind === "text" ? (_jsx("span", { children: span.text }, index)) : (_jsxs("span", { children: [_jsxs("span", { "aria-hidden": "true", style: {
32
+ fontFamily: "var(--mantine-font-family-monospace)",
33
+ fontSize: 11,
34
+ fontWeight: 500,
35
+ color: "var(--mantine-color-accent-filled)",
36
+ }, children: ["\u2197", " "] }), _jsx("a", { href: "#", onClick: (event) => {
37
+ event.preventDefault();
38
+ }, style: {
39
+ color: "var(--mantine-color-accent-filled)",
40
+ textDecoration: "underline",
41
+ textUnderlineOffset: 3,
42
+ textDecorationThickness: 1,
43
+ }, "data-testid": `main-editor-source-link-${span.fileRef}`, "data-file-ref": span.fileRef, children: span.text })] }, index))) })] }));
44
+ }
@@ -0,0 +1,12 @@
1
+ import type { NativeTableBlock as NativeTableBlockModel } from "../types.js";
2
+ export interface NativeTableViewProps {
3
+ readonly block: NativeTableBlockModel;
4
+ }
5
+ /**
6
+ * Normal document block — dossier-native table (D10): renders exactly like a
7
+ * Feishu native table — a plain document element with row rules and NO card
8
+ * chrome, kind pill, or outlining box. Being a table does not make a block
9
+ * embedded; only file-preview blocks are embedded.
10
+ */
11
+ export declare function NativeTableView({ block }: NativeTableViewProps): import("react").JSX.Element;
12
+ //# sourceMappingURL=NativeTableView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeTableView.d.ts","sourceRoot":"","sources":["../../src/blocks/NativeTableView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAG7E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,oBAAoB,+BA0D9D"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box } from "@mantine/core";
3
+ import { BORDER, MONO, MUTED } from "../tokens.js";
4
+ /**
5
+ * Normal document block — dossier-native table (D10): renders exactly like a
6
+ * Feishu native table — a plain document element with row rules and NO card
7
+ * chrome, kind pill, or outlining box. Being a table does not make a block
8
+ * embedded; only file-preview blocks are embedded.
9
+ */
10
+ export function NativeTableView({ block }) {
11
+ return (_jsxs(Box, { "data-testid": `main-editor-block-${block.id}`, children: [_jsx(Box, { style: {
12
+ display: "grid",
13
+ gridTemplateColumns: `repeat(${String(block.columns.length)}, minmax(0, 1fr))`,
14
+ columnGap: 16,
15
+ padding: "0 2px 8px 2px",
16
+ }, "data-testid": `main-editor-native-header-${block.id}`, children: block.columns.map((column, index) => (_jsx("span", { style: {
17
+ fontFamily: MONO,
18
+ fontSize: 7,
19
+ fontWeight: 500,
20
+ color: MUTED,
21
+ letterSpacing: "0.05em",
22
+ }, children: column }, column + String(index)))) }), block.rows.map((row, rowIndex) => (_jsx(Box, { style: {
23
+ display: "grid",
24
+ gridTemplateColumns: `repeat(${String(block.columns.length)}, minmax(0, 1fr))`,
25
+ columnGap: 16,
26
+ padding: "9px 2px",
27
+ borderTop: `1px solid ${BORDER}`,
28
+ }, "data-testid": `main-editor-native-row-${block.id}-${String(rowIndex)}`, children: row.map((cell, cellIndex) => (_jsx("span", { style: {
29
+ fontFamily: MONO,
30
+ fontSize: 8,
31
+ color: cellIndex === 0 ? "var(--mantine-color-text-filled)" : MUTED,
32
+ whiteSpace: "nowrap",
33
+ overflow: "hidden",
34
+ textOverflow: "ellipsis",
35
+ }, children: cell }, String(cellIndex)))) }, `${row[0] ?? ""}-${String(rowIndex)}`)))] }));
36
+ }
@@ -0,0 +1,17 @@
1
+ import type { MainEditorLocale } from "../locales/index.js";
2
+ import type { EmbeddedSourceFile } from "../types.js";
3
+ export interface SavedViewDropdownProps {
4
+ readonly blockId: string;
5
+ readonly sourceFile: EmbeddedSourceFile;
6
+ readonly locale: MainEditorLocale;
7
+ }
8
+ /**
9
+ * The source-file variant dropdown on top of an embedded (file-preview)
10
+ * block (D10): because the dropdown previews SAVED VIEWS of the source file,
11
+ * picking one publishes "main-editor.selected-view" and every block bound to
12
+ * that channel (here or in a peer host) re-derives its previewed view — D6
13
+ * state passing. The current selection derives from the same channel,
14
+ * falling back to the file's default view.
15
+ */
16
+ export declare function SavedViewDropdown({ blockId, sourceFile, locale }: SavedViewDropdownProps): import("react").JSX.Element;
17
+ //# sourceMappingURL=SavedViewDropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SavedViewDropdown.d.ts","sourceRoot":"","sources":["../../src/blocks/SavedViewDropdown.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAA0B,MAAM,aAAa,CAAC;AAI9E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,sBAAsB,+BA8HxF"}
@@ -0,0 +1,85 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Box } from "@mantine/core";
4
+ import { usePrismStateSetter, usePrismStateValue } from "@zephytiju/prism-react";
5
+ import { formatMessage, stringsForLocale } from "../locales/index.js";
6
+ import { ACCENT, BORDER, CARD, LINE, MONO, MUTED, TEXT } from "../tokens.js";
7
+ import { menuHeaderStyle } from "./menuStyles.js";
8
+ /**
9
+ * The source-file variant dropdown on top of an embedded (file-preview)
10
+ * block (D10): because the dropdown previews SAVED VIEWS of the source file,
11
+ * picking one publishes "main-editor.selected-view" and every block bound to
12
+ * that channel (here or in a peer host) re-derives its previewed view — D6
13
+ * state passing. The current selection derives from the same channel,
14
+ * falling back to the file's default view.
15
+ */
16
+ export function SavedViewDropdown({ blockId, sourceFile, locale }) {
17
+ const strings = stringsForLocale(locale);
18
+ const [menuOpen, setMenuOpen] = useState(false);
19
+ // The dropdown owns the selected-view binding: setter-only publish, value
20
+ // consumed to derive the current view (EntityCard's selected-entity pattern).
21
+ const selectedView = usePrismStateValue("main-editor.selected-view");
22
+ const publishSelectedView = usePrismStateSetter("main-editor.selected-view");
23
+ const currentViewId = selectedView?.blockId === blockId ? selectedView.viewId : sourceFile.defaultViewId;
24
+ const currentView = sourceFile.savedViews.find((view) => view.id === currentViewId) ??
25
+ sourceFile.savedViews[0];
26
+ const currentLabel = currentView?.label ?? "";
27
+ return (_jsxs(Box, { style: { position: "relative", flexShrink: 0 }, children: [_jsxs("button", { type: "button", style: {
28
+ height: 22,
29
+ padding: "0 10px",
30
+ borderRadius: 11,
31
+ background: CARD,
32
+ border: `1px solid ${BORDER}`,
33
+ fontFamily: MONO,
34
+ fontSize: 7,
35
+ fontWeight: 500,
36
+ color: ACCENT,
37
+ display: "inline-flex",
38
+ alignItems: "center",
39
+ gap: 7,
40
+ cursor: "pointer",
41
+ userSelect: "none",
42
+ whiteSpace: "nowrap",
43
+ }, "data-testid": `main-editor-view-select-${blockId}`, "aria-haspopup": "listbox", "aria-expanded": menuOpen, onClick: () => {
44
+ setMenuOpen((open) => !open);
45
+ }, children: [formatMessage(strings.viewSelector, { variant: currentLabel }), _jsx("span", { style: { color: MUTED }, "aria-hidden": "true", children: "\u25BE" })] }), menuOpen ? (_jsxs(_Fragment, { children: [_jsx("div", { style: { position: "fixed", inset: 0, zIndex: 8 }, onClick: () => {
46
+ setMenuOpen(false);
47
+ }, "data-testid": `main-editor-view-menu-overlay-${blockId}` }), _jsxs(Box, { component: "ul", w: 264, py: 4, style: {
48
+ position: "absolute",
49
+ top: 26,
50
+ right: 0,
51
+ background: CARD,
52
+ border: `1px solid ${LINE}`,
53
+ borderRadius: 6,
54
+ boxShadow: "0 8px 24px rgba(0,0,0,.55)",
55
+ zIndex: 9,
56
+ listStyle: "none",
57
+ margin: 0,
58
+ }, "data-testid": `main-editor-view-menu-${blockId}`, role: "listbox", children: [_jsx("li", { style: menuHeaderStyle, children: formatMessage(strings.savedViewsTitle, { file: sourceFile.name }) }), sourceFile.savedViews.map((view) => {
59
+ const active = view.id === currentViewId;
60
+ return (_jsx("li", { children: _jsxs("button", { type: "button", role: "option", "aria-selected": active, style: {
61
+ width: "100%",
62
+ height: 26,
63
+ display: "flex",
64
+ alignItems: "center",
65
+ gap: 8,
66
+ padding: "0 12px",
67
+ fontFamily: MONO,
68
+ fontSize: 8,
69
+ color: active ? ACCENT : TEXT,
70
+ background: "transparent",
71
+ border: "none",
72
+ cursor: "pointer",
73
+ textAlign: "left",
74
+ }, "data-testid": `main-editor-view-option-${blockId}-${view.id}`, onClick: () => {
75
+ publishSelectedView({ blockId, viewId: view.id });
76
+ setMenuOpen(false);
77
+ }, children: [_jsx("span", { style: {
78
+ width: 5,
79
+ height: 5,
80
+ borderRadius: "50%",
81
+ background: active ? ACCENT : BORDER,
82
+ flexShrink: 0,
83
+ } }), view.label] }) }, view.id));
84
+ })] })] })) : null] }));
85
+ }
@@ -0,0 +1,25 @@
1
+ import type { RefObject } from "react";
2
+ import type { MainEditorLocale } from "../locales/index.js";
3
+ export interface SelectionToolbarProps {
4
+ readonly locale: MainEditorLocale;
5
+ /**
6
+ * The editor surface this toolbar serves (selections inside OTHER instances
7
+ * or hosts never open it — each instance's toolbar checks its own bounds).
8
+ */
9
+ readonly containerRef: RefObject<HTMLElement | null>;
10
+ }
11
+ /**
12
+ * The D11 text-selection toolbar: selecting text inside the editor's editable
13
+ * text surfaces (narrative heading/paragraph, analyst-judgment body) opens a
14
+ * floating toolbar at the selection. The style actions (bold / italic /
15
+ * underline / strikethrough) apply text-style mutations to the selection via
16
+ * document.execCommand — the DOM is the editing surface while the channel
17
+ * projection stays authoritative for content. The 💬 action wraps the
18
+ * selected range in a token-only highlight mark and emits
19
+ * "main-editor.comment-requested" {blockId, quote}, anchoring a new thread to
20
+ * that text range (the host creates the thread; the aligned comments rail
21
+ * stacks it under its block). The toolbar dismisses whenever the selection
22
+ * collapses (or scrolls away).
23
+ */
24
+ export declare function SelectionToolbar({ locale, containerRef }: SelectionToolbarProps): import("react").JSX.Element | null;
25
+ //# sourceMappingURL=SelectionToolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionToolbar.d.ts","sourceRoot":"","sources":["../../src/blocks/SelectionToolbar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA+D,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACtD;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,qBAAqB,sCA2M/E"}