@primer/view-components 0.0.93 → 0.0.94
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/app/assets/javascripts/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/components/primer/alpha/{modal-dialog-element.d.ts → modal_dialog.d.ts} +0 -0
- package/app/components/primer/alpha/{modal-dialog-element.js → modal_dialog.js} +0 -0
- package/app/components/primer/alpha/{toggle-switch-element.d.ts → toggle_switch.d.ts} +0 -0
- package/app/components/primer/alpha/{toggle-switch-element.js → toggle_switch.js} +4 -2
- package/app/components/primer/alpha/{tool-tip-element.d.ts → tool_tip.d.ts} +0 -0
- package/app/components/primer/alpha/{tool-tip-element.js → tool_tip.js} +0 -0
- package/app/components/primer/{clipboard_copy_component.d.ts → clipboard_copy.d.ts} +0 -0
- package/app/components/primer/{clipboard_copy_component.js → clipboard_copy.js} +1 -1
- package/app/components/primer/primer.d.ts +7 -7
- package/app/components/primer/primer.js +7 -7
- package/package.json +4 -3
- package/app/components/primer/experimental/action-bar-element.d.ts +0 -14
- package/app/components/primer/experimental/action-bar-element.js +0 -139
- package/app/components/primer/experimental/action-menu-element.d.ts +0 -31
- package/app/components/primer/experimental/action-menu-element.js +0 -334
- package/app/components/primer/experimental/overflow-menu-element.d.ts +0 -13
- package/app/components/primer/experimental/overflow-menu-element.js +0 -113
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/* eslint-disable custom-elements/expose-class-on-global */
|
|
2
|
-
/* eslint-disable custom-elements/define-tag-after-class-definition */
|
|
3
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8
|
-
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
11
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
12
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13
|
-
};
|
|
14
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
15
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
16
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
17
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
18
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
19
|
-
};
|
|
20
|
-
var _ActionBarElement_instances, _ActionBarElement_observer, _ActionBarElement_initialBarWidth, _ActionBarElement_calculateVisibility, _ActionBarElement_hideItems, _ActionBarElement_showItems, _ActionBarElement_hiddenItems, _ActionBarElement_toggleMoreMenu, _ActionBarElement_gap;
|
|
21
|
-
import { controller, targets, target } from '@github/catalyst';
|
|
22
|
-
import { positionedOffset } from '@primer/behaviors';
|
|
23
|
-
let ActionBarElement = class ActionBarElement extends HTMLElement {
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
_ActionBarElement_instances.add(this);
|
|
27
|
-
// eslint-disable-next-line prettier/prettier
|
|
28
|
-
_ActionBarElement_observer.set(this, void 0);
|
|
29
|
-
_ActionBarElement_initialBarWidth.set(this, void 0);
|
|
30
|
-
}
|
|
31
|
-
connectedCallback() {
|
|
32
|
-
let overflowItemsCount = 0;
|
|
33
|
-
for (const item of this.items) {
|
|
34
|
-
const offset = positionedOffset(item, this);
|
|
35
|
-
if (offset && offset.left < 0) {
|
|
36
|
-
overflowItemsCount++;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hideItems).call(this, overflowItemsCount);
|
|
40
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_toggleMoreMenu).call(this);
|
|
41
|
-
__classPrivateFieldSet(this, _ActionBarElement_initialBarWidth, this.offsetWidth, "f");
|
|
42
|
-
__classPrivateFieldSet(this, _ActionBarElement_observer, new ResizeObserver(entries => {
|
|
43
|
-
for (const entry of entries) {
|
|
44
|
-
if (__classPrivateFieldGet(this, _ActionBarElement_initialBarWidth, "f") !== entry.contentRect.width) {
|
|
45
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_calculateVisibility).call(this);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}), "f");
|
|
49
|
-
__classPrivateFieldGet(this, _ActionBarElement_observer, "f").observe(this);
|
|
50
|
-
}
|
|
51
|
-
disconnectedCallback() {
|
|
52
|
-
__classPrivateFieldGet(this, _ActionBarElement_observer, "f").unobserve(this);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
_ActionBarElement_observer = new WeakMap(), _ActionBarElement_initialBarWidth = new WeakMap(), _ActionBarElement_instances = new WeakSet(), _ActionBarElement_calculateVisibility = function _ActionBarElement_calculateVisibility() {
|
|
56
|
-
const firstItem = this.items[0];
|
|
57
|
-
if (firstItem.hidden && this.offsetWidth >= firstItem.offsetWidth + __classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_gap).call(this)) {
|
|
58
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_showItems).call(this, 1);
|
|
59
|
-
}
|
|
60
|
-
const offset = positionedOffset(firstItem, this);
|
|
61
|
-
if (!offset) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (offset.left < 0) {
|
|
65
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hideItems).call(this, 1);
|
|
66
|
-
}
|
|
67
|
-
else if (offset.left >= firstItem.offsetWidth + __classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_gap).call(this)) {
|
|
68
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_showItems).call(this, 1);
|
|
69
|
-
}
|
|
70
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_toggleMoreMenu).call(this);
|
|
71
|
-
}, _ActionBarElement_hideItems = function _ActionBarElement_hideItems(count) {
|
|
72
|
-
const reversedItems = this.items.slice().reverse().filter(item => !item.hidden);
|
|
73
|
-
const reversedMenuItems = this.menuItems.slice().reverse().filter(item => item.hidden);
|
|
74
|
-
for (const i of [...Array(count).keys()]) {
|
|
75
|
-
if (reversedItems[i]) {
|
|
76
|
-
reversedItems[i].hidden = true;
|
|
77
|
-
}
|
|
78
|
-
if (reversedMenuItems[i]) {
|
|
79
|
-
reversedMenuItems[i].hidden = false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, _ActionBarElement_showItems = function _ActionBarElement_showItems(count) {
|
|
83
|
-
const items = __classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hiddenItems).call(this);
|
|
84
|
-
const menuItems = this.menuItems.filter(item => !item.hidden);
|
|
85
|
-
for (const i of [...Array(count).keys()]) {
|
|
86
|
-
if (items[i]) {
|
|
87
|
-
items[i].hidden = false;
|
|
88
|
-
}
|
|
89
|
-
if (menuItems[i]) {
|
|
90
|
-
menuItems[i].hidden = true;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}, _ActionBarElement_hiddenItems = function _ActionBarElement_hiddenItems() {
|
|
94
|
-
return this.items.filter(item => item.hidden);
|
|
95
|
-
}, _ActionBarElement_toggleMoreMenu = function _ActionBarElement_toggleMoreMenu() {
|
|
96
|
-
this.moreMenu.hidden = __classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hiddenItems).call(this).length === 0;
|
|
97
|
-
}, _ActionBarElement_gap = function _ActionBarElement_gap() {
|
|
98
|
-
var _a;
|
|
99
|
-
return parseInt((_a = window.getComputedStyle(this)) === null || _a === void 0 ? void 0 : _a.columnGap) || 0;
|
|
100
|
-
};
|
|
101
|
-
__decorate([
|
|
102
|
-
targets
|
|
103
|
-
], ActionBarElement.prototype, "items", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
targets
|
|
106
|
-
], ActionBarElement.prototype, "menuItems", void 0);
|
|
107
|
-
__decorate([
|
|
108
|
-
target
|
|
109
|
-
], ActionBarElement.prototype, "moreMenu", void 0);
|
|
110
|
-
ActionBarElement = __decorate([
|
|
111
|
-
controller
|
|
112
|
-
], ActionBarElement);
|
|
113
|
-
export { ActionBarElement };
|