@tblaisot/prez-as-adoc 0.0.2 → 0.1.0

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 (73) hide show
  1. package/.github/workflows/release.yml +12 -7
  2. package/README.adoc +2 -2
  3. package/asciidoctor/extensions/index.js +2 -0
  4. package/asciidoctor/extensions/slides_treeprocessor.js +41 -22
  5. package/asciidoctor/extensions/speaker_notes_treeprocessor.js +30 -35
  6. package/asciidoctor/templates/admonition.js +2 -3
  7. package/asciidoctor/templates/document.js +36 -37
  8. package/asciidoctor/templates/index.cjs +9 -0
  9. package/asciidoctor/templates/preamble.js +7 -8
  10. package/asciidoctor/templates/section.js +23 -24
  11. package/asciidoctor/templates/slide.js +13 -9
  12. package/asciidoctor/templates/speaker_note.js +8 -9
  13. package/asciidoctor/templates/title.js +15 -19
  14. package/{statics → bespoke}/assets/bespoke-speaker.html +3 -3
  15. package/bespoke/assets/grid.svg +32 -0
  16. package/{bespoke-plugins/bespoke-classes.js → bespoke/plugins/bespoke-classes-no-bespoke.js} +1 -1
  17. package/bespoke/plugins/bespoke-classes.js +39 -0
  18. package/{bespoke-plugins → bespoke/plugins}/bespoke-debug.js +3 -3
  19. package/{bespoke-plugins → bespoke/plugins}/bespoke-editor.js +2 -2
  20. package/{bespoke-plugins → bespoke/plugins}/bespoke-hash.js +1 -1
  21. package/{bespoke-plugins → bespoke/plugins}/bespoke-nav.js +1 -1
  22. package/{bespoke-plugins → bespoke/plugins}/bespoke-progress.js +1 -1
  23. package/{bespoke-plugins → bespoke/plugins}/bespoke-scale.js +1 -1
  24. package/bespoke/plugins/bespoke-speaker.js +113 -0
  25. package/{bespoke-plugins → bespoke/plugins}/bespoke-view-mode.js +11 -11
  26. package/bespoke/plugins/index.js +9 -0
  27. package/{statics → bespoke}/styles/blocks/progress.css +11 -11
  28. package/bespoke/styles/bullets/bullets.css +18 -0
  29. package/bespoke/styles/debug.css +9 -0
  30. package/bespoke/styles/deck/deck-editor.css +33 -0
  31. package/{statics → bespoke}/styles/deck/deck-full.css +1 -1
  32. package/{statics → bespoke}/styles/deck/deck-grid.css +2 -2
  33. package/{statics → bespoke}/styles/deck/deck-list.css +12 -5
  34. package/{statics → bespoke}/styles/deck/deck-pointless.css +1 -1
  35. package/{statics → bespoke}/styles/deck/deck-print.css +1 -1
  36. package/{statics → bespoke}/styles/deck/deck.css +2 -5
  37. package/{statics → bespoke}/styles/main.css +4 -0
  38. package/{statics → bespoke}/styles/slide/slide-full.css +2 -2
  39. package/{statics → bespoke}/styles/slide/slide-list.css +4 -5
  40. package/bespoke/styles/slide/slide.css +38 -0
  41. package/bespoke/styles/speaker/speaker.css +3 -0
  42. package/bin/prez-as-adoc.js +11 -5
  43. package/docs/README.adoc +333 -0
  44. package/docs/api-reference.adoc +1023 -0
  45. package/docs/architecture.adoc +382 -0
  46. package/docs/asciidoctor-components.adoc +522 -0
  47. package/docs/bespoke-components.adoc +819 -0
  48. package/docs/index.adoc +142 -0
  49. package/docs/usage-guide.adoc +940 -0
  50. package/docs/vite-integration.adoc +699 -0
  51. package/exemple/package.json +25 -0
  52. package/exemple/slide-templates/default-slide.html +7 -0
  53. package/exemple/slide-templates/title-slide-slide.html +8 -0
  54. package/exemple/src/index.adoc +70 -0
  55. package/exemple/src/index.html +16 -0
  56. package/exemple/src/scripts/main.js +44 -0
  57. package/exemple/src/styles/base.css +101 -0
  58. package/exemple/src/styles/main.css +7 -0
  59. package/exemple/src/styles/theme.css +62 -0
  60. package/exemple/vite.config.js +25 -0
  61. package/package.json +22 -10
  62. package/vite/plugins/README.adoc +302 -0
  63. package/vite/plugins/index.js +3 -0
  64. package/vite/plugins/prez-as-adoc-asciidoc-converter.js +57 -0
  65. package/vite/plugins/vite-plugin-prez-as-adoc.js +38 -0
  66. package/bespoke-plugins/bespoke-overview.js +0 -21
  67. package/bespoke-plugins/bespoke-speaker.js +0 -112
  68. package/statics/styles/debug.css +0 -9
  69. package/statics/styles/slide/slide.css +0 -28
  70. package/vitejs/plugins/prez-as-adoc-plugin.js +0 -114
  71. /package/{statics → bespoke}/assets/bespoke-speaker.css +0 -0
  72. /package/{statics → bespoke}/assets/bespoke-speaker.js +0 -0
  73. /package/{statics → bespoke}/styles/normalize.css +0 -0
