@ulu/frontend 0.0.3 → 0.0.6

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 (285) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +3 -1
  3. package/js/deprecated/mini-collapsible.js +1 -1
  4. package/js/events/index.js +4 -1
  5. package/js/helpers/css-breakpoint.js +5 -7
  6. package/js/helpers/file-save.js +4 -0
  7. package/js/helpers/node-data-manager.js +4 -0
  8. package/js/helpers/pause-youtube-video.js +4 -0
  9. package/js/helpers/scrollbar-width-property.js +6 -2
  10. package/js/index.js +0 -2
  11. package/js/ui/flipcard.js +5 -1
  12. package/js/ui/grid.js +4 -0
  13. package/js/ui/modals.js +4 -1
  14. package/js/ui/overflow-scroller-pager.js +3 -0
  15. package/js/ui/overflow-scroller.js +4 -1
  16. package/js/ui/programmatic-modal.js +3 -0
  17. package/js/ui/resizer.js +3 -0
  18. package/js/ui/slider.js +7 -4
  19. package/js/ui/tabs.js +3 -0
  20. package/js/ui/tooltip.js +3 -0
  21. package/js/utils/logger.js +3 -0
  22. package/package.json +20 -11
  23. package/scss/_breakpoint.scss +3 -4
  24. package/scss/_button.scss +4 -4
  25. package/scss/_color.scss +2 -2
  26. package/scss/_grid.scss +0 -1
  27. package/scss/_layout.scss +2 -3
  28. package/scss/_typography.scss +2 -3
  29. package/scss/_utils.scss +21 -4
  30. package/scss/base/_normalize.scss +1 -1
  31. package/scss/helpers/_units.scss +7 -11
  32. package/scss/stylesheets/full.scss +1 -4
  33. package/js/polyfills/element-closest.js +0 -17
  34. package/js/utils/array.js +0 -28
  35. package/js/utils/dom.js +0 -122
  36. package/js/utils/object.js +0 -22
  37. package/js/utils/performance.js +0 -43
  38. package/js/utils/regex.js +0 -10
  39. package/js/utils/string.js +0 -107
  40. package/trash/js-old/deprecated/doc-ready.js +0 -28
  41. package/trash/js-old/deprecated/jquery-prototypes.js +0 -309
  42. package/trash/js-old/deprecated/mini-collapsible-popper-positioning.js +0 -126
  43. package/trash/js-old/deprecated/mini-collapsible.js +0 -607
  44. package/trash/js-old/deprecated/script-loader.js +0 -60
  45. package/trash/js-old/events/index.js +0 -42
  46. package/trash/js-old/helpers/css-breakpoint.js +0 -247
  47. package/trash/js-old/helpers/file-save.js +0 -48
  48. package/trash/js-old/helpers/node-data-manager.js +0 -74
  49. package/trash/js-old/helpers/pause-youtube-video.js +0 -42
  50. package/trash/js-old/index.js +0 -15
  51. package/trash/js-old/polyfills/element-closest.js +0 -17
  52. package/trash/js-old/ui/flipcard.js +0 -202
  53. package/trash/js-old/ui/grid.js +0 -67
  54. package/trash/js-old/ui/modals.js +0 -219
  55. package/trash/js-old/ui/programmatic-modal.js +0 -91
  56. package/trash/js-old/ui/resizer.js +0 -60
  57. package/trash/js-old/ui/slider.js +0 -469
  58. package/trash/js-old/ui/tabs.js +0 -109
  59. package/trash/js-old/ui/tooltip.js +0 -82
  60. package/trash/js-old/utils/array.js +0 -28
  61. package/trash/js-old/utils/dom.js +0 -122
  62. package/trash/js-old/utils/logger.js +0 -69
  63. package/trash/js-old/utils/object.js +0 -22
  64. package/trash/js-old/utils/performance.js +0 -43
  65. package/trash/js-old/utils/regex.js +0 -10
  66. package/trash/js-old/utils/string.js +0 -107
  67. package/trash/js-old/waypoints/README.md +0 -3
  68. package/trash/js-old/waypoints/anchor-menu.js +0 -76
  69. package/trash/js-old/waypoints/element-waypoint.js +0 -75
  70. package/trash/js-old/waypoints/examples/page-link-menu.md +0 -106
  71. package/trash/js-old/waypoints/state-in-attribute.js +0 -32
  72. package/trash/js-old-230729/deprecated/doc-ready.js +0 -28
  73. package/trash/js-old-230729/deprecated/jquery-prototypes.js +0 -309
  74. package/trash/js-old-230729/deprecated/mini-collapsible-popper-positioning.js +0 -126
  75. package/trash/js-old-230729/deprecated/mini-collapsible.js +0 -607
  76. package/trash/js-old-230729/deprecated/script-loader.js +0 -60
  77. package/trash/js-old-230729/events/index.js +0 -42
  78. package/trash/js-old-230729/helpers/css-breakpoint.js +0 -247
  79. package/trash/js-old-230729/helpers/file-save.js +0 -48
  80. package/trash/js-old-230729/helpers/node-data-manager.js +0 -74
  81. package/trash/js-old-230729/helpers/pause-youtube-video.js +0 -42
  82. package/trash/js-old-230729/helpers/scrollbar-width-property.js +0 -10
  83. package/trash/js-old-230729/index.js +0 -15
  84. package/trash/js-old-230729/polyfills/element-closest.js +0 -17
  85. package/trash/js-old-230729/ui/flipcard.js +0 -202
  86. package/trash/js-old-230729/ui/grid.js +0 -67
  87. package/trash/js-old-230729/ui/modals.js +0 -219
  88. package/trash/js-old-230729/ui/overflow-scroller-pager.js +0 -58
  89. package/trash/js-old-230729/ui/overflow-scroller.js +0 -160
  90. package/trash/js-old-230729/ui/programmatic-modal.js +0 -91
  91. package/trash/js-old-230729/ui/resizer.js +0 -60
  92. package/trash/js-old-230729/ui/slider.js +0 -468
  93. package/trash/js-old-230729/ui/tabs.js +0 -109
  94. package/trash/js-old-230729/ui/tooltip.js +0 -82
  95. package/trash/js-old-230729/utils/array.js +0 -28
  96. package/trash/js-old-230729/utils/dom.js +0 -122
  97. package/trash/js-old-230729/utils/logger.js +0 -69
  98. package/trash/js-old-230729/utils/object.js +0 -22
  99. package/trash/js-old-230729/utils/performance.js +0 -43
  100. package/trash/js-old-230729/utils/regex.js +0 -10
  101. package/trash/js-old-230729/utils/string.js +0 -107
  102. package/trash/js-old-230729/waypoints/README.md +0 -3
  103. package/trash/js-old-230729/waypoints/anchor-menu.js +0 -76
  104. package/trash/js-old-230729/waypoints/element-waypoint.js +0 -75
  105. package/trash/js-old-230729/waypoints/examples/page-link-menu.md +0 -106
  106. package/trash/js-old-230729/waypoints/state-in-attribute.js +0 -32
  107. package/trash/logo-1.svg +0 -13
  108. package/trash/logo.svg +0 -16
  109. package/trash/scss-before-cqc-update/README.md +0 -58
  110. package/trash/scss-before-cqc-update/_breakpoint.scss +0 -190
  111. package/trash/scss-before-cqc-update/_button.scss +0 -229
  112. package/trash/scss-before-cqc-update/_calculate.scss +0 -65
  113. package/trash/scss-before-cqc-update/_color.scss +0 -211
  114. package/trash/scss-before-cqc-update/_cssvar.scss +0 -116
  115. package/trash/scss-before-cqc-update/_element.scss +0 -275
  116. package/trash/scss-before-cqc-update/_index.scss +0 -29
  117. package/trash/scss-before-cqc-update/_layout.scss +0 -247
  118. package/trash/scss-before-cqc-update/_path.scss +0 -59
  119. package/trash/scss-before-cqc-update/_selector.scss +0 -82
  120. package/trash/scss-before-cqc-update/_typography.scss +0 -322
  121. package/trash/scss-before-cqc-update/_units.scss +0 -48
  122. package/trash/scss-before-cqc-update/_utility.scss +0 -13
  123. package/trash/scss-before-cqc-update/_utils.scss +0 -211
  124. package/trash/scss-before-cqc-update/base/_color.scss +0 -14
  125. package/trash/scss-before-cqc-update/base/_elements.scss +0 -189
  126. package/trash/scss-before-cqc-update/base/_index.scss +0 -63
  127. package/trash/scss-before-cqc-update/base/_keyframes.scss +0 -74
  128. package/trash/scss-before-cqc-update/base/_layout.scss +0 -88
  129. package/trash/scss-before-cqc-update/base/_normalize.scss +0 -316
  130. package/trash/scss-before-cqc-update/base/_typography.scss +0 -42
  131. package/trash/scss-before-cqc-update/components/README.md +0 -5
  132. package/trash/scss-before-cqc-update/components/README.todos +0 -15
  133. package/trash/scss-before-cqc-update/components/_button.scss +0 -96
  134. package/trash/scss-before-cqc-update/components/_grid.scss +0 -671
  135. package/trash/scss-before-cqc-update/components/_index.scss +0 -70
  136. package/trash/scss-before-cqc-update/components/_links.scss +0 -35
  137. package/trash/scss-before-cqc-update/components/_list-lines.scss +0 -74
  138. package/trash/scss-before-cqc-update/components/_list-ordered.scss +0 -17
  139. package/trash/scss-before-cqc-update/components/_list-unordered.scss +0 -22
  140. package/trash/scss-before-cqc-update/components/_rule.scss +0 -94
  141. package/trash/scss-before-cqc-update/helpers/_color.scss +0 -15
  142. package/trash/scss-before-cqc-update/helpers/_display.scss +0 -73
  143. package/trash/scss-before-cqc-update/helpers/_index.scss +0 -68
  144. package/trash/scss-before-cqc-update/helpers/_print.scss +0 -59
  145. package/trash/scss-before-cqc-update/helpers/_typography.scss +0 -73
  146. package/trash/scss-before-cqc-update/helpers/_units.scss +0 -79
  147. package/trash/scss-before-cqc-update/helpers/_utilities.scss +0 -88
  148. package/trash/scss-before-cqc-update/stylesheets/README.md +0 -3
  149. package/trash/scss-before-cqc-update/stylesheets/full.scss +0 -17
  150. package/trash/scss-old/README.md +0 -58
  151. package/trash/scss-old/_breakpoint.scss +0 -140
  152. package/trash/scss-old/_button.scss +0 -223
  153. package/trash/scss-old/_calculate.scss +0 -64
  154. package/trash/scss-old/_color.scss +0 -200
  155. package/trash/scss-old/_element.scss +0 -262
  156. package/trash/scss-old/_grid.scss +0 -558
  157. package/trash/scss-old/_index.scss +0 -25
  158. package/trash/scss-old/_layout.scss +0 -170
  159. package/trash/scss-old/_path.scss +0 -58
  160. package/trash/scss-old/_selector.scss +0 -81
  161. package/trash/scss-old/_typography.scss +0 -320
  162. package/trash/scss-old/_units.scss +0 -47
  163. package/trash/scss-old/_utility.scss +0 -12
  164. package/trash/scss-old/_utils.scss +0 -186
  165. package/trash/scss-old/base/_color.scss +0 -13
  166. package/trash/scss-old/base/_elements.scss +0 -183
  167. package/trash/scss-old/base/_index.scss +0 -62
  168. package/trash/scss-old/base/_keyframes.scss +0 -74
  169. package/trash/scss-old/base/_layout.scss +0 -81
  170. package/trash/scss-old/base/_normalize.scss +0 -316
  171. package/trash/scss-old/base/_typography.scss +0 -42
  172. package/trash/scss-old/components/README.md +0 -5
  173. package/trash/scss-old/components/README.todos +0 -15
  174. package/trash/scss-old/components/_button.scss +0 -74
  175. package/trash/scss-old/components/_index.scss +0 -63
  176. package/trash/scss-old/components/_links.scss +0 -34
  177. package/trash/scss-old/components/_list-lines.scss +0 -73
  178. package/trash/scss-old/components/_list-ordered.scss +0 -16
  179. package/trash/scss-old/components/_list-unordered.scss +0 -21
  180. package/trash/scss-old/components/_rule.scss +0 -84
  181. package/trash/scss-old/helpers/_color.scss +0 -14
  182. package/trash/scss-old/helpers/_display.scss +0 -68
  183. package/trash/scss-old/helpers/_index.scss +0 -67
  184. package/trash/scss-old/helpers/_print.scss +0 -59
  185. package/trash/scss-old/helpers/_typography.scss +0 -73
  186. package/trash/scss-old/helpers/_units.scss +0 -68
  187. package/trash/scss-old/helpers/_utilities.scss +0 -82
  188. package/trash/scss-old/packages/README.md +0 -3
  189. package/trash/scss-old/packages/everything.scss +0 -17
  190. package/trash/scss-old-2/README.md +0 -58
  191. package/trash/scss-old-2/_breakpoint.scss +0 -139
  192. package/trash/scss-old-2/_button.scss +0 -223
  193. package/trash/scss-old-2/_calculate.scss +0 -64
  194. package/trash/scss-old-2/_color.scss +0 -202
  195. package/trash/scss-old-2/_element.scss +0 -263
  196. package/trash/scss-old-2/_grid.scss +0 -558
  197. package/trash/scss-old-2/_index.scss +0 -25
  198. package/trash/scss-old-2/_layout.scss +0 -170
  199. package/trash/scss-old-2/_path.scss +0 -58
  200. package/trash/scss-old-2/_selector.scss +0 -81
  201. package/trash/scss-old-2/_typography.scss +0 -320
  202. package/trash/scss-old-2/_units.scss +0 -47
  203. package/trash/scss-old-2/_utility.scss +0 -12
  204. package/trash/scss-old-2/_utils.scss +0 -186
  205. package/trash/scss-old-2/base/_color.scss +0 -13
  206. package/trash/scss-old-2/base/_elements.scss +0 -182
  207. package/trash/scss-old-2/base/_index.scss +0 -62
  208. package/trash/scss-old-2/base/_keyframes.scss +0 -73
  209. package/trash/scss-old-2/base/_layout.scss +0 -83
  210. package/trash/scss-old-2/base/_normalize.scss +0 -315
  211. package/trash/scss-old-2/base/_typography.scss +0 -41
  212. package/trash/scss-old-2/components/README.md +0 -5
  213. package/trash/scss-old-2/components/README.todos +0 -15
  214. package/trash/scss-old-2/components/_button.scss +0 -95
  215. package/trash/scss-old-2/components/_index.scss +0 -63
  216. package/trash/scss-old-2/components/_links.scss +0 -33
  217. package/trash/scss-old-2/components/_list-lines.scss +0 -73
  218. package/trash/scss-old-2/components/_list-ordered.scss +0 -16
  219. package/trash/scss-old-2/components/_list-unordered.scss +0 -21
  220. package/trash/scss-old-2/components/_rule.scss +0 -84
  221. package/trash/scss-old-2/helpers/_color.scss +0 -14
  222. package/trash/scss-old-2/helpers/_display.scss +0 -67
  223. package/trash/scss-old-2/helpers/_index.scss +0 -67
  224. package/trash/scss-old-2/helpers/_print.scss +0 -58
  225. package/trash/scss-old-2/helpers/_typography.scss +0 -72
  226. package/trash/scss-old-2/helpers/_units.scss +0 -68
  227. package/trash/scss-old-2/helpers/_utilities.scss +0 -81
  228. package/trash/scss-old-2/packages/README.md +0 -3
  229. package/trash/scss-old-2/packages/everything.scss +0 -17
  230. package/trash/scss-old-230729/README.md +0 -58
  231. package/trash/scss-old-230729/_breakpoint.scss +0 -139
  232. package/trash/scss-old-230729/_button.scss +0 -223
  233. package/trash/scss-old-230729/_calculate.scss +0 -64
  234. package/trash/scss-old-230729/_color.scss +0 -202
  235. package/trash/scss-old-230729/_element.scss +0 -273
  236. package/trash/scss-old-230729/_grid.scss +0 -694
  237. package/trash/scss-old-230729/_index.scss +0 -25
  238. package/trash/scss-old-230729/_layout.scss +0 -193
  239. package/trash/scss-old-230729/_path.scss +0 -58
  240. package/trash/scss-old-230729/_selector.scss +0 -81
  241. package/trash/scss-old-230729/_typography.scss +0 -320
  242. package/trash/scss-old-230729/_units.scss +0 -47
  243. package/trash/scss-old-230729/_utility.scss +0 -12
  244. package/trash/scss-old-230729/_utils.scss +0 -186
  245. package/trash/scss-old-230729/base/_color.scss +0 -13
  246. package/trash/scss-old-230729/base/_elements.scss +0 -188
  247. package/trash/scss-old-230729/base/_index.scss +0 -62
  248. package/trash/scss-old-230729/base/_keyframes.scss +0 -73
  249. package/trash/scss-old-230729/base/_layout.scss +0 -83
  250. package/trash/scss-old-230729/base/_normalize.scss +0 -315
  251. package/trash/scss-old-230729/base/_typography.scss +0 -41
  252. package/trash/scss-old-230729/components/README.md +0 -5
  253. package/trash/scss-old-230729/components/README.todos +0 -15
  254. package/trash/scss-old-230729/components/_button.scss +0 -95
  255. package/trash/scss-old-230729/components/_index.scss +0 -63
  256. package/trash/scss-old-230729/components/_links.scss +0 -34
  257. package/trash/scss-old-230729/components/_list-lines.scss +0 -73
  258. package/trash/scss-old-230729/components/_list-ordered.scss +0 -16
  259. package/trash/scss-old-230729/components/_list-unordered.scss +0 -21
  260. package/trash/scss-old-230729/components/_rule.scss +0 -93
  261. package/trash/scss-old-230729/helpers/_color.scss +0 -14
  262. package/trash/scss-old-230729/helpers/_display.scss +0 -73
  263. package/trash/scss-old-230729/helpers/_index.scss +0 -67
  264. package/trash/scss-old-230729/helpers/_print.scss +0 -58
  265. package/trash/scss-old-230729/helpers/_typography.scss +0 -72
  266. package/trash/scss-old-230729/helpers/_units.scss +0 -68
  267. package/trash/scss-old-230729/helpers/_utilities.scss +0 -87
  268. package/trash/scss-old-230729/packages/README.md +0 -3
  269. package/trash/scss-old-230729/packages/everything.scss +0 -17
  270. package/trash/vue/directives/background-image-url.js +0 -12
  271. package/trash/vue/helpers/add-required-components.js +0 -14
  272. package/trash/vue/ui/CollapsibleRegion/CollapsibleRegion.vue +0 -277
  273. package/trash/vue/ui/CollapsibleRegion/Demo.vue +0 -101
  274. package/trash/vue/ui/Dropdown/Dropdown.vue +0 -184
  275. package/trash/vue/ui/Modals/components/Modal.vue +0 -49
  276. package/trash/vue/ui/Modals/components/Modals.vue +0 -103
  277. package/trash/vue/ui/Modals/plugin.js +0 -215
  278. package/trash/vue/ui/Modals/readme.note +0 -10
  279. package/trash/vue/ui/Modals/reference/example-usage.vue +0 -27
  280. package/trash/vue/ui/Modals/reference/wcag-example/dialog.js +0 -324
  281. /package/js/{waypoints → deprecated/waypoints}/README.md +0 -0
  282. /package/js/{waypoints → deprecated/waypoints}/anchor-menu.js +0 -0
  283. /package/js/{waypoints → deprecated/waypoints}/element-waypoint.js +0 -0
  284. /package/js/{waypoints → deprecated/waypoints}/examples/page-link-menu.md +0 -0
  285. /package/js/{waypoints → deprecated/waypoints}/state-in-attribute.js +0 -0
