UNPKG

epubavocado

Version:

I am an EPUB object model aspiring to be standards compliant.

68 lines (67 loc) 3.15 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Spine = void 0; var entity_js_1 = require("../mixins/entity.js"); var id_js_1 = require("./mixins/id.js"); var util_js_1 = require("../../util.js"); var spine_item_js_1 = require("./spine-item.js"); var util_js_2 = require("./util.js"); var Spine = /** @class */ (function (_super) { __extends(Spine, _super); function Spine() { return _super !== null && _super.apply(this, arguments) || this; } Spine.prototype.pageProgressionDirection = function () { return this._resolve('./@page-progression-direction'); }; Spine.prototype.toc = function () { var idref = this._resolve('./@toc'); return util_js_2.resolveIdref(this, idref); }; Spine.prototype.itemref = function (_a) { var _b = _a === void 0 ? {} : _a, id = _b.id, anyProperties = _b.anyProperties, allProperties = _b.allProperties, onlyProperties = _b.onlyProperties, linear = _b.linear; return this.itemrefs({ ids: id ? [id] : [], anyProperties: anyProperties, allProperties: allProperties, onlyProperties: onlyProperties, linear: linear, })[0]; }; Spine.prototype.itemrefs = function (_a) { var _b, _c; var _d = _a === void 0 ? {} : _a, ids = _d.ids, anyProperties = _d.anyProperties, allProperties = _d.allProperties, onlyProperties = _d.onlyProperties, linear = _d.linear; if (linear !== undefined) { return (_b = this.itemrefs({ ids: ids, anyProperties: anyProperties, allProperties: allProperties, onlyProperties: onlyProperties, })) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return item.linear() === linear; }); } if (onlyProperties) { return (_c = this.itemrefs({ ids: ids, anyProperties: anyProperties, allProperties: onlyProperties, })) === null || _c === void 0 ? void 0 : _c.filter(function (item) { return util_js_1.toArray(item.properties()).length === onlyProperties.length; }); } var expression = "./opf:itemref" + util_js_2.idFilter(ids) + util_js_2.anyPropertiesFilter(anyProperties) + util_js_2.allPropertiesFilter(allProperties); return this._resolveAll(expression, spine_item_js_1.SpineItem); }; return Spine; }(id_js_1.ID(entity_js_1.Entity))); exports.Spine = Spine;