big updats
This commit is contained in:
22
app/util.ts
22
app/util.ts
@@ -1,5 +1,5 @@
|
||||
import { type InjectionKey, inject } from 'vue';
|
||||
import useDJSSRContext from "@/useDJSSRContext.ts";
|
||||
import useDjSSRContext from "@/useDjSSRContext.ts";
|
||||
|
||||
export function gid(id: string, doc: (Document | ShadowRoot) | undefined) {
|
||||
return ((doc ?? document).getElementById(id));
|
||||
@@ -46,7 +46,7 @@ export function css(strs: TemplateStringsArray, ...vals: string[]) {
|
||||
|
||||
export const cssRegistry = Symbol('css-registry') as InjectionKey<Set<string>>;
|
||||
export function addCSS(key: string, css: string) {
|
||||
const context = useDJSSRContext();
|
||||
const context = useDjSSRContext();
|
||||
if (context && !context.styles[key]) {
|
||||
context.styles[key] = css;
|
||||
} else {
|
||||
@@ -58,21 +58,3 @@ export function addCSS(key: string, css: string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
export class DJElement extends HTMLElement {
|
||||
static styles: CSSStyleSheet;
|
||||
|
||||
static template: HTMLTemplateElement;
|
||||
|
||||
root: ShadowRoot;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
const statics = this.constructor as typeof DJElement;
|
||||
this.root = this.attachShadow({ mode: "open" });
|
||||
this.root.appendChild(statics.template.content.cloneNode(true));
|
||||
this.root.adoptedStyleSheets = statics.styles ? [statics.styles] : [];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user