import { nextZIndex, toast, hasWindow } from '@talex-touch/tuffex/utils'
Hands out overlay stacking levels from one source so components do not hard-code conflicting z-index values.
| Export | Signature | When to use |
|---|
nextZIndex() | () => number | Claim the next incremented level for a new overlay |
getZIndex() | () => number | Read the current top level without incrementing |
refreshZIndex(seed?, reason?) | (seed?: number, reason?: string) => number | Recount from a given baseline |
resetZIndex(seed?, reason?) | (seed?: number, reason?: string) => number | Reset to the seed after unmount / in tests |
configureZIndex(options) | (options) => void | Configure the base seed and overrides globally |
onZIndexEvent(listener) | (listener) => () => void | Subscribe to level changes; returns an unsubscribe |
SSR-safe checks for browser API availability so you never touch window / document / navigator blindly.
| Export | Signature | When to use |
|---|
hasWindow() | () => boolean | Guard before accessing window |
hasDocument() | () => boolean | Guard before accessing document |
hasNavigator() | () => boolean | Guard before navigator (vibrate, clipboard) |
Wraps navigator.vibrate with semantic patterns.
| Export | Signature | When to use |
|---|
vibrate | { light() … error(), stop, isSupported } | Fire a preset directly, e.g. vibrate.success() |
useVibrate(type, options?) | (type: VibrateType, options?) => void | Trigger one configurable semantic vibration |
stopVibrate() | () => void | Interrupt an in-progress vibration |
isVibrateSupported() | () => boolean | Capability detection |
A global toast queue that does not require a per-page host (rendering still needs TxToastHost).
| Export | Signature | When to use |
|---|
toast(options) | (options) => string | Show a toast; returns an id usable to dismiss it |
dismissToast(id) | (id: string) => void | Dismiss a specific toast |
clearToasts() | () => void | Clear every toast |
Serially manages global dialogs by priority with lifecycle callbacks.
| Export | Signature | When to use |
|---|
getDialogManager() | () => DialogManager | Get the global singleton to queue / open dialogs |
| Export | Signature | When to use |
|---|
useFlip(targetRef, opts?) | (ref, opts?) => UseFlipReturn | Run a FLIP transition on an element (powers TxFlipOverlay) |
useAutoResize(targetRef, opts?) | (ref, opts?) => UseAutoResizeReturn | Measure and transition size changes (powers TxAutoSizer) |
| Export | Signature | When to use |
|---|
withInstall(component) | <T>(component: T) => T & { install } | Attach install so a component works with app.use() |
- Barrel:
packages/tuffex/packages/components/src/utils/index.ts re-exports packages/tuffex/packages/utils/*. - Subpath entry:
@talex-touch/tuffex/utils; the root @talex-touch/tuffex entry also folds in these exports.