@pascal-app/core 1.1.0 → 1.1.1

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 (124) hide show
  1. package/dist/agent-operations/__fixtures__/cases.d.ts +3 -2
  2. package/dist/agent-operations/__fixtures__/cases.d.ts.map +1 -1
  3. package/dist/agent-operations/__fixtures__/place-items-cases.d.ts.map +1 -1
  4. package/dist/agent-operations/__fixtures__/place-items-cases.js +28 -0
  5. package/dist/agent-operations/__fixtures__/roof-bearing-cases.d.ts +12209 -12209
  6. package/dist/agent-operations/asset-catalog.d.ts +21 -11
  7. package/dist/agent-operations/asset-catalog.d.ts.map +1 -1
  8. package/dist/agent-operations/asset-catalog.js +28 -10
  9. package/dist/agent-operations/asset-views.d.ts +8 -3
  10. package/dist/agent-operations/asset-views.d.ts.map +1 -1
  11. package/dist/agent-operations/asset-views.js +19 -3
  12. package/dist/agent-operations/batch.d.ts +7 -1
  13. package/dist/agent-operations/batch.d.ts.map +1 -1
  14. package/dist/agent-operations/batch.js +17 -2
  15. package/dist/agent-operations/catalog-asset.d.ts +15 -0
  16. package/dist/agent-operations/catalog-asset.d.ts.map +1 -0
  17. package/dist/agent-operations/catalog-asset.js +4 -0
  18. package/dist/agent-operations/circulation-spaces.d.ts +2963 -2963
  19. package/dist/agent-operations/design-brief.d.ts.map +1 -1
  20. package/dist/agent-operations/design-brief.js +2 -0
  21. package/dist/agent-operations/furnish-room.d.ts.map +1 -1
  22. package/dist/agent-operations/furnish-room.js +2 -1
  23. package/dist/agent-operations/index.d.ts +3 -0
  24. package/dist/agent-operations/index.d.ts.map +1 -1
  25. package/dist/agent-operations/index.js +4 -1
  26. package/dist/agent-operations/level-reads.d.ts.map +1 -1
  27. package/dist/agent-operations/level-reads.js +4 -1
  28. package/dist/agent-operations/place-in-room.d.ts.map +1 -1
  29. package/dist/agent-operations/place-in-room.js +2 -1
  30. package/dist/agent-operations/place-items.d.ts.map +1 -1
  31. package/dist/agent-operations/place-items.js +2 -1
  32. package/dist/agent-operations/scene-queries.d.ts +585 -585
  33. package/dist/agent-operations/scene-view.d.ts.map +1 -1
  34. package/dist/agent-operations/scene-view.js +38 -13
  35. package/dist/agent-operations/search-assets.d.ts.map +1 -1
  36. package/dist/agent-operations/search-assets.js +6 -0
  37. package/dist/agent-operations/types.d.ts +3 -2
  38. package/dist/agent-operations/types.d.ts.map +1 -1
  39. package/dist/agent-operations/usage-checks.js +18 -3
  40. package/dist/agent-tools/assets.js +1 -1
  41. package/dist/building/__fixtures__/wall-opening-cases.d.ts +234 -234
  42. package/dist/building/level-duplication.d.ts +3516 -3516
  43. package/dist/building/level-duplication.d.ts.map +1 -1
  44. package/dist/building/level-duplication.js +3 -1
  45. package/dist/building/wall-openings.d.ts +75 -75
  46. package/dist/commands/structure/shared.d.ts +3407 -3407
  47. package/dist/commands/structure/zone-wall-merge.d.ts +566 -566
  48. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +585 -585
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +2 -0
  52. package/dist/lib/__fixtures__/mezzanine.d.ts +9262 -9262
  53. package/dist/lib/absorb-wall-separators.d.ts +1344 -1344
  54. package/dist/lib/asset-storage.d.ts.map +1 -1
  55. package/dist/lib/asset-storage.js +3 -0
  56. package/dist/lib/floor-foundation-datum.d.ts.map +1 -1
  57. package/dist/lib/floor-foundation-datum.js +5 -1
  58. package/dist/lib/floorplan/context.d.ts +95 -0
  59. package/dist/lib/floorplan/context.d.ts.map +1 -0
  60. package/dist/lib/floorplan/context.js +155 -0
  61. package/dist/lib/floorplan/index.d.ts +6 -0
  62. package/dist/lib/floorplan/index.d.ts.map +1 -0
  63. package/dist/lib/floorplan/index.js +5 -0
  64. package/dist/lib/floorplan/marks.d.ts +71 -0
  65. package/dist/lib/floorplan/marks.d.ts.map +1 -0
  66. package/dist/lib/floorplan/marks.js +157 -0
  67. package/dist/lib/floorplan/plan-math.d.ts +18 -0
  68. package/dist/lib/floorplan/plan-math.d.ts.map +1 -0
  69. package/dist/lib/floorplan/plan-math.js +82 -0
  70. package/dist/lib/floorplan/svg-paths.d.ts +17 -0
  71. package/dist/lib/floorplan/svg-paths.d.ts.map +1 -0
  72. package/dist/lib/floorplan/svg-paths.js +92 -0
  73. package/dist/lib/floorplan/wall-affordances.d.ts +31 -0
  74. package/dist/lib/floorplan/wall-affordances.d.ts.map +1 -0
  75. package/dist/lib/floorplan/wall-affordances.js +24 -0
  76. package/dist/registry/__fixtures__/roof-planes.d.ts +69 -0
  77. package/dist/registry/__fixtures__/roof-planes.d.ts.map +1 -0
  78. package/dist/registry/__fixtures__/roof-planes.js +59 -0
  79. package/dist/registry/index.d.ts +2 -1
  80. package/dist/registry/index.d.ts.map +1 -1
  81. package/dist/registry/index.js +1 -0
  82. package/dist/registry/roofs.d.ts +34 -0
  83. package/dist/registry/roofs.d.ts.map +1 -0
  84. package/dist/registry/roofs.js +61 -0
  85. package/dist/registry/types.d.ts +30 -0
  86. package/dist/registry/types.d.ts.map +1 -1
  87. package/dist/registry/validate-relations.d.ts +5 -1
  88. package/dist/registry/validate-relations.d.ts.map +1 -1
  89. package/dist/registry/validate-relations.js +6 -2
  90. package/dist/schema/asset-url.d.ts +8 -0
  91. package/dist/schema/asset-url.d.ts.map +1 -1
  92. package/dist/schema/asset-url.js +17 -0
  93. package/dist/schema/nodes/roof.d.ts +1 -1
  94. package/dist/schema/nodes/roof.d.ts.map +1 -1
  95. package/dist/schema/nodes/roof.js +13 -8
  96. package/dist/schema/types.d.ts +1 -1
  97. package/dist/services/roof-level.d.ts.map +1 -1
  98. package/dist/services/roof-level.js +12 -2
  99. package/dist/services/roof-move.d.ts +4 -2
  100. package/dist/services/roof-move.d.ts.map +1 -1
  101. package/dist/services/roof-move.js +21 -9
  102. package/dist/spatial/usage-field/findings.d.ts +7 -1
  103. package/dist/spatial/usage-field/findings.d.ts.map +1 -1
  104. package/dist/spatial/usage-field/findings.js +42 -10
  105. package/dist/spatial/usage-field/path.d.ts.map +1 -1
  106. package/dist/spatial/usage-field/path.js +28 -18
  107. package/dist/store/actions/node-actions.d.ts +1641 -1641
  108. package/dist/store/scene-annotations.d.ts +1778 -1778
  109. package/dist/systems/document-reconcile.d.ts.map +1 -1
  110. package/dist/systems/document-reconcile.js +1 -2
  111. package/dist/systems/roof/roof-elevation.d.ts +11 -6
  112. package/dist/systems/roof/roof-elevation.d.ts.map +1 -1
  113. package/dist/systems/roof/roof-elevation.js +24 -11
  114. package/dist/systems/slab/__fixtures__/floor-step.d.ts +1622 -1622
  115. package/dist/systems/slab/__fixtures__/raised-room.d.ts +585 -585
  116. package/dist/systems/stair/stair-opening-preview.d.ts +1919 -1919
  117. package/dist/utils/ensure-scene-openings.d.ts +3409 -3409
  118. package/dist/utils/floor-plate-migration.d.ts +1344 -1344
  119. package/dist/utils/owned-floor-opening-migration.d.ts +1344 -1344
  120. package/dist/utils/reconcile-structure-on-load.d.ts +1641 -1641
  121. package/dist/utils/scene-bounds.d.ts +32 -0
  122. package/dist/utils/scene-bounds.d.ts.map +1 -0
  123. package/dist/utils/scene-bounds.js +201 -0
  124. package/package.json +1 -1
