Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Adopt @skyux/theme #458

Merged
merged 5 commits into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/karma/dev-src-app.karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function getConfig(config) {
webpackConfig.resolve.alias['@blackbaud/skyux-builder/runtime'] = runtimePath;

// Instead of adding skyux2 as a dependency of skyux-builder
webpackConfig.resolve.alias['@blackbaud/skyux/dist/css/sky.css'] =
webpackConfig.resolve.alias['@skyux/theme/css/sky.css'] =
'../../utils/runtime-test-skyux.css';

// Remove sky-style-loader
Expand Down
2 changes: 1 addition & 1 deletion config/webpack/alias-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
// Order here is very important; the more specific CSS alias must go before
// the more generic dist one.
if (skyPagesConfig.skyux.cssPath) {
alias['@blackbaud/skyux/dist/css/sky.css'] = spaPath(skyPagesConfig.skyux.cssPath);
alias['@skyux/theme/css/sky.css'] = spaPath(skyPagesConfig.skyux.cssPath);
}

if (skyPagesConfig.skyux.importPath) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@pact-foundation/pact": "5.3.0",
"@pact-foundation/pact-node": "6.7.0",
"@pact-foundation/pact-web": "5.3.0",
"@skyux/theme": "3.0.0-alpha.9",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added as a dependency to make the tests pass, but it should be removed once it's added as a dependency of SKY UX.
See: blackbaud/skyux2#1930

"@types/core-js": "0.9.41",
"@types/fontfaceobserver": "0.0.5",
"@types/jasmine": "2.5.47",
Expand Down
50 changes: 0 additions & 50 deletions runtime/style-loader.spec.ts

This file was deleted.

36 changes: 3 additions & 33 deletions runtime/style-loader.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
import * as FontFaceObserver from 'fontfaceobserver';

import { Injectable } from '@angular/core';

@Injectable()
export class SkyAppStyleLoader {
public static readonly LOAD_TIMEOUT: number = 3000;
public isLoaded: boolean = false;

public loadStyles(): Promise<any> {
const fontAwesome = new FontFaceObserver('FontAwesome');
const blackbaudSans = new FontFaceObserver('Blackbaud Sans');

return Promise
.all([
// Specify a character for FontAwesome since some browsers will fail to detect
// when the font is loaded unless a known character with a different width
// than the default is not specified.
fontAwesome.load('\uf0fc', SkyAppStyleLoader.LOAD_TIMEOUT),
blackbaudSans.load(undefined, SkyAppStyleLoader.LOAD_TIMEOUT)
])
.then(() => {
this.isLoaded = true;
})
.catch((error) => {
// Errors loading the font should not stop the page from rendering.
// Passing the error along in case the client wants to do something with it.
return Promise.resolve({
error: error
});
});
}
}
export {
SkyAppStyleLoader
} from '@skyux/theme/style-loader';
24 changes: 3 additions & 21 deletions runtime/viewport.service.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
import {
Injectable
} from '@angular/core';

import { ReplaySubject } from 'rxjs/ReplaySubject';

/**
* Provides information about the state of the application's viewport.
*/
@Injectable()
export class SkyAppViewportService {

/**
* Updated when the viewport becomes visible. While the page is rendered, the
* viewport may remain hidden as fonts and styles are loaded asynchronously;
* this is done to avoid a FOUC (Flash Of Unstyled Content) before the fonts
* and styles are ready.
*/
public visible = new ReplaySubject<boolean>(1);

}
export {
SkyAppViewportService
} from '@skyux/theme/viewport.service';
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
SkyAppWindowRef
} from '@blackbaud/skyux-builder/runtime';

require('style-loader!@blackbaud/skyux/dist/css/sky.css');
require('style-loader!@skyux/theme/css/sky.css');
require('style-loader!./app.component.scss');

let omnibarLoaded: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/skyux.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import '@blackbaud/skyux/dist/css/sky.css';
import '@skyux/theme/css/sky.css';
import '@blackbaud/skyux/dist/core';
2 changes: 1 addition & 1 deletion test/config-webpack-common.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('config webpack common', () => {
alias = config.resolve.alias;

expect(
alias['@blackbaud/skyux/dist/css/sky.css']
alias['@skyux/theme/css/sky.css']
).toBe(path.join(process.cwd(), cssPath));
});

Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"types": [
"core-js",
"node",
"jasmine",
"fontfaceobserver"
"jasmine"
],
"baseUrl": ".",
"paths": {
Expand Down
39 changes: 0 additions & 39 deletions utils/sky-style-loader.js

This file was deleted.

2 changes: 1 addition & 1 deletion utils/spec-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'use strict';

var styleLoader = require('./sky-style-loader');
const styleLoader = require('@skyux/theme/utils/node-js/style-loader');

// A race condition exists in Firefox where tests can begin before styles are loaded.
// This will ensure that styles are loaded before tests run by ensuring the style rule
Expand Down