@symbiote-native/vue 1.0.0 → 3.0.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.
Files changed (114) hide show
  1. package/README.md +13 -12
  2. package/babel-jsx.cjs +26 -18
  3. package/build/components/activity-indicator-props.d.ts +5 -0
  4. package/build/components/activity-indicator-props.js +1 -0
  5. package/build/components/button-props.d.ts +5 -0
  6. package/build/components/button-props.js +1 -0
  7. package/build/components/flat-list/index.d.ts +3 -3
  8. package/build/components/flat-list/index.js +3 -3
  9. package/build/components/image-background-props.d.ts +7 -0
  10. package/build/components/image-background-props.js +1 -0
  11. package/build/components/image-props.d.ts +5 -0
  12. package/build/components/image-props.js +5 -0
  13. package/build/components/{input-accessory-view.d.ts → input-accessory-view-props.d.ts} +1 -3
  14. package/build/components/input-accessory-view-props.js +5 -0
  15. package/build/components/keyboard-avoiding-view.js +9 -5
  16. package/build/components/modal/index.js +1 -1
  17. package/build/components/pressable-props.d.ts +31 -0
  18. package/build/components/pressable-props.js +12 -0
  19. package/build/components/refresh-control-props.d.ts +16 -0
  20. package/build/components/refresh-control-props.js +9 -0
  21. package/build/components/safe-area-view-props.d.ts +6 -0
  22. package/build/components/safe-area-view-props.js +5 -0
  23. package/build/components/scroll-view/{shared.d.ts → scroll-view-props.d.ts} +4 -27
  24. package/build/components/scroll-view/scroll-view-props.js +1 -0
  25. package/build/components/section-list/index.d.ts +3 -3
  26. package/build/components/switch/switch-props.d.ts +6 -0
  27. package/build/components/switch/switch-props.js +1 -0
  28. package/build/components/text-input/text-input-props.d.ts +5 -0
  29. package/build/components/text-input/text-input-props.js +1 -0
  30. package/build/components/text-props.d.ts +24 -0
  31. package/build/components/text-props.js +6 -0
  32. package/build/components/touchable-native-feedback-props.d.ts +7 -0
  33. package/build/components/touchable-native-feedback-props.js +1 -0
  34. package/build/components/touchable-props.d.ts +17 -0
  35. package/build/components/touchable-props.js +1 -0
  36. package/build/components/touchable-without-feedback-props.d.ts +5 -0
  37. package/build/components/touchable-without-feedback-props.js +1 -0
  38. package/build/components/view-props.d.ts +29 -0
  39. package/build/components/view-props.js +5 -0
  40. package/build/components/virtualized-list/index.d.ts +3 -3
  41. package/build/components/virtualized-list/index.js +64 -46
  42. package/build/components/virtualized-section-list/index.d.ts +3 -3
  43. package/build/descriptor-to-vue.js +2 -2
  44. package/build/host-instance/index.js +2 -2
  45. package/build/index.d.ts +24 -27
  46. package/build/index.js +31 -16
  47. package/build/intrinsic-elements.d.ts +19 -0
  48. package/build/intrinsic-elements.js +1 -0
  49. package/build/jsx-runtime.d.ts +67 -0
  50. package/build/jsx-runtime.js +1 -0
  51. package/build/modules/animated/index.d.ts +41 -20
  52. package/build/modules/animated/index.js +20 -19
  53. package/build/modules/image/index.d.ts +3 -0
  54. package/build/modules/image/index.js +13 -0
  55. package/build/register.d.ts +1 -1
  56. package/build/register.js +13 -33
  57. package/build/renderer/index.js +108 -54
  58. package/build/runtime-helpers/index.d.ts +10 -1
  59. package/build/runtime-helpers/index.js +56 -22
  60. package/build/utils/normalize-attrs.js +3 -3
  61. package/intrinsic-tags.cjs +52 -0
  62. package/metro-vue-transformer.cjs +55 -345
  63. package/package.json +13 -9
  64. package/babel-lower-host-primitives.cjs +0 -225
  65. package/build/components/activity-indicator/index.android.d.ts +0 -4
  66. package/build/components/activity-indicator/index.android.js +0 -10
  67. package/build/components/activity-indicator/index.d.ts +0 -1
  68. package/build/components/activity-indicator/index.ios.d.ts +0 -4
  69. package/build/components/activity-indicator/index.ios.js +0 -10
  70. package/build/components/activity-indicator/index.js +0 -4
  71. package/build/components/activity-indicator/shared.d.ts +0 -8
  72. package/build/components/activity-indicator/shared.js +0 -48
  73. package/build/components/button.d.ts +0 -14
  74. package/build/components/button.js +0 -61
  75. package/build/components/image-background.d.ts +0 -9
  76. package/build/components/image-background.js +0 -103
  77. package/build/components/image.d.ts +0 -9
  78. package/build/components/image.js +0 -90
  79. package/build/components/input-accessory-view.js +0 -41
  80. package/build/components/pressable.d.ts +0 -58
  81. package/build/components/pressable.js +0 -233
  82. package/build/components/refresh-control.d.ts +0 -20
  83. package/build/components/refresh-control.js +0 -47
  84. package/build/components/safe-area-view.d.ts +0 -9
  85. package/build/components/safe-area-view.js +0 -33
  86. package/build/components/scroll-view/index.android.d.ts +0 -4
  87. package/build/components/scroll-view/index.android.js +0 -64
  88. package/build/components/scroll-view/index.d.ts +0 -1
  89. package/build/components/scroll-view/index.ios.d.ts +0 -4
  90. package/build/components/scroll-view/index.ios.js +0 -17
  91. package/build/components/scroll-view/index.js +0 -4
  92. package/build/components/scroll-view/shared.js +0 -271
  93. package/build/components/scroll-view/sticky-header.d.ts +0 -7
  94. package/build/components/scroll-view/sticky-header.js +0 -208
  95. package/build/components/switch/index.android.d.ts +0 -12
  96. package/build/components/switch/index.android.js +0 -13
  97. package/build/components/switch/index.d.ts +0 -2
  98. package/build/components/switch/index.ios.d.ts +0 -12
  99. package/build/components/switch/index.ios.js +0 -11
  100. package/build/components/switch/index.js +0 -5
  101. package/build/components/switch/shared.d.ts +0 -23
  102. package/build/components/switch/shared.js +0 -126
  103. package/build/components/text-input/index.d.ts +0 -24
  104. package/build/components/text-input/index.js +0 -260
  105. package/build/components/touchable-native-feedback.d.ts +0 -24
  106. package/build/components/touchable-native-feedback.js +0 -82
  107. package/build/components/touchable.d.ts +0 -50
  108. package/build/components/touchable.js +0 -281
  109. package/build/components.d.ts +0 -53
  110. package/build/components.js +0 -45
  111. package/build/composables/use-raw-attrs.d.ts +0 -1
  112. package/build/composables/use-raw-attrs.js +0 -26
  113. package/build/state-style.d.ts +0 -1
  114. package/build/state-style.js +0 -13
