@agnos-ui/core 0.1.1 → 0.3.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 (145) hide show
  1. package/README.md +3 -3
  2. package/accordion-BaWN0_n-.js +330 -0
  3. package/accordion-BuIgxZ0S.cjs +329 -0
  4. package/alert-C4jCg9Pl.cjs +8 -0
  5. package/alert-Dlf-BV98.js +9 -0
  6. package/common-DRdsw5m8.js +76 -0
  7. package/common-nJRMXbwj.cjs +75 -0
  8. package/components/accordion/accordion.d.ts +57 -64
  9. package/components/accordion/index.cjs +7 -0
  10. package/components/accordion/index.js +7 -1
  11. package/components/alert/alert.d.ts +3 -12
  12. package/components/alert/common.d.ts +4 -13
  13. package/components/alert/index.cjs +10 -0
  14. package/components/alert/index.js +10 -2
  15. package/components/modal/index.cjs +7 -0
  16. package/components/modal/index.js +7 -1
  17. package/components/modal/modal.d.ts +7 -49
  18. package/components/pagination/index.cjs +5 -0
  19. package/components/pagination/index.d.ts +0 -1
  20. package/components/pagination/index.js +5 -2
  21. package/components/pagination/pagination.d.ts +107 -128
  22. package/components/progressbar/index.cjs +5 -0
  23. package/components/progressbar/index.js +5 -1
  24. package/components/progressbar/progressbar.d.ts +6 -22
  25. package/components/rating/index.cjs +5 -0
  26. package/components/rating/index.js +5 -1
  27. package/components/rating/rating.d.ts +16 -11
  28. package/components/select/index.cjs +6 -0
  29. package/components/select/index.js +6 -1
  30. package/components/select/select.d.ts +45 -57
  31. package/components/slider/index.cjs +5 -0
  32. package/components/slider/index.js +5 -1
  33. package/components/slider/slider.d.ts +63 -5
  34. package/components/toast/index.cjs +5 -0
  35. package/components/toast/index.d.ts +1 -0
  36. package/components/toast/index.js +5 -0
  37. package/components/toast/toast.d.ts +47 -0
  38. package/config.cjs +38 -0
  39. package/config.d.ts +6 -1
  40. package/config.js +35 -50
  41. package/directive-BTSEYLF3.cjs +404 -0
  42. package/directive-DCYlDznf.js +405 -0
  43. package/func-DR0n-ShK.js +7 -0
  44. package/func-Qd3cD9a3.cjs +6 -0
  45. package/index.cjs +119 -0
  46. package/index.d.ts +3 -1
  47. package/index.js +119 -31
  48. package/modal-BI2qUu1M.js +251 -0
  49. package/modal-rzMpATf5.cjs +250 -0
  50. package/package.json +30 -22
  51. package/pagination--GkwduJn.js +263 -0
  52. package/pagination-EWSWQT1I.cjs +262 -0
  53. package/progressbar-DH7DHYMp.cjs +83 -0
  54. package/progressbar-DuRX7_my.js +84 -0
  55. package/promise-BMJ8qhA8.cjs +118 -0
  56. package/promise-CY2U8bTP.js +119 -0
  57. package/rating-BR5wD7y2.js +173 -0
  58. package/rating-CmuYUSxy.cjs +172 -0
  59. package/select-BCs6HQWn.js +358 -0
  60. package/select-CCIKn8WR.cjs +357 -0
  61. package/services/extendWidget.cjs +32 -0
  62. package/services/extendWidget.d.ts +10 -5
  63. package/services/extendWidget.js +31 -34
  64. package/services/floatingUI.cjs +131 -0
  65. package/services/floatingUI.d.ts +30 -14
  66. package/services/floatingUI.js +128 -102
  67. package/services/focustrack.cjs +47 -0
  68. package/services/focustrack.js +45 -44
  69. package/services/hash.cjs +15 -0
  70. package/services/hash.d.ts +2 -0
  71. package/services/hash.js +15 -0
  72. package/services/intersection.cjs +53 -0
  73. package/services/intersection.js +48 -50
  74. package/services/matchMedia.cjs +13 -0
  75. package/services/matchMedia.d.ts +7 -0
  76. package/services/matchMedia.js +13 -0
  77. package/services/navManager.cjs +196 -0
  78. package/services/navManager.d.ts +24 -17
  79. package/services/navManager.js +186 -162
  80. package/services/portal.cjs +43 -0
  81. package/services/portal.js +41 -42
  82. package/services/resizeObserver.cjs +32 -0
  83. package/services/resizeObserver.d.ts +14 -0
  84. package/services/resizeObserver.js +32 -0
  85. package/services/siblingsInert.cjs +40 -0
  86. package/services/siblingsInert.js +31 -31
  87. package/services/transitions/baseTransitions.cjs +171 -0
  88. package/services/transitions/baseTransitions.d.ts +16 -16
  89. package/services/transitions/baseTransitions.js +159 -170
  90. package/services/transitions/collapse.cjs +44 -0
  91. package/services/transitions/collapse.js +41 -49
  92. package/services/transitions/cssTransitions.cjs +32 -0
  93. package/services/transitions/cssTransitions.d.ts +2 -1
  94. package/services/transitions/cssTransitions.js +29 -39
  95. package/services/transitions/simpleClassTransition.cjs +31 -0
  96. package/services/transitions/simpleClassTransition.js +30 -41
  97. package/slider-CA_fszn7.js +536 -0
  98. package/slider-DsLvT87U.cjs +535 -0
  99. package/toast-8tWp6x89.js +63 -0
  100. package/toast-Aw8o0Iwe.cjs +62 -0
  101. package/types.cjs +12 -0
  102. package/types.d.ts +21 -1
  103. package/types.js +11 -13
  104. package/utils/directive.cjs +26 -0
  105. package/utils/directive.d.ts +155 -4
  106. package/utils/directive.js +25 -189
  107. package/utils/internal/dom.d.ts +57 -3
  108. package/utils/internal/promise.d.ts +2 -2
  109. package/utils/internal/ssrHTMLElement.d.ts +7 -0
  110. package/utils/internal/textDirection.d.ts +1 -1
  111. package/utils/stores.cjs +163 -0
  112. package/utils/stores.d.ts +23 -20
  113. package/utils/stores.js +151 -269
  114. package/utils/writables.cjs +13 -0
  115. package/utils/writables.js +12 -71
  116. package/writables-D46sFgGK.cjs +85 -0
  117. package/writables-DoU_XYTX.js +86 -0
  118. package/components/accordion/accordion.js +0 -267
  119. package/components/alert/alert.js +0 -22
  120. package/components/alert/common.js +0 -69
  121. package/components/commonProps.js +0 -1
  122. package/components/modal/modal.js +0 -186
  123. package/components/pagination/bootstrap.d.ts +0 -8
  124. package/components/pagination/bootstrap.js +0 -110
  125. package/components/pagination/pagination.js +0 -149
  126. package/components/progressbar/progressbar.js +0 -78
  127. package/components/rating/rating.js +0 -138
  128. package/components/select/select.js +0 -266
  129. package/components/slider/slider.js +0 -415
  130. package/services/transitions/bootstrap/collapse.d.ts +0 -2
  131. package/services/transitions/bootstrap/collapse.js +0 -15
  132. package/services/transitions/bootstrap/fade.d.ts +0 -1
  133. package/services/transitions/bootstrap/fade.js +0 -7
  134. package/services/transitions/bootstrap.d.ts +0 -2
  135. package/services/transitions/bootstrap.js +0 -2
  136. package/utils/internal/checks.js +0 -60
  137. package/utils/internal/dom.js +0 -61
  138. package/utils/internal/func.js +0 -11
  139. package/utils/internal/isFocusable.js +0 -35
  140. package/utils/internal/math.js +0 -13
  141. package/utils/internal/promise.js +0 -169
  142. package/utils/internal/scrollbars.js +0 -33
  143. package/utils/internal/sort.js +0 -28
  144. package/utils/internal/textDirection.js +0 -7
  145. package/utils/internal/traversal.js +0 -105
