@snaptrude/plugin-core 1.0.1 → 1.0.2-plainpoint-20261102.2

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 (112) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +6 -0
  3. package/api-manifest.json +1682 -118
  4. package/dist/api/core/camera/index.d.ts +16 -6
  5. package/dist/api/core/camera/index.d.ts.map +1 -1
  6. package/dist/api/core/comment/index.d.ts +7 -3
  7. package/dist/api/core/comment/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +69 -21
  9. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  10. package/dist/api/core/geom/query/circle.d.ts +31 -11
  11. package/dist/api/core/geom/query/circle.d.ts.map +1 -1
  12. package/dist/api/core/geom/query/contour.d.ts +19 -7
  13. package/dist/api/core/geom/query/contour.d.ts.map +1 -1
  14. package/dist/api/core/geom/query/curve.d.ts +72 -24
  15. package/dist/api/core/geom/query/curve.d.ts.map +1 -1
  16. package/dist/api/core/geom/query/profile.d.ts +19 -7
  17. package/dist/api/core/geom/query/profile.d.ts.map +1 -1
  18. package/dist/api/core/geom/update/contour.d.ts +36 -12
  19. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  20. package/dist/api/core/geom/update/curve.d.ts +13 -5
  21. package/dist/api/core/geom/update/curve.d.ts.map +1 -1
  22. package/dist/api/core/geom/update/profile.d.ts +36 -12
  23. package/dist/api/core/geom/update/profile.d.ts.map +1 -1
  24. package/dist/api/core/io/import/index.d.ts +7 -3
  25. package/dist/api/core/io/import/index.d.ts.map +1 -1
  26. package/dist/api/core/math/quat.d.ts +2 -2
  27. package/dist/api/core/math/quat.d.ts.map +1 -1
  28. package/dist/api/core/math/vec3.d.ts +15 -15
  29. package/dist/api/core/math/vec3.d.ts.map +1 -1
  30. package/dist/api/core/storeys/index.d.ts +5 -0
  31. package/dist/api/core/storeys/index.d.ts.map +1 -1
  32. package/dist/api/design/boolean/index.d.ts +20 -4
  33. package/dist/api/design/boolean/index.d.ts.map +1 -1
  34. package/dist/api/design/create/bulk-items.d.ts +84 -16
  35. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  36. package/dist/api/design/create/index.d.ts +134 -59
  37. package/dist/api/design/create/index.d.ts.map +1 -1
  38. package/dist/api/design/create/opening-fields.d.ts +18 -6
  39. package/dist/api/design/create/opening-fields.d.ts.map +1 -1
  40. package/dist/api/design/delete/index.d.ts +14 -7
  41. package/dist/api/design/delete/index.d.ts.map +1 -1
  42. package/dist/api/design/dimensions.d.ts +12 -4
  43. package/dist/api/design/dimensions.d.ts.map +1 -1
  44. package/dist/api/design/edit/index.d.ts +7 -3
  45. package/dist/api/design/edit/index.d.ts.map +1 -1
  46. package/dist/api/design/family.d.ts +5 -1
  47. package/dist/api/design/family.d.ts.map +1 -1
  48. package/dist/api/design/index.d.ts +5 -0
  49. package/dist/api/design/index.d.ts.map +1 -1
  50. package/dist/api/design/lock.d.ts +3 -0
  51. package/dist/api/design/lock.d.ts.map +1 -1
  52. package/dist/api/design/text.d.ts +400 -0
  53. package/dist/api/design/text.d.ts.map +1 -0
  54. package/dist/api/design/transform/index.d.ts +28 -8
  55. package/dist/api/design/transform/index.d.ts.map +1 -1
  56. package/dist/api/entity/space.d.ts +30 -6
  57. package/dist/api/entity/space.d.ts.map +1 -1
  58. package/dist/api/entity/story.d.ts +4 -0
  59. package/dist/api/entity/story.d.ts.map +1 -1
  60. package/dist/api/presentation/drawings.d.ts +46 -1
  61. package/dist/api/presentation/drawings.d.ts.map +1 -1
  62. package/dist/api/presentation/graphics.d.ts +4 -0
  63. package/dist/api/presentation/graphics.d.ts.map +1 -1
  64. package/dist/api/presentation/placedViews.d.ts +29 -1
  65. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  66. package/dist/api/presentation/standards.d.ts +14 -0
  67. package/dist/api/presentation/standards.d.ts.map +1 -1
  68. package/dist/api/presentation/views.d.ts +5 -1
  69. package/dist/api/presentation/views.d.ts.map +1 -1
  70. package/dist/handles.d.ts +8 -0
  71. package/dist/handles.d.ts.map +1 -1
  72. package/dist/index.cjs +2298 -2179
  73. package/dist/index.cjs.map +1 -1
  74. package/dist/index.js +2285 -2179
  75. package/dist/index.js.map +1 -1
  76. package/package.json +13 -13
  77. package/src/api/core/camera/index.ts +9 -7
  78. package/src/api/core/comment/index.ts +3 -3
  79. package/src/api/core/geom/create/index.ts +25 -25
  80. package/src/api/core/geom/query/circle.ts +11 -11
  81. package/src/api/core/geom/query/contour.ts +7 -6
  82. package/src/api/core/geom/query/curve.ts +25 -25
  83. package/src/api/core/geom/query/profile.ts +7 -6
  84. package/src/api/core/geom/update/contour.ts +12 -11
  85. package/src/api/core/geom/update/curve.ts +5 -5
  86. package/src/api/core/geom/update/profile.ts +12 -11
  87. package/src/api/core/io/import/index.ts +3 -2
  88. package/src/api/core/math/quat.ts +2 -2
  89. package/src/api/core/math/vec3.ts +16 -16
  90. package/src/api/core/storeys/index.ts +5 -0
  91. package/src/api/design/boolean/index.ts +2 -2
  92. package/src/api/design/create/bulk-items.ts +7 -2
  93. package/src/api/design/create/index.ts +34 -46
  94. package/src/api/design/create/opening-fields.ts +7 -7
  95. package/src/api/design/delete/index.ts +14 -7
  96. package/src/api/design/dimensions.ts +5 -4
  97. package/src/api/design/edit/index.ts +3 -3
  98. package/src/api/design/family.ts +2 -1
  99. package/src/api/design/index.ts +5 -0
  100. package/src/api/design/lock.ts +6 -0
  101. package/src/api/design/text.ts +394 -0
  102. package/src/api/design/transform/index.ts +15 -7
  103. package/src/api/entity/space.ts +5 -4
  104. package/src/api/entity/story.ts +4 -0
  105. package/src/api/presentation/graphics.ts +4 -1
  106. package/src/api/presentation/placedViews.ts +12 -0
  107. package/src/api/presentation/standards.ts +6 -0
  108. package/src/api/presentation/views.ts +7 -2
  109. package/src/handles.ts +11 -0
  110. package/test/designText.test.mjs +72 -0
  111. package/test/handles.test.mjs +36 -0
  112. package/test/paperPensContract.test.mjs +39 -0
