jsonresume-theme-desert-modern 0.1.2 → 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/CHANGELOG.md +15 -0
- package/dist/index.js +75 -30
- package/package.json +2 -2
- package/src/index.jsx +12 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# jsonresume-theme-desert-modern
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2be531c: use @jsonresume/core/ssr renderResumeDocument
|
|
8
|
+
- Updated dependencies [ff09f75]
|
|
9
|
+
- @jsonresume/core@0.3.1
|
|
10
|
+
|
|
11
|
+
## 0.1.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [ff0f85b]
|
|
16
|
+
- @jsonresume/core@0.3.0
|
|
17
|
+
|
|
3
18
|
## 0.1.2
|
|
4
19
|
|
|
5
20
|
### 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,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`
|
|
@@ -6434,23 +6494,11 @@ function Resume({ resume }) {
|
|
|
6434
6494
|
] });
|
|
6435
6495
|
}
|
|
6436
6496
|
function render(resume) {
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
const styles = sheet.getStyleTags();
|
|
6443
|
-
return `<!DOCTYPE html>
|
|
6444
|
-
<html lang="en">
|
|
6445
|
-
<head>
|
|
6446
|
-
<meta charset="UTF-8">
|
|
6447
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6448
|
-
<title>${resume.basics?.name || "Resume"} - Resume</title>
|
|
6449
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
6450
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
6451
|
-
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
6452
|
-
${styles}
|
|
6453
|
-
<style>
|
|
6497
|
+
return renderResumeDocument(/* @__PURE__ */ jsx(Resume, { resume }), {
|
|
6498
|
+
fonts: [
|
|
6499
|
+
"https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&family=Inter:wght@400;500;600;700&display=swap"
|
|
6500
|
+
],
|
|
6501
|
+
headAfterStyles: `<style>
|
|
6454
6502
|
* {
|
|
6455
6503
|
box-sizing: border-box;
|
|
6456
6504
|
}
|
|
@@ -6468,15 +6516,12 @@ function render(resume) {
|
|
|
6468
6516
|
margin: 0.5in;
|
|
6469
6517
|
}
|
|
6470
6518
|
}
|
|
6471
|
-
</style
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
} finally {
|
|
6478
|
-
sheet.seal();
|
|
6479
|
-
}
|
|
6519
|
+
</style>`,
|
|
6520
|
+
lang: "en",
|
|
6521
|
+
dir: "ltr",
|
|
6522
|
+
title: `${resume.basics?.name || "Resume"} - Resume`,
|
|
6523
|
+
includeTokensCss: false
|
|
6524
|
+
});
|
|
6480
6525
|
}
|
|
6481
6526
|
export {
|
|
6482
6527
|
Resume,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsonresume-theme-desert-modern",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Warm minimalist resume theme inspired by desert modern aesthetics",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"styled-components": "^6.1.19",
|
|
21
|
-
"@jsonresume/core": "0.
|
|
21
|
+
"@jsonresume/core": "0.3.1"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
package/src/index.jsx
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
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 './Resume.jsx';
|
|
5
4
|
|
|
6
5
|
export function render(resume) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
);
|
|
13
|
-
const styles = sheet.getStyleTags();
|
|
14
|
-
|
|
15
|
-
return `<!DOCTYPE html>
|
|
16
|
-
<html lang="en">
|
|
17
|
-
<head>
|
|
18
|
-
<meta charset="UTF-8">
|
|
19
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
20
|
-
<title>${resume.basics?.name || 'Resume'} - Resume</title>
|
|
21
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
22
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
23
|
-
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
24
|
-
${styles}
|
|
25
|
-
<style>
|
|
6
|
+
return renderResumeDocument(<Resume resume={resume} />, {
|
|
7
|
+
fonts: [
|
|
8
|
+
'https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&family=Inter:wght@400;500;600;700&display=swap',
|
|
9
|
+
],
|
|
10
|
+
headAfterStyles: `<style>
|
|
26
11
|
* {
|
|
27
12
|
box-sizing: border-box;
|
|
28
13
|
}
|
|
@@ -40,15 +25,12 @@ export function render(resume) {
|
|
|
40
25
|
margin: 0.5in;
|
|
41
26
|
}
|
|
42
27
|
}
|
|
43
|
-
</style
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} finally {
|
|
50
|
-
sheet.seal();
|
|
51
|
-
}
|
|
28
|
+
</style>`,
|
|
29
|
+
lang: 'en',
|
|
30
|
+
dir: 'ltr',
|
|
31
|
+
title: `${resume.basics?.name || 'Resume'} - Resume`,
|
|
32
|
+
includeTokensCss: false,
|
|
33
|
+
});
|
|
52
34
|
}
|
|
53
35
|
|
|
54
36
|
export { Resume };
|