@mlightcad/libredwg-web 0.7.8 → 0.7.10

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.
@@ -1,9 +0,0 @@
1
- import { Dwg_Color } from '../types';
2
- /**
3
- * Encodes a LibreDWG CMC color as the packed int32 used by MLEADER / MLEADERSTYLE DXF.
4
- *
5
- * LibreDWG exposes {@link Dwg_Color.index} (0, 1..255, 256). DXF stores the same
6
- * semantics in a signed 32-bit raw value whose high byte is the color type flag.
7
- */
8
- export declare function encodeDwgColorAsMLeaderRaw(color: Dwg_Color | undefined | null): number | undefined;
9
- //# sourceMappingURL=mleaderColorCodec.d.ts.map
@@ -1,52 +0,0 @@
1
- import { Dwg_Color_Method } from '../types';
2
- /** MLEADERSTYLE DXF raw-color type flag: ByLayer (high byte). */
3
- const RAW_COLOR_TYPE_BY_LAYER = 0xc0;
4
- /** MLEADERSTYLE DXF raw-color type flag: ByBlock (high byte). */
5
- const RAW_COLOR_TYPE_BY_BLOCK = 0xc1;
6
- /** MLEADERSTYLE DXF raw-color type flag: true color (high byte). */
7
- const RAW_COLOR_TYPE_RGB = 0xc2;
8
- /** MLEADERSTYLE DXF raw-color type flag: ACI (high byte). */
9
- const RAW_COLOR_TYPE_ACI = 0xc3;
10
- /** MLEADERSTYLE DXF raw-color type flag: none / window background. */
11
- const RAW_COLOR_TYPE_WINDOW_BG = 0xc8;
12
- /**
13
- * Encodes a LibreDWG CMC color as the packed int32 used by MLEADER / MLEADERSTYLE DXF.
14
- *
15
- * LibreDWG exposes {@link Dwg_Color.index} (0, 1..255, 256). DXF stores the same
16
- * semantics in a signed 32-bit raw value whose high byte is the color type flag.
17
- */
18
- export function encodeDwgColorAsMLeaderRaw(color) {
19
- if (color == null)
20
- return undefined;
21
- const colorMethod = color.method;
22
- const method = color.method != null && colorMethod !== 0
23
- ? colorMethod
24
- : (color.rgb >>> 24) & 0xff;
25
- const index = color.index;
26
- if (method === Dwg_Color_Method.ByLayer || index === 256) {
27
- return (RAW_COLOR_TYPE_BY_LAYER << 24) >> 0;
28
- }
29
- if (method === Dwg_Color_Method.ByBlock || index === 0) {
30
- return (RAW_COLOR_TYPE_BY_BLOCK << 24) >> 0;
31
- }
32
- if (method === Dwg_Color_Method.None) {
33
- return (RAW_COLOR_TYPE_WINDOW_BG << 24) >> 0;
34
- }
35
- if (method === Dwg_Color_Method.TrueColor) {
36
- const rgb = color.rgb != null ? color.rgb & 0xffffff : undefined;
37
- if (rgb != null) {
38
- return ((RAW_COLOR_TYPE_RGB << 24) | rgb) >> 0;
39
- }
40
- }
41
- if (method === Dwg_Color_Method.ForegroundColor) {
42
- return ((RAW_COLOR_TYPE_ACI << 24) | 7) >> 0;
43
- }
44
- if (method === Dwg_Color_Method.Entities && index > 0 && index < 256) {
45
- return ((RAW_COLOR_TYPE_ACI << 24) | (index & 0xff)) >> 0;
46
- }
47
- if (index > 0 && index < 256) {
48
- return ((RAW_COLOR_TYPE_ACI << 24) | (index & 0xff)) >> 0;
49
- }
50
- return undefined;
51
- }
52
- //# sourceMappingURL=mleaderColorCodec.js.map
@@ -1,3 +0,0 @@
1
- import { DwgCodePage } from "../database";
2
- export declare const decodeString: (array: Uint8Array, codepage: DwgCodePage) => string;
3
- //# sourceMappingURL=stringConverter.d.ts.map
@@ -1,7 +0,0 @@
1
- import { dwgCodePageToEncoding } from "../database";
2
- export const decodeString = (array, codepage) => {
3
- const encoding = dwgCodePageToEncoding(codepage);
4
- const decoder = new TextDecoder(encoding);
5
- return decoder.decode(array);
6
- };
7
- //# sourceMappingURL=stringConverter.js.map
@@ -1,7 +0,0 @@
1
- export interface DwgUnknownEntity {
2
- /**
3
- * Entity type
4
- */
5
- type: 'UNKNOWN_ENTITY';
6
- }
7
- //# sourceMappingURL=unknown.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=unknown.js.map
@@ -1,7 +0,0 @@
1
- export interface DwgUnknownObject {
2
- /**
3
- * Object type
4
- */
5
- type: 'UNKNOWN_OBJECT';
6
- }
7
- //# sourceMappingURL=unknown.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=unknown.js.map
package/lib/debug.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export interface LibreDwgDebugOptions {
2
- /** Master switch for all debug output. */
3
- enabled: boolean;
4
- /** Log proxy entity graphics/entity data resolution. */
5
- proxyEntity: boolean;
6
- }
7
- export declare function getLibreDwgDebugOptions(): Readonly<LibreDwgDebugOptions>;
8
- export declare function setLibreDwgDebugOptions(partial: Partial<LibreDwgDebugOptions>): LibreDwgDebugOptions;
9
- export declare function resetLibreDwgDebugOptions(): void;
10
- export declare function isLibreDwgDebugEnabled(scope?: keyof Omit<LibreDwgDebugOptions, 'enabled'>): boolean;
11
- export declare function libreDwgDebugLog(scope: keyof Omit<LibreDwgDebugOptions, 'enabled'>, message: string, data?: unknown): void;
12
- export declare function hexPreview(bytes: Uint8Array | number[] | null | undefined, maxBytes?: number): string;
13
- //# sourceMappingURL=debug.d.ts.map
package/lib/debug.js DELETED
@@ -1,48 +0,0 @@
1
- const defaultOptions = {
2
- enabled: false,
3
- proxyEntity: false
4
- };
5
- let options = { ...defaultOptions };
6
- export function getLibreDwgDebugOptions() {
7
- return options;
8
- }
9
- export function setLibreDwgDebugOptions(partial) {
10
- options = { ...options, ...partial };
11
- return options;
12
- }
13
- export function resetLibreDwgDebugOptions() {
14
- options = { ...defaultOptions };
15
- }
16
- export function isLibreDwgDebugEnabled(scope) {
17
- if (!options.enabled) {
18
- return false;
19
- }
20
- if (!scope) {
21
- return true;
22
- }
23
- return options[scope];
24
- }
25
- export function libreDwgDebugLog(scope, message, data) {
26
- if (!isLibreDwgDebugEnabled(scope)) {
27
- return;
28
- }
29
- if (data === undefined) {
30
- console.log(`[libredwg:${scope}] ${message}`);
31
- }
32
- else {
33
- console.log(`[libredwg:${scope}] ${message}`, data);
34
- }
35
- }
36
- export function hexPreview(bytes, maxBytes = 16) {
37
- if (!bytes || bytes.length === 0) {
38
- return '(empty)';
39
- }
40
- const slice = Array.from(bytes).slice(0, maxBytes);
41
- const hex = slice
42
- .map(b => b.toString(16).toUpperCase().padStart(2, '0'))
43
- .join('');
44
- return bytes.length > maxBytes
45
- ? `${hex}... (${bytes.length} bytes total)`
46
- : hex;
47
- }
48
- //# sourceMappingURL=debug.js.map