@netlify/spark-ui 1.0.3-alpha.1 → 1.1.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.
- package/dist/assets/SearchLink.css +1 -1
- package/dist/assets/SearchModal.css +1 -1
- package/dist/chunks/compat.module.DJD78v1z.js +175 -0
- package/dist/chunks/hooks.module.D9IrxdEh.js +138 -0
- package/dist/chunks/{useTimeout.DYuvQwFN.js → useTimeout.YR4eKwj7.js} +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/preact/Modal/Modal.js +1 -1
- package/dist/components/preact/SearchModal/components/SearchInput.d.ts +0 -2
- package/dist/components/preact/SearchModal/components/SearchInput.js +2 -2
- package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.js +1 -1
- package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +51 -81
- package/dist/components/preact/SearchModal/components/SearchToggle/SearchToggle.js +1 -1
- package/dist/components/preact/SearchModal/components/SearchWindow.d.ts +1 -1
- package/dist/components/preact/SearchModal/components/SearchWindow.js +34 -39
- package/dist/components/preact/SearchModal/hooks/useKeyboardNav.js +6 -6
- package/dist/components/preact/SearchModal/hooks/useSearch.js +2 -2
- package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.js +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchLogger.js +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchParams.js +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchToggles.js +1 -1
- package/dist/components/preact/SearchModal/types/search.types.d.ts +0 -3
- package/dist/components/preact/index.d.ts +0 -1
- package/dist/components/preact/index.js +5 -7
- package/package.json +2 -4
- package/packages/components/Blockquote.astro +103 -0
- package/packages/components/index.ts +0 -1
- package/packages/components/preact/SearchModal/components/SearchInput.tsx +7 -9
- package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.css +1 -6
- package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.css +11 -67
- package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +30 -67
- package/packages/components/preact/SearchModal/components/SearchWindow.tsx +16 -27
- package/packages/components/preact/SearchModal/hooks/useKeyboardNav.ts +2 -2
- package/packages/components/preact/SearchModal/types/search.types.tsx +1 -2
- package/packages/components/preact/index.ts +0 -1
- package/packages/styles/tokens.css +4 -4
- package/dist/assets/AskNetlify.css +0 -1
- package/dist/assets/Orb.css +0 -1
- package/dist/chunks/compat.module.BjTzMHXJ.js +0 -296
- package/dist/chunks/hooks.module.DeYLzLnU.js +0 -177
- package/dist/components/preact/AskNetlify/AskNetlify.d.ts +0 -2
- package/dist/components/preact/AskNetlify/AskNetlify.js +0 -5292
- package/dist/components/preact/Orb/Orb.d.ts +0 -2
- package/dist/components/preact/Orb/Orb.js +0 -5
- package/packages/components/preact/AskNetlify/AskNetlify.css +0 -162
- package/packages/components/preact/AskNetlify/AskNetlify.tsx +0 -123
- package/packages/components/preact/Orb/Orb.css +0 -94
- package/packages/components/preact/Orb/Orb.tsx +0 -7
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
.chat-container {
|
|
2
|
-
opacity: 0;
|
|
3
|
-
animation: appearContainer 350ms ease-in-out forwards;
|
|
4
|
-
animation-delay: 300ms;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
@keyframes appearContainer {
|
|
8
|
-
0% {
|
|
9
|
-
opacity: 0;
|
|
10
|
-
}
|
|
11
|
-
100% {
|
|
12
|
-
opacity: 1;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.conversation {
|
|
17
|
-
height: calc(var(--n-search-container-height) + var(--n-search-footer-height));
|
|
18
|
-
padding: var(--n-search-padding-inline);
|
|
19
|
-
scroll-behavior: smooth;
|
|
20
|
-
overflow-y: auto;
|
|
21
|
-
display: grid;
|
|
22
|
-
align-items: flex-end;
|
|
23
|
-
gap: var(--space-s);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.message {
|
|
27
|
-
display: grid;
|
|
28
|
-
gap: var(--space-s);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.message-bubble {
|
|
32
|
-
padding: 1rem 1rem;
|
|
33
|
-
background: var(--neutral-light-100);
|
|
34
|
-
border-radius: var(--radius-l);
|
|
35
|
-
width: fit-content;
|
|
36
|
-
max-width: 85%;
|
|
37
|
-
font-size: var(--step-0);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.prose {
|
|
41
|
-
font-size: var(--step--0);
|
|
42
|
-
|
|
43
|
-
> * + * {
|
|
44
|
-
margin-top: var(--flow-space, var(--space-xs));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
h1,
|
|
48
|
-
h2,
|
|
49
|
-
h3 {
|
|
50
|
-
font-size: var(--step-1);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
h4,
|
|
54
|
-
h5,
|
|
55
|
-
h6 {
|
|
56
|
-
font-size: var(--step-0);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
pre {
|
|
60
|
-
background: var(--neutral-light-700);
|
|
61
|
-
border-radius: var(--radius-m);
|
|
62
|
-
max-width: 100%;
|
|
63
|
-
box-sizing: border-box;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
code {
|
|
67
|
-
overflow-x: scroll;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
code[class*='language-'],
|
|
71
|
-
pre[class*='language-'] {
|
|
72
|
-
display: block;
|
|
73
|
-
padding: var(--space-s);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.user-message {
|
|
78
|
-
margin-inline-start: auto;
|
|
79
|
-
background: var(--blue-000);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.form-wrapper {
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
position: relative;
|
|
86
|
-
height: var(--n-search-input-height);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.form-wrapper::after {
|
|
90
|
-
content: '';
|
|
91
|
-
display: block;
|
|
92
|
-
width: 100%;
|
|
93
|
-
height: 1px;
|
|
94
|
-
background: var(--neutral-light-100);
|
|
95
|
-
position: absolute;
|
|
96
|
-
top: 0;
|
|
97
|
-
left: 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.form-input {
|
|
101
|
-
border: none;
|
|
102
|
-
outline: none;
|
|
103
|
-
padding-inline: var(--n-search-padding-inline);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.form-submit {
|
|
107
|
-
border: none;
|
|
108
|
-
padding: 0.7rem;
|
|
109
|
-
border-radius: var(--radius-pill);
|
|
110
|
-
margin-inline-end: var(--space-2xs);
|
|
111
|
-
border: none;
|
|
112
|
-
background: var(--blue-600);
|
|
113
|
-
color: var(--neutral-000);
|
|
114
|
-
transition: filter 300ms ease-out;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.form-submit > svg {
|
|
118
|
-
width: 1rem;
|
|
119
|
-
height: auto;
|
|
120
|
-
aspect-ratio: 1 / 1;
|
|
121
|
-
border-radius: 1.5px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.form-submit[disabled] {
|
|
125
|
-
filter: saturate(0);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.button-back {
|
|
129
|
-
width: fit-content;
|
|
130
|
-
background: transparent;
|
|
131
|
-
position: absolute;
|
|
132
|
-
padding: 0.6rem 1rem;
|
|
133
|
-
background: var(--color-bg);
|
|
134
|
-
margin: 1rem;
|
|
135
|
-
border: 2px solid var(--color-bg-3);
|
|
136
|
-
border-radius: var(--radius-pill);
|
|
137
|
-
font-size: var(--step--1);
|
|
138
|
-
border: 1px solid;
|
|
139
|
-
cursor: pointer;
|
|
140
|
-
border-color: var(--neutral-300);
|
|
141
|
-
color: var(--neutral-800);
|
|
142
|
-
border-width: 0.5px;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.pulsing {
|
|
146
|
-
display: block;
|
|
147
|
-
width: 1rem;
|
|
148
|
-
height: 1rem;
|
|
149
|
-
clip-path: circle(40%);
|
|
150
|
-
background: var(--blue-700);
|
|
151
|
-
animation: pulsing 2.5s infinite ease-in-out;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@keyframes pulsing {
|
|
155
|
-
0%,
|
|
156
|
-
100% {
|
|
157
|
-
transform: scale(0.9);
|
|
158
|
-
}
|
|
159
|
-
50% {
|
|
160
|
-
transform: scale(1.05);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { useState, useRef, useEffect } from 'preact/hooks';
|
|
2
|
-
import { marked } from 'marked';
|
|
3
|
-
import { KapaProvider, useChat } from '@kapaai/react-sdk';
|
|
4
|
-
|
|
5
|
-
import './AskNetlify.css';
|
|
6
|
-
|
|
7
|
-
function AskNetlify(props) {
|
|
8
|
-
return (
|
|
9
|
-
<KapaProvider
|
|
10
|
-
integrationId="3c0789a6-c6a8-4fbc-b0cc-235f9e4a6351"
|
|
11
|
-
callbacks={{
|
|
12
|
-
askAI: {
|
|
13
|
-
onQuerySubmit: data => console.log('Question asked:', data.question),
|
|
14
|
-
},
|
|
15
|
-
}}
|
|
16
|
-
>
|
|
17
|
-
<ChatInterface {...props} />
|
|
18
|
-
</KapaProvider>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function ChatInterface({ setModalState }) {
|
|
23
|
-
const [message, setMessage] = useState('');
|
|
24
|
-
const { conversation, submitQuery, isGeneratingAnswer, isPreparingAnswer, stopGeneration } =
|
|
25
|
-
useChat();
|
|
26
|
-
|
|
27
|
-
const chatRef = useRef(null);
|
|
28
|
-
|
|
29
|
-
const handleSubmit = e => {
|
|
30
|
-
e.preventDefault();
|
|
31
|
-
if (message.trim()) {
|
|
32
|
-
submitQuery(message);
|
|
33
|
-
setMessage('');
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const el = chatRef.current as HTMLElement | null;
|
|
39
|
-
if (el) el.scrollTop = el.scrollHeight;
|
|
40
|
-
}, [conversation]);
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div className="chat-container">
|
|
44
|
-
<button
|
|
45
|
-
class="button button-back"
|
|
46
|
-
data-button-variant="outline"
|
|
47
|
-
onClick={() => setModalState({ current: 'search' })}
|
|
48
|
-
aria-label={'Return to search'}
|
|
49
|
-
>
|
|
50
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
|
|
51
|
-
<path d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z" />
|
|
52
|
-
</svg>
|
|
53
|
-
Search
|
|
54
|
-
</button>
|
|
55
|
-
<div ref={chatRef} className="conversation n-search-window">
|
|
56
|
-
{conversation.map((qa, index) => (
|
|
57
|
-
<div key={qa.id || `qa-${index}`} className="message">
|
|
58
|
-
<div className="message-right">
|
|
59
|
-
<div className="message-bubble user-message">
|
|
60
|
-
<p>{qa.question}</p>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div className="message-left">
|
|
65
|
-
{qa.answer ? (
|
|
66
|
-
<div className="message-bubble bot-message">
|
|
67
|
-
<div
|
|
68
|
-
className="message-answer prose flow"
|
|
69
|
-
dangerouslySetInnerHTML={{
|
|
70
|
-
__html: marked.parse(qa.answer),
|
|
71
|
-
}}
|
|
72
|
-
/>
|
|
73
|
-
</div>
|
|
74
|
-
) : (
|
|
75
|
-
<span class="pulsing"></span>
|
|
76
|
-
)}
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
))}
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<form onSubmit={handleSubmit} className="form-wrapper n-search-input-wrapper">
|
|
83
|
-
<input
|
|
84
|
-
type="text"
|
|
85
|
-
className="form-input n-search-input"
|
|
86
|
-
value={message}
|
|
87
|
-
onChange={e => setMessage(e.target.value)}
|
|
88
|
-
placeholder="Ask a question..."
|
|
89
|
-
disabled={isGeneratingAnswer}
|
|
90
|
-
/>
|
|
91
|
-
{/* <button type="submit" className="form-submit" disabled={isGeneratingAnswer}>
|
|
92
|
-
Send
|
|
93
|
-
</button> */}
|
|
94
|
-
|
|
95
|
-
{isGeneratingAnswer ? (
|
|
96
|
-
<button
|
|
97
|
-
type="button"
|
|
98
|
-
className="form-submit"
|
|
99
|
-
onClick={stopGeneration}
|
|
100
|
-
aria-label="Stop generation"
|
|
101
|
-
>
|
|
102
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor">
|
|
103
|
-
<rect x="0" y="0" width="16" height="16" />
|
|
104
|
-
</svg>
|
|
105
|
-
</button>
|
|
106
|
-
) : (
|
|
107
|
-
<button
|
|
108
|
-
type="submit"
|
|
109
|
-
className="form-submit"
|
|
110
|
-
disabled={!message.trim() || isPreparingAnswer}
|
|
111
|
-
aria-label="Send message"
|
|
112
|
-
>
|
|
113
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor">
|
|
114
|
-
<path d="M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z" />
|
|
115
|
-
</svg>
|
|
116
|
-
</button>
|
|
117
|
-
)}
|
|
118
|
-
</form>
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export default AskNetlify;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
@property --angle {
|
|
2
|
-
syntax: '<angle>';
|
|
3
|
-
inherits: false;
|
|
4
|
-
initial-value: 0deg;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
:root {
|
|
8
|
-
--bg: oklch(12.9% 0.042 264.695);
|
|
9
|
-
--c1: oklch(44.4% 0.177 26.899);
|
|
10
|
-
--c2: oklch(85.2% 0.199 91.936);
|
|
11
|
-
--c3: oklch(58.8% 0.158 241.966);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.orb {
|
|
15
|
-
display: grid;
|
|
16
|
-
grid-template-areas: 'stack';
|
|
17
|
-
inline-size: min(80vmin, 100%);
|
|
18
|
-
aspect-ratio: 1;
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
border-radius: 50%;
|
|
21
|
-
|
|
22
|
-
&::before,
|
|
23
|
-
&::after {
|
|
24
|
-
content: '';
|
|
25
|
-
display: block;
|
|
26
|
-
grid-area: stack;
|
|
27
|
-
width: 100%;
|
|
28
|
-
height: 100%;
|
|
29
|
-
border-radius: 50%;
|
|
30
|
-
transform: translateZ(0);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&::before {
|
|
34
|
-
background:
|
|
35
|
-
conic-gradient(
|
|
36
|
-
from calc(var(--angle) * 2) at 25% 70%,
|
|
37
|
-
var(--c3),
|
|
38
|
-
transparent 20% 80%,
|
|
39
|
-
var(--c3)
|
|
40
|
-
),
|
|
41
|
-
conic-gradient(
|
|
42
|
-
from calc(var(--angle) * 2) at 45% 75%,
|
|
43
|
-
var(--c2),
|
|
44
|
-
transparent 30% 60%,
|
|
45
|
-
var(--c2)
|
|
46
|
-
),
|
|
47
|
-
conic-gradient(
|
|
48
|
-
from calc(var(--angle) * -3) at 80% 20%,
|
|
49
|
-
var(--c1),
|
|
50
|
-
transparent 40% 60%,
|
|
51
|
-
var(--c1)
|
|
52
|
-
),
|
|
53
|
-
conic-gradient(
|
|
54
|
-
from calc(var(--angle) * 2) at 15% 5%,
|
|
55
|
-
var(--c2),
|
|
56
|
-
transparent 10% 90%,
|
|
57
|
-
var(--c2)
|
|
58
|
-
),
|
|
59
|
-
conic-gradient(
|
|
60
|
-
from calc(var(--angle) * 1) at 20% 80%,
|
|
61
|
-
var(--c1),
|
|
62
|
-
transparent 10% 90%,
|
|
63
|
-
var(--c1)
|
|
64
|
-
),
|
|
65
|
-
conic-gradient(
|
|
66
|
-
from calc(var(--angle) * -2) at 85% 10%,
|
|
67
|
-
var(--c3),
|
|
68
|
-
transparent 20% 80%,
|
|
69
|
-
var(--c3)
|
|
70
|
-
);
|
|
71
|
-
box-shadow: inset var(--bg) 0 0 5vmin 1vmin;
|
|
72
|
-
filter: blur(3vmin) contrast(5);
|
|
73
|
-
animation: rotate 20s linear infinite;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&::after {
|
|
77
|
-
--dot: 1.5px;
|
|
78
|
-
background-image: radial-gradient(
|
|
79
|
-
circle at center,
|
|
80
|
-
var(--bg) var(--dot),
|
|
81
|
-
transparent var(--dot)
|
|
82
|
-
);
|
|
83
|
-
background-size: calc(var(--dot) * 2) calc(var(--dot) * 2);
|
|
84
|
-
mask-image: radial-gradient(black 25%, transparent 75%);
|
|
85
|
-
backdrop-filter: blur(8vmin) contrast(10);
|
|
86
|
-
mix-blend-mode: overlay;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@keyframes rotate {
|
|
91
|
-
to {
|
|
92
|
-
--angle: 360deg;
|
|
93
|
-
}
|
|
94
|
-
}
|