@tscircuit/schematic-viewer 2.0.42 → 2.0.44
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/.github/workflows/bun-pver-release.yml +20 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +411 -40
- package/dist/index.js.map +1 -1
- package/examples/example14-schematic-component-click.fixture.tsx +46 -0
- package/lib/components/ControlledSchematicViewer.tsx +6 -0
- package/lib/components/MouseTracker.tsx +227 -0
- package/lib/components/SchematicComponentMouseTarget.tsx +182 -0
- package/lib/components/SchematicViewer.tsx +162 -122
- package/lib/hooks/useMouseEventsOverBoundingBox.ts +74 -0
- package/lib/index.ts +2 -0
- package/lib/utils/z-index-map.ts +1 -0
- package/package.json +1 -1
|
@@ -4,13 +4,21 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
UPSTREAM_REPO: "runframe" # for example: "eval"
|
|
11
|
+
PACKAGE_NAMES: "@tscircuit/schematic-viewer" # comma-separated list, e.g. "@tscircuit/core,@tscircuit/props"
|
|
12
|
+
|
|
7
13
|
jobs:
|
|
8
14
|
publish:
|
|
9
15
|
runs-on: ubuntu-latest
|
|
10
16
|
steps:
|
|
11
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
12
20
|
- name: Setup bun
|
|
13
|
-
uses: oven-sh/setup-bun@
|
|
21
|
+
uses: oven-sh/setup-bun@v2
|
|
14
22
|
with:
|
|
15
23
|
bun-version: latest
|
|
16
24
|
- uses: actions/setup-node@v3
|
|
@@ -23,3 +31,13 @@ jobs:
|
|
|
23
31
|
- run: pver release
|
|
24
32
|
env:
|
|
25
33
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
34
|
+
GITHUB_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
35
|
+
- name: Trigger upstream repo update
|
|
36
|
+
if: env.UPSTREAM_REPO && env.PACKAGE_NAMES
|
|
37
|
+
run: |
|
|
38
|
+
curl -X POST \
|
|
39
|
+
-H "Accept: application/vnd.github.v3+json" \
|
|
40
|
+
-H "Authorization: token ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}" \
|
|
41
|
+
-H "Content-Type: application/json" \
|
|
42
|
+
"https://api.github.com/repos/tscircuit/${{ env.UPSTREAM_REPO }}/actions/workflows/update-package.yml/dispatches" \
|
|
43
|
+
-d "{\"ref\":\"main\",\"inputs\":{\"package_names\":\"${{ env.PACKAGE_NAMES }}\"}}"
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ColorOverrides } from 'circuit-to-svg';
|
|
3
3
|
import { ManualEditEvent } from '@tscircuit/props';
|
|
4
4
|
import { CircuitJson } from 'circuit-json';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
circuitJson: CircuitJson;
|
|
@@ -16,7 +17,29 @@ interface Props {
|
|
|
16
17
|
colorOverrides?: ColorOverrides;
|
|
17
18
|
spiceSimulationEnabled?: boolean;
|
|
18
19
|
disableGroups?: boolean;
|
|
20
|
+
onSchematicComponentClicked?: (options: {
|
|
21
|
+
schematicComponentId: string;
|
|
22
|
+
event: MouseEvent;
|
|
23
|
+
}) => void;
|
|
19
24
|
}
|
|
20
|
-
declare const SchematicViewer: ({ circuitJson, containerStyle, editEvents: unappliedEditEvents, onEditEvent, defaultEditMode, debugGrid, editingEnabled, debug, clickToInteractEnabled, colorOverrides, spiceSimulationEnabled, disableGroups, }: Props) => react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare const SchematicViewer: ({ circuitJson, containerStyle, editEvents: unappliedEditEvents, onEditEvent, defaultEditMode, debugGrid, editingEnabled, debug, clickToInteractEnabled, colorOverrides, spiceSimulationEnabled, disableGroups, onSchematicComponentClicked, }: Props) => react_jsx_runtime.JSX.Element;
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
interface BoundingBoxBounds {
|
|
28
|
+
minX: number;
|
|
29
|
+
maxX: number;
|
|
30
|
+
minY: number;
|
|
31
|
+
maxY: number;
|
|
32
|
+
}
|
|
33
|
+
declare const MouseTracker: ({ children }: {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
interface UseMouseEventsOverBoundingBoxOptions {
|
|
38
|
+
bounds: BoundingBoxBounds | null;
|
|
39
|
+
onClick?: (event: MouseEvent) => void;
|
|
40
|
+
}
|
|
41
|
+
declare const useMouseEventsOverBoundingBox: (options: UseMouseEventsOverBoundingBoxOptions) => {
|
|
42
|
+
hovering: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { MouseTracker, SchematicViewer, useMouseEventsOverBoundingBox };
|