@@ -1,110 +0,0 @@
1
- // Utility functions
2
- function _applyPagination(page, maxSize) {
3
- const pp = Math.ceil(page / maxSize) - 1;
4
- const start = pp * maxSize;
5
- // console.log('start', start, 'pp', pp, 'page', page, 'maxSize', maxSize);
6
- const end = start + maxSize;
7
- return [start, end];
8
- }
9
- /**
10
- * Appends ellipses and first/last page number to the displayed pages
11
- * @param start - the first page number
12
- * @param end - the last page number
13
- * @param ellipses - apply ellipses
14
- * @param pages - the pages to apply the function to
15
- * @param pageCount - the total number of pages
16
- */
17
- function _applyEllipses(start, end, ellipses, pages, pageCount) {
18
- if (ellipses) {
19
- if (start > 0) {
20
- // The first page will always be included. If the displayed range
21
- // starts after the third page, then add ellipsis. But if the range
22
- // starts on the third page, then add the second page instead of
23
- // an ellipsis, because the ellipsis would only hide a single page.
24
- if (start > 2) {
25
- pages.unshift(-1);
26
- }
27
- else if (start === 2) {
28
- pages.unshift(2);
29
- }
30
- pages.unshift(1);
31
- }
32
- if (end < pageCount) {
33
- // The last page will always be included. If the displayed range
34
- // ends before the third-last page, then add ellipsis. But if the range
35
- // ends on third-last page, then add the second-last page instead of
36
- // an ellipsis, because the ellipsis would only hide a single page.
37
- if (end < pageCount - 2) {
38
- pages.push(-1);
39
- }
40
- else if (end === pageCount - 2) {
41
- pages.push(pageCount - 1);
42
- }
43
- pages.push(pageCount);
44
- }
45
- }
46
- }
47
- /**
48
- * Rotates page numbers based on maxSize items visible.
49
- * Currently selected page stays in the middle:
50
- *
51
- * Ex. for selected page = 6:
52
- * [5,*6*,7] for maxSize = 3
53
- * [4,5,*6*,7] for maxSize = 4
54
- *
55
- * @param page - the page number
56
- * @param maxSize - the max size
57
- * @param pageCount - the page count
58
- * @returns the rotated page numbers
59
- */
60
- function _applyRotation(page, maxSize, pageCount) {
61
- let start = 0;
62
- let end = pageCount;
63
- const leftOffset = Math.floor(maxSize / 2);
64
- const rightOffset = maxSize % 2 === 0 ? leftOffset - 1 : leftOffset;
65
- if (page <= leftOffset) {
66
- // very beginning, no rotation -> [0..maxSize]
67
- end = maxSize;
68
- }
69
- else if (pageCount - page < leftOffset) {
70
- // very end, no rotation -> [len-maxSize..len]
71
- start = pageCount - maxSize;
72
- }
73
- else {
74
- // rotate
75
- start = page - leftOffset - 1;
76
- end = page + rightOffset;
77
- }
78
- return [start, end];
79
- }
80
- /**
81
- * This is the pagination algorithm used by ng-bootstrap. While this is not the default implementation of our widget, we export it to ease the migration from ng-bootstrap pagination.
82
- * @param maxSize - the max size
83
- * @param rotate - rotate the pages
84
- * @param ellipses - enable ellipses
85
- * @returns the pages
86
- */
87
- export function ngBootstrapPagination(maxSize, rotate, ellipses) {
88
- return function (page, pageCount) {
89
- let pages = [];
90
- for (let i = 1; i <= pageCount; i++) {
91
- pages.push(i);
92
- }
93
- // apply maxSize if necessary
94
- if (maxSize > 0 && pageCount > maxSize) {
95
- let start = 0;
96
- let end = pageCount;
97
- // either paginating or rotating page numbers
98
- if (rotate) {
99
- [start, end] = _applyRotation(page, maxSize, pageCount);
100
- }
101
- else {
102
- [start, end] = _applyPagination(page, maxSize);
103
- }
104
- pages = pages.slice(start, end);
105
- // adding ellipses
106
- _applyEllipses(start, end, ellipses, pages, pageCount);
107
- }
108
- return pages;
109
- };
110
- }
@@ -1,149 +0,0 @@
1
- import { computed } from '@amadeus-it-group/tansu';
2
- import { INVALID_VALUE } from '../../types';
3
- import { bindableDerived, stateStores, writablesForProps } from '../../utils/stores';
4
- import { clamp, isNumber } from '../../utils/internal/checks';
5
- import { typeBoolean, typeFunction, typeNumber, typeString } from '../../utils/writables';
6
- import { noop } from '../../utils/internal/func';
7
- const defaultConfig = {
8
- page: 1,
9
- collectionSize: 0,
10
- pageSize: 10,
11
- disabled: false,
12
- directionLinks: true,
13
- boundaryLinks: false,
14
- size: null,
15
- onPageChange: noop,
16
- pagesFactory: (page, pageCount) => {
17
- // TODO extract this for testing
18
- const pages = [];
19
- for (let i = 1; i <= pageCount; i++) {
20
- pages.push(i);
21
- }
22
- return pages;
23
- },
24
- ariaLabel: 'Page navigation',
25
- activeLabel: '(current)',
26
- ariaPageLabel: (processPage, pageCount) => `Page ${processPage} of ${pageCount}`,
27
- ariaFirstLabel: 'Action link for first page',
28
- ariaPreviousLabel: 'Action link for previous page',
29
- ariaNextLabel: 'Action link for next page',
30
- ariaLastLabel: 'Action link for last page',
31
- className: '',
32
- slotEllipsis: '…',
33
- slotFirst: '«',
34
- slotPrevious: '‹',
35
- slotNext: '›',
36
- slotLast: '»',
37
- slotPages: undefined,
38
- slotNumberLabel: ({ displayedPage }) => `${displayedPage}`,
39
- };
40
- /**
41
- * Returns a shallow copy of the default pagination config
42
- * @returns a copy of the default config
43
- */
44
- export function getPaginationDefaultConfig() {
45
- return { ...defaultConfig };
46
- }
47
- const configValidator = {
48
- page: typeNumber,
49
- collectionSize: typeNumber,
50
- pageSize: typeNumber,
51
- disabled: typeBoolean,
52
- directionLinks: typeBoolean,
53
- boundaryLinks: typeBoolean,
54
- size: { normalizeValue: (value) => (value === 'lg' || value === 'sm' || value === null ? value : INVALID_VALUE) },
55
- onPageChange: typeFunction,
56
- pagesFactory: typeFunction,
57
- ariaLabel: typeString,
58
- activeLabel: typeString,
59
- ariaPageLabel: typeFunction,
60
- ariaFirstLabel: typeString,
61
- ariaPreviousLabel: typeString,
62
- ariaNextLabel: typeString,
63
- ariaLastLabel: typeString,
64
- className: typeString,
65
- };
66
- /**
67
- * Create a PaginationWidget with given config props
68
- * @param config - an optional pagination config
69
- * @returns a PaginationWidget
70
- */
71
- export function createPagination(config) {
72
- const [{
73
- // dirty inputs that need adjustment:
74
- page$: _dirtyPage$,
75
- // clean inputs with value validation:
76
- collectionSize$, pageSize$, onPageChange$, pagesFactory$, ariaPageLabel$, ...stateProps }, patch,] = writablesForProps(defaultConfig, config, configValidator);
77
- // computed
78
- // nb total of Pages.
79
- const pageCount$ = computed(() => {
80
- let pageCount = Math.ceil(collectionSize$() / pageSize$());
81
- // Here we choose to always display a page when collection size is 0
82
- if (!isNumber(pageCount) || pageCount < 1) {
83
- pageCount = 1;
84
- }
85
- return pageCount;
86
- });
87
- // current page
88
- const page$ = bindableDerived(onPageChange$, [_dirtyPage$, pageCount$], ([dirtyPage, pageCount]) => clamp(dirtyPage, pageCount, 1));
89
- const pages$ = computed(() => pagesFactory$()(page$(), pageCount$()));
90
- const nextDisabled$ = computed(() => page$() === pageCount$() || stateProps.disabled$());
91
- const previousDisabled$ = computed(() => page$() === 1 || stateProps.disabled$());
92
- const pagesLabel$ = computed(() => {
93
- const ariaPageLabel = ariaPageLabel$();
94
- const pageCount = pageCount$();
95
- return pages$().map((page) => ariaPageLabel(page, pageCount));
96
- });
97
- return {
98
- ...stateStores({
99
- pageCount$,
100
- page$,
101
- pages$,
102
- nextDisabled$,
103
- previousDisabled$,
104
- pagesLabel$,
105
- ...stateProps,
106
- }),
107
- patch,
108
- actions: {
109
- /**
110
- * Set the current page pageNumber (starting from 1)
111
- * @param pageNumber - Current page number to set.
112
- * Value is normalized between 1 and the number of page
113
- */
114
- select(pageNumber) {
115
- patch({ page: pageNumber });
116
- },
117
- /**
118
- * Select the first page
119
- */
120
- first() {
121
- patch({ page: 1 });
122
- },
123
- /**
124
- * Select the previous page
125
- */
126
- previous() {
127
- patch({ page: page$() - 1 });
128
- },
129
- /**
130
- * Select the next page
131
- */
132
- next() {
133
- patch({ page: page$() + 1 });
134
- },
135
- /**
136
- * Select the last page
137
- */
138
- last() {
139
- patch({ page: pageCount$() });
140
- },
141
- },
142
- api: {
143
- isEllipsis(pageNumber) {
144
- return pageNumber === -1;
145
- },
146
- },
147
- directives: {},
148
- };
149
- }
@@ -1,78 +0,0 @@
1
- import { clamp } from '../../utils/internal/checks';
2
- import { typeBoolean, typeFunction, typeNumber, typeString } from '../../utils/writables';
3
- import { stateStores, writablesForProps } from '../../utils/stores';
4
- import { computed } from '@amadeus-it-group/tansu';
5
- const defaultConfig = {
6
- min: 0,
7
- max: 100,
8
- value: 0,
9
- ariaLabel: 'Progressbar',
10
- className: '',
11
- slotContent: undefined,
12
- slotDefault: undefined,
13
- height: '',
14
- striped: false,
15
- animated: false,
16
- ariaValueTextFn: () => undefined,
17
- };
18
- /**
19
- * Retrieve a shallow copy of the default Progressbar config
20
- * @returns the default Progressbar config
21
- */
22
- export function getProgressbarDefaultConfig() {
23
- return { ...defaultConfig };
24
- }
25
- const configValidator = {
26
- min: typeNumber,
27
- max: typeNumber,
28
- value: typeNumber,
29
- ariaLabel: typeString,
30
- className: typeString,
31
- height: typeString,
32
- striped: typeBoolean,
33
- animated: typeBoolean,
34
- ariaValueTextFn: typeFunction,
35
- };
36
- /**
37
- * Create an ProgressbarWidget with given config props
38
- * @param config - an optional progress bar config
39
- * @returns an ProgressbarWidget
40
- */
41
- export function createProgressbar(config) {
42
- const [{
43
- // dirty inputs that need adjustment:
44
- max$: _dirtyMaximum$, value$: _dirtyValue$,
45
- // clean inputs
46
- min$, ariaValueTextFn$, ...stateProps }, patch,] = writablesForProps(defaultConfig, config, configValidator);
47
- const max$ = computed(() => Math.max(min$(), _dirtyMaximum$()));
48
- const value$ = computed(() => clamp(_dirtyValue$(), max$(), min$()));
49
- const percentage$ = computed(() => {
50
- const max = max$();
51
- const min = min$();
52
- if (max > min) {
53
- return clamp(((value$() - min) * 100) / (max - min), 100, 0);
54
- }
55
- else {
56
- return 0;
57
- }
58
- });
59
- const started$ = computed(() => value$() > min$());
60
- const finished$ = computed(() => value$() === max$());
61
- const ariaValueText$ = computed(() => ariaValueTextFn$()(value$(), min$(), max$()));
62
- return {
63
- ...stateStores({
64
- min$,
65
- max$,
66
- value$,
67
- percentage$,
68
- started$,
69
- finished$,
70
- ariaValueText$,
71
- ...stateProps,
72
- }),
73
- patch,
74
- api: {},
75
- directives: {},
76
- actions: {},
77
- };
78
- }
@@ -1,138 +0,0 @@
1
- import { computed, writable } from '@amadeus-it-group/tansu';
2
- import { INVALID_VALUE } from '../../types';
3
- import { bindableDerived, stateStores, writablesForProps } from '../../utils/stores';
4
- import { clamp, isNumber } from '../../utils/internal/checks';
5
- import { typeBoolean, typeFunction, typeNumber, typeString } from '../../utils/writables';
6
- import { noop } from '../../utils/internal/func';
7
- const defaultConfig = {
8
- rating: 0,
9
- tabindex: 0,
10
- maxRating: 10,
11
- disabled: false,
12
- readonly: false,
13
- resettable: true,
14
- ariaValueTextFn: (rating, maxRating) => `${rating} out of ${maxRating}`,
15
- onHover: noop,
16
- onLeave: noop,
17
- onRatingChange: noop,
18
- className: '',
19
- slotStar: ({ fill }) => String.fromCharCode(fill === 100 ? 9733 : 9734),
20
- ariaLabel: 'Rating',
21
- ariaLabelledBy: '',
22
- };
23
- /**
24
- * Returns a shallow copy of the default rating config.
25
- * @returns a copy of the default config
26
- */
27
- export function getRatingDefaultConfig() {
28
- return { ...defaultConfig };
29
- }
30
- // TODO export normalize function in utils and test them.
31
- const configValidator = {
32
- rating: typeNumber,
33
- tabindex: typeNumber,
34
- maxRating: { normalizeValue: (value) => (isNumber(value) ? Math.max(0, value) : INVALID_VALUE) },
35
- disabled: typeBoolean,
36
- readonly: typeBoolean,
37
- resettable: typeBoolean,
38
- ariaValueTextFn: typeFunction,
39
- onHover: typeFunction,
40
- onLeave: typeFunction,
41
- onRatingChange: typeFunction,
42
- className: typeString,
43
- ariaLabel: typeString,
44
- ariaLabelledBy: typeString,
45
- };
46
- /**
47
- * Create a RatingWidget with given config props
48
- * @param config - an optional alert config
49
- * @returns a RatingWidget
50
- */
51
- export function createRating(config) {
52
- const [{
53
- // dirty inputs that need adjustment:
54
- rating$: _dirtyRating$, tabindex$: _dirtyTabindex$,
55
- // clean inputs with value validation:
56
- ariaValueTextFn$, onHover$, onLeave$, onRatingChange$, ...stateProps }, patch,] = writablesForProps(defaultConfig, config, configValidator);
57
- const { maxRating$, disabled$, readonly$, resettable$ } = stateProps;
58
- // clean inputs adjustment to valid range
59
- const tabindex$ = computed(() => (disabled$() ? -1 : _dirtyTabindex$()));
60
- const rating$ = bindableDerived(onRatingChange$, [_dirtyRating$, maxRating$], ([dirtyRating, maxRating]) => clamp(dirtyRating, maxRating));
61
- // internal inputs
62
- const _hoveredRating$ = writable(0);
63
- // computed
64
- const isInteractive$ = computed(() => !disabled$() && !readonly$());
65
- const visibleRating$ = computed(() => {
66
- const rating = rating$(); // call rating unconditionnally (for the bindableDerived to stay active)
67
- const hoveredRating = _hoveredRating$();
68
- return hoveredRating !== 0 ? hoveredRating : rating;
69
- });
70
- const ariaValueText$ = computed(() => ariaValueTextFn$()(visibleRating$(), maxRating$()));
71
- const stars$ = computed(() => {
72
- const visibleRating = visibleRating$();
73
- return Array.from({ length: maxRating$() }, (_v, i) => ({
74
- fill: Math.round(Math.max(Math.min(visibleRating - i, 1), 0) * 100),
75
- index: i,
76
- }));
77
- });
78
- return {
79
- ...stateStores({
80
- ariaValueText$,
81
- isInteractive$,
82
- rating$,
83
- stars$,
84
- tabindex$,
85
- visibleRating$,
86
- ...stateProps,
87
- }),
88
- patch,
89
- actions: {
90
- click: (index) => {
91
- if (isInteractive$() && index > 0 && index <= maxRating$()) {
92
- patch({ rating: rating$() === index && resettable$() ? 0 : index });
93
- }
94
- },
95
- hover: (index) => {
96
- if (isInteractive$() && index > 0 && index <= maxRating$()) {
97
- _hoveredRating$.set(index);
98
- onHover$()(index);
99
- }
100
- },
101
- leave: () => {
102
- if (isInteractive$()) {
103
- onLeave$()(_hoveredRating$());
104
- _hoveredRating$.set(0);
105
- }
106
- },
107
- handleKey(event) {
108
- if (isInteractive$()) {
109
- const { key } = event;
110
- switch (key) {
111
- case 'ArrowLeft':
112
- case 'ArrowDown':
113
- patch({ rating: rating$() - 1 });
114
- break;
115
- case 'ArrowRight':
116
- case 'ArrowUp':
117
- patch({ rating: rating$() + 1 });
118
- break;
119
- case 'Home':
120
- case 'PageDown':
121
- patch({ rating: 0 });
122
- break;
123
- case 'End':
124
- case 'PageUp':
125
- patch({ rating: maxRating$() });
126
- break;
127
- default:
128
- return;
129
- }
130
- event.preventDefault();
131
- event.stopPropagation();
132
- }
133
- },
134
- },
135
- directives: {},
136
- api: {},
137
- };
138
- }