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
:is(body, body *), | |
:is(body, body *)::before, | |
:is(body, body *)::after { | |
--clamp-root-font-size: 16; | |
--clamp-slope: calc((var(--clamp-max) - var(--clamp-min)) / (var(--clamp-viewport-max) - var(--clamp-viewport-min))); | |
--clamp-y-axis-intersection: calc(var(--clamp-min) - (var(--clamp-slope) * var(--clamp-viewport-min))); | |
--clamp-preffered-value: calc( | |
var(--clamp-y-axis-intersection) * (1rem / var(--clamp-root-font-size)) + (var(--clamp-slope) * 100vi) | |
); | |
--clamp: clamp( |
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 backfaceFixed = (fixed: boolean): void => { | |
const scrollBarWidth = getScrollBarSize() | |
const scrollPosition = getScrollPosition(fixed) | |
document.body.style.borderInlineEnd = fixed ? `${scrollBarWidth}px solid transparent` : '' | |
applyStyles(scrollPosition, fixed) | |
if (!fixed) restorePosition(scrollPosition) | |
} | |
const isWritingModeVertical = (): boolean => { |
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 backfaceFixed = (fixed: boolean): void => { | |
const scrollBarWidth = getScrollBarSize() | |
const scrollPosition = getScrollPosition(fixed) | |
document.body.style.borderInlineEnd = fixed ? `${scrollBarWidth}px solid transparent` : '' | |
applyStyles(scrollPosition, fixed) | |
if (!fixed) restorePosition(scrollPosition) | |
} | |
const isWritingModeVertical = (): boolean => { |
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
export type AccordionOptions = { | |
buttonSelector: string | undefined | |
panelSelector: string | undefined | |
duration?: number | |
easing?: string | |
printAll?: boolean | |
} | |
const defaultOptions: AccordionOptions = { | |
buttonSelector: undefined, |
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
export type AccordionOptions = { | |
duration?: number | |
easing?: string | |
printAll?: boolean | |
} | |
const defaultOptions: AccordionOptions = { | |
duration: 300, | |
easing: 'ease-in-out', | |
printAll: false, |
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 initializeAnchorPositioning = (): void => { | |
const anchorElements = document.querySelectorAll('[data-anchor]') as NodeListOf<HTMLElement> | |
anchorElements.forEach((anchorElement) => { | |
const targetId = anchorElement.getAttribute('data-anchor') | |
if (!targetId) return | |
const anchorTarget = document.getElementById(targetId) as HTMLElement | |
if (!anchorTarget) return |
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
type AccordionOptions = { | |
duration?: number | |
easing?: string | |
} | |
const defaultOptions: AccordionOptions = { | |
duration: 300, | |
easing: 'ease-in-out', | |
} |
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
export type ObserverOptions = { | |
root?: HTMLElement | null; | |
rootMargin?: string; | |
threshold?: number | number[]; | |
}; | |
const defaultOptions: ObserverOptions = { | |
root: null, | |
rootMargin: "0px", | |
threshold: 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
const initializeSmoothScroll = (): void => { | |
// クリックイベントのリスナーを追加 | |
document.addEventListener('click', handleClick, { capture: true }) | |
} | |
// 固定配置のヘッダーのブロックサイズを取得 | |
const getHeaderBlockSize = (): string => { | |
const header = document.querySelector('[data-fixed-header]') as HTMLElement | |
if (!header) return '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
export type TabsOptions = { | |
tablistSelector: string | undefined | |
tabSelector: string | undefined | |
tabpanelSelector: string | undefined | |
firstView?: number | |
} | |
const defaultOptions: TabsOptions = { | |
tablistSelector: undefined, | |
tabSelector: undefined, |
NewerOlder