@ulu/frontend 0.2.0-beta.5 → 0.2.0-beta.7

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 (139) hide show
  1. package/dist/README.md +12 -0
  2. package/dist/{types → es}/core/component.d.ts +3 -9
  3. package/dist/es/core/component.d.ts.map +1 -0
  4. package/dist/es/core/component.js +134 -0
  5. package/dist/{types → es}/core/events.d.ts +1 -1
  6. package/dist/{types → es}/core/events.d.ts.map +1 -1
  7. package/dist/es/core/events.js +45 -0
  8. package/dist/es/core/index.d.ts +4 -0
  9. package/dist/{types → es}/core/settings.d.ts +1 -1
  10. package/dist/es/core/settings.d.ts.map +1 -0
  11. package/dist/es/core/settings.js +44 -0
  12. package/dist/es/index.d.ts +4 -0
  13. package/dist/es/index.js +123 -0
  14. package/dist/{types → es}/ui/breakpoints.d.ts +5 -3
  15. package/dist/es/ui/breakpoints.d.ts.map +1 -0
  16. package/dist/es/ui/breakpoints.js +194 -0
  17. package/dist/{types → es}/ui/collapsible.d.ts +28 -7
  18. package/dist/es/ui/collapsible.d.ts.map +1 -0
  19. package/dist/es/ui/collapsible.js +140 -0
  20. package/dist/{types → es}/ui/details-group.d.ts +1 -1
  21. package/dist/es/ui/details-group.js +49 -0
  22. package/dist/{types → es}/ui/dialog.d.ts +3 -3
  23. package/dist/es/ui/dialog.d.ts.map +1 -0
  24. package/dist/es/ui/dialog.js +112 -0
  25. package/dist/{types → es}/ui/flipcard.d.ts +1 -1
  26. package/dist/es/ui/flipcard.js +97 -0
  27. package/dist/{types → es}/ui/grid.d.ts +2 -2
  28. package/dist/{types → es}/ui/grid.d.ts.map +1 -1
  29. package/dist/es/ui/grid.js +18 -0
  30. package/dist/{types → es}/ui/index.d.ts +21 -21
  31. package/dist/{types → es}/ui/modal-builder.d.ts +21 -16
  32. package/dist/es/ui/modal-builder.d.ts.map +1 -0
  33. package/dist/es/ui/modal-builder.js +136 -0
  34. package/dist/es/ui/overflow-scroller-pager.js +28 -0
  35. package/dist/{types → es}/ui/overflow-scroller.d.ts +3 -3
  36. package/dist/{types → es}/ui/overflow-scroller.d.ts.map +1 -1
  37. package/dist/es/ui/overflow-scroller.js +90 -0
  38. package/dist/es/ui/page.js +7 -0
  39. package/dist/{types → es}/ui/popover.d.ts +3 -3
  40. package/dist/{types → es}/ui/popover.d.ts.map +1 -1
  41. package/dist/es/ui/popover.js +77 -0
  42. package/dist/es/ui/print-details.js +22 -0
  43. package/dist/es/ui/print.js +34 -0
  44. package/dist/{types → es}/ui/programmatic-modal.d.ts +1 -1
  45. package/dist/{types → es}/ui/programmatic-modal.d.ts.map +1 -1
  46. package/dist/{types → es}/ui/proxy-click.d.ts +4 -4
  47. package/dist/es/ui/proxy-click.d.ts.map +1 -0
  48. package/dist/es/ui/proxy-click.js +44 -0
  49. package/dist/{types → es}/ui/resizer.d.ts +16 -16
  50. package/dist/es/ui/resizer.d.ts.map +1 -0
  51. package/dist/es/ui/resizer.js +242 -0
  52. package/dist/{types → es}/ui/scroll-slider.d.ts +1 -1
  53. package/dist/es/ui/scroll-slider.js +29 -0
  54. package/dist/{types → es}/ui/scrollpoint.d.ts +79 -11
  55. package/dist/es/ui/scrollpoint.d.ts.map +1 -0
  56. package/dist/es/ui/scrollpoint.js +178 -0
  57. package/dist/{types → es}/ui/slider.d.ts +11 -8
  58. package/dist/es/ui/slider.d.ts.map +1 -0
  59. package/dist/es/ui/slider.js +292 -0
  60. package/dist/{types → es}/ui/tabs.d.ts +2 -2
  61. package/dist/{types → es}/ui/tabs.d.ts.map +1 -1
  62. package/dist/es/ui/tabs.js +64 -0
  63. package/dist/{types → es}/ui/theme-toggle.d.ts +4 -4
  64. package/dist/es/ui/theme-toggle.d.ts.map +1 -0
  65. package/dist/es/ui/theme-toggle.js +190 -0
  66. package/dist/{types → es}/ui/tooltip.d.ts +5 -5
  67. package/dist/es/ui/tooltip.d.ts.map +1 -0
  68. package/dist/es/ui/tooltip.js +184 -0
  69. package/dist/{types → es}/utils/class-logger.d.ts +4 -4
  70. package/dist/es/utils/class-logger.d.ts.map +1 -0
  71. package/dist/es/utils/class-logger.js +37 -0
  72. package/dist/es/utils/css.js +6 -0
  73. package/dist/{types → es}/utils/dom.d.ts +1 -1
  74. package/dist/{types → es}/utils/dom.d.ts.map +1 -1
  75. package/dist/es/utils/dom.js +29 -0
  76. package/dist/{types → es}/utils/file-save.d.ts.map +1 -1
  77. package/dist/es/utils/file-save.js +46 -0
  78. package/dist/{types → es}/utils/floating-ui.d.ts +1 -1
  79. package/dist/{types → es}/utils/floating-ui.d.ts.map +1 -1
  80. package/dist/es/utils/floating-ui.js +46 -0
  81. package/dist/es/utils/font-awesome.js +13 -0
  82. package/dist/es/utils/id.js +11 -0
  83. package/dist/{types → es}/utils/index.d.ts +7 -7
  84. package/dist/es/utils/pause-youtube-video.js +27 -0
  85. package/dist/umd/style.css +1 -0
  86. package/dist/{ulu-frontend.umd.js → umd/ulu-frontend.umd.js} +15 -15
  87. package/lib/js/ui/breakpoints.js +12 -12
  88. package/lib/js/ui/modal-builder.js +5 -3
  89. package/lib/js/ui/slider.js +19 -10
  90. package/lib/scss/_element.scss +10 -4
  91. package/lib/scss/components/_accordion.scss +1 -7
  92. package/lib/scss/components/_button.scss +11 -2
  93. package/lib/scss/components/_card.scss +0 -2
  94. package/lib/scss/components/_form-theme.scss +3 -3
  95. package/lib/scss/components/_menu-stack.scss +1 -0
  96. package/lib/scss/components/_modal.scss +13 -13
  97. package/lib/scss/helpers/_utilities.scss +0 -3
  98. package/package.json +19 -16
  99. package/dist/style.css +0 -1
  100. package/dist/types/core/component.d.ts.map +0 -1
  101. package/dist/types/core/index.d.ts +0 -4
  102. package/dist/types/core/settings.d.ts.map +0 -1
  103. package/dist/types/index.d.ts +0 -4
  104. package/dist/types/ui/breakpoints.d.ts.map +0 -1
  105. package/dist/types/ui/collapsible.d.ts.map +0 -1
  106. package/dist/types/ui/dialog.d.ts.map +0 -1
  107. package/dist/types/ui/modal-builder.d.ts.map +0 -1
  108. package/dist/types/ui/proxy-click.d.ts.map +0 -1
  109. package/dist/types/ui/resizer.d.ts.map +0 -1
  110. package/dist/types/ui/scrollpoint.d.ts.map +0 -1
  111. package/dist/types/ui/slider.d.ts.map +0 -1
  112. package/dist/types/ui/theme-toggle.d.ts.map +0 -1
  113. package/dist/types/ui/tooltip.d.ts.map +0 -1
  114. package/dist/types/utils/class-logger.d.ts.map +0 -1
  115. package/dist/ulu-frontend.es.js +0 -5743
  116. /package/dist/{types → es}/core/index.d.ts.map +0 -0
  117. /package/dist/{types → es}/index.d.ts.map +0 -0
  118. /package/dist/{types → es}/ui/details-group.d.ts.map +0 -0
  119. /package/dist/{types → es}/ui/flipcard.d.ts.map +0 -0
  120. /package/dist/{types → es}/ui/index.d.ts.map +0 -0
  121. /package/dist/{types → es}/ui/overflow-scroller-pager.d.ts +0 -0
  122. /package/dist/{types → es}/ui/overflow-scroller-pager.d.ts.map +0 -0
  123. /package/dist/{types → es}/ui/page.d.ts +0 -0
  124. /package/dist/{types → es}/ui/page.d.ts.map +0 -0
  125. /package/dist/{types → es}/ui/print-details.d.ts +0 -0
  126. /package/dist/{types → es}/ui/print-details.d.ts.map +0 -0
  127. /package/dist/{types → es}/ui/print.d.ts +0 -0
  128. /package/dist/{types → es}/ui/print.d.ts.map +0 -0
  129. /package/dist/{types → es}/ui/scroll-slider.d.ts.map +0 -0
  130. /package/dist/{types → es}/utils/css.d.ts +0 -0
  131. /package/dist/{types → es}/utils/css.d.ts.map +0 -0
  132. /package/dist/{types → es}/utils/file-save.d.ts +0 -0
  133. /package/dist/{types → es}/utils/font-awesome.d.ts +0 -0
  134. /package/dist/{types → es}/utils/font-awesome.d.ts.map +0 -0
  135. /package/dist/{types → es}/utils/id.d.ts +0 -0
  136. /package/dist/{types → es}/utils/id.d.ts.map +0 -0
  137. /package/dist/{types → es}/utils/index.d.ts.map +0 -0
  138. /package/dist/{types → es}/utils/pause-youtube-video.d.ts +0 -0
  139. /package/dist/{types → es}/utils/pause-youtube-video.d.ts.map +0 -0
