Compare commits
	
		
			1 Commits
		
	
	
		
			website/do
			...
			web/fix-cs
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 403184ad73 | 
							
								
								
									
										2
									
								
								web/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								web/package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -17059,6 +17059,7 @@ | |||||||
|         }, |         }, | ||||||
|         "node_modules/tree-sitter-json": { |         "node_modules/tree-sitter-json": { | ||||||
|             "version": "0.20.2", |             "version": "0.20.2", | ||||||
|  |             "hasInstallScript": true, | ||||||
|             "license": "MIT", |             "license": "MIT", | ||||||
|             "optional": true, |             "optional": true, | ||||||
|             "dependencies": { |             "dependencies": { | ||||||
| @ -17067,6 +17068,7 @@ | |||||||
|         }, |         }, | ||||||
|         "node_modules/tree-sitter-yaml": { |         "node_modules/tree-sitter-yaml": { | ||||||
|             "version": "0.5.0", |             "version": "0.5.0", | ||||||
|  |             "hasInstallScript": true, | ||||||
|             "license": "MIT", |             "license": "MIT", | ||||||
|             "optional": true, |             "optional": true, | ||||||
|             "dependencies": { |             "dependencies": { | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| import { SentryIgnoredError } from "@goauthentik/common/errors"; | import { SentryIgnoredError } from "@goauthentik/common/errors"; | ||||||
|  |  | ||||||
| import { CSSResult, css } from "lit"; | import { CSSResult, css, unsafeCSS } from "lit"; | ||||||
|  |  | ||||||
| export function getCookie(name: string): string { | export function getCookie(name: string): string { | ||||||
|     let cookieValue = ""; |     let cookieValue = ""; | ||||||
| @ -123,7 +123,7 @@ const isCSSResult = (v: unknown): v is CSSResult => | |||||||
|  |  | ||||||
| // prettier-ignore | // prettier-ignore | ||||||
| export const _adaptCSS = (sheet: AdaptableStylesheet): CSSStyleSheet => | export const _adaptCSS = (sheet: AdaptableStylesheet): CSSStyleSheet => | ||||||
|     (typeof sheet === "string" ? css([sheet] as unknown as TemplateStringsArray, ...[]).styleSheet |     (typeof sheet === "string" ? unsafeCSS(sheet).styleSheet | ||||||
|         : isCSSResult(sheet) ? sheet.styleSheet |         : isCSSResult(sheet) ? sheet.styleSheet | ||||||
|         : sheet) as CSSStyleSheet; |         : sheet) as CSSStyleSheet; | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,8 +1,32 @@ | |||||||
| import { CSSResult, unsafeCSS } from "lit"; | import { CSSResult, unsafeCSS } from "lit"; | ||||||
|  |  | ||||||
| export const ensureCSSStyleSheet = (css: string | CSSStyleSheet | CSSResult): CSSStyleSheet => | export const supportsAdoptingStyleSheets: boolean = | ||||||
|     typeof css === "string" |   window.ShadowRoot && | ||||||
|         ? (unsafeCSS(css).styleSheet as CSSStyleSheet) |   (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) && | ||||||
|         : css instanceof CSSResult |   'adoptedStyleSheets' in Document.prototype && | ||||||
|           ? (css.styleSheet as CSSStyleSheet) |   'replace' in CSSStyleSheet.prototype; | ||||||
|           : css; |  | ||||||
|  |  | ||||||
|  | function stringToStyleSheet(css: string) { | ||||||
|  |     if (supportsAdoptingStyleSheets) { | ||||||
|  |         const sheet = unsafeCSS(css).styleSheet; | ||||||
|  |         return sheet as CSSStyleSheet; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     const sheet = new CSSStyleSheet(); | ||||||
|  |     sheet.replaceSync(css); | ||||||
|  |     return sheet; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | export const ensureCSSStyleSheet = (css: string | CSSStyleSheet | CSSResult): CSSStyleSheet | CSSResult => { | ||||||
|  |     if (css instanceof CSSResult) { | ||||||
|  |         return css; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if (typeof css === "string") { | ||||||
|  |         return stringToStyleSheet(css); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     return css; | ||||||
|  | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	