daniel-fiuk_simple-map/styles.css

334 lines
7.2 KiB
CSS
Raw Permalink Normal View History

2026-04-24 19:47:09 +00:00
/*#region Containers and Wrappers*/
2026-04-10 22:14:25 +00:00
2026-04-24 19:47:09 +00:00
/* Used to contain the maps window in the note. */
.sm-container {
2026-04-10 22:14:25 +00:00
position: relative;
width: 100%;
overflow: hidden;
2026-04-14 20:45:41 +00:00
border-radius: 4px;
2026-04-10 22:14:25 +00:00
}
2026-04-24 19:47:09 +00:00
/* Used to contain the maps elements. */
.sm-wrapper {
2026-04-10 22:14:25 +00:00
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
2026-04-24 19:47:09 +00:00
/*#region Tiles and Backgrounds*/
/* Used for covering seams between tiles. */
.sm-background {
2026-04-14 20:45:41 +00:00
position: absolute;
2026-04-10 22:14:25 +00:00
inset: 0;
width: 100%;
height: 100%;
background-position: 0 0;
background-repeat: repeat;
transform: none;
z-index: 0;
}
2026-04-24 19:47:09 +00:00
/* Used to contain tile elements. */
.sm-tiles {
2026-04-10 22:14:25 +00:00
position: absolute;
inset: 0;
transform-origin: top left;
2026-04-14 20:45:41 +00:00
z-index: 1;
2026-04-10 22:14:25 +00:00
}
2026-04-24 19:47:09 +00:00
/* Used to desplay map images with the highest possible quality. */
.sm-tile {
2026-04-10 22:14:25 +00:00
position: absolute;
width: 100%;
height: 100%;
background-position: 0 0;
background-repeat: no-repeat;
background-size: 100% 100%;
}
2026-04-24 19:47:09 +00:00
/*#endregion*/
/* Prevents users from selecting tile images while dragging, while setting the cursor's grab state. */
.sm-container,
.sm-background,
.sm-tiles,
.sm-tile {
2026-04-10 22:14:25 +00:00
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;
}
2026-04-24 19:47:09 +00:00
/* While active, sets cursor state to grabbing. */
.sm-container:active,
.sm-background:active,
.sm-tiles:active,
.sm-tile:active {
2026-04-10 22:14:25 +00:00
cursor: grabbing;
}
2026-04-14 20:45:41 +00:00
2026-04-24 19:47:09 +00:00
/*#endregion*/
2026-04-10 22:14:25 +00:00
2026-04-24 19:47:09 +00:00
/*#region Toolbar*/
2026-04-10 22:14:25 +00:00
2026-04-24 19:47:09 +00:00
/* Defines the toolbar style while setting it's opacity to zero when not being interacted with. */
.sm-toolbar {
2026-04-10 22:14:25 +00:00
position: absolute;
bottom: 5px;
left: 5px;
z-index: 10;
2026-04-14 20:45:41 +00:00
display: flex;
flex-direction: row;
flex-wrap: nowrap;
2026-04-14 20:45:41 +00:00
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;
}
2026-04-24 19:47:09 +00:00
/* Sets the toolbar's opacity to 1 when user interacts with the map. */
.sm-container:hover .sm-toolbar,
.sm-container:focus-within .sm-toolbar {
2026-04-14 20:45:41 +00:00
opacity: 1;
2026-04-10 22:14:25 +00:00
}
2026-04-24 19:47:09 +00:00
/* Sets the style for toolbar buttons. */
.sm-toolbar button {
2026-04-10 22:14:25 +00:00
padding: 0.1rem 0.4rem;
font-size: 0.9rem;
}
2026-04-24 19:47:09 +00:00
/* Sets the style for zoom step text field on the toolbar. */
2026-04-26 20:04:49 +00:00
.sm-toolbar input.sm-zoom-step {
2026-04-10 22:14:25 +00:00
width: 4rem;
font-size: 0.9rem;
}
/* Search field on the toolbar with its prediction dropdown. */
2026-04-26 20:04:49 +00:00
.sm-search {
position: relative;
display: flex;
flex-direction: column;
}
2026-04-26 20:04:49 +00:00
.sm-search-input {
width: 10rem;
min-width: 0;
font-size: 0.9rem;
padding: 0.1rem 0.4rem;
}
2026-04-26 20:04:49 +00:00
.sm-search-suggestions {
position: absolute;
bottom: calc(100% + 4px);
left: 0;
2026-04-26 20:04:49 +00:00
/* 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;
}
2026-04-26 20:04:49 +00:00
.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;
}
2026-04-26 20:04:49 +00:00
.sm-search-suggestion:hover {
background-color: var(--background-modifier-hover);
}
2026-04-26 20:04:49 +00:00
.sm-search-suggestion-name {
font-weight: 600;
color: var(--text-normal);
}
2026-04-26 20:04:49 +00:00
.sm-search-suggestion-meta {
color: var(--text-muted);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
2026-04-24 19:47:09 +00:00
/*#endregion*/
2026-04-10 22:14:25 +00:00
2026-04-24 19:47:09 +00:00
/*#region Pins*/
2026-04-10 22:14:25 +00:00
/* 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;
}
2026-04-24 19:47:09 +00:00
/* Used to contain pin elements. */
.sm-pin {
2026-04-10 22:14:25 +00:00
position: absolute;
width: fit-content;
height: fit-content;
overflow: visible;
z-index: 5;
}
2026-04-24 19:47:09 +00:00
/* Sets the style of pin icon container. */
.sm-pin-icon {
2026-04-10 22:14:25 +00:00
position: relative;
width: 24px;
height: auto;
}
2026-04-24 19:47:09 +00:00
/* Sets the styles of the pin icon images. */
.sm-pin-icon svg,
.sm-pin-icon img {
2026-04-10 22:14:25 +00:00
display: block;
2026-04-15 15:32:13 +00:00
position: absolute;
bottom: 0;
2026-04-10 22:14:25 +00:00
width: 100%;
height: auto;
transform-origin: center bottom;
2026-04-14 20:45:41 +00:00
transform: translateX(-50%);
2026-04-10 22:14:25 +00:00
transition: transform 120ms ease, filter 120ms ease;
2026-04-14 20:45:41 +00:00
}
2026-04-24 19:47:09 +00:00
/* Sets the fill color of svg pins to match the Obsidian text accent color. */
.sm-pin-icon svg {
2026-04-14 17:36:59 +00:00
fill: var(--text-accent);
2026-04-10 22:14:25 +00:00
}
2026-04-24 19:47:09 +00:00
/* Sets cursor to pointer on hover. */
.sm-pin-icon:hover {
2026-04-10 22:14:25 +00:00
cursor: pointer;
2026-04-14 20:45:41 +00:00
}
2026-04-24 19:47:09 +00:00
/* Animates the pin icon images on pin hover. */
.sm-pin-icon:hover svg,
.sm-pin-icon:hover img {
2026-04-14 20:45:41 +00:00
transform: translateX(-50%) translateY(-10%) scale(1.1);
filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}
2026-04-24 19:47:09 +00:00
/* On pin hover, set pin icon color to text accent hover. */
.sm-pin-icon:hover svg {
2026-04-14 17:36:59 +00:00
fill: var(--text-accent-hover);
2026-04-10 22:14:25 +00:00
}
2026-04-24 19:47:09 +00:00
/*#endregion*/
2026-04-10 22:14:25 +00:00
2026-04-24 19:47:09 +00:00
/*#region Note Previews*/
2026-04-10 22:14:25 +00:00
2026-04-24 19:47:09 +00:00
/* Sets the hover container's style. */
.sm-hover-preview {
2026-04-10 22:14:25 +00:00
position: fixed;
2026-04-14 20:45:41 +00:00
width: min(520px, calc(100vw - 24px));
height: fit-content;
2026-04-10 22:14:25 +00:00
padding: 12px 14px;
border-radius: 8px;
2026-04-14 20:45:41 +00:00
2026-04-10 22:14:25 +00:00
background-color: var(--background-secondary);
color: var(--text-normal);
2026-04-14 20:45:41 +00:00
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
2026-04-10 22:14:25 +00:00
opacity: 0;
pointer-events: none;
transform: translateY(4px);
transition: opacity 120ms ease, transform 120ms ease;
z-index: 9999;
2026-04-14 20:45:41 +00:00
overflow: hidden;
2026-04-10 22:14:25 +00:00
}
2026-04-24 19:47:09 +00:00
/* Sets when the preview is visable. */
.sm-hover-preview.is-visible {
2026-04-10 22:14:25 +00:00
opacity: 1;
pointer-events: auto;
transform: translateY(0);
}
2026-04-24 19:47:09 +00:00
/* Sets the header element style. */
.sm-hover-header {
2026-04-14 20:45:41 +00:00
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 {
2026-04-10 22:14:25 +00:00
display: inline-block;
margin: 0;
2026-04-14 20:45:41 +00:00
font-size: var(--h1-size);
font-weight: var(--h1-weight, 700);
line-height: var(--h1-line-height, 1.2);
2026-04-14 20:45:41 +00:00
text-decoration: none;
2026-04-10 22:14:25 +00:00
}
/* 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 {
2026-04-10 22:14:25 +00:00
text-decoration: underline;
}
2026-04-24 19:47:09 +00:00
/* Sets the style of preview content. */
.sm-hover-content {
2026-04-14 20:45:41 +00:00
max-height: 260px;
overflow-y: auto;
2026-04-10 22:14:25 +00:00
font-size: 0.9rem;
line-height: 1.4;
2026-04-14 20:45:41 +00:00
padding-right: 4px;
2026-04-10 22:14:25 +00:00
}
2026-04-24 19:47:09 +00:00
/* 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 {
2026-04-14 20:45:41 +00:00
display: block;
2026-04-10 22:14:25 +00:00
max-width: 100%;
height: auto;
}
.sm-hover-preview .sm-hover-content .internal-embed,
.sm-hover-preview .sm-hover-content .image-embed {
2026-04-10 22:14:25 +00:00
max-width: 100%;
overflow: hidden;
}
2026-04-24 19:47:09 +00:00
/* Sets text overflow for preview content. */
.sm-hover-preview .sm-hover-content p {
2026-04-10 22:14:25 +00:00
overflow-wrap: anywhere;
}
2026-04-24 19:47:09 +00:00
/*#endregion*/