@netlify/spark-ui 1.0.3-alpha.0 → 1.1.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.
Files changed (47) hide show
  1. package/dist/assets/SearchLink.css +1 -1
  2. package/dist/assets/SearchModal.css +1 -1
  3. package/dist/chunks/compat.module.DT16W4Wr.js +175 -0
  4. package/dist/chunks/hooks.module.CNV9mxng.js +138 -0
  5. package/dist/chunks/{useTimeout.DYuvQwFN.js → useTimeout.DOkYFG64.js} +1 -1
  6. package/dist/components/index.d.ts +0 -1
  7. package/dist/components/preact/Modal/Modal.js +1 -1
  8. package/dist/components/preact/SearchModal/components/SearchInput.d.ts +0 -2
  9. package/dist/components/preact/SearchModal/components/SearchInput.js +2 -2
  10. package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.js +1 -1
  11. package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +51 -81
  12. package/dist/components/preact/SearchModal/components/SearchToggle/SearchToggle.js +1 -1
  13. package/dist/components/preact/SearchModal/components/SearchWindow.d.ts +1 -1
  14. package/dist/components/preact/SearchModal/components/SearchWindow.js +34 -39
  15. package/dist/components/preact/SearchModal/hooks/useKeyboardNav.js +6 -6
  16. package/dist/components/preact/SearchModal/hooks/useSearch.js +2 -2
  17. package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.js +1 -1
  18. package/dist/components/preact/SearchModal/hooks/useSearchLogger.js +1 -1
  19. package/dist/components/preact/SearchModal/hooks/useSearchParams.js +1 -1
  20. package/dist/components/preact/SearchModal/hooks/useSearchToggles.js +1 -1
  21. package/dist/components/preact/SearchModal/types/search.types.d.ts +0 -3
  22. package/dist/components/preact/index.d.ts +0 -1
  23. package/dist/components/preact/index.js +5 -7
  24. package/package.json +2 -4
  25. package/packages/components/Blockquote.astro +103 -0
  26. package/packages/components/index.ts +0 -1
  27. package/packages/components/preact/SearchModal/components/SearchInput.tsx +7 -9
  28. package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.css +1 -6
  29. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.css +11 -67
  30. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +30 -67
  31. package/packages/components/preact/SearchModal/components/SearchWindow.tsx +16 -27
  32. package/packages/components/preact/SearchModal/hooks/useKeyboardNav.ts +2 -2
  33. package/packages/components/preact/SearchModal/types/search.types.tsx +1 -2
  34. package/packages/components/preact/index.ts +0 -1
  35. package/packages/styles/tokens.css +4 -4
  36. package/dist/assets/AskNetlify.css +0 -1
  37. package/dist/assets/Orb.css +0 -1
  38. package/dist/chunks/compat.module.BjTzMHXJ.js +0 -296
  39. package/dist/chunks/hooks.module.DeYLzLnU.js +0 -177
  40. package/dist/components/preact/AskNetlify/AskNetlify.d.ts +0 -2
  41. package/dist/components/preact/AskNetlify/AskNetlify.js +0 -5288
  42. package/dist/components/preact/Orb/Orb.d.ts +0 -2
  43. package/dist/components/preact/Orb/Orb.js +0 -5
  44. package/packages/components/preact/AskNetlify/AskNetlify.css +0 -161
  45. package/packages/components/preact/AskNetlify/AskNetlify.tsx +0 -119
  46. package/packages/components/preact/Orb/Orb.css +0 -94
  47. package/packages/components/preact/Orb/Orb.tsx +0 -7
@@ -1,2 +0,0 @@
1
- declare const Orb: () => import("preact").JSX.Element;
2
- export default Orb;
@@ -1,5 +0,0 @@
1
- import { u as r } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import '../../../assets/Orb.css';const t = () => /* @__PURE__ */ r("div", { class: "orb" });
3
- export {
4
- t as default
5
- };
@@ -1,161 +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.5rem 1rem;
133
- background: var(--color-bg);
134
- margin: 1rem;
135
- border-radius: 7rem;
136
- border: 2px solid var(--color-bg-3);
137
- border-radius: var(--radius-pill);
138
- font-size: var(--step--2);
139
- border: 1px solid;
140
- cursor: pointer;
141
- color: var(--color-text);
142
- }
143
-
144
- .pulsing {
145
- display: block;
146
- width: 1rem;
147
- height: 1rem;
148
- clip-path: circle(40%);
149
- background: var(--blue-700);
150
- animation: pulsing 2.5s infinite ease-in-out;
151
- }
152
-
153
- @keyframes pulsing {
154
- 0%,
155
- 100% {
156
- transform: scale(0.9);
157
- }
158
- 50% {
159
- transform: scale(1.05);
160
- }
161
- }
@@ -1,119 +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
- >
49
- Return to Search
50
- </button>
51
- <div ref={chatRef} className="conversation n-search-window">
52
- {conversation.map((qa, index) => (
53
- <div key={qa.id || `qa-${index}`} className="message">
54
- <div className="message-right">
55
- <div className="message-bubble user-message">
56
- <p>{qa.question}</p>
57
- </div>
58
- </div>
59
-
60
- <div className="message-left">
61
- {qa.answer ? (
62
- <div className="message-bubble bot-message">
63
- <div
64
- className="message-answer prose flow"
65
- dangerouslySetInnerHTML={{
66
- __html: marked.parse(qa.answer),
67
- }}
68
- />
69
- </div>
70
- ) : (
71
- <span class="pulsing"></span>
72
- )}
73
- </div>
74
- </div>
75
- ))}
76
- </div>
77
-
78
- <form onSubmit={handleSubmit} className="form-wrapper n-search-input-wrapper">
79
- <input
80
- type="text"
81
- className="form-input n-search-input"
82
- value={message}
83
- onChange={e => setMessage(e.target.value)}
84
- placeholder="Ask a question..."
85
- disabled={isGeneratingAnswer}
86
- />
87
- {/* <button type="submit" className="form-submit" disabled={isGeneratingAnswer}>
88
- Send
89
- </button> */}
90
-
91
- {isGeneratingAnswer ? (
92
- <button
93
- type="button"
94
- className="form-submit"
95
- onClick={stopGeneration}
96
- aria-label="Stop generation"
97
- >
98
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor">
99
- <rect x="0" y="0" width="16" height="16" />
100
- </svg>
101
- </button>
102
- ) : (
103
- <button
104
- type="submit"
105
- className="form-submit"
106
- disabled={!message.trim() || isPreparingAnswer}
107
- aria-label="Send message"
108
- >
109
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor">
110
- <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" />
111
- </svg>
112
- </button>
113
- )}
114
- </form>
115
- </div>
116
- );
117
- }
118
-
119
- 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
- }
@@ -1,7 +0,0 @@
1
- import './Orb.css';
2
-
3
- const Orb = () => {
4
- return <div class="orb"></div>;
5
- };
6
-
7
- export default Orb;