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 { debounce } from '@utility/debounce' | |
import { throttle } from '@utility/throttle' | |
/** | |
* @classdesc 指定した要素までスクロールしたかを検知してコールバック関数で処理を実行します。 | |
* @author Manabu Yasuda <[email protected]> | |
* @example | |
* import ScrollFixed from '@lib/ScrollFixed' | |
* | |
* const fixed = new ScrollFixed({ |
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
//- @param {Object} params | |
//- @param {String} params.width [null] セルの横幅 | |
//- @param {String} params.parentWidth [null] テーブル全体の横幅 | |
//- | |
//- @examples Input | |
//- colgroup | |
//- +Col({ width: 300, parentWidth: 900 }) | |
//- +Col({ width: "300", parentWidth: "900" }) | |
//- +Col({ width: "300px", parentWidth: "900px" }) | |
//- |
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
// `npm i -D glob js-beautify` | |
const fs = require('fs') | |
const glob = require('glob') | |
const beautify = require('js-beautify') | |
const beautifyOptions = { | |
indent_size: 2, | |
end_with_newline: true, | |
preserve_newlines: false, | |
max_preserve_newlines: 0, | |
wrap_line_length: 0, |
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
/** | |
* 要素の幅と高さを取得します。 | |
* @param {HTMLElement} target 幅と高さを取得する要素 | |
* @return {{width: Number, height: Number}} | |
* @example | |
* const foo = getSize(document.querySelector('.foo')) | |
* console.log(foo) // => {width: 300, height: 200} | |
* console.log(foo.width) // => 300 | |
* console.log(foo.height) // => 200 | |
*/ |
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
/** | |
* 仕様としてフォーカス可能な要素。 | |
*/ | |
const focusableElementsString = | |
'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), input[type="search"]:not([disabled]), select:not([disabled])' | |
/** | |
* 仕様としてフォーカス可能、かつ`tabindex="-1"`が指定されていない要素。 | |
*/ | |
const currentFocusableElementsString = |
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 { loadDefaultJapaneseParser } from 'budoux' | |
const parser = loadDefaultJapaneseParser() | |
/** | |
* 文字列を解析して、適切に改行されるように`wbr`タグを挿入します。 | |
* IEは`wbr`タグに対応していません。 | |
* @see https://caniuse.com/wbr-element | |
* @see https://github.com/google/budoux/tree/main/javascript | |
* @param {HTMLElement} element 最適化する要素 |
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
//- @param {Object} params | |
//- @param {String} params.name [""] SVGスプライトのid名 | |
//- | |
//- @examples Input | |
//- +Icon({ name: "menu" }) | |
//- @examples Output | |
//- <svg role="img"> | |
//- <use xlink:href="/assets/svg/sprite.svg#menu"></use> | |
//- </svg> | |
mixin Icon(params={}) |
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
//- @param {Object} params | |
//- @param {String} params.src [""] 画像パス | |
//- @param {String} params.srcset [""] 画像のalt属性値 | |
//- | |
//- @examples Input | |
//- +Picture({ src: "https://placehold.jp/300x300.png", alt: "" }) | |
//- +Picture_Source({ media: "lg", srcset: "https://placehold.jp/1000x1000.png" }) | |
//- +Picture_Source({ media: "md", srcset: "https://placehold.jp/600x600.png" }) | |
//- | |
//- @examples Output |
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
//- @param {Object} params | |
//- @param {boolean|string} params.start [false] start属性値を出力するかの真偽値、または出力する数値 | |
//- | |
//- @examples Input | |
//- +ListOrder | |
//- +ListOrder_Item リスト1 | |
//- +ListOrder_Item リスト2 | |
//- +ListOrder_Child | |
//- +ListOrder_Item リスト2-1 | |
//- +ListOrder_Item リスト2-2 |