bm-core-ui 2.9.5 → 2.10.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/build/@types/index.d.ts +320 -61
- package/build/BMCollectionView/BMCollectionView.js +77 -39
- package/build/BMCollectionView/BMCollectionViewFlowLayout.js +18 -5
- package/build/BMCoreUI.css +45 -18
- package/build/BMView/BMMenu.js +134 -7
- package/build/BMView/BMView_v2.5.js +59 -0
- package/build/BMWindow/BMKeyboardShortcut.js +338 -88
- package/build/BMWindow/BMPopover/BMPopover.js +52 -11
- package/build/BMWindow/BMWindow.js +32 -6
- package/build/Core/BMCoreUI.js +20 -8
- package/build/images/AlignBottom.png +0 -0
- package/build/images/AlignCenterX.png +0 -0
- package/build/images/AlignCenterY.png +0 -0
- package/build/images/AlignLeading.png +0 -0
- package/build/images/AlignTop.png +0 -0
- package/build/images/AlignTrailing.png +0 -0
- package/build/images/AllConstraints.png +0 -0
- package/build/images/BottomConstraint.png +0 -0
- package/build/images/CenterXConstraint.png +0 -0
- package/build/images/CenterYConstraint.png +0 -0
- package/build/images/CoreUI2.png +0 -0
- package/build/images/CoreUI2@2x.png +0 -0
- package/build/images/Desktop.png +0 -0
- package/build/images/DesktopMini.png +0 -0
- package/build/images/EqualHeight.png +0 -0
- package/build/images/EqualHorizontalSpacing.png +0 -0
- package/build/images/EqualHorizontalSpacingInSuperview.png +0 -0
- package/build/images/EqualVerticalSpacing.png +0 -0
- package/build/images/EqualVerticalSpacingInSuperview.png +0 -0
- package/build/images/EqualWidth.png +0 -0
- package/build/images/HeightConstraint.png +0 -0
- package/build/images/InactiveConstraints.png +0 -0
- package/build/images/Layout.png +0 -0
- package/build/images/LayoutVariables.png +0 -0
- package/build/images/LeftConstraint.png +0 -0
- package/build/images/OwnConstraints.png +0 -0
- package/build/images/Phone.png +0 -0
- package/build/images/PhoneLandscape.png +0 -0
- package/build/images/PhoneLandscapeMini.png +0 -0
- package/build/images/PhoneMini.png +0 -0
- package/build/images/PhonePortrait.png +0 -0
- package/build/images/PhonePortraitMini.png +0 -0
- package/build/images/Properties.png +0 -0
- package/build/images/RightConstraint.png +0 -0
- package/build/images/SubviewConstraints.png +0 -0
- package/build/images/Tablet.png +0 -0
- package/build/images/TabletLandscape.png +0 -0
- package/build/images/TabletLandscapeMini.png +0 -0
- package/build/images/TabletMini.png +0 -0
- package/build/images/TabletPortrait.png +0 -0
- package/build/images/TabletPortraitMini.png +0 -0
- package/build/images/TopConstraint.png +0 -0
- package/build/images/WidthConstraint.png +0 -0
- package/lib/@types/BMCoreUI.min.d.ts +320 -61
- package/lib/BMCoreUI.min.js +3 -1
- package/package.json +9 -10
|
@@ -5,7 +5,7 @@ import { BMWindow } from "../BMWindow";
|
|
|
5
5
|
import { BMRectMakeWithOrigin, BMRectMakeWithNodeFrame, BMRectMake } from "../../Core/BMRect";
|
|
6
6
|
import { BMPointMake } from "../../Core/BMPoint";
|
|
7
7
|
import { BMHook, __BMVelocityAnimate } from "../../Core/BMAnimationContext";
|
|
8
|
-
import { BMView } from "../../BMView/BMView_v2.5";
|
|
8
|
+
import { BMView, BMViewColorScheme } from "../../BMView/BMView_v2.5";
|
|
9
9
|
import { BMInsetMakeWithEqualInsets } from "../../Core/BMInset";
|
|
10
10
|
|
|
11
11
|
// @type BMPopoverIndicatorDirection
|
|
@@ -194,6 +194,11 @@ BMPopover.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
194
194
|
*/
|
|
195
195
|
_clipPathOutlinePath: undefined, // <DOMNode, nullable>
|
|
196
196
|
|
|
197
|
+
/**
|
|
198
|
+
* When `_clipPathSVG` is defined, this represents the box shadow path element.
|
|
199
|
+
*/
|
|
200
|
+
_clipPathBoxShadowPath: undefined, // <DOMNode, nullable>
|
|
201
|
+
|
|
197
202
|
/**
|
|
198
203
|
* A string that forms part of the HTML IDs that will be assigned to the clip paths
|
|
199
204
|
* to be used on browsers.
|
|
@@ -258,24 +263,24 @@ BMPopover.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
258
263
|
this._size = size.copy();
|
|
259
264
|
|
|
260
265
|
// Set up the popover container
|
|
261
|
-
this.node.className = 'BMPopover';
|
|
262
|
-
this.contentNode.className = 'BMPopoverContainer BMPopoverContainerView';
|
|
266
|
+
this.node.className = 'BMDarkModeAuto BMPopover';
|
|
267
|
+
this.contentNode.className = 'BMDarkModeAuto BMPopoverContainer BMPopoverContainerView';
|
|
263
268
|
|
|
264
269
|
this._overlay.node.className = 'BMPopoverOverlay';
|
|
265
270
|
|
|
266
271
|
// A second layer is used to draw the drop shadow, due to the unusual shape of the popover window
|
|
267
272
|
const popoverDropShadowContainer = document.createElement('div');
|
|
268
|
-
popoverDropShadowContainer.className = 'BMPopoverContainerLayer BMPopoverDropShadowContainer';
|
|
273
|
+
popoverDropShadowContainer.className = 'BMDarkModeAuto BMPopoverContainerLayer BMPopoverDropShadowContainer';
|
|
269
274
|
const popoverDropShadowContent = document.createElement('div');
|
|
270
|
-
popoverDropShadowContent.className = 'BMPopoverDropShadowContent';
|
|
275
|
+
popoverDropShadowContent.className = 'BMDarkModeAuto BMPopoverDropShadowContent';
|
|
271
276
|
popoverDropShadowContainer.appendChild(popoverDropShadowContent);
|
|
272
277
|
|
|
273
278
|
// A third layer is used to draw the background
|
|
274
279
|
const popoverBackground = document.createElement('div');
|
|
275
|
-
popoverBackground.className = 'BMPopoverBackground';
|
|
280
|
+
popoverBackground.className = 'BMDarkModeAuto BMPopoverBackground';
|
|
276
281
|
|
|
277
282
|
// Two additional sublayers are used for dark mode and contain the outline and background color.
|
|
278
|
-
popoverBackground.innerHTML = '<div class="BMPopoverBackgroundDarkModeContainer"><div class="BMPopoverBackgroundDarkModeOutline"></div><div class="BMPopoverBackgroundDarkModeFill"></div></div>';
|
|
283
|
+
popoverBackground.innerHTML = '<div class="BMDarkModeAuto BMPopoverBackgroundDarkModeContainer"><div class="BMDarkModeAuto BMPopoverBackgroundDarkModeOutline"></div><div class="BMDarkModeAuto BMPopoverBackgroundDarkModeFill"></div></div>';
|
|
279
284
|
|
|
280
285
|
// Add the popover to the document
|
|
281
286
|
this.node.appendChild(popoverBackground);
|
|
@@ -310,6 +315,30 @@ BMPopover.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
310
315
|
return this.initWithSize(frame.size);
|
|
311
316
|
},
|
|
312
317
|
|
|
318
|
+
// @override - BMView
|
|
319
|
+
colorSchemeDidChange(scheme) {
|
|
320
|
+
BMWindow.prototype.colorSchemeDidChange.apply(this, arguments);
|
|
321
|
+
|
|
322
|
+
switch (this.colorScheme) {
|
|
323
|
+
case BMViewColorScheme.Light:
|
|
324
|
+
// Handled by BMWindow
|
|
325
|
+
break;
|
|
326
|
+
case BMViewColorScheme.Auto:
|
|
327
|
+
// For auto mode, add the BMDarkModeAuto class to the elements whose appearance should change
|
|
328
|
+
this._dropShadowContainer.classList.add('BMDarkModeAuto');
|
|
329
|
+
this._dropShadowContent.classList.add('BMDarkModeAuto');
|
|
330
|
+
this._background.classList.add('BMDarkModeAuto');
|
|
331
|
+
this._popoverDarkModeFill.classList.add('BMDarkModeAuto');
|
|
332
|
+
this._background.querySelector('.BMPopoverBackgroundDarkModeOutline').classList.add('BMDarkModeAuto');
|
|
333
|
+
this._background.querySelector('.BMPopoverBackgroundDarkModeContainer').classList.add('BMDarkModeAuto');
|
|
334
|
+
break;
|
|
335
|
+
case BMViewColorScheme.Dark:
|
|
336
|
+
// Dark is not yet supported
|
|
337
|
+
default:
|
|
338
|
+
throw new Error(`The color scheme ${scheme} is not supported on this view.`);
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
|
|
313
342
|
/**
|
|
314
343
|
* Invoked by CoreUI to update this popover's position and recalculate the various paths used by it.
|
|
315
344
|
*/
|
|
@@ -422,7 +451,8 @@ BMPopover.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
422
451
|
innerFrame.origin = BMPointMake();
|
|
423
452
|
|
|
424
453
|
const pathContent = `${this._pathForPopoverWithFrame(innerFrame, {indicatorSize: this._indicatorSize, position: indicatorPosition, direction, radius: this._borderRadius})}`;
|
|
425
|
-
const outlinePathContent = `${this._pathForPopoverWithFrame(innerFrame, {indicatorSize: this._indicatorSize, inset: 1, position: indicatorPosition, direction, radius: this._borderRadius})}`;
|
|
454
|
+
const outlinePathContent = `${this._pathForPopoverWithFrame(innerFrame, {indicatorSize: this._indicatorSize, inset: 1, position: indicatorPosition, direction, radius: this._borderRadius - 1.5})}`;
|
|
455
|
+
const boxShadowPathContent = `${this._pathForPopoverWithFrame(innerFrame, {indicatorSize: this._indicatorSize, position: indicatorPosition, direction, radius: this._borderRadius + 1.5})}`;
|
|
426
456
|
|
|
427
457
|
if (!this._clipPathUUID && !CSS.supports('clip-path', `path('${pathContent}')`)) {
|
|
428
458
|
// If inline path definitions are not supported by the browsers, create an UUID for a SVG clip path and create it
|
|
@@ -450,6 +480,15 @@ BMPopover.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
450
480
|
|
|
451
481
|
this._clipPathSVG.appendChild(outlineClipPath);
|
|
452
482
|
|
|
483
|
+
// Create and attach the shadow clip path
|
|
484
|
+
const boxShadowClipPath = document.createElementNS('http://www.w3.org/2000/svg', 'clipPath');
|
|
485
|
+
boxShadowClipPath.setAttribute('id', 'popover-box-shadow-clip-path-' + this._clipPathUUID);
|
|
486
|
+
boxShadowClipPath.setAttribute('clipPathUnits', 'userSpaceOnUse');
|
|
487
|
+
this._clipPathBoxShadowPath = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
488
|
+
boxShadowClipPath.appendChild(this._clipPathBoxShadowPath);
|
|
489
|
+
|
|
490
|
+
this._clipPathSVG.appendChild(boxShadowClipPath);
|
|
491
|
+
|
|
453
492
|
document.body.appendChild(this._clipPathSVG);
|
|
454
493
|
|
|
455
494
|
}
|
|
@@ -458,11 +497,13 @@ BMPopover.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
458
497
|
if (this._clipPathUUID) {
|
|
459
498
|
this._clipPathBackgroundPath.setAttribute('d', pathContent);
|
|
460
499
|
this._clipPathOutlinePath.setAttribute('d', outlinePathContent);
|
|
500
|
+
this._clipPathBoxShadowPath.setAttribute('d', boxShadowPathContent);
|
|
461
501
|
}
|
|
462
502
|
|
|
463
503
|
// For Blink/Chrome-based browsers clip-path: path() is not supported, but clip-path: url() can be used instead for that browser
|
|
464
504
|
const path = this._clipPathUUID ? `url(#popover-clip-path-${this._clipPathUUID})` : `path('${pathContent}')`;
|
|
465
|
-
const outlinePath = this._clipPathUUID ? `url(#popover
|
|
505
|
+
const outlinePath = this._clipPathUUID ? `url(#popover-outline-clip-path-${this._clipPathUUID})` : `path('${outlinePathContent}')`;
|
|
506
|
+
const boxShadowPath = this._clipPathUUID ? `url(#popover-box-shadow-clip-path-${this._clipPathUUID})` : `path('${boxShadowPathContent}')`;
|
|
466
507
|
|
|
467
508
|
// Assign the frame to the window, and to the drop shadow container
|
|
468
509
|
const positionStyle = {
|
|
@@ -482,8 +523,8 @@ BMPopover.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
482
523
|
popoverDarkModeFill.style.webkitClipPath = outlinePath;
|
|
483
524
|
|
|
484
525
|
BMCopyProperties(this._dropShadowContainer.style, positionStyle);
|
|
485
|
-
this._dropShadowContent.style.clipPath =
|
|
486
|
-
this._dropShadowContent.style.webkitClipPath =
|
|
526
|
+
this._dropShadowContent.style.clipPath = boxShadowPath;
|
|
527
|
+
this._dropShadowContent.style.webkitClipPath = boxShadowPath;
|
|
487
528
|
|
|
488
529
|
const popoverLayers = [this.contentNode, this._background, this._dropShadowContainer];
|
|
489
530
|
|
|
@@ -4,7 +4,7 @@ import {YES, NO, BMExtend, BMCopyProperties} from '../Core/BMCoreUI'
|
|
|
4
4
|
import {BMPointMake} from '../Core/BMPoint'
|
|
5
5
|
import {BMRectMake, BMRectMakeWithNodeFrame} from '../Core/BMRect'
|
|
6
6
|
import {BMAnimateWithBlock, BMAnimationContextGetCurrent, BMAnimationContextEnableWebAnimations, __BMVelocityAnimate, BMHook} from '../Core/BMAnimationContext'
|
|
7
|
-
import {BMView} from '../BMView/BMView_v2.5'
|
|
7
|
+
import {BMView, BMViewColorScheme} from '../BMView/BMView_v2.5'
|
|
8
8
|
import {BMLayoutOrientation} from '../BMView/BMLayoutSizeClass'
|
|
9
9
|
import { BMSizeMake } from '../Core/BMSize'
|
|
10
10
|
import { BMLayoutAttribute } from '../BMView/BMLayoutConstraint_v2.5'
|
|
@@ -730,7 +730,7 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
|
|
|
730
730
|
|
|
731
731
|
let node = document.createElement('div');
|
|
732
732
|
this._window = node;
|
|
733
|
-
node.className = 'BMWindow';
|
|
733
|
+
node.className = 'BMDarkModeAuto BMWindow';
|
|
734
734
|
|
|
735
735
|
BMCopyProperties(node.style, {
|
|
736
736
|
opacity: 0,
|
|
@@ -764,18 +764,18 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
|
|
|
764
764
|
}
|
|
765
765
|
|
|
766
766
|
this._content = document.createElement('div');
|
|
767
|
-
this._content.className = 'BMWindowContent';
|
|
767
|
+
this._content.className = 'BMDarkModeAuto BMWindowContent';
|
|
768
768
|
node.appendChild(this._content);
|
|
769
769
|
|
|
770
770
|
var withToolbar = (!args || args.toolbar === undefined) ? YES : args.toolbar;
|
|
771
771
|
|
|
772
772
|
if (withToolbar) {
|
|
773
773
|
this._toolbar = document.createElement('div');
|
|
774
|
-
this._toolbar.className = 'BMWindowToolbar';
|
|
774
|
+
this._toolbar.className = 'BMDarkModeAuto BMWindowToolbar';
|
|
775
775
|
node.appendChild(this._toolbar);
|
|
776
776
|
}
|
|
777
777
|
else {
|
|
778
|
-
this._content.className = 'BMWindowContent BMWindowFullContent';
|
|
778
|
+
this._content.className = 'BMDarkModeAuto BMWindowContent BMWindowFullContent';
|
|
779
779
|
}
|
|
780
780
|
|
|
781
781
|
document.body.appendChild(this._blocker);
|
|
@@ -940,7 +940,7 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
|
|
|
940
940
|
|
|
941
941
|
// Also create a drag handle to resize the window
|
|
942
942
|
let dragHandle = this._dragHandle = document.createElement('div');
|
|
943
|
-
dragHandle.className = 'material-icons BMWindowDragHandle';
|
|
943
|
+
dragHandle.className = 'material-icons BMWindowDragHandle BMDarkModeAuto';
|
|
944
944
|
dragHandle.innerText = 'dehaze';
|
|
945
945
|
dragHandle.style.cursor = 'nwse-resize';
|
|
946
946
|
node.appendChild(dragHandle);
|
|
@@ -1075,14 +1075,40 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
|
|
|
1075
1075
|
return this;
|
|
1076
1076
|
},
|
|
1077
1077
|
|
|
1078
|
+
// @override - BMView
|
|
1079
|
+
colorSchemeDidChange(scheme) {
|
|
1080
|
+
BMView.prototype.colorSchemeDidChange.apply(this, arguments);
|
|
1081
|
+
|
|
1082
|
+
switch (this.colorScheme) {
|
|
1083
|
+
case BMViewColorScheme.Light:
|
|
1084
|
+
// For light mode, remove the BMDarkModeAuto class from all elements
|
|
1085
|
+
this.node.querySelectorAll('.BMDarkModeAuto').forEach(n => n.classList.remove('BMDarkModeAuto'));
|
|
1086
|
+
this.node.classList.remove('BMDarkModeAuto');
|
|
1087
|
+
break;
|
|
1088
|
+
case BMViewColorScheme.Auto:
|
|
1089
|
+
// For auto mode, add the BMDarkModeAuto class to the elements whose appearance should change
|
|
1090
|
+
this.node.classList.add('BMDarkModeAuto');
|
|
1091
|
+
if (this._dragHandle) {
|
|
1092
|
+
this._dragHandle.classList.add('BMDarkModeAuto');
|
|
1093
|
+
}
|
|
1094
|
+
break;
|
|
1095
|
+
case BMViewColorScheme.Dark:
|
|
1096
|
+
// Dark is not yet supported
|
|
1097
|
+
default:
|
|
1098
|
+
throw new Error(`The color scheme ${scheme} is not supported on this view.`);
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
|
|
1078
1102
|
/**
|
|
1079
1103
|
* Invoked on non-modal windows when the viewport resizes.
|
|
1080
1104
|
* @param event <Event> The event that triggered this action.
|
|
1081
1105
|
*/
|
|
1082
1106
|
_viewportDidResize(event) {
|
|
1107
|
+
// Limit the window to not move past the new viewport size
|
|
1083
1108
|
this.maxRightConstraint.constant = window.innerWidth;
|
|
1084
1109
|
this.maxBottomConstraint.constant = window.innerHeight;
|
|
1085
1110
|
|
|
1111
|
+
// Full screen windows need to re-layout to match the new viewport size
|
|
1086
1112
|
if (this._fullScreen) this.layout();
|
|
1087
1113
|
},
|
|
1088
1114
|
|
package/build/Core/BMCoreUI.js
CHANGED
|
@@ -394,35 +394,47 @@ export var BMHTMLEntity = Object.freeze({ // <enum>
|
|
|
394
394
|
/**
|
|
395
395
|
* The HTML entity representing the control key.
|
|
396
396
|
*/
|
|
397
|
-
Control: '⌃', // <
|
|
397
|
+
Control: '⌃', // <String>
|
|
398
|
+
|
|
398
399
|
/**
|
|
399
400
|
* The HTML entity representing the bowen knot Command symbol.
|
|
400
401
|
*/
|
|
401
|
-
Command: '⌘', // <
|
|
402
|
+
Command: '⌘', // <String>
|
|
403
|
+
|
|
402
404
|
/**
|
|
403
405
|
* The HTML entity representing the Option symbol.
|
|
404
406
|
*/
|
|
405
|
-
Option: '⌥', // <
|
|
407
|
+
Option: '⌥', // <String>
|
|
408
|
+
|
|
406
409
|
/**
|
|
407
410
|
* The HTML entity representing the Shift symbol.
|
|
408
411
|
*/
|
|
409
|
-
Shift: '⇧', // <
|
|
412
|
+
Shift: '⇧', // <String>
|
|
413
|
+
|
|
410
414
|
/**
|
|
411
415
|
* The HTML entity representing the Caps-Lock symbol.
|
|
412
416
|
*/
|
|
413
|
-
CapsLock: '⇪', // <
|
|
417
|
+
CapsLock: '⇪', // <String>
|
|
418
|
+
|
|
414
419
|
/**
|
|
415
420
|
* The HTML entity representing the Backspace delete symbol.
|
|
416
421
|
*/
|
|
417
|
-
Delete: '⌫', // <
|
|
422
|
+
Delete: '⌫', // <String>
|
|
423
|
+
|
|
418
424
|
/**
|
|
419
425
|
* The HTML entity representing the Return symbol.
|
|
420
426
|
*/
|
|
421
|
-
Return: '⏎', // <
|
|
427
|
+
Return: '⏎', // <String>
|
|
428
|
+
|
|
422
429
|
/**
|
|
423
430
|
* The HTML entity representing the Escape symbol.
|
|
424
431
|
*/
|
|
425
|
-
Escape: '⎋', // <
|
|
432
|
+
Escape: '⎋', // <String>
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* The HTML entity representing the Tab symbol.
|
|
436
|
+
*/
|
|
437
|
+
Tab: '⇥', // <String>
|
|
426
438
|
});
|
|
427
439
|
|
|
428
440
|
// @endtype
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/images/CoreUI2.png
CHANGED
|
Binary file
|
|
Binary file
|
package/build/images/Desktop.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/images/Layout.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/images/Phone.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/images/Tablet.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|