Commit ef3c3a0b authored by Fred Chasen's avatar Fred Chasen

Rename Styler to Polisher

parent 8e5872c4
......@@ -9,7 +9,7 @@ $ npm install pagedjs
```js
import { Chunker, Styler} from 'pagedjs';
let styles = new Styler();
let styles = new Polisher();
let styleText = await styles.add("path/to/css/file.css");
let chunker = new Chunker(DOMContent, document.body, styles).then((flow) => {
......@@ -34,7 +34,7 @@ Process the first 50 pages of Moby Dick: [https://s3.amazonaws.com/pagedmedia/pa
Upload and chunk an Epub (using Epub.js): [https://s3.amazonaws.com/pagedmedia/pagedjs/examples/epub.html](https://s3.amazonaws.com/pagedmedia/examples/epub.html).
## Styler
## Polisher
Converts `@page` css to classes, and applies counters and content.
Test styles for Aurorae: [https://s3.amazonaws.com/pagedmedia/pagedjs/examples/styler.html](https://s3.amazonaws.com/pagedmedia/pagedjs/examples/styler.html).
......
......@@ -49,7 +49,7 @@
updateContents(val);
}, false)
styles = new Paged.Styler();
styles = new Paged.Polisher();
styleText = await styles.add("assets/styles/moby-dick.css");
async function updateContents(str) {
......
{
"name": "pagedjs",
"version": "0.0.1",
"version": "0.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
......@@ -41,10 +41,10 @@ const TEMPLATE = `<div class="page">
* @class
*/
class Chunker {
constructor(content, renderTo, styler, preview) {
constructor(content, renderTo, polisher, preview) {
this.pagesArea = document.createElement("div");
this.pagesArea.classList.add("pages");
this.styles = styler;
this.styles = polisher;
if (renderTo) {
renderTo.appendChild(this.pagesArea);
} else {
......@@ -63,16 +63,16 @@ class Chunker {
this.content = content;
if (content) {
return this.flow(content, styler);
return this.flow(content, polisher);
}
return this;
}
async flow(content, styler) {
async flow(content, polisher) {
let parsed = new ContentParser(content);
this.styles = styler;
this.styles = polisher;
this.breaks = this.styles && this.styles.breaks;
this.styles && this.styles.contents(parsed);
......
import Chunker from './chunker/chunker';
import Styler from './styles/styler';
import Polisher from './polisher/polisher';
export {
Chunker,
Styler
Polisher
};
......@@ -2,7 +2,7 @@ import Sheet from './sheet';
import baseStyles from './base';
import { UUID } from '../utils/utils';
class Styler {
class Polisher {
constructor() {
this.sheets = [];
this.inserted = [];
......@@ -221,4 +221,4 @@ class Styler {
}
}
export default Styler;
export default Polisher;
import Chunker from '../chunker/chunker';
import Styler from '../styles/styler';
import Polisher from '../polisher/polisher';
// let ready = new Promise(function($){document.addEventListener('DOMContentLoaded',$,{once:true})});
......@@ -51,7 +51,7 @@ ready.then(async function () {
// TODO: add inline styles
// Process styles
let styles = new Styler();
let styles = new Polisher();
let styleText = await styles.add(...hrefs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment