@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.
@@ -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
- "use strict";
2
-
3
- var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
4
- var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
5
- var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
6
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
7
- var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
8
- var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
9
- var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
10
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
11
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
12
- _Object$defineProperty(exports, "__esModule", {
13
- value: true
14
- });
15
- exports.default = void 0;
16
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
17
- var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
18
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
19
- var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
20
- var _bBerGrammarRenderer = _interopRequireDefault(require("@canopycanopycanopy/b-ber-grammar-renderer"));
21
- var _bBerGrammarAttributes = require("@canopycanopycanopy/b-ber-grammar-attributes");
22
- var _bBerParserGallery = _interopRequireDefault(require("@canopycanopycanopy/b-ber-parser-gallery"));
23
- function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
25
- // Define the open and closing markers, used by the `validateOpen` and
26
- // `validateClose` methods in `createRenderer`
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
- // The `render` function that gets passed into our `createRenderer` is
31
- // responsible for the HTML output.
32
- const render = ({
33
- context = {}
34
- }) => (tokens, index) => {
35
- var _context;
36
- const token = tokens[index];
37
- const info = (0, _trim.default)(_context = token.info).call(_context).match(MARKER_OPEN_RE);
38
- if (token.nesting !== 1 || !info) return '';
39
- const lineNumber = (0, _map.default)(token) ? (0, _map.default)(token)[0] : null;
40
- const fileName = `_markdown/${context.fileName}.md`;
41
- const location = {
42
- fileName,
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, _bBerGrammarAttributes.htmlId)(id)}" class="spread__content">`;
66
- case 'epub':
67
- case 'mobi':
68
- case 'pdf':
69
- case 'sample':
70
- default:
71
- return `<section id="${(0, _bBerGrammarAttributes.htmlId)(id)}" ${attrsString}>`;
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
- var _default = exports.default = {
75
- plugin: _bBerParserGallery.default,
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.61+2bbec564",
3
+ "version": "3.0.8-next.97+2e9748e6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "prepare:dist": "BABEL_ENV=production babel --config-file ../../babel.config.js -d dist/ src/ --ignore **/__tests__/**",
8
- "clean": "rimraf dist",
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
- "@babel/cli": "^7.10.5",
21
- "@babel/core": "^7.10.5",
22
- "@babel/preset-env": "^7.10.4",
23
- "browserslist": "^4.17.4",
24
- "jest": "^26.6.3",
25
- "rimraf": "^2.7.1"
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.61+2bbec564",
29
- "@canopycanopycanopy/b-ber-grammar-renderer": "3.0.8-next.61+2bbec564",
30
- "@canopycanopycanopy/b-ber-lib": "3.0.8-next.61+2bbec564",
31
- "@canopycanopycanopy/b-ber-logger": "3.0.8-next.61+2bbec564",
32
- "@canopycanopycanopy/b-ber-parser-gallery": "3.0.8-next.61+2bbec564",
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": "2bbec5643278f53becb0d2ba1f55edfe379d5587"
50
+ "gitHead": "2e9748e6f00446cd35dc8f933e049d8200fc24dd",
51
+ "types": "dist/index.d.ts"
54
52
  }