themed-markdown 0.1.3 → 0.1.4

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/dist/index.d.ts CHANGED
@@ -16,4 +16,7 @@ export { parseMarkdownIntoPresentation, serializePresentationToMarkdown, updateP
16
16
  export { parseMarkdownChunks } from './utils/markdownUtils';
17
17
  export type { MarkdownPresentation, MarkdownSlide, MarkdownPresentationFormat, MarkdownSource, MarkdownSourceType, RepositoryInfo, MarkdownSlideLocation, } from './types/presentation';
18
18
  export type { Theme } from '../industryTheme';
19
+ export { theme as defaultTheme } from '../industryTheme';
20
+ export { ThemeProvider, useTheme, useThemeSafe, getThemeWithMode, withTheme } from '../industryTheme/ThemeProvider';
21
+ export { scaleThemeFonts, increaseFontScale, decreaseFontScale, resetFontScale } from '../industryTheme';
19
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../industryMarkdown/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,YAAY,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAGrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAG3F,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAu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AAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAG7F,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,EAC/B,uBAAuB,EACvB,uCAAuC,EACvC,sBAAsB,EACtB,iBAAiB,EACjB,kCAAkC,EAClC,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1B,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EACL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACV,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACf,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -42,22 +42,32 @@ var __export = (target, all) => {
42
42
  // industryMarkdown/index.ts
43
43
  var exports_industryMarkdown = {};
44
44
  __export(exports_industryMarkdown, {
45
+ withTheme: () => withTheme,
46
+ useThemeSafe: () => useThemeSafe,
47
+ useTheme: () => useTheme,
45
48
  useIndustryHtmlModal: () => useIndustryHtmlModal,
46
49
  updateSlideTitle: () => updateSlideTitle,
47
50
  updateSlideContent: () => updateSlideContent,
48
51
  updatePresentationSlide: () => updatePresentationSlide,
49
52
  serializePresentationToMarkdown: () => serializePresentationToMarkdown,
53
+ scaleThemeFonts: () => scaleThemeFonts,
54
+ resetFontScale: () => resetFontScale,
50
55
  reconstructMarkdownContent: () => reconstructMarkdownContent,
51
56
  parseMarkdownIntoPresentationFromSource: () => parseMarkdownIntoPresentationFromSource,
52
57
  parseMarkdownIntoPresentation: () => parseMarkdownIntoPresentation,
53
58
  parseMarkdownChunks: () => parseMarkdownChunks,
59
+ increaseFontScale: () => increaseFontScale,
60
+ getThemeWithMode: () => getThemeWithMode,
54
61
  getAllSlideTitles: () => getAllSlideTitles,
55
62
  findSlideIndexByTitle: () => findSlideIndexByTitle,
56
63
  findSlideByTitle: () => findSlideByTitle,
57
64
  extractSlideTitle: () => extractSlideTitle,
65
+ defaultTheme: () => theme,
66
+ decreaseFontScale: () => decreaseFontScale,
58
67
  createPresentationWithErrorMessage: () => createPresentationWithErrorMessage,
59
68
  createIndustryMarkdownComponents: () => createIndustryMarkdownComponents,
60
69
  createGithubFileSource: () => createGithubFileSource,
70
+ ThemeProvider: () => ThemeProvider,
61
71
  SlidePresentation: () => SlidePresentation,
62
72
  IndustryZoomableMermaidDiagram: () => IndustryZoomableMermaidDiagram,
63
73
  IndustryPlaceholderModal: () => IndustryPlaceholderModal,
@@ -127,6 +137,47 @@ var getThemeWithMode = (baseTheme, colorMode) => {
127
137
  }
128
138
  };
129
139
  };
140
+ var ThemeProvider = ({
141
+ children,
142
+ theme: customTheme = theme,
143
+ initialColorMode = "dark"
144
+ }) => {
145
+ const [colorMode, setColorMode] = import_react.useState(initialColorMode);
146
+ import_react.useEffect(() => {
147
+ const savedMode = localStorage.getItem("principlemd-color-mode");
148
+ if (savedMode === "light" || savedMode === "dark") {
149
+ setColorMode(savedMode);
150
+ } else {
151
+ const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
152
+ setColorMode(prefersDark ? "dark" : "light");
153
+ }
154
+ }, []);
155
+ import_react.useEffect(() => {
156
+ localStorage.setItem("principlemd-color-mode", colorMode);
157
+ }, [colorMode]);
158
+ const toggleColorMode = () => {
159
+ setColorMode((prev) => prev === "light" ? "dark" : "light");
160
+ };
161
+ const themeWithMode = getThemeWithMode(customTheme, colorMode);
162
+ const value = {
163
+ theme: themeWithMode,
164
+ colorMode,
165
+ setColorMode,
166
+ toggleColorMode
167
+ };
168
+ return /* @__PURE__ */ import_react.default.createElement(ThemeContextSingleton.Provider, {
169
+ value
170
+ }, children);
171
+ };
172
+ var withTheme = (Component) => {
173
+ return (props) => {
174
+ const { theme: theme2 } = useTheme();
175
+ return /* @__PURE__ */ import_react.default.createElement(Component, {
176
+ ...props,
177
+ theme: theme2
178
+ });
179
+ };
180
+ };
130
181
 
131
182
  // industryTheme/index.ts
132
183
  var theme = {
@@ -264,6 +315,28 @@ var theme = {
264
315
  }
265
316
  }
266
317
  };
318
+ function scaleThemeFonts(theme2, scale) {
319
+ const currentScale = theme2.fontScale || 1;
320
+ const effectiveScale = scale / currentScale;
321
+ return {
322
+ ...theme2,
323
+ fontSizes: theme2.fontSizes.map((size) => Math.round(size * effectiveScale)),
324
+ fontScale: scale
325
+ };
326
+ }
327
+ function increaseFontScale(theme2) {
328
+ const currentScale = theme2.fontScale || 1;
329
+ const newScale = Math.min(currentScale * 1.1, 2);
330
+ return scaleThemeFonts(theme2, newScale);
331
+ }
332
+ function decreaseFontScale(theme2) {
333
+ const currentScale = theme2.fontScale || 1;
334
+ const newScale = Math.max(currentScale * 0.9, 0.5);
335
+ return scaleThemeFonts(theme2, newScale);
336
+ }
337
+ function resetFontScale(theme2) {
338
+ return scaleThemeFonts(theme2, 1);
339
+ }
267
340
 
268
341
  // industryMarkdown/utils/markdownUtils.ts
269
342
  function hashMarkdownString(str) {
package/dist/index.mjs CHANGED
@@ -55,6 +55,47 @@ var getThemeWithMode = (baseTheme, colorMode) => {
55
55
  }
56
56
  };
57
57
  };
