fb-slides 0.1.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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +225 -0
  3. package/bin/fb-slides.mjs +111 -0
  4. package/lib/build.mjs +98 -0
  5. package/lib/config.mjs +90 -0
  6. package/lib/create.mjs +59 -0
  7. package/lib/decks.mjs +13 -0
  8. package/lib/dev.mjs +94 -0
  9. package/lib/render.mjs +52 -0
  10. package/lib/server.mjs +168 -0
  11. package/lib/vendor.mjs +32 -0
  12. package/package.json +51 -0
  13. package/runtime/annotate.js +458 -0
  14. package/runtime/deck.js +299 -0
  15. package/runtime/index.html +37 -0
  16. package/runtime/outline.js +354 -0
  17. package/runtime/shortcuts.js +53 -0
  18. package/runtime/spotlight.js +293 -0
  19. package/runtime/theme.base.css +879 -0
  20. package/templates/starter/README.md +27 -0
  21. package/templates/starter/_gitignore +4 -0
  22. package/templates/starter/_package.json +14 -0
  23. package/templates/starter/assets/.gitkeep +0 -0
  24. package/templates/starter/decks/01-intro.md +44 -0
  25. package/templates/starter/decks/02-demos.md +34 -0
  26. package/templates/starter/demo/angular-hello/README.md +15 -0
  27. package/templates/starter/demo/angular-hello/_package.json +24 -0
  28. package/templates/starter/demo/angular-hello/angular.json +34 -0
  29. package/templates/starter/demo/angular-hello/src/index.html +12 -0
  30. package/templates/starter/demo/angular-hello/src/main.ts +18 -0
  31. package/templates/starter/demo/angular-hello/src/styles.css +22 -0
  32. package/templates/starter/demo/angular-hello/tsconfig.app.json +5 -0
  33. package/templates/starter/demo/angular-hello/tsconfig.json +17 -0
  34. package/templates/starter/demo/counter/index.html +34 -0
  35. package/templates/starter/slides.config.js +34 -0
  36. package/templates/starter/theme.css +14 -0