@@ -2,17 +2,22 @@ name: Publish Package to npmjs
2
2
  on:
3
3
  release:
4
4
  types: [published]
5
+
6
+ permissions:
7
+ id-token: write # Required for OIDC
8
+ contents: read
9
+
5
10
  jobs:
6
- build:
11
+ publish:
7
12
  runs-on: ubuntu-latest
8
13
  steps:
9
- - uses: actions/checkout@v3
10
- # Setup .npmrc file to publish to npm
11
- - uses: actions/setup-node@v3
14
+ - uses: actions/checkout@v4
15
+
16
+ - uses: actions/setup-node@v4
12
17
  with:
13
- node-version: '16.x'
18
+ node-version: '24'
14
19
  registry-url: 'https://registry.npmjs.org'
15
20
  - run: npm ci
21
+ # - run: npm run build --if-present
22
+ # - run: npm test
16
23
  - run: npm publish --access public
17
- env:
18
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.adoc CHANGED
@@ -19,12 +19,12 @@ prez-as-adoc --base_dir=./src --to_dir=./dist --slides-templates=./slide-templat
19
19
  [source,bash]
20
20
  ----
21
21
  // vite.config.js
22
- import { prezAsAdocPlugin } from '@tblaisot/prez-as-adoc/vitejs/plugins/prez-as-adoc-plugin.js'
22
+ import { prezAsAdoc } from '@tblaisot/prez-as-adoc/vite/plugins'
23
23
  import { defineConfig } from 'vite'
24
24
 
25
25
  export default defineConfig({
26
26
  plugins: [
27
- prezAsAdocPlugin({slidesTemplates: ['./slide-templates']})
27
+ prezAsAdoc({ slidesTemplates: ['./slide-templates'] })
28
28
  ]
29
29
  })
30
30
  ----
@@ -0,0 +1,2 @@
1
+ export * as slidesTreeprocessor from "./slides_treeprocessor.js";
2
+ export * as speakerNotesTreeprocessor from "./speaker_notes_treeprocessor.js";
@@ -1,7 +1,8 @@
1
1
  import {HELPERS} from "@tblaisot/asciidoctorjs-templates-js";
2
- const {sectionTitle, slice_text, $h, $div} = HELPERS;
3
2
 
