@ifc-lite/bcf 1.4.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.
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @ifc-lite/bcf - BIM Collaboration Format support
3
+ *
4
+ * This package provides BCF (BIM Collaboration Format) support for IFC-Lite.
5
+ * It implements BCF 2.1 and 3.0 specifications for issue tracking in BIM projects.
6
+ *
7
+ * @see https://github.com/buildingSMART/BCF-XML
8
+ * @see https://www.buildingsmart.org/standards/bsi-standards/bim-collaboration-format/
9
+ */
10
+ export type { BCFProject, BCFExtensions, BCFVersion, BCFTopic, BCFComment, BCFBimSnippet, BCFDocumentReference, BCFViewpoint, BCFPerspectiveCamera, BCFOrthogonalCamera, BCFPoint, BCFDirection, BCFComponents, BCFComponent, BCFVisibility, BCFColoring, BCFViewSetupHints, BCFLine, BCFClippingPlane, BCFBitmap, BCFHeaderFile, } from './types.js';
11
+ export { uuidToIfcGuid, ifcGuidToUuid, generateIfcGuid, generateUuid, isValidIfcGuid, isValidUuid, } from './guid.js';
12
+ export { readBCF } from './reader.js';
13
+ export { writeBCF } from './writer.js';
14
+ export type { ViewerCameraState, ViewerSectionPlane, ViewerBounds } from './viewpoint.js';
15
+ export { cameraToPerspective, cameraToOrthogonal, perspectiveToCamera, orthogonalToCamera, sectionPlaneToClippingPlane, clippingPlaneToSectionPlane, createViewpoint, extractViewpointState, } from './viewpoint.js';
16
+ import type { BCFProject, BCFTopic, BCFComment, BCFViewpoint } from './types.js';
17
+ /**
18
+ * Create a new empty BCF project
19
+ */
20
+ export declare function createBCFProject(options?: {
21
+ name?: string;
22
+ version?: '2.1' | '3.0';
23
+ }): BCFProject;
24
+ /**
25
+ * Create a new BCF topic (issue)
26
+ */
27
+ export declare function createBCFTopic(options: {
28
+ title: string;
29
+ description?: string;
30
+ author: string;
31
+ topicType?: string;
32
+ topicStatus?: string;
33
+ priority?: string;
34
+ assignedTo?: string;
35
+ dueDate?: string;
36
+ labels?: string[];
37
+ }): BCFTopic;
38
+ /**
39
+ * Create a new BCF comment
40
+ */
41
+ export declare function createBCFComment(options: {
42
+ author: string;
43
+ comment: string;
44
+ viewpointGuid?: string;
45
+ }): BCFComment;
46
+ /**
47
+ * Add a topic to a project
48
+ */
49
+ export declare function addTopicToProject(project: BCFProject, topic: BCFTopic): void;
50
+ /**
51
+ * Add a comment to a topic
52
+ */
53
+ export declare function addCommentToTopic(topic: BCFTopic, comment: BCFComment): void;
54
+ /**
55
+ * Add a viewpoint to a topic
56
+ */
57
+ export declare function addViewpointToTopic(topic: BCFTopic, viewpoint: BCFViewpoint): void;
58
+ /**
59
+ * Update topic status
60
+ */
61
+ export declare function updateTopicStatus(topic: BCFTopic, status: string, modifiedAuthor: string): void;
62
+ /**
63
+ * Parse ARGB hex color string to RGBA values
64
+ * BCF uses ARGB format (e.g., 'FFFF0000' = opaque red)
65
+ */
66
+ export declare function parseARGBColor(argb: string): {
67
+ r: number;
68
+ g: number;
69
+ b: number;
70
+ a: number;
71
+ };
72
+ /**
73
+ * Create ARGB hex color string from RGBA values
74
+ */
75
+ export declare function toARGBColor(r: number, g: number, b: number, a?: number): string;
76
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAGH,YAAY,EAEV,UAAU,EACV,aAAa,EACb,UAAU,EAEV,QAAQ,EACR,UAAU,EACV,aAAa,EACb,oBAAoB,EAEpB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,QAAQ,EACR,YAAY,EAEZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,WAAW,EACX,iBAAiB,EAEjB,OAAO,EACP,gBAAgB,EAChB,SAAS,EAET,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,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,UAAU,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAE5E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAG5E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,GAAG,IAAI,CAGlF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,GACrB,IAAI,CAIN;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG;IAC5C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAmBA;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,SAAM,GAAG,MAAM,CAG5E"}
package/dist/index.js ADDED
@@ -0,0 +1,112 @@
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
+ // GUID utilities
5
+ export { uuidToIfcGuid, ifcGuidToUuid, generateIfcGuid, generateUuid, isValidIfcGuid, isValidUuid, } from './guid.js';
6
+ // Reader
7
+ export { readBCF } from './reader.js';
8
+ // Writer
9
+ export { writeBCF } from './writer.js';
10
+ export { cameraToPerspective, cameraToOrthogonal, perspectiveToCamera, orthogonalToCamera, sectionPlaneToClippingPlane, clippingPlaneToSectionPlane, createViewpoint, extractViewpointState, } from './viewpoint.js';
11
+ import { generateUuid } from './guid.js';
12
+ /**
13
+ * Create a new empty BCF project
14
+ */
15
+ export function createBCFProject(options) {
16
+ return {
17
+ version: options?.version ?? '2.1',
18
+ projectId: generateUuid(),
19
+ name: options?.name,
20
+ topics: new Map(),
21
+ };
22
+ }
23
+ /**
24
+ * Create a new BCF topic (issue)
25
+ */
26
+ export function createBCFTopic(options) {
27
+ return {
28
+ guid: generateUuid(),
29
+ title: options.title,
30
+ description: options.description,
31
+ topicType: options.topicType ?? 'Issue',
32
+ topicStatus: options.topicStatus ?? 'Open',
33
+ priority: options.priority,
34
+ creationDate: new Date().toISOString(),
35
+ creationAuthor: options.author,
36
+ assignedTo: options.assignedTo,
37
+ dueDate: options.dueDate,
38
+ labels: options.labels,
39
+ comments: [],
40
+ viewpoints: [],
41
+ };
42
+ }
43
+ /**
44
+ * Create a new BCF comment
45
+ */
46
+ export function createBCFComment(options) {
47
+ return {
48
+ guid: generateUuid(),
49
+ date: new Date().toISOString(),
50
+ author: options.author,
51
+ comment: options.comment,
52
+ viewpointGuid: options.viewpointGuid,
53
+ };
54
+ }
55
+ /**
56
+ * Add a topic to a project
57
+ */
58
+ export function addTopicToProject(project, topic) {
59
+ project.topics.set(topic.guid, topic);
60
+ }
61
+ /**
62
+ * Add a comment to a topic
63
+ */
64
+ export function addCommentToTopic(topic, comment) {
65
+ topic.comments.push(comment);
66
+ topic.modifiedDate = new Date().toISOString();
67
+ }
68
+ /**
69
+ * Add a viewpoint to a topic
70
+ */
71
+ export function addViewpointToTopic(topic, viewpoint) {
72
+ topic.viewpoints.push(viewpoint);
73
+ topic.modifiedDate = new Date().toISOString();
74
+ }
75
+ /**
76
+ * Update topic status
77
+ */
78
+ export function updateTopicStatus(topic, status, modifiedAuthor) {
79
+ topic.topicStatus = status;
80
+ topic.modifiedDate = new Date().toISOString();
81
+ topic.modifiedAuthor = modifiedAuthor;
82
+ }
83
+ /**
84
+ * Parse ARGB hex color string to RGBA values
85
+ * BCF uses ARGB format (e.g., 'FFFF0000' = opaque red)
86
+ */
87
+ export function parseARGBColor(argb) {
88
+ // Handle both 6 and 8 character formats
89
+ const hex = argb.replace('#', '');
90
+ if (hex.length === 6) {
91
+ return {
92
+ a: 255,
93
+ r: parseInt(hex.substring(0, 2), 16),
94
+ g: parseInt(hex.substring(2, 4), 16),
95
+ b: parseInt(hex.substring(4, 6), 16),
96
+ };
97
+ }
98
+ return {
99
+ a: parseInt(hex.substring(0, 2), 16),
100
+ r: parseInt(hex.substring(2, 4), 16),
101
+ g: parseInt(hex.substring(4, 6), 16),
102
+ b: parseInt(hex.substring(6, 8), 16),
103
+ };
104
+ }
105
+ /**
106
+ * Create ARGB hex color string from RGBA values
107
+ */
108
+ export function toARGBColor(r, g, b, a = 255) {
109
+ const toHex = (n) => Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, '0');
110
+ return `${toHex(a)}${toHex(r)}${toHex(g)}${toHex(b)}`.toUpperCase();
111
+ }
112
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA2C/D,iBAAiB;AACjB,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,GACZ,MAAM,WAAW,CAAC;AAEnB,SAAS;AACT,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,SAAS;AACT,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIvC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,eAAe,EACf,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAAmB,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAGhC;IACC,OAAO;QACL,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,KAAK;QAClC,SAAS,EAAE,YAAY,EAAE;QACzB,IAAI,EAA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,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;QACpC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;QACpC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;KACrC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAC,GAAG,GAAG;IAClE,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACrG,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;AACtE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { BCFProject } from './types.js';
2
+ /**
3
+ * Parse a BCF file (.bcfzip) into a BCFProject
4
+ *
5
+ * @param file - BCF file as File, Blob, or ArrayBuffer
6
+ * @returns Parsed BCF project
7
+ */
8
+ export declare function readBCF(file: File | Blob | ArrayBuffer): Promise<BCFProject>;
9
+ //# sourceMappingURL=reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../src/reader.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,UAAU,EAmBX,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAmBlF"}