@tscircuit/schematic-viewer 0.0.2 → 0.0.4
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/dist/index.d.ts +6 -1
- package/dist/index.js +35176 -5772
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
- package/src/pages/led-circuit.tsx +8 -1
- package/tsconfig.json +2 -1
- package/dist/Schematic.d.ts +0 -6
- package/dist/Schematic.js +0 -8609
- package/dist/Schematic.js.map +0 -1
- package/dist/lib/hooks/index.d.ts +0 -1
- package/dist/lib/hooks/index.js +0 -2170
- package/dist/lib/hooks/index.js.map +0 -1
- package/dist/lib/hooks/use-maybe-promise.d.ts +0 -3
- package/dist/lib/hooks/use-maybe-promise.js +0 -2170
- package/dist/lib/hooks/use-maybe-promise.js.map +0 -1
- package/dist/lib/render-context/index.d.ts +0 -10
- package/dist/lib/render-context/index.js +0 -45
- package/dist/lib/render-context/index.js.map +0 -1
- package/dist/lib/types/core.d.ts +0 -149
- package/dist/lib/types/core.js +0 -18
- package/dist/lib/types/core.js.map +0 -1
- package/dist/lib/types/index.d.ts +0 -4
- package/dist/lib/types/index.js +0 -18
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/route-solver.d.ts +0 -24
- package/dist/lib/types/route-solver.js +0 -18
- package/dist/lib/types/route-solver.js.map +0 -1
- package/dist/lib/types/source-component.d.ts +0 -44
- package/dist/lib/types/source-component.js +0 -18
- package/dist/lib/types/source-component.js.map +0 -1
- package/dist/lib/types/util.d.ts +0 -14
- package/dist/lib/types/util.js +0 -18
- package/dist/lib/types/util.js.map +0 -1
- package/dist/lib/utils/direction-to-vec.d.ts +0 -13
- package/dist/lib/utils/direction-to-vec.js +0 -96
- package/dist/lib/utils/direction-to-vec.js.map +0 -1
- package/dist/lib/utils/get-svg-path-bounds.d.ts +0 -10
- package/dist/lib/utils/get-svg-path-bounds.js +0 -51
- package/dist/lib/utils/get-svg-path-bounds.js.map +0 -1
- package/dist/lib/utils/point-math.d.ts +0 -20
- package/dist/lib/utils/point-math.js +0 -57
- package/dist/lib/utils/point-math.js.map +0 -1
- package/dist/pages/_app.d.ts +0 -5
- package/dist/pages/_app.js +0 -2714
- package/dist/pages/_app.js.map +0 -1
- package/dist/pages/index.d.ts +0 -3
- package/dist/pages/index.js +0 -8615
- package/dist/pages/index.js.map +0 -1
- package/dist/pages/led-circuit-react.d.ts +0 -3
- package/dist/pages/led-circuit-react.js +0 -8640
- package/dist/pages/led-circuit-react.js.map +0 -1
- package/dist/pages/led-circuit.d.ts +0 -3
- package/dist/pages/led-circuit.js +0 -8659
- package/dist/pages/led-circuit.js.map +0 -1
- package/dist/schematic-components/MovableGrid/MovableGrid.stories.d.ts +0 -7
- package/dist/schematic-components/MovableGrid/MovableGrid.stories.js +0 -47
- package/dist/schematic-components/MovableGrid/MovableGrid.stories.js.map +0 -1
- package/dist/schematic-components/MovableGrid/index.d.ts +0 -3
- package/dist/schematic-components/MovableGrid/index.js +0 -34
- package/dist/schematic-components/MovableGrid/index.js.map +0 -1
- package/dist/schematic-components/ProjectComponent.d.ts +0 -10
- package/dist/schematic-components/ProjectComponent.js +0 -8584
- package/dist/schematic-components/ProjectComponent.js.map +0 -1
- package/dist/schematic-components/RenderError.d.ts +0 -6
- package/dist/schematic-components/RenderError.js +0 -40
- package/dist/schematic-components/RenderError.js.map +0 -1
- package/dist/schematic-components/SVGPathComponent.d.ts +0 -19
- package/dist/schematic-components/SVGPathComponent.js +0 -90
- package/dist/schematic-components/SVGPathComponent.js.map +0 -1
- package/dist/schematic-components/SchematicBug.d.ts +0 -13
- package/dist/schematic-components/SchematicBug.js +0 -468
- package/dist/schematic-components/SchematicBug.js.map +0 -1
- package/dist/schematic-components/SchematicComponent.d.ts +0 -13
- package/dist/schematic-components/SchematicComponent.js +0 -8451
- package/dist/schematic-components/SchematicComponent.js.map +0 -1
- package/dist/schematic-components/SchematicGroup.d.ts +0 -3
- package/dist/schematic-components/SchematicGroup.js +0 -32
- package/dist/schematic-components/SchematicGroup.js.map +0 -1
- package/dist/schematic-components/SchematicPort.d.ts +0 -13
- package/dist/schematic-components/SchematicPort.js +0 -8348
- package/dist/schematic-components/SchematicPort.js.map +0 -1
- package/dist/schematic-components/SchematicText.d.ts +0 -10
- package/dist/schematic-components/SchematicText.js +0 -71
- package/dist/schematic-components/SchematicText.js.map +0 -1
- package/dist/schematic-components/SchematicTrace.d.ts +0 -13
- package/dist/schematic-components/SchematicTrace.js +0 -137
- package/dist/schematic-components/SchematicTrace.js.map +0 -1
- package/dist/schematic-components/SimpleCapacitor.d.ts +0 -13
- package/dist/schematic-components/SimpleCapacitor.js +0 -103
- package/dist/schematic-components/SimpleCapacitor.js.map +0 -1
- package/dist/schematic-components/SimpleDiode.d.ts +0 -13
- package/dist/schematic-components/SimpleDiode.js +0 -101
- package/dist/schematic-components/SimpleDiode.js.map +0 -1
- package/dist/schematic-components/SimpleGround.d.ts +0 -13
- package/dist/schematic-components/SimpleGround.js +0 -102
- package/dist/schematic-components/SimpleGround.js.map +0 -1
- package/dist/schematic-components/SimpleInductor.d.ts +0 -13
- package/dist/schematic-components/SimpleInductor.js +0 -102
- package/dist/schematic-components/SimpleInductor.js.map +0 -1
- package/dist/schematic-components/SimplePowerSource.d.ts +0 -13
- package/dist/schematic-components/SimplePowerSource.js +0 -104
- package/dist/schematic-components/SimplePowerSource.js.map +0 -1
- package/dist/schematic-components/SimpleResistor.d.ts +0 -13
- package/dist/schematic-components/SimpleResistor.js +0 -102
- package/dist/schematic-components/SimpleResistor.js.map +0 -1
- package/dist/schematic-components/index.d.ts +0 -18
- package/dist/schematic-components/index.js +0 -8618
- package/dist/schematic-components/index.js.map +0 -1
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/schematic-components/RenderError.tsx
|
|
20
|
-
var RenderError_exports = {};
|
|
21
|
-
__export(RenderError_exports, {
|
|
22
|
-
default: () => RenderError_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(RenderError_exports);
|
|
25
|
-
var RenderError_default = ({ text }) => {
|
|
26
|
-
return <div style={{
|
|
27
|
-
position: "fixed",
|
|
28
|
-
backgroundColor: "red",
|
|
29
|
-
color: "white",
|
|
30
|
-
fontSize: 14,
|
|
31
|
-
fontFamily: "sans-serif",
|
|
32
|
-
padding: 5,
|
|
33
|
-
right: 0,
|
|
34
|
-
top: 0,
|
|
35
|
-
opacity: 0.75
|
|
36
|
-
}}>{text}</div>;
|
|
37
|
-
};
|
|
38
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
-
0 && (module.exports = {});
|
|
40
|
-
//# sourceMappingURL=RenderError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schematic-components/RenderError.tsx"],"sourcesContent":["interface Props {\n text: string\n}\n\nexport default ({ text }: Props) => {\n return (\n <div\n style={{\n position: \"fixed\",\n backgroundColor: \"red\",\n color: \"white\",\n fontSize: 14,\n fontFamily: \"sans-serif\",\n padding: 5,\n right: 0,\n top: 0,\n opacity: 0.75,\n }}\n >\n {text}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,IAAO,sBAAQ,CAAC,EAAE,KAAK,MAAa;AAClC,SACE,CAAC,IACC,OAAO;AAAA,IACL,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,OAAO;AAAA,IACP,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,KAAK;AAAA,IACL,SAAS;AAAA,EACX,IAEC,KACH,EAdC;AAgBL;","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface Props {
|
|
2
|
-
rotation: number;
|
|
3
|
-
center: {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
};
|
|
7
|
-
size: {
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
};
|
|
11
|
-
paths: Array<{
|
|
12
|
-
strokeWidth: number;
|
|
13
|
-
stroke: string;
|
|
14
|
-
d: string;
|
|
15
|
-
}>;
|
|
16
|
-
}
|
|
17
|
-
declare const SVGPathComponent: ({ size, center, rotation, paths }: Props) => JSX.Element;
|
|
18
|
-
|
|
19
|
-
export { SVGPathComponent, SVGPathComponent as default };
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
23
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
|
|
25
|
-
// src/schematic-components/SVGPathComponent.tsx
|
|
26
|
-
var SVGPathComponent_exports = {};
|
|
27
|
-
__export(SVGPathComponent_exports, {
|
|
28
|
-
SVGPathComponent: () => SVGPathComponent,
|
|
29
|
-
default: () => SVGPathComponent_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(SVGPathComponent_exports);
|
|
32
|
-
|
|
33
|
-
// src/lib/render-context/index.ts
|
|
34
|
-
var import_zustand = __toESM(require("zustand"));
|
|
35
|
-
var import_transformation_matrix = require("transformation-matrix");
|
|
36
|
-
var useRenderContext = (0, import_zustand.default)()(
|
|
37
|
-
(set, get) => ({
|
|
38
|
-
camera_transform: (0, import_transformation_matrix.compose)((0, import_transformation_matrix.scale)(100, 100, 0, 0))
|
|
39
|
-
})
|
|
40
|
-
);
|
|
41
|
-
var useCameraTransform = () => useRenderContext((s) => s.camera_transform);
|
|
42
|
-
|
|
43
|
-
// src/lib/utils/get-svg-path-bounds.ts
|
|
44
|
-
var import_svg_path_bounds = __toESM(require("svg-path-bounds"));
|
|
45
|
-
function getSVGPathBounds(ds) {
|
|
46
|
-
if (typeof ds === "string")
|
|
47
|
-
ds = [ds];
|
|
48
|
-
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
49
|
-
for (const d of ds) {
|
|
50
|
-
const [left, top, right, bottom] = (0, import_svg_path_bounds.default)(d);
|
|
51
|
-
minX = Math.min(left, minX);
|
|
52
|
-
maxX = Math.max(right, maxX);
|
|
53
|
-
minY = Math.min(top, minY);
|
|
54
|
-
maxY = Math.max(bottom, maxY);
|
|
55
|
-
}
|
|
56
|
-
return { minX, maxX, minY, maxY, width: maxX - minX, height: maxY - minY };
|
|
57
|
-
}
|
|
58
|
-
var get_svg_path_bounds_default = getSVGPathBounds;
|
|
59
|
-
|
|
60
|
-
// src/schematic-components/SVGPathComponent.tsx
|
|
61
|
-
var import_transformation_matrix2 = require("transformation-matrix");
|
|
62
|
-
var SVGPathComponent = ({ size, center, rotation, paths }) => {
|
|
63
|
-
const ct = useCameraTransform();
|
|
64
|
-
const pathBounds = get_svg_path_bounds_default(paths.map((p) => p.d));
|
|
65
|
-
const badRatio = Math.abs(pathBounds.width / pathBounds.height - size.width / size.height) > 0.01;
|
|
66
|
-
if (badRatio) {
|
|
67
|
-
console.warn(
|
|
68
|
-
`Ratio doesn't match for component. ${pathBounds.width}:${pathBounds.height} is not close to ${size.width}:${size.height}`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
pathBounds.height = Math.max(pathBounds.height, 1);
|
|
72
|
-
pathBounds.width = Math.max(pathBounds.width, 1);
|
|
73
|
-
const absoluteCenter = (0, import_transformation_matrix2.applyToPoint)(ct, center);
|
|
74
|
-
const absoluteSize = {
|
|
75
|
-
width: Math.max(1, size.width * ct.a),
|
|
76
|
-
height: Math.max(1, size.height * ct.d)
|
|
77
|
-
};
|
|
78
|
-
return <svg style={{
|
|
79
|
-
position: "absolute",
|
|
80
|
-
transform: rotation === 0 ? "" : `rotate(${rotation}rad)`,
|
|
81
|
-
left: absoluteCenter.x - absoluteSize.width / 2,
|
|
82
|
-
top: absoluteCenter.y - absoluteSize.height / 2
|
|
83
|
-
}} overflow="visible" width={absoluteSize.width} height={absoluteSize.height} viewBox={`${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`}>{paths.map((p, i) => <path key={i} fill="none" strokeWidth={2 * (p.strokeWidth || 1)} stroke={p.stroke || "red"} d={p.d} />)}</svg>;
|
|
84
|
-
};
|
|
85
|
-
var SVGPathComponent_default = SVGPathComponent;
|
|
86
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
-
0 && (module.exports = {
|
|
88
|
-
SVGPathComponent
|
|
89
|
-
});
|
|
90
|
-
//# sourceMappingURL=SVGPathComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schematic-components/SVGPathComponent.tsx","../../src/lib/render-context/index.ts","../../src/lib/utils/get-svg-path-bounds.ts"],"sourcesContent":["import { useCameraTransform } from \"lib/render-context\"\nimport getSVGPathBounds from \"lib/utils/get-svg-path-bounds\"\n\nimport { applyToPoint } from \"transformation-matrix\"\n\ninterface Props {\n rotation: number\n center: { x: number; y: number }\n size: { width: number; height: number }\n paths: Array<{\n strokeWidth: number\n stroke: string\n d: string\n }>\n}\n\nexport const SVGPathComponent = ({ size, center, rotation, paths }: Props) => {\n const ct = useCameraTransform()\n const pathBounds = getSVGPathBounds(paths.map((p) => p.d))\n // Margin in SVG Space\n const badRatio =\n Math.abs(pathBounds.width / pathBounds.height - size.width / size.height) >\n 0.01\n if (badRatio) {\n console.warn(\n `Ratio doesn't match for component. ${pathBounds.width}:${pathBounds.height} is not close to ${size.width}:${size.height}`\n )\n }\n pathBounds.height = Math.max(pathBounds.height, 1)\n pathBounds.width = Math.max(pathBounds.width, 1)\n const absoluteCenter = applyToPoint(ct, center)\n const absoluteSize = {\n width: Math.max(1, size.width * ct.a),\n height: Math.max(1, size.height * ct.d),\n }\n\n return (\n <svg\n style={{\n position: \"absolute\",\n transform: rotation === 0 ? \"\" : `rotate(${rotation}rad)`,\n left: absoluteCenter.x - absoluteSize.width / 2,\n top: absoluteCenter.y - absoluteSize.height / 2,\n // backgroundColor: badRatio ? \"rgba(255, 0, 0, 0.5)\" : \"transparent\",\n }}\n overflow=\"visible\"\n width={absoluteSize.width}\n height={absoluteSize.height}\n viewBox={`${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`}\n >\n {paths.map((p, i) => (\n <path\n key={i}\n fill=\"none\"\n strokeWidth={2 * (p.strokeWidth || 1)}\n stroke={p.stroke || \"red\"}\n d={p.d}\n />\n ))}\n </svg>\n )\n}\n\nexport default SVGPathComponent\n","import createStore from \"zustand\"\nimport { Matrix, compose, scale } from \"transformation-matrix\"\n\ninterface RenderContextState {\n camera_transform: Matrix\n}\n\nexport const useRenderContext = createStore<RenderContextState>()(\n (set, get) => ({\n camera_transform: compose(scale(100, 100, 0, 0)),\n })\n)\n\nexport const useCameraTransform = () =>\n useRenderContext((s) => s.camera_transform)\n","import svgPathBounds from \"svg-path-bounds\"\n\nexport function getSVGPathBounds(ds: string[] | string) {\n if (typeof ds === \"string\") ds = [ds]\n let minX = Infinity,\n maxX = -Infinity,\n minY = Infinity,\n maxY = -Infinity\n\n for (const d of ds) {\n const [left, top, right, bottom] = svgPathBounds(d)\n\n minX = Math.min(left, minX)\n maxX = Math.max(right, maxX)\n minY = Math.min(top, minY)\n maxY = Math.max(bottom, maxY)\n }\n\n return { minX, maxX, minY, maxY, width: maxX - minX, height: maxY - minY }\n}\n\nexport default getSVGPathBounds\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAwB;AACxB,mCAAuC;AAMhC,IAAM,uBAAmB,eAAAA,SAAgC;AAAA,EAC9D,CAAC,KAAK,SAAS;AAAA,IACb,sBAAkB,0CAAQ,oCAAM,KAAK,KAAK,GAAG,CAAC,CAAC;AAAA,EACjD;AACF;AAEO,IAAM,qBAAqB,MAChC,iBAAiB,CAAC,MAAM,EAAE,gBAAgB;;;ACd5C,6BAA0B;AAEnB,SAAS,iBAAiB,IAAuB;AACtD,MAAI,OAAO,OAAO;AAAU,SAAK,CAAC,EAAE;AACpC,MAAI,OAAO,UACT,OAAO,WACP,OAAO,UACP,OAAO;AAET,aAAW,KAAK,IAAI;AAClB,UAAM,CAAC,MAAM,KAAK,OAAO,MAAM,QAAI,uBAAAC,SAAc,CAAC;AAElD,WAAO,KAAK,IAAI,MAAM,IAAI;AAC1B,WAAO,KAAK,IAAI,OAAO,IAAI;AAC3B,WAAO,KAAK,IAAI,KAAK,IAAI;AACzB,WAAO,KAAK,IAAI,QAAQ,IAAI;AAAA,EAC9B;AAEA,SAAO,EAAE,MAAM,MAAM,MAAM,MAAM,OAAO,OAAO,MAAM,QAAQ,OAAO,KAAK;AAC3E;AAEA,IAAO,8BAAQ;;;AFlBf,IAAAC,gCAA6B;AAatB,IAAM,mBAAmB,CAAC,EAAE,MAAM,QAAQ,UAAU,MAAM,MAAa;AAC5E,QAAM,KAAK,mBAAmB;AAC9B,QAAM,aAAa,4BAAiB,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AAEzD,QAAM,WACJ,KAAK,IAAI,WAAW,QAAQ,WAAW,SAAS,KAAK,QAAQ,KAAK,MAAM,IACxE;AACF,MAAI,UAAU;AACZ,YAAQ;AAAA,MACN,sCAAsC,WAAW,SAAS,WAAW,0BAA0B,KAAK,SAAS,KAAK;AAAA,IACpH;AAAA,EACF;AACA,aAAW,SAAS,KAAK,IAAI,WAAW,QAAQ,CAAC;AACjD,aAAW,QAAQ,KAAK,IAAI,WAAW,OAAO,CAAC;AAC/C,QAAM,qBAAiB,4CAAa,IAAI,MAAM;AAC9C,QAAM,eAAe;AAAA,IACnB,OAAO,KAAK,IAAI,GAAG,KAAK,QAAQ,GAAG,CAAC;AAAA,IACpC,QAAQ,KAAK,IAAI,GAAG,KAAK,SAAS,GAAG,CAAC;AAAA,EACxC;AAEA,SACE,CAAC,IACC,OAAO;AAAA,IACL,UAAU;AAAA,IACV,WAAW,aAAa,IAAI,KAAK,UAAU;AAAA,IAC3C,MAAM,eAAe,IAAI,aAAa,QAAQ;AAAA,IAC9C,KAAK,eAAe,IAAI,aAAa,SAAS;AAAA,EAEhD,GACA,SAAS,UACT,OAAO,aAAa,OACpB,QAAQ,aAAa,QACrB,SAAS,GAAG,WAAW,QAAQ,WAAW,QAAQ,WAAW,SAAS,WAAW,WAEhF,MAAM,IAAI,CAAC,GAAG,MACb,CAAC,KACC,KAAK,GACL,KAAK,OACL,aAAa,KAAK,EAAE,eAAe,IACnC,QAAQ,EAAE,UAAU,OACpB,GAAG,EAAE,GACP,EACD,EACH,EAtBC;AAwBL;AAEA,IAAO,2BAAQ;","names":["createStore","svgPathBounds","import_transformation_matrix"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SchematicComponent } from '../lib/types/core.js';
|
|
2
|
-
import { SimpleBug } from '../lib/types/source-component.js';
|
|
3
|
-
import '../lib/types/util.js';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
component: {
|
|
7
|
-
source: SimpleBug;
|
|
8
|
-
schematic: SchematicComponent;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
declare const SchematicBug: ({ component: { source, schematic } }: Props) => JSX.Element;
|
|
12
|
-
|
|
13
|
-
export { SchematicBug, SchematicBug as default };
|
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
|
|
28
|
-
// node_modules/lodash/_baseRange.js
|
|
29
|
-
var require_baseRange = __commonJS({
|
|
30
|
-
"node_modules/lodash/_baseRange.js"(exports, module2) {
|
|
31
|
-
var nativeCeil = Math.ceil;
|
|
32
|
-
var nativeMax = Math.max;
|
|
33
|
-
function baseRange(start, end, step, fromRight) {
|
|
34
|
-
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
|
|
35
|
-
while (length--) {
|
|
36
|
-
result[fromRight ? length : ++index] = start;
|
|
37
|
-
start += step;
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
module2.exports = baseRange;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// node_modules/lodash/eq.js
|
|
46
|
-
var require_eq = __commonJS({
|
|
47
|
-
"node_modules/lodash/eq.js"(exports, module2) {
|
|
48
|
-
function eq(value, other) {
|
|
49
|
-
return value === other || value !== value && other !== other;
|
|
50
|
-
}
|
|
51
|
-
module2.exports = eq;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// node_modules/lodash/_freeGlobal.js
|
|
56
|
-
var require_freeGlobal = __commonJS({
|
|
57
|
-
"node_modules/lodash/_freeGlobal.js"(exports, module2) {
|
|
58
|
-
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
59
|
-
module2.exports = freeGlobal;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// node_modules/lodash/_root.js
|
|
64
|
-
var require_root = __commonJS({
|
|
65
|
-
"node_modules/lodash/_root.js"(exports, module2) {
|
|
66
|
-
var freeGlobal = require_freeGlobal();
|
|
67
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
68
|
-
var root = freeGlobal || freeSelf || Function("return this")();
|
|
69
|
-
module2.exports = root;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// node_modules/lodash/_Symbol.js
|
|
74
|
-
var require_Symbol = __commonJS({
|
|
75
|
-
"node_modules/lodash/_Symbol.js"(exports, module2) {
|
|
76
|
-
var root = require_root();
|
|
77
|
-
var Symbol2 = root.Symbol;
|
|
78
|
-
module2.exports = Symbol2;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// node_modules/lodash/_getRawTag.js
|
|
83
|
-
var require_getRawTag = __commonJS({
|
|
84
|
-
"node_modules/lodash/_getRawTag.js"(exports, module2) {
|
|
85
|
-
var Symbol2 = require_Symbol();
|
|
86
|
-
var objectProto = Object.prototype;
|
|
87
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
88
|
-
var nativeObjectToString = objectProto.toString;
|
|
89
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
90
|
-
function getRawTag(value) {
|
|
91
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
92
|
-
try {
|
|
93
|
-
value[symToStringTag] = void 0;
|
|
94
|
-
var unmasked = true;
|
|
95
|
-
} catch (e) {
|
|
96
|
-
}
|
|
97
|
-
var result = nativeObjectToString.call(value);
|
|
98
|
-
if (unmasked) {
|
|
99
|
-
if (isOwn) {
|
|
100
|
-
value[symToStringTag] = tag;
|
|
101
|
-
} else {
|
|
102
|
-
delete value[symToStringTag];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
module2.exports = getRawTag;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// node_modules/lodash/_objectToString.js
|
|
112
|
-
var require_objectToString = __commonJS({
|
|
113
|
-
"node_modules/lodash/_objectToString.js"(exports, module2) {
|
|
114
|
-
var objectProto = Object.prototype;
|
|
115
|
-
var nativeObjectToString = objectProto.toString;
|
|
116
|
-
function objectToString(value) {
|
|
117
|
-
return nativeObjectToString.call(value);
|
|
118
|
-
}
|
|
119
|
-
module2.exports = objectToString;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// node_modules/lodash/_baseGetTag.js
|
|
124
|
-
var require_baseGetTag = __commonJS({
|
|
125
|
-
"node_modules/lodash/_baseGetTag.js"(exports, module2) {
|
|
126
|
-
var Symbol2 = require_Symbol();
|
|
127
|
-
var getRawTag = require_getRawTag();
|
|
128
|
-
var objectToString = require_objectToString();
|
|
129
|
-
var nullTag = "[object Null]";
|
|
130
|
-
var undefinedTag = "[object Undefined]";
|
|
131
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
132
|
-
function baseGetTag(value) {
|
|
133
|
-
if (value == null) {
|
|
134
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
135
|
-
}
|
|
136
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
137
|
-
}
|
|
138
|
-
module2.exports = baseGetTag;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// node_modules/lodash/isObject.js
|
|
143
|
-
var require_isObject = __commonJS({
|
|
144
|
-
"node_modules/lodash/isObject.js"(exports, module2) {
|
|
145
|
-
function isObject(value) {
|
|
146
|
-
var type = typeof value;
|
|
147
|
-
return value != null && (type == "object" || type == "function");
|
|
148
|
-
}
|
|
149
|
-
module2.exports = isObject;
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// node_modules/lodash/isFunction.js
|
|
154
|
-
var require_isFunction = __commonJS({
|
|
155
|
-
"node_modules/lodash/isFunction.js"(exports, module2) {
|
|
156
|
-
var baseGetTag = require_baseGetTag();
|
|
157
|
-
var isObject = require_isObject();
|
|
158
|
-
var asyncTag = "[object AsyncFunction]";
|
|
159
|
-
var funcTag = "[object Function]";
|
|
160
|
-
var genTag = "[object GeneratorFunction]";
|
|
161
|
-
var proxyTag = "[object Proxy]";
|
|
162
|
-
function isFunction(value) {
|
|
163
|
-
if (!isObject(value)) {
|
|
164
|
-
return false;
|
|
165
|
-
}
|
|
166
|
-
var tag = baseGetTag(value);
|
|
167
|
-
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
168
|
-
}
|
|
169
|
-
module2.exports = isFunction;
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
// node_modules/lodash/isLength.js
|
|
174
|
-
var require_isLength = __commonJS({
|
|
175
|
-
"node_modules/lodash/isLength.js"(exports, module2) {
|
|
176
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
177
|
-
function isLength(value) {
|
|
178
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
179
|
-
}
|
|
180
|
-
module2.exports = isLength;
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// node_modules/lodash/isArrayLike.js
|
|
185
|
-
var require_isArrayLike = __commonJS({
|
|
186
|
-
"node_modules/lodash/isArrayLike.js"(exports, module2) {
|
|
187
|
-
var isFunction = require_isFunction();
|
|
188
|
-
var isLength = require_isLength();
|
|
189
|
-
function isArrayLike(value) {
|
|
190
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
191
|
-
}
|
|
192
|
-
module2.exports = isArrayLike;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// node_modules/lodash/_isIndex.js
|
|
197
|
-
var require_isIndex = __commonJS({
|
|
198
|
-
"node_modules/lodash/_isIndex.js"(exports, module2) {
|
|
199
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
200
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
201
|
-
function isIndex(value, length) {
|
|
202
|
-
var type = typeof value;
|
|
203
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
204
|
-
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
205
|
-
}
|
|
206
|
-
module2.exports = isIndex;
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
// node_modules/lodash/_isIterateeCall.js
|
|
211
|
-
var require_isIterateeCall = __commonJS({
|
|
212
|
-
"node_modules/lodash/_isIterateeCall.js"(exports, module2) {
|
|
213
|
-
var eq = require_eq();
|
|
214
|
-
var isArrayLike = require_isArrayLike();
|
|
215
|
-
var isIndex = require_isIndex();
|
|
216
|
-
var isObject = require_isObject();
|
|
217
|
-
function isIterateeCall(value, index, object) {
|
|
218
|
-
if (!isObject(object)) {
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
var type = typeof index;
|
|
222
|
-
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
|
|
223
|
-
return eq(object[index], value);
|
|
224
|
-
}
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
module2.exports = isIterateeCall;
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
// node_modules/lodash/_trimmedEndIndex.js
|
|
232
|
-
var require_trimmedEndIndex = __commonJS({
|
|
233
|
-
"node_modules/lodash/_trimmedEndIndex.js"(exports, module2) {
|
|
234
|
-
var reWhitespace = /\s/;
|
|
235
|
-
function trimmedEndIndex(string) {
|
|
236
|
-
var index = string.length;
|
|
237
|
-
while (index-- && reWhitespace.test(string.charAt(index))) {
|
|
238
|
-
}
|
|
239
|
-
return index;
|
|
240
|
-
}
|
|
241
|
-
module2.exports = trimmedEndIndex;
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
// node_modules/lodash/_baseTrim.js
|
|
246
|
-
var require_baseTrim = __commonJS({
|
|
247
|
-
"node_modules/lodash/_baseTrim.js"(exports, module2) {
|
|
248
|
-
var trimmedEndIndex = require_trimmedEndIndex();
|
|
249
|
-
var reTrimStart = /^\s+/;
|
|
250
|
-
function baseTrim(string) {
|
|
251
|
-
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
252
|
-
}
|
|
253
|
-
module2.exports = baseTrim;
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
// node_modules/lodash/isObjectLike.js
|
|
258
|
-
var require_isObjectLike = __commonJS({
|
|
259
|
-
"node_modules/lodash/isObjectLike.js"(exports, module2) {
|
|
260
|
-
function isObjectLike(value) {
|
|
261
|
-
return value != null && typeof value == "object";
|
|
262
|
-
}
|
|
263
|
-
module2.exports = isObjectLike;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
// node_modules/lodash/isSymbol.js
|
|
268
|
-
var require_isSymbol = __commonJS({
|
|
269
|
-
"node_modules/lodash/isSymbol.js"(exports, module2) {
|
|
270
|
-
var baseGetTag = require_baseGetTag();
|
|
271
|
-
var isObjectLike = require_isObjectLike();
|
|
272
|
-
var symbolTag = "[object Symbol]";
|
|
273
|
-
function isSymbol(value) {
|
|
274
|
-
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
275
|
-
}
|
|
276
|
-
module2.exports = isSymbol;
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
// node_modules/lodash/toNumber.js
|
|
281
|
-
var require_toNumber = __commonJS({
|
|
282
|
-
"node_modules/lodash/toNumber.js"(exports, module2) {
|
|
283
|
-
var baseTrim = require_baseTrim();
|
|
284
|
-
var isObject = require_isObject();
|
|
285
|
-
var isSymbol = require_isSymbol();
|
|
286
|
-
var NAN = 0 / 0;
|
|
287
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
288
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
289
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
290
|
-
var freeParseInt = parseInt;
|
|
291
|
-
function toNumber(value) {
|
|
292
|
-
if (typeof value == "number") {
|
|
293
|
-
return value;
|
|
294
|
-
}
|
|
295
|
-
if (isSymbol(value)) {
|
|
296
|
-
return NAN;
|
|
297
|
-
}
|
|
298
|
-
if (isObject(value)) {
|
|
299
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
300
|
-
value = isObject(other) ? other + "" : other;
|
|
301
|
-
}
|
|
302
|
-
if (typeof value != "string") {
|
|
303
|
-
return value === 0 ? value : +value;
|
|
304
|
-
}
|
|
305
|
-
value = baseTrim(value);
|
|
306
|
-
var isBinary = reIsBinary.test(value);
|
|
307
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
308
|
-
}
|
|
309
|
-
module2.exports = toNumber;
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
// node_modules/lodash/toFinite.js
|
|
314
|
-
var require_toFinite = __commonJS({
|
|
315
|
-
"node_modules/lodash/toFinite.js"(exports, module2) {
|
|
316
|
-
var toNumber = require_toNumber();
|
|
317
|
-
var INFINITY = 1 / 0;
|
|
318
|
-
var MAX_INTEGER = 17976931348623157e292;
|
|
319
|
-
function toFinite(value) {
|
|
320
|
-
if (!value) {
|
|
321
|
-
return value === 0 ? value : 0;
|
|
322
|
-
}
|
|
323
|
-
value = toNumber(value);
|
|
324
|
-
if (value === INFINITY || value === -INFINITY) {
|
|
325
|
-
var sign = value < 0 ? -1 : 1;
|
|
326
|
-
return sign * MAX_INTEGER;
|
|
327
|
-
}
|
|
328
|
-
return value === value ? value : 0;
|
|
329
|
-
}
|
|
330
|
-
module2.exports = toFinite;
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
// node_modules/lodash/_createRange.js
|
|
335
|
-
var require_createRange = __commonJS({
|
|
336
|
-
"node_modules/lodash/_createRange.js"(exports, module2) {
|
|
337
|
-
var baseRange = require_baseRange();
|
|
338
|
-
var isIterateeCall = require_isIterateeCall();
|
|
339
|
-
var toFinite = require_toFinite();
|
|
340
|
-
function createRange(fromRight) {
|
|
341
|
-
return function(start, end, step) {
|
|
342
|
-
if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
|
|
343
|
-
end = step = void 0;
|
|
344
|
-
}
|
|
345
|
-
start = toFinite(start);
|
|
346
|
-
if (end === void 0) {
|
|
347
|
-
end = start;
|
|
348
|
-
start = 0;
|
|
349
|
-
} else {
|
|
350
|
-
end = toFinite(end);
|
|
351
|
-
}
|
|
352
|
-
step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
|
|
353
|
-
return baseRange(start, end, step, fromRight);
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
module2.exports = createRange;
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
// node_modules/lodash/range.js
|
|
361
|
-
var require_range = __commonJS({
|
|
362
|
-
"node_modules/lodash/range.js"(exports, module2) {
|
|
363
|
-
var createRange = require_createRange();
|
|
364
|
-
var range2 = createRange();
|
|
365
|
-
module2.exports = range2;
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
// src/schematic-components/SchematicBug.tsx
|
|
370
|
-
var SchematicBug_exports = {};
|
|
371
|
-
__export(SchematicBug_exports, {
|
|
372
|
-
SchematicBug: () => SchematicBug,
|
|
373
|
-
default: () => SchematicBug_default
|
|
374
|
-
});
|
|
375
|
-
module.exports = __toCommonJS(SchematicBug_exports);
|
|
376
|
-
|
|
377
|
-
// src/lib/render-context/index.ts
|
|
378
|
-
var import_zustand = __toESM(require("zustand"));
|
|
379
|
-
var import_transformation_matrix = require("transformation-matrix");
|
|
380
|
-
var useRenderContext = (0, import_zustand.default)()(
|
|
381
|
-
(set, get) => ({
|
|
382
|
-
camera_transform: (0, import_transformation_matrix.compose)((0, import_transformation_matrix.scale)(100, 100, 0, 0))
|
|
383
|
-
})
|
|
384
|
-
);
|
|
385
|
-
var useCameraTransform = () => useRenderContext((s) => s.camera_transform);
|
|
386
|
-
|
|
387
|
-
// src/lib/utils/get-svg-path-bounds.ts
|
|
388
|
-
var import_svg_path_bounds = __toESM(require("svg-path-bounds"));
|
|
389
|
-
function getSVGPathBounds(ds) {
|
|
390
|
-
if (typeof ds === "string")
|
|
391
|
-
ds = [ds];
|
|
392
|
-
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
393
|
-
for (const d of ds) {
|
|
394
|
-
const [left, top, right, bottom] = (0, import_svg_path_bounds.default)(d);
|
|
395
|
-
minX = Math.min(left, minX);
|
|
396
|
-
maxX = Math.max(right, maxX);
|
|
397
|
-
minY = Math.min(top, minY);
|
|
398
|
-
maxY = Math.max(bottom, maxY);
|
|
399
|
-
}
|
|
400
|
-
return { minX, maxX, minY, maxY, width: maxX - minX, height: maxY - minY };
|
|
401
|
-
}
|
|
402
|
-
var get_svg_path_bounds_default = getSVGPathBounds;
|
|
403
|
-
|
|
404
|
-
// src/schematic-components/SVGPathComponent.tsx
|
|
405
|
-
var import_transformation_matrix2 = require("transformation-matrix");
|
|
406
|
-
var SVGPathComponent = ({ size, center, rotation, paths }) => {
|
|
407
|
-
const ct = useCameraTransform();
|
|
408
|
-
const pathBounds = get_svg_path_bounds_default(paths.map((p) => p.d));
|
|
409
|
-
const badRatio = Math.abs(pathBounds.width / pathBounds.height - size.width / size.height) > 0.01;
|
|
410
|
-
if (badRatio) {
|
|
411
|
-
console.warn(
|
|
412
|
-
`Ratio doesn't match for component. ${pathBounds.width}:${pathBounds.height} is not close to ${size.width}:${size.height}`
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
pathBounds.height = Math.max(pathBounds.height, 1);
|
|
416
|
-
pathBounds.width = Math.max(pathBounds.width, 1);
|
|
417
|
-
const absoluteCenter = (0, import_transformation_matrix2.applyToPoint)(ct, center);
|
|
418
|
-
const absoluteSize = {
|
|
419
|
-
width: Math.max(1, size.width * ct.a),
|
|
420
|
-
height: Math.max(1, size.height * ct.d)
|
|
421
|
-
};
|
|
422
|
-
return <svg style={{
|
|
423
|
-
position: "absolute",
|
|
424
|
-
transform: rotation === 0 ? "" : `rotate(${rotation}rad)`,
|
|
425
|
-
left: absoluteCenter.x - absoluteSize.width / 2,
|
|
426
|
-
top: absoluteCenter.y - absoluteSize.height / 2
|
|
427
|
-
}} overflow="visible" width={absoluteSize.width} height={absoluteSize.height} viewBox={`${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`}>{paths.map((p, i) => <path key={i} fill="none" strokeWidth={2 * (p.strokeWidth || 1)} stroke={p.stroke || "red"} d={p.d} />)}</svg>;
|
|
428
|
-
};
|
|
429
|
-
var SVGPathComponent_default = SVGPathComponent;
|
|
430
|
-
|
|
431
|
-
// src/schematic-components/SchematicBug.tsx
|
|
432
|
-
var import_range = __toESM(require_range());
|
|
433
|
-
var SchematicBug = ({ component: { source, schematic } }) => {
|
|
434
|
-
const ports_arrangement = schematic.port_arrangement;
|
|
435
|
-
const port_labels = schematic.port_labels;
|
|
436
|
-
const bugw = 30;
|
|
437
|
-
const rh = 15;
|
|
438
|
-
const pd = 7.5;
|
|
439
|
-
const bugh = Math.max(ports_arrangement.left_size, ports_arrangement.right_size) * rh;
|
|
440
|
-
return <SVGPathComponent_default rotation={schematic.rotation} center={schematic.center} size={schematic.size} paths={[
|
|
441
|
-
{
|
|
442
|
-
stroke: "red",
|
|
443
|
-
strokeWidth: 1,
|
|
444
|
-
d: `M 0 0 L ${bugw} 0 L ${bugw} ${bugh} L 0 ${bugh}Z`
|
|
445
|
-
},
|
|
446
|
-
...(0, import_range.default)(
|
|
447
|
-
0,
|
|
448
|
-
ports_arrangement.left_size + ports_arrangement.right_size
|
|
449
|
-
).map((i) => {
|
|
450
|
-
const ls = ports_arrangement.left_size;
|
|
451
|
-
const left = i < ls;
|
|
452
|
-
const rowi = i % ls;
|
|
453
|
-
const p1 = [left ? 0 : bugw, rh / 2 + rowi * rh];
|
|
454
|
-
const rd = [left ? -pd : pd, 0];
|
|
455
|
-
return {
|
|
456
|
-
stroke: "red",
|
|
457
|
-
strokeWidth: 1,
|
|
458
|
-
d: `M ${p1.join(" ")} l ${rd.join(" ")}`
|
|
459
|
-
};
|
|
460
|
-
})
|
|
461
|
-
]} />;
|
|
462
|
-
};
|
|
463
|
-
var SchematicBug_default = SchematicBug;
|
|
464
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
465
|
-
0 && (module.exports = {
|
|
466
|
-
SchematicBug
|
|
467
|
-
});
|
|
468
|
-
//# sourceMappingURL=SchematicBug.js.map
|