@snaptrude/plugin-core 0.9.12 → 0.9.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snaptrude/plugin-core",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -253,6 +253,32 @@ export abstract class PluginDesignFamilyApi {
253
253
  public abstract create(
254
254
  args?: PluginDesignFamilyCreateArgs,
255
255
  ): PluginApiReturn<PluginFamilyCreateResult>
256
+
257
+ /**
258
+ * Remove a family from the library: its catalog row is archived, so it
259
+ * leaves the Families panel. Placed instances are untouched — in this
260
+ * project and every other — because archived pins keep resolving. Pass
261
+ * `instances: true` to ALSO delete this project's instances in one undoable
262
+ * command; do that only when the user asks for the instances to go.
263
+ *
264
+ * Omit `id` to target the prepared draft. `id` may be a draft id, a saved
265
+ * catalog id, or any family from `list()`.
266
+ *
267
+ * @param args Optional family id, and whether to delete instances too
268
+ * @returns Whether a library row was archived and how many instances were removed
269
+ *
270
+ * @examplePrompt Delete the Louvre Screen family from my library
271
+ * @examplePrompt Get rid of that bollard and every copy of it in here
272
+ *
273
+ * # Example
274
+ * ```ts
275
+ * await snaptrude.design.family.delete({ id: "revit:steel-bollard~bef047" })
276
+ * await snaptrude.design.family.delete({ id: "revit:steel-bollard~bef047", instances: true })
277
+ * ```
278
+ */
279
+ public abstract delete(
280
+ args?: PluginDesignFamilyDeleteArgs,
281
+ ): PluginApiReturn<PluginFamilyDeleteResult>
256
282
  }
257
283
 
258
284
  // ---------------------------------------------------------------------------
@@ -439,6 +465,21 @@ export interface PluginFamilyCreateResult {
439
465
  definitionId?: string
440
466
  version?: number
441
467
  guid?: string
468
+ /** True when the save also dropped one instance into the model (nothing was placed yet). */
469
+ placed?: boolean
470
+ /** Host guidance for the caller, e.g. that an instance was placed at the view centre. */
471
+ hint?: string
472
+ error?: string
473
+ }
474
+
475
+ /** What `delete` reports. */
476
+ export interface PluginFamilyDeleteResult {
477
+ ok: boolean
478
+ familyId?: string
479
+ /** Instances deleted from the scene (only with `instances: true`), in one undoable command. */
480
+ removedInstances?: number
481
+ /** True when a library row was archived; false for an unsaved draft. */
482
+ archived?: boolean
442
483
  error?: string
443
484
  }
444
485
 
@@ -536,6 +577,20 @@ export const PluginDesignFamilyCreateArgs = z.object({
536
577
  })
537
578
  export type PluginDesignFamilyCreateArgs = z.infer<typeof PluginDesignFamilyCreateArgs>
538
579
 
580
+ /**
581
+ * Arguments for {@linkcode PluginDesignFamilyApi.delete}.
582
+ *
583
+ * | Property | Type | Description |
584
+ * |---|---|---|
585
+ * | `id` | `string` | Family to remove; omit for the prepared draft |
586
+ * | `instances` | `boolean` | Also delete this project's placed instances; default false |
587
+ */
588
+ export const PluginDesignFamilyDeleteArgs = z.object({
589
+ id: z.string().optional(),
590
+ instances: z.boolean().optional(),
591
+ })
592
+ export type PluginDesignFamilyDeleteArgs = z.infer<typeof PluginDesignFamilyDeleteArgs>
593
+
539
594
  /**
540
595
  * Arguments for {@linkcode PluginDesignFamilyApi.place}.
541
596
  *