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 resizeMasonryItem = ( | |
element: HTMLElement, | |
itemWrapper: HTMLElement | |
): void => { | |
const item = itemWrapper.firstChild; | |
if (!(item instanceof HTMLElement)) return; | |
const rowSize = parseInt(getComputedStyle(element).gridAutoRows, 10); | |
const gapSize = parseInt(getComputedStyle(element).rowGap, 10); | |
const itemSize = isWritingModeVertical(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
// View Transitions API は TypeScript の型定義に含まれていないため自身で定義する | |
declare global { | |
interface ViewTransition { | |
finished: Promise<void> | |
ready: Promise<void> | |
updateCallbackDone: Promise<void> | |
} | |
interface Document { | |
startViewTransition(updateCallback: () => Promise<void> | void): ViewTransition |
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 { load } from 'cheerio' | |
import Image from 'astro/components/Image.astro' | |
import { writeFileSync, readFileSync } from 'node:fs' | |
import BaseIcon from '@/components/BaseIcon.astro' | |
type Props = { | |
href: string | |
} |
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
body *, | |
body ::before, | |
body ::after { | |
--clamp-base-font-size: 16; | |
--clamp-viewport-min: 375; | |
--clamp-viewport-max: 1200; | |
--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-base-font-size)) + (var(--clamp-slope) * 100svi) |
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', | |
} |
NewerOlder