-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Elliot-Alexander/run-sherif
Update CI
- Loading branch information
Showing
31 changed files
with
168 additions
and
155 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"vaul-vue": patch | ||
--- | ||
|
||
Initial MVP of Vaul implementation in Vue |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/pnpm-lock.yaml | ||
/.gitignore | ||
/.changeset/**.md |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
"singleQuote": true, | ||
"printWidth": 100, | ||
"trailingComma": "none" | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,15 @@ | |
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"prettier:check": "prettier --check . --ignore-path .gitignore", | ||
"prettier:fix": "prettier --write . --ignore-path .gitignore", | ||
"prettier:check": "prettier --check .", | ||
"prettier:fix": "prettier --write .", | ||
"eslint:check": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore", | ||
"eslint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", | ||
"test": "pnpm -r test", | ||
"release": "pnpm -r release" | ||
"release": "pnpm -r release", | ||
"build-package": "pnpm --filter vaul-vue build-only" | ||
}, | ||
"packageManager": "[email protected]", | ||
"devDependencies": { | ||
"@changesets/cli": "^2.27.1", | ||
"@rushstack/eslint-patch": "^1.3.3", | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export const TRANSITIONS = { | ||
DURATION: 0.5, | ||
EASE: [0.32, 0.72, 0, 1], | ||
}; | ||
EASE: [0.32, 0.72, 0, 1] | ||
} | ||
|
||
export const VELOCITY_THRESHOLD = 0.4; | ||
export const VELOCITY_THRESHOLD = 0.4 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,70 @@ | ||
interface Style { | ||
[key: string]: string; | ||
[key: string]: string | ||
} | ||
|
||
const cache = new WeakMap(); | ||
const cache = new WeakMap() | ||
|
||
export function isInView(el: HTMLElement): boolean { | ||
const rect = el.getBoundingClientRect(); | ||
const rect = el.getBoundingClientRect() | ||
|
||
if (!window.visualViewport) return false; | ||
if (!window.visualViewport) return false | ||
|
||
return ( | ||
rect.top >= 0 && | ||
rect.left >= 0 && | ||
// Need + 40 for safari detection | ||
rect.bottom <= window.visualViewport.height - 40 && | ||
rect.right <= window.visualViewport.width | ||
); | ||
) | ||
} | ||
|
||
export function set(el?: Element | HTMLElement | null, styles?: Style, ignoreCache = false) { | ||
if (!el || !(el instanceof HTMLElement) || !styles) return; | ||
let originalStyles: Style = {}; | ||
if (!el || !(el instanceof HTMLElement) || !styles) return | ||
const originalStyles: Style = {} | ||
|
||
Object.entries(styles).forEach(([key, value]: [string, string]) => { | ||
if (key.startsWith('--')) { | ||
el.style.setProperty(key, value); | ||
return; | ||
el.style.setProperty(key, value) | ||
return | ||
} | ||
|
||
originalStyles[key] = (el.style as any)[key]; | ||
(el.style as any)[key] = value; | ||
}); | ||
originalStyles[key] = (el.style as any)[key] | ||
;(el.style as any)[key] = value | ||
}) | ||
|
||
if (ignoreCache) return; | ||
if (ignoreCache) return | ||
|
||
cache.set(el, originalStyles); | ||
cache.set(el, originalStyles) | ||
} | ||
|
||
export function reset(el: Element | HTMLElement | null, prop?: string) { | ||
if (!el || !(el instanceof HTMLElement)) return; | ||
let originalStyles = cache.get(el); | ||
if (!el || !(el instanceof HTMLElement)) return | ||
const originalStyles = cache.get(el) | ||
|
||
if (!originalStyles) { | ||
return; | ||
return | ||
} | ||
|
||
if (prop) { | ||
(el.style as any)[prop] = originalStyles[prop]; | ||
;(el.style as any)[prop] = originalStyles[prop] | ||
} else { | ||
Object.entries(originalStyles).forEach(([key, value]) => { | ||
(el.style as any)[key] = value; | ||
}); | ||
;(el.style as any)[key] = value | ||
}) | ||
} | ||
} | ||
|
||
export function getTranslateY(element: HTMLElement): number | null { | ||
const style = window.getComputedStyle(element); | ||
const style = window.getComputedStyle(element) | ||
const transform = | ||
// @ts-ignore | ||
style.transform || style.webkitTransform || style.mozTransform; | ||
let mat = transform.match(/^matrix3d\((.+)\)$/); | ||
if (mat) return parseFloat(mat[1].split(', ')[13]); | ||
mat = transform.match(/^matrix\((.+)\)$/); | ||
return mat ? parseFloat(mat[1].split(', ')[5]) : null; | ||
style.transform || style.webkitTransform || style.mozTransform | ||
let mat = transform.match(/^matrix3d\((.+)\)$/) | ||
if (mat) return parseFloat(mat[1].split(', ')[13]) | ||
mat = transform.match(/^matrix\((.+)\)$/) | ||
return mat ? parseFloat(mat[1].split(', ')[5]) : null | ||
} | ||
|
||
export function dampenValue(v: number) { | ||
return 8 * (Math.log(v + 1) - 2); | ||
return 8 * (Math.log(v + 1) - 2) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
function testPlatform(re: RegExp): boolean | undefined { | ||
return typeof window !== 'undefined' && window.navigator != null ? re.test(window.navigator.platform) : undefined; | ||
return typeof window !== 'undefined' && window.navigator != null | ||
? re.test(window.navigator.platform) | ||
: undefined | ||
} | ||
|
||
function isMac(): boolean | undefined { | ||
return testPlatform(/^Mac/); | ||
return testPlatform(/^Mac/) | ||
} | ||
|
||
function isIPhone(): boolean | undefined { | ||
return testPlatform(/^iPhone/); | ||
return testPlatform(/^iPhone/) | ||
} | ||
|
||
export function isSafari(): boolean | undefined { | ||
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent); | ||
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent) | ||
} | ||
|
||
function isIPad(): boolean | undefined { | ||
return ( | ||
testPlatform(/^iPad/) || | ||
// iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support. | ||
(isMac() && navigator.maxTouchPoints > 1) | ||
); | ||
) | ||
} | ||
|
||
export function isIOS(): boolean | undefined { | ||
return isIPhone() || isIPad(); | ||
return isIPhone() || isIPad() | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export interface SnapPoint { | ||
fraction: number; | ||
height: number; | ||
fraction: number | ||
height: number | ||
} |
Oops, something went wrong.