@vibecook/ice 0.10.0 → 0.14.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/README.md +79 -50
- package/dist/chunk-BA7XJC27.js +2429 -0
- package/dist/chunk-BA7XJC27.js.map +1 -0
- package/dist/chunk-BKV4ZEU3.js +1 -0
- package/dist/chunk-BKV4ZEU3.js.map +1 -0
- package/dist/{chunk-5FQS7V2C.js → chunk-DYK6KNLG.js} +13303 -7485
- package/dist/chunk-DYK6KNLG.js.map +1 -0
- package/dist/chunk-ENIFIUEP.js +155 -0
- package/dist/chunk-ENIFIUEP.js.map +1 -0
- package/dist/chunk-IBWWLA6D.js +634 -0
- package/dist/chunk-IBWWLA6D.js.map +1 -0
- package/dist/{chunk-OR5FNVUE.js → chunk-JS6PG6YD.js} +398 -167
- package/dist/chunk-JS6PG6YD.js.map +1 -0
- package/dist/chunk-QXOCF56A.js +148 -0
- package/dist/chunk-QXOCF56A.js.map +1 -0
- package/dist/chunk-ZPUPBULB.js +7399 -0
- package/dist/chunk-ZPUPBULB.js.map +1 -0
- package/dist/desk-engine.js +36 -0
- package/dist/desk-engine.js.map +1 -0
- package/dist/desk-kit.js +244 -0
- package/dist/desk-kit.js.map +1 -0
- package/dist/desk-objects.js +12728 -0
- package/dist/desk-objects.js.map +1 -0
- package/dist/desk.js +469 -0
- package/dist/desk.js.map +1 -0
- package/dist/devtools.js +233 -189
- package/dist/devtools.js.map +1 -1
- package/dist/dom.js +7 -19
- package/dist/index.js +232 -20
- package/dist/kernel.js +53 -25
- package/dist/react.js +1045 -38
- package/dist/react.js.map +1 -1
- package/dist/types/packages/core/src/behavior/define-behavior.d.ts +11 -0
- package/dist/types/packages/core/src/behavior/runtime.d.ts +4 -0
- package/dist/types/packages/core/src/canvas/define-canvas-type.d.ts +86 -0
- package/dist/types/packages/core/src/canvas/define-container.d.ts +17 -0
- package/dist/types/packages/core/src/canvas/diagnostics.d.ts +27 -0
- package/dist/types/packages/core/src/canvas/engine-catalog.d.ts +70 -0
- package/dist/types/packages/core/src/canvas/extensions.d.ts +125 -0
- package/dist/types/packages/core/src/canvas/frame-behavior-host.d.ts +16 -0
- package/dist/types/packages/core/src/canvas/frame-preview.d.ts +79 -0
- package/dist/types/packages/core/src/canvas/frame-projection.d.ts +38 -0
- package/dist/types/packages/core/src/canvas/frame-view.d.ts +36 -0
- package/dist/types/packages/core/src/canvas/migrate.d.ts +14 -0
- package/dist/types/packages/core/src/canvas/placement.d.ts +30 -0
- package/dist/types/packages/core/src/canvas/presentation-transition.d.ts +100 -0
- package/dist/types/packages/core/src/canvas/runtime-extension-host.d.ts +16 -0
- package/dist/types/packages/core/src/canvas/session.d.ts +47 -0
- package/dist/types/packages/core/src/catalog/camera-derived.d.ts +16 -27
- package/dist/types/packages/core/src/catalog/desk.d.ts +326 -0
- package/dist/types/packages/core/src/catalog/gesture.d.ts +51 -0
- package/dist/types/packages/core/src/catalog/graph.d.ts +2 -2
- package/dist/types/packages/core/src/catalog/index.d.ts +2 -0
- package/dist/types/packages/core/src/catalog/pointer.d.ts +42 -0
- package/dist/types/packages/core/src/catalog/selection-presence.d.ts +7 -0
- package/dist/types/packages/core/src/catalog/settings-resources.d.ts +28 -2
- package/dist/types/packages/core/src/catalog/surface.d.ts +1 -0
- package/dist/types/packages/core/src/doc/doc-commit-sink.d.ts +18 -2
- package/dist/types/packages/core/src/doc/doc-kit.d.ts +21 -2
- package/dist/types/packages/core/src/doc/envelope.d.ts +5 -2
- package/dist/types/packages/core/src/doc/schema-migrate.d.ts +1 -1
- package/dist/types/packages/core/src/doc/version-gate.d.ts +21 -3
- package/dist/types/packages/core/src/engine/commit-sink.d.ts +10 -1
- package/dist/types/packages/core/src/engine/engine.d.ts +6 -0
- package/dist/types/packages/core/src/engine/frame-control.d.ts +74 -0
- package/dist/types/packages/core/src/engine/guests.d.ts +4 -1
- package/dist/types/packages/core/src/engine/world-doors.d.ts +12 -0
- package/dist/types/packages/core/src/facade/create-canvas-engine.d.ts +146 -13
- package/dist/types/packages/core/src/index.d.ts +34 -13
- package/dist/types/packages/core/src/input/queue.d.ts +3 -1
- package/dist/types/packages/core/src/interaction/install.d.ts +30 -0
- package/dist/types/packages/core/src/interaction/wakes.d.ts +24 -0
- package/dist/types/packages/core/src/nav/nav-geometry.d.ts +100 -0
- package/dist/types/packages/core/src/nav/nested-canvas.d.ts +47 -4
- package/dist/types/packages/core/src/ops/cascade.d.ts +2 -1
- package/dist/types/packages/core/src/ops/claims.d.ts +6 -0
- package/dist/types/packages/core/src/ops/insert.d.ts +4 -0
- package/dist/types/packages/core/src/ops/point-pick.d.ts +4 -1
- package/dist/types/packages/core/src/ops/sibling-order.d.ts +14 -4
- package/dist/types/packages/core/src/ops/tray.d.ts +48 -0
- package/dist/types/packages/core/src/presence/presence-kit.d.ts +5 -0
- package/dist/types/packages/core/src/schema/meta.d.ts +10 -0
- package/dist/types/packages/core/src/schema/prefab.d.ts +8 -0
- package/dist/types/packages/core/src/settings/defaults.d.ts +25 -6
- package/dist/types/packages/core/src/surface/gpu-device.d.ts +55 -0
- package/dist/types/packages/core/src/systems/camera-sim.d.ts +29 -0
- package/dist/types/packages/core/src/systems/chrome.d.ts +15 -23
- package/dist/types/packages/core/src/systems/drag-mods.d.ts +34 -0
- package/dist/types/packages/core/src/systems/held.d.ts +71 -0
- package/dist/types/packages/core/src/systems/insert-ghost.d.ts +2 -0
- package/dist/types/packages/core/src/systems/l0-input.d.ts +14 -0
- package/dist/types/packages/core/src/systems/l1-pick.d.ts +37 -1
- package/dist/types/packages/core/src/systems/l2-arbitrate.d.ts +18 -4
- package/dist/types/packages/core/src/systems/l3-behave.d.ts +4 -1
- package/dist/types/packages/core/src/systems/l3-claim.d.ts +7 -0
- package/dist/types/packages/core/src/systems/l3-connect.d.ts +1 -1
- package/dist/types/packages/core/src/systems/l3-drop.d.ts +30 -1
- package/dist/types/packages/core/src/systems/l3-marquee.d.ts +2 -1
- package/dist/types/packages/core/src/systems/l3-ports.d.ts +1 -1
- package/dist/types/packages/core/src/systems/l4-cursor.d.ts +5 -0
- package/dist/types/packages/core/src/systems/nav-flight.d.ts +85 -3
- package/dist/types/packages/core/src/systems/nav-tap.d.ts +44 -0
- package/dist/types/packages/core/src/systems/press-wheel.d.ts +11 -0
- package/dist/types/packages/core/src/systems/tray.d.ts +108 -0
- package/dist/types/packages/core/src/systems/zoom-through.d.ts +30 -0
- package/dist/types/packages/core/src/tools/define-tool.d.ts +10 -0
- package/dist/types/packages/core/src/widget/define-widget.d.ts +166 -63
- package/dist/types/packages/core/src/widget/equip.d.ts +14 -2
- package/dist/types/packages/core/src/widget/held-tools.d.ts +83 -0
- package/dist/types/packages/core/src/widget/menu-actions.d.ts +44 -0
- package/dist/types/packages/core/src/widget/mount-store.d.ts +21 -46
- package/dist/types/packages/core/src/widget/spawn.d.ts +1 -1
- package/dist/types/packages/desk/src/assets/blue-noise.gen.d.ts +10 -0
- package/dist/types/packages/desk/src/card/card.d.ts +103 -0
- package/dist/types/packages/desk/src/compose/ambient.d.ts +59 -0
- package/dist/types/packages/desk/src/compose/builder.d.ts +285 -0
- package/dist/types/packages/desk/src/compose/children.d.ts +3 -0
- package/dist/types/packages/desk/src/compose/index.d.ts +14 -0
- package/dist/types/packages/desk/src/compose/marks.d.ts +126 -0
- package/dist/types/packages/desk/src/compose/pick.d.ts +5 -0
- package/dist/types/packages/desk/src/compose/reflector.d.ts +111 -0
- package/dist/types/packages/desk/src/compose/tap.d.ts +5 -0
- package/dist/types/packages/desk/src/docs.d.ts +23 -0
- package/dist/types/packages/desk/src/engine/budget.d.ts +38 -0
- package/dist/types/packages/desk/src/engine/device.d.ts +54 -0
- package/dist/types/packages/desk/src/engine/index.d.ts +5 -0
- package/dist/types/packages/desk/src/engine/pipeline.d.ts +36 -0
- package/dist/types/packages/desk/src/engine/rasters.d.ts +66 -0
- package/dist/types/packages/desk/src/engine/records.d.ts +56 -0
- package/dist/types/packages/desk/src/engine/shader.d.ts +22 -0
- package/dist/types/packages/desk/src/engine/struct.d.ts +39 -0
- package/dist/types/packages/desk/src/engine/target.d.ts +26 -0
- package/dist/types/packages/desk/src/gpu-ablation.d.ts +61 -0
- package/dist/types/packages/desk/src/gpu-memory.d.ts +54 -0
- package/dist/types/packages/desk/src/gpu-profiler.d.ts +141 -0
- package/dist/types/packages/desk/src/gpu-wrap.d.ts +8 -0
- package/dist/types/packages/desk/src/ground.d.ts +388 -0
- package/dist/types/packages/desk/src/hold/focus.d.ts +53 -0
- package/dist/types/packages/desk/src/hold/pose.d.ts +132 -0
- package/dist/types/packages/desk/src/hold/shaders.d.ts +9 -0
- package/dist/types/packages/desk/src/host/editor.d.ts +18 -0
- package/dist/types/packages/desk/src/host/index.d.ts +9 -0
- package/dist/types/packages/desk/src/host/ink.d.ts +18 -0
- package/dist/types/packages/desk/src/host/layer.d.ts +430 -0
- package/dist/types/packages/desk/src/host/picture.d.ts +2 -0
- package/dist/types/packages/desk/src/host/surface.d.ts +5 -0
- package/dist/types/packages/desk/src/index.d.ts +13 -0
- package/dist/types/packages/desk/src/kind.d.ts +187 -0
- package/dist/types/packages/desk/src/kinds/world.d.ts +429 -0
- package/dist/types/packages/desk/src/kit/arrays.d.ts +88 -0
- package/dist/types/packages/desk/src/kit/blobs.d.ts +40 -0
- package/dist/types/packages/desk/src/kit/book.d.ts +2 -0
- package/dist/types/packages/desk/src/kit/editor.d.ts +103 -0
- package/dist/types/packages/desk/src/kit/eye.d.ts +37 -0
- package/dist/types/packages/desk/src/kit/hold.d.ts +1 -0
- package/dist/types/packages/desk/src/kit/index.d.ts +26 -0
- package/dist/types/packages/desk/src/kit/inside.d.ts +116 -0
- package/dist/types/packages/desk/src/kit/layer.d.ts +159 -0
- package/dist/types/packages/desk/src/kit/light.d.ts +3 -0
- package/dist/types/packages/desk/src/kit/mesh.d.ts +29 -0
- package/dist/types/packages/desk/src/kit/mips.d.ts +2 -0
- package/dist/types/packages/desk/src/kit/nav.d.ts +2 -0
- package/dist/types/packages/desk/src/kit/paper-tex.d.ts +5 -0
- package/dist/types/packages/desk/src/kit/physics.d.ts +44 -0
- package/dist/types/packages/desk/src/kit/place.d.ts +44 -0
- package/dist/types/packages/desk/src/kit/print.d.ts +30 -0
- package/dist/types/packages/desk/src/kit/raster.d.ts +34 -0
- package/dist/types/packages/desk/src/kit/sdf.d.ts +1 -0
- package/dist/types/packages/desk/src/kit/seeds.d.ts +11 -0
- package/dist/types/packages/desk/src/kit/services.d.ts +34 -0
- package/dist/types/packages/desk/src/kit/springs.d.ts +12 -0
- package/dist/types/packages/desk/src/kit/strokes.d.ts +93 -0
- package/dist/types/packages/desk/src/kit/text.d.ts +142 -0
- package/dist/types/packages/desk/src/kit/uniform.d.ts +8 -0
- package/dist/types/packages/desk/src/kit/view.d.ts +39 -0
- package/dist/types/packages/desk/src/kit/wgsl.d.ts +15 -0
- package/dist/types/packages/desk/src/lattice/line.d.ts +15 -0
- package/dist/types/packages/desk/src/lattice/lod.d.ts +52 -0
- package/dist/types/packages/desk/src/lattice/ruler.d.ts +88 -0
- package/dist/types/packages/desk/src/marks/assemble.d.ts +65 -0
- package/dist/types/packages/desk/src/marks/ease.d.ts +4 -0
- package/dist/types/packages/desk/src/marks/laser.d.ts +41 -0
- package/dist/types/packages/desk/src/marks/layout.d.ts +167 -0
- package/dist/types/packages/desk/src/marks/pass.d.ts +59 -0
- package/dist/types/packages/desk/src/marks/shaders.d.ts +12 -0
- package/dist/types/packages/desk/src/mat/grid.d.ts +50 -0
- package/dist/types/packages/desk/src/mat/lamp.d.ts +14 -0
- package/dist/types/packages/desk/src/mat/layout.d.ts +144 -0
- package/dist/types/packages/desk/src/mat/mat-pass.d.ts +83 -0
- package/dist/types/packages/desk/src/mat/night.d.ts +95 -0
- package/dist/types/packages/desk/src/mat/projector.d.ts +39 -0
- package/dist/types/packages/desk/src/mat/shaders.d.ts +17 -0
- package/dist/types/packages/desk/src/mat/tilt.d.ts +14 -0
- package/dist/types/packages/desk/src/nav/flight.d.ts +186 -0
- package/dist/types/packages/desk/src/nav/portal.d.ts +95 -0
- package/dist/types/packages/desk/src/object.d.ts +46 -0
- package/dist/types/packages/desk/src/pass-instrument.d.ts +89 -0
- package/dist/types/packages/desk/src/shaders.d.ts +12 -0
- package/dist/types/packages/desk/src/shaders.gen.d.ts +16 -0
- package/dist/types/packages/desk/src/submit-instrument.d.ts +36 -0
- package/dist/types/packages/desk/src/theme.d.ts +475 -0
- package/dist/types/packages/desk/src/tray/carry.d.ts +99 -0
- package/dist/types/packages/desk/src/tray/drawer.d.ts +113 -0
- package/dist/types/packages/desk/src/tray/flux.d.ts +46 -0
- package/dist/types/packages/desk/src/tray/index.d.ts +4 -0
- package/dist/types/packages/desk/src/tray/lattice.d.ts +71 -0
- package/dist/types/packages/desk/src/tray/layout.d.ts +7 -0
- package/dist/types/packages/desk/src/tray/look.d.ts +29 -0
- package/dist/types/packages/desk/src/tray/pass.d.ts +96 -0
- package/dist/types/packages/desk/src/tray/shaders.d.ts +10 -0
- package/dist/types/packages/desk/src/tray/specimens.d.ts +199 -0
- package/dist/types/packages/devtools/src/attach.d.ts +22 -8
- package/dist/types/packages/devtools/src/dock.d.ts +18 -14
- package/dist/types/packages/devtools/src/gpu-panel.d.ts +105 -0
- package/dist/types/packages/devtools/src/index.d.ts +5 -4
- package/dist/types/packages/dom/src/desk-host.d.ts +91 -0
- package/dist/types/packages/dom/src/host.d.ts +13 -14
- package/dist/types/packages/dom/src/index.d.ts +12 -10
- package/dist/types/packages/dom/src/loop.d.ts +18 -1
- package/dist/types/packages/dom/src/pointer-adapter.d.ts +5 -29
- package/dist/types/packages/dom/src/widget-focus.d.ts +17 -13
- package/dist/types/packages/ice/src/desk-engine.d.ts +2 -0
- package/dist/types/packages/ice/src/desk-kit.d.ts +6 -0
- package/dist/types/packages/ice/src/desk-objects.d.ts +5 -0
- package/dist/types/packages/ice/src/desk.d.ts +5 -0
- package/dist/types/packages/kernel/src/atlas-pack.d.ts +157 -0
- package/dist/types/packages/kernel/src/bezier.d.ts +0 -15
- package/dist/types/packages/kernel/src/coords.d.ts +0 -39
- package/dist/types/packages/kernel/src/index.d.ts +2 -2
- package/dist/types/packages/kernel/src/nav-flight.d.ts +6 -0
- package/dist/types/packages/kernel/src/tray.d.ts +155 -0
- package/dist/types/packages/objects/src/board/board-pass.d.ts +180 -0
- package/dist/types/packages/objects/src/board/board-pen.d.ts +36 -0
- package/dist/types/packages/objects/src/board/board.d.ts +104 -0
- package/dist/types/packages/objects/src/board/data.d.ts +31 -0
- package/dist/types/packages/objects/src/board/history.d.ts +33 -0
- package/dist/types/packages/objects/src/board/kind.d.ts +208 -0
- package/dist/types/packages/objects/src/board/layout.d.ts +102 -0
- package/dist/types/packages/objects/src/board/object.d.ts +7 -0
- package/dist/types/packages/objects/src/board/pen.d.ts +71 -0
- package/dist/types/packages/objects/src/board/shaders.d.ts +36 -0
- package/dist/types/packages/objects/src/board/stroke.d.ts +99 -0
- package/dist/types/packages/objects/src/board/theme.d.ts +150 -0
- package/dist/types/packages/objects/src/calendar/data.d.ts +97 -0
- package/dist/types/packages/objects/src/calendar/events.d.ts +58 -0
- package/dist/types/packages/objects/src/calendar/hand.d.ts +53 -0
- package/dist/types/packages/objects/src/calendar/host/input.d.ts +67 -0
- package/dist/types/packages/objects/src/calendar/host/print.d.ts +9 -0
- package/dist/types/packages/objects/src/calendar/kind.d.ts +297 -0
- package/dist/types/packages/objects/src/calendar/law.d.ts +151 -0
- package/dist/types/packages/objects/src/calendar/layout.d.ts +47 -0
- package/dist/types/packages/objects/src/calendar/month.d.ts +75 -0
- package/dist/types/packages/objects/src/calendar/object.d.ts +45 -0
- package/dist/types/packages/objects/src/calendar/pad.d.ts +42 -0
- package/dist/types/packages/objects/src/calendar/pass.d.ts +229 -0
- package/dist/types/packages/objects/src/calendar/print.d.ts +87 -0
- package/dist/types/packages/objects/src/calendar/printing.d.ts +80 -0
- package/dist/types/packages/objects/src/calendar/roll.d.ts +45 -0
- package/dist/types/packages/objects/src/calendar/shaders.d.ts +12 -0
- package/dist/types/packages/objects/src/calendar/sheet.d.ts +43 -0
- package/dist/types/packages/objects/src/calendar/tiles.d.ts +67 -0
- package/dist/types/packages/objects/src/calendar/turn.d.ts +73 -0
- package/dist/types/packages/objects/src/calendar/writing.d.ts +42 -0
- package/dist/types/packages/objects/src/index.d.ts +22 -0
- package/dist/types/packages/objects/src/kinds.d.ts +24 -0
- package/dist/types/packages/objects/src/minimat/inside.d.ts +17 -0
- package/dist/types/packages/objects/src/minimat/kind.d.ts +51 -0
- package/dist/types/packages/objects/src/minimat/layout.d.ts +83 -0
- package/dist/types/packages/objects/src/minimat/minimat.d.ts +179 -0
- package/dist/types/packages/objects/src/minimat/object.d.ts +8 -0
- package/dist/types/packages/objects/src/minimat/pass.d.ts +61 -0
- package/dist/types/packages/objects/src/minimat/shaders.d.ts +10 -0
- package/dist/types/packages/objects/src/minimat/theme.d.ts +98 -0
- package/dist/types/packages/objects/src/notebook/ink.d.ts +70 -0
- package/dist/types/packages/objects/src/notebook/kind.d.ts +236 -0
- package/dist/types/packages/objects/src/notebook/law.d.ts +129 -0
- package/dist/types/packages/objects/src/notebook/layout.d.ts +46 -0
- package/dist/types/packages/objects/src/notebook/leaf.d.ts +44 -0
- package/dist/types/packages/objects/src/notebook/mesh.d.ts +20 -0
- package/dist/types/packages/objects/src/notebook/motion.d.ts +107 -0
- package/dist/types/packages/objects/src/notebook/object.d.ts +8 -0
- package/dist/types/packages/objects/src/notebook/pages.d.ts +56 -0
- package/dist/types/packages/objects/src/notebook/pass.d.ts +197 -0
- package/dist/types/packages/objects/src/notebook/pick.d.ts +30 -0
- package/dist/types/packages/objects/src/notebook/raster.d.ts +28 -0
- package/dist/types/packages/objects/src/notebook/shaders.d.ts +11 -0
- package/dist/types/packages/objects/src/notebook/shape.d.ts +155 -0
- package/dist/types/packages/objects/src/notebook/theme.d.ts +76 -0
- package/dist/types/packages/objects/src/palette.d.ts +577 -0
- package/dist/types/packages/objects/src/paper/host/body.d.ts +30 -0
- package/dist/types/packages/objects/src/paper/kind.d.ts +81 -0
- package/dist/types/packages/objects/src/paper/layout.d.ts +73 -0
- package/dist/types/packages/objects/src/paper/object.d.ts +31 -0
- package/dist/types/packages/objects/src/paper/pages.d.ts +43 -0
- package/dist/types/packages/objects/src/paper/paper-pass.d.ts +86 -0
- package/dist/types/packages/objects/src/paper/paper.d.ts +117 -0
- package/dist/types/packages/objects/src/paper/shaders.d.ts +18 -0
- package/dist/types/packages/objects/src/paper/theme.d.ts +58 -0
- package/dist/types/packages/objects/src/paper/typing.d.ts +51 -0
- package/dist/types/packages/objects/src/paper/writing.d.ts +161 -0
- package/dist/types/packages/objects/src/photo/carry.d.ts +33 -0
- package/dist/types/packages/objects/src/photo/kind.d.ts +136 -0
- package/dist/types/packages/objects/src/photo/layout.d.ts +39 -0
- package/dist/types/packages/objects/src/photo/object.d.ts +5 -0
- package/dist/types/packages/objects/src/photo/photo-pass.d.ts +104 -0
- package/dist/types/packages/objects/src/photo/photo.d.ts +262 -0
- package/dist/types/packages/objects/src/photo/pictures.d.ts +152 -0
- package/dist/types/packages/objects/src/photo/sample.d.ts +9 -0
- package/dist/types/packages/objects/src/photo/shaders.d.ts +18 -0
- package/dist/types/packages/objects/src/preset.d.ts +44 -0
- package/dist/types/packages/objects/src/shaders.d.ts +3 -0
- package/dist/types/packages/objects/src/shaders.gen.d.ts +21 -0
- package/dist/types/packages/react/src/canvas-hooks.d.ts +12 -0
- package/dist/types/packages/react/src/desk.d.ts +56 -0
- package/dist/types/packages/react/src/engine-context.d.ts +2 -2
- package/dist/types/packages/react/src/frame-preview-boundary.d.ts +19 -0
- package/dist/types/packages/react/src/hooks.d.ts +9 -14
- package/dist/types/packages/react/src/index.d.ts +16 -9
- package/dist/types/packages/react/src/keymap.d.ts +21 -2
- package/dist/types/packages/react/src/selection-menu.d.ts +171 -0
- package/dist/types/packages/react/src/tray-bar.d.ts +124 -0
- package/package.json +64 -31
- package/dist/chunk-5FQS7V2C.js.map +0 -1
- package/dist/chunk-JWRHAM7L.js +0 -1163
- package/dist/chunk-JWRHAM7L.js.map +0 -1
- package/dist/chunk-MFTMPJUF.js +0 -681
- package/dist/chunk-MFTMPJUF.js.map +0 -1
- package/dist/chunk-OR5FNVUE.js.map +0 -1
- package/dist/ground.js +0 -1213
- package/dist/ground.js.map +0 -1
- package/dist/r3f.js +0 -1644
- package/dist/r3f.js.map +0 -1
- package/dist/types/packages/core/src/input/measure-queue.d.ts +0 -30
- package/dist/types/packages/core/src/settings/ground-config.d.ts +0 -103
- package/dist/types/packages/core/src/systems/measure-ingest.d.ts +0 -26
- package/dist/types/packages/devtools/src/gl-panel.d.ts +0 -69
- package/dist/types/packages/dom/src/measure-adapter.d.ts +0 -31
- package/dist/types/packages/dom/src/measure-wiring.d.ts +0 -49
- package/dist/types/packages/dom/src/planes.d.ts +0 -33
- package/dist/types/packages/dom/src/reflectors/chrome.d.ts +0 -33
- package/dist/types/packages/dom/src/reflectors/dom-widgets.d.ts +0 -59
- package/dist/types/packages/dom/src/reflectors/graybox.d.ts +0 -31
- package/dist/types/packages/dom/src/reflectors/plane-transform.d.ts +0 -38
- package/dist/types/packages/ground/src/index.d.ts +0 -69
- package/dist/types/packages/ground/src/layer.d.ts +0 -40
- package/dist/types/packages/ground/src/pass.d.ts +0 -41
- package/dist/types/packages/ground/src/passes/grid-classic.d.ts +0 -30
- package/dist/types/packages/ground/src/passes/grid-magnet.d.ts +0 -31
- package/dist/types/packages/ground/src/passes/grid.d.ts +0 -28
- package/dist/types/packages/ground/src/passes/guides-collect.d.ts +0 -14
- package/dist/types/packages/ground/src/passes/guides.d.ts +0 -3
- package/dist/types/packages/ground/src/passes/magnet-collect.d.ts +0 -63
- package/dist/types/packages/ground/src/passes/soup-collect.d.ts +0 -35
- package/dist/types/packages/ground/src/passes/soup-mesh.d.ts +0 -8
- package/dist/types/packages/ground/src/passes/wires-collect.d.ts +0 -35
- package/dist/types/packages/ground/src/passes/wires.d.ts +0 -10
- package/dist/types/packages/ground/src/poles.d.ts +0 -47
- package/dist/types/packages/ground/src/renderer.d.ts +0 -15
- package/dist/types/packages/ice/src/ground.d.ts +0 -1
- package/dist/types/packages/ice/src/r3f.d.ts +0 -1
- package/dist/types/packages/kernel/src/eviction.d.ts +0 -23
- package/dist/types/packages/kernel/src/zoom-bands.d.ts +0 -19
- package/dist/types/packages/r3f/src/bridge.d.ts +0 -129
- package/dist/types/packages/r3f/src/composite-material.d.ts +0 -26
- package/dist/types/packages/r3f/src/compositor-pass.d.ts +0 -105
- package/dist/types/packages/r3f/src/dev-write-trap.d.ts +0 -30
- package/dist/types/packages/r3f/src/gl-root.d.ts +0 -96
- package/dist/types/packages/r3f/src/gl-router.d.ts +0 -70
- package/dist/types/packages/r3f/src/index.d.ts +0 -17
- package/dist/types/packages/r3f/src/island-state.d.ts +0 -112
- package/dist/types/packages/r3f/src/island.d.ts +0 -13
- package/dist/types/packages/r3f/src/pool.d.ts +0 -56
- package/dist/types/packages/r3f/src/preview-capture.d.ts +0 -19
- package/dist/types/packages/r3f/src/resource-registry.d.ts +0 -30
- package/dist/types/packages/r3f/src/self-sustain.d.ts +0 -39
- package/dist/types/packages/r3f/src/use-island-frame.d.ts +0 -39
- package/dist/types/packages/react/src/infinite-canvas.d.ts +0 -140
- package/dist/types/packages/react/src/preview-snapshots.d.ts +0 -17
- package/dist/types/packages/react/src/widget-preview.d.ts +0 -14
- package/dist/types/packages/react/src/widget-root.d.ts +0 -33
package/dist/react.js
CHANGED
|
@@ -1,51 +1,1058 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
createDeskHost,
|
|
3
|
+
isEditableTarget,
|
|
4
|
+
keyboardClaimOf
|
|
5
|
+
} from "./chunk-IBWWLA6D.js";
|
|
6
|
+
import {
|
|
7
|
+
ActiveTool,
|
|
8
|
+
Container,
|
|
9
|
+
DurableUndoStatus,
|
|
10
|
+
GestureActive,
|
|
11
|
+
Local,
|
|
12
|
+
Locked,
|
|
13
|
+
Not,
|
|
14
|
+
Position,
|
|
15
|
+
PrefabId,
|
|
16
|
+
PresenceInfo,
|
|
17
|
+
PresencePeer,
|
|
18
|
+
Selected,
|
|
19
|
+
WidgetBreakpoint,
|
|
20
|
+
closeTray,
|
|
21
|
+
currentNavEntry,
|
|
22
|
+
defineQuery,
|
|
23
|
+
devGuardsEnabled,
|
|
24
|
+
guardedTransaction,
|
|
25
|
+
heldEntity,
|
|
26
|
+
matchHeldTool,
|
|
27
|
+
selectedEntities,
|
|
28
|
+
tools,
|
|
29
|
+
trayOpen,
|
|
30
|
+
widgets
|
|
31
|
+
} from "./chunk-DYK6KNLG.js";
|
|
32
|
+
import "./chunk-JS6PG6YD.js";
|
|
33
|
+
|
|
34
|
+
// ../react/src/hooks.ts
|
|
35
|
+
import { useCallback, useMemo, useRef, useSyncExternalStore } from "react";
|
|
36
|
+
var selectedQ = defineQuery([Selected]);
|
|
37
|
+
function shallowEq(a, b) {
|
|
38
|
+
if (Object.is(a, b)) return true;
|
|
39
|
+
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
|
|
40
|
+
const ka = Object.keys(a);
|
|
41
|
+
const kb = Object.keys(b);
|
|
42
|
+
if (ka.length !== kb.length) return false;
|
|
43
|
+
for (const k of ka) {
|
|
44
|
+
if (!Object.is(a[k], b[k])) return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
function useWorldComponent(world, entity, component) {
|
|
49
|
+
const last = useRef(void 0);
|
|
50
|
+
const subscribe = useCallback(
|
|
51
|
+
(onChange) => world.reactive.observeValue(entity, component, onChange),
|
|
52
|
+
[world, entity, component]
|
|
53
|
+
);
|
|
54
|
+
const getSnapshot = useCallback(() => {
|
|
55
|
+
const v = world.isAlive(entity) ? world.get(entity, component) : void 0;
|
|
56
|
+
if (!shallowEq(v, last.current)) last.current = v;
|
|
57
|
+
return last.current;
|
|
58
|
+
}, [world, entity, component]);
|
|
59
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
60
|
+
}
|
|
61
|
+
function useWidgetProps(world, entity, type, group = "props") {
|
|
62
|
+
const widget = widgets.get(type);
|
|
63
|
+
const g = widget?.groups.find((x) => x.name === group);
|
|
64
|
+
if (widget === void 0 || g === void 0) {
|
|
65
|
+
throw new Error(`ice: useWidgetProps \u2014 unknown widget type/group "${type}"/"${group}".`);
|
|
66
|
+
}
|
|
67
|
+
const raw = useWorldComponent(world, entity, g.component);
|
|
68
|
+
return useMemo(() => {
|
|
69
|
+
if (raw === void 0) return void 0;
|
|
70
|
+
const out = {};
|
|
71
|
+
for (const [name, spec] of Object.entries(g.fields)) {
|
|
72
|
+
const v = raw[name];
|
|
73
|
+
out[name] = spec.kind === "json" && typeof v === "string" ? parseJsonCell(v, spec.default) : v;
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}, [raw, g]);
|
|
77
|
+
}
|
|
78
|
+
function useBehavior(world, entity, behavior) {
|
|
79
|
+
const raw = useWorldComponent(world, entity, behavior.component);
|
|
80
|
+
return useMemo(() => {
|
|
81
|
+
if (raw === void 0) return void 0;
|
|
82
|
+
const out = {};
|
|
83
|
+
for (const [name, spec] of Object.entries(behavior.schema)) {
|
|
84
|
+
const v = raw[name];
|
|
85
|
+
out[name] = spec.kind === "json" && typeof v === "string" ? parseJsonCell(v, spec.default) : v;
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}, [raw, behavior]);
|
|
89
|
+
}
|
|
90
|
+
function parseJsonCell(cell, serializedDefault) {
|
|
91
|
+
try {
|
|
92
|
+
return JSON.parse(cell);
|
|
93
|
+
} catch {
|
|
94
|
+
try {
|
|
95
|
+
return JSON.parse(serializedDefault ?? "null");
|
|
96
|
+
} catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function useSelected(world, entity) {
|
|
102
|
+
const last = useRef(false);
|
|
103
|
+
const subscribe = useCallback(
|
|
104
|
+
(onChange) => world.reactive.observeQuery(selectedQ, onChange),
|
|
105
|
+
[world]
|
|
106
|
+
);
|
|
107
|
+
const getSnapshot = useCallback(() => {
|
|
108
|
+
last.current = world.isAlive(entity) && world.hasTag(entity, Selected);
|
|
109
|
+
return last.current;
|
|
110
|
+
}, [world, entity]);
|
|
111
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
112
|
+
}
|
|
113
|
+
function useBreakpoint(world, entity) {
|
|
114
|
+
const bp = useWorldComponent(world, entity, WidgetBreakpoint);
|
|
115
|
+
return bp?.tier ?? "normal";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ../react/src/engine-context.tsx
|
|
119
|
+
import { createContext, useContext, useEffect } from "react";
|
|
120
|
+
import { jsx } from "react/jsx-runtime";
|
|
121
|
+
var EngineContext = createContext(null);
|
|
122
|
+
function EngineProvider({ engine, children }) {
|
|
123
|
+
return /* @__PURE__ */ jsx(EngineContext.Provider, { value: engine, children });
|
|
124
|
+
}
|
|
125
|
+
function useCanvasEngine() {
|
|
126
|
+
const engine = useContext(EngineContext);
|
|
127
|
+
if (engine === null) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
"ice: useCanvasEngine \u2014 no <EngineProvider>. Render inside <Desk> (which provides it) or wrap your tree in <EngineProvider engine={...}>."
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
return engine;
|
|
133
|
+
}
|
|
134
|
+
function useOps() {
|
|
135
|
+
return useCanvasEngine().ops;
|
|
136
|
+
}
|
|
137
|
+
function useStageHold(engine, active, name) {
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!active) return void 0;
|
|
140
|
+
return engine.stage.background(name);
|
|
141
|
+
}, [engine, active, name]);
|
|
142
|
+
}
|
|
143
|
+
function useFrameFreeze(engine, active, name) {
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (!active) return void 0;
|
|
146
|
+
return engine.frame.freeze(name);
|
|
147
|
+
}, [engine, active, name]);
|
|
148
|
+
}
|
|
149
|
+
var warnedUseWorld = false;
|
|
150
|
+
function useWorld() {
|
|
151
|
+
const engine = useCanvasEngine();
|
|
152
|
+
if (devGuardsEnabled() && !warnedUseWorld) {
|
|
153
|
+
warnedUseWorld = true;
|
|
154
|
+
console.warn(
|
|
155
|
+
"ice: useWorld() is a READ/OBSERVE escape hatch \u2014 never write to the world directly. Use useOps()/useCommit() for mutation (design-005 \xA75)."
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
return engine.world;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// ../react/src/use-commit.ts
|
|
162
|
+
import { useCallback as useCallback2, useRef as useRef2, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
163
|
+
function useCommit() {
|
|
164
|
+
const engine = useCanvasEngine();
|
|
165
|
+
return useCallback2(
|
|
166
|
+
(fn, opts) => {
|
|
167
|
+
const session = engine.docs.current();
|
|
168
|
+
if (session === void 0) {
|
|
169
|
+
throw new Error(
|
|
170
|
+
"ice: useCommit \u2014 no active document. Attach one with engine.docs.create()/open()/join() before committing widget edits."
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
if (session.readOnly) {
|
|
174
|
+
throw new Error("ice: useCommit \u2014 the document is read-only (version gate); widget edits are disabled.");
|
|
175
|
+
}
|
|
176
|
+
guardedTransaction(session.store, engine.world, fn, opts);
|
|
177
|
+
},
|
|
178
|
+
[engine]
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
var NO_UNDO = { canUndo: false, canRedo: false };
|
|
182
|
+
function useUndoStatus() {
|
|
183
|
+
const engine = useCanvasEngine();
|
|
184
|
+
const last = useRef2(NO_UNDO);
|
|
185
|
+
const subscribe = useCallback2(
|
|
186
|
+
(onChange) => engine.world.reactive.observeResource(DurableUndoStatus, onChange),
|
|
187
|
+
[engine]
|
|
188
|
+
);
|
|
189
|
+
const getSnapshot = useCallback2(() => {
|
|
190
|
+
const status = engine.world.getResource(DurableUndoStatus);
|
|
191
|
+
const canUndo = status?.canUndo ?? false;
|
|
192
|
+
const canRedo = status?.canRedo ?? false;
|
|
193
|
+
if (last.current.canUndo !== canUndo || last.current.canRedo !== canRedo) {
|
|
194
|
+
last.current = { canUndo, canRedo };
|
|
195
|
+
}
|
|
196
|
+
return last.current;
|
|
197
|
+
}, [engine]);
|
|
198
|
+
return useSyncExternalStore2(subscribe, getSnapshot, getSnapshot);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ../react/src/use-tool.ts
|
|
202
|
+
import { useCallback as useCallback3, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
203
|
+
function useTool() {
|
|
204
|
+
const engine = useCanvasEngine();
|
|
205
|
+
const subscribe = useCallback3(
|
|
206
|
+
(onChange) => engine.world.reactive.observeResource(ActiveTool, onChange),
|
|
207
|
+
[engine]
|
|
208
|
+
);
|
|
209
|
+
const getSnapshot = useCallback3(() => engine.world.getResource(ActiveTool)?.id ?? "select", [engine]);
|
|
210
|
+
const active = useSyncExternalStore3(subscribe, getSnapshot, getSnapshot);
|
|
211
|
+
const setTool = useCallback3((id) => engine.ops.setTool(id), [engine]);
|
|
212
|
+
return [active, setTool];
|
|
213
|
+
}
|
|
214
|
+
function useToolState(id) {
|
|
215
|
+
const [active] = useTool();
|
|
216
|
+
return active === id;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ../react/src/canvas-hooks.ts
|
|
220
|
+
import { useCallback as useCallback4, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
221
|
+
function useCurrentCanvas() {
|
|
222
|
+
const engine = useCanvasEngine();
|
|
223
|
+
const subscribe = useCallback4(
|
|
224
|
+
(onChange) => engine.canvas.subscribe(onChange),
|
|
225
|
+
[engine]
|
|
226
|
+
);
|
|
227
|
+
return useSyncExternalStore4(subscribe, engine.canvas.current, engine.canvas.current);
|
|
228
|
+
}
|
|
229
|
+
function useCanvasCatalog() {
|
|
230
|
+
const engine = useCanvasEngine();
|
|
231
|
+
const subscribe = useCallback4(
|
|
232
|
+
(onChange) => engine.canvas.subscribe(onChange),
|
|
233
|
+
[engine]
|
|
234
|
+
);
|
|
235
|
+
return useSyncExternalStore4(subscribe, engine.canvas.catalog, engine.canvas.catalog);
|
|
236
|
+
}
|
|
237
|
+
function useCanvasTools() {
|
|
238
|
+
const engine = useCanvasEngine();
|
|
239
|
+
const subscribe = useCallback4(
|
|
240
|
+
(onChange) => engine.canvas.subscribe(onChange),
|
|
241
|
+
[engine]
|
|
242
|
+
);
|
|
243
|
+
return useSyncExternalStore4(subscribe, engine.canvas.tools, engine.canvas.tools);
|
|
244
|
+
}
|
|
245
|
+
function useCanvasDiagnostics() {
|
|
246
|
+
const engine = useCanvasEngine();
|
|
247
|
+
const subscribe = useCallback4(
|
|
248
|
+
(onChange) => engine.canvas.subscribe(onChange),
|
|
249
|
+
[engine]
|
|
250
|
+
);
|
|
251
|
+
return useSyncExternalStore4(
|
|
252
|
+
subscribe,
|
|
253
|
+
engine.canvas.diagnostics,
|
|
254
|
+
engine.canvas.diagnostics
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
function useFramePreview(frame) {
|
|
258
|
+
const engine = useCanvasEngine();
|
|
259
|
+
const subscribe = useCallback4(
|
|
260
|
+
(onChange) => engine.previews.subscribe(frame, onChange),
|
|
261
|
+
[engine, frame]
|
|
262
|
+
);
|
|
263
|
+
const getSnapshot = useCallback4(() => engine.previews.snapshot(frame), [engine, frame]);
|
|
264
|
+
return useSyncExternalStore4(subscribe, getSnapshot, getSnapshot);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// ../react/src/frame-preview-boundary.tsx
|
|
268
|
+
import {
|
|
269
|
+
Component
|
|
270
|
+
} from "react";
|
|
271
|
+
var FramePreviewBoundary = class extends Component {
|
|
272
|
+
state = { failed: false };
|
|
273
|
+
static getDerivedStateFromError() {
|
|
274
|
+
return { failed: true };
|
|
275
|
+
}
|
|
276
|
+
componentDidCatch(error, info) {
|
|
277
|
+
this.props.onError?.(error, info);
|
|
278
|
+
}
|
|
279
|
+
render() {
|
|
280
|
+
return this.state.failed ? this.props.fallback ?? null : this.props.children;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// ../react/src/use-presence.ts
|
|
285
|
+
import { useCallback as useCallback5, useRef as useRef3, useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
286
|
+
var remotePeersQ = defineQuery([PresencePeer, Not(Local)]);
|
|
287
|
+
function usePresencePeers() {
|
|
288
|
+
const engine = useCanvasEngine();
|
|
289
|
+
const cache = useRef3({ key: "\0", value: [] });
|
|
290
|
+
const subscribe = useCallback5(
|
|
291
|
+
(onChange) => engine.world.reactive.observeQuery(remotePeersQ, onChange),
|
|
292
|
+
[engine]
|
|
293
|
+
);
|
|
294
|
+
const getSnapshot = useCallback5(() => {
|
|
295
|
+
const world = engine.world;
|
|
296
|
+
const ids = [];
|
|
297
|
+
world.query(remotePeersQ).each((b) => {
|
|
298
|
+
for (const r of b) ids.push(b.entity(r));
|
|
299
|
+
});
|
|
300
|
+
const key = ids.join(",");
|
|
301
|
+
if (key !== cache.current.key) {
|
|
302
|
+
cache.current = {
|
|
303
|
+
key,
|
|
304
|
+
value: ids.map((entity) => ({ entity, info: world.get(entity, PresenceInfo) }))
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
return cache.current.value;
|
|
308
|
+
}, [engine]);
|
|
309
|
+
return useSyncExternalStore5(subscribe, getSnapshot, getSnapshot);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// ../react/src/keymap.ts
|
|
313
|
+
var gestureActiveQ = defineQuery([GestureActive]);
|
|
314
|
+
function openOrEnterSelected(engine) {
|
|
315
|
+
const { world } = engine;
|
|
316
|
+
if (heldEntity(world) !== void 0 || trayOpen(world)) return;
|
|
317
|
+
const selected = selectedEntities(world);
|
|
318
|
+
if (selected.length !== 1) return;
|
|
319
|
+
const target = selected[0];
|
|
320
|
+
if (target === void 0 || !world.isAlive(target)) return;
|
|
321
|
+
const typeId = world.get(target, PrefabId)?.id;
|
|
322
|
+
if (typeof typeId === "string" && engine.catalog.widget(typeId)?.openable === true) {
|
|
323
|
+
engine.ops.open(target);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (!world.hasTag(target, Container)) return;
|
|
327
|
+
engine.ops.enterContainer(target);
|
|
328
|
+
}
|
|
329
|
+
function escapeOrExit(engine) {
|
|
330
|
+
const { world } = engine;
|
|
331
|
+
if (trayOpen(world)) {
|
|
332
|
+
closeTray(world);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (heldEntity(world) !== void 0) {
|
|
336
|
+
engine.ops.putDown();
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const gestureLive = world.firstOf(gestureActiveQ) !== void 0;
|
|
340
|
+
if (!gestureLive && currentNavEntry(world) !== void 0) {
|
|
341
|
+
engine.ops.exitContainer();
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
engine.ops.cancelActiveGestures();
|
|
345
|
+
}
|
|
346
|
+
var unlessInert = (run) => (engine) => {
|
|
347
|
+
if (heldEntity(engine.world) === void 0 && !trayOpen(engine.world)) run(engine);
|
|
348
|
+
};
|
|
349
|
+
function heldToolKey(engine, event) {
|
|
350
|
+
const held = heldEntity(engine.world);
|
|
351
|
+
if (held === void 0) return false;
|
|
352
|
+
const typeId = engine.world.get(held, PrefabId)?.id;
|
|
353
|
+
const tools2 = typeof typeId === "string" ? engine.catalog.widget(typeId)?.heldTools ?? [] : [];
|
|
354
|
+
const tool = matchHeldTool(tools2, { key: event.key, mod: event.metaKey || event.ctrlKey, shift: event.shiftKey, alt: event.altKey });
|
|
355
|
+
if (tool === void 0) return false;
|
|
356
|
+
engine.ops.useHeldTool(tool.id);
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
var signature = (key, mod, shift) => `${key.toLowerCase()}|${mod ? 1 : 0}|${shift ? 1 : 0}`;
|
|
360
|
+
function nudgeSelection(engine, dx, dy) {
|
|
361
|
+
const session = engine.docs.current();
|
|
362
|
+
if (session === void 0) return;
|
|
363
|
+
const selection = selectedEntities(engine.world).filter((e) => session.store.keyOf(e) !== void 0 && !engine.world.hasTag(e, Locked));
|
|
364
|
+
if (selection.length === 0) return;
|
|
365
|
+
guardedTransaction(session.store, engine.world, (tx) => {
|
|
366
|
+
for (const e of selection) {
|
|
367
|
+
const p = engine.world.get(e, Position);
|
|
368
|
+
if (p === void 0) continue;
|
|
369
|
+
tx.edit(e).set(Position, { x: p.x + dx, y: p.y + dy });
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
var ARROWS = [
|
|
374
|
+
["ArrowLeft", -1, 0],
|
|
375
|
+
["ArrowRight", 1, 0],
|
|
376
|
+
["ArrowUp", 0, -1],
|
|
377
|
+
["ArrowDown", 0, 1]
|
|
378
|
+
];
|
|
379
|
+
function toggleTape(engine) {
|
|
380
|
+
const selection = selectedEntities(engine.world);
|
|
381
|
+
if (selection.length === 0) return;
|
|
382
|
+
engine.ops.setLocked(selection, !selection.every((e) => engine.world.hasTag(e, Locked)));
|
|
383
|
+
}
|
|
384
|
+
function defaultEntries() {
|
|
385
|
+
const entries = [
|
|
386
|
+
{ key: "Backspace", run: unlessInert((e) => e.ops.deleteSelection()) },
|
|
387
|
+
{ key: "Delete", run: unlessInert((e) => e.ops.deleteSelection()) },
|
|
388
|
+
{ key: "z", mod: true, run: (e) => e.docs.undo() },
|
|
389
|
+
{ key: "z", mod: true, shift: true, run: (e) => e.docs.redo() },
|
|
390
|
+
{ key: "d", mod: true, run: unlessInert((e) => e.ops.duplicateSelection()) },
|
|
391
|
+
{ key: "a", mod: true, run: unlessInert((e) => e.ops.selectAll()) },
|
|
392
|
+
// design-015 §8 · §9 (D2b, D4b): ⏎ with ONE selected picks an openable object up, or flies into a container; Esc puts
|
|
393
|
+
// the held object down, else cancels a live gesture as ever, and with none to cancel flies back out of the current frame.
|
|
394
|
+
{ key: "Enter", run: (e) => openOrEnterSelected(e) },
|
|
395
|
+
{ key: "Escape", run: (e) => escapeOrExit(e) },
|
|
396
|
+
{ key: "l", mod: true, shift: true, run: unlessInert(toggleTape) }
|
|
397
|
+
];
|
|
398
|
+
for (const [key, dx, dy] of ARROWS) {
|
|
399
|
+
entries.push({ key, run: unlessInert((e) => nudgeSelection(e, dx, dy)) });
|
|
400
|
+
entries.push({ key, shift: true, run: unlessInert((e) => nudgeSelection(e, dx * 10, dy * 10)) });
|
|
401
|
+
}
|
|
402
|
+
const byLetter = /* @__PURE__ */ new Map();
|
|
403
|
+
for (const tool of tools.all()) {
|
|
404
|
+
if (tool.shortcut === void 0) continue;
|
|
405
|
+
byLetter.set(tool.shortcut, [...byLetter.get(tool.shortcut) ?? [], tool.id]);
|
|
406
|
+
}
|
|
407
|
+
for (const [key, ids] of byLetter) {
|
|
408
|
+
entries.push({
|
|
409
|
+
key,
|
|
410
|
+
run: (e) => {
|
|
411
|
+
const legal = e.canvas.tools();
|
|
412
|
+
const id = ids.find((t) => legal.some((tool) => tool.id === t));
|
|
413
|
+
if (id !== void 0) e.ops.setTool(id);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
return entries;
|
|
418
|
+
}
|
|
419
|
+
function resolveTarget(target) {
|
|
420
|
+
if (target !== void 0) return target;
|
|
421
|
+
return typeof window !== "undefined" ? window : void 0;
|
|
422
|
+
}
|
|
423
|
+
function attachKeymap(engine, target, overrides = []) {
|
|
424
|
+
const el = resolveTarget(target);
|
|
425
|
+
if (el === void 0) return () => {
|
|
426
|
+
};
|
|
427
|
+
const map = /* @__PURE__ */ new Map();
|
|
428
|
+
for (const entry of defaultEntries()) map.set(signature(entry.key, entry.mod, entry.shift), entry);
|
|
429
|
+
for (const entry of overrides) {
|
|
430
|
+
if (entry.key === " ") {
|
|
431
|
+
console.warn(
|
|
432
|
+
"ice: attachKeymap \u2014 an override on Space can never fire: the pointer adapter owns Space as the pan modifier (design-003 \xA74.4) and preventDefaults it before the keymap's handled-by-content gate."
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
map.set(signature(entry.key, entry.mod, entry.shift), entry);
|
|
436
|
+
}
|
|
437
|
+
const onKeyDown = (event) => {
|
|
438
|
+
if (event.defaultPrevented) return;
|
|
439
|
+
const claim = keyboardClaimOf(event.target);
|
|
440
|
+
if (claim.claimed) {
|
|
441
|
+
if (event.key === "Escape" && !claim.ownsEscape) {
|
|
442
|
+
event.preventDefault();
|
|
443
|
+
const t = event.target;
|
|
444
|
+
if (t instanceof HTMLElement || t instanceof SVGElement) t.blur();
|
|
445
|
+
}
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (isEditableTarget(event.target)) return;
|
|
449
|
+
if (heldToolKey(engine, event)) {
|
|
450
|
+
event.preventDefault();
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const mod = event.metaKey || event.ctrlKey;
|
|
454
|
+
const entry = map.get(signature(event.key, mod, event.shiftKey));
|
|
455
|
+
if (entry === void 0) return;
|
|
456
|
+
event.preventDefault();
|
|
457
|
+
entry.run(engine);
|
|
458
|
+
};
|
|
459
|
+
el.addEventListener("keydown", onKeyDown);
|
|
460
|
+
return () => el.removeEventListener("keydown", onKeyDown);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// ../react/src/selection-menu.tsx
|
|
464
|
+
import { useEffect as useEffect2, useLayoutEffect, useMemo as useMemo2, useRef as useRef4, useState } from "react";
|
|
465
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
466
|
+
var SELECTION_MENU = { height: 40, gap: 10, margin: 16, edge: 8, awayMs: 90, backMs: 200, inMs: 180, outMs: 120, foot: 72, travelMs: 340 };
|
|
467
|
+
var clamp = (x, a, b) => Math.min(Math.max(x, a), Math.max(a, b));
|
|
468
|
+
function placeSelectionMenu(anchor, size, sheet = 0) {
|
|
469
|
+
const M = SELECTION_MENU;
|
|
470
|
+
const { width: W, height: H } = anchor.view;
|
|
471
|
+
if (anchor.held !== void 0 && !anchor.held.landing) {
|
|
472
|
+
return { x: clamp(W / 2 - size.w / 2, M.margin, W - size.w - M.margin), y: H - M.foot + (M.foot - size.h) / 2, below: false };
|
|
473
|
+
}
|
|
474
|
+
const b = anchor.box;
|
|
475
|
+
if (b === null || anchor.count === 0) return null;
|
|
476
|
+
let x = (b.x0 + b.x1) / 2 - size.w / 2;
|
|
477
|
+
let y = b.y0 - M.gap - size.h;
|
|
478
|
+
const top = anchor.rulers !== null ? anchor.rulers.margin + anchor.rulers.band + M.edge : M.edge;
|
|
479
|
+
const yBelow = b.y1 + M.gap;
|
|
480
|
+
const roomAbove = y - sheet - top;
|
|
481
|
+
const roomBelow = H - M.edge - (yBelow + size.h + sheet);
|
|
482
|
+
let below = false;
|
|
483
|
+
if (roomAbove < 0 && roomBelow > roomAbove) {
|
|
484
|
+
y = yBelow;
|
|
485
|
+
below = true;
|
|
486
|
+
}
|
|
487
|
+
x = clamp(x, M.margin, W - size.w - M.margin);
|
|
488
|
+
y = clamp(y, M.edge, H - size.h - M.edge);
|
|
489
|
+
return { x, y, below };
|
|
490
|
+
}
|
|
491
|
+
var stroke = (children) => /* @__PURE__ */ jsx2("g", { fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children });
|
|
492
|
+
var SELECTION_GLYPHS = {
|
|
493
|
+
agents: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
494
|
+
/* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "3" }),
|
|
495
|
+
/* @__PURE__ */ jsx2("circle", { cx: "12", cy: "4.5", r: "2" }),
|
|
496
|
+
/* @__PURE__ */ jsx2("circle", { cx: "5.5", cy: "15.75", r: "2" }),
|
|
497
|
+
/* @__PURE__ */ jsx2("circle", { cx: "18.5", cy: "15.75", r: "2" })
|
|
498
|
+
] })),
|
|
499
|
+
chevron: stroke(/* @__PURE__ */ jsx2("path", { d: "M9.5 6l6 6-6 6" })),
|
|
500
|
+
trash: stroke(/* @__PURE__ */ jsx2("path", { d: "M4.5 6.5h15M9.5 6.5V5a1.5 1.5 0 0 1 1.5-1.5h2A1.5 1.5 0 0 1 14.5 5v1.5M6.5 6.5l.9 12.2a2 2 0 0 0 2 1.8h5.2a2 2 0 0 0 2-1.8l.9-12.2M10 10.5v6M14 10.5v6" })),
|
|
501
|
+
duplicate: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
502
|
+
/* @__PURE__ */ jsx2("rect", { x: "8.5", y: "8.5", width: "12", height: "12", rx: "3" }),
|
|
503
|
+
/* @__PURE__ */ jsx2("path", { d: "M15.5 8.5V6.5a3 3 0 0 0-3-3h-6a3 3 0 0 0-3 3v6a3 3 0 0 0 3 3h2" })
|
|
504
|
+
] })),
|
|
505
|
+
lock: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
506
|
+
/* @__PURE__ */ jsx2("rect", { x: "4.5", y: "10.5", width: "15", height: "10", rx: "3" }),
|
|
507
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 10.5V8a4 4 0 0 1 8 0v2.5M12 14.5v2" })
|
|
508
|
+
] })),
|
|
509
|
+
unlock: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
510
|
+
/* @__PURE__ */ jsx2("rect", { x: "4.5", y: "10.5", width: "15", height: "10", rx: "3" }),
|
|
511
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 10.5V8a4 4 0 0 1 7.7-1.5M12 14.5v2" })
|
|
512
|
+
] })),
|
|
513
|
+
ellipsis: /* @__PURE__ */ jsx2("path", { fill: "currentColor", fillRule: "evenodd", d: "M3.7 10.4h1.9a0.7 0.7 0 0 1 0.7 0.7v1.9a0.7 0.7 0 0 1 -0.7 0.7h-1.9a0.7 0.7 0 0 1 -0.7 -0.7v-1.9a0.7 0.7 0 0 1 0.7 -0.7ZM11.05 10.4h1.9a0.7 0.7 0 0 1 0.7 0.7v1.9a0.7 0.7 0 0 1 -0.7 0.7h-1.9a0.7 0.7 0 0 1 -0.7 -0.7v-1.9a0.7 0.7 0 0 1 0.7 -0.7ZM18.4 10.4h1.9a0.7 0.7 0 0 1 0.7 0.7v1.9a0.7 0.7 0 0 1 -0.7 0.7h-1.9a0.7 0.7 0 0 1 -0.7 -0.7v-1.9a0.7 0.7 0 0 1 0.7 -0.7Z" }),
|
|
514
|
+
// the held bar's (design-015 §8, D4b): the kinds' declared tools and Done — the same 24-box, one 2-unit stroke
|
|
515
|
+
"chevron-left": stroke(/* @__PURE__ */ jsx2("path", { d: "M14.5 6l-6 6 6 6" })),
|
|
516
|
+
pen: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
517
|
+
/* @__PURE__ */ jsx2("path", { d: "M5 19l1.2-4.2L15.6 5.4a2 2 0 0 1 2.8 0l.2.2a2 2 0 0 1 0 2.8L9.2 17.8z" }),
|
|
518
|
+
/* @__PURE__ */ jsx2("path", { d: "M13.5 7.5l3 3" })
|
|
519
|
+
] })),
|
|
520
|
+
eraser: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
521
|
+
/* @__PURE__ */ jsx2("path", { d: "M4.5 15.5l7-7a2 2 0 0 1 2.8 0l4.2 4.2a2 2 0 0 1 0 2.8l-4 4H9.3l-4.8-4z" }),
|
|
522
|
+
/* @__PURE__ */ jsx2("path", { d: "M9 19.5h11" })
|
|
523
|
+
] })),
|
|
524
|
+
undo: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
525
|
+
/* @__PURE__ */ jsx2("path", { d: "M8.5 7.5H15a4.5 4.5 0 0 1 0 9H7" }),
|
|
526
|
+
/* @__PURE__ */ jsx2("path", { d: "M11 4.5l-3.5 3 3.5 3" })
|
|
527
|
+
] })),
|
|
528
|
+
redo: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
529
|
+
/* @__PURE__ */ jsx2("path", { d: "M15.5 7.5H9a4.5 4.5 0 0 0 0 9h8" }),
|
|
530
|
+
/* @__PURE__ */ jsx2("path", { d: "M13 4.5l3.5 3-3.5 3" })
|
|
531
|
+
] })),
|
|
532
|
+
today: stroke(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
533
|
+
/* @__PURE__ */ jsx2("rect", { x: "4.5", y: "6", width: "15", height: "13.5", rx: "2.5" }),
|
|
534
|
+
/* @__PURE__ */ jsx2("path", { d: "M4.5 10.5h15M8.5 4v3.5M15.5 4v3.5" }),
|
|
535
|
+
/* @__PURE__ */ jsx2("circle", { cx: "12", cy: "15", r: "1.4" })
|
|
536
|
+
] })),
|
|
537
|
+
check: stroke(/* @__PURE__ */ jsx2("path", { d: "M5 12.5l4.5 4.5L19 7.5" }))
|
|
538
|
+
};
|
|
539
|
+
function Glyph({ glyph, size = 16 }) {
|
|
540
|
+
const body = typeof glyph === "string" ? SELECTION_GLYPHS[glyph] : glyph;
|
|
541
|
+
return /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", width: size, height: size, "aria-hidden": "true", focusable: "false", children: body });
|
|
542
|
+
}
|
|
543
|
+
var isDrawing = (g) => typeof g === "object" && g !== null && typeof g.path === "string";
|
|
544
|
+
var drawn = (g) => g.fill === true ? /* @__PURE__ */ jsx2("path", { fill: "currentColor", fillRule: "evenodd", d: g.path }) : stroke(/* @__PURE__ */ jsx2("path", { d: g.path }));
|
|
545
|
+
var initial = (label) => /* @__PURE__ */ jsx2("text", { x: "12", y: "16.5", textAnchor: "middle", fontSize: "13", fontWeight: "600", fill: "currentColor", children: (label.trim()[0] ?? "?").toUpperCase() });
|
|
546
|
+
var missingSaid = /* @__PURE__ */ new Set();
|
|
547
|
+
function actGlyph(k) {
|
|
548
|
+
return toolGlyph({ id: k.id, label: k.label, ...k.glyph !== void 0 ? { glyph: k.glyph } : {} }).node;
|
|
549
|
+
}
|
|
550
|
+
function toolGlyph(t) {
|
|
551
|
+
const g = t.glyph;
|
|
552
|
+
if (isDrawing(g)) return { node: drawn(g), missing: void 0 };
|
|
553
|
+
if (typeof g === "string" && g in SELECTION_GLYPHS) return { node: SELECTION_GLYPHS[g], missing: void 0 };
|
|
554
|
+
if (typeof g === "string" && !missingSaid.has(g)) {
|
|
555
|
+
missingSaid.add(g);
|
|
556
|
+
console.error(`[ice] the held tool "${t.id}" names the glyph "${g}", which the bar does not draw \u2014 declare its drawing (\`glyph: { path }\`) or a name of SELECTION_GLYPHS`);
|
|
557
|
+
}
|
|
558
|
+
return { node: initial(t.label), missing: typeof g === "string" ? g : void 0 };
|
|
559
|
+
}
|
|
560
|
+
function defaultSelectionActions() {
|
|
561
|
+
return [
|
|
562
|
+
{ id: "duplicate", label: "Duplicate", glyph: "duplicate", keys: "\u2318D", when: (s) => !s.locked, run: (e) => {
|
|
563
|
+
e.ops.duplicateSelection();
|
|
564
|
+
} },
|
|
565
|
+
{
|
|
566
|
+
id: "tape",
|
|
567
|
+
label: (s) => s.locked ? "Lift the tape" : "Tape it down",
|
|
568
|
+
glyph: (s) => s.locked ? "unlock" : "lock",
|
|
569
|
+
keys: "\u21E7\u2318L",
|
|
570
|
+
on: (s) => s.locked,
|
|
571
|
+
run: (e, s) => {
|
|
572
|
+
e.ops.setLocked(selectedEntities(e.world), !s.locked);
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
{ id: "more", label: "More", glyph: "ellipsis", run: () => {
|
|
576
|
+
} },
|
|
577
|
+
{ id: "delete", label: "Delete", glyph: "trash", keys: "\u232B", place: "end", tone: "danger", run: (e) => {
|
|
578
|
+
e.ops.deleteSelection();
|
|
579
|
+
} }
|
|
580
|
+
];
|
|
581
|
+
}
|
|
582
|
+
var labelOf = (a, s) => typeof a.label === "function" ? a.label(s) : a.label;
|
|
583
|
+
var glyphOf = (a, s) => typeof a.glyph === "function" ? a.glyph(s) : a.glyph;
|
|
584
|
+
var DESK_INK = "--ice-menu-ink:rgb(16 9 4 / .94);--ice-menu-ink-solid:rgb(16 9 4);--ice-menu-cream:rgb(255 237 215);--ice-menu-cream-rgb:255 237 215;--ice-menu-brass:rgb(196 165 116);--ice-menu-hair:rgb(196 165 116 / .24);--ice-menu-rule:rgb(196 165 116 / .34);--ice-menu-danger:rgb(255 69 58);--ice-menu-danger-bg:rgb(255 69 58 / .16);--ice-menu-shadow:-1px 2px 3px rgb(14 26 10 / .25),-8px 14px 32px rgb(14 26 10 / .38)";
|
|
585
|
+
var STYLE = `
|
|
586
|
+
[data-ice-selection-menu]{${DESK_INK};position:absolute;left:0;top:0;z-index:20;will-change:transform,opacity;font:500 12.5px/1 var(--ice-menu-font,system-ui,-apple-system,sans-serif);user-select:none}
|
|
587
|
+
[data-ice-selection-menu] .ice-sm-bar{position:relative;display:flex;align-items:center;gap:2px;height:40px;padding:4px;box-sizing:border-box;white-space:nowrap;border-radius:20px;background:var(--ice-menu-ink);color:var(--ice-menu-cream);box-shadow:inset 0 0 0 1px var(--ice-menu-hair),var(--ice-menu-shadow)}
|
|
588
|
+
[data-ice-selection-menu] button{appearance:none;border:0;margin:0;padding:0;background:none;color:inherit;font:inherit;cursor:pointer}
|
|
589
|
+
[data-ice-selection-menu] .ice-sm-btn{width:32px;height:32px;border-radius:16px;display:grid;place-items:center;color:rgb(var(--ice-menu-cream-rgb) / .86);transition:background 120ms ease,color 120ms ease,transform 120ms ease}
|
|
590
|
+
[data-ice-selection-menu] .ice-sm-btn:hover{background:rgb(var(--ice-menu-cream-rgb) / .09);color:var(--ice-menu-cream)}
|
|
591
|
+
[data-ice-selection-menu] .ice-sm-btn:active{transform:scale(.95);background:rgb(var(--ice-menu-cream-rgb) / .15)}
|
|
592
|
+
[data-ice-selection-menu] .ice-sm-btn[data-on="true"]{background:var(--ice-menu-cream);color:var(--ice-menu-ink-solid)}
|
|
593
|
+
[data-ice-selection-menu] .ice-sm-btn[data-tone="danger"]:hover{color:var(--ice-menu-danger);background:var(--ice-menu-danger-bg)}
|
|
594
|
+
[data-ice-selection-menu] .ice-sm-text{height:32px;padding:0 9px;border-radius:16px;display:inline-flex;align-items:center;gap:7px;color:var(--ice-menu-cream);background:rgb(var(--ice-menu-cream-rgb) / .08);transition:background 120ms ease,transform 120ms ease}
|
|
595
|
+
[data-ice-selection-menu] .ice-sm-text:hover{background:rgb(var(--ice-menu-cream-rgb) / .15)}
|
|
596
|
+
[data-ice-selection-menu] .ice-sm-text:active{transform:scale(.97)}
|
|
597
|
+
[data-ice-selection-menu] .ice-sm-text svg:last-child{transform:rotate(-90deg);opacity:.55;margin-left:-1px;transition:transform 240ms cubic-bezier(.25,1,.3,1)}
|
|
598
|
+
[data-ice-selection-menu][data-below="true"] .ice-sm-text svg:last-child{transform:rotate(90deg)}
|
|
599
|
+
[data-ice-selection-menu] .ice-sm-rule{flex:none;width:0;height:22px;margin:0 4px;border-left:1px dashed var(--ice-menu-rule)}
|
|
600
|
+
[data-ice-selection-menu] .ice-sm-sheet{position:absolute;left:0;min-width:208px;padding:6px;box-sizing:border-box;border-radius:14px;background:var(--ice-menu-ink);color:var(--ice-menu-cream);box-shadow:inset 0 0 0 1px var(--ice-menu-hair),var(--ice-menu-shadow)}
|
|
601
|
+
[data-ice-selection-menu] .ice-sm-item{display:flex;width:100%;align-items:center;justify-content:space-between;gap:16px;padding:8px 10px;border-radius:8px;text-align:left}
|
|
602
|
+
[data-ice-selection-menu] .ice-sm-item:hover{background:rgb(var(--ice-menu-cream-rgb) / .09)}
|
|
603
|
+
[data-ice-selection-menu] .ice-sm-item[data-tone="danger"]:hover{color:var(--ice-menu-danger);background:var(--ice-menu-danger-bg)}
|
|
604
|
+
[data-ice-selection-menu] .ice-sm-item kbd{font:500 11px/1 var(--ice-menu-mono,ui-monospace,monospace);color:var(--ice-menu-brass)}
|
|
605
|
+
[data-ice-selection-menu] .ice-sm-btn.is-dim{color:rgb(var(--ice-menu-cream-rgb) / .38);cursor:default}
|
|
606
|
+
[data-ice-selection-menu] .ice-sm-btn.is-dim:hover{background:none;color:rgb(var(--ice-menu-cream-rgb) / .38)}
|
|
607
|
+
[data-ice-selection-menu] .ice-sm-btn.is-dim:active{transform:none;background:none}
|
|
608
|
+
[data-ice-selection-menu][data-held="true"] .ice-sm-text svg:last-child{display:none}
|
|
609
|
+
[data-ice-selection-menu] .ice-sm-ink{width:28px;height:32px;border-radius:14px;display:grid;place-items:center}
|
|
610
|
+
[data-ice-selection-menu] .ice-sm-ink i{width:12px;height:12px;border-radius:50%;box-shadow:inset 0 0 0 1px rgb(255 255 255 / .16);transition:transform 160ms cubic-bezier(.3,1.4,.5,1),box-shadow 160ms ease}
|
|
611
|
+
[data-ice-selection-menu] .ice-sm-ink:hover i{transform:scale(1.18)}
|
|
612
|
+
[data-ice-selection-menu] .ice-sm-ink[data-on="true"] i{box-shadow:0 0 0 2px var(--ice-menu-ink-solid),0 0 0 3.5px var(--ice-menu-cream)}
|
|
613
|
+
`;
|
|
614
|
+
var shownOf = (a) => {
|
|
615
|
+
const held = a.held !== void 0 && !a.held.landing;
|
|
616
|
+
const landing = a.held?.landing === true;
|
|
617
|
+
const tools2 = held ? (a.held?.tools ?? []).map((t) => `${t.id}:${t.kind ?? ""}:${t.swatch ?? ""}`).join("|") : "";
|
|
618
|
+
const menu = (a.menu ?? []).map((m) => `${m.id}:${m.label}`).join("|");
|
|
619
|
+
return { count: a.count, locked: a.locked, visible: a.count > 0 && a.box !== null || held, gesturing: a.gesturing || a.editing === true || landing, held, tools: tools2, active: held ? a.held?.active ?? "" : "", menu };
|
|
620
|
+
};
|
|
621
|
+
var sameShown = (a, b) => a.count === b.count && a.locked === b.locked && a.visible === b.visible && a.gesturing === b.gesturing && a.held === b.held && a.tools === b.tools && a.active === b.active && a.menu === b.menu;
|
|
622
|
+
var transitionOf = (away, visible, traveling) => {
|
|
623
|
+
const M = SELECTION_MENU;
|
|
624
|
+
const opacity = away ? `opacity ${M.awayMs}ms ease-out` : visible ? `opacity ${M.inMs}ms ease-out` : `opacity ${M.outMs}ms ease-out, visibility 0s linear ${M.outMs}ms`;
|
|
625
|
+
return traveling ? `${opacity}, transform ${M.travelMs}ms cubic-bezier(.25,1,.3,1)` : opacity;
|
|
626
|
+
};
|
|
627
|
+
function SelectionMenu({ source, actions, engine: given }) {
|
|
628
|
+
const provided = useOptionalEngine();
|
|
629
|
+
const engine = given ?? provided;
|
|
630
|
+
const acts = useMemo2(() => actions ?? defaultSelectionActions(), [actions]);
|
|
631
|
+
const root = useRef4(null);
|
|
632
|
+
const [shown, setShown] = useState(() => shownOf(source.anchor()));
|
|
633
|
+
const [away, setAway] = useState(false);
|
|
634
|
+
const [open, setOpen] = useState(false);
|
|
635
|
+
const [below, setBelow] = useState(false);
|
|
636
|
+
const [traveling, setTraveling] = useState(false);
|
|
637
|
+
const tools2 = useRef4(source.anchor().held?.tools ?? []);
|
|
638
|
+
const kindActs = useRef4(source.anchor().menu ?? []);
|
|
639
|
+
const heldRef = useRef4(shown.held);
|
|
640
|
+
const travelTimer = useRef4(null);
|
|
641
|
+
const placeRef = useRef4(() => {
|
|
642
|
+
});
|
|
643
|
+
placeRef.current = () => {
|
|
644
|
+
const el = root.current;
|
|
645
|
+
const a = source.anchor();
|
|
646
|
+
const next = shownOf(a);
|
|
647
|
+
if (next.held) tools2.current = a.held?.tools ?? [];
|
|
648
|
+
kindActs.current = a.menu ?? [];
|
|
649
|
+
setShown((prev) => sameShown(prev, next) ? prev : next);
|
|
650
|
+
if (el === null) return;
|
|
651
|
+
if (next.held !== heldRef.current) {
|
|
652
|
+
heldRef.current = next.held;
|
|
653
|
+
el.style.transition = transitionOf(away, next.visible, true);
|
|
654
|
+
setTraveling(true);
|
|
655
|
+
if (travelTimer.current !== null) clearTimeout(travelTimer.current);
|
|
656
|
+
travelTimer.current = setTimeout(() => {
|
|
657
|
+
travelTimer.current = null;
|
|
658
|
+
setTraveling(false);
|
|
659
|
+
}, SELECTION_MENU.travelMs);
|
|
660
|
+
}
|
|
661
|
+
const bar = el.firstElementChild;
|
|
662
|
+
const sheet = el.querySelector(".ice-sm-sheet");
|
|
663
|
+
const p = placeSelectionMenu(a, { w: bar?.offsetWidth ?? 0, h: bar?.offsetHeight || SELECTION_MENU.height }, sheet?.offsetHeight ?? 0);
|
|
664
|
+
if (p === null) return;
|
|
665
|
+
el.style.transform = `translate(${p.x.toFixed(1)}px, ${p.y.toFixed(1)}px)`;
|
|
666
|
+
el.dataset.below = String(p.below);
|
|
667
|
+
setBelow((prev) => prev === p.below ? prev : p.below);
|
|
668
|
+
};
|
|
669
|
+
useEffect2(() => () => {
|
|
670
|
+
if (travelTimer.current !== null) clearTimeout(travelTimer.current);
|
|
671
|
+
}, []);
|
|
672
|
+
useLayoutEffect(() => {
|
|
673
|
+
const run = () => placeRef.current();
|
|
674
|
+
run();
|
|
675
|
+
return source.subscribe(run);
|
|
676
|
+
}, [source]);
|
|
677
|
+
useLayoutEffect(() => {
|
|
678
|
+
placeRef.current();
|
|
679
|
+
}, [shown.count, shown.locked, shown.visible, shown.held, shown.tools, shown.menu, open]);
|
|
680
|
+
useEffect2(() => {
|
|
681
|
+
if (shown.gesturing) {
|
|
682
|
+
setAway(true);
|
|
683
|
+
setOpen(false);
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
const t = setTimeout(() => setAway(false), SELECTION_MENU.backMs);
|
|
687
|
+
return () => clearTimeout(t);
|
|
688
|
+
}, [shown.gesturing]);
|
|
689
|
+
useEffect2(() => {
|
|
690
|
+
setOpen(false);
|
|
691
|
+
}, [shown.count]);
|
|
692
|
+
if (engine === void 0) return null;
|
|
693
|
+
const state = { count: shown.count, locked: shown.locked };
|
|
694
|
+
const visible = shown.visible;
|
|
695
|
+
const kinds = kindActs.current.map((k) => ({
|
|
696
|
+
id: `kind.${k.id}`,
|
|
697
|
+
label: k.label,
|
|
698
|
+
glyph: actGlyph(k),
|
|
699
|
+
...k.keys !== void 0 ? { keys: k.keys } : {},
|
|
700
|
+
run: (e) => {
|
|
701
|
+
e.ops.runMenuAction(k.id);
|
|
702
|
+
}
|
|
703
|
+
}));
|
|
704
|
+
const listed = [...kinds, ...acts].filter((a) => a.when === void 0 || a.when(state));
|
|
705
|
+
const at = (place) => listed.filter((a) => (a.place ?? "main") === place);
|
|
706
|
+
const button = (a) => {
|
|
707
|
+
const label = labelOf(a, state);
|
|
708
|
+
const tip = a.keys !== void 0 ? `${label} (${a.keys})` : label;
|
|
709
|
+
const run = () => {
|
|
710
|
+
if (a.id === "more") {
|
|
711
|
+
setOpen((o) => !o);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
setOpen(false);
|
|
715
|
+
a.run(engine, state);
|
|
716
|
+
};
|
|
717
|
+
if (a.text === true) {
|
|
718
|
+
return /* @__PURE__ */ jsxs("button", { type: "button", className: "ice-sm-text", "data-act": a.id, "aria-label": label, title: tip, onClick: run, children: [
|
|
719
|
+
/* @__PURE__ */ jsx2(Glyph, { glyph: glyphOf(a, state) }),
|
|
720
|
+
/* @__PURE__ */ jsx2("span", { children: label }),
|
|
721
|
+
/* @__PURE__ */ jsx2(Glyph, { glyph: "chevron", size: 12 })
|
|
722
|
+
] }, a.id);
|
|
723
|
+
}
|
|
724
|
+
return /* @__PURE__ */ jsx2("button", { type: "button", className: "ice-sm-btn", "data-act": a.id, "data-on": a.on?.(state) === true ? "true" : void 0, "data-tone": a.tone, "data-glyph": typeof glyphOf(a, state) === "string" ? glyphOf(a, state) : void 0, "aria-label": label, title: tip, "aria-haspopup": a.id === "more" ? "menu" : void 0, "aria-expanded": a.id === "more" ? open : void 0, onClick: run, children: /* @__PURE__ */ jsx2(Glyph, { glyph: glyphOf(a, state) }) }, a.id);
|
|
725
|
+
};
|
|
726
|
+
const lead = at("lead");
|
|
727
|
+
const main = at("main");
|
|
728
|
+
const end = at("end");
|
|
729
|
+
const opacity = visible && !away ? 1 : 0;
|
|
730
|
+
const slot = (t) => {
|
|
731
|
+
const tip = t.hint !== void 0 ? `${t.label} (${t.hint})` : t.label;
|
|
732
|
+
const g = toolGlyph(t);
|
|
733
|
+
const glyph = /* @__PURE__ */ jsx2(Glyph, { glyph: g.node });
|
|
734
|
+
if (t.kind === void 0) {
|
|
735
|
+
return /* @__PURE__ */ jsx2("button", { type: "button", className: "ice-sm-btn is-dim", "data-tool": t.id, "data-glyph-missing": g.missing, "aria-label": t.label, "aria-disabled": "true", title: tip, tabIndex: -1, children: glyph }, t.id);
|
|
736
|
+
}
|
|
737
|
+
const on = t.kind === "mode" && t.id === shown.active;
|
|
738
|
+
return /* @__PURE__ */ jsx2(
|
|
739
|
+
"button",
|
|
740
|
+
{
|
|
741
|
+
type: "button",
|
|
742
|
+
className: t.swatch !== void 0 ? "ice-sm-ink" : "ice-sm-btn",
|
|
743
|
+
"data-tool": t.id,
|
|
744
|
+
"data-kind": t.kind,
|
|
745
|
+
"data-glyph-missing": g.missing,
|
|
746
|
+
"data-on": on ? "true" : void 0,
|
|
747
|
+
"aria-pressed": t.kind === "mode" ? on : void 0,
|
|
748
|
+
"aria-label": t.label,
|
|
749
|
+
title: tip,
|
|
750
|
+
onClick: () => {
|
|
751
|
+
setOpen(false);
|
|
752
|
+
engine.ops.useHeldTool(t.id);
|
|
753
|
+
},
|
|
754
|
+
children: t.swatch !== void 0 ? /* @__PURE__ */ jsx2("i", { style: { background: t.swatch } }) : glyph
|
|
755
|
+
},
|
|
756
|
+
t.id
|
|
757
|
+
);
|
|
758
|
+
};
|
|
759
|
+
const done = /* @__PURE__ */ jsxs("button", { type: "button", className: "ice-sm-text", "data-act": "done", "aria-label": "Done", title: "Done (Esc)", onClick: () => {
|
|
760
|
+
setOpen(false);
|
|
761
|
+
engine.ops.putDown();
|
|
762
|
+
}, children: [
|
|
763
|
+
/* @__PURE__ */ jsx2(Glyph, { glyph: "check" }),
|
|
764
|
+
/* @__PURE__ */ jsx2("span", { children: "Done" })
|
|
765
|
+
] }, "done");
|
|
766
|
+
return /* @__PURE__ */ jsxs(
|
|
767
|
+
"div",
|
|
768
|
+
{
|
|
769
|
+
ref: root,
|
|
770
|
+
"data-ice-selection-menu": "",
|
|
771
|
+
"data-canvas-interactive": "",
|
|
772
|
+
"data-away": String(away),
|
|
773
|
+
"data-visible": String(visible),
|
|
774
|
+
"data-held": String(shown.held),
|
|
775
|
+
role: "toolbar",
|
|
776
|
+
"aria-label": shown.held ? "In hand" : "Selection",
|
|
777
|
+
"aria-hidden": !visible,
|
|
778
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
779
|
+
style: {
|
|
780
|
+
opacity,
|
|
781
|
+
visibility: visible ? "visible" : "hidden",
|
|
782
|
+
pointerEvents: opacity === 1 ? "auto" : "none",
|
|
783
|
+
transition: transitionOf(away, visible, traveling)
|
|
784
|
+
},
|
|
785
|
+
children: [
|
|
786
|
+
/* @__PURE__ */ jsx2("div", { className: "ice-sm-bar", children: shown.held ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
787
|
+
lead.map(button),
|
|
788
|
+
lead.length > 0 ? /* @__PURE__ */ jsx2("span", { className: "ice-sm-rule", "aria-hidden": "true" }) : null,
|
|
789
|
+
tools2.current.map(slot),
|
|
790
|
+
tools2.current.length > 0 ? /* @__PURE__ */ jsx2("span", { className: "ice-sm-rule", "aria-hidden": "true" }) : null,
|
|
791
|
+
done
|
|
792
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
793
|
+
lead.map(button),
|
|
794
|
+
lead.length > 0 && main.length > 0 ? /* @__PURE__ */ jsx2("span", { className: "ice-sm-rule", "aria-hidden": "true" }) : null,
|
|
795
|
+
main.map(button),
|
|
796
|
+
end.length > 0 && lead.length + main.length > 0 ? /* @__PURE__ */ jsx2("span", { className: "ice-sm-rule", "aria-hidden": "true" }) : null,
|
|
797
|
+
end.map(button)
|
|
798
|
+
] }) }),
|
|
799
|
+
open && !shown.held ? /* @__PURE__ */ jsx2("div", { className: "ice-sm-sheet", role: "menu", style: below ? { top: "calc(100% + 6px)" } : { bottom: "calc(100% + 6px)" }, children: listed.filter((a) => a.id !== "more").map((a) => /* @__PURE__ */ jsxs("button", { type: "button", role: "menuitem", className: "ice-sm-item", "data-act": a.id, "data-tone": a.tone, onClick: () => {
|
|
800
|
+
setOpen(false);
|
|
801
|
+
a.run(engine, state);
|
|
802
|
+
}, children: [
|
|
803
|
+
/* @__PURE__ */ jsx2("span", { children: labelOf(a, state) }),
|
|
804
|
+
a.keys !== void 0 ? /* @__PURE__ */ jsx2("kbd", { children: a.keys }) : null
|
|
805
|
+
] }, a.id)) }) : null,
|
|
806
|
+
/* @__PURE__ */ jsx2("style", { children: STYLE })
|
|
807
|
+
]
|
|
808
|
+
}
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
function useOptionalEngine() {
|
|
812
|
+
try {
|
|
813
|
+
return useCanvasEngine();
|
|
814
|
+
} catch {
|
|
815
|
+
return void 0;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
function selectionTaped(engine) {
|
|
819
|
+
const sel = selectedEntities(engine.world);
|
|
820
|
+
return sel.length > 0 && sel.every((e) => engine.world.hasTag(e, Locked));
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// ../react/src/tray-bar.tsx
|
|
824
|
+
import { useEffect as useEffect3, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState2 } from "react";
|
|
825
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
826
|
+
var TRAY_BAR = { height: 40, foot: 16, ride: 10, margin: 16, awayMs: 90, inMs: 180, headInset: 12, headFrom: 0.6 };
|
|
827
|
+
function placeTrayBar(a, height = TRAY_BAR.height) {
|
|
828
|
+
const B = TRAY_BAR;
|
|
829
|
+
const foot = a.view.height - B.foot;
|
|
830
|
+
const d = a.drawer;
|
|
831
|
+
const bottom = d === null ? foot : Math.min(foot, d.y - B.ride);
|
|
832
|
+
if (d === null) return { y: bottom - height, head: null };
|
|
833
|
+
const t = Math.min(Math.max((d.p - B.headFrom) / (1 - B.headFrom), 0), 1);
|
|
834
|
+
return { y: bottom - height, head: { x: d.x + B.headInset, y: d.header.y, w: Math.max(0, d.w - 2 * B.headInset), h: d.header.h, opacity: t * t * (3 - 2 * t) } };
|
|
835
|
+
}
|
|
836
|
+
var stadium = (x, y) => /* @__PURE__ */ jsx3("rect", { x, y, width: "3.5", height: "8.5", rx: "1.75" });
|
|
837
|
+
var TRAY_BAR_GLYPHS = {
|
|
838
|
+
pegboard: /* @__PURE__ */ jsxs2("g", { fill: "currentColor", children: [
|
|
839
|
+
stadium(5.75, 3.5),
|
|
840
|
+
stadium(14.75, 3.5),
|
|
841
|
+
stadium(10.25, 12)
|
|
842
|
+
] }),
|
|
843
|
+
close: /* @__PURE__ */ jsx3("path", { d: "M7 7l10 10M17 7L7 17", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round" })
|
|
844
|
+
};
|
|
845
|
+
var DESK_TAPE = '--ice-tape:#17181b;--ice-tape-letters-rgb:236 235 228;--ice-tape-chosen:#efe9da;--ice-tape-chosen-ink:rgb(16 9 4);--ice-tape-font:var(--vf-font-mono,ui-monospace,"SF Mono",Menlo,monospace)';
|
|
846
|
+
var STYLE2 = `
|
|
847
|
+
[data-ice-tray-bar]{${DESK_INK};${DESK_TAPE};--ice-tb-night:0;position:absolute;left:0;right:0;top:0;height:0;z-index:19;pointer-events:none;font:500 12.5px/1 var(--ice-menu-font,system-ui,-apple-system,sans-serif);user-select:none}
|
|
848
|
+
[data-ice-tray-bar] .ice-tb-handle{position:absolute;left:0;right:0;top:0;display:flex;justify-content:center;pointer-events:none;will-change:transform}
|
|
849
|
+
[data-ice-tray-bar] .ice-tb-bar{pointer-events:auto;display:flex;align-items:center;height:40px;padding:4px;box-sizing:border-box;white-space:nowrap;border-radius:20px;background:var(--ice-menu-ink);color:var(--ice-menu-cream);box-shadow:inset 0 0 0 1px var(--ice-menu-hair),var(--ice-menu-shadow);opacity:1;visibility:visible;transition:opacity ${TRAY_BAR.inMs}ms ease-out}
|
|
850
|
+
[data-ice-tray-bar][data-visible="false"] .ice-tb-bar{opacity:0;visibility:hidden;pointer-events:none;transition:opacity ${TRAY_BAR.awayMs}ms ease-out,visibility 0s linear ${TRAY_BAR.awayMs}ms}
|
|
851
|
+
[data-ice-tray-bar] button{appearance:none;border:0;margin:0;padding:0;background:none;color:inherit;font:inherit;cursor:pointer}
|
|
852
|
+
[data-ice-tray-bar] button:focus-visible{outline:2px solid var(--ice-menu-brass);outline-offset:1px}
|
|
853
|
+
[data-ice-tray-bar] .ice-tb-toggle{flex:none;height:32px;padding:0 12px 0 9px;border-radius:16px;display:inline-flex;align-items:center;gap:7px;background:rgb(var(--ice-menu-cream-rgb) / .08);transition:background 120ms ease,transform 120ms ease}
|
|
854
|
+
[data-ice-tray-bar] .ice-tb-toggle:hover{background:rgb(var(--ice-menu-cream-rgb) / .15)}
|
|
855
|
+
[data-ice-tray-bar] .ice-tb-toggle:active{transform:scale(.97)}
|
|
856
|
+
[data-ice-tray-bar] .ice-tb-head{position:absolute;left:0;top:0;display:flex;align-items:center;justify-content:center;box-sizing:border-box;pointer-events:none;visibility:visible;will-change:transform,opacity}
|
|
857
|
+
[data-ice-tray-bar][data-visible="false"] .ice-tb-head,[data-ice-tray-bar] .ice-tb-head[data-shown="false"]{visibility:hidden}
|
|
858
|
+
[data-ice-tray-bar] .ice-tb-chips{pointer-events:auto;display:flex;align-items:center;gap:8px;min-width:0;max-width:100%;padding:8px 7px;box-sizing:border-box;overflow-x:auto;scrollbar-width:none}
|
|
859
|
+
[data-ice-tray-bar] .ice-tb-chips::-webkit-scrollbar{display:none}
|
|
860
|
+
[data-ice-tray-bar] .ice-tb-chips[data-before="true"]{mask-image:linear-gradient(90deg,transparent 0,#000 18px)}
|
|
861
|
+
[data-ice-tray-bar] .ice-tb-chips[data-after="true"]{mask-image:linear-gradient(90deg,#000 calc(100% - 18px),transparent 100%)}
|
|
862
|
+
[data-ice-tray-bar] .ice-tb-chips[data-before="true"][data-after="true"]{mask-image:linear-gradient(90deg,transparent 0,#000 18px,#000 calc(100% - 18px),transparent 100%)}
|
|
863
|
+
[data-ice-tray-bar] .ice-tb-chip{--n:var(--ice-tb-night);flex:none;height:26px;padding:0 10px;border-radius:2.5px;display:inline-flex;align-items:center;font:600 11px/1 var(--ice-tape-font);letter-spacing:.08em;text-transform:uppercase;color:rgb(var(--ice-tape-letters-rgb) / calc(1 - .45 * var(--n)));background:linear-gradient(180deg,rgb(255 255 255 / calc(.1 * (1 - var(--n)))) 0,rgb(255 255 255 / calc(.035 * (1 - var(--n)))) 46%,rgb(255 255 255 / 0) 54%),var(--ice-tape);text-shadow:0 1px 0 rgb(0 0 0 / .55),0 -.5px 0 rgb(255 255 255 / calc(.1 * (1 - var(--n))));box-shadow:inset 0 .75px 0 rgb(255 255 255 / calc(.1 * (1 - var(--n)))),.6px .9px 0 rgb(0 0 0 / calc(.24 * (1 - .5 * var(--n)))),1px 2px 3px rgb(0 0 0 / calc(.16 * (1 - .5 * var(--n))));transition:transform 120ms ease,box-shadow 120ms ease}
|
|
864
|
+
[data-ice-tray-bar] .ice-tb-chip:hover{transform:translateY(-1px);box-shadow:inset 0 .75px 0 rgb(255 255 255 / calc(.1 * (1 - var(--n)))),1px 1.8px .5px rgb(0 0 0 / calc(.22 * (1 - .5 * var(--n)))),1.6px 3.2px 5px rgb(0 0 0 / calc(.2 * (1 - .5 * var(--n))))}
|
|
865
|
+
[data-ice-tray-bar] .ice-tb-chip:active{transform:none}
|
|
866
|
+
[data-ice-tray-bar] .ice-tb-chip:focus-visible{outline:2px solid var(--ice-menu-brass);outline-offset:2px}
|
|
867
|
+
[data-ice-tray-bar] .ice-tb-chip[data-on="true"]{--ice-tape:var(--ice-tape-chosen);color:var(--ice-tape-chosen-ink);text-shadow:0 1px 0 rgb(255 255 255 / .5),0 -.5px 0 rgb(60 40 20 / .18);filter:saturate(calc(1 - .7 * var(--n))) brightness(calc(1 - .4 * var(--n)))}
|
|
868
|
+
`;
|
|
869
|
+
var shownOf2 = (a) => ({
|
|
870
|
+
visible: !a.held && a.entries > 0,
|
|
871
|
+
open: a.open,
|
|
872
|
+
category: a.category,
|
|
873
|
+
chips: a.categories.map((c) => `${c.id}:${c.label}:${c.count}`).join("|")
|
|
874
|
+
});
|
|
875
|
+
var sameShown2 = (a, b) => a.visible === b.visible && a.open === b.open && a.category === b.category && a.chips === b.chips;
|
|
876
|
+
var pressed = (run) => (e) => {
|
|
877
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
878
|
+
e.preventDefault();
|
|
879
|
+
if (!e.repeat) run();
|
|
880
|
+
};
|
|
881
|
+
var spaceUp = (e) => {
|
|
882
|
+
if (e.key === " ") e.preventDefault();
|
|
883
|
+
};
|
|
884
|
+
var clicked = (run) => (e) => {
|
|
885
|
+
run();
|
|
886
|
+
if (e.detail > 0) e.currentTarget.blur();
|
|
887
|
+
};
|
|
888
|
+
function TrayBar({ source, label = "Objects", keys = "A" }) {
|
|
889
|
+
const root = useRef5(null);
|
|
890
|
+
const handle = useRef5(null);
|
|
891
|
+
const head = useRef5(null);
|
|
892
|
+
const chipsRef = useRef5(null);
|
|
893
|
+
const toggleRef = useRef5(null);
|
|
894
|
+
const cats = useRef5(source.anchor().categories);
|
|
895
|
+
const [shown, setShown] = useState2(() => shownOf2(source.anchor()));
|
|
896
|
+
const edges = () => {
|
|
897
|
+
const c = chipsRef.current;
|
|
898
|
+
if (c === null) return;
|
|
899
|
+
const more = c.scrollWidth - c.clientWidth;
|
|
900
|
+
c.dataset.before = String(more > 0.5 && c.scrollLeft > 0.5);
|
|
901
|
+
c.dataset.after = String(more > 0.5 && c.scrollLeft < more - 0.5);
|
|
902
|
+
};
|
|
903
|
+
const width = useRef5(-1);
|
|
904
|
+
const placeRef = useRef5(() => {
|
|
905
|
+
});
|
|
906
|
+
placeRef.current = () => {
|
|
907
|
+
const a = source.anchor();
|
|
908
|
+
cats.current = a.categories;
|
|
909
|
+
const next = shownOf2(a);
|
|
910
|
+
setShown((prev) => sameShown2(prev, next) ? prev : next);
|
|
911
|
+
const at = placeTrayBar(a);
|
|
912
|
+
if (handle.current !== null) handle.current.style.transform = `translateY(${at.y.toFixed(1)}px)`;
|
|
913
|
+
const h = head.current;
|
|
914
|
+
if (h !== null) {
|
|
915
|
+
const box = at.head;
|
|
916
|
+
h.dataset.shown = String(box !== null && box.opacity > 0);
|
|
917
|
+
if (box !== null) {
|
|
918
|
+
h.style.transform = `translate(${box.x.toFixed(1)}px, ${box.y.toFixed(1)}px)`;
|
|
919
|
+
h.style.width = `${box.w.toFixed(1)}px`;
|
|
920
|
+
h.style.height = `${box.h.toFixed(1)}px`;
|
|
921
|
+
h.style.opacity = box.opacity.toFixed(3);
|
|
922
|
+
if (box.w !== width.current) {
|
|
923
|
+
width.current = box.w;
|
|
924
|
+
edges();
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
root.current?.style.setProperty("--ice-tb-night", Math.min(Math.max(a.night, 0), 1).toFixed(3));
|
|
929
|
+
};
|
|
930
|
+
useLayoutEffect2(() => {
|
|
931
|
+
const run = () => placeRef.current();
|
|
932
|
+
run();
|
|
933
|
+
return source.subscribe(run);
|
|
934
|
+
}, [source]);
|
|
935
|
+
useLayoutEffect2(() => {
|
|
936
|
+
edges();
|
|
937
|
+
});
|
|
938
|
+
useEffect3(() => {
|
|
939
|
+
if (!shown.open && chipsRef.current?.contains(document.activeElement) === true) toggleRef.current?.focus();
|
|
940
|
+
}, [shown.open]);
|
|
941
|
+
const toggle = () => {
|
|
942
|
+
source.toggle();
|
|
943
|
+
};
|
|
944
|
+
const walk = (e) => {
|
|
945
|
+
const found = chipsRef.current?.querySelectorAll("button");
|
|
946
|
+
const list = found === void 0 ? [] : Array.from(found);
|
|
947
|
+
const at = list.indexOf(document.activeElement);
|
|
948
|
+
const to = e.key === "ArrowRight" ? at + 1 : e.key === "ArrowLeft" ? at - 1 : e.key === "Home" ? 0 : e.key === "End" ? list.length - 1 : null;
|
|
949
|
+
if (at < 0 || to === null) return;
|
|
950
|
+
e.preventDefault();
|
|
951
|
+
list[Math.min(Math.max(to, 0), list.length - 1)]?.focus();
|
|
952
|
+
};
|
|
953
|
+
const chips = [{ id: "", label: "All", count: 0 }, ...cats.current];
|
|
954
|
+
return /* @__PURE__ */ jsxs2("div", { ref: root, "data-ice-tray-bar": "", "data-open": String(shown.open), "data-visible": String(shown.visible), "aria-hidden": !shown.visible, children: [
|
|
955
|
+
/* @__PURE__ */ jsx3("div", { ref: handle, className: "ice-tb-handle", children: /* @__PURE__ */ jsx3("div", { className: "ice-tb-bar", "data-canvas-interactive": "", onPointerDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs2(
|
|
956
|
+
"button",
|
|
957
|
+
{
|
|
958
|
+
ref: toggleRef,
|
|
959
|
+
type: "button",
|
|
960
|
+
className: "ice-tb-toggle",
|
|
961
|
+
"data-act": "tray",
|
|
962
|
+
"aria-expanded": shown.open,
|
|
963
|
+
"aria-keyshortcuts": keys,
|
|
964
|
+
title: `${label} (${keys})`,
|
|
965
|
+
onClick: clicked(toggle),
|
|
966
|
+
onKeyDown: pressed(toggle),
|
|
967
|
+
onKeyUp: spaceUp,
|
|
968
|
+
children: [
|
|
969
|
+
/* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: 16, height: 16, "aria-hidden": "true", focusable: "false", children: shown.open ? TRAY_BAR_GLYPHS.close : TRAY_BAR_GLYPHS.pegboard }),
|
|
970
|
+
/* @__PURE__ */ jsx3("span", { children: label })
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
) }) }),
|
|
974
|
+
/* @__PURE__ */ jsx3("div", { ref: head, className: "ice-tb-head", children: /* @__PURE__ */ jsx3("div", { ref: chipsRef, className: "ice-tb-chips", role: "toolbar", "aria-label": "Categories", "data-canvas-interactive": "", onKeyDown: walk, onScroll: edges, onPointerDown: (e) => e.stopPropagation(), children: chips.map((c) => {
|
|
975
|
+
const on = c.id === shown.category;
|
|
976
|
+
const choose = () => {
|
|
977
|
+
source.category(c.id);
|
|
978
|
+
};
|
|
979
|
+
return /* @__PURE__ */ jsx3(
|
|
980
|
+
"button",
|
|
981
|
+
{
|
|
982
|
+
type: "button",
|
|
983
|
+
className: "ice-tb-chip",
|
|
984
|
+
"data-category": c.id,
|
|
985
|
+
"data-on": on ? "true" : void 0,
|
|
986
|
+
"aria-pressed": on,
|
|
987
|
+
tabIndex: shown.open ? void 0 : -1,
|
|
988
|
+
onClick: clicked(choose),
|
|
989
|
+
onKeyDown: pressed(choose),
|
|
990
|
+
onKeyUp: spaceUp,
|
|
991
|
+
children: c.label
|
|
992
|
+
},
|
|
993
|
+
c.id === "" ? "*" : `=${c.id}`
|
|
994
|
+
);
|
|
995
|
+
}) }) }),
|
|
996
|
+
/* @__PURE__ */ jsx3("style", { children: STYLE2 })
|
|
997
|
+
] });
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// ../react/src/desk.tsx
|
|
1001
|
+
import { useEffect as useEffect4, useRef as useRef6 } from "react";
|
|
1002
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1003
|
+
function Desk({ engine, layer, onReady, keymapOverrides, className, style, children }) {
|
|
1004
|
+
const containerRef = useRef6(null);
|
|
1005
|
+
const onReadyRef = useRef6(onReady);
|
|
1006
|
+
onReadyRef.current = onReady;
|
|
1007
|
+
const keymapOverridesRef = useRef6(keymapOverrides);
|
|
1008
|
+
keymapOverridesRef.current = keymapOverrides;
|
|
1009
|
+
useEffect4(() => {
|
|
1010
|
+
const container = containerRef.current;
|
|
1011
|
+
if (container === null) return;
|
|
1012
|
+
const mount = createDeskHost({ container, engine, layer });
|
|
1013
|
+
const detachKeymap = attachKeymap(engine, void 0, keymapOverridesRef.current ?? []);
|
|
1014
|
+
const undoReady = onReadyRef.current?.({ engine, host: mount.host, layer: mount.layer, focus: mount.focus });
|
|
1015
|
+
return () => {
|
|
1016
|
+
if (typeof undoReady === "function") undoReady();
|
|
1017
|
+
detachKeymap();
|
|
1018
|
+
mount.dispose();
|
|
1019
|
+
};
|
|
1020
|
+
}, [engine, layer]);
|
|
1021
|
+
return /* @__PURE__ */ jsx4(EngineProvider, { engine, children: /* @__PURE__ */ jsx4("div", { ref: containerRef, className, style: { width: "100%", height: "100%", ...style }, "data-ice-canvas": "", children }) });
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// ../react/src/index.ts
|
|
1025
|
+
var REACT_VERSION = "0.0.0";
|
|
32
1026
|
export {
|
|
1027
|
+
DESK_TAPE,
|
|
1028
|
+
Desk,
|
|
33
1029
|
EngineProvider,
|
|
34
|
-
|
|
1030
|
+
FramePreviewBoundary,
|
|
35
1031
|
REACT_VERSION,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1032
|
+
SELECTION_GLYPHS,
|
|
1033
|
+
SELECTION_MENU,
|
|
1034
|
+
SelectionMenu,
|
|
1035
|
+
TRAY_BAR,
|
|
1036
|
+
TRAY_BAR_GLYPHS,
|
|
1037
|
+
TrayBar,
|
|
39
1038
|
attachKeymap,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1039
|
+
defaultSelectionActions,
|
|
1040
|
+
nudgeSelection,
|
|
1041
|
+
placeSelectionMenu,
|
|
1042
|
+
placeTrayBar,
|
|
1043
|
+
selectionTaped,
|
|
1044
|
+
toggleTape,
|
|
1045
|
+
unlessInert,
|
|
44
1046
|
useBehavior,
|
|
45
1047
|
useBreakpoint,
|
|
1048
|
+
useCanvasCatalog,
|
|
1049
|
+
useCanvasDiagnostics,
|
|
46
1050
|
useCanvasEngine,
|
|
1051
|
+
useCanvasTools,
|
|
47
1052
|
useCommit,
|
|
1053
|
+
useCurrentCanvas,
|
|
48
1054
|
useFrameFreeze,
|
|
1055
|
+
useFramePreview,
|
|
49
1056
|
useOps,
|
|
50
1057
|
usePresencePeers,
|
|
51
1058
|
useSelected,
|