This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExtendedLitElement extends LitElement { | |
static getDuckTypedDescendants(parent, qualifyingPropertyName, stopTraversalOnMatch = true) { | |
const descendants = []; | |
/** | |
* Use a depth-first search (DFS) algorithm to traverse the DOM tree | |
* @param {Node} node | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Credit to @justinfagnani for the original implementation */ | |
import type {ReactiveElement} from 'lit'; | |
import {signal, effect} from '@preact/signals-core'; | |
type ReactiveElementConstructor = new (...args: any[]) => ReactiveElement; | |
export function SignalWatcher<T extends ReactiveElementConstructor>( | |
Base: T | |
): T { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Example usage */ | |
SlAlertWrapper.create({ | |
duration: 10000, | |
renderTemplate: function() { | |
/** @param {MouseEvent} e */ | |
const _handleLinkClick = e => { | |
e.preventDefault(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Notifies ancestor of drilled property update via event | |
*/ | |
class DrilledPropertyUpdateEventController { | |
static customEventName = 'lit-drilled-property-update'; | |
/** @type {HTMLElement} */ | |
host; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BottomIntersectionObserverController { | |
/** @type {HTMLElement} */ | |
host; | |
/** @type {string} */ | |
_bottomThreshold; | |
/** @type {CallableFunction} */ | |
bottomThresholdReachedCallback; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GSP_WrappedSignal { | |
constructor(initialValue) { | |
this.subscribers = new WeakMap(); | |
this.preactSignal = preactSignals.signal(initialValue); | |
} | |
} |