dsh-thinking-levels 3.4.5-beta.2 → 3.4.5-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
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
- ### 追加 — 思考レベルスライダー(鲸魚娘ランナーつまみ) — 3.4.5-beta.2
11
+ ### 追加 — 思考レベルスライダー(鲸魚娘ランナーつまみ) — 3.4.5-beta.3
12
12
 
13
13
  - モデルパネルの各行の思考レベル `<select>` をセグメントスライダーに改修。行のレベル
14
14
  チップをクリックすると全幅スライダーが展開されます:ストップ数はモデルの広告レベルに
package/CHANGELOG.ko.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
- ### 추가 — 사고 레벨 슬라이더(고래소녀 러너 썸) — 3.4.5-beta.2
11
+ ### 추가 — 사고 레벨 슬라이더(고래소녀 러너 썸) — 3.4.5-beta.3
12
12
 
13
13
  - 모델 패널各行의 사고 레벨 `<select>`를 세그먼트 슬라이더로 개편. 행의 레벨 칩을 클릭하면
14
14
  전폭 슬라이더가 펼쳐집니다: 스톱 수는 모델이 광고하는 레벨에 적응하고, `auto`는 항상
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.2
11
+ ### Added — effort slider (whale-girl runner thumb) — 3.4.5-beta.3
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.2",
3
+ "version": "3.4.5-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
@@ -787,21 +787,31 @@ 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
- * Visual baseline follows the approved dsh-reasoning-effort visual spec where
791
- * it applies: the thumb follows the pointer CONTINUOUSLY and snaps to a stop on
792
- * release (one `directory.select` per gesture), the plain thumb is pure white in
793
- * every theme, the full character stays visible at both track endpoints, and
794
- * reduced-motion freezes the run cycle. Deviations requested for this plugin:
795
- * the stop count adapts to the model's advertised efforts (not a fixed triple),
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
- * Inline styling only (no CSS modules in the client bundle) — the one thing
801
- * inline styles cannot express, the `@keyframes` of the run cycle plus its
802
- * reduced-motion freeze, is injected once into `document.head` under a
803
- * plugin-prefixed id. All math is defensive: a render throw here would abdicate
804
- * the whole model-seat takeover back to the shipped selector.
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
817
  const ZONE_H = 78;
