UNPKG

epubavocado

Version:

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

70 lines (69 loc) 2.66 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.Container = exports.Rootfile = exports.ContainerLink = void 0; var entity_js_1 = require("./mixins/entity.js"); var resource_js_1 = require("./mixins/resource.js"); var util_js_1 = require("../util.js"); var xpath_js_1 = require("../xpath.js"); var ContainerLink = /** @class */ (function (_super) { __extends(ContainerLink, _super); function ContainerLink() { return _super !== null && _super.apply(this, arguments) || this; } ContainerLink.prototype.rel = function () { var rel = this._resolve('./@rel'); if (rel) { return util_js_1.splitRelAttribute(rel); } return []; }; return ContainerLink; }(resource_js_1.Resource(entity_js_1.Entity))); exports.ContainerLink = ContainerLink; var Rootfile = /** @class */ (function (_super) { __extends(Rootfile, _super); function Rootfile() { return _super !== null && _super.apply(this, arguments) || this; } Rootfile.prototype.fullPath = function () { return this._resolve('./@full-path'); }; Rootfile.prototype.mediaType = function () { return this._resolve('./@media-type'); }; return Rootfile; }(entity_js_1.Entity)); exports.Rootfile = Rootfile; var Container = /** @class */ (function (_super) { __extends(Container, _super); function Container(doc) { return _super.call(this, xpath_js_1.select('/ocf:container', doc)) || this; } Container.prototype.version = function () { return this._resolve('./@version'); }; Container.prototype.rootfiles = function () { return this._resolveAll('./ocf:rootfiles/ocf:rootfile', Rootfile); }; Container.prototype.links = function () { return this._resolveAll('./ocf:links/ocf:link', ContainerLink); }; Container.prototype.defaultRendition = function () { return this.rootfiles()[0]; }; return Container; }(entity_js_1.Entity)); exports.Container = Container;