lecodes-sdk 2.0.2 → 2.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/dist/types/ui/UIScreen.d.ts +17 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types.json +1 -1
- package/package.json +1 -1
- package/src/bridges/tree.d.ts +4 -0
- package/src/chisel.ts +1 -1
- package/src/ui/UIScreen.ts +23 -0
- package/src/version.ts +1 -1
- package/tests/helpers/fakeTree.ts +2 -0
package/package.json
CHANGED
package/src/bridges/tree.d.ts
CHANGED
|
@@ -95,6 +95,10 @@ declare global {
|
|
|
95
95
|
routerPop(index: i32, transition: i32): void
|
|
96
96
|
routerHide(transition: i32): void
|
|
97
97
|
routerRestore(transition: i32): void
|
|
98
|
+
// The ADDRESS of a destination (`UIScreen.url`): a route (`/product/42`) a host with an address
|
|
99
|
+
// bar shows while the destination is the one on screen; null takes it away. OPTIONAL: a host
|
|
100
|
+
// without an address bar has no such method (the SDK feature-detects) — Web Lite has it.
|
|
101
|
+
setDestUrl?(kind: u8, id: f64, url: string | null): void
|
|
98
102
|
// Does the host registerView(name)? / the contract version its half was generated from (0 = no
|
|
99
103
|
// such view; on a host that does not say, 1 for a view it has) / the NativeView method channel:
|
|
100
104
|
// `args` is the array of the call's arguments, the callbacks settle exactly once through the
|
package/src/chisel.ts
CHANGED
|
@@ -128,7 +128,7 @@ export const chiselVocab: ChiselVocab = {
|
|
|
128
128
|
"onScroll", "onScrollRelease", "onOverscroll", "onRefresh", "onSubmit",
|
|
129
129
|
"onSelect", "onChange", "onFocus", "onBlur", "onOverlayTap", "onDetent",
|
|
130
130
|
"onEndReached", "onStartReached",
|
|
131
|
-
"append", "insert", "remove", "setContent", "keepAlive",
|
|
131
|
+
"append", "insert", "remove", "setContent", "keepAlive", "url",
|
|
132
132
|
"attachTo", "detents", "dismissible", "transition", "setSourceRect",
|
|
133
133
|
"push", "pop", "popToRoot", "replace", "select",
|
|
134
134
|
// UITabs / UIVirtualizedList / the native views (NativeView, CameraView, MapView, QRScanner)
|
package/src/ui/UIScreen.ts
CHANGED
|
@@ -37,6 +37,23 @@ export interface UIScreen extends UIContainerBase<UIScreenStyle, DrawableStyle &
|
|
|
37
37
|
*/
|
|
38
38
|
keepAlive(enabled?: boolean): this
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* The screen's ADDRESS on the web: while the screen is the one shown, the browser's address
|
|
42
|
+
* bar shows it, and a link copied from there opens the app with it (`app.launchUrl`). A route,
|
|
43
|
+
* not a page's address: `"/product/42"`, `"/search?q=shoes"` — the app never sees where the
|
|
44
|
+
* page is served from. Call it again to change the address of a screen that is shown (a
|
|
45
|
+
* filter, a search): the entry of the browser's history is replaced, not added to. `null`
|
|
46
|
+
* takes the address away; a screen with none keeps the address of the one under it.
|
|
47
|
+
*
|
|
48
|
+
* The way in is the app's: read `app.launchUrl` at start and listen to the `"url"` event, as
|
|
49
|
+
* for a deep link on a phone. No-op on hosts without an address bar.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* const ProductScreen = (id: string) => UIScreen(...).url(`/product/${id}`)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
url(route: string | null): this
|
|
56
|
+
|
|
40
57
|
/** Touch began on the screen; `ev.track(...)` takes over the rest of the gesture. */
|
|
41
58
|
onTouchStart(callback: (ev: TouchStartEvent<UIScreen>) => void): this,
|
|
42
59
|
/** @internal The destination tuple (Presentable). */
|
|
@@ -80,6 +97,12 @@ export class ScreenElement extends ContainerElement<"screen"> {
|
|
|
80
97
|
return this
|
|
81
98
|
}
|
|
82
99
|
|
|
100
|
+
url(route: string | null): this {
|
|
101
|
+
// an optional method of the bridge: a host without an address bar has none
|
|
102
|
+
if (this._h.id !== 0) tree().setDestUrl?.(TREE_DEST_SCREEN, this._h.id, route)
|
|
103
|
+
return this
|
|
104
|
+
}
|
|
105
|
+
|
|
83
106
|
readonly touchStartListeners: any[] = []
|
|
84
107
|
onTouchStart (callback: any): this {
|
|
85
108
|
this.touchStartListeners.push(callback)
|
package/src/version.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// same manifest). Its MAJOR is the bundle ↔ runtime contract: a bundle's `// sdk:` header line
|
|
5
5
|
// and a host's embedded version must agree on the major for the host to run the bundle; minor
|
|
6
6
|
// and patch never gate anything (features are detected, never versioned).
|
|
7
|
-
export const SDK_VERSION = "2.0.
|
|
7
|
+
export const SDK_VERSION = "2.0.3"
|
|
8
8
|
|
|
9
9
|
/** The major of a semver string, or null when it is not one. */
|
|
10
10
|
export const sdkMajor = (version: string | null | undefined): number | null => {
|
|
@@ -192,6 +192,8 @@ export class FakeTree {
|
|
|
192
192
|
}
|
|
193
193
|
routerHide = (transition: number): void => { this.rec("routerHide", transition); this.closeCurrent() }
|
|
194
194
|
routerRestore = (transition: number): void => { this.rec("routerRestore", transition); const top = this.stack[this.stack.length - 1]; if (top) this.present(top, transition) }
|
|
195
|
+
/** A host with an address bar has it (Web Lite); a test of a host without one deletes it. */
|
|
196
|
+
setDestUrl?: (kind: number, id: number, url: string | null) => void = (kind, id, url) => { this.rec("setDestUrl", kind, id, url) }
|
|
195
197
|
isViewSupported = (name: string): boolean => { this.rec("isViewSupported", name); return this.supportedViews.has(name) }
|
|
196
198
|
supportedViews = new Set<string>()
|
|
197
199
|
/** The contract version of a supported view (1 unless a test says otherwise). */
|