@tblaisot/prez-as-adoc 0.0.3 → 0.2.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.
- package/.github/workflows/release.yml +12 -7
- package/README.adoc +1 -1
- package/asciidoctor/extensions/slides_treeprocessor.js +71 -32
- package/asciidoctor/extensions/speaker_notes_treeprocessor.js +30 -35
- package/asciidoctor/templates/section.js +2 -1
- package/asciidoctor/templates/slide.js +15 -6
- package/asciidoctor/templates/title.js +3 -1
- package/{statics → bespoke}/assets/bespoke-speaker.html +3 -3
- package/bespoke/assets/grid.svg +32 -0
- package/{bespoke-plugins/bespoke-classes.js → bespoke/plugins/bespoke-classes-no-bespoke.js} +1 -1
- package/bespoke/plugins/bespoke-classes.js +39 -0
- package/{bespoke-plugins → bespoke/plugins}/bespoke-debug.js +3 -3
- package/{bespoke-plugins → bespoke/plugins}/bespoke-hash.js +1 -1
- package/bespoke/plugins/bespoke-highlight.js +23 -0
- package/{bespoke-plugins → bespoke/plugins}/bespoke-nav.js +1 -1
- package/{bespoke-plugins → bespoke/plugins}/bespoke-progress.js +1 -1
- package/{bespoke-plugins → bespoke/plugins}/bespoke-scale.js +1 -1
- package/bespoke/plugins/bespoke-speaker-view.js +789 -0
- package/{bespoke-plugins → bespoke/plugins}/bespoke-view-mode.js +11 -11
- package/bespoke/plugins/index.js +9 -0
- package/{statics → bespoke}/styles/blocks/progress.css +12 -12
- package/bespoke/styles/bullets/bullets.css +10 -0
- package/bespoke/styles/debug.css +13 -0
- package/{statics → bespoke}/styles/deck/deck-full.css +1 -1
- package/{statics → bespoke}/styles/deck/deck-grid.css +2 -2
- package/{statics → bespoke}/styles/deck/deck-list.css +13 -7
- package/{statics → bespoke}/styles/deck/deck-pointless.css +1 -1
- package/{statics → bespoke}/styles/deck/deck-print.css +1 -1
- package/{statics → bespoke}/styles/deck/deck.css +1 -5
- package/bespoke/styles/main.css +16 -0
- package/bespoke/styles/print/print.css +75 -0
- package/{statics → bespoke}/styles/slide/slide-full.css +2 -2
- package/{statics → bespoke}/styles/slide/slide-list.css +9 -5
- package/bespoke/styles/slide/slide.css +35 -0
- package/bespoke/styles/speaker-notes/speaker-notes.css +3 -0
- package/bespoke/styles/speaker-view/bullet.css +15 -0
- package/bespoke/styles/speaker-view/speaker-view.css +387 -0
- package/bin/prez-as-adoc.js +11 -5
- package/docs/README.adoc +333 -0
- package/docs/api-reference.adoc +1023 -0
- package/docs/architecture.adoc +382 -0
- package/docs/asciidoctor-components.adoc +522 -0
- package/docs/bespoke-components.adoc +819 -0
- package/docs/index.adoc +142 -0
- package/docs/usage-guide.adoc +940 -0
- package/docs/vite-integration.adoc +699 -0
- package/exemple/package.json +25 -0
- package/exemple/slide-templates/deck-title-slide.html +8 -0
- package/exemple/slide-templates/default-slide.html +7 -0
- package/exemple/src/index.adoc +70 -0
- package/exemple/src/index.html +16 -0
- package/exemple/src/scripts/main.js +44 -0
- package/exemple/src/styles/base.css +101 -0
- package/exemple/src/styles/main.css +7 -0
- package/exemple/src/styles/theme.css +62 -0
- package/exemple/vite.config.js +25 -0
- package/index.js +1 -0
- package/package.json +27 -12
- package/slides-templates/styles/deck-title-slide.css +18 -0
- package/slides-templates/styles/default-slide.css +47 -0
- package/slides-templates/styles/hidden-title.css +12 -0
- package/slides-templates/styles/main.css +8 -0
- package/slides-templates/styles/title-only-slide.css +19 -0
- package/slides-templates/styles/title-subtitle-slide.css +27 -0
- package/slides-templates/styles/two-columns-slide.css +45 -0
- package/slides-templates/styles/two-columns-title-slide.css +49 -0
- package/slides-templates/styles/variables.css +43 -0
- package/slides-templates/templates/deck-title-slide.html +9 -0
- package/slides-templates/templates/default-slide.html +7 -0
- package/slides-templates/templates/grid-4-slide.html +19 -0
- package/slides-templates/templates/two-columns-slide.html +13 -0
- package/slides-templates/templates/two-columns-title-slide.html +13 -0
- package/themes/default/admonitions.css +101 -0
- package/themes/default/code.css +3 -0
- package/themes/default/images.css +26 -0
- package/themes/default/lists.css +19 -0
- package/themes/default/main.css +7 -0
- package/themes/default/slide.css +8 -0
- package/themes/default/table.css +26 -0
- package/themes/default/utils.css +15 -0
- package/themes/default-dark/main.css +59 -0
- package/themes/default-light/main.css +58 -0
- package/vite/plugins/README.adoc +302 -0
- package/vite/plugins/folder-resolver.js +40 -0
- package/vite/plugins/index.js +3 -0
- package/vite/plugins/prez-as-adoc-asciidoc-converter.js +69 -0
- package/vite/plugins/vite-plugin-prez-as-adoc.js +38 -0
- package/bespoke-plugins/bespoke-editor.js +0 -96
- package/bespoke-plugins/bespoke-overview.js +0 -21
- package/bespoke-plugins/bespoke-speaker.js +0 -112
- package/bespoke-plugins/index.js +0 -9
- package/statics/styles/debug.css +0 -9
- package/statics/styles/main.css +0 -6
- package/statics/styles/slide/slide.css +0 -28
- package/vite-plugins/index.js +0 -1
- package/vite-plugins/prez-as-adoc-plugin.js +0 -115
- /package/{statics → bespoke}/assets/bespoke-speaker.css +0 -0
- /package/{statics → bespoke}/assets/bespoke-speaker.js +0 -0
- /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
|
-
|
|
11
|
+
publish:
|
|
7
12
|
runs-on: ubuntu-latest
|
|
8
13
|
steps:
|
|
9
|
-
- uses: actions/checkout@
|
|
10
|
-
|
|
11
|
-
- uses: actions/setup-node@
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
12
17
|
with:
|
|
13
|
-
node-version: '
|
|
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,7 +19,7 @@ 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 { prezAsAdoc } from '@tblaisot/prez-as-adoc/vite
|
|
22
|
+
import { prezAsAdoc } from '@tblaisot/prez-as-adoc/vite/plugins'
|
|
23
23
|
import { defineConfig } from 'vite'
|
|
24
24
|
|
|
25
25
|
export default defineConfig({
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import {HELPERS} from "@tblaisot/asciidoctorjs-templates-js";
|
|
2
|
-
const {sectionTitle, slice_text, $h, $div} = HELPERS;
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
const {sectionTitle, slice_text, isEmptyString} = HELPERS;
|
|
4
|
+
|
|
5
|
+
const NO_TITLE = '!';
|
|
6
|
+
|
|
7
|
+
export function debugAST(node) {
|
|
5
8
|
return {
|
|
6
9
|
context: node.getContext(),
|
|
10
|
+
role: node.getRole(),
|
|
11
|
+
attributes: node.getAttributes(),
|
|
7
12
|
blocks: node.getBlocks().map(n => debugAST(n)),
|
|
8
13
|
}
|
|
9
14
|
}
|
|
@@ -11,6 +16,7 @@ function debugAST(node) {
|
|
|
11
16
|
export function register(registry) {
|
|
12
17
|
registry.treeProcessor(function () {
|
|
13
18
|
const self = this
|
|
19
|
+
|
|
14
20
|
self.process(function (document) {
|
|
15
21
|
|
|
16
22
|
// document.findBy({context: 'page_break'}).forEach((node) => {
|
|
@@ -29,25 +35,44 @@ export function register(registry) {
|
|
|
29
35
|
// })
|
|
30
36
|
|
|
31
37
|
function recurse(node) {
|
|
32
|
-
const sections = node.getSections()
|
|
38
|
+
const sections = node.getSections();
|
|
33
39
|
if (sections.length === 0) return;
|
|
34
40
|
sections.forEach((section) => {
|
|
35
|
-
const slide = self.createBlock(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const slide = self.createBlock(
|
|
42
|
+
document,
|
|
43
|
+
'slide',
|
|
44
|
+
'',
|
|
45
|
+
{
|
|
46
|
+
...section.getAttributes(),
|
|
47
|
+
level: section.getLevel()
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const section_title = sectionTitle(section);
|
|
52
|
+
const title = self.createBlock(
|
|
53
|
+
slide,
|
|
54
|
+
'title',
|
|
55
|
+
section_title,
|
|
56
|
+
{
|
|
57
|
+
level: section.getLevel(),
|
|
58
|
+
slot: 'title'
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
if (section_title === NO_TITLE
|
|
62
|
+
|| section.isOption('notitle')
|
|
63
|
+
|| section.isOption('conceal')) {
|
|
64
|
+
slide.addRole('hidden-title');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
slide.getBlocks().push(title);
|
|
68
|
+
|
|
44
69
|
section.getBlocks().forEach((block) => {
|
|
45
70
|
slide.getBlocks().push(block);
|
|
46
71
|
})
|
|
47
72
|
node.getBlocks().splice(node.getBlocks().indexOf(section), 1); // remove node from parent
|
|
48
73
|
document.getBlocks().push(slide); // push slide to first level of the document
|
|
49
74
|
recurse(slide)
|
|
50
|
-
})
|
|
75
|
+
});
|
|
51
76
|
}
|
|
52
77
|
|
|
53
78
|
recurse(document)
|
|
@@ -56,39 +81,53 @@ export function register(registry) {
|
|
|
56
81
|
// create title slide
|
|
57
82
|
const attrName = document.getAttribute('slide-template-attr', 'slide-template', 'slide-template-attr');
|
|
58
83
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
84
|
+
const deck_title_slide = self.createBlock(
|
|
85
|
+
document,
|
|
86
|
+
'slide',
|
|
87
|
+
'',
|
|
88
|
+
{
|
|
89
|
+
[attrName]: 'deck-title',
|
|
90
|
+
...document.getAttributes(),
|
|
91
|
+
level: 0
|
|
92
|
+
}
|
|
93
|
+
);
|
|
63
94
|
|
|
64
95
|
const _title_obj = document.getDoctitle({partition: true, use_fallback: true});
|
|
65
96
|
if (_title_obj.subtitle) {
|
|
66
|
-
const _slice = document.getHeader().isOption('slice');
|
|
67
|
-
const title1 = self.createBlock(
|
|
97
|
+
const _slice = document.getHeader().isOption('slice'); // FIXME
|
|
98
|
+
const title1 = self.createBlock(deck_title_slide, 'title', slice_text(_title_obj.main, _slice), {
|
|
68
99
|
level: 1,
|
|
69
100
|
slot: 'title'
|
|
70
101
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
102
|
+
deck_title_slide.getBlocks().push(title1)
|
|
103
|
+
const subtitle = slice_text(_title_obj.subtitle, _slice);
|
|
104
|
+
if (!isEmptyString(subtitle)) {
|
|
105
|
+
const title2 = self.createBlock(deck_title_slide, 'title', subtitle, {
|
|
106
|
+
level: 2,
|
|
107
|
+
slot: 'subtitle'
|
|
108
|
+
});
|
|
109
|
+
deck_title_slide.getBlocks().push(title2)
|
|
110
|
+
}
|
|
77
111
|
} else {
|
|
78
|
-
const title = self.createBlock(
|
|
112
|
+
const title = self.createBlock(deck_title_slide, 'title', document.getHeader().getTitle(), {
|
|
79
113
|
level: 1,
|
|
80
114
|
slot: 'title'
|
|
81
115
|
});
|
|
82
|
-
|
|
116
|
+
deck_title_slide.getBlocks().push(title)
|
|
83
117
|
}
|
|
84
118
|
|
|
85
119
|
const preambles = document.findBy({context: 'preamble'});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
120
|
+
if(preambles.length === 1) {
|
|
121
|
+
preambles[0].getBlocks().forEach((block) => {
|
|
122
|
+
deck_title_slide.getBlocks().push(block);
|
|
123
|
+
});
|
|
124
|
+
const parentBlocks = preambles[0].getParent().getBlocks();
|
|
125
|
+
parentBlocks[parentBlocks.indexOf(preambles[0])] = deck_title_slide;//self.createBlock(preambles[0].getParent(), 'empty','', {}); // replace node from parent
|
|
126
|
+
} else {
|
|
127
|
+
document.getBlocks().splice(0, 0, deck_title_slide);
|
|
128
|
+
}
|
|
90
129
|
// remove preamble block from document
|
|
91
|
-
document.getBlocks()
|
|
130
|
+
// document.getBlocks()[document.getBlocks().findIndex(b => b === preambles[0])] = self.createBlock(document, 'empty', '', {});
|
|
92
131
|
|
|
93
132
|
return document;
|
|
94
133
|
})
|
|
@@ -1,40 +1,35 @@
|
|
|
1
|
+
|
|
1
2
|
export function register(registry) {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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,4 +1,4 @@
|
|
|
1
|
-
const {$h, $a, $section, sectionTitle, isDefined} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
|
|
1
|
+
const {$h, $a, $section, sectionTitle, isDefined, data_attributes} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
|
|
2
2
|
|
|
3
3
|
module.exports = function ({node}) {
|
|
4
4
|
let content = '';
|
|
@@ -16,6 +16,7 @@ module.exports = function ({node}) {
|
|
|
16
16
|
}
|
|
17
17
|
return $section({
|
|
18
18
|
class: ['doc-section', `level-${node.getLevel()}`, node.getRole()],
|
|
19
|
+
...data_attributes(node)
|
|
19
20
|
},
|
|
20
21
|
$h({
|
|
21
22
|
level: node.getLevel() + 1,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const {resolve} = require("path");
|
|
2
2
|
const {readFileSync, existsSync} = require("fs");
|
|
3
|
-
const {$, isEmptyString} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
|
|
3
|
+
const {$, isEmptyString, data_attributes} = require("@tblaisot/asciidoctorjs-templates-js/helpers");
|
|
4
|
+
const {debugAST} = require("../extensions/slides_treeprocessor");
|
|
5
|
+
|
|
6
|
+
const NO_TITLE = '!';
|
|
4
7
|
|
|
5
8
|
function resolveTemplate(paths, templateName) {
|
|
6
9
|
// find in folders
|
|
@@ -19,12 +22,17 @@ module.exports = function ({node}) {
|
|
|
19
22
|
const template = node.getAttribute(templateAttrName, defaultTemplate);
|
|
20
23
|
|
|
21
24
|
let slideContent = '';
|
|
25
|
+
let notesContent = '';
|
|
26
|
+
|
|
27
|
+
const contentNodes = node.getBlocks().filter(n=>n.getContext()!=='speaker_note');
|
|
28
|
+
const speakerNotesNodes = node.getBlocks().filter(n=>n.getContext()==='speaker_note');
|
|
22
29
|
|
|
23
30
|
if (isEmptyString(template)) {
|
|
24
31
|
slideContent = node.getBlocks().map(n => n.convert()).join('\n')
|
|
25
32
|
} else {
|
|
26
33
|
slideContent = resolveTemplate(node.document.getAttribute('slide-template-dirs'), template);
|
|
27
|
-
|
|
34
|
+
notesContent = speakerNotesNodes.map(n => n.convert()).join('\n');
|
|
35
|
+
const blockBySlot = contentNodes.reduce(
|
|
28
36
|
(acc, n) => {
|
|
29
37
|
const slot = n.getAttribute('slot') || 'default'
|
|
30
38
|
if (!acc[slot]) {
|
|
@@ -35,19 +43,20 @@ module.exports = function ({node}) {
|
|
|
35
43
|
},
|
|
36
44
|
{});
|
|
37
45
|
// Special slot
|
|
38
|
-
blockBySlot['all'] =
|
|
46
|
+
blockBySlot['all'] = contentNodes;
|
|
39
47
|
Object.entries(blockBySlot).forEach(([slotname, blocks]) => {
|
|
40
48
|
const content = $(blocks.map(n => n.convert()));
|
|
41
49
|
slideContent = slideContent.replace(`<!-- slot=${slotname} -->`, content);
|
|
42
|
-
})
|
|
50
|
+
});
|
|
43
51
|
}
|
|
44
52
|
return $('section', {
|
|
45
53
|
class: [
|
|
46
54
|
'slide',
|
|
47
55
|
template,
|
|
48
56
|
node.getRole()
|
|
49
|
-
]
|
|
57
|
+
],
|
|
58
|
+
...data_attributes(node)
|
|
50
59
|
},
|
|
51
|
-
slideContent
|
|
60
|
+
slideContent + notesContent
|
|
52
61
|
);
|
|
53
62
|
}
|
|
@@ -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"> <!– fixme –>-->
|
|
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>
|
|
@@ -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
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const KEY_D = "d";
|
|
3
3
|
const DEBUG_CLASS='debug';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function debug() {
|
|
6
6
|
return function (deck) {
|
|
7
7
|
|
|
8
8
|
function debugOverflow(){
|
|
@@ -10,9 +10,9 @@ export default function () {
|
|
|
10
10
|
const currentSlide = deck.slides[deck.slide()];
|
|
11
11
|
Array.from(currentSlide.children).forEach(el => {
|
|
12
12
|
if (el.scrollHeight > currentSlide.clientHeight) {
|
|
13
|
-
deck.parent.classList.add("overflowing");
|
|
13
|
+
deck.parent.classList.add("bespoke-overflowing");
|
|
14
14
|
} else {
|
|
15
|
-
deck.parent.classList.remove("overflowing");
|
|
15
|
+
deck.parent.classList.remove("bespoke-overflowing");
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Using ES6 import syntax
|
|
2
|
+
import hljs from 'highlight.js/lib/core';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
function doHighlightAll(){
|
|
6
|
+
document.querySelectorAll('pre.highlight code').forEach((el) => {
|
|
7
|
+
const language = el.getAttribute('data-lang');
|
|
8
|
+
// hljs.highlightElement(el);
|
|
9
|
+
el.innerHTML = hljs.highlight(el.innerHTML, {language}).value
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function highlight (config = {}) {
|
|
14
|
+
let alreadyHighlighted = false;
|
|
15
|
+
return function (deck) {
|
|
16
|
+
deck.on('activate', function(event) {
|
|
17
|
+
if(!alreadyHighlighted){
|
|
18
|
+
alreadyHighlighted = true;
|
|
19
|
+
doHighlightAll()
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
};
|