@@ -0,0 +1,72 @@
1
+ // The design.text argument contract, checked before transport.
2
+ // Run: node --test test/
3
+ // Imports the BUILT package (dist) — run `pnpm build` first.
4
+ import test from "node:test"
5
+ import assert from "node:assert/strict"
6
+ import {
7
+ PluginDesignTextCreateArgs,
8
+ PluginDesignTextUpdateArgs,
9
+ PluginTextPatch,
10
+ } from "../dist/index.js"
11
+
12
+ const position = "vec3_position"
13
+
14
+ test("create takes one non-blank line of words", () => {
15
+ assert.equal(
16
+ PluginDesignTextCreateArgs.safeParse({ position, content: "LIVING" })
17
+ .success,
18
+ true,
19
+ )
20
+ for (const content of ["", " ", "two\nlines", "two\r\nlines"])
21
+ assert.equal(
22
+ PluginDesignTextCreateArgs.safeParse({ position, content }).success,
23
+ false,
24
+ JSON.stringify(content),
25
+ )
26
+ })
27
+
28
+ test("create takes a #rrggbb colour and a vec3 handle for the arrowhead", () => {
29
+ const ok = {
30
+ position,
31
+ content: "Shear wall",
32
+ color: "#c62828",
33
+ arrowhead: "vec3_head",
34
+ }
35
+ assert.equal(PluginDesignTextCreateArgs.safeParse(ok).success, true)
36
+ for (const color of ["red", "#12345", "c62828"])
37
+ assert.equal(
38
+ PluginDesignTextCreateArgs.safeParse({ ...ok, color }).success,
39
+ false,
40
+ color,
41
+ )
42
+ for (const arrowhead of [{ x: 1, y: 0, z: 2 }, "component_1", "quat_1"])
43
+ assert.equal(
44
+ PluginDesignTextCreateArgs.safeParse({ ...ok, arrowhead }).success,
45
+ false,
46
+ JSON.stringify(arrowhead),
47
+ )
48
+ })
49
+
50
+ test("an update patch sets at least one known field", () => {
51
+ assert.deepEqual(PluginTextPatch.parse({ fontStyle: "Bold" }), {
52
+ fontStyle: "Bold",
53
+ })
54
+ for (const patch of [
55
+ {},
56
+ { size: 3 },
57
+ { content: "Fire exit", rotation: 90 },
58
+ { content: " " },
59
+ ])
60
+ assert.equal(
61
+ PluginTextPatch.safeParse(patch).success,
62
+ false,
63
+ JSON.stringify(patch),
64
+ )
65
+ assert.equal(
66
+ PluginDesignTextUpdateArgs.safeParse({
67
+ texts: [],
68
+ patch: { color: "#1565c0" },
69
+ }).success,
70
+ false,
71
+ )
72
+ })
@@ -0,0 +1,36 @@
1
+ // Node built-in test runner suite for the handle schemas.
2
+ // Imports the BUILT package (dist) — run `pnpm build` first.
3
+ import test from "node:test"
4
+ import assert from "node:assert/strict"
5
+ import { Vec3Handle, Vec3Input, Handle, PluginDesignMoveArgs } from "../dist/index.js"
6
+
7
+ test("a vec3 handle parses in every inbound form, and only as a handle", () => {
8
+ for (const v of ["vec3_abc", new Handle("vec3_abc"), { __h: "vec3_abc" }, { id: "vec3_abc" }]) {
9
+ const out = Vec3Handle.parse(v)
10
+ assert.ok(out instanceof Handle)
11
+ assert.equal(out.id, "vec3_abc")
12
+ }
13
+ assert.equal(Vec3Handle.safeParse({ x: 1, y: 2, z: 3 }).success, false)
14
+ const bad = Vec3Handle.safeParse("profile_1")
15
+ assert.equal(bad.success, false)
16
+ assert.match(bad.error.issues[0].message, /expected a "vec3" handle/)
17
+ })
18
+
19
+ test("Vec3Input takes a handle or a plain { x, y, z } point", () => {
20
+ // Geometry reads return plain points; agents pass them back where a vec3 belongs.
21
+ const point = { x: 1, y: 2.5, z: -3 }
22
+ assert.deepEqual(Vec3Input.parse(point), point)
23
+ assert.ok(Vec3Input.parse("vec3_abc") instanceof Handle)
24
+ const args = PluginDesignMoveArgs.parse({ components: ["wl_1"], displacement: { x: 0, y: 0, z: 10 } })
25
+ assert.deepEqual(args.displacement, { x: 0, y: 0, z: 10 })
26
+ const handled = PluginDesignMoveArgs.parse({ components: ["wl_1"], displacement: "vec3_d" })
27
+ assert.equal(handled.displacement.id, "vec3_d")
28
+ })
29
+
30
+ test("Vec3Input still rejects non-points and wrong handles, with one message", () => {
31
+ for (const v of [{ x: 1, y: 2 }, { x: 1, y: Number.NaN, z: 3 }, { x: "1", y: 2, z: 3 }, "profile_1", null, 42]) {
32
+ const r = Vec3Input.safeParse(v)
33
+ assert.equal(r.success, false, JSON.stringify(v))
34
+ assert.equal(r.error.issues[0].message, 'expected a "vec3" handle or a plain { x, y, z } point')
35
+ }
36
+ })
@@ -2,7 +2,10 @@ import { test } from "node:test"
2
2
  import assert from "node:assert/strict"
3
3
  import {
4
4
  PluginGraphicStandardPatch,
5
+ PluginGraphicsAnnotationCategory,
6
+ PluginGraphicsOverrideCategory,
5
7
  PluginGraphicsOverrides,
8
+ PluginResolvedGraphicStandard,
6
9
  PluginGraphicsSetScaleArgs,
7
10
  PluginDesignCreateReferenceLinesArgs,
8
11
  PluginReferenceLineOptions,
@@ -36,6 +39,42 @@ test("Paper Pens rejects ambiguous, ineffective and stock-writing edits before t
36
39
  assert.deepEqual(PluginGraphicStandardPatch.parse(patch), patch)
37
40
  })
38
41
 
42
+ test("Text is an annotation category with a projection pen and a size, but no view override", () => {
43
+ assert.equal(PluginGraphicsAnnotationCategory.safeParse("Text").success, true)
44
+ assert.equal(PluginGraphicsOverrideCategory.safeParse("Text").success, false)
45
+ assert.equal(
46
+ PluginGraphicsOverrides.safeParse({ Text: { hidden: true } }).success,
47
+ false,
48
+ )
49
+ for (const patch of [
50
+ { annotationText: { Text: { textMm: 3.5 } } },
51
+ { annotationText: { Text: { textMm: null } } },
52
+ { objectStyles: { Text: { projection: 2 } } },
53
+ ])
54
+ assert.deepEqual(PluginGraphicStandardPatch.parse(patch), patch)
55
+ for (const patch of [
56
+ { annotationText: { Text: { textMm: 0 } } },
57
+ { annotationText: { Text: { sizeMm: 3 } } },
58
+ { objectStyles: { Text: { cut: 2 } } },
59
+ ])
60
+ assert.equal(PluginGraphicStandardPatch.safeParse(patch).success, false)
61
+ const text = {
62
+ nameMm: 3,
63
+ areaMm: 2.5,
64
+ dimensionMm: 2.5,
65
+ gridTextMm: 3.5,
66
+ gridBubbleRadiusMm: 5,
67
+ sectionTextMm: 3,
68
+ sectionHeadRadiusMm: 6,
69
+ }
70
+ const resolvedText = PluginResolvedGraphicStandard.shape.text
71
+ assert.equal(resolvedText.safeParse(text).success, false)
72
+ assert.equal(
73
+ resolvedText.safeParse({ ...text, annotationMm: 2.5 }).success,
74
+ true,
75
+ )
76
+ })
77
+
39
78
  test("explicit reference styles cannot conflict with legacy fields or mixed call forms", () => {
40
79
  assert.equal(
41
80
  PluginReferenceLineOptions.safeParse({ styleId: "wide", thickness: 3 })