@ulu/frontend 0.0.3 → 0.0.5

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 (246) hide show
  1. package/package.json +11 -10
  2. package/scss/_grid.scss +0 -1
  3. package/scss/_typography.scss +0 -1
  4. package/scss/helpers/_units.scss +1 -6
  5. package/scss/stylesheets/full.scss +1 -4
  6. package/trash/js-old/deprecated/doc-ready.js +0 -28
  7. package/trash/js-old/deprecated/jquery-prototypes.js +0 -309
  8. package/trash/js-old/deprecated/mini-collapsible-popper-positioning.js +0 -126
  9. package/trash/js-old/deprecated/mini-collapsible.js +0 -607
  10. package/trash/js-old/deprecated/script-loader.js +0 -60
  11. package/trash/js-old/events/index.js +0 -42
  12. package/trash/js-old/helpers/css-breakpoint.js +0 -247
  13. package/trash/js-old/helpers/file-save.js +0 -48
  14. package/trash/js-old/helpers/node-data-manager.js +0 -74
  15. package/trash/js-old/helpers/pause-youtube-video.js +0 -42
  16. package/trash/js-old/index.js +0 -15
  17. package/trash/js-old/polyfills/element-closest.js +0 -17
  18. package/trash/js-old/ui/flipcard.js +0 -202
  19. package/trash/js-old/ui/grid.js +0 -67
  20. package/trash/js-old/ui/modals.js +0 -219
  21. package/trash/js-old/ui/programmatic-modal.js +0 -91
  22. package/trash/js-old/ui/resizer.js +0 -60
  23. package/trash/js-old/ui/slider.js +0 -469
  24. package/trash/js-old/ui/tabs.js +0 -109
  25. package/trash/js-old/ui/tooltip.js +0 -82
  26. package/trash/js-old/utils/array.js +0 -28
  27. package/trash/js-old/utils/dom.js +0 -122
  28. package/trash/js-old/utils/logger.js +0 -69
  29. package/trash/js-old/utils/object.js +0 -22
  30. package/trash/js-old/utils/performance.js +0 -43
  31. package/trash/js-old/utils/regex.js +0 -10
  32. package/trash/js-old/utils/string.js +0 -107
  33. package/trash/js-old/waypoints/README.md +0 -3
  34. package/trash/js-old/waypoints/anchor-menu.js +0 -76
  35. package/trash/js-old/waypoints/element-waypoint.js +0 -75
  36. package/trash/js-old/waypoints/examples/page-link-menu.md +0 -106
  37. package/trash/js-old/waypoints/state-in-attribute.js +0 -32
  38. package/trash/js-old-230729/deprecated/doc-ready.js +0 -28
  39. package/trash/js-old-230729/deprecated/jquery-prototypes.js +0 -309
  40. package/trash/js-old-230729/deprecated/mini-collapsible-popper-positioning.js +0 -126
  41. package/trash/js-old-230729/deprecated/mini-collapsible.js +0 -607
  42. package/trash/js-old-230729/deprecated/script-loader.js +0 -60
  43. package/trash/js-old-230729/events/index.js +0 -42
  44. package/trash/js-old-230729/helpers/css-breakpoint.js +0 -247
  45. package/trash/js-old-230729/helpers/file-save.js +0 -48
  46. package/trash/js-old-230729/helpers/node-data-manager.js +0 -74
  47. package/trash/js-old-230729/helpers/pause-youtube-video.js +0 -42
  48. package/trash/js-old-230729/helpers/scrollbar-width-property.js +0 -10
  49. package/trash/js-old-230729/index.js +0 -15
  50. package/trash/js-old-230729/polyfills/element-closest.js +0 -17
  51. package/trash/js-old-230729/ui/flipcard.js +0 -202
  52. package/trash/js-old-230729/ui/grid.js +0 -67
  53. package/trash/js-old-230729/ui/modals.js +0 -219
  54. package/trash/js-old-230729/ui/overflow-scroller-pager.js +0 -58
  55. package/trash/js-old-230729/ui/overflow-scroller.js +0 -160
  56. package/trash/js-old-230729/ui/programmatic-modal.js +0 -91
  57. package/trash/js-old-230729/ui/resizer.js +0 -60
  58. package/trash/js-old-230729/ui/slider.js +0 -468
  59. package/trash/js-old-230729/ui/tabs.js +0 -109
  60. package/trash/js-old-230729/ui/tooltip.js +0 -82
  61. package/trash/js-old-230729/utils/array.js +0 -28
  62. package/trash/js-old-230729/utils/dom.js +0 -122
  63. package/trash/js-old-230729/utils/logger.js +0 -69
  64. package/trash/js-old-230729/utils/object.js +0 -22
  65. package/trash/js-old-230729/utils/performance.js +0 -43
  66. package/trash/js-old-230729/utils/regex.js +0 -10
  67. package/trash/js-old-230729/utils/string.js +0 -107
  68. package/trash/js-old-230729/waypoints/README.md +0 -3
  69. package/trash/js-old-230729/waypoints/anchor-menu.js +0 -76
  70. package/trash/js-old-230729/waypoints/element-waypoint.js +0 -75
  71. package/trash/js-old-230729/waypoints/examples/page-link-menu.md +0 -106
  72. package/trash/js-old-230729/waypoints/state-in-attribute.js +0 -32
  73. package/trash/logo-1.svg +0 -13
  74. package/trash/logo.svg +0 -16
  75. package/trash/scss-before-cqc-update/README.md +0 -58
  76. package/trash/scss-before-cqc-update/_breakpoint.scss +0 -190
  77. package/trash/scss-before-cqc-update/_button.scss +0 -229
  78. package/trash/scss-before-cqc-update/_calculate.scss +0 -65
  79. package/trash/scss-before-cqc-update/_color.scss +0 -211
  80. package/trash/scss-before-cqc-update/_cssvar.scss +0 -116
  81. package/trash/scss-before-cqc-update/_element.scss +0 -275
  82. package/trash/scss-before-cqc-update/_index.scss +0 -29
  83. package/trash/scss-before-cqc-update/_layout.scss +0 -247
  84. package/trash/scss-before-cqc-update/_path.scss +0 -59
  85. package/trash/scss-before-cqc-update/_selector.scss +0 -82
  86. package/trash/scss-before-cqc-update/_typography.scss +0 -322
  87. package/trash/scss-before-cqc-update/_units.scss +0 -48
  88. package/trash/scss-before-cqc-update/_utility.scss +0 -13
  89. package/trash/scss-before-cqc-update/_utils.scss +0 -211
  90. package/trash/scss-before-cqc-update/base/_color.scss +0 -14
  91. package/trash/scss-before-cqc-update/base/_elements.scss +0 -189
  92. package/trash/scss-before-cqc-update/base/_index.scss +0 -63
  93. package/trash/scss-before-cqc-update/base/_keyframes.scss +0 -74
  94. package/trash/scss-before-cqc-update/base/_layout.scss +0 -88
  95. package/trash/scss-before-cqc-update/base/_normalize.scss +0 -316
  96. package/trash/scss-before-cqc-update/base/_typography.scss +0 -42
  97. package/trash/scss-before-cqc-update/components/README.md +0 -5
  98. package/trash/scss-before-cqc-update/components/README.todos +0 -15
  99. package/trash/scss-before-cqc-update/components/_button.scss +0 -96
  100. package/trash/scss-before-cqc-update/components/_grid.scss +0 -671
  101. package/trash/scss-before-cqc-update/components/_index.scss +0 -70
  102. package/trash/scss-before-cqc-update/components/_links.scss +0 -35
  103. package/trash/scss-before-cqc-update/components/_list-lines.scss +0 -74
  104. package/trash/scss-before-cqc-update/components/_list-ordered.scss +0 -17
  105. package/trash/scss-before-cqc-update/components/_list-unordered.scss +0 -22
  106. package/trash/scss-before-cqc-update/components/_rule.scss +0 -94
  107. package/trash/scss-before-cqc-update/helpers/_color.scss +0 -15
  108. package/trash/scss-before-cqc-update/helpers/_display.scss +0 -73
  109. package/trash/scss-before-cqc-update/helpers/_index.scss +0 -68
  110. package/trash/scss-before-cqc-update/helpers/_print.scss +0 -59
  111. package/trash/scss-before-cqc-update/helpers/_typography.scss +0 -73
  112. package/trash/scss-before-cqc-update/helpers/_units.scss +0 -79
  113. package/trash/scss-before-cqc-update/helpers/_utilities.scss +0 -88
  114. package/trash/scss-before-cqc-update/stylesheets/README.md +0 -3
  115. package/trash/scss-before-cqc-update/stylesheets/full.scss +0 -17
  116. package/trash/scss-old/README.md +0 -58
  117. package/trash/scss-old/_breakpoint.scss +0 -140
  118. package/trash/scss-old/_button.scss +0 -223
  119. package/trash/scss-old/_calculate.scss +0 -64
  120. package/trash/scss-old/_color.scss +0 -200
  121. package/trash/scss-old/_element.scss +0 -262
  122. package/trash/scss-old/_grid.scss +0 -558
  123. package/trash/scss-old/_index.scss +0 -25
  124. package/trash/scss-old/_layout.scss +0 -170
  125. package/trash/scss-old/_path.scss +0 -58
  126. package/trash/scss-old/_selector.scss +0 -81
  127. package/trash/scss-old/_typography.scss +0 -320
  128. package/trash/scss-old/_units.scss +0 -47
  129. package/trash/scss-old/_utility.scss +0 -12
  130. package/trash/scss-old/_utils.scss +0 -186
  131. package/trash/scss-old/base/_color.scss +0 -13
  132. package/trash/scss-old/base/_elements.scss +0 -183
  133. package/trash/scss-old/base/_index.scss +0 -62
  134. package/trash/scss-old/base/_keyframes.scss +0 -74
  135. package/trash/scss-old/base/_layout.scss +0 -81
  136. package/trash/scss-old/base/_normalize.scss +0 -316
  137. package/trash/scss-old/base/_typography.scss +0 -42
  138. package/trash/scss-old/components/README.md +0 -5
  139. package/trash/scss-old/components/README.todos +0 -15
  140. package/trash/scss-old/components/_button.scss +0 -74
  141. package/trash/scss-old/components/_index.scss +0 -63
  142. package/trash/scss-old/components/_links.scss +0 -34
  143. package/trash/scss-old/components/_list-lines.scss +0 -73
  144. package/trash/scss-old/components/_list-ordered.scss +0 -16
  145. package/trash/scss-old/components/_list-unordered.scss +0 -21
  146. package/trash/scss-old/components/_rule.scss +0 -84
  147. package/trash/scss-old/helpers/_color.scss +0 -14
  148. package/trash/scss-old/helpers/_display.scss +0 -68
  149. package/trash/scss-old/helpers/_index.scss +0 -67
  150. package/trash/scss-old/helpers/_print.scss +0 -59
  151. package/trash/scss-old/helpers/_typography.scss +0 -73
  152. package/trash/scss-old/helpers/_units.scss +0 -68
  153. package/trash/scss-old/helpers/_utilities.scss +0 -82
  154. package/trash/scss-old/packages/README.md +0 -3
  155. package/trash/scss-old/packages/everything.scss +0 -17
  156. package/trash/scss-old-2/README.md +0 -58
  157. package/trash/scss-old-2/_breakpoint.scss +0 -139
  158. package/trash/scss-old-2/_button.scss +0 -223
  159. package/trash/scss-old-2/_calculate.scss +0 -64
  160. package/trash/scss-old-2/_color.scss +0 -202
  161. package/trash/scss-old-2/_element.scss +0 -263
  162. package/trash/scss-old-2/_grid.scss +0 -558
  163. package/trash/scss-old-2/_index.scss +0 -25
  164. package/trash/scss-old-2/_layout.scss +0 -170
  165. package/trash/scss-old-2/_path.scss +0 -58
  166. package/trash/scss-old-2/_selector.scss +0 -81
  167. package/trash/scss-old-2/_typography.scss +0 -320
  168. package/trash/scss-old-2/_units.scss +0 -47
  169. package/trash/scss-old-2/_utility.scss +0 -12
  170. package/trash/scss-old-2/_utils.scss +0 -186
  171. package/trash/scss-old-2/base/_color.scss +0 -13
  172. package/trash/scss-old-2/base/_elements.scss +0 -182
  173. package/trash/scss-old-2/base/_index.scss +0 -62
  174. package/trash/scss-old-2/base/_keyframes.scss +0 -73
  175. package/trash/scss-old-2/base/_layout.scss +0 -83
  176. package/trash/scss-old-2/base/_normalize.scss +0 -315
  177. package/trash/scss-old-2/base/_typography.scss +0 -41
  178. package/trash/scss-old-2/components/README.md +0 -5
  179. package/trash/scss-old-2/components/README.todos +0 -15
  180. package/trash/scss-old-2/components/_button.scss +0 -95
  181. package/trash/scss-old-2/components/_index.scss +0 -63
  182. package/trash/scss-old-2/components/_links.scss +0 -33
  183. package/trash/scss-old-2/components/_list-lines.scss +0 -73
  184. package/trash/scss-old-2/components/_list-ordered.scss +0 -16
  185. package/trash/scss-old-2/components/_list-unordered.scss +0 -21
  186. package/trash/scss-old-2/components/_rule.scss +0 -84
  187. package/trash/scss-old-2/helpers/_color.scss +0 -14
  188. package/trash/scss-old-2/helpers/_display.scss +0 -67
  189. package/trash/scss-old-2/helpers/_index.scss +0 -67
  190. package/trash/scss-old-2/helpers/_print.scss +0 -58
  191. package/trash/scss-old-2/helpers/_typography.scss +0 -72
  192. package/trash/scss-old-2/helpers/_units.scss +0 -68
  193. package/trash/scss-old-2/helpers/_utilities.scss +0 -81
  194. package/trash/scss-old-2/packages/README.md +0 -3
  195. package/trash/scss-old-2/packages/everything.scss +0 -17
  196. package/trash/scss-old-230729/README.md +0 -58
  197. package/trash/scss-old-230729/_breakpoint.scss +0 -139
  198. package/trash/scss-old-230729/_button.scss +0 -223
  199. package/trash/scss-old-230729/_calculate.scss +0 -64
  200. package/trash/scss-old-230729/_color.scss +0 -202
  201. package/trash/scss-old-230729/_element.scss +0 -273
  202. package/trash/scss-old-230729/_grid.scss +0 -694
  203. package/trash/scss-old-230729/_index.scss +0 -25
  204. package/trash/scss-old-230729/_layout.scss +0 -193
  205. package/trash/scss-old-230729/_path.scss +0 -58
  206. package/trash/scss-old-230729/_selector.scss +0 -81
  207. package/trash/scss-old-230729/_typography.scss +0 -320
  208. package/trash/scss-old-230729/_units.scss +0 -47
  209. package/trash/scss-old-230729/_utility.scss +0 -12
  210. package/trash/scss-old-230729/_utils.scss +0 -186
  211. package/trash/scss-old-230729/base/_color.scss +0 -13
  212. package/trash/scss-old-230729/base/_elements.scss +0 -188
  213. package/trash/scss-old-230729/base/_index.scss +0 -62
  214. package/trash/scss-old-230729/base/_keyframes.scss +0 -73
  215. package/trash/scss-old-230729/base/_layout.scss +0 -83
  216. package/trash/scss-old-230729/base/_normalize.scss +0 -315
  217. package/trash/scss-old-230729/base/_typography.scss +0 -41
  218. package/trash/scss-old-230729/components/README.md +0 -5
  219. package/trash/scss-old-230729/components/README.todos +0 -15
  220. package/trash/scss-old-230729/components/_button.scss +0 -95
  221. package/trash/scss-old-230729/components/_index.scss +0 -63
  222. package/trash/scss-old-230729/components/_links.scss +0 -34
  223. package/trash/scss-old-230729/components/_list-lines.scss +0 -73
  224. package/trash/scss-old-230729/components/_list-ordered.scss +0 -16
  225. package/trash/scss-old-230729/components/_list-unordered.scss +0 -21
  226. package/trash/scss-old-230729/components/_rule.scss +0 -93
  227. package/trash/scss-old-230729/helpers/_color.scss +0 -14
  228. package/trash/scss-old-230729/helpers/_display.scss +0 -73
  229. package/trash/scss-old-230729/helpers/_index.scss +0 -67
  230. package/trash/scss-old-230729/helpers/_print.scss +0 -58
  231. package/trash/scss-old-230729/helpers/_typography.scss +0 -72
  232. package/trash/scss-old-230729/helpers/_units.scss +0 -68
  233. package/trash/scss-old-230729/helpers/_utilities.scss +0 -87
  234. package/trash/scss-old-230729/packages/README.md +0 -3
  235. package/trash/scss-old-230729/packages/everything.scss +0 -17
  236. package/trash/vue/directives/background-image-url.js +0 -12
  237. package/trash/vue/helpers/add-required-components.js +0 -14
  238. package/trash/vue/ui/CollapsibleRegion/CollapsibleRegion.vue +0 -277
  239. package/trash/vue/ui/CollapsibleRegion/Demo.vue +0 -101
  240. package/trash/vue/ui/Dropdown/Dropdown.vue +0 -184
  241. package/trash/vue/ui/Modals/components/Modal.vue +0 -49
  242. package/trash/vue/ui/Modals/components/Modals.vue +0 -103
  243. package/trash/vue/ui/Modals/plugin.js +0 -215
  244. package/trash/vue/ui/Modals/readme.note +0 -10
  245. package/trash/vue/ui/Modals/reference/example-usage.vue +0 -27
  246. package/trash/vue/ui/Modals/reference/wcag-example/dialog.js +0 -324
@@ -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
- }