bm-core-ui 2.7.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 (99) hide show
  1. package/CHANGELOG.md +1624 -0
  2. package/LICENSE +21 -0
  3. package/README.md +145 -0
  4. package/build/@types/index.d.ts +14078 -0
  5. package/build/BMCodeEditor/BMCodeEditor.js +707 -0
  6. package/build/BMCollectionView/BMCollectionView.js +5861 -0
  7. package/build/BMCollectionView/BMCollectionViewCell.js +688 -0
  8. package/build/BMCollectionView/BMCollectionViewFlowLayout.js +4467 -0
  9. package/build/BMCollectionView/BMCollectionViewLayout.js +830 -0
  10. package/build/BMCollectionView/BMCollectionViewLayoutAttributes.js +673 -0
  11. package/build/BMCollectionView/BMCollectionViewMasonryLayout.js +491 -0
  12. package/build/BMCollectionView/BMCollectionViewStackLayout.js +634 -0
  13. package/build/BMCollectionView/BMCollectionViewTileLayout.js +1121 -0
  14. package/build/BMCoreUI.css +2833 -0
  15. package/build/BMView/BMAttributedLabelView.js +310 -0
  16. package/build/BMView/BMLayoutConstraint_v2.5.js +1813 -0
  17. package/build/BMView/BMLayoutGuide.js +192 -0
  18. package/build/BMView/BMLayoutSizeClass.js +466 -0
  19. package/build/BMView/BMMenu.js +574 -0
  20. package/build/BMView/BMScrollView.js +247 -0
  21. package/build/BMView/BMTextField.js +512 -0
  22. package/build/BMView/BMTextFieldDelegate.js +71 -0
  23. package/build/BMView/BMView_v2.5.js +3572 -0
  24. package/build/BMView/BMViewport.js +221 -0
  25. package/build/BMViewLayoutEditor/BMLayoutEditor.js +6117 -0
  26. package/build/BMViewLayoutEditor/BMLayoutEditorConstraintSettings.js +417 -0
  27. package/build/BMViewLayoutEditor/BMLayoutEditorDelegate.js +59 -0
  28. package/build/BMViewLayoutEditor/BMLayoutEditorSettingCells.js +1653 -0
  29. package/build/BMViewLayoutEditor/BMLayoutEditorSettings.js +1480 -0
  30. package/build/BMViewLayoutEditor/BMLayoutEditorSettingsComplexCells.js +431 -0
  31. package/build/BMViewLayoutEditor/BMLayoutEditorSettingsDelegate.js +46 -0
  32. package/build/BMViewLayoutEditor/BMLayoutEditorVariablesController.js +460 -0
  33. package/build/BMViewLayoutEditor/BMLayoutEditorViewGroupSettings.js +293 -0
  34. package/build/BMViewLayoutEditor/BMLayoutEditorViewSettings.js +382 -0
  35. package/build/BMViewLayoutEditor/BMLayoutVariableProvider.js +202 -0
  36. package/build/BMWindow/BMConfirmationPopup.js +477 -0
  37. package/build/BMWindow/BMKeyboardShortcut.js +151 -0
  38. package/build/BMWindow/BMPopover/BMPopover.js +492 -0
  39. package/build/BMWindow/BMToolWindow.js +71 -0
  40. package/build/BMWindow/BMWindow.js +2000 -0
  41. package/build/Core/BMAnimationContext.js +1181 -0
  42. package/build/Core/BMColor.js +991 -0
  43. package/build/Core/BMCoreUI.js +470 -0
  44. package/build/Core/BMFunctionCollection.js +110 -0
  45. package/build/Core/BMIndexPath.js +165 -0
  46. package/build/Core/BMInset.js +138 -0
  47. package/build/Core/BMKeyPath.js +100 -0
  48. package/build/Core/BMPoint.js +291 -0
  49. package/build/Core/BMRect.js +556 -0
  50. package/build/Core/BMSize.js +137 -0
  51. package/build/iScroll/LICENSE +22 -0
  52. package/build/iScroll/iscroll-probe.js +2154 -0
  53. package/build/images/AlignBottom.png +0 -0
  54. package/build/images/AlignCenterX.png +0 -0
  55. package/build/images/AlignCenterY.png +0 -0
  56. package/build/images/AlignLeading.png +0 -0
  57. package/build/images/AlignTop.png +0 -0
  58. package/build/images/AlignTrailing.png +0 -0
  59. package/build/images/AllConstraints.png +0 -0
  60. package/build/images/BottomConstraint.png +0 -0
  61. package/build/images/CenterXConstraint.png +0 -0
  62. package/build/images/CenterYConstraint.png +0 -0
  63. package/build/images/CoreUI2.png +0 -0
  64. package/build/images/CoreUI2@2x.png +0 -0
  65. package/build/images/Desktop.png +0 -0
  66. package/build/images/DesktopMini.png +0 -0
  67. package/build/images/EqualHeight.png +0 -0
  68. package/build/images/EqualHorizontalSpacing.png +0 -0
  69. package/build/images/EqualHorizontalSpacingInSuperview.png +0 -0
  70. package/build/images/EqualVerticalSpacing.png +0 -0
  71. package/build/images/EqualVerticalSpacingInSuperview.png +0 -0
  72. package/build/images/EqualWidth.png +0 -0
  73. package/build/images/HeightConstraint.png +0 -0
  74. package/build/images/InactiveConstraints.png +0 -0
  75. package/build/images/Layout.png +0 -0
  76. package/build/images/LayoutVariables.png +0 -0
  77. package/build/images/LeftConstraint.png +0 -0
  78. package/build/images/OwnConstraints.png +0 -0
  79. package/build/images/Phone.png +0 -0
  80. package/build/images/PhoneLandscape.png +0 -0
  81. package/build/images/PhoneLandscapeMini.png +0 -0
  82. package/build/images/PhoneMini.png +0 -0
  83. package/build/images/PhonePortrait.png +0 -0
  84. package/build/images/PhonePortraitMini.png +0 -0
  85. package/build/images/Properties.png +0 -0
  86. package/build/images/RightConstraint.png +0 -0
  87. package/build/images/SubviewConstraints.png +0 -0
  88. package/build/images/Tablet.png +0 -0
  89. package/build/images/TabletLandscape.png +0 -0
  90. package/build/images/TabletLandscapeMini.png +0 -0
  91. package/build/images/TabletMini.png +0 -0
  92. package/build/images/TabletPortrait.png +0 -0
  93. package/build/images/TabletPortraitMini.png +0 -0
  94. package/build/images/TopConstraint.png +0 -0
  95. package/build/images/WidthConstraint.png +0 -0
  96. package/build/index.js +40 -0
  97. package/lib/@types/BMCoreUI.min.d.ts +14078 -0
  98. package/lib/BMCoreUI.min.js +1 -0
  99. package/package.json +58 -0
