Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 2a8732b

Browse files
committed
chore(package): Publish Angular MDC v1.0.0
1 parent 15f8a31 commit 2a8732b

File tree

23 files changed

+88
-78
lines changed

23 files changed

+88
-78
lines changed

demos/angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"index": "src/index.html",
2222
"main": "src/main.ts",
2323
"polyfills": "src/polyfills.ts",
24-
"tsConfig": "tsconfig.json",
24+
"tsConfig": "src/tsconfig.app.json",
2525
"assets": [
2626
"src/favicon.png",
2727
"src/assets"

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "https://github.com/trimox/angular-mdc-web.git"
99
},
1010
"license": "MIT",
11-
"version": "0.44.0",
11+
"version": "1.0.0",
1212
"engines": {
1313
"node": ">= 9.11.1"
1414
},
@@ -72,11 +72,11 @@
7272
"karma-webpack": "^3.0.5",
7373
"magic-string": "^0.25.2",
7474
"node-sass": "^4.9.2",
75-
"rollup": "^1.8.0",
75+
"rollup": "^1.10.0",
7676
"rollup-plugin-alias": "^1.5.1",
7777
"rollup-plugin-babel": "^4.3.2",
7878
"rollup-plugin-commonjs": "^9.3.4",
79-
"rollup-plugin-node-resolve": "^4.0.1",
79+
"rollup-plugin-node-resolve": "^4.2.3",
8080
"run-sequence": "^2.2.1",
8181
"sorcery": "^0.10.0",
8282
"stylelint": "^9.10.1",

