@hozo/primitives 0.3.0 → 0.4.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/CHANGELOG.md +44 -0
- package/README.md +1 -1
- package/dist/button-host-attributes.d.ts +20 -0
- package/dist/button-host-attributes.d.ts.map +1 -0
- package/dist/button-host-attributes.js +47 -0
- package/dist/button-host-attributes.js.map +1 -0
- package/dist/button-host-props.native.d.ts +8 -0
- package/dist/button-host-props.native.d.ts.map +1 -0
- package/dist/button-host-props.native.js +20 -0
- package/dist/button-host-props.native.js.map +1 -0
- package/dist/foundation.d.ts +21 -3
- package/dist/foundation.d.ts.map +1 -1
- package/dist/foundation.js +41 -5
- package/dist/foundation.js.map +1 -1
- package/dist/foundation.native.d.ts +27 -7
- package/dist/foundation.native.d.ts.map +1 -1
- package/dist/foundation.native.js +18 -3
- package/dist/foundation.native.js.map +1 -1
- package/dist/generated/button-dom-props.d.ts +11 -0
- package/dist/generated/button-dom-props.d.ts.map +1 -0
- package/dist/generated/button-dom-props.js +132 -0
- package/dist/generated/button-dom-props.js.map +1 -0
- package/dist/generated/button-props.d.ts +3 -0
- package/dist/generated/button-props.d.ts.map +1 -0
- package/dist/generated/button-props.js +5 -0
- package/dist/generated/button-props.js.map +1 -0
- package/dist/generated/button-props.native.d.ts +2 -0
- package/dist/generated/button-props.native.d.ts.map +1 -0
- package/dist/generated/button-props.native.js +2 -0
- package/dist/generated/button-props.native.js.map +1 -0
- package/dist/generated/inherited-label.d.ts +2 -0
- package/dist/generated/inherited-label.d.ts.map +1 -0
- package/dist/generated/inherited-label.js +3 -0
- package/dist/generated/inherited-label.js.map +1 -0
- package/dist/generated/inherited-pressable.d.ts +2 -0
- package/dist/generated/inherited-pressable.d.ts.map +1 -0
- package/dist/generated/inherited-pressable.js +3 -0
- package/dist/generated/inherited-pressable.js.map +1 -0
- package/dist/generated/inherited-relative-text.d.ts +2 -0
- package/dist/generated/inherited-relative-text.d.ts.map +1 -0
- package/dist/generated/inherited-relative-text.js +3 -0
- package/dist/generated/inherited-relative-text.js.map +1 -0
- package/dist/generated/inherited-text.d.ts +2 -0
- package/dist/generated/inherited-text.d.ts.map +1 -0
- package/dist/generated/inherited-text.js +3 -0
- package/dist/generated/inherited-text.js.map +1 -0
- package/dist/generated/inherited-view.d.ts +2 -0
- package/dist/generated/inherited-view.d.ts.map +1 -0
- package/dist/generated/inherited-view.js +3 -0
- package/dist/generated/inherited-view.js.map +1 -0
- package/dist/generated/native-disabled.d.ts +2 -0
- package/dist/generated/native-disabled.d.ts.map +1 -0
- package/dist/generated/native-disabled.js +2 -0
- package/dist/generated/native-disabled.js.map +1 -0
- package/dist/generated/text-input-dom-props.d.ts +7 -0
- package/dist/generated/text-input-dom-props.d.ts.map +1 -0
- package/dist/generated/text-input-dom-props.js +130 -0
- package/dist/generated/text-input-dom-props.js.map +1 -0
- package/dist/generated/text-input.native.d.ts +1 -1
- package/dist/generated/text-input.native.d.ts.map +1 -1
- package/dist/generated/text-input.native.js +1 -1
- package/dist/generated/text-input.native.js.map +1 -1
- package/dist/generated/view-dom-props.d.ts +8 -0
- package/dist/generated/view-dom-props.d.ts.map +1 -0
- package/dist/generated/view-dom-props.js +241 -0
- package/dist/generated/view-dom-props.js.map +1 -0
- package/dist/inherited-label.native.d.ts +8 -0
- package/dist/inherited-label.native.d.ts.map +1 -0
- package/dist/inherited-label.native.js +12 -0
- package/dist/inherited-label.native.js.map +1 -0
- package/dist/inherited-pressable.native.d.ts +11 -0
- package/dist/inherited-pressable.native.d.ts.map +1 -0
- package/dist/inherited-pressable.native.js +75 -0
- package/dist/inherited-pressable.native.js.map +1 -0
- package/dist/inherited-relative-text.native.d.ts +13 -0
- package/dist/inherited-relative-text.native.d.ts.map +1 -0
- package/dist/inherited-relative-text.native.js +16 -0
- package/dist/inherited-relative-text.native.js.map +1 -0
- package/dist/inherited-text-scope.d.ts +8 -0
- package/dist/inherited-text-scope.d.ts.map +1 -0
- package/dist/inherited-text-scope.js +10 -0
- package/dist/inherited-text-scope.js.map +1 -0
- package/dist/inherited-text-style.native.d.ts +5 -0
- package/dist/inherited-text-style.native.d.ts.map +1 -0
- package/dist/inherited-text-style.native.js +30 -0
- package/dist/inherited-text-style.native.js.map +1 -0
- package/dist/inherited-text.native.d.ts +5 -0
- package/dist/inherited-text.native.d.ts.map +1 -0
- package/dist/inherited-text.native.js +18 -0
- package/dist/inherited-text.native.js.map +1 -0
- package/dist/inherited-view.native.d.ts +9 -0
- package/dist/inherited-view.native.d.ts.map +1 -0
- package/dist/inherited-view.native.js +17 -0
- package/dist/inherited-view.native.js.map +1 -0
- package/dist/link.d.ts +4 -3
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +9 -1
- package/dist/link.js.map +1 -1
- package/dist/link.native.d.ts +1 -1
- package/dist/link.native.d.ts.map +1 -1
- package/dist/link.native.js +7 -1
- package/dist/link.native.js.map +1 -1
- package/dist/native-disabled.d.ts +13 -0
- package/dist/native-disabled.d.ts.map +1 -0
- package/dist/native-disabled.js +13 -0
- package/dist/native-disabled.js.map +1 -0
- package/dist/presence.native.d.ts.map +1 -1
- package/dist/presence.native.js +1 -1
- package/dist/presence.native.js.map +1 -1
- package/dist/pressable.d.ts.map +1 -1
- package/dist/pressable.js +8 -1
- package/dist/pressable.js.map +1 -1
- package/dist/pressable.native.d.ts +10 -1
- package/dist/pressable.native.d.ts.map +1 -1
- package/dist/pressable.native.js +44 -45
- package/dist/pressable.native.js.map +1 -1
- package/dist/text-color-transition.native.d.ts +12 -0
- package/dist/text-color-transition.native.d.ts.map +1 -0
- package/dist/text-color-transition.native.js +87 -0
- package/dist/text-color-transition.native.js.map +1 -0
- package/dist/text-input-props.native.d.ts +10 -0
- package/dist/text-input-props.native.d.ts.map +1 -0
- package/dist/text-input-props.native.js +15 -0
- package/dist/text-input-props.native.js.map +1 -0
- package/dist/text-input.native.d.ts +19 -0
- package/dist/text-input.native.d.ts.map +1 -0
- package/dist/text-input.native.js +32 -0
- package/dist/text-input.native.js.map +1 -0
- package/package.json +51 -7
- package/src/button-host-attributes.ts +56 -0
- package/src/button-host-props.native.ts +22 -0
- package/src/foundation.native.tsx +45 -6
- package/src/foundation.tsx +74 -4
- package/src/generated/button-dom-props.ts +127 -0
- package/src/generated/button-props.native.ts +1 -0
- package/src/generated/button-props.ts +4 -0
- package/src/generated/inherited-label.ts +2 -0
- package/src/generated/inherited-pressable.ts +2 -0
- package/src/generated/inherited-relative-text.ts +2 -0
- package/src/generated/inherited-text.ts +2 -0
- package/src/generated/inherited-view.ts +2 -0
- package/src/generated/native-disabled.ts +1 -0
- package/src/generated/text-input-dom-props.ts +128 -0
- package/src/generated/text-input.native.ts +1 -4
- package/src/generated/view-dom-props.ts +267 -0
- package/src/inherited-label.native.tsx +28 -0
- package/src/inherited-pressable.native.tsx +152 -0
- package/src/inherited-relative-text.native.tsx +22 -0
- package/src/inherited-text-scope.tsx +27 -0
- package/src/inherited-text-style.native.ts +35 -0
- package/src/inherited-text.native.tsx +32 -0
- package/src/inherited-view.native.tsx +37 -0
- package/src/link.native.tsx +17 -13
- package/src/link.ts +12 -0
- package/src/native-disabled.ts +23 -0
- package/src/presence.native.tsx +1 -1
- package/src/pressable.native.tsx +70 -42
- package/src/pressable.ts +8 -1
- package/src/text-color-transition.native.ts +96 -0
- package/src/text-input-props.native.ts +26 -0
- package/src/text-input.native.tsx +57 -0
- package/dist/generated/animated.d.ts +0 -2
- package/dist/generated/animated.d.ts.map +0 -1
- package/dist/generated/animated.js +0 -3
- package/dist/generated/animated.js.map +0 -1
- package/dist/presence-context.d.ts +0 -15
- package/dist/presence-context.d.ts.map +0 -1
- package/dist/presence-context.js +0 -11
- package/dist/presence-context.js.map +0 -1
- package/dist/runtime-transition.native.d.ts +0 -30
- package/dist/runtime-transition.native.d.ts.map +0 -1
- package/dist/runtime-transition.native.js +0 -183
- package/dist/runtime-transition.native.js.map +0 -1
- package/src/generated/animated.ts +0 -6
- package/src/presence-context.ts +0 -27
- package/src/runtime-transition.native.tsx +0 -244
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// What a View's spread means on the Web, once the compiler has lowered it to
|
|
2
|
+
// a plain element -- and a Text's, an Image's, and every document primitive's,
|
|
3
|
+
// since they share the same universal props (#1122).
|
|
4
|
+
//
|
|
5
|
+
// `function Box(props) { return <View {...props} /> }` lowers at build time,
|
|
6
|
+
// but `props` still holds the primitive's vocabulary -- `accessibilityLabel`,
|
|
7
|
+
// `testID`, `accessibilityState` -- and spread raw onto the DOM those are
|
|
8
|
+
// unknown attributes: the element loses its accessible name, and a test that
|
|
9
|
+
// finds it by test id finds nothing. #1096 and #1118 were the same bug for
|
|
10
|
+
// Button and TextInput.
|
|
11
|
+
//
|
|
12
|
+
// So the spread goes through the translation the uncompiled `View` applies
|
|
13
|
+
// to its named props. Everything else passes through, as it did before:
|
|
14
|
+
// `aria-*`, `onKeyDown` and the rest are already DOM props. Keys the spread
|
|
15
|
+
// does not hold are not set, because explicit attributes the compiler wrote
|
|
16
|
+
// before the spread must survive it.
|
|
17
|
+
//
|
|
18
|
+
// `onLayout` and the responder props need the element and an effect, which a
|
|
19
|
+
// function called during render does not have (#1126). So when the spread
|
|
20
|
+
// carries one, the translation adds a callback ref: it is handed the element,
|
|
21
|
+
// and the cleanup React 19 runs when the element goes is the effect's.
|
|
22
|
+
import { createSpreadResponder, hozoDomStyle, RESPONDER_PROPS, } from '@hozo/engine';
|
|
23
|
+
const UNIVERSAL = new Set([
|
|
24
|
+
'accessibilityHint',
|
|
25
|
+
'accessibilityLabel',
|
|
26
|
+
'accessibilityLiveRegion',
|
|
27
|
+
'accessibilityState',
|
|
28
|
+
'accessibilityValue',
|
|
29
|
+
'nativeID',
|
|
30
|
+
'pointerEvents',
|
|
31
|
+
'style',
|
|
32
|
+
'testID',
|
|
33
|
+
]);
|
|
34
|
+
// Per element, not per render: the ref is a new function each render, so
|
|
35
|
+
// React detaches the old one and attaches the new to the same element. The
|
|
36
|
+
// observer survives that, and so does the last layout reported -- as with
|
|
37
|
+
// the uncompiled View, `onLayout` fires when the layout changes, not on
|
|
38
|
+
// every render.
|
|
39
|
+
const attached = new WeakMap();
|
|
40
|
+
function observe(element, state) {
|
|
41
|
+
const emit = () => {
|
|
42
|
+
const rect = element.getBoundingClientRect();
|
|
43
|
+
const layout = {
|
|
44
|
+
x: element.offsetLeft,
|
|
45
|
+
y: element.offsetTop,
|
|
46
|
+
width: rect.width,
|
|
47
|
+
height: rect.height,
|
|
48
|
+
};
|
|
49
|
+
const key = `${layout.x}:${layout.y}:${layout.width}:${layout.height}`;
|
|
50
|
+
if (key === state.previous)
|
|
51
|
+
return;
|
|
52
|
+
state.previous = key;
|
|
53
|
+
state.onLayout?.({ nativeEvent: { layout } });
|
|
54
|
+
};
|
|
55
|
+
emit();
|
|
56
|
+
if (typeof ResizeObserver === 'undefined')
|
|
57
|
+
return;
|
|
58
|
+
state.observer = new ResizeObserver(emit);
|
|
59
|
+
state.observer.observe(element);
|
|
60
|
+
}
|
|
61
|
+
/** The callback ref that gives a translated spread its element, or none when it needs none. */
|
|
62
|
+
function elementRef(source, fallback) {
|
|
63
|
+
const onLayout = source.onLayout;
|
|
64
|
+
const responderProps = {};
|
|
65
|
+
for (const name of RESPONDER_PROPS) {
|
|
66
|
+
if (Object.hasOwn(source, name))
|
|
67
|
+
responderProps[name] = source[name];
|
|
68
|
+
}
|
|
69
|
+
const responder = Object.keys(responderProps).length > 0 ? createSpreadResponder(responderProps) : undefined;
|
|
70
|
+
if (!onLayout && !responder && !fallback)
|
|
71
|
+
return undefined;
|
|
72
|
+
const forwarded = source.ref;
|
|
73
|
+
return Object.assign((node) => {
|
|
74
|
+
if (!node)
|
|
75
|
+
return undefined;
|
|
76
|
+
if (fallback) {
|
|
77
|
+
const img = node;
|
|
78
|
+
const currentSrc = img.getAttribute('src');
|
|
79
|
+
if (img.complete && img.naturalWidth === 0 && currentSrc !== fallback) {
|
|
80
|
+
if (typeof img.decode === 'function') {
|
|
81
|
+
img.decode().then(undefined, () => {
|
|
82
|
+
if (img.getAttribute('src') === currentSrc)
|
|
83
|
+
img.src = fallback;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
img.src = fallback;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
let current;
|
|
92
|
+
if (onLayout || responder) {
|
|
93
|
+
current = attached.get(node);
|
|
94
|
+
if (!current) {
|
|
95
|
+
current = { previous: '', leaving: false };
|
|
96
|
+
attached.set(node, current);
|
|
97
|
+
}
|
|
98
|
+
current.leaving = false;
|
|
99
|
+
current.onLayout = onLayout;
|
|
100
|
+
if (onLayout && !current.observer)
|
|
101
|
+
observe(node, current);
|
|
102
|
+
responder?.attach(node);
|
|
103
|
+
}
|
|
104
|
+
let release;
|
|
105
|
+
if (typeof forwarded === 'function')
|
|
106
|
+
release = forwarded(node);
|
|
107
|
+
else if (forwarded)
|
|
108
|
+
forwarded.current = node;
|
|
109
|
+
return () => {
|
|
110
|
+
if (typeof release === 'function')
|
|
111
|
+
release();
|
|
112
|
+
else if (typeof forwarded === 'function')
|
|
113
|
+
forwarded(null);
|
|
114
|
+
else if (forwarded)
|
|
115
|
+
forwarded.current = null;
|
|
116
|
+
if (!current)
|
|
117
|
+
return;
|
|
118
|
+
// Not yet: a re-render detaches and reattaches the same element.
|
|
119
|
+
current.leaving = true;
|
|
120
|
+
queueMicrotask(() => {
|
|
121
|
+
if (!current.leaving)
|
|
122
|
+
return;
|
|
123
|
+
current.observer?.disconnect();
|
|
124
|
+
attached.delete(node);
|
|
125
|
+
responder?.release(node);
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
}, { responder });
|
|
129
|
+
}
|
|
130
|
+
function translate(source, consumed, fallback) {
|
|
131
|
+
const has = (name) => Object.hasOwn(source, name);
|
|
132
|
+
const out = {};
|
|
133
|
+
for (const name in source) {
|
|
134
|
+
if (has(name) && !consumed.has(name))
|
|
135
|
+
out[name] = source[name];
|
|
136
|
+
}
|
|
137
|
+
if (has('accessibilityLabel'))
|
|
138
|
+
out['aria-label'] = source.accessibilityLabel;
|
|
139
|
+
if (has('accessibilityHint'))
|
|
140
|
+
out['aria-description'] = source.accessibilityHint;
|
|
141
|
+
if (has('testID'))
|
|
142
|
+
out['data-testid'] = source.testID;
|
|
143
|
+
if (has('nativeID'))
|
|
144
|
+
out.id = source.nativeID;
|
|
145
|
+
if (has('pointerEvents'))
|
|
146
|
+
out['data-hozo-pointer-events'] = source.pointerEvents;
|
|
147
|
+
if (has('accessibilityLiveRegion')) {
|
|
148
|
+
const region = source.accessibilityLiveRegion;
|
|
149
|
+
out['aria-live'] = region === 'none' ? undefined : region;
|
|
150
|
+
}
|
|
151
|
+
if (has('accessibilityState')) {
|
|
152
|
+
const state = source.accessibilityState;
|
|
153
|
+
out['data-hozo-disabled'] = state?.disabled ? '' : undefined;
|
|
154
|
+
out['aria-disabled'] = state?.disabled;
|
|
155
|
+
out['aria-selected'] = state?.selected;
|
|
156
|
+
out['aria-checked'] = state?.checked;
|
|
157
|
+
out['aria-busy'] = state?.busy;
|
|
158
|
+
out['aria-expanded'] = state?.expanded;
|
|
159
|
+
}
|
|
160
|
+
if (has('accessibilityValue')) {
|
|
161
|
+
const value = source.accessibilityValue;
|
|
162
|
+
out['aria-valuemin'] = value?.min;
|
|
163
|
+
out['aria-valuemax'] = value?.max;
|
|
164
|
+
out['aria-valuenow'] = value?.now;
|
|
165
|
+
out['aria-valuetext'] = value?.text;
|
|
166
|
+
}
|
|
167
|
+
if (has('style'))
|
|
168
|
+
out.style = hozoDomStyle(source.style);
|
|
169
|
+
const ref = elementRef(source, fallback);
|
|
170
|
+
if (ref) {
|
|
171
|
+
out.ref = ref;
|
|
172
|
+
delete out.onLayout;
|
|
173
|
+
for (const name of RESPONDER_PROPS)
|
|
174
|
+
delete out[name];
|
|
175
|
+
// The pointer handlers the responder needs, after any the spread named.
|
|
176
|
+
Object.assign(out, ref.responder?.handlers);
|
|
177
|
+
}
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
/** A View's, Text's or document primitive's spread onto its element. */
|
|
181
|
+
export function hozoViewDomProps(props) {
|
|
182
|
+
if (!props || typeof props !== 'object')
|
|
183
|
+
return props;
|
|
184
|
+
return translate(props, UNIVERSAL);
|
|
185
|
+
}
|
|
186
|
+
const IMAGE = new Set([...UNIVERSAL, 'defaultSource', 'src']);
|
|
187
|
+
// The uncompiled Image's resolution. Its fallback to `defaultSource` after a
|
|
188
|
+
// load error is state there; here it is the `onError` and attach ref below.
|
|
189
|
+
function webSource(source) {
|
|
190
|
+
if (typeof source === 'string')
|
|
191
|
+
return source;
|
|
192
|
+
if (!source || typeof source !== 'object')
|
|
193
|
+
return undefined;
|
|
194
|
+
if (Array.isArray(source)) {
|
|
195
|
+
for (const candidate of source) {
|
|
196
|
+
const resolved = webSource(candidate);
|
|
197
|
+
if (resolved)
|
|
198
|
+
return resolved;
|
|
199
|
+
}
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
const object = source;
|
|
203
|
+
return typeof object.uri === 'string'
|
|
204
|
+
? object.uri
|
|
205
|
+
: typeof object.default === 'string'
|
|
206
|
+
? object.default
|
|
207
|
+
: undefined;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* An Image's spread onto its `<img>`. `src` may be an object or a list of
|
|
211
|
+
* them, and an accessibility label is the image's `alt`, as it is uncompiled.
|
|
212
|
+
*/
|
|
213
|
+
export function hozoImageDomProps(props) {
|
|
214
|
+
if (!props || typeof props !== 'object')
|
|
215
|
+
return props;
|
|
216
|
+
const source = props;
|
|
217
|
+
const primary = webSource(source.src);
|
|
218
|
+
const fallback = webSource(source.defaultSource);
|
|
219
|
+
const out = translate(source, IMAGE, primary && fallback ? fallback : undefined);
|
|
220
|
+
if (Object.hasOwn(source, 'src') || Object.hasOwn(source, 'defaultSource')) {
|
|
221
|
+
out.src = primary ?? fallback;
|
|
222
|
+
}
|
|
223
|
+
if (Object.hasOwn(source, 'accessibilityLabel')) {
|
|
224
|
+
delete out['aria-label'];
|
|
225
|
+
if (!Object.hasOwn(source, 'alt'))
|
|
226
|
+
out.alt = source.accessibilityLabel;
|
|
227
|
+
}
|
|
228
|
+
// A `src` that fails to load falls back to `defaultSource`, as it does
|
|
229
|
+
// uncompiled (#1126). Set on the element rather than kept in state: the
|
|
230
|
+
// next render writes the same `src` prop, which React leaves alone.
|
|
231
|
+
if (fallback && primary) {
|
|
232
|
+
const onError = source.onError;
|
|
233
|
+
out.onError = (event) => {
|
|
234
|
+
if (event.currentTarget.getAttribute('src') !== fallback)
|
|
235
|
+
event.currentTarget.src = fallback;
|
|
236
|
+
onError?.(event);
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return out;
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=view-dom-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-dom-props.js","sourceRoot":"","sources":["../../src/generated/view-dom-props.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+EAA+E;AAC/E,qDAAqD;AACrD,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,wBAAwB;AACxB,EAAE;AACF,2EAA2E;AAC3E,wEAAwE;AACxE,4EAA4E;AAC5E,4EAA4E;AAC5E,qCAAqC;AACrC,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,uEAAuE;AAEvE,OAAO,EACL,qBAAqB,EAErB,YAAY,EACZ,eAAe,GAEhB,MAAM,cAAc,CAAA;AAarB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,mBAAmB;IACnB,oBAAoB;IACpB,yBAAyB;IACzB,oBAAoB;IACpB,oBAAoB;IACpB,UAAU;IACV,eAAe;IACf,OAAO;IACP,QAAQ;CACT,CAAC,CAAA;AAaF,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;A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
|
2
|
+
import type { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
/** A pattern supplies already-resolved label styles, not classes or state. */
|
|
4
|
+
export declare function HozoInheritedLabel({ style, children, }: {
|
|
5
|
+
style?: StyleProp<TextStyle>;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=inherited-label.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-label.native.d.ts","sourceRoot":"","sources":["../src/inherited-label.native.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxD,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,+BAaA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useHozoInheritedTextFrame } from '@hozo/engine/generated/text-inheritance-protocol';
|
|
3
|
+
import { Children } from 'react';
|
|
4
|
+
import { HozoInheritedText } from './inherited-text.native.js';
|
|
5
|
+
import { HozoInheritedTextScope } from './inherited-text-scope.js';
|
|
6
|
+
import { flattenInheritedTextStyle } from './inherited-text-style.native.js';
|
|
7
|
+
/** A pattern supplies already-resolved label styles, not classes or state. */
|
|
8
|
+
export function HozoInheritedLabel({ style, children, }) {
|
|
9
|
+
const frame = useHozoInheritedTextFrame(flattenInheritedTextStyle(style));
|
|
10
|
+
return (_jsx(HozoInheritedTextScope, { frame: frame, children: Children.map(children, (child) => typeof child === 'string' || typeof child === 'number' ? (_jsx(HozoInheritedText, { style: style, children: child })) : (child)) }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=inherited-label.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-label.native.js","sourceRoot":"","sources":["../src/inherited-label.native.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAA;AAC5F,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA6B,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA4B,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAE5E,8EAA8E;AAC9E,MAAM,UAAU,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GAIT;IACC,MAAM,KAAK,GAAG,yBAAyB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAA;IACzE,OAAO,CACL,KAAC,sBAAsB,IAAC,KAAK,EAAE,KAAK,YACjC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAChC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CACvD,KAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,YAAG,KAAK,GAAqB,CAC7D,CAAC,CAAC,CAAC,CACF,KAAK,CACN,CACF,GACsB,CAC1B,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from 'react';
|
|
2
|
+
import type { Pressable, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
import { type HozoPressableProps } from './pressable.native.tsx';
|
|
4
|
+
type Props = Omit<HozoPressableProps, 'style'> & {
|
|
5
|
+
style?: StyleProp<ViewStyle & TextStyle> | Exclude<HozoPressableProps['style'], undefined>;
|
|
6
|
+
ref?: ComponentPropsWithRef<typeof Pressable>['ref'];
|
|
7
|
+
};
|
|
8
|
+
/** Internal generated ABI. Ordinary Pressable is unchanged. */
|
|
9
|
+
export declare function HozoInheritedPressable({ style, children, hozoTextStyle, hozoTransition, ...props }: Props): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=inherited-pressable.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-pressable.native.d.ts","sourceRoot":"","sources":["../src/inherited-pressable.native.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,qBAAqB,EAK3B,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAI9E,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAG/E,KAAK,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG;IAC/C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAA;IAC1F,GAAG,CAAC,EAAE,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,KAAK,CAAC,CAAA;CACrD,CAAA;AAkED,+DAA+D;AAC/D,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,aAAa,EACb,cAAc,EACd,GAAG,KAAK,EACT,EAAE,KAAK,+BAqDP"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { HozoInteractionContext } from '@hozo/behaviors/pressable-interaction';
|
|
3
|
+
import { canBlendColor } from '@hozo/engine';
|
|
4
|
+
import { HOZO_INHERITED_TEXT_FIELDS, useHozoInheritedTextFrame, } from '@hozo/engine/generated/text-inheritance-protocol';
|
|
5
|
+
import { Children, useContext, useMemo, useRef, } from 'react';
|
|
6
|
+
import { HozoInheritedText } from './inherited-text.native.js';
|
|
7
|
+
import { HozoInheritedTextScope } from './inherited-text-scope.js';
|
|
8
|
+
import { flattenInheritedTextStyle } from './inherited-text-style.native.js';
|
|
9
|
+
import { HozoPressable } from './pressable.native.js';
|
|
10
|
+
import { useHozoTextColorTransition } from './text-color-transition.native.js';
|
|
11
|
+
/** Only the label reads/publishes typography; there is no extra native box. */
|
|
12
|
+
function LabelScope({ own, resolve, transition, children, }) {
|
|
13
|
+
const interaction = useContext(HozoInteractionContext);
|
|
14
|
+
if (!interaction)
|
|
15
|
+
throw new Error('Inherited label requires the existing Pressable owner');
|
|
16
|
+
// The existing owner is the only state machine. Resolve the class label
|
|
17
|
+
// once from its committed snapshot, then apply the owner's explicit style.
|
|
18
|
+
const frame = useHozoInheritedTextFrame(flattenInheritedTextStyle([resolve?.({ ...interaction }), own]));
|
|
19
|
+
const labelled = Children.map(children, (child) => typeof child === 'string' || typeof child === 'number' ? (_jsx(HozoInheritedText, { children: child })) : (child));
|
|
20
|
+
return transition ? (_jsx(MotionScope, { frame: frame, transition: transition, children: labelled })) : (_jsx(HozoInheritedTextScope, { frame: frame, children: labelled }));
|
|
21
|
+
}
|
|
22
|
+
function MotionScope({ frame, transition, children, }) {
|
|
23
|
+
if (typeof frame.paint.color !== 'string' ||
|
|
24
|
+
!canBlendColor(frame.paint.color) ||
|
|
25
|
+
frame.paint.motion?.color != null)
|
|
26
|
+
throw new Error('Native text inheritance does not assess unresolved colours or nested inherited motion');
|
|
27
|
+
const color = useHozoTextColorTransition(frame.paint.color, '', transition);
|
|
28
|
+
const paint = useMemo(() => Object.freeze({ color: frame.paint.color, motion: Object.freeze({ color }) }), [color, frame.paint.color]);
|
|
29
|
+
return (_jsx(HozoInheritedTextScope, { frame: { metrics: frame.metrics, paint }, children: children }));
|
|
30
|
+
}
|
|
31
|
+
/** Internal generated ABI. Ordinary Pressable is unchanged. */
|
|
32
|
+
export function HozoInheritedPressable({ style, children, hozoTextStyle, hozoTransition, ...props }) {
|
|
33
|
+
const motion = Boolean(hozoTransition);
|
|
34
|
+
const initialMotion = useRef(motion);
|
|
35
|
+
const callback = typeof style === 'function';
|
|
36
|
+
const initialCallback = useRef(callback);
|
|
37
|
+
if (motion !== initialMotion.current)
|
|
38
|
+
throw new Error('Inherited colour motion does not assess changing transition presence');
|
|
39
|
+
if (motion && callback !== initialCallback.current)
|
|
40
|
+
throw new Error('Inherited colour motion does not assess changing box style ownership');
|
|
41
|
+
if (hozoTransition &&
|
|
42
|
+
(!hozoTransition.colors || hozoTransition.opacity || hozoTransition.transform))
|
|
43
|
+
throw new Error('Native text inheritance does not assess non-colour label transitions');
|
|
44
|
+
const { box, own } = useMemo(() => {
|
|
45
|
+
if (typeof style === 'function') {
|
|
46
|
+
if (!hozoTransition)
|
|
47
|
+
throw new Error('Native text inheritance does not assess style callbacks without motion');
|
|
48
|
+
// Only compiler-owned box callbacks are admitted. Label classes already
|
|
49
|
+
// have their own resolved channel: do not run or merge them twice here.
|
|
50
|
+
return {
|
|
51
|
+
box: (state) => {
|
|
52
|
+
const flat = flattenInheritedTextStyle(style(state));
|
|
53
|
+
if (HOZO_INHERITED_TEXT_FIELDS.some((field) => Object.hasOwn(flat, field)))
|
|
54
|
+
throw new Error('Native text inheritance does not assess text in box callbacks');
|
|
55
|
+
if (flat.backgroundColor != null &&
|
|
56
|
+
(typeof flat.backgroundColor !== 'string' || !canBlendColor(flat.backgroundColor)))
|
|
57
|
+
throw new Error('Native text inheritance does not assess unresolved background colours');
|
|
58
|
+
return flat;
|
|
59
|
+
},
|
|
60
|
+
own: {},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const flat = flattenInheritedTextStyle(style);
|
|
64
|
+
const box = { ...flat };
|
|
65
|
+
const own = {};
|
|
66
|
+
for (const field of HOZO_INHERITED_TEXT_FIELDS) {
|
|
67
|
+
if (Object.hasOwn(flat, field))
|
|
68
|
+
own[field] = flat[field];
|
|
69
|
+
delete box[field];
|
|
70
|
+
}
|
|
71
|
+
return { box: box, own };
|
|
72
|
+
}, [style, hozoTransition]);
|
|
73
|
+
return (_jsx(HozoPressable, { ...props, style: box, hozoTransition: callback ? hozoTransition : undefined, children: (state) => (_jsx(LabelScope, { own: own, resolve: hozoTextStyle, transition: hozoTransition, children: typeof children === 'function' ? children(state) : children })) }));
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=inherited-pressable.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-pressable.native.js","sourceRoot":"","sources":["../src/inherited-pressable.native.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EACL,0BAA0B,EAE1B,yBAAyB,GAC1B,MAAM,kDAAkD,CAAA;AACzD,OAAO,EACL,QAAQ,EAGR,UAAU,EACV,OAAO,EACP,MAAM,GACP,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA6B,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA4B,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAC5E,OAAO,EAAE,aAAa,EAA2B,MAAM,uBAAwB,CAAA;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AAO9E,+EAA+E;AAC/E,SAAS,UAAU,CAAC,EAClB,GAAG,EACH,OAAO,EACP,UAAU,EACV,QAAQ,GAMT;IACC,MAAM,WAAW,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAA;IACtD,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAC1F,wEAAwE;IACxE,2EAA2E;IAC3E,MAAM,KAAK,GAAG,yBAAyB,CACrC,yBAAyB,CAAC,CAAC,OAAO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AAU,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,GACjD,CACd,GACa,CACjB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from 'react';
|
|
2
|
+
import type { Text } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* A semantic size ratio, not a second style resolver. The scope's legacy
|
|
5
|
+
* size bridge comes from the same effective metrics as the seven-field frame.
|
|
6
|
+
* Resolve the default once; the element's own class/explicit size wins after
|
|
7
|
+
* it and the shared Text publishes the result for opaque descendants too.
|
|
8
|
+
* Kept separate so passive Text pays no new hook or import for relative text.
|
|
9
|
+
*/
|
|
10
|
+
export declare function HozoInheritedRelativeText({ hozoRelative, style, ...props }: ComponentPropsWithRef<typeof Text> & {
|
|
11
|
+
hozoRelative: number;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=inherited-relative-text.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-relative-text.native.d.ts","sourceRoot":"","sources":["../src/inherited-relative-text.native.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,qBAAqB,EAAc,MAAM,OAAO,CAAA;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAGxC;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,YAAY,EACZ,KAAK,EACL,GAAG,KAAK,EACT,EAAE,qBAAqB,CAAC,OAAO,IAAI,CAAC,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,+BAK/D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { HozoTextSizeContext } from '@hozo/engine/generated/text-size-context';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
import { HozoInheritedText } from './inherited-text.native.js';
|
|
5
|
+
/**
|
|
6
|
+
* A semantic size ratio, not a second style resolver. The scope's legacy
|
|
7
|
+
* size bridge comes from the same effective metrics as the seven-field frame.
|
|
8
|
+
* Resolve the default once; the element's own class/explicit size wins after
|
|
9
|
+
* it and the shared Text publishes the result for opaque descendants too.
|
|
10
|
+
* Kept separate so passive Text pays no new hook or import for relative text.
|
|
11
|
+
*/
|
|
12
|
+
export function HozoInheritedRelativeText({ hozoRelative, style, ...props }) {
|
|
13
|
+
const base = useContext(HozoTextSizeContext);
|
|
14
|
+
return (_jsx(HozoInheritedText, { ...props, style: [{ fontSize: Math.round(base * hozoRelative) }, style] }));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=inherited-relative-text.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-relative-text.native.js","sourceRoot":"","sources":["../src/inherited-relative-text.native.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAA;AAC9E,OAAO,EAA8B,UAAU,EAAE,MAAM,OAAO,CAAA;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA6B,CAAA;AAE/D;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,EACxC,YAAY,EACZ,KAAK,EACL,GAAG,KAAK,EACsD;IAC9D,MAAM,IAAI,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAA;IAC5C,OAAO,CACL,KAAC,iBAAiB,OAAK,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,GAAI,CAChG,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HozoInheritedTextFrame } from '@hozo/engine/generated/text-inheritance-protocol';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
/** One stable shape, even when every local declaration is removed. */
|
|
4
|
+
export declare function HozoInheritedTextScope({ frame, children, }: {
|
|
5
|
+
frame: HozoInheritedTextFrame;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=inherited-text-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-text-scope.d.ts","sourceRoot":"","sources":["../src/inherited-text-scope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,kDAAkD,CAAA;AAEzD,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAElD,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,sBAAsB,CAAA;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,+BAWA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { HozoInheritedMetricsContext, HozoInheritedPaintContext, } from '@hozo/engine/generated/text-inheritance-protocol';
|
|
3
|
+
import { HozoTextSizeContext } from '@hozo/engine/generated/text-size-context';
|
|
4
|
+
import { useContext } from 'react';
|
|
5
|
+
/** One stable shape, even when every local declaration is removed. */
|
|
6
|
+
export function HozoInheritedTextScope({ frame, children, }) {
|
|
7
|
+
const legacy = useContext(HozoTextSizeContext);
|
|
8
|
+
return (_jsx(HozoInheritedMetricsContext.Provider, { value: frame.metrics, children: _jsx(HozoInheritedPaintContext.Provider, { value: frame.paint, children: _jsx(HozoTextSizeContext.Provider, { value: frame.metrics.fontSize ?? legacy, children: children }) }) }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=inherited-text-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-text-scope.js","sourceRoot":"","sources":["../src/inherited-text-scope.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAE1B,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAA;AAC9E,OAAO,EAAkB,UAAU,EAAE,MAAM,OAAO,CAAA;AAElD,sEAAsE;AACtE,MAAM,UAAU,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,GAIT;IACC,MAAM,MAAM,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAA;IAC9C,OAAO,CACL,KAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YACxD,KAAC,yBAAyB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,YACpD,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,IAAI,MAAM,YAClE,QAAQ,GACoB,GACI,GACA,CACxC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type HozoInheritedTextOwn } from '@hozo/engine/generated/text-inheritance-protocol';
|
|
2
|
+
import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
export type InheritedNativeStyle = StyleProp<TextStyle & ViewStyle>;
|
|
4
|
+
export declare function flattenInheritedTextStyle(style: InheritedNativeStyle): Record<string, unknown> & HozoInheritedTextOwn;
|
|
5
|
+
//# sourceMappingURL=inherited-text-style.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-text-style.native.d.ts","sourceRoot":"","sources":["../src/inherited-text-style.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,KAAK,SAAS,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAEzF,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,CAAA;AAGnE,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,oBAAoB,GAwBpD,0BAAc,oBAAoB,CAClD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HOZO_INHERITED_TEXT_FIELDS, } from '@hozo/engine/generated/text-inheritance-protocol';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
const EMPTY = Object.freeze({});
|
|
4
|
+
export function flattenInheritedTextStyle(style) {
|
|
5
|
+
if (typeof style === 'function')
|
|
6
|
+
throw new Error('Native text inheritance does not assess style callbacks');
|
|
7
|
+
// Read static records without cloning them. Only the View host needs its
|
|
8
|
+
// own normalized copy; the compiler's/source owner's style is never edited.
|
|
9
|
+
const flat = (StyleSheet.flatten(style) ?? EMPTY);
|
|
10
|
+
for (const name of ['fontFamily', 'fontVariant', 'fontStyle']) {
|
|
11
|
+
if (flat[name] != null)
|
|
12
|
+
throw new Error(`Native text inheritance does not assess ${name}`);
|
|
13
|
+
}
|
|
14
|
+
// This internal first slice accepts resolved seven-field frames, not
|
|
15
|
+
// Animated nodes or opaque platform colors. Do not silently certify them.
|
|
16
|
+
for (const name of HOZO_INHERITED_TEXT_FIELDS) {
|
|
17
|
+
const value = flat[name];
|
|
18
|
+
if (value == null)
|
|
19
|
+
continue;
|
|
20
|
+
const numeric = name === 'fontSize' || name === 'lineHeight' || name === 'letterSpacing';
|
|
21
|
+
const textual = name === 'textAlign' || name === 'textTransform';
|
|
22
|
+
if ((numeric && typeof value !== 'number') ||
|
|
23
|
+
(textual && typeof value !== 'string') ||
|
|
24
|
+
(!numeric && !textual && typeof value !== 'string' && typeof value !== 'number') ||
|
|
25
|
+
(typeof value === 'number' && !Number.isFinite(value)))
|
|
26
|
+
throw new Error(`Native text inheritance does not assess ${name}`);
|
|
27
|
+
}
|
|
28
|
+
return flat;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=inherited-text-style.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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AK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;YAChF,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAEtD,MAAM,IAAI,KAAK,CAAC,2CAA2C,IAAI,EAAE,CAAC,CAAA;IACtE,CAAC;IACD,OAAO,IAA0C,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
/** @internal Generated ABI; ordinary output does not import it. */
|
|
4
|
+
export declare function HozoInheritedText({ style, children, ...props }: ComponentPropsWithRef<typeof Text>): import("react").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=inherited-text.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-text.native.d.ts","sourceRoot":"","sources":["../src/inherited-text.native.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAe,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAY,IAAI,EAAkB,MAAM,cAAc,CAAA;AAM7D,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,CAAC,OAAO,IAAI,CAAC,+BAkBpC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useHozoInheritedTextFrame } from '@hozo/engine/generated/text-inheritance-protocol';
|
|
3
|
+
import { Animated, Text } from 'react-native';
|
|
4
|
+
import { HozoInheritedTextScope } from './inherited-text-scope.js';
|
|
5
|
+
import { flattenInheritedTextStyle } from './inherited-text-style.native.js';
|
|
6
|
+
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
7
|
+
/** @internal Generated ABI; ordinary output does not import it. */
|
|
8
|
+
export function HozoInheritedText({ style, children, ...props }) {
|
|
9
|
+
const frame = useHozoInheritedTextFrame(flattenInheritedTextStyle(style));
|
|
10
|
+
// Local overrides mask the shared value but retain this host kind. Toggling
|
|
11
|
+
// an own colour must not remount nested state or allocate another timeline.
|
|
12
|
+
const Component = frame.paint.motion ? AnimatedText : Text;
|
|
13
|
+
const paint = frame.paint.motion
|
|
14
|
+
? { color: frame.paint.motion.color ?? frame.paint.color }
|
|
15
|
+
: frame.paint;
|
|
16
|
+
return (_jsx(HozoInheritedTextScope, { frame: frame, children: _jsx(Component, { ...props, style: [style, frame.metrics, paint], children: children }) }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=inherited-text.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-text.native.js","sourceRoot":"","sources":["../src/inherited-text.native.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAA;AAE5F,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA4B,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAE5E,MAAM,YAAY,GAAgB,QAAQ,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAA;AAExE,mEAAmE;AACnE,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EAC2B;IACnC,MAAM,KAAK,GAAG,yBAAyB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAA;IACzE,4EAA4E;IAC5E,4EAA4E;IAC5E,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAA;IAC1D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM;QAC9B,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;QAC1D,CAAC,CAAC,KAAK,CAAC,KAAK,CAAA;IACf,OAAO,CACL,KAAC,sBAAsB,IAAC,KAAK,EAAE,KAAK,YAClC,KAAC,SAAS,OACJ,KAAK,EACT,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAA6B,EAAE,KAA2B,CAAC,YAE/E,QAAQ,GACC,GACW,CAC1B,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { type InheritedNativeStyle } from './inherited-text-style.native.ts';
|
|
4
|
+
export interface HozoInheritedViewProps extends Omit<ComponentPropsWithRef<typeof View>, 'style'> {
|
|
5
|
+
style?: InheritedNativeStyle;
|
|
6
|
+
}
|
|
7
|
+
/** @internal Publish owner data before removing invalid host View fields. */
|
|
8
|
+
export declare function HozoInheritedView({ style, children, ...props }: HozoInheritedViewProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=inherited-view.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-view.native.d.ts","sourceRoot":"","sources":["../src/inherited-view.native.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,qBAAqB,EAAE,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAA;AAGnD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAA;AAEzC,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,IAAI,CAAC,EAAE,OAAO,CAAC;IAC/F,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAC7B;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,+BAkBtF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { HOZO_INHERITED_TEXT_FIELDS, useHozoInheritedTextFrame, } from '@hozo/engine/generated/text-inheritance-protocol';
|
|
3
|
+
import { Children } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { HozoInheritedText } from './inherited-text.native.js';
|
|
6
|
+
import { HozoInheritedTextScope } from './inherited-text-scope.js';
|
|
7
|
+
import { flattenInheritedTextStyle, } from './inherited-text-style.native.js';
|
|
8
|
+
/** @internal Publish owner data before removing invalid host View fields. */
|
|
9
|
+
export function HozoInheritedView({ style, children, ...props }) {
|
|
10
|
+
const own = flattenInheritedTextStyle(style);
|
|
11
|
+
const frame = useHozoInheritedTextFrame(own);
|
|
12
|
+
const rendered = { ...own };
|
|
13
|
+
for (const name of HOZO_INHERITED_TEXT_FIELDS)
|
|
14
|
+
delete rendered[name];
|
|
15
|
+
return (_jsx(HozoInheritedTextScope, { frame: frame, children: _jsx(View, { ...props, style: rendered, children: Children.map(children, (child) => typeof child === 'string' || typeof child === 'number' ? (_jsx(HozoInheritedText, { children: child })) : (child)) }) }));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=inherited-view.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-view.native.js","sourceRoot":"","sources":["../src/inherited-view.native.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,QAAQ,EAA8B,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA6B,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA4B,CAAA;AACnE,OAAO,EACL,yBAAyB,GAE1B,MAAM,kCAAkC,CAAA;AAMzC,6EAA6E;AAC7E,MAAM,UAAU,iBAAiB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAA0B;IACrF,MAAM,GAAG,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAA;IAC5C,MAAM,KAAK,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAA;IAC5C,MAAM,QAAQ,GAAG,EAAE,GAAG,GAAG,EAAE,CAAA;IAC3B,KAAK,MAAM,IAAI,IAAI,0BAA0B;QAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAA;IACpE,OAAO,CACL,KAAC,sBAAsB,IAAC,KAAK,EAAE,KAAK,YAClC,KAAC,IAAI,OAAK,KAAK,EAAE,KAAK,EAAE,QAA8B,YACnD,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAChC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CACvD,KAAC,iBAAiB,cAAE,KAAK,GAAqB,CAC/C,CAAC,CAAC,CAAC,CACF,KAAK,CACN,CACF,GACI,GACgB,CAC1B,CAAA;AACH,CAAC"}
|