@jsonresume/theme-primitives 0.2.1 → 0.3.0

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.
@@ -0,0 +1,12 @@
1
+ import type { ElementType } from 'react';
2
+ /**
3
+ * Resume prose with its inline Markdown rendered (#600): **strong**,
4
+ * *emphasis*, `code` and [links](https://example.com). The shared renderer
5
+ * escapes the text first and keeps only http(s) and mailto links, so every
6
+ * theme shows the same, safe result.
7
+ */
8
+ export declare function Prose({ as: Tag, text, className, }: {
9
+ as?: ElementType;
10
+ text: string;
11
+ className?: string;
12
+ }): import("react").JSX.Element;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import o, { useState, useMemo, useEffect, useContext, useDebugValue, createElement, useRef, Fragment as Fragment$1 } from "react";
2
2
  import { renderToStaticMarkup } from "react-dom/server";
3
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
4
+ import { renderInlineMarkdown, formatLocation, safeUrl, formatDateRange, normalizeDates, formatUrlForDisplay } from "@jsonresume/utils";
4
5
  import { Schema, Option, Predicate } from "effect";
5
- import { formatLocation, safeUrl, formatDateRange, normalizeDates, formatUrlForDisplay } from "@jsonresume/utils";
6
6
  var __assign = function() {
7
7
  __assign = Object.assign || function __assign2(t) {
8
8
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -1352,6 +1352,20 @@ var classes = { page: "_1t9tjcq0", masthead: "_1t9tjcq1", identity: "_1t9tjcq2",
1352
1352
  var tokens = { color: { ink: "var(--_1ucpvn50)", muted: "var(--_1ucpvn51)", accent: "var(--_1ucpvn52)", rule: "var(--_1ucpvn53)", soft: "var(--_1ucpvn54)", sidebar: "var(--_1ucpvn55)", sidebarInk: "var(--_1ucpvn56)" }, font: { body: "var(--_1ucpvn57)", display: "var(--_1ucpvn58)" }, space: { section: "var(--_1ucpvn59)", entry: "var(--_1ucpvn5a)", gutter: "var(--_1ucpvn5b)" }, type: { size: "var(--_1ucpvn5c)", leading: "var(--_1ucpvn5d)", name: "var(--_1ucpvn5e)", heading: "var(--_1ucpvn5f)" }, width: "var(--_1ucpvn5g)" };
1353
1353
  var defaults = { color: { ink: "#20242a", muted: "#505862", accent: "#234f70", rule: "#ccd2d8", soft: "#f2f5f7", sidebar: "#183e4c", sidebarInk: "#ffffff" }, font: { body: "Arial, sans-serif", display: "Arial, sans-serif" }, space: { section: "30px", entry: "19px", gutter: "48px" }, type: { size: "16px", leading: "1.55", name: "42px", heading: "18px" }, width: "920px" };
1354
1354
  var defaultDesign = "_1ucpvn5h";
1355
+ function Prose({
1356
+ as: Tag = "p",
1357
+ text: text2,
1358
+ className
1359
+ }) {
1360
+ return /* @__PURE__ */ jsx(
1361
+ Tag,
1362
+ {
1363
+ className,
1364
+ dir: "auto",
1365
+ dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text2) }
1366
+ }
1367
+ );
1368
+ }
1355
1369
  function Header({ model }) {
1356
1370
  return /* @__PURE__ */ jsxs("header", { className: classes.masthead, children: [
1357
1371
  model.settings.showPhoto && model.image && /* @__PURE__ */ jsx(
@@ -1369,7 +1383,7 @@ function Header({ model }) {
1369
1383
  model.label && /* @__PURE__ */ jsx("p", { className: classes.label, children: model.label })
1370
1384
  ] }),
1371
1385
  model.contacts.length > 0 && /* @__PURE__ */ jsx("ul", { className: classes.contact, "aria-label": "Contact information", lang: "en", children: model.contacts.map((contact, index) => /* @__PURE__ */ jsx("li", { dir: "auto", children: contact.href ? /* @__PURE__ */ jsx("a", { href: contact.href, children: /* @__PURE__ */ jsx(ContactText, { text: contact.text }) }) : /* @__PURE__ */ jsx(ContactText, { text: contact.text }) }, index)) }),
1372
- model.summary && /* @__PURE__ */ jsx("p", { className: classes.summary, dir: "auto", children: model.summary })
1386
+ model.summary && /* @__PURE__ */ jsx(Prose, { className: classes.summary, text: model.summary })
1373
1387
  ] });
1374
1388
  }
1375
1389
  function ContactText({ text: text2 }) {
@@ -1385,8 +1399,8 @@ function Article({ item }) {
1385
1399
  item.date && /* @__PURE__ */ jsx("p", { className: classes.date, children: item.date })
1386
1400
  ] }),
1387
1401
  (item.context || item.location) && /* @__PURE__ */ jsx("p", { className: classes.context, dir: "auto", children: [item.context, item.location].filter(Boolean).join(" · ") }),
1388
- item.paragraphs.map((paragraph, index) => /* @__PURE__ */ jsx("p", { className: classes.paragraph, dir: "auto", children: paragraph }, index)),
1389
- item.highlights.length > 0 && /* @__PURE__ */ jsx("ul", { className: classes.bullets, children: item.highlights.map((highlight, index) => /* @__PURE__ */ jsx("li", { dir: "auto", children: highlight }, index)) }),
1402
+ item.paragraphs.map((paragraph, index) => /* @__PURE__ */ jsx(Prose, { className: classes.paragraph, text: paragraph }, index)),
1403
+ item.highlights.length > 0 && /* @__PURE__ */ jsx("ul", { className: classes.bullets, children: item.highlights.map((highlight, index) => /* @__PURE__ */ jsx(Prose, { as: "li", text: highlight }, index)) }),
1390
1404
  item.details.length > 0 && /* @__PURE__ */ jsx("p", { className: classes.details, dir: "auto", children: item.details.join(" · ") })
1391
1405
  ] });
1392
1406
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonresume/theme-primitives",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Typed, accessible document primitives for complete JSON Resume themes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "@jsonresume/theme-kit": "1.2.1",
47
47
  "@repo/eslint-config-custom": "0.0.0",
48
48
  "tsconfig": "0.0.0",
49
- "@jsonresume/core": "0.4.0"
49
+ "@jsonresume/core": "0.4.1"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=18"