@mlightcad/cad-simple-viewer 1.7.5 → 1.7.6

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 (131) hide show
  1. package/dist/cad-simple-viewer.js +9270 -8077
  2. package/dist/cad-simple-viewer.umd.cjs +83 -83
  3. package/dist/mtext-renderer-worker.js +2987 -2815
  4. package/find.ts +7 -0
  5. package/lib/app/AcApDocManager.d.ts +5 -0
  6. package/lib/app/AcApDocManager.d.ts.map +1 -1
  7. package/lib/app/AcApDocManager.js +39 -21
  8. package/lib/app/AcApDocManager.js.map +1 -1
  9. package/lib/app/AcApOpenDatabaseOptions.d.ts +8 -6
  10. package/lib/app/AcApOpenDatabaseOptions.d.ts.map +1 -1
  11. package/lib/app/AcApOpenFileProgressController.d.ts +17 -9
  12. package/lib/app/AcApOpenFileProgressController.d.ts.map +1 -1
  13. package/lib/app/AcApOpenFileProgressController.js +41 -20
  14. package/lib/app/AcApOpenFileProgressController.js.map +1 -1
  15. package/lib/app/AcApProgress.d.ts +5 -0
  16. package/lib/app/AcApProgress.d.ts.map +1 -1
  17. package/lib/app/AcApProgress.js +10 -0
  18. package/lib/app/AcApProgress.js.map +1 -1
  19. package/lib/app/openFileProgress.d.ts +8 -1
  20. package/lib/app/openFileProgress.d.ts.map +1 -1
  21. package/lib/app/openFileProgress.js +13 -2
  22. package/lib/app/openFileProgress.js.map +1 -1
  23. package/lib/app/syncCurrentSpaceFromTileMode.d.ts +25 -0
  24. package/lib/app/syncCurrentSpaceFromTileMode.d.ts.map +1 -0
  25. package/lib/app/syncCurrentSpaceFromTileMode.js +85 -0
  26. package/lib/app/syncCurrentSpaceFromTileMode.js.map +1 -0
  27. package/lib/editor/input/AcEdOsnapCenterMarks.d.ts +15 -2
  28. package/lib/editor/input/AcEdOsnapCenterMarks.d.ts.map +1 -1
  29. package/lib/editor/input/AcEdOsnapCenterMarks.js +63 -13
  30. package/lib/editor/input/AcEdOsnapCenterMarks.js.map +1 -1
  31. package/lib/editor/input/AcEdOsnapResolver.d.ts +14 -0
  32. package/lib/editor/input/AcEdOsnapResolver.d.ts.map +1 -1
  33. package/lib/editor/input/AcEdOsnapResolver.js +246 -32
  34. package/lib/editor/input/AcEdOsnapResolver.js.map +1 -1
  35. package/lib/editor/input/AcEdSelectionFilter.d.ts +6 -0
  36. package/lib/editor/input/AcEdSelectionFilter.d.ts.map +1 -1
  37. package/lib/editor/input/AcEdSelectionFilter.js +19 -2
  38. package/lib/editor/input/AcEdSelectionFilter.js.map +1 -1
  39. package/lib/editor/input/AcEditor.d.ts +6 -0
  40. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  41. package/lib/editor/input/AcEditor.js +9 -0
  42. package/lib/editor/input/AcEditor.js.map +1 -1
  43. package/lib/editor/input/ui/AcEdCommandLine.d.ts +12 -0
  44. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  45. package/lib/editor/input/ui/AcEdCommandLine.js +54 -16
  46. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  47. package/lib/editor/input/ui/AcEdInputManager.d.ts +15 -0
  48. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
  49. package/lib/editor/input/ui/AcEdInputManager.js +41 -10
  50. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
  51. package/lib/editor/view/AcEdBaseView.d.ts +34 -0
  52. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
  53. package/lib/editor/view/AcEdBaseView.js +35 -44
  54. package/lib/editor/view/AcEdBaseView.js.map +1 -1
  55. package/lib/editor/view/AcEdSpatialQueryResult.d.ts +7 -0
  56. package/lib/editor/view/AcEdSpatialQueryResult.d.ts.map +1 -1
  57. package/lib/editor/view/AcEdSpatialQueryResult.js.map +1 -1
  58. package/lib/find/AcApFindNavigator.d.ts +59 -0
  59. package/lib/find/AcApFindNavigator.d.ts.map +1 -0
  60. package/lib/find/AcApFindNavigator.js +145 -0
  61. package/lib/find/AcApFindNavigator.js.map +1 -0
  62. package/lib/find/findDrawing.d.ts +100 -0
  63. package/lib/find/findDrawing.d.ts.map +1 -0
  64. package/lib/find/findDrawing.js +183 -0
  65. package/lib/find/findDrawing.js.map +1 -0
  66. package/lib/find/findText.d.ts +147 -0
  67. package/lib/find/findText.d.ts.map +1 -0
  68. package/lib/find/findText.js +561 -0
  69. package/lib/find/findText.js.map +1 -0
  70. package/lib/find/index.d.ts +3 -0
  71. package/lib/find/index.d.ts.map +1 -0
  72. package/lib/find/index.js +3 -0
  73. package/lib/find/index.js.map +1 -0
  74. package/lib/i18n/ar/jig.d.ts +2 -0
  75. package/lib/i18n/ar/jig.d.ts.map +1 -1
  76. package/lib/i18n/ar/jig.js +1 -1
  77. package/lib/i18n/ar/jig.js.map +1 -1
  78. package/lib/i18n/cs/jig.d.ts +2 -0
  79. package/lib/i18n/cs/jig.d.ts.map +1 -1
  80. package/lib/i18n/cs/jig.js +2 -0
  81. package/lib/i18n/cs/jig.js.map +1 -1
  82. package/lib/i18n/en/jig.d.ts +2 -0
  83. package/lib/i18n/en/jig.d.ts.map +1 -1
  84. package/lib/i18n/en/jig.js +2 -0
  85. package/lib/i18n/en/jig.js.map +1 -1
  86. package/lib/i18n/tr/jig.d.ts +2 -0
  87. package/lib/i18n/tr/jig.d.ts.map +1 -1
  88. package/lib/i18n/tr/jig.js +2 -0
  89. package/lib/i18n/tr/jig.js.map +1 -1
  90. package/lib/i18n/zh/jig.d.ts +2 -0
  91. package/lib/i18n/zh/jig.d.ts.map +1 -1
  92. package/lib/i18n/zh/jig.js +2 -0
  93. package/lib/i18n/zh/jig.js.map +1 -1
  94. package/lib/index.d.ts +2 -0
  95. package/lib/index.d.ts.map +1 -1
  96. package/lib/index.js +2 -0
  97. package/lib/index.js.map +1 -1
  98. package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.d.ts +29 -7
  99. package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.d.ts.map +1 -1
  100. package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.js +77 -38
  101. package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.js.map +1 -1
  102. package/lib/view/AcTrConvertQueue.d.ts +78 -0
  103. package/lib/view/AcTrConvertQueue.d.ts.map +1 -0
  104. package/lib/view/AcTrConvertQueue.js +143 -0
  105. package/lib/view/AcTrConvertQueue.js.map +1 -0
  106. package/lib/view/AcTrGroupWcsBboxAssert.d.ts +9 -0
  107. package/lib/view/AcTrGroupWcsBboxAssert.d.ts.map +1 -1
  108. package/lib/view/AcTrGroupWcsBboxAssert.js +12 -0
  109. package/lib/view/AcTrGroupWcsBboxAssert.js.map +1 -1
  110. package/lib/view/AcTrLayer.d.ts.map +1 -1
  111. package/lib/view/AcTrLayer.js +5 -1
  112. package/lib/view/AcTrLayer.js.map +1 -1
  113. package/lib/view/AcTrLayout.d.ts.map +1 -1
  114. package/lib/view/AcTrLayout.js +15 -0
  115. package/lib/view/AcTrLayout.js.map +1 -1
  116. package/lib/view/AcTrLayoutView.d.ts.map +1 -1
  117. package/lib/view/AcTrLayoutView.js +3 -1
  118. package/lib/view/AcTrLayoutView.js.map +1 -1
  119. package/lib/view/AcTrProgressiveOpenFitController.d.ts +1 -0
  120. package/lib/view/AcTrProgressiveOpenFitController.d.ts.map +1 -1
  121. package/lib/view/AcTrProgressiveOpenFitController.js +2 -1
  122. package/lib/view/AcTrProgressiveOpenFitController.js.map +1 -1
  123. package/lib/view/AcTrView2d.d.ts +210 -20
  124. package/lib/view/AcTrView2d.d.ts.map +1 -1
  125. package/lib/view/AcTrView2d.js +962 -273
  126. package/lib/view/AcTrView2d.js.map +1 -1
  127. package/package.json +17 -10
  128. package/src/find/AcApFindNavigator.ts +190 -0
  129. package/src/find/findDrawing.ts +211 -0
  130. package/src/find/findText.ts +624 -0
  131. package/src/find/index.ts +2 -0
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Text search over the entities of one layout (FIND).
3
+ *
4
+ * Shared by every UI (cad-simple-ui-plugin, the full Vue cad-viewer) so that
5
+ * both behave identically. Pure TypeScript with no runtime imports, published
6
+ * as the `@mlightcad/cad-simple-viewer/find` subpath.
7
+ *
8
+ * Searched fields:
9
+ * - `TEXT` — `textString`
10
+ * - `MTEXT` — `contents` with MTEXT formatting codes removed
11
+ * - `ATTRIB` — attribute value (`textString`) of every `INSERT` in the layout
12
+ * (the tag is reported for display but is not searched)
13
+ * - `TEXT` / `MTEXT` / `ATTRIB` inside the block definition of every `INSERT`
14
+ * (nested blocks included, anonymous/dynamic blocks too): title blocks,
15
+ * legends and labels are usually drawn this way
16
+ * - constant `ATTDEF` values inside block definitions (the only ATTDEFs that
17
+ * are drawn inside a block; templates get their value from an `ATTRIB`)
18
+ * - `DIMENSION` — the text of its dimension block when that block has a
19
+ * match, otherwise the override text (`dimensionText`)
20
+ * - `MULTILEADER` — its MTEXT contents
21
+ * - `ACAD_TABLE` — the cell text (from the table block when present,
22
+ * otherwise the cell strings)
23
+ *
24
+ * Every layout is visited in one synchronous pass per search. A hit inside a
25
+ * block, dimension or table selects the top-level entity of the layout that
26
+ * contains it, and carries the WCS extents of the matched text so the view
27
+ * can zoom to the text itself instead of to the whole block. Xrefs are not
28
+ * searched.
29
+ *
30
+ * The module is structural (no `instanceof`) so it can be unit tested with
31
+ * plain objects.
32
+ */
33
+ /** Maximum number of hits returned by one search. */
34
+ export declare const ACAP_FIND_MAX_RESULTS = 500;
35
+ /** Kind of entity that produced a hit. */
36
+ export type AcApFindHitKind = 'text' | 'mtext' | 'attribute'
37
+ /** TEXT / MTEXT inside a block definition (via an `INSERT`). */
38
+ | 'block' | 'dimension' | 'leader' | 'table';
39
+ /** Options for {@link acapFindTextInLayout}. */
40
+ export interface AcApFindOptions {
41
+ /**
42
+ * When true the query must match case and accents exactly. When false
43
+ * (default) case, accents (diacritics) and runs of whitespace are ignored.
44
+ */
45
+ matchCase?: boolean;
46
+ /** Maximum hits to return; defaults to {@link ACAP_FIND_MAX_RESULTS}. */
47
+ maxResults?: number;
48
+ }
49
+ /** One match returned by {@link acapFindTextInLayout}. */
50
+ export interface AcApFindHit {
51
+ /**
52
+ * Top-level entity of the layout that is selected (the `INSERT` for
53
+ * attributes and block text, the `DIMENSION` / `ACAD_TABLE` for their text).
54
+ */
55
+ entityId: string;
56
+ /**
57
+ * Key of the text that matched, unique within the layout: the entity id
58
+ * for top-level text, the attribute id for attributes, and
59
+ * `<entityId>/<nested id>…` for text found inside a block, dimension or
60
+ * table (the same block text appears once per `INSERT`).
61
+ */
62
+ textEntityId: string;
63
+ kind: AcApFindHitKind;
64
+ /** Plain text that matched (formatting codes removed, whitespace collapsed). */
65
+ text: string;
66
+ /** Attribute tag, for `attribute` hits. */
67
+ tag?: string;
68
+ /** Block name of the owning `INSERT`, for `attribute` hits. */
69
+ blockName?: string;
70
+ layer: string;
71
+ /** Insertion point of the text in WCS. */
72
+ position: {
73
+ x: number;
74
+ y: number;
75
+ };
76
+ /**
77
+ * WCS extents of the matched text, when known (text nested in a block,
78
+ * dimension or table). Used to zoom to the text itself.
79
+ */
80
+ extents?: {
81
+ min: {
82
+ x: number;
83
+ y: number;
84
+ };
85
+ max: {
86
+ x: number;
87
+ y: number;
88
+ };
89
+ };
90
+ }
91
+ /** Result of one search. */
92
+ export interface AcApFindResult {
93
+ hits: AcApFindHit[];
94
+ /** True when more than `maxResults` entities matched. */
95
+ truncated: boolean;
96
+ }
97
+ type EntityLike = any;
98
+ /** Minimal database shape used by the search. */
99
+ export interface AcApFindDatabaseLike {
100
+ tables: {
101
+ blockTable: {
102
+ /** Block definition by name; used to search text inside blocks. */
103
+ getAt?(name: string): {
104
+ newIterator(): Iterable<EntityLike>;
105
+ } | undefined;
106
+ getIdAt(id: string): {
107
+ newIterator(): Iterable<EntityLike>;
108
+ /** Used to resolve the matched entity for zoom extents. */
109
+ getIdAt?(id: string): EntityLike;
110
+ } | undefined;
111
+ };
112
+ layerTable?: {
113
+ getAt(name: string): {
114
+ isOff?: boolean;
115
+ isFrozen?: boolean;
116
+ } | undefined;
117
+ };
118
+ };
119
+ }
120
+ /**
121
+ * Normalizes text or a query for comparison.
122
+ *
123
+ * - always: NFKC, whitespace runs → one space, trimmed
124
+ * - unless `matchCase`: accents removed, lower-cased
125
+ */
126
+ export declare function acapNormalizeFindText(value: string, matchCase?: boolean): string;
127
+ /**
128
+ * Converts MTEXT contents to plain text: removes formatting codes
129
+ * (`\f…;`, `\H…;`, `\C…;`, `\L \l \O \o \K \k`, braces), turns `\P` into a
130
+ * space, decodes `\~`, `\U+XXXX`, stacked fractions and `%%c %%d %%p`.
131
+ */
132
+ export declare function acapMTextToPlainText(contents: string): string;
133
+ /**
134
+ * Finds text in the entities of one block table record (a layout).
135
+ *
136
+ * Entities that are invisible or sit on an off/frozen layer are skipped so
137
+ * that results always correspond to something the user can see.
138
+ *
139
+ * @param db - Database owning the layout.
140
+ * @param layoutBtrId - Block table record id of the layout (model/paper space).
141
+ * @param query - User query; blank queries return no hits.
142
+ */
143
+ export declare function acapFindTextInLayout(db: AcApFindDatabaseLike, layoutBtrId: string, query: string, options?: AcApFindOptions): AcApFindResult;
144
+ /** Returns a short excerpt of `text` centred on the first match of `query`. */
145
+ export declare function acapFindExcerpt(text: string, query: string, matchCase?: boolean, width?: number): string;
146
+ export {};
147
+ //# sourceMappingURL=findText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findText.d.ts","sourceRoot":"","sources":["../../src/find/findText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,OAAO,GACP,WAAW;AACb,gEAAgE;GAC9D,OAAO,GACP,WAAW,GACX,QAAQ,GACR,OAAO,CAAA;AAEX,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,yEAAyE;IACzE,UAAU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