Build a package¶
A content package brings building elements or furniture to DomusVox: what they are called, how big they are, how they are placed, how they look in the plan and in 3D. You need no DomusVox code for it, only JSON files, SVG symbols and, if you like, glTF models. Packages are published through the domusvox-registry; its template and RULES.md are the best place to start. The concept behind it is in Packages and the registry.
Files¶
my_package/
manifest.json required: who, what, which version, which licence
elements.json the element types
symbols/*.svg 2D plan symbols
models/*.glb 3D models (optional)
README.md, LICENSE, CHANGELOG.md
Both JSON files are checked by a published JSON Schema:
- package-manifest-1.json for
manifest.json - package-elements-1.json for
elements.json
DomusVox checks the same rules again when it loads a package (parseElementPackage in @domusvox/core). Two rules keep old and new versions working together: unknown fields are ignored, and another schema number is rejected.
An element¶
{
"key": "sofa_three",
"category": "seating",
"names": { "en": "Sofa, three seats", "de": "Sofa, drei Sitze" },
"spoken": { "en": "Sofa for three, 2.2 metres wide", "de": "Sofa für drei, 2,2 Meter breit" },
"size": { "width": 2.2, "depth": 0.9, "height": 0.8 },
"resize": { "width": [1.6, 2.8] },
"placement": { "rule": "at-wall", "gap": 0.05 },
"clearance": [{ "side": "front", "depth": 0.6 }],
"symbol": "symbols/sofa.svg",
"model": "models/sofa.glb",
"modelDetailed": "models/detailed/sofa.glb",
"modelFit": "stretch",
"scanCategories": ["sofa"]
}
sizeis in metres: width and depth on the floor, height upwards, andelevationfor things that do not start at the floor (a window sill). It is the size in the plan and in 3D.placement.ruleis one ofin-wall,at-wall,free,under,on,ceiling. A package only chooses the rule; how placing works is decided by DomusVox.spokenis read by screen readers. Say what it is and how big, in a short sentence.
3D¶
Every element has a body in 3D, even without a model: DomusVox draws a block of size. With a model it looks like the real thing.
model: a glTF binary (.glb), light enough for the hallway tablet (about 3,000 triangles, textures up to 512 × 512 px, about 300 KB).modelDetailed(optional): a heavier model for desktops, undermodels/detailed/(up to 50,000 triangles, 4 MB).- Orientation: metres, Y up, the origin at the centre of the footprint on the floor, the front towards +Z. For elements at a wall, the front is the side facing into the room.
modelFit:stretch(default) scales each side to the chosen size, right for cupboards and kitchen rows;uniformkeeps the proportions and fits inside, right for chairs, lamps and plants.
Plan symbols¶
SVG with shapes and paths only: svg, g, path, rect, circle, ellipse, line, polyline, polygon, title, desc. No scripts, links, text, styles, event handlers or references to anything outside the file. Draw in currentColor, so the symbol follows the look.
In the house¶
A placed piece keeps its footprint and height in the house model and names its element as package:key, for example basis:sofa. If the package is missing, DomusVox still draws a block in its place and says which package would show more.
Versions¶
Packages follow SemVer. domusvox names the DomusVox versions a package needs (">=0.6.0"), dependencies the packages it needs ({ "basis": ">=1.0.0" }). Element keys are part of the public interface: renaming one is a major version, with replaces ({ "couch": "sofa_three" }) so placed pieces move along.