ducjs 3.4.3 → 3.4.4

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/README.md CHANGED
@@ -20,22 +20,13 @@ For detailed documentation, including all available types and utility functions,
20
20
 
21
21
  ## Tools
22
22
 
23
- - [Playground](https://ducflair.com/core): Experiment with the `duc` format in a live environment.
23
+ - [Playground](https://scopture.com/w/hollow): Experiment with the `duc` format in a live environment.
24
24
  - [Documentation](https://duc.ducflair.com): Comprehensive guides and API references.
25
25
 
26
26
  ## Contributing
27
27
 
28
- At the moment we are not accepting contributions to this package. However, we welcome feedback and suggestions for future improvements. Feel free to open an issue or contact us at [Ducflair Support](https://www.ducflair.com/support).
28
+ Feel free to open an issue or contact us at [Ducflair Support](https://www.ducflair.com/support).
29
29
 
30
30
  ## License
31
31
 
32
- This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
33
-
34
-
35
- ## Commit Message Guidelines
36
-
37
- To ensure smooth releases with semantic-release, please follow [these guidelines](https://semantic-release.gitbook.io/semantic-release#how-does-it-work).
38
-
39
- ---
40
-
41
- *The duc format and libraries are constantly evolving, aiming to set new standards in the 2D CAD industry. Be a part of this transformation and help shape the future of design technology!*
32
+ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
@@ -415,7 +415,7 @@ export function serializeDuc(data) {
415
415
  * @returns {number}
416
416
  */
417
417
  export function getCurrentSchemaVersion() {
418
- return 3000004;
418
+ return 3000005;
419
419
  }
420
420
 
421
421
  /**
Binary file
@@ -10,8 +10,8 @@ export declare const newElement: (currentScope: Scope, opts: {
10
10
  export declare const newEmbeddableElement: (currentScope: Scope, opts: {
11
11
  type: "embeddable";
12
12
  } & ElementConstructorOpts) => NonDeleted<DucEmbeddableElement>;
13
- export declare const newFrameElement: (currentScope: Scope, opts: ElementConstructorOpts) => NonDeleted<DucFrameElement>;
14
- export declare const newPlotElement: (currentScope: Scope, opts: ElementConstructorOpts) => NonDeleted<DucPlotElement>;
13
+ export declare const newFrameElement: (currentScope: Scope, opts: Partial<DucFrameElement> & ElementConstructorOpts) => NonDeleted<DucFrameElement>;
14
+ export declare const newPlotElement: (currentScope: Scope, opts: Partial<DucPlotElement> & ElementConstructorOpts) => NonDeleted<DucPlotElement>;
15
15
  export declare const newEllipseElement: (currentScope: Scope, opts: {
16
16
  type: "ellipse";
17
17
  ratio?: DucEllipseElement["ratio"];
@@ -35,8 +35,8 @@ export declare const newArrowElement: (currentScope: Scope, opts: Partial<DucArr
35
35
  export declare const newImageElement: (currentScope: Scope, opts: Partial<DucImageElement> & ElementConstructorOpts) => NonDeleted<DucImageElement>;
36
36
  export declare const newTableElement: (currentScope: Scope, opts: Partial<DucTableElement> & ElementConstructorOpts) => NonDeleted<DucTableElement>;
37
37
  export declare const newDocElement: (currentScope: Scope, opts: Partial<DucDocElement> & ElementConstructorOpts) => NonDeleted<DucDocElement>;
38
- export declare const newPdfElement: (currentScope: Scope, opts: ElementConstructorOpts) => NonDeleted<DucPdfElement>;
39
- export declare const newModelElement: (currentScope: Scope, opts: ElementConstructorOpts) => NonDeleted<DucModelElement>;
38
+ export declare const newPdfElement: (currentScope: Scope, opts: Partial<DucPdfElement> & ElementConstructorOpts) => NonDeleted<DucPdfElement>;
39
+ export declare const newModelElement: (currentScope: Scope, opts: Partial<DucModelElement> & ElementConstructorOpts) => NonDeleted<DucModelElement>;
40
40
  /**
41
41
  * Clones DucElement data structure. Does not regenerate id, nonce, or
42
42
  * any value. The purpose is to to break object references for immutability
@@ -144,6 +144,7 @@ const withDisabledContentVisibility = (items, fallback) => {
144
144
  const source = (items === null || items === void 0 ? void 0 : items.length) ? items : [fallback];
145
145
  return source.map((item) => (Object.assign(Object.assign({}, item), { content: Object.assign(Object.assign({}, item.content), { visible: false }) })));
146
146
  };
147
+ const getDxfDefaultBackground = () => (Object.assign(Object.assign({}, DEFAULT_ELEMENT_PROPS.background), { content: Object.assign(Object.assign({}, DEFAULT_ELEMENT_PROPS.background.content), { src: "#ffffff", visible: false, opacity: 1 }) }));
147
148
  const getMediaElementStyle = (opts) => ({
148
149
  stroke: withDisabledContentVisibility(opts.stroke, DEFAULT_ELEMENT_PROPS.stroke),
149
150
  background: withDisabledContentVisibility(opts.background, DEFAULT_ELEMENT_PROPS.background),
@@ -172,9 +173,14 @@ export const newDocElement = (currentScope, opts) => {
172
173
  };
173
174
  export const newPdfElement = (currentScope, opts) => (Object.assign(Object.assign({ fileId: null, gridConfig: { columns: 1, gapX: 0, gapY: 0, firstPageAlone: false, scale: 1 } }, _newElementBase("pdf", currentScope, Object.assign(Object.assign({}, opts), getDocumentElementStyle(opts)))), { type: "pdf" }));
174
175
  export const newModelElement = (currentScope, opts) => {
176
+ var _a;
177
+ const modelType = (_a = opts.modelType) === null || _a === void 0 ? void 0 : _a.toLowerCase();
178
+ const backgroundFallback = modelType === "dxf" || modelType === "dwg"
179
+ ? getDxfDefaultBackground()
180
+ : DEFAULT_ELEMENT_PROPS.background;
175
181
  const modelStyle = {
176
182
  stroke: withDisabledContentVisibility(opts.stroke, DEFAULT_ELEMENT_PROPS.stroke),
177
- background: withDisabledContentVisibility(opts.background, DEFAULT_ELEMENT_PROPS.background),
183
+ background: withDisabledContentVisibility(opts.background, backgroundFallback),
178
184
  };
179
185
  return Object.assign(Object.assign({ modelType: null, code: null, thumbnail: null, fileIds: [], viewerState: null }, _newElementBase("model", currentScope, Object.assign(Object.assign({}, opts), modelStyle))), { type: 'model' });
180
186
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ducjs",
3
- "version": "3.4.3",
3
+ "version": "3.4.4",
4
4
  "description": "The duc 2D CAD file format is a cornerstone of our advanced design system, conceived to cater to professionals seeking precision and efficiency in their design work.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",