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
@@ -0,0 +1,183 @@
1
+ const binding = require('../binding')
2
+ const { adopt } = require('./handle')
3
+ const wrap = require('./wrap')
4
+ const UIKitColor = require('./color')
5
+ const UIKitFont = require('./font')
6
+ const UIKitView = require('./view')
7
+
8
+ module.exports = exports = class UIKitTextField extends UIKitView {
9
+ _init(opts) {
10
+ const { x = 0, y = 0, width = 0, height = 0 } = opts
11
+
12
+ return binding.textFieldInit(x, y, width, height, this)
13
+ }
14
+
15
+ get text() {
16
+ return binding.textFieldText(this._tag)
17
+ }
18
+
19
+ set text(text) {
20
+ binding.textFieldText(this._tag, text)
21
+ }
22
+
23
+ get placeholder() {
24
+ return binding.textFieldPlaceholder(this._tag)
25
+ }
26
+
27
+ set placeholder(placeholder) {
28
+ binding.textFieldPlaceholder(this._tag, placeholder)
29
+ }
30
+
31
+ get font() {
32
+ return wrap(UIKitFont, binding.textFieldFont(this._tag))
33
+ }
34
+
35
+ set font(font) {
36
+ binding.textFieldFont(this._tag, adopt(font))
37
+ }
38
+
39
+ get textColor() {
40
+ return wrap(UIKitColor, binding.textFieldTextColor(this._tag))
41
+ }
42
+
43
+ set textColor(textColor) {
44
+ binding.textFieldTextColor(this._tag, adopt(textColor))
45
+ }
46
+
47
+ get textAlignment() {
48
+ return binding.textFieldTextAlignment(this._tag)
49
+ }
50
+
51
+ set textAlignment(textAlignment) {
52
+ binding.textFieldTextAlignment(this._tag, textAlignment)
53
+ }
54
+
55
+ get secureTextEntry() {
56
+ return binding.textFieldSecureTextEntry(this._tag)
57
+ }
58
+
59
+ set secureTextEntry(secureTextEntry) {
60
+ binding.textFieldSecureTextEntry(this._tag, secureTextEntry)
61
+ }
62
+
63
+ get keyboardType() {
64
+ return binding.textFieldKeyboardType(this._tag)
65
+ }
66
+
67
+ set keyboardType(keyboardType) {
68
+ binding.textFieldKeyboardType(this._tag, keyboardType)
69
+ }
70
+
71
+ get returnKeyType() {
72
+ return binding.textFieldReturnKeyType(this._tag)
73
+ }
74
+
75
+ set returnKeyType(returnKeyType) {
76
+ binding.textFieldReturnKeyType(this._tag, returnKeyType)
77
+ }
78
+
79
+ get autocapitalizationType() {
80
+ return binding.textFieldAutocapitalizationType(this._tag)
81
+ }
82
+
83
+ set autocapitalizationType(autocapitalizationType) {
84
+ binding.textFieldAutocapitalizationType(this._tag, autocapitalizationType)
85
+ }
86
+
87
+ get autocorrectionType() {
88
+ return binding.textFieldAutocorrectionType(this._tag)
89
+ }
90
+
91
+ set autocorrectionType(autocorrectionType) {
92
+ binding.textFieldAutocorrectionType(this._tag, autocorrectionType)
93
+ }
94
+
95
+ get enabled() {
96
+ return binding.textFieldEnabled(this._tag)
97
+ }
98
+
99
+ set enabled(enabled) {
100
+ binding.textFieldEnabled(this._tag, enabled)
101
+ }
102
+
103
+ get selectedRange() {
104
+ return binding.textFieldSelectedRange(this._tag)
105
+ }
106
+
107
+ set selectedRange(selectedRange) {
108
+ const { location = 0, length = 0 } = selectedRange
109
+
110
+ binding.textFieldSelectedRange(this._tag, location, length)
111
+ }
112
+
113
+ [Symbol.for('bare.inspect')]() {
114
+ return {
115
+ __proto__: { constructor: UIKitTextField }
116
+ }
117
+ }
118
+
119
+ _ondidbeginediting() {
120
+ this.emit('didBeginEditing')
121
+ }
122
+
123
+ _ondidendediting() {
124
+ this.emit('didEndEditing')
125
+ }
126
+
127
+ _ondidchange() {
128
+ this.emit('didChange')
129
+ }
130
+
131
+ _ondidchangeselection() {
132
+ this.emit('didChangeSelection')
133
+ }
134
+
135
+ _onshouldchangecharacters(location, length, string) {
136
+ this.emit('shouldChangeCharacters', { location, length, string })
137
+ }
138
+
139
+ _onshouldreturn() {
140
+ this.emit('shouldReturn')
141
+ }
142
+ }
143
+
144
+ exports._events = {
145
+ didBeginEditing: binding.TEXT_FIELD_EVENT_DID_BEGIN_EDITING,
146
+ didEndEditing: binding.TEXT_FIELD_EVENT_DID_END_EDITING,
147
+ didChange: binding.TEXT_FIELD_EVENT_DID_CHANGE,
148
+ shouldChangeCharacters: binding.TEXT_FIELD_EVENT_SHOULD_CHANGE_CHARACTERS,
149
+ shouldReturn: binding.TEXT_FIELD_EVENT_SHOULD_RETURN,
150
+ didChangeSelection: binding.TEXT_FIELD_EVENT_DID_CHANGE_SELECTION
151
+ }
152
+
153
+ exports.KEYBOARD_TYPE = {
154
+ DEFAULT: binding.KEYBOARD_TYPE_DEFAULT,
155
+ NUMBER_PAD: binding.KEYBOARD_TYPE_NUMBER_PAD,
156
+ DECIMAL_PAD: binding.KEYBOARD_TYPE_DECIMAL_PAD,
157
+ NUMBERS_AND_PUNCTUATION: binding.KEYBOARD_TYPE_NUMBERS_AND_PUNCTUATION,
158
+ EMAIL_ADDRESS: binding.KEYBOARD_TYPE_EMAIL_ADDRESS,
159
+ PHONE_PAD: binding.KEYBOARD_TYPE_PHONE_PAD,
160
+ URL: binding.KEYBOARD_TYPE_URL
161
+ }
162
+
163
+ exports.RETURN_KEY_TYPE = {
164
+ DEFAULT: binding.RETURN_KEY_TYPE_DEFAULT,
165
+ DONE: binding.RETURN_KEY_TYPE_DONE,
166
+ GO: binding.RETURN_KEY_TYPE_GO,
167
+ NEXT: binding.RETURN_KEY_TYPE_NEXT,
168
+ SEARCH: binding.RETURN_KEY_TYPE_SEARCH,
169
+ SEND: binding.RETURN_KEY_TYPE_SEND
170
+ }
171
+
172
+ exports.TEXT_AUTOCAPITALIZATION_TYPE = {
173
+ NONE: binding.AUTOCAPITALIZATION_TYPE_NONE,
174
+ WORDS: binding.AUTOCAPITALIZATION_TYPE_WORDS,
175
+ SENTENCES: binding.AUTOCAPITALIZATION_TYPE_SENTENCES,
176
+ ALL_CHARACTERS: binding.AUTOCAPITALIZATION_TYPE_ALL_CHARACTERS
177
+ }
178
+
179
+ exports.TEXT_AUTOCORRECTION_TYPE = {
180
+ DEFAULT: binding.AUTOCORRECTION_TYPE_DEFAULT,
181
+ NO: binding.AUTOCORRECTION_TYPE_NO,
182
+ YES: binding.AUTOCORRECTION_TYPE_YES
183
+ }
@@ -0,0 +1,59 @@
1
+ import { tag, handle, Handle, Wrapper } from 'bare-foundation-registry'
2
+ import UIKitScrollView = require('./scroll-view')
3
+ import UIKitView = require('./view')
4
+ import UIKitColor = require('./color')
5
+ import UIKitFont = require('./font')
6
+
7
+ /** Several lines of editable text, as a `UITextView`. */
8
+ interface UIKitTextView extends UIKitScrollView<UIKitTextView.Events> {
9
+ text: string | null
10
+
11
+ get font(): UIKitFont | null
12
+ set font(font: Wrapper | null)
13
+
14
+ get textColor(): UIKitColor | null
15
+ set textColor(color: Wrapper | null)
16
+
17
+ /** A `UIKitLabel.TEXT_ALIGNMENT` constant. */
18
+ textAlignment: number
19
+
20
+ /** A `UIKitTextField.KEYBOARD_TYPE` constant. */
21
+ keyboardType: number
22
+
23
+ /** A `UIKitTextField.RETURN_KEY_TYPE` constant. */
24
+ returnKeyType: number
25
+
26
+ /** A `UIKitTextField.TEXT_AUTOCAPITALIZATION_TYPE` constant. */
27
+ autocapitalizationType: number
28
+
29
+ /** A `UIKitTextField.TEXT_AUTOCORRECTION_TYPE` constant. */
30
+ autocorrectionType: number
31
+
32
+ /** The selected range, as UTF-16 offsets. With nothing selected, `length` is 0. */
33
+ get selectedRange(): { location: number; length: number }
34
+ set selectedRange(range: { location?: number; length?: number })
35
+
36
+ editable: boolean
37
+
38
+ scrollEnabled: boolean
39
+ }
40
+
41
+ declare class UIKitTextView {
42
+ constructor(frame?: Partial<UIKitView.Rect>)
43
+ }
44
+
45
+ declare namespace UIKitTextView {
46
+ export interface Events {
47
+ didBeginEditing: []
48
+ didEndEditing: []
49
+
50
+ /** The text changed. */
51
+ didChange: []
52
+ didChangeSelection: []
53
+
54
+ /** The `length` characters at `location` are about to be replaced by `string`. */
55
+ shouldChangeText: [edit: { location: number; length: number; string: string }]
56
+ }
57
+ }
58
+
59
+ export = UIKitTextView