insights4you-jekyll-theme 0.2.2 → 0.4.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 (271) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +110 -0
  3. data/README.md +113 -30
  4. data/_data/i4y-colors.json +218 -0
  5. data/_data/i4y-social-media.yml +0 -2
  6. data/_includes/layout/footer.html +48 -0
  7. data/_includes/{head.html → layout/head.html} +40 -20
  8. data/_includes/layout/navbar-logo.html +137 -0
  9. data/_includes/layout/navbar.html +82 -0
  10. data/_includes/ui/button.html +13 -14
  11. data/_includes/ui/icon.html +24 -26
  12. data/_includes/ui/spinner.html +2 -0
  13. data/_includes/utils/banner.html +7 -0
  14. data/_includes/utils/settings.html +144 -0
  15. data/_layouts/base.html +63 -0
  16. data/_layouts/default.html +39 -16
  17. data/_sass/_bootstrap-components.scss +31 -0
  18. data/_sass/_bootstrap-config.scss +7 -0
  19. data/_sass/_bootstrap-override.scss +78 -0
  20. data/_sass/_config.scss +9 -0
  21. data/_sass/_core.scss +78 -0
  22. data/_sass/_debug.scss +49 -0
  23. data/_sass/_mixins.scss +2 -0
  24. data/_sass/_props.scss +91 -0
  25. data/_sass/_utilities-marketing.scss +209 -0
  26. data/_sass/_utilities.scss +135 -0
  27. data/_sass/_variables-dark.scss +19 -0
  28. data/_sass/_variables-marketing.scss +0 -0
  29. data/_sass/_variables.scss +1001 -0
  30. data/_sass/bootstrap/LICENSE +21 -0
  31. data/_sass/bootstrap/README.md +246 -0
  32. data/_sass/bootstrap/js/index.esm.js +19 -0
  33. data/_sass/bootstrap/js/index.umd.js +34 -0
  34. data/_sass/bootstrap/js/src/alert.js +87 -0
  35. data/_sass/bootstrap/js/src/base-component.js +85 -0
  36. data/_sass/bootstrap/js/src/button.js +72 -0
  37. data/_sass/bootstrap/js/src/carousel.js +474 -0
  38. data/_sass/bootstrap/js/src/collapse.js +297 -0
  39. data/_sass/bootstrap/js/src/dom/data.js +55 -0
  40. data/_sass/bootstrap/js/src/dom/event-handler.js +317 -0
  41. data/_sass/bootstrap/js/src/dom/manipulator.js +71 -0
  42. data/_sass/bootstrap/js/src/dom/selector-engine.js +126 -0
  43. data/_sass/bootstrap/js/src/dropdown.js +455 -0
  44. data/_sass/bootstrap/js/src/modal.js +378 -0
  45. data/_sass/bootstrap/js/src/offcanvas.js +282 -0
  46. data/_sass/bootstrap/js/src/popover.js +97 -0
  47. data/_sass/bootstrap/js/src/scrollspy.js +296 -0
  48. data/_sass/bootstrap/js/src/tab.js +315 -0
  49. data/_sass/bootstrap/js/src/toast.js +225 -0
  50. data/_sass/bootstrap/js/src/tooltip.js +633 -0
  51. data/_sass/bootstrap/js/src/util/backdrop.js +151 -0
  52. data/_sass/bootstrap/js/src/util/component-functions.js +35 -0
  53. data/_sass/bootstrap/js/src/util/config.js +65 -0
  54. data/_sass/bootstrap/js/src/util/focustrap.js +115 -0
  55. data/_sass/bootstrap/js/src/util/index.js +306 -0
  56. data/_sass/bootstrap/js/src/util/sanitizer.js +117 -0
  57. data/_sass/bootstrap/js/src/util/scrollbar.js +114 -0
  58. data/_sass/bootstrap/js/src/util/swipe.js +146 -0
  59. data/_sass/bootstrap/js/src/util/template-factory.js +160 -0
  60. data/_sass/bootstrap/package.json +184 -0
  61. data/_sass/bootstrap/scss/_accordion.scss +158 -0
  62. data/_sass/bootstrap/scss/_alert.scss +68 -0
  63. data/_sass/bootstrap/scss/_badge.scss +38 -0
  64. data/_sass/bootstrap/scss/_breadcrumb.scss +40 -0
  65. data/_sass/bootstrap/scss/_button-group.scss +142 -0
  66. data/_sass/bootstrap/scss/_buttons.scss +216 -0
  67. data/_sass/bootstrap/scss/_card.scss +239 -0
  68. data/_sass/bootstrap/scss/_carousel.scss +236 -0
  69. data/_sass/bootstrap/scss/_close.scss +63 -0
  70. data/_sass/bootstrap/scss/_containers.scss +41 -0
  71. data/_sass/bootstrap/scss/_dropdown.scss +250 -0
  72. data/_sass/bootstrap/scss/_forms.scss +9 -0
  73. data/_sass/bootstrap/scss/_functions.scss +302 -0
  74. data/_sass/bootstrap/scss/_grid.scss +39 -0
  75. data/_sass/bootstrap/scss/_helpers.scss +12 -0
  76. data/_sass/bootstrap/scss/_images.scss +42 -0
  77. data/_sass/bootstrap/scss/_list-group.scss +197 -0
  78. data/_sass/bootstrap/scss/_maps.scss +174 -0
  79. data/_sass/bootstrap/scss/_mixins.scss +42 -0
  80. data/_sass/bootstrap/scss/_modal.scss +236 -0
  81. data/_sass/bootstrap/scss/_nav.scss +197 -0
  82. data/_sass/bootstrap/scss/_navbar.scss +289 -0
  83. data/_sass/bootstrap/scss/_offcanvas.scss +143 -0
  84. data/_sass/bootstrap/scss/_pagination.scss +109 -0
  85. data/_sass/bootstrap/scss/_placeholders.scss +51 -0
  86. data/_sass/bootstrap/scss/_popover.scss +196 -0
  87. data/_sass/bootstrap/scss/_progress.scss +68 -0
  88. data/_sass/bootstrap/scss/_reboot.scss +611 -0
  89. data/_sass/bootstrap/scss/_root.scss +187 -0
  90. data/_sass/bootstrap/scss/_spinners.scss +85 -0
  91. data/_sass/bootstrap/scss/_tables.scss +171 -0
  92. data/_sass/bootstrap/scss/_toasts.scss +73 -0
  93. data/_sass/bootstrap/scss/_tooltip.scss +119 -0
  94. data/_sass/bootstrap/scss/_transitions.scss +27 -0
  95. data/_sass/bootstrap/scss/_type.scss +106 -0
  96. data/_sass/bootstrap/scss/_utilities.scss +806 -0
  97. data/_sass/bootstrap/scss/_variables-dark.scss +87 -0
  98. data/_sass/bootstrap/scss/_variables.scss +1751 -0
  99. data/_sass/bootstrap/scss/bootstrap-grid.scss +62 -0
  100. data/_sass/bootstrap/scss/bootstrap-reboot.scss +10 -0
  101. data/_sass/bootstrap/scss/bootstrap-utilities.scss +19 -0
  102. data/_sass/bootstrap/scss/bootstrap.scss +52 -0
  103. data/_sass/bootstrap/scss/forms/_floating-labels.scss +95 -0
  104. data/_sass/bootstrap/scss/forms/_form-check.scss +189 -0
  105. data/_sass/bootstrap/scss/forms/_form-control.scss +214 -0
  106. data/_sass/bootstrap/scss/forms/_form-range.scss +91 -0
  107. data/_sass/bootstrap/scss/forms/_form-select.scss +80 -0
  108. data/_sass/bootstrap/scss/forms/_form-text.scss +11 -0
  109. data/_sass/bootstrap/scss/forms/_input-group.scss +132 -0
  110. data/_sass/bootstrap/scss/forms/_labels.scss +36 -0
  111. data/_sass/bootstrap/scss/forms/_validation.scss +12 -0
  112. data/_sass/bootstrap/scss/helpers/_clearfix.scss +3 -0
  113. data/_sass/bootstrap/scss/helpers/_color-bg.scss +7 -0
  114. data/_sass/bootstrap/scss/helpers/_colored-links.scss +30 -0
  115. data/_sass/bootstrap/scss/helpers/_focus-ring.scss +5 -0
  116. data/_sass/bootstrap/scss/helpers/_icon-link.scss +25 -0
  117. data/_sass/bootstrap/scss/helpers/_position.scss +36 -0
  118. data/_sass/bootstrap/scss/helpers/_ratio.scss +26 -0
  119. data/_sass/bootstrap/scss/helpers/_stacks.scss +15 -0
  120. data/_sass/bootstrap/scss/helpers/_stretched-link.scss +15 -0
  121. data/_sass/bootstrap/scss/helpers/_text-truncation.scss +7 -0
  122. data/_sass/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
  123. data/_sass/bootstrap/scss/helpers/_vr.scss +8 -0
  124. data/_sass/bootstrap/scss/mixins/_alert.scss +18 -0
  125. data/_sass/bootstrap/scss/mixins/_backdrop.scss +14 -0
  126. data/_sass/bootstrap/scss/mixins/_banner.scss +7 -0
  127. data/_sass/bootstrap/scss/mixins/_border-radius.scss +78 -0
  128. data/_sass/bootstrap/scss/mixins/_box-shadow.scss +18 -0
  129. data/_sass/bootstrap/scss/mixins/_breakpoints.scss +127 -0
  130. data/_sass/bootstrap/scss/mixins/_buttons.scss +70 -0
  131. data/_sass/bootstrap/scss/mixins/_caret.scss +69 -0
  132. data/_sass/bootstrap/scss/mixins/_clearfix.scss +9 -0
  133. data/_sass/bootstrap/scss/mixins/_color-mode.scss +21 -0
  134. data/_sass/bootstrap/scss/mixins/_color-scheme.scss +7 -0
  135. data/_sass/bootstrap/scss/mixins/_container.scss +11 -0
  136. data/_sass/bootstrap/scss/mixins/_deprecate.scss +10 -0
  137. data/_sass/bootstrap/scss/mixins/_forms.scss +163 -0
  138. data/_sass/bootstrap/scss/mixins/_gradients.scss +47 -0
  139. data/_sass/bootstrap/scss/mixins/_grid.scss +151 -0
  140. data/_sass/bootstrap/scss/mixins/_image.scss +16 -0
  141. data/_sass/bootstrap/scss/mixins/_list-group.scss +26 -0
  142. data/_sass/bootstrap/scss/mixins/_lists.scss +7 -0
  143. data/_sass/bootstrap/scss/mixins/_pagination.scss +10 -0
  144. data/_sass/bootstrap/scss/mixins/_reset-text.scss +17 -0
  145. data/_sass/bootstrap/scss/mixins/_resize.scss +6 -0
  146. data/_sass/bootstrap/scss/mixins/_table-variants.scss +24 -0
  147. data/_sass/bootstrap/scss/mixins/_text-truncate.scss +8 -0
  148. data/_sass/bootstrap/scss/mixins/_transition.scss +26 -0
  149. data/_sass/bootstrap/scss/mixins/_utilities.scss +97 -0
  150. data/_sass/bootstrap/scss/mixins/_visually-hidden.scss +33 -0
  151. data/_sass/bootstrap/scss/utilities/_api.scss +47 -0
  152. data/_sass/fonts/_webfonts.scss +15 -0
  153. data/_sass/helpers/_index.scss +143 -0
  154. data/_sass/layout/_animations.scss +63 -0
  155. data/_sass/layout/_core.scss +62 -0
  156. data/_sass/layout/_dark.scss +77 -0
  157. data/_sass/layout/_footer.scss +12 -0
  158. data/_sass/layout/_navbar.scss +392 -0
  159. data/_sass/layout/_page.scss +169 -0
  160. data/_sass/layout/_root.scss +64 -0
  161. data/_sass/marketing/_browser.scss +67 -0
  162. data/_sass/marketing/_core.scss +8 -0
  163. data/_sass/marketing/_filters.scss +0 -0
  164. data/_sass/marketing/_hero.scss +69 -0
  165. data/_sass/marketing/_pricing.scss +111 -0
  166. data/_sass/marketing/_sections.scss +124 -0
  167. data/_sass/marketing/_shape.scss +31 -0
  168. data/_sass/mixins/_functions.scss +96 -0
  169. data/_sass/mixins/_mixins.scss +68 -0
  170. data/_sass/tabler-flags.scss +2 -0
  171. data/_sass/tabler-marketing.scss +13 -0
  172. data/_sass/tabler-payments.scss +2 -0
  173. data/_sass/tabler-props.scss +1 -0
  174. data/_sass/tabler-socials.scss +2 -0
  175. data/_sass/tabler-themes.scss +121 -0
  176. data/_sass/tabler-vendors.scss +16 -0
  177. data/_sass/tabler.scss +2 -0
  178. data/_sass/ui/_accordion.scss +177 -0
  179. data/_sass/ui/_alerts.scss +99 -0
  180. data/_sass/ui/_avatars.scss +145 -0
  181. data/_sass/ui/_badges.scss +113 -0
  182. data/_sass/ui/_breadcrumbs.scss +50 -0
  183. data/_sass/ui/_button-group.scss +16 -0
  184. data/_sass/ui/_buttons.scss +261 -0
  185. data/_sass/ui/_calendars.scss +104 -0
  186. data/_sass/ui/_cards.scss +594 -0
  187. data/_sass/ui/_carousel.scss +68 -0
  188. data/_sass/ui/_charts.scss +61 -0
  189. data/_sass/ui/_chat.scss +38 -0
  190. data/_sass/ui/_chips.scss +0 -0
  191. data/_sass/ui/_close.scss +60 -0
  192. data/_sass/ui/_datagrid.scss +17 -0
  193. data/_sass/ui/_dropdowns.scss +120 -0
  194. data/_sass/ui/_empty.scss +60 -0
  195. data/_sass/ui/_flags.scss +31 -0
  196. data/_sass/ui/_forms.scss +241 -0
  197. data/_sass/ui/_grid.scss +115 -0
  198. data/_sass/ui/_icons.scss +72 -0
  199. data/_sass/ui/_images.scss +19 -0
  200. data/_sass/ui/_legend.scss +12 -0
  201. data/_sass/ui/_lists.scss +124 -0
  202. data/_sass/ui/_loaders.scss +72 -0
  203. data/_sass/ui/_login.scss +3 -0
  204. data/_sass/ui/_markdown.scss +43 -0
  205. data/_sass/ui/_modals.scss +67 -0
  206. data/_sass/ui/_nav.scss +96 -0
  207. data/_sass/ui/_offcanvas.scss +17 -0
  208. data/_sass/ui/_pagination.scss +58 -0
  209. data/_sass/ui/_payments.scss +28 -0
  210. data/_sass/ui/_placeholder.scss +9 -0
  211. data/_sass/ui/_popovers.scss +2 -0
  212. data/_sass/ui/_progress.scss +107 -0
  213. data/_sass/ui/_ribbons.scss +157 -0
  214. data/_sass/ui/_segmented.scss +101 -0
  215. data/_sass/ui/_signature.scss +15 -0
  216. data/_sass/ui/_social.scss +52 -0
  217. data/_sass/ui/_stars.scss +13 -0
  218. data/_sass/ui/_status.scss +163 -0
  219. data/_sass/ui/_steps.scss +156 -0
  220. data/_sass/ui/_switch-icon.scss +211 -0
  221. data/_sass/ui/_tables.scss +177 -0
  222. data/_sass/ui/_tags.scss +57 -0
  223. data/_sass/ui/_timeline.scss +61 -0
  224. data/_sass/ui/_toasts.scss +18 -0
  225. data/_sass/ui/_toolbar.scss +10 -0
  226. data/_sass/ui/_tracking.scss +29 -0
  227. data/_sass/ui/_type.scss +268 -0
  228. data/_sass/ui/forms/_form-check.scss +91 -0
  229. data/_sass/ui/forms/_form-colorinput.scss +54 -0
  230. data/_sass/ui/forms/_form-custom.scss +28 -0
  231. data/_sass/ui/forms/_form-icon.scss +35 -0
  232. data/_sass/ui/forms/_form-imagecheck.scss +105 -0
  233. data/_sass/ui/forms/_form-selectgroup.scss +153 -0
  234. data/_sass/ui/forms/_validation.scss +13 -0
  235. data/_sass/ui/typo/_hr.scss +77 -0
  236. data/_sass/utils/_background.scss +15 -0
  237. data/_sass/utils/_colors.scss +100 -0
  238. data/_sass/utils/_opacity.scss +7 -0
  239. data/_sass/utils/_scroll.scss +47 -0
  240. data/_sass/utils/_shadow.scss +9 -0
  241. data/_sass/utils/_sizing.scss +6 -0
  242. data/_sass/utils/_text.scss +15 -0
  243. data/_sass/vendors/_apexcharts.scss +48 -0
  244. data/_sass/vendors/_coloris.scss +72 -0
  245. data/_sass/vendors/_dropzone.scss +27 -0
  246. data/_sass/vendors/_fslightbox.scss +13 -0
  247. data/_sass/vendors/_jsvectormap.scss +47 -0
  248. data/_sass/vendors/_litepicker.scss +69 -0
  249. data/_sass/vendors/_nouislider.scss +49 -0
  250. data/_sass/vendors/_plyr.scss +3 -0
  251. data/_sass/vendors/_stars-rating.scss +22 -0
  252. data/_sass/vendors/_tinymce.scss +34 -0
  253. data/_sass/vendors/_tom-select.scss +81 -0
  254. data/_sass/vendors/_turbo.scss +3 -0
  255. data/_sass/vendors/_typed.scss +4 -0
  256. data/_sass/vendors/_wysiwyg.scss +34 -0
  257. data/assets/css/main.scss +10 -0
  258. data/assets/js/custom.js +175 -0
  259. data/assets/js/custom.min.js +1 -0
  260. data/assets/js/theme.js +12 -194
  261. data/assets/js/theme.min.js +12 -0
  262. data/insights4you-jekyll-theme.gemspec +93 -0
  263. metadata +386 -27
  264. data/_data/notifications.yml +0 -10
  265. data/_includes/footer.html +0 -48
  266. data/_includes/header-logo.html +0 -91
  267. data/_includes/header-navbar.html +0 -59
  268. data/_includes/header-svg.html +0 -275
  269. data/_layouts/home.html +0 -19
  270. data/_layouts/post.html +0 -19
  271. data/assets/css/theme.min.css +0 -120
