Skip to content

Commit

Permalink
paged integrated 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
dmca-glasgow committed Nov 15, 2024
1 parent 2f19277 commit bb988ae
Show file tree
Hide file tree
Showing 86 changed files with 3,760 additions and 807 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
content="width=device-width, initial-scale=1.0" />
<title>ISOS</title>
</head>

<body>
<textarea id="article" style="display: none"> </textarea>
<div id="root"></div>
Expand Down
74 changes: 0 additions & 74 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
"devDependencies": {
"@axe-core/playwright": "^4.10.0",
"@babel/preset-react": "^7.25.9",
"@linaria/core": "^6.1.0",
"@linaria/react": "^6.1.0",
"@playwright/test": "^1.48.2",
"@preact/preset-vite": "^2.9.1",
"@tauri-apps/cli": "^2.0.4",
Expand Down
6 changes: 6 additions & 0 deletions packages/paged/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"private": true,
"version": "0.0.0",
"type": "module",
"files": [
"src"
],
"exports": [
"./src/index.ts"
],
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down
32 changes: 32 additions & 0 deletions packages/paged/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// @ts-expect-error
import { chunker } from './pagedjs';

import { config } from './config';

import './pagedjs/index.scss';
import './pagedjs/interface.scss';

let loading = true;

export async function render(app: HTMLElement, renderTo: HTMLElement) {
loading = true;

console.log('chunking...');
const chunks = await chunker(app, renderTo, config);
console.log(`took: ${(chunks.performance / 1000).toFixed(2)}s`);

loading = false;
document.dispatchEvent(new Event('pages-loaded'));

return chunks;
}

export function waitForRender() {
return new Promise((resolve) => {
if (loading) {
document.addEventListener('pages-loaded', resolve, { once: true });
} else {
resolve(true);
}
});
}
2 changes: 1 addition & 1 deletion packages/paged/src/pagedjs/interface.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@media screen {
.pages {
#print-view {
$gap: 1em;
margin: 0 auto;

Expand Down
58 changes: 37 additions & 21 deletions packages/paged/src/styles/pages.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,44 @@
.pagedjs_page {
&:first-child {
.pagedjs_page_content > div {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
#print-view {
font-family: Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro,
sans-serif;
font-size: 12pt;
line-height: 1.4;

h1 {
font-size: 1.8em;
text-align: center;
}
.pagedjs_page {
&:first-child {
.pagedjs_page_content > div {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;

h1 {
font-size: 1.8em;
text-align: center;
}

p {
padding-left: 2em;
padding-right: 2em;
p {
padding-left: 2em;
padding-right: 2em;
}
}
}
}
}

// page styling ------

.pagedjs_page_content > div > *:first-child,
.pagedjs_page_content > div > .boxout:first-child *:first-child,
.pagedjs_page_content > div > .boxout:first-child .type {
margin-top: 0;
.pagedjs_page_content > div > *:first-child,
.pagedjs_page_content > div > .boxout:first-child > *:first-child,
.pagedjs_page_content > div > .boxout:first-child > .type,
.pagedjs_page_content > div > section:first-child > *:first-child,
.pagedjs_page_content
> div
> section:first-child
> .boxout:first-child
> *:first-child,
.pagedjs_page_content
> div
> section:first-child
> .boxout:first-child
> .type {
margin-top: 0;
}
}
Loading

0 comments on commit bb988ae

Please sign in to comment.