@ucd-lib/theme-elements 2.1.2 → 2.1.4

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.
@@ -13,6 +13,11 @@ export function styles() {
13
13
  [hidden] {
14
14
  display: none;
15
15
  }
16
+
17
+ .collapse__content {
18
+ background-color: var(--collapse-background-color, white);
19
+ border-color: var(--collapse-border-color, black);
20
+ }
16
21
  `;
17
22
 
18
23
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucd-lib/theme-elements",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Custom elements for the UCD brand theme",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@ export class WaitController{
8
8
  * @method wait
9
9
  * @description Wait for the specified amount of time
10
10
  * @param {Number} time - Time to wait (ms)
11
- * @returns
11
+ * @returns
12
12
  */
13
13
  async wait(time){
14
14
  return new Promise(resolve => {
@@ -20,7 +20,7 @@ export class WaitController{
20
20
  * @method waitForUpdate
21
21
  * @description Requests and waits for Lit update.
22
22
  */
23
- async waitForUpdate(){
23
+ async waitForUpdate(){
24
24
  this.host.requestUpdate();
25
25
  await this.host.updateComplete;
26
26
  }
@@ -30,7 +30,7 @@ export class WaitController{
30
30
  * @description Wait for specified number of animation frames
31
31
  * @param {Number} ct Number of frames
32
32
  */
33
- async waitForFrames(ct=1) {
33
+ async waitForFrames(ct=1) {
34
34
  for (let i = 0; i < ct; i++) {
35
35
  await new Promise(resolve => {
36
36
  requestAnimationFrame(resolve);
@@ -38,5 +38,36 @@ export class WaitController{
38
38
  }
39
39
  }
40
40
 
41
+ /**
42
+ * @description Wait for the host to have a property with a specific value
43
+ * @param {String} prop - Host property to wait for
44
+ * @param {*} value - Host property value to wait for
45
+ * @param {Number} timeout - Timeout in ms
46
+ * @returns {Object} - Object with the following properties:
47
+ * - prop: Property name
48
+ * - targetValue: Value to wait for
49
+ * - timeoutValue: Timeout value
50
+ * - propValue: Current value of the property
51
+ * - wasTimeout: Was the wait timed out
52
+ */
53
+ async waitForHostPropertyValue(prop, value, timeout=5000){
54
+ const out = {
55
+ prop,
56
+ targetValue: value,
57
+ timeoutValue: timeout,
58
+ propValue: this.host[prop],
59
+ wasTimeout: false
60
+ };
61
+ let start = Date.now();
62
+ while (this.host[prop] !== value) {
63
+ if (Date.now() - start > timeout) {
64
+ out.wasTimeout = true;
65
+ return out;
66
+ }
67
+ await this.wait(10);
68
+ }
69
+ return out;
70
+ }
71
+
41
72
 
42
- }
73
+ }