first commit

This commit is contained in:
becarta
2025-05-16 00:17:42 +02:00
parent ea5c866137
commit bacf566ec9
6020 changed files with 1715262 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
type ARIAAttributeMap = {
[K in keyof ARIAMixin]: string;
};
/**
* Map of ARIAMixin properties to attributes
*/
export declare const ariaMixinAttributes: ARIAAttributeMap;
export declare const ElementInternalsShim: {
new (_host: HTMLElement): {
ariaAtomic: string;
ariaAutoComplete: string;
ariaBrailleLabel: string;
ariaBrailleRoleDescription: string;
ariaBusy: string;
ariaChecked: string;
ariaColCount: string;
ariaColIndex: string;
ariaColSpan: string;
ariaCurrent: string;
ariaDescription: string;
ariaDisabled: string;
ariaExpanded: string;
ariaHasPopup: string;
ariaHidden: string;
ariaInvalid: string;
ariaKeyShortcuts: string;
ariaLabel: string;
ariaLevel: string;
ariaLive: string;
ariaModal: string;
ariaMultiLine: string;
ariaMultiSelectable: string;
ariaOrientation: string;
ariaPlaceholder: string;
ariaPosInSet: string;
ariaPressed: string;
ariaReadOnly: string;
ariaRequired: string;
ariaRoleDescription: string;
ariaRowCount: string;
ariaRowIndex: string;
ariaRowSpan: string;
ariaSelected: string;
ariaSetSize: string;
ariaSort: string;
ariaValueMax: string;
ariaValueMin: string;
ariaValueNow: string;
ariaValueText: string;
role: string;
__host: HTMLElement;
readonly shadowRoot: ShadowRoot;
checkValidity(): boolean;
form: null;
labels: NodeListOf<HTMLLabelElement>;
reportValidity(): boolean;
setFormValue(): void;
setValidity(): void;
states: Set<string>;
validationMessage: string;
validity: ValidityState;
willValidate: boolean;
};
};
declare const ElementInternalsShimWithRealType: typeof ElementInternals;
export { ElementInternalsShimWithRealType as ElementInternals };
export declare const HYDRATE_INTERNALS_ATTR_PREFIX = "hydrate-internals-";
//# sourceMappingURL=element-internals.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"element-internals.d.ts","sourceRoot":"","sources":["../src/lib/element-internals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,KAAK,gBAAgB,GAAG;KACrB,CAAC,IAAI,MAAM,SAAS,GAAG,MAAM;CAC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBA0CjC,CAAC;AAOF,eAAO,MAAM,oBAAoB;gBAoDZ,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBARtB,WAAW;;;;gBAqBO,UAAU,CAAC,gBAAgB,CAAC;;wBAItC,IAAI;uBACL,IAAI;;;kBAGF,aAAa;;;CAE/B,CAAC;AAEF,QAAA,MAAM,gCAAgC,EACF,OAAO,gBAAgB,CAAC;AAC5D,OAAO,EAAC,gCAAgC,IAAI,gBAAgB,EAAC,CAAC;AAE9D,eAAO,MAAM,6BAA6B,uBAAuB,CAAC"}

View File