58
+ var ThemeProvider = ({
59
+ children,
60
+ theme: customTheme = theme,
61
+ initialColorMode = "dark"
62
+ }) => {
63
+ const [colorMode, setColorMode] = useState(initialColorMode);
64
+ useEffect(() => {
65
+ const savedMode = localStorage.getItem("principlemd-color-mode");
66
+ if (savedMode === "light" || savedMode === "dark") {
67
+ setColorMode(savedMode);
68
+ } else {
69
+ const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
70
+ setColorMode(prefersDark ? "dark" : "light");
71
+ }
72
+ }, []);
73
+ useEffect(() => {
74
+ localStorage.setItem("principlemd-color-mode", colorMode);
75
+ }, [colorMode]);
76
+ const toggleColorMode = () => {
77
+ setColorMode((prev) => prev === "light" ? "dark" : "light");
78
+ };
79
+ const themeWithMode = getThemeWithMode(customTheme, colorMode);
80
+ const value = {
81
+ theme: themeWithMode,
82
+ colorMode,
83
+ setColorMode,
84
+ toggleColorMode
85
+ };
86
+ return /* @__PURE__ */ React.createElement(ThemeContextSingleton.Provider, {
87
+ value
88
+ }, children);
89
+ };
90
+ var withTheme = (Component) => {
91
+ return (props) => {
92
+ const { theme: theme2 } = useTheme();
93
+ return /* @__PURE__ */ React.createElement(Component, {
94
+ ...props,
95
+ theme: theme2
96
+ });
97
+ };
98
+ };
58
99
 
59
100
  // industryTheme/index.ts
60
101
  var theme = {
@@ -192,6 +233,28 @@ var theme = {
192
233
  }
193
234
  }
194
235
  };
