bare-ui-kit 0.2.0 → 0.3.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.
Files changed (89) hide show
  1. package/CMakeLists.txt +7 -1
  2. package/README.md +42 -1
  3. package/binding.m +558 -2
  4. package/index.d.ts +41 -0
  5. package/index.js +16 -0
  6. package/lib/activity-indicator-view.d.ts +29 -0
  7. package/lib/activity-indicator-view.h +181 -0
  8. package/lib/activity-indicator-view.js +56 -0
  9. package/lib/alert-action.d.ts +33 -0
  10. package/lib/alert-action.js +48 -0
  11. package/lib/alert-controller.d.ts +20 -0
  12. package/lib/alert-controller.h +199 -0
  13. package/lib/alert-controller.js +33 -0
  14. package/lib/attributed-string.d.ts +45 -0
  15. package/lib/attributed-string.h +176 -0
  16. package/lib/attributed-string.js +51 -0
  17. package/lib/attributes.js +34 -0
  18. package/lib/bezier-path.d.ts +26 -0
  19. package/lib/bezier-path.h +145 -0
  20. package/lib/bezier-path.js +51 -0
  21. package/lib/bridging.h +600 -2
  22. package/lib/color.d.ts +86 -0
  23. package/lib/color.h +286 -0
  24. package/lib/color.js +170 -0
  25. package/lib/events.js +35 -0
  26. package/lib/font-descriptor.d.ts +30 -0
  27. package/lib/font-descriptor.h +96 -0
  28. package/lib/font-descriptor.js +47 -0
  29. package/lib/font-metrics.d.ts +38 -0
  30. package/lib/font-metrics.h +109 -0
  31. package/lib/font-metrics.js +58 -0
  32. package/lib/font.d.ts +59 -0
  33. package/lib/font.h +424 -0
  34. package/lib/font.js +100 -0
  35. package/lib/handle.d.ts +5 -0
  36. package/lib/handle.js +6 -0
  37. package/lib/image-view.d.ts +15 -0
  38. package/lib/image-view.h +75 -0
  39. package/lib/image-view.js +27 -0
  40. package/lib/image.d.ts +37 -0
  41. package/lib/image.h +205 -0
  42. package/lib/image.js +60 -0
  43. package/lib/label.d.ts +51 -0
  44. package/lib/label.h +331 -0
  45. package/lib/label.js +94 -0
  46. package/lib/paragraph-style.d.ts +20 -0
  47. package/lib/paragraph-style.h +94 -0
  48. package/lib/paragraph-style.js +42 -0
  49. package/lib/pasteboard.d.ts +31 -0
  50. package/lib/pasteboard.h +123 -0
  51. package/lib/pasteboard.js +63 -0
  52. package/lib/retain.js +12 -0
  53. package/lib/runtime.m +92 -15
  54. package/lib/scene.d.ts +30 -0
  55. package/lib/scene.h +87 -0
  56. package/lib/scene.js +48 -0
  57. package/lib/scratch.js +4 -0
  58. package/lib/screen.d.ts +26 -0
  59. package/lib/screen.h +194 -0
  60. package/lib/screen.js +52 -0
  61. package/lib/scroll-view.d.ts +39 -0
  62. package/lib/scroll-view.h +246 -0
  63. package/lib/scroll-view.js +64 -0
  64. package/lib/switch.d.ts +22 -0
  65. package/lib/switch.h +166 -0
  66. package/lib/switch.js +42 -0
  67. package/lib/text-field.d.ts +103 -0
  68. package/lib/text-field.h +562 -0
  69. package/lib/text-field.js +183 -0
  70. package/lib/text-view.d.ts +59 -0
  71. package/lib/text-view.h +497 -0
  72. package/lib/text-view.js +138 -0
  73. package/lib/view-controller.d.ts +37 -0
  74. package/lib/view-controller.h +108 -20
  75. package/lib/view-controller.js +50 -5
  76. package/lib/view.d.ts +158 -0
  77. package/lib/view.h +1385 -20
  78. package/lib/view.js +276 -7
  79. package/lib/window.d.ts +44 -0
  80. package/lib/window.h +167 -27
  81. package/lib/window.js +62 -9
  82. package/lib/wrap.js +7 -0
  83. package/package.json +12 -3
  84. package/prebuilds/ios-arm64/bare +0 -0
  85. package/prebuilds/ios-arm64/bare-ui-kit.bare +0 -0
  86. package/prebuilds/ios-arm64-simulator/bare +0 -0
  87. package/prebuilds/ios-arm64-simulator/bare-ui-kit.bare +0 -0
  88. package/prebuilds/ios-x64-simulator/bare +0 -0
  89. package/prebuilds/ios-x64-simulator/bare-ui-kit.bare +0 -0
package/lib/window.js CHANGED
@@ -1,28 +1,77 @@
1
1
  const binding = require('../binding')
