jsonresume-theme-art-school-modern 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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # jsonresume-theme-art-school-modern
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 5c23cd2: use @jsonresume/core/ssr renderResumeDocument
8
+
3
9
  ## 0.2.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { renderToString } from "react-dom/server";
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,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: () => {
@@ -1446,7 +1505,9 @@ function formatDateRange({
1446
1505
  return formatter.format(date);
1447
1506
  };
1448
1507
  const start = formatDate(startDate);
1449
- if (endDate === void 0) return start;
1508
+ if (endDate === void 0) {
1509
+ return start;
1510
+ }
1450
1511
  const end = formatDate(endDate);
1451
1512
  return `${start} - ${end}`;
1452
1513
  }
@@ -1531,7 +1592,6 @@ function safeUrl(url) {
1531
1592
  const trimmed = url.trim();
1532
1593
  const dangerousProtocols = /^(javascript|data|vbscript|file|about):/i;
1533
1594
  if (dangerousProtocols.test(trimmed)) {
1534
- console.warn(`[Security] Blocked dangerous URL: ${trimmed.slice(0, 50)}`);
1535
1595
  return null;
1536
1596
  }
1537
1597
  const safeProtocols = /^(https?|mailto|tel|sms|ftp):/i;
@@ -1547,7 +1607,6 @@ function safeUrl(url) {
1547
1607
  if (/^[a-z0-9][a-z0-9.-]+\.[a-z]{2,}$/i.test(trimmed)) {
1548
1608
  return `https://${trimmed}`;
1549
1609
  }
1550
- console.warn(`[Security] Uncertain URL safety: ${trimmed.slice(0, 50)}`);
1551
1610
  return trimmed;
1552
1611
  }
1553
1612
  function isExternalUrl(url, currentOrigin = null) {
@@ -6377,7 +6436,13 @@ function Resume({ resume }) {
6377
6436
  work.length > 0 && /* @__PURE__ */ jsx(SectionBlock, { index: next2(), title: "Work", children: work.map((job, i) => /* @__PURE__ */ jsxs(Entry, { children: [
6378
6437
  /* @__PURE__ */ jsxs(EntryTop, { children: [
6379
6438
  /* @__PURE__ */ jsx(EntryTitle, { children: job.position || job.name }),
6380
- /* @__PURE__ */ jsx(EntryMeta, { children: /* @__PURE__ */ jsx(DateRange, { startDate: job.startDate, endDate: job.endDate }) })
6439
+ /* @__PURE__ */ jsx(EntryMeta, { children: /* @__PURE__ */ jsx(
6440
+ DateRange,
6441
+ {
6442
+ startDate: job.startDate,
6443
+ endDate: job.endDate
6444
+ }
6445
+ ) })
6381
6446
  ] }),
6382
6447
  job.name && job.position && /* @__PURE__ */ jsx(EntrySub, { children: job.name }),
6383
6448
  job.location && /* @__PURE__ */ jsx(EntryMeta, { children: job.location }),
@@ -6403,7 +6468,13 @@ function Resume({ resume }) {
6403
6468
  education.length > 0 && /* @__PURE__ */ jsx(SectionBlock, { index: next2(), title: "Study", children: education.map((edu, i) => /* @__PURE__ */ jsxs(Entry, { children: [
6404
6469
  /* @__PURE__ */ jsxs(EntryTop, { children: [
6405
6470
  /* @__PURE__ */ jsx(EntryTitle, { children: edu.institution }),
6406
- /* @__PURE__ */ jsx(EntryMeta, { children: /* @__PURE__ */ jsx(DateRange, { startDate: edu.startDate, endDate: edu.endDate }) })
6471
+ /* @__PURE__ */ jsx(EntryMeta, { children: /* @__PURE__ */ jsx(
6472
+ DateRange,
6473
+ {
6474
+ startDate: edu.startDate,
6475
+ endDate: edu.endDate
6476
+ }
6477
+ ) })
6407
6478
  ] }),
6408
6479
  (edu.studyType || edu.area) && /* @__PURE__ */ jsx(EntrySub, { children: [edu.studyType, edu.area].filter(Boolean).join(", ") }),
6409
6480
  edu.score && /* @__PURE__ */ jsxs(EntryText, { children: [
@@ -6474,23 +6545,16 @@ function Resume({ resume }) {
6474
6545
  ] }) });
6475
6546
  }
6476
6547
  function render(resume) {
6477
- const sheet = new gt();
6478
- const html = renderToString(sheet.collectStyles(/* @__PURE__ */ jsx(Resume, { resume })));
6479
- const styles = sheet.getStyleTags();
6480
6548
  const title = resume.basics && resume.basics.name || "Resume";
6481
- return `<!DOCTYPE html>
6482
- <html lang="en">
6483
- <head>
6484
- <meta charset="utf-8">
6485
- <title>${title}</title>
6486
- <meta name="viewport" content="width=device-width, initial-scale=1">
6487
- <link rel="preconnect" href="https://fonts.googleapis.com">
6488
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
6489
- <link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=Archivo:wght@400;500;600;700;800&family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;1,9..144,400;1,9..144,500&display=swap" rel="stylesheet">
6490
- ${styles}
6491
- </head>
6492
- <body>${html}</body>
6493
- </html>`;
6549
+ return renderResumeDocument(/* @__PURE__ */ jsx(Resume, { resume }), {
6550
+ fonts: [
6551
+ "Archivo Black",
6552
+ "Archivo:wght@400;500;600;700;800",
6553
+ "Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;1,9..144,400;1,9..144,500"
6554
+ ],
6555
+ title,
6556
+ includeTokensCss: false
6557
+ });
6494
6558
  }
6495
6559
  const index = { render };
6496
6560
  export {
package/index.jsx CHANGED
@@ -1,26 +1,17 @@
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 './src/Resume.jsx';
4
3
 
5
4
  export function render(resume) {
6
- const sheet = new ServerStyleSheet();
7
- const html = renderToString(sheet.collectStyles(<Resume resume={resume} />));
8
- const styles = sheet.getStyleTags();
9
5
  const title = (resume.basics && resume.basics.name) || 'Resume';
10
-
11
- return `<!DOCTYPE html>
12
- <html lang="en">
13
- <head>
14
- <meta charset="utf-8">
15
- <title>${title}</title>
16
- <meta name="viewport" content="width=device-width, initial-scale=1">
17
- <link rel="preconnect" href="https://fonts.googleapis.com">
18
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
19
- <link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=Archivo:wght@400;500;600;700;800&family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;1,9..144,400;1,9..144,500&display=swap" rel="stylesheet">
20
- ${styles}
21
- </head>
22
- <body>${html}</body>
23
- </html>`;
6
+ return renderResumeDocument(<Resume resume={resume} />, {
7
+ fonts: [
8
+ 'Archivo Black',
9
+ 'Archivo:wght@400;500;600;700;800',
10
+ 'Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;1,9..144,400;1,9..144,500',
11
+ ],
12
+ title,
13
+ includeTokensCss: false,
14
+ });
24
15
  }
25
16
 
26
17
  export default { render };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-art-school-modern",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "main": "./index.jsx",
6
6
  "description": "Art School Modern JSON Resume theme - avant-garde gallery aesthetic with oversized display type, asymmetric expressive layout, and a single vivid accent",