diff --git a/README.md b/README.md index 0a63bb9..c8baee3 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ Turn a Bambu Lab printer into a pen plotter, with a page that tells you what to do at each step: when to put the pen in, how to set its height, and where the paper is on the bed. -Draw handwritten-style text (letters, poems), trace PNG/JPEG images, or plot -SVGs. +Draw handwritten-style text (letters, poems) with a font, size and bold, +italic or underline for each word, trace PNG/JPEG images, or plot SVGs. The +paper preview shows exactly what the pen will draw; drag it to move, resize or +turn the drawing. ## Running it diff --git a/app/design.py b/app/design.py index d45451e..11a09c4 100644 --- a/app/design.py +++ b/app/design.py @@ -4,13 +4,17 @@ Everything here returns strokes: lists of (x, y) points in millimetres, with the origin at the top-left and y pointing down, like on paper. """ +import functools import io import random +from dataclasses import dataclass +from typing import Literal import cv2 import numpy as np import svgelements from HersheyFonts import HersheyFonts +from pydantic import BaseModel type Stroke = list[tuple[float, float]] @@ -40,51 +44,163 @@ def random_poem() -> str: return random.choice(POEMS) +# Typographic characters the fonts don't have, drawn as ones they do. +SUBSTITUTES = {"’": "'", "‘": "'", "“": '"', "”": '"', "–": "-", "—": "-", "\t": " ", "\u00a0": " "} + +# How far a letter moves the pen along, and its strokes. +type Glyph = tuple[float, list[Stroke]] + + +class Run(BaseModel): + """A stretch of text in one style. No font or size means the design's own.""" + + text: str + font: str | None = None + size: float | None = None + bold: bool = False + italic: bool = False + underline: bool = False + + +class Paragraph(BaseModel): + align: Literal["left", "center", "right"] = "left" + runs: list[Run] = [] + + +def plain_paragraphs(text: str, align: Literal["left", "center", "right"] = "left") -> list[Paragraph]: + return [Paragraph(align=align, runs=[Run(text=line)] if line else []) for line in text.split("\n")] + + +@dataclass(frozen=True) +class Font: + glyphs: dict[str, Glyph] + # Where letters sit, as a fraction of their height from the top. + baseline: float + + +@functools.cache +def load_font(name: str) -> Font: + """A font scaled for 1 mm tall letters, with y down from the top of the letter.""" + f = HersheyFonts() + f.load_default_font(name if name in FONTS else "scripts") + top, base, bottom = f.render_options.cap_line, f.render_options.base_line, f.render_options.bottom_line + scale = 1 / (bottom - top) + glyphs: dict[str, Glyph] = {} + for char, g in f.all_glyphs.items(): + strokes = [[((x - g.left_offset) * scale, (y - top) * scale) for x, y in stroke] for stroke in g.strokes] + glyphs[char] = (g.char_width * scale, strokes) + for char, same in SUBSTITUTES.items(): + glyphs[char] = glyphs[same] + return Font(glyphs, (base - top) * scale) + + +@dataclass(frozen=True) +class _Style: + font: Font + size: float + bold: bool + italic: bool + underline: bool + + @property + def bold_offset(self) -> float: + # About a pen's width, so the second pass sits right next to the first. + return min(max(self.size * 0.04, 0.25), 0.5) if self.bold else 0.0 + + def advance(self, char: str) -> float: + glyph = self.font.glyphs.get(char) + return glyph[0] * self.size + self.bold_offset if glyph else 0.0 + + +ITALIC_SLANT = 0.2 + + def text_strokes( - text: str, + paragraphs: list[Paragraph], *, font: str, size: float, max_width: float, line_spacing: float = 1.6, - align: str = "left", ) -> list[Stroke]: - """Lay out text with `size` mm tall letters, wrapping at `max_width` mm.""" - f = HersheyFonts() - f.load_default_font(font if font in FONTS else "scripts") - f.normalize_rendering(size) - - def width(s: str) -> float: - xs = [x for stroke in f.strokes_for_text(s) for x, _ in stroke] - return max(xs) if xs else 0.0 - - lines: list[str] = [] - for paragraph in text.splitlines(): - current = "" - for word in paragraph.split(): - candidate = f"{current} {word}".strip() - if current and width(candidate) > max_width: - lines.append(current) - current = word - else: - current = candidate - lines.append(current) + """Lay out styled text, wrapping at `max_width` mm. + Letters of different sizes on one line share a baseline, and each line is + as tall as its biggest letters. The fonts only come in one weight, so bold + goes over each letter twice, a pen's width apart. + """ strokes: list[Stroke] = [] - line_height = size * line_spacing - for i, line in enumerate(lines): - baseline = size + i * line_height - offset = 0.0 - if align == "center": - offset = (max_width - width(line)) / 2 - elif align == "right": - offset = max_width - width(line) - for stroke in f.strokes_for_text(line): - # Hershey glyphs have y pointing up. - strokes.append([(offset + x, baseline - y) for x, y in stroke]) + top = 0.0 + for paragraph in paragraphs: + chars: list[tuple[str, _Style]] = [] + for run in paragraph.runs: + style = _Style(load_font(run.font or font), run.size or size, run.bold, run.italic, run.underline) + chars += [(c, style) for c in run.text] + if not chars: + top += size * line_spacing + continue + for line in _wrap(chars, max_width): + visible = _rstrip_spaces(line) + width = sum(style.advance(c) for c, style in visible) + x = {"center": (max_width - width) / 2, "right": max_width - width}.get(paragraph.align, 0.0) + baseline = top + max(style.size * style.font.baseline for _, style in line) + underline: list[tuple[float, float, float]] = [] + for i, (char, style) in enumerate(line): + glyph = style.font.glyphs.get(char) + if glyph is None: + continue + letter_top = baseline - style.size * style.font.baseline + for stroke in glyph[1]: + points = [(x + gx * style.size, letter_top + gy * style.size) for gx, gy in stroke] + if style.italic: + points = [(px + (baseline - py) * ITALIC_SLANT, py) for px, py in points] + strokes.append(points) + if style.bold: + strokes.append([(px + style.bold_offset, py) for px, py in points]) + end = x + style.advance(char) + if style.underline and i < len(visible): + if underline and abs(underline[-1][1] - x) < 1e-6: + x0, _, y = underline.pop() + underline.append((x0, end, max(y, baseline + style.size * 0.15))) + else: + underline.append((x, end, baseline + style.size * 0.15)) + x = end + strokes += [[(x0, y), (x1, y)] for x0, x1, y in underline] + top += max(style.size for _, style in line) * line_spacing return strokes +def _wrap(chars: list[tuple[str, _Style]], max_width: float) -> list[list[tuple[str, _Style]]]: + """Split a paragraph into lines at spaces. Spaces where it wraps stay at the end of the line before.""" + lines: list[list[tuple[str, _Style]]] = [] + line_start, x, has_word = 0, 0.0, False + i = 0 + while i < len(chars): + if chars[i][0] == " ": + x += chars[i][1].advance(" ") + i += 1 + continue + j, word = i, 0.0 + while j < len(chars) and chars[j][0] != " ": + word += chars[j][1].advance(chars[j][0]) + j += 1 + if has_word and x + word > max_width: + lines.append(chars[line_start:i]) + line_start, x = i, 0.0 + x += word + has_word = True + i = j + lines.append(chars[line_start:]) + return lines + + +def _rstrip_spaces[T](line: list[tuple[str, T]]) -> list[tuple[str, T]]: + end = len(line) + while end and line[end - 1][0] == " ": + end -= 1 + return line[:end] + + def svg_strokes(data: bytes) -> list[Stroke]: """Every visible shape in the SVG as strokes, in mm.""" svg = svgelements.SVG.parse(io.BytesIO(data), reify=True) diff --git a/app/main.py b/app/main.py index 86eb126..b5f581e 100644 --- a/app/main.py +++ b/app/main.py @@ -35,6 +35,8 @@ PAPER_SIZES = { class Design(BaseModel): kind: Literal["text", "image", "svg"] = "text" text: str = design.random_poem() + # The text with its styling. Without it, `text` is drawn all in `font` and `size`. + doc: list[design.Paragraph] | None = None font: str = "scripts" size: float = 5.0 line_spacing: float = 1.6 @@ -105,16 +107,18 @@ def paper_size() -> tuple[float, float]: return DEFAULT_PAPER -def strokes_on_paper() -> tuple[list[design.Stroke], bool]: +def strokes_on_paper() -> tuple[list[design.Stroke], bool, dict | None]: """The current design on the paper, ordered for drawing. - Also says whether some of it was cut off for being outside the paper. + Also says whether some of it was cut off for being outside the paper, and + how it was moved there: the page draws handles from that, and shifts the + preview to follow them until a new one arrives. """ d = state.design paper_w, paper_h = paper_size() placed = laid_out(paper_w, paper_h) if not placed: - return [], False + return [], False, None scale = d.scale / 100 if d.kind != "text": # At 100% a picture fills the paper whichever way it's turned. Text @@ -126,7 +130,15 @@ def strokes_on_paper() -> tuple[list[design.Stroke], bool]: moved = plot.transform(placed, rotation=d.rotation, scale=scale, offset=(d.offset_x, d.offset_y)) x0, y0, x1, y1 = plot.bounds(moved) overflow = x0 < -0.5 or y0 < -0.5 or x1 > paper_w + 0.5 or y1 > paper_h + 0.5 - return plot.order(plot.clip(moved, paper_w, paper_h)), overflow + frame = { + "box": plot.bounds(placed), + "scale": scale, + # How much smaller than asked it had to be to fit, for pictures. + "fit": scale / (d.scale / 100), + "rotation": d.rotation, + "offset": (d.offset_x, d.offset_y), + } + return plot.order(plot.clip(moved, paper_w, paper_h)), overflow, frame def laid_out(paper_w: float, paper_h: float) -> list[design.Stroke]: @@ -139,12 +151,11 @@ def laid_out(paper_w: float, paper_h: float) -> list[design.Stroke]: room_w, room_h = paper_w - 2 * d.margin, paper_h - 2 * d.margin if d.kind == "text": strokes = design.text_strokes( - d.text, + d.doc if d.doc is not None else design.plain_paragraphs(d.text, d.align), font=d.font, size=d.size, max_width=room_w, line_spacing=d.line_spacing, - align=d.align, ) # Text keeps the size asked for, starting at the top-left margin. placed = [[(x + d.margin, y + d.margin) for x, y in s] for s in strokes] @@ -176,7 +187,7 @@ def laid_out(paper_w: float, paper_h: float) -> list[design.Stroke]: def preview() -> dict: paper_w, paper_h = paper_size() try: - strokes, overflow = strokes_on_paper() + strokes, overflow, frame = strokes_on_paper() except Exception as e: # noqa: BLE001 - show any tracing error next to the design return {"d": "", "width": paper_w, "height": paper_h, "error": str(e), "strokes": 0} draw, _ = plot.length(strokes) @@ -189,6 +200,7 @@ def preview() -> dict: "draw_mm": round(draw), "estimated_seconds": round(plot.estimate_seconds(strokes, printer.settings)), "overflow": overflow, + "frame": frame, "error": None, } @@ -373,14 +385,14 @@ def save_settings(body: PenSettings): @app.post("/design") def update_design(body: Design): - state.design = body + state.design = body.model_copy(update={"text": body.text.replace("\r\n", "\n")}) state.save_design() return back() @app.post("/design/poem") def new_poem(): - state.design = state.design.model_copy(update={"kind": "text", "text": design.random_poem()}) + state.design = state.design.model_copy(update={"kind": "text", "text": design.random_poem(), "doc": None}) state.save_design() return back() @@ -409,7 +421,7 @@ def plot_start(): s = printer.settings if not (s.paper_top_left and s.paper_bottom_right): return back("error", "Mark the paper first") - strokes, _ = strokes_on_paper() + strokes, _, _ = strokes_on_paper() if not strokes: return back("error", "There's nothing to draw yet") name = state.upload_name if state.design.kind != "text" else state.design.text.strip().split("\n")[0][:40] diff --git a/bun.lock b/bun.lock index ee7999f..9c5b78d 100644 --- a/bun.lock +++ b/bun.lock @@ -7,6 +7,17 @@ "dependencies": { "@inertiajs/react": "^3.9.1", "@inertiajs/vite": "^3.9.1", + "@tiptap/core": "3.31.4", + "@tiptap/extension-bold": "3.31.4", + "@tiptap/extension-document": "3.31.4", + "@tiptap/extension-italic": "3.31.4", + "@tiptap/extension-paragraph": "3.31.4", + "@tiptap/extension-text": "3.31.4", + "@tiptap/extension-text-align": "3.31.4", + "@tiptap/extension-underline": "3.31.4", + "@tiptap/extensions": "3.31.4", + "@tiptap/pm": "3.31.4", + "@tiptap/react": "3.31.4", "clsx": "^2.1.1", "lucide-react": "^1.55.0", "react": "^19.3.0", @@ -26,6 +37,12 @@ }, }, "packages": { + "@floating-ui/core": ["@floating-ui/core@1.8.0", "", { "dependencies": { "@floating-ui/utils": "^0.2.12" } }, "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ=="], + + "@floating-ui/dom": ["@floating-ui/dom@1.8.0", "", { "dependencies": { "@floating-ui/core": "^1.8.0", "@floating-ui/utils": "^0.2.12" } }, "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg=="], + + "@floating-ui/utils": ["@floating-ui/utils@0.2.12", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="], + "@inertiajs/core": ["@inertiajs/core@3.9.1", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.31", "es-toolkit": "^1.33.0", "laravel-precognition": "^2.1.0" }, "peerDependencies": { "axios": "^1.15.2" }, "optionalPeers": ["axios"] }, "sha512-ScLQZ1/KXlvmqCEJMEZABSK5updJZIli1kaG/coWXpWMmpSLsazSJkR7esITYp7X5vTgrOGNIrcRmdMp/GQ0NA=="], "@inertiajs/react": ["@inertiajs/react@3.9.1", "", { "dependencies": { "@inertiajs/core": "3.9.1", "es-toolkit": "^1.33.0", "laravel-precognition": "^2.1.0" }, "peerDependencies": { "react": "^19.0.0", "react-dom": "^19.0.0" } }, "sha512-fRWElF5XIm1j01ecQCEehx0KPLEYVA6fCdWvig7XUhwhmSQG6EIyNum3eG8ZEfYuY7mWhNyqae/MSRIv+bAsjw=="], @@ -106,6 +123,32 @@ "@tailwindcss/vite": ["@tailwindcss/vite@4.3.3", "", { "dependencies": { "@tailwindcss/node": "4.3.3", "@tailwindcss/oxide": "4.3.3", "tailwindcss": "4.3.3" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, "sha512-yYU8cogLeSh/ms2jh8Fj7jaba/EWa7Ja6GoUqYZaraEuCI5YS6ms6ObZgjjedm+jm6XZjdNRWBpPP6Z86oOxcw=="], + "@tiptap/core": ["@tiptap/core@3.31.4", "", { "peerDependencies": { "@tiptap/pm": "3.31.4" } }, "sha512-cIVUQYBycighzsk6GbmCef8ZiEDVxoT5EuAe4xg2q9dNkDqCXVqI4YGr9aavCQEiAS4uHiRwqvcsPqJHipFDfg=="], + + "@tiptap/extension-bold": ["@tiptap/extension-bold@3.31.4", "", { "peerDependencies": { "@tiptap/core": "3.31.4" } }, "sha512-QX1xoXvO0gz6uVsoLegumqQ4MJXL7lcUDQZ4J7la7LBqiIh4efrCmp2EXbhpr37M/YQL7w8q3g7H/VovSh7xIg=="], + + "@tiptap/extension-bubble-menu": ["@tiptap/extension-bubble-menu@3.31.4", "", { "dependencies": { "@floating-ui/dom": "^1.0.0" }, "peerDependencies": { "@tiptap/core": "3.31.4", "@tiptap/pm": "3.31.4" } }, "sha512-Ml/yswuys+3QkOMajfXyAGlUKCxEbT3dMyF8vHwQ5mDk9MDm+dqp10It5CrDBkUT/KkVTa6AJI3kb0TXZJZiAA=="], + + "@tiptap/extension-document": ["@tiptap/extension-document@3.31.4", "", { "peerDependencies": { "@tiptap/core": "3.31.4" } }, "sha512-vT20u62RWR+BLIyNJ54e24MPUY4zm8VF7tcgJnxQXi7BgVJWcNMtMWWDIkPJ4JNXwfoIznKh3jzYsaYmbCJgQQ=="], + + "@tiptap/extension-floating-menu": ["@tiptap/extension-floating-menu@3.31.4", "", { "peerDependencies": { "@floating-ui/dom": "^1.0.0", "@tiptap/core": "3.31.4", "@tiptap/pm": "3.31.4" } }, "sha512-pKzulkDmolpVt7IP9FSPsC5pKbXQ5pyeqkaAYr8cyOVW+KUObpPRIzAuXvEso8PCjWgwJ1f2qyishOEMw8MbfQ=="], + + "@tiptap/extension-italic": ["@tiptap/extension-italic@3.31.4", "", { "peerDependencies": { "@tiptap/core": "3.31.4" } }, "sha512-pftTQBPYZocNDAj/u6OyDIp7YxmN0+N895cQPogJQ6qMHdLiRhzgawiEewJkniyN1w8k3Wx/Etp8pTKrxaOOBQ=="], + + "@tiptap/extension-paragraph": ["@tiptap/extension-paragraph@3.31.4", "", { "peerDependencies": { "@tiptap/core": "3.31.4" } }, "sha512-WZlBgw+XVKXerRlmEsoQ7x1PwSU+dh3X+b70+ViZsLebdfsmmYBIaNDrvIGwG9UQr5eLnddJnZplMSTI2YKs+g=="], + + "@tiptap/extension-text": ["@tiptap/extension-text@3.31.4", "", { "peerDependencies": { "@tiptap/core": "3.31.4" } }, "sha512-WL2ZRpFksgQcXJN05/UQH09YCH9LlhdLrSEcviASvEH/aAfsKiJlDrouN8PET+YAWK/F5xFc5/Q1z0xj+I23jw=="], + + "@tiptap/extension-text-align": ["@tiptap/extension-text-align@3.31.4", "", { "peerDependencies": { "@tiptap/core": "3.31.4" } }, "sha512-Z8x/x2N4BiFwu7+UfJABT/OQbwZPUHbmvAH6Fo5lefgeIlTwAXFBzz4x7Eeed7iJAcXUzOnyd6bmkhK36gYJ2g=="], + + "@tiptap/extension-underline": ["@tiptap/extension-underline@3.31.4", "", { "peerDependencies": { "@tiptap/core": "3.31.4" } }, "sha512-0iFGPIqmqGkCrOFh1OPo7Dzv5s86dVN3bZaugsz0jK04otkb8bn04ZDKP2/6Wq+lcK0M9DfJ0QqfW5hC2nBZxQ=="], + + "@tiptap/extensions": ["@tiptap/extensions@3.31.4", "", { "peerDependencies": { "@tiptap/core": "3.31.4", "@tiptap/pm": "3.31.4" } }, "sha512-nIupIne/sHpV2Kw1M4MOmr4+G454KI8BXM5+LWKOU2EpzfALZWVSy7koF9lVRna4Zp5Gv8hfg5Z8kvmrYQvhkw=="], + + "@tiptap/pm": ["@tiptap/pm@3.31.4", "", { "dependencies": { "prosemirror-changeset": "^2.4.1", "prosemirror-commands": "^1.7.1", "prosemirror-dropcursor": "^1.8.2", "prosemirror-gapcursor": "^1.4.1", "prosemirror-history": "^1.5.0", "prosemirror-inputrules": "^1.5.1", "prosemirror-keymap": "^1.2.3", "prosemirror-model": "^1.25.11", "prosemirror-schema-list": "^1.5.1", "prosemirror-state": "^1.4.4", "prosemirror-tables": "^1.8.5", "prosemirror-transform": "^1.12.0", "prosemirror-view": "^1.42.3" } }, "sha512-x7dwth79cQp4QGae66/RJqMDJQv0+n7b7dD7cyFQBWqzPFLJxN/4paHY4qbWedZjNLhRyIOAD9a5q4AYM1zmPA=="], + + "@tiptap/react": ["@tiptap/react@3.31.4", "", { "dependencies": { "@types/use-sync-external-store": "^0.0.6", "fast-equals": "^5.3.3", "use-sync-external-store": "^1.4.0" }, "optionalDependencies": { "@tiptap/extension-bubble-menu": "3.31.4", "@tiptap/extension-floating-menu": "3.31.4" }, "peerDependencies": { "@tiptap/core": "3.31.4", "@tiptap/pm": "3.31.4", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "@types/react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-mBvvXgdPhMinT1NPfwHvFK1dFdMXHVWMSeNn0IPj7/zV0XBmOnASkEOwoIvl8NluKYEtpZBE1yA+6pN2enLa5g=="], + "@types/bun": ["@types/bun@1.4.2", "", { "dependencies": { "bun-types": "1.4.2" } }, "sha512-GimotNn7+ZV0uVArItBbriZsR1oNf0+WTzPkdcFrzShI7k2norL0uzEaJT8T33dWr7O/c9ZDuAFQrctKCi72oQ=="], "@types/node": ["@types/node@26.6.5", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg=="], @@ -114,6 +157,8 @@ "@types/react-dom": ["@types/react-dom@19.3.0", "", { "peerDependencies": { "@types/react": "^19.3.0" } }, "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q=="], + "@types/use-sync-external-store": ["@types/use-sync-external-store@0.0.6", "", {}, "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg=="], + "@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="], "@typescript/typescript-darwin-arm64": ["@typescript/typescript-darwin-arm64@7.0.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA=="], @@ -170,6 +215,8 @@ "es-toolkit": ["es-toolkit@1.52.0", "", {}, "sha512-XTNEJQh1tY1ZJVcf6ayP/2n4ZPyaHlW2FWs7xvw5ddPuhUVjLD3olQVQS7kf58JbAB48iL0uL/jerTrjtV3lDA=="], + "fast-equals": ["fast-equals@5.4.5", "", {}, "sha512-yKEpcFuRPu/pTQL2VB8YKE2yFldrLlIsoWtJeBnAdqEhvu21OgkFT0C8njf/xYc2LSZGEr3K9JGjthHJxnVLvQ=="], + "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="], @@ -212,18 +259,48 @@ "nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], + "orderedmap": ["orderedmap@2.1.1", "", {}, "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g=="], + "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], "picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], "postcss": ["postcss@8.5.29", "", { "dependencies": { "nanoid": "^3.3.19", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ=="], + "prosemirror-changeset": ["prosemirror-changeset@2.4.4", "", { "dependencies": { "prosemirror-transform": "^1.0.0" } }, "sha512-Gyuz9jYdrAeA9I7AholyOes9KUmv/lEwsC5O9s5xF5VB3EgTPsXMGUxz4+H1B+wKVPdZbvRcg1Cp3x8qX+8ofA=="], + + "prosemirror-commands": ["prosemirror-commands@1.7.2", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.10.2" } }, "sha512-q6Q6szxqdu9Xd6EcdKsqXghu5nQdZTpB4Q9yd04WRc7/jt763e/rT60Owh0L1GYY+T46o5rD+9lEN36dZS43tw=="], + + "prosemirror-dropcursor": ["prosemirror-dropcursor@1.8.4", "", { "dependencies": { "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.1.0", "prosemirror-view": "^1.1.0" } }, "sha512-VmKxhcA6a+h5oPSYmfF1ZNeQqPbyYaIxqZsKqeYCyTlPtrjUgNaHL3P8vVaO19oqAV0zuaM/axkowZHrB1P3Tg=="], + + "prosemirror-gapcursor": ["prosemirror-gapcursor@1.4.1", "", { "dependencies": { "prosemirror-keymap": "^1.0.0", "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-view": "^1.0.0" } }, "sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw=="], + + "prosemirror-history": ["prosemirror-history@1.5.1", "", { "dependencies": { "prosemirror-state": "^1.2.2", "prosemirror-transform": "^1.0.0", "prosemirror-view": "^1.31.0", "rope-sequence": "^1.3.0" } }, "sha512-onlwnqKvgtFg6srZOmDOAhlAy1FIHQpOExORybX0S+DvJepE5tPALrB9iGet/2sqqqrelSnB10OoiOJqAvu2DA=="], + + "prosemirror-inputrules": ["prosemirror-inputrules@1.5.1", "", { "dependencies": { "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.0.0" } }, "sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw=="], + + "prosemirror-keymap": ["prosemirror-keymap@1.2.3", "", { "dependencies": { "prosemirror-state": "^1.0.0", "w3c-keyname": "^2.2.0" } }, "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw=="], + + "prosemirror-model": ["prosemirror-model@1.25.12", "", { "dependencies": { "orderedmap": "^2.0.0" } }, "sha512-Ue2gTmXMa7EhpLNhC7J+h4+ykD8ha12K6rrZFFKKJHBForfIStw5gJ6Zrf1mqqAa9NmpmEB4wp9bKmA4eUVjWg=="], + + "prosemirror-schema-list": ["prosemirror-schema-list@1.5.1", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.7.3" } }, "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q=="], + + "prosemirror-state": ["prosemirror-state@1.4.4", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-transform": "^1.0.0", "prosemirror-view": "^1.27.0" } }, "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw=="], + + "prosemirror-tables": ["prosemirror-tables@1.8.5", "", { "dependencies": { "prosemirror-keymap": "^1.2.3", "prosemirror-model": "^1.25.4", "prosemirror-state": "^1.4.4", "prosemirror-transform": "^1.10.5", "prosemirror-view": "^1.41.4" } }, "sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw=="], + + "prosemirror-transform": ["prosemirror-transform@1.12.2", "", { "dependencies": { "prosemirror-model": "^1.21.0" } }, "sha512-PE/aY0HEY4zczvmqrilgkUK/WautF0chvMqkmM/iN5/aPHvwrCWaQZjS6CIZp+K84YrvPFqrL+YArrfJX8xX7g=="], + + "prosemirror-view": ["prosemirror-view@1.42.6", "", { "dependencies": { "prosemirror-model": "^1.25.12", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.1.0" } }, "sha512-3g25f6hKV2bBxo3puH3EcYWmmVNSH0iWmNsMVT7sugDSpA025jgpOLarcDWr39SdzPjYMaiYtRdNtXialPSjEQ=="], + "react": ["react@19.3.0", "", {}, "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog=="], "react-dom": ["react-dom@19.3.0", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.0" } }, "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q=="], "rolldown": ["rolldown@1.2.13", "", { "dependencies": { "@oxc-project/types": "=0.153.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.13", "@rolldown/binding-android-arm64": "1.2.13", "@rolldown/binding-darwin-arm64": "1.2.13", "@rolldown/binding-darwin-x64": "1.2.13", "@rolldown/binding-freebsd-x64": "1.2.13", "@rolldown/binding-linux-arm-gnueabihf": "1.2.13", "@rolldown/binding-linux-arm64-gnu": "1.2.13", "@rolldown/binding-linux-arm64-musl": "1.2.13", "@rolldown/binding-linux-ppc64-gnu": "1.2.13", "@rolldown/binding-linux-s390x-gnu": "1.2.13", "@rolldown/binding-linux-x64-gnu": "1.2.13", "@rolldown/binding-linux-x64-musl": "1.2.13", "@rolldown/binding-openharmony-arm64": "1.2.13", "@rolldown/binding-win32-arm64-msvc": "1.2.13", "@rolldown/binding-win32-x64-msvc": "1.2.13" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-/5apOkwWxtACcQtZ5WlrAsKS4JwXVThQPJZ3RqIruRY9UG9M8e0VlXN068xum/JRKA4aIUoJ13ghe/kGCvidiQ=="], + "rope-sequence": ["rope-sequence@1.3.4", "", {}, "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ=="], + "sade": ["sade@1.8.1", "", { "dependencies": { "mri": "^1.1.0" } }, "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A=="], "scheduler": ["scheduler@0.28.0", "", {}, "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw=="], @@ -240,8 +317,12 @@ "undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="], + "use-sync-external-store": ["use-sync-external-store@1.7.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A=="], + "vite": ["vite@8.3.4", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.29", "rolldown": "~1.2.12", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ=="], + "w3c-keyname": ["w3c-keyname@2.2.8", "", {}, "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="], + "@tailwindcss/node/lightningcss": ["lightningcss@1.32.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="], "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" }, "bundled": true }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], diff --git a/bun.nix b/bun.nix index 3617a07..67c34d1 100644 --- a/bun.nix +++ b/bun.nix @@ -25,6 +25,18 @@ url = "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz"; hash = "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="; }; + "@floating-ui/core@1.8.0" = fetchurl { + url = "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz"; + hash = "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ=="; + }; + "@floating-ui/dom@1.8.0" = fetchurl { + url = "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz"; + hash = "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg=="; + }; + "@floating-ui/utils@0.2.12" = fetchurl { + url = "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.12.tgz"; + hash = "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="; + }; "@inertiajs/core@3.9.1" = fetchurl { url = "https://registry.npmjs.org/@inertiajs/core/-/core-3.9.1.tgz"; hash = "sha512-ScLQZ1/KXlvmqCEJMEZABSK5updJZIli1kaG/coWXpWMmpSLsazSJkR7esITYp7X5vTgrOGNIrcRmdMp/GQ0NA=="; @@ -189,6 +201,58 @@ url = "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.3.3.tgz"; hash = "sha512-yYU8cogLeSh/ms2jh8Fj7jaba/EWa7Ja6GoUqYZaraEuCI5YS6ms6ObZgjjedm+jm6XZjdNRWBpPP6Z86oOxcw=="; }; + "@tiptap/core@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/core/-/core-3.31.4.tgz"; + hash = "sha512-cIVUQYBycighzsk6GbmCef8ZiEDVxoT5EuAe4xg2q9dNkDqCXVqI4YGr9aavCQEiAS4uHiRwqvcsPqJHipFDfg=="; + }; + "@tiptap/extension-bold@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-bold/-/extension-bold-3.31.4.tgz"; + hash = "sha512-QX1xoXvO0gz6uVsoLegumqQ4MJXL7lcUDQZ4J7la7LBqiIh4efrCmp2EXbhpr37M/YQL7w8q3g7H/VovSh7xIg=="; + }; + "@tiptap/extension-bubble-menu@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-3.31.4.tgz"; + hash = "sha512-Ml/yswuys+3QkOMajfXyAGlUKCxEbT3dMyF8vHwQ5mDk9MDm+dqp10It5CrDBkUT/KkVTa6AJI3kb0TXZJZiAA=="; + }; + "@tiptap/extension-document@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-document/-/extension-document-3.31.4.tgz"; + hash = "sha512-vT20u62RWR+BLIyNJ54e24MPUY4zm8VF7tcgJnxQXi7BgVJWcNMtMWWDIkPJ4JNXwfoIznKh3jzYsaYmbCJgQQ=="; + }; + "@tiptap/extension-floating-menu@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-3.31.4.tgz"; + hash = "sha512-pKzulkDmolpVt7IP9FSPsC5pKbXQ5pyeqkaAYr8cyOVW+KUObpPRIzAuXvEso8PCjWgwJ1f2qyishOEMw8MbfQ=="; + }; + "@tiptap/extension-italic@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-italic/-/extension-italic-3.31.4.tgz"; + hash = "sha512-pftTQBPYZocNDAj/u6OyDIp7YxmN0+N895cQPogJQ6qMHdLiRhzgawiEewJkniyN1w8k3Wx/Etp8pTKrxaOOBQ=="; + }; + "@tiptap/extension-paragraph@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-paragraph/-/extension-paragraph-3.31.4.tgz"; + hash = "sha512-WZlBgw+XVKXerRlmEsoQ7x1PwSU+dh3X+b70+ViZsLebdfsmmYBIaNDrvIGwG9UQr5eLnddJnZplMSTI2YKs+g=="; + }; + "@tiptap/extension-text-align@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-text-align/-/extension-text-align-3.31.4.tgz"; + hash = "sha512-Z8x/x2N4BiFwu7+UfJABT/OQbwZPUHbmvAH6Fo5lefgeIlTwAXFBzz4x7Eeed7iJAcXUzOnyd6bmkhK36gYJ2g=="; + }; + "@tiptap/extension-text@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-text/-/extension-text-3.31.4.tgz"; + hash = "sha512-WL2ZRpFksgQcXJN05/UQH09YCH9LlhdLrSEcviASvEH/aAfsKiJlDrouN8PET+YAWK/F5xFc5/Q1z0xj+I23jw=="; + }; + "@tiptap/extension-underline@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extension-underline/-/extension-underline-3.31.4.tgz"; + hash = "sha512-0iFGPIqmqGkCrOFh1OPo7Dzv5s86dVN3bZaugsz0jK04otkb8bn04ZDKP2/6Wq+lcK0M9DfJ0QqfW5hC2nBZxQ=="; + }; + "@tiptap/extensions@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/extensions/-/extensions-3.31.4.tgz"; + hash = "sha512-nIupIne/sHpV2Kw1M4MOmr4+G454KI8BXM5+LWKOU2EpzfALZWVSy7koF9lVRna4Zp5Gv8hfg5Z8kvmrYQvhkw=="; + }; + "@tiptap/pm@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/pm/-/pm-3.31.4.tgz"; + hash = "sha512-x7dwth79cQp4QGae66/RJqMDJQv0+n7b7dD7cyFQBWqzPFLJxN/4paHY4qbWedZjNLhRyIOAD9a5q4AYM1zmPA=="; + }; + "@tiptap/react@3.31.4" = fetchurl { + url = "https://registry.npmjs.org/@tiptap/react/-/react-3.31.4.tgz"; + hash = "sha512-mBvvXgdPhMinT1NPfwHvFK1dFdMXHVWMSeNn0IPj7/zV0XBmOnASkEOwoIvl8NluKYEtpZBE1yA+6pN2enLa5g=="; + }; "@tybys/wasm-util@0.10.4" = fetchurl { url = "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz"; hash = "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A=="; @@ -209,6 +273,10 @@ url = "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz"; hash = "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg=="; }; + "@types/use-sync-external-store@0.0.6" = fetchurl { + url = "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz"; + hash = "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg=="; + }; "@typescript/typescript-aix-ppc64@7.0.2" = fetchurl { url = "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz"; hash = "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="; @@ -321,6 +389,10 @@ url = "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.52.0.tgz"; hash = "sha512-XTNEJQh1tY1ZJVcf6ayP/2n4ZPyaHlW2FWs7xvw5ddPuhUVjLD3olQVQS7kf58JbAB48iL0uL/jerTrjtV3lDA=="; }; + "fast-equals@5.4.5" = fetchurl { + url = "https://registry.npmjs.org/fast-equals/-/fast-equals-5.4.5.tgz"; + hash = "sha512-yKEpcFuRPu/pTQL2VB8YKE2yFldrLlIsoWtJeBnAdqEhvu21OgkFT0C8njf/xYc2LSZGEr3K9JGjthHJxnVLvQ=="; + }; "fdir@6.5.0" = fetchurl { url = "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz"; hash = "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="; @@ -453,6 +525,10 @@ url = "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz"; hash = "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="; }; + "orderedmap@2.1.1" = fetchurl { + url = "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz"; + hash = "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g=="; + }; "picocolors@1.1.1" = fetchurl { url = "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz"; hash = "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="; @@ -465,6 +541,58 @@ url = "https://registry.npmjs.org/postcss/-/postcss-8.5.29.tgz"; hash = "sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ=="; }; + "prosemirror-changeset@2.4.4" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-changeset/-/prosemirror-changeset-2.4.4.tgz"; + hash = "sha512-Gyuz9jYdrAeA9I7AholyOes9KUmv/lEwsC5O9s5xF5VB3EgTPsXMGUxz4+H1B+wKVPdZbvRcg1Cp3x8qX+8ofA=="; + }; + "prosemirror-commands@1.7.2" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-commands/-/prosemirror-commands-1.7.2.tgz"; + hash = "sha512-q6Q6szxqdu9Xd6EcdKsqXghu5nQdZTpB4Q9yd04WRc7/jt763e/rT60Owh0L1GYY+T46o5rD+9lEN36dZS43tw=="; + }; + "prosemirror-dropcursor@1.8.4" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-dropcursor/-/prosemirror-dropcursor-1.8.4.tgz"; + hash = "sha512-VmKxhcA6a+h5oPSYmfF1ZNeQqPbyYaIxqZsKqeYCyTlPtrjUgNaHL3P8vVaO19oqAV0zuaM/axkowZHrB1P3Tg=="; + }; + "prosemirror-gapcursor@1.4.1" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-gapcursor/-/prosemirror-gapcursor-1.4.1.tgz"; + hash = "sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw=="; + }; + "prosemirror-history@1.5.1" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.5.1.tgz"; + hash = "sha512-onlwnqKvgtFg6srZOmDOAhlAy1FIHQpOExORybX0S+DvJepE5tPALrB9iGet/2sqqqrelSnB10OoiOJqAvu2DA=="; + }; + "prosemirror-inputrules@1.5.1" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-inputrules/-/prosemirror-inputrules-1.5.1.tgz"; + hash = "sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw=="; + }; + "prosemirror-keymap@1.2.3" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.2.3.tgz"; + hash = "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw=="; + }; + "prosemirror-model@1.25.12" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.25.12.tgz"; + hash = "sha512-Ue2gTmXMa7EhpLNhC7J+h4+ykD8ha12K6rrZFFKKJHBForfIStw5gJ6Zrf1mqqAa9NmpmEB4wp9bKmA4eUVjWg=="; + }; + "prosemirror-schema-list@1.5.1" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.5.1.tgz"; + hash = "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q=="; + }; + "prosemirror-state@1.4.4" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.4.tgz"; + hash = "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw=="; + }; + "prosemirror-tables@1.8.5" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.8.5.tgz"; + hash = "sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw=="; + }; + "prosemirror-transform@1.12.2" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-transform/-/prosemirror-transform-1.12.2.tgz"; + hash = "sha512-PE/aY0HEY4zczvmqrilgkUK/WautF0chvMqkmM/iN5/aPHvwrCWaQZjS6CIZp+K84YrvPFqrL+YArrfJX8xX7g=="; + }; + "prosemirror-view@1.42.6" = fetchurl { + url = "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.42.6.tgz"; + hash = "sha512-3g25f6hKV2bBxo3puH3EcYWmmVNSH0iWmNsMVT7sugDSpA025jgpOLarcDWr39SdzPjYMaiYtRdNtXialPSjEQ=="; + }; "react-dom@19.3.0" = fetchurl { url = "https://registry.npmjs.org/react-dom/-/react-dom-19.3.0.tgz"; hash = "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q=="; @@ -477,6 +605,10 @@ url = "https://registry.npmjs.org/rolldown/-/rolldown-1.2.13.tgz"; hash = "sha512-/5apOkwWxtACcQtZ5WlrAsKS4JwXVThQPJZ3RqIruRY9UG9M8e0VlXN068xum/JRKA4aIUoJ13ghe/kGCvidiQ=="; }; + "rope-sequence@1.3.4" = fetchurl { + url = "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz"; + hash = "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ=="; + }; "sade@1.8.1" = fetchurl { url = "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz"; hash = "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A=="; @@ -513,8 +645,16 @@ url = "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz"; hash = "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="; }; + "use-sync-external-store@1.7.0" = fetchurl { + url = "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz"; + hash = "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A=="; + }; "vite@8.3.4" = fetchurl { url = "https://registry.npmjs.org/vite/-/vite-8.3.4.tgz"; hash = "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ=="; }; + "w3c-keyname@2.2.8" = fetchurl { + url = "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz"; + hash = "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="; + }; } diff --git a/frontend/components/design-panel.tsx b/frontend/components/design-panel.tsx index b089cb3..5998898 100644 --- a/frontend/components/design-panel.tsx +++ b/frontend/components/design-panel.tsx @@ -1,10 +1,11 @@ import { router } from "@inertiajs/react"; import clsx from "clsx"; -import { Dices, ImageUp, RotateCcw, RotateCw, Type, Upload } from "lucide-react"; +import { ImageUp, RotateCcw, RotateCw, Type, Upload } from "lucide-react"; import { useEffect, useRef, useState } from "react"; import type { Design, PageProps } from "@/types"; +import { TextEditor } from "./text-editor"; import { Field, inputClass } from "./ui"; const DESIGN_PROPS = ["design", "preview", "notice"]; @@ -16,10 +17,14 @@ export function useDesign(server: Design): [Design, UpdateDesign] { const [design, setDesign] = useState(server); const latest = useRef(design); const timer = useRef>(undefined); + const sent = useRef(null); - // Pick up changes made on the server (new poem, upload switching tabs). - const serverKey = `${server.kind}|${server.text}|${server.upload_name}`; + // Pick up changes made on the server (new poem, upload switching tabs), but + // not the server echoing back what we sent: there may be newer typing since. + const serverKey = `${server.kind}|${server.text}|${JSON.stringify(server.doc)}|${server.upload_name}`; useEffect(() => { + const echo = sent.current && server.kind === sent.current.kind && server.text === sent.current.text && JSON.stringify(server.doc) === JSON.stringify(sent.current.doc) && server.upload_name === latest.current.upload_name; + if (echo) return; latest.current = server; setDesign(server); }, [serverKey]); @@ -30,6 +35,7 @@ export function useDesign(server: Design): [Design, UpdateDesign] { setDesign(next); clearTimeout(timer.current); timer.current = setTimeout(() => { + sent.current = latest.current; const { upload_name, ...body } = latest.current; router.post("/design", body, { preserveScroll: true, preserveState: true, only: DESIGN_PROPS }); }, 250); @@ -73,41 +79,12 @@ export function DesignPanel({ props, design, update }: { props: PageProps; desig {design.kind === "text" ? (
-
-