dsh-background-by-model 0.7.3 → 0.7.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/cordis.patch.yml CHANGED
@@ -1,8 +1,8 @@
1
- # Deep Midnight theme plugin: bundle patch layer.
2
- # When this package is installed into a profile via `dsh plugin add`,
3
- # this patch is applied as a layer, inserting the theme plugin row
4
- # into the composed configuration.
5
-
6
- - insert:
7
- - id: dsh-background-by-model
8
- name: 'dsh-background-by-model'
1
+ # Deep Midnight theme plugin: bundle patch layer.
2
+ # When this package is installed into a profile via `dsh plugin add`,
3
+ # this patch is applied as a layer, inserting the theme plugin row
4
+ # into the composed configuration.
5
+
6
+ - insert:
7
+ - id: dsh-background-by-model
8
+ name: 'dsh-background-by-model'
package/lib/client.js CHANGED
@@ -1602,9 +1602,12 @@ window.__ModuleLoader__.load({
1602
1602
  const names = Object.keys(input.initial).filter((n) => n.startsWith("--"));
1603
1603
  if (names.length === 0) return "";
1604
1604
  const css = registrations(names, input.initial);
1605
- if (!(input.durationMs > 0) || input.selectors.length === 0) return css;
1606
- const list = names.map((n) => `${n} ${input.durationMs}ms ${input.easing}`).join(",");
1607
- return `${css}${input.selectors.join(",")}{transition:${list}}`;
1605
+ if (!(input.durationMs > 0)) return css;
1606
+ const timing = (n) => `${n} ${input.durationMs}ms ${input.easing}`;
1607
+ return `${css}${input.scopes.map((s) => ({
1608
+ selector: s.selector,
1609
+ transitions: [...s.tokens.filter((n) => names.includes(n)), ...s.properties ?? []]
1610
+ })).filter((s) => s.transitions.length > 0).map((s) => `${s.selector}{transition:${s.transitions.map(timing).join(",")}}`).join("")}`;
1608
1611
  }
1609
1612
  /**
1610
1613
  * The same fade for an element the plugin paints INLINE (its columns and cards).
@@ -2693,7 +2696,8 @@ window.__ModuleLoader__.load({
2693
2696
  }
2694
2697
  const SETTINGS_PANEL_SEL = "[role=\"dialog\"][aria-modal=\"true\"][aria-labelledby]";
2695
2698
  const SETTINGS_STYLE_RULE = `${SETTINGS_PANEL_SEL}{background:var(--dsh-any-bg-settings-surface,var(--dsw-alias-bg-layer-2));backdrop-filter:var(--dsh-any-blur-settings,none);}html[${THEMED_ATTR}] ${SETTINGS_PANEL_SEL}{--dsw-alias-bg-layer-1:var(--dsh-any-bg-settings-layer-1);--dsw-alias-bg-layer-2:var(--dsh-any-bg-settings-layer-2);--dsw-alias-bg-layer-3:var(--dsh-any-bg-settings-layer-3)}${SETTINGS_PANEL_SEL} .dab-card{backdrop-filter:var(--dsh-any-blur-card-panels,none);-webkit-backdrop-filter:var(--dsh-any-blur-card-panels,none)}`;
2696
- const INPUT_BLUR_RULE = "[data-composer-card],[data-cordis-panel]{-webkit-backdrop-filter:var(--dsh-any-input-blur,none);backdrop-filter:var(--dsh-any-input-blur,none)}[data-cordis-panel]{--dsw-specific-menu:var(--dsh-any-op-menu-cordis)!important}";
2699
+ const CORDIS_PANEL_SEL = "[data-cordis-panel]";
2700
+ const INPUT_BLUR_RULE = `[data-composer-card],${CORDIS_PANEL_SEL}{-webkit-backdrop-filter:var(--dsh-any-input-blur,none);backdrop-filter:var(--dsh-any-input-blur,none)}${CORDIS_PANEL_SEL}{--dsw-specific-menu:var(--dsh-any-op-menu-cordis)!important}`;
2697
2701
  function applyInputBlur(px) {
2698
2702
  if (px > 0) document.documentElement.style.setProperty("--dsh-any-input-blur", `blur(${px}px)`);
2699
2703
  else document.documentElement.style.removeProperty("--dsh-any-input-blur");
@@ -2724,13 +2728,22 @@ window.__ModuleLoader__.load({
2724
2728
  write("--dsh-any-traj-layer-2", "--dsw-alias-bg-layer-2");
2725
2729
  write("--dsh-any-traj-layer-3", "--dsw-alias-bg-layer-3");
2726
2730
  }
2731
+ const TRAJECTORY_ROOT_SEL = "[data-conversation-composer-overlay]";
2727
2732
  /** Elements whose own token declarations change when the palette does: the body
2728
2733
  * (which everything else inherits), and the two surfaces that RE-declare the
2729
- * layer tokens instead of inheriting them. */
2730
- const FADE_SELECTORS = [
2731
- "body",
2732
- SETTINGS_PANEL_SEL,
2733
- "[data-conversation-composer-overlay]"
2734
+ * layer tokens instead of inheriting them.
2735
+ *
2736
+ * The three layer tokens are also the ONLY ones those two surfaces may carry a
2737
+ * transition for. Handing them the full palette is not "more of the same": a
2738
+ * transition on an INHERITED token makes the element interpolate towards the
2739
+ * stale value it saw when the fade was armed, and everything under it rides that
2740
+ * lagged copy — the settings dialog's own controls (the holiday switch fill, the
2741
+ * active chips) then hold the previous theme colour for the whole switch and jump
2742
+ * at the end. See ./palette-fade for the measurement. */
2743
+ const FADE_LAYER_TOKENS = [
2744
+ "--dsw-alias-bg-layer-1",
2745
+ "--dsw-alias-bg-layer-2",
2746
+ "--dsw-alias-bg-layer-3"
2734
2747
  ];
2735
2748
  /** The token names the plugin re-emits. One palette is enough: every branch
2736
2749
  * defines the same set, and an unknown name would only be registered when the
@@ -2738,6 +2751,43 @@ window.__ModuleLoader__.load({
2738
2751
  function fadeTokenNames() {
2739
2752
  return Object.keys(genTokens(220, .55, .25).tokens);
2740
2753
  }
2754
+ /** One `transition` list per element that DECLARES palette tokens, each carrying
2755
+ * only the tokens that element actually declares.
2756
+ *
2757
+ * Two of the entries carry a STANDARD property instead, because those surfaces
2758
+ * are not painted from a registered token: the settings dialog's plate and the
2759
+ * file-preview panel read a colour the plugin owns as a plain variable
2760
+ * (`--dsh-any-bg-settings-surface`, `--dsh-any-bg-rightbar`) and would otherwise
2761
+ * snap in one frame while every surface around them fades. The Cordis panel is
2762
+ * the third case of the same kind — it re-declares `--dsw-specific-menu` from
2763
+ * `--dsh-any-op-menu-cordis`, which is also unregistered, but since the token it
2764
+ * re-declares IS one, naming the token is what reaches it. */
2765
+ function fadeScopes() {
2766
+ return [
2767
+ {
2768
+ selector: "body",
2769
+ tokens: fadeTokenNames()
2770
+ },
2771
+ {
2772
+ selector: SETTINGS_PANEL_SEL,
2773
+ tokens: FADE_LAYER_TOKENS,
2774
+ properties: ["background-color"]
2775
+ },
2776
+ {
2777
+ selector: TRAJECTORY_ROOT_SEL,
2778
+ tokens: FADE_LAYER_TOKENS
2779
+ },
2780
+ {
2781
+ selector: RIGHTBAR_SEL,
2782
+ tokens: [],
2783
+ properties: ["background-color"]
2784
+ },
2785
+ {
2786
+ selector: CORDIS_PANEL_SEL,
2787
+ tokens: ["--dsw-specific-menu"]
2788
+ }
2789
+ ];
2790
+ }
2741
2791
  let fadeStyleEl = null;
2742
2792
  let fadeInitials = null;
2743
2793
  let fadeCssCache = "";
@@ -2805,7 +2855,7 @@ window.__ModuleLoader__.load({
2805
2855
  function applyPaletteFade(animate) {
2806
2856
  const initials = fadeInitialsOf(fadeTokenNames());
2807
2857
  const css = paletteFadeCss({
2808
- selectors: FADE_SELECTORS,
2858
+ scopes: fadeScopes(),
2809
2859
  initial: initials,
2810
2860
  durationMs: animate ? paletteFadeMs() : 0,
2811
2861
  easing: rTransition().easing
@@ -2818,7 +2868,8 @@ window.__ModuleLoader__.load({
2818
2868
  function fadeInlineFor(animate) {
2819
2869
  return paletteFadeInline(animate ? paletteFadeMs() : 0, rTransition().easing);
2820
2870
  }
2821
- const RIGHTBAR_STYLE_RULE = "div[data-sidebar-right-panel]:not(:has([data-dockkit-content],[data-dockkit-empty]))[data-sidebar-right-open],div[data-sidebar-right-panel] [data-dockkit-content]:not([data-dockkit-float]),div[data-sidebar-right-panel] [data-dockkit-empty]{background:var(--dsh-any-bg-rightbar,var(--dsw-alias-bg-base))!important}div[data-sidebar-right-panel][data-sidebar-right-open]{-webkit-backdrop-filter:var(--dsh-any-blur-rightbar,none);backdrop-filter:var(--dsh-any-blur-rightbar,none)}";
2871
+ const RIGHTBAR_SEL = "div[data-sidebar-right-panel]:not(:has([data-dockkit-content],[data-dockkit-empty]))[data-sidebar-right-open],div[data-sidebar-right-panel] [data-dockkit-content]:not([data-dockkit-float]),div[data-sidebar-right-panel] [data-dockkit-empty]";
2872
+ const RIGHTBAR_STYLE_RULE = `${RIGHTBAR_SEL}{background:var(--dsh-any-bg-rightbar,var(--dsw-alias-bg-base))!important}div[data-sidebar-right-panel][data-sidebar-right-open]{-webkit-backdrop-filter:var(--dsh-any-blur-rightbar,none);backdrop-filter:var(--dsh-any-blur-rightbar,none)}`;
2822
2873
  /** Paint the file-preview panel's surface from its own slider. */
2823
2874
  function applyRightbarOverrides(op) {
2824
2875
  const root = document.documentElement;