@snaptrude/plugin-core 0.7.0 → 0.8.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.
Files changed (133) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/api-manifest.full.json +360 -19
  3. package/api-manifest.json +915 -37
  4. package/dist/api/core/camera/index.d.ts +208 -0
  5. package/dist/api/core/camera/index.d.ts.map +1 -0
  6. package/dist/api/core/comment/index.d.ts +105 -2
  7. package/dist/api/core/comment/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +13 -13
  9. package/dist/api/core/geom/delete/index.d.ts +8 -2
  10. package/dist/api/core/geom/delete/index.d.ts.map +1 -1
  11. package/dist/api/core/geom/query/arc.d.ts +5 -5
  12. package/dist/api/core/geom/query/brep.d.ts +18 -18
  13. package/dist/api/core/geom/query/circle.d.ts +18 -18
  14. package/dist/api/core/geom/query/contour.d.ts +20 -20
  15. package/dist/api/core/geom/query/curve.d.ts +49 -49
  16. package/dist/api/core/geom/query/edge.d.ts +5 -5
  17. package/dist/api/core/geom/query/face.d.ts +16 -16
  18. package/dist/api/core/geom/query/halfedge.d.ts +8 -8
  19. package/dist/api/core/geom/query/profile.d.ts +19 -19
  20. package/dist/api/core/geom/query/vertex.d.ts +8 -8
  21. package/dist/api/core/geom/update/contour.d.ts +14 -14
  22. package/dist/api/core/geom/update/curve.d.ts +7 -7
  23. package/dist/api/core/geom/update/profile.d.ts +16 -16
  24. package/dist/api/core/handles/index.d.ts +210 -0
  25. package/dist/api/core/handles/index.d.ts.map +1 -0
  26. package/dist/api/core/index.d.ts +15 -0
  27. package/dist/api/core/index.d.ts.map +1 -1
  28. package/dist/api/core/io/export/index.d.ts +132 -0
  29. package/dist/api/core/io/export/index.d.ts.map +1 -0
  30. package/dist/api/core/io/import/index.d.ts +1 -1
  31. package/dist/api/core/io/index.d.ts +5 -0
  32. package/dist/api/core/io/index.d.ts.map +1 -1
  33. package/dist/api/core/layers.d.ts +7 -7
  34. package/dist/api/core/proposals/index.d.ts +65 -9
  35. package/dist/api/core/proposals/index.d.ts.map +1 -1
  36. package/dist/api/core/user.d.ts +44 -0
  37. package/dist/api/core/user.d.ts.map +1 -0
  38. package/dist/api/design/boolean/index.d.ts +4 -4
  39. package/dist/api/design/create/index.d.ts +139 -44
  40. package/dist/api/design/create/index.d.ts.map +1 -1
  41. package/dist/api/design/doors/index.d.ts +36 -0
  42. package/dist/api/design/doors/index.d.ts.map +1 -1
  43. package/dist/api/design/edit/index.d.ts +1 -1
  44. package/dist/api/design/erase/index.d.ts +2 -2
  45. package/dist/api/design/furniture/index.d.ts +114 -3
  46. package/dist/api/design/furniture/index.d.ts.map +1 -1
  47. package/dist/api/design/index.d.ts +10 -0
  48. package/dist/api/design/index.d.ts.map +1 -1
  49. package/dist/api/design/materials/index.d.ts +111 -14
  50. package/dist/api/design/materials/index.d.ts.map +1 -1
  51. package/dist/api/design/query/index.d.ts +31 -1
  52. package/dist/api/design/query/index.d.ts.map +1 -1
  53. package/dist/api/design/query/spaces.d.ts +5 -5
  54. package/dist/api/design/transform/index.d.ts +83 -14
  55. package/dist/api/design/transform/index.d.ts.map +1 -1
  56. package/dist/api/design/types/index.d.ts +181 -0
  57. package/dist/api/design/types/index.d.ts.map +1 -0
  58. package/dist/api/design/update/index.d.ts +335 -2
  59. package/dist/api/design/update/index.d.ts.map +1 -1
  60. package/dist/api/design/visibility.d.ts +98 -0
  61. package/dist/api/design/visibility.d.ts.map +1 -0
  62. package/dist/api/entity/referenceLine.d.ts +2 -2
  63. package/dist/api/entity/space.d.ts +19 -19
  64. package/dist/api/entity/story.d.ts +128 -15
  65. package/dist/api/entity/story.d.ts.map +1 -1
  66. package/dist/api/presentation/aiInspiration.d.ts +1967 -7
  67. package/dist/api/presentation/aiInspiration.d.ts.map +1 -1
  68. package/dist/api/presentation/annotate.d.ts +448 -0
  69. package/dist/api/presentation/annotate.d.ts.map +1 -0
  70. package/dist/api/presentation/diagrams.d.ts +49 -8
  71. package/dist/api/presentation/diagrams.d.ts.map +1 -1
  72. package/dist/api/presentation/export.d.ts +104 -0
  73. package/dist/api/presentation/export.d.ts.map +1 -0
  74. package/dist/api/presentation/index.d.ts +40 -3
  75. package/dist/api/presentation/index.d.ts.map +1 -1
  76. package/dist/api/presentation/sheets.d.ts +410 -13
  77. package/dist/api/presentation/sheets.d.ts.map +1 -1
  78. package/dist/api/presentation/views.d.ts +165 -10
  79. package/dist/api/presentation/views.d.ts.map +1 -1
  80. package/dist/api/program/areas.d.ts +63 -3
  81. package/dist/api/program/areas.d.ts.map +1 -1
  82. package/dist/api/program/cores.d.ts +3 -99
  83. package/dist/api/program/cores.d.ts.map +1 -1
  84. package/dist/api/program/index.d.ts +2 -2
  85. package/dist/api/program/index.d.ts.map +1 -1
  86. package/dist/api/program/layout.d.ts +172 -12
  87. package/dist/api/program/layout.d.ts.map +1 -1
  88. package/dist/api/program/site.d.ts +11 -8
  89. package/dist/api/program/site.d.ts.map +1 -1
  90. package/dist/api/program/spreadsheet.d.ts +105 -13
  91. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  92. package/dist/handles.d.ts +64 -25
  93. package/dist/handles.d.ts.map +1 -1
  94. package/dist/index.cjs +2502 -1466
  95. package/dist/index.cjs.map +1 -1
  96. package/dist/index.js +2369 -1461
  97. package/dist/index.js.map +1 -1
  98. package/package.json +1 -1
  99. package/src/api/core/camera/index.ts +212 -0
  100. package/src/api/core/comment/index.ts +120 -2
  101. package/src/api/core/geom/delete/index.ts +6 -0
  102. package/src/api/core/handles/index.ts +233 -0
  103. package/src/api/core/index.ts +15 -0
  104. package/src/api/core/io/export/index.ts +124 -0
  105. package/src/api/core/io/index.ts +5 -0
  106. package/src/api/core/proposals/index.ts +71 -11
  107. package/src/api/core/user.ts +46 -0
  108. package/src/api/design/create/index.ts +166 -36
  109. package/src/api/design/doors/index.ts +40 -0
  110. package/src/api/design/furniture/index.ts +127 -3
  111. package/src/api/design/index.ts +10 -0
  112. package/src/api/design/materials/index.ts +157 -30
  113. package/src/api/design/query/index.ts +33 -7
  114. package/src/api/design/transform/index.ts +89 -12
  115. package/src/api/design/types/index.ts +156 -0
  116. package/src/api/design/update/index.ts +402 -6
  117. package/src/api/design/visibility.ts +109 -0
  118. package/src/api/entity/story.ts +141 -15
  119. package/src/api/presentation/aiInspiration.ts +761 -7
  120. package/src/api/presentation/annotate.ts +360 -0
  121. package/src/api/presentation/diagrams.ts +53 -8
  122. package/src/api/presentation/export.ts +104 -0
  123. package/src/api/presentation/index.ts +48 -3
  124. package/src/api/presentation/sheets.ts +346 -13
  125. package/src/api/presentation/views.ts +164 -12
  126. package/src/api/program/areas.ts +57 -6
  127. package/src/api/program/cores.ts +3 -91
  128. package/src/api/program/index.ts +2 -2
  129. package/src/api/program/layout.ts +182 -12
  130. package/src/api/program/site.ts +11 -8
  131. package/src/api/program/spreadsheet.ts +125 -29
  132. package/src/handles.ts +77 -13
  133. package/tsconfig.json +7 -2
