@canopycanopycanopy/b-ber-shapes-directives 3.0.8-nav.0 → 3.0.8-next.61
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/README.md +18 -4
- package/index.js +24 -48
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# b-ber-shapes-directives
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A data-only package that exports constants and sets defining every b-ber directive and its allowed attributes. It exports the colon marker strings and minimum lengths used by all block and inline parsers, named `Set` collections grouping directives by position in the publication (frontmatter, bodymatter, backmatter, inline, miscellaneous, draft, and deprecated), merged convenience sets (`BLOCK_DIRECTIVES`, `ALL_DIRECTIVES`), per-directive allowed-attribute sets (`SUPPORTED_ATTRIBUTES`), and sets of HTML audio/video/iframe attributes and Vimeo embed parameters. The parser packages and the b-ber render pipeline import from this package to validate directive names and attributes at parse time.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
|
+
```js
|
|
8
|
+
import {
|
|
9
|
+
BLOCK_DIRECTIVE_FENCE,
|
|
10
|
+
BODYMATTER_DIRECTIVES,
|
|
11
|
+
SUPPORTED_ATTRIBUTES,
|
|
12
|
+
} from '@canopycanopycanopy/b-ber-shapes-directives'
|
|
7
13
|
```
|
|
8
|
-
|
|
14
|
+
|
|
15
|
+
This package is a pure data export with no runtime logic — it is consumed at build time by directive validators in `b-ber-lib` and all parser packages.
|
|
16
|
+
|
|
17
|
+
## Dev
|
|
18
|
+
|
|
9
19
|
```
|
|
20
|
+
npm test
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Tests verify marker constants, directive set types, and merged set correctness.
|
package/index.js
CHANGED
|
@@ -8,60 +8,38 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.vimeoEmbedAttributes = exports.htmlIframeAttributes = exports.htmlAudioVideoAttributes = exports.bBerAudioVideoAttributes = exports.SUPPORTED_ATTRIBUTES = exports.SECONDARY_INLINE_DIRECTIVE_MARKER_MIN_LENGTH = exports.SECONDARY_INLINE_DIRECTIVE_FENCE_OPEN = exports.SECONDARY_INLINE_DIRECTIVE_FENCE_CLOSE = exports.MISC_DIRECTIVES = exports.INLINE_DIRECTIVE_MARKER_MIN_LENGTH = exports.INLINE_DIRECTIVE_MARKER = exports.INLINE_DIRECTIVE_FENCE = exports.INLINE_DIRECTIVES = exports.FRONTMATTER_DIRECTIVES = exports.DRAFT_DIRECTIVES = exports.DIRECTIVES_REQUIRING_ALT_TAG = exports.DEPRECATED_DIRECTIVES = exports.BODYMATTER_DIRECTIVES = exports.BLOCK_DIRECTIVE_MARKER_MIN_LENGTH = exports.BLOCK_DIRECTIVE_MARKER = exports.BLOCK_DIRECTIVE_FENCE = exports.BLOCK_DIRECTIVES = exports.BACKMATTER_DIRECTIVES = exports.ALL_DIRECTIVES = void 0;
|
|
9
9
|
var _repeat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/repeat"));
|
|
10
10
|
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
11
|
-
const BLOCK_DIRECTIVE_MARKER = ':';
|
|
12
|
-
exports.
|
|
13
|
-
const
|
|
14
|
-
exports.
|
|
15
|
-
const
|
|
16
|
-
exports.
|
|
17
|
-
const
|
|
18
|
-
exports.
|
|
19
|
-
const
|
|
20
|
-
exports.
|
|
21
|
-
const
|
|
22
|
-
exports.BLOCK_DIRECTIVE_FENCE = BLOCK_DIRECTIVE_FENCE;
|
|
23
|
-
const INLINE_DIRECTIVE_FENCE = `${(0, _repeat.default)(INLINE_DIRECTIVE_MARKER).call(INLINE_DIRECTIVE_MARKER, INLINE_DIRECTIVE_MARKER_MIN_LENGTH)} `;
|
|
24
|
-
exports.INLINE_DIRECTIVE_FENCE = INLINE_DIRECTIVE_FENCE;
|
|
25
|
-
const SECONDARY_INLINE_DIRECTIVE_FENCE_OPEN = `${(0, _repeat.default)(INLINE_DIRECTIVE_MARKER).call(INLINE_DIRECTIVE_MARKER, SECONDARY_INLINE_DIRECTIVE_MARKER_MIN_LENGTH)} `;
|
|
26
|
-
exports.SECONDARY_INLINE_DIRECTIVE_FENCE_OPEN = SECONDARY_INLINE_DIRECTIVE_FENCE_OPEN;
|
|
27
|
-
const SECONDARY_INLINE_DIRECTIVE_FENCE_CLOSE = `${(0, _repeat.default)(INLINE_DIRECTIVE_MARKER).call(INLINE_DIRECTIVE_MARKER, SECONDARY_INLINE_DIRECTIVE_MARKER_MIN_LENGTH)}`;
|
|
28
|
-
exports.SECONDARY_INLINE_DIRECTIVE_FENCE_CLOSE = SECONDARY_INLINE_DIRECTIVE_FENCE_CLOSE;
|
|
29
|
-
const FRONTMATTER_DIRECTIVES = new _set.default(['frontmatter', 'halftitlepage', 'titlepage', 'dedication', 'epigraph', 'foreword', 'preface', 'acknowledgments']);
|
|
30
|
-
exports.FRONTMATTER_DIRECTIVES = FRONTMATTER_DIRECTIVES;
|
|
31
|
-
const BODYMATTER_DIRECTIVES = new _set.default(['bodymatter', 'introduction', 'prologue', 'chapter', 'subchapter', 'epilogue', 'conclusion', 'part', 'volume',
|
|
11
|
+
const BLOCK_DIRECTIVE_MARKER = exports.BLOCK_DIRECTIVE_MARKER = ':';
|
|
12
|
+
const INLINE_DIRECTIVE_MARKER = exports.INLINE_DIRECTIVE_MARKER = ':';
|
|
13
|
+
const BLOCK_DIRECTIVE_MARKER_MIN_LENGTH = exports.BLOCK_DIRECTIVE_MARKER_MIN_LENGTH = 3;
|
|
14
|
+
const INLINE_DIRECTIVE_MARKER_MIN_LENGTH = exports.INLINE_DIRECTIVE_MARKER_MIN_LENGTH = 3;
|
|
15
|
+
const SECONDARY_INLINE_DIRECTIVE_MARKER_MIN_LENGTH = exports.SECONDARY_INLINE_DIRECTIVE_MARKER_MIN_LENGTH = 2;
|
|
16
|
+
const BLOCK_DIRECTIVE_FENCE = exports.BLOCK_DIRECTIVE_FENCE = `${(0, _repeat.default)(BLOCK_DIRECTIVE_MARKER).call(BLOCK_DIRECTIVE_MARKER, BLOCK_DIRECTIVE_MARKER_MIN_LENGTH)} `;
|
|
17
|
+
const INLINE_DIRECTIVE_FENCE = exports.INLINE_DIRECTIVE_FENCE = `${(0, _repeat.default)(INLINE_DIRECTIVE_MARKER).call(INLINE_DIRECTIVE_MARKER, INLINE_DIRECTIVE_MARKER_MIN_LENGTH)} `;
|
|
18
|
+
const SECONDARY_INLINE_DIRECTIVE_FENCE_OPEN = exports.SECONDARY_INLINE_DIRECTIVE_FENCE_OPEN = `${(0, _repeat.default)(INLINE_DIRECTIVE_MARKER).call(INLINE_DIRECTIVE_MARKER, SECONDARY_INLINE_DIRECTIVE_MARKER_MIN_LENGTH)} `;
|
|
19
|
+
const SECONDARY_INLINE_DIRECTIVE_FENCE_CLOSE = exports.SECONDARY_INLINE_DIRECTIVE_FENCE_CLOSE = `${(0, _repeat.default)(INLINE_DIRECTIVE_MARKER).call(INLINE_DIRECTIVE_MARKER, SECONDARY_INLINE_DIRECTIVE_MARKER_MIN_LENGTH)}`;
|
|
20
|
+
const FRONTMATTER_DIRECTIVES = exports.FRONTMATTER_DIRECTIVES = new _set.default(['frontmatter', 'halftitlepage', 'titlepage', 'dedication', 'epigraph', 'foreword', 'preface', 'acknowledgments']);
|
|
21
|
+
const BODYMATTER_DIRECTIVES = exports.BODYMATTER_DIRECTIVES = new _set.default(['bodymatter', 'introduction', 'prologue', 'chapter', 'subchapter', 'epilogue', 'conclusion', 'part', 'volume',
|
|
32
22
|
// Generic container directives for secitoning layout
|
|
33
23
|
'section', 'article']);
|
|
34
|
-
exports.
|
|
35
|
-
const
|
|
36
|
-
exports.
|
|
37
|
-
const INLINE_DIRECTIVES = new _set.default(['figure', 'figure-inline', 'logo', 'video', 'video-inline', 'audio', 'audio-inline', 'vimeo', 'vimeo-inline', 'iframe', 'iframe-inline', 'media', 'media-inline']);
|
|
38
|
-
exports.INLINE_DIRECTIVES = INLINE_DIRECTIVES;
|
|
39
|
-
const MISC_DIRECTIVES = new _set.default(['pullquote', 'blockquote', 'dialogue', 'gallery', 'spread', 'epigraph']);
|
|
24
|
+
const BACKMATTER_DIRECTIVES = exports.BACKMATTER_DIRECTIVES = new _set.default(['backmatter', 'afterword', 'loi', 'appendix', 'seriespage', 'credits', 'contributors', 'colophon']);
|
|
25
|
+
const INLINE_DIRECTIVES = exports.INLINE_DIRECTIVES = new _set.default(['figure', 'figure-inline', 'logo', 'video', 'video-inline', 'audio', 'audio-inline', 'vimeo', 'vimeo-inline', 'iframe', 'iframe-inline', 'media', 'media-inline']);
|
|
26
|
+
const MISC_DIRECTIVES = exports.MISC_DIRECTIVES = new _set.default(['pullquote', 'blockquote', 'dialogue', 'gallery', 'spread', 'epigraph']);
|
|
40
27
|
|
|
41
28
|
// belonging to the epub-vocab, but still in draft. see https://idpf.github.io/epub-vocabs/structure/
|
|
42
|
-
exports.
|
|
43
|
-
const
|
|
44
|
-
exports.
|
|
45
|
-
const
|
|
46
|
-
exports.
|
|
47
|
-
const
|
|
48
|
-
exports.BLOCK_DIRECTIVES = BLOCK_DIRECTIVES;
|
|
49
|
-
const ALL_DIRECTIVES = new _set.default([...BLOCK_DIRECTIVES, ...INLINE_DIRECTIVES, ...MISC_DIRECTIVES]);
|
|
50
|
-
exports.ALL_DIRECTIVES = ALL_DIRECTIVES;
|
|
51
|
-
const htmlAudioVideoAttributes = new _set.default(['autoplay', 'loop', 'controls', 'muted', 'preload', 'autobuffer', 'buffered', 'mozCurrentSampleOffset', 'played', 'volume', 'crossorigin']);
|
|
52
|
-
exports.htmlAudioVideoAttributes = htmlAudioVideoAttributes;
|
|
53
|
-
const htmlIframeAttributes = new _set.default(['title', 'width', 'height', 'allow', 'loading', 'name', 'referrerpolicy', 'sandbox', 'srcdoc', 'scrolling', 'frameborder']);
|
|
29
|
+
const DRAFT_DIRECTIVES = exports.DRAFT_DIRECTIVES = new _set.default(['abstract', 'toc-brief', 'credits', 'keywords', 'seriespage', 'case-study', 'pullquote', 'label', 'ordinal', 'learning-objectives', 'learning-outcome', 'learning-outcomes', 'learning-resources', 'learning-standard', 'learning-standards', 'answer', 'answers', 'assessments', 'feedback', 'fill-in-the-blank-problem', 'general-problem', 'match-problem', 'multiple-choice-problem', 'practice', 'question', 'practices', 'true-false-problem', 'biblioref', 'glossref', 'backlink', 'credit']);
|
|
30
|
+
const DEPRECATED_DIRECTIVES = exports.DEPRECATED_DIRECTIVES = new _set.default(['subchapter', 'help', 'marginalia', 'sidebar', 'warning', 'annotation', 'note', 'rearnote', 'rearnotes', 'annoref']);
|
|
31
|
+
const BLOCK_DIRECTIVES = exports.BLOCK_DIRECTIVES = new _set.default([...FRONTMATTER_DIRECTIVES, ...BODYMATTER_DIRECTIVES, ...BACKMATTER_DIRECTIVES]);
|
|
32
|
+
const ALL_DIRECTIVES = exports.ALL_DIRECTIVES = new _set.default([...BLOCK_DIRECTIVES, ...INLINE_DIRECTIVES, ...MISC_DIRECTIVES]);
|
|
33
|
+
const htmlAudioVideoAttributes = exports.htmlAudioVideoAttributes = new _set.default(['autoplay', 'loop', 'controls', 'muted', 'preload', 'autobuffer', 'buffered', 'mozCurrentSampleOffset', 'played', 'volume', 'crossorigin']);
|
|
34
|
+
const htmlIframeAttributes = exports.htmlIframeAttributes = new _set.default(['title', 'width', 'height', 'allow', 'loading', 'name', 'referrerpolicy', 'sandbox', 'srcdoc', 'scrolling', 'frameborder']);
|
|
54
35
|
|
|
55
36
|
// Attributes that are used in the vimeo and vimeo-inline directives and passed
|
|
56
37
|
// to vimeo via query string
|
|
57
|
-
exports.
|
|
58
|
-
const vimeoEmbedAttributes = new _set.default(['autopause', 'autoplay', 'background', 'byline', 'color', 'controls', 'dnt', 'fun', 'loop', 'muted', 'playsinline', 'portrait', 'quality', 'speed', '#t', 'texttrack', 'title', 'transparent']);
|
|
38
|
+
const vimeoEmbedAttributes = exports.vimeoEmbedAttributes = new _set.default(['autopause', 'autoplay', 'background', 'byline', 'color', 'controls', 'dnt', 'fun', 'loop', 'muted', 'playsinline', 'portrait', 'quality', 'speed', '#t', 'texttrack', 'title', 'transparent']);
|
|
59
39
|
|
|
60
40
|
// b-ber attributes for audio, video and vimeo directives
|
|
61
|
-
exports.
|
|
62
|
-
const
|
|
63
|
-
exports.bBerAudioVideoAttributes = bBerAudioVideoAttributes;
|
|
64
|
-
const SUPPORTED_ATTRIBUTES = {
|
|
41
|
+
const bBerAudioVideoAttributes = exports.bBerAudioVideoAttributes = new _set.default(['classes', 'source', 'poster', 'aspectratio']);
|
|
42
|
+
const SUPPORTED_ATTRIBUTES = exports.SUPPORTED_ATTRIBUTES = {
|
|
65
43
|
block: new _set.default(['title', 'classes']),
|
|
66
44
|
figure: new _set.default(['alt', 'caption', 'classes', 'source']),
|
|
67
45
|
'figure-inline': new _set.default(['alt', 'caption', 'classes', 'source']),
|
|
@@ -81,6 +59,4 @@ const SUPPORTED_ATTRIBUTES = {
|
|
|
81
59
|
spread: new _set.default(['classes']),
|
|
82
60
|
epigraph: new _set.default(['alt', 'source'])
|
|
83
61
|
};
|
|
84
|
-
exports.
|
|
85
|
-
const DIRECTIVES_REQUIRING_ALT_TAG = new _set.default(['figure', 'figure-inline', 'logo']);
|
|
86
|
-
exports.DIRECTIVES_REQUIRING_ALT_TAG = DIRECTIVES_REQUIRING_ALT_TAG;
|
|
62
|
+
const DIRECTIVES_REQUIRING_ALT_TAG = exports.DIRECTIVES_REQUIRING_ALT_TAG = new _set.default(['figure', 'figure-inline', 'logo']);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-shapes-directives",
|
|
3
|
-
"version": "3.0.8-
|
|
3
|
+
"version": "3.0.8-next.61+2bbec564",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"url": "https://maxwellsimmer.com"
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "2bbec5643278f53becb0d2ba1f55edfe379d5587"
|
|
50
50
|
}
|