@netlify/spark-ui 1.11.0 → 1.12.0-alpha.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/dist/assets/AskNetlify.css +1 -1
- package/dist/components/preact/AskNetlify/components/ChatMessages.js +61 -57
- package/dist/components/preact/AskNetlify/components/SourcesList.d.ts +3 -0
- package/dist/components/preact/AskNetlify/components/SourcesList.js +19 -0
- package/package.json +2 -2
- package/packages/components/preact/AskNetlify/AskNetlify.css +13 -0
- package/packages/components/preact/AskNetlify/components/ChatMessages.tsx +4 -1
- package/packages/components/preact/AskNetlify/components/SourcesList.tsx +25 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
.n-fadeIn{opacity:0;animation:fadeIn var(--animation-duration, .3s) ease-out forwards}.n-fadeInUp{opacity:0;transform:translateY(var(--animation-transformY, 5px));animation:fadeInUp var(--animation-duration, .3s) ease-out forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeInUp{to{opacity:1;transform:translateY(0)}}.n-ask-chat-container{opacity:0;animation:appearContainer .12s ease-in-out forwards;animation-delay:.14s}.n-ask-conversation{display:grid;align-items:flex-end;height:calc(var(--n-search-container-height) + var(--n-search-footer-height));padding:var(--n-search-padding-inline);overflow-y:auto;scroll-behavior:smooth;gap:var(--space-s)}.n-ask-form{display:flex;align-items:center;position:relative;height:var(--n-search-input-height);background-color:var(--search-input-bg-color)}.n-ask-form:after{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:1px;background:var(--color-bg-3)}.n-ask-question{border:none;border-radius:var(--radius-pill);transform:translate(-.75rem);color:var(--color-text-1);font-size:var(--step--1);font-weight:var(--font-weight-regular);text-align:left;text-wrap:pretty;display:flex;align-items:center;gap:var(--space-2xs);transition:background-color .2s ease-out}.n-ask-question [data-icon=caretRight]{opacity:0;color:var(--color-text-weaker);transform:translate(-3px);transition:transform .2s ease-out}.n-ask-question:hover{background-color:var(--n-search-color-bg-2)}.n-ask-question:hover [data-icon=caretRight]{opacity:1;transform:translate(0)}.n-ask-question-list .n-ask-question-list-item{position:relative;width:fit-content;opacity:0;transform:translateY(10px);animation:fadeInUp .5s forwards}.n-ask-message{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-s);margin-block-start:var(--space-2xl)}.n-ask-message-bubble{width:fit-content;max-width:85%;padding:var(--space-xs) var(--space-s);background:var(--search-answer-message-color);border-radius:var(--radius-l);font-size:var(--step-0)}.n-ask-user-message{margin-inline-start:auto;background:var(--search-user-message-color)}.n-ask-input{border:none;outline:none;padding-inline:var(--n-search-padding-inline)}.n-ask-form-submit{padding:.7rem;margin-inline-end:var(--space-2xs);border:none;border-radius:var(--radius-pill);background:var(--search-submit-btn-bg-color);color:var(--neutral-000);transition:background-color .15s ease-out}.n-ask-form-submit>svg{width:1rem;height:auto;aspect-ratio:1 / 1;border-radius:1.5px;transition:opacity .15s ease-out}.n-ask-form-submit[disabled]{background:var(--neutral-500)}.n-ask-form-submit[disabled]>*{opacity:.5}.n-ask-button-back{position:absolute;z-index:1;width:fit-content;margin:1rem;padding:.5rem 1rem;background:var(--search-back-btn-bg-color);border:.5px solid var(--color-bg-3);border-radius:var(--radius-pill);font-size:var(--step--1);color:var(--color-text-1);cursor:pointer}.n-ask-button-back [data-icon=caretRight]{color:var(--color-text-weaker);transform:rotate(180deg)}.n-ask-prose{font-size:var(--step--0)}.n-ask-prose>*+*{margin-top:var(--flow-space, var(--space-s))}.n-ask-prose :where(ol,ul,li)>*+*{margin-top:var(--flow-space, var(--space-3xs))}.n-ask-prose h1,.n-ask-prose h2,.n-ask-prose h3{font-size:var(--step-1);font-weight:var(--font-weight-bold)}.n-ask-prose h4,.n-ask-prose h5,.n-ask-prose h6{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-prose pre{max-width:100%;padding:var(--space-s);background:var(--neutral-light-700);border-radius:var(--radius-m);box-sizing:border-box;color:var(--neutral-100);overflow-x:auto}.n-ask-prose code{overflow-x:auto}.n-ask-prose code[class*=language-],.n-ask-prose pre[class*=language-]{display:block;font-size:var(--font-size-text-xs)}.n-ask-message-loader{width:2.5rem;height:auto;display:block;color:var(--search-loading-color)}.n-ask-message-loader :where(#ask-netlify-tick-1,#ask-netlify-tick-2,#ask-netlify-tick-3){opacity:0;animation:fadeIn .8s ease-in-out infinite}.n-ask-message-loader #ask-netlify-tick-1{animation-delay:.1s}.n-ask-message-loader #ask-netlify-tick-2{animation-delay:.2s}.n-ask-message-loader #ask-netlify-tick-3{animation-delay:.3s}.n-ask-message-loader :where(#ask-netlify-eyelid-left,#ask-netlify-eyelid-right){transform-origin:top center;transform:scaleY(1.035);animation:askEyeBlink 4s infinite;animation-delay:1s}@keyframes askEyeBlink{0%,5%{transform:scaleY(1.035)}6%,10%{transform:scaleY(1.3)}11%,15%{transform:scaleY(1.035)}16%,20%{transform:scaleY(1.3)}21%,to{transform:scaleY(1.035)}}
|
|
1
|
+
.n-fadeIn{opacity:0;animation:fadeIn var(--animation-duration, .3s) ease-out forwards}.n-fadeInUp{opacity:0;transform:translateY(var(--animation-transformY, 5px));animation:fadeInUp var(--animation-duration, .3s) ease-out forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeInUp{to{opacity:1;transform:translateY(0)}}.n-ask-chat-container{opacity:0;animation:appearContainer .12s ease-in-out forwards;animation-delay:.14s}.n-ask-conversation{display:grid;align-items:flex-end;height:calc(var(--n-search-container-height) + var(--n-search-footer-height));padding:var(--n-search-padding-inline);overflow-y:auto;scroll-behavior:smooth;gap:var(--space-s)}.n-ask-form{display:flex;align-items:center;position:relative;height:var(--n-search-input-height);background-color:var(--search-input-bg-color)}.n-ask-form:after{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:1px;background:var(--color-bg-3)}.n-ask-question{border:none;border-radius:var(--radius-pill);transform:translate(-.75rem);color:var(--color-text-1);font-size:var(--step--1);font-weight:var(--font-weight-regular);text-align:left;text-wrap:pretty;display:flex;align-items:center;gap:var(--space-2xs);transition:background-color .2s ease-out}.n-ask-question [data-icon=caretRight]{opacity:0;color:var(--color-text-weaker);transform:translate(-3px);transition:transform .2s ease-out}.n-ask-question:hover{background-color:var(--n-search-color-bg-2)}.n-ask-question:hover [data-icon=caretRight]{opacity:1;transform:translate(0)}.n-ask-question-list .n-ask-question-list-item{position:relative;width:fit-content;opacity:0;transform:translateY(10px);animation:fadeInUp .5s forwards}.n-ask-message{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-s);margin-block-start:var(--space-2xl)}.n-ask-message-bubble{width:fit-content;max-width:85%;padding:var(--space-xs) var(--space-s);background:var(--search-answer-message-color);border-radius:var(--radius-l);font-size:var(--step-0)}.n-ask-user-message{margin-inline-start:auto;background:var(--search-user-message-color)}.n-ask-sources{margin-block-start:var(--space-m)}.n-ask-sources-title{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-sources a{font-size:var(--step--1)}.n-ask-input{border:none;outline:none;padding-inline:var(--n-search-padding-inline)}.n-ask-form-submit{padding:.7rem;margin-inline-end:var(--space-2xs);border:none;border-radius:var(--radius-pill);background:var(--search-submit-btn-bg-color);color:var(--neutral-000);transition:background-color .15s ease-out}.n-ask-form-submit>svg{width:1rem;height:auto;aspect-ratio:1 / 1;border-radius:1.5px;transition:opacity .15s ease-out}.n-ask-form-submit[disabled]{background:var(--neutral-500)}.n-ask-form-submit[disabled]>*{opacity:.5}.n-ask-button-back{position:absolute;z-index:1;width:fit-content;margin:1rem;padding:.5rem 1rem;background:var(--search-back-btn-bg-color);border:.5px solid var(--color-bg-3);border-radius:var(--radius-pill);font-size:var(--step--1);color:var(--color-text-1);cursor:pointer}.n-ask-button-back [data-icon=caretRight]{color:var(--color-text-weaker);transform:rotate(180deg)}.n-ask-prose{font-size:var(--step--0)}.n-ask-prose>*+*{margin-top:var(--flow-space, var(--space-s))}.n-ask-prose :where(ol,ul,li)>*+*{margin-top:var(--flow-space, var(--space-3xs))}.n-ask-prose h1,.n-ask-prose h2,.n-ask-prose h3{font-size:var(--step-1);font-weight:var(--font-weight-bold)}.n-ask-prose h4,.n-ask-prose h5,.n-ask-prose h6{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-prose pre{max-width:100%;padding:var(--space-s);background:var(--neutral-light-700);border-radius:var(--radius-m);box-sizing:border-box;color:var(--neutral-100);overflow-x:auto}.n-ask-prose code{overflow-x:auto}.n-ask-prose code[class*=language-],.n-ask-prose pre[class*=language-]{display:block;font-size:var(--font-size-text-xs)}.n-ask-message-loader{width:2.5rem;height:auto;display:block;color:var(--search-loading-color)}.n-ask-message-loader :where(#ask-netlify-tick-1,#ask-netlify-tick-2,#ask-netlify-tick-3){opacity:0;animation:fadeIn .8s ease-in-out infinite}.n-ask-message-loader #ask-netlify-tick-1{animation-delay:.1s}.n-ask-message-loader #ask-netlify-tick-2{animation-delay:.2s}.n-ask-message-loader #ask-netlify-tick-3{animation-delay:.3s}.n-ask-message-loader :where(#ask-netlify-eyelid-left,#ask-netlify-eyelid-right){transform-origin:top center;transform:scaleY(1.035);animation:askEyeBlink 4s infinite;animation-delay:1s}@keyframes askEyeBlink{0%,5%{transform:scaleY(1.035)}6%,10%{transform:scaleY(1.3)}11%,15%{transform:scaleY(1.035)}16%,20%{transform:scaleY(1.3)}21%,to{transform:scaleY(1.035)}}
|
|
@@ -3,7 +3,8 @@ var ye = (n, e, t) => e in n ? we(n, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var d = (n, e, t) => ye(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { u as w } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
5
5
|
import Se from "../../Icon/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { SourcesList as $e } from "./SourcesList.js";
|
|
7
|
+
import { Fragment as Re } from "preact";
|
|
7
8
|
function H() {
|
|
8
9
|
return {
|
|
9
10
|
async: !1,
|
|
@@ -91,31 +92,31 @@ var x = {
|
|
|
91
92
|
fencesBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:\`\`\`|~~~)`),
|
|
92
93
|
headingBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}#`),
|
|
93
94
|
htmlBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
94
|
-
},
|
|
95
|
+
}, ve = /^(?:[ \t]*(?:\n|$))+/, Te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ze = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, _e = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = /(?:[*+-]|\d{1,9}[.)])/, ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ae = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Le = /^[^\n]+/, U = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ie = u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ce = u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Pe = u(
|
|
95
96
|
"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))",
|
|
96
97
|
"i"
|
|
97
|
-
).replace("comment", X).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(),
|
|
98
|
-
blockquote:
|
|
99
|
-
code:
|
|
100
|
-
def:
|
|
101
|
-
fences:
|
|
102
|
-
heading:
|
|
98
|
+
).replace("comment", X).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Be = u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", pe).getRegex(), W = {
|
|
99
|
+
blockquote: Be,
|
|
100
|
+
code: Te,
|
|
101
|
+
def: Ie,
|
|
102
|
+
fences: ze,
|
|
103
|
+
heading: _e,
|
|
103
104
|
hr: L,
|
|
104
|
-
html:
|
|
105
|
+
html: Pe,
|
|
105
106
|
lheading: he,
|
|
106
|
-
list:
|
|
107
|
-
newline:
|
|
107
|
+
list: Ce,
|
|
108
|
+
newline: ve,
|
|
108
109
|
paragraph: pe,
|
|
109
110
|
table: A,
|
|
110
|
-
text:
|
|
111
|
+
text: Le
|
|
111
112
|
}, re = u(
|
|
112
113
|
"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
113
|
-
).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(),
|
|
114
|
+
).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Ee = {
|
|
114
115
|
...W,
|
|
115
|
-
lheading:
|
|
116
|
+
lheading: Ae,
|
|
116
117
|
table: re,
|
|
117
118
|
paragraph: u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex()
|
|
118
|
-
},
|
|
119
|
+
}, qe = {
|
|
119
120
|
...W,
|
|
120
121
|
html: u(
|
|
121
122
|
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
@@ -127,64 +128,64 @@ var x = {
|
|
|
127
128
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
128
129
|
paragraph: u(F).replace("hr", L).replace("heading", ` *#{1,6} *[^
|
|
129
130
|
]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
130
|
-
},
|
|
131
|
+
}, Ze = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, De = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Me = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Z = /[\p{P}\p{S}]/u, J = /[\s\p{P}\p{S}]/u, ge = /[^\s\p{P}\p{S}]/u, Ge = u(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, J).getRegex(), fe = /(?!~)[\p{P}\p{S}]/u, Ne = /(?!~)[\s\p{P}\p{S}]/u, Oe = /(?:[^\s\p{P}\p{S}]|~)/u, je = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, de = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, He = u(de, "u").replace(/punct/g, Z).getRegex(), Qe = u(de, "u").replace(/punct/g, fe).getRegex(), ke = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Fe = u(ke, "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), Ue = u(ke, "gu").replace(/notPunctSpace/g, Oe).replace(/punctSpace/g, Ne).replace(/punct/g, fe).getRegex(), Xe = u(
|
|
131
132
|
"^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
|
|
132
133
|
"gu"
|
|
133
|
-
).replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(),
|
|
134
|
+
).replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), We = u(/\\(punct)/, "gu").replace(/punct/g, Z).getRegex(), Je = u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Ke = u(X).replace("(?:-->|$)", "-->").getRegex(), Ve = u(
|
|
134
135
|
"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
|
|
135
|
-
).replace("comment",
|
|
136
|
+
).replace("comment", Ke).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), P = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Ye = u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", P).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), be = u(/^!?\[(label)\]\[(ref)\]/).replace("label", P).replace("ref", U).getRegex(), xe = u(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), et = u("reflink|nolink(?!\\()", "g").replace("reflink", be).replace("nolink", xe).getRegex(), K = {
|
|
136
137
|
_backpedal: A,
|
|
137
138
|
// only used for GFM url
|
|
138
|
-
anyPunctuation:
|
|
139
|
-
autolink:
|
|
140
|
-
blockSkip:
|
|
139
|
+
anyPunctuation: We,
|
|
140
|
+
autolink: Je,
|
|
141
|
+
blockSkip: je,
|
|
141
142
|
br: ue,
|
|
142
|
-
code:
|
|
143
|
+
code: De,
|
|
143
144
|
del: A,
|
|
144
|
-
emStrongLDelim:
|
|
145
|
-
emStrongRDelimAst:
|
|
146
|
-
emStrongRDelimUnd:
|
|
147
|
-
escape:
|
|
148
|
-
link:
|
|
145
|
+
emStrongLDelim: He,
|
|
146
|
+
emStrongRDelimAst: Fe,
|
|
147
|
+
emStrongRDelimUnd: Xe,
|
|
148
|
+
escape: Ze,
|
|
149
|
+
link: Ye,
|
|
149
150
|
nolink: xe,
|
|
150
|
-
punctuation:
|
|
151
|
+
punctuation: Ge,
|
|
151
152
|
reflink: be,
|
|
152
|
-
reflinkSearch:
|
|
153
|
-
tag:
|
|
154
|
-
text:
|
|
153
|
+
reflinkSearch: et,
|
|
154
|
+
tag: Ve,
|
|
155
|
+
text: Me,
|
|
155
156
|
url: A
|
|
156
|
-
},
|
|
157
|
+
}, tt = {
|
|
157
158
|
...K,
|
|
158
159
|
link: u(/^!?\[(label)\]\((.*?)\)/).replace("label", P).getRegex(),
|
|
159
160
|
reflink: u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", P).getRegex()
|
|
160
161
|
}, N = {
|
|
161
162
|
...K,
|
|
162
|
-
emStrongRDelimAst:
|
|
163
|
-
emStrongLDelim:
|
|
163
|
+
emStrongRDelimAst: Ue,
|
|
164
|
+
emStrongLDelim: Qe,
|
|
164
165
|
url: u(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
165
166
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
166
167
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
167
168
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
168
|
-
},
|
|
169
|
+
}, nt = {
|
|
169
170
|
...N,
|
|
170
171
|
br: u(ue).replace("{2,}", "*").getRegex(),
|
|
171
172
|
text: u(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
172
173
|
}, I = {
|
|
173
174
|
normal: W,
|
|
174
|
-
gfm:
|
|
175
|
-
pedantic:
|
|
175
|
+
gfm: Ee,
|
|
176
|
+
pedantic: qe
|
|
176
177
|
}, z = {
|
|
177
178
|
normal: K,
|
|
178
179
|
gfm: N,
|
|
179
|
-
breaks:
|
|
180
|
-
pedantic:
|
|
181
|
-
},
|
|
180
|
+
breaks: nt,
|
|
181
|
+
pedantic: tt
|
|
182
|
+
}, rt = {
|
|
182
183
|
"&": "&",
|
|
183
184
|
"<": "<",
|
|
184
185
|
">": ">",
|
|
185
186
|
'"': """,
|
|
186
187
|
"'": "'"
|
|
187
|
-
}, se = (n) =>
|
|
188
|
+
}, se = (n) => rt[n];
|
|
188
189
|
function y(n, e) {
|
|
189
190
|
if (e) {
|
|
190
191
|
if (x.escapeTest.test(n))
|
|
@@ -227,7 +228,7 @@ function _(n, e, t) {
|
|
|
227
228
|
s++;
|
|
228
229
|
return n.slice(0, r - s);
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
+
function st(n, e) {
|
|
231
232
|
if (n.indexOf(e[1]) === -1)
|
|
232
233
|
return -1;
|
|
233
234
|
let t = 0;
|
|
@@ -253,7 +254,7 @@ function ae(n, e, t, r, s) {
|
|
|
253
254
|
};
|
|
254
255
|
return r.state.inLink = !1, h;
|
|
255
256
|
}
|
|
256
|
-
function
|
|
257
|
+
function it(n, e, t) {
|
|
257
258
|
const r = n.match(t.other.indentCodeCompensation);
|
|
258
259
|
if (r === null)
|
|
259
260
|
return e;
|
|
@@ -301,7 +302,7 @@ var B = class {
|
|
|
301
302
|
fences(n) {
|
|
302
303
|
const e = this.rules.block.fences.exec(n);
|
|
303
304
|
if (e) {
|
|
304
|
-
const t = e[0], r =
|
|
305
|
+
const t = e[0], r = it(t, e[3] || "", this.rules);
|
|
305
306
|
return {
|
|
306
307
|
type: "code",
|
|
307
308
|
raw: t,
|
|
@@ -587,7 +588,7 @@ ${o}` : o;
|
|
|
587
588
|
if ((t.length - i.length) % 2 === 0)
|
|
588
589
|
return;
|
|
589
590
|
} else {
|
|
590
|
-
const i =
|
|
591
|
+
const i = st(e[2], "()");
|
|
591
592
|
if (i === -2)
|
|
592
593
|
return;
|
|
593
594
|
if (i > -1) {
|
|
@@ -1360,7 +1361,7 @@ ${n}</tr>
|
|
|
1360
1361
|
"preprocess",
|
|
1361
1362
|
"postprocess",
|
|
1362
1363
|
"processAllTokens"
|
|
1363
|
-
])), G),
|
|
1364
|
+
])), G), lt = class {
|
|
1364
1365
|
constructor(...n) {
|
|
1365
1366
|
d(this, "defaults", H());
|
|
1366
1367
|
d(this, "options", this.setOptions);
|
|
@@ -1532,7 +1533,7 @@ Please report this to https://github.com/markedjs/marked.`, n) {
|
|
|
1532
1533
|
throw t;
|
|
1533
1534
|
};
|
|
1534
1535
|
}
|
|
1535
|
-
}, R = new
|
|
1536
|
+
}, R = new lt();
|
|
1536
1537
|
function f(n, e) {
|
|
1537
1538
|
return R.parse(n, e);
|
|
1538
1539
|
}
|
|
@@ -1564,11 +1565,11 @@ f.walkTokens;
|
|
|
1564
1565
|
f.parseInline;
|
|
1565
1566
|
$.parse;
|
|
1566
1567
|
S.lex;
|
|
1567
|
-
function
|
|
1568
|
+
function ut({
|
|
1568
1569
|
conversation: n,
|
|
1569
1570
|
lastMessageRef: e
|
|
1570
1571
|
}) {
|
|
1571
|
-
return /* @__PURE__ */ w(
|
|
1572
|
+
return /* @__PURE__ */ w(Re, { children: n.map((t, r) => {
|
|
1572
1573
|
const s = r === n.length - 1;
|
|
1573
1574
|
return /* @__PURE__ */ w("div", { class: "n-ask-message", children: [
|
|
1574
1575
|
/* @__PURE__ */ w("div", { class: "n-ask-message-right", children: /* @__PURE__ */ w(
|
|
@@ -1579,16 +1580,19 @@ function ht({
|
|
|
1579
1580
|
children: /* @__PURE__ */ w("p", { children: t.question })
|
|
1580
1581
|
}
|
|
1581
1582
|
) }),
|
|
1582
|
-
/* @__PURE__ */ w("div", { class: "n-ask-message-left", children: t.answer ? /* @__PURE__ */ w("div", { class: "n-ask-message-bubble n-ask-bot-message", children:
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1583
|
+
/* @__PURE__ */ w("div", { class: "n-ask-message-left", children: t.answer ? /* @__PURE__ */ w("div", { class: "n-ask-message-bubble n-ask-bot-message", children: [
|
|
1584
|
+
/* @__PURE__ */ w(
|
|
1585
|
+
"div",
|
|
1586
|
+
{
|
|
1587
|
+
class: "n-ask-message-answer n-ask-prose prose flow",
|
|
1588
|
+
dangerouslySetInnerHTML: { __html: f.parse(t.answer) }
|
|
1589
|
+
}
|
|
1590
|
+
),
|
|
1591
|
+
t.id && /* @__PURE__ */ w($e, { sources: t.sources })
|
|
1592
|
+
] }) : /* @__PURE__ */ w("div", { class: "n-ask-message-loader", children: /* @__PURE__ */ w(Se, { name: "askNetlify" }) }) })
|
|
1589
1593
|
] }, t.id || `qa-${r}`);
|
|
1590
1594
|
}) });
|
|
1591
1595
|
}
|
|
1592
1596
|
export {
|
|
1593
|
-
|
|
1597
|
+
ut as ChatMessages
|
|
1594
1598
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { u as l } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
|
+
function r({ sources: e }) {
|
|
3
|
+
return e != null && e.length ? /* @__PURE__ */ l("div", { className: "n-ask-sources", children: [
|
|
4
|
+
/* @__PURE__ */ l("h4", { class: "n-ask-sources-title", children: "Sources:" }),
|
|
5
|
+
/* @__PURE__ */ l("ul", { children: e.map((t, n) => {
|
|
6
|
+
if (t.title)
|
|
7
|
+
return /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l("a", { href: t.source_url, target: "_blank", rel: "noopener noreferrer", children: [
|
|
8
|
+
t.title,
|
|
9
|
+
t.subtitle && t.subtitle !== t.title && /* @__PURE__ */ l("span", { children: [
|
|
10
|
+
" - ",
|
|
11
|
+
t.subtitle
|
|
12
|
+
] })
|
|
13
|
+
] }) }, n);
|
|
14
|
+
}) })
|
|
15
|
+
] }) : null;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
r as SourcesList
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/spark-ui",
|
|
3
3
|
"description": "Assets, design tokens, components, and utilities",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.0-alpha.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/components/preact/index.js",
|
|
7
7
|
"types": "dist/components/preact/index.d.ts",
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
"prettier": "^3.5.3",
|
|
69
69
|
"prettier-plugin-astro": "^0.14.1"
|
|
70
70
|
}
|
|
71
|
-
}
|
|
71
|
+
}
|
|
@@ -101,6 +101,19 @@
|
|
|
101
101
|
background: var(--search-user-message-color);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
.n-ask-sources {
|
|
105
|
+
margin-block-start: var(--space-m);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.n-ask-sources-title {
|
|
109
|
+
font-size: var(--step-0);
|
|
110
|
+
font-weight: var(--font-weight-bold);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.n-ask-sources a {
|
|
114
|
+
font-size: var(--step--1);
|
|
115
|
+
}
|
|
116
|
+
|
|
104
117
|
/* ----------------------------- */
|
|
105
118
|
/* Form UI */
|
|
106
119
|
/* ----------------------------- */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Ref } from 'preact';
|
|
1
2
|
import { marked } from 'marked';
|
|
3
|
+
|
|
2
4
|
import Icon from '../../Icon';
|
|
3
|
-
import {
|
|
5
|
+
import { SourcesList } from './SourcesList';
|
|
4
6
|
|
|
5
7
|
export function ChatMessages({
|
|
6
8
|
conversation,
|
|
@@ -31,6 +33,7 @@ export function ChatMessages({
|
|
|
31
33
|
class="n-ask-message-answer n-ask-prose prose flow"
|
|
32
34
|
dangerouslySetInnerHTML={{ __html: marked.parse(qa.answer) }}
|
|
33
35
|
/>
|
|
36
|
+
{qa.id && <SourcesList sources={qa.sources} />}
|
|
34
37
|
</div>
|
|
35
38
|
) : (
|
|
36
39
|
<div class="n-ask-message-loader">
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function SourcesList({ sources }) {
|
|
2
|
+
if (!sources?.length) return null;
|
|
3
|
+
|
|
4
|
+
return (
|
|
5
|
+
<div className="n-ask-sources">
|
|
6
|
+
<h4 class="n-ask-sources-title">Sources:</h4>
|
|
7
|
+
<ul>
|
|
8
|
+
{sources.map((source, index) => {
|
|
9
|
+
if (!source.title) return;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<li key={index}>
|
|
13
|
+
<a href={source.source_url} target="_blank" rel="noopener noreferrer">
|
|
14
|
+
{source.title}
|
|
15
|
+
{source.subtitle && source.subtitle !== source.title && (
|
|
16
|
+
<span> - {source.subtitle}</span>
|
|
17
|
+
)}
|
|
18
|
+
</a>
|
|
19
|
+
</li>
|
|
20
|
+
);
|
|
21
|
+
})}
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|