@tscircuit/core 0.0.73 → 0.0.75

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 (58) hide show
  1. package/dist/index.js +9 -4
  2. package/package.json +3 -5
  3. package/index.ts +0 -1
  4. package/lib/Project.ts +0 -131
  5. package/lib/components/base-components/NormalComponent.ts +0 -419
  6. package/lib/components/base-components/PrimitiveComponent.ts +0 -478
  7. package/lib/components/base-components/Renderable.ts +0 -126
  8. package/lib/components/index.ts +0 -25
  9. package/lib/components/normal-components/Board.ts +0 -49
  10. package/lib/components/normal-components/Capacitor.ts +0 -70
  11. package/lib/components/normal-components/Chip.ts +0 -98
  12. package/lib/components/normal-components/Diode.ts +0 -27
  13. package/lib/components/normal-components/Jumper.ts +0 -101
  14. package/lib/components/normal-components/Led.ts +0 -27
  15. package/lib/components/normal-components/Resistor.ts +0 -59
  16. package/lib/components/primitive-components/Constraint.ts +0 -91
  17. package/lib/components/primitive-components/FabricationNotePath.ts +0 -50
  18. package/lib/components/primitive-components/FabricationNoteText.ts +0 -26
  19. package/lib/components/primitive-components/Footprint.ts +0 -239
  20. package/lib/components/primitive-components/Group.ts +0 -42
  21. package/lib/components/primitive-components/Hole.ts +0 -65
  22. package/lib/components/primitive-components/Keepout.ts +0 -58
  23. package/lib/components/primitive-components/Net.ts +0 -171
  24. package/lib/components/primitive-components/PlatedHole.ts +0 -116
  25. package/lib/components/primitive-components/Port.ts +0 -236
  26. package/lib/components/primitive-components/SilkscreenPath.ts +0 -48
  27. package/lib/components/primitive-components/SilkscreenText.ts +0 -25
  28. package/lib/components/primitive-components/SmtPad.ts +0 -162
  29. package/lib/components/primitive-components/Trace.ts +0 -635
  30. package/lib/components/primitive-components/TraceHint.ts +0 -71
  31. package/lib/fiber/catalogue.ts +0 -22
  32. package/lib/fiber/create-instance-from-react-element.ts +0 -179
  33. package/lib/fiber/intrinsic-jsx.ts +0 -48
  34. package/lib/index.ts +0 -5
  35. package/lib/register-catalogue.ts +0 -12
  36. package/lib/soup/underscorifyPinStyles.ts +0 -25
  37. package/lib/soup/underscorifyPortArrangement.ts +0 -51
  38. package/lib/utils/autorouting/SimpleRouteJson.ts +0 -48
  39. package/lib/utils/autorouting/computeObstacleBounds.ts +0 -10
  40. package/lib/utils/autorouting/findPossibleTraceLayerCombinations.ts +0 -102
  41. package/lib/utils/autorouting/mergeRoutes.ts +0 -71
  42. package/lib/utils/components/createNetsFromProps.ts +0 -15
  43. package/lib/utils/constants.ts +0 -35
  44. package/lib/utils/createComponentsFromSoup.ts +0 -79
  45. package/lib/utils/extend-aliases.ts +0 -12
  46. package/lib/utils/get-bounds-of-pcb-components.ts +0 -41
  47. package/lib/utils/get-relative-direction.ts +0 -14
  48. package/lib/utils/getClosest.ts +0 -35
  49. package/lib/utils/getPortFromHints.ts +0 -10
  50. package/lib/utils/pairs.ts +0 -10
  51. package/lib/utils/projectPointInDirection.ts +0 -18
  52. package/lib/utils/range.ts +0 -8
  53. package/lib/utils/schematic/getAllDimensionsForSchematicBox.ts +0 -330
  54. package/lib/utils/schematic/getSizeOfSidesFromPortArrangement.ts +0 -47
  55. package/lib/utils/selector-matching/index.ts +0 -2
  56. package/lib/utils/selector-matching/is-matching-path-selector.ts +0 -32
  57. package/lib/utils/selector-matching/is-matching-selector.ts +0 -64
  58. package/lib/utils/try-now.ts +0 -7
@@ -1,64 +0,0 @@
1
- import type { PrimitiveComponent } from "lib/components"
2
- import type { Primitive } from "schematic-symbols/drawing/types"
3
-
4
- /**
5
- * Determines if a component matches a given selector.
6
- *
7
- * This function supports the following selector types:
8
- * - ID selectors (#id)
9
- * - Class selectors (.className)
10
- * - Type selectors (resistor)
11
- * - Attribute selectors ([key='value'])
12
- *
13
- * It also supports combinations of these selectors.
14
- *
15
- * @param component - The component to check.
16
- * @param selector - The selector string to match against.
17
- * @returns True if the component matches the selector, false otherwise.
18
- */
19
- export function isMatchingSelector(
20
- component: PrimitiveComponent,
21
- selector: string,
22
- ): boolean {
23
- // Check for ID selector
24
- const idMatch = selector.match(/^#(\w+)/)
25
- if (idMatch) {
26
- return component.props.id === idMatch[1]
27
- }
28
-
29
- // Check for class selector
30
- const classMatch = selector.match(/^\.(\w+)/)
31
- if (classMatch) {
32
- return component.isMatchingNameOrAlias(classMatch[1])
33
- }
34
-
35
- // Split the selector into type and conditions
36
- let [type, ...conditions] = selector.split(/(?=[#.[])/)
37
-
38
- if (type === "pin") type = "port"
39
-
40
- // Check if the component type matches
41
- if (
42
- type &&
43
- type !== "*" &&
44
- component.lowercaseComponentName !== type.toLowerCase()
45
- ) {
46
- return false
47
- }
48
-
49
- // Check all conditions
50
- return conditions.every((condition) => {
51
- if (condition.startsWith("#")) {
52
- return component.props.id === condition.slice(1)
53
- }
54
- if (condition.startsWith(".")) {
55
- return component.isMatchingNameOrAlias(condition.slice(1))
56
- }
57
-
58
- // Check for attribute selector
59
- const match = condition.match(/\[(\w+)=['"]?(.+?)['"]?\]/)
60
- if (!match) return true
61
- const [, prop, value] = match
62
- return component.props[prop].toString() === value
63
- })
64
- }
@@ -1,7 +0,0 @@
1
- export function tryNow<T>(fn: () => T): [T, null] | [null, Error] {
2
- try {
3
- return [fn(), null]
4
- } catch (e: any) {
5
- return [null, e]
6
- }
7
- }