@icos-react/largemodel 1.0.24 → 1.0.25
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/index.js +34 -7
- package/dist/index.mjs +34 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8280,8 +8280,14 @@ var ChatButton = (0, import_react25.forwardRef)(
|
|
|
8280
8280
|
const [viewportWidth, setViewportWidth] = (0, import_react25.useState)(
|
|
8281
8281
|
typeof window !== "undefined" ? window.innerWidth : 0
|
|
8282
8282
|
);
|
|
8283
|
+
const [viewportHeight, setViewportHeight] = (0, import_react25.useState)(
|
|
8284
|
+
typeof window !== "undefined" ? window.innerHeight : 0
|
|
8285
|
+
);
|
|
8283
8286
|
(0, import_react25.useLayoutEffect)(() => {
|
|
8284
|
-
const update = () =>
|
|
8287
|
+
const update = () => {
|
|
8288
|
+
setViewportWidth(window.innerWidth);
|
|
8289
|
+
setViewportHeight(window.innerHeight);
|
|
8290
|
+
};
|
|
8285
8291
|
update();
|
|
8286
8292
|
window.addEventListener("resize", update);
|
|
8287
8293
|
return () => window.removeEventListener("resize", update);
|
|
@@ -8885,7 +8891,32 @@ var ChatButton = (0, import_react25.forwardRef)(
|
|
|
8885
8891
|
document.removeEventListener("mouseup", handleGlobalMouseUp);
|
|
8886
8892
|
};
|
|
8887
8893
|
}, [handleGlobalMouseMove, handleGlobalMouseUp]);
|
|
8888
|
-
const
|
|
8894
|
+
const resolveLengthToPx = (v, axis, fallback) => {
|
|
8895
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
8896
|
+
return v;
|
|
8897
|
+
if (typeof v !== "string")
|
|
8898
|
+
return fallback;
|
|
8899
|
+
const s = v.trim();
|
|
8900
|
+
const n = parseFloat(s);
|
|
8901
|
+
if (!Number.isFinite(n))
|
|
8902
|
+
return fallback;
|
|
8903
|
+
if (s.endsWith("vw"))
|
|
8904
|
+
return n / 100 * (viewportWidth || 0);
|
|
8905
|
+
if (s.endsWith("vh"))
|
|
8906
|
+
return n / 100 * (viewportHeight || 0);
|
|
8907
|
+
if (s.endsWith("%")) {
|
|
8908
|
+
const base = axis === "w" ? viewportWidth : viewportHeight;
|
|
8909
|
+
return n / 100 * (base || 0);
|
|
8910
|
+
}
|
|
8911
|
+
if (s.endsWith("px"))
|
|
8912
|
+
return n;
|
|
8913
|
+
return n;
|
|
8914
|
+
};
|
|
8915
|
+
const chatWidthNumForLayout = resolveLengthToPx(
|
|
8916
|
+
chatWidth,
|
|
8917
|
+
"w",
|
|
8918
|
+
CHAT_WINDOW.DEFAULT_WIDTH
|
|
8919
|
+
);
|
|
8889
8920
|
const parseHorizontalEdgePx = (v) => {
|
|
8890
8921
|
if (v === void 0)
|
|
8891
8922
|
return void 0;
|
|
@@ -8930,11 +8961,7 @@ var ChatButton = (0, import_react25.forwardRef)(
|
|
|
8930
8961
|
isolation: "isolate",
|
|
8931
8962
|
zIndex: 1
|
|
8932
8963
|
};
|
|
8933
|
-
|
|
8934
|
-
base.height = getChatHeight();
|
|
8935
|
-
} else {
|
|
8936
|
-
base.height = CHAT_WINDOW.HUMAN_TOGGLE_HEIGHT;
|
|
8937
|
-
}
|
|
8964
|
+
base.height = getChatHeight();
|
|
8938
8965
|
if (clampedRightPx !== void 0) {
|
|
8939
8966
|
base.right = clampedRightPx + chatW + gap;
|
|
8940
8967
|
} else if (windowPosition.right !== void 0) {
|
package/dist/index.mjs
CHANGED
|
@@ -8246,8 +8246,14 @@ var ChatButton = forwardRef8(
|
|
|
8246
8246
|
const [viewportWidth, setViewportWidth] = useState13(
|
|
8247
8247
|
typeof window !== "undefined" ? window.innerWidth : 0
|
|
8248
8248
|
);
|
|
8249
|
+
const [viewportHeight, setViewportHeight] = useState13(
|
|
8250
|
+
typeof window !== "undefined" ? window.innerHeight : 0
|
|
8251
|
+
);
|
|
8249
8252
|
useLayoutEffect(() => {
|
|
8250
|
-
const update = () =>
|
|
8253
|
+
const update = () => {
|
|
8254
|
+
setViewportWidth(window.innerWidth);
|
|
8255
|
+
setViewportHeight(window.innerHeight);
|
|
8256
|
+
};
|
|
8251
8257
|
update();
|
|
8252
8258
|
window.addEventListener("resize", update);
|
|
8253
8259
|
return () => window.removeEventListener("resize", update);
|
|
@@ -8851,7 +8857,32 @@ var ChatButton = forwardRef8(
|
|
|
8851
8857
|
document.removeEventListener("mouseup", handleGlobalMouseUp);
|
|
8852
8858
|
};
|
|
8853
8859
|
}, [handleGlobalMouseMove, handleGlobalMouseUp]);
|
|
8854
|
-
const
|
|
8860
|
+
const resolveLengthToPx = (v, axis, fallback) => {
|
|
8861
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
8862
|
+
return v;
|
|
8863
|
+
if (typeof v !== "string")
|
|
8864
|
+
return fallback;
|
|
8865
|
+
const s = v.trim();
|
|
8866
|
+
const n = parseFloat(s);
|
|
8867
|
+
if (!Number.isFinite(n))
|
|
8868
|
+
return fallback;
|
|
8869
|
+
if (s.endsWith("vw"))
|
|
8870
|
+
return n / 100 * (viewportWidth || 0);
|
|
8871
|
+
if (s.endsWith("vh"))
|
|
8872
|
+
return n / 100 * (viewportHeight || 0);
|
|
8873
|
+
if (s.endsWith("%")) {
|
|
8874
|
+
const base = axis === "w" ? viewportWidth : viewportHeight;
|
|
8875
|
+
return n / 100 * (base || 0);
|
|
8876
|
+
}
|
|
8877
|
+
if (s.endsWith("px"))
|
|
8878
|
+
return n;
|
|
8879
|
+
return n;
|
|
8880
|
+
};
|
|
8881
|
+
const chatWidthNumForLayout = resolveLengthToPx(
|
|
8882
|
+
chatWidth,
|
|
8883
|
+
"w",
|
|
8884
|
+
CHAT_WINDOW.DEFAULT_WIDTH
|
|
8885
|
+
);
|
|
8855
8886
|
const parseHorizontalEdgePx = (v) => {
|
|
8856
8887
|
if (v === void 0)
|
|
8857
8888
|
return void 0;
|
|
@@ -8896,11 +8927,7 @@ var ChatButton = forwardRef8(
|
|
|
8896
8927
|
isolation: "isolate",
|
|
8897
8928
|
zIndex: 1
|
|
8898
8929
|
};
|
|
8899
|
-
|
|
8900
|
-
base.height = getChatHeight();
|
|
8901
|
-
} else {
|
|
8902
|
-
base.height = CHAT_WINDOW.HUMAN_TOGGLE_HEIGHT;
|
|
8903
|
-
}
|
|
8930
|
+
base.height = getChatHeight();
|
|
8904
8931
|
if (clampedRightPx !== void 0) {
|
|
8905
8932
|
base.right = clampedRightPx + chatW + gap;
|
|
8906
8933
|
} else if (windowPosition.right !== void 0) {
|