create-slidev 0.49.0-beta.1 → 0.49.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/template/package.json
CHANGED
package/template/slides.md
CHANGED
|
@@ -611,23 +611,20 @@ Add `{monaco}` to the code block to turn it into an editor:
|
|
|
611
611
|
|
|
612
612
|
```ts {monaco}
|
|
613
613
|
import { ref } from 'vue'
|
|
614
|
-
import
|
|
614
|
+
import { emptyArray } from './external'
|
|
615
615
|
|
|
616
|
-
const
|
|
616
|
+
const arr = ref(emptyArray(10))
|
|
617
617
|
```
|
|
618
618
|
|
|
619
619
|
Use `{monaco-run}` to create an editor that can execute the code directly in the slide:
|
|
620
620
|
|
|
621
621
|
```ts {monaco-run}
|
|
622
622
|
import { version } from 'vue'
|
|
623
|
+
import { emptyArray, sayHello } from './external'
|
|
623
624
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
: fibonacci(n - 1) + fibonacci(n - 2) // you know, this is NOT the best way to do it :P
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
console.log(version, Array.from({ length: 10 }, (_, i) => fibonacci(i + 1)))
|
|
625
|
+
sayHello()
|
|
626
|
+
console.log(`vue ${version}`)
|
|
627
|
+
console.log(emptyArray<number>(10).reduce(fib => [...fib, fib.at(-1)! + fib.at(-2)!], [1, 1]))
|
|
631
628
|
```
|
|
632
629
|
|
|
633
630
|
---
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
3
|
// #region snippet
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
// Inside ./snippets/external.ts
|
|
5
|
+
export function emptyArray<T>(length: number) {
|
|
6
|
+
return Array.from<T>({ length })
|
|
6
7
|
}
|
|
7
8
|
// #endregion snippet
|
|
8
9
|
|
|
9
|
-
export
|
|
10
|
+
export function sayHello() {
|
|
11
|
+
console.log('Hello from snippets/external.ts')
|
|
12
|
+
}
|