@bouku/core 0.1.1 → 0.1.2

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.
@@ -21,6 +21,6 @@ const base = {
21
21
  container: "items-center",
22
22
  badge: "mb-2",
23
23
  logo: "mb-5 w-12",
24
- title: "items-center gap-2 text-xl sm:text-2xl 2xl:text-3xl font-bold text-primary",
24
+ title: "items-center gap-2 text-2xl sm:text-3xl 2xl:text-4xl font-bold text-primary",
25
25
  subtitle: "items-center gap-2 max-sm:text-sm 2xl:text-lg text-center text-primary-light dark:text-primary-dark"
26
26
  };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.linkify = void 0;
4
4
  exports.formatText = formatText;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_router_dom_1 = require("react-router-dom");
6
7
  const ts_1 = require("@bouko/ts");
7
8
  const delimiterConfig = [
8
9
  {
@@ -22,18 +23,24 @@ const delimiterPattern = delimiterConfig.map(({ key }) => {
22
23
  const escaped = (0, ts_1.escapeRegex)(key);
23
24
  return `${escaped}.*?${escaped}`;
24
25
  }).join("|");
25
- const delimiterRegex = new RegExp(`(${delimiterPattern})`, "g");
26
+ const linkPattern = String.raw `\[[^\]]+\]\([^)]+\)`;
27
+ const formatRegex = new RegExp(`(${delimiterPattern}|${linkPattern})`, "g");
26
28
  function formatText(text) {
27
29
  const parts = text
28
- .split(delimiterRegex)
30
+ .split(formatRegex)
29
31
  .filter(Boolean);
30
- return (0, jsx_runtime_1.jsx)("span", { children: parts.map((part, index) => {
32
+ return ((0, jsx_runtime_1.jsx)("span", { children: parts.map((part, index) => {
33
+ const linkMatch = part.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
34
+ if (linkMatch) {
35
+ const [, label, link] = linkMatch;
36
+ return ((0, jsx_runtime_1.jsx)(react_router_dom_1.Link, { className: "text-accent", to: link, children: label }, index));
37
+ }
31
38
  const delimiter = delimiterConfig.find(({ key }) => part.startsWith(key) && part.endsWith(key));
32
39
  if (!delimiter)
33
40
  return part;
34
41
  const content = part.slice(delimiter.key.length, -delimiter.key.length);
35
42
  return ((0, jsx_runtime_1.jsx)("span", { className: delimiter.style, children: content }, index));
36
- }) });
43
+ }) }));
37
44
  }
38
45
  const linkify = (label, link) => `[${label}](${link})`;
39
46
  exports.linkify = linkify;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bouku/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",