@alignable/bifrost 0.0.23 → 0.0.24
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/{chunk-UQXLIJWA.js → chunk-TUQ332K5.js} +6 -6
- package/dist/chunk-TUQ332K5.js.map +1 -0
- package/dist/proxy/pages/onRenderClient.js +12 -7
- package/dist/proxy/pages/onRenderClient.js.map +1 -1
- package/dist/proxy/pages/onRenderHtml.d.ts +5 -2
- package/dist/proxy/pages/onRenderHtml.js +8 -7
- package/dist/proxy/pages/onRenderHtml.js.map +1 -1
- package/dist/proxy/pages/restorationVisit/+config.d.ts +1 -6
- package/dist/proxy/pages/restorationVisit/+config.js +2 -9
- package/dist/proxy/pages/restorationVisit/+config.js.map +1 -1
- package/dist/proxy/pages/restorationVisit/onRenderClient.js +8 -7
- package/dist/proxy/pages/restorationVisit/onRenderClient.js.map +1 -1
- package/dist/renderer/onRenderClient.js +1 -1
- package/dist/renderer/onRenderHtml.d.ts +2 -2
- package/package.json +4 -7
- package/dist/chunk-UQXLIJWA.js.map +0 -1
- package/dist/proxy/pages/restorationVisit/onBeforeRender.d.ts +0 -3
- package/dist/proxy/pages/restorationVisit/onBeforeRender.js +0 -7
- package/dist/proxy/pages/restorationVisit/onBeforeRender.js.map +0 -1
|
@@ -686,8 +686,8 @@ var Controller = class {
|
|
|
686
686
|
this.started = false;
|
|
687
687
|
// Event handlers
|
|
688
688
|
this.clickCaptured = () => {
|
|
689
|
-
|
|
690
|
-
|
|
689
|
+
removeEventListener("click", this.clickBubbled, false);
|
|
690
|
+
addEventListener("click", this.clickBubbled, false);
|
|
691
691
|
};
|
|
692
692
|
this.clickBubbled = (event) => {
|
|
693
693
|
if (this.enabled && this.clickEventIsSignificant(event)) {
|
|
@@ -706,7 +706,7 @@ var Controller = class {
|
|
|
706
706
|
}
|
|
707
707
|
start() {
|
|
708
708
|
if (!this.started) {
|
|
709
|
-
|
|
709
|
+
addEventListener("click", this.clickCaptured, true);
|
|
710
710
|
this.location = Location.currentLocation;
|
|
711
711
|
this.restorationIdentifier = uuid();
|
|
712
712
|
this.lastRenderedLocation = this.location;
|
|
@@ -719,7 +719,7 @@ var Controller = class {
|
|
|
719
719
|
}
|
|
720
720
|
stop() {
|
|
721
721
|
if (this.started) {
|
|
722
|
-
|
|
722
|
+
removeEventListener("click", this.clickCaptured, true);
|
|
723
723
|
this.started = false;
|
|
724
724
|
}
|
|
725
725
|
}
|
|
@@ -758,7 +758,7 @@ var Controller = class {
|
|
|
758
758
|
return this.cache.get(Location.wrap(location).toCacheKey());
|
|
759
759
|
}
|
|
760
760
|
shouldCacheSnapshot() {
|
|
761
|
-
return document.
|
|
761
|
+
return document.querySelector("#proxied-body") && document.head.querySelector("meta[name='turbolinks-no-cache']")?.getAttribute("content") != "no-cache";
|
|
762
762
|
}
|
|
763
763
|
cacheSnapshot() {
|
|
764
764
|
if (this.shouldCacheSnapshot()) {
|
|
@@ -942,4 +942,4 @@ export {
|
|
|
942
942
|
copyElementAttributes,
|
|
943
943
|
Turbolinks
|
|
944
944
|
};
|
|
945
|
-
//# sourceMappingURL=chunk-
|
|
945
|
+
//# sourceMappingURL=chunk-TUQ332K5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../lib/renderReact.ts","../lib/turbolinks/util.ts","../lib/turbolinks/mergeHead.ts","../lib/turbolinks/lruCache.ts","../lib/turbolinks/progress_bar.ts","../lib/turbolinks/browser_adapter.ts","../lib/turbolinks/location.ts","../lib/turbolinks/types.ts","../lib/turbolinks/visit.ts","../lib/turbolinks/controller.ts","../lib/turbolinks/index.ts"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { Root, createRoot, hydrateRoot } from \"react-dom/client\";\n\nlet root: Root;\n\nexport function renderReact(page: ReactNode, isHydration: boolean) {\n const container = document.getElementById(\"page-view\")!;\n if (isHydration) {\n root = hydrateRoot(container, page);\n } else {\n if (!root) {\n root = createRoot(container);\n }\n root.render(page);\n }\n}\n","export function array<T>(values: ArrayLike<T>): T[] {\n return Array.prototype.slice.call(values);\n}\n\nexport const closest = (() => {\n const html = document.documentElement;\n\n type MatchesSelector = (this: Element, selector: string) => boolean;\n const match: MatchesSelector =\n html.matches ||\n (html as any).webkitMatchesSelector ||\n (html as any).msMatchesSelector ||\n (html as any).mozMatchesSelector;\n\n type Closest = (this: Element, selector: string) => Element | null;\n const closest: Closest =\n html.closest ||\n function (selector: string) {\n let element: Element | null = this;\n while (element) {\n if (match.call(element, selector)) {\n return element;\n } else {\n element = element.parentElement;\n }\n }\n };\n\n return function (element: Element, selector: string) {\n return closest.call(element, selector);\n };\n})();\n\nexport function defer(callback: () => any) {\n setTimeout(callback, 1);\n}\n\nexport type DispatchOptions = {\n target: EventTarget;\n cancelable: boolean;\n data: any;\n};\n\nexport function dispatch(\n eventName: string,\n { target, cancelable, data }: Partial<DispatchOptions> = {}\n) {\n const event = document.createEvent(\"Events\") as Event & { data: any };\n event.initEvent(eventName, true, cancelable == true);\n event.data = data || {};\n\n // Fix setting `defaultPrevented` when `preventDefault()` is called\n // http://stackoverflow.com/questions/23349191/event-preventdefault-is-not-working-in-ie-11-for-custom-events\n if (event.cancelable && !preventDefaultSupported) {\n const { preventDefault } = event;\n event.preventDefault = function () {\n if (!this.defaultPrevented) {\n Object.defineProperty(this, \"defaultPrevented\", { get: () => true });\n }\n preventDefault.call(this);\n };\n }\n\n (target || document).dispatchEvent(event);\n return event;\n}\n\nconst preventDefaultSupported = (() => {\n const event = document.createEvent(\"Events\");\n event.initEvent(\"test\", true, true);\n event.preventDefault();\n return event.defaultPrevented;\n})();\n\nexport function unindent(\n strings: TemplateStringsArray,\n ...values: any[]\n): string {\n const lines = trimLeft(interpolate(strings, values)).split(\"\\n\");\n const match = lines[0].match(/^\\s+/);\n const indent = match ? match[0].length : 0;\n return lines.map((line) => line.slice(indent)).join(\"\\n\");\n}\n\nfunction trimLeft(string: string) {\n return string.replace(/^\\n/, \"\");\n}\n\nfunction interpolate(strings: TemplateStringsArray, values: any[]) {\n return strings.reduce((result, string, i) => {\n const value = values[i] == undefined ? \"\" : values[i];\n return result + string + value;\n }, \"\");\n}\n\nexport function uuid() {\n return Array.apply(null, { length: 36 } as any)\n .map((_, i) => {\n if (i == 8 || i == 13 || i == 18 || i == 23) {\n return \"-\";\n } else if (i == 14) {\n return \"4\";\n } else if (i == 19) {\n return (Math.floor(Math.random() * 4) + 8).toString(16);\n } else {\n return Math.floor(Math.random() * 15).toString(16);\n }\n })\n .join(\"\");\n}\n\nexport function createScriptElement(element: Element, cb?: () => void) {\n if (element.getAttribute(\"data-turbolinks-eval\") == \"false\") {\n return element;\n } else {\n const createdScriptElement = document.createElement(\"script\");\n createdScriptElement.textContent = element.textContent;\n // async false makes scripts run in-order. it wont block js execution (thankfully)\n // https://github.com/turbolinks/turbolinks/issues/282#issuecomment-355731712\n createdScriptElement.async = false;\n copyElementAttributes(createdScriptElement, element);\n if (cb) {\n createdScriptElement.addEventListener(\"load\", cb);\n }\n return createdScriptElement;\n }\n}\n\nexport function copyElementAttributes(\n destinationElement: Element,\n sourceElement: Element\n) {\n for (const { name, value } of array(sourceElement.attributes)) {\n destinationElement.setAttribute(name, value);\n }\n}\n\nfunction replaceElementWithElement(fromElement: Element, toElement: Element) {\n const parentElement = fromElement.parentElement;\n if (parentElement) {\n return parentElement.replaceChild(toElement, fromElement);\n }\n}\nexport function activateNewBodyScriptElements(\n newScriptElements: HTMLScriptElement[]\n) {\n for (const inertScriptElement of newScriptElements) {\n const activatedScriptElement = createScriptElement(inertScriptElement);\n replaceElementWithElement(inertScriptElement, activatedScriptElement);\n }\n}\n\nexport function focusFirstAutofocusableElement() {\n const element = document.body.querySelector(\"[autofocus]\");\n if (element && \"focus\" in element && typeof element.focus === \"function\") {\n element.focus();\n }\n}\n","import { createScriptElement } from \"./util\";\n\ninterface ElementDetails {\n tracked: boolean;\n}\nconst allHeadScriptsEverRun: { [outerHTML: string]: ElementDetails } = {};\nlet firstLoad = true;\nlet lastTrackedScriptSignature: string;\n\nexport async function mergeHead(\n head: HTMLHeadElement,\n trackScripts: boolean,\n reload: () => void\n) {\n const newHead = categorizeHead(head);\n const oldHead = categorizeHead(document.head);\n\n if (\n head\n .querySelector('meta[name=\"turbolinks-visit-control\"]')\n ?.getAttribute(\"content\") === \"reload\"\n ) {\n reload();\n }\n if (trackScripts) {\n lastTrackedScriptSignature =\n lastTrackedScriptSignature ||\n trackedElementSignature([...oldHead.scripts, ...oldHead.stylesheets]);\n if (\n lastTrackedScriptSignature !==\n trackedElementSignature([...newHead.scripts, ...newHead.stylesheets])\n ) {\n reload();\n }\n }\n\n if (firstLoad) {\n // TODO: messy code\n for (const element of oldHead.scripts) {\n allHeadScriptsEverRun[element.outerHTML] = {\n tracked: elementIsTracked(element),\n };\n }\n firstLoad = false;\n }\n\n copyNewHeadStylesheetElements(newHead.stylesheets, oldHead.stylesheets);\n removeCurrentHeadProvisionalElements(oldHead.provisional);\n copyNewHeadProvisionalElements(newHead.provisional);\n\n return new Promise<void>((resolve) => {\n copyNewHeadScriptElements(newHead.scripts, resolve);\n });\n}\n\nfunction trackedElementSignature(scripts: Element[]) {\n return scripts\n .filter(elementIsTracked)\n .map((s) => s.outerHTML)\n .join();\n}\n\nfunction copyNewHeadStylesheetElements(next: Element[], prev: Element[]) {\n const existing = prev.map((s) => s.outerHTML);\n for (const element of next) {\n if (!existing.includes(element.outerHTML)) {\n document.head.appendChild(element);\n }\n }\n}\n\nfunction copyNewHeadScriptElements(\n next: Element[],\n onScriptsLoaded: () => void\n) {\n let blockingLoaded: boolean[] = [];\n function dispatch() {\n onScriptsLoaded();\n }\n for (const element of next as HTMLScriptElement[]) {\n const runBefore = element.outerHTML in allHeadScriptsEverRun;\n if (!runBefore) {\n let cb;\n if (!element.defer && element.src) {\n const idx = blockingLoaded.length;\n cb = () => {\n blockingLoaded[idx] = true;\n if (blockingLoaded.every((v) => v)) {\n dispatch();\n }\n };\n blockingLoaded.push(false);\n }\n document.head.appendChild(createScriptElement(element, cb));\n allHeadScriptsEverRun[element.outerHTML] = {\n tracked: elementIsTracked(element),\n };\n }\n }\n if (blockingLoaded.length === 0) {\n // raf waits for react to finish\n requestAnimationFrame(dispatch);\n }\n}\n\nfunction removeCurrentHeadProvisionalElements(prev: Element[]) {\n for (const element of prev) {\n document.head.removeChild(element);\n }\n}\n\nfunction copyNewHeadProvisionalElements(next: Element[]) {\n for (const element of next) {\n document.head.appendChild(element);\n }\n}\n\nfunction elementIsTracked(element: Element) {\n return element.getAttribute(\"data-turbolinks-track\") == \"reload\";\n}\n\nfunction elementIsScript(element: Element) {\n const tagName = element.tagName.toLowerCase();\n return tagName == \"script\";\n}\n\nfunction elementIsStylesheet(element: Element) {\n const tagName = element.tagName.toLowerCase();\n return (\n tagName == \"style\" ||\n (tagName == \"link\" && element.getAttribute(\"rel\") == \"stylesheet\")\n );\n}\n\nfunction elementIsFavicon(element: Element) {\n const tagName = element.tagName.toLowerCase();\n\n return tagName == \"link\" && element.getAttribute(\"rel\") == \"icon\";\n}\n\nfunction categorizeHead(head: ParentNode) {\n const scripts = [];\n const stylesheets = [];\n const provisional = [];\n for (const element of head.children) {\n // we want to keep the same favicon on page transitions\n if (elementIsFavicon(element)) {\n continue;\n }\n\n if (elementIsScript(element)) {\n scripts.push(element);\n } else if (elementIsStylesheet(element)) {\n stylesheets.push(element);\n } else {\n provisional.push(element);\n }\n }\n return { scripts, stylesheets, provisional };\n}\n","export class LruCache<T> {\n private values: Map<string, T> = new Map<string, T>();\n private maxEntries;\n\n constructor(maxEntries: number) {\n this.maxEntries = maxEntries;\n }\n\n public get(key: string): T | undefined {\n const hasKey = this.values.has(key);\n let entry: T | undefined;\n if (hasKey) {\n // peek the entry, re-insert for LRU strategy\n entry = this.values.get(key)!;\n this.values.delete(key);\n this.values.set(key, entry);\n }\n\n return entry;\n }\n\n public put(key: string, value: T) {\n if (this.values.size >= this.maxEntries) {\n // least-recently used cache eviction strategy\n const keyToDelete = this.values.keys().next().value;\n\n this.values.delete(keyToDelete);\n }\n\n this.values.set(key, value);\n }\n}\n","import { unindent } from \"./util\";\n\nexport class ProgressBar {\n static animationDuration = 300; /*ms*/\n\n static get defaultCSS() {\n return unindent`\n .turbolinks-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 9999;\n transition:\n width ${ProgressBar.animationDuration}ms ease-out,\n opacity ${ProgressBar.animationDuration / 2}ms ${\n ProgressBar.animationDuration / 2\n }ms ease-in;\n transform: translate3d(0, 0, 0);\n }\n `;\n }\n\n readonly stylesheetElement = this.createStylesheetElement();\n readonly progressElement = this.createProgressElement();\n\n hiding = false;\n trickleInterval?: number;\n value = 0;\n visible = false;\n\n show() {\n if (!this.visible) {\n this.visible = true;\n this.installStylesheetElement();\n this.installProgressElement();\n this.startTrickling();\n }\n }\n\n hide() {\n if (this.visible && !this.hiding) {\n this.hiding = true;\n this.fadeProgressElement(() => {\n this.uninstallProgressElement();\n this.stopTrickling();\n this.visible = false;\n this.hiding = false;\n });\n }\n }\n\n setValue(value: number) {\n this.value = value;\n this.refresh();\n }\n\n // Private\n\n installStylesheetElement() {\n document.head.insertBefore(\n this.stylesheetElement,\n document.head.firstChild\n );\n }\n\n installProgressElement() {\n this.progressElement.style.width = \"0\";\n this.progressElement.style.opacity = \"1\";\n document.documentElement.insertBefore(this.progressElement, document.body);\n this.refresh();\n }\n\n fadeProgressElement(callback: () => void) {\n this.progressElement.style.opacity = \"0\";\n setTimeout(callback, ProgressBar.animationDuration * 1.5);\n }\n\n uninstallProgressElement() {\n if (this.progressElement.parentNode) {\n document.documentElement.removeChild(this.progressElement);\n }\n }\n\n startTrickling() {\n if (!this.trickleInterval) {\n this.trickleInterval = window.setInterval(\n this.trickle,\n ProgressBar.animationDuration\n );\n }\n }\n\n stopTrickling() {\n window.clearInterval(this.trickleInterval);\n delete this.trickleInterval;\n }\n\n trickle = () => {\n this.setValue(this.value + Math.random() / 100);\n };\n\n refresh() {\n requestAnimationFrame(() => {\n this.progressElement.style.width = `${10 + this.value * 90}%`;\n });\n }\n\n createStylesheetElement() {\n const element = document.createElement(\"style\");\n element.type = \"text/css\";\n element.textContent = ProgressBar.defaultCSS;\n return element;\n }\n\n createProgressElement() {\n const element = document.createElement(\"div\");\n element.className = \"turbolinks-progress-bar\";\n return element;\n }\n}\n","import { Adapter } from \"./adapter\";\nimport { Controller } from \"./controller\";\nimport { Locatable } from \"./location\";\nimport { ProgressBar } from \"./progress_bar\";\nimport { Action } from \"./types\";\nimport { Visit } from \"./visit\";\n\nexport class BrowserAdapter implements Adapter {\n readonly controller: Controller;\n readonly progressBar = new ProgressBar();\n\n progressBarTimeout?: number;\n\n constructor(controller: Controller) {\n this.controller = controller;\n }\n\n visitProposedToLocationWithAction(location: Locatable, action: Action) {\n this.controller.startVisitToLocationWithAction(\n location,\n action,\n );\n }\n\n visitStarted(visit: Visit) {\n visit.issueRequest();\n visit.changeHistory();\n visit.loadCachedSnapshot();\n }\n\n visitRequestStarted(visit: Visit) {\n this.progressBar.setValue(0);\n if (visit.hasCachedSnapshot() || visit.action != \"restore\") {\n this.showProgressBarAfterDelay();\n } else {\n this.showProgressBar();\n }\n }\n\n visitRequestProgressed(visit: Visit) {\n this.progressBar.setValue(visit.progress);\n }\n\n visitRequestCompleted(visit: Visit) {\n visit.loadResponse();\n }\n\n visitRequestFailedWithStatusCode(visit: Visit, statusCode: number) {\n switch (statusCode) {\n // TODO\n // case SystemStatusCode.networkFailure:\n // case SystemStatusCode.timeoutFailure:\n // case SystemStatusCode.contentTypeMismatch:\n // return this.reload()\n default:\n return visit.loadResponse();\n }\n }\n\n visitRequestFinished(visit: Visit) {\n this.hideProgressBar();\n }\n\n visitCompleted(visit: Visit) {\n }\n\n pageInvalidated() {\n this.reload();\n }\n\n visitFailed(visit: Visit) {}\n\n visitRendered(visit: Visit) {}\n\n // Private\n\n showProgressBarAfterDelay() {\n this.progressBarTimeout = window.setTimeout(\n this.showProgressBar,\n this.controller.progressBarDelay\n );\n }\n\n showProgressBar = () => {\n this.progressBar.show();\n };\n\n hideProgressBar() {\n this.progressBar.hide();\n if (this.progressBarTimeout != null) {\n window.clearTimeout(this.progressBarTimeout);\n delete this.progressBarTimeout;\n }\n }\n\n reload() {\n window.location.reload();\n }\n}\n","export type Locatable = Location | string;\n\nexport class Location {\n static get currentLocation() {\n return this.wrap(window.location.toString());\n }\n\n static wrap(locatable: Locatable): Location;\n static wrap(locatable?: Locatable | null): Location | undefined;\n static wrap(locatable: Locatable) {\n if (typeof locatable == \"string\") {\n return new this(locatable);\n } else if (locatable != null) {\n return locatable;\n }\n }\n\n readonly absoluteURL: string;\n readonly requestURL: string;\n readonly anchor?: string;\n\n constructor(url: string) {\n const linkWithAnchor = document.createElement(\"a\");\n linkWithAnchor.href = url;\n\n this.absoluteURL = linkWithAnchor.href;\n\n const anchorLength = linkWithAnchor.hash.length;\n if (anchorLength < 2) {\n this.requestURL = this.absoluteURL;\n } else {\n this.requestURL = this.absoluteURL.slice(0, -anchorLength);\n this.anchor = linkWithAnchor.hash.slice(1);\n }\n }\n\n getOrigin() {\n return this.absoluteURL.split(\"/\", 3).join(\"/\");\n }\n\n getPath() {\n return (this.requestURL.match(/\\/\\/[^/]*(\\/[^?;]*)/) || [])[1] || \"/\";\n }\n\n getPathComponents() {\n return this.getPath().split(\"/\").slice(1);\n }\n\n getLastPathComponent() {\n return this.getPathComponents().slice(-1)[0];\n }\n\n getExtension() {\n return (this.getLastPathComponent().match(/\\.[^.]*$/) || [])[0] || \"\";\n }\n\n isHTML() {\n return this.getExtension().match(/^(?:|\\.(?:htm|html|xhtml))$/);\n }\n\n isPrefixedBy(location: Location): boolean {\n const prefixURL = getPrefixURL(location);\n return (\n this.isEqualTo(location) || stringStartsWith(this.absoluteURL, prefixURL)\n );\n }\n\n isEqualTo(location?: Location) {\n return location && this.absoluteURL === location.absoluteURL;\n }\n\n toCacheKey() {\n return this.requestURL;\n }\n\n toJSON() {\n return this.absoluteURL;\n }\n\n toString() {\n return this.absoluteURL;\n }\n\n valueOf() {\n return this.absoluteURL;\n }\n}\n\nfunction getPrefixURL(location: Location) {\n return addTrailingSlash(location.getOrigin() + location.getPath());\n}\n\nfunction addTrailingSlash(url: string) {\n return stringEndsWith(url, \"/\") ? url : url + \"/\";\n}\n\nfunction stringStartsWith(string: string, prefix: string) {\n return string.slice(0, prefix.length) === prefix;\n}\n\nfunction stringEndsWith(string: string, suffix: string) {\n return string.slice(-suffix.length) === suffix;\n}\n","export type Action = \"advance\" | \"replace\" | \"restore\";\n\nexport function isAction(action: any): action is Action {\n return action == \"advance\" || action == \"replace\" || action == \"restore\";\n}\n\nexport type Position = { x: number; y: number };\n","import { navigate } from \"vite-plugin-ssr/client/router\";\nimport { Adapter } from \"./adapter\";\nimport { Controller } from \"./controller.js\";\nimport { Location } from \"./location\";\nimport { Action } from \"./types\";\nimport { uuid } from \"./util\";\n\nexport enum TimingMetric {\n visitStart = \"visitStart\",\n requestStart = \"requestStart\",\n requestEnd = \"requestEnd\",\n visitEnd = \"visitEnd\",\n}\n\nexport type TimingMetrics = Partial<{ [metric in TimingMetric]: any }>;\n\nexport enum VisitState {\n initialized = \"initialized\",\n started = \"started\",\n canceled = \"canceled\",\n failed = \"failed\",\n completed = \"completed\",\n}\n\nexport class Visit {\n readonly controller: Controller;\n readonly action: Action;\n readonly adapter: Adapter;\n readonly identifier = uuid();\n readonly restorationIdentifier: string;\n readonly timingMetrics: TimingMetrics = {};\n\n frame?: number;\n location: Location;\n progress = 0;\n referrer?: Location;\n redirectedToLocation?: Location;\n snapshotCached = false;\n state = VisitState.initialized;\n\n requestInFlight = false;\n renderFn?: () => Promise<void>;\n\n constructor(\n controller: Controller,\n location: Location,\n action: Action,\n restorationIdentifier: string = uuid()\n ) {\n this.controller = controller;\n this.location = location;\n this.action = action;\n this.adapter = controller.adapter;\n this.restorationIdentifier = restorationIdentifier;\n }\n\n start() {\n if (this.state == VisitState.initialized) {\n this.recordTimingMetric(TimingMetric.visitStart);\n this.state = VisitState.started;\n this.adapter.visitStarted(this);\n }\n }\n\n cancel() {\n if (this.state == VisitState.started) {\n this.requestInFlight = false;\n this.cancelRender();\n this.state = VisitState.canceled;\n }\n }\n\n complete() {\n if (this.state == VisitState.started) {\n this.recordTimingMetric(TimingMetric.visitEnd);\n this.state = VisitState.completed;\n this.adapter.visitCompleted(this);\n this.controller.visitCompleted(this);\n }\n }\n\n fail() {\n if (this.state == VisitState.started) {\n this.state = VisitState.failed;\n this.adapter.visitFailed(this);\n }\n }\n\n changeHistory() {\n // no-op since issueRequest calls navigate which handles all of this already\n return;\n }\n\n issueRequest() {\n if (!this.requestInFlight) {\n if (this.shouldIssueRequest()) {\n const url = new URL(\n this.location.toString(),\n this.location.getOrigin()\n );\n navigate(url.pathname + url.hash + url.search, {\n overwriteLastHistoryEntry: this.action === \"replace\",\n }).catch(console.error);\n this.progress = 0;\n this.requestInFlight = true;\n }\n }\n }\n\n getCachedSnapshot() {\n const snapshot = this.controller.getCachedSnapshotForLocation(\n this.location\n );\n if (snapshot) {\n if (this.action == \"restore\") {\n return snapshot;\n }\n }\n }\n\n hasCachedSnapshot() {\n return this.getCachedSnapshot() != null;\n }\n\n loadCachedSnapshot() {\n // no-op since issueRequest calls navigate which handles all of this already\n return;\n }\n\n loadResponse() {\n this.render(async () => {\n if (!this.renderFn)\n throw new Error(\"Render details not set before rendering\");\n this.cacheSnapshot();\n await this.renderFn();\n this.complete();\n });\n }\n\n // HTTP request delegate\n\n /*\n requestStarted() {\n this.recordTimingMetric(TimingMetric.requestStart);\n this.adapter.visitRequestStarted(this);\n }\n\n requestProgressed(progress: number) {\n this.progress = progress;\n if (this.adapter.visitRequestProgressed) {\n this.adapter.visitRequestProgressed(this);\n }\n }\n\n requestCompletedWithResponse(\n response: string,\n redirectedToLocation?: Location\n ) {\n this.response = response;\n this.redirectedToLocation = redirectedToLocation;\n this.adapter.visitRequestCompleted(this);\n }\n\n requestFailedWithStatusCode(statusCode: number, response?: string) {\n this.response = response;\n this.adapter.visitRequestFailedWithStatusCode(this, statusCode);\n }\n\n requestFinished() {\n this.recordTimingMetric(TimingMetric.requestEnd);\n this.adapter.visitRequestFinished(this);\n }\n */\n\n // Instrumentation\n\n recordTimingMetric(metric: TimingMetric) {\n this.timingMetrics[metric] = new Date().getTime();\n }\n\n getTimingMetrics(): TimingMetrics {\n return { ...this.timingMetrics };\n }\n\n // Private\n\n shouldIssueRequest() {\n return this.action == \"restore\" ? !this.hasCachedSnapshot() : true;\n }\n\n cacheSnapshot() {\n if (!this.snapshotCached) {\n this.controller.cacheSnapshot();\n this.snapshotCached = true;\n }\n }\n\n render(callback: () => Promise<void>) {\n this.cancelRender();\n this.frame = requestAnimationFrame(() => {\n delete this.frame;\n callback.call(this);\n });\n }\n\n cancelRender() {\n if (this.frame) {\n cancelAnimationFrame(this.frame);\n delete this.frame;\n }\n }\n}\n","import { LruCache } from \"./lruCache\";\nimport { Adapter } from \"./adapter\";\nimport { BrowserAdapter } from \"./browser_adapter\";\nimport { Location, Locatable } from \"./location\";\nimport { Action, isAction } from \"./types\";\nimport { closest, defer, dispatch, uuid } from \"./util\";\nimport { Visit } from \"./visit\";\n\nexport type TimingData = {};\nexport type VisitOptions = { action: Action };\n\nexport interface Snapshot {\n bodyEl: Element;\n headEl: HTMLHeadElement;\n pageContext: any;\n}\n\nexport class Controller {\n adapter: Adapter = new BrowserAdapter(this);\n\n cache = new LruCache<Snapshot>(10);\n currentVisit?: Visit;\n enabled = true;\n lastRenderedLocation?: Location;\n location!: Location;\n progressBarDelay = 500;\n restorationIdentifier!: string; // This only exists for compatibility with iOS\n started = false;\n pageContext: any;\n\n start() {\n if (!this.started) {\n addEventListener(\"click\", this.clickCaptured, true);\n this.location = Location.currentLocation;\n this.restorationIdentifier = uuid();\n this.lastRenderedLocation = this.location;\n this.started = true;\n this.enabled = true;\n }\n }\n\n disable() {\n this.enabled = false;\n }\n\n stop() {\n if (this.started) {\n removeEventListener(\"click\", this.clickCaptured, true);\n this.started = false;\n }\n }\n\n clearCache() {\n this.cache = new LruCache(10);\n }\n\n visit(location: Locatable, options: Partial<VisitOptions> = {}) {\n location = Location.wrap(location);\n if (this.applicationAllowsVisitingLocation(location)) {\n if (this.locationIsVisitable(location)) {\n const action = options.action || \"advance\";\n this.adapter.visitProposedToLocationWithAction(location, action);\n } else {\n window.location.href = location.toString();\n }\n }\n }\n\n startVisitToLocationWithAction(\n location: Locatable,\n action: Action,\n restorationIdentifier?: string\n ) {\n this.startVisit(Location.wrap(location), action);\n }\n\n setProgressBarDelay(delay: number) {\n this.progressBarDelay = delay;\n }\n\n // History delegate\n\n historyPoppedToLocationWithRestorationIdentifier(\n location: Locatable,\n restorationIdentifier: string\n ) {\n if (this.enabled) {\n this.location = Location.wrap(location);\n this.restorationIdentifier = restorationIdentifier;\n this.startVisit(this.location, \"restore\");\n } else {\n this.adapter.pageInvalidated();\n }\n }\n\n // Snapshot cache\n\n getCachedSnapshotForLocation(location: Locatable) {\n return this.cache.get(Location.wrap(location).toCacheKey());\n }\n\n shouldCacheSnapshot() {\n return (\n document.querySelector(\"#proxied-body\") &&\n document.head\n .querySelector(\"meta[name='turbolinks-no-cache']\")\n ?.getAttribute(\"content\") != \"no-cache\"\n );\n }\n\n cacheSnapshot() {\n if (this.shouldCacheSnapshot()) {\n this.notifyApplicationBeforeCachingSnapshot();\n const snapshot = {\n bodyEl: document.body.cloneNode(true),\n headEl: document.head.cloneNode(true),\n pageContext: this.pageContext,\n };\n const location = this.lastRenderedLocation || Location.currentLocation;\n defer(() => this.cache.put(location.toCacheKey(), snapshot));\n }\n }\n\n // View\n viewInvalidated() {\n this.adapter.pageInvalidated();\n }\n\n viewWillRender() {\n this.notifyApplicationBeforeRender();\n }\n\n viewRendered() {\n this.lastRenderedLocation = this.currentVisit!.location;\n this.notifyApplicationAfterRender();\n }\n\n // Event handlers\n\n clickCaptured = () => {\n removeEventListener(\"click\", this.clickBubbled, false);\n addEventListener(\"click\", this.clickBubbled, false);\n };\n\n clickBubbled = (event: MouseEvent) => {\n if (this.enabled && this.clickEventIsSignificant(event)) {\n const link = this.getVisitableLinkForTarget(event.target);\n if (link) {\n const location = this.getVisitableLocationForLink(link);\n if (\n location &&\n this.applicationAllowsFollowingLinkToLocation(link, location)\n ) {\n event.preventDefault();\n event.stopPropagation();\n const action = this.getActionForLink(link);\n this.visit(location, { action });\n }\n }\n }\n };\n\n // Application events\n\n applicationAllowsFollowingLinkToLocation(link: Element, location: Location) {\n const event = this.notifyApplicationAfterClickingLinkToLocation(\n link,\n location\n );\n return !event.defaultPrevented;\n }\n\n applicationAllowsVisitingLocation(location: Location) {\n const event = this.notifyApplicationBeforeVisitingLocation(location);\n return !event.defaultPrevented;\n }\n\n notifyApplicationAfterClickingLinkToLocation(\n link: Element,\n location: Location\n ) {\n return dispatch(\"turbolinks:click\", {\n target: link,\n data: { url: location.absoluteURL },\n cancelable: true,\n });\n }\n\n notifyApplicationBeforeVisitingLocation(location: Location) {\n return dispatch(\"turbolinks:before-visit\", {\n data: { url: location.absoluteURL },\n cancelable: true,\n });\n }\n\n notifyApplicationAfterVisitingLocation(location: Location) {\n return dispatch(\"turbolinks:visit\", {\n data: { url: location.absoluteURL },\n });\n }\n\n notifyApplicationBeforeCachingSnapshot() {\n return dispatch(\"turbolinks:before-cache\");\n }\n\n notifyApplicationBeforeRender() {\n return dispatch(\"turbolinks:before-render\");\n }\n\n notifyApplicationAfterRender() {\n return dispatch(\"turbolinks:render\");\n }\n\n notifyApplicationAfterPageLoad(timing: TimingData = {}) {\n return dispatch(\"turbolinks:load\", {\n data: { url: this.location.absoluteURL, timing },\n });\n }\n\n // Private\n\n startVisit(location: Location, action: Action) {\n if (this.currentVisit) {\n this.currentVisit.cancel();\n }\n this.currentVisit = this.createVisit(location, action);\n this.currentVisit.start();\n this.notifyApplicationAfterVisitingLocation(location);\n }\n\n createVisit(location: Location, action: Action): Visit {\n const visit = new Visit(this, location, action);\n visit.referrer = this.location;\n if (action === \"restore\") {\n // dont issue navigate() because VPS already did.\n visit.requestInFlight = true;\n }\n return visit;\n }\n\n visitCompleted(visit: Visit) {\n this.notifyApplicationAfterPageLoad(visit.getTimingMetrics());\n }\n\n clickEventIsSignificant(event: MouseEvent) {\n return !(\n (event.target && (event.target as any).isContentEditable) ||\n event.defaultPrevented ||\n event.which > 1 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n );\n }\n\n getVisitableLinkForTarget(target: EventTarget | null) {\n if (target instanceof Element && this.elementIsVisitable(target)) {\n return closest(target, \"a[href]:not([target]):not([download])\");\n }\n }\n\n getVisitableLocationForLink(link: Element) {\n const location = new Location(link.getAttribute(\"href\") || \"\");\n if (this.locationIsVisitable(location)) {\n return location;\n }\n }\n\n getActionForLink(link: Element): Action {\n const action = link.getAttribute(\"data-turbolinks-action\");\n return isAction(action) ? action : \"advance\";\n }\n\n elementIsVisitable(element: Element) {\n const container = closest(element, \"[data-turbolinks]\");\n if (container) {\n return container.getAttribute(\"data-turbolinks\") != \"false\";\n } else {\n return true;\n }\n }\n\n locationIsVisitable(location: Location) {\n return location.isPrefixedBy(new Location(\"/\")) && location.isHTML();\n }\n}\n","import { mergeHead } from \"./mergeHead\";\nimport { Controller, VisitOptions } from \"./controller\";\nimport { Locatable } from \"./location\";\nimport {\n activateNewBodyScriptElements,\n focusFirstAutofocusableElement,\n} from \"./util\";\n\nconst controller = new Controller();\n\nexport const Turbolinks = {\n get supported() {\n return true;\n },\n\n controller,\n\n visit(location: Locatable, options?: Partial<VisitOptions>) {\n controller.visit(location, options);\n },\n\n clearCache() {\n controller.clearCache();\n },\n\n setProgressBarDelay(delay: number) {\n controller.setProgressBarDelay(delay);\n },\n\n start() {\n // because this runs after ios hooks, we have to recover. See onRenderHtml\n if (\n window.Turbolinks !== Turbolinks &&\n window.Turbolinks.controller.adapter\n ) {\n (window.Turbolinks.controller.adapter as any).controller = controller;\n controller.adapter = window.Turbolinks.controller.adapter;\n }\n // Tells vite-plugin-ssr not to do link interception\n (window as any)._disableAutomaticLinkInterception = true;\n window.Turbolinks = Turbolinks;\n controller.start();\n },\n\n _vpsCachePageContext(pageContext: any) {\n controller.pageContext = pageContext;\n },\n\n _vpsOnRenderClient(\n newHead: HTMLHeadElement,\n trackScripts: boolean,\n executeBodyScripts: boolean,\n renderBody: () => void\n ) {\n if (controller.currentVisit) {\n const { currentVisit } = controller;\n // TODO: move to controller?\n currentVisit.renderFn = async () => {\n const scriptsLoaded = mergeHead(newHead, trackScripts, () =>\n controller.viewInvalidated()\n );\n\n controller.viewWillRender();\n renderBody();\n await scriptsLoaded;\n\n if (executeBodyScripts) {\n activateNewBodyScriptElements(\n Array.from(document.body.querySelectorAll(\"script\"))\n );\n }\n focusFirstAutofocusableElement();\n\n controller.viewRendered();\n controller.adapter.visitRendered(currentVisit);\n };\n\n controller.adapter.visitRequestCompleted(controller.currentVisit);\n controller.adapter.visitRequestFinished(controller.currentVisit);\n } else {\n console.error(\n \"controller.currentVisit should exist when onRenderClient fires\"\n );\n }\n },\n};\n\nexport type Turbolinks = typeof Turbolinks;\n"],"mappings":";AACA,SAAe,YAAY,mBAAmB;AAE9C,IAAI;AAEG,SAAS,YAAY,MAAiB,aAAsB;AACjE,QAAM,YAAY,SAAS,eAAe,WAAW;AACrD,MAAI,aAAa;AACf,WAAO,YAAY,WAAW,IAAI;AAAA,EACpC,OAAO;AACL,QAAI,CAAC,MAAM;AACT,aAAO,WAAW,SAAS;AAAA,IAC7B;AACA,SAAK,OAAO,IAAI;AAAA,EAClB;AACF;;;ACfO,SAAS,MAAS,QAA2B;AAClD,SAAO,MAAM,UAAU,MAAM,KAAK,MAAM;AAC1C;AAEO,IAAM,WAAW,MAAM;AAC5B,QAAM,OAAO,SAAS;AAGtB,QAAM,QACJ,KAAK,WACJ,KAAa,yBACb,KAAa,qBACb,KAAa;AAGhB,QAAMA,WACJ,KAAK,WACL,SAAU,UAAkB;AAC1B,QAAI,UAA0B;AAC9B,WAAO,SAAS;AACd,UAAI,MAAM,KAA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C3B;AAAA,EAEA,mBACE,SACA,cACA,oBACA,YACA;AACA,QAAI,WAAW,cAAc;AAC3B,YAAM,EAAE,aAAa,IAAI;AAEzB,mBAAa,WAAW,YAAY;AAClC,cAAM,gBAAgB;AAAA,UAAU;AAAA,UAAS;AAAA,UAAc,MACrD,WAAW,gBAAgB;AAAA,QAC7B;AAEA,mBAAW,eAAe;AAC1B,mBAAW;AACX,cAAM;AAEN,YAAI,oBAAoB;AACtB;AAAA,YACE,MAAM,KAAK,SAAS,KAAK,iBAAiB,QAAQ,CAAC;AAAA,UACrD;AAAA,QACF;AACA,uCAA+B;AAE/B,mBAAW,aAAa;AACxB,mBAAW,QAAQ,cAAc,YAAY;AAAA,MAC/C;AAEA,iBAAW,QAAQ,sBAAsB,WAAW,YAAY;AAChE,iBAAW,QAAQ,qBAAqB,WAAW,YAAY;AAAA,IACjE,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["closest","dispatch","controller","controller"]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
Turbolinks,
|
|
6
6
|
copyElementAttributes,
|
|
7
7
|
renderReact
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-TUQ332K5.js";
|
|
9
9
|
import {
|
|
10
10
|
PageShell
|
|
11
11
|
} from "../../chunk-4DL7N7Y5.js";
|
|
@@ -15,6 +15,7 @@ import "../../chunk-EYYCKU6F.js";
|
|
|
15
15
|
// proxy/pages/onRenderClient.tsx
|
|
16
16
|
import React from "react";
|
|
17
17
|
Turbolinks.start();
|
|
18
|
+
var PassthruLayout = ({ children }) => /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
18
19
|
async function onRenderClient(pageContext) {
|
|
19
20
|
if (pageContext.redirectTo) {
|
|
20
21
|
Turbolinks.visit(pageContext.redirectTo);
|
|
@@ -25,7 +26,7 @@ async function onRenderClient(pageContext) {
|
|
|
25
26
|
if (!layoutMap) {
|
|
26
27
|
throw new Error("layoutMap needs to be defined in config");
|
|
27
28
|
}
|
|
28
|
-
const Layout = layoutMap[layout];
|
|
29
|
+
const Layout = layoutMap[layout] || PassthruLayout;
|
|
29
30
|
function render(body) {
|
|
30
31
|
renderReact(
|
|
31
32
|
/* @__PURE__ */ React.createElement(PageShell, { key: pageContext.urlOriginal, pageContext }, /* @__PURE__ */ React.createElement(Layout, { ...layoutProps }, /* @__PURE__ */ React.createElement("div", { id: "proxied-body", dangerouslySetInnerHTML: { __html: body } }))),
|
|
@@ -33,9 +34,17 @@ async function onRenderClient(pageContext) {
|
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
36
|
let bodyEl;
|
|
37
|
+
function cachePageContext() {
|
|
38
|
+
Turbolinks._vpsCachePageContext({
|
|
39
|
+
layoutProps,
|
|
40
|
+
layout,
|
|
41
|
+
bodyAttrs: getElementAttributes(bodyEl)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
36
44
|
if (pageContext.isHydration) {
|
|
37
45
|
bodyEl = document.getElementById("proxied-body");
|
|
38
46
|
render(bodyEl.innerHTML);
|
|
47
|
+
cachePageContext();
|
|
39
48
|
} else {
|
|
40
49
|
const { proxySendClient: proxy } = pageContext;
|
|
41
50
|
if (!proxy) {
|
|
@@ -50,13 +59,9 @@ async function onRenderClient(pageContext) {
|
|
|
50
59
|
document.body.getAttributeNames().forEach((n) => document.body.removeAttribute(n));
|
|
51
60
|
copyElementAttributes(document.body, bodyEl);
|
|
52
61
|
render(bodyEl.innerHTML);
|
|
62
|
+
cachePageContext();
|
|
53
63
|
});
|
|
54
64
|
}
|
|
55
|
-
Turbolinks._vpsCachePageContext({
|
|
56
|
-
layoutProps,
|
|
57
|
-
layout,
|
|
58
|
-
bodyAttrs: getElementAttributes(bodyEl)
|
|
59
|
-
});
|
|
60
65
|
}
|
|
61
66
|
export {
|
|
62
67
|
onRenderClient as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../proxy/pages/onRenderClient.tsx"],"sourcesContent":["import React from \"react\";\nimport { renderReact } from \"../../lib/renderReact.js\";\nimport { PageShell } from \"../../lib/PageShell.js\";\nimport { PageContextProxyClient } from \"../../types/internal.js\";\nimport { Turbolinks } from \"../../lib/turbolinks/index.js\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../proxy/pages/onRenderClient.tsx"],"sourcesContent":["import React from \"react\";\nimport { renderReact } from \"../../lib/renderReact.js\";\nimport { PageShell } from \"../../lib/PageShell.js\";\nimport { PageContextProxyClient } from \"../../types/internal.js\";\nimport { Turbolinks } from \"../../lib/turbolinks/index.js\";\nimport { copyElementAttributes } from \"../../lib/turbolinks/util.js\";\nimport { getElementAttributes } from \"../../lib/getElementAttributes.js\";\nimport { LayoutComponent } from \"../../types/internal.js\";\n\nTurbolinks.start();\n\nconst PassthruLayout: LayoutComponent = ({ children }) => <>{children}</>;\n\nexport default async function onRenderClient(\n pageContext: PageContextProxyClient\n) {\n if (pageContext.redirectTo) {\n Turbolinks.visit(pageContext.redirectTo);\n return;\n }\n const { layoutProps, layout } = pageContext;\n\n const { layoutMap } = pageContext.config;\n if (!layoutMap) {\n throw new Error(\"layoutMap needs to be defined in config\");\n }\n const Layout = layoutMap[layout] || PassthruLayout;\n\n function render(body: string) {\n renderReact(\n <PageShell key={pageContext.urlOriginal} pageContext={pageContext}>\n <Layout {...layoutProps}>\n <div id=\"proxied-body\" dangerouslySetInnerHTML={{ __html: body }} />\n </Layout>\n </PageShell>,\n pageContext.isHydration\n );\n }\n let bodyEl: Element;\n\n function cachePageContext() {\n // cache page context will save it and return it to us during restoration visits\n Turbolinks._vpsCachePageContext({\n layoutProps,\n layout,\n bodyAttrs: getElementAttributes(bodyEl),\n });\n }\n\n if (pageContext.isHydration) {\n // During hydration of initial ssr, body is in dom, not page props (to avoid double-send)\n bodyEl = document.getElementById(\"proxied-body\")!;\n render(bodyEl.innerHTML);\n cachePageContext();\n } else {\n const { proxySendClient: proxy } = pageContext;\n\n if (!proxy) {\n console.error(\"proxy/+onRenderClient did not receive proxySendClient\");\n return;\n }\n\n const parsed = document.createElement(\"html\");\n parsed.innerHTML = proxy;\n bodyEl = parsed.querySelector(\"body\")!;\n const headEl = parsed.querySelector(\"head\")!;\n\n Turbolinks._vpsOnRenderClient(headEl, true, true, () => {\n // merge body attributes\n document.body\n .getAttributeNames()\n .forEach((n) => document.body.removeAttribute(n));\n copyElementAttributes(document.body, bodyEl);\n // render body with react\n render(bodyEl.innerHTML);\n cachePageContext();\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AASlB,WAAW,MAAM;AAEjB,IAAM,iBAAkC,CAAC,EAAE,SAAS,MAAM,0DAAG,QAAS;AAEtE,eAAO,eACL,aACA;AACA,MAAI,YAAY,YAAY;AAC1B,eAAW,MAAM,YAAY,UAAU;AACvC;AAAA,EACF;AACA,QAAM,EAAE,aAAa,OAAO,IAAI;AAEhC,QAAM,EAAE,UAAU,IAAI,YAAY;AAClC,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AACA,QAAM,SAAS,UAAU,MAAM,KAAK;AAEpC,WAAS,OAAO,MAAc;AAC5B;AAAA,MACE,oCAAC,aAAU,KAAK,YAAY,aAAa,eACvC,oCAAC,UAAQ,GAAG,eACV,oCAAC,SAAI,IAAG,gBAAe,yBAAyB,EAAE,QAAQ,KAAK,GAAG,CACpE,CACF;AAAA,MACA,YAAY;AAAA,IACd;AAAA,EACF;AACA,MAAI;AAEJ,WAAS,mBAAmB;AAE1B,eAAW,qBAAqB;AAAA,MAC9B;AAAA,MACA;AAAA,MACA,WAAW,qBAAqB,MAAM;AAAA,IACxC,CAAC;AAAA,EACH;AAEA,MAAI,YAAY,aAAa;AAE3B,aAAS,SAAS,eAAe,cAAc;AAC/C,WAAO,OAAO,SAAS;AACvB,qBAAiB;AAAA,EACnB,OAAO;AACL,UAAM,EAAE,iBAAiB,MAAM,IAAI;AAEnC,QAAI,CAAC,OAAO;AACV,cAAQ,MAAM,uDAAuD;AACrE;AAAA,IACF;AAEA,UAAM,SAAS,SAAS,cAAc,MAAM;AAC5C,WAAO,YAAY;AACnB,aAAS,OAAO,cAAc,MAAM;AACpC,UAAM,SAAS,OAAO,cAAc,MAAM;AAE1C,eAAW,mBAAmB,QAAQ,MAAM,MAAM,MAAM;AAEtD,eAAS,KACN,kBAAkB,EAClB,QAAQ,CAAC,MAAM,SAAS,KAAK,gBAAgB,CAAC,CAAC;AAClD,4BAAsB,SAAS,MAAM,MAAM;AAE3C,aAAO,OAAO,SAAS;AACvB,uBAAiB;AAAA,IACnB,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vite_plugin_ssr_dist_esm_node_runtime_html_renderHtml_js from 'vite-plugin-ssr/dist/esm/node/runtime/html/renderHtml.js';
|
|
2
2
|
import { h as PageContextProxyServer } from '../../internal-45a068f0.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'vite-plugin-ssr/types';
|
|
@@ -7,7 +7,10 @@ import '../../renderer/_config.js';
|
|
|
7
7
|
import '../../controller-16e58bbd.js';
|
|
8
8
|
|
|
9
9
|
declare function onRenderHtml(pageContext: PageContextProxyServer): Promise<{
|
|
10
|
-
documentHtml:
|
|
10
|
+
documentHtml: string;
|
|
11
|
+
pageContext: {};
|
|
12
|
+
} | {
|
|
13
|
+
documentHtml: vite_plugin_ssr_dist_esm_node_runtime_html_renderHtml_js.TemplateWrapped;
|
|
11
14
|
pageContext: {};
|
|
12
15
|
} | {
|
|
13
16
|
documentHtml?: undefined;
|
|
@@ -15,6 +15,14 @@ import jsdom from "jsdom";
|
|
|
15
15
|
async function onRenderHtml(pageContext) {
|
|
16
16
|
if (pageContext.proxy) {
|
|
17
17
|
const { proxy, layoutProps, layout } = pageContext;
|
|
18
|
+
const { layoutMap } = pageContext.config;
|
|
19
|
+
if (!layoutMap) {
|
|
20
|
+
throw new Error("layoutMap needs to be defined in config");
|
|
21
|
+
}
|
|
22
|
+
const Layout = layoutMap[layout];
|
|
23
|
+
if (!Layout) {
|
|
24
|
+
return { documentHtml: proxy, pageContext: {} };
|
|
25
|
+
}
|
|
18
26
|
const dom = new jsdom.JSDOM(proxy);
|
|
19
27
|
const doc = dom.window.document;
|
|
20
28
|
const bodyEl = doc.querySelector("body");
|
|
@@ -22,13 +30,6 @@ async function onRenderHtml(pageContext) {
|
|
|
22
30
|
if (!bodyEl || !head) {
|
|
23
31
|
throw new Error("Proxy failed");
|
|
24
32
|
}
|
|
25
|
-
const { layoutMap } = pageContext.config;
|
|
26
|
-
if (!layoutMap) {
|
|
27
|
-
throw new Error("layoutMap needs to be defined in config");
|
|
28
|
-
}
|
|
29
|
-
const Layout = layoutMap[layout];
|
|
30
|
-
if (!Layout)
|
|
31
|
-
throw new Error(`${layout} layout not found`);
|
|
32
33
|
const pageHtml = ReactDOMServer.renderToString(
|
|
33
34
|
/* @__PURE__ */ React.createElement(PageShell, { pageContext }, /* @__PURE__ */ React.createElement(Layout, { ...layoutProps }, /* @__PURE__ */ React.createElement(
|
|
34
35
|
"div",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../proxy/pages/onRenderHtml.tsx"],"sourcesContent":["import React from \"react\";\nimport ReactDOMServer from \"react-dom/server\";\nimport { dangerouslySkipEscape, escapeInject } from \"vite-plugin-ssr/server\";\nimport { PageContextProxyServer } from \"../../types/internal.js\";\nimport { PageShell } from \"../../lib/PageShell.js\";\nimport jsdom from \"jsdom\";\nimport { getElementAttributes } from \"../../lib/getElementAttributes.js\";\n\nexport default async function onRenderHtml(\n pageContext: PageContextProxyServer\n) {\n if (pageContext.proxy) {\n const { proxy, layoutProps, layout } = pageContext;\n\n const dom = new jsdom.JSDOM(proxy);\n const doc = dom.window.document;\n const bodyEl = doc.querySelector(\"body\");\n const head = doc.querySelector(\"head\");\n if (!bodyEl || !head) {\n throw new Error(\"Proxy failed\");\n }\n\n const
|
|
1
|
+
{"version":3,"sources":["../../../proxy/pages/onRenderHtml.tsx"],"sourcesContent":["import React from \"react\";\nimport ReactDOMServer from \"react-dom/server\";\nimport { dangerouslySkipEscape, escapeInject } from \"vite-plugin-ssr/server\";\nimport { PageContextProxyServer } from \"../../types/internal.js\";\nimport { PageShell } from \"../../lib/PageShell.js\";\nimport jsdom from \"jsdom\";\nimport { getElementAttributes } from \"../../lib/getElementAttributes.js\";\n\nexport default async function onRenderHtml(\n pageContext: PageContextProxyServer\n) {\n if (pageContext.proxy) {\n const { proxy, layoutProps, layout } = pageContext;\n\n const { layoutMap } = pageContext.config;\n if (!layoutMap) {\n throw new Error(\"layoutMap needs to be defined in config\");\n }\n const Layout = layoutMap[layout];\n if (!Layout) {\n // passthru\n return { documentHtml: proxy, pageContext: {} };\n }\n\n const dom = new jsdom.JSDOM(proxy);\n const doc = dom.window.document;\n const bodyEl = doc.querySelector(\"body\");\n const head = doc.querySelector(\"head\");\n if (!bodyEl || !head) {\n throw new Error(\"Proxy failed\");\n }\n\n const pageHtml = ReactDOMServer.renderToString(\n <PageShell pageContext={pageContext}>\n <Layout {...layoutProps}>\n <div\n id=\"proxied-body\"\n dangerouslySetInnerHTML={{ __html: bodyEl.innerHTML }}\n />\n </Layout>\n </PageShell>\n );\n\n const documentHtml = escapeInject`\n <!DOCTYPE html>\n <html>\n <head>\n ${dangerouslySkipEscape(head.innerHTML)}\n ${\n // We need to fire turbolinks:load exactly on DCL, so it must be a blocking head script to catch DCL event.\n // Vite loads scripts with type=\"module\" so the rest of our code will show up too late.\n // TODO: figure out how to bundle this better. at least read from a .js file\n dangerouslySkipEscape(`<script>\n window.Turbolinks = {controller:{restorationIdentifier: ''}};\n addEventListener(\"DOMContentLoaded\", () => {\n const event = new Event(\"turbolinks:load\", { bubbles: true, cancelable: true });\n event.data = {url: window.location.href};\n document.dispatchEvent(event); \n })\n </script>`)\n }\n </head>\n <body ${dangerouslySkipEscape(\n Object.entries(getElementAttributes(bodyEl))\n .map(([name, value]) => `${name}=\"${value}\"`)\n .join(\" \")\n )}>\n <div id=\"page-view\">${dangerouslySkipEscape(pageHtml)}</div>\n </body>\n </html>`;\n\n return {\n documentHtml,\n pageContext: {},\n };\n } else {\n // do nothing: Just exists to signal fastify server that no routes matched and we should proxy\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,OAAO,WAAW;AAClB,OAAO,oBAAoB;AAC3B,SAAS,uBAAuB,oBAAoB;AAGpD,OAAO,WAAW;AAGlB,eAAO,aACL,aACA;AACA,MAAI,YAAY,OAAO;AACrB,UAAM,EAAE,OAAO,aAAa,OAAO,IAAI;AAEvC,UAAM,EAAE,UAAU,IAAI,YAAY;AAClC,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,yCAAyC;AAAA,IAC3D;AACA,UAAM,SAAS,UAAU,MAAM;AAC/B,QAAI,CAAC,QAAQ;AAEX,aAAO,EAAE,cAAc,OAAO,aAAa,CAAC,EAAE;AAAA,IAChD;AAEA,UAAM,MAAM,IAAI,MAAM,MAAM,KAAK;AACjC,UAAM,MAAM,IAAI,OAAO;AACvB,UAAM,SAAS,IAAI,cAAc,MAAM;AACvC,UAAM,OAAO,IAAI,cAAc,MAAM;AACrC,QAAI,CAAC,UAAU,CAAC,MAAM;AACpB,YAAM,IAAI,MAAM,cAAc;AAAA,IAChC;AAEA,UAAM,WAAW,eAAe;AAAA,MAC9B,oCAAC,aAAU,eACT,oCAAC,UAAQ,GAAG,eACV;AAAA,QAAC;AAAA;AAAA,UACC,IAAG;AAAA,UACH,yBAAyB,EAAE,QAAQ,OAAO,UAAU;AAAA;AAAA,MACtD,CACF,CACF;AAAA,IACF;AAEA,UAAM,eAAe;AAAA;AAAA;AAAA;AAAA,YAIb,sBAAsB,KAAK,SAAS,CAAC;AAAA;AAAA;AAAA;AAAA,IAKrC,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAOd,CACV;AAAA;AAAA,gBAEM;AAAA,MACN,OAAO,QAAQ,qBAAqB,MAAM,CAAC,EACxC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,KAAK,KAAK,GAAG,EAC3C,KAAK,GAAG;AAAA,IACb,CAAC;AAAA,gCACuB,sBAAsB,QAAQ,CAAC;AAAA;AAAA;AAI3D,WAAO;AAAA,MACL;AAAA,MACA,aAAa,CAAC;AAAA,IAChB;AAAA,EACF,OAAO;AAEL,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
route: string;
|
|
3
3
|
Page: string;
|
|
4
|
-
onBeforeRender:
|
|
4
|
+
onBeforeRender: null;
|
|
5
5
|
onRenderClient: "import:@alignable/bifrost/proxy/pages/restorationVisit/onRenderClient";
|
|
6
6
|
passToClient: never[];
|
|
7
7
|
clientRouting: true;
|
|
8
8
|
hydrationCanBeAborted: true;
|
|
9
|
-
meta: {
|
|
10
|
-
onBeforeRender: {
|
|
11
|
-
env: "client-only";
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
9
|
};
|
|
15
10
|
|
|
16
11
|
export { _default as default };
|
|
@@ -2,18 +2,11 @@
|
|
|
2
2
|
var config_default = {
|
|
3
3
|
route: "import:@alignable/bifrost/proxy/pages/restorationVisit/route",
|
|
4
4
|
Page: "import:@alignable/bifrost/proxy/pages/Page",
|
|
5
|
-
onBeforeRender:
|
|
5
|
+
onBeforeRender: null,
|
|
6
6
|
onRenderClient: "import:@alignable/bifrost/proxy/pages/restorationVisit/onRenderClient",
|
|
7
7
|
passToClient: [],
|
|
8
8
|
clientRouting: true,
|
|
9
|
-
hydrationCanBeAborted: true
|
|
10
|
-
meta: {
|
|
11
|
-
onBeforeRender: {
|
|
12
|
-
// We tell vite-plugin-ssr to load and execute onBeforeRender() on the client-side.
|
|
13
|
-
// Moving onBeforeRender to client tells VPS it does not need to make network request on navigation
|
|
14
|
-
env: "client-only"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
hydrationCanBeAborted: true
|
|
17
10
|
};
|
|
18
11
|
export {
|
|
19
12
|
config_default as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../proxy/pages/restorationVisit/+config.ts"],"sourcesContent":["import { Config } from \"vite-plugin-ssr/types\";\n\nexport default {\n route: \"import:@alignable/bifrost/proxy/pages/restorationVisit/route\",\n Page: \"import:@alignable/bifrost/proxy/pages/Page\",\n onBeforeRender
|
|
1
|
+
{"version":3,"sources":["../../../../proxy/pages/restorationVisit/+config.ts"],"sourcesContent":["import { Config } from \"vite-plugin-ssr/types\";\n\ntype Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\nexport default {\n route: \"import:@alignable/bifrost/proxy/pages/restorationVisit/route\",\n Page: \"import:@alignable/bifrost/proxy/pages/Page\",\n onBeforeRender: null,\n onRenderClient:\n \"import:@alignable/bifrost/proxy/pages/restorationVisit/onRenderClient\",\n passToClient: [],\n clientRouting: true,\n hydrationCanBeAborted: true,\n} satisfies Nullable<Config>;\n// ^ temp workaround waiting on https://github.com/brillout/vite-plugin-ssr/commit/fefc63ead5959aec6e6344f53b049d9cafeb2139 to merge\n"],"mappings":";AAMA,IAAO,iBAAQ;AAAA,EACb,OAAO;AAAA,EACP,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,gBACE;AAAA,EACF,cAAc,CAAC;AAAA,EACf,eAAe;AAAA,EACf,uBAAuB;AACzB;","names":[]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
Turbolinks,
|
|
6
6
|
copyElementAttributes,
|
|
7
7
|
renderReact
|
|
8
|
-
} from "../../../chunk-
|
|
8
|
+
} from "../../../chunk-TUQ332K5.js";
|
|
9
9
|
import {
|
|
10
10
|
PageShell
|
|
11
11
|
} from "../../../chunk-4DL7N7Y5.js";
|
|
@@ -14,6 +14,7 @@ import "../../../chunk-EYYCKU6F.js";
|
|
|
14
14
|
|
|
15
15
|
// proxy/pages/restorationVisit/onRenderClient.tsx
|
|
16
16
|
import React from "react";
|
|
17
|
+
var PassthruLayout = ({ children }) => /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
17
18
|
async function onRenderClient(pageContext) {
|
|
18
19
|
if (pageContext.isHydration) {
|
|
19
20
|
throw new Error("restoration visit should never happen on initial render");
|
|
@@ -24,7 +25,7 @@ async function onRenderClient(pageContext) {
|
|
|
24
25
|
if (!layoutMap) {
|
|
25
26
|
throw new Error("layoutMap needs to be defined in config");
|
|
26
27
|
}
|
|
27
|
-
const Layout = layoutMap[layout];
|
|
28
|
+
const Layout = layoutMap[layout] || PassthruLayout;
|
|
28
29
|
function render(body) {
|
|
29
30
|
renderReact(
|
|
30
31
|
/* @__PURE__ */ React.createElement(PageShell, { key: pageContext.urlOriginal, pageContext }, /* @__PURE__ */ React.createElement(Layout, { ...layoutProps }, /* @__PURE__ */ React.createElement("div", { id: "proxied-body", dangerouslySetInnerHTML: { __html: body } }))),
|
|
@@ -39,11 +40,11 @@ async function onRenderClient(pageContext) {
|
|
|
39
40
|
document.body.getAttributeNames().forEach((n) => document.body.removeAttribute(n));
|
|
40
41
|
copyElementAttributes(document.body, bodyEl);
|
|
41
42
|
render(proxyBodyEl.innerHTML);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
Turbolinks._vpsCachePageContext({
|
|
44
|
+
layoutProps,
|
|
45
|
+
layout,
|
|
46
|
+
bodyAttrs: getElementAttributes(bodyEl)
|
|
47
|
+
});
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../proxy/pages/restorationVisit/onRenderClient.tsx"],"sourcesContent":["import React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../proxy/pages/restorationVisit/onRenderClient.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n LayoutComponent,\n PageContextProxyRestorationVisit,\n} from \"../../../types/internal.js\";\nimport { PageShell } from \"../../../lib/PageShell.js\";\nimport { renderReact } from \"../../../lib/renderReact.js\";\nimport { Turbolinks } from \"../../../lib/turbolinks/index.js\";\nimport { getElementAttributes } from \"../../../lib/getElementAttributes.js\";\nimport { copyElementAttributes } from \"../../../lib/turbolinks/util.js\";\n\nconst PassthruLayout: LayoutComponent = ({ children }) => <>{children}</>;\n\nexport default async function onRenderClient(\n pageContext: PageContextProxyRestorationVisit\n) {\n if (pageContext.isHydration) {\n throw new Error(\"restoration visit should never happen on initial render\");\n }\n\n const { layoutProps, layout } = pageContext.snapshot.pageContext;\n const { bodyEl, headEl } = pageContext.snapshot;\n const { layoutMap } = pageContext.config;\n if (!layoutMap) {\n throw new Error(\"layoutMap needs to be defined in config\");\n }\n const Layout = layoutMap[layout] || PassthruLayout;\n\n function render(body: string) {\n renderReact(\n <PageShell key={pageContext.urlOriginal} pageContext={pageContext}>\n <Layout {...layoutProps}>\n <div id=\"proxied-body\" dangerouslySetInnerHTML={{ __html: body }} />\n </Layout>\n </PageShell>,\n pageContext.isHydration\n );\n }\n const proxyBodyEl = bodyEl.querySelector(\"#proxied-body\");\n if (!proxyBodyEl) {\n throw new Error(\"proxied body not found in cached snapshot\");\n }\n\n Turbolinks._vpsOnRenderClient(headEl, true, true, () => {\n // merge body attributes\n document.body\n .getAttributeNames()\n .forEach((n) => document.body.removeAttribute(n));\n copyElementAttributes(document.body, bodyEl);\n // render body with react\n render(proxyBodyEl.innerHTML);\n // cache page context will save it and return it to us during restoration visits\n Turbolinks._vpsCachePageContext({\n layoutProps,\n layout,\n bodyAttrs: getElementAttributes(bodyEl),\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAWlB,IAAM,iBAAkC,CAAC,EAAE,SAAS,MAAM,0DAAG,QAAS;AAEtE,eAAO,eACL,aACA;AACA,MAAI,YAAY,aAAa;AAC3B,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAEA,QAAM,EAAE,aAAa,OAAO,IAAI,YAAY,SAAS;AACrD,QAAM,EAAE,QAAQ,OAAO,IAAI,YAAY;AACvC,QAAM,EAAE,UAAU,IAAI,YAAY;AAClC,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AACA,QAAM,SAAS,UAAU,MAAM,KAAK;AAEpC,WAAS,OAAO,MAAc;AAC5B;AAAA,MACE,oCAAC,aAAU,KAAK,YAAY,aAAa,eACvC,oCAAC,UAAQ,GAAG,eACV,oCAAC,SAAI,IAAG,gBAAe,yBAAyB,EAAE,QAAQ,KAAK,GAAG,CACpE,CACF;AAAA,MACA,YAAY;AAAA,IACd;AAAA,EACF;AACA,QAAM,cAAc,OAAO,cAAc,eAAe;AACxD,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AAEA,aAAW,mBAAmB,QAAQ,MAAM,MAAM,MAAM;AAEtD,aAAS,KACN,kBAAkB,EAClB,QAAQ,CAAC,MAAM,SAAS,KAAK,gBAAgB,CAAC,CAAC;AAClD,0BAAsB,SAAS,MAAM,MAAM;AAE3C,WAAO,YAAY,SAAS;AAE5B,eAAW,qBAAqB;AAAA,MAC9B;AAAA,MACA;AAAA,MACA,WAAW,qBAAqB,MAAM;AAAA,IACxC,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vite_plugin_ssr_dist_esm_node_runtime_html_renderHtml_js from 'vite-plugin-ssr/dist/esm/node/runtime/html/renderHtml.js';
|
|
2
2
|
import { e as PageContextNoProxyServer } from '../internal-45a068f0.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'vite-plugin-ssr/types';
|
|
@@ -12,7 +12,7 @@ declare function onRenderHtml(pageContext: PageContextNoProxyServer): Promise<{
|
|
|
12
12
|
};
|
|
13
13
|
documentHtml?: undefined;
|
|
14
14
|
} | {
|
|
15
|
-
documentHtml:
|
|
15
|
+
documentHtml: vite_plugin_ssr_dist_esm_node_runtime_html_renderHtml_js.TemplateWrapped;
|
|
16
16
|
pageContext: {
|
|
17
17
|
redirectTo?: undefined;
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alignable/bifrost",
|
|
3
3
|
"repository": "https://github.com/Alignable/bifrost.git",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.24",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -53,10 +53,6 @@
|
|
|
53
53
|
"types": "./dist/proxy/pages/restorationVisit/onRenderClient.d.ts",
|
|
54
54
|
"default": "./dist/proxy/pages/restorationVisit/onRenderClient.js"
|
|
55
55
|
},
|
|
56
|
-
"./proxy/pages/restorationVisit/onBeforeRender": {
|
|
57
|
-
"types": "./dist/proxy/pages/restorationVisit/onBeforeRender.d.ts",
|
|
58
|
-
"default": "./dist/proxy/pages/restorationVisit/onBeforeRender.js"
|
|
59
|
-
},
|
|
60
56
|
".": {
|
|
61
57
|
"types": "./dist/index.d.ts",
|
|
62
58
|
"default": "./dist/index.js"
|
|
@@ -87,16 +83,17 @@
|
|
|
87
83
|
"react-dom": "^18.x.x",
|
|
88
84
|
"tough-cookie": "^4.1.2",
|
|
89
85
|
"uuid": "^9.0.0",
|
|
90
|
-
"vite-plugin-ssr": "0.4.
|
|
86
|
+
"vite-plugin-ssr": "0.4.137"
|
|
91
87
|
},
|
|
92
88
|
"peerDependencies": {
|
|
93
89
|
"jsdom": "^22.1.0",
|
|
94
90
|
"react": "^18.x.x",
|
|
95
91
|
"react-dom": "^18.x.x",
|
|
96
92
|
"typescript": ">=4.7",
|
|
97
|
-
"vite-plugin-ssr": "0.4.
|
|
93
|
+
"vite-plugin-ssr": "0.4.137"
|
|
98
94
|
},
|
|
99
95
|
"devDependencies": {
|
|
96
|
+
"@types/jsdom": "^21.1.2",
|
|
100
97
|
"@types/node": "^18.11.9",
|
|
101
98
|
"@types/react": "^18.0.8",
|
|
102
99
|
"@types/react-dom": "^18.0.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/renderReact.ts","../lib/turbolinks/util.ts","../lib/turbolinks/mergeHead.ts","../lib/turbolinks/lruCache.ts","../lib/turbolinks/progress_bar.ts","../lib/turbolinks/browser_adapter.ts","../lib/turbolinks/location.ts","../lib/turbolinks/types.ts","../lib/turbolinks/visit.ts","../lib/turbolinks/controller.ts","../lib/turbolinks/index.ts"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { Root, createRoot, hydrateRoot } from \"react-dom/client\";\n\nlet root: Root;\n\nexport function renderReact(page: ReactNode, isHydration: boolean) {\n const container = document.getElementById(\"page-view\")!;\n if (isHydration) {\n root = hydrateRoot(container, page);\n } else {\n if (!root) {\n root = createRoot(container);\n }\n root.render(page);\n }\n}\n","export function array<T>(values: ArrayLike<T>): T[] {\n return Array.prototype.slice.call(values);\n}\n\nexport const closest = (() => {\n const html = document.documentElement;\n\n type MatchesSelector = (this: Element, selector: string) => boolean;\n const match: MatchesSelector =\n html.matches ||\n (html as any).webkitMatchesSelector ||\n (html as any).msMatchesSelector ||\n (html as any).mozMatchesSelector;\n\n type Closest = (this: Element, selector: string) => Element | null;\n const closest: Closest =\n html.closest ||\n function (selector: string) {\n let element: Element | null = this;\n while (element) {\n if (match.call(element, selector)) {\n return element;\n } else {\n element = element.parentElement;\n }\n }\n };\n\n return function (element: Element, selector: string) {\n return closest.call(element, selector);\n };\n})();\n\nexport function defer(callback: () => any) {\n setTimeout(callback, 1);\n}\n\nexport type DispatchOptions = {\n target: EventTarget;\n cancelable: boolean;\n data: any;\n};\n\nexport function dispatch(\n eventName: string,\n { target, cancelable, data }: Partial<DispatchOptions> = {}\n) {\n const event = document.createEvent(\"Events\") as Event & { data: any };\n event.initEvent(eventName, true, cancelable == true);\n event.data = data || {};\n\n // Fix setting `defaultPrevented` when `preventDefault()` is called\n // http://stackoverflow.com/questions/23349191/event-preventdefault-is-not-working-in-ie-11-for-custom-events\n if (event.cancelable && !preventDefaultSupported) {\n const { preventDefault } = event;\n event.preventDefault = function () {\n if (!this.defaultPrevented) {\n Object.defineProperty(this, \"defaultPrevented\", { get: () => true });\n }\n preventDefault.call(this);\n };\n }\n\n (target || document).dispatchEvent(event);\n return event;\n}\n\nconst preventDefaultSupported = (() => {\n const event = document.createEvent(\"Events\");\n event.initEvent(\"test\", true, true);\n event.preventDefault();\n return event.defaultPrevented;\n})();\n\nexport function unindent(\n strings: TemplateStringsArray,\n ...values: any[]\n): string {\n const lines = trimLeft(interpolate(strings, values)).split(\"\\n\");\n const match = lines[0].match(/^\\s+/);\n const indent = match ? match[0].length : 0;\n return lines.map((line) => line.slice(indent)).join(\"\\n\");\n}\n\nfunction trimLeft(string: string) {\n return string.replace(/^\\n/, \"\");\n}\n\nfunction interpolate(strings: TemplateStringsArray, values: any[]) {\n return strings.reduce((result, string, i) => {\n const value = values[i] == undefined ? \"\" : values[i];\n return result + string + value;\n }, \"\");\n}\n\nexport function uuid() {\n return Array.apply(null, { length: 36 } as any)\n .map((_, i) => {\n if (i == 8 || i == 13 || i == 18 || i == 23) {\n return \"-\";\n } else if (i == 14) {\n return \"4\";\n } else if (i == 19) {\n return (Math.floor(Math.random() * 4) + 8).toString(16);\n } else {\n return Math.floor(Math.random() * 15).toString(16);\n }\n })\n .join(\"\");\n}\n\nexport function createScriptElement(element: Element, cb?: () => void) {\n if (element.getAttribute(\"data-turbolinks-eval\") == \"false\") {\n return element;\n } else {\n const createdScriptElement = document.createElement(\"script\");\n createdScriptElement.textContent = element.textContent;\n // async false makes scripts run in-order. it wont block js execution (thankfully)\n // https://github.com/turbolinks/turbolinks/issues/282#issuecomment-355731712\n createdScriptElement.async = false;\n copyElementAttributes(createdScriptElement, element);\n if (cb) {\n createdScriptElement.addEventListener(\"load\", cb);\n }\n return createdScriptElement;\n }\n}\n\nexport function copyElementAttributes(\n destinationElement: Element,\n sourceElement: Element\n) {\n for (const { name, value } of array(sourceElement.attributes)) {\n destinationElement.setAttribute(name, value);\n }\n}\n\nfunction replaceElementWithElement(fromElement: Element, toElement: Element) {\n const parentElement = fromElement.parentElement;\n if (parentElement) {\n return parentElement.replaceChild(toElement, fromElement);\n }\n}\nexport function activateNewBodyScriptElements(\n newScriptElements: HTMLScriptElement[]\n) {\n for (const inertScriptElement of newScriptElements) {\n const activatedScriptElement = createScriptElement(inertScriptElement);\n replaceElementWithElement(inertScriptElement, activatedScriptElement);\n }\n}\n\nexport function focusFirstAutofocusableElement() {\n const element = document.body.querySelector(\"[autofocus]\");\n if (element && \"focus\" in element && typeof element.focus === \"function\") {\n element.focus();\n }\n}\n","import { createScriptElement } from \"./util\";\n\ninterface ElementDetails {\n tracked: boolean;\n}\nconst allHeadScriptsEverRun: { [outerHTML: string]: ElementDetails } = {};\nlet firstLoad = true;\nlet lastTrackedScriptSignature: string;\n\nexport async function mergeHead(\n head: HTMLHeadElement,\n trackScripts: boolean,\n reload: () => void\n) {\n const newHead = categorizeHead(head);\n const oldHead = categorizeHead(document.head);\n\n if (\n head\n .querySelector('meta[name=\"turbolinks-visit-control\"]')\n ?.getAttribute(\"content\") === \"reload\"\n ) {\n reload();\n }\n if (trackScripts) {\n lastTrackedScriptSignature =\n lastTrackedScriptSignature ||\n trackedElementSignature([...oldHead.scripts, ...oldHead.stylesheets]);\n if (\n lastTrackedScriptSignature !==\n trackedElementSignature([...newHead.scripts, ...newHead.stylesheets])\n ) {\n reload();\n }\n }\n\n if (firstLoad) {\n // TODO: messy code\n for (const element of oldHead.scripts) {\n allHeadScriptsEverRun[element.outerHTML] = {\n tracked: elementIsTracked(element),\n };\n }\n firstLoad = false;\n }\n\n copyNewHeadStylesheetElements(newHead.stylesheets, oldHead.stylesheets);\n removeCurrentHeadProvisionalElements(oldHead.provisional);\n copyNewHeadProvisionalElements(newHead.provisional);\n\n return new Promise<void>((resolve) => {\n copyNewHeadScriptElements(newHead.scripts, resolve);\n });\n}\n\nfunction trackedElementSignature(scripts: Element[]) {\n return scripts\n .filter(elementIsTracked)\n .map((s) => s.outerHTML)\n .join();\n}\n\nfunction copyNewHeadStylesheetElements(next: Element[], prev: Element[]) {\n const existing = prev.map((s) => s.outerHTML);\n for (const element of next) {\n if (!existing.includes(element.outerHTML)) {\n document.head.appendChild(element);\n }\n }\n}\n\nfunction copyNewHeadScriptElements(\n next: Element[],\n onScriptsLoaded: () => void\n) {\n let blockingLoaded: boolean[] = [];\n function dispatch() {\n onScriptsLoaded();\n }\n for (const element of next as HTMLScriptElement[]) {\n const runBefore = element.outerHTML in allHeadScriptsEverRun;\n if (!runBefore) {\n let cb;\n if (!element.defer && element.src) {\n const idx = blockingLoaded.length;\n cb = () => {\n blockingLoaded[idx] = true;\n if (blockingLoaded.every((v) => v)) {\n dispatch();\n }\n };\n blockingLoaded.push(false);\n }\n document.head.appendChild(createScriptElement(element, cb));\n allHeadScriptsEverRun[element.outerHTML] = {\n tracked: elementIsTracked(element),\n };\n }\n }\n if (blockingLoaded.length === 0) {\n // raf waits for react to finish\n requestAnimationFrame(dispatch);\n }\n}\n\nfunction removeCurrentHeadProvisionalElements(prev: Element[]) {\n for (const element of prev) {\n document.head.removeChild(element);\n }\n}\n\nfunction copyNewHeadProvisionalElements(next: Element[]) {\n for (const element of next) {\n document.head.appendChild(element);\n }\n}\n\nfunction elementIsTracked(element: Element) {\n return element.getAttribute(\"data-turbolinks-track\") == \"reload\";\n}\n\nfunction elementIsScript(element: Element) {\n const tagName = element.tagName.toLowerCase();\n return tagName == \"script\";\n}\n\nfunction elementIsStylesheet(element: Element) {\n const tagName = element.tagName.toLowerCase();\n return (\n tagName == \"style\" ||\n (tagName == \"link\" && element.getAttribute(\"rel\") == \"stylesheet\")\n );\n}\n\nfunction elementIsFavicon(element: Element) {\n const tagName = element.tagName.toLowerCase();\n\n return tagName == \"link\" && element.getAttribute(\"rel\") == \"icon\";\n}\n\nfunction categorizeHead(head: ParentNode) {\n const scripts = [];\n const stylesheets = [];\n const provisional = [];\n for (const element of head.children) {\n // we want to keep the same favicon on page transitions\n if (elementIsFavicon(element)) {\n continue;\n }\n\n if (elementIsScript(element)) {\n scripts.push(element);\n } else if (elementIsStylesheet(element)) {\n stylesheets.push(element);\n } else {\n provisional.push(element);\n }\n }\n return { scripts, stylesheets, provisional };\n}\n","export class LruCache<T> {\n private values: Map<string, T> = new Map<string, T>();\n private maxEntries;\n\n constructor(maxEntries: number) {\n this.maxEntries = maxEntries;\n }\n\n public get(key: string): T | undefined {\n const hasKey = this.values.has(key);\n let entry: T | undefined;\n if (hasKey) {\n // peek the entry, re-insert for LRU strategy\n entry = this.values.get(key)!;\n this.values.delete(key);\n this.values.set(key, entry);\n }\n\n return entry;\n }\n\n public put(key: string, value: T) {\n if (this.values.size >= this.maxEntries) {\n // least-recently used cache eviction strategy\n const keyToDelete = this.values.keys().next().value;\n\n this.values.delete(keyToDelete);\n }\n\n this.values.set(key, value);\n }\n}\n","import { unindent } from \"./util\";\n\nexport class ProgressBar {\n static animationDuration = 300; /*ms*/\n\n static get defaultCSS() {\n return unindent`\n .turbolinks-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 9999;\n transition:\n width ${ProgressBar.animationDuration}ms ease-out,\n opacity ${ProgressBar.animationDuration / 2}ms ${\n ProgressBar.animationDuration / 2\n }ms ease-in;\n transform: translate3d(0, 0, 0);\n }\n `;\n }\n\n readonly stylesheetElement = this.createStylesheetElement();\n readonly progressElement = this.createProgressElement();\n\n hiding = false;\n trickleInterval?: number;\n value = 0;\n visible = false;\n\n show() {\n if (!this.visible) {\n this.visible = true;\n this.installStylesheetElement();\n this.installProgressElement();\n this.startTrickling();\n }\n }\n\n hide() {\n if (this.visible && !this.hiding) {\n this.hiding = true;\n this.fadeProgressElement(() => {\n this.uninstallProgressElement();\n this.stopTrickling();\n this.visible = false;\n this.hiding = false;\n });\n }\n }\n\n setValue(value: number) {\n this.value = value;\n this.refresh();\n }\n\n // Private\n\n installStylesheetElement() {\n document.head.insertBefore(\n this.stylesheetElement,\n document.head.firstChild\n );\n }\n\n installProgressElement() {\n this.progressElement.style.width = \"0\";\n this.progressElement.style.opacity = \"1\";\n document.documentElement.insertBefore(this.progressElement, document.body);\n this.refresh();\n }\n\n fadeProgressElement(callback: () => void) {\n this.progressElement.style.opacity = \"0\";\n setTimeout(callback, ProgressBar.animationDuration * 1.5);\n }\n\n uninstallProgressElement() {\n if (this.progressElement.parentNode) {\n document.documentElement.removeChild(this.progressElement);\n }\n }\n\n startTrickling() {\n if (!this.trickleInterval) {\n this.trickleInterval = window.setInterval(\n this.trickle,\n ProgressBar.animationDuration\n );\n }\n }\n\n stopTrickling() {\n window.clearInterval(this.trickleInterval);\n delete this.trickleInterval;\n }\n\n trickle = () => {\n this.setValue(this.value + Math.random() / 100);\n };\n\n refresh() {\n requestAnimationFrame(() => {\n this.progressElement.style.width = `${10 + this.value * 90}%`;\n });\n }\n\n createStylesheetElement() {\n const element = document.createElement(\"style\");\n element.type = \"text/css\";\n element.textContent = ProgressBar.defaultCSS;\n return element;\n }\n\n createProgressElement() {\n const element = document.createElement(\"div\");\n element.className = \"turbolinks-progress-bar\";\n return element;\n }\n}\n","import { Adapter } from \"./adapter\";\nimport { Controller } from \"./controller\";\nimport { Locatable } from \"./location\";\nimport { ProgressBar } from \"./progress_bar\";\nimport { Action } from \"./types\";\nimport { Visit } from \"./visit\";\n\nexport class BrowserAdapter implements Adapter {\n readonly controller: Controller;\n readonly progressBar = new ProgressBar();\n\n progressBarTimeout?: number;\n\n constructor(controller: Controller) {\n this.controller = controller;\n }\n\n visitProposedToLocationWithAction(location: Locatable, action: Action) {\n this.controller.startVisitToLocationWithAction(\n location,\n action,\n );\n }\n\n visitStarted(visit: Visit) {\n visit.issueRequest();\n visit.changeHistory();\n visit.loadCachedSnapshot();\n }\n\n visitRequestStarted(visit: Visit) {\n this.progressBar.setValue(0);\n if (visit.hasCachedSnapshot() || visit.action != \"restore\") {\n this.showProgressBarAfterDelay();\n } else {\n this.showProgressBar();\n }\n }\n\n visitRequestProgressed(visit: Visit) {\n this.progressBar.setValue(visit.progress);\n }\n\n visitRequestCompleted(visit: Visit) {\n visit.loadResponse();\n }\n\n visitRequestFailedWithStatusCode(visit: Visit, statusCode: number) {\n switch (statusCode) {\n // TODO\n // case SystemStatusCode.networkFailure:\n // case SystemStatusCode.timeoutFailure:\n // case SystemStatusCode.contentTypeMismatch:\n // return this.reload()\n default:\n return visit.loadResponse();\n }\n }\n\n visitRequestFinished(visit: Visit) {\n this.hideProgressBar();\n }\n\n visitCompleted(visit: Visit) {\n }\n\n pageInvalidated() {\n this.reload();\n }\n\n visitFailed(visit: Visit) {}\n\n visitRendered(visit: Visit) {}\n\n // Private\n\n showProgressBarAfterDelay() {\n this.progressBarTimeout = window.setTimeout(\n this.showProgressBar,\n this.controller.progressBarDelay\n );\n }\n\n showProgressBar = () => {\n this.progressBar.show();\n };\n\n hideProgressBar() {\n this.progressBar.hide();\n if (this.progressBarTimeout != null) {\n window.clearTimeout(this.progressBarTimeout);\n delete this.progressBarTimeout;\n }\n }\n\n reload() {\n window.location.reload();\n }\n}\n","export type Locatable = Location | string;\n\nexport class Location {\n static get currentLocation() {\n return this.wrap(window.location.toString());\n }\n\n static wrap(locatable: Locatable): Location;\n static wrap(locatable?: Locatable | null): Location | undefined;\n static wrap(locatable: Locatable) {\n if (typeof locatable == \"string\") {\n return new this(locatable);\n } else if (locatable != null) {\n return locatable;\n }\n }\n\n readonly absoluteURL: string;\n readonly requestURL: string;\n readonly anchor?: string;\n\n constructor(url: string) {\n const linkWithAnchor = document.createElement(\"a\");\n linkWithAnchor.href = url;\n\n this.absoluteURL = linkWithAnchor.href;\n\n const anchorLength = linkWithAnchor.hash.length;\n if (anchorLength < 2) {\n this.requestURL = this.absoluteURL;\n } else {\n this.requestURL = this.absoluteURL.slice(0, -anchorLength);\n this.anchor = linkWithAnchor.hash.slice(1);\n }\n }\n\n getOrigin() {\n return this.absoluteURL.split(\"/\", 3).join(\"/\");\n }\n\n getPath() {\n return (this.requestURL.match(/\\/\\/[^/]*(\\/[^?;]*)/) || [])[1] || \"/\";\n }\n\n getPathComponents() {\n return this.getPath().split(\"/\").slice(1);\n }\n\n getLastPathComponent() {\n return this.getPathComponents().slice(-1)[0];\n }\n\n getExtension() {\n return (this.getLastPathComponent().match(/\\.[^.]*$/) || [])[0] || \"\";\n }\n\n isHTML() {\n return this.getExtension().match(/^(?:|\\.(?:htm|html|xhtml))$/);\n }\n\n isPrefixedBy(location: Location): boolean {\n const prefixURL = getPrefixURL(location);\n return (\n this.isEqualTo(location) || stringStartsWith(this.absoluteURL, prefixURL)\n );\n }\n\n isEqualTo(location?: Location) {\n return location && this.absoluteURL === location.absoluteURL;\n }\n\n toCacheKey() {\n return this.requestURL;\n }\n\n toJSON() {\n return this.absoluteURL;\n }\n\n toString() {\n return this.absoluteURL;\n }\n\n valueOf() {\n return this.absoluteURL;\n }\n}\n\nfunction getPrefixURL(location: Location) {\n return addTrailingSlash(location.getOrigin() + location.getPath());\n}\n\nfunction addTrailingSlash(url: string) {\n return stringEndsWith(url, \"/\") ? url : url + \"/\";\n}\n\nfunction stringStartsWith(string: string, prefix: string) {\n return string.slice(0, prefix.length) === prefix;\n}\n\nfunction stringEndsWith(string: string, suffix: string) {\n return string.slice(-suffix.length) === suffix;\n}\n","export type Action = \"advance\" | \"replace\" | \"restore\";\n\nexport function isAction(action: any): action is Action {\n return action == \"advance\" || action == \"replace\" || action == \"restore\";\n}\n\nexport type Position = { x: number; y: number };\n","import { navigate } from \"vite-plugin-ssr/client/router\";\nimport { Adapter } from \"./adapter\";\nimport { Controller } from \"./controller.js\";\nimport { Location } from \"./location\";\nimport { Action } from \"./types\";\nimport { uuid } from \"./util\";\n\nexport enum TimingMetric {\n visitStart = \"visitStart\",\n requestStart = \"requestStart\",\n requestEnd = \"requestEnd\",\n visitEnd = \"visitEnd\",\n}\n\nexport type TimingMetrics = Partial<{ [metric in TimingMetric]: any }>;\n\nexport enum VisitState {\n initialized = \"initialized\",\n started = \"started\",\n canceled = \"canceled\",\n failed = \"failed\",\n completed = \"completed\",\n}\n\nexport class Visit {\n readonly controller: Controller;\n readonly action: Action;\n readonly adapter: Adapter;\n readonly identifier = uuid();\n readonly restorationIdentifier: string;\n readonly timingMetrics: TimingMetrics = {};\n\n frame?: number;\n location: Location;\n progress = 0;\n referrer?: Location;\n redirectedToLocation?: Location;\n snapshotCached = false;\n state = VisitState.initialized;\n\n requestInFlight = false;\n renderFn?: () => Promise<void>;\n\n constructor(\n controller: Controller,\n location: Location,\n action: Action,\n restorationIdentifier: string = uuid()\n ) {\n this.controller = controller;\n this.location = location;\n this.action = action;\n this.adapter = controller.adapter;\n this.restorationIdentifier = restorationIdentifier;\n }\n\n start() {\n if (this.state == VisitState.initialized) {\n this.recordTimingMetric(TimingMetric.visitStart);\n this.state = VisitState.started;\n this.adapter.visitStarted(this);\n }\n }\n\n cancel() {\n if (this.state == VisitState.started) {\n this.requestInFlight = false;\n this.cancelRender();\n this.state = VisitState.canceled;\n }\n }\n\n complete() {\n if (this.state == VisitState.started) {\n this.recordTimingMetric(TimingMetric.visitEnd);\n this.state = VisitState.completed;\n this.adapter.visitCompleted(this);\n this.controller.visitCompleted(this);\n }\n }\n\n fail() {\n if (this.state == VisitState.started) {\n this.state = VisitState.failed;\n this.adapter.visitFailed(this);\n }\n }\n\n changeHistory() {\n // no-op since issueRequest calls navigate which handles all of this already\n return;\n }\n\n issueRequest() {\n if (!this.requestInFlight) {\n if (this.shouldIssueRequest()) {\n const url = new URL(\n this.location.toString(),\n this.location.getOrigin()\n );\n navigate(url.pathname + url.hash + url.search, {\n overwriteLastHistoryEntry: this.action === \"replace\",\n }).catch(console.error);\n this.progress = 0;\n this.requestInFlight = true;\n }\n }\n }\n\n getCachedSnapshot() {\n const snapshot = this.controller.getCachedSnapshotForLocation(\n this.location\n );\n if (snapshot) {\n if (this.action == \"restore\") {\n return snapshot;\n }\n }\n }\n\n hasCachedSnapshot() {\n return this.getCachedSnapshot() != null;\n }\n\n loadCachedSnapshot() {\n // no-op since issueRequest calls navigate which handles all of this already\n return;\n }\n\n loadResponse() {\n this.render(async () => {\n if (!this.renderFn)\n throw new Error(\"Render details not set before rendering\");\n this.cacheSnapshot();\n await this.renderFn();\n this.complete();\n });\n }\n\n // HTTP request delegate\n\n /*\n requestStarted() {\n this.recordTimingMetric(TimingMetric.requestStart);\n this.adapter.visitRequestStarted(this);\n }\n\n requestProgressed(progress: number) {\n this.progress = progress;\n if (this.adapter.visitRequestProgressed) {\n this.adapter.visitRequestProgressed(this);\n }\n }\n\n requestCompletedWithResponse(\n response: string,\n redirectedToLocation?: Location\n ) {\n this.response = response;\n this.redirectedToLocation = redirectedToLocation;\n this.adapter.visitRequestCompleted(this);\n }\n\n requestFailedWithStatusCode(statusCode: number, response?: string) {\n this.response = response;\n this.adapter.visitRequestFailedWithStatusCode(this, statusCode);\n }\n\n requestFinished() {\n this.recordTimingMetric(TimingMetric.requestEnd);\n this.adapter.visitRequestFinished(this);\n }\n */\n\n // Instrumentation\n\n recordTimingMetric(metric: TimingMetric) {\n this.timingMetrics[metric] = new Date().getTime();\n }\n\n getTimingMetrics(): TimingMetrics {\n return { ...this.timingMetrics };\n }\n\n // Private\n\n shouldIssueRequest() {\n return this.action == \"restore\" ? !this.hasCachedSnapshot() : true;\n }\n\n cacheSnapshot() {\n if (!this.snapshotCached) {\n this.controller.cacheSnapshot();\n this.snapshotCached = true;\n }\n }\n\n render(callback: () => Promise<void>) {\n this.cancelRender();\n this.frame = requestAnimationFrame(() => {\n delete this.frame;\n callback.call(this);\n });\n }\n\n cancelRender() {\n if (this.frame) {\n cancelAnimationFrame(this.frame);\n delete this.frame;\n }\n }\n}\n","import { LruCache } from \"./lruCache\";\nimport { Adapter } from \"./adapter\";\nimport { BrowserAdapter } from \"./browser_adapter\";\nimport { Location, Locatable } from \"./location\";\nimport { Action, isAction } from \"./types\";\nimport { closest, defer, dispatch, uuid } from \"./util\";\nimport { Visit } from \"./visit\";\n\nexport type TimingData = {};\nexport type VisitOptions = { action: Action };\n\nexport interface Snapshot {\n bodyEl: Element;\n headEl: HTMLHeadElement;\n pageContext: any;\n}\n\nexport class Controller {\n adapter: Adapter = new BrowserAdapter(this);\n\n cache = new LruCache<Snapshot>(10);\n currentVisit?: Visit;\n enabled = true;\n lastRenderedLocation?: Location;\n location!: Location;\n progressBarDelay = 500;\n restorationIdentifier!: string; // This only exists for compatibility with iOS\n started = false;\n pageContext: any;\n\n start() {\n if (!this.started) {\n // TODO: delete document.body in this file. We are doing this to pre-empt VPS interceptor.\n // https://github.com/brillout/vite-plugin-ssr/issues/918 fixes this.\n document.body.addEventListener(\"click\", this.clickCaptured, true);\n this.location = Location.currentLocation;\n this.restorationIdentifier = uuid();\n this.lastRenderedLocation = this.location;\n this.started = true;\n this.enabled = true;\n }\n }\n\n disable() {\n this.enabled = false;\n }\n\n stop() {\n if (this.started) {\n document.body.removeEventListener(\"click\", this.clickCaptured, true);\n this.started = false;\n }\n }\n\n clearCache() {\n this.cache = new LruCache(10);\n }\n\n visit(location: Locatable, options: Partial<VisitOptions> = {}) {\n location = Location.wrap(location);\n if (this.applicationAllowsVisitingLocation(location)) {\n if (this.locationIsVisitable(location)) {\n const action = options.action || \"advance\";\n this.adapter.visitProposedToLocationWithAction(location, action);\n } else {\n window.location.href = location.toString();\n }\n }\n }\n\n startVisitToLocationWithAction(\n location: Locatable,\n action: Action,\n restorationIdentifier?: string\n ) {\n this.startVisit(Location.wrap(location), action);\n }\n\n setProgressBarDelay(delay: number) {\n this.progressBarDelay = delay;\n }\n\n // History delegate\n\n historyPoppedToLocationWithRestorationIdentifier(\n location: Locatable,\n restorationIdentifier: string\n ) {\n if (this.enabled) {\n this.location = Location.wrap(location);\n this.restorationIdentifier = restorationIdentifier;\n this.startVisit(this.location, \"restore\");\n } else {\n this.adapter.pageInvalidated();\n }\n }\n\n // Snapshot cache\n\n getCachedSnapshotForLocation(location: Locatable) {\n return this.cache.get(Location.wrap(location).toCacheKey());\n }\n\n shouldCacheSnapshot() {\n return (\n document.body.querySelector(\"#proxied-body\") &&\n document.head\n .querySelector(\"meta[name='turbolinks-no-cache']\")\n ?.getAttribute(\"content\") != \"no-cache\"\n );\n }\n\n cacheSnapshot() {\n if (this.shouldCacheSnapshot()) {\n this.notifyApplicationBeforeCachingSnapshot();\n const snapshot = {\n bodyEl: document.body.cloneNode(true),\n headEl: document.head.cloneNode(true),\n pageContext: this.pageContext,\n };\n const location = this.lastRenderedLocation || Location.currentLocation;\n defer(() => this.cache.put(location.toCacheKey(), snapshot));\n }\n }\n\n // View\n viewInvalidated() {\n this.adapter.pageInvalidated();\n }\n\n viewWillRender() {\n this.notifyApplicationBeforeRender();\n }\n\n viewRendered() {\n this.lastRenderedLocation = this.currentVisit!.location;\n this.notifyApplicationAfterRender();\n }\n\n // Event handlers\n\n clickCaptured = () => {\n document.body.removeEventListener(\"click\", this.clickBubbled, false);\n document.body.addEventListener(\"click\", this.clickBubbled, false);\n };\n\n clickBubbled = (event: MouseEvent) => {\n if (this.enabled && this.clickEventIsSignificant(event)) {\n const link = this.getVisitableLinkForTarget(event.target);\n if (link) {\n const location = this.getVisitableLocationForLink(link);\n if (\n location &&\n this.applicationAllowsFollowingLinkToLocation(link, location)\n ) {\n event.preventDefault();\n event.stopPropagation();\n const action = this.getActionForLink(link);\n this.visit(location, { action });\n }\n }\n }\n };\n\n // Application events\n\n applicationAllowsFollowingLinkToLocation(link: Element, location: Location) {\n const event = this.notifyApplicationAfterClickingLinkToLocation(\n link,\n location\n );\n return !event.defaultPrevented;\n }\n\n applicationAllowsVisitingLocation(location: Location) {\n const event = this.notifyApplicationBeforeVisitingLocation(location);\n return !event.defaultPrevented;\n }\n\n notifyApplicationAfterClickingLinkToLocation(\n link: Element,\n location: Location\n ) {\n return dispatch(\"turbolinks:click\", {\n target: link,\n data: { url: location.absoluteURL },\n cancelable: true,\n });\n }\n\n notifyApplicationBeforeVisitingLocation(location: Location) {\n return dispatch(\"turbolinks:before-visit\", {\n data: { url: location.absoluteURL },\n cancelable: true,\n });\n }\n\n notifyApplicationAfterVisitingLocation(location: Location) {\n return dispatch(\"turbolinks:visit\", {\n data: { url: location.absoluteURL },\n });\n }\n\n notifyApplicationBeforeCachingSnapshot() {\n return dispatch(\"turbolinks:before-cache\");\n }\n\n notifyApplicationBeforeRender() {\n return dispatch(\"turbolinks:before-render\");\n }\n\n notifyApplicationAfterRender() {\n return dispatch(\"turbolinks:render\");\n }\n\n notifyApplicationAfterPageLoad(timing: TimingData = {}) {\n return dispatch(\"turbolinks:load\", {\n data: { url: this.location.absoluteURL, timing },\n });\n }\n\n // Private\n\n startVisit(location: Location, action: Action) {\n if (this.currentVisit) {\n this.currentVisit.cancel();\n }\n this.currentVisit = this.createVisit(location, action);\n this.currentVisit.start();\n this.notifyApplicationAfterVisitingLocation(location);\n }\n\n createVisit(location: Location, action: Action): Visit {\n const visit = new Visit(this, location, action);\n visit.referrer = this.location;\n if (action === \"restore\") {\n // dont issue navigate() because VPS already did.\n visit.requestInFlight = true;\n }\n return visit;\n }\n\n visitCompleted(visit: Visit) {\n this.notifyApplicationAfterPageLoad(visit.getTimingMetrics());\n }\n\n clickEventIsSignificant(event: MouseEvent) {\n return !(\n (event.target && (event.target as any).isContentEditable) ||\n event.defaultPrevented ||\n event.which > 1 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n );\n }\n\n getVisitableLinkForTarget(target: EventTarget | null) {\n if (target instanceof Element && this.elementIsVisitable(target)) {\n return closest(target, \"a[href]:not([target]):not([download])\");\n }\n }\n\n getVisitableLocationForLink(link: Element) {\n const location = new Location(link.getAttribute(\"href\") || \"\");\n if (this.locationIsVisitable(location)) {\n return location;\n }\n }\n\n getActionForLink(link: Element): Action {\n const action = link.getAttribute(\"data-turbolinks-action\");\n return isAction(action) ? action : \"advance\";\n }\n\n elementIsVisitable(element: Element) {\n const container = closest(element, \"[data-turbolinks]\");\n if (container) {\n return container.getAttribute(\"data-turbolinks\") != \"false\";\n } else {\n return true;\n }\n }\n\n locationIsVisitable(location: Location) {\n return location.isPrefixedBy(new Location(\"/\")) && location.isHTML();\n }\n}\n","import { mergeHead } from \"./mergeHead\";\nimport { Controller, VisitOptions } from \"./controller\";\nimport { Locatable } from \"./location\";\nimport { activateNewBodyScriptElements, focusFirstAutofocusableElement } from \"./util\";\n\nconst controller = new Controller();\n\nexport const Turbolinks = {\n get supported() {\n return true;\n },\n\n controller,\n\n visit(location: Locatable, options?: Partial<VisitOptions>) {\n controller.visit(location, options);\n },\n\n clearCache() {\n controller.clearCache();\n },\n\n setProgressBarDelay(delay: number) {\n controller.setProgressBarDelay(delay);\n },\n\n start() {\n // because this runs after ios hooks, we have to recover. See onRenderHtml\n if (\n window.Turbolinks !== Turbolinks &&\n window.Turbolinks.controller.adapter\n ) {\n (window.Turbolinks.controller.adapter as any).controller = controller;\n controller.adapter = window.Turbolinks.controller.adapter;\n }\n // Tells vite-plugin-ssr not to do link interception\n (window as any)._disableAutomaticLinkInterception = true\n window.Turbolinks = Turbolinks;\n controller.start();\n },\n\n _vpsCachePageContext(pageContext: any) {\n controller.pageContext = pageContext;\n },\n\n _vpsOnRenderClient(\n newHead: HTMLHeadElement,\n trackScripts: boolean,\n executeBodyScripts: boolean,\n renderBody: () => void\n ) {\n if (controller.currentVisit) {\n const { currentVisit } = controller;\n // TODO: move to controller?\n currentVisit.renderFn = async () => {\n const scriptsLoaded = mergeHead(newHead, trackScripts, () =>\n controller.viewInvalidated()\n );\n\n controller.viewWillRender();\n renderBody();\n await scriptsLoaded;\n \n if (executeBodyScripts) {\n activateNewBodyScriptElements(\n Array.from(document.body.querySelectorAll(\"script\"))\n );\n }\n focusFirstAutofocusableElement();\n\n controller.viewRendered();\n controller.adapter.visitRendered(currentVisit);\n };\n\n controller.adapter.visitRequestCompleted(controller.currentVisit);\n controller.adapter.visitRequestFinished(controller.currentVisit);\n } else {\n console.error(\n \"controller.currentVisit should exist when onRenderClient fires\"\n );\n }\n },\n};\n\nexport type Turbolinks = typeof Turbolinks;\n"],"mappings":";AACA,SAAe,YAAY,mBAAmB;AAE9C,IAAI;AAEG,SAAS,YAAY,MAAiB,aAAsB;AACjE,QAAM,YAAY,SAAS,eAAe,WAAW;AACrD,MAAI,aAAa;AACf,WAAO,YAAY,WAAW,IAAI;AAAA,EACpC,OAAO;AACL,QAAI,CAAC,MAAM;AACT,aAAO,WAAW,SAAS;AAAA,IAC7B;AACA,SAAK,OAAO,IAAI;AAAA,EAClB;AACF;;;ACfO,SAAS,MAAS,QAA2B;AAClD,SAAO,MAAM,UAAU,MAAM,KAAK,MAAM;AAC1C;AAEO,IAAM,WAAW,MAAM;AAC5B,QAAM,OAAO,SAAS;AAGtB,QAAM,QACJ,KAAK,WACJ,KAAa,yBACb,KAAa,qBACb,KAAa;AAGhB,QAAMA,WACJ,KAAK,WACL,SAAU,UAAkB;AAC1B,QAAI,UAA0B;AAC9B,WAAO,SAAS;AACd,UAAI,MAAM,KAAK,SAAS,QAAQ,GAAG;AACjC,eAAO;AAAA,MACT,OAAO;AACL,kBAAU,QAAQ;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AAEF,SAAO,SAAU,SAAkB,UAAkB;AACnD,WAAOA,SAAQ,KAAK,SAAS,QAAQ;AAAA,EACvC;AACF,GAAG;AAEI,SAAS,MAAM,UAAqB;AACzC,aAAW,UAAU,CAAC;AACxB;AAQO,SAAS,SACd,WACA,EAAE,QAAQ,YAAY,KAAK,IAA8B,CAAC,GAC1D;AACA,QAAM,QAAQ,SAAS,YAAY,QAAQ;AAC3C,QAAM,UAAU,WAAW,MAAM,cAAc,IAAI;AACnD,QAAM,OAAO,QAAQ,CAAC;AAItB,MAAI,MAAM,cAAc,CAAC,yBAAyB;AAChD,UAAM,EAAE,eAAe,IAAI;AAC3B,UAAM,iBAAiB,WAAY;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AAW,YAAY;AAChE,iBAAW,QAAQ,qBAAqB,WAAW,YAAY;AAAA,IACjE,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["closest","dispatch","controller","controller"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../proxy/pages/restorationVisit/onBeforeRender.tsx"],"sourcesContent":["import { PageContextProxyServer } from \"../../../types/internal.js\";\n\n// In restoration visit, this happens on client.\n// Do nothing. onBeforeRoute handles it all for us.\nexport default async function onBeforeRender() {}\n"],"mappings":";AAIA,eAAO,iBAAwC;AAAC;","names":[]}
|