package/dist/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # Dist
2
+
3
+ ## UMD
4
+
5
+ This is for testing (code pen, etc) it includes the full library, externals are set to globals and it has the full stylesheet (only useful for basic testing).
6
+
7
+ ## ES
8
+
9
+ This is the version of the library that should be consumed by users. It includes the JS bundle and typescript declarations.
10
+
11
+ Note the legacy `import { something } from "@ulu/frontend/js/ui/some-module.js"` import syntax is preserved/mapped through this bundle now. But most users should import like `import { something } from "@ulu/frontend"`.
12
+
@@ -3,8 +3,8 @@
3
3
  */
4
4
  export class ComponentInitializer {
5
5
  static defaults: {
6
- type: any;
7
- baseAttribute: any;
6
+ type: null;
7
+ baseAttribute: null;
8
8
  };
9
9
  static requiredOptions: string[];
10
10
  static hasRequiredOptions: any;
@@ -18,13 +18,7 @@ export class ComponentInitializer {
18
18
  type: string;
19
19
  baseAttribute: string;
20
20
  });
21
- options: {
22
- type: any;
23
- baseAttribute: any;
24
- } & {
25
- type: string;
26
- baseAttribute: string;
27
- };
21
+ options: never;
28
22
  logTitle: string;
29
23
  /**
30
24
  * Initializes the component based on the provided configuration.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../lib/js/core/component.js"],"names":[],"mappings":"AAUA;;GAEG;AACH;IACE;;;MAGE;IACF,iCAGE;IACF,+BAEE;IAEF;;;;;OAKG;IACH,qBAHG;QAAwB,IAAI;QACJ,aAAa;KACvC,EASA;IAFC,eAAwE;IACxE,iBAAgD;IAElD;;;;;;;;OAQG;IACH,aANG;QAAyB,KAAK;QACP,GAAG;QACF,QAAQ;QACV,UAAU;QACJ,OAAO,EAA3B,WAAW;KACrB,QAcA;IACD;;;;;;;OAOG;IACH,sBALG;QAAyB,KAAK;QACP,GAAG,EAAlB,MAAM;QACU,QAAQ,EAAxB,OAAO;QACa,OAAO,EAA3B,WAAW;KACrB,QAKA;IACD;;;;OAIG;IACH,kCAGC;IACD;;;OAGG;IACH,uCAEC;IACD;;;OAGG;IACH,2CAEC;IACD;;;;;;OAMG;IACH,uDALW,WAAW,GAGT,KAAK,CAAC;QAAC,OAAO,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,WAAU;KAAC,CAAC,CAS7E;IACD;;;OAGG;IACH,2BAFW,WAAW,QAIrB;IACD;;;OAGG;IACH,iCAFY,GAAC,CAKZ;IACD;;OAEG;IACH,0BAEC;IACD;;OAEG;IACH,2BAEC;IACD;;OAEG;IACH,+BAEC;CACF"}
@@ -0,0 +1,134 @@
1
+ var h = Object.defineProperty;
2
+ var c = (r, t, e) => t in r ? h(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var n = (r, t, e) => c(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { hasRequiredProps as p } from "@ulu/utils/object.js";
5
+ import { getDatasetOptionalJson as b } from "@ulu/utils/browser/dom.js";
6
+ import { dataAttributeToDatasetKey as d } from "../utils/dom.js";
7
+ import { getCoreEventName as g } from "./events.js";
8
+ const i = class i {
9
+ /**
10
+ * Create a new instance of ComponentInitializer
11
+ * @param {Object} options Options for configuring the component initializer.
12
+ * @param {String} options.type Type of component (used for logs).
13
+ * @param {String} options.baseAttribute Prefix and base attribute name (used for base attribute and further element attribute names).
14
+ */
15
+ constructor(t) {
16
+ if (!i.hasRequiredOptions(t))
17
+ throw new Error(
18
+ `Missing a required options: ${i.requiredOptions.join(", ")}`
19
+ );
20
+ this.options = Object.assign({}, i.defaults, t), this.logTitle = `ULU: ${this.options.type}:
21
+ `;
22
+ }
23
+ /**
24
+ * Initializes the component based on the provided configuration.
25
+ * @param {Object} config The initialization configuration.
26
+ * @param {Function} config.setup The setup function to call for each element.
27
+ * @param {String} config.key [null] The optional key to use with attribute selector.
28
+ * @param {Boolean} config.withData [null] Whether to retrieve element data.
29
+ * @param {Array} config.coreEvents [null] An array of core event names (e.g., 'pageModified') that should trigger a re-initialization.
30
+ * @param {HTMLElement} config.context [document] The context to query within.
31
+ */
32
+ init(t) {
33
+ var e;
34
+ this.setupElements(t), (e = t.coreEvents) != null && e.length && t.coreEvents.forEach((s) => {
35
+ const o = g(s);
36
+ o && document.addEventListener(o, () => this.setupElements(t));
37
+ });
38
+ }
39
+ /**
40
+ * Processes the elements based on the provided configuration.
41
+ * @param {object} config The initialization configuration.
42
+ * @param {function} config.setup The setup function to call for each element.
43
+ * @param {string} config.key The optional key to use with attribute selector.
44
+ * @param {boolean} config.withData [false] Whether to retrieve element data.
45
+ * @param {HTMLElement} config.context [document] The context to query within.
46
+ */
47
+ setupElements(t) {
48
+ const { setup: e, key: s, withData: o, context: a } = t;
49
+ this.queryAllInitial(s, o, a).forEach((u) => e(u, this));
50
+ }
51
+ /**
52
+ * Get an attribute name
53
+ * @param {String} key Optional key, if no key will return baseAttribute if key will return key added to base
54
+ * @returns {String} String like data-ulu-dialog or data-ulu-dialog-element
55
+ */
56
+ getAttribute(t) {
57
+ const { baseAttribute: e } = this.options;
58
+ return t ? `${e}-${t}` : `${e}`;
59
+ }
60
+ /**
61
+ * Create an attribute selector
62
+ * @param {String} key Optional key (see getAttribute)
63
+ */
64
+ attributeSelector(t) {
65
+ return `[${this.getAttribute(t)}]`;
66
+ }
67
+ /**
68
+ * Create an attribute selector for initial
69
+ * @return {String}
70
+ */
71
+ attributeSelectorInitial(t) {
72
+ return `${this.attributeSelector(t)}:not([${this.getAttribute("init")}])`;
73
+ }
74
+ /**
75
+ * Queries all main elements of a component that have not been initialized and extracts their data attributes.
76
+ * @param {HTMLElement} context The context to query within.
77
+ * @param {Boolean} withData Include dataset from element (as optional JSON)
78
+ * @param {Node} context Element to query elements from
79
+ * @returns {Array<{element: HTMLElement, data: object, initialize: Function}>} An array of objects containing the elements, their data, and convenience function initialize() which when called will set the init attribute on the element
80
+ */
81
+ queryAllInitial(t, e, s = document) {
82
+ return [...s.querySelectorAll(this.attributeSelectorInitial(t))].map((a) => ({
83
+ element: a,
84
+ data: e ? this.getData(a, t) : null,
85
+ initialize: () => this.initializeElement(a)
86
+ }));
87
+ }
88
+ /**
89
+ * Sets the init attribute on an element, marking it as initialized.
90
+ * @param {HTMLElement} element The element to initialize.
91
+ */
92
+ initializeElement(t) {
93
+ t.setAttribute(this.getAttribute("init"), "");
94
+ }
95
+ /**
96
+ * Get an elements dataset value as JSON or other value
97
+ * @return {*} The value of the dataset, if JSON will return object else will return string value or undefined
98
+ */
99
+ getData(t, e) {
100
+ const s = d(this.getAttribute(e));
101
+ return b(t, s);
102
+ }
103
+ /**
104
+ * Will output namespaced console logs for the given initializer
105
+ */
106
+ log(...t) {
107
+ console.log(this.logTitle, ...t);
108
+ }
109
+ /**
110
+ * Will output namespaced console warnings for the given initializer
111
+ */
112
+ warn(...t) {
113
+ console.warn(this.logTitle, ...t);
114
+ }
115
+ /**
116
+ * Will output namespaced console error for the given initializer
117
+ */
118
+ logError(...t) {
119
+ console.error(this.logTitle, ...t);
120
+ }
121
+ };
122
+ n(i, "defaults", {
123
+ type: null,
124
+ baseAttribute: null
125
+ }), n(i, "requiredOptions", [
126
+ "type",
127
+ "baseAttribute"
128
+ ]), n(i, "hasRequiredOptions", p(
129
+ i.requiredOptions
130
+ ));
131
+ let l = i;
132
+ export {
133
+ l as ComponentInitializer
134
+ };
@@ -23,5 +23,5 @@ export function getCoreEventName(type: string): string | null;
23
23
  * @param {Object} options CustomEvent options.
