@conciv/solid-streamdown 0.0.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.
@@ -0,0 +1,238 @@
1
+ import { i as e, t } from "./esm-C6DrQFNX.js";
2
+ //#region ../../node_modules/.pnpm/hast-util-sanitize@5.0.2/node_modules/hast-util-sanitize/lib/schema.js
3
+ var n = [
4
+ "ariaDescribedBy",
5
+ "ariaLabel",
6
+ "ariaLabelledBy"
7
+ ], r = {
8
+ ancestors: {
9
+ tbody: ["table"],
10
+ td: ["table"],
11
+ th: ["table"],
12
+ thead: ["table"],
13
+ tfoot: ["table"],
14
+ tr: ["table"]
15
+ },
16
+ attributes: {
17
+ a: [
18
+ ...n,
19
+ "dataFootnoteBackref",
20
+ "dataFootnoteRef",
21
+ ["className", "data-footnote-backref"],
22
+ "href"
23
+ ],
24
+ blockquote: ["cite"],
25
+ code: [["className", /^language-./]],
26
+ del: ["cite"],
27
+ div: ["itemScope", "itemType"],
28
+ dl: [...n],
29
+ h2: [["className", "sr-only"]],
30
+ img: [
31
+ ...n,
32
+ "longDesc",
33
+ "src"
34
+ ],
35
+ input: [["disabled", !0], ["type", "checkbox"]],
36
+ ins: ["cite"],
37
+ li: [["className", "task-list-item"]],
38
+ ol: [...n, ["className", "contains-task-list"]],
39
+ q: ["cite"],
40
+ section: ["dataFootnotes", ["className", "footnotes"]],
41
+ source: ["srcSet"],
42
+ summary: [...n],
43
+ table: [...n],
44
+ ul: [...n, ["className", "contains-task-list"]],
45
+ "*": /* @__PURE__ */ "abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width".split(".")
46
+ },
47
+ clobber: [
48
+ "ariaDescribedBy",
49
+ "ariaLabelledBy",
50
+ "id",
51
+ "name"
52
+ ],
53
+ clobberPrefix: "user-content-",
54
+ protocols: {
55
+ cite: ["http", "https"],
56
+ href: [
57
+ "http",
58
+ "https",
59
+ "irc",
60
+ "ircs",
61
+ "mailto",
62
+ "xmpp"
63
+ ],
64
+ longDesc: ["http", "https"],
65
+ src: ["http", "https"]
66
+ },
67
+ required: { input: {
68
+ disabled: !0,
69
+ type: "checkbox"
70
+ } },
71
+ strip: ["script"],
72
+ tagNames: /* @__PURE__ */ "a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var".split(".")
73
+ }, i = {}.hasOwnProperty;
74
+ function a(e, t) {
75
+ let n = {
76
+ type: "root",
77
+ children: []
78
+ }, i = o({
79
+ schema: t ? {
80
+ ...r,
81
+ ...t
82
+ } : r,
83
+ stack: []
84
+ }, e);
85
+ return i && (Array.isArray(i) ? i.length === 1 ? n = i[0] : n.children = i : n = i), n;
86
+ }
87
+ function o(e, t) {
88
+ if (t && typeof t == "object") {
89
+ let n = t;
90
+ switch (typeof n.type == "string" ? n.type : "") {
91
+ case "comment": return s(e, n);
92
+ case "doctype": return c(e, n);
93
+ case "element": return l(e, n);
94
+ case "root": return u(e, n);
95
+ case "text": return d(e, n);
96
+ default:
97
+ }
98
+ }
99
+ }
100
+ function s(e, t) {
101
+ if (e.schema.allowComments) {
102
+ let e = typeof t.value == "string" ? t.value : "", n = e.indexOf("-->"), r = {
103
+ type: "comment",
104
+ value: n < 0 ? e : e.slice(0, n)
105
+ };
106
+ return v(r, t), r;
107
+ }
108
+ }
109
+ function c(e, t) {
110
+ if (e.schema.allowDoctypes) {
111
+ let e = { type: "doctype" };
112
+ return v(e, t), e;
113
+ }
114
+ }
115
+ function l(e, t) {
116
+ let n = typeof t.tagName == "string" ? t.tagName : "";
117
+ e.stack.push(n);
118
+ let r = f(e, t.children), a = p(e, t.properties);
119
+ e.stack.pop();
120
+ let o = !1;
121
+ if (n && n !== "*" && (!e.schema.tagNames || e.schema.tagNames.includes(n)) && (o = !0, e.schema.ancestors && i.call(e.schema.ancestors, n))) {
122
+ let t = e.schema.ancestors[n], r = -1;
123
+ for (o = !1; ++r < t.length;) e.stack.includes(t[r]) && (o = !0);
124
+ }
125
+ if (!o) return e.schema.strip && !e.schema.strip.includes(n) ? r : void 0;
126
+ let s = {
127
+ type: "element",
128
+ tagName: n,
129
+ properties: a,
130
+ children: r
131
+ };
132
+ return v(s, t), s;
133
+ }
134
+ function u(e, t) {
135
+ let n = {
136
+ type: "root",
137
+ children: f(e, t.children)
138
+ };
139
+ return v(n, t), n;
140
+ }
141
+ function d(e, t) {
142
+ let n = {
143
+ type: "text",
144
+ value: typeof t.value == "string" ? t.value : ""
145
+ };
146
+ return v(n, t), n;
147
+ }
148
+ function f(e, t) {
149
+ let n = [];
150
+ if (Array.isArray(t)) {
151
+ let r = t, i = -1;
152
+ for (; ++i < r.length;) {
153
+ let t = o(e, r[i]);
154
+ t && (Array.isArray(t) ? n.push(...t) : n.push(t));
155
+ }
156
+ }
157
+ return n;
158
+ }
159
+ function p(e, t) {
160
+ let n = e.stack[e.stack.length - 1], r = e.schema.attributes, a = e.schema.required, o = r && i.call(r, n) ? r[n] : void 0, s = r && i.call(r, "*") ? r["*"] : void 0, c = t && typeof t == "object" ? t : {}, l = {}, u;
161
+ for (u in c) if (i.call(c, u)) {
162
+ let t = c[u], n = m(e, y(o, u), u, t);
163
+ n ??= m(e, y(s, u), u, t), n != null && (l[u] = n);
164
+ }
165
+ if (a && i.call(a, n)) {
166
+ let e = a[n];
167
+ for (u in e) i.call(e, u) && !i.call(l, u) && (l[u] = e[u]);
168
+ }
169
+ return l;
170
+ }
171
+ function m(e, t, n, r) {
172
+ return t ? Array.isArray(r) ? h(e, t, n, r) : g(e, t, n, r) : void 0;
173
+ }
174
+ function h(e, t, n, r) {
175
+ let i = -1, a = [];
176
+ for (; ++i < r.length;) {
177
+ let o = g(e, t, n, r[i]);
178
+ (typeof o == "number" || typeof o == "string") && a.push(o);
179
+ }
180
+ return a;
181
+ }
182
+ function g(e, t, n, r) {
183
+ if (!(typeof r != "boolean" && typeof r != "number" && typeof r != "string") && _(e, n, r)) {
184
+ if (typeof t == "object" && t.length > 1) {
185
+ let e = !1, n = 0;
186
+ for (; ++n < t.length;) {
187
+ let i = t[n];
188
+ if (i && typeof i == "object" && "flags" in i) {
189
+ if (i.test(String(r))) {
190
+ e = !0;
191
+ break;
192
+ }
193
+ } else if (i === r) {
194
+ e = !0;
195
+ break;
196
+ }
197
+ }
198
+ if (!e) return;
199
+ }
200
+ return e.schema.clobber && e.schema.clobberPrefix && e.schema.clobber.includes(n) ? e.schema.clobberPrefix + r : r;
201
+ }
202
+ }
203
+ function _(e, t, n) {
204
+ let r = e.schema.protocols && i.call(e.schema.protocols, t) ? e.schema.protocols[t] : void 0;
205
+ if (!r || r.length === 0) return !0;
206
+ let a = String(n), o = a.indexOf(":"), s = a.indexOf("?"), c = a.indexOf("#"), l = a.indexOf("/");
207
+ if (o < 0 || l > -1 && o > l || s > -1 && o > s || c > -1 && o > c) return !0;
208
+ let u = -1;
209
+ for (; ++u < r.length;) {
210
+ let e = r[u];
211
+ if (o === e.length && a.slice(0, e.length) === e) return !0;
212
+ }
213
+ return !1;
214
+ }
215
+ function v(n, r) {
216
+ let i = e(r);
217
+ r.data && (n.data = t(r.data)), i && (n.position = i);
218
+ }
219
+ function y(e, t) {
220
+ let n, r = -1;
221
+ if (e) for (; ++r < e.length;) {
222
+ let i = e[r], a = typeof i == "string" ? i : i[0];
223
+ if (a === t) return i;
224
+ a === "data*" && (n = i);
225
+ }
226
+ if (t.length > 4 && t.slice(0, 4).toLowerCase() === "data") return n;
227
+ }
228
+ //#endregion
229
+ //#region ../../node_modules/.pnpm/rehype-sanitize@6.0.0/node_modules/rehype-sanitize/lib/index.js
230
+ function b(e) {
231
+ return function(t) {
232
+ return a(t, e);
233
+ };
234
+ }
235
+ //#endregion
236
+ export { b as default, r as defaultSchema };
237
+
238
+ //# sourceMappingURL=rehype-sanitize-DT7vjPGT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehype-sanitize-DT7vjPGT.js","names":["structuredClone"],"sources":["../../../node_modules/.pnpm/hast-util-sanitize@5.0.2/node_modules/hast-util-sanitize/lib/schema.js","../../../node_modules/.pnpm/hast-util-sanitize@5.0.2/node_modules/hast-util-sanitize/lib/index.js","../../../node_modules/.pnpm/rehype-sanitize@6.0.0/node_modules/rehype-sanitize/lib/index.js"],"sourcesContent":["/**\n * @import {Schema} from 'hast-util-sanitize'\n */\n\n// Couple of ARIA attributes allowed in several, but not all, places.\nconst aria = ['ariaDescribedBy', 'ariaLabel', 'ariaLabelledBy']\n\n/**\n * Default schema.\n *\n * Follows GitHub style sanitation.\n *\n * @type {Schema}\n */\nexport const defaultSchema = {\n ancestors: {\n tbody: ['table'],\n td: ['table'],\n th: ['table'],\n thead: ['table'],\n tfoot: ['table'],\n tr: ['table']\n },\n attributes: {\n a: [\n ...aria,\n // Note: these 3 are used by GFM footnotes, they do work on all links.\n 'dataFootnoteBackref',\n 'dataFootnoteRef',\n ['className', 'data-footnote-backref'],\n 'href'\n ],\n blockquote: ['cite'],\n // Note: this class is not normally allowed by GH, when manually writing\n // `code` as HTML in markdown, they adds it some other way.\n // We can’t do that, so we have to allow it.\n code: [['className', /^language-./]],\n del: ['cite'],\n div: ['itemScope', 'itemType'],\n dl: [...aria],\n // Note: this is used by GFM footnotes.\n h2: [['className', 'sr-only']],\n img: [...aria, 'longDesc', 'src'],\n // Note: `input` is not normally allowed by GH, when manually writing\n // it in markdown, they add it from tasklists some other way.\n // We can’t do that, so we have to allow it.\n input: [\n ['disabled', true],\n ['type', 'checkbox']\n ],\n ins: ['cite'],\n // Note: this class is not normally allowed by GH, when manually writing\n // `li` as HTML in markdown, they adds it some other way.\n // We can’t do that, so we have to allow it.\n li: [['className', 'task-list-item']],\n // Note: this class is not normally allowed by GH, when manually writing\n // `ol` as HTML in markdown, they adds it some other way.\n // We can’t do that, so we have to allow it.\n ol: [...aria, ['className', 'contains-task-list']],\n q: ['cite'],\n section: ['dataFootnotes', ['className', 'footnotes']],\n source: ['srcSet'],\n summary: [...aria],\n table: [...aria],\n // Note: this class is not normally allowed by GH, when manually writing\n // `ol` as HTML in markdown, they adds it some other way.\n // We can’t do that, so we have to allow it.\n ul: [...aria, ['className', 'contains-task-list']],\n '*': [\n 'abbr',\n 'accept',\n 'acceptCharset',\n 'accessKey',\n 'action',\n 'align',\n 'alt',\n 'axis',\n 'border',\n 'cellPadding',\n 'cellSpacing',\n 'char',\n 'charOff',\n 'charSet',\n 'checked',\n 'clear',\n 'colSpan',\n 'color',\n 'cols',\n 'compact',\n 'coords',\n 'dateTime',\n 'dir',\n // Note: `disabled` is technically allowed on all elements by GH.\n // But it is useless on everything except `input`.\n // Because `input`s are normally not allowed, but we allow them for\n // checkboxes due to tasklists, we allow `disabled` only there.\n 'encType',\n 'frame',\n 'hSpace',\n 'headers',\n 'height',\n 'hrefLang',\n 'htmlFor',\n 'id',\n 'isMap',\n 'itemProp',\n 'label',\n 'lang',\n 'maxLength',\n 'media',\n 'method',\n 'multiple',\n 'name',\n 'noHref',\n 'noShade',\n 'noWrap',\n 'open',\n 'prompt',\n 'readOnly',\n 'rev',\n 'rowSpan',\n 'rows',\n 'rules',\n 'scope',\n 'selected',\n 'shape',\n 'size',\n 'span',\n 'start',\n 'summary',\n 'tabIndex',\n 'title',\n 'useMap',\n 'vAlign',\n 'value',\n 'width'\n ]\n },\n clobber: ['ariaDescribedBy', 'ariaLabelledBy', 'id', 'name'],\n clobberPrefix: 'user-content-',\n protocols: {\n cite: ['http', 'https'],\n href: ['http', 'https', 'irc', 'ircs', 'mailto', 'xmpp'],\n longDesc: ['http', 'https'],\n src: ['http', 'https']\n },\n required: {\n input: {disabled: true, type: 'checkbox'}\n },\n strip: ['script'],\n tagNames: [\n 'a',\n 'b',\n 'blockquote',\n 'br',\n 'code',\n 'dd',\n 'del',\n 'details',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'hr',\n 'i',\n 'img',\n // Note: `input` is not normally allowed by GH, when manually writing\n // it in markdown, they add it from tasklists some other way.\n // We can’t do that, so we have to allow it.\n 'input',\n 'ins',\n 'kbd',\n 'li',\n 'ol',\n 'p',\n 'picture',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'section',\n 'source',\n 'span',\n 'strike',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'tr',\n 'tt',\n 'ul',\n 'var'\n ]\n}\n","/**\n * @import {\n * Comment,\n * Doctype,\n * ElementContent,\n * Element,\n * Nodes,\n * Properties,\n * RootContent,\n * Root,\n * Text\n * } from 'hast'\n */\n\n/**\n * @typedef {[string, ...Array<Exclude<Properties[keyof Properties], Array<any>> | RegExp>] | string} PropertyDefinition\n * Definition for a property.\n *\n * @typedef Schema\n * Schema that defines what nodes and properties are allowed.\n *\n * The default schema is `defaultSchema`, which follows how GitHub cleans.\n * If any top-level key is missing in the given schema, the corresponding\n * value of the default schema is used.\n *\n * To extend the standard schema with a few changes, clone `defaultSchema`\n * like so:\n *\n * ```js\n * import deepmerge from 'deepmerge'\n * import {h} from 'hastscript'\n * import {defaultSchema, sanitize} from 'hast-util-sanitize'\n *\n * // This allows `className` on all elements.\n * const schema = deepmerge(defaultSchema, {attributes: {'*': ['className']}})\n *\n * const tree = sanitize(h('div', {className: ['foo']}), schema)\n *\n * // `tree` still has `className`.\n * console.log(tree)\n * // {\n * // type: 'element',\n * // tagName: 'div',\n * // properties: {className: ['foo']},\n * // children: []\n * // }\n * ```\n * @property {boolean | null | undefined} [allowComments=false]\n * Whether to allow comment nodes (default: `false`).\n *\n * For example:\n *\n * ```js\n * allowComments: true\n * ```\n * @property {boolean | null | undefined} [allowDoctypes=false]\n * Whether to allow doctype nodes (default: `false`).\n *\n * For example:\n *\n * ```js\n * allowDoctypes: true\n * ```\n * @property {Record<string, Array<string>> | null | undefined} [ancestors]\n * Map of tag names to a list of tag names which are required ancestors\n * (default: `defaultSchema.ancestors`).\n *\n * Elements with these tag names will be ignored if they occur outside of one\n * of their allowed parents.\n *\n * For example:\n *\n * ```js\n * ancestors: {\n * tbody: ['table'],\n * // …\n * tr: ['table']\n * }\n * ```\n * @property {Record<string, Array<PropertyDefinition>> | null | undefined} [attributes]\n * Map of tag names to allowed property names (default:\n * `defaultSchema.attributes`).\n *\n * The special key `'*'` as a tag name defines property names allowed on all\n * elements.\n *\n * The special value `'data*'` as a property name can be used to allow all\n * `data` properties.\n *\n * For example:\n *\n * ```js\n * attributes: {\n * 'ariaDescribedBy', 'ariaLabel', 'ariaLabelledBy', …, 'href'\n * // …\n * '*': [\n * 'abbr',\n * 'accept',\n * 'acceptCharset',\n * // …\n * 'vAlign',\n * 'value',\n * 'width'\n * ]\n * }\n * ```\n *\n * Instead of a single string in the array, which allows any property value\n * for the field, you can use an array to allow several values.\n * For example, `input: ['type']` allows `type` set to any value on `input`s.\n * But `input: [['type', 'checkbox', 'radio']]` allows `type` when set to\n * `'checkbox'` or `'radio'`.\n *\n * You can use regexes, so for example `span: [['className', /^hljs-/]]`\n * allows any class that starts with `hljs-` on `span`s.\n *\n * When comma- or space-separated values are used (such as `className`), each\n * value in is checked individually.\n * For example, to allow certain classes on `span`s for syntax highlighting,\n * use `span: [['className', 'number', 'operator', 'token']]`.\n * This will allow `'number'`, `'operator'`, and `'token'` classes, but drop\n * others.\n * @property {Array<string> | null | undefined} [clobber]\n * List of property names that clobber (default: `defaultSchema.clobber`).\n *\n * For example:\n *\n * ```js\n * clobber: ['ariaDescribedBy', 'ariaLabelledBy', 'id', 'name']\n * ```\n * @property {string | null | undefined} [clobberPrefix]\n * Prefix to use before clobbering properties (default:\n * `defaultSchema.clobberPrefix`).\n *\n * For example:\n *\n * ```js\n * clobberPrefix: 'user-content-'\n * ```\n * @property {Record<string, Array<string> | null | undefined> | null | undefined} [protocols]\n * Map of *property names* to allowed protocols (default:\n * `defaultSchema.protocols`).\n *\n * This defines URLs that are always allowed to have local URLs (relative to\n * the current website, such as `this`, `#this`, `/this`, or `?this`), and\n * only allowed to have remote URLs (such as `https://example.com`) if they\n * use a known protocol.\n *\n * For example:\n *\n * ```js\n * protocols: {\n * cite: ['http', 'https'],\n * // …\n * src: ['http', 'https']\n * }\n * ```\n * @property {Record<string, Record<string, Properties[keyof Properties]>> | null | undefined} [required]\n * Map of tag names to required property names with a default value\n * (default: `defaultSchema.required`).\n *\n * This defines properties that must be set.\n * If a field does not exist (after the element was made safe), these will be\n * added with the given value.\n *\n * For example:\n *\n * ```js\n * required: {\n * input: {disabled: true, type: 'checkbox'}\n * }\n * ```\n *\n * > 👉 **Note**: properties are first checked based on `schema.attributes`,\n * > then on `schema.required`.\n * > That means properties could be removed by `attributes` and then added\n * > again with `required`.\n * @property {Array<string> | null | undefined} [strip]\n * List of tag names to strip from the tree (default: `defaultSchema.strip`).\n *\n * By default, unsafe elements (those not in `schema.tagNames`) are replaced\n * by what they contain.\n * This option can drop their contents.\n *\n * For example:\n *\n * ```js\n * strip: ['script']\n * ```\n * @property {Array<string> | null | undefined} [tagNames]\n * List of allowed tag names (default: `defaultSchema.tagNames`).\n *\n * For example:\n *\n * ```js\n * tagNames: [\n * 'a',\n * 'b',\n * // …\n * 'ul',\n * 'var'\n * ]\n * ```\n *\n * @typedef State\n * Info passed around.\n * @property {Readonly<Schema>} schema\n * Schema.\n * @property {Array<string>} stack\n * Tag names of ancestors.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {position} from 'unist-util-position'\nimport {defaultSchema} from './schema.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Sanitize a tree.\n *\n * @param {Readonly<Nodes>} node\n * Unsafe tree.\n * @param {Readonly<Schema> | null | undefined} [options]\n * Configuration (default: `defaultSchema`).\n * @returns {Nodes}\n * New, safe tree.\n */\nexport function sanitize(node, options) {\n /** @type {Nodes} */\n let result = {type: 'root', children: []}\n\n /** @type {State} */\n const state = {\n schema: options ? {...defaultSchema, ...options} : defaultSchema,\n stack: []\n }\n const replace = transform(state, node)\n\n if (replace) {\n if (Array.isArray(replace)) {\n if (replace.length === 1) {\n result = replace[0]\n } else {\n result.children = replace\n }\n } else {\n result = replace\n }\n }\n\n return result\n}\n\n/**\n * Sanitize `node`.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<unknown>} node\n * Unsafe node.\n * @returns {Array<ElementContent> | Nodes | undefined}\n * Safe result.\n */\nfunction transform(state, node) {\n if (node && typeof node === 'object') {\n const unsafe = /** @type {Record<string, Readonly<unknown>>} */ (node)\n const type = typeof unsafe.type === 'string' ? unsafe.type : ''\n\n switch (type) {\n case 'comment': {\n return comment(state, unsafe)\n }\n\n case 'doctype': {\n return doctype(state, unsafe)\n }\n\n case 'element': {\n return element(state, unsafe)\n }\n\n case 'root': {\n return root(state, unsafe)\n }\n\n case 'text': {\n return text(state, unsafe)\n }\n\n default:\n }\n }\n}\n\n/**\n * Make a safe comment.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<Record<string, Readonly<unknown>>>} unsafe\n * Unsafe comment-like value.\n * @returns {Comment | undefined}\n * Safe comment (if with `allowComments`).\n */\nfunction comment(state, unsafe) {\n if (state.schema.allowComments) {\n // See <https://html.spec.whatwg.org/multipage/parsing.html#serialising-html-fragments>\n const result = typeof unsafe.value === 'string' ? unsafe.value : ''\n const index = result.indexOf('-->')\n const value = index < 0 ? result : result.slice(0, index)\n\n /** @type {Comment} */\n const node = {type: 'comment', value}\n\n patch(node, unsafe)\n\n return node\n }\n}\n\n/**\n * Make a safe doctype.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<Record<string, Readonly<unknown>>>} unsafe\n * Unsafe doctype-like value.\n * @returns {Doctype | undefined}\n * Safe doctype (if with `allowDoctypes`).\n */\nfunction doctype(state, unsafe) {\n if (state.schema.allowDoctypes) {\n /** @type {Doctype} */\n const node = {type: 'doctype'}\n\n patch(node, unsafe)\n\n return node\n }\n}\n\n/**\n * Make a safe element.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<Record<string, Readonly<unknown>>>} unsafe\n * Unsafe element-like value.\n * @returns {Array<ElementContent> | Element | undefined}\n * Safe element.\n */\nfunction element(state, unsafe) {\n const name = typeof unsafe.tagName === 'string' ? unsafe.tagName : ''\n\n state.stack.push(name)\n\n const content = /** @type {Array<ElementContent>} */ (\n children(state, unsafe.children)\n )\n const properties_ = properties(state, unsafe.properties)\n\n state.stack.pop()\n\n let safeElement = false\n\n if (\n name &&\n name !== '*' &&\n (!state.schema.tagNames || state.schema.tagNames.includes(name))\n ) {\n safeElement = true\n\n // Some nodes can break out of their context if they don’t have a certain\n // ancestor.\n if (state.schema.ancestors && own.call(state.schema.ancestors, name)) {\n const ancestors = state.schema.ancestors[name]\n let index = -1\n\n safeElement = false\n\n while (++index < ancestors.length) {\n if (state.stack.includes(ancestors[index])) {\n safeElement = true\n }\n }\n }\n }\n\n if (!safeElement) {\n return state.schema.strip && !state.schema.strip.includes(name)\n ? content\n : undefined\n }\n\n /** @type {Element} */\n const node = {\n type: 'element',\n tagName: name,\n properties: properties_,\n children: content\n }\n\n patch(node, unsafe)\n\n return node\n}\n\n/**\n * Make a safe root.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<Record<string, Readonly<unknown>>>} unsafe\n * Unsafe root-like value.\n * @returns {Root}\n * Safe root.\n */\nfunction root(state, unsafe) {\n const content = /** @type {Array<RootContent>} */ (\n children(state, unsafe.children)\n )\n\n /** @type {Root} */\n const node = {type: 'root', children: content}\n\n patch(node, unsafe)\n\n return node\n}\n\n/**\n * Make a safe text.\n *\n * @param {State} _\n * Info passed around.\n * @param {Readonly<Record<string, Readonly<unknown>>>} unsafe\n * Unsafe text-like value.\n * @returns {Text}\n * Safe text.\n */\nfunction text(_, unsafe) {\n const value = typeof unsafe.value === 'string' ? unsafe.value : ''\n /** @type {Text} */\n const node = {type: 'text', value}\n\n patch(node, unsafe)\n\n return node\n}\n\n/**\n * Make children safe.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<unknown>} children\n * Unsafe value.\n * @returns {Array<Nodes>}\n * Safe children.\n */\nfunction children(state, children) {\n /** @type {Array<Nodes>} */\n const results = []\n\n if (Array.isArray(children)) {\n const childrenUnknown = /** @type {Array<Readonly<unknown>>} */ (children)\n let index = -1\n\n while (++index < childrenUnknown.length) {\n const value = transform(state, childrenUnknown[index])\n\n if (value) {\n if (Array.isArray(value)) {\n results.push(...value)\n } else {\n results.push(value)\n }\n }\n }\n }\n\n return results\n}\n\n/**\n * Make element properties safe.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<unknown>} properties\n * Unsafe value.\n * @returns {Properties}\n * Safe value.\n */\nfunction properties(state, properties) {\n const tagName = state.stack[state.stack.length - 1]\n const attributes = state.schema.attributes\n const required = state.schema.required\n const specific =\n attributes && own.call(attributes, tagName)\n ? attributes[tagName]\n : undefined\n const defaults =\n attributes && own.call(attributes, '*') ? attributes['*'] : undefined\n const properties_ =\n /** @type {Readonly<Record<string, Readonly<unknown>>>} */ (\n properties && typeof properties === 'object' ? properties : {}\n )\n /** @type {Properties} */\n const result = {}\n /** @type {string} */\n let key\n\n for (key in properties_) {\n if (own.call(properties_, key)) {\n const unsafe = properties_[key]\n let safe = propertyValue(\n state,\n findDefinition(specific, key),\n key,\n unsafe\n )\n\n if (safe === null || safe === undefined) {\n safe = propertyValue(state, findDefinition(defaults, key), key, unsafe)\n }\n\n if (safe !== null && safe !== undefined) {\n result[key] = safe\n }\n }\n }\n\n if (required && own.call(required, tagName)) {\n const properties = required[tagName]\n\n for (key in properties) {\n if (own.call(properties, key) && !own.call(result, key)) {\n result[key] = properties[key]\n }\n }\n }\n\n return result\n}\n\n/**\n * Sanitize a property value.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<PropertyDefinition> | undefined} definition\n * Definition.\n * @param {string} key\n * Field name.\n * @param {Readonly<unknown>} value\n * Unsafe value (but an array).\n * @returns {Array<number | string> | boolean | number | string | undefined}\n * Safe value.\n */\nfunction propertyValue(state, definition, key, value) {\n return definition\n ? Array.isArray(value)\n ? propertyValueMany(state, definition, key, value)\n : propertyValuePrimitive(state, definition, key, value)\n : undefined\n}\n\n/**\n * Sanitize a property value which is a list.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<PropertyDefinition>} definition\n * Definition.\n * @param {string} key\n * Field name.\n * @param {Readonly<Array<Readonly<unknown>>>} values\n * Unsafe value (but an array).\n * @returns {Array<number | string>}\n * Safe value.\n */\nfunction propertyValueMany(state, definition, key, values) {\n let index = -1\n /** @type {Array<number | string>} */\n const result = []\n\n while (++index < values.length) {\n const value = propertyValuePrimitive(state, definition, key, values[index])\n\n if (typeof value === 'number' || typeof value === 'string') {\n result.push(value)\n }\n }\n\n return result\n}\n\n/**\n * Sanitize a property value which is a primitive.\n *\n * @param {State} state\n * Info passed around.\n * @param {Readonly<PropertyDefinition>} definition\n * Definition.\n * @param {string} key\n * Field name.\n * @param {Readonly<unknown>} value\n * Unsafe value (but not an array).\n * @returns {boolean | number | string | undefined}\n * Safe value.\n */\nfunction propertyValuePrimitive(state, definition, key, value) {\n if (\n typeof value !== 'boolean' &&\n typeof value !== 'number' &&\n typeof value !== 'string'\n ) {\n return\n }\n\n if (!safeProtocol(state, key, value)) {\n return\n }\n\n // Just a string, or only one item in an array, means all values are OK.\n // More than one item means an allow list.\n if (typeof definition === 'object' && definition.length > 1) {\n let ok = false\n let index = 0 // Ignore `key`, which is the first item.\n\n while (++index < definition.length) {\n const allowed = definition[index]\n\n // Expression.\n if (allowed && typeof allowed === 'object' && 'flags' in allowed) {\n if (allowed.test(String(value))) {\n ok = true\n break\n }\n }\n // Primitive.\n else if (allowed === value) {\n ok = true\n break\n }\n }\n\n if (!ok) return\n }\n\n return state.schema.clobber &&\n state.schema.clobberPrefix &&\n state.schema.clobber.includes(key)\n ? state.schema.clobberPrefix + value\n : value\n}\n\n/**\n * Check whether `value` is a safe URL.\n *\n * @param {State} state\n * Info passed around.\n * @param {string} key\n * Field name.\n * @param {Readonly<unknown>} value\n * Unsafe value.\n * @returns {boolean}\n * Whether it’s a safe value.\n */\nfunction safeProtocol(state, key, value) {\n const protocols =\n state.schema.protocols && own.call(state.schema.protocols, key)\n ? state.schema.protocols[key]\n : undefined\n\n // No protocols defined? Then everything is fine.\n if (!protocols || protocols.length === 0) {\n return true\n }\n\n const url = String(value)\n const colon = url.indexOf(':')\n const questionMark = url.indexOf('?')\n const numberSign = url.indexOf('#')\n const slash = url.indexOf('/')\n\n if (\n colon < 0 ||\n // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.\n (slash > -1 && colon > slash) ||\n (questionMark > -1 && colon > questionMark) ||\n (numberSign > -1 && colon > numberSign)\n ) {\n return true\n }\n\n let index = -1\n\n while (++index < protocols.length) {\n const protocol = protocols[index]\n\n if (\n colon === protocol.length &&\n url.slice(0, protocol.length) === protocol\n ) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Add data and position.\n *\n * @param {Nodes} node\n * Node to patch safe data and position on.\n * @param {Readonly<Record<string, Readonly<unknown>>>} unsafe\n * Unsafe node-like value.\n * @returns {undefined}\n * Nothing.\n */\nfunction patch(node, unsafe) {\n const cleanPosition = position(\n // @ts-expect-error: looks like a node.\n unsafe\n )\n\n if (unsafe.data) {\n node.data = structuredClone(unsafe.data)\n }\n\n if (cleanPosition) node.position = cleanPosition\n}\n\n/**\n *\n * @param {Readonly<Array<PropertyDefinition>> | undefined} definitions\n * @param {string} key\n * @returns {Readonly<PropertyDefinition> | undefined}\n */\nfunction findDefinition(definitions, key) {\n /** @type {PropertyDefinition | undefined} */\n let dataDefault\n let index = -1\n\n if (definitions) {\n while (++index < definitions.length) {\n const entry = definitions[index]\n const name = typeof entry === 'string' ? entry : entry[0]\n\n if (name === key) {\n return entry\n }\n\n if (name === 'data*') dataDefault = entry\n }\n }\n\n if (key.length > 4 && key.slice(0, 4).toLowerCase() === 'data') {\n return dataDefault\n }\n}\n","/**\n * @typedef {import('hast').Root} Root\n * @typedef {import('hast-util-sanitize').Schema} Schema\n */\n\nimport {sanitize} from 'hast-util-sanitize'\n\n/**\n * Sanitize HTML.\n *\n * @param {Schema | null | undefined} [options]\n * Configuration (optional).\n * @returns\n * Transform.\n */\nexport default function rehypeSanitize(options) {\n /**\n * @param {Root} tree\n * Tree.\n * @returns {Root}\n * New tree.\n */\n return function (tree) {\n // Assume root in -> root out.\n const result = /** @type {Root} */ (sanitize(tree, options))\n return result\n }\n}\n"],"x_google_ignoreList":[0,1,2],"mappings":";;AAKA,IAAM,IAAO;CAAC;CAAmB;CAAa;AAAgB,GASjD,IAAgB;CAC3B,WAAW;EACT,OAAO,CAAC,OAAO;EACf,IAAI,CAAC,OAAO;EACZ,IAAI,CAAC,OAAO;EACZ,OAAO,CAAC,OAAO;EACf,OAAO,CAAC,OAAO;EACf,IAAI,CAAC,OAAO;CACd;CACA,YAAY;EACV,GAAG;GACD,GAAG;GAEH;GACA;GACA,CAAC,aAAa,uBAAuB;GACrC;EACF;EACA,YAAY,CAAC,MAAM;EAInB,MAAM,CAAC,CAAC,aAAa,aAAa,CAAC;EACnC,KAAK,CAAC,MAAM;EACZ,KAAK,CAAC,aAAa,UAAU;EAC7B,IAAI,CAAC,GAAG,CAAI;EAEZ,IAAI,CAAC,CAAC,aAAa,SAAS,CAAC;EAC7B,KAAK;GAAC,GAAG;GAAM;GAAY;EAAK;EAIhC,OAAO,CACL,CAAC,YAAY,EAAI,GACjB,CAAC,QAAQ,UAAU,CACrB;EACA,KAAK,CAAC,MAAM;EAIZ,IAAI,CAAC,CAAC,aAAa,gBA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,QACtD,OAAO;AAEX;;;AC7uBA,SAAwB,EAAe,GAAS;CAO9C,OAAO,SAAU,GAAM;EAGrB,OADoC,EAAS,GAAM,CACvC;CACd;AACF"}
@@ -0,0 +1,19 @@
1
+ import { type JSX } from 'solid-js';
2
+ import { type RemendOptions } from 'remend';
3
+ export type HighlightCode = (code: string, lang: string | undefined) => string;
4
+ export type CaretVariant = 'block' | 'circle';
5
+ export type StreamdownProps = {
6
+ children: string;
7
+ animated?: boolean;
8
+ isAnimating?: boolean;
9
+ caret?: CaretVariant | boolean;
10
+ parseIncompleteMarkdown?: boolean;
11
+ remendOptions?: RemendOptions;
12
+ allowRawHtml?: boolean;
13
+ allowedLinkPrefixes?: string[];
14
+ allowedImagePrefixes?: string[];
15
+ highlightCode?: HighlightCode;
16
+ class?: string;
17
+ };
18
+ export declare function Streamdown(props: StreamdownProps): JSX.Element;
19
+ //# sourceMappingURL=streamdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streamdown.d.ts","sourceRoot":"","sources":["../src/streamdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,GAAG,EAAgB,MAAM,UAAU,CAAA;AAOnF,OAAe,EAAC,KAAK,aAAa,EAAC,MAAM,QAAQ,CAAA;AAMjD,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,CAAA;AAE9E,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAA;AAyB7C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,YAAY,GAAG,OAAO,CAAA;IAC9B,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC/B,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AA4KD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CA8C9D"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@conciv/solid-streamdown",
3
+ "version": "0.0.1",
4
+ "description": "A SolidJS streaming-markdown renderer: a port of Vercel's streamdown (block memoization, incomplete-markdown handling, token fade-in) onto Solid + the unified pipeline. Encapsulated so the widget can swap it without churn.",
5
+ "keywords": [
6
+ "conciv",
7
+ "markdown",
8
+ "solid-js",
9
+ "streaming"
10
+ ],
11
+ "homepage": "https://github.com/conciv-dev/conciv/tree/main/packages/solid-streamdown#readme",
12
+ "bugs": "https://github.com/conciv-dev/conciv/issues",
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/conciv-dev/conciv.git",
17
+ "directory": "packages/solid-streamdown"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "src/styles.css",
22
+ "LICENSE-APACHE"
23
+ ],
24
+ "type": "module",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ },
30
+ "./styles.css": "./src/styles.css"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "dependencies": {
36
+ "marked": "^18.0.5",
37
+ "rehype-harden": "^1.1.8",
38
+ "rehype-raw": "^7.0.0",
39
+ "rehype-sanitize": "^6.0.0",
40
+ "remark-gfm": "^4.0.1",
41
+ "remark-parse": "^11.0.0",
42
+ "remark-rehype": "^11.1.2",
43
+ "remend": "^1.3.0",
44
+ "unified": "^11.0.5",
45
+ "unist-util-visit-parents": "^6.0.2"
46
+ },
47
+ "devDependencies": {
48
+ "@chromatic-com/storybook": "^5.2.1",
49
+ "@storybook/addon-a11y": "^10.4.4",
50
+ "@storybook/addon-docs": "^10.4.4",
51
+ "@storybook/addon-vitest": "^10.4.4",
52
+ "@types/hast": "^3.0.4",
53
+ "@types/node": "^22.19.21",
54
+ "@vitest/browser-playwright": "4.1.8",
55
+ "@vitest/coverage-v8": "4.1.8",
56
+ "playwright": "^1.60.0",
57
+ "shiki": "^4.2.0",
58
+ "solid-js": "^1.9.13",
59
+ "storybook": "^10.4.4",
60
+ "storybook-solidjs-vite": "^10.3.0",
61
+ "typescript": "^6.0.3",
62
+ "vite": "^8.0.16",
63
+ "vite-plugin-solid": "^2.11.12",
64
+ "vitest": "^4.1.8"
65
+ },
66
+ "peerDependencies": {
67
+ "shiki": "^4.2.0",
68
+ "solid-js": "^1.9.13"
69
+ },
70
+ "scripts": {
71
+ "build": "vite build && tsc -p tsconfig.build.json",
72
+ "typecheck": "tsc -p tsconfig.json --noEmit",
73
+ "lint": "oxlint",
74
+ "test": "vitest run",
75
+ "storybook": "storybook dev -p 6006",
76
+ "build-storybook": "storybook build",
77
+ "publint": "publint",
78
+ "attw": "attw --pack . --profile esm-only --exclude-entrypoints styles.css"
79
+ }
80
+ }
package/src/styles.css ADDED
@@ -0,0 +1,51 @@
1
+ /* Token fade-in for streamed markdown. Spans are injected by the animate rehype plugin with
2
+ per-token CSS vars (--sd-animation/--sd-duration/--sd-easing/--sd-delay). */
3
+ [data-sd-animate] {
4
+ animation: var(--sd-animation, sd-fadeIn) var(--sd-duration, 150ms) var(--sd-easing, ease) var(--sd-delay, 0ms) both;
5
+ }
6
+
7
+ @media (prefers-reduced-motion: reduce) {
8
+ [data-sd-animate] {
9
+ animation: none;
10
+ }
11
+ }
12
+
13
+ /* Caret glyph (set via --sd-caret on .sd-root while streaming), on the LAST block element only.
14
+ Direct-child combinator → exactly one caret, on the block's ::after at the text baseline, never
15
+ inside an animating token. Matches Vercel streamdown's `[&>*:last-child]:after` approach. */
16
+ .sd-root > *:last-child::after {
17
+ content: var(--sd-caret, '');
18
+ display: inline;
19
+ vertical-align: baseline;
20
+ }
21
+
22
+ @keyframes sd-fadeIn {
23
+ from {
24
+ opacity: 0;
25
+ }
26
+ to {
27
+ opacity: 1;
28
+ }
29
+ }
30
+
31
+ @keyframes sd-blurIn {
32
+ from {
33
+ opacity: 0;
34
+ filter: blur(4px);
35
+ }
36
+ to {
37
+ opacity: 1;
38
+ filter: blur(0);
39
+ }
40
+ }
41
+
42
+ @keyframes sd-slideUp {
43
+ from {
44
+ opacity: 0;
45
+ transform: translateY(4px);
46
+ }
47
+ to {
48
+ opacity: 1;
49
+ transform: translateY(0);
50
+ }
51
+ }