Skip to content

Commit 7265ee9

Browse files
Starter implementation of Bezier library and UI documentation (#664)
* Initial commit for interactive documentation. Created draggable points * Swapped line demo to cubic and quadratic. Cleaned up interface * Implement Bezier constructor * Clean up to_svg function * Create interactive docs wasm folder * Integrate wasm with interactive docs and change eslint settings * Created wasm-bindgen for Bezier class. Incorporated wasm class into frontend * Refactored bezierdrawing to call wasm binding. Moved drawing functions to util * Change internal representation of Bezier segment * Convert to typescript & named internal bezier repr Co-authored-by: Hannah Li <[email protected]> Co-authored-by: Robert Nadal <[email protected]>
1 parent 5581044 commit 7265ee9

27 files changed

+19939
-5
lines changed

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@
3737
"html.format.wrapLineLength": 200,
3838
"files.eol": "\n",
3939
"files.insertFinalNewline": true,
40+
"[vue]": {
41+
"editor.defaultFormatter": "esbenp.prettier-vscode"
42+
},
43+
"[typescript]": {
44+
"editor.defaultFormatter": "esbenp.prettier-vscode"
45+
},
4046
}

Cargo.lock

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ members = [
55
"proc-macros",
66
"frontend/wasm",
77
"bezier-rs/lib",
8+
"bezier-rs/docs/interactive-docs/wasm",
89
]
910

1011
[profile.release.package.graphite-wasm]
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
const webpackConfigPath = require.resolve("@vue/cli-service/webpack.config.js");
2+
3+
module.exports = {
4+
root: true,
5+
env: {
6+
browser: true,
7+
node: true,
8+
es2020: true,
9+
},
10+
parserOptions: {
11+
ecmaVersion: 2020,
12+
// parser: '@typescript-eslint/parser'
13+
},
14+
extends: [
15+
// Vue-specific defaults
16+
"plugin:vue/vue3-essential",
17+
// Vue-compatible JS defaults
18+
"@vue/airbnb",
19+
// Vue-compatible TS defaults
20+
"@vue/typescript/recommended",
21+
// Vue-compatible Prettier defaults
22+
"plugin:prettier-vue/recommended",
23+
// General Prettier defaults
24+
"prettier",
25+
],
26+
settings: {
27+
// https://github.com/import-js/eslint-plugin-import#resolvers
28+
"import/resolver": {
29+
// `node` must be listed first!
30+
node: {},
31+
webpack: { config: webpackConfigPath },
32+
},
33+
// https://github.com/meteorlxy/eslint-plugin-prettier-vue
34+
"prettier-vue": {
35+
// Use Prettier to format the HTML, CSS, and JS blocks of .vue single-file components
36+
SFCBlocks: {
37+
template: true,
38+
style: true,
39+
script: true,
40+
},
41+
},
42+
},
43+
ignorePatterns: [
44+
// Ignore generated directories
45+
"node_modules/",
46+
"dist/",
47+
"pkg/",
48+
"wasm/pkg/",
49+
// Don't ignore JS and TS dotfiles in this folder
50+
"!.*.js",
51+
"!.*.ts",
52+
],
53+
rules: {
54+
// Standard ESLint config
55+
indent: "off",
56+
quotes: ["error", "double"],
57+
camelcase: ["error", { properties: "always" }],
58+
"linebreak-style": ["error", "unix"],
59+
"eol-last": ["error", "always"],
60+
"max-len": ["error", { code: 200, tabWidth: 4 }],
61+
"prefer-destructuring": "off",
62+
"no-console": "warn",
63+
"no-debugger": "warn",
64+
"no-param-reassign": ["error", { props: false }],
65+
"no-bitwise": "off",
66+
"no-shadow": "off",
67+
"no-use-before-define": "off",
68+
// TODO: Vetur cannot properly recognize paths using @ which contradicts this rule
69+
// "no-restricted-imports": ["error", { patterns: [".*", "!@/*"] }],
70+
71+
// TypeScript plugin config
72+
"@typescript-eslint/indent": "off",
73+
"@typescript-eslint/camelcase": "off",
74+
"@typescript-eslint/no-use-before-define": "off",
75+
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", ignoreRestSiblings: true }],
76+
"@typescript-eslint/explicit-function-return-type": ["error"],
77+
78+
// Import plugin config (used to intelligently validate module import statements)
79+
"import/prefer-default-export": "off",
80+
"import/no-relative-packages": "error",
81+
"import/order": [
82+
"error",
83+
{
84+
alphabetize: {
85+
order: "asc",
86+
caseInsensitive: true,
87+
},
88+
warnOnUnassignedImports: true,
89+
"newlines-between": "always-and-inside-groups",
90+
pathGroups: [
91+
{
92+
pattern: "**/*.vue",
93+
group: "unknown",
94+
position: "after",
95+
},
96+
],
97+
},
98+
],
99+
100+
// Prettier plugin config (used to enforce HTML, CSS, and JS formatting styles as an ESLint plugin, where fixes are reported to ESLint to be applied when linting)
101+
"prettier-vue/prettier": [
102+
"error",
103+
{
104+
tabWidth: 4,
105+
tabs: true,
106+
printWidth: 200,
107+
},
108+
],
109+
110+
// Vue plugin config (used to validate Vue single-file components)
111+
"vue/multi-word-component-names": "off",
112+
113+
// Vue Accessibility plugin config (included by airbnb defaults but undesirable for a web app project)
114+
"vuejs-accessibility/form-control-has-label": "off",
115+
"vuejs-accessibility/label-has-for": "off",
116+
"vuejs-accessibility/click-events-have-key-events": "off",
117+
},
118+
overrides: [
119+
{
120+
files: ["*.js"],
121+
rules: {
122+
"@typescript-eslint/explicit-function-return-type": ["off"],
123+
},
124+
},
125+
],
126+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
/wasm/pkg
5+
6+
7+
# local env files
8+
.env.local
9+
.env.*.local
10+
11+
# Log files
12+
npm-debug.log*
13+
yarn-debug.log*
14+
yarn-error.log*
15+
pnpm-debug.log*
16+
17+
# Editor directories and files
18+
.idea
19+
.vscode
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# interactive-docs
2+
3+
## Project setup
4+
```
5+
npm install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
npm run serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
npm run build
16+
```
17+
18+
### Lints and fixes files
19+
```
20+
npm run lint
21+
```
22+
23+
### Customize configuration
24+
See [Configuration Reference](https://cli.vuejs.org/config/).
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"jsx": "preserve",
4+
"target": "es5",
5+
"module": "esnext",
6+
"baseUrl": "./",
7+
"moduleResolution": "node",
8+
"paths": {
9+
"@/*": [
10+
"src/*"
11+
]
12+
},
13+
"lib": [
14+
"esnext",
15+
"dom",
16+
"dom.iterable",
17+
"scripthost"
18+
]
19+
}
20+
}

0 commit comments

Comments
 (0)