Skip to content

Commit

Permalink
merging v2 changes to main (v3)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmerz committed Aug 5, 2024
2 parents 881708a + 857ff2f commit ef26b7d
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 6 deletions.
16 changes: 16 additions & 0 deletions brand-app/pages/page-ucd-theme-collapse.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,21 @@ export function render() {
I am the content.
</ucd-theme-collapse>
`)}
<h2>Using CSS Custom Properties</h2>
${this.examplePanel(html`
<style>
.custom-collapse {
--collapse-background-color: #FFFBED;
--collapse-border-color: #FFBF00;
}
</style>
<div class="custom-collapse">
<ucd-theme-collapse brand-class="category-brand--secondary" title="I am the panel title">
I am the content.
</ucd-theme-collapse>
</div>
`)}
`;
}
1 change: 1 addition & 0 deletions brand-app/pages/ucd-theme-quick-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Component class for displaying a quick links nav
| styleModifiers | <code>String</code> | Apply alternate styles with a space-separated list. |
| opened | <code>Boolean</code> | Menu is open |
| animationDuration | <code>Number</code> | Length of animation when opening/closing menu |
| useIcon | <code>Boolean</code> | Show a custom icon next to the title |

<a name="open"></a>

Expand Down
5 changes: 5 additions & 0 deletions elements/brand/ucd-theme-collapse/ucd-theme-collapse.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export function styles() {
[hidden] {
display: none;
}
.collapse__content {
background-color: var(--collapse-background-color, white);
border-color: var(--collapse-border-color, black);
}
`;

return [
Expand Down
2 changes: 1 addition & 1 deletion elements/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ucd-lib/theme-elements",
"version": "3.0.0",
"version": "3.0.1",
"description": "Custom elements for the UCD brand theme",
"main": "index.js",
"scripts": {
Expand Down
39 changes: 35 additions & 4 deletions elements/utils/controllers/wait.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class WaitController{
* @method wait
* @description Wait for the specified amount of time
* @param {Number} time - Time to wait (ms)
* @returns
* @returns
*/
async wait(time){
return new Promise(resolve => {
Expand All @@ -20,7 +20,7 @@ export class WaitController{
* @method waitForUpdate
* @description Requests and waits for Lit update.
*/
async waitForUpdate(){
async waitForUpdate(){
this.host.requestUpdate();
await this.host.updateComplete;
}
Expand All @@ -30,13 +30,44 @@ export class WaitController{
* @description Wait for specified number of animation frames
* @param {Number} ct Number of frames
*/
async waitForFrames(ct=1) {
async waitForFrames(ct=1) {
for (let i = 0; i < ct; i++) {
await new Promise(resolve => {
requestAnimationFrame(resolve);
});
}
}

/**
* @description Wait for the host to have a property with a specific value
* @param {String} prop - Host property to wait for
* @param {*} value - Host property value to wait for
* @param {Number} timeout - Timeout in ms
* @returns {Object} - Object with the following properties:
* - prop: Property name
* - targetValue: Value to wait for
* - timeoutValue: Timeout value
* - propValue: Current value of the property
* - wasTimeout: Was the wait timed out
*/
async waitForHostPropertyValue(prop, value, timeout=5000){
const out = {
prop,
targetValue: value,
timeoutValue: timeout,
propValue: this.host[prop],
wasTimeout: false
};
let start = Date.now();
while (this.host[prop] !== value) {
if (Date.now() - start > timeout) {
out.wasTimeout = true;
return out;
}
await this.wait(10);
}
return out;
}


}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ucd-lib/theme",
"version": "2.0.0",
"version": "2.0.1",
"description": "University branding, additional theme support, theme elements",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit ef26b7d

Please sign in to comment.