Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add ability to override style building #884

Merged
merged 3 commits into from
Nov 14, 2018
Merged

Conversation

CaerusKaru
Copy link
Member

@CaerusKaru CaerusKaru commented Nov 11, 2018

This change decouples the style-generation from the actual directives, meaning that the library is now composed of the following:

  • Directives that respond to inputs and matchMedia events
  • Style generation providers that return styles when triggered by directives

This allows for end-users or library authors to provide their own unique style generation (even by borrowing or extending our existing library code) for any directive. This is entirely non-mandatory for use of the BaseDirective, since the BaseDirective need not always use a de-coupled style provider to function.

The canonical example is the following:

@Injectable()
export class CustomStyleBuilder extends StyleBuilder {
  buildStyles(input: string) {
	return {
		'style1': 'value1',
	};
  }
}

@NgModule({
	...
	providers: [
		provide: <the style builder to orverride, e.g. FlexStyleBuilder>,
		useClass: CustomStyleBuilder,
	],
})
export class MyAppModule {}

Fixes #689

@CaerusKaru
Copy link
Member Author

Needs rebase before merge

@CaerusKaru CaerusKaru added pr: merge ready This PR is ready for the caretaker to presubmit and merge pr: merge safe The caretaker can merge this PR without doing a presubmit and removed pr: blocked labels Nov 14, 2018
@CaerusKaru CaerusKaru merged commit 9148e87 into master Nov 14, 2018
@CaerusKaru CaerusKaru deleted the adam/defaults branch November 14, 2018 01:03
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes pr: lgtm This PR has been approved by the reviewer pr: merge ready This PR is ready for the caretaker to presubmit and merge pr: merge safe The caretaker can merge this PR without doing a presubmit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

poll: what should be the default behavior for fxFlex?
2 participants