@ambientcss/components 2.1.0 → 3.0.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.
- package/README.md +35 -0
- package/dist/index.cjs +1544 -392
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +750 -52
- package/dist/index.d.ts +750 -52
- package/dist/index.js +1505 -392
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1045 -298
- package/package.json +10 -4
- package/src/components/AmbientButton.tsx +23 -27
- package/src/components/AmbientFader.tsx +29 -115
- package/src/components/AmbientKnob.tsx +58 -220
- package/src/components/AmbientPanel.tsx +8 -2
- package/src/components/AmbientProvider.tsx +3 -0
- package/src/components/AmbientSelect.tsx +40 -0
- package/src/components/AmbientSlider.tsx +28 -113
- package/src/components/AmbientSwitch.tsx +58 -58
- package/src/controls/AmbientBank.tsx +139 -0
- package/src/controls/AmbientLatch.tsx +78 -0
- package/src/controls/AmbientPress.tsx +74 -0
- package/src/controls/AmbientRotary.tsx +94 -0
- package/src/controls/AmbientTravel.tsx +83 -0
- package/src/core/context.tsx +46 -0
- package/src/core/controllable.ts +33 -0
- package/src/core/dev.ts +15 -0
- package/src/core/frames.tsx +63 -0
- package/src/core/kit.tsx +107 -0
- package/src/core/material.ts +27 -0
- package/src/core/numeric.ts +88 -0
- package/src/core/types.ts +116 -0
- package/src/core/useBank.ts +165 -0
- package/src/core/useLatch.ts +54 -0
- package/src/core/usePress.ts +120 -0
- package/src/core/useRotary.ts +253 -0
- package/src/core/useTravel.ts +141 -0
- package/src/index.ts +122 -2
- package/src/kits/console.tsx +80 -0
- package/src/kits/grounded.tsx +113 -0
- package/src/parts/bank.tsx +32 -0
- package/src/parts/console.tsx +101 -0
- package/src/parts/knob.tsx +203 -0
- package/src/parts/latch.tsx +33 -0
- package/src/parts/press.tsx +56 -0
- package/src/parts/travel.tsx +70 -0
- package/src/styles.css +1045 -298
package/README.md
CHANGED
|
@@ -25,3 +25,38 @@ export function Example() {
|
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
|
+
|
|
29
|
+
## Two layers
|
|
30
|
+
|
|
31
|
+
Every control is a **mechanism** — kinematics, value, state and ARIA — plus a
|
|
32
|
+
**skin**. The named components are presets that pair one with a set of parts;
|
|
33
|
+
underneath, the mechanism has no appearance of its own and will wear whatever
|
|
34
|
+
you give it.
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { AmbientRotary, KnobBody, ScaleRing } from "@ambientcss/components";
|
|
38
|
+
|
|
39
|
+
<AmbientRotary
|
|
40
|
+
value={gain} onChange={setGain}
|
|
41
|
+
travel={{ start: -135, sweep: 270 }}
|
|
42
|
+
input="drag"
|
|
43
|
+
className="amb-knob"
|
|
44
|
+
parts={{
|
|
45
|
+
panel: <ScaleRing count={13} />,
|
|
46
|
+
base: <KnobBody flush />,
|
|
47
|
+
actuator: <MyPointer />,
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Parts drop into four frames — `panel`, `base`, `actuator`, `fixture` — painted
|
|
53
|
+
in that order, of which only `actuator` moves. The control publishes its state
|
|
54
|
+
on its own root as `--ambx-percent`, `--ambx-angle`, `--ambx-size` and friends,
|
|
55
|
+
so a part can be pure CSS with no React state at all; `useControlState()` is the
|
|
56
|
+
same data typed, for parts that need JS.
|
|
57
|
+
|
|
58
|
+
Mechanisms: `AmbientRotary`, `AmbientTravel`, `AmbientPress`, `AmbientLatch`,
|
|
59
|
+
`AmbientBank`. Or take the hooks — `useRotary`, `useTravel`, `usePress`,
|
|
60
|
+
`useLatch`, `useBank` — and render the markup yourself.
|
|
61
|
+
|
|
62
|
+
Full guide: [Composing controls](https://kikkupico.github.io/ambientcss/ambient-components/composing).
|