dsh-thinking-levels 3.4.5-beta.2 → 3.4.5-beta.4
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/CHANGELOG.ja.md +1 -1
- package/CHANGELOG.ko.md +1 -1
- package/CHANGELOG.md +1 -1
- package/dsh.plugin.json +1 -1
- package/lib/client.js +382 -109
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.ja.md
CHANGED
package/CHANGELOG.ko.md
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@ All notable changes to `dsh-thinking-levels` are documented here.
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
-
### Added — effort slider (whale-girl runner thumb) — 3.4.5-beta.
|
|
11
|
+
### Added — effort slider (whale-girl runner thumb) — 3.4.5-beta.4
|
|
12
12
|
|
|
13
13
|
- **The model panel's per-line effort `<select>` became a segment slider.** Click a line's
|
|
14
14
|
effort chip and a full-width slider expands under that line: the stop count adapts to the
|
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-thinking-levels",
|
|
3
|
-
"version": "3.4.5-beta.
|
|
3
|
+
"version": "3.4.5-beta.4",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"description": "thinking-level (reasoning_effort) control — auto-adjust per tool round, with optional manual lock and per-tool timing telemetry.",
|
|
6
6
|
"engines": {
|
package/lib/client.js
CHANGED
|
@@ -787,34 +787,44 @@ window.__ModuleLoader__.load({
|
|
|
787
787
|
* Segment slider for one model line's reasoning effort (the 改造 of the retired
|
|
788
788
|
* per-line `<select>`).
|
|
789
789
|
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
* reduced-motion freezes
|
|
795
|
-
*
|
|
790
|
+
* Interaction follows the approved dsh-reasoning-effort visual spec: the thumb
|
|
791
|
+
* follows the pointer CONTINUOUSLY and snaps to a stop on release (one
|
|
792
|
+
* `directory.select` per gesture), the plain thumb is pure white in every
|
|
793
|
+
* theme, the full thumb stays visible at both track endpoints, and
|
|
794
|
+
* reduced-motion freezes motion. Deviations requested for this plugin: the
|
|
795
|
+
* stop count adapts to the model's advertised efforts (not a fixed triple),
|
|
796
796
|
* `auto` is pinned leftmost (see `orderEffortsForSlider`), and the whale-girl
|
|
797
797
|
* runner thumb is per-line — DeepSeek lines run the 8-frame strip, every other
|
|
798
798
|
* model gets the plain knob.
|
|
799
799
|
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
804
|
-
* the
|
|
800
|
+
* The track carries the reference plugin's signature FX, ported from its
|
|
801
|
+
* published bundle: a procedural canvas "radiation" (three sine waves with a
|
|
802
|
+
* sharp crest, exponential trail decay from the thumb, a 4px pixel grid with
|
|
803
|
+
* grain, 14 particle streaks flying left, and a radial glow at the thumb — all
|
|
804
|
+
* clipped LEFT of the thumb, screen-blended over the track, pixelated), a CSS
|
|
805
|
+
* flare at the thumb, theme-split tracks via `body[data-ds-dark-theme]`, a
|
|
806
|
+
* light-theme progress fill, and a `[data-top]` breathe pulse. Dragging speeds
|
|
807
|
+
* and brightens everything. The canvas runs a rAF loop unless
|
|
808
|
+
* `prefers-reduced-motion` is set (then single frames on change).
|
|
809
|
+
*
|
|
810
|
+
* Inline styling only (no CSS modules in the client bundle) — everything a
|
|
811
|
+
* stylesheet needs (pseudo-elements, keyframes, theme selectors, blend modes)
|
|
812
|
+
* is injected once into `document.head` under a plugin-prefixed id. All math
|
|
813
|
+
* is defensive: a render throw here would abdicate the whole model-seat entry
|
|
814
|
+
* back to the shipped selector.
|
|
805
815
|
*/
|
|
806
816
|
/** Editor-row zone height: label row + track + headroom for the standing girl. */
|
|
807
|
-
const ZONE_H =
|
|
808
|
-
/** Track thickness; sits `TRACK_B` px above the zone bottom. */
|
|
817
|
+
const ZONE_H = 70;
|
|
818
|
+
/** Track thickness; sits `TRACK_B` px above the zone bottom (above the 14px label row). */
|
|
809
819
|
const TRACK_H = 16;
|
|
810
|
-
const TRACK_B =
|
|
820
|
+
const TRACK_B = 16;
|
|
811
821
|
/** Horizontal inset keeping the thumb fully visible at both endpoint stops. */
|
|
812
822
|
const PAD_MASCOT = 18;
|
|
813
823
|
const PAD_KNOB = 14;
|
|
814
824
|
/** Thumb metrics. */
|
|
815
825
|
const GIRL_W = WHALE_RUN_STRIP.frameW / 2;
|
|
816
826
|
const GIRL_H = WHALE_RUN_STRIP.frameH / 2;
|
|
817
|
-
const GIRL_B =
|
|
827
|
+
const GIRL_B = 21;
|
|
818
828
|
const KNOB = 28;
|
|
819
829
|
/** Label row height under the track. */
|
|
820
830
|
const LABEL_H = 14;
|
|
@@ -822,42 +832,252 @@ window.__ModuleLoader__.load({
|
|
|
822
832
|
const STRIP_CSS_W = WHALE_RUN_STRIP.frameW * WHALE_RUN_STRIP.frames / 2;
|
|
823
833
|
const STRIP_CSS_H = WHALE_RUN_STRIP.frameH / 2;
|
|
824
834
|
const KEYFRAMES_ID = "dsh-thinking-levels-effort-slider";
|
|
825
|
-
const ZONE_CLASS = "dsh-tl-
|
|
826
|
-
const RUN_CLASS = "dsh-tl-
|
|
835
|
+
const ZONE_CLASS = "dsh-tl-zone";
|
|
836
|
+
const RUN_CLASS = "dsh-tl-run";
|
|
837
|
+
const GIRL_CLASS = "dsh-tl-girl";
|
|
838
|
+
const KNOB_CLASS = "dsh-tl-knob";
|
|
839
|
+
const TRACK_CLASS = "dsh-tl-track";
|
|
840
|
+
const FILL_CLASS = "dsh-tl-fill";
|
|
841
|
+
const CANVAS_CLASS = "dsh-tl-canvas";
|
|
842
|
+
const FLARE_CLASS = "dsh-tl-flare";
|
|
827
843
|
const RUN_KEYFRAMES = "dsh-tl-whale-run-keyframes";
|
|
828
|
-
let styleInjected = false;
|
|
829
844
|
/**
|
|
830
|
-
*
|
|
831
|
-
*
|
|
832
|
-
* `
|
|
845
|
+
* The effect stylesheet: radiation track themes (dark violet gradient vs pale
|
|
846
|
+
* blue + progress fill), the screen-blended pixelated canvas, the flare with
|
|
847
|
+
* its cross streaks, dragging boosts, the `[data-top]` breathe pulses, the
|
|
848
|
+
* girl's run cycle with drop-shadow glow, and the reduced-motion freezes.
|
|
833
849
|
*/
|
|
834
|
-
|
|
835
|
-
if (styleInjected || document.getElementById(KEYFRAMES_ID) !== null) {
|
|
836
|
-
styleInjected = true;
|
|
837
|
-
return;
|
|
838
|
-
}
|
|
839
|
-
const style = document.createElement("style");
|
|
840
|
-
style.id = KEYFRAMES_ID;
|
|
841
|
-
style.textContent = `
|
|
850
|
+
const EFFECT_CSS = `
|
|
842
851
|
.${ZONE_CLASS}:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: 2px; }
|
|
852
|
+
.${TRACK_CLASS} {
|
|
853
|
+
border-radius: 999px;
|
|
854
|
+
overflow: hidden;
|
|
855
|
+
isolation: isolate;
|
|
856
|
+
background: linear-gradient(100deg, #03040a 0%, #071126 22%, #101d4c 45%, #302262 70%, #5d35a0 100%);
|
|
857
|
+
box-shadow:
|
|
858
|
+
inset 0 1px 0 rgba(189, 199, 255, .15),
|
|
859
|
+
inset 0 -1px 0 rgba(0, 0, 0, .55),
|
|
860
|
+
0 3px 10px rgba(12, 17, 55, .34);
|
|
861
|
+
}
|
|
862
|
+
.${TRACK_CLASS}::after {
|
|
863
|
+
content: "";
|
|
864
|
+
position: absolute;
|
|
865
|
+
inset: 0;
|
|
866
|
+
pointer-events: none;
|
|
867
|
+
background:
|
|
868
|
+
radial-gradient(circle at 18% 45%, rgba(82, 130, 255, .12), transparent 24%),
|
|
869
|
+
linear-gradient(90deg, rgba(0, 0, 0, .28), transparent 42%, rgba(168, 113, 255, .12));
|
|
870
|
+
}
|
|
871
|
+
body:not([data-ds-dark-theme]) .${TRACK_CLASS} {
|
|
872
|
+
background: var(--dsw-static-blue-75, #e5f0ff);
|
|
873
|
+
box-shadow:
|
|
874
|
+
inset 0 1px 0 rgba(255, 255, 255, .9),
|
|
875
|
+
inset 0 0 0 1px rgba(80, 133, 194, .14),
|
|
876
|
+
0 3px 10px rgba(48, 101, 165, .13);
|
|
877
|
+
}
|
|
878
|
+
.${FILL_CLASS} {
|
|
879
|
+
position: absolute;
|
|
880
|
+
top: 0;
|
|
881
|
+
bottom: 0;
|
|
882
|
+
left: 0;
|
|
883
|
+
width: var(--dsh-tl-progress, 0%);
|
|
884
|
+
border-radius: inherit;
|
|
885
|
+
background: linear-gradient(90deg, #ffffff 0%, #d7eaff 18%, #75afea 54%, #0751ad 100%);
|
|
886
|
+
transition: width 190ms cubic-bezier(.22, 1, .36, 1);
|
|
887
|
+
display: none;
|
|
888
|
+
}
|
|
889
|
+
body:not([data-ds-dark-theme]) .${FILL_CLASS} { display: block; }
|
|
890
|
+
.${CANVAS_CLASS} {
|
|
891
|
+
position: absolute;
|
|
892
|
+
inset: 0;
|
|
893
|
+
width: 100%;
|
|
894
|
+
height: 100%;
|
|
895
|
+
image-rendering: pixelated;
|
|
896
|
+
mix-blend-mode: screen;
|
|
897
|
+
pointer-events: none;
|
|
898
|
+
transition: filter 140ms ease;
|
|
899
|
+
}
|
|
900
|
+
.${FLARE_CLASS} {
|
|
901
|
+
position: absolute;
|
|
902
|
+
top: 50%;
|
|
903
|
+
width: 78px;
|
|
904
|
+
height: 46px;
|
|
905
|
+
border-radius: 50%;
|
|
906
|
+
background: radial-gradient(ellipse at 100% 50%, rgba(255,255,255,.96) 0 4%, rgba(188,189,255,.8) 11%, rgba(106,87,255,.5) 28%, rgba(105,31,255,.2) 49%, transparent 74%);
|
|
907
|
+
filter: blur(2px) saturate(1.25);
|
|
908
|
+
mix-blend-mode: screen;
|
|
909
|
+
transform: translate(-100%, -50%);
|
|
910
|
+
transition: left 70ms linear, filter 140ms ease;
|
|
911
|
+
pointer-events: none;
|
|
912
|
+
}
|
|
913
|
+
.${FLARE_CLASS}::before,
|
|
914
|
+
.${FLARE_CLASS}::after {
|
|
915
|
+
content: "";
|
|
916
|
+
position: absolute;
|
|
917
|
+
inset: 50% auto auto 100%;
|
|
918
|
+
border-radius: 999px;
|
|
919
|
+
transform: translate(-50%, -50%);
|
|
920
|
+
}
|
|
921
|
+
.${FLARE_CLASS}::before {
|
|
922
|
+
width: 52px;
|
|
923
|
+
height: 1px;
|
|
924
|
+
background: linear-gradient(90deg, transparent, rgba(100,160,255,.42), #f1ecff, rgba(193,82,255,.65), transparent);
|
|
925
|
+
box-shadow: 0 0 7px #9b7cff, 0 0 13px rgba(72,132,255,.64);
|
|
926
|
+
}
|
|
927
|
+
.${FLARE_CLASS}::after {
|
|
928
|
+
width: 1px;
|
|
929
|
+
height: 20px;
|
|
930
|
+
background: linear-gradient(180deg, transparent, rgba(196,190,255,.84), transparent);
|
|
931
|
+
box-shadow: 0 0 7px #9c7cff;
|
|
932
|
+
}
|
|
933
|
+
.${ZONE_CLASS}[data-drag="1"] .${CANVAS_CLASS} { filter: saturate(1.45) brightness(1.28) contrast(1.06); }
|
|
934
|
+
.${ZONE_CLASS}[data-drag="1"] .${FLARE_CLASS} { filter: blur(1.5px) saturate(1.6) brightness(1.42); transition: none; }
|
|
935
|
+
.${KNOB_CLASS} {
|
|
936
|
+
border-radius: 50%;
|
|
937
|
+
background: #fff;
|
|
938
|
+
border: 1px solid rgba(255, 255, 255, .94);
|
|
939
|
+
box-shadow:
|
|
940
|
+
0 0 0 2px rgba(92, 105, 255, .12),
|
|
941
|
+
0 0 14px rgba(121, 82, 255, .48),
|
|
942
|
+
0 2px 7px rgba(0, 0, 0, .3);
|
|
943
|
+
transition: left 190ms cubic-bezier(.22, 1, .36, 1), transform 160ms ease, box-shadow 180ms ease;
|
|
944
|
+
}
|
|
945
|
+
.${ZONE_CLASS}[data-drag="1"] .${KNOB_CLASS} {
|
|
946
|
+
transform: translateX(-50%) scale(1.07);
|
|
947
|
+
transition: none;
|
|
948
|
+
box-shadow:
|
|
949
|
+
0 0 0 3px rgba(113, 115, 255, .25),
|
|
950
|
+
0 0 20px rgba(74, 145, 255, .86),
|
|
951
|
+
0 0 31px rgba(171, 53, 255, .66),
|
|
952
|
+
0 3px 8px rgba(0, 0, 0, .32);
|
|
953
|
+
}
|
|
954
|
+
.${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { animation: dsh-tl-dark-breathe 1.9s ease-in-out infinite; }
|
|
955
|
+
@keyframes dsh-tl-dark-breathe {
|
|
956
|
+
0%, 100% { box-shadow: inset 0 1px 0 rgba(196,204,255,.16), 0 3px 10px rgba(18,25,72,.4); }
|
|
957
|
+
50% { box-shadow: inset 0 1px 0 rgba(220,214,255,.24), 0 0 21px rgba(111,66,255,.5); }
|
|
958
|
+
}
|
|
959
|
+
body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { animation-name: dsh-tl-light-breathe; }
|
|
960
|
+
@keyframes dsh-tl-light-breathe {
|
|
961
|
+
0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 1px rgba(67,124,193,.16), 0 3px 10px rgba(48,101,165,.13); }
|
|
962
|
+
50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.95), inset 0 0 0 1px rgba(67,124,193,.22), 0 3px 10px rgba(31,102,190,.22), 0 0 19px rgba(31,105,201,.24); }
|
|
963
|
+
}
|
|
843
964
|
.${RUN_CLASS} { animation: ${RUN_KEYFRAMES} 0.72s steps(8, end) infinite alternate; }
|
|
844
965
|
@keyframes ${RUN_KEYFRAMES} {
|
|
845
966
|
from { background-position-x: 0; }
|
|
846
967
|
to { background-position-x: -${STRIP_CSS_W}px; }
|
|
847
968
|
}
|
|
969
|
+
.${GIRL_CLASS} {
|
|
970
|
+
filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .28)) drop-shadow(0 0 5px rgba(92, 105, 255, .34));
|
|
971
|
+
transform-origin: 50% 68%;
|
|
972
|
+
transition: left 190ms cubic-bezier(.22, 1, .36, 1);
|
|
973
|
+
}
|
|
974
|
+
.${ZONE_CLASS}[data-drag="1"] .${GIRL_CLASS} {
|
|
975
|
+
animation-duration: 0.42s;
|
|
976
|
+
transition: none;
|
|
977
|
+
filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .28)) drop-shadow(0 0 8px rgba(87, 137, 255, .68));
|
|
978
|
+
}
|
|
848
979
|
@media (prefers-reduced-motion: reduce) {
|
|
980
|
+
.${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { animation: none; }
|
|
849
981
|
.${RUN_CLASS} { animation: none; }
|
|
982
|
+
.${FLARE_CLASS}, .${FILL_CLASS}, .${KNOB_CLASS} { transition: none; }
|
|
850
983
|
}
|
|
851
984
|
`;
|
|
985
|
+
let styleInjected = false;
|
|
986
|
+
/** Inject the effect stylesheet once per document. */
|
|
987
|
+
function ensureEffectStyle() {
|
|
988
|
+
if (styleInjected || document.getElementById(KEYFRAMES_ID) !== null) {
|
|
989
|
+
styleInjected = true;
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
const style = document.createElement("style");
|
|
993
|
+
style.id = KEYFRAMES_ID;
|
|
994
|
+
style.textContent = EFFECT_CSS;
|
|
852
995
|
document.head.appendChild(style);
|
|
853
996
|
styleInjected = true;
|
|
854
997
|
}
|
|
855
998
|
const clamp01 = (value) => Math.min(1, Math.max(0, value));
|
|
999
|
+
/**
|
|
1000
|
+
* Draw one frame of the track FX: sine-wave columns with a sharp crest and an
|
|
1001
|
+
* exponential trail decaying from the thumb, a 4px pixel grid with grain and a
|
|
1002
|
+
* radial halo around the thumb, particle streaks streaming LEFT, and a radial
|
|
1003
|
+
* glow at the origin — everything clipped LEFT of the thumb, theme-split by
|
|
1004
|
+
* the harness `data-ds-dark-theme` body attribute.
|
|
1005
|
+
*/
|
|
1006
|
+
function drawRadiation(context, width, height, time, state) {
|
|
1007
|
+
const origin = state.origin;
|
|
1008
|
+
const isDark = document.body.hasAttribute("data-ds-dark-theme");
|
|
1009
|
+
const cell = 4;
|
|
1010
|
+
const speed = state.dragging ? 2.8 : 1;
|
|
1011
|
+
context.clearRect(0, 0, width, height);
|
|
1012
|
+
if (origin <= 0) return;
|
|
1013
|
+
context.save();
|
|
1014
|
+
context.beginPath();
|
|
1015
|
+
context.rect(0, 0, origin, height);
|
|
1016
|
+
context.clip();
|
|
1017
|
+
for (let x = 0; x < origin; x += cell) {
|
|
1018
|
+
const delta = x + cell * .5 - origin;
|
|
1019
|
+
const distance = Math.abs(delta);
|
|
1020
|
+
const phaseA = distance / 10 - time * .0074 * speed;
|
|
1021
|
+
const phaseB = distance / 23 - time * .0041 * speed + 1.7;
|
|
1022
|
+
const phaseC = distance / 40 - time * .0022 * speed + 3.4;
|
|
1023
|
+
const sinA = Math.max(0, Math.sin(phaseA));
|
|
1024
|
+
const sinB = Math.max(0, Math.sin(phaseB));
|
|
1025
|
+
const sinC = Math.max(0, Math.sin(phaseC));
|
|
1026
|
+
const waveA = Math.pow(sinA, 2.6);
|
|
1027
|
+
const waveB = Math.pow(sinB, 3.2);
|
|
1028
|
+
const waveC = Math.pow(sinC, 4);
|
|
1029
|
+
const crest = Math.pow(sinA, 15) + Math.pow(sinB, 18) * .78;
|
|
1030
|
+
const wave = Math.min(1, waveA * .76 + waveB * .58 + waveC * .32);
|
|
1031
|
+
const trail = .38 + .62 * Math.exp(-distance / Math.max(55, width * .72));
|
|
1032
|
+
const pillar = Math.pow(Math.max(0, Math.sin(x / 20 + time * .0016)), 3) * .27;
|
|
1033
|
+
const columnEnergy = trail * (wave * 1.04 + pillar + crest * .32);
|
|
1034
|
+
if (columnEnergy > .012) {
|
|
1035
|
+
const nearness = Math.max(0, 1 - distance / Math.max(1, width * .78));
|
|
1036
|
+
context.fillStyle = `rgba(${isDark ? Math.round(42 + 124 * nearness + 75 * wave) : Math.round(28 + 58 * nearness + 15 * wave)}, ${isDark ? Math.round(56 + 58 * nearness + 44 * crest) : Math.round(88 + 72 * nearness + 30 * crest)}, ${isDark ? Math.round(175 + 72 * nearness + 8 * wave) : Math.round(182 + 62 * nearness)}, ${isDark ? Math.min(.88, columnEnergy * .72) : Math.min(.62, columnEnergy * .54)})`;
|
|
1037
|
+
context.fillRect(x, 0, 3, height);
|
|
1038
|
+
}
|
|
1039
|
+
for (let y = 0; y < height; y += cell) {
|
|
1040
|
+
const deltaY = y + cell * .5 - height * .5;
|
|
1041
|
+
const radial = Math.hypot(delta / 38, deltaY / 11);
|
|
1042
|
+
const halo = Math.exp(-radial * .96) * 1.08;
|
|
1043
|
+
const verticalShape = .58 + .42 * Math.cos(deltaY / height * Math.PI);
|
|
1044
|
+
const grain = .72 + .28 * Math.sin(x * .73 + y * 1.31 + time * .006);
|
|
1045
|
+
const alpha = Math.min(.96, (columnEnergy * .88 + halo + crest * .19) * verticalShape * grain);
|
|
1046
|
+
if (alpha < .035) continue;
|
|
1047
|
+
const hot = Math.max(0, 1 - radial / 2.4);
|
|
1048
|
+
context.fillStyle = `rgba(${isDark ? Math.round(54 + 148 * hot + 42 * wave + 35 * crest) : Math.round(25 + 72 * hot + 12 * wave)}, ${isDark ? Math.round(68 + 78 * hot + 46 * crest) : Math.round(98 + 72 * hot + 24 * crest)}, ${isDark ? Math.round(186 + 64 * hot) : Math.round(194 + 56 * hot)}, ${isDark ? alpha : alpha * .72})`;
|
|
1049
|
+
context.fillRect(x, y, 3, 3);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
for (let i = 0; i < 14; i += 1) {
|
|
1053
|
+
const particleX = origin - (time * (state.dragging ? .16 : .065) * (.78 + i % 5 * .09) + i * 23) % Math.max(30, origin + 64);
|
|
1054
|
+
if (particleX < -24 || particleX > width + 16) continue;
|
|
1055
|
+
const particleY = 3 + (i * 13 + Math.sin(time * .003 + i) * 5) % Math.max(7, height - 6);
|
|
1056
|
+
const length = 4 + i % 4 * 4 + (state.dragging ? 6 : 0);
|
|
1057
|
+
const alpha = .28 + i % 5 * .1;
|
|
1058
|
+
const streak = context.createLinearGradient(particleX, 0, particleX + length, 0);
|
|
1059
|
+
streak.addColorStop(0, isDark ? "rgba(72,118,255,0)" : "rgba(24,94,184,0)");
|
|
1060
|
+
streak.addColorStop(.68, isDark ? `rgba(112,135,255,${alpha})` : `rgba(36,108,202,${alpha * .72})`);
|
|
1061
|
+
streak.addColorStop(1, isDark ? `rgba(236,222,255,${Math.min(1, alpha + .26)})` : `rgba(103,175,248,${Math.min(.82, alpha + .18)})`);
|
|
1062
|
+
context.fillStyle = streak;
|
|
1063
|
+
context.fillRect(particleX, particleY, length, i % 3 === 0 ? 2 : 1);
|
|
1064
|
+
}
|
|
1065
|
+
const glow = context.createRadialGradient(origin, height / 2, 0, origin, height / 2, 24);
|
|
1066
|
+
glow.addColorStop(0, isDark ? "rgba(255,255,255,.82)" : "rgba(255,255,255,.86)");
|
|
1067
|
+
glow.addColorStop(.14, isDark ? "rgba(183,190,255,.54)" : "rgba(162,210,255,.48)");
|
|
1068
|
+
glow.addColorStop(.44, isDark ? "rgba(103,74,255,.28)" : "rgba(37,112,207,.22)");
|
|
1069
|
+
glow.addColorStop(1, isDark ? "rgba(86,31,210,0)" : "rgba(25,91,181,0)");
|
|
1070
|
+
context.fillStyle = glow;
|
|
1071
|
+
context.fillRect(origin - 26, 0, 52, height);
|
|
1072
|
+
context.restore();
|
|
1073
|
+
}
|
|
856
1074
|
const zoneStyle = {
|
|
857
1075
|
position: "relative",
|
|
858
1076
|
flex: "1 1 auto",
|
|
859
|
-
minWidth: "
|
|
1077
|
+
minWidth: "100px",
|
|
860
1078
|
height: `${ZONE_H}px`,
|
|
1079
|
+
isolation: "isolate",
|
|
1080
|
+
zIndex: 1,
|
|
861
1081
|
touchAction: "none",
|
|
862
1082
|
userSelect: "none",
|
|
863
1083
|
WebkitUserSelect: "none"
|
|
@@ -871,49 +1091,8 @@ window.__ModuleLoader__.load({
|
|
|
871
1091
|
...zoneStyle,
|
|
872
1092
|
cursor: "pointer"
|
|
873
1093
|
};
|
|
874
|
-
const trackStyle = {
|
|
875
|
-
position: "absolute",
|
|
876
|
-
bottom: `${TRACK_B}px`,
|
|
877
|
-
height: `${TRACK_H}px`,
|
|
878
|
-
borderRadius: "999px",
|
|
879
|
-
background: "linear-gradient(90deg, rgba(94,140,255,0.32), rgba(150,110,255,0.14)), var(--dsw-alias-bg-layer-1)",
|
|
880
|
-
border: "1px solid var(--dsw-alias-border-l2)",
|
|
881
|
-
boxSizing: "border-box"
|
|
882
|
-
};
|
|
883
|
-
const fillStyle = {
|
|
884
|
-
position: "absolute",
|
|
885
|
-
bottom: `${TRACK_B}px`,
|
|
886
|
-
height: `${TRACK_H}px`,
|
|
887
|
-
borderRadius: "999px",
|
|
888
|
-
background: "linear-gradient(90deg, rgba(88,131,255,0.92), rgba(122,90,255,0.80))",
|
|
889
|
-
pointerEvents: "none"
|
|
890
|
-
};
|
|
891
|
-
const tickStyle = {
|
|
892
|
-
position: "absolute",
|
|
893
|
-
bottom: `24.5px`,
|
|
894
|
-
width: "7px",
|
|
895
|
-
height: "7px",
|
|
896
|
-
borderRadius: "50%",
|
|
897
|
-
background: "#fff",
|
|
898
|
-
border: "1px solid var(--dsw-alias-border-l2)",
|
|
899
|
-
boxSizing: "border-box",
|
|
900
|
-
transform: "translateX(-50%)",
|
|
901
|
-
pointerEvents: "none"
|
|
902
|
-
};
|
|
903
|
-
const shadowStyle = {
|
|
904
|
-
position: "absolute",
|
|
905
|
-
bottom: `26px`,
|
|
906
|
-
width: `${GIRL_W + 6}px`,
|
|
907
|
-
height: "6px",
|
|
908
|
-
borderRadius: "50%",
|
|
909
|
-
background: "rgba(0,0,0,0.22)",
|
|
910
|
-
filter: "blur(2px)",
|
|
911
|
-
transform: "translateX(-50%)",
|
|
912
|
-
pointerEvents: "none"
|
|
913
|
-
};
|
|
914
1094
|
const girlStyle = {
|
|
915
1095
|
position: "absolute",
|
|
916
|
-
bottom: `${GIRL_B}px`,
|
|
917
1096
|
width: `${GIRL_W}px`,
|
|
918
1097
|
height: `${GIRL_H}px`,
|
|
919
1098
|
backgroundImage: `url(${WHALE_RUN_STRIP_SRC})`,
|
|
@@ -924,16 +1103,11 @@ window.__ModuleLoader__.load({
|
|
|
924
1103
|
};
|
|
925
1104
|
const knobStyle = {
|
|
926
1105
|
position: "absolute",
|
|
927
|
-
bottom: `${28 - KNOB / 2}px`,
|
|
928
1106
|
width: `${KNOB}px`,
|
|
929
1107
|
height: `${KNOB}px`,
|
|
930
|
-
borderRadius: "50%",
|
|
931
|
-
background: "#fff",
|
|
932
|
-
border: "2px solid var(--dsw-alias-state-business-primary)",
|
|
933
|
-
boxShadow: "0 1px 4px rgba(0,0,0,0.25)",
|
|
934
|
-
boxSizing: "border-box",
|
|
935
1108
|
transform: "translateX(-50%)",
|
|
936
|
-
pointerEvents: "none"
|
|
1109
|
+
pointerEvents: "none",
|
|
1110
|
+
boxSizing: "border-box"
|
|
937
1111
|
};
|
|
938
1112
|
const labelStyle$2 = {
|
|
939
1113
|
position: "absolute",
|
|
@@ -959,15 +1133,85 @@ window.__ModuleLoader__.load({
|
|
|
959
1133
|
const [dragPos, setDragPos] = (0, react.useState)(null);
|
|
960
1134
|
const dragRef = (0, react.useRef)(null);
|
|
961
1135
|
const [keyIndex, setKeyIndex] = (0, react.useState)(null);
|
|
1136
|
+
const canvasRef = (0, react.useRef)(null);
|
|
1137
|
+
const fractionRef = (0, react.useRef)(0);
|
|
1138
|
+
const draggingRef = (0, react.useRef)(false);
|
|
1139
|
+
const padRef = (0, react.useRef)(mascot ? PAD_MASCOT : PAD_KNOB);
|
|
1140
|
+
const redrawRef = (0, react.useRef)(null);
|
|
1141
|
+
(0, react.useEffect)(() => {
|
|
1142
|
+
redrawRef.current?.();
|
|
1143
|
+
});
|
|
1144
|
+
/**
|
|
1145
|
+
* The canvas FX loop: dpr-aware resize, theme-following redraws, one rAF
|
|
1146
|
+
* frame per tick — or static single frames when the user prefers reduced
|
|
1147
|
+
* motion. Everything dies with the effect (the editor row unmount). Mounted
|
|
1148
|
+
* before the empty-stops early return: hooks must run unconditionally (with
|
|
1149
|
+
* no stops the canvas never renders and the effect no-ops).
|
|
1150
|
+
*/
|
|
1151
|
+
(0, react.useEffect)(() => {
|
|
1152
|
+
const canvas = canvasRef.current;
|
|
1153
|
+
if (canvas === null) return;
|
|
1154
|
+
const context = canvas.getContext("2d");
|
|
1155
|
+
if (context === null) return;
|
|
1156
|
+
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
1157
|
+
let width = 1;
|
|
1158
|
+
let height = 1;
|
|
1159
|
+
let frame = 0;
|
|
1160
|
+
const resize = () => {
|
|
1161
|
+
const bounds = canvas.getBoundingClientRect();
|
|
1162
|
+
const ratio = Math.min(window.devicePixelRatio || 1, 2);
|
|
1163
|
+
width = Math.max(1, bounds.width);
|
|
1164
|
+
height = Math.max(1, bounds.height);
|
|
1165
|
+
canvas.width = Math.max(1, Math.round(width * ratio));
|
|
1166
|
+
canvas.height = Math.max(1, Math.round(height * ratio));
|
|
1167
|
+
context.setTransform(ratio, 0, 0, ratio, 0, 0);
|
|
1168
|
+
};
|
|
1169
|
+
const draw = (time = performance.now()) => {
|
|
1170
|
+
drawRadiation(context, width, height, time, {
|
|
1171
|
+
origin: fractionRef.current * width,
|
|
1172
|
+
dragging: draggingRef.current
|
|
1173
|
+
});
|
|
1174
|
+
};
|
|
1175
|
+
const loop = (time) => {
|
|
1176
|
+
draw(time);
|
|
1177
|
+
frame = window.requestAnimationFrame(loop);
|
|
1178
|
+
};
|
|
1179
|
+
const redraw = () => {
|
|
1180
|
+
if (reducedMotion.matches) draw();
|
|
1181
|
+
};
|
|
1182
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
1183
|
+
resize();
|
|
1184
|
+
draw();
|
|
1185
|
+
});
|
|
1186
|
+
const themeObserver = new MutationObserver(() => draw());
|
|
1187
|
+
resizeObserver.observe(canvas);
|
|
1188
|
+
themeObserver.observe(document.body, {
|
|
1189
|
+
attributes: true,
|
|
1190
|
+
attributeFilter: ["data-ds-dark-theme"]
|
|
1191
|
+
});
|
|
1192
|
+
redrawRef.current = redraw;
|
|
1193
|
+
resize();
|
|
1194
|
+
draw();
|
|
1195
|
+
if (!reducedMotion.matches) frame = window.requestAnimationFrame(loop);
|
|
1196
|
+
return () => {
|
|
1197
|
+
window.cancelAnimationFrame(frame);
|
|
1198
|
+
resizeObserver.disconnect();
|
|
1199
|
+
themeObserver.disconnect();
|
|
1200
|
+
redrawRef.current = null;
|
|
1201
|
+
};
|
|
1202
|
+
}, []);
|
|
962
1203
|
if (stops.length === 0) return null;
|
|
963
|
-
|
|
1204
|
+
ensureEffectStyle();
|
|
964
1205
|
const pad = mascot ? PAD_MASCOT : PAD_KNOB;
|
|
1206
|
+
padRef.current = pad;
|
|
965
1207
|
const count = stops.length;
|
|
966
1208
|
const indexOf = (fraction) => count <= 1 ? 0 : Math.min(count - 1, Math.max(0, Math.round(fraction * (count - 1))));
|
|
967
1209
|
const fractionOf = (index) => count <= 1 ? 0 : index / (count - 1);
|
|
968
1210
|
const committedIndex = nearestEffortStopIndex(stops, value);
|
|
969
1211
|
const shownFraction = dragPos ?? fractionOf(keyIndex ?? committedIndex);
|
|
970
1212
|
const shownIndex = indexOf(shownFraction);
|
|
1213
|
+
fractionRef.current = shownFraction;
|
|
1214
|
+
draggingRef.current = dragPos !== null;
|
|
971
1215
|
/** Pointer → 0..1 fraction within the padded rail of the zone's box. */
|
|
972
1216
|
const fractionFromEvent = (event) => {
|
|
973
1217
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
@@ -1021,8 +1265,11 @@ window.__ModuleLoader__.load({
|
|
|
1021
1265
|
setKeyIndex(null);
|
|
1022
1266
|
if (id !== void 0 && id !== value) onCommit(id);
|
|
1023
1267
|
};
|
|
1024
|
-
/**
|
|
1268
|
+
/**
|
|
1269
|
+
* Tick/label/thumb x position inside the padded rail (percent of the zone).
|
|
1270
|
+
*/
|
|
1025
1271
|
const at = (fraction) => `calc(${pad}px + ${fraction} * (100% - ${2 * pad}px))`;
|
|
1272
|
+
const dragging = dragPos !== null;
|
|
1026
1273
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1027
1274
|
role: "slider",
|
|
1028
1275
|
className: ZONE_CLASS,
|
|
@@ -1032,6 +1279,8 @@ window.__ModuleLoader__.load({
|
|
|
1032
1279
|
"aria-valuemax": count - 1,
|
|
1033
1280
|
"aria-valuenow": shownIndex,
|
|
1034
1281
|
"aria-valuetext": stops[shownIndex]?.name ?? stops[committedIndex]?.id ?? "",
|
|
1282
|
+
"data-drag": dragging ? "1" : "0",
|
|
1283
|
+
"data-top": shownIndex === count - 1 ? "1" : "0",
|
|
1035
1284
|
style: disabled ? zoneDisabledStyle : zoneActiveStyle,
|
|
1036
1285
|
onPointerDown,
|
|
1037
1286
|
onPointerMove,
|
|
@@ -1040,35 +1289,57 @@ window.__ModuleLoader__.load({
|
|
|
1040
1289
|
onKeyDown,
|
|
1041
1290
|
onKeyUp,
|
|
1042
1291
|
children: [
|
|
1043
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1292
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1293
|
+
className: TRACK_CLASS,
|
|
1294
|
+
style: {
|
|
1295
|
+
position: "absolute",
|
|
1296
|
+
left: `${pad}px`,
|
|
1297
|
+
right: `${pad}px`,
|
|
1298
|
+
bottom: `${TRACK_B}px`,
|
|
1299
|
+
height: `${TRACK_H}px`
|
|
1300
|
+
},
|
|
1301
|
+
children: [
|
|
1302
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: FILL_CLASS }),
|
|
1303
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("canvas", {
|
|
1304
|
+
ref: canvasRef,
|
|
1305
|
+
className: CANVAS_CLASS
|
|
1306
|
+
}),
|
|
1307
|
+
stops.map((stop, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
|
|
1308
|
+
position: "absolute",
|
|
1309
|
+
bottom: `${TRACK_H / 2 - 3.5}px`,
|
|
1310
|
+
left: `${index / Math.max(1, count - 1) * 100}%`,
|
|
1311
|
+
width: "7px",
|
|
1312
|
+
height: "7px",
|
|
1313
|
+
borderRadius: "50%",
|
|
1314
|
+
background: "#fff",
|
|
1315
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
1316
|
+
boxSizing: "border-box",
|
|
1317
|
+
transform: "translateX(-50%)",
|
|
1318
|
+
pointerEvents: "none",
|
|
1319
|
+
zIndex: 2,
|
|
1320
|
+
opacity: index <= shownIndex ? 1 : .65
|
|
1321
|
+
} }, stop.id))
|
|
1322
|
+
]
|
|
1323
|
+
}),
|
|
1324
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1325
|
+
className: FLARE_CLASS,
|
|
1326
|
+
style: { left: at(shownFraction) }
|
|
1327
|
+
}),
|
|
1328
|
+
mascot ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1329
|
+
className: `${RUN_CLASS} ${GIRL_CLASS}`,
|
|
1063
1330
|
style: {
|
|
1064
1331
|
...girlStyle,
|
|
1065
1332
|
left: at(shownFraction),
|
|
1066
|
-
|
|
1333
|
+
bottom: `${GIRL_B}px`
|
|
1334
|
+
}
|
|
1335
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1336
|
+
className: KNOB_CLASS,
|
|
1337
|
+
style: {
|
|
1338
|
+
...knobStyle,
|
|
1339
|
+
left: at(shownFraction),
|
|
1340
|
+
bottom: `${24 - KNOB / 2}px`
|
|
1067
1341
|
}
|
|
1068
|
-
})
|
|
1069
|
-
...knobStyle,
|
|
1070
|
-
left: at(shownFraction)
|
|
1071
|
-
} }),
|
|
1342
|
+
}),
|
|
1072
1343
|
count <= 6 && stops.map((stop, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1073
1344
|
style: {
|
|
1074
1345
|
...index === shownIndex ? labelActiveStyle : labelStyle$2,
|
|
@@ -1242,8 +1513,8 @@ window.__ModuleLoader__.load({
|
|
|
1242
1513
|
position: "absolute",
|
|
1243
1514
|
bottom: "calc(100% + 8px)",
|
|
1244
1515
|
left: "0",
|
|
1245
|
-
zIndex:
|
|
1246
|
-
width: "320px",
|
|
1516
|
+
zIndex: 1300,
|
|
1517
|
+
width: "min(320px, calc(100vw - 24px))",
|
|
1247
1518
|
padding: "8px",
|
|
1248
1519
|
background: "var(--dsw-alias-bg-layer-3)",
|
|
1249
1520
|
color: "var(--dsw-alias-label-primary)",
|
|
@@ -1257,7 +1528,7 @@ window.__ModuleLoader__.load({
|
|
|
1257
1528
|
const backdropStyle = {
|
|
1258
1529
|
position: "fixed",
|
|
1259
1530
|
inset: 0,
|
|
1260
|
-
zIndex:
|
|
1531
|
+
zIndex: 1299
|
|
1261
1532
|
};
|
|
1262
1533
|
const modelsStyle = {
|
|
1263
1534
|
maxHeight: "320px",
|
|
@@ -1385,7 +1656,9 @@ window.__ModuleLoader__.load({
|
|
|
1385
1656
|
border: "1px solid var(--dsw-alias-border-l2)",
|
|
1386
1657
|
borderRadius: "6px",
|
|
1387
1658
|
background: "var(--dsw-alias-bg-layer-1)",
|
|
1388
|
-
fontSize: "12px"
|
|
1659
|
+
fontSize: "12px",
|
|
1660
|
+
position: "relative",
|
|
1661
|
+
zIndex: 2
|
|
1389
1662
|
};
|
|
1390
1663
|
const labelStyle$1 = {
|
|
1391
1664
|
flex: "0 0 auto",
|