236
+ function scaleThemeFonts(theme2, scale) {
237
+ const currentScale = theme2.fontScale || 1;
238
+ const effectiveScale = scale / currentScale;
239
+ return {
240
+ ...theme2,
241
+ fontSizes: theme2.fontSizes.map((size) => Math.round(size * effectiveScale)),
242
+ fontScale: scale
243
+ };
244
+ }
245
+ function increaseFontScale(theme2) {
246
+ const currentScale = theme2.fontScale || 1;
247
+ const newScale = Math.min(currentScale * 1.1, 2);
248
+ return scaleThemeFonts(theme2, newScale);
249
+ }
250
+ function decreaseFontScale(theme2) {
251
+ const currentScale = theme2.fontScale || 1;
252
+ const newScale = Math.max(currentScale * 0.9, 0.5);
253
+ return scaleThemeFonts(theme2, newScale);
254
+ }
255
+ function resetFontScale(theme2) {
256
+ return scaleThemeFonts(theme2, 1);
257
+ }
195
258
 
196
259
  // industryMarkdown/utils/markdownUtils.ts
197
260
  function hashMarkdownString(str) {
@@ -3490,22 +3553,32 @@ function updatePresentationSlide(presentation, index, newContent) {
3490
3553
  };
3491
3554
  }
3492
3555
  export {
3556
+ withTheme,
3557
+ useThemeSafe,
3558
+ useTheme,
3493
3559
  useIndustryHtmlModal,
3494
3560
  updateSlideTitle,
3495
3561
  updateSlideContent,
3496
3562
  updatePresentationSlide,
3497
3563
  serializePresentationToMarkdown,
3564
+ scaleThemeFonts,
3565
+ resetFontScale,
3498
3566
  reconstructMarkdownContent,
3499
3567
  parseMarkdownIntoPresentationFromSource,
3500
3568
  parseMarkdownIntoPresentation,
3501
3569
  parseMarkdownChunks,
3570
+ increaseFontScale,
3571
+ getThemeWithMode,
3502
3572
  getAllSlideTitles,
3503
3573
  findSlideIndexByTitle,
3504
3574
  findSlideByTitle,
3505
3575
  extractSlideTitle,
3576
+ theme as defaultTheme,
3577
+ decreaseFontScale,
3506
3578
  createPresentationWithErrorMessage,
3507
3579
  createIndustryMarkdownComponents,
3508
3580
  createGithubFileSource,
3581
+ ThemeProvider,
3509
3582
  SlidePresentation,
3510
3583
  IndustryZoomableMermaidDiagram,
3511
3584
  IndustryPlaceholderModal,
@@ -16,4 +16,7 @@ export { parseMarkdownIntoPresentation, serializePresentationToMarkdown, updateP
16
16
  export { parseMarkdownChunks } from './utils/markdownUtils';
17
17
  export type { MarkdownPresentation, MarkdownSlide, MarkdownPresentationFormat, MarkdownSource, MarkdownSourceType, RepositoryInfo, MarkdownSlideLocation, } from './types/presentation';
18
18
  export type { Theme } from '../industryTheme';
19
+ export { theme as defaultTheme } from '../industryTheme';
20
+ export { ThemeProvider, useTheme, useThemeSafe, getThemeWithMode, withTheme } from '../industryTheme/ThemeProvider';
21
+ export { scaleThemeFonts, increaseFontScale, decreaseFontScale, resetFontScale } from '../industryTheme';
19
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../industryMarkdown/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,YAAY,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAGrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAG3F,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAG7F,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,EAC/B,uBAAuB,EACvB,uCAAuC,EACvC,sBAAsB,EACtB,iBAAiB,EACjB,kCAAkC,EAClC,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1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BAAuB,CAAC;AAG5D,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1B,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EACL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACV,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACf,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "themed-markdown",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Industry-themed markdown renderer with presentation capabilities",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -8,10 +8,10 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
12
13
  },
13
- "./industryMarkdown": "./dist/industryMarkdown/index.js",
14
- "./industryTheme": "./dist/industryTheme/index.js"
14
+ "./dist/index.css": "./dist/index.css"
15
15
  },
16
16
  "scripts": {
17
17
  "build": "bun run clean && bun run build:esm && bun run build:cjs && bun run build:types && bun run copy:css && bun run copy:types",