@@ -0,0 +1,247 @@
1
+ // @ts-check
2
+
3
+ import {YES, NO, BMExtend, BMAddSmoothMousewheelInteractionToNode, BMIsTouchDevice} from '../Core/BMCoreUI'
4
+ import {BMPointMake} from '../Core/BMPoint'
5
+ import {BMRectMakeWithNodeFrame} from '../Core/BMRect'
6
+ import {BMAnimationContextGetCurrent, BMAnimationContext, BMAnimationContextAddCompletionHandler} from '../Core/BMAnimationContext'
7
+ import {BMLayoutAttribute, BMLayoutConstraintRelation, BMLayoutConstraint} from './BMLayoutConstraint_v2.5'
8
+ import {BMView} from './BMView_v2.5'
9
+ import {IScroll} from '../iScroll/iscroll-probe'
10
+
11
+ // @type BMScrollView extends BMView
12
+
13
+ /**
14
+ * The scroll view manages a DOM node whose content may overflow beyond its bounds.
15
+ * Unlike regular scrolling DOM nodes, constraints may be attached to a scroll view's content area.
16
+ * When views are constrained to its content areas, whenever the scroll view scrolls, those views' layouts
17
+ * will update accordingly.
18
+ */
19
+ export function BMScrollView() {} // <constructor>
20
+
21
+ /**
22
+ * Constructs and returns a scroll view.
23
+ * @return <BMScrollView> A scroll view.
24
+ */
25
+ BMScrollView.scrollView = function () {
26
+ return BMView.view.call(this);
27
+ }
28
+
29
+
30
+ /**
31
+ * Constructs and returns a scroll view for the given node.
32
+ * @param node <DOMNode> The scroll view node.
33
+ * {
34
+ * @param contentNode <DOMNode> The scroll view content node.
35
+ * }
36
+ * @return <BMScrollView> A scroll view.
37
+ */
38
+ BMScrollView.scrollViewForNode = function (node, args) {
39
+ return Object.create(BMScrollView.prototype).initWithWrapperDOMNode(node, args);
40
+ }
41
+
42
+ BMScrollView.prototype = BMExtend({}, BMView.prototype, {
43
+
44
+ get contentNode() { return this._node },
45
+ set contentNode(node) {},
46
+
47
+ /**
48
+ * The content view having all of the views managed by this view.
49
+ */
50
+ _contentView: undefined, // <BMView>
51
+ get contentView() {
52
+ return this._contentView;
53
+ },
54
+
55
+ /**
56
+ * The iScroll instance used for scrolling.
57
+ */
58
+ _iScroll: undefined, // <iScroll>
59
+
60
+ /**
61
+ * A point representing this scroll view's current scroll offset.
62
+ */
63
+ _scrollOffset: undefined, // <BMPoint>
64
+
65
+ // @override - BMView
66
+ get supportsAutomaticIntrinsicSize() {
67
+ return NO;
68
+ },
69
+
70
+ // @override - BMView
71
+ initWithDOMNode(node) {
72
+ let contentNode = document.createElement('div');
73
+ return this.initWithWrapperDOMNode(node, {contentNode: contentNode});
74
+ },
75
+
76
+ /**
77
+ * Initializes this scroll view with the given wrapper DOM node and the given content DOM node.
78
+ * @param node <DOMNode> The wrapper DOM node.
79
+ * {
80
+ * @param contentNode <DOMNode> The content view DOM node.
81
+ * }
82
+ */
83
+ initWithWrapperDOMNode(node, args) {
84
+ BMView.prototype.initWithDOMNode.call(this, node);
85
+
86
+ this._contentView = BMView.viewForNode.call(BMScrollContentView, args.contentNode);
87
+ BMView.prototype.addSubview.call(this, this._contentView);
88
+
89
+ node.style.overflow = 'hidden';
90
+ node.className = 'BMScrollView';
91
+
92
+ BMAddSmoothMousewheelInteractionToNode(node);
93
+
94
+ this._iScroll = new IScroll(node, {
95
+ mouseWheel: YES, scrollbars: YES, probeType: 3, click: NO, deceleration: 0.001, resizePolling: 999999999999, scrollX: YES, freeScroll: YES, interactiveScrollbars: !BMIsTouchDevice,
96
+ disableMouse: YES, disablePointer: YES, fadeScrollbars: BMIsTouchDevice
97
+ });
98
+
99
+ this._iScroll.on('scroll', () => this._iScrollDidScroll());
100
+ this._scrollOffset = BMPointMake();
101
+
102
+ return this;
103
+ },
104
+
105
+ /**
106
+ * Invoked whenever the iScroll instance managing this scroll view's scrolling scrolls.
107
+ */
108
+ _iScrollDidScroll() {
109
+ this._scrollOffset = BMPointMake(this._iScroll.x, this._iScroll.y);
110
+
111
+ this.layout();
112
+ },
113
+
114
+ // @override - BMView
115
+ get bounds() { // <BMRect>
116
+ let bounds = this._frame.copy();
117
+ bounds.origin = this._scrollOffset;
118
+
119
+ return bounds;
120
+ },
121
+
122
+
123
+ /**
124
+ * Should be invoked to add a subview to the content view's <code>contentNode</code>. If that subview
125
+ * already has a superview, it will first be removed from its current superview.
126
+ * Note that the view will not be added as a direct descendant of this scroll view
127
+ * @param subview <BMView> The subview to add.
128
+ * {
129
+ * @param toPosition <Number, nullable> Defaults to the last available position within this view. The position
130
+ * in which to add the given subview. If this is specified
131
+ * CoreUI will add the subview's node before the node of the
132
+ * view currently occupying that position.
133
+ * }
134
+ */
135
+ addSubview(subview, args) {
136
+ this._contentView.addSubview(subview, args);
137
+ },
138
+
139
+ // @override - BMView
140
+ release() {
141
+ this._contentView.release();
142
+ if (this._iScroll) this._iScroll.destroy();
143
+
144
+ BMView.prototype.release.call(this);
145
+ }
146
+
147
+ });
148
+
149
+ // @endtype
150
+
151
+ // @type BMScrollContentView extends BMView
152
+
153
+ /**
154
+ * The scroll content view manages the content of a scroll view.
155
+ */
156
+ export function BMScrollContentView () {} // <constructor>
157
+
158
+ BMScrollContentView.prototype = BMExtend({}, BMView.prototype, {
159
+
160
+ get contentNode() { return this._node },
161
+ set contentNode(node) {},
162
+
163
+ // Scroll content view always has deterministic constraints.
164
+ _hasDeterministicConstraints: YES, // <Boolean>
165
+
166
+ /**
167
+ * Is set to `"Scroll View Content"` by default for scroll content views.
168
+ */
169
+ debuggingName: 'Scroll View Content', // <String>
170
+
171
+ // @override - BMView
172
+ get supportsAutomaticIntrinsicSize() {
173
+ return NO;
174
+ },
175
+
176
+ // @override - BMView
177
+ // Scroll content views are always fixed to the top-left of their parents, regardless of the positioning
178
+ // reported by its constraint variables
179
+ _frame: undefined, // <BMRect>
180
+ get frame() {
181
+ return this._frame || BMRectMakeWithNodeFrame(this._node);
182
+ },
183
+
184
+ set frame(frame) {
185
+
186
+ frame.origin = BMPointMake();
187
+
188
+ Object.getOwnPropertyDescriptor(BMView.prototype, 'frame').set.call(this, frame);
189
+
190
+ if (BMAnimationContextGetCurrent()) {
191
+ BMAnimationContextAddCompletionHandler(() => {
192
+ this.superview._iScroll.refresh();
193
+ });
194
+ }
195
+ else {
196
+ (this.superview._iScroll) && this.superview._iScroll.refresh();
197
+ }
198
+
199
+ },
200
+
201
+ // @override - BMView
202
+ internalConstraints() {
203
+ let constraints = BMView.prototype.internalConstraints.call(this);
204
+
205
+ if (this._superviewLeftConstraint) {
206
+ this._superviewLeftConstraint.constant = this.superview._scrollOffset.x;
207
+ this._superviewTopConstraint.constant = this.superview._scrollOffset.y;
208
+
209
+ constraints.push(this._superviewWidthConstraint, this._superviewHeightConstraint, this._superviewLeftConstraint, this._superviewTopConstraint);
210
+ }
211
+ else {
212
+ // Scroll content views are always constrained to have their size at least equal to that of their containing scroll view
213
+ constraints.push(this._superviewWidthConstraint = BMLayoutConstraint.internalConstraintWithView(this, {
214
+ attribute: BMLayoutAttribute.Width,
215
+ relatedBy: BMLayoutConstraintRelation.GreaterThanOrEquals,
216
+ toView: this.superview,
217
+ secondAttribute: BMLayoutAttribute.Width
218
+ }));
219
+ constraints.push(this._superviewHeightConstraint = BMLayoutConstraint.internalConstraintWithView(this, {
220
+ attribute: BMLayoutAttribute.Height,
221
+ relatedBy: BMLayoutConstraintRelation.GreaterThanOrEquals,
222
+ toView: this.superview,
223
+ secondAttribute: BMLayoutAttribute.Height
224
+ }));
225
+
226
+ // Their reported positioning is always the parent scroll view's scroll offset
227
+ constraints.push(this._superviewLeftConstraint = BMLayoutConstraint.internalConstraintWithView(this, {
228
+ attribute: BMLayoutAttribute.Leading,
229
+ relatedBy: BMLayoutConstraintRelation.Equals,
230
+ toView: this.superview,
231
+ secondAttribute: BMLayoutAttribute.Leading,
232
+ constant: this.superview._scrollOffset.x
233
+ }));
234
+ constraints.push(this._superviewTopConstraint = BMLayoutConstraint.internalConstraintWithView(this, {
235
+ attribute: BMLayoutAttribute.Top,
236
+ relatedBy: BMLayoutConstraintRelation.Equals,
237
+ toView: this.superview,
238
+ secondAttribute: BMLayoutAttribute.Top,
239
+ constant: this.superview._scrollOffset.y
240
+ }));
241
+ }
242
+
243
+ return constraints;
244
+ }
245
+ });
246
+
247
+ // @endtype