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