build(media): build26 from 45504a2b

This commit is contained in:
publish
2026-08-05 18:57:42 +02:00
commit 46507f9d0d
320 changed files with 11597 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
import { addMediaComponent, getMediaComponents, getMediaOwner, getMediaProp, setMediaProp } from "./media-components.js";
+12
View File
@@ -0,0 +1,12 @@
import { HTMLMediaElementHost, HTMLMediaTargetLike, MediaComponent, MediaComponents } from "../media-host/media-host.js";
//#region src/dom/utils/media-components.d.ts
type MediaHost<T extends HTMLMediaTargetLike = any> = HTMLMediaElementHost<T, any>;
declare function getMediaComponents(host: MediaHost): MediaComponents;
declare function addMediaComponent<T extends MediaComponent>(host: MediaHost, component: T): () => void;
declare function getMediaProp<T extends HTMLMediaTargetLike, K extends keyof T>(host: MediaHost<T>, prop: K): T[K] | undefined;
declare function setMediaProp<T extends HTMLMediaTargetLike, K extends keyof T>(host: MediaHost<T>, prop: K, value: T[K]): void;
/** Find the object that owns a media property: the first component `override` exposing it, otherwise the attached target. */
declare function getMediaOwner<T extends HTMLMediaTargetLike>(host: MediaHost<T>, prop: keyof T): Partial<T> | null;
//#endregion
export { addMediaComponent, getMediaComponents, getMediaOwner, getMediaProp, setMediaProp };
//# sourceMappingURL=media-components.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"media-components.d.ts","names":[],"sources":["../../../../src/dom/utils/media-components.ts"],"mappings":";;KAQY,SAAA,WAAoB,mBAAA,UAAoB,oBAAA,CAAqB,CAAA;AAAA,iBAIzD,kBAAA,CAAmB,IAAA,EAAM,SAAA,GAAS,eAAA;AAAA,iBAMlC,iBAAA,WAA4B,cAAA,CAAA,CAAgB,IAAA,EAAM,SAAA,EAAW,SAAA,EAAW,CAAA;AAAA,iBAuBxE,YAAA,WAAuB,mBAAA,kBAA4B,CAAA,CAAA,CAAG,IAAA,EAAM,SAAA,CAAU,CAAA,GAAI,IAAA,EAAM,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,iBAItF,YAAA,WAAuB,mBAAA,kBAA4B,CAAA,CAAA,CAAG,IAAA,EAAM,SAAA,CAAU,CAAA,GAAI,IAAA,EAAM,CAAA,EAAG,KAAA,EAAO,CAAA,CAAE,CAAA;;iBAM5F,aAAA,WAAwB,mBAAA,CAAA,CAAY,IAAA,EAAM,SAAA,CAAU,CAAA,GAAI,IAAA,QAAY,CAAA,GAAI,OAAA,CAAQ,CAAA"}
+41
View File
@@ -0,0 +1,41 @@
//#region src/dom/utils/media-components.ts
const componentRegistry = /* @__PURE__ */ new WeakMap();
function getMediaComponents(host) {
let map = componentRegistry.get(host);
if (!map) componentRegistry.set(host, map = /* @__PURE__ */ new Map());
return map;
}
function addMediaComponent(host, component) {
const components = getMediaComponents(host);
const ctor = component.constructor;
const previous = components.get(ctor);
if (previous && previous !== component) previous.detach?.();
components.set(ctor, component);
component.setMedia?.(host);
if (host.target) component.attach?.(host.target);
return () => {
if (components.get(ctor) === component) {
component.detach?.();
components.delete(ctor);
}
};
}
function getMediaProp(host, prop) {
return getMediaOwner(host, prop)?.[prop];
}
function setMediaProp(host, prop, value) {
const own = getMediaOwner(host, prop);
if (own) own[prop] = value;
}
/** Find the object that owns a media property: the first component `override` exposing it, otherwise the attached target. */
function getMediaOwner(host, prop) {
for (const component of getMediaComponents(host).values()) {
const override = component.targetOverride;
if (override?.[prop] !== void 0) return override;
}
return host.target;
}
//#endregion
export { addMediaComponent, getMediaComponents, getMediaOwner, getMediaProp, setMediaProp };
//# sourceMappingURL=media-components.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"media-components.js","names":[],"sources":["../../../../src/dom/utils/media-components.ts"],"sourcesContent":["import type {\n HTMLMediaElementHost,\n MediaComponent,\n MediaComponentConstructor,\n MediaComponents,\n HTMLMediaTargetLike as TargetLike,\n} from '../media-host';\n\nexport type MediaHost<T extends TargetLike = any> = HTMLMediaElementHost<T, any>;\n\nconst componentRegistry = new WeakMap<MediaHost, MediaComponents>();\n\nexport function getMediaComponents(host: MediaHost) {\n let map = componentRegistry.get(host);\n if (!map) componentRegistry.set(host, (map = new Map() as MediaComponents));\n return map;\n}\n\nexport function addMediaComponent<T extends MediaComponent>(host: MediaHost, component: T) {\n const components = getMediaComponents(host);\n // Get the component's constructor to use as the key for the component in the registry.\n const ctor = component.constructor as MediaComponentConstructor<T>;\n\n const previous = components.get(ctor);\n if (previous && previous !== component) previous.detach?.();\n\n components.set(ctor, component);\n\n component.setMedia?.(host);\n\n // @ts-expect-error `target` is protected, but these helpers are the host's own machinery.\n if (host.target) component.attach?.(host.target);\n\n return () => {\n if (components.get(ctor) === component) {\n component.detach?.();\n components.delete(ctor);\n }\n };\n}\n\nexport function getMediaProp<T extends TargetLike, K extends keyof T>(host: MediaHost<T>, prop: K): T[K] | undefined {\n return getMediaOwner(host, prop)?.[prop];\n}\n\nexport function setMediaProp<T extends TargetLike, K extends keyof T>(host: MediaHost<T>, prop: K, value: T[K]): void {\n const own = getMediaOwner(host, prop);\n if (own) (own as Record<K, T[K]>)[prop] = value;\n}\n\n/** Find the object that owns a media property: the first component `override` exposing it, otherwise the attached target. */\nexport function getMediaOwner<T extends TargetLike>(host: MediaHost<T>, prop: keyof T): Partial<T> | null {\n for (const component of getMediaComponents(host).values()) {\n const override = component.targetOverride as Partial<T> | null | undefined;\n if (override?.[prop] !== undefined) return override;\n }\n // @ts-expect-error `target` is protected, but these helpers are the host's own machinery.\n return host.target;\n}\n"],"mappings":";AAUA,MAAM,oCAAoB,IAAI,SAAqC;AAEnE,SAAgB,mBAAmB,MAAiB;CAClD,IAAI,MAAM,kBAAkB,IAAI,KAAK;AACrC,KAAI,CAAC,IAAK,mBAAkB,IAAI,MAAO,sBAAM,IAAI,KAAK,CAAqB;AAC3E,QAAO;;AAGT,SAAgB,kBAA4C,MAAiB,WAAc;CACzF,MAAM,aAAa,mBAAmB,KAAK;CAE3C,MAAM,OAAO,UAAU;CAEvB,MAAM,WAAW,WAAW,IAAI,KAAK;AACrC,KAAI,YAAY,aAAa,UAAW,UAAS,UAAU;AAE3D,YAAW,IAAI,MAAM,UAAU;AAE/B,WAAU,WAAW,KAAK;AAG1B,KAAI,KAAK,OAAQ,WAAU,SAAS,KAAK,OAAO;AAEhD,cAAa;AACX,MAAI,WAAW,IAAI,KAAK,KAAK,WAAW;AACtC,aAAU,UAAU;AACpB,cAAW,OAAO,KAAK;;;;AAK7B,SAAgB,aAAsD,MAAoB,MAA2B;AACnH,QAAO,cAAc,MAAM,KAAK,GAAG;;AAGrC,SAAgB,aAAsD,MAAoB,MAAS,OAAmB;CACpH,MAAM,MAAM,cAAc,MAAM,KAAK;AACrC,KAAI,IAAM,KAAwB,QAAQ;;;AAI5C,SAAgB,cAAoC,MAAoB,MAAkC;AACxG,MAAK,MAAM,aAAa,mBAAmB,KAAK,CAAC,QAAQ,EAAE;EACzD,MAAM,WAAW,UAAU;AAC3B,MAAI,WAAW,UAAU,KAAA,EAAW,QAAO;;AAG7C,QAAO,KAAK"}