@chenyqthu/tp-mobile-ui-kit 0.2.0 → 0.2.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.
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import type { TPLiquidGlassProps } from '../types';
3
3
  import '../../styles/tp-core-nav-controls.css';
4
4
  /**
5
- * Apple iOS 26/27 Liquid Glass surface primitive combining translucent refractive backdrop blur,
6
- * a directional 135-degree specular rim highlight, and inner meniscus depth lighting.
5
+ * Apple iOS 26/27 Liquid Glass surface primitive combining SDF Snell-law optical backdrop
6
+ * refraction (with subtle RGB dispersion in Chromium), directional 135-degree specular rim
7
+ * highlights, and inner meniscus depth lighting.
7
8
  */
8
9
  export declare const TPLiquidGlass: React.FC<TPLiquidGlassProps>;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { TPLiquidGlassProps } from '../types';
3
+ import { type LiquidGlassDisplacementAsset } from '../utils/liquidGlassEngine';
4
+ export interface TPLiquidGlassBackdropProps {
5
+ hostRef?: React.RefObject<HTMLElement | null>;
6
+ shape?: NonNullable<TPLiquidGlassProps['shape']>;
7
+ tint?: NonNullable<TPLiquidGlassProps['tint']>;
8
+ bezelWidth?: number;
9
+ refraction?: number;
10
+ dispersion?: number;
11
+ blur?: number;
12
+ saturation?: number;
13
+ optical?: boolean;
14
+ }
15
+ /**
16
+ * Measures a glass backdrop's rendered geometry and prepares its cached SVG displacement asset.
17
+ */
18
+ export declare function useLiquidGlassSurface(targetRef: React.RefObject<HTMLElement | null>, options: Omit<TPLiquidGlassBackdropProps, 'hostRef'>): {
19
+ filterId: string;
20
+ asset: LiquidGlassDisplacementAsset | null;
21
+ size: {
22
+ width: number;
23
+ height: number;
24
+ };
25
+ opticalEnabled: boolean;
26
+ };
27
+ /**
28
+ * Optical backdrop layer rendered inside a Liquid Glass container (`z-index: 0`).
29
+ * Never place `isolation: isolate` or `backdrop-filter` on the parent container so Chromium can
30
+ * sample the live scrolling DOM behind this element.
31
+ */
32
+ export declare const TPLiquidGlassBackdrop: React.FC<TPLiquidGlassBackdropProps>;
@@ -32,6 +32,7 @@ export { TPPopup } from './components/TPPopup';
32
32
  export { TPMenu } from './components/TPMenu';
33
33
  export { TPToast, TPToastProvider, useTPToast, type TPToastOptions, type TPToastContextValue, } from './components/TPToast';
34
34
  export { TPLiquidGlass } from './components/TPLiquidGlass';
35
+ export { computeLiquidGlassDisplacementField, supportsSvgBackdropFilter, type LiquidGlassFieldOptions, type LiquidGlassFieldResult, } from './utils/liquidGlassEngine';
35
36
  export { TPIconButton, TPIconButtonGroup } from './components/TPIconButton';
36
37
  export { TPCheckbox, TPCheckboxGroup } from './components/TPCheckbox';
37
38
  export { TPRadio, TPRadioGroup } from './components/TPRadio';
@@ -22,6 +22,10 @@ export interface TPLiquidGlassProps {
22
22
  shape?: 'pill' | 'circle' | 'rounded';
23
23
  tint?: 'clear' | 'brand' | 'dark';
24
24
  interactive?: boolean;
25
+ refraction?: number;
26
+ dispersion?: number;
27
+ blur?: number;
28
+ optical?: boolean;
25
29
  as?: 'div' | 'button' | 'nav' | 'section';
26
30
  ariaLabel?: string;
27
31
  disabled?: boolean;
@@ -0,0 +1,37 @@
1
+ export interface LiquidGlassFieldOptions {
2
+ width: number;
3
+ height: number;
4
+ radius: number;
5
+ bezelWidth: number;
6
+ glassThickness?: number;
7
+ refractiveIndex?: number;
8
+ }
9
+ export interface LiquidGlassFieldResult {
10
+ data: Uint8ClampedArray;
11
+ width: number;
12
+ height: number;
13
+ maxScale: number;
14
+ }
15
+ export interface LiquidGlassDisplacementAsset {
16
+ url: string;
17
+ width: number;
18
+ height: number;
19
+ maxScale: number;
20
+ }
21
+ /**
22
+ * Returns true only in Chromium desktop/Android browsers where SVG `backdrop-filter: url(#...)`
23
+ * samples live DOM pixels behind the element. Safari/WebKit and Firefox drop the entire
24
+ * `backdrop-filter` rule when `url(...)` appears, so they receive CSS fallback styling instead.
25
+ */
26
+ export declare function supportsSvgBackdropFilter(): boolean;
27
+ /**
28
+ * Computes a rounded-rectangle SDF displacement field using a convex squircle profile and
29
+ * Snell's law refraction (`n1 = 1.0 -> n2 = 1.5`), keeping interior center pixels neutral
30
+ * (`R = 128, G = 128`) and refracting along the curved bezel rim.
31
+ */
32
+ export declare function computeLiquidGlassDisplacementField(options: LiquidGlassFieldOptions): LiquidGlassFieldResult;
33
+ /**
34
+ * Generates and memoizes a PNG data URL displacement map for a Liquid Glass bezel contour.
35
+ * Returns null safely in environments without 2D Canvas support (such as jsdom or SSR).
36
+ */
37
+ export declare function getLiquidGlassDisplacementAsset(options: LiquidGlassFieldOptions): LiquidGlassDisplacementAsset | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chenyqthu/tp-mobile-ui-kit",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "TP-Link multi-brand mobile React UI component library (TP-Design 12-mode Theme Engine + Omada APP 5.3 Blocks & Real PAG Motion Assets + Single-file HTML standalone bundle)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-23T22:48:47.952Z",
3
+ "generatedAt": "2026-11-24T00:53:16.666Z",
4
4
  "package": {
5
5
  "name": "@chenyqthu/tp-mobile-ui-kit",
6
- "version": "0.2.0",
6
+ "version": "0.2.1",
7
7
  "description": "TP-Link multi-brand mobile React UI component library (TP-Design 12-mode Theme Engine + Omada APP 5.3 Blocks & Real PAG Motion Assets + Single-file HTML standalone bundle)",
8
8
  "entries": {
9
9
  ".": "@chenyqthu/tp-mobile-ui-kit",
@@ -18,15 +18,15 @@
18
18
  "jsdelivrCss": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@latest/dist/style.css",
19
19
  "jsdelivrStandalone": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@latest/dist/standalone.js",
20
20
  "jsdelivrWasm": "https://cdn.jsdelivr.net/npm/libpag@4.5.85/lib/libpag.wasm",
21
- "pinnedCss": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@0.2.0/dist/style.css",
22
- "pinnedStandalone": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@0.2.0/dist/standalone.js"
21
+ "pinnedCss": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@0.2.1/dist/style.css",
22
+ "pinnedStandalone": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@0.2.1/dist/standalone.js"
23
23
  }
24
24
  },
25
25
  "counts": {
26
26
  "components": 77,
27
27
  "blocks": 7,
28
28
  "pages": 10,
29
- "hooksAndHelpers": 9,
29
+ "hooksAndHelpers": 11,
30
30
  "brands": 6,
31
31
  "themePresets": 12,
32
32
  "templates": 3,
@@ -1909,6 +1909,24 @@
1909
1909
  }
1910
1910
  ]
