Prefer rem, assure that dialogs scale correctly.
This commit is contained in:
@@ -92,7 +92,7 @@ header {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
cursor: ns-resize;
|
cursor: ns-resize;
|
||||||
font-size: 1.2em;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.week-label {
|
.week-label {
|
||||||
@@ -111,7 +111,7 @@ header {
|
|||||||
|
|
||||||
.month-name-label {
|
.month-name-label {
|
||||||
grid-column: -2 / -1;
|
grid-column: -2 / -1;
|
||||||
font-size: 2em;
|
font-size: 2rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ const modalPosition = ref({ x: 0, y: 0 })
|
|||||||
const dialogWidth = ref(null)
|
const dialogWidth = ref(null)
|
||||||
const dialogHeight = ref(null)
|
const dialogHeight = ref(null)
|
||||||
const hasMoved = ref(false)
|
const hasMoved = ref(false)
|
||||||
const margin = 8 // viewport margin in px to keep dialog from touching edges
|
|
||||||
|
|
||||||
// Collect incoming non-prop attributes (e.g., class / style from usage site)
|
// Collect incoming non-prop attributes (e.g., class / style from usage site)
|
||||||
const attrs = useAttrs()
|
const attrs = useAttrs()
|
||||||
@@ -62,8 +61,8 @@ function handleDrag(event) {
|
|||||||
const h = dialogHeight.value || modalRef.value?.offsetHeight || 0
|
const h = dialogHeight.value || modalRef.value?.offsetHeight || 0
|
||||||
const vw = window.innerWidth
|
const vw = window.innerWidth
|
||||||
const vh = window.innerHeight
|
const vh = window.innerHeight
|
||||||
x = clamp(x, margin, Math.max(margin, vw - w - margin))
|
x = clamp(x, 0, Math.max(0, vw - w - 0))
|
||||||
y = clamp(y, margin, Math.max(margin, vh - h - margin))
|
y = clamp(y, 0, Math.max(0, vh - h - 0))
|
||||||
modalPosition.value = { x, y }
|
modalPosition.value = { x, y }
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
@@ -97,10 +96,14 @@ const modalStyle = computed(() => {
|
|||||||
// <BaseDialog class="settings-modal" :style="{ top: '...' }" /> works even with fragment root.
|
// <BaseDialog class="settings-modal" :style="{ top: '...' }" /> works even with fragment root.
|
||||||
const modalAttrs = computed(() => {
|
const modalAttrs = computed(() => {
|
||||||
const { class: extClass, style: extStyle, ...rest } = attrs
|
const { class: extClass, style: extStyle, ...rest } = attrs
|
||||||
|
// When dialog has been moved (dragged), internal positioning styles must override external ones
|
||||||
|
const mergedStyle = hasMoved.value
|
||||||
|
? [extStyle, modalStyle.value].filter(Boolean)
|
||||||
|
: [modalStyle.value, extStyle].filter(Boolean)
|
||||||
return {
|
return {
|
||||||
...rest,
|
...rest,
|
||||||
class: ['ec-modal', extClass].filter(Boolean),
|
class: ['ec-modal', extClass].filter(Boolean),
|
||||||
style: [modalStyle.value, extStyle].filter(Boolean), // external style overrides internal
|
style: mergedStyle,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -120,7 +123,8 @@ function positionNearAnchor() {
|
|||||||
const anchor = props.anchorEl || anchorRef.value
|
const anchor = props.anchorEl || anchorRef.value
|
||||||
if (!anchor) return
|
if (!anchor) return
|
||||||
const rect = anchor.getBoundingClientRect()
|
const rect = anchor.getBoundingClientRect()
|
||||||
const offsetY = 8 // vertical gap below the anchor
|
const rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize)
|
||||||
|
const offsetY = 0.5 * rootFontSize // vertical gap below the anchor in rem converted to pixels
|
||||||
const w = modalRef.value?.offsetWidth || dialogWidth.value || 320
|
const w = modalRef.value?.offsetWidth || dialogWidth.value || 320
|
||||||
const h = modalRef.value?.offsetHeight || dialogHeight.value || 200
|
const h = modalRef.value?.offsetHeight || dialogHeight.value || 200
|
||||||
const vw = window.innerWidth
|
const vw = window.innerWidth
|
||||||
@@ -128,8 +132,8 @@ function positionNearAnchor() {
|
|||||||
let x = rect.left
|
let x = rect.left
|
||||||
let y = rect.bottom + offsetY
|
let y = rect.bottom + offsetY
|
||||||
// If anchor is wider than dialog and would overflow right edge, clamp; otherwise keep left align
|
// If anchor is wider than dialog and would overflow right edge, clamp; otherwise keep left align
|
||||||
x = clamp(x, margin, Math.max(margin, vw - w - margin))
|
x = clamp(x, 0, Math.max(0, vw - w - 0))
|
||||||
y = clamp(y, margin, Math.max(margin, vh - h - margin))
|
y = clamp(y, 0, Math.max(0, vh - h - 0))
|
||||||
modalPosition.value = { x, y }
|
modalPosition.value = { x, y }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,8 +176,8 @@ function handleResize() {
|
|||||||
const vw = window.innerWidth
|
const vw = window.innerWidth
|
||||||
const vh = window.innerHeight
|
const vh = window.innerHeight
|
||||||
modalPosition.value = {
|
modalPosition.value = {
|
||||||
x: clamp(modalPosition.value.x, margin, Math.max(margin, vw - w - margin)),
|
x: clamp(modalPosition.value.x, 0, Math.max(0, vw - w - 0)),
|
||||||
y: clamp(modalPosition.value.y, margin, Math.max(margin, vh - h - margin)),
|
y: clamp(modalPosition.value.y, 0, Math.max(0, vh - h - 0)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,12 +216,12 @@ onUnmounted(() => {
|
|||||||
background: color-mix(in srgb, var(--panel) 85%, transparent);
|
background: color-mix(in srgb, var(--panel) 85%, transparent);
|
||||||
backdrop-filter: blur(0.625em);
|
backdrop-filter: blur(0.625em);
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
border-radius: 0.6em;
|
border-radius: 0.6rem;
|
||||||
min-height: 23em;
|
min-height: 23rem;
|
||||||
min-width: 26em;
|
min-width: 26rem;
|
||||||
max-width: min(34em, 90vw);
|
max-width: min(34rem, 90vw);
|
||||||
box-shadow: 0 0.6em 1.8em rgba(0, 0, 0, 0.35);
|
box-shadow: 0 0.6rem 1.8rem rgba(0, 0, 0, 0.35);
|
||||||
border: 0.0625em solid color-mix(in srgb, var(--muted) 40%, transparent);
|
border: 0.0625rem solid color-mix(in srgb, var(--muted) 40%, transparent);
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@@ -229,35 +233,35 @@ onUnmounted(() => {
|
|||||||
.ec-form {
|
.ec-form {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto 1fr auto;
|
grid-template-rows: auto 1fr auto;
|
||||||
min-height: 23em;
|
min-height: 23rem;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.ec-header {
|
.ec-header {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
padding: 0.75em 1em 0.5em 1em;
|
padding: 0.75rem 1rem 0.5rem 1rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1em;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
.ec-title {
|
.ec-title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1.1em;
|
font-size: 1.1rem;
|
||||||
}
|
}
|
||||||
.ec-body {
|
.ec-body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1em;
|
gap: 1rem;
|
||||||
padding: 0 1em 0.5em 1em;
|
padding: 0 1rem 0.5rem 1rem;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
.ec-footer {
|
.ec-footer {
|
||||||
padding: 0.5em 1em 1em 1em;
|
padding: 0.5rem 1rem 1rem 1rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 1em;
|
gap: 1rem;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ const formattedDate = computed(() => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
color: var(--holiday);
|
color: var(--holiday);
|
||||||
font-size: 0.8em;
|
font-size: 0.8rem;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 1.0;
|
line-height: 1.0;
|
||||||
padding-inline: 0.15em;
|
padding-inline: 0.15em;
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ const weekdayNames = computed(() => {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 1.2em;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
.dow.weekend {
|
.dow.weekend {
|
||||||
color: var(--weekend);
|
color: var(--weekend);
|
||||||
|
|||||||
@@ -686,7 +686,7 @@ header h1 {
|
|||||||
.month-label {
|
.month-label {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
font-size: 2em;
|
font-size: 2rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ const handleEventClick = (payload) => {
|
|||||||
place-items: center;
|
place-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: 1.2em;
|
font-size: 1.2rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
height: var(--row-h);
|
height: var(--row-h);
|
||||||
|
|||||||
@@ -674,7 +674,7 @@ const recurrenceSummary = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ec-field > span {
|
.ec-field > span {
|
||||||
font-size: 0.85em;
|
font-size: 0.85rem;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,6 +688,7 @@ const recurrenceSummary = computed(() => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ec-color-swatches {
|
.ec-color-swatches {
|
||||||
@@ -725,6 +726,7 @@ const recurrenceSummary = computed(() => {
|
|||||||
padding: 0.5em 0.8em;
|
padding: 0.5em 0.8em;
|
||||||
border-radius: 0.4em;
|
border-radius: 0.4em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 1rem;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -770,7 +772,7 @@ const recurrenceSummary = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ec-field-label {
|
.ec-field-label {
|
||||||
font-size: 0.85em;
|
font-size: 0.85rem;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,7 +802,7 @@ const recurrenceSummary = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ec-weekday-text {
|
.ec-weekday-text {
|
||||||
font-size: 0.8em;
|
font-size: 0.8rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@@ -847,7 +849,7 @@ const recurrenceSummary = computed(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
font-size: 0.75em;
|
font-size: 0.75rem;
|
||||||
}
|
}
|
||||||
.freq-select {
|
.freq-select {
|
||||||
padding: 0.4rem 0.55rem;
|
padding: 0.4rem 0.55rem;
|
||||||
@@ -878,6 +880,7 @@ const recurrenceSummary = computed(() => {
|
|||||||
background: var(--panel-alt);
|
background: var(--panel-alt);
|
||||||
border-radius: 0.45rem;
|
border-radius: 0.45rem;
|
||||||
padding: 0.4rem 0.5rem;
|
padding: 0.4rem 0.5rem;
|
||||||
|
font-size: 1rem;
|
||||||
transition:
|
transition:
|
||||||
border-color 0.18s ease,
|
border-color 0.18s ease,
|
||||||
background-color 0.18s ease,
|
background-color 0.18s ease,
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ function segmentKey(seg) {
|
|||||||
|
|
||||||
function getSegmentRowHeight(seg) {
|
function getSegmentRowHeight(seg) {
|
||||||
const data = segmentCompression.value[segmentKey(seg)]
|
const data = segmentCompression.value[segmentKey(seg)]
|
||||||
return data && typeof data.rowHeight === 'number' ? `${data.rowHeight}px` : '1.5em'
|
return data && typeof data.rowHeight === 'number' ? `${data.rowHeight}px` : '1.5rem'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSegmentTotalHeight(seg) {
|
function getSegmentTotalHeight(seg) {
|
||||||
@@ -580,7 +580,7 @@ function applyRangeDuringDrag(st, startDate, endDate) {
|
|||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
/* Font-size so that ascender+descender exactly fills the row height:
|
/* Font-size so that ascender+descender exactly fills the row height:
|
||||||
given total = asc+desc at 1em (hardcoded 1.15), font-size = rowHeight / total */
|
given total = asc+desc at 1em (hardcoded 1.15), font-size = rowHeight / total */
|
||||||
font-size: calc(var(--segment-row-height, 1.5em) / 1.15);
|
font-size: calc(var(--segment-row-height, 1.5rem) / 1.15);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ onBeforeUnmount(() => {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0.5em;
|
margin: 0.5em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 1em;
|
font-size: 1rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@@ -356,14 +356,14 @@ onBeforeUnmount(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.today-date {
|
.today-date {
|
||||||
font-size: 1.5em;
|
font-size: 1.5rem;
|
||||||
white-space: pre-line;
|
white-space: pre-line;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-time {
|
.current-time {
|
||||||
font-family: ui-monospace, SF Mono, Consolas, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Ubuntu Mono", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
|
font-family: ui-monospace, SF Mono, Consolas, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Ubuntu Mono", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
|
||||||
font-size: 3.6em;
|
font-size: 3.6rem;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ function onWheel(e) {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 0.25rem;
|
gap: 0.25rem;
|
||||||
background: none;
|
background: none;
|
||||||
|
font-size: 1rem;
|
||||||
font-variant-numeric: tabular-nums;
|
font-variant-numeric: tabular-nums;
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ function parseGoToDateCandidate(input, refStr) {
|
|||||||
border-radius: 0.45rem;
|
border-radius: 0.45rem;
|
||||||
border: .1rem solid color-mix(in srgb, var(--muted) 35%, transparent);
|
border: .1rem solid color-mix(in srgb, var(--muted) 35%, transparent);
|
||||||
background: color-mix(in srgb, var(--panel) 88%, transparent);
|
background: color-mix(in srgb, var(--panel) 88%, transparent);
|
||||||
font: inherit;
|
font-size: 1rem;
|
||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ select {
|
|||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
padding: 0.4rem 0.5rem;
|
padding: 0.4rem 0.5rem;
|
||||||
border-radius: 0.4rem;
|
border-radius: 0.4rem;
|
||||||
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.holiday-row {
|
.holiday-row {
|
||||||
@@ -273,7 +274,7 @@ select {
|
|||||||
|
|
||||||
.state-select {
|
.state-select {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
min-width: 120px;
|
min-width: 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-row {
|
.footer-row {
|
||||||
@@ -297,6 +298,7 @@ select {
|
|||||||
padding: 0.5rem 0.8rem;
|
padding: 0.5rem 0.8rem;
|
||||||
border-radius: 0.4rem;
|
border-radius: 0.4rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
.ec-btn.close-btn {
|
.ec-btn.close-btn {
|
||||||
background: var(--panel-alt);
|
background: var(--panel-alt);
|
||||||
|
|||||||
Reference in New Issue
Block a user