jsonresume-theme-two-column-modernist 1.1.1 → 1.1.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # jsonresume-theme-two-column-modernist
2
2
 
3
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - eb7f950: use @jsonresume/core/ssr renderResumeDocument
8
+ - Updated dependencies [ff09f75]
9
+ - @jsonresume/core@0.3.1
10
+
11
+ ## 1.1.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [ff0f85b]
16
+ - @jsonresume/core@0.3.0
17
+
3
18
  ## 1.1.1
4
19
 
5
20
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { renderToStaticMarkup } from "react-dom/server";
2
3
  import o, { useRef, useContext, useState, useMemo, useEffect, useDebugValue, createElement, createContext } from "react";
3
- import { renderToString } 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: () => {
@@ -1446,7 +1506,9 @@ function formatDateRange({
1446
1506
  return formatter.format(date);
1447
1507
  };
1448
1508
  const start = formatDate(startDate);
1449
- if (endDate === void 0) return start;
1509
+ if (endDate === void 0) {
1510
+ return start;
1511
+ }
1450
1512
  const end = formatDate(endDate);
1451
1513
  return `${start} - ${end}`;
1452
1514
  }
@@ -1531,7 +1593,6 @@ function safeUrl(url) {
1531
1593
  const trimmed = url.trim();
1532
1594
  const dangerousProtocols = /^(javascript|data|vbscript|file|about):/i;
1533
1595
  if (dangerousProtocols.test(trimmed)) {
1534
- console.warn(`[Security] Blocked dangerous URL: ${trimmed.slice(0, 50)}`);
1535
1596
  return null;
1536
1597
  }
1537
1598
  const safeProtocols = /^(https?|mailto|tel|sms|ftp):/i;
@@ -1547,7 +1608,6 @@ function safeUrl(url) {
1547
1608
  if (/^[a-z0-9][a-z0-9.-]+\.[a-z]{2,}$/i.test(trimmed)) {
1548
1609
  return `https://${trimmed}`;
1549
1610
  }
1550
- console.warn(`[Security] Uncertain URL safety: ${trimmed.slice(0, 50)}`);
1551
1611
  return trimmed;
1552
1612
  }
1553
1613
  dt.div`
@@ -6428,23 +6488,9 @@ function Resume({ resume }) {
6428
6488
  ] });
6429
6489
  }
6430
6490
  function render(resume) {
6431
- const sheet = new gt();
6432
- try {
6433
- const html = renderToString(
6434
- sheet.collectStyles(/* @__PURE__ */ jsx(Resume, { resume }))
6435
- );
6436
- const styles = sheet.getStyleTags();
6437
- return `<!DOCTYPE html>
6438
- <html lang="en">
6439
- <head>
6440
- <meta charset="utf-8">
6441
- <title>${resume.basics?.name || "Resume"} - Resume</title>
6442
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6443
- <link rel="preconnect" href="https://fonts.googleapis.com">
6444
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
6445
- <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">
6446
- ${styles}
6447
- <style>
6491
+ return renderResumeDocument(/* @__PURE__ */ jsx(Resume, { resume }), {
6492
+ fonts: ["Space Grotesk:wght@400;500;600;700"],
6493
+ headAfterStyles: `<style>
6448
6494
  * {
6449
6495
  box-sizing: border-box;
6450
6496
  }
@@ -6463,15 +6509,11 @@ function render(resume) {
6463
6509
  margin: 0.5cm;
6464
6510
  }
6465
6511
  }
6466
- </style>
6467
- </head>
6468
- <body>
6469
- ${html}
6470
- </body>
6471
- </html>`;
6472
- } finally {
6473
- sheet.seal();
6474
- }
6512
+ </style>`,
6513
+ lang: "en",
6514
+ title: `${resume.basics?.name || "Resume"} - Resume`,
6515
+ includeTokensCss: false
6516
+ });
6475
6517
  }
6476
6518
  export {
6477
6519
  render
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-two-column-modernist",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "description": "Structured European minimalism with asymmetric two-column layout and neutral grotesk typography",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "swiss-design"
16
16
  ],
17
17
  "dependencies": {
18
- "@jsonresume/core": "0.2.0",
18
+ "@jsonresume/core": "0.3.1",
19
19
  "styled-components": "6.1.19"
20
20
  },
21
21
  "peerDependencies": {
package/src/index.jsx CHANGED
@@ -1,27 +1,10 @@
1
- import React from 'react';
2
- import { renderToString } from 'react-dom/server';
3
- import { ServerStyleSheet } from 'styled-components';
1
+ import { renderResumeDocument } from '@jsonresume/core/ssr';
4
2
  import Resume from './Resume.jsx';
5
3
 
6
4
  export function render(resume) {
7
- const sheet = new ServerStyleSheet();
8
- try {
9
- const html = renderToString(
10
- sheet.collectStyles(<Resume resume={resume} />)
11
- );
12
- const styles = sheet.getStyleTags();
13
-
14
- return `<!DOCTYPE html>
15
- <html lang="en">
16
- <head>
17
- <meta charset="utf-8">
18
- <title>${resume.basics?.name || 'Resume'} - Resume</title>
19
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
20
- <link rel="preconnect" href="https://fonts.googleapis.com">
21
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
22
- <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">
23
- ${styles}
24
- <style>
5
+ return renderResumeDocument(<Resume resume={resume} />, {
6
+ fonts: ['Space Grotesk:wght@400;500;600;700'],
7
+ headAfterStyles: `<style>
25
8
  * {
26
9
  box-sizing: border-box;
27
10
  }
@@ -40,13 +23,9 @@ export function render(resume) {
40
23
  margin: 0.5cm;
41
24
  }
42
25
  }
43
- </style>
44
- </head>
45
- <body>
46
- ${html}
47
- </body>
48
- </html>`;
49
- } finally {
50
- sheet.seal();
51
- }
26
+ </style>`,
27
+ lang: 'en',
28
+ title: `${resume.basics?.name || 'Resume'} - Resume`,
29
+ includeTokensCss: false,
30
+ });
52
31
  }