All skills
onmax avatar

/vueuse-functions

@de09c7b official
by Maxonmax/nuxt-skills715 stars
38

Apply VueUse composables where appropriate to build concise, maintainable Vue.js / Nuxt features.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/vueuse-functions

This session only. Nothing lands on disk.

referencesuseClamp.md

≈425 tokens on demand. Your agent reads this file only when SKILL.md points to it.

useClamp

Reactively clamp a value between two other values.

Usage

import { useClamp } from '@vueuse/math'

const min = shallowRef(0)
const max = shallowRef(10)
const value = useClamp(0, min, max)

Writable Ref

When you pass a mutable ref, the returned value is a writable computed that clamps values when setting:

import { useClamp } from '@vueuse/math'

const number = shallowRef(0)
const clamped = useClamp(number, 0, 10)

clamped.value = 15 // clamped.value will be 10
clamped.value = -5 // clamped.value will be 0

Read-only Mode

When you pass a getter function or readonly ref, the returned value is a read-only computed:

import { useClamp } from '@vueuse/math'

const value = ref(5)
const clamped = useClamp(() => value.value * 2, 0, 10)

// clamped.value is computed from the getter

Reactive Bounds

All arguments (value, min, max) can be reactive:

import { useClamp } from '@vueuse/math'

const value = shallowRef(5)
const min = shallowRef(0)
const max = shallowRef(10)

const clamped = useClamp(value, min, max)

max.value = 3 // clamped.value automatically becomes 3

Type Declarations

/**
 * Reactively clamp a value between two other values.
 *
 * @see https://vueuse.org/useClamp
 * @param value number
 * @param min
 * @param max
 *
 * @__NO_SIDE_EFFECTS__
 */
export declare function useClamp(
  value: ReadonlyRefOrGetter<number>,
  min: MaybeRefOrGetter<number>,
  max: MaybeRefOrGetter<number>,
): ComputedRef<number>
export declare function useClamp(
  value: MaybeRefOrGetter<number>,
  min: MaybeRefOrGetter<number>,
  max: MaybeRefOrGetter<number>,
): Ref<number>

Source: SKILL.md on GitHub

No alerts8d3 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    This skill is a documentation and implementation guide for the VueUse library. It maps developer requirements to reactive composables. While the skill is a legitimate development tool, it provides a surface for indirect prompt injection by demonstrating the ingestion of untrusted data from sources like the clipboard and URL parameters without explicit sanitization patterns.

  • Socket8d

    No alerts

  • Snyk8d

    Risk: LOW · No issues

Signed by skilld at de09c7b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last week
metadata
{
  "author": "SerKo <https://github.com/serkodev>",
  "version": "1.0"
}
compatibility
Requires Vue 3 (or above) or Nuxt 3 (or above) project

README badge

README badge for onmax/nuxt-skills/vueuse-functions