packages/base/foundation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @dynamic
12
export class MDCFoundation<AdapterType extends {} = {}> {
23
static get cssClasses(): { [key: string]: string } {
34
// Classes extending MDCFoundation should implement this method to return an object which exports every

packages/chips/chip.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
import { fromEvent, Subject } from 'rxjs';
2525
import { takeUntil } from 'rxjs/operators';
2626

27+
import { MDCComponent } from '@angular-mdc/web/base';
2728
import {
2829
toBoolean,
2930
Platform
@@ -37,7 +38,10 @@ import {
3738
} from '@angular-mdc/web/icon';
3839

3940
import { cssClasses } from '@material/chips/chip/constants';
40-
import { MDCChipFoundation } from '@material/chips/chip';
41+
import {
42+
MDCChipAdapter,
43+
MDCChipFoundation
44+
} from '@material/chips/chip';
4145

4246
export interface MdcChipInteractionEvent {
4347
detail: {
@@ -129,7 +133,7 @@ export class MdcChipText {
129133
changeDetection: ChangeDetectionStrategy.OnPush,
130134
providers: [MdcRipple]
131135
})
132-
export class MdcChip implements AfterViewInit, OnDestroy {
136+
export class MdcChip extends MDCComponent<any> implements AfterViewInit, OnDestroy {
133137
/** Emits whenever the component is destroyed. */
134138
private _destroyed = new Subject<void>();
135139

@@ -248,8 +252,8 @@ export class MdcChip implements AfterViewInit, OnDestroy {
248252
@ContentChild(MdcChipCheckmark) _checkmark?: MdcChipCheckmark;
249253
@ContentChildren(forwardRef(() => MdcChipIcon), { descendants: true }) _icons!: QueryList<MdcChipIcon>;
250254

251-
private _createAdapter() {
252-
return {
255+
getDefaultFoundation() {
256+
const adapter: MDCChipAdapter = {
253257
addClass: (className: string) => this._getHostElement().classList.add(className),
254258
removeClass: (className: string) => this._getHostElement().classList.remove(className),
255259
hasClass: (className: string) => this._getHostElement().classList.contains(className),
@@ -265,10 +269,11 @@ export class MdcChip implements AfterViewInit, OnDestroy {
265269
},
266270
eventTargetHasClass: (target: HTMLElement, className: string) => target.classList.contains(className),
267271
notifyInteraction: () => this._emitSelectionChangeEvent(true),
272+
notifySelection: () => { },
268273
notifyTrailingIconInteraction: () => this.trailingIconInteraction.emit({ detail: { chipId: this.id } }),
269274
notifyRemoval: () => this.removed.emit({ detail: { chipId: this.id, root: this } }),
270275
getComputedStyleValue: (propertyName: string) => {
271-
if (!this._platform.isBrowser) { return; }
276+
if (!this._platform.isBrowser) { return ''; }
272277
return window.getComputedStyle(this._getHostElement()).getPropertyValue(propertyName);
273278
},
274279
setStyleProperty: (propertyName: string, value: string) =>
@@ -278,26 +283,18 @@ export class MdcChip implements AfterViewInit, OnDestroy {
278283
getCheckmarkBoundingClientRect: () => this._checkmark ?
279284
this._checkmark.elementRef.nativeElement.getBoundingClientRect() : null
280285
};
286+
return new MDCChipFoundation(adapter);
281287
}
282288

283-
private _foundation: {
284-
init(): void,
285-
destroy(): void,
286-
setSelected(selected: boolean): void,
287-
setShouldRemoveOnTrailingIconClick(shouldRemove: boolean): void,
288-
handleInteraction(evt: KeyboardEvent | MouseEvent): void,
289-
handleTransitionEnd(evt: TransitionEvent): void,
290-
handleTrailingIconInteraction(evt: KeyboardEvent | MouseEvent): void,
291-
getDimensions(): ClientRect
292-
} = new MDCChipFoundation(this._createAdapter());
293-
294289
constructor(
295290
private _platform: Platform,
296291
private _ngZone: NgZone,
297292
private _changeDetectorRef: ChangeDetectorRef,
298293
private _ripple: MdcRipple,
299294
public elementRef: ElementRef<HTMLElement>,
300-
@Optional() @Inject(MDC_CHIPSET_PARENT_COMPONENT) private _parent: MdcChipSetParentComponent) { }
295+
@Optional() @Inject(MDC_CHIPSET_PARENT_COMPONENT) private _parent: MdcChipSetParentComponent) {
296+
super(elementRef);
297+
}
301298

302299
ngAfterViewInit(): void {
303300
this._foundation.init();

packages/drawer/drawer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import createFocusTrap, { FocusTrap } from 'focus-trap';
2424
import {
2525
MDCDismissibleDrawerFoundation,
2626
MDCModalDrawerFoundation
27-
} from '@material/drawer/index';
27+
} from '@material/drawer';
2828

2929
export type MdcDrawerType = 'permanent' | 'dismissible' | 'modal';
3030

packages/floating-label/floating-label.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { fromEvent, Subject } from 'rxjs';
1010
import { filter, takeUntil } from 'rxjs/operators';
1111

1212
import { MDCComponent } from '@angular-mdc/web/base';
13-
import { MDCFloatingLabelFoundation } from '@material/floating-label/index';
13+
import { MDCFloatingLabelFoundation } from '@material/floating-label';
1414

1515
@Directive({
1616
selector: 'label[mdcFloatingLabel], mdc-floating-label',

packages/icon-button/icon-button.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { toBoolean } from '@angular-mdc/web/common';
2323
import { MdcRipple } from '@angular-mdc/web/ripple';
2424
import { MdcIcon } from '@angular-mdc/web/icon';
2525

26-
import { MDCIconButtonToggleFoundation } from '@material/icon-button/index';
26+
import { MDCIconButtonToggleFoundation } from '@material/icon-button';
2727

2828
export const MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR: Provider = {
2929
provide: NG_VALUE_ACCESSOR,

packages/line-ripple/line-ripple.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { fromEvent, Subject } from 'rxjs';
99
import { filter, takeUntil } from 'rxjs/operators';
1010

11-
import { MDCLineRippleFoundation } from '@material/line-ripple/index';
11+
import { MDCLineRippleFoundation } from '@material/line-ripple';
1212

1313
@Directive({
1414
selector: '[mdcLineRipple], mdc-line-ripple',

packages/linear-progress/linear-progress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { MDCComponent } from '@angular-mdc/web/base';
1111
import { toBoolean, toNumber } from '@angular-mdc/web/common';
1212

13-
import { MDCLinearProgressFoundation, MDCLinearProgressAdapter } from '@material/linear-progress/index';
13+
import { MDCLinearProgressFoundation, MDCLinearProgressAdapter } from '@material/linear-progress';
1414

1515
@Component({
1616
moduleId: module.id,

packages/list/list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import { toBoolean, Platform } from '@angular-mdc/web/common';
2222
import { MdcListItem, MdcListSelectionChange, MDC_LIST_PARENT_COMPONENT } from './list-item';
2323

2424
import { cssClasses, strings } from '@material/list/constants';
25-
import { ponyfill } from '@material/dom/index';
26-
import { MDCListFoundation, MDCListAdapter } from '@material/list/index';
25+
import { ponyfill } from '@material/dom';
26+
import { MDCListFoundation, MDCListAdapter } from '@material/list';
2727

2828
/** Change event that is being fired whenever the selected state of an option changes. */
2929
export class MdcListItemChange {

0 commit comments

Comments
 (0)