@@ -0,0 +1,129 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* Map of ARIAMixin properties to attributes
*/
export const ariaMixinAttributes = {
ariaAtomic: 'aria-atomic',
ariaAutoComplete: 'aria-autocomplete',
ariaBrailleLabel: 'aria-braillelabel',
ariaBrailleRoleDescription: 'aria-brailleroledescription',
ariaBusy: 'aria-busy',
ariaChecked: 'aria-checked',
ariaColCount: 'aria-colcount',
ariaColIndex: 'aria-colindex',
ariaColSpan: 'aria-colspan',
ariaCurrent: 'aria-current',
ariaDescription: 'aria-description',
ariaDisabled: 'aria-disabled',
ariaExpanded: 'aria-expanded',
ariaHasPopup: 'aria-haspopup',
ariaHidden: 'aria-hidden',
ariaInvalid: 'aria-invalid',
ariaKeyShortcuts: 'aria-keyshortcuts',
ariaLabel: 'aria-label',
ariaLevel: 'aria-level',
ariaLive: 'aria-live',
ariaModal: 'aria-modal',
ariaMultiLine: 'aria-multiline',
ariaMultiSelectable: 'aria-multiselectable',
ariaOrientation: 'aria-orientation',
ariaPlaceholder: 'aria-placeholder',
ariaPosInSet: 'aria-posinset',
ariaPressed: 'aria-pressed',
ariaReadOnly: 'aria-readonly',
ariaRequired: 'aria-required',
ariaRoleDescription: 'aria-roledescription',
ariaRowCount: 'aria-rowcount',
ariaRowIndex: 'aria-rowindex',
ariaRowSpan: 'aria-rowspan',
ariaSelected: 'aria-selected',
ariaSetSize: 'aria-setsize',
ariaSort: 'aria-sort',
ariaValueMax: 'aria-valuemax',
ariaValueMin: 'aria-valuemin',
ariaValueNow: 'aria-valuenow',
ariaValueText: 'aria-valuetext',
role: 'role',
};
// Shim the global element internals object
// Methods should be fine as noops and properties can generally
// be while on the server.
export const ElementInternalsShim = class ElementInternals {
get shadowRoot() {
// Grab the shadow root instance from the Element shim
// to ensure that the shadow root is always available
// to the internals instance even if the mode is 'closed'
return this.__host
.__shadowRoot;
}
constructor(_host) {
this.ariaAtomic = '';
this.ariaAutoComplete = '';
this.ariaBrailleLabel = '';
this.ariaBrailleRoleDescription = '';
this.ariaBusy = '';
this.ariaChecked = '';
this.ariaColCount = '';
this.ariaColIndex = '';
this.ariaColSpan = '';
this.ariaCurrent = '';
this.ariaDescription = '';
this.ariaDisabled = '';
this.ariaExpanded = '';
this.ariaHasPopup = '';
this.ariaHidden = '';
this.ariaInvalid = '';
this.ariaKeyShortcuts = '';
this.ariaLabel = '';
this.ariaLevel = '';
this.ariaLive = '';
this.ariaModal = '';
this.ariaMultiLine = '';
this.ariaMultiSelectable = '';
this.ariaOrientation = '';
this.ariaPlaceholder = '';
this.ariaPosInSet = '';
this.ariaPressed = '';
this.ariaReadOnly = '';
this.ariaRequired = '';
this.ariaRoleDescription = '';
this.ariaRowCount = '';
this.ariaRowIndex = '';
this.ariaRowSpan = '';
this.ariaSelected = '';
this.ariaSetSize = '';
this.ariaSort = '';
this.ariaValueMax = '';
this.ariaValueMin = '';
this.ariaValueNow = '';
this.ariaValueText = '';
this.role = '';
this.form = null;
this.labels = [];
this.states = new Set();
this.validationMessage = '';
this.validity = {};
this.willValidate = true;
this.__host = _host;
}
checkValidity() {
// TODO(augustjk) Consider actually implementing logic.
// See https://github.com/lit/lit/issues/3740
console.warn('`ElementInternals.checkValidity()` was called on the server.' +
'This method always returns true.');
return true;
}
reportValidity() {
return true;
}
setFormValue() { }
setValidity() { }
};
const ElementInternalsShimWithRealType = ElementInternalsShim;
export { ElementInternalsShimWithRealType as ElementInternals };
export const HYDRATE_INTERNALS_ATTR_PREFIX = 'hydrate-internals-';
//# sourceMappingURL=element-internals.js.map

File diff suppressed because one or more lines are too long

34
node_modules/@lit-labs/ssr-dom-shim/lib/events.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* This is a basic implementation of an EventTarget, Event and CustomEvent.
*
* This is not fully spec compliant (e.g. validation),
* but should work well enough for our use cases.
*
* @see https://dom.spec.whatwg.org/#eventtarget
* @see https://dom.spec.whatwg.org/#event
* @see https://dom.spec.whatwg.org/#customevent
*/
export interface EventTargetShimMeta {
/**
* The event target parent represents the previous event target for an event
* in capture phase and the next event target for a bubbling event.
* Note that this is not the element parent
*/
__eventTargetParent: EventTarget | undefined;
/**
* The host event target/element of this event target, if this event target
* is inside a Shadow DOM.
*/
__host: EventTarget | undefined;
}
declare const EventTargetShimWithRealType: typeof EventTarget;
export { EventTargetShimWithRealType as EventTarget, EventTargetShimWithRealType as EventTargetShim, };
declare const EventShimWithRealType: typeof Event;
declare const CustomEventShimWithRealType: typeof CustomEvent;
export { EventShimWithRealType as Event, EventShimWithRealType as EventShim, CustomEventShimWithRealType as CustomEvent, CustomEventShimWithRealType as CustomEventShim, };
//# sourceMappingURL=events.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/lib/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,mBAAmB,EAAE,WAAW,GAAG,SAAS,CAAC;IAC7C;;;OAGG;IACH,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;CACjC;AA6PD,QAAA,MAAM,2BAA2B,EACF,OAAO,WAAW,CAAC;AAClD,OAAO,EACL,2BAA2B,IAAI,WAAW,EAC1C,2BAA2B,IAAI,eAAe,GAC/C,CAAC;AAkLF,QAAA,MAAM,qBAAqB,EAA0B,OAAO,KAAK,CAAC;AAClE,QAAA,MAAM,2BAA2B,EACF,OAAO,WAAW,CAAC;AAClD,OAAO,EACL,qBAAqB,IAAI,KAAK,EAC9B,qBAAqB,IAAI,SAAS,EAClC,2BAA2B,IAAI,WAAW,EAC1C,2BAA2B,IAAI,eAAe,GAC/C,CAAC"}

