bare-native 0.0.1 → 0.1.1

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 CHANGED
@@ -1,11 +1,33 @@
1
1
  # bare-native
2
2
 
3
- Native application development framework for Bare.
3
+ Native application development framework for Bare. It provides a common set of UI primitives backed by the native platform UI toolkits, built on top of the Bare native addon system. This means that all native code is neatly tucked away and delivered to developers as prebuilt binaries, [no compilation required](https://xkcd.com/303/).
4
4
 
5
5
  ```
6
6
  npm i bare-native
7
7
  ```
8
8
 
9
+ ## Usage
10
+
11
+ ```js
12
+ const { Window } = require('bare-native')
13
+
14
+ const window = new Window(400, 250)
15
+
16
+ window.show()
17
+ ```
18
+
19
+ <https://github.com/holepunchto/bare-build> is used to package your application code alongside a Bare runtime suitable for the target platform. Either install the tool globally or as a development dependency of your project:
20
+
21
+ ```
22
+ npm i [-g|-D] bare-build
23
+ ```
24
+
25
+ Next, build your application for the target platform, telling `bare-build` to use the `bare-native` runtime:
26
+
27
+ ```
28
+ bare-build --out <dir> --target <platform>-<arch> --runtime bare-native/runtime app.js
29
+ ```
30
+
9
31
  ## License
10
32
 
11
33
  Apache-2.0
@@ -0,0 +1,37 @@
1
+ const EventEmitter = require('bare-events')
2
+ const NDK = require('bare-ndk')
3
+
4
+ module.exports = class NativeWebView extends EventEmitter {
5
+ constructor() {
6
+ super()
7
+
8
+ this._native = new NDK.WebView()
9
+
10
+ this._native.javaScriptEnabled(true)
11
+ }
12
+
13
+ get native() {
14
+ return this._native
15
+ }
16
+
17
+ loadURL(url) {
18
+ this._native.loadURL(url)
19
+ return this
20
+ }
21
+
22
+ loadHTML(html) {
23
+ this._native.loadData(html)
24
+ return this
25
+ }
26
+
27
+ inspectable(enabled) {
28
+ NDK.WebView.debuggingEnabled(enabled)
29
+ return this
30
+ }
31
+
32
+ [Symbol.for('bare.inspect')]() {
33
+ return {
34
+ __proto__: { constructor: NativeWebView }
35
+ }
36
+ }
37
+ }
@@ -22,6 +22,11 @@ module.exports = class NativeWebView extends EventEmitter {
22
22
  return this
23
23
  }
24
24
 
25
+ inspectable(enabled) {
26
+ this._native.inspectable = enabled
27
+ return this
28
+ }
29
+
25
30
  [Symbol.for('bare.inspect')]() {
26
31
  return {
27
32
  __proto__: { constructor: NativeWebView }
@@ -24,6 +24,10 @@ module.exports = class NativeWebView extends EventEmitter {
24
24
  return this
25
25
  }
26
26
 
27
+ inspectable(enabled) {
28
+ return this
29
+ }
30
+
27
31
  [Symbol.for('bare.inspect')]() {
28
32
  return {
29
33
  __proto__: { constructor: NativeWebView }
@@ -22,6 +22,10 @@ module.exports = class NativeWebView extends EventEmitter {
22
22
  return this
23
23
  }
24
24
 
25
+ inspectable(enabled) {
26
+ return this
27
+ }
28
+
25
29
  [Symbol.for('bare.inspect')]() {
26
30
  return {
27
31
  __proto__: { constructor: NativeWebView }
@@ -0,0 +1,29 @@
1
+ const EventEmitter = require('bare-events')
2
+ const NDK = require('bare-ndk')
3
+
4
+ module.exports = class NativeWindow extends EventEmitter {
5
+ constructor() {
6
+ super()
7
+
8
+ this._native = NDK.Activity
9
+ }
10
+
11
+ get native() {
12
+ return this._native
13
+ }
14
+
15
+ show() {
16
+ return this
17
+ }
18
+
19
+ content(view) {
20
+ this._native.contentView(view._native)
21
+ return this
22
+ }
23
+
24
+ [Symbol.for('bare.inspect')]() {
25
+ return {
26
+ __proto__: { constructor: NativeWindow }
27
+ }
28
+ }
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-native",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "description": "Native application development framework for Bare",
5
5
  "exports": {
6
6
  "./package": "./package.json",
@@ -11,12 +11,14 @@
11
11
  "#window": {
12
12
  "darwin": "./lib/window/darwin.js",
13
13
  "linux": "./lib/window/linux.js",
14
+ "android": "./lib/window/android.js",
14
15
  "win32": "./lib/window/win32.js"
15
16
  },
16
17
  "#web-view": {
17
18
  "darwin": "./lib/web-view/apple.js",
18
19
  "ios": "./lib/web-view/apple.js",
19
20
  "linux": "./lib/web-view/linux.js",
21
+ "android": "./lib/web-view/android.js",
20
22
  "win32": "./lib/web-view/win32.js"
21
23
  }
22
24
  },
@@ -39,12 +41,14 @@
39
41
  },
40
42
  "homepage": "https://github.com/holepunchto/bare-native#readme",
41
43
  "dependencies": {
42
- "bare-app-kit": "^0.0.0",
44
+ "bare-app-kit": "^0.1.0",
43
45
  "bare-events": "^2.8.2",
44
- "bare-gtk": "^0.0.0",
45
- "bare-web-kit": "^0.0.0",
46
- "bare-web-kit-gtk": "^0.0.0",
47
- "bare-win-ui": "^0.0.0"
46
+ "bare-gtk": "^0.1.0",
47
+ "bare-ndk": "^0.1.2",
48
+ "bare-ui-kit": "^0.1.0",
49
+ "bare-web-kit": "^0.1.0",
50
+ "bare-web-kit-gtk": "^0.1.0",
51
+ "bare-win-ui": "^0.1.0"
48
52
  },
49
53
  "devDependencies": {
50
54
  "brittle": "^3.3.2",
package/runtime.js CHANGED
@@ -1,9 +1,13 @@
1
1
  const AppKit = require('bare-app-kit/runtime')
2
+ const UIKit = require('bare-ui-kit/runtime')
2
3
  const GTK = require('bare-gtk/runtime')
4
+ const NDK = require('bare-ndk/runtime')
3
5
  const WinUI = require('bare-win-ui/runtime')
4
6
 
5
7
  exports.prebuilds = {
6
8
  ...AppKit.prebuilds,
9
+ ...UIKit.prebuilds,
7
10
  ...GTK.prebuilds,
11
+ ...NDK.prebuilds,
8
12
  ...WinUI.prebuilds
9
13
  }