@@ -822,37 +832,245 @@ 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-effort-zone";
826
- const RUN_CLASS = "dsh-tl-whale-run";
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
- * Inject the run-cycle keyframes + reduced-motion freeze once per document.
831
- * The dragging speed overrides the class shorthand via inline
832
- * `animationDuration` (inline wins over the stylesheet).
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
- function ensureRunStyle() {
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",
@@ -871,49 +1089,8 @@ window.__ModuleLoader__.load({
871
1089
  ...zoneStyle,
872
1090
  cursor: "pointer"
873
1091
  };
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
1092
  const girlStyle = {
915
1093
  position: "absolute",
916
- bottom: `${GIRL_B}px`,
917
1094
  width: `${GIRL_W}px`,
918
1095
  height: `${GIRL_H}px`,
919
1096
  backgroundImage: `url(${WHALE_RUN_STRIP_SRC})`,
@@ -924,16 +1101,11 @@ window.__ModuleLoader__.load({
924
1101
  };
925
1102
  const knobStyle = {
926
1103
  position: "absolute",
927
- bottom: `${28 - KNOB / 2}px`,
928
1104
  width: `${KNOB}px`,
929
1105
  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
1106
  transform: "translateX(-50%)",
936
- pointerEvents: "none"
1107
+ pointerEvents: "none",
1108
+ boxSizing: "border-box"
937
1109
  };
938
1110
  const labelStyle$2 = {
939
1111
  position: "absolute",
@@ -959,15 +1131,85 @@ window.__ModuleLoader__.load({
959
1131
  const [dragPos, setDragPos] = (0, react.useState)(null);
960
1132
  const dragRef = (0, react.useRef)(null);
961
1133
  const [keyIndex, setKeyIndex] = (0, react.useState)(null);
1134
+ const canvasRef = (0, react.useRef)(null);
1135
+ const fractionRef = (0, react.useRef)(0);
1136
+ const draggingRef = (0, react.useRef)(false);
1137
+ const padRef = (0, react.useRef)(mascot ? PAD_MASCOT : PAD_KNOB);
1138
+ const redrawRef = (0, react.useRef)(null);
1139
+ (0, react.useEffect)(() => {
1140
+ redrawRef.current?.();
1141
+ });
1142
+ /**
1143
+ * The canvas FX loop: dpr-aware resize, theme-following redraws, one rAF
1144
+ * frame per tick — or static single frames when the user prefers reduced
1145
+ * motion. Everything dies with the effect (the editor row unmount). Mounted
1146
+ * before the empty-stops early return: hooks must run unconditionally (with
1147
+ * no stops the canvas never renders and the effect no-ops).
1148
+ */
1149
+ (0, react.useEffect)(() => {
1150
+ const canvas = canvasRef.current;
1151
+ if (canvas === null) return;
1152
+ const context = canvas.getContext("2d");
1153
+ if (context === null) return;
1154
+ const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
1155
+ let width = 1;
1156
+ let height = 1;
1157
+ let frame = 0;
1158
+ const resize = () => {
1159
+ const bounds = canvas.getBoundingClientRect();
1160
+ const ratio = Math.min(window.devicePixelRatio || 1, 2);
1161
+ width = Math.max(1, bounds.width);
1162
+ height = Math.max(1, bounds.height);
1163
+ canvas.width = Math.max(1, Math.round(width * ratio));
1164
+ canvas.height = Math.max(1, Math.round(height * ratio));
1165
+ context.setTransform(ratio, 0, 0, ratio, 0, 0);
1166
+ };
1167
+ const draw = (time = performance.now()) => {
1168
+ drawRadiation(context, width, height, time, {
1169
+ origin: fractionRef.current * width,
1170
+ dragging: draggingRef.current
1171
+ });
1172
+ };
1173
+ const loop = (time) => {
1174
+ draw(time);
1175
+ frame = window.requestAnimationFrame(loop);
1176
+ };
1177
+ const redraw = () => {
1178
+ if (reducedMotion.matches) draw();
1179
+ };
1180
+ const resizeObserver = new ResizeObserver(() => {
1181
+ resize();
1182
+ draw();
1183
+ });
1184
+ const themeObserver = new MutationObserver(() => draw());
1185
+ resizeObserver.observe(canvas);
1186
+ themeObserver.observe(document.body, {
1187
+ attributes: true,
1188
+ attributeFilter: ["data-ds-dark-theme"]
1189
+ });
1190
+ redrawRef.current = redraw;
1191
+ resize();
1192
+ draw();
1193
+ if (!reducedMotion.matches) frame = window.requestAnimationFrame(loop);
1194
+ return () => {
1195
+ window.cancelAnimationFrame(frame);
1196
+ resizeObserver.disconnect();
1197
+ themeObserver.disconnect();
1198
+ redrawRef.current = null;
1199
+ };
1200
+ }, []);
962
1201
  if (stops.length === 0) return null;
963
- if (mascot) ensureRunStyle();
1202
+ ensureEffectStyle();
964
1203
  const pad = mascot ? PAD_MASCOT : PAD_KNOB;
1204
+ padRef.current = pad;
965
1205
  const count = stops.length;
966
1206
  const indexOf = (fraction) => count <= 1 ? 0 : Math.min(count - 1, Math.max(0, Math.round(fraction * (count - 1))));
967
1207
  const fractionOf = (index) => count <= 1 ? 0 : index / (count - 1);
968
1208
  const committedIndex = nearestEffortStopIndex(stops, value);
969
1209
  const shownFraction = dragPos ?? fractionOf(keyIndex ?? committedIndex);
970
1210
  const shownIndex = indexOf(shownFraction);
1211
+ fractionRef.current = shownFraction;
1212
+ draggingRef.current = dragPos !== null;
971
1213
  /** Pointer → 0..1 fraction within the padded rail of the zone's box. */
972
1214
  const fractionFromEvent = (event) => {
973
1215
  const rect = event.currentTarget.getBoundingClientRect();
@@ -1021,8 +1263,11 @@ window.__ModuleLoader__.load({
1021
1263
  setKeyIndex(null);
1022
1264
  if (id !== void 0 && id !== value) onCommit(id);
1023
1265
  };
1024
- /** Tick/label/thumb x position inside the padded rail (percent of the zone). */
1266
+ /**
1267
+ * Tick/label/thumb x position inside the padded rail (percent of the zone).
1268
+ */
1025
1269
  const at = (fraction) => `calc(${pad}px + ${fraction} * (100% - ${2 * pad}px))`;
1270
+ const dragging = dragPos !== null;
1026
1271
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1027
1272
  role: "slider",
1028
1273
  className: ZONE_CLASS,
@@ -1032,6 +1277,8 @@ window.__ModuleLoader__.load({
1032
1277
  "aria-valuemax": count - 1,
1033
1278
  "aria-valuenow": shownIndex,
1034
1279
  "aria-valuetext": stops[shownIndex]?.name ?? stops[committedIndex]?.id ?? "",
1280
+ "data-drag": dragging ? "1" : "0",
1281
+ "data-top": shownIndex === count - 1 ? "1" : "0",
1035
1282
  style: disabled ? zoneDisabledStyle : zoneActiveStyle,
1036
1283
  onPointerDown,
1037
1284
  onPointerMove,
@@ -1040,35 +1287,56 @@ window.__ModuleLoader__.load({
1040
1287
  onKeyDown,
1041
1288
  onKeyUp,
1042
1289
  children: [
1043
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1044
- ...trackStyle,
1045
- left: `${pad}px`,
1046
- right: `${pad}px`
1047
- } }),
1048
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1049
- ...fillStyle,
1050
- left: `${pad}px`,
1051
- width: shownFraction <= 0 ? "0px" : `calc(${pad}px + ${shownFraction} * (100% - ${2 * pad}px) - ${pad}px)`
1052
- } }),
1053
- stops.map((stop, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1054
- ...tickStyle,
1055
- left: at(fractionOf(index)),
1056
- opacity: index <= shownIndex ? 1 : .65
1057
- } }, stop.id)),
1058
- mascot ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1059
- ...shadowStyle,
1060
- left: at(shownFraction)
1061
- } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1062
- className: RUN_CLASS,
1290
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1291
+ className: TRACK_CLASS,
1292
+ style: {
1293
+ left: `${pad}px`,
1294
+ right: `${pad}px`,
1295
+ bottom: `${TRACK_B}px`,
1296
+ height: `${TRACK_H}px`
1297
+ },
1298
+ children: [
1299
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: FILL_CLASS }),
1300
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("canvas", {
1301
+ ref: canvasRef,
1302
+ className: CANVAS_CLASS
1303
+ }),
1304
+ stops.map((stop, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1305
+ position: "absolute",
1306
+ bottom: `${TRACK_H / 2 - 3.5}px`,
1307
+ left: `${index / Math.max(1, count - 1) * 100}%`,
1308
+ width: "7px",
1309
+ height: "7px",
1310
+ borderRadius: "50%",
1311
+ background: "#fff",
1312
+ border: "1px solid var(--dsw-alias-border-l2)",
1313
+ boxSizing: "border-box",
1314
+ transform: "translateX(-50%)",
1315
+ pointerEvents: "none",
1316
+ zIndex: 2,
1317
+ opacity: index <= shownIndex ? 1 : .65
1318
+ } }, stop.id))
1319
+ ]
1320
+ }),
1321
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1322
+ className: FLARE_CLASS,
1323
+ style: { left: at(shownFraction) }
1324
+ }),
1325
+ mascot ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1326
+ className: `${RUN_CLASS} ${GIRL_CLASS}`,
1063
1327
  style: {
1064
1328
  ...girlStyle,
1065
1329
  left: at(shownFraction),
1066
- ...dragPos !== null ? { animationDuration: "0.42s" } : {}
1330
+ bottom: `${GIRL_B}px`
1067
1331
  }
1068
- })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1069
- ...knobStyle,
1070
- left: at(shownFraction)
1071
- } }),
1332
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1333
+ className: KNOB_CLASS,
1334
+ style: {
1335
+ ...knobStyle,
1336
+ left: at(shownFraction),
1337
+ bottom: `${28 - KNOB / 2}px`
1338
+ }
1339
+ }),
1072
1340
  count <= 6 && stops.map((stop, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1073
1341
  style: {
1074
1342
  ...index === shownIndex ? labelActiveStyle : labelStyle$2,