@xyne/workflow-ui 1.3.10 → 1.3.12
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/dist/components/builder/AddStepButton.d.ts +6 -0
- package/dist/components/builder/AddStepButton.d.ts.map +1 -0
- package/dist/components/builder/AddStepButton.js +7 -0
- package/dist/components/builder/AddStepButton.js.map +1 -0
- package/dist/components/builder/BranchEdge.d.ts +3 -0
- package/dist/components/builder/BranchEdge.d.ts.map +1 -0
- package/dist/components/builder/BranchEdge.js +19 -0
- package/dist/components/builder/BranchEdge.js.map +1 -0
- package/dist/components/builder/BuilderToolbar.d.ts +10 -0
- package/dist/components/builder/BuilderToolbar.d.ts.map +1 -0
- package/dist/components/builder/BuilderToolbar.js +16 -0
- package/dist/components/builder/BuilderToolbar.js.map +1 -0
- package/dist/components/builder/StepConfigDrawer.d.ts +11 -0
- package/dist/components/builder/StepConfigDrawer.d.ts.map +1 -0
- package/dist/components/builder/StepConfigDrawer.js +21 -0
- package/dist/components/builder/StepConfigDrawer.js.map +1 -0
- package/dist/components/builder/StepNode.d.ts +15 -0
- package/dist/components/builder/StepNode.d.ts.map +1 -0
- package/dist/components/builder/StepNode.js +56 -0
- package/dist/components/builder/StepNode.js.map +1 -0
- package/dist/components/builder/StepPalette.d.ts +7 -0
- package/dist/components/builder/StepPalette.d.ts.map +1 -0
- package/dist/components/builder/StepPalette.js +83 -0
- package/dist/components/builder/StepPalette.js.map +1 -0
- package/dist/components/builder/StepPicker.d.ts +9 -0
- package/dist/components/builder/StepPicker.d.ts.map +1 -0
- package/dist/components/builder/StepPicker.js +95 -0
- package/dist/components/builder/StepPicker.js.map +1 -0
- package/dist/components/builder/TriggerConfigPanel.d.ts +10 -0
- package/dist/components/builder/TriggerConfigPanel.d.ts.map +1 -0
- package/dist/components/builder/TriggerConfigPanel.js +49 -0
- package/dist/components/builder/TriggerConfigPanel.js.map +1 -0
- package/dist/components/builder/TriggerNode.d.ts +9 -0
- package/dist/components/builder/TriggerNode.d.ts.map +1 -0
- package/dist/components/builder/TriggerNode.js +30 -0
- package/dist/components/builder/TriggerNode.js.map +1 -0
- package/dist/components/builder/TriggerPicker.d.ts +8 -0
- package/dist/components/builder/TriggerPicker.d.ts.map +1 -0
- package/dist/components/builder/TriggerPicker.js +61 -0
- package/dist/components/builder/TriggerPicker.js.map +1 -0
- package/dist/components/builder/WorkflowBuilder.d.ts +20 -0
- package/dist/components/builder/WorkflowBuilder.d.ts.map +1 -0
- package/dist/components/builder/WorkflowBuilder.js +157 -0
- package/dist/components/builder/WorkflowBuilder.js.map +1 -0
- package/dist/components/builder/edge-types.d.ts +3 -0
- package/dist/components/builder/edge-types.d.ts.map +1 -0
- package/dist/components/builder/edge-types.js +5 -0
- package/dist/components/builder/edge-types.js.map +1 -0
- package/dist/components/builder/node-types.d.ts +3 -0
- package/dist/components/builder/node-types.d.ts.map +1 -0
- package/dist/components/builder/node-types.js +11 -0
- package/dist/components/builder/node-types.js.map +1 -0
- package/dist/components/builder/v2/AddStepButton.d.ts +6 -0
- package/dist/components/builder/v2/AddStepButton.d.ts.map +1 -0
- package/dist/components/builder/v2/AddStepButton.js +6 -0
- package/dist/components/builder/v2/AddStepButton.js.map +1 -0
- package/dist/components/builder/v2/BranchEdge.d.ts +3 -0
- package/dist/components/builder/v2/BranchEdge.d.ts.map +1 -0
- package/dist/components/builder/v2/BranchEdge.js +46 -0
- package/dist/components/builder/v2/BranchEdge.js.map +1 -0
- package/dist/components/builder/v2/LoopBodyEdge.d.ts +7 -0
- package/dist/components/builder/v2/LoopBodyEdge.d.ts.map +1 -0
- package/dist/components/builder/v2/LoopBodyEdge.js +19 -0
- package/dist/components/builder/v2/LoopBodyEdge.js.map +1 -0
- package/dist/components/builder/v2/LoopbackEdge.d.ts +10 -0
- package/dist/components/builder/v2/LoopbackEdge.d.ts.map +1 -0
- package/dist/components/builder/v2/LoopbackEdge.js +26 -0
- package/dist/components/builder/v2/LoopbackEdge.js.map +1 -0
- package/dist/components/builder/v2/StepNode.d.ts +21 -0
- package/dist/components/builder/v2/StepNode.d.ts.map +1 -0
- package/dist/components/builder/v2/StepNode.js +36 -0
- package/dist/components/builder/v2/StepNode.js.map +1 -0
- package/dist/components/builder/v2/StepPicker.d.ts +8 -0
- package/dist/components/builder/v2/StepPicker.d.ts.map +1 -0
- package/dist/components/builder/v2/StepPicker.js +73 -0
- package/dist/components/builder/v2/StepPicker.js.map +1 -0
- package/dist/components/builder/v2/TerminalNode.d.ts +6 -0
- package/dist/components/builder/v2/TerminalNode.d.ts.map +1 -0
- package/dist/components/builder/v2/TerminalNode.js +7 -0
- package/dist/components/builder/v2/TerminalNode.js.map +1 -0
- package/dist/components/builder/v2/TriggerNode.d.ts +10 -0
- package/dist/components/builder/v2/TriggerNode.d.ts.map +1 -0
- package/dist/components/builder/v2/TriggerNode.js +20 -0
- package/dist/components/builder/v2/TriggerNode.js.map +1 -0
- package/dist/components/builder/v2/TriggerPicker.d.ts +7 -0
- package/dist/components/builder/v2/TriggerPicker.d.ts.map +1 -0
- package/dist/components/builder/v2/TriggerPicker.js +45 -0
- package/dist/components/builder/v2/TriggerPicker.js.map +1 -0
- package/dist/components/builder/v2/WorkflowBuilder.d.ts +14 -0
- package/dist/components/builder/v2/WorkflowBuilder.d.ts.map +1 -0
- package/dist/components/builder/v2/WorkflowBuilder.js +189 -0
- package/dist/components/builder/v2/WorkflowBuilder.js.map +1 -0
- package/dist/components/builder/v2/edge-types.d.ts +3 -0
- package/dist/components/builder/v2/edge-types.d.ts.map +1 -0
- package/dist/components/builder/v2/edge-types.js +9 -0
- package/dist/components/builder/v2/edge-types.js.map +1 -0
- package/dist/components/builder/v2/icons.d.ts +25 -0
- package/dist/components/builder/v2/icons.d.ts.map +1 -0
- package/dist/components/builder/v2/icons.js +43 -0
- package/dist/components/builder/v2/icons.js.map +1 -0
- package/dist/components/builder/v2/layout-engine.d.ts +76 -0
- package/dist/components/builder/v2/layout-engine.d.ts.map +1 -0
- package/dist/components/builder/v2/layout-engine.js +465 -0
- package/dist/components/builder/v2/layout-engine.js.map +1 -0
- package/dist/components/builder/v2/node-types.d.ts +3 -0
- package/dist/components/builder/v2/node-types.d.ts.map +1 -0
- package/dist/components/builder/v2/node-types.js +11 -0
- package/dist/components/builder/v2/node-types.js.map +1 -0
- package/dist/components/builder/v2/theme.d.ts +28 -0
- package/dist/components/builder/v2/theme.d.ts.map +1 -0
- package/dist/components/builder/v2/theme.js +63 -0
- package/dist/components/builder/v2/theme.js.map +1 -0
- package/dist/components/builder/v3/CitationEditor.d.ts.map +1 -1
- package/dist/components/builder/v3/CitationEditor.js +10 -1
- package/dist/components/builder/v3/CitationEditor.js.map +1 -1
- package/dist/components/builder/v3/VariablePickerPopover.d.ts +1 -1
- package/dist/components/builder/v3/VariablePickerPopover.d.ts.map +1 -1
- package/dist/components/builder/v3/VariablePickerPopover.js +3 -3
- package/dist/components/builder/v3/VariablePickerPopover.js.map +1 -1
- package/dist/components/dashboard/WorkflowSummaryEditor.d.ts +11 -0
- package/dist/components/dashboard/WorkflowSummaryEditor.d.ts.map +1 -0
- package/dist/components/dashboard/WorkflowSummaryEditor.js +46 -0
- package/dist/components/dashboard/WorkflowSummaryEditor.js.map +1 -0
- package/dist/components/execution/CitationSourcePanel.d.ts +23 -0
- package/dist/components/execution/CitationSourcePanel.d.ts.map +1 -0
- package/dist/components/execution/CitationSourcePanel.js +14 -0
- package/dist/components/execution/CitationSourcePanel.js.map +1 -0
- package/dist/components/execution/ExecutionEdge.d.ts +4 -0
- package/dist/components/execution/ExecutionEdge.d.ts.map +1 -0
- package/dist/components/execution/ExecutionEdge.js +27 -0
- package/dist/components/execution/ExecutionEdge.js.map +1 -0
- package/dist/components/execution/ExecutionStepNode.d.ts +14 -0
- package/dist/components/execution/ExecutionStepNode.d.ts.map +1 -0
- package/dist/components/execution/ExecutionStepNode.js +47 -0
- package/dist/components/execution/ExecutionStepNode.js.map +1 -0
- package/dist/components/execution/ExecutionTabs.d.ts.map +1 -1
- package/dist/components/execution/ExecutionTabs.js +37 -21
- package/dist/components/execution/ExecutionTabs.js.map +1 -1
- package/dist/components/execution/ExecutionTriggerNode.d.ts +9 -0
- package/dist/components/execution/ExecutionTriggerNode.d.ts.map +1 -0
- package/dist/components/execution/ExecutionTriggerNode.js +15 -0
- package/dist/components/execution/ExecutionTriggerNode.js.map +1 -0
- package/dist/components/execution/ExecutionViewer.d.ts.map +1 -1
- package/dist/components/execution/ExecutionViewer.js +38 -27
- package/dist/components/execution/ExecutionViewer.js.map +1 -1
- package/dist/components/execution/SchemaAwareRenderer.d.ts +7 -1
- package/dist/components/execution/SchemaAwareRenderer.d.ts.map +1 -1
- package/dist/components/execution/SchemaAwareRenderer.js +25 -18
- package/dist/components/execution/SchemaAwareRenderer.js.map +1 -1
- package/dist/components/execution/StepAgentPanels.d.ts +9 -0
- package/dist/components/execution/StepAgentPanels.d.ts.map +1 -0
- package/dist/components/execution/StepAgentPanels.js +133 -0
- package/dist/components/execution/StepAgentPanels.js.map +1 -0
- package/dist/components/execution/StepDetailPanel.d.ts.map +1 -1
- package/dist/components/execution/StepDetailPanel.js +6 -2
- package/dist/components/execution/StepDetailPanel.js.map +1 -1
- package/dist/components/execution/execution-layout.d.ts +31 -0
- package/dist/components/execution/execution-layout.d.ts.map +1 -0
- package/dist/components/execution/execution-layout.js +90 -0
- package/dist/components/execution/execution-layout.js.map +1 -0
- package/dist/components/execution/journey-model.d.ts.map +1 -1
- package/dist/components/execution/journey-model.js +11 -5
- package/dist/components/execution/journey-model.js.map +1 -1
- package/dist/components/execution/origin/OriginTrace.d.ts.map +1 -1
- package/dist/components/execution/origin/OriginTrace.js +66 -29
- package/dist/components/execution/origin/OriginTrace.js.map +1 -1
- package/dist/components/execution/origin/citation-resolver.d.ts +39 -0
- package/dist/components/execution/origin/citation-resolver.d.ts.map +1 -0
- package/dist/components/execution/origin/citation-resolver.js +94 -0
- package/dist/components/execution/origin/citation-resolver.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/shared/AttachmentCard.d.ts +22 -0
- package/dist/components/shared/AttachmentCard.d.ts.map +1 -1
- package/dist/components/shared/AttachmentCard.js +93 -3
- package/dist/components/shared/AttachmentCard.js.map +1 -1
- package/dist/components/shared/CitationArrow.d.ts +37 -0
- package/dist/components/shared/CitationArrow.d.ts.map +1 -0
- package/dist/components/shared/CitationArrow.js +83 -0
- package/dist/components/shared/CitationArrow.js.map +1 -0
- package/dist/components/shared/DocumentViewer.d.ts +4 -2
- package/dist/components/shared/DocumentViewer.d.ts.map +1 -1
- package/dist/components/shared/DocumentViewer.js +8 -8
- package/dist/components/shared/DocumentViewer.js.map +1 -1
- package/dist/components/shared/JsonTreeViewer.d.ts +9 -0
- package/dist/components/shared/JsonTreeViewer.d.ts.map +1 -0
- package/dist/components/shared/JsonTreeViewer.js +46 -0
- package/dist/components/shared/JsonTreeViewer.js.map +1 -0
- package/dist/components/shared/MarkdownCitation.d.ts +25 -0
- package/dist/components/shared/MarkdownCitation.d.ts.map +1 -0
- package/dist/components/shared/MarkdownCitation.js +31 -0
- package/dist/components/shared/MarkdownCitation.js.map +1 -0
- package/dist/components/shared/MarkdownView.d.ts.map +1 -1
- package/dist/components/shared/MarkdownView.js +19 -2
- package/dist/components/shared/MarkdownView.js.map +1 -1
- package/dist/components/shared/citation-context.d.ts +35 -0
- package/dist/components/shared/citation-context.d.ts.map +1 -0
- package/dist/components/shared/citation-context.js +34 -0
- package/dist/components/shared/citation-context.js.map +1 -0
- package/dist/components/shared/citation.d.ts +55 -0
- package/dist/components/shared/citation.d.ts.map +1 -0
- package/dist/components/shared/citation.js +83 -0
- package/dist/components/shared/citation.js.map +1 -0
- package/dist/components/shared/markdown-citation-directive.d.ts +34 -0
- package/dist/components/shared/markdown-citation-directive.d.ts.map +1 -0
- package/dist/components/shared/markdown-citation-directive.js +110 -0
- package/dist/components/shared/markdown-citation-directive.js.map +1 -0
- package/dist/components/shared/viewers/PdfView.d.ts +38 -0
- package/dist/components/shared/viewers/PdfView.d.ts.map +1 -0
- package/dist/components/shared/viewers/PdfView.js +439 -0
- package/dist/components/shared/viewers/PdfView.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout-engine/components.d.ts.map +1 -1
- package/dist/layout-engine/components.js +78 -23
- package/dist/layout-engine/components.js.map +1 -1
- package/dist/layout-engine/render.d.ts.map +1 -1
- package/dist/layout-engine/render.js +62 -1
- package/dist/layout-engine/render.js.map +1 -1
- package/dist/styles.css +8 -2
- package/package.json +5 -2
- package/dist/components/schema-form/AttachmentField.d.ts +0 -16
- package/dist/components/schema-form/AttachmentField.d.ts.map +0 -1
- package/dist/components/schema-form/AttachmentField.js +0 -139
- package/dist/components/schema-form/AttachmentField.js.map +0 -1
- package/dist/utils/map-lanes.d.ts +0 -35
- package/dist/utils/map-lanes.d.ts.map +0 -1
- package/dist/utils/map-lanes.js +0 -48
- package/dist/utils/map-lanes.js.map +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import ReactMarkdown from 'react-markdown';
|
|
2
|
+
import ReactMarkdown, {} from 'react-markdown';
|
|
3
3
|
import remarkGfm from 'remark-gfm';
|
|
4
|
+
import remarkDirective from 'remark-directive';
|
|
4
5
|
import rehypeRaw from 'rehype-raw';
|
|
5
6
|
import rehypeSanitize from 'rehype-sanitize';
|
|
6
7
|
import { cn } from './cn.js';
|
|
7
8
|
import { JsonView, tryParseJson } from './JsonView.js';
|
|
9
|
+
import { MarkdownCitation } from './MarkdownCitation.js';
|
|
10
|
+
import { remarkCitationDirective, citationSanitizeSchema } from './markdown-citation-directive.js';
|
|
8
11
|
/**
|
|
9
12
|
* Renders markdown (GitHub-flavored) to safe React nodes — no
|
|
10
13
|
* `dangerouslySetInnerHTML`. Used for the workflow summary in both the builder
|
|
@@ -12,7 +15,20 @@ import { JsonView, tryParseJson } from './JsonView.js';
|
|
|
12
15
|
* it works without a Tailwind typography plugin.
|
|
13
16
|
*/
|
|
14
17
|
export function MarkdownView({ children, className, bare }) {
|
|
15
|
-
return (_jsx("div", { className: cn('wui-markdown min-w-0 max-w-full', !bare && 'text-[13px] leading-relaxed text-[var(--wui-fg)]', className), children: _jsx(ReactMarkdown
|
|
18
|
+
return (_jsx("div", { className: cn('wui-markdown min-w-0 max-w-full', !bare && 'text-[13px] leading-relaxed text-[var(--wui-fg)]', className), children: _jsx(ReactMarkdown
|
|
19
|
+
// remarkDirective must precede remarkCitationDirective (the nodes have to
|
|
20
|
+
// exist before we map them). rehypeRaw stays ahead of rehypeSanitize so
|
|
21
|
+
// raw HTML is still sanitized — our <citation> survives the round-trip
|
|
22
|
+
// because the schema below admits it.
|
|
23
|
+
, {
|
|
24
|
+
// remarkDirective must precede remarkCitationDirective (the nodes have to
|
|
25
|
+
// exist before we map them). rehypeRaw stays ahead of rehypeSanitize so
|
|
26
|
+
// raw HTML is still sanitized — our <citation> survives the round-trip
|
|
27
|
+
// because the schema below admits it.
|
|
28
|
+
remarkPlugins: [remarkGfm, remarkDirective, remarkCitationDirective], rehypePlugins: [rehypeRaw, [rehypeSanitize, citationSanitizeSchema]],
|
|
29
|
+
// `citation` isn't an intrinsic element, so the map needs the cast;
|
|
30
|
+
// hast-util-to-jsx-runtime dispatches any tag present here by name.
|
|
31
|
+
components: {
|
|
16
32
|
h1: ({ node: _n, ...p }) => _jsx("h1", { className: "mb-2.5 mt-4 border-b border-[var(--wui-border)] pb-1.5 text-[15px] font-semibold text-[var(--wui-fg)] first:mt-0", ...p }),
|
|
17
33
|
h2: ({ node: _n, ...p }) => _jsx("h2", { className: "mb-2 mt-4 border-b border-[var(--wui-border)] pb-1 text-[13.5px] font-semibold text-[var(--wui-fg)] first:mt-0", ...p }),
|
|
18
34
|
h3: ({ node: _n, ...p }) => _jsx("h3", { className: "mb-1.5 mt-3 text-[12.5px] font-semibold text-[var(--wui-fg)] first:mt-0", ...p }),
|
|
@@ -45,6 +61,7 @@ export function MarkdownView({ children, className, bare }) {
|
|
|
45
61
|
th: ({ node: _n, ...p }) => _jsx("th", { className: "border-b border-[var(--wui-border)] bg-[var(--wui-bg-muted)] px-3 py-2 text-left font-semibold text-[var(--wui-fg)] [&:not(:last-child)]:border-r [&:not(:last-child)]:border-[var(--wui-border)]", ...p }),
|
|
46
62
|
td: ({ node: _n, ...p }) => _jsx("td", { className: "border-b border-[var(--wui-border)] px-3 py-2 align-top text-[var(--wui-fg)] [&:not(:last-child)]:border-r [&:not(:last-child)]:border-[var(--wui-border)]", ...p }),
|
|
47
63
|
hr: ({ node: _n, ...p }) => _jsx("hr", { className: "my-4 border-t border-[var(--wui-border)]", ...p }),
|
|
64
|
+
citation: MarkdownCitation,
|
|
48
65
|
}, children: children }) }));
|
|
49
66
|
}
|
|
50
67
|
//# sourceMappingURL=MarkdownView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownView.js","sourceRoot":"","sources":["../../../src/components/shared/MarkdownView.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"MarkdownView.js","sourceRoot":"","sources":["../../../src/components/shared/MarkdownView.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,EAAE,EAAmB,MAAM,gBAAgB,CAAC;AAChE,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,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AAC,EAAE,EAAE,EAAE,CAAC,aAAI,SAAS,EAAC,4JAA4J,KAAK,CAAC,GAAI;gBAChN,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,aAAI,SAAS,EAAC,0CAA0C,KAAK,CAAC,GAAI;gBAC9F,QAAQ,EAAE,gBAAgB;aACb,YAEd,QAAQ,GACK,GACZ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { OriginResolverCtx } from '../execution/origin/origin-resolver.js';
|
|
2
|
+
import type { ResolvedCitation } from '../execution/origin/citation-resolver.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a citation marker needs to turn a cited ref into an openable source: the
|
|
5
|
+
* workflow config + step outputs of the execution being read.
|
|
6
|
+
*
|
|
7
|
+
* Supplied by context rather than props because markers mount deep inside
|
|
8
|
+
* renderers that are otherwise data-only — the layout DSL's components and the
|
|
9
|
+
* markdown renderer — and threading a resolver through every one of them (and
|
|
10
|
+
* every existing caller) would be invasive for something most surfaces don't use.
|
|
11
|
+
*
|
|
12
|
+
* The default is `null`, and markers render nothing without it. So a surface that
|
|
13
|
+
* has no execution in scope (a summary, an approval reason, any of the many
|
|
14
|
+
* string-only markdown callers) keeps working untouched, and citations light up
|
|
15
|
+
* only where a provider is mounted.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CitationOriginContext: import("react").Context<OriginResolverCtx | null>;
|
|
18
|
+
export declare function useCitationOrigin(): OriginResolverCtx | null;
|
|
19
|
+
/** Show a cited document. */
|
|
20
|
+
export type OpenCitationDoc = (doc: Extract<ResolvedCitation, {
|
|
21
|
+
kind: 'doc';
|
|
22
|
+
}>) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Where a cited document should open.
|
|
25
|
+
*
|
|
26
|
+
* A surface that can host a side-by-side panel (the run view) provides this, and
|
|
27
|
+
* the source opens as a resizable column beside the data — you keep the value and
|
|
28
|
+
* its evidence on screen together, which is the whole point of checking a citation.
|
|
29
|
+
*
|
|
30
|
+
* Without a provider the marker falls back to a modal, so surfaces with nowhere to
|
|
31
|
+
* put a panel (a preview, an embedded snippet) still open their sources.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CitationOpenContext: import("react").Context<OpenCitationDoc | null>;
|
|
34
|
+
export declare function useCitationOpener(): OpenCitationDoc | null;
|
|
35
|
+
//# sourceMappingURL=citation-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-context.d.ts","sourceRoot":"","sources":["../../../src/components/shared/citation-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAEjF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,mDAAgD,CAAC;AAEnF,wBAAgB,iBAAiB,IAAI,iBAAiB,GAAG,IAAI,CAE5D;AAED,6BAA6B;AAC7B,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,KAAK,IAAI,CAAC;AAExF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,iDAA8C,CAAC;AAE/E,wBAAgB,iBAAiB,IAAI,eAAe,GAAG,IAAI,CAE1D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What a citation marker needs to turn a cited ref into an openable source: the
|
|
4
|
+
* workflow config + step outputs of the execution being read.
|
|
5
|
+
*
|
|
6
|
+
* Supplied by context rather than props because markers mount deep inside
|
|
7
|
+
* renderers that are otherwise data-only — the layout DSL's components and the
|
|
8
|
+
* markdown renderer — and threading a resolver through every one of them (and
|
|
9
|
+
* every existing caller) would be invasive for something most surfaces don't use.
|
|
10
|
+
*
|
|
11
|
+
* The default is `null`, and markers render nothing without it. So a surface that
|
|
12
|
+
* has no execution in scope (a summary, an approval reason, any of the many
|
|
13
|
+
* string-only markdown callers) keeps working untouched, and citations light up
|
|
14
|
+
* only where a provider is mounted.
|
|
15
|
+
*/
|
|
16
|
+
export const CitationOriginContext = createContext(null);
|
|
17
|
+
export function useCitationOrigin() {
|
|
18
|
+
return useContext(CitationOriginContext);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Where a cited document should open.
|
|
22
|
+
*
|
|
23
|
+
* A surface that can host a side-by-side panel (the run view) provides this, and
|
|
24
|
+
* the source opens as a resizable column beside the data — you keep the value and
|
|
25
|
+
* its evidence on screen together, which is the whole point of checking a citation.
|
|
26
|
+
*
|
|
27
|
+
* Without a provider the marker falls back to a modal, so surfaces with nowhere to
|
|
28
|
+
* put a panel (a preview, an embedded snippet) still open their sources.
|
|
29
|
+
*/
|
|
30
|
+
export const CitationOpenContext = createContext(null);
|
|
31
|
+
export function useCitationOpener() {
|
|
32
|
+
return useContext(CitationOpenContext);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=citation-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-context.js","sourceRoot":"","sources":["../../../src/components/shared/citation-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAIlD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAEnF,MAAM,UAAU,iBAAiB;IAC/B,OAAO,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC;AAKD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAyB,IAAI,CAAC,CAAC;AAE/E,MAAM,UAAU,iBAAiB;IAC/B,OAAO,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-citation helpers for the reader side.
|
|
3
|
+
*
|
|
4
|
+
* The types live in the SDK (`@xyne/workflow-sdk/common`) — one definition, so
|
|
5
|
+
* the producer (agent step) and the renderers can't drift. This module adds only
|
|
6
|
+
* what reading needs: unwrapping a cited agent response, and walking the
|
|
7
|
+
* citation mirror alongside the data.
|
|
8
|
+
*/
|
|
9
|
+
import type { CitationRef, CitationMap } from '@xyne/workflow-sdk/common';
|
|
10
|
+
import { isCitationRef, isCitationRefArray } from '@xyne/workflow-sdk/common';
|
|
11
|
+
export type { CitationRef, CitationMap };
|
|
12
|
+
export { isCitationRef, isCitationRefArray };
|
|
13
|
+
/**
|
|
14
|
+
* The citation branch belonging to a child, indexed exactly as the value is.
|
|
15
|
+
*
|
|
16
|
+
* How containers walk data and citations in lockstep: since the mirror follows
|
|
17
|
+
* the value's shape, the key or index used to descend into one descends into the
|
|
18
|
+
* other. `undefined` in, `undefined` out — an uncited subtree just stays quiet.
|
|
19
|
+
*/
|
|
20
|
+
export declare function citeAt(cite: unknown, key: string | number): unknown;
|
|
21
|
+
/**
|
|
22
|
+
* The citations for one data point, addressed by its path into the rendered data
|
|
23
|
+
* (`['response', 'total']`, `['response', 'lineItems', 0, 'amount']`).
|
|
24
|
+
*
|
|
25
|
+
* Exact match, not prefix: the mirror follows the data exactly, so a hit is the
|
|
26
|
+
* citations *for that leaf* and nothing is inherited from an ancestor. (Contrast
|
|
27
|
+
* `getFieldCitations` in origin-resolver, which is prefix-aware because author
|
|
28
|
+
* citations are written at a different granularity than they're read.)
|
|
29
|
+
*/
|
|
30
|
+
export declare function citationsAt(map: CitationMap, path: ReadonlyArray<string | number>): CitationRef[];
|
|
31
|
+
/**
|
|
32
|
+
* Split a step's output into the data to render and a citation mirror **aligned
|
|
33
|
+
* to it**.
|
|
34
|
+
*
|
|
35
|
+
* A cited agent returns `output.response = { value, citation }`. We hoist `value`
|
|
36
|
+
* back into `response` so the panel shows the data itself rather than a wrapper,
|
|
37
|
+
* and nest the mirror under the same key — leaving citation and data the same
|
|
38
|
+
* shape, so one walk indexes both (`data.response.total` ↔ `citation.response.total`).
|
|
39
|
+
*
|
|
40
|
+
* Everything else — uncited agents, every other step type — passes through with
|
|
41
|
+
* `citation: undefined`, so renderers can call this unconditionally.
|
|
42
|
+
*/
|
|
43
|
+
export declare function unwrapResponse(output: Record<string, unknown> | undefined): {
|
|
44
|
+
data: Record<string, unknown>;
|
|
45
|
+
citation: CitationMap | undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The matching unwrap for the declared output schema: `resolveOutputJsonSchema`
|
|
49
|
+
* describes a cited response as `{ value, citation }`, so hoist `value` back to
|
|
50
|
+
* `response` exactly as {@link unwrapResponse} does to the data. Without this the
|
|
51
|
+
* schema and the data would disagree about what `response` is, and the
|
|
52
|
+
* schema-driven renderer would fall back to a raw JSON dump.
|
|
53
|
+
*/
|
|
54
|
+
export declare function unwrapResponseSchema(schema: Record<string, unknown> | undefined, output: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
55
|
+
//# sourceMappingURL=citation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation.d.ts","sourceRoot":"","sources":["../../../src/components/shared/citation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE9E,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAInE;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,GACnC,WAAW,EAAE,CAOf;AAkBD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG;IAC3E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;CACnC,CAQA;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAOrC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isCitationRef, isCitationRefArray } from '@xyne/workflow-sdk/common';
|
|
2
|
+
export { isCitationRef, isCitationRefArray };
|
|
3
|
+
/**
|
|
4
|
+
* The citation branch belonging to a child, indexed exactly as the value is.
|
|
5
|
+
*
|
|
6
|
+
* How containers walk data and citations in lockstep: since the mirror follows
|
|
7
|
+
* the value's shape, the key or index used to descend into one descends into the
|
|
8
|
+
* other. `undefined` in, `undefined` out — an uncited subtree just stays quiet.
|
|
9
|
+
*/
|
|
10
|
+
export function citeAt(cite, key) {
|
|
11
|
+
return cite !== null && typeof cite === 'object'
|
|
12
|
+
? cite[key]
|
|
13
|
+
: undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The citations for one data point, addressed by its path into the rendered data
|
|
17
|
+
* (`['response', 'total']`, `['response', 'lineItems', 0, 'amount']`).
|
|
18
|
+
*
|
|
19
|
+
* Exact match, not prefix: the mirror follows the data exactly, so a hit is the
|
|
20
|
+
* citations *for that leaf* and nothing is inherited from an ancestor. (Contrast
|
|
21
|
+
* `getFieldCitations` in origin-resolver, which is prefix-aware because author
|
|
22
|
+
* citations are written at a different granularity than they're read.)
|
|
23
|
+
*/
|
|
24
|
+
export function citationsAt(map, path) {
|
|
25
|
+
let cur = map;
|
|
26
|
+
for (const seg of path) {
|
|
27
|
+
if (cur === null || typeof cur !== 'object')
|
|
28
|
+
return [];
|
|
29
|
+
cur = cur[seg];
|
|
30
|
+
}
|
|
31
|
+
return isCitationRefArray(cur) ? cur : [];
|
|
32
|
+
}
|
|
33
|
+
function citedWrapper(output) {
|
|
34
|
+
const response = output?.['response'];
|
|
35
|
+
if (response === null
|
|
36
|
+
|| typeof response !== 'object'
|
|
37
|
+
|| Array.isArray(response)
|
|
38
|
+
|| !('value' in response || 'citation' in response)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const w = response;
|
|
42
|
+
return { value: w.value, citation: w.citation ?? {} };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Split a step's output into the data to render and a citation mirror **aligned
|
|
46
|
+
* to it**.
|
|
47
|
+
*
|
|
48
|
+
* A cited agent returns `output.response = { value, citation }`. We hoist `value`
|
|
49
|
+
* back into `response` so the panel shows the data itself rather than a wrapper,
|
|
50
|
+
* and nest the mirror under the same key — leaving citation and data the same
|
|
51
|
+
* shape, so one walk indexes both (`data.response.total` ↔ `citation.response.total`).
|
|
52
|
+
*
|
|
53
|
+
* Everything else — uncited agents, every other step type — passes through with
|
|
54
|
+
* `citation: undefined`, so renderers can call this unconditionally.
|
|
55
|
+
*/
|
|
56
|
+
export function unwrapResponse(output) {
|
|
57
|
+
const wrapper = citedWrapper(output);
|
|
58
|
+
if (!wrapper)
|
|
59
|
+
return { data: output ?? {}, citation: undefined };
|
|
60
|
+
return {
|
|
61
|
+
// Sibling agent fields (attachments, usage, toolCalls) are preserved.
|
|
62
|
+
data: { ...output, response: wrapper.value },
|
|
63
|
+
citation: { response: wrapper.citation },
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The matching unwrap for the declared output schema: `resolveOutputJsonSchema`
|
|
68
|
+
* describes a cited response as `{ value, citation }`, so hoist `value` back to
|
|
69
|
+
* `response` exactly as {@link unwrapResponse} does to the data. Without this the
|
|
70
|
+
* schema and the data would disagree about what `response` is, and the
|
|
71
|
+
* schema-driven renderer would fall back to a raw JSON dump.
|
|
72
|
+
*/
|
|
73
|
+
export function unwrapResponseSchema(schema, output) {
|
|
74
|
+
if (!schema || !citedWrapper(output))
|
|
75
|
+
return schema;
|
|
76
|
+
const props = schema['properties'];
|
|
77
|
+
const response = props?.['response'];
|
|
78
|
+
const inner = response?.['properties']?.['value'];
|
|
79
|
+
if (!props || !inner)
|
|
80
|
+
return schema;
|
|
81
|
+
return { ...schema, properties: { ...props, response: inner } };
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=citation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation.js","sourceRoot":"","sources":["../../../src/components/shared/citation.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,IAAa,EAAE,GAAoB;IACxD,OAAO,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAC9C,CAAC,CAAE,IAAqC,CAAC,GAAG,CAAC;QAC7C,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CACzB,GAAgB,EAChB,IAAoC;IAEpC,IAAI,GAAG,GAAY,GAAG,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK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MAAM,CAAC;IACpD,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAwC,CAAC;IAC1E,MAAM,QAAQ,GAAG,KAAK,EAAE,CAAC,UAAU,CAAwC,CAAC;IAC5E,MAAM,KAAK,GAAI,QAAQ,EAAE,CAAC,YAAY,CAAyC,EAAE,CAAC,OAAO,CAAC,CAAC;IAC3F,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK;QAAE,OAAO,MAAM,CAAC;IACpC,OAAO,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Root } from 'mdast';
|
|
2
|
+
import type { VFile } from 'vfile';
|
|
3
|
+
/** The element the directive becomes; `components` maps it to MarkdownCitation. */
|
|
4
|
+
export declare const CITATION_TAG = "citation";
|
|
5
|
+
/**
|
|
6
|
+
* Map `:::citation{…}` onto a `<citation>` element carrying its attributes, and
|
|
7
|
+
* neutralise every other directive (see {@link revertToSource}).
|
|
8
|
+
*/
|
|
9
|
+
export declare function remarkCitationDirective(): (tree: Root, file: VFile) => void;
|
|
10
|
+
/**
|
|
11
|
+
* `defaultSchema` plus the `citation` element.
|
|
12
|
+
*
|
|
13
|
+
* Without this, sanitize doesn't merely ignore `<citation>` — it **unwraps** it,
|
|
14
|
+
* dropping the marker while keeping the text, so citations would silently vanish.
|
|
15
|
+
* Only our five attributes are allowed through, and `url` is confined to http(s),
|
|
16
|
+
* so the directive can't smuggle in markup or a `javascript:` target.
|
|
17
|
+
*/
|
|
18
|
+
export declare const citationSanitizeSchema: {
|
|
19
|
+
tagNames: string[];
|
|
20
|
+
attributes: {
|
|
21
|
+
citation: ("ref" | "title" | "url" | "page" | "quote")[];
|
|
22
|
+
};
|
|
23
|
+
protocols: {
|
|
24
|
+
url: string[];
|
|
25
|
+
};
|
|
26
|
+
allowComments?: boolean | null | undefined;
|
|
27
|
+
allowDoctypes?: boolean | null | undefined;
|
|
28
|
+
ancestors?: Record<string, Array<string>> | null | undefined;
|
|
29
|
+
clobber?: Array<string> | null | undefined;
|
|
30
|
+
clobberPrefix?: string | null | undefined;
|
|
31
|
+
required?: Record<string, Record<string, import("hast").Properties[keyof import("hast").Properties]>> | null | undefined;
|
|
32
|
+
strip?: Array<string> | null | undefined;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=markdown-citation-directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-citation-directive.d.ts","sourceRoot":"","sources":["../../../src/components/shared/markdown-citation-directive.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAInC,mFAAmF;AACnF,eAAO,MAAM,YAAY,aAAa,CAAC;AAgDvC;;;GAGG;AACH,wBAAgB,uBAAuB,KAC7B,MAAM,IAAI,EAAE,MAAM,KAAK,KAAG,IAAI,CAiCvC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;CAWlC,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `:::citation{…}` support for {@link MarkdownView} — the markdown half of runtime
|
|
3
|
+
* citations, mirroring what `cite={…}` does for structured data.
|
|
4
|
+
*
|
|
5
|
+
* An agent writing prose wraps each sourced statement in a container directive:
|
|
6
|
+
*
|
|
7
|
+
* :::citation{ref="steps.ocr.output.results.0.data" page=3 quote="TOTAL 5000"}
|
|
8
|
+
* The invoice totals ₹5,000.
|
|
9
|
+
* :::
|
|
10
|
+
*
|
|
11
|
+
* which renders the statement plus a ↗ marker opening the source.
|
|
12
|
+
*/
|
|
13
|
+
import { visit, SKIP } from 'unist-util-visit';
|
|
14
|
+
import { defaultSchema } from 'rehype-sanitize';
|
|
15
|
+
import { CITATION_DIRECTIVE_ATTRS } from '@xyne/workflow-sdk/common';
|
|
16
|
+
/** The element the directive becomes; `components` maps it to MarkdownCitation. */
|
|
17
|
+
export const CITATION_TAG = 'citation';
|
|
18
|
+
const DIRECTIVE_TYPES = new Set(['containerDirective', 'leafDirective', 'textDirective']);
|
|
19
|
+
/**
|
|
20
|
+
* Replace a node with the exact markdown it was parsed from.
|
|
21
|
+
*
|
|
22
|
+
* Enabling remark-directive turns on `:name` / `::name` / `:::name` **globally**,
|
|
23
|
+
* for every MarkdownView caller — so text that merely looks like a directive
|
|
24
|
+
* (`:release:`, a `:shrug` shortcode) would parse into an unknown node that
|
|
25
|
+
* rehype-sanitize then unwraps, silently deleting the author's words. Restoring
|
|
26
|
+
* the original source keeps this feature from changing any prose but our own.
|
|
27
|
+
*
|
|
28
|
+
* The source is sliced by the node's own offsets, so it round-trips exactly
|
|
29
|
+
* rather than being re-serialised approximately.
|
|
30
|
+
*/
|
|
31
|
+
function revertToSource(node, source) {
|
|
32
|
+
const start = node.position?.start.offset;
|
|
33
|
+
const end = node.position?.end.offset;
|
|
34
|
+
if (start === undefined || end === undefined)
|
|
35
|
+
return false;
|
|
36
|
+
const literal = source.slice(start, end);
|
|
37
|
+
delete node.name;
|
|
38
|
+
delete node.attributes;
|
|
39
|
+
delete node.data;
|
|
40
|
+
if (node.type === 'textDirective') {
|
|
41
|
+
node.type = 'text';
|
|
42
|
+
node.value = literal;
|
|
43
|
+
delete node.children;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
// Block-level: `text` isn't valid where a block directive sat, so wrap it.
|
|
47
|
+
node.type = 'paragraph';
|
|
48
|
+
node.children = [{ type: 'text', value: literal }];
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Map `:::citation{…}` onto a `<citation>` element carrying its attributes, and
|
|
53
|
+
* neutralise every other directive (see {@link revertToSource}).
|
|
54
|
+
*/
|
|
55
|
+
export function remarkCitationDirective() {
|
|
56
|
+
return (tree, file) => {
|
|
57
|
+
const source = String(file.value);
|
|
58
|
+
visit(tree, (node) => {
|
|
59
|
+
const n = node;
|
|
60
|
+
if (!DIRECTIVE_TYPES.has(n.type))
|
|
61
|
+
return;
|
|
62
|
+
if (n.type === 'containerDirective' && n.name === CITATION_TAG) {
|
|
63
|
+
const attrs = n.attributes ?? {};
|
|
64
|
+
const props = {};
|
|
65
|
+
for (const key of CITATION_DIRECTIVE_ATTRS) {
|
|
66
|
+
const v = attrs[key];
|
|
67
|
+
if (typeof v === 'string' && v !== '')
|
|
68
|
+
props[key] = v;
|
|
69
|
+
}
|
|
70
|
+
// A lone paragraph would put a block inside our inline wrapper and push
|
|
71
|
+
// the marker onto its own line; unwrap it so the marker trails the text.
|
|
72
|
+
const kids = n.children;
|
|
73
|
+
if (Array.isArray(kids) && kids.length === 1) {
|
|
74
|
+
const only = kids[0];
|
|
75
|
+
if (only.type === 'paragraph' && Array.isArray(only.children)) {
|
|
76
|
+
n.children = only.children;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const data = n.data ?? (n.data = {});
|
|
80
|
+
data['hName'] = CITATION_TAG;
|
|
81
|
+
data['hProperties'] = props;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (revertToSource(n, source))
|
|
85
|
+
return SKIP;
|
|
86
|
+
return;
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* `defaultSchema` plus the `citation` element.
|
|
92
|
+
*
|
|
93
|
+
* Without this, sanitize doesn't merely ignore `<citation>` — it **unwraps** it,
|
|
94
|
+
* dropping the marker while keeping the text, so citations would silently vanish.
|
|
95
|
+
* Only our five attributes are allowed through, and `url` is confined to http(s),
|
|
96
|
+
* so the directive can't smuggle in markup or a `javascript:` target.
|
|
97
|
+
*/
|
|
98
|
+
export const citationSanitizeSchema = {
|
|
99
|
+
...defaultSchema,
|
|
100
|
+
tagNames: [...(defaultSchema.tagNames ?? []), CITATION_TAG],
|
|
101
|
+
attributes: {
|
|
102
|
+
...defaultSchema.attributes,
|
|
103
|
+
[CITATION_TAG]: [...CITATION_DIRECTIVE_ATTRS],
|
|
104
|
+
},
|
|
105
|
+
protocols: {
|
|
106
|
+
...defaultSchema.protocols,
|
|
107
|
+
url: ['http', 'https'],
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=markdown-citation-directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-citation-directive.js","sourceRoot":"","sources":["../../../src/components/shared/markdown-citation-directive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,mFAAmF;AACnF,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAYvC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;AAE1F;;;;;;;;;;;GAWG;AACH,SAAS,cAAc,CAAC,IAAmB,EAAE,MAAc;IACzD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC;IACtC,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEzC,OAAO,IAAI,CAAC,IAAI,CAAC;IACjB,OAAO,IAAI,CAAC,UAAU,CAAC;IACvB,OAAO,IAAI,CAAC,IAAI,CAAC;IAE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auth). */
|
|
4
|
+
url: string;
|
|
5
|
+
/** Display name shown in the toolbar and used for the download filename. */
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
/** 1-indexed page to scroll to on first load (e.g. a citation's pageNumber). */
|
|
8
|
+
initialPage?: number | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Initial zoom. A number is a literal scale (1 = 100%); the named pdf.js
|
|
11
|
+
* modes fit the page to the container. Defaults to `'page-width'` because
|
|
12
|
+
* this viewer is embedded in a narrow, resizable side panel — a literal
|
|
13
|
+
* 100% would overflow horizontally. Named modes re-fit on container resize;
|
|
14
|
+
* once the user zooms manually we stop re-fitting.
|
|
15
|
+
*/
|
|
16
|
+
initialScale?: number | 'page-width' | 'page-fit' | 'page-actual' | 'auto' | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Bump this to re-jump to `initialPage` even when the value didn't change —
|
|
19
|
+
* lets a host pull the user back to the cited page on re-click. Also
|
|
20
|
+
* re-applies `highlightQuery`.
|
|
21
|
+
*/
|
|
22
|
+
navSeq?: number | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* When provided, prefills the Find input and pdf.js's findController
|
|
25
|
+
* highlights matches in the text layer.
|
|
26
|
+
*/
|
|
27
|
+
highlightQuery?: string | null | undefined;
|
|
28
|
+
/** Leading slot in the toolbar (e.g. a Back button). */
|
|
29
|
+
leading?: ReactNode;
|
|
30
|
+
/** Optional right-side companion rendered alongside the scroll area. */
|
|
31
|
+
rightSlot?: ReactNode;
|
|
32
|
+
/** Extreme-right Close button — only when the host wants a dismiss affordance. */
|
|
33
|
+
onClose?: (() => void) | undefined;
|
|
34
|
+
/** Hide the Download link. */
|
|
35
|
+
hideDownload?: boolean | undefined;
|
|
36
|
+
}
|
|
37
|
+
export default function PdfView({ url, name, initialPage, initialScale, navSeq, highlightQuery, leading, rightSlot, onClose, hideDownload, }: PdfViewProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=PdfView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfView.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/viewers/PdfView.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA8FjF,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;IACvF;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,wDAAwD;IACxD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,wEAAwE;IACxE,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,kFAAkF;IAClF,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACnC,8BAA8B;IAC9B,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC;AAKD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,GAAG,EACH,IAAiB,EACjB,WAAW,EACX,YAA2B,EAC3B,MAAM,EACN,cAAc,EACd,OAAO,EACP,SAAS,EACT,OAAO,EACP,YAAoB,GACrB,EAAE,YAAY,+BA0ed"}
|