tikzify 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/book.ts +7 -10
- package/src/index.ts +1 -0
package/package.json
CHANGED
package/src/book.ts
CHANGED
|
@@ -7,12 +7,9 @@ import { emojiMap } from './emojis'
|
|
|
7
7
|
export type Page = z.infer<typeof Page>
|
|
8
8
|
export const Page = z.object({
|
|
9
9
|
gradient: gradient,
|
|
10
|
-
|
|
10
|
+
textBackground: z.string(),
|
|
11
11
|
text: z.string().max(1024),
|
|
12
|
-
emojis: z.
|
|
13
|
-
text: z.array(Emoji).length(3),
|
|
14
|
-
image: z.array(Emoji).length(3),
|
|
15
|
-
}),
|
|
12
|
+
emojis: z.array(Emoji).length(6),
|
|
16
13
|
jpgBase64: z.string().max(300_000)
|
|
17
14
|
})
|
|
18
15
|
|
|
@@ -46,13 +43,13 @@ export function bookTex(book: Book) {
|
|
|
46
43
|
const pages = book.pages
|
|
47
44
|
|
|
48
45
|
const emojiElements = Object.fromEntries(
|
|
49
|
-
pages.flatMap(p =>
|
|
46
|
+
pages.flatMap(p => p.emojis.map(emoji => {
|
|
50
47
|
const svg = emojiMap[emoji]
|
|
51
48
|
return [emoji, fromSvg(svg!)]
|
|
52
49
|
})))
|
|
53
50
|
|
|
54
51
|
const gradColors = pages.flatMap(p => p.gradient)
|
|
55
|
-
const textBgColors = pages.map(p => p.
|
|
52
|
+
const textBgColors = pages.map(p => p.textBackground)
|
|
56
53
|
const emojiColors = Object.values(emojiElements).flatMap(es => es.flatMap(getColors))
|
|
57
54
|
const colors = colorMap(new Set([
|
|
58
55
|
book.color,
|
|
@@ -123,8 +120,8 @@ ${book.pages.map((page, i) => {
|
|
|
123
120
|
}).join('\n')
|
|
124
121
|
}
|
|
125
122
|
|
|
126
|
-
const esText = emojisTex(page.emojis.
|
|
127
|
-
const esImage = emojisTex(page.emojis.
|
|
123
|
+
const esText = emojisTex(page.emojis.slice(0, 3), TRANSFORMS_TEXT)
|
|
124
|
+
const esImage = emojisTex(page.emojis.slice(3, 6), TRANSFORMS_IMAGE)
|
|
128
125
|
const rtl = book.lang === 'he'
|
|
129
126
|
|
|
130
127
|
const image = String.raw`
|
|
@@ -155,7 +152,7 @@ ${esImage}
|
|
|
155
152
|
(current page.south west) rectangle ([xshift=148.5mm]current page.north east);
|
|
156
153
|
\fill[
|
|
157
154
|
opacity=0.2,
|
|
158
|
-
color=c${colors[page.
|
|
155
|
+
color=c${colors[page.textBackground]},
|
|
159
156
|
yshift=-20,
|
|
160
157
|
xscale=380,
|
|
161
158
|
yscale=-500,
|