@@ -0,0 +1,104 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Presentation export — render the Present-mode layout sheets to a downloadable
4
+ * file (PDF / PNG / JPG) and hand the plugin the bytes as base64.
5
+ *
6
+ * This wraps the same pipeline the Present-mode **Export** dialog drives:
7
+ * each sheet is serialized to an SVG, then either composed into a PDF
8
+ * (svg2pdf/jspdf) or rasterized to a PNG/JPG. Nothing is written to disk
9
+ * host-side — the plugin receives the encoded bytes and decides what to do
10
+ * with them (save, upload, preview).
11
+ *
12
+ * Requires **Present mode to be open** (the documentation editor); the call
13
+ * throws `PRECONDITION_FAILED` when it is not.
14
+ *
15
+ * The result is always a uniform `{ files }` array (see
16
+ * {@linkcode PluginPresentationExportResult}):
17
+ * - `pdf` with `combine` (the default) → a single multi-page file.
18
+ * - `pdf` with `combine: false`, or any `png`/`jpg` → one file per sheet.
19
+ *
20
+ * Accessed via `snaptrude.presentation.export`.
21
+ *
22
+ * The schemas and result types live here; the callable method is declared on
23
+ * {@linkcode PluginPresentationApi.export}.
24
+ */
25
+ /** Output file format: a vector `pdf`, or a rasterized `png` / `jpg`. */
26
+ export declare const PluginPresentationExportFormat: z.ZodEnum<{
27
+ pdf: "pdf";
28
+ png: "png";
29
+ jpg: "jpg";
30
+ }>;
31
+ export type PluginPresentationExportFormat = z.infer<typeof PluginPresentationExportFormat>;
32
+ /**
33
+ * Target pixel dimensions for a rasterized (`png`/`jpg`) export. Ignored for
34
+ * `pdf`, which stays vector and takes its size from the sheet.
35
+ *
36
+ * | Property | Type | Description |
37
+ * |---|---|---|
38
+ * | `width` | `number` | Output width in pixels |
39
+ * | `height` | `number` | Output height in pixels |
40
+ */
41
+ export declare const PluginPresentationExportResolution: z.ZodObject<{
42
+ width: z.ZodNumber;
43
+ height: z.ZodNumber;
44
+ }, z.core.$strip>;
45
+ export type PluginPresentationExportResolution = z.infer<typeof PluginPresentationExportResolution>;
46
+ /**
47
+ * Arguments for {@linkcode PluginPresentationApi.export}.
48
+ *
49
+ * | Property | Type | Description |
50
+ * |---|---|---|
51
+ * | `format` | `"pdf" \| "png" \| "jpg"` | Output format |
52
+ * | `sheetIds` | `string[] \| undefined` | Sheets to export (all sheets when omitted) |
53
+ * | `combine` | `boolean \| undefined` | PDF only: one multi-page file (default `true`) vs one file per sheet |
54
+ * | `resolution` | {@linkcode PluginPresentationExportResolution}` \| undefined` | Raster target size (`png`/`jpg` only) |
55
+ * | `fileName` | `string \| undefined` | Base file name (without extension) |
56
+ */
57
+ export declare const PluginPresentationExportArgs: z.ZodObject<{
58
+ format: z.ZodEnum<{
59
+ pdf: "pdf";
60
+ png: "png";
61
+ jpg: "jpg";
62
+ }>;
63
+ sheetIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
+ combine: z.ZodOptional<z.ZodBoolean>;
65
+ resolution: z.ZodOptional<z.ZodObject<{
66
+ width: z.ZodNumber;
67
+ height: z.ZodNumber;
68
+ }, z.core.$strip>>;
69
+ fileName: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strip>;
71
+ export type PluginPresentationExportArgs = z.infer<typeof PluginPresentationExportArgs>;
72
+ /**
73
+ * A single exported file.
74
+ *
75
+ * | Property | Type | Description |
76
+ * |---|---|---|
77
+ * | `fileName` | `string` | File name including extension |
78
+ * | `mimeType` | `string` | MIME type (`application/pdf`, `image/png`, `image/jpeg`) |
79
+ * | `dataBase64` | `string` | The file bytes, base64-encoded (no data-URL prefix) |
80
+ */
81
+ export declare const PluginPresentationExportFile: z.ZodObject<{
82
+ fileName: z.ZodString;
83
+ mimeType: z.ZodString;
84
+ dataBase64: z.ZodString;
85
+ }, z.core.$strip>;
86
+ export type PluginPresentationExportFile = z.infer<typeof PluginPresentationExportFile>;
87
+ /**
88
+ * Result of {@linkcode PluginPresentationApi.export} — always a `files` array.
89
+ * A combined PDF yields one entry; per-sheet exports yield one entry each, in
90
+ * sheet order.
91
+ *
92
+ * | Property | Type | Description |
93
+ * |---|---|---|
94
+ * | `files` | {@linkcode PluginPresentationExportFile}`[]` | The exported files |
95
+ */
96
+ export declare const PluginPresentationExportResult: z.ZodObject<{
97
+ files: z.ZodArray<z.ZodObject<{
98
+ fileName: z.ZodString;
99
+ mimeType: z.ZodString;
100
+ dataBase64: z.ZodString;
101
+ }, z.core.$strip>>;
102
+ }, z.core.$strip>;
103
+ export type PluginPresentationExportResult = z.infer<typeof PluginPresentationExportResult>;
104
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/api/presentation/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,yEAAyE;AACzE,eAAO,MAAM,8BAA8B;;;;EAAgC,CAAA;AAC3E,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,8BAA8B,CACtC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC;;;iBAG7C,CAAA;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,kCAAkC,CAC1C,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;iBAMvC,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B;;;;;;iBAEzC,CAAA;AACF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,8BAA8B,CACtC,CAAA"}
@@ -1,8 +1,11 @@
1
+ import { PluginApiReturn } from "../../types";
1
2
  import { PluginPresentationViewsApi } from "./views";
2
3
  import { PluginPresentationAIInspirationApi } from "./aiInspiration";
3
4
  import { PluginPresentationSheetsApi } from "./sheets";
4
5
  import { PluginPresentationDiagramsApi } from "./diagrams";
6
+ import { PluginPresentationAnnotateApi } from "./annotate";
5
7
  import { PluginPresentationImportApi } from "./import";
8
+ import { PluginPresentationExportResult, type PluginPresentationExportFormat, type PluginPresentationExportResolution } from "./export";
6
9
  /**
7
10
  * Presentation APIs — prepare and assemble presentations.
8
11
  *
@@ -28,19 +31,53 @@ export declare abstract class PluginPresentationApi {
28
31
  abstract sheets: PluginPresentationSheetsApi;
29
32
  /** Program/adjacency/site diagrams — place images on sheets. See {@linkcode PluginPresentationDiagramsApi}. */
30
33
  abstract diagrams: PluginPresentationDiagramsApi;
34
+ /** Annotations on Present-mode sheets — text/arrows/notes/geo shapes. See {@linkcode PluginPresentationAnnotateApi}. */
35
+ abstract annotate: PluginPresentationAnnotateApi;
31
36
  /** Import reference images/PDFs onto the Present canvas. See {@linkcode PluginPresentationImportApi}. */
32
37
  abstract import: PluginPresentationImportApi;
33
38
  /**
34
39
  * Present-mode AI Inspiration image/video generation. See
35
- * {@linkcode PluginPresentationAIInspirationApi}. _(authored ahead — optional
36
- * until the host lands; the host implementation today is a stub.)_
40
+ * {@linkcode PluginPresentationAIInspirationApi}.
37
41
  */
38
- aiInspiration?: PluginPresentationAIInspirationApi;
42
+ abstract aiInspiration: PluginPresentationAIInspirationApi;
43
+ /**
44
+ * Export the presentation's layout sheets to a downloadable file (PDF / PNG /
45
+ * JPG) and return the encoded bytes as base64. Wraps the Present-mode Export
46
+ * dialog pipeline headlessly. Requires Present mode to be open.
47
+ *
48
+ * @param format - Output format: `"pdf"`, `"png"`, or `"jpg"`.
49
+ * @param options - Optional `sheetIds` (all sheets when omitted), `combine`
50
+ * (PDF only — one multi-page file vs one per sheet, default `true`),
51
+ * `resolution` (raster target size for `png`/`jpg`), and `fileName`.
52
+ * @returns A {@linkcode PluginPresentationExportResult} — always a `files`
53
+ * array (one entry for a combined PDF, one per sheet otherwise).
54
+ * @throws If Present mode is not open, a `sheetId` is unknown, or a sheet
55
+ * fails to serialize/encode.
56
+ *
57
+ * @examplePrompt Export the presentation as a PDF
58
+ * @examplePrompt Download all sheets as a single PDF
59
+ * @examplePrompt Export sheet 1 as a PNG
60
+ * @examplePrompt Save the presentation sheets as JPG images
61
+ * @examplePrompt Export these sheets to PDF at high resolution
62
+ *
63
+ * # Example
64
+ * ```ts
65
+ * const { files } = await snaptrude.presentation.export("pdf")
66
+ * ```
67
+ */
68
+ abstract export(format: PluginPresentationExportFormat, options?: {
69
+ sheetIds?: string[];
70
+ combine?: boolean;
71
+ resolution?: PluginPresentationExportResolution;
72
+ fileName?: string;
73
+ }): PluginApiReturn<PluginPresentationExportResult>;
39
74
  constructor();
40
75
  }
