mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
docs(design): cross-reference feature-slice and feature-availability (#357)
This commit is contained in:
@@ -38,11 +38,11 @@ type FeatureAvailability = 'available' | 'unavailable' | 'unsupported';
|
||||
|
||||
## Related: Missing Feature vs Unavailable Capability
|
||||
|
||||
See [player-api](/rfc/player-api/index.md) for feature access patterns.
|
||||
See [feature-slice-design](feature-slice-design.md) for feature access patterns.
|
||||
|
||||
| Concept | Cause | Detection |
|
||||
| ---------------------- | ------------------- | --------------------------------- |
|
||||
| Missing feature | Composition error | `hasFeature()` returns `false` |
|
||||
| Missing feature | Feature not included| `slice === undefined` |
|
||||
| Unavailable capability | Platform limitation | `*Availability === 'unsupported'` |
|
||||
|
||||
---
|
||||
@@ -105,24 +105,6 @@ const volumeFeature = createFeature<HTMLMediaElement>()({
|
||||
|
||||
Guards receive `{ target, signal }`, not state. Check capability on target directly.
|
||||
|
||||
### UI Usage
|
||||
|
||||
```tsx
|
||||
function VolumeSlider() {
|
||||
const player = usePlayer();
|
||||
|
||||
if (!hasFeature(player, features.volume)) return null;
|
||||
|
||||
const { volume, volumeAvailability } = player;
|
||||
|
||||
if (volumeAvailability === 'unsupported') return null;
|
||||
if (volumeAvailability === 'unavailable') return <Slider disabled />;
|
||||
return <Slider value={volume} />;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
- Media Chrome uses similar pattern with `*Unavailable` properties
|
||||
|
||||
@@ -154,9 +154,9 @@ A thin lens over the store — flat access, scoped subscription:
|
||||
3. **Layered API** — Primitive layer is generic, player layer is typed and convenient
|
||||
4. **Familiar pattern** — Similar to Jotai atoms, Vue InjectionKey
|
||||
|
||||
## Alternatives Considered
|
||||
## Related
|
||||
|
||||
See [`rfc/player-api/primitives.md`](../../rfc/player-api/primitives.md) for the proxy-level API.
|
||||
See [feature-availability-design](feature-availability-design.md) for capability detection patterns.
|
||||
|
||||
## Files
|
||||
|
||||
|
||||
Reference in New Issue
Block a user