UNPKG

@itwin/appui-abstract

Version:
32 lines 1.83 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Utilities */ /* eslint-disable @typescript-eslint/no-deprecated */ /** Creates an IconSpec with an SVG source and gets the SVG source from an IconSpec. * @public @deprecated in 4.3 - will not be removed until after 2026-06-13. AppUI libraries >= 4.7.x support loading SVGs sources without prefixes, eliminating the need for these utilities. */ export class IconSpecUtilities { /** Prefix for an SVG IconSpec loaded with the Sprite loader */ static SVG_PREFIX = "svg:"; static WEB_COMPONENT_PREFIX = "webSvg:"; /** Create an IconSpec for an SVG loaded into web component with svg-loader * @public @deprecated in 4.3 - will not be removed until after 2026-06-13. AppUI libraries > 4.7.x support loading SVGs sources without prefixes, eliminating the need for this utility. */ static createWebComponentIconSpec(srcString) { return `${IconSpecUtilities.WEB_COMPONENT_PREFIX}${srcString}`; } /** Get the SVG Source from an svg-loader IconSpec * @public @deprecated in 4.3 - will not be removed until after 2026-06-13. AppUI libraries > 4.7.x support loading SVGs sources without prefixes, eliminating the need for this utility. */ static getWebComponentSource(iconSpec) { if (iconSpec.startsWith(IconSpecUtilities.WEB_COMPONENT_PREFIX) && iconSpec.length > 7) { return iconSpec.slice(7); } return undefined; } } //# sourceMappingURL=IconSpecUtilities.js.map