vite-plugin-react-deck 1.9.1 → 1.11.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.
- package/helpers.d.ts +2 -1
- package/index.cjs +70 -17
- package/index.mjs +70 -17
- package/package.json +1 -1
- package/remark-morph.d.ts +1 -0
- package/themes/index.d.ts +1 -0
- package/themes/light.d.ts +11 -0
- package/types.d.ts +2 -1
package/helpers.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { dark, green, purple, solarizedLight } from "./themes";
|
|
1
|
+
import { dark, green, light, purple, solarizedLight } from "./themes";
|
|
2
2
|
declare const themes: {
|
|
3
3
|
readonly dark: typeof dark;
|
|
4
4
|
readonly green: typeof green;
|
|
5
|
+
readonly light: typeof light;
|
|
5
6
|
readonly purple: typeof purple;
|
|
6
7
|
readonly "solarized-light": typeof solarizedLight;
|
|
7
8
|
};
|
package/index.cjs
CHANGED
|
@@ -66,27 +66,49 @@ var themeTokens2 = {
|
|
|
66
66
|
colors: colors2
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
+
// src/themes/light.ts
|
|
70
|
+
var light_exports = {};
|
|
71
|
+
__export(light_exports, {
|
|
72
|
+
themeTokens: () => themeTokens3
|
|
73
|
+
});
|
|
74
|
+
var colors3 = {
|
|
75
|
+
primary: "#1a1a2e",
|
|
76
|
+
// dark navy text
|
|
77
|
+
secondary: "#0077b6",
|
|
78
|
+
// vivid blue accent
|
|
79
|
+
tertiary: "#f5f5f7"
|
|
80
|
+
// off-white background
|
|
81
|
+
};
|
|
82
|
+
var fonts2 = {
|
|
83
|
+
header: '"Inter", "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
84
|
+
text: '"Inter", "Helvetica Neue", Helvetica, Arial, sans-serif'
|
|
85
|
+
};
|
|
86
|
+
var themeTokens3 = {
|
|
87
|
+
colors: colors3,
|
|
88
|
+
fonts: fonts2
|
|
89
|
+
};
|
|
90
|
+
|
|
69
91
|
// src/themes/purple.ts
|
|
70
92
|
var purple_exports = {};
|
|
71
93
|
__export(purple_exports, {
|
|
72
|
-
themeTokens: () =>
|
|
94
|
+
themeTokens: () => themeTokens4
|
|
73
95
|
});
|
|
74
|
-
var
|
|
96
|
+
var colors4 = {
|
|
75
97
|
//primary: "#56D4F8",
|
|
76
98
|
primary: "#ffffff",
|
|
77
99
|
secondary: "#F530EC",
|
|
78
100
|
tertiary: "#2B135A"
|
|
79
101
|
};
|
|
80
|
-
var
|
|
81
|
-
colors:
|
|
102
|
+
var themeTokens4 = {
|
|
103
|
+
colors: colors4
|
|
82
104
|
};
|
|
83
105
|
|
|
84
106
|
// src/themes/solarized-light.ts
|
|
85
107
|
var solarized_light_exports = {};
|
|
86
108
|
__export(solarized_light_exports, {
|
|
87
|
-
themeTokens: () =>
|
|
109
|
+
themeTokens: () => themeTokens5
|
|
88
110
|
});
|
|
89
|
-
var
|
|
111
|
+
var colors5 = {
|
|
90
112
|
primary: "#073642",
|
|
91
113
|
// base02 - dark text on light background
|
|
92
114
|
secondary: "#268bd2",
|
|
@@ -94,19 +116,20 @@ var colors4 = {
|
|
|
94
116
|
tertiary: "#fdf6e3"
|
|
95
117
|
// base3 - light background
|
|
96
118
|
};
|
|
97
|
-
var
|
|
119
|
+
var fonts3 = {
|
|
98
120
|
header: '"Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
99
121
|
text: '"Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif'
|
|
100
122
|
};
|
|
101
|
-
var
|
|
102
|
-
colors:
|
|
103
|
-
fonts:
|
|
123
|
+
var themeTokens5 = {
|
|
124
|
+
colors: colors5,
|
|
125
|
+
fonts: fonts3
|
|
104
126
|
};
|
|
105
127
|
|
|
106
128
|
// src/helpers.ts
|
|
107
129
|
var themes = {
|
|
108
130
|
dark: dark_exports,
|
|
109
131
|
green: green_exports,
|
|
132
|
+
light: light_exports,
|
|
110
133
|
purple: purple_exports,
|
|
111
134
|
"solarized-light": solarized_light_exports
|
|
112
135
|
};
|
|
@@ -136,10 +159,10 @@ function createDecksPageFile({
|
|
|
136
159
|
}) {
|
|
137
160
|
var _a;
|
|
138
161
|
const themeModule = themes[theme];
|
|
139
|
-
const
|
|
140
|
-
const primary = (
|
|
141
|
-
const secondary = (
|
|
142
|
-
const tertiary = (
|
|
162
|
+
const colors6 = (_a = themeModule == null ? void 0 : themeModule.themeTokens) == null ? void 0 : _a.colors;
|
|
163
|
+
const primary = (colors6 == null ? void 0 : colors6.primary) ?? "#ffffff";
|
|
164
|
+
const secondary = (colors6 == null ? void 0 : colors6.secondary) ?? "#F49676";
|
|
165
|
+
const tertiary = (colors6 == null ? void 0 : colors6.tertiary) ?? "#042F3B";
|
|
143
166
|
return `import React, { StrictMode, useState } from "react";
|
|
144
167
|
import * as ReactDOM from "react-dom/client";
|
|
145
168
|
|
|
@@ -455,7 +478,7 @@ var import_mdx = require("@mdx-js/mdx");
|
|
|
455
478
|
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
456
479
|
var import_remark_directive = __toESM(require("remark-directive"), 1);
|
|
457
480
|
var import_remark_gfm = __toESM(require("remark-gfm"), 1);
|
|
458
|
-
var
|
|
481
|
+
var import_unist_util_visit2 = require("unist-util-visit");
|
|
459
482
|
|
|
460
483
|
// src/codegen.ts
|
|
461
484
|
var Patterns = {
|
|
@@ -492,6 +515,35 @@ ${header}
|
|
|
492
515
|
`.trim();
|
|
493
516
|
}
|
|
494
517
|
|
|
518
|
+
// src/remark-morph.ts
|
|
519
|
+
var import_unist_util_visit = require("unist-util-visit");
|
|
520
|
+
var MORPH_EXPR_RE = /^morph\s*=\s*"([^"]+)"$/;
|
|
521
|
+
function remarkMorph() {
|
|
522
|
+
return (tree) => {
|
|
523
|
+
(0, import_unist_util_visit.visit)(tree, "mdxTextExpression", (node, index, parent) => {
|
|
524
|
+
if (!parent || index == null) return;
|
|
525
|
+
const match = node.value.match(MORPH_EXPR_RE);
|
|
526
|
+
if (!match) return;
|
|
527
|
+
const morphName = match[1];
|
|
528
|
+
parent.children.splice(index, 1);
|
|
529
|
+
if (index > 0) {
|
|
530
|
+
const prev = parent.children[index - 1];
|
|
531
|
+
if (prev.type === "text") {
|
|
532
|
+
prev.value = prev.value.replace(/\s+$/, "");
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (!parent.data) {
|
|
536
|
+
parent.data = {};
|
|
537
|
+
}
|
|
538
|
+
if (!parent.data.hProperties) {
|
|
539
|
+
parent.data.hProperties = {};
|
|
540
|
+
}
|
|
541
|
+
parent.data.hProperties.morph = morphName;
|
|
542
|
+
return [import_unist_util_visit.SKIP, index];
|
|
543
|
+
});
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
|
|
495
547
|
// src/slides.ts
|
|
496
548
|
var INCLUDE_RE = /^::include\{file=(.+?)\}\s*$/gm;
|
|
497
549
|
function resolveIncludes(content, filePath, { maxDepth = 10, _depth = 0 } = {}) {
|
|
@@ -528,7 +580,7 @@ function resolveIncludes(content, filePath, { maxDepth = 10, _depth = 0 } = {})
|
|
|
528
580
|
}
|
|
529
581
|
function myRemarkPlugin() {
|
|
530
582
|
return (tree) => {
|
|
531
|
-
(0,
|
|
583
|
+
(0, import_unist_util_visit2.visit)(tree, (node) => {
|
|
532
584
|
if (node.type === "containerDirective" || node.type === "leafDirective" || node.type === "textDirective") {
|
|
533
585
|
if (!node.data) {
|
|
534
586
|
node.data = {};
|
|
@@ -586,6 +638,7 @@ ${slide}
|
|
|
586
638
|
import_remark_gfm.default,
|
|
587
639
|
import_remark_directive.default,
|
|
588
640
|
myRemarkPlugin,
|
|
641
|
+
remarkMorph,
|
|
589
642
|
...options.remarkPlugins
|
|
590
643
|
]
|
|
591
644
|
});
|
|
@@ -665,7 +718,7 @@ var import_lodash = __toESM(require("lodash"), 1);
|
|
|
665
718
|
// src/types.ts
|
|
666
719
|
var import_zod = require("zod");
|
|
667
720
|
var PestacleConfigSchema = import_zod.z.object({
|
|
668
|
-
theme: import_zod.z.enum(["dark", "green", "purple", "solarized-light"]).default("green"),
|
|
721
|
+
theme: import_zod.z.enum(["dark", "green", "light", "purple", "solarized-light"]).default("green"),
|
|
669
722
|
startupPage: import_zod.z.boolean().optional(),
|
|
670
723
|
transition: import_zod.z.enum(["fade", "slide", "drop", "none"]).optional()
|
|
671
724
|
});
|
package/index.mjs
CHANGED
|
@@ -45,27 +45,49 @@ var themeTokens2 = {
|
|
|
45
45
|
colors: colors2
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
// src/themes/light.ts
|
|
49
|
+
var light_exports = {};
|
|
50
|
+
__export(light_exports, {
|
|
51
|
+
themeTokens: () => themeTokens3
|
|
52
|
+
});
|
|
53
|
+
var colors3 = {
|
|
54
|
+
primary: "#1a1a2e",
|
|
55
|
+
// dark navy text
|
|
56
|
+
secondary: "#0077b6",
|
|
57
|
+
// vivid blue accent
|
|
58
|
+
tertiary: "#f5f5f7"
|
|
59
|
+
// off-white background
|
|
60
|
+
};
|
|
61
|
+
var fonts2 = {
|
|
62
|
+
header: '"Inter", "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
63
|
+
text: '"Inter", "Helvetica Neue", Helvetica, Arial, sans-serif'
|
|
64
|
+
};
|
|
65
|
+
var themeTokens3 = {
|
|
66
|
+
colors: colors3,
|
|
67
|
+
fonts: fonts2
|
|
68
|
+
};
|
|
69
|
+
|
|
48
70
|
// src/themes/purple.ts
|
|
49
71
|
var purple_exports = {};
|
|
50
72
|
__export(purple_exports, {
|
|
51
|
-
themeTokens: () =>
|
|
73
|
+
themeTokens: () => themeTokens4
|
|
52
74
|
});
|
|
53
|
-
var
|
|
75
|
+
var colors4 = {
|
|
54
76
|
//primary: "#56D4F8",
|
|
55
77
|
primary: "#ffffff",
|
|
56
78
|
secondary: "#F530EC",
|
|
57
79
|
tertiary: "#2B135A"
|
|
58
80
|
};
|
|
59
|
-
var
|
|
60
|
-
colors:
|
|
81
|
+
var themeTokens4 = {
|
|
82
|
+
colors: colors4
|
|
61
83
|
};
|
|
62
84
|
|
|
63
85
|
// src/themes/solarized-light.ts
|
|
64
86
|
var solarized_light_exports = {};
|
|
65
87
|
__export(solarized_light_exports, {
|
|
66
|
-
themeTokens: () =>
|
|
88
|
+
themeTokens: () => themeTokens5
|
|
67
89
|
});
|
|
68
|
-
var
|
|
90
|
+
var colors5 = {
|
|
69
91
|
primary: "#073642",
|
|
70
92
|
// base02 - dark text on light background
|
|
71
93
|
secondary: "#268bd2",
|
|
@@ -73,19 +95,20 @@ var colors4 = {
|
|
|
73
95
|
tertiary: "#fdf6e3"
|
|
74
96
|
// base3 - light background
|
|
75
97
|
};
|
|
76
|
-
var
|
|
98
|
+
var fonts3 = {
|
|
77
99
|
header: '"Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
78
100
|
text: '"Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif'
|
|
79
101
|
};
|
|
80
|
-
var
|
|
81
|
-
colors:
|
|
82
|
-
fonts:
|
|
102
|
+
var themeTokens5 = {
|
|
103
|
+
colors: colors5,
|
|
104
|
+
fonts: fonts3
|
|
83
105
|
};
|
|
84
106
|
|
|
85
107
|
// src/helpers.ts
|
|
86
108
|
var themes = {
|
|
87
109
|
dark: dark_exports,
|
|
88
110
|
green: green_exports,
|
|
111
|
+
light: light_exports,
|
|
89
112
|
purple: purple_exports,
|
|
90
113
|
"solarized-light": solarized_light_exports
|
|
91
114
|
};
|
|
@@ -115,10 +138,10 @@ function createDecksPageFile({
|
|
|
115
138
|
}) {
|
|
116
139
|
var _a;
|
|
117
140
|
const themeModule = themes[theme];
|
|
118
|
-
const
|
|
119
|
-
const primary = (
|
|
120
|
-
const secondary = (
|
|
121
|
-
const tertiary = (
|
|
141
|
+
const colors6 = (_a = themeModule == null ? void 0 : themeModule.themeTokens) == null ? void 0 : _a.colors;
|
|
142
|
+
const primary = (colors6 == null ? void 0 : colors6.primary) ?? "#ffffff";
|
|
143
|
+
const secondary = (colors6 == null ? void 0 : colors6.secondary) ?? "#F49676";
|
|
144
|
+
const tertiary = (colors6 == null ? void 0 : colors6.tertiary) ?? "#042F3B";
|
|
122
145
|
return `import React, { StrictMode, useState } from "react";
|
|
123
146
|
import * as ReactDOM from "react-dom/client";
|
|
124
147
|
|
|
@@ -434,7 +457,7 @@ import { compile } from "@mdx-js/mdx";
|
|
|
434
457
|
import matter from "gray-matter";
|
|
435
458
|
import remarkDirective from "remark-directive";
|
|
436
459
|
import remarkGfm from "remark-gfm";
|
|
437
|
-
import { visit } from "unist-util-visit";
|
|
460
|
+
import { visit as visit2 } from "unist-util-visit";
|
|
438
461
|
|
|
439
462
|
// src/codegen.ts
|
|
440
463
|
var Patterns = {
|
|
@@ -471,6 +494,35 @@ ${header}
|
|
|
471
494
|
`.trim();
|
|
472
495
|
}
|
|
473
496
|
|
|
497
|
+
// src/remark-morph.ts
|
|
498
|
+
import { SKIP, visit } from "unist-util-visit";
|
|
499
|
+
var MORPH_EXPR_RE = /^morph\s*=\s*"([^"]+)"$/;
|
|
500
|
+
function remarkMorph() {
|
|
501
|
+
return (tree) => {
|
|
502
|
+
visit(tree, "mdxTextExpression", (node, index, parent) => {
|
|
503
|
+
if (!parent || index == null) return;
|
|
504
|
+
const match = node.value.match(MORPH_EXPR_RE);
|
|
505
|
+
if (!match) return;
|
|
506
|
+
const morphName = match[1];
|
|
507
|
+
parent.children.splice(index, 1);
|
|
508
|
+
if (index > 0) {
|
|
509
|
+
const prev = parent.children[index - 1];
|
|
510
|
+
if (prev.type === "text") {
|
|
511
|
+
prev.value = prev.value.replace(/\s+$/, "");
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
if (!parent.data) {
|
|
515
|
+
parent.data = {};
|
|
516
|
+
}
|
|
517
|
+
if (!parent.data.hProperties) {
|
|
518
|
+
parent.data.hProperties = {};
|
|
519
|
+
}
|
|
520
|
+
parent.data.hProperties.morph = morphName;
|
|
521
|
+
return [SKIP, index];
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
474
526
|
// src/slides.ts
|
|
475
527
|
var INCLUDE_RE = /^::include\{file=(.+?)\}\s*$/gm;
|
|
476
528
|
function resolveIncludes(content, filePath, { maxDepth = 10, _depth = 0 } = {}) {
|
|
@@ -507,7 +559,7 @@ function resolveIncludes(content, filePath, { maxDepth = 10, _depth = 0 } = {})
|
|
|
507
559
|
}
|
|
508
560
|
function myRemarkPlugin() {
|
|
509
561
|
return (tree) => {
|
|
510
|
-
|
|
562
|
+
visit2(tree, (node) => {
|
|
511
563
|
if (node.type === "containerDirective" || node.type === "leafDirective" || node.type === "textDirective") {
|
|
512
564
|
if (!node.data) {
|
|
513
565
|
node.data = {};
|
|
@@ -565,6 +617,7 @@ ${slide}
|
|
|
565
617
|
remarkGfm,
|
|
566
618
|
remarkDirective,
|
|
567
619
|
myRemarkPlugin,
|
|
620
|
+
remarkMorph,
|
|
568
621
|
...options.remarkPlugins
|
|
569
622
|
]
|
|
570
623
|
});
|
|
@@ -644,7 +697,7 @@ import _ from "lodash";
|
|
|
644
697
|
// src/types.ts
|
|
645
698
|
import { z } from "zod";
|
|
646
699
|
var PestacleConfigSchema = z.object({
|
|
647
|
-
theme: z.enum(["dark", "green", "purple", "solarized-light"]).default("green"),
|
|
700
|
+
theme: z.enum(["dark", "green", "light", "purple", "solarized-light"]).default("green"),
|
|
648
701
|
startupPage: z.boolean().optional(),
|
|
649
702
|
transition: z.enum(["fade", "slide", "drop", "none"]).optional()
|
|
650
703
|
});
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function remarkMorph(): (tree: any) => void;
|
package/themes/index.d.ts
CHANGED
package/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type TransitionName = (typeof TransitionNames)[number];
|
|
|
4
4
|
export interface ReactDeckOptions {
|
|
5
5
|
rehypePlugins: any[];
|
|
6
6
|
remarkPlugins: any[];
|
|
7
|
-
theme: "dark" | "green" | "purple" | "solarized-light";
|
|
7
|
+
theme: "dark" | "green" | "light" | "purple" | "solarized-light";
|
|
8
8
|
/** Show the talks listing page. Defaults to true in dev, false in production. */
|
|
9
9
|
startupPage?: boolean;
|
|
10
10
|
/** Default slide transition. */
|
|
@@ -14,6 +14,7 @@ export declare const PestacleConfigSchema: z.ZodObject<{
|
|
|
14
14
|
theme: z.ZodDefault<z.ZodEnum<{
|
|
15
15
|
dark: "dark";
|
|
16
16
|
green: "green";
|
|
17
|
+
light: "light";
|
|
17
18
|
purple: "purple";
|
|
18
19
|
"solarized-light": "solarized-light";
|
|
19
20
|
}>>;
|