saby-customizer 0.0.6 → 0.0.8

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.
@@ -1,4 +1,4 @@
1
- import { toolbar } from 'saby-customizer/lib.js'
1
+ import { toolbar, sendCloudStatistic } from 'saby-customizer/lib.js'
2
2
  import { octicons } from 'saby-customizer/octicons.js'
3
3
  import { GitBranchCardData } from 'saby-customizer/features/git-branch.js'
4
4
 
@@ -11,6 +11,7 @@ toolbar.addButton({
11
11
  onclick: card => {
12
12
  const gitCard = new GitBranchCardData(card.data)
13
13
 
14
+ sendCloudStatistic('Тулбар задачи', 'Копирование ссылки')
14
15
  gitCard.restoreFromHistory()
15
16
  .then(() => gitCard.copyLink())
16
17
  .catch(console.error)
@@ -1,5 +1,5 @@
1
1
  import { oom } from '@notml/core'
2
- import { toolbar, PopupDialog, getListOfOpenCards, snackbar, context, db } from 'saby-customizer/lib.js'
2
+ import { toolbar, PopupDialog, getListOfOpenCards, snackbar, context, db, sendCloudStatistic } from 'saby-customizer/lib.js'
3
3
  import { octicons } from 'saby-customizer/octicons.js'
4
4
 
5
5
 
@@ -110,6 +110,7 @@ export class GitBranchCardData {
110
110
 
111
111
  /** Копирование ссылки на задачу */
112
112
  copyLink() {
113
+ sendCloudStatistic('Типы задач', this.name)
113
114
  navigator.clipboard.writeText(this.raw.url)
114
115
  snackbar.show(`Скопирована ссылка: ${this.raw.url}`)
115
116
  }
@@ -118,6 +119,7 @@ export class GitBranchCardData {
118
119
  async copyBranchName() {
119
120
  const branchName = await this.getBranchName()
120
121
 
122
+ sendCloudStatistic('Типы задач', this.name)
121
123
  navigator.clipboard.writeText(branchName)
122
124
  snackbar.show(`Скопировано имя ветки: ${branchName}`)
123
125
 
@@ -132,6 +134,7 @@ export class GitBranchCardData {
132
134
  this.raw.url + '\n' +
133
135
  this.raw.description
134
136
 
137
+ sendCloudStatistic('Типы задач', this.name)
135
138
  navigator.clipboard.writeText(description)
136
139
  snackbar.show(`Скопировано описание для git commit:\n${description}`)
137
140
 
@@ -321,7 +324,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
321
324
  }).dom,
322
325
  /** @type {import('@material/mwc-icon-button').IconButton} */// @ts-ignore
323
326
  descriptionEdit: oom.mwcIconButton({
324
- title: 'Редактировать описание для git commit',
327
+ title: 'Редактировать описание для Git коммита',
325
328
  class: 'icon_18',
326
329
  innerHTML: octicons.pencil.toSVG({ width: 18 }),
327
330
  onclick: () => this.editDescription()
@@ -512,6 +515,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
512
515
 
513
516
  /** Открывает форму редактирования редактирование описания для коммита */
514
517
  editDescription() {
518
+ sendCloudStatistic('Диалог - Ветки для Git', 'Редактирование описания для Git коммита')
515
519
  this.elements.descriptionEdit.classList.toggle('hide')
516
520
  this.elements.description.classList.toggle('hide')
517
521
  this.elements.descriptionTextarea.classList.toggle('hide')
@@ -531,11 +535,13 @@ class GitBranchCard extends oom.extends(HTMLElement) {
531
535
  const version = this.versionsList[index]
532
536
 
533
537
  if (version === 'Произвольная') {
538
+ sendCloudStatistic('Диалог - Ветки для Git', 'Выбор произвольной версии для ветки Git')
534
539
  this.elements.branchVersionTextfield.classList.toggle('hide')
535
540
  this.elements.branchButton.classList.toggle('hide')
536
541
  this.elements.branchVersionTextfield.focus()
537
542
  this.elements.branchVersionTextfield.select()
538
543
  } else {
544
+ sendCloudStatistic('Диалог - Ветки для Git', 'Выбор версии для ветки Git из списка')
539
545
  this.version = version
540
546
  }
541
547
  }
@@ -570,6 +576,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
570
576
 
571
577
  /** Открывает форму редактирования доп. имени ветки */
572
578
  editBranchSubName() {
579
+ sendCloudStatistic('Диалог - Ветки для Git', 'Редактирование имени ветки для Git')
573
580
  this.elements.branchSubName.classList.toggle('hide')
574
581
  this.elements.branchSubNameTextfield.classList.toggle('hide')
575
582
  this.elements.branchSubNameTextfield.focus()
@@ -593,6 +600,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
593
600
 
594
601
  /** Копирование ссылки на задачу */
595
602
  copyLink() {
603
+ sendCloudStatistic('Диалог - Ветки для Git', 'Копирование ссылки')
596
604
  this.data.copyLink()
597
605
  }
598
606
 
@@ -602,6 +610,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
602
610
  this.elements.branchVersionTextfield.checkValidity()
603
611
 
604
612
  if (valid) {
613
+ sendCloudStatistic('Диалог - Ветки для Git', 'Копирование ветки для Git')
605
614
  await this.data.copyBranchName()
606
615
  }
607
616
  }
@@ -612,6 +621,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
612
621
  this.elements.branchVersionTextfield.checkValidity()
613
622
 
614
623
  if (valid) {
624
+ sendCloudStatistic('Диалог - Ветки для Git', 'Копирование описания для Git коммита')
615
625
  await this.data.copyDescription()
616
626
  }
617
627
  }
@@ -689,6 +699,7 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
689
699
  this.openTaskList.dom.classList.remove('hide')
690
700
  break
691
701
  case 1:
702
+ sendCloudStatistic('Диалог - Ветки для Git', 'Открытие истории задач')
692
703
  this.historyTaskList({ innerHTML: '' }, oom.div({ class: 'empty' }, 'Загрузка ...'))
693
704
  this.openTaskList.dom.classList.add('hide')
694
705
  this.historyTaskList.dom.classList.remove('hide')
@@ -782,11 +793,14 @@ toolbar.addButton({
782
793
  title: 'История веток для Git (Alt+H)',
783
794
  iconSVG: octicons['git-branch'].toSVG({ width: 24 }),
784
795
  keysMapping: 'alt-KeyH',
785
- onclick: () => PopupDialog.toggle({
786
- key: 'git-branch-dialog',
787
- title: 'Ветки для Git',
788
- Element: GitBranchCardList
789
- })
796
+ onclick: () => {
797
+ sendCloudStatistic('Правая панель', 'Открытие диалога - Ветки для Git')
798
+ PopupDialog.toggle({
799
+ key: 'git-branch-dialog',
800
+ title: 'Ветки для Git',
801
+ Element: GitBranchCardList
802
+ })
803
+ }
790
804
  })
791
805
 
792
806
  toolbar.addButton({
@@ -798,6 +812,7 @@ toolbar.addButton({
798
812
  onclick: card => {
799
813
  const gitCard = new GitBranchCardData(card.data)
800
814
 
815
+ sendCloudStatistic('Тулбар задачи', 'Копирование ветки для Git')
801
816
  gitCard.restoreFromHistory()
802
817
  .then(() => gitCard.copyBranchName())
803
818
  .catch(console.error)
@@ -812,6 +827,7 @@ toolbar.addButton({
812
827
  onclick: card => {
813
828
  const gitCard = new GitBranchCardData(card.data)
814
829
 
830
+ sendCloudStatistic('Тулбар задачи', 'Копирование описания для Git коммита')
815
831
  gitCard.restoreFromHistory()
816
832
  .then(() => gitCard.copyDescription())
817
833
  .catch(console.error)
@@ -827,6 +843,7 @@ toolbar.addButton({
827
843
  const links = []
828
844
  const view = card.element.querySelector('.fed2-DocumentPrint__content-view')?.shadowRoot
829
845
 
846
+ sendCloudStatistic('Тулбар задачи', 'Открытие ветки для Review кода')
830
847
  if (view) {
831
848
  const rows = Array.from(view.querySelectorAll('.git_row'))
832
849
  const rc = `div[title="rc-${card.data.version}"]`
@@ -846,6 +863,7 @@ toolbar.addButton({
846
863
  window.open(link, '_blank')
847
864
  }
848
865
  } else {
866
+ sendCloudStatistic('Ошибки SABY Customizer', 'Не удалось найти ветки для Review кода')
849
867
  snackbar.show('Не удалось найти ветки для Review кода')
850
868
  }
851
869
  }
@@ -1,3 +1,25 @@
1
- // Собрать стату по использованию фич кастомайзера
2
- // https://online.sbis.ru/news/4a005fd5-c99b-4e8d-a78b-eeb67b78d892
3
- // https://git.sbis.ru/contragents/online/-/blob/rc-22.1200/client/ContractorCommon/_statisticCollection/Helper.ts
1
+ /*
2
+ Сбор статы по использованию фич кастомайзера
3
+ */
4
+ /* global requirejs */
5
+ let sendStatistic = null
6
+ const loadSender = () => new Promise((resolve) => {
7
+ if (sendStatistic) {
8
+ return resolve(sendStatistic)
9
+ }
10
+ requirejs(['CloudStatisticsHelper/cloudStatisticsHelper'], ({ sendCloudStatistic }) => {
11
+ sendStatistic = sendCloudStatistic
12
+ resolve(sendStatistic)
13
+ })
14
+ })
15
+
16
+ /**
17
+ * Отправка прикладной статистики
18
+ * @param {string} context Элемент системы
19
+ * @param {string} action Действие
20
+ */
21
+ export function sendCloudStatistic(context, action) {
22
+ loadSender().then((sendStatistic) => {
23
+ sendStatistic({ functionality: 'SABY Customizer', context, action })
24
+ })
25
+ }
@@ -1,5 +1,6 @@
1
1
  const replaceDocTypeName = {
2
2
  'Error': 'Ошибка',
3
+ 'Ошибка на стенде': 'Ошибка',
3
4
  'Task to Development': 'Задача',
4
5
  'Задача в разработку': 'Задача',
5
6
  'Изменение документации разработки': 'ЗадачаДок',
package/lib.js CHANGED
@@ -3,6 +3,7 @@ export * from './lib/database.js'
3
3
  export * from './lib/hotkeys.js'
4
4
  export * from './lib/layout.js'
5
5
  export * from './lib/popup-dialog.js'
6
+ export * from './lib/saby-lib/cloud-statistic.js'
6
7
  export * from './lib/saby-lib/edo.js'
7
8
  export * from './lib/saby-lib/rpc.js'
8
9
  export * from './lib/saby-lib/toolbar.js'
package/material.js CHANGED
@@ -173,16 +173,6 @@ function query(selector, cache) {
173
173
  enumerable: true,
174
174
  configurable: true,
175
175
  };
176
- if (cache) {
177
- const key = typeof name === 'symbol' ? Symbol() : `__${name}`;
178
- descriptor.get = function () {
179
- var _a, _b;
180
- if (this[key] === undefined) {
181
- this[key] = (_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0 ? _b : null;
182
- }
183
- return this[key];
184
- };
185
- }
186
176
  return descriptor;
187
177
  },
188
178
  });
@@ -232,11 +222,7 @@ function queryAssignedElements(options) {
232
222
  function queryAssignedNodes(slotOrOptions, flatten, selector) {
233
223
  let slot = slotOrOptions;
234
224
  let assignedNodesOptions;
235
- if (typeof slotOrOptions === 'object') {
236
- slot = slotOrOptions.slot;
237
- assignedNodesOptions = slotOrOptions;
238
- }
239
- else {
225
+ {
240
226
  assignedNodesOptions = { flatten };
241
227
  }
242
228
  if (selector) {
@@ -250,7 +236,7 @@ function queryAssignedNodes(slotOrOptions, flatten, selector) {
250
236
  descriptor: (_name) => ({
251
237
  get() {
252
238
  var _a, _b;
253
- const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;
239
+ const slotSelector = `slot${':not([name])'}`;
254
240
  const slotEl = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(slotSelector);
255
241
  return (_b = slotEl === null || slotEl === void 0 ? void 0 : slotEl.assignedNodes(assignedNodesOptions)) !== null && _b !== void 0 ? _b : [];
256
242
  },
@@ -500,12 +486,12 @@ function queryAssignedNodes(slotOrOptions, flatten, selector) {
500
486
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
501
487
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
502
488
  (function () {
503
- if (typeof window === 'undefined') {
489
+ if (typeof window === 'undefined' || typeof Element === 'undefined') {
504
490
  return;
505
491
  }
506
492
  var slice = Array.prototype.slice;
507
493
  var matches = Element.prototype.matches || Element.prototype.msMatchesSelector;
508
- var _focusableElementsString = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'details', 'summary', 'iframe', 'object', 'embed', '[contenteditable]'].join(',');
494
+ var _focusableElementsString = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'details', 'summary', 'iframe', 'object', 'embed', 'video', '[contenteditable]'].join(',');
509
495
  var InertRoot = function () {
510
496
  function InertRoot(rootElement, inertManager) {
511
497
  _classCallCheck(this, InertRoot);
@@ -1494,7 +1480,7 @@ const cssResultFromStyleSheet = (sheet) => {
1494
1480
  return unsafeCSS(cssText);
1495
1481
  };
1496
1482
  const getCompatibleStyle = supportsAdoptingStyleSheets ||
1497
- (NODE_MODE )
1483
+ (NODE_MODE)
1498
1484
  ? (s) => s
1499
1485
  : (s) => s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;
1500
1486
 
@@ -3122,10 +3108,7 @@ const PartType = {
3122
3108
  ATTRIBUTE: 1,
3123
3109
  CHILD: 2,
3124
3110
  PROPERTY: 3,
3125
- BOOLEAN_ATTRIBUTE: 4,
3126
- EVENT: 5,
3127
- ELEMENT: 6,
3128
- };
3111
+ BOOLEAN_ATTRIBUTE: 4};
3129
3112
  const directive = (c) => (...values) => ({
3130
3113
  ['_$litDirective$']: c,
3131
3114
  values,
@@ -10470,7 +10453,7 @@ var MDCTopAppBarFoundation = (function (_super) {
10470
10453
  if (this.checkForUpdate()) {
10471
10454
  var offset = this.currentAppBarOffsetTop;
10472
10455
  if (Math.abs(offset) >= this.topAppBarHeight) {
10473
- offset = -numbers$1.MAX_TOP_APP_BAR_HEIGHT;
10456
+ offset = -128;
10474
10457
  }
10475
10458
  this.adapter.setStyle('top', offset + 'px');
10476
10459
  }
package/octicons.js CHANGED
@@ -19534,128 +19534,143 @@ var require$$0 = {
19534
19534
  }
19535
19535
  };
19536
19536
 
19537
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
19538
- var hasOwnProperty = Object.prototype.hasOwnProperty;
19539
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
19540
- function toObject(val) {
19541
- if (val === null || val === undefined) {
19542
- throw new TypeError('Object.assign cannot be called with null or undefined');
19543
- }
19544
- return Object(val);
19545
- }
19546
- function shouldUseNative() {
19547
- try {
19548
- if (!Object.assign) {
19549
- return false;
19550
- }
19551
- var test1 = new String('abc');
19552
- test1[5] = 'de';
19553
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
19537
+ var objectAssign;
19538
+ var hasRequiredObjectAssign;
19539
+ function requireObjectAssign () {
19540
+ if (hasRequiredObjectAssign) return objectAssign;
19541
+ hasRequiredObjectAssign = 1;
19542
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
19543
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
19544
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
19545
+ function toObject(val) {
19546
+ if (val === null || val === undefined) {
19547
+ throw new TypeError('Object.assign cannot be called with null or undefined');
19548
+ }
19549
+ return Object(val);
19550
+ }
19551
+ function shouldUseNative() {
19552
+ try {
19553
+ if (!Object.assign) {
19554
+ return false;
19555
+ }
19556
+ var test1 = new String('abc');
19557
+ test1[5] = 'de';
19558
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
19559
+ return false;
19560
+ }
19561
+ var test2 = {};
19562
+ for (var i = 0; i < 10; i++) {
19563
+ test2['_' + String.fromCharCode(i)] = i;
19564
+ }
19565
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
19566
+ return test2[n];
19567
+ });
19568
+ if (order2.join('') !== '0123456789') {
19569
+ return false;
19570
+ }
19571
+ var test3 = {};
19572
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
19573
+ test3[letter] = letter;
19574
+ });
19575
+ if (Object.keys(Object.assign({}, test3)).join('') !==
19576
+ 'abcdefghijklmnopqrst') {
19577
+ return false;
19578
+ }
19579
+ return true;
19580
+ } catch (err) {
19554
19581
  return false;
19555
19582
  }
19556
- var test2 = {};
19557
- for (var i = 0; i < 10; i++) {
19558
- test2['_' + String.fromCharCode(i)] = i;
19559
- }
19560
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
19561
- return test2[n];
19562
- });
19563
- if (order2.join('') !== '0123456789') {
19564
- return false;
19565
- }
19566
- var test3 = {};
19567
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
19568
- test3[letter] = letter;
19569
- });
19570
- if (Object.keys(Object.assign({}, test3)).join('') !==
19571
- 'abcdefghijklmnopqrst') {
19572
- return false;
19573
- }
19574
- return true;
19575
- } catch (err) {
19576
- return false;
19577
19583
  }
19578
- }
19579
- var objectAssign$1 = shouldUseNative() ? Object.assign : function (target, source) {
19580
- var from;
19581
- var to = toObject(target);
19582
- var symbols;
19583
- for (var s = 1; s < arguments.length; s++) {
19584
- from = Object(arguments[s]);
19585
- for (var key in from) {
19586
- if (hasOwnProperty.call(from, key)) {
19587
- to[key] = from[key];
19588
- }
19589
- }
19590
- if (getOwnPropertySymbols) {
19591
- symbols = getOwnPropertySymbols(from);
19592
- for (var i = 0; i < symbols.length; i++) {
19593
- if (propIsEnumerable.call(from, symbols[i])) {
19594
- to[symbols[i]] = from[symbols[i]];
19584
+ objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
19585
+ var from;
19586
+ var to = toObject(target);
19587
+ var symbols;
19588
+ for (var s = 1; s < arguments.length; s++) {
19589
+ from = Object(arguments[s]);
19590
+ for (var key in from) {
19591
+ if (hasOwnProperty.call(from, key)) {
19592
+ to[key] = from[key];
19593
+ }
19594
+ }
19595
+ if (getOwnPropertySymbols) {
19596
+ symbols = getOwnPropertySymbols(from);
19597
+ for (var i = 0; i < symbols.length; i++) {
19598
+ if (propIsEnumerable.call(from, symbols[i])) {
19599
+ to[symbols[i]] = from[symbols[i]];
19600
+ }
19595
19601
  }
19596
19602
  }
19597
19603
  }
19598
- }
19599
- return to;
19600
- };
19601
- getDefaultExportFromCjs(objectAssign$1);
19602
-
19603
- const data = require$$0;
19604
- const objectAssign = objectAssign$1;
19605
- const DEFAULT_HEIGHT = 16;
19606
- for (const key of Object.keys(data)) {
19607
- const htmlAttributes = (icon, defaultOptions, options) => {
19608
- const attributes = [];
19609
- const attrObj = objectAssign({}, defaultOptions, options);
19610
- if (options) {
19611
- if (options['width'] || options['height']) {
19612
- attrObj['width'] = options['width']
19613
- ? options['width']
19614
- : (parseInt(options['height']) * defaultOptions['width']) / defaultOptions['height'];
19615
- attrObj['height'] = options['height']
19616
- ? options['height']
19617
- : (parseInt(options['width']) * defaultOptions['height']) / defaultOptions['width'];
19618
- }
19619
- if (options['class']) {
19620
- attrObj['class'] = `octicon octicon-${key} ${options['class']}`;
19621
- attrObj['class'].trim();
19622
- }
19623
- if (options['aria-label']) {
19624
- attrObj['aria-label'] = options['aria-label'];
19625
- attrObj['role'] = 'img';
19626
- delete attrObj['aria-hidden'];
19627
- }
19628
- }
19629
- for (const option of Object.keys(attrObj)) {
19630
- attributes.push(`${option}="${attrObj[option]}"`);
19631
- }
19632
- return attributes.join(' ').trim()
19633
- };
19634
- data[key].symbol = key;
19635
- for (const height of Object.keys(data[key].heights)) {
19636
- data[key].heights[height].options = {
19637
- version: '1.1',
19638
- width: data[key].heights[height].width,
19639
- height: parseInt(height),
19640
- viewBox: `0 0 ${data[key].heights[height].width} ${height}`,
19641
- class: `octicon octicon-${key}`,
19642
- 'aria-hidden': 'true'
19643
- };
19644
- }
19645
- data[key].toSVG = function (options = {}) {
19646
- const {height, width} = options;
19647
- const naturalHeight = closestNaturalHeight(Object.keys(data[key].heights), height || width || DEFAULT_HEIGHT);
19648
- return `<svg ${htmlAttributes(data[key], data[key].heights[naturalHeight].options, options)}>${
19649
- data[key].heights[naturalHeight].path
19650
- }</svg>`
19651
- };
19604
+ return to;
19605
+ };
19606
+ return objectAssign;
19652
19607
  }
19653
- var octicons = data;
19654
- function closestNaturalHeight(naturalHeights, height) {
19655
- return naturalHeights
19656
- .map(naturalHeight => parseInt(naturalHeight, 10))
19657
- .reduce((acc, naturalHeight) => (naturalHeight <= height ? naturalHeight : acc), naturalHeights[0])
19608
+
19609
+ var octicons;
19610
+ var hasRequiredOcticons;
19611
+ function requireOcticons () {
19612
+ if (hasRequiredOcticons) return octicons;
19613
+ hasRequiredOcticons = 1;
19614
+ const data = require$$0;
19615
+ const objectAssign = requireObjectAssign();
19616
+ const DEFAULT_HEIGHT = 16;
19617
+ for (const key of Object.keys(data)) {
19618
+ const htmlAttributes = (icon, defaultOptions, options) => {
19619
+ const attributes = [];
19620
+ const attrObj = objectAssign({}, defaultOptions, options);
19621
+ if (options) {
19622
+ if (options['width'] || options['height']) {
19623
+ attrObj['width'] = options['width']
19624
+ ? options['width']
19625
+ : (parseInt(options['height']) * defaultOptions['width']) / defaultOptions['height'];
19626
+ attrObj['height'] = options['height']
19627
+ ? options['height']
19628
+ : (parseInt(options['width']) * defaultOptions['height']) / defaultOptions['width'];
19629
+ }
19630
+ if (options['class']) {
19631
+ attrObj['class'] = `octicon octicon-${key} ${options['class']}`;
19632
+ attrObj['class'].trim();
19633
+ }
19634
+ if (options['aria-label']) {
19635
+ attrObj['aria-label'] = options['aria-label'];
19636
+ attrObj['role'] = 'img';
19637
+ delete attrObj['aria-hidden'];
19638
+ }
19639
+ }
19640
+ for (const option of Object.keys(attrObj)) {
19641
+ attributes.push(`${option}="${attrObj[option]}"`);
19642
+ }
19643
+ return attributes.join(' ').trim()
19644
+ };
19645
+ data[key].symbol = key;
19646
+ for (const height of Object.keys(data[key].heights)) {
19647
+ data[key].heights[height].options = {
19648
+ version: '1.1',
19649
+ width: data[key].heights[height].width,
19650
+ height: parseInt(height),
19651
+ viewBox: `0 0 ${data[key].heights[height].width} ${height}`,
19652
+ class: `octicon octicon-${key}`,
19653
+ 'aria-hidden': 'true'
19654
+ };
19655
+ }
19656
+ data[key].toSVG = function (options = {}) {
19657
+ const {height, width} = options;
19658
+ const naturalHeight = closestNaturalHeight(Object.keys(data[key].heights), height || width || DEFAULT_HEIGHT);
19659
+ return `<svg ${htmlAttributes(data[key], data[key].heights[naturalHeight].options, options)}>${
19660
+ data[key].heights[naturalHeight].path
19661
+ }</svg>`
19662
+ };
19663
+ }
19664
+ octicons = data;
19665
+ function closestNaturalHeight(naturalHeights, height) {
19666
+ return naturalHeights
19667
+ .map(naturalHeight => parseInt(naturalHeight, 10))
19668
+ .reduce((acc, naturalHeight) => (naturalHeight <= height ? naturalHeight : acc), naturalHeights[0])
19669
+ }
19670
+ return octicons;
19658
19671
  }
19659
- var index = getDefaultExportFromCjs(octicons);
19672
+
19673
+ var octiconsExports = requireOcticons();
19674
+ var index = /*@__PURE__*/getDefaultExportFromCjs(octiconsExports);
19660
19675
 
19661
19676
  export { index as octicons };
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "repository": "github:saby-customizer/saby-customizer.github.io",
11
11
  "license": "Unlicense",
12
- "version": "0.0.6",
12
+ "version": "0.0.8",
13
13
  "type": "module",
14
14
  "main": "./userscript.js",
15
15
  "exports": {