Skip to content

Commit 41574aa

Browse files
refactor: change the default presentations dimensions
I changed the default dimensions from `45x80` to `4500x8000`, so by a factor of 100. The reason I did this is so that you're able to use tailwind classes with 0.01 unit accuracy. Before if you wanted to use something that was not exactly an integer unit you'd have to resort to the `calc` and `var` CSS functions. That is not that clean as you'd have to add a style attribute and then add CSS, which is a lot of extra text. The only problem now is that unit is tiny, so you have to specify width as `2000` for example. I think this is a trade of that is worth it.
1 parent dc47176 commit 41574aa

File tree

11 files changed

+16
-17
lines changed

11 files changed

+16
-17
lines changed

browser/css/modes/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const latex = /*CSS*/ `
6969
}
7070
`;
7171

72-
const fontSize = 1;
72+
const fontSize = 100;
7373

7474
/** The CSS related to the body. */
7575
const body = /*CSS*/ `

browser/css/modes/pdf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const body = /*CSS*/ `
1717
// eslint-disable-next-line no-inline-comments
1818
const slide = /*CSS*/ `
1919
body slyde-component[level="${Component.level.slide}"] {
20-
margin-bottom: var(--unit);
20+
margin-bottom: calc(var(--unit) * 100);
2121
}
2222
2323
body slyde-component[level="${Component.level.slide}"]:last-child {

browser/css/tw-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { SlydeHtmlDocumentCssProperties } from '#browser/css/types';
22

33
/** Tells the config to force this to scale only using `--unit`. */
44
const scaleWithUnit = Object.fromEntries(
5-
Array.from({ length: 1000 }, (_ignore, amount) => [amount, `calc(${amount} * var(--unit))`])
5+
Array.from({ length: 10000 }, (_ignore, amount) => [amount, `calc(${amount} * var(--unit))`])
66
);
77

88
/** The config for tailwind in the browser. */

lib/core/components/blocks/highlight.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export class Highlight extends Component {
2929
@Component.utils.children.require
3030
// eslint-disable-next-line jsdoc/require-jsdoc
3131
public render({ children }: Component.RenderArguments): string {
32+
const borderColor = `border-color:${this.#borderColor}`;
33+
3234
// eslint-disable-next-line no-inline-comments
3335
let title = /*HTML*/ `
3436
<h4 class="flex items-center gap-2 text-LG font-semibold" style="color:${this.#borderColor}">
@@ -38,12 +40,9 @@ export class Highlight extends Component {
3840

3941
if (this.#title === null) title = '';
4042

41-
const borderColor = `border-color:${this.#borderColor}`;
42-
const borderWidth = `border-width:calc((1/6)*var(--unit));border-left-width:calc((3/6)*var(--unit));`;
43-
4443
// eslint-disable-next-line no-inline-comments
4544
return /*HTML*/ `
46-
<div class="p-1 mt-1" style="${borderColor};${borderWidth}">
45+
<div class="p-100 mt-100 border-21 border-l-50" style="${borderColor}">
4746
${title}
4847
<div id="${this.id}-children-container">
4948
${children?.()}

lib/core/components/blocks/point.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class Point extends Component {
3131
readonly #paddingTop = Component.utils.extract({
3232
aliases: ['padding-top', 'pt'],
3333
context: this,
34-
fallback: 1,
34+
fallback: 100,
3535
transform: Component.utils.transform.number,
3636
});
3737

@@ -42,7 +42,7 @@ export class Point extends Component {
4242
const inner = children!();
4343
// eslint-disable-next-line no-inline-comments
4444
return /*HTML*/ `
45-
<div class="pt-1 block before:content-['${symbolMap[this.#symbol]}'] before:mr-1 before:text-foreground"
45+
<div class="pt-100 block before:content-['${symbolMap[this.#symbol]}'] before:mr-100 before:text-foreground"
4646
style="padding-top: calc(${this.#paddingTop} * var(--unit));">
4747
${inner}
4848
</div>

lib/core/components/blocks/table.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ export class Table extends Component {
4040
// eslint-disable-next-line no-inline-comments
4141
return /* CSS */ `
4242
#id table {
43-
--line-width: calc(var(--unit) / 8);
44-
--padding-x: calc(var(--unit) * 2);
45-
--padding-y: calc(var(--unit) / 2);
43+
--line-width: calc(var(--unit) * 12.5);
44+
--padding-x: calc(var(--unit) * 200);
45+
--padding-y: calc(var(--unit) * 50);
4646
4747
border-collapse: collapse;
4848
border: none;

lib/core/components/blocks/text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class Text extends Component {
99
// eslint-disable-next-line @typescript-eslint/class-methods-use-this, jsdoc/require-jsdoc
1010
public render({ children }: Component.RenderArguments): string {
1111
// eslint-disable-next-line no-inline-comments
12-
return /*HTML*/ `<div class="block py-2">${children?.()}</div>`;
12+
return /*HTML*/ `<div class="block py-200">${children?.()}</div>`;
1313
}
1414

1515
// eslint-disable-next-line @typescript-eslint/class-methods-use-this, jsdoc/require-jsdoc

lib/core/components/slides/question-slide.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class QuestionSlide extends Component {
1717
// eslint-disable-next-line no-inline-comments
1818
return /*HTML*/ `
1919
<div class="h-full w-full flex justify-center items-center overflow-hidden">
20-
<h2 class="text-primary font-bold text-lg">${this.#title}</h2>
20+
<h2 class="text-primary font-bold text-3xl">${this.#title}</h2>
2121
${children?.() ?? ''}
2222
</div>
2323
`;

lib/core/components/slides/slide.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class Slide extends Component {
1515
readonly #padding: number = Component.utils.extract({
1616
aliases: ['padding', 'p'],
1717
context: this,
18-
fallback: 4,
18+
fallback: 400,
1919
transform: Component.utils.transform.number,
2020
});
2121

lib/core/components/slides/title-slide.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class TitleSlide extends Component {
2727
// eslint-disable-next-line no-inline-comments
2828
return /*HTML*/ `
2929
<div class="h-full w-full flex justify-center items-center overflow-hidden">
30-
<h2 class="text-primary font-bold text-lg">${this.#title}</h2>
30+
<h2 class="text-primary font-bold text-3xl">${this.#title}</h2>
3131
${authors}
3232
</div>
3333
`;

0 commit comments

Comments
 (0)