@noodleseed/assistant 1.9.0 → 1.10.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 +52 -9
- package/dist/{chunk-4B3XXGRP.js → chunk-RSNMY27B.js} +24 -7
- package/dist/chunk-RSNMY27B.js.map +1 -0
- package/dist/index.cjs +22 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +28 -6
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +9 -2
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4B3XXGRP.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -22155,6 +22155,7 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
22155
22155
|
let mountedTransport;
|
|
22156
22156
|
let destroyed = false;
|
|
22157
22157
|
let initialized = false;
|
|
22158
|
+
let hostContext = createAssistantAppHostContext(actions.theme);
|
|
22158
22159
|
let destroyPromise;
|
|
22159
22160
|
const renderTimer = setTimeout(() => {
|
|
22160
22161
|
if (initialized || !frame.isConnected) return;
|
|
@@ -22181,7 +22182,7 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
22181
22182
|
message: { text: {} }
|
|
22182
22183
|
},
|
|
22183
22184
|
{
|
|
22184
|
-
hostContext
|
|
22185
|
+
hostContext
|
|
22185
22186
|
}
|
|
22186
22187
|
);
|
|
22187
22188
|
mountedBridge = bridge;
|
|
@@ -22256,6 +22257,7 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
22256
22257
|
if (destroyed) return;
|
|
22257
22258
|
initialized = true;
|
|
22258
22259
|
clearTimeout(renderTimer);
|
|
22260
|
+
bridge.setHostContext(hostContext);
|
|
22259
22261
|
const current = options.getDetail?.() ?? detail;
|
|
22260
22262
|
void bridge.sendToolInput({ arguments: current.arguments ?? {} });
|
|
22261
22263
|
void bridge.sendToolResult({
|
|
@@ -22271,6 +22273,11 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
22271
22273
|
},
|
|
22272
22274
|
{ once: true }
|
|
22273
22275
|
);
|
|
22276
|
+
const updateTheme = (theme) => {
|
|
22277
|
+
if (destroyed) return;
|
|
22278
|
+
hostContext = createAssistantAppHostContext(theme);
|
|
22279
|
+
if (initialized) mountedBridge?.setHostContext(hostContext);
|
|
22280
|
+
};
|
|
22274
22281
|
const destroy = () => {
|
|
22275
22282
|
if (destroyPromise) return destroyPromise;
|
|
22276
22283
|
destroyed = true;
|
|
@@ -22289,9 +22296,12 @@ function mountAssistantApp(detail, actions, options = {}) {
|
|
|
22289
22296
|
})();
|
|
22290
22297
|
return destroyPromise;
|
|
22291
22298
|
};
|
|
22292
|
-
mountedApps.set(card, { destroy });
|
|
22299
|
+
mountedApps.set(card, { destroy, updateTheme });
|
|
22293
22300
|
return card;
|
|
22294
22301
|
}
|
|
22302
|
+
function updateAssistantAppTheme(card, theme) {
|
|
22303
|
+
mountedApps.get(card)?.updateTheme(theme);
|
|
22304
|
+
}
|
|
22295
22305
|
|
|
22296
22306
|
// src/appearance.ts
|
|
22297
22307
|
var common = {
|
|
@@ -31423,7 +31433,7 @@ function contrastWarnings(theme, mode) {
|
|
|
31423
31433
|
for (const [role, foreground, background] of pairs) {
|
|
31424
31434
|
if (!foreground || !background) continue;
|
|
31425
31435
|
const ratio = contrastRatio2(foreground, background);
|
|
31426
|
-
if (ratio >= 4.5) continue;
|
|
31436
|
+
if (ratio === void 0 || ratio >= 4.5) continue;
|
|
31427
31437
|
warnings.push({
|
|
31428
31438
|
code: "low_contrast",
|
|
31429
31439
|
theme: mode,
|
|
@@ -31437,13 +31447,16 @@ function contrastWarnings(theme, mode) {
|
|
|
31437
31447
|
return warnings;
|
|
31438
31448
|
}
|
|
31439
31449
|
function contrastRatio2(first, second) {
|
|
31440
|
-
const
|
|
31441
|
-
const
|
|
31450
|
+
const firstLuminance = luminance(first);
|
|
31451
|
+
const secondLuminance = luminance(second);
|
|
31452
|
+
if (firstLuminance === void 0 || secondLuminance === void 0) return void 0;
|
|
31453
|
+
const lighter = Math.max(firstLuminance, secondLuminance);
|
|
31454
|
+
const darker = Math.min(firstLuminance, secondLuminance);
|
|
31442
31455
|
return (lighter + 0.05) / (darker + 0.05);
|
|
31443
31456
|
}
|
|
31444
31457
|
function luminance(color) {
|
|
31445
31458
|
const match = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(color);
|
|
31446
|
-
if (!match) return
|
|
31459
|
+
if (!match) return void 0;
|
|
31447
31460
|
const values = match.slice(1).map((value) => {
|
|
31448
31461
|
const channel = Number.parseInt(value, 16) / 255;
|
|
31449
31462
|
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
@@ -32276,6 +32289,9 @@ var NoodleAssistantElement = class extends HTMLElementBase {
|
|
|
32276
32289
|
})
|
|
32277
32290
|
);
|
|
32278
32291
|
}
|
|
32292
|
+
for (const app of this.shadowRoot?.querySelectorAll(".noodle-app-card") ?? []) {
|
|
32293
|
+
updateAssistantAppTheme(app, mode);
|
|
32294
|
+
}
|
|
32279
32295
|
}
|
|
32280
32296
|
#setSessionState(state) {
|
|
32281
32297
|
this.#sessionState = state;
|