@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.
Files changed (108) hide show
  1. package/dist/index.d.ts +6 -1
  2. package/dist/index.js +35176 -5772
  3. package/dist/index.js.map +1 -1
  4. package/package.json +3 -5
  5. package/src/pages/led-circuit.tsx +8 -1
  6. package/tsconfig.json +2 -1
  7. package/dist/Schematic.d.ts +0 -6
  8. package/dist/Schematic.js +0 -8609
  9. package/dist/Schematic.js.map +0 -1
  10. package/dist/lib/hooks/index.d.ts +0 -1
  11. package/dist/lib/hooks/index.js +0 -2170
  12. package/dist/lib/hooks/index.js.map +0 -1
  13. package/dist/lib/hooks/use-maybe-promise.d.ts +0 -3
  14. package/dist/lib/hooks/use-maybe-promise.js +0 -2170
  15. package/dist/lib/hooks/use-maybe-promise.js.map +0 -1
  16. package/dist/lib/render-context/index.d.ts +0 -10
  17. package/dist/lib/render-context/index.js +0 -45
  18. package/dist/lib/render-context/index.js.map +0 -1
  19. package/dist/lib/types/core.d.ts +0 -149
  20. package/dist/lib/types/core.js +0 -18
  21. package/dist/lib/types/core.js.map +0 -1
  22. package/dist/lib/types/index.d.ts +0 -4
  23. package/dist/lib/types/index.js +0 -18
  24. package/dist/lib/types/index.js.map +0 -1
  25. package/dist/lib/types/route-solver.d.ts +0 -24
  26. package/dist/lib/types/route-solver.js +0 -18
  27. package/dist/lib/types/route-solver.js.map +0 -1
  28. package/dist/lib/types/source-component.d.ts +0 -44
  29. package/dist/lib/types/source-component.js +0 -18
  30. package/dist/lib/types/source-component.js.map +0 -1
  31. package/dist/lib/types/util.d.ts +0 -14
  32. package/dist/lib/types/util.js +0 -18
  33. package/dist/lib/types/util.js.map +0 -1
  34. package/dist/lib/utils/direction-to-vec.d.ts +0 -13
  35. package/dist/lib/utils/direction-to-vec.js +0 -96
  36. package/dist/lib/utils/direction-to-vec.js.map +0 -1
  37. package/dist/lib/utils/get-svg-path-bounds.d.ts +0 -10
  38. package/dist/lib/utils/get-svg-path-bounds.js +0 -51
  39. package/dist/lib/utils/get-svg-path-bounds.js.map +0 -1
  40. package/dist/lib/utils/point-math.d.ts +0 -20
  41. package/dist/lib/utils/point-math.js +0 -57
  42. package/dist/lib/utils/point-math.js.map +0 -1
  43. package/dist/pages/_app.d.ts +0 -5
  44. package/dist/pages/_app.js +0 -2714
  45. package/dist/pages/_app.js.map +0 -1
  46. package/dist/pages/index.d.ts +0 -3
  47. package/dist/pages/index.js +0 -8615
  48. package/dist/pages/index.js.map +0 -1
  49. package/dist/pages/led-circuit-react.d.ts +0 -3
  50. package/dist/pages/led-circuit-react.js +0 -8640
  51. package/dist/pages/led-circuit-react.js.map +0 -1
  52. package/dist/pages/led-circuit.d.ts +0 -3
  53. package/dist/pages/led-circuit.js +0 -8659
  54. package/dist/pages/led-circuit.js.map +0 -1
  55. package/dist/schematic-components/MovableGrid/MovableGrid.stories.d.ts +0 -7
  56. package/dist/schematic-components/MovableGrid/MovableGrid.stories.js +0 -47
  57. package/dist/schematic-components/MovableGrid/MovableGrid.stories.js.map +0 -1
  58. package/dist/schematic-components/MovableGrid/index.d.ts +0 -3
  59. package/dist/schematic-components/MovableGrid/index.js +0 -34
  60. package/dist/schematic-components/MovableGrid/index.js.map +0 -1
  61. package/dist/schematic-components/ProjectComponent.d.ts +0 -10
  62. package/dist/schematic-components/ProjectComponent.js +0 -8584
  63. package/dist/schematic-components/ProjectComponent.js.map +0 -1
  64. package/dist/schematic-components/RenderError.d.ts +0 -6
  65. package/dist/schematic-components/RenderError.js +0 -40
  66. package/dist/schematic-components/RenderError.js.map +0 -1
  67. package/dist/schematic-components/SVGPathComponent.d.ts +0 -19
  68. package/dist/schematic-components/SVGPathComponent.js +0 -90
  69. package/dist/schematic-components/SVGPathComponent.js.map +0 -1
  70. package/dist/schematic-components/SchematicBug.d.ts +0 -13
  71. package/dist/schematic-components/SchematicBug.js +0 -468
  72. package/dist/schematic-components/SchematicBug.js.map +0 -1
  73. package/dist/schematic-components/SchematicComponent.d.ts +0 -13
  74. package/dist/schematic-components/SchematicComponent.js +0 -8451
  75. package/dist/schematic-components/SchematicComponent.js.map +0 -1
  76. package/dist/schematic-components/SchematicGroup.d.ts +0 -3
  77. package/dist/schematic-components/SchematicGroup.js +0 -32
  78. package/dist/schematic-components/SchematicGroup.js.map +0 -1
  79. package/dist/schematic-components/SchematicPort.d.ts +0 -13
  80. package/dist/schematic-components/SchematicPort.js +0 -8348
  81. package/dist/schematic-components/SchematicPort.js.map +0 -1
  82. package/dist/schematic-components/SchematicText.d.ts +0 -10
  83. package/dist/schematic-components/SchematicText.js +0 -71
  84. package/dist/schematic-components/SchematicText.js.map +0 -1
  85. package/dist/schematic-components/SchematicTrace.d.ts +0 -13
  86. package/dist/schematic-components/SchematicTrace.js +0 -137
  87. package/dist/schematic-components/SchematicTrace.js.map +0 -1
  88. package/dist/schematic-components/SimpleCapacitor.d.ts +0 -13
  89. package/dist/schematic-components/SimpleCapacitor.js +0 -103
  90. package/dist/schematic-components/SimpleCapacitor.js.map +0 -1
  91. package/dist/schematic-components/SimpleDiode.d.ts +0 -13
  92. package/dist/schematic-components/SimpleDiode.js +0 -101
  93. package/dist/schematic-components/SimpleDiode.js.map +0 -1
  94. package/dist/schematic-components/SimpleGround.d.ts +0 -13
  95. package/dist/schematic-components/SimpleGround.js +0 -102
  96. package/dist/schematic-components/SimpleGround.js.map +0 -1
  97. package/dist/schematic-components/SimpleInductor.d.ts +0 -13
  98. package/dist/schematic-components/SimpleInductor.js +0 -102
  99. package/dist/schematic-components/SimpleInductor.js.map +0 -1
  100. package/dist/schematic-components/SimplePowerSource.d.ts +0 -13
  101. package/dist/schematic-components/SimplePowerSource.js +0 -104
  102. package/dist/schematic-components/SimplePowerSource.js.map +0 -1
  103. package/dist/schematic-components/SimpleResistor.d.ts +0 -13
  104. package/dist/schematic-components/SimpleResistor.js +0 -102
  105. package/dist/schematic-components/SimpleResistor.js.map +0 -1
  106. package/dist/schematic-components/index.d.ts +0 -18
  107. package/dist/schematic-components/index.js +0 -8618
  108. package/dist/schematic-components/index.js.map +0 -1