@@ -1,42 +0,0 @@
1
- import { debounce } from "../utils/performance";
2
-
3
- /**
4
- * Event object - called on dispatch
5
- */
6
- const events = {
7
- pageModified(context) {
8
- context.dispatchEvent(new Event(getName("pageModified"), { bubbles: true }));
9
- },
10
- pageResized(context) {
11
- context.dispatchEvent(new Event(getName("pageResized"), { bubbles: true }));
12
- }
13
- }
14
-
15
- // Add global document events
16
- window.addEventListener('resize', debounce(() => dispatch("pageResized", document), 250));
17
-
18
- /**
19
- * Triggers one of our custom events
20
- * @param {String} type Type of event to dispatch
21
- * @param {Node} context Element to trigger the event from
22
- * @example
23
- * if (updatedMarkup) {
24
- * dispatch("pageModified", modalElement);
25
- * }
26
- */
27
- export function dispatch(type, context) {
28
- if (events[type]) {
29
- events[type](context);
30
- } else {
31
- console.warn(`Unable to dispatch site event: ${ type } in context:`, context);
32
- }
33
- }
34
-
35
- /**
36
- * Handles the actual event names being used (future could namespace)
37
- * @param {String} type Type of event to get the actual event name for
38
- * @returns {String}
39
- */
40
- export function getName(type) {
41
- return "ulu:" + type;
42
- }
@@ -1,247 +0,0 @@
1
- // =============================================================================
2
- // Grabs Breakpoint from CSS
3
- // =============================================================================
4
-
5
- // Version: 1.0.6
6
-
7
- // Description: Pass breakpoints from CSS to stylesheet, use this to attach
8
- // behaviors on breakpoints
9
-
10
- import { debounce } from "../utils/performance";
11
- import { getName } from "../events/index.js";
12
- import { removeArrayElement } from "../utils/array";
13
- import { log, logError } from "../utils/logger.js";
14
-
15
- /**
16
- * Resize Handler to update breakpoints for all instances (Called after resize finished)
17
- */
18
- window.addEventListener(getName("pageResized"), () => {
19
- CssBreakpoints.instances.forEach(i => i.update());
20
- });
21
-
22
- /**
23
- * Class that provides method for retrieving and acting on breakpoints passed
24
- * from CSS (using element psuedo content prop)
25
- */
26
- export class CssBreakpoints {
27
- static instances = [];
28
- static defaults = {
29
- element: document.body,
30
- psuedoSelector: ':before',
31
- debug: false
32
- }
33
- /**
34
- * @param {Object} config Configruation object
35
- * @param {Array} config.order Required, Array of strings that correspond to the breakpoints setup in the styles, Breakpoints from smallest to largest
36
- * @param {Node} config.element The element to retrieve active breakpoint from stylesheet (default is body)
37
- * @param {String} config.psuedoSelector Change psuedo selector used to get the breakpoint from the psuedo's content property
38
- */
39
- constructor(config) {
40
- if (!config.order) {
41
- logError(this, 'Missing order (required)!');
42
- }
43
- Object.assign(this, CssBreakpoints.defaults, config);
44
- this.active = null;
45
- this.previous = null;
46
- this.activeIndex = null;
47
- this.resizeDirection = null;
48
- this.previousIndex = null;
49
- this.breakpoints = {};
50
- this.order.forEach(n => this.breakpoints[n] = new Breakpoint(n, this));
51
- log(this, this);
52
- this.update(); // Run for the first time, then whenever browser resizes
53
- CssBreakpoints.instances.push(this);
54
- }
55
- /**
56
- * Get breakpoint from element (design note: user could override prototype)
57
- */
58
- getBreakpoint() {
59
- return window.getComputedStyle(this.element, this.psuedoSelector).content.replace(/^"|"$/g, '');
60
- }
61
- /**
62
- * Updates the active breakpoint by checking the element and executes handlers on change
63
- */
64
- update() {
65
- const name = this.getBreakpoint();
66
- // console.log('name:\n', name);
67
- if (name === this.active) return;
68
- // this.log(`current breakpoint: ${ name }`);
69
- // Update active and cache last
70
- this.previous = this.active;
71
- this.previousIndex = this.activeIndex;
72
-
73
- const index = this.order.indexOf(name);
74
- this.active = name;
75
- this.activeIndex = index;
76
- const activeBreakpoint = this.at(this.active);
77
- // Get arrays of breakpoints based on the order array
78
- const mapBreakpoints = n => this.at(n);
79
- // From breakpoint to end (highest)
80
- const max = this.order.slice(index).map(mapBreakpoints);
81
- const notMax = this.order.slice(0, index).map(mapBreakpoints);
82
- // From start up to this breakpoint
83
- const min = this.order.slice(0, index + 1).map(mapBreakpoints);
84
- const notMin = this.order.slice(index + 1).map(mapBreakpoints);
85
- const notOnly = this.order.slice().map(mapBreakpoints);
86
- notOnly.splice(index, 1);
87
-
88
- log(this, 'max:', max.map(b => b.name).join());
89
- log(this, 'min:', min.map(b => b.name).join());
90
-
91
- max.forEach(b => b._setDirection('max', true));
92
- min.forEach(b => b._setDirection('min', true));
93
- activeBreakpoint._setDirection('only', true);
94
-
95
- notMax.forEach(b => b._setDirection('max', false));
96
- notMin.forEach(b => b._setDirection('min', false));
97
- notOnly.forEach(b => b._setDirection('only', false));
98
-
99
- // Set direction (extra info if needed)
100
- if (this.previousIndex !== null) {
101
- this.resizeDirection = this.previousIndex < index ? "up" : "down";
102
- }
103
- }
104
- /**
105
- * Get a breakpoint by key
106
- * @param {String} name The name of the breakpoint to get
107
- */
108
- at(name) {
109
- const bp = this.breakpoints[name];
110
- if (!name) {
111
- logError(this, 'Unable to find breakpoint for:', bp);
112
- }
113
- return bp;
114
- }
115
- }
116
- /**
117
- * Used to handle a breakpoints direction's handler and state
118
- */
119
- class BreakpointDirection {
120
- constructor(direction, breakpoint) {
121
- this.direction = direction; // String name (logging)
122
- this.active = false;
123
- this.on = [];
124
- this.off = []; // Triggered when direction has been set to active and then set to inactive (not on initial inactive)
125
- this.breakpoint = breakpoint; // Reference to parent
126
- }
127
- /**
128
- * Change the state of the direction
129
- */
130
- change(to) {
131
- if (this.active !== to) {
132
- if (to) this._call(true);
133
- else if (this.active) this._call(false); // Going from active to inactive
134
- this.active = to;
135
- }
136
- }
137
- /**
138
- * Calls all functions in handlers or
139
- */
140
- _call(forActive) {
141
- const handlers = forActive ? this.on : this.off;
142
- handlers.forEach(handler => handler());
143
- log(this.breakpoint._manager, `Handlers called (${ forActive ? 'on' : 'off' }): ${ this.direction }`);
144
- }
145
- /**
146
- * Returns handlers in normalized object format on/off
147
- */
148
- getHandlers(handler) {
149
- return typeof handler !== "object" ? { on: handler } : handler;
150
- }
151
- /**
152
- * Adds a handler for the direction, optionally use object to add off state handler
153
- * @param {Function|Object} handler Function to be executed when direction is active, read object description for on/off
154
- * @param {Function|Object} handler.on Function to be executed when direction is active
155
- * @param {Function|Object} handler.off Function to be executed when direction was active and is now changed to inactive
156
- */
157
- add(handler) {
158
- const handlers = this.getHandlers(handler);
159
- if (handlers.on) {
160
- this.on.push(handlers.on);
161
- }
162
- if (handlers.off) {
163
- this.off.push(handlers.off);
164
- }
165
- // Already active when handler was added, fire now
166
- if (this.active && handlers.on) {
167
- handlers.on();
168
- log(this.breakpoint._manager, `Handler called immediately: ${ this.direction }`, handlers.on);
169
- }
170
- }
171
- /**
172
- * Removes a handler
173
- */
174
- remove(handler) {
175
- const handlers = this.getHandlers(handler);
176
- if (handlers.on) {
177
- removeArrayElement(this.on, handlers.on);
178
- }
179
- if (handlers.off) {
180
- removeArrayElement(this.off, handlers.off);
181
- }
182
- }
183
- }
184
- /**
185
- * Single breakpoint management
186
- */
187
- class Breakpoint {
188
- constructor(name, manager) {
189
- this.directions = {
190
- max: new BreakpointDirection('max', this),
191
- min: new BreakpointDirection('min', this),
192
- only: new BreakpointDirection('only', this)
193
- };
194
- this._manager = manager; // Ref to parent class
195
- this.name = name;
196
- }
197
- /**
198
- * Private method used inrternally for managing direction activation
199
- * - Each direction manages it's own state and handlers
200
- * @param {String} direction The directional key
201
- * @param {Boolean} active State of that direction to set
202
- */
203
- _setDirection(direction, active) {
204
- this.directions[direction].change(active);
205
- }
206
- /**
207
- * Attach handler to be executed from the breakpoint and to all breakpoints below.
208
- * - If the browser resizes from a breakpoint below this breakpoint,
209
- * and above the breakpoint name specified, this handler will fire
210
- * @param {Function} handler Handler to be executed
211
- */
212
- max(handler) {
213
- this.directions.max.add(handler);
214
- }
215
- /**
216
- * Attach handler to be executed from the breakpoint and to all breakpoints below.
217
- * - If the browser resizes from a breakpoint above this breakpoint,
218
- * and below the breakpoint name specified, this handler will fire
219
- * @param {Function} handler Handler to be executed
220
- */
221
- min(handler) {
222
- this.directions.min.add(handler);
223
- }
224
- /**
225
- * Attach a handler to fire when the breakpoint is within the key
226
- * @param {Function} handler Handler to be executed
227
- */
228
- only(handler) {
229
- this.directions.only.add(handler);
230
- }
231
- /**
232
- * Remove handler
233
- * @param {Function} handler Handler to be removed, extended on/off object style can be used
234
- * @param {String} direction Remove handler only from specified direction, else search all directions
235
- */
236
- remove(handler, direction) {
237
- const directions = direction ? [ direction ] : ['max', 'min', 'only'];
238
- directions.forEach(d => d.remove(handler));
239
- }
240
-
241
- log(...msg) {
242
- msg.unshift(`Breakpoint (${ this.name }):`);
243
- this._manager.log.apply(this._manager, msg);
244
- }
245
- }
246
-
247
- export default CssBreakpoints;
@@ -1,48 +0,0 @@
1
- // Description: Simple script that is useful for testing. It will:
2
- // - Make a file
3
- // - Create a URL to it
4
- // - Gives utility function to create a link to the file (for front end)
5
- // - Gives method to destroy the file when no longer needed
6
- // - User can redefine the program by passing options object matching props.
7
-
8
- // Dependencies: No
9
-
10
- // Support: Limited to knew browsers that support Blob(), also user preferences or
11
- // type of browser may limit access to Blob functionality
12
-
13
- // Related Docs:
14
- // - https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob
15
- // - https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
16
- // - https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
17
-
18
-
19
- class FileSave {
20
- constructor(data, options) {
21
- this.filename = "filesave-file.txt";
22
- this.type = "text/plain;charset=utf-8";
23
- // Allow user to override above
24
- if (options) Object.assign(this, options);
25
- this.data = data;
26
- this.blob = new Blob([data], { type: this.type });
27
- this.url = URL.createObjectURL(this.blob);
28
- }
29
- destroy() {
30
- return URL.revokeObjectURL(this.url);
31
- }
32
- getUrl() {
33
- return this.url;
34
- }
35
- createLink(text) {
36
- var link = d.createElement('a');
37
- text = d.createTextNode(text);
38
- link.setAttribute('download', this.filename);
39
- link.setAttribute('href', this.url);
40
- link.appendChild(text);
41
- return link;
42
- }
43
- static isBrowserSupported() {
44
- return "FileReader" in window;
45
- }
46
- }
47
-
48
- export default FileSave;
@@ -1,74 +0,0 @@
1
- /**
2
- * Class that provides a method to store data based on node/element
3
- */
4
- export default class NodeDataManager {
5
- constructor() {
6
- this.store = [];
7
- }
8
- /**
9
- * Get data for an element/node
10
- * @param {Node} node Html Node/Element to get data for
11
- * @param {String|Boolean} key If key is passed, return that key's data for the element, if falsey return elements complete dataset
12
- */
13
- get(node, key = false) {
14
- const nodeData = this.find(node);
15
- if (nodeData) {
16
- return nodeData.get(key);
17
- }
18
- }
19
- /**
20
- * Bind data to a specific Node/Element
21
- * @param {Node} node Html Node/Element to get data for
22
- * @param {String} key Key to save the data under
23
- * @param {*} value Value to save
24
- */
25
- set(node, key, value) {
26
- const nodeData = this.find(node);
27
- if (nodeData) {
28
- nodeData.set(key, value);
29
- } else {
30
- this.store.push(new NodeDataStore(node, { [key] : value }));
31
- }
32
- }
33
- /**
34
- * Return an elements store object
35
- */
36
- find(node) {
37
- return this.store.find(nd => nd.isNode(node));
38
- }
39
- /**
40
- * Destroy all references to data and nodes/elements
41
- */
42
- destroy() {
43
- this.store.forEach(nd => nd.destroy());
44
- this.store = [];
45
- }
46
- }
47
- /**
48
- * Child class that provides a store for one specific node/element
49
- */
50
- export class NodeDataStore {
51
- constructor(node, data) {
52
- this.node = node;
53
- this.data = data || {}; // Lookup
54
- }
55
- set(key, value) {
56
- this.data[key] = value;
57
- }
58
- get(key = false) {
59
- return key ? this.data[key] : this.data;
60
- }
61
- remove(key) {
62
- delete this.data[key];
63
- }
64
- isNode(node) {
65
- return this.node.isSameNode(node);
66
- }
67
- clearData() {
68
- this.data = {};
69
- }
70
- destroy() {
71
- this.clearData();
72
- this.node = null;
73
- }
74
- }
@@ -1,42 +0,0 @@
1
- // Version: 1.0.4
2
- // Description: Pauses youtube using js api (iframe post message)
3
-
4
- const selectors = [
5
- '.youtube-embedded-video',
6
- 'iframe[title*="YouTube video player"]',
7
- 'iframe[src*="youtube.com/embed"]'
8
- ];
9
- /**
10
- * Somewhat hacky way to pause the video
11
- * - https://www.digitalredpanther.com/blog/play-pause-stop-youtube-embed
12
- * - Actual JS API documentation (Didn't follow this for now) (https://developers.google.com/youtube/iframe_api_reference)
13
- * @param {Element|Node} context The DOM element to search for and pause videos within
14
- */
15
- export function pauseVideos(context = document) {
16
- const videos = getVideos(context);
17
- videos.forEach(video => {
18
- try {
19
- video.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*');
20
- } catch (error) {
21
- console.error(error);
22
- }
23
- });
24
- }
25
- /**
26
- * Prep videos to be paused
27
- * - Add query parameters for js API
28
- * - Removes all other query parameters from iframe.src
29
- */
30
- export function prepVideos(context = document) {
31
- const videos = getVideos(context);
32
- videos.forEach(video => {
33
- const { src } = video;
34
- if (src) {
35
- video.src = src.split("?")[0] + "?rel=0&enablejsapi=1";
36
- }
37
- })
38
- }
39
-
40
- function getVideos(context) {
41
- return context.querySelectorAll(selectors.join(", "));
42
- }
@@ -1,10 +0,0 @@
1
-
2
- /**
3
- * Sets a CSS custom property equal to the scrollbar width
4
- * @param {Node} element The element that is the child of a scrollabel container
5
- * @param {Node} container The container that can be scrolled
6
- */
7
- export default function addScrollbarProperty(element = document.body, container = window) {
8
- const scrollbarWidth = container.innerWidth - element.clientWidth;
9
- element.style.setProperty("--scrollbar-width", `${ scrollbarWidth }px`);
10
- }
@@ -1,15 +0,0 @@
1
- // =============================================================================
2
- // Main Library Import
3
- // =============================================================================
4
-
5
- // Used for:
6
- // - Allow users to access commonly needed items with at one point/file
7
- // - Could allow changing of the ulu/js file structure if needed
8
- // - Will not include things that aren't used in every site (those would need to
9
- // imported manually
10
-
11
- import "./polyfills/element-closest.js";
12
-
13
- export { CssBreakpoints } from "./helpers/css-breakpoint.js";
14
- export * as events from "./events/index.js";
15
- export * as grid from "./ui/grid.js";
@@ -1,17 +0,0 @@
1
- if (!Element.prototype.matches) {
2
- Element.prototype.matches =
3
- Element.prototype.msMatchesSelector ||
4
- Element.prototype.webkitMatchesSelector;
5
- }
6
-
7
- if (!Element.prototype.closest) {
8
- Element.prototype.closest = function(s) {
9
- var el = this;
10
-
11
- do {
12
- if (Element.prototype.matches.call(el, s)) return el;
13
- el = el.parentElement || el.parentNode;
14
- } while (el !== null && el.nodeType === 1);
15
- return null;
16
- };
17
- }