@lincyaw/render-slides 0.0.0-stage → 1.0.0-rc.0

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.
@@ -0,0 +1,36 @@
1
+ interface Palette {
2
+ type: 'light' | 'dark'
3
+ background: string
4
+ ink: string
5
+ muted: string
6
+ keyword: string
7
+ string: string
8
+ key: string
9
+ number: string
10
+ deleted: string
11
+ }
12
+
13
+ function theme(name: string, c: Palette) {
14
+ const rule = (scope: string[], foreground: string, fontStyle?: string) => ({ scope, settings: { foreground, ...fontStyle ? { fontStyle } : {} } })
15
+ return {
16
+ name,
17
+ type: c.type,
18
+ colors: { 'editor.background': c.background, 'editor.foreground': c.ink },
19
+ tokenColors: [
20
+ { settings: { foreground: c.ink, background: c.background } },
21
+ rule(['comment', 'punctuation.definition.comment'], c.muted, 'italic'),
22
+ rule(['keyword', 'storage', 'storage.type', 'storage.modifier', 'keyword.control', 'keyword.operator.word', 'keyword.operator.logical.python', 'entity.name.tag'], c.keyword),
23
+ rule(['string', 'punctuation.definition.string', 'string.quoted', 'markup.inserted'], c.string),
24
+ rule(['entity.name.function', 'support.function', 'entity.name.type', 'entity.name.class', 'support.type', 'support.class', 'entity.other.attribute-name', 'meta.object-literal.key', 'support.type.property-name'], c.key),
25
+ rule(['constant.numeric', 'constant.language', 'constant.character', 'support.constant', 'variable.language'], c.number),
26
+ rule(['markup.deleted', 'invalid'], c.deleted),
27
+ ],
28
+ }
29
+ }
30
+
31
+ export default () => ({
32
+ themes: {
33
+ light: theme('presmium-book-light', { type: 'light', background: '#ffffff', ink: '#1c1b19', muted: '#5c584f', keyword: '#8a3b12', string: '#2f6b3a', key: '#7a3e8e', number: '#0f5f5c', deleted: '#a3321c' }),
34
+ dark: theme('presmium-book-dark', { type: 'dark', background: '#1f1e1b', ink: '#edeae3', muted: '#a9a498', keyword: '#e59a6b', string: '#9ccb8f', key: '#d3a3e3', number: '#6fc1b9', deleted: '#ee9a86' }),
35
+ },
36
+ })
@@ -0,0 +1,25 @@
1
+ interface Options {
2
+ userRoot: string
3
+ roots: string[]
4
+ }
5
+
6
+ function fromDeck(deck: string, path: string): string {
7
+ const from = deck.split(/[\\/]/).filter(Boolean)
8
+ const to = path.split(/[\\/]/).filter(Boolean)
9
+ let same = 0
10
+ while (same < from.length && same < to.length && from[same] === to[same]) same++
11
+ return [...from.slice(same).map(() => '..'), ...to.slice(same)].join('/') || '.'
12
+ }
13
+
14
+ const CLIENT_SETUPS = '{main,root,routes,shortcuts,code-runners,monaco,mermaid,mermaid-renderer,context-menu}'
15
+
16
+ export default function setup(options: Options) {
17
+ const entries = options.roots.filter(root => !/[\\/]node_modules[\\/]/.test(root)).flatMap((root) => {
18
+ const at = fromDeck(options.userRoot, root)
19
+ return [`${at}/setup/${CLIENT_SETUPS}.{ts,js,mjs}`, `${at}/components/**/*.vue`, `${at}/layouts/*.vue`]
20
+ })
21
+ return [{
22
+ name: 'presmium:book-dependencies',
23
+ config: () => ({ optimizeDeps: { entries } }),
24
+ }]
25
+ }
@@ -0,0 +1,282 @@
1
+ :root,
2
+ html.dark {
3
+ --slidev-theme-primary: var(--pm-color-accent);
4
+ --slidev-theme-background: var(--pm-color-surface);
5
+ --slidev-code-background: var(--pm-color-surface);
6
+ --slidev-code-foreground: var(--pm-color-ink);
7
+ --slidev-code-font-family: var(--pm-font-mono);
8
+ --slidev-code-font-size: 14px;
9
+ --slidev-code-line-height: 1.6;
10
+ --slidev-code-padding: 14px;
11
+ --slidev-code-radius: 10px;
12
+ --slidev-code-margin: 10px 0;
13
+ --slidev-code-tab-divider: var(--pm-color-line);
14
+ --slidev-code-tab-text-color: var(--pm-color-muted);
15
+ --slidev-code-tab-active-text-color: var(--pm-color-ink);
16
+ --slidev-code-tab-font-size: 12px;
17
+ }
18
+
19
+ .slidev-layout {
20
+ box-sizing: border-box;
21
+ height: 100%;
22
+ padding: 40px 56px;
23
+ background: var(--pm-color-bg);
24
+ color: var(--pm-color-ink);
25
+ font-family: var(--pm-font-sans);
26
+ font-size: 18px;
27
+ line-height: 1.6;
28
+ }
29
+
30
+ .slidev-layout :is(h1, h2, h3, h4, h5, h6) {
31
+ margin: 0 0 0.5em;
32
+ color: var(--pm-color-ink);
33
+ line-height: 1.2;
34
+ }
35
+
36
+ .slidev-layout h1 {
37
+ margin: 0 0 18px;
38
+ font-family: var(--pm-font-serif);
39
+ font-size: 40px;
40
+ font-weight: 600;
41
+ line-height: 1.15;
42
+ letter-spacing: -0.005em;
43
+ }
44
+
45
+ .slidev-layout h2 {
46
+ font-family: var(--pm-font-serif);
47
+ font-size: 28px;
48
+ font-weight: 600;
49
+ }
50
+
51
+ .slidev-layout h3 {
52
+ font-size: 22px;
53
+ font-weight: 600;
54
+ }
55
+
56
+ .slidev-layout :is(h4, h5, h6) {
57
+ font-size: 18px;
58
+ font-weight: 600;
59
+ }
60
+
61
+ .slidev-layout p {
62
+ margin: 12px 0;
63
+ }
64
+
65
+ .slidev-layout :is(ul, ol) {
66
+ margin: 12px 0;
67
+ padding-left: 1.3em;
68
+ }
69
+
70
+ .slidev-layout ul {
71
+ list-style: disc;
72
+ }
73
+
74
+ .slidev-layout ol {
75
+ list-style: decimal;
76
+ }
77
+
78
+ .slidev-layout li {
79
+ margin: 4px 0;
80
+ padding-left: 0.2em;
81
+ }
82
+
83
+ .slidev-layout li::marker {
84
+ color: var(--pm-color-accent);
85
+ }
86
+
87
+ .slidev-layout :is(b, strong) {
88
+ font-weight: 600;
89
+ }
90
+
91
+ .slidev-layout a {
92
+ color: var(--pm-color-accent);
93
+ text-decoration: underline;
94
+ text-underline-offset: 3px;
95
+ }
96
+
97
+ .slidev-layout blockquote {
98
+ margin: 12px 0;
99
+ padding: 2px 0 2px 18px;
100
+ border-left: 3px solid var(--pm-color-accent);
101
+ color: var(--pm-color-muted);
102
+ }
103
+
104
+ .slidev-layout blockquote > * {
105
+ margin: 4px 0;
106
+ }
107
+
108
+ .slidev-layout table {
109
+ width: 100%;
110
+ margin: 12px 0;
111
+ border-collapse: collapse;
112
+ font-size: 0.85em;
113
+ font-variant-numeric: tabular-nums;
114
+ }
115
+
116
+ .slidev-layout :is(th, td) {
117
+ padding: 6px 12px;
118
+ border-bottom: 1px solid var(--pm-color-line);
119
+ text-align: left;
120
+ }
121
+
122
+ .slidev-layout th {
123
+ border-bottom-color: var(--pm-color-line-strong);
124
+ color: var(--pm-color-muted);
125
+ font-weight: 600;
126
+ }
127
+
128
+ .slidev-layout kbd {
129
+ padding: 0 0.35em;
130
+ border: 1px solid var(--pm-color-line-strong);
131
+ border-radius: var(--pm-radius-chip);
132
+ font-family: var(--pm-font-mono);
133
+ font-size: 0.8em;
134
+ }
135
+
136
+ .slidev-layout code {
137
+ font-family: var(--pm-font-mono);
138
+ }
139
+
140
+ .slidev-layout :not(pre) > code {
141
+ padding: 0.05em 0.35em;
142
+ border-radius: var(--pm-radius-small);
143
+ background: var(--pm-color-accent-soft);
144
+ color: var(--pm-color-accent);
145
+ font-size: 0.9em;
146
+ }
147
+
148
+ .slidev-layout .slidev-code {
149
+ border: 1px solid var(--pm-color-line);
150
+ }
151
+
152
+ .slidev-layout .slidev-code .slidev-code-dishonored {
153
+ opacity: 1;
154
+ }
155
+
156
+ .slidev-layout .slidev-code .slidev-code-dishonored span {
157
+ color: color-mix(in srgb, var(--pm-color-ink) 62%, var(--pm-color-surface));
158
+ }
159
+
160
+ .slidev-layout .slidev-code-block-title,
161
+ .slidev-layout .slidev-code-group-tabs {
162
+ border: 1px solid var(--pm-color-line);
163
+ border-bottom: 0;
164
+ }
165
+
166
+ .slidev-layout.pm-book {
167
+ position: relative;
168
+ padding: 34px 56px 46px;
169
+ }
170
+
171
+ .slidev-layout.pm-book .footnotes {
172
+ right: 56px;
173
+ bottom: 40px;
174
+ left: 56px;
175
+ }
176
+
177
+ .pm-book__content > :is(p, ul, ol, blockquote),
178
+ .pm-book__content > .slidev-vclick-target > :is(p, ul, ol, blockquote) {
179
+ font-family: var(--pm-font-serif);
180
+ }
181
+
182
+ .pm-book__chapter {
183
+ display: flex;
184
+ align-items: center;
185
+ gap: 12px;
186
+ margin: 0 0 10px;
187
+ color: var(--pm-color-accent);
188
+ font-family: var(--pm-font-sans);
189
+ font-size: 12px;
190
+ font-weight: 600;
191
+ letter-spacing: 0.08em;
192
+ line-height: 1.4;
193
+ }
194
+
195
+ .pm-book__chapter::after {
196
+ content: '';
197
+ flex: 1;
198
+ height: 1px;
199
+ background: var(--pm-color-line);
200
+ }
201
+
202
+ .slidev-layout.pm-book--cover {
203
+ display: flex;
204
+ flex-direction: column;
205
+ justify-content: flex-end;
206
+ padding-bottom: 96px;
207
+ }
208
+
209
+ .pm-book--cover h1 {
210
+ max-width: 85%;
211
+ margin-bottom: 18px;
212
+ font-size: 48px;
213
+ line-height: 1.12;
214
+ }
215
+
216
+ .pm-book--cover h1::before {
217
+ content: '';
218
+ display: block;
219
+ width: 48px;
220
+ height: 3px;
221
+ margin-bottom: 22px;
222
+ border-radius: 2px;
223
+ background: var(--pm-color-accent);
224
+ }
225
+
226
+ .pm-book--cover .pm-book__content > :is(p, ul, ol) {
227
+ max-width: 80%;
228
+ color: var(--pm-color-muted);
229
+ font-size: 20px;
230
+ }
231
+
232
+ .pm-book-footer {
233
+ position: absolute;
234
+ right: 56px;
235
+ bottom: 16px;
236
+ left: 56px;
237
+ display: flex;
238
+ align-items: center;
239
+ gap: 12px;
240
+ color: var(--pm-color-muted);
241
+ font-family: var(--pm-font-sans);
242
+ font-size: 11px;
243
+ line-height: 1.2;
244
+ }
245
+
246
+ .pm-book-footer__title {
247
+ min-width: 0;
248
+ overflow: hidden;
249
+ text-overflow: ellipsis;
250
+ white-space: nowrap;
251
+ }
252
+
253
+ .pm-book-footer__steps {
254
+ display: flex;
255
+ flex: none;
256
+ gap: 5px;
257
+ width: min(calc(var(--steps, 1) * 22px - 5px), 40%);
258
+ margin-left: auto;
259
+ }
260
+
261
+ .pm-book-footer__steps > span {
262
+ flex: 1;
263
+ min-width: 2px;
264
+ height: 3px;
265
+ border-radius: 2px;
266
+ background: var(--pm-color-line-strong);
267
+ }
268
+
269
+ .pm-book-footer__steps > span[data-done] {
270
+ background: var(--pm-color-accent);
271
+ }
272
+
273
+ .pm-book-footer__page {
274
+ margin-left: auto;
275
+ font-family: var(--pm-font-mono);
276
+ font-variant-numeric: tabular-nums;
277
+ white-space: nowrap;
278
+ }
279
+
280
+ .pm-book-footer__steps + .pm-book-footer__page {
281
+ margin-left: 0;
282
+ }
@@ -0,0 +1,2 @@
1
+ import '@lincyaw/host/design.css'
2
+ import './book.css'