akili-specs 2.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/.claude/commands/akili-archive.md +145 -0
- package/.claude/commands/akili-audit.md +97 -0
- package/.claude/commands/akili-constitution.md +413 -0
- package/.claude/commands/akili-execute.md +240 -0
- package/.claude/commands/akili-propose.md +167 -0
- package/.claude/commands/akili-seo.md +277 -0
- package/.claude/commands/akili-specify.md +320 -0
- package/.claude/commands/akili-test.md +141 -0
- package/.claude/commands/akili-validate.md +176 -0
- package/.claude/skills/angular-developer/SKILL.md +130 -0
- package/.claude/skills/angular-developer/references/angular-animations.md +160 -0
- package/.claude/skills/angular-developer/references/angular-aria.md +410 -0
- package/.claude/skills/angular-developer/references/cli.md +86 -0
- package/.claude/skills/angular-developer/references/component-harnesses.md +59 -0
- package/.claude/skills/angular-developer/references/component-styling.md +91 -0
- package/.claude/skills/angular-developer/references/components.md +117 -0
- package/.claude/skills/angular-developer/references/creating-services.md +97 -0
- package/.claude/skills/angular-developer/references/data-resolvers.md +69 -0
- package/.claude/skills/angular-developer/references/define-routes.md +67 -0
- package/.claude/skills/angular-developer/references/defining-providers.md +72 -0
- package/.claude/skills/angular-developer/references/di-fundamentals.md +120 -0
- package/.claude/skills/angular-developer/references/e2e-testing.md +66 -0
- package/.claude/skills/angular-developer/references/effects.md +83 -0
- package/.claude/skills/angular-developer/references/hierarchical-injectors.md +43 -0
- package/.claude/skills/angular-developer/references/host-elements.md +80 -0
- package/.claude/skills/angular-developer/references/injection-context.md +63 -0
- package/.claude/skills/angular-developer/references/inputs.md +101 -0
- package/.claude/skills/angular-developer/references/linked-signal.md +59 -0
- package/.claude/skills/angular-developer/references/loading-strategies.md +61 -0
- package/.claude/skills/angular-developer/references/mcp.md +106 -0
- package/.claude/skills/angular-developer/references/migrations.md +30 -0
- package/.claude/skills/angular-developer/references/navigate-to-routes.md +69 -0
- package/.claude/skills/angular-developer/references/outputs.md +86 -0
- package/.claude/skills/angular-developer/references/reactive-forms.md +122 -0
- package/.claude/skills/angular-developer/references/rendering-strategies.md +44 -0
- package/.claude/skills/angular-developer/references/resource.md +74 -0
- package/.claude/skills/angular-developer/references/route-animations.md +56 -0
- package/.claude/skills/angular-developer/references/route-guards.md +52 -0
- package/.claude/skills/angular-developer/references/router-lifecycle.md +45 -0
- package/.claude/skills/angular-developer/references/router-testing.md +87 -0
- package/.claude/skills/angular-developer/references/show-routes-with-outlets.md +68 -0
- package/.claude/skills/angular-developer/references/signal-forms.md +897 -0
- package/.claude/skills/angular-developer/references/signals-overview.md +94 -0
- package/.claude/skills/angular-developer/references/tailwind-css.md +69 -0
- package/.claude/skills/angular-developer/references/template-driven-forms.md +114 -0
- package/.claude/skills/angular-developer/references/testing-fundamentals.md +66 -0
- package/.claude/skills/api-design-principles/SKILL.md +528 -0
- package/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/.claude/skills/aws-serverless/SKILL.md +323 -0
- package/.claude/skills/brainstorming/SKILL.md +96 -0
- package/.claude/skills/error-handling-patterns/SKILL.md +641 -0
- package/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/.claude/skills/frontend-design/SKILL.md +272 -0
- package/.claude/skills/gsap-core/SKILL.md +254 -0
- package/.claude/skills/gsap-frameworks/SKILL.md +153 -0
- package/.claude/skills/gsap-performance/SKILL.md +79 -0
- package/.claude/skills/gsap-plugins/SKILL.md +426 -0
- package/.claude/skills/gsap-react/SKILL.md +136 -0
- package/.claude/skills/gsap-scrolltrigger/SKILL.md +296 -0
- package/.claude/skills/gsap-timeline/SKILL.md +107 -0
- package/.claude/skills/gsap-utils/SKILL.md +284 -0
- package/.claude/skills/judgment-day/SKILL.md +52 -0
- package/.claude/skills/nestjs-expert/SKILL.md +552 -0
- package/.claude/skills/product-manager-toolkit/SKILL.md +351 -0
- package/.claude/skills/product-manager-toolkit/references/prd_templates.md +317 -0
- package/.claude/skills/product-manager-toolkit/scripts/customer_interview_analyzer.py +441 -0
- package/.claude/skills/product-manager-toolkit/scripts/rice_prioritizer.py +296 -0
- package/.claude/skills/react-doctor/AGENTS.md +15 -0
- package/.claude/skills/react-doctor/SKILL.md +19 -0
- package/.claude/skills/seo-audit/SKILL.md +497 -0
- package/.claude/skills/seo-audit/evals/evals.json +136 -0
- package/.claude/skills/seo-audit/references/ai-writing-detection.md +200 -0
- package/.claude/skills/seo-audit/references/international-seo.md +230 -0
- package/.claude/skills/shadcn-ui/SKILL.md +1677 -0
- package/.claude/skills/shadcn-ui/references/learn.md +145 -0
- package/.claude/skills/shadcn-ui/references/official-ui-reference.md +1725 -0
- package/.claude/skills/shadcn-ui/references/reference.md +586 -0
- package/.claude/skills/shadcn-ui/references/ui-reference.md +1578 -0
- package/.claude/skills/stitch-design/README.md +50 -0
- package/.claude/skills/stitch-design/SKILL.md +84 -0
- package/.claude/skills/stitch-design/examples/DESIGN.md +22 -0
- package/.claude/skills/stitch-design/examples/enhanced-prompt.md +28 -0
- package/.claude/skills/stitch-design/references/design-mappings.md +45 -0
- package/.claude/skills/stitch-design/references/prompt-keywords.md +114 -0
- package/.claude/skills/stitch-design/references/tool-schemas.md +76 -0
- package/.claude/skills/stitch-design/workflows/edit-design.md +44 -0
- package/.claude/skills/stitch-design/workflows/generate-design-md.md +63 -0
- package/.claude/skills/stitch-design/workflows/text-to-design.md +47 -0
- package/.claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/.claude/skills/systematic-debugging/SKILL.md +296 -0
- package/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/.claude/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/.claude/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/.claude/skills/systematic-debugging/find-polluter.sh +63 -0
- package/.claude/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/.claude/skills/systematic-debugging/test-academic.md +14 -0
- package/.claude/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/.claude/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/.claude/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/.claude/skills/tailwind-design-system/SKILL.md +874 -0
- package/.claude/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/.claude/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.claude/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.claude/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/.claude/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.claude/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.claude/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.claude/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.claude/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/.claude/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.claude/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.claude/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.claude/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.claude/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/.claude/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.claude/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/.claude/skills/vercel-react-best-practices/AGENTS.md +2934 -0
- package/.claude/skills/vercel-react-best-practices/SKILL.md +136 -0
- package/.claude/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/.claude/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/.claude/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/.claude/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/.claude/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/.claude/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/.claude/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/.claude/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/.claude/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/.claude/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/.claude/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/.claude/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/.claude/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/.claude/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/.claude/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/.claude/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/.claude/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/.claude/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/.claude/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/.claude/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/.claude/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/.claude/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/.claude/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/.claude/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/.claude/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/.claude/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/.claude/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/.claude/templates/implementer.md +36 -0
- package/.claude/templates/leader.md +77 -0
- package/.claude/templates/reviewer.md +53 -0
- package/.mcp.json.example +12 -0
- package/CHANGELOG.md +243 -0
- package/LICENSE +21 -0
- package/README.md +795 -0
- package/assets/jc-fox-mark.svg +10 -0
- package/assets/jc-methodology-badge.png +0 -0
- package/bin/akili.js +574 -0
- package/docs/README.md +48 -0
- package/docs/cli.md +187 -0
- package/docs/commands/README.md +43 -0
- package/docs/commands/akili-archive.md +65 -0
- package/docs/commands/akili-constitution.md +91 -0
- package/docs/commands/akili-execute.md +93 -0
- package/docs/commands/akili-propose.md +65 -0
- package/docs/commands/akili-seo.md +75 -0
- package/docs/commands/akili-specify.md +69 -0
- package/docs/commands/akili-test.md +65 -0
- package/docs/commands/akili-validate.md +64 -0
- package/docs/flow.md +255 -0
- package/docs/model-routing.md +133 -0
- package/docs/openspec-comparison.md +42 -0
- package/docs/plans/2026-05-26-multi-agent-sdd-orchestration-design.md +105 -0
- package/docs/release-checklist.md +91 -0
- package/docs/skills/README.md +42 -0
- package/docs/skills/angular-developer.md +23 -0
- package/docs/skills/api-design-principles.md +22 -0
- package/docs/skills/aws-serverless.md +22 -0
- package/docs/skills/brainstorming.md +21 -0
- package/docs/skills/error-handling-patterns.md +22 -0
- package/docs/skills/frontend-design.md +23 -0
- package/docs/skills/gsap-core.md +21 -0
- package/docs/skills/gsap-frameworks.md +20 -0
- package/docs/skills/gsap-performance.md +21 -0
- package/docs/skills/gsap-plugins.md +20 -0
- package/docs/skills/gsap-react.md +22 -0
- package/docs/skills/gsap-scrolltrigger.md +21 -0
- package/docs/skills/gsap-timeline.md +20 -0
- package/docs/skills/gsap-utils.md +21 -0
- package/docs/skills/nestjs-expert.md +23 -0
- package/docs/skills/product-manager-toolkit.md +22 -0
- package/docs/skills/react-doctor.md +27 -0
- package/docs/skills/seo-audit.md +27 -0
- package/docs/skills/shadcn-ui.md +22 -0
- package/docs/skills/stitch-design.md +21 -0
- package/docs/skills/systematic-debugging.md +27 -0
- package/docs/skills/tailwind-design-system.md +23 -0
- package/docs/skills/ui-ux-pro-max.md +25 -0
- package/docs/skills/vercel-react-best-practices.md +22 -0
- package/package.json +50 -0
- package/scripts/gsc_verify.py +162 -0
- package/scripts/parse_tests.js +112 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gsap-utils
|
|
3
|
+
description: Official GSAP skill for gsap.utils — clamp, mapRange, normalize, interpolate, random, snap, toArray, wrap, pipe. Use when the user asks about gsap.utils, clamp, mapRange, random, snap, toArray, wrap, or helper utilities in GSAP.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# gsap.utils
|
|
8
|
+
|
|
9
|
+
## When to Use This Skill
|
|
10
|
+
|
|
11
|
+
Apply when writing or reviewing code that uses **gsap.utils** for math, array/collection handling, unit parsing, or value mapping in animations (e.g. mapping scroll to a value, randomizing, snapping to a grid, or normalizing inputs).
|
|
12
|
+
|
|
13
|
+
**Related skills:** Use with **gsap-core**, **gsap-timeline**, and **gsap-scrolltrigger** when building animations; CustomEase and other easing utilities are in **gsap-plugins**.
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
**gsap.utils** provides pure helpers; no need to register. Use in tween vars (e.g. function-based values), in ScrollTrigger or Observer callbacks, or in any JS that drives GSAP. All are on **gsap.utils** (e.g. `gsap.utils.clamp()`).
|
|
18
|
+
|
|
19
|
+
**Omitting the value: function form.** Many utils accept the value to transform as the **last** argument. If you omit that argument, the util returns a **function** that accepts the value later. Use the function form when you need to clamp, map, normalize, or snap many values with the same config (e.g. in a mousemove handler or tween callback). **Exception: random()** — pass **true** as the last argument to get a reusable function (do not omit the value); see [random()](https://gsap.com/docs/v3/GSAP/UtilityMethods/random()).
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
// With value: returns the result
|
|
23
|
+
gsap.utils.clamp(0, 100, 150); // 100
|
|
24
|
+
|
|
25
|
+
// Without value: returns a function you call with the value later
|
|
26
|
+
let c = gsap.utils.clamp(0, 100);
|
|
27
|
+
c(150); // 100
|
|
28
|
+
c(-10); // 0
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Clamping and Ranges
|
|
32
|
+
|
|
33
|
+
### clamp(min, max, value?)
|
|
34
|
+
|
|
35
|
+
Constrains a value between min and max. Omit **value** to get a function: `clamp(min, max)(value)`.
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
gsap.utils.clamp(0, 100, 150); // 100
|
|
39
|
+
gsap.utils.clamp(0, 100, -10); // 0
|
|
40
|
+
|
|
41
|
+
let clampFn = gsap.utils.clamp(0, 100);
|
|
42
|
+
clampFn(150); // 100
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### mapRange(inMin, inMax, outMin, outMax, value?)
|
|
46
|
+
|
|
47
|
+
Maps a value from one range to another. Use when converting scroll position, progress (0–1), or input range to an animation range. Omit **value** to get a function: `mapRange(inMin, inMax, outMin, outMax)(value)`.
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
gsap.utils.mapRange(0, 100, 0, 500, 50); // 250
|
|
51
|
+
gsap.utils.mapRange(0, 1, 0, 360, 0.5); // 180 (progress to degrees)
|
|
52
|
+
|
|
53
|
+
let mapFn = gsap.utils.mapRange(0, 100, 0, 500);
|
|
54
|
+
mapFn(50); // 250
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### normalize(min, max, value?)
|
|
58
|
+
|
|
59
|
+
Returns a value normalized to 0–1 for the given range. Inverse of mapping when the target range is 0–1. Omit **value** to get a function: `normalize(min, max)(value)`.
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
gsap.utils.normalize(0, 100, 50); // 0.5
|
|
63
|
+
gsap.utils.normalize(100, 300, 200); // 0.5
|
|
64
|
+
|
|
65
|
+
let normFn = gsap.utils.normalize(0, 100);
|
|
66
|
+
normFn(50); // 0.5
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### interpolate(start, end, progress?)
|
|
70
|
+
|
|
71
|
+
Interpolates between two values at a given progress (0–1). Handles numbers, colors, and objects with matching keys. Omit **progress** to get a function: `interpolate(start, end)(progress)`.
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
gsap.utils.interpolate(0, 100, 0.5); // 50
|
|
75
|
+
gsap.utils.interpolate("#ff0000", "#0000ff", 0.5); // mid color
|
|
76
|
+
gsap.utils.interpolate({ x: 0, y: 0 }, { x: 100, y: 50 }, 0.5); // { x: 50, y: 25 }
|
|
77
|
+
|
|
78
|
+
let lerp = gsap.utils.interpolate(0, 100);
|
|
79
|
+
lerp(0.5); // 50
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Random and Snap
|
|
83
|
+
|
|
84
|
+
### random(minimum, maximum[, snapIncrement, returnFunction]) / random(array[, returnFunction])
|
|
85
|
+
|
|
86
|
+
Returns a random number in the range **minimum**–**maximum**, or a random element from an **array**. Optional **snapIncrement** snaps the result to the nearest multiple (e.g. `5` → multiples of 5). **To get a reusable function**, pass **true** as the last argument (**returnFunction**); the returned function takes no args and returns a new random value each time. This is the only util that uses `true` for the function form instead of omitting the value.
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
// immediate value: number in range
|
|
90
|
+
gsap.utils.random(-100, 100); // e.g. 42.7
|
|
91
|
+
gsap.utils.random(0, 500, 5); // 0–500, snapped to nearest 5
|
|
92
|
+
|
|
93
|
+
// reusable function: pass true as last argument
|
|
94
|
+
let randomFn = gsap.utils.random(-200, 500, 10, true);
|
|
95
|
+
randomFn(); // random value in range, snapped to 10
|
|
96
|
+
randomFn(); // another random value
|
|
97
|
+
|
|
98
|
+
// array: pick one value at random
|
|
99
|
+
gsap.utils.random(["red", "blue", "green"]); // "red", "blue", or "green"
|
|
100
|
+
let randomFromArray = gsap.utils.random([0, 100, 200], true);
|
|
101
|
+
randomFromArray(); // 0, 100, or 200
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**String form in tween vars:** use `"random(-100, 100)"`, `"random(-100, 100, 5)"`, or `"random([0, 100, 200])"`; GSAP evaluates it per target.
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
gsap.to(".box", { x: "random(-100, 100, 5)", duration: 1 });
|
|
108
|
+
gsap.to(".item", { backgroundColor: "random([red, blue, green])" });
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### snap(snapTo, value?)
|
|
112
|
+
|
|
113
|
+
Snaps a value to the nearest multiple of **snapTo**, or to the nearest value in an array of allowed values. Omit **value** to get a function: `snap(snapTo)(value)` (or `snap(snapArray)(value)`).
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
gsap.utils.snap(10, 23); // 20
|
|
117
|
+
gsap.utils.snap(0.25, 0.7); // 0.75
|
|
118
|
+
gsap.utils.snap([0, 100, 200], 150); // 100 or 200 (nearest in array)
|
|
119
|
+
|
|
120
|
+
let snapFn = gsap.utils.snap(10);
|
|
121
|
+
snapFn(23); // 20
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Use in tweens for grid or step-based animation:
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
gsap.to(".x", { x: 200, snap: { x: 20 } });
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### shuffle(array)
|
|
131
|
+
|
|
132
|
+
Returns a new array with the same elements in random order. Use for randomizing order (e.g. stagger from "random" with a copy).
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
gsap.utils.shuffle([1, 2, 3, 4]); // e.g. [3, 1, 4, 2]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### distribute(config)
|
|
139
|
+
|
|
140
|
+
**Returns a function** that assigns a value to each target based on its position in the array (or in a grid). Used internally for advanced staggers; use it whenever you need values spread across many elements (e.g. scale, opacity, x, delay). The returned function receives `(index, target, targets)` — either call it manually or pass the result directly into a tween; GSAP will call it per target with index, element, and array.
|
|
141
|
+
|
|
142
|
+
**Config (all optional):**
|
|
143
|
+
|
|
144
|
+
| Property | Type | Description |
|
|
145
|
+
|----------|------|-------------|
|
|
146
|
+
| `base` | Number | Starting value. Default `0`. |
|
|
147
|
+
| `amount` | Number | Total to distribute across all targets (added to base). E.g. `amount: 1` with 100 targets → 0.01 between each. Use **each** instead to set a fixed step per target. |
|
|
148
|
+
| `each` | Number | Amount to add between each target (added to base). E.g. `each: 1` with 4 targets → 0, 1, 2, 3. Use **amount** instead to split a total. |
|
|
149
|
+
| `from` | Number \| String \| Array | Where distribution starts: index, or `"start"`, `"center"`, `"edges"`, `"random"`, `"end"`, or ratios like `[0.25, 0.75]`. Default `0`. |
|
|
150
|
+
| `grid` | String \| Array | Use grid position instead of flat index: `[rows, columns]` (e.g. `[5, 10]`) or `"auto"` to detect. Omit for flat array. |
|
|
151
|
+
| `axis` | String | For grid: limit to one axis (`"x"` or `"y"`). |
|
|
152
|
+
| `ease` | Ease | Distribute values along an ease curve (e.g. `"power1.inOut"`). Default `"none"`. |
|
|
153
|
+
|
|
154
|
+
**In a tween:** pass the result of `distribute(config)` as the property value; GSAP calls the function for each target with `(index, target, targets)`.
|
|
155
|
+
|
|
156
|
+
```javascript
|
|
157
|
+
// Scale: middle elements 0.5, outer edges 3 (amount 2.5 distributed from center)
|
|
158
|
+
gsap.to(".class", {
|
|
159
|
+
scale: gsap.utils.distribute({
|
|
160
|
+
base: 0.5,
|
|
161
|
+
amount: 2.5,
|
|
162
|
+
from: "center"
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Manual use:** call the returned function with `(index, target, targets)` to get the value for that index.
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
const distributor = gsap.utils.distribute({
|
|
171
|
+
base: 50,
|
|
172
|
+
amount: 100,
|
|
173
|
+
from: "center",
|
|
174
|
+
ease: "power1.inOut"
|
|
175
|
+
});
|
|
176
|
+
const targets = gsap.utils.toArray(".box");
|
|
177
|
+
const valueForIndex2 = distributor(2, targets[2], targets);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
See [distribute()](https://gsap.com/docs/v3/GSAP/UtilityMethods/distribute/) for more.
|
|
181
|
+
|
|
182
|
+
## Units and Parsing
|
|
183
|
+
|
|
184
|
+
### getUnit(value)
|
|
185
|
+
|
|
186
|
+
Returns the unit string of a value (e.g. `"px"`, `"%"`, `"deg"`). Use when normalizing or converting values.
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
gsap.utils.getUnit("100px"); // "px"
|
|
190
|
+
gsap.utils.getUnit("50%"); // "%"
|
|
191
|
+
gsap.utils.getUnit(42); // "" (unitless)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### unitize(value, unit)
|
|
195
|
+
|
|
196
|
+
Appends a unit to a number, or returns the value as-is if it already has a unit. Use when building CSS values or tween end values.
|
|
197
|
+
|
|
198
|
+
```javascript
|
|
199
|
+
gsap.utils.unitize(100, "px"); // "100px"
|
|
200
|
+
gsap.utils.unitize("2rem", "px"); // "2rem" (unchanged)
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### splitColor(color, returnHSL?)
|
|
204
|
+
|
|
205
|
+
Converts a color string into an array: **[red, green, blue]** (0–255), or **[red, green, blue, alpha]** (4 elements for RGBA when alpha is present or required). Pass **true** as the second argument (**returnHSL**) to get **[hue, saturation, lightness]** or **[hue, saturation, lightness, alpha]** (HSL/HSLA) instead. Works with `"rgb()"`, `"rgba()"`, `"hsl()"`, `"hsla()"`, hex, and named colors (e.g. `"red"`). Use when animating color components or building gradients. See [splitColor()](https://gsap.com/docs/v3/GSAP/UtilityMethods/splitColor/).
|
|
206
|
+
|
|
207
|
+
```javascript
|
|
208
|
+
gsap.utils.splitColor("red"); // [255, 0, 0]
|
|
209
|
+
gsap.utils.splitColor("#6fb936"); // [111, 185, 54]
|
|
210
|
+
gsap.utils.splitColor("rgba(204, 153, 51, 0.5)"); // [204, 153, 51, 0.5] (4 elements)
|
|
211
|
+
gsap.utils.splitColor("#6fb936", true); // [94, 55, 47] (HSL: hue, saturation, lightness)
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Arrays and Collections
|
|
215
|
+
|
|
216
|
+
### selector(scope)
|
|
217
|
+
|
|
218
|
+
Returns a scoped selector function that finds elements only within the given element (or ref). Use in components so selectors like `".box"` match only descendants of that component, not the whole document. Accepts a DOM element or a ref (e.g. React ref; handles `.current`).
|
|
219
|
+
|
|
220
|
+
```javascript
|
|
221
|
+
const q = gsap.utils.selector(containerRef);
|
|
222
|
+
q(".box"); // array of .box elements inside container
|
|
223
|
+
gsap.to(q(".circle"), { x: 100 });
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### toArray(value, scope?)
|
|
227
|
+
|
|
228
|
+
Converts a value to an array: selector string (scoped to element), NodeList, HTMLCollection, single element, or array. Use when passing mixed inputs to GSAP (e.g. targets) and a true array is needed.
|
|
229
|
+
|
|
230
|
+
```javascript
|
|
231
|
+
gsap.utils.toArray(".item"); // array of elements
|
|
232
|
+
gsap.utils.toArray(".item", container); // scoped to container
|
|
233
|
+
gsap.utils.toArray(nodeList); // [ ... ] from NodeList
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### pipe(...functions)
|
|
237
|
+
|
|
238
|
+
Composes functions: **pipe(f1, f2, f3)(value)** returns f3(f2(f1(value))). Use when applying a chain of transforms (e.g. normalize → mapRange → snap) in a tween or callback.
|
|
239
|
+
|
|
240
|
+
```javascript
|
|
241
|
+
const fn = gsap.utils.pipe(
|
|
242
|
+
(v) => gsap.utils.normalize(0, 100, v),
|
|
243
|
+
(v) => gsap.utils.snap(0.1, v)
|
|
244
|
+
);
|
|
245
|
+
fn(50); // normalized then snapped
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### wrap(min, max, value?)
|
|
249
|
+
|
|
250
|
+
Wraps a value into the range min–max (inclusive min, exclusive max). Use for infinite scroll or cyclic values. Omit **value** to get a function: `wrap(min, max)(value)`.
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
gsap.utils.wrap(0, 360, 370); // 10
|
|
254
|
+
gsap.utils.wrap(0, 360, -10); // 350
|
|
255
|
+
|
|
256
|
+
let wrapFn = gsap.utils.wrap(0, 360);
|
|
257
|
+
wrapFn(370); // 10
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### wrapYoyo(min, max, value?)
|
|
261
|
+
|
|
262
|
+
Wraps value in range with a yoyo (bounces at ends). Use for back-and-forth within a range. Omit **value** to get a function: `wrapYoyo(min, max)(value)`.
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
gsap.utils.wrapYoyo(0, 100, 150); // 50 (bounces back)
|
|
266
|
+
|
|
267
|
+
let wrapY = gsap.utils.wrapYoyo(0, 100);
|
|
268
|
+
wrapY(150); // 50
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Best practices
|
|
272
|
+
|
|
273
|
+
- ✅ Omit the value argument to get a reusable function when the same range/config is used many times (e.g. scroll handler, tween callback): `let mapFn = gsap.utils.mapRange(0, 1, 0, 360); mapFn(progress)`.
|
|
274
|
+
- ✅ Use **snap** for grid-aligned or step-based values; use **toArray** when GSAP or your code needs a real array from a selector or NodeList.
|
|
275
|
+
- ✅ Use **gsap.utils.selector(scope)** in components so selectors are scoped to a container or ref.
|
|
276
|
+
|
|
277
|
+
## Do Not
|
|
278
|
+
|
|
279
|
+
- ❌ Assume **mapRange** / **normalize** handle units; they work on numbers. Use **getUnit** / **unitize** when units matter.
|
|
280
|
+
- ❌ Override or rely on undocumented behavior; stick to the documented API.
|
|
281
|
+
|
|
282
|
+
### Learn More
|
|
283
|
+
|
|
284
|
+
https://gsap.com/docs/v3/HelperFunctions
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: judgment-day
|
|
3
|
+
description: "Trigger: judgment day, dual review, adversarial review, juzgar. Run explicit blind dual review with at most two scoped fix/re-judgment rounds."
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
author: gentleman-programming
|
|
7
|
+
version: "1.6"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Activation Contract
|
|
11
|
+
|
|
12
|
+
Load only when the user explicitly requests Judgment Day or equivalent dual/adversarial review for a concrete target. Judgment Day replaces ordinary 4R for that target; never run both.
|
|
13
|
+
|
|
14
|
+
## Hard Rules
|
|
15
|
+
|
|
16
|
+
- Resolve matching project skills before starting and pass the same paths to both judges and any fix actor.
|
|
17
|
+
- Build one complete immutable target, then launch two blind read-only judges in parallel with identical scope and criteria.
|
|
18
|
+
- Each judge returns one neutral findings result and terminates. Wait for both; never accept a partial judgment.
|
|
19
|
+
- Never launch `review-refuter`; two-judge agreement is the corroboration mechanism.
|
|
20
|
+
- Only the parent orchestrator merges/persists findings, launches the fix actor, launches scoped re-judgment, and updates native counters.
|
|
21
|
+
- Fix only severe findings confirmed by both judges. WARNING/SUGGESTION rows remain `info`.
|
|
22
|
+
- Permit at most two fix rounds and two scoped re-judgments. Re-judgment sees only the frozen ledger plus fix delta and may record fix-caused defects.
|
|
23
|
+
- Terminal transaction states are only `approved | escalated`; never reset or extend an exhausted lineage.
|
|
24
|
+
|
|
25
|
+
## Decision Gates
|
|
26
|
+
|
|
27
|
+
| Condition | Action |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Target unclear | Ask one scope question and stop. |
|
|
30
|
+
| Both judges confirm severe finding | Ask before round-one correction; then use the bounded fix actor. |
|
|
31
|
+
| One judge reports it | Record suspect; do not auto-fix. |
|
|
32
|
+
| Judges contradict | Escalate for explicit human decision. |
|
|
33
|
+
| Scoped re-judgment fails before round two | Parent may launch the final bounded fix round. |
|
|
34
|
+
| Any issue remains after round two | Escalate and stop. |
|
|
35
|
+
|
|
36
|
+
## Execution Steps
|
|
37
|
+
|
|
38
|
+
1. Start `review/start(target, mode=judgment_day)` and persist the transaction.
|
|
39
|
+
2. Launch both read-only judges against the same immutable target.
|
|
40
|
+
3. Merge findings into the frozen ledger and persist it through the selected artifact store.
|
|
41
|
+
4. Ask before round-one correction; run the fix actor only for confirmed severe IDs.
|
|
42
|
+
5. Run both judges again only over the frozen ledger plus immutable fix delta.
|
|
43
|
+
6. Repeat once at most, then run independent final verification and emit the terminal receipt.
|
|
44
|
+
|
|
45
|
+
## Output Contract
|
|
46
|
+
|
|
47
|
+
Return target identity, round, confirmed/suspect/contradiction/INFO counts, correction work units, scoped re-judgment result, artifact references, skill resolution, and exactly one final `JUDGMENT: APPROVED ✅` or `JUDGMENT: ESCALATED ⚠️`.
|
|
48
|
+
|
|
49
|
+
## References
|
|
50
|
+
|
|
51
|
+
- [../_shared/review-ledger-contract.md](../_shared/review-ledger-contract.md) — canonical transaction, ledger, persistence, and lifecycle contract.
|
|
52
|
+
- [references/prompts-and-formats.md](references/prompts-and-formats.md) — compact judge/fix prompts and verdict shape.
|