UNPKG

@benev/nubs

Version:
48 lines 2.56 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _NubGridboard_dispatchCause; import { html } from "lit"; import { property } from "lit/decorators.js"; import { MagicElement, mixinCss } from "@chasemoskal/magical"; import { styles } from "./style.css.js"; import { GridButtonsView } from "./views/grid-buttons.js"; import { makeCauseDispatcher } from "./starters/make-cause-dispatcher.js"; import { selectStandardLayout } from "./layouts/select-standard-layout.js"; import { listenForKeyEventsAndUpdateKeylog } from "./starters/listen-for-key-events-and-update-keylog.js"; let NubGridboard = class NubGridboard extends MagicElement { constructor() { super(...arguments); this.layout = "compact"; _NubGridboard_dispatchCause.set(this, makeCauseDispatcher(this)); } realize() { const { use } = this; const dispatchCause = __classPrivateFieldGet(this, _NubGridboard_dispatchCause, "f"); const layout = selectStandardLayout(this.layout); const [keylog, setKeylog, getKeylog] = (use.state({})); use.setup(listenForKeyEventsAndUpdateKeylog(window, getKeylog, setKeylog)); return html ` <div class=grid> ${GridButtonsView({ layout, keylog, dispatchCause })} </div> `; } }; _NubGridboard_dispatchCause = new WeakMap(); __decorate([ property({ type: String, reflect: true }) ], NubGridboard.prototype, "layout", void 0); NubGridboard = __decorate([ mixinCss(styles) ], NubGridboard); export { NubGridboard }; //# sourceMappingURL=element.js.map