Skip to content

Commit

Permalink
Fixup prettier config and fix formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
theacodes committed Oct 6, 2023
1 parent 12b0a95 commit ed2318a
Show file tree
Hide file tree
Showing 28 changed files with 487 additions and 348 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 80,
"trailingComma": "all",
"bracketSameLine": true
}
12 changes: 12 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**/.git
**/.svn
**/.hg
**/node_modules
build/
debug/kicanvas
docs/site
.github/
.vscode/
CODE_OF_CONDUCT.md
package-lock.json
src/kicad/text/newstroke-glyphs.ts
36 changes: 20 additions & 16 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
{
"tabWidth": 4,
"useTabs": false,
"printWidth": 80,
"trailingComma": "all",
"bracketSameLine": true,
"overrides": [
{
"files": [
"*.js",
"*.ts"
],
"options": {
"parser": "typescript"
}
}
]
"tabWidth": 4,
"useTabs": false,
"printWidth": 80,
"trailingComma": "all",
"bracketSameLine": true,
"overrides": [
{
"files": ["*.js", "*.ts"],
"options": {
"parser": "typescript"
}
},
{
"files": ["tsconfig.json"],
"options": {
"parser": "json5",
"quoteProps": "preserve"
}
}
]
}
26 changes: 25 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"**/*.js": {
"when": "$(basename).ts"
},
"dist/": true
"build/": true
},
"cSpell.words": [
"Adhes",
Expand Down Expand Up @@ -46,4 +46,28 @@
"debug.console.closeOnEnd": true,
"debug.terminal.clearBeforeReusing": true,
"typescript.tsdk": "node_modules/typescript/lib",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
}
10 changes: 5 additions & 5 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ derivative works.
This project contains copies or makes use of other works. These works and their respective
license and terms are:

- Earcut by Mapbox, licensed under the ISC license. Retrived from https://github.com/mapbox/earcut.
- Newstroke by Vladimir Uryvaev, Lingdong Huang, Adobe, and KiCAD contributors. Originally licensed under Creative Commons CC0 1.0, amended with an MIT-like license, and utilizes glyphs that are licensed under the SIL Open Font License Version 1.1.
- Material Symbols by Google, licensed under the Apache License, Version 2.0. Retrieved from https://github.com/google/material-design-icons.
- Nunito by Vernon Adams, Manvel Shmavonyan, licensed under the Open Font License. Retrieved from https://fonts.google.com/specimen/Nunito/about
- Bellota by Kemie Guaida, licensed under the Open Font License. Retrieved from https://fonts.google.com/specimen/Bellota/about
- Earcut by Mapbox, licensed under the ISC license. Retrived from https://github.com/mapbox/earcut.
- Newstroke by Vladimir Uryvaev, Lingdong Huang, Adobe, and KiCAD contributors. Originally licensed under Creative Commons CC0 1.0, amended with an MIT-like license, and utilizes glyphs that are licensed under the SIL Open Font License Version 1.1.
- Material Symbols by Google, licensed under the Apache License, Version 2.0. Retrieved from https://github.com/google/material-design-icons.
- Nunito by Vernon Adams, Manvel Shmavonyan, licensed under the Open Font License. Retrieved from https://fonts.google.com/specimen/Nunito/about
- Bellota by Kemie Guaida, licensed under the Open Font License. Retrieved from https://fonts.google.com/specimen/Bellota/about
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ KiCanvas is very early in its development and there's a ton of stuff that hasn't

In general, please check the [GitHub issues] page before filing new issues. Some high-level things that we known won't work:

- Any KiCAD 5 files, KiCanvas can only parse files from KiCAD 6 and later.
- Some KiCAD 7 features might not be fully implemented, such as custom fonts in schematics.
- Browsers other than desktop Chrome, Firefox, and Safari may run into issues, as we aren't currently running automated tests against other browsers. We welcome issues related to browser compatibility, just make sure it hasn't already been reported.
- Any KiCAD 5 files, KiCanvas can only parse files from KiCAD 6 and later.
- Some KiCAD 7 features might not be fully implemented, such as custom fonts in schematics.
- Browsers other than desktop Chrome, Firefox, and Safari may run into issues, as we aren't currently running automated tests against other browsers. We welcome issues related to browser compatibility, just make sure it hasn't already been reported.

[GitHub issues]: https://github.com/theacodes/kicanvas/issues

Expand All @@ -54,21 +54,20 @@ Contributions are welcome! However, since KiCanvas is in a super early stage ple