@@ -1,24 +0,0 @@
1
- declare type RouteSolver = (params: {
2
- terminals: Array<{
3
- x: number;
4
- y: number;
5
- facing_direction?: "up" | "down" | "left" | "right";
6
- }>;
7
- obstacles: Array<{
8
- cx: number;
9
- cy: number;
10
- w: number;
11
- h: number;
12
- }>;
13
- }) => Promise<Array<{
14
- from: {
15
- x: number;
16
- y: number;
17
- };
18
- to: {
19
- x: number;
20
- y: number;
21
- };
22
- }>>;
23
-
24
- export { RouteSolver };
@@ -1,18 +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 __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // src/lib/types/route-solver.ts
16
- var route_solver_exports = {};
17
- module.exports = __toCommonJS(route_solver_exports);
18
- //# sourceMappingURL=route-solver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/types/route-solver.ts"],"sourcesContent":["export type RouteSolver = (params: {\n terminals: Array<{\n x: number\n y: number\n facing_direction?: \"up\" | \"down\" | \"left\" | \"right\"\n }>\n obstacles: Array<{ cx: number; cy: number; w: number; h: number }>\n}) => Promise<\n Array<{ from: { x: number; y: number }; to: { x: number; y: number } }>\n>\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,44 +0,0 @@
1
- import { NumberWithUnit } from './util.js';
2
-
3
- interface SourceComponentBase {
4
- type: "source_component";
5
- /** The functional type of this component, e.g. resistor, capacitor etc. */
6
- ftype?: string;
7
- source_component_id: string;
8
- name: string;
9
- }
10
- interface SimpleResistor extends SourceComponentBase {
11
- ftype: "simple_resistor";
12
- resistance: NumberWithUnit<"ohm">;
13
- }
14
- interface SimpleCapacitor extends SourceComponentBase {
15
- ftype: "simple_capacitor";
16
- capacitance: NumberWithUnit<"farad">;
17
- }
18
- interface SimpleInductor extends SourceComponentBase {
19
- ftype: "simple_inductor";
20
- inductance: NumberWithUnit<"henry">;
21
- }
22
- interface SimpleDiode extends SourceComponentBase {
23
- ftype: "simple_diode";
24
- }
25
- declare type LightEmittingDiode = SimpleDiode & {
26
- ftype: "led";
27
- };
28
- interface SimpleBug extends SourceComponentBase {
29
- ftype: "simple_bug";
30
- }
31
- interface SimplePowerSource extends SourceComponentBase {
32
- ftype: "simple_power_source";
33
- voltage: NumberWithUnit<"volt">;
34
- }
35
- interface SimpleGround extends SourceComponentBase {
36
- ftype: "simple_ground";
37
- }
38
- declare type AnySourceComponent = SimpleResistor | SimpleCapacitor | SimpleBug | SimpleInductor | SimplePowerSource | SimpleGround | SimpleDiode | LightEmittingDiode;
39
- declare type SourceComponentFType = AnySourceComponent["ftype"];
40
- declare type SourceComponent<T extends SourceComponentFType = SourceComponentFType> = Extract<AnySourceComponent, {
41
- ftype: T;
42
- }>;
43
-
44
- export { AnySourceComponent, LightEmittingDiode, SimpleBug, SimpleCapacitor, SimpleDiode, SimpleGround, SimpleInductor, SimplePowerSource, SimpleResistor, SourceComponent, SourceComponentBase, SourceComponentFType };
@@ -1,18 +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 __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // src/lib/types/source-component.ts
16
- var source_component_exports = {};
17
- module.exports = __toCommonJS(source_component_exports);
18
- //# sourceMappingURL=source-component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/types/source-component.ts"],"sourcesContent":["import { NumberWithUnit } from \"./util\"\n\nexport interface SourceComponentBase {\n type: \"source_component\"\n /** The functional type of this component, e.g. resistor, capacitor etc. */\n ftype?: string\n source_component_id: string\n name: string\n}\n\nexport interface SimpleResistor extends SourceComponentBase {\n ftype: \"simple_resistor\"\n // Resistance measured in ohms\n resistance: NumberWithUnit<\"ohm\">\n}\n\nexport interface SimpleCapacitor extends SourceComponentBase {\n ftype: \"simple_capacitor\"\n // Capacitance measured in farads\n capacitance: NumberWithUnit<\"farad\">\n}\n\nexport interface SimpleInductor extends SourceComponentBase {\n ftype: \"simple_inductor\"\n // Inductance measured in henries\n inductance: NumberWithUnit<\"henry\">\n}\n\nexport interface SimpleDiode extends SourceComponentBase {\n ftype: \"simple_diode\"\n}\n\nexport type LightEmittingDiode = SimpleDiode & {\n ftype: \"led\"\n}\n\nexport interface SimpleBug extends SourceComponentBase {\n ftype: \"simple_bug\"\n}\n\nexport interface SimplePowerSource extends SourceComponentBase {\n ftype: \"simple_power_source\"\n voltage: NumberWithUnit<\"volt\">\n}\n\nexport interface SimpleGround extends SourceComponentBase {\n ftype: \"simple_ground\"\n}\n\nexport type AnySourceComponent =\n | SimpleResistor\n | SimpleCapacitor\n | SimpleBug\n | SimpleInductor\n | SimplePowerSource\n | SimpleGround\n | SimpleDiode\n | LightEmittingDiode\n\nexport type SourceComponentFType = AnySourceComponent[\"ftype\"]\nexport type SourceComponent<\n T extends SourceComponentFType = SourceComponentFType\n> = Extract<AnySourceComponent, { ftype: T }>\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,14 +0,0 @@
1
- declare type SIPrefix = "femto" | "f" | "u" | "micro" | "c" | "centi" | "m" | "milli" | "k" | "kilo" | "M" | "mega";
2
- declare type UnitAbbreviations = {
3
- farad: "F";
4
- ohm: "Ω";
5
- henry: "H";
6
- meter: "m";
7
- volt: "V";
8
- };
9
- declare type Unit = "ohm" | "farad" | "henry" | "meter" | "volt";
10
- declare type UnitOrAbbreviation = UnitAbbreviations[Unit] | Unit;
11
- declare type NumberWithAnyUnit = `${number}${UnitOrAbbreviation}` | `${number} ${UnitOrAbbreviation}` | `${number}${SIPrefix}${UnitOrAbbreviation}` | `${number} ${SIPrefix}${UnitOrAbbreviation}`;
12
- declare type NumberWithUnit<T extends Unit> = `${number}${T | UnitAbbreviations[T]}` | `${number} ${T | UnitAbbreviations[T]}` | `${number}${SIPrefix}${T | UnitAbbreviations[T]}` | `${number} ${SIPrefix}${T | UnitAbbreviations[T]}`;
13
-
14
- export { NumberWithAnyUnit, NumberWithUnit, SIPrefix, Unit, UnitAbbreviations, UnitOrAbbreviation };
@@ -1,18 +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 __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // src/lib/types/util.ts
16
- var util_exports = {};
17
- module.exports = __toCommonJS(util_exports);
18
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/types/util.ts"],"sourcesContent":["// Currently, removing uncommon SI Prefixes for type simplicity.\nexport type SIPrefix =\n // | \"y\"\n // | \"yocto\"\n // | \"z\"\n // | \"zepto\"\n // | \"atto\"\n // | \"a\"\n | \"femto\"\n | \"f\"\n | \"u\"\n | \"micro\"\n // | \"d\"\n // | \"deci\"\n | \"c\"\n | \"centi\"\n | \"m\"\n | \"milli\"\n | \"k\"\n | \"kilo\"\n | \"M\"\n | \"mega\"\n// | \"G\"\n// | \"T\"\n// | \"P\"\n// | \"E\"\n// | \"Z\"\n// | \"Y\"\n\nexport type UnitAbbreviations = {\n farad: \"F\"\n ohm: \"Ω\"\n henry: \"H\"\n meter: \"m\"\n volt: \"V\"\n}\n\nexport type Unit = \"ohm\" | \"farad\" | \"henry\" | \"meter\" | \"volt\"\n\nexport type UnitOrAbbreviation = UnitAbbreviations[Unit] | Unit\n\nexport type NumberWithAnyUnit =\n | `${number}${UnitOrAbbreviation}`\n | `${number} ${UnitOrAbbreviation}`\n | `${number}${SIPrefix}${UnitOrAbbreviation}`\n | `${number} ${SIPrefix}${UnitOrAbbreviation}`\n\nexport type NumberWithUnit<T extends Unit> =\n | `${number}${T | UnitAbbreviations[T]}`\n | `${number} ${T | UnitAbbreviations[T]}`\n | `${number}${SIPrefix}${T | UnitAbbreviations[T]}`\n | `${number} ${SIPrefix}${T | UnitAbbreviations[T]}`\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,13 +0,0 @@
1
- declare const directionToVec: (direction: "up" | "down" | "left" | "right") => {
2
- x: number;
3
- y: number;
4
- };
5
- declare const vecToDirection: ({ x, y }: {
6
- x: number;
7
- y: number;
8
- }) => "left" | "right" | "up" | "down";
9
- declare const rotateClockwise: (direction: "up" | "down" | "left" | "right") => "left" | "right" | "up" | "down";
10
- declare const rotateCounterClockwise: (direction: "up" | "down" | "left" | "right") => "left" | "right" | "up" | "down";
11
- declare const rotateDirection: (direction: "up" | "down" | "left" | "right", num90DegreeClockwiseTurns: number) => "left" | "right" | "up" | "down";
12
-
13
- export { directionToVec, rotateClockwise, rotateCounterClockwise, rotateDirection, vecToDirection };
@@ -1,96 +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/lib/utils/direction-to-vec.ts
20
- var direction_to_vec_exports = {};
21
- __export(direction_to_vec_exports, {
22
- directionToVec: () => directionToVec,
23
- rotateClockwise: () => rotateClockwise,
24
- rotateCounterClockwise: () => rotateCounterClockwise,
25
- rotateDirection: () => rotateDirection,
26
- vecToDirection: () => vecToDirection
27
- });
28
- module.exports = __toCommonJS(direction_to_vec_exports);
29
- var directionToVec = (direction) => {
30
- if (direction === "up")
31
- return { x: 0, y: -1 };
32
- else if (direction === "down")
33
- return { x: 0, y: 1 };
34
- else if (direction === "left")
35
- return { x: -1, y: 0 };
36
- else if (direction === "right")
37
- return { x: 1, y: 0 };
38
- else
39
- throw new Error("Invalid direction");
40
- };
41
- var vecToDirection = ({ x, y }) => {
42
- if (x > y)
43
- y = 0;
44
- if (y > x)
45
- x = 0;
46
- if (x > 0 && y === 0)
47
- return "right";
48
- else if (x < 0 && y === 0)
49
- return "left";
50
- else if (x === 0 && y > 0)
51
- return "down";
52
- else if (x === 0 && y < 0)
53
- return "up";
54
- else
55
- throw new Error(`Invalid vector for direction conversion (${x}, ${y})`);
56
- };
57
- var rotateClockwise = (direction) => {
58
- if (direction === "up")
59
- return "right";
60
- else if (direction === "right")
61
- return "down";
62
- else if (direction === "down")
63
- return "left";
64
- else if (direction === "left")
65
- return "up";
66
- };
67
- var rotateCounterClockwise = (direction) => {
68
- if (direction === "up")
69
- return "left";
70
- else if (direction === "left")
71
- return "down";
72
- else if (direction === "down")
73
- return "right";
74
- else if (direction === "right")
75
- return "up";
76
- };
77
- var rotateDirection = (direction, num90DegreeClockwiseTurns) => {
78
- while (num90DegreeClockwiseTurns > 0) {
79
- direction = rotateClockwise(direction);
80
- num90DegreeClockwiseTurns--;
81
- }
82
- while (num90DegreeClockwiseTurns < 0) {
83
- direction = rotateCounterClockwise(direction);
84
- num90DegreeClockwiseTurns++;
85
- }
86
- return direction;
87
- };
88
- // Annotate the CommonJS export names for ESM import in node:
89
- 0 && (module.exports = {
90
- directionToVec,
91
- rotateClockwise,
92
- rotateCounterClockwise,
93
- rotateDirection,
94
- vecToDirection
95
- });
96
- //# sourceMappingURL=direction-to-vec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/utils/direction-to-vec.ts"],"sourcesContent":["export const directionToVec = (direction: \"up\" | \"down\" | \"left\" | \"right\") => {\n if (direction === \"up\") return { x: 0, y: -1 }\n else if (direction === \"down\") return { x: 0, y: 1 }\n else if (direction === \"left\") return { x: -1, y: 0 }\n else if (direction === \"right\") return { x: 1, y: 0 }\n else throw new Error(\"Invalid direction\")\n}\n\nexport const vecToDirection = ({ x, y }: { x: number; y: number }) => {\n if (x > y) y = 0\n if (y > x) x = 0\n if (x > 0 && y === 0) return \"right\"\n else if (x < 0 && y === 0) return \"left\"\n else if (x === 0 && y > 0) return \"down\"\n else if (x === 0 && y < 0) return \"up\"\n else throw new Error(`Invalid vector for direction conversion (${x}, ${y})`)\n}\n\nexport const rotateClockwise = (\n direction: \"up\" | \"down\" | \"left\" | \"right\"\n) => {\n if (direction === \"up\") return \"right\"\n else if (direction === \"right\") return \"down\"\n else if (direction === \"down\") return \"left\"\n else if (direction === \"left\") return \"up\"\n}\n\nexport const rotateCounterClockwise = (\n direction: \"up\" | \"down\" | \"left\" | \"right\"\n) => {\n if (direction === \"up\") return \"left\"\n else if (direction === \"left\") return \"down\"\n else if (direction === \"down\") return \"right\"\n else if (direction === \"right\") return \"up\"\n}\n\nexport const rotateDirection = (\n direction: \"up\" | \"down\" | \"left\" | \"right\",\n num90DegreeClockwiseTurns: number\n) => {\n while (num90DegreeClockwiseTurns > 0) {\n direction = rotateClockwise(direction)\n num90DegreeClockwiseTurns--\n }\n while (num90DegreeClockwiseTurns < 0) {\n direction = rotateCounterClockwise(direction)\n num90DegreeClockwiseTurns++\n }\n return direction\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,iBAAiB,CAAC,cAAgD;AAC7E,MAAI,cAAc;AAAM,WAAO,EAAE,GAAG,GAAG,GAAG,GAAG;AAAA,WACpC,cAAc;AAAQ,WAAO,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,WAC1C,cAAc;AAAQ,WAAO,EAAE,GAAG,IAAI,GAAG,EAAE;AAAA,WAC3C,cAAc;AAAS,WAAO,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA;AAC/C,UAAM,IAAI,MAAM,mBAAmB;AAC1C;AAEO,IAAM,iBAAiB,CAAC,EAAE,GAAG,EAAE,MAAgC;AACpE,MAAI,IAAI;AAAG,QAAI;AACf,MAAI,IAAI;AAAG,QAAI;AACf,MAAI,IAAI,KAAK,MAAM;AAAG,WAAO;AAAA,WACpB,IAAI,KAAK,MAAM;AAAG,WAAO;AAAA,WACzB,MAAM,KAAK,IAAI;AAAG,WAAO;AAAA,WACzB,MAAM,KAAK,IAAI;AAAG,WAAO;AAAA;AAC7B,UAAM,IAAI,MAAM,4CAA4C,MAAM,IAAI;AAC7E;AAEO,IAAM,kBAAkB,CAC7B,cACG;AACH,MAAI,cAAc;AAAM,WAAO;AAAA,WACtB,cAAc;AAAS,WAAO;AAAA,WAC9B,cAAc;AAAQ,WAAO;AAAA,WAC7B,cAAc;AAAQ,WAAO;AACxC;AAEO,IAAM,yBAAyB,CACpC,cACG;AACH,MAAI,cAAc;AAAM,WAAO;AAAA,WACtB,cAAc;AAAQ,WAAO;AAAA,WAC7B,cAAc;AAAQ,WAAO;AAAA,WAC7B,cAAc;AAAS,WAAO;AACzC;AAEO,IAAM,kBAAkB,CAC7B,WACA,8BACG;AACH,SAAO,4BAA4B,GAAG;AACpC,gBAAY,gBAAgB,SAAS;AACrC;AAAA,EACF;AACA,SAAO,4BAA4B,GAAG;AACpC,gBAAY,uBAAuB,SAAS;AAC5C;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -1,10 +0,0 @@
1
- declare function getSVGPathBounds(ds: string[] | string): {
2
- minX: number;
3
- maxX: number;
4
- minY: number;
5
- maxY: number;
6
- width: number;
7
- height: number;
8
- };
9
-
10
- export { getSVGPathBounds as default, getSVGPathBounds };
@@ -1,51 +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/lib/utils/get-svg-path-bounds.ts
26
- var get_svg_path_bounds_exports = {};
27
- __export(get_svg_path_bounds_exports, {
28
- default: () => get_svg_path_bounds_default,
29
- getSVGPathBounds: () => getSVGPathBounds
30
- });
31
- module.exports = __toCommonJS(get_svg_path_bounds_exports);
32
- var import_svg_path_bounds = __toESM(require("svg-path-bounds"));
33
- function getSVGPathBounds(ds) {
34
- if (typeof ds === "string")
35
- ds = [ds];
36
- let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
37
- for (const d of ds) {
38
- const [left, top, right, bottom] = (0, import_svg_path_bounds.default)(d);
39
- minX = Math.min(left, minX);
40
- maxX = Math.max(right, maxX);
41
- minY = Math.min(top, minY);
42
- maxY = Math.max(bottom, maxY);
43
- }
44
- return { minX, maxX, minY, maxY, width: maxX - minX, height: maxY - minY };
45
- }
46
- var get_svg_path_bounds_default = getSVGPathBounds;
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- getSVGPathBounds
50
- });
51
- //# sourceMappingURL=get-svg-path-bounds.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/utils/get-svg-path-bounds.ts"],"sourcesContent":["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;AAAA,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,uBAAAA,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;","names":["svgPathBounds"]}
@@ -1,20 +0,0 @@
1
- declare type Point = {
2
- x: number;
3
- y: number;
4
- };
5
- declare function sub(p1: Point, p2: Point): {
6
- x: number;
7
- y: number;
8
- };
9
- declare function mult(p1: Point, p2: Point): {
10
- x: number;
11
- y: number;
12
- };
13
- declare function mag(p1: Point, p2: Point): number;
14
- declare function componentSum(p1: Point): number;
15
- declare function norm(p1: Point): {
16
- x: number;
17
- y: number;
18
- };
19
-
20
- export { Point, componentSum, mag, mult, norm, sub };
@@ -1,57 +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/lib/utils/point-math.ts
20
- var point_math_exports = {};
21
- __export(point_math_exports, {
22
- componentSum: () => componentSum,
23
- mag: () => mag,
24
- mult: () => mult,
25
- norm: () => norm,
26
- sub: () => sub
27
- });
28
- module.exports = __toCommonJS(point_math_exports);
29
- function sub(p1, p2) {
30
- return { x: p1.x - p2.x, y: p1.y - p2.y };
31
- }
32
- function mult(p1, p2) {
33
- return { x: p1.x * p2.x, y: p1.y * p2.y };
34
- }
35
- function mag(p1, p2) {
36
- const dx = p1.x - p2.x;
37
- const dy = p1.y - p2.y;
38
- return Math.sqrt(dx ** 2 + dy ** 2);
39
- }
40
- function componentSum(p1) {
41
- return p1.x + p1.y;
42
- }
43
- function norm(p1) {
44
- return {
45
- x: Math.sign(p1.x),
46
- y: Math.sign(p1.y)
47
- };
48
- }
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- componentSum,
52
- mag,
53
- mult,
54
- norm,
55
- sub
56
- });
57
- //# sourceMappingURL=point-math.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/utils/point-math.ts"],"sourcesContent":["export type Point = { x: number; y: number }\n\nexport function sub(p1: Point, p2: Point) {\n return { x: p1.x - p2.x, y: p1.y - p2.y }\n}\n\nexport function mult(p1: Point, p2: Point) {\n return { x: p1.x * p2.x, y: p1.y * p2.y }\n}\n\nexport function mag(p1: Point, p2: Point) {\n const dx = p1.x - p2.x\n const dy = p1.y - p2.y\n return Math.sqrt(dx ** 2 + dy ** 2)\n}\n\nexport function componentSum(p1: Point) {\n return p1.x + p1.y\n}\n\nexport function norm(p1: Point) {\n return {\n x: Math.sign(p1.x),\n y: Math.sign(p1.y),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,IAAI,IAAW,IAAW;AACxC,SAAO,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE;AAC1C;AAEO,SAAS,KAAK,IAAW,IAAW;AACzC,SAAO,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE;AAC1C;AAEO,SAAS,IAAI,IAAW,IAAW;AACxC,QAAM,KAAK,GAAG,IAAI,GAAG;AACrB,QAAM,KAAK,GAAG,IAAI,GAAG;AACrB,SAAO,KAAK,KAAK,MAAM,IAAI,MAAM,CAAC;AACpC;AAEO,SAAS,aAAa,IAAW;AACtC,SAAO,GAAG,IAAI,GAAG;AACnB;AAEO,SAAS,KAAK,IAAW;AAC9B,SAAO;AAAA,IACL,GAAG,KAAK,KAAK,GAAG,CAAC;AAAA,IACjB,GAAG,KAAK,KAAK,GAAG,CAAC;AAAA,EACnB;AACF;","names":[]}
@@ -1,5 +0,0 @@
1
- declare const App: ({ Component }: {
2
- Component: any;
3
- }) => JSX.Element;
4
-
5
- export { App, App as default };