UNPKG

@payfit/unity-icons

Version:

22 lines (21 loc) • 718 B
import e from "./generated/sprite.js"; //#region src/utils.ts var t = e, n = class extends Error { constructor(e) { super(e), this.name = "SpriteInjectionError"; } }, r = !1; function i() { if (typeof document > "u") throw new n("Cannot inject sprite in non-browser environment"); if (!r) try { let e = document.createElement("div"); e.setAttribute("data-testid", "unity-sprite-container"), e.style.display = "none", e.innerHTML = t, document.body.appendChild(e), r = !0; } catch (e) { throw new n(`Failed to inject sprite: ${e instanceof Error ? e.message : "Unknown error"}`); } } function a() { return typeof document < "u" && r; } //#endregion export { i as injectSprite, a as isSpriteInDocument };