@canopycanopycanopy/b-ber-grammar-spread 3.0.8-next.61 → 3.0.8-next.97
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/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -78
- package/package.json +16 -18
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
declare const _default: {
|
|
3
|
+
plugin: (md: any, name: string, options?: any) => void;
|
|
4
|
+
name: string;
|
|
5
|
+
renderer: (args: any) => {
|
|
6
|
+
render: any;
|
|
7
|
+
marker: string;
|
|
8
|
+
minMarkers: number;
|
|
9
|
+
markerOpen: any;
|
|
10
|
+
markerClose: any;
|
|
11
|
+
validateOpen(params: any, line: any): boolean | undefined;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export = _default;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1,82 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
let _canopycanopycanopy_b_ber_grammar_attributes = require("@canopycanopycanopy/b-ber-grammar-attributes");
|
|
24
|
+
let _canopycanopycanopy_b_ber_grammar_renderer = require("@canopycanopycanopy/b-ber-grammar-renderer");
|
|
25
|
+
_canopycanopycanopy_b_ber_grammar_renderer = __toESM(_canopycanopycanopy_b_ber_grammar_renderer);
|
|
26
|
+
let _canopycanopycanopy_b_ber_lib = require("@canopycanopycanopy/b-ber-lib");
|
|
27
|
+
let _canopycanopycanopy_b_ber_parser_gallery = require("@canopycanopycanopy/b-ber-parser-gallery");
|
|
28
|
+
_canopycanopycanopy_b_ber_parser_gallery = __toESM(_canopycanopycanopy_b_ber_parser_gallery);
|
|
29
|
+
//#region src/index.ts
|
|
27
30
|
const MARKER_OPEN_RE = /^(spread)(?::([^\s]+)(\s.*)?)?$/;
|
|
28
31
|
const MARKER_CLOSE_RE = /^(exit)(?::([^\s]+))?/;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
lineNumber
|
|
44
|
-
};
|
|
45
|
-
const [, type, id, attrs] = info;
|
|
46
|
-
const attrsObject = (0, _bBerGrammarAttributes.attributesObject)(attrs, type, location);
|
|
47
|
-
const attrsString = (0, _bBerGrammarAttributes.attributesString)(attrsObject);
|
|
48
|
-
|
|
49
|
-
// Spread directive is handled differentenly based on build:
|
|
50
|
-
//
|
|
51
|
-
// reader, web: Drop all assets (images, videos, etc) into a `fullscreen`
|
|
52
|
-
// container so that they can be positioned using custom CSS
|
|
53
|
-
//
|
|
54
|
-
// epub, mobi: Drop all assets into a section.spread container that is
|
|
55
|
-
// initialized as a slider via JS if available. defaults to a simple sequence
|
|
56
|
-
// of images
|
|
57
|
-
//
|
|
58
|
-
// pdf: Sequence of images
|
|
59
|
-
|
|
60
|
-
switch (_State.default.build) {
|
|
61
|
-
case 'web':
|
|
62
|
-
case 'reader':
|
|
63
|
-
return `
|
|
32
|
+
const render = ({ context = {} }) => (tokens, index) => {
|
|
33
|
+
const token = tokens[index];
|
|
34
|
+
const info = token.info.trim().match(MARKER_OPEN_RE);
|
|
35
|
+
if (token.nesting !== 1 || !info) return "";
|
|
36
|
+
const lineNumber = token.map ? token.map[0] : null;
|
|
37
|
+
const location = {
|
|
38
|
+
fileName: `_markdown/${context.fileName}.md`,
|
|
39
|
+
lineNumber
|
|
40
|
+
};
|
|
41
|
+
const [, type, id, attrs] = info;
|
|
42
|
+
const attrsString = (0, _canopycanopycanopy_b_ber_grammar_attributes.attributesString)((0, _canopycanopycanopy_b_ber_grammar_attributes.attributesObject)(attrs, type, location));
|
|
43
|
+
switch (_canopycanopycanopy_b_ber_lib.State.build) {
|
|
44
|
+
case "web":
|
|
45
|
+
case "reader": return `
|
|
64
46
|
<div ${attrsString}>
|
|
65
|
-
<div id="${(0,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
47
|
+
<div id="${(0, _canopycanopycanopy_b_ber_grammar_attributes.htmlId)(id)}" class="spread__content">`;
|
|
48
|
+
default: return `<section id="${(0, _canopycanopycanopy_b_ber_grammar_attributes.htmlId)(id)}" ${attrsString}>`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var src_default = {
|
|
52
|
+
plugin: _canopycanopycanopy_b_ber_parser_gallery.default,
|
|
53
|
+
name: "spread",
|
|
54
|
+
renderer: (args) => (0, _canopycanopycanopy_b_ber_grammar_renderer.default)({
|
|
55
|
+
...args,
|
|
56
|
+
markerOpen: MARKER_OPEN_RE,
|
|
57
|
+
markerClose: MARKER_CLOSE_RE,
|
|
58
|
+
render: render(args)
|
|
59
|
+
})
|
|
73
60
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
name: 'spread',
|
|
77
|
-
renderer: args => (0, _bBerGrammarRenderer.default)(_objectSpread(_objectSpread({}, args), {}, {
|
|
78
|
-
markerOpen: MARKER_OPEN_RE,
|
|
79
|
-
markerClose: MARKER_CLOSE_RE,
|
|
80
|
-
render: render(args)
|
|
81
|
-
}))
|
|
82
|
-
};
|
|
61
|
+
//#endregion
|
|
62
|
+
module.exports = src_default;
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-grammar-spread",
|
|
3
|
-
"version": "3.0.8-next.
|
|
3
|
+
"version": "3.0.8-next.97+2e9748e6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"prepare": "npm run clean && npm run prepare:dist",
|
|
10
|
-
"build": "npm run prepare",
|
|
11
|
-
"watch": "BABEL_ENV=production babel --config-file ../../babel.config.js -d dist/ src/ --watch src",
|
|
7
|
+
"build": "tsdown",
|
|
8
|
+
"typecheck": "tsc --noEmit",
|
|
12
9
|
"test": "jest"
|
|
13
10
|
},
|
|
14
11
|
"author": "Triple Canopy <b-ber@canopycanopycanopy.com> (https://triplecanopy.github.io/)",
|
|
@@ -17,19 +14,19 @@
|
|
|
17
14
|
"access": "public"
|
|
18
15
|
},
|
|
19
16
|
"devDependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
17
|
+
"@swc/core": "^1.15.40",
|
|
18
|
+
"@swc/jest": "^0.2.39",
|
|
19
|
+
"jest": "^29.7.0",
|
|
20
|
+
"rimraf": "^2.7.1",
|
|
21
|
+
"tsdown": "^0.22.1",
|
|
22
|
+
"typescript": "^6.0.3"
|
|
26
23
|
},
|
|
27
24
|
"dependencies": {
|
|
28
|
-
"@canopycanopycanopy/b-ber-grammar-attributes": "3.0.8-next.
|
|
29
|
-
"@canopycanopycanopy/b-ber-grammar-renderer": "3.0.8-next.
|
|
30
|
-
"@canopycanopycanopy/b-ber-lib": "3.0.8-next.
|
|
31
|
-
"@canopycanopycanopy/b-ber-logger": "3.0.8-next.
|
|
32
|
-
"@canopycanopycanopy/b-ber-parser-gallery": "3.0.8-next.
|
|
25
|
+
"@canopycanopycanopy/b-ber-grammar-attributes": "3.0.8-next.97+2e9748e6",
|
|
26
|
+
"@canopycanopycanopy/b-ber-grammar-renderer": "3.0.8-next.97+2e9748e6",
|
|
27
|
+
"@canopycanopycanopy/b-ber-lib": "3.0.8-next.97+2e9748e6",
|
|
28
|
+
"@canopycanopycanopy/b-ber-logger": "3.0.8-next.97+2e9748e6",
|
|
29
|
+
"@canopycanopycanopy/b-ber-parser-gallery": "3.0.8-next.97+2e9748e6",
|
|
33
30
|
"lodash": "^4.17.21",
|
|
34
31
|
"tar": "^6.1.11"
|
|
35
32
|
},
|
|
@@ -50,5 +47,6 @@
|
|
|
50
47
|
"url": "https://maxwellsimmer.com"
|
|
51
48
|
}
|
|
52
49
|
],
|
|
53
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "2e9748e6f00446cd35dc8f933e049d8200fc24dd",
|
|
51
|
+
"types": "dist/index.d.ts"
|
|
54
52
|
}
|