|
| 1 | +# svelte-circles |
| 2 | + |
| 3 | +A playground for developing _interactive_ SVG graphics, as a Svelte component. |
| 4 | + |
| 5 | +Aims: |
| 6 | + |
| 7 | +- [ ] apply the Toolbook/Flash programming model to modern web apps |
| 8 | + - [ ] vector graphics with scripts and cascading events |
| 9 | +- [ ] allow working with SVG assets in separate files (editable) |
| 10 | +- [ ] ... (other aims still foggy) |
| 11 | + |
| 12 | + |
| 13 | +## Requirements |
| 14 | + |
| 15 | +- npm |
| 16 | + |
| 17 | +## Getting started |
| 18 | + |
| 19 | +``` |
| 20 | +$ npm install |
| 21 | +``` |
| 22 | + |
| 23 | +*If you see errors, check out the [Troubleshooting](#troubleshooting) section.* |
| 24 | + |
| 25 | +``` |
| 26 | +$ npm run dev |
| 27 | +
|
| 28 | + Your application is ready~! 🚀 |
| 29 | +
|
| 30 | + - Local: http://localhost:5000 |
| 31 | +
|
| 32 | +... |
| 33 | +[2019-11-24 19:42:02] waiting for changes... |
| 34 | +``` |
| 35 | + |
| 36 | +Open [http://localhost:5000](http://localhost:5000). |
| 37 | + |
| 38 | + |
| 39 | +> |
| 40 | +
|
| 41 | + |
| 42 | +## Tests |
| 43 | + |
| 44 | +<font color=red>tbd. Tests are intended, using Mocha, Puppeteer or similar (what is this C... fellow?).</font> |
| 45 | + |
| 46 | + |
| 47 | +## Developing |
| 48 | + |
| 49 | +While you're running the `npm run dev`, changes to the code are reflected in the browser. |
| 50 | + |
| 51 | +>You will need to hit 'refresh' in the browser, though. Remains open whether we want the browser to automatically refresh - it may also be a unwanted. |
| 52 | +
|
| 53 | + |
| 54 | +## Using |
| 55 | + |
| 56 | +>This module is not currently published to the online `npm` repo. This is because it's a proof-of-concept and not really useful as from-the-shelf. If this changes, we may rethink polishing and publishing. |
| 57 | +
|
| 58 | +To use the component in your other (npm) project, use: |
| 59 | + |
| 60 | +Here, just once: |
| 61 | + |
| 62 | +``` |
| 63 | +$ npm link |
| 64 | +``` |
| 65 | + |
| 66 | +In the using project: |
| 67 | + |
| 68 | +``` |
| 69 | +$ cd <your-project> |
| 70 | +$ npm link svelte-circles-demo # the name in 'package.json' |
| 71 | +``` |
| 72 | + |
| 73 | +This should provide you the component in the other project. |
| 74 | + |
| 75 | +*<font color=red>Warning: not tried!</font>* |
| 76 | + |
| 77 | +See [app/App.svelte](app/App.svelte) for a sample. |
| 78 | + |
| 79 | +<!-- disabled (enable if there are properties) |
| 80 | +### Properties |
| 81 | + |
| 82 | +| | Default Value | Description |
| 83 | +|---|---|--- |
| 84 | +
|
| 85 | +--> |
| 86 | + |
| 87 | + |
| 88 | +## Troubleshooting |
| 89 | + |
| 90 | +### macOS Catalina |
| 91 | + |
| 92 | +If you're on macOS 10.15 and get a bunch of errors about `node-gyp`, see [here](https://github.com/nodejs/node-gyp/issues/1927#issuecomment-549349352). |
| 93 | + |
| 94 | +Essentially: |
| 95 | + |
| 96 | +>``` |
| 97 | +>$ sudo rm -rf $(xcode-select -print-path) |
| 98 | +>$ xcode-select --install |
| 99 | +>$ /usr/sbin/pkgutil --packages | grep CLTools # should list some files |
| 100 | +>``` |
| 101 | +
|
| 102 | +Then try again `npm install`. |
| 103 | +
|
| 104 | +## References |
| 105 | +
|
| 106 | +- Thanks to Eugenkiss [7 Tasks](https://eugenkiss.github.io/7guis/tasks#circle) for the original "Circle Drawer" code, found via [Svelte Examples](https://svelte.dev/examples#7guis-circles) |
| 107 | +
|
| 108 | +- [rollup-plugin-svelte/README](https://github.com/rollup/rollup-plugin-svelte) |
| 109 | +
|
| 110 | + Read especially [this section](https://github.com/rollup/rollup-plugin-svelte#pkgsvelte) for knowledge on exporting/importing Svelte components, via npm. |
| 111 | +
|
| 112 | +- [lukeed/svelte-demo](https://github.com/lukeed/svelte-demo) used as a template for the `app` part (demo/testbed) |
| 113 | +
|
0 commit comments