41
76
  export * from "./views";
42
77
  export * from "./sheets";
43
78
  export * from "./diagrams";
79
+ export * from "./annotate";
44
80
  export * from "./import";
45
81
  export * from "./aiInspiration";
82
+ export * from "./export";
46
83
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,EAAE,kCAAkC,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;AAEtD;;;;;;;;;;;;;;;;;GAiBG;AACH,8BAAsB,qBAAqB;IACzC,qEAAqE;IACrE,SAAgB,KAAK,EAAE,0BAA0B,CAAA;IACjD,mHAAmH;IACnH,SAAgB,MAAM,EAAE,2BAA2B,CAAA;IACnD,+GAA+G;IAC/G,SAAgB,QAAQ,EAAE,6BAA6B,CAAA;IACvD,yGAAyG;IACzG,SAAgB,MAAM,EAAE,2BAA2B,CAAA;IACnD;;;;OAIG;IACI,aAAa,CAAC,EAAE,kCAAkC,CAAA;;CAG1D;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,EAAE,kCAAkC,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EACL,8BAA8B,EAC9B,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACxC,MAAM,UAAU,CAAA;AAEjB;;;;;;;;;;;;;;;;;GAiBG;AACH,8BAAsB,qBAAqB;IACzC,qEAAqE;IACrE,SAAgB,KAAK,EAAE,0BAA0B,CAAA;IACjD,mHAAmH;IACnH,SAAgB,MAAM,EAAE,2BAA2B,CAAA;IACnD,+GAA+G;IAC/G,SAAgB,QAAQ,EAAE,6BAA6B,CAAA;IACvD,wHAAwH;IACxH,SAAgB,QAAQ,EAAE,6BAA6B,CAAA;IACvD,yGAAyG;IACzG,SAAgB,MAAM,EAAE,2BAA2B,CAAA;IACnD;;;OAGG;IACH,SAAgB,aAAa,EAAE,kCAAkC,CAAA;IAEjE;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;aACa,MAAM,CACpB,MAAM,EAAE,8BAA8B,EACtC,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,UAAU,CAAC,EAAE,kCAAkC,CAAA;QAC/C,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,GACA,eAAe,CAAC,8BAA8B,CAAC;;CAGnD;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA"}