1911
1911
  },
1912
+ {
1913
+ "name": "computeLiquidGlassDisplacementField",
1914
+ "category": "core-nav-controls",
1915
+ "kind": "helper",
1916
+ "subpath": "@chenyqthu/tp-mobile-ui-kit/core",
1917
+ "sourcePath": "src/core/utils/liquidGlassEngine.ts",
1918
+ "description": "Computes a rounded-rectangle SDF displacement field using a convex squircle profile and Snell's law refraction (`n1 = 1.0 -> n2 = 1.5`), keeping interior center pixels neutral (`R = 128, G = 128`) and refracting along the curved bezel rim.",
1919
+ "signature": "(options: LiquidGlassFieldOptions): LiquidGlassFieldResult"
1920
+ },
1921
+ {
1922
+ "name": "supportsSvgBackdropFilter",
1923
+ "category": "core-nav-controls",
1924
+ "kind": "helper",
1925
+ "subpath": "@chenyqthu/tp-mobile-ui-kit/core",
1926
+ "sourcePath": "src/core/utils/liquidGlassEngine.ts",
1927
+ "description": "Returns true only in Chromium desktop/Android browsers where SVG `backdrop-filter: url(#...)` samples live DOM pixels behind the element. Safari/WebKit and Firefox drop the entire `backdrop-filter` rule when `url(...)` appears, so they receive CSS fallback styling instead.",
1928
+ "signature": "(): boolean"
1929
+ },
1912
1930
  {
1913
1931
  "name": "TPButton",
1914
1932
  "category": "core-nav-controls",
@@ -2186,7 +2204,7 @@
2186
2204
  "kind": "component",
2187
2205
  "subpath": "@chenyqthu/tp-mobile-ui-kit/core",
2188
2206
  "sourcePath": "src/core/components/TPLiquidGlass.tsx",
2189
- "description": "Apple iOS 26/27 Liquid Glass surface primitive combining translucent refractive backdrop blur, a directional 135-degree specular rim highlight, and inner meniscus depth lighting.",
2207
+ "description": "Apple iOS 26/27 Liquid Glass surface primitive combining SDF Snell-law optical backdrop refraction (with subtle RGB dispersion in Chromium), directional 135-degree specular rim highlights, and inner meniscus depth lighting.",
2190
2208
  "propsType": "TPLiquidGlassProps",
2191
2209
  "props": [
2192
2210
  {
@@ -2204,6 +2222,26 @@
2204
2222
  "type": "boolean",
2205
2223
  "optional": true
2206
2224
  },
2225
+ {
2226
+ "name": "refraction",
2227
+ "type": "number",
2228
+ "optional": true
2229
+ },
2230
+ {
2231
+ "name": "dispersion",
2232
+ "type": "number",
2233
+ "optional": true
2234
+ },
2235
+ {
2236
+ "name": "blur",
2237
+ "type": "number",
2238
+ "optional": true
2239
+ },
2240
+ {
2241
+ "name": "optical",
2242
+ "type": "boolean",
2243
+ "optional": true
2244
+ },
2207
2245
  {
2208
2246
  "name": "as",
2209
2247
  "type": "'div' | 'button' | 'nav' | 'section'",
@@ -12310,8 +12348,8 @@
12310
12348
  "js": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@latest/dist/standalone.js"
12311
12349
  },
12312
12350
  "pinnedUrls": {
12313
- "css": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@0.2.0/dist/style.css",
12314
- "js": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@0.2.0/dist/standalone.js"
12351
+ "css": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@0.2.1/dist/style.css",
12352
+ "js": "https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@0.2.1/dist/standalone.js"
12315
12353
  }
12316
12354
  },
12317
12355
  {