@@ -1,281 +0,0 @@
1
- // The Touchable* family for Vue, all built on Pressable. Ported against RN's own sources
2
- // (.vendors/react-native/.../Components/Touchable/*.js) after the 2026-08-19 audit found ten
3
- // divergences shared by the React/Vue/Svelte/Angular ports; Solid migrated first, this is Vue.
4
- //
5
- // Shared (framework-agnostic) half: the press-scheduling machine, the underlay machine, the
6
- // resting-opacity math, the press-handler gate, the extra-style split. Vue owns only the
7
- // lifecycle — refs, the real timers, the Animated wiring, and the emit bridge:
8
- // TouchableOpacity: an Animated.Value fading toward activeOpacity on press-in and back to the
9
- // style's own opacity on press-out.
10
- // TouchableHighlight: the underlay machine flipping a `shown` ref; underlayColor lands on the
11
- // container, the lowered opacity on the cloned child.
12
- // TouchableWithoutFeedback: the same press-scheduling machine with the visual half empty.
13
- //
14
- // Inputs arrive as attrs (untyped), narrowed with runtime guards. The handlers read attrs LIVE
15
- // (they fire on events, not render) so a re-supplied callback / timing is always honored.
16
- import { cloneVNode, defineComponent, getCurrentInstance, h, onUnmounted, ref, watch, } from '@vue/runtime-core';
17
- import { createHighlightUnderlayHandlers, createHighlightUnderlayRuntime, createTouchableFeedbackHandlers, createTouchableFeedbackRuntime, hasTouchablePressHandler, resolveHighlightExtraStyles, restingOpacityFromStyle, DEFAULT_ACTIVE_OPACITY, OPACITY_ACTIVE_GRANT_DURATION_MS, OPACITY_INACTIVE_DURATION_MS, TOUCHABLE_MIN_PRESS_DURATION_MS, } from '@symbiote-native/components';
18
- import { dlog, } from '@symbiote-native/engine';
19
- import { Pressable, emitPressableEvents, PRESSABLE_EMITS, } from './pressable.js';
20
- import { Animated } from '../modules/animated/index.js';
21
- import { normalizeVueAttrs } from '../utils/normalize-attrs.js';
22
- const TOUCHABLE_HIGHLIGHT_EMITS = {
23
- ...PRESSABLE_EMITS,
24
- showUnderlay: () => true,
25
- hideUnderlay: () => true,
26
- };
27
- function numberOr(value, fallback) {
28
- return typeof value === 'number' ? value : fallback;
29
- }
30
- // The real setTimeout the shared machines schedule their deferred activation/deactivation/underlay
31
- // hide on (core/components has no timer globals). Returns a canceller so an early release flushes
32
- // the timer.
33
- function scheduleTimeout(callback, ms) {
34
- const id = setTimeout(callback, ms);
35
- return () => clearTimeout(id);
36
- }
37
- function forwardExcept(attrs, handled) {
38
- const result = {};
39
- for (const key of Object.keys(attrs)) {
40
- if (!handled.includes(key))
41
- result[key] = attrs[key];
42
- }
43
- return result;
44
- }
45
- const TOUCHABLE_OPACITY_HANDLED = [
46
- 'activeOpacity',
47
- 'style',
48
- 'class',
49
- 'onPressIn',
50
- 'onPressOut',
51
- 'delayPressIn',
52
- 'delayPressOut',
53
- 'minPressDuration',
54
- ];
55
- export const TouchableOpacity = defineComponent((_props, { slots, attrs: rawAttrs, emit }) => {
56
- // RN's _getChildStyleOpacityWithDefault: the fade settles at the opacity the CALLER's style
57
- // asks for, not at a hard 1 — and the Animated.Value is SEEDED there, or the first paint jumps
58
- // to fully opaque on a Touchable styled `opacity: 0.6`.
59
- const restingOpacity = () => restingOpacityFromStyle(normalizeVueAttrs(rawAttrs).style);
60
- // One Animated.Value per mount. Held by identity in setup scope (an engine object, never a
61
- // reactive ref — a Proxy would miss the graph's bookkeeping). The Animated.View leaf commits
62
- // it every frame.
63
- const opacity = new Animated.Value(restingOpacity());
64
- // The shared press-scheduling cell (delayPressIn timer + activation clock), persisted across
65
- // renders in setup scope; the handlers are rebuilt each render over live attrs.
66
- const runtime = createTouchableFeedbackRuntime();
67
- function setOpacityTo(toValue, duration) {
68
- dlog(`TouchableOpacity opacity -> ${toValue} over ${duration}ms`);
69
- // useNativeDriver: true is RN's own (TouchableOpacity.js:242). opacity is natively drivable,
70
- // so the fade survives a busy JS thread — the whole point of press feedback.
71
- Animated.timing(opacity, {
72
- toValue,
73
- duration,
74
- easing: Animated.Easing.inOut(Animated.Easing.quad),
75
- useNativeDriver: true,
76
- }).start();
77
- }
78
- // RN's componentDidUpdate: a changed `disabled` or a changed style opacity re-settles the view,
79
- // so a Touchable disabled mid-press does not stay stuck at its active opacity. NO `immediate` —
80
- // RN does this on UPDATE only, and firing at mount would animate over the value the
81
- // Animated.Value was just seeded with. Two getter sources, not one object: Vue compares an
82
- // array source element-wise, so an unrelated attr change does not re-settle the opacity.
83
- watch([() => normalizeVueAttrs(rawAttrs).disabled, restingOpacity], ([, resting]) => {
84
- setOpacityTo(resting, OPACITY_INACTIVE_DURATION_MS);
85
- });
86
- // RN's componentWillUnmount: stop the animation and drop the value back, so a teardown
87
- // mid-fade leaves no driver running against a node that is gone.
88
- onUnmounted(() => {
89
- opacity.resetAnimation();
90
- });
91
- return () => {
92
- const attrs = normalizeVueAttrs(rawAttrs);
93
- const style = attrs.style;
94
- // Rebuilt each render so a re-supplied delay/opacity is honored (Vue's live-attr idiom); the
95
- // shared machine owns the scheduling, the adapter supplies the Animated fade + emit.
96
- const { handlePressIn, handlePressOut } = createTouchableFeedbackHandlers({
97
- delayPressIn: numberOr(attrs.delayPressIn, 0),
98
- delayPressOut: numberOr(attrs.delayPressOut, 0),
99
- // RN's Touchables override Pressability's 130ms floor with 0; what holds the active
100
- // visual is the fade's own duration, not a press-duration floor.
101
- minPressDuration: numberOr(attrs.minPressDuration, TOUCHABLE_MIN_PRESS_DURATION_MS),
102
- schedule: scheduleTimeout,
103
- now: Date.now,
104
- }, runtime, {
105
- activate(event) {
106
- setOpacityTo(numberOr(attrs.activeOpacity, DEFAULT_ACTIVE_OPACITY), OPACITY_ACTIVE_GRANT_DURATION_MS);
107
- emit('pressIn', event);
108
- },
109
- deactivate(event) {
110
- setOpacityTo(restingOpacity(), OPACITY_INACTIVE_DURATION_MS);
111
- emit('pressOut', event);
112
- },
113
- });
114
- const pressableProps = {
115
- __minPressDuration: 0,
116
- ...forwardExcept(attrs, TOUCHABLE_OPACITY_HANDLED),
117
- ...emitPressableEvents(emit),
118
- onPressIn: handlePressIn,
119
- onPressOut: handlePressOut,
120
- };
121
- const children = slots.default !== undefined ? slots.default() : [];
122
- const feedback = h(Animated.View, { style: [style, { opacity }], class: attrs.class }, () => children);
123
- return h(Pressable, pressableProps, { default: () => [feedback] });
124
- };
125
- }, {
126
- name: 'TouchableOpacity',
127
- inheritAttrs: false,
128
- emits: PRESSABLE_EMITS,
129
- });
130
- // delayPressOut is CONSUMED here (the underlay hold), so it must not also forward to the host.
131
- // onPress/onPressIn/onPressOut/onShowUnderlay/onHideUnderlay never appear in attrs at all — they
132
- // are declared emits, which Vue strips from $attrs.
133
- const TOUCHABLE_HIGHLIGHT_HANDLED = [
134
- 'activeOpacity',
135
- 'underlayColor',
136
- 'style',
137
- 'delayPressOut',
138
- ];
139
- // A vnode that can carry a style prop: a host tag (string) or a component (object/function).
140
- // Fragment / Text / Comment / Static are Symbols and fail all three — cloning one with a style
141
- // would silently drop it.
142
- function isStylableVNode(vnode) {
143
- const type = vnode.type;
144
- return (typeof type === 'string' ||
145
- typeof type === 'function' ||
146
- (typeof type === 'object' && type !== null));
147
- }
148
- export const TouchableHighlight = defineComponent((_props, { slots, attrs: rawAttrs, emit }) => {
149
- // `shown` is NOT `pressed`: RN holds the underlay for delayPressOut past the tap so a fast tap
150
- // still flashes, and the pressed flag is already false by then.
151
- const shown = ref(false);
152
- // The mutable underlay cell (the in-flight hide canceller). A plain setup-scope object, never
153
- // a ref: the machine mutates it on every event and nothing reads it reactively.
154
- const runtime = createHighlightUnderlayRuntime();
155
- // The press callbacks are declared emits, so Vue has stripped their onX listeners from $attrs.
156
- // RN's _hasPressHandler gate therefore reads what the PARENT actually passed, off the
157
- // instance's own vnode props — the same shape FlatList/VirtualizedList use for this.
158
- const instance = getCurrentInstance();
159
- const listener = (onName) => {
160
- const vnodeProps = instance?.vnode.props;
161
- return vnodeProps == null ? undefined : vnodeProps[onName];
162
- };
163
- return () => {
164
- const attrs = normalizeVueAttrs(rawAttrs);
165
- const hasPressHandler = hasTouchablePressHandler({
166
- onPress: listener('onPress'),
167
- onPressIn: listener('onPressIn'),
168
- onPressOut: listener('onPressOut'),
169
- onLongPress: listener('onLongPress'),
170
- });
171
- // Rebuilt each render over live attrs; the runtime persists, so an in-flight hide timer
172
- // survives a rebuild.
173
- const underlay = createHighlightUnderlayHandlers({
174
- delayPressOut: numberOr(attrs.delayPressOut, 0),
175
- hasPressHandler,
176
- schedule: scheduleTimeout,
177
- }, runtime, {
178
- setShown: next => {
179
- shown.value = next;
180
- },
181
- onShowUnderlay: () => emit('showUnderlay'),
182
- onHideUnderlay: () => emit('hideUnderlay'),
183
- });
184
- const extra = resolveHighlightExtraStyles({
185
- shown: shown.value,
186
- hasPressHandler,
187
- underlayColor: typeof attrs.underlayColor === 'string'
188
- ? attrs.underlayColor
189
- : undefined,
190
- activeOpacity: typeof attrs.activeOpacity === 'number'
191
- ? attrs.activeOpacity
192
- : undefined,
193
- });
194
- const children = slots.default !== undefined ? slots.default() : [];
195
- // RN's _createExtraStyles split: the backgroundColor on the CONTAINER, the lowered opacity
196
- // on the CHILD (TouchableHighlight.js clones its single child). Vue can reach the child
197
- // without a wrapper node — cloneVNode merges the style onto exactly one existing vnode, so
198
- // nothing is inserted into the flex chain. It needs RN's own single-element-child shape
199
- // though (React.Children.only): a fragment, a raw text node or several roots have no one
200
- // child to clone, and there both styles fold onto the container — the pre-audit
201
- // approximation, where the opacity fades the very underlay it should reveal.
202
- const onlyChild = children.length === 1 && children[0] !== undefined
203
- ? children[0]
204
- : undefined;
205
- const canStyleChild = onlyChild !== undefined && isStylableVNode(onlyChild);
206
- const styledChildren = extra !== undefined && canStyleChild && onlyChild !== undefined
207
- ? [cloneVNode(onlyChild, { style: extra.child })]
208
- : children;
209
- const containerStyle = extra === undefined
210
- ? attrs.style
211
- : canStyleChild
212
- ? [attrs.style, extra.underlay]
213
- : [attrs.style, extra.underlay, extra.child];
214
- const pressableProps = {
215
- __minPressDuration: 0,
216
- ...forwardExcept(attrs, TOUCHABLE_HIGHLIGHT_HANDLED),
217
- ...emitPressableEvents(emit),
218
- style: containerStyle,
219
- // Visual first, then the caller's callback — RN's order in _createPressabilityConfig.
220
- onPress: (event) => {
221
- underlay.handlePress(event);
222
- emit('press', event);
223
- },
224
- onPressIn: (event) => {
225
- underlay.handlePressIn(event);
226
- emit('pressIn', event);
227
- },
228
- onPressOut: (event) => {
229
- underlay.handlePressOut(event);
230
- emit('pressOut', event);
231
- },
232
- };
233
- return h(Pressable, pressableProps, { default: () => styledChildren });
234
- };
235
- }, {
236
- name: 'TouchableHighlight',
237
- inheritAttrs: false,
238
- emits: TOUCHABLE_HIGHLIGHT_EMITS,
239
- });
240
- // RN's TouchableWithoutFeedback builds a FULL Pressability config — "without feedback" means no
241
- // VISUAL, not no timing — so the delay props are consumed by the shared machine here instead of
242
- // forwarding to the host as unknown Fabric props.
243
- const TOUCHABLE_WITHOUT_FEEDBACK_HANDLED = [
244
- 'delayPressIn',
245
- 'delayPressOut',
246
- 'minPressDuration',
247
- ];
248
- export const TouchableWithoutFeedback = defineComponent((_props, { slots, attrs: rawAttrs, emit }) => {
249
- const runtime = createTouchableFeedbackRuntime();
250
- return () => {
251
- const attrs = normalizeVueAttrs(rawAttrs);
252
- // The same machine TouchableOpacity runs, with the visual half left empty.
253
- const { handlePressIn, handlePressOut } = createTouchableFeedbackHandlers({
254
- delayPressIn: numberOr(attrs.delayPressIn, 0),
255
- delayPressOut: numberOr(attrs.delayPressOut, 0),
256
- minPressDuration: numberOr(attrs.minPressDuration, TOUCHABLE_MIN_PRESS_DURATION_MS),
257
- schedule: scheduleTimeout,
258
- now: Date.now,
259
- }, runtime, {
260
- activate(event) {
261
- emit('pressIn', event);
262
- },
263
- deactivate(event) {
264
- emit('pressOut', event);
265
- },
266
- });
267
- const pressableProps = {
268
- __minPressDuration: 0,
269
- ...forwardExcept(attrs, TOUCHABLE_WITHOUT_FEEDBACK_HANDLED),
270
- ...emitPressableEvents(emit),
271
- onPressIn: handlePressIn,
272
- onPressOut: handlePressOut,
273
- };
274
- const children = slots.default !== undefined ? slots.default() : [];
275
- return h(Pressable, pressableProps, { default: () => children });
276
- };
277
- }, {
278
- name: 'TouchableWithoutFeedback',
279
- inheritAttrs: false,
280
- emits: PRESSABLE_EMITS,
281
- });
@@ -1,53 +0,0 @@
1
- import { type FunctionalComponent, type VNodeRef } from '@vue/runtime-core';
2
- import type { ISymbioteEvent, IClassNameValue, IStyleProp, ITextStyle, IViewStyle } from '@symbiote-native/engine';
3
- import type { IAccessibilityProps, IAriaProps, IResponderProps } from '@symbiote-native/components';
4
- export interface IViewProps extends IAccessibilityProps, IAriaProps, IResponderProps {
5
- style?: IStyleProp<IViewStyle>;
6
- class?: IClassNameValue;
7
- onPress?: (event: ISymbioteEvent) => void;
8
- onPressIn?: (event: ISymbioteEvent) => void;
9
- onPressOut?: (event: ISymbioteEvent) => void;
10
- onLayout?: (event: ISymbioteEvent) => void;
11
- onFocus?: (event: ISymbioteEvent) => void;
12
- onBlur?: (event: ISymbioteEvent) => void;
13
- pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only';
14
- hitSlop?: number | {
15
- top?: number;
16
- left?: number;
17
- bottom?: number;
18
- right?: number;
19
- };
20
- id?: string;
21
- focusable?: boolean;
22
- collapsable?: boolean;
23
- removeClippedSubviews?: boolean;
24
- renderToHardwareTextureAndroid?: boolean;
25
- shouldRasterizeIOS?: boolean;
26
- needsOffscreenAlphaCompositing?: boolean;
27
- ref?: VNodeRef;
28
- key?: string | number | symbol;
29
- }
30
- export interface ITextProps extends IAccessibilityProps, IAriaProps {
31
- style?: IStyleProp<ITextStyle>;
32
- class?: IClassNameValue;
33
- onPress?: (event: ISymbioteEvent) => void;
34
- onLongPress?: (event: ISymbioteEvent) => void;
35
- onPressIn?: (event: ISymbioteEvent) => void;
36
- onPressOut?: (event: ISymbioteEvent) => void;
37
- onLayout?: (event: ISymbioteEvent) => void;
38
- onTextLayout?: (event: ISymbioteEvent) => void;
39
- numberOfLines?: number;
40
- ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';
41
- selectable?: boolean;
42
- adjustsFontSizeToFit?: boolean;
43
- minimumFontScale?: number;
44
- allowFontScaling?: boolean;
45
- maxFontSizeMultiplier?: number | null;
46
- selectionColor?: string;
47
- ref?: VNodeRef;
48
- key?: string | number | symbol;
49
- }
50
- export declare const HOST_VIEW = "symbiote-view";
51
- export declare const HOST_TEXT = "symbiote-text";
52
- export declare const View: FunctionalComponent<IViewProps, {}, any, {}>;
53
- export declare const Text: FunctionalComponent<ITextProps, {}, any, {}>;
@@ -1,45 +0,0 @@
1
- // Host primitives for app code. Thin FUNCTIONAL components over the intrinsic tags the
2
- // renderer maps to Fabric: `inheritAttrs: false` + a manual attr spread passes every
3
- // prop and `@event` (onX) straight through to patchProp -> routeProp. The full prop
4
- // surface (typed ViewProps/TextProps, a11y folding) arrives with @symbiote-native/components.
5
- //
6
- // FUNCTIONAL, not a stateful defineComponent: a functional component has no instance, so
7
- // a template/function ref on it falls through to its single root host element (the raw
8
- // SymbioteNode), exactly like React's functional View hands back its host instance. A
9
- // stateful component's ref would resolve to a useless component proxy, which is why
10
- // createAnimatedComponent (which captures the host node via that ref) needs the fall-through.
11
- import { h } from '@vue/runtime-core';
12
- import { resolveTextProps } from '@symbiote-native/components';
13
- import { normalizeVueAttrs } from './utils/normalize-attrs.js';
14
- function hostComponent(intrinsic, name,
15
- // An optional last fold over the normalized attrs. Text needs one (RN's ellipsizeMode /
16
- // allowFontScaling defaults); View does not, so it stays a straight pass-through.
17
- fold = attrs => attrs) {
18
- // normalizeVueAttrs folds kebab template props (:accessibility-label) to the RN camelCase contract.
19
- const component = (_props, { slots, attrs }) => h(intrinsic, fold(normalizeVueAttrs(attrs)), slots.default !== undefined ? slots.default() : undefined);
20
- component.displayName = name;
21
- component.inheritAttrs = false;
22
- return component;
23
- }
24
- // The intrinsic tags the two bare primitives wrap. Exported because ADAPTER-INTERNAL renders must
25
- // use the TAG, never the component: Vue charges a full component instance even for a functional
26
- // one, so `h(View, …)` inside our own Pressable/Button costs an instance per node for a wrapper
27
- // that only forwards attrs.
28
- //
29
- // These stay LITERALS rather than being read out of `@symbiote-native/components/host-primitives`,
30
- // which is where the two transforms now get them: the spec types `intrinsic` as `string`, and
31
- // reading it here would widen `HOST_VIEW` from the literal type that `hostComponent` and every
32
- // adapter-internal `h(HOST_VIEW, …)` rely on. So this is the last remaining second encoding, and
33
- // `components.test.ts` pins it against the spec rather than trusting the two to stay in step.
34
- //
35
- // Children go to a tag as an ARRAY (or a bare string / vnode), never a slot function — an element
36
- // ignores slot children entirely and renders nothing. The reverse of the rule that applies to a
37
- // component.
38
- export const HOST_VIEW = 'symbiote-view';
39
- export const HOST_TEXT = 'symbiote-text';
40
- export const View = hostComponent(HOST_VIEW, 'View');
41
- export const Text = hostComponent(HOST_TEXT, 'Text', resolveTextProps);
42
- // Text is no longer bare either — it carries RN's Text.js defaults through resolveTextProps.
43
- // Image is NOT a bare host primitive: it needs the shared fold (source/src/srcSet resolution,
44
- // width/height -> style, alt -> accessibility) + the Image statics, so it lives in ./image as a
45
- // functional component over renderImage. View/Text stay bare; they forward attrs verbatim.
@@ -1 +0,0 @@
1
- export declare function useRawAttrs(contextAttrs: Record<string, unknown>): Record<string, unknown>;
@@ -1,26 +0,0 @@
1
- // The unproxied twin of a setup context's `attrs`.
2
- //
3
- // Vue hands `setupContext.attrs` out as `new Proxy(instance.attrs, attrsProxyHandlers)`, and in
4
- // PRODUCTION as well as dev that proxy's only trap is `get(target, key) { track(target, "get", "");
5
- // return target[key]; }` (runtime-core.esm-bundler.js:8357). So every attribute read costs a
6
- // WeakMap get, a Map get and a `dep.track()`, and the first read of each instance also allocates
7
- // a Map and a Dep into the module-global `targetMap` that live as long as the component does.
8
- // Pressable reads ~16 attrs per render and a benchmark create mounts 2 000 of them.
9
- //
10
- // `instance.attrs` is the raw object behind that proxy. Capturing it is safe because its identity
11
- // never changes: `initProps` assigns it once (:4907) and `updateProps` mutates that same object in
12
- // place (`attrs[key] = value` / `delete attrs[key]`), so a reference taken at setup always reads
13
- // current values. The tracking the proxy performs is for reads in a setup BODY; a render fn does
14
- // not need it, because the parent's patch re-runs the child render through `updateComponentPreRender`
15
- // whether or not the child subscribed.
16
- //
17
- // CALL THIS FROM A SETUP BODY ONLY, never from a render fn, a `computed`, or any other deferred
18
- // callback. `getCurrentInstance()` resolves to `currentInstance || currentRenderingInstance`, so in
19
- // a callback that runs while a DIFFERENT component is rendering it returns that component and this
20
- // would silently hand back the wrong bag. `virtualized-list/index.ts` calls normalizeVueAttrs
21
- // inside a `computed` for exactly that reason and must keep using the context attrs.
22
- import { getCurrentInstance } from '@vue/runtime-core';
23
- export function useRawAttrs(contextAttrs) {
24
- const instance = getCurrentInstance();
25
- return instance === null ? contextAttrs : instance.attrs;
26
- }
@@ -1 +0,0 @@
1
- export { resolveStateStyle, type IPressStateArgument, type IResolvedStateStyle, } from '@symbiote-native/components/state-style';
@@ -1,13 +0,0 @@
1
- // Re-export only. The implementation is shared (`@symbiote-native/components`) because two adapters
2
- // had written byte-identical copies; this file exists so the code a transform EMITS keeps importing
3
- // from the adapter package the app already depends on, rather than reaching past it.
4
- //
5
- // Imported from the SUBPATH, not the barrel: every adapter barrel re-exports
6
- // `@symbiote-native/components` wholesale, so a name on that barrel silently becomes public API on
7
- // all five — which is how a transform internal nearly shipped as a supported export.
8
- //
9
- // Present on every adapter, including those with no lowering transform yet: a per-framework subpath
10
- // that four of five declare is exactly the silent gap `tests/package-subpath-parity.test.ts` exists
11
- // to catch, and the file costs a re-export. Deliberately NOT on the public barrel — the emitted
12
- // code names it, app code does not.
13
- export { resolveStateStyle, } from '@symbiote-native/components/state-style';