efficient-shell 4.137.0 → 4.145.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.
- package/LICENSE +6 -17
- package/README.md +80 -12
- package/dist/Browser-24YNRTKT.js +43 -0
- package/dist/Calculator-LER6KUQC.js +29 -0
- package/dist/ConfirmDialog-GAYETRMG.js +1 -0
- package/dist/CurrencyConverter-Y35GFDFF.js +21 -0
- package/dist/Documents-7FYX2CGT.js +52 -0
- package/dist/Files-RZOML2N6.js +89 -0
- package/dist/Notepad-VVDCBDUA.js +25 -0
- package/dist/PdfViewer-CvLb2j_l.d.ts +40 -0
- package/dist/PdfViewer-ZCT3PYXU.js +1 -0
- package/dist/PomodoroTimer-VAM3AJOX.js +99 -0
- package/dist/Preview-HZ37D7QJ.js +187 -0
- package/dist/Sidebar-CVF7C6BO.js +23 -0
- package/dist/Spreadsheet-6WX3P6AB.js +37 -0
- package/dist/Stock-AUWI3TUX.js +16 -0
- package/dist/Weather-HU75TH7T.js +60 -0
- package/dist/WorldClock-T64MDRMJ.js +32 -0
- package/dist/apps/index.d.ts +3 -23
- package/dist/apps/index.js +1 -151
- package/dist/brand.css +1 -1
- package/dist/chunk-2RHMSFZV.js +9 -0
- package/dist/chunk-4FS742BM.js +1 -0
- package/dist/chunk-57MIENLJ.js +1 -0
- package/dist/chunk-7DAQ3WVP.js +106 -0
- package/dist/chunk-BR22X7E5.js +1 -0
- package/dist/chunk-BUTSU7FO.js +1 -0
- package/dist/chunk-CVTOZCM3.js +24 -0
- package/dist/chunk-D65T4H6J.js +1 -0
- package/dist/chunk-ESL5TDNA.js +1 -0
- package/dist/chunk-FBDZGO3V.js +1 -0
- package/dist/chunk-FHTLC7HH.js +1 -0
- package/dist/chunk-GDSGXDET.js +34 -0
- package/dist/chunk-I55UMU3R.js +6 -0
- package/dist/chunk-KKOHUQPF.js +1 -0
- package/dist/chunk-L7TEFXIS.js +69 -0
- package/dist/chunk-LVDRBRYU.js +1 -0
- package/dist/chunk-LVFMK5OQ.js +29 -0
- package/dist/chunk-LWLCNQY7.js +1 -0
- package/dist/chunk-MAIHBBWT.js +1 -0
- package/dist/chunk-MU5H2CDL.js +2 -0
- package/dist/chunk-NBBOFQPL.js +947 -0
- package/dist/chunk-NPJH5MD7.js +13 -0
- package/dist/chunk-OCSOMMY2.js +1 -0
- package/dist/chunk-PH3PRIFP.js +5 -0
- package/dist/chunk-RJ4LACFH.js +9 -0
- package/dist/chunk-SLCR26NK.js +4 -0
- package/dist/chunk-TFKB2WEB.js +19 -0
- package/dist/chunk-TR6PLN7W.js +1 -0
- package/dist/chunk-TWV42Q3K.js +1 -0
- package/dist/chunk-UB22J6EF.js +1 -0
- package/dist/chunk-UB4JIOLD.js +2 -0
- package/dist/chunk-V453E4KU.js +11 -0
- package/dist/chunk-VTVSMRFX.js +1 -0
- package/dist/file-intake/index.js +1 -4
- package/dist/{index-DVI9DMSu.d.ts → index-NhR7frRu.d.ts} +189 -17
- package/dist/index.d.ts +2 -2
- package/dist/index.js +639 -7473
- package/dist/map/index.d.ts +266 -13
- package/dist/map/index.js +22 -540
- package/dist/markdown/index.js +6 -184
- package/dist/markup/index.js +1 -135
- package/dist/page-tabs/index.js +21 -709
- package/dist/pdf/index.d.ts +9 -0
- package/dist/pdf/index.js +2 -0
- package/dist/sounds-OMHXVVQ4.js +1 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -19
- package/dist/ui.css +7 -0
- package/package.json +9 -3
- package/dist/Browser-ZNX4WFUH.js +0 -482
- package/dist/Browser-ZNX4WFUH.js.map +0 -1
- package/dist/Calculator-6FGNKOXU.js +0 -192
- package/dist/Calculator-6FGNKOXU.js.map +0 -1
- package/dist/ConfirmDialog-NPQMIGUR.js +0 -4
- package/dist/ConfirmDialog-NPQMIGUR.js.map +0 -1
- package/dist/CurrencyConverter-FF7EXRYL.js +0 -236
- package/dist/CurrencyConverter-FF7EXRYL.js.map +0 -1
- package/dist/Documents-H3R7XSBH.js +0 -441
- package/dist/Documents-H3R7XSBH.js.map +0 -1
- package/dist/Files-ZHJIAUC2.js +0 -805
- package/dist/Files-ZHJIAUC2.js.map +0 -1
- package/dist/Notepad-VE7ISWRQ.js +0 -410
- package/dist/Notepad-VE7ISWRQ.js.map +0 -1
- package/dist/PdfViewer-SQBFYAGW.js +0 -5
- package/dist/PdfViewer-SQBFYAGW.js.map +0 -1
- package/dist/PomodoroTimer-IR3WREED.js +0 -633
- package/dist/PomodoroTimer-IR3WREED.js.map +0 -1
- package/dist/Preview-DAQGRNRM.js +0 -2959
- package/dist/Preview-DAQGRNRM.js.map +0 -1
- package/dist/Sidebar-YW6H4NDJ.js +0 -291
- package/dist/Sidebar-YW6H4NDJ.js.map +0 -1
- package/dist/Spreadsheet-HOCPHJOC.js +0 -519
- package/dist/Spreadsheet-HOCPHJOC.js.map +0 -1
- package/dist/Stock-LVRQPURG.js +0 -158
- package/dist/Stock-LVRQPURG.js.map +0 -1
- package/dist/Weather-LZQGVDJL.js +0 -431
- package/dist/Weather-LZQGVDJL.js.map +0 -1
- package/dist/WorldClock-XPD7WOZT.js +0 -202
- package/dist/WorldClock-XPD7WOZT.js.map +0 -1
- package/dist/apps/index.js.map +0 -1
- package/dist/chunk-5O42JXQE.js +0 -26
- package/dist/chunk-5O42JXQE.js.map +0 -1
- package/dist/chunk-5RPTS3BT.js +0 -70
- package/dist/chunk-5RPTS3BT.js.map +0 -1
- package/dist/chunk-6XJEJWNJ.js +0 -61
- package/dist/chunk-6XJEJWNJ.js.map +0 -1
- package/dist/chunk-7CCHEEYC.js +0 -94
- package/dist/chunk-7CCHEEYC.js.map +0 -1
- package/dist/chunk-BE7FZOFU.js +0 -17
- package/dist/chunk-BE7FZOFU.js.map +0 -1
- package/dist/chunk-COWYSHG2.js +0 -79
- package/dist/chunk-COWYSHG2.js.map +0 -1
- package/dist/chunk-D7PYW2QS.js +0 -265
- package/dist/chunk-D7PYW2QS.js.map +0 -1
- package/dist/chunk-DVZWYWSD.js +0 -26
- package/dist/chunk-DVZWYWSD.js.map +0 -1
- package/dist/chunk-E7TB6WD2.js +0 -153
- package/dist/chunk-E7TB6WD2.js.map +0 -1
- package/dist/chunk-FIHOGVUP.js +0 -416
- package/dist/chunk-FIHOGVUP.js.map +0 -1
- package/dist/chunk-GA35NEND.js +0 -56
- package/dist/chunk-GA35NEND.js.map +0 -1
- package/dist/chunk-HUBJAUGG.js +0 -316
- package/dist/chunk-HUBJAUGG.js.map +0 -1
- package/dist/chunk-I2TAAJHS.js +0 -465
- package/dist/chunk-I2TAAJHS.js.map +0 -1
- package/dist/chunk-ICTRCKUE.js +0 -3710
- package/dist/chunk-ICTRCKUE.js.map +0 -1
- package/dist/chunk-IPXN646P.js +0 -14
- package/dist/chunk-IPXN646P.js.map +0 -1
- package/dist/chunk-IRWSRJ4K.js +0 -48
- package/dist/chunk-IRWSRJ4K.js.map +0 -1
- package/dist/chunk-JOPU6WPY.js +0 -504
- package/dist/chunk-JOPU6WPY.js.map +0 -1
- package/dist/chunk-MGGY74RY.js +0 -14
- package/dist/chunk-MGGY74RY.js.map +0 -1
- package/dist/chunk-PVPPAWVM.js +0 -46
- package/dist/chunk-PVPPAWVM.js.map +0 -1
- package/dist/chunk-R7QGMK6N.js +0 -102
- package/dist/chunk-R7QGMK6N.js.map +0 -1
- package/dist/chunk-RT6DSB5Y.js +0 -143
- package/dist/chunk-RT6DSB5Y.js.map +0 -1
- package/dist/chunk-TRCWINHF.js +0 -105
- package/dist/chunk-TRCWINHF.js.map +0 -1
- package/dist/chunk-TW7LPMVR.js +0 -16
- package/dist/chunk-TW7LPMVR.js.map +0 -1
- package/dist/chunk-UTYKLGGT.js +0 -195
- package/dist/chunk-UTYKLGGT.js.map +0 -1
- package/dist/chunk-VNJJCH5A.js +0 -822
- package/dist/chunk-VNJJCH5A.js.map +0 -1
- package/dist/chunk-XJHZWSKV.js +0 -1103
- package/dist/chunk-XJHZWSKV.js.map +0 -1
- package/dist/chunk-Y3GYJ7YR.js +0 -549
- package/dist/chunk-Y3GYJ7YR.js.map +0 -1
- package/dist/chunk-YA4EE7ST.js +0 -14107
- package/dist/chunk-YA4EE7ST.js.map +0 -1
- package/dist/chunk-YDHXWCCJ.js +0 -145
- package/dist/chunk-YDHXWCCJ.js.map +0 -1
- package/dist/chunk-YE6GUDGP.js +0 -548
- package/dist/chunk-YE6GUDGP.js.map +0 -1
- package/dist/chunk-YNKK7NE3.js +0 -171
- package/dist/chunk-YNKK7NE3.js.map +0 -1
- package/dist/chunk-YPO6RDMX.js +0 -20
- package/dist/chunk-YPO6RDMX.js.map +0 -1
- package/dist/chunk-ZS7PMGUW.js +0 -7
- package/dist/chunk-ZS7PMGUW.js.map +0 -1
- package/dist/file-intake/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/map/index.js.map +0 -1
- package/dist/markdown/index.js.map +0 -1
- package/dist/markup/index.js.map +0 -1
- package/dist/page-tabs/index.js.map +0 -1
- package/dist/sounds-NT4DEZGD.js +0 -3
- package/dist/sounds-NT4DEZGD.js.map +0 -1
- package/dist/ui/index.js.map +0 -1
package/dist/markdown/index.js
CHANGED
|
@@ -1,185 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function remarkDialect() {
|
|
10
|
-
const data = this.data();
|
|
11
|
-
(data.micromarkExtensions ??= []).push({
|
|
12
|
-
disable: { null: ["codeIndented", "htmlFlow", "htmlText", "setextUnderline"] }
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
var MARKDOWN_PLUGINS = {
|
|
16
|
-
note: [remarkGfm, remarkBreaks, remarkDialect],
|
|
17
|
-
article: [remarkGfm, remarkDialect]
|
|
18
|
-
};
|
|
19
|
-
var linkRenderer = ({ node: _n, ...props }) => /* @__PURE__ */ jsx("a", { ...props, target: "_blank", rel: "noopener noreferrer", className: "text-blue-600 hover:underline break-all" });
|
|
20
|
-
var codeRenderer = ({ node: _n, ...props }) => /* @__PURE__ */ jsx("code", { className: "rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800", ...props });
|
|
21
|
-
var preRenderer = (extra) => ({ node: _n, ...props }) => /* @__PURE__ */ jsx(
|
|
22
|
-
"pre",
|
|
23
|
-
{
|
|
24
|
-
className: `${extra} overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 font-mono text-xs [&>code]:bg-transparent [&>code]:p-0 [&>code]:[font-size:inherit]`,
|
|
25
|
-
...props
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
var tableRenderers = {
|
|
29
|
-
th: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("th", { className: "border border-gray-200 bg-gray-50 px-2 py-1 text-left font-semibold text-gray-700", ...props }),
|
|
30
|
-
td: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("td", { className: "border border-gray-200 px-2 py-1 align-top", ...props })
|
|
31
|
-
};
|
|
32
|
-
var NOTE_COMPONENTS = {
|
|
33
|
-
a: linkRenderer,
|
|
34
|
-
h1: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h1", { className: "text-base font-semibold text-gray-900", ...props }),
|
|
35
|
-
h2: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold text-gray-900", ...props }),
|
|
36
|
-
h3: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-700", ...props }),
|
|
37
|
-
h4: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-gray-700", ...props }),
|
|
38
|
-
h5: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h5", { className: "text-sm font-semibold text-gray-700", ...props }),
|
|
39
|
-
h6: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h6", { className: "text-sm font-semibold text-gray-700", ...props }),
|
|
40
|
-
ul: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("ul", { className: "list-disc pl-5", ...props }),
|
|
41
|
-
ol: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("ol", { className: "list-decimal pl-5", ...props }),
|
|
42
|
-
code: codeRenderer,
|
|
43
|
-
pre: preRenderer("p-2"),
|
|
44
|
-
blockquote: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-gray-300 pl-2.5 text-gray-600", ...props }),
|
|
45
|
-
hr: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("hr", { className: "border-gray-200", ...props }),
|
|
46
|
-
table: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsx("table", { className: "text-xs border-collapse", ...props }) }),
|
|
47
|
-
...tableRenderers,
|
|
48
|
-
img: ({ node: _n, alt, ...props }) => /* @__PURE__ */ jsx("img", { ...props, alt: alt ?? "", loading: "lazy", className: "max-w-full max-h-64 rounded-lg border border-gray-200" })
|
|
49
|
-
};
|
|
50
|
-
function noteComponents(resolveImageSrc) {
|
|
51
|
-
if (!resolveImageSrc) return NOTE_COMPONENTS;
|
|
52
|
-
return {
|
|
53
|
-
...NOTE_COMPONENTS,
|
|
54
|
-
img: ({ node: _n, src, alt, ...props }) => {
|
|
55
|
-
const raw = typeof src === "string" ? src : void 0;
|
|
56
|
-
return /* @__PURE__ */ jsx(
|
|
57
|
-
"img",
|
|
58
|
-
{
|
|
59
|
-
...props,
|
|
60
|
-
src: raw ? resolveImageSrc(raw) : raw,
|
|
61
|
-
alt: alt ?? "",
|
|
62
|
-
loading: "lazy",
|
|
63
|
-
className: "max-w-full max-h-64 rounded-lg border border-gray-200"
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function ArticleImage({ src, alt }) {
|
|
70
|
-
const [failed, setFailed] = useState(false);
|
|
71
|
-
const label = (alt ?? "").replace(/^screenshot:\s*/i, "");
|
|
72
|
-
if (!src || failed) {
|
|
73
|
-
return /* @__PURE__ */ jsxs("span", { className: "my-3 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-2.5", children: [
|
|
74
|
-
/* @__PURE__ */ jsx(
|
|
75
|
-
"svg",
|
|
76
|
-
{
|
|
77
|
-
className: "mt-0.5 h-4 w-4 shrink-0 text-gray-400",
|
|
78
|
-
viewBox: "0 0 20 20",
|
|
79
|
-
fill: "currentColor",
|
|
80
|
-
"aria-hidden": "true",
|
|
81
|
-
children: /* @__PURE__ */ jsx("path", { d: "M3 6a1.5 1.5 0 0 1 1.5-1.5h1.1l.4-.9a1 1 0 0 1 .9-.6h6.2a1 1 0 0 1 .9.6l.4.9h1.1A1.5 1.5 0 0 1 18 6v8.5A1.5 1.5 0 0 1 16.5 16h-13A1.5 1.5 0 0 1 2 14.5V6Zm7.5 1.5a3.25 3.25 0 1 0 0 6.5 3.25 3.25 0 0 0 0-6.5Z" })
|
|
82
|
-
}
|
|
83
|
-
),
|
|
84
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500", children: label || "Screenshot" })
|
|
85
|
-
] });
|
|
86
|
-
}
|
|
87
|
-
return /* @__PURE__ */ jsx(
|
|
88
|
-
"img",
|
|
89
|
-
{
|
|
90
|
-
src,
|
|
91
|
-
alt: alt ?? "",
|
|
92
|
-
loading: "lazy",
|
|
93
|
-
onError: () => setFailed(true),
|
|
94
|
-
className: "my-3 block max-w-full rounded-lg border border-gray-200"
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
function articleComponents(resolveImageSrc) {
|
|
99
|
-
return {
|
|
100
|
-
a: linkRenderer,
|
|
101
|
-
h1: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h1", { className: "mt-6 mb-3 text-xl font-semibold text-gray-900 first:mt-0", ...props }),
|
|
102
|
-
h2: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h2", { className: "mt-6 mb-2.5 border-b border-gray-200 pb-1.5 text-lg font-semibold text-gray-900 first:mt-0", ...props }),
|
|
103
|
-
h3: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h3", { className: "mt-5 mb-2 text-base font-semibold text-gray-900 first:mt-0", ...props }),
|
|
104
|
-
h4: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h4", { className: "mt-4 mb-1.5 text-sm font-semibold text-gray-900 first:mt-0", ...props }),
|
|
105
|
-
h5: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h5", { className: "mt-4 mb-1.5 text-sm font-semibold text-gray-700 first:mt-0", ...props }),
|
|
106
|
-
h6: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("h6", { className: "mt-4 mb-1.5 text-sm font-semibold text-gray-700 first:mt-0", ...props }),
|
|
107
|
-
p: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("p", { className: "my-2.5 leading-relaxed", ...props }),
|
|
108
|
-
ul: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("ul", { className: "my-2.5 list-disc space-y-1 pl-5", ...props }),
|
|
109
|
-
ol: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("ol", { className: "my-2.5 list-decimal space-y-1 pl-5", ...props }),
|
|
110
|
-
// A numbered walkthrough has multi-paragraph steps (text, then a
|
|
111
|
-
// screenshot); paragraphs inside an item stay tighter than the gap between
|
|
112
|
-
// items, or the numbering stops reading as a sequence.
|
|
113
|
-
li: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("li", { className: "leading-relaxed [&>p]:my-1", ...props }),
|
|
114
|
-
code: codeRenderer,
|
|
115
|
-
pre: preRenderer("my-3 p-3"),
|
|
116
|
-
blockquote: ({ node: _n, ...props }) => /* @__PURE__ */ jsx(
|
|
117
|
-
"blockquote",
|
|
118
|
-
{
|
|
119
|
-
className: "my-3 rounded-r-lg border-l-4 border-blue-400/60 bg-blue-50 px-3 py-2 text-gray-700 [&>p]:my-1",
|
|
120
|
-
...props
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
hr: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("hr", { className: "my-4 border-gray-200", ...props }),
|
|
124
|
-
table: ({ node: _n, ...props }) => /* @__PURE__ */ jsx("div", { className: "my-3 overflow-x-auto", children: /* @__PURE__ */ jsx("table", { className: "border-collapse text-sm", ...props }) }),
|
|
125
|
-
...tableRenderers,
|
|
126
|
-
img: ({ node: _n, src, alt }) => {
|
|
127
|
-
const raw = typeof src === "string" ? src : void 0;
|
|
128
|
-
return /* @__PURE__ */ jsx(ArticleImage, { src: raw && resolveImageSrc ? resolveImageSrc(raw) : raw, alt });
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function Markdown({
|
|
133
|
-
children,
|
|
134
|
-
variant = "note",
|
|
135
|
-
clamp = false,
|
|
136
|
-
resolveImageSrc,
|
|
137
|
-
components,
|
|
138
|
-
className = ""
|
|
139
|
-
}) {
|
|
140
|
-
const ref = useRef(null);
|
|
141
|
-
const [overflowing, setOverflowing] = useState(false);
|
|
142
|
-
useBrowserLayoutEffect(() => {
|
|
143
|
-
const el = ref.current;
|
|
144
|
-
if (!clamp || !el) {
|
|
145
|
-
setOverflowing(false);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const check = () => setOverflowing(el.scrollHeight > el.clientHeight + 1);
|
|
149
|
-
check();
|
|
150
|
-
const ro = new ResizeObserver(check);
|
|
151
|
-
ro.observe(el);
|
|
152
|
-
return () => ro.disconnect();
|
|
153
|
-
}, [clamp, children]);
|
|
154
|
-
const resolved = useMemo(
|
|
155
|
-
() => ({
|
|
156
|
-
...variant === "article" ? articleComponents(resolveImageSrc) : noteComponents(resolveImageSrc),
|
|
157
|
-
...components
|
|
158
|
-
}),
|
|
159
|
-
[variant, resolveImageSrc, components]
|
|
160
|
-
);
|
|
161
|
-
const named = ` ${className} `;
|
|
162
|
-
const ink = /\stext-(?:[a-z]+-\d{2,3}(?:\/\d+)?|black|white|inherit)\s/.test(named) ? "" : "text-gray-800";
|
|
163
|
-
const size = /\stext-(?:xs|sm|base|lg|[2-9]?xl|\[[^\]]+\])\s/.test(named) ? "" : "text-sm";
|
|
164
|
-
return /* @__PURE__ */ jsx(
|
|
165
|
-
"div",
|
|
166
|
-
{
|
|
167
|
-
ref,
|
|
168
|
-
className: [
|
|
169
|
-
variant === "article" ? "max-w-3xl break-words" : "break-words space-y-1.5",
|
|
170
|
-
size,
|
|
171
|
-
ink,
|
|
172
|
-
clamp ? "rosmd-clamp" : "",
|
|
173
|
-
clamp && overflowing ? "rosmd-fade" : "",
|
|
174
|
-
className
|
|
175
|
-
].filter(Boolean).join(" "),
|
|
176
|
-
children: /* @__PURE__ */ jsx(ReactMarkdown, { remarkPlugins: MARKDOWN_PLUGINS[variant], components: resolved, children })
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
var MemoMarkdown = memo(Markdown);
|
|
181
|
-
var markdown_default = MemoMarkdown;
|
|
182
|
-
|
|
183
|
-
export { MARKDOWN_PLUGINS, MemoMarkdown as Markdown, markdown_default as default };
|
|
184
|
-
//# sourceMappingURL=index.js.map
|
|
185
|
-
//# sourceMappingURL=index.js.map
|
|
2
|
+
import{useBrowserLayoutEffect as e}from"../chunk-D65T4H6J.js";import{memo as t,useRef as r,useState as a,useMemo as o}from"react";import s from"react-markdown";import l from"remark-breaks";import n from"remark-gfm";import{jsx as m,jsxs as d}from"react/jsx-runtime";function c(){const e=this.data();(e.micromarkExtensions??=[]).push({disable:{null:["codeIndented","htmlFlow","htmlText","setextUnderline"]}})}var i={note:[n,l,c],article:[n,c]},b=({node:e,...t})=>/* @__PURE__ */m("a",{...t,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline break-all"}),x=({node:e,...t})=>/* @__PURE__ */m("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",...t}),g=e=>({node:t,...r})=>/* @__PURE__ */m("pre",{className:`${e} overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 font-mono text-xs [&>code]:bg-transparent [&>code]:p-0 [&>code]:[font-size:inherit]`,...r}),h={th:({node:e,...t})=>/* @__PURE__ */m("th",{className:"border border-gray-200 bg-gray-50 px-2 py-1 text-left font-semibold text-gray-700",...t}),td:({node:e,...t})=>/* @__PURE__ */m("td",{className:"border border-gray-200 px-2 py-1 align-top",...t})},y={a:b,h1:({node:e,...t})=>/* @__PURE__ */m("h1",{className:"text-base font-semibold text-gray-900",...t}),h2:({node:e,...t})=>/* @__PURE__ */m("h2",{className:"text-sm font-semibold text-gray-900",...t}),h3:({node:e,...t})=>/* @__PURE__ */m("h3",{className:"text-sm font-semibold text-gray-700",...t}),h4:({node:e,...t})=>/* @__PURE__ */m("h4",{className:"text-sm font-semibold text-gray-700",...t}),h5:({node:e,...t})=>/* @__PURE__ */m("h5",{className:"text-sm font-semibold text-gray-700",...t}),h6:({node:e,...t})=>/* @__PURE__ */m("h6",{className:"text-sm font-semibold text-gray-700",...t}),ul:({node:e,...t})=>/* @__PURE__ */m("ul",{className:"list-disc pl-5",...t}),ol:({node:e,...t})=>/* @__PURE__ */m("ol",{className:"list-decimal pl-5",...t}),code:x,pre:g("p-2"),blockquote:({node:e,...t})=>/* @__PURE__ */m("blockquote",{className:"border-l-2 border-gray-300 pl-2.5 text-gray-600",...t}),hr:({node:e,...t})=>/* @__PURE__ */m("hr",{className:"border-gray-200",...t}),table:({node:e,...t})=>/* @__PURE__ */m("div",{className:"overflow-x-auto",children:/* @__PURE__ */m("table",{className:"text-xs border-collapse",...t})}),...h,img:({node:e,alt:t,...r})=>/* @__PURE__ */m("img",{...r,alt:t??"",loading:"lazy",className:"max-w-full max-h-64 rounded-lg border border-gray-200"})};function p(e){return e?{...y,img:({node:t,src:r,alt:a,...o})=>{const s="string"==typeof r?r:void 0;/* @__PURE__ */
|
|
3
|
+
return m("img",{...o,src:s?e(s):s,alt:a??"",loading:"lazy",className:"max-w-full max-h-64 rounded-lg border border-gray-200"})}}:y}function f({src:e,alt:t}){const[r,o]=a(!1),s=(t??"").replace(/^screenshot:\s*/i,"");return!e||r?/* @__PURE__ */d("span",{className:"my-3 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-2.5",children:[
|
|
4
|
+
/* @__PURE__ */m("svg",{className:"mt-0.5 h-4 w-4 shrink-0 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */m("path",{d:"M3 6a1.5 1.5 0 0 1 1.5-1.5h1.1l.4-.9a1 1 0 0 1 .9-.6h6.2a1 1 0 0 1 .9.6l.4.9h1.1A1.5 1.5 0 0 1 18 6v8.5A1.5 1.5 0 0 1 16.5 16h-13A1.5 1.5 0 0 1 2 14.5V6Zm7.5 1.5a3.25 3.25 0 1 0 0 6.5 3.25 3.25 0 0 0 0-6.5Z"})}),
|
|
5
|
+
/* @__PURE__ */m("span",{className:"text-xs text-gray-500",children:s||"Screenshot"})]}):/* @__PURE__ */m("img",{src:e,alt:t??"",loading:"lazy",onError:()=>o(!0),className:"my-3 block max-w-full rounded-lg border border-gray-200"})}function u(e){return{a:b,h1:({node:e,...t})=>/* @__PURE__ */m("h1",{className:"mt-6 mb-3 text-xl font-semibold text-gray-900 first:mt-0",...t}),h2:({node:e,...t})=>/* @__PURE__ */m("h2",{className:"mt-6 mb-2.5 border-b border-gray-200 pb-1.5 text-lg font-semibold text-gray-900 first:mt-0",...t}),h3:({node:e,...t})=>/* @__PURE__ */m("h3",{className:"mt-5 mb-2 text-base font-semibold text-gray-900 first:mt-0",...t}),h4:({node:e,...t})=>/* @__PURE__ */m("h4",{className:"mt-4 mb-1.5 text-sm font-semibold text-gray-900 first:mt-0",...t}),h5:({node:e,...t})=>/* @__PURE__ */m("h5",{className:"mt-4 mb-1.5 text-sm font-semibold text-gray-700 first:mt-0",...t}),h6:({node:e,...t})=>/* @__PURE__ */m("h6",{className:"mt-4 mb-1.5 text-sm font-semibold text-gray-700 first:mt-0",...t}),p:({node:e,...t})=>/* @__PURE__ */m("p",{className:"my-2.5 leading-relaxed",...t}),ul:({node:e,...t})=>/* @__PURE__ */m("ul",{className:"my-2.5 list-disc space-y-1 pl-5",...t}),ol:({node:e,...t})=>/* @__PURE__ */m("ol",{className:"my-2.5 list-decimal space-y-1 pl-5",...t}),li:({node:e,...t})=>/* @__PURE__ */m("li",{className:"leading-relaxed [&>p]:my-1",...t}),code:x,pre:g("my-3 p-3"),blockquote:({node:e,...t})=>/* @__PURE__ */m("blockquote",{className:"my-3 rounded-r-lg border-l-4 border-blue-400/60 bg-blue-50 px-3 py-2 text-gray-700 [&>p]:my-1",...t}),hr:({node:e,...t})=>/* @__PURE__ */m("hr",{className:"my-4 border-gray-200",...t}),table:({node:e,...t})=>/* @__PURE__ */m("div",{className:"my-3 overflow-x-auto",children:/* @__PURE__ */m("table",{className:"border-collapse text-sm",...t})}),...h,img:({node:t,src:r,alt:a})=>{const o="string"==typeof r?r:void 0;/* @__PURE__ */
|
|
6
|
+
return m(f,{src:o&&e?e(o):o,alt:a})}}}var N=t(function({children:t,variant:l="note",clamp:n=!1,resolveImageSrc:d,components:c,className:b=""}){const x=r(null),[g,h]=a(!1);e(()=>{const e=x.current;if(!n||!e)return void h(!1);const t=()=>h(e.scrollHeight>e.clientHeight+1);t();const r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[n,t]);const y=o(()=>({..."article"===l?u(d):p(d),...c}),[l,d,c]),f=` ${b} `,N=/\stext-(?:[a-z]+-\d{2,3}(?:\/\d+)?|black|white|inherit)\s/.test(f)?"":"text-gray-800",k=/\stext-(?:xs|sm|base|lg|[2-9]?xl|\[[^\]]+\])\s/.test(f)?"":"text-sm";/* @__PURE__ */
|
|
7
|
+
return m("div",{ref:x,className:["article"===l?"max-w-3xl break-words":"break-words space-y-1.5",k,N,n?"rosmd-clamp":"",n&&g?"rosmd-fade":"",b].filter(Boolean).join(" "),children:/* @__PURE__ */m(s,{remarkPlugins:i[l],components:y,children:t})})}),k=N;export{i as MARKDOWN_PLUGINS,N as Markdown,k as default};
|
package/dist/markup/index.js
CHANGED
|
@@ -1,135 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var INLINE = {
|
|
3
|
-
bold: { fence: "**", placeholder: "bold text" },
|
|
4
|
-
italic: { fence: "_", placeholder: "italic text" },
|
|
5
|
-
strike: { fence: "~~", placeholder: "struck out" },
|
|
6
|
-
code: { fence: "`", placeholder: "code" },
|
|
7
|
-
highlight: { fence: "==", placeholder: "highlighted text" }
|
|
8
|
-
};
|
|
9
|
-
var LINE_PREFIX = {
|
|
10
|
-
bullet: () => "- ",
|
|
11
|
-
number: (i) => `${i + 1}. `,
|
|
12
|
-
quote: () => "> "
|
|
13
|
-
};
|
|
14
|
-
function applyMark(text, start, end, style) {
|
|
15
|
-
const selected = text.slice(start, end);
|
|
16
|
-
if (style === "link") {
|
|
17
|
-
const label = selected || "link text";
|
|
18
|
-
const snippet = `[${label}](https://)`;
|
|
19
|
-
return {
|
|
20
|
-
text: text.slice(0, start) + snippet + text.slice(end),
|
|
21
|
-
// Land the caret on the URL — the label is usually already right.
|
|
22
|
-
// Offset spans "[", the label, "](" — three characters plus the label.
|
|
23
|
-
selectionStart: start + label.length + 3,
|
|
24
|
-
selectionEnd: start + snippet.length - 1
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const prefix = LINE_PREFIX[style];
|
|
28
|
-
if (prefix) {
|
|
29
|
-
const from = text.lastIndexOf("\n", Math.max(start - 1, 0)) + 1;
|
|
30
|
-
const toIdx = text.indexOf("\n", end);
|
|
31
|
-
const to = toIdx === -1 ? text.length : toIdx;
|
|
32
|
-
const block = text.slice(from, to);
|
|
33
|
-
const lines = block.split("\n");
|
|
34
|
-
const marked = lines.every((l, i) => l.startsWith(prefix(i)));
|
|
35
|
-
const next = lines.map((l, i) => marked ? l.slice(prefix(i).length) : prefix(i) + l).join("\n");
|
|
36
|
-
return {
|
|
37
|
-
text: text.slice(0, from) + next + text.slice(to),
|
|
38
|
-
selectionStart: from,
|
|
39
|
-
selectionEnd: from + next.length
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const { fence, placeholder } = INLINE[style];
|
|
43
|
-
const before = text.slice(Math.max(0, start - fence.length), start);
|
|
44
|
-
const after = text.slice(end, end + fence.length);
|
|
45
|
-
if (before === fence && after === fence) {
|
|
46
|
-
return {
|
|
47
|
-
text: text.slice(0, start - fence.length) + selected + text.slice(end + fence.length),
|
|
48
|
-
selectionStart: start - fence.length,
|
|
49
|
-
selectionEnd: start - fence.length + selected.length
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
const inner = selected || placeholder;
|
|
53
|
-
return {
|
|
54
|
-
text: text.slice(0, start) + fence + inner + fence + text.slice(end),
|
|
55
|
-
selectionStart: start + fence.length,
|
|
56
|
-
selectionEnd: start + fence.length + inner.length
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
var MARKUP_TOOLS = [
|
|
60
|
-
{ style: "bold", label: "B", title: "Bold (\u2318B)", shortcut: "b" },
|
|
61
|
-
{ style: "italic", label: "I", title: "Italic (\u2318I)", shortcut: "i" },
|
|
62
|
-
{ style: "strike", label: "S", title: "Strikethrough" },
|
|
63
|
-
{ style: "highlight", label: "\u25C6", title: "Highlight in the brand color" },
|
|
64
|
-
{ style: "code", label: "\u2039\u203A", title: "Code" },
|
|
65
|
-
{ style: "link", label: "\u{1F517}", title: "Link (\u2318K)", shortcut: "k" },
|
|
66
|
-
{ style: "bullet", label: "\u2022", title: "Bulleted list" },
|
|
67
|
-
{ style: "number", label: "1.", title: "Numbered list" },
|
|
68
|
-
{ style: "quote", label: "\u275D", title: "Quote" }
|
|
69
|
-
];
|
|
70
|
-
function markupTools(styles) {
|
|
71
|
-
return MARKUP_TOOLS.filter((t) => styles.includes(t.style));
|
|
72
|
-
}
|
|
73
|
-
var STANDARD_MARKUP = [
|
|
74
|
-
{ open: "**", close: "**", kind: "bold" },
|
|
75
|
-
{ open: "==", close: "==", kind: "highlight" },
|
|
76
|
-
{ open: "~~", close: "~~", kind: "strike" },
|
|
77
|
-
{ open: "_", close: "_", kind: "italic", wordBoundary: true }
|
|
78
|
-
];
|
|
79
|
-
var COPY_FIELD_TOOLS = MARKUP_TOOLS.map((tool) => tool.style).filter((style) => STANDARD_MARKUP.some((rule) => rule.kind === style));
|
|
80
|
-
var STOREFRONT_MARKUP = [
|
|
81
|
-
...STANDARD_MARKUP,
|
|
82
|
-
{ open: "*", close: "*", kind: "accent" }
|
|
83
|
-
];
|
|
84
|
-
var CAMPAIGN_MARKUP = [
|
|
85
|
-
...STANDARD_MARKUP,
|
|
86
|
-
{ open: "*", close: "*", kind: "accent" },
|
|
87
|
-
{ open: "#", close: "#", kind: "bold", notBefore: "0123456789" },
|
|
88
|
-
{ open: "[", close: "]", kind: "italic", notBefore: "(" }
|
|
89
|
-
];
|
|
90
|
-
function wordish(ch) {
|
|
91
|
-
return !/\s/.test(ch) && !/[!-\/:-@[-`{-~]/.test(ch);
|
|
92
|
-
}
|
|
93
|
-
function tokenizeInline(value, rules) {
|
|
94
|
-
const out = [];
|
|
95
|
-
let buf = "";
|
|
96
|
-
let i = 0;
|
|
97
|
-
while (i < value.length) {
|
|
98
|
-
const hit = matchAt(value, i, rules);
|
|
99
|
-
if (hit) {
|
|
100
|
-
out.push({ kind: "text", text: buf });
|
|
101
|
-
buf = "";
|
|
102
|
-
out.push({ kind: hit.rule.kind, text: hit.inner });
|
|
103
|
-
i = hit.end;
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
buf += value[i];
|
|
107
|
-
i += 1;
|
|
108
|
-
}
|
|
109
|
-
out.push({ kind: "text", text: buf });
|
|
110
|
-
return out;
|
|
111
|
-
}
|
|
112
|
-
function matchAt(value, i, rules) {
|
|
113
|
-
for (const rule of rules) {
|
|
114
|
-
if (!value.startsWith(rule.open, i)) continue;
|
|
115
|
-
if (rule.wordBoundary && i > 0 && wordish(value[i - 1])) continue;
|
|
116
|
-
const from = i + rule.open.length;
|
|
117
|
-
const closeAt = value.indexOf(rule.close, from);
|
|
118
|
-
if (closeAt < from + 1) continue;
|
|
119
|
-
const inner = value.slice(from, closeAt);
|
|
120
|
-
if (inner.includes(rule.close[0])) continue;
|
|
121
|
-
const end = closeAt + rule.close.length;
|
|
122
|
-
const next = value[end];
|
|
123
|
-
if (rule.notBefore && next !== void 0 && rule.notBefore.includes(next)) continue;
|
|
124
|
-
if (rule.wordBoundary && next !== void 0 && wordish(next)) continue;
|
|
125
|
-
return { rule, inner, end };
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
function stripInline(value, rules) {
|
|
130
|
-
return tokenizeInline(value, rules).map((t) => t.text).join("");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export { CAMPAIGN_MARKUP, COPY_FIELD_TOOLS, MARKUP_TOOLS, STANDARD_MARKUP, STOREFRONT_MARKUP, applyMark, markupTools, stripInline, tokenizeInline };
|
|
134
|
-
//# sourceMappingURL=index.js.map
|
|
135
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
var e={bold:{fence:"**",placeholder:"bold text"},italic:{fence:"_",placeholder:"italic text"},strike:{fence:"~~",placeholder:"struck out"},code:{fence:"`",placeholder:"code"},highlight:{fence:"==",placeholder:"highlighted text"}},t={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function l(l,n,i,o){const c=l.slice(n,i);if("link"===o){const e=c||"link text",t=`[${e}](https://)`;return{text:l.slice(0,n)+t+l.slice(i),selectionStart:n+e.length+3,selectionEnd:n+t.length-1}}const s=t[o];if(s){const e=l.lastIndexOf("\n",Math.max(n-1,0))+1,t=l.indexOf("\n",i),o=-1===t?l.length:t,c=l.slice(e,o).split("\n"),r=c.every((e,t)=>e.startsWith(s(t))),d=c.map((e,t)=>r?e.slice(s(t).length):s(t)+e).join("\n");return{text:l.slice(0,e)+d+l.slice(o),selectionStart:e,selectionEnd:e+d.length}}const{fence:r,placeholder:d}=e[o],h=l.slice(Math.max(0,n-r.length),n),u=l.slice(i,i+r.length);if(h===r&&u===r)return{text:l.slice(0,n-r.length)+c+l.slice(i+r.length),selectionStart:n-r.length,selectionEnd:n-r.length+c.length};const a=c||d;return{text:l.slice(0,n)+r+a+r+l.slice(i),selectionStart:n+r.length,selectionEnd:n+r.length+a.length}}var n=[{style:"bold",label:"B",title:"Bold (⌘B)",shortcut:"b"},{style:"italic",label:"I",title:"Italic (⌘I)",shortcut:"i"},{style:"strike",label:"S",title:"Strikethrough"},{style:"highlight",label:"◆",title:"Highlight in the brand color"},{style:"code",label:"‹›",title:"Code"},{style:"link",label:"🔗",title:"Link (⌘K)",shortcut:"k"},{style:"bullet",label:"•",title:"Bulleted list"},{style:"number",label:"1.",title:"Numbered list"},{style:"quote",label:"❝",title:"Quote"}];function i(e){return n.filter(t=>e.includes(t.style))}var o=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0}],c=n.map(e=>e.style).filter(e=>o.some(t=>t.kind===e)),s=[...o,{open:"*",close:"*",kind:"accent"}],r=[...o,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"("}];function d(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function h(e,t){const l=[];let n="",i=0;for(;i<e.length;){const o=u(e,i,t);o?(l.push({kind:"text",text:n}),n="",l.push({kind:o.rule.kind,text:o.inner}),i=o.end):(n+=e[i],i+=1)}return l.push({kind:"text",text:n}),l}function u(e,t,l){for(const n of l){if(!e.startsWith(n.open,t))continue;if(n.wordBoundary&&t>0&&d(e[t-1]))continue;const l=t+n.open.length,i=e.indexOf(n.close,l);if(i<l+1)continue;const o=e.slice(l,i);if(o.includes(n.close[0]))continue;const c=i+n.close.length,s=e[c];if((!n.notBefore||void 0===s||!n.notBefore.includes(s))&&(!n.wordBoundary||void 0===s||!d(s)))return{rule:n,inner:o,end:c}}return null}function a(e,t){return h(e,t).map(e=>e.text).join("")}export{r as CAMPAIGN_MARKUP,c as COPY_FIELD_TOOLS,n as MARKUP_TOOLS,o as STANDARD_MARKUP,s as STOREFRONT_MARKUP,l as applyMark,i as markupTools,a as stripInline,h as tokenizeInline};
|