This file contains hidden or 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 default class Controller { | |
| constructor(model) { | |
| this.model = model; | |
| } | |
| } |
This file contains hidden or 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 Controller from './controller'; | |
| export default class ModalController extends Controller { | |
| open(e) { | |
| this.model.isOpen = true; | |
| } | |
| close(e) { | |
| this.model.isOpen = false; | |
| } |
This file contains hidden or 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
| class View { | |
| constructor(controller) { | |
| this.controller = controller; | |
| this.controller.model.registerObserver(this); | |
| } | |
| } |
This file contains hidden or 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 View from './view'; | |
| export default class ModalView extends View { | |
| constructor(controller, options) { | |
| super(controller); | |
| this.node = options.node; | |
| this.overlay = options.overlay; | |
| this.triggers = options.triggers; | |
| this.init(); | |
| } |
This file contains hidden or 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 Clipboard from '../lib/clipboard'; | |
| import Tooltip from '../lib/tooltip'; | |
| export default function init() { | |
| const clipboards = new Clipboard({ | |
| nodes: document.queryAll('[data-clipboard]'), | |
| targets: document.queryAll('[data-clipboard-target]'), | |
| }).init(); | |
| clipboards.each((instance) => { |
This file contains hidden or 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 View from './view'; | |
| import Model from './model'; | |
| import Controller from './controller'; | |
| export default class Clipboard { | |
| constructor(options) { | |
| this.model = new Model(); | |
| this.controller = new Controller(this.model); | |
| this.view = new View(this.controller, options); | |
| } |
This file contains hidden or 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 View from './view'; | |
| import Model from './model'; | |
| import Controller from './controller'; | |
| export default class Clipboard { | |
| constructor(options) { | |
| this.model = new Model(); | |
| this.controller = new Controller(this.model); | |
| this.view = new View(this.controller, options); | |
| } |
This file contains hidden or 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 Controller from '../shared/controller'; | |
| export default class ClipboardController extends Controller { | |
| copy = () => { | |
| this.model.isCopied = true; | |
| if (this.onCopy && typeof this.onCopy === 'function') { | |
| this.onCopy(); | |
| } | |
| } |
This file contains hidden or 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 View from './view'; | |
| import Model from './model'; | |
| import Controller from './controller'; | |
| export default class Tooltip { | |
| constructor(options) { | |
| this.model = new Model(); | |
| this.controller = new Controller(this.model); | |
| this.view = new View(this.controller, options); | |
| } |
This file contains hidden or 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 Headroom from '../lib/headroom'; | |
| export default function init(app) { | |
| const headroom = new Headroom({ | |
| nodes: document.queryAll('[data-headroom]'), | |
| }).init(); | |
| const header = headroom.find('page-header'); | |
| if (header) { | |
| header.onToggle((instance) => { |