@machineblocks/render-target 0.0.0-stage → 0.1.0

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.
Files changed (89) hide show
  1. package/blocks/com/machineblocks/bml/target/render/Library.bml +55 -0
  2. package/blocks/com/machineblocks/bml/target/render/README.bml +37 -0
  3. package/blocks/com/machineblocks/bml/target/render/documentation/AssemblyPatterns.bml +47 -0
  4. package/blocks/com/machineblocks/bml/target/render/documentation/CompositeRendering.bml +60 -0
  5. package/blocks/com/machineblocks/bml/target/render/documentation/Customizer.bml +62 -0
  6. package/blocks/com/machineblocks/bml/target/render/documentation/DomainBoundary.bml +43 -0
  7. package/blocks/com/machineblocks/bml/target/render/documentation/ExpressionRenderer.bml +58 -0
  8. package/blocks/com/machineblocks/bml/target/render/documentation/FileStructure.bml +42 -0
  9. package/blocks/com/machineblocks/bml/target/render/documentation/FqnNaming.bml +85 -0
  10. package/blocks/com/machineblocks/bml/target/render/documentation/HelperFunctions.bml +57 -0
  11. package/blocks/com/machineblocks/bml/target/render/documentation/Imports.bml +49 -0
  12. package/blocks/com/machineblocks/bml/target/render/documentation/Introduction.bml +43 -0
  13. package/blocks/com/machineblocks/bml/target/render/documentation/LeafOptimization.bml +44 -0
  14. package/blocks/com/machineblocks/bml/target/render/documentation/NativeMappings.bml +58 -0
  15. package/blocks/com/machineblocks/bml/target/render/documentation/Presets.bml +50 -0
  16. package/blocks/com/machineblocks/bml/target/render/documentation/PropertyRenderer.bml +50 -0
  17. package/blocks/com/machineblocks/bml/target/render/documentation/RendererPipeline.bml +51 -0
  18. package/blocks/com/machineblocks/bml/target/render/documentation/SerializationRules.bml +84 -0
  19. package/blocks/com/machineblocks/bml/target/render/documentation/SetRendering.bml +77 -0
  20. package/blocks/com/machineblocks/bml/target/render/documentation/SettingsFormat.bml +80 -0
  21. package/blocks/com/machineblocks/bml/target/render/documentation/SourceMaps.bml +33 -0
  22. package/blocks/com/machineblocks/bml/target/render/documentation/TargetRegistration.bml +61 -0
  23. package/blocks/com/machineblocks/bml/target/render/documentation/V1Scope.bml +44 -0
  24. package/dist/composite.d.ts +8 -0
  25. package/dist/composite.d.ts.map +1 -0
  26. package/dist/composite.js +232 -0
  27. package/dist/composite.js.map +1 -0
  28. package/dist/composition.d.ts +6 -0
  29. package/dist/composition.d.ts.map +1 -0
  30. package/dist/composition.js +40 -0
  31. package/dist/composition.js.map +1 -0
  32. package/dist/diagnostics.d.ts +22 -0
  33. package/dist/diagnostics.d.ts.map +1 -0
  34. package/dist/diagnostics.js +29 -0
  35. package/dist/diagnostics.js.map +1 -0
  36. package/dist/dispatch.d.ts +13 -0
  37. package/dist/dispatch.d.ts.map +1 -0
  38. package/dist/dispatch.js +46 -0
  39. package/dist/dispatch.js.map +1 -0
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +8 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/leaf.d.ts +4 -0
  45. package/dist/leaf.d.ts.map +1 -0
  46. package/dist/leaf.js +92 -0
  47. package/dist/leaf.js.map +1 -0
  48. package/dist/machineblocks-render-target.d.ts +14 -0
  49. package/dist/machineblocks-render-target.d.ts.map +1 -0
  50. package/dist/machineblocks-render-target.js +63 -0
  51. package/dist/machineblocks-render-target.js.map +1 -0
  52. package/dist/naming.d.ts +29 -0
  53. package/dist/naming.d.ts.map +1 -0
  54. package/dist/naming.js +120 -0
  55. package/dist/naming.js.map +1 -0
  56. package/dist/options.d.ts +8 -0
  57. package/dist/options.d.ts.map +1 -0
  58. package/dist/options.js +26 -0
  59. package/dist/options.js.map +1 -0
  60. package/dist/paths.d.ts +6 -0
  61. package/dist/paths.d.ts.map +1 -0
  62. package/dist/paths.js +55 -0
  63. package/dist/paths.js.map +1 -0
  64. package/dist/presets.d.ts +6 -0
  65. package/dist/presets.d.ts.map +1 -0
  66. package/dist/presets.js +105 -0
  67. package/dist/presets.js.map +1 -0
  68. package/dist/processors.d.ts +24 -0
  69. package/dist/processors.d.ts.map +1 -0
  70. package/dist/processors.js +72 -0
  71. package/dist/processors.js.map +1 -0
  72. package/dist/serialize.d.ts +7 -0
  73. package/dist/serialize.d.ts.map +1 -0
  74. package/dist/serialize.js +42 -0
  75. package/dist/serialize.js.map +1 -0
  76. package/dist/set-file.d.ts +5 -0
  77. package/dist/set-file.d.ts.map +1 -0
  78. package/dist/set-file.js +199 -0
  79. package/dist/set-file.js.map +1 -0
  80. package/dist/source-map.d.ts +13 -0
  81. package/dist/source-map.d.ts.map +1 -0
  82. package/dist/source-map.js +41 -0
  83. package/dist/source-map.js.map +1 -0
  84. package/dist/version.d.ts +8 -0
  85. package/dist/version.d.ts.map +1 -0
  86. package/dist/version.js +8 -0
  87. package/dist/version.js.map +1 -0
  88. package/package.json +41 -4
  89. package/README.md +0 -3
