@symbiote-native/vue 3.0.2 → 3.0.3
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 +72 -28
- package/build/renderer/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -20,20 +20,79 @@ mutation-oriented framework driving the already-validated engine.
|
|
|
20
20
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
23
|
+
```bash
|
|
24
|
+
npx @symbiote-native/cli new my-app --framework vue --vue-flavor sfc # or --vue-flavor tsx
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
One command, nothing to wire by hand: scaffolds the Metro config (the SFC transformer, or the TSX
|
|
28
|
+
Babel plugin below), the entry seam below, and `@symbiote-native/vue`/`react-native`/`vue` as your
|
|
29
|
+
app's own dependencies.
|
|
30
|
+
|
|
31
|
+
<details>
|
|
32
|
+
<summary>Manual install (no generator — an existing app, or you want to wire it yourself)</summary>
|
|
33
|
+
|
|
23
34
|
```bash
|
|
24
35
|
npm install @symbiote-native/vue react-native vue
|
|
25
36
|
```
|
|
26
37
|
|
|
27
38
|
`react-native` and `vue` stay your app's own top-level dependencies — this package only replaces
|
|
28
|
-
the JS renderer that drives them. **
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
the JS renderer that drives them. **SFC** additionally needs a Metro transformer for `.vue` files
|
|
40
|
+
— see [`examples/vue-sfc`](../../examples/vue-sfc)'s `metro.config.js`.
|
|
41
|
+
|
|
42
|
+
**TSX** needs one more Babel plugin beyond the install above, or a dev-mode Vue warning can crash
|
|
43
|
+
the mount to a blank screen. RN's dev React-JSX transform tags every `JSXElement` with `__self`/
|
|
44
|
+
`__source` (inert under React); `@vue/babel-plugin-jsx` copies them verbatim into the vnode's
|
|
45
|
+
props, and at module scope `__self`'s `this` is the Hermes global `HostObject` — the first Vue dev
|
|
46
|
+
warning that formats that prop for a component trace throws reading `Symbol.toStringTag` off it,
|
|
47
|
+
unwinding the whole mount. Strip both attributes on `JSXOpeningElement` exit, after Babel's
|
|
48
|
+
`__self`/`__source` plugins add them but before `@vue/babel-plugin-jsx` reads them (see
|
|
49
|
+
[`examples/vue-tsx`](../../examples/vue-tsx)'s `babel.config.js`, `stripReactJsxDevAttrs`) — SFC
|
|
50
|
+
doesn't need this, since its compiler never sees RN's React-JSX transform at all.
|
|
51
|
+
|
|
52
|
+
</details>
|
|
32
53
|
|
|
33
54
|
---
|
|
34
55
|
|
|
35
56
|
## Use it
|
|
36
57
|
|
|
58
|
+
The app is ordinary Vue. The primitives are TAGS — `<view>`, `<text>`, `<pressable>` — so there is
|
|
59
|
+
nothing to import for them at all; both Vue compilers resolve them as elements and the renderer
|
|
60
|
+
maps each to its Fabric view. Styling is a CSS class (a plain `.css` file in TSX, an SFC's own
|
|
61
|
+
`<style>` block otherwise) — the convention every example app here follows. A tap→increment
|
|
62
|
+
counter, authored in TSX:
|
|
63
|
+
|
|
64
|
+
```jsx
|
|
65
|
+
import { ref } from '@vue/runtime-core';
|
|
66
|
+
import './App.css';
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
setup() {
|
|
70
|
+
const count = ref(0);
|
|
71
|
+
return () => (
|
|
72
|
+
<safe-area-view class="screen">
|
|
73
|
+
<text>Taps: {count.value}</text>
|
|
74
|
+
<pressable onPress={() => count.value++}>
|
|
75
|
+
<text>Tap me</text>
|
|
76
|
+
</pressable>
|
|
77
|
+
</safe-area-view>
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
/* App.css */
|
|
85
|
+
.screen {
|
|
86
|
+
flex: 1;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
padding: 24px;
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
<details>
|
|
94
|
+
<summary>Native entry point (index.js) — already scaffolded by <code>npx @symbiote-native/cli new --framework vue</code></summary>
|
|
95
|
+
|
|
37
96
|
The zero-config entry mirrors real Vue's own `createApp(App).mount(...)` idiom and wires the same
|
|
38
97
|
RN-backed host seams React's `registerApp` does — this is what
|
|
39
98
|
[`examples/vue-tsx`](../../examples/vue-tsx) and [`examples/vue-sfc`](../../examples/vue-sfc)
|
|
@@ -41,6 +100,11 @@ actually use:
|
|
|
41
100
|
|
|
42
101
|
```js
|
|
43
102
|
// index.js
|
|
103
|
+
|
|
104
|
+
// Registers host behaviors (Image, Pressable, Switch, ...) that /bootstrap alone doesn't
|
|
105
|
+
// reach; deleting this breaks them silently (Metro's production inlineRequires makes a
|
|
106
|
+
// side-effect-only barrel import go lazy, see register.ts).
|
|
107
|
+
import '@symbiote-native/vue';
|
|
44
108
|
import { createApp } from '@symbiote-native/vue/bootstrap';
|
|
45
109
|
import App from './App';
|
|
46
110
|
import { name as appName } from './app.json';
|
|
@@ -66,27 +130,7 @@ RNAppRegistry.registerRunnable(appName, ({ rootTag }) => {
|
|
|
66
130
|
});
|
|
67
131
|
```
|
|
68
132
|
|
|
69
|
-
|
|
70
|
-
nothing to import for them at all; both Vue compilers resolve them as elements and the renderer
|
|
71
|
-
maps each to its Fabric view. A tap→increment counter, authored in TSX:
|
|
72
|
-
|
|
73
|
-
```jsx
|
|
74
|
-
import { ref } from '@vue/runtime-core';
|
|
75
|
-
|
|
76
|
-
export default {
|
|
77
|
-
setup() {
|
|
78
|
-
const count = ref(0);
|
|
79
|
-
return () => (
|
|
80
|
-
<view style={{ padding: 24 }}>
|
|
81
|
-
<text>Taps: {count.value}</text>
|
|
82
|
-
<pressable onPress={() => count.value++}>
|
|
83
|
-
<text>Tap me</text>
|
|
84
|
-
</pressable>
|
|
85
|
-
</view>
|
|
86
|
-
);
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
```
|
|
133
|
+
</details>
|
|
90
134
|
|
|
91
135
|
### Two example apps
|
|
92
136
|
|
|
@@ -101,9 +145,9 @@ the demo above is the first one running on the iOS simulator:
|
|
|
101
145
|
|
|
102
146
|
## Parity — and the one gap
|
|
103
147
|
|
|
104
|
-
|
|
105
|
-
accessibility, and the `VirtualizedList` family
|
|
106
|
-
parity is **structural, not hand-copied**: the
|
|
148
|
+
Vue reaches the same primitives, runtime modules, `Animated` on both drivers, gestures,
|
|
149
|
+
accessibility, and the `VirtualizedList` family as React, Svelte, Solid, and Angular, verified
|
|
150
|
+
on-device on iOS and Android. That parity is **structural, not hand-copied**: the
|
|
107
151
|
component logic (state machines + render functions) is written **once** in `@symbiote-native/components`,
|
|
108
152
|
and each adapter supplies only its lifecycle (Vue's `ref`/`watch` + the descriptor→`h()` bridge).
|
|
109
153
|
|
package/build/renderer/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// drives the exact same retained tree React does: the proof the core is framework-
|
|
4
4
|
// agnostic.
|
|
5
5
|
import { callWithErrorHandling, createRenderer, ErrorCodes, markRaw, } from '@vue/runtime-core';
|
|
6
|
-
import { appendChild, createAnchor, createElement, createRawText, childrenOf, dlog, insertBefore, isRawTextNode, isTextContainer, nextSiblingOf, parentOf, removeChild, routeProp,
|
|
6
|
+
import { appendChild, createAnchor, createElement, createRawText, childrenOf, dlog, insertBefore, isRawTextNode, isTextContainer, nextSiblingOf, parentOf, removeChild, routeProp, setText, textOf, toPublicInstance, SymbioteSurface, } from '@symbiote-native/engine';
|
|
7
7
|
import { descriptorFor } from '@symbiote-native/components';
|
|
8
8
|
import { normalizeVueAttrKey } from '../utils/normalize-attrs.js';
|
|
9
9
|
function isSurface(parent) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/vue",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "SymbioteNative's Vue adapter — a @vue/runtime-core createRenderer driving real native iOS/Android views through the same engine as the React adapter.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"@vue/compiler-sfc": "^3.5.13",
|
|
71
71
|
"@vue/runtime-core": "^3.5.13",
|
|
72
72
|
"typescript": "~6.0.0",
|
|
73
|
-
"@symbiote-native/components": "3.1.
|
|
74
|
-
"@symbiote-native/css-parser": "0.5.
|
|
73
|
+
"@symbiote-native/components": "3.1.1",
|
|
74
|
+
"@symbiote-native/css-parser": "0.5.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"vue": ">=3.5.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@babel/core": "^7.25.2",
|
|
83
83
|
"@symbiote-native/engine": "1.3.0",
|
|
84
|
-
"@symbiote-native/test-utils": "0.4.
|
|
84
|
+
"@symbiote-native/test-utils": "0.4.3"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"typecheck": "tsc --build",
|