one 2.13.9 → 2.14.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/android/src/main/java/dev/onejs/one/OneKotlinHostView.kt +53 -14
- package/android/src/main/java/dev/onejs/one/OneNativeSourceKeyedState.kt +23 -0
- package/android/src/main/java/dev/onejs/one/OneNativeSourceViewDispatch.kt +16 -3
- package/dist/cjs/metro-config/getViteMetroPluginOptions.cjs +4 -10
- package/dist/cjs/metro-config/getViteMetroPluginOptions.native.cjs +4 -10
- package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js +4 -10
- package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
- package/dist/cjs/platform/native-source/view.native.cjs +4 -4
- package/dist/cjs/platform/native-source/view.native.js +4 -4
- package/dist/cjs/platform/native-source/view.native.js.map +1 -1
- package/dist/cjs/platform/native-source/wire.native.cjs +152 -49
- package/dist/cjs/platform/native-source/wire.native.js +152 -49
- package/dist/cjs/platform/native-source/wire.native.js.map +1 -1
- package/dist/cjs/platform/native-source/wireProps.native.cjs +138 -0
- package/dist/cjs/platform/native-source/wireProps.native.js +140 -0
- package/dist/cjs/platform/native-source/wireProps.native.js.map +1 -0
- package/dist/cjs/platform/swift/index.native.cjs +12 -8
- package/dist/cjs/platform/swift/index.native.js +12 -8
- package/dist/cjs/platform/swift/index.native.js.map +1 -1
- package/dist/cjs/router/useScreens.cjs +1 -1
- package/dist/cjs/router/useScreens.native.cjs +2 -1
- package/dist/cjs/router/useScreens.native.js +2 -1
- package/dist/cjs/router/useScreens.native.js.map +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.mjs +4 -10
- package/dist/esm/metro-config/getViteMetroPluginOptions.mjs.map +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.native.js +4 -10
- package/dist/esm/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
- package/dist/esm/platform/native-source/view.native.js +5 -5
- package/dist/esm/platform/native-source/view.native.js.map +1 -1
- package/dist/esm/platform/native-source/wire.native.js +149 -49
- package/dist/esm/platform/native-source/wire.native.js.map +1 -1
- package/dist/esm/platform/native-source/wireProps.native.js +113 -0
- package/dist/esm/platform/native-source/wireProps.native.js.map +1 -0
- package/dist/esm/platform/swift/index.native.js +13 -9
- package/dist/esm/platform/swift/index.native.js.map +1 -1
- package/dist/esm/router/useScreens.mjs +1 -1
- package/dist/esm/router/useScreens.mjs.map +1 -1
- package/dist/esm/router/useScreens.native.js +2 -1
- package/dist/esm/router/useScreens.native.js.map +1 -1
- package/ios/Generated/OneNativeTabViewView.swift +2 -1
- package/ios/OneNativeComposition.swift +1 -0
- package/ios/OneNativeHostingController.swift +113 -0
- package/ios/OneSwiftHostComponentView.mm +28 -4
- package/ios/OneSwiftHostView.swift +63 -9
- package/ios/OneSwiftPackage.swift +6 -1
- package/package.json +13 -13
- package/src/metro-config/getViteMetroPluginOptions.integration.test.ts +33 -3
- package/src/metro-config/getViteMetroPluginOptions.ts +5 -11
- package/src/native/packedClosure.test.ts +59 -22
- package/src/platform/native-source/view.native.tsx +4 -5
- package/src/platform/native-source/wire.native.ts +108 -26
- package/src/platform/native-source/wireProps.native.test.ts +57 -0
- package/src/platform/native-source/wireProps.native.ts +124 -0
- package/src/platform/swift/index.native.tsx +9 -7
- package/src/platform/swift/types.ts +4 -2
- package/src/router/useScreens.tsx +1 -1
- package/types/metro-config/getViteMetroPluginOptions.d.ts +1 -1
- package/types/metro-config/getViteMetroPluginOptions.d.ts.map +1 -1
- package/types/platform/native-source/view.native.d.ts.map +1 -1
- package/types/platform/native-source/wire.native.d.ts +3 -0
- package/types/platform/native-source/wire.native.d.ts.map +1 -1
- package/types/platform/native-source/wireProps.native.d.ts +15 -0
- package/types/platform/native-source/wireProps.native.d.ts.map +1 -0
- package/types/platform/swift/index.native.d.ts.map +1 -1
- package/types/platform/swift/types.d.ts +4 -1
- package/types/platform/swift/types.d.ts.map +1 -1
|
@@ -14,6 +14,14 @@ import com.facebook.react.uimanager.UIManagerHelper
|
|
|
14
14
|
import com.facebook.react.views.view.ReactViewGroup
|
|
15
15
|
|
|
16
16
|
class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
17
|
+
companion object {
|
|
18
|
+
// matches RESYNC_EVENT in wireProps.native: emitted when a change
|
|
19
|
+
// document cannot apply, answered by a full document
|
|
20
|
+
const val RESYNC_EVENT = "\$resync"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private val keyedState = OneNativeSourceKeyedState()
|
|
24
|
+
|
|
17
25
|
private val composeView =
|
|
18
26
|
ComposeView(context).apply {
|
|
19
27
|
layoutParams =
|
|
@@ -32,7 +40,8 @@ class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
|
32
40
|
private var committedSource by mutableStateOf("")
|
|
33
41
|
private var committedView by mutableStateOf("")
|
|
34
42
|
private var committedContractHash by mutableStateOf("")
|
|
35
|
-
private var
|
|
43
|
+
private var committedPropsText = "{}"
|
|
44
|
+
private var resyncPending = false
|
|
36
45
|
|
|
37
46
|
private val contentLayout = Runnable { layoutComposeContent() }
|
|
38
47
|
|
|
@@ -46,23 +55,19 @@ class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
|
46
55
|
clipChildren = false
|
|
47
56
|
addView(composeView)
|
|
48
57
|
composeView.setContent {
|
|
58
|
+
// the props were merged into the keyed state at commit;
|
|
59
|
+
// composition only renders. Content reads the state's revision
|
|
60
|
+
// itself, so every apply resubscribes the rendering scope.
|
|
49
61
|
val source = committedSource
|
|
50
62
|
val view = committedView
|
|
51
|
-
val hash = committedContractHash
|
|
52
|
-
val props = committedProps
|
|
53
63
|
|
|
54
64
|
if (source.isNotEmpty() && view.isNotEmpty()) {
|
|
55
65
|
val dispatch = OneNativeSourceViewRegistry.get(source)
|
|
56
|
-
if (dispatch.contractHash != hash) {
|
|
57
|
-
error(
|
|
58
|
-
"native view $source.$view changed (contract hash mismatch: expected $hash, got ${dispatch.contractHash}); rebuild the app"
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
66
|
Layout(
|
|
62
67
|
content = {
|
|
63
68
|
dispatch.Content(
|
|
64
69
|
view = view,
|
|
65
|
-
|
|
70
|
+
state = keyedState,
|
|
66
71
|
emit = { eventName, eventArgs ->
|
|
67
72
|
onHostEvent(source, view, eventName, eventArgs)
|
|
68
73
|
},
|
|
@@ -123,12 +128,30 @@ class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
|
123
128
|
observedWidth = -1
|
|
124
129
|
observedHeight = -1
|
|
125
130
|
}
|
|
131
|
+
if (sourceOrViewChanged || nextHash != committedContractHash) {
|
|
132
|
+
keyedState.reset()
|
|
133
|
+
}
|
|
126
134
|
|
|
127
|
-
if (sourceOrViewChanged || nextHash != committedContractHash || nextProps !=
|
|
135
|
+
if (sourceOrViewChanged || nextHash != committedContractHash || nextProps != committedPropsText) {
|
|
136
|
+
if (nextSource.isNotEmpty() && nextView.isNotEmpty()) {
|
|
137
|
+
val dispatch = OneNativeSourceViewRegistry.get(nextSource)
|
|
138
|
+
if (dispatch.contractHash != nextHash) {
|
|
139
|
+
error(
|
|
140
|
+
"native view $nextSource.$nextView changed (contract hash mismatch: expected $nextHash, got ${dispatch.contractHash}); rebuild the app"
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
// decode and merge at commit, whether or not the composition
|
|
144
|
+
// is attached: a refused change asks for a resync instead of
|
|
145
|
+
// committing anything.
|
|
146
|
+
if (!dispatch.apply(nextView, nextProps, keyedState)) {
|
|
147
|
+
emitKeyedResync()
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
}
|
|
128
151
|
committedSource = nextSource
|
|
129
152
|
committedView = nextView
|
|
130
153
|
committedContractHash = nextHash
|
|
131
|
-
|
|
154
|
+
committedPropsText = nextProps
|
|
132
155
|
requestLayout()
|
|
133
156
|
}
|
|
134
157
|
}
|
|
@@ -144,8 +167,20 @@ class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
|
144
167
|
private fun onHostEvent(eventSource: String, eventView: String, name: String, args: String) {
|
|
145
168
|
// discard events from a detached or replaced source/view
|
|
146
169
|
if (!isAttachedToWindow || eventSource != committedSource || eventView != committedView) return
|
|
147
|
-
|
|
148
|
-
|
|
170
|
+
dispatchHostEvent(name, args)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// asks javascript for a full document after refusing a change document.
|
|
174
|
+
// runs during the prop commit (never composition), so it cannot compare
|
|
175
|
+
// against committed props the way view events do. commits also run while
|
|
176
|
+
// detached, so a resync the dispatcher cannot take yet waits for attach.
|
|
177
|
+
private fun emitKeyedResync() {
|
|
178
|
+
if (!dispatchHostEvent(RESYNC_EVENT, "[]")) resyncPending = true
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private fun dispatchHostEvent(name: String, args: String): Boolean {
|
|
182
|
+
val reactContext = UIManagerHelper.getReactContext(this) ?: return false
|
|
183
|
+
val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id) ?: return false
|
|
149
184
|
dispatcher.dispatchEvent(
|
|
150
185
|
OneKotlinHostEvent(
|
|
151
186
|
surfaceId = UIManagerHelper.getSurfaceId(this),
|
|
@@ -154,6 +189,7 @@ class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
|
154
189
|
args = args,
|
|
155
190
|
)
|
|
156
191
|
)
|
|
192
|
+
return true
|
|
157
193
|
}
|
|
158
194
|
|
|
159
195
|
private fun onContentSizeChanged(
|
|
@@ -189,6 +225,7 @@ class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
|
189
225
|
|
|
190
226
|
override fun onAttachedToWindow() {
|
|
191
227
|
super.onAttachedToWindow()
|
|
228
|
+
if (resyncPending && dispatchHostEvent(RESYNC_EVENT, "[]")) resyncPending = false
|
|
192
229
|
post(contentLayout)
|
|
193
230
|
}
|
|
194
231
|
|
|
@@ -248,6 +285,8 @@ class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
|
248
285
|
|
|
249
286
|
internal fun resetForReuse() {
|
|
250
287
|
removeCallbacks(contentLayout)
|
|
288
|
+
keyedState.reset()
|
|
289
|
+
resyncPending = false
|
|
251
290
|
reportedWidth = -1.0
|
|
252
291
|
reportedHeight = -1.0
|
|
253
292
|
observedWidth = -1
|
|
@@ -255,7 +294,7 @@ class OneKotlinHostView(context: Context) : ReactViewGroup(context) {
|
|
|
255
294
|
committedSource = ""
|
|
256
295
|
committedView = ""
|
|
257
296
|
committedContractHash = ""
|
|
258
|
-
|
|
297
|
+
committedPropsText = "{}"
|
|
259
298
|
stagedSource = null
|
|
260
299
|
stagedView = null
|
|
261
300
|
stagedContractHash = null
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package dev.onejs.one
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.getValue
|
|
4
|
+
import androidx.compose.runtime.mutableIntStateOf
|
|
5
|
+
import androidx.compose.runtime.setValue
|
|
6
|
+
|
|
7
|
+
// held keyed-props state for one host view instance. the host owns the
|
|
8
|
+
// lifetime (reset on source/view/contract change and on recycle) while the
|
|
9
|
+
// generated glue owns the contents: the last applied seq, one untyped holder
|
|
10
|
+
// per view (each read back only by the glue that created it), and the
|
|
11
|
+
// applied-commit revision the glue bumps and Content reads so composition
|
|
12
|
+
// resubscribes on every apply. touched from the ui thread (host commits)
|
|
13
|
+
// and composition (glue reads) only.
|
|
14
|
+
class OneNativeSourceKeyedState {
|
|
15
|
+
var seq: Int = -1
|
|
16
|
+
val views = mutableMapOf<String, Any?>()
|
|
17
|
+
var revision by mutableIntStateOf(0)
|
|
18
|
+
|
|
19
|
+
fun reset() {
|
|
20
|
+
seq = -1
|
|
21
|
+
views.clear()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -2,12 +2,25 @@ package dev.onejs.one
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
|
|
5
|
-
// generated per .kt source that declares public @Composable functions
|
|
6
|
-
// one
|
|
5
|
+
// generated per .kt source that declares public @Composable functions. apply
|
|
6
|
+
// decodes one props document and merges it into the host-owned state on the
|
|
7
|
+
// ui thread at prop commit: full documents always apply, a change applies
|
|
8
|
+
// onto the held seq and refuses otherwise (the host answers $resync).
|
|
9
|
+
// Content only renders the held props; a callback reports its arguments
|
|
7
10
|
// through emit as a json array.
|
|
8
11
|
interface OneNativeSourceViewDispatch {
|
|
9
12
|
val contractHash: String
|
|
10
13
|
|
|
14
|
+
fun apply(
|
|
15
|
+
view: String,
|
|
16
|
+
propsJson: String,
|
|
17
|
+
state: OneNativeSourceKeyedState,
|
|
18
|
+
): Boolean
|
|
19
|
+
|
|
11
20
|
@Composable
|
|
12
|
-
fun Content(
|
|
21
|
+
fun Content(
|
|
22
|
+
view: String,
|
|
23
|
+
state: OneNativeSourceKeyedState,
|
|
24
|
+
emit: (String, String) -> Unit,
|
|
25
|
+
)
|
|
13
26
|
}
|
|
@@ -26,16 +26,10 @@ var import_babel_preset = require("../babel-preset/index.cjs");
|
|
|
26
26
|
var import_buildOneMetroResolverOverrides = require("./buildOneMetroResolverOverrides.cjs");
|
|
27
27
|
function getViteMetroPluginOptions({ projectRoot, relativeRouterRoot, ignoredRouteFiles, linking, userDefaultConfigOverrides, setupFile }) {
|
|
28
28
|
const require2 = (0, import_node_module.createRequire)(projectRoot + "/");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} catch {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
if (missing.length) {
|
|
38
|
-
throw new Error(`[one] Metro requires ${missing.join(" and ")} in the app at ${projectRoot}. Install with your package manager, or remove native.bundler: 'metro' to use One's default native bundler.`);
|
|
29
|
+
try {
|
|
30
|
+
require2.resolve("@vxrn/vite-plugin-metro");
|
|
31
|
+
} catch {
|
|
32
|
+
throw new Error(`[one] Metro requires @vxrn/vite-plugin-metro in the app at ${projectRoot}. Install with your package manager, or remove native.bundler: 'metro' to use One's default native bundler.`);
|
|
39
33
|
}
|
|
40
34
|
const applyOneResolverOverrides = (0, import_buildOneMetroResolverOverrides.buildOneMetroResolverOverrides)({ projectRoot });
|
|
41
35
|
return {
|
|
@@ -29,16 +29,10 @@ var import_buildOneMetroResolverOverrides = require("./buildOneMetroResolverOver
|
|
|
29
29
|
function getViteMetroPluginOptions(param) {
|
|
30
30
|
var { projectRoot, relativeRouterRoot, ignoredRouteFiles, linking, userDefaultConfigOverrides, setupFile } = param;
|
|
31
31
|
var require2 = (0, import_module.createRequire)(projectRoot + "/");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} catch (unused) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
if (missing.length) {
|
|
41
|
-
throw new Error(`[one] Metro requires ${missing.join(" and ")} in the app at ${projectRoot}. Install with your package manager, or remove native.bundler: 'metro' to use One's default native bundler.`);
|
|
32
|
+
try {
|
|
33
|
+
require2.resolve("@vxrn/vite-plugin-metro");
|
|
34
|
+
} catch (unused) {
|
|
35
|
+
throw new Error(`[one] Metro requires @vxrn/vite-plugin-metro in the app at ${projectRoot}. Install with your package manager, or remove native.bundler: 'metro' to use One's default native bundler.`);
|
|
42
36
|
}
|
|
43
37
|
var applyOneResolverOverrides = (0, import_buildOneMetroResolverOverrides.buildOneMetroResolverOverrides)({ projectRoot });
|
|
44
38
|
return {
|
|
@@ -29,16 +29,10 @@ var import_buildOneMetroResolverOverrides = require("./buildOneMetroResolverOver
|
|
|
29
29
|
function getViteMetroPluginOptions(param) {
|
|
30
30
|
var { projectRoot, relativeRouterRoot, ignoredRouteFiles, linking, userDefaultConfigOverrides, setupFile } = param;
|
|
31
31
|
var require2 = (0, import_module.createRequire)(projectRoot + "/");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} catch (unused) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
if (missing.length) {
|
|
41
|
-
throw new Error(`[one] Metro requires ${missing.join(" and ")} in the app at ${projectRoot}. Install with your package manager, or remove native.bundler: 'metro' to use One's default native bundler.`);
|
|
32
|
+
try {
|
|
33
|
+
require2.resolve("@vxrn/vite-plugin-metro");
|
|
34
|
+
} catch (unused) {
|
|
35
|
+
throw new Error(`[one] Metro requires @vxrn/vite-plugin-metro in the app at ${projectRoot}. Install with your package manager, or remove native.bundler: 'metro' to use One's default native bundler.`);
|
|
42
36
|
}
|
|
43
37
|
var applyOneResolverOverrides = (0, import_buildOneMetroResolverOverrides.buildOneMetroResolverOverrides)({ projectRoot });
|
|
44
38
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getViteMetroPluginOptions.native.js","names":[],"sources":["cjs/metro-config/getViteMetroPluginOptions.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar getViteMetroPluginOptions_exports = {};\n__export(getViteMetroPluginOptions_exports, {\n getViteMetroPluginOptions: () => getViteMetroPluginOptions\n});\nmodule.exports = __toCommonJS(getViteMetroPluginOptions_exports);\nvar import_module = require(\"module\");\nvar import_babel_preset = require(\"../babel-preset\");\nvar import_buildOneMetroResolverOverrides = require(\"./buildOneMetroResolverOverrides\");\nfunction getViteMetroPluginOptions(param) {\n var { projectRoot, relativeRouterRoot, ignoredRouteFiles, linking, userDefaultConfigOverrides, setupFile } = param;\n var require2 = (0, import_module.createRequire)(projectRoot + \"/\");\n
|
|
1
|
+
{"version":3,"file":"getViteMetroPluginOptions.native.js","names":[],"sources":["cjs/metro-config/getViteMetroPluginOptions.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar getViteMetroPluginOptions_exports = {};\n__export(getViteMetroPluginOptions_exports, {\n getViteMetroPluginOptions: () => getViteMetroPluginOptions\n});\nmodule.exports = __toCommonJS(getViteMetroPluginOptions_exports);\nvar import_module = require(\"module\");\nvar import_babel_preset = require(\"../babel-preset\");\nvar import_buildOneMetroResolverOverrides = require(\"./buildOneMetroResolverOverrides\");\nfunction getViteMetroPluginOptions(param) {\n var { projectRoot, relativeRouterRoot, ignoredRouteFiles, linking, userDefaultConfigOverrides, setupFile } = param;\n var require2 = (0, import_module.createRequire)(projectRoot + \"/\");\n try {\n require2.resolve(\"@vxrn/vite-plugin-metro\");\n } catch (unused) {\n throw new Error(`[one] Metro requires @vxrn/vite-plugin-metro in the app at ${projectRoot}. Install with your package manager, or remove native.bundler: 'metro' to use One's default native bundler.`);\n }\n var applyOneResolverOverrides = (0, import_buildOneMetroResolverOverrides.buildOneMetroResolverOverrides)({\n projectRoot\n });\n return {\n oneViteMetroBabelConfig: true,\n defaultConfigOverrides: function defaultConfigOverrides(defaultConfig) {\n var config = applyOneResolverOverrides(defaultConfig);\n if (typeof userDefaultConfigOverrides === \"function\") {\n config = userDefaultConfigOverrides(config);\n }\n return config;\n },\n babelConfig: {\n plugins: (0, import_babel_preset.buildOneBabelPlugins)({\n projectRoot,\n relativeRouterRoot,\n ignoredRouteFiles,\n linking,\n setupFile,\n // vite path injects import-meta-env-plugin separately via the\n // metro server transformFile hook using the user's vite `define`.\n includeImportMetaEnv: false\n })\n }\n };\n}\n//# sourceMappingURL=getViteMetroPluginOptions.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,oCAAoC,CAAC;AACzC,SAAS,mCAAmC,EAC1C,iCAAiC,0BACnC,CAAC;AACD,OAAO,UAAU,aAAa,iCAAiC;AAC/D,IAAI,gBAAgB,QAAQ,QAAQ;AACpC,IAAI,sBAAsB,QAAQ,iCAAiB;AACnD,IAAI,wCAAwC,QAAQ,4CAAkC;AACtF,SAAS,0BAA0B,OAAO;CACxC,IAAI,EAAE,aAAa,oBAAoB,mBAAmB,SAAS,4BAA4B,cAAc;CAC7G,IAAI,YAAY,GAAG,cAAc,cAAa,CAAE,cAAc,GAAG;CACjE,IAAI;EACF,SAAS,QAAQ,yBAAyB;CAC5C,SAAS,QAAQ;EACf,MAAM,IAAI,MAAM,8DAA8D,YAAY,4GAA4G;CACxM;CACA,IAAI,6BAA6B,GAAG,sCAAsC,+BAA8B,CAAE,EACxG,YACF,CAAC;CACD,OAAO;EACL,yBAAyB;EACzB,wBAAwB,SAAS,uBAAuB,eAAe;GACrE,IAAI,SAAS,0BAA0B,aAAa;GACpD,IAAI,OAAO,+BAA+B,YAAY;IACpD,SAAS,2BAA2B,MAAM;GAC5C;GACA,OAAO;EACT;EACA,aAAa,EACX,UAAU,GAAG,oBAAoB,qBAAoB,CAAE;GACrD;GACA;GACA;GACA;GACA;GAGA,sBAAsB;EACxB,CAAC,EACH;CACF;AACF"}
|
|
@@ -34,10 +34,11 @@ var import_react = require("react");
|
|
|
34
34
|
var import_react_native = require("react-native");
|
|
35
35
|
var import_OneKotlinHostNativeComponent = __toESM(require("../specs/OneKotlinHostNativeComponent.native.js"), 1);
|
|
36
36
|
var import_wire = require("./wire.native.js");
|
|
37
|
+
var import_wireProps = require("./wireProps.native.js");
|
|
37
38
|
function KotlinSourceView(param) {
|
|
38
39
|
var { source, view, contractHash, props, wires } = param;
|
|
40
|
+
var keyed = (0, import_wireProps.useNativeSourceProps)(props, wires, view !== "");
|
|
39
41
|
var [contentSize, setContentSize] = (0, import_react.useState)();
|
|
40
|
-
var encoded = wires ? (0, import_wire.encodeNativeSourceProps)(props, wires.props, wires.structs) : props;
|
|
41
42
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native.View, {
|
|
42
43
|
style: props.style,
|
|
43
44
|
collapsable: false,
|
|
@@ -48,10 +49,9 @@ function KotlinSourceView(param) {
|
|
|
48
49
|
source,
|
|
49
50
|
view,
|
|
50
51
|
contractHash,
|
|
51
|
-
props:
|
|
52
|
-
return typeof value === "function" ? true : value;
|
|
53
|
-
}),
|
|
52
|
+
props: keyed.text,
|
|
54
53
|
onHostEvent: function onHostEvent(event) {
|
|
54
|
+
if (event.nativeEvent.name === import_wireProps.RESYNC_EVENT) return keyed.resync();
|
|
55
55
|
var callback = props[event.nativeEvent.name];
|
|
56
56
|
if (typeof callback === "function") {
|
|
57
57
|
var _ref;
|
|
@@ -34,10 +34,11 @@ var import_react = require("react");
|
|
|
34
34
|
var import_react_native = require("react-native");
|
|
35
35
|
var import_OneKotlinHostNativeComponent = __toESM(require("../specs/OneKotlinHostNativeComponent.native.js"), 1);
|
|
36
36
|
var import_wire = require("./wire.native.js");
|
|
37
|
+
var import_wireProps = require("./wireProps.native.js");
|
|
37
38
|
function KotlinSourceView(param) {
|
|
38
39
|
var { source, view, contractHash, props, wires } = param;
|
|
40
|
+
var keyed = (0, import_wireProps.useNativeSourceProps)(props, wires, view !== "");
|
|
39
41
|
var [contentSize, setContentSize] = (0, import_react.useState)();
|
|
40
|
-
var encoded = wires ? (0, import_wire.encodeNativeSourceProps)(props, wires.props, wires.structs) : props;
|
|
41
42
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native.View, {
|
|
42
43
|
style: props.style,
|
|
43
44
|
collapsable: false,
|
|
@@ -48,10 +49,9 @@ function KotlinSourceView(param) {
|
|
|
48
49
|
source,
|
|
49
50
|
view,
|
|
50
51
|
contractHash,
|
|
51
|
-
props:
|
|
52
|
-
return typeof value === "function" ? true : value;
|
|
53
|
-
}),
|
|
52
|
+
props: keyed.text,
|
|
54
53
|
onHostEvent: function onHostEvent(event) {
|
|
54
|
+
if (event.nativeEvent.name === import_wireProps.RESYNC_EVENT) return keyed.resync();
|
|
55
55
|
var callback = props[event.nativeEvent.name];
|
|
56
56
|
if (typeof callback === "function") {
|
|
57
57
|
var _ref;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.native.js","names":[],"sources":["cjs/platform/native-source/view.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar view_native_exports = {};\n__export(view_native_exports, {\n KotlinSourceView: () => KotlinSourceView\n});\nmodule.exports = __toCommonJS(view_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react = require(\"react\");\nvar import_react_native = require(\"react-native\");\nvar import_OneKotlinHostNativeComponent = __toESM(require(\"../specs/OneKotlinHostNativeComponent\"), 1);\nvar import_wire = require(\"./wire.native\");\nfunction KotlinSourceView(param) {\n var { source, view, contractHash, props, wires } = param;\n var
|
|
1
|
+
{"version":3,"file":"view.native.js","names":[],"sources":["cjs/platform/native-source/view.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar view_native_exports = {};\n__export(view_native_exports, {\n KotlinSourceView: () => KotlinSourceView\n});\nmodule.exports = __toCommonJS(view_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react = require(\"react\");\nvar import_react_native = require(\"react-native\");\nvar import_OneKotlinHostNativeComponent = __toESM(require(\"../specs/OneKotlinHostNativeComponent\"), 1);\nvar import_wire = require(\"./wire.native\");\nvar import_wireProps = require(\"./wireProps.native\");\nfunction KotlinSourceView(param) {\n var { source, view, contractHash, props, wires } = param;\n var keyed = (0, import_wireProps.useNativeSourceProps)(props, wires, view !== \"\");\n var [contentSize, setContentSize] = (0, import_react.useState)();\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native.View, {\n style: props.style,\n collapsable: false,\n children: [\n /* yoga uses the natural child size while retaining parent flex and stretch. */\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {\n pointerEvents: \"none\",\n style: contentSize\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneKotlinHostNativeComponent.default, {\n source,\n view,\n contractHash,\n props: keyed.text,\n onHostEvent: function onHostEvent(event) {\n if (event.nativeEvent.name === import_wireProps.RESYNC_EVENT) return keyed.resync();\n var callback = props[event.nativeEvent.name];\n if (typeof callback === \"function\") {\n var _ref;\n var args = JSON.parse(event.nativeEvent.args);\n var argWires = wires === null || wires === void 0 ? void 0 : wires.callbacks[event.nativeEvent.name];\n callback(...argWires ? (0, import_wire.decodeNativeSourceCallback)(args, argWires, (_ref = wires === null || wires === void 0 ? void 0 : wires.structs) !== null && _ref !== void 0 ? _ref : {}, event.nativeEvent.name) : args);\n }\n },\n onHostSizeChange: function onHostSizeChange(event) {\n setContentSize({\n width: event.nativeEvent.width,\n height: event.nativeEvent.height\n });\n },\n style: import_react_native.StyleSheet.absoluteFill\n })\n ]\n });\n}\n//# sourceMappingURL=view.native.js.map\n"],"mappings":"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"}
|