@@ -0,0 +1,44 @@
1
+ <!--Render Target Documentation — LeafOptimization
2
+ FQN: com.machineblocks.bml.target.render.documentation.LeafOptimization-->
3
+ <rdoc:LeafOptimization xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Direct mb_block call for single-NativeBlock types
12
+ </is>
13
+ <documentation>
14
+ Some block types are a single NativeBlock: every property maps 1:1 to
15
+ native settings, no sub-blocks, no multi-child composition. Example:
16
+ com.machineblocks.bml.bricks.Standard.
17
+
18
+ Standalone compile of such a block emits a direct mb_block() main call.
19
+ Customizer variables are the settings. There is no typed wrapper module and
20
+ no mb_param_* extraction layer:
21
+
22
+ mb_block(
23
+ config = mb_config,
24
+ settings = [
25
+ ["size", size],
26
+ ["studs", studs]
27
+ ]
28
+ );
29
+
30
+ This avoids the extra module call found in older hand-maintained SCAD
31
+ artifacts. Composite blocks with real inner structure (Wall, Calibrator)
32
+ still emit typed modules.
33
+
34
+ Exactly one NativeBlock child uses this direct call. Zero children returns
35
+ files: [] and diagnostic MB_EMPTY_BLOCK. Two or more children use the
36
+ composite module in CompositeRendering. A leaf parameter that is not a
37
+ property reference, or a default other than a boolean, number, string, or
38
+ SizeXYZ, returns files: [] and diagnostic BML_LEAF_VALUE_UNSUPPORTED.
39
+
40
+ </documentation>
41
+ <references>
42
+ <see type="rdoc:CompositeRendering" relation="ReadNext" />
43
+ </references>
44
+ </rdoc:LeafOptimization>
@@ -0,0 +1,58 @@
1
+ <!--Render Target Documentation — NativeMappings
2
+ FQN: com.machineblocks.bml.target.render.documentation.NativeMappings-->
3
+ <rdoc:NativeMappings xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Declarative map from built-in capabilities to native SCAD functions
12
+ </is>
13
+ <documentation>
14
+ ScadBlockProcessor reads a declarative JSON file, scad-native-mappings.json,
15
+ shipped with this package. It maps #built-in capability calls to native SCAD
16
+ functions when a 1:1 equivalent exists, so trivial calls do not import a
17
+ helper.
18
+
19
+ Location: package root of @machineblocks/render-target, file
20
+ scad-native-mappings.json.
21
+
22
+ Format: service FQN to function name to { native, arity }.
23
+ native null means no direct SCAD equivalent: emit the FQN-prefixed function
24
+ and add a use import. arity -1 means variadic.
25
+
26
+ Initial map:
27
+
28
+ org.blockml.bml.service.Math
29
+ min max floor ceil round abs pow sqrt — native of the same name, arity 1 or 2
30
+ round_n clamp — native null
31
+ org.blockml.bml.service.Strings
32
+ length — native len, arity 1
33
+ concat — native str, arity -1
34
+
35
+ Resolution for each #built-in in ${ } expressions or in embedded expressions
36
+ inside SCAD implementations:
37
+
38
+ #math.min(a, b) -> min(a, b), no import
39
+ #math.round_n(x, 1) -> bom__org__blockml__service__Math__round_n(x, 1)
40
+ plus use of Math.scad
41
+ #strings.length(s) -> len(s), no import
42
+
43
+ Functions inside the service SCAD files use the bom__ prefix and __ separators:
44
+
45
+ function bom__org__blockml__service__Math__round_n(x, n) =
46
+ round(x * pow(10, n)) / pow(10, n);
47
+ function bom__org__blockml__service__Math__clamp(x, lo, hi) =
48
+ min(max(x, lo), hi);
49
+
50
+ The same prefix pattern applies to the other Math helpers (min, max, floor,
51
+ ceil, round, abs, pow, sqrt) even when the native map also emits the short
52
+ SCAD name. The service file remains the fallback implementation.
53
+
54
+ </documentation>
55
+ <references>
56
+ <see type="rdoc:FileStructure" relation="ReadNext" />
57
+ </references>
58
+ </rdoc:NativeMappings>
@@ -0,0 +1,50 @@
1
+ <!--Render Target Documentation — Presets
2
+ FQN: com.machineblocks.bml.target.render.documentation.Presets-->
3
+ <rdoc:Presets xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Preset blocks to OpenSCAD customizer JSON
12
+ </is>
13
+ <documentation>
14
+ A preset block (for example com.machineblocks.bml.bricks.StandardPresets
15
+ with a _presets composition) may be rendered to an OpenSCAD customizer JSON
16
+ file. The compiler merges appliedPresets chains before serialization.
17
+
18
+ The JSON uses the preset name as the key (the label shown in the OpenSCAD UI):
19
+
20
+ {
21
+ "fileFormatVersion": "1",
22
+ "parameterSets": {
23
+ "Brick 2x4": {
24
+ "size": "[2, 4, 3]",
25
+ "baseColor": "#EAC645",
26
+ "studs": "true"
27
+ },
28
+ "Brick 1x1": {
29
+ "size": "[1, 1, 3]",
30
+ "baseColor": "#EAC645"
31
+ }
32
+ }
33
+ }
34
+
35
+ All parameter values are strings (OpenSCAD customizer requirement). Emit
36
+ only properties whose preset value differs from the block default. Omitted
37
+ properties fall back to those defaults when OpenSCAD loads the parameter
38
+ set.
39
+
40
+ A block whose only composition is presets is rendered to the manifestation
41
+ path with a .json suffix instead of a .scad file. basePresets chains are
42
+ merged left to right, then the instance's own values overlay them. The
43
+ parameter set key is the instance name. A basePresets cycle returns
44
+ files: [] and diagnostic BML_PRESET_CYCLE.
45
+
46
+ </documentation>
47
+ <references>
48
+ <see type="rdoc:SourceMaps" relation="ReadNext" />
49
+ </references>
50
+ </rdoc:Presets>
@@ -0,0 +1,50 @@
1
+ <!--Render Target Documentation — PropertyRenderer
2
+ FQN: com.machineblocks.bml.target.render.documentation.PropertyRenderer-->
3
+ <rdoc:PropertyRenderer xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ MBOM properties to settings entries
12
+ </is>
13
+ <documentation>
14
+ The property renderer fills a SettingsBundle. V1 emission is a pseudo-map
15
+ pair ["paramName", value] per entry.
16
+
17
+ Native parameter inventory and scad:value defaults come from NativeBlock.bml
18
+ in @machineblocks/core. There is no hardcoded parameter list in this
19
+ package. The old 09_mbom_properties.yml file is a pointer stub only.
20
+
21
+ Each property definition supplies:
22
+
23
+ - name — MBOM property name, camelCase
24
+ - scadName — SCAD parameter name, camelCase, usually identical
25
+ - type — MBOM type FQN
26
+ - serializer — rule from SerializationRules
27
+ - default — default value
28
+
29
+ V1 reads property values from memberValues and definition defaults, not via
30
+ accessor capabilities.
31
+
32
+ Native properties (those declared on the NativeBlock set) map to dedicated
33
+ getters in the generated module body:
34
+
35
+ size = mb_param_size(config, settings, [1, 8, 9]);
36
+ baseColor = mb_param_baseColor(config, settings);
37
+
38
+ Custom properties map to the generic getter:
39
+
40
+ wallThickness = mb_param(config, settings, "wallThickness", 1);
41
+ cornerRounding = mb_param(config, settings, "cornerRounding", 0.5);
42
+
43
+ Native versus custom is decided from the domain TypeRegistry (the
44
+ NativeBlock property set), not from a list in this package.
45
+
46
+ </documentation>
47
+ <references>
48
+ <see type="rdoc:ExpressionRenderer" relation="ReadNext" />
49
+ </references>
50
+ </rdoc:PropertyRenderer>
@@ -0,0 +1,51 @@
1
+ <!--Render Target Documentation — RendererPipeline
2
+ FQN: com.machineblocks.bml.target.render.documentation.RendererPipeline-->
3
+ <rdoc:RendererPipeline xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Internal pipeline of each block renderer
12
+ </is>
13
+ <documentation>
14
+ These steps belong to this target. They are not a framework-wide pipeline.
15
+ Numbers 9-11 below match the historical SCAD reference notes in the compiler
16
+ handbook; the rest are internal to the processors.
17
+
18
+ MBOM Block
19
+ Module Name Resolver — FQN to SCAD module name
20
+ Import Resolver — FQN to use/include paths
21
+ Property Renderer — MBOM properties to settings entries
22
+ Expression Renderer — expression AST to SCAD expressions
23
+ Assembly Pattern Mapper — semantic values to SCAD assembly calls
24
+ Composition Renderer — compositions to nested mb_block() calls
25
+ (ScadBlockProcessor only)
26
+ Set Renderer — set to STEPS array plus view submodules
27
+ (ScadSetProcessor only)
28
+ Customizer Generator — properties to the OpenSCAD customizer section
29
+ Source Map Generator — BML positions to SCAD positions (Source Map V3)
30
+ ScadFile(s)
31
+
32
+ Before dispatch, on a working copy (canonical BOM unchanged):
33
+
34
+ 9. Target Resolver — look up machineblocks-v3-scad. If the target cannot
35
+ support a block baseType, emit a diagnostic for that block.
36
+ 10. expandDirectives() plus id resolution — expand bml:each, bml:if, and
37
+ bml:with on the composition tree. Then evaluate id expressions, assign
38
+ deterministic auto-ids to static unreferenced children that still lack
39
+ an id, and compose nested paths (parentPartId::childPartId) for output.
40
+ Auto-ids are not written back to the BomDocument.
41
+ 11. Block renderer dispatch — exact FQN, then baseType chain, then delegates.
42
+
43
+ Renderers may call framework validation utilities during the pipeline.
44
+ They choose Urmodell, a pragmatic fork, or further forks. They do not mutate
45
+ the canonical document.
46
+
47
+ </documentation>
48
+ <references>
49
+ <see type="rdoc:FqnNaming" relation="ReadNext" />
50
+ </references>
51
+ </rdoc:RendererPipeline>
@@ -0,0 +1,84 @@
1
+ <!--Render Target Documentation — SerializationRules
2
+ FQN: com.machineblocks.bml.target.render.documentation.SerializationRules-->
3
+ <rdoc:SerializationRules xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ How MBOM values become SCAD settings expressions
12
+ </is>
13
+ <documentation>
14
+ Type shapes live on com.machineblocks.bml.type.* and native parameters on
15
+ NativeBlock.bml. This block is only the emit strategy (transferred from the
16
+ former types handbook, section 6).
17
+
18
+ Strategy:
19
+
20
+ 1. Read the BOM member value in authored form.
21
+ 2. Consult type metadata (field order, serialize capability, NativeBlock
22
+ scad:value).
23
+ 3. Translate at render time.
24
+ 4. Choose the shortest valid SCAD expression.
25
+ 5. Add scadName to expression text on the SettingsBundle.
26
+ 6. The SettingsEmitter writes the bundle (V1 pseudo-map pair, future object).
27
+
28
+ Default struct to SCAD array: element order is the type's property
29
+ declaration order — the same ordinal as BML positional array literals.
30
+ Do not invent a separate SCAD index convention.
31
+
32
+ FaceMapXY properties xNeg, xPos, yNeg, yPos
33
+ MBOM { xNeg: 1, xPos: 1, yNeg: 0, yPos: 0 }
34
+ SCAD [1, 1, 0, 0]
35
+
36
+ Exceptions must be defined on the type, the property, or an annotation
37
+ facet. Never implied:
38
+
39
+ - Compact forms (PerSide4 scalar or 2-element when faces are paired)
40
+ - Enum / catalog literals via scad:value
41
+ - A custom serialize capability on the type or property
42
+
43
+ Examples (settings entry shown as the V1 pair):
44
+
45
+ SizeXYZ { x:4, y:2, z:3 } -> ["size", [4, 2, 3]]
46
+
47
+ AxisXYZ holeXYZDiameter
48
+ - all auto -> ["holeXYZDiameter", "auto"]
49
+ - { x:3, y:3, z:4 } -> ["holeXYZDiameter", [3, 4]]
50
+ - { x:3, y:3.2, z:4 } -> ["holeXYZDiameter", [3, 3.2, 4]]
51
+
52
+ PerSide4 recessWallThickness
53
+ - all 0.333 -> ["recessWallThickness", 0.333]
54
+ - x faces 0.5, y faces 0.25 -> ["recessWallThickness", [0.5, 0.25]]
55
+ - 0.5, 0.4, 0.25, 0.2 -> ["recessWallThickness", [0.5, 0.4, 0.25, 0.2]]
56
+
57
+ FaceVector6 sizeMod
58
+ - { "x-":0, "x+":0.5, others 0 } -> ["sizeMod", [0, 0.5, 0, 0, 0, 0]]
59
+
60
+ FaceMap baseAdjustment
61
+ - { "x-": -0.1, "x+": -0.1, "z+": 0.05 }
62
+ -> ["baseAdjustment", [["x-", -0.1], ["x+", -0.1], ["z+", 0.05]]]
63
+ - namespaced keys pass through: "pbx.x+", "pty.z+"
64
+
65
+ SelectiveGrid studs
66
+ - studs true stays ["studs", true]
67
+ - studAreas become [["studAreas", [[[0,0],[1,1], false], [[2,0],[3,1], "hollow"]]]]
68
+
69
+ WallGapList recessWallGaps
70
+ - [{ face:"x+", position:0, length:"full" }, { face:"y-", position:2, length:3 }]
71
+ -> ["recessWallGaps", [["x+"], ["y-", 2, 3]]]
72
+
73
+ Direction.West -> ["direction", "west"]
74
+
75
+ Color { hex: "#EAC645" } -> ["baseColor", "#EAC645"]
76
+
77
+ Expressions stay ExpressionValue { raw } on the BOM. The renderer serializes
78
+ the parsed AST or a statically resolved value. See ExpressionRenderer.
79
+
80
+ </documentation>
81
+ <references>
82
+ <see type="rdoc:DomainBoundary" relation="ReadNext" />
83
+ </references>
84
+ </rdoc:SerializationRules>
@@ -0,0 +1,77 @@
1
+ <!--Render Target Documentation — SetRendering
2
+ FQN: com.machineblocks.bml.target.render.documentation.SetRendering-->
3
+ <rdoc:SetRendering xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Set processor: STEPS, bounding box, and view submodules
12
+ </is>
13
+ <documentation>
14
+ A block whose baseType chain includes com.machineblocks.bml.core.Set is
15
+ rendered by ScadSetProcessor as a SCAD file with a STEPS array and four
16
+ view submodules.
17
+
18
+ A MachineBlocks set uses three aggregations. _presets and _parts are
19
+ inherited. _steps is declared on Set.
20
+
21
+ - _presets — palette; configurations referenced by appliedPresets on _parts
22
+ - _parts — placed instances (direction, offset, appliedPresets; id becomes
23
+ the SCAD instance id)
24
+ - _steps — assembly order; optional; default is _parts document order
25
+
26
+ STEPS is generated from the placement list. Each entry:
27
+
28
+ [instanceId, boundingBox, direction, offset]
29
+
30
+ - [0] instanceId — string from the placed instance id
31
+ - [1] boundingBox — [x, y, z] from merged preset/configuration size
32
+ - [2] direction — "west" | "north" | "east" | "south"
33
+ - [3] offset — [x, y, z]
34
+
35
+ Example:
36
+
37
+ STEPS = [
38
+ ["00001", [16, 16, 1], "west", [0, 0, 0]],
39
+ ["00002", [4, 4, 9], "west", [0, 0, 1]]
40
+ ];
41
+
42
+ The set bounding box is computed at SCAD render time, not by the compiler:
43
+
44
+ ["size", mb_set_bounding_box(STEPS)]
45
+
46
+ Four submodules, PascalCase suffixes of the set module:
47
+
48
+ ...DefaultEnclosure__Total
49
+ ...DefaultEnclosure__Print
50
+ ...DefaultEnclosure__Step
51
+ ...DefaultEnclosure__Instance
52
+
53
+ The Instance submodule dispatches with if / else if on instanceId to
54
+ per-instance modules named with the id appended by underscore
55
+ (...__Instance_00001). Each of those modules calls the manifestation
56
+ module of the placed part's type FQN.
57
+
58
+ Total and Print call every instance module in STEPS order. Step calls the
59
+ prefix of that list whose index is less than or equal to the customizer
60
+ variable step. When _steps is absent, STEPS follows _parts document order.
61
+ A missing direction defaults to "west". A missing offset defaults to
62
+ [0, 0, 0]. A missing id or size returns files: [] and diagnostic
63
+ BML_SET_PART_INCOMPLETE.
64
+
65
+ Set customizer variables:
66
+
67
+ mode = "total"; // [total:Total, print:3D Print, step:Step, instance:Instance]
68
+ step = 0; // [0:9]
69
+ instanceId = "00001";
70
+ assembly = "merged"; // [unassembled:Unassembled, assembled:Assembled, merged:Merged]
71
+ baseColor = "#EAC645";
72
+
73
+ </documentation>
74
+ <references>
75
+ <see type="rdoc:Customizer" relation="ReadNext" />
76
+ </references>
77
+ </rdoc:SetRendering>
@@ -0,0 +1,80 @@
1
+ <!--Render Target Documentation — SettingsFormat
2
+ FQN: com.machineblocks.bml.target.render.documentation.SettingsFormat-->
3
+ <rdoc:SettingsFormat xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ SettingsBundle plus emitter, pseudo-map in V1
12
+ </is>
13
+ <documentation>
14
+ The V3 library passes instance parameters via a settings argument on
15
+ mb_block and reads them with mb_param(config, settings, key, default) and
16
+ mb_param_size (and the other mb_param_* getters). The renderer supports two
17
+ emission formats. Only one is active at runtime.
18
+
19
+ V1 — pseudo-map (the only format the current library understands):
20
+
21
+ mb_block(
22
+ config = mb_config,
23
+ settings = [
24
+ ["size", size],
25
+ ["brick1SizeY", brick1SizeY]
26
+ ]
27
+ );
28
+
29
+ Future — OpenSCAD native object() when that type is stable:
30
+
31
+ settings = object(
32
+ size = size,
33
+ brick1SizeY = brick1SizeY
34
+ )
35
+
36
+ Nested composition settings would become nested objects. Today's equivalent
37
+ is separate mb_block() calls with a flat settings list per call, not nested
38
+ pair arrays.
39
+
40
+ Two layers, so composition logic never hardcodes pseudo-map syntax:
41
+
42
+ 1. Resolve properties to a SettingsBundle (renderer-neutral).
43
+ Map of scadName to SCAD expression text.
44
+ Built from PropertyResolver: inline, then preset, then config, then default.
45
+ 2. SettingsEmitter turns the bundle into the settings argument expression.
46
+ PseudoMapSettingsEmitter is the V1 default.
47
+ ObjectSettingsEmitter is future.
48
+
49
+ interface SettingsBundle {
50
+ entries: ReadonlyMap of string to string
51
+ }
52
+ interface SettingsEmitter {
53
+ emit(bundle: SettingsBundle): string
54
+ }
55
+
56
+ Rules:
57
+
58
+ - Property resolution is format-agnostic. The same bundle feeds both emitters.
59
+ - Only the emitter changes when the format changes.
60
+ - The composition renderer calls emitter.emit(childBundle) per mb_block().
61
+ - Nested mb_block() trees stay structurally identical.
62
+ - The switch is target-level config, not per property.
63
+
64
+ interface ScadRenderOptions {
65
+ settingsFormat?: "pseudo-map" | "object"
66
+ }
67
+
68
+ Wired from CompileOptions / targetOptions.machineblocks-v3-scad.
69
+ V1 rejects object with diagnostic BML_SETTINGS_FORMAT_UNSUPPORTED and
70
+ writes no file while the SCAD library cannot read it.
71
+
72
+ Migration when object() is stable: the SCAD library gains object-aware
73
+ getters; ObjectSettingsEmitter lands in this package; settingsFormat object
74
+ is opt-in, then default; PseudoMapSettingsEmitter stays for older OpenSCAD.
75
+
76
+ </documentation>
77
+ <references>
78
+ <see type="rdoc:PropertyRenderer" relation="ReadNext" />
79
+ </references>
80
+ </rdoc:SettingsFormat>
@@ -0,0 +1,33 @@
1
+ <!--Render Target Documentation — SourceMaps
2
+ FQN: com.machineblocks.bml.target.render.documentation.SourceMaps-->
3
+ <rdoc:SourceMaps xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Source Map V3 beside each SCAD file
12
+ </is>
13
+ <documentation>
14
+ The renderer writes a Source Map V3 file next to each SCAD output:
15
+
16
+ Wall.scad
17
+ Wall.scad.map
18
+
19
+ The map records BML source file, line, and column for every generated SCAD
20
+ line, so diagnostics can point at the BML position rather than the generated
21
+ SCAD.
22
+
23
+ Source Map V3 is the language-agnostic format (version 3, sources, mappings).
24
+ Each generated SCAD line is one mappings group. This implementation points
25
+ every line at the block definition's BML position. The map is the optional
26
+ sourceMap field on the RenderOutput file. The host writes Wall.scad.map
27
+ when that field is present.
28
+
29
+ </documentation>
30
+ <references>
31
+ <see type="rdoc:HelperFunctions" relation="ReadNext" />
32
+ </references>
33
+ </rdoc:SourceMaps>
@@ -0,0 +1,61 @@
1
+ <!--Render Target Documentation — TargetRegistration
2
+ FQN: com.machineblocks.bml.target.render.documentation.TargetRegistration-->
3
+ <rdoc:TargetRegistration xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Registry name and how a host constructs the target
12
+ </is>
13
+ <documentation>
14
+ Registry / CLI target name: machineblocks-v3-scad
15
+ npm package: @machineblocks/render-target
16
+ TypeScript class (when implemented): MachineBlocksRenderTarget
17
+
18
+ Host wiring:
19
+
20
+ import { registerTarget } from "@blockml/compiler";
21
+ import { BlockRenderEngine } from "@blockml/block-render-engine";
22
+ import { MachineBlocksRenderTarget } from "@machineblocks/render-target";
23
+
24
+ registerTarget(new MachineBlocksRenderTarget(new BlockRenderEngine()));
25
+
26
+ Shape:
27
+
28
+ class MachineBlocksRenderTarget implements RenderTarget {
29
+ name = "machineblocks-v3-scad"
30
+ engine = new BlockRenderEngine()
31
+ processors = [
32
+ new ScadSetProcessor(),
33
+ new ScadBlockProcessor()
34
+ ]
35
+ delegates = []
36
+ }
37
+
38
+ Both V1 processors use the engine compile strategy.
39
+ delegates stays empty. Other domain targets may list this target as a
40
+ delegate and ship no processors of their own.
41
+
42
+ @blockml/cli does not register this name. @machineblocks/cli does.
43
+ Tests and browser callers call registerTarget directly.
44
+
45
+ Stage-3 RenderTarget also carries accepts scopes
46
+ (document, library, corpus, auto) and render(request, ctx). This product
47
+ target is a document target: one BML file in, one or more SCAD files out.
48
+ The host requires a file argument unless --all loops srcDir.
49
+
50
+ render finds the BomDocument whose source.filePath equals the session
51
+ sourceFilePath. No match returns files: [] and diagnostic
52
+ BML_RENDER_DOCUMENT_NOT_FOUND.
53
+
54
+ targetOptions.machineblocks-v3-scad carries mbLibPath and settingsFormat
55
+ (pseudo-map or object).
56
+
57
+ </documentation>
58
+ <references>
59
+ <see type="rdoc:RendererPipeline" relation="ReadNext" />
60
+ </references>
61
+ </rdoc:TargetRegistration>
@@ -0,0 +1,44 @@
1
+ <!--Render Target Documentation — V1Scope
2
+ FQN: com.machineblocks.bml.target.render.documentation.V1Scope-->
3
+ <rdoc:V1Scope xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ V1 base types handled by this target
12
+ </is>
13
+ <documentation>
14
+ V1 supports exactly two base types:
15
+
16
+ - com.machineblocks.bml.core.Block — ScadBlockProcessor
17
+ Standard SCAD block module.
18
+ - com.machineblocks.bml.core.Set — ScadSetProcessor
19
+ STEPS-based set with view submodules.
20
+
21
+ User types that inherit either base type use the same processor.
22
+ ScadSetProcessor is registered first because it is more specific.
23
+ ScadBlockProcessor is the fallback for Block.
24
+
25
+ A block whose baseType chain does not include
26
+ com.machineblocks.bml.core.Block is not supported. The compiler emits
27
+ BML_NO_TARGET for that block.
28
+
29
+ isSubtypeOf walks the baseType chain in the BOM type registry.
30
+
31
+ Later processors (copy of built-in service files, capability implementation
32
+ transpilation) may be added. They are not required for V1 block and set emit.
33
+ The engine allows them to use a different strategy in the same target.
34
+
35
+ ScadBlockProcessor emits a leaf, a composite module, or a preset JSON file.
36
+ ScadSetProcessor emits a SCAD file with a STEPS array and four view
37
+ submodules. A composition that carries bml:each, bml:if, or bml:with
38
+ returns files: [] and diagnostic BML_DIRECTIVE_DEFERRED.
39
+
40
+ </documentation>
41
+ <references>
42
+ <see type="rdoc:TargetRegistration" relation="ReadNext" />
43
+ </references>
44
+ </rdoc:V1Scope>
@@ -0,0 +1,8 @@
1
+ import type { BlockDefinition } from "@blockml/bom";
2
+ import type { RenderContext, RenderOutput } from "@blockml/compiler";
3
+ import { type ManifestationMapping } from "./naming.js";
4
+ type Registry = RenderContext["session"]["typeRegistry"];
5
+ export declare function renderCompositeFile(block: BlockDefinition, outputRelativePath: string, outputBasePath: string, mbLibPath: string, registry: Registry, mapping: ManifestationMapping): RenderOutput;
6
+ export declare function nativePropertyNames(registry: Registry): Set<string>;
7
+ export {};
8
+ //# sourceMappingURL=composite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../src/composite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAqC,MAAM,cAAc,CAAC;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIrE,OAAO,EAAgD,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAKtG,KAAK,QAAQ,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC;AAOzD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,EACtB,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,oBAAoB,GAC5B,YAAY,CAiGd;AAsID,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAQnE"}