4
- function debugAST(node) {
3
+ const {sectionTitle, slice_text, isEmptyString} = HELPERS;
4
+
5
+ export function debugAST(node) {
5
6
  return {
6
7
  context: node.getContext(),
7
8
  blocks: node.getBlocks().map(n => debugAST(n)),
@@ -29,17 +30,27 @@ export function register(registry) {
29
30
  // })
30
31
 
31
32
  function recurse(node) {
32
- const sections = node.getSections()
33
+ const sections = node.getSections();
33
34
  if (sections.length === 0) return;
34
35
  sections.forEach((section) => {
35
- const slide = self.createBlock(document, 'slide', '', {
36
- ...section.getAttributes(),
37
- level: section.getLevel()
38
- });
39
- const title = self.createBlock(slide, 'title', sectionTitle(section), {
40
- level: section.getLevel(),
41
- slot: 'title'
42
- });
36
+ const slide = self.createBlock(
37
+ document,
38
+ 'slide',
39
+ '',
40
+ {
41
+ ...section.getAttributes(),
42
+ level: section.getLevel()
43
+ }
44
+ );
45
+ const title = self.createBlock(
46
+ slide,
47
+ 'title',
48
+ sectionTitle(section),
49
+ {
50
+ level: section.getLevel(),
51
+ slot: 'title'
52
+ }
53
+ );
43
54
  slide.getBlocks().push(title)
44
55
  section.getBlocks().forEach((block) => {
45
56
  slide.getBlocks().push(block);
@@ -47,7 +58,7 @@ export function register(registry) {
47
58
  node.getBlocks().splice(node.getBlocks().indexOf(section), 1); // remove node from parent
48
59
  document.getBlocks().push(slide); // push slide to first level of the document
49
60
  recurse(slide)
50
- })
61
+ });
51
62
  }
52
63
 
53
64
  recurse(document)
@@ -56,10 +67,16 @@ export function register(registry) {
56
67
  // create title slide
57
68
  const attrName = document.getAttribute('slide-template-attr', 'slide-template', 'slide-template-attr');
58
69
 
59
- const title_slide = self.createBlock(document, 'slide', '', {
60
- [attrName]: 'title-slide', ...document.getAttributes(),
61
- level: 0
62
- });
70
+ const title_slide = self.createBlock(
71
+ document,
72
+ 'slide',
73
+ '',
74
+ {
75
+ [attrName]: 'title-slide',
76
+ ...document.getAttributes(),
77
+ level: 0
78
+ }
79
+ );
63
80
 
64
81
  const _title_obj = document.getDoctitle({partition: true, use_fallback: true});
65
82
  if (_title_obj.subtitle) {
@@ -68,12 +85,15 @@ export function register(registry) {
68
85
  level: 1,
69
86
  slot: 'title'
70
87
  });
71
- const title2 = self.createBlock(title_slide, 'title', slice_text(_title_obj.subtitle, _slice), {
72
- level: 2,
73
- slot: 'subtitle'
74
- });
75
88
  title_slide.getBlocks().push(title1)
76
- title_slide.getBlocks().push(title2)
89
+ const subtitle = slice_text(_title_obj.subtitle, _slice);
90
+ if (!isEmptyString(subtitle)) {
91
+ const title2 = self.createBlock(title_slide, 'title', subtitle, {
92
+ level: 2,
93
+ slot: 'subtitle'
94
+ });
95
+ title_slide.getBlocks().push(title2)
96
+ }
77
97
  } else {
78
98
  const title = self.createBlock(title_slide, 'title', document.getHeader().getTitle(), {
79
99
  level: 1,
@@ -89,7 +109,6 @@ export function register(registry) {
89
109
 
90
110
  // remove preamble block from document
91
111
  document.getBlocks().splice(document.getBlocks().findIndex(b => b === preambles[0]), 1);
92
-
93
112
  return document;
94
113
  })
95
114
  })
@@ -1,40 +1,35 @@
1
+
1
2
  export function register(registry) {
2
- registry.treeProcessor(function () {
3
- const self = this
4
- self.process(function (document) {
5
- function recurse(node) {
6
- const sections = node.getSections()
7
- if(sections.length === 0) return;
8
- sections.forEach((section) => {
9
- section.findBy()
10
- recurse(slide)
11
- })
12
- }
3
+ registry.treeProcessor(function () {
4
+ const self = this
13
5
 
14
- recurse(document)
15
- document.findBy({context: 'open'}).forEach((node) => {
16
- if (node.hasRole('aside') || node.hasRole('speaker') || node.hasRole('notes')) {
17
- const note = self.createBlock(document, 'speaker_note', '', {...node.getAttributes()});
18
- const blocks = node.getParent().getBlocks()
19
- const node_idx = blocks.indexOf(node)
20
- node.getBlocks().forEach((block) => {
21
- note.getBlocks().push(block);
22
- })
23
- blocks[node_idx] = note;
24
- }
25
- })
26
- document.findBy({context: 'admonition'}).forEach((node) => {
27
- if (node.hasRole('aside') || node.hasRole('speaker') || node.hasRole('notes')) {
28
- const note = self.createBlock(document, 'speaker_note', '', {...node.getAttributes()});
29
- const blocks = node.getParent().getBlocks()
30
- const node_idx = blocks.indexOf(node)
31
- node.getBlocks().forEach((block) => {
32
- note.getBlocks().push(block);
33
- })
34
- blocks[node_idx] = note;
6
+ function replaceNodeWithSpeakerNoteNode(node){
7
+ const note = self.createBlock(node.getParent(), 'speaker_note', '', {...node.getAttributes()});
8
+ const parentBlocks = node.getParent().getBlocks();
9
+ node.getBlocks().forEach((block) => {
10
+ note.getBlocks().push(block);
11
+ });
12
+ parentBlocks[parentBlocks.indexOf(node)]=note; // replace node from parent
35
13
  }
36
- })
37
- return document;
14
+
15
+ self.process(function (document) {
16
+ document.findBy({context: 'open'}).forEach((node) => {
17
+ if (node.hasRole('speaker') || node.hasRole('notes')) {
18
+ replaceNodeWithSpeakerNoteNode(node);
19
+ }
20
+ });
21
+ document.findBy({context: 'admonition'}).forEach((node) => {
22
+ if (node.hasRole('speaker') || node.hasRole('notes')) {
23
+ replaceNodeWithSpeakerNoteNode(node);
24
+ }
25
+ });
26
+ document.findBy({context: 'sidebar'}).forEach((node) => {
27
+ if (node.hasRole('speaker') || node.hasRole('notes')) {
28
+ replaceNodeWithSpeakerNoteNode(node);
29
+ }
30
+ });
31
+ return document;
32
+ });
33
+
38
34
  })
39
- })
40
35
  }
@@ -1,6 +1,5 @@
1
- const {HELPERS, TEMPLATES} = require("@tblaisot/asciidoctorjs-templates-js");
2
- const {admonition: admonition_template} = TEMPLATES;
3
- const {$aside} = HELPERS;
1
+ const {admonition: admonition_template} = require("@tblaisot/asciidoctorjs-templates-js/templates");
2
+ const {$aside} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
4
3
 
5
4
  module.exports = function ({node}) {
6
5
  if (node.hasRole('speaker')) {
@@ -1,52 +1,51 @@
1
- const {HELPERS, TEMPLATES} = require("@tblaisot/asciidoctorjs-templates-js");
2
- const {$, $metaIf, toAttribute, toAttributes,isEmptyString} = HELPERS;
1
+ const {$, $metaIf, toAttribute, toAttributes, isEmptyString} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
3
2
 
4
3
  function getFavicon(node) {
5
- let favicon = ''
6
- if (node.document.hasAttribute('favicon')) {
7
- let icon_href = node.document.getAttribute('favicon');
8
- if (isEmptyString(icon_href)) {
9
- icon_href = 'favicon.ico';
4
+ let favicon = ''
5
+ if (node.document.hasAttribute('favicon')) {
6
+ let icon_href = node.document.getAttribute('favicon');
7
+ if (isEmptyString(icon_href)) {
8
+ icon_href = 'favicon.ico';
9
+ }
10
+ const icon_ext = icon_href.split('.').pop();
11
+ const icon_type = icon_ext === 'ico' ? 'image/x-icon' : `image/${icon_ext}`;
12
+ favicon = $('link', {rel: "icon", type: icon_type, href: icon_href});
10
13
  }
11
- const icon_ext = icon_href.split('.').pop();
12
- const icon_type = icon_ext === 'ico' ? 'image/x-icon' : `image/${icon_ext}`;
13
- favicon = $('link', {rel: "icon", type: icon_type, href: icon_href});
14
- }
15
- return favicon
14
+ return favicon
16
15
  }
17
16
 
18
17
  // false needs to be verbatim everything else is a string.
19
18
  // Calling side isn't responsible for quoting so we are doing it here
20
19
  function toValidSlideNumber(val) {
21
- // corner case: empty is empty attribute which is true
22
- if (val === "") {
23
- return true;
24
- }
25
- // using toString here handles both the 'false' string and the false boolean
26
- return val.toString() === 'false' ? false : `'${val}'`
20
+ // corner case: empty is empty attribute which is true
21
+ if (val === "") {
22
+ return true;
23
+ }
24
+ // using toString here handles both the 'false' string and the false boolean
25
+ return val.toString() === 'false' ? false : `'${val}'`
27
26
  }
28
27
 
29
28
  /**
30
29
  * Returns formatted style/link and script tags for header.
31
30
  */
32
31
  module.exports = function ({node}) {
33
- const document_content = node.getContent();
34
- let docinfo_content_header = node.getDocinfo('header', '.html');
35
- let docinfo_content_head = node.getDocinfo('head', '.html');
36
- let docinfo_content_footer = node.getDocinfo('footer', '.html');
32
+ const document_content = node.getContent();
33
+ let docinfo_content_header = node.getDocinfo('header', '.html');
34
+ let docinfo_content_head = node.getDocinfo('head', '.html');
35
+ let docinfo_content_footer = node.getDocinfo('footer', '.html');
37
36
 
38
37
 
39
- if (node.getNoheader() || isEmptyString(docinfo_content_header)) {
40
- docinfo_content_header = '';
41
- }
42
- if (isEmptyString(docinfo_content_footer)) {
43
- docinfo_content_footer = '';
44
- }
38
+ if (node.getNoheader() || isEmptyString(docinfo_content_header)) {
39
+ docinfo_content_header = '';
40
+ }
41
+ if (isEmptyString(docinfo_content_footer)) {
42
+ docinfo_content_footer = '';
43
+ }
45
44
 
46
- const scripts=node.getAttribute('scripts', '').split(',').map(script => `<script type="module" src="${script}"></script>`)
47
- const stylesheets=node.getAttribute('stylesheets', '').split(',').map(style => `<link rel="stylesheet" type="text/css" href="${style}">`)
45
+ const scripts = node.getAttribute('scripts', '').split(',').map(script => `<script type="module" src="${script}"></script>`)
46
+ const stylesheets = node.getAttribute('stylesheets', '').split(',').map(style => `<link rel="stylesheet" type="text/css" href="${style}">`)
48
47
 
49
- return `
48
+ return `
50
49
  <!DOCTYPE html>
51
50
  <html ${toAttribute('lang', node.hasAttribute('nolang') ? '' : node.getAttribute('lang', 'en'))}>
52
51
  <head>
@@ -64,12 +63,12 @@ module.exports = function ({node}) {
64
63
  ${docinfo_content_head}
65
64
  </head>
66
65
  <body ${toAttributes({
67
- id: node.getId(),
68
- class: [
69
- node.getAttribute('doctype'),
70
- node.getAttribute('docrole') || node.getAttribute('role'),
71
- ]
72
- })}>
66
+ id: node.getId(),
67
+ class: [
68
+ node.getAttribute('doctype'),
69
+ node.getAttribute('docrole') || node.getAttribute('role'),
70
+ ]
71
+ })}>
73
72
  ${docinfo_content_header}
74
73
  <div class="slides">
75
74
  <!-- START CONTENT -->
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ admonition: require('./admonition.js'),
3
+ document: require('./document.js'),
4
+ preamble: require('./preamble.js'),
5
+ section: require('./section.js'),
6
+ slide: require('./slide.js'),
7
+ speaker_note: require('./speaker_note.js'),
8
+ title: require('./title.js'),
9
+ }
@@ -1,11 +1,10 @@
1
- const {HELPERS, TEMPLATES} = require("@tblaisot/asciidoctorjs-templates-js");
2
- const {$section} = HELPERS;
1
+ const {$section} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
3
2
 
4
3
  module.exports = function ({node}) {
5
- return $section({
6
- id: 'preamble',
7
- 'aria-label': 'Preamble'
8
- },
9
- node.getContent()
10
- );
4
+ return $section({
5
+ id: 'preamble',
6
+ 'aria-label': 'Preamble'
7
+ },
8
+ node.getContent()
9
+ );
11
10
  }
@@ -1,29 +1,28 @@
1
- const {HELPERS, TEMPLATES} = require("@tblaisot/asciidoctor-js-templates");
2
- const {$h, $a, $section, sectionTitle,isDefined} = HELPERS;
1
+ const {$h, $a, $section, sectionTitle, isDefined} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
3
2
 
4
3
  module.exports = function ({node}) {
5
- let content = '';
6
- if (isDefined(node.getId())) {
7
- if (node.document.hasAttribute('sectanchors')) {
8
- content += $a({class: "anchor", href: `#${node.getId()}`, 'aria-hidden': "true"})
9
- }
10
- if (node.document.hasAttribute('sectlinks')) {
11
- content += $a({class: "link", href: `#${node.getId()}`}, sectionTitle(node))
4
+ let content = '';
5
+ if (isDefined(node.getId())) {
6
+ if (node.document.hasAttribute('sectanchors')) {
7
+ content += $a({class: "anchor", href: `#${node.getId()}`, 'aria-hidden': "true"})
8
+ }
9
+ if (node.document.hasAttribute('sectlinks')) {
10
+ content += $a({class: "link", href: `#${node.getId()}`}, sectionTitle(node))
11
+ } else {
12
+ content += sectionTitle(node)
13
+ }
12
14
  } else {
13
- content += sectionTitle(node)
15
+ content += sectionTitle(node)
14
16
  }
15
- } else {
16
- content += sectionTitle(node)
17
- }
18
- return $section({
19
- class: ['doc-section', `level-${node.getLevel()}`, node.getRole()],
20
- },
21
- $h({
22
- level: node.getLevel() + 1,
23
- id: node.getId()
24
- },
25
- content
26
- ),
27
- node.getContent()
28
- )
17
+ return $section({
18
+ class: ['doc-section', `level-${node.getLevel()}`, node.getRole()],
19
+ },
20
+ $h({
21
+ level: node.getLevel() + 1,
22
+ id: node.getId()
23
+ },
24
+ content
25
+ ),
26
+ node.getContent()
27
+ )
29
28
  }
@@ -1,13 +1,12 @@
1
1
  const {resolve} = require("path");
2
2
  const {readFileSync, existsSync} = require("fs");
3
- const {HELPERS, TEMPLATES} = require("@tblaisot/asciidoctorjs-templates-js");
4
- const {$, isEmptyString} = HELPERS;
3
+ const {$, isEmptyString} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
5
4
 
6
5
  function resolveTemplate(paths, templateName) {
7
6
  // find in folders
8
- for(let path of paths){
9
- const templatePath = resolve(path,`${templateName}-slide.html`)
10
- if(existsSync(templatePath)){
7
+ for (let path of paths) {
8
+ const templatePath = resolve(path, `${templateName}-slide.html`)
9
+ if (existsSync(templatePath)) {
11
10
  return readFileSync(templatePath, {encoding: 'utf-8'});
12
11
  }
13
12
  }
@@ -20,12 +19,17 @@ module.exports = function ({node}) {
20
19
  const template = node.getAttribute(templateAttrName, defaultTemplate);
21
20
 
22
21
  let slideContent = '';
22
+ let notesContent = '';
23
+
24
+ const contentNodes = node.getBlocks().filter(n=>n.getContext()!=='speaker_note');
25
+ const speakerNotesNodes = node.getBlocks().filter(n=>n.getContext()==='speaker_note');
23
26
 
24
27
  if (isEmptyString(template)) {
25
28
  slideContent = node.getBlocks().map(n => n.convert()).join('\n')
26
29
  } else {
27
30
  slideContent = resolveTemplate(node.document.getAttribute('slide-template-dirs'), template);
28
- const blockBySlot = node.getBlocks().reduce(
31
+ notesContent = speakerNotesNodes.map(n => n.convert()).join('\n');
32
+ const blockBySlot = contentNodes.reduce(
29
33
  (acc, n) => {
30
34
  const slot = n.getAttribute('slot') || 'default'
31
35
  if (!acc[slot]) {
@@ -36,11 +40,11 @@ module.exports = function ({node}) {
36
40
  },
37
41
  {});
38
42
  // Special slot
39
- blockBySlot['all'] = node.getBlocks();
43
+ blockBySlot['all'] = contentNodes;
40
44
  Object.entries(blockBySlot).forEach(([slotname, blocks]) => {
41
45
  const content = $(blocks.map(n => n.convert()));
42
46
  slideContent = slideContent.replace(`<!-- slot=${slotname} -->`, content);
43
- })
47
+ });
44
48
  }
45
49
  return $('section', {
46
50
  class: [
@@ -49,6 +53,6 @@ module.exports = function ({node}) {
49
53
  node.getRole()
50
54
  ]
51
55
  },
52
- slideContent
56
+ slideContent + notesContent
53
57
  );
54
58
  }
@@ -1,12 +1,11 @@
1
- const {HELPERS, TEMPLATES} = require("@tblaisot/asciidoctorjs-templates-js");
2
- const {$} = HELPERS;
1
+ const {$} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
3
2
 
4
3
  module.exports = function ({node}) {
5
- return $('aside',
6
- {
7
- id: node.getId(),
8
- class: ['speaker-notes'],
9
- },
10
- node.getBlocks().map(block => block.convert()).join('\n')
11
- )
4
+ return $('aside',
5
+ {
6
+ id: node.getId(),
7
+ class: ['speaker-notes'],
8
+ },
9
+ node.getBlocks().map(block => block.convert()).join('\n')
10
+ )
12
11
  }
@@ -1,24 +1,20 @@
1
- const {HELPERS, TEMPLATES} = require("@tblaisot/asciidoctorjs-templates-js");
2
- const {$, $h, $a, isDefined, sectionTitle} = HELPERS;
1
+ const {$h, $a, isDefined} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
3
2
 
4
3
  module.exports = function ({node}) {
5
- let content = '';
6
- if (isDefined(node.getId())) {
7
- if (node.document.hasAttribute('sectanchors')) {
8
- content += $a({class: "anchor", href: `#${node.getId()}`, 'aria-hidden': "true"})
9
- }
10
- if (node.document.hasAttribute('sectlinks')) {
11
- content += $a({class: "link", href: `#${node.getId()}`}, node.getContent())
4
+ let content = '';
5
+ if (isDefined(node.getId())) {
6
+ if (node.document.hasAttribute('sectanchors')) {
7
+ content += $a({class: "anchor", href: `#${node.getId()}`, 'aria-hidden': "true"})
8
+ }
9
+ if (node.document.hasAttribute('sectlinks')) {
10
+ content += $a({class: "link", href: `#${node.getId()}`}, node.getContent())
11
+ } else {
12
+ content += node.getContent()
13
+ }
12
14
  } else {
13
- content += node.getContent()
15
+ content += node.getContent()
14
16
  }
15
- } else {
16
- content += node.getContent()
17
- }
18
- return $h({
19
- level: node.getAttribute('level') + 1,
20
- id: node.getId()
21
- },
22
- content
23
- );
17
+ return $h({
18
+ level: node.getAttribute('level') + 1, id: node.getId()
19
+ }, content);
24
20
  }
@@ -4,19 +4,19 @@
4
4
  <head>
5
5
  <meta charset="utf-8">
6
6
  <title>Speaker View</title>
7
- <link rel="stylesheet" href="/css/main.css">
7
+ <!-- <link rel="stylesheet" href="/css/main.css"> &lt;!&ndash; fixme &ndash;&gt;-->
8
8
  <link rel="stylesheet" href="./bespoke-speaker.css">
9
9
  <!-- <link rel="stylesheet" href="./bespoke-speaker-overrides.css">-->
10
10
  </head>
11
11
 
12
12
  <body>
13
13
  <div id="present-container">
14
- <div class="slides full" id="present">
14
+ <div class="slides full speaker speaker--present" id="present">
15
15
  <!-- <div id="present-content"></div>-->
16
16
  </div>
17
17
  </div>
18
18
  <div id="future-container">
19
- <div class="slides full" id="future">
19
+ <div class="slides full speaker speaker--future" id="future">
20
20
  <!-- <div id="future-content"></div>-->
21
21
  </div>
22
22
  </div>
@@ -0,0 +1,32 @@
1
+ <svg width="1024" height="768" xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <style>
4
+ .square {
5
+ stroke: red;
6
+ stroke-opacity: 0.1;
7
+ stroke-width: 1;
8
+ fill: transparent;
9
+ }
10
+
11
+ .grid {
12
+ fill: url(#grid);
13
+ }
14
+
15
+ .line {
16
+ stroke: #8af8f9;
17
+ }
18
+ </style>
19
+ <pattern x="0" y="0" width="25" height="25" viewBox="0 0 25 25" patternUnits="userSpaceOnUse" id="grid">
20
+ <rect x="0" y="0" width="25" height="25" class="square"/>
21
+ </pattern>
22
+ </defs>
23
+
24
+ <rect x="0" y="0" width="1024" height="768" class="grid"/>
25
+
26
+ <line x1="100" x2="100" y1="0" y2="768" class="line"/>
27
+ <line x1="475" x2="475" y1="0" y2="768" class="line"/>
28
+ <line x1="550" x2="550" y1="0" y2="768" class="line"/>
29
+ <line x1="925" x2="925" y1="0" y2="768" class="line"/>
30
+
31
+ <line y1="125" y2="125" x1="0" x2="1024" class="line"/>
32
+ </svg>
@@ -1,4 +1,4 @@
1
- export default function () {
1
+ export function classesNoBespoke () {
2
2
  return function (deck) {
3
3
  function addClass(el, cls) {
4
4
  el.classList.add(cls);
@@ -0,0 +1,39 @@
1
+ export function classes (config = {prefix: 'bespoke-'}) {
2
+ return function (deck) {
3
+ function addClass(el, cls) {
4
+ el.classList.add(config.prefix + cls);
5
+ }
6
+
7
+ function removeClass(el, cls) {
8
+ el.classList.remove(config.prefix + cls)
9
+ }
10
+
11
+ function deactivate(el, index) {
12
+ const activeSlide = deck.slides[deck.slide()];
13
+ const offset = index - deck.slide();
14
+ const offsetClass = offset > 0 ? 'after' : 'before';
15
+
16
+ removeClass(el, 'active');
17
+ removeClass(el, 'inactive');
18
+ removeClass(el, 'before');
19
+ removeClass(el, 'after');
20
+
21
+ if (el !== activeSlide) {
22
+ addClass(el, 'inactive');
23
+ addClass(el, offsetClass);
24
+ }
25
+ }
26
+
27
+ addClass(deck.parent, 'parent');
28
+
29
+ deck.slides.map(function (el) {
30
+ addClass(el, 'slide');
31
+ });
32
+
33
+ deck.on('activate', function (e) {
34
+ deck.slides.map(deactivate);
35
+ addClass(e.slide, 'active');
36
+ removeClass(e.slide, 'inactive');
37
+ });
38
+ };
39
+ };