daniel-fiuk_simple-map/styles.css
2026-04-26 14:04:49 -06:00

333 lines
7.2 KiB
CSS

/*#region Containers and Wrappers*/
/* Used to contain the maps window in the note. */
.sm-container {
position: relative;
width: 100%;
overflow: hidden;
border-radius: 4px;
}
/* Used to contain the maps elements. */
.sm-wrapper {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
/*#region Tiles and Backgrounds*/
/* Used for covering seams between tiles. */
.sm-background {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
background-position: 0 0;
background-repeat: repeat;
transform: none;
z-index: 0;
}
/* Used to contain tile elements. */
.sm-tiles {
position: absolute;
inset: 0;
transform-origin: top left;
z-index: 1;
}
/* Used to desplay map images with the highest possible quality. */
.sm-tile {
position: absolute;
width: 100%;
height: 100%;
background-position: 0 0;
background-repeat: no-repeat;
background-size: 100% 100%;
}
/*#endregion*/
/* Prevents users from selecting tile images while dragging, while setting the cursor's grab state. */
.sm-container,
.sm-background,
.sm-tiles,
.sm-tile {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-drag: none;
-khtml-user-drag: none;
-moz-user-drag: none;
user-drag: none;
cursor: grab;
}
/* While active, sets cursor state to grabbing. */
.sm-container:active,
.sm-background:active,
.sm-tiles:active,
.sm-tile:active {
cursor: grabbing;
}
/*#endregion*/
/*#region Toolbar*/
/* Defines the toolbar style while setting it's opacity to zero when not being interacted with. */
.sm-toolbar {
position: absolute;
bottom: 5px;
left: 5px;
z-index: 10;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
gap: 5px;
padding: 5px;
background-color: var(--background-secondary);
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
opacity: 0;
transition: opacity 150ms ease;
}
/* Sets the toolbar's opacity to 1 when user interacts with the map. */
.sm-container:hover .sm-toolbar,
.sm-container:focus-within .sm-toolbar {
opacity: 1;
}
/* Sets the style for toolbar buttons. */
.sm-toolbar button {
padding: 0.1rem 0.4rem;
font-size: 0.9rem;
}
/* Sets the style for zoom step text field on the toolbar. */
.sm-toolbar input.sm-zoom-step {
width: 4rem;
font-size: 0.9rem;
}
/* Search field on the toolbar with its prediction dropdown. */
.sm-search {
position: relative;
display: flex;
flex-direction: column;
}
.sm-search-input {
width: 10rem;
min-width: 0;
font-size: 0.9rem;
padding: 0.1rem 0.4rem;
}
.sm-search-suggestions {
position: absolute;
bottom: calc(100% + 4px);
left: 0;
/* Grow to fit the widest suggestion (note title + match metadata) but never wider than the map container minus a small buffer; the max-width is set per-render via the --sm-dropdown-max-width custom property on .sm-search. */
width: max-content;
min-width: 100%;
max-width: var(--sm-dropdown-max-width, 100%);
max-height: 220px;
overflow-x: hidden;
overflow-y: auto;
background-color: var(--background-secondary);
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 11;
}
.sm-search-suggestion {
display: flex;
align-items: baseline;
gap: 4px;
padding: 4px 6px;
cursor: pointer;
font-size: 0.85rem;
/* Allow the meta span to truncate with ellipsis when the dropdown hits its max-width cap. */
min-width: 0;
}
.sm-search-suggestion:hover {
background-color: var(--background-modifier-hover);
}
.sm-search-suggestion-name {
font-weight: 600;
color: var(--text-normal);
}
.sm-search-suggestion-meta {
color: var(--text-muted);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/*#endregion*/
/*#region Pins*/
/* Used to hide pins filtered out by the toolbar search. Kept in the DOM so re-applying an empty search restores them instantly. */
.sm-pin.sm-pin-hidden {
display: none;
}
/* Used to contain pin elements. */
.sm-pin {
position: absolute;
width: fit-content;
height: fit-content;
overflow: visible;
z-index: 5;
}
/* Sets the style of pin icon container. */
.sm-pin-icon {
position: relative;
width: 24px;
height: auto;
}
/* Sets the styles of the pin icon images. */
.sm-pin-icon svg,
.sm-pin-icon img {
display: block;
position: absolute;
bottom: 0;
width: 100%;
height: auto;
transform-origin: center bottom;
transform: translateX(-50%);
transition: transform 120ms ease, filter 120ms ease;
}
/* Sets the fill color of svg pins to match the Obsidian text accent color. */
.sm-pin-icon svg {
fill: var(--text-accent);
}
/* Sets cursor to pointer on hover. */
.sm-pin-icon:hover {
cursor: pointer;
}
/* Animates the pin icon images on pin hover. */
.sm-pin-icon:hover svg,
.sm-pin-icon:hover img {
transform: translateX(-50%) translateY(-10%) scale(1.1);
filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}
/* On pin hover, set pin icon color to text accent hover. */
.sm-pin-icon:hover svg {
fill: var(--text-accent-hover);
}
/*#endregion*/
/*#region Note Previews*/
/* Sets the hover container's style. */
.sm-hover-preview {
position: fixed;
width: min(520px, calc(100vw - 24px));
height: fit-content;
padding: 12px 14px;
border-radius: 8px;
background-color: var(--background-secondary);
color: var(--text-normal);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
opacity: 0;
pointer-events: none;
transform: translateY(4px);
transition: opacity 120ms ease, transform 120ms ease;
z-index: 9999;
overflow: hidden;
}
/* Sets when the preview is visable. */
.sm-hover-preview.is-visible {
opacity: 1;
pointer-events: auto;
transform: translateY(0);
}
/* Sets the header element style. */
.sm-hover-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 6px;
gap: 8px;
}
/* Sets the header title text style — H1-sized link in the preview header, matching Obsidian's heading variables. The coordinates row uses its own selectors and is unaffected. */
.sm-hover-preview a.sm-hover-title {
display: inline-block;
margin: 0;
font-size: var(--h1-size);
font-weight: var(--h1-weight, 700);
line-height: var(--h1-line-height, 1.2);
text-decoration: none;
}
/* Sets preview internal link styles. Scoped to body content so the H1-sized title link in the header keeps its clean, undecorated heading look. */
.sm-hover-preview .sm-hover-content a.internal-link {
text-decoration: underline;
}
/* Underline the title only on hover so it still reads as interactive without competing with H1 heading style at rest. */
.sm-hover-preview a.sm-hover-title:hover {
text-decoration: underline;
}
/* Sets the style of preview content. */
.sm-hover-content {
max-height: 260px;
overflow-y: auto;
font-size: 0.9rem;
line-height: 1.4;
padding-right: 4px;
}
/* Sets the style of image, video, and embeded content. */
.sm-hover-preview .sm-hover-content img,
.sm-hover-preview .sm-hover-content svg,
.sm-hover-preview .sm-hover-content video,
.sm-hover-preview .sm-hover-content .internal-embed img {
display: block;
max-width: 100%;
height: auto;
}
.sm-hover-preview .sm-hover-content .internal-embed,
.sm-hover-preview .sm-hover-content .image-embed {
max-width: 100%;
overflow: hidden;
}
/* Sets text overflow for preview content. */
.sm-hover-preview .sm-hover-content p {
overflow-wrap: anywhere;
}
/*#endregion*/