jsonresume-theme-writers-portfolio 0.2.2 → 0.2.3
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 +8 -0
- package/dist/index.js +77 -38
- package/package.json +2 -2
- package/src/index.jsx +14 -39
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
3
3
|
import o, { useRef, useContext, useState, useMemo, useEffect, useDebugValue, createElement, createContext } from "react";
|
|
4
4
|
var __assign = function() {
|
|
5
5
|
__assign = Object.assign || function __assign2(t) {
|
|
@@ -1300,6 +1300,66 @@ var vt = /^\s*<\/[a-z]/i, gt = (function() {
|
|
|
1300
1300
|
"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");
|
|
1301
1301
|
var wt = "__sc-".concat(f, "__");
|
|
1302
1302
|
"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);
|
|
1303
|
+
const CSS_RESET = "<style>*,*::before,*::after{box-sizing:border-box}html,body{margin:0;padding:0}body{-webkit-font-smoothing:antialiased}</style>";
|
|
1304
|
+
const TOKENS_CSS_HREF = "https://unpkg.com/@jsonresume/core/dist/tokens.css";
|
|
1305
|
+
const FONTS_PRECONNECT = '<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>';
|
|
1306
|
+
function isHref(value) {
|
|
1307
|
+
return /^(https?:)?\/\//.test(value) || value.trim().startsWith("<link");
|
|
1308
|
+
}
|
|
1309
|
+
function familyParam(family) {
|
|
1310
|
+
const [name, ...rest] = String(family).split(":");
|
|
1311
|
+
const encodedName = name.trim().replace(/\s+/g, "+");
|
|
1312
|
+
return rest.length ? `${encodedName}:${rest.join(":")}` : encodedName;
|
|
1313
|
+
}
|
|
1314
|
+
function googleFontsLinks(families) {
|
|
1315
|
+
if (!Array.isArray(families) || families.length === 0) return "";
|
|
1316
|
+
const passthrough = [];
|
|
1317
|
+
const names = [];
|
|
1318
|
+
for (const entry of families) {
|
|
1319
|
+
if (entry == null || entry === "") continue;
|
|
1320
|
+
if (isHref(entry)) passthrough.push(entry);
|
|
1321
|
+
else names.push(entry);
|
|
1322
|
+
}
|
|
1323
|
+
const links = passthrough.map(
|
|
1324
|
+
(href) => href.trim().startsWith("<link") ? href : `<link href="${href}" rel="stylesheet">`
|
|
1325
|
+
);
|
|
1326
|
+
if (names.length > 0) {
|
|
1327
|
+
const query = names.map(familyParam).join("&family=");
|
|
1328
|
+
links.unshift(
|
|
1329
|
+
`<link href="https://fonts.googleapis.com/css2?family=${query}&display=swap" rel="stylesheet">`
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
if (links.length === 0) return "";
|
|
1333
|
+
return FONTS_PRECONNECT + links.join("");
|
|
1334
|
+
}
|
|
1335
|
+
function renderResumeDocument(element, options = {}) {
|
|
1336
|
+
const {
|
|
1337
|
+
fonts,
|
|
1338
|
+
title,
|
|
1339
|
+
lang = "en",
|
|
1340
|
+
dir = "ltr",
|
|
1341
|
+
reset = false,
|
|
1342
|
+
head = "",
|
|
1343
|
+
headAfterStyles = "",
|
|
1344
|
+
includeTokensCss = true,
|
|
1345
|
+
bodyClass
|
|
1346
|
+
} = options;
|
|
1347
|
+
const sheet = new gt();
|
|
1348
|
+
let html;
|
|
1349
|
+
let styleTags;
|
|
1350
|
+
try {
|
|
1351
|
+
html = renderToStaticMarkup(sheet.collectStyles(element));
|
|
1352
|
+
styleTags = sheet.getStyleTags();
|
|
1353
|
+
} finally {
|
|
1354
|
+
sheet.seal();
|
|
1355
|
+
}
|
|
1356
|
+
const fontLinks = googleFontsLinks(fonts);
|
|
1357
|
+
const tokensLink = includeTokensCss ? `<link rel="stylesheet" href="${TOKENS_CSS_HREF}">` : "";
|
|
1358
|
+
const resetTag = reset ? CSS_RESET : "";
|
|
1359
|
+
const titleTag = title ? `<title>${title}</title>` : "";
|
|
1360
|
+
const bodyAttr = bodyClass ? ` class="${bodyClass}"` : "";
|
|
1361
|
+
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>`;
|
|
1362
|
+
}
|
|
1303
1363
|
createContext({
|
|
1304
1364
|
theme: "professional",
|
|
1305
1365
|
setTheme: () => {
|
|
@@ -1477,7 +1537,9 @@ function formatDateRange({
|
|
|
1477
1537
|
return formatter.format(date);
|
|
1478
1538
|
};
|
|
1479
1539
|
const start = formatDate(startDate);
|
|
1480
|
-
if (endDate === void 0)
|
|
1540
|
+
if (endDate === void 0) {
|
|
1541
|
+
return start;
|
|
1542
|
+
}
|
|
1481
1543
|
const end = formatDate(endDate);
|
|
1482
1544
|
return `${start} - ${end}`;
|
|
1483
1545
|
}
|
|
@@ -1562,7 +1624,6 @@ function safeUrl(url) {
|
|
|
1562
1624
|
const trimmed = url.trim();
|
|
1563
1625
|
const dangerousProtocols = /^(javascript|data|vbscript|file|about):/i;
|
|
1564
1626
|
if (dangerousProtocols.test(trimmed)) {
|
|
1565
|
-
console.warn(`[Security] Blocked dangerous URL: ${trimmed.slice(0, 50)}`);
|
|
1566
1627
|
return null;
|
|
1567
1628
|
}
|
|
1568
1629
|
const safeProtocols = /^(https?|mailto|tel|sms|ftp):/i;
|
|
@@ -1578,7 +1639,6 @@ function safeUrl(url) {
|
|
|
1578
1639
|
if (/^[a-z0-9][a-z0-9.-]+\.[a-z]{2,}$/i.test(trimmed)) {
|
|
1579
1640
|
return `https://${trimmed}`;
|
|
1580
1641
|
}
|
|
1581
|
-
console.warn(`[Security] Uncertain URL safety: ${trimmed.slice(0, 50)}`);
|
|
1582
1642
|
return trimmed;
|
|
1583
1643
|
}
|
|
1584
1644
|
const ContactContainer = dt.div`
|
|
@@ -6425,13 +6485,7 @@ function render(resume, options = {}) {
|
|
|
6425
6485
|
dir = "ltr",
|
|
6426
6486
|
title = resume.basics?.name || "Resume"
|
|
6427
6487
|
} = options;
|
|
6428
|
-
const
|
|
6429
|
-
try {
|
|
6430
|
-
const html = renderToString(
|
|
6431
|
-
sheet.collectStyles(/* @__PURE__ */ jsx(Resume, { resume }))
|
|
6432
|
-
);
|
|
6433
|
-
const styles = sheet.getStyleTags();
|
|
6434
|
-
const designTokens = `
|
|
6488
|
+
const designTokens = `
|
|
6435
6489
|
:root {
|
|
6436
6490
|
--resume-color-primary: #2f2f2f;
|
|
6437
6491
|
--resume-color-secondary: #5a5a5a;
|
|
@@ -6441,7 +6495,7 @@ function render(resume, options = {}) {
|
|
|
6441
6495
|
--resume-color-border: #d4d0c8;
|
|
6442
6496
|
}
|
|
6443
6497
|
`;
|
|
6444
|
-
|
|
6498
|
+
const globalStyles = `
|
|
6445
6499
|
* {
|
|
6446
6500
|
margin: 0;
|
|
6447
6501
|
padding: 0;
|
|
@@ -6466,34 +6520,19 @@ function render(resume, options = {}) {
|
|
|
6466
6520
|
}
|
|
6467
6521
|
}
|
|
6468
6522
|
`;
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
<meta charset="UTF-8">
|
|
6473
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6474
|
-
<title>${title}</title>
|
|
6475
|
-
|
|
6476
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
6477
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
6478
|
-
<link href="https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400&display=swap" rel="stylesheet">
|
|
6479
|
-
|
|
6480
|
-
<style>
|
|
6523
|
+
return renderResumeDocument(/* @__PURE__ */ jsx(Resume, { resume }), {
|
|
6524
|
+
fonts: ["Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400"],
|
|
6525
|
+
head: `<style>
|
|
6481
6526
|
${designTokens}
|
|
6482
|
-
</style
|
|
6483
|
-
|
|
6484
|
-
${styles}
|
|
6485
|
-
|
|
6486
|
-
<style>
|
|
6527
|
+
</style>`,
|
|
6528
|
+
headAfterStyles: `<style>
|
|
6487
6529
|
${globalStyles}
|
|
6488
|
-
</style
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
} finally {
|
|
6495
|
-
sheet.seal();
|
|
6496
|
-
}
|
|
6530
|
+
</style>`,
|
|
6531
|
+
lang: locale,
|
|
6532
|
+
dir,
|
|
6533
|
+
title,
|
|
6534
|
+
includeTokensCss: false
|
|
6535
|
+
});
|
|
6497
6536
|
}
|
|
6498
6537
|
const index = { render };
|
|
6499
6538
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsonresume-theme-writers-portfolio",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Literary and elegant resume theme for content writers, editors, and communications professionals. Features transitional serif typography, generous spacing, and prose-like readability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"react": "^19.2.0",
|
|
34
34
|
"react-dom": "^19.2.0",
|
|
35
35
|
"styled-components": "^6.1.19",
|
|
36
|
-
"@jsonresume/core": "0.3.
|
|
36
|
+
"@jsonresume/core": "0.3.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"vitest": "^1.6.0",
|
package/src/index.jsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ServerStyleSheet } from 'styled-components';
|
|
1
|
+
import { renderResumeDocument } from '@jsonresume/core/ssr';
|
|
3
2
|
import Resume from './Resume.jsx';
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -18,16 +17,7 @@ export function render(resume, options = {}) {
|
|
|
18
17
|
title = resume.basics?.name || 'Resume',
|
|
19
18
|
} = options;
|
|
20
19
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const html = renderToString(
|
|
25
|
-
sheet.collectStyles(<Resume resume={resume} />)
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const styles = sheet.getStyleTags();
|
|
29
|
-
|
|
30
|
-
const designTokens = `
|
|
20
|
+
const designTokens = `
|
|
31
21
|
:root {
|
|
32
22
|
--resume-color-primary: #2f2f2f;
|
|
33
23
|
--resume-color-secondary: #5a5a5a;
|
|
@@ -38,7 +28,7 @@ export function render(resume, options = {}) {
|
|
|
38
28
|
}
|
|
39
29
|
`;
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
const globalStyles = `
|
|
42
32
|
* {
|
|
43
33
|
margin: 0;
|
|
44
34
|
padding: 0;
|
|
@@ -64,34 +54,19 @@ export function render(resume, options = {}) {
|
|
|
64
54
|
}
|
|
65
55
|
`;
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<meta charset="UTF-8">
|
|
71
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
72
|
-
<title>${title}</title>
|
|
73
|
-
|
|
74
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
75
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
76
|
-
<link href="https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400&display=swap" rel="stylesheet">
|
|
77
|
-
|
|
78
|
-
<style>
|
|
57
|
+
return renderResumeDocument(<Resume resume={resume} />, {
|
|
58
|
+
fonts: ['Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400'],
|
|
59
|
+
head: `<style>
|
|
79
60
|
${designTokens}
|
|
80
|
-
</style
|
|
81
|
-
|
|
82
|
-
${styles}
|
|
83
|
-
|
|
84
|
-
<style>
|
|
61
|
+
</style>`,
|
|
62
|
+
headAfterStyles: `<style>
|
|
85
63
|
${globalStyles}
|
|
86
|
-
</style
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} finally {
|
|
93
|
-
sheet.seal();
|
|
94
|
-
}
|
|
64
|
+
</style>`,
|
|
65
|
+
lang: locale,
|
|
66
|
+
dir,
|
|
67
|
+
title,
|
|
68
|
+
includeTokensCss: false,
|
|
69
|
+
});
|
|
95
70
|
}
|
|
96
71
|
|
|
97
72
|
export { Resume };
|