@ds-mo/ui 1.10.1 → 1.11.1

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.
@@ -99,7 +99,7 @@ export namespace Components {
99
99
  }
100
100
  interface DsAppShell {
101
101
  /**
102
- * When `true`, paints the shared chrome surface (bg + wash + grid) behind panel, bar, and tools.
102
+ * When `true`, paints the radial wash behind panel, bar, and tools (synced to shell layout).
103
103
  * @default false
104
104
  */
105
105
  "gradient": boolean;
@@ -108,6 +108,11 @@ export namespace Components {
108
108
  * @default ''
109
109
  */
110
110
  "gradientSrc": string;
111
+ /**
112
+ * When `true`, paints the diagonal grid overlay on the shared chrome layer. Independent of `gradient`.
113
+ * @default false
114
+ */
115
+ "grid": boolean;
111
116
  /**
112
117
  * Chrome style propagated to slotted `ds-panel-nav` and `ds-bar-nav`.
113
118
  * @default 'dashboard'
@@ -1781,7 +1786,7 @@ declare namespace LocalJSX {
1781
1786
  }
1782
1787
  interface DsAppShell {
1783
1788
  /**
1784
- * When `true`, paints the shared chrome surface (bg + wash + grid) behind panel, bar, and tools.
1789
+ * When `true`, paints the radial wash behind panel, bar, and tools (synced to shell layout).
1785
1790
  * @default false
1786
1791
  */
1787
1792
  "gradient"?: boolean;
@@ -1790,6 +1795,11 @@ declare namespace LocalJSX {
1790
1795
  * @default ''
1791
1796
  */
1792
1797
  "gradientSrc"?: string;
1798
+ /**
1799
+ * When `true`, paints the diagonal grid overlay on the shared chrome layer. Independent of `gradient`.
1800
+ * @default false
1801
+ */
1802
+ "grid"?: boolean;
1793
1803
  /**
1794
1804
  * Chrome style propagated to slotted `ds-panel-nav` and `ds-bar-nav`.
1795
1805
  * @default 'dashboard'
@@ -2871,6 +2881,7 @@ declare namespace LocalJSX {
2871
2881
  interface DsAppShellAttributes {
2872
2882
  "navStyle": NavChromeStyle;
2873
2883
  "gradient": boolean;
2884
+ "grid": boolean;
2874
2885
  "gradientSrc": string;
2875
2886
  }
2876
2887
  interface DsBadgeAttributes {
@@ -8,3 +8,49 @@ export type ChromeTransitionSource = 'panel-nav' | 'panel-tools';
8
8
  export interface ChromeTransitionDetail {
9
9
  source: ChromeTransitionSource;
10
10
  }
11
+
12
+ /** Reference-counted gate — used while panel-nav width is transitioning. */
13
+ export class ChromeTransitionDepth {
14
+ private depth = 0;
15
+
16
+ enter(): void {
17
+ this.depth += 1;
18
+ }
19
+
20
+ exit(): void {
21
+ this.depth = Math.max(0, this.depth - 1);
22
+ }
23
+
24
+ get isActive(): boolean {
25
+ return this.depth > 0;
26
+ }
27
+ }
28
+
29
+ export interface RafCoalescer {
30
+ schedule(): void;
31
+ cancel(): void;
32
+ }
33
+
34
+ /** Coalesce bursty layout work (ResizeObserver, prop churn) to one callback per frame. */
35
+ export function createRafCoalescer(onFrame: () => void): RafCoalescer {
36
+ let rafId = 0;
37
+ return {
38
+ schedule() {
39
+ if (rafId !== 0) return;
40
+ rafId = requestAnimationFrame(() => {
41
+ rafId = 0;
42
+ onFrame();
43
+ });
44
+ },
45
+ cancel() {
46
+ if (rafId !== 0) {
47
+ cancelAnimationFrame(rafId);
48
+ rafId = 0;
49
+ }
50
+ },
51
+ };
52
+ }
53
+
54
+ export function readChromeTransitionSource(event: Event): ChromeTransitionSource | undefined {
55
+ return (event as CustomEvent<ChromeTransitionDetail>).detail?.source;
56
+ }
@@ -33,12 +33,16 @@ export {
33
33
  shellGradientPositionPanel,
34
34
  shellGradientPositionBar,
35
35
  shellChromeSurfacePosition,
36
+ shellChromeLayerActive,
36
37
  } from './shell-gradient';
37
38
  export type { ShellGradientLayout } from './shell-gradient';
38
39
  export type { ChromeTransitionDetail, ChromeTransitionSource } from './chrome-transition';
39
40
  export {
40
41
  CHROME_TRANSITION_END,
41
42
  CHROME_TRANSITION_START,
43
+ ChromeTransitionDepth,
44
+ createRafCoalescer,
45
+ readChromeTransitionSource,
42
46
  } from './chrome-transition';
43
47
  export {
44
48
  barGradientPositionFromPanelWidth,
@@ -10,6 +10,11 @@ export const SHELL_CHROME_SURFACE_POSITION_VAR = '--ds-shell-chrome-surface-posi
10
10
  /** Layer opacity for the nav gradient wash. */
11
11
  export const SHELL_GRADIENT_OPACITY = '0.1';
12
12
 
13
+ /** Whether the shared chrome layer (bg + optional wash/grid) should mount. */
14
+ export function shellChromeLayerActive(gradient: boolean, grid: boolean): boolean {
15
+ return gradient || grid;
16
+ }
17
+
13
18
  const GRADIENT_GEOMETRY = '100% 100% at 0% 0%';
14
19
 
15
20
  /**
@@ -1,2 +0,0 @@
1
- const n="dsChromeTransitionStart";const t="dsChromeTransitionEnd";function e(n,t){if(typeof document==="undefined")return 0;const e=document.createElement("div");e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;height:0;width:var("+t+");";n.appendChild(e);const i=e.getBoundingClientRect().width;n.removeChild(e);return i}function i(n){return{expandedPx:e(n,"--_nav-width"),collapsedPx:e(n,"--_nav-width-collapsed")}}function o(n,t){if(t?.classList.contains("panel-nav--collapsed"))return true;const e=n?.collapsed;return e===true}function r(n,t){return t?n.collapsedPx:n.expandedPx}export{n as C,t as a,e as b,o as i,r as p,i as r};
2
- //# sourceMappingURL=p-DN65lYYc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["CHROME_TRANSITION_START","CHROME_TRANSITION_END","readCssVarWidthPx","context","cssVarName","document","probe","createElement","style","cssText","appendChild","width","getBoundingClientRect","removeChild","readPanelNavWidthTokens","navRoot","expandedPx","collapsedPx","isPanelNavCollapsed","panelNavHost","classList","contains","collapsedProp","collapsed","panelWidthPxFromTokens","tokens"],"sources":["src/wc/nav/chrome-transition.ts","src/wc/nav/shell-chrome-metrics.ts"],"sourcesContent":["/** Bubbling/composed events — `ds-app-shell` and `ds-bar-nav` coordinate during width motion. */\n\nexport const CHROME_TRANSITION_START = 'dsChromeTransitionStart';\nexport const CHROME_TRANSITION_END = 'dsChromeTransitionEnd';\n\nexport type ChromeTransitionSource = 'panel-nav' | 'panel-tools';\n\nexport interface ChromeTransitionDetail {\n source: ChromeTransitionSource;\n}\n","import { shellGradientPositionBar } from './shell-gradient';\n\n/** Read a `var(--token)` width in px using a hidden probe (works with calc() tokens). */\nexport function readCssVarWidthPx(context: HTMLElement, cssVarName: string): number {\n if (typeof document === 'undefined') return 0;\n\n const probe = document.createElement('div');\n probe.style.cssText =\n 'position:absolute;visibility:hidden;pointer-events:none;height:0;width:var(' +\n cssVarName +\n ');';\n context.appendChild(probe);\n const width = probe.getBoundingClientRect().width;\n context.removeChild(probe);\n return width;\n}\n\nexport interface PanelNavWidthTokens {\n expandedPx: number;\n collapsedPx: number;\n}\n\n/** Resolve panel-nav expanded/collapsed widths from scoped CSS vars on `.panel-nav`. */\nexport function readPanelNavWidthTokens(navRoot: HTMLElement): PanelNavWidthTokens {\n return {\n expandedPx: readCssVarWidthPx(navRoot, '--_nav-width'),\n collapsedPx: readCssVarWidthPx(navRoot, '--_nav-width-collapsed'),\n };\n}\n\nexport function isPanelNavCollapsed(\n panelNavHost: HTMLElement | null,\n navRoot: HTMLElement | null,\n): boolean {\n if (navRoot?.classList.contains('panel-nav--collapsed')) return true;\n const collapsedProp = (panelNavHost as (HTMLElement & { collapsed?: boolean }) | null)?.collapsed;\n return collapsedProp === true;\n}\n\nexport function panelWidthPxFromTokens(\n tokens: PanelNavWidthTokens,\n collapsed: boolean,\n): number {\n return collapsed ? tokens.collapsedPx : tokens.expandedPx;\n}\n\nexport function barGradientPositionFromPanelWidth(panelWidthPx: number): string {\n return shellGradientPositionBar(panelWidthPx);\n}\n"],"mappings":"AAEO,MAAMA,EAA0B,0BAChC,MAAMC,EAAwB,wBCA/B,SAAUC,EAAkBC,EAAsBC,GACtD,UAAWC,WAAa,YAAa,OAAO,EAE5C,MAAMC,EAAQD,SAASE,cAAc,OACrCD,EAAME,MAAMC,QACV,8EACAL,EACA,KACFD,EAAQO,YAAYJ,GACpB,MAAMK,EAAQL,EAAMM,wBAAwBD,MAC5CR,EAAQU,YAAYP,GACpB,OAAOK,CACT,CAQM,SAAUG,EAAwBC,GACtC,MAAO,CACLC,WAAYd,EAAkBa,EAAS,gBACvCE,YAAaf,EAAkBa,EAAS,0BAE5C,CAEM,SAAUG,EACdC,EACAJ,GAEA,GAAIA,GAASK,UAAUC,SAAS,wBAAyB,OAAO,KAChE,MAAMC,EAAiBH,GAAiEI,UACxF,OAAOD,IAAkB,IAC3B,CAEM,SAAUE,EACdC,EACAF,GAEA,OAAOA,EAAYE,EAAOR,YAAcQ,EAAOT,UACjD,Q","ignoreList":[]}