-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate custom
smiz
lib (#101)
- Loading branch information
1 parent
c045df7
commit e9eb553
Showing
9 changed files
with
185 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
<script lang="ts"> | ||
import Zoom from 'svelte-medium-image-zoom'; | ||
let { children } = $props(); | ||
</script> | ||
|
||
<Zoom class_button="btn" zoom_margin={10}> | ||
<!-- custom unzoom zoom buttons --> | ||
{#snippet icon_zoom()} | ||
<coreicons-shape-expand class="size-5"></coreicons-shape-expand> | ||
{/snippet} | ||
{#snippet icon_unzoom()} | ||
<coreicons-shape-shrink class="size-5"></coreicons-shape-shrink> | ||
{/snippet} | ||
<!-- custom zoom content --> | ||
{#snippet zoom_content({ img, button_unzoom, modal_state })} | ||
<!-- zoomed image --> | ||
{@render img()} | ||
<div | ||
class="opacity-0 transition-opacity" | ||
class:opacity-100={modal_state === 'LOADING' || modal_state === 'LOADED'} | ||
> | ||
{@render button_unzoom()} | ||
</div> | ||
{/snippet} | ||
|
||
{@render children()} | ||
</Zoom> |
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
File renamed without changes.
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,106 @@ | ||
[data-smiz-ghost] { | ||
position: absolute; | ||
pointer-events: none; | ||
} | ||
|
||
[data-smiz-btn-zoom], | ||
[data-smiz-btn-unzoom] { | ||
/* background-color: rgba(0, 0, 0, 0.7); */ | ||
border-radius: 50%; | ||
/* border: none; */ | ||
/* box-shadow: 0 0 1px rgba(255, 255, 255, 0.5); */ | ||
/* color: #fff; */ | ||
height: 40px; | ||
margin: 0; | ||
outline: none !important; | ||
/* outline-offset: 2px; */ | ||
padding: 9px; | ||
touch-action: manipulation; | ||
width: 40px; | ||
-webkit-appearance: none; | ||
-moz-appearance: none; | ||
appearance: none; | ||
} | ||
|
||
[data-smiz-btn-zoom]:not(:focus):not(:active) { | ||
position: absolute; | ||
clip: rect(0 0 0 0); | ||
clip-path: inset(50%); | ||
height: 1px; | ||
overflow: hidden; | ||
pointer-events: none; | ||
white-space: nowrap; | ||
width: 1px; | ||
} | ||
|
||
[data-smiz-btn-zoom] { | ||
position: absolute; | ||
inset: 10px 10px auto auto; | ||
/* cursor: zoom-in; */ | ||
} | ||
|
||
[data-smiz-btn-unzoom] { | ||
position: absolute; | ||
inset: 20px 20px auto auto; | ||
/* cursor: zoom-out; */ | ||
z-index: 1; | ||
} | ||
|
||
[data-smiz-content='found'] img, | ||
[data-smiz-content='found'] [role='img'], | ||
[data-smiz-content='found'] [data-zoom] { | ||
cursor: zoom-in; | ||
} | ||
|
||
[data-smiz-modal]::backdrop { | ||
display: none; | ||
} | ||
|
||
[data-smiz-modal][open] { | ||
position: fixed; | ||
width: 100vw; | ||
width: 100dvw; | ||
height: 100vh; | ||
height: 100dvh; | ||
max-width: none; | ||
max-height: none; | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
background: transparent; | ||
overflow: hidden; | ||
} | ||
|
||
[data-smiz-modal-overlay] { | ||
position: absolute; | ||
inset: 0; | ||
transition: background-color 0.3s; | ||
} | ||
|
||
[data-smiz-modal-overlay='hidden'] { | ||
background-color: oklch(var(--b3) / 0); | ||
} | ||
|
||
[data-smiz-modal-overlay='visible'] { | ||
background-color: oklch(var(--b3) / 0.55); | ||
} | ||
|
||
[data-smiz-modal-content] { | ||
position: relative; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
[data-smiz-modal-img] { | ||
position: absolute; | ||
cursor: zoom-out; | ||
transform-origin: top left; | ||
transition: transform 0.3s; | ||
} | ||
|
||
@media (prefers-reduced-motion: reduce) { | ||
[data-smiz-modal-overlay], | ||
[data-smiz-modal-img] { | ||
transition-duration: 0.01ms !important; | ||
} | ||
} |