efficient-shell 4.137.0 → 4.137.1

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.
Files changed (166) hide show
  1. package/LICENSE +6 -17
  2. package/README.md +3 -1
  3. package/dist/Browser-ZX5OTOKK.js +43 -0
  4. package/dist/Calculator-4SQGOQFQ.js +29 -0
  5. package/dist/ConfirmDialog-NPKW2XHM.js +1 -0
  6. package/dist/CurrencyConverter-2KOM7L6V.js +21 -0
  7. package/dist/Documents-IZTIQYPG.js +52 -0
  8. package/dist/Files-B63KKXGZ.js +89 -0
  9. package/dist/Notepad-WA77V45J.js +25 -0
  10. package/dist/PdfViewer-RBRGEKWF.js +1 -0
  11. package/dist/PomodoroTimer-SDUBKXUS.js +99 -0
  12. package/dist/Preview-D4KOA4OI.js +187 -0
  13. package/dist/Sidebar-Y57LYXXI.js +23 -0
  14. package/dist/Spreadsheet-JX5E6WH6.js +37 -0
  15. package/dist/Stock-XAQ5WMUZ.js +16 -0
  16. package/dist/Weather-HLAGJ5LV.js +60 -0
  17. package/dist/WorldClock-IRI4VCTA.js +32 -0
  18. package/dist/apps/index.js +1 -151
  19. package/dist/chunk-3A46NCXK.js +29 -0
  20. package/dist/chunk-44UO7FYU.js +11 -0
  21. package/dist/chunk-466CM2TJ.js +1 -0
  22. package/dist/chunk-57MIENLJ.js +1 -0
  23. package/dist/chunk-5CRAF2AD.js +2 -0
  24. package/dist/chunk-A2OQLLYK.js +6 -0
  25. package/dist/chunk-B43AGQET.js +4 -0
  26. package/dist/chunk-BR22X7E5.js +1 -0
  27. package/dist/chunk-BUTSU7FO.js +1 -0
  28. package/dist/chunk-D65T4H6J.js +1 -0
  29. package/dist/chunk-ESL5TDNA.js +1 -0
  30. package/dist/chunk-FBDZGO3V.js +1 -0
  31. package/dist/chunk-FHTLC7HH.js +1 -0
  32. package/dist/chunk-FQLMX3IE.js +948 -0
  33. package/dist/chunk-H562R4GX.js +34 -0
  34. package/dist/chunk-JN4WXTWJ.js +106 -0
  35. package/dist/chunk-LVDRBRYU.js +1 -0
  36. package/dist/chunk-LWLCNQY7.js +1 -0
  37. package/dist/chunk-MAIHBBWT.js +1 -0
  38. package/dist/chunk-NPJH5MD7.js +13 -0
  39. package/dist/chunk-OCSOMMY2.js +1 -0
  40. package/dist/chunk-OQDWLHZI.js +1 -0
  41. package/dist/chunk-OWSAMA3I.js +23 -0
  42. package/dist/chunk-PH3PRIFP.js +5 -0
  43. package/dist/chunk-TAWKWSPN.js +9 -0
  44. package/dist/chunk-U4GTZPXP.js +1 -0
  45. package/dist/chunk-UB4JIOLD.js +2 -0
  46. package/dist/chunk-UZAJ5BF6.js +9 -0
  47. package/dist/chunk-VEGMDXT4.js +1 -0
  48. package/dist/chunk-VTVSMRFX.js +1 -0
  49. package/dist/chunk-VVAGSKW7.js +1 -0
  50. package/dist/chunk-XO43FJRM.js +19 -0
  51. package/dist/chunk-Y7BOLDRM.js +69 -0
  52. package/dist/file-intake/index.js +1 -4
  53. package/dist/index.js +639 -7473
  54. package/dist/map/index.js +20 -540
  55. package/dist/markdown/index.js +6 -184
  56. package/dist/markup/index.js +1 -135
  57. package/dist/page-tabs/index.js +21 -709
  58. package/dist/sounds-OMHXVVQ4.js +1 -0
  59. package/dist/ui/index.js +1 -19
  60. package/package.json +4 -3
  61. package/dist/Browser-ZNX4WFUH.js +0 -482
  62. package/dist/Browser-ZNX4WFUH.js.map +0 -1
  63. package/dist/Calculator-6FGNKOXU.js +0 -192
  64. package/dist/Calculator-6FGNKOXU.js.map +0 -1
  65. package/dist/ConfirmDialog-NPQMIGUR.js +0 -4
  66. package/dist/ConfirmDialog-NPQMIGUR.js.map +0 -1
  67. package/dist/CurrencyConverter-FF7EXRYL.js +0 -236
  68. package/dist/CurrencyConverter-FF7EXRYL.js.map +0 -1
  69. package/dist/Documents-H3R7XSBH.js +0 -441
  70. package/dist/Documents-H3R7XSBH.js.map +0 -1
  71. package/dist/Files-ZHJIAUC2.js +0 -805
  72. package/dist/Files-ZHJIAUC2.js.map +0 -1
  73. package/dist/Notepad-VE7ISWRQ.js +0 -410
  74. package/dist/Notepad-VE7ISWRQ.js.map +0 -1
  75. package/dist/PdfViewer-SQBFYAGW.js +0 -5
  76. package/dist/PdfViewer-SQBFYAGW.js.map +0 -1
  77. package/dist/PomodoroTimer-IR3WREED.js +0 -633
  78. package/dist/PomodoroTimer-IR3WREED.js.map +0 -1
  79. package/dist/Preview-DAQGRNRM.js +0 -2959
  80. package/dist/Preview-DAQGRNRM.js.map +0 -1
  81. package/dist/Sidebar-YW6H4NDJ.js +0 -291
  82. package/dist/Sidebar-YW6H4NDJ.js.map +0 -1
  83. package/dist/Spreadsheet-HOCPHJOC.js +0 -519
  84. package/dist/Spreadsheet-HOCPHJOC.js.map +0 -1
  85. package/dist/Stock-LVRQPURG.js +0 -158
  86. package/dist/Stock-LVRQPURG.js.map +0 -1
  87. package/dist/Weather-LZQGVDJL.js +0 -431
  88. package/dist/Weather-LZQGVDJL.js.map +0 -1
  89. package/dist/WorldClock-XPD7WOZT.js +0 -202
  90. package/dist/WorldClock-XPD7WOZT.js.map +0 -1
  91. package/dist/apps/index.js.map +0 -1
  92. package/dist/chunk-5O42JXQE.js +0 -26
  93. package/dist/chunk-5O42JXQE.js.map +0 -1
  94. package/dist/chunk-5RPTS3BT.js +0 -70
  95. package/dist/chunk-5RPTS3BT.js.map +0 -1
  96. package/dist/chunk-6XJEJWNJ.js +0 -61
  97. package/dist/chunk-6XJEJWNJ.js.map +0 -1
  98. package/dist/chunk-7CCHEEYC.js +0 -94
  99. package/dist/chunk-7CCHEEYC.js.map +0 -1
  100. package/dist/chunk-BE7FZOFU.js +0 -17
  101. package/dist/chunk-BE7FZOFU.js.map +0 -1
  102. package/dist/chunk-COWYSHG2.js +0 -79
  103. package/dist/chunk-COWYSHG2.js.map +0 -1
  104. package/dist/chunk-D7PYW2QS.js +0 -265
  105. package/dist/chunk-D7PYW2QS.js.map +0 -1
  106. package/dist/chunk-DVZWYWSD.js +0 -26
  107. package/dist/chunk-DVZWYWSD.js.map +0 -1
  108. package/dist/chunk-E7TB6WD2.js +0 -153
  109. package/dist/chunk-E7TB6WD2.js.map +0 -1
  110. package/dist/chunk-FIHOGVUP.js +0 -416
  111. package/dist/chunk-FIHOGVUP.js.map +0 -1
  112. package/dist/chunk-GA35NEND.js +0 -56
  113. package/dist/chunk-GA35NEND.js.map +0 -1
  114. package/dist/chunk-HUBJAUGG.js +0 -316
  115. package/dist/chunk-HUBJAUGG.js.map +0 -1
  116. package/dist/chunk-I2TAAJHS.js +0 -465
  117. package/dist/chunk-I2TAAJHS.js.map +0 -1
  118. package/dist/chunk-ICTRCKUE.js +0 -3710
  119. package/dist/chunk-ICTRCKUE.js.map +0 -1
  120. package/dist/chunk-IPXN646P.js +0 -14
  121. package/dist/chunk-IPXN646P.js.map +0 -1
  122. package/dist/chunk-IRWSRJ4K.js +0 -48
  123. package/dist/chunk-IRWSRJ4K.js.map +0 -1
  124. package/dist/chunk-JOPU6WPY.js +0 -504
  125. package/dist/chunk-JOPU6WPY.js.map +0 -1
  126. package/dist/chunk-MGGY74RY.js +0 -14
  127. package/dist/chunk-MGGY74RY.js.map +0 -1
  128. package/dist/chunk-PVPPAWVM.js +0 -46
  129. package/dist/chunk-PVPPAWVM.js.map +0 -1
  130. package/dist/chunk-R7QGMK6N.js +0 -102
  131. package/dist/chunk-R7QGMK6N.js.map +0 -1
  132. package/dist/chunk-RT6DSB5Y.js +0 -143
  133. package/dist/chunk-RT6DSB5Y.js.map +0 -1
  134. package/dist/chunk-TRCWINHF.js +0 -105
  135. package/dist/chunk-TRCWINHF.js.map +0 -1
  136. package/dist/chunk-TW7LPMVR.js +0 -16
  137. package/dist/chunk-TW7LPMVR.js.map +0 -1
  138. package/dist/chunk-UTYKLGGT.js +0 -195
  139. package/dist/chunk-UTYKLGGT.js.map +0 -1
  140. package/dist/chunk-VNJJCH5A.js +0 -822
  141. package/dist/chunk-VNJJCH5A.js.map +0 -1
  142. package/dist/chunk-XJHZWSKV.js +0 -1103
  143. package/dist/chunk-XJHZWSKV.js.map +0 -1
  144. package/dist/chunk-Y3GYJ7YR.js +0 -549
  145. package/dist/chunk-Y3GYJ7YR.js.map +0 -1
  146. package/dist/chunk-YA4EE7ST.js +0 -14107
  147. package/dist/chunk-YA4EE7ST.js.map +0 -1
  148. package/dist/chunk-YDHXWCCJ.js +0 -145
  149. package/dist/chunk-YDHXWCCJ.js.map +0 -1
  150. package/dist/chunk-YE6GUDGP.js +0 -548
  151. package/dist/chunk-YE6GUDGP.js.map +0 -1
  152. package/dist/chunk-YNKK7NE3.js +0 -171
  153. package/dist/chunk-YNKK7NE3.js.map +0 -1
  154. package/dist/chunk-YPO6RDMX.js +0 -20
  155. package/dist/chunk-YPO6RDMX.js.map +0 -1
  156. package/dist/chunk-ZS7PMGUW.js +0 -7
  157. package/dist/chunk-ZS7PMGUW.js.map +0 -1
  158. package/dist/file-intake/index.js.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/map/index.js.map +0 -1
  161. package/dist/markdown/index.js.map +0 -1
  162. package/dist/markup/index.js.map +0 -1
  163. package/dist/page-tabs/index.js.map +0 -1
  164. package/dist/sounds-NT4DEZGD.js +0 -3
  165. package/dist/sounds-NT4DEZGD.js.map +0 -1
  166. package/dist/ui/index.js.map +0 -1
@@ -1,185 +1,7 @@
1
1
  "use client";
2
- import { useBrowserLayoutEffect } from '../chunk-IRWSRJ4K.js';
3
- import { memo, useRef, useState, useMemo } from 'react';
4
- import ReactMarkdown from 'react-markdown';
5
- import remarkBreaks from 'remark-breaks';
6
- import remarkGfm from 'remark-gfm';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
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};
@@ -1,135 +1 @@
1
- // src/markup/index.ts
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};