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
getHexColor = (color) -> | |
return "" unless color | |
return color if /^#/.test(color) | |
rgbValues = getRGBValues(color) | |
hexValues = rgbValues.map(numberToHex) | |
"#" + hexValues.join("") | |
numberToHex = (number) -> | |
"0#{number.toString(16)}".slice(-2).toUpperCase() |
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 { Controller } from "stimulus"; | |
export default class extends Controller { | |
initialize() { | |
this.registerAliasedControllers() | |
} | |
registerAliasedControllers() { | |
for (let [alias, original] of this.controllerIdentifiersByAlias) { | |
if (!this.moduleForIdentifier(alias)) { |
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
# ~ Dispatch jQuery events as regular DOM events ~ | |
# | |
# Delegated events are given a new name in the format `jquery:<original event name>`. | |
# If you delegate `ajax:send` you will be able to listen for `jquery:ajax:send` | |
# on native event listeners such as Stimulus actions and `EventTarget.addEventListener`. | |
# | |
# Notes: | |
# * The first parameter must be called "event". | |
# * The parameters can be accessed as members on the `event.detail` object. | |
# |