2
+ const { adopt } = require('./handle')
3
+ const retain = require('./retain')
2
4
  const UIKitView = require('./view')
5
+ const UIKitScene = require('./scene')
3
6
  const UIKitViewController = require('./view-controller')
4
7
 
8
+ // Windows made key are kept here, because UIKit would otherwise be their only
9
+ // owner.
10
+ const key = new Set()
11
+
5
12
  module.exports = exports = class UIKitWindow extends UIKitView {
6
- constructor() {
7
- super()
13
+ constructor(opts = {}) {
14
+ super(opts)
8
15
 
9
- this._handle = binding.windowInit(this)
16
+ this._rootViewController = null
17
+ this._windowScene = null
10
18
  }
11
19
 
12
- get rootViewController() {
13
- const handle = binding.windowRootViewController(this._handle)
20
+ _onkeyboardwillchangeframe(x, y, width, height) {
21
+ this.emit('keyboardWillChangeFrame', { x, y, width, height })
22
+ }
14
23
 
15
- if (handle === undefined) return null
24
+ _init(opts) {
25
+ const { scene = null, x, y, width, height } = opts
16
26
 
17
- return new UIKitViewController(handle)
27
+ const framed = x !== undefined || y !== undefined || width !== undefined || height !== undefined
28
+
29
+ return binding.windowInit(
30
+ scene === null ? null : adopt(scene),
31
+ framed ? (x ?? 0) : null,
32
+ framed ? (y ?? 0) : null,
33
+ framed ? (width ?? 0) : null,
34
+ framed ? (height ?? 0) : null,
35
+ this
36
+ )
37
+ }
38
+
39
+ get rootViewController() {
40
+ return retain(
41
+ this,
42
+ '_rootViewController',
43
+ UIKitViewController,
44
+ binding.windowRootViewController(this._tag)
45
+ )
18
46
  }
19
47
 
20
48
  set rootViewController(viewController) {
21
- binding.windowRootViewController(this._handle, viewController._handle)
49
+ binding.windowRootViewController(this._tag, adopt(viewController))
50
+ this._rootViewController = viewController
51
+ }
52
+
53
+ get windowScene() {
54
+ return retain(this, '_windowScene', UIKitScene, binding.windowWindowScene(this._tag))
55
+ }
56
+
57
+ set windowScene(windowScene) {
58
+ binding.windowWindowScene(this._tag, adopt(windowScene))
59
+ this._windowScene = windowScene
60
+ }
61
+
62
+ get keyWindow() {
63
+ return binding.windowKeyWindow(this._tag)
22
64
  }
23
65
 
24
66
  makeKeyWindow() {
25
- binding.windowMakeKeyWindow(this._handle)
67
+ binding.windowMakeKeyWindow(this._tag)
68
+ key.add(this)
69
+ return this
70
+ }
71
+
72
+ makeKeyAndVisible() {
73
+ binding.windowMakeKeyAndVisible(this._tag)
74
+ key.add(this)
26
75
  return this
27
76
  }
28
77
 
@@ -32,3 +81,7 @@ module.exports = exports = class UIKitWindow extends UIKitView {
32
81
  }
33
82
  }
34
83
  }
84
+
85
+ exports._events = {
86
+ keyboardWillChangeFrame: binding.WINDOW_EVENT_KEYBOARD_WILL_CHANGE_FRAME
87
+ }
package/lib/wrap.js ADDED
@@ -0,0 +1,7 @@
1
+ const binding = require('../binding')
2
+
3
+ module.exports = exports = function wrap(Class, tag) {
4
+ if (tag === null) return null
5
+
6
+ return binding.wrapper(tag) || new Class({ tag })
7
+ }
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "bare-ui-kit",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "UIKit bindings and runtime for Bare",
5
5
  "exports": {
6
6
  "./package": "./package.json",
7
- ".": "./index.js",
8
- "./runtime": "./runtime.js"
7
+ ".": {
8
+ "types": "./index.d.ts",
9
+ "default": "./index.js"
10
+ },
11
+ "./runtime": "./runtime.js",
12
+ "./*": {
13
+ "types": "./lib/*.d.ts",
14
+ "default": "./lib/*.js"
15
+ }
9
16
  },
10
17
  "files": [
11
18
  "index.js",
19
+ "index.d.ts",
12
20
  "binding.m",
13
21
  "binding.js",
14
22
  "runtime.js",
@@ -34,6 +42,7 @@
34
42
  "homepage": "https://github.com/holepunchto/bare-ui-kit#readme",
35
43
  "dependencies": {
36
44
  "bare-events": "^2.8.2",
45
+ "bare-foundation-registry": "^0.1.0",
37
46
  "require-asset": "^1.1.0"
38
47
  },
39
48
  "peerDependencies": {
Binary file
Binary file
Binary file