KiCanvas would not be possible without the incredible financial support of our [sponsors]. I'd specifically like to thank the following people for their support:

- [@mithro](https://github.com/mithro)
- [@jeremysf](https://github.com/jeremysf)
- [@blues](https://github.com/blues)
- [@timonsku](https://github.com/timonsku)
- [@todbot](https://github.com/todbot)
- [@friggeri](https://github.com/friggeri)
- [@voidmar](https://github.com/voidmar)
- [@casundra](https://github.com/casundra)
- [@ntpopgetdope](https://github.com/ntpopgetdope)
- [@ehughes](https://github.com/ehughes)
- [@guru](https://github.com/guru)
- [@jamesneal](https://github.com/jamesneal)
- [@calithameridi](https://github.com/calithameridi)
- [@jwr](https://github.com/jwr)
- [@forsyth](https://github.com/forsyth)
- [@mattimo](https://github.com/mattimo)
- [@mzollin](https://github.com/mzollin)

- [@mithro](https://github.com/mithro)
- [@jeremysf](https://github.com/jeremysf)
- [@blues](https://github.com/blues)
- [@timonsku](https://github.com/timonsku)
- [@todbot](https://github.com/todbot)
- [@friggeri](https://github.com/friggeri)
- [@voidmar](https://github.com/voidmar)
- [@casundra](https://github.com/casundra)
- [@ntpopgetdope](https://github.com/ntpopgetdope)
- [@ehughes](https://github.com/ehughes)
- [@guru](https://github.com/guru)
- [@jamesneal](https://github.com/jamesneal)
- [@calithameridi](https://github.com/calithameridi)
- [@jwr](https://github.com/jwr)
- [@forsyth](https://github.com/forsyth)
- [@mattimo](https://github.com/mattimo)
- [@mzollin](https://github.com/mzollin)
27 changes: 13 additions & 14 deletions debug/board.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="./style.css" />
<!-- <script src="https://greggman.github.io/webgl-lint/webgl-lint.js"></script> -->
</head>

<head>
<link rel="stylesheet" href="./style.css" />
<!-- <script src="https://greggman.github.io/webgl-lint/webgl-lint.js"></script> -->
</head>

<body>

<body>
<kc-kicanvas-shell id="kicanvas" src="examples/dimensions.kicad_pcb"></kc-kicanvas-shell>
</body>
<script type="module" src="./kicanvas/kicanvas.js"></script>
</body>

<body>
<body>
<kc-kicanvas-shell
id="kicanvas"
src="examples/dimensions.kicad_pcb"></kc-kicanvas-shell>
</body>
<script type="module" src="./kicanvas/kicanvas.js"></script>
</body>
</html>
96 changes: 57 additions & 39 deletions debug/embedded.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,61 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="./embedded-style.css" />
</head>

<head>
<link rel="stylesheet" href="./embedded-style.css">
</head>

<body>
<main>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<kicanvas-embed src="examples/helium.kicad_sch" controls="basic" controlslist="download nofullscreen">
</kicanvas-embed>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<kicanvas-embed src="examples/starfish.kicad_pcb" controls="full">
</kicanvas-embed>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<kicanvas-embed>
<kicanvas-source src="examples/mcu.kicad_sch"></kicanvas-source>
<kicanvas-source src="examples/analogins.kicad_sch"></kicanvas-source>
</kicanvas-embed>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</main>
</body>

<script type="module" src="./kicanvas/kicanvas.js"></script>
<body>
<main>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<kicanvas-embed
src="examples/helium.kicad_sch"
controls="basic"
controlslist="download nofullscreen">
</kicanvas-embed>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<kicanvas-embed src="examples/starfish.kicad_pcb" controls="full">
</kicanvas-embed>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<kicanvas-embed>
<kicanvas-source src="examples/mcu.kicad_sch"></kicanvas-source>
<kicanvas-source
src="examples/analogins.kicad_sch"></kicanvas-source>
</kicanvas-embed>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</main>
</body>

<script type="module" src="./kicanvas/kicanvas.js"></script>
</html>
18 changes: 8 additions & 10 deletions debug/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="./style.css" />
</head>

<head>
<link rel="stylesheet" href="./style.css" />
</head>

<body>
<kc-kicanvas-shell id="kicanvas"></kc-kicanvas-shell>
</body>

<script type="module" src="./kicanvas/kicanvas.js"></script>
<body>
<kc-kicanvas-shell id="kicanvas"></kc-kicanvas-shell>
</body>

<script type="module" src="./kicanvas/kicanvas.js"></script>
</html>
20 changes: 10 additions & 10 deletions debug/schematic.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="./style.css" />
</head>

<head>
<link rel="stylesheet" href="./style.css">
</head>

<body>
<kc-kicanvas-shell id="kicanvas" src="./examples/helium.kicad_sch"></kc-kicanvas-shell>
</body>
<script type="module" src="./kicanvas/kicanvas.js"></script>

<body>
<kc-kicanvas-shell
id="kicanvas"
src="./examples/helium.kicad_sch"></kc-kicanvas-shell>
</body>
<script type="module" src="./kicanvas/kicanvas.js"></script>
</html>
12 changes: 6 additions & 6 deletions docs/docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ KiCanvas notably does not have any runtime dependencies. Everything it needs to

KiCanvas's source code under `./src` is organized into the following:

- `base` contains generic, widely applicable utilities for working with JavaScript, TypeScript, the DOM, and math. These are the sort of things you'd use across multiple, unrelated projects.
- `kicad` contains the KiCAD data layer and text layout implementation. This is where parsers for KiCAD files and associated models live.
- `graphics` contains the rendering engine. It is somewhat generic- it handles rendering primitives such as lines, circles, and polygons, but is also tailored to KiCanvas's needs in specific ways.
- `viewers` contains classes that implement viewers for different KiCAD documents. Viewers handle creating geometry using "Painters" and managing "Layers" for the renderer to draw. Viewers do not provide a user interface on their own, they're designed with high-level APIs that let various user interface elements control the viewer.
- `kc-ui` contains generic, low-level web components used to build KiCanvas's user interface. Elements in here are generic enough to be re-used in other projects, but may be slightly tailored to KiCanvas's needs. For example, `<kc-ui-button>` and `<kc-ui-icon>`.
- `kicanvas` contains the KiCanvas application and its elements. Elements here implement KiCanvas functionality, such as `<kc-project-panel>` and `<kc-symbols-panel>`.
- `base` contains generic, widely applicable utilities for working with JavaScript, TypeScript, the DOM, and math. These are the sort of things you'd use across multiple, unrelated projects.
- `kicad` contains the KiCAD data layer and text layout implementation. This is where parsers for KiCAD files and associated models live.
- `graphics` contains the rendering engine. It is somewhat generic- it handles rendering primitives such as lines, circles, and polygons, but is also tailored to KiCanvas's needs in specific ways.
- `viewers` contains classes that implement viewers for different KiCAD documents. Viewers handle creating geometry using "Painters" and managing "Layers" for the renderer to draw. Viewers do not provide a user interface on their own, they're designed with high-level APIs that let various user interface elements control the viewer.
- `kc-ui` contains generic, low-level web components used to build KiCanvas's user interface. Elements in here are generic enough to be re-used in other projects, but may be slightly tailored to KiCanvas's needs. For example, `<kc-ui-button>` and `<kc-ui-icon>`.
- `kicanvas` contains the KiCanvas application and its elements. Elements here implement KiCanvas functionality, such as `<kc-project-panel>` and `<kc-symbols-panel>`.

[KiCanvas]: https://kicanvas.org
[TypeScript]: https://typescript.dev
Expand Down
13 changes: 5 additions & 8 deletions docs/docs/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,9 @@ This example shows how to use `<kicanvas-source>` along with inline KiCAD data.
```html
<kicanvas-embed>
<kicanvas-source type="schematic">
(lib_symbols
(symbol "power:+12V" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "#PWR" (at 0 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
...
(lib_symbols (symbol "power:+12V" (power) (pin_names (offset 0)) (in_bom
yes) (on_board yes) (property "Reference" "#PWR" (at 0 -3.81 0) (effects
(font (size 1.27 1.27)) hide) ) ...
</kicanvas-source>
</kicanvas-embed>
```
Expand Down Expand Up @@ -152,8 +149,8 @@ This example shows how to use `<kicanvas-source>` along with inline KiCAD data.

This functionality hasn't been implemented yet

| Event Name | Fired When |
| ------------------------- | ------------------------------------------------------------------------------------------------- |
| Event Name | Fired When |
| ---------------------------- | ------------------------------------------------------------------------------------------------- |
| ⚠️ `kicanvas:click` | The user clicks or taps within the embedded document |
| ⚠️ `kicanvas:documentchange` | The currently displayed document is changed, either through user interaction or programmatically. |
| ⚠️ `kicanvas:error` | An error occurs while loading source files |
Expand Down
Loading

0 comments on commit ed2318a

Please sign in to comment.