@tscircuit/schematic-viewer 1.4.2 → 2.0.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/README.md +16 -26
- package/biome.json +8 -1
- package/bun.lockb +0 -0
- package/cosmos.config.json +3 -0
- package/cosmos.decorator.tsx +3 -0
- package/dist/index.d.ts +6 -11
- package/dist/index.js +54 -2485
- package/dist/index.js.map +1 -1
- package/examples/resistor-and-capacitor.fixture.tsx +14 -0
- package/index.html +12 -0
- package/lib/components/SchematicViewer.tsx +78 -0
- package/lib/dev/render-to-circuit-json.ts +8 -0
- package/lib/index.ts +1 -0
- package/package.json +27 -74
- package/src/main.tsx +20 -0
- package/test.ts +0 -0
- package/tsconfig.json +28 -25
- package/vite.config.js +12 -4
- package/.codesandbox/tasks.json +0 -36
- package/.github/workflows/chromatic.yml +0 -30
- package/.github/workflows/npm-build.yml +0 -26
- package/.github/workflows/npm-typecheck.yml +0 -26
- package/.github/workflows/release.yml +0 -29
- package/.prettierrc +0 -1
- package/.storybook/main.ts +0 -12
- package/.storybook/preview.ts +0 -17
- package/ava.config.js +0 -7
- package/dist/index.css +0 -7
- package/dist/index.css.map +0 -1
- package/next-env.d.ts +0 -5
- package/parsel.d.ts +0 -81
- package/release.config.js +0 -15
- package/renovate.json +0 -17
- package/src/Schematic.tsx +0 -246
- package/src/index.ts +0 -1
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/use-maybe-promise.ts +0 -14
- package/src/lib/render-context/index.ts +0 -28
- package/src/lib/types/core.ts +0 -181
- package/src/lib/types/index.ts +0 -4
- package/src/lib/types/route-solver.ts +0 -10
- package/src/lib/types/source-component.ts +0 -73
- package/src/lib/types/util.ts +0 -52
- package/src/lib/utils/collect-element-refs.ts +0 -45
- package/src/lib/utils/colors.ts +0 -235
- package/src/lib/utils/direction-to-vec.ts +0 -50
- package/src/lib/utils/get-rotation-from-anchor-side.ts +0 -11
- package/src/lib/utils/get-svg-path-bounds.ts +0 -22
- package/src/lib/utils/get-vec-from-anchor-side.ts +0 -11
- package/src/lib/utils/point-math.ts +0 -26
- package/src/pages/_app.tsx +0 -23
- package/src/pages/index.tsx +0 -10
- package/src/pages/led-circuit-react.tsx +0 -54
- package/src/pages/style.css +0 -5
- package/src/schematic-components/ContextProviders.tsx +0 -15
- package/src/schematic-components/DebugPoint.tsx +0 -25
- package/src/schematic-components/RenderError.tsx +0 -23
- package/src/schematic-components/SVGPathComponent.tsx +0 -183
- package/src/schematic-components/SVGPathComponent2.tsx +0 -76
- package/src/schematic-components/SchematicChip.tsx +0 -202
- package/src/schematic-components/SchematicComponent.tsx +0 -51
- package/src/schematic-components/SchematicComponentFromSymbol.tsx +0 -46
- package/src/schematic-components/SchematicElement.tsx +0 -43
- package/src/schematic-components/SchematicGroup.tsx +0 -3
- package/src/schematic-components/SchematicNetLabel.tsx +0 -63
- package/src/schematic-components/SchematicText.tsx +0 -44
- package/src/schematic-components/SchematicTrace.tsx +0 -51
- package/src/schematic-components/TableViewer.tsx +0 -13
- package/src/schematic-components/index.tsx +0 -9
- package/src/stories/basics/schematic-net-label.stories.tsx +0 -138
- package/src/stories/basics/schematic-net-labels-2.stories.tsx +0 -35
- package/src/stories/bug-connections.stories.tsx +0 -31
- package/src/stories/bug-high-port-numbers.stories.tsx +0 -130
- package/src/stories/bug-one-sided.stories.tsx +0 -34
- package/src/stories/bug-pin-spacing.stories.tsx +0 -52
- package/src/stories/bugs/bug1-y-flip.stories.tsx +0 -20
- package/src/stories/bugs/bug2-component-bounds.stories.tsx +0 -62
- package/src/stories/bugs/bug3-scaling-trace.stories.tsx +0 -24
- package/src/stories/bugs/bug4-schematic-line.stories.tsx +0 -17
- package/src/stories/bugs/bug5-diode.stories.tsx +0 -16
- package/src/stories/bugs/bug6-trace-scaling.stories.tsx +0 -18
- package/src/stories/bugs/bug7-multiple-schematic-panning.stories.tsx +0 -23
- package/src/stories/bugs/bug8-autolayout.stories.tsx +0 -43
- package/src/stories/circuit-components/diode.stories.tsx +0 -16
- package/src/stories/circuit-components/netalias.stories.tsx +0 -14
- package/src/stories/circuit-components/resistor.stories.tsx +0 -16
- package/src/stories/component-drawing-example.stories.tsx +0 -17
- package/src/stories/led-circuit-react.stories.tsx +0 -48
- package/src/stories/net-alias.stories.tsx +0 -92
- package/src/stories/off-center-render.stories.tsx +0 -29
- package/src/stories/rotated-resistor.stories.tsx +0 -23
- package/src/stories/schematic-path.stories.tsx +0 -40
- package/src/stories/three-sided-bug.stories.tsx +0 -30
- package/tsconfig.tsbuildinfo +0 -1
- package/tsup.config.ts +0 -8
- package/vercel.json +0 -3
package/package.json
CHANGED
|
@@ -1,83 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/schematic-viewer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/tscircuit/schematic-viewer.git"
|
|
9
|
-
},
|
|
5
|
+
"type": "module",
|
|
10
6
|
"scripts": {
|
|
11
|
-
"start": "
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"build": "tsup",
|
|
15
|
-
"yalc": "npm run build && yalc push",
|
|
16
|
-
"storybook": "storybook dev -p 6006",
|
|
17
|
-
"build-storybook": "storybook build",
|
|
18
|
-
"chromatic": "npx chromatic --project-token=chpt_d88a6beb0734bbe"
|
|
19
|
-
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"@tscircuit/table-viewer": "*",
|
|
22
|
-
"react": "*"
|
|
7
|
+
"start": "cosmos",
|
|
8
|
+
"build": "tsup-node ./lib/index.ts --dts --format esm --sourcemap",
|
|
9
|
+
"build:site": "cosmos-export"
|
|
23
10
|
},
|
|
24
11
|
"devDependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"@tscircuit/table-viewer": "^0.0.6",
|
|
40
|
-
"@types/node": "^18.6.0",
|
|
41
|
-
"@types/react": "^18.0.15",
|
|
42
|
-
"@vitejs/plugin-react": "^4.3.0",
|
|
43
|
-
"ava": "^4.3.1",
|
|
44
|
-
"chromatic": "^11.5.5",
|
|
45
|
-
"circuit-json": "^0.0.92",
|
|
46
|
-
"esbuild": "^0.20.2",
|
|
47
|
-
"esbuild-register": "^3.5.0",
|
|
48
|
-
"next": "^14.2.3",
|
|
49
|
-
"parse-svg-path": "^0.1.2",
|
|
50
|
-
"react": "^18.2.0",
|
|
51
|
-
"react-dom": "^18.2.0",
|
|
52
|
-
"react-use-measure": "^2.1.1",
|
|
53
|
-
"semantic-release": "^21.0.6",
|
|
54
|
-
"storybook": "^8.1.3",
|
|
55
|
-
"svg-path-bounds": "^1.0.2",
|
|
56
|
-
"svg-path-generator": "^1.1.0",
|
|
57
|
-
"transformation-matrix": "^2.12.0",
|
|
58
|
-
"tsup": "^6.7.0",
|
|
59
|
-
"type-fest": "^2.17.0",
|
|
60
|
-
"typescript": "^5.5.3",
|
|
61
|
-
"vite": "^5.2.11",
|
|
62
|
-
"vite-tsconfig-paths": "^4.3.2",
|
|
63
|
-
"zod": "^3.23.8",
|
|
64
|
-
"zustand": "^4.0.0"
|
|
12
|
+
"@biomejs/biome": "^1.9.4",
|
|
13
|
+
"@tscircuit/core": "^0.0.222",
|
|
14
|
+
"@types/bun": "latest",
|
|
15
|
+
"@types/react": "^19.0.1",
|
|
16
|
+
"@types/react-dom": "^19.0.2",
|
|
17
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
18
|
+
"circuit-json": "^0.0.111",
|
|
19
|
+
"react": "18",
|
|
20
|
+
"react-cosmos": "^6.2.1",
|
|
21
|
+
"react-cosmos-plugin-vite": "^6.2.0",
|
|
22
|
+
"react-dom": "18",
|
|
23
|
+
"tsup": "^8.3.5",
|
|
24
|
+
"vite": "^6.0.3",
|
|
25
|
+
"react-reconciler": "^0.31.0"
|
|
65
26
|
},
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"@tscircuit/core": "^0.0.132",
|
|
69
|
-
"@tscircuit/layout": "^0.0.25",
|
|
70
|
-
"@tscircuit/props": "^0.0.23",
|
|
71
|
-
"@tscircuit/soup-util": "^0.0.38",
|
|
72
|
-
"circuit-to-svg": "^0.0.54",
|
|
73
|
-
"convert-units": "^2.3.4",
|
|
74
|
-
"react-error-boundary": "^4.0.4",
|
|
75
|
-
"react-supergrid": "^1.0.10",
|
|
76
|
-
"schematic-symbols": "^0.0.78",
|
|
77
|
-
"use-mouse-matrix-transform": "^1.1.12"
|
|
78
|
-
},
|
|
79
|
-
"bugs": {
|
|
80
|
-
"url": "https://github.com/tscircuit/schematic-viewer/issues"
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"typescript": "^5.0.0"
|
|
81
29
|
},
|
|
82
|
-
"
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"circuit-to-svg": "^0.0.90",
|
|
32
|
+
"debug": "^4.4.0",
|
|
33
|
+
"performance-now": "^2.1.0",
|
|
34
|
+
"use-mouse-matrix-transform": "^1.1.13"
|
|
35
|
+
}
|
|
83
36
|
}
|
package/src/main.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { createRoot } from "react-dom/client"
|
|
3
|
+
import { renderToCircuitJson } from "lib/dev/render-to-circuit-json"
|
|
4
|
+
import { SchematicViewer } from "lib/components/SchematicViewer"
|
|
5
|
+
|
|
6
|
+
const root = createRoot(document.getElementById("root")!)
|
|
7
|
+
|
|
8
|
+
root.render(
|
|
9
|
+
<React.StrictMode>
|
|
10
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
11
|
+
<SchematicViewer
|
|
12
|
+
circuitJson={renderToCircuitJson(
|
|
13
|
+
<board width="10mm" height="10mm">
|
|
14
|
+
<resistor name="R1" resistance={1000} />
|
|
15
|
+
</board>,
|
|
16
|
+
)}
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</React.StrictMode>,
|
|
20
|
+
)
|
package/test.ts
ADDED
|
File without changes
|
package/tsconfig.json
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
|
|
4
|
-
"lib": [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
// Enable latest features
|
|
4
|
+
"lib": ["ESNext", "DOM"],
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
9
|
"allowJs": true,
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
10
|
+
|
|
11
|
+
"baseUrl": ".",
|
|
12
|
+
"paths": {
|
|
13
|
+
"lib/*": ["lib/*"]
|
|
14
|
+
},
|
|
14
15
|
"esModuleInterop": true,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
16
|
+
|
|
17
|
+
// Bundler mode
|
|
18
|
+
"moduleResolution": "bundler",
|
|
19
|
+
"allowImportingTsExtensions": true,
|
|
20
|
+
"verbatimModuleSyntax": true,
|
|
21
|
+
"noEmit": true,
|
|
22
|
+
|
|
23
|
+
// Best practices
|
|
24
|
+
"strict": true,
|
|
25
|
+
"skipLibCheck": true,
|
|
26
|
+
"noFallthroughCasesInSwitch": true,
|
|
27
|
+
|
|
28
|
+
// Some stricter flags (disabled by default)
|
|
29
|
+
"noUnusedLocals": false,
|
|
30
|
+
"noUnusedParameters": false,
|
|
31
|
+
"noPropertyAccessFromIndexSignature": false
|
|
32
|
+
}
|
|
30
33
|
}
|
package/vite.config.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { defineConfig } from "vite"
|
|
2
2
|
import react from "@vitejs/plugin-react"
|
|
3
|
-
import
|
|
3
|
+
import { resolve } from "node:path"
|
|
4
4
|
|
|
5
|
-
export default {
|
|
6
|
-
plugins: [react(),
|
|
7
|
-
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [react()],
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
lib: resolve(__dirname, "./lib"),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
define: {
|
|
13
|
+
global: {},
|
|
14
|
+
},
|
|
15
|
+
})
|
package/.codesandbox/tasks.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// These tasks will run in order when initializing your CodeSandbox project.
|
|
3
|
-
"setupTasks": [
|
|
4
|
-
{
|
|
5
|
-
"name": "Install Dependencies",
|
|
6
|
-
"command": "npm install"
|
|
7
|
-
}
|
|
8
|
-
],
|
|
9
|
-
|
|
10
|
-
// These tasks can be run from CodeSandbox. Running one will open a log in the app.
|
|
11
|
-
"tasks": {
|
|
12
|
-
"start": {
|
|
13
|
-
"name": "start",
|
|
14
|
-
"command": "npm run start",
|
|
15
|
-
"runAtStart": true,
|
|
16
|
-
"preview": {
|
|
17
|
-
"port": 6006
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"typecheck": {
|
|
21
|
-
"name": "typecheck",
|
|
22
|
-
"command": "npm run typecheck",
|
|
23
|
-
"runAtStart": false
|
|
24
|
-
},
|
|
25
|
-
"build": {
|
|
26
|
-
"name": "build",
|
|
27
|
-
"command": "npm run build",
|
|
28
|
-
"runAtStart": false
|
|
29
|
-
},
|
|
30
|
-
"storybook": {
|
|
31
|
-
"name": "storybook",
|
|
32
|
-
"command": "npm run storybook",
|
|
33
|
-
"runAtStart": false
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: "Chromatic"
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
chromatic:
|
|
13
|
-
name: Run Chromatic
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
steps:
|
|
16
|
-
- name: Checkout code
|
|
17
|
-
uses: actions/checkout@v4
|
|
18
|
-
with:
|
|
19
|
-
fetch-depth: 0
|
|
20
|
-
- uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: 20
|
|
23
|
-
- name: Install dependencies
|
|
24
|
-
# ⚠️ See your package manager's documentation for the correct command to install dependencies in a CI environment.
|
|
25
|
-
run: npm ci
|
|
26
|
-
- name: Run Chromatic
|
|
27
|
-
uses: chromaui/action@latest
|
|
28
|
-
with:
|
|
29
|
-
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
|
|
30
|
-
projectToken: chpt_d88a6beb0734bbe
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
-
name: Build
|
|
3
|
-
|
|
4
|
-
on:
|
|
5
|
-
push:
|
|
6
|
-
branches: [main]
|
|
7
|
-
pull_request:
|
|
8
|
-
branches: [main]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v3
|
|
16
|
-
|
|
17
|
-
- name: Use Node.js
|
|
18
|
-
uses: actions/setup-node@v3
|
|
19
|
-
with:
|
|
20
|
-
node-version: "20"
|
|
21
|
-
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: npm ci
|
|
24
|
-
|
|
25
|
-
- name: Run build
|
|
26
|
-
run: npm run build
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
-
name: Type Check
|
|
3
|
-
|
|
4
|
-
on:
|
|
5
|
-
push:
|
|
6
|
-
branches: [main]
|
|
7
|
-
pull_request:
|
|
8
|
-
branches: [main]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
type-check:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v3
|
|
16
|
-
|
|
17
|
-
- name: Use Node.js
|
|
18
|
-
uses: actions/setup-node@v3
|
|
19
|
-
with:
|
|
20
|
-
node-version: "20"
|
|
21
|
-
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: npm ci
|
|
24
|
-
|
|
25
|
-
- name: Run typecheck
|
|
26
|
-
run: npx tsc --noEmit
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- name: Checkout code
|
|
13
|
-
uses: actions/checkout@v3
|
|
14
|
-
|
|
15
|
-
- name: Setup Node.js
|
|
16
|
-
uses: actions/setup-node@v2
|
|
17
|
-
with:
|
|
18
|
-
node-version: 18
|
|
19
|
-
|
|
20
|
-
- name: Install dependencies
|
|
21
|
-
run: npm install
|
|
22
|
-
- name: Build
|
|
23
|
-
run: npm run build
|
|
24
|
-
|
|
25
|
-
- name: Semantic Release
|
|
26
|
-
env:
|
|
27
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
29
|
-
run: npx semantic-release
|
package/.prettierrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "semi": false }
|
package/.storybook/main.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { StorybookConfig } from "@storybook/react-vite"
|
|
2
|
-
|
|
3
|
-
const config: StorybookConfig = {
|
|
4
|
-
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
5
|
-
addons: [],
|
|
6
|
-
framework: {
|
|
7
|
-
name: "@storybook/react-vite",
|
|
8
|
-
options: {},
|
|
9
|
-
},
|
|
10
|
-
docs: {},
|
|
11
|
-
}
|
|
12
|
-
export default config
|
package/.storybook/preview.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Preview } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import "react-data-grid/lib/styles.css"
|
|
4
|
-
|
|
5
|
-
const preview: Preview = {
|
|
6
|
-
parameters: {
|
|
7
|
-
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
8
|
-
controls: {
|
|
9
|
-
matchers: {
|
|
10
|
-
color: /(background|color)$/i,
|
|
11
|
-
date: /Date$/,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default preview
|
package/ava.config.js
DELETED
package/dist/index.css
DELETED
package/dist/index.css.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/pages/style.css"],"sourcesContent":["@import url(\"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono&display=swap\");\n\n.schematic-text {\n font-family: \"IBM Plex Mono\", monospace;\n}\n"],"mappings":";;;AAEA;AACE;AAAA;","names":[]}
|
package/next-env.d.ts
DELETED
package/parsel.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
declare module "parsel-js" {
|
|
2
|
-
export interface Tokens {
|
|
3
|
-
type:
|
|
4
|
-
| "class"
|
|
5
|
-
| "attribute"
|
|
6
|
-
| "id"
|
|
7
|
-
| "type"
|
|
8
|
-
| "pseudo-element"
|
|
9
|
-
| "pseudo-class"
|
|
10
|
-
| "comma"
|
|
11
|
-
| "combinator"
|
|
12
|
-
content: string
|
|
13
|
-
name: string
|
|
14
|
-
namespace?: string
|
|
15
|
-
value?: string
|
|
16
|
-
pos: [number, number]
|
|
17
|
-
operator?: string
|
|
18
|
-
argument?: string
|
|
19
|
-
subtree?: AST
|
|
20
|
-
caseSensitive?: "i"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface Complex {
|
|
24
|
-
type: "complex"
|
|
25
|
-
combinator: string
|
|
26
|
-
right: AST
|
|
27
|
-
left: AST
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface Compound {
|
|
31
|
-
type: "compound"
|
|
32
|
-
list: Tokens[]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface List {
|
|
36
|
-
type: "list"
|
|
37
|
-
list: AST[]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface ParserOptions {
|
|
41
|
-
recursive?: boolean
|
|
42
|
-
list?: boolean
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface SpecificityOptions {
|
|
46
|
-
format?: string
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export type AST = Complex | Compound | List | Tokens
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Get AST:
|
|
53
|
-
*/
|
|
54
|
-
export function parse(selector: string, options?: ParserOptions): AST
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Get list of tokens as a flat array:
|
|
58
|
-
*/
|
|
59
|
-
export function tokenize(selector: string): Tokens[]
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Traverse all tokens of a (sub)tree:
|
|
63
|
-
*/
|
|
64
|
-
export function walk(node: AST, cb: (node: AST, parentNode: AST) => {}): void
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Calculate specificity (returns an array of 3 numbers):
|
|
68
|
-
*/
|
|
69
|
-
export function specificity(
|
|
70
|
-
selector: string | AST,
|
|
71
|
-
options?: SpecificityOptions
|
|
72
|
-
): number[]
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* To convert the specificity array to a number
|
|
76
|
-
*/
|
|
77
|
-
export function specificityToNumber(
|
|
78
|
-
specificity: number[],
|
|
79
|
-
base?: number
|
|
80
|
-
): number
|
|
81
|
-
}
|
package/release.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
branches: ["main"], // change this to your default branch if not `main`
|
|
3
|
-
plugins: [
|
|
4
|
-
"@semantic-release/commit-analyzer",
|
|
5
|
-
"@semantic-release/release-notes-generator",
|
|
6
|
-
["@semantic-release/npm", { npmPublish: true }],
|
|
7
|
-
[
|
|
8
|
-
"@semantic-release/git",
|
|
9
|
-
{
|
|
10
|
-
assets: ["package.json"],
|
|
11
|
-
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
],
|
|
15
|
-
}
|
package/renovate.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"extends": [
|
|
4
|
-
"config:base"
|
|
5
|
-
],
|
|
6
|
-
"packageRules": [
|
|
7
|
-
{
|
|
8
|
-
"packagePatterns": ["*"],
|
|
9
|
-
"excludePackagePatterns": ["@tscircuit/*"],
|
|
10
|
-
"enabled": false
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"matchUpdateTypes": ["major", "minor", "patch"],
|
|
14
|
-
"automerge": true
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
}
|