feat(code-snippet): dispatch "expand" and "collapse" events (#1291)

* test(code-snippet): simply assertions

* feat(code-snippet): dispatch "expand," "collapse" events

* Run "yarn build:docs"

* test(code-snippet): assert events
This commit is contained in:
metonym 2022-05-12 19:52:31 -07:00 committed by GitHub
commit 1454eeae19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 56 deletions

View file

@ -1,4 +1,9 @@
<script>
/**
* @event {null} expand
* @event {null} collapse
*/
/**
* Set the type of code snippet
* @type {"single" | "inline" | "multi"}
@ -117,6 +122,7 @@
if (code === undefined) setShowMoreLess();
if (code) tick().then(setShowMoreLess);
}
$: if (type === "multi") dispatch(expanded ? "expand" : "collapse");
onMount(() => {
return () => clearTimeout(timeout);