@reekon-tools/boldr-utils 1.6.18 → 1.6.19

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 (82) hide show
  1. package/dist/annotation/canvas/AnnotationCanvasInner.js +7 -1
  2. package/dist/annotation/canvas/AnnotationCanvasInner.native.js +58 -5
  3. package/dist/annotation/canvas/AnnotationCanvasSkia.d.ts +5 -1
  4. package/dist/annotation/canvas/AnnotationCanvasSkia.js +53 -4
  5. package/dist/annotation/canvas/Tool.d.ts +5 -2
  6. package/dist/annotation/canvas/measurementGeometry.d.ts +1 -1
  7. package/dist/annotation/canvas/measurementGeometry.js +3 -2
  8. package/dist/annotation/canvas/stampLayout.d.ts +7 -1
  9. package/dist/annotation/canvas/stampLayout.js +66 -5
  10. package/dist/annotation/canvas/tools/measurementLineTool.d.ts +12 -0
  11. package/dist/annotation/canvas/tools/measurementLineTool.js +95 -0
  12. package/dist/annotation/canvas/tools/panTool.js +1 -1
  13. package/dist/annotation/canvas/tools/selectTool.js +75 -9
  14. package/dist/annotation/canvas/useAnnotationCanvasState.d.ts +1 -0
  15. package/dist/annotation/canvas/useAnnotationCanvasState.js +9 -0
  16. package/dist/exports.d.ts +1 -0
  17. package/dist/exports.js +1 -0
  18. package/dist/types/annotation.d.ts +4 -0
  19. package/dist/types/annotation.js +6 -0
  20. package/dist/types/firestore.d.ts +53 -0
  21. package/dist/types/firestore.js +49 -0
  22. package/package.json +1 -1
  23. package/dist/canvas/AnnotationCanvas.d.ts +0 -11
  24. package/dist/canvas/AnnotationCanvas.js +0 -10
  25. package/dist/canvas/AnnotationCanvas.native.d.ts +0 -8
  26. package/dist/canvas/AnnotationCanvas.native.js +0 -6
  27. package/dist/canvas/AnnotationCanvasInner.d.ts +0 -39
  28. package/dist/canvas/AnnotationCanvasInner.js +0 -219
  29. package/dist/canvas/AnnotationCanvasInner.native.d.ts +0 -35
  30. package/dist/canvas/AnnotationCanvasInner.native.js +0 -138
  31. package/dist/canvas/AnnotationCanvasSkia.d.ts +0 -27
  32. package/dist/canvas/AnnotationCanvasSkia.js +0 -20
  33. package/dist/canvas/Tool.d.ts +0 -38
  34. package/dist/canvas/Tool.js +0 -1
  35. package/dist/canvas/elements/BackgroundImageElement.d.ts +0 -9
  36. package/dist/canvas/elements/BackgroundImageElement.js +0 -37
  37. package/dist/canvas/elements/MeasurementStampElement.d.ts +0 -13
  38. package/dist/canvas/elements/MeasurementStampElement.js +0 -30
  39. package/dist/canvas/elements/ShapeElement.d.ts +0 -7
  40. package/dist/canvas/elements/ShapeElement.js +0 -62
  41. package/dist/canvas/elements/StrokeElement.d.ts +0 -7
  42. package/dist/canvas/elements/StrokeElement.js +0 -18
  43. package/dist/canvas/measurementPicker.d.ts +0 -10
  44. package/dist/canvas/measurementPicker.js +0 -1
  45. package/dist/canvas/measurementStampOverlay.d.ts +0 -11
  46. package/dist/canvas/measurementStampOverlay.js +0 -1
  47. package/dist/canvas/pointerAdapter.d.ts +0 -3
  48. package/dist/canvas/pointerAdapter.js +0 -19
  49. package/dist/canvas/stampLayout.d.ts +0 -5
  50. package/dist/canvas/stampLayout.js +0 -14
  51. package/dist/canvas/tools/measurementStampTool.d.ts +0 -9
  52. package/dist/canvas/tools/measurementStampTool.js +0 -37
  53. package/dist/canvas/tools/panTool.d.ts +0 -5
  54. package/dist/canvas/tools/panTool.js +0 -25
  55. package/dist/canvas/tools/penTool.d.ts +0 -13
  56. package/dist/canvas/tools/penTool.js +0 -68
  57. package/dist/canvas/tools/selectTool.d.ts +0 -2
  58. package/dist/canvas/tools/selectTool.js +0 -182
  59. package/dist/canvas/useAnnotationCanvasState.d.ts +0 -54
  60. package/dist/canvas/useAnnotationCanvasState.js +0 -210
  61. package/dist/canvas/viewport.d.ts +0 -16
  62. package/dist/canvas/viewport.js +0 -54
  63. package/dist/data/AnnotationDataContext.d.ts +0 -8
  64. package/dist/data/AnnotationDataContext.js +0 -11
  65. package/dist/data/AnnotationDataProvider.d.ts +0 -65
  66. package/dist/data/AnnotationDataProvider.js +0 -4
  67. package/dist/data/InMemoryAnnotationProvider.d.ts +0 -30
  68. package/dist/data/InMemoryAnnotationProvider.js +0 -197
  69. package/dist/data/canvasPersistence.d.ts +0 -3
  70. package/dist/data/canvasPersistence.js +0 -26
  71. package/dist/data/hooks/useAnnotationCanvasDoc.d.ts +0 -33
  72. package/dist/data/hooks/useAnnotationCanvasDoc.js +0 -314
  73. package/dist/data/hooks/useAnnotationDoc.d.ts +0 -7
  74. package/dist/data/hooks/useAnnotationDoc.js +0 -33
  75. package/dist/data/hooks/useAnnotationList.d.ts +0 -7
  76. package/dist/data/hooks/useAnnotationList.js +0 -26
  77. package/dist/data/hooks/useAnnotationMutations.d.ts +0 -9
  78. package/dist/data/hooks/useAnnotationMutations.js +0 -11
  79. package/dist/hooks/useParseMeasurement.d.ts +0 -4
  80. package/dist/hooks/useParseMeasurement.js +0 -14
  81. package/dist/utils/evaluateFormula.d.ts +0 -20
  82. package/dist/utils/evaluateFormula.js +0 -31
@@ -37,11 +37,11 @@ const segmentDistanceSq = (px, py, ax, ay, bx, by) => {
37
37
  const dy = py - cy;
38
38
  return dx * dx + dy * dy;
39
39
  };
40
- const findHit = (doc, world, zoom) => {
40
+ const findHit = (doc, world, zoom, viewportTileScale = 1) => {
41
41
  // Hit-test in z-order (top first): measurements > shapes > strokes.
42
42
  for (let i = doc.placedMeasurements.length - 1; i >= 0; i--) {
43
43
  const m = doc.placedMeasurements[i];
44
- if (hitPlacedMeasurement(m, world, zoom)) {
44
+ if (hitPlacedMeasurement(m, world, zoom, doc.tileScaleFactor, viewportTileScale)) {
45
45
  return { id: m.id, kind: 'measurement' };
46
46
  }
47
47
  }
@@ -128,12 +128,16 @@ const translatePatch = (elementKind, id, doc, delta) => {
128
128
  // via DragSelectionConfig AND the web pointer handlers — one source of truth) ---
129
129
  // Grabbing the tile of a line annotation slides it along the line; everything
130
130
  // else (bare stamps, grabs on the line body) is a group move.
131
- const classifyGrab = (doc, id, world, zoom) => {
131
+ const classifyGrab = (doc, id, world, zoom, viewportTileScale = 1) => {
132
132
  const m = doc.placedMeasurements.find((x) => x.id === id);
133
133
  if (!m)
134
134
  return 'move';
135
- // Same footprint the tile is drawn at (smaller for unassociated inputs, #6).
136
- const half = (stampTileSize(m) / 2 + HIT_PADDING) / zoom;
135
+ // Same footprint the tile is drawn at (smaller for unassociated inputs, #6;
136
+ // folds in the document-wide tile scale + viewport scale so slide-grab
137
+ // matches the draw).
138
+ const half = (stampTileSize(m, doc.tileScaleFactor, viewportTileScale) / 2 +
139
+ HIT_PADDING) /
140
+ zoom;
137
141
  const onTile = Math.abs(world.x - m.anchor.x) <= half &&
138
142
  Math.abs(world.y - m.anchor.y) <= half;
139
143
  return onTile && placementOf(m) === 'line' && m.line ? 'slide' : 'move';
@@ -190,6 +194,48 @@ const endpointPatch = (doc, id, handle, delta) => {
190
194
  const anchor = recomputeAnchor(line, 'line', linePosOf(m), m.anchor);
191
195
  return { ops: [{ op: 'updateMeasurement', id, patch: { line, anchor } }] };
192
196
  };
197
+ // Which endpoint handle of a (selected) line/arrow SHAPE is under `world`.
198
+ // Shape lines store their endpoints as geometry.points[0]/[1] (unlike
199
+ // measurement lines, which carry them on `line.a/b` alongside a tile). Prefers
200
+ // the nearer endpoint when both are within range.
201
+ const findShapeHandleHit = (doc, id, world, zoom) => {
202
+ const s = doc.shapes.find((x) => x.id === id);
203
+ if (!s || (s.kind !== 'line' && s.kind !== 'arrow'))
204
+ return null;
205
+ const [a, b] = s.geometry.points;
206
+ if (!a || !b)
207
+ return null;
208
+ const r2 = (HANDLE_GRAB_PX / zoom) ** 2;
209
+ const da = (world.x - a.x) ** 2 + (world.y - a.y) ** 2;
210
+ const db = (world.x - b.x) ** 2 + (world.y - b.y) ** 2;
211
+ if (da <= r2 && da <= db)
212
+ return 'a';
213
+ if (db <= r2)
214
+ return 'b';
215
+ return null;
216
+ };
217
+ // Move one endpoint of a line/arrow shape by a world delta (resize/rotate).
218
+ // Rewrites the whole geometry (updateShape merges shallowly at the top level,
219
+ // so `closed` and any other geometry fields must be carried through).
220
+ const shapeEndpointPatch = (doc, id, handle, delta) => {
221
+ const s = doc.shapes.find((x) => x.id === id);
222
+ if (!s || (s.kind !== 'line' && s.kind !== 'arrow'))
223
+ return null;
224
+ const [a, b] = s.geometry.points;
225
+ if (!a || !b)
226
+ return null;
227
+ const na = handle === 'a' ? { x: a.x + delta.x, y: a.y + delta.y } : a;
228
+ const nb = handle === 'b' ? { x: b.x + delta.x, y: b.y + delta.y } : b;
229
+ return {
230
+ ops: [
231
+ {
232
+ op: 'updateShape',
233
+ id,
234
+ patch: { geometry: { ...s.geometry, points: [na, nb] } },
235
+ },
236
+ ],
237
+ };
238
+ };
193
239
  // Which corner handle of a (selected) rectangle annotation is under `world`.
194
240
  // Prefers the nearest corner when several are within range (small rects).
195
241
  const findRectCornerHit = (doc, id, world, zoom) => {
@@ -272,7 +318,11 @@ const resizePatch = (doc, id, delta) => {
272
318
  // Patch for the current drag mode (web pointer path), from a world-space delta.
273
319
  const dragPatch = (s, doc, delta, zoom) => {
274
320
  if (s.mode === 'endpoint' && s.handle) {
275
- return endpointPatch(doc, s.id, s.handle, delta);
321
+ // Shape lines and measurement lines store endpoints differently, so the
322
+ // patch builder is keyed on which kind is being dragged.
323
+ return s.elementKind === 'shape'
324
+ ? shapeEndpointPatch(doc, s.id, s.handle, delta)
325
+ : endpointPatch(doc, s.id, s.handle, delta);
276
326
  }
277
327
  if (s.mode === 'slide')
278
328
  return slidePatch(doc, s.id, delta, zoom);
@@ -292,7 +342,7 @@ export const createSelectTool = () => ({
292
342
  // reusing the same hit-test and translate logic the pointer handlers below
293
343
  // use for web — one source of truth.
294
344
  dragSelection: {
295
- hitTest: (doc, world, zoom) => findHit(doc, world, zoom),
345
+ hitTest: (doc, world, zoom, viewportTileScale) => findHit(doc, world, zoom, viewportTileScale),
296
346
  buildTranslatePatch: (doc, id, kind, delta) => {
297
347
  const op = translatePatch(kind, id, doc, delta);
298
348
  return op ? { ops: [op] } : null;
@@ -301,6 +351,8 @@ export const createSelectTool = () => ({
301
351
  buildSlidePatch: slidePatch,
302
352
  hitTestHandle: findHandleHit,
303
353
  buildEndpointPatch: endpointPatch,
354
+ hitTestShapeHandle: findShapeHandleHit,
355
+ buildShapeEndpointPatch: shapeEndpointPatch,
304
356
  hitTestResizeHandle: findResizeHandleHit,
305
357
  buildResizePatch: resizePatch,
306
358
  hitTestRectCorner: findRectCornerHit,
@@ -328,6 +380,19 @@ export const createSelectTool = () => ({
328
380
  delta: { x: 0, y: 0 },
329
381
  };
330
382
  }
383
+ const shapeHandle = findShapeHandleHit(ctx.document, selId, world, zoom);
384
+ if (shapeHandle) {
385
+ ctx.setSelection({ ids: [selId] });
386
+ return {
387
+ kind: 'dragging',
388
+ id: selId,
389
+ elementKind: 'shape',
390
+ mode: 'endpoint',
391
+ handle: shapeHandle,
392
+ start: world,
393
+ delta: { x: 0, y: 0 },
394
+ };
395
+ }
331
396
  if (findResizeHandleHit(ctx.document, selId, world, zoom)) {
332
397
  return {
333
398
  kind: 'dragging',
@@ -352,14 +417,15 @@ export const createSelectTool = () => ({
352
417
  };
353
418
  }
354
419
  }
355
- const hit = findHit(ctx.document, world, zoom);
420
+ const hit = findHit(ctx.document, world, zoom, ctx.tileViewportScale);
356
421
  if (!hit) {
357
422
  ctx.setSelection(null);
358
423
  return { kind: 'idle' };
359
424
  }
360
425
  ctx.setSelection({ ids: [hit.id] });
361
426
  const mode = hit.kind === 'measurement' &&
362
- classifyGrab(ctx.document, hit.id, world, zoom) === 'slide'
427
+ classifyGrab(ctx.document, hit.id, world, zoom, ctx.tileViewportScale) ===
428
+ 'slide'
363
429
  ? 'slide'
364
430
  : 'move';
365
431
  return {
@@ -49,6 +49,7 @@ export interface AnnotationCanvasStateApi {
49
49
  activeTool: Tool | null;
50
50
  toolState: ToolState;
51
51
  ctx: ToolContext;
52
+ tileViewportScale: number;
52
53
  penDrawingStroke: AnnotationStroke | null;
53
54
  customPreviewState: ToolState;
54
55
  dispatchPointerDown(event: CanvasPointerEvent): void;
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { applyPatch, invertPatch, DEFAULT_LAYER_ID, } from '../../types/annotation.js';
3
3
  import { createViewportApi, panBy, zoomAt, DEFAULT_VIEWPORT, } from './viewport.js';
4
4
  import { recomputeAnchor, rectCenter, DEFAULT_LINE_POS, } from './measurementGeometry.js';
5
+ import { viewportTileScale } from './stampLayout.js';
5
6
  // Platform-agnostic state machine for the annotation canvas. Web and native
6
7
  // inners share this hook; each wraps it with platform-specific event
7
8
  // capture and JSX (div + DOM events vs. GestureDetector + RN Views).
@@ -21,10 +22,16 @@ export const useAnnotationCanvasState = (props) => {
21
22
  return map;
22
23
  }, [measurements]);
23
24
  const viewportApi = useMemo(() => createViewportApi(viewport), [viewport]);
25
+ // How large the document renders when fit to this canvas, as a tile-footprint
26
+ // multiplier (zoom-independent). Keeps tiles a consistent fraction of the
27
+ // drawing on a phone vs a desktop pane. Used by the overlays (drawn size) and
28
+ // the tools (hit box) so both agree.
29
+ const tileViewportScale = useMemo(() => viewportTileScale(width, height, canvas.viewport.width, canvas.viewport.height), [width, height, canvas.viewport.width, canvas.viewport.height]);
24
30
  const ctx = useMemo(() => ({
25
31
  document: canvas,
26
32
  selection,
27
33
  viewport: viewportApi,
34
+ tileViewportScale,
28
35
  preview(patch) {
29
36
  setPreviewPatch(patch);
30
37
  },
@@ -56,6 +63,7 @@ export const useAnnotationCanvasState = (props) => {
56
63
  canvas,
57
64
  selection,
58
65
  viewportApi,
66
+ tileViewportScale,
59
67
  onCommit,
60
68
  onSelectionChange,
61
69
  pickMeasurement,
@@ -361,6 +369,7 @@ export const useAnnotationCanvasState = (props) => {
361
369
  activeTool,
362
370
  toolState,
363
371
  ctx,
372
+ tileViewportScale,
364
373
  penDrawingStroke,
365
374
  customPreviewState: toolState,
366
375
  dispatchPointerDown,
package/dist/exports.d.ts CHANGED
@@ -21,6 +21,7 @@ export type { GestureConfig, PanTrigger, AnnotationCanvasInnerProps, } from './a
21
21
  export type { CanvasPointerEvent, RequestTextInput, ShapeDrawConfig, Tool, ToolContext, ToolState, } from './annotation/canvas/Tool.js';
22
22
  export type { MeasurementRef, PickMeasurement, } from './annotation/canvas/measurementPicker.js';
23
23
  export type { MeasurementStampRenderArgs, RenderMeasurementStamp, } from './annotation/canvas/measurementStampOverlay.js';
24
+ export { STAMP_TILE_SIZE, STAMP_INPUT_TILE_SIZE, DEFAULT_TILE_SCALE, TILE_SCALE_MIN, TILE_SCALE_MAX, clampTileScale, stampTileSize, isUnassociatedStamp, } from './annotation/canvas/stampLayout.js';
24
25
  export { createViewportApi, fitToScreen, panBy, zoomAt, DEFAULT_VIEWPORT, type ViewportApi, type ViewportState, } from './annotation/canvas/viewport.js';
25
26
  export { createPenTool, type PenToolOptions, } from './annotation/canvas/tools/penTool.js';
26
27
  export { createSelectTool } from './annotation/canvas/tools/selectTool.js';
package/dist/exports.js CHANGED
@@ -21,6 +21,7 @@ export { useAnnotationMutations, } from './annotation/data/hooks/useAnnotationMu
21
21
  export { useAnnotationCanvasDoc, } from './annotation/data/hooks/useAnnotationCanvasDoc.js';
22
22
  export { hydrateCanvasState } from './annotation/data/canvasPersistence.js';
23
23
  export { InMemoryAnnotationProvider } from './annotation/data/InMemoryAnnotationProvider.js';
24
+ export { STAMP_TILE_SIZE, STAMP_INPUT_TILE_SIZE, DEFAULT_TILE_SCALE, TILE_SCALE_MIN, TILE_SCALE_MAX, clampTileScale, stampTileSize, isUnassociatedStamp, } from './annotation/canvas/stampLayout.js';
24
25
  export { createViewportApi, fitToScreen, panBy, zoomAt, DEFAULT_VIEWPORT, } from './annotation/canvas/viewport.js';
25
26
  export { createPenTool, } from './annotation/canvas/tools/penTool.js';
26
27
  export { createSelectTool } from './annotation/canvas/tools/selectTool.js';
@@ -103,6 +103,7 @@ export interface AnnotationCanvasState {
103
103
  strokes: AnnotationStroke[];
104
104
  shapes: AnnotationShape[];
105
105
  placedMeasurements: PlacedMeasurementRef[];
106
+ tileScaleFactor?: number;
106
107
  externalPayloadPath?: string;
107
108
  }
108
109
  export type AnnotationElement = (AnnotationStroke & {
@@ -148,6 +149,9 @@ export type AnnotationPatchOp = {
148
149
  } | {
149
150
  op: 'setViewport';
150
151
  patch: Partial<AnnotationViewport>;
152
+ } | {
153
+ op: 'setTileScaleFactor';
154
+ value: number;
151
155
  } | {
152
156
  op: 'setLayers';
153
157
  layers: AnnotationLayer[];
@@ -67,6 +67,8 @@ const applyOp = (state, op) => {
67
67
  };
68
68
  case 'setViewport':
69
69
  return { ...state, viewport: { ...state.viewport, ...op.patch } };
70
+ case 'setTileScaleFactor':
71
+ return { ...state, tileScaleFactor: op.value };
70
72
  case 'setLayers':
71
73
  return { ...state, layers: op.layers };
72
74
  }
@@ -141,6 +143,10 @@ const invertOp = (before, op) => {
141
143
  }
142
144
  return { op: 'setViewport', patch: inversePatch };
143
145
  }
146
+ case 'setTileScaleFactor':
147
+ // Restore the prior factor; absent → an explicit 1 (visually identical to
148
+ // absent), keeping the op's `value: number` contract.
149
+ return { op: 'setTileScaleFactor', value: before.tileScaleFactor ?? 1 };
144
150
  case 'setLayers':
145
151
  return { op: 'setLayers', layers: before.layers };
146
152
  }
@@ -427,6 +427,53 @@ export declare enum DecimalTolerance {
427
427
  Hundredth = "0.01",
428
428
  Thousandth = "0.001"
429
429
  }
430
+ /**
431
+ * Trade/industry a user works in. Collected during registration to personalize
432
+ * the experience. String values are stable identifiers safe for persistence and
433
+ * analytics; they double as i18n key suffixes (e.g. `trades.iron_worker`).
434
+ */
435
+ export declare enum UserTrades {
436
+ Woodworking = "woodworking",
437
+ Plumbing = "plumbing",
438
+ Electrical = "electrical",
439
+ Structural = "structural",
440
+ Framing = "framing",
441
+ Carpenter = "carpenter",
442
+ IronWorker = "iron_worker",
443
+ Joiners = "joiners",
444
+ HVAC = "hvac",
445
+ Painting = "painting",
446
+ GC = "gc",
447
+ IT = "it",
448
+ Surveying = "surveying",
449
+ Pipefitter = "pipe_fitter",
450
+ Drywall = "drywall",
451
+ Welding = "welding",
452
+ Flooring = "flooring",
453
+ Decking = "decking",
454
+ Tile = "tile",
455
+ DIY = "diy",
456
+ Other = "other"
457
+ }
458
+ /**
459
+ * Role a user holds within their trade. Collected during registration. String
460
+ * values double as i18n key suffixes (e.g. `roles.project_manager`).
461
+ */
462
+ export declare enum UserRoles {
463
+ Apprentice = "apprentice",
464
+ Journeyman = "journeyman",
465
+ Owner = "owner",
466
+ ProjectManager = "project_manager",
467
+ Supervisor = "supervisor",
468
+ Foreman = "foreman",
469
+ Superintendent = "superintendent",
470
+ Estimator = "estimator",
471
+ OfficeManager = "office_manager",
472
+ Operator = "operator",
473
+ Laborer = "laborer",
474
+ Engineer = "engineer",
475
+ Safety = "safety"
476
+ }
430
477
  export interface UserDocument extends FirestoreDoc, Timestamps {
431
478
  defaultOrganization: string;
432
479
  displayName: string;
@@ -440,6 +487,12 @@ export interface UserDocument extends FirestoreDoc, Timestamps {
440
487
  printLabelSize: string;
441
488
  printLogoFileId: string;
442
489
  devices?: Record<string, string>;
490
+ /** Four-digit birth year. Optional — not required during registration. */
491
+ birthYear?: number;
492
+ /** The trade/industry the user works in. Captured during registration. */
493
+ industry?: UserTrades;
494
+ /** The user's role within their trade. Optional. */
495
+ role?: UserRoles;
443
496
  }
444
497
  export interface UserComment extends FirestoreDoc, Timestamps {
445
498
  comment: string;
@@ -123,3 +123,52 @@ export var DecimalTolerance;
123
123
  DecimalTolerance["Hundredth"] = "0.01";
124
124
  DecimalTolerance["Thousandth"] = "0.001";
125
125
  })(DecimalTolerance || (DecimalTolerance = {}));
126
+ /**
127
+ * Trade/industry a user works in. Collected during registration to personalize
128
+ * the experience. String values are stable identifiers safe for persistence and
129
+ * analytics; they double as i18n key suffixes (e.g. `trades.iron_worker`).
130
+ */
131
+ export var UserTrades;
132
+ (function (UserTrades) {
133
+ UserTrades["Woodworking"] = "woodworking";
134
+ UserTrades["Plumbing"] = "plumbing";
135
+ UserTrades["Electrical"] = "electrical";
136
+ UserTrades["Structural"] = "structural";
137
+ UserTrades["Framing"] = "framing";
138
+ UserTrades["Carpenter"] = "carpenter";
139
+ UserTrades["IronWorker"] = "iron_worker";
140
+ UserTrades["Joiners"] = "joiners";
141
+ UserTrades["HVAC"] = "hvac";
142
+ UserTrades["Painting"] = "painting";
143
+ UserTrades["GC"] = "gc";
144
+ UserTrades["IT"] = "it";
145
+ UserTrades["Surveying"] = "surveying";
146
+ UserTrades["Pipefitter"] = "pipe_fitter";
147
+ UserTrades["Drywall"] = "drywall";
148
+ UserTrades["Welding"] = "welding";
149
+ UserTrades["Flooring"] = "flooring";
150
+ UserTrades["Decking"] = "decking";
151
+ UserTrades["Tile"] = "tile";
152
+ UserTrades["DIY"] = "diy";
153
+ UserTrades["Other"] = "other";
154
+ })(UserTrades || (UserTrades = {}));
155
+ /**
156
+ * Role a user holds within their trade. Collected during registration. String
157
+ * values double as i18n key suffixes (e.g. `roles.project_manager`).
158
+ */
159
+ export var UserRoles;
160
+ (function (UserRoles) {
161
+ UserRoles["Apprentice"] = "apprentice";
162
+ UserRoles["Journeyman"] = "journeyman";
163
+ UserRoles["Owner"] = "owner";
164
+ UserRoles["ProjectManager"] = "project_manager";
165
+ UserRoles["Supervisor"] = "supervisor";
166
+ UserRoles["Foreman"] = "foreman";
167
+ UserRoles["Superintendent"] = "superintendent";
168
+ UserRoles["Estimator"] = "estimator";
169
+ UserRoles["OfficeManager"] = "office_manager";
170
+ UserRoles["Operator"] = "operator";
171
+ UserRoles["Laborer"] = "laborer";
172
+ UserRoles["Engineer"] = "engineer";
173
+ UserRoles["Safety"] = "safety";
174
+ })(UserRoles || (UserRoles = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reekon-tools/boldr-utils",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
4
4
  "description": "Shared utilities for formulas and measurement conversion used in Reekon apps",
5
5
  "author": "REEKON Tools",
6
6
  "license": "MIT",
@@ -1,11 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { AnnotationCanvasInnerProps } from './AnnotationCanvasInner.js';
3
- export type { AnnotationCanvasHandle, GestureConfig, PanTrigger, } from './AnnotationCanvasInner.js';
4
- export interface CanvasKitOpts {
5
- locateFile?: (file: string) => string;
6
- }
7
- export type AnnotationCanvasProps = AnnotationCanvasInnerProps & {
8
- fallback?: ReactNode;
9
- canvasKitOpts?: CanvasKitOpts;
10
- };
11
- export declare const AnnotationCanvas: ({ fallback, canvasKitOpts, ...rest }: AnnotationCanvasProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { WithSkiaWeb } from '@shopify/react-native-skia/lib/module/web/index.js';
3
- // Web-only entry point: lazy-loads CanvasKit wasm via WithSkiaWeb. Imperative
4
- // API (undo/redo/zoom) is exposed through the `imperativeRef` prop rather
5
- // than React refs, since WithSkiaWeb can't forward refs through its lazy
6
- // component boundary. The native build sits in `AnnotationCanvas.native.tsx`
7
- // and skips WithSkiaWeb entirely (no wasm to load).
8
- export const AnnotationCanvas = ({ fallback, canvasKitOpts, ...rest }) => (_jsx(WithSkiaWeb, { getComponent: () => import('./AnnotationCanvasInner.js').then((m) => ({
9
- default: m.AnnotationCanvasInner,
10
- })), fallback: fallback ?? null, componentProps: rest, opts: canvasKitOpts }));
@@ -1,8 +0,0 @@
1
- import type { AnnotationCanvasInnerProps } from './AnnotationCanvasInner.native.js';
2
- export type { AnnotationCanvasHandle, } from './useAnnotationCanvasState.js';
3
- export type { GestureConfig, PanTrigger, } from './AnnotationCanvasInner.js';
4
- export type AnnotationCanvasProps = AnnotationCanvasInnerProps & {
5
- fallback?: unknown;
6
- canvasKitOpts?: unknown;
7
- };
8
- export declare const AnnotationCanvas: (props: AnnotationCanvasProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { AnnotationCanvasInner } from './AnnotationCanvasInner.native.js';
3
- export const AnnotationCanvas = (props) => {
4
- const { fallback: _f, canvasKitOpts: _o, ...rest } = props;
5
- return _jsx(AnnotationCanvasInner, { ...rest });
6
- };
@@ -1,39 +0,0 @@
1
- import { type CSSProperties, type MutableRefObject } from 'react';
2
- import type { DecimalTolerance, FractionalTolerance, Measurement, Units } from '../types/firestore.js';
3
- import type { AnnotationCanvasState, AnnotationDocumentPatch, Selection } from '../types/annotation.js';
4
- import type { MeasurementRef } from './measurementPicker.js';
5
- import type { Tool } from './Tool.js';
6
- import { type AnnotationCanvasHandle } from './useAnnotationCanvasState.js';
7
- import { type ViewportState } from './viewport.js';
8
- import type { RenderMeasurementStamp } from './measurementStampOverlay.js';
9
- export type { AnnotationCanvasHandle };
10
- export interface AnnotationCanvasInnerProps {
11
- canvas: AnnotationCanvasState;
12
- onCommit(patch: AnnotationDocumentPatch): void;
13
- tools: Tool[];
14
- activeToolId: string;
15
- selection: Selection | null;
16
- onSelectionChange(selection: Selection | null): void;
17
- measurements?: Measurement[];
18
- fallbackUnit?: Units;
19
- fractionalTolerance?: FractionalTolerance;
20
- decimalTolerance?: DecimalTolerance;
21
- resolveImageUrl?: (storagePath: string) => Promise<string>;
22
- pickMeasurement?: () => Promise<MeasurementRef | null>;
23
- renderMeasurementStamp?: RenderMeasurementStamp;
24
- stampFontSource?: unknown;
25
- stampValueFontSize?: number;
26
- stampLabelFontSize?: number;
27
- gestures?: GestureConfig;
28
- width: number;
29
- height: number;
30
- initialViewport?: ViewportState;
31
- style?: CSSProperties;
32
- imperativeRef?: MutableRefObject<AnnotationCanvasHandle | null>;
33
- }
34
- export type PanTrigger = 'middleMouse' | 'rightMouse' | 'space';
35
- export interface GestureConfig {
36
- wheel?: 'zoom' | 'pan' | 'auto';
37
- panTriggers?: PanTrigger[];
38
- }
39
- export declare const AnnotationCanvasInner: (props: AnnotationCanvasInnerProps) => import("react/jsx-runtime").JSX.Element;