mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 02:41:05 +00:00
chore: format files with Prettier 3
This commit is contained in:
parent
1dcd09bd98
commit
8e996dc683
391 changed files with 3725 additions and 3785 deletions
|
@ -44,4 +44,4 @@
|
|||
dispatch("change", { size, breakpointValue: breakpoints[size] });
|
||||
</script>
|
||||
|
||||
<slot size="{size}" sizes="{sizes}" />
|
||||
<slot {size} {sizes} />
|
||||
|
|
2
src/Breakpoint/breakpointObserver.d.ts
vendored
2
src/Breakpoint/breakpointObserver.d.ts
vendored
|
@ -9,7 +9,7 @@ export function breakpointObserver(): {
|
|||
subscribe: (
|
||||
this: void,
|
||||
run: Subscriber<any>,
|
||||
invalidate?: (value?: any) => void
|
||||
invalidate?: (value?: any) => void,
|
||||
) => Unsubscriber;
|
||||
/**
|
||||
* Returns a store readable store that returns whether the current
|
||||
|
|
|
@ -14,19 +14,19 @@ export function breakpointObserver() {
|
|||
const match = {
|
||||
sm: window.matchMedia(`(max-width: ${breakpoints.md}px)`),
|
||||
md: window.matchMedia(
|
||||
`(min-width: ${breakpoints.md}px) and (max-width: ${breakpoints.lg}px)`
|
||||
`(min-width: ${breakpoints.md}px) and (max-width: ${breakpoints.lg}px)`,
|
||||
),
|
||||
lg: window.matchMedia(
|
||||
`(min-width: ${breakpoints.lg}px) and (max-width: ${breakpoints.xlg}px)`
|
||||
`(min-width: ${breakpoints.lg}px) and (max-width: ${breakpoints.xlg}px)`,
|
||||
),
|
||||
xlg: window.matchMedia(
|
||||
`(min-width: ${breakpoints.xlg}px) and (max-width: ${breakpoints.max}px)`
|
||||
`(min-width: ${breakpoints.xlg}px) and (max-width: ${breakpoints.max}px)`,
|
||||
),
|
||||
max: window.matchMedia(`(min-width: ${breakpoints.max}px)`),
|
||||
};
|
||||
const matchers = Object.entries(match);
|
||||
const sizeByMedia = Object.fromEntries(
|
||||
matchers.map(([size, queryList]) => [queryList.media, size])
|
||||
matchers.map(([size, queryList]) => [queryList.media, size]),
|
||||
);
|
||||
|
||||
const size = matchers.find(([size, queryList]) => queryList.matches)[0];
|
||||
|
@ -39,12 +39,12 @@ export function breakpointObserver() {
|
|||
}
|
||||
|
||||
matchers.forEach(([size, queryList]) =>
|
||||
queryList.addEventListener("change", handleChange)
|
||||
queryList.addEventListener("change", handleChange),
|
||||
);
|
||||
|
||||
return () => {
|
||||
matchers.forEach(([size, queryList]) =>
|
||||
queryList.removeEventListener("change", handleChange)
|
||||
queryList.removeEventListener("change", handleChange),
|
||||
);
|
||||
};
|
||||
});
|
||||
|
|
1
src/Breakpoint/index.d.ts
vendored
1
src/Breakpoint/index.d.ts
vendored
|
@ -2,4 +2,3 @@
|
|||
export { default as Breakpoint } from "./Breakpoint.svelte";
|
||||
export { breakpointObserver } from "./breakpointObserver";
|
||||
export { breakpoints } from "./breakpoints";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue