@blackcube/aurelia2-bleet 1.0.0 → 1.0.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.
Binary file
package/dist/index.es.js CHANGED
@@ -1033,6 +1033,8 @@ var Channels;
1033
1033
  Channels["Profile"] = "bleet:profile";
1034
1034
  Channels["ProfileStatus"] = "bleet:profile:status";
1035
1035
  Channels["Ajaxify"] = "bleet:ajaxify";
1036
+ Channels["Popover"] = "bleet:popover";
1037
+ Channels["PopoverStatus"] = "bleet:popover:status";
1036
1038
  })(Channels || (Channels = {}));
1037
1039
  var OverlayAction;
1038
1040
  (function (OverlayAction) {
@@ -1117,6 +1119,19 @@ var MenuStatus;
1117
1119
  MenuStatus["Opened"] = "opened";
1118
1120
  MenuStatus["Closed"] = "closed";
1119
1121
  })(MenuStatus || (MenuStatus = {}));
1122
+ var PopoverAction;
1123
+ (function (PopoverAction) {
1124
+ PopoverAction["Open"] = "open";
1125
+ PopoverAction["Close"] = "close";
1126
+ PopoverAction["Toggle"] = "toggle";
1127
+ })(PopoverAction || (PopoverAction = {}));
1128
+ var PopoverStatus;
1129
+ (function (PopoverStatus) {
1130
+ PopoverStatus["Opening"] = "opening";
1131
+ PopoverStatus["Closing"] = "closing";
1132
+ PopoverStatus["Opened"] = "opened";
1133
+ PopoverStatus["Closed"] = "closed";
1134
+ })(PopoverStatus || (PopoverStatus = {}));
1120
1135
  var UiColor;
