@ds-mo/ui 2.10.0 → 2.10.2
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/dist/.build-stamp +1 -1
- package/dist/components/ds-app-shell.js +1 -1
- package/dist/components/ds-badge.js +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-button-filled.js +1 -1
- package/dist/components/ds-button-unfilled-icon.js +1 -1
- package/dist/components/ds-card-setting.js +1 -1
- package/dist/components/ds-checkbox.js +1 -1
- package/dist/components/ds-fade.js +1 -1
- package/dist/components/ds-fade.js.map +1 -1
- package/dist/components/ds-field.js +1 -1
- package/dist/components/ds-field.js.map +1 -1
- package/dist/components/ds-header.js +1 -1
- package/dist/components/ds-header.js.map +1 -1
- package/dist/components/ds-icon.js +1 -1
- package/dist/components/ds-input.js +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-modal.js +1 -1
- package/dist/components/ds-panel-nav.js +1 -1
- package/dist/components/ds-panel-nav.js.map +1 -1
- package/dist/components/ds-panel-tools.js +1 -1
- package/dist/components/ds-radio-group.js +1 -1
- package/dist/components/ds-scrollbar.js +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-shell-gradient-picker.js +1 -1
- package/dist/components/ds-shell-gradient-swatch.js +1 -1
- package/dist/components/ds-slider.js +1 -1
- package/dist/components/ds-surface.js +1 -1
- package/dist/components/ds-tab-group-nav.js +1 -1
- package/dist/components/ds-tab-group.js +1 -1
- package/dist/components/ds-table.js +1 -1
- package/dist/components/ds-table.js.map +1 -1
- package/dist/components/ds-tag.js +1 -1
- package/dist/components/ds-text.js +1 -1
- package/dist/components/ds-toast-provider.js +1 -1
- package/dist/components/ds-toggle.js +1 -1
- package/dist/components/ds-tooltip.js +1 -1
- package/dist/components/{p-CDNVPM2x.js → p-B46PyZkE.js} +2 -2
- package/dist/components/{p-Dul5eGGE.js → p-BOLhoDYO.js} +2 -2
- package/dist/components/{p-CKCBqwIw.js → p-BUKwjW6E.js} +2 -2
- package/dist/components/{p-CJubWt1F.js → p-BVg6jstc.js} +2 -2
- package/dist/components/p-Bz3jyrDV.js +2 -0
- package/dist/components/p-Bz3jyrDV.js.map +1 -0
- package/dist/components/{p-DnGr8qtq.js → p-ChDonLAn.js} +2 -2
- package/dist/components/p-CkFkSpa6.js +2 -0
- package/dist/components/p-CkFkSpa6.js.map +1 -0
- package/dist/components/{p-evjnuLjj.js → p-CpfTDXDO.js} +2 -2
- package/dist/components/{p-Cynjsv-P.js → p-D3Jehaex.js} +2 -2
- package/dist/components/{p-w2Wrf0jC.js → p-DnaPMGPJ.js} +2 -2
- package/dist/components/p-EK1hOP19.js +2 -0
- package/dist/components/p-EK1hOP19.js.map +1 -0
- package/dist/lib/components/Icon/icon-cache.d.ts +24 -0
- package/dist/lib/components/Menu/menu-placement.d.ts +23 -0
- package/dist/lib/components/Menu/menu-position.d.ts +19 -0
- package/dist/lib/nav/badge-gradient-ring.d.ts +27 -0
- package/dist/lib/nav/chrome-transition.d.ts +24 -0
- package/dist/lib/nav/index.d.ts +16 -0
- package/dist/lib/nav/index.js +419 -0
- package/dist/lib/nav/index.js.map +7 -0
- package/dist/lib/nav/nav-chrome.d.ts +9 -0
- package/dist/lib/nav/shell-chrome-metrics.d.ts +11 -0
- package/dist/lib/nav/shell-gradient-presets.d.ts +20 -0
- package/dist/lib/nav/shell-gradient.d.ts +43 -0
- package/dist/lib/nav/shell-view-transition.d.ts +23 -0
- package/dist/lib/utils/index.d.ts +7 -0
- package/dist/lib/utils/index.js +247 -0
- package/dist/lib/utils/index.js.map +7 -0
- package/dist/lib/utils/resolve-css-length-px.d.ts +7 -0
- package/dist/lib/utils/resolve-css-time-ms.d.ts +7 -0
- package/dist/lib/utils/scroll-edge-fade.d.ts +32 -0
- package/dist/lib/utils/token-defaults.d.ts +33 -0
- package/dist/types/components/Fade/Fade.d.ts +13 -15
- package/dist/types/components/Fade/index.d.ts +1 -1
- package/dist/types/components/PanelNav/PanelNav.d.ts +0 -3
- package/dist/types/components.d.ts +6 -28
- package/dist/types/nav/index.d.ts +1 -1
- package/dist/types/nav/shell-gradient-presets.d.ts +8 -0
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/scroll-edge-fade.d.ts +24 -4
- package/package.json +8 -7
- package/src/angular/proxies.ts +2 -2
- package/src/wc/components/Fade/Fade.tsx +40 -94
- package/src/wc/components/Fade/index.ts +1 -1
- package/src/wc/components/PanelNav/PanelNav.tsx +2 -20
- package/src/wc/components.d.ts +6 -28
- package/src/wc/nav/index.ts +1 -0
- package/src/wc/nav/shell-gradient-presets.ts +16 -2
- package/src/wc/utils/index.ts +10 -1
- package/src/wc/utils/scroll-edge-fade.css +6 -4
- package/src/wc/utils/scroll-edge-fade.ts +115 -5
- package/dist/components/p-0y48zKIF.js +0 -2
- package/dist/components/p-0y48zKIF.js.map +0 -1
- package/dist/components/p-BFPfyJ8Z.js +0 -2
- package/dist/components/p-BFPfyJ8Z.js.map +0 -1
- package/dist/components/p-BOpHKDOG.js +0 -2
- package/dist/components/p-BOpHKDOG.js.map +0 -1
- /package/dist/components/{p-CDNVPM2x.js.map → p-B46PyZkE.js.map} +0 -0
- /package/dist/components/{p-Dul5eGGE.js.map → p-BOLhoDYO.js.map} +0 -0
- /package/dist/components/{p-CKCBqwIw.js.map → p-BUKwjW6E.js.map} +0 -0
- /package/dist/components/{p-CJubWt1F.js.map → p-BVg6jstc.js.map} +0 -0
- /package/dist/components/{p-DnGr8qtq.js.map → p-ChDonLAn.js.map} +0 -0
- /package/dist/components/{p-evjnuLjj.js.map → p-CpfTDXDO.js.map} +0 -0
- /package/dist/components/{p-Cynjsv-P.js.map → p-D3Jehaex.js.map} +0 -0
- /package/dist/components/{p-w2Wrf0jC.js.map → p-DnaPMGPJ.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ds-mo/ui",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "CompoMo — composable web components styled with TokoMo design tokens",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"import": "./dist/components/index.js"
|
|
43
43
|
},
|
|
44
44
|
"./nav": {
|
|
45
|
-
"types": "./
|
|
46
|
-
"import": "./
|
|
45
|
+
"types": "./dist/lib/nav/index.d.ts",
|
|
46
|
+
"import": "./dist/lib/nav/index.js"
|
|
47
47
|
},
|
|
48
48
|
"./utils": {
|
|
49
|
-
"types": "./
|
|
50
|
-
"import": "./
|
|
49
|
+
"types": "./dist/lib/utils/index.d.ts",
|
|
50
|
+
"import": "./dist/lib/utils/index.js"
|
|
51
51
|
},
|
|
52
52
|
"./dist/components/*": "./dist/components/*"
|
|
53
53
|
},
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"prebuild": "node scripts/generate-icon-catalog.mjs",
|
|
68
68
|
"pretypecheck": "node scripts/generate-icon-catalog.mjs",
|
|
69
69
|
"pretest": "node scripts/generate-icon-catalog.mjs",
|
|
70
|
-
"build": "stencil build && node scripts/patch-index-types.mjs && node scripts/patch-components-d-exports.mjs && node scripts/verify-icons-externalized.mjs && node scripts/write-build-stamp.mjs",
|
|
70
|
+
"build": "stencil build && node scripts/patch-index-types.mjs && node scripts/patch-components-d-exports.mjs && node scripts/verify-icons-externalized.mjs && node scripts/write-build-stamp.mjs && node scripts/build-lib-exports.mjs",
|
|
71
71
|
"verify:pack": "node scripts/verify-npm-pack.mjs && node scripts/verify-nav-import.mjs",
|
|
72
72
|
"test": "node --import tsx/esm --test tests/panel-nav-utils.test.ts tests/panel-tools.test.ts tests/shell-shortcuts.test.ts tests/shell-gradient-presets.test.ts tests/shell-view-transition.test.ts tests/shell-gradient.test.ts tests/shell-chrome-metrics.test.ts tests/shell-chrome-layer.test.ts tests/chrome-transition.test.ts tests/bar-nav-overflow-hysteresis.test.ts tests/badge-gradient-ring.test.ts tests/scroll-edge-fade.test.ts tests/resolve-css-length-px.test.ts tests/resolve-css-time-ms.test.ts tests/overlay-positioning.test.ts tests/menu-position.test.ts tests/menu-placement.test.ts tests/bar-nav-utils.test.ts tests/bar-nav-tabs-menu-utils.test.ts tests/bar-nav-dom-utils.test.ts tests/icon-catalog.test.ts tests/icon-cache.test.ts tests/icon-svg.test.ts",
|
|
73
73
|
"test:e2e": "npm run build && playwright test",
|
|
@@ -130,7 +130,8 @@
|
|
|
130
130
|
"typescript": "~6.0.3",
|
|
131
131
|
"typescript-eslint": "^8.59.1",
|
|
132
132
|
"vite": "^8.0.16",
|
|
133
|
-
"zod": "^4.4.3"
|
|
133
|
+
"zod": "^4.4.3",
|
|
134
|
+
"esbuild": "^0.28.0"
|
|
134
135
|
},
|
|
135
136
|
"engines": {
|
|
136
137
|
"node": "^20.19.0 || >=22.12.0"
|
package/src/angular/proxies.ts
CHANGED
|
@@ -398,14 +398,14 @@ export declare interface DsEmptyState extends Components.DsEmptyState {}
|
|
|
398
398
|
|
|
399
399
|
|
|
400
400
|
@ProxyCmp({
|
|
401
|
-
inputs: ['
|
|
401
|
+
inputs: ['height', 'side', 'size', 'visible']
|
|
402
402
|
})
|
|
403
403
|
@Component({
|
|
404
404
|
selector: 'ds-fade',
|
|
405
405
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
406
406
|
template: '<ng-content></ng-content>',
|
|
407
407
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
408
|
-
inputs: ['
|
|
408
|
+
inputs: ['height', 'side', 'size', 'visible'],
|
|
409
409
|
standalone: false
|
|
410
410
|
})
|
|
411
411
|
export class DsFade {
|
|
@@ -1,54 +1,21 @@
|
|
|
1
|
-
import { Component,
|
|
2
|
-
import {
|
|
1
|
+
import { Component, Element, Prop, State, Watch, h, Host } from '@stencil/core';
|
|
2
|
+
import {
|
|
3
|
+
isScrollAtEdge,
|
|
4
|
+
scrollEdgeFadeClassMap,
|
|
5
|
+
scrollEdgeFadeSizeStyle,
|
|
6
|
+
type ScrollEdgeFadeEdge,
|
|
7
|
+
type ScrollEdgeFadeSize,
|
|
8
|
+
type ScrollEdgeFadeSizeToken,
|
|
9
|
+
} from '../../utils/scroll-edge-fade';
|
|
3
10
|
|
|
4
|
-
|
|
5
|
-
export type
|
|
6
|
-
| 'default'
|
|
7
|
-
| 'primary'
|
|
8
|
-
| 'secondary'
|
|
9
|
-
| 'navigation'
|
|
10
|
-
| 'media'
|
|
11
|
-
| 'always-dark'
|
|
12
|
-
| 'inverted';
|
|
13
|
-
export type FadeSizeToken =
|
|
14
|
-
| 'size-000'
|
|
15
|
-
| 'size-050'
|
|
16
|
-
| 'size-075'
|
|
17
|
-
| 'size-100'
|
|
18
|
-
| 'size-150'
|
|
19
|
-
| 'size-200'
|
|
20
|
-
| 'size-250'
|
|
21
|
-
| 'size-300'
|
|
22
|
-
| 'size-400'
|
|
23
|
-
| 'size-500'
|
|
24
|
-
| 'size-600'
|
|
25
|
-
| 'size-800';
|
|
26
|
-
export type FadeSize = FadeSizeToken | (string & {});
|
|
11
|
+
/** @deprecated Use `ScrollEdgeFadeEdge` from `@ds-mo/ui/utils`. */
|
|
12
|
+
export type FadeSide = ScrollEdgeFadeEdge;
|
|
27
13
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'size-050': 'var(--dimension-size-050)',
|
|
31
|
-
'size-075': 'var(--dimension-size-075)',
|
|
32
|
-
'size-100': 'var(--dimension-size-100)',
|
|
33
|
-
'size-150': 'var(--dimension-size-150)',
|
|
34
|
-
'size-200': 'var(--dimension-size-200)',
|
|
35
|
-
'size-250': 'var(--dimension-size-250)',
|
|
36
|
-
'size-300': 'var(--dimension-size-300)',
|
|
37
|
-
'size-400': 'var(--dimension-size-400)',
|
|
38
|
-
'size-500': 'var(--dimension-size-500)',
|
|
39
|
-
'size-600': 'var(--dimension-size-600)',
|
|
40
|
-
'size-800': 'var(--dimension-size-800)',
|
|
41
|
-
};
|
|
14
|
+
/** @deprecated Use `ScrollEdgeFadeSizeToken` from `@ds-mo/ui/utils`. */
|
|
15
|
+
export type FadeSizeToken = ScrollEdgeFadeSizeToken;
|
|
42
16
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
primary: 'var(--color-background-primary)',
|
|
46
|
-
secondary: 'var(--color-background-secondary)',
|
|
47
|
-
navigation: 'var(--color-navigation-background)',
|
|
48
|
-
media: 'var(--color-media-background)',
|
|
49
|
-
'always-dark': 'var(--color-always-dark-background)',
|
|
50
|
-
inverted: 'var(--color-inverted-background)',
|
|
51
|
-
};
|
|
17
|
+
/** @deprecated Use `ScrollEdgeFadeSize` from `@ds-mo/ui/utils`. */
|
|
18
|
+
export type FadeSize = ScrollEdgeFadeSize;
|
|
52
19
|
|
|
53
20
|
@Component({
|
|
54
21
|
tag: 'ds-fade',
|
|
@@ -58,10 +25,7 @@ const SURFACE_BACKGROUND: Record<FadeSurface, string> = {
|
|
|
58
25
|
export class Fade {
|
|
59
26
|
@Element() el!: HTMLElement;
|
|
60
27
|
|
|
61
|
-
/**
|
|
62
|
-
@State() private shellGradientChrome: 'panel' | 'bar' | null = null;
|
|
63
|
-
|
|
64
|
-
/** Edge where the fade is anchored. */
|
|
28
|
+
/** Edge where content fades as it approaches the scroll boundary. */
|
|
65
29
|
@Prop() side: FadeSide = 'bottom';
|
|
66
30
|
|
|
67
31
|
/** Fade depth along the fade axis. Accepts dimension size token names or any CSS length. */
|
|
@@ -73,61 +37,43 @@ export class Fade {
|
|
|
73
37
|
*/
|
|
74
38
|
@Prop() height: string | undefined;
|
|
75
39
|
|
|
76
|
-
/**
|
|
77
|
-
@Prop() surface: FadeSurface = 'default';
|
|
78
|
-
|
|
79
|
-
/** Direct background override for contexts that already expose a resolved surface var. */
|
|
80
|
-
@Prop() background: string = 'var(--color-background-secondary)';
|
|
81
|
-
|
|
82
|
-
/** Controls visibility without removing the element from layout/positioning. */
|
|
40
|
+
/** Controls the mask without removing the scroll container from layout. */
|
|
83
41
|
@Prop() visible: boolean = true;
|
|
84
42
|
|
|
85
|
-
|
|
86
|
-
this.syncShellGradient();
|
|
87
|
-
}
|
|
43
|
+
@State() private atEnd = false;
|
|
88
44
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
this.shellGradientChrome = this.el.closest('ds-bar-nav') ? 'bar' : 'panel';
|
|
45
|
+
@Watch('side')
|
|
46
|
+
@Watch('visible')
|
|
47
|
+
protected onFadeConfigChange() {
|
|
48
|
+
this.syncAtEnd();
|
|
95
49
|
}
|
|
96
50
|
|
|
97
|
-
|
|
98
|
-
|
|
51
|
+
componentDidLoad() {
|
|
52
|
+
this.syncAtEnd();
|
|
53
|
+
}
|
|
99
54
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
: this.size;
|
|
55
|
+
private syncAtEnd() {
|
|
56
|
+
this.atEnd = isScrollAtEdge(this.el, this.side);
|
|
103
57
|
}
|
|
104
58
|
|
|
105
|
-
private
|
|
106
|
-
|
|
107
|
-
|
|
59
|
+
private handleScroll(e: Event) {
|
|
60
|
+
const target = e.currentTarget as HTMLElement;
|
|
61
|
+
this.atEnd = isScrollAtEdge(target, this.side);
|
|
108
62
|
}
|
|
109
63
|
|
|
110
64
|
render() {
|
|
111
|
-
const isVerticalEdge = this.side === 'top' || this.side === 'bottom';
|
|
112
|
-
|
|
113
65
|
return (
|
|
114
66
|
<Host
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}}
|
|
126
|
-
style={{
|
|
127
|
-
'--ds-fade-size': this.resolveSize(),
|
|
128
|
-
'--ds-fade-bg': this.resolveBackground(),
|
|
129
|
-
} as Record<string, string>}
|
|
130
|
-
/>
|
|
67
|
+
class={scrollEdgeFadeClassMap({
|
|
68
|
+
edges: this.side,
|
|
69
|
+
atEnd: { [this.side]: this.atEnd },
|
|
70
|
+
hidden: !this.visible,
|
|
71
|
+
})}
|
|
72
|
+
style={scrollEdgeFadeSizeStyle(this.size, this.height) as Record<string, string>}
|
|
73
|
+
onScroll={(e: Event) => this.handleScroll(e)}
|
|
74
|
+
>
|
|
75
|
+
<slot />
|
|
76
|
+
</Host>
|
|
131
77
|
);
|
|
132
78
|
}
|
|
133
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { FadeSide, FadeSize, FadeSizeToken
|
|
1
|
+
export type { FadeSide, FadeSize, FadeSizeToken } from './Fade';
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
type PanelNavRouterMode,
|
|
18
18
|
type PanelNavUserActionDetail,
|
|
19
19
|
} from './panel-nav-types';
|
|
20
|
+
import { scrollEdgeFadeClassMap } from '../../utils/scroll-edge-fade';
|
|
20
21
|
|
|
21
22
|
@Component({
|
|
22
23
|
tag: 'ds-panel-nav',
|
|
@@ -88,7 +89,6 @@ export class PanelNav {
|
|
|
88
89
|
|
|
89
90
|
@State() private renderedStyle: NavChromeStyle = 'dashboard';
|
|
90
91
|
@State() private parsedGroups: PanelNavGroup[] = [];
|
|
91
|
-
@State() private atBottom = false;
|
|
92
92
|
@State() private isAnimating = false;
|
|
93
93
|
@State() private rovingIndex: number = 0;
|
|
94
94
|
@State() private viewportNarrow: boolean = false;
|
|
@@ -179,7 +179,6 @@ export class PanelNav {
|
|
|
179
179
|
componentDidLoad() {
|
|
180
180
|
this.syncHostPropsIfNeeded();
|
|
181
181
|
this.scheduleDeferredHostPropSync();
|
|
182
|
-
this.checkScroll();
|
|
183
182
|
if (this.breakpoint > 0) this.connectResizeObserver();
|
|
184
183
|
}
|
|
185
184
|
|
|
@@ -389,19 +388,6 @@ export class PanelNav {
|
|
|
389
388
|
this.focusRovingAt(next);
|
|
390
389
|
}
|
|
391
390
|
|
|
392
|
-
private checkScroll() {
|
|
393
|
-
const body = this.el.querySelector('.panel-nav__body') as HTMLElement | null;
|
|
394
|
-
if (!body) return;
|
|
395
|
-
const remaining = body.scrollHeight - body.scrollTop - body.clientHeight;
|
|
396
|
-
this.atBottom = remaining < 2;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
private handleBodyScroll(e: Event) {
|
|
400
|
-
const body = e.target as HTMLElement;
|
|
401
|
-
const remaining = body.scrollHeight - body.scrollTop - body.clientHeight;
|
|
402
|
-
this.atBottom = remaining < 2;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
391
|
private handleItemClick(id: string) {
|
|
406
392
|
this.dsNavSelect.emit(id);
|
|
407
393
|
}
|
|
@@ -558,7 +544,6 @@ export class PanelNav {
|
|
|
558
544
|
'panel-nav--settings': !isDashboard,
|
|
559
545
|
'panel-nav--collapsed': collapsed,
|
|
560
546
|
'panel-nav--animating': this.isAnimating,
|
|
561
|
-
'panel-nav--at-bottom': this.atBottom,
|
|
562
547
|
};
|
|
563
548
|
|
|
564
549
|
return (
|
|
@@ -601,11 +586,8 @@ export class PanelNav {
|
|
|
601
586
|
<div
|
|
602
587
|
class={{
|
|
603
588
|
'panel-nav__body': true,
|
|
604
|
-
'
|
|
605
|
-
'scroll-edge-fade--bottom': true,
|
|
606
|
-
'scroll-edge-fade--at-end': this.atBottom,
|
|
589
|
+
...scrollEdgeFadeClassMap({ edges: 'bottom' }),
|
|
607
590
|
}}
|
|
608
|
-
onScroll={e => this.handleBodyScroll(e)}
|
|
609
591
|
>
|
|
610
592
|
{(() => {
|
|
611
593
|
let flatIdx = 0;
|
package/src/wc/components.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { CardSettingWidth } from "./components/CardSetting/CardSetting";
|
|
|
19
19
|
import { ChipBackground, ChipContrast, ChipElevation, ChipIntent, ChipSize } from "./components/Chip/Chip";
|
|
20
20
|
import { DividerInset, DividerLength, DividerOrientation, DividerSurface } from "./components/Divider/Divider";
|
|
21
21
|
import { EmptyStateType } from "./components/EmptyState/EmptyState";
|
|
22
|
-
import { FadeSide, FadeSize
|
|
22
|
+
import { FadeSide, FadeSize } from "./components/Fade/Fade";
|
|
23
23
|
import { HeaderBackground } from "./components/Header/Header";
|
|
24
24
|
import { IconColor, IconSize } from "./components/Icon/Icon";
|
|
25
25
|
import { InputType } from "./components/Input/Input";
|
|
@@ -57,7 +57,7 @@ export { CardSettingWidth } from "./components/CardSetting/CardSetting";
|
|
|
57
57
|
export { ChipBackground, ChipContrast, ChipElevation, ChipIntent, ChipSize } from "./components/Chip/Chip";
|
|
58
58
|
export { DividerInset, DividerLength, DividerOrientation, DividerSurface } from "./components/Divider/Divider";
|
|
59
59
|
export { EmptyStateType } from "./components/EmptyState/EmptyState";
|
|
60
|
-
export { FadeSide, FadeSize
|
|
60
|
+
export { FadeSide, FadeSize } from "./components/Fade/Fade";
|
|
61
61
|
export { HeaderBackground } from "./components/Header/Header";
|
|
62
62
|
export { IconColor, IconSize } from "./components/Icon/Icon";
|
|
63
63
|
export { InputType } from "./components/Input/Input";
|
|
@@ -445,17 +445,12 @@ export namespace Components {
|
|
|
445
445
|
"type": EmptyStateType;
|
|
446
446
|
}
|
|
447
447
|
interface DsFade {
|
|
448
|
-
/**
|
|
449
|
-
* Direct background override for contexts that already expose a resolved surface var.
|
|
450
|
-
* @default 'var(--color-background-secondary)'
|
|
451
|
-
*/
|
|
452
|
-
"background": string;
|
|
453
448
|
/**
|
|
454
449
|
* Deprecated alias for size. Kept for existing consumers that pass a raw CSS length. Prefer `size`.
|
|
455
450
|
*/
|
|
456
451
|
"height": string | undefined;
|
|
457
452
|
/**
|
|
458
|
-
* Edge where the
|
|
453
|
+
* Edge where content fades as it approaches the scroll boundary.
|
|
459
454
|
* @default 'bottom'
|
|
460
455
|
*/
|
|
461
456
|
"side": FadeSide;
|
|
@@ -465,12 +460,7 @@ export namespace Components {
|
|
|
465
460
|
*/
|
|
466
461
|
"size": FadeSize;
|
|
467
462
|
/**
|
|
468
|
-
*
|
|
469
|
-
* @default 'default'
|
|
470
|
-
*/
|
|
471
|
-
"surface": FadeSurface;
|
|
472
|
-
/**
|
|
473
|
-
* Controls visibility without removing the element from layout/positioning.
|
|
463
|
+
* Controls the mask without removing the scroll container from layout.
|
|
474
464
|
* @default true
|
|
475
465
|
*/
|
|
476
466
|
"visible": boolean;
|
|
@@ -2134,17 +2124,12 @@ declare namespace LocalJSX {
|
|
|
2134
2124
|
"type"?: EmptyStateType;
|
|
2135
2125
|
}
|
|
2136
2126
|
interface DsFade {
|
|
2137
|
-
/**
|
|
2138
|
-
* Direct background override for contexts that already expose a resolved surface var.
|
|
2139
|
-
* @default 'var(--color-background-secondary)'
|
|
2140
|
-
*/
|
|
2141
|
-
"background"?: string;
|
|
2142
2127
|
/**
|
|
2143
2128
|
* Deprecated alias for size. Kept for existing consumers that pass a raw CSS length. Prefer `size`.
|
|
2144
2129
|
*/
|
|
2145
2130
|
"height"?: string | undefined;
|
|
2146
2131
|
/**
|
|
2147
|
-
* Edge where the
|
|
2132
|
+
* Edge where content fades as it approaches the scroll boundary.
|
|
2148
2133
|
* @default 'bottom'
|
|
2149
2134
|
*/
|
|
2150
2135
|
"side"?: FadeSide;
|
|
@@ -2154,12 +2139,7 @@ declare namespace LocalJSX {
|
|
|
2154
2139
|
*/
|
|
2155
2140
|
"size"?: FadeSize;
|
|
2156
2141
|
/**
|
|
2157
|
-
*
|
|
2158
|
-
* @default 'default'
|
|
2159
|
-
*/
|
|
2160
|
-
"surface"?: FadeSurface;
|
|
2161
|
-
/**
|
|
2162
|
-
* Controls visibility without removing the element from layout/positioning.
|
|
2142
|
+
* Controls the mask without removing the scroll container from layout.
|
|
2163
2143
|
* @default true
|
|
2164
2144
|
*/
|
|
2165
2145
|
"visible"?: boolean;
|
|
@@ -2916,8 +2896,6 @@ declare namespace LocalJSX {
|
|
|
2916
2896
|
"side": FadeSide;
|
|
2917
2897
|
"size": FadeSize;
|
|
2918
2898
|
"height": string | undefined;
|
|
2919
|
-
"surface": FadeSurface;
|
|
2920
|
-
"background": string;
|
|
2921
2899
|
"visible": boolean;
|
|
2922
2900
|
}
|
|
2923
2901
|
interface DsFieldAttributes {
|
package/src/wc/nav/index.ts
CHANGED
|
@@ -48,6 +48,7 @@ export {
|
|
|
48
48
|
SHELL_GRADIENT_PRESET_LABELS,
|
|
49
49
|
buildShellRadialGradientForPreset,
|
|
50
50
|
isShellGradientPreset,
|
|
51
|
+
normalizeShellGradientPreset,
|
|
51
52
|
shellGradientPresetStopToken,
|
|
52
53
|
} from './shell-gradient-presets';
|
|
53
54
|
export type { ChromeTransitionDetail, ChromeTransitionSource } from './chrome-transition';
|
|
@@ -37,10 +37,24 @@ export function isShellGradientPreset(value: string): value is ShellGradientPres
|
|
|
37
37
|
return (SHELL_GRADIENT_PRESETS as string[]).includes(value);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Coerce unknown/absent presets to the default. Runtime values escape the
|
|
42
|
+
* type: removing the reflected `gradient-preset` attribute (e.g. an Angular
|
|
43
|
+
* `[attr.gradient-preset]="null"` binding) drives the prop to null past its
|
|
44
|
+
* field default — without normalization the stop lookup interpolates the
|
|
45
|
+
* literal string "undefined" into CSS and the wash silently disappears.
|
|
46
|
+
*/
|
|
47
|
+
export function normalizeShellGradientPreset(
|
|
48
|
+
value: string | null | undefined,
|
|
49
|
+
): ShellGradientPreset {
|
|
50
|
+
return value != null && isShellGradientPreset(value) ? value : DEFAULT_SHELL_GRADIENT_PRESET;
|
|
51
|
+
}
|
|
52
|
+
|
|
40
53
|
/** Radial wash for a preset — transparent at top-left into the intent stop. `none` returns no image. */
|
|
41
54
|
export function buildShellRadialGradientForPreset(preset: ShellGradientPreset): string {
|
|
42
|
-
|
|
55
|
+
const normalized = normalizeShellGradientPreset(preset);
|
|
56
|
+
if (normalized === 'none') return 'none';
|
|
43
57
|
|
|
44
|
-
const stop = shellGradientPresetStopToken(
|
|
58
|
+
const stop = shellGradientPresetStopToken(normalized);
|
|
45
59
|
return `radial-gradient(${GRADIENT_GEOMETRY}, var(--color-background-transparent) 0%, ${stop} 100%)`;
|
|
46
60
|
}
|
package/src/wc/utils/index.ts
CHANGED
|
@@ -4,9 +4,18 @@ export { parseCssTimeMs, resolveCssTimeMs } from './resolve-css-time-ms';
|
|
|
4
4
|
export {
|
|
5
5
|
SCROLL_EDGE_FADE_DEFAULT_SIZE,
|
|
6
6
|
SCROLL_EDGE_FADE_SIZE_VAR,
|
|
7
|
+
isScrollAtEdge,
|
|
8
|
+
resolveScrollEdgeFadeSize,
|
|
9
|
+
scrollEdgeFadeClassMap,
|
|
7
10
|
scrollEdgeFadeMaskImage,
|
|
8
11
|
scrollEdgeFadeMaskStyle,
|
|
12
|
+
scrollEdgeFadeSizeStyle,
|
|
13
|
+
} from './scroll-edge-fade';
|
|
14
|
+
export type {
|
|
15
|
+
ScrollEdgeFadeEdge,
|
|
16
|
+
ScrollEdgeFadeOptions,
|
|
17
|
+
ScrollEdgeFadeSize,
|
|
18
|
+
ScrollEdgeFadeSizeToken,
|
|
9
19
|
} from './scroll-edge-fade';
|
|
10
|
-
export type { ScrollEdgeFadeEdge } from './scroll-edge-fade';
|
|
11
20
|
export { TOKEN_DEFAULTS, TOKEN_CSS_LENGTHS } from './token-defaults';
|
|
12
21
|
export type { TokenDefaultKey } from './token-defaults';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Scroll-edge alpha fade —
|
|
3
|
-
*
|
|
2
|
+
* Scroll-edge alpha fade — the single edge-fade utility for overflow containers.
|
|
3
|
+
* Masks scrolling content to transparent so flat surfaces, shell gradients, and
|
|
4
|
+
* images show through. Pair with `.scroll-edge-fade--at-end` when flush.
|
|
4
5
|
*
|
|
5
|
-
* @see scroll-edge-fade.ts
|
|
6
|
+
* @see scroll-edge-fade.ts — `scrollEdgeFadeClassMap`, `isScrollAtEdge`, size helpers.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
.scroll-edge-fade {
|
|
@@ -67,7 +68,8 @@
|
|
|
67
68
|
mask-size: 100% 100%;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
.scroll-edge-fade--at-end
|
|
71
|
+
.scroll-edge-fade--at-end,
|
|
72
|
+
.scroll-edge-fade--hidden {
|
|
71
73
|
-webkit-mask-image: none;
|
|
72
74
|
mask-image: none;
|
|
73
75
|
}
|
|
@@ -5,12 +5,75 @@ export const SCROLL_EDGE_FADE_DEFAULT_SIZE = 'var(--dimension-size-600)';
|
|
|
5
5
|
|
|
6
6
|
export type ScrollEdgeFadeEdge = 'top' | 'bottom' | 'left' | 'right';
|
|
7
7
|
|
|
8
|
+
export type ScrollEdgeFadeSizeToken =
|
|
9
|
+
| 'size-000'
|
|
10
|
+
| 'size-050'
|
|
11
|
+
| 'size-075'
|
|
12
|
+
| 'size-100'
|
|
13
|
+
| 'size-150'
|
|
14
|
+
| 'size-200'
|
|
15
|
+
| 'size-250'
|
|
16
|
+
| 'size-300'
|
|
17
|
+
| 'size-400'
|
|
18
|
+
| 'size-500'
|
|
19
|
+
| 'size-600'
|
|
20
|
+
| 'size-800';
|
|
21
|
+
|
|
22
|
+
export type ScrollEdgeFadeSize = ScrollEdgeFadeSizeToken | (string & {});
|
|
23
|
+
|
|
24
|
+
const SIZE_VALUE: Record<ScrollEdgeFadeSizeToken, string> = {
|
|
25
|
+
'size-000': 'var(--dimension-size-000)',
|
|
26
|
+
'size-050': 'var(--dimension-size-050)',
|
|
27
|
+
'size-075': 'var(--dimension-size-075)',
|
|
28
|
+
'size-100': 'var(--dimension-size-100)',
|
|
29
|
+
'size-150': 'var(--dimension-size-150)',
|
|
30
|
+
'size-200': 'var(--dimension-size-200)',
|
|
31
|
+
'size-250': 'var(--dimension-size-250)',
|
|
32
|
+
'size-300': 'var(--dimension-size-300)',
|
|
33
|
+
'size-400': 'var(--dimension-size-400)',
|
|
34
|
+
'size-500': 'var(--dimension-size-500)',
|
|
35
|
+
'size-600': 'var(--dimension-size-600)',
|
|
36
|
+
'size-800': 'var(--dimension-size-800)',
|
|
37
|
+
};
|
|
38
|
+
|
|
8
39
|
const SIZE_REF = `var(${SCROLL_EDGE_FADE_SIZE_VAR}, ${SCROLL_EDGE_FADE_DEFAULT_SIZE})`;
|
|
9
40
|
|
|
41
|
+
export interface ScrollEdgeFadeOptions {
|
|
42
|
+
/** One or more edges to fade. */
|
|
43
|
+
edges: ScrollEdgeFadeEdge | ScrollEdgeFadeEdge[];
|
|
44
|
+
/**
|
|
45
|
+
* When true, or when every listed edge is at its scroll limit, removes the mask.
|
|
46
|
+
* Pass a per-edge map to hide only the edges that are flush (panel-nav bottom fade).
|
|
47
|
+
*/
|
|
48
|
+
atEnd?: boolean | Partial<Record<ScrollEdgeFadeEdge, boolean>>;
|
|
49
|
+
/** Force the mask off regardless of scroll position (`ds-fade` `visible={false}`). */
|
|
50
|
+
hidden?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Resolve a dimension size token name or raw CSS length for `--ds-scroll-edge-fade-size`. */
|
|
54
|
+
export function resolveScrollEdgeFadeSize(
|
|
55
|
+
size: ScrollEdgeFadeSize = 'size-600',
|
|
56
|
+
height?: string,
|
|
57
|
+
): string {
|
|
58
|
+
if (height) return height;
|
|
59
|
+
return Object.prototype.hasOwnProperty.call(SIZE_VALUE, size)
|
|
60
|
+
? SIZE_VALUE[size as ScrollEdgeFadeSizeToken]
|
|
61
|
+
: size;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Inline style map setting fade depth on a scroll container. */
|
|
65
|
+
export function scrollEdgeFadeSizeStyle(
|
|
66
|
+
size: ScrollEdgeFadeSize = 'size-600',
|
|
67
|
+
height?: string,
|
|
68
|
+
): Record<string, string> {
|
|
69
|
+
return {
|
|
70
|
+
[SCROLL_EDGE_FADE_SIZE_VAR]: resolveScrollEdgeFadeSize(size, height),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
10
74
|
/**
|
|
11
75
|
* Alpha mask for a scroll container edge — content fades to transparent so
|
|
12
|
-
* textured backgrounds (gradients, images) show through.
|
|
13
|
-
* `ds-fade` overlays on non-flat surfaces.
|
|
76
|
+
* textured backgrounds (shell gradients, images) show through.
|
|
14
77
|
*/
|
|
15
78
|
export function scrollEdgeFadeMaskImage(edge: ScrollEdgeFadeEdge): string {
|
|
16
79
|
switch (edge) {
|
|
@@ -25,14 +88,61 @@ export function scrollEdgeFadeMaskImage(edge: ScrollEdgeFadeEdge): string {
|
|
|
25
88
|
}
|
|
26
89
|
}
|
|
27
90
|
|
|
28
|
-
/** Inline style map for a masked scroll region. */
|
|
29
|
-
export function scrollEdgeFadeMaskStyle(
|
|
91
|
+
/** Inline style map for a masked scroll region (single edge). */
|
|
92
|
+
export function scrollEdgeFadeMaskStyle(
|
|
93
|
+
edge: ScrollEdgeFadeEdge,
|
|
94
|
+
size: ScrollEdgeFadeSize = 'size-600',
|
|
95
|
+
height?: string,
|
|
96
|
+
): Record<string, string> {
|
|
30
97
|
const mask = scrollEdgeFadeMaskImage(edge);
|
|
31
98
|
return {
|
|
32
|
-
|
|
99
|
+
...scrollEdgeFadeSizeStyle(size, height),
|
|
33
100
|
WebkitMaskImage: mask,
|
|
34
101
|
maskImage: mask,
|
|
35
102
|
WebkitMaskSize: '100% 100%',
|
|
36
103
|
maskSize: '100% 100%',
|
|
37
104
|
};
|
|
38
105
|
}
|
|
106
|
+
|
|
107
|
+
/** Class map for `scroll-edge-fade` modifiers — pair with `scroll-edge-fade.css`. */
|
|
108
|
+
export function scrollEdgeFadeClassMap(opts: ScrollEdgeFadeOptions): Record<string, boolean> {
|
|
109
|
+
const edges = Array.isArray(opts.edges) ? opts.edges : [opts.edges];
|
|
110
|
+
const classes: Record<string, boolean> = {
|
|
111
|
+
'scroll-edge-fade': true,
|
|
112
|
+
'scroll-edge-fade--hidden': opts.hidden === true,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
for (const edge of edges) {
|
|
116
|
+
classes[`scroll-edge-fade--${edge}`] = true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const { atEnd } = opts;
|
|
120
|
+
if (atEnd === true) {
|
|
121
|
+
classes['scroll-edge-fade--at-end'] = true;
|
|
122
|
+
} else if (atEnd && typeof atEnd === 'object') {
|
|
123
|
+
const allAtEnd = edges.every(edge => atEnd[edge]);
|
|
124
|
+
if (allAtEnd) {
|
|
125
|
+
classes['scroll-edge-fade--at-end'] = true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return classes;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Whether a scroll container is flush with the given edge (within `threshold` px). */
|
|
133
|
+
export function isScrollAtEdge(
|
|
134
|
+
el: HTMLElement,
|
|
135
|
+
edge: ScrollEdgeFadeEdge,
|
|
136
|
+
threshold = 2,
|
|
137
|
+
): boolean {
|
|
138
|
+
switch (edge) {
|
|
139
|
+
case 'top':
|
|
140
|
+
return el.scrollTop <= threshold;
|
|
141
|
+
case 'bottom':
|
|
142
|
+
return el.scrollHeight - el.scrollTop - el.clientHeight <= threshold;
|
|
143
|
+
case 'left':
|
|
144
|
+
return el.scrollLeft <= threshold;
|
|
145
|
+
case 'right':
|
|
146
|
+
return el.scrollWidth - el.scrollLeft - el.clientWidth <= threshold;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const n=["cool","neutral","warm"];const t="neutral";const o={none:"None",cool:"Cool",neutral:"Neutral",warm:"Warm"};const r={cool:"var(--color-color-intent-blue-strong-background)",neutral:"var(--color-color-intent-grey-strong-background)",warm:"var(--color-color-intent-yellow-strong-background)"};const a="100% 100% at 0% 0%";function e(n){if(n==="none")return null;return r[n]}function s(n){if(n==="none")return"none";const t=e(n);return`radial-gradient(${a}, var(--color-background-transparent) 0%, ${t} 100%)`}const c="--ds-shell-gradient-image";const l="--ds-shell-gradient-size";const i="--ds-shell-gradient-position-panel";const u="--ds-shell-gradient-position-bar";const d="--ds-shell-gradient-opacity";const g="0.1";function h(n=t){return s(n)}function f(n){const t=typeof globalThis.window!=="undefined"?globalThis.window:undefined;if(!t)return{width:0,height:0};const o=t.visualViewport;return{width:Math.round(o?.width??t.innerWidth),height:Math.round(o?.height??t.innerHeight)}}function p(n){return`${Math.round(n.width)}px ${Math.round(n.height)}px`}function b(){return"0 0"}function w(n){return`${-Math.round(n)}px 0`}export{t as D,n as S,o as a,g as b,s as c,c as d,l as e,d as f,i as g,u as h,w as i,h as j,p as k,f as r,b as s};
|
|
2
|
-
//# sourceMappingURL=p-0y48zKIF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["SHELL_GRADIENT_WASH_PRESETS","DEFAULT_SHELL_GRADIENT_PRESET","SHELL_GRADIENT_PRESET_LABELS","none","cool","neutral","warm","SHELL_GRADIENT_PRESET_STOP","GRADIENT_GEOMETRY","shellGradientPresetStopToken","preset","buildShellRadialGradientForPreset","stop","SHELL_GRADIENT_IMAGE_VAR","SHELL_GRADIENT_SIZE_VAR","SHELL_GRADIENT_POSITION_PANEL_VAR","SHELL_GRADIENT_POSITION_BAR_VAR","SHELL_GRADIENT_OPACITY_VAR","SHELL_GRADIENT_OPACITY","buildShellRadialGradient","readShellViewportDimensions","win","w","globalThis","window","undefined","width","height","visual","visualViewport","Math","round","innerWidth","innerHeight","shellGradientSize","layout","shellGradientPositionPanel","shellGradientPositionBar","panelWidth"],"sources":["src/wc/nav/shell-gradient-presets.ts","src/wc/nav/shell-gradient.ts"],"sourcesContent":["/** Built-in shell chrome wash presets — none (solid secondary), cool, neutral, warm. */\nexport type ShellGradientPreset = 'none' | 'cool' | 'neutral' | 'warm';\n\nexport const SHELL_GRADIENT_PRESETS: ShellGradientPreset[] = ['none', 'cool', 'neutral', 'warm'];\n\n/** Wash presets shown after the `none` option in pickers. */\nexport const SHELL_GRADIENT_WASH_PRESETS: Exclude<ShellGradientPreset, 'none'>[] = [\n 'cool',\n 'neutral',\n 'warm',\n];\n\n/** Default wash when `gradient-preset` is omitted. */\nexport const DEFAULT_SHELL_GRADIENT_PRESET: ShellGradientPreset = 'neutral';\n\nexport const SHELL_GRADIENT_PRESET_LABELS: Record<ShellGradientPreset, string> = {\n none: 'None',\n cool: 'Cool',\n neutral: 'Neutral',\n warm: 'Warm',\n};\n\nconst SHELL_GRADIENT_PRESET_STOP: Record<Exclude<ShellGradientPreset, 'none'>, string> = {\n cool: 'var(--color-color-intent-blue-strong-background)',\n neutral: 'var(--color-color-intent-grey-strong-background)',\n warm: 'var(--color-color-intent-yellow-strong-background)',\n};\n\nconst GRADIENT_GEOMETRY = '100% 100% at 0% 0%';\n\nexport function shellGradientPresetStopToken(preset: ShellGradientPreset): string | null {\n if (preset === 'none') return null;\n return SHELL_GRADIENT_PRESET_STOP[preset];\n}\n\nexport function isShellGradientPreset(value: string): value is ShellGradientPreset {\n return (SHELL_GRADIENT_PRESETS as string[]).includes(value);\n}\n\n/** Radial wash for a preset — transparent at top-left into the intent stop. `none` returns no image. */\nexport function buildShellRadialGradientForPreset(preset: ShellGradientPreset): string {\n if (preset === 'none') return 'none';\n\n const stop = shellGradientPresetStopToken(preset);\n return `radial-gradient(${GRADIENT_GEOMETRY}, var(--color-background-transparent) 0%, ${stop} 100%)`;\n}\n","/** CSS var names consumed by `ds-panel-nav` / `ds-bar-nav` inside `ds-app-shell`. */\nimport type { ShellGradientPreset } from './shell-gradient-presets';\nimport {\n DEFAULT_SHELL_GRADIENT_PRESET,\n buildShellRadialGradientForPreset,\n} from './shell-gradient-presets';\n\nexport type { ShellGradientPreset } from './shell-gradient-presets';\nexport {\n DEFAULT_SHELL_GRADIENT_PRESET,\n SHELL_GRADIENT_PRESETS,\n SHELL_GRADIENT_PRESET_LABELS,\n buildShellRadialGradientForPreset,\n isShellGradientPreset,\n shellGradientPresetStopToken,\n} from './shell-gradient-presets';\n\nexport const SHELL_GRADIENT_IMAGE_VAR = '--ds-shell-gradient-image';\nexport const SHELL_GRADIENT_SIZE_VAR = '--ds-shell-gradient-size';\nexport const SHELL_GRADIENT_POSITION_PANEL_VAR = '--ds-shell-gradient-position-panel';\nexport const SHELL_GRADIENT_POSITION_BAR_VAR = '--ds-shell-gradient-position-bar';\nexport const SHELL_GRADIENT_OPACITY_VAR = '--ds-shell-gradient-opacity';\n/** Per chrome-surface background-position — offsets wash + grid to shell row origin. */\nexport const SHELL_CHROME_SURFACE_POSITION_VAR = '--ds-shell-chrome-surface-position';\n\n/** Layer opacity for the nav gradient wash. */\nexport const SHELL_GRADIENT_OPACITY = '0.1';\n\n/** Whether the shared chrome layer (secondary bg + optional wash) should mount. */\nexport function shellChromeLayerActive(gradient: boolean): boolean {\n return gradient;\n}\n\n/**\n * Shell radial wash — same for panel and bar nav.\n * Tokens follow `data-theme` (light/dark intent stops).\n */\nexport function buildShellRadialGradient(\n preset: ShellGradientPreset = DEFAULT_SHELL_GRADIENT_PRESET,\n): string {\n return buildShellRadialGradientForPreset(preset);\n}\n\n/** Built-in radial image (`gradientSrc` on shell overrides). */\nexport function shellGradientImage(\n preset: ShellGradientPreset = DEFAULT_SHELL_GRADIENT_PRESET,\n): string {\n return buildShellRadialGradient(preset);\n}\n\nexport interface ShellViewportDimensions {\n width: number;\n height: number;\n}\n\n/**\n * Viewport size for shell chrome with `background-attachment: fixed`.\n * Must not use the `ds-app-shell` element box — the shell can be shorter or\n * taller than the viewport when host height chains break or content overflows.\n */\nexport function readShellViewportDimensions(win?: Window): ShellViewportDimensions {\n const w = win ?? (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n if (!w) return { width: 0, height: 0 };\n\n const visual = w.visualViewport;\n return {\n width: Math.round(visual?.width ?? w.innerWidth),\n height: Math.round(visual?.height ?? w.innerHeight),\n };\n}\n\nexport interface ShellGradientLayout {\n width: number;\n height: number;\n panelWidth: number;\n}\n\n/** Pixel `background-size` for the fixed-attachment radial wash. */\nexport function shellGradientSize(layout: Pick<ShellGradientLayout, 'width' | 'height'>): string {\n return `${Math.round(layout.width)}px ${Math.round(layout.height)}px`;\n}\n\nexport function shellGradientPositionPanel(): string {\n return '0 0';\n}\n\nexport function shellGradientPositionBar(panelWidth: number): string {\n return `${-Math.round(panelWidth)}px 0`;\n}\n\n/** Phase-lock a chrome rect to the shell row coordinate system (wash + grid). */\nexport function shellChromeSurfacePosition(leftPx: number, topPx: number): string {\n return `${-Math.round(leftPx)}px ${-Math.round(topPx)}px`;\n}\n"],"mappings":"AAMO,MAAMA,EAAsE,CACjF,OACA,UACA,QAIK,MAAMC,EAAqD,UAE3D,MAAMC,EAAoE,CAC/EC,KAAM,OACNC,KAAM,OACNC,QAAS,UACTC,KAAM,QAGR,MAAMC,EAAmF,CACvFH,KAAM,mDACNC,QAAS,mDACTC,KAAM,sDAGR,MAAME,EAAoB,qBAEpB,SAAUC,EAA6BC,GAC3C,GAAIA,IAAW,OAAQ,OAAO,KAC9B,OAAOH,EAA2BG,EACpC,CAOM,SAAUC,EAAkCD,GAChD,GAAIA,IAAW,OAAQ,MAAO,OAE9B,MAAME,EAAOH,EAA6BC,GAC1C,MAAO,mBAAmBF,8CAA8DI,SAC1F,CC5BO,MAAMC,EAA2B,4BACjC,MAAMC,EAA0B,2BAChC,MAAMC,EAAoC,qCAC1C,MAAMC,EAAkC,mCACxC,MAAMC,EAA6B,8BAKnC,MAAMC,EAAyB,MAWhC,SAAUC,EACdT,EAA8BT,GAE9B,OAAOU,EAAkCD,EAC3C,CAmBM,SAAUU,EAA4BC,GAC1C,MAAMC,SAAmBC,WAAWC,SAAW,YAAcD,WAAWC,OAASC,UACjF,IAAKH,EAAG,MAAO,CAAEI,MAAO,EAAGC,OAAQ,GAEnC,MAAMC,EAASN,EAAEO,eACjB,MAAO,CACLH,MAAOI,KAAKC,MAAMH,GAAQF,OAASJ,EAAEU,YACrCL,OAAQG,KAAKC,MAAMH,GAAQD,QAAUL,EAAEW,aAE3C,CASM,SAAUC,EAAkBC,GAChC,MAAO,GAAGL,KAAKC,MAAMI,EAAOT,YAAYI,KAAKC,MAAMI,EAAOR,WAC5D,C,SAEgBS,IACd,MAAO,KACT,CAEM,SAAUC,EAAyBC,GACvC,MAAO,IAAIR,KAAKC,MAAMO,QACxB,Q","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BADGE_GRADIENT_POSITION_VAR","isShellGradientActive","from","shell","closest","hasAttribute"],"sources":["src/wc/nav/badge-gradient-ring.ts"],"sourcesContent":["import {\n SHELL_GRADIENT_POSITION_BAR_VAR,\n SHELL_GRADIENT_POSITION_PANEL_VAR,\n} from './shell-gradient';\n\n/** Per-badge background-position for shell gradient ring sampling. */\nexport const BADGE_GRADIENT_POSITION_VAR = '--_badge-gradient-position';\n\nexport interface GradientSurface {\n element: HTMLElement;\n chromeHost: HTMLElement;\n positionVar: string;\n}\n\n/** Whether the badge sits under `ds-app-shell[gradient]`. */\nexport function isShellGradientActive(from: HTMLElement): boolean {\n // Explicit <HTMLElement>: the inferred HTMLDsAppShellElement type only\n // resolves where @stencil/core types are installed — consumers importing\n // `@ds-mo/ui/nav` (raw TS) compile this without them.\n const shell = from.closest<HTMLElement>('ds-app-shell');\n return shell?.hasAttribute('gradient') === true;\n}\n\n/** Bar or panel chrome surface that owns the shell gradient stack. */\nexport function findGradientSurface(from: HTMLElement): GradientSurface | null {\n const barHost = from.closest('ds-bar-nav') as HTMLElement | null;\n if (barHost) {\n const root = barHost.shadowRoot ?? barHost;\n const element = root.querySelector('.bar-nav');\n if (element) {\n return {\n element: element as HTMLElement,\n chromeHost: barHost,\n positionVar: SHELL_GRADIENT_POSITION_BAR_VAR,\n };\n }\n }\n\n const panelHost = from.closest('ds-panel-nav') as HTMLElement | null;\n if (panelHost) {\n const root = panelHost.shadowRoot ?? panelHost;\n const element = root.querySelector('.panel-nav');\n if (element) {\n return {\n element: element as HTMLElement,\n chromeHost: panelHost,\n positionVar: SHELL_GRADIENT_POSITION_PANEL_VAR,\n };\n }\n }\n\n return null;\n}\n\ninterface ParsedPosition {\n x: number;\n y: number;\n}\n\n/** Parse a two-value CSS background-position (e.g. `-200px 0`). */\nexport function parseCssBackgroundPosition(value: string): ParsedPosition {\n const trimmed = value.trim();\n if (!trimmed) return { x: 0, y: 0 };\n\n const parts = trimmed.split(/\\s+/);\n const x = parseLength(parts[0] ?? '0');\n const y = parseLength(parts[1] ?? '0');\n return { x, y };\n}\n\nfunction parseLength(token: string): number {\n const px = token.match(/^(-?[\\d.]+)px$/);\n if (px) return Number(px[1]);\n return 0;\n}\n\n/**\n * Background position for a badge ring so the shell gradient aligns with nav chrome.\n * Uses badge center relative to the painted chrome surface.\n */\nexport function badgeGradientPosition(\n badgeHost: HTMLElement,\n surface: GradientSurface,\n shellPosition: string,\n): string {\n const badgeRect = badgeHost.getBoundingClientRect();\n const surfaceRect = surface.element.getBoundingClientRect();\n const anchorX = badgeRect.left + badgeRect.width / 2 - surfaceRect.left;\n const anchorY = badgeRect.top + badgeRect.height / 2 - surfaceRect.top;\n const { x, y } = parseCssBackgroundPosition(shellPosition);\n\n return `${Math.round(x - anchorX)}px ${Math.round(y - anchorY)}px`;\n}\n\n/** Resolve shell gradient position from chrome host custom properties. */\nexport function readShellGradientPosition(surface: GradientSurface): string {\n const styles = getComputedStyle(surface.chromeHost);\n return styles.getPropertyValue(surface.positionVar).trim() || '0 0';\n}\n\n/** Stamp `--_badge-gradient-position` on the badge host (fixed viewport chrome). */\nexport function syncBadgeGradientPosition(badgeHost: HTMLElement): void {\n if (!isShellGradientActive(badgeHost)) {\n badgeHost.style.removeProperty(BADGE_GRADIENT_POSITION_VAR);\n return;\n }\n\n badgeHost.style.setProperty(BADGE_GRADIENT_POSITION_VAR, '0 0');\n}\n"],"mappings":"AAMO,MAAMA,EAA8B,6BASrC,SAAUC,EAAsBC,GAIpC,MAAMC,EAAQD,EAAKE,QAAqB,gBACxC,OAAOD,GAAOE,aAAa,cAAgB,IAC7C,Q","ignoreList":[]}
|