@cadview/svelte 0.2.0 → 0.3.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.
@@ -4,6 +4,7 @@
4
4
  CadViewer as CoreCadViewer,
5
5
  type CadViewerOptions,
6
6
  type FormatConverter,
7
+ type DebugOptions,
7
8
  type DxfLayer,
8
9
  type SelectEvent,
9
10
  type MeasureEvent,
@@ -16,7 +17,9 @@
16
17
  file?: File | ArrayBuffer | string | null;
17
18
  theme?: Theme;
18
19
  tool?: Tool;
19
- options?: Omit<CadViewerOptions, 'theme' | 'initialTool'>;
20
+ /** Enable debug overlay. Pass `true` for defaults, or a `DebugOptions` object. */
21
+ debug?: boolean | DebugOptions;
22
+ options?: Omit<CadViewerOptions, 'theme' | 'initialTool' | 'debug'>;
20
23
  /** Format converters for non-DXF file formats (e.g. DWG via @cadview/dwg). */
21
24
  formatConverters?: FormatConverter[];
22
25
  class?: string;
@@ -30,6 +33,7 @@
30
33
  file = null,
31
34
  theme = 'dark',
32
35
  tool = 'pan',
36
+ debug,
33
37
  options = {},
34
38
  formatConverters,
35
39
  class: className = '',
@@ -48,6 +52,7 @@
48
52
 
49
53
  const initialTheme = untrack(() => theme);
50
54
  const initialTool = untrack(() => tool);
55
+ const initialDebug = untrack(() => debug);
51
56
  const initialOptions = untrack(() => options);
52
57
 
53
58
  const initialConverters = untrack(() => formatConverters);
@@ -55,6 +60,7 @@
55
60
  const v = new CoreCadViewer(canvas, {
56
61
  theme: initialTheme,
57
62
  initialTool: initialTool,
63
+ debug: initialDebug,
58
64
  formatConverters: initialConverters,
59
65
  ...initialOptions,
60
66
  });
@@ -76,6 +82,13 @@
76
82
  viewer?.setTool(tool);
77
83
  });
78
84
 
85
+ // React to debug changes
86
+ $effect(() => {
87
+ if (debug !== undefined) {
88
+ viewer?.setDebug(debug);
89
+ }
90
+ });
91
+
79
92
  // React to file changes
80
93
  $effect(() => {
81
94
  if (!viewer || !file) return;
@@ -1,9 +1,11 @@
1
- import { CadViewer as CoreCadViewer, type CadViewerOptions, type FormatConverter, type DxfLayer, type SelectEvent, type MeasureEvent, type ViewTransform, type Tool, type Theme } from '@cadview/core';
1
+ import { CadViewer as CoreCadViewer, type CadViewerOptions, type FormatConverter, type DebugOptions, type DxfLayer, type SelectEvent, type MeasureEvent, type ViewTransform, type Tool, type Theme } from '@cadview/core';
2
2
  interface Props {
3
3
  file?: File | ArrayBuffer | string | null;
4
4
  theme?: Theme;
5
5
  tool?: Tool;
6
- options?: Omit<CadViewerOptions, 'theme' | 'initialTool'>;
6
+ /** Enable debug overlay. Pass `true` for defaults, or a `DebugOptions` object. */
7
+ debug?: boolean | DebugOptions;
8
+ options?: Omit<CadViewerOptions, 'theme' | 'initialTool' | 'debug'>;
7
9
  /** Format converters for non-DXF file formats (e.g. DWG via @cadview/dwg). */
8
10
  formatConverters?: FormatConverter[];
9
11
  class?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"CadViewer.svelte.d.ts","sourceRoot":"","sources":["../src/lib/CadViewer.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,SAAS,IAAI,aAAa,EAC1B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,IAAI,EACT,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAGvB,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC;IAC1D,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAA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CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CAC/C;AAgJH,QAAA,MAAM,SAAS;qBAvBU,aAAa,GAAG,IAAI;qBAIpB,IAAI;qBAIJ,QAAQ,EAAE;4BAID,MAAM,WAAW,OAAO,KAAG,IAAI;MAWV,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,19 @@
1
1
  {
2
2
  "name": "@cadview/svelte",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Svelte 5 wrapper for @cadview/core — CAD/DXF file viewer component",
7
7
  "author": "Wisnu Wicaksono",
8
- "keywords": ["cad", "dxf", "viewer", "svelte", "svelte5", "component", "canvas"],
8
+ "keywords": [
9
+ "cad",
10
+ "dxf",
11
+ "viewer",
12
+ "svelte",
13
+ "svelte5",
14
+ "component",
15
+ "canvas"
16
+ ],
9
17
  "repository": {
10
18
  "type": "git",
11
19
  "url": "git+https://github.com/wiscaksono/cadview.git",
@@ -28,22 +36,27 @@
28
36
  "default": "./dist/index.js"
29
37
  }
30
38
  },
31
- "files": ["dist", "LICENSE", "README.md", "!dist/**/*.test.*"],
32
- "scripts": {
33
- "build": "svelte-package",
34
- "dev": "svelte-package --watch",
35
- "typecheck": "svelte-check"
36
- },
39
+ "files": [
40
+ "dist",
41
+ "LICENSE",
42
+ "README.md",
43
+ "!dist/**/*.test.*"
44
+ ],
37
45
  "peerDependencies": {
38
- "@cadview/core": "workspace:*",
39
- "svelte": "^5.0.0"
46
+ "svelte": "^5.0.0",
47
+ "@cadview/core": "0.3.0"
40
48
  },
41
49
  "devDependencies": {
42
- "@cadview/core": "workspace:*",
43
50
  "@sveltejs/package": "^2.0.0",
44
51
  "svelte": "^5.0.0",
45
52
  "svelte-check": "^4.0.0",
46
- "typescript": "^5.7.0"
53
+ "typescript": "^5.7.0",
54
+ "@cadview/core": "0.3.0"
47
55
  },
48
- "sideEffects": false
49
- }
56
+ "sideEffects": false,
57
+ "scripts": {
58
+ "build": "svelte-package",
59
+ "dev": "svelte-package --watch",
60
+ "typecheck": "svelte-check"
61
+ }
62
+ }