24
24
  * @returns {CustomEvent}
25
25
  */
26
- export function createUluEvent(type: string, data?: any, options?: any): CustomEvent;
26
+ export function createUluEvent(type: string, data?: any, options?: Object): CustomEvent;
27
27
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../lib/js/core/events.js"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,yDAFW,IAAI,QAQd;AAED;;;;GAIG;AACH,sDAEC;AAED;;;;GAIG;AACH,gDAFa,SAAO,IAAI,CAQvB;AAED;;;;;;GAMG;AACH,oDAJW,GAAG,kBAED,WAAW,CAIvB"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../lib/js/core/events.js"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,yDAFW,IAAI,QAQd;AAED;;;;GAIG;AACH,sDAEC;AAED;;;;GAIG;AACH,gDAFa,SAAO,IAAI,CAQvB;AAED;;;;;;GAMG;AACH,oDAJW,GAAG,YACH,MAAM,GACJ,WAAW,CAIvB"}
@@ -0,0 +1,45 @@
1
+ import { debounce as s } from "@ulu/utils/performance.js";
2
+ import { isBrowser as a } from "@ulu/utils/browser/dom.js";
3
+ a() && (u(), f());
4
+ const i = {
5
+ pageModified(e) {
6
+ e.dispatchEvent(n("pageModified"));
7
+ },
8
+ pageResized(e) {
9
+ e.dispatchEvent(n("pageResized"));
10
+ },
11
+ beforePrint(e) {
12
+ e.dispatchEvent(n("beforePrint"));
13
+ },
14
+ afterPrint(e) {
15
+ e.dispatchEvent(n("afterPrint"));
16
+ }
17
+ }, c = Object.keys(i);
18
+ function r(e, t) {
19
+ i[e] ? i[e](t) : console.warn(`Unable to dispatch non-core event: ${e}`);
20
+ }
21
+ function o(e) {
22
+ return "ulu:" + e;
23
+ }
24
+ function p(e) {
25
+ return c.includes(e) ? o(e) : (console.warn(`'${e}' is not a valid core event type.`), null);
26
+ }
27
+ function n(e, t = null, d = { bubbles: !0 }) {
28
+ return new CustomEvent(o(e), { detail: t, ...d });
29
+ }
30
+ function u() {
31
+ window.addEventListener("resize", s(() => r("pageResized", document), 250));
32
+ }
33
+ function f() {
34
+ window.addEventListener("beforeprint", () => {
35
+ r("beforePrint", document);
36
+ }), window.addEventListener("afterprint", () => {
37
+ r("afterPrint", document);
38
+ });
39
+ }
40
+ export {
41
+ n as createUluEvent,
42
+ r as dispatchCoreEvent,
43
+ p as getCoreEventName,
44
+ o as getUluEventName
45
+ };
@@ -0,0 +1,4 @@
1
+ export { ComponentInitializer } from './component.js';
2
+ export { dispatchCoreEvent, getCoreEventName, getUluEventName, createUluEvent } from './events.js';
3
+ export { getDefaultSettings, updateSettings, getSettings, getSetting, updateSetting, wrapSettingString } from './settings.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -37,7 +37,7 @@ export function updateSetting(key: string, value: any): void;
37
37
  * @returns {Object} An object with a `toString()` method that returns the
