chore: delete angular jss manager package (#2413)
This commit is contained in:
Родитель
ebcd96fd9b
Коммит
b7118e1dee
|
@ -10,7 +10,7 @@
|
|||
"private": true,
|
||||
"workspaces": {
|
||||
"packages": ["packages/*"],
|
||||
"nohoist": ["**/jest-preset-angular", "**/jest-preset-angular/**", "**/react-syntax-highlighter"]
|
||||
"nohoist": ["**/react-syntax-highlighter"]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# Tests
|
||||
__test__/
|
||||
*.spec.*
|
||||
*.test.*
|
||||
|
||||
# Source files
|
||||
src/
|
||||
|
||||
# config
|
||||
babel.config.js
|
||||
webpack.config.js
|
|
@ -1 +0,0 @@
|
|||
package-lock=false
|
|
@ -1,3 +0,0 @@
|
|||
coverage/*
|
||||
dist/*
|
||||
www/*
|
|
@ -1,371 +0,0 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [4.1.11](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.10...@microsoft/fast-jss-manager-angular@4.1.11) (2019-11-07)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.10](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.9...@microsoft/fast-jss-manager-angular@4.1.10) (2019-10-25)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.9](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.8...@microsoft/fast-jss-manager-angular@4.1.9) (2019-10-16)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.8](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.7...@microsoft/fast-jss-manager-angular@4.1.8) (2019-09-10)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.7](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.6...@microsoft/fast-jss-manager-angular@4.1.7) (2019-09-05)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.6](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.5...@microsoft/fast-jss-manager-angular@4.1.6) (2019-08-22)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.5](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.4...@microsoft/fast-jss-manager-angular@4.1.5) (2019-06-25)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.4](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.3...@microsoft/fast-jss-manager-angular@4.1.4) (2019-06-11)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.3](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.2...@microsoft/fast-jss-manager-angular@4.1.3) (2019-05-31)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.2](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.1...@microsoft/fast-jss-manager-angular@4.1.2) (2019-05-08)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.1.1](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.1.0...@microsoft/fast-jss-manager-angular@4.1.1) (2019-04-26)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [4.1.0](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.0.1...@microsoft/fast-jss-manager-angular@4.1.0) (2019-04-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* reduce dependency on peer dependencies ([#1669](https://github.com/Microsoft/fast-dna/issues/1669)) ([cc06b10](https://github.com/Microsoft/fast-dna/commit/cc06b10))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.0.1](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@4.0.0...@microsoft/fast-jss-manager-angular@4.0.1) (2019-04-09)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [4.0.0](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.13...@microsoft/fast-jss-manager-angular@4.0.0) (2019-03-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update to use esModuleInterop in the TypeScript configuration files ([#1211](https://github.com/Microsoft/fast-dna/issues/1211)) ([2ec0644](https://github.com/Microsoft/fast-dna/commit/2ec0644))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* This will affect how imports will be handled by
|
||||
consumers
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.13](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.12...@microsoft/fast-jss-manager-angular@3.0.13) (2019-03-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update jest to fix build break ([#1531](https://github.com/Microsoft/fast-dna/issues/1531)) ([73ae6de](https://github.com/Microsoft/fast-dna/commit/73ae6de))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.12](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.11...@microsoft/fast-jss-manager-angular@3.0.12) (2019-03-11)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.11](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.10...@microsoft/fast-jss-manager-angular@3.0.11) (2019-02-28)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.10](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.9...@microsoft/fast-jss-manager-angular@3.0.10) (2019-02-21)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.9](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.8...@microsoft/fast-jss-manager-angular@3.0.9) (2019-02-07)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.8](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.7...@microsoft/fast-jss-manager-angular@3.0.8) (2019-01-15)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.7](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.6...@microsoft/fast-jss-manager-angular@3.0.7) (2018-12-31)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="3.0.6"></a>
|
||||
## [3.0.6](https://github.com/Microsoft/fast-dna/compare/@microsoft/fast-jss-manager-angular@3.0.5...@microsoft/fast-jss-manager-angular@3.0.6) (2018-12-21)
|
||||
|
||||
**Note:** Version bump only for package @microsoft/fast-jss-manager-angular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.2.0"></a>
|
||||
# 2.2.0 (2018-09-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add contrast based color system ([#810](https://github.com/Microsoft/fast-dna/issues/810)) ([5ec457c](https://github.com/Microsoft/fast-dna/commit/5ec457c))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
# 2.1.0 (2018-08-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update Lerna to ^3.0.0 ([#795](https://github.com/Microsoft/fast-dna/issues/795)) ([9ce9a56](https://github.com/Microsoft/fast-dna/commit/9ce9a56))
|
||||
* upgrade to TypeScript 3.0.0 ([#793](https://github.com/Microsoft/fast-dna/issues/793)) ([e203e86](https://github.com/Microsoft/fast-dna/commit/e203e86))
|
||||
* **fast-components-react-base:** add callback to horizontal overflow to return and object that informs scroll start and end ([#797](https://github.com/Microsoft/fast-dna/issues/797)) ([37975f3](https://github.com/Microsoft/fast-dna/commit/37975f3))
|
||||
* **paragraph:** adds paragraph as a new MSFT component ([#805](https://github.com/Microsoft/fast-dna/issues/805)) ([8325d3f](https://github.com/Microsoft/fast-dna/commit/8325d3f))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-corrected"></a>
|
||||
# 2.0.0-corrected (2018-08-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix tslint globbing issue and enforce whitespace in import/export statements ([#219](https://github.com/Microsoft/fast-dna/issues/219)) ([4637a90](https://github.com/Microsoft/fast-dna/commit/4637a90))
|
||||
* travis-CI build-break ([#336](https://github.com/Microsoft/fast-dna/issues/336)) ([bffbf5e](https://github.com/Microsoft/fast-dna/commit/bffbf5e))
|
||||
* **fast-components-react-msft:** fixes error running jest with components that require chroma ([#687](https://github.com/Microsoft/fast-dna/issues/687)) ([140457c](https://github.com/Microsoft/fast-dna/commit/140457c))
|
||||
* **tslint:** fixes incorrect tslint rule regarding ordered imports ([#188](https://github.com/Microsoft/fast-dna/issues/188)) ([ebe0b30](https://github.com/Microsoft/fast-dna/commit/ebe0b30))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **angular:** add preliminary JSS manager for angular ([#140](https://github.com/Microsoft/fast-dna/issues/140)) ([0799251](https://github.com/Microsoft/fast-dna/commit/0799251))
|
||||
* **detail view:** add detail view ([#470](https://github.com/Microsoft/fast-dna/issues/470)) ([665b871](https://github.com/Microsoft/fast-dna/commit/665b871))
|
||||
* **fast-css-editor-react:** add default editor component and position component ([#636](https://github.com/Microsoft/fast-dna/issues/636)) ([72037a8](https://github.com/Microsoft/fast-dna/commit/72037a8))
|
||||
* **form generator:** updates styles found in configuration pane ([#420](https://github.com/Microsoft/fast-dna/issues/420)) ([919121b](https://github.com/Microsoft/fast-dna/commit/919121b))
|
||||
* **Image:** add new component and msft styles ([#237](https://github.com/Microsoft/fast-dna/issues/237)) ([ea057ed](https://github.com/Microsoft/fast-dna/commit/ea057ed))
|
||||
* **label:** add new component and msft styles ([#265](https://github.com/Microsoft/fast-dna/issues/265)) ([0328028](https://github.com/Microsoft/fast-dna/commit/0328028))
|
||||
* **toggle:** add new component and msft styles ([#212](https://github.com/Microsoft/fast-dna/issues/212)) ([b9dd3e0](https://github.com/Microsoft/fast-dna/commit/b9dd3e0))
|
||||
* add form generator to the packages ([#311](https://github.com/Microsoft/fast-dna/issues/311)) ([a339b3c](https://github.com/Microsoft/fast-dna/commit/a339b3c))
|
||||
* add snapshot test suite ([#207](https://github.com/Microsoft/fast-dna/issues/207)) ([7ceaafe](https://github.com/Microsoft/fast-dna/commit/7ceaafe))
|
||||
* catagorizing relevant dependencies as peerDependencies ([#186](https://github.com/Microsoft/fast-dna/issues/186)) ([7e15db6](https://github.com/Microsoft/fast-dna/commit/7e15db6))
|
||||
* remove JSS manager dependency from React base components ([#148](https://github.com/Microsoft/fast-dna/issues/148)) ([48de34a](https://github.com/Microsoft/fast-dna/commit/48de34a))
|
||||
* update code coverage on travis ([#330](https://github.com/Microsoft/fast-dna/issues/330)) ([63ab4f4](https://github.com/Microsoft/fast-dna/commit/63ab4f4))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
# [2.1.0](https://github.com/Microsoft/fast-dna/compare/v2.0.0-corrected...v2.1.0) (2018-08-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update Lerna to ^3.0.0 ([#795](https://github.com/Microsoft/fast-dna/issues/795)) ([9ce9a56](https://github.com/Microsoft/fast-dna/commit/9ce9a56))
|
||||
* upgrade to TypeScript 3.0.0 ([#793](https://github.com/Microsoft/fast-dna/issues/793)) ([e203e86](https://github.com/Microsoft/fast-dna/commit/e203e86))
|
||||
* **fast-components-react-base:** add callback to horizontal overflow to return and object that informs scroll start and end ([#797](https://github.com/Microsoft/fast-dna/issues/797)) ([37975f3](https://github.com/Microsoft/fast-dna/commit/37975f3))
|
||||
* **paragraph:** adds paragraph as a new MSFT component ([#805](https://github.com/Microsoft/fast-dna/issues/805)) ([8325d3f](https://github.com/Microsoft/fast-dna/commit/8325d3f))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
# [2.0.0](https://github.com/Microsoft/fast-dna/compare/v1.6.0...v2.0.0) (2018-08-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fast-components-react-msft:** fixes error running jest with components that require chroma ([#687](https://github.com/Microsoft/fast-dna/issues/687)) ([140457c](https://github.com/Microsoft/fast-dna/commit/140457c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **detail view:** add detail view ([#470](https://github.com/Microsoft/fast-dna/issues/470)) ([665b871](https://github.com/Microsoft/fast-dna/commit/665b871))
|
||||
* **fast-css-editor-react:** add default editor component and position component ([#636](https://github.com/Microsoft/fast-dna/issues/636)) ([72037a8](https://github.com/Microsoft/fast-dna/commit/72037a8))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.9.0"></a>
|
||||
# [1.9.0](https://github.com/Microsoft/fast-dna/compare/v1.6.0...v1.9.0) (2018-07-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fast-components-react-msft:** fixes error running jest with components that require chroma ([#687](https://github.com/Microsoft/fast-dna/issues/687)) ([140457c](https://github.com/Microsoft/fast-dna/commit/140457c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **detail view:** add detail view ([#470](https://github.com/Microsoft/fast-dna/issues/470)) ([665b871](https://github.com/Microsoft/fast-dna/commit/665b871))
|
||||
* **fast-css-editor-react:** add default editor component and position component ([#636](https://github.com/Microsoft/fast-dna/issues/636)) ([72037a8](https://github.com/Microsoft/fast-dna/commit/72037a8))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.8.0"></a>
|
||||
# [1.8.0](https://github.com/Microsoft/fast-dna/compare/v1.6.0...v1.8.0) (2018-06-12)
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.7.0"></a>
|
||||
# [1.7.0](https://github.com/Microsoft/fast-dna/compare/v1.6.0...v1.7.0) (2018-06-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **detail view:** add detail view ([#470](https://github.com/Microsoft/fast-dna/issues/470)) ([665b871](https://github.com/Microsoft/fast-dna/commit/665b871))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.6.0"></a>
|
||||
# [1.6.0](https://github.com/Microsoft/fast-dna/compare/v1.2.0...v1.6.0) (2018-05-16)
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.5.0"></a>
|
||||
# [1.5.0](https://github.com/Microsoft/fast-dna/compare/v1.2.0...v1.5.0) (2018-05-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **form generator:** updates styles found in configuration pane ([#420](https://github.com/Microsoft/fast-dna/issues/420)) ([919121b](https://github.com/Microsoft/fast-dna/commit/919121b))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
# [1.4.0](https://github.com/Microsoft/fast-dna/compare/v1.2.0...v1.4.0) (2018-05-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **form generator:** updates styles found in configuration pane ([#420](https://github.com/Microsoft/fast-dna/issues/420)) ([919121b](https://github.com/Microsoft/fast-dna/commit/919121b))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
# 1.2.0 (2018-05-10)
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# 1.1.0 (2018-05-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **tslint:** fixes incorrect tslint rule regarding ordered imports ([#188](https://github.com/Microsoft/fast-dna/issues/188)) ([ebe0b30](https://github.com/Microsoft/fast-dna/commit/ebe0b30))
|
||||
* fix tslint globbing issue and enforce whitespace in import/export statements ([#219](https://github.com/Microsoft/fast-dna/issues/219)) ([4637a90](https://github.com/Microsoft/fast-dna/commit/4637a90))
|
||||
* travis-CI build-break ([#336](https://github.com/Microsoft/fast-dna/issues/336)) ([bffbf5e](https://github.com/Microsoft/fast-dna/commit/bffbf5e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **angular:** add preliminary JSS manager for angular ([#140](https://github.com/Microsoft/fast-dna/issues/140)) ([0799251](https://github.com/Microsoft/fast-dna/commit/0799251))
|
||||
* **Image:** add new component and msft styles ([#237](https://github.com/Microsoft/fast-dna/issues/237)) ([ea057ed](https://github.com/Microsoft/fast-dna/commit/ea057ed))
|
||||
* **label:** add new component and msft styles ([#265](https://github.com/Microsoft/fast-dna/issues/265)) ([0328028](https://github.com/Microsoft/fast-dna/commit/0328028))
|
||||
* **toggle:** add new component and msft styles ([#212](https://github.com/Microsoft/fast-dna/issues/212)) ([b9dd3e0](https://github.com/Microsoft/fast-dna/commit/b9dd3e0))
|
||||
* add form generator to the packages ([#311](https://github.com/Microsoft/fast-dna/issues/311)) ([a339b3c](https://github.com/Microsoft/fast-dna/commit/a339b3c))
|
||||
* add snapshot test suite ([#207](https://github.com/Microsoft/fast-dna/issues/207)) ([7ceaafe](https://github.com/Microsoft/fast-dna/commit/7ceaafe))
|
||||
* catagorizing relevant dependencies as peerDependencies ([#186](https://github.com/Microsoft/fast-dna/issues/186)) ([7e15db6](https://github.com/Microsoft/fast-dna/commit/7e15db6))
|
||||
* remove JSS manager dependency from React base components ([#148](https://github.com/Microsoft/fast-dna/issues/148)) ([48de34a](https://github.com/Microsoft/fast-dna/commit/48de34a))
|
||||
* update code coverage on travis ([#330](https://github.com/Microsoft/fast-dna/issues/330)) ([63ab4f4](https://github.com/Microsoft/fast-dna/commit/63ab4f4))
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
# FAST JSS manager Angular
|
||||
**_This package has been deprecated and is no longer under active development_.**
|
||||
|
||||
An Angular directive and component library for managing component JSS (JavaScript Style Sheets). It allows top-down variable injection into JSS stylesheet functions using the exported `DesignSystem`.
|
||||
|
||||
## Installation
|
||||
|
||||
`npm i --save @microsoft/fast-jss-manager-angular`
|
||||
|
||||
## Usage
|
||||
|
||||
Any configuration can be passed down and will serve as a scoped configuration for its containing children. Any component making use of the design system must be constructed with these additions:
|
||||
|
||||
- The `@angular/core` `ElementRef` must be passed as a parameter in the components constructor
|
||||
- The component must pass JSS styles into the `manageJss` higher order component and use that as the styled component
|
||||
- The component must have an input named `className`
|
||||
|
||||
Example component:
|
||||
|
||||
```ts
|
||||
import { Component, ElementRef, Inject, Input } from "@angular/core";
|
||||
import manageJss from "@microsoft/fast-jss-manager-angular";
|
||||
|
||||
@Component({
|
||||
selector: "example",
|
||||
template: `<span [class]="className"><ng-content></ng-content></span>`
|
||||
})
|
||||
class ExampleComponent {
|
||||
@Input() private className: string;
|
||||
|
||||
constructor(@Inject(ElementRef) private el: ElementRef) { }
|
||||
}
|
||||
|
||||
const styles: any = {
|
||||
example: {
|
||||
color: (config: any): string => {
|
||||
return config.color;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const StyledExampleComponent: any = manageJss(styles)(ExampleComponent);
|
||||
|
||||
export default StyledExampleComponent;
|
||||
```
|
||||
|
||||
Implementation of the example component in the application:
|
||||
|
||||
```html
|
||||
<design-system [config]="{color: 'red'}">
|
||||
<example>Hello world</example>
|
||||
</design-system>
|
||||
```
|
|
@ -1,39 +0,0 @@
|
|||
import { Component } from "@angular/core";
|
||||
|
||||
export interface DesignSystem {
|
||||
red: any;
|
||||
blue: any;
|
||||
purple: any;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: "app-root",
|
||||
template: `<div>
|
||||
<design-system [config]="config.red">
|
||||
<example>red</example>
|
||||
</design-system>
|
||||
<design-system [config]="config.blue">
|
||||
<example>blue</example>
|
||||
<design-system [config]="config.purple">
|
||||
<example>purple</example>
|
||||
</design-system>
|
||||
</design-system>
|
||||
</div>`,
|
||||
})
|
||||
export class AppComponent {
|
||||
private config: DesignSystem;
|
||||
|
||||
constructor() {
|
||||
this.config = {
|
||||
red: {
|
||||
color: "red",
|
||||
},
|
||||
blue: {
|
||||
color: "blue",
|
||||
},
|
||||
purple: {
|
||||
color: "purple",
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
import { BrowserModule } from "@angular/platform-browser";
|
||||
import { NgModule } from "@angular/core";
|
||||
import { AppComponent } from "./app.component";
|
||||
import ExampleComponent from "./components/example.component";
|
||||
import { DesignSystemModule } from "../src/design-system.module";
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent, ExampleComponent],
|
||||
imports: [BrowserModule, DesignSystemModule],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule {}
|
|
@ -1,26 +0,0 @@
|
|||
import { Component, ElementRef, Inject, Input } from "@angular/core";
|
||||
import manageJss from "../../src";
|
||||
|
||||
@Component({
|
||||
selector: "example",
|
||||
template: `<span [class]="className"><ng-content></ng-content></span>`,
|
||||
})
|
||||
class ExampleComponent {
|
||||
@Input()
|
||||
private className: string;
|
||||
|
||||
constructor(@Inject(ElementRef) private el: ElementRef) {}
|
||||
}
|
||||
|
||||
const styles: any = {
|
||||
example: {
|
||||
color: (config: any): string => {
|
||||
return config.color;
|
||||
},
|
||||
background: "yellow",
|
||||
},
|
||||
};
|
||||
|
||||
const JSSComponent: any = manageJss(styles)(ExampleComponent);
|
||||
|
||||
export default JSSComponent;
|
|
@ -1,10 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +0,0 @@
|
|||
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
|
||||
import { AppModule } from "./app.module";
|
||||
|
||||
/* tslint:disable-next-line */
|
||||
const Polyfills: any = require("./polyfills");
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
|
@ -1,61 +0,0 @@
|
|||
/* tslint:disable */
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
// import 'core-js/es6/parse-int';
|
||||
// import 'core-js/es6/parse-float';
|
||||
// import 'core-js/es6/number';
|
||||
// import 'core-js/es6/math';
|
||||
// import 'core-js/es6/string';
|
||||
// import 'core-js/es6/date';
|
||||
// import 'core-js/es6/array';
|
||||
// import 'core-js/es6/regexp';
|
||||
// import 'core-js/es6/map';
|
||||
// import 'core-js/es6/weak-map';
|
||||
// import 'core-js/es6/set';
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `yarn add --dev classlist.js`.
|
||||
|
||||
/** IE10 and IE11 requires the following for the Reflect API. */
|
||||
// import 'core-js/es6/reflect';
|
||||
|
||||
/** Evergreen browsers require these. **/
|
||||
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
||||
import "core-js/es7/reflect";
|
||||
|
||||
/**
|
||||
* Required to support Web Animations `@angular/platform-browser/animations`.
|
||||
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
|
||||
**/
|
||||
// import 'web-animations-js';
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import "zone.js/dist/zone"; // Included with Angular CLI.
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
|
@ -1,11 +0,0 @@
|
|||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
const mock = () => {
|
||||
let storage = {};
|
||||
|
||||
return {
|
||||
getItem: key => (key in storage ? storage[key] : null),
|
||||
setItem: (key, value) => (storage[key] = value || ""),
|
||||
removeItem: key => delete storage[key],
|
||||
clear: () => (storage = {}),
|
||||
};
|
||||
};
|
||||
|
||||
Object.defineProperty(window, "localStorage", { value: mock() });
|
||||
Object.defineProperty(window, "sessionStorage", { value: mock() });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
value: () => ["-webkit-appearance"],
|
||||
});
|
|
@ -1,2 +0,0 @@
|
|||
import "jest-preset-angular";
|
||||
import "./jest-global-mocks";
|
|
@ -1,27 +0,0 @@
|
|||
const watch = require("watch");
|
||||
const path = require("path");
|
||||
const spawn = require("child_process").spawn;
|
||||
|
||||
function success(str) {
|
||||
console.log("\x1b[32m%s\x1b[0m", str);
|
||||
}
|
||||
|
||||
function clearConsole() {
|
||||
console.log('\033[2J')
|
||||
}
|
||||
|
||||
watch.watchTree(path.resolve(__dirname, "../src"), (modifiedFile, currentStat, previousStat) => {
|
||||
clearConsole();
|
||||
if (typeof modifiedFile === "object" && currentStat === null && previousStat === null) {
|
||||
success("Watching for typescript changes");
|
||||
} else if (/\.tsx?$/.test(modifiedFile)) {
|
||||
spawn("npm", ["run", "lint"], { stdio: "inherit" })
|
||||
.on("exit", (error) => {
|
||||
if (error && error.code === 1) {
|
||||
throw error;
|
||||
} else if (error === 0) {
|
||||
success("Typescript successfully linted with no errors found.\nWatching for changes...");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,108 +0,0 @@
|
|||
{
|
||||
"name": "@microsoft/fast-jss-manager-angular",
|
||||
"description": "Angular directive and component for managing component JSS stylesheets",
|
||||
"sideEffects": false,
|
||||
"version": "4.1.11",
|
||||
"author": {
|
||||
"name": "Microsoft",
|
||||
"url": "https://discord.gg/FcSNfg4"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Microsoft/fast-dna.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/fast-dna/issues/new/choose"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc -p ./tsconfig.build.json",
|
||||
"clean:dist": "node ../../build/clean.js dist",
|
||||
"prepare": "yarn clean:dist && yarn build",
|
||||
"prettier": "prettier --config ../../.prettierrc --write \"**/*.ts\"",
|
||||
"prettier:diff": "prettier --config ../../.prettierrc \"**/*.ts\" --list-different",
|
||||
"start": "webpack-dev-server --progress",
|
||||
"test": "yarn tslint && yarn unit-tests",
|
||||
"tslint": "tslint -c ./tslint.json '**/*.ts'",
|
||||
"tslint:fix": "tslint -c ./tslint.json --fix '**/*.ts'",
|
||||
"tslint:watch": "node build/tslint-watch.js",
|
||||
"unit-tests": "jest --runInBand",
|
||||
"unit-tests:watch": "jest --watch",
|
||||
"watch": "yarn build -- -w --preserveWatchOutput"
|
||||
},
|
||||
"jest": {
|
||||
"collectCoverage": true,
|
||||
"coverageThreshold": {
|
||||
"global": {
|
||||
"statements": 40,
|
||||
"branches": 0,
|
||||
"functions": 20,
|
||||
"lines": 39
|
||||
}
|
||||
},
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"js"
|
||||
],
|
||||
"preset": "jest-preset-angular",
|
||||
"setupFilesAfterEnv": [
|
||||
"./build/setup-jest.ts"
|
||||
],
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"/dist/"
|
||||
],
|
||||
"testURL": "http://localhost",
|
||||
"transform": {
|
||||
"^.+\\.ts$": "ts-jest",
|
||||
"^.+\\.js?$": "babel-jest"
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules/(?!@ngrx|lodash-es)"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/common": "^5.2.0",
|
||||
"@angular/compiler": "^5.2.9",
|
||||
"@angular/core": "^5.2.0",
|
||||
"@angular/platform-browser": "^5.2.9",
|
||||
"@angular/platform-browser-dynamic": "^5.2.9",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"@microsoft/fast-tslint-rules": "^3.0.4",
|
||||
"@types/jest": "^24.0.11",
|
||||
"@types/lodash-es": "^4.17.0",
|
||||
"@types/node": "^9.4.6",
|
||||
"babel-jest": "^24.5.0",
|
||||
"core-js": "^2.4.1",
|
||||
"fork-ts-checker-webpack-plugin": "^0.4.2",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"jest": "^24.5.0",
|
||||
"jest-preset-angular": "^5.2.1",
|
||||
"lodash-es": "^4.0.0",
|
||||
"prettier": "1.14.3",
|
||||
"ts-jest": "^24.0.0",
|
||||
"ts-loader": "^4.4.1",
|
||||
"tslint": "^5.9.1",
|
||||
"tslint-config-prettier": "^1.15.0",
|
||||
"typescript": "3.3.3",
|
||||
"watch": "^1.0.2",
|
||||
"webpack": "^4.12.0",
|
||||
"webpack-cli": "^3.0.8",
|
||||
"webpack-dev-server": "^3.1.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^5.2.0",
|
||||
"@angular/core": "^5.2.0",
|
||||
"lodash-es": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/fast-jss-manager": "^4.1.9",
|
||||
"core-js": "^2.4.1",
|
||||
"jss": "^9.8.0",
|
||||
"jss-preset-default": "^4.3.0",
|
||||
"rxjs": "^5.5.6",
|
||||
"zone.js": "^0.8.19"
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
import { Directive, ElementRef, Inject, Input, SimpleChanges } from "@angular/core";
|
||||
import { eventNames } from "./utilities/get-event-names";
|
||||
|
||||
/**
|
||||
* This directive stores and manages custom events requesting the design system configuration
|
||||
*/
|
||||
@Directive({
|
||||
selector: "design-system",
|
||||
})
|
||||
export class DesignSystemDirective {
|
||||
@Input()
|
||||
private config: any;
|
||||
|
||||
private el: HTMLElement;
|
||||
private children: EventTarget[];
|
||||
|
||||
constructor(@Inject(ElementRef) private hostElement: ElementRef) {
|
||||
this.el = hostElement.nativeElement;
|
||||
this.children = [];
|
||||
|
||||
this.el.addEventListener(eventNames.getConfig, this.handleGetConfig, true);
|
||||
this.el.addEventListener(
|
||||
eventNames.registerComponent,
|
||||
this.handleRegisterComponent,
|
||||
true
|
||||
);
|
||||
this.el.addEventListener(
|
||||
eventNames.deregisterComponent,
|
||||
this.handleDeregisterComponent,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
public ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes.config.currentValue !== changes.config.previousValue) {
|
||||
const event: CustomEvent = new CustomEvent(eventNames.update);
|
||||
|
||||
this.children.forEach((child: EventTarget) => {
|
||||
child.dispatchEvent(event);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
this.el.removeEventListener(eventNames.getConfig, this.handleGetConfig, true);
|
||||
this.el.removeEventListener(
|
||||
eventNames.registerComponent,
|
||||
this.handleRegisterComponent,
|
||||
true
|
||||
);
|
||||
this.el.removeEventListener(
|
||||
eventNames.deregisterComponent,
|
||||
this.handleDeregisterComponent,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles merging the event details with the config given to the directive
|
||||
*/
|
||||
private handleGetConfig = (e: CustomEvent): void => {
|
||||
Object.assign(e.detail, this.config);
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles registering the component with the design system directive
|
||||
*/
|
||||
private handleRegisterComponent = (e: CustomEvent): void => {
|
||||
this.children.push(e.target);
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles de-registering the component with the design system directive
|
||||
*/
|
||||
private handleDeregisterComponent = (e: CustomEvent): void => {
|
||||
this.children.filter((child: EventTarget) => child !== e.target);
|
||||
};
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
import { NgModule } from "@angular/core";
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { DesignSystemDirective } from "./design-system.directive";
|
||||
|
||||
@NgModule({
|
||||
declarations: [DesignSystemDirective],
|
||||
imports: [CommonModule],
|
||||
exports: [DesignSystemDirective],
|
||||
})
|
||||
export class DesignSystemModule {}
|
|
@ -1,4 +0,0 @@
|
|||
import manageJss from "./manage-jss";
|
||||
|
||||
export default manageJss;
|
||||
export * from "./manage-jss";
|
|
@ -1,8 +0,0 @@
|
|||
import JSS, { create, SheetsManager } from "jss";
|
||||
import presets from "jss-preset-default";
|
||||
|
||||
const jss: JSS = create(presets());
|
||||
const stylesheetManager: SheetsManager = new SheetsManager();
|
||||
|
||||
export default jss;
|
||||
export { stylesheetManager };
|
|
@ -1,63 +0,0 @@
|
|||
import { Component, ElementRef, Input } from "@angular/core";
|
||||
import { async, TestBed } from "@angular/core/testing";
|
||||
import manageJss from "./manage-jss";
|
||||
import { DesignSystemDirective } from "./design-system.directive";
|
||||
|
||||
/**
|
||||
* Component definition
|
||||
*/
|
||||
@Component({
|
||||
selector: "example-with-directive",
|
||||
template: `<design-system config="{color: 'red'}"><span [class]="className || ''">{{ text }}</span></design-system>`,
|
||||
})
|
||||
|
||||
/**
|
||||
* Class definition
|
||||
*/
|
||||
class SimpleDirectiveComponent {
|
||||
@Input()
|
||||
private className: string;
|
||||
@Input()
|
||||
private text: string;
|
||||
|
||||
constructor(private el: ElementRef) {}
|
||||
}
|
||||
|
||||
const styles: any = {
|
||||
example: {
|
||||
color: (config: any): string => {
|
||||
return config.color;
|
||||
},
|
||||
fontWeight: (config: any): string => {
|
||||
return config.weight;
|
||||
},
|
||||
background: "yellow",
|
||||
},
|
||||
};
|
||||
|
||||
const JSSComponent: any = manageJss(styles)(SimpleDirectiveComponent);
|
||||
|
||||
describe("The return value of manage JSS", (): void => {
|
||||
test("should return a function", (): void => {
|
||||
expect(typeof manageJss()).toBe("function");
|
||||
});
|
||||
|
||||
test("should return a function that returns a function", (): void => {
|
||||
expect(typeof manageJss()(SimpleDirectiveComponent)).toBe("function");
|
||||
});
|
||||
});
|
||||
|
||||
describe("The directive", (): void => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [DesignSystemDirective, JSSComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it("should create a component wrapped with the directive", async(() => {
|
||||
const fixture: any = TestBed.createComponent(JSSComponent);
|
||||
const directiveComponent: any = fixture.debugElement.componentInstance;
|
||||
|
||||
expect(directiveComponent).toBeTruthy();
|
||||
}));
|
||||
});
|
|
@ -1,157 +0,0 @@
|
|||
import { Component, ElementRef, Input, SimpleChanges } from "@angular/core";
|
||||
import { SheetsManager } from "jss";
|
||||
import { ComponentStyles } from "@microsoft/fast-jss-manager";
|
||||
import { eventNames } from "./utilities/get-event-names";
|
||||
import jss, { stylesheetManager } from "./jss-instance";
|
||||
|
||||
/**
|
||||
* State interface for JSS manager
|
||||
*/
|
||||
export interface JSSManagerState {
|
||||
/**
|
||||
* Stores a JSS stylesheet containing all style rules for a component
|
||||
*/
|
||||
styleSheet?: any;
|
||||
}
|
||||
|
||||
function manageJss<S, C>(styles?: ComponentStyles<S, C>): <T>(BaseComponent: any) => any {
|
||||
return function(BaseComponent: any): any {
|
||||
class JSSManager extends BaseComponent {
|
||||
/**
|
||||
* The style manager is responsible for attaching and detaching style elements when
|
||||
* components mount and un-mount
|
||||
*/
|
||||
private static stylesheetManager: SheetsManager = stylesheetManager;
|
||||
|
||||
/**
|
||||
* The HTML class names as determined by the static and dymanic styles
|
||||
*/
|
||||
private className: string;
|
||||
|
||||
/**
|
||||
* The JSS managers state object
|
||||
*/
|
||||
private state: any;
|
||||
|
||||
private ngOnInit(): void {
|
||||
if (super.ngOnInit) {
|
||||
super.ngOnInit();
|
||||
}
|
||||
|
||||
this.state = {};
|
||||
|
||||
this.el.nativeElement.addEventListener(
|
||||
eventNames.getConfig,
|
||||
(e: CustomEvent) => {
|
||||
this.config = e.detail;
|
||||
|
||||
if (this.state.styleSheet) {
|
||||
this.state.styleSheet.update(this.designSystem);
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
const registerComponentEvent: CustomEvent = new CustomEvent(
|
||||
eventNames.registerComponent
|
||||
);
|
||||
this.el.nativeElement.dispatchEvent(registerComponentEvent);
|
||||
|
||||
const updateStylesEvent: CustomEvent = new CustomEvent(
|
||||
eventNames.getConfig,
|
||||
{ detail: {} }
|
||||
);
|
||||
this.el.nativeElement.dispatchEvent(updateStylesEvent);
|
||||
|
||||
this.el.nativeElement.addEventListener(
|
||||
eventNames.update,
|
||||
(e: CustomEvent) => {
|
||||
this.el.nativeElement.dispatchEvent(updateStylesEvent);
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
private ngAfterContentInit(): void {
|
||||
if (super.ngAfterContentInit) {
|
||||
super.ngAfterContentInit();
|
||||
}
|
||||
|
||||
const state: JSSManagerState = {};
|
||||
|
||||
if (Boolean(styles)) {
|
||||
state.styleSheet = jss.createStyleSheet(styles, {
|
||||
link: true,
|
||||
});
|
||||
}
|
||||
|
||||
this.state = state;
|
||||
|
||||
this.className = this.getClassNames()[Object.keys(styles)[0] as any];
|
||||
}
|
||||
|
||||
private ngAfterViewInit(): void {
|
||||
if (super.ngAfterViewInit) {
|
||||
super.ngAfterViewInit();
|
||||
}
|
||||
|
||||
if (Boolean(this.state.styleSheet)) {
|
||||
// It appears we need to update the stylesheet for any style properties defined as functions
|
||||
// to work.
|
||||
this.state.styleSheet.attach().update(this.designSystem);
|
||||
}
|
||||
}
|
||||
|
||||
private ngOnDestroy(): void {
|
||||
if (this.hasStyleSheet()) {
|
||||
this.state.styleSheet.detach();
|
||||
jss.removeStyleSheet(this.state.styleSheet);
|
||||
}
|
||||
|
||||
const deregisterComponentEvent: CustomEvent = new CustomEvent(
|
||||
eventNames.deregisterComponent
|
||||
);
|
||||
this.el.nativeElement.dispatchEvent(deregisterComponentEvent);
|
||||
}
|
||||
|
||||
private get designSystem(): any {
|
||||
return this.config ? this.config : {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if this component has an associated dynamic stylesheet
|
||||
*/
|
||||
private hasStyleSheet(): boolean {
|
||||
return Boolean(this.state.styleSheet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges static and dynamic stylesheet classnames into one object
|
||||
*/
|
||||
private getClassNames(): { [className in keyof S]?: string } {
|
||||
const classNames: Partial<{ [className in keyof S]?: string }> = {};
|
||||
|
||||
if (this.hasStyleSheet()) {
|
||||
for (const key in this.state.styleSheet.classes) {
|
||||
if (
|
||||
this.state.styleSheet.classes.hasOwnProperty(key as keyof S)
|
||||
) {
|
||||
classNames[key as keyof S] =
|
||||
typeof classNames[key as keyof S] !== "undefined"
|
||||
? `${classNames[key as keyof S]} ${
|
||||
this.state.styleSheet.classes[key as keyof S]
|
||||
}`
|
||||
: this.state.styleSheet.classes[key as keyof S];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return classNames as { [className in keyof S]?: string };
|
||||
}
|
||||
}
|
||||
|
||||
return JSSManager;
|
||||
};
|
||||
}
|
||||
|
||||
export default manageJss;
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"baseUrl": "./",
|
||||
"emitDecoratorMetadata": true,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"**/dist/**"
|
||||
]
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
export interface EventNames {
|
||||
getConfig: string;
|
||||
update: string;
|
||||
registerComponent: string;
|
||||
deregisterComponent: string;
|
||||
}
|
||||
|
||||
export const eventNames: EventNames = {
|
||||
getConfig: "design-system-get-config",
|
||||
update: "design-system-update",
|
||||
registerComponent: "design-system-register-component",
|
||||
deregisterComponent: "design-system-deregister-component",
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"**/*.spec.*"
|
||||
]
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"outDir": "./dist",
|
||||
"experimentalDecorators": true,
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"extends": [
|
||||
"@microsoft/fast-tslint-rules",
|
||||
"tslint-config-prettier"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"linterOptions": {
|
||||
"exclude": [
|
||||
"node_modules/**",
|
||||
"build/**",
|
||||
"dist/**"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
|
||||
const appDir = path.resolve(__dirname, "./app");
|
||||
const outDir = path.resolve(__dirname, "./www");
|
||||
|
||||
module.exports = {
|
||||
devtool: "inline-source-map",
|
||||
entry: path.resolve(appDir, "index.ts"),
|
||||
output: {
|
||||
path: outDir,
|
||||
publicPath: "/",
|
||||
filename: "[name].js"
|
||||
},
|
||||
mode: process.env.NODE_ENV || "development",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /.ts$/,
|
||||
use: [
|
||||
{
|
||||
loader: "ts-loader",
|
||||
options: {
|
||||
transpileOnly: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new ForkTsCheckerWebpackPlugin({
|
||||
tslint: path.resolve(__dirname, "../../tslint.json")
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
title: "Angular JSS Manager example",
|
||||
template: path.resolve(__dirname, "./app/index.html"),
|
||||
contentBase: outDir,
|
||||
}),
|
||||
new webpack.ContextReplacementPlugin(
|
||||
/\@angular(\\|\/)core(\\|\/)esm5/, path.join(__dirname, './app')
|
||||
)
|
||||
],
|
||||
resolve: {
|
||||
extensions: [".js", ".ts", ".json"],
|
||||
alias: {
|
||||
fbjs: path.resolve('./node_modules/fbjs'),
|
||||
'lodash-es': path.resolve('./node_modules/lodash-es')
|
||||
}
|
||||
},
|
||||
devServer: {
|
||||
compress: false,
|
||||
historyApiFallback: true,
|
||||
open: true,
|
||||
overlay: true,
|
||||
port: 7005
|
||||
}
|
||||
}
|
631
yarn.lock
631
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче