Dev#153
Conversation
Jorgedanisc
…lationships, and improve bounds utility robustness.
…data fields into DucBlock across all language bindings.
…collections across all language bindings.
…lock instance creation and testing.
…or SST scripts with a new `sst:wrap` utility.
Jorgedanisc
There was a problem hiding this comment.
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, andDucBlockCollectionstructures - Updated schema with new fields
block_idsandinstance_idin_DucElementBase - Removed deprecated
DucBlockInstanceElementas 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), | ||
| ] |
There was a problem hiding this comment.
Avoid automated semicolon insertion (93% of all statements in the enclosing script have an explicit semicolon).
| ] | |
| ]; |
| 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"] |
There was a problem hiding this comment.
Variable arrow_inst_1_elems is not used.
| from ducpy.classes.ElementsClass import (DucBlock, DucBlockCollection, DucBlockInstance, DucGroup, DucHead, DucLayer, | ||
| DucRegion, ElementBackground, | ||
| ElementStroke, ElementWrapper, | ||
| GeometricPoint) |
There was a problem hiding this comment.
Import of 'GeometricPoint' is not used.
| @@ -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 | |||
There was a problem hiding this comment.
Import of 'random_versioning' is not used.
| ) | ||
| 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 |
There was a problem hiding this comment.
Import of 'generate_random_id' is not used.
Import of 'DEFAULT_STROKE_COLOR' is not used.
Import of 'DEFAULT_FILL_COLOR' is not used.
| 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 |
There was a problem hiding this comment.
Import of 'STROKE_CAP' is not used.
| 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 |
There was a problem hiding this comment.
Import of 'STROKE_JOIN' is not used.
|
|
||
| import ducpy as duc | ||
| from ducpy.classes.ElementsClass import DucBlockInstanceElement, StringValueEntry | ||
| from ducpy.classes.ElementsClass import DucBlockInstance, StringValueEntry, DucBlockDuplicationArray |
There was a problem hiding this comment.
Import of 'DucBlockDuplicationArray' is not used.
Import of 'StringValueEntry' is not used.
Import of 'DucBlockInstance' is not used.
|
🎉 This PR is included in version 2.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 2.2.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 2.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
No description provided.