-
-
Save MaximBalaganskiy/154401783b83d0cfe77a2c8f5e132958 to your computer and use it in GitHub Desktop.
mdc-list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dumber Gist</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | |
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet"> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | |
<base href="/"> | |
</head> | |
<!-- | |
Dumber gist uses dumber bundler, the default bundle file | |
is /dist/entry-bundle.js. | |
The starting module is pointed to aurelia-bootstrapper | |
(data-main attribute on script) for Aurelia, | |
The aurelia bootstrapper then loads up user module "main" | |
(aurelia-app attribute on <body>) which is your src/main.ts. | |
--> | |
<body aurelia-app="main" class="mdc-typography"> | |
<script src="/dist/entry-bundle.js" data-main="aurelia-bootstrapper"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"aurelia-bootstrapper": "^2.3.3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="@material/textfield/dist/mdc.textfield.css"></require> | |
<require from="./parent"></require> | |
<parent></parent> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
public message: string = 'Hello Aurelia MDC!'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<mdc-text-field value.bind="internalValue"></mdc-text-field> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { inject, useView, PLATFORM } from 'aurelia-framework'; | |
@useView(PLATFORM.moduleName('./datepicker.html')) | |
@inject(Element) | |
export class Datepicker { | |
constructor(private element: Element){ | |
const viewModel = this; | |
Object.defineProperties(element, { | |
value: { | |
get(this: Element) { | |
return viewModel.value; | |
}, | |
set(this: Element, value: string) { | |
viewModel.value = value; | |
}, | |
configurable: true | |
} | |
}); | |
} | |
internalValue: string; | |
get value(): string { | |
return this.internalValue; | |
} | |
set value(v: string) { | |
this.internalValue = v; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Aurelia, PLATFORM, ValueAttributeObserver, EventSubscriber, bindingMode} from 'aurelia-framework'; | |
import { MdcComponentAdapters } from '@aurelia-mdc-web/base'; | |
export function configure(aurelia: Aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging('info') | |
.plugin(PLATFORM.moduleName('@aurelia-mdc-web/all')); | |
aurelia.start().then(() => aurelia.setRoot()); | |
aurelia.container.get(MdcComponentAdapters).registerMdcElementConfig({ | |
tagName: 'datepicker', | |
properties: { | |
value: { | |
defaultBindingMode: bindingMode.twoWay, | |
getObserver(element: Element) { | |
return new ValueAttributeObserver(element, 'value', new EventSubscriber(['change', 'input'])); | |
} | |
} | |
} | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./datepicker"></require> | |
<datepicker value.bind="testValue"></datepicker> | |
<span>${testValue}</span> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Parent {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment