@sigx/lynx-share 0.1.0 → 0.4.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/LICENSE +1 -1
- package/README.md +1 -8
- package/android/com/sigx/share/ShareModule.kt +8 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/share.d.ts +2 -2
- package/dist/share.d.ts.map +1 -1
- package/ios/ShareModule.swift +4 -2
- package/package.json +29 -7
- package/dist/share.js +0 -21
- package/dist/share.js.map +0 -1
- /package/{sigx-module.json → signalx-module.json} +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -8,14 +8,7 @@ Native share dialog for sigx-lynx. `UIActivityViewController` on iOS, `Intent.AC
|
|
|
8
8
|
pnpm add @sigx/lynx-share
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
// sigx.lynx.config.ts
|
|
13
|
-
export default defineLynxConfig({
|
|
14
|
-
modules: ['@sigx/lynx-share'],
|
|
15
|
-
});
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
No special permissions on either platform.
|
|
11
|
+
`sigx prebuild` auto-discovers and links the native module. No special permissions on either platform.
|
|
19
12
|
|
|
20
13
|
## Usage
|
|
21
14
|
|
|
@@ -8,7 +8,7 @@ import com.lynx.react.bridge.ReadableMap
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Native share dialog module.
|
|
11
|
-
* JS usage: NativeModules.Share.share({ title: "Check this out",
|
|
11
|
+
* JS usage: NativeModules.Share.share({ title: "Check this out", message: "Hello!", url: "https://..." })
|
|
12
12
|
*/
|
|
13
13
|
class ShareModule(context: Context) : LynxModule(context) {
|
|
14
14
|
|
|
@@ -17,7 +17,13 @@ class ShareModule(context: Context) : LynxModule(context) {
|
|
|
17
17
|
if (options == null) return
|
|
18
18
|
|
|
19
19
|
val title = if (options.hasKey("title")) options.getString("title") else null
|
|
20
|
-
|
|
20
|
+
// `message` is the canonical key (matches the TS API); `text` is
|
|
21
|
+
// accepted as a back-compat alias from older callers.
|
|
22
|
+
val text = when {
|
|
23
|
+
options.hasKey("message") -> options.getString("message")
|
|
24
|
+
options.hasKey("text") -> options.getString("text")
|
|
25
|
+
else -> null
|
|
26
|
+
}
|
|
21
27
|
val url = if (options.hasKey("url")) options.getString("url") else null
|
|
22
28
|
|
|
23
29
|
val shareText = buildString {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Share } from './share
|
|
2
|
-
export type { ShareOptions } from './share
|
|
1
|
+
export { Share } from './share';
|
|
2
|
+
export type { ShareOptions } from './share';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { callSync as e, isModuleAvailable as t } from "@sigx/lynx-core";
|
|
2
|
+
//#region src/share.ts
|
|
3
|
+
var n = "Share", r = {
|
|
4
|
+
share(t) {
|
|
5
|
+
e(n, "share", t);
|
|
6
|
+
},
|
|
7
|
+
isAvailable() {
|
|
8
|
+
return t(n);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { r as Share };
|
|
13
|
+
|
|
2
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/share.ts"],"sourcesContent":["import { callSync, isModuleAvailable } from '@sigx/lynx-core';\n\nconst MODULE = 'Share';\n\nexport interface ShareOptions {\n title?: string;\n message?: string;\n url?: string;\n}\n\n/**\n * Native share dialog APIs.\n *\n * @example\n * ```ts\n * import { Share } from '@sigx/lynx-share';\n *\n * Share.share({ title: 'Check this out', message: 'Built with sigx-lynx!', url: 'https://sigx.dev' });\n * ```\n */\nexport const Share = {\n share(options: ShareOptions): void {\n callSync(MODULE, 'share', options);\n },\n\n isAvailable(): boolean {\n return isModuleAvailable(MODULE);\n },\n} as const;\n"],"mappings":";;AAEA,IAAM,IAAS,SAkBF,IAAQ;CACjB,MAAM,GAA6B;EAC/B,EAAS,GAAQ,SAAS,EAAQ;;CAGtC,cAAuB;EACnB,OAAO,EAAkB,EAAO;;CAEvC"}
|
package/dist/share.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface ShareOptions {
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
export declare const Share: {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
share(options: ShareOptions): void;
|
|
18
|
+
isAvailable(): boolean;
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=share.d.ts.map
|
package/dist/share.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK;
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK;IACd,KAAK,UAAU,YAAY,GAAG,IAAI;IAIlC,WAAW,IAAI,OAAO;CAGhB,CAAC"}
|
package/ios/ShareModule.swift
CHANGED
|
@@ -2,7 +2,7 @@ import UIKit
|
|
|
2
2
|
import Lynx
|
|
3
3
|
|
|
4
4
|
/// Native share dialog module.
|
|
5
|
-
/// JS usage: NativeModules.Share.share({ title: "Check this",
|
|
5
|
+
/// JS usage: NativeModules.Share.share({ title: "Check this", message: "Hello!", url: "https://..." })
|
|
6
6
|
class ShareModule: NSObject, LynxModule {
|
|
7
7
|
|
|
8
8
|
@objc static var name: String { "Share" }
|
|
@@ -20,7 +20,9 @@ class ShareModule: NSObject, LynxModule {
|
|
|
20
20
|
guard let options = options else { return }
|
|
21
21
|
|
|
22
22
|
let title = options["title"] as? String
|
|
23
|
-
|
|
23
|
+
// `message` is the canonical key (matches the TS API); `text` is
|
|
24
|
+
// accepted as a back-compat alias from older callers.
|
|
25
|
+
let text = (options["message"] as? String) ?? (options["text"] as? String)
|
|
24
26
|
let urlString = options["url"] as? String
|
|
25
27
|
|
|
26
28
|
var items: [Any] = []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigx/lynx-share",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Native share dialog for sigx-lynx",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,24 +10,46 @@
|
|
|
10
10
|
"import": "./dist/index.js",
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
12
|
},
|
|
13
|
-
"./
|
|
13
|
+
"./signalx-module.json": "./signalx-module.json"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"ios",
|
|
18
18
|
"android",
|
|
19
|
-
"
|
|
19
|
+
"signalx-module.json"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sigx/lynx-core": "^0.
|
|
22
|
+
"@sigx/lynx-core": "^0.4.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"typescript": "^
|
|
25
|
+
"typescript": "^6.0.3",
|
|
26
|
+
"@sigx/vite": "^0.4.3"
|
|
26
27
|
},
|
|
27
28
|
"author": "Andreas Ekdahl",
|
|
28
29
|
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/signalxjs/lynx.git",
|
|
33
|
+
"directory": "packages/lynx-share"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/signalxjs/lynx/tree/main/packages/lynx-share",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/signalxjs/lynx/issues"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"signalx",
|
|
44
|
+
"sigx",
|
|
45
|
+
"lynx",
|
|
46
|
+
"mobile",
|
|
47
|
+
"ios",
|
|
48
|
+
"android",
|
|
49
|
+
"share"
|
|
50
|
+
],
|
|
29
51
|
"scripts": {
|
|
30
|
-
"build": "
|
|
31
|
-
"dev": "
|
|
52
|
+
"build": "vite build && tsgo --emitDeclarationOnly",
|
|
53
|
+
"dev": "vite build --watch"
|
|
32
54
|
}
|
|
33
55
|
}
|
package/dist/share.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { callSync, isModuleAvailable } from '@sigx/lynx-core';
|
|
2
|
-
const MODULE = 'Share';
|
|
3
|
-
/**
|
|
4
|
-
* Native share dialog APIs.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* import { Share } from '@sigx/lynx-share';
|
|
9
|
-
*
|
|
10
|
-
* Share.share({ title: 'Check this out', message: 'Built with sigx-lynx!', url: 'https://sigx.dev' });
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export const Share = {
|
|
14
|
-
share(options) {
|
|
15
|
-
callSync(MODULE, 'share', options);
|
|
16
|
-
},
|
|
17
|
-
isAvailable() {
|
|
18
|
-
return isModuleAvailable(MODULE);
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=share.js.map
|
package/dist/share.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"share.js","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,GAAG,OAAO,CAAC;AAQvB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,KAAK,CAAC,OAAqB;QACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,WAAW;QACP,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACK,CAAC"}
|
|
File without changes
|