375
node_modules/@lit-labs/ssr-dom-shim/lib/events.js generated vendored Normal file
View File

@@ -0,0 +1,375 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _Event_cancelable, _Event_bubbles, _Event_composed, _Event_defaultPrevented, _Event_timestamp, _Event_propagationStopped, _Event_type, _Event_target, _Event_isBeingDispatched, _a, _CustomEvent_detail, _b;
const isCaptureEventListener = (options) => (typeof options === 'boolean' ? options : options?.capture ?? false);
// Event phases
const NONE = 0;
const CAPTURING_PHASE = 1;
const AT_TARGET = 2;
const BUBBLING_PHASE = 3;
// Shim the global EventTarget object
const EventTargetShim = class EventTarget {
constructor() {
this.__eventListeners = new Map();
this.__captureEventListeners = new Map();
}
addEventListener(type, callback, options) {
if (callback === undefined || callback === null) {
return;
}
const eventListenersMap = isCaptureEventListener(options)
? this.__captureEventListeners
: this.__eventListeners;
let eventListeners = eventListenersMap.get(type);
if (eventListeners === undefined) {
eventListeners = new Map();
eventListenersMap.set(type, eventListeners);
}
else if (eventListeners.has(callback)) {
return;
}
const normalizedOptions = typeof options === 'object' && options ? options : {};
normalizedOptions.signal?.addEventListener('abort', () => this.removeEventListener(type, callback, options));
eventListeners.set(callback, normalizedOptions ?? {});
}
removeEventListener(type, callback, options) {
if (callback === undefined || callback === null) {
return;
}
const eventListenersMap = isCaptureEventListener(options)
? this.__captureEventListeners
: this.__eventListeners;
const eventListeners = eventListenersMap.get(type);
if (eventListeners !== undefined) {
eventListeners.delete(callback);
if (!eventListeners.size) {
eventListenersMap.delete(type);
}
}
}
dispatchEvent(event) {
const composedPath = [this];
let parent = this.__eventTargetParent;
if (event.composed) {
while (parent) {
composedPath.push(parent);
parent = parent.__eventTargetParent;
}
}
else {
// If the event is not composed and the event was dispatched inside
// shadow DOM, we need to stop before the host of the shadow DOM.
while (parent && parent !== this.__host) {
composedPath.push(parent);
parent = parent.__eventTargetParent;
}
}
// We need to patch various properties that would either be empty or wrong
// in this scenario.
let stopPropagation = false;
let stopImmediatePropagation = false;
let eventPhase = NONE;
let target = null;
let tmpTarget = null;
let currentTarget = null;
const originalStopPropagation = event.stopPropagation;
const originalStopImmediatePropagation = event.stopImmediatePropagation;
Object.defineProperties(event, {
target: {
get() {
return target ?? tmpTarget;
},
...enumerableProperty,
},
srcElement: {
get() {
return event.target;
},
...enumerableProperty,
},
currentTarget: {
get() {
return currentTarget;
},
...enumerableProperty,
},
eventPhase: {
get() {
return eventPhase;
},
...enumerableProperty,
},
composedPath: {
value: () => composedPath,
...enumerableProperty,
},
stopPropagation: {
value: () => {
stopPropagation = true;
originalStopPropagation.call(event);
},
...enumerableProperty,
},
stopImmediatePropagation: {
value: () => {
stopImmediatePropagation = true;
originalStopImmediatePropagation.call(event);
},
...enumerableProperty,
},
});
// An event handler can either be a function, an object with a handleEvent
// method or null. This function takes care to call the event handler
// correctly.
const invokeEventListener = (listener, options, eventListenerMap) => {
if (typeof listener === 'function') {
listener(event);
}
else if (typeof listener?.handleEvent === 'function') {
listener.handleEvent(event);
}
if (options.once) {
eventListenerMap.delete(listener);
}
};
// When an event is finished being dispatched, which can be after the event
// tree has been traversed or stopPropagation/stopImmediatePropagation has
// been called. Once that is the case, the currentTarget and eventPhase
// need to be reset and a value, representing whether the event has not
// been prevented, needs to be returned.
const finishDispatch = () => {
currentTarget = null;
eventPhase = NONE;
return !event.defaultPrevented;
};
// An event starts with the capture order, where it starts from the top.
// This is done even if bubbles is set to false, which is the default.
const captureEventPath = composedPath.slice().reverse();
// If the event target, which dispatches the event, is either in the light DOM
// or the event is not composed, the target is always itself. If that is not
// the case, the target needs to be retargeted: https://dom.spec.whatwg.org/#retarget
target = !this.__host || !event.composed ? this : null;
const retarget = (eventTargets) => {
// eslint-disable-next-line @typescript-eslint/no-this-alias
tmpTarget = this;
while (tmpTarget.__host && eventTargets.includes(tmpTarget.__host)) {
tmpTarget = tmpTarget.__host;
}
};
for (const eventTarget of captureEventPath) {
if (!target && (!tmpTarget || tmpTarget === eventTarget.__host)) {
retarget(captureEventPath.slice(captureEventPath.indexOf(eventTarget)));
}
currentTarget = eventTarget;
eventPhase = eventTarget === event.target ? AT_TARGET : CAPTURING_PHASE;
const captureEventListeners = eventTarget.__captureEventListeners.get(event.type);
if (captureEventListeners) {
for (const [listener, options] of captureEventListeners) {
invokeEventListener(listener, options, captureEventListeners);
if (stopImmediatePropagation) {
// Event.stopImmediatePropagation() stops any following invocation
// of an event handler even on the same event target.
return finishDispatch();
}
}
}
if (stopPropagation) {
// Event.stopPropagation() stops any following invocation
// of an event handler for any following event targets.
return finishDispatch();
}
}
const bubbleEventPath = event.bubbles ? composedPath : [this];
tmpTarget = null;
for (const eventTarget of bubbleEventPath) {
if (!target &&
(!tmpTarget || eventTarget === tmpTarget.__host)) {
retarget(bubbleEventPath.slice(0, bubbleEventPath.indexOf(eventTarget) + 1));
}
currentTarget = eventTarget;
eventPhase = eventTarget === event.target ? AT_TARGET : BUBBLING_PHASE;
const captureEventListeners = eventTarget.__eventListeners.get(event.type);
if (captureEventListeners) {
for (const [listener, options] of captureEventListeners) {
invokeEventListener(listener, options, captureEventListeners);
if (stopImmediatePropagation) {
// Event.stopImmediatePropagation() stops any following invocation
// of an event handler even on the same event target.
return finishDispatch();
}
}
}
if (stopPropagation) {
// Event.stopPropagation() stops any following invocation
// of an event handler for any following event targets.
return finishDispatch();
}
}
return finishDispatch();
}
};
const EventTargetShimWithRealType = EventTargetShim;
export { EventTargetShimWithRealType as EventTarget, EventTargetShimWithRealType as EventTargetShim, };
const enumerableProperty = { __proto__: null };
enumerableProperty.enumerable = true;
Object.freeze(enumerableProperty);
// TODO: Remove this when we remove support for vm modules (--experimental-vm-modules).
const EventShim = (_a = class Event {
constructor(type, options = {}) {
_Event_cancelable.set(this, false);
_Event_bubbles.set(this, false);
_Event_composed.set(this, false);
_Event_defaultPrevented.set(this, false);
_Event_timestamp.set(this, Date.now());
_Event_propagationStopped.set(this, false);
_Event_type.set(this, void 0);
_Event_target.set(this, void 0);
_Event_isBeingDispatched.set(this, void 0);
this.NONE = NONE;
this.CAPTURING_PHASE = CAPTURING_PHASE;
this.AT_TARGET = AT_TARGET;
this.BUBBLING_PHASE = BUBBLING_PHASE;
if (arguments.length === 0)
throw new Error(`The type argument must be specified`);
if (typeof options !== 'object' || !options) {
throw new Error(`The "options" argument must be an object`);
}
const { bubbles, cancelable, composed } = options;
__classPrivateFieldSet(this, _Event_cancelable, !!cancelable, "f");
__classPrivateFieldSet(this, _Event_bubbles, !!bubbles, "f");
__classPrivateFieldSet(this, _Event_composed, !!composed, "f");
__classPrivateFieldSet(this, _Event_type, `${type}`, "f");
__classPrivateFieldSet(this, _Event_target, null, "f");
__classPrivateFieldSet(this, _Event_isBeingDispatched, false, "f");
}
initEvent(_type, _bubbles, _cancelable) {
throw new Error('Method not implemented.');
}
stopImmediatePropagation() {
this.stopPropagation();
}
preventDefault() {
__classPrivateFieldSet(this, _Event_defaultPrevented, true, "f");
}
get target() {
return __classPrivateFieldGet(this, _Event_target, "f");
}
get currentTarget() {
return __classPrivateFieldGet(this, _Event_target, "f");
}
get srcElement() {
return __classPrivateFieldGet(this, _Event_target, "f");
}
get type() {
return __classPrivateFieldGet(this, _Event_type, "f");
}
get cancelable() {
return __classPrivateFieldGet(this, _Event_cancelable, "f");
}
get defaultPrevented() {
return __classPrivateFieldGet(this, _Event_cancelable, "f") && __classPrivateFieldGet(this, _Event_defaultPrevented, "f");
}
get timeStamp() {
return __classPrivateFieldGet(this, _Event_timestamp, "f");
}
composedPath() {
return __classPrivateFieldGet(this, _Event_isBeingDispatched, "f") ? [__classPrivateFieldGet(this, _Event_target, "f")] : [];
}
get returnValue() {
return !__classPrivateFieldGet(this, _Event_cancelable, "f") || !__classPrivateFieldGet(this, _Event_defaultPrevented, "f");
}
get bubbles() {
return __classPrivateFieldGet(this, _Event_bubbles, "f");
}
get composed() {
return __classPrivateFieldGet(this, _Event_composed, "f");
}
get eventPhase() {
return __classPrivateFieldGet(this, _Event_isBeingDispatched, "f") ? _a.AT_TARGET : _a.NONE;
}
get cancelBubble() {
return __classPrivateFieldGet(this, _Event_propagationStopped, "f");
}
set cancelBubble(value) {
if (value) {
__classPrivateFieldSet(this, _Event_propagationStopped, true, "f");
}
}
stopPropagation() {
__classPrivateFieldSet(this, _Event_propagationStopped, true, "f");
}
get isTrusted() {
return false;
}
},
_Event_cancelable = new WeakMap(),
_Event_bubbles = new WeakMap(),
_Event_composed = new WeakMap(),
_Event_defaultPrevented = new WeakMap(),
_Event_timestamp = new WeakMap(),
_Event_propagationStopped = new WeakMap(),
_Event_type = new WeakMap(),
_Event_target = new WeakMap(),
_Event_isBeingDispatched = new WeakMap(),
_a.NONE = NONE,
_a.CAPTURING_PHASE = CAPTURING_PHASE,
_a.AT_TARGET = AT_TARGET,
_a.BUBBLING_PHASE = BUBBLING_PHASE,
_a);
Object.defineProperties(EventShim.prototype, {
initEvent: enumerableProperty,
stopImmediatePropagation: enumerableProperty,
preventDefault: enumerableProperty,
target: enumerableProperty,
currentTarget: enumerableProperty,
srcElement: enumerableProperty,
type: enumerableProperty,
cancelable: enumerableProperty,
defaultPrevented: enumerableProperty,
timeStamp: enumerableProperty,
composedPath: enumerableProperty,
returnValue: enumerableProperty,
bubbles: enumerableProperty,
composed: enumerableProperty,
eventPhase: enumerableProperty,
cancelBubble: enumerableProperty,
stopPropagation: enumerableProperty,
isTrusted: enumerableProperty,
});
// TODO: Remove this when we remove support for vm modules (--experimental-vm-modules).
const CustomEventShim = (_b = class CustomEvent extends EventShim {
constructor(type, options = {}) {
super(type, options);
_CustomEvent_detail.set(this, void 0);
__classPrivateFieldSet(this, _CustomEvent_detail, options?.detail ?? null, "f");
}
initCustomEvent(_type, _bubbles, _cancelable, _detail) {
throw new Error('Method not implemented.');
}
get detail() {
return __classPrivateFieldGet(this, _CustomEvent_detail, "f");
}
},
_CustomEvent_detail = new WeakMap(),
_b);
Object.defineProperties(CustomEventShim.prototype, {
detail: enumerableProperty,
});
const EventShimWithRealType = EventShim;
const CustomEventShimWithRealType = CustomEventShim;
export { EventShimWithRealType as Event, EventShimWithRealType as EventShim, CustomEventShimWithRealType as CustomEvent, CustomEventShimWithRealType as CustomEventShim, };
//# sourceMappingURL=events.js.map

File diff suppressed because one or more lines are too long