Commit ef3c3a0b authored by Fred Chasen's avatar Fred Chasen

Rename Styler to Polisher

parent 8e5872c4
...@@ -9,7 +9,7 @@ $ npm install pagedjs ...@@ -9,7 +9,7 @@ $ npm install pagedjs
```js ```js
import { Chunker, Styler} from 'pagedjs'; import { Chunker, Styler} from 'pagedjs';
let styles = new Styler(); let styles = new Polisher();
let styleText = await styles.add("path/to/css/file.css"); let styleText = await styles.add("path/to/css/file.css");
let chunker = new Chunker(DOMContent, document.body, styles).then((flow) => { 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 ...@@ -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). 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. 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). 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 @@ ...@@ -49,7 +49,7 @@
updateContents(val); updateContents(val);
}, false) }, false)
styles = new Paged.Styler(); styles = new Paged.Polisher();
styleText = await styles.add("assets/styles/moby-dick.css"); styleText = await styles.add("assets/styles/moby-dick.css");
async function updateContents(str) { async function updateContents(str) {
......
{ {
"name": "pagedjs", "name": "pagedjs",
"version": "0.0.1", "version": "0.0.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
......
...@@ -41,10 +41,10 @@ const TEMPLATE = `<div class="page"> ...@@ -41,10 +41,10 @@ const TEMPLATE = `<div class="page">
* @class * @class
*/ */
class Chunker { class Chunker {
constructor(content, renderTo, styler, preview) { constructor(content, renderTo, polisher, preview) {
this.pagesArea = document.createElement("div"); this.pagesArea = document.createElement("div");
this.pagesArea.classList.add("pages"); this.pagesArea.classList.add("pages");
this.styles = styler; this.styles = polisher;
if (renderTo) { if (renderTo) {
renderTo.appendChild(this.pagesArea); renderTo.appendChild(this.pagesArea);
} else { } else {
...@@ -63,16 +63,16 @@ class Chunker { ...@@ -63,16 +63,16 @@ class Chunker {
this.content = content; this.content = content;
if (content) { if (content) {
return this.flow(content, styler); return this.flow(content, polisher);
} }
return this; return this;
} }
async flow(content, styler) { async flow(content, polisher) {
let parsed = new ContentParser(content); let parsed = new ContentParser(content);
this.styles = styler; this.styles = polisher;
this.breaks = this.styles && this.styles.breaks; this.breaks = this.styles && this.styles.breaks;
this.styles && this.styles.contents(parsed); this.styles && this.styles.contents(parsed);
......
import Chunker from './chunker/chunker'; import Chunker from './chunker/chunker';
import Styler from './styles/styler'; import Polisher from './polisher/polisher';
export { export {
Chunker, Chunker,
Styler Polisher
}; };
...@@ -2,7 +2,7 @@ import Sheet from './sheet'; ...@@ -2,7 +2,7 @@ import Sheet from './sheet';
import baseStyles from './base'; import baseStyles from './base';
import { UUID } from '../utils/utils'; import { UUID } from '../utils/utils';
class Styler { class Polisher {
constructor() { constructor() {
this.sheets = []; this.sheets = [];
this.inserted = []; this.inserted = [];
...@@ -221,4 +221,4 @@ class Styler { ...@@ -221,4 +221,4 @@ class Styler {
} }
} }
export default Styler; export default Polisher;
import Chunker from '../chunker/chunker'; 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})}); // let ready = new Promise(function($){document.addEventListener('DOMContentLoaded',$,{once:true})});
...@@ -51,7 +51,7 @@ ready.then(async function () { ...@@ -51,7 +51,7 @@ ready.then(async function () {
// TODO: add inline styles // TODO: add inline styles
// Process styles // Process styles
let styles = new Styler(); let styles = new Polisher();
let styleText = await styles.add(...hrefs); 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