jsonresume-theme-french-atelier 0.2.2 → 0.2.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/CHANGELOG.md +13 -0
- package/dist/index.js +68 -19
- package/index.jsx +6 -18
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# jsonresume-theme-french-atelier
|
|
2
2
|
|
|
3
|
+
## 0.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ff09f75]
|
|
8
|
+
- @jsonresume/core@0.3.1
|
|
9
|
+
|
|
10
|
+
## 0.2.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 5c23cd2: use @jsonresume/core/ssr renderResumeDocument
|
|
15
|
+
|
|
3
16
|
## 0.2.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import o, { useRef, useContext, useState, useMemo, useEffect, useDebugValue, createElement, createContext } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
4
4
|
var __assign = function() {
|
|
5
5
|
__assign = Object.assign || function __assign2(t) {
|
|
6
6
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1300,6 +1300,65 @@ 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
|
+
includeTokensCss = true,
|
|
1344
|
+
bodyClass
|
|
1345
|
+
} = options;
|
|
1346
|
+
const sheet = new gt();
|
|
1347
|
+
let html;
|
|
1348
|
+
let styleTags;
|
|
1349
|
+
try {
|
|
1350
|
+
html = renderToStaticMarkup(sheet.collectStyles(element));
|
|
1351
|
+
styleTags = sheet.getStyleTags();
|
|
1352
|
+
} finally {
|
|
1353
|
+
sheet.seal();
|
|
1354
|
+
}
|
|
1355
|
+
const fontLinks = googleFontsLinks(fonts);
|
|
1356
|
+
const tokensLink = includeTokensCss ? `<link rel="stylesheet" href="${TOKENS_CSS_HREF}">` : "";
|
|
1357
|
+
const resetTag = reset ? CSS_RESET : "";
|
|
1358
|
+
const titleTag = title ? `<title>${title}</title>` : "";
|
|
1359
|
+
const bodyAttr = bodyClass ? ` class="${bodyClass}"` : "";
|
|
1360
|
+
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 + titleTag + `</head><body${bodyAttr}>${html}</body></html>`;
|
|
1361
|
+
}
|
|
1303
1362
|
createContext({
|
|
1304
1363
|
theme: "professional",
|
|
1305
1364
|
setTheme: () => {
|
|
@@ -1477,7 +1536,9 @@ function formatDateRange({
|
|
|
1477
1536
|
return formatter.format(date);
|
|
1478
1537
|
};
|
|
1479
1538
|
const start = formatDate(startDate);
|
|
1480
|
-
if (endDate === void 0)
|
|
1539
|
+
if (endDate === void 0) {
|
|
1540
|
+
return start;
|
|
1541
|
+
}
|
|
1481
1542
|
const end = formatDate(endDate);
|
|
1482
1543
|
return `${start} - ${end}`;
|
|
1483
1544
|
}
|
|
@@ -1598,7 +1659,6 @@ function safeUrl(url) {
|
|
|
1598
1659
|
const trimmed = url.trim();
|
|
1599
1660
|
const dangerousProtocols = /^(javascript|data|vbscript|file|about):/i;
|
|
1600
1661
|
if (dangerousProtocols.test(trimmed)) {
|
|
1601
|
-
console.warn(`[Security] Blocked dangerous URL: ${trimmed.slice(0, 50)}`);
|
|
1602
1662
|
return null;
|
|
1603
1663
|
}
|
|
1604
1664
|
const safeProtocols = /^(https?|mailto|tel|sms|ftp):/i;
|
|
@@ -1614,7 +1674,6 @@ function safeUrl(url) {
|
|
|
1614
1674
|
if (/^[a-z0-9][a-z0-9.-]+\.[a-z]{2,}$/i.test(trimmed)) {
|
|
1615
1675
|
return `https://${trimmed}`;
|
|
1616
1676
|
}
|
|
1617
|
-
console.warn(`[Security] Uncertain URL safety: ${trimmed.slice(0, 50)}`);
|
|
1618
1677
|
return trimmed;
|
|
1619
1678
|
}
|
|
1620
1679
|
function isExternalUrl(url, currentOrigin = null) {
|
|
@@ -6536,22 +6595,12 @@ function Resume({ resume }) {
|
|
|
6536
6595
|
] });
|
|
6537
6596
|
}
|
|
6538
6597
|
function render(resume) {
|
|
6539
|
-
const sheet = new gt();
|
|
6540
|
-
const html = renderToString(sheet.collectStyles(/* @__PURE__ */ jsx(Resume, { resume })));
|
|
6541
|
-
const styles = sheet.getStyleTags();
|
|
6542
6598
|
const title = resume.basics && resume.basics.name || "Resume";
|
|
6543
|
-
return
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6549
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
6550
|
-
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Work+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
|
6551
|
-
${styles}
|
|
6552
|
-
</head>
|
|
6553
|
-
<body>${html}</body>
|
|
6554
|
-
</html>`;
|
|
6599
|
+
return renderResumeDocument(/* @__PURE__ */ jsx(Resume, { resume }), {
|
|
6600
|
+
fonts: ["Playfair Display:wght@400;700;900", "Work Sans:wght@400;500;600"],
|
|
6601
|
+
title,
|
|
6602
|
+
includeTokensCss: false
|
|
6603
|
+
});
|
|
6555
6604
|
}
|
|
6556
6605
|
export {
|
|
6557
6606
|
render
|
package/index.jsx
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { ServerStyleSheet } from 'styled-components';
|
|
2
|
+
import { renderResumeDocument } from '@jsonresume/core/ssr';
|
|
4
3
|
import Resume from './src/Resume.jsx';
|
|
5
4
|
|
|
6
5
|
export function render(resume) {
|
|
7
|
-
const sheet = new ServerStyleSheet();
|
|
8
|
-
const html = renderToString(sheet.collectStyles(<Resume resume={resume} />));
|
|
9
|
-
const styles = sheet.getStyleTags();
|
|
10
6
|
const title = (resume.basics && resume.basics.name) || 'Resume';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<title>${title}</title>
|
|
17
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
18
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
19
|
-
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Work+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
|
20
|
-
${styles}
|
|
21
|
-
</head>
|
|
22
|
-
<body>${html}</body>
|
|
23
|
-
</html>`;
|
|
7
|
+
return renderResumeDocument(<Resume resume={resume} />, {
|
|
8
|
+
fonts: ['Playfair Display:wght@400;700;900', 'Work Sans:wght@400;500;600'],
|
|
9
|
+
title,
|
|
10
|
+
includeTokensCss: false,
|
|
11
|
+
});
|
|
24
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsonresume-theme-french-atelier",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Artistic precision with editorial-inspired layout, high-contrast serif titles, and deep plum accents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.jsx",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"styled-components": "^6.1.19",
|
|
13
|
-
"@jsonresume/core": "0.3.
|
|
13
|
+
"@jsonresume/core": "0.3.1"
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|