38
38
  * (optionally transformed) setting value as a string.
39
39
  */
40
- export function wrapSettingString(key: string, transform: Function): any;
40
+ export function wrapSettingString(key: string, transform: Function): Object;
41
41
  /**
42
42
  * Default settings
43
43
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../lib/js/core/settings.js"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,sCAFa,MAAM,CAIlB;AAED;;;GAGG;AACH,wCAFW,MAAM,QAIhB;AAED;;;GAGG;AACH,+BAFa,MAAM,CAIlB;AAED;;;;GAIG;AACH,gCAHW,MAAM,GACJ,GAAC,CAQb;AAED;;;;GAIG;AACH,mCAHW,MAAM,SACN,GAAC,QAIX;AAED;;;;;;;;;;;GAWG;AACH,qEAHa,MAAM,CAUlB;;;;;;;;oBAxFa,MAAM;;;;oBACN,MAAM;;;;uBACN,MAAM;;;;uBACN,MAAM;;;;mBACN,MAAM;;;;kBACN,MAAM"}
@@ -0,0 +1,44 @@
1
+ const c = {
2
+ iconClassClose: "css-icon css-icon--close",
3
+ iconClassDragX: "css-icon css-icon--drag-x",
4
+ iconClassDragBoth: "css-icon css-icon--drag-both",
5
+ iconClassPrevious: "css-icon css-icon--angle-left",
6
+ iconClassNext: "css-icon css-icon--angle-right",
7
+ cssvarPrefix: ""
8
+ };
9
+ let t = { ...c };
10
+ function o() {
11
+ return { ...c };
12
+ }
13
+ function r(n) {
14
+ Object.assign(t, n);
15
+ }
16
+ function a() {
17
+ return { ...t };
18
+ }
19
+ function i(n) {
20
+ if (!t.hasOwnProperty(n)) {
21
+ console.warn(`Attempted to access non-existent setting: ${n}`);
22
+ return;
23
+ }
24
+ return t[n];
25
+ }
26
+ function g(n, s) {
27
+ t[n] = s;
28
+ }
29
+ function u(n, s) {
30
+ return {
31
+ toString() {
32
+ const e = i(n);
33
+ return s ? s(e) : e;
34
+ }
35
+ };
36
+ }
37
+ export {
38
+ o as getDefaultSettings,
39
+ i as getSetting,
40
+ a as getSettings,
41
+ g as updateSetting,
42
+ r as updateSettings,
43
+ u as wrapSettingString
44
+ };
@@ -0,0 +1,4 @@
1
+ export * from './core/index.js';
2
+ export * from './ui/index.js';
3
+ export * from './utils/index.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,123 @@
1
+ import { createUluEvent as i, dispatchCoreEvent as r, getCoreEventName as a, getUluEventName as o } from "./core/events.js";
2
+ import { getDefaultSettings as l, getSetting as n, getSettings as p, updateSetting as g, updateSettings as u, wrapSettingString as f } from "./core/settings.js";
3
+ import { ComponentInitializer as m } from "./core/component.js";
4
+ import { BreakpointManager as I } from "./ui/breakpoints.js";
5
+ import { Collapsible as z } from "./ui/collapsible.js";
6
+ import { init as D, initializer as C, setupGroup as v } from "./ui/details-group.js";
7
+ import { baseAttribute as y, closeAttribute as T, defaults as B, getDialogOptions as h, init as A, initializer as P, setDefaults as k, setupDialog as G, setupTrigger as L } from "./ui/dialog.js";
8
+ import { Flipcard as w, init as U, initializer as V } from "./ui/flipcard.js";
9
+ import { init as M, initializer as O } from "./ui/grid.js";
10
+ import { buildModal as N, defaults as R, init as W, initializer as K, setDefaults as j } from "./ui/modal-builder.js";
11
+ import { OverflowScroller as J } from "./ui/overflow-scroller.js";
12
+ import { createPager as X } from "./ui/overflow-scroller-pager.js";
13
+ import { init as Z } from "./ui/page.js";
14
+ import { Popover as $, getContentByTrigger as ee, init as te, initializer as ie, instances as re, resolve as ae } from "./ui/popover.js";
15
+ import { attrs as se, init as le } from "./ui/print-details.js";
16
+ import { init as pe } from "./ui/print.js";
17
+ import { attachHandlers as ue, defaults as fe, init as de, initializer as me, setDefaults as xe, setupProxy as Ie } from "./ui/proxy-click.js";
18
+ import { Resizer as ze } from "./ui/resizer.js";
19
+ import { init as De, initializer as Ce } from "./ui/scroll-slider.js";
20
+ import { Scrollpoint as be, init as ye, initializer as Te } from "./ui/scrollpoint.js";
21
+ import { Slider as he, init as Ae, initializer as Pe, setupSlider as ke } from "./ui/slider.js";
22
+ import { init as Le, initializer as Ee, instances as we, setup as Ue } from "./ui/tabs.js";
23
+ import { defaults as Fe, init as Me, initializer as Oe, setDefaults as He, setupToggle as Ne } from "./ui/theme-toggle.js";
24
+ import { Tooltip as We, init as Ke, initializer as je } from "./ui/tooltip.js";
25
+ import { log as Je, logError as Qe, logWarning as Xe, set as Ye } from "./utils/class-logger.js";
26
+ import { dataAttributeToDatasetKey as _e, resolveClasses as $e, setPositionClasses as et } from "./utils/dom.js";
27
+ import { FileSave as it } from "./utils/file-save.js";
28
+ import { createFloatingUi as at, defaults as ot } from "./utils/floating-ui.js";
29
+ import { configureIcons as lt } from "./utils/font-awesome.js";
30
+ import { ensureId as pt, newId as gt } from "./utils/id.js";
31
+ import { pauseVideos as ft, prepVideos as dt } from "./utils/pause-youtube-video.js";
32
+ export {
33
+ I as BreakpointManager,
34
+ z as Collapsible,
35
+ m as ComponentInitializer,
36
+ it as FileSave,
37
+ w as Flipcard,
38
+ J as OverflowScroller,
39
+ $ as Popover,
40
+ ze as Resizer,
41
+ be as Scrollpoint,
42
+ he as Slider,
43
+ We as Tooltip,
44
+ Je as classLoggerLog,
45
+ Qe as classLoggerLogError,
46
+ Xe as classLoggerLogWarning,
47
+ Ye as classLoggerSet,
48
+ at as createFloatingUi,
49
+ i as createUluEvent,
50
+ _e as dataAttributeToDatasetKey,
51
+ D as detailsGroupInit,
52
+ C as detailsGroupInitializer,
53
+ v as detailsGroupSetupGroup,
54
+ y as dialogBaseAttribute,
55
+ T as dialogCloseAttribute,
56
+ B as dialogDefaults,
57
+ h as dialogGetDialogOptions,
58
+ A as dialogInit,
59
+ P as dialogInitializer,
60
+ k as dialogSetDefaults,
61
+ G as dialogSetupDialog,
62
+ L as dialogSetupTrigger,
63
+ r as dispatchCoreEvent,
64
+ pt as ensureId,
65
+ U as flipcardInit,
66
+ V as flipcardInitializer,
67
+ ot as floatingUiDefaults,
68
+ lt as fontAwesomeConfigureIcons,
69
+ a as getCoreEventName,
70
+ l as getDefaultSettings,
71
+ n as getSetting,
72
+ p as getSettings,
73
+ o as getUluEventName,
74
+ M as gridInit,
75
+ O as gridInitializer,
76
+ N as modalBuilderBuildModal,
77
+ R as modalBuilderDefaults,
78
+ W as modalBuilderInit,
79
+ K as modalBuilderInitializer,
80
+ j as modalBuilderSetDefaults,
81
+ gt as newId,
82
+ X as overflowScrollerCreatePager,
83
+ Z as pageInit,
84
+ ee as popoverGetContentByTrigger,
85
+ te as popoverInit,
86
+ ie as popoverInitializer,
87
+ re as popoverInstances,
88
+ ae as popoverResolve,
89
+ se as printDetailsAttrs,
90
+ le as printDetailsInit,
91
+ pe as printInit,
92
+ ue as proxyClickAttachHandlers,
93
+ fe as proxyClickDefaults,
94
+ de as proxyClickInit,
95
+ me as proxyClickInitializer,
96
+ xe as proxyClickSetDefaults,
97
+ Ie as proxyClickSetupProxy,
98
+ $e as resolveClasses,
99
+ De as scrollSliderInit,
100
+ Ce as scrollSliderInitializer,
101
+ ye as scrollpointInit,
102
+ Te as scrollpointInitializer,
103
+ et as setPositionClasses,
104
+ Ae as sliderInit,
105
+ Pe as sliderInitializer,
106
+ ke as sliderSetupSlider,
107
+ Le as tabsInit,
108
+ Ee as tabsInitializer,
109
+ we as tabsInstances,
110
+ Ue as tabsSetup,
111
+ Fe as themeToggleDefaults,
112
+ Me as themeToggleInit,
113
+ Oe as themeToggleInitializer,
114
+ He as themeToggleSetDefaults,
115
+ Ne as themeToggleSetupToggle,
116
+ Ke as tooltipInit,
117
+ je as tooltipInitializer,
118
+ g as updateSetting,
119
+ u as updateSettings,
120
+ f as wrapSettingString,
121
+ ft as youtubePauseVideos,
122
+ dt as youtubePrepVideos
123
+ };
@@ -5,10 +5,12 @@
5
5
  */
