circuitjson-toolkit 1.1.1 → 1.1.2
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.
package/README.md
CHANGED
|
@@ -43,6 +43,12 @@ caller-buffer mutation; explicit transfers detach exact buffers immediately
|
|
|
43
43
|
after admission. See the
|
|
44
44
|
[1.1.1 release notes](docs/release-notes-v1.1.1.md).
|
|
45
45
|
|
|
46
|
+
Version 1.1.2 makes schematic SVG paint deterministic. Open primitives always
|
|
47
|
+
emit `fill="none"`, filled primitives retain authored paint or use the shared
|
|
48
|
+
theme fallback, and generic component and symbol bodies explicitly use the
|
|
49
|
+
ECAD Forge schematic palette. See the
|
|
50
|
+
[1.1.2 release notes](docs/release-notes-v1.1.2.md).
|
|
51
|
+
|
|
46
52
|
Before 1.1.0:
|
|
47
53
|
|
|
48
54
|
```js
|
|
@@ -72,6 +78,8 @@ const model = document.model
|
|
|
72
78
|
- Copy-on-write normalization of supported legacy CircuitJSON aliases through
|
|
73
79
|
`CircuitJsonDocument.normalizeModel()`
|
|
74
80
|
- Deterministic PCB, schematic, and BOM renderers
|
|
81
|
+
- Explicit schematic SVG stroke/fill paint that does not depend on browser
|
|
82
|
+
defaults
|
|
75
83
|
- Asset-backed `schematic_image` rows and hierarchical
|
|
76
84
|
`schematic_sheet_symbol` rows with shared bounds and SVG behavior
|
|
77
85
|
- Reusable exact PCB interaction and spatial indexes
|
|
@@ -301,6 +309,7 @@ copy while keeping sync, direct async, and worker results mutation-isolated.
|
|
|
301
309
|
- [Testing and downstream conformance](docs/testing.md)
|
|
302
310
|
- [1.1.0 release notes](docs/release-notes-v1.1.0.md)
|
|
303
311
|
- [1.1.1 release notes](docs/release-notes-v1.1.1.md)
|
|
312
|
+
- [1.1.2 release notes](docs/release-notes-v1.1.2.md)
|
|
304
313
|
- [Library scope](spec/library-scope.md)
|
|
305
314
|
|
|
306
315
|
## Package scope
|
package/docs/api.md
CHANGED
|
@@ -330,7 +330,12 @@ the same option names across toolkits. Canonical `schematic_image` rows resolve
|
|
|
330
330
|
their exact `asset_id` from `document.assets`; full asset mode renders the
|
|
331
331
|
payload, while metadata-only or unresolved assets are omitted without a
|
|
332
332
|
placeholder. `schematic_sheet_symbol` renders a hierarchical child box and is
|
|
333
|
-
never treated as a selectable `schematic_sheet` page.
|
|
333
|
+
never treated as a selectable `schematic_sheet` page. Since 1.1.2, every
|
|
334
|
+
primitive emits explicit SVG fill paint: open arcs, polylines, and shapes use
|
|
335
|
+
`fill="none"`; filled primitives keep valid authored paint or fall back to
|
|
336
|
+
`var(--schematic-fill-color, #f1d8bd)`. Generic component and symbol bodies use
|
|
337
|
+
the same fill variable plus
|
|
338
|
+
`var(--schematic-default-ink-color, #008aa3)` for their stroke.
|
|
334
339
|
|
|
335
340
|
### `BomTableRenderer.render(document, options?)`
|
|
336
341
|
|
package/docs/migration.md
CHANGED
|
@@ -98,6 +98,13 @@ mutations cannot alter a queued parser input, project entry, or asset. With
|
|
|
98
98
|
`transferInput: true`, exact transferable buffers detach at admission;
|
|
99
99
|
partial, resizable, and shared ranges continue to use isolated copies.
|
|
100
100
|
|
|
101
|
+
Since 1.1.2, schematic SVG renderers no longer inherit the browser's default
|
|
102
|
+
black fill. Open primitives always render with `fill="none"`. A primitive with
|
|
103
|
+
`is_filled: true` uses its valid authored `fill_color`/`fillColor`, or the
|
|
104
|
+
shared `--schematic-fill-color` theme variable when no paint is authored.
|
|
105
|
+
Generic component and symbol bodies explicitly use the shared schematic fill
|
|
106
|
+
and ink variables. Public names, parameters, and return shapes are unchanged.
|
|
107
|
+
|
|
101
108
|
## Package subpaths
|
|
102
109
|
|
|
103
110
|
- `circuitjson-toolkit/parser`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# circuitjson-toolkit 1.1.2
|
|
2
|
+
|
|
3
|
+
## Deterministic schematic paint
|
|
4
|
+
|
|
5
|
+
This patch removes browser-dependent SVG fill behavior from the canonical
|
|
6
|
+
schematic renderer.
|
|
7
|
+
|
|
8
|
+
- Open arcs, polylines, and unfilled shapes now emit `fill="none"` explicitly,
|
|
9
|
+
so they cannot become black-filled in a browser or host stylesheet.
|
|
10
|
+
- Filled schematic primitives retain a valid authored `fill_color` or
|
|
11
|
+
`fillColor`. When `is_filled: true` has no authored paint, rendering uses
|
|
12
|
+
`var(--schematic-fill-color, #f1d8bd)`.
|
|
13
|
+
- Generic `schematic_component` and `schematic_symbol` bodies now emit the
|
|
14
|
+
shared schematic fill and default-ink theme variables explicitly.
|
|
15
|
+
- Filled paths render as polygons; open paths remain polylines. This preserves
|
|
16
|
+
geometry while making fill intent unambiguous.
|
|
17
|
+
- Unsafe authored paints remain rejected by the existing SVG paint sanitizer.
|
|
18
|
+
|
|
19
|
+
Public exports, method names, parameters, CircuitJSON document envelopes, and
|
|
20
|
+
renderer return shapes are unchanged from 1.1.1.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "circuitjson-toolkit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Canonical CircuitJSON parsing, project, rendering, query, manufacturing, simulation, and scene contracts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"circuitjson",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"docs/provenance.md",
|
|
53
53
|
"docs/release-notes-v1.1.0.md",
|
|
54
54
|
"docs/release-notes-v1.1.1.md",
|
|
55
|
+
"docs/release-notes-v1.1.2.md",
|
|
55
56
|
"docs/testing.md",
|
|
56
57
|
"spec",
|
|
57
58
|
"LICENSE",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { SafeXmlText } from './SafeXmlText.mjs'
|
|
2
2
|
|
|
3
|
+
const DEFAULT_FILLED_PAINT = 'var(--schematic-fill-color, #f1d8bd)'
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Builds SVG drawing attributes for schematic primitive rows.
|
|
5
7
|
*/
|
|
@@ -46,11 +48,16 @@ export class CircuitJsonSchematicSvgPrimitiveAttributes {
|
|
|
46
48
|
'"'
|
|
47
49
|
)
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
const resolvedFill = CircuitJsonSchematicSvgPrimitiveAttributes.#fill(
|
|
52
|
+
element,
|
|
53
|
+
options,
|
|
54
|
+
safeFill
|
|
55
|
+
)
|
|
56
|
+
if (resolvedFill) {
|
|
50
57
|
attributes.push(
|
|
51
58
|
'fill="' +
|
|
52
59
|
CircuitJsonSchematicSvgPrimitiveAttributes.#escapeHtml(
|
|
53
|
-
|
|
60
|
+
resolvedFill
|
|
54
61
|
) +
|
|
55
62
|
'"'
|
|
56
63
|
)
|
|
@@ -71,6 +78,21 @@ export class CircuitJsonSchematicSvgPrimitiveAttributes {
|
|
|
71
78
|
return attributes.length ? ' ' + attributes.join(' ') : ''
|
|
72
79
|
}
|
|
73
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Resolves deterministic fill semantics for one SVG primitive.
|
|
83
|
+
* @param {object} element CircuitJSON element row.
|
|
84
|
+
* @param {{ fill?: boolean }} options Attribute options.
|
|
85
|
+
* @param {string} safeFill Valid authored fill paint.
|
|
86
|
+
* @returns {string} Explicit SVG fill paint.
|
|
87
|
+
*/
|
|
88
|
+
static #fill(element, options, safeFill) {
|
|
89
|
+
if (options.fill === false || element?.is_filled === false) {
|
|
90
|
+
return 'none'
|
|
91
|
+
}
|
|
92
|
+
if (safeFill) return safeFill
|
|
93
|
+
return element?.is_filled === true ? DEFAULT_FILLED_PAINT : 'none'
|
|
94
|
+
}
|
|
95
|
+
|
|
74
96
|
/**
|
|
75
97
|
* Resolves a finite number.
|
|
76
98
|
* @param {unknown} value Number candidate.
|
|
@@ -151,7 +151,7 @@ export class CircuitJsonSchematicSvgRenderer {
|
|
|
151
151
|
component.schematic_component_id || ''
|
|
152
152
|
) +
|
|
153
153
|
'">' +
|
|
154
|
-
'<rect class="schematic-component__body" x="' +
|
|
154
|
+
'<rect class="schematic-component__body" fill="var(--schematic-fill-color, #f1d8bd)" stroke="var(--schematic-default-ink-color, #008aa3)" x="' +
|
|
155
155
|
CircuitJsonSchematicSvgRenderer.#formatNumber(x) +
|
|
156
156
|
'" y="' +
|
|
157
157
|
CircuitJsonSchematicSvgRenderer.#formatNumber(y) +
|
|
@@ -218,7 +218,7 @@ export class CircuitJsonSchematicSvgRenderer {
|
|
|
218
218
|
CircuitJsonSchematicSvgRenderer.#escapeHtml(
|
|
219
219
|
symbol.schematic_symbol_id || ''
|
|
220
220
|
) +
|
|
221
|
-
'"><rect class="schematic-symbol__body" x="' +
|
|
221
|
+
'"><rect class="schematic-symbol__body" fill="var(--schematic-fill-color, #f1d8bd)" stroke="var(--schematic-default-ink-color, #008aa3)" x="' +
|
|
222
222
|
CircuitJsonSchematicSvgRenderer.#formatNumber(x) +
|
|
223
223
|
'" y="' +
|
|
224
224
|
CircuitJsonSchematicSvgRenderer.#formatNumber(y) +
|
|
@@ -517,7 +517,9 @@ export class CircuitJsonSchematicSvgRenderer {
|
|
|
517
517
|
CircuitJsonSchematicSvgRenderer.#pointsAttribute(points)
|
|
518
518
|
) +
|
|
519
519
|
'"' +
|
|
520
|
-
CircuitJsonSchematicSvgPrimitiveAttributes.attributes(element
|
|
520
|
+
CircuitJsonSchematicSvgPrimitiveAttributes.attributes(element, {
|
|
521
|
+
fill: tag === 'polygon'
|
|
522
|
+
}) +
|
|
521
523
|
'></' +
|
|
522
524
|
tag +
|
|
523
525
|
'>'
|