@@ -202,15 +202,8 @@ function pocketIssue(nodes, room, from) {
202
202
  approximate,
203
203
  };
204
204
  }
205
- /**
206
- * The usage findings of a scene: narrow passages (measured from the chosen entrance, one for each
207
- * place that is narrow with the rooms it leads to, and the best other door as a fact), missing turning circles, floor a 0.60 m unit cannot get out of, wall
208
- * objects that stand out into circulation, pieces inside something solid, what stands in front of a
209
- * window or a door, a bed's room, a room's headroom and its ceiling. Every threshold is an indicator,
210
- * not a compliance check.
211
- */
212
- export function usageIssues(nodes, options = {}) {
213
- const shapes = usageShapes(nodes);
205
+ /** The passages, turning circles and pockets of every group of rooms, measured on one clearance field. */
206
+ function circulationIssues(nodes, shapes, options) {
214
207
  const measure = measureUsage(nodes, shapes, options);
215
208
  const issues = [];
216
209
  for (const group of measure.groups) {
@@ -247,6 +240,45 @@ export function usageIssues(nodes, options = {}) {
247
240
  }
248
241
  }
249
242
  }
250
- issues.push(...clashIssues(nodes, shapes), ...blockedOpeningIssues(nodes, shapes), ...doorSwingIssues(nodes, shapes), ...entryIssues(nodes, shapes), ...doorOverStairIssues(nodes, shapes), ...fixtureClearanceIssues(nodes, shapes), ...bedIssues(nodes, shapes));
251
243
  return issues;
252
244
  }
