@inhuman.tools/quickdraw 0.0.0-bootstrap.0 → 0.2.0
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/LICENSE.md +7 -0
- package/README.md +102 -1
- package/aurora.vert +168 -0
- package/dist/bench/host.d.ts +62 -0
- package/dist/bench/host.d.ts.map +1 -0
- package/dist/bench/host.js +77 -0
- package/dist/bench/host.js.map +1 -0
- package/dist/bench/main.d.ts +6 -0
- package/dist/bench/main.d.ts.map +1 -0
- package/dist/bench/main.js +118 -0
- package/dist/bench/main.js.map +1 -0
- package/dist/bench/model.d.ts +36 -0
- package/dist/bench/model.d.ts.map +1 -0
- package/dist/bench/model.js +112 -0
- package/dist/bench/model.js.map +1 -0
- package/dist/bench/tea.d.ts +14 -0
- package/dist/bench/tea.d.ts.map +1 -0
- package/dist/bench/tea.js +6 -0
- package/dist/bench/tea.js.map +1 -0
- package/dist/bench/view.d.ts +9 -0
- package/dist/bench/view.d.ts.map +1 -0
- package/dist/bench/view.js +88 -0
- package/dist/bench/view.js.map +1 -0
- package/dist/bench/worker.d.ts +6 -0
- package/dist/bench/worker.d.ts.map +1 -0
- package/dist/bench/worker.js +46 -0
- package/dist/bench/worker.js.map +1 -0
- package/dist/buffer/bgfx-mark.d.ts +32 -0
- package/dist/buffer/bgfx-mark.d.ts.map +1 -0
- package/dist/buffer/bgfx-mark.js +43 -0
- package/dist/buffer/bgfx-mark.js.map +1 -0
- package/dist/buffer/index.d.ts +191 -0
- package/dist/buffer/index.d.ts.map +1 -0
- package/dist/buffer/index.js +353 -0
- package/dist/buffer/index.js.map +1 -0
- package/dist/capabilities/env.d.ts +23 -0
- package/dist/capabilities/env.d.ts.map +1 -0
- package/dist/capabilities/env.js +35 -0
- package/dist/capabilities/env.js.map +1 -0
- package/dist/capabilities/index.d.ts +13 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +13 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/parse.d.ts +41 -0
- package/dist/capabilities/parse.d.ts.map +1 -0
- package/dist/capabilities/parse.js +86 -0
- package/dist/capabilities/parse.js.map +1 -0
- package/dist/capabilities/probe.d.ts +37 -0
- package/dist/capabilities/probe.d.ts.map +1 -0
- package/dist/capabilities/probe.js +75 -0
- package/dist/capabilities/probe.js.map +1 -0
- package/dist/capabilities/sequences.d.ts +33 -0
- package/dist/capabilities/sequences.d.ts.map +1 -0
- package/dist/capabilities/sequences.js +36 -0
- package/dist/capabilities/sequences.js.map +1 -0
- package/dist/capabilities/types.d.ts +25 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +5 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/input/decode.d.ts +167 -0
- package/dist/input/decode.d.ts.map +1 -0
- package/dist/input/decode.js +825 -0
- package/dist/input/decode.js.map +1 -0
- package/dist/input/draft.d.ts +85 -0
- package/dist/input/draft.d.ts.map +1 -0
- package/dist/input/draft.js +276 -0
- package/dist/input/draft.js.map +1 -0
- package/dist/input/index.d.ts +3 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/input/index.js +3 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input/prompt-blocks.d.ts +58 -0
- package/dist/input/prompt-blocks.d.ts.map +1 -0
- package/dist/input/prompt-blocks.js +48 -0
- package/dist/input/prompt-blocks.js.map +1 -0
- package/dist/input/rich-draft.d.ts +46 -0
- package/dist/input/rich-draft.d.ts.map +1 -0
- package/dist/input/rich-draft.js +391 -0
- package/dist/input/rich-draft.js.map +1 -0
- package/dist/input/rich-hit.d.ts +17 -0
- package/dist/input/rich-hit.d.ts.map +1 -0
- package/dist/input/rich-hit.js +89 -0
- package/dist/input/rich-hit.js.map +1 -0
- package/dist/input/rich-intake.d.ts +16 -0
- package/dist/input/rich-intake.d.ts.map +1 -0
- package/dist/input/rich-intake.js +22 -0
- package/dist/input/rich-intake.js.map +1 -0
- package/dist/input/rich-paint.d.ts +13 -0
- package/dist/input/rich-paint.d.ts.map +1 -0
- package/dist/input/rich-paint.js +18 -0
- package/dist/input/rich-paint.js.map +1 -0
- package/dist/internals/bgfx/index.d.ts +17 -0
- package/dist/internals/bgfx/index.d.ts.map +1 -0
- package/dist/internals/bgfx/index.js +17 -0
- package/dist/internals/bgfx/index.js.map +1 -0
- package/dist/internals/bgfx/materialize.d.ts +31 -0
- package/dist/internals/bgfx/materialize.d.ts.map +1 -0
- package/dist/internals/bgfx/materialize.js +117 -0
- package/dist/internals/bgfx/materialize.js.map +1 -0
- package/dist/internals/bgfx/opacity.d.ts +37 -0
- package/dist/internals/bgfx/opacity.d.ts.map +1 -0
- package/dist/internals/bgfx/opacity.js +76 -0
- package/dist/internals/bgfx/opacity.js.map +1 -0
- package/dist/internals/bgfx/registry.d.ts +13 -0
- package/dist/internals/bgfx/registry.d.ts.map +1 -0
- package/dist/internals/bgfx/registry.js +24 -0
- package/dist/internals/bgfx/registry.js.map +1 -0
- package/dist/internals/bgfx/sab-layout.d.ts +61 -0
- package/dist/internals/bgfx/sab-layout.d.ts.map +1 -0
- package/dist/internals/bgfx/sab-layout.js +107 -0
- package/dist/internals/bgfx/sab-layout.js.map +1 -0
- package/dist/internals/bgfx/shader-frame-host.d.ts +22 -0
- package/dist/internals/bgfx/shader-frame-host.d.ts.map +1 -0
- package/dist/internals/bgfx/shader-frame-host.js +165 -0
- package/dist/internals/bgfx/shader-frame-host.js.map +1 -0
- package/dist/internals/bgfx/shadertoy-catalog.d.ts +41 -0
- package/dist/internals/bgfx/shadertoy-catalog.d.ts.map +1 -0
- package/dist/internals/bgfx/shadertoy-catalog.js +200 -0
- package/dist/internals/bgfx/shadertoy-catalog.js.map +1 -0
- package/dist/internals/bgfx/shadertoy-gl.d.ts +38 -0
- package/dist/internals/bgfx/shadertoy-gl.d.ts.map +1 -0
- package/dist/internals/bgfx/shadertoy-gl.js +283 -0
- package/dist/internals/bgfx/shadertoy-gl.js.map +1 -0
- package/dist/internals/bgfx/types.d.ts +51 -0
- package/dist/internals/bgfx/types.d.ts.map +1 -0
- package/dist/internals/bgfx/types.js +14 -0
- package/dist/internals/bgfx/types.js.map +1 -0
- package/dist/internals/bgfx-worker.d.ts +6 -0
- package/dist/internals/bgfx-worker.d.ts.map +1 -0
- package/dist/internals/bgfx-worker.js +131 -0
- package/dist/internals/bgfx-worker.js.map +1 -0
- package/dist/layout/birth.d.ts +77 -0
- package/dist/layout/birth.d.ts.map +1 -0
- package/dist/layout/birth.js +148 -0
- package/dist/layout/birth.js.map +1 -0
- package/dist/layout/children.d.ts +5 -0
- package/dist/layout/children.d.ts.map +1 -0
- package/dist/layout/children.js +19 -0
- package/dist/layout/children.js.map +1 -0
- package/dist/layout/chrome_frame.d.ts +254 -0
- package/dist/layout/chrome_frame.d.ts.map +1 -0
- package/dist/layout/chrome_frame.js +1080 -0
- package/dist/layout/chrome_frame.js.map +1 -0
- package/dist/layout/chrome_mask.d.ts +40 -0
- package/dist/layout/chrome_mask.d.ts.map +1 -0
- package/dist/layout/chrome_mask.js +150 -0
- package/dist/layout/chrome_mask.js.map +1 -0
- package/dist/layout/engine.d.ts +49 -0
- package/dist/layout/engine.d.ts.map +1 -0
- package/dist/layout/engine.js +1269 -0
- package/dist/layout/engine.js.map +1 -0
- package/dist/layout/flex.d.ts +36 -0
- package/dist/layout/flex.d.ts.map +1 -0
- package/dist/layout/flex.js +111 -0
- package/dist/layout/flex.js.map +1 -0
- package/dist/layout/grid.d.ts +36 -0
- package/dist/layout/grid.d.ts.map +1 -0
- package/dist/layout/grid.js +126 -0
- package/dist/layout/grid.js.map +1 -0
- package/dist/layout/index.d.ts +30 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +30 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/indication.d.ts +34 -0
- package/dist/layout/indication.d.ts.map +1 -0
- package/dist/layout/indication.js +68 -0
- package/dist/layout/indication.js.map +1 -0
- package/dist/layout/length.d.ts +18 -0
- package/dist/layout/length.d.ts.map +1 -0
- package/dist/layout/length.js +24 -0
- package/dist/layout/length.js.map +1 -0
- package/dist/layout/live_paint.d.ts +145 -0
- package/dist/layout/live_paint.d.ts.map +1 -0
- package/dist/layout/live_paint.js +255 -0
- package/dist/layout/live_paint.js.map +1 -0
- package/dist/layout/markdown.d.ts +22 -0
- package/dist/layout/markdown.d.ts.map +1 -0
- package/dist/layout/markdown.js +167 -0
- package/dist/layout/markdown.js.map +1 -0
- package/dist/layout/measure.d.ts +46 -0
- package/dist/layout/measure.d.ts.map +1 -0
- package/dist/layout/measure.js +307 -0
- package/dist/layout/measure.js.map +1 -0
- package/dist/layout/paint-hotkey.d.ts +45 -0
- package/dist/layout/paint-hotkey.d.ts.map +1 -0
- package/dist/layout/paint-hotkey.js +152 -0
- package/dist/layout/paint-hotkey.js.map +1 -0
- package/dist/layout/paint.d.ts +25 -0
- package/dist/layout/paint.d.ts.map +1 -0
- package/dist/layout/paint.js +189 -0
- package/dist/layout/paint.js.map +1 -0
- package/dist/layout/paint_theme.d.ts +85 -0
- package/dist/layout/paint_theme.d.ts.map +1 -0
- package/dist/layout/paint_theme.js +76 -0
- package/dist/layout/paint_theme.js.map +1 -0
- package/dist/layout/progress.d.ts +31 -0
- package/dist/layout/progress.d.ts.map +1 -0
- package/dist/layout/progress.js +83 -0
- package/dist/layout/progress.js.map +1 -0
- package/dist/layout/selection.d.ts +136 -0
- package/dist/layout/selection.d.ts.map +1 -0
- package/dist/layout/selection.js +312 -0
- package/dist/layout/selection.js.map +1 -0
- package/dist/layout/selection_gesture.d.ts +88 -0
- package/dist/layout/selection_gesture.d.ts.map +1 -0
- package/dist/layout/selection_gesture.js +239 -0
- package/dist/layout/selection_gesture.js.map +1 -0
- package/dist/layout/selection_paint.d.ts +47 -0
- package/dist/layout/selection_paint.d.ts.map +1 -0
- package/dist/layout/selection_paint.js +320 -0
- package/dist/layout/selection_paint.js.map +1 -0
- package/dist/layout/serialize.d.ts +49 -0
- package/dist/layout/serialize.d.ts.map +1 -0
- package/dist/layout/serialize.js +437 -0
- package/dist/layout/serialize.js.map +1 -0
- package/dist/layout/squeeze.d.ts +58 -0
- package/dist/layout/squeeze.d.ts.map +1 -0
- package/dist/layout/squeeze.js +239 -0
- package/dist/layout/squeeze.js.map +1 -0
- package/dist/layout/text.d.ts +44 -0
- package/dist/layout/text.d.ts.map +1 -0
- package/dist/layout/text.js +230 -0
- package/dist/layout/text.js.map +1 -0
- package/dist/layout/theme_store.d.ts +21 -0
- package/dist/layout/theme_store.d.ts.map +1 -0
- package/dist/layout/theme_store.js +133 -0
- package/dist/layout/theme_store.js.map +1 -0
- package/dist/layout/types.d.ts +564 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/layout/types.js +2 -0
- package/dist/layout/types.js.map +1 -0
- package/dist/layout/visual_draft.d.ts +60 -0
- package/dist/layout/visual_draft.d.ts.map +1 -0
- package/dist/layout/visual_draft.js +199 -0
- package/dist/layout/visual_draft.js.map +1 -0
- package/dist/lexicon/color.d.ts +22 -0
- package/dist/lexicon/color.d.ts.map +1 -0
- package/dist/lexicon/color.js +6 -0
- package/dist/lexicon/color.js.map +1 -0
- package/dist/lexicon/index.d.ts +15 -0
- package/dist/lexicon/index.d.ts.map +1 -0
- package/dist/lexicon/index.js +15 -0
- package/dist/lexicon/index.js.map +1 -0
- package/dist/lexicon/prominence.d.ts +46 -0
- package/dist/lexicon/prominence.d.ts.map +1 -0
- package/dist/lexicon/prominence.js +73 -0
- package/dist/lexicon/prominence.js.map +1 -0
- package/dist/lexicon/quarantine.d.ts +21 -0
- package/dist/lexicon/quarantine.d.ts.map +1 -0
- package/dist/lexicon/quarantine.js +15 -0
- package/dist/lexicon/quarantine.js.map +1 -0
- package/dist/lexicon/roles.d.ts +37 -0
- package/dist/lexicon/roles.d.ts.map +1 -0
- package/dist/lexicon/roles.js +52 -0
- package/dist/lexicon/roles.js.map +1 -0
- package/dist/lexicon/tiers.d.ts +18 -0
- package/dist/lexicon/tiers.d.ts.map +1 -0
- package/dist/lexicon/tiers.js +17 -0
- package/dist/lexicon/tiers.js.map +1 -0
- package/dist/measure/index.d.ts +43 -0
- package/dist/measure/index.d.ts.map +1 -0
- package/dist/measure/index.js +120 -0
- package/dist/measure/index.js.map +1 -0
- package/dist/render.d.ts +72 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +164 -0
- package/dist/render.js.map +1 -0
- package/dist/runtime/agents_keys.d.ts +8 -0
- package/dist/runtime/agents_keys.d.ts.map +1 -0
- package/dist/runtime/agents_keys.js +24 -0
- package/dist/runtime/agents_keys.js.map +1 -0
- package/dist/runtime/agents_peek.d.ts +44 -0
- package/dist/runtime/agents_peek.d.ts.map +1 -0
- package/dist/runtime/agents_peek.js +96 -0
- package/dist/runtime/agents_peek.js.map +1 -0
- package/dist/runtime/agents_preview.d.ts +27 -0
- package/dist/runtime/agents_preview.d.ts.map +1 -0
- package/dist/runtime/agents_preview.js +122 -0
- package/dist/runtime/agents_preview.js.map +1 -0
- package/dist/runtime/box_bus.d.ts +144 -0
- package/dist/runtime/box_bus.d.ts.map +1 -0
- package/dist/runtime/box_bus.js +74 -0
- package/dist/runtime/box_bus.js.map +1 -0
- package/dist/runtime/clipboard-image.d.ts +20 -0
- package/dist/runtime/clipboard-image.d.ts.map +1 -0
- package/dist/runtime/clipboard-image.js +62 -0
- package/dist/runtime/clipboard-image.js.map +1 -0
- package/dist/runtime/copy_toast.d.ts +46 -0
- package/dist/runtime/copy_toast.d.ts.map +1 -0
- package/dist/runtime/copy_toast.js +117 -0
- package/dist/runtime/copy_toast.js.map +1 -0
- package/dist/runtime/echo.d.ts +41 -0
- package/dist/runtime/echo.d.ts.map +1 -0
- package/dist/runtime/echo.js +112 -0
- package/dist/runtime/echo.js.map +1 -0
- package/dist/runtime/frame.d.ts +79 -0
- package/dist/runtime/frame.d.ts.map +1 -0
- package/dist/runtime/frame.js +258 -0
- package/dist/runtime/frame.js.map +1 -0
- package/dist/runtime/index.d.ts +16 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +16 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/key_buffer.d.ts +19 -0
- package/dist/runtime/key_buffer.d.ts.map +1 -0
- package/dist/runtime/key_buffer.js +24 -0
- package/dist/runtime/key_buffer.js.map +1 -0
- package/dist/runtime/keys.d.ts +66 -0
- package/dist/runtime/keys.d.ts.map +1 -0
- package/dist/runtime/keys.js +220 -0
- package/dist/runtime/keys.js.map +1 -0
- package/dist/runtime/paint_snapshot.d.ts +9 -0
- package/dist/runtime/paint_snapshot.d.ts.map +1 -0
- package/dist/runtime/paint_snapshot.js +8 -0
- package/dist/runtime/paint_snapshot.js.map +1 -0
- package/dist/runtime/paint_source.d.ts +266 -0
- package/dist/runtime/paint_source.d.ts.map +1 -0
- package/dist/runtime/paint_source.js +532 -0
- package/dist/runtime/paint_source.js.map +1 -0
- package/dist/runtime/present_loop.d.ts +11 -0
- package/dist/runtime/present_loop.d.ts.map +1 -0
- package/dist/runtime/present_loop.js +46 -0
- package/dist/runtime/present_loop.js.map +1 -0
- package/dist/runtime/present_profile.d.ts +58 -0
- package/dist/runtime/present_profile.d.ts.map +1 -0
- package/dist/runtime/present_profile.js +130 -0
- package/dist/runtime/present_profile.js.map +1 -0
- package/dist/runtime/raster.d.ts +24 -0
- package/dist/runtime/raster.d.ts.map +1 -0
- package/dist/runtime/raster.js +43 -0
- package/dist/runtime/raster.js.map +1 -0
- package/dist/runtime/renderer.d.ts +151 -0
- package/dist/runtime/renderer.d.ts.map +1 -0
- package/dist/runtime/renderer.js +1607 -0
- package/dist/runtime/renderer.js.map +1 -0
- package/dist/runtime/screenshot.d.ts +9 -0
- package/dist/runtime/screenshot.d.ts.map +1 -0
- package/dist/runtime/screenshot.js +111 -0
- package/dist/runtime/screenshot.js.map +1 -0
- package/dist/runtime/selection_host.d.ts +41 -0
- package/dist/runtime/selection_host.d.ts.map +1 -0
- package/dist/runtime/selection_host.js +190 -0
- package/dist/runtime/selection_host.js.map +1 -0
- package/dist/runtime/stderr_hold.d.ts +16 -0
- package/dist/runtime/stderr_hold.d.ts.map +1 -0
- package/dist/runtime/stderr_hold.js +23 -0
- package/dist/runtime/stderr_hold.js.map +1 -0
- package/dist/runtime/thought_birth.d.ts +25 -0
- package/dist/runtime/thought_birth.d.ts.map +1 -0
- package/dist/runtime/thought_birth.js +122 -0
- package/dist/runtime/thought_birth.js.map +1 -0
- package/dist/runtime/thought_collapsed.d.ts +35 -0
- package/dist/runtime/thought_collapsed.d.ts.map +1 -0
- package/dist/runtime/thought_collapsed.js +94 -0
- package/dist/runtime/thought_collapsed.js.map +1 -0
- package/dist/runtime/tty.d.ts +58 -0
- package/dist/runtime/tty.d.ts.map +1 -0
- package/dist/runtime/tty.js +130 -0
- package/dist/runtime/tty.js.map +1 -0
- package/dist/theme/ansi16.d.ts +34 -0
- package/dist/theme/ansi16.d.ts.map +1 -0
- package/dist/theme/ansi16.js +181 -0
- package/dist/theme/ansi16.js.map +1 -0
- package/dist/theme/ansi256.d.ts +15 -0
- package/dist/theme/ansi256.d.ts.map +1 -0
- package/dist/theme/ansi256.js +94 -0
- package/dist/theme/ansi256.js.map +1 -0
- package/dist/theme/ground.d.ts +8 -0
- package/dist/theme/ground.d.ts.map +1 -0
- package/dist/theme/ground.js +11 -0
- package/dist/theme/ground.js.map +1 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +10 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/region.d.ts +42 -0
- package/dist/theme/region.d.ts.map +1 -0
- package/dist/theme/region.js +105 -0
- package/dist/theme/region.js.map +1 -0
- package/dist/theme/resolver.d.ts +126 -0
- package/dist/theme/resolver.d.ts.map +1 -0
- package/dist/theme/resolver.js +366 -0
- package/dist/theme/resolver.js.map +1 -0
- package/dist/theme/salience.d.ts +90 -0
- package/dist/theme/salience.d.ts.map +1 -0
- package/dist/theme/salience.js +208 -0
- package/dist/theme/salience.js.map +1 -0
- package/dist/theme/seeds.d.ts +113 -0
- package/dist/theme/seeds.d.ts.map +1 -0
- package/dist/theme/seeds.js +52 -0
- package/dist/theme/seeds.js.map +1 -0
- package/dist/theme/selection.d.ts +94 -0
- package/dist/theme/selection.d.ts.map +1 -0
- package/dist/theme/selection.js +135 -0
- package/dist/theme/selection.js.map +1 -0
- package/dist/theme/theme.d.ts +41 -0
- package/dist/theme/theme.d.ts.map +1 -0
- package/dist/theme/theme.js +34 -0
- package/dist/theme/theme.js.map +1 -0
- package/dist/widgets/composer-caret.d.ts +47 -0
- package/dist/widgets/composer-caret.d.ts.map +1 -0
- package/dist/widgets/composer-caret.js +90 -0
- package/dist/widgets/composer-caret.js.map +1 -0
- package/dist/widgets/composer-click.d.ts +30 -0
- package/dist/widgets/composer-click.d.ts.map +1 -0
- package/dist/widgets/composer-click.js +89 -0
- package/dist/widgets/composer-click.js.map +1 -0
- package/dist/widgets/composer-command.d.ts +64 -0
- package/dist/widgets/composer-command.d.ts.map +1 -0
- package/dist/widgets/composer-command.js +127 -0
- package/dist/widgets/composer-command.js.map +1 -0
- package/dist/widgets/composer-frame.d.ts +74 -0
- package/dist/widgets/composer-frame.d.ts.map +1 -0
- package/dist/widgets/composer-frame.js +284 -0
- package/dist/widgets/composer-frame.js.map +1 -0
- package/dist/widgets/composer-picker.d.ts +89 -0
- package/dist/widgets/composer-picker.d.ts.map +1 -0
- package/dist/widgets/composer-picker.js +240 -0
- package/dist/widgets/composer-picker.js.map +1 -0
- package/dist/widgets/diff.d.ts +11 -0
- package/dist/widgets/diff.d.ts.map +1 -0
- package/dist/widgets/diff.js +19 -0
- package/dist/widgets/diff.js.map +1 -0
- package/dist/widgets/expand.d.ts +28 -0
- package/dist/widgets/expand.d.ts.map +1 -0
- package/dist/widgets/expand.js +94 -0
- package/dist/widgets/expand.js.map +1 -0
- package/dist/widgets/index.d.ts +126 -0
- package/dist/widgets/index.d.ts.map +1 -0
- package/dist/widgets/index.js +455 -0
- package/dist/widgets/index.js.map +1 -0
- package/dist/widgets/internals/arrival-lang.d.ts +88 -0
- package/dist/widgets/internals/arrival-lang.d.ts.map +1 -0
- package/dist/widgets/internals/arrival-lang.js +211 -0
- package/dist/widgets/internals/arrival-lang.js.map +1 -0
- package/dist/widgets/internals/diff-expand.d.ts +93 -0
- package/dist/widgets/internals/diff-expand.d.ts.map +1 -0
- package/dist/widgets/internals/diff-expand.js +1106 -0
- package/dist/widgets/internals/diff-expand.js.map +1 -0
- package/dist/widgets/internals/embedded-syntax.d.ts +62 -0
- package/dist/widgets/internals/embedded-syntax.d.ts.map +1 -0
- package/dist/widgets/internals/embedded-syntax.js +465 -0
- package/dist/widgets/internals/embedded-syntax.js.map +1 -0
- package/dist/widgets/internals/markdown-expand.d.ts +57 -0
- package/dist/widgets/internals/markdown-expand.d.ts.map +1 -0
- package/dist/widgets/internals/markdown-expand.js +980 -0
- package/dist/widgets/internals/markdown-expand.js.map +1 -0
- package/dist/widgets/internals/overlay-syntax.d.ts +24 -0
- package/dist/widgets/internals/overlay-syntax.d.ts.map +1 -0
- package/dist/widgets/internals/overlay-syntax.js +90 -0
- package/dist/widgets/internals/overlay-syntax.js.map +1 -0
- package/dist/widgets/internals/pierre-parse/cleanLastNewline.d.ts +6 -0
- package/dist/widgets/internals/pierre-parse/cleanLastNewline.d.ts.map +1 -0
- package/dist/widgets/internals/pierre-parse/cleanLastNewline.js +8 -0
- package/dist/widgets/internals/pierre-parse/cleanLastNewline.js.map +1 -0
- package/dist/widgets/internals/pierre-parse/constants.d.ts +13 -0
- package/dist/widgets/internals/pierre-parse/constants.d.ts.map +1 -0
- package/dist/widgets/internals/pierre-parse/constants.js +13 -0
- package/dist/widgets/internals/pierre-parse/constants.js.map +1 -0
- package/dist/widgets/internals/pierre-parse/detachString.d.ts +3 -0
- package/dist/widgets/internals/pierre-parse/detachString.d.ts.map +1 -0
- package/dist/widgets/internals/pierre-parse/detachString.js +24 -0
- package/dist/widgets/internals/pierre-parse/detachString.js.map +1 -0
- package/dist/widgets/internals/pierre-parse/index.d.ts +8 -0
- package/dist/widgets/internals/pierre-parse/index.d.ts.map +1 -0
- package/dist/widgets/internals/pierre-parse/index.js +8 -0
- package/dist/widgets/internals/pierre-parse/index.js.map +1 -0
- package/dist/widgets/internals/pierre-parse/parseDiffFromFile.d.ts +15 -0
- package/dist/widgets/internals/pierre-parse/parseDiffFromFile.d.ts.map +1 -0
- package/dist/widgets/internals/pierre-parse/parseDiffFromFile.js +39 -0
- package/dist/widgets/internals/pierre-parse/parseDiffFromFile.js.map +1 -0
- package/dist/widgets/internals/pierre-parse/parsePatchFiles.d.ts +11 -0
- package/dist/widgets/internals/pierre-parse/parsePatchFiles.d.ts.map +1 -0
- package/dist/widgets/internals/pierre-parse/parsePatchFiles.js +621 -0
- package/dist/widgets/internals/pierre-parse/parsePatchFiles.js.map +1 -0
- package/dist/widgets/internals/pierre-parse/types.d.ts +73 -0
- package/dist/widgets/internals/pierre-parse/types.d.ts.map +1 -0
- package/dist/widgets/internals/pierre-parse/types.js +7 -0
- package/dist/widgets/internals/pierre-parse/types.js.map +1 -0
- package/dist/widgets/internals/syntax.d.ts +55 -0
- package/dist/widgets/internals/syntax.d.ts.map +1 -0
- package/dist/widgets/internals/syntax.js +261 -0
- package/dist/widgets/internals/syntax.js.map +1 -0
- package/dist/widgets/markdown.d.ts +14 -0
- package/dist/widgets/markdown.d.ts.map +1 -0
- package/dist/widgets/markdown.js +9 -0
- package/dist/widgets/markdown.js.map +1 -0
- package/dist/widgets/shadow-stream.d.ts +88 -0
- package/dist/widgets/shadow-stream.d.ts.map +1 -0
- package/dist/widgets/shadow-stream.js +359 -0
- package/dist/widgets/shadow-stream.js.map +1 -0
- package/dist/widgets/speech.d.ts +36 -0
- package/dist/widgets/speech.d.ts.map +1 -0
- package/dist/widgets/speech.js +238 -0
- package/dist/widgets/speech.js.map +1 -0
- package/dist/widgets/stream-birth.d.ts +13 -0
- package/dist/widgets/stream-birth.d.ts.map +1 -0
- package/dist/widgets/stream-birth.js +70 -0
- package/dist/widgets/stream-birth.js.map +1 -0
- package/dist/widgets/syntax-boot.d.ts +25 -0
- package/dist/widgets/syntax-boot.d.ts.map +1 -0
- package/dist/widgets/syntax-boot.js +181 -0
- package/dist/widgets/syntax-boot.js.map +1 -0
- package/dist/widgets/text.d.ts +16 -0
- package/dist/widgets/text.d.ts.map +1 -0
- package/dist/widgets/text.js +14 -0
- package/dist/widgets/text.js.map +1 -0
- package/dist/widgets/transcript.d.ts +44 -0
- package/dist/widgets/transcript.d.ts.map +1 -0
- package/dist/widgets/transcript.js +106 -0
- package/dist/widgets/transcript.js.map +1 -0
- package/doom.vert +1840 -0
- package/fonts/DejaVuSans.ttf +0 -0
- package/fonts/DejaVuSansMono.ttf +0 -0
- package/fonts/LICENSE-DejaVu.txt +187 -0
- package/fonts/README.md +6 -0
- package/gradient.vert +75 -0
- package/package.json +147 -4
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection state model — buffer-cell-space ranges with granularity.
|
|
3
|
+
*
|
|
4
|
+
* State lives renderer/main-side (the buffer owner). The host wires mouse
|
|
5
|
+
* gestures (Phase 1d) and keyboard selection into transitions on this type;
|
|
6
|
+
* paint (Phase 1c) reads it to mark cells `selected`.
|
|
7
|
+
*
|
|
8
|
+
* Two cooperating concepts:
|
|
9
|
+
*
|
|
10
|
+
* 1. GLOBAL state (this module): anchor/active cells + granularity. Knows
|
|
11
|
+
* "this cell is fully inside the selection range" — the cheap, geometry-
|
|
12
|
+
* only membership test. Does NOT know what text a cell renders.
|
|
13
|
+
*
|
|
14
|
+
* 2. COMPONENT-delegated serialization (Phase 2b): each widget declares how
|
|
15
|
+
* its cells map back to semantic content (markdown source, diff text,
|
|
16
|
+
* code). The global layer asks "is this cell selected?" and the component
|
|
17
|
+
* answers "what text does it produce?"
|
|
18
|
+
*
|
|
19
|
+
* Geometry law (the bifunctor):
|
|
20
|
+
* - `"char"` / `"word"` — **stream** range in document order (row-major).
|
|
21
|
+
* Multi-line: first row from start.col→EOL, middle rows full width, last
|
|
22
|
+
* row SOL→end.col. Same model every terminal/editor uses for drag-select.
|
|
23
|
+
* - `"line"` — full row width for every row in the vertical span.
|
|
24
|
+
* - `"rect"` — axis-aligned column block (Alt+drag / tmux rectangle).
|
|
25
|
+
* - `"structural"` — bounding box of a LayoutNode (refined by component).
|
|
26
|
+
*
|
|
27
|
+
* Cell coordinates are 0-indexed buffer cells (matching `elementAt`'s
|
|
28
|
+
* internal rect math after the 1-based SGR subtraction).
|
|
29
|
+
*/
|
|
30
|
+
/** Clamp a cell into a rect (inclusive). */
|
|
31
|
+
export function clampCell(cell, rect) {
|
|
32
|
+
const maxC = rect.x + Math.max(1, rect.w) - 1;
|
|
33
|
+
const maxR = rect.y + Math.max(1, rect.h) - 1;
|
|
34
|
+
return {
|
|
35
|
+
col: Math.min(maxC, Math.max(rect.x, cell.col)),
|
|
36
|
+
row: Math.min(maxR, Math.max(rect.y, cell.row)),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Clip an inclusive column range to contain on this row; null if row outside. */
|
|
40
|
+
function clipRangeToContain(range, row, contain) {
|
|
41
|
+
if (!contain)
|
|
42
|
+
return range;
|
|
43
|
+
if (row < contain.y || row >= contain.y + contain.h)
|
|
44
|
+
return null;
|
|
45
|
+
const c0 = contain.x;
|
|
46
|
+
const c1 = contain.x + contain.w - 1;
|
|
47
|
+
const start = Math.max(range[0], c0);
|
|
48
|
+
const end = Math.min(range[1], c1);
|
|
49
|
+
if (end < start)
|
|
50
|
+
return null;
|
|
51
|
+
return [start, end];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Start a new selection at a cell. Anchor and active both start at the cell;
|
|
55
|
+
* a subsequent drag/extend moves `active`. When `contain` is set, the cell is
|
|
56
|
+
* clamped into that rect and the confinement rides on the state.
|
|
57
|
+
*/
|
|
58
|
+
export function startSelection(cell, granularity = "char", anchorKey, contain) {
|
|
59
|
+
const c = contain ? clampCell(cell, contain) : cell;
|
|
60
|
+
return { anchor: c, active: c, granularity, anchorKey, contain };
|
|
61
|
+
}
|
|
62
|
+
/** Move the active end (drag / shift-click extend / keyboard arrow). */
|
|
63
|
+
export function extendSelection(sel, cell) {
|
|
64
|
+
if (!sel)
|
|
65
|
+
return null;
|
|
66
|
+
const c = sel.contain ? clampCell(cell, sel.contain) : cell;
|
|
67
|
+
return { ...sel, active: c };
|
|
68
|
+
}
|
|
69
|
+
/** Clear the selection. */
|
|
70
|
+
export function clearSelection() {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* True when anchor and active are the same cell (collapsed caret / click
|
|
75
|
+
* without drag). Copy-on-select hosts should skip OSC 52 for collapsed
|
|
76
|
+
* selections unless multi-click expanded the range.
|
|
77
|
+
*/
|
|
78
|
+
export function isCollapsed(sel) {
|
|
79
|
+
if (!sel)
|
|
80
|
+
return true;
|
|
81
|
+
return sel.anchor.col === sel.active.col && sel.anchor.row === sel.active.row;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* True when the selection covers more than one cell under its geometry law.
|
|
85
|
+
* For `"line"` a single-row collapsed click still selects the full line, so
|
|
86
|
+
* this is true whenever granularity is line (or structural) even if collapsed.
|
|
87
|
+
*/
|
|
88
|
+
export function hasCopyableExtent(sel) {
|
|
89
|
+
if (!sel)
|
|
90
|
+
return false;
|
|
91
|
+
if (sel.granularity === "line" || sel.granularity === "structural")
|
|
92
|
+
return true;
|
|
93
|
+
if (sel.granularity === "word") {
|
|
94
|
+
// Word may be expanded (anchor ≠ active) or still collapsed pre-snap.
|
|
95
|
+
return !isCollapsed(sel);
|
|
96
|
+
}
|
|
97
|
+
return !isCollapsed(sel);
|
|
98
|
+
}
|
|
99
|
+
/** Document-order comparison: earlier row, then earlier col. */
|
|
100
|
+
function docBefore(a, b) {
|
|
101
|
+
return a.row < b.row || (a.row === b.row && a.col < b.col);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Stream endpoints in document order (start ≤ end). Used by char/word geometry.
|
|
105
|
+
* Anchor/active may be in either drag direction.
|
|
106
|
+
*/
|
|
107
|
+
export function streamEndpoints(sel) {
|
|
108
|
+
if (docBefore(sel.active, sel.anchor)) {
|
|
109
|
+
return { start: sel.active, end: sel.anchor };
|
|
110
|
+
}
|
|
111
|
+
return { start: sel.anchor, end: sel.active };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Axis-aligned corners (min/max col and row independently). Correct for
|
|
115
|
+
* `"rect"`; for stream ranges this is only a loose envelope — use
|
|
116
|
+
* {@link rowRange} for exact per-row membership.
|
|
117
|
+
*/
|
|
118
|
+
function axisCorners(sel) {
|
|
119
|
+
return {
|
|
120
|
+
tl: {
|
|
121
|
+
col: Math.min(sel.anchor.col, sel.active.col),
|
|
122
|
+
row: Math.min(sel.anchor.row, sel.active.row),
|
|
123
|
+
},
|
|
124
|
+
br: {
|
|
125
|
+
col: Math.max(sel.anchor.col, sel.active.col),
|
|
126
|
+
row: Math.max(sel.anchor.row, sel.active.row),
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Bounding rect envelope of the selection in buffer coordinates.
|
|
132
|
+
*
|
|
133
|
+
* For multi-line stream (`"char"`/`"word"`) and `"line"`, the envelope spans
|
|
134
|
+
* full row width when `rowWidth` is supplied — paint loops walk this rect and
|
|
135
|
+
* filter with {@link rowRange}. When `rowWidth` is omitted, multi-line
|
|
136
|
+
* stream uses a conservative full-width sentinel (caller should prefer
|
|
137
|
+
* providing width).
|
|
138
|
+
*
|
|
139
|
+
* For `"rect"` the envelope IS the selected region.
|
|
140
|
+
*/
|
|
141
|
+
export function selectionRect(sel, rowWidth = Number.MAX_SAFE_INTEGER) {
|
|
142
|
+
const w = Math.max(1, rowWidth);
|
|
143
|
+
// When confined, the envelope is at most the contain box (input never
|
|
144
|
+
// "selects" the rest of the terminal).
|
|
145
|
+
if (sel.contain) {
|
|
146
|
+
return { ...sel.contain };
|
|
147
|
+
}
|
|
148
|
+
if (sel.granularity === "rect" || sel.granularity === "structural") {
|
|
149
|
+
const { tl, br } = axisCorners(sel);
|
|
150
|
+
return {
|
|
151
|
+
x: tl.col,
|
|
152
|
+
y: tl.row,
|
|
153
|
+
w: br.col - tl.col + 1,
|
|
154
|
+
h: br.row - tl.row + 1,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (sel.granularity === "line") {
|
|
158
|
+
const r0 = Math.min(sel.anchor.row, sel.active.row);
|
|
159
|
+
const r1 = Math.max(sel.anchor.row, sel.active.row);
|
|
160
|
+
return { x: 0, y: r0, w, h: r1 - r0 + 1 };
|
|
161
|
+
}
|
|
162
|
+
// char / word — stream envelope
|
|
163
|
+
const { start, end } = streamEndpoints(sel);
|
|
164
|
+
if (start.row === end.row) {
|
|
165
|
+
const c0 = Math.min(start.col, end.col);
|
|
166
|
+
const c1 = Math.max(start.col, end.col);
|
|
167
|
+
return { x: c0, y: start.row, w: c1 - c0 + 1, h: 1 };
|
|
168
|
+
}
|
|
169
|
+
// Multi-line stream spans full width (first line may start mid-row; last may
|
|
170
|
+
// end mid-row — rowRange filters the corners).
|
|
171
|
+
return { x: 0, y: start.row, w, h: end.row - start.row + 1 };
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Column range selected on a given row, or `null` if the row is outside the
|
|
175
|
+
* selection. Returned range is **inclusive** on both ends: `[startCol, endCol]`.
|
|
176
|
+
*
|
|
177
|
+
* Geometry by granularity:
|
|
178
|
+
* - `"char"` / `"word"` — stream: first/middle/last row rules
|
|
179
|
+
* - `"line"` — full row `[0, rowWidth-1]`
|
|
180
|
+
* - `"rect"` / `"structural"` — axis box columns on every selected row
|
|
181
|
+
*/
|
|
182
|
+
export function rowRange(sel, row, rowWidth) {
|
|
183
|
+
if (rowWidth <= 0)
|
|
184
|
+
return null;
|
|
185
|
+
const lastCol = rowWidth - 1;
|
|
186
|
+
let range = null;
|
|
187
|
+
if (sel.granularity === "line") {
|
|
188
|
+
const r0 = Math.min(sel.anchor.row, sel.active.row);
|
|
189
|
+
const r1 = Math.max(sel.anchor.row, sel.active.row);
|
|
190
|
+
if (row < r0 || row > r1)
|
|
191
|
+
return null;
|
|
192
|
+
range = [0, lastCol];
|
|
193
|
+
}
|
|
194
|
+
else if (sel.granularity === "rect" || sel.granularity === "structural") {
|
|
195
|
+
const { tl, br } = axisCorners(sel);
|
|
196
|
+
if (row < tl.row || row > br.row)
|
|
197
|
+
return null;
|
|
198
|
+
range = [tl.col, br.col];
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
// char / word — stream
|
|
202
|
+
const { start, end } = streamEndpoints(sel);
|
|
203
|
+
if (row < start.row || row > end.row)
|
|
204
|
+
return null;
|
|
205
|
+
if (start.row === end.row) {
|
|
206
|
+
range = [Math.min(start.col, end.col), Math.max(start.col, end.col)];
|
|
207
|
+
}
|
|
208
|
+
else if (row === start.row) {
|
|
209
|
+
range = [start.col, lastCol];
|
|
210
|
+
}
|
|
211
|
+
else if (row === end.row) {
|
|
212
|
+
range = [0, end.col];
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
range = [0, lastCol];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return clipRangeToContain(range, row, sel.contain);
|
|
219
|
+
}
|
|
220
|
+
// ── Word bounds (for double-click snap) ─────────────────────────────────────
|
|
221
|
+
/**
|
|
222
|
+
* Word character class for double-click selection. Letters, marks, numbers,
|
|
223
|
+
* underscore — the terminal/editor convergence set. Everything else is a
|
|
224
|
+
* separator (including whitespace and punctuation).
|
|
225
|
+
*/
|
|
226
|
+
function isWordChar(ch) {
|
|
227
|
+
if (!ch)
|
|
228
|
+
return false;
|
|
229
|
+
// First code point only (cell may hold a grapheme; we still classify by it).
|
|
230
|
+
const cp = ch.codePointAt(0);
|
|
231
|
+
if (cp === undefined)
|
|
232
|
+
return false;
|
|
233
|
+
// ASCII fast path
|
|
234
|
+
if ((cp >= 0x30 && cp <= 0x39) || // 0-9
|
|
235
|
+
(cp >= 0x41 && cp <= 0x5a) || // A-Z
|
|
236
|
+
(cp >= 0x61 && cp <= 0x7a) || // a-z
|
|
237
|
+
cp === 0x5f // _
|
|
238
|
+
) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
// Unicode letters / marks / numbers (no full ICU; good enough for TUI copy).
|
|
242
|
+
try {
|
|
243
|
+
return /[\p{L}\p{M}\p{N}]/u.test(String.fromCodePoint(cp));
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
export function wordBoundsOnRow(cells, col) {
|
|
250
|
+
if (col < 0 || col >= cells.length)
|
|
251
|
+
return [Math.max(0, col), Math.max(0, col)];
|
|
252
|
+
const ch = cells[col] ?? "";
|
|
253
|
+
if (!isWordChar(ch))
|
|
254
|
+
return [col, col];
|
|
255
|
+
let start = col;
|
|
256
|
+
while (start > 0 && isWordChar(cells[start - 1] ?? ""))
|
|
257
|
+
start--;
|
|
258
|
+
let end = col;
|
|
259
|
+
while (end + 1 < cells.length && isWordChar(cells[end + 1] ?? ""))
|
|
260
|
+
end++;
|
|
261
|
+
return [start, end];
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Expand a collapsed (or any) selection to the full word under `cell`.
|
|
265
|
+
* Sets anchor to word start and active to word end on that row.
|
|
266
|
+
*/
|
|
267
|
+
export function expandToWordAt(cell, getRowCells, anchorKey, contain) {
|
|
268
|
+
const c = contain ? clampCell(cell, contain) : cell;
|
|
269
|
+
const cells = getRowCells(c.row);
|
|
270
|
+
if (!cells || cells.length === 0) {
|
|
271
|
+
return startSelection(c, "word", anchorKey, contain);
|
|
272
|
+
}
|
|
273
|
+
let [a, b] = wordBoundsOnRow(cells, c.col);
|
|
274
|
+
// Word snap must not escape the input box.
|
|
275
|
+
if (contain) {
|
|
276
|
+
a = Math.max(a, contain.x);
|
|
277
|
+
b = Math.min(b, contain.x + contain.w - 1);
|
|
278
|
+
}
|
|
279
|
+
return {
|
|
280
|
+
anchor: { col: a, row: c.row },
|
|
281
|
+
active: { col: b, row: c.row },
|
|
282
|
+
granularity: "word",
|
|
283
|
+
anchorKey,
|
|
284
|
+
contain,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Expand to full line under `cell` (triple-click). Anchor at col 0, active at
|
|
289
|
+
* last content-ish col when `rowWidth` known; granularity `"line"` so
|
|
290
|
+
* {@link rowRange} already spans full width either way. With `contain`, the
|
|
291
|
+
* "line" is the input row only (cols of the box), never the whole terminal.
|
|
292
|
+
*/
|
|
293
|
+
export function expandToLineAt(cell, rowWidth, anchorKey, contain) {
|
|
294
|
+
if (contain) {
|
|
295
|
+
const row = clampCell(cell, contain).row;
|
|
296
|
+
return {
|
|
297
|
+
anchor: { col: contain.x, row },
|
|
298
|
+
active: { col: contain.x + contain.w - 1, row },
|
|
299
|
+
granularity: "line",
|
|
300
|
+
anchorKey,
|
|
301
|
+
contain,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
const last = Math.max(0, rowWidth - 1);
|
|
305
|
+
return {
|
|
306
|
+
anchor: { col: 0, row: cell.row },
|
|
307
|
+
active: { col: last, row: cell.row },
|
|
308
|
+
granularity: "line",
|
|
309
|
+
anchorKey,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/layout/selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA0CH,4CAA4C;AAC5C,MAAM,UAAU,SAAS,CAAC,IAAU,EAAE,IAAU;IAC9C,MAAM,IAAI,GAAG,IA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
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection gesture state machine — mouse events → SelectionState transitions.
|
|
3
|
+
*
|
|
4
|
+
* Pure state, no I/O. The host wires decoded mouse events in and reads
|
|
5
|
+
* {@link GestureOutput} (a selection snapshot + optional edge-scroll signal)
|
|
6
|
+
* out for paint + autoscroll.
|
|
7
|
+
*
|
|
8
|
+
* Visible-selection law (terminal/editor convergence):
|
|
9
|
+
* - A bare single click does **not** create a 1-cell selection. It only
|
|
10
|
+
* records the press so a subsequent drag can start from that cell, and
|
|
11
|
+
* clears any prior selection (click-to-dismiss).
|
|
12
|
+
* - Selection appears on: drag past the press cell, double-click (word),
|
|
13
|
+
* triple-click (line), Alt+drag (rect), or Shift+click extend.
|
|
14
|
+
*
|
|
15
|
+
* Containment (`userSelect: "contain"`, e.g. composer input):
|
|
16
|
+
* - When the press lands inside a contain region, the selection is armed
|
|
17
|
+
* with that rect. Every subsequent endpoint is clamped into it — drag
|
|
18
|
+
* cannot leave the input (browser <textarea> model).
|
|
19
|
+
*
|
|
20
|
+
* Click-count grammar:
|
|
21
|
+
* single — arm a potential drag (no paint yet)
|
|
22
|
+
* double — word granularity + expand to word bounds (when getRowCells given)
|
|
23
|
+
* triple — line granularity + expand to full line (within contain if set)
|
|
24
|
+
* quad+ — cycles back to char (structural walk is Phase 4)
|
|
25
|
+
*
|
|
26
|
+
* Modifiers:
|
|
27
|
+
* Alt — rectangular block granularity during a drag
|
|
28
|
+
* Shift — extend the existing selection from its anchor (shift+click)
|
|
29
|
+
*/
|
|
30
|
+
import { type Cell, type SelectionState } from "./selection.js";
|
|
31
|
+
import type { Rect } from "./types.js";
|
|
32
|
+
export type ContainRegion = {
|
|
33
|
+
key: string;
|
|
34
|
+
rect: Rect;
|
|
35
|
+
};
|
|
36
|
+
export type GestureEvent = {
|
|
37
|
+
kind: "press" | "release" | "drag";
|
|
38
|
+
/** 0-indexed buffer cell (caller subtracts the SGR 1-base). */
|
|
39
|
+
col: number;
|
|
40
|
+
row: number;
|
|
41
|
+
/** Event timestamp in ms (for multi-click windowing). */
|
|
42
|
+
tMs: number;
|
|
43
|
+
shift?: boolean;
|
|
44
|
+
alt?: boolean;
|
|
45
|
+
ctrl?: boolean;
|
|
46
|
+
meta?: boolean;
|
|
47
|
+
/** Optional LayoutNode key under the pointer (host hit-tests). */
|
|
48
|
+
key?: string;
|
|
49
|
+
};
|
|
50
|
+
export type GestureOutput = {
|
|
51
|
+
selection: SelectionState | null;
|
|
52
|
+
/**
|
|
53
|
+
* Edge-scroll signal during a drag. `undefined` when the drag is inside the
|
|
54
|
+
* viewport. The host drives the actual scroll interval; this just flags
|
|
55
|
+
* direction + that autoscroll is needed.
|
|
56
|
+
*/
|
|
57
|
+
scroll?: "up" | "down";
|
|
58
|
+
/**
|
|
59
|
+
* True when this event completed a gesture that should copy-on-select
|
|
60
|
+
* (release with a real extent). Hosts can also call `hasCopyableExtent`.
|
|
61
|
+
*/
|
|
62
|
+
copyReady?: boolean;
|
|
63
|
+
};
|
|
64
|
+
export type GestureMachineOpts = {
|
|
65
|
+
/** Viewport height in rows — for drag-to-edge-scroll detection. */
|
|
66
|
+
viewportH?: number;
|
|
67
|
+
/** Viewport width in cols — for triple-click line expand (non-contain). */
|
|
68
|
+
viewportW?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Optional row text accessor for double-click word snap. Return one row of
|
|
71
|
+
* cell `ch` strings (index = column). When omitted, word granularity is set
|
|
72
|
+
* but a collapsed word is discarded on release (same as bare click).
|
|
73
|
+
*/
|
|
74
|
+
getRowCells?: (row: number) => readonly string[] | null | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve `userSelect: "contain"` region at a cell (composer body, etc.).
|
|
77
|
+
* When non-null, the gesture arms confinement for the whole drag.
|
|
78
|
+
*/
|
|
79
|
+
containAt?: (cell: Cell) => ContainRegion | null;
|
|
80
|
+
};
|
|
81
|
+
export declare function createGestureMachine(opts?: GestureMachineOpts): {
|
|
82
|
+
handle: (ev: GestureEvent) => GestureOutput;
|
|
83
|
+
clear: () => SelectionState | null;
|
|
84
|
+
selection: () => SelectionState | null;
|
|
85
|
+
/** Update viewport dims without rebuilding (resize). */
|
|
86
|
+
setViewport: (w: number, h: number) => void;
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=selection_gesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection_gesture.d.ts","sourceRoot":"","sources":["../../src/layout/selection_gesture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAOL,KAAK,IAAI,EAET,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOvC,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACnC,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IACpE;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,aAAa,GAAG,IAAI,CAAC;CAClD,CAAC;AAgCF,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,kBAAuB,GAAG;IACnE,MAAM,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,aAAa,CAAC;IAC5C,KAAK,EAAE,MAAM,cAAc,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,MAAM,cAAc,GAAG,IAAI,CAAC;IACvC,wDAAwD;IACxD,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C,CAwNA"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection gesture state machine — mouse events → SelectionState transitions.
|
|
3
|
+
*
|
|
4
|
+
* Pure state, no I/O. The host wires decoded mouse events in and reads
|
|
5
|
+
* {@link GestureOutput} (a selection snapshot + optional edge-scroll signal)
|
|
6
|
+
* out for paint + autoscroll.
|
|
7
|
+
*
|
|
8
|
+
* Visible-selection law (terminal/editor convergence):
|
|
9
|
+
* - A bare single click does **not** create a 1-cell selection. It only
|
|
10
|
+
* records the press so a subsequent drag can start from that cell, and
|
|
11
|
+
* clears any prior selection (click-to-dismiss).
|
|
12
|
+
* - Selection appears on: drag past the press cell, double-click (word),
|
|
13
|
+
* triple-click (line), Alt+drag (rect), or Shift+click extend.
|
|
14
|
+
*
|
|
15
|
+
* Containment (`userSelect: "contain"`, e.g. composer input):
|
|
16
|
+
* - When the press lands inside a contain region, the selection is armed
|
|
17
|
+
* with that rect. Every subsequent endpoint is clamped into it — drag
|
|
18
|
+
* cannot leave the input (browser <textarea> model).
|
|
19
|
+
*
|
|
20
|
+
* Click-count grammar:
|
|
21
|
+
* single — arm a potential drag (no paint yet)
|
|
22
|
+
* double — word granularity + expand to word bounds (when getRowCells given)
|
|
23
|
+
* triple — line granularity + expand to full line (within contain if set)
|
|
24
|
+
* quad+ — cycles back to char (structural walk is Phase 4)
|
|
25
|
+
*
|
|
26
|
+
* Modifiers:
|
|
27
|
+
* Alt — rectangular block granularity during a drag
|
|
28
|
+
* Shift — extend the existing selection from its anchor (shift+click)
|
|
29
|
+
*/
|
|
30
|
+
import { clampCell, expandToLineAt, expandToWordAt, extendSelection, clearSelection, startSelection, } from "./selection.js";
|
|
31
|
+
/** Multi-click window in milliseconds (browser convention). */
|
|
32
|
+
const MULTI_CLICK_MS = 500;
|
|
33
|
+
/** Movement tolerance in cells — exceed this and it's a drag, not a click. */
|
|
34
|
+
const MOVE_TOLERANCE = 5;
|
|
35
|
+
/**
|
|
36
|
+
* Should this selection paint / copy? Collapsed char (and collapsed word
|
|
37
|
+
* without snap) is not a selection — it's a caret arm or a failed expand.
|
|
38
|
+
*/
|
|
39
|
+
function hasVisibleExtent(sel) {
|
|
40
|
+
if (!sel)
|
|
41
|
+
return false;
|
|
42
|
+
if (sel.granularity === "line" || sel.granularity === "structural")
|
|
43
|
+
return true;
|
|
44
|
+
return sel.anchor.col !== sel.active.col || sel.anchor.row !== sel.active.row;
|
|
45
|
+
}
|
|
46
|
+
export function createGestureMachine(opts = {}) {
|
|
47
|
+
let viewportH = opts.viewportH;
|
|
48
|
+
let viewportW = opts.viewportW;
|
|
49
|
+
const getRowCells = opts.getRowCells;
|
|
50
|
+
const containAt = opts.containAt;
|
|
51
|
+
const st = {
|
|
52
|
+
sel: null,
|
|
53
|
+
lastPressCell: null,
|
|
54
|
+
lastPressKey: undefined,
|
|
55
|
+
contain: undefined,
|
|
56
|
+
lastPressMs: -Infinity,
|
|
57
|
+
clickCount: 0,
|
|
58
|
+
dragging: false,
|
|
59
|
+
armedGranularity: "char",
|
|
60
|
+
movedOrExpanded: false,
|
|
61
|
+
};
|
|
62
|
+
function clickCountToGranularity(count) {
|
|
63
|
+
if (count >= 4)
|
|
64
|
+
return "char";
|
|
65
|
+
return ["char", "word", "line"][Math.min(count, 3) - 1];
|
|
66
|
+
}
|
|
67
|
+
function sameCell(a, b) {
|
|
68
|
+
return a.col === b.col && a.row === b.row;
|
|
69
|
+
}
|
|
70
|
+
function manhattan(a, b) {
|
|
71
|
+
return Math.abs(a.col - b.col) + Math.abs(a.row - b.row);
|
|
72
|
+
}
|
|
73
|
+
function edgeScroll(row) {
|
|
74
|
+
// Contained drags never autoscroll the outer viewport off the input.
|
|
75
|
+
if (st.contain)
|
|
76
|
+
return undefined;
|
|
77
|
+
if (viewportH === undefined)
|
|
78
|
+
return undefined;
|
|
79
|
+
if (row < 0)
|
|
80
|
+
return "up";
|
|
81
|
+
if (row >= viewportH)
|
|
82
|
+
return "down";
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
function clamp(cell) {
|
|
86
|
+
return st.contain ? clampCell(cell, st.contain) : cell;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Is the cell inside the armed contain rect (inclusive)? A pointer off the
|
|
90
|
+
* box is not over the input's content, so its cell carries no position —
|
|
91
|
+
* the endpoint stays at the last in-box cell instead.
|
|
92
|
+
*/
|
|
93
|
+
function inContain(cell) {
|
|
94
|
+
const r = st.contain;
|
|
95
|
+
if (!r)
|
|
96
|
+
return true;
|
|
97
|
+
const maxC = r.x + Math.max(1, r.w) - 1;
|
|
98
|
+
const maxR = r.y + Math.max(1, r.h) - 1;
|
|
99
|
+
return cell.col >= r.x && cell.col <= maxC && cell.row >= r.y && cell.row <= maxR;
|
|
100
|
+
}
|
|
101
|
+
function armContain(cell, evKey) {
|
|
102
|
+
const region = containAt?.(cell) ?? null;
|
|
103
|
+
st.contain = region?.rect;
|
|
104
|
+
st.lastPressKey = region?.key ?? evKey;
|
|
105
|
+
return clamp(cell);
|
|
106
|
+
}
|
|
107
|
+
/** Materialize a selection at press for multi-click / Alt; char stays armed only. */
|
|
108
|
+
function materializeAtPress(cell, gran) {
|
|
109
|
+
const key = st.lastPressKey;
|
|
110
|
+
const contain = st.contain;
|
|
111
|
+
if (gran === "word") {
|
|
112
|
+
if (getRowCells) {
|
|
113
|
+
st.movedOrExpanded = true;
|
|
114
|
+
return expandToWordAt(cell, getRowCells, key, contain);
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
if (gran === "line") {
|
|
119
|
+
st.movedOrExpanded = true;
|
|
120
|
+
return expandToLineAt(cell, viewportW ?? 1, key, contain);
|
|
121
|
+
}
|
|
122
|
+
if (gran === "rect") {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
function handle(ev) {
|
|
128
|
+
if (ev.kind === "press") {
|
|
129
|
+
// Shift+click extends the existing selection from its anchor.
|
|
130
|
+
// Clamp into the existing contain (if any); do not re-arm from the new cell.
|
|
131
|
+
if (ev.shift && st.sel && hasVisibleExtent(st.sel)) {
|
|
132
|
+
st.contain = st.sel.contain;
|
|
133
|
+
const cell = clamp({ col: ev.col, row: ev.row });
|
|
134
|
+
st.sel = extendSelection(st.sel, cell);
|
|
135
|
+
st.dragging = true;
|
|
136
|
+
st.movedOrExpanded = true;
|
|
137
|
+
st.lastPressCell = cell;
|
|
138
|
+
st.lastPressMs = ev.tMs;
|
|
139
|
+
return { selection: st.sel };
|
|
140
|
+
}
|
|
141
|
+
const raw = { col: ev.col, row: ev.row };
|
|
142
|
+
// Multi-click detection uses the raw press cell (pre-clamp) so double-click
|
|
143
|
+
// still matches the same physical click target.
|
|
144
|
+
const withinWindow = ev.tMs - st.lastPressMs <= MULTI_CLICK_MS;
|
|
145
|
+
const sameSpot = st.lastPressCell !== null && sameCell(st.lastPressCell, clamp(raw));
|
|
146
|
+
// For multi-click, re-use prior contain if same spot; else arm fresh.
|
|
147
|
+
const cell = withinWindow && sameSpot && st.contain ? clamp(raw) : armContain(raw, ev.key);
|
|
148
|
+
st.clickCount = withinWindow && sameSpot ? st.clickCount + 1 : 1;
|
|
149
|
+
st.lastPressCell = cell;
|
|
150
|
+
st.lastPressMs = ev.tMs;
|
|
151
|
+
const granularity = clickCountToGranularity(st.clickCount);
|
|
152
|
+
const gran = ev.alt ? "rect" : granularity;
|
|
153
|
+
st.armedGranularity = gran;
|
|
154
|
+
st.movedOrExpanded = false;
|
|
155
|
+
st.dragging = true;
|
|
156
|
+
// Clear any prior selection at gesture START (press), not release.
|
|
157
|
+
// materializeAtPress returns null for bare char (armed only); word/line
|
|
158
|
+
// replace the old range immediately. Hosts recolor from this return.
|
|
159
|
+
st.sel = materializeAtPress(cell, gran);
|
|
160
|
+
return { selection: hasVisibleExtent(st.sel) ? st.sel : null };
|
|
161
|
+
}
|
|
162
|
+
if (ev.kind === "drag") {
|
|
163
|
+
const raw = { col: ev.col, row: ev.row };
|
|
164
|
+
// Containment clamps the endpoint into the input, so a pointer *off* the
|
|
165
|
+
// box still projects onto it — that projection can land on the anchor
|
|
166
|
+
// and erase a range the drag already established (pointer drifting above
|
|
167
|
+
// a single-row input in the anchor's column). An off-box cell carries no
|
|
168
|
+
// real position then; keep the endpoint the drag last set.
|
|
169
|
+
const clamped = clamp(raw);
|
|
170
|
+
const offBox = !inContain(raw);
|
|
171
|
+
const cell = offBox && st.sel !== null && sameCell(clamped, st.sel.anchor) ? st.sel.active : clamped;
|
|
172
|
+
if (st.clickCount > 1 && st.lastPressCell && manhattan(st.lastPressCell, cell) > MOVE_TOLERANCE) {
|
|
173
|
+
st.clickCount = 1;
|
|
174
|
+
st.armedGranularity = "char";
|
|
175
|
+
st.sel = startSelection(st.lastPressCell, "char", st.lastPressKey, st.contain);
|
|
176
|
+
st.movedOrExpanded = !sameCell(st.lastPressCell, cell);
|
|
177
|
+
}
|
|
178
|
+
const gran = st.armedGranularity === "rect" ? "rect" : (st.sel?.granularity ?? st.armedGranularity);
|
|
179
|
+
if (!st.sel) {
|
|
180
|
+
const origin = st.lastPressCell ?? cell;
|
|
181
|
+
st.sel = startSelection(origin, gran, st.lastPressKey, st.contain);
|
|
182
|
+
}
|
|
183
|
+
if (!sameCell(st.sel.active, cell))
|
|
184
|
+
st.movedOrExpanded = true;
|
|
185
|
+
st.sel = extendSelection({ ...st.sel, granularity: gran }, cell);
|
|
186
|
+
if (!hasVisibleExtent(st.sel)) {
|
|
187
|
+
return {
|
|
188
|
+
selection: null,
|
|
189
|
+
scroll: edgeScroll(ev.row),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return { selection: st.sel, scroll: edgeScroll(ev.row) };
|
|
193
|
+
}
|
|
194
|
+
if (ev.kind === "release") {
|
|
195
|
+
st.dragging = false;
|
|
196
|
+
const raw = { col: ev.col, row: ev.row };
|
|
197
|
+
const clamped = clamp(raw);
|
|
198
|
+
// Same law as drag: a release off the box projects onto the input, and
|
|
199
|
+
// that projection must not collapse the range at button-up — the drag
|
|
200
|
+
// already established the extent the host commits as the draft mark.
|
|
201
|
+
const cell = !inContain(raw) && st.sel !== null && sameCell(clamped, st.sel.anchor) ? st.sel.active : clamped;
|
|
202
|
+
if (st.sel && hasVisibleExtent(st.sel) && st.clickCount <= 1 && !sameCell(st.sel.active, cell)) {
|
|
203
|
+
st.sel = extendSelection(st.sel, cell);
|
|
204
|
+
st.movedOrExpanded = true;
|
|
205
|
+
}
|
|
206
|
+
if (!hasVisibleExtent(st.sel)) {
|
|
207
|
+
st.sel = null;
|
|
208
|
+
st.movedOrExpanded = false;
|
|
209
|
+
st.armedGranularity = "char";
|
|
210
|
+
st.contain = undefined;
|
|
211
|
+
return { selection: null, copyReady: false };
|
|
212
|
+
}
|
|
213
|
+
const copyReady = st.movedOrExpanded || hasVisibleExtent(st.sel);
|
|
214
|
+
st.armedGranularity = "char";
|
|
215
|
+
return { selection: st.sel, copyReady };
|
|
216
|
+
}
|
|
217
|
+
return { selection: hasVisibleExtent(st.sel) ? st.sel : null };
|
|
218
|
+
}
|
|
219
|
+
function clear() {
|
|
220
|
+
st.sel = clearSelection();
|
|
221
|
+
st.clickCount = 0;
|
|
222
|
+
st.lastPressCell = null;
|
|
223
|
+
st.lastPressKey = undefined;
|
|
224
|
+
st.contain = undefined;
|
|
225
|
+
st.dragging = false;
|
|
226
|
+
st.movedOrExpanded = false;
|
|
227
|
+
st.armedGranularity = "char";
|
|
228
|
+
return st.sel;
|
|
229
|
+
}
|
|
230
|
+
function selection() {
|
|
231
|
+
return hasVisibleExtent(st.sel) ? st.sel : null;
|
|
232
|
+
}
|
|
233
|
+
function setViewport(w, h) {
|
|
234
|
+
viewportW = w;
|
|
235
|
+
viewportH = h;
|
|
236
|
+
}
|
|
237
|
+
return { handle, clear, selection, setViewport };
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=selection_gesture.js.map
|