fritzkit 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.
- package/.claude-plugin/marketplace.json +12 -0
- package/.claude-plugin/plugin.json +13 -0
- package/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/README.md +429 -2
- package/dist/cli/commands/doctor.d.ts +4 -0
- package/dist/cli/commands/doctor.js +7 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/export.d.ts +17 -0
- package/dist/cli/commands/export.js +81 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/kicad.d.ts +10 -0
- package/dist/cli/commands/kicad.js +22 -0
- package/dist/cli/commands/kicad.js.map +1 -0
- package/dist/cli/commands/parts.d.ts +22 -0
- package/dist/cli/commands/parts.js +46 -0
- package/dist/cli/commands/parts.js.map +1 -0
- package/dist/cli/commands/prune.d.ts +14 -0
- package/dist/cli/commands/prune.js +67 -0
- package/dist/cli/commands/prune.js.map +1 -0
- package/dist/cli/commands/render.d.ts +24 -0
- package/dist/cli/commands/render.js +62 -0
- package/dist/cli/commands/render.js.map +1 -0
- package/dist/cli/commands/schema.d.ts +10 -0
- package/dist/cli/commands/schema.js +35 -0
- package/dist/cli/commands/schema.js.map +1 -0
- package/dist/cli/commands/ui.d.ts +14 -0
- package/dist/cli/commands/ui.js +67 -0
- package/dist/cli/commands/ui.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +24 -0
- package/dist/cli/commands/validate.js +91 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/context.d.ts +81 -0
- package/dist/cli/context.js +139 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +8 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/program.d.ts +21 -0
- package/dist/cli/program.js +158 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/raster.d.ts +4 -0
- package/dist/cli/raster.js +9 -0
- package/dist/cli/raster.js.map +1 -0
- package/dist/core/compile/breadboard-util.d.ts +12 -0
- package/dist/core/compile/breadboard-util.js +107 -0
- package/dist/core/compile/breadboard-util.js.map +1 -0
- package/dist/core/compile/breadboard.d.ts +60 -0
- package/dist/core/compile/breadboard.js +513 -0
- package/dist/core/compile/breadboard.js.map +1 -0
- package/dist/core/compile/fzp.d.ts +12 -0
- package/dist/core/compile/fzp.js +183 -0
- package/dist/core/compile/fzp.js.map +1 -0
- package/dist/core/compile/icon.d.ts +17 -0
- package/dist/core/compile/icon.js +27 -0
- package/dist/core/compile/icon.js.map +1 -0
- package/dist/core/compile/index.d.ts +4 -0
- package/dist/core/compile/index.js +62 -0
- package/dist/core/compile/index.js.map +1 -0
- package/dist/core/compile/pcb.d.ts +39 -0
- package/dist/core/compile/pcb.js +164 -0
- package/dist/core/compile/pcb.js.map +1 -0
- package/dist/core/compile/schematic.d.ts +69 -0
- package/dist/core/compile/schematic.js +240 -0
- package/dist/core/compile/schematic.js.map +1 -0
- package/dist/core/compile/style.d.ts +52 -0
- package/dist/core/compile/style.js +72 -0
- package/dist/core/compile/style.js.map +1 -0
- package/dist/core/compile/types.d.ts +50 -0
- package/dist/core/compile/types.js +15 -0
- package/dist/core/compile/types.js.map +1 -0
- package/dist/core/export/bin.d.ts +61 -0
- package/dist/core/export/bin.js +221 -0
- package/dist/core/export/bin.js.map +1 -0
- package/dist/core/export/fzpz.d.ts +37 -0
- package/dist/core/export/fzpz.js +121 -0
- package/dist/core/export/fzpz.js.map +1 -0
- package/dist/core/export/index.d.ts +5 -0
- package/dist/core/export/index.js +6 -0
- package/dist/core/export/index.js.map +1 -0
- package/dist/core/export/install.d.ts +77 -0
- package/dist/core/export/install.js +183 -0
- package/dist/core/export/install.js.map +1 -0
- package/dist/core/export/prune.d.ts +72 -0
- package/dist/core/export/prune.js +165 -0
- package/dist/core/export/prune.js.map +1 -0
- package/dist/core/fritzing.d.ts +22 -0
- package/dist/core/fritzing.js +77 -0
- package/dist/core/fritzing.js.map +1 -0
- package/dist/core/identity.d.ts +29 -0
- package/dist/core/identity.js +70 -0
- package/dist/core/identity.js.map +1 -0
- package/dist/core/image/bbox.d.ts +27 -0
- package/dist/core/image/bbox.js +24 -0
- package/dist/core/image/bbox.js.map +1 -0
- package/dist/core/image/index.d.ts +8 -0
- package/dist/core/image/index.js +9 -0
- package/dist/core/image/index.js.map +1 -0
- package/dist/core/image/key.d.ts +72 -0
- package/dist/core/image/key.js +317 -0
- package/dist/core/image/key.js.map +1 -0
- package/dist/core/image/prepare.d.ts +31 -0
- package/dist/core/image/prepare.js +98 -0
- package/dist/core/image/prepare.js.map +1 -0
- package/dist/core/image/remover.d.ts +17 -0
- package/dist/core/image/remover.js +51 -0
- package/dist/core/image/remover.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +17 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/kicad/footprint.d.ts +104 -0
- package/dist/core/kicad/footprint.js +317 -0
- package/dist/core/kicad/footprint.js.map +1 -0
- package/dist/core/kicad/index.d.ts +25 -0
- package/dist/core/kicad/index.js +197 -0
- package/dist/core/kicad/index.js.map +1 -0
- package/dist/core/kicad/sexpr.d.ts +35 -0
- package/dist/core/kicad/sexpr.js +163 -0
- package/dist/core/kicad/sexpr.js.map +1 -0
- package/dist/core/resolve.d.ts +113 -0
- package/dist/core/resolve.js +301 -0
- package/dist/core/resolve.js.map +1 -0
- package/dist/core/schema/part.d.ts +995 -0
- package/dist/core/schema/part.js +278 -0
- package/dist/core/schema/part.js.map +1 -0
- package/dist/core/schema/part.schema.json +1122 -0
- package/dist/core/svg.d.ts +20 -0
- package/dist/core/svg.js +56 -0
- package/dist/core/svg.js.map +1 -0
- package/dist/core/units.d.ts +28 -0
- package/dist/core/units.js +42 -0
- package/dist/core/units.js.map +1 -0
- package/dist/core/validate/checker.d.ts +46 -0
- package/dist/core/validate/checker.js +142 -0
- package/dist/core/validate/checker.js.map +1 -0
- package/dist/core/validate/doctor.d.ts +25 -0
- package/dist/core/validate/doctor.js +156 -0
- package/dist/core/validate/doctor.js.map +1 -0
- package/dist/core/validate/explain.d.ts +10 -0
- package/dist/core/validate/explain.js +135 -0
- package/dist/core/validate/explain.js.map +1 -0
- package/dist/core/validate/index.d.ts +21 -0
- package/dist/core/validate/index.js +96 -0
- package/dist/core/validate/index.js.map +1 -0
- package/dist/core/validate/structural.d.ts +74 -0
- package/dist/core/validate/structural.js +664 -0
- package/dist/core/validate/structural.js.map +1 -0
- package/dist/core/workspace.d.ts +69 -0
- package/dist/core/workspace.js +213 -0
- package/dist/core/workspace.js.map +1 -0
- package/dist/mcp/jsonpatch.d.ts +30 -0
- package/dist/mcp/jsonpatch.js +145 -0
- package/dist/mcp/jsonpatch.js.map +1 -0
- package/dist/mcp/main.d.ts +2 -0
- package/dist/mcp/main.js +5 -0
- package/dist/mcp/main.js.map +1 -0
- package/dist/mcp/server.d.ts +28 -0
- package/dist/mcp/server.js +310 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/server/api.d.ts +72 -0
- package/dist/server/api.js +507 -0
- package/dist/server/api.js.map +1 -0
- package/dist/server/events.d.ts +28 -0
- package/dist/server/events.js +134 -0
- package/dist/server/events.js.map +1 -0
- package/dist/server/http.d.ts +36 -0
- package/dist/server/http.js +127 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/index.d.ts +65 -0
- package/dist/server/index.js +193 -0
- package/dist/server/index.js.map +1 -0
- package/dist/ui/assets/index-DLU8opyI.js +63 -0
- package/dist/ui/assets/index-GhUA-T3b.css +1 -0
- package/dist/ui/index.html +14 -0
- package/package.json +89 -4
- package/skills/fritzkit/SKILL.md +690 -0
- package/skills/fritzkit/reference/examples.md +275 -0
- package/skills/fritzkit/reference/part-json.md +333 -0
- package/skills/fritzkit/scripts/measure.py +197 -0
- package/tools/fzp-checker/.python-version +1 -0
- package/tools/fzp-checker/README.md +45 -0
- package/tools/fzp-checker/check_fzp.py +48 -0
- package/tools/fzp-checker/pyproject.toml +26 -0
- package/tools/fzp-checker/uv.lock +266 -0
- package/tools/fzp-checker/vendor/LICENSE.txt +8 -0
- package/tools/fzp-checker/vendor/UPSTREAM.md +25 -0
- package/tools/fzp-checker/vendor/fzp_checker.py +14 -0
- package/tools/fzp-checker/vendor/scripts/checks/__init__.py +26 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/__init__.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/check_missing_leg_ids.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/connector_numbering.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/fzp_checker_runner.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/fzp_checkers.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/fzp_svg_checkers.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/fzp_utils.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/svg_checkers.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/svg_utils.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/check_missing_leg_ids.py +44 -0
- package/tools/fzp-checker/vendor/scripts/checks/checkascii.py +27 -0
- package/tools/fzp-checker/vendor/scripts/checks/checkcase.py +156 -0
- package/tools/fzp-checker/vendor/scripts/checks/checkcopies.py +104 -0
- package/tools/fzp-checker/vendor/scripts/checks/connector_numbering.py +79 -0
- package/tools/fzp-checker/vendor/scripts/checks/connectors_misnumbered.py +228 -0
- package/tools/fzp-checker/vendor/scripts/checks/explain_errors.md +95 -0
- package/tools/fzp-checker/vendor/scripts/checks/fzp_checker_runner.py +717 -0
- package/tools/fzp-checker/vendor/scripts/checks/fzp_checkers.py +1069 -0
- package/tools/fzp-checker/vendor/scripts/checks/fzp_svg_checkers.py +62 -0
- package/tools/fzp-checker/vendor/scripts/checks/fzp_utils.py +222 -0
- package/tools/fzp-checker/vendor/scripts/checks/inspector_fc51.png +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/invisibleconnectors.py +118 -0
- package/tools/fzp-checker/vendor/scripts/checks/nolayeridcheck.txt +758 -0
- package/tools/fzp-checker/vendor/scripts/checks/requirements.txt +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/svg_checkers.py +953 -0
- package/tools/fzp-checker/vendor/scripts/checks/svg_utils.py +96 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_checkers.py +839 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/author_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/author_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/buses_missing_id.fzp.test +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/buses_missing_node_members.fzp.test +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/buses_present_valid.fzp.test +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_layers_missing_attributes.fzp.test +16 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_layers_present_valid.fzp.test +14 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_numbering_invalid.fzp.test +70 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_numbering_valid.fzp.test +70 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_refs_valid.fzp.test +53 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_mixed.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_silkscreen_nested.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_style_attr.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_white_stroke.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_wrong_color.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_inherited.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_legacy.fzp.test +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_nested_copper.fzp.test +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_none.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_standard.fzp.test +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_uppercase.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/css_connector.fzp.test +100 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/description_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/description_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/duplicate_ids.fzp.test +27 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/family_property_missing.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/family_property_present_valid.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/font_size.fzp.test +46 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/fritzing_version_invalid_format.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/fritzing_version_missing.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/fritzing_version_present_valid.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/gorn_absent.fzp.test +15 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/gorn_present.fzp.test +15 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/hybrid_connectors.fzp.test +232 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/invalid_xml.fzp.test +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/layer_ids_match.fzp.test +29 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/layer_ids_mismatch.fzp.test +30 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/layer_nesting_invalid.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/layer_nesting_valid.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/matrix_transform.fzp.test +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/missing_connector_refs.fzp.test +63 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/missing_leg_ids.fzp.test +34 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_missing.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_non_alnum.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_special_chars_absent.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_special_chars_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_too_short.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/no_layer_invalid.fzp.test +19 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/no_layer_namedview.fzp.test +19 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/no_layer_valid.fzp.test +19 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/pcb_only.fzp.test +48 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/property_fields_missing_name.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/property_fields_missing_value.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/property_fields_present.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/required_tags_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/required_tags_present.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/stroke_test.fzp.test +60 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/template_svgs.fzp.test +35 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/title_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/title_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/unique_ids.fzp.test +27 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/unique_property_names_duplicates.fzp.test +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/unique_property_names_unique.fzp.test +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/valid_xml.fzp.test +249 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/version_invalid_format.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/version_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/version_present_valid.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/views_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/views_present.fzp.test +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/connector_refs_valid_breadboard.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/duplicate_ids_breadboard.svg +13 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/gorn_absent_breadboard.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/gorn_present_breadboard.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/hybrid_connectors_breadboard.svg +102 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/layer_nesting_invalid.svg +13 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/layer_nesting_valid.svg +13 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/matrix_transform.svg +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/missing_connector_refs_breadboard.svg +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/missing_leg_ids_breadboard.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/test_layer_ids_match_breadboard.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/test_layer_ids_mismatch_breadboard.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/unique_ids_breadboard.svg +13 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/hybrid_connectors_icon.svg +78 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/no_layer_invalid.svg +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/no_layer_namedview.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/no_layer_valid.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/plain_pcb.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/connector_refs_valid_pcb.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_mixed.svg +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_silkscreen_nested.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_style_attr.svg +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_white_stroke.svg +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_wrong_color.svg +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_inherited.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_legacy.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_nested_copper.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_none.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_standard.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_uppercase.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/css_connector.svg +25 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/font_size.svg +54 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/hybrid_connectors_pcb.svg +35 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/missing_connector_refs_pcb.svg +14 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/pcb-arduino-shield.svg +25 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/stroke_test.svg +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/test_layer_ids_match_pcb.svg +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/test_layer_ids_mismatch_pcb.svg +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/connector_refs_valid_schematic.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/hybrid_connectors_schematic.svg +59 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/missing_connector_refs_schematic.svg +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/test_layer_ids_match_schematic.svg +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/test_layer_ids_mismatch_schematic.svg +6 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const CODE_HELP = {
|
|
2
|
+
"module-id": "The moduleId identifies the part inside Fritzing and names its folder.",
|
|
3
|
+
"zip-entries": "The .fzpz zip must be flat and hold exactly the files the fzp references.",
|
|
4
|
+
"required-tags": "Fritzing expects title, label, date, author, version and a family property.",
|
|
5
|
+
"layer-ids": "Each layer the fzp lists must be a <g id=...> group in that view's SVG.",
|
|
6
|
+
"connector-refs": "Each connector's svgId/terminalId/legId must name an element in the SVG.",
|
|
7
|
+
"connector-numbering": "Connector ids are connector0, connector1, ... and must be unique.",
|
|
8
|
+
buses: "A bus ties connectors that are the same electrical node (e.g. two GND pins).",
|
|
9
|
+
"svg-root": "SVG sizes must be physical (in/mm) with a viewBox, or Fritzing guesses the dpi.",
|
|
10
|
+
"svg-style": "Fritzing's renderer supports only a small subset of SVG and CSS.",
|
|
11
|
+
"svg-ids": "SVG ids must be unique; Fritzing finds connectors and layers by id.",
|
|
12
|
+
"copper-only": "Copper layers become real copper on a fabricated board.",
|
|
13
|
+
"pcb-layers": "THT pads live on both copper layers; SMD pads on copper1 only.",
|
|
14
|
+
spice: "The <spice> block is substituted per instance when simulating.",
|
|
15
|
+
"fzp-xml": "The fzp file could not be parsed as XML.",
|
|
16
|
+
"svg-xml": "An SVG file could not be parsed as XML.",
|
|
17
|
+
"spec-schema": "part.json does not match the fritzkit part schema.",
|
|
18
|
+
};
|
|
19
|
+
/** One or two lines of text for an issue: what is wrong, why it matters, how to fix it. */
|
|
20
|
+
export function explain(issue) {
|
|
21
|
+
const head = `${issue.level === "error" ? "Error" : "Warning"} [${issue.code}]: ${issue.message}`;
|
|
22
|
+
const where = issue.where ? ` (in ${issue.where})` : "";
|
|
23
|
+
const why = CODE_HELP[issue.code];
|
|
24
|
+
const lines = [head + where];
|
|
25
|
+
if (why)
|
|
26
|
+
lines.push(` Why: ${why}`);
|
|
27
|
+
if (issue.fix)
|
|
28
|
+
lines.push(` Fix: ${issue.fix}`);
|
|
29
|
+
return lines.join("\n");
|
|
30
|
+
}
|
|
31
|
+
const CHECKER_FIXES = [
|
|
32
|
+
{
|
|
33
|
+
match: /Missing viewBox/i,
|
|
34
|
+
fix: "Add viewBox, width and height to the SVG root; give width/height in in or mm.",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
match: /Invalid viewBox/i,
|
|
38
|
+
fix: 'Use viewBox="0 0 <w> <h>" with four numbers (fritzkit: 1 unit = 1 mil).',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
match: /Invisible connector|invisible/i,
|
|
42
|
+
fix: "Give the connector element a fill or stroke, or mark the connector hybrid in the fzp.",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
match: /Duplicate id attribute/i,
|
|
46
|
+
fix: "Make SVG ids unique; for PCB nest copper0 inside copper1 and share one pad element.",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
match: /terminal/i,
|
|
50
|
+
fix: "Make the terminal element visible with non-zero size, or drop terminalId (Fritzing 1.0.3+ picks the connector centre).",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
match: /style/i,
|
|
54
|
+
fix: "Replace style= with XML attributes (fill, stroke, stroke-width ...); Fritzing converts only a few CSS properties.",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
match: /has an empty value/i,
|
|
58
|
+
fix: "Give the property a value or remove it; empty properties do nothing in the Inspector.",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
match: /Layer ID '([^']*)' from (\w+) not found/i,
|
|
62
|
+
fix: "Wrap that view's artwork in a <g> whose id is the layer id; for the icon, use a separate cropped icon SVG.",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
match: /not referenced in (any )?FZP/i,
|
|
66
|
+
fix: "Declare the connector in the fzp for that view, or remove/rename the stray SVG element.",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
match: /Missing required tag: (\w+)/i,
|
|
70
|
+
fix: "Add the missing element to the fzp (title, label, date, author, version ...).",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
match: /Date format/i,
|
|
74
|
+
fix: "Write <date> as YYYY-MM-DD.",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
match: /fritzingVersion/i,
|
|
78
|
+
fix: 'Set fritzingVersion="1.0.7" on <module> after re-checking the part with a current Fritzing.',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
match: /Invalid font family/i,
|
|
82
|
+
fix: 'Use font-family="Noto Sans" (or "OCR-Fritzing-mono" for PCB silkscreen).',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
match: /gorn attribute/i,
|
|
86
|
+
fix: "Delete every gorn= attribute; they are written by Fritzing's editor and must not ship.",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
match: /not inside a valid Fritzing layer group/i,
|
|
90
|
+
fix: 'Put every drawn element inside the view\'s layer group, e.g. <g id="breadboard">.',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
match: /does not reference an element in layer/i,
|
|
94
|
+
fix: "Add the connector's svgId element to that layer group in the SVG.",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
match: /not found in \w+ SVG/i,
|
|
98
|
+
fix: "The fzp names an svgId that the SVG lacks; add the element or fix the id.",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
match: /Non-standard copper color|Invalid color '.*' found in copper|Invalid stroke for connector/i,
|
|
102
|
+
fix: 'Draw copper with stroke/fill "#F7BD13".',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
match: /ModuleID contains/i,
|
|
106
|
+
fix: "Keep the moduleId to letters, digits, '_', '.' and '-'.",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
match: /Connector mismatch/i,
|
|
110
|
+
fix: "A numeric connector name does not match its connectorN id; harmless when pins were removed (fritzkit never reuses ids, D12a), otherwise rename the pin.",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
match: /layer nested inside/i,
|
|
114
|
+
fix: "Only copper0 may sit inside copper1; move other layer groups to the top level of the SVG.",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
match: /ModuleID .*too short|'ModuleID' is undefined/i,
|
|
118
|
+
fix: "Give <module> a moduleId of at least 8 filename-safe characters.",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
match: /No font (family|size) found|Invalid font size/i,
|
|
122
|
+
fix: 'Give every <text> font-family="Noto Sans" and a unitless font-size attribute.',
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
/** A short fix for a checker output line, or undefined when the message is not known. */
|
|
126
|
+
export function explainCheckerLine(line) {
|
|
127
|
+
// parseCheckerOutput prefixes svg issues with "<file>.svg: " and some messages end in
|
|
128
|
+
// " File: <path>"; a slug such as "terminal-block" must not steer the match.
|
|
129
|
+
const msg = line.replace(/^\S+\.svg: /, "").replace(/ File: .*$/, "");
|
|
130
|
+
for (const { match, fix } of CHECKER_FIXES)
|
|
131
|
+
if (match.test(msg))
|
|
132
|
+
return fix;
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=explain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain.js","sourceRoot":"","sources":["../../../src/core/validate/explain.ts"],"names":[],"mappings":"AAOA,MAAM,SAAS,GAA2B;IACxC,WAAW,EAAE,wEAAwE;IACrF,aAAa,EAAE,2EAA2E;IAC1F,eAAe,EAAE,6EAA6E;IAC9F,WAAW,EAAE,yEAAyE;IACtF,gBAAgB,EAAE,0EAA0E;IAC5F,qBAAqB,EAAE,mEAAmE;IAC1F,KAAK,EAAE,8EAA8E;IACrF,UAAU,EAAE,iFA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UAAU,kBAAkB,CAAC,IAAY;IAC7C,sFAAsF;IACtF,6EAA6E;IAC7E,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACtE,KAAK,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,aAAa;QAAE,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC;IAC5E,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Issue, type ValidateInput } from "./structural.js";
|
|
2
|
+
export type { Issue, IssueLevel, ValidateInput, SvgNode } from "./structural.js";
|
|
3
|
+
export { validateStructure, parseFzp, parseSvg, entryNameForImage } from "./structural.js";
|
|
4
|
+
export { runFzpChecker, parseCheckerOutput, findCheckerDir, UV_INSTALL_HINT, type CheckerOptions, type CheckerResult, } from "./checker.js";
|
|
5
|
+
export { explain, explainCheckerLine } from "./explain.js";
|
|
6
|
+
export { doctor, formatDoctor, doctorStatus, nodeVersionCheck, AUTOHOTKEY_V2, type DoctorCheck, type DoctorReport, type DoctorOptions, } from "./doctor.js";
|
|
7
|
+
/** Structural validation of a compiled part (CompiledPart is accepted as is). */
|
|
8
|
+
export declare function validateCompiled(input: ValidateInput): Issue[];
|
|
9
|
+
/** Map flat .fzpz entries to the validator input (svgs keyed by the svg.<view>. prefix). */
|
|
10
|
+
export declare function entriesToInput(entries: {
|
|
11
|
+
name: string;
|
|
12
|
+
data: Uint8Array;
|
|
13
|
+
}[]): ValidateInput;
|
|
14
|
+
/** Unzip a .fzpz (bytes) and validate it. */
|
|
15
|
+
export declare function validateFzpzBytes(bytes: Uint8Array): Issue[];
|
|
16
|
+
/** Read a .fzpz from disk and validate it. */
|
|
17
|
+
export declare function validateFzpzFile(path: string): Issue[];
|
|
18
|
+
/** Validate a parsed part.json against the schema: one issue per zod error, with its path. */
|
|
19
|
+
export declare function validateSpecJson(json: unknown): Issue[];
|
|
20
|
+
/** ASCII report: one line per issue, errors first, e.g. "ERROR [layer-ids] ... (fix: ...)". */
|
|
21
|
+
export declare function formatIssues(issues: Issue[]): string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validator entry points: structural checks on a compiled part or a .fzpz on disk, schema
|
|
3
|
+
* checks on a part.json, the vendored Fritzing checker and the doctor.
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { strFromU8, unzipSync } from "fflate";
|
|
7
|
+
import { VIEWS } from "../compile/types.js";
|
|
8
|
+
import { safeParsePartSpec } from "../schema/part.js";
|
|
9
|
+
import { validateStructure } from "./structural.js";
|
|
10
|
+
export { validateStructure, parseFzp, parseSvg, entryNameForImage } from "./structural.js";
|
|
11
|
+
export { runFzpChecker, parseCheckerOutput, findCheckerDir, UV_INSTALL_HINT, } from "./checker.js";
|
|
12
|
+
export { explain, explainCheckerLine } from "./explain.js";
|
|
13
|
+
export { doctor, formatDoctor, doctorStatus, nodeVersionCheck, AUTOHOTKEY_V2, } from "./doctor.js";
|
|
14
|
+
/** Structural validation of a compiled part (CompiledPart is accepted as is). */
|
|
15
|
+
export function validateCompiled(input) {
|
|
16
|
+
return validateStructure(input);
|
|
17
|
+
}
|
|
18
|
+
/** Map flat .fzpz entries to the validator input (svgs keyed by the svg.<view>. prefix). */
|
|
19
|
+
export function entriesToInput(entries) {
|
|
20
|
+
const fzpEntry = entries.find((e) => e.name.startsWith("part.") && e.name.endsWith(".fzp"));
|
|
21
|
+
const svgs = {};
|
|
22
|
+
for (const v of VIEWS) {
|
|
23
|
+
const e = entries.find((x) => x.name.startsWith(`svg.${v}.`) && x.name.endsWith(".svg"));
|
|
24
|
+
if (e)
|
|
25
|
+
svgs[v] = strFromU8(e.data);
|
|
26
|
+
}
|
|
27
|
+
return { fzp: fzpEntry ? strFromU8(fzpEntry.data) : "", svgs, entries };
|
|
28
|
+
}
|
|
29
|
+
/** Unzip a .fzpz (bytes) and validate it. */
|
|
30
|
+
export function validateFzpzBytes(bytes) {
|
|
31
|
+
let files;
|
|
32
|
+
try {
|
|
33
|
+
files = unzipSync(bytes);
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
level: "error",
|
|
39
|
+
code: "zip-entries",
|
|
40
|
+
message: `not a readable zip: ${e instanceof Error ? e.message : String(e)}`,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
const entries = Object.entries(files).map(([name, data]) => ({ name, data }));
|
|
45
|
+
const input = entriesToInput(entries);
|
|
46
|
+
if (input.fzp === "") {
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
level: "error",
|
|
50
|
+
code: "zip-entries",
|
|
51
|
+
message: "the .fzpz has no part.*.fzp entry",
|
|
52
|
+
fix: "a .fzpz holds one fzp named part.<moduleId>.fzp",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
return validateStructure(input);
|
|
57
|
+
}
|
|
58
|
+
/** Read a .fzpz from disk and validate it. */
|
|
59
|
+
export function validateFzpzFile(path) {
|
|
60
|
+
return validateFzpzBytes(new Uint8Array(readFileSync(path)));
|
|
61
|
+
}
|
|
62
|
+
/** Validate a parsed part.json against the schema: one issue per zod error, with its path. */
|
|
63
|
+
export function validateSpecJson(json) {
|
|
64
|
+
const r = safeParsePartSpec(json);
|
|
65
|
+
if (r.success)
|
|
66
|
+
return [];
|
|
67
|
+
return r.error.issues.map((zi) => {
|
|
68
|
+
const path = zi.path.map(String).join(".");
|
|
69
|
+
return {
|
|
70
|
+
level: "error",
|
|
71
|
+
code: "spec-schema",
|
|
72
|
+
message: path ? `${path}: ${zi.message}` : zi.message,
|
|
73
|
+
...(path ? { where: path } : {}),
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** ASCII report: one line per issue, errors first, e.g. "ERROR [layer-ids] ... (fix: ...)". */
|
|
78
|
+
export function formatIssues(issues) {
|
|
79
|
+
if (issues.length === 0)
|
|
80
|
+
return "No issues found.";
|
|
81
|
+
const sorted = [
|
|
82
|
+
...issues.filter((i) => i.level === "error"),
|
|
83
|
+
...issues.filter((i) => i.level !== "error"),
|
|
84
|
+
];
|
|
85
|
+
const lines = sorted.map((i) => {
|
|
86
|
+
const level = i.level === "error" ? "ERROR" : "WARN ";
|
|
87
|
+
const where = i.where ? ` <${i.where}>` : "";
|
|
88
|
+
const fix = i.fix ? ` (fix: ${i.fix})` : "";
|
|
89
|
+
return `${level} [${i.code}]${where} ${i.message}${fix}`;
|
|
90
|
+
});
|
|
91
|
+
const nErr = issues.filter((i) => i.level === "error").length;
|
|
92
|
+
const nWarn = issues.length - nErr;
|
|
93
|
+
lines.push(`${nErr} error${nErr === 1 ? "" : "s"}, ${nWarn} warning${nWarn === 1 ? "" : "s"}`);
|
|
94
|
+
return lines.join("\n");
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/validate/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAkC,MAAM,iBAAiB,CAAC;AAGpF,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,eAAe,GAGhB,MAA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AK,IAAI,CAAC,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC;IAC3D,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;IAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/F,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { View } from "../compile/types.js";
|
|
2
|
+
export type IssueLevel = "error" | "warning";
|
|
3
|
+
export interface Issue {
|
|
4
|
+
level: IssueLevel;
|
|
5
|
+
/** kebab-case check id, e.g. "layer-ids". */
|
|
6
|
+
code: string;
|
|
7
|
+
message: string;
|
|
8
|
+
/** Where the problem is: a zip entry name, "fzp", "<view> svg", a connector id ... */
|
|
9
|
+
where?: string;
|
|
10
|
+
/** How to fix it. */
|
|
11
|
+
fix?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The subset of CompiledPart the validator reads (a CompiledPart is assignable). */
|
|
14
|
+
export interface ValidateInput {
|
|
15
|
+
fzp: string;
|
|
16
|
+
svgs: Partial<Record<View, string>>;
|
|
17
|
+
entries: {
|
|
18
|
+
name: string;
|
|
19
|
+
data: Uint8Array;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
export declare const ALLOWED_FONTS: readonly ["Noto Sans", "OCR-Fritzing-mono"];
|
|
23
|
+
interface FzpP {
|
|
24
|
+
layer: string;
|
|
25
|
+
svgId?: string;
|
|
26
|
+
terminalId?: string;
|
|
27
|
+
legId?: string;
|
|
28
|
+
hybrid?: string;
|
|
29
|
+
}
|
|
30
|
+
interface FzpConnector {
|
|
31
|
+
id: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
views: Partial<Record<View, FzpP[]>>;
|
|
34
|
+
}
|
|
35
|
+
interface FzpView {
|
|
36
|
+
image?: string;
|
|
37
|
+
layers: string[];
|
|
38
|
+
}
|
|
39
|
+
interface FzpModel {
|
|
40
|
+
moduleId?: string;
|
|
41
|
+
fritzingVersion?: string;
|
|
42
|
+
tags: Record<string, string | undefined>;
|
|
43
|
+
properties: {
|
|
44
|
+
name: string;
|
|
45
|
+
value: string;
|
|
46
|
+
}[];
|
|
47
|
+
views: Partial<Record<View, FzpView>>;
|
|
48
|
+
connectors: FzpConnector[];
|
|
49
|
+
buses: {
|
|
50
|
+
id: string;
|
|
51
|
+
members: string[];
|
|
52
|
+
}[];
|
|
53
|
+
spiceLines: string[];
|
|
54
|
+
}
|
|
55
|
+
/** Parse an fzp string. Throws on malformed XML. */
|
|
56
|
+
export declare function parseFzp(fzp: string): FzpModel;
|
|
57
|
+
export interface SvgNode {
|
|
58
|
+
tag: string;
|
|
59
|
+
attrs: Record<string, string>;
|
|
60
|
+
/** Ancestor elements, outermost first (excluding this node). */
|
|
61
|
+
ancestors: {
|
|
62
|
+
tag: string;
|
|
63
|
+
id?: string;
|
|
64
|
+
}[];
|
|
65
|
+
/** Concatenated direct text content (for <text> diagnostics). */
|
|
66
|
+
text: string;
|
|
67
|
+
}
|
|
68
|
+
/** Parse an SVG into a flat element list in document order. Throws on malformed XML. */
|
|
69
|
+
export declare function parseSvg(svg: string): SvgNode[];
|
|
70
|
+
/** "breadboard/x.svg" -> "svg.breadboard.x.svg". */
|
|
71
|
+
export declare function entryNameForImage(image: string): string;
|
|
72
|
+
/** Run every structural check. Never throws: XML parse failures become issues. */
|
|
73
|
+
export declare function validateStructure(input: ValidateInput): Issue[];
|
|
74
|
+
export {};
|