@snaptrude/plugin-core 0.0.0-bimsvg-20260928124803
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/AGENTS.md +231 -0
- package/CHANGELOG.md +341 -0
- package/CLAUDE.md +11 -0
- package/api-manifest.json +9120 -0
- package/dist/api/analysis/daylight.d.ts +603 -0
- package/dist/api/analysis/daylight.d.ts.map +1 -0
- package/dist/api/analysis/heatmaps.d.ts +658 -0
- package/dist/api/analysis/heatmaps.d.ts.map +1 -0
- package/dist/api/analysis/illuminance.d.ts +145 -0
- package/dist/api/analysis/illuminance.d.ts.map +1 -0
- package/dist/api/analysis/index.d.ts +59 -0
- package/dist/api/analysis/index.d.ts.map +1 -0
- package/dist/api/analysis/shadows.d.ts +165 -0
- package/dist/api/analysis/shadows.d.ts.map +1 -0
- package/dist/api/analysis/solar.d.ts +249 -0
- package/dist/api/analysis/solar.d.ts.map +1 -0
- package/dist/api/analysis/sunlightHours.d.ts +208 -0
- package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
- package/dist/api/analysis/sunpath.d.ts +80 -0
- package/dist/api/analysis/sunpath.d.ts.map +1 -0
- package/dist/api/analysis/weather.d.ts +193 -0
- package/dist/api/analysis/weather.d.ts.map +1 -0
- package/dist/api/core/buildings.d.ts +427 -0
- package/dist/api/core/buildings.d.ts.map +1 -0
- package/dist/api/core/camera/index.d.ts +261 -0
- package/dist/api/core/camera/index.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +333 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +1073 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +78 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +33 -0
- package/dist/api/core/geom/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/arc.d.ts +169 -0
- package/dist/api/core/geom/query/arc.d.ts.map +1 -0
- package/dist/api/core/geom/query/brep.d.ts +514 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -0
- package/dist/api/core/geom/query/circle.d.ts +378 -0
- package/dist/api/core/geom/query/circle.d.ts.map +1 -0
- package/dist/api/core/geom/query/contour.d.ts +450 -0
- package/dist/api/core/geom/query/contour.d.ts.map +1 -0
- package/dist/api/core/geom/query/curve.d.ts +918 -0
- package/dist/api/core/geom/query/curve.d.ts.map +1 -0
- package/dist/api/core/geom/query/edge.d.ts +128 -0
- package/dist/api/core/geom/query/edge.d.ts.map +1 -0
- package/dist/api/core/geom/query/face.d.ts +363 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -0
- package/dist/api/core/geom/query/halfedge.d.ts +206 -0
- package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
- package/dist/api/core/geom/query/index.d.ts +61 -0
- package/dist/api/core/geom/query/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/profile.d.ts +410 -0
- package/dist/api/core/geom/query/profile.d.ts.map +1 -0
- package/dist/api/core/geom/query/vertex.d.ts +187 -0
- package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
- package/dist/api/core/geom/update/contour.d.ts +272 -0
- package/dist/api/core/geom/update/contour.d.ts.map +1 -0
- package/dist/api/core/geom/update/curve.d.ts +180 -0
- package/dist/api/core/geom/update/curve.d.ts.map +1 -0
- package/dist/api/core/geom/update/index.d.ts +27 -0
- package/dist/api/core/geom/update/index.d.ts.map +1 -0
- package/dist/api/core/geom/update/profile.d.ts +329 -0
- package/dist/api/core/geom/update/profile.d.ts.map +1 -0
- package/dist/api/core/groups.d.ts +485 -0
- package/dist/api/core/groups.d.ts.map +1 -0
- package/dist/api/core/handles/index.d.ts +210 -0
- package/dist/api/core/handles/index.d.ts.map +1 -0
- package/dist/api/core/history/index.d.ts +78 -0
- package/dist/api/core/history/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +97 -0
- package/dist/api/core/index.d.ts.map +1 -0
- package/dist/api/core/io/export/index.d.ts +134 -0
- package/dist/api/core/io/export/index.d.ts.map +1 -0
- package/dist/api/core/io/import/index.d.ts +455 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +40 -0
- package/dist/api/core/io/index.d.ts.map +1 -0
- package/dist/api/core/io/job/index.d.ts +139 -0
- package/dist/api/core/io/job/index.d.ts.map +1 -0
- package/dist/api/core/io/query/index.d.ts +74 -0
- package/dist/api/core/io/query/index.d.ts.map +1 -0
- package/dist/api/core/io/terrain/index.d.ts +341 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +805 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/index.d.ts +18 -0
- package/dist/api/core/math/index.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +170 -0
- package/dist/api/core/math/quat.d.ts.map +1 -0
- package/dist/api/core/math/vec3.d.ts +174 -0
- package/dist/api/core/math/vec3.d.ts.map +1 -0
- package/dist/api/core/mode/index.d.ts +111 -0
- package/dist/api/core/mode/index.d.ts.map +1 -0
- package/dist/api/core/project/index.d.ts +466 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- package/dist/api/core/proposals/index.d.ts +531 -0
- package/dist/api/core/proposals/index.d.ts.map +1 -0
- package/dist/api/core/storeys/index.d.ts +265 -0
- package/dist/api/core/storeys/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +860 -0
- package/dist/api/core/tags.d.ts.map +1 -0
- package/dist/api/core/units/index.d.ts +175 -0
- package/dist/api/core/units/index.d.ts.map +1 -0
- package/dist/api/core/user.d.ts +44 -0
- package/dist/api/core/user.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +49 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +168 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -0
- package/dist/api/design/create/bulk-items.d.ts +185 -0
- package/dist/api/design/create/bulk-items.d.ts.map +1 -0
- package/dist/api/design/create/grids.d.ts +132 -0
- package/dist/api/design/create/grids.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +1747 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/create/opening-fields.d.ts +37 -0
- package/dist/api/design/create/opening-fields.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +70 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/dimensions.d.ts +427 -0
- package/dist/api/design/dimensions.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +470 -0
- package/dist/api/design/doors/index.d.ts.map +1 -0
- package/dist/api/design/edit/index.d.ts +49 -0
- package/dist/api/design/edit/index.d.ts.map +1 -0
- package/dist/api/design/erase/index.d.ts +160 -0
- package/dist/api/design/erase/index.d.ts.map +1 -0
- package/dist/api/design/family.d.ts +611 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +296 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/grids.d.ts +237 -0
- package/dist/api/design/grids.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +260 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +67 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +551 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +252 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/grids.d.ts +287 -0
- package/dist/api/design/query/grids.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1318 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- package/dist/api/design/query/referenceLines.d.ts +45 -0
- package/dist/api/design/query/referenceLines.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +394 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +282 -0
- package/dist/api/design/selection/index.d.ts.map +1 -0
- package/dist/api/design/shared.d.ts +38 -0
- package/dist/api/design/shared.d.ts.map +1 -0
- package/dist/api/design/transform/index.d.ts +249 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- package/dist/api/design/types/index.d.ts +181 -0
- package/dist/api/design/types/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +803 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- package/dist/api/design/visibility.d.ts +126 -0
- package/dist/api/design/visibility.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +300 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +265 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
- package/dist/api/entity/department.d.ts +1 -0
- package/dist/api/entity/department.d.ts.map +1 -0
- package/dist/api/entity/index.d.ts +28 -0
- package/dist/api/entity/index.d.ts.map +1 -0
- package/dist/api/entity/referenceLine.d.ts +210 -0
- package/dist/api/entity/referenceLine.d.ts.map +1 -0
- package/dist/api/entity/space.d.ts +846 -0
- package/dist/api/entity/space.d.ts.map +1 -0
- package/dist/api/entity/story.d.ts +476 -0
- package/dist/api/entity/story.d.ts.map +1 -0
- package/dist/api/index.d.ts +45 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/presentation/aiInspiration.d.ts +2400 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/annotate.d.ts +483 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +184 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/drawings.d.ts +2900 -0
- package/dist/api/presentation/drawings.d.ts.map +1 -0
- package/dist/api/presentation/export.d.ts +126 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +164 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +114 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/placedViews.d.ts +1232 -0
- package/dist/api/presentation/placedViews.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +481 -0
- package/dist/api/presentation/shapes.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +643 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- package/dist/api/presentation/slideshow.d.ts +125 -0
- package/dist/api/presentation/slideshow.d.ts.map +1 -0
- package/dist/api/presentation/tables.d.ts +81 -0
- package/dist/api/presentation/tables.d.ts.map +1 -0
- package/dist/api/presentation/viewPresets.d.ts +70 -0
- package/dist/api/presentation/viewPresets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +741 -0
- package/dist/api/presentation/views.d.ts.map +1 -0
- package/dist/api/program/adjacency.d.ts +155 -0
- package/dist/api/program/adjacency.d.ts.map +1 -0
- package/dist/api/program/areas.d.ts +450 -0
- package/dist/api/program/areas.d.ts.map +1 -0
- package/dist/api/program/classification.d.ts +135 -0
- package/dist/api/program/classification.d.ts.map +1 -0
- package/dist/api/program/cores.d.ts +78 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +487 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +71 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/labels.d.ts +355 -0
- package/dist/api/program/labels.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +398 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metadata.d.ts +328 -0
- package/dist/api/program/metadata.d.ts.map +1 -0
- package/dist/api/program/metrics.d.ts +108 -0
- package/dist/api/program/metrics.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +823 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2628 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/api/workspace/index.d.ts +552 -0
- package/dist/api/workspace/index.d.ts.map +1 -0
- package/dist/errors/codes.d.ts +34 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/envelope.d.ts +56 -0
- package/dist/errors/envelope.d.ts.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/plugin-error.d.ts +69 -0
- package/dist/errors/plugin-error.d.ts.map +1 -0
- package/dist/handles.d.ts +229 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +47 -0
- package/dist/host-utils.d.ts.map +1 -0
- package/dist/index.cjs +8836 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7568 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +41 -0
- package/scripts/generate-manifest.mjs +238 -0
- package/scripts/generate-manifest.test.mjs +292 -0
- package/src/api/analysis/daylight.ts +470 -0
- package/src/api/analysis/heatmaps.ts +683 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +61 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/solar.ts +237 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/analysis/weather.ts +179 -0
- package/src/api/core/buildings.ts +485 -0
- package/src/api/core/camera/index.ts +268 -0
- package/src/api/core/comment/index.ts +376 -0
- package/src/api/core/geom/create/index.ts +1204 -0
- package/src/api/core/geom/delete/index.ts +84 -0
- package/src/api/core/geom/index.ts +35 -0
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +563 -0
- package/src/api/core/geom/query/circle.ts +404 -0
- package/src/api/core/geom/query/contour.ts +540 -0
- package/src/api/core/geom/query/curve.ts +1078 -0
- package/src/api/core/geom/query/edge.ts +130 -0
- package/src/api/core/geom/query/face.ts +403 -0
- package/src/api/core/geom/query/halfedge.ts +210 -0
- package/src/api/core/geom/query/index.ts +63 -0
- package/src/api/core/geom/query/profile.ts +473 -0
- package/src/api/core/geom/query/vertex.ts +205 -0
- package/src/api/core/geom/update/contour.ts +315 -0
- package/src/api/core/geom/update/curve.ts +209 -0
- package/src/api/core/geom/update/index.ts +29 -0
- package/src/api/core/geom/update/profile.ts +377 -0
- package/src/api/core/groups.ts +521 -0
- package/src/api/core/handles/index.ts +233 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +99 -0
- package/src/api/core/io/export/index.ts +126 -0
- package/src/api/core/io/import/index.ts +504 -0
- package/src/api/core/io/index.ts +42 -0
- package/src/api/core/io/job/index.ts +140 -0
- package/src/api/core/io/query/index.ts +71 -0
- package/src/api/core/io/terrain/index.ts +360 -0
- package/src/api/core/io/underlay/index.ts +705 -0
- package/src/api/core/layers.ts +333 -0
- package/src/api/core/math/index.ts +20 -0
- package/src/api/core/math/quat.ts +172 -0
- package/src/api/core/math/vec3.ts +179 -0
- package/src/api/core/mode/index.ts +108 -0
- package/src/api/core/project/index.ts +479 -0
- package/src/api/core/proposals/index.ts +569 -0
- package/src/api/core/storeys/index.ts +294 -0
- package/src/api/core/tags.ts +911 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/user.ts +46 -0
- package/src/api/core/zoom/index.ts +51 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/bulk-items.ts +186 -0
- package/src/api/design/create/grids.ts +137 -0
- package/src/api/design/create/index.ts +1954 -0
- package/src/api/design/create/opening-fields.ts +37 -0
- package/src/api/design/delete/index.ts +74 -0
- package/src/api/design/dimensions.ts +453 -0
- package/src/api/design/doors/index.ts +500 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/family.ts +646 -0
- package/src/api/design/furniture/index.ts +319 -0
- package/src/api/design/grids.ts +237 -0
- package/src/api/design/index.ts +274 -0
- package/src/api/design/lock.ts +69 -0
- package/src/api/design/materials/index.ts +608 -0
- package/src/api/design/query/geometry/index.ts +288 -0
- package/src/api/design/query/grids.ts +197 -0
- package/src/api/design/query/index.ts +1176 -0
- package/src/api/design/query/referenceLines.ts +52 -0
- package/src/api/design/query/spaces.ts +275 -0
- package/src/api/design/selection/index.ts +273 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +254 -0
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +798 -0
- package/src/api/design/visibility.ts +143 -0
- package/src/api/design/windows/index.ts +333 -0
- package/src/api/entity/buildableEnvelope.ts +322 -0
- package/src/api/entity/department.ts +0 -0
- package/src/api/entity/index.ts +30 -0
- package/src/api/entity/referenceLine.ts +235 -0
- package/src/api/entity/space.ts +612 -0
- package/src/api/entity/story.ts +517 -0
- package/src/api/index.ts +47 -0
- package/src/api/presentation/aiInspiration.ts +1116 -0
- package/src/api/presentation/annotate.ts +417 -0
- package/src/api/presentation/diagrams.ts +194 -0
- package/src/api/presentation/drawings.ts +529 -0
- package/src/api/presentation/export.ts +133 -0
- package/src/api/presentation/import.ts +159 -0
- package/src/api/presentation/index.ts +129 -0
- package/src/api/presentation/placedViews.ts +1203 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +616 -0
- package/src/api/presentation/slideshow.ts +134 -0
- package/src/api/presentation/tables.ts +84 -0
- package/src/api/presentation/viewPresets.ts +83 -0
- package/src/api/presentation/views.ts +698 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +408 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +83 -0
- package/src/api/program/departments.ts +517 -0
- package/src/api/program/index.ts +73 -0
- package/src/api/program/labels.ts +332 -0
- package/src/api/program/layout.ts +422 -0
- package/src/api/program/metadata.ts +364 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +748 -0
- package/src/api/program/spreadsheet.ts +2698 -0
- package/src/api/workspace/index.ts +612 -0
- package/src/errors/codes.ts +136 -0
- package/src/errors/envelope.ts +75 -0
- package/src/errors/index.ts +21 -0
- package/src/errors/plugin-error.ts +134 -0
- package/src/handles.ts +282 -0
- package/src/host-utils.ts +68 -0
- package/src/index.ts +5 -0
- package/src/types.ts +16 -0
- package/test/errors.test.mjs +184 -0
- package/tsconfig.json +22 -0
- package/tsup.config.ts +12 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { Vec3Handle } from "../../../handles"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Camera controls.
|
|
7
|
+
*
|
|
8
|
+
* Position the viewport camera, snap it to a standard orthographic/isometric
|
|
9
|
+
* view, and toggle between the 2D (plan) and 3D modelling modes — mirrors the
|
|
10
|
+
* canvas view menu and the 2D/3D toggle. Like {@linkcode PluginZoomApi}, these
|
|
11
|
+
* are transient VIEW-STATE changes: they are not model edits, so they are not
|
|
12
|
+
* write-gated and are not undoable. Accessed via `snaptrude.core.camera`.
|
|
13
|
+
*/
|
|
14
|
+
export abstract class PluginCameraApi {
|
|
15
|
+
constructor() {}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Point the camera: place its eye at `eye` looking toward `target` (world
|
|
19
|
+
* coordinates, internal `babylon` units). View-state only — not undoable.
|
|
20
|
+
*
|
|
21
|
+
* @param eye - Camera position as a {@linkcode Vec3Handle}
|
|
22
|
+
* @param target - Point the camera looks at as a {@linkcode Vec3Handle}
|
|
23
|
+
* @returns `true` once the camera has been positioned.
|
|
24
|
+
*
|
|
25
|
+
* @examplePrompt Look at the model from above the north-east corner
|
|
26
|
+
* @examplePrompt Position the camera at (50, 30, 50) looking at the origin
|
|
27
|
+
* @examplePrompt Point the camera at the centre of the building from the side
|
|
28
|
+
* @examplePrompt Set the eye to this point and aim it at that point
|
|
29
|
+
*
|
|
30
|
+
* # Example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const { vec3 } = snaptrude.core.math
|
|
33
|
+
* await snaptrude.core.camera.lookFrom(vec3.new(50, 30, 50), vec3.new(0, 0, 0))
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
public abstract lookFrom(
|
|
37
|
+
eye: Vec3Handle,
|
|
38
|
+
target: Vec3Handle,
|
|
39
|
+
): PluginApiReturn<boolean>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Snap the camera to a standard view — the five orthographic elevations
|
|
43
|
+
* (`top` / `front` / `back` / `left` / `right`) or the 3D `iso` (isometric
|
|
44
|
+
* perspective) view. Mirrors the canvas view menu. View-state only — not
|
|
45
|
+
* undoable. The orthographic presets exit 2D mode first if needed.
|
|
46
|
+
*
|
|
47
|
+
* @param view - The standard view to snap to ({@linkcode PluginStandardView})
|
|
48
|
+
* @returns `true` once the view has been applied.
|
|
49
|
+
*
|
|
50
|
+
* @examplePrompt Switch to the top view
|
|
51
|
+
* @examplePrompt Show me the front elevation
|
|
52
|
+
* @examplePrompt Go to the isometric view
|
|
53
|
+
* @examplePrompt Look at the model from the left
|
|
54
|
+
* @examplePrompt Give me a plan view from the top
|
|
55
|
+
*
|
|
56
|
+
* # Example
|
|
57
|
+
* ```ts
|
|
58
|
+
* await snaptrude.core.camera.setStandardView("top")
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
public abstract setStandardView(
|
|
62
|
+
view: PluginStandardView,
|
|
63
|
+
): PluginApiReturn<boolean>
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get the current camera mode. Paired with {@linkcode PluginCameraApi.setMode}.
|
|
67
|
+
*
|
|
68
|
+
* @returns `"2d"` when the editor is in plan view, `"3d"` otherwise.
|
|
69
|
+
*
|
|
70
|
+
* @examplePrompt Am I in 2D or 3D?
|
|
71
|
+
* @examplePrompt What view mode is the editor in?
|
|
72
|
+
*
|
|
73
|
+
* # Example
|
|
74
|
+
* ```ts
|
|
75
|
+
* if ((await snaptrude.core.camera.getMode()) === "2d") {
|
|
76
|
+
* await snaptrude.core.camera.setMode("3d")
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
public abstract getMode(): PluginApiReturn<PluginCameraMode>
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Toggle the modelling mode between `2d` (plan) and `3d`. Mirrors the canvas
|
|
84
|
+
* 2D/3D toggle: `3d` enters the isometric perspective view, `2d` drops to the
|
|
85
|
+
* orthographic plan of the active storey. View-state only — not undoable.
|
|
86
|
+
*
|
|
87
|
+
* @param mode - `"2d"` or `"3d"` ({@linkcode PluginCameraMode})
|
|
88
|
+
* @returns `true` once the mode switch has been requested.
|
|
89
|
+
*
|
|
90
|
+
* @examplePrompt Switch to 3D view
|
|
91
|
+
* @examplePrompt Drop into 2D plan mode
|
|
92
|
+
* @examplePrompt Go back to 3D
|
|
93
|
+
* @examplePrompt Show the floor plan in 2D
|
|
94
|
+
*
|
|
95
|
+
* # Example
|
|
96
|
+
* ```ts
|
|
97
|
+
* await snaptrude.core.camera.setMode("3d")
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
public abstract setMode(mode: PluginCameraMode): PluginApiReturn<boolean>
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Read the camera's current projection: `"perspective"` (the default 3D
|
|
104
|
+
* view) or `"orthographic"`. In 2D (plan) mode this always reports
|
|
105
|
+
* `"orthographic"` — a plan is an orthographic projection.
|
|
106
|
+
*
|
|
107
|
+
* @returns The current {@linkcode PluginCameraProjection}.
|
|
108
|
+
*
|
|
109
|
+
* @examplePrompt Is the camera in perspective or orthographic?
|
|
110
|
+
* @examplePrompt What projection is the 3D view using?
|
|
111
|
+
* @examplePrompt Check whether perspective is on
|
|
112
|
+
*
|
|
113
|
+
* # Example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const projection = await snaptrude.core.camera.getProjection()
|
|
116
|
+
* console.log(projection) // "perspective" | "orthographic"
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
public abstract getProjection(): PluginApiReturn<PluginCameraProjection>
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Switch the 3D camera between `"perspective"` and `"orthographic"`
|
|
123
|
+
* projection — the Perspective/Orthographic control in the Design tab's
|
|
124
|
+
* View Settings panel. Like {@linkcode PluginCameraApi.setMode}, this is a
|
|
125
|
+
* transient view-state change: not write-gated, not undoable.
|
|
126
|
+
*
|
|
127
|
+
* In 2D (plan) mode the canvas is always an orthographic plan:
|
|
128
|
+
* `"orthographic"` is accepted as a no-op, while `"perspective"` is
|
|
129
|
+
* rejected — switch to 3D first via `setMode("3d")`.
|
|
130
|
+
*
|
|
131
|
+
* @param projection - `"perspective"` or `"orthographic"` ({@linkcode PluginCameraProjection})
|
|
132
|
+
* @returns `true` once the projection has been applied.
|
|
133
|
+
*
|
|
134
|
+
* @examplePrompt Switch the camera to orthographic
|
|
135
|
+
* @examplePrompt Turn perspective off
|
|
136
|
+
* @examplePrompt Give me a perspective view of the model
|
|
137
|
+
* @examplePrompt Make the 3D view orthographic like an axonometric drawing
|
|
138
|
+
*
|
|
139
|
+
* # Example
|
|
140
|
+
* ```ts
|
|
141
|
+
* await snaptrude.core.camera.setProjection("orthographic")
|
|
142
|
+
* const projection = await snaptrude.core.camera.getProjection() // "orthographic"
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
public abstract setProjection(
|
|
146
|
+
projection: PluginCameraProjection,
|
|
147
|
+
): PluginApiReturn<boolean>
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Zoom (fit) the camera to all geometry in the scene — the "zoom extents"
|
|
151
|
+
* action. View-state only — not undoable. Canonical home of the zoom-extents
|
|
152
|
+
* read (the deprecated `core.zoom.extents`).
|
|
153
|
+
*
|
|
154
|
+
* @returns `true` once the camera has been framed to the scene.
|
|
155
|
+
*
|
|
156
|
+
* @examplePrompt Zoom out so I can see the whole model
|
|
157
|
+
* @examplePrompt Fit everything in the view
|
|
158
|
+
* @examplePrompt Frame the entire building in the viewport
|
|
159
|
+
* @examplePrompt Do a zoom extents on the canvas
|
|
160
|
+
*
|
|
161
|
+
* # Example
|
|
162
|
+
* ```ts
|
|
163
|
+
* await snaptrude.core.camera.zoomExtents()
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
public abstract zoomExtents(): PluginApiReturn<boolean>
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Zoom (fit) the camera to the current selection. View-state only — not
|
|
170
|
+
* undoable. Canonical home of the zoom-to-selection read (the deprecated
|
|
171
|
+
* `core.zoom.selection`).
|
|
172
|
+
*
|
|
173
|
+
* @returns `true` if there was a selection to frame; `false` if nothing is
|
|
174
|
+
* selected (no-op).
|
|
175
|
+
*
|
|
176
|
+
* @examplePrompt Zoom in on what I have selected
|
|
177
|
+
* @examplePrompt Frame the selected walls in the view
|
|
178
|
+
* @examplePrompt Focus the camera on my current selection
|
|
179
|
+
* @examplePrompt Fit the view to the selected room
|
|
180
|
+
*
|
|
181
|
+
* # Example
|
|
182
|
+
* ```ts
|
|
183
|
+
* await snaptrude.core.camera.zoomSelection()
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
public abstract zoomSelection(): PluginApiReturn<boolean>
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* A standard camera view: the five orthographic elevations (`top`/`front`/
|
|
191
|
+
* `back`/`left`/`right`) or the 3D isometric perspective (`iso`).
|
|
192
|
+
*/
|
|
193
|
+
export const PluginStandardView = z.enum([
|
|
194
|
+
"top",
|
|
195
|
+
"front",
|
|
196
|
+
"back",
|
|
197
|
+
"left",
|
|
198
|
+
"right",
|
|
199
|
+
"iso",
|
|
200
|
+
])
|
|
201
|
+
export type PluginStandardView = z.infer<typeof PluginStandardView>
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The modelling mode: `2d` (orthographic plan) or `3d` (isometric perspective).
|
|
205
|
+
*/
|
|
206
|
+
export const PluginCameraMode = z.enum(["2d", "3d"])
|
|
207
|
+
export type PluginCameraMode = z.infer<typeof PluginCameraMode>
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The 3D camera projection: `perspective` (the default) or `orthographic` —
|
|
211
|
+
* the Perspective/Orthographic control in the Design tab's View Settings panel.
|
|
212
|
+
*/
|
|
213
|
+
export const PluginCameraProjection = z.enum(["perspective", "orthographic"])
|
|
214
|
+
export type PluginCameraProjection = z.infer<typeof PluginCameraProjection>
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Arguments for {@linkcode PluginCameraApi.lookFrom}.
|
|
218
|
+
*
|
|
219
|
+
* | Property | Type | Description |
|
|
220
|
+
* |---|---|---|
|
|
221
|
+
* | `eye` | {@linkcode Vec3Handle} | Camera position (world, `babylon` units) |
|
|
222
|
+
* | `target` | {@linkcode Vec3Handle} | Point the camera looks at |
|
|
223
|
+
*/
|
|
224
|
+
export const PluginCameraLookFromArgs = z.object({
|
|
225
|
+
eye: Vec3Handle,
|
|
226
|
+
target: Vec3Handle,
|
|
227
|
+
})
|
|
228
|
+
export type PluginCameraLookFromArgs = z.infer<typeof PluginCameraLookFromArgs>
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Arguments for {@linkcode PluginCameraApi.setStandardView}.
|
|
232
|
+
*
|
|
233
|
+
* | Property | Type | Description |
|
|
234
|
+
* |---|---|---|
|
|
235
|
+
* | `view` | {@linkcode PluginStandardView} | The standard view to snap to |
|
|
236
|
+
*/
|
|
237
|
+
export const PluginCameraSetStandardViewArgs = z.object({
|
|
238
|
+
view: PluginStandardView,
|
|
239
|
+
})
|
|
240
|
+
export type PluginCameraSetStandardViewArgs = z.infer<
|
|
241
|
+
typeof PluginCameraSetStandardViewArgs
|
|
242
|
+
>
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Arguments for {@linkcode PluginCameraApi.setMode}.
|
|
246
|
+
*
|
|
247
|
+
* | Property | Type | Description |
|
|
248
|
+
* |---|---|---|
|
|
249
|
+
* | `mode` | {@linkcode PluginCameraMode} | `"2d"` or `"3d"` |
|
|
250
|
+
*/
|
|
251
|
+
export const PluginCameraSetModeArgs = z.object({
|
|
252
|
+
mode: PluginCameraMode,
|
|
253
|
+
})
|
|
254
|
+
export type PluginCameraSetModeArgs = z.infer<typeof PluginCameraSetModeArgs>
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Arguments for {@linkcode PluginCameraApi.setProjection}.
|
|
258
|
+
*
|
|
259
|
+
* | Property | Type | Description |
|
|
260
|
+
* |---|---|---|
|
|
261
|
+
* | `projection` | {@linkcode PluginCameraProjection} | `"perspective"` or `"orthographic"` |
|
|
262
|
+
*/
|
|
263
|
+
export const PluginCameraSetProjectionArgs = z.object({
|
|
264
|
+
projection: PluginCameraProjection,
|
|
265
|
+
})
|
|
266
|
+
export type PluginCameraSetProjectionArgs = z.infer<
|
|
267
|
+
typeof PluginCameraSetProjectionArgs
|
|
268
|
+
>
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { Vec3Handle, ComponentHandle, Vec3Components } from "../../../handles"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Comments — create, edit, resolve, tag, and list scene/project comments.
|
|
7
|
+
*
|
|
8
|
+
* A comment is an opaque {@link CommentHandle} (its server id). Comments may be
|
|
9
|
+
* anchored to a component at a 3D point, carry @mentions (by email) and emojis,
|
|
10
|
+
* and be resolved / reopened. Accessed via `snaptrude.core.comment`.
|
|
11
|
+
*/
|
|
12
|
+
export abstract class PluginCommentApi {
|
|
13
|
+
constructor() {}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create a comment in the project — optionally pinned to a component at a 3D
|
|
17
|
+
* point — with optional @mentions that notify teammates by email.
|
|
18
|
+
*
|
|
19
|
+
* @param message - Comment text (emojis = plain unicode).
|
|
20
|
+
* @param component - Optional component to anchor the comment to.
|
|
21
|
+
* @param position - Optional pin point; defaults to the component's center.
|
|
22
|
+
* @param mentions - Optional user emails to @mention (appended as real @mention tags).
|
|
23
|
+
* @returns the new {@link CommentHandle}.
|
|
24
|
+
*
|
|
25
|
+
* @examplePrompt Add a comment on this wall saying the height looks wrong
|
|
26
|
+
* @examplePrompt Leave a note on the selected room for the design team
|
|
27
|
+
* @examplePrompt Comment "verify the door swing" and tag alex@acme.com
|
|
28
|
+
* @examplePrompt Pin a review note at this point on the slab
|
|
29
|
+
*
|
|
30
|
+
* # Example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const c = await snaptrude.core.comment.create(
|
|
33
|
+
* "Check this wall 🎉",
|
|
34
|
+
* spaceId,
|
|
35
|
+
* undefined,
|
|
36
|
+
* ["alex@acme.com"],
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
public abstract create(
|
|
41
|
+
message: string,
|
|
42
|
+
component?: ComponentHandle,
|
|
43
|
+
position?: Vec3Handle,
|
|
44
|
+
mentions?: string[],
|
|
45
|
+
): PluginApiReturn<CommentHandle>
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Edit a comment's message (and optional @mentions).
|
|
49
|
+
*
|
|
50
|
+
* @param comment - The comment to edit.
|
|
51
|
+
* @param message - New message text.
|
|
52
|
+
* @param mentions - Optional user emails to @mention.
|
|
53
|
+
*
|
|
54
|
+
* @examplePrompt Edit my comment to say the beam depth is 600mm
|
|
55
|
+
* @examplePrompt Change the text of this comment
|
|
56
|
+
* @examplePrompt Update the note on the wall and mention priya@studio.com
|
|
57
|
+
* @examplePrompt Reword the comment I just added
|
|
58
|
+
*
|
|
59
|
+
* # Example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const c = await snaptrude.core.comment.create("Beam depth TBD")
|
|
62
|
+
* await snaptrude.core.comment.update(c, "Beam depth is 600mm", ["priya@studio.com"])
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
public abstract update(
|
|
66
|
+
comment: CommentHandle,
|
|
67
|
+
message: string,
|
|
68
|
+
mentions?: string[],
|
|
69
|
+
): PluginApiReturn<boolean>
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Mark a comment resolved. Paired with {@link PluginCommentApi.reopen}.
|
|
73
|
+
*
|
|
74
|
+
* @param comment - The target comment.
|
|
75
|
+
*
|
|
76
|
+
* @examplePrompt Mark this comment as resolved
|
|
77
|
+
* @examplePrompt Resolve the comment about the staircase
|
|
78
|
+
* @examplePrompt Close out this review note
|
|
79
|
+
* @examplePrompt Set that comment to done
|
|
80
|
+
*
|
|
81
|
+
* # Example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const c = await snaptrude.core.comment.create("Verify the door swing")
|
|
84
|
+
* await snaptrude.core.comment.resolve(c)
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
public abstract resolve(comment: CommentHandle): PluginApiReturn<boolean>
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Reopen a resolved comment. Paired with {@link PluginCommentApi.resolve}.
|
|
91
|
+
*
|
|
92
|
+
* @param comment - The target comment.
|
|
93
|
+
*
|
|
94
|
+
* @examplePrompt Reopen this resolved comment
|
|
95
|
+
* @examplePrompt Mark the comment as unresolved again
|
|
96
|
+
* @examplePrompt Bring back the closed note about the window heights
|
|
97
|
+
* @examplePrompt Un-resolve that comment so we can keep discussing it
|
|
98
|
+
*
|
|
99
|
+
* # Example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const [comment] = await snaptrude.core.comment.list()
|
|
102
|
+
* await snaptrude.core.comment.reopen(comment)
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
public abstract reopen(comment: CommentHandle): PluginApiReturn<boolean>
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Check whether a comment has been marked resolved.
|
|
109
|
+
*
|
|
110
|
+
* @param comment - The target comment.
|
|
111
|
+
*
|
|
112
|
+
* @examplePrompt Is this comment resolved yet?
|
|
113
|
+
* @examplePrompt Check if the note about the roof has been closed
|
|
114
|
+
* @examplePrompt Has my comment been resolved?
|
|
115
|
+
* @examplePrompt Tell me whether that comment is still open
|
|
116
|
+
*
|
|
117
|
+
* # Example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const [comment] = await snaptrude.core.comment.list()
|
|
120
|
+
* const resolved = await snaptrude.core.comment.isResolved(comment)
|
|
121
|
+
* console.log(resolved ? "resolved" : "still open")
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
public abstract isResolved(comment: CommentHandle): PluginApiReturn<boolean>
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Tag (mention) a user on an existing comment, by email.
|
|
128
|
+
*
|
|
129
|
+
* @param comment - The comment to add a mention to.
|
|
130
|
+
* @param email - The user's email to @mention.
|
|
131
|
+
*
|
|
132
|
+
* @examplePrompt Tag alex@acme.com on this comment
|
|
133
|
+
* @examplePrompt Mention the structural engineer in that note
|
|
134
|
+
* @examplePrompt Add priya@studio.com to the comment about the lobby
|
|
135
|
+
* @examplePrompt Notify a teammate about an existing comment
|
|
136
|
+
*
|
|
137
|
+
* # Example
|
|
138
|
+
* ```ts
|
|
139
|
+
* const [comment] = await snaptrude.core.comment.list()
|
|
140
|
+
* await snaptrude.core.comment.tag(comment, "alex@acme.com")
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
public abstract tag(
|
|
144
|
+
comment: CommentHandle,
|
|
145
|
+
email: string,
|
|
146
|
+
): PluginApiReturn<boolean>
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Permanently remove a comment from the project.
|
|
150
|
+
*
|
|
151
|
+
* @param comment - The target comment.
|
|
152
|
+
*
|
|
153
|
+
* @examplePrompt Delete this comment
|
|
154
|
+
* @examplePrompt Remove the note about the old layout
|
|
155
|
+
* @examplePrompt Get rid of my last comment
|
|
156
|
+
* @examplePrompt Clear that resolved comment off the wall
|
|
157
|
+
*
|
|
158
|
+
* # Example
|
|
159
|
+
* ```ts
|
|
160
|
+
* const [comment] = await snaptrude.core.comment.list()
|
|
161
|
+
* await snaptrude.core.comment.delete(comment)
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
public abstract delete(comment: CommentHandle): PluginApiReturn<boolean>
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* List every comment in the project (deleted ones are excluded), returned as
|
|
168
|
+
* comment handles you can pass to the other comment methods.
|
|
169
|
+
*
|
|
170
|
+
* @examplePrompt List all the comments in this project
|
|
171
|
+
* @examplePrompt How many comments are on this model?
|
|
172
|
+
* @examplePrompt Show every note in the file
|
|
173
|
+
* @examplePrompt Get all comments so I can check which are resolved
|
|
174
|
+
*
|
|
175
|
+
* # Example
|
|
176
|
+
* ```ts
|
|
177
|
+
* const comments = await snaptrude.core.comment.list()
|
|
178
|
+
* console.log(`${comments.length} comments in the project`)
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
public abstract list(): PluginApiReturn<CommentHandle[]>
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Read a comment's full detail — its text, author, pin location, resolved
|
|
185
|
+
* state, and reply thread. Comments are otherwise write-only; this is the read
|
|
186
|
+
* side. Pass a top-level comment handle or a reply handle (a reply has an empty
|
|
187
|
+
* `thread`). Returns `null` if the handle doesn't match a live comment.
|
|
188
|
+
*
|
|
189
|
+
* @param comment - The comment (or reply) to read.
|
|
190
|
+
* @returns the {@link PluginCommentDetails}, or `null` if not found.
|
|
191
|
+
*
|
|
192
|
+
* @examplePrompt Read the comment on this wall and tell me what it says
|
|
193
|
+
* @examplePrompt Who left this comment and where is it pinned?
|
|
194
|
+
* @examplePrompt Show me the full thread for this comment
|
|
195
|
+
* @examplePrompt Get the text and author of the selected comment
|
|
196
|
+
*
|
|
197
|
+
* # Example
|
|
198
|
+
* ```ts
|
|
199
|
+
* const [first] = await snaptrude.core.comment.list()
|
|
200
|
+
* const details = await snaptrude.core.comment.get(first)
|
|
201
|
+
* console.log(details?.content, "by", details?.author?.name)
|
|
202
|
+
* console.log(`${details?.thread.length ?? 0} replies`)
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
public abstract get(
|
|
206
|
+
comment: CommentHandle,
|
|
207
|
+
): PluginApiReturn<PluginCommentDetails | null>
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Reply to a comment — posts a new comment threaded under `comment` (which must
|
|
211
|
+
* be a top-level comment, not itself a reply). Notifies the thread's
|
|
212
|
+
* participants, mirroring the sidebar Reply action.
|
|
213
|
+
*
|
|
214
|
+
* @param comment - The top-level comment to reply to.
|
|
215
|
+
* @param text - The reply text (emojis = plain unicode).
|
|
216
|
+
* @returns the new reply's {@link CommentHandle}.
|
|
217
|
+
*
|
|
218
|
+
* @examplePrompt Reply to this comment saying I fixed the wall height
|
|
219
|
+
* @examplePrompt Add a reply to the review note confirming it's done
|
|
220
|
+
* @examplePrompt Respond to the comment about the door with "looks good now"
|
|
221
|
+
* @examplePrompt Post a follow-up on the selected comment thread
|
|
222
|
+
*
|
|
223
|
+
* # Example
|
|
224
|
+
* ```ts
|
|
225
|
+
* const [thread] = await snaptrude.core.comment.list()
|
|
226
|
+
* const reply = await snaptrude.core.comment.reply(thread, "Fixed 👍")
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
public abstract reply(
|
|
230
|
+
comment: CommentHandle,
|
|
231
|
+
text: string,
|
|
232
|
+
): PluginApiReturn<CommentHandle>
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Opaque handle to a comment — its server-assigned id (entity-style: a raw,
|
|
237
|
+
* persistable string resolved live, not a registry-minted value handle).
|
|
238
|
+
*/
|
|
239
|
+
export type CommentHandle = string & { readonly __handle: "comment" }
|
|
240
|
+
export const CommentHandle = z
|
|
241
|
+
.string()
|
|
242
|
+
.min(1)
|
|
243
|
+
.transform((s) => s as CommentHandle)
|
|
244
|
+
|
|
245
|
+
/** `ComponentHandle` is defined in `handles.ts` (imported above) and exported from the
|
|
246
|
+
* package root via `export * from "./handles"`. Not re-exported here to avoid an
|
|
247
|
+
* ambiguous double `export *` at the barrel. */
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Arguments for {@link PluginCommentApi.create}.
|
|
251
|
+
*
|
|
252
|
+
* | Property | Type | Description |
|
|
253
|
+
* |---|---|---|
|
|
254
|
+
* | `component` | {@link ComponentHandle}? | Component to anchor the comment to |
|
|
255
|
+
* | `position` | {@link Vec3Handle}? | Pin point; defaults to the component's center |
|
|
256
|
+
* | `message` | `string` | Comment text (emojis = unicode) |
|
|
257
|
+
* | `mentions` | `string[]`? | User emails to @mention |
|
|
258
|
+
*/
|
|
259
|
+
export const PluginCommentCreateArgs = z.object({
|
|
260
|
+
component: ComponentHandle.optional(),
|
|
261
|
+
position: Vec3Handle.optional(),
|
|
262
|
+
message: z.string(),
|
|
263
|
+
mentions: z.array(z.string()).optional(),
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
export type PluginCommentCreateArgs = z.infer<typeof PluginCommentCreateArgs>
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Arguments for {@link PluginCommentApi.update}.
|
|
270
|
+
*
|
|
271
|
+
* | Property | Type | Description |
|
|
272
|
+
* |---|---|---|
|
|
273
|
+
* | `comment` | {@link CommentHandle} | The comment to edit |
|
|
274
|
+
* | `message` | `string` | New message text |
|
|
275
|
+
* | `mentions` | `string[]`? | User emails to @mention |
|
|
276
|
+
*/
|
|
277
|
+
export const PluginCommentUpdateArgs = z.object({
|
|
278
|
+
comment: CommentHandle,
|
|
279
|
+
message: z.string(),
|
|
280
|
+
mentions: z.array(z.string()).optional(),
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
export type PluginCommentUpdateArgs = z.infer<typeof PluginCommentUpdateArgs>
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Arguments for {@link PluginCommentApi.resolve} / {@link PluginCommentApi.reopen}
|
|
287
|
+
* / {@link PluginCommentApi.isResolved} / {@link PluginCommentApi.delete}.
|
|
288
|
+
*
|
|
289
|
+
* | Property | Type | Description |
|
|
290
|
+
* |---|---|---|
|
|
291
|
+
* | `comment` | {@link CommentHandle} | The target comment |
|
|
292
|
+
*/
|
|
293
|
+
export const PluginCommentRefArgs = z.object({
|
|
294
|
+
comment: CommentHandle,
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
export type PluginCommentRefArgs = z.infer<typeof PluginCommentRefArgs>
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Arguments for {@link PluginCommentApi.tag}.
|
|
301
|
+
*
|
|
302
|
+
* | Property | Type | Description |
|
|
303
|
+
* |---|---|---|
|
|
304
|
+
* | `comment` | {@link CommentHandle} | The comment to add a mention to |
|
|
305
|
+
* | `email` | `string` | The user's email to @mention |
|
|
306
|
+
*/
|
|
307
|
+
export const PluginCommentTagArgs = z.object({
|
|
308
|
+
comment: CommentHandle,
|
|
309
|
+
email: z.string(),
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
export type PluginCommentTagArgs = z.infer<typeof PluginCommentTagArgs>
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Arguments for {@link PluginCommentApi.reply}.
|
|
316
|
+
*
|
|
317
|
+
* | Property | Type | Description |
|
|
318
|
+
* |---|---|---|
|
|
319
|
+
* | `comment` | {@link CommentHandle} | The top-level comment to reply to |
|
|
320
|
+
* | `text` | `string` | The reply text (emojis = unicode) |
|
|
321
|
+
*/
|
|
322
|
+
export const PluginCommentReplyArgs = z.object({
|
|
323
|
+
comment: CommentHandle,
|
|
324
|
+
text: z.string(),
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
export type PluginCommentReplyArgs = z.infer<typeof PluginCommentReplyArgs>
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* The author of a comment or reply — the display name and email of the teammate
|
|
331
|
+
* who posted it. `null` on the rare comment with no recorded author.
|
|
332
|
+
*/
|
|
333
|
+
export interface PluginCommentAuthor {
|
|
334
|
+
/** The author's display name (falls back to their email). */
|
|
335
|
+
name: string
|
|
336
|
+
/** The author's email. */
|
|
337
|
+
email: string
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* One reply in a comment's thread (returned by {@link PluginCommentApi.get}).
|
|
342
|
+
*/
|
|
343
|
+
export interface PluginCommentReply {
|
|
344
|
+
/** The reply's own {@link CommentHandle}. */
|
|
345
|
+
id: CommentHandle
|
|
346
|
+
/** The reply text. */
|
|
347
|
+
content: string
|
|
348
|
+
/** Who posted the reply. */
|
|
349
|
+
author: PluginCommentAuthor | null
|
|
350
|
+
/** ISO-8601 timestamp of when the reply was posted (empty if unknown). */
|
|
351
|
+
createdAt: string
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* The read model of a comment — returned by {@link PluginCommentApi.get}. The
|
|
356
|
+
* inverse of {@link PluginCommentApi.create}: `content`/`component`/`position`
|
|
357
|
+
* echo what was posted, plus the resolved state and reply `thread`.
|
|
358
|
+
*/
|
|
359
|
+
export interface PluginCommentDetails {
|
|
360
|
+
/** The comment's {@link CommentHandle}. */
|
|
361
|
+
id: CommentHandle
|
|
362
|
+
/** The comment text. */
|
|
363
|
+
content: string
|
|
364
|
+
/** Who posted the comment. */
|
|
365
|
+
author: PluginCommentAuthor | null
|
|
366
|
+
/** The pin point (engine world coordinates), or `null` if un-anchored. */
|
|
367
|
+
position: Vec3Components | null
|
|
368
|
+
/** The component the comment is anchored to, or `null` if un-anchored. */
|
|
369
|
+
component: ComponentHandle | null
|
|
370
|
+
/** Whether the comment has been marked resolved. */
|
|
371
|
+
isResolved: boolean
|
|
372
|
+
/** ISO-8601 timestamp of when the comment was posted (empty if unknown). */
|
|
373
|
+
createdAt: string
|
|
374
|
+
/** The reply thread, oldest first. Empty for a comment with no replies. */
|
|
375
|
+
thread: PluginCommentReply[]
|
|
376
|
+
}
|