Skip to content

Dev#153

Merged
jorgedanisc merged 13 commits into
mainfrom
dev
Dec 12, 2025
Merged

Dev#153
jorgedanisc merged 13 commits into
mainfrom
dev

Conversation

@jorgedanisc
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 12, 2025 21:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a major architectural refactoring of the block system, transitioning from an element-based approach (DucBlockInstanceElement) to a metadata-based approach (DucBlockInstance). The changes introduce a more flexible and scalable design where:

  • Block definitions no longer directly contain elements; instead, elements reference blocks via block_ids
  • Block instances are managed as separate metadata objects with an instance_id
  • New structures for block metadata, collections, and hierarchical organization are added

Key Changes:

  • Refactored block/instance relationship model across all language implementations
  • Added DucBlockMetadata, DucBlockInstance, and DucBlockCollection structures
  • Updated schema with new fields block_ids and instance_id in _DucElementBase
  • Removed deprecated DucBlockInstanceElement as an element type
  • Updated serialization/deserialization logic across Rust, Python, and TypeScript

Reviewed changes

Copilot reviewed 62 out of 64 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
schema/duc.fbs Major schema refactoring: added block metadata, collections, and instance structures; deprecated old block instance element
packages/ducrs/src/types.rs Updated Rust types to reflect new block architecture; removed DucBlockInstanceElement
packages/ducrs/src/serialize.rs Updated serialization for new block structures and element base fields
packages/ducrs/src/parse.rs Updated parsing for new block structures and element base fields
packages/ducpy/* Comprehensive Python implementation updates including builders, serializers, parsers, and tests
packages/ducjs/src/types/elements/index.ts TypeScript type definitions updated for new block system
packages/ducjs/src/serialize.ts TypeScript serialization logic updated
packages/ducjs/src/parse.ts TypeScript parsing logic updated
packages/ducpdf/src/duc2pdf/* Removed block instance element handling from PDF converter
packages/ducsvg/vite.config.mts Added externalization for WASM dependencies
Various config files Build configuration and dependency updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

MIME_TYPES.stp,
MIME_TYPES.stl,
...Object.values(IMAGE_MIME_TYPES),
]
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid automated semicolon insertion (93% of all statements in the enclosing script have an explicit semicolon).

Suggested change
]
];

Copilot uses AI. Check for mistakes.
parsed_instances = [i for i in parsed_instances if i.id != "arrow_inst_2"]
assert len(title_inst_2_elems) == 2

arrow_inst_1_elems = [el for el in parsed_elements if val_get_base(el.element).instance_id == "arrow_inst_1"]
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable arrow_inst_1_elems is not used.

Copilot uses AI. Check for mistakes.
Comment on lines +11 to 14
from ducpy.classes.ElementsClass import (DucBlock, DucBlockCollection, DucBlockInstance, DucGroup, DucHead, DucLayer,
DucRegion, ElementBackground,
ElementStroke, ElementWrapper,
GeometricPoint)
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'GeometricPoint' is not used.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,39 @@
from typing import List, Optional
from ducpy.classes.ElementsClass import DucBlockInstance, DucBlockDuplicationArray, StringValueEntry
from ducpy.utils.rand_utils import random_versioning
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'random_versioning' is not used.

Copilot uses AI. Check for mistakes.
)
from .style_builders import create_simple_styles, create_text_style, create_paragraph_formatting, create_stack_format_properties, create_stack_format, create_doc_style, create_text_column, create_column_layout
from ducpy.utils import generate_random_id, DEFAULT_SCOPE, DEFAULT_STROKE_COLOR, DEFAULT_FILL_COLOR
from ducpy.utils import generate_random_id, DEFAULT_SCOPE, DEFAULT_STROKE_COLOR, DEFAULT_FILL_COLOR, DEFAULT_STROKE_WIDTH
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'generate_random_id' is not used.
Import of 'DEFAULT_STROKE_COLOR' is not used.
Import of 'DEFAULT_FILL_COLOR' is not used.

Copilot uses AI. Check for mistakes.
from ducpy.Duc.IMAGE_STATUS import IMAGE_STATUS
from ducpy.Duc.STROKE_PREFERENCE import STROKE_PREFERENCE
from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT
from ducpy.Duc.STROKE_CAP import STROKE_CAP
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'STROKE_CAP' is not used.

Copilot uses AI. Check for mistakes.
from ducpy.Duc.STROKE_PREFERENCE import STROKE_PREFERENCE
from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT
from ducpy.Duc.STROKE_CAP import STROKE_CAP
from ducpy.Duc.STROKE_JOIN import STROKE_JOIN
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'STROKE_JOIN' is not used.

Copilot uses AI. Check for mistakes.

import ducpy as duc
from ducpy.classes.ElementsClass import DucBlockInstanceElement, StringValueEntry
from ducpy.classes.ElementsClass import DucBlockInstance, StringValueEntry, DucBlockDuplicationArray
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'DucBlockDuplicationArray' is not used.
Import of 'StringValueEntry' is not used.
Import of 'DucBlockInstance' is not used.

Copilot uses AI. Check for mistakes.
@jorgedanisc jorgedanisc merged commit d1b98ac into main Dec 12, 2025
13 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants