side effects reference docs & examples (#3258)

Adds reference docs, guide in the "Editor" article, and examples for the
side effects manager.

There are 4 new examples:
1. Before create/update shape - constrains shapes to be places within a
circle
2. Before delete shape - prevent red shapes from being deleted
3. After create/update shape - make sure there's only ever one red shape
on the page at a time
4. After delete shape - delete frames after their last child is deleted

As these examples all require fairly specific configurations of shapes
(or are hard to understand without some visual hinting in the case of
placing shapes within a circle), I've included a `createDemoShapes`
function in each of these which makes sure the examples start with
shapes that will quickly show you the side effects in action. I've kept
these separate from the main code (in a function at the bottom), so
hopefully that won't be a source of confusion to anyone working from
these examples.


### Change Type
- [x] `docs` — Changes to the documentation, examples, or templates.
- [x] `improvement` — Improving existing features
This commit is contained in:
alex 2024-03-26 18:38:19 +00:00 committed by GitHub
parent 01ec8f1e98
commit 3593799d9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 1357 additions and 10 deletions

View file

@ -31,6 +31,7 @@ export function generateSection(section: InputSection, articles: Articles, index
for (const file of files) {
const filename = file.toString()
if (filename.startsWith('.')) continue
const pathname = isExamples ? path.join(dir, filename, 'README.md') : path.join(dir, filename)
const fileContent = fs.readFileSync(pathname).toString()
const extension = path.extname(filename)