@@ -0,0 +1,27 @@
1
+ # __TITLE__
2
+
3
+ Slides built with [`__PKG__`](https://www.npmjs.com/package/__PKG__).
4
+
5
+ ```bash
6
+ npm install
7
+ npm run dev # http://localhost:4000
8
+ npm run build # → dist/
9
+ npm run preview # build, then serve dist/
10
+ ```
11
+
12
+ ## What is where
13
+
14
+ | | |
15
+ | --- | --- |
16
+ | `decks/*.md` | the talk. Drop a file in, delete one — there is no list to update |
17
+ | `demo/counter/` | a static page a slide embeds and runs |
18
+ | `demo/angular-hello/` | an app with its own dev server, started by `servers:` |
19
+ | `assets/` | images the Markdown links to |
20
+ | `theme.css` | colour overrides, loaded after the package's theme |
21
+ | `slides.config.js` | title, folders, signature, side servers — all optional |
22
+
23
+ The Angular demo needs its own install once — `npm --prefix demo/angular-hello install`.
24
+ Without it that one slide comes up empty and everything else works.
25
+
26
+ The deck engine itself is not in this repo: it comes from the package, so
27
+ `npm update __PKG__` brings new features to this talk and every other one.
@@ -0,0 +1,4 @@
1
+ node_modules/
2
+ dist/
3
+ .angular/
4
+ .DS_Store
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "__NAME__",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "fb-slides dev",
8
+ "build": "fb-slides build",
9
+ "preview": "fb-slides preview"
10
+ },
11
+ "devDependencies": {
12
+ "__PKG__": "__VERSION__"
13
+ }
14
+ }
File without changes
@@ -0,0 +1,44 @@
1
+ ---
2
+ marp: true
3
+ title: __TITLE__
4
+ section: Intro
5
+ ---
6
+
7
+ # __TITLE__
8
+
9
+ The subtitle goes here.
10
+
11
+ ---
12
+
13
+ ## A slide
14
+
15
+ A slide is whatever sits between two `---` lines.
16
+
17
+ - lists of three or more reveal one item at a time
18
+ - `?nofrag` shows them all at once
19
+ - an `#` h1 on its own makes a section divider
20
+
21
+ Note: this is a speaker note — only the speaker view (`S`) shows it.
22
+
23
+ ---
24
+
25
+ ## Code
26
+
27
+ The ranges in the fence are reveal's: one group per click.
28
+
29
+ ```js [1|3-5]
30
+ const deck = 'decks/*.md';
31
+
32
+ for (const slide of deck) {
33
+ render(slide);
34
+ }
35
+ ```
36
+
37
+ ---
38
+
39
+ ## A diagram
40
+
41
+ ```mermaid
42
+ flowchart LR
43
+ MD[Markdown] --> DECK[fb-slides] --> R[reveal.js]
44
+ ```
@@ -0,0 +1,34 @@
1
+ ---
2
+ marp: true
3
+ title: Demos
4
+ section: Demos
5
+ ---
6
+
7
+ <!-- demo: counter -->
8
+
9
+ ## A page, running on the slide
10
+
11
+ <iframe src="../demo/counter/" style="width:100%;height:60vh"></iframe>
12
+
13
+ ---
14
+
15
+ <!-- demo: http://localhost:4200/ -->
16
+
17
+ ## An app with its own dev server
18
+
19
+ <iframe src="http://localhost:4200/" style="width:100%;height:60vh"></iframe>
20
+
21
+ ---
22
+
23
+ ## How those two slides work
24
+
25
+ ```markdown
26
+ <!-- demo: counter --> a folder in demo/
27
+ <!-- demo: http://…:4200/ --> anything else
28
+ ```
29
+
30
+ - the marker must be the first thing in the slide
31
+ - what follows it is the fallback for GitHub and Marp
32
+ - `demo/angular-hello` is started by `servers:` in `slides.config.js`
33
+
34
+ Note: the iframe is reloaded every time you arrive on the slide, so a demo is always in its initial state.
@@ -0,0 +1,15 @@
1
+ # angular-hello
2
+
3
+ An Angular app on a slide. It is here to show the one thing a static page cannot:
4
+ a demo with its **own dev server**, started by `servers:` in `../../slides.config.js`
5
+ and embedded with `<!-- demo: http://localhost:4200/ -->`.
6
+
7
+ It needs its own install, once:
8
+
9
+ ```bash
10
+ npm --prefix demo/angular-hello install
11
+ ```
12
+
13
+ Until you do, `npm run dev` prints a warning and that one slide comes up empty.
14
+ Delete the folder — and the `servers:` entry, and the slide — if the talk has no
15
+ framework demo in it.
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "angular-hello",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "ng": "ng",
7
+ "start": "ng serve",
8
+ "build": "ng build"
9
+ },
10
+ "dependencies": {
11
+ "@angular/common": "^22.1.0",
12
+ "@angular/compiler": "^22.1.0",
13
+ "@angular/core": "^22.1.0",
14
+ "@angular/platform-browser": "^22.1.0",
15
+ "rxjs": "~7.8.0",
16
+ "tslib": "^2.3.0"
17
+ },
18
+ "devDependencies": {
19
+ "@angular/build": "^22.1.6",
20
+ "@angular/cli": "^22.1.6",
21
+ "@angular/compiler-cli": "^22.1.0",
22
+ "typescript": "~6.0.2"
23
+ }
24
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "projects": {
5
+ "angular-hello": {
6
+ "projectType": "application",
7
+ "root": "",
8
+ "sourceRoot": "src",
9
+ "prefix": "app",
10
+ "architect": {
11
+ "build": {
12
+ "builder": "@angular/build:application",
13
+ "options": {
14
+ "browser": "src/main.ts",
15
+ "index": "src/index.html",
16
+ "tsConfig": "tsconfig.app.json",
17
+ "styles": ["src/styles.css"]
18
+ },
19
+ "configurations": {
20
+ "development": { "optimization": false, "sourceMap": true }
21
+ },
22
+ "defaultConfiguration": "development"
23
+ },
24
+ "serve": {
25
+ "builder": "@angular/build:dev-server",
26
+ "configurations": {
27
+ "development": { "buildTarget": "angular-hello:build:development" }
28
+ },
29
+ "defaultConfiguration": "development"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>angular-hello</title>
6
+ <base href="/" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+ </head>
9
+ <body>
10
+ <app-root></app-root>
11
+ </body>
12
+ </html>
@@ -0,0 +1,18 @@
1
+ // A whole Angular app in one file: it exists to prove that a slide can embed an
2
+ // app with its own dev server, not just a static page. `servers:` in
3
+ // slides.config.js is what starts it alongside the deck.
4
+ import { Component, signal } from '@angular/core';
5
+ import { bootstrapApplication } from '@angular/platform-browser';
6
+
7
+ @Component({
8
+ selector: 'app-root',
9
+ template: `
10
+ <h1>Hello from Angular</h1>
11
+ <button (click)="count.set(count() + 1)">{{ count() }}</button>
12
+ `,
13
+ })
14
+ export class App {
15
+ readonly count = signal(0);
16
+ }
17
+
18
+ bootstrapApplication(App).catch((error) => console.error(error));
@@ -0,0 +1,22 @@
1
+ body {
2
+ margin: 0;
3
+ display: grid;
4
+ place-items: center;
5
+ align-content: center;
6
+ gap: 1rem;
7
+ height: 100vh;
8
+ background: #12151b;
9
+ color: #e8ebf0;
10
+ font-family: ui-sans-serif, system-ui, sans-serif;
11
+ }
12
+ h1 { font-size: clamp(20px, 4vw, 40px); font-weight: 650; margin: 0; }
13
+ button {
14
+ font: inherit;
15
+ font-size: clamp(16px, 3vw, 28px);
16
+ padding: 0.4em 1.1em;
17
+ border-radius: 14px;
18
+ border: 1px solid #2c333f;
19
+ background: #1a1f27;
20
+ color: #6ea8fe;
21
+ cursor: pointer;
22
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": { "types": [] },
4
+ "include": ["src/**/*.ts"]
5
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "compileOnSave": false,
3
+ "compilerOptions": {
4
+ "strict": true,
5
+ "skipLibCheck": true,
6
+ "isolatedModules": true,
7
+ "experimentalDecorators": true,
8
+ "importHelpers": true,
9
+ "target": "ES2022",
10
+ "module": "preserve"
11
+ },
12
+ "angularCompilerOptions": {
13
+ "strictInjectionParameters": true
14
+ },
15
+ "files": [],
16
+ "references": [{ "path": "./tsconfig.app.json" }]
17
+ }
@@ -0,0 +1,34 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>counter</title>
6
+ <style>
7
+ body {
8
+ margin: 0;
9
+ display: grid;
10
+ place-items: center;
11
+ height: 100vh;
12
+ background: #12151b;
13
+ color: #e8ebf0;
14
+ font: 500 clamp(18px, 5vw, 44px) / 1.4 ui-sans-serif, system-ui, sans-serif;
15
+ }
16
+ button {
17
+ font: inherit;
18
+ padding: 0.4em 1em;
19
+ border-radius: 14px;
20
+ border: 1px solid #2c333f;
21
+ background: #1a1f27;
22
+ color: #6ea8fe;
23
+ cursor: pointer;
24
+ }
25
+ </style>
26
+ </head>
27
+ <body>
28
+ <!-- Any page can go on a slide. This one is here to prove it is really running. -->
29
+ <button onclick="this.textContent = ++count">0</button>
30
+ <script>
31
+ let count = 0;
32
+ </script>
33
+ </body>
34
+ </html>
@@ -0,0 +1,34 @@
1
+ // Everything here is optional: delete the file and the defaults below apply.
2
+ export default {
3
+ title: '__TITLE__',
4
+ lang: 'en',
5
+
6
+ // Where the talk lives. Every .md in here becomes slides, in file-name order.
7
+ decks: 'decks',
8
+
9
+ // Folder behind a bare `<!-- demo: counter -->` marker in the Markdown.
10
+ demos: 'demo',
11
+
12
+ // Port `fb-slides dev` serves the deck on (`preview` uses the next one up).
13
+ // `--port n` on the command line wins over this.
14
+ port: 4000,
15
+
16
+ // Side processes `fb-slides dev` starts along with the deck — a demo that is a
17
+ // real app rather than a static page. Drop this key, the folder and the slide
18
+ // that embeds it if the talk has no framework demo in it.
19
+ servers: [
20
+ {
21
+ name: 'angular-hello',
22
+ cwd: 'demo/angular-hello',
23
+ command: 'npm',
24
+ args: ['start', '--', '--port', '4200'],
25
+ url: 'http://localhost:4200/',
26
+ },
27
+ ],
28
+
29
+ // The corner signature. Uncomment to show it.
30
+ // signature: { name: 'fabiobiondi.dev', url: 'https://www.fabiobiondi.dev', logo: 'assets/logo.png' },
31
+
32
+ // Passed straight to Reveal.initialize().
33
+ // reveal: { transition: 'fade', slideNumber: false },
34
+ };
@@ -0,0 +1,14 @@
1
+ /* Loaded after the package's theme.base.css — an override, not a replacement.
2
+ Redefining a token here reskins the whole deck. Delete this file if the
3
+ default dark theme is fine as it is. */
4
+
5
+ /*
6
+ :root {
7
+ --bg: #0e1116;
8
+ --card: #1a1f27;
9
+ --text: #e8ebf0;
10
+ --muted: #97a1b0;
11
+ --accent: #6ea8fe;
12
+ --accent-2: #7ee2b8;
13
+ }
14
+ */