6
6
  export class BreakpointManager {
7
7
  static instances: any[];
8
+ static globalsInitialized: boolean;
9
+ static _initializeGlobals(): void;
8
10
  static defaults: {
9
11
  element: HTMLElement;
10
12
  valueFromPseudo: boolean;
11
- customProperty: any;
13
+ customProperty: Object;
12
14
  pseudoSelector: string;
13
15
  order: string[];
14
16
  debug: boolean;
@@ -31,7 +33,7 @@ export class BreakpointManager {
31
33
  active: any;
32
34
  previous: any;
33
35
  activeIndex: any;
34
- resizeDirection: string;
36
+ resizeDirection: string | null;
35
37
  previousIndex: any;
36
38
  breakpoints: {};
37
39
  onChangeCallbacks: any[];
@@ -144,7 +146,7 @@ declare class BreakpointDirection {
144
146
  * @param {Function|Object} handler.on Function to be executed when direction is active
145
147
  * @param {Function|Object} handler.off Function to be executed when direction was active and is now changed to inactive
146
148
  */
147
- add(handler: Function | any): void;
149
+ add(handler: Function | Object): void;
148
150
  /**
149
151
  * Removes a handler
150
152
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../lib/js/ui/breakpoints.js"],"names":[],"mappings":"AAcA;;;;GAIG;AACH;IACE,wBAAsB;IACtB,mCAAkC;IAElC,kCAQC;IACD;;;;;;;MAQC;IACD;;;;;;;OAOG;IACH,oBANG;QAAsB,KAAK;QACL,cAAc;QACd,eAAe;QAChB,OAAO,EAApB,IAAI;QACW,cAAc;KACvC,EAeA;IAXC,YAAkB;IAClB,cAAoB;IACpB,iBAAuB;IACvB,+BAA2B;IAC3B,mBAAyB;IACzB,gBAAqB;IACrB,yBAA2B;IAM7B;;;;;OAKG;IACH,mCAEC;IACD;;;OAGG;IACH,yCAEC;IACD;;OAEG;IACH,gCAEC;IACD;;OAEG;IACH,kCAEC;IACD;;OAEG;IACH,wBAMC;IACD;;OAEG;IACH,eAuCC;IACD;;;;OAIG;IACH,kBAFY,UAAU,CAQrB;CACF;AAsED;;;GAGG;AACH;IACE,qCAQC;IAPC;;;;MAIC;IACD,cAAuB;IACvB,UAAgB;IAElB;;;;;OAKG;IACH,wDAEC;IACD;;;;OAIG;IACH,6BAEC;IACD;;;;OAIG;IACH,6BAEC;IACD;;;OAGG;IACH,8BAEC;IACD;;;;OAIG;IACH,mDAOC;IAED,yBAGC;CACF;AArID;;;GAGG;AACH;IACE,6CAMC;IALC,eAA0B;IAC1B,gBAAmB;IACnB,UAAY;IACZ,WAAa;IACb,gBAA4B;IAE9B;;OAEG;IACH,sBAMC;IACD;;OAEG;IACH,4BAIC;IACD;;OAEG;IACH,+BAEC;IACD;;;;;OAKG;IACH,aAJW,WAAS,MAAM,QAiBzB;IACD;;OAEG;IACH,2BAQC;CACF"}
@@ -0,0 +1,194 @@
1
+ var u = Object.defineProperty;
2
+ var p = (s, t, e) => t in s ? u(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var r = (s, t, e) => p(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import { removeArrayElement as c } from "@ulu/utils/array.js";
5
+ import { isBrowser as g } from "@ulu/utils/browser/dom.js";
6
+ import { getCoreEventName as v } from "../core/events.js";
7
+ import { wrapSettingString as b } from "../core/settings.js";
8
+ import { getCustomProperty as k } from "../utils/css.js";
9
+ import { log as d, logError as f } from "../utils/class-logger.js";
10
+ const y = (s) => k(s, "breakpoint"), i = class i {
11
+ static _initializeGlobals() {
12
+ i.globalsInitialized || !g() || (window.addEventListener(v("pageResized"), () => {
13
+ i.instances.forEach((t) => t.update());
14
+ }), i.globalsInitialized = !0);
15
+ }
16
+ /**
17
+ * @param {Object} config Configuration object
18
+ * @param {Array} config.order Array of strings that correspond to the breakpoints setup in the styles, Breakpoints from smallest to largest, defaults to [small, medium, large]
19
+ * @param {Array} config.customProperty Property to grab breakpoint from (default is --breakpoint)
20
+ * @param {Array} config.valueFromPseudo Use the legacy method of grabbing breakpoint from pseudo element, default uses custom property
21
+ * @param {Node} config.element The element to retrieve active breakpoint from stylesheet. (default is html) For using the old pseudo method, adjust this to document.body
22
+ * @param {String} config.pseudoSelector Change pseudo selector used to get the breakpoint from the pseudo's content property
23
+ */
24
+ constructor(t) {
25
+ i._initializeGlobals(), Object.assign(this, i.defaults, t), this.active = null, this.previous = null, this.activeIndex = null, this.resizeDirection = null, this.previousIndex = null, this.breakpoints = {}, this.onChangeCallbacks = [], this.order.forEach((e) => this.breakpoints[e] = new x(e, this)), d(this, this), this.update(), i.instances.push(this);
26
+ }
27
+ /**
28
+ * Add a callback for every time a breakpoint changes
29
+ * - Not recommended, possibly use to watch for changes, etc
30
+ * - For more control use instance.at(name) with breakpoint methods
31
+ * @param {Function} callback Function to call, passed one argument current instance which can be used to get information about breakpoints
32
+ */
33
+ onChange(t) {
34
+ this.onChangeCallbacks.push(t);
35
+ }
36
+ /**
37
+ * Remove change callback
38
+ * @param {Function} callback Function to remove
39
+ */
40
+ removeOnChange(t) {
41
+ c(this.onChangeCallbacks, t);
42
+ }
43
+ /**
44
+ * Get breakpoint from a pseudo element
45
+ */
46
+ getBreakpointInPseudo() {
47
+ return window.getComputedStyle(this.element, this.pseudoSelector).content.replace(/^"|"$/g, "");
48
+ }
49
+ /**
50
+ * Get breakpoint from a custom property
51
+ */
52
+ getBreakpointInProperty() {
53
+ return getComputedStyle(this.element).getPropertyValue(this.customProperty).trim();
54
+ }
55
+ /**
56
+ * Get breakpoint from element (design note: user could override prototype)
57
+ */
58
+ getBreakpoint() {
59
+ return this.valueFromPseudo ? this.getBreakpointInPseudo() : this.getBreakpointInProperty();
60
+ }
61
+ /**
62
+ * Updates the active breakpoint by checking the element and executes handlers on change
63
+ */
64
+ update() {
65
+ const t = this.getBreakpoint();
66
+ if (!t) {
67
+ f(this, "Unable to get current breakpoint, maybe order is incorrect? Breakpoint check skipped!");
68
+ return;
69
+ }
70
+ if (t === this.active) return;
71
+ this.previous = this.active, this.previousIndex = this.activeIndex;
72
+ const e = this.order.indexOf(t);
73
+ this.active = t, this.activeIndex = e, this.order.forEach((o, n) => {
74
+ const a = this.breakpoints[o], h = this.activeIndex;
75
+ a._setDirection("min", n <= h), a._setDirection("max", n > h), a._setDirection("only", n === h);
76
+ }), this.previousIndex !== null && (this.resizeDirection = this.previousIndex < e ? "up" : "down"), this.onChangeCallbacks.forEach((o) => o(this));
77
+ }
78
+ /**
79
+ * Get a breakpoint by key
80
+ * @param {String} name The name of the breakpoint to get
81
+ * @return {Breakpoint} Breakpoint to act on (see Breakpoint class)
82
+ */
83
+ at(t) {
84
+ const e = this.breakpoints[t];
85
+ return t || f(this, "Unable to find breakpoint for:", e), e;
86
+ }
87
+ };
88
+ r(i, "instances", []), r(i, "globalsInitialized", !1), r(i, "defaults", {
89
+ element: document == null ? void 0 : document.documentElement,
90
+ valueFromPseudo: !1,
91
+ customProperty: "--breakpoint",
92
+ customProperty: b("cssvarPrefix", y),
93
+ pseudoSelector: ":before",
94
+ order: ["none", "small", "medium", "large"],
95
+ debug: !1
96
+ });
97
+ let m = i;
98
+ class l {
99
+ constructor(t, e) {
100
+ this.direction = t, this.active = !1, this.on = [], this.off = [], this.breakpoint = e;
101
+ }
102
+ /**
103
+ * Change the state of the direction
104
+ */
105
+ change(t) {
106
+ this.active !== t && (t ? this._call(!0) : this.active && this._call(!1), this.active = t);
107
+ }
108
+ /**
109
+ * Calls all functions in handlers or
110
+ */
111
+ _call(t) {
112
+ (t ? this.on : this.off).forEach((o) => o()), d(this.breakpoint._manager, `Handlers called (${t ? "on" : "off"}): ${this.direction}`);
113
+ }
114
+ /**
115
+ * Returns handlers in normalized object format on/off
116
+ */
117
+ getHandlers(t) {
118
+ return typeof t != "object" ? { on: t } : t;
119
+ }
120
+ /**
121
+ * Adds a handler for the direction, optionally use object to add off state handler
122
+ * @param {Function|Object} handler Function to be executed when direction is active, read object description for on/off
123
+ * @param {Function|Object} handler.on Function to be executed when direction is active
124
+ * @param {Function|Object} handler.off Function to be executed when direction was active and is now changed to inactive
125
+ */
126
+ add(t) {
127
+ const e = this.getHandlers(t);
128
+ e.on && this.on.push(e.on), e.off && this.off.push(e.off), this.active && e.on && (e.on(), d(this.breakpoint._manager, `Handler called immediately: ${this.direction}`, e.on));
129
+ }
130
+ /**
131
+ * Removes a handler
132
+ */
133
+ remove(t) {
134
+ const e = this.getHandlers(t);
135
+ e.on && c(this.on, e.on), e.off && c(this.off, e.off);
136
+ }
137
+ }
138
+ class x {
139
+ constructor(t, e) {
140
+ this.directions = {
141
+ max: new l("max", this),
142
+ min: new l("min", this),
143
+ only: new l("only", this)
144
+ }, this._manager = e, this.name = t;
145
+ }
146
+ /**
147
+ * Private method used inrternally for managing direction activation
148
+ * - Each direction manages it's own state and handlers
149
+ * @param {String} direction The directional key
150
+ * @param {Boolean} active State of that direction to set
151
+ */
152
+ _setDirection(t, e) {
153
+ this.directions[t].change(e);
154
+ }
155
+ /**
156
+ * Attach handler to be executed from the breakpoint and to all breakpoints below (inclusive).
157
+ * This corresponds to a `max-width` media query in SCSS.
158
+ * @param {Function} handler Handler to be executed
159
+ */
160
+ max(t) {
161
+ this.directions.max.add(t);
162
+ }
163
+ /**
164
+ * Attach handler to be executed from the breakpoint and to all breakpoints above (inclusive).
165
+ * This corresponds to a `min-width` media query in SCSS.
166
+ * @param {Function} handler Handler to be executed
167
+ */
168
+ min(t) {
169
+ this.directions.min.add(t);
170
+ }
171
+ /**
172
+ * Attach a handler to fire when the breakpoint is within the key
173
+ * @param {Function} handler Handler to be executed
174
+ */
175
+ only(t) {
176
+ this.directions.only.add(t);
177
+ }
178
+ /**
179
+ * Remove handler
180
+ * @param {Function} handler Handler to be removed, extended on/off object style can be used
181
+ * @param {String} direction Remove handler only from specified direction, else search all directions
182
+ */
183
+ remove(t, e) {
184
+ (e ? [e] : ["max", "min", "only"]).forEach((n) => {
185
+ this.directions[n] && this.directions[n].remove(t);
186
+ });
187
+ }
188
+ log(...t) {
189
+ t.unshift(`Breakpoint (${this.name}):`), this._manager.log.apply(this._manager, t);
190
+ }
191
+ }
192
+ export {
193
+ m as BreakpointManager
194
+ };