Editor's Draft – 6 June 2025
Status: This document is an unofficial editor's draft. It has no formal standing within the W3C. It is published for discussion and early feedback.
| // You can access React utilities as props of React object. | |
| // For example: `React.useRef()` | |
| interface CheckboxProps { | |
| value?: boolean; | |
| defaultValue?: boolean; | |
| onChange?: (newValue: boolean) => void; | |
| } | |
| function Checkbox({ value, defaultValue, onChange }: CheckboxProps) { |
| TRANSLITE_DICT = {"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"","б":"b","ю":"yu"}; | |
| transliterate = function(word){ | |
| return word.split('').map(function(char){ | |
| return typeof TRANSLITE_DICT[char] !== 'undefined' ? TRANSLITE_DICT[char] : char; | |
| }).join("").replace(/\s/g, '-').toLowerCase().replace(/[^\w^-]/gi, ''); | |
| }; |
| import classNames from 'classnames'; | |
| // modName -> mod_name | |
| function toKebabCase(str) { | |
| return str ? str.replace(/[A-Z]/g, function(s) {return '-' + s.toLowerCase() }).replace(/$\-/, '') : ''; | |
| } | |
| function BEM(blockName) { | |
| blockName = blockName || ''; |
| import { Component, ViewContainerRef, ComponentRef, ComponentFactoryResolver, ViewChild, Type, Input, Compiler } from '@angular/core'; | |
| // Helper component to add dynamic components | |
| @Component({ | |
| selector: 'tnp-component-injector', | |
| template: `<div></div>` | |
| }) | |
| export class ComponentInjector { | |
| @Input() component: Type<Component>; | |
| @Input() props: Object = {}; |
| Presentation - *скоро появится* | |
| *ngComponentOutlet Example - http://plnkr.co/edit/yscxeoYZ0Cfnzzk6Hgu7?p=preview | |
| ComponentInjector Module - https://gist.github.com/tenphi/94b8732d894ce7cec088738c7201e79e | |
| Полезные доклады про Angular: | |
| The Angular 2 Compiler Tobias Bosch - https://youtu.be/kW9cJsvcsGo | |
| Netanel Basal ViewContainerRef - https://netbasal.com/angular-2-understanding-viewcontainerref-acc183f3b682#.t9ip215zn |