# @hua-labs/state - AI Documentation
# Version: 1.1.0
# Auto-generated by generate-docs — do not edit manually

package:
  name: "@hua-labs/state"
  version: "1.1.0"
  description: "HUA State - Unified state management for hua framework with SSR support and integrations"
  license: "MIT"

overview: "Zustand-based state management wrapper optimized for the hua ecosystem. Provides built-in SSR hydration handling, localStorage persistence with partialize support, and seamless i18n integration for React and Next.js applications."

exports:
  main:
    path: "@hua-labs/state"
    provides:
      - name: "createHuaStore"
        type: "function"
        description: "Create a Zustand store with SSR/persistence support"
      - name: "isStoreRehydrated"
        type: "function"
        description: "Check if a persisted store has completed rehydration from localStorage. Returns false while hydration is pending (SSR safe)."
      - name: "onStoreRehydrated"
        type: "function"
        description: "Subscribe to a store's rehydration completion event. Calls the callback immediately if the store is already rehydrated. Returns an unsubscribe function."
      - name: "markStoreRehydrated"
        type: "function"
        description: "Manually mark a store as rehydrated and fire all pending listeners. Use when integrating a Zustand store created outside of createHuaStore."
      - name: "createI18nStore"
        type: "function"
        description: "Create a pre-configured i18n language store"
      - name: "createPersistedStore"
        type: "function"
        description: "Convenience wrapper that always enables persistence. Supports localStorage (default) and sessionStorage."
      - name: "useStoreReset"
        type: "function"
        description: "Hook that captures initial state and provides a reset function. Only resets data keys, preserves functions."
      - name: "withDevTools"
        type: "function"
        description: "Wrap a Zustand state creator with Redux DevTools support. No-ops in production."
      - name: "createComputedStore"
        type: "function"
        description: ""
      - name: "composeMiddleware"
        type: "function"
        description: ""
      - name: "StoreCreator"
        type: "type"
        description: "Type alias for the Zustand state creator function passed to createHuaStore."
      - name: "StoreConfig"
        type: "type"
        description: "Configuration object for createHuaStore — persist, persistKey, ssr, partialize."
      - name: "HuaStore"
        type: "type"
        description: "Return type of createHuaStore — a bound Zustand store hook."
      - name: "BaseStoreState"
        type: "type"
        description: "Base constraint for store state — requires an object type."
      - name: "UseBoundStore"
        type: "type"
        description: "Re-exported Zustand UseBoundStore type for typed store hooks."
      - name: "StoreApi"
        type: "type"
        description: "Re-exported Zustand StoreApi type for direct store access."
      - name: "I18nStoreState"
        type: "type"
        description: "State shape for the i18n store — language, setLanguage, etc."
      - name: "I18nStoreConfig"
        type: "type"
        description: "Configuration for createI18nStore — default language, supported languages."
      - name: "LanguageStoreState"
        type: "type"
        description: ""
      - name: "UseStoreHook"
        type: "type"
        description: "Generic type helper for typed store selector hooks."
      - name: "CreatePersistedStoreOptions"
        type: "type"
        description: "Options for createPersistedStore — storage type ('local'|'session') and partialize."
      - name: "UseStoreResetReturn"
        type: "type"
        description: "Return type of useStoreReset — { reset: () => void }."
      - name: "ComputedConfig"
        type: "type"
        description: ""

  subpaths:
    - path: "@hua-labs/state/integrations/i18n"
      description: "createI18nStore for language management"

features:
  - "Zustand-based — Lightweight, performant state management"
  - "SSR support — Automatic hydration handling for Next.js App Router"
  - "Persistence — Built-in localStorage with partialize support"
  - "i18n integration — Pre-configured store for language management"
  - "Type-safe — Full TypeScript support with strict typing"
  - "createPersistedStore — Convenience wrapper for always-persisted stores (localStorage/sessionStorage)"
  - "useStoreReset — Reset store to initial state (preserves functions)"
  - "withDevTools — Redux DevTools middleware (auto-disabled in production)"
  - "createComputedStore — Derived state with auto-recomputing on changes"
  - "composeMiddleware — Compose multiple Zustand middlewares right-to-left"

related_packages:
  - "@hua-labs/i18n-core-zustand"
  - "@hua-labs/hua"

compatibility:
  react: ">=19.0.0"
  node: ">=20.0.0"
