@popcraft/runtime 0.22.0 → 0.23.1
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/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -863,7 +863,7 @@ function createSiteClient(base = "") {
|
|
|
863
863
|
const res = await fetch(`${data(id)}?id=${encodeURIComponent(recordId)}`, { method: "DELETE", credentials: "same-origin" });
|
|
864
864
|
if (!res.ok) throw await refusal(res, "That could not be removed. Try again.");
|
|
865
865
|
},
|
|
866
|
-
submit: (form) => fetch(`${root}/${FORM_ENDPOINT}`, { method: "POST", headers: json, body: JSON.stringify({ form: form.id, name: form.name, values: form.values }) }).then((r) => r.
|
|
866
|
+
submit: (form) => fetch(`${root}/${FORM_ENDPOINT}`, { method: "POST", headers: json, body: JSON.stringify({ form: form.id, name: form.name, values: form.values }) }).then((r) => r.ok, () => false)
|
|
867
867
|
};
|
|
868
868
|
}
|
|
869
869
|
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/expressions.ts", "../src/prototype.ts", "../src/machine.ts", "../src/controls.ts", "../src/site/contract.ts", "../src/client.ts", "../src/physics.ts", "../src/platformer-dom.ts"],
|
|
4
|
-
"sourcesContent": ["// What PopCraft's expressions mean: the values they work with, how operators treat them, and every function they may\n// call. One implementation, used by the editor (lib/document/expressions.ts parses and evaluates with it) and by code\n// exported from PopCraft (an exported app's compiled expressions call these), so an expression gives the same answer\n// on the canvas, on a published site and in an exported project.\n\nexport type ExprValue = number | string | boolean | object\n\n/** A record as the adding-up functions read it: its values by field key, and when it was made (ms). */\nexport interface ExprRow { values: Record<string, unknown>; at?: number }\n/** A collection's records by its name (any case); undefined when there is none of that name. */\nexport interface ExprData { rows(collection: string): readonly ExprRow[] | undefined }\n\n/** Thrown when an expression asks for something that is not there (a collection, here); the caller decides what that means. */\nexport class ExprMissing extends Error {}\n\nexport const num = (v: ExprValue): number => {\n if (typeof v === 'number') return Number.isFinite(v) ? v : 0\n if (typeof v === 'boolean') return v ? 1 : 0\n if (typeof v === 'string') { const n = Number(v); return Number.isFinite(n) ? n : 0 }\n return 0\n}\nexport const truthy = (v: ExprValue): boolean => (typeof v === 'string' ? v !== '' && v !== 'false' : typeof v === 'object' ? true : num(v) !== 0)\n/** A value as words: whole numbers as they are, others to at most 4 places with trailing zeros dropped. */\nexport const exprText = (v: ExprValue): string => (typeof v === 'number' ? (Number.isInteger(v) ? String(v) : String(Number(v.toFixed(4)))) : typeof v === 'object' ? '' : String(v))\nexport const finite = (n: number) => (Number.isFinite(n) ? n : 0)\n\nconst DAY = 86_400_000\n/** The local calendar day a moment falls on, as a whole number that goes up by one a day. */\nexport const dayOf = (ms: number) => { const d = new Date(ms); return Math.floor(new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime() / DAY + 0.5) }\nexport const keyOf = (name: ExprValue) => exprText(name).toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '')\n/**\n * The records of `collection` that hold for every `field, value` pair in `pairs` (none: all of them). A file with\n * no such collection \u2014 or a place with no records to read, the canvas \u2014 is an error, so the layer keeps what it was\n * drawn with rather than saying 0.\n */\nfunction rowsOf(data: ExprData | undefined, collection: ExprValue, pairs: ExprValue[]): readonly ExprRow[] {\n const rows = data?.rows(exprText(collection))\n if (!rows) throw new ExprMissing(`No collection \"${exprText(collection)}\"`)\n if (pairs.length < 2) return rows\n return rows.filter(r => { for (let i = 0; i + 1 < pairs.length; i += 2) if (!same(r.values[keyOf(pairs[i])] as ExprValue ?? '', pairs[i + 1])) return false; return true })\n}\n/** Made on or after the day `days` before today (0: today). A record that does not say when counts as today's. */\nconst since = (rows: readonly ExprRow[], days: ExprValue) => { const from = dayOf(Date.now()) - Math.max(0, Math.round(num(days))); return rows.filter(r => r.at === undefined || dayOf(r.at) >= from) }\nconst total = (rows: readonly ExprRow[], field: ExprValue) => { const k = keyOf(field); return finite(rows.reduce((t, r) => t + (Number(r.values[k]) || 0), 0)) }\n\n/** Every function an expression may call: arguments already worked out, and the records it may add up. */\nexport const FUNCTIONS: Record<string, (a: ExprValue[], data?: ExprData) => ExprValue> = {\n /** How many records: `count(\"Trips\")`, `count(\"Trips\", \"status\", \"Booked\")` (each pair is a field and its value). */\n count: (a, data) => rowsOf(data, a[0], a.slice(1)).length,\n /** A number field added up: `sum(\"Sessions\", \"minutes\")`, `sum(\"Sessions\", \"minutes\", \"kind\", \"Run\")`. */\n sum: (a, data) => total(rowsOf(data, a[0], a.slice(2)), a[1]),\n /** How many different values a field has: `distinct(\"Dishes\", \"by\")` is how many people are cooking. */\n distinct: (a, data) => { const k = keyOf(a[1]); return new Set(rowsOf(data, a[0], a.slice(2)).map(r => exprText(r.values[k] as ExprValue ?? ''))).size },\n /** The largest value of a number field: `best(\"Sessions\", \"minutes\")`. */\n best: (a, data) => { const k = keyOf(a[1]); return rowsOf(data, a[0], a.slice(2)).reduce((m, r) => Math.max(m, Number(r.values[k]) || 0), 0) },\n /** Records made in the last days: `countSince(\"Sessions\", 6)` is this week, `countSince(\"Checks\", 0, \"habit\", item_id)` today's. */\n countSince: (a, data) => since(rowsOf(data, a[0], a.slice(2)), a[1]).length,\n /** Records made on one day, counted back from today: `countOn(\"Checks\", 1, \"habit\", item_name)` is yesterday's. */\n countOn: (a, data) => { const day = dayOf(Date.now()) - Math.max(0, Math.round(num(a[1]))); return rowsOf(data, a[0], a.slice(2)).filter(r => dayOf(r.at ?? Date.now()) === day).length },\n /** A number field added up over the last days: `sumSince(\"Sessions\", \"minutes\", 6)`. */\n sumSince: (a, data) => total(since(rowsOf(data, a[0], a.slice(3)), a[2]), a[1]),\n /** Days in a row with a record, up to today (or yesterday, while today is still open): `streak(\"Checks\", \"habit\", item_id)`. */\n streak: (a, data) => {\n const days = new Set(rowsOf(data, a[0], a.slice(1)).map(r => dayOf(r.at ?? Date.now())))\n let d = dayOf(Date.now())\n if (!days.has(d)) d -= 1\n let n = 0\n while (days.has(d)) { n++; d-- }\n return n\n },\n /** Today as words: `today()` \u2192 \"Friday 2 October\". */\n today: () => new Date().toLocaleDateString(undefined, { weekday: 'long', day: 'numeric', month: 'long' }),\n min: a => Math.min(...a.map(num)),\n max: a => Math.max(...a.map(num)),\n clamp: a => Math.min(Math.max(num(a[0]), num(a[1])), num(a[2])),\n abs: a => Math.abs(num(a[0])),\n sign: a => Math.sign(num(a[0])),\n floor: a => Math.floor(num(a[0])),\n ceil: a => Math.ceil(num(a[0])),\n round: a => { const d = Math.max(0, Math.min(6, Math.round(num(a[1] ?? 0)))); const f = 10 ** d; return Math.round(num(a[0]) * f) / f },\n sqrt: a => finite(Math.sqrt(Math.max(0, num(a[0])))),\n pow: a => finite(num(a[0]) ** num(a[1])),\n /** Linear blend from a to b by t (0\u20261). */\n mix: a => num(a[0]) + (num(a[1]) - num(a[0])) * num(a[2]),\n /** A whole random number from lo to hi inclusive (a crit roll, a loot drop). */\n random: a => { const lo = Math.ceil(num(a[0] ?? 0)), hi = Math.floor(num(a[1] ?? 1)); return lo + Math.floor(Math.random() * (hi - lo + 1)) },\n /** The clock, in ms (a cooldown: `usedAt = now()`, then `now() - usedAt >= 3000`). */\n now: () => Date.now(),\n /** The value as text. */\n text: a => exprText(a[0] ?? ''),\n /** A whole number zero-padded to `n` digits: `pad(420, 6)` \u2192 \"000420\". */\n pad: a => { const n = Math.round(num(a[0])); const s = String(Math.abs(n)).padStart(Math.max(0, Math.min(12, num(a[1] ?? 0))), '0'); return n < 0 ? `-${s}` : s },\n /** A number with exactly `d` decimals: `fixed(12.5, 2)` \u2192 \"12.50\". */\n fixed: a => num(a[0]).toFixed(Math.max(0, Math.min(6, Math.round(num(a[1] ?? 0))))),\n /** A number with thousands separators: `group(12500)` \u2192 \"12,500\". */\n group: a => Math.round(num(a[0])).toLocaleString('en-US'),\n /** Milliseconds (or seconds with `s`) as a clock: `clock(83450)` \u2192 \"1:23.45\". */\n clock: a => { const ms = Math.max(0, num(a[0])); const m = Math.floor(ms / 60000), s = Math.floor(ms / 1000) % 60, cs = Math.floor(ms / 10) % 100; return `${m}:${String(s).padStart(2, '0')}.${String(cs).padStart(2, '0')}` },\n /** Text length. */\n len: a => exprText(a[0] ?? '').length,\n upper: a => exprText(a[0] ?? '').toUpperCase(),\n}\n\n/** `==`: text compares as text, numbers as numbers. */\nexport const same = (a: ExprValue, b: ExprValue) => (typeof a === 'string' || typeof b === 'string' ? exprText(a) === exprText(b) : typeof a === 'object' || typeof b === 'object' ? JSON.stringify(a) === JSON.stringify(b) : num(a) === num(b))\n\n/** The operators, as expressions use them: `+` joins text, dividing by zero is 0, `%` is never negative. */\nexport const ops = {\n add: (a: ExprValue, b: ExprValue): ExprValue => (typeof a === 'string' || typeof b === 'string' ? exprText(a) + exprText(b) : finite(num(a) + num(b))),\n sub: (a: ExprValue, b: ExprValue) => finite(num(a) - num(b)),\n mul: (a: ExprValue, b: ExprValue) => finite(num(a) * num(b)),\n div: (a: ExprValue, b: ExprValue) => (num(b) === 0 ? 0 : finite(num(a) / num(b))),\n mod: (a: ExprValue, b: ExprValue) => { const m = num(b); return m === 0 ? 0 : ((num(a) % m) + m) % m },\n lt: (a: ExprValue, b: ExprValue) => num(a) < num(b),\n le: (a: ExprValue, b: ExprValue) => num(a) <= num(b),\n gt: (a: ExprValue, b: ExprValue) => num(a) > num(b),\n ge: (a: ExprValue, b: ExprValue) => num(a) >= num(b),\n eq: (a: ExprValue, b: ExprValue) => same(a, b),\n ne: (a: ExprValue, b: ExprValue) => !same(a, b),\n neg: (a: ExprValue) => -num(a),\n not: (a: ExprValue) => !truthy(a),\n}\n", "// The player for an exported prototype: popcraftMount(root, spec) keeps each state machine's state, sets every\n// element's look for it with smart animate's glide, and wires the interactions (click, hover, press, drag to orbit,\n// after a delay, keys). What it reads is data the exporter writes (lib/io/web/interactive.ts in PopCraft).\n// Exported React imports it; PopCraft's standalone HTML export inlines the same code, compiled from this file.\n/* eslint-disable */\n\nfunction popcraftMount(root: any, spec: any) {\n var els: any = {}, state: any = {}, owned: any = {}, orbit: any = {}, last: any = {}, holds: any = {}, hist: any = [], timers: any = [];\n var nodes: any = [root].concat(Array.prototype.slice.call(root.querySelectorAll('[data-pc]')));\n nodes.forEach(function (el: any) { els[el.getAttribute('data-pc')] = el; });\n for (var m in spec.m) state[m] = spec.m[m];\n for (var u in spec.e) (owned[spec.e[u][0]] = owned[spec.e[u][0]] || []).push(u);\n var drags: any = {}, clicks: any = {};\n spec.on.forEach(function (o: any) { if (o[3] === 'drag') drags[o[0]] = 1; if (o[3] === 'click' || o[3] === 'press') clicks[o[0]] = 1; });\n function lookIn(u: any, st: any) { var e = spec.e[u]; if (!e) return -2; var i = e[1][st === undefined ? state[e[0]] : st]; return i === undefined ? -1 : i; }\n function tf(f: any, o: any) {\n var ry = f[4] + (o ? o.ry : 0), rx = f[5] + (o ? o.rx : 0), p = [];\n if (f[0] || f[1] || f[2]) p.push(f[2] ? 'translate3d(' + f[0] + 'px, ' + f[1] + 'px, ' + f[2] + 'px)' : 'translate(' + f[0] + 'px, ' + f[1] + 'px)');\n if (f[3]) p.push('rotate(' + f[3] + 'deg)');\n if (ry) p.push('rotateY(' + ry + 'deg)');\n if (rx) p.push('rotateX(' + rx + 'deg)');\n if (f[6] !== 1 || f[7] !== 1) p.push('scale(' + f[6] + ', ' + f[7] + ')');\n return p.length ? p.join(' ') : 'none';\n }\n function css(u: any, i: any) {\n var L = spec.L[i], c = L[0];\n if (orbit[u] && L[2]) c += ';transform:' + tf(L[2], orbit[u]);\n if (drags[u]) c += ';touch-action:none;user-select:none;-webkit-user-select:none';\n if (clicks[u]) c += ';cursor:pointer';\n return c;\n }\n // Out of the flow too: in an auto-layout frame a layer that is not showing must not hold its place, or the\n // layers of the screen that is showing are pushed down past the frame's edge.\n var HIDE = ';opacity:0;visibility:hidden;pointer-events:none;position:absolute';\n function set(u: any, ms: any, ez: any) {\n var el = els[u], i = lookIn(u, undefined);\n if (!el || i === -2) return;\n var tr = ms ? ';transition:all ' + ms + 'ms ' + ez : ';transition:none';\n if (i < 0) { el.style.cssText = (last[u] || '') + HIDE + tr; return; }\n var c = css(u, i), text = spec.L[i][1];\n if (text !== null && el.textContent !== text) el.textContent = text;\n if (ms && el.style.visibility === 'hidden') { el.style.cssText = c + ';opacity:0;transition:none'; void el.offsetWidth; }\n el.style.cssText = c + tr;\n last[u] = c;\n }\n var ANIM = /(?:^|;)animation:[^;]*/;\n function anim(i: any) { var m = i >= 0 ? ANIM.exec(spec.L[i][0]) : null; return m ? m[0] : ''; }\n function go(m: any, to: any, ms: any, ez: any, fromHistory: any) {\n if (!(m in state) || state[m] === to) return;\n var list = owned[m] || [];\n // What is mid-animation and plays something else in the new state glides on from where it is now.\n list.forEach(function (u: any) {\n var a = lookIn(u, undefined), b = lookIn(u, to), el = els[u];\n if (!el || a < 0 || !anim(a) || anim(a) === anim(b)) return;\n var cs = getComputedStyle(el);\n el.style.cssText = css(u, a) + ';animation:none;transition:none;transform:' + cs.transform + ';opacity:' + cs.opacity;\n });\n void root.offsetWidth;\n if (m === 'flow' && !fromHistory) hist.push(state[m]);\n state[m] = to;\n list.forEach(function (u: any) { set(u, ms, ez); });\n arm();\n }\n function active(u: any, trig: any) { return spec.on.filter(function (o: any) { return String(o[0]) === String(u) && o[3] === trig && state[o[1]] === o[2]; }); }\n function run(o: any, u: any) {\n var a = o[4];\n if (a.k === 'go') {\n if (a.hold) { if (!holds[u]) holds[u] = { m: a.m, back: state[a.m], ms: a.ms, ez: a.ez }; }\n go(a.m, a.to, a.ms, a.ez, false);\n } else if (a.k === 'back' && hist.length) {\n go(a.m, hist.pop(), 300, 'ease-in-out', true);\n }\n }\n function release(u: any) { var h = holds[u]; if (!h) return; delete holds[u]; go(h.m, h.back, h.ms, h.ez, true); }\n function chain(el: any) {\n var out: string[] = [];\n for (var n = el; n && n !== root.parentNode; n = n.parentNode) { var id = n.getAttribute && n.getAttribute('data-pc'); if (id !== null && id !== undefined) out.push(id); if (n === root) break; }\n return out;\n }\n function first(ids: any, trig: any) { for (var i = 0; i < ids.length; i++) { var a = active(ids[i], trig); if (a.length) return { u: ids[i], list: a }; } return null; }\n function arm() {\n timers.forEach(clearTimeout); timers = [];\n spec.on.forEach(function (o: any) { if (o[3] === 'timeout' && state[o[1]] === o[2]) timers.push(setTimeout(function () { if (state[o[1]] === o[2]) run(o, o[0]); }, o[5])); });\n }\n // Hover: the elements under the pointer, compared with the last move's.\n var over: any = [];\n function hover(ids: any) {\n var left = over.filter(function (u: any) { return ids.indexOf(u) < 0; }), entered = ids.filter(function (u: any) { return over.indexOf(u) < 0; });\n over = ids;\n left.forEach(function (u: any) { release(u); active(u, 'leave').forEach(function (o: any) { run(o, u); }); });\n entered.slice().reverse().forEach(function (u: any) { active(u, 'hover').concat(active(u, 'enter')).forEach(function (o: any) { run(o, u); }); });\n }\n var press: any = null;\n function onMove(e: any) {\n if (press) {\n var dx = e.clientX - press.x, dy = e.clientY - press.y;\n if (!press.dragged && Math.abs(dx) + Math.abs(dy) > 5) {\n press.dragged = true;\n var d = first(press.ids, 'drag');\n if (d) { var du = d.u; press.drag = d; d.list.forEach(function (o: any) { if (o[4].k !== 'orbit') run(o, du); }); }\n if (press.held) { release(press.held); press.held = null; }\n }\n if (press.drag) {\n // Screen px to the design's px: the root may be drawn scaled.\n var k = root.getBoundingClientRect().width / (root.offsetWidth || 1) || 1;\n press.drag.list.forEach(function (o: any) {\n var a = o[4]; if (a.k !== 'orbit') return;\n // Across turns the orbited element; down tilts the tilt element (a group holding it), within the range.\n var cur = orbit[a.t] || { rx: 0, ry: 0 };\n orbit[a.t] = { rx: cur.rx, ry: cur.ry + ((e.clientX - press.lx) / k) * a.d };\n if (a.tilt) { var tc = orbit[a.tt] || { rx: 0, ry: 0 }; orbit[a.tt] = { ry: tc.ry, rx: Math.max(a.lo, Math.min(a.hi, tc.rx - ((e.clientY - press.ly) / k) * a.d)) }; }\n set(a.t, 0, 'linear');\n if (a.tt !== a.t) set(a.tt, 0, 'linear');\n });\n press.lx = e.clientX; press.ly = e.clientY;\n return;\n }\n }\n hover(chain(e.target));\n }\n function onDown(e: any) {\n var ids = chain(e.target);\n press = { x: e.clientX, y: e.clientY, lx: e.clientX, ly: e.clientY, ids: ids, dragged: false, drag: null, held: null };\n if (first(ids, 'drag') && root.setPointerCapture) { try { root.setPointerCapture(e.pointerId); } catch (err) { /* not capturable */ } }\n var p = first(ids, 'press');\n if (p) { var pu = p.u; press.held = pu; p.list.forEach(function (o: any) { run(o, pu); }); }\n }\n function onUp(e: any) {\n var p = press; press = null;\n if (!p) return;\n if (p.held) release(p.held);\n if (p.dragged) return;\n var c = first(p.ids, 'click');\n if (c) { var cu = c.u; c.list.forEach(function (o: any) { run(o, cu); }); }\n void e;\n }\n function onLeave() { if (!press) hover([]); }\n function onKey(e: any) { spec.on.forEach(function (o: any) { if (o[3] === 'key' && state[o[1]] === o[2] && (!o[6] || o[6].toLowerCase() === String(e.key).toLowerCase())) run(o, o[0]); }); }\n for (var id in els) set(id, 0, 'linear');\n root.addEventListener('pointermove', onMove);\n root.addEventListener('pointerdown', onDown);\n root.addEventListener('pointerup', onUp);\n root.addEventListener('pointercancel', onUp);\n root.addEventListener('pointerleave', onLeave);\n window.addEventListener('keydown', onKey);\n arm();\n return function () {\n timers.forEach(clearTimeout);\n root.removeEventListener('pointermove', onMove); root.removeEventListener('pointerdown', onDown); root.removeEventListener('pointerup', onUp);\n root.removeEventListener('pointercancel', onUp); root.removeEventListener('pointerleave', onLeave); window.removeEventListener('keydown', onKey);\n };\n}\n\nexport { popcraftMount }\n", "// The player for a frame's state machine: popcraftMachine(root, spec) runs the machine (its states, guards, actions\n// and inputs) and plays the frame's timeline between its markers as the machine moves. Data from PopCraft's exporter\n// (lib/io/web/state-machine.ts). Exported React imports it; the standalone HTML export inlines it, compiled from here.\n/* eslint-disable */\n\nfunction popcraftMachineCore(spec: any) {\n function start(id: any) { var t = spec.in[id]; return !t || t[0] === 'event' ? undefined : t[1]; }\n function holds(g: any, values: any, fired: any) {\n var t = spec.in[g[0]];\n if (!t) return false;\n if (t[0] === 'event') return !!fired[g[0]];\n var v = g[0] in values ? values[g[0]] : start(g[0]), w = g[2];\n switch (g[1]) {\n case 'eq': return v === w;\n case 'neq': return v !== w;\n case 'gt': return typeof v === 'number' && typeof w === 'number' && v > w;\n case 'gte': return typeof v === 'number' && typeof w === 'number' && v >= w;\n case 'lt': return typeof v === 'number' && typeof w === 'number' && v < w;\n case 'lte': return typeof v === 'number' && typeof w === 'number' && v <= w;\n }\n return false;\n }\n function apply(values: any, actions: any) {\n var out: any = {}, fired: any = {};\n for (var k in values) out[k] = values[k];\n actions.forEach(function (a: any) {\n var t = spec.in[a[1]];\n if (!t) return;\n var cur = a[1] in out ? out[a[1]] : start(a[1]), by = typeof a[2] === 'number' ? a[2] : 1;\n if (a[0] === 'set') { if (t[0] === 'event') fired[a[1]] = 1; else if (a.length > 2 && typeof a[2] === typeof cur) out[a[1]] = a[2]; }\n else if (a[0] === 'toggle') { if (typeof cur === 'boolean') out[a[1]] = !cur; }\n else if (a[0] === 'increment') { if (typeof cur === 'number') out[a[1]] = cur + by; }\n else if (a[0] === 'decrement') { if (typeof cur === 'number') out[a[1]] = cur - by; }\n else if (a[0] === 'fire') { if (t[0] === 'event') fired[a[1]] = 1; }\n else if (a[0] === 'reset') { var s = start(a[1]); if (s === undefined) delete out[a[1]]; else out[a[1]] = s; }\n });\n return { values: out, fired: fired };\n }\n function next(r: any, fired: any) {\n var own = spec.t.filter(function (t: any) { return t[0] === r.state; });\n var any = spec.t.filter(function (t: any) { return t[0] === '*' && t[1] !== r.state; });\n var all = own.concat(any);\n for (var i = 0; i < all.length; i++) {\n var t = all[i];\n if (spec.s[t[1]] && t[2].every(function (g: any) { return holds(g, r.values, fired); })) return t;\n }\n return null;\n }\n function enter(r: any, id: any) {\n var res = apply(r.values, spec.s[id] ? spec.s[id][4] : []);\n return { run: { state: id, values: res.values }, fired: res.fired };\n }\n function settle(r: any, fired: any) {\n var cur = r, ev = fired || {};\n for (var i = 0; i < 16; i++) { var t = next(cur, ev); if (!t) break; var n = enter(cur, t[1]); cur = n.run; ev = n.fired; }\n return cur;\n }\n function begin() {\n var first = spec.s[spec.i] ? spec.i : Object.keys(spec.s)[0], values: any = {};\n if (first === undefined) return null;\n for (var k in spec.in) { var s = start(k); if (s !== undefined) values[k] = s; }\n var e = enter({ state: first, values: values }, first);\n return settle(e.run, e.fired);\n }\n function hears(l: any, type: any, chain: any, key?: any) {\n if (l[0] !== type) return false;\n if (type === 'complete') return true;\n if (type === 'keyDown' || type === 'keyUp') return !l[3] || String(l[3]).toLowerCase() === String(key).toLowerCase();\n return l[1] === null || chain.indexOf(l[1]) >= 0;\n }\n function dispatch(r: any, type: any, chain: any, key?: any) {\n var heard = spec.l.filter(function (l: any) { return hears(l, type, chain, key); });\n if (!heard.length) return r;\n var res = apply(r.values, [].concat.apply([], heard.map(function (l: any) { return l[2]; })));\n return settle({ state: r.state, values: res.values }, res.fired);\n }\n function set(r: any, id: any, value: any) {\n var t = spec.in[id];\n if (!t) return r;\n var res = apply(r.values, [t[0] === 'event' ? ['fire', id] : ['set', id, value]]);\n return settle({ state: r.state, values: res.values }, res.fired);\n }\n return { begin: begin, dispatch: dispatch, set: set };\n}\nfunction popcraftMachine(root: any, spec: any) {\n var core = popcraftMachineCore(spec), run = core.begin(), anims: any = [], t0 = 0, done = false, raf = 0, over: any = [];\n if (!run) return function () {};\n function chain(el: any) {\n var out: string[] = [];\n for (var n = el; n && n !== root.parentNode; n = n.parentNode) { var id = n.getAttribute && n.getAttribute('data-sm'); if (id) out.push(id); if (n === root) break; }\n return out;\n }\n function update(r: any) {\n if (r === run) return;\n var changed = r.state !== run.state;\n run = r;\n if (!changed) return;\n t0 = performance.now(); done = false;\n root.dispatchEvent(new CustomEvent('popcraft:state', { detail: { state: r.state, name: spec.s[r.state] ? spec.s[r.state][5] : r.state, values: r.values } }));\n }\n function tick(now: any) {\n var s = spec.s[run.state];\n if (s) {\n var a = s[0], b = s[1], played = Math.max(0, now - t0) * s[3], t: number;\n if (s[2] && b > a) t = a + (played % (b - a));\n else {\n t = Math.min(b, a + played);\n if (!done && a + played >= b) { done = true; update(core.dispatch(run, 'complete', [])); }\n }\n anims.forEach(function (x: any) { x.currentTime = t; });\n }\n raf = requestAnimationFrame(tick);\n }\n function on(type: any) { return function (e: any) { update(core.dispatch(run, type, chain(e.target))); }; }\n function onMove(e: any) {\n var ids = chain(e.target);\n var left = over.filter(function (u: any) { return ids.indexOf(u) < 0; }), entered = ids.filter(function (u: any) { return over.indexOf(u) < 0; });\n over = ids;\n if (left.length) update(core.dispatch(run, 'pointerExit', left));\n if (entered.length) update(core.dispatch(run, 'pointerEnter', entered));\n }\n function onLeave() { if (over.length) { var left = over; over = []; update(core.dispatch(run, 'pointerExit', left)); } }\n function onKey(type: any) {\n return function (e: any) {\n var t = e.target;\n if (e.repeat || e.metaKey || e.ctrlKey || (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable))) return;\n var r = core.dispatch(run, type, [], e.key);\n if (r !== run) { e.preventDefault(); update(r); }\n };\n }\n var down = on('pointerDown'), up = on('pointerUp'), click = on('click'), keyDown = onKey('keyDown'), keyUp = onKey('keyUp');\n anims = root.getAnimations ? root.getAnimations({ subtree: true }) : [];\n anims.forEach(function (x: any) { x.pause(); });\n t0 = performance.now();\n root.addEventListener('pointerdown', down);\n root.addEventListener('pointerup', up);\n root.addEventListener('click', click);\n root.addEventListener('pointermove', onMove);\n root.addEventListener('pointerleave', onLeave);\n window.addEventListener('keydown', keyDown);\n window.addEventListener('keyup', keyUp);\n raf = requestAnimationFrame(tick);\n function byName(k: any) { if (spec.in[k]) return k; for (var id in spec.in) if (spec.in[id][2] === k) return id; return k; }\n var api = {\n state: function () { return run.state; },\n values: function () { return run.values; },\n set: function (input: any, value: any) { update(core.set(run, byName(input), value)); },\n fire: function (input: any) { update(core.set(run, byName(input), undefined)); },\n destroy: function () {\n cancelAnimationFrame(raf);\n root.removeEventListener('pointerdown', down); root.removeEventListener('pointerup', up); root.removeEventListener('click', click);\n root.removeEventListener('pointermove', onMove); root.removeEventListener('pointerleave', onLeave);\n window.removeEventListener('keydown', keyDown); window.removeEventListener('keyup', keyUp);\n },\n };\n root.popcraftMachine = api;\n return api.destroy;\n}\n\nexport { popcraftMachine, popcraftMachineCore }\n", "// What an exported app calls for the interactions that act on the page itself rather than on React state: switching a\n// variable mode (a theme), controlling a frame's timeline (its CSS animations), and turning a layer in 3D by\n// dragging it. Plain DOM, no framework: exported React calls these from its event handlers.\n\n/**\n * Put `root` (the document element) in one mode of a collection: `classes` are every mode's class of that collection\n * ('' for the default mode, which has none), `to` the one to switch to, or '__NEXT__' for the one after the current.\n * Returns the class now on.\n */\nexport function switchMode(root: Element, classes: readonly string[], to: string): string {\n const now = classes.find(c => c && root.classList.contains(c)) ?? ''\n const next = to === '__NEXT__' ? classes[(classes.indexOf(now) + 1) % classes.length] ?? '' : to\n for (const c of classes) if (c) root.classList.remove(c)\n if (next) root.classList.add(next)\n return next\n}\n\nexport interface TimelineControlSpec {\n /** Whose timeline: the screen's (default) or a motion instance's (the caller finds the element). */\n target?: 'FRAME' | 'INSTANCE'\n op: 'PLAY' | 'PAUSE' | 'TOGGLE' | 'SEEK' | 'SCRUB'\n /** SEEK: a time (ms), or the next / previous marker. */\n to?: number | 'NEXT' | 'PREV'\n /** The ms range a seek or a scrub stays within (default: the whole timeline). */\n span?: [number, number]\n /** SCRUB: the drag axis, the px that cover the span (negative: left / up moves on), what happens on release. */\n axis?: 'X' | 'Y'\n distance?: number\n release?: 'HOLD' | 'SNAP' | 'PLAY'\n /** SEEK and SNAP: how long the glide takes (ms). */\n glide?: number\n}\n\nconst animationsOf = (root: Element) => root.getAnimations({ subtree: true })\nconst timeOf = (root: Element) => Number(animationsOf(root)[0]?.currentTime ?? 0)\nfunction goTo(root: Element, ms: number, glide = 0) {\n const anims = animationsOf(root)\n if (!glide) { for (const a of anims) { a.pause(); a.currentTime = ms } return }\n const from = timeOf(root), t0 = performance.now()\n const step = (now: number) => {\n const k = Math.min(1, (now - t0) / glide), e = 1 - (1 - k) ** 3\n for (const a of anims) { a.pause(); a.currentTime = from + (ms - from) * e }\n if (k < 1) requestAnimationFrame(step)\n }\n requestAnimationFrame(step)\n}\n\n/**\n * Play, pause, toggle or seek the timeline of `root` (a screen, or a motion instance): its CSS animations, as the\n * exporter wrote them. `markers` are the timeline's markers (ms), for seeking to the next or previous one.\n */\nexport function controlTimeline(root: Element | null, control: TimelineControlSpec, markers: readonly number[] = []): void {\n if (!root) return\n const anims = animationsOf(root)\n const [lo, hi] = control.span ?? [0, Number(anims[0]?.effect?.getComputedTiming().duration ?? 0)]\n switch (control.op) {\n case 'PLAY': for (const a of anims) a.play(); return\n case 'PAUSE': for (const a of anims) a.pause(); return\n case 'TOGGLE': for (const a of anims) (a.playState === 'running' ? a.pause() : a.play()); return\n case 'SEEK': {\n const now = timeOf(root)\n const to = control.to === 'NEXT' ? markers.find(m => m > now + 1) ?? hi : control.to === 'PREV' ? [...markers].reverse().find(m => m < now - 1) ?? lo : Math.min(hi, Math.max(lo, Number(control.to ?? lo)))\n goTo(root, to, control.glide ?? 350)\n }\n }\n}\n\n/** A SCRUB: from a pointer press on `handle`, a drag moves `root`'s timeline across its span; release as asked. */\nexport function scrubTimeline(down: PointerEvent, root: Element | null, control: TimelineControlSpec, markers: readonly number[] = []): void {\n if (!root) return\n const handle = down.currentTarget as Element\n const box = handle.getBoundingClientRect()\n const axis = control.axis ?? 'X'\n const anims = animationsOf(root)\n const [lo, hi] = control.span ?? [0, Number(anims[0]?.effect?.getComputedTiming().duration ?? 0)]\n const distance = control.distance ?? (axis === 'X' ? box.width : box.height)\n const start = timeOf(root), origin = axis === 'X' ? down.clientX : down.clientY\n for (const a of anims) a.pause()\n const move = (e: PointerEvent) => {\n const moved = (axis === 'X' ? e.clientX : e.clientY) - origin\n goTo(root, Math.min(hi, Math.max(lo, start + (moved / (distance || 1)) * (hi - lo))))\n }\n const up = () => {\n window.removeEventListener('pointermove', move)\n window.removeEventListener('pointerup', up)\n if (control.release === 'PLAY') for (const a of animationsOf(root)) a.play()\n if (control.release === 'SNAP' && markers.length) { const now = timeOf(root); goTo(root, markers.reduce((b, m) => (Math.abs(m - now) < Math.abs(b - now) ? m : b)), control.glide ?? 350) }\n }\n window.addEventListener('pointermove', move)\n window.addEventListener('pointerup', up)\n}\n\n/** How a drag turns a layer: degrees per px, and a vertical drag that tilts it (or `tiltLayerId`, a layer holding it). */\nexport interface OrbitSpec { degreesPerPx?: number; tilt?: boolean; tiltRange?: [number, number]; tiltLayerId?: string }\n\n/** An ORBIT_3D drag: from a press on `el`, dragging turns it about its vertical axis (and tilts it, when asked). */\nexport function orbitDrag(down: PointerEvent, el: HTMLElement | null, spec: OrbitSpec = {}): void {\n if (!el) return\n const per = spec.degreesPerPx ?? 0.4\n const [tlo, thi] = spec.tiltRange ?? [-30, 30]\n // Its own transform, read once, so turns add to where it was drawn rather than to the last turn.\n const base = el.dataset.pcBase ?? (el.dataset.pcBase = getComputedStyle(el).transform === 'none' ? '' : getComputedStyle(el).transform)\n // The tilt goes to the layer it names (a group holding the object, so it tilts toward the viewer whichever way the\n // object has turned, as a trackball does), else to the turned layer itself.\n const tiltEl = (spec.tiltLayerId ? document.querySelector<HTMLElement>(`[data-pc-id$=\"${spec.tiltLayerId}\"]`) : null) ?? el\n const tiltBase = tiltEl === el ? '' : (tiltEl.dataset.pcBase ?? (tiltEl.dataset.pcBase = getComputedStyle(tiltEl).transform === 'none' ? '' : getComputedStyle(tiltEl).transform))\n const x0 = down.clientX, y0 = down.clientY\n let turn = Number(el.dataset.pcTurn ?? 0), tilt = Number(tiltEl.dataset.pcTilt ?? 0)\n const t0 = turn, k0 = tilt\n const move = (e: PointerEvent) => {\n turn = t0 + (e.clientX - x0) * per\n if (spec.tilt) tilt = Math.min(thi, Math.max(tlo, k0 - (e.clientY - y0) * per))\n if (tiltEl === el) el.style.transform = `${base} rotateY(${turn}deg)${spec.tilt ? ` rotateX(${tilt}deg)` : ''}`\n else { el.style.transform = `${base} rotateY(${turn}deg)`; if (spec.tilt) tiltEl.style.transform = `${tiltBase} rotateX(${tilt}deg)` }\n }\n const up = () => {\n el.dataset.pcTurn = String(turn)\n tiltEl.dataset.pcTilt = String(tilt)\n window.removeEventListener('pointermove', move)\n window.removeEventListener('pointerup', up)\n }\n window.addEventListener('pointermove', move)\n window.addEventListener('pointerup', up)\n}\n", "// The contract between a PopCraft site's pages and the host that serves them: the addresses a page asks (sign-in at\n// `_pc/auth/\u2026`, a visitor's records at `_pc/data/<collection>`), what each may send, and what comes back. PopCraft's\n// site host, an exported Next.js project's route handlers and the browser client all follow it, from this one file.\n\n/** A field's key: what a form names it by and a record keeps it under (`Good thing` \u2192 `good_thing`). */\nexport const fieldKey = (name: string): string => name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'field'\n\n/** A collection as the contract needs it: its fields, and whose its records are. */\nexport interface CollectionField { id: string; name: string; type: string; options?: string[] }\nexport interface Collection { id: string; name: string; fields: CollectionField[]; perVisitor?: boolean; shared?: boolean }\n\n\n/** Under the site's own origin. */\nexport const AUTH_ENDPOINT = '_pc/auth'\nexport type AuthAction = 'signUp' | 'signIn' | 'signOut' | 'updateAccount' | 'changePassword' | 'deleteAccount' | 'forgotPassword' | 'resetPassword'\nexport const AUTH_ACTIONS: readonly AuthAction[] = ['signUp', 'signIn', 'signOut', 'updateAccount', 'changePassword', 'deleteAccount', 'forgotPassword', 'resetPassword']\nexport const AUTH_PATHS: Record<AuthAction | 'session', string> = { signUp: 'sign-up', signIn: 'sign-in', signOut: 'sign-out', updateAccount: 'update', changePassword: 'password', deleteAccount: 'delete', forgotPassword: 'forgot', resetPassword: 'reset', session: 'session' }\n/** The page a reset link in an email opens (the site's own): it carries `?token=`, which the reset form sends back. */\nexport const RESET_PATH = '/reset-password'\n\n/** The visitor, as the site knows them. */\nexport interface SiteUser { id: string; name: string; email: string }\nexport interface SessionReply { user: SiteUser | null }\n\n/** The site's own cookie: the session's token, readable by no script. */\nexport const SESSION_COOKIE = 'pc_session'\nexport const SESSION_MAX_AGE = 60 * 60 * 24 * 7\n\nexport const AUTH_LIMITS = { name: 80, email: 254, passwordMin: 8, passwordMax: 128 }\n\n/** What a visitor typed into a sign-up or sign-in form, checked, or why it will not do (words a visitor can read). */\nexport function cleanCredentials(action: 'signUp' | 'signIn', raw: unknown): { ok: true; name: string; email: string; password: string } | { ok: false; error: string } {\n const v = raw && typeof raw === 'object' ? raw as Record<string, unknown> : {}\n const email = typeof v.email === 'string' ? v.email.trim().toLowerCase() : ''\n const password = typeof v.password === 'string' ? v.password : ''\n const name = typeof v.name === 'string' ? v.name.trim() : ''\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email) || email.length > AUTH_LIMITS.email) return { ok: false, error: 'Enter your email address.' }\n if (action === 'signUp' && password.length < AUTH_LIMITS.passwordMin) return { ok: false, error: `Choose a password of at least ${AUTH_LIMITS.passwordMin} characters.` }\n if (!password || password.length > AUTH_LIMITS.passwordMax) return { ok: false, error: 'Enter your password.' }\n if (name.length > AUTH_LIMITS.name) return { ok: false, error: 'That name is too long.' }\n // A sign-up with no name field is still a person: the part of their address before the @ stands in.\n return { ok: true, name: name || email.split('@')[0], email, password }\n}\n\nconst text = (v: unknown) => (typeof v === 'string' ? v : '')\nconst fields = (raw: unknown) => (raw && typeof raw === 'object' ? raw as Record<string, unknown> : {})\ntype Checked<T> = ({ ok: true } & T) | { ok: false; error: string }\nconst newPassword = (v: unknown): Checked<{ password: string }> => {\n const password = text(v)\n if (password.length < AUTH_LIMITS.passwordMin) return { ok: false, error: `Choose a password of at least ${AUTH_LIMITS.passwordMin} characters.` }\n if (password.length > AUTH_LIMITS.passwordMax) return { ok: false, error: 'That password is too long.' }\n return { ok: true, password }\n}\n\n/** A new name for the account (a form field named `name`). */\nexport function cleanName(raw: unknown): Checked<{ name: string }> {\n const name = text(fields(raw).name).trim()\n if (!name) return { ok: false, error: 'Enter a name.' }\n return name.length > AUTH_LIMITS.name ? { ok: false, error: 'That name is too long.' } : { ok: true, name }\n}\n/** A change of password: the one in use (`password`) and the new one (`new_password`). */\nexport function cleanPasswordChange(raw: unknown): Checked<{ current: string; password: string }> {\n const v = fields(raw)\n const current = text(v.password)\n if (!current || current.length > AUTH_LIMITS.passwordMax) return { ok: false, error: 'Enter your current password.' }\n const next = newPassword(v.new_password)\n return next.ok ? { ok: true, current, password: next.password } : next\n}\n/** The address a reset link is asked for (`email`). */\nexport function cleanEmail(raw: unknown): Checked<{ email: string }> {\n const email = text(fields(raw).email).trim().toLowerCase()\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email) && email.length <= AUTH_LIMITS.email ? { ok: true, email } : { ok: false, error: 'Enter your email address.' }\n}\n/** A reset: the token the emailed link carried, and the new password (`new_password`). */\nexport function cleanReset(raw: unknown): Checked<{ token: string; password: string }> {\n const v = fields(raw)\n const token = text(v.token)\n if (!/^[\\w.~-]{8,4096}$/.test(token)) return { ok: false, error: 'That reset link is not complete. Open it from the email again.' }\n const next = newPassword(v.new_password)\n return next.ok ? { ok: true, token, password: next.password } : next\n}\n\n/** The variables a site reads its visitor from, when the file has them (by name): set on load and as they sign in or out. */\n// Each ends in a word of its own (`userName`, not `name`): an expression names a variable by its last word, and a\n// file's brand kit already has a `name`.\nexport const USER_VARIABLES = { signedIn: 'user/signedIn', name: 'user/userName', email: 'user/userEmail', error: 'user/signInError' } as const\n\n\n\n/** Under the site's own origin, followed by the collection's id. */\nexport const DATA_ENDPOINT = '_pc/data'\nexport const RECORD_LIMITS = { textChars: 5000, perVisitor: 2000, list: 500 }\n\n/** A record as it travels: its id, when it was made, and its values by field key (`fieldKey(field.name)`). */\nexport interface SiteRecord {\n id: string; createdAt: string; values: Record<string, string | number | boolean | null>\n /** A shared collection's record: who made it, and whether that is the visitor asking. */\n by?: string; mine?: boolean\n}\n\nfunction coerce(field: CollectionField, raw: unknown): { ok: true; value: string | number | boolean | null } | { ok: false; error: string } {\n if (raw === undefined || raw === null || raw === '') return { ok: true, value: field.type === 'BOOLEAN' ? false : null }\n if (field.type === 'NUMBER') {\n const n = typeof raw === 'number' ? raw : Number(raw)\n return Number.isFinite(n) ? { ok: true, value: n } : { ok: false, error: `\"${field.name}\" is a number` }\n }\n if (field.type === 'BOOLEAN') return { ok: true, value: raw === true || raw === 'true' || raw === 'yes' || raw === 'on' || raw === '1' }\n if (typeof raw !== 'string') return { ok: false, error: `\"${field.name}\" is text` }\n if (raw.length > RECORD_LIMITS.textChars) return { ok: false, error: `\"${field.name}\" is too long` }\n if (field.type === 'OPTION' && field.options?.length && !field.options.includes(raw)) return { ok: false, error: `\"${field.name}\" is one of: ${field.options.join(', ')}` }\n return { ok: true, value: raw }\n}\n\n/**\n * What a visitor sent as a record of `collection`: only its fields are kept (by key), each as its type. A form's\n * values are text, so a number or a tick box arrives as words and is read as what the field is.\n */\nexport function cleanRecord(collection: Collection, raw: unknown): { ok: true; values: SiteRecord['values'] } | { ok: false; error: string } {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return { ok: false, error: 'Not a record' }\n const sent = raw as Record<string, unknown>\n const values: SiteRecord['values'] = {}\n for (const field of collection.fields) {\n const key = fieldKey(field.name)\n const got = coerce(field, sent[key])\n if (!got.ok) return got\n values[key] = got.value\n }\n return { ok: true, values }\n}\n\n/** The file's collections a site's visitors have their own records of, by id. */\nexport function visitorCollections<C extends Collection>(collections: Record<string, C> | undefined): C[] {\n return Object.values(collections ?? {}).filter(c => c.perVisitor)\n}\n\n// \u2500\u2500 Forms \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// A site's visitors are strangers, so a submission is cut to size here before anything is stored.\n\nexport const SUBMISSION_LIMITS = { fields: 50, nameChars: 80, valueChars: 5000, totalChars: 64_000, formChars: 120 }\n\n/** The path a site posts a form to, on its own origin. */\nexport const FORM_ENDPOINT = '_pc/form'\n/** A field no person fills: a submission that has it is dropped (and told it was kept). */\nexport const HONEYPOT = '_pc_hp'\n\nexport interface FormPost { form: string; name?: string; values: Record<string, string> }\n\n/** `raw` as a submission that may be stored, or the reason it may not. */\nexport function cleanSubmission(raw: unknown): { ok: true; form: string; name: string; values: Record<string, string>; spam: boolean } | { ok: false; error: string } {\n if (!raw || typeof raw !== 'object') return { ok: false, error: 'Not a form submission' }\n const { form, name, values } = raw as Partial<FormPost>\n if (typeof form !== 'string' || !form || form.length > SUBMISSION_LIMITS.formChars) return { ok: false, error: 'A submission names its form' }\n if (!values || typeof values !== 'object' || Array.isArray(values)) return { ok: false, error: 'A submission has values' }\n const entries = Object.entries(values)\n if (entries.length > SUBMISSION_LIMITS.fields) return { ok: false, error: `A form sends up to ${SUBMISSION_LIMITS.fields} fields` }\n const out: Record<string, string> = {}\n let total = 0\n let spam = false\n for (const [k, v] of entries) {\n if (typeof v !== 'string') return { ok: false, error: 'A value is text' }\n if (k === HONEYPOT) { spam = spam || v !== ''; continue }\n if (!k || k.length > SUBMISSION_LIMITS.nameChars) return { ok: false, error: 'A field name is too long' }\n if (v.length > SUBMISSION_LIMITS.valueChars) return { ok: false, error: `\"${k}\" is too long` }\n total += k.length + v.length\n out[k] = v\n }\n if (total > SUBMISSION_LIMITS.totalChars) return { ok: false, error: 'The submission is too large' }\n return { ok: true, form, name: typeof name === 'string' ? name.slice(0, SUBMISSION_LIMITS.formChars) : '', values: out, spam }\n}\n", "// What a site's pages ask of their own server: who is signed in, signing up, in and out (and the account), a visitor's\n// own records, and keeping a form. A published PopCraft site and an exported project both ask through this, at the\n// paths the site contract names (`_pc/\u2026` on the site's own origin), answered by `siteRequest`.\n\nimport { AUTH_ENDPOINT, AUTH_PATHS, DATA_ENDPOINT, FORM_ENDPOINT, type AuthAction, type SessionReply, type SiteRecord, type SiteUser } from './site/contract'\n\nexport interface SiteClient {\n /** Who is signed in now (null: nobody, or a site with no sign-in). */\n who(): Promise<SiteUser | null>\n /** Sign up or in with what a form holds, or sign out. Resolves to the visitor (null once signed out); rejects with words a visitor can read. */\n act(action: AuthAction, values: Record<string, string>): Promise<SiteUser | null>\n /** The visitor's own records of a collection, newest first (none when signed out). */\n records(collectionId: string): Promise<SiteRecord[]>\n /** Add a record, or change one of theirs (`recordId`). Rejects with words a visitor can read. */\n save(collectionId: string, values: Record<string, string | number | boolean | null>, recordId?: string): Promise<void>\n remove(collectionId: string, recordId: string): Promise<void>\n /** Keep a form: true when the site kept it (false when it keeps nothing, or could not be reached). */\n submit(form: { id: string; name?: string; values: Record<string, string> }): Promise<boolean>\n}\n\n/** A client for the site at `base` (its path on this origin: '' at the root). */\nexport function createSiteClient(base = ''): SiteClient {\n const root = base.replace(/\\/+$/, '')\n const at = (path: string) => `${root}/${AUTH_ENDPOINT}/${path}`\n const data = (collection: string) => `${root}/${DATA_ENDPOINT}/${encodeURIComponent(collection)}`\n const json = { 'content-type': 'application/json' }\n const refusal = async (res: Response, fallback: string) => new Error(((await res.json().catch(() => ({}))) as { error?: string }).error || fallback)\n return {\n who: () => fetch(at(AUTH_PATHS.session), { credentials: 'same-origin' }).then(r => (r.ok ? (r.json() as Promise<SessionReply>) : { user: null }), () => ({ user: null })).then(r => r.user ?? null),\n async act(action, values) {\n // A reset carries the token the emailed link put in the address.\n const token = action === 'resetPassword' && typeof location !== 'undefined' ? { token: new URLSearchParams(location.search).get('token') ?? new URLSearchParams(location.hash.slice(1)).get('access_token') ?? '' } : {}\n const res = await fetch(at(AUTH_PATHS[action]), { method: 'POST', credentials: 'same-origin', headers: json, body: JSON.stringify(action === 'signOut' ? {} : { name: values.name, email: values.email, password: values.password, new_password: values.new_password, ...token }) })\n if (!res.ok) throw await refusal(res, 'That did not work. Try again.')\n return ((await res.json().catch(() => ({}))) as SessionReply).user ?? null\n },\n async records(id) {\n const res = await fetch(data(id), { credentials: 'same-origin' }).catch(() => null)\n return res?.ok ? ((await res.json()) as { records: SiteRecord[] }).records : []\n },\n async save(id, values, recordId) {\n const res = await fetch(data(id), { method: 'POST', credentials: 'same-origin', headers: json, body: JSON.stringify(recordId ? { id: recordId, values } : { values }) })\n if (!res.ok) throw await refusal(res, 'That could not be saved. Try again.')\n },\n async remove(id, recordId) {\n const res = await fetch(`${data(id)}?id=${encodeURIComponent(recordId)}`, { method: 'DELETE', credentials: 'same-origin' })\n if (!res.ok) throw await refusal(res, 'That could not be removed. Try again.')\n },\n submit: form => fetch(`${root}/${FORM_ENDPOINT}`, { method: 'POST', headers: json, body: JSON.stringify({ form: form.id, name: form.name, values: form.values }) }).then(r => r.status === 201, () => false),\n }\n}\n", "// A platformer's physics: the pure step that moves a player through a level \u2014 gravity, running, jumping (with\n// coyote time and a jump buffer, so a jump pressed a moment early or late still happens), landing on solid ground,\n// bumping heads and walls, one-way platforms, collecting, dying on hazards and finishing at the goal.\n//\n// No DOM and no clock: `stepPlatformer(world, input, dt)` takes the world and returns the next one, so the editor's\n// Present mode and a published site (each with its own frame loop and its own way of drawing) move the same player\n// the same way. Coordinates are the screen's: x right, y down, in px; times in seconds.\n\nexport type PhysicsRole = 'player' | 'solid' | 'platform' | 'collectible' | 'hazard' | 'goal'\n\nexport interface PhysicsBox { id: string; x: number; y: number; w: number; h: number }\n\n/** A hazard that walks `distance` px right of where it is drawn and back, at `speed` px/s. */\nexport interface Patrol { distance: number; speed?: number }\n\n/** A hazard: a box, and maybe a patrol. */\nexport interface HazardBox extends PhysicsBox { patrol?: Patrol; stomp?: boolean }\n\n/** A block: hit from below it bumps, and pays `reward` coins the first time. */\nexport interface Bump { reward?: number; reveal?: string }\nexport interface SolidBox extends PhysicsBox { bump?: Bump }\n\n/** How long a bumped block takes to rise and settle (s), and how high it goes (px). */\nexport const BUMP_TIME = 0.18\nexport const BUMP_HEIGHT = 12\n\n/** What the player is doing, for the layers that show it (a run cycle, a jump). */\nexport type PlayerMotion = 'idle' | 'run' | 'jump'\n\nexport interface PlatformerSettings {\n /** px/s\u00B2 downward. */\n gravity: number\n /** Top running speed, px/s. */\n speed: number\n /** How fast the player reaches top speed on the ground, px/s\u00B2. */\n accel: number\n /** Jump take-off speed, px/s. Releasing the jump early cuts the rise short (a variable-height jump). */\n jump: number\n /** Fastest fall, px/s. */\n maxFall: number\n /** A jump still works this long after running off an edge (s). */\n coyote: number\n /** A jump pressed this long before landing happens on landing (s). */\n buffer: number\n}\n\nexport const PLATFORMER_DEFAULTS: PlatformerSettings = { gravity: 2600, speed: 420, accel: 3200, jump: 980, maxFall: 1400, coyote: 0.1, buffer: 0.12 }\n\nexport interface PlatformerLevel {\n player: PhysicsBox\n solids: SolidBox[]\n /** Stood on from above; jumped up through from below. */\n platforms: PhysicsBox[]\n collectibles: PhysicsBox[]\n hazards: HazardBox[]\n goal: PhysicsBox | null\n /** Falling below this y is a death (the level's bottom edge). */\n floor: number\n settings: PlatformerSettings\n}\n\nexport interface PlatformerInput { left: boolean; right: boolean; jump: boolean }\n\nexport interface PlatformerWorld {\n level: PlatformerLevel\n x: number\n y: number\n vx: number\n vy: number\n grounded: boolean\n /** Which way the player faces: 1 right, -1 left. */\n facing: 1 | -1\n /** Seconds since last on the ground (coyote time). */\n air: number\n /** Seconds since the jump was pressed, while it waits to be used (jump buffer). */\n queued: number\n jumpHeld: boolean\n collected: string[]\n deaths: number\n won: boolean\n /** Seconds the game has run: where the patrolling hazards are. */\n t: number\n /** Hazards stomped on (gone). */\n defeated: string[]\n /** Blocks bumped, and when they were last (for the bounce). */\n bumped: Record<string, number>\n /** Coins from blocks, on top of the collected ones. */\n bonus: number\n}\n\nexport type PlatformerEvent = { type: 'stomp'; id: string } | { type: 'bump'; id: string; reward: number } | { type: 'jump' } | { type: 'land' } | { type: 'collect'; id: string } | { type: 'die' } | { type: 'win' }\n\nexport function createPlatformer(level: PlatformerLevel): PlatformerWorld {\n return { level, x: level.player.x, y: level.player.y, vx: 0, vy: 0, grounded: false, facing: 1, air: 0, queued: Infinity, jumpHeld: false, collected: [], deaths: 0, won: false, t: 0, defeated: [], bumped: {}, bonus: 0 }\n}\n\nconst PATROL_SPEED = 80\n\n/** How far a hazard has walked from where it was drawn at `t` seconds, and which way it faces. */\nexport function patrolAt(patrol: Patrol | undefined, t: number): { dx: number; facing: 1 | -1 } {\n const d = patrol?.distance ?? 0\n if (!(d > 0)) return { dx: 0, facing: 1 }\n const p = (t * Math.max(1, patrol!.speed ?? PATROL_SPEED)) % (2 * d)\n return p < d ? { dx: p, facing: 1 } : { dx: 2 * d - p, facing: -1 }\n}\n\n/** How high a bumped block is lifted at the world's time (0 once it has settled). */\nexport function bumpLift(world: PlatformerWorld, id: string): number {\n const at = world.bumped[id]\n if (at === undefined) return 0\n const k = (world.t - at) / BUMP_TIME\n return k >= 0 && k < 1 ? Math.sin(k * Math.PI) * BUMP_HEIGHT : 0\n}\n\n/** Every patrolling hazard's offset now. */\nexport function hazardOffsets(world: PlatformerWorld): { id: string; dx: number; facing: 1 | -1 }[] {\n return world.level.hazards.filter(h => h.patrol).map(h => ({ id: h.id, ...patrolAt(h.patrol, world.t) }))\n}\n\n/** In the air, running, or standing still. */\nexport function playerMotion(world: PlatformerWorld): PlayerMotion {\n if (!world.grounded) return 'jump'\n return Math.abs(world.vx) > 20 ? 'run' : 'idle'\n}\n\nconst overlaps = (a: { x: number; y: number; w: number; h: number }, b: PhysicsBox) =>\n a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y\n\nconst approach = (v: number, to: number, by: number) => (v < to ? Math.min(to, v + by) : Math.max(to, v - by))\n\n/** The longest a single step integrates; a longer frame (a hidden tab coming back) is taken in pieces. */\nconst MAX_DT = 1 / 120\n\n/** Advance the world by `dt` seconds of `input`. Returns the new world and what happened. */\nexport function stepPlatformer(world: PlatformerWorld, input: PlatformerInput, dt: number): { world: PlatformerWorld; events: PlatformerEvent[] } {\n const events: PlatformerEvent[] = []\n let w = world\n let left = Math.min(Math.max(0, dt), 0.25)\n while (left > 0 && !w.won) {\n const h = Math.min(MAX_DT, left)\n w = substep(w, input, h, events)\n left -= h\n }\n return { world: w, events }\n}\n\nfunction substep(world: PlatformerWorld, input: PlatformerInput, dt: number, events: PlatformerEvent[]): PlatformerWorld {\n const { level } = world\n const s = level.settings\n const pw = level.player.w, ph = level.player.h\n let { x, y, vx, vy, grounded, facing, air, queued, collected, deaths, defeated, bumped, bonus } = world\n const t = world.t + dt\n\n // Run: toward the held direction's top speed, slower to turn in the air.\n const dir = (input.right ? 1 : 0) - (input.left ? 1 : 0)\n if (dir) facing = dir > 0 ? 1 : -1\n vx = approach(vx, dir * s.speed, s.accel * (grounded ? 1 : 0.65) * dt)\n\n // Jump: a fresh press is queued for `buffer`; it fires while on the ground or within `coyote` of leaving it.\n const pressed = input.jump && !world.jumpHeld\n queued = pressed ? 0 : queued + dt\n air = grounded ? 0 : air + dt\n if (queued <= s.buffer && air <= s.coyote) {\n vy = -s.jump\n grounded = false\n air = s.coyote + 1\n queued = Infinity\n events.push({ type: 'jump' })\n }\n // Let go early and the rise is cut short.\n if (!input.jump && vy < -s.jump * 0.4) vy = -s.jump * 0.4\n\n vy = Math.min(s.maxFall, vy + s.gravity * dt)\n\n // Move one axis at a time, so a corner never lets the player through a wall.\n x += vx * dt\n for (const b of level.solids) {\n if (!overlaps({ x, y, w: pw, h: ph }, b)) continue\n x = vx > 0 ? b.x - pw : b.x + b.w\n vx = 0\n }\n const wasGrounded = grounded\n const before = y\n y += vy * dt\n grounded = false\n for (const b of level.solids) {\n if (!overlaps({ x, y, w: pw, h: ph }, b)) continue\n if (vy > 0) { y = b.y - ph; grounded = true } else {\n y = b.y + b.h\n // A head under a block bumps it (only the block most under the head, once per hit).\n if (b.bump && vy < 0 && x + pw / 2 >= b.x - pw / 2 && x + pw / 2 <= b.x + b.w + pw / 2) {\n const first = !(b.id in bumped)\n const reward = first ? b.bump.reward ?? 0 : 0\n bumped = { ...bumped, [b.id]: t }\n bonus += reward\n events.push({ type: 'bump', id: b.id, reward })\n }\n }\n vy = 0\n }\n // One-way platforms: only from above, only when the feet were above the top last step.\n if (vy >= 0) for (const b of level.platforms) {\n if (before + ph <= b.y + 0.5 && y + ph >= b.y && x + pw > b.x && x < b.x + b.w) { y = b.y - ph; vy = 0; grounded = true }\n }\n if (grounded && !wasGrounded) events.push({ type: 'land' })\n\n const me = { x, y, w: pw, h: ph }\n for (const c of level.collectibles) {\n if (!collected.includes(c.id) && overlaps(me, c)) { collected = [...collected, c.id]; events.push({ type: 'collect', id: c.id }) }\n }\n let won: boolean = world.won\n if (level.goal && overlaps(me, level.goal)) { won = true; events.push({ type: 'win' }) }\n // A hazard touched: stomped when it can be and the feet came down onto its top half, else a death.\n let hurt = false\n for (const hz of level.hazards) {\n if (defeated.includes(hz.id)) continue\n const at = { ...hz, x: hz.x + patrolAt(hz.patrol, t).dx }\n if (!overlaps(me, at)) continue\n if (hz.stomp && vy > 0 && before + ph <= at.y + at.h / 2) {\n defeated = [...defeated, hz.id]\n vy = -s.jump * 0.55\n grounded = false\n air = s.coyote + 1\n events.push({ type: 'stomp', id: hz.id })\n } else hurt = true\n }\n if (!won && (y > level.floor || hurt)) {\n // Back to the start; what was collected stays collected.\n events.push({ type: 'die' })\n return { ...world, x: level.player.x, y: level.player.y, vx: 0, vy: 0, grounded: false, air: 0, queued: Infinity, jumpHeld: input.jump, facing: 1, collected, deaths: deaths + 1, won, t, defeated, bumped, bonus }\n }\n return { ...world, x, y, vx, vy, grounded, facing, air, queued, jumpHeld: input.jump, collected, deaths, won, t, defeated, bumped, bonus }\n}\n\n// \u2500\u2500 The level, from layers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** A layer as the physics sees it: its box on the screen and the role it plays (`physics` on the layer). */\nexport interface PhysicsLayer extends PhysicsBox { role: PhysicsRole; patrol?: Patrol; stomp?: boolean; bump?: Bump }\n\n/**\n * A level from a screen's layers. One player (the first); the rest by role. Settings start from the defaults and\n * take the screen's own. The floor is a little below the lowest thing in the level.\n */\nexport function levelFromLayers(layers: readonly PhysicsLayer[], settings: Partial<PlatformerSettings> = {}, height?: number): PlatformerLevel | null {\n const player = layers.find(l => l.role === 'player')\n if (!player) return null\n const of = (r: PhysicsRole) => layers.filter(l => l.role === r).map(({ id, x, y, w, h }) => ({ id, x, y, w, h }))\n const bottom = Math.max(height ?? 0, ...layers.map(l => l.y + l.h))\n return {\n player: { id: player.id, x: player.x, y: player.y, w: player.w, h: player.h },\n solids: layers.filter(l => l.role === 'solid').map(({ id, x, y, w, h, bump }) => ({ id, x, y, w, h, ...(bump ? { bump } : {}) })), platforms: of('platform'), collectibles: of('collectible'),\n hazards: layers.filter(l => l.role === 'hazard').map(({ id, x, y, w, h, patrol, stomp }) => ({ id, x, y, w, h, ...(patrol ? { patrol } : {}), ...(stomp ? { stomp } : {}) })),\n goal: of('goal')[0] ?? null,\n floor: bottom + 200,\n settings: { ...PLATFORMER_DEFAULTS, ...settings },\n }\n}\n", "// A platformer, played on a page: `popcraftPlatformer(root, spec)` runs the physics (./physics.ts) every frame and\n// moves the screen's layers to match \u2014 the player by a transform from where it was drawn, a collected item hidden.\n// Input is the keyboard (arrows, A/D/W, space) and any layers the screen marks as on-screen controls, pressed with a\n// finger, a pen or a mouse. Returns a stop function.\n\nimport { bumpLift, createPlatformer, hazardOffsets, levelFromLayers, playerMotion, stepPlatformer, type PhysicsLayer, type PlatformerInput, type PlatformerSettings, type PlatformerWorld, type PlayerMotion } from './physics'\n\nexport type PlatformerControl = 'left' | 'right' | 'jump'\n\nexport interface PlatformerSpec {\n /** The screen's physics layers, in screen px. */\n layers: PhysicsLayer[]\n /** Layers that work as buttons: [layer id, what they press]. */\n controls?: [id: string, control: PlatformerControl][]\n /** Layers hidden while the game plays and shown when it is won (they may be hidden in the design, `data-pc-hidden`). */\n wins?: string[]\n /** Layers inside the player shown only in one state: [layer id, idle | run | jump]. */\n poses?: [id: string, pose: PlayerMotion][]\n /** Scenery that slides against the player's travel: [layer id, px per px travelled]. */\n parallax?: [id: string, factor: number][]\n settings?: Partial<PlatformerSettings>\n /** Pixel art kept pixel-perfect: the player is drawn on this grid (screen px per art pixel); the physics is not. */\n grid?: number\n /** The screen's height (falling below it is a death). */\n height?: number\n}\n\nconst KEYS: Record<string, PlatformerControl> = {\n ArrowLeft: 'left', a: 'left', A: 'left', ArrowRight: 'right', d: 'right', D: 'right',\n ArrowUp: 'jump', w: 'jump', W: 'jump', ' ': 'jump',\n}\n\n/** The game's state as attributes on the screen, for a site's own CSS (a win banner, a score). */\nconst show = (root: HTMLElement, w: PlatformerWorld) => {\n root.dataset.pcCollected = String(w.collected.length + w.bonus)\n root.dataset.pcDeaths = String(w.deaths)\n if (w.won) root.dataset.pcWon = ''\n}\n\nexport function popcraftPlatformer(root: HTMLElement, spec: PlatformerSpec): () => void {\n const level = levelFromLayers(spec.layers, spec.settings, spec.height)\n if (!level) return () => {}\n const find = (id: string) => root.querySelector<HTMLElement>(`[data-pc-id=\"${CSS.escape(id)}\"]`)\n const player = find(level.player.id)\n let world = createPlatformer(level)\n const held = new Set<PlatformerControl>()\n const pressed = new Map<number, PlatformerControl>()\n const input = (): PlatformerInput => ({ left: held.has('left') || [...pressed.values()].includes('left'), right: held.has('right') || [...pressed.values()].includes('right'), jump: held.has('jump') || [...pressed.values()].includes('jump') })\n\n const typing = (t: EventTarget | null) => t instanceof HTMLElement && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))\n const onKey = (down: boolean) => (e: KeyboardEvent) => {\n const c = KEYS[e.key]\n if (!c || e.metaKey || e.ctrlKey || e.altKey || typing(e.target)) return\n e.preventDefault()\n if (down) held.add(c); else held.delete(c)\n }\n const keyDown = onKey(true), keyUp = onKey(false)\n window.addEventListener('keydown', keyDown)\n window.addEventListener('keyup', keyUp)\n const blur = () => { held.clear(); pressed.clear() }\n window.addEventListener('blur', blur)\n\n const unbind: (() => void)[] = []\n for (const [id, control] of spec.controls ?? []) {\n const el = find(id)\n if (!el) continue\n el.style.touchAction = 'none'\n el.style.userSelect = 'none'\n const down = (e: PointerEvent) => { e.preventDefault(); el.setPointerCapture?.(e.pointerId); pressed.set(e.pointerId, control) }\n const up = (e: PointerEvent) => { pressed.delete(e.pointerId) }\n el.addEventListener('pointerdown', down)\n el.addEventListener('pointerup', up)\n el.addEventListener('pointercancel', up)\n unbind.push(() => { el.removeEventListener('pointerdown', down); el.removeEventListener('pointerup', up); el.removeEventListener('pointercancel', up) })\n }\n\n const hidden = new Set<string>()\n const wins = (spec.wins ?? []).map(find).filter((el): el is HTMLElement => !!el)\n for (const el of wins) el.style.visibility = 'hidden'\n // The player's pose layers: the one for what it is doing shows (its idle one when it has none for that).\n const poses = (spec.poses ?? []).map(([id, pose]) => [find(id), pose] as const).filter((p): p is readonly [HTMLElement, PlayerMotion] => !!p[0])\n // Run and jump art is hidden in the design (so the screen shows its idle self); the game takes it over.\n for (const [el] of poses) el.removeAttribute('data-pc-hidden')\n const hazards = new Map(level.hazards.filter(h => h.patrol).map(h => [h.id, find(h.id)]))\n // Blocks that bump, and the layers a bump shows (a used ? block over the live one).\n const blocks = new Map(level.solids.filter(b => b.bump).map(b => [b.id, { el: find(b.id), reveal: b.bump!.reveal ? find(b.bump!.reveal) : null }]))\n for (const { reveal } of blocks.values()) if (reveal) reveal.style.visibility = 'hidden'\n const gone = new Set<string>()\n const scenery = (spec.parallax ?? []).map(([id, f]) => [find(id), f] as const).filter((p): p is readonly [HTMLElement, number] => !!p[0])\n let shownWin = false\n let last = 0\n let raf = 0\n const frame = (now: number) => {\n const dt = last ? (now - last) / 1000 : 0\n last = now\n world = stepPlatformer(world, input(), dt).world\n const g = spec.grid && spec.grid > 0 ? spec.grid : 0\n const at = (v: number) => (g ? Math.round(v / g) * g : v)\n if (player) player.style.transform = `translate(${at(world.x - level.player.x)}px, ${at(world.y - level.player.y)}px)${world.facing < 0 ? ' scaleX(-1)' : ''}`\n for (const [id, b] of blocks) {\n const lift = bumpLift(world, id)\n if (b.el) b.el.style.transform = lift ? `translate(0, ${-at(lift)}px)` : ''\n if (b.reveal && id in world.bumped && b.reveal.style.visibility === 'hidden') { b.reveal.removeAttribute('data-pc-hidden'); b.reveal.style.visibility = '' }\n if (b.reveal) b.reveal.style.transform = b.el?.style.transform ?? ''\n }\n for (const id of world.defeated) if (!gone.has(id)) { gone.add(id); const el = hazards.get(id) ?? find(id); if (el) el.style.visibility = 'hidden' }\n for (const [el, f] of scenery) el.style.transform = `translate(${at(-(world.x - level.player.x) * f)}px, 0)`\n const motion = playerMotion(world)\n const pose = poses.some(([, p]) => p === motion) ? motion : 'idle'\n for (const [el, p] of poses) el.style.visibility = p === pose || !poses.some(([, q]) => q === pose) ? '' : 'hidden'\n for (const h of hazardOffsets(world)) { const el = hazards.get(h.id); if (el) el.style.transform = `translate(${at(h.dx)}px, 0)${h.facing < 0 ? ' scaleX(-1)' : ''}` }\n for (const id of world.collected) if (!hidden.has(id)) { hidden.add(id); const el = find(id); if (el) el.style.visibility = 'hidden' }\n show(root, world)\n if (world.won && !shownWin) { shownWin = true; for (const el of wins) { el.style.visibility = ''; el.removeAttribute('data-pc-hidden') } }\n raf = requestAnimationFrame(frame)\n }\n raf = requestAnimationFrame(frame)\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('keydown', keyDown)\n window.removeEventListener('keyup', keyUp)\n window.removeEventListener('blur', blur)\n for (const u of unbind) u()\n if (player) player.style.transform = ''\n for (const [el] of poses) el.style.visibility = ''\n for (const [el] of scenery) el.style.transform = ''\n for (const { el, reveal } of blocks.values()) { if (el) el.style.transform = ''; if (reveal) { reveal.style.transform = ''; reveal.style.visibility = 'hidden' } }\n for (const id of gone) { const el = find(id); if (el) el.style.visibility = '' }\n for (const el of hazards.values()) if (el) el.style.transform = ''\n for (const id of hidden) { const el = find(id); if (el) el.style.visibility = '' }\n for (const el of wins) el.style.visibility = ''\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAaO,IAAM,cAAN,cAA0B,MAAM;AAAC;AAEjC,IAAM,MAAM,CAAC,MAAyB;AAC3C,MAAI,OAAO,MAAM,SAAU,QAAO,OAAO,SAAS,CAAC,IAAI,IAAI;AAC3D,MAAI,OAAO,MAAM,UAAW,QAAO,IAAI,IAAI;AAC3C,MAAI,OAAO,MAAM,UAAU;AAAE,UAAM,IAAI,OAAO,CAAC;AAAG,WAAO,OAAO,SAAS,CAAC,IAAI,IAAI;AAAA,EAAE;AACpF,SAAO;AACT;AACO,IAAM,SAAS,CAAC,MAA2B,OAAO,MAAM,WAAW,MAAM,MAAM,MAAM,UAAU,OAAO,MAAM,WAAW,OAAO,IAAI,CAAC,MAAM;AAEzI,IAAM,WAAW,CAAC,MAA0B,OAAO,MAAM,WAAY,OAAO,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,OAAO,OA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ent": ["// What PopCraft's expressions mean: the values they work with, how operators treat them, and every function they may\n// call. One implementation, used by the editor (lib/document/expressions.ts parses and evaluates with it) and by code\n// exported from PopCraft (an exported app's compiled expressions call these), so an expression gives the same answer\n// on the canvas, on a published site and in an exported project.\n\nexport type ExprValue = number | string | boolean | object\n\n/** A record as the adding-up functions read it: its values by field key, and when it was made (ms). */\nexport interface ExprRow { values: Record<string, unknown>; at?: number }\n/** A collection's records by its name (any case); undefined when there is none of that name. */\nexport interface ExprData { rows(collection: string): readonly ExprRow[] | undefined }\n\n/** Thrown when an expression asks for something that is not there (a collection, here); the caller decides what that means. */\nexport class ExprMissing extends Error {}\n\nexport const num = (v: ExprValue): number => {\n if (typeof v === 'number') return Number.isFinite(v) ? v : 0\n if (typeof v === 'boolean') return v ? 1 : 0\n if (typeof v === 'string') { const n = Number(v); return Number.isFinite(n) ? n : 0 }\n return 0\n}\nexport const truthy = (v: ExprValue): boolean => (typeof v === 'string' ? v !== '' && v !== 'false' : typeof v === 'object' ? true : num(v) !== 0)\n/** A value as words: whole numbers as they are, others to at most 4 places with trailing zeros dropped. */\nexport const exprText = (v: ExprValue): string => (typeof v === 'number' ? (Number.isInteger(v) ? String(v) : String(Number(v.toFixed(4)))) : typeof v === 'object' ? '' : String(v))\nexport const finite = (n: number) => (Number.isFinite(n) ? n : 0)\n\nconst DAY = 86_400_000\n/** The local calendar day a moment falls on, as a whole number that goes up by one a day. */\nexport const dayOf = (ms: number) => { const d = new Date(ms); return Math.floor(new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime() / DAY + 0.5) }\nexport const keyOf = (name: ExprValue) => exprText(name).toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '')\n/**\n * The records of `collection` that hold for every `field, value` pair in `pairs` (none: all of them). A file with\n * no such collection \u2014 or a place with no records to read, the canvas \u2014 is an error, so the layer keeps what it was\n * drawn with rather than saying 0.\n */\nfunction rowsOf(data: ExprData | undefined, collection: ExprValue, pairs: ExprValue[]): readonly ExprRow[] {\n const rows = data?.rows(exprText(collection))\n if (!rows) throw new ExprMissing(`No collection \"${exprText(collection)}\"`)\n if (pairs.length < 2) return rows\n return rows.filter(r => { for (let i = 0; i + 1 < pairs.length; i += 2) if (!same(r.values[keyOf(pairs[i])] as ExprValue ?? '', pairs[i + 1])) return false; return true })\n}\n/** Made on or after the day `days` before today (0: today). A record that does not say when counts as today's. */\nconst since = (rows: readonly ExprRow[], days: ExprValue) => { const from = dayOf(Date.now()) - Math.max(0, Math.round(num(days))); return rows.filter(r => r.at === undefined || dayOf(r.at) >= from) }\nconst total = (rows: readonly ExprRow[], field: ExprValue) => { const k = keyOf(field); return finite(rows.reduce((t, r) => t + (Number(r.values[k]) || 0), 0)) }\n\n/** Every function an expression may call: arguments already worked out, and the records it may add up. */\nexport const FUNCTIONS: Record<string, (a: ExprValue[], data?: ExprData) => ExprValue> = {\n /** How many records: `count(\"Trips\")`, `count(\"Trips\", \"status\", \"Booked\")` (each pair is a field and its value). */\n count: (a, data) => rowsOf(data, a[0], a.slice(1)).length,\n /** A number field added up: `sum(\"Sessions\", \"minutes\")`, `sum(\"Sessions\", \"minutes\", \"kind\", \"Run\")`. */\n sum: (a, data) => total(rowsOf(data, a[0], a.slice(2)), a[1]),\n /** How many different values a field has: `distinct(\"Dishes\", \"by\")` is how many people are cooking. */\n distinct: (a, data) => { const k = keyOf(a[1]); return new Set(rowsOf(data, a[0], a.slice(2)).map(r => exprText(r.values[k] as ExprValue ?? ''))).size },\n /** The largest value of a number field: `best(\"Sessions\", \"minutes\")`. */\n best: (a, data) => { const k = keyOf(a[1]); return rowsOf(data, a[0], a.slice(2)).reduce((m, r) => Math.max(m, Number(r.values[k]) || 0), 0) },\n /** Records made in the last days: `countSince(\"Sessions\", 6)` is this week, `countSince(\"Checks\", 0, \"habit\", item_id)` today's. */\n countSince: (a, data) => since(rowsOf(data, a[0], a.slice(2)), a[1]).length,\n /** Records made on one day, counted back from today: `countOn(\"Checks\", 1, \"habit\", item_name)` is yesterday's. */\n countOn: (a, data) => { const day = dayOf(Date.now()) - Math.max(0, Math.round(num(a[1]))); return rowsOf(data, a[0], a.slice(2)).filter(r => dayOf(r.at ?? Date.now()) === day).length },\n /** A number field added up over the last days: `sumSince(\"Sessions\", \"minutes\", 6)`. */\n sumSince: (a, data) => total(since(rowsOf(data, a[0], a.slice(3)), a[2]), a[1]),\n /** Days in a row with a record, up to today (or yesterday, while today is still open): `streak(\"Checks\", \"habit\", item_id)`. */\n streak: (a, data) => {\n const days = new Set(rowsOf(data, a[0], a.slice(1)).map(r => dayOf(r.at ?? Date.now())))\n let d = dayOf(Date.now())\n if (!days.has(d)) d -= 1\n let n = 0\n while (days.has(d)) { n++; d-- }\n return n\n },\n /** Today as words: `today()` \u2192 \"Friday 2 October\". */\n today: () => new Date().toLocaleDateString(undefined, { weekday: 'long', day: 'numeric', month: 'long' }),\n min: a => Math.min(...a.map(num)),\n max: a => Math.max(...a.map(num)),\n clamp: a => Math.min(Math.max(num(a[0]), num(a[1])), num(a[2])),\n abs: a => Math.abs(num(a[0])),\n sign: a => Math.sign(num(a[0])),\n floor: a => Math.floor(num(a[0])),\n ceil: a => Math.ceil(num(a[0])),\n round: a => { const d = Math.max(0, Math.min(6, Math.round(num(a[1] ?? 0)))); const f = 10 ** d; return Math.round(num(a[0]) * f) / f },\n sqrt: a => finite(Math.sqrt(Math.max(0, num(a[0])))),\n pow: a => finite(num(a[0]) ** num(a[1])),\n /** Linear blend from a to b by t (0\u20261). */\n mix: a => num(a[0]) + (num(a[1]) - num(a[0])) * num(a[2]),\n /** A whole random number from lo to hi inclusive (a crit roll, a loot drop). */\n random: a => { const lo = Math.ceil(num(a[0] ?? 0)), hi = Math.floor(num(a[1] ?? 1)); return lo + Math.floor(Math.random() * (hi - lo + 1)) },\n /** The clock, in ms (a cooldown: `usedAt = now()`, then `now() - usedAt >= 3000`). */\n now: () => Date.now(),\n /** The value as text. */\n text: a => exprText(a[0] ?? ''),\n /** A whole number zero-padded to `n` digits: `pad(420, 6)` \u2192 \"000420\". */\n pad: a => { const n = Math.round(num(a[0])); const s = String(Math.abs(n)).padStart(Math.max(0, Math.min(12, num(a[1] ?? 0))), '0'); return n < 0 ? `-${s}` : s },\n /** A number with exactly `d` decimals: `fixed(12.5, 2)` \u2192 \"12.50\". */\n fixed: a => num(a[0]).toFixed(Math.max(0, Math.min(6, Math.round(num(a[1] ?? 0))))),\n /** A number with thousands separators: `group(12500)` \u2192 \"12,500\". */\n group: a => Math.round(num(a[0])).toLocaleString('en-US'),\n /** Milliseconds (or seconds with `s`) as a clock: `clock(83450)` \u2192 \"1:23.45\". */\n clock: a => { const ms = Math.max(0, num(a[0])); const m = Math.floor(ms / 60000), s = Math.floor(ms / 1000) % 60, cs = Math.floor(ms / 10) % 100; return `${m}:${String(s).padStart(2, '0')}.${String(cs).padStart(2, '0')}` },\n /** Text length. */\n len: a => exprText(a[0] ?? '').length,\n upper: a => exprText(a[0] ?? '').toUpperCase(),\n}\n\n/** `==`: text compares as text, numbers as numbers. */\nexport const same = (a: ExprValue, b: ExprValue) => (typeof a === 'string' || typeof b === 'string' ? exprText(a) === exprText(b) : typeof a === 'object' || typeof b === 'object' ? JSON.stringify(a) === JSON.stringify(b) : num(a) === num(b))\n\n/** The operators, as expressions use them: `+` joins text, dividing by zero is 0, `%` is never negative. */\nexport const ops = {\n add: (a: ExprValue, b: ExprValue): ExprValue => (typeof a === 'string' || typeof b === 'string' ? exprText(a) + exprText(b) : finite(num(a) + num(b))),\n sub: (a: ExprValue, b: ExprValue) => finite(num(a) - num(b)),\n mul: (a: ExprValue, b: ExprValue) => finite(num(a) * num(b)),\n div: (a: ExprValue, b: ExprValue) => (num(b) === 0 ? 0 : finite(num(a) / num(b))),\n mod: (a: ExprValue, b: ExprValue) => { const m = num(b); return m === 0 ? 0 : ((num(a) % m) + m) % m },\n lt: (a: ExprValue, b: ExprValue) => num(a) < num(b),\n le: (a: ExprValue, b: ExprValue) => num(a) <= num(b),\n gt: (a: ExprValue, b: ExprValue) => num(a) > num(b),\n ge: (a: ExprValue, b: ExprValue) => num(a) >= num(b),\n eq: (a: ExprValue, b: ExprValue) => same(a, b),\n ne: (a: ExprValue, b: ExprValue) => !same(a, b),\n neg: (a: ExprValue) => -num(a),\n not: (a: ExprValue) => !truthy(a),\n}\n", "// The player for an exported prototype: popcraftMount(root, spec) keeps each state machine's state, sets every\n// element's look for it with smart animate's glide, and wires the interactions (click, hover, press, drag to orbit,\n// after a delay, keys). What it reads is data the exporter writes (lib/io/web/interactive.ts in PopCraft).\n// Exported React imports it; PopCraft's standalone HTML export inlines the same code, compiled from this file.\n/* eslint-disable */\n\nfunction popcraftMount(root: any, spec: any) {\n var els: any = {}, state: any = {}, owned: any = {}, orbit: any = {}, last: any = {}, holds: any = {}, hist: any = [], timers: any = [];\n var nodes: any = [root].concat(Array.prototype.slice.call(root.querySelectorAll('[data-pc]')));\n nodes.forEach(function (el: any) { els[el.getAttribute('data-pc')] = el; });\n for (var m in spec.m) state[m] = spec.m[m];\n for (var u in spec.e) (owned[spec.e[u][0]] = owned[spec.e[u][0]] || []).push(u);\n var drags: any = {}, clicks: any = {};\n spec.on.forEach(function (o: any) { if (o[3] === 'drag') drags[o[0]] = 1; if (o[3] === 'click' || o[3] === 'press') clicks[o[0]] = 1; });\n function lookIn(u: any, st: any) { var e = spec.e[u]; if (!e) return -2; var i = e[1][st === undefined ? state[e[0]] : st]; return i === undefined ? -1 : i; }\n function tf(f: any, o: any) {\n var ry = f[4] + (o ? o.ry : 0), rx = f[5] + (o ? o.rx : 0), p = [];\n if (f[0] || f[1] || f[2]) p.push(f[2] ? 'translate3d(' + f[0] + 'px, ' + f[1] + 'px, ' + f[2] + 'px)' : 'translate(' + f[0] + 'px, ' + f[1] + 'px)');\n if (f[3]) p.push('rotate(' + f[3] + 'deg)');\n if (ry) p.push('rotateY(' + ry + 'deg)');\n if (rx) p.push('rotateX(' + rx + 'deg)');\n if (f[6] !== 1 || f[7] !== 1) p.push('scale(' + f[6] + ', ' + f[7] + ')');\n return p.length ? p.join(' ') : 'none';\n }\n function css(u: any, i: any) {\n var L = spec.L[i], c = L[0];\n if (orbit[u] && L[2]) c += ';transform:' + tf(L[2], orbit[u]);\n if (drags[u]) c += ';touch-action:none;user-select:none;-webkit-user-select:none';\n if (clicks[u]) c += ';cursor:pointer';\n return c;\n }\n // Out of the flow too: in an auto-layout frame a layer that is not showing must not hold its place, or the\n // layers of the screen that is showing are pushed down past the frame's edge.\n var HIDE = ';opacity:0;visibility:hidden;pointer-events:none;position:absolute';\n function set(u: any, ms: any, ez: any) {\n var el = els[u], i = lookIn(u, undefined);\n if (!el || i === -2) return;\n var tr = ms ? ';transition:all ' + ms + 'ms ' + ez : ';transition:none';\n if (i < 0) { el.style.cssText = (last[u] || '') + HIDE + tr; return; }\n var c = css(u, i), text = spec.L[i][1];\n if (text !== null && el.textContent !== text) el.textContent = text;\n if (ms && el.style.visibility === 'hidden') { el.style.cssText = c + ';opacity:0;transition:none'; void el.offsetWidth; }\n el.style.cssText = c + tr;\n last[u] = c;\n }\n var ANIM = /(?:^|;)animation:[^;]*/;\n function anim(i: any) { var m = i >= 0 ? ANIM.exec(spec.L[i][0]) : null; return m ? m[0] : ''; }\n function go(m: any, to: any, ms: any, ez: any, fromHistory: any) {\n if (!(m in state) || state[m] === to) return;\n var list = owned[m] || [];\n // What is mid-animation and plays something else in the new state glides on from where it is now.\n list.forEach(function (u: any) {\n var a = lookIn(u, undefined), b = lookIn(u, to), el = els[u];\n if (!el || a < 0 || !anim(a) || anim(a) === anim(b)) return;\n var cs = getComputedStyle(el);\n el.style.cssText = css(u, a) + ';animation:none;transition:none;transform:' + cs.transform + ';opacity:' + cs.opacity;\n });\n void root.offsetWidth;\n if (m === 'flow' && !fromHistory) hist.push(state[m]);\n state[m] = to;\n list.forEach(function (u: any) { set(u, ms, ez); });\n arm();\n }\n function active(u: any, trig: any) { return spec.on.filter(function (o: any) { return String(o[0]) === String(u) && o[3] === trig && state[o[1]] === o[2]; }); }\n function run(o: any, u: any) {\n var a = o[4];\n if (a.k === 'go') {\n if (a.hold) { if (!holds[u]) holds[u] = { m: a.m, back: state[a.m], ms: a.ms, ez: a.ez }; }\n go(a.m, a.to, a.ms, a.ez, false);\n } else if (a.k === 'back' && hist.length) {\n go(a.m, hist.pop(), 300, 'ease-in-out', true);\n }\n }\n function release(u: any) { var h = holds[u]; if (!h) return; delete holds[u]; go(h.m, h.back, h.ms, h.ez, true); }\n function chain(el: any) {\n var out: string[] = [];\n for (var n = el; n && n !== root.parentNode; n = n.parentNode) { var id = n.getAttribute && n.getAttribute('data-pc'); if (id !== null && id !== undefined) out.push(id); if (n === root) break; }\n return out;\n }\n function first(ids: any, trig: any) { for (var i = 0; i < ids.length; i++) { var a = active(ids[i], trig); if (a.length) return { u: ids[i], list: a }; } return null; }\n function arm() {\n timers.forEach(clearTimeout); timers = [];\n spec.on.forEach(function (o: any) { if (o[3] === 'timeout' && state[o[1]] === o[2]) timers.push(setTimeout(function () { if (state[o[1]] === o[2]) run(o, o[0]); }, o[5])); });\n }\n // Hover: the elements under the pointer, compared with the last move's.\n var over: any = [];\n function hover(ids: any) {\n var left = over.filter(function (u: any) { return ids.indexOf(u) < 0; }), entered = ids.filter(function (u: any) { return over.indexOf(u) < 0; });\n over = ids;\n left.forEach(function (u: any) { release(u); active(u, 'leave').forEach(function (o: any) { run(o, u); }); });\n entered.slice().reverse().forEach(function (u: any) { active(u, 'hover').concat(active(u, 'enter')).forEach(function (o: any) { run(o, u); }); });\n }\n var press: any = null;\n function onMove(e: any) {\n if (press) {\n var dx = e.clientX - press.x, dy = e.clientY - press.y;\n if (!press.dragged && Math.abs(dx) + Math.abs(dy) > 5) {\n press.dragged = true;\n var d = first(press.ids, 'drag');\n if (d) { var du = d.u; press.drag = d; d.list.forEach(function (o: any) { if (o[4].k !== 'orbit') run(o, du); }); }\n if (press.held) { release(press.held); press.held = null; }\n }\n if (press.drag) {\n // Screen px to the design's px: the root may be drawn scaled.\n var k = root.getBoundingClientRect().width / (root.offsetWidth || 1) || 1;\n press.drag.list.forEach(function (o: any) {\n var a = o[4]; if (a.k !== 'orbit') return;\n // Across turns the orbited element; down tilts the tilt element (a group holding it), within the range.\n var cur = orbit[a.t] || { rx: 0, ry: 0 };\n orbit[a.t] = { rx: cur.rx, ry: cur.ry + ((e.clientX - press.lx) / k) * a.d };\n if (a.tilt) { var tc = orbit[a.tt] || { rx: 0, ry: 0 }; orbit[a.tt] = { ry: tc.ry, rx: Math.max(a.lo, Math.min(a.hi, tc.rx - ((e.clientY - press.ly) / k) * a.d)) }; }\n set(a.t, 0, 'linear');\n if (a.tt !== a.t) set(a.tt, 0, 'linear');\n });\n press.lx = e.clientX; press.ly = e.clientY;\n return;\n }\n }\n hover(chain(e.target));\n }\n function onDown(e: any) {\n var ids = chain(e.target);\n press = { x: e.clientX, y: e.clientY, lx: e.clientX, ly: e.clientY, ids: ids, dragged: false, drag: null, held: null };\n if (first(ids, 'drag') && root.setPointerCapture) { try { root.setPointerCapture(e.pointerId); } catch (err) { /* not capturable */ } }\n var p = first(ids, 'press');\n if (p) { var pu = p.u; press.held = pu; p.list.forEach(function (o: any) { run(o, pu); }); }\n }\n function onUp(e: any) {\n var p = press; press = null;\n if (!p) return;\n if (p.held) release(p.held);\n if (p.dragged) return;\n var c = first(p.ids, 'click');\n if (c) { var cu = c.u; c.list.forEach(function (o: any) { run(o, cu); }); }\n void e;\n }\n function onLeave() { if (!press) hover([]); }\n function onKey(e: any) { spec.on.forEach(function (o: any) { if (o[3] === 'key' && state[o[1]] === o[2] && (!o[6] || o[6].toLowerCase() === String(e.key).toLowerCase())) run(o, o[0]); }); }\n for (var id in els) set(id, 0, 'linear');\n root.addEventListener('pointermove', onMove);\n root.addEventListener('pointerdown', onDown);\n root.addEventListener('pointerup', onUp);\n root.addEventListener('pointercancel', onUp);\n root.addEventListener('pointerleave', onLeave);\n window.addEventListener('keydown', onKey);\n arm();\n return function () {\n timers.forEach(clearTimeout);\n root.removeEventListener('pointermove', onMove); root.removeEventListener('pointerdown', onDown); root.removeEventListener('pointerup', onUp);\n root.removeEventListener('pointercancel', onUp); root.removeEventListener('pointerleave', onLeave); window.removeEventListener('keydown', onKey);\n };\n}\n\nexport { popcraftMount }\n", "// The player for a frame's state machine: popcraftMachine(root, spec) runs the machine (its states, guards, actions\n// and inputs) and plays the frame's timeline between its markers as the machine moves. Data from PopCraft's exporter\n// (lib/io/web/state-machine.ts). Exported React imports it; the standalone HTML export inlines it, compiled from here.\n/* eslint-disable */\n\nfunction popcraftMachineCore(spec: any) {\n function start(id: any) { var t = spec.in[id]; return !t || t[0] === 'event' ? undefined : t[1]; }\n function holds(g: any, values: any, fired: any) {\n var t = spec.in[g[0]];\n if (!t) return false;\n if (t[0] === 'event') return !!fired[g[0]];\n var v = g[0] in values ? values[g[0]] : start(g[0]), w = g[2];\n switch (g[1]) {\n case 'eq': return v === w;\n case 'neq': return v !== w;\n case 'gt': return typeof v === 'number' && typeof w === 'number' && v > w;\n case 'gte': return typeof v === 'number' && typeof w === 'number' && v >= w;\n case 'lt': return typeof v === 'number' && typeof w === 'number' && v < w;\n case 'lte': return typeof v === 'number' && typeof w === 'number' && v <= w;\n }\n return false;\n }\n function apply(values: any, actions: any) {\n var out: any = {}, fired: any = {};\n for (var k in values) out[k] = values[k];\n actions.forEach(function (a: any) {\n var t = spec.in[a[1]];\n if (!t) return;\n var cur = a[1] in out ? out[a[1]] : start(a[1]), by = typeof a[2] === 'number' ? a[2] : 1;\n if (a[0] === 'set') { if (t[0] === 'event') fired[a[1]] = 1; else if (a.length > 2 && typeof a[2] === typeof cur) out[a[1]] = a[2]; }\n else if (a[0] === 'toggle') { if (typeof cur === 'boolean') out[a[1]] = !cur; }\n else if (a[0] === 'increment') { if (typeof cur === 'number') out[a[1]] = cur + by; }\n else if (a[0] === 'decrement') { if (typeof cur === 'number') out[a[1]] = cur - by; }\n else if (a[0] === 'fire') { if (t[0] === 'event') fired[a[1]] = 1; }\n else if (a[0] === 'reset') { var s = start(a[1]); if (s === undefined) delete out[a[1]]; else out[a[1]] = s; }\n });\n return { values: out, fired: fired };\n }\n function next(r: any, fired: any) {\n var own = spec.t.filter(function (t: any) { return t[0] === r.state; });\n var any = spec.t.filter(function (t: any) { return t[0] === '*' && t[1] !== r.state; });\n var all = own.concat(any);\n for (var i = 0; i < all.length; i++) {\n var t = all[i];\n if (spec.s[t[1]] && t[2].every(function (g: any) { return holds(g, r.values, fired); })) return t;\n }\n return null;\n }\n function enter(r: any, id: any) {\n var res = apply(r.values, spec.s[id] ? spec.s[id][4] : []);\n return { run: { state: id, values: res.values }, fired: res.fired };\n }\n function settle(r: any, fired: any) {\n var cur = r, ev = fired || {};\n for (var i = 0; i < 16; i++) { var t = next(cur, ev); if (!t) break; var n = enter(cur, t[1]); cur = n.run; ev = n.fired; }\n return cur;\n }\n function begin() {\n var first = spec.s[spec.i] ? spec.i : Object.keys(spec.s)[0], values: any = {};\n if (first === undefined) return null;\n for (var k in spec.in) { var s = start(k); if (s !== undefined) values[k] = s; }\n var e = enter({ state: first, values: values }, first);\n return settle(e.run, e.fired);\n }\n function hears(l: any, type: any, chain: any, key?: any) {\n if (l[0] !== type) return false;\n if (type === 'complete') return true;\n if (type === 'keyDown' || type === 'keyUp') return !l[3] || String(l[3]).toLowerCase() === String(key).toLowerCase();\n return l[1] === null || chain.indexOf(l[1]) >= 0;\n }\n function dispatch(r: any, type: any, chain: any, key?: any) {\n var heard = spec.l.filter(function (l: any) { return hears(l, type, chain, key); });\n if (!heard.length) return r;\n var res = apply(r.values, [].concat.apply([], heard.map(function (l: any) { return l[2]; })));\n return settle({ state: r.state, values: res.values }, res.fired);\n }\n function set(r: any, id: any, value: any) {\n var t = spec.in[id];\n if (!t) return r;\n var res = apply(r.values, [t[0] === 'event' ? ['fire', id] : ['set', id, value]]);\n return settle({ state: r.state, values: res.values }, res.fired);\n }\n return { begin: begin, dispatch: dispatch, set: set };\n}\nfunction popcraftMachine(root: any, spec: any) {\n var core = popcraftMachineCore(spec), run = core.begin(), anims: any = [], t0 = 0, done = false, raf = 0, over: any = [];\n if (!run) return function () {};\n function chain(el: any) {\n var out: string[] = [];\n for (var n = el; n && n !== root.parentNode; n = n.parentNode) { var id = n.getAttribute && n.getAttribute('data-sm'); if (id) out.push(id); if (n === root) break; }\n return out;\n }\n function update(r: any) {\n if (r === run) return;\n var changed = r.state !== run.state;\n run = r;\n if (!changed) return;\n t0 = performance.now(); done = false;\n root.dispatchEvent(new CustomEvent('popcraft:state', { detail: { state: r.state, name: spec.s[r.state] ? spec.s[r.state][5] : r.state, values: r.values } }));\n }\n function tick(now: any) {\n var s = spec.s[run.state];\n if (s) {\n var a = s[0], b = s[1], played = Math.max(0, now - t0) * s[3], t: number;\n if (s[2] && b > a) t = a + (played % (b - a));\n else {\n t = Math.min(b, a + played);\n if (!done && a + played >= b) { done = true; update(core.dispatch(run, 'complete', [])); }\n }\n anims.forEach(function (x: any) { x.currentTime = t; });\n }\n raf = requestAnimationFrame(tick);\n }\n function on(type: any) { return function (e: any) { update(core.dispatch(run, type, chain(e.target))); }; }\n function onMove(e: any) {\n var ids = chain(e.target);\n var left = over.filter(function (u: any) { return ids.indexOf(u) < 0; }), entered = ids.filter(function (u: any) { return over.indexOf(u) < 0; });\n over = ids;\n if (left.length) update(core.dispatch(run, 'pointerExit', left));\n if (entered.length) update(core.dispatch(run, 'pointerEnter', entered));\n }\n function onLeave() { if (over.length) { var left = over; over = []; update(core.dispatch(run, 'pointerExit', left)); } }\n function onKey(type: any) {\n return function (e: any) {\n var t = e.target;\n if (e.repeat || e.metaKey || e.ctrlKey || (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable))) return;\n var r = core.dispatch(run, type, [], e.key);\n if (r !== run) { e.preventDefault(); update(r); }\n };\n }\n var down = on('pointerDown'), up = on('pointerUp'), click = on('click'), keyDown = onKey('keyDown'), keyUp = onKey('keyUp');\n anims = root.getAnimations ? root.getAnimations({ subtree: true }) : [];\n anims.forEach(function (x: any) { x.pause(); });\n t0 = performance.now();\n root.addEventListener('pointerdown', down);\n root.addEventListener('pointerup', up);\n root.addEventListener('click', click);\n root.addEventListener('pointermove', onMove);\n root.addEventListener('pointerleave', onLeave);\n window.addEventListener('keydown', keyDown);\n window.addEventListener('keyup', keyUp);\n raf = requestAnimationFrame(tick);\n function byName(k: any) { if (spec.in[k]) return k; for (var id in spec.in) if (spec.in[id][2] === k) return id; return k; }\n var api = {\n state: function () { return run.state; },\n values: function () { return run.values; },\n set: function (input: any, value: any) { update(core.set(run, byName(input), value)); },\n fire: function (input: any) { update(core.set(run, byName(input), undefined)); },\n destroy: function () {\n cancelAnimationFrame(raf);\n root.removeEventListener('pointerdown', down); root.removeEventListener('pointerup', up); root.removeEventListener('click', click);\n root.removeEventListener('pointermove', onMove); root.removeEventListener('pointerleave', onLeave);\n window.removeEventListener('keydown', keyDown); window.removeEventListener('keyup', keyUp);\n },\n };\n root.popcraftMachine = api;\n return api.destroy;\n}\n\nexport { popcraftMachine, popcraftMachineCore }\n", "// What an exported app calls for the interactions that act on the page itself rather than on React state: switching a\n// variable mode (a theme), controlling a frame's timeline (its CSS animations), and turning a layer in 3D by\n// dragging it. Plain DOM, no framework: exported React calls these from its event handlers.\n\n/**\n * Put `root` (the document element) in one mode of a collection: `classes` are every mode's class of that collection\n * ('' for the default mode, which has none), `to` the one to switch to, or '__NEXT__' for the one after the current.\n * Returns the class now on.\n */\nexport function switchMode(root: Element, classes: readonly string[], to: string): string {\n const now = classes.find(c => c && root.classList.contains(c)) ?? ''\n const next = to === '__NEXT__' ? classes[(classes.indexOf(now) + 1) % classes.length] ?? '' : to\n for (const c of classes) if (c) root.classList.remove(c)\n if (next) root.classList.add(next)\n return next\n}\n\nexport interface TimelineControlSpec {\n /** Whose timeline: the screen's (default) or a motion instance's (the caller finds the element). */\n target?: 'FRAME' | 'INSTANCE'\n op: 'PLAY' | 'PAUSE' | 'TOGGLE' | 'SEEK' | 'SCRUB'\n /** SEEK: a time (ms), or the next / previous marker. */\n to?: number | 'NEXT' | 'PREV'\n /** The ms range a seek or a scrub stays within (default: the whole timeline). */\n span?: [number, number]\n /** SCRUB: the drag axis, the px that cover the span (negative: left / up moves on), what happens on release. */\n axis?: 'X' | 'Y'\n distance?: number\n release?: 'HOLD' | 'SNAP' | 'PLAY'\n /** SEEK and SNAP: how long the glide takes (ms). */\n glide?: number\n}\n\nconst animationsOf = (root: Element) => root.getAnimations({ subtree: true })\nconst timeOf = (root: Element) => Number(animationsOf(root)[0]?.currentTime ?? 0)\nfunction goTo(root: Element, ms: number, glide = 0) {\n const anims = animationsOf(root)\n if (!glide) { for (const a of anims) { a.pause(); a.currentTime = ms } return }\n const from = timeOf(root), t0 = performance.now()\n const step = (now: number) => {\n const k = Math.min(1, (now - t0) / glide), e = 1 - (1 - k) ** 3\n for (const a of anims) { a.pause(); a.currentTime = from + (ms - from) * e }\n if (k < 1) requestAnimationFrame(step)\n }\n requestAnimationFrame(step)\n}\n\n/**\n * Play, pause, toggle or seek the timeline of `root` (a screen, or a motion instance): its CSS animations, as the\n * exporter wrote them. `markers` are the timeline's markers (ms), for seeking to the next or previous one.\n */\nexport function controlTimeline(root: Element | null, control: TimelineControlSpec, markers: readonly number[] = []): void {\n if (!root) return\n const anims = animationsOf(root)\n const [lo, hi] = control.span ?? [0, Number(anims[0]?.effect?.getComputedTiming().duration ?? 0)]\n switch (control.op) {\n case 'PLAY': for (const a of anims) a.play(); return\n case 'PAUSE': for (const a of anims) a.pause(); return\n case 'TOGGLE': for (const a of anims) (a.playState === 'running' ? a.pause() : a.play()); return\n case 'SEEK': {\n const now = timeOf(root)\n const to = control.to === 'NEXT' ? markers.find(m => m > now + 1) ?? hi : control.to === 'PREV' ? [...markers].reverse().find(m => m < now - 1) ?? lo : Math.min(hi, Math.max(lo, Number(control.to ?? lo)))\n goTo(root, to, control.glide ?? 350)\n }\n }\n}\n\n/** A SCRUB: from a pointer press on `handle`, a drag moves `root`'s timeline across its span; release as asked. */\nexport function scrubTimeline(down: PointerEvent, root: Element | null, control: TimelineControlSpec, markers: readonly number[] = []): void {\n if (!root) return\n const handle = down.currentTarget as Element\n const box = handle.getBoundingClientRect()\n const axis = control.axis ?? 'X'\n const anims = animationsOf(root)\n const [lo, hi] = control.span ?? [0, Number(anims[0]?.effect?.getComputedTiming().duration ?? 0)]\n const distance = control.distance ?? (axis === 'X' ? box.width : box.height)\n const start = timeOf(root), origin = axis === 'X' ? down.clientX : down.clientY\n for (const a of anims) a.pause()\n const move = (e: PointerEvent) => {\n const moved = (axis === 'X' ? e.clientX : e.clientY) - origin\n goTo(root, Math.min(hi, Math.max(lo, start + (moved / (distance || 1)) * (hi - lo))))\n }\n const up = () => {\n window.removeEventListener('pointermove', move)\n window.removeEventListener('pointerup', up)\n if (control.release === 'PLAY') for (const a of animationsOf(root)) a.play()\n if (control.release === 'SNAP' && markers.length) { const now = timeOf(root); goTo(root, markers.reduce((b, m) => (Math.abs(m - now) < Math.abs(b - now) ? m : b)), control.glide ?? 350) }\n }\n window.addEventListener('pointermove', move)\n window.addEventListener('pointerup', up)\n}\n\n/** How a drag turns a layer: degrees per px, and a vertical drag that tilts it (or `tiltLayerId`, a layer holding it). */\nexport interface OrbitSpec { degreesPerPx?: number; tilt?: boolean; tiltRange?: [number, number]; tiltLayerId?: string }\n\n/** An ORBIT_3D drag: from a press on `el`, dragging turns it about its vertical axis (and tilts it, when asked). */\nexport function orbitDrag(down: PointerEvent, el: HTMLElement | null, spec: OrbitSpec = {}): void {\n if (!el) return\n const per = spec.degreesPerPx ?? 0.4\n const [tlo, thi] = spec.tiltRange ?? [-30, 30]\n // Its own transform, read once, so turns add to where it was drawn rather than to the last turn.\n const base = el.dataset.pcBase ?? (el.dataset.pcBase = getComputedStyle(el).transform === 'none' ? '' : getComputedStyle(el).transform)\n // The tilt goes to the layer it names (a group holding the object, so it tilts toward the viewer whichever way the\n // object has turned, as a trackball does), else to the turned layer itself.\n const tiltEl = (spec.tiltLayerId ? document.querySelector<HTMLElement>(`[data-pc-id$=\"${spec.tiltLayerId}\"]`) : null) ?? el\n const tiltBase = tiltEl === el ? '' : (tiltEl.dataset.pcBase ?? (tiltEl.dataset.pcBase = getComputedStyle(tiltEl).transform === 'none' ? '' : getComputedStyle(tiltEl).transform))\n const x0 = down.clientX, y0 = down.clientY\n let turn = Number(el.dataset.pcTurn ?? 0), tilt = Number(tiltEl.dataset.pcTilt ?? 0)\n const t0 = turn, k0 = tilt\n const move = (e: PointerEvent) => {\n turn = t0 + (e.clientX - x0) * per\n if (spec.tilt) tilt = Math.min(thi, Math.max(tlo, k0 - (e.clientY - y0) * per))\n if (tiltEl === el) el.style.transform = `${base} rotateY(${turn}deg)${spec.tilt ? ` rotateX(${tilt}deg)` : ''}`\n else { el.style.transform = `${base} rotateY(${turn}deg)`; if (spec.tilt) tiltEl.style.transform = `${tiltBase} rotateX(${tilt}deg)` }\n }\n const up = () => {\n el.dataset.pcTurn = String(turn)\n tiltEl.dataset.pcTilt = String(tilt)\n window.removeEventListener('pointermove', move)\n window.removeEventListener('pointerup', up)\n }\n window.addEventListener('pointermove', move)\n window.addEventListener('pointerup', up)\n}\n", "// The contract between a PopCraft site's pages and the host that serves them: the addresses a page asks (sign-in at\n// `_pc/auth/\u2026`, a visitor's records at `_pc/data/<collection>`), what each may send, and what comes back. PopCraft's\n// site host, an exported Next.js project's route handlers and the browser client all follow it, from this one file.\n\n/** A field's key: what a form names it by and a record keeps it under (`Good thing` \u2192 `good_thing`). */\nexport const fieldKey = (name: string): string => name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'field'\n\n/** A collection as the contract needs it: its fields, and whose its records are. */\nexport interface CollectionField { id: string; name: string; type: string; options?: string[] }\nexport interface Collection { id: string; name: string; fields: CollectionField[]; perVisitor?: boolean; shared?: boolean }\n\n\n/** Under the site's own origin. */\nexport const AUTH_ENDPOINT = '_pc/auth'\nexport type AuthAction = 'signUp' | 'signIn' | 'signOut' | 'updateAccount' | 'changePassword' | 'deleteAccount' | 'forgotPassword' | 'resetPassword'\nexport const AUTH_ACTIONS: readonly AuthAction[] = ['signUp', 'signIn', 'signOut', 'updateAccount', 'changePassword', 'deleteAccount', 'forgotPassword', 'resetPassword']\nexport const AUTH_PATHS: Record<AuthAction | 'session', string> = { signUp: 'sign-up', signIn: 'sign-in', signOut: 'sign-out', updateAccount: 'update', changePassword: 'password', deleteAccount: 'delete', forgotPassword: 'forgot', resetPassword: 'reset', session: 'session' }\n/** The page a reset link in an email opens (the site's own): it carries `?token=`, which the reset form sends back. */\nexport const RESET_PATH = '/reset-password'\n\n/** The visitor, as the site knows them. */\nexport interface SiteUser { id: string; name: string; email: string }\nexport interface SessionReply { user: SiteUser | null }\n\n/** The site's own cookie: the session's token, readable by no script. */\nexport const SESSION_COOKIE = 'pc_session'\nexport const SESSION_MAX_AGE = 60 * 60 * 24 * 7\n\nexport const AUTH_LIMITS = { name: 80, email: 254, passwordMin: 8, passwordMax: 128 }\n\n/** What a visitor typed into a sign-up or sign-in form, checked, or why it will not do (words a visitor can read). */\nexport function cleanCredentials(action: 'signUp' | 'signIn', raw: unknown): { ok: true; name: string; email: string; password: string } | { ok: false; error: string } {\n const v = raw && typeof raw === 'object' ? raw as Record<string, unknown> : {}\n const email = typeof v.email === 'string' ? v.email.trim().toLowerCase() : ''\n const password = typeof v.password === 'string' ? v.password : ''\n const name = typeof v.name === 'string' ? v.name.trim() : ''\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email) || email.length > AUTH_LIMITS.email) return { ok: false, error: 'Enter your email address.' }\n if (action === 'signUp' && password.length < AUTH_LIMITS.passwordMin) return { ok: false, error: `Choose a password of at least ${AUTH_LIMITS.passwordMin} characters.` }\n if (!password || password.length > AUTH_LIMITS.passwordMax) return { ok: false, error: 'Enter your password.' }\n if (name.length > AUTH_LIMITS.name) return { ok: false, error: 'That name is too long.' }\n // A sign-up with no name field is still a person: the part of their address before the @ stands in.\n return { ok: true, name: name || email.split('@')[0], email, password }\n}\n\nconst text = (v: unknown) => (typeof v === 'string' ? v : '')\nconst fields = (raw: unknown) => (raw && typeof raw === 'object' ? raw as Record<string, unknown> : {})\ntype Checked<T> = ({ ok: true } & T) | { ok: false; error: string }\nconst newPassword = (v: unknown): Checked<{ password: string }> => {\n const password = text(v)\n if (password.length < AUTH_LIMITS.passwordMin) return { ok: false, error: `Choose a password of at least ${AUTH_LIMITS.passwordMin} characters.` }\n if (password.length > AUTH_LIMITS.passwordMax) return { ok: false, error: 'That password is too long.' }\n return { ok: true, password }\n}\n\n/** A new name for the account (a form field named `name`). */\nexport function cleanName(raw: unknown): Checked<{ name: string }> {\n const name = text(fields(raw).name).trim()\n if (!name) return { ok: false, error: 'Enter a name.' }\n return name.length > AUTH_LIMITS.name ? { ok: false, error: 'That name is too long.' } : { ok: true, name }\n}\n/** A change of password: the one in use (`password`) and the new one (`new_password`). */\nexport function cleanPasswordChange(raw: unknown): Checked<{ current: string; password: string }> {\n const v = fields(raw)\n const current = text(v.password)\n if (!current || current.length > AUTH_LIMITS.passwordMax) return { ok: false, error: 'Enter your current password.' }\n const next = newPassword(v.new_password)\n return next.ok ? { ok: true, current, password: next.password } : next\n}\n/** The address a reset link is asked for (`email`). */\nexport function cleanEmail(raw: unknown): Checked<{ email: string }> {\n const email = text(fields(raw).email).trim().toLowerCase()\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email) && email.length <= AUTH_LIMITS.email ? { ok: true, email } : { ok: false, error: 'Enter your email address.' }\n}\n/** A reset: the token the emailed link carried, and the new password (`new_password`). */\nexport function cleanReset(raw: unknown): Checked<{ token: string; password: string }> {\n const v = fields(raw)\n const token = text(v.token)\n if (!/^[\\w.~-]{8,4096}$/.test(token)) return { ok: false, error: 'That reset link is not complete. Open it from the email again.' }\n const next = newPassword(v.new_password)\n return next.ok ? { ok: true, token, password: next.password } : next\n}\n\n/** The variables a site reads its visitor from, when the file has them (by name): set on load and as they sign in or out. */\n// Each ends in a word of its own (`userName`, not `name`): an expression names a variable by its last word, and a\n// file's brand kit already has a `name`.\nexport const USER_VARIABLES = { signedIn: 'user/signedIn', name: 'user/userName', email: 'user/userEmail', error: 'user/signInError' } as const\n\n\n\n/** Under the site's own origin, followed by the collection's id. */\nexport const DATA_ENDPOINT = '_pc/data'\nexport const RECORD_LIMITS = { textChars: 5000, perVisitor: 2000, list: 500 }\n\n/** A record as it travels: its id, when it was made, and its values by field key (`fieldKey(field.name)`). */\nexport interface SiteRecord {\n id: string; createdAt: string; values: Record<string, string | number | boolean | null>\n /** A shared collection's record: who made it, and whether that is the visitor asking. */\n by?: string; mine?: boolean\n}\n\nfunction coerce(field: CollectionField, raw: unknown): { ok: true; value: string | number | boolean | null } | { ok: false; error: string } {\n if (raw === undefined || raw === null || raw === '') return { ok: true, value: field.type === 'BOOLEAN' ? false : null }\n if (field.type === 'NUMBER') {\n const n = typeof raw === 'number' ? raw : Number(raw)\n return Number.isFinite(n) ? { ok: true, value: n } : { ok: false, error: `\"${field.name}\" is a number` }\n }\n if (field.type === 'BOOLEAN') return { ok: true, value: raw === true || raw === 'true' || raw === 'yes' || raw === 'on' || raw === '1' }\n if (typeof raw !== 'string') return { ok: false, error: `\"${field.name}\" is text` }\n if (raw.length > RECORD_LIMITS.textChars) return { ok: false, error: `\"${field.name}\" is too long` }\n if (field.type === 'OPTION' && field.options?.length && !field.options.includes(raw)) return { ok: false, error: `\"${field.name}\" is one of: ${field.options.join(', ')}` }\n return { ok: true, value: raw }\n}\n\n/**\n * What a visitor sent as a record of `collection`: only its fields are kept (by key), each as its type. A form's\n * values are text, so a number or a tick box arrives as words and is read as what the field is.\n */\nexport function cleanRecord(collection: Collection, raw: unknown): { ok: true; values: SiteRecord['values'] } | { ok: false; error: string } {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return { ok: false, error: 'Not a record' }\n const sent = raw as Record<string, unknown>\n const values: SiteRecord['values'] = {}\n for (const field of collection.fields) {\n const key = fieldKey(field.name)\n const got = coerce(field, sent[key])\n if (!got.ok) return got\n values[key] = got.value\n }\n return { ok: true, values }\n}\n\n/** The file's collections a site's visitors have their own records of, by id. */\nexport function visitorCollections<C extends Collection>(collections: Record<string, C> | undefined): C[] {\n return Object.values(collections ?? {}).filter(c => c.perVisitor)\n}\n\n// \u2500\u2500 Forms \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// A site's visitors are strangers, so a submission is cut to size here before anything is stored.\n\nexport const SUBMISSION_LIMITS = { fields: 50, nameChars: 80, valueChars: 5000, totalChars: 64_000, formChars: 120 }\n\n/** The path a site posts a form to, on its own origin. */\nexport const FORM_ENDPOINT = '_pc/form'\n/** A field no person fills: a submission that has it is dropped (and told it was kept). */\nexport const HONEYPOT = '_pc_hp'\n\nexport interface FormPost { form: string; name?: string; values: Record<string, string> }\n\n/** `raw` as a submission that may be stored, or the reason it may not. */\nexport function cleanSubmission(raw: unknown): { ok: true; form: string; name: string; values: Record<string, string>; spam: boolean } | { ok: false; error: string } {\n if (!raw || typeof raw !== 'object') return { ok: false, error: 'Not a form submission' }\n const { form, name, values } = raw as Partial<FormPost>\n if (typeof form !== 'string' || !form || form.length > SUBMISSION_LIMITS.formChars) return { ok: false, error: 'A submission names its form' }\n if (!values || typeof values !== 'object' || Array.isArray(values)) return { ok: false, error: 'A submission has values' }\n const entries = Object.entries(values)\n if (entries.length > SUBMISSION_LIMITS.fields) return { ok: false, error: `A form sends up to ${SUBMISSION_LIMITS.fields} fields` }\n const out: Record<string, string> = {}\n let total = 0\n let spam = false\n for (const [k, v] of entries) {\n if (typeof v !== 'string') return { ok: false, error: 'A value is text' }\n if (k === HONEYPOT) { spam = spam || v !== ''; continue }\n if (!k || k.length > SUBMISSION_LIMITS.nameChars) return { ok: false, error: 'A field name is too long' }\n if (v.length > SUBMISSION_LIMITS.valueChars) return { ok: false, error: `\"${k}\" is too long` }\n total += k.length + v.length\n out[k] = v\n }\n if (total > SUBMISSION_LIMITS.totalChars) return { ok: false, error: 'The submission is too large' }\n return { ok: true, form, name: typeof name === 'string' ? name.slice(0, SUBMISSION_LIMITS.formChars) : '', values: out, spam }\n}\n", "// What a site's pages ask of their own server: who is signed in, signing up, in and out (and the account), a visitor's\n// own records, and keeping a form. A published PopCraft site and an exported project both ask through this, at the\n// paths the site contract names (`_pc/\u2026` on the site's own origin), answered by `siteRequest`.\n\nimport { AUTH_ENDPOINT, AUTH_PATHS, DATA_ENDPOINT, FORM_ENDPOINT, type AuthAction, type SessionReply, type SiteRecord, type SiteUser } from './site/contract'\n\nexport interface SiteClient {\n /** Who is signed in now (null: nobody, or a site with no sign-in). */\n who(): Promise<SiteUser | null>\n /** Sign up or in with what a form holds, or sign out. Resolves to the visitor (null once signed out); rejects with words a visitor can read. */\n act(action: AuthAction, values: Record<string, string>): Promise<SiteUser | null>\n /** The visitor's own records of a collection, newest first (none when signed out). */\n records(collectionId: string): Promise<SiteRecord[]>\n /** Add a record, or change one of theirs (`recordId`). Rejects with words a visitor can read. */\n save(collectionId: string, values: Record<string, string | number | boolean | null>, recordId?: string): Promise<void>\n remove(collectionId: string, recordId: string): Promise<void>\n /** Keep a form: true when the site kept it (false when it keeps nothing, or could not be reached). */\n submit(form: { id: string; name?: string; values: Record<string, string> }): Promise<boolean>\n}\n\n/** A client for the site at `base` (its path on this origin: '' at the root). */\nexport function createSiteClient(base = ''): SiteClient {\n const root = base.replace(/\\/+$/, '')\n const at = (path: string) => `${root}/${AUTH_ENDPOINT}/${path}`\n const data = (collection: string) => `${root}/${DATA_ENDPOINT}/${encodeURIComponent(collection)}`\n const json = { 'content-type': 'application/json' }\n const refusal = async (res: Response, fallback: string) => new Error(((await res.json().catch(() => ({}))) as { error?: string }).error || fallback)\n return {\n who: () => fetch(at(AUTH_PATHS.session), { credentials: 'same-origin' }).then(r => (r.ok ? (r.json() as Promise<SessionReply>) : { user: null }), () => ({ user: null })).then(r => r.user ?? null),\n async act(action, values) {\n // A reset carries the token the emailed link put in the address.\n const token = action === 'resetPassword' && typeof location !== 'undefined' ? { token: new URLSearchParams(location.search).get('token') ?? new URLSearchParams(location.hash.slice(1)).get('access_token') ?? '' } : {}\n const res = await fetch(at(AUTH_PATHS[action]), { method: 'POST', credentials: 'same-origin', headers: json, body: JSON.stringify(action === 'signOut' ? {} : { name: values.name, email: values.email, password: values.password, new_password: values.new_password, ...token }) })\n if (!res.ok) throw await refusal(res, 'That did not work. Try again.')\n return ((await res.json().catch(() => ({}))) as SessionReply).user ?? null\n },\n async records(id) {\n const res = await fetch(data(id), { credentials: 'same-origin' }).catch(() => null)\n return res?.ok ? ((await res.json()) as { records: SiteRecord[] }).records : []\n },\n async save(id, values, recordId) {\n const res = await fetch(data(id), { method: 'POST', credentials: 'same-origin', headers: json, body: JSON.stringify(recordId ? { id: recordId, values } : { values }) })\n if (!res.ok) throw await refusal(res, 'That could not be saved. Try again.')\n },\n async remove(id, recordId) {\n const res = await fetch(`${data(id)}?id=${encodeURIComponent(recordId)}`, { method: 'DELETE', credentials: 'same-origin' })\n if (!res.ok) throw await refusal(res, 'That could not be removed. Try again.')\n },\n submit: form => fetch(`${root}/${FORM_ENDPOINT}`, { method: 'POST', headers: json, body: JSON.stringify({ form: form.id, name: form.name, values: form.values }) }).then(r => r.ok, () => false),\n }\n}\n", "// A platformer's physics: the pure step that moves a player through a level \u2014 gravity, running, jumping (with\n// coyote time and a jump buffer, so a jump pressed a moment early or late still happens), landing on solid ground,\n// bumping heads and walls, one-way platforms, collecting, dying on hazards and finishing at the goal.\n//\n// No DOM and no clock: `stepPlatformer(world, input, dt)` takes the world and returns the next one, so the editor's\n// Present mode and a published site (each with its own frame loop and its own way of drawing) move the same player\n// the same way. Coordinates are the screen's: x right, y down, in px; times in seconds.\n\nexport type PhysicsRole = 'player' | 'solid' | 'platform' | 'collectible' | 'hazard' | 'goal'\n\nexport interface PhysicsBox { id: string; x: number; y: number; w: number; h: number }\n\n/** A hazard that walks `distance` px right of where it is drawn and back, at `speed` px/s. */\nexport interface Patrol { distance: number; speed?: number }\n\n/** A hazard: a box, and maybe a patrol. */\nexport interface HazardBox extends PhysicsBox { patrol?: Patrol; stomp?: boolean }\n\n/** A block: hit from below it bumps, and pays `reward` coins the first time. */\nexport interface Bump { reward?: number; reveal?: string }\nexport interface SolidBox extends PhysicsBox { bump?: Bump }\n\n/** How long a bumped block takes to rise and settle (s), and how high it goes (px). */\nexport const BUMP_TIME = 0.18\nexport const BUMP_HEIGHT = 12\n\n/** What the player is doing, for the layers that show it (a run cycle, a jump). */\nexport type PlayerMotion = 'idle' | 'run' | 'jump'\n\nexport interface PlatformerSettings {\n /** px/s\u00B2 downward. */\n gravity: number\n /** Top running speed, px/s. */\n speed: number\n /** How fast the player reaches top speed on the ground, px/s\u00B2. */\n accel: number\n /** Jump take-off speed, px/s. Releasing the jump early cuts the rise short (a variable-height jump). */\n jump: number\n /** Fastest fall, px/s. */\n maxFall: number\n /** A jump still works this long after running off an edge (s). */\n coyote: number\n /** A jump pressed this long before landing happens on landing (s). */\n buffer: number\n}\n\nexport const PLATFORMER_DEFAULTS: PlatformerSettings = { gravity: 2600, speed: 420, accel: 3200, jump: 980, maxFall: 1400, coyote: 0.1, buffer: 0.12 }\n\nexport interface PlatformerLevel {\n player: PhysicsBox\n solids: SolidBox[]\n /** Stood on from above; jumped up through from below. */\n platforms: PhysicsBox[]\n collectibles: PhysicsBox[]\n hazards: HazardBox[]\n goal: PhysicsBox | null\n /** Falling below this y is a death (the level's bottom edge). */\n floor: number\n settings: PlatformerSettings\n}\n\nexport interface PlatformerInput { left: boolean; right: boolean; jump: boolean }\n\nexport interface PlatformerWorld {\n level: PlatformerLevel\n x: number\n y: number\n vx: number\n vy: number\n grounded: boolean\n /** Which way the player faces: 1 right, -1 left. */\n facing: 1 | -1\n /** Seconds since last on the ground (coyote time). */\n air: number\n /** Seconds since the jump was pressed, while it waits to be used (jump buffer). */\n queued: number\n jumpHeld: boolean\n collected: string[]\n deaths: number\n won: boolean\n /** Seconds the game has run: where the patrolling hazards are. */\n t: number\n /** Hazards stomped on (gone). */\n defeated: string[]\n /** Blocks bumped, and when they were last (for the bounce). */\n bumped: Record<string, number>\n /** Coins from blocks, on top of the collected ones. */\n bonus: number\n}\n\nexport type PlatformerEvent = { type: 'stomp'; id: string } | { type: 'bump'; id: string; reward: number } | { type: 'jump' } | { type: 'land' } | { type: 'collect'; id: string } | { type: 'die' } | { type: 'win' }\n\nexport function createPlatformer(level: PlatformerLevel): PlatformerWorld {\n return { level, x: level.player.x, y: level.player.y, vx: 0, vy: 0, grounded: false, facing: 1, air: 0, queued: Infinity, jumpHeld: false, collected: [], deaths: 0, won: false, t: 0, defeated: [], bumped: {}, bonus: 0 }\n}\n\nconst PATROL_SPEED = 80\n\n/** How far a hazard has walked from where it was drawn at `t` seconds, and which way it faces. */\nexport function patrolAt(patrol: Patrol | undefined, t: number): { dx: number; facing: 1 | -1 } {\n const d = patrol?.distance ?? 0\n if (!(d > 0)) return { dx: 0, facing: 1 }\n const p = (t * Math.max(1, patrol!.speed ?? PATROL_SPEED)) % (2 * d)\n return p < d ? { dx: p, facing: 1 } : { dx: 2 * d - p, facing: -1 }\n}\n\n/** How high a bumped block is lifted at the world's time (0 once it has settled). */\nexport function bumpLift(world: PlatformerWorld, id: string): number {\n const at = world.bumped[id]\n if (at === undefined) return 0\n const k = (world.t - at) / BUMP_TIME\n return k >= 0 && k < 1 ? Math.sin(k * Math.PI) * BUMP_HEIGHT : 0\n}\n\n/** Every patrolling hazard's offset now. */\nexport function hazardOffsets(world: PlatformerWorld): { id: string; dx: number; facing: 1 | -1 }[] {\n return world.level.hazards.filter(h => h.patrol).map(h => ({ id: h.id, ...patrolAt(h.patrol, world.t) }))\n}\n\n/** In the air, running, or standing still. */\nexport function playerMotion(world: PlatformerWorld): PlayerMotion {\n if (!world.grounded) return 'jump'\n return Math.abs(world.vx) > 20 ? 'run' : 'idle'\n}\n\nconst overlaps = (a: { x: number; y: number; w: number; h: number }, b: PhysicsBox) =>\n a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y\n\nconst approach = (v: number, to: number, by: number) => (v < to ? Math.min(to, v + by) : Math.max(to, v - by))\n\n/** The longest a single step integrates; a longer frame (a hidden tab coming back) is taken in pieces. */\nconst MAX_DT = 1 / 120\n\n/** Advance the world by `dt` seconds of `input`. Returns the new world and what happened. */\nexport function stepPlatformer(world: PlatformerWorld, input: PlatformerInput, dt: number): { world: PlatformerWorld; events: PlatformerEvent[] } {\n const events: PlatformerEvent[] = []\n let w = world\n let left = Math.min(Math.max(0, dt), 0.25)\n while (left > 0 && !w.won) {\n const h = Math.min(MAX_DT, left)\n w = substep(w, input, h, events)\n left -= h\n }\n return { world: w, events }\n}\n\nfunction substep(world: PlatformerWorld, input: PlatformerInput, dt: number, events: PlatformerEvent[]): PlatformerWorld {\n const { level } = world\n const s = level.settings\n const pw = level.player.w, ph = level.player.h\n let { x, y, vx, vy, grounded, facing, air, queued, collected, deaths, defeated, bumped, bonus } = world\n const t = world.t + dt\n\n // Run: toward the held direction's top speed, slower to turn in the air.\n const dir = (input.right ? 1 : 0) - (input.left ? 1 : 0)\n if (dir) facing = dir > 0 ? 1 : -1\n vx = approach(vx, dir * s.speed, s.accel * (grounded ? 1 : 0.65) * dt)\n\n // Jump: a fresh press is queued for `buffer`; it fires while on the ground or within `coyote` of leaving it.\n const pressed = input.jump && !world.jumpHeld\n queued = pressed ? 0 : queued + dt\n air = grounded ? 0 : air + dt\n if (queued <= s.buffer && air <= s.coyote) {\n vy = -s.jump\n grounded = false\n air = s.coyote + 1\n queued = Infinity\n events.push({ type: 'jump' })\n }\n // Let go early and the rise is cut short.\n if (!input.jump && vy < -s.jump * 0.4) vy = -s.jump * 0.4\n\n vy = Math.min(s.maxFall, vy + s.gravity * dt)\n\n // Move one axis at a time, so a corner never lets the player through a wall.\n x += vx * dt\n for (const b of level.solids) {\n if (!overlaps({ x, y, w: pw, h: ph }, b)) continue\n x = vx > 0 ? b.x - pw : b.x + b.w\n vx = 0\n }\n const wasGrounded = grounded\n const before = y\n y += vy * dt\n grounded = false\n for (const b of level.solids) {\n if (!overlaps({ x, y, w: pw, h: ph }, b)) continue\n if (vy > 0) { y = b.y - ph; grounded = true } else {\n y = b.y + b.h\n // A head under a block bumps it (only the block most under the head, once per hit).\n if (b.bump && vy < 0 && x + pw / 2 >= b.x - pw / 2 && x + pw / 2 <= b.x + b.w + pw / 2) {\n const first = !(b.id in bumped)\n const reward = first ? b.bump.reward ?? 0 : 0\n bumped = { ...bumped, [b.id]: t }\n bonus += reward\n events.push({ type: 'bump', id: b.id, reward })\n }\n }\n vy = 0\n }\n // One-way platforms: only from above, only when the feet were above the top last step.\n if (vy >= 0) for (const b of level.platforms) {\n if (before + ph <= b.y + 0.5 && y + ph >= b.y && x + pw > b.x && x < b.x + b.w) { y = b.y - ph; vy = 0; grounded = true }\n }\n if (grounded && !wasGrounded) events.push({ type: 'land' })\n\n const me = { x, y, w: pw, h: ph }\n for (const c of level.collectibles) {\n if (!collected.includes(c.id) && overlaps(me, c)) { collected = [...collected, c.id]; events.push({ type: 'collect', id: c.id }) }\n }\n let won: boolean = world.won\n if (level.goal && overlaps(me, level.goal)) { won = true; events.push({ type: 'win' }) }\n // A hazard touched: stomped when it can be and the feet came down onto its top half, else a death.\n let hurt = false\n for (const hz of level.hazards) {\n if (defeated.includes(hz.id)) continue\n const at = { ...hz, x: hz.x + patrolAt(hz.patrol, t).dx }\n if (!overlaps(me, at)) continue\n if (hz.stomp && vy > 0 && before + ph <= at.y + at.h / 2) {\n defeated = [...defeated, hz.id]\n vy = -s.jump * 0.55\n grounded = false\n air = s.coyote + 1\n events.push({ type: 'stomp', id: hz.id })\n } else hurt = true\n }\n if (!won && (y > level.floor || hurt)) {\n // Back to the start; what was collected stays collected.\n events.push({ type: 'die' })\n return { ...world, x: level.player.x, y: level.player.y, vx: 0, vy: 0, grounded: false, air: 0, queued: Infinity, jumpHeld: input.jump, facing: 1, collected, deaths: deaths + 1, won, t, defeated, bumped, bonus }\n }\n return { ...world, x, y, vx, vy, grounded, facing, air, queued, jumpHeld: input.jump, collected, deaths, won, t, defeated, bumped, bonus }\n}\n\n// \u2500\u2500 The level, from layers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** A layer as the physics sees it: its box on the screen and the role it plays (`physics` on the layer). */\nexport interface PhysicsLayer extends PhysicsBox { role: PhysicsRole; patrol?: Patrol; stomp?: boolean; bump?: Bump }\n\n/**\n * A level from a screen's layers. One player (the first); the rest by role. Settings start from the defaults and\n * take the screen's own. The floor is a little below the lowest thing in the level.\n */\nexport function levelFromLayers(layers: readonly PhysicsLayer[], settings: Partial<PlatformerSettings> = {}, height?: number): PlatformerLevel | null {\n const player = layers.find(l => l.role === 'player')\n if (!player) return null\n const of = (r: PhysicsRole) => layers.filter(l => l.role === r).map(({ id, x, y, w, h }) => ({ id, x, y, w, h }))\n const bottom = Math.max(height ?? 0, ...layers.map(l => l.y + l.h))\n return {\n player: { id: player.id, x: player.x, y: player.y, w: player.w, h: player.h },\n solids: layers.filter(l => l.role === 'solid').map(({ id, x, y, w, h, bump }) => ({ id, x, y, w, h, ...(bump ? { bump } : {}) })), platforms: of('platform'), collectibles: of('collectible'),\n hazards: layers.filter(l => l.role === 'hazard').map(({ id, x, y, w, h, patrol, stomp }) => ({ id, x, y, w, h, ...(patrol ? { patrol } : {}), ...(stomp ? { stomp } : {}) })),\n goal: of('goal')[0] ?? null,\n floor: bottom + 200,\n settings: { ...PLATFORMER_DEFAULTS, ...settings },\n }\n}\n", "// A platformer, played on a page: `popcraftPlatformer(root, spec)` runs the physics (./physics.ts) every frame and\n// moves the screen's layers to match \u2014 the player by a transform from where it was drawn, a collected item hidden.\n// Input is the keyboard (arrows, A/D/W, space) and any layers the screen marks as on-screen controls, pressed with a\n// finger, a pen or a mouse. Returns a stop function.\n\nimport { bumpLift, createPlatformer, hazardOffsets, levelFromLayers, playerMotion, stepPlatformer, type PhysicsLayer, type PlatformerInput, type PlatformerSettings, type PlatformerWorld, type PlayerMotion } from './physics'\n\nexport type PlatformerControl = 'left' | 'right' | 'jump'\n\nexport interface PlatformerSpec {\n /** The screen's physics layers, in screen px. */\n layers: PhysicsLayer[]\n /** Layers that work as buttons: [layer id, what they press]. */\n controls?: [id: string, control: PlatformerControl][]\n /** Layers hidden while the game plays and shown when it is won (they may be hidden in the design, `data-pc-hidden`). */\n wins?: string[]\n /** Layers inside the player shown only in one state: [layer id, idle | run | jump]. */\n poses?: [id: string, pose: PlayerMotion][]\n /** Scenery that slides against the player's travel: [layer id, px per px travelled]. */\n parallax?: [id: string, factor: number][]\n settings?: Partial<PlatformerSettings>\n /** Pixel art kept pixel-perfect: the player is drawn on this grid (screen px per art pixel); the physics is not. */\n grid?: number\n /** The screen's height (falling below it is a death). */\n height?: number\n}\n\nconst KEYS: Record<string, PlatformerControl> = {\n ArrowLeft: 'left', a: 'left', A: 'left', ArrowRight: 'right', d: 'right', D: 'right',\n ArrowUp: 'jump', w: 'jump', W: 'jump', ' ': 'jump',\n}\n\n/** The game's state as attributes on the screen, for a site's own CSS (a win banner, a score). */\nconst show = (root: HTMLElement, w: PlatformerWorld) => {\n root.dataset.pcCollected = String(w.collected.length + w.bonus)\n root.dataset.pcDeaths = String(w.deaths)\n if (w.won) root.dataset.pcWon = ''\n}\n\nexport function popcraftPlatformer(root: HTMLElement, spec: PlatformerSpec): () => void {\n const level = levelFromLayers(spec.layers, spec.settings, spec.height)\n if (!level) return () => {}\n const find = (id: string) => root.querySelector<HTMLElement>(`[data-pc-id=\"${CSS.escape(id)}\"]`)\n const player = find(level.player.id)\n let world = createPlatformer(level)\n const held = new Set<PlatformerControl>()\n const pressed = new Map<number, PlatformerControl>()\n const input = (): PlatformerInput => ({ left: held.has('left') || [...pressed.values()].includes('left'), right: held.has('right') || [...pressed.values()].includes('right'), jump: held.has('jump') || [...pressed.values()].includes('jump') })\n\n const typing = (t: EventTarget | null) => t instanceof HTMLElement && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))\n const onKey = (down: boolean) => (e: KeyboardEvent) => {\n const c = KEYS[e.key]\n if (!c || e.metaKey || e.ctrlKey || e.altKey || typing(e.target)) return\n e.preventDefault()\n if (down) held.add(c); else held.delete(c)\n }\n const keyDown = onKey(true), keyUp = onKey(false)\n window.addEventListener('keydown', keyDown)\n window.addEventListener('keyup', keyUp)\n const blur = () => { held.clear(); pressed.clear() }\n window.addEventListener('blur', blur)\n\n const unbind: (() => void)[] = []\n for (const [id, control] of spec.controls ?? []) {\n const el = find(id)\n if (!el) continue\n el.style.touchAction = 'none'\n el.style.userSelect = 'none'\n const down = (e: PointerEvent) => { e.preventDefault(); el.setPointerCapture?.(e.pointerId); pressed.set(e.pointerId, control) }\n const up = (e: PointerEvent) => { pressed.delete(e.pointerId) }\n el.addEventListener('pointerdown', down)\n el.addEventListener('pointerup', up)\n el.addEventListener('pointercancel', up)\n unbind.push(() => { el.removeEventListener('pointerdown', down); el.removeEventListener('pointerup', up); el.removeEventListener('pointercancel', up) })\n }\n\n const hidden = new Set<string>()\n const wins = (spec.wins ?? []).map(find).filter((el): el is HTMLElement => !!el)\n for (const el of wins) el.style.visibility = 'hidden'\n // The player's pose layers: the one for what it is doing shows (its idle one when it has none for that).\n const poses = (spec.poses ?? []).map(([id, pose]) => [find(id), pose] as const).filter((p): p is readonly [HTMLElement, PlayerMotion] => !!p[0])\n // Run and jump art is hidden in the design (so the screen shows its idle self); the game takes it over.\n for (const [el] of poses) el.removeAttribute('data-pc-hidden')\n const hazards = new Map(level.hazards.filter(h => h.patrol).map(h => [h.id, find(h.id)]))\n // Blocks that bump, and the layers a bump shows (a used ? block over the live one).\n const blocks = new Map(level.solids.filter(b => b.bump).map(b => [b.id, { el: find(b.id), reveal: b.bump!.reveal ? find(b.bump!.reveal) : null }]))\n for (const { reveal } of blocks.values()) if (reveal) reveal.style.visibility = 'hidden'\n const gone = new Set<string>()\n const scenery = (spec.parallax ?? []).map(([id, f]) => [find(id), f] as const).filter((p): p is readonly [HTMLElement, number] => !!p[0])\n let shownWin = false\n let last = 0\n let raf = 0\n const frame = (now: number) => {\n const dt = last ? (now - last) / 1000 : 0\n last = now\n world = stepPlatformer(world, input(), dt).world\n const g = spec.grid && spec.grid > 0 ? spec.grid : 0\n const at = (v: number) => (g ? Math.round(v / g) * g : v)\n if (player) player.style.transform = `translate(${at(world.x - level.player.x)}px, ${at(world.y - level.player.y)}px)${world.facing < 0 ? ' scaleX(-1)' : ''}`\n for (const [id, b] of blocks) {\n const lift = bumpLift(world, id)\n if (b.el) b.el.style.transform = lift ? `translate(0, ${-at(lift)}px)` : ''\n if (b.reveal && id in world.bumped && b.reveal.style.visibility === 'hidden') { b.reveal.removeAttribute('data-pc-hidden'); b.reveal.style.visibility = '' }\n if (b.reveal) b.reveal.style.transform = b.el?.style.transform ?? ''\n }\n for (const id of world.defeated) if (!gone.has(id)) { gone.add(id); const el = hazards.get(id) ?? find(id); if (el) el.style.visibility = 'hidden' }\n for (const [el, f] of scenery) el.style.transform = `translate(${at(-(world.x - level.player.x) * f)}px, 0)`\n const motion = playerMotion(world)\n const pose = poses.some(([, p]) => p === motion) ? motion : 'idle'\n for (const [el, p] of poses) el.style.visibility = p === pose || !poses.some(([, q]) => q === pose) ? '' : 'hidden'\n for (const h of hazardOffsets(world)) { const el = hazards.get(h.id); if (el) el.style.transform = `translate(${at(h.dx)}px, 0)${h.facing < 0 ? ' scaleX(-1)' : ''}` }\n for (const id of world.collected) if (!hidden.has(id)) { hidden.add(id); const el = find(id); if (el) el.style.visibility = 'hidden' }\n show(root, world)\n if (world.won && !shownWin) { shownWin = true; for (const el of wins) { el.style.visibility = ''; el.removeAttribute('data-pc-hidden') } }\n raf = requestAnimationFrame(frame)\n }\n raf = requestAnimationFrame(frame)\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('keydown', keyDown)\n window.removeEventListener('keyup', keyUp)\n window.removeEventListener('blur', blur)\n for (const u of unbind) u()\n if (player) player.style.transform = ''\n for (const [el] of poses) el.style.visibility = ''\n for (const [el] of scenery) el.style.transform = ''\n for (const { el, reveal } of blocks.values()) { if (el) el.style.transform = ''; if (reveal) { reveal.style.transform = ''; reveal.style.visibility = 'hidden' } }\n for (const id of gone) { const el = find(id); if (el) el.style.visibility = '' }\n for (const el of hazards.values()) if (el) el.style.transform = ''\n for (const id of hidden) { const el = find(id); if (el) el.style.visibility = '' }\n for (const el of wins) el.style.visibility = ''\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAaO,IAAM,cAAN,cAA0B,MAAM;AAAC;AAEjC,IAAM,MAAM,CAAC,MAAyB;AAC3C,MAAI,OAAO,MAAM,SAAU,QAAO,OAAO,SAAS,CAAC,IAAI,IAAI;AAC3D,MAAI,OAAO,MAAM,UAAW,QA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AACjK,eAAW,MAAM,MAAM;AAAE,YAAM,KAAK,KAAK,EAAE;AAAG,UAAI,GAAI,IAAG,MAAM,aAAa;AAAA,IAAG;AAC/E,eAAW,MAAM,QAAQ,OAAO,EAAG,KAAI,GAAI,IAAG,MAAM,YAAY;AAChE,eAAW,MAAM,QAAQ;AAAE,YAAM,KAAK,KAAK,EAAE;AAAG,UAAI,GAAI,IAAG,MAAM,aAAa;AAAA,IAAG;AACjF,eAAW,MAAM,KAAM,IAAG,MAAM,aAAa;AAAA,EAC/C;AACF;",
|
|
6
6
|
"names": ["u", "text", "m", "id", "t", "total"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popcraft/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"description": "What code exported from PopCraft shares: the meaning of expressions (operators and functions) and, as it grows, the parts of a design's behaviour that are common code rather than generated React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"esbuild": "0.28.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@neondatabase/serverless": "^1.
|
|
43
|
-
"postgres": "^3.4.
|
|
42
|
+
"@neondatabase/serverless": "^1.2.0",
|
|
43
|
+
"postgres": "^3.4.9"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "node build.mjs",
|