@@ -0,0 +1,117 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/sanitizer.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ // js-docs-start allow-list
9
+ const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
10
+
11
+ export const DefaultAllowlist = {
12
+ // Global attributes allowed on any supplied element below.
13
+ '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
14
+ a: ['target', 'href', 'title', 'rel'],
15
+ area: [],
16
+ b: [],
17
+ br: [],
18
+ col: [],
19
+ code: [],
20
+ dd: [],
21
+ div: [],
22
+ dl: [],
23
+ dt: [],
24
+ em: [],
25
+ hr: [],
26
+ h1: [],
27
+ h2: [],
28
+ h3: [],
29
+ h4: [],
30
+ h5: [],
31
+ h6: [],
32
+ i: [],
33
+ img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
34
+ li: [],
35
+ ol: [],
36
+ p: [],
37
+ pre: [],
38
+ s: [],
39
+ small: [],
40
+ span: [],
41
+ sub: [],
42
+ sup: [],
43
+ strong: [],
44
+ u: [],
45
+ ul: []
46
+ }
47
+ // js-docs-end allow-list
48
+
49
+ const uriAttributes = new Set([
50
+ 'background',
51
+ 'cite',
52
+ 'href',
53
+ 'itemtype',
54
+ 'longdesc',
55
+ 'poster',
56
+ 'src',
57
+ 'xlink:href'
58
+ ])
59
+
60
+ /**
61
+ * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation
62
+ * contexts.
63
+ *
64
+ * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
65
+ */
66
+ // eslint-disable-next-line unicorn/better-regex
67
+ const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i
68
+
69
+ const allowedAttribute = (attribute, allowedAttributeList) => {
70
+ const attributeName = attribute.nodeName.toLowerCase()
71
+
72
+ if (allowedAttributeList.includes(attributeName)) {
73
+ if (uriAttributes.has(attributeName)) {
74
+ return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue))
75
+ }
76
+
77
+ return true
78
+ }
79
+
80
+ // Check if a regular expression validates the attribute.
81
+ return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
82
+ .some(regex => regex.test(attributeName))
83
+ }
84
+
85
+ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
86
+ if (!unsafeHtml.length) {
87
+ return unsafeHtml
88
+ }
89
+
90
+ if (sanitizeFunction && typeof sanitizeFunction === 'function') {
91
+ return sanitizeFunction(unsafeHtml)
92
+ }
93
+
94
+ const domParser = new window.DOMParser()
95
+ const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')
96
+ const elements = [].concat(...createdDocument.body.querySelectorAll('*'))
97
+
98
+ for (const element of elements) {
99
+ const elementName = element.nodeName.toLowerCase()
100
+
101
+ if (!Object.keys(allowList).includes(elementName)) {
102
+ element.remove()
103
+ continue
104
+ }
105
+
106
+ const attributeList = [].concat(...element.attributes)
107
+ const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])
108
+
109
+ for (const attribute of attributeList) {
110
+ if (!allowedAttribute(attribute, allowedAttributes)) {
111
+ element.removeAttribute(attribute.nodeName)
112
+ }
113
+ }
114
+ }
115
+
116
+ return createdDocument.body.innerHTML
117
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/scrollBar.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ import Manipulator from '../dom/manipulator.js'
9
+ import SelectorEngine from '../dom/selector-engine.js'
10
+ import { isElement } from './index.js'
11
+
12
+ /**
13
+ * Constants
14
+ */
15
+
16
+ const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'
17
+ const SELECTOR_STICKY_CONTENT = '.sticky-top'
18
+ const PROPERTY_PADDING = 'padding-right'
19
+ const PROPERTY_MARGIN = 'margin-right'
20
+
21
+ /**
22
+ * Class definition
23
+ */
24
+
25
+ class ScrollBarHelper {
26
+ constructor() {
27
+ this._element = document.body
28
+ }
29
+
30
+ // Public
31
+ getWidth() {
32
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
33
+ const documentWidth = document.documentElement.clientWidth
34
+ return Math.abs(window.innerWidth - documentWidth)
35
+ }
36
+
37
+ hide() {
38
+ const width = this.getWidth()
39
+ this._disableOverFlow()
40
+ // give padding to element to balance the hidden scrollbar width
41
+ this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width)
42
+ // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
43
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width)
44
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width)
45
+ }
46
+
47
+ reset() {
48
+ this._resetElementAttributes(this._element, 'overflow')
49
+ this._resetElementAttributes(this._element, PROPERTY_PADDING)
50
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING)
51
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN)
52
+ }
53
+
54
+ isOverflowing() {
55
+ return this.getWidth() > 0
56
+ }
57
+
58
+ // Private
59
+ _disableOverFlow() {
60
+ this._saveInitialAttribute(this._element, 'overflow')
61
+ this._element.style.overflow = 'hidden'
62
+ }
63
+
64
+ _setElementAttributes(selector, styleProperty, callback) {
65
+ const scrollbarWidth = this.getWidth()
66
+ const manipulationCallBack = element => {
67
+ if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
68
+ return
69
+ }
70
+
71
+ this._saveInitialAttribute(element, styleProperty)
72
+ const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty)
73
+ element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`)
74
+ }
75
+
76
+ this._applyManipulationCallback(selector, manipulationCallBack)
77
+ }
78
+
79
+ _saveInitialAttribute(element, styleProperty) {
80
+ const actualValue = element.style.getPropertyValue(styleProperty)
81
+ if (actualValue) {
82
+ Manipulator.setDataAttribute(element, styleProperty, actualValue)
83
+ }
84
+ }
85
+
86
+ _resetElementAttributes(selector, styleProperty) {
87
+ const manipulationCallBack = element => {
88
+ const value = Manipulator.getDataAttribute(element, styleProperty)
89
+ // We only want to remove the property if the value is `null`; the value can also be zero
90
+ if (value === null) {
91
+ element.style.removeProperty(styleProperty)
92
+ return
93
+ }
94
+
95
+ Manipulator.removeDataAttribute(element, styleProperty)
96
+ element.style.setProperty(styleProperty, value)
97
+ }
98
+
99
+ this._applyManipulationCallback(selector, manipulationCallBack)
100
+ }
101
+
102
+ _applyManipulationCallback(selector, callBack) {
103
+ if (isElement(selector)) {
104
+ callBack(selector)
105
+ return
106
+ }
107
+
108
+ for (const sel of SelectorEngine.find(selector, this._element)) {
109
+ callBack(sel)
110
+ }
111
+ }
112
+ }
113
+
114
+ export default ScrollBarHelper
@@ -0,0 +1,146 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/swipe.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ import EventHandler from '../dom/event-handler.js'
9
+ import Config from './config.js'
10
+ import { execute } from './index.js'
11
+
12
+ /**
13
+ * Constants
14
+ */
15
+
16
+ const NAME = 'swipe'
17
+ const EVENT_KEY = '.bs.swipe'
18
+ const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`
19
+ const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`
20
+ const EVENT_TOUCHEND = `touchend${EVENT_KEY}`
21
+ const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`
22
+ const EVENT_POINTERUP = `pointerup${EVENT_KEY}`
23
+ const POINTER_TYPE_TOUCH = 'touch'
24
+ const POINTER_TYPE_PEN = 'pen'
25
+ const CLASS_NAME_POINTER_EVENT = 'pointer-event'
26
+ const SWIPE_THRESHOLD = 40
27
+
28
+ const Default = {
29
+ endCallback: null,
30
+ leftCallback: null,
31
+ rightCallback: null
32
+ }
33
+
34
+ const DefaultType = {
35
+ endCallback: '(function|null)',
36
+ leftCallback: '(function|null)',
37
+ rightCallback: '(function|null)'
38
+ }
39
+
40
+ /**
41
+ * Class definition
42
+ */
43
+
44
+ class Swipe extends Config {
45
+ constructor(element, config) {
46
+ super()
47
+ this._element = element
48
+
49
+ if (!element || !Swipe.isSupported()) {
50
+ return
51
+ }
52
+
53
+ this._config = this._getConfig(config)
54
+ this._deltaX = 0
55
+ this._supportPointerEvents = Boolean(window.PointerEvent)
56
+ this._initEvents()
57
+ }
58
+
59
+ // Getters
60
+ static get Default() {
61
+ return Default
62
+ }
63
+
64
+ static get DefaultType() {
65
+ return DefaultType
66
+ }
67
+
68
+ static get NAME() {
69
+ return NAME
70
+ }
71
+
72
+ // Public
73
+ dispose() {
74
+ EventHandler.off(this._element, EVENT_KEY)
75
+ }
76
+
77
+ // Private
78
+ _start(event) {
79
+ if (!this._supportPointerEvents) {
80
+ this._deltaX = event.touches[0].clientX
81
+
82
+ return
83
+ }
84
+
85
+ if (this._eventIsPointerPenTouch(event)) {
86
+ this._deltaX = event.clientX
87
+ }
88
+ }
89
+
90
+ _end(event) {
91
+ if (this._eventIsPointerPenTouch(event)) {
92
+ this._deltaX = event.clientX - this._deltaX
93
+ }
94
+
95
+ this._handleSwipe()
96
+ execute(this._config.endCallback)
97
+ }
98
+
99
+ _move(event) {
100
+ this._deltaX = event.touches && event.touches.length > 1 ?
101
+ 0 :
102
+ event.touches[0].clientX - this._deltaX
103
+ }
104
+
105
+ _handleSwipe() {
106
+ const absDeltaX = Math.abs(this._deltaX)
107
+
108
+ if (absDeltaX <= SWIPE_THRESHOLD) {
109
+ return
110
+ }
111
+
112
+ const direction = absDeltaX / this._deltaX
113
+
114
+ this._deltaX = 0
115
+
116
+ if (!direction) {
117
+ return
118
+ }
119
+
120
+ execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback)
121
+ }
122
+
123
+ _initEvents() {
124
+ if (this._supportPointerEvents) {
125
+ EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event))
126
+ EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event))
127
+
128
+ this._element.classList.add(CLASS_NAME_POINTER_EVENT)
129
+ } else {
130
+ EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event))
131
+ EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event))
132
+ EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event))
133
+ }
134
+ }
135
+
136
+ _eventIsPointerPenTouch(event) {
137
+ return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
138
+ }
139
+
140
+ // Static
141
+ static isSupported() {
142
+ return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
143
+ }
144
+ }
145
+
146
+ export default Swipe
@@ -0,0 +1,160 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/template-factory.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ import SelectorEngine from '../dom/selector-engine.js'
9
+ import Config from './config.js'
10
+ import { DefaultAllowlist, sanitizeHtml } from './sanitizer.js'
11
+ import { execute, getElement, isElement } from './index.js'
12
+
13
+ /**
14
+ * Constants
15
+ */
16
+
17
+ const NAME = 'TemplateFactory'
18
+
19
+ const Default = {
20
+ allowList: DefaultAllowlist,
21
+ content: {}, // { selector : text , selector2 : text2 , }
22
+ extraClass: '',
23
+ html: false,
24
+ sanitize: true,
25
+ sanitizeFn: null,
26
+ template: '<div></div>'
27
+ }
28
+
29
+ const DefaultType = {
30
+ allowList: 'object',
31
+ content: 'object',
32
+ extraClass: '(string|function)',
33
+ html: 'boolean',
34
+ sanitize: 'boolean',
35
+ sanitizeFn: '(null|function)',
36
+ template: 'string'
37
+ }
38
+
39
+ const DefaultContentType = {
40
+ entry: '(string|element|function|null)',
41
+ selector: '(string|element)'
42
+ }
43
+
44
+ /**
45
+ * Class definition
46
+ */
47
+
48
+ class TemplateFactory extends Config {
49
+ constructor(config) {
50
+ super()
51
+ this._config = this._getConfig(config)
52
+ }
53
+
54
+ // Getters
55
+ static get Default() {
56
+ return Default
57
+ }
58
+
59
+ static get DefaultType() {
60
+ return DefaultType
61
+ }
62
+
63
+ static get NAME() {
64
+ return NAME
65
+ }
66
+
67
+ // Public
68
+ getContent() {
69
+ return Object.values(this._config.content)
70
+ .map(config => this._resolvePossibleFunction(config))
71
+ .filter(Boolean)
72
+ }
73
+
74
+ hasContent() {
75
+ return this.getContent().length > 0
76
+ }
77
+
78
+ changeContent(content) {
79
+ this._checkContent(content)
80
+ this._config.content = { ...this._config.content, ...content }
81
+ return this
82
+ }
83
+
84
+ toHtml() {
85
+ const templateWrapper = document.createElement('div')
86
+ templateWrapper.innerHTML = this._maybeSanitize(this._config.template)
87
+
88
+ for (const [selector, text] of Object.entries(this._config.content)) {
89
+ this._setContent(templateWrapper, text, selector)
90
+ }
91
+
92
+ const template = templateWrapper.children[0]
93
+ const extraClass = this._resolvePossibleFunction(this._config.extraClass)
94
+
95
+ if (extraClass) {
96
+ template.classList.add(...extraClass.split(' '))
97
+ }
98
+
99
+ return template
100
+ }
101
+
102
+ // Private
103
+ _typeCheckConfig(config) {
104
+ super._typeCheckConfig(config)
105
+ this._checkContent(config.content)
106
+ }
107
+
108
+ _checkContent(arg) {
109
+ for (const [selector, content] of Object.entries(arg)) {
110
+ super._typeCheckConfig({ selector, entry: content }, DefaultContentType)
111
+ }
112
+ }
113
+
114
+ _setContent(template, content, selector) {
115
+ const templateElement = SelectorEngine.findOne(selector, template)
116
+
117
+ if (!templateElement) {
118
+ return
119
+ }
120
+
121
+ content = this._resolvePossibleFunction(content)
122
+
123
+ if (!content) {
124
+ templateElement.remove()
125
+ return
126
+ }
127
+
128
+ if (isElement(content)) {
129
+ this._putElementInTemplate(getElement(content), templateElement)
130
+ return
131
+ }
132
+
133
+ if (this._config.html) {
134
+ templateElement.innerHTML = this._maybeSanitize(content)
135
+ return
136
+ }
137
+
138
+ templateElement.textContent = content
139
+ }
140
+
141
+ _maybeSanitize(arg) {
142
+ return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg
143
+ }
144
+
145
+ _resolvePossibleFunction(arg) {
146
+ return execute(arg, [this])
147
+ }
148
+
149
+ _putElementInTemplate(element, templateElement) {
150
+ if (this._config.html) {
151
+ templateElement.innerHTML = ''
152
+ templateElement.append(element)
153
+ return
154
+ }
155
+
156
+ templateElement.textContent = element.textContent
157
+ }
158
+ }
159
+
160
+ export default TemplateFactory