1121
1136
  (function (UiColor) {
1122
1137
  UiColor["Primary"] = "primary";
@@ -3160,6 +3175,181 @@ let BleetAjaxifyTriggerCustomAttribute = (() => {
3160
3175
  return _classThis;
3161
3176
  })();
3162
3177
 
3178
+ let BleetPopoverCustomAttribute = (() => {
3179
+ let _classDecorators = [customAttribute({ name: 'bleet-popover', defaultProperty: 'id' })];
3180
+ let _classDescriptor;
3181
+ let _classExtraInitializers = [];
3182
+ let _classThis;
3183
+ let _id_decorators;
3184
+ let _id_initializers = [];
3185
+ let _id_extraInitializers = [];
3186
+ (class {
3187
+ static { _classThis = this; }
3188
+ static {
3189
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
3190
+ _id_decorators = [bindable];
3191
+ __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
3192
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
3193
+ _classThis = _classDescriptor.value;
3194
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
3195
+ __runInitializers(_classThis, _classExtraInitializers);
3196
+ }
3197
+ logger;
3198
+ element;
3199
+ ea;
3200
+ id = __runInitializers(this, _id_initializers, '');
3201
+ isOpen = (__runInitializers(this, _id_extraInitializers), false);
3202
+ subscription = null;
3203
+ constructor(logger = resolve(ILogger).scopeTo('bleet-popover'), element = resolve(INode), ea = resolve(IEventAggregator)) {
3204
+ this.logger = logger;
3205
+ this.element = element;
3206
+ this.ea = ea;
3207
+ this.logger.trace('constructor');
3208
+ }
3209
+ attaching() {
3210
+ this.logger.trace('attaching');
3211
+ this.subscription = this.ea.subscribe(Channels.Popover, this.onPopover);
3212
+ }
3213
+ attached() {
3214
+ this.logger.trace('attached');
3215
+ }
3216
+ detaching() {
3217
+ this.logger.trace('detaching');
3218
+ this.subscription?.dispose();
3219
+ }
3220
+ dispose() {
3221
+ this.logger.trace('dispose');
3222
+ this.subscription?.dispose();
3223
+ }
3224
+ onPopover = (payload) => {
3225
+ if (payload.id !== this.id)
3226
+ return;
3227
+ switch (payload.action) {
3228
+ case PopoverAction.Open:
3229
+ this.open(payload.rect);
3230
+ break;
3231
+ case PopoverAction.Close:
3232
+ this.close();
3233
+ break;
3234
+ case PopoverAction.Toggle:
3235
+ if (this.isOpen) {
3236
+ this.close();
3237
+ }
3238
+ else {
3239
+ this.open(payload.rect);
3240
+ }
3241
+ break;
3242
+ }
3243
+ };
3244
+ open(rect) {
3245
+ this.isOpen = true;
3246
+ this.element.classList.add('is-open');
3247
+ if (rect) {
3248
+ this.positionAt(rect);
3249
+ }
3250
+ this.ea.publish(Channels.PopoverStatus, {
3251
+ status: PopoverStatus.Opened,
3252
+ id: this.id,
3253
+ });
3254
+ }
3255
+ close() {
3256
+ this.isOpen = false;
3257
+ this.element.classList.remove('is-open');
3258
+ this.ea.publish(Channels.PopoverStatus, {
3259
+ status: PopoverStatus.Closed,
3260
+ id: this.id,
3261
+ });
3262
+ }
3263
+ positionAt(rect) {
3264
+ this.element.style.visibility = 'hidden';
3265
+ this.element.style.display = 'block';
3266
+ const popoverRect = this.element.getBoundingClientRect();
3267
+ // Center above trigger
3268
+ let top = rect.top - popoverRect.height - 10;
3269
+ let left = rect.left + (rect.width / 2) - (popoverRect.width / 2);
3270
+ // Fallback below if not enough space above
3271
+ if (top < 4)
3272
+ top = rect.bottom + 10;
3273
+ // Clamp to viewport
3274
+ if (left < 4)
3275
+ left = 4;
3276
+ if (left + popoverRect.width > window.innerWidth - 4) {
3277
+ left = window.innerWidth - popoverRect.width - 4;
3278
+ }
3279
+ this.element.style.top = `${top}px`;
3280
+ this.element.style.left = `${left}px`;
3281
+ this.element.style.visibility = '';
3282
+ this.element.style.display = '';
3283
+ }
3284
+ });
3285
+ return _classThis;
3286
+ })();
3287
+
3288
+ let BleetPopoverTriggerCustomAttribute = (() => {
3289
+ let _classDecorators = [customAttribute({ name: 'bleet-popover-trigger', defaultProperty: 'id' })];
3290
+ let _classDescriptor;
3291
+ let _classExtraInitializers = [];
3292
+ let _classThis;
3293
+ let _id_decorators;
3294
+ let _id_initializers = [];
3295
+ let _id_extraInitializers = [];
3296
+ let _absolute_decorators;
3297
+ let _absolute_initializers = [];
3298
+ let _absolute_extraInitializers = [];
3299
+ (class {
3300
+ static { _classThis = this; }
3301
+ static {
3302
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
3303
+ _id_decorators = [bindable];
3304
+ _absolute_decorators = [bindable()];
3305
+ __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
3306
+ __esDecorate(null, null, _absolute_decorators, { kind: "field", name: "absolute", static: false, private: false, access: { has: obj => "absolute" in obj, get: obj => obj.absolute, set: (obj, value) => { obj.absolute = value; } }, metadata: _metadata }, _absolute_initializers, _absolute_extraInitializers);
3307
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
3308
+ _classThis = _classDescriptor.value;
3309
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
3310
+ __runInitializers(_classThis, _classExtraInitializers);
3311
+ }
3312
+ logger;
3313
+ element;
3314
+ ea;
3315
+ id = __runInitializers(this, _id_initializers, '');
3316
+ absolute = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _absolute_initializers, true));
3317
+ constructor(logger = resolve(ILogger).scopeTo('bleet-popover-trigger'), element = resolve(INode), ea = resolve(IEventAggregator)) {
3318
+ this.logger = logger;
3319
+ this.element = element;
3320
+ this.ea = ea;
3321
+ this.logger.trace('constructor');
3322
+ }
3323
+ attached() {
3324
+ this.logger.trace('attached');
3325
+ this.element.addEventListener('mouseenter', this.onMouseEnter);
3326
+ this.element.addEventListener('mouseleave', this.onMouseLeave);
3327
+ }
3328
+ detaching() {
3329
+ this.logger.trace('detaching');
3330
+ this.element.removeEventListener('mouseenter', this.onMouseEnter);
3331
+ this.element.removeEventListener('mouseleave', this.onMouseLeave);
3332
+ }
3333
+ dispose() {
3334
+ this.logger.trace('dispose');
3335
+ }
3336
+ onMouseEnter = (__runInitializers(this, _absolute_extraInitializers), () => {
3337
+ this.ea.publish(Channels.Popover, {
3338
+ id: this.id,
3339
+ action: PopoverAction.Open,
3340
+ rect: this.absolute ? this.element.getBoundingClientRect() : undefined,
3341
+ });
3342
+ });
3343
+ onMouseLeave = () => {
3344
+ this.ea.publish(Channels.Popover, {
3345
+ id: this.id,
3346
+ action: PopoverAction.Close,
3347
+ });
3348
+ };
3349
+ });
3350
+ return _classThis;
3351
+ })();
3352
+
3163
3353
  let BleetOverlay = (() => {
3164
3354
  let _classDecorators = [customElement({
3165
3355
  name: 'bleet-overlay',
@@ -4479,6 +4669,8 @@ const DefaultComponents = [
4479
4669
  BleetToasterTriggerCustomAttribute,
4480
4670
  BleetUploadCustomAttribute,
4481
4671
  BleetAjaxifyTriggerCustomAttribute,
4672
+ BleetPopoverCustomAttribute,
4673
+ BleetPopoverTriggerCustomAttribute,
4482
4674
  // components
4483
4675
  BleetOverlay,
4484
4676
  BleetToast,
@@ -4510,5 +4702,5 @@ function createBleetConfiguration(optionsCallback) {
4510
4702
  }
4511
4703
  const BleetConfiguration = createBleetConfiguration();
4512
4704
 
4513
- export { AjaxifyAction, AjaxifyCodec, BadgeAction, BleetAjaxify, BleetAjaxifyTriggerCustomAttribute, BleetAlertCustomAttribute, BleetBadgeCustomAttribute, BleetBurgerCustomAttribute, BleetConfiguration, BleetDrawer, BleetDrawerTriggerCustomAttribute, BleetDropdownCustomAttribute, BleetMenuCustomAttribute, BleetModal, BleetModalTriggerCustomAttribute, BleetOverlay, BleetPagerCustomAttribute, BleetPasswordCustomAttribute, BleetProfileCustomAttribute, Quilljs as BleetQuilljs, BleetSelectCustomAttribute, BleetTabsCustomAttribute, BleetToast, BleetToaster, BleetToasterTrigger, BleetToasterTriggerCustomAttribute, BleetUploadCustomAttribute, Channels, CsrfCodec, DialogAction, DrawerAction, DrawerStatus, IApiService, IHttpService, ISocketioService, IStorageService, ISvgService, ITransitionService, ITrapFocusService, MenuAction, MenuStatus, ModalAction, ModalStatus, OverlayAction, OverlayStatus, ProfileAction, ProfileStatus, RequestCodec, ToasterAction, ToasterStatus, Transport, UiColor, UiIcon, UiToastIcon };
4705
+ export { AjaxifyAction, AjaxifyCodec, BadgeAction, BleetAjaxify, BleetAjaxifyTriggerCustomAttribute, BleetAlertCustomAttribute, BleetBadgeCustomAttribute, BleetBurgerCustomAttribute, BleetConfiguration, BleetDrawer, BleetDrawerTriggerCustomAttribute, BleetDropdownCustomAttribute, BleetMenuCustomAttribute, BleetModal, BleetModalTriggerCustomAttribute, BleetOverlay, BleetPagerCustomAttribute, BleetPasswordCustomAttribute, BleetPopoverCustomAttribute, BleetPopoverTriggerCustomAttribute, BleetProfileCustomAttribute, Quilljs as BleetQuilljs, BleetSelectCustomAttribute, BleetTabsCustomAttribute, BleetToast, BleetToaster, BleetToasterTrigger, BleetToasterTriggerCustomAttribute, BleetUploadCustomAttribute, Channels, CsrfCodec, DialogAction, DrawerAction, DrawerStatus, IApiService, IHttpService, ISocketioService, IStorageService, ISvgService, ITransitionService, ITrapFocusService, MenuAction, MenuStatus, ModalAction, ModalStatus, OverlayAction, OverlayStatus, PopoverAction, PopoverStatus, ProfileAction, ProfileStatus, RequestCodec, ToasterAction, ToasterStatus, Transport, UiColor, UiIcon, UiToastIcon };
4514
4706
  //# sourceMappingURL=index.es.js.map