@hozo/primitives 0.2.0 → 0.3.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.
@@ -16,17 +16,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
16
16
  // `HozoContainerQuery` renders no element of its own. It exists to put a
17
17
  // component boundary between the provider and the read, and adding a View
18
18
  // to do that would change the layout the query is measuring.
19
- import { createContext, useContext, useMemo, useState } from 'react';
19
+ import { createContext, useContext, useMemo, useState, } from 'react';
20
20
  import { View } from 'react-native';
21
21
  import { keepIfSettled } from './runtime-measured.js';
22
22
  const HozoContainerContext = createContext({});
23
23
  /**
24
- * A View that measures itself and hands its width to its subtree.
24
+ * Measures the existing host and hands its width to its subtree.
25
25
  *
26
- * The compiler renders an element here instead of a View when its classes
27
- * declared it a container.
26
+ * A provider adds no layout node. The host keeps its own style/children
27
+ * callbacks, refs and events rather than asking a replacement View to
28
+ * approximate them. An ordinary container still defaults to View.
28
29
  */
29
- export function HozoContainer({ hozoContainerName, onLayout, children, ...rest }) {
30
+ export function HozoContainer({ hozoContainerComponent, hozoContainerName, onLayout, children, ...rest }) {
31
+ const Component = hozoContainerComponent ?? View;
30
32
  const [width, setWidth] = useState(undefined);
31
33
  const outer = useContext(HozoContainerContext);
32
34
  const widths = useMemo(() => ({
@@ -45,7 +47,7 @@ export function HozoContainer({ hozoContainerName, onLayout, children, ...rest }
45
47
  setWidth((current) => keepIfSettled(current, measured));
46
48
  onLayout?.(event);
47
49
  };
48
- return (_jsx(View, { ...rest, onLayout: measure, children: _jsx(HozoContainerContext.Provider, { value: widths, children: children }) }));
50
+ return (_jsx(HozoContainerContext.Provider, { value: widths, children: _jsx(Component, { ...rest, onLayout: measure, children: children }) }));
49
51
  }
50
52
  /**
51
53
  * Hands the widths in scope to the element that queries them.
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-container.native.js","sourceRoot":"","sources":["../src/runtime-container.native.tsx"],"names":[],"mappings":";AAAA,qDAAqD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,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,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"}
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,EAAE;AACF,qEAAqE;AACrE,sEAAsE;AACtE,oEAAoE;AACpE,uEAAuE;AACvE,yEAAyE;AACzE,sEAAsE;AACtE,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,6DAA6D;AAE7D,OAAO,EAEL,aAAa,EAGb,UAAU,EACV,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAA0B,IAAI,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAkBrD,MAAM,oBAAoB,GAAG,aAAa,CAAsB,EAAE,CAAC,CAAA;AAUnE;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAyC,EACpE,sBAAsB,EACtB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACkB;IACzB,MAAM,SAAS,GAAgB,sBAAsB,IAAI,IAAI,CAAA;IAC7D,MAAM,CAAC,KAAK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measured/responder-aware View for the Web paths that cannot be a plain div. */
50
- export declare function HozoView({ ref: forwardedRef, children, style, testID, nativeID, pointerEvents, accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityState, accessibilityValue, accessibilityLiveRegion, onLayout, collapsable: _collapsable, role, 'aria-disabled': ariaDisabled, 'data-hozo-disabled': dataHozoDisabled, onStartShouldSetResponder, onStartShouldSetResponderCapture, onMoveShouldSetResponder, onMoveShouldSetResponderCapture, onResponderGrant, onResponderStart, onResponderMove, onResponderEnd, onResponderRelease, onResponderReject, onResponderTerminate, onResponderTerminationRequest, ...props }: HozoViewProps): import("react").DetailedReactHTMLElement<{
51
- dangerouslySetInnerHTML?: {
52
- __html: string | TrustedHTML;
53
- } | undefined;
54
- onCopy?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
55
- onCopyCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
56
- onCut?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
57
- onCutCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
58
- onPaste?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
59
- onPasteCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
60
- onCompositionEnd?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
61
- onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
62
- onCompositionStart?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
63
- onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
64
- onCompositionUpdate?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
65
- onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
66
- onFocus?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
67
- onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
68
- onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
69
- onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
70
- onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
71
- onChangeCapture?: import("react").ChangeEventHandler<HTMLDivElement, Element> | undefined;
72
- onBeforeInput?: import("react").InputEventHandler<HTMLDivElement> | undefined;
73
- onBeforeInputCapture?: import("react").InputEventHandler<HTMLDivElement> | undefined;
74
- onInput?: import("react").InputEventHandler<HTMLDivElement> | undefined;
75
- onInputCapture?: import("react").InputEventHandler<HTMLDivElement> | undefined;
76
- onReset?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
77
- onResetCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
78
- onSubmit?: import("react").SubmitEventHandler<HTMLDivElement> | undefined;
79
- onSubmitCapture?: import("react").SubmitEventHandler<HTMLDivElement> | undefined;
80
- onInvalid?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
81
- onInvalidCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
82
- onLoad?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
83
- onLoadCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
84
- onError?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
85
- onErrorCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
86
- onKeyDown?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
87
- onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
88
- onKeyPress?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
89
- onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
90
- onKeyUp?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
91
- onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
92
- onAbort?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
93
- onAbortCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
94
- onCanPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
95
- onCanPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
96
- onCanPlayThrough?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
97
- onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
98
- onDurationChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
99
- onDurationChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
100
- onEmptied?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
101
- onEmptiedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
102
- onEncrypted?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
103
- onEncryptedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
104
- onEnded?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
105
- onEndedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
106
- onLoadedData?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
107
- onLoadedDataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
108
- onLoadedMetadata?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
109
- onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
110
- onLoadStart?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
111
- onLoadStartCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
112
- onPause?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
113
- onPauseCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
114
- onPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
115
- onPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
116
- onPlaying?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
117
- onPlayingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
118
- onProgress?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
119
- onProgressCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
120
- onRateChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
121
- onRateChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
122
- onSeeked?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
123
- onSeekedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
124
- onSeeking?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
125
- onSeekingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
126
- onStalled?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
127
- onStalledCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
128
- onSuspend?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
129
- onSuspendCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
130
- onTimeUpdate?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
131
- onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
132
- onVolumeChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
133
- onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
134
- onWaiting?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
135
- onWaitingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
136
- onAuxClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
137
- onAuxClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
138
- onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
139
- onClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
140
- onContextMenu?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
141
- onContextMenuCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
142
- onDoubleClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
143
- onDoubleClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
144
- onDrag?: import("react").DragEventHandler<HTMLDivElement> | undefined;
145
- onDragCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
146
- onDragEnd?: import("react").DragEventHandler<HTMLDivElement> | undefined;
147
- onDragEndCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
148
- onDragEnter?: import("react").DragEventHandler<HTMLDivElement> | undefined;
149
- onDragEnterCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
150
- onDragExit?: import("react").DragEventHandler<HTMLDivElement> | undefined;
151
- onDragExitCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
152
- onDragLeave?: import("react").DragEventHandler<HTMLDivElement> | undefined;
153
- onDragLeaveCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
154
- onDragOver?: import("react").DragEventHandler<HTMLDivElement> | undefined;
155
- onDragOverCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
156
- onDragStart?: import("react").DragEventHandler<HTMLDivElement> | undefined;
157
- onDragStartCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
158
- onDrop?: import("react").DragEventHandler<HTMLDivElement> | undefined;
159
- onDropCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
160
- onMouseDown?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
161
- onMouseDownCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
162
- onMouseEnter?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
163
- onMouseLeave?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
164
- onMouseMove?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
165
- onMouseMoveCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
166
- onMouseOut?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
167
- onMouseOutCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
168
- onMouseOver?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
169
- onMouseOverCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
170
- onMouseUp?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
171
- onMouseUpCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
172
- onSelect?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
173
- onSelectCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
174
- onTouchCancel?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
175
- onTouchCancelCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
176
- onTouchEnd?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
177
- onTouchEndCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
178
- onTouchMove?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
179
- onTouchMoveCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
180
- onTouchStart?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
181
- onTouchStartCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
182
- onPointerDown?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
183
- onPointerDownCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
184
- onPointerMove?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
185
- onPointerMoveCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
186
- onPointerUp?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
187
- onPointerUpCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
188
- onPointerCancel?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
189
- onPointerCancelCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
190
- onPointerEnter?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
191
- onPointerLeave?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
192
- onPointerOver?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
193
- onPointerOverCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
194
- onPointerOut?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
195
- onPointerOutCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
196
- onGotPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
197
- onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
198
- onLostPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
199
- onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
200
- onScroll?: import("react").UIEventHandler<HTMLDivElement> | undefined;
201
- onScrollCapture?: import("react").UIEventHandler<HTMLDivElement> | undefined;
202
- onScrollEnd?: import("react").UIEventHandler<HTMLDivElement> | undefined;
203
- onScrollEndCapture?: import("react").UIEventHandler<HTMLDivElement> | undefined;
204
- onWheel?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
205
- onWheelCapture?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
206
- onAnimationStart?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
207
- onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
208
- onAnimationEnd?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
209
- onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
210
- onAnimationIteration?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
211
- onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
212
- onToggle?: import("react").ToggleEventHandler<HTMLDivElement> | undefined;
213
- onBeforeToggle?: import("react").ToggleEventHandler<HTMLDivElement> | undefined;
214
- onTransitionCancel?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
215
- onTransitionCancelCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
216
- onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
217
- onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
218
- onTransitionRun?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
219
- onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
220
- onTransitionStart?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
221
- onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
222
- "aria-activedescendant"?: string | undefined;
223
- "aria-atomic"?: ("false" | "true" | boolean) | undefined;
224
- "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
225
- "aria-braillelabel"?: string | undefined;
226
- "aria-brailleroledescription"?: string | undefined;
227
- "aria-colcount"?: number | undefined;
228
- "aria-colindex"?: number | undefined;
229
- "aria-colindextext"?: string | undefined;
230
- "aria-colspan"?: number | undefined;
231
- "aria-controls"?: string | undefined;
232
- "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
233
- "aria-describedby"?: string | undefined;
234
- "aria-details"?: string | undefined;
235
- "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
236
- "aria-errormessage"?: string | undefined;
237
- "aria-flowto"?: string | undefined;
238
- "aria-grabbed"?: ("false" | "true" | boolean) | undefined;
239
- "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
240
- "aria-hidden"?: ("false" | "true" | boolean) | undefined;
241
- "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
242
- "aria-keyshortcuts"?: string | undefined;
243
- "aria-labelledby"?: string | undefined;
244
- "aria-level"?: number | undefined;
245
- "aria-modal"?: ("false" | "true" | boolean) | undefined;
246
- "aria-multiline"?: ("false" | "true" | boolean) | undefined;
247
- "aria-multiselectable"?: ("false" | "true" | boolean) | undefined;
248
- "aria-orientation"?: "horizontal" | "vertical" | undefined;
249
- "aria-owns"?: string | undefined;
250
- "aria-placeholder"?: string | undefined;
251
- "aria-posinset"?: number | undefined;
252
- "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
253
- "aria-readonly"?: ("false" | "true" | boolean) | undefined;
254
- "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
255
- "aria-required"?: ("false" | "true" | boolean) | undefined;
256
- "aria-roledescription"?: string | undefined;
257
- "aria-rowcount"?: number | undefined;
258
- "aria-rowindex"?: number | undefined;
259
- "aria-rowindextext"?: string | undefined;
260
- "aria-rowspan"?: number | undefined;
261
- "aria-setsize"?: number | undefined;
262
- "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
263
- defaultChecked?: boolean | undefined;
264
- defaultValue?: string | number | readonly string[] | undefined;
265
- suppressContentEditableWarning?: boolean | undefined;
266
- suppressHydrationWarning?: boolean | undefined;
267
- accessKey?: string | undefined;
268
- autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
269
- autoFocus?: boolean | undefined;
270
- className?: string | undefined;
271
- contentEditable?: ("false" | "true" | boolean) | "inherit" | "plaintext-only" | undefined;
272
- contextMenu?: string | undefined;
273
- dir?: string | undefined;
274
- draggable?: ("false" | "true" | boolean) | undefined;
275
- enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
276
- hidden?: boolean | undefined;
277
- lang?: string | undefined;
278
- nonce?: string | undefined;
279
- slot?: string | undefined;
280
- spellCheck?: ("false" | "true" | boolean) | undefined;
281
- tabIndex?: number | undefined;
282
- title?: string | undefined;
283
- translate?: "yes" | "no" | undefined;
284
- radioGroup?: string | undefined;
285
- about?: string | undefined;
286
- content?: string | undefined;
287
- datatype?: string | undefined;
288
- inlist?: any;
289
- prefix?: string | undefined;
290
- property?: string | undefined;
291
- rel?: string | undefined;
292
- resource?: string | undefined;
293
- rev?: string | undefined;
294
- typeof?: string | undefined;
295
- vocab?: string | undefined;
296
- autoCorrect?: string | undefined;
297
- autoSave?: string | undefined;
298
- color?: string | undefined;
299
- itemProp?: string | undefined;
300
- itemScope?: boolean | undefined;
301
- itemType?: string | undefined;
302
- itemID?: string | undefined;
303
- itemRef?: string | undefined;
304
- results?: number | undefined;
305
- security?: string | undefined;
306
- unselectable?: "on" | "off" | undefined;
307
- popover?: "" | "auto" | "manual" | "hint" | undefined;
308
- popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
309
- popoverTarget?: string | undefined;
310
- inert?: boolean | undefined;
311
- inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
312
- is?: string | undefined;
313
- exportparts?: string | undefined;
314
- part?: string | undefined;
315
- ref: (element: HTMLDivElement | null) => void;
316
- role: string | undefined;
317
- style: import("react").CSSProperties | undefined;
318
- 'data-testid': string | undefined;
319
- id: string | undefined;
320
- 'data-hozo-pointer-events': "auto" | "box-none" | "box-only" | "none" | undefined;
321
- 'data-hozo-disabled': string | undefined;
322
- 'aria-disabled': ("false" | "true" | boolean) | undefined;
323
- 'aria-selected': boolean | undefined;
324
- 'aria-checked': "mixed" | boolean | undefined;
325
- 'aria-busy': boolean | undefined;
326
- 'aria-expanded': boolean | undefined;
327
- 'aria-valuemin': number | undefined;
328
- 'aria-valuemax': number | undefined;
329
- 'aria-valuenow': number | undefined;
330
- 'aria-valuetext': string | undefined;
331
- 'aria-live': "assertive" | "polite" | undefined;
332
- 'aria-label': string | undefined;
333
- 'aria-description': string | undefined;
334
- }, HTMLDivElement>;
50
+ export declare function HozoView({ ref: forwardedRef, children, style, testID, nativeID, pointerEvents, accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityState, accessibilityValue, accessibilityLiveRegion, onLayout, collapsable: _collapsable, role, 'aria-disabled': ariaDisabled, 'data-hozo-disabled': dataHozoDisabled, onStartShouldSetResponder, onStartShouldSetResponderCapture, onMoveShouldSetResponder, onMoveShouldSetResponderCapture, onResponderGrant, onResponderStart, onResponderMove, onResponderEnd, onResponderRelease, onResponderReject, onResponderTerminate, onResponderTerminationRequest, ...props }: HozoViewProps): import("react").FunctionComponentElement<import("react").FragmentProps>;
335
51
  //# sourceMappingURL=view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,cAAc,EAEpB,MAAM,cAAc,CAAA;AACrB,OAAO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D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;CAC1B;AAOD,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EAAE,YAAY,EACjB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,QAAQ,EACR,WAAW,EAAE,YAAY,EACzB,IAAI,EACJ,eAAe,EAAE,YAAY,EAC7B,oBAAoB,EAAE,gBAAgB,EACtC,yBAAyB,EACzB,gCAAgC,EAChC,wBAAwB,EACxB,+BAA+B,EAC/B,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,GAAG,KAAK,EACT,EAAE,aAAa,2EAqFf"}
package/dist/view.js CHANGED
@@ -1,5 +1,5 @@
1
- import { hozoDomStyle, useResponderDomProps, } from '@hozo/engine';
2
- import { createElement, useCallback, useEffect, useRef, } from 'react';
1
+ import { hozoDomStyle, hozoViewBase, hozoViewClassName, useResponderDomProps, } from '@hozo/engine';
2
+ import { createElement, Fragment, useCallback, useEffect, useRef, } from 'react';
3
3
  function assignRef(ref, value) {
4
4
  if (typeof ref === 'function')
5
5
  ref(value);
@@ -57,8 +57,9 @@ export function HozoView({ ref: forwardedRef, children, style, testID, nativeID,
57
57
  }, []);
58
58
  const state = accessibilityState;
59
59
  const value = accessibilityValue;
60
- return createElement('div', {
60
+ return createElement(Fragment, null, hozoViewBase(), createElement('div', {
61
61
  ...props,
62
+ className: hozoViewClassName(props.className),
62
63
  ...responder,
63
64
  ref: setRef,
64
65
  role: accessibilityRole ?? role,
@@ -79,6 +80,6 @@ export function HozoView({ ref: forwardedRef, children, style, testID, nativeID,
79
80
  'aria-live': accessibilityLiveRegion === 'none' ? undefined : accessibilityLiveRegion,
80
81
  'aria-label': accessibilityLabel,
81
82
  'aria-description': accessibilityHint,
82
- }, children);
83
+ }, children));
83
84
  }
84
85
  //# sourceMappingURL=view.js.map
package/dist/view.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAEZ,oBAAoB,GACrB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,aAAa,EAIb,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAA;AAwCd,SAAS,SAAS,CAAI,GAAuB,EAAE,KAAe;IAC5D,IAAI,OAAO,GAAG,KAAK,UAAU;QAAE,GAAG,CAAC,KAAK,CAAC,CAAA;SACpC,IAAI,GAAG;QAAE,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;AACnC,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,QAAQ,CAAC,EACvB,GAAG,EAAE,YAAY,EACjB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,QAAQ,EACR,WAAW,EAAE,YAAY,EACzB,IAAI,EACJ,eAAe,EAAE,YAAY,EAC7B,oBAAoB,EAAE,gBAAgB,EACtC,yBAAyB,EACzB,gCAAgC,EAChC,wBAAwB,EACxB,+BAA+B,EAC/B,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,GAAG,KAAK,EACM;IACd,MAAM,UAAU,GAAG,MAAM,CAAiB,IAA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AAC,uBAAuB;QACrF,YAAY,EAAE,kBAAkB;QAChC,kBAAkB,EAAE,iBAAiB;KACtC,EACD,QAAQ,CACT,CACF,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hozo/primitives",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Canonical universal UI primitives for Hozo applications.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -131,8 +131,8 @@
131
131
  "provenance": true
132
132
  },
133
133
  "dependencies": {
134
- "@hozo/behaviors": "^0.2.0",
135
- "@hozo/engine": "^0.2.0"
134
+ "@hozo/behaviors": "^0.3.0",
135
+ "@hozo/engine": "^0.3.0"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "react": "^19.0.0",
@@ -6,6 +6,8 @@
6
6
  import {
7
7
  type HozoDomStyle,
8
8
  hozoDomStyle,
9
+ hozoViewBase,
10
+ hozoViewClassName,
9
11
  type ResponderProps,
10
12
  useResponderDomProps,
11
13
  } from '@hozo/engine'
@@ -14,6 +16,8 @@ import {
14
16
  type CSSProperties,
15
17
  type MouseEventHandler,
16
18
  type ReactNode,
19
+ type Ref,
20
+ useCallback,
17
21
  useEffect,
18
22
  useRef,
19
23
  useState,
@@ -89,8 +93,29 @@ function universalDomProps(props: UniversalProps) {
89
93
  } as const
90
94
  }
91
95
 
92
- function useLayoutRef<T extends HTMLElement>(onLayout?: (event: HozoLayoutEvent) => void) {
96
+ /**
97
+ * The element, for `onLayout` and the responder, and the caller's `ref` too.
98
+ *
99
+ * React Native's `View` takes a `ref`, and the compiled `<div>` passes one
100
+ * straight through. This fallback held its own ref for `onLayout` and gave
101
+ * the caller nothing, so whether `ref` worked depended on whether the
102
+ * compiler had run. `setRef` hands the node to both.
103
+ */
104
+ function useLayoutRef<T extends HTMLElement>(
105
+ onLayout?: (event: HozoLayoutEvent) => void,
106
+ forwarded?: Ref<T>,
107
+ ) {
93
108
  const elementRef = useRef<T>(null)
109
+ // A new function only when the caller's ref changes, so React detaches the
110
+ // old one and attaches the new rather than re-running both every render.
111
+ const setRef = useCallback(
112
+ (node: T | null) => {
113
+ elementRef.current = node
114
+ if (typeof forwarded === 'function') forwarded(node)
115
+ else if (forwarded) forwarded.current = node
116
+ },
117
+ [forwarded],
118
+ )
94
119
  const callbackRef = useRef(onLayout)
95
120
  callbackRef.current = onLayout
96
121
 
@@ -120,33 +145,43 @@ function useLayoutRef<T extends HTMLElement>(onLayout?: (event: HozoLayoutEvent)
120
145
  return () => observer.disconnect()
121
146
  }, [])
122
147
 
123
- return elementRef
148
+ return { elementRef, setRef }
124
149
  }
125
150
 
126
151
  export interface ViewProps extends UniversalProps, ResponderProps {
127
152
  className?: string
128
153
  children?: ReactNode
154
+ ref?: Ref<HTMLDivElement>
129
155
  }
130
156
 
131
- export function View({ className, children, onLayout, ...universal }: ViewProps) {
132
- const ref = useLayoutRef<HTMLDivElement>(onLayout)
133
- const responder = useResponderDomProps(ref, universal)
157
+ export function View({ className, children, onLayout, ref, ...universal }: ViewProps) {
158
+ const { elementRef, setRef } = useLayoutRef<HTMLDivElement>(onLayout, ref)
159
+ const responder = useResponderDomProps(elementRef, universal)
134
160
  return (
135
- <div ref={ref} className={className} {...universalDomProps(universal)} {...responder}>
136
- {children}
137
- </div>
161
+ <>
162
+ {hozoViewBase()}
163
+ <div
164
+ ref={setRef}
165
+ className={hozoViewClassName(className)}
166
+ {...universalDomProps(universal)}
167
+ {...responder}
168
+ >
169
+ {children}
170
+ </div>
171
+ </>
138
172
  )
139
173
  }
140
174
 
141
175
  export interface TextProps extends UniversalProps {
142
176
  className?: string
143
177
  children?: ReactNode
178
+ ref?: Ref<HTMLSpanElement>
144
179
  }
145
180
 
146
- export function Text({ className, children, onLayout, ...universal }: TextProps) {
147
- const ref = useLayoutRef<HTMLSpanElement>(onLayout)
181
+ export function Text({ className, children, onLayout, ref, ...universal }: TextProps) {
182
+ const { setRef } = useLayoutRef<HTMLSpanElement>(onLayout, ref)
148
183
  return (
149
- <span ref={ref} className={className} {...universalDomProps(universal)}>
184
+ <span ref={setRef} className={className} {...universalDomProps(universal)}>
150
185
  {children}
151
186
  </span>
152
187
  )
@@ -160,6 +195,7 @@ export interface ImageProps extends UniversalProps {
160
195
  accessibilityLabel?: string
161
196
  onLoad?: (event: unknown) => void
162
197
  onError?: (event: unknown) => void
198
+ ref?: Ref<HTMLImageElement>
163
199
  }
164
200
 
165
201
  export interface HozoImageSourceObject {
@@ -200,15 +236,16 @@ export function Image({
200
236
  onLoad,
201
237
  onError,
202
238
  onLayout,
239
+ ref,
203
240
  ...universal
204
241
  }: ImageProps) {
205
- const ref = useLayoutRef<HTMLImageElement>(onLayout)
242
+ const { setRef } = useLayoutRef<HTMLImageElement>(onLayout, ref)
206
243
  const [failedSource, setFailedSource] = useState<HozoImageSource>()
207
244
  const webSrc =
208
245
  (failedSource === src ? undefined : webImageSource(src)) ?? webImageSource(defaultSource)
209
246
  return (
210
247
  <img
211
- ref={ref}
248
+ ref={setRef}
212
249
  className={className}
213
250
  src={webSrc}
214
251
  alt={alt ?? accessibilityLabel ?? ''}
@@ -307,17 +344,21 @@ export function Button({
307
344
  )
308
345
  }
309
346
  return (
310
- <button
311
- type="button"
312
- className={className}
313
- disabled={disabled}
314
- data-hozo-disabled={disabled ? '' : undefined}
315
- aria-label={accessibilityLabel}
316
- aria-description={accessibilityHint}
317
- data-testid={testID}
318
- onClick={onPress as MouseEventHandler<HTMLButtonElement>}
319
- >
320
- {children}
321
- </button>
347
+ <>
348
+ {hozoViewBase()}
349
+ <button
350
+ type="button"
351
+ className={className}
352
+ disabled={disabled}
353
+ data-hozo-disabled={disabled ? '' : undefined}
354
+ data-hozo-pressable={onPress && !disabled ? '' : undefined}
355
+ aria-label={accessibilityLabel}
356
+ aria-description={accessibilityHint}
357
+ data-testid={testID}
358
+ onClick={onPress as MouseEventHandler<HTMLButtonElement>}
359
+ >
360
+ {children}
361
+ </button>
362
+ </>
322
363
  )
323
364
  }