Skip to content
← Public packages

@kentcdodds/cloudflare-connect-pse-hyperframes

I Built Your Personal Software Ecosystem: Kent C. Dodds's Cloudflare Connect 2026 talk deck, built with HyperFrames. How Kody gives every user one of everything on Cloudflare.

FollowForkOpen app

Files

index.html

458 lines · 19.5 KB · HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="robots" content="noindex">
<meta name="description" content="I Built Your Personal Software Ecosystem. Kent C. Dodds at Cloudflare Connect 2026. Kody on Cloudflare: Worker Loaders, Artifacts, Durable Objects, D1, R2, Vectorize, Queues, Workflows and Email Routing.">
<meta name="theme-color" content="#16191d">
<script>
	;(function () {
		var key = 'pse-theme'
		var saved = null
		try { saved = localStorage.getItem(key) } catch (e) {}
		var mode = saved === 'light' || saved === 'dark' ? saved : (matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark')
		document.documentElement.setAttribute('data-theme', mode)
		document.querySelector('meta[name="theme-color"]').setAttribute('content', mode === 'light' ? '#f6f3ee' : '#16191d')
	})()
</script>
<title>I Built Your Personal Software Ecosystem · Kent C. Dodds · Cloudflare Connect 2026</title>
<link rel="icon" href="favicon.ico">
<script>
	// Kody serves the app at /packages/<name>. Without a trailing slash the composition's
	// relative URL would resolve outside the package, so add one before anything loads.
	;(function () {
		var p = location.pathname
		if (location.protocol !== 'file:' && !p.endsWith('/') && !/\.html$/.test(p)) {
			history.replaceState(null, '', p + '/' + location.search + location.hash)
		}
	})()
</script>
<style>
	* { box-sizing: border-box; margin: 0; padding: 0; }
	:root { --app-w: 100vw; --app-h: 100vh; --app-h: 100dvh; }
	html, body { width: 100%; height: 100%; overflow: hidden; background: #0e1012; overscroll-behavior: none; }
	html[data-theme="light"], html[data-theme="light"] body { background: #f6f3ee; }
	html[data-theme="light"] .fit-toggle { background: rgb(26 24 20 / 0.08); color: #1a1814; border-color: rgb(26 24 20 / 0.16); }
	[data-theme-root] { position: relative; display: inline-flex; }
	[data-theme-menu] { display: none; position: absolute; right: 0; bottom: calc(100% + 8px); flex-direction: column; gap: 2px; padding: 4px; background: rgba(20,20,22,0.92); border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
	[data-theme-menu][data-open] { display: flex; }
	[data-theme-menu] button { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: rgba(255,255,255,0.85); cursor: pointer; }
	[data-theme-menu] button[aria-checked="true"] { background: rgba(255,255,255,0.18); color: #fff; }
	body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
	hyperframes-slideshow { display: block; position: fixed; left: 0; top: 0; width: var(--app-w); height: var(--app-h); outline: none; }
	hyperframes-player { position: absolute; inset: 0; }
	/* Touch lands here, not in the composition iframe: tap the left third to go back, anywhere
	   else to go forward, or swipe. Pinch-zoom stays with the browser. */
	.tapzone { position: absolute; inset: 0; touch-action: pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
	html[data-zoomed] .tapzone { touch-action: auto; }
	/* Portrait phones: the stage can turn sideways to fill the screen. */
	@media (orientation: portrait) {
		html[data-rotated] hyperframes-slideshow { left: 50%; top: 50%; width: var(--app-h); height: var(--app-w); translate: -50% -50%; rotate: 90deg; }
	}
	/* The nav capsule fades while the presenter is idle, so it never sits on a projected slide. */
	hyperframes-slideshow [data-hf-nav-cluster] { transition: opacity 0.4s ease; }
	html[data-idle] hyperframes-slideshow [data-hf-nav-cluster] { opacity: 0; }
	.blackout { position: fixed; inset: 0; z-index: 50; background: #000; display: none; }
	html[data-blackout] .blackout { display: block; }
	.fit-toggle { display: none; }
	@media (orientation: portrait) and (max-width: 700px) {
		.fit-toggle { display: block; position: fixed; left: 50%; translate: -50% 0; top: max(20px, env(safe-area-inset-top)); z-index: 20; background: rgb(255 255 255 / 0.12); color: #e6e9ee; border: 1px solid rgb(255 255 255 / 0.18); border-radius: 999px; padding: 12px 20px; font: 600 15px/1.2 system-ui, sans-serif; transition: opacity 0.4s ease; }
		html[data-idle] .fit-toggle { opacity: 0; pointer-events: none; }
	}
</style>
<script>
/* player.js */
</script>
<script>
/* slideshow.js */
</script>
</head>
<body>
<template id="deck">
	<hyperframes-slideshow tabindex="0" notes-storage-key="cloudflare-connect-pse-hyperframes">
		<hyperframes-player interactive src="composition.html"></hyperframes-player>
		<!-- island -->
	</hyperframes-slideshow>
</template>
<div class="blackout" aria-hidden="true"></div>
<button type="button" class="fit-toggle" data-fit-toggle>Rotate slides</button>
<script>
	;(function () {
		var root = document.documentElement
		var params = new URLSearchParams(location.search)
		var pass = new URLSearchParams()
		;['still', 'soft'].forEach(function (k) {
			if (params.has(k)) pass.set(k, '')
		})
		var fragment = document.getElementById('deck').content.cloneNode(true)
		var player = fragment.querySelector('hyperframes-player')
		var qs = pass.toString()
		if (qs) player.setAttribute('src', 'composition.html?' + qs.replace(/=(&|$)/g, '$1'))
		document.body.prepend(fragment)
		var deck = document.querySelector('hyperframes-slideshow')

		// Clickers send Page Down / Page Up (some send arrows up and down, or B / . to blank).
		// The slideshow owns Left / Right / Space / Backspace / P / F; this adds the rest
		// through its message API.
		function post(msg) {
			window.postMessage(msg, '*')
		}
		function onKey(e) {
			if (e.metaKey || e.ctrlKey || e.altKey) return
			var k = e.key
			if (k === 'PageDown' || k === 'ArrowDown') post({ type: 'next' })
			else if (k === 'PageUp' || k === 'ArrowUp') post({ type: 'prev' })
			else if (k === 'Home') post({ type: 'goto', slideIndex: 0 })
			else if (k === 'End') post({ type: 'goto', slideIndex: total() - 1 })
			else if (k === 'b' || k === 'B' || k === '.') root.toggleAttribute('data-blackout')
			else return
			e.preventDefault()
		}
		window.addEventListener('keydown', onKey)
		function hookFrame() {
			var frame = player.iframeElement
			if (!frame || !frame.contentWindow) return
			try {
				frame.contentWindow.addEventListener('keydown', onKey)
			} catch (err) {}
		}
		player.addEventListener('ready', hookFrame)

		// Light, dark, or system. System is the default and follows the display setting.
		// The choice is stored so it stays as the slides change.
		var themeKey = 'pse-theme'
		var themeChoice = 'system'
		try {
			var savedTheme = localStorage.getItem(themeKey)
			if (savedTheme === 'light' || savedTheme === 'dark' || savedTheme === 'system') themeChoice = savedTheme
		} catch (e) {}
		var themeIcons = {
			light: '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="4"></circle><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"></path></svg>',
			dark: '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z"></path></svg>',
			system: '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><path d="M12 3a9 9 0 0 0 0 18z" fill="currentColor" stroke="none"></path></svg>'
		}
		var themeLabels = { light: 'Light', dark: 'Dark', system: 'System' }
		function themeMode() {
			if (themeChoice === 'light' || themeChoice === 'dark') return themeChoice
			return matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
		}
		function paintTheme() {
			var trigger = deck.querySelector('[data-theme-toggle]')
			var menu = deck.querySelector('[data-theme-menu]')
			var open = !!(menu && menu.hasAttribute('data-open'))
			if (trigger) {
				trigger.innerHTML = themeIcons[themeChoice] || themeIcons.system
				trigger.setAttribute('aria-expanded', open ? 'true' : 'false')
				trigger.setAttribute('aria-label', 'Theme, ' + (themeLabels[themeChoice] || 'System'))
				trigger.setAttribute('title', 'Theme')
				if (open) trigger.removeAttribute('data-hf-tooltip')
				else trigger.setAttribute('data-hf-tooltip', 'Theme')
			}
			var buttons = deck.querySelectorAll('[data-theme-choice]')
			for (var i = 0; i < buttons.length; i++) {
				buttons[i].setAttribute('aria-checked', buttons[i].getAttribute('data-theme-choice') === themeChoice ? 'true' : 'false')
			}
		}
		function setThemeMenu(open) {
			var menu = deck.querySelector('[data-theme-menu]')
			if (!menu) return
			if (open) menu.setAttribute('data-open', '')
			else menu.removeAttribute('data-open')
			paintTheme()
		}
		function applyTheme() {
			var mode = themeMode()
			root.setAttribute('data-theme', mode)
			var meta = document.querySelector('meta[name="theme-color"]')
			if (meta) meta.setAttribute('content', mode === 'light' ? '#f6f3ee' : '#16191d')
			try {
				var frame = player.iframeElement
				if (frame && frame.contentDocument) frame.contentDocument.documentElement.setAttribute('data-theme', mode)
			} catch (e) {}
			paintTheme()
		}
		function mountTheme() {
			var cluster = deck.querySelector('[data-hf-nav-cluster]')
			if (!cluster || cluster.querySelector('[data-theme-root]')) return
			var sample = cluster.querySelector('button')
			var wrap = document.createElement('div')
			wrap.setAttribute('data-theme-root', '')
			var menu = document.createElement('div')
			menu.setAttribute('data-theme-menu', '')
			menu.setAttribute('role', 'menu')
			menu.setAttribute('aria-label', 'Theme')
			;['light', 'dark', 'system'].forEach(function (choice) {
				var item = document.createElement('button')
				item.type = 'button'
				item.setAttribute('role', 'menuitemradio')
				item.setAttribute('data-theme-choice', choice)
				item.setAttribute('aria-label', themeLabels[choice])
				item.setAttribute('title', themeLabels[choice])
				item.setAttribute('data-hf-tooltip', themeLabels[choice])
				item.innerHTML = themeIcons[choice]
				item.addEventListener('click', function (e) {
					e.stopPropagation()
					themeChoice = choice
					try { localStorage.setItem(themeKey, choice) } catch (err) {}
					menu.removeAttribute('data-open')
					applyTheme()
				})
				menu.appendChild(item)
			})
			var trigger = document.createElement('button')
			trigger.type = 'button'
			trigger.setAttribute('data-theme-toggle', '')
			trigger.setAttribute('aria-haspopup', 'menu')
			if (sample) trigger.style.cssText = sample.style.cssText
			trigger.addEventListener('click', function (e) {
				e.stopPropagation()
				setThemeMenu(!menu.hasAttribute('data-open'))
			})
			wrap.appendChild(menu)
			wrap.appendChild(trigger)
			cluster.appendChild(wrap)
			paintTheme()
		}
		document.addEventListener('click', function (e) {
			var themeRoot = deck.querySelector('[data-theme-root]')
			if (!themeRoot || themeRoot.contains(e.target)) return
			setThemeMenu(false)
		})
		document.addEventListener('keydown', function (e) {
			if (e.key === 'Escape') setThemeMenu(false)
		})
		player.addEventListener('ready', applyTheme)
		matchMedia('(prefers-color-scheme: light)').addEventListener('change', function () {
			if (themeChoice === 'system') applyTheme()
		})
		new MutationObserver(mountTheme).observe(deck, { childList: true, subtree: true })
		applyTheme()
		mountTheme()

		// Size the stage to the visible viewport, which shrinks and grows as Android Chrome's
		// toolbar moves. While pinch-zoomed the layout stays put and navigation pauses.
		var vv = window.visualViewport
		function zoomed() {
			return !!vv && vv.scale > 1.01
		}
		function fit() {
			root.toggleAttribute('data-zoomed', zoomed())
			if (zoomed()) return
			root.style.setProperty('--app-w', window.innerWidth + 'px')
			root.style.setProperty('--app-h', (vv ? vv.height : window.innerHeight) + 'px')
		}
		window.addEventListener('resize', fit)
		window.addEventListener('orientationchange', fit)
		if (vv) vv.addEventListener('resize', fit)
		fit()

		var portrait = window.matchMedia('(orientation: portrait)')
		function rotated() {
			return root.hasAttribute('data-rotated') && portrait.matches
		}

		// Taps and swipes. A tap on the left third goes back, anywhere else goes forward; a
		// horizontal swipe steps either way. In the rotated portrait fit the slide's x axis runs
		// down the screen, so gestures are read in slide space.
		var zone = document.createElement('div')
		zone.className = 'tapzone'
		zone.setAttribute('aria-hidden', 'true')
		player.after(zone)
		;['touchstart', 'touchend'].forEach(function (n) {
			zone.addEventListener(n, function (e) {
				e.stopPropagation()
			}, { passive: true })
		})
		var gesture = null
		var pointers = 0
		zone.addEventListener('pointerdown', function (e) {
			if (e.pointerType === 'mouse') return
			pointers++
			if (pointers > 1 || zoomed()) {
				if (gesture) gesture.multi = true
				return
			}
			gesture = { id: e.pointerId, x: e.clientX, y: e.clientY, t: Date.now(), multi: false }
		})
		function release(e) {
			if (e.pointerType === 'mouse') return
			pointers = Math.max(0, pointers - 1)
			var g = gesture
			if (!g || e.pointerId !== g.id) return
			gesture = null
			if (e.type === 'pointercancel' || g.multi || zoomed()) return
			var turn = rotated()
			var dx = turn ? e.clientY - g.y : e.clientX - g.x
			var dy = turn ? g.x - e.clientX : e.clientY - g.y
			if (Math.abs(dx) > 40 && Math.abs(dx) > Math.abs(dy) * 1.2) return post({ type: dx < 0 ? 'next' : 'prev' })
			if (Math.abs(dx) < 14 && Math.abs(dy) < 14 && Date.now() - g.t < 700) {
				var r = zone.getBoundingClientRect()
				var at = turn ? (e.clientY - r.top) / r.height : (e.clientX - r.left) / r.width
				post({ type: at < 1 / 3 ? 'prev' : 'next' })
			}
		}
		zone.addEventListener('pointerup', release)
		zone.addEventListener('pointercancel', release)

		// Full screen on a phone also turns the slides sideways where the browser allows it.
		function lockLandscape() {
			var o = screen.orientation
			return o && o.lock ? o.lock('landscape') : Promise.reject(new Error('no orientation lock'))
		}
		document.addEventListener('fullscreenchange', function () {
			if (document.fullscreenElement && window.matchMedia('(pointer: coarse)').matches) lockLandscape().catch(function () {})
		})
		var toggle = document.querySelector('[data-fit-toggle]')
		function label() {
			toggle.textContent = root.hasAttribute('data-rotated') ? 'Upright slides' : 'Rotate slides'
		}
		toggle.addEventListener('click', function () {
			if (root.hasAttribute('data-rotated')) {
				root.removeAttribute('data-rotated')
				return label()
			}
			var full = deck.requestFullscreen ? deck.requestFullscreen() : Promise.reject(new Error('no fullscreen'))
			full.then(lockLandscape).catch(function () {
				if (document.fullscreenElement) document.exitFullscreen().catch(function () {})
				root.setAttribute('data-rotated', '')
				label()
			})
		})

		// Hide the nav capsule after a few idle seconds; any pointer or key brings it back.
		var idleTimer = 0
		function wake() {
			root.removeAttribute('data-idle')
			clearTimeout(idleTimer)
			idleTimer = setTimeout(function () {
				root.setAttribute('data-idle', '')
			}, 2500)
		}
		;['pointermove', 'pointerdown', 'keydown', 'touchstart'].forEach(function (n) {
			window.addEventListener(n, wake, { passive: true })
		})
		wake()

		// #12 opens slide 12. #12.3 opens that slide on step 3. The hash follows
		// the deck, so a reload lands on the same slide and the same step.
		// Audience mode paints the nav without the slide counter, so the place
		// comes from the controller. The counter label is only a fallback.
		function slides() {
			var c = deck.controller
			if (!c || typeof c.slidesOf !== 'function') return null
			var list = c.slidesOf('main')
			return list && list.length ? list : null
		}
		function counter() {
			var here = placeNow()
			if (here) return { index: here.slide, total: slides().length }
			var el = deck.querySelector('[data-hf-counter]')
			var m = el && /Slide (\d+) of (\d+)/.exec(el.getAttribute('aria-label') || '')
			return m ? { index: Number(m[1]), total: Number(m[2]) } : null
		}
		function total() {
			var list = slides()
			return list ? list.length : 1
		}
		function parsePlace(hash) {
			var m = /^#(\d+)(?:\.(\d+))?$/.exec(hash || '')
			if (!m) return null
			var slide = Number(m[1])
			if (!slide) return null
			return { slide: slide, step: m[2] == null ? 0 : Number(m[2]) }
		}
		function placeNow() {
			var c = deck.controller
			var list = slides()
			if (!c || !c.position || !list) return null
			var index = c.position.slideIndex
			if (typeof index !== 'number' || index < 0 || index >= list.length) return null
			var frag = c.position.fragmentIndex
			var step = typeof frag === 'number' && frag > 0 ? frag : 0
			return { slide: index + 1, index: index, step: step }
		}
		function clamped(place) {
			var list = slides()
			var totalSlides = list ? list.length : place.slide
			var slide = Math.min(Math.max(place.slide, 1), totalSlides)
			var index = slide - 1
			var step = place.step
			var spec = list && list[index]
			var n = spec && spec.fragments ? spec.fragments.length : 0
			step = n > 0 ? Math.min(Math.max(step, 0), n - 1) : 0
			return { slide: slide, index: index, step: step }
		}
		function writePlace(slide, step) {
			var h = '#' + slide + (step > 0 ? '.' + step : '')
			if (location.hash !== h) history.replaceState(null, '', location.pathname + location.search + h)
		}
		var target = parsePlace(location.hash)
		var settled = !target
		var syncing = false
		var again = false
		var watching = false
		// The slideshow previous control jumps to the prior slide. A slide with
		// steps should step back first, so #10.2 goes to #10.1.
		function armPrev() {
			var c = deck.controller
			if (!c || c.__stepPrev || typeof c.prev !== 'function' || typeof c.resumeSlide !== 'function') return
			var orig = c.prev.bind(c)
			c.prev = function () {
				var pos = c.position
				if (pos && typeof pos.fragmentIndex === 'number' && pos.fragmentIndex > 0) {
					c.resumeSlide(pos.slideIndex, pos.fragmentIndex - 1)
					return
				}
				return orig()
			}
			c.__stepPrev = true
		}
		function sync() {
			if (syncing) {
				again = true
				return
			}
			syncing = true
			try {
				armPrev()
				var c = deck.controller
				if (c && !watching && typeof c.onChange === 'function') {
					watching = true
					c.onChange(sync)
				}
				var here = placeNow()
				if (!here) return
				if (!settled && target) {
					var want = clamped(target)
					if (here.index !== want.index || here.step !== want.step) {
						if (c && typeof c.resumeSlide === 'function') c.resumeSlide(want.index, want.step)
						else post({ type: 'goto', slideIndex: want.index })
						return
					}
					settled = true
				}
				if (settled) writePlace(here.slide, here.step)
			} finally {
				syncing = false
				if (again) {
					again = false
					sync()
				}
			}
		}
		new MutationObserver(sync).observe(deck, { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ['aria-label'] })
		player.addEventListener('ready', sync)
		window.addEventListener('hashchange', function () {
			var next = parsePlace(location.hash)
			var here = placeNow()
			if (next && here && next.slide === here.slide && next.step === here.step) return
			target = next
			settled = !target
			sync()
		})
		window.__deckShell = { counter: counter }
	})()
</script>
</body>
</html>