altium-toolkit 1.4.11 → 1.4.12

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.
@@ -0,0 +1,29 @@
1
+ # altium-toolkit 1.4.12
2
+
3
+ Version 1.4.12 preserves native schematic footer metadata when a project also
4
+ provides document-level special-string parameters.
5
+
6
+ ## Project schematic fidelity
7
+
8
+ - Project parameters are resolved before the convergence fidelity pass so
9
+ document context and native fallback metadata compose deterministically.
10
+ - Footer fallback values synchronize the visible text, resolved-text sidecar,
11
+ and special-string expression before the historical renderer consumes them.
12
+ - Organization, address, approval, and other native owner metadata no longer
13
+ regress to unresolved placeholders in complete project loads.
14
+
15
+ ## Compatibility
16
+
17
+ - Historical parser and renderer sources remain byte-for-byte frozen.
18
+ - Existing schematic colors, canvas borders, title-block chrome, and public
19
+ renderer signatures remain unchanged.
20
+ - Resolution derives from the ownership and parameter data models without
21
+ project names, filenames, labels, or sample-specific rules.
22
+
23
+ ## Verification
24
+
25
+ - A repository-owned generic regression covers project parameters combined
26
+ with native footer metadata fallbacks.
27
+ - The complete package suite, immutable-source checks, feature-preservation
28
+ check, formatting check, performance guard, and npm package dry run are
29
+ required for release.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "altium-toolkit",
3
- "version": "1.4.11",
3
+ "version": "1.4.12",
4
4
  "description": "Altium document parsing and non-interactive rendering utilities",
5
5
  "keywords": [
6
6
  "altium",
@@ -214,12 +214,47 @@ export class AltiumSchematicFidelityNormalizer {
214
214
  if (!replacement) return text
215
215
 
216
216
  changed = true
217
- return { ...text, text: replacement }
217
+ return AltiumSchematicFidelityNormalizer.#resolvedFooterText(
218
+ text,
219
+ replacement
220
+ )
218
221
  })
219
222
 
220
223
  return changed ? resolvedTexts : texts
221
224
  }
222
225
 
226
+ /**
227
+ * Synchronizes one footer fallback across the visible text sidecar fields.
228
+ * @param {Record<string, any>} text Footer text primitive.
229
+ * @param {string} replacement Resolved native metadata value.
230
+ * @returns {Record<string, any>} Resolved footer text primitive.
231
+ */
232
+ static #resolvedFooterText(text, replacement) {
233
+ const specialString = text?.specialString
234
+ const resolvedSpecialString = specialString
235
+ ? {
236
+ ...specialString,
237
+ resolvedText: replacement,
238
+ expressionParts: Array.isArray(specialString.expressionParts)
239
+ ? specialString.expressionParts.map((part) =>
240
+ part?.kind === 'parameter'
241
+ ? { ...part, value: replacement }
242
+ : part
243
+ )
244
+ : specialString.expressionParts
245
+ }
246
+ : specialString
247
+
248
+ return {
249
+ ...text,
250
+ text: replacement,
251
+ resolvedText: replacement,
252
+ ...(resolvedSpecialString
253
+ ? { specialString: resolvedSpecialString }
254
+ : {})
255
+ }
256
+ }
257
+
223
258
  /**
224
259
  * Returns true when an ownership record seeds the lower-right footer.
225
260
  * @param {Record<string, any>} record Ownership record.
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: GPL-3.0-or-later
3
3
 
4
4
  import { SchematicSvgRenderer as LegacySchematicSvgRenderer } from '../ui/SchematicSvgRenderer.mjs'
5
+ import { SchematicProjectParameterResolver } from '../core/altium/SchematicProjectParameterResolver.mjs'
5
6
  import { AltiumSchematicImageNormalizer } from './AltiumSchematicImageNormalizer.mjs'
6
7
  import { AltiumSchematicNativeFooterOwnerAligner } from './AltiumSchematicNativeFooterOwnerAligner.mjs'
7
8
  import { AltiumSchematicFidelityNormalizer } from './AltiumSchematicFidelityNormalizer.mjs'
@@ -21,17 +22,32 @@ export class SchematicSvgRenderer {
21
22
  * @returns {string} Rendered SVG panel markup.
22
23
  */
23
24
  static render(documentModel, options = {}) {
25
+ const projectParameters = options.projectParameters
26
+ const projectResolved = projectParameters
27
+ ? SchematicProjectParameterResolver.applyToDocumentModel(
28
+ documentModel,
29
+ projectParameters,
30
+ { replaceText: true }
31
+ )
32
+ : documentModel
24
33
  const normalized =
25
- AltiumSchematicImageNormalizer.normalize(documentModel)
34
+ AltiumSchematicImageNormalizer.normalize(projectResolved)
26
35
  const fidelityNormalized =
27
36
  AltiumSchematicFidelityNormalizer.normalize(normalized)
28
37
  const aligned =
29
38
  AltiumSchematicNativeFooterOwnerAligner.align(fidelityNormalized)
30
39
  const renderDocument =
31
40
  SchematicSvgRenderer.#visibilityAwareDocument(aligned)
41
+ const legacyOptions = projectParameters
42
+ ? Object.fromEntries(
43
+ Object.entries(options).filter(
44
+ ([name]) => name !== 'projectParameters'
45
+ )
46
+ )
47
+ : options
32
48
  const markup = LegacySchematicSvgRenderer.render(
33
49
  renderDocument,
34
- options
50
+ legacyOptions
35
51
  )
36
52
 
37
53
  return SchematicSvgRenderer.#injectHarnessMarkup(markup, renderDocument)