@symbiote-native/vue 0.3.2 → 0.3.4
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.
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
import { computed, defineComponent, getCurrentInstance, h, isVNode, onBeforeUnmount, ref, shallowRef, watch, } from '@vue/runtime-core';
|
|
28
28
|
import { DEFAULT_END_REACHED_THRESHOLD, DEFAULT_INITIAL_NUM_TO_RENDER, DEFAULT_MAX_TO_RENDER_PER_BATCH, DEFAULT_START_REACHED_THRESHOLD, DEFAULT_UPDATE_CELLS_BATCHING_PERIOD, DEFAULT_WINDOW_SIZE, EMPTY_OFFSET, FIRST_INDEX, INVERTED_X_STYLE, INVERTED_Y_STYLE, NO_CONTENT_LENGTH_SENT, averageMeasuredLength, buildListPlan, buildOffsets, buildViewabilityPairs, computeEndReached, computeStartReached, computeViewableSet, computeWindow, diffViewable, highestMeasuredIndex, maxMinimumViewTime, offsetForIndex, readLayoutLength, readScrollOffset, throttleWindow, } from '@symbiote-native/components';
|
|
29
29
|
import { dlog, } from '@symbiote-native/engine';
|
|
30
|
-
import { ScrollView } from '../scroll-view
|
|
30
|
+
import { ScrollView } from '../scroll-view';
|
|
31
31
|
import { RefreshControl } from '../refresh-control.js';
|
|
32
32
|
import { normalizeVueAttrs } from '../../utils/normalize-attrs.js';
|
|
33
33
|
import { componentFromSlot } from '../../utils/slots-to-render-props.js';
|
package/build/index.js
CHANGED
|
@@ -17,17 +17,17 @@ export { Image, setImageSourceResolver } from './components/image.js';
|
|
|
17
17
|
// First component off the shared @symbiote-native/components layer: render-only, drives the
|
|
18
18
|
// agnostic renderActivityIndicator through descriptorToVue. Proof the layer is reusable:
|
|
19
19
|
// the render fn is shared verbatim with React; Vue supplies only the bridge.
|
|
20
|
-
export { ActivityIndicator } from './components/activity-indicator
|
|
20
|
+
export { ActivityIndicator } from './components/activity-indicator';
|
|
21
21
|
// First component to bring the state half into Vue (the lastNativeReport reducer + the
|
|
22
22
|
// snap-back watch); render shared verbatim with React, Vue supplies the reactive lifecycle.
|
|
23
|
-
export { Switch } from './components/switch
|
|
23
|
+
export { Switch } from './components/switch';
|
|
24
24
|
// ScrollView. Full parity: vertical + horizontal, every pass-through prop, the
|
|
25
25
|
// synthesized onContentSizeChange, the imperative handle via expose() + shallowRef, RefreshControl
|
|
26
26
|
// (iOS sibling / Android wrap), and sticky headers (the scroll AnimatedValue,
|
|
27
27
|
// the headerLayoutYs cross-talk, and the per-header Animated.View wrap). The pure math (intrinsics,
|
|
28
28
|
// decelerationRate, content-size dedupe, the handle, the sticky interpolation) is shared verbatim
|
|
29
29
|
// with React from @symbiote-native/components.
|
|
30
|
-
export { ScrollView } from './components/scroll-view
|
|
30
|
+
export { ScrollView } from './components/scroll-view';
|
|
31
31
|
// Pressable family. Full parity with React (the 3-layer split): the press state machine + render
|
|
32
32
|
// decisions are shared in @symbiote-native/components; Vue supplies the reactivity + descriptor bridge.
|
|
33
33
|
export { Pressable } from './components/pressable.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { AnimatedValue, AnimatedValueXY, AnimatedColor, AnimatedMock, Easing, Platform, timing, spring, decay, parallel, sequence, stagger, loop, delay, add, subtract, multiply, divide, modulo, diffClamp, event, forkEvent, unforkEvent, } from '@symbiote-native/engine';
|
|
7
7
|
import { View, Text } from '../../components.js';
|
|
8
8
|
import { Image } from '../../components/image.js';
|
|
9
|
-
import { ScrollView } from '../../components/scroll-view
|
|
9
|
+
import { ScrollView } from '../../components/scroll-view';
|
|
10
10
|
import { createAnimatedComponent } from './create-animated-component.js';
|
|
11
11
|
export { createAnimatedComponent } from './create-animated-component.js';
|
|
12
12
|
// View/Text are pure host primitives; Image is the functional renderImage wrapper, and all expose
|
|
@@ -13,8 +13,18 @@
|
|
|
13
13
|
// Ships as a package-level export (`@symbiote-native/vue/metro-vue-transformer`) rather than living
|
|
14
14
|
// in each consuming app: a consumer's own metro.config.js just points babelTransformerPath at it.
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const nodeFs = require('fs');
|
|
17
|
+
const { parse, compileScript, registerTS } = require('@vue/compiler-sfc');
|
|
17
18
|
const { createCompoundExpression } = require('@vue/compiler-core');
|
|
19
|
+
|
|
20
|
+
// A bare-specifier type import (`import type { X } from '@symbiote-native/navigation/vue'`, as
|
|
21
|
+
// opposed to a relative one) needs real node_modules resolution (package.json exports, pnpm
|
|
22
|
+
// symlinks) to turn the specifier into a file path — compileScript's own `fs` option only reads
|
|
23
|
+
// paths it's already given, it can't do that resolution. @vue/compiler-sfc's sanctioned hook for
|
|
24
|
+
// this is `registerTS`, the same one @vitejs/plugin-vue and vue-tsc call: it hands the compiler a
|
|
25
|
+
// lazy loader for the real `typescript` package, which resolves the specifier via
|
|
26
|
+
// `ts.resolveModuleName` and self-supplies `ts.sys` as the fs fallback.
|
|
27
|
+
registerTS(() => require('typescript'));
|
|
18
28
|
// @symbiote-native/css-parser is a real dependency of THIS package, so requiring it directly here
|
|
19
29
|
// (rather than through the ./metro-css-parser public subpath, which exists for CONSUMERS) resolves
|
|
20
30
|
// straight from this package's own node_modules under pnpm.
|
|
@@ -31,6 +41,23 @@ const {
|
|
|
31
41
|
|
|
32
42
|
const upstreamTransformer = resolveUpstreamTransformer();
|
|
33
43
|
|
|
44
|
+
// compileScript needs file system access to resolve a type-only `defineProps<ISomeProps>()`
|
|
45
|
+
// where ISomeProps is imported from another file — without it, Metro's worker process (a real
|
|
46
|
+
// Node process, but one @vue/compiler-sfc doesn't auto-detect as Node unless the consumer calls
|
|
47
|
+
// its `registerTS` hook) throws "No fs option provided ... in non-Node environment". Wiring
|
|
48
|
+
// Node's own `fs` module straight through is simpler than registering the `typescript` package
|
|
49
|
+
// as a loader (registerTS), and this file already runs in Node at Metro build time.
|
|
50
|
+
const compileScriptFs = {
|
|
51
|
+
fileExists: (file) => nodeFs.existsSync(file),
|
|
52
|
+
readFile: (file) => {
|
|
53
|
+
try {
|
|
54
|
+
return nodeFs.readFileSync(file, 'utf-8');
|
|
55
|
+
} catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
34
61
|
// Rewrites a Vue template AST so every `class`/`:class` binding on an element resolves
|
|
35
62
|
// against this file's scoped class names at the compiled call site, via @symbiote-native/engine's
|
|
36
63
|
// scopeClassName(value, localNames, scopeId). This runs at the AST level rather than as a
|
|
@@ -234,6 +261,7 @@ async function compileSfc(src, filename) {
|
|
|
234
261
|
id: scopeId,
|
|
235
262
|
inlineTemplate: true,
|
|
236
263
|
templateOptions,
|
|
264
|
+
fs: compileScriptFs,
|
|
237
265
|
});
|
|
238
266
|
// Point every Vue import (the compiler's injected helpers AND the user's own
|
|
239
267
|
// `import { ref } from 'vue'`) at the runtime-helpers shim, which re-exports the same
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/vue",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
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
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,16 +44,17 @@
|
|
|
44
44
|
"@vue/compiler-core": "^3.5.13",
|
|
45
45
|
"@vue/compiler-sfc": "^3.5.13",
|
|
46
46
|
"@vue/runtime-core": "^3.5.13",
|
|
47
|
-
"
|
|
47
|
+
"typescript": "~6.0.0",
|
|
48
48
|
"@symbiote-native/css-parser": "0.2.1",
|
|
49
|
-
"@symbiote-native/
|
|
49
|
+
"@symbiote-native/components": "0.2.3",
|
|
50
|
+
"@symbiote-native/engine": "0.1.4"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"vue": ">=3.5.0",
|
|
53
54
|
"react-native": ">=0.86"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@symbiote-native/test-utils": "0.1.
|
|
57
|
+
"@symbiote-native/test-utils": "0.1.5"
|
|
57
58
|
},
|
|
58
59
|
"scripts": {
|
|
59
60
|
"typecheck": "tsc --build",
|