@inkandswitch/patchwork-pkg-base 0.0.7 → 0.0.8
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/modules.json +4 -0
- package/package.json +1 -1
- package/packages/account-history/dist/assets/HistoryRecorder-HO_sxeuE.js +248 -0
- package/packages/account-history/dist/assets/HistoryRecorder-HO_sxeuE.js.map +1 -0
- package/packages/account-history/dist/assets/HistoryViewer-Ct5g7zek.js +308 -0
- package/packages/account-history/dist/assets/HistoryViewer-Ct5g7zek.js.map +1 -0
- package/packages/account-history/dist/assets/NotebookViewer-BkYJL6Jc.js +504 -0
- package/packages/account-history/dist/assets/NotebookViewer-BkYJL6Jc.js.map +1 -0
- package/packages/account-history/dist/assets/index-CFzuSuJg.js +148 -0
- package/packages/account-history/dist/assets/index-CFzuSuJg.js.map +1 -0
- package/packages/account-history/dist/assets/makeDocumentProjection-DXgEZYyv.js +706 -0
- package/packages/account-history/dist/assets/makeDocumentProjection-DXgEZYyv.js.map +1 -0
- package/packages/account-history/dist/assets/store-CRmRL4Cv.js +1079 -0
- package/packages/account-history/dist/assets/store-CRmRL4Cv.js.map +1 -0
- package/packages/account-history/dist/index.js +5 -0
- package/packages/account-history/dist/index.js.map +1 -0
- package/packages/account-history/package.json +33 -0
- package/packages/chat/dist/ChatRoot-BXsklgz7.js +6113 -0
- package/packages/chat/dist/context-tool-CenQrztX.js +107 -0
- package/packages/chat/dist/datatype-1niKKK-c.js +15 -0
- package/packages/chat/dist/index-DYFHDHZ9.js +368 -0
- package/packages/chat/dist/index.js +5 -0
- package/packages/chat/dist/tool-D9BTS5wc.js +38 -0
- package/packages/chat/package.json +42 -0
- package/packages/comments-view/dist/assets/comments-D9lwpHOh.js +50 -0
- package/packages/comments-view/dist/assets/comments-D9lwpHOh.js.map +1 -0
- package/packages/comments-view/dist/assets/datatype-C4SMwWiO.js +22 -0
- package/packages/comments-view/dist/assets/datatype-C4SMwWiO.js.map +1 -0
- package/packages/comments-view/dist/assets/main-C8GVksuY.js +2973 -0
- package/packages/comments-view/dist/assets/main-C8GVksuY.js.map +1 -0
- package/packages/comments-view/dist/index.js +115 -0
- package/packages/comments-view/dist/index.js.map +1 -0
- package/packages/comments-view/package.json +36 -0
- package/packages/drafts/dist/assets/DraftDatatype-Dn8VF6oC.js +14 -0
- package/packages/drafts/dist/assets/DraftDatatype-Dn8VF6oC.js.map +1 -0
- package/packages/drafts/dist/assets/DraftListProvider-DVhUGU1x.js +362 -0
- package/packages/drafts/dist/assets/DraftListProvider-DVhUGU1x.js.map +1 -0
- package/packages/drafts/dist/assets/DraftOverlayProvider-NMDqnpBV.js +123 -0
- package/packages/drafts/dist/assets/DraftOverlayProvider-NMDqnpBV.js.map +1 -0
- package/packages/drafts/dist/assets/clone-policy-D4XOfZxs.js +15 -0
- package/packages/drafts/dist/assets/clone-policy-D4XOfZxs.js.map +1 -0
- package/packages/drafts/dist/assets/index-DAqs20jZ.js +65 -0
- package/packages/drafts/dist/assets/index-DAqs20jZ.js.map +1 -0
- package/packages/drafts/dist/assets/main-Cdev7z-t.js +2366 -0
- package/packages/drafts/dist/assets/main-Cdev7z-t.js.map +1 -0
- package/packages/drafts/dist/index.js +140 -0
- package/packages/drafts/dist/index.js.map +1 -0
- package/packages/drafts/package.json +34 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryViewer-Ct5g7zek.js","sources":["../../src/HistoryViewer.tsx"],"sourcesContent":["import { createSignal, createMemo, createEffect, For, Show } from \"solid-js\";\nimport { render } from \"solid-js/web\";\nimport type { AutomergeUrl } from \"@automerge/automerge-repo\";\nimport { makeDocumentProjection } from \"solid-automerge\";\nimport { OpenDocumentEvent } from \"@inkandswitch/patchwork-elements\";\nimport {\n getRegistry,\n type ToolDescription,\n type ToolImplementation,\n} from \"@inkandswitch/patchwork-plugins\";\nimport {\n type PatchworkToolProps,\n type HistoryDoc,\n type HistoryEntry,\n} from \"./types.ts\";\nimport \"./index.css\";\n\ntype GroupingMode = \"date\" | \"document\";\ntype DocumentSortMode = \"recent\" | \"visits\";\n\nconst dateGroupFormatter = new Intl.DateTimeFormat(\"en-US\", {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n});\n\nconst timeFormatter = new Intl.DateTimeFormat(\"en-US\", {\n hour: \"numeric\",\n minute: \"2-digit\",\n hour12: true,\n});\n\nconst shortDateFormatter = new Intl.DateTimeFormat(\"en-US\", {\n month: \"short\",\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"2-digit\",\n});\n\n// Helper function to get tool metadata from registry\nfunction getToolMetadata(toolId: string): { name: string; icon?: string } {\n const toolRegistry = getRegistry<ToolDescription>(\"patchwork:tool\");\n const tool = toolRegistry.get(toolId);\n\n if (tool) {\n return {\n name: tool.name || toolId,\n icon: tool.icon,\n };\n }\n\n // Fallback if tool not found in registry\n return {\n name: toolId,\n icon: \"File\",\n };\n}\n\nfunction HistoryEntryRow(props: {\n entry: HistoryEntry;\n timeDisplay: string;\n urlDisplay: string;\n onOpen: (entry: HistoryEntry) => void;\n onDelete: (e: MouseEvent, entry: HistoryEntry) => void;\n}) {\n const toolMetadata = getToolMetadata(props.entry.toolId);\n\n return (\n <div class=\"account-history-entry\">\n <div class=\"account-history-entry-time\">{props.timeDisplay}</div>\n <div\n class=\"account-history-entry-content\"\n onClick={() => props.onOpen(props.entry)}\n >\n <span class=\"account-history-entry-title\">{props.entry.docTitle}</span>\n <span class=\"account-history-entry-tool\">— {toolMetadata.name}</span>\n <span class=\"account-history-entry-url\">{props.urlDisplay}</span>\n </div>\n <div class=\"account-history-entry-actions\">\n <button\n class=\"account-history-entry-delete\"\n onClick={(e) => props.onDelete(e, props.entry)}\n aria-label=\"Delete from history\"\n title=\"Delete from history\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </div>\n </div>\n );\n}\n\nexport function HistoryViewer(props: PatchworkToolProps<HistoryDoc>) {\n const historyDoc = makeDocumentProjection<HistoryDoc>(props.handle);\n\n // Load preferences from localStorage\n const savedGroupingMode = (localStorage.getItem(\"history-grouping-mode\") ||\n \"date\") as GroupingMode;\n const savedSortMode = (localStorage.getItem(\"history-document-sort-mode\") ||\n \"recent\") as DocumentSortMode;\n const savedSearchQuery = localStorage.getItem(\"history-search-query\") || \"\";\n\n const [groupingMode, setGroupingMode] =\n createSignal<GroupingMode>(savedGroupingMode);\n const [documentSortMode, setDocumentSortMode] =\n createSignal<DocumentSortMode>(savedSortMode);\n const [searchQuery, setSearchQuery] = createSignal<string>(savedSearchQuery);\n const [expandedGroups, setExpandedGroups] = createSignal<Set<AutomergeUrl>>(\n new Set()\n );\n\n // Save preferences to localStorage when they change\n createEffect(() => {\n localStorage.setItem(\"history-grouping-mode\", groupingMode());\n });\n\n createEffect(() => {\n localStorage.setItem(\"history-document-sort-mode\", documentSortMode());\n });\n\n createEffect(() => {\n localStorage.setItem(\"history-search-query\", searchQuery());\n });\n\n // Filter entries based on search query\n const filteredEntries = createMemo(() => {\n const query = searchQuery().toLowerCase().trim();\n if (!query) {\n return historyDoc.entries || [];\n }\n\n return (historyDoc.entries || []).filter((entry) => {\n const titleMatch = entry.docTitle?.toLowerCase().includes(query);\n const urlMatch = entry.docUrl?.toLowerCase().includes(query);\n return titleMatch || urlMatch;\n });\n });\n\n // Group entries by date (returns array of [dateString, entries] tuples)\n const groupedByDate = createMemo(() => {\n const groups = new Map<string, HistoryEntry[]>();\n\n // Reverse to show most recent first\n const entries = [...filteredEntries()].reverse();\n\n for (const entry of entries) {\n const date = dateGroupFormatter.format(new Date(entry.timestamp));\n\n if (!groups.has(date)) {\n groups.set(date, []);\n }\n groups.get(date)!.push(entry);\n }\n\n return Array.from(groups);\n });\n\n // Group entries by document\n const groupedByDocument = createMemo(() => {\n const groups = new Map<AutomergeUrl, HistoryEntry[]>();\n\n // Reverse to show most recent first within each document group\n const entries = [...filteredEntries()].reverse();\n\n for (const entry of entries) {\n if (!groups.has(entry.docUrl)) {\n groups.set(entry.docUrl, []);\n }\n groups.get(entry.docUrl)!.push(entry);\n }\n\n return groups;\n });\n\n // Sorted document groups\n const sortedDocumentGroups = createMemo(() => {\n const groups = Array.from(groupedByDocument());\n const sortMode = documentSortMode();\n\n if (sortMode === \"visits\") {\n // Sort by number of visits (descending)\n return groups.sort((a, b) => b[1].length - a[1].length);\n } else {\n // Precompute max timestamps to avoid recalculating in comparator\n const maxTimestamps = new Map<AutomergeUrl, number>();\n for (const [url, entries] of groups) {\n let max = 0;\n for (const e of entries) {\n if (e.timestamp > max) max = e.timestamp;\n }\n maxTimestamps.set(url, max);\n }\n return groups.sort(\n (a, b) => maxTimestamps.get(b[0])! - maxTimestamps.get(a[0])!\n );\n }\n });\n\n const openDocument = (entry: HistoryEntry) => {\n // TODO: it makes sense to load the document at the specific moment in history, but for now\n // this isn't indicated well in the UI, so it's likely to be confusing.\n // const url =\n // entry.heads.length > 0\n // ? (`${entry.docUrl}#${entry.heads[0]}` as AutomergeUrl)\n // : entry.docUrl;\n const url = entry.docUrl;\n\n // Open document with saved tool\n props.element.dispatchEvent(\n new OpenDocumentEvent({\n url,\n toolId: entry.toolId,\n })\n );\n };\n\n const formatTime = (timestamp: number) => {\n return timeFormatter.format(new Date(timestamp));\n };\n\n const formatShortDate = (timestamp: number) => {\n return shortDateFormatter.format(new Date(timestamp));\n };\n\n const deleteEntry = (e: MouseEvent, entryToDelete: HistoryEntry) => {\n e.stopPropagation();\n\n props.handle.change((doc) => {\n const index = doc.entries.findIndex(\n (e) =>\n e.timestamp === entryToDelete.timestamp &&\n e.docUrl === entryToDelete.docUrl\n );\n if (index !== -1) {\n doc.entries.splice(index, 1);\n }\n });\n };\n\n const toggleGroup = (docUrl: AutomergeUrl) => {\n setExpandedGroups((prev) => {\n const newSet = new Set(prev);\n if (newSet.has(docUrl)) {\n newSet.delete(docUrl);\n } else {\n newSet.add(docUrl);\n }\n return newSet;\n });\n };\n\n const openDocumentGroup = (docUrl: AutomergeUrl) => {\n // Open document without specifying heads or tool (opens most recent version with default tool)\n props.element.dispatchEvent(\n new OpenDocumentEvent({\n url: docUrl,\n })\n );\n };\n\n return (\n <div class=\"account-history-viewer\">\n <div class=\"account-history-header\">\n <h1 class=\"account-history-title\">Account History</h1>\n <div class=\"account-history-header-controls\">\n <span class=\"account-history-group-label\">Group by:</span>\n <button\n onClick={() => setGroupingMode(\"date\")}\n class={`account-history-toggle-button ${groupingMode() === \"date\" ? \"active\" : \"\"}`}\n >\n Date\n </button>\n <button\n onClick={() => setGroupingMode(\"document\")}\n class={`account-history-toggle-button ${groupingMode() === \"document\" ? \"active\" : \"\"}`}\n >\n Document\n </button>\n <Show when={groupingMode() === \"document\"}>\n <span class=\"account-history-sort-label\">Sort by:</span>\n <button\n onClick={() => setDocumentSortMode(\"recent\")}\n class={`account-history-sort-button ${documentSortMode() === \"recent\" ? \"active\" : \"\"}`}\n >\n Most Recent\n </button>\n <button\n onClick={() => setDocumentSortMode(\"visits\")}\n class={`account-history-sort-button ${documentSortMode() === \"visits\" ? \"active\" : \"\"}`}\n >\n Most Visits\n </button>\n </Show>\n </div>\n <div class=\"account-history-search\">\n <svg\n class=\"account-history-search-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.35-4.35\" />\n </svg>\n <input\n type=\"text\"\n class=\"account-history-search-input\"\n placeholder=\"search history\"\n value={searchQuery()}\n onInput={(e) => setSearchQuery(e.currentTarget.value)}\n />\n </div>\n </div>\n\n <div class=\"account-history-content\">\n <Show when={groupingMode() === \"date\"}>\n <For each={groupedByDate()}>\n {([date, entries]) => (\n <div class=\"account-history-group\">\n <div class=\"account-history-group-header\">\n <h2 class=\"account-history-group-title\">{date}</h2>\n </div>\n <div class=\"account-history-entries\">\n <For each={entries}>\n {(entry) => (\n <HistoryEntryRow\n entry={entry}\n timeDisplay={formatTime(entry.timestamp)}\n urlDisplay={entry.docUrl}\n onOpen={openDocument}\n onDelete={deleteEntry}\n />\n )}\n </For>\n </div>\n </div>\n )}\n </For>\n </Show>\n\n <Show when={groupingMode() === \"document\"}>\n <For each={sortedDocumentGroups()}>\n {([docUrl, entries]) => {\n const isExpanded = () => expandedGroups().has(docUrl);\n\n return (\n <div class=\"account-history-group\">\n <div\n class=\"account-history-group-header account-history-group-header-clickable\"\n onClick={() => openDocumentGroup(docUrl)}\n >\n <div class=\"account-history-group-header-content\">\n <h2 class=\"account-history-group-title\">\n {entries[0]?.docTitle ?? \"Untitled\"}\n </h2>\n <p class=\"account-history-group-meta\">\n {entries[0]?.docType ?? \"unknown\"} • {entries.length}{\" \"}\n {entries.length === 1 ? \"visit\" : \"visits\"}\n </p>\n </div>\n <button\n class=\"account-history-group-toggle\"\n onClick={(e) => {\n e.stopPropagation();\n toggleGroup(docUrl);\n }}\n aria-label={isExpanded() ? \"Collapse\" : \"Expand\"}\n title={isExpanded() ? \"Collapse\" : \"Expand\"}\n >\n {isExpanded() ? \"−\" : \"+\"}\n </button>\n </div>\n <Show when={isExpanded()}>\n <div class=\"account-history-entries\">\n <For each={entries}>\n {(entry) => (\n <HistoryEntryRow\n entry={entry}\n timeDisplay={formatShortDate(entry.timestamp)}\n urlDisplay={`(#${entry.heads})`}\n onOpen={openDocument}\n onDelete={deleteEntry}\n />\n )}\n </For>\n </div>\n </Show>\n </div>\n );\n }}\n </For>\n </Show>\n\n <Show when={!historyDoc.entries || historyDoc.entries.length === 0}>\n <div class=\"account-history-empty\">\n No history yet. Open some documents to start tracking your history.\n </div>\n </Show>\n </div>\n </div>\n );\n}\n\nexport const renderHistoryViewer: ToolImplementation<HistoryDoc> = (\n handle,\n element\n) => render(() => <HistoryViewer handle={handle} repo={element.repo} element={element} />, element);\n"],"names":["dateGroupFormatter","Intl","DateTimeFormat","year","month","day","timeFormatter","hour","minute","hour12","shortDateFormatter","getToolMetadata","toolId","toolRegistry","getRegistry","tool","get","name","icon","HistoryEntryRow","props","toolMetadata","entry","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_el$7","_el$8","_el$9","_$insert","timeDisplay","$$click","onOpen","docTitle","urlDisplay","e","onDelete","HistoryViewer","historyDoc","makeDocumentProjection","handle","savedGroupingMode","localStorage","getItem","savedSortMode","savedSearchQuery","groupingMode","setGroupingMode","createSignal","documentSortMode","setDocumentSortMode","searchQuery","setSearchQuery","expandedGroups","setExpandedGroups","Set","createEffect","setItem","filteredEntries","createMemo","query","toLowerCase","trim","entries","filter","titleMatch","includes","urlMatch","docUrl","groupedByDate","groups","Map","reverse","date","format","Date","timestamp","has","set","push","Array","from","groupedByDocument","sortedDocumentGroups","sortMode","sort","a","b","length","maxTimestamps","url","max","openDocument","element","dispatchEvent","OpenDocumentEvent","formatTime","formatShortDate","deleteEntry","entryToDelete","stopPropagation","change","doc","index","findIndex","splice","toggleGroup","prev","newSet","delete","add","openDocumentGroup","_el$0","_tmpl$6","_el$1","_el$10","_el$11","_el$12","_el$13","_el$14","_el$18","_el$19","_el$20","_el$21","_$createComponent","Show","when","children","_tmpl$2","_el$16","_tmpl$3","_$effect","_$className","_el$17","_tmpl$4","$$input","currentTarget","value","For","each","_el$23","_tmpl$7","_el$24","_el$25","_el$26","isExpanded","_el$27","_tmpl$9","_el$28","_el$29","_el$30","_el$31","_el$32","_el$34","_el$35","docType","_el$36","_tmpl$8","heads","_p$","_v$3","_v$4","_$setAttribute","t","undefined","_tmpl$5","_v$","_v$2","renderHistoryViewer","render","repo","_$delegateEvents"],"mappings":";;;;;AAoBA,M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sDA,CACjEhI,QACAqD,YACG4E,OAAO,MAAA7C,gBAAOvF,eAAa;AAAA,EAACG;AAAAA,EAAc,IAAEkI,OAAI;AAAA,WAAE7E,QAAQ6E;AAAAA,EAAI;AAAA,EAAE7E;AAAgB,CAAA,GAAMA,OAAO;AAAE8E,eAAA,CAAA,SAAA,OAAA,CAAA;"}
|
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
"use strict";
|
|
3
|
+
try {
|
|
4
|
+
if (typeof document != "undefined") {
|
|
5
|
+
var elementStyle = document.createElement("style");
|
|
6
|
+
elementStyle.appendChild(document.createTextNode('/* ===== Notebook Viewer Layout ===== */\n\n.notebook-viewer {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;\n color: var(--account-history-text);\n background: var(--account-history-hover);\n overflow: hidden;\n box-sizing: border-box;\n position: relative;\n}\n\n/* ===== Timeline Controls (top section) ===== */\n\n.notebook-viewer-timeline {\n flex-shrink: 0;\n padding: var(--account-history-space-sm) var(--account-history-space-lg);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--account-history-space-2xs);\n background: transparent;\n z-index: 2;\n}\n\n.notebook-viewer-date-label {\n font-size: var(--account-history-text-md);\n font-weight: 600;\n color: var(--account-history-text);\n font-variant-numeric: tabular-nums;\n}\n\n/* Playback controls — floating top-left */\n.notebook-viewer-playback {\n position: absolute;\n top: var(--account-history-space-sm);\n left: var(--account-history-space-sm);\n display: flex;\n align-items: center;\n gap: var(--account-history-space-xs);\n z-index: 3;\n}\n\n.notebook-viewer-play-button {\n width: 36px;\n height: 36px;\n border-radius: 50%;\n border: 1px solid var(--account-history-border);\n background: var(--account-history-bg);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--account-history-text);\n transition: background-color var(--account-history-transition-fast) var(--easing),\n color var(--account-history-transition-fast) var(--easing);\n padding: 0;\n}\n\n.notebook-viewer-play-button:hover {\n background: var(--account-history-primary);\n color: var(--account-history-primary-line);\n border-color: var(--account-history-primary);\n}\n\n/* Direction toggle switch */\n.notebook-viewer-direction-toggle {\n position: relative;\n display: flex;\n align-items: center;\n border-radius: 12px;\n border: 1px solid var(--account-history-border);\n background: var(--account-history-bg);\n cursor: pointer;\n overflow: hidden;\n user-select: none;\n height: 24px;\n}\n\n.notebook-viewer-direction-option {\n position: relative;\n z-index: 1;\n padding: 0 var(--account-history-space-xs);\n font-size: var(--account-history-text-2xs);\n font-weight: 600;\n color: var(--account-history-text-tertiary);\n transition: color var(--account-history-transition-fast) var(--easing);\n line-height: 24px;\n}\n\n.notebook-viewer-direction-option.active {\n color: var(--account-history-primary-line);\n}\n\n.notebook-viewer-direction-thumb {\n position: absolute;\n top: 1px;\n bottom: 1px;\n width: 50%;\n border-radius: 10px;\n background: var(--account-history-primary);\n transition: left var(--account-history-transition-base) var(--easing);\n}\n\n.notebook-viewer-direction-thumb.left {\n left: 1px;\n}\n\n.notebook-viewer-direction-thumb.right {\n left: calc(50% - 1px);\n}\n\n.notebook-viewer-timeline-row {\n display: flex;\n align-items: center;\n gap: var(--account-history-space-sm);\n width: 100%;\n max-width: 660px;\n}\n\n.notebook-viewer-timeline-label {\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: var(--account-history-text-sm);\n font-weight: 500;\n color: var(--account-history-text-secondary);\n padding: var(--account-history-space-2xs) var(--account-history-space-xs);\n border-radius: var(--account-history-radius);\n white-space: nowrap;\n transition: color var(--account-history-transition-fast) var(--easing);\n font-family: inherit;\n}\n\n.notebook-viewer-timeline-label:hover {\n color: var(--account-history-primary);\n}\n\n.notebook-viewer-timeline-slider {\n flex: 1;\n min-width: 0;\n cursor: pointer;\n accent-color: var(--account-history-primary);\n}\n\n/* ===== Page Area (middle section) ===== */\n\n.notebook-viewer-page-area {\n flex: 1;\n display: flex;\n align-items: stretch;\n min-height: 0;\n padding: 0 var(--account-history-space-sm);\n gap: var(--account-history-space-xs);\n}\n\n/* Arrow buttons */\n.notebook-viewer-arrow {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n background: transparent;\n border: none;\n cursor: pointer;\n color: var(--account-history-text-secondary);\n font-size: 2rem;\n transition: color var(--account-history-transition-fast) var(--easing),\n opacity var(--account-history-transition-fast) var(--easing);\n border-radius: var(--account-history-radius);\n padding: 0;\n}\n\n.notebook-viewer-arrow:hover:not(:disabled) {\n color: var(--account-history-primary);\n background: rgba(0, 0, 0, 0.04);\n}\n\n.notebook-viewer-arrow:disabled {\n opacity: 0.25;\n cursor: default;\n}\n\n/* The "page" - the central patchwork-view container */\n.notebook-viewer-page {\n flex: 1;\n min-width: 0;\n min-height: 0;\n background: var(--account-history-bg);\n border-radius: 6px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.08);\n overflow: hidden;\n position: relative;\n}\n\n.notebook-viewer-page patchwork-view {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n/* ===== Bottom Controls ===== */\n\n.notebook-viewer-bottom {\n flex-shrink: 0;\n padding: var(--account-history-space-sm) var(--account-history-space-lg);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--account-history-space-xs);\n z-index: 2;\n}\n\n/* Step row — single-line layout: [dropdown] [dropdown?] [slider] [value] */\n.notebook-viewer-step-row {\n display: flex;\n align-items: center;\n gap: var(--account-history-space-sm);\n font-size: var(--account-history-text-sm);\n color: var(--account-history-text-secondary);\n}\n\n.notebook-viewer-select {\n padding: var(--account-history-space-2xs) var(--account-history-space-xs);\n border-radius: var(--account-history-radius);\n border: 1px solid var(--account-history-border);\n background: var(--account-history-bg);\n color: var(--account-history-text);\n font-size: var(--account-history-text-sm);\n font-family: inherit;\n cursor: pointer;\n}\n\n.notebook-viewer-step-slider {\n width: 150px;\n accent-color: var(--account-history-primary);\n cursor: pointer;\n}\n\n.notebook-viewer-step-value {\n min-width: 2em;\n text-align: center;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n\n.notebook-viewer-entry-info {\n font-size: var(--account-history-text-sm);\n color: var(--account-history-text-tertiary);\n display: flex;\n gap: var(--account-history-space-sm);\n align-items: center;\n}\n\n.notebook-viewer-entry-info-position {\n font-weight: 500;\n color: var(--account-history-text-secondary);\n}\n\n/* ===== Open Document Button (top-right) ===== */\n\n.notebook-viewer-open-doc {\n position: absolute;\n top: var(--account-history-space-sm);\n right: var(--account-history-space-sm);\n z-index: 3;\n}\n\n.notebook-viewer-open-doc-button {\n height: 36px;\n border-radius: 18px;\n border: 1px solid var(--account-history-border);\n background: var(--account-history-bg);\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: var(--account-history-space-2xs);\n color: var(--account-history-text);\n font-size: var(--account-history-text-sm);\n font-weight: 500;\n font-family: inherit;\n padding: 0 var(--account-history-space-sm) 0 var(--account-history-space-xs);\n transition: background-color var(--account-history-transition-fast) var(--easing),\n color var(--account-history-transition-fast) var(--easing);\n white-space: nowrap;\n}\n\n.notebook-viewer-open-doc-button:hover {\n background: var(--account-history-primary);\n color: var(--account-history-primary-line);\n border-color: var(--account-history-primary);\n}\n\n.notebook-viewer-open-doc-button svg {\n flex-shrink: 0;\n}\n\n.notebook-viewer-version-dropdown {\n position: absolute;\n top: calc(100% + var(--account-history-space-2xs));\n right: 0;\n min-width: 160px;\n background: var(--account-history-bg);\n border: 1px solid var(--account-history-border);\n border-radius: var(--account-history-radius);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);\n z-index: 4;\n overflow: hidden;\n}\n\n.notebook-viewer-version-option {\n display: block;\n width: 100%;\n padding: var(--account-history-space-xs) var(--account-history-space-sm);\n background: none;\n border: none;\n cursor: pointer;\n text-align: left;\n font-size: var(--account-history-text-sm);\n font-family: inherit;\n color: var(--account-history-text);\n transition: background-color var(--account-history-transition-fast) var(--easing);\n}\n\n.notebook-viewer-version-option:hover {\n background: var(--account-history-hover);\n}\n\n.notebook-viewer-version-option + .notebook-viewer-version-option {\n border-top: 1px solid var(--account-history-border);\n}\n\n/* ===== Empty State ===== */\n\n.notebook-viewer-empty {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--account-history-text-tertiary);\n font-size: var(--account-history-text-md);\n}\n\n\n\n/* ===== Responsive ===== */\n@media (max-width: 640px) {\n .notebook-viewer-arrow {\n width: 32px;\n font-size: 1.5rem;\n }\n\n .notebook-viewer-step-slider {\n width: 100px;\n }\n}'));
|
|
7
|
+
document.head.appendChild(elementStyle);
|
|
8
|
+
}
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.error("vite-plugin-css-injected-by-js", e);
|
|
11
|
+
}
|
|
12
|
+
})();
|
|
13
|
+
import { e as render, f as createComponent, g as delegateEvents, c as createMemo, b as createSignal, o as onCleanup, h as createEffect, i as insert, S as Show, j as createRenderEffect, s as setAttribute, k as className, l as getOwner, F as For, m as memo, t as template } from "./store-CRmRL4Cv.js";
|
|
14
|
+
import { m as makeDocumentProjection } from "./makeDocumentProjection-DXgEZYyv.js";
|
|
15
|
+
import { OpenDocumentEvent } from "@inkandswitch/patchwork-elements";
|
|
16
|
+
var _tmpl$ = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg width=20 height=20 viewBox="0 0 24 24"fill=currentColor stroke=none><polygon points="6 3 20 12 6 21">`), _tmpl$2 = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg width=20 height=20 viewBox="0 0 24 24"fill=currentColor stroke=none><rect x=5 y=3 width=5 height=18></rect><rect x=14 y=3 width=5 height=18>`), _tmpl$3 = /* @__PURE__ */ template(`<div class=notebook-viewer-playback><div class=notebook-viewer-direction-toggle><span>Rev</span><span>Fwd</span><div></div></div><button class=notebook-viewer-play-button>`), _tmpl$4 = /* @__PURE__ */ template(`<div class=notebook-viewer-version-dropdown><button class=notebook-viewer-version-option>Latest version</button><button class=notebook-viewer-version-option>This version`), _tmpl$5 = /* @__PURE__ */ template(`<div class=notebook-viewer-open-doc><button class=notebook-viewer-open-doc-button title="Open this document"><svg xmlns=http://www.w3.org/2000/svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1=10 y1=14 x2=21 y2=3></line></svg>Open document`), _tmpl$6 = /* @__PURE__ */ template(`<div class=notebook-viewer-timeline><div class=notebook-viewer-date-label></div><div class=notebook-viewer-timeline-row><button class=notebook-viewer-timeline-label title="Go to first entry">First</button><input type=range class=notebook-viewer-timeline-slider min=0><button class=notebook-viewer-timeline-label title="Go to latest entry">Latest`), _tmpl$7 = /* @__PURE__ */ template(`<div class=notebook-viewer-page-area><button class=notebook-viewer-arrow aria-label="Go back"><svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="15 18 9 12 15 6"></polyline></svg></button><div class=notebook-viewer-page></div><button class=notebook-viewer-arrow aria-label="Go forward"><svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="9 18 15 12 9 6">`), _tmpl$8 = /* @__PURE__ */ template(`<select class=notebook-viewer-select>`), _tmpl$9 = /* @__PURE__ */ template(`<input type=range class=notebook-viewer-step-slider min=0>`), _tmpl$0 = /* @__PURE__ */ template(`<span class=notebook-viewer-step-value>`), _tmpl$1 = /* @__PURE__ */ template(`<div class=notebook-viewer-bottom><div class=notebook-viewer-step-row><select class=notebook-viewer-select><option value=entries>Step by entries</option><option value=time>Step by time</option></select></div><div class=notebook-viewer-entry-info><span class=notebook-viewer-entry-info-position>Entry <!> of </span><span>`), _tmpl$10 = /* @__PURE__ */ template(`<div class=notebook-viewer>`), _tmpl$11 = /* @__PURE__ */ template(`<div class=notebook-viewer-empty>No history entries yet. Open some documents to start tracking history.`), _tmpl$12 = /* @__PURE__ */ template(`<patchwork-view>`, true, false, false), _tmpl$13 = /* @__PURE__ */ template(`<option>`);
|
|
17
|
+
const LS_INDEX_KEY = "notebook-viewer-current-index";
|
|
18
|
+
const LS_STEP_KEY = "notebook-viewer-step-size";
|
|
19
|
+
const LS_STEP_MODE_KEY = "notebook-viewer-step-mode";
|
|
20
|
+
const LS_TIME_UNIT_KEY = "notebook-viewer-time-unit";
|
|
21
|
+
const LS_TIME_AMOUNT_KEY = "notebook-viewer-time-amount";
|
|
22
|
+
const ALL_STEP_SIZES = [1, 5, 10, 25, 50, 100, 250, 500, 1e3, 2500, 5e3, 1e4];
|
|
23
|
+
const TIME_UNIT_OPTIONS = [{
|
|
24
|
+
unit: "minutes",
|
|
25
|
+
label: "min",
|
|
26
|
+
amounts: [1, 5, 15, 30, 60],
|
|
27
|
+
msPerUnit: 60 * 1e3
|
|
28
|
+
}, {
|
|
29
|
+
unit: "hours",
|
|
30
|
+
label: "hr",
|
|
31
|
+
amounts: [1, 2, 4, 6, 8, 12, 24],
|
|
32
|
+
msPerUnit: 60 * 60 * 1e3
|
|
33
|
+
}, {
|
|
34
|
+
unit: "days",
|
|
35
|
+
label: "day",
|
|
36
|
+
amounts: [1, 2, 3, 5, 7],
|
|
37
|
+
msPerUnit: 24 * 60 * 60 * 1e3
|
|
38
|
+
}, {
|
|
39
|
+
unit: "weeks",
|
|
40
|
+
label: "wk",
|
|
41
|
+
amounts: [1, 2, 4, 6, 13, 26, 52],
|
|
42
|
+
msPerUnit: 7 * 24 * 60 * 60 * 1e3
|
|
43
|
+
}];
|
|
44
|
+
const dateTimeFormatter = new Intl.DateTimeFormat("en-US", {
|
|
45
|
+
year: "numeric",
|
|
46
|
+
month: "long",
|
|
47
|
+
day: "numeric",
|
|
48
|
+
hour: "numeric",
|
|
49
|
+
minute: "2-digit",
|
|
50
|
+
hour12: true
|
|
51
|
+
});
|
|
52
|
+
function findNearestEntryIndex(entries, currentIdx, targetTimestamp, direction) {
|
|
53
|
+
if (direction === "back") {
|
|
54
|
+
for (let i = currentIdx - 1; i >= 0; i--) {
|
|
55
|
+
if (entries[i].timestamp <= targetTimestamp) return i;
|
|
56
|
+
}
|
|
57
|
+
return 0;
|
|
58
|
+
} else {
|
|
59
|
+
for (let i = currentIdx + 1; i < entries.length; i++) {
|
|
60
|
+
if (entries[i].timestamp >= targetTimestamp) return i;
|
|
61
|
+
}
|
|
62
|
+
return entries.length - 1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function NotebookViewer(props) {
|
|
66
|
+
const historyDoc = makeDocumentProjection(props.handle);
|
|
67
|
+
const entries = createMemo(() => historyDoc.entries || []);
|
|
68
|
+
const totalEntries = createMemo(() => entries().length);
|
|
69
|
+
const historySpanMs = createMemo(() => {
|
|
70
|
+
const e = entries();
|
|
71
|
+
if (e.length < 2) return 0;
|
|
72
|
+
return e[e.length - 1].timestamp - e[0].timestamp;
|
|
73
|
+
});
|
|
74
|
+
const availableStepSizes = createMemo(() => {
|
|
75
|
+
const total = totalEntries();
|
|
76
|
+
return ALL_STEP_SIZES.filter((s) => s <= total);
|
|
77
|
+
});
|
|
78
|
+
const availableTimeAmounts = createMemo(() => {
|
|
79
|
+
const span = historySpanMs();
|
|
80
|
+
const result = {
|
|
81
|
+
minutes: [],
|
|
82
|
+
hours: [],
|
|
83
|
+
days: [],
|
|
84
|
+
weeks: []
|
|
85
|
+
};
|
|
86
|
+
for (const opt of TIME_UNIT_OPTIONS) {
|
|
87
|
+
result[opt.unit] = opt.amounts.filter((a) => a * opt.msPerUnit <= span);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
});
|
|
91
|
+
const availableTimeUnits = createMemo(() => TIME_UNIT_OPTIONS.filter((opt) => availableTimeAmounts()[opt.unit].length > 0));
|
|
92
|
+
const savedIndexRaw = localStorage.getItem(LS_INDEX_KEY);
|
|
93
|
+
const hasSavedIndex = savedIndexRaw !== null;
|
|
94
|
+
const savedIndex = hasSavedIndex ? parseInt(savedIndexRaw, 10) : -1;
|
|
95
|
+
const savedStepSize = parseInt(localStorage.getItem(LS_STEP_KEY) || "1", 10);
|
|
96
|
+
const savedStepMode = localStorage.getItem(LS_STEP_MODE_KEY) || "entries";
|
|
97
|
+
const savedTimeUnit = localStorage.getItem(LS_TIME_UNIT_KEY) || "hours";
|
|
98
|
+
const savedTimeAmount = parseInt(localStorage.getItem(LS_TIME_AMOUNT_KEY) || "1", 10);
|
|
99
|
+
const [rawCurrentIndex, setRawCurrentIndex] = createSignal(hasSavedIndex && Number.isFinite(savedIndex) ? Math.max(0, savedIndex) : -1);
|
|
100
|
+
const [stepSize, setStepSize] = createSignal(Number.isFinite(savedStepSize) ? Math.max(1, savedStepSize) : 1);
|
|
101
|
+
const [stepMode, setStepMode] = createSignal(savedStepMode);
|
|
102
|
+
const [timeUnit, setTimeUnit] = createSignal(savedTimeUnit);
|
|
103
|
+
const [timeAmount, setTimeAmount] = createSignal(Number.isFinite(savedTimeAmount) ? Math.max(1, savedTimeAmount) : 1);
|
|
104
|
+
const currentIndex = createMemo(() => {
|
|
105
|
+
const total = totalEntries();
|
|
106
|
+
if (total === 0) return 0;
|
|
107
|
+
const raw = rawCurrentIndex();
|
|
108
|
+
if (raw < 0) return total - 1;
|
|
109
|
+
return Math.min(Math.max(0, raw), total - 1);
|
|
110
|
+
});
|
|
111
|
+
const currentEntry = createMemo(() => {
|
|
112
|
+
const e = entries();
|
|
113
|
+
const idx = currentIndex();
|
|
114
|
+
return e.length > 0 ? e[idx] : void 0;
|
|
115
|
+
});
|
|
116
|
+
const currentDateLabel = createMemo(() => {
|
|
117
|
+
const entry = currentEntry();
|
|
118
|
+
if (!entry) return "";
|
|
119
|
+
return dateTimeFormatter.format(new Date(entry.timestamp));
|
|
120
|
+
});
|
|
121
|
+
const viewDocUrl = createMemo(() => {
|
|
122
|
+
const entry = currentEntry();
|
|
123
|
+
if (!entry) return void 0;
|
|
124
|
+
if (entry.heads && entry.heads.length > 0) {
|
|
125
|
+
return `${entry.docUrl}#${entry.heads.join("|")}`;
|
|
126
|
+
}
|
|
127
|
+
return entry.docUrl;
|
|
128
|
+
});
|
|
129
|
+
const viewToolId = createMemo(() => currentEntry()?.toolId);
|
|
130
|
+
const viewKey = createMemo(() => {
|
|
131
|
+
const url = viewDocUrl();
|
|
132
|
+
const toolId = viewToolId();
|
|
133
|
+
return url ? `${url}-${toolId || "default"}` : void 0;
|
|
134
|
+
});
|
|
135
|
+
const canGoBack = createMemo(() => currentIndex() > 0);
|
|
136
|
+
const canGoForward = createMemo(() => {
|
|
137
|
+
const total = totalEntries();
|
|
138
|
+
return total > 0 && currentIndex() < total - 1;
|
|
139
|
+
});
|
|
140
|
+
const timeStepMs = createMemo(() => {
|
|
141
|
+
const unit = timeUnit();
|
|
142
|
+
const amount = timeAmount();
|
|
143
|
+
const opt = TIME_UNIT_OPTIONS.find((o) => o.unit === unit);
|
|
144
|
+
return opt ? amount * opt.msPerUnit : 0;
|
|
145
|
+
});
|
|
146
|
+
const goBack = () => {
|
|
147
|
+
if (stepMode() === "entries") {
|
|
148
|
+
setRawCurrentIndex(Math.max(0, currentIndex() - stepSize()));
|
|
149
|
+
} else {
|
|
150
|
+
const entry = currentEntry();
|
|
151
|
+
if (!entry) return;
|
|
152
|
+
const targetTs = entry.timestamp - timeStepMs();
|
|
153
|
+
const newIdx = findNearestEntryIndex(entries(), currentIndex(), targetTs, "back");
|
|
154
|
+
setRawCurrentIndex(newIdx);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const goForward = () => {
|
|
158
|
+
if (stepMode() === "entries") {
|
|
159
|
+
setRawCurrentIndex(Math.min(totalEntries() - 1, currentIndex() + stepSize()));
|
|
160
|
+
} else {
|
|
161
|
+
const entry = currentEntry();
|
|
162
|
+
if (!entry) return;
|
|
163
|
+
const targetTs = entry.timestamp + timeStepMs();
|
|
164
|
+
const newIdx = findNearestEntryIndex(entries(), currentIndex(), targetTs, "forward");
|
|
165
|
+
setRawCurrentIndex(newIdx);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const stepSizeSliderIndex = createMemo(() => {
|
|
169
|
+
const sizes = availableStepSizes();
|
|
170
|
+
const idx = sizes.indexOf(stepSize());
|
|
171
|
+
if (idx >= 0) return idx;
|
|
172
|
+
for (let i = sizes.length - 1; i >= 0; i--) {
|
|
173
|
+
if (sizes[i] <= stepSize()) return i;
|
|
174
|
+
}
|
|
175
|
+
return 0;
|
|
176
|
+
});
|
|
177
|
+
const updateStepSizeFromSlider = (sliderIndex) => {
|
|
178
|
+
const sizes = availableStepSizes();
|
|
179
|
+
const clamped = Math.max(0, Math.min(sliderIndex, sizes.length - 1));
|
|
180
|
+
setStepSize(sizes[clamped] || 1);
|
|
181
|
+
};
|
|
182
|
+
const currentTimeAmounts = createMemo(() => availableTimeAmounts()[timeUnit()] || []);
|
|
183
|
+
const timeAmountSliderIndex = createMemo(() => {
|
|
184
|
+
const amounts = currentTimeAmounts();
|
|
185
|
+
const idx = amounts.indexOf(timeAmount());
|
|
186
|
+
if (idx >= 0) return idx;
|
|
187
|
+
for (let i = amounts.length - 1; i >= 0; i--) {
|
|
188
|
+
if (amounts[i] <= timeAmount()) return i;
|
|
189
|
+
}
|
|
190
|
+
return 0;
|
|
191
|
+
});
|
|
192
|
+
const updateTimeAmountFromSlider = (sliderIndex) => {
|
|
193
|
+
const amounts = currentTimeAmounts();
|
|
194
|
+
const clamped = Math.max(0, Math.min(sliderIndex, amounts.length - 1));
|
|
195
|
+
setTimeAmount(amounts[clamped] || 1);
|
|
196
|
+
};
|
|
197
|
+
const timeStepLabel = createMemo(() => {
|
|
198
|
+
const amount = timeAmount();
|
|
199
|
+
const unit = timeUnit();
|
|
200
|
+
const opt = TIME_UNIT_OPTIONS.find((o) => o.unit === unit);
|
|
201
|
+
if (!opt) return "";
|
|
202
|
+
const label = amount === 1 ? opt.label : opt.label + "s";
|
|
203
|
+
return `${amount} ${label}`;
|
|
204
|
+
});
|
|
205
|
+
const goToFirst = () => setRawCurrentIndex(0);
|
|
206
|
+
const goToLatest = () => setRawCurrentIndex(totalEntries() - 1);
|
|
207
|
+
const [isPlaying, setIsPlaying] = createSignal(false);
|
|
208
|
+
const [playDirection, setPlayDirection] = createSignal("forward");
|
|
209
|
+
let playIntervalId;
|
|
210
|
+
const stopPlayback = () => {
|
|
211
|
+
setIsPlaying(false);
|
|
212
|
+
if (playIntervalId !== void 0) {
|
|
213
|
+
clearInterval(playIntervalId);
|
|
214
|
+
playIntervalId = void 0;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const togglePlayback = () => {
|
|
218
|
+
if (isPlaying()) {
|
|
219
|
+
stopPlayback();
|
|
220
|
+
} else {
|
|
221
|
+
setIsPlaying(true);
|
|
222
|
+
playIntervalId = window.setInterval(() => {
|
|
223
|
+
const dir = playDirection();
|
|
224
|
+
if (dir === "forward") {
|
|
225
|
+
if (!canGoForward()) {
|
|
226
|
+
stopPlayback();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
goForward();
|
|
230
|
+
} else {
|
|
231
|
+
if (!canGoBack()) {
|
|
232
|
+
stopPlayback();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
goBack();
|
|
236
|
+
}
|
|
237
|
+
}, 1e3);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
onCleanup(stopPlayback);
|
|
241
|
+
const [showVersionDropdown, setShowVersionDropdown] = createSignal(false);
|
|
242
|
+
const hasHeads = createMemo(() => {
|
|
243
|
+
const entry = currentEntry();
|
|
244
|
+
return !!(entry && entry.heads && entry.heads.length > 0);
|
|
245
|
+
});
|
|
246
|
+
const openDocument = (useLatest) => {
|
|
247
|
+
const entry = currentEntry();
|
|
248
|
+
if (!entry) return;
|
|
249
|
+
let url;
|
|
250
|
+
if (useLatest || !entry.heads || entry.heads.length === 0) {
|
|
251
|
+
url = entry.docUrl;
|
|
252
|
+
} else {
|
|
253
|
+
url = `${entry.docUrl}#${entry.heads.join("|")}`;
|
|
254
|
+
}
|
|
255
|
+
props.element.dispatchEvent(new OpenDocumentEvent({
|
|
256
|
+
url,
|
|
257
|
+
toolId: entry.toolId
|
|
258
|
+
}));
|
|
259
|
+
setShowVersionDropdown(false);
|
|
260
|
+
};
|
|
261
|
+
const handleOpenDocClick = () => {
|
|
262
|
+
if (hasHeads()) {
|
|
263
|
+
setShowVersionDropdown((v) => !v);
|
|
264
|
+
} else {
|
|
265
|
+
openDocument(true);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const onClickOutside = (e) => {
|
|
269
|
+
const target = e.target;
|
|
270
|
+
if (!target.closest(".notebook-viewer-open-doc")) {
|
|
271
|
+
setShowVersionDropdown(false);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
document.addEventListener("click", onClickOutside);
|
|
275
|
+
onCleanup(() => document.removeEventListener("click", onClickOutside));
|
|
276
|
+
const onKeyDown = (e) => {
|
|
277
|
+
const target = e.target;
|
|
278
|
+
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (e.key === "ArrowLeft") {
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
goBack();
|
|
284
|
+
} else if (e.key === "ArrowRight") {
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
goForward();
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
document.addEventListener("keydown", onKeyDown);
|
|
290
|
+
onCleanup(() => document.removeEventListener("keydown", onKeyDown));
|
|
291
|
+
createEffect(() => localStorage.setItem(LS_INDEX_KEY, String(currentIndex())));
|
|
292
|
+
createEffect(() => localStorage.setItem(LS_STEP_KEY, String(stepSize())));
|
|
293
|
+
createEffect(() => localStorage.setItem(LS_STEP_MODE_KEY, stepMode()));
|
|
294
|
+
createEffect(() => localStorage.setItem(LS_TIME_UNIT_KEY, timeUnit()));
|
|
295
|
+
createEffect(() => localStorage.setItem(LS_TIME_AMOUNT_KEY, String(timeAmount())));
|
|
296
|
+
const stepDescription = createMemo(() => {
|
|
297
|
+
if (stepMode() === "entries") {
|
|
298
|
+
const s = stepSize();
|
|
299
|
+
return `${s} ${s === 1 ? "entry" : "entries"}`;
|
|
300
|
+
}
|
|
301
|
+
return timeStepLabel();
|
|
302
|
+
});
|
|
303
|
+
return (() => {
|
|
304
|
+
var _el$ = _tmpl$10();
|
|
305
|
+
insert(_el$, createComponent(Show, {
|
|
306
|
+
get when() {
|
|
307
|
+
return totalEntries() > 0;
|
|
308
|
+
},
|
|
309
|
+
get fallback() {
|
|
310
|
+
return _tmpl$11();
|
|
311
|
+
},
|
|
312
|
+
get children() {
|
|
313
|
+
return [(() => {
|
|
314
|
+
var _el$2 = _tmpl$3(), _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$6 = _el$5.nextSibling, _el$7 = _el$3.nextSibling;
|
|
315
|
+
_el$3.$$click = () => setPlayDirection((d) => d === "forward" ? "reverse" : "forward");
|
|
316
|
+
_el$7.$$click = togglePlayback;
|
|
317
|
+
insert(_el$7, createComponent(Show, {
|
|
318
|
+
get when() {
|
|
319
|
+
return !isPlaying();
|
|
320
|
+
},
|
|
321
|
+
get children() {
|
|
322
|
+
return _tmpl$();
|
|
323
|
+
}
|
|
324
|
+
}), null);
|
|
325
|
+
insert(_el$7, createComponent(Show, {
|
|
326
|
+
get when() {
|
|
327
|
+
return isPlaying();
|
|
328
|
+
},
|
|
329
|
+
get children() {
|
|
330
|
+
return _tmpl$2();
|
|
331
|
+
}
|
|
332
|
+
}), null);
|
|
333
|
+
createRenderEffect((_p$) => {
|
|
334
|
+
var _v$ = `Direction: ${playDirection()}`, _v$2 = `notebook-viewer-direction-option ${playDirection() === "reverse" ? "active" : ""}`, _v$3 = `notebook-viewer-direction-option ${playDirection() === "forward" ? "active" : ""}`, _v$4 = `notebook-viewer-direction-thumb ${playDirection() === "forward" ? "right" : "left"}`, _v$5 = isPlaying() ? "Pause" : "Play";
|
|
335
|
+
_v$ !== _p$.e && setAttribute(_el$3, "title", _p$.e = _v$);
|
|
336
|
+
_v$2 !== _p$.t && className(_el$4, _p$.t = _v$2);
|
|
337
|
+
_v$3 !== _p$.a && className(_el$5, _p$.a = _v$3);
|
|
338
|
+
_v$4 !== _p$.o && className(_el$6, _p$.o = _v$4);
|
|
339
|
+
_v$5 !== _p$.i && setAttribute(_el$7, "title", _p$.i = _v$5);
|
|
340
|
+
return _p$;
|
|
341
|
+
}, {
|
|
342
|
+
e: void 0,
|
|
343
|
+
t: void 0,
|
|
344
|
+
a: void 0,
|
|
345
|
+
o: void 0,
|
|
346
|
+
i: void 0
|
|
347
|
+
});
|
|
348
|
+
return _el$2;
|
|
349
|
+
})(), (() => {
|
|
350
|
+
var _el$0 = _tmpl$5(), _el$1 = _el$0.firstChild;
|
|
351
|
+
_el$1.$$click = handleOpenDocClick;
|
|
352
|
+
insert(_el$0, createComponent(Show, {
|
|
353
|
+
get when() {
|
|
354
|
+
return showVersionDropdown();
|
|
355
|
+
},
|
|
356
|
+
get children() {
|
|
357
|
+
var _el$10 = _tmpl$4(), _el$11 = _el$10.firstChild, _el$12 = _el$11.nextSibling;
|
|
358
|
+
_el$11.$$click = () => openDocument(true);
|
|
359
|
+
_el$12.$$click = () => openDocument(false);
|
|
360
|
+
return _el$10;
|
|
361
|
+
}
|
|
362
|
+
}), null);
|
|
363
|
+
return _el$0;
|
|
364
|
+
})(), (() => {
|
|
365
|
+
var _el$13 = _tmpl$6(), _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling, _el$16 = _el$15.firstChild, _el$17 = _el$16.nextSibling, _el$18 = _el$17.nextSibling;
|
|
366
|
+
insert(_el$14, currentDateLabel);
|
|
367
|
+
_el$16.$$click = goToFirst;
|
|
368
|
+
_el$17.$$input = (e) => setRawCurrentIndex(parseInt(e.currentTarget.value, 10));
|
|
369
|
+
_el$18.$$click = goToLatest;
|
|
370
|
+
createRenderEffect(() => setAttribute(_el$17, "max", totalEntries() - 1));
|
|
371
|
+
createRenderEffect(() => _el$17.value = currentIndex());
|
|
372
|
+
return _el$13;
|
|
373
|
+
})(), (() => {
|
|
374
|
+
var _el$19 = _tmpl$7(), _el$20 = _el$19.firstChild, _el$21 = _el$20.nextSibling, _el$22 = _el$21.nextSibling;
|
|
375
|
+
_el$20.$$click = goBack;
|
|
376
|
+
insert(_el$21, createComponent(Show, {
|
|
377
|
+
get when() {
|
|
378
|
+
return viewKey();
|
|
379
|
+
},
|
|
380
|
+
keyed: true,
|
|
381
|
+
children: (_key) => (() => {
|
|
382
|
+
var _el$38 = _tmpl$12();
|
|
383
|
+
_el$38._$owner = getOwner();
|
|
384
|
+
createRenderEffect((_p$) => {
|
|
385
|
+
var _v$0 = viewDocUrl(), _v$1 = viewToolId();
|
|
386
|
+
_v$0 !== _p$.e && (_el$38.docUrl = _p$.e = _v$0);
|
|
387
|
+
_v$1 !== _p$.t && (_el$38.toolId = _p$.t = _v$1);
|
|
388
|
+
return _p$;
|
|
389
|
+
}, {
|
|
390
|
+
e: void 0,
|
|
391
|
+
t: void 0
|
|
392
|
+
});
|
|
393
|
+
return _el$38;
|
|
394
|
+
})()
|
|
395
|
+
}));
|
|
396
|
+
_el$22.$$click = goForward;
|
|
397
|
+
createRenderEffect((_p$) => {
|
|
398
|
+
var _v$6 = !canGoBack(), _v$7 = `Go back ${stepDescription()}`, _v$8 = !canGoForward(), _v$9 = `Go forward ${stepDescription()}`;
|
|
399
|
+
_v$6 !== _p$.e && (_el$20.disabled = _p$.e = _v$6);
|
|
400
|
+
_v$7 !== _p$.t && setAttribute(_el$20, "title", _p$.t = _v$7);
|
|
401
|
+
_v$8 !== _p$.a && (_el$22.disabled = _p$.a = _v$8);
|
|
402
|
+
_v$9 !== _p$.o && setAttribute(_el$22, "title", _p$.o = _v$9);
|
|
403
|
+
return _p$;
|
|
404
|
+
}, {
|
|
405
|
+
e: void 0,
|
|
406
|
+
t: void 0,
|
|
407
|
+
a: void 0,
|
|
408
|
+
o: void 0
|
|
409
|
+
});
|
|
410
|
+
return _el$19;
|
|
411
|
+
})(), (() => {
|
|
412
|
+
var _el$23 = _tmpl$1(), _el$24 = _el$23.firstChild, _el$25 = _el$24.firstChild, _el$31 = _el$24.nextSibling, _el$32 = _el$31.firstChild, _el$33 = _el$32.firstChild, _el$35 = _el$33.nextSibling;
|
|
413
|
+
_el$35.nextSibling;
|
|
414
|
+
var _el$36 = _el$32.nextSibling;
|
|
415
|
+
_el$25.addEventListener("change", (e) => setStepMode(e.currentTarget.value));
|
|
416
|
+
insert(_el$24, createComponent(Show, {
|
|
417
|
+
get when() {
|
|
418
|
+
return stepMode() === "time";
|
|
419
|
+
},
|
|
420
|
+
get children() {
|
|
421
|
+
var _el$26 = _tmpl$8();
|
|
422
|
+
_el$26.addEventListener("change", (e) => {
|
|
423
|
+
const unit = e.currentTarget.value;
|
|
424
|
+
setTimeUnit(unit);
|
|
425
|
+
const amounts = availableTimeAmounts()[unit];
|
|
426
|
+
if (amounts.length > 0 && !amounts.includes(timeAmount())) {
|
|
427
|
+
setTimeAmount(amounts[0]);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
insert(_el$26, createComponent(For, {
|
|
431
|
+
get each() {
|
|
432
|
+
return availableTimeUnits();
|
|
433
|
+
},
|
|
434
|
+
children: (opt) => (() => {
|
|
435
|
+
var _el$39 = _tmpl$13();
|
|
436
|
+
insert(_el$39, () => opt.unit);
|
|
437
|
+
createRenderEffect(() => _el$39.value = opt.unit);
|
|
438
|
+
return _el$39;
|
|
439
|
+
})()
|
|
440
|
+
}));
|
|
441
|
+
createRenderEffect(() => _el$26.value = timeUnit());
|
|
442
|
+
return _el$26;
|
|
443
|
+
}
|
|
444
|
+
}), null);
|
|
445
|
+
insert(_el$24, createComponent(Show, {
|
|
446
|
+
get when() {
|
|
447
|
+
return stepMode() === "entries";
|
|
448
|
+
},
|
|
449
|
+
get children() {
|
|
450
|
+
return [(() => {
|
|
451
|
+
var _el$27 = _tmpl$9();
|
|
452
|
+
_el$27.$$input = (e) => updateStepSizeFromSlider(parseInt(e.currentTarget.value, 10));
|
|
453
|
+
createRenderEffect(() => setAttribute(_el$27, "max", Math.max(0, availableStepSizes().length - 1)));
|
|
454
|
+
createRenderEffect(() => _el$27.value = stepSizeSliderIndex());
|
|
455
|
+
return _el$27;
|
|
456
|
+
})(), (() => {
|
|
457
|
+
var _el$28 = _tmpl$0();
|
|
458
|
+
insert(_el$28, stepSize);
|
|
459
|
+
return _el$28;
|
|
460
|
+
})()];
|
|
461
|
+
}
|
|
462
|
+
}), null);
|
|
463
|
+
insert(_el$24, createComponent(Show, {
|
|
464
|
+
get when() {
|
|
465
|
+
return memo(() => stepMode() === "time")() && currentTimeAmounts().length > 0;
|
|
466
|
+
},
|
|
467
|
+
get children() {
|
|
468
|
+
return [(() => {
|
|
469
|
+
var _el$29 = _tmpl$9();
|
|
470
|
+
_el$29.$$input = (e) => updateTimeAmountFromSlider(parseInt(e.currentTarget.value, 10));
|
|
471
|
+
createRenderEffect(() => setAttribute(_el$29, "max", Math.max(0, currentTimeAmounts().length - 1)));
|
|
472
|
+
createRenderEffect(() => _el$29.value = timeAmountSliderIndex());
|
|
473
|
+
return _el$29;
|
|
474
|
+
})(), (() => {
|
|
475
|
+
var _el$30 = _tmpl$0();
|
|
476
|
+
insert(_el$30, timeStepLabel);
|
|
477
|
+
return _el$30;
|
|
478
|
+
})()];
|
|
479
|
+
}
|
|
480
|
+
}), null);
|
|
481
|
+
insert(_el$32, () => currentIndex() + 1, _el$35);
|
|
482
|
+
insert(_el$32, totalEntries, null);
|
|
483
|
+
insert(_el$36, () => currentEntry()?.docTitle);
|
|
484
|
+
createRenderEffect(() => _el$25.value = stepMode());
|
|
485
|
+
return _el$23;
|
|
486
|
+
})()];
|
|
487
|
+
}
|
|
488
|
+
}));
|
|
489
|
+
return _el$;
|
|
490
|
+
})();
|
|
491
|
+
}
|
|
492
|
+
const renderNotebookViewer = (handle, element) => render(() => createComponent(NotebookViewer, {
|
|
493
|
+
handle,
|
|
494
|
+
get repo() {
|
|
495
|
+
return element.repo;
|
|
496
|
+
},
|
|
497
|
+
element
|
|
498
|
+
}), element);
|
|
499
|
+
delegateEvents(["click", "input"]);
|
|
500
|
+
export {
|
|
501
|
+
NotebookViewer,
|
|
502
|
+
renderNotebookViewer
|
|
503
|
+
};
|
|
504
|
+
//# sourceMappingURL=NotebookViewer-BkYJL6Jc.js.map
|