@noodleseed/assistant 1.9.0 → 1.11.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/README.md +90 -9
- package/dist/{chunk-RYQBXTLR.js → chunk-KRB2SXFD.js} +6 -1
- package/dist/{chunk-RYQBXTLR.js.map → chunk-KRB2SXFD.js.map} +1 -1
- package/dist/{chunk-4B3XXGRP.js → chunk-ZPELSHUP.js} +25 -8
- package/dist/chunk-ZPELSHUP.js.map +1 -0
- package/dist/{client-CsmtpD1z.d.cts → client-BKIeuSVS.d.cts} +7 -2
- package/dist/{client-B803xZVn.d.ts → client-BccAX_om.d.ts} +7 -2
- package/dist/client.cjs +5 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/index.cjs +27 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/react/client.cjs +5 -0
- package/dist/react/client.cjs.map +1 -1
- package/dist/react/client.d.cts +1 -1
- package/dist/react/client.d.ts +1 -1
- package/dist/react/client.js +1 -1
- package/dist/react.cjs +33 -6
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +10 -3
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4B3XXGRP.js.map +0 -1
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
AssistantClientError,
|
|
3
3
|
copyAssistantModelContext,
|
|
4
4
|
createAssistantClient
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KRB2SXFD.js";
|
|
6
6
|
import {
|
|
7
7
|
_enum,
|
|
8
8
|
_null,
|
|
@@ -3106,6 +3106,7 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
3106
3106
|
let mountedTransport;
|
|
3107
3107
|
let destroyed = false;
|
|
3108
3108
|
let initialized = false;
|
|
3109
|
+
let hostContext = createAssistantAppHostContext(actions.theme);
|
|
3109
3110
|
let destroyPromise;
|
|
3110
3111
|
const renderTimer = setTimeout(() => {
|
|
3111
3112
|
if (initialized || !frame.isConnected) return;
|
|
@@ -3132,7 +3133,7 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
3132
3133
|
message: { text: {} }
|
|
3133
3134
|
},
|
|
3134
3135
|
{
|
|
3135
|
-
hostContext
|
|
3136
|
+
hostContext
|
|
3136
3137
|
}
|
|
3137
3138
|
);
|
|
3138
3139
|
mountedBridge = bridge;
|
|
@@ -3207,6 +3208,7 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
3207
3208
|
if (destroyed) return;
|
|
3208
3209
|
initialized = true;
|
|
3209
3210
|
clearTimeout(renderTimer);
|
|
3211
|
+
bridge.setHostContext(hostContext);
|
|
3210
3212
|
const current = options.getDetail?.() ?? detail;
|
|
3211
3213
|
void bridge.sendToolInput({ arguments: current.arguments ?? {} });
|
|
3212
3214
|
void bridge.sendToolResult({
|
|
@@ -3222,6 +3224,11 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
3222
3224
|
},
|
|
3223
3225
|
{ once: true }
|
|
3224
3226
|
);
|
|
3227
|
+
const updateTheme = (theme) => {
|
|
3228
|
+
if (destroyed) return;
|
|
3229
|
+
hostContext = createAssistantAppHostContext(theme);
|
|
3230
|
+
if (initialized) mountedBridge?.setHostContext(hostContext);
|
|
3231
|
+
};
|
|
3225
3232
|
const destroy = () => {
|
|
3226
3233
|
if (destroyPromise) return destroyPromise;
|
|
3227
3234
|
destroyed = true;
|
|
@@ -3240,9 +3247,12 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
3240
3247
|
})();
|
|
3241
3248
|
return destroyPromise;
|
|
3242
3249
|
};
|
|
3243
|
-
mountedApps.set(card, { destroy });
|
|
3250
|
+
mountedApps.set(card, { destroy, updateTheme });
|
|
3244
3251
|
return card;
|
|
3245
3252
|
}
|
|
3253
|
+
function updateAssistantAppTheme(card, theme) {
|
|
3254
|
+
mountedApps.get(card)?.updateTheme(theme);
|
|
3255
|
+
}
|
|
3246
3256
|
function unmountAssistantApp(card) {
|
|
3247
3257
|
return mountedApps.get(card)?.destroy() ?? Promise.resolve();
|
|
3248
3258
|
}
|
|
@@ -7168,7 +7178,7 @@ function contrastWarnings(theme, mode) {
|
|
|
7168
7178
|
for (const [role, foreground, background] of pairs) {
|
|
7169
7179
|
if (!foreground || !background) continue;
|
|
7170
7180
|
const ratio = contrastRatio2(foreground, background);
|
|
7171
|
-
if (ratio >= 4.5) continue;
|
|
7181
|
+
if (ratio === void 0 || ratio >= 4.5) continue;
|
|
7172
7182
|
warnings.push({
|
|
7173
7183
|
code: "low_contrast",
|
|
7174
7184
|
theme: mode,
|
|
@@ -7182,13 +7192,16 @@ function contrastWarnings(theme, mode) {
|
|
|
7182
7192
|
return warnings;
|
|
7183
7193
|
}
|
|
7184
7194
|
function contrastRatio2(first, second) {
|
|
7185
|
-
const
|
|
7186
|
-
const
|
|
7195
|
+
const firstLuminance = luminance(first);
|
|
7196
|
+
const secondLuminance = luminance(second);
|
|
7197
|
+
if (firstLuminance === void 0 || secondLuminance === void 0) return void 0;
|
|
7198
|
+
const lighter = Math.max(firstLuminance, secondLuminance);
|
|
7199
|
+
const darker = Math.min(firstLuminance, secondLuminance);
|
|
7187
7200
|
return (lighter + 0.05) / (darker + 0.05);
|
|
7188
7201
|
}
|
|
7189
7202
|
function luminance(color) {
|
|
7190
7203
|
const match = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(color);
|
|
7191
|
-
if (!match) return
|
|
7204
|
+
if (!match) return void 0;
|
|
7192
7205
|
const values = match.slice(1).map((value) => {
|
|
7193
7206
|
const channel = Number.parseInt(value, 16) / 255;
|
|
7194
7207
|
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
@@ -8021,6 +8034,9 @@ var NoodleAssistantElement = class extends HTMLElementBase {
|
|
|
8021
8034
|
})
|
|
8022
8035
|
);
|
|
8023
8036
|
}
|
|
8037
|
+
for (const app of this.shadowRoot?.querySelectorAll(".noodle-app-card") ?? []) {
|
|
8038
|
+
updateAssistantAppTheme(app, mode);
|
|
8039
|
+
}
|
|
8024
8040
|
}
|
|
8025
8041
|
#setSessionState(state) {
|
|
8026
8042
|
this.#sessionState = state;
|
|
@@ -8196,6 +8212,7 @@ function registerNoodleAssistant() {
|
|
|
8196
8212
|
|
|
8197
8213
|
export {
|
|
8198
8214
|
mountAssistantApp,
|
|
8215
|
+
updateAssistantAppTheme,
|
|
8199
8216
|
unmountAssistantApp,
|
|
8200
8217
|
ASSISTANT_TAG_NAME,
|
|
8201
8218
|
NoodleAssistantElement,
|
|
@@ -8206,4 +8223,4 @@ export {
|
|
|
8206
8223
|
dompurify/dist/purify.es.mjs:
|
|
8207
8224
|
(*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE *)
|
|
8208
8225
|
*/
|
|
8209
|
-
//# sourceMappingURL=chunk-
|
|
8226
|
+
//# sourceMappingURL=chunk-ZPELSHUP.js.map
|