Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected render(): DNode {
let { aria = {}, closeText, open = false, title = '', theme, classes } = this.properties;
const contentStyles = this.getStyles();
const contentClasses = this.getModifierClasses();
const fixedContentClasses = this.getFixedModifierClasses();
if (!closeText) {
const { messages } = this.localizeBundle(commonBundle);
closeText = `${messages.close} ${title}`;
}
// This is a side-effect of rendering, it clears the slide styles for the next render.
this._slide = undefined;
return v(
'div',
{
'aria-labelledby': this._titleId,
classes: this.theme(css.root),
onmousedown: this._onSwipeStart,
onmousemove: this._onSwipeMove,
onmouseup: this._onSwipeEnd,
ontouchend: this._onSwipeEnd,
ontouchmove: this._onSwipeMove,
ontouchstart: this._onSwipeStart
},
[
open ? this.renderUnderlay() : null,
v(
'div',
{
showOutput?: boolean;
/** Size of the slider increment */
step?: number;
/** If the value provided by the slider are valid */
valid?: boolean;
/** The current value */
value?: number;
/** Orients the slider vertically, false by default. */
vertical?: boolean;
/** Length of the vertical slider (only used if vertical is true) */
verticalHeight?: string;
/** The id used for the form input element */
widgetId?: string;
}
@theme(css)
export class Slider extends ThemedMixin(FocusMixin(WidgetBase)) {
// id used to associate input with output
private _widgetId = uuid();
private _onInput(event: Event) {
event.stopPropagation();
const value = (event.target as HTMLInputElement).value;
this.properties.onValue && this.properties.onValue(parseFloat(value));
}
protected getRootClasses(): (string | null)[] {
const { disabled, valid, readOnly, vertical = false } = this.properties;
const focus = this.meta(Focus).get('root');
return [
results?: any[];
/** Determines if this input is valid */
valid?: { valid?: boolean; message?: string } | boolean;
/** Value to set on the input */
value?: string;
/** Optional id string for the combobox, set on the text input */
widgetId?: string;
}
// Enum used when traversing items using arrow keys
export enum Operation {
increase = 1,
decrease = -1
}
@theme(css)
@diffProperty('results', reference)
export class ComboBox extends I18nMixin(ThemedMixin(FocusMixin(WidgetBase))) {
private _activeIndex = 0;
private _ignoreBlur: boolean | undefined;
private _idBase = uuid();
private _menuHasVisualFocus = false;
private _open: boolean | undefined;
private _wasOpen: boolean | undefined;
private _closeMenu() {
this._open = false;
this.invalidate();
}
private _getMenuId() {
return `${this._idBase}-menu`;
/** Size of the slider increment */
step?: number;
/** If the value provided by the slider are valid */
valid?: boolean;
/** The current value */
value?: number;
/** Orients the slider vertically, false by default. */
vertical?: boolean;
/** Length of the vertical slider (only used if vertical is true) */
verticalHeight?: string;
/** The id used for the form input element */
widgetId?: string;
}
@theme(css)
export class Slider extends ThemedMixin(FocusMixin(WidgetBase)) {
// id used to associate input with output
private _widgetId = uuid();
private _onInput(event: Event) {
event.stopPropagation();
const value = (event.target as HTMLInputElement).value;
this.properties.onValue && this.properties.onValue(parseFloat(value));
}
protected getRootClasses(): (string | null)[] {
const { disabled, valid, readOnly, vertical = false } = this.properties;
const focus = this.meta(Focus).get('root');
return [
css.root,
/** Determines if this input is valid */
valid?: { valid?: boolean; message?: string } | boolean;
/** Value to set on the input */
value?: string;
/** Optional id string for the combobox, set on the text input */
widgetId?: string;
}
// Enum used when traversing items using arrow keys
export enum Operation {
increase = 1,
decrease = -1
}
@theme(css)
@diffProperty('results', reference)
export class ComboBox extends I18nMixin(ThemedMixin(FocusMixin(WidgetBase))) {
private _activeIndex = 0;
private _ignoreBlur: boolean | undefined;
private _idBase = uuid();
private _menuHasVisualFocus = false;
private _open: boolean | undefined;
private _wasOpen: boolean | undefined;
private _closeMenu() {
this._open = false;
this.invalidate();
}
private _getMenuId() {
return `${this._idBase}-menu`;
}
valid?: { valid?: boolean; message?: string } | boolean;
/** Value to set on the input */
value?: string;
/** Optional id string for the combobox, set on the text input */
widgetId?: string;
}
// Enum used when traversing items using arrow keys
export enum Operation {
increase = 1,
decrease = -1
}
@theme(css)
@diffProperty('results', reference)
export class ComboBox extends I18nMixin(ThemedMixin(FocusMixin(WidgetBase))) {
private _activeIndex = 0;
private _ignoreBlur: boolean | undefined;
private _idBase = uuid();
private _menuHasVisualFocus = false;
private _open: boolean | undefined;
private _wasOpen: boolean | undefined;
private _closeMenu() {
this._open = false;
this.invalidate();
}
private _getMenuId() {
return `${this._idBase}-menu`;
}
div.setAttribute('has-ci', 'ci');
}
div.textContent = `Built with Build Time Render: ${!!div.getAttribute('hasBtr')}
Currently Rendered by BTR: ${has('build-time-render')}`;
div.classList.add(...css.root.split(' '));
if (div.parentNode === null) {
root!.appendChild(div);
}
const appRoot = document.getElementById('app-root')!;
console.log(appRoot);
const registry = new Registry();
const router = registerRouterInjector(routes, registry);
if (!btr) {
router.setPath('/foo/bar');
}
const r = renderer(() => w(LazyApp, {}));
r.mount({ domNode: appRoot, registry });
import App from './App';
import * as css from './app.m.css';
import './Bar';
import LazyApp from './LazyApp';
import routes from './routes';
import test from './test.block';
'!has("bar")';
if (has('foo')) {
console.log('foo');
}
const root = document.getElementById('app');
const btr = has('build-time-render');
App().then((result) => {
console.log(result());
console.log(require('foo/bar'));
});
let div = document.getElementById('div');
if (!div) {
div = document.createElement('div');
div.id = 'div';
}
if (btr) {
test('./src/foo.txt').then((result: string) => {
const nodeBtr = document.createElement('div');
nodeBtr.id = 'nodeBtr';
nodeBtr.innerHTML = result;
root!.appendChild(nodeBtr);
}
if (has('dojo-debug')) {
div.setAttribute('dojo-debug', 'true');
}
if (has('env') === 'prod') {
div.setAttribute('has-prod', 'prod');
}
if (has('env') === 'ci') {
div.setAttribute('has-ci', 'ci');
}
div.textContent = `Built with Build Time Render: ${!!div.getAttribute('hasBtr')}
Currently Rendered by BTR: ${has('build-time-render')}`;
div.classList.add(...css.root.split(' '));
if (div.parentNode === null) {
root!.appendChild(div);
}
const appRoot = document.getElementById('app-root')!;
console.log(appRoot);
const registry = new Registry();
const router = registerRouterInjector(routes, registry);
if (!btr) {
router.setPath('/foo/bar');
}
it("can declaratively listen to a CAPScase DOM event dispatched by a Custom Element", function() {
this.weight = 1;
const r = renderer(() => w(ComponentWithDeclarativeEvent, {}));
r.mount({ domNode: scratch, sync: true });
const wc: any = document.querySelector("ce-with-event");
let handledResult: any = document.querySelector("#caps");
expect(handledResult.handled).to.be.false;
wc.click();
expect(handledResult.handled).to.be.true;
});