245
+ /**
246
+ * Each measurement with the finding types it gives, in the order their findings are listed. On a
247
+ * building of a few hundred rooms the circulation measurement takes seconds and the others a
248
+ * fraction of one, so a question about some types takes the measurements that give them alone.
249
+ */
250
+ const MEASUREMENTS = [
251
+ {
252
+ types: ['usage_pocket', 'usage_passage_narrow', 'usage_turning_narrow'],
253
+ run: circulationIssues,
254
+ },
255
+ { types: ['usage_clash'], run: clashIssues },
256
+ {
257
+ types: ['usage_opening_blocked'],
258
+ run: (nodes, shapes) => blockedOpeningIssues(nodes, shapes),
259
+ },
260
+ { types: ['usage_door_swing'], run: doorSwingIssues },
261
+ { types: ['usage_entry_narrow'], run: entryIssues },
262
+ { types: ['usage_door_over_stair'], run: doorOverStairIssues },
263
+ { types: ['usage_fixture_clearance'], run: fixtureClearanceIssues },
264
+ { types: ['usage_bed_clearance'], run: bedIssues },
265
+ ];
266
+ /** Every finding type a measurement gives. */
267
+ export const USAGE_TYPES = new Set(MEASUREMENTS.flatMap((measurement) => measurement.types));
268
+ /**
269
+ * The usage findings of a scene: narrow passages (measured from the chosen entrance, one for each
270
+ * place that is narrow with the rooms it leads to, and the best other door as a fact), missing turning circles, floor a 0.60 m unit cannot get out of, wall
271
+ * objects that stand out into circulation, pieces inside something solid, what stands in front of a
272
+ * window or a door, a bed's room, a room's headroom and its ceiling. Every threshold is an indicator,
273
+ * not a compliance check.
274
+ */
275
+ export function usageIssues(nodes, options = {}) {
276
+ const { types, ...measure } = options;
277
+ const asked = types
278
+ ? MEASUREMENTS.filter((measurement) => measurement.types.some((type) => types.has(type)))
279
+ : MEASUREMENTS;
280
+ if (asked.length === 0)
281
+ return [];
282
+ const shapes = usageShapes(nodes);
283
+ return asked.flatMap((measurement) => measurement.run(nodes, shapes, measure));
284
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/spatial/usage-field/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAwB,KAAK,IAAI,EAAE,MAAM,SAAS,CAAA;AA2D3E;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,IAAI,EACP,CAAC,EAAE,YAAY,EACf,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GACxB;IAAE,CAAC,EAAE,YAAY,CAAC;IAAC,CAAC,EAAE,UAAU,CAAA;CAAE,CAiCpC;AAED,qGAAqG;AACrG,wBAAgB,MAAM,CACpB,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,YAAY,EACf,CAAC,EAAE,MAAM,GACR;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAOxC;AA8BD,qHAAqH;AACrH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,YAAY,CAkCzF;AA8FD,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CAAA;AAE1E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,IAAI,EACP,CAAC,EAAE,YAAY,EACf,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAC5C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK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ellX, cellZ } from './field.js';
2
- /** A binary min-heap on a numeric key. */
2
+ /** A binary min-heap on a numeric key. `pop` returns the value and leaves its key in `key`. */
3
3
  class Heap {
4
4
  keys = [];
5
5
  values = [];
6
+ key = 0;
6
7
  get size() {
7
8
  return this.keys.length;
8
9
  }
@@ -14,37 +15,45 @@ class Heap {
14
15
  values.push(value);
15
16
  while (i > 0) {
16
17
  const parent = (i - 1) >> 1;
17
- if (keys[i] >= keys[parent])
18
+ const above = keys[parent];
19
+ if (key >= above)
18
20
  break;
19
- [keys[i], keys[parent]] = [keys[parent], keys[i]];
20
- [values[i], values[parent]] = [values[parent], values[i]];
21
+ keys[i] = above;
22
+ values[i] = values[parent];
21
23
  i = parent;
22
24
  }
25
+ keys[i] = key;
26
+ values[i] = value;
23
27
  }
24
28
  pop() {
25
29
  const keys = this.keys;
26
30
  const values = this.values;
27
- const top = [keys[0], values[0]];
28
- const lastKey = keys.pop();
29
- const lastValue = values.pop();
30
- if (keys.length) {
31
- keys[0] = lastKey;
32
- values[0] = lastValue;
31
+ this.key = keys[0];
32
+ const top = values[0];
33
+ const key = keys.pop();
34
+ const value = values.pop();
35
+ const size = keys.length;
36
+ if (size) {
33
37
  let i = 0;
34
38
  for (;;) {
35
39
  const l = 2 * i + 1;
36
40
  const r = l + 1;
37
41
  let m = i;
38
- if (l < keys.length && keys[l] < keys[m])
42
+ let least = key;
43
+ if (l < size && keys[l] < least) {
39
44
  m = l;
40
- if (r < keys.length && keys[r] < keys[m])
45
+ least = keys[l];
46
+ }
47
+ if (r < size && keys[r] < least)
41
48
  m = r;
42
49
  if (m === i)
43
50
  break;
44
- [keys[i], keys[m]] = [keys[m], keys[i]];
45
- [values[i], values[m]] = [values[m], values[i]];
51
+ keys[i] = keys[m];
52
+ values[i] = values[m];
46
53
  i = m;
47
54
  }
55
+ keys[i] = key;
56
+ values[i] = value;
48
57
  }
49
58
  return top;
50
59
  }
@@ -72,11 +81,11 @@ export function widestPath(g, F, inside, sources) {
72
81
  heap.push(-F[s], s);
73
82
  }
74
83
  while (heap.size) {
75
- const [negative, c] = heap.pop();
84
+ const c = heap.pop();
76
85
  if (done[c])
77
86
  continue;
78
87
  done[c] = 1;
79
- const b = -negative;
88
+ const b = -heap.key;
80
89
  const i = c % g.W;
81
90
  const j = (c / g.W) | 0;
82
91
  for (const [di, dj] of FOUR) {
@@ -150,7 +159,8 @@ export function travel(g, pass, sources) {
150
159
  heap.push(0, s);
151
160
  }
152
161
  while (heap.size) {
153
- const [d, c] = heap.pop();
162
+ const c = heap.pop();
163
+ const d = heap.key;
154
164
  if (d > D[c])
155
165
  continue;
156
166
  const i = c % g.W;
@@ -322,7 +332,7 @@ export function shortestRoute(g, pass, from, to) {
322
332
  cost[from] = 0;
323
333
  heap.push(heuristic(from), from);
324
334
  while (heap.size) {
325
- const [, c] = heap.pop();
335
+ const c = heap.pop();
326
336
  if (c === to)
327
337
  break;
328
338
  const i = c % g.W;