@@ -216,9 +216,48 @@ def serialize_duc(
216216 layers : Optional [list ] = None ,
217217 external_files : Optional [list ] = None ,
218218) -> bytes :
219- """Serialize elements to ``.duc`` format.
220- Element instances and state dataclasses are automatically converted to the
221- camelCase dicts expected by the Rust native module.
219+ """Serialize elements and document state to raw ``.duc`` binary format.
220+
221+ This function accepts lists of elements created via the `ducpy.builders` API
222+ (e.g., `ElementBuilder`) and serializes them into the compressed format
223+ expected by `.duc` files. Element instances and state dataclasses are
224+ automatically converted to the camelCase dicts expected by the Rust native module.
225+
226+ Parameters
227+ ----------
228+ name : str
229+ The document name or identifier (used to populate the `source` field).
230+ thumbnail : Optional[bytes], default=None
231+ Raw PNG bytes representing a thumbnail of the document.
232+ dictionary : Optional[list], default=None
233+ List of Key-Value string pairs for dictionary entries.
234+ elements : Optional[list], default=None
235+ A list of elements (e.g., created via `ElementBuilder`) to include.
236+ duc_local_state : Any, default=None
237+ A `DucLocalState` object representing viewport state (pan, zoom, etc).
238+ duc_global_state : Any, default=None
239+ A `DucGlobalState` object representing document-wide settings.
240+ version_graph : Any, default=None
241+ Version history metadata of the document.
242+ blocks : Optional[list], default=None
243+ List of block definitions.
244+ block_instances : Optional[list], default=None
245+ List of block instances.
246+ block_collections : Optional[list], default=None
247+ List of block collections (libraries).
248+ groups : Optional[list], default=None
249+ List of element groups.
250+ regions : Optional[list], default=None
251+ List of boolean regions.
252+ layers : Optional[list], default=None
253+ List of document layers.
254+ external_files : Optional[list], default=None
255+ List of external files (e.g., embedded images or PDFs).
256+
257+ Returns
258+ -------
259+ bytes
260+ The raw `.duc` binary data, ready to be written to a file.
222261 """
223262 thumb = bytes (thumbnail ) if thumbnail is not None else None
224263
0 commit comments