@netlify/spark-ui 1.14.1 → 1.14.3

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.
@@ -1,6 +1,6 @@
1
1
  import "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import "../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { A as d } from "../../../chunks/AskNetlify.WwftmboN.js";
3
+ import { A as d } from "../../../chunks/AskNetlify.34ZT77N0.js";
4
4
  import "./components/QuestionList/questions.js";
5
5
  import "./components/QuestionList/QuestionList.js";
6
6
  import "./components/BackButton.js";
@@ -1,6 +1,6 @@
1
1
  import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import { A as g, y as f, d } from "../../../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { A as K, K as L } from "../../../../../chunks/AskNetlify.WwftmboN.js";
3
+ import { A as K, K as L } from "../../../../../chunks/AskNetlify.34ZT77N0.js";
4
4
  import P from "../../../Modal/Modal.js";
5
5
  import h from "../../../KeyboardKey/KeyboardKey.js";
6
6
  import M from "../SearchWindow.js";
@@ -4,7 +4,7 @@ import { default as m } from "./Icon/index.js";
4
4
  import { default as s } from "./SearchModal/components/SearchLink/SearchLink.js";
5
5
  import { default as u } from "./SearchModal/components/SearchHeading/SearchHeading.js";
6
6
  import { default as i } from "./SearchModal/components/SearchToggle/SearchToggle.js";
7
- import { A as S } from "../../chunks/AskNetlify.WwftmboN.js";
7
+ import { A as S } from "../../chunks/AskNetlify.34ZT77N0.js";
8
8
  import "preact";
9
9
  import "../../chunks/hooks.module.DGkdD5n9.js";
10
10
  import { default as n } from "./SearchModal/components/SearchModal/SearchModal.js";
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.14.1",
4
+ "version": "1.14.3",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -259,16 +259,17 @@ button.n-ask-button-back [data-icon='caretRight'] {
259
259
 
260
260
  .n-ask-prose pre {
261
261
  max-width: 100%;
262
- padding: var(--space-s);
263
- background: var(--neutral-light-700);
262
+ background: var(--neutral-light-700, var(--neutral-700));
264
263
  border-radius: var(--radius-m);
265
264
  box-sizing: border-box;
266
265
  color: var(--neutral-100);
266
+ color-scheme: dark;
267
267
  overflow-x: auto;
268
268
  }
269
269
 
270
270
  .n-ask-prose code {
271
271
  overflow-x: auto;
272
+ padding: var(--space-s);
272
273
  }
273
274
 
274
275
  .n-ask-prose code[class*='language-'],
@@ -51,6 +51,16 @@ export default function AskNetlify({ setModalState, searchQuery, urlParamQuery }
51
51
  }
52
52
  }, [newMessageReady]);
53
53
 
54
+ const [urlParamHandled, setUrlParamHandled] = useState(false);
55
+
56
+ useEffect(() => {
57
+ if (urlParamQuery && !urlParamHandled) {
58
+ const trimmedQuery = urlParamQuery.trim();
59
+ setMessage(trimmedQuery);
60
+ setUrlParamHandled(true); // prevent refilling after submission
61
+ }
62
+ }, [urlParamQuery, urlParamHandled]);
63
+
54
64
  /**
55
65
  * Populates and handles the input when a query is present.
56
66
  *
@@ -60,19 +70,16 @@ export default function AskNetlify({ setModalState, searchQuery, urlParamQuery }
60
70
  * Focuses the input and marks the message as ready in both cases.
61
71
  */
62
72
  useEffect(() => {
63
- const trimmedQuery = (urlParamQuery ?? searchQuery ?? '').trim();
73
+ if (!searchQuery) return;
64
74
 
65
- if (urlParamQuery) {
66
- setMessage(trimmedQuery);
67
- }
75
+ const trimmedQuery = searchQuery.trim();
68
76
 
69
77
  if (searchQuery) {
70
78
  submitQuery(trimmedQuery);
79
+ inputRef?.current?.focus();
80
+ setNewMessageReady(true);
71
81
  }
72
-
73
- inputRef?.current?.focus();
74
- setNewMessageReady(true);
75
- }, [setMessage, setNewMessageReady, submitQuery, setMessage, urlParamQuery, searchQuery]);
82
+ }, [setMessage, setNewMessageReady, submitQuery, searchQuery]);
76
83
 
77
84
  return (
78
85
  <div className="n-ask-chat-container">