@skillpet/circuit 0.6.3 → 0.6.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/README.de.md +150 -0
- package/README.es.md +150 -0
- package/README.fr.md +150 -0
- package/README.ja.md +150 -0
- package/README.ko.md +150 -0
- package/README.md +26 -1
- package/README.zh-CN.md +150 -0
- package/dist/circuit.bundle.js +3 -4
- package/dist/circuit.bundle.min.js +5 -5
- package/dist/circuit.esm.js +3 -4
- package/dist/index.cjs +3 -4
- package/package.json +1 -1
package/README.de.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @skillpet/circuit
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Español](./README.es.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md)
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Schaltplan-Bibliothek — elektrische Schaltpläne aus JSON rendern, mit interaktivem SVG, Themes und Vue / React-Komponenten.</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@skillpet/circuit"><img src="https://img.shields.io/npm/v/@skillpet/circuit.svg" alt="npm version"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@skillpet/circuit"><img src="https://img.shields.io/npm/l/@skillpet/circuit.svg" alt="license"></a>
|
|
12
|
+
<a href="https://circuit.skill.pet"><img src="https://img.shields.io/badge/docs-circuit.skill.pet-blue" alt="docs"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Website & Demos:** [circuit.skill.pet](https://circuit.skill.pet)
|
|
18
|
+
|
|
19
|
+
## Funktionen
|
|
20
|
+
|
|
21
|
+
- Schaltpläne aus einer einfachen JSON-Beschreibung rendern
|
|
22
|
+
- Über 200 integrierte elektrische Bauteile (Widerstände, Kondensatoren, Dioden, Transistoren, ICs, Logikgatter usw.)
|
|
23
|
+
- Interaktives SVG: Hover-Hervorhebung, Tooltips, Klick-Events
|
|
24
|
+
- 3 integrierte Themes (Hell, Dunkel, Druck) + benutzerdefinierte Themes
|
|
25
|
+
- Sanfte Farbübergänge zwischen Elementen
|
|
26
|
+
- Vue 3 & React-Komponenten sofort einsatzbereit
|
|
27
|
+
- Browser-Bundle (Script-Tag) & ESM / CJS-Unterstützung
|
|
28
|
+
- KaTeX-Mathematik-Label-Rendering
|
|
29
|
+
- Flussdiagramme, DSP-Blöcke, Breadboard-Bauteile
|
|
30
|
+
- Keine Laufzeit-Abhängigkeiten (KaTeX ist optional)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @skillpet/circuit
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Schnellstart
|
|
39
|
+
|
|
40
|
+
### ESM / TypeScript
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { renderFromJson } from "@skillpet/circuit";
|
|
44
|
+
|
|
45
|
+
const svg = renderFromJson({
|
|
46
|
+
elements: [
|
|
47
|
+
{ type: "SourceV", d: "up", label: "12V" },
|
|
48
|
+
{ type: "ResistorIEEE", label: "R1 10kΩ" },
|
|
49
|
+
{ type: "Capacitor", d: "down", label: "C1 100nF" },
|
|
50
|
+
{ type: "Line", d: "left" },
|
|
51
|
+
{ type: "Ground" },
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Browser (Script-Tag)
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<script src="https://unpkg.com/@skillpet/circuit/dist/circuit.bundle.min.js"></script>
|
|
60
|
+
<script>
|
|
61
|
+
const svg = Circuit.renderFromJson({
|
|
62
|
+
elements: [
|
|
63
|
+
{ type: "ResistorIEEE", label: "R1" },
|
|
64
|
+
{ type: "Capacitor", d: "down", label: "C1" },
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
document.getElementById("output").innerHTML = svg;
|
|
68
|
+
</script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Interaktiver Modus
|
|
72
|
+
|
|
73
|
+
In das DOM einbinden mit Hover-Hervorhebung, Tooltips und Klick-Events:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { mountFromJson } from "@skillpet/circuit";
|
|
77
|
+
|
|
78
|
+
const ctrl = mountFromJson(document.getElementById("container"), {
|
|
79
|
+
elements: [
|
|
80
|
+
{ type: "ResistorIEEE", id: "R1", tooltip: "100kΩ Kohleschichtwiderstand" },
|
|
81
|
+
{ type: "Capacitor", d: "down", id: "C1", tooltip: "0.1μF Keramik" },
|
|
82
|
+
],
|
|
83
|
+
}, { interactive: true });
|
|
84
|
+
|
|
85
|
+
ctrl.on("element:click", (info) => console.log("Klick:", info.id));
|
|
86
|
+
ctrl.on("element:hover", (info) => console.log("Hover:", info.tooltip));
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Vue 3
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<script setup>
|
|
93
|
+
import { CircuitDiagram } from "@skillpet/circuit/vue";
|
|
94
|
+
|
|
95
|
+
const circuit = {
|
|
96
|
+
elements: [
|
|
97
|
+
{ type: "ResistorIEEE", label: "R1", id: "R1", tooltip: "100kΩ" },
|
|
98
|
+
{ type: "Capacitor", d: "down", label: "C1" },
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<CircuitDiagram :circuit="circuit" interactive @element-click="console.log" />
|
|
105
|
+
</template>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### React
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { CircuitDiagram } from "@skillpet/circuit/react";
|
|
112
|
+
|
|
113
|
+
function App() {
|
|
114
|
+
return (
|
|
115
|
+
<CircuitDiagram
|
|
116
|
+
circuit={{ elements: [{ type: "ResistorIEEE", label: "R1" }] }}
|
|
117
|
+
interactive
|
|
118
|
+
onElementClick={(info) => console.log(info)}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Themes
|
|
125
|
+
|
|
126
|
+
Drei integrierte Themes: `light` (Standard), `dark` und `print`.
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const svg = renderFromJson(circuit, { theme: "dark" });
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Farbübergänge
|
|
133
|
+
|
|
134
|
+
Sanfte Gradientenübergänge zwischen unterschiedlich gefärbten Elementen:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const svg = renderFromJson({
|
|
138
|
+
drawing: { colorTransition: true },
|
|
139
|
+
elements: [
|
|
140
|
+
{ type: "SourceV", d: "up", color: "#2ecc71" },
|
|
141
|
+
{ type: "ResistorIEEE", color: "#e74c3c" },
|
|
142
|
+
],
|
|
143
|
+
}, { colorTransition: true });
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Lizenz
|
|
147
|
+
|
|
148
|
+
Kostenlos für den persönlichen und Bildungsgebrauch. Für die kommerzielle Nutzung ist eine separate Lizenz erforderlich.
|
|
149
|
+
Die vollständigen Bedingungen finden Sie in der LICENSE-Datei dieses Pakets.
|
|
150
|
+
Für kommerzielle Lizenzen kontaktieren Sie **license@skill.pet** oder besuchen Sie [circuit.skill.pet/license](https://circuit.skill.pet/license).
|
package/README.es.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @skillpet/circuit
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Español](./README.es.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md)
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Biblioteca de diagramas de circuitos — renderiza esquemas eléctricos desde JSON, con SVG interactivo, temas y componentes Vue / React.</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@skillpet/circuit"><img src="https://img.shields.io/npm/v/@skillpet/circuit.svg" alt="npm version"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@skillpet/circuit"><img src="https://img.shields.io/npm/l/@skillpet/circuit.svg" alt="license"></a>
|
|
12
|
+
<a href="https://circuit.skill.pet"><img src="https://img.shields.io/badge/docs-circuit.skill.pet-blue" alt="docs"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Sitio web y demos:** [circuit.skill.pet](https://circuit.skill.pet)
|
|
18
|
+
|
|
19
|
+
## Características
|
|
20
|
+
|
|
21
|
+
- Renderiza diagramas de circuitos desde una descripción JSON simple
|
|
22
|
+
- Más de 200 componentes eléctricos integrados (resistencias, condensadores, diodos, transistores, circuitos integrados, puertas lógicas, etc.)
|
|
23
|
+
- SVG interactivo: resaltado al pasar el ratón, tooltips, eventos de clic
|
|
24
|
+
- 3 temas integrados (claro, oscuro, impresión) + temas personalizados
|
|
25
|
+
- Transiciones de color suaves entre elementos
|
|
26
|
+
- Componentes Vue 3 y React listos para usar
|
|
27
|
+
- Bundle para navegador (etiqueta script) y soporte ESM / CJS
|
|
28
|
+
- Renderizado de etiquetas matemáticas con KaTeX
|
|
29
|
+
- Diagramas de flujo, bloques DSP, componentes de protoboard
|
|
30
|
+
- Sin dependencias en tiempo de ejecución (KaTeX es opcional)
|
|
31
|
+
|
|
32
|
+
## Instalación
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @skillpet/circuit
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Inicio rápido
|
|
39
|
+
|
|
40
|
+
### ESM / TypeScript
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { renderFromJson } from "@skillpet/circuit";
|
|
44
|
+
|
|
45
|
+
const svg = renderFromJson({
|
|
46
|
+
elements: [
|
|
47
|
+
{ type: "SourceV", d: "up", label: "12V" },
|
|
48
|
+
{ type: "ResistorIEEE", label: "R1 10kΩ" },
|
|
49
|
+
{ type: "Capacitor", d: "down", label: "C1 100nF" },
|
|
50
|
+
{ type: "Line", d: "left" },
|
|
51
|
+
{ type: "Ground" },
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Navegador (etiqueta Script)
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<script src="https://unpkg.com/@skillpet/circuit/dist/circuit.bundle.min.js"></script>
|
|
60
|
+
<script>
|
|
61
|
+
const svg = Circuit.renderFromJson({
|
|
62
|
+
elements: [
|
|
63
|
+
{ type: "ResistorIEEE", label: "R1" },
|
|
64
|
+
{ type: "Capacitor", d: "down", label: "C1" },
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
document.getElementById("output").innerHTML = svg;
|
|
68
|
+
</script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Modo interactivo
|
|
72
|
+
|
|
73
|
+
Monta en el DOM con resaltado al pasar el ratón, tooltips y eventos de clic:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { mountFromJson } from "@skillpet/circuit";
|
|
77
|
+
|
|
78
|
+
const ctrl = mountFromJson(document.getElementById("container"), {
|
|
79
|
+
elements: [
|
|
80
|
+
{ type: "ResistorIEEE", id: "R1", tooltip: "100kΩ Película de carbón" },
|
|
81
|
+
{ type: "Capacitor", d: "down", id: "C1", tooltip: "0.1μF Cerámico" },
|
|
82
|
+
],
|
|
83
|
+
}, { interactive: true });
|
|
84
|
+
|
|
85
|
+
ctrl.on("element:click", (info) => console.log("Clic:", info.id));
|
|
86
|
+
ctrl.on("element:hover", (info) => console.log("Hover:", info.tooltip));
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Vue 3
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<script setup>
|
|
93
|
+
import { CircuitDiagram } from "@skillpet/circuit/vue";
|
|
94
|
+
|
|
95
|
+
const circuit = {
|
|
96
|
+
elements: [
|
|
97
|
+
{ type: "ResistorIEEE", label: "R1", id: "R1", tooltip: "100kΩ" },
|
|
98
|
+
{ type: "Capacitor", d: "down", label: "C1" },
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<CircuitDiagram :circuit="circuit" interactive @element-click="console.log" />
|
|
105
|
+
</template>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### React
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { CircuitDiagram } from "@skillpet/circuit/react";
|
|
112
|
+
|
|
113
|
+
function App() {
|
|
114
|
+
return (
|
|
115
|
+
<CircuitDiagram
|
|
116
|
+
circuit={{ elements: [{ type: "ResistorIEEE", label: "R1" }] }}
|
|
117
|
+
interactive
|
|
118
|
+
onElementClick={(info) => console.log(info)}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Temas
|
|
125
|
+
|
|
126
|
+
Tres temas integrados: `light` (predeterminado), `dark` y `print`.
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const svg = renderFromJson(circuit, { theme: "dark" });
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Transiciones de color
|
|
133
|
+
|
|
134
|
+
Transiciones de gradiente suaves entre elementos de diferentes colores:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const svg = renderFromJson({
|
|
138
|
+
drawing: { colorTransition: true },
|
|
139
|
+
elements: [
|
|
140
|
+
{ type: "SourceV", d: "up", color: "#2ecc71" },
|
|
141
|
+
{ type: "ResistorIEEE", color: "#e74c3c" },
|
|
142
|
+
],
|
|
143
|
+
}, { colorTransition: true });
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Licencia
|
|
147
|
+
|
|
148
|
+
Gratis para uso personal y educativo. El uso comercial requiere una licencia separada.
|
|
149
|
+
Consulte el archivo LICENSE incluido en este paquete para los términos completos.
|
|
150
|
+
Para licencias comerciales, contacte **license@skill.pet** o visite [circuit.skill.pet/license](https://circuit.skill.pet/license).
|
package/README.fr.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @skillpet/circuit
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Español](./README.es.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md)
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Bibliothèque de schémas de circuits — rendez des schémas électriques à partir de JSON, avec SVG interactif, thèmes et composants Vue / React.</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@skillpet/circuit"><img src="https://img.shields.io/npm/v/@skillpet/circuit.svg" alt="npm version"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@skillpet/circuit"><img src="https://img.shields.io/npm/l/@skillpet/circuit.svg" alt="license"></a>
|
|
12
|
+
<a href="https://circuit.skill.pet"><img src="https://img.shields.io/badge/docs-circuit.skill.pet-blue" alt="docs"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Site web et démos :** [circuit.skill.pet](https://circuit.skill.pet)
|
|
18
|
+
|
|
19
|
+
## Fonctionnalités
|
|
20
|
+
|
|
21
|
+
- Rendu de schémas de circuits à partir d'une simple description JSON
|
|
22
|
+
- Plus de 200 composants électriques intégrés (résistances, condensateurs, diodes, transistors, circuits intégrés, portes logiques, etc.)
|
|
23
|
+
- SVG interactif : surbrillance au survol, infobulles, événements de clic
|
|
24
|
+
- 3 thèmes intégrés (clair, sombre, impression) + thèmes personnalisés
|
|
25
|
+
- Transitions de couleur fluides entre les éléments
|
|
26
|
+
- Composants Vue 3 et React prêts à l'emploi
|
|
27
|
+
- Bundle navigateur (balise script) et support ESM / CJS
|
|
28
|
+
- Rendu d'étiquettes mathématiques avec KaTeX
|
|
29
|
+
- Organigrammes, blocs DSP, composants de breadboard
|
|
30
|
+
- Aucune dépendance runtime (KaTeX est optionnel)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @skillpet/circuit
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Démarrage rapide
|
|
39
|
+
|
|
40
|
+
### ESM / TypeScript
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { renderFromJson } from "@skillpet/circuit";
|
|
44
|
+
|
|
45
|
+
const svg = renderFromJson({
|
|
46
|
+
elements: [
|
|
47
|
+
{ type: "SourceV", d: "up", label: "12V" },
|
|
48
|
+
{ type: "ResistorIEEE", label: "R1 10kΩ" },
|
|
49
|
+
{ type: "Capacitor", d: "down", label: "C1 100nF" },
|
|
50
|
+
{ type: "Line", d: "left" },
|
|
51
|
+
{ type: "Ground" },
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Navigateur (balise Script)
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<script src="https://unpkg.com/@skillpet/circuit/dist/circuit.bundle.min.js"></script>
|
|
60
|
+
<script>
|
|
61
|
+
const svg = Circuit.renderFromJson({
|
|
62
|
+
elements: [
|
|
63
|
+
{ type: "ResistorIEEE", label: "R1" },
|
|
64
|
+
{ type: "Capacitor", d: "down", label: "C1" },
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
document.getElementById("output").innerHTML = svg;
|
|
68
|
+
</script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Mode interactif
|
|
72
|
+
|
|
73
|
+
Montez dans le DOM avec surbrillance au survol, infobulles et événements de clic :
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { mountFromJson } from "@skillpet/circuit";
|
|
77
|
+
|
|
78
|
+
const ctrl = mountFromJson(document.getElementById("container"), {
|
|
79
|
+
elements: [
|
|
80
|
+
{ type: "ResistorIEEE", id: "R1", tooltip: "100kΩ Film carbone" },
|
|
81
|
+
{ type: "Capacitor", d: "down", id: "C1", tooltip: "0.1μF Céramique" },
|
|
82
|
+
],
|
|
83
|
+
}, { interactive: true });
|
|
84
|
+
|
|
85
|
+
ctrl.on("element:click", (info) => console.log("Clic :", info.id));
|
|
86
|
+
ctrl.on("element:hover", (info) => console.log("Survol :", info.tooltip));
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Vue 3
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<script setup>
|
|
93
|
+
import { CircuitDiagram } from "@skillpet/circuit/vue";
|
|
94
|
+
|
|
95
|
+
const circuit = {
|
|
96
|
+
elements: [
|
|
97
|
+
{ type: "ResistorIEEE", label: "R1", id: "R1", tooltip: "100kΩ" },
|
|
98
|
+
{ type: "Capacitor", d: "down", label: "C1" },
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<CircuitDiagram :circuit="circuit" interactive @element-click="console.log" />
|
|
105
|
+
</template>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### React
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { CircuitDiagram } from "@skillpet/circuit/react";
|
|
112
|
+
|
|
113
|
+
function App() {
|
|
114
|
+
return (
|
|
115
|
+
<CircuitDiagram
|
|
116
|
+
circuit={{ elements: [{ type: "ResistorIEEE", label: "R1" }] }}
|
|
117
|
+
interactive
|
|
118
|
+
onElementClick={(info) => console.log(info)}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Thèmes
|
|
125
|
+
|
|
126
|
+
Trois thèmes intégrés : `light` (par défaut), `dark` et `print`.
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const svg = renderFromJson(circuit, { theme: "dark" });
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Transitions de couleur
|
|
133
|
+
|
|
134
|
+
Transitions en dégradé fluides entre des éléments de couleurs différentes :
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const svg = renderFromJson({
|
|
138
|
+
drawing: { colorTransition: true },
|
|
139
|
+
elements: [
|
|
140
|
+
{ type: "SourceV", d: "up", color: "#2ecc71" },
|
|
141
|
+
{ type: "ResistorIEEE", color: "#e74c3c" },
|
|
142
|
+
],
|
|
143
|
+
}, { colorTransition: true });
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Licence
|
|
147
|
+
|
|
148
|
+
Gratuit pour un usage personnel et éducatif. L'utilisation commerciale nécessite une licence séparée.
|
|
149
|
+
Consultez le fichier LICENSE inclus dans ce package pour les conditions complètes.
|
|
150
|
+
Pour les licences commerciales, contactez **license@skill.pet** ou visitez [circuit.skill.pet/license](https://circuit.skill.pet/license).
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @skillpet/circuit
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Español](./README.es.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md)
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>回路図ライブラリ — JSON から電気回路図をレンダリング。インタラクティブ SVG、テーマ、Vue / React コンポーネント対応。</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@skillpet/circuit"><img src="https://img.shields.io/npm/v/@skillpet/circuit.svg" alt="npm version"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@skillpet/circuit"><img src="https://img.shields.io/npm/l/@skillpet/circuit.svg" alt="license"></a>
|
|
12
|
+
<a href="https://circuit.skill.pet"><img src="https://img.shields.io/badge/docs-circuit.skill.pet-blue" alt="docs"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**ウェブサイト&デモ:** [circuit.skill.pet](https://circuit.skill.pet)
|
|
18
|
+
|
|
19
|
+
## 特徴
|
|
20
|
+
|
|
21
|
+
- シンプルな JSON 記述から回路図をレンダリング
|
|
22
|
+
- 200 以上の内蔵電気部品(抵抗器、コンデンサ、ダイオード、トランジスタ、IC、論理ゲートなど)
|
|
23
|
+
- インタラクティブ SVG:ホバーハイライト、ツールチップ、クリックイベント
|
|
24
|
+
- 3 つの内蔵テーマ(ライト、ダーク、印刷)+カスタムテーマ
|
|
25
|
+
- 要素間のスムーズなカラートランジション
|
|
26
|
+
- Vue 3 & React コンポーネントをすぐに利用可能
|
|
27
|
+
- ブラウザバンドル(script タグ)& ESM / CJS サポート
|
|
28
|
+
- KaTeX 数式ラベルレンダリング
|
|
29
|
+
- フローチャート、DSP ブロック、ブレッドボード部品
|
|
30
|
+
- ランタイム依存なし(KaTeX はオプション)
|
|
31
|
+
|
|
32
|
+
## インストール
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @skillpet/circuit
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## クイックスタート
|
|
39
|
+
|
|
40
|
+
### ESM / TypeScript
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { renderFromJson } from "@skillpet/circuit";
|
|
44
|
+
|
|
45
|
+
const svg = renderFromJson({
|
|
46
|
+
elements: [
|
|
47
|
+
{ type: "SourceV", d: "up", label: "12V" },
|
|
48
|
+
{ type: "ResistorIEEE", label: "R1 10kΩ" },
|
|
49
|
+
{ type: "Capacitor", d: "down", label: "C1 100nF" },
|
|
50
|
+
{ type: "Line", d: "left" },
|
|
51
|
+
{ type: "Ground" },
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### ブラウザ(Script タグ)
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<script src="https://unpkg.com/@skillpet/circuit/dist/circuit.bundle.min.js"></script>
|
|
60
|
+
<script>
|
|
61
|
+
const svg = Circuit.renderFromJson({
|
|
62
|
+
elements: [
|
|
63
|
+
{ type: "ResistorIEEE", label: "R1" },
|
|
64
|
+
{ type: "Capacitor", d: "down", label: "C1" },
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
document.getElementById("output").innerHTML = svg;
|
|
68
|
+
</script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### インタラクティブモード
|
|
72
|
+
|
|
73
|
+
DOM にマウントして、ホバーハイライト、ツールチップ、クリックイベントを有効化:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { mountFromJson } from "@skillpet/circuit";
|
|
77
|
+
|
|
78
|
+
const ctrl = mountFromJson(document.getElementById("container"), {
|
|
79
|
+
elements: [
|
|
80
|
+
{ type: "ResistorIEEE", id: "R1", tooltip: "100kΩ カーボン皮膜" },
|
|
81
|
+
{ type: "Capacitor", d: "down", id: "C1", tooltip: "0.1μF セラミック" },
|
|
82
|
+
],
|
|
83
|
+
}, { interactive: true });
|
|
84
|
+
|
|
85
|
+
ctrl.on("element:click", (info) => console.log("クリック:", info.id));
|
|
86
|
+
ctrl.on("element:hover", (info) => console.log("ホバー:", info.tooltip));
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Vue 3
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<script setup>
|
|
93
|
+
import { CircuitDiagram } from "@skillpet/circuit/vue";
|
|
94
|
+
|
|
95
|
+
const circuit = {
|
|
96
|
+
elements: [
|
|
97
|
+
{ type: "ResistorIEEE", label: "R1", id: "R1", tooltip: "100kΩ" },
|
|
98
|
+
{ type: "Capacitor", d: "down", label: "C1" },
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<CircuitDiagram :circuit="circuit" interactive @element-click="console.log" />
|
|
105
|
+
</template>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### React
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { CircuitDiagram } from "@skillpet/circuit/react";
|
|
112
|
+
|
|
113
|
+
function App() {
|
|
114
|
+
return (
|
|
115
|
+
<CircuitDiagram
|
|
116
|
+
circuit={{ elements: [{ type: "ResistorIEEE", label: "R1" }] }}
|
|
117
|
+
interactive
|
|
118
|
+
onElementClick={(info) => console.log(info)}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## テーマ
|
|
125
|
+
|
|
126
|
+
3 つの内蔵テーマ:`light`(デフォルト)、`dark`、`print`。
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const svg = renderFromJson(circuit, { theme: "dark" });
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## カラートランジション
|
|
133
|
+
|
|
134
|
+
異なる色の要素間でスムーズなグラデーション遷移:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const svg = renderFromJson({
|
|
138
|
+
drawing: { colorTransition: true },
|
|
139
|
+
elements: [
|
|
140
|
+
{ type: "SourceV", d: "up", color: "#2ecc71" },
|
|
141
|
+
{ type: "ResistorIEEE", color: "#e74c3c" },
|
|
142
|
+
],
|
|
143
|
+
}, { colorTransition: true });
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## ライセンス
|
|
147
|
+
|
|
148
|
+
個人・教育目的は無料です。商用利用には別途ライセンスが必要です。
|
|
149
|
+
詳細は本パッケージの LICENSE ファイルをご覧ください。
|
|
150
|
+
商用ライセンスについては **license@skill.pet** または [circuit.skill.pet/license](https://circuit.skill.pet/license) までお問い合わせください。
|