@hozo/primitives 0.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/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/flat-list.native.d.ts +17 -0
- package/dist/flat-list.native.d.ts.map +1 -0
- package/dist/flat-list.native.js +89 -0
- package/dist/flat-list.native.js.map +1 -0
- package/dist/foundation.d.ts +104 -0
- package/dist/foundation.d.ts.map +1 -0
- package/dist/foundation.js +115 -0
- package/dist/foundation.js.map +1 -0
- package/dist/foundation.native.d.ts +59 -0
- package/dist/foundation.native.d.ts.map +1 -0
- package/dist/foundation.native.js +40 -0
- package/dist/foundation.native.js.map +1 -0
- package/dist/generated/animated.d.ts +2 -0
- package/dist/generated/animated.d.ts.map +1 -0
- package/dist/generated/animated.js +3 -0
- package/dist/generated/animated.js.map +1 -0
- package/dist/generated/backdrop-filter.d.ts +2 -0
- package/dist/generated/backdrop-filter.d.ts.map +1 -0
- package/dist/generated/backdrop-filter.js +3 -0
- package/dist/generated/backdrop-filter.js.map +1 -0
- package/dist/generated/container.d.ts +2 -0
- package/dist/generated/container.d.ts.map +1 -0
- package/dist/generated/container.js +3 -0
- package/dist/generated/container.js.map +1 -0
- package/dist/generated/flat-list.d.ts +2 -0
- package/dist/generated/flat-list.d.ts.map +1 -0
- package/dist/generated/flat-list.js +2 -0
- package/dist/generated/flat-list.js.map +1 -0
- package/dist/generated/flat-list.native.d.ts +3 -0
- package/dist/generated/flat-list.native.d.ts.map +1 -0
- package/dist/generated/flat-list.native.js +2 -0
- package/dist/generated/flat-list.native.js.map +1 -0
- package/dist/generated/grid.d.ts +3 -0
- package/dist/generated/grid.d.ts.map +1 -0
- package/dist/generated/grid.js +4 -0
- package/dist/generated/grid.js.map +1 -0
- package/dist/generated/link.d.ts +2 -0
- package/dist/generated/link.d.ts.map +1 -0
- package/dist/generated/link.js +2 -0
- package/dist/generated/link.js.map +1 -0
- package/dist/generated/link.native.d.ts +2 -0
- package/dist/generated/link.native.d.ts.map +1 -0
- package/dist/generated/link.native.js +2 -0
- package/dist/generated/link.native.js.map +1 -0
- package/dist/generated/pressable.d.ts +2 -0
- package/dist/generated/pressable.d.ts.map +1 -0
- package/dist/generated/pressable.js +2 -0
- package/dist/generated/pressable.js.map +1 -0
- package/dist/generated/pressable.native.d.ts +2 -0
- package/dist/generated/pressable.native.d.ts.map +1 -0
- package/dist/generated/pressable.native.js +2 -0
- package/dist/generated/pressable.native.js.map +1 -0
- package/dist/generated/refresh-control.d.ts +2 -0
- package/dist/generated/refresh-control.d.ts.map +1 -0
- package/dist/generated/refresh-control.js +2 -0
- package/dist/generated/refresh-control.js.map +1 -0
- package/dist/generated/refresh-control.native.d.ts +2 -0
- package/dist/generated/refresh-control.native.d.ts.map +1 -0
- package/dist/generated/refresh-control.native.js +2 -0
- package/dist/generated/refresh-control.native.js.map +1 -0
- package/dist/generated/scroll-view.d.ts +2 -0
- package/dist/generated/scroll-view.d.ts.map +1 -0
- package/dist/generated/scroll-view.js +2 -0
- package/dist/generated/scroll-view.js.map +1 -0
- package/dist/generated/scroll-view.native.d.ts +2 -0
- package/dist/generated/scroll-view.native.d.ts.map +1 -0
- package/dist/generated/scroll-view.native.js +2 -0
- package/dist/generated/scroll-view.native.js.map +1 -0
- package/dist/generated/spaced.d.ts +2 -0
- package/dist/generated/spaced.d.ts.map +1 -0
- package/dist/generated/spaced.js +3 -0
- package/dist/generated/spaced.js.map +1 -0
- package/dist/generated/text-input.d.ts +2 -0
- package/dist/generated/text-input.d.ts.map +1 -0
- package/dist/generated/text-input.js +2 -0
- package/dist/generated/text-input.js.map +1 -0
- package/dist/generated/text-input.native.d.ts +2 -0
- package/dist/generated/text-input.native.d.ts.map +1 -0
- package/dist/generated/text-input.native.js +2 -0
- package/dist/generated/text-input.native.js.map +1 -0
- package/dist/generated/text-size.d.ts +2 -0
- package/dist/generated/text-size.d.ts.map +1 -0
- package/dist/generated/text-size.js +3 -0
- package/dist/generated/text-size.js.map +1 -0
- package/dist/generated/text.d.ts +2 -0
- package/dist/generated/text.d.ts.map +1 -0
- package/dist/generated/text.js +5 -0
- package/dist/generated/text.js.map +1 -0
- package/dist/generated/view.d.ts +2 -0
- package/dist/generated/view.d.ts.map +1 -0
- package/dist/generated/view.js +2 -0
- package/dist/generated/view.js.map +1 -0
- package/dist/generated/view.native.d.ts +2 -0
- package/dist/generated/view.native.d.ts.map +1 -0
- package/dist/generated/view.native.js +2 -0
- package/dist/generated/view.native.js.map +1 -0
- package/dist/index.d.ts +188 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +718 -0
- package/dist/index.js.map +1 -0
- package/dist/index.native.d.ts +22 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/index.native.js +8 -0
- package/dist/index.native.js.map +1 -0
- package/dist/link.d.ts +320 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +69 -0
- package/dist/link.js.map +1 -0
- package/dist/link.native.d.ts +33 -0
- package/dist/link.native.d.ts.map +1 -0
- package/dist/link.native.js +44 -0
- package/dist/link.native.js.map +1 -0
- package/dist/pressable.d.ts +65 -0
- package/dist/pressable.d.ts.map +1 -0
- package/dist/pressable.js +202 -0
- package/dist/pressable.js.map +1 -0
- package/dist/pressable.native.d.ts +55 -0
- package/dist/pressable.native.d.ts.map +1 -0
- package/dist/pressable.native.js +405 -0
- package/dist/pressable.native.js.map +1 -0
- package/dist/runtime-backdrop.native.d.ts +8 -0
- package/dist/runtime-backdrop.native.d.ts.map +1 -0
- package/dist/runtime-backdrop.native.js +12 -0
- package/dist/runtime-backdrop.native.js.map +1 -0
- package/dist/runtime-container.native.d.ts +41 -0
- package/dist/runtime-container.native.d.ts.map +1 -0
- package/dist/runtime-container.native.js +61 -0
- package/dist/runtime-container.native.js.map +1 -0
- package/dist/runtime-grid.d.ts +37 -0
- package/dist/runtime-grid.d.ts.map +1 -0
- package/dist/runtime-grid.js +139 -0
- package/dist/runtime-grid.js.map +1 -0
- package/dist/runtime-grid.native.d.ts +26 -0
- package/dist/runtime-grid.native.d.ts.map +1 -0
- package/dist/runtime-grid.native.js +76 -0
- package/dist/runtime-grid.native.js.map +1 -0
- package/dist/runtime-measured.d.ts +20 -0
- package/dist/runtime-measured.d.ts.map +1 -0
- package/dist/runtime-measured.js +42 -0
- package/dist/runtime-measured.js.map +1 -0
- package/dist/runtime-spacing.d.ts +9 -0
- package/dist/runtime-spacing.d.ts.map +1 -0
- package/dist/runtime-spacing.js +35 -0
- package/dist/runtime-spacing.js.map +1 -0
- package/dist/runtime-spacing.native.d.ts +12 -0
- package/dist/runtime-spacing.native.d.ts.map +1 -0
- package/dist/runtime-spacing.native.js +64 -0
- package/dist/runtime-spacing.native.js.map +1 -0
- package/dist/runtime-text-size.native.d.ts +29 -0
- package/dist/runtime-text-size.native.d.ts.map +1 -0
- package/dist/runtime-text-size.native.js +51 -0
- package/dist/runtime-text-size.native.js.map +1 -0
- package/dist/runtime-transition.native.d.ts +15 -0
- package/dist/runtime-transition.native.d.ts.map +1 -0
- package/dist/runtime-transition.native.js +156 -0
- package/dist/runtime-transition.native.js.map +1 -0
- package/dist/text-input.d.ts +40 -0
- package/dist/text-input.d.ts.map +1 -0
- package/dist/text-input.js +54 -0
- package/dist/text-input.js.map +1 -0
- package/dist/view.d.ts +42 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +84 -0
- package/dist/view.js.map +1 -0
- package/dist/view.native.d.ts +8 -0
- package/dist/view.native.d.ts.map +1 -0
- package/dist/view.native.js +5 -0
- package/dist/view.native.js.map +1 -0
- package/dist/windowing.d.ts +149 -0
- package/dist/windowing.d.ts.map +1 -0
- package/dist/windowing.js +336 -0
- package/dist/windowing.js.map +1 -0
- package/package.json +160 -0
- package/src/flat-list.native.tsx +158 -0
- package/src/foundation.native.tsx +179 -0
- package/src/foundation.tsx +323 -0
- package/src/generated/animated.ts +6 -0
- package/src/generated/backdrop-filter.ts +5 -0
- package/src/generated/container.ts +7 -0
- package/src/generated/flat-list.native.ts +6 -0
- package/src/generated/flat-list.ts +7 -0
- package/src/generated/grid.ts +4 -0
- package/src/generated/link.native.ts +1 -0
- package/src/generated/link.ts +1 -0
- package/src/generated/pressable.native.ts +5 -0
- package/src/generated/pressable.ts +5 -0
- package/src/generated/refresh-control.native.ts +4 -0
- package/src/generated/refresh-control.ts +1 -0
- package/src/generated/scroll-view.native.ts +4 -0
- package/src/generated/scroll-view.ts +1 -0
- package/src/generated/spaced.ts +2 -0
- package/src/generated/text-input.native.ts +4 -0
- package/src/generated/text-input.ts +1 -0
- package/src/generated/text-size.ts +7 -0
- package/src/generated/text.ts +8 -0
- package/src/generated/view.native.ts +1 -0
- package/src/generated/view.ts +1 -0
- package/src/index.native.ts +24 -0
- package/src/index.ts +1111 -0
- package/src/link.native.tsx +77 -0
- package/src/link.ts +125 -0
- package/src/pressable.native.tsx +538 -0
- package/src/pressable.ts +358 -0
- package/src/runtime-backdrop.native.tsx +22 -0
- package/src/runtime-container.native.tsx +105 -0
- package/src/runtime-grid.native.tsx +143 -0
- package/src/runtime-grid.ts +198 -0
- package/src/runtime-measured.ts +42 -0
- package/src/runtime-spacing.native.tsx +75 -0
- package/src/runtime-spacing.ts +37 -0
- package/src/runtime-text-size.native.tsx +79 -0
- package/src/runtime-transition.native.tsx +183 -0
- package/src/text-input.ts +129 -0
- package/src/view.native.ts +7 -0
- package/src/view.ts +165 -0
- package/src/windowing.ts +415 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { blendColor } from '@hozo/engine';
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
4
|
+
import { Animated, Easing, Pressable, StyleSheet, Text, } from 'react-native';
|
|
5
|
+
const HOVERED = 1;
|
|
6
|
+
const FOCUSED = 2;
|
|
7
|
+
const PRESSED = 4;
|
|
8
|
+
const FOCUS_VISIBLE = 8;
|
|
9
|
+
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
10
|
+
/**
|
|
11
|
+
* Which Pressable to render, and it is not a preference.
|
|
12
|
+
*
|
|
13
|
+
* `Animated.createAnimatedComponent` drops a *function* style. React
|
|
14
|
+
* Native's `AnimatedProps.__getValueWithStaticProps` flattens the static
|
|
15
|
+
* style before handing it on:
|
|
16
|
+
*
|
|
17
|
+
* const flatStaticStyle = flattenStyle(staticStyle);
|
|
18
|
+
* ...
|
|
19
|
+
* } else { props[key] = flatStaticStyle; }
|
|
20
|
+
*
|
|
21
|
+
* and `flattenStyle` of a function is `undefined`, so the element renders
|
|
22
|
+
* with no style at all -- no background, no padding, nothing. A compiled
|
|
23
|
+
* `hover:` class produces exactly that callback, so every Pressable with a
|
|
24
|
+
* state variant and no transition rendered unstyled on both platforms.
|
|
25
|
+
*
|
|
26
|
+
* Measured rather than reasoned: four probes on the census screen, each
|
|
27
|
+
* adding one ingredient, and the one that lost its colour was the callback
|
|
28
|
+
* without a transition (#357). #334 had already fixed the transition half
|
|
29
|
+
* by passing an array, which is why that half draws.
|
|
30
|
+
*
|
|
31
|
+
* So an element with nothing to animate gets the plain Pressable, which
|
|
32
|
+
* takes a callback as its own API and keeps React Native's timing for
|
|
33
|
+
* `pressed` with it.
|
|
34
|
+
*/
|
|
35
|
+
// Annotated because the inferred type of the animated component names an
|
|
36
|
+
// internal React Native type that cannot be referenced from a declaration
|
|
37
|
+
// file. `ElementType` says the only thing the caller needs: it is a
|
|
38
|
+
// component to render.
|
|
39
|
+
export function pressableFor(transition) {
|
|
40
|
+
return transition ? AnimatedPressable : Pressable;
|
|
41
|
+
}
|
|
42
|
+
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
43
|
+
const InteractionContext = createContext(null);
|
|
44
|
+
function easingFor(name) {
|
|
45
|
+
switch (name) {
|
|
46
|
+
case 'linear':
|
|
47
|
+
return Easing.linear;
|
|
48
|
+
case 'ease-in':
|
|
49
|
+
return Easing.in(Easing.ease);
|
|
50
|
+
case 'ease-out':
|
|
51
|
+
return Easing.out(Easing.ease);
|
|
52
|
+
case 'ease-in-out':
|
|
53
|
+
return Easing.inOut(Easing.ease);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const transformRank = (key) => key.startsWith('translate') ? 0 : key.startsWith('rotate') ? 1 : 2;
|
|
57
|
+
function transformTargets(style) {
|
|
58
|
+
const merged = new Map();
|
|
59
|
+
const visit = (part) => {
|
|
60
|
+
if (!part)
|
|
61
|
+
return;
|
|
62
|
+
if (Array.isArray(part))
|
|
63
|
+
return part.forEach(visit);
|
|
64
|
+
const transform = StyleSheet.flatten(part)?.transform;
|
|
65
|
+
// React Native also accepts a CSS transform string, which has no
|
|
66
|
+
// entries to read. Nothing here can animate one, and the `as any[]`
|
|
67
|
+
// that used to stand here let it reach `Object.entries` and come back
|
|
68
|
+
// with a key of `'0'`.
|
|
69
|
+
if (typeof transform === 'string')
|
|
70
|
+
return;
|
|
71
|
+
for (const entry of transform || []) {
|
|
72
|
+
const [key, raw] = Object.entries(entry)[0] || [];
|
|
73
|
+
if (!key)
|
|
74
|
+
continue;
|
|
75
|
+
if (key === 'scale' && typeof raw === 'number') {
|
|
76
|
+
merged.set('scaleX', { key: 'scaleX', value: raw, degrees: false });
|
|
77
|
+
merged.set('scaleY', { key: 'scaleY', value: raw, degrees: false });
|
|
78
|
+
}
|
|
79
|
+
else if (typeof raw === 'number') {
|
|
80
|
+
merged.set(key, { key, value: raw, degrees: false });
|
|
81
|
+
}
|
|
82
|
+
else if (typeof raw === 'string' && raw.endsWith('deg')) {
|
|
83
|
+
const value = Number(raw.slice(0, -3));
|
|
84
|
+
if (Number.isFinite(value))
|
|
85
|
+
merged.set(key, { key, value, degrees: true });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
visit(style);
|
|
90
|
+
return [...merged.values()].sort((a, b) => transformRank(a.key) - transformRank(b.key));
|
|
91
|
+
}
|
|
92
|
+
function identityFor(target) {
|
|
93
|
+
return target.key.startsWith('scale') ? 1 : 0;
|
|
94
|
+
}
|
|
95
|
+
const COLOR_KEYS = ['backgroundColor', 'color'];
|
|
96
|
+
function colorTargets(style) {
|
|
97
|
+
const flattened = StyleSheet.flatten(style);
|
|
98
|
+
const colors = new Map();
|
|
99
|
+
for (const key of COLOR_KEYS) {
|
|
100
|
+
const value = flattened?.[key];
|
|
101
|
+
if (typeof value === 'string')
|
|
102
|
+
colors.set(key, value);
|
|
103
|
+
}
|
|
104
|
+
return colors;
|
|
105
|
+
}
|
|
106
|
+
export function HozoPressable({ style, onHoverIn, onHoverOut, onFocus, onBlur, onPressIn, onPressOut, onPointerDown, onKeyDown, hozoTransition, hozoFocusVisible = false, ...props }) {
|
|
107
|
+
const [interaction, setInteraction] = useState(0);
|
|
108
|
+
const interactionRef = useRef(0);
|
|
109
|
+
const initialStyle = typeof style === 'function'
|
|
110
|
+
? style({ pressed: false, hovered: false, focused: false, focusVisible: false })
|
|
111
|
+
: style;
|
|
112
|
+
const initialOpacity = StyleSheet.flatten(initialStyle)?.opacity;
|
|
113
|
+
const opacity = useRef(new Animated.Value(typeof initialOpacity === 'number' ? initialOpacity : 1)).current;
|
|
114
|
+
const colorSpecs = useMemo(() => {
|
|
115
|
+
if (!hozoTransition?.colors || typeof style !== 'function')
|
|
116
|
+
return [];
|
|
117
|
+
const found = new Set();
|
|
118
|
+
for (const pressed of [false, true]) {
|
|
119
|
+
for (const hovered of [false, true]) {
|
|
120
|
+
for (const focused of [false, true]) {
|
|
121
|
+
for (const focusVisible of [false, true]) {
|
|
122
|
+
for (const key of colorTargets(style({ pressed, hovered, focused, focusVisible })).keys())
|
|
123
|
+
found.add(key);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return [...found];
|
|
129
|
+
}, [hozoTransition?.colors, style]);
|
|
130
|
+
const initialColors = colorTargets(initialStyle);
|
|
131
|
+
const colorRanges = useRef(new Map()).current;
|
|
132
|
+
for (const key of colorSpecs) {
|
|
133
|
+
if (!colorRanges.has(key)) {
|
|
134
|
+
const initial = initialColors.get(key) ?? (key === 'backgroundColor' ? 'transparent' : '');
|
|
135
|
+
if (initial)
|
|
136
|
+
colorRanges.set(key, { from: initial, to: initial });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const colorProgress = useRef(new Animated.Value(0)).current;
|
|
140
|
+
const colorFraction = useRef(0);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
const listener = colorProgress.addListener(({ value }) => {
|
|
143
|
+
colorFraction.current = value;
|
|
144
|
+
});
|
|
145
|
+
return () => colorProgress.removeListener(listener);
|
|
146
|
+
}, [colorProgress]);
|
|
147
|
+
const animatedColors = Object.fromEntries([...colorRanges].map(([key, range]) => [
|
|
148
|
+
key,
|
|
149
|
+
colorProgress.interpolate({
|
|
150
|
+
inputRange: [0, 1],
|
|
151
|
+
outputRange: [range.from, range.to],
|
|
152
|
+
}),
|
|
153
|
+
]));
|
|
154
|
+
const transformSpecs = useMemo(() => {
|
|
155
|
+
if (!hozoTransition?.transform || typeof style !== 'function')
|
|
156
|
+
return [];
|
|
157
|
+
const states = [false, true].flatMap((pressed) => [false, true].flatMap((hovered) => [false, true].flatMap((focused) => [false, true].map((focusVisible) => ({ pressed, hovered, focused, focusVisible })))));
|
|
158
|
+
const merged = new Map();
|
|
159
|
+
for (const state of states) {
|
|
160
|
+
for (const target of transformTargets(style(state)))
|
|
161
|
+
merged.set(target.key, target);
|
|
162
|
+
}
|
|
163
|
+
return [...merged.values()].sort((a, b) => transformRank(a.key) - transformRank(b.key));
|
|
164
|
+
}, [hozoTransition?.transform, style]);
|
|
165
|
+
const transformValues = useRef(new Map()).current;
|
|
166
|
+
const initialTargets = new Map(transformTargets(initialStyle).map((target) => [target.key, target]));
|
|
167
|
+
for (const spec of transformSpecs) {
|
|
168
|
+
if (!transformValues.has(spec.key)) {
|
|
169
|
+
transformValues.set(spec.key, new Animated.Value(initialTargets.get(spec.key)?.value ?? identityFor(spec)));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const animatedTransform = transformSpecs.map((spec) => ({
|
|
173
|
+
[spec.key]: spec.degrees
|
|
174
|
+
? transformValues.get(spec.key).interpolate({
|
|
175
|
+
inputRange: [-360, 360],
|
|
176
|
+
outputRange: ['-360deg', '360deg'],
|
|
177
|
+
})
|
|
178
|
+
: transformValues.get(spec.key),
|
|
179
|
+
}));
|
|
180
|
+
const animateInteraction = useCallback((next) => {
|
|
181
|
+
if (!hozoTransition || typeof style !== 'function')
|
|
182
|
+
return;
|
|
183
|
+
const flattened = StyleSheet.flatten(style({
|
|
184
|
+
pressed: (next & PRESSED) !== 0,
|
|
185
|
+
hovered: (next & HOVERED) !== 0,
|
|
186
|
+
focused: (next & FOCUSED) !== 0,
|
|
187
|
+
focusVisible: (next & FOCUS_VISIBLE) !== 0,
|
|
188
|
+
}));
|
|
189
|
+
const animations = [];
|
|
190
|
+
if (hozoTransition.opacity) {
|
|
191
|
+
const targetOpacity = typeof flattened?.opacity === 'number' ? flattened.opacity : 1;
|
|
192
|
+
animations.push(Animated.timing(opacity, {
|
|
193
|
+
toValue: targetOpacity,
|
|
194
|
+
duration: hozoTransition.duration,
|
|
195
|
+
delay: hozoTransition.delay ?? 0,
|
|
196
|
+
easing: easingFor(hozoTransition.easing),
|
|
197
|
+
useNativeDriver: true,
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
if (hozoTransition.transform) {
|
|
201
|
+
const targets = new Map(transformTargets(style({
|
|
202
|
+
pressed: (next & PRESSED) !== 0,
|
|
203
|
+
hovered: (next & HOVERED) !== 0,
|
|
204
|
+
focused: (next & FOCUSED) !== 0,
|
|
205
|
+
focusVisible: (next & FOCUS_VISIBLE) !== 0,
|
|
206
|
+
})).map((target) => [target.key, target.value]));
|
|
207
|
+
for (const spec of transformSpecs) {
|
|
208
|
+
animations.push(Animated.timing(transformValues.get(spec.key), {
|
|
209
|
+
toValue: targets.get(spec.key) ?? identityFor(spec),
|
|
210
|
+
duration: hozoTransition.duration,
|
|
211
|
+
delay: hozoTransition.delay ?? 0,
|
|
212
|
+
easing: easingFor(hozoTransition.easing),
|
|
213
|
+
useNativeDriver: true,
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (hozoTransition.colors) {
|
|
218
|
+
const targets = colorTargets(style({
|
|
219
|
+
pressed: (next & PRESSED) !== 0,
|
|
220
|
+
hovered: (next & HOVERED) !== 0,
|
|
221
|
+
focused: (next & FOCUSED) !== 0,
|
|
222
|
+
focusVisible: (next & FOCUS_VISIBLE) !== 0,
|
|
223
|
+
}));
|
|
224
|
+
for (const [key, range] of colorRanges) {
|
|
225
|
+
const current = blendColor(range.from, range.to, colorFraction.current);
|
|
226
|
+
const target = targets.get(key) ?? (key === 'backgroundColor' ? 'transparent' : current);
|
|
227
|
+
colorRanges.set(key, { from: current, to: target });
|
|
228
|
+
}
|
|
229
|
+
colorProgress.setValue(0);
|
|
230
|
+
colorFraction.current = 0;
|
|
231
|
+
animations.push(Animated.timing(colorProgress, {
|
|
232
|
+
toValue: 1,
|
|
233
|
+
duration: hozoTransition.duration,
|
|
234
|
+
delay: hozoTransition.delay ?? 0,
|
|
235
|
+
easing: easingFor(hozoTransition.easing),
|
|
236
|
+
useNativeDriver: false,
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
Animated.parallel(animations).start();
|
|
240
|
+
}, [colorProgress, colorRanges, hozoTransition, opacity, style, transformSpecs, transformValues]);
|
|
241
|
+
const setFlag = useCallback((flag, active) => {
|
|
242
|
+
const current = interactionRef.current;
|
|
243
|
+
const next = active ? current | flag : current & ~flag;
|
|
244
|
+
interactionRef.current = next;
|
|
245
|
+
animateInteraction(next);
|
|
246
|
+
setInteraction(next);
|
|
247
|
+
}, [animateInteraction]);
|
|
248
|
+
const PressableComponent = pressableFor(hozoTransition);
|
|
249
|
+
const modality = useRef('keyboard');
|
|
250
|
+
// The style for the state this component is in, resolved here because
|
|
251
|
+
// the animated path cannot hand React Native a callback -- see the
|
|
252
|
+
// `style` prop below.
|
|
253
|
+
const resolvedStyle = useMemo(() => typeof style === 'function'
|
|
254
|
+
? style({
|
|
255
|
+
pressed: (interaction & PRESSED) !== 0,
|
|
256
|
+
hovered: (interaction & HOVERED) !== 0,
|
|
257
|
+
focused: (interaction & FOCUSED) !== 0,
|
|
258
|
+
focusVisible: (interaction & FOCUS_VISIBLE) !== 0,
|
|
259
|
+
})
|
|
260
|
+
: style, [interaction, style]);
|
|
261
|
+
const context = useMemo(() => ({
|
|
262
|
+
pressed: (interaction & PRESSED) !== 0,
|
|
263
|
+
hovered: (interaction & HOVERED) !== 0,
|
|
264
|
+
focused: (interaction & FOCUSED) !== 0,
|
|
265
|
+
focusVisible: (interaction & FOCUS_VISIBLE) !== 0,
|
|
266
|
+
transition: hozoTransition,
|
|
267
|
+
}), [hozoTransition, interaction]);
|
|
268
|
+
return (_jsx(InteractionContext.Provider, { value: context, children: _jsx(PressableComponent, { ...props, onHoverIn: (event) => {
|
|
269
|
+
setFlag(HOVERED, true);
|
|
270
|
+
onHoverIn?.(event);
|
|
271
|
+
}, onHoverOut: (event) => {
|
|
272
|
+
setFlag(HOVERED, false);
|
|
273
|
+
onHoverOut?.(event);
|
|
274
|
+
}, onFocus: (event) => {
|
|
275
|
+
setFlag(FOCUSED, true);
|
|
276
|
+
if (hozoFocusVisible)
|
|
277
|
+
setFlag(FOCUS_VISIBLE, modality.current === 'keyboard');
|
|
278
|
+
onFocus?.(event);
|
|
279
|
+
}, onBlur: (event) => {
|
|
280
|
+
setFlag(FOCUSED, false);
|
|
281
|
+
if (hozoFocusVisible)
|
|
282
|
+
setFlag(FOCUS_VISIBLE, false);
|
|
283
|
+
onBlur?.(event);
|
|
284
|
+
}, onPointerDown: hozoFocusVisible
|
|
285
|
+
? (event) => {
|
|
286
|
+
modality.current = 'pointer';
|
|
287
|
+
setFlag(FOCUS_VISIBLE, false);
|
|
288
|
+
onPointerDown?.(event);
|
|
289
|
+
}
|
|
290
|
+
: onPointerDown, onKeyDown: hozoFocusVisible
|
|
291
|
+
? (event) => {
|
|
292
|
+
modality.current = 'keyboard';
|
|
293
|
+
if ((interactionRef.current & FOCUSED) !== 0)
|
|
294
|
+
setFlag(FOCUS_VISIBLE, true);
|
|
295
|
+
onKeyDown?.(event);
|
|
296
|
+
}
|
|
297
|
+
: onKeyDown, onPressIn: (event) => {
|
|
298
|
+
modality.current = 'pointer';
|
|
299
|
+
if (hozoFocusVisible)
|
|
300
|
+
setFlag(FOCUS_VISIBLE, false);
|
|
301
|
+
setFlag(PRESSED, true);
|
|
302
|
+
onPressIn?.(event);
|
|
303
|
+
}, onPressOut: (event) => {
|
|
304
|
+
setFlag(PRESSED, false);
|
|
305
|
+
onPressOut?.(event);
|
|
306
|
+
},
|
|
307
|
+
// An array when there is a transition, a callback when there is
|
|
308
|
+
// not, and the difference is not a preference.
|
|
309
|
+
//
|
|
310
|
+
// `AnimatedProps` builds the animated node from `props.style`, and
|
|
311
|
+
// its first act is to skip anything that is not an object:
|
|
312
|
+
//
|
|
313
|
+
// if (key === 'style') {
|
|
314
|
+
// // Ignore `style` if it is not an object (or array).
|
|
315
|
+
// if (typeof value === 'object' && value != null) {
|
|
316
|
+
//
|
|
317
|
+
// A callback is a function, so no node was ever attached. Pressable
|
|
318
|
+
// still called it, so the `Animated.Value`s it returned reached the
|
|
319
|
+
// view as plain objects where colours and numbers belong -- and a
|
|
320
|
+
// `backgroundColor` that is an object is not a colour, so the view
|
|
321
|
+
// dropped it. The compiled `bg-brand` button rendered with no
|
|
322
|
+
// background at all, and its white label with it, for as long as
|
|
323
|
+
// this code has existed. Found by the first screenshot anything
|
|
324
|
+
// ever took of the acceptance screen (#297).
|
|
325
|
+
//
|
|
326
|
+
// The state the callback would have supplied is state this
|
|
327
|
+
// component already keeps: `pressed` is set from `onPressIn` and
|
|
328
|
+
// `onPressOut`, which is what drives Pressable's own flag too.
|
|
329
|
+
style: hozoTransition
|
|
330
|
+
? // Cast because `Animated.createAnimatedComponent` types
|
|
331
|
+
// `style` as a resolved ViewStyle, while the whole point of
|
|
332
|
+
// an animated component is that it may hold `Animated.Value`s.
|
|
333
|
+
[
|
|
334
|
+
resolvedStyle,
|
|
335
|
+
{
|
|
336
|
+
...(hozoTransition.opacity ? { opacity } : null),
|
|
337
|
+
...(hozoTransition.transform ? { transform: animatedTransform } : null),
|
|
338
|
+
...(hozoTransition.colors ? animatedColors : null),
|
|
339
|
+
},
|
|
340
|
+
]
|
|
341
|
+
: ({ pressed }) => typeof style === 'function'
|
|
342
|
+
? style({
|
|
343
|
+
pressed: pressed || (interaction & PRESSED) !== 0,
|
|
344
|
+
hovered: (interaction & HOVERED) !== 0,
|
|
345
|
+
focused: (interaction & FOCUSED) !== 0,
|
|
346
|
+
focusVisible: (interaction & FOCUS_VISIBLE) !== 0,
|
|
347
|
+
})
|
|
348
|
+
: style }) }));
|
|
349
|
+
}
|
|
350
|
+
/** Text whose interaction state and transition are owned by an enclosing HozoPressable. */
|
|
351
|
+
export function HozoText({ style, ...props }) {
|
|
352
|
+
const context = useContext(InteractionContext);
|
|
353
|
+
const state = context ?? { pressed: false, hovered: false, focused: false, focusVisible: false };
|
|
354
|
+
const resolved = typeof style === 'function' ? style(state) : style;
|
|
355
|
+
const target = StyleSheet.flatten(resolved)?.color;
|
|
356
|
+
const progress = useRef(new Animated.Value(1)).current;
|
|
357
|
+
const fraction = useRef(1);
|
|
358
|
+
const previousTarget = useRef(typeof target === 'string' ? target : '');
|
|
359
|
+
const range = useRef({ from: previousTarget.current, to: previousTarget.current });
|
|
360
|
+
const interaction = `${state.pressed}:${state.hovered}:${state.focused}`;
|
|
361
|
+
const previousInteraction = useRef(interaction);
|
|
362
|
+
const pending = previousInteraction.current !== interaction && typeof target === 'string';
|
|
363
|
+
if (pending) {
|
|
364
|
+
range.current = {
|
|
365
|
+
from: blendColor(range.current.from, range.current.to, fraction.current),
|
|
366
|
+
to: target,
|
|
367
|
+
};
|
|
368
|
+
previousInteraction.current = interaction;
|
|
369
|
+
previousTarget.current = target;
|
|
370
|
+
}
|
|
371
|
+
useEffect(() => {
|
|
372
|
+
const listener = progress.addListener(({ value }) => {
|
|
373
|
+
fraction.current = value;
|
|
374
|
+
});
|
|
375
|
+
return () => progress.removeListener(listener);
|
|
376
|
+
}, [progress]);
|
|
377
|
+
useLayoutEffect(() => {
|
|
378
|
+
if (!pending || !context?.transition?.colors)
|
|
379
|
+
return;
|
|
380
|
+
progress.setValue(0);
|
|
381
|
+
fraction.current = 0;
|
|
382
|
+
Animated.timing(progress, {
|
|
383
|
+
toValue: 1,
|
|
384
|
+
duration: context.transition.duration,
|
|
385
|
+
delay: context.transition.delay ?? 0,
|
|
386
|
+
easing: easingFor(context.transition.easing),
|
|
387
|
+
useNativeDriver: false,
|
|
388
|
+
}).start();
|
|
389
|
+
// `context?`, not `context`: the context defaults to null, and this
|
|
390
|
+
// component is explicitly written to work without one -- see the
|
|
391
|
+
// `if (!context ...)` below. A dependency array is evaluated on every
|
|
392
|
+
// render, before any of them, so `context.transition` threw for a
|
|
393
|
+
// HozoText used outside a HozoPressable.
|
|
394
|
+
}, [context?.transition, pending, progress]);
|
|
395
|
+
const animatedColor = context?.transition?.colors && range.current.from
|
|
396
|
+
? progress.interpolate({
|
|
397
|
+
inputRange: [0, 1],
|
|
398
|
+
outputRange: [range.current.from, range.current.to],
|
|
399
|
+
})
|
|
400
|
+
: undefined;
|
|
401
|
+
if (!context || typeof style !== 'function')
|
|
402
|
+
return _jsx(Text, { ...props, style: resolved });
|
|
403
|
+
return (_jsx(AnimatedText, { ...props, style: [resolved, animatedColor ? { color: animatedColor } : null] }));
|
|
404
|
+
}
|
|
405
|
+
//# sourceMappingURL=pressable.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressable.native.js","sourceRoot":"","sources":["../src/pressable.native.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;A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E,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAI,CAChG,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
export interface HozoBackdropFilterProps extends ViewProps {
|
|
4
|
+
hozoBlurRadius: number;
|
|
5
|
+
}
|
|
6
|
+
/** Native component boundary for the opt-in backdrop-filter adapter. */
|
|
7
|
+
export declare function HozoBackdropFilter({ hozoBlurRadius, ...props }: HozoBackdropFilterProps): ReactElement;
|
|
8
|
+
//# sourceMappingURL=runtime-backdrop.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-backdrop.native.d.ts","sourceRoot":"","sources":["../src/runtime-backdrop.native.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,EACjC,cAAc,EACd,GAAG,KAAK,EACT,EAAE,uBAAuB,GAAG,YAAY,CASxC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { hozoBackdropFilterAdapter } from '@hozo/engine';
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
/** Native component boundary for the opt-in backdrop-filter adapter. */
|
|
4
|
+
export function HozoBackdropFilter({ hozoBlurRadius, ...props }) {
|
|
5
|
+
const Adapter = hozoBackdropFilterAdapter();
|
|
6
|
+
if (!Adapter) {
|
|
7
|
+
throw new Error('[hozo] backdropFilter needs a Native adapter. Configure one with ' +
|
|
8
|
+
'configureHozoBackdropFilter(createExpoBlurAdapter(BlurView, options)).');
|
|
9
|
+
}
|
|
10
|
+
return createElement(Adapter, { ...props, blurRadius: hozoBlurRadius });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=runtime-backdrop.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-backdrop.native.js","sourceRoot":"","sources":["../src/runtime-backdrop.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAA;AAOxD,wEAAwE;AACxE,MAAM,UAAU,kBAAkB,CAAC,EACjC,cAAc,EACd,GAAG,KAAK,EACgB;IACxB,MAAM,OAAO,GAAG,yBAAyB,EAAE,CAAA;IAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,mEAAmE;YACjE,wEAAwE,CAC3E,CAAA;IACH,CAAC;IACD,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CAAA;AACzE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ViewProps } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* Container widths in scope, by name.
|
|
5
|
+
*
|
|
6
|
+
* The empty key is the nearest container whatever it is called, which is
|
|
7
|
+
* what an unnamed `@sm:` asks about. A named container registers under
|
|
8
|
+
* both, so `@sm:` inside `@container/main` reads the same width as
|
|
9
|
+
* `@sm/main:`.
|
|
10
|
+
*
|
|
11
|
+
* `undefined` for a name means no container in scope answers to it --
|
|
12
|
+
* distinct from a container that measured zero, and the distinction is
|
|
13
|
+
* load-bearing. CSS says a query with no container matches nothing, in
|
|
14
|
+
* *either* direction, so `@max-md:` must not fire just because there is
|
|
15
|
+
* no width to compare.
|
|
16
|
+
*/
|
|
17
|
+
export type HozoContainerWidths = Readonly<Record<string, number | undefined>>;
|
|
18
|
+
export interface HozoContainerProps extends ViewProps {
|
|
19
|
+
/** `@container/main` -- the name `@sm/main:` addresses. */
|
|
20
|
+
hozoContainerName?: string;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A View that measures itself and hands its width to its subtree.
|
|
25
|
+
*
|
|
26
|
+
* The compiler renders an element here instead of a View when its classes
|
|
27
|
+
* declared it a container.
|
|
28
|
+
*/
|
|
29
|
+
export declare function HozoContainer({ hozoContainerName, onLayout, children, ...rest }: HozoContainerProps): ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Hands the widths in scope to the element that queries them.
|
|
32
|
+
*
|
|
33
|
+
* A render prop rather than a hook, because the querying element is
|
|
34
|
+
* usually in the same component as the container and a hook there would
|
|
35
|
+
* read the context from *outside* the provider. This puts a component
|
|
36
|
+
* boundary in the way, and renders nothing else.
|
|
37
|
+
*/
|
|
38
|
+
export declare function HozoContainerQuery({ children, }: {
|
|
39
|
+
children: (widths: HozoContainerWidths) => ReactNode;
|
|
40
|
+
}): ReactNode;
|
|
41
|
+
//# sourceMappingURL=runtime-container.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-container.native.d.ts","sourceRoot":"","sources":["../src/runtime-container.native.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAiB,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAA;AACpF,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAI3E;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;AAI9E,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,kBAAkB,GAAG,SAAS,CA8BhC;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,SAAS,CAAA;CACrD,GAAG,SAAS,CAEZ"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Container queries on React Native, which has none.
|
|
3
|
+
//
|
|
4
|
+
// The width a container query asks about is the one thing the runtime
|
|
5
|
+
// cannot already know. A window has one width and `useHozoViewport`
|
|
6
|
+
// reports it; a container's width is whatever layout gave that particular
|
|
7
|
+
// element, so the element has to measure itself and say.
|
|
8
|
+
//
|
|
9
|
+
// Two pieces, and the split is forced by React rather than chosen. A
|
|
10
|
+
// component cannot read a context it renders the provider for, so the
|
|
11
|
+
// element that *is* the container and the element that *queries* it
|
|
12
|
+
// cannot be hooks in the same function body. `HozoContainer` provides;
|
|
13
|
+
// `HozoContainerQuery` consumes through a render prop, which is the same
|
|
14
|
+
// shape `group-…:` already borrows from Pressable's `style` callback.
|
|
15
|
+
//
|
|
16
|
+
// `HozoContainerQuery` renders no element of its own. It exists to put a
|
|
17
|
+
// component boundary between the provider and the read, and adding a View
|
|
18
|
+
// to do that would change the layout the query is measuring.
|
|
19
|
+
import { createContext, useContext, useMemo, useState } from 'react';
|
|
20
|
+
import { View } from 'react-native';
|
|
21
|
+
import { keepIfSettled } from './runtime-measured.js';
|
|
22
|
+
const HozoContainerContext = createContext({});
|
|
23
|
+
/**
|
|
24
|
+
* A View that measures itself and hands its width to its subtree.
|
|
25
|
+
*
|
|
26
|
+
* The compiler renders an element here instead of a View when its classes
|
|
27
|
+
* declared it a container.
|
|
28
|
+
*/
|
|
29
|
+
export function HozoContainer({ hozoContainerName, onLayout, children, ...rest }) {
|
|
30
|
+
const [width, setWidth] = useState(undefined);
|
|
31
|
+
const outer = useContext(HozoContainerContext);
|
|
32
|
+
const widths = useMemo(() => ({
|
|
33
|
+
...outer,
|
|
34
|
+
'': width,
|
|
35
|
+
...(hozoContainerName ? { [hozoContainerName]: width } : {}),
|
|
36
|
+
}), [outer, width, hozoContainerName]);
|
|
37
|
+
// The author's own `onLayout` still runs. Taking the prop and dropping
|
|
38
|
+
// it would be the quiet kind of breakage this compiler exists to avoid.
|
|
39
|
+
const measure = (event) => {
|
|
40
|
+
const measured = event.nativeEvent.layout.width;
|
|
41
|
+
// A tolerance rather than `===`, for the reason `measured.ts` gives.
|
|
42
|
+
// This one has not been seen looping, and it is the same shape as the
|
|
43
|
+
// one that was: a stored width, a render that depends on it, and a
|
|
44
|
+
// float coming back from Yoga.
|
|
45
|
+
setWidth((current) => keepIfSettled(current, measured));
|
|
46
|
+
onLayout?.(event);
|
|
47
|
+
};
|
|
48
|
+
return (_jsx(View, { ...rest, onLayout: measure, children: _jsx(HozoContainerContext.Provider, { value: widths, children: children }) }));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Hands the widths in scope to the element that queries them.
|
|
52
|
+
*
|
|
53
|
+
* A render prop rather than a hook, because the querying element is
|
|
54
|
+
* usually in the same component as the container and a hook there would
|
|
55
|
+
* read the context from *outside* the provider. This puts a component
|
|
56
|
+
* boundary in the way, and renders nothing else.
|
|
57
|
+
*/
|
|
58
|
+
export function HozoContainerQuery({ children, }) {
|
|
59
|
+
return children(useContext(HozoContainerContext));
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=runtime-container.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-container.native.js","sourceRoot":"","sources":["../src/runtime-container.native.tsx"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,0EAA0E;AAC1E,yDAAyD;AACzD,EAA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,CAAC,CAAA;QACvD,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAA;IACnB,CAAC,CAAA;IAED,OAAO,CACL,KAAC,IAAI,OAAK,IAAI,EAAE,QAAQ,EAAE,OAAO,YAC/B,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YAAG,QAAQ,GAAiC,GACnF,CACR,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,QAAQ,GAGT;IACC,OAAO,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type GridTrack = {
|
|
2
|
+
kind: 'fr';
|
|
3
|
+
value: number;
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'points';
|
|
6
|
+
value: number;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'minmax';
|
|
9
|
+
min: number;
|
|
10
|
+
value: number;
|
|
11
|
+
};
|
|
12
|
+
export interface GridCell {
|
|
13
|
+
child: number | null;
|
|
14
|
+
tracks: readonly GridTrack[];
|
|
15
|
+
}
|
|
16
|
+
export interface GridItemPlacement {
|
|
17
|
+
span: number;
|
|
18
|
+
/** Zero-based explicit column; absent means normal row auto-placement. */
|
|
19
|
+
columnStart?: number;
|
|
20
|
+
rowSpan?: number;
|
|
21
|
+
/** Zero-based explicit row; absent means normal row auto-placement. */
|
|
22
|
+
rowStart?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface PlacedGridItem {
|
|
25
|
+
child: number;
|
|
26
|
+
column: number;
|
|
27
|
+
columnSpan: number;
|
|
28
|
+
row: number;
|
|
29
|
+
rowSpan: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function gridLayout(items: readonly GridItemPlacement[], columnCount: number): PlacedGridItem[];
|
|
32
|
+
/** Pure row auto-placement. Explicit coordinates/dense can replace this step later. */
|
|
33
|
+
export declare function gridRows(items: readonly GridItemPlacement[], tracks: readonly GridTrack[]): GridCell[][];
|
|
34
|
+
export declare function gridCellStyle(tracks: readonly GridTrack[], internalGap?: number): Record<string, number>;
|
|
35
|
+
export declare function gridTrackSizes(tracks: readonly GridTrack[], width: number, gap: number): number[];
|
|
36
|
+
export declare function gridRowSizes(layout: readonly PlacedGridItem[], measuredHeights: readonly number[], rowGap: number, explicitTracks?: readonly GridTrack[]): number[];
|
|
37
|
+
//# sourceMappingURL=runtime-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-grid.d.ts","sourceRoot":"","sources":["../src/runtime-grid.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAElD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,SAAS,SAAS,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,iBAAiB,EAAE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