@ifc-lite/lens 1.7.0

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/LICENSE ADDED
@@ -0,0 +1,373 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
@@ -0,0 +1,23 @@
1
+ import type { RGBAColor } from './types.js';
2
+ /** Ghost color for unmatched entities: faint gray at low opacity */
3
+ export declare const GHOST_COLOR: RGBAColor;
4
+ /**
5
+ * Parse hex color string to RGBA tuple (0–1 range).
6
+ *
7
+ * @param hex - Hex color (e.g. "#E53935" or "E53935")
8
+ * @param alpha - Alpha value in 0–1 range
9
+ */
10
+ export declare function hexToRgba(hex: string, alpha: number): RGBAColor;
11
+ /**
12
+ * Convert RGBA tuple to hex color string (ignores alpha).
13
+ *
14
+ * @param rgba - RGBA tuple with values in 0–1 range
15
+ * @returns Hex string like "#e53935"
16
+ */
17
+ export declare function rgbaToHex(rgba: RGBAColor): string;
18
+ /**
19
+ * Check if a color is a ghost color (alpha < 0.2).
20
+ * Used to exclude ghost entries from UI legends.
21
+ */
22
+ export declare function isGhostColor(rgba: RGBAColor): boolean;
23
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,oEAAoE;AACpE,eAAO,MAAM,WAAW,EAAE,SAAiC,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAM/D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAKjD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAErD"}
package/dist/colors.js ADDED
@@ -0,0 +1,38 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /** Ghost color for unmatched entities: faint gray at low opacity */
5
+ export const GHOST_COLOR = [0.6, 0.6, 0.6, 0.15];
6
+ /**
7
+ * Parse hex color string to RGBA tuple (0–1 range).
8
+ *
9
+ * @param hex - Hex color (e.g. "#E53935" or "E53935")
10
+ * @param alpha - Alpha value in 0–1 range
11
+ */
12
+ export function hexToRgba(hex, alpha) {
13
+ const h = hex.replace('#', '');
14
+ const r = parseInt(h.substring(0, 2), 16) / 255;
15
+ const g = parseInt(h.substring(2, 4), 16) / 255;
16
+ const b = parseInt(h.substring(4, 6), 16) / 255;
17
+ return [r, g, b, alpha];
18
+ }
19
+ /**
20
+ * Convert RGBA tuple to hex color string (ignores alpha).
21
+ *
22
+ * @param rgba - RGBA tuple with values in 0–1 range
23
+ * @returns Hex string like "#e53935"
24
+ */
25
+ export function rgbaToHex(rgba) {
26
+ const r = Math.round(rgba[0] * 255).toString(16).padStart(2, '0');
27
+ const g = Math.round(rgba[1] * 255).toString(16).padStart(2, '0');
28
+ const b = Math.round(rgba[2] * 255).toString(16).padStart(2, '0');
29
+ return `#${r}${g}${b}`;
30
+ }
31
+ /**
32
+ * Check if a color is a ghost color (alpha < 0.2).
33
+ * Used to exclude ghost entries from UI legends.
34
+ */
35
+ export function isGhostColor(rgba) {
36
+ return rgba[3] < 0.2;
37
+ }
38
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAI/D,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,KAAa;IAClD,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC/B,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IAChD,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IAChD,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IAChD,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAe;IAC1C,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AACvB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Lens, LensEvaluationResult, LensDataProvider } from './types.js';
2
+ /**
3
+ * Evaluate a lens against all entities in the data provider.
4
+ *
5
+ * - O(n × r) where n = entity count, r = enabled rules
6
+ * - First matching rule wins (short-circuit per entity)
7
+ * - Unmatched entities receive {@link GHOST_COLOR} for context
8
+ *
9
+ * @param lens - Lens configuration to evaluate
10
+ * @param provider - Data provider for entity access
11
+ * @returns Color map, hidden IDs, per-rule counts, and execution time
12
+ */
13
+ export declare function evaluateLens(lens: Lens, provider: LensDataProvider): LensEvaluationResult;
14
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,IAAI,EACJ,oBAAoB,EACpB,gBAAgB,EAGjB,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,gBAAgB,GACzB,oBAAoB,CAuDtB"}
package/dist/engine.js ADDED
@@ -0,0 +1,79 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { matchesCriteria } from './matching.js';
5
+ import { hexToRgba, GHOST_COLOR } from './colors.js';
6
+ /**
7
+ * Evaluate a lens against all entities in the data provider.
8
+ *
9
+ * - O(n × r) where n = entity count, r = enabled rules
10
+ * - First matching rule wins (short-circuit per entity)
11
+ * - Unmatched entities receive {@link GHOST_COLOR} for context
12
+ *
13
+ * @param lens - Lens configuration to evaluate
14
+ * @param provider - Data provider for entity access
15
+ * @returns Color map, hidden IDs, per-rule counts, and execution time
16
+ */
17
+ export function evaluateLens(lens, provider) {
18
+ const startTime = performance.now();
19
+ const enabledRules = lens.rules.filter(r => r.enabled);
20
+ // Early exit — no enabled rules means no evaluation
21
+ if (enabledRules.length === 0) {
22
+ return {
23
+ colorMap: new Map(),
24
+ hiddenIds: new Set(),
25
+ ruleCounts: new Map(),
26
+ ruleEntityIds: new Map(),
27
+ executionTime: performance.now() - startTime,
28
+ };
29
+ }
30
+ const colorMap = new Map();
31
+ const hiddenIds = new Set();
32
+ const ruleCounts = new Map();
33
+ const ruleEntityIds = new Map();
34
+ // Initialize rule counts and entity ID lists
35
+ for (const rule of enabledRules) {
36
+ ruleCounts.set(rule.id, 0);
37
+ ruleEntityIds.set(rule.id, []);
38
+ }
39
+ // Evaluate all entities
40
+ provider.forEachEntity((globalId) => {
41
+ let matched = false;
42
+ // First matching rule wins
43
+ for (const rule of enabledRules) {
44
+ if (matchesCriteria(rule.criteria, globalId, provider)) {
45
+ matched = true;
46
+ ruleCounts.set(rule.id, (ruleCounts.get(rule.id) ?? 0) + 1);
47
+ ruleEntityIds.get(rule.id).push(globalId);
48
+ applyRuleAction(rule, globalId, colorMap, hiddenIds);
49
+ break;
50
+ }
51
+ }
52
+ // Ghost unmatched entities for context
53
+ if (!matched) {
54
+ colorMap.set(globalId, GHOST_COLOR);
55
+ }
56
+ });
57
+ return {
58
+ colorMap,
59
+ hiddenIds,
60
+ ruleCounts,
61
+ ruleEntityIds,
62
+ executionTime: performance.now() - startTime,
63
+ };
64
+ }
65
+ /** Apply rule action to an entity */
66
+ function applyRuleAction(rule, globalId, colorMap, hiddenIds) {
67
+ switch (rule.action) {
68
+ case 'colorize':
69
+ colorMap.set(globalId, hexToRgba(rule.color, 1));
70
+ break;
71
+ case 'transparent':
72
+ colorMap.set(globalId, hexToRgba(rule.color, 0.3));
73
+ break;
74
+ case 'hide':
75
+ hiddenIds.add(globalId);
76
+ break;
77
+ }
78
+ }
79
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAS/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAU,EACV,QAA0B;IAE1B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEpC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAEvD,oDAAoD;IACpD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO;YACL,QAAQ,EAAE,IAAI,GAAG,EAAE;YACnB,SAAS,EAAE,IAAI,GAAG,EAAE;YACpB,UAAU,EAAE,IAAI,GAAG,EAAE;YACrB,aAAa,EAAE,IAAI,GAAG,EAAE;YACxB,aAAa,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;SAC7C,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;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tB,IAAc,EACd,QAAgB,EAChB,QAAgC,EAChC,SAAsB;IAEtB,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,UAAU;YACb,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM;QACR,KAAK,aAAa;YAChB,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;YACnD,MAAM;QACR,KAAK,MAAM;YACT,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,MAAM;IACV,CAAC;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @ifc-lite/lens — Rule-based 3D filtering and colorization
3
+ *
4
+ * Pure, framework-agnostic lens evaluation engine for IFC models.
5
+ * Evaluate rules that match entities by IFC class, property value, or
6
+ * material name and apply visual actions (colorize, hide, transparent).
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { evaluateLens, BUILTIN_LENSES } from '@ifc-lite/lens';
11
+ * import type { LensDataProvider } from '@ifc-lite/lens';
12
+ *
13
+ * const provider: LensDataProvider = createMyProvider(myData);
14
+ * const result = evaluateLens(BUILTIN_LENSES[0], provider);
15
+ * // result.colorMap — Map<globalId, RGBAColor>
16
+ * // result.hiddenIds — Set<globalId>
17
+ * // result.ruleCounts — Map<ruleId, count>
18
+ * ```
19
+ */
20
+ export type { LensDataProvider, PropertySetInfo, LensCriteria, LensRule, Lens, LensEvaluationResult, RGBAColor, } from './types.js';
21
+ export { COMMON_IFC_CLASSES,
22
+ /** @deprecated Use COMMON_IFC_CLASSES instead */
23
+ COMMON_IFC_CLASSES as COMMON_IFC_TYPES, LENS_PALETTE, IFC_SUBTYPE_TO_BASE, } from './types.js';
24
+ export { evaluateLens } from './engine.js';
25
+ export { matchesCriteria } from './matching.js';
26
+ export { GHOST_COLOR, hexToRgba, rgbaToHex, isGhostColor, } from './colors.js';
27
+ export { BUILTIN_LENSES } from './presets.js';
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,oBAAoB,EACpB,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,kBAAkB;AAClB,iDAAiD;AACjD,kBAAkB,IAAI,gBAAgB,EACtC,YAAY,EACZ,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAMhD,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ export { COMMON_IFC_CLASSES,
5
+ /** @deprecated Use COMMON_IFC_CLASSES instead */
6
+ COMMON_IFC_CLASSES as COMMON_IFC_TYPES, LENS_PALETTE, IFC_SUBTYPE_TO_BASE, } from './types.js';
7
+ // ============================================================================
8
+ // Engine
9
+ // ============================================================================
10
+ export { evaluateLens } from './engine.js';
11
+ // ============================================================================
12
+ // Matching
13
+ // ============================================================================
14
+ export { matchesCriteria } from './matching.js';
15
+ // ============================================================================
16
+ // Colors
17
+ // ============================================================================
18
+ export { GHOST_COLOR, hexToRgba, rgbaToHex, isGhostColor, } from './colors.js';
19
+ // ============================================================================
20
+ // Presets
21
+ // ============================================================================
22
+ export { BUILTIN_LENSES } from './presets.js';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAoC/D,OAAO,EACL,kBAAkB;AAClB,iDAAiD;AACjD,kBAAkB,IAAI,gBAAgB,EACtC,YAAY,EACZ,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { LensCriteria, LensDataProvider } from './types.js';
2
+ /**
3
+ * Check if an entity matches a {@link LensCriteria}.
4
+ *
5
+ * Performance: O(1) for type matching, O(psets) for property/material.
6
+ */
7
+ export declare function matchesCriteria(criteria: LensCriteria, globalId: number, provider: LensDataProvider): boolean;
8
+ //# sourceMappingURL=matching.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matching.d.ts","sourceRoot":"","sources":["../src/matching.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGjE;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAWT"}
@@ -0,0 +1,72 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { IFC_SUBTYPE_TO_BASE } from './types.js';
5
+ /**
6
+ * Check if an entity matches a {@link LensCriteria}.
7
+ *
8
+ * Performance: O(1) for type matching, O(psets) for property/material.
9
+ */
10
+ export function matchesCriteria(criteria, globalId, provider) {
11
+ switch (criteria.type) {
12
+ case 'ifcType':
13
+ return matchesIfcType(criteria, globalId, provider);
14
+ case 'property':
15
+ return matchesProperty(criteria, globalId, provider);
16
+ case 'material':
17
+ return matchesMaterial(criteria, globalId, provider);
18
+ default:
19
+ return false;
20
+ }
21
+ }
22
+ /** Match by IFC class with subclass support */
23
+ function matchesIfcType(criteria, globalId, provider) {
24
+ if (!criteria.ifcType)
25
+ return false;
26
+ const typeName = provider.getEntityType(globalId);
27
+ if (!typeName)
28
+ return false;
29
+ // Exact match
30
+ if (typeName === criteria.ifcType)
31
+ return true;
32
+ // Subtype match: e.g. IfcSlabStandardCase matches an IfcSlab rule
33
+ const baseType = IFC_SUBTYPE_TO_BASE[typeName];
34
+ return baseType === criteria.ifcType;
35
+ }
36
+ /** Match by property value */
37
+ function matchesProperty(criteria, globalId, provider) {
38
+ if (!criteria.propertySet || !criteria.propertyName)
39
+ return false;
40
+ const value = provider.getPropertyValue(globalId, criteria.propertySet, criteria.propertyName);
41
+ if (criteria.operator === 'exists') {
42
+ return value !== null && value !== undefined;
43
+ }
44
+ if (criteria.operator === 'contains' && criteria.propertyValue !== undefined) {
45
+ return String(value ?? '').toLowerCase().includes(criteria.propertyValue.toLowerCase());
46
+ }
47
+ // Default: equals
48
+ if (criteria.propertyValue !== undefined) {
49
+ return String(value ?? '') === criteria.propertyValue;
50
+ }
51
+ return value !== null && value !== undefined;
52
+ }
53
+ /** Match by material (scans material-related property sets) */
54
+ function matchesMaterial(criteria, globalId, provider) {
55
+ if (!criteria.materialName)
56
+ return false;
57
+ const psets = provider.getPropertySets(globalId);
58
+ if (!psets || psets.length === 0)
59
+ return false;
60
+ const pattern = criteria.materialName.toLowerCase();
61
+ for (const pset of psets) {
62
+ if (pset.name.toLowerCase().includes('material')) {
63
+ for (const prop of pset.properties) {
64
+ if (String(prop.value ?? '').toLowerCase().includes(pattern)) {
65
+ return true;
66
+ }
67
+ }
68
+ }
69
+ }
70
+ return false;
71
+ }
72
+ //# sourceMappingURL=matching.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matching.js","sourceRoot":"","sources":["../src/matching.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAsB,EACtB,QAAgB,EAChB,QAA0B;IAE1B,QAAQ,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtB,KAAK,SAAS;YACZ,OAAO,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACtD,KAAK,UAAU;YACb,OAAO,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACvD,KAAK,UAAU;YACb,OAAO,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACvD;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED,+CAA+C;AAC/C,SAAS,cAAc,CACrB,QAAsB,EACtB,QAAgB,EAChB,QAA0B;IAE1B,IAAI,CAAC,QAAQ,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAEpC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,cAAc;IACd,IAAI,QAAQ,KAAK,QAAQ,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE/C,kEAAkE;IAClE,M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AK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE/C,MAAM,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAEpD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACnC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;oBAC7D,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Lens } from './types.js';
2
+ /**
3
+ * Built-in lens presets covering common BIM use-cases.
4
+ *
5
+ * These are immutable starter configurations that ship with the package.
6
+ * The viewer marks them with `builtin: true` so they cannot be deleted.
7
+ */
8
+ export declare const BUILTIN_LENSES: readonly Lens[];
9
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,IAAI,EAmDzC,CAAC"}
@@ -0,0 +1,62 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Built-in lens presets covering common BIM use-cases.
6
+ *
7
+ * These are immutable starter configurations that ship with the package.
8
+ * The viewer marks them with `builtin: true` so they cannot be deleted.
9
+ */
10
+ export const BUILTIN_LENSES = [
11
+ {
12
+ id: 'lens-by-type',
13
+ name: 'By IFC Class',
14
+ builtin: true,
15
+ rules: [
16
+ { id: 'wall', name: 'Walls', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcWall' }, action: 'colorize', color: '#8D6E63' },
17
+ { id: 'slab', name: 'Slabs', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcSlab' }, action: 'colorize', color: '#607D8B' },
18
+ { id: 'column', name: 'Columns', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcColumn' }, action: 'colorize', color: '#E53935' },
19
+ { id: 'beam', name: 'Beams', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcBeam' }, action: 'colorize', color: '#1E88E5' },
20
+ { id: 'door', name: 'Doors', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcDoor' }, action: 'colorize', color: '#00897B' },
21
+ { id: 'window', name: 'Windows', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcWindow' }, action: 'colorize', color: '#42A5F5' },
22
+ { id: 'stair', name: 'Stairs', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcStairFlight' }, action: 'colorize', color: '#FF8F00' },
23
+ { id: 'roof', name: 'Roofs', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcRoof' }, action: 'colorize', color: '#8E24AA' },
24
+ ],
25
+ },
26
+ {
27
+ id: 'lens-structural',
28
+ name: 'Structural',
29
+ builtin: true,
30
+ rules: [
31
+ { id: 'col', name: 'Columns', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcColumn' }, action: 'colorize', color: '#E53935' },
32
+ { id: 'beam', name: 'Beams', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcBeam' }, action: 'colorize', color: '#1E88E5' },
33
+ { id: 'slab', name: 'Slabs', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcSlab' }, action: 'colorize', color: '#FDD835' },
34
+ { id: 'footing', name: 'Footings', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcFooting' }, action: 'colorize', color: '#43A047' },
35
+ ],
36
+ },
37
+ {
38
+ id: 'lens-envelope',
39
+ name: 'Building Envelope',
40
+ builtin: true,
41
+ rules: [
42
+ { id: 'roof', name: 'Roofs', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcRoof' }, action: 'colorize', color: '#C62828' },
43
+ { id: 'curtwall', name: 'Curtain Walls', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcCurtainWall' }, action: 'colorize', color: '#0277BD' },
44
+ { id: 'window', name: 'Windows', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcWindow' }, action: 'colorize', color: '#4FC3F7' },
45
+ { id: 'door', name: 'Doors', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcDoor' }, action: 'colorize', color: '#00695C' },
46
+ { id: 'wall', name: 'Walls', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcWall' }, action: 'colorize', color: '#8D6E63' },
47
+ ],
48
+ },
49
+ {
50
+ id: 'lens-openings',
51
+ name: 'Openings & Circulation',
52
+ builtin: true,
53
+ rules: [
54
+ { id: 'door', name: 'Doors', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcDoor' }, action: 'colorize', color: '#00897B' },
55
+ { id: 'window', name: 'Windows', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcWindow' }, action: 'colorize', color: '#42A5F5' },
56
+ { id: 'stair', name: 'Stairs', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcStairFlight' }, action: 'colorize', color: '#FF8F00' },
57
+ { id: 'ramp', name: 'Ramps', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcRamp' }, action: 'colorize', color: '#7CB342' },
58
+ { id: 'railing', name: 'Railings', enabled: true, criteria: { type: 'ifcType', ifcType: 'IfcRailing' }, action: 'colorize', color: '#78909C' },
59
+ ],
60
+ },
61
+ ];
62
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","sourceR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AE,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE;SAC/I;KACF;CACF,CAAC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @ifc-lite/lens — Rule-based 3D filtering and colorization
3
+ *
4
+ * A lens is a collection of rules that match entities by IFC class, property
5
+ * value, or material name, then apply a visual action (colorize, hide, or
6
+ * make transparent). Unmatched entities are ghosted for context.
7
+ *
8
+ * Multi-model support: evaluation works across federated models using
9
+ * global IDs. The {@link LensDataProvider} abstracts data access so
10
+ * consumers can bridge any data source.
11
+ */
12
+ /**
13
+ * Abstract interface for accessing IFC entity data during lens evaluation.
14
+ *
15
+ * Consumers implement this to bridge their data source (IfcDataStore,
16
+ * server API, IndexedDB, etc.) to the lens engine.
17
+ */
18
+ export interface LensDataProvider {
19
+ /** Total entity count (used for pre-allocation hints) */
20
+ getEntityCount(): number;
21
+ /**
22
+ * Iterate all entities. The callback receives the global ID and the
23
+ * model identifier for each entity.
24
+ */
25
+ forEachEntity(callback: (globalId: number, modelId: string) => void): void;
26
+ /** Get the IFC class name for an entity (e.g. "IfcWall") */
27
+ getEntityType(globalId: number): string | undefined;
28
+ /**
29
+ * Get a single property value by property-set name and property name.
30
+ * Returns `undefined` when the property does not exist.
31
+ */
32
+ getPropertyValue(globalId: number, propertySetName: string, propertyName: string): unknown;
33
+ /**
34
+ * Get all property sets for an entity.
35
+ * Used for material matching (scans psets whose name contains "material").
36
+ */
37
+ getPropertySets(globalId: number): PropertySetInfo[];
38
+ }
39
+ /** Property set returned by {@link LensDataProvider.getPropertySets} */
40
+ export interface PropertySetInfo {
41
+ name: string;
42
+ properties: ReadonlyArray<{
43
+ name: string;
44
+ value: unknown;
45
+ }>;
46
+ }
47
+ /** Criteria for matching entities */
48
+ export interface LensCriteria {
49
+ type: 'ifcType' | 'property' | 'material';
50
+ /** IFC class name (e.g. "IfcWall") — used when type === "ifcType" */
51
+ ifcType?: string;
52
+ /** Property set name (e.g. "Pset_WallCommon") — used when type === "property" */
53
+ propertySet?: string;
54
+ /** Property name (e.g. "IsExternal") — used when type === "property" */
55
+ propertyName?: string;
56
+ /** Comparison operator for property value */
57
+ operator?: 'equals' | 'contains' | 'exists';
58
+ /** Property value to compare against */
59
+ propertyValue?: string;
60
+ /** Material name pattern — used when type === "material" */
61
+ materialName?: string;
62
+ }
63
+ /** A single rule within a Lens */
64
+ export interface LensRule {
65
+ id: string;
66
+ name: string;
67
+ enabled: boolean;
68
+ criteria: LensCriteria;
69
+ action: 'colorize' | 'hide' | 'transparent';
70
+ /** Hex color for colorize/transparent actions (e.g. "#E53935") */
71
+ color: string;
72
+ }
73
+ /** A saved Lens configuration */
74
+ export interface Lens {
75
+ id: string;
76
+ name: string;
77
+ rules: LensRule[];
78
+ /** Built-in presets cannot be deleted */
79
+ builtin?: boolean;
80
+ /** Auto-color mode: color entities by distinct property values */
81
+ autoColorProperty?: {
82
+ propertySetName: string;
83
+ propertyName: string;
84
+ };
85
+ }
86
+ /** RGBA color tuple with values in the 0–1 range */
87
+ export type RGBAColor = [number, number, number, number];
88
+ /** Result of lens evaluation */
89
+ export interface LensEvaluationResult {
90
+ /** Global ID → RGBA color (includes ghost colors for unmatched entities) */
91
+ colorMap: Map<number, RGBAColor>;
92
+ /** Global IDs hidden by "hide" rules */
93
+ hiddenIds: Set<number>;
94
+ /** Rule ID → matched entity count */
95
+ ruleCounts: Map<string, number>;
96
+ /** Rule ID → matched entity global IDs (for isolation) */
97
+ ruleEntityIds: Map<string, number[]>;
98
+ /** Wall-clock evaluation time in milliseconds */
99
+ executionTime: number;
100
+ }
101
+ /** Common IFC classes for lens rule editor UI */
102
+ export declare const COMMON_IFC_CLASSES: readonly ["IfcWall", "IfcWallStandardCase", "IfcSlab", "IfcSlabStandardCase", "IfcColumn", "IfcColumnStandardCase", "IfcBeam", "IfcBeamStandardCase", "IfcDoor", "IfcWindow", "IfcStairFlight", "IfcStair", "IfcRoof", "IfcRamp", "IfcRampFlight", "IfcRailing", "IfcCovering", "IfcCurtainWall", "IfcPlate", "IfcFooting", "IfcPile", "IfcMember", "IfcBuildingElementProxy", "IfcFurnishingElement", "IfcSpace", "IfcFlowSegment", "IfcFlowTerminal", "IfcFlowFitting", "IfcDistributionElement", "IfcOpeningElement"];
103
+ /** Preset colors for new lens rules — high contrast, perceptually distinct */
104
+ export declare const LENS_PALETTE: readonly ["#E53935", "#1E88E5", "#FDD835", "#43A047", "#8E24AA", "#00ACC1", "#FF8F00", "#6D4C41", "#EC407A", "#5C6BC0", "#26A69A", "#78909C"];
105
+ /** IFC subclass → base class mapping for hierarchy-aware matching */
106
+ export declare const IFC_SUBTYPE_TO_BASE: Readonly<Record<string, string>>;
107
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAMH;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,cAAc,IAAI,MAAM,CAAC;IAEzB;;;OAGG;IACH,aAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAE3E,4DAA4D;IAC5D,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAEpD;;;OAGG;IACH,gBAAgB,CACd,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;IAEX;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,CAAC;CACtD;AAED,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,aAAa,CAAC;QACxB,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A4E;IAC5E,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,wCAAwC;IACxC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,qCAAqC;IACrC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,0DAA0D;IAC1D,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACrC,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC;CACvB;AAMD,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,0fAgBrB,CAAC;AAEX,8EAA8E;AAC9E,eAAO,MAAM,YAAY,+IAIf,CAAC;AAEX,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOhE,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,40 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ // ============================================================================
5
+ // Constants
6
+ // ============================================================================
7
+ /** Common IFC classes for lens rule editor UI */
8
+ export const COMMON_IFC_CLASSES = [
9
+ 'IfcWall', 'IfcWallStandardCase',
10
+ 'IfcSlab', 'IfcSlabStandardCase',
11
+ 'IfcColumn', 'IfcColumnStandardCase',
12
+ 'IfcBeam', 'IfcBeamStandardCase',
13
+ 'IfcDoor', 'IfcWindow',
14
+ 'IfcStairFlight', 'IfcStair',
15
+ 'IfcRoof', 'IfcRamp', 'IfcRampFlight',
16
+ 'IfcRailing', 'IfcCovering',
17
+ 'IfcCurtainWall', 'IfcPlate',
18
+ 'IfcFooting', 'IfcPile',
19
+ 'IfcMember', 'IfcBuildingElementProxy',
20
+ 'IfcFurnishingElement', 'IfcSpace',
21
+ 'IfcFlowSegment', 'IfcFlowTerminal', 'IfcFlowFitting',
22
+ 'IfcDistributionElement',
23
+ 'IfcOpeningElement',
24
+ ];
25
+ /** Preset colors for new lens rules — high contrast, perceptually distinct */
26
+ export const LENS_PALETTE = [
27
+ '#E53935', '#1E88E5', '#FDD835', '#43A047',
28
+ '#8E24AA', '#00ACC1', '#FF8F00', '#6D4C41',
29
+ '#EC407A', '#5C6BC0', '#26A69A', '#78909C',
30
+ ];
31
+ /** IFC subclass → base class mapping for hierarchy-aware matching */
32
+ export const IFC_SUBTYPE_TO_BASE = {
33
+ IfcWallStandardCase: 'IfcWall',
34
+ IfcSlabStandardCase: 'IfcSlab',
35
+ IfcColumnStandardCase: 'IfcColumn',
36
+ IfcBeamStandardCase: 'IfcBeam',
37
+ IfcStairFlight: 'IfcStair',
38
+ IfcRampFlight: 'IfcRamp',
39
+ };
40
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAkI/D,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,iDAAiD;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,qBAAqB;IAChC,SAAS,EAAE,qBAAqB;IAChC,WAAW,EAAE,uBAAuB;IACpC,SAAS,EAAE,qBAAqB;IAChC,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,UAAU;IAC5B,SAAS,EAAE,SAAS,EAAE,eAAe;IACrC,YAAY,EAAE,aAAa;IAC3B,gBAAgB,EAAE,UAAU;IAC5B,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,yBAAyB;IACtC,sBAAsB,EAAE,UAAU;IAClC,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB;IACrD,wBAAwB;IACxB,mBAAmB;CACX,CAAC;AAEX,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IAC1C,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IAC1C,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;CAClC,CAAC;AAEX,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACnE,mBAAmB,EAAE,SAAS;IAC9B,mBAAmB,EAAE,SAAS;IAC9B,qBAAqB,EAAE,WAAW;IAClC,mBAAmB,EAAE,SAAS;IAC9B,cAAc,EAAE,UAAU;IAC1B,aAAa,EAAE,SAAS;CACzB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@ifc-lite/lens",
3
+ "version": "1.7.0",
4
+ "description": "Rule-based 3D filtering and colorization for IFC models",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "dependencies": {},
15
+ "devDependencies": {
16
+ "typescript": "^5.3.0",
17
+ "vitest": "^1.6.0"
18
+ },
19
+ "license": "MPL-2.0",
20
+ "author": "Louis True",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/louistrue/ifc-lite.git",
24
+ "directory": "packages/lens"
25
+ },
26
+ "homepage": "https://louistrue.github.io/ifc-lite/",
27
+ "bugs": "https://github.com/louistrue/ifc-lite/issues",
28
+ "keywords": [
29
+ "ifc",
30
+ "bim",
31
+ "lens",
32
+ "filtering",
33
+ "colorization",
34
+ "visualization",
35
+ "aec"
36
+ ],
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "README.md"
43
+ ],
44
+ "scripts": {
45
+ "build": "tsc",
46
+ "dev": "tsc --watch",
47
+ "test": "vitest run"
48
+ }
49
+ }