@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.
- package/README.md +13 -12
- package/babel-jsx.cjs +26 -18
- package/build/components/activity-indicator-props.d.ts +5 -0
- package/build/components/activity-indicator-props.js +1 -0
- package/build/components/button-props.d.ts +5 -0
- package/build/components/button-props.js +1 -0
- package/build/components/flat-list/index.d.ts +3 -3
- package/build/components/flat-list/index.js +3 -3
- package/build/components/image-background-props.d.ts +7 -0
- package/build/components/image-background-props.js +1 -0
- package/build/components/image-props.d.ts +5 -0
- package/build/components/image-props.js +5 -0
- package/build/components/{input-accessory-view.d.ts → input-accessory-view-props.d.ts} +1 -3
- package/build/components/input-accessory-view-props.js +5 -0
- package/build/components/keyboard-avoiding-view.js +9 -5
- package/build/components/modal/index.js +1 -1
- package/build/components/pressable-props.d.ts +31 -0
- package/build/components/pressable-props.js +12 -0
- package/build/components/refresh-control-props.d.ts +16 -0
- package/build/components/refresh-control-props.js +9 -0
- package/build/components/safe-area-view-props.d.ts +6 -0
- package/build/components/safe-area-view-props.js +5 -0
- package/build/components/scroll-view/{shared.d.ts → scroll-view-props.d.ts} +4 -27
- package/build/components/scroll-view/scroll-view-props.js +1 -0
- package/build/components/section-list/index.d.ts +3 -3
- package/build/components/switch/switch-props.d.ts +6 -0
- package/build/components/switch/switch-props.js +1 -0
- package/build/components/text-input/text-input-props.d.ts +5 -0
- package/build/components/text-input/text-input-props.js +1 -0
- package/build/components/text-props.d.ts +24 -0
- package/build/components/text-props.js +6 -0
- package/build/components/touchable-native-feedback-props.d.ts +7 -0
- package/build/components/touchable-native-feedback-props.js +1 -0
- package/build/components/touchable-props.d.ts +17 -0
- package/build/components/touchable-props.js +1 -0
- package/build/components/touchable-without-feedback-props.d.ts +5 -0
- package/build/components/touchable-without-feedback-props.js +1 -0
- package/build/components/view-props.d.ts +29 -0
- package/build/components/view-props.js +5 -0
- package/build/components/virtualized-list/index.d.ts +3 -3
- package/build/components/virtualized-list/index.js +64 -46
- package/build/components/virtualized-section-list/index.d.ts +3 -3
- package/build/descriptor-to-vue.js +2 -2
- package/build/host-instance/index.js +2 -2
- package/build/index.d.ts +24 -27
- package/build/index.js +31 -16
- package/build/intrinsic-elements.d.ts +19 -0
- package/build/intrinsic-elements.js +1 -0
- package/build/jsx-runtime.d.ts +67 -0
- package/build/jsx-runtime.js +1 -0
- package/build/modules/animated/index.d.ts +41 -20
- package/build/modules/animated/index.js +20 -19
- package/build/modules/image/index.d.ts +3 -0
- package/build/modules/image/index.js +13 -0
- package/build/register.d.ts +1 -1
- package/build/register.js +13 -33
- package/build/renderer/index.js +108 -54
- package/build/runtime-helpers/index.d.ts +10 -1
- package/build/runtime-helpers/index.js +56 -22
- package/build/utils/normalize-attrs.js +3 -3
- package/intrinsic-tags.cjs +52 -0
- package/metro-vue-transformer.cjs +55 -345
- package/package.json +13 -9
- package/babel-lower-host-primitives.cjs +0 -225
- package/build/components/activity-indicator/index.android.d.ts +0 -4
- package/build/components/activity-indicator/index.android.js +0 -10
- package/build/components/activity-indicator/index.d.ts +0 -1
- package/build/components/activity-indicator/index.ios.d.ts +0 -4
- package/build/components/activity-indicator/index.ios.js +0 -10
- package/build/components/activity-indicator/index.js +0 -4
- package/build/components/activity-indicator/shared.d.ts +0 -8
- package/build/components/activity-indicator/shared.js +0 -48
- package/build/components/button.d.ts +0 -14
- package/build/components/button.js +0 -61
- package/build/components/image-background.d.ts +0 -9
- package/build/components/image-background.js +0 -103
- package/build/components/image.d.ts +0 -9
- package/build/components/image.js +0 -90
- package/build/components/input-accessory-view.js +0 -41
- package/build/components/pressable.d.ts +0 -58
- package/build/components/pressable.js +0 -233
- package/build/components/refresh-control.d.ts +0 -20
- package/build/components/refresh-control.js +0 -47
- package/build/components/safe-area-view.d.ts +0 -9
- package/build/components/safe-area-view.js +0 -33
- package/build/components/scroll-view/index.android.d.ts +0 -4
- package/build/components/scroll-view/index.android.js +0 -64
- package/build/components/scroll-view/index.d.ts +0 -1
- package/build/components/scroll-view/index.ios.d.ts +0 -4
- package/build/components/scroll-view/index.ios.js +0 -17
- package/build/components/scroll-view/index.js +0 -4
- package/build/components/scroll-view/shared.js +0 -271
- package/build/components/scroll-view/sticky-header.d.ts +0 -7
- package/build/components/scroll-view/sticky-header.js +0 -208
- package/build/components/switch/index.android.d.ts +0 -12
- package/build/components/switch/index.android.js +0 -13
- package/build/components/switch/index.d.ts +0 -2
- package/build/components/switch/index.ios.d.ts +0 -12
- package/build/components/switch/index.ios.js +0 -11
- package/build/components/switch/index.js +0 -5
- package/build/components/switch/shared.d.ts +0 -23
- package/build/components/switch/shared.js +0 -126
- package/build/components/text-input/index.d.ts +0 -24
- package/build/components/text-input/index.js +0 -260
- package/build/components/touchable-native-feedback.d.ts +0 -24
- package/build/components/touchable-native-feedback.js +0 -82
- package/build/components/touchable.d.ts +0 -50
- package/build/components/touchable.js +0 -281
- package/build/components.d.ts +0 -53
- package/build/components.js +0 -45
- package/build/composables/use-raw-attrs.d.ts +0 -1
- package/build/composables/use-raw-attrs.js +0 -26
- package/build/state-style.d.ts +0 -1
- package/build/state-style.js +0 -13
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
// Compile-time lowering of <View>/<Text> to the intrinsic tags the renderer maps to Fabric, for the
|
|
2
|
-
// TSX/JSX authoring path. The SFC twin is the nodeTransform in metro-vue-transformer.cjs — same
|
|
3
|
-
// rewrite, different vehicle, and until this existed TSX paid a tax SFC no longer did.
|
|
4
|
-
//
|
|
5
|
-
// WHY. Vue charges a full component instance even for a FUNCTIONAL component
|
|
6
|
-
// (createComponentInstance + initProps + initSlots + setupRenderEffect). View and Text are ~73% of
|
|
7
|
-
// the static tags in a real screen, so that is one instance per node on nearly three quarters of
|
|
8
|
-
// the tree. Lowered, they become plain element vnodes the renderer's nodeOps handle directly.
|
|
9
|
-
// Measured on the SFC path: 25-29% off all three create-shaped rows on device.
|
|
10
|
-
//
|
|
11
|
-
// Do NOT ship this plugin without also configuring @vue/babel-plugin-jsx's `isCustomElement` to
|
|
12
|
-
// answer true for `symbiote-*` — see ./babel-jsx.cjs, which is why the two are handed out together
|
|
13
|
-
// and should not be wired separately. Without it a lowered tag compiles to
|
|
14
|
-
// `createVNode(resolveComponent("symbiote-view"), …, {default: () => […]})`: a component that
|
|
15
|
-
// resolves to nothing, with slot children an element path would never mount.
|
|
16
|
-
//
|
|
17
|
-
// .cjs because Babel require()s it and this package is "type": "module".
|
|
18
|
-
|
|
19
|
-
const SOURCE = '@symbiote-native/vue';
|
|
20
|
-
|
|
21
|
-
// The tag map is the SHARED SPEC's, not this file's — four transforms each carried a copy before
|
|
22
|
-
// it existed and they had already drifted. Only `intrinsic` is read: Vue applies the `id` ->
|
|
23
|
-
// `nativeID` alias at RUNTIME (patchProp), because compile time reaches two of Vue's four paths to
|
|
24
|
-
// a node. See the spec's own `aliases` comment.
|
|
25
|
-
const {
|
|
26
|
-
HOST_PRIMITIVES,
|
|
27
|
-
} = require('@symbiote-native/components/host-primitives');
|
|
28
|
-
|
|
29
|
-
// A functional `style` keeps the RN idiom AND lowers, by being CALLED once per state at bag-build
|
|
30
|
-
// time instead of being handed to a component that calls it per press.
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
const LOWERABLE = new Map(
|
|
34
|
-
Object.entries(HOST_PRIMITIVES).map(([name, spec]) => [
|
|
35
|
-
name,
|
|
36
|
-
{
|
|
37
|
-
intrinsic: spec.intrinsic,
|
|
38
|
-
observesState: spec.observesState === true,
|
|
39
|
-
intrinsicWhen: spec.intrinsicWhen,
|
|
40
|
-
},
|
|
41
|
-
]),
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
// REFUSAL_CATEGORIES.dynamicIntrinsicChoice. A primitive whose spec entry carries `intrinsicWhen`
|
|
45
|
-
// picks between TWO Fabric views by the value of one prop, and the transform prints a STATIC tag
|
|
46
|
-
// name — so it can only choose when that value is a compile-time literal.
|
|
47
|
-
//
|
|
48
|
-
// This is not the unreadable-VALUE hazard wearing a new hat, and the difference decides how hard to
|
|
49
|
-
// refuse: an unreadable value lands a prop wrong, which a later write can still correct; the wrong
|
|
50
|
-
// choice here commits the wrong native view, and no prop write moves a node between views. So only
|
|
51
|
-
// the two provable shapes resolve and everything else keeps the component.
|
|
52
|
-
//
|
|
53
|
-
// `multiline="true"` — a STRING attribute — is deliberately NOT one of them, though the component
|
|
54
|
-
// would treat it as truthy. A string that reads as a boolean is the shape where an author and the
|
|
55
|
-
// runtime disagree most often (`multiline="false"` is truthy), and refusing costs only the
|
|
56
|
-
// optimisation while guessing costs the right view.
|
|
57
|
-
//
|
|
58
|
-
// Returns the tag to emit, or undefined to refuse.
|
|
59
|
-
function intrinsicWhenFor(openingElement, entry) {
|
|
60
|
-
const choice = entry.intrinsicWhen;
|
|
61
|
-
if (choice === undefined) return entry.intrinsic;
|
|
62
|
-
|
|
63
|
-
let resolved = false;
|
|
64
|
-
for (const attribute of openingElement.attributes) {
|
|
65
|
-
// A spread may carry the selector prop, and the transform cannot see inside it. Nothing else
|
|
66
|
-
// in this loop can tell that apart from "the prop is absent", so it must refuse outright.
|
|
67
|
-
if (attribute.type === 'JSXSpreadAttribute') return undefined;
|
|
68
|
-
if (attribute.type !== 'JSXAttribute') continue;
|
|
69
|
-
if (attribute.name.type !== 'JSXIdentifier') continue;
|
|
70
|
-
if (attribute.name.name !== choice.prop) continue;
|
|
71
|
-
|
|
72
|
-
// A bare `multiline` with no value is JSX for `true`.
|
|
73
|
-
if (attribute.value === null || attribute.value === undefined) {
|
|
74
|
-
resolved = true;
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
if (attribute.value.type !== 'JSXExpressionContainer') return undefined;
|
|
78
|
-
const expression = attribute.value.expression;
|
|
79
|
-
if (expression.type !== 'BooleanLiteral') return undefined;
|
|
80
|
-
resolved = expression.value;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return resolved ? choice.intrinsic : entry.intrinsic;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// The shared spec's allow-list for `stateInTemplate`, spelled the same in all five transforms:
|
|
87
|
-
// only a provably inert value shape lowers. `style={styleFn}` is an Identifier at compile time and
|
|
88
|
-
// no transform can tell an object from a function, so anything that is not one of these refuses. A
|
|
89
|
-
// narrow "refuse a function literal" reading passes every obvious test and then fails on the one
|
|
90
|
-
// call site that hoists its style into a variable — which is what ActionButton does.
|
|
91
|
-
const INERT_VALUE_TYPES = new Set([
|
|
92
|
-
'ObjectExpression',
|
|
93
|
-
'ArrayExpression',
|
|
94
|
-
'StringLiteral',
|
|
95
|
-
'NumericLiteral',
|
|
96
|
-
'BooleanLiteral',
|
|
97
|
-
'NullLiteral',
|
|
98
|
-
'TemplateLiteral',
|
|
99
|
-
]);
|
|
100
|
-
|
|
101
|
-
// A bare `style="x"` attribute value is a JSXText-ish literal and inert; `style={…}` is inert only
|
|
102
|
-
// when the expression inside is.
|
|
103
|
-
function isInertValueAttribute(value) {
|
|
104
|
-
if (value === null || value === undefined) return true;
|
|
105
|
-
if (value.type !== 'JSXExpressionContainer')
|
|
106
|
-
return INERT_VALUE_TYPES.has(value.type);
|
|
107
|
-
return INERT_VALUE_TYPES.has(value.expression.type);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// The JSX twin of metro-vue-transformer.cjs's refusesLowering — same three categories, different
|
|
111
|
-
// AST. A primitive that owns state can lower only when the template does not read that state,
|
|
112
|
-
// because a lowered element has no instance to read it from. Refusing is always safe; lowering a
|
|
113
|
-
// button that reads `pressed` gives a button that renders and does not respond, on device, with
|
|
114
|
-
// nothing red.
|
|
115
|
-
function refusesLowering(openingElement, children, types) {
|
|
116
|
-
for (const attribute of openingElement.attributes) {
|
|
117
|
-
// `{...props}` — an attribute set this pass cannot enumerate, so it may hide a functional
|
|
118
|
-
// `style`. REFUSAL_CATEGORIES.unreadableAttributeSet.
|
|
119
|
-
if (attribute.type === 'JSXSpreadAttribute') return true;
|
|
120
|
-
if (attribute.type !== 'JSXAttribute') continue;
|
|
121
|
-
if (attribute.name.type !== 'JSXIdentifier') continue;
|
|
122
|
-
|
|
123
|
-
// REFUSAL_CATEGORIES.instanceBoundDirective. `ref` on a COMPONENT yields the component
|
|
124
|
-
// instance; on an element it yields the host node. Lowering silently changes which one the app
|
|
125
|
-
// receives, so a `pressableRef.value.measure()` starts reaching a different object — a runtime
|
|
126
|
-
// failure with nothing red at build time. Found by the shared verdict table, not by a Vue test.
|
|
127
|
-
if (attribute.name.name === 'ref') return true;
|
|
128
|
-
|
|
129
|
-
if (attribute.name.name !== 'style') continue;
|
|
130
|
-
|
|
131
|
-
// REFUSAL_CATEGORIES.stateInTemplate no longer fires on a `style` at all. Every shape is
|
|
132
|
-
// covered: an inert value rides through, and anything else is either called directly or handed
|
|
133
|
-
// to the runtime helper, which decides with a `typeof` what no compile-time analysis could.
|
|
134
|
-
// What still refuses is above (an unreadable attribute set) and below (a child reading state).
|
|
135
|
-
if (!isInertValueAttribute(attribute.value)) continue;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// A function child that TAKES an argument is the render-prop form, i.e. children as a function
|
|
139
|
-
// of press state. A zero-arity function child is an ordinary lazy child and lowers fine — the
|
|
140
|
-
// distinction the shared spec spells out for renderPropChild.
|
|
141
|
-
return children.some(child => {
|
|
142
|
-
if (child.type !== 'JSXExpressionContainer') return false;
|
|
143
|
-
const { expression } = child;
|
|
144
|
-
return (
|
|
145
|
-
(expression.type === 'ArrowFunctionExpression' ||
|
|
146
|
-
expression.type === 'FunctionExpression') &&
|
|
147
|
-
expression.params.length >= 1
|
|
148
|
-
);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Every local name bound to a lowerable export of @symbiote-native/vue in THIS file, honouring
|
|
153
|
-
// `import { View as Box }`. Matching bare tag names instead would rewrite an app's own <View>.
|
|
154
|
-
function lowerableLocalNames(programPath) {
|
|
155
|
-
const names = new Map();
|
|
156
|
-
programPath.node.body.forEach(statement => {
|
|
157
|
-
if (
|
|
158
|
-
statement.type !== 'ImportDeclaration' ||
|
|
159
|
-
statement.source.value !== SOURCE
|
|
160
|
-
)
|
|
161
|
-
return;
|
|
162
|
-
statement.specifiers.forEach(specifier => {
|
|
163
|
-
if (specifier.type !== 'ImportSpecifier') return;
|
|
164
|
-
const imported =
|
|
165
|
-
specifier.imported.type === 'Identifier'
|
|
166
|
-
? specifier.imported.name
|
|
167
|
-
: specifier.imported.value;
|
|
168
|
-
const entry = LOWERABLE.get(imported);
|
|
169
|
-
if (entry !== undefined) names.set(specifier.local.name, entry);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
return names;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Refusals apply ONLY to a primitive that owns state. View and Text still lower unconditionally,
|
|
176
|
-
// and that remains deliberate: their only folds are kebab->camel and RN's Text defaults, both of
|
|
177
|
-
// which moved into the renderer (normalizeVueAttrKey in patchProp, seedTextDefaults/textDefaultFor
|
|
178
|
-
// in createElement) when the SFC lowering landed, so nothing a spread could hide is left. Adding a
|
|
179
|
-
// refusal for them would make TSX diverge from SFC, which lowers them unconditionally too.
|
|
180
|
-
module.exports = function lowerHostPrimitives({ types }) {
|
|
181
|
-
return {
|
|
182
|
-
name: 'symbiote-vue-lower-host-primitives',
|
|
183
|
-
visitor: {
|
|
184
|
-
Program(programPath) {
|
|
185
|
-
const names = lowerableLocalNames(programPath);
|
|
186
|
-
if (names.size === 0) return;
|
|
187
|
-
programPath.traverse({
|
|
188
|
-
JSXElement(elementPath) {
|
|
189
|
-
const { openingElement, closingElement } = elementPath.node;
|
|
190
|
-
const tag = openingElement.name;
|
|
191
|
-
if (tag.type !== 'JSXIdentifier') return;
|
|
192
|
-
const entry = names.get(tag.name);
|
|
193
|
-
if (entry === undefined) return;
|
|
194
|
-
// Resolved BEFORE the state refusal and outside its `observesState` gate: the two
|
|
195
|
-
// guard different things, and this one applies to a primitive that owns no state at
|
|
196
|
-
// all. Reading it as "another case for refusesLowering" would put it behind that flag
|
|
197
|
-
// and it would never run for TextInput.
|
|
198
|
-
const intrinsic = intrinsicWhenFor(openingElement, entry);
|
|
199
|
-
if (intrinsic === undefined) return;
|
|
200
|
-
if (
|
|
201
|
-
entry.observesState &&
|
|
202
|
-
refusesLowering(openingElement, elementPath.node.children, types)
|
|
203
|
-
)
|
|
204
|
-
return;
|
|
205
|
-
// A shadowing local binding (a parameter, or a `const View = …` in scope) is NOT our
|
|
206
|
-
// import even though the name matches. Only rewrite where the binding at this use site
|
|
207
|
-
// is still the module-level import.
|
|
208
|
-
const binding = elementPath.scope.getBinding(tag.name);
|
|
209
|
-
if (binding === undefined || binding.kind !== 'module') return;
|
|
210
|
-
// NO state-style expansion. A functional `style` reaches `routeProp` untouched and
|
|
211
|
-
// the engine resolves it at both values of `pressed` (`isStyleCallback`), so rewriting
|
|
212
|
-
// the attribute into a pair here would be this transform carrying BEHAVIOUR — what
|
|
213
|
-
// `tests/lowering-transform-carries-no-behaviour.test.ts` exists to keep out. Removed
|
|
214
|
-
// from BOTH Vue paths in one change: the SFC twin sees an expression as source text
|
|
215
|
-
// where this one has the AST, so a split removed from one and not the other is the
|
|
216
|
-
// exact drift `.claude/rules/adapter-parity-audit.md` records for this pair.
|
|
217
|
-
openingElement.name = types.jsxIdentifier(intrinsic);
|
|
218
|
-
if (closingElement)
|
|
219
|
-
closingElement.name = types.jsxIdentifier(intrinsic);
|
|
220
|
-
},
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
};
|
|
225
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type { IActivityIndicatorProps } from './shared';
|
|
2
|
-
export declare const ActivityIndicator: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// ActivityIndicator on Android: AndroidProgressBar needs `styleAttr` (it drives the
|
|
2
|
-
// ProgressBar's setStyle(); without it the view throws "setStyle() not called") and
|
|
3
|
-
// `indeterminate: true`, and its default color is the theme (null). Metro picks this on an
|
|
4
|
-
// Android host; no Platform.OS read. Mirrors the React adapter's Android binding.
|
|
5
|
-
import { createActivityIndicator } from './shared.js';
|
|
6
|
-
export const ActivityIndicator = createActivityIndicator({
|
|
7
|
-
// RN: `color = Platform.OS === 'ios' ? GRAY : null`. Android lets the theme color it.
|
|
8
|
-
defaultColor: null,
|
|
9
|
-
nativeExtras: { styleAttr: 'Normal', indeterminate: true },
|
|
10
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './index.ios';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type { IActivityIndicatorProps } from './shared';
|
|
2
|
-
export declare const ActivityIndicator: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// ActivityIndicator on iOS: RCTActivityIndicatorView takes the size enum + a GRAY default
|
|
2
|
-
// color and no extra native props. Also the base (activity-indicator.ts re-exports it) for
|
|
3
|
-
// headless / web. Mirrors the React adapter's iOS binding.
|
|
4
|
-
import { createActivityIndicator } from './shared.js';
|
|
5
|
-
// RN's iOS default spinner color (Libraries/.../ActivityIndicator.js GRAY).
|
|
6
|
-
const IOS_DEFAULT_COLOR = '#999999';
|
|
7
|
-
export const ActivityIndicator = createActivityIndicator({
|
|
8
|
-
defaultColor: IOS_DEFAULT_COLOR,
|
|
9
|
-
nativeExtras: {},
|
|
10
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// Base / default ActivityIndicator. Re-exports the iOS build. Metro overrides this with
|
|
2
|
-
// activity-indicator.ios.ts / .android.ts on a real host; under tsx / tsc / web the host
|
|
3
|
-
// resolves here. Filename is the selector, no Platform.OS read.
|
|
4
|
-
export * from './index.ios.js';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { IActivityIndicatorPlatform, IActivityIndicatorProps as IActivityIndicatorBaseProps } from '@symbiote-native/components';
|
|
2
|
-
import type { IClassNameValue } from '@symbiote-native/engine';
|
|
3
|
-
export type IActivityIndicatorProps = IActivityIndicatorBaseProps & {
|
|
4
|
-
class?: IClassNameValue;
|
|
5
|
-
};
|
|
6
|
-
export declare function createActivityIndicator(platform: IActivityIndicatorPlatform): import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// ActivityIndicator, the Vue lifecycle half. The render (size translation, wrapper +
|
|
2
|
-
// spinner, color omission) lives framework-agnostic in @symbiote-native/components and is shared
|
|
3
|
-
// verbatim with the React adapter; here Vue only normalizes inputs, calls the render fn,
|
|
4
|
-
// and bridges the Descriptor to a vnode. No reactivity of its own; this component is
|
|
5
|
-
// render-only (the spinner animates natively).
|
|
6
|
-
//
|
|
7
|
-
// Inputs arrive as attrs, not a typed props block, the same passthrough shape as
|
|
8
|
-
// components.ts. RN's per-platform bits (iOS GRAY default; Android theme/null + styleAttr +
|
|
9
|
-
// indeterminate) are supplied by the .ios/.android files via `IActivityIndicatorPlatform`.
|
|
10
|
-
import { defineComponent } from '@vue/runtime-core';
|
|
11
|
-
import { renderActivityIndicator } from '@symbiote-native/components';
|
|
12
|
-
import { descriptorToVue } from '../../descriptor-to-vue.js';
|
|
13
|
-
import { normalizeVueAttrs } from '../../utils/normalize-attrs.js';
|
|
14
|
-
function normalizeSize(size) {
|
|
15
|
-
if (size === 'large')
|
|
16
|
-
return 'large';
|
|
17
|
-
if (typeof size === 'number')
|
|
18
|
-
return size;
|
|
19
|
-
return 'small';
|
|
20
|
-
}
|
|
21
|
-
// Narrow attrs.style to a plain ViewStyle object (assignable to the render fn's StyleProp
|
|
22
|
-
// param) without a cast. Array/registered styles degrade to undefined; the engine's own
|
|
23
|
-
// flatten handles those when an app passes them; the wrapper only needs the object form.
|
|
24
|
-
function isViewStyleObject(value) {
|
|
25
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
26
|
-
}
|
|
27
|
-
export function createActivityIndicator(platform) {
|
|
28
|
-
return defineComponent({
|
|
29
|
-
name: 'ActivityIndicator',
|
|
30
|
-
inheritAttrs: false,
|
|
31
|
-
setup(_props, { attrs: rawAttrs }) {
|
|
32
|
-
return () => {
|
|
33
|
-
// Defaults match RN (animating / hidesWhenStopped true, size 'small'); the rest of
|
|
34
|
-
// attrs (testID, accessibility, onLayout) forwards onto the wrapper via passthrough.
|
|
35
|
-
const attrs = normalizeVueAttrs(rawAttrs);
|
|
36
|
-
const { animating, color, hidesWhenStopped, size, style, ...passthrough } = attrs;
|
|
37
|
-
return descriptorToVue(renderActivityIndicator({
|
|
38
|
-
animating: animating !== false,
|
|
39
|
-
hidesWhenStopped: hidesWhenStopped !== false,
|
|
40
|
-
size: normalizeSize(size),
|
|
41
|
-
color: typeof color === 'string' ? color : undefined,
|
|
42
|
-
style: isViewStyleObject(style) ? style : undefined,
|
|
43
|
-
passthrough,
|
|
44
|
-
}, platform));
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type IButtonProps as ICoreButtonProps } from '@symbiote-native/components';
|
|
2
|
-
import type { IClassNameValue, ISymbioteEvent } from '@symbiote-native/engine';
|
|
3
|
-
export type IButtonProps = Omit<ICoreButtonProps, 'onPress'> & {
|
|
4
|
-
class?: IClassNameValue;
|
|
5
|
-
};
|
|
6
|
-
type IButtonEmits = {
|
|
7
|
-
press: (event: ISymbioteEvent) => boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare const Button: import("vue").DefineSetupFnComponent<IButtonProps, IButtonEmits, {}, Omit<ICoreButtonProps, "onPress"> & {
|
|
10
|
-
class?: IClassNameValue;
|
|
11
|
-
} & {
|
|
12
|
-
onPress?: ((event: ISymbioteEvent) => any) | undefined;
|
|
13
|
-
}, import("vue").PublicProps>;
|
|
14
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Button for Vue. The minimal cross-platform button in RN's iOS shape (Button.js): a
|
|
2
|
-
// TouchableOpacity wrapping a Text. The base text style, the role constant, and the color fold are
|
|
3
|
-
// shared in @symbiote-native/components/view; here Vue only composes its TouchableOpacity + Text and
|
|
4
|
-
// forwards the native-only props. The Vue twin of the React adapter's Button.
|
|
5
|
-
import { defineComponent, h } from '@vue/runtime-core';
|
|
6
|
-
import { BUTTON_ACCESSIBILITY_ROLE, resolveButtonTextStyle, } from '@symbiote-native/components';
|
|
7
|
-
import { HOST_TEXT } from '../components.js';
|
|
8
|
-
import { TouchableOpacity } from './touchable.js';
|
|
9
|
-
import { normalizeVueAttrs } from '../utils/normalize-attrs.js';
|
|
10
|
-
// The props Button consumes / re-maps itself; everything else (accessibility, aria, TV-focus,
|
|
11
|
-
// testID, nativeID) forwards to the TouchableOpacity. `title` becomes the Text child; onPress and
|
|
12
|
-
// disabled re-map; touchSoundDisabled maps to the pressable's android_disableSound.
|
|
13
|
-
const HANDLED = [
|
|
14
|
-
'title',
|
|
15
|
-
'color',
|
|
16
|
-
'touchSoundDisabled',
|
|
17
|
-
'accessibilityRole',
|
|
18
|
-
'accessible',
|
|
19
|
-
'accessibilityState',
|
|
20
|
-
];
|
|
21
|
-
function forwardAttrs(attrs) {
|
|
22
|
-
const result = {};
|
|
23
|
-
for (const key of Object.keys(attrs)) {
|
|
24
|
-
if (!HANDLED.includes(key))
|
|
25
|
-
result[key] = attrs[key];
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
export const Button = defineComponent((_props, { attrs: rawAttrs, emit }) => {
|
|
30
|
-
return () => {
|
|
31
|
-
const attrs = normalizeVueAttrs(rawAttrs);
|
|
32
|
-
const title = typeof attrs.title === 'string' ? attrs.title : '';
|
|
33
|
-
const color = typeof attrs.color === 'string' ? attrs.color : undefined;
|
|
34
|
-
const disabled = attrs.disabled === true ? true : undefined;
|
|
35
|
-
const touchSoundDisabled = attrs.touchSoundDisabled === true ? true : undefined;
|
|
36
|
-
const textStyle = resolveButtonTextStyle(color, disabled);
|
|
37
|
-
// RN's Button sets role=button, is accessible, and propagates the disabled accessibility
|
|
38
|
-
// state. The caller's props pass through, but Button's fixed role / accessible / disabled-
|
|
39
|
-
// state win, applied after the forwarded spread. touchSoundDisabled → android_disableSound.
|
|
40
|
-
const touchableProps = {
|
|
41
|
-
...forwardAttrs(attrs),
|
|
42
|
-
disabled,
|
|
43
|
-
android_disableSound: touchSoundDisabled,
|
|
44
|
-
accessibilityRole: BUTTON_ACCESSIBILITY_ROLE,
|
|
45
|
-
accessible: true,
|
|
46
|
-
accessibilityState: { disabled },
|
|
47
|
-
onPress: (event) => emit('press', event),
|
|
48
|
-
};
|
|
49
|
-
return h(TouchableOpacity, touchableProps, {
|
|
50
|
-
// The intrinsic tag, not our <Text> component — see the note at HOST_VIEW. RN's Text
|
|
51
|
-
// defaults are seeded by the renderer for a bare tag (seedTextDefaults).
|
|
52
|
-
default: () => [h(HOST_TEXT, { style: textStyle }, title)],
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
}, {
|
|
56
|
-
name: 'Button',
|
|
57
|
-
inheritAttrs: false,
|
|
58
|
-
emits: {
|
|
59
|
-
press: (_event) => true,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type FunctionalComponent } from '@vue/runtime-core';
|
|
2
|
-
import { type IImageProps } from '@symbiote-native/components';
|
|
3
|
-
import { type IClassNameValue, type IStyleProp, type IViewStyle } from '@symbiote-native/engine';
|
|
4
|
-
export interface IImageBackgroundProps extends Omit<IImageProps, 'style'> {
|
|
5
|
-
style?: IStyleProp<IViewStyle>;
|
|
6
|
-
imageStyle?: IStyleProp<IViewStyle> | string;
|
|
7
|
-
class?: IClassNameValue;
|
|
8
|
-
}
|
|
9
|
-
export declare const ImageBackground: FunctionalComponent<{}, {}, any, {}>;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
// ImageBackground: the Vue lifecycle half. The composition (the absolute-fill Image behind the
|
|
2
|
-
// children, the dimension-proxy + style-merge math) lives framework-agnostic in
|
|
3
|
-
// @symbiote-native/components/renderImageBackground, shared verbatim with React; Vue narrows the
|
|
4
|
-
// untyped attrs into the typed Image view, folds aria/role, bridges the Descriptor to vnodes, and
|
|
5
|
-
// appends the slot children ON TOP of the inner image.
|
|
6
|
-
//
|
|
7
|
-
// FUNCTIONAL, not a stateful defineComponent: render-only, no state.
|
|
8
|
-
import { h } from '@vue/runtime-core';
|
|
9
|
-
import { renderImageBackground, resolveAccessibilityProps, } from '@symbiote-native/components';
|
|
10
|
-
import { resolveClassName, } from '@symbiote-native/engine';
|
|
11
|
-
import { descriptorToVue } from '../descriptor-to-vue.js';
|
|
12
|
-
import { normalizeVueAttrs } from '../utils/normalize-attrs.js';
|
|
13
|
-
function asString(value) {
|
|
14
|
-
return typeof value === 'string' ? value : undefined;
|
|
15
|
-
}
|
|
16
|
-
function asNumber(value) {
|
|
17
|
-
return typeof value === 'number' ? value : undefined;
|
|
18
|
-
}
|
|
19
|
-
function asSource(value) {
|
|
20
|
-
if (typeof value === 'number')
|
|
21
|
-
return value;
|
|
22
|
-
if (typeof value === 'object' && value !== null)
|
|
23
|
-
return value;
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
function isResizeMode(value) {
|
|
27
|
-
return (value === 'cover' ||
|
|
28
|
-
value === 'contain' ||
|
|
29
|
-
value === 'stretch' ||
|
|
30
|
-
value === 'repeat' ||
|
|
31
|
-
value === 'center');
|
|
32
|
-
}
|
|
33
|
-
function asResizeMode(value) {
|
|
34
|
-
return isResizeMode(value) ? value : undefined;
|
|
35
|
-
}
|
|
36
|
-
function asCrossOrigin(value) {
|
|
37
|
-
return value === 'anonymous' || value === 'use-credentials'
|
|
38
|
-
? value
|
|
39
|
-
: undefined;
|
|
40
|
-
}
|
|
41
|
-
function isStyleProp(value) {
|
|
42
|
-
return typeof value === 'object' && value !== null;
|
|
43
|
-
}
|
|
44
|
-
function toChildVNode(child) {
|
|
45
|
-
return typeof child === 'string' ? child : descriptorToVue(child);
|
|
46
|
-
}
|
|
47
|
-
const HANDLED_ATTRS = [
|
|
48
|
-
'style',
|
|
49
|
-
'imageStyle',
|
|
50
|
-
'class',
|
|
51
|
-
'source',
|
|
52
|
-
'defaultSource',
|
|
53
|
-
'loadingIndicatorSource',
|
|
54
|
-
'resizeMode',
|
|
55
|
-
'tintColor',
|
|
56
|
-
'src',
|
|
57
|
-
'srcSet',
|
|
58
|
-
'alt',
|
|
59
|
-
'width',
|
|
60
|
-
'height',
|
|
61
|
-
'crossOrigin',
|
|
62
|
-
'referrerPolicy',
|
|
63
|
-
];
|
|
64
|
-
function forwardAttrs(attrs) {
|
|
65
|
-
const result = {};
|
|
66
|
-
for (const key of Object.keys(attrs)) {
|
|
67
|
-
if (!HANDLED_ATTRS.includes(key))
|
|
68
|
-
result[key] = attrs[key];
|
|
69
|
-
}
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
const ImageBackgroundComponent = (_props, { attrs: rawAttrs, slots }) => {
|
|
73
|
-
const attrs = normalizeVueAttrs(rawAttrs);
|
|
74
|
-
const wrapper = renderImageBackground({
|
|
75
|
-
style: isStyleProp(attrs.style) ? attrs.style : undefined,
|
|
76
|
-
imageStyle: typeof attrs.imageStyle === 'string'
|
|
77
|
-
? resolveClassName(attrs.imageStyle)
|
|
78
|
-
: isStyleProp(attrs.imageStyle)
|
|
79
|
-
? attrs.imageStyle
|
|
80
|
-
: undefined,
|
|
81
|
-
image: {
|
|
82
|
-
source: asSource(attrs.source),
|
|
83
|
-
defaultSource: asSource(attrs.defaultSource),
|
|
84
|
-
loadingIndicatorSource: asSource(attrs.loadingIndicatorSource),
|
|
85
|
-
resizeMode: asResizeMode(attrs.resizeMode),
|
|
86
|
-
tintColor: asString(attrs.tintColor),
|
|
87
|
-
src: asString(attrs.src),
|
|
88
|
-
srcSet: asString(attrs.srcSet),
|
|
89
|
-
alt: asString(attrs.alt),
|
|
90
|
-
width: asNumber(attrs.width),
|
|
91
|
-
height: asNumber(attrs.height),
|
|
92
|
-
crossOrigin: asCrossOrigin(attrs.crossOrigin),
|
|
93
|
-
referrerPolicy: asString(attrs.referrerPolicy),
|
|
94
|
-
passthrough: resolveAccessibilityProps(forwardAttrs(attrs)),
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
// wrapper = symbiote-view > [imageDescriptor]; the slot children paint AFTER the image (on top).
|
|
98
|
-
const slotChildren = slots.default !== undefined ? slots.default() : [];
|
|
99
|
-
return h(wrapper.type, { ...wrapper.props, key: wrapper.key, class: attrs.class }, [...wrapper.children.map(toChildVNode), ...slotChildren]);
|
|
100
|
-
};
|
|
101
|
-
ImageBackgroundComponent.displayName = 'ImageBackground';
|
|
102
|
-
ImageBackgroundComponent.inheritAttrs = false;
|
|
103
|
-
export const ImageBackground = ImageBackgroundComponent;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { FunctionalComponent } from '@vue/runtime-core';
|
|
2
|
-
import { type IImageProps as IImageBaseProps, type IImageStatics } from '@symbiote-native/components';
|
|
3
|
-
import type { IClassNameValue } from '@symbiote-native/engine';
|
|
4
|
-
export { setImageSourceResolver } from '@symbiote-native/components';
|
|
5
|
-
export type { IImageSource, IImageSourceProp, IResizeMode, IImageSize, IImageCacheStatus, } from '@symbiote-native/components';
|
|
6
|
-
export type IImageProps = IImageBaseProps & {
|
|
7
|
-
class?: IClassNameValue;
|
|
8
|
-
};
|
|
9
|
-
export declare const Image: FunctionalComponent<IImageProps> & IImageStatics;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// Image: the Vue lifecycle half. The full fold (source/src/srcSet resolution, width/height ->
|
|
2
|
-
// style fold, resizeMode/tintColor, alt -> accessibility, and the native source array) lives
|
|
3
|
-
// framework-agnostic in @symbiote-native/components, shared verbatim with React; Vue narrows the
|
|
4
|
-
// untyped attrs into renderImage's typed view, folds aria/role, bridges the Descriptor to a
|
|
5
|
-
// vnode, and carries the Image statics (getSize/prefetch/queryCache/...).
|
|
6
|
-
//
|
|
7
|
-
// FUNCTIONAL, not a stateful defineComponent: Animated.Image wraps it via createAnimatedComponent,
|
|
8
|
-
// which captures the host node through a ref that only falls through on a functional component
|
|
9
|
-
// (a defineComponent's ref resolves to a useless component proxy; see components.ts).
|
|
10
|
-
import { imageStatics, renderImage, resolveAccessibilityProps, } from '@symbiote-native/components';
|
|
11
|
-
import { descriptorToVue } from '../descriptor-to-vue.js';
|
|
12
|
-
import { normalizeVueAttrs } from '../utils/normalize-attrs.js';
|
|
13
|
-
export { setImageSourceResolver } from '@symbiote-native/components';
|
|
14
|
-
function asString(value) {
|
|
15
|
-
return typeof value === 'string' ? value : undefined;
|
|
16
|
-
}
|
|
17
|
-
function asNumber(value) {
|
|
18
|
-
return typeof value === 'number' ? value : undefined;
|
|
19
|
-
}
|
|
20
|
-
function asSource(value) {
|
|
21
|
-
if (typeof value === 'number')
|
|
22
|
-
return value;
|
|
23
|
-
if (typeof value === 'object' && value !== null)
|
|
24
|
-
return value;
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
function isResizeMode(value) {
|
|
28
|
-
return (value === 'cover' ||
|
|
29
|
-
value === 'contain' ||
|
|
30
|
-
value === 'stretch' ||
|
|
31
|
-
value === 'repeat' ||
|
|
32
|
-
value === 'center');
|
|
33
|
-
}
|
|
34
|
-
function asResizeMode(value) {
|
|
35
|
-
return isResizeMode(value) ? value : undefined;
|
|
36
|
-
}
|
|
37
|
-
function asCrossOrigin(value) {
|
|
38
|
-
return value === 'anonymous' || value === 'use-credentials'
|
|
39
|
-
? value
|
|
40
|
-
: undefined;
|
|
41
|
-
}
|
|
42
|
-
function isStyleProp(value) {
|
|
43
|
-
return typeof value === 'object' && value !== null;
|
|
44
|
-
}
|
|
45
|
-
const HANDLED_ATTRS = [
|
|
46
|
-
'source',
|
|
47
|
-
'defaultSource',
|
|
48
|
-
'loadingIndicatorSource',
|
|
49
|
-
'style',
|
|
50
|
-
'resizeMode',
|
|
51
|
-
'tintColor',
|
|
52
|
-
'src',
|
|
53
|
-
'srcSet',
|
|
54
|
-
'alt',
|
|
55
|
-
'width',
|
|
56
|
-
'height',
|
|
57
|
-
'crossOrigin',
|
|
58
|
-
'referrerPolicy',
|
|
59
|
-
];
|
|
60
|
-
function forwardAttrs(attrs) {
|
|
61
|
-
const result = {};
|
|
62
|
-
for (const key of Object.keys(attrs)) {
|
|
63
|
-
if (!HANDLED_ATTRS.includes(key))
|
|
64
|
-
result[key] = attrs[key];
|
|
65
|
-
}
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
const ImageComponent = (_props, { attrs: rawAttrs }) => {
|
|
69
|
-
const attrs = normalizeVueAttrs(rawAttrs);
|
|
70
|
-
return descriptorToVue(renderImage({
|
|
71
|
-
source: asSource(attrs.source),
|
|
72
|
-
defaultSource: asSource(attrs.defaultSource),
|
|
73
|
-
loadingIndicatorSource: asSource(attrs.loadingIndicatorSource),
|
|
74
|
-
style: isStyleProp(attrs.style) ? attrs.style : undefined,
|
|
75
|
-
resizeMode: asResizeMode(attrs.resizeMode),
|
|
76
|
-
tintColor: asString(attrs.tintColor),
|
|
77
|
-
src: asString(attrs.src),
|
|
78
|
-
srcSet: asString(attrs.srcSet),
|
|
79
|
-
alt: asString(attrs.alt),
|
|
80
|
-
width: asNumber(attrs.width),
|
|
81
|
-
height: asNumber(attrs.height),
|
|
82
|
-
crossOrigin: asCrossOrigin(attrs.crossOrigin),
|
|
83
|
-
referrerPolicy: asString(attrs.referrerPolicy),
|
|
84
|
-
passthrough: resolveAccessibilityProps(forwardAttrs(attrs)),
|
|
85
|
-
}));
|
|
86
|
-
};
|
|
87
|
-
ImageComponent.displayName = 'Image';
|
|
88
|
-
ImageComponent.inheritAttrs = false;
|
|
89
|
-
// Statics attached like RN (Image.getSize/prefetch/...), shared verbatim with React.
|
|
90
|
-
export const Image = Object.assign(ImageComponent, imageStatics);
|