File tree Expand file tree Collapse file tree 4 files changed +50
-1
lines changed
src/instance-initializers Expand file tree Collapse file tree 4 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 44 */
55
66const { addonV1Shim } = require ( '@embroider/addon-shim' ) ;
7- module . exports = addonV1Shim ( __dirname ) ;
7+ const flightIconSprite = require ( '@hashicorp/flight-icons/svg-sprite/svg-sprite-module' ) ;
8+
9+ module . exports = {
10+ ...addonV1Shim ( __dirname ) ,
11+ contentFor ( type , config ) {
12+ if ( ! config . emberFlightIcons ?. lazyEmbed && type === 'body-footer' ) {
13+ return flightIconSprite ;
14+ }
15+ } ,
16+ } ;
Original file line number Diff line number Diff line change 4040 "@floating-ui/dom" : " ^1.6.3" ,
4141 "@hashicorp/design-system-tokens" : " ^2.1.0" ,
4242 "@hashicorp/ember-flight-icons" : " ^5.0.3" ,
43+ "@hashicorp/flight-icons" : " ^3.3.0" ,
4344 "@oddbird/popover-polyfill" : " ^0.4.3" ,
4445 "decorator-transforms" : " ^1.1.0" ,
4546 "ember-a11y-refocus" : " ^4.1.0" ,
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) HashiCorp, Inc.
3+ * SPDX-License-Identifier: MPL-2.0
4+ */
5+
6+ import config from 'ember-get-config' ;
7+ import type ApplicationInstance from '@ember/application/instance' ;
8+
9+ export async function initialize (
10+ appInstance : ApplicationInstance & {
11+ __flightIconsSpriteLoaded ?: boolean ;
12+ }
13+ ) {
14+ if (
15+ config ?. emberFlightIcons ?. lazyEmbed &&
16+ appInstance . __flightIconsSpriteLoaded !== true
17+ ) {
18+ const { default : svgSprite } = await import (
19+ '@hashicorp/flight-icons/svg-sprite/svg-sprite-module'
20+ ) ;
21+
22+ // in test environments we can inject the sprite directly into the ember testing container
23+ // to avoid issues with tools like Percy that only consider content inside that element
24+ if ( config . environment === 'test' ) {
25+ window . document
26+ ?. getElementById ( 'ember-testing' )
27+ ?. insertAdjacentHTML ( 'afterbegin' , svgSprite ) ;
28+ } else {
29+ window . document ?. body ?. insertAdjacentHTML ( 'beforeend' , svgSprite ) ;
30+ }
31+
32+ appInstance . __flightIconsSpriteLoaded = true ;
33+ }
34+ }
35+
36+ export default {
37+ initialize,
38+ } ;
Original file line number Diff line number Diff line change @@ -4117,6 +4117,7 @@ __metadata:
41174117 "@glint/template": "npm:^1.4.0"
41184118 "@hashicorp/design-system-tokens": "npm:^2.1.0"
41194119 "@hashicorp/ember-flight-icons": "npm:^5.0.3"
4120+ "@hashicorp/flight-icons": "npm:^3.3.0"
41204121 "@oddbird/popover-polyfill": "npm:^0.4.3"
41214122 "@rollup/plugin-babel": "npm:^6.0.4"
41224123 "@tsconfig/ember": "npm:^3.0.8"
You can’t perform that action at this time.
0 commit comments