@jsonresume/jsonresume-theme-professional 1.0.19 → 1.0.20

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/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # @jsonresume/jsonresume-theme-professional
2
+
3
+ ## 1.0.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 965cf57: use @jsonresume/core/ssr renderResumeDocument
8
+ - Updated dependencies [ff09f75]
9
+ - @jsonresume/core@0.3.1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2014-2026 JSON Resume contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { renderToString } from "react-dom/server";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { renderToStaticMarkup } from "react-dom/server";
3
3
  import o, { useState, useMemo, useEffect, useContext, useDebugValue, createElement, useRef } from "react";
4
4
  import { marked } from "marked";
5
5
  import { FaMapPin, FaEnvelope, FaPhoneAlt, FaLink, FaLinkedin, FaGithub, FaTwitter } from "react-icons/fa";
@@ -1271,6 +1271,66 @@ var vt = /^\s*<\/[a-z]/i, gt = (function() {
1271
1271
  "production" !== process.env.NODE_ENV && "undefined" != typeof navigator && "ReactNative" === navigator.product && console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");
1272
1272
  var wt = "__sc-".concat(f, "__");
1273
1273
  "production" !== process.env.NODE_ENV && "test" !== process.env.NODE_ENV && "undefined" != typeof window && (window[wt] || (window[wt] = 0), 1 === window[wt] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[wt] += 1);
1274
+ const CSS_RESET = "<style>*,*::before,*::after{box-sizing:border-box}html,body{margin:0;padding:0}body{-webkit-font-smoothing:antialiased}</style>";
1275
+ const TOKENS_CSS_HREF = "https://unpkg.com/@jsonresume/core/dist/tokens.css";
1276
+ const FONTS_PRECONNECT = '<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>';
1277
+ function isHref(value) {
1278
+ return /^(https?:)?\/\//.test(value) || value.trim().startsWith("<link");
1279
+ }
1280
+ function familyParam(family) {
1281
+ const [name, ...rest] = String(family).split(":");
1282
+ const encodedName = name.trim().replace(/\s+/g, "+");
1283
+ return rest.length ? `${encodedName}:${rest.join(":")}` : encodedName;
1284
+ }
1285
+ function googleFontsLinks(families) {
1286
+ if (!Array.isArray(families) || families.length === 0) return "";
1287
+ const passthrough = [];
1288
+ const names = [];
1289
+ for (const entry of families) {
1290
+ if (entry == null || entry === "") continue;
1291
+ if (isHref(entry)) passthrough.push(entry);
1292
+ else names.push(entry);
1293
+ }
1294
+ const links = passthrough.map(
1295
+ (href) => href.trim().startsWith("<link") ? href : `<link href="${href}" rel="stylesheet">`
1296
+ );
1297
+ if (names.length > 0) {
1298
+ const query = names.map(familyParam).join("&family=");
1299
+ links.unshift(
1300
+ `<link href="https://fonts.googleapis.com/css2?family=${query}&display=swap" rel="stylesheet">`
1301
+ );
1302
+ }
1303
+ if (links.length === 0) return "";
1304
+ return FONTS_PRECONNECT + links.join("");
1305
+ }
1306
+ function renderResumeDocument(element, options = {}) {
1307
+ const {
1308
+ fonts,
1309
+ title,
1310
+ lang = "en",
1311
+ dir = "ltr",
1312
+ reset = false,
1313
+ head = "",
1314
+ headAfterStyles = "",
1315
+ includeTokensCss = true,
1316
+ bodyClass
1317
+ } = options;
1318
+ const sheet = new gt();
1319
+ let html;
1320
+ let styleTags;
1321
+ try {
1322
+ html = renderToStaticMarkup(sheet.collectStyles(element));
1323
+ styleTags = sheet.getStyleTags();
1324
+ } finally {
1325
+ sheet.seal();
1326
+ }
1327
+ const fontLinks = googleFontsLinks(fonts);
1328
+ const tokensLink = includeTokensCss ? `<link rel="stylesheet" href="${TOKENS_CSS_HREF}">` : "";
1329
+ const resetTag = reset ? CSS_RESET : "";
1330
+ const titleTag = title ? `<title>${title}</title>` : "";
1331
+ const bodyAttr = bodyClass ? ` class="${bodyClass}"` : "";
1332
+ return `<!DOCTYPE html><html lang="${lang}" dir="${dir}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">` + fontLinks + tokensLink + resetTag + head + styleTags + headAfterStyles + titleTag + `</head><body${bodyAttr}>${html}</body></html>`;
1333
+ }
1274
1334
  const Section = dt.div`
1275
1335
  max-width: 700px;
1276
1336
  margin: 0 auto 18px;
@@ -1687,30 +1747,29 @@ const Resume = ({ resume }) => {
1687
1747
  ] });
1688
1748
  };
1689
1749
  const render = (resume) => {
1690
- const sheet = new gt();
1691
- const html = renderToString(sheet.collectStyles(/* @__PURE__ */ jsx(Resume, { resume })));
1692
- const styles = sheet.getStyleTags();
1693
- return `<!DOCTYPE html><head>
1694
- <title>${resume.basics.name} - Resume</title>
1695
- <meta charset="utf-8">
1696
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
1697
- <style>
1750
+ return renderResumeDocument(
1751
+ /* @__PURE__ */ jsx("main", { children: /* @__PURE__ */ jsx(Resume, { resume }) }),
1752
+ {
1753
+ head: `<style>
1698
1754
  @font-face {
1699
1755
  font-family: LatinModern;
1700
1756
  font-style: normal;
1701
1757
  font-weight: normal;
1758
+ font-display: swap;
1702
1759
  src: url("/fonts/lmroman10-regular.otf") format("opentype");
1703
1760
  }
1704
1761
 
1705
1762
  @font-face {
1706
1763
  font-family: LatinModern;
1707
1764
  font-weight: bold;
1765
+ font-display: swap;
1708
1766
  src: url("/fonts/lmroman10-bold.otf") format("opentype");
1709
1767
  }
1710
1768
 
1711
1769
  @font-face {
1712
1770
  font-family: LatinModern;
1713
1771
  font-style: italic;
1772
+ font-display: swap;
1714
1773
  src: url("/fonts/lmroman10-italic.otf") format("opentype");
1715
1774
  }
1716
1775
 
@@ -1718,18 +1777,21 @@ const render = (resume) => {
1718
1777
  font-family: LatinModernSans;
1719
1778
  font-style: normal;
1720
1779
  font-weight: normal;
1780
+ font-display: swap;
1721
1781
  src: url("/fonts/lmsans10-regular.otf") format("opentype");
1722
1782
  }
1723
1783
 
1724
1784
  @font-face {
1725
1785
  font-family: LatinModernSans;
1726
1786
  font-weight: bold;
1787
+ font-display: swap;
1727
1788
  src: url("/fonts/lmsans10-bold.otf") format("opentype");
1728
1789
  }
1729
1790
 
1730
1791
  @font-face {
1731
1792
  font-family: LatinModernSans;
1732
1793
  font-style: italic;
1794
+ font-display: swap;
1733
1795
  src: url("/fonts/lmsans10-italic.otf") format("opentype");
1734
1796
  }
1735
1797
 
@@ -1775,8 +1837,13 @@ const render = (resume) => {
1775
1837
 
1776
1838
 
1777
1839
 
1778
- </style>
1779
- ${styles}</head><body>${html}</body></html>`;
1840
+ </style>`,
1841
+ lang: "en",
1842
+ dir: "ltr",
1843
+ title: `${resume.basics.name} - Resume`,
1844
+ includeTokensCss: false
1845
+ }
1846
+ );
1780
1847
  };
1781
1848
  export {
1782
1849
  Resume,
package/package.json CHANGED
@@ -1,28 +1,24 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@jsonresume/jsonresume-theme-professional",
4
- "version": "1.0.19",
4
+ "version": "1.0.20",
5
5
  "main": "./src/index.jsx",
6
6
  "license": "MIT",
7
7
  "devDependencies": {
8
- "@repo/eslint-config-custom": "workspace:^",
9
8
  "react": "^19.2.0",
10
9
  "styled-components": "^6.1.19",
11
10
  "@vitejs/plugin-react": "^4.3.4",
12
- "vite": "^5.4.21"
11
+ "vite": "^5.4.21",
12
+ "@repo/eslint-config-custom": "^0.0.0"
13
13
  },
14
14
  "peerDependencies": {
15
15
  "styled-components": "^6"
16
16
  },
17
- "scripts": {
18
- "lint": "eslint src || exit 0",
19
- "publish": "npm publish --access public",
20
- "build": "vite build"
21
- },
22
17
  "dependencies": {
23
18
  "marked": "^16.3.0",
24
19
  "prismjs": "^1.29.0",
25
- "react-icons": "^5.0.1"
20
+ "react-icons": "^5.0.1",
21
+ "@jsonresume/core": "0.3.1"
26
22
  },
27
23
  "exports": {
28
24
  ".": {
@@ -33,5 +29,9 @@
33
29
  "import": "./dist/index.js",
34
30
  "default": "./dist/index.js"
35
31
  }
32
+ },
33
+ "scripts": {
34
+ "lint": "eslint src || exit 0",
35
+ "build": "vite build"
36
36
  }
37
- }
37
+ }
package/src/index.jsx CHANGED
@@ -1,32 +1,32 @@
1
- import { renderToString } from 'react-dom/server';
2
- import { ServerStyleSheet } from 'styled-components';
1
+ import { renderResumeDocument } from '@jsonresume/core/ssr';
3
2
  import Resume from './ui/Resume';
4
3
 
5
4
  export const render = (resume) => {
6
- const sheet = new ServerStyleSheet();
7
- const html = renderToString(sheet.collectStyles(<Resume resume={resume} />));
8
- const styles = sheet.getStyleTags();
9
- return `<!DOCTYPE html><head>
10
- <title>${resume.basics.name} - Resume</title>
11
- <meta charset="utf-8">
12
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
13
- <style>
5
+ return renderResumeDocument(
6
+ <main>
7
+ <Resume resume={resume} />
8
+ </main>,
9
+ {
10
+ head: `<style>
14
11
  @font-face {
15
12
  font-family: LatinModern;
16
13
  font-style: normal;
17
14
  font-weight: normal;
15
+ font-display: swap;
18
16
  src: url("/fonts/lmroman10-regular.otf") format("opentype");
19
17
  }
20
18
 
21
19
  @font-face {
22
20
  font-family: LatinModern;
23
21
  font-weight: bold;
22
+ font-display: swap;
24
23
  src: url("/fonts/lmroman10-bold.otf") format("opentype");
25
24
  }
26
25
 
27
26
  @font-face {
28
27
  font-family: LatinModern;
29
28
  font-style: italic;
29
+ font-display: swap;
30
30
  src: url("/fonts/lmroman10-italic.otf") format("opentype");
31
31
  }
32
32
 
@@ -34,18 +34,21 @@ export const render = (resume) => {
34
34
  font-family: LatinModernSans;
35
35
  font-style: normal;
36
36
  font-weight: normal;
37
+ font-display: swap;
37
38
  src: url("/fonts/lmsans10-regular.otf") format("opentype");
38
39
  }
39
40
 
40
41
  @font-face {
41
42
  font-family: LatinModernSans;
42
43
  font-weight: bold;
44
+ font-display: swap;
43
45
  src: url("/fonts/lmsans10-bold.otf") format("opentype");
44
46
  }
45
47
 
46
48
  @font-face {
47
49
  font-family: LatinModernSans;
48
50
  font-style: italic;
51
+ font-display: swap;
49
52
  src: url("/fonts/lmsans10-italic.otf") format("opentype");
50
53
  }
51
54
 
@@ -91,8 +94,13 @@ export const render = (resume) => {
91
94
 
92
95
 
93
96
 
94
- </style>
95
- ${styles}</head><body>${html}</body></html>`;
97
+ </style>`,
98
+ lang: 'en',
99
+ dir: 'ltr',
100
+ title: `${resume.basics.name} - Resume`,
101
+ includeTokensCss: false,
102
+ }
103
+ );
96
104
  };
97
105
 
98
106
  export { Resume };
@@ -1,11 +0,0 @@
1
-
2
- > @jsonresume/jsonresume-theme-professional@1.0.18 build /Users/ajaxdavis/repos/jsonresume.org/packages/themes/jsonresume-theme-professional
3
- > vite build
4
-
5
- The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
6
- vite v5.4.21 building SSR bundle for production...
7
- transforming...
8
- ✓ 36 modules transformed.
9
- rendering chunks...
10
- dist/index.mjs 74.83 kB
11
- ✓ built in 1.58s