@d4gger/design-system 4.0.2 → 4.1.0
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/README.md +3 -0
- package/dist/docs/component-index.json +1 -1
- package/dist/docs/consumer-guide.md +96 -0
- package/dist/foundations/telegram/index.cjs +20 -0
- package/dist/foundations/telegram/index.cjs.map +7 -0
- package/dist/foundations/telegram/index.d.cts +3 -0
- package/dist/foundations/telegram/index.d.cts.map +1 -0
- package/dist/foundations/telegram/index.d.mts +3 -0
- package/dist/foundations/telegram/index.d.mts.map +1 -0
- package/dist/foundations/telegram/index.d.ts +3 -0
- package/dist/foundations/telegram/index.d.ts.map +1 -0
- package/dist/foundations/telegram/index.js +3 -0
- package/dist/foundations/telegram/index.js.map +7 -0
- package/dist/foundations/telegram/theme-params.cjs +160 -0
- package/dist/foundations/telegram/theme-params.cjs.map +7 -0
- package/dist/foundations/telegram/theme-params.d.cts +124 -0
- package/dist/foundations/telegram/theme-params.d.cts.map +1 -0
- package/dist/foundations/telegram/theme-params.d.mts +124 -0
- package/dist/foundations/telegram/theme-params.d.mts.map +1 -0
- package/dist/foundations/telegram/theme-params.d.ts +124 -0
- package/dist/foundations/telegram/theme-params.d.ts.map +1 -0
- package/dist/foundations/telegram/theme-params.js +140 -0
- package/dist/foundations/telegram/theme-params.js.map +7 -0
- package/dist/foundations/telegram/viewport.cjs +81 -0
- package/dist/foundations/telegram/viewport.cjs.map +7 -0
- package/dist/foundations/telegram/viewport.d.cts +57 -0
- package/dist/foundations/telegram/viewport.d.cts.map +1 -0
- package/dist/foundations/telegram/viewport.d.mts +57 -0
- package/dist/foundations/telegram/viewport.d.mts.map +1 -0
- package/dist/foundations/telegram/viewport.d.ts +57 -0
- package/dist/foundations/telegram/viewport.d.ts.map +1 -0
- package/dist/foundations/telegram/viewport.js +61 -0
- package/dist/foundations/telegram/viewport.js.map +7 -0
- package/dist/styles.css +2 -3
- package/dist/telegram.css +93 -0
- package/dist/tokens.cjs +968 -0
- package/dist/tokens.d.cts +964 -0
- package/dist/tokens.d.mts +964 -0
- package/dist/tokens.d.ts +964 -0
- package/dist/tokens.js +964 -0
- package/dist/tokens.json +964 -0
- package/dist/utilities.css +2 -3
- package/package.json +26 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram Mini App viewport contract: the CSS variables Telegram's script
|
|
3
|
+
* sets on `:root` as soon as it loads (no `ready()` call is needed, and
|
|
4
|
+
* Telegram keeps them current on `viewportChanged` / `safeAreaChanged` /
|
|
5
|
+
* `contentSafeAreaChanged`), plus the DS-side defaults for hosted
|
|
6
|
+
* (non-Telegram) rendering. CSS that reads them needs no JS subscription;
|
|
7
|
+
* `observeTelegramHost` only re-runs the colour bridge.
|
|
8
|
+
*
|
|
9
|
+
* - `--tg-viewport-height` tracks the full WebView height, including areas
|
|
10
|
+
* temporarily covered (e.g. by the on-screen keyboard).
|
|
11
|
+
* - `--tg-viewport-stable-height` excludes transient shrinking — the value
|
|
12
|
+
* full-height panels should bind to (already the default for `body` and
|
|
13
|
+
* full Drawers via the `globals.css` compliance layer).
|
|
14
|
+
* - `--tg-safe-area-inset-*` / `--tg-content-safe-area-inset-*` carry the
|
|
15
|
+
* notch / status-bar / home-indicator regions; the content variant is the
|
|
16
|
+
* inset inside Telegram's own bottom chrome.
|
|
17
|
+
*
|
|
18
|
+
* Every `var(--tg-…)` reference in `telegram.css` carries a standard-web
|
|
19
|
+
* fallback, so the stylesheet is a no-op outside a Telegram WebView. The
|
|
20
|
+
* `qa:telegram-vars` package check enforces that invariant.
|
|
21
|
+
*/
|
|
22
|
+
import type { DensityMode } from '../../layout/responsive.props.js';
|
|
23
|
+
export declare const TELEGRAM_VIEWPORT_HEIGHT_VAR: "--tg-viewport-height";
|
|
24
|
+
export declare const TELEGRAM_VIEWPORT_STABLE_HEIGHT_VAR: "--tg-viewport-stable-height";
|
|
25
|
+
export declare const TELEGRAM_COLOR_SCHEME_VAR: "--tg-color-scheme";
|
|
26
|
+
export declare const TELEGRAM_SAFE_AREA_VARS: {
|
|
27
|
+
readonly top: "--tg-safe-area-inset-top";
|
|
28
|
+
readonly right: "--tg-safe-area-inset-right";
|
|
29
|
+
readonly bottom: "--tg-safe-area-inset-bottom";
|
|
30
|
+
readonly left: "--tg-safe-area-inset-left";
|
|
31
|
+
};
|
|
32
|
+
export declare const TELEGRAM_CONTENT_SAFE_AREA_VARS: {
|
|
33
|
+
readonly top: "--tg-content-safe-area-inset-top";
|
|
34
|
+
readonly right: "--tg-content-safe-area-inset-right";
|
|
35
|
+
readonly bottom: "--tg-content-safe-area-inset-bottom";
|
|
36
|
+
readonly left: "--tg-content-safe-area-inset-left";
|
|
37
|
+
};
|
|
38
|
+
/** DS density a Mini App root defaults to — small WebView, thumb reach. */
|
|
39
|
+
export declare const TELEGRAM_MINI_APP_DENSITY_DEFAULT: DensityMode;
|
|
40
|
+
/** Host marker attribute the bridge sets and `telegram.css` scopes to. */
|
|
41
|
+
export declare const TELEGRAM_MINI_APP_ATTRIBUTE: "data-tg-mini-app";
|
|
42
|
+
/** True inside a Telegram Mini App WebView (real or stubbed in tests). */
|
|
43
|
+
export declare function isTelegramWebView(): boolean;
|
|
44
|
+
export type ObserveTelegramHostOptions = {
|
|
45
|
+
/** Re-run the bridge when Telegram fires `themeChanged`. Default true. */
|
|
46
|
+
themeChanged?: boolean;
|
|
47
|
+
/** Re-run the bridge when Telegram fires `viewportChanged`. Default true. */
|
|
48
|
+
viewportChanged?: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Keep the bridge output fresh across a Mini App session: re-runs `apply`
|
|
52
|
+
* on Telegram's `themeChanged` / `viewportChanged` events. Returns a
|
|
53
|
+
* cleanup that detaches both listeners. No-op (returns a no-op cleanup)
|
|
54
|
+
* outside a Telegram WebView or when the host exposes no event API.
|
|
55
|
+
*/
|
|
56
|
+
export declare function observeTelegramHost(apply: () => void, options?: ObserveTelegramHostOptions): () => void;
|
|
57
|
+
//# sourceMappingURL=viewport.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.d.mts","sourceRoot":"","sources":["../../../src/foundations/telegram/viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAEhE,eAAO,MAAM,4BAA4B,EAAG,sBAA+B,CAAA;AAC3E,eAAO,MAAM,mCAAmC,EAAG,6BAAsC,CAAA;AACzF,eAAO,MAAM,yBAAyB,EAAG,mBAA4B,CAAA;AAErE,eAAO,MAAM,uBAAuB;;;;;CAK1B,CAAA;AAEV,eAAO,MAAM,+BAA+B;;;;;CAKlC,CAAA;AAEV,2EAA2E;AAC3E,eAAO,MAAM,iCAAiC,EAAE,WAAuB,CAAA;AAEvE,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,EAAG,kBAA2B,CAAA;AAmBtE,0EAA0E;AAC1E,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,IAAI,EACjB,OAAO,GAAE,0BAA+B,GACvC,MAAM,IAAI,CAwBZ"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram Mini App viewport contract: the CSS variables Telegram's script
|
|
3
|
+
* sets on `:root` as soon as it loads (no `ready()` call is needed, and
|
|
4
|
+
* Telegram keeps them current on `viewportChanged` / `safeAreaChanged` /
|
|
5
|
+
* `contentSafeAreaChanged`), plus the DS-side defaults for hosted
|
|
6
|
+
* (non-Telegram) rendering. CSS that reads them needs no JS subscription;
|
|
7
|
+
* `observeTelegramHost` only re-runs the colour bridge.
|
|
8
|
+
*
|
|
9
|
+
* - `--tg-viewport-height` tracks the full WebView height, including areas
|
|
10
|
+
* temporarily covered (e.g. by the on-screen keyboard).
|
|
11
|
+
* - `--tg-viewport-stable-height` excludes transient shrinking — the value
|
|
12
|
+
* full-height panels should bind to (already the default for `body` and
|
|
13
|
+
* full Drawers via the `globals.css` compliance layer).
|
|
14
|
+
* - `--tg-safe-area-inset-*` / `--tg-content-safe-area-inset-*` carry the
|
|
15
|
+
* notch / status-bar / home-indicator regions; the content variant is the
|
|
16
|
+
* inset inside Telegram's own bottom chrome.
|
|
17
|
+
*
|
|
18
|
+
* Every `var(--tg-…)` reference in `telegram.css` carries a standard-web
|
|
19
|
+
* fallback, so the stylesheet is a no-op outside a Telegram WebView. The
|
|
20
|
+
* `qa:telegram-vars` package check enforces that invariant.
|
|
21
|
+
*/
|
|
22
|
+
import type { DensityMode } from '../../layout/responsive.props.js';
|
|
23
|
+
export declare const TELEGRAM_VIEWPORT_HEIGHT_VAR: "--tg-viewport-height";
|
|
24
|
+
export declare const TELEGRAM_VIEWPORT_STABLE_HEIGHT_VAR: "--tg-viewport-stable-height";
|
|
25
|
+
export declare const TELEGRAM_COLOR_SCHEME_VAR: "--tg-color-scheme";
|
|
26
|
+
export declare const TELEGRAM_SAFE_AREA_VARS: {
|
|
27
|
+
readonly top: "--tg-safe-area-inset-top";
|
|
28
|
+
readonly right: "--tg-safe-area-inset-right";
|
|
29
|
+
readonly bottom: "--tg-safe-area-inset-bottom";
|
|
30
|
+
readonly left: "--tg-safe-area-inset-left";
|
|
31
|
+
};
|
|
32
|
+
export declare const TELEGRAM_CONTENT_SAFE_AREA_VARS: {
|
|
33
|
+
readonly top: "--tg-content-safe-area-inset-top";
|
|
34
|
+
readonly right: "--tg-content-safe-area-inset-right";
|
|
35
|
+
readonly bottom: "--tg-content-safe-area-inset-bottom";
|
|
36
|
+
readonly left: "--tg-content-safe-area-inset-left";
|
|
37
|
+
};
|
|
38
|
+
/** DS density a Mini App root defaults to — small WebView, thumb reach. */
|
|
39
|
+
export declare const TELEGRAM_MINI_APP_DENSITY_DEFAULT: DensityMode;
|
|
40
|
+
/** Host marker attribute the bridge sets and `telegram.css` scopes to. */
|
|
41
|
+
export declare const TELEGRAM_MINI_APP_ATTRIBUTE: "data-tg-mini-app";
|
|
42
|
+
/** True inside a Telegram Mini App WebView (real or stubbed in tests). */
|
|
43
|
+
export declare function isTelegramWebView(): boolean;
|
|
44
|
+
export type ObserveTelegramHostOptions = {
|
|
45
|
+
/** Re-run the bridge when Telegram fires `themeChanged`. Default true. */
|
|
46
|
+
themeChanged?: boolean;
|
|
47
|
+
/** Re-run the bridge when Telegram fires `viewportChanged`. Default true. */
|
|
48
|
+
viewportChanged?: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Keep the bridge output fresh across a Mini App session: re-runs `apply`
|
|
52
|
+
* on Telegram's `themeChanged` / `viewportChanged` events. Returns a
|
|
53
|
+
* cleanup that detaches both listeners. No-op (returns a no-op cleanup)
|
|
54
|
+
* outside a Telegram WebView or when the host exposes no event API.
|
|
55
|
+
*/
|
|
56
|
+
export declare function observeTelegramHost(apply: () => void, options?: ObserveTelegramHostOptions): () => void;
|
|
57
|
+
//# sourceMappingURL=viewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../../src/foundations/telegram/viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAEhE,eAAO,MAAM,4BAA4B,EAAG,sBAA+B,CAAA;AAC3E,eAAO,MAAM,mCAAmC,EAAG,6BAAsC,CAAA;AACzF,eAAO,MAAM,yBAAyB,EAAG,mBAA4B,CAAA;AAErE,eAAO,MAAM,uBAAuB;;;;;CAK1B,CAAA;AAEV,eAAO,MAAM,+BAA+B;;;;;CAKlC,CAAA;AAEV,2EAA2E;AAC3E,eAAO,MAAM,iCAAiC,EAAE,WAAuB,CAAA;AAEvE,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,EAAG,kBAA2B,CAAA;AAmBtE,0EAA0E;AAC1E,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,IAAI,EACjB,OAAO,GAAE,0BAA+B,GACvC,MAAM,IAAI,CAwBZ"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const TELEGRAM_VIEWPORT_HEIGHT_VAR = "--tg-viewport-height";
|
|
2
|
+
const TELEGRAM_VIEWPORT_STABLE_HEIGHT_VAR = "--tg-viewport-stable-height";
|
|
3
|
+
const TELEGRAM_COLOR_SCHEME_VAR = "--tg-color-scheme";
|
|
4
|
+
const TELEGRAM_SAFE_AREA_VARS = {
|
|
5
|
+
top: "--tg-safe-area-inset-top",
|
|
6
|
+
right: "--tg-safe-area-inset-right",
|
|
7
|
+
bottom: "--tg-safe-area-inset-bottom",
|
|
8
|
+
left: "--tg-safe-area-inset-left"
|
|
9
|
+
};
|
|
10
|
+
const TELEGRAM_CONTENT_SAFE_AREA_VARS = {
|
|
11
|
+
top: "--tg-content-safe-area-inset-top",
|
|
12
|
+
right: "--tg-content-safe-area-inset-right",
|
|
13
|
+
bottom: "--tg-content-safe-area-inset-bottom",
|
|
14
|
+
left: "--tg-content-safe-area-inset-left"
|
|
15
|
+
};
|
|
16
|
+
const TELEGRAM_MINI_APP_DENSITY_DEFAULT = "compact";
|
|
17
|
+
const TELEGRAM_MINI_APP_ATTRIBUTE = "data-tg-mini-app";
|
|
18
|
+
function getTelegramWebApp() {
|
|
19
|
+
if (typeof window === "undefined") {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
return window.Telegram?.WebApp;
|
|
23
|
+
}
|
|
24
|
+
function isTelegramWebView() {
|
|
25
|
+
return getTelegramWebApp() !== void 0;
|
|
26
|
+
}
|
|
27
|
+
function observeTelegramHost(apply, options = {}) {
|
|
28
|
+
const { themeChanged = true, viewportChanged = true } = options;
|
|
29
|
+
const webApp = getTelegramWebApp();
|
|
30
|
+
if (!webApp?.onEvent) {
|
|
31
|
+
return () => {
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const subscriptions = [];
|
|
35
|
+
if (themeChanged) {
|
|
36
|
+
subscriptions.push(["themeChanged", apply]);
|
|
37
|
+
}
|
|
38
|
+
if (viewportChanged) {
|
|
39
|
+
subscriptions.push(["viewportChanged", apply]);
|
|
40
|
+
}
|
|
41
|
+
for (const [type, listener] of subscriptions) {
|
|
42
|
+
webApp.onEvent(type, listener);
|
|
43
|
+
}
|
|
44
|
+
return () => {
|
|
45
|
+
for (const [type, listener] of subscriptions) {
|
|
46
|
+
webApp.offEvent?.(type, listener);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
TELEGRAM_COLOR_SCHEME_VAR,
|
|
52
|
+
TELEGRAM_CONTENT_SAFE_AREA_VARS,
|
|
53
|
+
TELEGRAM_MINI_APP_ATTRIBUTE,
|
|
54
|
+
TELEGRAM_MINI_APP_DENSITY_DEFAULT,
|
|
55
|
+
TELEGRAM_SAFE_AREA_VARS,
|
|
56
|
+
TELEGRAM_VIEWPORT_HEIGHT_VAR,
|
|
57
|
+
TELEGRAM_VIEWPORT_STABLE_HEIGHT_VAR,
|
|
58
|
+
isTelegramWebView,
|
|
59
|
+
observeTelegramHost
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=viewport.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/foundations/telegram/viewport.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Telegram Mini App viewport contract: the CSS variables Telegram's script\n * sets on `:root` as soon as it loads (no `ready()` call is needed, and\n * Telegram keeps them current on `viewportChanged` / `safeAreaChanged` /\n * `contentSafeAreaChanged`), plus the DS-side defaults for hosted\n * (non-Telegram) rendering. CSS that reads them needs no JS subscription;\n * `observeTelegramHost` only re-runs the colour bridge.\n *\n * - `--tg-viewport-height` tracks the full WebView height, including areas\n * temporarily covered (e.g. by the on-screen keyboard).\n * - `--tg-viewport-stable-height` excludes transient shrinking \u2014 the value\n * full-height panels should bind to (already the default for `body` and\n * full Drawers via the `globals.css` compliance layer).\n * - `--tg-safe-area-inset-*` / `--tg-content-safe-area-inset-*` carry the\n * notch / status-bar / home-indicator regions; the content variant is the\n * inset inside Telegram's own bottom chrome.\n *\n * Every `var(--tg-\u2026)` reference in `telegram.css` carries a standard-web\n * fallback, so the stylesheet is a no-op outside a Telegram WebView. The\n * `qa:telegram-vars` package check enforces that invariant.\n */\n\nimport type { DensityMode } from '../../layout/responsive.props'\n\nexport const TELEGRAM_VIEWPORT_HEIGHT_VAR = '--tg-viewport-height' as const\nexport const TELEGRAM_VIEWPORT_STABLE_HEIGHT_VAR = '--tg-viewport-stable-height' as const\nexport const TELEGRAM_COLOR_SCHEME_VAR = '--tg-color-scheme' as const\n\nexport const TELEGRAM_SAFE_AREA_VARS = {\n top: '--tg-safe-area-inset-top',\n right: '--tg-safe-area-inset-right',\n bottom: '--tg-safe-area-inset-bottom',\n left: '--tg-safe-area-inset-left',\n} as const\n\nexport const TELEGRAM_CONTENT_SAFE_AREA_VARS = {\n top: '--tg-content-safe-area-inset-top',\n right: '--tg-content-safe-area-inset-right',\n bottom: '--tg-content-safe-area-inset-bottom',\n left: '--tg-content-safe-area-inset-left',\n} as const\n\n/** DS density a Mini App root defaults to \u2014 small WebView, thumb reach. */\nexport const TELEGRAM_MINI_APP_DENSITY_DEFAULT: DensityMode = 'compact'\n\n/** Host marker attribute the bridge sets and `telegram.css` scopes to. */\nexport const TELEGRAM_MINI_APP_ATTRIBUTE = 'data-tg-mini-app' as const\n\ntype MinimalTelegramWebApp = {\n colorScheme?: 'light' | 'dark'\n viewportHeight?: number\n viewportStableHeight?: number\n isExpanded?: boolean\n onEvent?: (type: string, listener: () => void) => void\n offEvent?: (type: string, listener: () => void) => void\n}\n\nfunction getTelegramWebApp(): MinimalTelegramWebApp | undefined {\n if (typeof window === 'undefined') {\n return undefined\n }\n\n return (window as typeof window & { Telegram?: { WebApp?: MinimalTelegramWebApp } }).Telegram?.WebApp\n}\n\n/** True inside a Telegram Mini App WebView (real or stubbed in tests). */\nexport function isTelegramWebView(): boolean {\n return getTelegramWebApp() !== undefined\n}\n\nexport type ObserveTelegramHostOptions = {\n /** Re-run the bridge when Telegram fires `themeChanged`. Default true. */\n themeChanged?: boolean\n /** Re-run the bridge when Telegram fires `viewportChanged`. Default true. */\n viewportChanged?: boolean\n}\n\n/**\n * Keep the bridge output fresh across a Mini App session: re-runs `apply`\n * on Telegram's `themeChanged` / `viewportChanged` events. Returns a\n * cleanup that detaches both listeners. No-op (returns a no-op cleanup)\n * outside a Telegram WebView or when the host exposes no event API.\n */\nexport function observeTelegramHost(\n apply: () => void,\n options: ObserveTelegramHostOptions = {},\n): () => void {\n const { themeChanged = true, viewportChanged = true } = options\n const webApp = getTelegramWebApp()\n if (!webApp?.onEvent) {\n return () => {}\n }\n\n const subscriptions: Array<[string, () => void]> = []\n if (themeChanged) {\n subscriptions.push(['themeChanged', apply])\n }\n if (viewportChanged) {\n subscriptions.push(['viewportChanged', apply])\n }\n\n for (const [type, listener] of subscriptions) {\n webApp.onEvent(type, listener)\n }\n\n return () => {\n for (const [type, listener] of subscriptions) {\n webApp.offEvent?.(type, listener)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAwBO,MAAM,+BAA+B;AACrC,MAAM,sCAAsC;AAC5C,MAAM,4BAA4B;AAElC,MAAM,0BAA0B;AAAA,EACrC,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;AAEO,MAAM,kCAAkC;AAAA,EAC7C,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;AAGO,MAAM,oCAAiD;AAGvD,MAAM,8BAA8B;AAW3C,SAAS,oBAAuD;AAC9D,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO;AAAA,EACT;AAEA,SAAQ,OAA6E,UAAU;AACjG;AAGO,SAAS,oBAA6B;AAC3C,SAAO,kBAAkB,MAAM;AACjC;AAeO,SAAS,oBACd,OACA,UAAsC,CAAC,GAC3B;AACZ,QAAM,EAAE,eAAe,MAAM,kBAAkB,KAAK,IAAI;AACxD,QAAM,SAAS,kBAAkB;AACjC,MAAI,CAAC,QAAQ,SAAS;AACpB,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AAEA,QAAM,gBAA6C,CAAC;AACpD,MAAI,cAAc;AAChB,kBAAc,KAAK,CAAC,gBAAgB,KAAK,CAAC;AAAA,EAC5C;AACA,MAAI,iBAAiB;AACnB,kBAAc,KAAK,CAAC,mBAAmB,KAAK,CAAC;AAAA,EAC/C;AAEA,aAAW,CAAC,MAAM,QAAQ,KAAK,eAAe;AAC5C,WAAO,QAAQ,MAAM,QAAQ;AAAA,EAC/B;AAEA,SAAO,MAAM;AACX,eAAW,CAAC,MAAM,QAAQ,KAAK,eAAe;AAC5C,aAAO,WAAW,MAAM,QAAQ;AAAA,IAClC;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/styles.css
CHANGED
|
@@ -1458,9 +1458,8 @@ html {
|
|
|
1458
1458
|
Telegram WebView (every `var()` here falls back to prior/standard-web
|
|
1459
1459
|
behavior when the Telegram-set custom property is absent).
|
|
1460
1460
|
|
|
1461
|
-
`--tg-viewport-stable-height` is set by Telegram on `:root`
|
|
1462
|
-
|
|
1463
|
-
height (excludes Telegram's own header/bottom chrome, and — unlike the
|
|
1461
|
+
`--tg-viewport-stable-height` is set by Telegram's script on `:root` as
|
|
1462
|
+
soon as it loads, and tracks the WebView's real visible height (excludes Telegram's own header/bottom chrome, and — unlike the
|
|
1464
1463
|
plain `--tg-viewport-height` — ignores transient shrinking while the
|
|
1465
1464
|
on-screen keyboard is up). Redefining `--dsx-drawer-min-height-full` here,
|
|
1466
1465
|
after `tokens.css`, updates every full-height Drawer variant (the
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* D4gger Telegram Mini App adapter (opt-in, additive).
|
|
3
|
+
*
|
|
4
|
+
* Import AFTER the core bundle in a Mini App entry:
|
|
5
|
+
*
|
|
6
|
+
* import '@d4gger/design-system/styles.css'
|
|
7
|
+
* import '@d4gger/design-system/telegram.css'
|
|
8
|
+
*
|
|
9
|
+
* Every `var(--tg-*)` reference below falls back to standard-web behavior,
|
|
10
|
+
* so this file is a no-op outside a Telegram WebView (Telegram's script sets
|
|
11
|
+
* its `--tg-*` vars on `:root` as soon as it loads). The `qa:telegram-vars`
|
|
12
|
+
* package check enforces that invariant: each `--tg-*` reference must carry
|
|
13
|
+
* a fallback, and this file must never declare a `--tg-*` variable
|
|
14
|
+
* (Telegram owns that namespace — referenced, never declared, same
|
|
15
|
+
* relationship the package already has with `--radix-*`).
|
|
16
|
+
*
|
|
17
|
+
* Two layers, and no colours:
|
|
18
|
+
* 1. Viewport + content-safe-area bindings (`--dsx-tg-*` aliases).
|
|
19
|
+
* The stable-height and base safe-area aliases already ship in the
|
|
20
|
+
* core `globals.css` compliance layer; this file adds the stable
|
|
21
|
+
* aliases for composition plus the content-safe-area inset variant
|
|
22
|
+
* (inside Telegram's own bottom chrome).
|
|
23
|
+
* 2. A low-end motion guard for small WebViews.
|
|
24
|
+
*
|
|
25
|
+
* Telegram's palette reaches the DS through ONE path, the `./telegram`
|
|
26
|
+
* subpath's `applyTelegramThemeParams` (G-35). A CSS-only colour bridge
|
|
27
|
+
* cannot work: the theme rules re-declare every token on `<body>`, and a
|
|
28
|
+
* token cannot fall back to itself.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
:root {
|
|
32
|
+
--dsx-tg-viewport-height: var(--tg-viewport-height, 100vh);
|
|
33
|
+
--dsx-tg-viewport-stable-height: var(--tg-viewport-stable-height, 100vh);
|
|
34
|
+
--dsx-tg-content-safe-area-inset-top: var(
|
|
35
|
+
--tg-content-safe-area-inset-top,
|
|
36
|
+
var(--dsx-safe-area-inset-top, env(safe-area-inset-top, 0px))
|
|
37
|
+
);
|
|
38
|
+
--dsx-tg-content-safe-area-inset-right: var(
|
|
39
|
+
--tg-content-safe-area-inset-right,
|
|
40
|
+
var(--dsx-safe-area-inset-right, env(safe-area-inset-right, 0px))
|
|
41
|
+
);
|
|
42
|
+
--dsx-tg-content-safe-area-inset-bottom: var(
|
|
43
|
+
--tg-content-safe-area-inset-bottom,
|
|
44
|
+
var(--dsx-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))
|
|
45
|
+
);
|
|
46
|
+
--dsx-tg-content-safe-area-inset-left: var(
|
|
47
|
+
--tg-content-safe-area-inset-left,
|
|
48
|
+
var(--dsx-safe-area-inset-left, env(safe-area-inset-left, 0px))
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Low-end motion guard for small WebViews. The OS-level
|
|
53
|
+
* `prefers-reduced-motion` signal is already honored globally by
|
|
54
|
+
* `motion.css` / `brand-effects.css` themselves; what they lack is an
|
|
55
|
+
* app-set kill-switch for low-end Android WebViews where the OS signal
|
|
56
|
+
* never fires. Setting `data-tg-motion="reduced"` on the Mini App root
|
|
57
|
+
* (the app decides, e.g. via `navigator.hardwareConcurrency` /
|
|
58
|
+
* device-memory heuristics) applies the same treatment motion.css uses,
|
|
59
|
+
* mirrored class-for-class: entrances resolve to their resting state,
|
|
60
|
+
* continuous loops go static, ember motes hide, and collapse skips its
|
|
61
|
+
* transition without cancelling the exit it animates.
|
|
62
|
+
* 60fps guidance for Mini Apps: keep this marker available, avoid
|
|
63
|
+
* `brand-effects.css` inside the WebView, and keep per-frame work (orbit
|
|
64
|
+
* satellites, scan sweeps, starfields) off small screens. */
|
|
65
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-fade,
|
|
66
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-converge,
|
|
67
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-rift,
|
|
68
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-stagger > *,
|
|
69
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-orbit,
|
|
70
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-pulse,
|
|
71
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-scan,
|
|
72
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-glow,
|
|
73
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-drift,
|
|
74
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-starfield::before,
|
|
75
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-aurora::after,
|
|
76
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-twinkle,
|
|
77
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-brand-ambient,
|
|
78
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-brand-starfield,
|
|
79
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-brand-shimmer {
|
|
80
|
+
animation: none;
|
|
81
|
+
opacity: 1;
|
|
82
|
+
filter: none;
|
|
83
|
+
transform: none;
|
|
84
|
+
clip-path: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-collapse {
|
|
88
|
+
animation: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
[data-tg-mini-app][data-tg-motion='reduced'] .dsx-motion-ember__mote {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|