Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
This commit is contained in:
1 parent
288e6e94ac
commit
c1175d389f
699 files changed
+110197
-4117
No files matched your search
@@ -0,0 +1,193 @@
|
||||
.auth-page {
|
||||
--home-glass-opacity: 58%;
|
||||
min-height: 100vh;
|
||||
min-height: 100dvh;
|
||||
overflow-x: hidden;
|
||||
background-color: var(--bg);
|
||||
}
|
||||
|
||||
.auth-page > :not(.home-wallpaper) {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.auth-brand {
|
||||
position: fixed;
|
||||
top: 1rem;
|
||||
left: 1.25rem;
|
||||
max-width: min(24rem, calc(100vw - 2.5rem));
|
||||
overflow: hidden;
|
||||
color: var(--fg);
|
||||
font-size: 1rem;
|
||||
font-weight: 650;
|
||||
line-height: 2.25rem;
|
||||
text-decoration: none;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.auth-shell {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: min(100% - 2rem, 30rem);
|
||||
min-height: 100vh;
|
||||
min-height: 100dvh;
|
||||
margin: 0 auto;
|
||||
padding: 5.5rem 0 3rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: clamp(1.35rem, 4vw, 2rem);
|
||||
border: 1px solid color-mix(in srgb, var(--border) 72%, var(--accent) 28%);
|
||||
border-radius: 1rem;
|
||||
background: color-mix(in srgb, var(--bg) var(--home-glass-opacity, 58%), transparent);
|
||||
box-shadow: 0 1.4rem 4rem #0007;
|
||||
-webkit-backdrop-filter: blur(18px) saturate(120%);
|
||||
backdrop-filter: blur(18px) saturate(120%);
|
||||
}
|
||||
|
||||
.auth-heading h1 {
|
||||
margin: 0 0 1.4rem;
|
||||
font-size: clamp(1.5rem, 5vw, 2rem);
|
||||
font-weight: 620;
|
||||
letter-spacing: -.02em;
|
||||
}
|
||||
|
||||
.auth-form {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.auth-form label {
|
||||
display: grid;
|
||||
gap: .4rem;
|
||||
color: var(--fg);
|
||||
font-size: .88rem;
|
||||
}
|
||||
|
||||
.auth-form input {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: .72rem .82rem;
|
||||
border: 1px solid color-mix(in srgb, var(--input-border, var(--border)) 82%, var(--accent) 18%);
|
||||
border-radius: .55rem;
|
||||
background: color-mix(in srgb, var(--input-bg, var(--bg)) 78%, transparent);
|
||||
color: var(--input-fg, var(--fg));
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.auth-form input:focus {
|
||||
border-color: var(--accent);
|
||||
outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.auth-primary,
|
||||
.auth-secondary,
|
||||
.auth-provider-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: .65rem;
|
||||
min-height: 2.8rem;
|
||||
box-sizing: border-box;
|
||||
padding: .65rem 1rem;
|
||||
border: 1px solid color-mix(in srgb, var(--border) 72%, var(--accent) 28%);
|
||||
border-radius: .6rem;
|
||||
color: var(--fg);
|
||||
font: inherit;
|
||||
font-weight: 620;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.auth-primary {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent);
|
||||
color: var(--bg);
|
||||
}
|
||||
|
||||
.auth-secondary,
|
||||
.auth-provider-button {
|
||||
background: color-mix(in srgb, var(--button-bg, var(--bg)) 72%, transparent);
|
||||
}
|
||||
|
||||
.auth-primary:hover,
|
||||
.auth-primary:focus-visible,
|
||||
.auth-secondary:hover,
|
||||
.auth-secondary:focus-visible,
|
||||
.auth-provider-button:hover,
|
||||
.auth-provider-button:focus-visible {
|
||||
filter: brightness(1.08);
|
||||
outline: 2px solid color-mix(in srgb, var(--accent) 48%, transparent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.auth-provider-button svg {
|
||||
width: 1.35rem;
|
||||
height: 1.35rem;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.65;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.auth-separator {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
align-items: center;
|
||||
gap: .7rem;
|
||||
margin: 1.2rem 0;
|
||||
color: var(--muted);
|
||||
font-size: .78rem;
|
||||
}
|
||||
|
||||
.auth-separator::before,
|
||||
.auth-separator::after {
|
||||
height: 1px;
|
||||
background: var(--border-soft, var(--border));
|
||||
content: "";
|
||||
}
|
||||
|
||||
.auth-magic-form {
|
||||
margin-top: 1.2rem;
|
||||
padding-top: 1.2rem;
|
||||
border-top: 1px solid var(--border-soft, var(--border));
|
||||
}
|
||||
|
||||
.auth-error {
|
||||
padding: .65rem .75rem;
|
||||
border: 1px solid color-mix(in srgb, #d33 65%, var(--border));
|
||||
border-radius: .5rem;
|
||||
background: color-mix(in srgb, #d33 12%, transparent);
|
||||
color: color-mix(in srgb, #f55 80%, var(--fg));
|
||||
}
|
||||
|
||||
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
||||
.auth-card { background: color-mix(in srgb, var(--bg) 92%, transparent); }
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.auth-brand { left: .75rem; }
|
||||
.auth-shell { width: min(100% - 1.25rem, 30rem); padding-top: 4.5rem; }
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
.auth-card,
|
||||
.auth-form input,
|
||||
.auth-primary,
|
||||
.auth-secondary,
|
||||
.auth-provider-button {
|
||||
border-color: CanvasText;
|
||||
background: Canvas;
|
||||
color: CanvasText;
|
||||
box-shadow: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
backdrop-filter: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
.bookmark-sections { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,13rem),1fr)); gap:1rem; margin-block:1rem; }
|
||||
.bookmark-section { border:1px solid var(--border); background:var(--panel,var(--bg)); border-radius:.75rem; padding:1rem; min-width:0; }
|
||||
.home-bookmarks > .bookmark-sections > .bookmark-section { background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); border-color:color-mix(in srgb,var(--border) 72%,var(--accent) 28%); box-shadow:0 .45rem 1.4rem #0002; -webkit-backdrop-filter:blur(10px) saturate(115%); backdrop-filter:blur(10px) saturate(115%); }
|
||||
body:has(> .home-wallpaper) .home-bookmarks > .bookmark-sections > .bookmark-section { background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); box-shadow:0 .55rem 1.8rem #0005; }
|
||||
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) { body:has(> .home-wallpaper) .home-bookmarks > .bookmark-sections > .bookmark-section { background:color-mix(in srgb,var(--bg) 90%,transparent); } }
|
||||
@media (forced-colors:active) { .home-bookmarks > .bookmark-sections > .bookmark-section { background:Canvas; border-color:CanvasText; box-shadow:none; -webkit-backdrop-filter:none; backdrop-filter:none; } }
|
||||
.bookmark-section h2 { font-size:1rem; color:var(--fg); margin:0 0 .75rem; }
|
||||
.bookmark-section ul { margin:0; padding:0; list-style:none; }
|
||||
.bookmark-section a { display:block; padding:.5rem; color:var(--link); text-decoration:none; overflow-wrap:anywhere; border-radius:.35rem; }
|
||||
.bookmark-section a:hover { background:var(--row-hover,var(--border-soft)); }
|
||||
.home-bookmark-manager { margin-block:1rem; }
|
||||
.home-bookmark-manager summary { cursor:pointer; color:var(--link); }
|
||||
.home-bookmark-manager #panel-bookmarks { display:block; margin-top:1rem; padding:1rem; border:1px solid var(--border); border-radius:.75rem; }
|
||||
.home-bookmark-manager .table-scroll { overflow:auto; }
|
||||
.home-bookmark-manager table { width:100%; border-collapse:collapse; text-align:left; }
|
||||
.home-bookmark-manager th,.home-bookmark-manager td { padding:.5rem; }
|
||||
.home-bookmark-manager input:not([type=checkbox]),.home-bookmark-manager select { box-sizing:border-box; width:100%; min-width:8rem; padding:.5rem; }
|
||||
.home-bookmark-manager .row-actions { white-space:nowrap; }
|
||||
.home-bookmark-manager button { cursor:pointer; padding:.4rem .7rem; }
|
||||
.home-bookmark-manager .config-actions { display:flex; gap:.5rem; margin-top:1rem; }
|
||||
.bookmark-section-row { background:var(--row-hover,var(--border-soft)); }
|
||||
.bookmark-toggle { display:flex; gap:.4rem; align-items:center; font-size:.85rem; margin-top:.5rem; }
|
||||
.bookmark-toggle[hidden] { display:none!important; }
|
||||
.bookmark-toggle input { appearance:none; width:2rem; height:1.1rem; border-radius:1rem; background:var(--border); flex-shrink:0; position:relative; cursor:pointer; }
|
||||
.bookmark-toggle input::after { content:''; position:absolute; width:.8rem; height:.8rem; top:.15rem; left:.15rem; border-radius:50%; background:var(--fg); transition:transform .15s; }
|
||||
.bookmark-toggle input:checked { background:var(--accent); }
|
||||
.bookmark-toggle input:checked::after { transform:translateX(.9rem); }
|
||||
.bookmark-toggle input:focus-visible { outline:2px solid var(--link); outline-offset:2px; }
|
||||
.bookmark-toolbar { display:flex; justify-content:flex-end; }
|
||||
.bookmark-settings-icon { display:grid; place-items:center; width:2rem; height:2rem; padding:.35rem; background:transparent; color:var(--muted,var(--fg)); border:0; border-radius:.4rem; cursor:pointer; }
|
||||
.bookmark-settings-icon:hover { color:var(--link); background:var(--row-hover,var(--border-soft)); }
|
||||
.bookmark-settings-icon svg { width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linejoin:round; }
|
||||
dialog.home-bookmark-manager { width:min(72rem,calc(100vw - 2rem)); max-height:90vh; max-height:90svh; box-sizing:border-box; margin:auto; padding:0; border:1px solid var(--border); border-radius:.85rem; background:var(--bg); color:var(--fg); box-shadow:0 1.5rem 5rem #0009; overflow:auto; }
|
||||
dialog.home-bookmark-manager::backdrop { background:#0009; backdrop-filter:blur(3px); }
|
||||
.bookmark-dialog-header { position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.75rem 1.25rem; background:var(--bg); border-bottom:1px solid var(--border); }
|
||||
.bookmark-dialog-header h2 { margin:0; color:var(--fg); font-size:1.1rem; }
|
||||
.bookmark-dialog-header button { border:0; background:transparent; color:var(--fg); font-size:1.5rem; }
|
||||
dialog.home-bookmark-manager #panel-bookmarks { border:0; margin:0; padding:1.25rem; }
|
||||
dialog.home-bookmark-manager #panel-bookmarks > h1 { display:none; }
|
||||
.bookmark-editor-toolbar { display:flex; gap:.5rem; margin-block:1rem; }
|
||||
.bookmark-card-editor { display:grid; gap:1rem; }
|
||||
.bookmark-editor-card { min-width:0; border:1px solid var(--border); border-radius:.65rem; padding:1rem; margin:0; background:var(--panel,var(--bg)); }
|
||||
.bookmark-card-head { display:flex; align-items:end; gap:.5rem; margin-bottom:1rem; }
|
||||
.bookmark-card-head .bookmark-field { flex:1; }
|
||||
.bookmark-card-head h3 { margin:0; }
|
||||
.bookmark-field { display:flex; flex-direction:column; gap:.35rem; min-width:0; }
|
||||
.bookmark-field > span { font-size:.8rem; color:var(--muted,var(--fg)); }
|
||||
.bookmark-field input { width:100%; min-width:0!important; box-sizing:border-box; }
|
||||
.bookmark-section-options { display:flex; flex-wrap:wrap; align-items:center; gap:1rem; padding-bottom:.75rem; }
|
||||
.bookmark-section-options .muted { flex-basis:100%; margin:0; font-size:.85rem; }
|
||||
.bookmark-link-row { display:grid; grid-template-columns:minmax(7rem,1fr) 5rem minmax(9rem,2fr) minmax(5rem,1fr) repeat(3,2rem); gap:.5rem; align-items:end; margin-bottom:.75rem; }
|
||||
.bookmark-link-row > select { min-width:0; width:100%; }
|
||||
.bookmark-link-row button { padding:.4rem!important; }
|
||||
.bookmark-savebar { position:sticky; bottom:0; background:var(--bg); padding-block:1rem; display:flex; gap:1rem; align-items:center; }
|
||||
.bookmark-legacy[hidden] { display:none!important; }
|
||||
.vim-config-code { font-family:"Hack Nerd Font",monospace; width:100%; resize:vertical; line-height:1.5; tab-size:4; }
|
||||
#vim-settings-form input[type=file]::file-selector-button { padding:.45rem .8rem; margin-right:.8rem; border:1px solid var(--border); border-radius:.35rem; background:var(--button-bg,var(--bg)); color:var(--fg); cursor:pointer; }
|
||||
@media(max-width:700px) {
|
||||
.bookmark-link-row { grid-template-columns:1fr 1fr repeat(3,2rem); border-top:1px solid var(--border); padding-top:.75rem; }
|
||||
.bookmark-link-row .bookmark-field { grid-column:span 2; }
|
||||
.bookmark-link-row .bookmark-field:nth-child(3) { grid-column:1 / -1; }
|
||||
dialog.home-bookmark-manager { width:calc(100vw - 1rem); max-height:95svh; }
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* Keep the desktop layout and gestures intact. Small screens get compact
|
||||
navigation; coarse pointers default to scrolling instead of editing. */
|
||||
.calendar-mobile-view,.calendar-mobile-days,.calendar-mobile-actions,.calendar-mobile-count,.calendar-touch-edit{display:none}
|
||||
@media (pointer:coarse){
|
||||
.calendar-touch-edit{display:inline-flex;align-items:center;justify-content:center;min-height:40px}
|
||||
.calendar-time-event,.calendar-time-column{touch-action:pan-x pan-y pinch-zoom}
|
||||
.calendar-time-event .calendar-move-handle,.calendar-time-event .calendar-resize-handle,.calendar-timeline-handle{display:none}
|
||||
.calendar-touch-editing .calendar-time-event,.calendar-touch-editing .calendar-time-column{touch-action:none}
|
||||
.calendar-touch-editing .calendar-move-handle{display:grid;width:28px;height:28px}
|
||||
.calendar-touch-editing .calendar-resize-handle{display:block;height:10px}
|
||||
.calendar-touch-editing .calendar-time-event .calendar-event{padding-right:2rem}
|
||||
.calendar-touch-edit[aria-pressed=true]{background:var(--accent);color:var(--bg)}
|
||||
}
|
||||
@media(max-width:650px), (max-width:950px) and (pointer:coarse){
|
||||
body:has(.calendar-app)>.topbar{flex-wrap:nowrap;gap:.15rem;padding:.3rem max(.35rem,env(safe-area-inset-right)) .3rem max(.35rem,env(safe-area-inset-left));min-height:44px;box-sizing:border-box}
|
||||
body:has(.calendar-app)>.topbar>nav{display:none}
|
||||
body:has(.calendar-app)>.topbar>.brand{flex:1;min-width:0;font-size:.85rem}
|
||||
body:has(.calendar-app)>.topbar .auth-user-name{display:none}
|
||||
body:has(.calendar-app)>.topbar .city-map-launch,body:has(.calendar-app)>.topbar .notification-launch{flex:0 0 40px;width:40px;height:40px;margin:0;padding:.55rem}
|
||||
body:has(.calendar-app)>.topbar .auth-menu>details>summary{min-width:40px;min-height:40px;justify-content:center}
|
||||
.calendar-app{padding:.35rem max(.35rem,env(safe-area-inset-right)) max(.35rem,env(safe-area-inset-bottom)) max(.35rem,env(safe-area-inset-left));min-width:0}
|
||||
.calendar-app>.calendar-toolbar:first-child{display:grid;grid-template-columns:minmax(0,1fr) 40px 76px 40px;gap:.3rem;margin-bottom:.3rem}
|
||||
/* Name and date already have visible controls; keep the heading for readers. */
|
||||
.calendar-app>.calendar-toolbar:first-child h1{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
||||
#calendar-select{grid-row:2;grid-column:1;min-width:0;width:100%}
|
||||
#calendar-refresh{grid-row:2;grid-column:2}
|
||||
#calendar-new{grid-row:2;grid-column:3;text-align:center;white-space:nowrap}
|
||||
#calendar-create,#calendar-settings,#calendar-display-settings,#calendar-source-settings{display:none}
|
||||
.calendar-mobile-actions{display:block;position:relative;grid-row:2;grid-column:4;z-index:30}
|
||||
.calendar-mobile-actions>summary{display:grid;place-items:center;min-height:40px;border:1px solid var(--border);border-radius:6px;cursor:pointer;list-style:none;font-size:1.4rem;background:var(--bg)}
|
||||
.calendar-mobile-actions>summary::-webkit-details-marker{display:none}
|
||||
.calendar-mobile-actions>div{position:absolute;right:0;top:calc(100% + .3rem);min-width:12rem;display:grid;gap:.25rem;background:var(--bg);border:1px solid var(--border);border-radius:.5rem;padding:.4rem;box-shadow:0 .6rem 1.5rem #0006}
|
||||
.calendar-mobile-actions button{text-align:left}
|
||||
.calendar-toolbar{gap:.3rem;margin-bottom:.3rem}
|
||||
.calendar-toolbar a,.calendar-toolbar button,.calendar-toolbar select,#calendar-nav input{font-size:16px;min-height:40px;box-sizing:border-box;padding:.3rem .45rem;line-height:1.4}
|
||||
.calendar-toolbar [hidden],.calendar-mobile-actions [hidden]{display:none!important}
|
||||
#calendar-nav .calendar-view-link{display:none}
|
||||
#calendar-nav>a{min-width:40px;text-align:center}
|
||||
#calendar-nav input{flex:1;width:0;min-width:130px;max-width:100%;color:var(--fg);background:var(--bg);border:1px solid var(--border);border-radius:6px;-webkit-appearance:none;appearance:none}
|
||||
#calendar-nav input::-webkit-date-and-time-value{text-align:center}
|
||||
.calendar-mobile-view{display:block;flex:0 0 100%;width:100%}
|
||||
.calendar-time-controls{flex-wrap:nowrap;gap:.3rem;min-width:0;flex-shrink:0;margin:0;padding:.25rem}
|
||||
.calendar-time-controls button{min-width:36px;min-height:40px}
|
||||
.calendar-time-meta{font-size:0;flex:1;min-width:0}
|
||||
.calendar-time-meta::after{content:attr(data-short);font-size:.7rem;white-space:nowrap}
|
||||
.calendar-time-controls .calendar-touch-edit{font-size:.78rem;padding:.2rem .4rem;white-space:nowrap}
|
||||
.calendar-mobile-days{display:flex;flex-shrink:0;justify-content:space-between;gap:1px;padding:.2rem 0;background:var(--bg)}
|
||||
.calendar-mobile-days button{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;min-width:0;min-height:44px;padding:.1rem;border:1px solid transparent;border-radius:.4rem;color:var(--fg);background:transparent;font:inherit;cursor:pointer}
|
||||
.calendar-mobile-days small{font-size:.65rem}
|
||||
.calendar-mobile-days button[aria-pressed=true]{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 20%,var(--bg));font-weight:700}
|
||||
.calendar-time-grid{grid-template-columns:3rem minmax(0,1fr)}
|
||||
.calendar-time-grid[data-days="7"]{grid-template-columns:3rem repeat(7,max(245px,calc(100vw - 4rem)))}
|
||||
.calendar-time-scroll{scrollbar-gutter:auto;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y pinch-zoom}
|
||||
.calendar-time-heading{padding:.2rem;background:var(--bg);font-size:.85rem;min-height:2rem;box-sizing:border-box}
|
||||
.calendar-time-heading>a{display:block;min-height:32px;line-height:32px;color:var(--accent)}
|
||||
.calendar-time-axis,.calendar-all-day-label{background:var(--bg)}
|
||||
.calendar-time-axis span{font-size:.65rem;right:.2rem}
|
||||
.calendar-all-day-label{font-size:.7rem}
|
||||
.calendar-time-event .calendar-event{font-size:.85rem;line-height:1.25;padding:.2rem}
|
||||
#calendar-content:not(:empty){-webkit-backdrop-filter:none;backdrop-filter:none;background:color-mix(in srgb,var(--bg) 90%,transparent);box-shadow:none}
|
||||
.calendar-day{min-height:62px;padding:.2rem;box-sizing:border-box}
|
||||
.calendar-day>a:first-child{display:block;line-height:28px;color:var(--fg)}
|
||||
.calendar-month .calendar-day>.calendar-event{display:none}
|
||||
.calendar-mobile-count{display:block;font-size:.7rem;line-height:24px;color:var(--accent);white-space:nowrap}
|
||||
.calendar-month .calendar-day>a:not(:first-child):not(.calendar-mobile-count):not(.calendar-event){display:none}
|
||||
.calendar-year .calendar-day{min-height:40px}
|
||||
.calendar-week{grid-template-columns:repeat(7,minmax(260px,1fr));overscroll-behavior:contain}
|
||||
.calendar-list{table-layout:fixed;font-size:.85rem}
|
||||
.calendar-list td{overflow-wrap:anywhere;vertical-align:top}
|
||||
.calendar-list td:first-child{width:6rem}
|
||||
.calendar-list td:nth-child(3){display:none}
|
||||
.calendar-list .calendar-event{white-space:normal;font-size:.85rem}
|
||||
.calendar-detail{overflow-wrap:anywhere}
|
||||
.calendar-detail dl{grid-template-columns:1fr;gap:.25rem}
|
||||
.calendar-detail dt{font-size:.8rem;color:var(--muted)}
|
||||
.calendar-detail dd{margin-bottom:.5rem}
|
||||
#calendar-dialog{inset-block-start:calc(var(--calendar-visual-top,0px) + .5rem);inset-block-end:auto;max-height:calc(var(--calendar-visual-height,100dvh) - 1rem);width:calc(100vw - 1rem);max-width:calc(100vw - 1rem);margin:0 auto;border-radius:.6rem;background:var(--bg);-webkit-backdrop-filter:none;backdrop-filter:none}
|
||||
#calendar-dialog #calendar-form{max-height:calc(var(--calendar-visual-height,100dvh) - 1rem)}
|
||||
#calendar-dialog header,#calendar-dialog footer{padding:.5rem .7rem;gap:.4rem}
|
||||
#calendar-dialog footer{padding-bottom:max(.5rem,env(safe-area-inset-bottom))}
|
||||
#calendar-dialog button{min-height:44px;font-size:16px}
|
||||
#calendar-fields{padding:.2rem .7rem .5rem;scrollbar-gutter:auto;min-width:0;-webkit-overflow-scrolling:touch}
|
||||
#calendar-fields label{min-width:0;margin:.5rem 0}
|
||||
#calendar-fields input,#calendar-fields select,#calendar-fields textarea{font-size:16px;min-width:0;max-width:100%;min-height:44px;-webkit-text-size-adjust:100%}
|
||||
#calendar-fields input[type=checkbox]{min-height:24px;min-width:24px}
|
||||
#calendar-fields p{font-size:.85rem;overflow-wrap:anywhere}
|
||||
}
|
||||
@media(max-width:950px) and (max-height:480px) and (pointer:coarse){
|
||||
.calendar-app>.calendar-toolbar:first-child h1{display:none}
|
||||
#calendar-nav .calendar-mobile-view{flex:1;min-width:100px;width:0}
|
||||
.calendar-time-grid[data-days="7"]{grid-template-columns:3rem repeat(7,max(245px,calc((100vw - 4rem)/2)))}
|
||||
}
|
||||
@@ -0,0 +1,608 @@
|
||||
.calendar-app {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
max-width: 1500px;
|
||||
margin: 0 auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
body:has(.calendar-app) > .topbar { flex-wrap: wrap; padding: .65rem; gap: .5rem; }
|
||||
body:has(.calendar-app) > .topbar > .brand { flex: 1; min-width: 0; }
|
||||
body:has(.calendar-app) > .topbar > .brand > a { display: block; overflow: hidden; text-overflow: ellipsis; }
|
||||
body:has(.calendar-app) > .topbar > nav { order: 2; width: 100%; }
|
||||
body:has(.calendar-app) > .topbar > .city-map-launch { margin-inline: 0; flex-shrink: 0; }
|
||||
}
|
||||
body.mode-view:has(.calendar-app) {
|
||||
background:
|
||||
radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent, #578) 13%, transparent), transparent 34rem),
|
||||
radial-gradient(circle at 92% 100%, color-mix(in srgb, var(--accent, #578) 8%, transparent), transparent 30rem),
|
||||
var(--bg);
|
||||
}
|
||||
#calendar-content:not(:empty) {
|
||||
border-radius: 0.8rem;
|
||||
background: color-mix(in srgb, var(--bg) 76%, transparent);
|
||||
box-shadow: 0 0.55rem 1.8rem #0002;
|
||||
-webkit-backdrop-filter: blur(12px) saturate(115%);
|
||||
backdrop-filter: blur(12px) saturate(115%);
|
||||
}
|
||||
.calendar-time-view {
|
||||
min-height: 0;
|
||||
}
|
||||
.calendar-time-scroll {
|
||||
max-height: none;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-gutter: stable;
|
||||
border: 1px solid var(--border, #7775);
|
||||
position: relative;
|
||||
}
|
||||
html:has(body.mode-view .calendar-time-view) {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
body.mode-view:has(.calendar-time-view) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
body.mode-view:has(.calendar-time-view) > .topbar {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.calendar-app:has(.calendar-time-view) {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
padding-bottom: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.calendar-app:has(.calendar-time-view) > .calendar-toolbar,
|
||||
.calendar-app:has(.calendar-time-view) > #calendar-status {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.calendar-app:has(.calendar-time-view) > #calendar-content,
|
||||
.calendar-app:has(.calendar-time-view) .calendar-time-view {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.calendar-app:has(.calendar-time-view) > #calendar-content {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.calendar-app:has(.calendar-time-view) .calendar-time-view {
|
||||
flex: 0 1 95%;
|
||||
height: 95%;
|
||||
}
|
||||
.calendar-app:has(.calendar-time-view) .calendar-time-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.calendar-time-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 4rem repeat(var(--calendar-days), minmax(115px, 1fr));
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
}
|
||||
.calendar-time-heading {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 8;
|
||||
background: color-mix(in srgb, var(--bg) 86%, transparent);
|
||||
padding: 0.6rem 0.25rem;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid var(--border, #7775);
|
||||
}
|
||||
.calendar-time-corner {
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
.calendar-all-day,
|
||||
.calendar-all-day-label {
|
||||
background: color-mix(in srgb, var(--bg) 84%, transparent);
|
||||
border-bottom: 1px solid var(--border, #7775);
|
||||
padding: 0.25rem;
|
||||
min-height: 2rem;
|
||||
}
|
||||
.calendar-all-day-label {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
z-index: 7;
|
||||
}
|
||||
.calendar-time-axis {
|
||||
height: calc(24 * var(--hour-height));
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background: color-mix(in srgb, var(--bg) 84%, transparent);
|
||||
z-index: 6;
|
||||
}
|
||||
.calendar-time-axis span {
|
||||
position: absolute;
|
||||
right: 0.4rem;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.calendar-time-column {
|
||||
height: calc(24 * var(--hour-height));
|
||||
position: relative;
|
||||
border-left: 1px solid var(--border, #7775);
|
||||
cursor: crosshair;
|
||||
background:
|
||||
repeating-linear-gradient(
|
||||
to bottom,
|
||||
var(--border, #7775) 0px,
|
||||
var(--border, #7775) 1px,
|
||||
transparent 1px,
|
||||
transparent var(--hour-height)
|
||||
),
|
||||
repeating-linear-gradient(
|
||||
to bottom,
|
||||
var(--border-soft, #7772) 0px,
|
||||
var(--border-soft, #7772) 1px,
|
||||
transparent 1px,
|
||||
transparent var(--snap-height)
|
||||
);
|
||||
}
|
||||
.calendar-time-column.selecting {
|
||||
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #578) 28%, transparent);
|
||||
}
|
||||
.calendar-time-column.calendar-drop-target {
|
||||
box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent, #578) 72%, transparent);
|
||||
background-color: color-mix(in srgb, var(--accent, #578) 8%, transparent);
|
||||
}
|
||||
.calendar-time-selection {
|
||||
position: absolute;
|
||||
z-index: 12;
|
||||
left: 2px;
|
||||
right: 2px;
|
||||
box-sizing: border-box;
|
||||
padding: 0.15rem 0.35rem;
|
||||
overflow: hidden;
|
||||
border: 2px solid var(--accent, #578);
|
||||
border-radius: 6px;
|
||||
background: color-mix(in srgb, var(--accent, #578) 24%, var(--bg));
|
||||
color: var(--fg);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 650;
|
||||
font-variant-numeric: tabular-nums;
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #578) 18%, transparent), 0 0.4rem 1.2rem #0004;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
.calendar-time-event {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
padding: 2px;
|
||||
border: 1px solid var(--accent, #578);
|
||||
border-radius: 6px;
|
||||
background: color-mix(in srgb, var(--accent, #578) 20%, var(--bg));
|
||||
z-index: 2;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
box-shadow: 0 1px 3px #0003;
|
||||
transition: box-shadow 90ms ease, border-color 90ms ease;
|
||||
}
|
||||
.calendar-time-event:hover,
|
||||
.calendar-time-event:focus-within {
|
||||
box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #578) 35%, transparent), 0 0.35rem 0.9rem #0004;
|
||||
}
|
||||
.calendar-time-event .calendar-event {
|
||||
margin: 0;
|
||||
border: 0;
|
||||
padding: 0.15rem 1.4rem 0.15rem 0.2rem;
|
||||
white-space: normal;
|
||||
line-height: 1.1;
|
||||
background: transparent;
|
||||
flex: 1;
|
||||
font-size: 0.8rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
.calendar-move-handle {
|
||||
position: absolute;
|
||||
right: 2px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 4;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 1px solid color-mix(in srgb, var(--accent, #578) 45%, transparent);
|
||||
border-radius: 5px;
|
||||
background: color-mix(in srgb, var(--bg) 78%, transparent);
|
||||
color: var(--fg);
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1;
|
||||
opacity: 0.72;
|
||||
}
|
||||
.calendar-move-handle::before {
|
||||
content: "";
|
||||
width: 11px;
|
||||
height: 13px;
|
||||
background: radial-gradient(circle, currentColor 1.2px, transparent 1.4px) 0 0 / 5px 5px;
|
||||
}
|
||||
.calendar-time-event:hover .calendar-move-handle,
|
||||
.calendar-move-handle:focus-visible {
|
||||
opacity: 1;
|
||||
}
|
||||
.calendar-resize-handle {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 5;
|
||||
width: 100%;
|
||||
height: 7px;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: ns-resize;
|
||||
touch-action: none;
|
||||
}
|
||||
.calendar-resize-handle::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: min(2.2rem, 42%);
|
||||
height: 3px;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, var(--accent, #578) 72%, var(--fg));
|
||||
transform: translate(-50%, -50%);
|
||||
opacity: 0.55;
|
||||
}
|
||||
.calendar-resize-start {
|
||||
top: 0;
|
||||
border-top: 2px solid color-mix(in srgb, var(--accent, #578) 70%, transparent);
|
||||
}
|
||||
.calendar-resize-end {
|
||||
bottom: 0;
|
||||
border-bottom: 2px solid color-mix(in srgb, var(--accent, #578) 70%, transparent);
|
||||
}
|
||||
.calendar-time-event:hover .calendar-resize-handle,
|
||||
.calendar-resize-handle:focus-visible {
|
||||
background: color-mix(in srgb, var(--accent, #578) 30%, transparent);
|
||||
}
|
||||
.calendar-time-event:hover .calendar-resize-handle::after,
|
||||
.calendar-resize-handle:focus-visible::after,
|
||||
.calendar-time-event.resizing .calendar-resize-handle::after {
|
||||
opacity: 1;
|
||||
}
|
||||
.calendar-time-event.moving {
|
||||
z-index: 15;
|
||||
opacity: 0.9;
|
||||
outline: 2px solid var(--accent, #578);
|
||||
box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, #578) 22%, transparent), 0 0.8rem 2rem #0007;
|
||||
pointer-events: none;
|
||||
overflow: visible;
|
||||
cursor: grabbing;
|
||||
will-change: transform, top, height;
|
||||
}
|
||||
.calendar-time-event.calendar-drag-invalid {
|
||||
border-color: var(--danger, #c44);
|
||||
outline-color: var(--danger, #c44);
|
||||
filter: saturate(0.55);
|
||||
}
|
||||
.calendar-time-event.resizing-start {
|
||||
border-top-width: 3px;
|
||||
}
|
||||
.calendar-time-event.resizing-end {
|
||||
border-bottom-width: 3px;
|
||||
}
|
||||
.calendar-time-controls > span:last-child {
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.8;
|
||||
margin-left: auto;
|
||||
}
|
||||
.calendar-week-heading {
|
||||
grid-row: 1;
|
||||
text-align: center;
|
||||
padding: 0.5rem;
|
||||
border-bottom: 1px solid var(--border, #7775);
|
||||
}
|
||||
.calendar-timeline-handle {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
height: 12px;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--fg);
|
||||
cursor: ew-resize;
|
||||
touch-action: none;
|
||||
z-index: 2;
|
||||
}
|
||||
.calendar-track.moving {
|
||||
outline: 1px solid var(--accent, #578);
|
||||
}
|
||||
.calendar-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
.calendar-toolbar h1 {
|
||||
font-size: 1.25rem;
|
||||
margin: 0 auto 0 0;
|
||||
}
|
||||
.calendar-toolbar a,
|
||||
.calendar-toolbar button,
|
||||
.calendar-toolbar select {
|
||||
padding: 0.35rem 0.65rem;
|
||||
border: 1px solid var(--border, #7775);
|
||||
border-radius: 6px;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
text-decoration: none;
|
||||
}
|
||||
.calendar-toolbar a[aria-current="page"] {
|
||||
background: var(--accent, #375);
|
||||
color: var(--bg);
|
||||
}
|
||||
#calendar-status:empty {
|
||||
display: none;
|
||||
}
|
||||
.calendar-month {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||
gap: 1px;
|
||||
background: var(--border, #7775);
|
||||
border: 1px solid var(--border, #7775);
|
||||
}
|
||||
.calendar-day {
|
||||
min-height: 100px;
|
||||
background: color-mix(in srgb, var(--bg) 82%, transparent);
|
||||
padding: 0.4rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
.calendar-day.outside {
|
||||
opacity: 0.55;
|
||||
}
|
||||
.calendar-day.today {
|
||||
box-shadow: inset 0 0 0 2px var(--accent, #578);
|
||||
}
|
||||
.calendar-weekday {
|
||||
background: color-mix(in srgb, var(--bg) 86%, transparent);
|
||||
padding: 0.35rem;
|
||||
text-align: center;
|
||||
}
|
||||
.calendar-event {
|
||||
display: block;
|
||||
padding: 0.2rem 0.35rem;
|
||||
margin: 0.25rem 0;
|
||||
border-inline-start: 3px solid var(--accent, #578);
|
||||
background: color-mix(in srgb, var(--accent, #578) 10%, var(--bg));
|
||||
color: var(--fg);
|
||||
text-decoration: none;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.calendar-event:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.calendar-year {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
.calendar-year .calendar-day {
|
||||
min-height: 32px;
|
||||
text-align: center;
|
||||
padding: 0.15rem;
|
||||
}
|
||||
.calendar-year h2 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
.calendar-dot {
|
||||
display: block;
|
||||
font-size: 0.7rem;
|
||||
color: var(--accent);
|
||||
}
|
||||
.calendar-week {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, minmax(140px, 1fr));
|
||||
overflow: auto;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.calendar-week section {
|
||||
border: 1px solid var(--border, #7775);
|
||||
padding: 0.5rem;
|
||||
min-height: 260px;
|
||||
background: color-mix(in srgb, var(--bg) 78%, transparent);
|
||||
}
|
||||
.calendar-list {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.calendar-list td,
|
||||
.calendar-list th {
|
||||
padding: 0.5rem;
|
||||
text-align: start;
|
||||
border-bottom: 1px solid var(--border, #7775);
|
||||
}
|
||||
.calendar-list th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.calendar-detail {
|
||||
max-width: 850px;
|
||||
}
|
||||
.calendar-detail p {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.calendar-detail dl {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 0.5rem 1rem;
|
||||
}
|
||||
.calendar-detail dd {
|
||||
margin: 0;
|
||||
}
|
||||
.calendar-timeline {
|
||||
overflow: auto;
|
||||
}
|
||||
.calendar-track {
|
||||
min-width: 1000px;
|
||||
position: relative;
|
||||
height: 2.5rem;
|
||||
background: repeating-linear-gradient(
|
||||
90deg,
|
||||
transparent 0,
|
||||
transparent calc(100% / 24 - 1px),
|
||||
var(--border, #7775) calc(100% / 24 - 1px),
|
||||
var(--border, #7775) calc(100% / 24)
|
||||
);
|
||||
}
|
||||
.calendar-track a {
|
||||
position: absolute;
|
||||
top: 0.25rem;
|
||||
min-width: 4px;
|
||||
margin: 0;
|
||||
}
|
||||
#calendar-dialog {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
box-sizing: border-box;
|
||||
width: min(42rem, 95vw);
|
||||
max-width: 95vw;
|
||||
max-height: 95vh;
|
||||
max-height: 95dvh;
|
||||
margin: auto;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--border, #7775);
|
||||
border-radius: 12px;
|
||||
background: color-mix(in srgb, var(--bg) 76%, transparent);
|
||||
color: var(--fg);
|
||||
padding: 0;
|
||||
box-shadow: 0 1.5rem 5rem #0009;
|
||||
-webkit-backdrop-filter: blur(16px) saturate(120%);
|
||||
backdrop-filter: blur(16px) saturate(120%);
|
||||
}
|
||||
#calendar-dialog::backdrop {
|
||||
background: #0008;
|
||||
backdrop-filter: blur(3px);
|
||||
}
|
||||
#calendar-dialog #calendar-form {
|
||||
display: grid;
|
||||
grid-template-rows: auto minmax(0, 1fr) auto auto;
|
||||
max-height: 95vh;
|
||||
max-height: 95dvh;
|
||||
margin: 0;
|
||||
}
|
||||
#calendar-dialog header,
|
||||
#calendar-dialog footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.7rem;
|
||||
padding: 0.8rem 1rem;
|
||||
background: color-mix(in srgb, var(--bg) 84%, transparent);
|
||||
}
|
||||
#calendar-dialog header {
|
||||
border-bottom: 1px solid var(--border-soft, var(--border, #7775));
|
||||
}
|
||||
#calendar-dialog footer {
|
||||
justify-content: flex-end;
|
||||
border-top: 1px solid var(--border-soft, var(--border, #7775));
|
||||
}
|
||||
#calendar-dialog h2 {
|
||||
margin: 0;
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
#calendar-dialog header [data-close] {
|
||||
padding: 0.2rem 0.55rem;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
#calendar-fields {
|
||||
min-height: 0;
|
||||
padding: 0.3rem 1rem 0.8rem;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
#calendar-fields label {
|
||||
display: grid;
|
||||
gap: 0.3rem;
|
||||
margin: 0.7rem 0;
|
||||
}
|
||||
#calendar-fields input,
|
||||
#calendar-fields textarea,
|
||||
#calendar-fields select {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
color: var(--fg);
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border, #7775);
|
||||
border-radius: 5px;
|
||||
}
|
||||
#calendar-fields input[type="checkbox"] {
|
||||
width: auto;
|
||||
justify-self: start;
|
||||
}
|
||||
#calendar-fields textarea {
|
||||
min-height: 100px;
|
||||
}
|
||||
#calendar-form-error {
|
||||
margin: 0;
|
||||
padding: 0 1rem;
|
||||
color: var(--danger, #c44);
|
||||
}
|
||||
.calendar-delete-button {
|
||||
width: 100%;
|
||||
margin-top: 1rem;
|
||||
padding: 0.55rem 0.8rem;
|
||||
border: 1px solid var(--danger, #c44);
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: var(--danger, #c44);
|
||||
cursor: pointer;
|
||||
}
|
||||
.calendar-delete-button:hover,
|
||||
.calendar-delete-button:focus-visible {
|
||||
background: color-mix(in srgb, var(--danger, #c44) 16%, transparent);
|
||||
}
|
||||
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
||||
#calendar-content:not(:empty),
|
||||
#calendar-dialog { background: color-mix(in srgb, var(--bg) 94%, transparent); }
|
||||
}
|
||||
@media (forced-colors: active) {
|
||||
body.mode-view:has(.calendar-app) { background: Canvas; }
|
||||
#calendar-content:not(:empty),
|
||||
#calendar-dialog { background: Canvas; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
|
||||
#calendar-dialog { border-color: CanvasText; }
|
||||
}
|
||||
@media (max-width: 650px) {
|
||||
.calendar-app {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
.calendar-day {
|
||||
min-height: 75px;
|
||||
padding: 0.2rem;
|
||||
}
|
||||
.calendar-event {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.calendar-toolbar h1 {
|
||||
width: 100%;
|
||||
}
|
||||
.calendar-list td {
|
||||
padding: 0.35rem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
.city-governance { box-sizing:border-box; width:min(38rem,calc(100vw - 2rem)); max-height:85vh; overflow:auto; color:var(--fg); background:var(--bg); border:1px solid var(--border); border-radius:.75rem; padding:1rem; }
|
||||
.city-governance::backdrop { background:#0008; }
|
||||
.city-governance header,.city-governance footer,.city-governance li { display:flex; align-items:center; justify-content:space-between; gap:.7rem; }
|
||||
.city-governance h2,.city-governance h3 { margin:.4rem 0; }
|
||||
.city-governance fieldset { border:0; padding:0; margin:0; min-width:0; }
|
||||
.city-governance label { display:flex; align-items:center; gap:.6rem; margin:.5rem 0; }
|
||||
.city-governance select,.city-governance input[type=search] { min-width:0; flex:1; }
|
||||
.city-governance dl { display:grid; grid-template-columns:auto 1fr; gap:.3rem 1rem; margin:.7rem 0; }
|
||||
.city-governance dd { margin:0; }
|
||||
.city-governance ol,.city-governance ul { padding:0; list-style:none; }
|
||||
.city-governance li { margin:.25rem 0; overflow-wrap:anywhere; }
|
||||
.city-governance li code { font-size:.75rem; }
|
||||
.city-governance .governance-confirm { font-size:.85rem; }
|
||||
.city-access-row { display:grid; grid-template-columns:5rem minmax(4rem,1fr) 7rem 2rem; gap:.3rem; margin:.3rem 0; }
|
||||
.city-access-row input,.city-access-row select { width:100%; box-sizing:border-box; min-width:0; }
|
||||
@media(max-width:480px) { .city-access-row { grid-template-columns:4.5rem minmax(3rem,1fr) 6rem 1.8rem; font-size:.85rem; } }
|
||||
@@ -0,0 +1,40 @@
|
||||
.city-relation{fill:none;stroke:color-mix(in srgb,var(--accent) 55%,var(--fg));stroke-width:2;stroke-dasharray:7 5;opacity:.72;marker-end:url(#city-arrow)}
|
||||
.city-relation-label{font-size:10px;fill:var(--muted)}
|
||||
.city-localities{display:flex;align-items:center;gap:.45rem;flex-wrap:wrap;margin:.5rem 0 1rem;color:var(--muted)}
|
||||
.city-localities a{padding:.2rem .55rem;border:1px solid var(--border);border-radius:999px;text-decoration:none;color:var(--fg);background:color-mix(in srgb,var(--accent) 10%,var(--bg))}
|
||||
.city-inspector form{display:grid;gap:.55rem;margin-top:1rem;padding-top:.75rem;border-top:1px solid var(--border)}
|
||||
.city-node-link{font-size:18px;font-weight:800;fill:var(--accent);cursor:pointer}.city-spot-link{font-size:13px}.city-detail-link{display:inline-block;padding:.4rem .7rem;border-radius:.55rem;background:var(--accent);color:var(--bg);font-weight:700;text-decoration:none}
|
||||
.city-path-form{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}.city-path-form input{min-width:min(28rem,60vw)}
|
||||
.city-inspector form label{display:grid;gap:.25rem}.city-inspector li button{padding:.05rem .35rem;margin-left:.35rem}.city-node-detail dl{display:grid;grid-template-columns:auto 1fr;gap:.5rem 1rem}.city-node-detail dd{margin:0}
|
||||
.city-context-menu{position:fixed;z-index:10000;display:grid;min-width:13rem;padding:.4rem;border:1px solid var(--border);border-radius:.65rem;background:var(--bg);color:var(--fg);box-shadow:0 .75rem 2rem color-mix(in srgb,#000 28%,transparent)}
|
||||
.city-context-menu strong{padding:.4rem .55rem;border-bottom:1px solid var(--border);margin-bottom:.25rem}.city-context-menu a,.city-context-menu button{display:block;width:100%;box-sizing:border-box;padding:.5rem .55rem;border:0;border-radius:.4rem;background:transparent;color:var(--fg);font:inherit;text-align:left;text-decoration:none;cursor:pointer}.city-context-menu a:hover,.city-context-menu a:focus,.city-context-menu button:hover,.city-context-menu button:focus{outline:none;background:color-mix(in srgb,var(--accent) 16%,transparent)}
|
||||
.city-page{fill:color-mix(in srgb,var(--bg) 82%,var(--accent) 18%);stroke:var(--border);stroke-width:1}.city-page-title{font-size:9px;fill:var(--fg);pointer-events:none}.city-page-link:hover .city-page{stroke:var(--accent);stroke-width:2}.city-page-more{font-size:9px;fill:var(--muted)}
|
||||
.city-delete,.city-context-delete{color:var(--danger,#c43b3b)!important}.city-delete{margin-top:1rem;border-color:currentColor;background:transparent}
|
||||
.city-trail{display:flex;align-items:center;gap:.35rem;margin-right:auto}.city-trail button{min-width:0;padding:.35rem .55rem;border:0;background:transparent;color:var(--accent);font:inherit;cursor:pointer}.city-trail button:hover{text-decoration:underline}
|
||||
.city-scene-title{font-size:16px;font-weight:750;fill:var(--fg);pointer-events:none}.city-scene-path{font-size:10px;fill:var(--muted);pointer-events:none}.city-scene-count{font-size:11px;fill:var(--muted);text-anchor:end;pointer-events:none}
|
||||
.city-district-block{fill:color-mix(in srgb,var(--accent) 16%,var(--bg));stroke:color-mix(in srgb,var(--accent) 70%,var(--border));stroke-width:3;filter:drop-shadow(0 8px 7px rgb(0 0 0/.16));cursor:pointer}.city-district-road{fill:none;stroke:color-mix(in srgb,var(--fg) 18%,var(--bg));stroke-width:14;stroke-linecap:round;pointer-events:none}.city-quartier-tile:hover .city-district-block{fill:color-mix(in srgb,var(--accent) 25%,var(--bg));stroke-width:5}
|
||||
.city-green-belt{fill:color-mix(in srgb,#73a96b 25%,var(--bg));stroke:color-mix(in srgb,#73a96b 50%,var(--border));stroke-width:1}.city-road{fill:color-mix(in srgb,var(--fg) 30%,var(--bg));stroke:var(--border);stroke-width:2;cursor:pointer}.city-road-center{stroke:color-mix(in srgb,#f5d76e 75%,var(--fg));stroke-width:3;stroke-dasharray:20 16;pointer-events:none}.city-street-tile:hover .city-road{fill:color-mix(in srgb,var(--fg) 40%,var(--bg));stroke:var(--accent);stroke-width:4}
|
||||
.city-building-shadow{fill:rgb(0 0 0/.18);pointer-events:none}.city-building{fill:color-mix(in srgb,var(--bg) 78%,var(--accent) 22%);stroke:color-mix(in srgb,var(--accent) 60%,var(--border));stroke-width:2;cursor:pointer}.city-building-roof{fill:color-mix(in srgb,var(--accent) 65%,var(--bg));pointer-events:none}.city-spot-tile:hover .city-building{stroke:var(--accent);stroke-width:5}.city-building-window{fill:color-mix(in srgb,#8bd5ff 35%,var(--bg));stroke:color-mix(in srgb,#8bd5ff 55%,var(--border));stroke-width:1}.city-page-link:hover .city-building-window{fill:color-mix(in srgb,#8bd5ff 60%,var(--bg))}
|
||||
.city-brick-base{fill:color-mix(in srgb,#984f3f 58%,var(--bg))}.city-brick-mortar{fill:none;stroke:color-mix(in srgb,#e3c6a6 48%,var(--bg));stroke-width:1}.city-cobble-base{fill:color-mix(in srgb,#8e887d 55%,var(--bg))}.city-cobble-line{fill:none;stroke:color-mix(in srgb,#d8d0c2 40%,var(--bg));stroke-width:.8}.city-brick-fill{fill:url(#city-bricks)}
|
||||
.city-old-map-ground{fill:color-mix(in srgb,#c9b894 20%,var(--bg));stroke:color-mix(in srgb,#806c4e 35%,var(--border));stroke-width:2}.city-street-border{fill:none;stroke:color-mix(in srgb,#4c4238 75%,var(--border));stroke-width:38;stroke-linecap:round;stroke-linejoin:round;cursor:pointer}.city-cobbled-street{fill:none;stroke:url(#city-cobbles);stroke-width:32;stroke-linecap:round;stroke-linejoin:round;cursor:pointer}.city-cobbled-street-wide{stroke-width:64}.city-street-tile:hover .city-cobbled-street{stroke:color-mix(in srgb,#b7aa96 74%,var(--accent));filter:drop-shadow(0 0 4px color-mix(in srgb,var(--accent) 55%,transparent))}
|
||||
.city-building{fill:url(#city-bricks)}.city-building-roof{fill:color-mix(in srgb,#6d352d 72%,var(--accent))}
|
||||
.city-generator-status{padding:.25rem .5rem;border:1px solid var(--border);border-radius:999px;color:var(--muted);font:11px "JetBrains Mono",monospace}.city-generated-fabric{opacity:.68;pointer-events:none}.city-generated-building{fill:color-mix(in srgb,#9a5544 55%,var(--bg));stroke:color-mix(in srgb,#4f3028 48%,var(--border));stroke-width:.35}.city-generated-road-border{stroke:color-mix(in srgb,#4c4238 75%,var(--border));stroke-width:5.2;stroke-linecap:round}.city-generated-road{stroke:color-mix(in srgb,#b7aa96 82%,var(--bg));stroke-width:4.1;stroke-linecap:round}
|
||||
.city-spot-point{fill:#c92d38;stroke:#fff;stroke-width:2.5;cursor:pointer;filter:drop-shadow(0 2px 4px rgb(0 0 0/.45))}.city-spot-point-halo{fill:color-mix(in srgb,#c92d38 24%,transparent);stroke:#c92d38;stroke-width:1.5;cursor:pointer}.city-spot-point-label{font-size:11px;font-weight:750;fill:var(--fg);paint-order:stroke;stroke:var(--bg);stroke-width:4px;pointer-events:none}.city-spot-tile:hover .city-spot-point-halo{fill:color-mix(in srgb,#c92d38 42%,transparent);stroke-width:3}
|
||||
.city-spot-undefined .city-spot-point{fill:#9bdc28;stroke:#f5ffd9}.city-spot-undefined .city-spot-point-halo{fill:color-mix(in srgb,#9bdc28 30%,transparent);stroke:#9bdc28}.city-spot-undefined .city-spot-point-label{fill:#9bdc28}.city-spot-undefined.city-undefined-expanded>.city-spot-point,.city-spot-undefined.city-undefined-expanded>.city-spot-point-halo,.city-spot-undefined.city-undefined-expanded>.city-spot-point-label{display:none}.city-undefined-page-link{cursor:pointer}.city-undefined-page-point{fill:#9bdc28;stroke:#f5ffd9;stroke-width:2;filter:drop-shadow(0 2px 4px rgb(0 0 0/.42))}.city-undefined-page-halo{fill:color-mix(in srgb,#9bdc28 28%,transparent);stroke:#9bdc28;stroke-width:1.25}.city-undefined-page-label{font-size:9px;font-weight:700;fill:#9bdc28;paint-order:stroke;stroke:var(--bg);stroke-width:3px;pointer-events:none;opacity:.82;transition:opacity .12s}.city-undefined-page-link:hover .city-undefined-page-point,.city-undefined-page-link:focus .city-undefined-page-point{r:7}.city-undefined-page-link:hover .city-undefined-page-halo,.city-undefined-page-link:focus .city-undefined-page-halo{fill:color-mix(in srgb,#9bdc28 46%,transparent);stroke-width:2.5}.city-undefined-page-link:hover .city-undefined-page-label,.city-undefined-page-link:focus .city-undefined-page-label{opacity:1}
|
||||
.city-spot-popover{position:absolute;z-index:30;width:min(20rem,calc(100% - 20px));max-height:calc(100% - 20px);overflow:auto;box-sizing:border-box;padding:1rem;border:1px solid var(--border);border-radius:.75rem;background:var(--bg);color:var(--fg);box-shadow:0 1rem 2.5rem rgb(0 0 0/.35)}.city-spot-popover h3{margin:.1rem 2rem .25rem 0}.city-spot-popover h4{margin:.85rem 0 .3rem}.city-spot-popover ul{margin:.2rem 0 .8rem;padding-left:1.2rem}.city-popover-type{margin:0;color:#c92d38;font-size:.75rem;font-weight:800;text-transform:uppercase}.city-popover-close{position:absolute;top:.45rem;right:.45rem;width:2rem;height:2rem;padding:0;border:0;background:transparent;color:var(--fg);font-size:1.4rem;cursor:pointer}
|
||||
.city-quartier-tile .city-district-block{fill-opacity:.34}.city-quartier-tile:hover .city-district-block{fill-opacity:.52}.city-assigned-street{fill:none;stroke:color-mix(in srgb,var(--city-street-color,var(--accent)) 48%,transparent);stroke-width:5;stroke-linecap:round;pointer-events:none;transition:stroke-width .15s,stroke .15s,filter .15s}.city-generated-street-hit{fill:none;stroke:transparent;stroke-width:28;stroke-linecap:round;cursor:pointer;transition:stroke .15s}.city-generated-street-label{font-size:13px;font-weight:850;fill:var(--fg);paint-order:stroke;stroke:color-mix(in srgb,var(--bg) 88%,transparent);stroke-width:5px;pointer-events:none;opacity:0;transition:opacity .15s,fill .15s}.city-street-tile:hover .city-generated-street-hit,.city-street-tile:focus .city-generated-street-hit{stroke:rgb(0 0 0/.34)}.city-street-tile:hover .city-assigned-street,.city-street-tile:focus .city-assigned-street{stroke:color-mix(in srgb,var(--city-street-color,var(--accent)) 78%,white);stroke-width:8;filter:drop-shadow(0 0 4px var(--city-street-color,var(--accent)))}.city-street-tile:hover .city-generated-street-label,.city-street-tile:focus .city-generated-street-label{fill:var(--city-street-color,var(--accent));opacity:1}
|
||||
.city-quartier-boundary{fill:color-mix(in srgb,var(--accent) 8%,transparent);stroke:color-mix(in srgb,var(--accent) 65%,var(--border));stroke-width:2;stroke-dasharray:8 5;cursor:pointer}.city-quartier-tile:hover .city-quartier-boundary{fill:color-mix(in srgb,var(--accent) 18%,transparent);stroke-width:4}.city-assigned-street.is-current{stroke:color-mix(in srgb,var(--accent) 78%,white);stroke-width:8;filter:drop-shadow(0 0 4px var(--accent))}
|
||||
.city-autoplan{margin:1rem 0;padding:.8rem;border:1px solid var(--border);border-radius:.7rem}.city-autoplan summary{cursor:pointer;font-weight:750}.city-autoplan-results{max-height:28rem;overflow:auto;margin-top:.7rem}.city-autoplan-results table{width:100%;border-collapse:collapse;font-size:.8rem}.city-autoplan-results th,.city-autoplan-results td{padding:.35rem;border-bottom:1px solid var(--border-soft);text-align:left}.city-autoplan-results .is-undefined{color:#9bdc28}
|
||||
|
||||
/* The resting map is a guide: names are visible without finding a hit target.
|
||||
Hover/focus still emphasize the road and its label, without hiding neighbors. */
|
||||
.city-generated-street-label,.city-undefined-page-label{opacity:1}
|
||||
.city-scene-title,.city-scene-path{paint-order:stroke;stroke:var(--bg);stroke-width:4px;stroke-linejoin:round}
|
||||
/* Keep the explicit Labels toggle working for every current renderer label. */
|
||||
.city-labels-off :is(.city-scene-title,.city-scene-path,.city-scene-count,.city-generated-street-label,.city-spot-point-label,.city-undefined-page-label){display:none}
|
||||
.city-is-selected>.city-spot-point-halo,.city-undefined-page-link.city-is-selected>.city-undefined-page-halo{stroke:var(--accent);stroke-width:4;fill:color-mix(in srgb,var(--accent) 42%,transparent)}
|
||||
.city-selection-bar{position:absolute;z-index:35;bottom:1rem;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:.4rem;padding:.35rem .6rem;max-width:calc(100% - 2rem);white-space:nowrap;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:.7rem;box-shadow:0 .3rem 1rem #0005}
|
||||
.city-selection-bar[hidden]{display:none}.city-selection-bar button{min-width:2rem;min-height:2rem;padding:.2rem .4rem}
|
||||
.city-inspector h2 :is([data-city-rename],[data-city-move-selection]){margin-left:.5rem;padding:.1rem .35rem;border:0;background:transparent;color:var(--accent);cursor:pointer}
|
||||
.city-organize-dialog{box-sizing:border-box;width:min(32rem,calc(100vw - 2rem));max-height:calc(100dvh - 2rem);overflow:auto;padding:1rem;border:1px solid var(--border);border-radius:.8rem;background:var(--bg);color:var(--fg)}
|
||||
.city-organize-dialog::backdrop{background:#0008}.city-organize-dialog form{display:grid;gap:.7rem;margin:0}.city-organize-dialog h2,.city-organize-dialog p{margin:0}.city-organize-dialog label{display:grid;gap:.25rem}.city-organize-dialog :is(input,select){box-sizing:border-box;width:100%;min-width:0;font:inherit;color:var(--fg);background:var(--bg);border:1px solid var(--border);border-radius:.3rem;padding:.4rem}.city-organize-dialog footer{display:flex;gap:.5rem;justify-content:flex-end}.city-organize-dialog [role=alert]{color:var(--danger,#ef6565)}.city-selection-summary{max-height:8rem;overflow:auto;margin:0;padding-left:1.4rem}.city-organize-dialog button{padding:.4rem .7rem}.city-organize-dialog :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
|
||||
@@ -0,0 +1,29 @@
|
||||
/* SVG architecture keeps the map's labels and hit targets native and sharp. */
|
||||
.mode-city{--city-stone:color-mix(in srgb,var(--bg) 42%,#d7c59d);--city-paper:color-mix(in srgb,var(--bg) 83%,#d7c59d);--city-brass:color-mix(in srgb,var(--fg) 30%,#ba9857);--city-roof:#a76549;--city-iron:color-mix(in srgb,var(--fg) 70%,#25382f);height:100dvh;overflow:hidden;margin:0;background:var(--bg);color:var(--fg)}
|
||||
.mode-city .city-shell,.mode-city .city-layout,.mode-city .city-canvas-wrap{box-sizing:border-box;width:100%;height:100dvh;min-height:0;padding:0;margin:0;display:block;overflow:hidden;border:0;border-radius:0}
|
||||
.mode-city .city-canvas-wrap{background:radial-gradient(ellipse at center,color-mix(in srgb,var(--city-stone) 23%,var(--bg)),var(--bg))}
|
||||
.mode-city .city-map{position:absolute;inset:76px 22px 48px;width:calc(100% - 44px);height:calc(100% - 124px);min-height:0}
|
||||
.mode-city .city-canvas-wrap::after{content:"";position:absolute;inset:12px;pointer-events:none;border:1px solid color-mix(in srgb,var(--city-brass) 50%,transparent);outline:1px solid color-mix(in srgb,var(--city-brass) 22%,transparent);outline-offset:4px}
|
||||
.city-hud{position:absolute;inset:21px 29px auto;display:flex;align-items:center;gap:13px;pointer-events:none}.city-hud>*{pointer-events:auto}.city-atlas-seal{width:34px;color:var(--city-brass)}.city-atlas-seal svg{width:100%;fill:none;stroke:currentColor;stroke-width:1.5}.city-hud-location{min-width:0}.city-hud-location>small{display:block;letter-spacing:.16em;font-size:9px;color:var(--city-brass)}
|
||||
.mode-city .city-trail{font-family:Georgia,"Noto Serif",serif;font-size:17px;gap:.1rem;max-width:70vw;overflow:auto;scrollbar-width:none}.mode-city .city-trail button{font:inherit;color:var(--fg);padding:.15rem .35rem;white-space:nowrap}.mode-city .city-trail span{white-space:nowrap}.mode-city .city-menu-launch{margin-left:auto;display:flex;align-items:center;gap:.6rem;border:1px solid var(--city-brass);border-radius:2px;background:var(--city-paper);padding:.45rem .8rem;font:small-caps 14px Georgia,serif;letter-spacing:.1em;color:var(--fg);cursor:pointer}.city-menu-launch span{font:20px serif}
|
||||
.city-compass{position:absolute;bottom:42px;right:27px;width:53px;text-align:center;color:var(--city-brass);pointer-events:none;font:10px Georgia,serif}.city-compass svg{display:block;fill:none;stroke:currentColor;stroke-width:.85}.city-map-hint{position:absolute;bottom:23px;left:30px;font-size:10px;color:var(--muted);letter-spacing:.03em;pointer-events:none}
|
||||
.city-command-menu{box-sizing:border-box;width:min(860px,calc(100vw - 38px));max-height:calc(100dvh - 38px);padding:22px;border:1px solid var(--city-brass);border-radius:3px;outline:1px solid color-mix(in srgb,var(--city-brass) 35%,transparent);outline-offset:-6px;background:var(--city-paper);color:var(--fg);box-shadow:0 24px 100px #0009}.city-command-menu::backdrop{background:#080c1399;backdrop-filter:blur(5px)}
|
||||
.city-command-head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--city-brass);padding-bottom:15px;margin-bottom:18px}.city-command-head small{color:var(--city-brass);font:10px Georgia,serif;letter-spacing:.25em}.city-command-head h1{margin:4px 0 0;font:25px Georgia,"Noto Serif",serif;letter-spacing:.1em}.city-command-head>button{border:0;background:transparent;color:var(--fg);font-size:27px;cursor:pointer}
|
||||
.city-command-layout{display:grid;grid-template-columns:190px minmax(0,1fr);gap:23px}.city-command-nav{display:flex;flex-direction:column;gap:7px}.city-command-nav :is(button,a){padding:10px 12px;text-align:left;font:inherit;font-size:13px;text-decoration:none;border:1px solid transparent;background:transparent;color:var(--fg);cursor:pointer}.city-command-nav [aria-pressed=true],.city-command-nav :is(button,a):hover{border-color:color-mix(in srgb,var(--city-brass) 50%,transparent);background:color-mix(in srgb,var(--city-brass) 12%,transparent)}.city-command-nav [aria-pressed=true]::after{content:" ◂";color:var(--city-brass)}.city-command-content{min-width:0;max-height:65dvh;overflow:auto;padding-right:5px}
|
||||
.mode-city .city-command-menu :is(.city-inspector,.city-directory,.city-planner){display:block;border:0;padding:0;margin:0;border-radius:0;min-height:0}.mode-city .city-command-menu .city-toolbar{display:flex;gap:.7rem}.mode-city .city-command-menu .city-planner-grid{display:block}.mode-city .city-command-menu [hidden]{display:none!important}.mode-city .city-command-menu .city-planner form{margin-top:1rem}.mode-city .city-menu-account{display:flex;position:static;padding:1rem 0;background:transparent;border:0}.mode-city .city-menu-account .city-map-launch{display:none}.city-command-menu .city-locality-search{margin-left:0;width:100%}.city-command-menu .city-locality-search input[name=q]{width:100%;min-width:0}.city-command-menu .city-generator-status{font-size:10px;white-space:normal;border:0;padding:0}.city-create-kind{display:grid;gap:.35rem;margin-top:1rem}
|
||||
.city-command-menu :is(input,select){box-sizing:border-box;max-width:100%;color:var(--fg);background:var(--bg);border:1px solid var(--border);padding:.4rem;font:inherit}.city-command-menu button{cursor:pointer}.city-command-menu :focus-visible,.mode-city .city-menu-launch:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
|
||||
.city-command-menu [data-city-jump]{background:transparent;border:0;padding:.15rem 0;color:var(--fg);font:inherit;text-align:left}.city-command-menu [data-city-jump]:hover{color:var(--accent);text-decoration:underline}
|
||||
.city-command-content{scrollbar-width:thin;scrollbar-color:var(--city-brass) transparent}.city-command-menu h2{margin:0 0 .65rem;font-size:1.15rem}.city-command-menu .city-autoplan{margin:0 0 .7rem;padding:.6rem}.mode-city .city-command-menu .city-planner form{gap:.5rem;margin-top:.8rem}.city-command-menu .city-planner form h3{margin:.2rem 0 .45rem;font-size:1rem}.city-command-menu .city-planner form label{display:grid;grid-template-columns:6rem minmax(0,1fr);align-items:center;gap:.5rem;font-size:.85rem}.city-command-menu .city-planner form :is(input,select){width:100%;min-width:0;padding:.3rem;line-height:1.3}.city-command-menu .city-planner form>button{justify-self:end;min-width:5rem;padding:.3rem .75rem}.city-command-menu .auth-menu-popover{position:static;margin-top:.5rem;box-shadow:none}
|
||||
.mode-city .city-scene-pager{position:absolute;bottom:24px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:.7rem;color:var(--city-brass);font:12px Georgia,serif}.city-scene-pager[hidden]{display:none!important}.city-scene-pager button{background:var(--city-paper);border:1px solid var(--city-brass);color:var(--fg);width:30px;height:26px;cursor:pointer}.mode-city .city-selection-bar{bottom:4.5rem}
|
||||
.estate-ground{fill:color-mix(in srgb,var(--city-stone) 8%,transparent);stroke:none;pointer-events:none}.estate-stone{fill:var(--city-stone)}.estate-mortar{fill:none;stroke:color-mix(in srgb,var(--bg) 22%,var(--city-stone));stroke-width:.7}.estate-roof-fill{fill:var(--city-roof)}.estate-roof-tile{fill:none;stroke:#743e303f;stroke-width:.7}
|
||||
.estate-route-edge{fill:none;stroke:color-mix(in srgb,var(--city-brass) 56%,var(--bg));stroke-width:20;stroke-linecap:round;pointer-events:none}.estate-route{fill:none;stroke:var(--city-stone);stroke-width:14;stroke-dasharray:2 1;pointer-events:none}.estate-walkway{fill:none;stroke:color-mix(in srgb,var(--city-stone) 70%,transparent);stroke-width:12;stroke-dasharray:4 1;pointer-events:none}.estate-detail-walkway{fill:none;stroke:color-mix(in srgb,var(--bg) 14%,transparent);stroke-width:4;stroke-dasharray:3 4;pointer-events:none}
|
||||
.city-courtyard{fill:url(#city-court-stone);stroke:var(--city-brass);stroke-width:2;filter:drop-shadow(2px 5px 3px #0003)}.estate-balustrade{fill:none;stroke:color-mix(in srgb,var(--city-brass) 70%,var(--bg));stroke-width:6;stroke-dasharray:2 4;pointer-events:none}.estate-shadow{fill:#0002}.estate-house-wall{fill:#dbc8a3;stroke:#6c614a;stroke-width:1.3}.estate-house-roof{fill:url(#city-terracotta);stroke:#744735;stroke-width:1.2}.estate-window{fill:#384641;stroke:#a99570;stroke-width:1.4}.estate-cornice{fill:none;stroke:#897653;stroke-width:2.5}.estate-palazzo-wall{fill:#dccaab;stroke:#8f7c56;stroke-width:1.5}.estate-pediment{fill:#ba9e76;stroke:#857351;stroke-width:2}.estate-column{stroke:#f1e2c4;stroke-width:7;fill:none}.estate-rosette{fill:#d3b567;stroke:#78694d;stroke-width:1.5}.estate-iron{fill:none;stroke:var(--city-iron);stroke-width:1.7}.estate-cypress{fill:color-mix(in srgb,#467155 65%,var(--bg));stroke:#738268;stroke-width:.7}.estate-tree-trunk{stroke:#867654;stroke-width:2}.estate-fountain{fill:#77a99d;stroke:#d5c59e;stroke-width:6}.estate-fountain-inner{fill:#b3d2c0;stroke:#637f75;stroke-width:3}
|
||||
.mode-city .city-estate-scene .city-spot-point-label{font-family:Georgia,"Noto Serif",serif;font-weight:600;fill:var(--fg);stroke:var(--city-stone);stroke-width:4;paint-order:stroke;font-size:17px}.mode-city .city-estate-detail .city-spot-point-label{font-size:20px}.mode-city .city-estate-scene .city-generated-street-label{font:22px Georgia,"Noto Serif",serif;fill:var(--fg);opacity:1;stroke:var(--bg);stroke-width:4;paint-order:stroke}
|
||||
.city-estate-page-label,.mode-city .city-estate-scene .city-undefined-page-label{font-size:12px;fill:var(--fg);font-weight:500;stroke:var(--city-stone);stroke-width:3;paint-order:stroke;pointer-events:none}.city-map-page-link:hover use,.city-map-page-link:focus use{filter:drop-shadow(0 0 4px var(--accent))}.city-map-page-link:focus-visible{outline:none}.city-map-page-link:focus-visible .estate-shadow{stroke:var(--accent);stroke-width:3}.city-spot-entry{cursor:pointer}.city-spot-entry:hover use,.city-spot-entry:focus-visible use{filter:drop-shadow(0 0 4px var(--accent))}.city-spot-entry:focus-visible{outline:none}.city-spot-entry:focus-visible .city-spot-point-label{fill:var(--accent)}
|
||||
.mode-city .city-spot-tile.city-is-selected>.city-courtyard{stroke:var(--accent);stroke-width:5}.city-map-page-link.city-is-selected .estate-shadow{stroke:var(--accent);stroke-width:4;fill:color-mix(in srgb,var(--accent) 35%,transparent)}.city-estate-more rect,.city-portal-link rect{fill:var(--city-paper);stroke:var(--city-brass);stroke-width:1}.city-estate-more text,.city-portal-label{fill:var(--fg);font-size:12px;pointer-events:none}.city-estate-more{cursor:pointer}.city-portal-link:hover rect{stroke:var(--accent);stroke-width:2}.mode-city .city-labels-off :is(.city-estate-page-label,.city-undefined-page-label,.city-spot-point-label,.city-generated-street-label){display:none}
|
||||
.mode-city .city-generated-fabric{opacity:.88}.mode-city .city-generated-building{fill:url(#city-terracotta);stroke:color-mix(in srgb,var(--city-brass) 60%,var(--bg));stroke-width:1;filter:drop-shadow(1px 2px 1px #0003)}.mode-city .city-generated-road-border{stroke:color-mix(in srgb,var(--city-brass) 60%,var(--bg));stroke-width:7}.mode-city .city-generated-road{stroke:var(--city-stone);stroke-width:5}.mode-city .city-quartier-boundary{fill:color-mix(in srgb,var(--city-brass) 6%,transparent);stroke:var(--city-brass);stroke-dasharray:none;stroke-width:2}.mode-city .city-quartier-tile:hover .city-quartier-boundary{fill:color-mix(in srgb,var(--accent) 14%,transparent)}.mode-city .city-scene-title{font:20px Georgia,"Noto Serif",serif;stroke:var(--bg);stroke-width:4}.mode-city .city-scene-path{font:11px Georgia,serif}.city-quartier-ornament{pointer-events:none}
|
||||
@media(max-width:650px){.mode-city .city-map{inset:85px 8px 63px;width:calc(100% - 16px);height:calc(100% - 148px)}.city-hud{inset:24px 22px auto;gap:6px}.city-atlas-seal{display:none}.mode-city .city-trail{max-width:61vw;font-size:14px}.city-hud-location>small{font-size:8px;letter-spacing:.06em;max-width:56vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mode-city .city-menu-launch{padding:.35rem;font-size:11px;gap:.25rem}.city-map-hint{bottom:23px;font-size:9px;left:23px;max-width:65vw}.city-scene-pager{bottom:43px!important}.city-compass{width:34px;right:22px;bottom:30px}.city-command-layout{grid-template-columns:1fr;gap:12px}.city-command-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px}.city-command-nav :is(button,a){padding:7px;font-size:12px}.city-command-content{max-height:48dvh}.city-command-menu{padding:16px}.city-command-head{margin-bottom:10px}}
|
||||
@media(prefers-reduced-motion:reduce){.mode-city *{transition:none!important;scroll-behavior:auto!important}}
|
||||
.city-public-exit{position:absolute;z-index:2;top:88px;left:30px;display:flex;gap:.8rem;font-size:.85rem;background:var(--bg);border:1px solid var(--border);border-radius:.3rem;padding:.35rem .65rem}
|
||||
.city-public-exit a{text-decoration:none;color:var(--link)}
|
||||
.city-map-popup-mode .city-public-exit{display:none}
|
||||
@@ -0,0 +1,3 @@
|
||||
.city-shell{padding:1rem;max-width:none}.city-map-title{font-weight:700}.city-toolbar{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:.75rem}.city-toolbar button{min-width:2.4rem}.city-toolbar label{margin-left:.5rem}.city-layout{display:grid;grid-template-columns:minmax(0,1fr) 18rem;gap:1rem;min-height:68vh}.city-canvas-wrap{position:relative;overflow:hidden;border:1px solid var(--border);border-radius:1rem;background:color-mix(in srgb,var(--bg) 88%,var(--accent) 12%);min-height:68vh}.city-map{display:block;width:100%;height:68vh;touch-action:none;cursor:grab}.city-map.is-dragging{cursor:grabbing}.city-quartier{fill:color-mix(in srgb,var(--bg) 86%,var(--accent) 14%);stroke:color-mix(in srgb,var(--accent) 65%,var(--border));stroke-width:2}.city-quartier-title{font-size:18px;font-weight:750;fill:var(--fg)}.city-street{fill:color-mix(in srgb,var(--fg) 13%,var(--bg));stroke:color-mix(in srgb,var(--fg) 24%,transparent);stroke-width:1}.city-street-line{stroke:color-mix(in srgb,var(--bg) 65%,var(--fg));stroke-width:2;stroke-dasharray:10 8}.city-street-title{font-size:13px;font-weight:650;fill:var(--fg)}.city-spot{fill:var(--accent);stroke:var(--bg);stroke-width:3;cursor:pointer;filter:drop-shadow(0 2px 3px rgb(0 0 0/.25))}.city-spot:hover,.city-node:focus .city-spot{stroke:var(--fg);stroke-width:4}.city-spot-title{font-size:11px;font-weight:650;fill:var(--fg);paint-order:stroke;stroke:var(--bg);stroke-width:3px;stroke-linejoin:round;pointer-events:none}.city-labels-off .city-spot-title{display:none}.city-inspector{border:1px solid var(--border);border-radius:1rem;padding:1rem;overflow:auto}.city-inspector h2{margin-top:0}.city-inspector dl{display:grid;grid-template-columns:auto 1fr;gap:.4rem .7rem}.city-inspector dt{font-weight:700}.city-inspector dd{margin:0;overflow-wrap:anywhere}.city-empty{position:absolute;inset:0;display:grid;place-content:center;text-align:center;padding:2rem}.city-empty[hidden]{display:none}.city-directory,.city-planner{margin-top:1rem;border:1px solid var(--border);border-radius:.75rem;padding:.75rem}.city-directory-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));gap:1rem}.city-directory article{border-left:3px solid var(--accent);padding-left:.75rem}.city-directory ul{padding-left:1.2rem}.city-planner-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));gap:1rem}.city-planner form{display:grid;gap:.7rem;align-content:start}.city-planner label{display:grid;gap:.3rem}@media(max-width:800px){.city-layout{grid-template-columns:1fr}.city-canvas-wrap,.city-map{min-height:58vh;height:58vh}.city-inspector{min-height:8rem}}
|
||||
.city-locality-search{display:flex;align-items:center;gap:.25rem;margin-inline-start:auto}.city-locality-search input[name="q"]{width:min(18rem,30vw)}
|
||||
html.city-map-popup-mode,body.city-map-popup-mode{width:100%;height:100%;overflow:hidden}.city-map-popup-mode .topbar,.city-map-popup-mode .city-toolbar,.city-map-popup-mode .city-inspector,.city-map-popup-mode .city-directory,.city-map-popup-mode .city-planner{display:none}.city-map-popup-mode .city-shell{width:100%;height:100%;padding:0;overflow:hidden}.city-map-popup-mode .city-layout{display:block;width:100%;height:100%;min-height:0;overflow:hidden}.city-map-popup-mode .city-canvas-wrap{width:100%;height:100%;min-height:0;border:0;border-radius:0;overflow:hidden}.city-map-popup-mode .city-map{width:100%;height:100%;min-height:0}
|
||||
@@ -0,0 +1,3 @@
|
||||
.mode-city .city-quartier-tile:focus-visible .city-quartier-boundary{stroke:var(--accent);stroke-width:3;vector-effect:non-scaling-stroke}
|
||||
.mode-city .city-estate-more:focus-visible rect,.mode-city .city-portal-link:focus-visible rect{stroke:var(--accent);stroke-width:3}
|
||||
.mode-city [data-city-retry]{justify-self:center;margin-top:1rem}
|
||||
@@ -0,0 +1,352 @@
|
||||
body.mode-config .config-main {
|
||||
padding: 1.25rem;
|
||||
display: block;
|
||||
}
|
||||
|
||||
body.mode-config .config-layout {
|
||||
display: grid !important;
|
||||
grid-template-columns: 16rem minmax(0, 1fr) !important;
|
||||
gap: 1.5rem !important;
|
||||
align-items: start !important;
|
||||
}
|
||||
|
||||
body.mode-config .config-sidebar {
|
||||
grid-column: 1;
|
||||
position: sticky;
|
||||
top: 4rem;
|
||||
align-self: start;
|
||||
border-right: 1px solid var(--border-soft);
|
||||
padding: 0.75rem;
|
||||
min-height: calc(100vh - 6rem);
|
||||
}
|
||||
|
||||
body.mode-config .config-sidebar.collapsed {
|
||||
width: 2.5rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body.mode-config .config-sidebar.collapsed .sidebar-nav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body.mode-config .config-content {
|
||||
grid-column: 2;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
body.mode-config .config-panel {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body.mode-config .config-panel.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body.mode-config .sidebar-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
body.mode-config .sidebar-nav a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
body.mode-config .sidebar-nav a.active {
|
||||
color: var(--link-hover);
|
||||
}
|
||||
|
||||
body.mode-config .config-section {
|
||||
margin-bottom: 2rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.resource-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||
gap: .75rem;
|
||||
}
|
||||
.resource-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: .35rem;
|
||||
padding: .85rem;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: .5rem;
|
||||
}
|
||||
.queue-settings-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||
gap: .75rem;
|
||||
align-items: end;
|
||||
}
|
||||
.queue-settings-grid label { display: flex; flex-direction: column; gap: .25rem; }
|
||||
.queue-settings-grid label:first-child { flex-direction: row; align-items: center; }
|
||||
.event-definition-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
|
||||
gap: .75rem;
|
||||
align-items: end;
|
||||
}
|
||||
.event-definition-grid label { display: flex; flex-direction: column; gap: .25rem; }
|
||||
.event-definition-grid label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; }
|
||||
.event-definition-grid .event-payload { grid-column: 1 / -1; }
|
||||
.event-definition-grid textarea { font-family: monospace; }
|
||||
.adapter-plugin-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||
gap: .75rem;
|
||||
align-items: end;
|
||||
}
|
||||
.adapter-plugin-grid label { display: flex; flex-direction: column; gap: .25rem; }
|
||||
.adapter-plugin-grid label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; }
|
||||
.adapter-plugin-grid .adapter-template { grid-column: 1 / -1; }
|
||||
.auth-account-form { display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.75rem;align-items:end;margin-bottom:1rem }
|
||||
.auth-account-form label { display:grid;gap:.25rem }
|
||||
.asset-detail-dialog { width:min(72rem,calc(100vw - 2rem));max-height:calc(100vh - 2rem);overflow:auto;background:var(--bg);color:var(--fg);border:1px solid var(--border-soft);border-radius:.5rem;padding:1.25rem }
|
||||
.asset-detail-dialog::backdrop { background:rgba(0,0,0,.55) }
|
||||
.config-path-control,.config-range-control{display:flex;align-items:center;gap:.5rem;min-width:0}.config-path-control input{flex:1;min-width:0}.config-path-control button{flex:0 0 2.2rem;height:2.2rem;padding:0}.config-range-control input{flex:1;min-width:8rem}.config-range-control output{min-width:3.5rem;text-align:end;font-variant-numeric:tabular-nums}
|
||||
.config-path-picker{box-sizing:border-box;width:min(46rem,95vw);height:min(42rem,90dvh);margin:auto;padding:0;overflow:hidden;border:1px solid var(--border);border-radius:.8rem;background:var(--input-bg,var(--bg));color:var(--fg);box-shadow:0 1.5rem 5rem #0009}.config-path-picker[open]{display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto}.config-path-picker::backdrop{background:#0009;backdrop-filter:blur(3px)}.config-path-picker>header,.config-path-picker>nav,.config-path-picker>footer{display:flex;align-items:center;gap:.6rem;padding:.75rem 1rem;background:var(--input-bg,var(--bg))}.config-path-picker>header{justify-content:space-between;border-bottom:1px solid var(--border)}.config-path-picker>header h2{margin:0;font-size:1.05rem}.config-path-picker>header button{border:0;background:transparent;color:inherit;font-size:1.4rem}.config-path-picker>nav{border-bottom:1px solid var(--border-soft)}.config-path-picker>nav code{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.config-path-picker>[data-path-picker-status]{min-height:1.2rem;margin:0;padding:.45rem 1rem}.config-path-picker-list{min-height:10rem;padding:.25rem .5rem;overflow:auto;overscroll-behavior:contain}.config-path-picker-item{display:grid;grid-template-columns:1.5rem minmax(0,1fr) auto;align-items:center;gap:.55rem;width:100%;padding:.5rem .65rem;border:0;border-radius:.35rem;background:transparent;color:inherit;text-align:start}.config-path-picker-item:hover,.config-path-picker-item[aria-selected=true]{background:var(--row-hover,var(--border-soft))}.config-path-picker-item[aria-selected=true]{outline:1px solid var(--accent)}.config-path-picker-item span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.config-path-picker-item small{color:var(--muted)}.config-path-picker>footer{justify-content:flex-end;border-top:1px solid var(--border)}
|
||||
.asset-dialog-close { position:absolute;right:.75rem;top:.75rem }
|
||||
.table-scroll { overflow-x: auto; }
|
||||
|
||||
body.mode-config .config-section input[type="text"],
|
||||
body.mode-config .config-section input[type="number"],
|
||||
body.mode-config .config-section select {
|
||||
max-width: 42rem;
|
||||
}
|
||||
|
||||
body.mode-config .config-section input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 0.6rem;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
body.mode-config .recent-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
body.mode-config .recent-table th,
|
||||
body.mode-config .recent-table td {
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
padding: 0.4rem;
|
||||
}
|
||||
|
||||
body.mode-config .recent-table th {
|
||||
text-align: left;
|
||||
color: var(--muted);
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
body.mode-config .recent-table tr:hover {
|
||||
background: var(--row-hover);
|
||||
}
|
||||
|
||||
/* Dense administration tables. Keep detail/log bodies readable, and scroll
|
||||
wide tables rather than wrapping editable rows or clipping their controls. */
|
||||
body.mode-config :is(.recent-table, .config-form-table) {
|
||||
width:100%; border-collapse:collapse; font-size:.85rem; line-height:1.35;
|
||||
}
|
||||
body.mode-config :is(.recent-table, .config-form-table) :is(th, td) {
|
||||
padding:.22rem .45rem; vertical-align:middle; white-space:nowrap;
|
||||
overflow-wrap:normal; word-break:normal; border-bottom:1px solid var(--border-soft);
|
||||
}
|
||||
body.mode-config :is(.recent-table, .config-form-table) td form {
|
||||
display:inline-flex; align-items:center; gap:.35rem; flex-wrap:nowrap;
|
||||
margin:0; padding:0; vertical-align:middle;
|
||||
}
|
||||
body.mode-config :is(.recent-table, .config-form-table) td form:empty { display:none; }
|
||||
body.mode-config :is(.recent-table, .config-form-table) :is(input:not([type=checkbox]):not([type=hidden]), select, button, .button-link) {
|
||||
box-sizing:border-box; height:1.8rem; min-height:1.8rem; margin:0;
|
||||
padding:.18rem .4rem; font-size:inherit; line-height:1.3; vertical-align:middle;
|
||||
}
|
||||
body.mode-config .recent-table input:not([type=checkbox]):not([type=hidden]):not([type=file]) {
|
||||
width:clamp(7rem,9vw,12rem); min-width:6rem;
|
||||
}
|
||||
body.mode-config .recent-table select { width:auto; min-width:7rem; max-width:24rem; }
|
||||
body.mode-config .config-panel .recent-table input[name=campus_default_lang]:not([type=hidden]) { width:4rem; min-width:4rem; }
|
||||
body.mode-config .config-panel .recent-table input[name=nav_href]:not([type=hidden]) { width:clamp(16rem,35vw,40rem); }
|
||||
body.mode-config :is(.recent-table, .config-form-table) label.config-toggle { min-height:1.8rem; margin:0; gap:.4rem; }
|
||||
body.mode-config .recent-table td :is(p, small) { display:inline; margin:0; }
|
||||
body.mode-config .recent-table td small { margin-inline-start:.45rem; }
|
||||
body.mode-config .recent-table td br { display:none; }
|
||||
body.mode-config .recent-table td code + code { margin-inline-start:.5rem; }
|
||||
body.mode-config .recent-table .cell-secondary { color:var(--muted); margin-inline-start:.5rem; }
|
||||
body.mode-config .recent-table .cell-clip {
|
||||
display:inline-block; max-width:24rem; overflow:hidden; text-overflow:ellipsis;
|
||||
white-space:nowrap; vertical-align:middle;
|
||||
}
|
||||
body.mode-config .recent-table .job-log-detail td { white-space:normal; padding:.5rem; }
|
||||
body.mode-config .recent-table .job-log-detail pre { display:block; white-space:pre-wrap; }
|
||||
body.mode-config .table-scroll { max-width:100%; overflow-x:auto; margin-block:.5rem 1rem; scrollbar-width:thin; scrollbar-color:var(--muted) var(--bg); }
|
||||
#panel-extensions .cell-clip { max-width:14rem; }
|
||||
|
||||
body.mode-config .mono {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
}
|
||||
|
||||
body.mode-config .muted {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.mode-config .config-warning {
|
||||
max-width: 64rem;
|
||||
padding: .7rem .85rem;
|
||||
border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--border));
|
||||
border-radius: .5rem;
|
||||
background: color-mix(in srgb, var(--danger) 9%, transparent);
|
||||
}
|
||||
|
||||
|
||||
/* Shared settings shell and panels */
|
||||
.mode-config > .topbar { gap: 1rem; padding: .5rem 1rem; flex-wrap: wrap; }
|
||||
.mode-config > .topbar nav { display: flex; gap: .8rem; flex-wrap: wrap; }
|
||||
.mode-config .config-sidebar { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
|
||||
.mode-config [hidden] { display: none !important; }
|
||||
.mode-config .config-layout { transition: grid-template-columns .15s; }
|
||||
body.mode-config .config-layout.sidebar-collapsed { grid-template-columns: 3rem minmax(0,1fr) !important; }
|
||||
body.mode-config .config-sidebar { max-height: calc(100vh - 5rem); overflow-y: auto; min-height: 0; }
|
||||
body.mode-config .sidebar-nav { gap: .9rem; }
|
||||
.config-nav-group summary { color: var(--muted); font-size: .85rem; cursor: pointer; padding: .5rem .25rem; }
|
||||
.config-nav-group a { display: block; padding: .55rem .7rem; margin: .15rem 0; border-radius: .35rem; overflow-wrap: anywhere; }
|
||||
.config-nav-group a.active { background: color-mix(in srgb,var(--accent) 15%,transparent); border-inline-start: 3px solid var(--accent); }
|
||||
.config-nav-group a:hover { background: var(--row-hover,var(--border-soft)); }
|
||||
.mode-config .config-content { max-width: 90rem; width: 100%; }
|
||||
.mode-config .config-panel h1 { margin-top: .4rem; font-size: 1.5rem; }
|
||||
.mode-config .config-panel h2 { margin-top: 2rem; font-size: 1.12rem; }
|
||||
.mode-config .config-panel input:not([type=checkbox]):not([type=hidden]):not([type=file]),
|
||||
.mode-config .config-panel select, .mode-config .config-panel textarea { box-sizing: border-box; min-width: 0; width: 100%; }
|
||||
.mode-config .config-panel input[type=file] { max-width: 100%; }
|
||||
.mode-config .config-panel form { margin-bottom: 1.3rem; }
|
||||
.mode-config .settings-form > label { display: grid; gap: .5rem; margin-block: .9rem; }
|
||||
.mode-config .settings-form { max-width: 64rem; }
|
||||
.settings-form fieldset { border: 1px solid var(--border); border-radius: .6rem; padding: 1.25rem; margin-bottom: 1.25rem; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
|
||||
.settings-form fieldset label { display: grid; gap: .4rem; }
|
||||
.settings-form legend { padding: 0 .5rem; color: var(--muted); }
|
||||
.settings-form .wide { grid-column: 1 / -1; }
|
||||
.config-actions { display: flex; gap: .6rem; margin-top: 1rem; align-items: center; }
|
||||
.mode-config .row-actions { white-space: nowrap; }
|
||||
.config-error { color: var(--danger); min-height: 1.5rem; white-space: pre-wrap; }
|
||||
.mode-config .queue-settings-grid { max-width: 48rem; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1.3rem; border: 1px solid var(--border); border-radius: .6rem; padding: 1.25rem; }
|
||||
.mode-config .event-definition-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; border: 1px solid var(--border); border-radius: .6rem; padding: 1.25rem; }
|
||||
.mode-config .event-definition-grid details { grid-column: 1 / -1; }
|
||||
.mode-config .event-definition-grid details > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; padding-top: 1rem; }
|
||||
.mode-config label.config-toggle { display: flex !important; flex-direction: row !important; align-items: center; gap: .7rem; cursor: pointer; min-height: 2.3rem; }
|
||||
.config-toggle::after { content: attr(data-label); }
|
||||
.mode-config input[type=checkbox] { appearance: none; flex: 0 0 2.6rem; width: 2.6rem; height: 1.45rem; border: 1px solid var(--input-border); border-radius: 1rem; background: var(--button-bg); position: relative; padding: 0; vertical-align: middle; cursor: pointer; }
|
||||
.mode-config input[type=checkbox]::before { content: ""; position: absolute; width: 1.03rem; height: 1.03rem; border-radius: 50%; top: .15rem; left: .18rem; background: var(--muted); transition: transform .15s; }
|
||||
.mode-config input[type=checkbox]:checked { background: var(--accent); }
|
||||
.mode-config input[type=checkbox]:checked::before { transform: translateX(1.08rem); background: var(--bg); }
|
||||
.mode-config input[type=checkbox]:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
|
||||
.mode-config input[type=checkbox]:disabled { opacity: .45; cursor: not-allowed; }
|
||||
.mode-config .config-toggle:has(input:disabled) { cursor: not-allowed; opacity: .7; }
|
||||
.resource-charts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; margin-top: 1.25rem; }
|
||||
.resource-charts figure { margin: 0; padding: 1rem; border: 1px solid var(--border); border-radius: .6rem; }
|
||||
.resource-charts figcaption { color: var(--muted); margin-bottom: .75rem; }
|
||||
.resource-charts svg { width: 100%; display: block; color: var(--accent); }
|
||||
.resource-charts .chart-line { fill: none; stroke: currentColor; stroke-width: 2; vector-effect: non-scaling-stroke; }
|
||||
.resource-charts .io-write { stroke-dasharray:5 3; }
|
||||
.resource-charts .io-write, .io-legend .io-write { color:var(--fg); }
|
||||
.io-legend { display:flex; gap:.8rem; font-size:.75rem; color:var(--accent); }
|
||||
.io-legend span::before { content:''; display:inline-block; width:1rem; border-top:2px solid currentColor; margin-right:.25rem; vertical-align:middle; }
|
||||
.io-legend .io-write::before { border-top-style:dashed; }
|
||||
.resource-charts .chart-axis { stroke: var(--border); }
|
||||
.resource-charts text { fill: var(--muted); font: 11px system-ui,sans-serif; }
|
||||
.monitor-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:.75rem; margin:1rem 0; }
|
||||
.monitor-toolbar a { margin-inline-start:auto; }
|
||||
.monitor-header, .monitor-header-actions { display:flex; align-items:center; gap:.8rem; flex-wrap:wrap; }
|
||||
.monitor-header { justify-content:space-between; margin-bottom:1rem; }
|
||||
.mode-config .monitor-header h1 { margin:0; }
|
||||
#resource-time-range { margin:.4rem 0 0; font-size:.8rem; font-variant-numeric:tabular-nums; }
|
||||
.monitor-settings-icon { display:inline-flex; align-items:center; justify-content:center; padding:.5rem; }
|
||||
.monitor-settings-icon svg { width:1.2rem; height:1.2rem; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linejoin:round; }
|
||||
dialog.monitor-settings-dialog { box-sizing:border-box; width:min(44rem,calc(100vw - 2rem)); max-height:90vh; max-height:90svh; margin:auto; padding:0; overflow:auto; background:var(--bg); color:var(--fg); border:1px solid var(--border); border-radius:.8rem; box-shadow:0 1.5rem 5rem #0009; }
|
||||
dialog.monitor-settings-dialog:not([open]) { display:none; }
|
||||
.monitor-settings-dialog::backdrop { background:#0009; backdrop-filter:blur(3px); }
|
||||
.monitor-settings-dialog > header { position:sticky; top:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.75rem 1.25rem; background:var(--bg); border-bottom:1px solid var(--border); }
|
||||
.mode-config .monitor-settings-dialog h2 { margin:0; font-size:1.12rem; }
|
||||
.monitor-settings-dialog > header button { background:transparent; border:0; color:var(--fg); font-size:1.5rem; }
|
||||
.monitor-settings-body { padding:1.25rem; }
|
||||
.monitor-settings-body .config-actions { flex-wrap:wrap; }
|
||||
.resource-chart-scroll { overflow-x:auto; margin-top:1rem; }
|
||||
.execution-dashboard .resource-charts { grid-template-columns:repeat(4,minmax(12rem,1fr)); gap:.6rem; margin-top:.5rem; }
|
||||
.execution-dashboard .resource-charts figure { padding:.6rem; min-width:0; }
|
||||
.execution-dashboard .resource-card span { font-variant-numeric:tabular-nums; }
|
||||
.job-table { font-variant-numeric:tabular-nums; }
|
||||
.job-table td:first-child { overflow-wrap:anywhere; }
|
||||
.job-table small { color:var(--muted); }
|
||||
.job-table button { white-space:nowrap; }
|
||||
.job-log-detail td { padding:.75rem; background:var(--surface-alt,var(--surface)); }
|
||||
.job-log-detail pre { white-space:pre-wrap; overflow-wrap:anywhere; max-height:22rem; overflow:auto; margin:.5rem 0; font-size:.8rem; }
|
||||
.job-log-detail[hidden] { display:none; }
|
||||
.execution-dashboard .config-error:empty, #scheduler-queue-state:empty { display:none; }
|
||||
.mode-config #bookmark-rows td:first-child { width: 25%; }
|
||||
.mode-config #bookmark-rows td:nth-child(2) { width: 6rem; }
|
||||
@media (max-width: 760px) {
|
||||
body.mode-config .config-main { padding: .5rem; }
|
||||
body.mode-config .config-layout { grid-template-columns: 1fr !important; gap: .8rem !important; }
|
||||
body.mode-config .config-sidebar { grid-column: 1; position: static; max-height: 15rem; border: 1px solid var(--border); padding: .5rem; }
|
||||
body.mode-config .config-content { grid-column: 1; }
|
||||
body.mode-config .config-layout.sidebar-collapsed { grid-template-columns: 1fr !important; }
|
||||
body.mode-config .config-sidebar.collapsed { width: auto; }
|
||||
.resource-charts, .mode-config .event-definition-grid, .mode-config .queue-settings-grid, .settings-form fieldset { grid-template-columns: 1fr; }
|
||||
}
|
||||
/* Keep modal layout independent of compact administration tables. */
|
||||
body.mode-config:has(.domain-entry-dialog[open]) { overflow: hidden; }
|
||||
body.mode-config .domain-entry-dialog {
|
||||
box-sizing: border-box;
|
||||
width: min(46rem, calc(100vw - 2rem));
|
||||
max-height: 90vh;
|
||||
max-height: 90dvh;
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
overflow: auto;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--muted) var(--bg);
|
||||
white-space: normal;
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: .7rem;
|
||||
box-shadow: 0 1.5rem 5rem #0008;
|
||||
}
|
||||
.domain-entry-dialog:not([open]) { display: none; }
|
||||
.domain-entry-dialog::backdrop { background: #0009; }
|
||||
.domain-entry-dialog > header {
|
||||
position: sticky; top: 0; z-index: 1;
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
gap: 1rem; padding: .8rem 1rem;
|
||||
background: var(--bg); border-bottom: 1px solid var(--border);
|
||||
}
|
||||
body.mode-config .domain-entry-dialog h2 { margin: 0; min-width: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
|
||||
.domain-entry-dialog [data-domain-entry-close] { flex: 0 0 auto; font-size: 1.4rem; min-width: 2rem; min-height: 2rem; padding: .1rem .4rem; }
|
||||
.domain-entry-body { padding: 1rem; }
|
||||
.domain-entry-body > form { display: block; margin: 0; padding: 0; }
|
||||
.domain-entry-body > form + form { margin-top: 1rem; }
|
||||
.domain-entry-dialog fieldset { display: grid; grid-template-columns: minmax(0,1fr); gap: .75rem; min-width: 0; margin: 0; padding: .9rem; border: 1px solid var(--border); border-radius: .4rem; }
|
||||
.domain-entry-dialog legend { padding: 0 .4rem; font-weight: 600; }
|
||||
.domain-entry-dialog label:not(.config-toggle) { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; gap: .5rem 1rem; margin: 0; overflow-wrap: anywhere; }
|
||||
body.mode-config .domain-entry-dialog .config-toggle { justify-content: flex-start; }
|
||||
body.mode-config .domain-entry-dialog input:not([type=checkbox]):not([type=hidden]), body.mode-config .domain-entry-dialog select {
|
||||
display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
|
||||
min-height: 2.2rem; margin: 0; padding: .35rem .5rem; font: inherit;
|
||||
background: var(--input-bg, var(--bg)); color: var(--fg); border: 1px solid var(--input-border, var(--border)); border-radius: .25rem;
|
||||
}
|
||||
.domain-entry-dialog button[type=submit] { justify-self: end; width: auto; min-height: 2.2rem; }
|
||||
.domain-entry-dialog p { display: block; margin: .75rem 0; white-space: normal; overflow-wrap: anywhere; font-size: .85rem; line-height: 1.6; color: var(--muted); }
|
||||
.domain-entry-dialog :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
@media (max-width: 560px) {
|
||||
body.mode-config .domain-entry-dialog { width: calc(100vw - 1rem); max-height: 95vh; max-height: 95dvh; }
|
||||
.domain-entry-body { padding: .65rem; }
|
||||
.domain-entry-dialog label:not(.config-toggle) { grid-template-columns: minmax(0,1fr); }
|
||||
}
|
||||
.config-create-heading{display:flex;align-items:center;gap:.45rem}.config-icon-button{display:inline-grid;place-items:center;width:1.8rem;height:1.8rem;border:1px solid var(--border);border-radius:.35rem;background:transparent;color:var(--link);cursor:pointer;font-size:1.2rem}.config-icon-button:hover{background:var(--button-hover-bg)}.config-form-dialog{width:min(42rem,calc(100vw - 2rem));max-height:calc(100vh - 2rem);padding:0;border:1px solid var(--border);border-radius:.7rem;background:var(--bg);color:var(--fg);box-shadow:0 1.5rem 5rem #0009}.config-form-dialog::backdrop{background:#0008;backdrop-filter:blur(2px)}.config-form-dialog>header{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;padding:.75rem 1rem;background:var(--bg);border-bottom:1px solid var(--border);z-index:1}.config-form-dialog>header h2{margin:0;font-size:1rem}.config-form-dialog>header button{border:0;background:transparent;color:var(--fg);font-size:1.4rem;cursor:pointer}.config-form-dialog>form{padding:1rem}.config-form-dialog .table-scroll{overflow:visible}.config-form-dialog .config-form-table{margin:0;width:100%}
|
||||
.broadcast-form { margin-block: .75rem 1rem; }
|
||||
.broadcast-form .config-form-table { width: 100%; margin: 0; }
|
||||
.broadcast-form th { width: 15rem; text-align: left; white-space: nowrap; }
|
||||
.broadcast-form td { width: auto; }
|
||||
.broadcast-form :is(input,textarea,select) { width: min(100%, 34rem); box-sizing: border-box; }
|
||||
@@ -0,0 +1,384 @@
|
||||
.lightbox-trigger {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
.content-lightbox {
|
||||
width: 100vw;
|
||||
max-width: none;
|
||||
height: 100vh;
|
||||
max-height: none;
|
||||
margin: 0;
|
||||
padding: 2.5rem;
|
||||
border: 0;
|
||||
background: rgba(5, 8, 14, .96);
|
||||
}
|
||||
|
||||
.content-lightbox::backdrop {
|
||||
background: rgba(0, 0, 0, .9);
|
||||
}
|
||||
|
||||
.content-lightbox img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.content-lightbox [data-lightbox-close] {
|
||||
position: fixed;
|
||||
z-index: 2;
|
||||
top: .8rem;
|
||||
right: 1rem;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
font-size: 1.7rem;
|
||||
}
|
||||
|
||||
.media-player {
|
||||
overflow: hidden;
|
||||
width: min(100%, 70rem);
|
||||
margin: 1rem auto;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: .65rem;
|
||||
background: color-mix(in srgb, var(--input-bg) 94%, black);
|
||||
box-shadow: 0 .8rem 2rem rgba(0, 0, 0, .18);
|
||||
}
|
||||
|
||||
.media-player audio,
|
||||
.media-player video {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
background: #05070a;
|
||||
}
|
||||
|
||||
.audio-player {
|
||||
padding-top: .45rem;
|
||||
}
|
||||
|
||||
.media-player-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: .6rem;
|
||||
min-height: 2.8rem;
|
||||
padding: .45rem .65rem;
|
||||
color: var(--muted);
|
||||
font: .78rem "JetBrains Mono", monospace;
|
||||
}
|
||||
|
||||
.media-player-toolbar [data-media-time] {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.media-player-toolbar label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: .35rem;
|
||||
}
|
||||
|
||||
.media-player-toolbar select,
|
||||
.media-player-toolbar button {
|
||||
min-height: 2rem;
|
||||
padding: .25rem .55rem;
|
||||
}
|
||||
|
||||
.children-icon-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
|
||||
gap: .75rem;
|
||||
}
|
||||
|
||||
.children-icon-item {
|
||||
display: grid;
|
||||
grid-template-rows: 7rem auto;
|
||||
gap: .45rem;
|
||||
min-width: 0;
|
||||
padding: .5rem;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: .4rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.children-preview,
|
||||
.children-type-icon {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 7rem;
|
||||
background: var(--input-bg);
|
||||
}
|
||||
|
||||
.children-preview img,
|
||||
.children-preview video,
|
||||
.children-preview iframe,
|
||||
.children-preview canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
object-fit: contain;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.children-type-icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.children-type-icon svg {
|
||||
width: 3.25rem;
|
||||
height: 3.25rem;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: 1.5;
|
||||
}
|
||||
|
||||
.children-type-folder { color: #e8bd62; }
|
||||
.children-type-archive { color: #b998dc; }
|
||||
.children-type-audio { color: #74c7b8; }
|
||||
.children-type-code { color: #79aee8; }
|
||||
.children-type-package { color: #d88d78; }
|
||||
|
||||
.children-preview-badge {
|
||||
position: absolute;
|
||||
right: .3rem;
|
||||
bottom: .3rem;
|
||||
padding: .12rem .32rem;
|
||||
border-radius: .2rem;
|
||||
background: rgba(0, 0, 0, .72);
|
||||
color: white;
|
||||
font: .66rem "JetBrains Mono", monospace;
|
||||
}
|
||||
|
||||
.children-icon-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.children-loading {
|
||||
padding: .7rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.children-preview-pending::before {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
content: "";
|
||||
background:
|
||||
linear-gradient(
|
||||
100deg,
|
||||
transparent 30%,
|
||||
color-mix(in srgb, var(--fg) 8%, transparent) 50%,
|
||||
transparent 70%
|
||||
);
|
||||
background-size: 200% 100%;
|
||||
animation: children-preview-pulse 1.4s linear infinite;
|
||||
}
|
||||
|
||||
.children-preview-ready::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.children-next {
|
||||
height: 2px;
|
||||
margin-top: .5rem;
|
||||
}
|
||||
|
||||
@keyframes children-preview-pulse {
|
||||
from { background-position: 200% 0; }
|
||||
to { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
.children-detail {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.children-detail th,
|
||||
.children-detail td {
|
||||
padding: .45rem .6rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.breadcrumb-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.children-view-switcher {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: .3rem;
|
||||
}
|
||||
|
||||
.children-view-switcher[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.children-view-switcher button {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: .3rem;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.children-view-switcher button:hover,
|
||||
.children-view-switcher button.active {
|
||||
border-color: var(--link);
|
||||
color: var(--link);
|
||||
}
|
||||
|
||||
.children-entry {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.children-entry.children-selected {
|
||||
outline: 2px solid var(--link);
|
||||
outline-offset: -2px;
|
||||
background: color-mix(in srgb, var(--link) 16%, transparent);
|
||||
}
|
||||
|
||||
.children-context-menu {
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
min-width: 13rem;
|
||||
padding: .35rem;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: .35rem;
|
||||
background: var(--input-bg);
|
||||
box-shadow: 0 .6rem 1.5rem rgba(0, 0, 0, .3);
|
||||
}
|
||||
|
||||
.children-context-menu button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: .5rem .7rem;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--fg);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.children-context-menu button:hover {
|
||||
background: color-mix(in srgb, var(--link) 14%, transparent);
|
||||
}
|
||||
|
||||
.children-context-group {
|
||||
margin: .25rem 0;
|
||||
padding: .35rem 0;
|
||||
border-top: 1px solid var(--border-soft);
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
.children-context-group > span {
|
||||
display: block;
|
||||
padding: .2rem .7rem;
|
||||
color: var(--muted);
|
||||
font-size: .78rem;
|
||||
}
|
||||
|
||||
.children-context-group a {
|
||||
display: block;
|
||||
padding: .5rem .7rem;
|
||||
color: var(--fg);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.children-context-group a:hover {
|
||||
background: color-mix(in srgb, var(--link) 14%, transparent);
|
||||
}
|
||||
|
||||
.search-unified-results .search-view-icon,
|
||||
.search-unified-results .search-view-detail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.search-unified-results[data-search-view="icon"] .search-view-icon {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.search-unified-results[data-search-view="detail"] .search-view-detail {
|
||||
display: table;
|
||||
}
|
||||
|
||||
.search-unified-results[data-search-view="icon"] .search-view-list,
|
||||
.search-unified-results[data-search-view="detail"] .search-view-list {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 38rem) {
|
||||
.media-player-toolbar {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
.excalidraw-plugin-frame {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 12rem);
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 0.4rem;
|
||||
background: var(--input-bg);
|
||||
}
|
||||
|
||||
.excalidraw-plugin-frame[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.excalidraw-viewer {
|
||||
display: grid;
|
||||
grid-template-rows: auto minmax(24rem, calc(100vh - 14rem));
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 0.4rem;
|
||||
background: var(--input-bg);
|
||||
}
|
||||
|
||||
.excalidraw-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 1rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
.excalidraw-viewer canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.excalidraw-viewer canvas:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
[data-projection-status]:empty { display: none; }
|
||||
.pdf-toolbar [data-projection-status] { max-width: 40em; font-size: .85em; color: var(--muted); }
|
||||
.print-actions{display:inline-flex;align-items:center;gap:.45rem}.print-actions a{display:grid;place-items:center;min-width:2rem;height:2rem;padding:0 .45rem;border:1px solid var(--border);border-radius:.35rem;color:var(--link);text-decoration:none;font-weight:700}.print-actions a:hover{background:var(--button-hover-bg);border-color:var(--link)}
|
||||
.viewer-shortcut-dialog{width:min(34rem,calc(100vw - 2rem));padding:0;border:1px solid var(--border);border-radius:.7rem;background:var(--bg);color:var(--fg);box-shadow:0 1.5rem 5rem #0009}.viewer-shortcut-dialog::backdrop{background:#0008}.viewer-shortcut-dialog form{margin:0;padding:1rem}.viewer-shortcut-dialog header{display:flex;align-items:center;justify-content:space-between;gap:1rem}.viewer-shortcut-dialog header h2{margin:0;font-size:1.1rem}.viewer-shortcut-dialog header button{border:0;background:transparent;color:var(--fg);font-size:1.4rem}.viewer-shortcut-content{display:grid;gap:.65rem;margin-top:.8rem}.viewer-shortcut-content label{display:grid;gap:.25rem}.viewer-shortcut-content input{box-sizing:border-box;width:100%;padding:.5rem;background:var(--input-bg,var(--bg));color:var(--fg);border:1px solid var(--border)}.viewer-shortcut-content a,.viewer-shortcut-content button{width:max-content;padding:.4rem .7rem;color:var(--link)}
|
||||
.viewer-shortcut-dialog{max-height:min(80vh,42rem);overflow:auto}.viewer-shortcut-dialog form{box-sizing:border-box;min-width:0}.viewer-shortcut-dialog input,.viewer-shortcut-dialog button,.viewer-shortcut-dialog a{font:inherit}.viewer-shortcut-dialog button,.viewer-shortcut-dialog a{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--border);border-radius:.35rem;background:var(--surface,var(--bg));text-decoration:none;cursor:pointer}.viewer-shortcut-dialog button:hover,.viewer-shortcut-dialog a:hover{background:var(--row-hover,var(--surface,var(--bg)))}.viewer-find-form{display:grid;gap:.65rem}.viewer-find-form input{min-width:0}.viewer-find-suggestions{display:grid;gap:.15rem;max-height:18rem;overflow:auto}.viewer-find-suggestions a{display:block;width:auto;justify-content:flex-start;border-color:transparent;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.viewer-shortcut-grid{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:.45rem .8rem}.viewer-shortcut-grid kbd{padding:.2rem .45rem;border:1px solid var(--border);border-radius:.3rem;background:var(--surface,var(--bg));font-family:var(--mono,monospace);font-size:.85em}
|
||||
.viewer-children-dialog-content{display:block;max-height:60vh;overflow:auto}.viewer-children-dialog-content ul{display:grid;gap:.25rem;margin:0;padding:0;list-style:none}.viewer-children-dialog-content a{width:auto;justify-content:flex-start;border-color:transparent;text-align:left}.viewer-children-dialog-content table{width:100%;border-collapse:collapse}.viewer-children-dialog-content th,.viewer-children-dialog-content td{padding:.4rem;border-bottom:1px solid var(--border);text-align:start}
|
||||
@@ -0,0 +1,5 @@
|
||||
#tasks-dav-dialog{box-sizing:border-box;width:min(800px,96vw);max-height:92dvh;overflow:auto;color:var(--fg);background:var(--bg)!important;border:1px solid var(--border,#8885);border-radius:1rem;padding:1rem;box-shadow:0 1rem 4rem #0005}
|
||||
#tasks-dav-dialog::backdrop{background:#0007;backdrop-filter:blur(3px)}
|
||||
#tasks-dav-dialog header{display:flex;align-items:center;justify-content:space-between;gap:1rem}#tasks-dav-dialog h2{font-size:1.2rem;margin:.25rem 0}#tasks-dav-dialog p{font-size:.9rem}#tasks-dav-dialog form{display:flex;flex-wrap:wrap;gap:.4rem;margin:1rem 0}#tasks-dav-dialog form>input{flex:1;min-width:10rem}#tasks-dav-dialog>input,#tasks-dav-dialog section input{width:100%}#tasks-dav-dialog input,#tasks-dav-dialog select,#tasks-dav-dialog button{box-sizing:border-box;font:inherit;color:var(--fg);background:var(--bg);border:1px solid var(--border,#8885);border-radius:.4rem;padding:.5rem;min-width:0}#tasks-dav-dialog button{cursor:pointer}#tasks-dav-dialog :focus-visible{outline:2px solid var(--accent);outline-offset:2px}#tasks-dav-dialog section{padding:.7rem;border:1px solid var(--accent);border-radius:.5rem}#tasks-dav-dialog section label{display:block;font-size:.85rem;margin:.3rem 0}#tasks-dav-dialog .task-dav-table{overflow:auto}#tasks-dav-dialog table{width:100%;border-collapse:collapse;font-size:.85rem}#tasks-dav-dialog th,#tasks-dav-dialog td{padding:.35rem;text-align:left;border-bottom:1px solid var(--border,#8885)}#tasks-dav-dialog td:first-child{overflow-wrap:anywhere}#tasks-dav-dialog [role=status]{color:var(--danger,#d55)}
|
||||
#tasks-dav-dialog .dav-compat-toggle{display:flex;align-items:center;gap:.5rem;width:100%;font-size:.9rem}#tasks-dav-dialog .dav-compat-toggle input{width:1.2rem;height:1.2rem;min-height:0;flex:none;accent-color:var(--accent)}#tasks-dav-dialog .dav-compat-help{width:100%;margin:.15rem 0;font-size:.85rem;color:var(--muted,var(--fg))}
|
||||
@media(max-width:760px){#tasks-dav-dialog{width:100%;max-width:none;height:100dvh;max-height:100dvh;margin:0;border-radius:0}#tasks-dav-dialog input,#tasks-dav-dialog select,#tasks-dav-dialog button{min-height:44px;font-size:16px}#tasks-dav-dialog .dav-compat-toggle{min-height:44px}}
|
||||
@@ -0,0 +1,8 @@
|
||||
/* Vendored Nerd Fonts v3.2.1; see /static/fonts/hack/LICENSE.md. */
|
||||
@font-face {
|
||||
font-family: "Hack Nerd Font";
|
||||
src: url("/static/fonts/hack/HackNerdFont-Regular.ttf") format("truetype");
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
.home-wallpaper { position:fixed; inset:0; z-index:0; width:100%; height:100%; object-fit:cover; object-position:center; pointer-events:none; user-select:none; }
|
||||
body:has(> .home-wallpaper) { isolation:isolate; }
|
||||
.mode-home > :is(.topbar,main), .is-home-page > :is(.topbar,main), .home-landing > .home-main, body:has(> .home-wallpaper) > .periodical-shell { position:relative; z-index:1; }
|
||||
.home-landing:has(> .home-wallpaper), .mode-home:has(> .home-wallpaper), .is-home-page:has(> .home-wallpaper) { background-color:var(--bg); }
|
||||
.home-landing,.mode-home,.is-home-page { --home-glass-opacity:58%; }
|
||||
.home-landing { margin: 0; min-height: 100vh; font-family: system-ui, sans-serif; }
|
||||
.home-landing * { box-sizing: border-box; }
|
||||
.home-landing a { text-decoration: none; }
|
||||
.home-account { position: absolute; top: .7rem; right: 1rem; display: flex; align-items: center; gap: .55rem; z-index: 5; padding:.3rem .45rem; border:1px solid color-mix(in srgb,var(--border) 70%,var(--accent) 30%); border-radius:999px; background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); box-shadow:0 .4rem 1.4rem #0003; -webkit-backdrop-filter:blur(12px) saturate(115%); backdrop-filter:blur(12px) saturate(115%); }
|
||||
.home-account .auth-menu { position: relative; }
|
||||
.home-wiki-title { position:absolute; z-index:5; top:1rem; left:1.25rem; min-width:0; max-width:min(22rem,40vw); margin:0; font-size:1rem; font-weight:600; line-height:2.25rem; }
|
||||
.home-wiki-title a { display:block; overflow:hidden; color:var(--fg); text-overflow:ellipsis; white-space:nowrap; }
|
||||
.home-account .city-map-launch { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: .4rem; border-radius: 50%; background: transparent; color: var(--fg); }
|
||||
.home-main { width: min(100% - 2rem, 58rem); margin: auto; padding: 6rem 0 3rem; }
|
||||
.home-layout-directory .home-main { width:min(100% - 3rem,100rem); }
|
||||
.home-search { width: min(100%, 40rem); margin: auto; text-align: center; }
|
||||
.home-search-combobox { position:relative; width:100%; z-index:6; }
|
||||
.home-search form { display: flex; border: 1px solid color-mix(in srgb,var(--border) 72%,var(--accent) 28%); background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); border-radius: 2rem; padding: .35rem .5rem .35rem 1rem; box-shadow:0 .45rem 1.5rem #0002; -webkit-backdrop-filter:blur(12px) saturate(115%); backdrop-filter:blur(12px) saturate(115%); }
|
||||
.home-search form:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
.home-search input[type=search] { min-width: 0; width: 100%; font-size: 1.1rem; border: 0; background: transparent; outline: none; }
|
||||
.home-search button { flex-shrink: 0; border: 0; border-radius: 50%; padding: .65rem; display: grid; place-items: center; background:color-mix(in srgb,var(--button-bg,var(--bg)) 76%,transparent); }
|
||||
.home-search button svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
|
||||
.home-search-suggestions { position:absolute; z-index:8; top:calc(100% + .55rem); left:0; right:0; max-height:max(8rem,min(28rem,calc(50dvh - 5rem))); padding:.4rem; overflow:auto; overscroll-behavior:contain; border:1px solid color-mix(in srgb,var(--border) 70%,var(--accent) 30%); border-radius:.85rem; background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); box-shadow:0 1rem 2.6rem #0007; -webkit-backdrop-filter:blur(16px) saturate(120%); backdrop-filter:blur(16px) saturate(120%); text-align:left; }
|
||||
.home-search-suggestions[hidden] { display:none; }
|
||||
.home-search-suggestion { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:.7rem; min-width:0; padding:.58rem .7rem; border-radius:.55rem; color:var(--fg); text-decoration:none; }
|
||||
.home-search-suggestion:hover,.home-search-suggestion[aria-selected="true"] { background:color-mix(in srgb,var(--accent) 16%,transparent); outline:none; }
|
||||
.home-search-suggestion-kind { min-width:3.4rem; padding:.12rem .35rem; overflow:hidden; border:1px solid color-mix(in srgb,var(--accent) 42%,var(--border)); border-radius:999px; color:var(--muted); font-size:.68rem; text-align:center; text-overflow:ellipsis; white-space:nowrap; }
|
||||
.home-search-suggestion-main { display:grid; min-width:0; gap:.12rem; }
|
||||
.home-search-suggestion-main strong,.home-search-suggestion-main small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||
.home-search-suggestion-main strong { color:var(--fg); font-size:.92rem; font-weight:620; }
|
||||
.home-search-suggestion-main small { color:var(--muted); font: .75rem "Hack Nerd Font",monospace; }
|
||||
.home-search-suggestion-open { color:var(--muted); font-size:.75rem; white-space:nowrap; }
|
||||
.home-search-suggestion-search { margin-top:.3rem; border-top:1px solid var(--border-soft,var(--border)); border-radius:.25rem .25rem .55rem .55rem; }
|
||||
.home-search-suggestion-search .home-search-suggestion-kind { min-width:2rem; border:0; font-size:1rem; }
|
||||
.mode-home .topbar-search,
|
||||
.is-home-page .topbar-search { border:1px solid color-mix(in srgb,var(--border) 72%,var(--accent) 28%); border-radius:.45rem; background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); box-shadow:0 .35rem 1.2rem #0002; -webkit-backdrop-filter:blur(12px) saturate(115%); backdrop-filter:blur(12px) saturate(115%); }
|
||||
.mode-home .topbar-search:focus-within,
|
||||
.is-home-page .topbar-search:focus-within { outline:2px solid var(--accent); outline-offset:2px; }
|
||||
.mode-home .topbar-search input[name="q"],
|
||||
.is-home-page .topbar-search input[name="q"] { border-color:transparent; background:transparent; box-shadow:none; outline:none; }
|
||||
body:has(> .home-wallpaper) .home-search form,
|
||||
body:has(> .home-wallpaper) .topbar-search { background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); box-shadow:0 .55rem 1.8rem #0005; }
|
||||
:is(body.mode-home,body.is-home-page,body.home-landing,body.periodical-top) :is(.notification-dialog,.calendar-upcoming-dialog,.city-map-dialog,dialog.home-bookmark-manager,.auth-menu-popover),
|
||||
body.periodical-top .periodical-shell dialog { border-color:color-mix(in srgb,var(--border) 72%,var(--accent) 28%); background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); box-shadow:0 1.5rem 5rem #0009; -webkit-backdrop-filter:blur(16px) saturate(120%); backdrop-filter:blur(16px) saturate(120%); }
|
||||
:is(body.mode-home,body.is-home-page,body.home-landing,body.periodical-top) :is(.notification-dialog,.calendar-upcoming-dialog,dialog.home-bookmark-manager) header,
|
||||
:is(body.mode-home,body.is-home-page,body.home-landing,body.periodical-top) dialog.home-bookmark-manager .bookmark-savebar,
|
||||
body.periodical-top .periodical-shell dialog header { background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); }
|
||||
body:has(> .home-wallpaper) :is(.notification-dialog,.calendar-upcoming-dialog,.city-map-dialog,dialog.home-bookmark-manager,.auth-menu-popover),
|
||||
body.periodical-top:has(> .home-wallpaper) .periodical-shell dialog { background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); }
|
||||
body:has(> .home-wallpaper) :is(.notification-dialog,.calendar-upcoming-dialog,dialog.home-bookmark-manager) header,
|
||||
body:has(> .home-wallpaper) dialog.home-bookmark-manager .bookmark-savebar,
|
||||
body.periodical-top:has(> .home-wallpaper) .periodical-shell dialog header { background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); }
|
||||
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
|
||||
body:has(> .home-wallpaper) .home-search form,
|
||||
body:has(> .home-wallpaper) .topbar-search { background:color-mix(in srgb,var(--bg) 90%,transparent); }
|
||||
body:has(> .home-wallpaper) :is(.notification-dialog,.calendar-upcoming-dialog,.city-map-dialog,dialog.home-bookmark-manager,.auth-menu-popover),
|
||||
body.periodical-top:has(> .home-wallpaper) .periodical-shell dialog { background:color-mix(in srgb,var(--bg) 92%,transparent); }
|
||||
}
|
||||
.home-shortcuts { display:flex; width:max-content; max-width:100%; margin:1.35rem auto 0; gap:.25rem; }
|
||||
.home-shortcuts a { display:grid; place-items:center; width:2.45rem; height:2.45rem; border-radius:50%; color:var(--fg); }
|
||||
.home-shortcuts a:hover,.home-shortcuts a:focus-visible { background:color-mix(in srgb,var(--accent) 17%,transparent); color:var(--accent); outline:2px solid color-mix(in srgb,var(--accent) 42%,transparent); outline-offset:-2px; }
|
||||
.home-shortcuts svg { width:1.35rem; height:1.35rem; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
|
||||
.home-appearance-launch { position:fixed; z-index:7; right:1rem; bottom:1rem; display:grid; place-items:center; width:2.6rem; height:2.6rem; padding:.55rem; border:1px solid color-mix(in srgb,var(--border) 70%,var(--accent) 30%); border-radius:50%; background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); color:var(--fg); box-shadow:0 .45rem 1.5rem #0005; -webkit-backdrop-filter:blur(12px) saturate(115%); backdrop-filter:blur(12px) saturate(115%); cursor:pointer; }
|
||||
.home-appearance-launch:hover,.home-appearance-launch:focus-visible { border-color:var(--accent); color:var(--accent); outline:2px solid color-mix(in srgb,var(--accent) 42%,transparent); outline-offset:2px; }
|
||||
.home-appearance-launch svg { width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linejoin:round; }
|
||||
.home-appearance-dialog { width:min(30rem,calc(100vw - 2rem)); box-sizing:border-box; margin:auto; padding:0; border:1px solid color-mix(in srgb,var(--border) 70%,var(--accent) 30%); border-radius:.9rem; background:color-mix(in srgb,var(--bg) var(--home-glass-opacity,58%),transparent); color:var(--fg); box-shadow:0 1.5rem 5rem #0009; -webkit-backdrop-filter:blur(18px) saturate(120%); backdrop-filter:blur(18px) saturate(120%); }
|
||||
.home-appearance-dialog::backdrop { background:#0008; -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); }
|
||||
.home-appearance-dialog form { display:grid; gap:1rem; margin:0; padding:1.2rem; }
|
||||
.home-appearance-dialog header,.home-appearance-dialog footer { display:flex; align-items:center; gap:.75rem; }
|
||||
.home-appearance-dialog header { justify-content:space-between; }
|
||||
.home-appearance-dialog h2,.home-appearance-dialog p { margin:0; }
|
||||
.home-appearance-dialog h2 { font-size:1.1rem; }
|
||||
.home-appearance-dialog header button { border:0; background:transparent; color:inherit; font-size:1.5rem; cursor:pointer; }
|
||||
.home-appearance-dialog label { display:grid; gap:.55rem; }
|
||||
.home-appearance-range { display:grid; grid-template-columns:minmax(0,1fr) 3.5rem; align-items:center; gap:.75rem; }
|
||||
.home-appearance-range input { width:100%; accent-color:var(--accent); }
|
||||
.home-appearance-range output { color:var(--fg); font-variant-numeric:tabular-nums; text-align:right; }
|
||||
.home-appearance-dialog footer { justify-content:flex-end; }
|
||||
.home-appearance-dialog footer [role=status] { min-width:0; margin-right:auto; color:var(--muted); }
|
||||
.home-appearance-dialog footer button { padding:.5rem .8rem; border:1px solid var(--border); border-radius:.4rem; background:color-mix(in srgb,var(--button-bg,var(--bg)) var(--home-glass-opacity,58%),transparent); color:var(--fg); cursor:pointer; }
|
||||
.home-search ~ .home-bookmarks { margin-top: 4rem; }
|
||||
.home-bookmarks h2 { font-size: 1rem; font-weight: 500; color: var(--muted); }
|
||||
.home-bookmark-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .75rem; }
|
||||
.home-bookmark { display: flex; gap: .8rem; align-items: center; padding: 1.25rem; border: 1px solid var(--border); border-radius: .65rem; overflow-wrap: anywhere; }
|
||||
.home-bookmark:hover { background: var(--button-hover-bg); border-color: var(--accent); }
|
||||
.home-empty { color: var(--muted); }
|
||||
.home-layout-search .home-main { min-height: 100vh; min-height: 100svh; display: grid; align-items: center; padding-block: 5rem; }
|
||||
.home-layout-directory .home-main { padding-top: max(7rem, 18vh); }
|
||||
@media (max-width: 600px) { .home-layout-directory .home-main { padding-top: 7rem; } .home-search ~ .home-bookmarks { margin-top: 2.5rem; } }
|
||||
.home-paged { height:100vh; height:100dvh; overflow:hidden; overscroll-behavior:none; }
|
||||
.home-paged .home-main[data-home-pager] { display:grid; grid-template-rows:100vh 100vh; grid-template-rows:100dvh 100dvh; align-items:stretch; width:min(100% - 3rem,100rem); height:200vh; height:200dvh; margin:auto; padding:0; transform:translate3d(0,var(--home-pager-drag),0); transition:transform .42s cubic-bezier(.22,.8,.24,1); will-change:transform; }
|
||||
.home-paged .home-main[data-home-page="bookmarks"] { transform:translate3d(0,calc(-100dvh + var(--home-pager-drag)),0); }
|
||||
.home-paged .home-main[data-home-dragging] { transition:none; user-select:none; }
|
||||
.home-pager-page { position:relative; min-width:0; height:100vh; height:100dvh; }
|
||||
.home-search-page { display:grid; place-items:center; padding:5rem 0; touch-action:pan-x; }
|
||||
.home-search-page .home-search { align-self:center; }
|
||||
.home-bookmarks-page { padding:4.5rem 0 3rem; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; touch-action:pan-y; }
|
||||
.home-bookmarks-page-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin:0 0 1.25rem; padding-inline:.25rem; }
|
||||
.home-bookmarks-page-head h1 { margin:0; font-size:clamp(1.45rem,3vw,2rem); font-weight:550; }
|
||||
.home-page-cue { display:grid; place-items:center; width:2.5rem; height:2.5rem; padding:.5rem; border:1px solid color-mix(in srgb,var(--border) 72%,var(--accent) 28%); border-radius:50%; background:color-mix(in srgb,var(--bg) 62%,transparent); color:var(--fg); box-shadow:0 .35rem 1.2rem #0003; -webkit-backdrop-filter:blur(10px) saturate(115%); backdrop-filter:blur(10px) saturate(115%); cursor:pointer; }
|
||||
.home-page-cue svg { width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
|
||||
.home-page-cue-next { position:absolute; z-index:2; left:50%; bottom:1.25rem; transform:translateX(-50%); animation:home-page-cue 2.4s ease-in-out infinite; }
|
||||
.home-page-cue:hover,.home-page-cue:focus-visible { border-color:var(--accent); color:var(--accent); outline:2px solid color-mix(in srgb,var(--accent) 45%,transparent); outline-offset:2px; }
|
||||
.home-page-indicator { position:fixed; z-index:4; top:50%; right:max(.7rem,env(safe-area-inset-right)); display:grid; gap:.55rem; transform:translateY(-50%); }
|
||||
.home-page-indicator button { width:.65rem; height:.65rem; padding:0; border:1px solid color-mix(in srgb,var(--fg) 62%,transparent); border-radius:50%; background:color-mix(in srgb,var(--bg) 62%,transparent); box-shadow:0 1px 5px #0005; cursor:pointer; }
|
||||
.home-page-indicator button[aria-current="page"] { border-color:var(--accent); background:var(--accent); transform:scale(1.25); }
|
||||
@keyframes home-page-cue { 0%,70%,100%{translate:0 0} 82%{translate:0 .28rem} 91%{translate:0 0} }
|
||||
@media(max-width:600px) { .home-account{right:.5rem;gap:.35rem;padding:.2rem .3rem}.home-wiki-title{left:.75rem;max-width:35vw;font-size:.95rem}.home-appearance-launch{right:.7rem;bottom:.7rem}.home-paged .home-main[data-home-pager]{width:min(100% - 1.5rem,100rem)} .home-search-page{padding-inline:.35rem} .home-bookmarks-page{padding-top:4.25rem} .home-page-indicator{right:.35rem} }
|
||||
@media(max-width:600px) { .home-search-suggestions{max-height:max(8rem,calc(50dvh - 4rem))} .home-search-suggestion{grid-template-columns:minmax(0,1fr) auto;gap:.4rem} .home-search-suggestion-kind{display:none} }
|
||||
@media(prefers-reduced-motion:reduce) { .home-paged .home-main[data-home-pager]{transition:none} .home-page-cue-next{animation:none} }
|
||||
@media (forced-colors:active) {
|
||||
.home-search form,
|
||||
.mode-home .topbar-search,
|
||||
.is-home-page .topbar-search,
|
||||
:is(body.mode-home,body.is-home-page,body.home-landing,body.periodical-top) :is(.notification-dialog,.calendar-upcoming-dialog,.city-map-dialog,dialog.home-bookmark-manager,.auth-menu-popover),
|
||||
body.periodical-top .periodical-shell dialog,
|
||||
.home-page-cue,
|
||||
.home-account,
|
||||
.home-appearance-launch,
|
||||
.home-appearance-dialog,
|
||||
.home-search-suggestions { border-color:CanvasText; background:Canvas; box-shadow:none; -webkit-backdrop-filter:none; backdrop-filter:none; }
|
||||
}
|
||||
@@ -15,8 +15,15 @@ a {
|
||||
padding: 1rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
background: var(--bg);
|
||||
align-items: center;
|
||||
gap: .75rem;
|
||||
}
|
||||
|
||||
.topbar > nav { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
|
||||
.topbar > nav > a { margin: 0; padding: .4rem .6rem; border-radius: .35rem; white-space: nowrap; }
|
||||
.topbar > nav > a:hover { background: var(--row-hover, var(--border-soft)); }
|
||||
.topbar > .brand > a { margin: 0; white-space: nowrap; }
|
||||
|
||||
.topbar a {
|
||||
color: var(--link);
|
||||
text-decoration: none;
|
||||
@@ -55,3 +62,8 @@ a {
|
||||
background: var(--panel);
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
.preview.code-preview {
|
||||
white-space: pre;
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
html:has(.notification-dialog[open], .calendar-upcoming-dialog[open]) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Dialogs remain in the topbar DOM but render in the browser's top layer. */
|
||||
.notification-dialog,
|
||||
.calendar-upcoming-dialog {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
box-sizing: border-box;
|
||||
margin: auto;
|
||||
max-width: calc(100vw - 1rem);
|
||||
max-height: calc(100dvh - 1rem);
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
text-align: start;
|
||||
background: var(--input-bg, var(--bg, #fff));
|
||||
color: var(--fg, #222);
|
||||
border: 1px solid var(--border, #888);
|
||||
border-radius: 0.85rem;
|
||||
box-shadow: 0 1.5rem 5rem #0009;
|
||||
}
|
||||
.notification-dialog {
|
||||
width: min(40rem, calc(100vw - 1rem));
|
||||
height: fit-content;
|
||||
}
|
||||
.calendar-upcoming-dialog {
|
||||
width: clamp(20rem, 72vw, 68rem);
|
||||
height: min(52rem, 95vh);
|
||||
height: min(52rem, 95dvh);
|
||||
}
|
||||
.notification-dialog::backdrop,
|
||||
.calendar-upcoming-dialog::backdrop {
|
||||
background: #0009;
|
||||
backdrop-filter: blur(3px);
|
||||
}
|
||||
.notification-dialog .nav-modal-content,
|
||||
.calendar-upcoming-dialog .nav-modal-content {
|
||||
box-sizing: border-box;
|
||||
display: grid;
|
||||
grid-template-rows: auto auto minmax(0, 1fr) auto;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
.notification-dialog header,
|
||||
.calendar-upcoming-dialog header {
|
||||
position: static;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
min-width: 0;
|
||||
padding: 0.8rem 1rem;
|
||||
background: var(--input-bg, var(--bg, #fff));
|
||||
border-bottom: 1px solid var(--border-soft, var(--border, #8884));
|
||||
}
|
||||
.notification-dialog h2,
|
||||
.calendar-upcoming-dialog h2 {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
font-size: 1.05rem;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.notification-dialog header button,
|
||||
.calendar-upcoming-dialog header button {
|
||||
flex: 0 0 auto;
|
||||
padding: 0.25rem 0.55rem;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
font-size: 1.4rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.notification-dialog .notifications-list {
|
||||
max-height: min(28rem, 60dvh);
|
||||
overflow: auto;
|
||||
}
|
||||
.notification-dialog a,
|
||||
.calendar-upcoming-dialog a {
|
||||
color: var(--link, var(--fg));
|
||||
text-decoration: none;
|
||||
}
|
||||
.notification-dialog .notification-item {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.notification-dialog small {
|
||||
color: var(--muted, var(--fg));
|
||||
}
|
||||
.notification-launch {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.calendar-upcoming-dialog [data-calendar-upcoming-status] {
|
||||
margin: 0;
|
||||
padding: 0.65rem 1rem;
|
||||
color: var(--muted, var(--fg));
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.calendar-upcoming-dialog [data-calendar-upcoming-status]:empty {
|
||||
display: none;
|
||||
}
|
||||
.calendar-upcoming-list {
|
||||
min-height: 0;
|
||||
padding: 0.35rem 0.55rem;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-gutter: stable;
|
||||
contain: layout paint style;
|
||||
}
|
||||
.calendar-upcoming-item {
|
||||
display: grid;
|
||||
grid-template-columns: 7.5rem 4.75rem minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: 0.65rem;
|
||||
min-width: 0;
|
||||
min-height: 2.1rem;
|
||||
padding: 0.25rem 0.55rem;
|
||||
border-bottom: 1px solid var(--border-soft, var(--border, #8883));
|
||||
color: inherit;
|
||||
content-visibility: auto;
|
||||
contain: layout paint style;
|
||||
contain-intrinsic-size: auto 2.1rem;
|
||||
}
|
||||
.calendar-upcoming-item:hover,
|
||||
.calendar-upcoming-item:focus-visible {
|
||||
background: var(--row-hover, color-mix(in srgb, var(--accent, #578) 10%, transparent));
|
||||
outline: none;
|
||||
}
|
||||
.calendar-upcoming-item time,
|
||||
.calendar-upcoming-item strong {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.calendar-upcoming-item time {
|
||||
color: var(--muted, var(--fg));
|
||||
font-size: 0.82rem;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.calendar-upcoming-item strong {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.calendar-upcoming-dialog footer {
|
||||
padding: 0.65rem 1rem;
|
||||
text-align: end;
|
||||
border-top: 1px solid var(--border-soft, var(--border, #8884));
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.calendar-upcoming-dialog {
|
||||
width: 95vw;
|
||||
max-width: none;
|
||||
height: 95vh;
|
||||
height: 95dvh;
|
||||
max-height: 95dvh;
|
||||
border-radius: 0.6rem;
|
||||
}
|
||||
.calendar-upcoming-list {
|
||||
padding-inline: 0.25rem;
|
||||
}
|
||||
.calendar-upcoming-item {
|
||||
grid-template-columns: 5.8rem 3.8rem minmax(0, 1fr);
|
||||
gap: 0.4rem;
|
||||
padding-inline: 0.35rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.calendar-upcoming-list {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.notification-settings{border-top:1px solid var(--border);margin-top:.7rem;padding-top:.5rem}.notification-settings summary{cursor:pointer;font-size:.85rem}.notification-settings>div{display:grid;gap:.6rem;padding:.6rem 0}.notification-settings label{display:flex;align-items:center;gap:.5rem;font-size:.85rem}.notification-settings input[type=checkbox]{appearance:auto;width:1rem;height:1rem;margin:0;accent-color:var(--accent)}.notification-settings select{background:var(--input-bg,var(--bg));color:var(--fg);border:1px solid var(--border);border-radius:.3rem;padding:.3rem}.notification-settings small,.notification-settings [role=status]{font-size:.75rem;color:var(--muted);margin:0}.notification-settings input[type=range]{min-width:0;max-width:12rem;accent-color:var(--accent)}.notification-toasts{position:fixed;right:1rem;bottom:1rem;z-index:1000;width:min(25rem,calc(100vw - 2rem));display:grid;gap:.5rem;pointer-events:none}.notification-toast{display:flex;align-items:center;gap:.6rem;padding:.8rem 1rem;pointer-events:auto;border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:.7rem;background:var(--bg);color:var(--fg);box-shadow:0 .4rem 1.4rem #0005}.notification-toast a{color:inherit;text-decoration:none;flex:1;overflow-wrap:anywhere}.notification-toast button{color:inherit;background:transparent;border:0;cursor:pointer;font-size:1.2rem}.task-nav-item{grid-template-columns:auto minmax(0,1fr) auto;align-items:center}.task-nav-item strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tasks-today-dialog .nav-modal-content{padding:1rem}.tasks-today-dialog .notifications-list{max-height:65dvh;overflow:auto}
|
||||
@@ -0,0 +1 @@
|
||||
.notification-launch{position:relative;display:grid;place-items:center;width:2.25rem;height:2.25rem;margin-inline-end:.35rem;padding:.38rem;border:1px solid var(--border,currentColor);border-radius:50%;background:transparent;color:var(--fg,currentColor);cursor:pointer}.notification-launch:hover,.notification-launch:focus-visible{background:color-mix(in srgb,var(--accent,#5267df) 15%,transparent);color:var(--accent,#5267df)}.notification-launch svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.notification-badge{position:absolute;top:-.1rem;right:-.1rem;width:.58rem;height:.58rem;border-radius:50%;background:#e5484d;border:2px solid var(--bg,#111)}.notification-badge[hidden]{display:none}.notification-dialog{width:min(34rem,calc(100vw - 2rem));max-height:min(38rem,calc(100vh - 2rem));padding:0;border:1px solid var(--border);border-radius:.75rem;background:var(--bg);color:var(--fg);box-shadow:0 1.5rem 5rem #0009}.notification-dialog::backdrop{background:#0008;backdrop-filter:blur(2px)}.notification-dialog form{margin:0;padding:1rem}.notification-dialog header,.notifications-page>header{display:flex;align-items:center;justify-content:space-between;gap:.7rem}.notification-dialog h2,.notifications-page h1{margin:0;font-size:1.15rem}.notification-dialog button,.notifications-page button{border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.notification-dialog .notifications-list{max-height:24rem;overflow:auto;margin-top:.8rem}.notifications-list{display:grid;gap:.5rem}.notification-item{display:grid;gap:.25rem;padding:.65rem .75rem;border:1px solid var(--border-soft,var(--border));border-radius:.45rem;text-decoration:none;color:inherit}.notification-item:hover{background:var(--row-hover,var(--surface,var(--bg)))}.notification-item time{font-size:.78rem;color:var(--muted)}.notification-item.unread{border-color:color-mix(in srgb,var(--accent) 55%,var(--border));background:color-mix(in srgb,var(--accent) 7%,transparent)}.notification-dialog footer{margin-top:.8rem;text-align:right}.notifications-page{max-width:54rem;margin-inline:auto}.notifications-page .notifications-list{margin-top:1rem}.notifications-page .notification-item{grid-template-columns:1fr auto;align-items:center}
|
||||
@@ -0,0 +1,14 @@
|
||||
.periodical-shell{max-width:76rem;margin:0 auto;padding:1rem;min-width:0}.periodical-shell .topbar{position:static;gap:1rem;padding:.5rem 0;border-bottom:1px solid var(--border)}.periodical-shell nav{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap}.periodical-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem}.periodical-heading h1{font-size:1.6rem}.periodical-filters{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap;margin:1rem 0}.periodical-layout{display:grid;grid-template-columns:minmax(0,1fr) 18rem;gap:2rem}.periodical-entries article{padding:1rem 0;border-bottom:1px solid var(--border)}.periodical-entries h2{font-size:1.3rem;margin:.4rem 0;overflow-wrap:anywhere}.periodical-entry-meta{display:flex;gap:1rem;font-size:.85rem;color:var(--muted)}.periodical-path{font-size:.8rem;color:var(--muted);overflow-wrap:anywhere}.periodical-entries nav{font-size:.85rem}.periodical-entries button{background:transparent;padding:.25rem .45rem;cursor:pointer}.periodical-pagination{justify-content:space-between;padding:1rem 0}.periodical-calendar{border:1px solid var(--border);border-radius:.5rem;padding:.7rem}.periodical-calendar header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.periodical-calendar header a{padding:.3rem .7rem}.periodical-days,.periodical-weekdays{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));text-align:center;gap:.2rem}.periodical-days a{padding:.4rem .1rem;text-decoration:none;color:var(--muted);border-radius:.2rem;position:relative}.periodical-days .has-entries{color:var(--link);font-weight:bold;background:var(--button-hover-bg)}.periodical-days small{display:block;font-size:.65rem}.periodical-days [aria-current=date]{outline:2px solid var(--accent)}.periodical-recent h2{font-size:1rem}.periodical-recent>a{display:block;margin:.5rem 0;overflow-wrap:anywhere}.periodical-recent time{font-size:.75rem;color:var(--muted)}.periodical-shell dialog{width:min(30rem,calc(100vw - 2rem));box-sizing:border-box;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:.6rem;padding:1rem}.periodical-shell dialog::backdrop{background:#0008}.periodical-shell dialog header{display:flex;justify-content:space-between;align-items:center}.periodical-shell dialog label{display:grid;gap:.2rem;margin:.6rem 0}.periodical-shell dialog input{width:100%;box-sizing:border-box;padding:.4rem}.periodical-shell :focus-visible{outline:2px solid var(--accent);outline-offset:2px}@media(max-width:700px){.periodical-layout{grid-template-columns:1fr}.periodical-layout aside{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:1rem}.periodical-shell{padding:.65rem}.periodical-heading{flex-wrap:wrap}.periodical-filters input{max-width:10rem}}@media(max-width:420px){.periodical-layout aside{grid-template-columns:1fr}.periodical-recent{display:block}}
|
||||
@media(max-width:700px){.periodical-layout aside{grid-row:auto}.periodical-recent{display:block}}
|
||||
.periodical-entries{min-width:0}.periodical-index{width:100%;table-layout:fixed;border-collapse:collapse;font-size:.95rem;margin:0}.periodical-index th,.periodical-index td{padding:.4rem .55rem;text-align:left;vertical-align:middle;border:0;border-bottom:1px solid var(--border)}.periodical-index th{font-size:.75rem;font-weight:500;color:var(--muted)}.periodical-index th:first-child,.periodical-index-date{width:7.5rem;white-space:nowrap;color:var(--muted);font-size:.8rem;font-variant-numeric:tabular-nums}.periodical-index .periodical-index-title{min-width:0}.periodical-index h2{font-size:.95rem;font-weight:500;line-height:1.5;margin:0}.periodical-index h2 a{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none;color:var(--fg)}.periodical-index h2 a:hover{text-decoration:underline;color:var(--link)}.periodical-index tbody tr:hover{background:var(--button-hover-bg)}.periodical-index .periodical-index-actions{width:5.5rem;padding-left:.25rem;padding-right:.25rem}.periodical-index-actions nav{flex-wrap:nowrap;gap:.3rem;justify-content:flex-end}.periodical-index-actions button{padding:.1rem .25rem}.periodical-calendar-panel{min-width:0}.periodical-calendar-panel .periodical-filters{margin:0 0 .65rem;gap:.5rem;font-size:.8rem}.periodical-calendar-panel .periodical-filters label:first-child{display:flex;align-items:center;justify-content:space-between;width:100%;gap:.4rem}.periodical-calendar-panel .periodical-filters input[type=month]{min-width:0;max-width:11rem;padding:.3rem}.periodical-calendar-panel .periodical-filters button{padding:.25rem .55rem}@media(max-width:500px){.periodical-index th:first-child,.periodical-index-date{width:6rem;font-size:.75rem}.periodical-index th,.periodical-index td{padding:.4rem .25rem}.periodical-index h2{font-size:.85rem}.periodical-index .periodical-index-actions{width:4.7rem}.periodical-index-actions nav{gap:.15rem}}
|
||||
.periodical-compose-page{max-width:60rem;margin:auto}.periodical-compose-page fieldset{border:0;padding:0;min-width:0}.periodical-compose-page label{display:grid;gap:.4rem;margin:.8rem 0}.periodical-compose-page input,.periodical-compose-page textarea{width:100%;box-sizing:border-box;padding:.5rem;background:var(--bg);color:var(--fg);border:1px solid var(--border);font:inherit}.periodical-compose-page textarea{resize:vertical}.periodical-compose-meta{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem}@media(max-width:650px){.periodical-compose-meta{grid-template-columns:1fr;gap:0}}
|
||||
.periodical-site-title{font-size:1.25rem;font-weight:600}.periodical-full-article h1{overflow-wrap:anywhere}.periodical-body{overflow-wrap:anywhere;line-height:1.8}.periodical-body img{max-width:100%;height:auto}.periodical-body pre{overflow:auto;max-width:100%}.periodical-body table{display:block;max-width:100%;overflow:auto}.periodical-recent time{margin-right:.4rem}.periodical-shell .topbar{justify-content:space-between}
|
||||
.periodical-shell dialog[data-periodical-composer]{width:min(48rem,calc(100vw - 2rem));max-height:90vh;overflow:auto}.periodical-shell dialog fieldset{min-width:0;border:0;padding:0}.periodical-shell dialog textarea{width:100%;box-sizing:border-box;resize:vertical;background:var(--bg);color:var(--fg);font:inherit;padding:.5rem;border:1px solid var(--border)}
|
||||
.periodical-filters input[type=month]{color:var(--fg);background:var(--input-bg,var(--bg));border:1px solid var(--border)}
|
||||
.periodical-filters input[type=month]::-webkit-calendar-picker-indicator{background-color:#e8e8e8;border-radius:2px;opacity:.75}
|
||||
.periodical-month-controls{display:flex;align-items:center;gap:.3rem;width:100%;min-width:0}
|
||||
.periodical-calendar-panel .periodical-month-controls input[type=month]{flex:1;width:0;min-width:0;max-width:none;height:2rem;box-sizing:border-box;font:inherit}
|
||||
.periodical-calendar-panel .periodical-filter-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 2rem;width:2rem;height:2rem;box-sizing:border-box;padding:0;border:1px solid transparent;border-radius:.25rem;background:transparent;color:var(--muted);text-decoration:none;cursor:pointer}
|
||||
.periodical-calendar-panel .periodical-filter-icon:hover{background:var(--button-hover-bg);color:var(--fg);border-color:var(--border)}
|
||||
.periodical-filter-icon svg{display:block;pointer-events:none}
|
||||
.periodical-editor-actions{display:flex;align-items:center;gap:.35rem;margin-left:auto}.periodical-editor-actions button{min-width:2.2rem;min-height:2rem;padding:.25rem .45rem}.periodical-compose-page .editor-grid{margin:.5rem 0 1rem}.periodical-compose-page .editor-pane{min-width:0}.periodical-compose-page .cm-editor{min-height:25rem;border:1px solid var(--border)}.periodical-compose-page .preview{min-height:25rem}.periodical-compose-page .editor-statusbar{display:flex;justify-content:space-between;gap:.6rem;padding:.25rem .45rem;font-size:.75rem;color:var(--muted);border:1px solid var(--border);border-top:0}
|
||||
@@ -0,0 +1,45 @@
|
||||
.public-document {max-width:80rem;margin:0 auto;padding:1rem;min-width:0}
|
||||
.public-document [hidden] {display:none!important}
|
||||
.public-topbar,.public-location,.public-heading {display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap}
|
||||
.public-topbar {border-bottom:1px solid var(--border);padding:.5rem 0 .8rem;margin-bottom:.6rem}
|
||||
.public-topbar nav,.public-scope-links,.public-breadcrumbs {display:flex;align-items:center;gap:.7rem;flex-wrap:wrap;min-width:0}
|
||||
.public-topbar a,.public-location a {text-decoration:none}
|
||||
.public-topbar a:hover,.public-location a:hover {text-decoration:underline}
|
||||
.public-brand {font-weight:700;overflow-wrap:anywhere}
|
||||
.public-location {margin-bottom:1.2rem;font-size:.9rem}
|
||||
.public-breadcrumbs a {overflow-wrap:anywhere}
|
||||
.public-breadcrumbs a+a:before {content:'›';color:var(--muted);margin-right:.7rem}
|
||||
.public-heading h1 {font-size:1.35rem;margin:.4rem 0}
|
||||
.public-notice {color:var(--muted);font-size:.85rem;margin:.3rem 0 1rem}
|
||||
.public-skip {position:absolute;left:-9999px}
|
||||
.public-skip:focus {left:1rem;top:1rem;background:var(--bg);padding:.6rem;z-index:1000}
|
||||
.public-document :focus-visible {outline:2px solid var(--accent,var(--link));outline-offset:3px}
|
||||
.public-tree-tools {display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin:.7rem 0}
|
||||
.public-tree-tools label {display:flex;align-items:center;gap:.5rem}
|
||||
.public-tree-tools input {max-width:100%;min-width:0}
|
||||
.public-tree {display:flex;flex-direction:column}
|
||||
.public-tree-row {display:flex;gap:.4rem;align-items:center;min-height:2rem;padding:.15rem .3rem .15rem calc(min(var(--depth),16)*1rem);border-bottom:1px solid var(--border-soft)}
|
||||
.public-tree-row:hover {background:var(--button-hover-bg)}
|
||||
.public-tree-row button,.public-tree-spacer {width:1.6rem;flex-shrink:0;padding:0;text-align:center}
|
||||
.public-tree-name {overflow-wrap:anywhere;min-width:0}
|
||||
.public-tree-name {text-decoration:none}
|
||||
.public-tree-name:hover {text-decoration:underline}
|
||||
.public-tree-folder {margin-left:auto;padding:.2rem .5rem;text-decoration:none}
|
||||
.public-children-list,.public-children-details,.public-children-icons {list-style:none;padding:0;margin:.5rem 0}
|
||||
.public-children-list li,.public-children-details li,.public-children-icons li {display:flex;gap:.5rem;align-items:center;min-width:0;padding:.5rem;border-bottom:1px solid var(--border-soft)}
|
||||
.public-child-link {display:flex;align-items:center;gap:.5rem;min-width:0;overflow-wrap:anywhere;text-decoration:none}
|
||||
.public-child-link:hover {text-decoration:underline}
|
||||
.public-child-folder {margin-left:auto;padding:.2rem .5rem;text-decoration:none;flex-shrink:0}
|
||||
.public-children-details small {color:var(--muted);overflow-wrap:anywhere;margin-left:auto;font-size:.8rem}
|
||||
.public-children-icons {display:grid;grid-template-columns:repeat(auto-fill,minmax(10rem,1fr));gap:.5rem}
|
||||
.public-children-icons li {border:1px solid var(--border);border-radius:.4rem;position:relative;align-items:stretch}
|
||||
.public-children-icons .public-child-link {flex:1;flex-direction:column;align-items:center;text-align:center;padding:.6rem .2rem}
|
||||
.public-children-icons .public-child-link>span:first-child {font-size:2rem}
|
||||
.public-children-icons .public-child-folder {position:absolute;right:.15rem;top:.15rem}
|
||||
.public-children-views {display:flex;gap:.35rem;margin:.5rem 0}
|
||||
.public-tree-tools button {padding:.25rem .55rem}
|
||||
.public-children-views button {display:grid;place-items:center;width:1.75rem;height:1.75rem;padding:0;border:1px solid var(--border-soft);border-radius:.3rem;background:transparent;color:var(--muted);cursor:pointer}
|
||||
.public-children-views button:hover,.public-children-views button[aria-pressed=true] {border-color:var(--link);color:var(--link)}
|
||||
.public-document .children-next {min-height:2rem}
|
||||
@media(max-width:600px) {.public-document{padding:.6rem}.public-topbar nav{gap:.5rem;font-size:.85rem}.public-children-details li{flex-wrap:wrap}.public-children-details small{width:100%;margin-left:1.5rem}.public-tree-row{padding-left:calc(min(var(--depth),8)*.7rem)}.public-tree-tools label{width:100%}.public-tree-tools input{flex:1;width:8rem}}
|
||||
@media(max-width:600px) {.public-topbar .public-nav-label{display:none}.public-topbar nav a{display:inline-flex;align-items:center;justify-content:center;min-width:2rem;min-height:2rem;font-size:1.25rem}}
|
||||
@@ -6,6 +6,13 @@
|
||||
line-height: 1.0;
|
||||
}
|
||||
|
||||
.revision-pagination {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 1.5rem;
|
||||
padding-block: 1rem;
|
||||
}
|
||||
|
||||
.diff-view div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
.mode-search .search-main{max-width:1200px;padding-top:1.1rem}
|
||||
.mode-search .topbar-search{display:flex;align-items:center;gap:.4rem;flex:1;max-width:46rem;margin:0}.mode-search .topbar-search input{flex:1;min-width:0;width:auto;margin:0}.mode-search .topbar-search button{flex-shrink:0;margin:0;line-height:1;display:grid;place-items:center;padding:.55rem}.mode-search .topbar-search button svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.8}
|
||||
.mode-search .breadcrumb-bar{gap:1rem;margin-bottom:.4rem}
|
||||
.mode-search .breadcrumb-bar h1{font-size:1.2rem;margin:0}
|
||||
.mode-search .search-scope,.mode-search .search-help{margin:.3rem 0;font-size:.8rem;color:var(--fg-muted,var(--muted,var(--fg)));overflow-wrap:anywhere}
|
||||
.mode-search .search-help{opacity:.7;margin-bottom:1rem}
|
||||
.mode-search .search-options{margin:.6rem 0 1rem;border:1px solid var(--border-soft,var(--border));border-radius:.4rem;background:color-mix(in srgb,var(--fg) 2%,transparent)}
|
||||
.mode-search .search-options>summary{display:flex;align-items:center;gap:.45rem;padding:.55rem .7rem;font-size:.82rem;cursor:pointer;list-style:none}
|
||||
.mode-search .search-options>summary::-webkit-details-marker{display:none}
|
||||
.mode-search .search-options>summary::after{content:"⌄";margin-inline-start:auto;transition:transform .15s}
|
||||
.mode-search .search-options[open]>summary::after{transform:rotate(180deg)}
|
||||
.mode-search .search-options>summary svg,.mode-search .search-city-results h2 svg{width:1rem;height:1rem;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
|
||||
.mode-search .search-options-active{font-size:.68rem;padding:.05rem .4rem;border-radius:1rem;background:color-mix(in srgb,var(--accent,var(--link)) 15%,transparent);color:var(--fg)}
|
||||
.mode-search .search-filter-grid{display:grid;grid-template-columns:minmax(8rem,1.15fr) minmax(8rem,1.1fr) minmax(7rem,.85fr) repeat(2,minmax(8.5rem,1fr));gap:.6rem .7rem;padding:.2rem .7rem .7rem;min-width:0}
|
||||
.mode-search .search-filter-field{display:flex;flex-direction:column;gap:.25rem;font-size:.75rem;min-width:0;margin:0}
|
||||
.mode-search .search-filter-field input,.mode-search .search-filter-field select{box-sizing:border-box;width:100%;min-width:0;min-height:2rem;padding:.35rem .45rem;margin:0;border:1px solid var(--input-border,var(--border));border-radius:.3rem;background:var(--input-bg,var(--bg));color:var(--input-fg,var(--fg));font:inherit}
|
||||
.mode-search .search-filter-field input[type="date"]{max-width:100%}
|
||||
.mode-search .search-filter-field small,.mode-search .search-filter-footer small,.mode-search .search-city-filter-hint{font-size:.7rem;line-height:1.4;color:var(--fg-muted,var(--muted,var(--fg)));overflow-wrap:anywhere}
|
||||
.mode-search .search-filter-footer{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem}
|
||||
.mode-search .search-filter-actions{display:flex;align-items:center;gap:.8rem;font-size:.78rem;margin-inline-start:auto}
|
||||
.mode-search .search-filter-actions button{margin:0;padding:.35rem .65rem;font-size:.78rem;min-height:2rem}
|
||||
.mode-search .search-city-filter-hint{grid-column:1/-1;margin:0}
|
||||
.mode-search .search-options summary:focus-visible,.mode-search .search-filter-grid :is(input,select,button,a):focus-visible,.mode-search .search-city-result a:focus-visible{outline:2px solid var(--accent,var(--link));outline-offset:3px}
|
||||
.mode-search .search-city-results{margin:.9rem 0 1.1rem;padding:.7rem .85rem;border:1px solid var(--border-soft,var(--border));border-inline-start:3px solid color-mix(in srgb,var(--accent,var(--link)) 65%,var(--border));border-radius:.4rem;background:color-mix(in srgb,var(--accent,var(--link)) 3%,var(--bg))}
|
||||
.mode-search .search-city-results h2,.mode-search .search-pages-heading{display:flex;align-items:center;gap:.45rem;margin:0 0 .4rem;font-size:.9rem;font-weight:600}
|
||||
.mode-search .search-city-list{list-style:none;margin:0;padding:0}
|
||||
.mode-search .search-city-result{position:relative;padding:.55rem 0;line-height:1.45}
|
||||
.mode-search .search-city-result+.search-city-result{border-top:1px solid var(--border-soft,var(--border))}
|
||||
.mode-search .search-city-title{display:flex;align-items:baseline;gap:.45rem;min-width:0}
|
||||
.mode-search .search-city-title .search-result-name{font-size:.95rem}
|
||||
.mode-search .search-city-kind{flex-shrink:0;font-size:.65rem;line-height:1.5;padding:.04rem .38rem;border:1px solid color-mix(in srgb,var(--accent,var(--link)) 35%,var(--border));border-radius:.25rem;color:var(--fg)}
|
||||
.mode-search .search-city-location{display:flex;align-items:baseline;flex-wrap:wrap;gap:.2rem .65rem;margin-top:.1rem}
|
||||
.mode-search .search-city-parent,.mode-search .search-city-updated{font-size:.7rem;color:var(--fg-muted,var(--muted,var(--fg)));overflow-wrap:anywhere}
|
||||
.mode-search .search-city-parent::before{content:"·";margin-inline-end:.65rem}
|
||||
.mode-search .search-city-updated{display:block;margin-top:.25rem}
|
||||
.mode-search .search-city-result .search-result-excerpt{font-size:.8rem;margin-top:.2rem}
|
||||
.mode-search .search-city-result .search-match-sources:empty{display:none}
|
||||
.mode-search .search-limit{border-inline-start:3px solid var(--accent,var(--link));padding:.4rem .7rem;font-size:.85rem}
|
||||
.mode-search .search-view-list{list-style:none;margin:0;padding:0}
|
||||
.mode-search .search-view-list .search-result{display:block;padding:.65rem .25rem;border-bottom:1px solid var(--border-soft,var(--border));line-height:1.45}
|
||||
.mode-search .search-result-name{display:block;font-size:1rem;font-weight:600;text-decoration:none;overflow-wrap:anywhere}
|
||||
.mode-search .search-result-path{display:block;font-family:var(--font-mono,monospace);font-size:.77rem;font-weight:400;line-height:1.5;overflow-wrap:anywhere;text-decoration:none;opacity:.82}
|
||||
.mode-search .search-result-name:hover,.mode-search a.search-result-path:hover{text-decoration:underline}
|
||||
.mode-search .search-match-sources{display:flex;gap:.3rem;flex-wrap:wrap;margin-top:.3rem}
|
||||
.mode-search .search-match-sources>span{font-size:.66rem;line-height:1.5;padding:.05rem .38rem;border-radius:.25rem;background:color-mix(in srgb,var(--fg) 7%,transparent);color:var(--fg);white-space:nowrap}
|
||||
.mode-search .search-result-excerpt{display:block;font-size:.84rem;line-height:1.55;margin-top:.3rem;color:var(--fg);overflow-wrap:anywhere}
|
||||
.mode-search .search-excerpt-omitted{display:block;font-size:.75rem;line-height:1.5;margin-top:.3rem;color:var(--fg-muted,var(--muted,var(--fg)));opacity:.8;overflow-wrap:anywhere}
|
||||
.mode-search mark{background:color-mix(in srgb,var(--accent,var(--link)) 25%,transparent);color:inherit;font-weight:650;border-radius:.12rem;padding:0 .04em;box-decoration-break:clone}
|
||||
.mode-search .search-view-icon{grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:.8rem}
|
||||
.mode-search .search-view-icon .search-result{align-items:stretch;text-align:left;padding:.8rem;min-width:0}
|
||||
.mode-search .search-view-icon .children-preview{align-self:center;margin-bottom:.5rem}
|
||||
.mode-search .search-view-icon .search-result-name{font-size:.9rem;white-space:normal;overflow:visible}
|
||||
.mode-search .search-view-icon .search-result-excerpt{font-size:.77rem;line-height:1.45;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
|
||||
.mode-search .search-view-detail{width:100%;table-layout:fixed;font-size:.8rem;border-collapse:collapse}
|
||||
.mode-search .search-view-detail th,.mode-search .search-view-detail td{padding:.55rem .6rem;text-align:left;vertical-align:top;border-bottom:1px solid var(--border-soft,var(--border))}
|
||||
.mode-search .search-view-detail th:first-child{width:32%}.mode-search .search-view-detail th:nth-child(2){width:40%}.mode-search .search-view-detail th:nth-child(3){width:14%}
|
||||
.mode-search .search-view-detail .search-result-name{font-size:.88rem}.mode-search .search-view-detail .search-result-excerpt{font-size:.78rem}
|
||||
.mode-search .search-result-type,.mode-search .search-result-updated{font-size:.72rem;overflow-wrap:anywhere}
|
||||
.mode-search .search-empty{padding:2rem 0;opacity:.75}
|
||||
.mode-search .search-error{margin:1rem 0;padding:1rem;border:1px solid var(--border-soft,var(--border));border-inline-start:3px solid var(--accent,var(--link));border-radius:.35rem;background:color-mix(in srgb,var(--fg) 3%,transparent)}
|
||||
.mode-search .search-error h2{margin:0;font-size:1rem}.mode-search .search-error p{margin:.6rem 0;font-size:.85rem;line-height:1.6;color:var(--fg-muted,var(--muted,var(--fg)))}
|
||||
.mode-search .search-retry{display:inline-flex;align-items:center;gap:.4rem;font-size:.85rem;text-decoration:none}.mode-search .search-retry:hover{text-decoration:underline}.mode-search .search-retry svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
@media(max-width:700px){.mode-search .search-main{padding-inline:.8rem}.mode-search .search-view-detail th:nth-child(n+3),.mode-search .search-view-detail td:nth-child(n+3){display:none}.mode-search .search-view-detail th:first-child{width:42%}.mode-search .search-view-detail th:nth-child(2){width:auto}.mode-search .search-view-icon{grid-template-columns:repeat(auto-fill,minmax(170px,1fr))}.mode-search .topbar-search{min-width:0}.mode-search .topbar-search input{min-width:0;width:100%}}
|
||||
@media(max-width:850px){.mode-search .search-filter-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
||||
@media(max-width:520px){.mode-search .search-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.mode-search .search-city-results{padding:.6rem}.mode-search .search-city-title{align-items:flex-start}.mode-search .search-city-parent{flex-basis:100%}.mode-search .search-city-parent::before{content:none}.mode-search .search-city-result .search-result-path{font-size:.72rem}.mode-search .search-filter-footer small{flex-basis:100%}}
|
||||
@@ -0,0 +1,101 @@
|
||||
#tasks-app{max-width:1380px;margin:0 auto;padding:1.2rem;display:grid;grid-template-columns:12rem minmax(0,1fr);gap:2rem;color:var(--fg)}
|
||||
#task-schedule{padding:1rem;max-width:1600px;margin:auto}.task-schedule-scroll{overflow:auto;max-height:80dvh}.task-schedule-grid{min-width:1000px}.task-schedule-row{display:grid;grid-template-columns:16rem repeat(var(--days),minmax(1.6rem,1fr));align-items:center;min-height:2.4rem;border-bottom:1px solid var(--border);gap:1px}.task-schedule-row>a:first-child{position:sticky;left:0;background:var(--bg);color:var(--accent);z-index:1;padding:.4rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.task-schedule-row>span{text-align:center;font-size:.8rem}.task-schedule-bar{background:color-mix(in srgb,var(--accent) 25%,var(--bg));border:1px solid var(--accent);border-radius:.4rem;padding:.3rem;color:var(--fg);white-space:nowrap;overflow:hidden;font-size:.7rem}.task-schedule-bar[data-status=done]{opacity:.5}.task-schedule-row:first-child{position:sticky;top:0;background:var(--bg);z-index:2}
|
||||
.task-day-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.6rem}.task-day-cards>div{display:flex;flex-direction:column;gap:.25rem;padding:.6rem .8rem;border:1px solid var(--border,#8885);border-radius:.6rem}.task-day-cards small{font-size:.8rem;opacity:.8}.task-day-cards strong{font-variant-numeric:tabular-nums;font-size:1.2rem}#tasks-day-blocks{list-style:none;padding:0;margin:.5rem 0}#tasks-day-blocks li{display:grid;grid-template-columns:minmax(12rem,auto) minmax(0,1fr);gap:.6rem;padding:.4rem 0;border-bottom:1px solid var(--border,#8885)}#tasks-day-blocks a{color:var(--accent);overflow-wrap:anywhere}#tasks-day>p{font-size:.8rem}#tasks-day summary{cursor:pointer;font-size:.9rem}@media(max-width:520px){.task-day-cards{gap:.35rem}.task-day-cards>div{padding:.5rem}.task-day-cards strong{font-size:1rem}#tasks-day-blocks li{grid-template-columns:1fr;gap:.2rem}}
|
||||
#tasks-focus>small:empty{display:none}
|
||||
#tasks-focus{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;border:1px solid var(--border,#8885);border-radius:.65rem;padding:.7rem;margin-bottom:1rem}#tasks-focus-clock{font-variant-numeric:tabular-nums;font-size:1.35rem;min-width:4.5rem}#tasks-focus input{width:5rem}#tasks-focus>small{flex-basis:100%;min-height:1em;overflow-wrap:anywhere}#tasks-focus>a{color:var(--accent)}#tasks-focus[data-state=running]{border-color:var(--accent)}#tasks-focus-state{font-size:.8rem;opacity:.8}
|
||||
#tasks-plan-dialog{box-sizing:border-box;width:min(720px,96vw);max-height:92dvh;overflow:auto;color:var(--fg);background:var(--bg)!important;border:1px solid var(--border,#8885);border-radius:1rem;padding:1.2rem;box-shadow:0 1rem 4rem #0005}
|
||||
#tasks-plan-dialog::backdrop{background:#0007;backdrop-filter:blur(3px)}
|
||||
#tasks-plan-dialog form{display:grid;gap:.7rem;margin:1rem 0}#tasks-plan-dialog form>button{justify-self:end}.task-plan-fields{display:grid;grid-template-columns:1fr 1fr;gap:.7rem}.task-plan-fields label{display:flex;flex-direction:column;gap:.3rem;min-width:0}.task-plan-fields label:first-child{grid-column:1/-1}.task-plan-fields input,.task-plan-fields select{width:100%;min-width:0}.task-plan-row{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;border-top:1px solid var(--border,#8885);padding:.6rem 0}.task-plan-row>a,.task-plan-row>span{flex:1;min-width:12rem;color:var(--accent);overflow-wrap:anywhere}#tasks-plan-dialog h2{font-size:1.2rem}#tasks-plan-dialog [role=status]{font-size:.9rem}
|
||||
@media(max-width:760px){#tasks-plan-dialog{width:100%;max-width:none;height:100dvh;max-height:100dvh;margin:0;border-radius:0;padding:1rem}.task-plan-fields{grid-template-columns:minmax(0,1fr)}.task-plan-row .tasks-actions{width:100%;justify-content:flex-end}}
|
||||
#tasks-fields .task-full{grid-column:1/-1}#tasks-fields label.task-toggle{flex-direction:row-reverse;align-items:center;justify-content:flex-end;gap:.6rem}#tasks-fields label.task-toggle input{width:1.2rem;height:1.2rem;accent-color:var(--accent)}
|
||||
body:has(#tasks-app)>.topbar{min-width:0}#tasks-app{box-sizing:border-box}
|
||||
#tasks-dialog{background:var(--bg)!important}#tasks-form{display:flex;flex-direction:column;max-height:calc(92dvh - 3rem)}#tasks-fields{overflow:auto;min-height:0;padding:.25rem .2rem}.tasks-toolbar,#tasks-form>footer,#tasks-history,#tasks-error{flex-shrink:0}
|
||||
#tasks-nav{display:flex;flex-direction:column;gap:.25rem;padding-top:.5rem}
|
||||
#tasks-nav a{display:flex;gap:.6rem;align-items:center;padding:.55rem .75rem;color:var(--fg);text-decoration:none;border-radius:.5rem}
|
||||
#tasks-nav a[aria-current=page],#tasks-nav a:hover{background:color-mix(in srgb,var(--accent,#6598bf) 17%,transparent)}
|
||||
.tasks-workspace{min-width:0}.tasks-toolbar{display:flex;align-items:center;justify-content:space-between;gap:1rem}.tasks-toolbar h1,.tasks-toolbar h2{margin:.25rem 0;font-size:1.5rem}.tasks-actions{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
|
||||
.tasks-muted,#tasks-date,.task-row-meta{color:var(--muted,var(--fg));opacity:.75;font-size:.85rem}
|
||||
#tasks-app input,#tasks-app select,#tasks-app textarea{box-sizing:border-box;color:var(--fg);background:var(--bg);border:1px solid var(--border,#8885);border-radius:.4rem;font:inherit;padding:.55rem;min-width:0}
|
||||
#tasks-app button{font:inherit;color:var(--fg);border:1px solid var(--border,#8885);background:var(--panel,var(--bg));border-radius:.45rem;padding:.5rem .7rem;cursor:pointer}#tasks-app button:hover{border-color:var(--accent)}#tasks-app :focus-visible{outline:2px solid var(--accent);outline-offset:2px}#tasks-app button:disabled{opacity:.5;cursor:default}
|
||||
#tasks-capture{display:flex;gap:.5rem;margin:1rem 0}#tasks-quick-title{flex:1}.tasks-search{display:flex;align-items:center;gap:.6rem;margin:1rem 0}.tasks-search input{flex:1}#tasks-status:empty{display:none}
|
||||
#tasks-list{border-top:1px solid var(--border,#8885)}.task-row{display:flex;align-items:center;gap:.8rem;padding:.6rem .2rem;border-bottom:1px solid var(--border,#8885);content-visibility:auto;contain-intrinsic-size:auto 62px}.task-row-main{min-width:0;flex:1;display:flex;flex-direction:column;gap:.2rem}.task-row-main>a{color:var(--fg);text-decoration:none;overflow-wrap:anywhere}.task-row-main>a:hover{color:var(--accent)}.task-row[data-done=true] .task-row-main>a{text-decoration:line-through;opacity:.65}.task-row-meta{display:flex;gap:.7rem;flex-wrap:wrap}.task-row-meta .task-overdue{color:var(--danger,#da6161);opacity:1}#tasks-more{margin:1rem 0;width:100%}
|
||||
#tasks-dialog{box-sizing:border-box;color:var(--fg);background:var(--panel,var(--bg));border:1px solid var(--border,#8885);border-radius:1rem;width:min(680px,95vw);max-height:92dvh;padding:1.5rem;box-shadow:0 1rem 4rem #0005;overflow:auto}#tasks-dialog::backdrop{background:#0007;backdrop-filter:blur(3px)}#tasks-fields{display:grid;grid-template-columns:1fr 1fr;gap:.8rem;margin:1rem 0}#tasks-fields label{display:flex;flex-direction:column;gap:.3rem;font-size:.9rem}#tasks-fields label.task-full{grid-column:1/-1}#tasks-fields input,#tasks-fields select,#tasks-fields textarea{width:100%}#tasks-fields textarea{min-height:7rem;resize:vertical}#tasks-fields a{overflow-wrap:anywhere;color:var(--accent)}#tasks-form footer{justify-content:flex-end;margin-top:1rem}#tasks-error{color:var(--danger,#d55)}#tasks-history{font-size:.8rem}#tasks-app [hidden]{display:none!important}
|
||||
@media(max-width:760px){#tasks-app{display:block;padding:.75rem}#tasks-nav{flex-direction:row;overflow:auto;padding:0 0 .7rem;gap:.1rem;white-space:nowrap}#tasks-nav a{padding:.5rem}.tasks-toolbar h1{font-size:1.3rem}#tasks-dialog{width:100%;height:100dvh;max-height:100dvh;margin:0;border-radius:0;padding:1rem}#tasks-fields{gap:.7rem}.task-row{gap:.5rem}}
|
||||
@media(max-width:760px){body:has(#tasks-app)>.topbar{flex-wrap:wrap;padding:.65rem;gap:.5rem}body:has(#tasks-app)>.topbar>.brand{flex:1;min-width:0}body:has(#tasks-app)>.topbar>.brand>a{display:block;overflow:hidden;text-overflow:ellipsis}body:has(#tasks-app)>.topbar>nav{order:2;width:100%}body:has(#tasks-app)>.topbar>.city-map-launch{margin-inline:0;flex-shrink:0}#tasks-fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}
|
||||
@media(max-width:760px){#tasks-dialog{max-width:none}#tasks-form{max-height:calc(100dvh - 2rem);height:100%}#tasks-fields{flex:1}#tasks-form>footer{margin-top:.5rem}}
|
||||
|
||||
/* Inline tasks: shared columns on desktop, labelled touch controls on mobile. */
|
||||
.tasks-list-scroll{min-width:0}
|
||||
.task-inline-header{display:none}
|
||||
.task-inline-row{position:relative;min-width:0;border-bottom:1px solid var(--border,#8885)}
|
||||
.task-inline-row label{min-width:0;margin:0}
|
||||
.task-inline-row label>span{font-size:.75rem;color:var(--muted,var(--fg))}
|
||||
#tasks-app .task-inline-row input,#tasks-app .task-inline-row select{width:100%;min-width:0;margin:0}
|
||||
.task-inline-row .tasks-actions{margin:0}
|
||||
.task-inline-row [data-action=detail]{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;color:var(--fg);text-decoration:none;border:1px solid transparent;border-radius:.3rem}
|
||||
.task-inline-row [data-action=detail]:hover{border-color:var(--accent)}
|
||||
.task-inline-estimate{white-space:nowrap;font-size:.7rem;color:var(--muted,var(--fg));font-variant-numeric:tabular-nums}
|
||||
.task-inline-status{display:block;font-size:.8rem;overflow-wrap:anywhere;color:var(--danger,#d55)}
|
||||
.task-inline-status:empty{display:none}
|
||||
.task-inline-status[data-state=saved],.task-inline-status[data-state=saving]{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
||||
.task-inline-row[aria-busy=true]>.task-inline-main [data-action=complete]{color:var(--accent)}
|
||||
.task-inline-row input[type=date]::-webkit-calendar-picker-indicator,.task-date-nav input[type=date]::-webkit-calendar-picker-indicator{background-color:#e8e8e8;border-radius:2px;opacity:.75}
|
||||
.task-inline-row[data-done=true]>.task-inline-main input[name=title]{text-decoration:line-through;opacity:.7}
|
||||
.task-child-capture{display:flex;min-width:0;gap:.25rem}
|
||||
.task-inline-row>a{color:var(--accent);font-size:.75rem}
|
||||
.task-inline-title{position:relative}
|
||||
.task-context-badge{position:absolute;right:.3rem;bottom:.65rem;font-size:.65rem;color:var(--muted,var(--fg));pointer-events:none}
|
||||
#tasks-app .task-inline-row[data-context=true]>.task-inline-main input[name=title]{padding-right:2.5rem}
|
||||
.task-date-nav,.task-date-nav>label{display:flex;align-items:center;gap:.35rem;flex-wrap:wrap}
|
||||
.task-date-nav{margin:.5rem 0}
|
||||
#tasks-app .task-date-nav input{width:auto;max-width:100%;font-size:16px;min-height:44px}
|
||||
#tasks-app .task-date-nav button{min-width:44px;min-height:44px}
|
||||
|
||||
@media(min-width:1024px){
|
||||
#tasks-app{max-width:none;padding:1rem;grid-template-columns:10rem minmax(0,1fr);gap:1rem}
|
||||
.tasks-list-scroll{overflow-x:auto;overscroll-behavior-x:contain}
|
||||
.tasks-list-scroll:has(.task-inline-row){--task-columns:2rem minmax(12rem,1fr) 5.5rem repeat(5,7rem) 18rem}
|
||||
.tasks-list-scroll:has(.task-inline-row)>.task-inline-header{display:grid}
|
||||
.task-inline-header,.task-inline-row{display:grid;grid-template-columns:var(--task-columns);align-items:center;min-width:72.5rem;gap:0;padding:0;margin:0}
|
||||
.task-inline-header{min-height:1.8rem;background:var(--panel,var(--bg));font-size:.75rem;color:var(--muted,var(--fg))}
|
||||
.task-inline-header>span{padding:0 .3rem;white-space:nowrap}
|
||||
.task-inline-row>.task-inline-main,.task-inline-row>.task-inline-dates{display:contents}
|
||||
.task-inline-row>.task-inline-main>label,.task-inline-row>.task-inline-dates>label{display:block}
|
||||
.task-inline-row label>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
||||
#tasks-app .task-inline-row input,#tasks-app .task-inline-row select{height:2.1rem;padding:0 .25rem;font-size:.8rem;border:1px solid transparent;border-radius:0;background:transparent;line-height:normal}
|
||||
#tasks-app .task-inline-row input:hover,#tasks-app .task-inline-row select:hover{background:color-mix(in srgb,var(--accent) 6%,transparent)}
|
||||
#tasks-app .task-inline-row input:focus,#tasks-app .task-inline-row select:focus{border-color:var(--accent);background:var(--bg);outline-offset:-2px}
|
||||
#tasks-app .task-inline-row button,.task-inline-row [data-action=detail]{flex:none;width:1.75rem;height:1.75rem;padding:0;font-size:1rem;border-color:transparent;background:transparent}
|
||||
#tasks-app .task-inline-row button:hover{border-color:var(--accent)}
|
||||
.task-inline-row>.tasks-actions{grid-column:9;flex-wrap:nowrap;justify-content:flex-end;gap:0}
|
||||
.task-inline-estimate{margin-right:auto}
|
||||
.task-inline-estimate{max-width:2.25rem;overflow:hidden;text-overflow:ellipsis;flex-shrink:0}
|
||||
.task-inline-row>.task-inline-status{grid-column:2/-1}
|
||||
.task-inline-row>.task-inline-status[data-state=error]{padding:.25rem}
|
||||
.task-inline-row>.task-inline-children,.task-inline-row>.task-child-capture{grid-column:1/-1;margin:0}
|
||||
.task-inline-children{border-top:1px solid var(--border,#8885)}
|
||||
.task-inline-children>.task-inline-row:last-child{border-bottom:0}
|
||||
.task-inline-row>.task-child-capture{padding-left:2rem;border-top:1px solid var(--border,#8885)}
|
||||
.task-inline-row>a{position:absolute;top:.5rem;left:2.1rem;z-index:1}
|
||||
#tasks-app .task-is-child>.task-inline-main input[name=title]{padding-left:1.3rem}
|
||||
#tasks-app .task-inline-row .task-children-more{width:auto;padding:0 .5rem;font-size:.8rem}
|
||||
}
|
||||
@media(max-width:1023px){
|
||||
.task-inline-row{padding:.75rem 0}
|
||||
.task-inline-main{display:grid;grid-template-columns:2.75rem minmax(0,1fr);align-items:end;gap:.35rem}
|
||||
.task-inline-main>label:last-child{grid-column:2}
|
||||
.task-inline-row label{display:grid;gap:.2rem}
|
||||
.task-inline-dates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;margin:.5rem 0}
|
||||
#tasks-app .task-inline-row input,#tasks-app .task-inline-row select{height:2.75rem;font-size:16px;padding:.4rem;max-width:100%}
|
||||
#tasks-app .task-inline-row button,.task-inline-row [data-action=detail]{min-width:2.75rem;min-height:2.75rem;padding:.4rem;font-size:1.1rem}
|
||||
.task-inline-row>.tasks-actions{gap:.25rem;justify-content:flex-end;flex-wrap:wrap}
|
||||
.task-inline-estimate{margin-right:auto}
|
||||
.task-inline-children{border-left:2px solid var(--border,#8885);padding-left:.5rem;margin-top:.5rem}
|
||||
.task-inline-row>a{display:inline-flex;align-items:center;min-height:2.75rem;gap:.3rem}
|
||||
.task-inline-row>a::after{content:attr(aria-label)}
|
||||
.task-child-capture{margin-top:.5rem}
|
||||
}
|
||||
#tasks-dav-dialog{box-sizing:border-box;width:min(760px,96vw);max-height:92dvh;overflow:auto;color:var(--fg);background:var(--bg)!important;border:1px solid var(--border,#8885);border-radius:1rem;padding:1rem;box-shadow:0 1rem 4rem #0005}
|
||||
#tasks-dav-dialog::backdrop{background:#0007;backdrop-filter:blur(3px)}
|
||||
#tasks-dav-dialog h2{font-size:1.2rem}#tasks-dav-dialog p{font-size:.9rem}#tasks-dav-dialog form{display:flex;flex-wrap:wrap;gap:.4rem;margin:1rem 0}#tasks-dav-dialog form>input{flex:1;min-width:10rem}#tasks-dav-dialog>input,#tasks-dav-dialog section input{width:100%;box-sizing:border-box}#tasks-dav-dialog section{padding:.7rem;border:1px solid var(--accent);border-radius:.5rem}#tasks-dav-dialog section label{display:block;font-size:.85rem;margin:.3rem 0}#tasks-dav-dialog .task-dav-table{overflow:auto}#tasks-dav-dialog table{width:100%;border-collapse:collapse;font-size:.85rem}#tasks-dav-dialog th,#tasks-dav-dialog td{padding:.35rem;text-align:left;border-bottom:1px solid var(--border,#8885)}#tasks-dav-dialog td:first-child{overflow-wrap:anywhere}#tasks-dav-dialog [role=status]{color:var(--danger,#d55)}
|
||||
@media(max-width:760px){#tasks-dav-dialog{width:100%;max-width:none;height:100dvh;max-height:100dvh;margin:0;border-radius:0}#tasks-dav-dialog input,#tasks-dav-dialog select,#tasks-dav-dialog button{min-height:44px;font-size:16px}}
|
||||
@@ -0,0 +1,22 @@
|
||||
:root {
|
||||
--bg: #070809;
|
||||
--fg: #e7e9ec;
|
||||
--muted: #858b92;
|
||||
--panel: #0e1012;
|
||||
--border: rgba(210, 217, 224, 0.23);
|
||||
--border-soft: rgba(210, 217, 224, 0.09);
|
||||
--link: #c9d0d7;
|
||||
--link-hover: #ffffff;
|
||||
--input-bg: #111418;
|
||||
--input-fg: #f2f3f4;
|
||||
--input-border: rgba(205, 213, 220, 0.28);
|
||||
--button-bg: #171a1e;
|
||||
--button-fg: #e8eaed;
|
||||
--button-border: rgba(210, 217, 224, 0.32);
|
||||
--button-hover-bg: #24282d;
|
||||
--danger: #cf233f;
|
||||
--accent: #bec5cc;
|
||||
--row-hover: rgba(225, 231, 236, 0.08);
|
||||
--code-bg: #030405;
|
||||
--code-fg: #d8dde2;
|
||||
}
|
||||
@@ -16,6 +16,9 @@
|
||||
--button-hover-bg: #222;
|
||||
--danger: #ff6d6d;
|
||||
--accent: #b077ff;
|
||||
--scrollbar-track: color-mix(in srgb, var(--bg) 88%, var(--fg) 12%);
|
||||
--scrollbar-thumb: color-mix(in srgb, var(--muted) 72%, var(--accent) 28%);
|
||||
--scrollbar-thumb-hover: color-mix(in srgb, var(--muted) 38%, var(--accent) 62%);
|
||||
}
|
||||
|
||||
html,
|
||||
@@ -24,6 +27,44 @@ body {
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
/* Theme-aware global scrollbars. Firefox uses the standard properties;
|
||||
Chromium/WebKit use the pseudo-elements below. */
|
||||
* {
|
||||
scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar {
|
||||
width: 0.7rem;
|
||||
height: 0.7rem;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-track,
|
||||
*::-webkit-scrollbar-corner {
|
||||
background: var(--scrollbar-track);
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-thumb {
|
||||
min-width: 2rem;
|
||||
min-height: 2rem;
|
||||
border: 2px solid var(--scrollbar-track);
|
||||
border-radius: 999px;
|
||||
background: var(--scrollbar-thumb);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-thumb:hover,
|
||||
*::-webkit-scrollbar-thumb:active {
|
||||
background: var(--scrollbar-thumb-hover);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
* {
|
||||
scrollbar-color: auto;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--link);
|
||||
}
|
||||
@@ -162,3 +203,100 @@ body:has(.config-sidebar) .container {
|
||||
filter: brightness(0.92) contrast(1.08);
|
||||
}
|
||||
}
|
||||
.campus-status-lamp {
|
||||
display: inline-block;
|
||||
width: 0.72rem;
|
||||
height: 0.72rem;
|
||||
margin-right: 0.35rem;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
box-shadow: 0 0 0.45rem currentColor;
|
||||
}
|
||||
|
||||
.campus-status-lamp.online {
|
||||
color: #9acd32;
|
||||
background: #9acd32;
|
||||
}
|
||||
|
||||
.campus-status-lamp.offline {
|
||||
color: #e04444;
|
||||
background: #e04444;
|
||||
}
|
||||
|
||||
.config-form-table {
|
||||
width: min(100%, 52rem);
|
||||
margin: 0 0 2rem;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.config-form-table th,
|
||||
.config-form-table td {
|
||||
padding: 0.65rem 0.8rem;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
.config-form-table th {
|
||||
width: 14rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.config-form-table input[type="text"],
|
||||
.config-form-table select {
|
||||
width: min(100%, 30rem);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.config-form-table tfoot td {
|
||||
text-align: right;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.token-status {
|
||||
display: inline-block;
|
||||
margin-left: 0.55rem;
|
||||
padding: 0.1rem 0.42rem;
|
||||
border: 1px solid currentColor;
|
||||
border-radius: 999px;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.token-status.active {
|
||||
color: #9acd32;
|
||||
}
|
||||
|
||||
.token-status.revoked {
|
||||
color: var(--danger);
|
||||
}
|
||||
.topbar-search {
|
||||
flex: 1 1 24rem;
|
||||
max-width: 36rem;
|
||||
margin: 0 1rem;
|
||||
}
|
||||
|
||||
.topbar-search input[name="q"] {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: .42rem .65rem;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: .35rem;
|
||||
background: var(--input-bg);
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
.topbar-search button {
|
||||
margin-left: .35rem;
|
||||
}
|
||||
|
||||
.search-path-results {
|
||||
display: grid;
|
||||
gap: .45rem;
|
||||
padding-left: 1.25rem;
|
||||
}
|
||||
|
||||
.search-path-results small {
|
||||
margin-left: .6rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
:root {
|
||||
--bg: #090b11;
|
||||
--fg: #f7f3e9;
|
||||
--muted: #aaa38e;
|
||||
--panel: rgba(23, 24, 31, 0.72);
|
||||
--border: rgba(245, 197, 66, 0.25);
|
||||
--border-soft: rgba(245, 197, 66, 0.10);
|
||||
--link: #f7cf58;
|
||||
--link-hover: #fff2ae;
|
||||
--input-bg: #12141c;
|
||||
--input-fg: #fff9e9;
|
||||
--input-border: rgba(245, 197, 66, 0.38);
|
||||
--button-bg: #191b24;
|
||||
--button-fg: #fff7dc;
|
||||
--button-border: rgba(245, 197, 66, 0.42);
|
||||
--button-hover-bg: #292733;
|
||||
--danger: #e84c68;
|
||||
--accent: #f5c542;
|
||||
--row-hover: rgba(245, 197, 66, 0.11);
|
||||
--code-bg: #07080d;
|
||||
--code-fg: #ffe48a;
|
||||
--scrollbar-thumb: color-mix(in srgb, #8f7c45 42%, var(--accent) 58%);
|
||||
--scrollbar-thumb-hover: #f8d763;
|
||||
}
|
||||
|
||||
body {
|
||||
background-image:
|
||||
radial-gradient(circle at 78% 12%, rgba(245, 197, 66, 0.055), transparent 28rem),
|
||||
linear-gradient(145deg, transparent 65%, rgba(122, 24, 48, 0.07));
|
||||
background-attachment: fixed;
|
||||
}
|
||||
|
||||
::selection {
|
||||
background: color-mix(in srgb, var(--accent) 72%, #7a1830);
|
||||
color: #080910;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
:root {
|
||||
--bg: #091321;
|
||||
--fg: #edf7ff;
|
||||
--muted: #829ab5;
|
||||
--panel: #0d1b2d;
|
||||
--border: rgba(80, 178, 240, 0.24);
|
||||
--border-soft: rgba(80, 178, 240, 0.11);
|
||||
--link: #62c7ff;
|
||||
--link-hover: #c5edff;
|
||||
--input-bg: #0e2035;
|
||||
--input-fg: #edf7ff;
|
||||
--input-border: rgba(90, 194, 255, 0.34);
|
||||
--button-bg: #102942;
|
||||
--button-fg: #dff4ff;
|
||||
--button-border: rgba(90, 194, 255, 0.34);
|
||||
--button-hover-bg: #173b5d;
|
||||
--danger: #ff6682;
|
||||
--accent: #35aeea;
|
||||
--row-hover: rgba(66, 183, 242, 0.11);
|
||||
--code-bg: #07101c;
|
||||
--code-fg: #8edcff;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
:root {
|
||||
--bg: #f8fbff;
|
||||
--fg: #17253d;
|
||||
--muted: #687b98;
|
||||
--panel: #ffffff;
|
||||
--border: rgba(34, 105, 177, 0.22);
|
||||
--border-soft: rgba(34, 105, 177, 0.10);
|
||||
--link: #176fbd;
|
||||
--link-hover: #064c91;
|
||||
--input-bg: #ffffff;
|
||||
--input-fg: #17253d;
|
||||
--input-border: rgba(25, 112, 190, 0.32);
|
||||
--button-bg: #edf6ff;
|
||||
--button-fg: #135a9b;
|
||||
--button-border: rgba(25, 112, 190, 0.34);
|
||||
--button-hover-bg: #dceeff;
|
||||
--danger: #d43f5e;
|
||||
--accent: #238bd2;
|
||||
--row-hover: rgba(35, 139, 210, 0.08);
|
||||
--code-bg: #edf5fc;
|
||||
--code-fg: #164f7d;
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
:root {
|
||||
--bg: #101322;
|
||||
--fg: #f6eef8;
|
||||
--muted: #9fa7c7;
|
||||
--panel: transparent;
|
||||
--border: rgba(255,255,255,0.16);
|
||||
--border-soft: rgba(255,255,255,0.07);
|
||||
--link: #f7b7d8;
|
||||
--bg: #140d1d;
|
||||
--fg: #fff0fa;
|
||||
--muted: #c79ab8;
|
||||
--panel: rgba(45, 18, 50, 0.34);
|
||||
--border: rgba(255, 104, 180, 0.25);
|
||||
--border-soft: rgba(255, 104, 180, 0.11);
|
||||
--link: #ff9dce;
|
||||
--link-hover: #ffffff;
|
||||
--input-bg: #171b31;
|
||||
--input-fg: #f6eef8;
|
||||
--input-border: rgba(247,183,216,0.34);
|
||||
--button-bg: #1d2342;
|
||||
--button-fg: #f6eef8;
|
||||
--button-border: rgba(247,183,216,0.38);
|
||||
--button-hover-bg: #28305a;
|
||||
--danger: #ff5d8f;
|
||||
--accent: #ffd86f;
|
||||
--row-hover: rgba(247,183,216,0.09);
|
||||
--code-bg: #171b31;
|
||||
--code-fg: #aee7ff;
|
||||
--input-bg: #21132b;
|
||||
--input-fg: #fff0fa;
|
||||
--input-border: rgba(255, 91, 173, 0.43);
|
||||
--button-bg: #2a1736;
|
||||
--button-fg: #fff2fa;
|
||||
--button-border: rgba(255, 91, 173, 0.47);
|
||||
--button-hover-bg: #472044;
|
||||
--danger: #ff477e;
|
||||
--accent: #ff4fa3;
|
||||
--row-hover: rgba(255, 79, 163, 0.14);
|
||||
--code-bg: #1b1024;
|
||||
--code-fg: #ffc1df;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
:root {
|
||||
--bg: #11101b;
|
||||
--fg: #f7f1ff;
|
||||
--muted: #a49ab6;
|
||||
--panel: #191629;
|
||||
--border: rgba(255, 145, 58, 0.25);
|
||||
--border-soft: rgba(117, 220, 224, 0.12);
|
||||
--link: #ff9b49;
|
||||
--link-hover: #ffd2a8;
|
||||
--input-bg: #1d1930;
|
||||
--input-fg: #f7f1ff;
|
||||
--input-border: rgba(116, 214, 220, 0.34);
|
||||
--button-bg: #28213c;
|
||||
--button-fg: #ffe8d2;
|
||||
--button-border: rgba(255, 139, 48, 0.38);
|
||||
--button-hover-bg: #382b4e;
|
||||
--danger: #ff537a;
|
||||
--accent: #f6812d;
|
||||
--row-hover: rgba(117, 220, 224, 0.10);
|
||||
--code-bg: #0d0c16;
|
||||
--code-fg: #82e1df;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
:root {
|
||||
--bg: #fffaf4;
|
||||
--fg: #30241d;
|
||||
--muted: #806d61;
|
||||
--panel: #ffffff;
|
||||
--border: rgba(225, 108, 28, 0.23);
|
||||
--border-soft: rgba(225, 108, 28, 0.11);
|
||||
--link: #d85e13;
|
||||
--link-hover: #9f3900;
|
||||
--input-bg: #fffefd;
|
||||
--input-fg: #30241d;
|
||||
--input-border: rgba(221, 99, 21, 0.34);
|
||||
--button-bg: #fff0df;
|
||||
--button-fg: #a94308;
|
||||
--button-border: rgba(221, 99, 21, 0.38);
|
||||
--button-hover-bg: #ffe2c1;
|
||||
--danger: #cf334f;
|
||||
--accent: #ed741f;
|
||||
--row-hover: rgba(237, 116, 31, 0.09);
|
||||
--code-bg: #fff1e2;
|
||||
--code-fg: #8a3b0d;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License
|
||||
|
||||
The work in the DejaVu project was committed to the public domain.
|
||||
|
||||
Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera"
|
||||
|
||||
### MIT License
|
||||
|
||||
Copyright (c) 2018 Source Foundry Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
### BITSTREAM VERA LICENSE
|
||||
|
||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.
|
||||
@@ -0,0 +1,126 @@
|
||||
# Nerd Fonts Licensing
|
||||
|
||||
There are various sources used under various licenses:
|
||||
|
||||
* Nerd Fonts source fonts, patched fonts, and folders with explict OFL SIL files are licensed under SIL OPEN FONT LICENSE Version 1.1 (see below).
|
||||
* Nerd Fonts original source code files (such as `.sh`, `.py`, `font-patcher` and others) are licensed under the MIT License (MIT) (see below).
|
||||
* Many other licenses are present in this project for even more detailed breakdown see: [License Audit](https://github.com/ryanoasis/nerd-fonts/blob/-/license-audit.md).
|
||||
|
||||
## Source files not in folders containing an explicit license are using the MIT License (MIT)
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Ryan L McIntyre
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
## Various Fonts, Patched Fonts, SVGs, Glyph Fonts, and any files in a folder with explicit SIL OFL 1.1 License
|
||||
|
||||
Copyright (c) 2014, Ryan L McIntyre (https://ryanlmcintyre.com).
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Hack Nerd Font
|
||||
|
||||
Vendored from Nerd Fonts **v3.2.1**:
|
||||
https://github.com/ryanoasis/nerd-fonts/blob/v3.2.1/patched-fonts/Hack/Regular/HackNerdFont-Regular.ttf
|
||||
|
||||
Hack upstream license: `LICENSE.md` (Source Foundry Hack v3.003).
|
||||
Nerd Fonts license and icon-license references: `NERD-FONTS-LICENSE`.
|
||||
|
||||
Served by `/static/css/fonts.css`; no runtime CDN request is needed.
|
||||
+39
-51
@@ -27,6 +27,8 @@ async function renderMarkdownPreview() {
|
||||
body: JSON.stringify({
|
||||
markdown:
|
||||
editor.value,
|
||||
path: window.PagesWikiCurrentPath || location.pathname,
|
||||
projection: true,
|
||||
}),
|
||||
},
|
||||
)
|
||||
@@ -44,7 +46,8 @@ async function restoreRevision(
|
||||
|
||||
const res = await fetch(
|
||||
"/_/api/v1/revisions/restore?revision="
|
||||
+ revisionUUID,
|
||||
+ encodeURIComponent(revisionUUID),
|
||||
{ method: "POST" },
|
||||
)
|
||||
|
||||
if (!res.ok) {
|
||||
@@ -56,57 +59,42 @@ async function restoreRevision(
|
||||
}
|
||||
|
||||
async function openRevisionDialog() {
|
||||
|
||||
const objectUUID =
|
||||
document.getElementById(
|
||||
"object-uuid",
|
||||
).value
|
||||
|
||||
const res = await fetch(
|
||||
"/_/api/v1/revisions/list?uuid="
|
||||
+ objectUUID,
|
||||
)
|
||||
|
||||
const revisions =
|
||||
await res.json()
|
||||
|
||||
const root =
|
||||
document.getElementById(
|
||||
"revision-list",
|
||||
)
|
||||
|
||||
root.innerHTML = ""
|
||||
|
||||
revisions.forEach((r) => {
|
||||
|
||||
const div =
|
||||
document.createElement("div")
|
||||
|
||||
div.className =
|
||||
"revision-item"
|
||||
|
||||
const ts =
|
||||
new Date(
|
||||
r.created_at * 1000,
|
||||
)
|
||||
|
||||
div.innerHTML =
|
||||
"<code>"
|
||||
+ r.uuid
|
||||
+ "</code><br>"
|
||||
+ ts.toLocaleString()
|
||||
+ "<br>"
|
||||
+ r.message
|
||||
+ "<br><button onclick=\"restoreRevision('"
|
||||
+ r.uuid
|
||||
+ "')\">Restore</button>"
|
||||
|
||||
root.appendChild(div)
|
||||
const objectUUID = document.getElementById("object-uuid")?.value
|
||||
const root = document.getElementById("revision-list")
|
||||
const dialog = document.getElementById("revision-dialog")
|
||||
if (!objectUUID || !root || !dialog) return
|
||||
const ja = document.documentElement.lang.startsWith("ja")
|
||||
const res = await fetch("/_/api/v1/revisions/list?uuid=" + encodeURIComponent(objectUUID))
|
||||
if (!res.ok) {
|
||||
root.textContent = ja ? "履歴を取得できませんでした。" : "Revision history is unavailable."
|
||||
dialog.showModal()
|
||||
return
|
||||
}
|
||||
const revisions = await res.json()
|
||||
root.replaceChildren()
|
||||
revisions.forEach((revision) => {
|
||||
const item = document.createElement("div")
|
||||
item.className = "revision-item"
|
||||
const id = document.createElement("code")
|
||||
id.textContent = revision.uuid
|
||||
const time = document.createElement("div")
|
||||
time.textContent = new Date(revision.created_at * 1000).toLocaleString()
|
||||
const message = document.createElement("p")
|
||||
message.textContent = revision.message
|
||||
const restore = document.createElement("button")
|
||||
restore.type = "button"
|
||||
restore.textContent = ja ? "復元" : "Restore"
|
||||
restore.addEventListener("click", () => restoreRevision(revision.uuid))
|
||||
item.append(id, time, message, restore)
|
||||
root.append(item)
|
||||
})
|
||||
|
||||
document.getElementById(
|
||||
"revision-dialog",
|
||||
).showModal()
|
||||
if (res.headers.get("X-Next-Cursor")) {
|
||||
const more = document.createElement("a")
|
||||
more.href = "/r/history/" + encodeURIComponent(objectUUID)
|
||||
more.textContent = ja ? "すべての履歴を表示" : "Browse revision history"
|
||||
root.append(more)
|
||||
}
|
||||
dialog.showModal()
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const ja = document.documentElement.lang.startsWith('ja');
|
||||
const id = location.pathname.split('/').filter(Boolean).pop();
|
||||
const result = document.querySelector('[data-import-result]');
|
||||
const rows = () => Array.from(document.querySelectorAll('[data-import-item]'));
|
||||
const fields = ['target_path', 'quartier', 'street', 'spot'];
|
||||
const namePattern = /^[a-z0-9][a-z0-9_-]{1,63}$/;
|
||||
|
||||
const style = document.createElement('style');
|
||||
style.textContent = '.import-bulk-replace{display:flex;gap:.45rem;align-items:center;flex-wrap:wrap;margin:.7rem 0}.import-row-warning{display:block;color:var(--danger);font-size:.72rem;max-width:15rem;white-space:normal}.import-row-hint{color:var(--muted)}tr.import-invalid{background:color-mix(in srgb,var(--danger) 8%,transparent)}';
|
||||
document.head.appendChild(style);
|
||||
|
||||
document.querySelectorAll('[data-field=spot]').forEach(input => {
|
||||
if (!input.value) input.placeholder = ja ? '未定義(Street所属)' : 'Undefined (Street inbox)';
|
||||
const status = document.createElement('small');
|
||||
status.className = 'import-row-warning';
|
||||
input.closest('td').appendChild(status);
|
||||
});
|
||||
|
||||
const validateRow = row => {
|
||||
const get = name => row.querySelector(`[data-field=${name}]`).value.trim();
|
||||
const sourceDepth = row.querySelector('code').textContent.split('/').filter(Boolean).length;
|
||||
const quartier = get('quartier'), street = get('street'), spot = get('spot');
|
||||
const status = row.querySelector('.import-row-warning');
|
||||
let error = '', hint = '';
|
||||
if (street && !quartier) error = ja ? 'StreetにはQuartierが必要です' : 'Street requires a Quartier';
|
||||
else if (spot && !street) error = ja ? 'SpotにはStreetが必要です' : 'Spot requires a Street';
|
||||
else if ([quartier, street, spot].some(value => value && !namePattern.test(value))) error = ja ? 'City名は英小文字・数字・_・-を2〜64文字で指定してください' : 'City names require 2–64 lowercase letters, digits, _ or -';
|
||||
else if (spot === street && spot) hint = ja ? '同名のため未定義Spotとして配置されます' : 'Same name: assigned to the undefined Spot';
|
||||
else if (!spot && street) hint = ja ? '未定義SpotとしてStreetへ所属します' : 'Assigned to the Street undefined Spot';
|
||||
else if (spot && sourceDepth <= 3) hint = ja ? `Spot PathはStreet配下の _${spot} になります` : `Spot Path will be _${spot} below the Street`;
|
||||
status.textContent = error || hint;
|
||||
status.classList.toggle('import-row-hint', !error);
|
||||
row.classList.toggle('import-invalid', !!error);
|
||||
return !error;
|
||||
};
|
||||
const validateAll = () => rows().every(validateRow);
|
||||
rows().forEach(row => fields.forEach(field => row.querySelector(`[data-field=${field}]`).addEventListener('input', () => validateRow(row))));
|
||||
validateAll();
|
||||
|
||||
const actions = document.querySelector('.import-actions');
|
||||
if (actions) {
|
||||
const bulk = document.createElement('div');
|
||||
bulk.className = 'import-bulk-replace';
|
||||
bulk.innerHTML = `<strong>${ja ? '一括置換' : 'Bulk replace'}</strong><input data-replace-from placeholder="${ja ? '検索文字列' : 'Find'}"><span>→</span><input data-replace-to placeholder="${ja ? '置換文字列' : 'Replace'}"><select data-replace-field><option value="all">${ja ? 'すべての編集列' : 'All editable columns'}</option><option value="target_path">Path</option><option value="quartier">Quartier</option><option value="street">Street</option><option value="spot">Spot</option></select><button type="button" data-replace-apply>${ja ? '置換' : 'Replace'}</button>`;
|
||||
actions.before(bulk);
|
||||
bulk.querySelector('[data-replace-apply]').addEventListener('click', () => {
|
||||
const from = bulk.querySelector('[data-replace-from]').value;
|
||||
if (!from) return;
|
||||
const to = bulk.querySelector('[data-replace-to]').value;
|
||||
const scope = bulk.querySelector('[data-replace-field]').value;
|
||||
const targets = scope === 'all' ? fields : [scope];
|
||||
rows().forEach(row => targets.forEach(field => {
|
||||
const input = row.querySelector(`[data-field=${field}]`);
|
||||
input.value = input.value.split(from).join(to);
|
||||
}));
|
||||
validateAll();
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelector('.import-table-wrap')?.addEventListener('keydown', event => {
|
||||
if (event.key !== 'Tab' || !event.target.matches('input[data-field]:not([type=checkbox])')) return;
|
||||
const column = event.target.dataset.field;
|
||||
const inputs = rows().map(row => row.querySelector(`input[data-field=${column}]`)).filter(Boolean);
|
||||
const current = inputs.indexOf(event.target);
|
||||
const next = current + (event.shiftKey ? -1 : 1);
|
||||
if (next < 0 || next >= inputs.length) return;
|
||||
event.preventDefault();
|
||||
inputs[next].focus();
|
||||
inputs[next].select();
|
||||
});
|
||||
|
||||
const collect = () => rows().map(row => ({
|
||||
sequence: Number(row.dataset.sequence),
|
||||
selected: row.querySelector('[data-field=selected]').checked,
|
||||
target_path: row.querySelector('[data-field=target_path]').value,
|
||||
quartier: row.querySelector('[data-field=quartier]').value,
|
||||
street: row.querySelector('[data-field=street]').value,
|
||||
spot: row.querySelector('[data-field=spot]').value,
|
||||
}));
|
||||
const call = async (method, body) => {
|
||||
if (result) result.textContent = '…';
|
||||
const response = await fetch('/_/api/v1/import/' + encodeURIComponent(id), {method, headers: {'Content-Type': 'application/json'}, body: body ? JSON.stringify(body) : undefined});
|
||||
const data = await response.json().catch(() => ({}));
|
||||
if (!response.ok) throw new Error(data.error || `HTTP ${response.status}`);
|
||||
return data;
|
||||
};
|
||||
document.querySelector('[data-save-plan]')?.addEventListener('click', async () => { if (!validateAll()) return; try { await call('PATCH', {items: collect()}); result.textContent = ja ? '計画を保存しました' : 'Plan saved'; } catch (error) { result.textContent = error.message; } });
|
||||
document.querySelector('[data-commit-import]')?.addEventListener('click', async () => { if (!validateAll()) return; try { await call('PATCH', {items: collect()}); await call('POST', {conflict: document.querySelector('[data-conflict]').value}); location.reload(); } catch (error) { result.textContent = error.message; } });
|
||||
document.querySelector('[data-rollback-import]')?.addEventListener('click', async () => { if (!confirm(ja ? 'このimportで作成したPathを取り消しますか?' : 'Roll back paths created by this import?')) return; try { await call('DELETE'); location.reload(); } catch (error) { result.textContent = error.message; } });
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
(() => {
|
||||
const form = document.getElementById('bookmark-form');
|
||||
if (!form) return;
|
||||
const msg = form.dataset, groups = [];
|
||||
for (const row of document.querySelectorAll('#bookmark-source-rows tr')) {
|
||||
const item = {label:row.querySelector('[name=bookmark_label]').value, href:row.querySelector('[name=bookmark_target]').value, kind:row.querySelector('[name=bookmark_kind]').value, children:row.querySelector('[data-bookmark-children]').checked};
|
||||
if (item.kind === 'section') groups.push({section:item, links:[]});
|
||||
else { if (!groups.length) groups.push({section:null,links:[]}); groups.at(-1).links.push(item); }
|
||||
}
|
||||
const legacy = form.querySelector('.bookmark-legacy');
|
||||
legacy.hidden = true; legacy.querySelectorAll('input,select').forEach(input => input.disabled = true);
|
||||
const el = (tag, cls, text) => { const node = document.createElement(tag); if (cls) node.className = cls; if (text) node.textContent = text; return node; };
|
||||
const editor = el('div','bookmark-card-editor'); legacy.before(editor);
|
||||
const toolbar = el('div','bookmark-editor-toolbar'); editor.before(toolbar);
|
||||
const status = form.querySelector('[data-bookmark-status]');
|
||||
const count = () => groups.reduce((n,g) => n + g.links.length + (g.section ? 1 : 0), 0);
|
||||
const room = () => { if (count() < 64) return true; status.textContent = msg.limit; return false; };
|
||||
const button = (text, action, title = text) => {const node = el('button','',text); node.type='button'; node.title=title; node.setAttribute('aria-label',title); node.addEventListener('click',action); return node;};
|
||||
const field = (title, value, change, required = true) => {
|
||||
const label=el('label','bookmark-field'), input=el('input'); label.append(el('span','',title),input);
|
||||
input.value=value; input.required=required; input.maxLength=(title===msg.label || title===msg.section) ? 200 : 4096;
|
||||
input.addEventListener('input',()=>change(input.value)); return label;
|
||||
};
|
||||
const addLink = group => { if (!room()) return; group.links.push({kind:'path', label:'', href:'', children:false}); render(); editor.querySelectorAll('.bookmark-link-row').item([...editor.querySelectorAll('.bookmark-link-row')].length-1)?.querySelector('input')?.focus(); };
|
||||
toolbar.append(button(msg.addSection,()=>{
|
||||
if (!room() || groups.filter(g=>g.section).length>=16) {status.textContent=msg.limit;return;}
|
||||
groups.push({section:{kind:'section',label:'',href:'',children:false},links:[]});render();editor.lastElementChild.querySelector('input').focus();
|
||||
}),button(msg.addLink,()=>{if(!groups.length)groups.push({section:null,links:[]});addLink(groups.at(-1));}));
|
||||
function render() {
|
||||
editor.replaceChildren();
|
||||
groups.forEach((group,index) => {
|
||||
const card=el('fieldset','bookmark-editor-card'), header=el('div','bookmark-card-head');
|
||||
if (group.section) {
|
||||
header.append(field(msg.section,group.section.label,v=>group.section.label=v));
|
||||
const up=button('↑',()=>{[groups[index-1],groups[index]]=[groups[index],groups[index-1]];render();},msg.up);
|
||||
up.disabled=index===0 || !groups[index-1].section;
|
||||
const down=button('↓',()=>{[groups[index+1],groups[index]]=[groups[index],groups[index+1]];render();},msg.down);down.disabled=index===groups.length-1;
|
||||
header.append(up,down,button('×',()=>{if(!confirm(msg.confirm))return;groups.splice(index,1);render();},msg.remove));
|
||||
} else header.append(el('h3','',msg.default));
|
||||
card.append(header);
|
||||
if (group.section) {
|
||||
const options=el('div','bookmark-section-options'), toggle=el('label','bookmark-toggle'), check=el('input');check.type='checkbox';check.role='switch';check.checked=group.section.children;
|
||||
toggle.append(check,el('span','',msg.children));check.addEventListener('change',()=>{group.section.children=check.checked;render();});
|
||||
options.append(toggle);
|
||||
if (group.section.children) options.append(field('Path',group.section.href,v=>group.section.href=v),el('p','muted',msg.auto));
|
||||
card.append(options);
|
||||
}
|
||||
group.links.forEach((link,li) => {
|
||||
const row=el('div','bookmark-link-row');
|
||||
row.append(field(msg.label,link.label,v=>link.label=v));
|
||||
const kind=el('select');kind.setAttribute('aria-label',msg.target);
|
||||
for (const value of ['path','url']) {const option=el('option','',value==='path'?'Path':'URL');option.value=value;kind.append(option);}kind.value=link.kind;kind.addEventListener('change',()=>link.kind=kind.value);
|
||||
row.append(kind,field(msg.target,link.href,v=>link.href=v));
|
||||
const move=el('select');move.setAttribute('aria-label',msg.section);
|
||||
groups.forEach((g,i)=>{const option=el('option','',g.section?.label||msg.default);option.value=i;move.append(option);});move.value=index;
|
||||
move.addEventListener('change',()=>{group.links.splice(li,1);groups[Number(move.value)].links.push(link);render();});row.append(move);
|
||||
const up=button('↑',()=>{[group.links[li-1],group.links[li]]=[group.links[li],group.links[li-1]];render();},msg.up);up.disabled=li===0;
|
||||
const down=button('↓',()=>{[group.links[li+1],group.links[li]]=[group.links[li],group.links[li+1]];render();},msg.down);down.disabled=li===group.links.length-1;
|
||||
row.append(up,down,button('×',()=>{group.links.splice(li,1);render();},msg.remove));card.append(row);
|
||||
});
|
||||
card.append(button(msg.addLink,()=>addLink(group)));editor.append(card);
|
||||
});
|
||||
}
|
||||
render();
|
||||
const dialog=document.querySelector('[data-bookmark-dialog]'), open=document.querySelector('[data-bookmark-open]');
|
||||
let dirty=false;
|
||||
form.addEventListener('input',()=>dirty=true);form.addEventListener('change',()=>dirty=true);
|
||||
toolbar.addEventListener('click',()=>dirty=true);editor.addEventListener('click',e=>{if(e.target.closest('button'))dirty=true;});
|
||||
if (dialog) {
|
||||
open.addEventListener('click',()=>dialog.showModal());
|
||||
dialog.querySelector('[data-bookmark-close]').addEventListener('click',()=>dialog.close());
|
||||
dialog.addEventListener('click',event=>{if(event.target===dialog){const r=dialog.getBoundingClientRect();if(event.clientX<r.left||event.clientX>r.right||event.clientY<r.top||event.clientY>r.bottom)dialog.close();}});
|
||||
dialog.addEventListener('close',()=>open.focus());
|
||||
}
|
||||
window.addEventListener('beforeunload',event=>{if(dirty){event.preventDefault();event.returnValue='';}});
|
||||
form.addEventListener('submit',async event=>{
|
||||
event.preventDefault();const save=form.querySelector('[type=submit]');if(save.disabled)return;
|
||||
const data=new URLSearchParams(new FormData(form));
|
||||
for(const group of groups)for(const item of [...(group.section?[group.section]:[]),...group.links]){
|
||||
data.append('bookmark_label',item.label);data.append('bookmark_kind',item.kind);data.append('bookmark_target',item.href);data.append('bookmark_children',String(Boolean(item.children)));
|
||||
}
|
||||
save.disabled=true;status.textContent='';
|
||||
try{
|
||||
const response=await fetch(form.action,{method:'POST',body:data,headers:{Accept:'application/json'},signal:AbortSignal.timeout(15000)});
|
||||
if(!response.ok)throw new Error((await response.text()).trim());await response.json();dirty=false;status.textContent=msg.saved;
|
||||
if(dialog){dialog.close();location.reload();}
|
||||
}catch(error){status.textContent=error.message;}finally{save.disabled=false;}
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,32 @@
|
||||
(() => {
|
||||
// At most two background listings at a time; no previews or revision fetches.
|
||||
const queue = []; let active = 0;
|
||||
const pump = () => { while (active < 2 && queue.length) { active++; queue.shift()().finally(() => { active--; pump(); }); } };
|
||||
const enqueue = job => { queue.push(job); pump(); };
|
||||
const observer = new IntersectionObserver(entries => {
|
||||
for (const entry of entries) if (entry.isIntersecting) { observer.unobserve(entry.target); entry.target._load(); }
|
||||
}, {rootMargin: '100px'});
|
||||
for (const list of document.querySelectorAll('[data-bookmark-source]')) {
|
||||
const button = list.parentElement.querySelector('[data-bookmark-load]');
|
||||
let after = '', busy = false;
|
||||
const load = () => {
|
||||
if (busy) return; busy = true; button.disabled = true; list.setAttribute('aria-busy', 'true');
|
||||
enqueue(async () => {
|
||||
try {
|
||||
const url = new URL(list.dataset.bookmarkSource, location.origin);
|
||||
if (after) url.searchParams.set('after', after);
|
||||
const response = await fetch(url, {cache: 'no-store', signal: AbortSignal.timeout(15000)});
|
||||
if (!response.ok) throw new Error(String(response.status));
|
||||
const data = await response.json();
|
||||
for (const link of data.links) {
|
||||
const li = document.createElement('li'), a = document.createElement('a');
|
||||
a.href = link.href; a.textContent = link.label; li.append(a); list.append(li);
|
||||
}
|
||||
after = data.next; button.hidden = !after; button.textContent = button.dataset.more;
|
||||
} catch (_) { button.textContent = button.dataset.error; }
|
||||
finally { busy = false; button.disabled = false; list.setAttribute('aria-busy', 'false'); }
|
||||
});
|
||||
};
|
||||
list._load = load; button.addEventListener('click', load); observer.observe(list);
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,376 @@
|
||||
let browserSelectionAnchor = null;
|
||||
let activeNavigatorLink = null;
|
||||
|
||||
function browserRows() {
|
||||
return Array.from(document.querySelectorAll('.browser-row'));
|
||||
}
|
||||
|
||||
function selectedEntries() {
|
||||
return browserRows().filter(row => row.classList.contains('selected'));
|
||||
}
|
||||
|
||||
function markEntrySelected(row, selected) {
|
||||
row.classList.toggle('selected', selected);
|
||||
row.setAttribute('aria-selected', String(selected));
|
||||
}
|
||||
|
||||
function clearBrowserSelection() {
|
||||
browserRows().forEach(row => markEntrySelected(row, false));
|
||||
selectedEntry = null;
|
||||
updateSelectionStatus();
|
||||
}
|
||||
|
||||
function updateSelectionStatus() {
|
||||
const count = selectedEntries().length;
|
||||
const status = document.getElementById('browser-selection-status');
|
||||
if (status) status.textContent = count ? `${count} selected` : '';
|
||||
const rename = document.getElementById('browser-context-rename');
|
||||
if (rename) rename.disabled = count !== 1;
|
||||
}
|
||||
|
||||
function selectEntry(el, event) {
|
||||
const modifier = Boolean(event && (event.ctrlKey || event.metaKey));
|
||||
const range = Boolean(event && event.shiftKey && browserSelectionAnchor);
|
||||
if (range) {
|
||||
const rows = browserRows();
|
||||
const from = rows.indexOf(browserSelectionAnchor);
|
||||
const to = rows.indexOf(el);
|
||||
if (!modifier) rows.forEach(row => markEntrySelected(row, false));
|
||||
if (from >= 0 && to >= 0) {
|
||||
const [start, end] = from < to ? [from, to] : [to, from];
|
||||
rows.slice(start, end + 1).forEach(row => markEntrySelected(row, true));
|
||||
}
|
||||
} else if (modifier) {
|
||||
markEntrySelected(el, !el.classList.contains('selected'));
|
||||
browserSelectionAnchor = el;
|
||||
} else {
|
||||
browserRows().forEach(row => markEntrySelected(row, row === el));
|
||||
browserSelectionAnchor = el;
|
||||
}
|
||||
const selected = selectedEntries();
|
||||
selectedEntry = el.classList.contains('selected') ? el : (selected.at(-1) || null);
|
||||
if (selectedEntry) updatePreview(selectedEntry);
|
||||
updateSelectionStatus();
|
||||
}
|
||||
|
||||
function openContextMenu(ev, el) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
if (!el.classList.contains('selected')) selectEntry(el);
|
||||
selectedEntry = el;
|
||||
const menu = document.getElementById('context-menu');
|
||||
const rename = menu.querySelector('button:nth-child(3)');
|
||||
if (rename) {
|
||||
rename.id = 'browser-context-rename';
|
||||
rename.disabled = selectedEntries().length !== 1;
|
||||
}
|
||||
placeContextMenu(menu, ev.clientX, ev.clientY);
|
||||
loadContextAdapters(el.dataset.path);
|
||||
}
|
||||
|
||||
function placeContextMenu(menu, x, y) {
|
||||
menu.style.display = 'block';
|
||||
menu.style.left = `${x}px`;
|
||||
menu.style.top = `${y}px`;
|
||||
const bounds = menu.getBoundingClientRect();
|
||||
menu.style.left = `${Math.max(8, Math.min(x, innerWidth - bounds.width - 8))}px`;
|
||||
menu.style.top = `${Math.max(8, Math.min(y, innerHeight - bounds.height - 8))}px`;
|
||||
}
|
||||
|
||||
function selectionMarquee() {
|
||||
const grid = document.getElementById('browser-grid');
|
||||
const box = document.getElementById('selection-marquee');
|
||||
if (!grid || !box) return;
|
||||
grid.addEventListener('pointerdown', event => {
|
||||
if (event.button !== 0 || event.target.closest('.browser-row,button,a,input')) return;
|
||||
const startX = event.clientX;
|
||||
const startY = event.clientY;
|
||||
const additive = event.ctrlKey || event.metaKey;
|
||||
const initial = new Set(additive ? selectedEntries() : []);
|
||||
let active = false;
|
||||
try { grid.setPointerCapture?.(event.pointerId); } catch (_) {}
|
||||
|
||||
const move = current => {
|
||||
if (!active && Math.hypot(current.clientX - startX, current.clientY - startY) < 4) return;
|
||||
active = true;
|
||||
current.preventDefault();
|
||||
const left = Math.min(startX, current.clientX);
|
||||
const top = Math.min(startY, current.clientY);
|
||||
const right = Math.max(startX, current.clientX);
|
||||
const bottom = Math.max(startY, current.clientY);
|
||||
Object.assign(box.style, {
|
||||
display: 'block', left: `${left}px`, top: `${top}px`,
|
||||
width: `${right - left}px`, height: `${bottom - top}px`
|
||||
});
|
||||
for (const row of browserRows()) {
|
||||
const rect = row.getBoundingClientRect();
|
||||
const hit = rect.left < right && rect.right > left && rect.top < bottom && rect.bottom > top;
|
||||
markEntrySelected(row, initial.has(row) || hit);
|
||||
}
|
||||
const selected = selectedEntries();
|
||||
selectedEntry = selected.at(-1) || null;
|
||||
updateSelectionStatus();
|
||||
const edge = 44;
|
||||
const main = grid.closest('.browser-main');
|
||||
if (main && current.clientY > innerHeight - edge) main.scrollTop += 18;
|
||||
if (main && current.clientY < grid.getBoundingClientRect().top + edge) main.scrollTop -= 18;
|
||||
};
|
||||
const finish = current => {
|
||||
grid.removeEventListener('pointermove', move);
|
||||
grid.removeEventListener('pointerup', finish);
|
||||
grid.removeEventListener('pointercancel', finish);
|
||||
try { grid.releasePointerCapture?.(current.pointerId); } catch (_) {}
|
||||
box.style.display = 'none';
|
||||
if (!active && !additive) clearBrowserSelection();
|
||||
if (selectedEntry) updatePreview(selectedEntry);
|
||||
};
|
||||
grid.addEventListener('pointermove', move);
|
||||
grid.addEventListener('pointerup', finish);
|
||||
grid.addEventListener('pointercancel', finish);
|
||||
});
|
||||
}
|
||||
|
||||
function draggedItems(event) {
|
||||
let raw = '';
|
||||
try { raw = event.dataTransfer.getData('application/x-pageswiki-paths'); } catch (_) {}
|
||||
if (raw) {
|
||||
try {
|
||||
const items = JSON.parse(raw);
|
||||
if (Array.isArray(items)) return items.filter(item => item && typeof item.path === 'string');
|
||||
} catch (_) {}
|
||||
}
|
||||
const path = event.dataTransfer.getData('text/plain') || draggedPath;
|
||||
if (!path) return [];
|
||||
const row = browserRows().find(item => item.dataset.path === path);
|
||||
return [{path, name: row?.dataset.name || path.split('/').pop(), is_directory: row?.dataset.isDir === 'true'}];
|
||||
}
|
||||
|
||||
function dragStart(ev, el) {
|
||||
if (!el.classList.contains('selected')) selectEntry(el);
|
||||
const items = selectedEntries().map(row => ({
|
||||
path: row.dataset.path,
|
||||
name: row.dataset.name,
|
||||
is_directory: row.dataset.isDir === 'true'
|
||||
}));
|
||||
draggedPath = el.dataset.path;
|
||||
ev.dataTransfer.effectAllowed = 'copyMove';
|
||||
ev.dataTransfer.setData('application/x-pageswiki-paths', JSON.stringify(items));
|
||||
ev.dataTransfer.setData('text/plain', items.map(item => item.path).join('\n'));
|
||||
}
|
||||
|
||||
function dragOver(ev, el) {
|
||||
if (el.dataset.isDir === 'true') {
|
||||
ev.preventDefault();
|
||||
ev.dataTransfer.dropEffect = 'move';
|
||||
}
|
||||
}
|
||||
|
||||
async function dropEntry(ev, el) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
if (el.dataset.isDir !== 'true') return;
|
||||
const targetDir = el.dataset.path.replace(/\/$/, '');
|
||||
const items = draggedItems(ev).filter(item => item.path !== targetDir);
|
||||
if (!items.length) return;
|
||||
const moves = items.map(item => ({
|
||||
...item,
|
||||
destination: `${targetDir}/${item.path.replace(/\/+$/, '').split('/').pop()}`
|
||||
})).filter(item => item.destination !== item.path);
|
||||
if (!moves.length) return;
|
||||
if (!confirm(`${moves.length} item(s)\n→ ${targetDir}`)) return;
|
||||
await runMoveQueue(moves);
|
||||
location.reload();
|
||||
}
|
||||
|
||||
async function ctxRename() {
|
||||
const entries = selectedEntries();
|
||||
if (entries.length !== 1) return;
|
||||
const entry = entries[0];
|
||||
const oldPath = entry.dataset.path;
|
||||
const newPath = prompt('Rename path:', oldPath);
|
||||
if (!newPath || newPath === oldPath) return;
|
||||
await renamePath(oldPath, newPath, entry.dataset.isDir === 'true');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function ctxCopy() {
|
||||
const paths = selectedEntries().map(row => row.dataset.path);
|
||||
if (!paths.length) return;
|
||||
localStorage.setItem('pageswiki.fileClipboard', JSON.stringify({
|
||||
operation: 'copy', paths, created_at: Date.now()
|
||||
}));
|
||||
}
|
||||
|
||||
function ctxCopyPath() {
|
||||
const paths = selectedEntries().map(row => row.dataset.path);
|
||||
if (paths.length) navigator.clipboard.writeText(paths.join('\n'));
|
||||
}
|
||||
|
||||
async function renamePath(oldPath, newPath, recursive = false, operation = null, range = {start: 0, end: 100}) {
|
||||
const ownOperation = !operation;
|
||||
operation ||= startBrowserOperation('Renaming', oldPath, true);
|
||||
const request = {old_path: oldPath, new_path: newPath, recursive};
|
||||
try {
|
||||
const preview = await fetch('/_/api/v1/path/rename?preview=1', {
|
||||
method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(request)
|
||||
});
|
||||
if (!preview.ok) throw new Error((await preview.text()).trim() || 'rename preview failed');
|
||||
const estimate = await preview.json();
|
||||
const count = Number(estimate.count || 1);
|
||||
updateBrowserOperation(operation, range.start + (range.end - range.start) * .2,
|
||||
`${count} path${count === 1 ? '' : 's'} · ${newPath}`);
|
||||
const response = await fetch('/_/api/v1/path/rename', {
|
||||
method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(request)
|
||||
});
|
||||
if (!response.ok) throw new Error((await response.text()).trim() || 'rename failed');
|
||||
const result = await response.json().catch(() => ({count}));
|
||||
updateBrowserOperation(operation, range.end, `${result.count || count} path${(result.count || count) === 1 ? '' : 's'}`);
|
||||
if (ownOperation) finishBrowserOperation(operation);
|
||||
return result.count || count;
|
||||
} catch (error) {
|
||||
failBrowserOperation(operation, error.message);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async function runMoveQueue(moves) {
|
||||
const operation = startBrowserOperation('Moving items', `0 / ${moves.length}`, true);
|
||||
for (let index = 0; index < moves.length; index += 1) {
|
||||
const move = moves[index];
|
||||
await renamePath(move.path, move.destination, Boolean(move.is_directory), operation, {
|
||||
start: index / moves.length * 100,
|
||||
end: (index + 1) / moves.length * 100
|
||||
});
|
||||
updateBrowserOperation(operation, (index + 1) / moves.length * 100, `${index + 1} / ${moves.length}`);
|
||||
}
|
||||
finishBrowserOperation(operation);
|
||||
}
|
||||
|
||||
function startBrowserOperation(title, detail, indeterminate = false) {
|
||||
const operation = document.createElement('div');
|
||||
operation.className = `browser-operation${indeterminate ? ' indeterminate' : ''}`;
|
||||
operation.style.setProperty('--operation-progress', '4');
|
||||
operation.innerHTML = '<svg class="operation-ring" viewBox="0 0 36 36" aria-hidden="true"><circle class="operation-ring-track" cx="18" cy="18" r="15.9"></circle><circle class="operation-ring-value" cx="18" cy="18" r="15.9" pathLength="100"></circle></svg><div><div class="operation-title"></div><div class="operation-detail"></div></div>';
|
||||
operation.querySelector('.operation-title').textContent = title;
|
||||
operation.querySelector('.operation-detail').textContent = detail;
|
||||
document.getElementById('browser-operation-stack').append(operation);
|
||||
return operation;
|
||||
}
|
||||
|
||||
function updateBrowserOperation(operation, progress, detail) {
|
||||
operation.classList.remove('indeterminate');
|
||||
operation.style.setProperty('--operation-progress', String(Math.max(0, Math.min(100, progress))));
|
||||
if (detail) operation.querySelector('.operation-detail').textContent = detail;
|
||||
}
|
||||
|
||||
function finishBrowserOperation(operation) {
|
||||
updateBrowserOperation(operation, 100);
|
||||
operation.classList.add('done');
|
||||
setTimeout(() => operation.remove(), 1000);
|
||||
}
|
||||
|
||||
function failBrowserOperation(operation, detail) {
|
||||
operation.classList.remove('indeterminate');
|
||||
operation.classList.add('failed');
|
||||
operation.style.setProperty('--operation-progress', '100');
|
||||
operation.querySelector('.operation-title').textContent = 'Operation failed';
|
||||
operation.querySelector('.operation-detail').textContent = detail;
|
||||
}
|
||||
|
||||
function navigatorDragOver(event) {
|
||||
const container = document.getElementById('navigator-links');
|
||||
if (container?.dataset.editable !== 'true') return;
|
||||
event.preventDefault();
|
||||
event.dataTransfer.dropEffect = 'copy';
|
||||
document.getElementById('browser-sidebar').classList.add('is-drop-target');
|
||||
}
|
||||
|
||||
function navigatorDragLeave(event) {
|
||||
const sidebar = document.getElementById('browser-sidebar');
|
||||
if (!sidebar.contains(event.relatedTarget)) sidebar.classList.remove('is-drop-target');
|
||||
}
|
||||
|
||||
async function navigatorDrop(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const sidebar = document.getElementById('browser-sidebar');
|
||||
sidebar.classList.remove('is-drop-target');
|
||||
const container = document.getElementById('navigator-links');
|
||||
if (container?.dataset.editable !== 'true') return;
|
||||
const items = draggedItems(event);
|
||||
if (!items.length) return;
|
||||
const operation = startBrowserOperation('Adding shortcuts', `0 / ${items.length}`);
|
||||
try {
|
||||
for (let index = 0; index < items.length; index += 1) {
|
||||
const item = items[index];
|
||||
const response = await fetch('/_/api/v1/browser/navigation', {
|
||||
method: 'POST', headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({label: item.name, path: item.path, is_directory: Boolean(item.is_directory)})
|
||||
});
|
||||
if (!response.ok) throw new Error((await response.text()).trim() || 'could not add shortcut');
|
||||
appendNavigatorLink(await response.json());
|
||||
updateBrowserOperation(operation, (index + 1) / items.length * 100, `${index + 1} / ${items.length}`);
|
||||
}
|
||||
finishBrowserOperation(operation);
|
||||
} catch (error) {
|
||||
failBrowserOperation(operation, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
function appendNavigatorLink(link) {
|
||||
const container = document.getElementById('navigator-links');
|
||||
if (container.querySelector(`[data-navigation-id="${CSS.escape(link.uuid)}"]`)) return;
|
||||
const anchor = document.createElement('a');
|
||||
anchor.className = 'sidebar-link navigator-link';
|
||||
anchor.href = link.is_directory ? `/v/browser${link.path}` : link.path;
|
||||
anchor.dataset.navigationId = link.uuid;
|
||||
anchor.dataset.navigationPath = link.path;
|
||||
anchor.dataset.isDir = String(Boolean(link.is_directory));
|
||||
anchor.textContent = link.label;
|
||||
anchor.addEventListener('contextmenu', event => openNavigatorMenu(event, anchor));
|
||||
container.append(anchor);
|
||||
}
|
||||
|
||||
function openNavigatorMenu(event, link) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
activeNavigatorLink = link;
|
||||
placeContextMenu(document.getElementById('navigator-menu'), event.clientX, event.clientY);
|
||||
}
|
||||
|
||||
async function renameNavigatorLink() {
|
||||
if (!activeNavigatorLink) return;
|
||||
const label = prompt('Shortcut name:', activeNavigatorLink.textContent.trim());
|
||||
if (!label || label === activeNavigatorLink.textContent.trim()) return;
|
||||
const response = await fetch('/_/api/v1/browser/navigation', {
|
||||
method: 'PATCH', headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({uuid: activeNavigatorLink.dataset.navigationId, label})
|
||||
});
|
||||
if (!response.ok) {
|
||||
alert((await response.text()).trim());
|
||||
return;
|
||||
}
|
||||
activeNavigatorLink.textContent = label;
|
||||
}
|
||||
|
||||
async function deleteNavigatorLink() {
|
||||
if (!activeNavigatorLink) return;
|
||||
const link = activeNavigatorLink;
|
||||
if (!confirm(`Remove “${link.textContent.trim()}” from Navigator?`)) return;
|
||||
const response = await fetch('/_/api/v1/browser/navigation', {
|
||||
method: 'DELETE', headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({uuid: link.dataset.navigationId})
|
||||
});
|
||||
if (!response.ok) {
|
||||
alert((await response.text()).trim());
|
||||
return;
|
||||
}
|
||||
link.remove();
|
||||
activeNavigatorLink = null;
|
||||
}
|
||||
|
||||
document.addEventListener('click', () => {
|
||||
document.getElementById('navigator-menu')?.style.setProperty('display', 'none');
|
||||
});
|
||||
selectionMarquee();
|
||||
updateSelectionStatus();
|
||||
@@ -0,0 +1,75 @@
|
||||
(() => {
|
||||
document.documentElement.dataset.browserThumbnails = 'ready';
|
||||
const connection = navigator.connection || {};
|
||||
const concurrency = connection.saveData || /(^|-)2g$/.test(connection.effectiveType || '') ? 1 : 2;
|
||||
const queue = [];
|
||||
let active = 0;
|
||||
let stopped = false;
|
||||
|
||||
const ready = image => image.closest('.browser-thumbnail')
|
||||
?.classList.replace('children-preview-pending', 'children-preview-ready');
|
||||
|
||||
const load = image => new Promise(resolve => {
|
||||
if (stopped || !image.isConnected || image.dataset.previewLoaded) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
image.dataset.previewLoaded = 'true';
|
||||
image.loading = 'lazy';
|
||||
image.decoding = 'async';
|
||||
image.fetchPriority = 'low';
|
||||
const done = success => {
|
||||
window.clearTimeout(timeout);
|
||||
if (success) ready(image);
|
||||
resolve();
|
||||
};
|
||||
const timeout = window.setTimeout(() => done(false), 30000);
|
||||
image.addEventListener('load', () => done(true), {once: true});
|
||||
image.addEventListener('error', () => done(false), {once: true});
|
||||
image.src = image.dataset.previewSrc;
|
||||
});
|
||||
|
||||
const drain = () => {
|
||||
if (stopped || document.visibilityState === 'hidden') return;
|
||||
while (active < concurrency && queue.length) {
|
||||
active++;
|
||||
const image = queue.shift();
|
||||
Promise.resolve().then(() => load(image)).finally(() => {
|
||||
active--;
|
||||
drain();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const enqueue = image => {
|
||||
if (image.dataset.previewQueued || image.dataset.previewLoaded) return;
|
||||
image.dataset.previewQueued = 'true';
|
||||
queue.push(image);
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver(entries => {
|
||||
for (const entry of entries) {
|
||||
if (!entry.isIntersecting) continue;
|
||||
observer.unobserve(entry.target);
|
||||
enqueue(entry.target);
|
||||
}
|
||||
drain();
|
||||
}, {rootMargin: '240px 0px'});
|
||||
|
||||
document.querySelectorAll('.browser-thumbnail [data-preview-src]').forEach(image => {
|
||||
observer.observe(image);
|
||||
const rect = image.getBoundingClientRect();
|
||||
if (rect.bottom >= -240 && rect.top <= innerHeight + 240) {
|
||||
observer.unobserve(image);
|
||||
enqueue(image);
|
||||
}
|
||||
});
|
||||
drain();
|
||||
document.addEventListener('visibilitychange', drain);
|
||||
window.addEventListener('pagehide', () => {
|
||||
stopped = true;
|
||||
queue.length = 0;
|
||||
observer.disconnect();
|
||||
document.querySelectorAll('.browser-thumbnail [data-preview-loaded]').forEach(image => image.removeAttribute('src'));
|
||||
}, {once: true});
|
||||
})();
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,121 @@
|
||||
// Bounded, deterministic close-up projection. Geometry never owns Page identity.
|
||||
(() => {
|
||||
const SPOTS_PER_VIEW = 6, PAGES_PER_VIEW = 24;
|
||||
const ns='http://www.w3.org/2000/svg';
|
||||
const el=(tag,attrs={},text='')=>{const n=document.createElementNS(ns,tag);for(const [k,v] of Object.entries(attrs))n.setAttribute(k,v);if(text)n.textContent=text;return n;};
|
||||
const uniquePages=spot=>[...new Map((spot.pages||[]).map(p=>[p.page_uuid,p])).values()];
|
||||
// Only the actual boundary Page is represented by the central palace. The
|
||||
// API may suggest a descendant as a fallback portal (also in undefined
|
||||
// buckets); such a Page must keep its independently selectable building.
|
||||
const surroundingPages=spot=>uniquePages(spot).filter(p=>!(p.page_uuid===spot.portal_page_uuid&&p.path===spot.path_prefix));
|
||||
const undefinedSpot=spot=>spot.name?.endsWith('-undefined')||spot.path_prefix?.endsWith('/_undefined');
|
||||
const pageName=p=>p.label||(p.path||'').split('/').filter(Boolean).pop()||p.page_uuid;
|
||||
const pageURL=p=>p.path?p.path.split('/').map(encodeURIComponent).join('/'):`/o/uuid:${encodeURIComponent(p.page_uuid)}`;
|
||||
const slice=(items,page,size)=>{const pages=Math.max(1,Math.ceil(items.length/size)),index=Math.max(0,Math.min(pages-1,page||0));return{items:items.slice(index*size,(index+1)*size),page:index,pages,total:items.length};};
|
||||
function layout(count) {
|
||||
const columns=Math.min(3,Math.max(1,count)),rows=Math.ceil(count/columns);
|
||||
const width=Math.max(960,columns*380+120),height=Math.max(680,rows*350+180);
|
||||
return {width,height,plots:Array.from({length:count},(_,i)=>({x:width/2-(columns-1)*190+(i%columns)*380,y:height/2-(rows-1)*175+Math.floor(i/columns)*350,w:336,h:314}))};
|
||||
}
|
||||
const label=(parent,cls,x,y,text,width=100,size=12)=>{
|
||||
const n=el('text',{class:cls,x,y,'text-anchor':'middle','font-size':size});
|
||||
// Bounded horizontal lines; the complete name is always in the tooltip.
|
||||
const chars=[...String(text)],lines=[];let line='',used=0;
|
||||
for(const char of chars){const unit=/[\u0000-\u00ff]/.test(char)?size*.57:size;if(used+unit>width&&line){lines.push(line);line='';used=0;}line+=char;used+=unit;}
|
||||
if(line)lines.push(line);
|
||||
lines.slice(0,2).forEach((part,i)=>n.append(el('tspan',{x,dy:i?size+2:0},i===1&&lines.length>2?part.slice(0,-1)+'…':part)));
|
||||
n.append(el('title',{},text));parent.append(n);return n;
|
||||
};
|
||||
const use=(parent,id,x,y,width,height,cls='')=>{const n=el('use',{href:`#${id}`,x,y,width,height,class:cls});parent.append(n);return n;};
|
||||
function definitions() {
|
||||
const defs=el('defs');
|
||||
const paving=el('pattern',{id:'city-court-stone',width:24,height:16,patternUnits:'userSpaceOnUse'});
|
||||
paving.append(el('rect',{width:24,height:16,class:'estate-stone'}),el('path',{d:'M0 0H24M0 8H24M0 16H24M12 0V8M6 8V16M24 8V16',class:'estate-mortar'}));defs.append(paving);
|
||||
const roof=el('pattern',{id:'city-terracotta',width:8,height:8,patternUnits:'userSpaceOnUse'});
|
||||
roof.append(el('rect',{width:8,height:8,class:'estate-roof-fill'}),el('path',{d:'M0 4H8M0 8H8M4 0V4M2 4V8M6 4V8',class:'estate-roof-tile'}));defs.append(roof);
|
||||
const house=el('symbol',{id:'city-page-house',viewBox:'0 0 64 54'});
|
||||
house.append(el('path',{d:'M7 25 32 8 57 25V49H7Z',class:'estate-house-wall'}),el('path',{d:'M2 26 32 3 62 26 56 28 32 12 8 28Z',class:'estate-house-roof'}),el('path',{d:'M27 49V36Q32 28 37 36V49M13 30H20V39H13ZM44 30H51V39H44Z',class:'estate-window'}),el('path',{d:'M4 49H60M9 43H24M41 43H55',class:'estate-cornice'}));defs.append(house);
|
||||
const hall=el('symbol',{id:'city-palazzo',viewBox:'0 0 140 105'});
|
||||
hall.append(el('path',{d:'M10 34H130V96H10Z',class:'estate-palazzo-wall'}),el('path',{d:'M3 36 70 3 137 36ZM11 34H129V42H11Z',class:'estate-pediment'}),el('path',{d:'M18 44V90M43 44V90M97 44V90M122 44V90',class:'estate-column'}),el('path',{d:'M56 96V63Q70 43 84 63V96M24 55H36V72H24ZM104 55H116V72H104Z',class:'estate-window'}),el('path',{d:'M4 96H136M0 102H140M16 83H46M94 83H124',class:'estate-cornice'}),el('circle',{cx:70,cy:24,r:6,class:'estate-rosette'}));defs.append(hall);
|
||||
const gate=el('symbol',{id:'city-iron-gate',viewBox:'0 0 100 50'});
|
||||
gate.append(el('path',{d:'M4 16H14V48H4ZM86 16H96V48H86ZM1 12H17V18H1ZM83 12H99V18H83Z',class:'estate-palazzo-wall'}),el('path',{d:'M15 47V24Q50-6 85 24V47M15 32H85M15 44H85M24 15V47M37 8V47M50 5V47M63 8V47M76 15V47M21 23Q30 13 37 23Q44 32 50 23Q57 13 64 23Q71 32 79 23',class:'estate-iron'}));defs.append(gate);
|
||||
const tree=el('symbol',{id:'city-cypress',viewBox:'0 0 18 44'});
|
||||
tree.append(el('path',{d:'M9 3Q-4 24 5 36H13Q22 24 9 3Z',class:'estate-cypress'}),el('path',{d:'M9 32V44',class:'estate-tree-trunk'}));defs.append(tree);
|
||||
return defs;
|
||||
}
|
||||
function projectRoads(roads,width,height) {
|
||||
if(!roads.length)return [];
|
||||
const xs=roads.flatMap(r=>[r[0],r[2]]),ys=roads.flatMap(r=>[r[1],r[3]]);
|
||||
const loX=Math.min(...xs),hiX=Math.max(...xs),loY=Math.min(...ys),hiY=Math.max(...ys);
|
||||
const scale=Math.min((width-180)/Math.max(40,hiX-loX),(height-150)/Math.max(40,hiY-loY));
|
||||
return roads.map(r=>[width/2+(r[0]-(loX+hiX)/2)*scale,height/2+(r[1]-(loY+hiY)/2)*scale,width/2+(r[2]-(loX+hiX)/2)*scale,height/2+(r[3]-(loY+hiY)/2)*scale]);
|
||||
}
|
||||
function nearestRoad(x,y,roads) {
|
||||
let best=null,distance=Infinity;
|
||||
for(const [ax,ay,bx,by] of roads){const dx=bx-ax,dy=by-ay,t=Math.max(0,Math.min(1,((x-ax)*dx+(y-ay)*dy)/(dx*dx+dy*dy||1))),px=ax+t*dx,py=ay+t*dy,d=Math.hypot(x-px,y-py);if(d<distance){best=[px,py];distance=d;}}
|
||||
return best;
|
||||
}
|
||||
function pageHouse(group,page,x,y,isUndefined=false) {
|
||||
const a=el('a',{href:pageURL(page),class:`city-map-page-link city-page-link${isUndefined?' city-undefined-page-link':''}`,'data-page-uuid':page.page_uuid,'aria-label':pageName(page)});
|
||||
a.append(el('title',{},`${pageName(page)} · ${page.path||page.page_uuid}`),el('ellipse',{cx:x,cy:y+14,rx:34,ry:9,class:'estate-shadow'}));
|
||||
use(a,'city-page-house',x-29,y-34,58,49);
|
||||
// A small lime marker retains the meaning of unclassified Page points.
|
||||
if(isUndefined)a.append(el('circle',{cx:x+26,cy:y-24,r:5,class:'city-undefined-page-point'}));
|
||||
label(a,isUndefined?'city-undefined-page-label':'city-estate-page-label',x,y+29,pageName(page),99,12);
|
||||
a.addEventListener('click',event=>event.stopPropagation());group.append(a);
|
||||
}
|
||||
function ground(group,width,height) {
|
||||
group.append(el('rect',{x:0,y:0,width,height,rx:16,class:'estate-ground'}));
|
||||
for(const x of [32,width-48])for(let y=80;y<height-50;y+=100)use(group,'city-cypress',x,y,16,40);
|
||||
}
|
||||
function courtyard(group,x,y,w,h) {
|
||||
group.append(el('path',{d:`M${x-w/2+22} ${y-h/2}H${x+w/2-22}L${x+w/2} ${y-h/2+22}V${y+h/2-22}L${x+w/2-22} ${y+h/2}H${x-w/2+22}L${x-w/2} ${y+h/2-22}V${y-h/2+22}Z`,class:'city-courtyard'}));
|
||||
group.append(el('path',{d:`M${x-w/2+12} ${y-h/2+35}V${y+h/2-35}M${x+w/2-12} ${y-h/2+35}V${y+h/2-35}`,class:'estate-balustrade'}));
|
||||
}
|
||||
function entry(group,spot,x,y,onSpot,isUndefined,large=false) {
|
||||
const g=el('g',{class:large?'city-spot-monument':'city-spot-entry',role:large?'img':'button',...(large?{}:{tabindex:0}),'aria-label':spot.title||spot.name});
|
||||
if(!isUndefined)use(g,'city-palazzo',x-61,y-49,122,92);
|
||||
else {g.append(el('circle',{cx:x,cy:y-5,r:25,class:'estate-fountain'}),el('circle',{cx:x,cy:y-5,r:12,class:'estate-fountain-inner'}));}
|
||||
label(g,'city-spot-point-label',x,y+59,isUndefined?(document.documentElement.lang.startsWith('ja')?'未分類のPage':'Unclassified Pages'):spot.title||spot.name,large?260:195,large?20:17);
|
||||
group.append(g);
|
||||
}
|
||||
function spotGroup(spot,onSpot,focused=false) {
|
||||
const group=el('g',{class:'city-node city-spot-tile','data-city-type':'Spot','data-city-uuid':spot.uuid,role:'group','aria-label':spot.title||spot.name});
|
||||
group.addEventListener('click',event=>{if(event.target.closest('a'))return;event.stopPropagation();if(!focused)onSpot(spot);});return group;
|
||||
}
|
||||
function streetScene(street,roads,page,onSpot) {
|
||||
const available=street.spots.filter(s=>!undefinedSpot(s)||uniquePages(s).length);
|
||||
const batch=slice(available,page,SPOTS_PER_VIEW),space=layout(batch.items.length),root=el('g',{class:'city-estate-scene'});
|
||||
root.append(definitions());ground(root,space.width,space.height);
|
||||
const projected=projectRoads(roads,space.width,space.height);
|
||||
for(const r of projected)root.append(el('path',{d:`M${r[0]} ${r[1]}L${r[2]} ${r[3]}`,class:'estate-route-edge'}),el('path',{d:`M${r[0]} ${r[1]}L${r[2]} ${r[3]}`,class:'estate-route'}));
|
||||
label(root,'city-generated-street-label',space.width/2,38,street.title||street.name,500,22);
|
||||
batch.items.forEach((spot,i)=>{
|
||||
const box=space.plots[i],group=spotGroup(spot,onSpot),pages=surroundingPages(spot),isUndefined=undefinedSpot(spot),anchor=nearestRoad(box.x,box.y,projected);
|
||||
if(anchor)root.append(el('path',{d:`M${anchor[0]} ${anchor[1]}L${box.x} ${box.y+box.h/2}`,class:'estate-walkway'}));
|
||||
group.setAttribute('data-estate-box',`${box.x-box.w/2},${box.y-box.h/2},${box.w},${box.h}`);
|
||||
if(isUndefined)group.classList.add('city-spot-undefined','city-undefined-expanded');
|
||||
courtyard(group,box.x,box.y,box.w,box.h);entry(group,spot,box.x,box.y-9,onSpot,isUndefined);
|
||||
const places=[[-109,-91],[109,-91],[109,91],[-109,91],[0,-110],[0,110]];
|
||||
pages.slice(0,6).forEach((p,j)=>pageHouse(group,p,box.x+places[j][0],box.y+places[j][1],isUndefined));
|
||||
if(pages.length>6){const count=el('g',{class:'city-estate-more',role:'button',tabindex:0,'aria-label':`${pages.length} Pages`});count.append(el('rect',{x:box.x+65,y:box.y+box.h/2+5,width:90,height:22,rx:11}),el('text',{x:box.x+110,y:box.y+box.h/2+21,'text-anchor':'middle'},`+ ${pages.length-6} Pages`));group.append(count);}
|
||||
use(group,'city-iron-gate',box.x-31,box.y+box.h/2-6,62,31);root.append(group);
|
||||
});
|
||||
return {root,...space,...batch,kind:'spots'};
|
||||
}
|
||||
function spotScene(spot,page,onSpot) {
|
||||
const batch=slice(surroundingPages(spot),page,PAGES_PER_VIEW),width=1120,height=780,root=el('g',{class:'city-estate-scene city-estate-detail'});
|
||||
root.append(definitions());ground(root,width,height);
|
||||
const group=spotGroup(spot,onSpot,true);group.classList.add('city-estate-focused');courtyard(group,width/2,height/2,990,630);
|
||||
group.append(el('ellipse',{cx:width/2,cy:height/2+118,rx:45,ry:22,class:'estate-fountain'}));
|
||||
entry(group,spot,width/2,height/2-35,onSpot,undefinedSpot(spot),true);
|
||||
const places=[];for(let i=0;i<8;i++)places.push([175+i*110,126]);for(let i=0;i<8;i++)places.push([175+i*110,618]);for(let i=0;i<4;i++)places.push([123,228+i*96]);for(let i=0;i<4;i++)places.push([997,228+i*96]);
|
||||
batch.items.forEach((p,i)=>{const [x,y]=places[i];group.append(el('path',{d:`M${width/2} ${height/2+70}Q${x} ${height/2+70} ${x} ${y}`,class:'estate-detail-walkway'}));});
|
||||
batch.items.forEach((p,i)=>pageHouse(group,p,...places[i],undefinedSpot(spot)));
|
||||
const portal=spot.portal_path||(spot.portal_page_uuid&&`/o/uuid:${spot.portal_page_uuid}`);
|
||||
if(portal){const text=document.documentElement.lang.startsWith('ja')?'ポータルPageを開く':'Open portal Page',link=el('a',{href:portal,class:'city-portal-link','aria-label':text});link.append(el('rect',{x:width/2-110,y:height/2+48,width:220,height:31,rx:3}));label(link,'city-portal-label',width/2,height/2+69,text,210,13);link.addEventListener('click',e=>e.stopPropagation());group.append(link);}
|
||||
use(group,'city-iron-gate',width/2-60,height-75,120,60);root.append(group);
|
||||
return {root,width,height,...batch,kind:'pages'};
|
||||
}
|
||||
window.PagesWikiCityEstates={layout,streetScene,spotScene,definitions,uniquePages,pageURL,surroundingPages,undefinedSpot,SPOTS_PER_VIEW,PAGES_PER_VIEW};
|
||||
})();
|
||||
@@ -0,0 +1,105 @@
|
||||
/* Geometry only: never put Page names, grants or topology into this cache. */
|
||||
(() => {
|
||||
'use strict';
|
||||
const VERSION = 'gen-city-1.4.6-layout2';
|
||||
const PREFIX = 'pageswiki:city-fabric:v2:';
|
||||
const MAX_CACHE_ENTRIES = 3, MAX_CACHE_BYTES = 512 * 1024;
|
||||
const workerURL = '/static/js/city-generator-worker.js?v=2';
|
||||
const abortError = () => new DOMException('City generation cancelled', 'AbortError');
|
||||
const validFabric = fabric => {
|
||||
if (!fabric || !Number.isFinite(fabric.width) || !Number.isFinite(fabric.height) || fabric.width < 64 || fabric.width > 320 || fabric.height < 64 || fabric.height > 240) return false;
|
||||
if (!Array.isArray(fabric.roads) || !Array.isArray(fabric.buildings) || fabric.roads.length > 4096 || fabric.buildings.length > 4096) return false;
|
||||
const finite = value => Number.isFinite(value) && Math.abs(value) <= 2048;
|
||||
return fabric.roads.every(road => Array.isArray(road) && road.length === 4 && road.every(finite)) &&
|
||||
fabric.buildings.every(building => Array.isArray(building) && building.length >= 3 && building.length <= 16 && building.every(point => Array.isArray(point) && point.length === 2 && point.every(finite)));
|
||||
};
|
||||
|
||||
class CityFabricClient {
|
||||
constructor({workerFactory = url => new Worker(url), storage, timeout = 5000} = {}) {
|
||||
this.workerFactory = workerFactory;
|
||||
this.timeout = Math.max(20, Math.min(5000, timeout));
|
||||
try { this.storage = storage === undefined ? sessionStorage : storage; } catch (_) { this.storage = null; }
|
||||
this.memory = new Map(); this.pending = null; this.sequence = 0;
|
||||
}
|
||||
|
||||
cacheKey(key, width, height) { return PREFIX + JSON.stringify([VERSION, key, width, height]); }
|
||||
|
||||
readCache(key) {
|
||||
if (this.memory.has(key)) {
|
||||
const value = this.memory.get(key); this.memory.delete(key); this.memory.set(key, value); return value;
|
||||
}
|
||||
try {
|
||||
const raw = this.storage?.getItem(key);
|
||||
if (raw && raw.length <= MAX_CACHE_BYTES) {
|
||||
const value = JSON.parse(raw);
|
||||
if (validFabric(value)) { this.remember(key, value); return value; }
|
||||
}
|
||||
if (raw) this.storage?.removeItem(key);
|
||||
} catch (_) { /* Storage denial or corrupt cache must not break the map. */ }
|
||||
return null;
|
||||
}
|
||||
|
||||
remember(key, value) {
|
||||
this.memory.delete(key); this.memory.set(key, value);
|
||||
while (this.memory.size > MAX_CACHE_ENTRIES) this.memory.delete(this.memory.keys().next().value);
|
||||
}
|
||||
|
||||
saveCache(key, value) {
|
||||
this.remember(key, value);
|
||||
try {
|
||||
const raw = JSON.stringify(value);
|
||||
if (raw.length > MAX_CACHE_BYTES || !this.storage) return;
|
||||
// Only inspect our namespace; never clear another feature's storage.
|
||||
const keys = [];
|
||||
for (let i = 0; i < this.storage.length; i++) {
|
||||
const item = this.storage.key(i);
|
||||
if (item?.startsWith(PREFIX) && item !== key) keys.push(item);
|
||||
}
|
||||
while (keys.length >= MAX_CACHE_ENTRIES) this.storage.removeItem(keys.shift());
|
||||
this.storage.setItem(key, raw);
|
||||
} catch (_) { /* Quota exhaustion: the bounded in-memory cache still works. */ }
|
||||
}
|
||||
|
||||
generateFabric(key, width = 180, height = 100, {signal} = {}) {
|
||||
key = String(key || '');
|
||||
if (!key || key.length > 256 || !Number.isInteger(width) || !Number.isInteger(height) || width < 64 || width > 320 || height < 64 || height > 240) return Promise.reject(new RangeError('City generation bounds exceeded'));
|
||||
if (signal?.aborted) return Promise.reject(abortError());
|
||||
const cacheKey = this.cacheKey(key, width, height);
|
||||
if (this.pending?.key === cacheKey) return this.pending.promise;
|
||||
this.cancel();
|
||||
const cached = this.readCache(cacheKey);
|
||||
if (cached && cached.width === width && cached.height === height) return Promise.resolve(cached);
|
||||
let resolve, reject;
|
||||
const promise = new Promise((yes, no) => { resolve = yes; reject = no; });
|
||||
const job = {key: cacheKey, id: ++this.sequence, promise, resolve, reject, worker: null, timer: null, signal, abort: null};
|
||||
this.pending = job;
|
||||
const finish = (error, fabric) => {
|
||||
if (this.pending !== job) return;
|
||||
clearTimeout(job.timer); job.signal?.removeEventListener('abort', job.abort);
|
||||
job.worker?.terminate(); this.pending = null;
|
||||
if (error) reject(error); else { this.saveCache(cacheKey, fabric); resolve(fabric); }
|
||||
};
|
||||
job.abort = () => finish(abortError());
|
||||
signal?.addEventListener('abort', job.abort, {once: true});
|
||||
try {
|
||||
job.worker = this.workerFactory(workerURL);
|
||||
job.worker.onmessage = event => {
|
||||
const message = event.data;
|
||||
if (message?.id !== job.id) return;
|
||||
if (message.error || !validFabric(message.fabric) || message.fabric.width !== width || message.fabric.height !== height) finish(new Error('Invalid City generation result'));
|
||||
else finish(null, message.fabric);
|
||||
};
|
||||
job.worker.onerror = event => { event.preventDefault?.(); finish(new Error('City worker unavailable')); };
|
||||
job.worker.onmessageerror = () => finish(new Error('Invalid City worker message'));
|
||||
job.timer = setTimeout(() => finish(new Error('City generation timed out')), this.timeout);
|
||||
job.worker.postMessage({id: job.id, key, width, height});
|
||||
} catch (_) { finish(new Error('City worker unavailable')); }
|
||||
return promise;
|
||||
}
|
||||
|
||||
cancel() { this.pending?.abort(); }
|
||||
}
|
||||
|
||||
window.PagesWikiCityFabricClient = CityFabricClient;
|
||||
window.PagesWikiGenCity = new CityFabricClient();
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
/* gen-city has synchronous internals; only this Worker may execute its bundle. */
|
||||
'use strict';
|
||||
importScripts('/static/vendor/city-generator/gen-city.bundle.js?v=1.4.6.2');
|
||||
let busy = false;
|
||||
self.onmessage = async event => {
|
||||
if (busy) return;
|
||||
const {id, key, width, height} = event.data || {};
|
||||
if (!Number.isInteger(id) || typeof key !== 'string' || !key || key.length > 256 || !Number.isInteger(width) || !Number.isInteger(height) || width < 64 || width > 320 || height < 64 || height > 240) {
|
||||
self.postMessage({id, error: 'Invalid City generation bounds'}); return;
|
||||
}
|
||||
busy = true;
|
||||
try {
|
||||
const fabric = await self.PagesWikiGenCity.generateFabric(key, width, height);
|
||||
if (fabric.roads.length > 4096 || fabric.buildings.length > 4096) throw new Error('City geometry budget exceeded');
|
||||
self.postMessage({id, fabric});
|
||||
} catch (_) { self.postMessage({id, error: 'City generation failed'}); }
|
||||
finally { busy = false; }
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
(() => {
|
||||
const VERSION = 1;
|
||||
const hash = value => {
|
||||
let h = 2166136261;
|
||||
for (const char of String(value)) { h ^= char.charCodeAt(0); h = Math.imul(h, 16777619); }
|
||||
return h >>> 0;
|
||||
};
|
||||
const randomFrom = seed => {
|
||||
let state = hash(seed) || 1;
|
||||
return () => { state += 0x6D2B79F5; let t = state; t = Math.imul(t ^ t >>> 15, t | 1); t ^= t + Math.imul(t ^ t >>> 7, t | 61); return ((t ^ t >>> 14) >>> 0) / 4294967296; };
|
||||
};
|
||||
const jitter = (random, amount) => (random() * 2 - 1) * amount;
|
||||
const cacheKey = city => `pageswiki:city-geometry:v${VERSION}:${city.domain_uuid}:${city.version}`;
|
||||
const signature = city => city.quartiers.map(q => `${q.uuid}:${q.streets.map(s => `${s.uuid}:${s.spots.map(p => p.uuid).join(',')}`).join('|')}`).join(';');
|
||||
|
||||
function generate(city) {
|
||||
const random = randomFrom(`${city.domain_uuid}:${city.version}:${signature(city)}`);
|
||||
const geometry = { version:VERSION, domain:{width:1000,height:Math.max(560,Math.ceil(city.quartiers.length/3)*250+80)}, quartiers:{}, streets:{}, spots:{} };
|
||||
city.quartiers.forEach((quartier,index) => {
|
||||
const col=index%3,row=Math.floor(index/3),x=55+col*315+jitter(random,18),y=55+row*235+jitter(random,14);
|
||||
const width=255+jitter(random,22),height=170+jitter(random,18),cut=18+random()*24;
|
||||
geometry.quartiers[quartier.uuid]={x,y,width,height,polygon:[[x+cut,y],[x+width-cut*.3,y+4],[x+width,y+cut],[x+width-7,y+height-cut*.4],[x+width-cut,y+height],[x+cut*.4,y+height-5],[x,y+height-cut],[x+5,y+cut]]};
|
||||
const mapHeight=Math.max(480,quartier.streets.length*125+110);
|
||||
quartier.streets.forEach((street,streetIndex) => {
|
||||
const sy=90+streetIndex*120+jitter(random,22),bend=jitter(random,85),startY=sy+jitter(random,18),endY=sy+jitter(random,28);
|
||||
geometry.streets[street.uuid]={width:920,height:mapHeight,path:[[35,startY],[260,sy+bend],[635,sy-bend*.65],[885,endY]],laneWidth:26+random()*14};
|
||||
street.spots.forEach((spot,spotIndex) => {
|
||||
const side=spotIndex%2===0?-1:1,slot=Math.floor(spotIndex/2),sx=65+slot*210+jitter(random,18),baseY=side<0?62:330;
|
||||
geometry.spots[spot.uuid]={x:sx,y:baseY+jitter(random,16),width:160+jitter(random,15),height:112+Math.min(4,(spot.pages||[]).length)*19+jitter(random,10),side,roof:random()>.55?'gable':'flat'};
|
||||
});
|
||||
});
|
||||
});
|
||||
return geometry;
|
||||
}
|
||||
|
||||
function load(city) {
|
||||
const key=cacheKey(city),expected=signature(city);
|
||||
try { const cached=JSON.parse(localStorage.getItem(key)); if(cached?.version===VERSION&&cached.signature===expected)return cached.geometry; } catch (_) {}
|
||||
const geometry=generate(city);
|
||||
try {
|
||||
localStorage.setItem(key,JSON.stringify({version:VERSION,signature:expected,geometry}));
|
||||
Object.keys(localStorage).filter(item=>item.startsWith(`pageswiki:city-geometry:v${VERSION}:${city.domain_uuid}:`)&&item!==key).slice(0,-2).forEach(item=>localStorage.removeItem(item));
|
||||
} catch (_) {}
|
||||
return geometry;
|
||||
}
|
||||
|
||||
window.PagesWikiCityGeometry={version:VERSION,load,generate,register(adapter){if(adapter?.load&&adapter?.generate)window.PagesWikiCityGeometry=adapter;}};
|
||||
})();
|
||||
@@ -0,0 +1,164 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const dialog = document.querySelector('[data-governance-dialog]');
|
||||
if (!dialog) return;
|
||||
const find = selector => dialog.querySelector(selector);
|
||||
const form = find('form'), fields = find('fieldset'), result = find('[data-governance-result]');
|
||||
const endpoint = dialog.dataset.endpoint;
|
||||
const accessForm = find('[data-access-form]'), accessFields = accessForm.querySelector('fieldset');
|
||||
const publicationForm=find('[data-publication-form]'), publicationFields=publicationForm.querySelector('fieldset');
|
||||
let impact;
|
||||
const autoForm=find('[data-auto-publication-form]');let autoState;
|
||||
const clearAuto=()=>{autoState=null;autoForm.reset();autoForm.elements.confirm.setCustomValidity('');find('[data-auto-save]').disabled=true;find('[data-auto-impact]').replaceChildren();};
|
||||
const clearPublication=()=>{impact=null; publicationForm.reset();find('[data-publication-impact]').replaceChildren();find('[data-publication-status]').textContent='';find('[data-publication-enable]').disabled=true;};
|
||||
let accessState, entries = [];
|
||||
const showAccess = () => {
|
||||
const list = find('[data-access-entries]'); list.replaceChildren();
|
||||
entries.forEach((entry,index) => {
|
||||
const row = document.createElement('div'); row.className = 'city-access-row';
|
||||
for (const [key,options] of [['kind',['user','group']],['name',null],['permission',['read','read_write']]]) {
|
||||
const input = document.createElement(options ? 'select' : 'input');
|
||||
if (options) options.forEach(value => { const option = document.createElement('option'); option.value = value; option.textContent = accessForm.dataset[value]; input.append(option); });
|
||||
else { input.maxLength=64; input.required=true; input.placeholder=accessForm.dataset.name; }
|
||||
input.setAttribute('aria-label', key==='name' ? accessForm.dataset.name : key==='kind' ? `${accessForm.dataset.user} / ${accessForm.dataset.group}` : `${accessForm.dataset.read} / ${accessForm.dataset.read_write}`);
|
||||
input.value = entry[key]; input.addEventListener('input',()=>{ entry[key]=input.value; if(key==='kind'||key==='name') delete entry.id; }); row.append(input);
|
||||
}
|
||||
const remove = document.createElement('button'); remove.type='button'; remove.textContent='×'; remove.setAttribute('aria-label',dialog.dataset.remove); remove.addEventListener('click',()=>{ entries.splice(index,1); showAccess(); }); row.append(remove); list.append(row);
|
||||
});
|
||||
};
|
||||
let state, owners = [], candidates = [], timer, generation = 0, searchGeneration = 0;
|
||||
const label = policy => dialog.dataset[policy] || policy;
|
||||
const api = async (url, method = 'GET', body) => {
|
||||
const response = await fetch(url, {method, headers:{'Content-Type':'application/json'}, ...(body ? {body:JSON.stringify(body)} : {})});
|
||||
const data = await response.json().catch(() => ({}));
|
||||
if (!response.ok) throw new Error(data.error || `HTTP ${response.status}`);
|
||||
return data;
|
||||
};
|
||||
const showPolicy = data => {
|
||||
find('[data-governance-superior]').textContent = data.superior_allows_public ? dialog.dataset.yes : dialog.dataset.no;
|
||||
find('[data-governance-effective]').textContent = data.draft_effective_public ? dialog.dataset.yes : dialog.dataset.no;
|
||||
const chain = find('[data-governance-chain]'); chain.replaceChildren();
|
||||
data.chain.forEach(item => { const li = document.createElement('li'); li.textContent = `${item.kind}: ${label(item.policy)}`; chain.append(li); });
|
||||
};
|
||||
const showOwners = () => {
|
||||
const list = find('[data-governance-owners]'); list.replaceChildren();
|
||||
owners.forEach(owner => {
|
||||
const li = document.createElement('li'), text = document.createElement('span');
|
||||
text.textContent = `${owner.display_name || owner.username} (${owner.username})${owner.active ? '' : ' · '+dialog.dataset.inactive}`;
|
||||
li.append(text);
|
||||
if (state.can_appoint) {
|
||||
const button = document.createElement('button'); button.type = 'button'; button.textContent = '×'; button.setAttribute('aria-label',dialog.dataset.remove);
|
||||
button.addEventListener('click', () => { owners = owners.filter(o => o.membership_uuid !== owner.membership_uuid); showOwners(); }); li.append(button);
|
||||
}
|
||||
list.append(li);
|
||||
});
|
||||
};
|
||||
const members = async () => {
|
||||
const seq = ++searchGeneration, opened = generation;
|
||||
try {
|
||||
const data = await api(endpoint+'/members?q='+encodeURIComponent(find('[data-governance-search]').value));
|
||||
if (seq !== searchGeneration || opened !== generation || !dialog.open) return;
|
||||
candidates = data;
|
||||
const select = find('[data-governance-members]'); select.replaceChildren();
|
||||
data.forEach(o => { const option = document.createElement('option'); option.value = o.membership_uuid; option.textContent = `${o.display_name || o.username} (${o.username})`; select.append(option); });
|
||||
} catch (error) { if (opened === generation && dialog.open) result.textContent = error.message; }
|
||||
};
|
||||
document.querySelector('[data-governance-open]').addEventListener('click', async () => {
|
||||
dialog.showModal(); const seq = ++generation; fields.disabled = true; accessFields.disabled=true; result.textContent = ''; form.reset(); accessForm.reset();
|
||||
publicationFields.disabled=true; clearPublication();clearAuto();
|
||||
try {
|
||||
const [data,acl] = await Promise.all([api(endpoint),api(endpoint+'/access')]);
|
||||
if (seq !== generation || !dialog.open) return;
|
||||
if (data.epoch !== acl.epoch || data.topology_version !== acl.topology_version) throw new Error(dialog.dataset.conflict);
|
||||
state = data; owners = [...data.owners]; form.elements.policy.value = data.policy;
|
||||
accessState=acl; entries=acl.entries.map(e=>({...e})); accessForm.elements.mode.value=acl.mode; showAccess(); accessFields.disabled=false;
|
||||
form.elements.policy.querySelector('[value=inherit]').disabled = data.kind === 'domain';
|
||||
form.elements.policy.querySelector('[value=public]').disabled = !data.superior_allows_public;
|
||||
find('[data-governance-appointments]').hidden = !data.can_appoint;
|
||||
showPolicy(data); showOwners(); fields.disabled = false;
|
||||
publicationFields.disabled=false;
|
||||
if (data.can_appoint) members();
|
||||
} catch (error) { result.textContent = error.message; }
|
||||
});
|
||||
find('[data-governance-close]').addEventListener('click', () => dialog.close());
|
||||
dialog.addEventListener('close', () => { if (dialog.open) return; generation++; searchGeneration++; clearTimeout(timer); });
|
||||
dialog.addEventListener('keydown', event => event.stopPropagation());
|
||||
find('[data-governance-search]').addEventListener('input', () => { clearTimeout(timer); searchGeneration++; timer = setTimeout(members,200); });
|
||||
find('[data-governance-add]').addEventListener('click', () => {
|
||||
const selected = candidates.find(o => o.membership_uuid === find('[data-governance-members]').value);
|
||||
if (selected && owners.length < 32 && !owners.some(o => o.membership_uuid === selected.membership_uuid)) { owners.push(selected); showOwners(); }
|
||||
});
|
||||
const save = async preview => {
|
||||
if (!state || fields.disabled || accessFields.disabled) return;
|
||||
const body = {epoch:state.epoch, topology_version:state.topology_version, policy:form.elements.policy.value, confirm_relaxation:form.elements.confirm_relaxation.checked};
|
||||
if (state.can_appoint && JSON.stringify(owners.map(o => o.membership_uuid)) !== JSON.stringify(state.owners.map(o => o.membership_uuid))) body.owners = owners.map(o => o.membership_uuid);
|
||||
fields.disabled = true; accessFields.disabled=true; const seq = generation;
|
||||
publicationFields.disabled=true;
|
||||
try {
|
||||
const data = await api(endpoint+(preview ? '/preview' : ''), preview ? 'POST' : 'PATCH', body);
|
||||
if (seq !== generation || !dialog.open) return;
|
||||
showPolicy(data);
|
||||
if (!preview) { state = data; accessState.epoch=data.epoch; owners = [...data.owners]; showOwners(); form.elements.confirm_relaxation.checked = false; result.textContent = dialog.dataset.saved; clearPublication(); }
|
||||
else result.textContent = '';
|
||||
} catch (error) { if (seq === generation) result.textContent = error.message; }
|
||||
finally { if (seq === generation) {fields.disabled = false; accessFields.disabled=false; publicationFields.disabled=false;} }
|
||||
};
|
||||
form.addEventListener('submit', event => { event.preventDefault(); save(false); });
|
||||
find('[data-governance-preview]').addEventListener('click', () => save(true));
|
||||
find('[data-access-add]').addEventListener('click',()=>{ if(entries.length<64) { entries.push({kind:'user',name:'',permission:'read'}); showAccess(); } });
|
||||
accessForm.addEventListener('submit',async event=>{
|
||||
event.preventDefault(); if (!accessState || fields.disabled || accessFields.disabled) return;
|
||||
const body={epoch:accessState.epoch,topology_version:accessState.topology_version,mode:accessForm.elements.mode.value,entries:accessForm.elements.mode.value==='inherit'?[]:entries.map(({kind,name,permission,id})=>({kind,name,permission,id}))};
|
||||
fields.disabled=true; accessFields.disabled=true; const seq=generation;
|
||||
publicationFields.disabled=true;clearPublication();
|
||||
try { const data=await api(endpoint+'/access','PATCH',body); if(seq!==generation||!dialog.open)return; accessState=data; state.epoch=data.epoch; entries=data.entries.map(e=>({...e})); showAccess(); accessForm.elements.confirm.checked=false; result.textContent=accessForm.dataset.saved;
|
||||
} catch(error) { if(seq===generation) result.textContent=error.message;
|
||||
} finally { if(seq===generation) {fields.disabled=false;accessFields.disabled=false;publicationFields.disabled=false;} }
|
||||
});
|
||||
const publication = async operation => {
|
||||
if(!state || fields.disabled || publicationFields.disabled) return;
|
||||
const seq=generation; fields.disabled=true; accessFields.disabled=true; publicationFields.disabled=true;
|
||||
const body=operation==='preview'?undefined:{epoch:state.epoch,topology_version:state.topology_version,publication_version:impact?.publication_version??state.publication_version,enabled:operation==='enable',confirm:publicationForm.elements.confirm.checked,impact_token:impact?.impact_token||''};
|
||||
try {
|
||||
const data=await api(endpoint+'/publication',operation==='preview'?'GET':'PATCH',body);
|
||||
if(seq!==generation||!dialog.open)return;
|
||||
if(data.epoch!==state.epoch||data.topology_version!==state.topology_version)throw new Error(dialog.dataset.conflict);
|
||||
state.publication_version=data.publication_version;
|
||||
impact=data;find('[data-publication-enable]').disabled=!data.eligible;publicationForm.elements.confirm.checked=false;
|
||||
find('[data-publication-status]').textContent=publicationForm.dataset[data.enabled?'enabled':'disabled'];
|
||||
const list=find('[data-publication-impact]');list.replaceChildren();
|
||||
const ul=document.createElement('ul');
|
||||
data.entries.forEach(e=>{const li=document.createElement('li');li.textContent=`${e.path} (${e.lang}) · ${e.revision_uuid}`;ul.append(li);});list.append(ul);
|
||||
if(data.excluded.length){const p=document.createElement('p');p.textContent=publicationForm.dataset.excluded;list.append(p);const ul=document.createElement('ul');data.excluded.forEach(path=>{const li=document.createElement('li');li.textContent=path;ul.append(li);});list.append(ul);}
|
||||
} catch(error){if(seq===generation){clearPublication();result.textContent=error.message;}}
|
||||
finally{if(seq===generation){fields.disabled=false;accessFields.disabled=false;publicationFields.disabled=false;}}
|
||||
};
|
||||
find('[data-publication-preview]').addEventListener('click',()=>publication('preview'));
|
||||
find('[data-publication-revoke]').addEventListener('click',()=>publication('revoke'));
|
||||
publicationForm.addEventListener('submit',event=>{event.preventDefault();if(impact?.eligible)publication('enable');});
|
||||
find('[data-auto-preview]').addEventListener('click',async()=>{
|
||||
const seq=generation;clearAuto();
|
||||
try {
|
||||
const data=await api(endpoint+'/auto-publication');if(seq!==generation||!dialog.open)return;
|
||||
autoState=data;autoForm.elements.mode.value=data.mode;
|
||||
autoForm.elements.mode.querySelector('[value=automatic]').disabled=!data.can_automatic;
|
||||
find('[data-auto-save]').disabled=false;
|
||||
const list=document.createElement('ul');
|
||||
(data.impact.entries||[]).forEach(entry=>{const li=document.createElement('li');li.textContent=entry.path+' · '+entry.lang;list.append(li);});
|
||||
(data.impact.excluded||[]).forEach(path=>{const li=document.createElement('li');li.textContent=publicationForm.dataset.excluded+': '+path;list.append(li);});
|
||||
if(!data.preview_complete){const note=document.createElement('p');note.textContent=publicationForm.dataset.error;list.append(note);}
|
||||
const status=document.createElement('p');status.textContent=publicationForm.dataset[data.active?'enabled':'disabled'];find('[data-auto-impact]').append(status,list);
|
||||
}catch(error){if(seq===generation)result.textContent=error.message;}
|
||||
});
|
||||
autoForm.addEventListener('submit',async event=>{
|
||||
event.preventDefault();if(!autoState)return;
|
||||
const seq=generation,mode=autoForm.elements.mode.value;
|
||||
if(mode!=='required'&&!autoForm.elements.confirm.checked){autoForm.elements.confirm.setCustomValidity(autoForm.elements.confirm.parentElement.textContent.trim());autoForm.elements.confirm.reportValidity();return;}
|
||||
find('[data-auto-save]').disabled=true;
|
||||
try {
|
||||
await api(endpoint+'/auto-publication','PATCH',{mode,version:autoState.version,epoch:autoState.epoch,topology_version:autoState.topology_version,confirm:autoForm.elements.confirm.checked,impact_token:autoState.impact.impact_token});
|
||||
if(seq!==generation||!dialog.open)return;clearAuto();clearPublication();result.textContent=dialog.dataset.saved;
|
||||
}catch(error){if(seq===generation){result.textContent=error.message;clearAuto();}}
|
||||
});
|
||||
autoForm.elements.confirm.addEventListener('change',()=>autoForm.elements.confirm.setCustomValidity(''));
|
||||
autoForm.elements.mode.addEventListener('change',()=>autoForm.elements.confirm.setCustomValidity(''));
|
||||
});
|
||||
@@ -0,0 +1,344 @@
|
||||
(() => {
|
||||
const graphStyles = document.createElement('link'); graphStyles.rel = 'stylesheet'; graphStyles.href = '/static/css/city-graph.css?v=12'; document.head.append(graphStyles);
|
||||
const svg = document.querySelector('#city-map');
|
||||
if (!svg) return;
|
||||
const viewport = svg.querySelector('[data-city-viewport]');
|
||||
const inspector = document.querySelector('[data-city-inspector]');
|
||||
const directory = document.querySelector('[data-city-directory]');
|
||||
const empty = document.querySelector('[data-city-empty]');
|
||||
const version = document.querySelector('[data-city-version]');
|
||||
const ns = 'http://www.w3.org/2000/svg';
|
||||
let transform = { x: 24, y: 24, scale: 1 };
|
||||
let dragging = null;
|
||||
let city = null;
|
||||
let contextMenu = null;
|
||||
let suppressClick = false;
|
||||
let cityView = { level:'domain', quartier:null, street:null };
|
||||
let fabricToken = 0;
|
||||
let domainFabricPromise = null;
|
||||
let domainFabricKey = null;
|
||||
let generationController = null;
|
||||
let loadController = null;
|
||||
let suspended = false;
|
||||
let navigation = null;
|
||||
let organizer = null;
|
||||
const label = key => svg.dataset[key] || key;
|
||||
const popupMode = new URLSearchParams(location.search).get('popup') === '1';
|
||||
if (popupMode) { document.documentElement.classList.add('city-map-popup-mode'); document.body.classList.add('city-map-popup-mode'); }
|
||||
|
||||
const node = (name, attrs = {}, text = '') => {
|
||||
const el = document.createElementNS(ns, name);
|
||||
for (const [key, value] of Object.entries(attrs)) el.setAttribute(key, value);
|
||||
if (text) el.textContent = text;
|
||||
return el;
|
||||
};
|
||||
const applyTransform = () => viewport.setAttribute('transform', `translate(${transform.x} ${transform.y}) scale(${transform.scale})`);
|
||||
const svgPoint = (x,y) => new DOMPoint(x,y).matrixTransform(svg.getScreenCTM().inverse());
|
||||
const zoom = (factor, cx = svg.viewBox.baseVal.width / 2, cy = svg.viewBox.baseVal.height / 2) => {
|
||||
const next = Math.max(.35, Math.min(3, transform.scale * factor));
|
||||
transform.x = cx - (cx - transform.x) * next / transform.scale;
|
||||
transform.y = cy - (cy - transform.y) * next / transform.scale;
|
||||
transform.scale = next; applyTransform();
|
||||
};
|
||||
const show = (type, item, parent = '') => {
|
||||
inspector.dataset.cityType=type;inspector.dataset.cityUuid=item.uuid;
|
||||
inspector.innerHTML = `<h2>${escapeHTML(item.title || item.name)}</h2><dl><dt>Type</dt><dd>${type}</dd><dt>Name</dt><dd>${escapeHTML(item.name)}</dd><dt>Path</dt><dd><code>${escapeHTML(item.path_prefix || '—')}</code></dd>${parent ? `<dt>Location</dt><dd>${escapeHTML(parent)}</dd>` : ''}<dt>State</dt><dd>${escapeHTML(item.state)}</dd></dl>${item.description || item.summary ? `<p>${escapeHTML(item.description || item.summary)}</p>` : ''}<p><a class="city-detail-link" href="${escapeHTML(detailURL(type,item))}">Details →</a></p>${document.querySelector('.city-planner') ? `<button type="button" class="city-delete" data-delete-city-node data-city-type="${type}" data-city-uuid="${item.uuid}">${document.documentElement.lang.startsWith('ja') ? 'この要素を削除' : 'Delete this element'}</button>` : ''}`;
|
||||
inspector.querySelector('[data-delete-city-node]')?.addEventListener('click', event => deleteNode(event.currentTarget.dataset.cityType, item));
|
||||
organizer?.decorateInspector(inspector,type,item);
|
||||
};
|
||||
const showStreet = (street, parent) => {
|
||||
show('Street', street, parent);
|
||||
if (!document.querySelector('.city-planner')) return;
|
||||
const options = city.quartiers.map(q => `<option value="${q.uuid}">${escapeHTML(q.title)}</option>`).join('');
|
||||
inspector.insertAdjacentHTML('beforeend', `<form data-street-move><h3>Move Street</h3><label>Quartier<select name="parent_uuid">${options}</select></label><label>Order<input type="number" name="sort_key" value="${street.sort_key || 0}"></label><button>Move</button></form>`);
|
||||
inspector.querySelector('[data-street-move]').addEventListener('submit', async event => { event.preventDefault(); const values=Object.fromEntries(new FormData(event.target)); values.sort_key=Number(values.sort_key); const response = await fetch(`/_/api/v1/city/zones/${street.uuid}/move`, {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(values)}); if (response.ok) await load(); else alert((await response.json()).error); });
|
||||
};
|
||||
const showSpot = (spot, parent) => {
|
||||
show('Spot', spot, parent);
|
||||
// The map already contains these placements; do not fetch/render a second
|
||||
// unbounded list just to populate the closed utility menu.
|
||||
const pages = window.PagesWikiCityEstates.uniquePages(spot).slice(0,100);
|
||||
const canPlan = !!document.querySelector('.city-planner');
|
||||
const pageList = pages.length ? `<h3>Pages</h3><ul>${pages.map(page => `<li><a href="${escapeHTML(window.PagesWikiCityEstates.pageURL(page))}">${escapeHTML(page.label || page.path || page.page_uuid)}</a> <small>${escapeHTML(page.edge_type)}</small>${canPlan ? ` <button type="button" data-remove-page="${page.page_uuid}" data-edge="${page.edge_type}" aria-label="Remove">×</button>` : ''}</li>`).join('')}</ul>` : '<p class="muted">No Pages</p>';
|
||||
inspector.insertAdjacentHTML('beforeend', pageList);
|
||||
const relations = city.relations.filter(relation => relation.source_spot_uuid === spot.uuid);
|
||||
if (relations.length) inspector.insertAdjacentHTML('beforeend', `<h3>Relations</h3><ul>${relations.map(relation => { const target = city.quartiers.flatMap(q => q.streets.flatMap(s => s.spots)).find(item => item.uuid === relation.target_spot_uuid); return `<li>${escapeHTML(relation.relation_type)} → ${escapeHTML(target?.title || relation.target_spot_uuid)}${canPlan ? ` <button type="button" data-remove-relation="${relation.target_spot_uuid}" data-relation="${relation.relation_type}" aria-label="Remove">×</button>` : ''}</li>`; }).join('')}</ul>`);
|
||||
if (canPlan) {
|
||||
const options = city.quartiers.flatMap(q => q.streets.flatMap(s => s.spots)).filter(item => item.uuid !== spot.uuid).map(item => `<option value="${item.uuid}">${escapeHTML(item.title)}</option>`).join('');
|
||||
inspector.insertAdjacentHTML('beforeend', `<details><summary>SpotGraph</summary><form data-spot-page><label>Page path<input name="path" placeholder="/guide/page" required></label><label>Edge<select name="edge_type"><option>primary</option><option>guide</option><option>reference</option><option>example</option><option>attachment</option><option>related</option></select></label><button>Add Page</button></form><form data-spot-relation><label>Destination<select name="target_spot_uuid">${options}</select></label><label>Relation<select name="relation_type"><option>related</option><option>depends_on</option><option>supersedes</option><option>implements</option><option>learn_before</option><option>operated_by</option></select></label><button>Add relation</button></form></details>`);
|
||||
inspector.querySelector('[data-spot-page]')?.addEventListener('submit', async event => { event.preventDefault(); const response = await fetch(`/_/api/v1/city/spots/${spot.uuid}/pages`, {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(Object.fromEntries(new FormData(event.target)))}); if (response.ok) await load(); else alert((await response.json()).error); });
|
||||
inspector.querySelector('[data-spot-relation]')?.addEventListener('submit', async event => { event.preventDefault(); const response = await fetch(`/_/api/v1/city/spots/${spot.uuid}/relations`, {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(Object.fromEntries(new FormData(event.target)))}); if (response.ok) await load(); else alert((await response.json()).error); });
|
||||
inspector.querySelectorAll('[data-remove-page]').forEach(button => button.addEventListener('click', async () => { const response = await fetch(`/_/api/v1/city/spots/${spot.uuid}/pages`, {method:'DELETE',headers:{'Content-Type':'application/json'},body:JSON.stringify({page_uuid:button.dataset.removePage,edge_type:button.dataset.edge})}); if (response.ok) await load(); else alert((await response.json()).error); }));
|
||||
inspector.querySelectorAll('[data-remove-relation]').forEach(button => button.addEventListener('click', async () => { const response = await fetch(`/_/api/v1/city/spots/${spot.uuid}/relations`, {method:'DELETE',headers:{'Content-Type':'application/json'},body:JSON.stringify({target_spot_uuid:button.dataset.removeRelation,relation_type:button.dataset.relation})}); if (response.ok) await load(); else alert((await response.json()).error); }));
|
||||
// Spot relocation is offered by the organizer's modal. The legacy form
|
||||
// changed the Street without changing its boundary or retaining inference.
|
||||
}
|
||||
};
|
||||
const enterSpot = (spot, parent) => {
|
||||
cityView={...cityView,level:'spot',spot:spot.uuid,page:0};
|
||||
showSpot(spot,parent);renderScene();
|
||||
};
|
||||
const escapeHTML = value => String(value || '').replace(/[&<>'"]/g, c => ({'&':'&','<':'<','>':'>',"'":''','"':'"'}[c]));
|
||||
// Estate placement is computed directly before rendering; no observer-driven
|
||||
// reflow or redistribution of Spot anchors is needed.
|
||||
const detailURL = (type, item) => item.detail_href?.startsWith('/v/city/') ? item.detail_href : `/v/city/${{Quartier:'q', Street:'s', Spot:'p'}[type]}/uuid:${encodeURIComponent(item.uuid)}`;
|
||||
const closeContext = () => { contextMenu?.remove(); contextMenu = null; };
|
||||
const deleteNode = async (type, item) => {
|
||||
const ja = document.documentElement.lang.toLowerCase().startsWith('ja');
|
||||
if (!confirm(ja ? `${item.title || item.name} を削除しますか? 下位要素も案内図から削除されます。ドキュメント自体は削除されません。` : `Delete ${item.title || item.name}? Descendants are removed from the map; documents are preserved.`)) return;
|
||||
const plural = type === 'Spot' ? 'spots' : 'zones';
|
||||
const options = {method:'DELETE', headers:{'Content-Type':'application/json'}};
|
||||
if (type !== 'Spot') options.body = JSON.stringify({kind:type.toLowerCase()});
|
||||
const response = await fetch(`/_/api/v1/city/${plural}/${item.uuid}`, options);
|
||||
if (!response.ok) { alert((await response.json()).error || 'Delete failed'); return; }
|
||||
closeContext(); inspector.innerHTML = ''; await load();
|
||||
};
|
||||
const openContext = (event, type, item) => {
|
||||
event.preventDefault(); event.stopPropagation(); closeContext();
|
||||
const ja = document.documentElement.lang.toLowerCase().startsWith('ja');
|
||||
const url = event.target.closest?.('.city-map-page-link')?.getAttribute('href') || detailURL(type, item);
|
||||
contextMenu = document.createElement('div');
|
||||
contextMenu.className = 'city-context-menu'; contextMenu.setAttribute('role', 'menu');
|
||||
contextMenu.innerHTML = `<strong>${escapeHTML(item.title || item.name)}</strong><a role="menuitem" href="${escapeHTML(url)}">${ja ? '詳細を開く' : 'Open details'}</a><a role="menuitem" href="${escapeHTML(url)}" target="_blank" rel="noopener">${ja ? '新しいタブで開く' : 'Open in new tab'}</a><button type="button" role="menuitem" data-copy-city-link>${ja ? 'リンクをコピー' : 'Copy link'}</button>${document.querySelector('.city-planner') ? `<button type="button" class="city-context-delete" role="menuitem" data-delete-city>${ja ? '削除' : 'Delete'}</button>` : ''}`;
|
||||
document.body.append(contextMenu);
|
||||
organizer?.context(contextMenu,type,item,event);
|
||||
const rect = contextMenu.getBoundingClientRect();
|
||||
contextMenu.style.left = `${Math.max(8, Math.min(event.clientX, innerWidth - rect.width - 8))}px`;
|
||||
contextMenu.style.top = `${Math.max(8, Math.min(event.clientY, innerHeight - rect.height - 8))}px`;
|
||||
contextMenu.querySelector('[data-copy-city-link]').addEventListener('click', async () => { try { await navigator.clipboard.writeText(new URL(url, location.href).href); } catch (_) {} closeContext(); });
|
||||
contextMenu.querySelector('[data-delete-city]')?.addEventListener('click', () => deleteNode(type, item));
|
||||
contextMenu.querySelector('a')?.focus();
|
||||
};
|
||||
const findCityItem = (type, id) => {
|
||||
if (!city) return null;
|
||||
if (type === 'Quartier') return city.quartiers.find(item => item.uuid === id);
|
||||
if (type === 'Street') return city.quartiers.flatMap(item => item.streets).find(item => item.uuid === id);
|
||||
if (type === 'Spot') return city.quartiers.flatMap(item => item.streets.flatMap(street => street.spots)).find(item => item.uuid === id);
|
||||
return null;
|
||||
};
|
||||
|
||||
const sceneGroup = (type, item) => node('g', {class:`city-node city-${type.toLowerCase()}-tile`,tabindex:'0',role:'button','data-city-type':type,'data-city-uuid':item.uuid,'aria-label':`${type} ${item.title}`});
|
||||
const sceneText = (group, x, y, title, path) => { group.append(node('text',{class:'city-scene-title',x,y},title)); group.append(node('text',{class:'city-scene-path',x,y:y+22},path||'')); };
|
||||
// Anchor the name to a road, but keep the text horizontal even on vertical
|
||||
// or diagonal segments. textPath rotates and clips names on short segments.
|
||||
const appendStreetLabel = (group, street, roads, mapPoint) => {
|
||||
if (!roads.length) return;
|
||||
const road = roads[Math.floor(roads.length / 2)];
|
||||
const [x, y] = mapPoint([(road[0] + road[2]) / 2, (road[1] + road[3]) / 2]);
|
||||
group.append(node('text', {
|
||||
class: 'city-generated-street-label', x, y: y - 10, 'text-anchor': 'middle'
|
||||
}, street.title || street.name));
|
||||
};
|
||||
function updateCityTrail() {
|
||||
let trail=document.querySelector('[data-city-trail]'); if(!trail){trail=document.createElement('nav');trail.className='city-trail';trail.dataset.cityTrail='';document.querySelector('.city-toolbar').prepend(trail);}
|
||||
const q=city.quartiers.find(item=>item.uuid===cityView.quartier), s=q?.streets.find(item=>item.uuid===cityView.street),p=s?.spots.find(item=>item.uuid===cityView.spot);
|
||||
trail.innerHTML=`<button type="button" data-city-level="domain">City</button>${q?`<span>›</span><button type="button" data-city-level="quartier">${escapeHTML(q.title)}</button>`:''}${s?`<span>›</span><button type="button" data-city-level="street">${escapeHTML(s.title)}</button>`:''}${cityView.level==='spot'&&p?`<span>›</span><span aria-current="location">${escapeHTML(p.title)}</span>`:''}`;
|
||||
trail.querySelector('[data-city-level="domain"]')?.addEventListener('click',()=>{cityView={level:'domain',quartier:null,street:null};renderScene();});
|
||||
trail.querySelector('[data-city-level="quartier"]')?.addEventListener('click',()=>{cityView={level:'quartier',quartier:q.uuid,street:null};renderScene();});
|
||||
trail.querySelector('[data-city-level="street"]')?.addEventListener('click',()=>{cityView={level:'street',quartier:q.uuid,street:s.uuid};renderScene();});
|
||||
const search=document.querySelector('[data-city-locality-search]');if(search){const id=cityView.level==='quartier'?q?.uuid:cityView.level==='street'?s?.uuid:cityView.level==='spot'?p?.uuid:null;search.elements.locality.value=cityView.level;search.elements.locality_id.value=id?'uuid:'+id:'';}
|
||||
}
|
||||
const edgeWeight = edge => ({primary:1,path:1,guide:.7,example:.5,attachment:.25,reference:.15,related:.15}[edge]||.35);
|
||||
const spotWeight = spot => { const pages=new Map();(spot.pages||[]).forEach(page=>pages.set(page.page_uuid,Math.max(pages.get(page.page_uuid)||0,edgeWeight(page.edge_type))));return [...pages.values()].reduce((a,b)=>a+b,0); };
|
||||
const streetWeight = street => Math.max(.25,street.spots.reduce((sum,spot)=>sum+spotWeight(spot),0));
|
||||
const quartierWeight = quartier => { const pages=new Map();quartier.streets.forEach(street=>street.spots.forEach(spot=>(spot.pages||[]).forEach(page=>pages.set(page.page_uuid,Math.max(pages.get(page.page_uuid)||0,edgeWeight(page.edge_type))))));return Math.max(.5,[...pages.values()].reduce((a,b)=>a+b,0)); };
|
||||
function partition(items,rect,weight,output=new Map(),depth=0){if(!items.length)return output;if(items.length===1){output.set(items[0].uuid,rect);return output;}const total=items.reduce((sum,item)=>sum+weight(item),0);let split=1,running=weight(items[0]);for(let i=1;i<items.length;i++){if(Math.abs(running-total/2)<Math.abs(running+weight(items[i])-total/2)){split=i;break;}running+=weight(items[i]);split=i+1;}split=Math.min(items.length-1,Math.max(1,split));const first=items.slice(0,split),second=items.slice(split),ratio=Math.max(.18,Math.min(.82,first.reduce((sum,item)=>sum+weight(item),0)/total)),vertical=rect.w>=rect.h;if(vertical){const w=rect.w*ratio;partition(first,{x:rect.x,y:rect.y,w,h:rect.h},weight,output,depth+1);partition(second,{x:rect.x+w,y:rect.y,w:rect.w-w,h:rect.h},weight,output,depth+1);}else{const h=rect.h*ratio;partition(first,{x:rect.x,y:rect.y,w:rect.w,h},weight,output,depth+1);partition(second,{x:rect.x,y:rect.y+h,w:rect.w,h:rect.h-h},weight,output,depth+1);}return output;}
|
||||
const centerOf = points => points.reduce((sum,p)=>[sum[0]+p[0],sum[1]+p[1]],[0,0]).map(value=>value/points.length);
|
||||
const inside = (point,rect) => point[0]>=rect.x&&point[0]<=rect.x+rect.w&&point[1]>=rect.y&&point[1]<=rect.y+rect.h;
|
||||
function cityLayout(fabric) {
|
||||
const totalWeight=city.quartiers.reduce((sum,q)=>sum+quartierWeight(q),0);
|
||||
const minimum=Math.min(.35,city.quartiers.length*.025),occupancy=Math.min(.92,Math.max(minimum,totalWeight*5/Math.max(1,fabric.buildings.length))),scale=Math.sqrt(occupancy);
|
||||
const used={x:(fabric.width-fabric.width*scale)/2,y:(fabric.height-fabric.height*scale)/2,w:fabric.width*scale,h:fabric.height*scale};
|
||||
const quartiers=partition(city.quartiers,used,quartierWeight),streetRoads=new Map();
|
||||
city.quartiers.forEach(q=>{
|
||||
const region=quartiers.get(q.uuid),roads=fabric.roads.filter(r=>inside([(r[0]+r[2])/2,(r[1]+r[3])/2],region)).sort((a,b)=>(a[0]+a[2]+a[1]+a[3])-(b[0]+b[2]+b[1]+b[3]));
|
||||
let cursor=0;
|
||||
q.streets.forEach((street,index)=>{
|
||||
const requested=Math.max(1,Math.ceil(streetWeight(street)*1.5));
|
||||
const count=Math.min(requested,Math.max(1,roads.length-cursor-(q.streets.length-index-1)));
|
||||
streetRoads.set(street.uuid,roads.slice(cursor,cursor+count));cursor+=count;
|
||||
});
|
||||
});
|
||||
return {quartiers,streetRoads,occupancy,totalWeight};
|
||||
}
|
||||
async function renderTown(context) {
|
||||
const token=context.token,status=document.querySelector('[data-city-generator-status]')||document.createElement('span');status.dataset.cityGeneratorStatus='';status.className='city-generator-status';status.textContent=label('generating');if(!status.isConnected)document.querySelector('.city-toolbar').append(status);
|
||||
try { const fabric=await domainFabricPromise;if(token!==fabricToken)return;const layout=cityLayout(fabric);
|
||||
if(context.type==='street'||context.type==='spot'){
|
||||
const open=spot=>enterSpot(spot,context.quartier.title+' / '+context.street.title);
|
||||
const estate=context.type==='spot'
|
||||
?window.PagesWikiCityEstates.spotScene(context.spot,cityView.page||0,open)
|
||||
:window.PagesWikiCityEstates.streetScene(context.street,layout.streetRoads.get(context.street.uuid)||[],cityView.page||0,open);
|
||||
svg.setAttribute('viewBox',[0,0,estate.width,estate.height].join(' '));viewport.append(estate.root);
|
||||
organizer?.syncSelection();setScenePager(estate);navigation?.refresh();svg.setAttribute('aria-busy','false');
|
||||
status.textContent=(document.documentElement.lang.startsWith('ja')?'表示中: ':'Showing: ')+estate.items.length+' / '+estate.total+' '+estate.kind;
|
||||
return;
|
||||
}
|
||||
const source=context.type==='domain'?{x:0,y:0,w:fabric.width,h:fabric.height}:layout.quartiers.get(context.quartier.uuid),width=920,height=context.type==='domain'?600:570,pad=20,sx=(width-pad*2)/source.w,sy=(height-pad*2)/source.h,mapPoint=p=>[pad+(p[0]-source.x)*sx,pad+(p[1]-source.y)*sy],layer=node('g',{class:'city-generated-fabric','aria-hidden':'true'}),visibleRoads=fabric.roads.filter(r=>inside([(r[0]+r[2])/2,(r[1]+r[3])/2],source)),visibleBuildings=fabric.buildings.filter(b=>inside(centerOf(b),source));visibleBuildings.forEach(points=>layer.append(node('polygon',{class:'city-generated-building',points:points.map(mapPoint).map(p=>p.join(',')).join(' ')})));visibleRoads.forEach(r=>{const a=mapPoint([r[0],r[1]]),b=mapPoint([r[2],r[3]]);layer.append(node('line',{class:'city-generated-road-border',x1:a[0],y1:a[1],x2:b[0],y2:b[1]}));});visibleRoads.forEach(r=>{const a=mapPoint([r[0],r[1]]),b=mapPoint([r[2],r[3]]);layer.append(node('line',{class:'city-generated-road',x1:a[0],y1:a[1],x2:b[0],y2:b[1]}));});viewport.append(layer);const overlay=node('g',{class:'city-generated-assignments'});
|
||||
if(context.type==='domain'){city.quartiers.forEach(q=>{const rect=layout.quartiers.get(q.uuid),a=mapPoint([rect.x,rect.y]),b=mapPoint([rect.x+rect.w,rect.y+rect.h]),g=sceneGroup('Quartier',q);g.append(node('rect',{class:'city-quartier-boundary',x:a[0],y:a[1],width:b[0]-a[0],height:b[1]-a[1],rx:8}));sceneText(g,a[0]+14,a[1]+28,q.title,`${Math.round(quartierWeight(q)*10)/10} pages`);g.addEventListener('click',()=>{cityView={level:'quartier',quartier:q.uuid,street:null};show('Quartier',q);renderScene();});overlay.append(g);});}
|
||||
if(context.type==='quartier'){
|
||||
context.quartier.streets.forEach((street,streetIndex)=>{
|
||||
const roads=layout.streetRoads.get(street.uuid)||[],hue=(streetIndex*67+18)%360,g=sceneGroup('Street',street);
|
||||
g.style.setProperty('--city-street-color',`hsl(${hue} 68% 58%)`);
|
||||
roads.forEach((r,i)=>{
|
||||
const a=mapPoint([r[0],r[1]]),b=mapPoint([r[2],r[3]]),d=`M ${a[0]} ${a[1]} L ${b[0]} ${b[1]}`;
|
||||
g.append(node('path',{class:'city-assigned-street',id:`city-street-${street.uuid}-${i}`,d}));
|
||||
g.append(node('path',{class:'city-generated-street-hit',d}));
|
||||
});
|
||||
appendStreetLabel(g,street,roads,mapPoint);
|
||||
g.addEventListener('click',()=>{cityView={level:'street',quartier:context.quartier.uuid,street:street.uuid};showStreet(street,context.quartier.title);renderScene();});
|
||||
overlay.append(g);
|
||||
});
|
||||
}
|
||||
viewport.append(overlay);navigation?.refresh();svg.setAttribute('aria-busy','false');status.textContent='gen-city '+fabric.version+' · '+Math.round(layout.totalWeight*10)/10+' weighted pages';
|
||||
} catch(error){
|
||||
if(token!==fabricToken||suspended||error.name==='AbortError')return;
|
||||
svg.setAttribute('aria-busy','false');
|
||||
status.textContent=label('generationFailed');empty.hidden=false;
|
||||
empty.querySelector('p').textContent=label('generationFailed');
|
||||
empty.querySelector('[data-city-retry]').hidden=false;
|
||||
console.warn(error);
|
||||
}
|
||||
}
|
||||
function setScenePager(batch) {
|
||||
const pager=document.querySelector('[data-city-scene-pager]');
|
||||
cityView.page=batch.page;pager.hidden=batch.pages<=1;
|
||||
pager.querySelector('[data-city-scene-page]').textContent=(batch.page+1)+' / '+batch.pages+' · '+batch.total+' '+batch.kind;
|
||||
pager.querySelector('[data-city-scene-prev]').disabled=batch.page===0;
|
||||
pager.querySelector('[data-city-scene-next]').disabled=batch.page+1>=batch.pages;
|
||||
}
|
||||
function renderScene() {
|
||||
if(!city)return;
|
||||
viewport.replaceChildren();updateCityTrail();reset();const token=++fabricToken;
|
||||
svg.setAttribute('aria-busy','true');
|
||||
empty.querySelector('[data-city-retry]').hidden=true;
|
||||
empty.querySelector('p').textContent=empty.dataset.emptyHelp;
|
||||
document.querySelector('[data-city-scene-pager]').hidden=true;
|
||||
const q=city.quartiers.find(item=>item.uuid===cityView.quartier),s=q?.streets.find(item=>item.uuid===cityView.street),spot=s?.spots.find(item=>item.uuid===cityView.spot);
|
||||
if(cityView.level==='domain'){
|
||||
svg.setAttribute('viewBox','0 0 920 600');viewport.append(window.PagesWikiCityEstates.definitions());
|
||||
empty.hidden=city.quartiers.length>0;renderTown({type:'domain',token});
|
||||
}else if(cityView.level==='quartier'&&q){
|
||||
svg.setAttribute('viewBox','0 0 920 570');viewport.append(window.PagesWikiCityEstates.definitions());
|
||||
empty.hidden=q.streets.length>0;renderTown({type:'quartier',quartier:q,token});
|
||||
}else if(s){
|
||||
empty.hidden=true;
|
||||
renderTown({type:cityView.level==='spot'&&spot?'spot':'street',quartier:q,street:s,spot,token});
|
||||
}
|
||||
}
|
||||
function render(data) {
|
||||
city=data;
|
||||
// A title/membership update must not randomly regenerate the town fabric.
|
||||
if(domainFabricKey!==data.domain_uuid||!domainFabricPromise){
|
||||
generationController?.abort();generationController=new AbortController();
|
||||
domainFabricKey=data.domain_uuid;
|
||||
domainFabricPromise=window.PagesWikiGenCity.generateFabric(data.domain_uuid,240,160,{signal:generationController.signal});
|
||||
}
|
||||
if(cityView.quartier&&!data.quartiers.some(q=>q.uuid===cityView.quartier))cityView={level:'domain',quartier:null,street:null};
|
||||
const q=data.quartiers.find(q=>q.uuid===cityView.quartier);
|
||||
if(cityView.street&&!q?.streets.some(s=>s.uuid===cityView.street))cityView={level:'quartier',quartier:cityView.quartier,street:null};
|
||||
if(cityView.level==='spot'&&!q?.streets.find(s=>s.uuid===cityView.street)?.spots.some(s=>s.uuid===cityView.spot))cityView={level:'street',quartier:cityView.quartier,street:cityView.street,page:0};
|
||||
version.textContent=`Topology v${data.version}`;renderDirectory(data);populateSelects(data);renderScene();organizer?.refresh();
|
||||
const selected=findCityItem(inspector.dataset.cityType,inspector.dataset.cityUuid);
|
||||
if(selected){if(inspector.dataset.cityType==='Spot')showSpot(selected,'');else if(inspector.dataset.cityType==='Street')showStreet(selected,'');else show('Quartier',selected);}
|
||||
else{inspector.replaceChildren();delete inspector.dataset.cityUuid;delete inspector.dataset.cityType;}
|
||||
if(!svg.dataset.requestedLocalityApplied){
|
||||
svg.dataset.requestedLocalityApplied='true';
|
||||
const params=new URLSearchParams(location.search),type=['spot','street','quartier'].find(kind=>params.has(kind)),id=params.get(type);
|
||||
const q=data.quartiers.find(q=>type==='quartier'?q.uuid===id:q.streets.some(s=>type==='street'?s.uuid===id:s.spots.some(p=>p.uuid===id)));
|
||||
const s=q?.streets.find(s=>type==='street'?s.uuid===id:s.spots.some(p=>p.uuid===id)),p=s?.spots.find(p=>p.uuid===id);
|
||||
if(q){cityView={level:type,quartier:q.uuid,street:s?.uuid||null,spot:p?.uuid||null,page:0};renderScene();if(p)showSpot(p,q.title+' / '+s.title);else if(s)showStreet(s,q.title);else show('Quartier',q);}
|
||||
}
|
||||
}
|
||||
function renderDirectory(data) {
|
||||
const jump=(type,item)=>`<button type="button" data-city-jump="${type}" data-city-id="${item.uuid}">${escapeHTML(item.title||item.name)}</button>`;
|
||||
directory.innerHTML = `<div class="city-directory-grid">${data.quartiers.map(q => `<article><h3>${jump('quartier',q)}</h3>${q.description ? `<p>${escapeHTML(q.description)}</p>` : ''}${q.streets.map(s => `<h4>${jump('street',s)}</h4><ul>${s.spots.map(p => `<li>${jump('spot',p)}</li>`).join('')}</ul>`).join('')}</article>`).join('')}</div>`;
|
||||
directory.querySelectorAll('[data-city-jump]').forEach(button=>button.addEventListener('click',()=>{
|
||||
const type=button.dataset.cityJump,id=button.dataset.cityId;
|
||||
const q=data.quartiers.find(q=>q.uuid===id||q.streets.some(s=>s.uuid===id||s.spots.some(p=>p.uuid===id)));
|
||||
const s=q?.streets.find(s=>s.uuid===id||s.spots.some(p=>p.uuid===id)),p=s?.spots.find(p=>p.uuid===id);
|
||||
if(!q)return;
|
||||
cityView={level:type,quartier:q.uuid,street:s?.uuid||null,spot:p?.uuid||null,page:0};
|
||||
if(p)showSpot(p,q.title+' / '+s.title);else if(s)showStreet(s,q.title);else show('Quartier',q);
|
||||
window.PagesWikiCityMenu.close();renderScene();
|
||||
}));
|
||||
}
|
||||
function populateSelects(data) {
|
||||
document.querySelectorAll('[data-city-quartier-select]').forEach(select => select.innerHTML = data.quartiers.map(q => `<option value="${q.uuid}">${escapeHTML(q.title)}</option>`).join(''));
|
||||
const streets = data.quartiers.flatMap(q => q.streets.map(s => ({...s, quartier: q.title})));
|
||||
document.querySelectorAll('[data-city-street-select]').forEach(select => select.innerHTML = streets.map(s => `<option value="${s.uuid}">${escapeHTML(s.quartier)} / ${escapeHTML(s.title)}</option>`).join(''));
|
||||
}
|
||||
function installCityAutoPlan() {
|
||||
const planner=document.querySelector('.city-planner');if(!planner||document.querySelector('[data-city-autoplan]'))return;
|
||||
const ja=document.documentElement.lang.startsWith('ja'),panel=document.createElement('details');panel.className='city-autoplan';panel.dataset.cityAutoplan='';panel.innerHTML=`<summary>${ja?'URL Pathから都市を自動生成':'Generate City from URL Paths'}</summary><p class="muted">${ja?'第1階層をQuartier、第2階層をStreet、第3階層をSpotとしてdry-runします。浅いPageは未定義Spotへ所属します。':'Dry-run: level 1 becomes Quartier, level 2 Street, and level 3 Spot. Shallow Pages use an undefined Spot.'}</p><button type="button" data-autoplan-preview>${ja?'計画を表示':'Preview plan'}</button><button type="button" data-autoplan-apply hidden>${ja?'計画を適用':'Apply plan'}</button><span data-autoplan-result></span><div class="city-autoplan-results" data-autoplan-results></div>`;planner.before(panel);
|
||||
const result=panel.querySelector('[data-autoplan-result]'),results=panel.querySelector('[data-autoplan-results]'),apply=panel.querySelector('[data-autoplan-apply]');
|
||||
panel.querySelector('[data-autoplan-preview]').addEventListener('click',async()=>{result.textContent='…';const response=await fetch('/_/api/v1/city/autoplan');const data=await response.json();if(!response.ok){result.textContent=data.error||'Failed';return}result.textContent=`${data.count} Pages`;const rows=(data.items||[]).slice(0,300);results.innerHTML=`<table><thead><tr><th>Path</th><th>Quartier</th><th>Street</th><th>Spot</th><th>${ja?'処理':'Action'}</th></tr></thead><tbody>${rows.map(item=>`<tr><td><code>${escapeHTML(item.path)}</code></td><td>${escapeHTML(item.Quartier)}</td><td>${escapeHTML(item.Street)}</td><td class="${item.undefined_spot?'is-undefined':''}">${escapeHTML(item.Spot)}</td><td>${escapeHTML(item.action)}</td></tr>`).join('')}</tbody></table>${data.count>rows.length?`<p>+ ${data.count-rows.length}</p>`:''}`;apply.hidden=!data.count;});
|
||||
apply.addEventListener('click',async()=>{if(!confirm(ja?'この計画をCityへ適用しますか?':'Apply this plan to the City?'))return;apply.disabled=true;result.textContent='…';const response=await fetch('/_/api/v1/city/autoplan',{method:'POST'}),data=await response.json();apply.disabled=false;if(!response.ok){result.textContent=data.error||'Failed';return}result.textContent=`${data.applied} Pages`;await load();});
|
||||
}
|
||||
function reset() { transform = { x: 0, y: 0, scale: 1 }; applyTransform(); }
|
||||
async function load() {
|
||||
loadController?.abort();const controller=new AbortController();loadController=controller;
|
||||
// Discard old authorized labels before revalidation, including BFCache
|
||||
// restoration and failed/revoked reloads. Geometry caches contain no names.
|
||||
++fabricToken;generationController?.abort();domainFabricPromise=null;city=null;closeContext();viewport.replaceChildren();directory.replaceChildren();inspector.replaceChildren();
|
||||
document.querySelector('[data-city-trail]')?.replaceChildren();
|
||||
document.querySelector('[data-city-scene-pager]').hidden=true;version.textContent='';
|
||||
populateSelects({quartiers:[]});
|
||||
try {
|
||||
const response=await fetch('/_/api/v1/city/map',{cache:'no-store',headers:{Accept:'application/json'},signal:controller.signal});
|
||||
if(!response.ok)throw new Error(await response.text());
|
||||
const data=await response.json();
|
||||
if(loadController===controller&&!suspended)render(data);
|
||||
} catch(error){if(error.name!=='AbortError')throw error;}
|
||||
finally {if(loadController===controller)loadController=null;}
|
||||
}
|
||||
function goParent(focus=false) {
|
||||
if(!city||cityView.level==='domain')return;
|
||||
const preferred=cityView.spot||cityView.street||cityView.quartier;
|
||||
if(cityView.level==='spot')cityView={level:'street',quartier:cityView.quartier,street:cityView.street,page:0};
|
||||
else if(cityView.level==='street')cityView={level:'quartier',quartier:cityView.quartier,street:null};
|
||||
else cityView={level:'domain',quartier:null,street:null};
|
||||
if(focus)navigation?.requestFocus(preferred);renderScene();
|
||||
}
|
||||
document.querySelectorAll('[data-city-action]').forEach(button => button.addEventListener('click', () => ({'zoom-in': () => zoom(1.25), 'zoom-out': () => zoom(.8), reset}[button.dataset.cityAction] || (() => {}))()));
|
||||
document.querySelector('[data-city-labels]')?.addEventListener('change', event => svg.classList.toggle('city-labels-off', !event.target.checked));
|
||||
svg.addEventListener('wheel', event => { event.preventDefault(); const point=svgPoint(event.clientX,event.clientY);zoom(event.deltaY < 0 ? 1.12 : .89,point.x,point.y); }, { passive: false });
|
||||
svg.addEventListener('contextmenu', event => {
|
||||
const target = event.target.closest?.('[data-city-type]');
|
||||
if (!target) return;
|
||||
const item = findCityItem(target.dataset.cityType, target.dataset.cityUuid);
|
||||
if (item) openContext(event, target.dataset.cityType, item);
|
||||
}, true);
|
||||
svg.addEventListener('pointerdown', event => {
|
||||
if (event.button !== 0 || event.target.closest?.('a,button')) return;
|
||||
const p=svgPoint(event.clientX,event.clientY);dragging = { x:p.x, y:p.y, screenX:event.clientX,screenY:event.clientY,tx:transform.x, ty:transform.y, pointerId:event.pointerId, active:false };
|
||||
});
|
||||
svg.addEventListener('click', event => { if (suppressClick) { event.preventDefault(); event.stopPropagation(); event.cityDragSuppressed=true; suppressClick = false; } }, true);
|
||||
svg.addEventListener('click', event => {
|
||||
if(event.cityDragSuppressed||event.defaultPrevented||event.target.closest?.('.city-node,a,button'))return;
|
||||
goParent();
|
||||
});
|
||||
svg.addEventListener('pointermove', event => {
|
||||
if (!dragging) return;
|
||||
const p=svgPoint(event.clientX,event.clientY),dx=p.x-dragging.x,dy=p.y-dragging.y;
|
||||
if (!dragging.active && Math.hypot(event.clientX-dragging.screenX,event.clientY-dragging.screenY) < 7) return;
|
||||
if (!dragging.active) { dragging.active = true; svg.setPointerCapture(dragging.pointerId); svg.classList.add('is-dragging'); }
|
||||
transform.x = dragging.tx + dx; transform.y = dragging.ty + dy; applyTransform();
|
||||
});
|
||||
const endDrag = () => { if (dragging?.active) suppressClick = true; dragging = null; svg.classList.remove('is-dragging'); };
|
||||
svg.addEventListener('pointerup', endDrag); svg.addEventListener('pointercancel', endDrag);
|
||||
document.querySelectorAll('[data-city-create]').forEach(form => form.addEventListener('submit', async event => { event.preventDefault(); const values = Object.fromEntries(new FormData(form)); const kind = form.dataset.cityCreate; const endpoint = kind === 'spot' ? 'spots' : 'zones'; const result = document.querySelector('[data-city-plan-result]'); const response = await fetch(`/_/api/v1/city/${endpoint}`, { method: 'POST', headers: {'Content-Type':'application/json','Accept':'application/json'}, body: JSON.stringify(values) }); const body = await response.json(); if (!response.ok) { result.textContent = body.error || 'Failed'; return; } form.reset(); result.textContent = 'Saved'; await load(); }));
|
||||
document.addEventListener('pointerdown', event => { if (contextMenu && !contextMenu.contains(event.target)) closeContext(); });
|
||||
document.addEventListener('keydown', event => { if (event.key === 'Escape') closeContext(); });
|
||||
if(popupMode) document.addEventListener('click',event=>{const link=event.target.closest?.('a[href]');if(!link||link.hasAttribute('data-city-level'))return;if(organizer&&(event.ctrlKey||event.metaKey)&&link.closest('#city-map'))return;const href=link.getAttribute('href');if(!href)return;event.preventDefault();event.stopPropagation();window.top.location.href=new URL(href,location.href).href},true);
|
||||
addEventListener('scroll', closeContext, true);
|
||||
installCityAutoPlan();
|
||||
document.querySelector('[data-city-scene-prev]').addEventListener('click',()=>{cityView.page=Math.max(0,(cityView.page||0)-1);renderScene();});
|
||||
document.querySelector('[data-city-scene-next]').addEventListener('click',()=>{cityView.page=(cityView.page||0)+1;renderScene();});
|
||||
organizer=window.PagesWikiCityOrganizer?.({svg,getCity:()=>city,reload:load,canPlan:!!document.querySelector('.city-planner'),dismissMenus:()=>{closeContext();window.PagesWikiCityMenu.close();}});
|
||||
navigation=window.PagesWikiCityNavigation({svg,parent:()=>goParent(true)});
|
||||
empty.querySelector('[data-city-retry]').addEventListener('click',()=>{domainFabricPromise=null;load().catch(error=>{empty.hidden=false;empty.querySelector('p').textContent=error.message;});});
|
||||
addEventListener('pagehide',()=>{suspended=true;++fabricToken;loadController?.abort();generationController?.abort();window.PagesWikiGenCity.cancel();domainFabricPromise=null;});
|
||||
addEventListener('pageshow',event=>{if(event.persisted){suspended=false;load().catch(error=>{empty.hidden=false;empty.querySelector('p').textContent=error.message;});}});
|
||||
load().catch(error => { empty.hidden = false; empty.querySelector('p').textContent = error.message; });
|
||||
})();
|
||||
@@ -0,0 +1,17 @@
|
||||
(() => {
|
||||
const dialog=document.querySelector('[data-city-command-menu]');if(!dialog)return;
|
||||
const select=tab=>{
|
||||
if(!dialog.querySelector(`[data-city-menu-panel="${tab}"]`))tab='guide';
|
||||
dialog.querySelectorAll('[data-city-menu-panel]').forEach(panel=>panel.hidden=panel.dataset.cityMenuPanel!==tab);
|
||||
dialog.querySelectorAll('[data-city-menu-tab]').forEach(button=>button.setAttribute('aria-pressed',String(button.dataset.cityMenuTab===tab)));
|
||||
};
|
||||
const open=(tab='guide')=>{select(tab);if(!dialog.open)dialog.showModal();dialog.querySelector(`[data-city-menu-tab="${tab}"]`)?.focus();};
|
||||
const close=()=>dialog.close();
|
||||
document.querySelector('[data-city-menu-open]').addEventListener('click',()=>open());
|
||||
dialog.querySelectorAll('[data-city-menu-close]').forEach(b=>b.addEventListener('click',close));
|
||||
dialog.querySelectorAll('[data-city-menu-tab]').forEach(b=>b.addEventListener('click',()=>select(b.dataset.cityMenuTab)));
|
||||
dialog.addEventListener('click',event=>{if(event.target===dialog)close();});
|
||||
dialog.addEventListener('keydown',event=>{if(event.key==='Escape')event.stopPropagation();});
|
||||
dialog.querySelector('[data-city-create-kind]')?.addEventListener('change',event=>dialog.querySelectorAll('[data-city-create]').forEach(form=>form.hidden=form.dataset.cityCreate!==event.target.value));
|
||||
window.PagesWikiCityMenu={open,close};
|
||||
})();
|
||||
@@ -0,0 +1,56 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
window.PagesWikiCityNavigation = ({svg, parent}) => {
|
||||
const selector = '.city-quartier-tile,.city-street-tile,.city-spot-entry[role="button"],.city-estate-more,.city-map-page-link,.city-portal-link';
|
||||
const directions = {ArrowLeft:[-1,0], a:[-1,0], h:[-1,0], ArrowRight:[1,0], d:[1,0], l:[1,0], ArrowUp:[0,-1], w:[0,-1], k:[0,-1], ArrowDown:[0,1], s:[0,1], j:[0,1]};
|
||||
let focusPending = false, preferred = null;
|
||||
const blocked = () => !!document.querySelector('dialog[open],.city-context-menu') || [...document.querySelectorAll('[role="dialog"][aria-modal="true"]:not(dialog):not([hidden])')].some(element => element.getClientRects().length && getComputedStyle(element).visibility !== 'hidden');
|
||||
const candidates = () => {
|
||||
const bounds = svg.getBoundingClientRect();
|
||||
return [...svg.querySelectorAll(selector)].map(element => ({element, rect: element.getBoundingClientRect()})).filter(({element, rect}) => {
|
||||
const style = getComputedStyle(element);
|
||||
return rect.width > 0 && rect.height > 0 && rect.right > bounds.left && rect.left < bounds.right && rect.bottom > bounds.top && rect.top < bounds.bottom && style.display !== 'none' && style.visibility !== 'hidden' && !element.closest('[hidden],[inert]');
|
||||
}).map(item => ({...item, x: item.rect.left + item.rect.width/2, y: item.rect.top + item.rect.height/2}));
|
||||
};
|
||||
const focus = item => item?.element.focus({preventScroll:true});
|
||||
const refresh = () => {
|
||||
if (!focusPending || blocked()) return;
|
||||
const items = candidates();
|
||||
const wanted = preferred && items.find(item => item.element.closest('[data-city-uuid]')?.dataset.cityUuid === preferred);
|
||||
focus(wanted || items.sort((a,b) => a.y-b.y || a.x-b.x)[0]);
|
||||
if (items.length) { focusPending = false; preferred = null; }
|
||||
};
|
||||
const requestFocus = id => { focusPending = true; preferred = id || null; };
|
||||
const keydown = event => {
|
||||
if (event.defaultPrevented || event.isComposing || event.keyCode === 229 || event.ctrlKey || event.metaKey || event.altKey || blocked()) return;
|
||||
const target = event.target;
|
||||
if (target.closest?.('input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"]')) return;
|
||||
if (!svg.contains(target) && target !== document.body && target !== document.documentElement) return;
|
||||
const direction = directions[event.key] || directions[event.key.toLowerCase()];
|
||||
if (event.key === 'Backspace') {
|
||||
event.preventDefault(); event.stopPropagation(); parent(); return;
|
||||
}
|
||||
if (!direction && event.key !== 'Enter' && event.key !== ' ') return;
|
||||
const items = candidates();
|
||||
const current = items.find(item => item.element === document.activeElement || item.element === target);
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
if (!current) return;
|
||||
event.preventDefault(); event.stopPropagation(); requestFocus();
|
||||
if (event.repeat) return;
|
||||
current.element.dispatchEvent(new MouseEvent('click', {bubbles:true,cancelable:true,view:window}));
|
||||
return;
|
||||
}
|
||||
if (!direction || !items.length) return;
|
||||
event.preventDefault(); event.stopPropagation();
|
||||
if (!current) { focus(items.sort((a,b) => a.y-b.y || a.x-b.x)[0]); return; }
|
||||
const [vx, vy] = direction;
|
||||
const next = items.filter(item => item !== current).map(item => {
|
||||
const dx = item.x-current.x, dy = item.y-current.y, forward = dx*vx+dy*vy, sideways = Math.abs(dx*vy-dy*vx);
|
||||
return {item, forward, score: Math.hypot(dx,dy)*(1+sideways/Math.max(1,forward))};
|
||||
}).filter(item => item.forward > 1).sort((a,b) => a.score-b.score)[0];
|
||||
focus(next?.item);
|
||||
};
|
||||
document.addEventListener('keydown', keydown, true);
|
||||
return {refresh, requestFocus, destroy: () => document.removeEventListener('keydown', keydown, true)};
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,20 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const form = document.querySelector('[data-city-path-form]');
|
||||
if (!form) return;
|
||||
form.addEventListener('submit', async (event) => {
|
||||
event.preventDefault();
|
||||
const result = form.querySelector('[data-city-path-result]');
|
||||
const type = form.dataset.kind === 'spot' ? 'spots' : 'zones';
|
||||
const response = await fetch(`/_/api/v1/city/${type}/${encodeURIComponent(form.dataset.uuid)}`, {
|
||||
method: 'PATCH',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({kind: form.dataset.kind, path_prefix: form.elements.path_prefix.value}),
|
||||
});
|
||||
if (!response.ok) {
|
||||
const data = await response.json().catch(() => ({}));
|
||||
result.textContent = data.error || `HTTP ${response.status}`;
|
||||
return;
|
||||
}
|
||||
result.textContent = document.documentElement.lang.startsWith('ja') ? '保存しました' : 'Saved';
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,165 @@
|
||||
// City-only organization. Document URLs are not renamed by these actions.
|
||||
window.PagesWikiCityOrganizer = ({svg, getCity, reload, dismissMenus, canPlan}) => {
|
||||
if (!canPlan) return null;
|
||||
const ja = document.documentElement.lang.startsWith('ja');
|
||||
const words = ja ? {
|
||||
rename:'表示名を変更', title:'表示名', save:'保存', cancel:'キャンセル',
|
||||
merge:'既存Spotに統合', create:'新しいSpotにまとめる', move:'別のStreetに移す', clear:'選択を解除',
|
||||
selected:'件を選択中', target:'統合先Spot', street:'配置先Street', path:'SpotのPath境界', name:'識別名',
|
||||
advanced:'詳細設定', unchanged:'PageのURL・UUID・内容は変更しません。Spotの入れ子は作りません。',
|
||||
mergeHelp:'選択したPageをまとめます。選択元のSpot全体を統合した場合、元Spotは地図から除去し、関連リンクを統合先へ引き継ぎます。',
|
||||
moveHelp:'SpotのUUIDを保ってStreetとPath境界を変更します。既存PageはURLを変えず、明示的な所属として引き継ぎます。',
|
||||
renameHelp:'地図の表示名だけを変更します。識別名と既存リンクは維持されます。',
|
||||
empty:'選べる宛先がありません。新しいSpotを作成してください。', busy:'保存中…', failed:'操作に失敗しました。',
|
||||
city_changed:'地図が更新されています。閉じて地図を更新し、選択内容を確認してから再実行してください。',
|
||||
city_invalid_selection:'選択が無効です。地図を更新して選択し直してください。',
|
||||
city_invalid_target:'選択元と異なる有効な宛先を指定してください。',
|
||||
city_invalid_title:'表示名を1〜160文字で入力してください。', city_name_conflict:'識別名が使用済みです。詳細設定で変更してください。',
|
||||
city_too_many_pages:'一度に処理できるPage数を超えています。選択を分けてください。',
|
||||
city_too_many_relations:'関連リンクが多すぎます。選択するSpotを分けてください。',
|
||||
boundary:'Pathは配置先の配下に指定し、ほかのSpotの境界と重ならないようにしてください。',
|
||||
forbidden:'この操作にはドメイン管理権限が必要です。', refresh:'地図を更新', hint:'Ctrl / ⌘ + クリックで複数選択'
|
||||
} : {
|
||||
rename:'Rename display title', title:'Display title', save:'Save', cancel:'Cancel',
|
||||
merge:'Merge into Spot', create:'Create Spot from selection', move:'Move to Street', clear:'Clear selection',
|
||||
selected:'selected', target:'Destination Spot', street:'Destination Street', path:'Spot Path boundary', name:'Identifier',
|
||||
advanced:'Advanced', unchanged:'Page URLs, UUIDs and content are preserved. Spots cannot contain other Spots.',
|
||||
mergeHelp:'Combine the selected Pages. Whole source Spots are removed from the map; their relations are transferred to the destination.',
|
||||
moveHelp:'Keep Spot UUIDs while changing Street and Path boundaries. Existing Pages retain their URLs and are kept as explicit members.',
|
||||
renameHelp:'Change the map title only. Identifiers and existing links remain unchanged.',
|
||||
empty:'No destination is available. Create a new Spot instead.', busy:'Saving…', failed:'Operation failed.',
|
||||
city_changed:'The map changed. Close this dialog, refresh and review the selection before retrying.',
|
||||
city_invalid_selection:'Invalid selection. Refresh and select again.', city_invalid_target:'Choose a valid destination outside the selection.',
|
||||
city_invalid_title:'Enter a title of 1–160 characters.', city_name_conflict:'Identifier already exists. Change it in Advanced.',
|
||||
city_too_many_pages:'Too many Pages for one operation. Split the selection.',
|
||||
city_too_many_relations:'Too many relations. Select fewer Spots.',
|
||||
boundary:'The Path must be under the destination and must not overlap another Spot boundary.',
|
||||
forbidden:'Domain administrator access is required.', refresh:'Refresh map', hint:'Ctrl / ⌘ + click to select multiple items'
|
||||
};
|
||||
const escape = value => String(value ?? '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||
const selection = new Map();
|
||||
const spots = () => (getCity()?.quartiers || []).flatMap(q => q.streets.flatMap(s => s.spots.map(p => ({...p, street:s, quartier:q}))));
|
||||
const streets = () => (getCity()?.quartiers || []).flatMap(q => q.streets.map(s => ({...s, quartier:q})));
|
||||
const pageKey = (spot, page) => `page:${spot}:${page}`;
|
||||
const pick = target => {
|
||||
const page = target.closest?.('.city-map-page-link');
|
||||
const spot = target.closest?.('[data-city-type="Spot"]');
|
||||
if (!spot) return null;
|
||||
const item = spots().find(p => p.uuid === spot.dataset.cityUuid);
|
||||
if (!item) return null;
|
||||
if (page) return {key:pageKey(item.uuid,page.dataset.pageUuid),spot_uuid:item.uuid,page_uuid:page.dataset.pageUuid,title:page.getAttribute('aria-label')};
|
||||
return {key:`spot:${item.uuid}`,spot_uuid:item.uuid,title:item.title || item.name};
|
||||
};
|
||||
const bar = document.createElement('div');
|
||||
bar.className='city-selection-bar'; bar.hidden=true;
|
||||
bar.innerHTML=`<span data-city-selected-count aria-live="polite"></span>`;
|
||||
svg.closest('.city-canvas-wrap').append(bar);
|
||||
const button = (container, title, icon, action, attribute) => {
|
||||
const el=document.createElement('button'); el.type='button';el.title=title;el.setAttribute('aria-label',title);
|
||||
if(attribute)el.setAttribute(attribute,'');if(container.getAttribute('role')==='menu')el.setAttribute('role','menuitem');el.textContent=icon;el.addEventListener('click',action);container.append(el);return el;
|
||||
};
|
||||
const syncSelection = () => {
|
||||
bar.hidden=selection.size===0;
|
||||
bar.querySelector('[data-city-selected-count]').textContent=`${selection.size} ${words.selected}`;
|
||||
moveButton.disabled=[...selection.values()].some(p=>p.page_uuid);
|
||||
svg.querySelectorAll('[data-city-type="Spot"]').forEach(el=>el.classList.toggle('city-is-selected',selection.has(`spot:${el.dataset.cityUuid}`)));
|
||||
svg.querySelectorAll('.city-map-page-link').forEach(el=>el.classList.toggle('city-is-selected',selection.has(pageKey(el.closest('[data-city-uuid]').dataset.cityUuid,el.dataset.pageUuid))));
|
||||
};
|
||||
const add = item => {
|
||||
if(item.page_uuid)selection.delete(`spot:${item.spot_uuid}`);
|
||||
else for(const [key,value] of selection)if(value.spot_uuid===item.spot_uuid)selection.delete(key);
|
||||
selection.set(item.key,item);
|
||||
};
|
||||
button(bar,words.merge,'↪',()=>organize('merge'),'data-city-merge');
|
||||
button(bar,words.create,'+',()=>organize('create'),'data-city-create-selection');
|
||||
const moveButton=button(bar,words.move,'⇄',()=>organize('move'),'data-city-move-selection');
|
||||
button(bar,words.clear,'×',()=>{selection.clear();syncSelection();},'data-city-clear-selection');
|
||||
svg.addEventListener('pointerdown',event=>{if((event.ctrlKey||event.metaKey)&&pick(event.target))event.stopPropagation();},true);
|
||||
svg.addEventListener('click',event=>{
|
||||
if(!(event.ctrlKey||event.metaKey)||event.cityDragSuppressed)return;
|
||||
const item=pick(event.target);if(!item)return;
|
||||
event.preventDefault();event.stopImmediatePropagation();
|
||||
if(selection.has(item.key))selection.delete(item.key);else if(selection.size<200)add(item);
|
||||
syncSelection();
|
||||
},true);
|
||||
const errorText = error => words[error.message] || (/Path|boundar/.test(error.message)?words.boundary:error.message || words.failed);
|
||||
const post = async (url, body) => {
|
||||
const response=await fetch(url,{method:'POST',headers:{'Content-Type':'application/json','Accept':'application/json'},body:JSON.stringify(body)});
|
||||
const data=await response.json().catch(()=>({}));
|
||||
if(!response.ok)throw new Error(response.status===403||response.status===401?'forbidden':data.error||`HTTP ${response.status}`);
|
||||
return data;
|
||||
};
|
||||
let dialog=null;
|
||||
const openDialog = (title, content, submit) => {
|
||||
dismissMenus();dialog?.close();
|
||||
const previous=document.activeElement,el=document.createElement('dialog');dialog=el;el.className='city-organize-dialog';
|
||||
el.innerHTML=`<form><h2>${escape(title)}</h2>${content}<p class="muted">${escape(words.unchanged)}</p><p data-city-organize-error role="alert"></p><footer><button type="button" data-city-dialog-cancel>${escape(words.cancel)}</button><button type="submit">${escape(words.save)}</button></footer></form>`;
|
||||
document.body.append(el);let busy=false;
|
||||
el.addEventListener('close',()=>{el.remove();if(dialog===el)dialog=null;if(previous?.isConnected)previous.focus();});
|
||||
el.addEventListener('cancel',event=>{if(busy)event.preventDefault();});
|
||||
// Stop outer map-popup Escape handlers; native dialog cancellation still runs.
|
||||
el.addEventListener('keydown',event=>{if(event.key==='Escape')event.stopPropagation();});
|
||||
el.querySelector('[data-city-dialog-cancel]').addEventListener('click',()=>el.close());
|
||||
el.querySelector('form').addEventListener('submit',async event=>{
|
||||
event.preventDefault();if(busy)return;busy=true;
|
||||
const error=el.querySelector('[data-city-organize-error]'),buttons=el.querySelectorAll('button');
|
||||
buttons.forEach(b=>b.disabled=true);error.textContent=words.busy;
|
||||
try {await submit(new FormData(event.target));selection.clear();syncSelection();await reload();el.close();}
|
||||
catch(e){error.textContent=errorText(e);}
|
||||
finally{busy=false;buttons.forEach(b=>b.disabled=false);}
|
||||
});
|
||||
el.showModal();el.querySelector('input,select')?.focus();return el;
|
||||
};
|
||||
const rename = (type, item) => {
|
||||
const version=getCity().version;
|
||||
const el=openDialog(words.rename,`<label>${escape(words.title)}<input name="title" value="${escape(item.title||item.name)}" required maxlength="160"></label><p>${escape(words.renameHelp)}</p>`,data=>post(`/_/api/v1/city/${type==='Spot'?'spots':'zones'}/${encodeURIComponent(item.uuid)}/title`,{kind:type.toLowerCase(),title:data.get('title'),base_version:version}));
|
||||
el.querySelector('input').select();
|
||||
};
|
||||
const organize = action => {
|
||||
if(!selection.size)return;
|
||||
const entries=[...selection.values()],base_version=getCity().version;
|
||||
const request={action:action==='move'?'move':'merge',base_version,spots:entries.filter(p=>!p.page_uuid).map(p=>p.spot_uuid),pages:entries.filter(p=>p.page_uuid).map(({spot_uuid,page_uuid})=>({spot_uuid,page_uuid}))};
|
||||
if(action==='move'&&request.pages.length)return;
|
||||
const options=streets(),firstSource=spots().find(p=>p.uuid===entries[0].spot_uuid);
|
||||
const defaultStreet=firstSource?.street.uuid||options[0]?.uuid;
|
||||
const name=`spot-${crypto.randomUUID().slice(0,8)}`;
|
||||
const choices=spots().filter(p=>!entries.some(e=>e.spot_uuid===p.uuid)&&!p.name.endsWith('-undefined')&&!p.path_prefix.endsWith('/_undefined'));
|
||||
let fields=`<ul class="city-selection-summary">${entries.map(e=>`<li>${escape(e.title)}</li>`).join('')}</ul><p>${escape(action==='move'?words.moveHelp:words.mergeHelp)}</p>`;
|
||||
if(action==='merge')fields+=`<label>${escape(words.target)}<select name="target" required>${choices.map(p=>`<option value="${p.uuid}">${escape(p.quartier.title)} / ${escape(p.street.title)} / ${escape(p.title)}</option>`).join('')}</select></label>${choices.length?'':`<p>${escape(words.empty)}</p>`}`;
|
||||
else {
|
||||
fields+=`<label>${escape(words.street)}<select name="street" required>${options.map(s=>`<option value="${s.uuid}" ${s.uuid===defaultStreet?'selected':''}>${escape(s.quartier.title)} / ${escape(s.title)}</option>`).join('')}</select></label>`;
|
||||
if(action==='create')fields+=`<label>${escape(words.title)}<input name="title" required maxlength="160"></label><details><summary>${escape(words.advanced)}</summary><label>${escape(words.name)}<input name="name" value="${name}" required pattern="[a-z0-9][a-z0-9_-]{1,63}"></label></details>`;
|
||||
if(action==='create'||entries.length===1)fields+=`<label>${escape(words.path)}<input name="path" required></label>`;
|
||||
}
|
||||
const el=openDialog(words[action],fields,data=>{
|
||||
if(action==='merge')request.target_spot_uuid=data.get('target');
|
||||
else if(action==='create')request.new_spot={street_uuid:data.get('street'),name:data.get('name'),title:data.get('title'),path_prefix:data.get('path')};
|
||||
else {request.street_uuid=data.get('street');request.path_prefix=data.get('path')||'';}
|
||||
return post('/_/api/v1/city/organize',request);
|
||||
});
|
||||
if(action!=='merge'){
|
||||
const form=el.querySelector('form');
|
||||
const updatePath=()=>{const street=options.find(s=>s.uuid===form.elements.street.value),leaf=action==='create'?form.elements.name.value:firstSource.path_prefix.split('/').pop();if(form.elements.path)form.elements.path.value=street.path_prefix.replace(/\/$/,'')+'/'+leaf;};
|
||||
form.elements.street.addEventListener('change',updatePath);form.elements.name?.addEventListener('input',updatePath);updatePath();
|
||||
}
|
||||
};
|
||||
return {
|
||||
syncSelection,
|
||||
refresh(){const current=spots();for(const [key,item] of selection)if(!current.some(s=>s.uuid===item.spot_uuid&&(!item.page_uuid||s.pages.some(p=>p.page_uuid===item.page_uuid))))selection.delete(key);syncSelection();},
|
||||
decorateInspector(container,type,item){
|
||||
const heading=container.querySelector('h2');if(heading)button(heading,words.rename,'✎',()=>rename(type,item),'data-city-rename');
|
||||
if(heading&&type==='Spot')button(heading,words.move,'⇄',()=>{selection.clear();add({key:`spot:${item.uuid}`,spot_uuid:item.uuid,title:item.title||item.name});syncSelection();organize('move');},'data-city-move-selection');
|
||||
},
|
||||
context(menu,type,item,event){
|
||||
const hit=pick(event.target);
|
||||
if(!hit?.page_uuid)button(menu,words.rename,words.rename,()=>rename(type,item),'data-city-rename');
|
||||
if(type==='Spot'){
|
||||
if(hit&&!selection.has(hit.key)){selection.clear();add(hit);syncSelection();}
|
||||
if(hit?.page_uuid){menu.querySelector('strong').textContent=hit.title;menu.querySelector('[data-delete-city]')?.remove();}
|
||||
button(menu,words.merge,words.merge,()=>organize('merge'),'data-city-merge');
|
||||
button(menu,words.create,words.create,()=>organize('create'),'data-city-create-selection');
|
||||
if(![...selection.values()].some(p=>p.page_uuid))button(menu,words.move,words.move,()=>organize('move'),'data-city-move-selection');
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,407 @@
|
||||
/* Shared configuration navigation and bounded live resource charts. */
|
||||
async function configJSON(url, options = {}) {
|
||||
const response = await fetch(url, {cache: "no-store", ...options});
|
||||
const text = await response.text();
|
||||
let data;
|
||||
try { data = JSON.parse(text); } catch (_) {
|
||||
throw new Error(response.ok ? configMessages.requestFailed : text.trim() || response.statusText);
|
||||
}
|
||||
if (!response.ok) throw new Error(data.error || response.statusText);
|
||||
return data;
|
||||
}
|
||||
|
||||
async function configAction(button, resultID, work) {
|
||||
if (button) button.disabled = true;
|
||||
const result = document.getElementById(resultID);
|
||||
if (result) result.textContent = "";
|
||||
try { await work(); if (result) result.textContent = "✓"; }
|
||||
catch (error) { if (result) result.textContent = error.message; else alert(error.message); }
|
||||
finally { if (button) button.disabled = false; }
|
||||
}
|
||||
|
||||
let activeConfigPanel = "";
|
||||
let configPanelController = null;
|
||||
function setupConfigDialogs() {
|
||||
for (const button of document.querySelectorAll('[data-config-open]')) {
|
||||
const dialog = document.getElementById(button.dataset.configOpen);
|
||||
if (!dialog || button.dataset.configReady) continue;
|
||||
button.dataset.configReady = '1';
|
||||
button.addEventListener('click', () => dialog.showModal());
|
||||
for (const close of dialog.querySelectorAll('[data-config-close]')) close.addEventListener('click', () => dialog.close());
|
||||
dialog.addEventListener('click', event => { if (event.target === dialog) dialog.close(); });
|
||||
}
|
||||
const promote = (form, title) => {
|
||||
if (!form || form.dataset.dialogReady) return;
|
||||
form.dataset.dialogReady = '1';
|
||||
const anchor = form.parentElement;
|
||||
const dialog = document.createElement('dialog');
|
||||
dialog.className = 'config-form-dialog';
|
||||
const header = document.createElement('header');
|
||||
const heading = document.createElement('h2'); heading.textContent = title;
|
||||
const close = document.createElement('button'); close.type='button'; close.textContent='×'; close.setAttribute('aria-label', configMessages.close || 'Close');
|
||||
header.append(heading, close); dialog.append(header, form); document.body.append(dialog);
|
||||
const trigger = document.createElement('button'); trigger.type='button'; trigger.className='config-icon-button'; trigger.textContent='⚙'; trigger.title=title; trigger.setAttribute('aria-label', title);
|
||||
anchor?.insertBefore(trigger, anchor.firstChild); trigger.addEventListener('click',()=>dialog.showModal()); close.addEventListener('click',()=>dialog.close());
|
||||
};
|
||||
promote(document.getElementById('asset-form'), document.querySelector('#panel-assets h1')?.textContent || 'Assets');
|
||||
for (const form of document.querySelectorAll('#panel-auth-providers > form, #panel-auth > form')) promote(form, form.querySelector('input[name=action]')?.value || 'Account settings');
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', setupConfigDialogs);
|
||||
function toggleSidebar() {
|
||||
const sidebar = document.getElementById("config-sidebar");
|
||||
const closed = sidebar.classList.toggle("collapsed");
|
||||
sidebar.closest(".config-layout").classList.toggle("sidebar-collapsed", closed);
|
||||
sidebar.querySelector(".sidebar-toggle").setAttribute("aria-expanded", String(!closed));
|
||||
}
|
||||
function showConfigPanel(name, updateURL = true) {
|
||||
if (name === "nav") name = "nav-home";
|
||||
if (name === "resources") name = "scheduler";
|
||||
const target = document.getElementById("panel-" + name);
|
||||
if (!target?.classList.contains("config-panel")) return showConfigPanel("home", updateURL);
|
||||
configPanelController?.abort();
|
||||
configPanelController = new AbortController();
|
||||
activeConfigPanel = name;
|
||||
if (name !== 'scheduler') document.getElementById('monitor-settings-dialog')?.close();
|
||||
for (const panel of document.querySelectorAll(".config-panel")) panel.classList.toggle("active", panel === target);
|
||||
for (const group of document.querySelectorAll(".config-nav-group")) group.open = false;
|
||||
for (const link of document.querySelectorAll(".sidebar-nav a[data-panel]")) {
|
||||
const active = link.dataset.panel === name;
|
||||
link.classList.toggle("active", active);
|
||||
if (active) { link.setAttribute("aria-current", "page"); link.closest("details").open = true; }
|
||||
else link.removeAttribute("aria-current");
|
||||
}
|
||||
if (updateURL) {
|
||||
const url = new URL(location.href);
|
||||
url.searchParams.set("panel", name);
|
||||
history.replaceState(null, "", url);
|
||||
}
|
||||
configResources.activate(name === "scheduler");
|
||||
if (["events", "queue", "logs"].includes(name)) loadSchedulerPanel(name, configPanelController.signal);
|
||||
if (name === "adapters" || name === "adapters-builtin") loadAdapterPanel();
|
||||
if (name === "assets") loadAssetPanel();
|
||||
}
|
||||
|
||||
function resourceIORates(before, after) {
|
||||
const unavailable = {read:NaN, write:NaN};
|
||||
if (!before?.io?.available || !after?.io?.available || !after.io.process_id || before.io.process_id !== after.io.process_id) return unavailable;
|
||||
const seconds = (after.time - before.time) / 1000;
|
||||
const counters = [before.io.read_bytes, before.io.write_bytes, after.io.read_bytes, after.io.write_bytes];
|
||||
if (!(seconds > 0) || !counters.every(n => Number.isSafeInteger(n) && n >= 0)) return unavailable;
|
||||
const read = after.io.read_bytes - before.io.read_bytes, write = after.io.write_bytes - before.io.write_bytes;
|
||||
if (read < 0 || write < 0) return unavailable;
|
||||
return {read:read/seconds, write:write/seconds};
|
||||
}
|
||||
|
||||
const monitorPreferences = (() => {
|
||||
const key = 'pageswiki.monitor.display.v1';
|
||||
const fields = ['resource-history-hours','resource-stat-interval','resource-graph-interval','resource-live'];
|
||||
return {
|
||||
restore() {
|
||||
try {
|
||||
const saved = JSON.parse(localStorage.getItem(key) || '{}');
|
||||
for (const id of fields) {
|
||||
const input = document.getElementById(id), value = saved[id];
|
||||
if (id === 'resource-live' && typeof value === 'boolean') input.checked = value;
|
||||
else if (id === 'resource-history-hours' && ['1','24','168'].includes(value)) input.value = value;
|
||||
else if (id.includes('-interval') && Number.isInteger(value) && value >= 1 && value <= 60) input.value = String(value);
|
||||
}
|
||||
const stat = document.getElementById('resource-stat-interval'), graph = document.getElementById('resource-graph-interval');
|
||||
graph.value = String(Math.max(Number(stat.value), Number(graph.value)));
|
||||
} catch (_) { /* Storage can be disabled or hold an older format. */ }
|
||||
},
|
||||
save() {
|
||||
try { localStorage.setItem(key, JSON.stringify(Object.fromEntries(fields.map(id => {
|
||||
const input = document.getElementById(id);
|
||||
return [id, input.type === 'checkbox' ? input.checked : input.type === 'number' ? Number(input.value) : input.value];
|
||||
})))); } catch (_) { /* Monitoring still works without storage. */ }
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
const configResources = (() => {
|
||||
const samples = [];
|
||||
const historySamples = [], liveSamples = [];
|
||||
let active = false, timer = null, controller = null, generation = 0;
|
||||
let historyAt = 0, graphAt = 0, historyHours = '', monitorLoaded = false, previousLive = null;
|
||||
const seconds = (id, fallback) => {
|
||||
const input = document.getElementById(id);
|
||||
return input?.checkValidity() && input.value !== '' ? Number(input.value) : fallback;
|
||||
};
|
||||
const statDelay = () => seconds('resource-stat-interval', 1) * 1000;
|
||||
const graphDelay = () => Math.max(statDelay(), seconds('resource-graph-interval', 5) * 1000);
|
||||
const point = item => ({
|
||||
time:item.timestamp_ms, io:item.io, cpu:parseFloat(item.cpu.load_average), memory:item.memory.heap_bytes,
|
||||
storage:item.storage.total_bytes ? item.storage.used_bytes / item.storage.total_bytes * 100 : NaN,
|
||||
queue:Number(item.queue.stats?.queued || 0) + Number(item.queue.active_workers || 0)
|
||||
});
|
||||
function renderGraphs(current, hours) {
|
||||
liveSamples.push(point(current));
|
||||
if (liveSamples.length > 361) liveSamples.splice(0, liveSamples.length - 361);
|
||||
const cutoff = current.timestamp_ms - Number(hours) * 3600000;
|
||||
const byTime = new Map([...historySamples, ...liveSamples].filter(item => item.time >= cutoff && item.time <= current.timestamp_ms).map(item => [item.time,item]));
|
||||
const combined = [...byTime.values()].sort((a,b) => a.time - b.time);
|
||||
for (let i=0;i<combined.length;i++) Object.assign(combined[i], resourceIORates(combined[i-1], combined[i]));
|
||||
// Keep the last value per time bucket, including the fresh live tail.
|
||||
// At most 361 SVG points even after this page has been open for days.
|
||||
const first = combined[0]?.time || current.timestamp_ms;
|
||||
const bucket = Math.max(1, (current.timestamp_ms - first) / 360);
|
||||
const buckets = new Map();
|
||||
for (const item of combined) buckets.set(Math.floor((item.time - first) / bucket), item);
|
||||
samples.splice(0, samples.length, ...buckets.values());
|
||||
for (const key of ['cpu','memory','io','queue']) plot(key);
|
||||
document.getElementById('resource-time-range').textContent = samples.length ?
|
||||
new Date(samples[0].time).toLocaleString() + ' — ' + new Date(samples.at(-1).time).toLocaleString() : '—';
|
||||
}
|
||||
const ns = "http://www.w3.org/2000/svg";
|
||||
const node = (tag, attrs, text) => {
|
||||
const result = document.createElementNS(ns, tag);
|
||||
for (const [key,value] of Object.entries(attrs)) result.setAttribute(key, value);
|
||||
if (text !== undefined) result.textContent = text;
|
||||
return result;
|
||||
};
|
||||
function plot(key) {
|
||||
const svg = document.querySelector('[data-resource-chart="' + key + '"]');
|
||||
const series = key === 'io' ? ['read','write'] : [key];
|
||||
const values = samples.flatMap(sample => series.map(name => sample[name])).filter(Number.isFinite);
|
||||
if (!svg) return;
|
||||
if (!values.length) {svg.replaceChildren();return;}
|
||||
const high = Math.max(1, ...values) * 1.1;
|
||||
const first = samples[0].time, last = samples[samples.length - 1].time;
|
||||
const label = key === 'io' ? formatSchedulerBytes(high) + '/s' : key === "memory" ? formatSchedulerBytes(high) : high.toFixed(key === "cpu" ? 1 : 0);
|
||||
svg.replaceChildren(
|
||||
node("line", {x1:48,y1:112,x2:392,y2:112,class:"chart-axis"}),
|
||||
node("text", {x:1,y:15}, label), node("text", {x:20,y:114}, "0")
|
||||
);
|
||||
for (const name of series) {
|
||||
const className = 'chart-line' + (key === 'io' ? ' io-' + name : '');
|
||||
let points = [];
|
||||
const flush = () => {
|
||||
if (!points.length) return;
|
||||
svg.append(node('polyline', {points:points.map(p=>p.join(',')).join(' '),class:className}));
|
||||
const end=points.at(-1);svg.append(node('circle',{cx:end[0],cy:end[1],r:2,fill:'currentColor',class:key==='io'?'io-'+name:''}));
|
||||
points=[];
|
||||
};
|
||||
for (const sample of samples) {
|
||||
if (!Number.isFinite(sample[name])) { flush(); continue; }
|
||||
points.push([48+(sample.time-first)/Math.max(1,last-first)*344,112-sample[name]/high*98]);
|
||||
}
|
||||
flush();
|
||||
}
|
||||
}
|
||||
async function sample() {
|
||||
if (!active || document.hidden || controller) return;
|
||||
controller = new AbortController();
|
||||
const request = controller, version = generation;
|
||||
try {
|
||||
const hours = document.getElementById('resource-history-hours').value;
|
||||
const fetchHistory = hours !== historyHours || Date.now() - historyAt >= 30000;
|
||||
const [r, jobs, history, definitions] = await Promise.all([
|
||||
configJSON("/_/api/v1/queue/resources", {signal: request.signal}),
|
||||
configJSON("/_/api/v1/queue/jobs?status=running&limit=100", {signal: request.signal}),
|
||||
fetchHistory ? configJSON("/_/api/v1/queue/resources/history?hours=" + hours, {signal: request.signal}) : null,
|
||||
!monitorLoaded ? configJSON("/_/api/v1/event", {signal: request.signal}) : null
|
||||
]);
|
||||
if (!active || version !== generation || request.signal.aborted) return;
|
||||
const count = r.queue.stats || {};
|
||||
const current = point(r), io = resourceIORates(previousLive, current);
|
||||
previousLive = current;
|
||||
const rate = value => Number.isFinite(value) ? formatSchedulerBytes(value) + '/s' : '—';
|
||||
document.querySelector('[data-resource="io"]').textContent = configMessages.ioRead + ' ' + rate(io.read) + ' · ' + configMessages.ioWrite + ' ' + rate(io.write);
|
||||
const queued = Number(count.queued || 0), running = Number(count.running || 0);
|
||||
configJobs.renderRunning(jobs.jobs || []);
|
||||
if (history) {
|
||||
historyAt = Date.now(); historyHours = hours;
|
||||
historySamples.splice(0, historySamples.length, ...(history.samples || []).map(point));
|
||||
}
|
||||
if (history || Date.now() - graphAt >= graphDelay()) {
|
||||
graphAt = Date.now();
|
||||
renderGraphs(r, hours);
|
||||
}
|
||||
if (!samples.length) document.querySelectorAll('[data-resource-chart]').forEach(svg => svg.replaceChildren());
|
||||
const form = document.getElementById('resource-monitor-form');
|
||||
const monitor = definitions?.events.find(item => item.uuid === 'builtin.resource.sample');
|
||||
if (monitor && !form.dataset.dirty) {
|
||||
form.elements.enabled.checked = monitor.enabled;
|
||||
form.elements.interval.value = monitor.interval_seconds;
|
||||
}
|
||||
if (definitions) monitorLoaded = true;
|
||||
document.getElementById('scheduler-queue-state').textContent = r.queue.paused ? configMessages.paused : '';
|
||||
document.querySelector('[data-resource="cpu"]').textContent = (r.cpu.load_average || "—") + " / " + r.cpu.logical_cpus + " CPU";
|
||||
document.querySelector('[data-resource="memory"]').textContent = formatSchedulerBytes(r.memory.heap_bytes);
|
||||
document.querySelector('[data-resource="storage"]').textContent = formatSchedulerBytes(r.storage.used_bytes) + " / " + formatSchedulerBytes(r.storage.total_bytes);
|
||||
document.querySelector('[data-resource="queue"]').textContent = queued + " " + configMessages.queued + " · " + running + " " + configMessages.running;
|
||||
document.querySelector('[data-panel-error="resources"]').textContent = "";
|
||||
} catch (error) {
|
||||
if (error.name !== "AbortError") document.querySelector('[data-panel-error="resources"]').textContent = error.message;
|
||||
} finally {
|
||||
if (controller === request) controller = null;
|
||||
if (version === generation && active && !document.hidden && document.getElementById("resource-live").checked) timer = setTimeout(sample, statDelay());
|
||||
}
|
||||
}
|
||||
function activate(value) {
|
||||
active = value;
|
||||
generation++;
|
||||
clearTimeout(timer); timer = null;
|
||||
controller?.abort();
|
||||
controller = null;
|
||||
previousLive = null;
|
||||
if (value && !document.hidden) timer = setTimeout(sample, 0);
|
||||
}
|
||||
return {activate, refresh() { historyAt = 0; graphAt = 0; monitorLoaded = false; activate(activeConfigPanel === 'scheduler'); }};
|
||||
})();
|
||||
|
||||
// Job history is paged, not accumulated in the DOM. Log pages are fetched only
|
||||
// when expanded; all requests are aborted when leaving the panel.
|
||||
const configJobs = (() => {
|
||||
let historyVersion = 0;
|
||||
const esc = value => schedulerEscape(value);
|
||||
function row(job) {
|
||||
const duration = job.started_at_ms ? Math.max(0, ((job.finished_at_ms || Date.now()) - job.started_at_ms) / 1000).toFixed(1) + ' s' : '—';
|
||||
const action = ['failed','cancelled','skipped'].includes(job.status) ? 'retry' : ['running','queued'].includes(job.status) ? 'cancel' : '';
|
||||
const label = job.cancel_requested && job.status === 'running' ? configMessages.cancelRequested : configMessages[job.status] || job.status;
|
||||
return '<tr data-job-row="' + esc(job.uuid) + '"><td><span class="mono">' + esc(job.event_type) + '</span> <small class="cell-clip" title="' + esc(job.event_key) + '">' + esc(job.event_key) +
|
||||
'</small></td><td>' + esc(label) + (job.error ? ' <small class="cell-clip" title="' + esc(job.error) + '">' + esc(job.error) + '</small>' : '') + '</td><td>' + job.attempts + ' / ' + job.max_attempts + '</td><td>' +
|
||||
esc(new Date(job.started_at_ms || job.created_at_ms).toLocaleString()) + '</td><td>' + duration + '</td><td>' +
|
||||
(action ? '<button type="button" data-queue-action="' + action + '" data-job="' + esc(job.uuid) + '"' + (action === 'cancel' && job.cancel_requested ? ' disabled' : '') + '>' + esc(configMessages[action]) + '</button> ' : '') +
|
||||
'<button type="button" data-job-logs="' + esc(job.uuid) + '" aria-expanded="false">' + esc(configMessages.logs) + '</button></td></tr>';
|
||||
}
|
||||
function renderRunning(jobs) {
|
||||
const body = document.querySelector('#scheduler-jobs tbody');
|
||||
// Preserve expanded logs and keyboard focus while refreshing job values.
|
||||
const present = new Set(jobs.map(job => job.uuid));
|
||||
for (const old of body.querySelectorAll('[data-job-row]')) {
|
||||
if (!present.has(old.dataset.jobRow)) { if (old.nextElementSibling?.classList.contains('job-log-detail')) old.nextElementSibling.remove(); old.remove(); }
|
||||
}
|
||||
body.querySelector('[data-empty]')?.remove();
|
||||
for (const job of jobs) {
|
||||
const old = [...body.querySelectorAll('[data-job-row]')].find(node => node.dataset.jobRow === job.uuid);
|
||||
if (!old) body.insertAdjacentHTML('beforeend', row(job));
|
||||
else {
|
||||
const fresh = document.createElement('tbody'); fresh.innerHTML = row(job);
|
||||
for (let i = 0; i < 5; i++) old.cells[i].innerHTML = fresh.rows[0].cells[i].innerHTML;
|
||||
const cancel = old.querySelector('[data-queue-action="cancel"]');
|
||||
if (cancel) cancel.disabled = job.cancel_requested;
|
||||
}
|
||||
}
|
||||
if (!jobs.length) body.innerHTML = '<tr data-empty><td colspan="6">' + esc(configMessages.emptyRunning) + '</td></tr>';
|
||||
}
|
||||
async function loadHistory(cursor = '', signal = configPanelController?.signal) {
|
||||
const version = ++historyVersion;
|
||||
const params = new URLSearchParams({status:document.getElementById('job-history-status').value,limit:'50',cursor});
|
||||
const data = await configJSON('/_/api/v1/queue/jobs?' + params, {signal});
|
||||
if (version !== historyVersion || signal?.aborted || activeConfigPanel !== 'logs') return;
|
||||
document.querySelector('#job-history tbody').innerHTML = (data.jobs || []).map(row).join('') || '<tr><td colspan="6">—</td></tr>';
|
||||
const more = document.getElementById('job-history-more');
|
||||
more.hidden = !data.next_cursor; more.dataset.cursor = data.next_cursor || '';
|
||||
}
|
||||
async function loadLogs(button, older = false) {
|
||||
const row = button.closest('tr');
|
||||
let detail = older ? row : row.nextElementSibling;
|
||||
const job = older ? detail.dataset.job : button.dataset.jobLogs;
|
||||
if (!older && detail?.classList.contains('job-log-detail')) {
|
||||
detail.remove(); button.setAttribute('aria-expanded', 'false'); return;
|
||||
}
|
||||
if (!older) {
|
||||
row.insertAdjacentHTML('afterend', '<tr class="job-log-detail"><td colspan="6"><small></small><pre></pre><button type="button" data-older-logs hidden></button></td></tr>');
|
||||
detail = row.nextElementSibling; detail.dataset.job = job;
|
||||
detail.querySelector('small').textContent = job;
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
const pre = detail.querySelector('pre'), more = detail.querySelector('button');
|
||||
pre.textContent = configMessages.loading; more.disabled = true;
|
||||
try {
|
||||
const params = new URLSearchParams({job_uuid:job,limit:'100'});
|
||||
if (older && more.dataset.before) params.set('before_id',more.dataset.before);
|
||||
const data = await configJSON('/_/api/v1/event/logs?' + params, {signal:configPanelController?.signal});
|
||||
if (!detail.isConnected) return;
|
||||
pre.textContent = data.logs.map(log => new Date(log.created_at_ms).toLocaleString() + ' [' + log.level + '] ' + log.message).join('\n') || '—';
|
||||
more.hidden = data.logs.length < 100;
|
||||
more.dataset.before = data.logs.at(-1)?.id || '';
|
||||
more.textContent = configMessages.olderLogs;
|
||||
} catch (error) {
|
||||
if (error.name === 'AbortError') {
|
||||
const toggle = detail.previousElementSibling?.querySelector('[data-job-logs]');
|
||||
toggle?.setAttribute('aria-expanded', 'false'); detail.remove();
|
||||
} else { pre.textContent = error.message; more.hidden = false; more.textContent = configMessages.retry; }
|
||||
}
|
||||
finally { more.disabled = false; }
|
||||
}
|
||||
document.addEventListener('click', event => {
|
||||
const logs = event.target.closest('[data-job-logs], [data-older-logs]');
|
||||
if (logs) loadLogs(logs, logs.hasAttribute('data-older-logs'));
|
||||
const action = event.target.closest('[data-queue-action]');
|
||||
if (action) configAction(action, '', async () => {
|
||||
await configJSON('/_/api/v1/queue/' + action.dataset.queueAction, {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({uuid:action.dataset.job})});
|
||||
if (activeConfigPanel === 'logs') await loadHistory();
|
||||
else configResources.activate(activeConfigPanel === 'scheduler');
|
||||
});
|
||||
});
|
||||
return {loadHistory, renderRunning};
|
||||
})();
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
monitorPreferences.restore();
|
||||
const monitorDialog = document.getElementById('monitor-settings-dialog');
|
||||
const monitorOpen = document.getElementById('monitor-settings-open');
|
||||
monitorOpen.addEventListener('click', () => {
|
||||
monitorDialog.showModal(); monitorOpen.setAttribute('aria-expanded', 'true');
|
||||
});
|
||||
document.getElementById('monitor-settings-close').addEventListener('click', () => monitorDialog.close());
|
||||
monitorDialog.addEventListener('click', event => {
|
||||
if (event.target !== monitorDialog) return;
|
||||
const bounds = monitorDialog.getBoundingClientRect();
|
||||
if (event.clientX < bounds.left || event.clientX > bounds.right || event.clientY < bounds.top || event.clientY > bounds.bottom) monitorDialog.close();
|
||||
});
|
||||
monitorDialog.addEventListener('close', () => {
|
||||
monitorOpen.setAttribute('aria-expanded', 'false');
|
||||
if (activeConfigPanel === 'scheduler') monitorOpen.focus();
|
||||
});
|
||||
document.querySelector(".sidebar-nav").addEventListener("click", event => {
|
||||
const link = event.target.closest("a[data-panel]");
|
||||
if (!link || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
||||
event.preventDefault(); showConfigPanel(link.dataset.panel);
|
||||
});
|
||||
document.addEventListener("click", event => {
|
||||
const link = event.target.closest("[data-config-panel]");
|
||||
if (!link || event.ctrlKey || event.metaKey) return;
|
||||
event.preventDefault(); showConfigPanel(link.dataset.configPanel);
|
||||
});
|
||||
document.getElementById("resource-live").addEventListener("change", () => { monitorPreferences.save(); configResources.activate(activeConfigPanel === "scheduler"); });
|
||||
const statInterval = document.getElementById('resource-stat-interval');
|
||||
const graphInterval = document.getElementById('resource-graph-interval');
|
||||
const updateIntervals = () => {
|
||||
if (!statInterval.checkValidity() || !graphInterval.checkValidity() || !statInterval.value || !graphInterval.value) return;
|
||||
if (Number(graphInterval.value) < Number(statInterval.value)) graphInterval.value = statInterval.value;
|
||||
monitorPreferences.save();
|
||||
configResources.refresh();
|
||||
};
|
||||
statInterval.addEventListener('change', updateIntervals);
|
||||
graphInterval.addEventListener('change', updateIntervals);
|
||||
document.getElementById('resource-history-hours').addEventListener('change', () => { monitorPreferences.save(); configResources.refresh(); });
|
||||
document.getElementById('monitor-refresh').addEventListener('click', () => configResources.refresh());
|
||||
document.getElementById('job-history-status').addEventListener('change', () => loadSchedulerPanel('logs', configPanelController?.signal));
|
||||
document.getElementById('job-history-refresh').addEventListener('click', () => loadSchedulerPanel('logs', configPanelController?.signal));
|
||||
document.getElementById('job-history-more').addEventListener('click', event => configAction(event.currentTarget, '', () => configJobs.loadHistory(event.currentTarget.dataset.cursor)));
|
||||
const monitorForm = document.getElementById('resource-monitor-form');
|
||||
monitorForm.addEventListener('input', () => monitorForm.dataset.dirty = 'true');
|
||||
monitorForm.addEventListener('submit', event => {
|
||||
event.preventDefault();
|
||||
configAction(event.submitter, 'resource-monitor-result', async () => {
|
||||
await configJSON('/_/api/v1/event', {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({
|
||||
uuid:'builtin.resource.sample',name:'Resource monitoring',event_type:'resource.sample',event_key:'local',payload:'{}',
|
||||
schedule_kind:'interval',interval_seconds:Number(monitorForm.elements.interval.value),enabled:monitorForm.elements.enabled.checked,priority:100,max_attempts:1
|
||||
})});
|
||||
delete monitorForm.dataset.dirty;
|
||||
});
|
||||
});
|
||||
document.getElementById('resource-monitor-run').addEventListener('click', event => configAction(event.currentTarget,'resource-monitor-result',async () => {
|
||||
await configJSON('/_/api/v1/event/run',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({uuid:'builtin.resource.sample'})});
|
||||
}));
|
||||
document.addEventListener("visibilitychange", () => configResources.activate(activeConfigPanel === "scheduler"));
|
||||
const schedule = document.querySelector('#event-definition-form [name="schedule_kind"]');
|
||||
const updateSchedule = () => {
|
||||
for (const field of document.querySelectorAll("[data-schedule-field]")) field.hidden = field.dataset.scheduleField !== schedule.value;
|
||||
};
|
||||
schedule.addEventListener("change", updateSchedule); updateSchedule();
|
||||
showConfigPanel(new URLSearchParams(location.search).get("panel") || "home");
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
+101
-296
@@ -29,24 +29,28 @@ window.PagesEditor = {
|
||||
|
||||
const renderPreview =
|
||||
async () => {
|
||||
this.previewController?.abort()
|
||||
const controller = new AbortController()
|
||||
this.previewController = controller
|
||||
const sequence = (this.previewSequence || 0) + 1
|
||||
this.previewSequence = sequence
|
||||
const source = editor.value
|
||||
|
||||
if (
|
||||
editType.value
|
||||
===
|
||||
"html"
|
||||
) {
|
||||
|
||||
preview.innerHTML =
|
||||
if (editType.value === "code") {
|
||||
preview.classList.add("code-preview")
|
||||
preview.textContent =
|
||||
editor.value
|
||||
|
||||
return editor.value
|
||||
}
|
||||
|
||||
try {
|
||||
const res =
|
||||
await fetch(
|
||||
"/_/api/v1/render/markdown",
|
||||
{
|
||||
method: "POST",
|
||||
signal: controller.signal,
|
||||
|
||||
headers: {
|
||||
"Content-Type":
|
||||
@@ -54,34 +58,66 @@ window.PagesEditor = {
|
||||
},
|
||||
|
||||
body: JSON.stringify({
|
||||
markdown:
|
||||
editor.value,
|
||||
...(editType.value === "html" ? {html: source} : {markdown: source}),
|
||||
path: window.PagesWikiCurrentPath || location.pathname,
|
||||
projection: true,
|
||||
}),
|
||||
},
|
||||
)
|
||||
|
||||
if (controller.signal.aborted || sequence !== this.previewSequence) return
|
||||
if (!res.ok) {
|
||||
preview.classList.add("code-preview")
|
||||
|
||||
preview.innerText =
|
||||
editor.value
|
||||
source
|
||||
|
||||
return editor.value
|
||||
}
|
||||
|
||||
const data =
|
||||
await res.json()
|
||||
if (controller.signal.aborted || sequence !== this.previewSequence) return
|
||||
|
||||
preview.classList.remove("code-preview")
|
||||
preview.innerHTML =
|
||||
data.html
|
||||
|
||||
if (window.PagesWikiLoadChildren) {
|
||||
window.PagesWikiLoadChildren(preview)
|
||||
}
|
||||
|
||||
return data.html
|
||||
} catch (error) {
|
||||
if (controller.signal.aborted || sequence !== this.previewSequence) return
|
||||
preview.classList.add("code-preview")
|
||||
preview.textContent = source
|
||||
return source
|
||||
}
|
||||
}
|
||||
|
||||
this.renderPreview =
|
||||
renderPreview
|
||||
|
||||
document.querySelectorAll('[data-editor-action]').forEach(button => button.addEventListener('click', event => {
|
||||
event.preventDefault()
|
||||
switch (button.dataset.editorAction) {
|
||||
case 'save': this.saveNow(); break
|
||||
case 'rename': window.PagesPathActions.renameCurrentPath(); break
|
||||
case 'delete': window.PagesPathActions.removeCurrentPath(); break
|
||||
case 'html': window.switchEditorFormat('html'); break
|
||||
case 'markdown': window.switchEditorFormat('markdown'); break
|
||||
case 'preview': window.toggleEditorPreview(); break
|
||||
}
|
||||
}))
|
||||
|
||||
editor.addEventListener(
|
||||
"input",
|
||||
async () => {
|
||||
|
||||
await renderPreview()
|
||||
clearTimeout(this.previewTimer)
|
||||
this.previewController?.abort()
|
||||
this.previewTimer = setTimeout(renderPreview, 150)
|
||||
|
||||
clearTimeout(
|
||||
this.autosaveTimer,
|
||||
@@ -138,6 +174,10 @@ window.PagesEditor = {
|
||||
return editor.value
|
||||
}
|
||||
|
||||
if (editType.value === "code") {
|
||||
return editor.value
|
||||
}
|
||||
|
||||
const res =
|
||||
await fetch(
|
||||
"/_/api/v1/render/markdown",
|
||||
@@ -184,6 +224,15 @@ window.PagesEditor = {
|
||||
const canonicalHTML =
|
||||
await this.getCanonicalHTML()
|
||||
|
||||
const pageLanguage =
|
||||
document.getElementById(
|
||||
"page-language",
|
||||
)
|
||||
const pageContentType =
|
||||
document.getElementById("page-content-type")
|
||||
const pageFilename =
|
||||
document.getElementById("page-filename")
|
||||
|
||||
await fetch(
|
||||
"/_/api/v1/revisions/save",
|
||||
{
|
||||
@@ -203,6 +252,21 @@ window.PagesEditor = {
|
||||
|
||||
message:
|
||||
"autosave",
|
||||
|
||||
lang:
|
||||
pageLanguage
|
||||
? pageLanguage.value
|
||||
: "und",
|
||||
|
||||
content_type:
|
||||
pageContentType
|
||||
? pageContentType.value
|
||||
: "",
|
||||
|
||||
filename:
|
||||
pageFilename
|
||||
? pageFilename.value
|
||||
: "",
|
||||
}),
|
||||
},
|
||||
)
|
||||
@@ -226,6 +290,15 @@ window.PagesEditor = {
|
||||
const canonicalHTML =
|
||||
await this.getCanonicalHTML()
|
||||
|
||||
const pageLanguage =
|
||||
document.getElementById(
|
||||
"page-language",
|
||||
)
|
||||
const pageContentType =
|
||||
document.getElementById("page-content-type")
|
||||
const pageFilename =
|
||||
document.getElementById("page-filename")
|
||||
|
||||
const res =
|
||||
await fetch(
|
||||
"/_/api/v1/revisions/save",
|
||||
@@ -246,6 +319,21 @@ window.PagesEditor = {
|
||||
|
||||
message:
|
||||
"manual-save",
|
||||
|
||||
lang:
|
||||
pageLanguage
|
||||
? pageLanguage.value
|
||||
: "und",
|
||||
|
||||
content_type:
|
||||
pageContentType
|
||||
? pageContentType.value
|
||||
: "",
|
||||
|
||||
filename:
|
||||
pageFilename
|
||||
? pageFilename.value
|
||||
: "",
|
||||
}),
|
||||
},
|
||||
)
|
||||
@@ -314,288 +402,5 @@ document.addEventListener(
|
||||
},
|
||||
)
|
||||
|
||||
async function renderPagesWikiDiagramsInPreview(root) {
|
||||
|
||||
if (!root) {
|
||||
return
|
||||
}
|
||||
|
||||
const blocks =
|
||||
root.querySelectorAll(
|
||||
"pre code.language-mermaid, pre code.language-plantuml, pre code.language-graphviz, pre code.language-dot, pre code.language-d2"
|
||||
)
|
||||
|
||||
for (const code of blocks) {
|
||||
|
||||
const pre =
|
||||
code.closest("pre")
|
||||
|
||||
if (!pre) {
|
||||
continue
|
||||
}
|
||||
|
||||
let diagramType =
|
||||
Array.from(code.classList)
|
||||
.find(c => c.startsWith("language-"))
|
||||
?.replace("language-", "")
|
||||
|
||||
if (!diagramType) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (diagramType === "dot") {
|
||||
diagramType = "graphviz"
|
||||
}
|
||||
|
||||
const source =
|
||||
code.textContent || ""
|
||||
|
||||
const figure =
|
||||
document.createElement("figure")
|
||||
|
||||
figure.className =
|
||||
"diagram diagram-" + diagramType
|
||||
|
||||
figure.textContent =
|
||||
"Rendering " + diagramType + "..."
|
||||
|
||||
pre.replaceWith(figure)
|
||||
|
||||
try {
|
||||
|
||||
const res =
|
||||
await fetch(
|
||||
"/:/compile/diagram/" + encodeURIComponent(diagramType),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "text/plain; charset=utf-8",
|
||||
},
|
||||
body: source,
|
||||
},
|
||||
)
|
||||
|
||||
if (!res.ok) {
|
||||
figure.textContent =
|
||||
"Diagram render failed: " + res.status
|
||||
continue
|
||||
}
|
||||
|
||||
const svg =
|
||||
await res.text()
|
||||
|
||||
const blob =
|
||||
new Blob(
|
||||
[svg],
|
||||
{
|
||||
type: "image/svg+xml",
|
||||
},
|
||||
)
|
||||
|
||||
const url =
|
||||
URL.createObjectURL(blob)
|
||||
|
||||
const img =
|
||||
document.createElement("img")
|
||||
|
||||
img.src =
|
||||
url
|
||||
|
||||
img.alt =
|
||||
diagramType + " diagram"
|
||||
|
||||
img.onload =
|
||||
() => {
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
|
||||
figure.textContent =
|
||||
""
|
||||
|
||||
figure.appendChild(img)
|
||||
|
||||
} catch (err) {
|
||||
|
||||
figure.textContent =
|
||||
"Diagram render failed"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const PagesWikiOldRenderPreview =
|
||||
window.PagesEditor &&
|
||||
window.PagesEditor.renderPreview
|
||||
|
||||
if (PagesWikiOldRenderPreview) {
|
||||
|
||||
window.PagesEditor.renderPreview =
|
||||
async function() {
|
||||
|
||||
const ret =
|
||||
PagesWikiOldRenderPreview.apply(
|
||||
window.PagesEditor,
|
||||
arguments,
|
||||
)
|
||||
|
||||
await Promise.resolve(ret)
|
||||
|
||||
await renderPagesWikiDiagramsInPreview(
|
||||
document.getElementById("preview"),
|
||||
)
|
||||
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
async function renderPagesWikiDiagramsInPreview(root) {
|
||||
|
||||
if (!root) {
|
||||
return
|
||||
}
|
||||
|
||||
const blocks =
|
||||
root.querySelectorAll(
|
||||
"pre code.language-mermaid, pre code.language-plantuml, pre code.language-graphviz, pre code.language-dot, pre code.language-d2"
|
||||
)
|
||||
|
||||
for (const code of blocks) {
|
||||
|
||||
const pre =
|
||||
code.closest("pre")
|
||||
|
||||
if (!pre) {
|
||||
continue
|
||||
}
|
||||
|
||||
let diagramType =
|
||||
Array.from(code.classList)
|
||||
.find(c => c.startsWith("language-"))
|
||||
?.replace("language-", "")
|
||||
|
||||
if (!diagramType) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (diagramType === "dot") {
|
||||
diagramType = "graphviz"
|
||||
}
|
||||
|
||||
const source =
|
||||
code.textContent || ""
|
||||
|
||||
const figure =
|
||||
document.createElement("figure")
|
||||
|
||||
figure.className =
|
||||
"diagram diagram-" + diagramType
|
||||
|
||||
figure.textContent =
|
||||
"Rendering " + diagramType + "..."
|
||||
|
||||
pre.replaceWith(figure)
|
||||
|
||||
const res =
|
||||
await fetch(
|
||||
"/:/compile/diagram/" + encodeURIComponent(diagramType),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "text/plain; charset=utf-8",
|
||||
},
|
||||
body: source,
|
||||
},
|
||||
)
|
||||
|
||||
if (!res.ok) {
|
||||
figure.textContent =
|
||||
"Diagram render failed: " + res.status
|
||||
continue
|
||||
}
|
||||
|
||||
const svg =
|
||||
await res.text()
|
||||
|
||||
const blob =
|
||||
new Blob(
|
||||
[svg],
|
||||
{
|
||||
type: "image/svg+xml",
|
||||
},
|
||||
)
|
||||
|
||||
const url =
|
||||
URL.createObjectURL(blob)
|
||||
|
||||
const img =
|
||||
document.createElement("img")
|
||||
|
||||
img.src =
|
||||
url
|
||||
|
||||
img.alt =
|
||||
diagramType + " diagram"
|
||||
|
||||
img.onload =
|
||||
() => URL.revokeObjectURL(url)
|
||||
|
||||
figure.textContent =
|
||||
""
|
||||
|
||||
figure.appendChild(img)
|
||||
}
|
||||
}
|
||||
|
||||
function installPagesWikiDiagramPreviewHook() {
|
||||
|
||||
if (
|
||||
!window.PagesEditor ||
|
||||
!window.PagesEditor.renderPreview ||
|
||||
window.PagesEditorDiagramPreviewHookInstalled
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
window.PagesEditorDiagramPreviewHookInstalled = true
|
||||
|
||||
const original =
|
||||
window.PagesEditor.renderPreview
|
||||
|
||||
window.PagesEditor.renderPreview =
|
||||
async function() {
|
||||
|
||||
const ret =
|
||||
original.apply(
|
||||
window.PagesEditor,
|
||||
arguments,
|
||||
)
|
||||
|
||||
await Promise.resolve(ret)
|
||||
|
||||
await renderPagesWikiDiagramsInPreview(
|
||||
document.getElementById("preview"),
|
||||
)
|
||||
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"DOMContentLoaded",
|
||||
() => {
|
||||
installPagesWikiDiagramPreviewHook()
|
||||
|
||||
setTimeout(
|
||||
() => {
|
||||
installPagesWikiDiagramPreviewHook()
|
||||
|
||||
if (
|
||||
window.PagesEditor &&
|
||||
window.PagesEditor.renderPreview
|
||||
) {
|
||||
window.PagesEditor.renderPreview()
|
||||
}
|
||||
},
|
||||
100,
|
||||
)
|
||||
},
|
||||
)
|
||||
// HTML/Markdown previews and diagram projections are produced by the common
|
||||
// server boundary. Do not reinterpret authoring source in a second client pass.
|
||||
@@ -0,0 +1,70 @@
|
||||
(() => {
|
||||
const open = document.querySelector('[data-home-appearance-open]');
|
||||
const dialog = document.querySelector('[data-home-appearance-dialog]');
|
||||
const form = dialog?.querySelector('[data-home-appearance-form]');
|
||||
const input = form?.elements.home_glass_transparency;
|
||||
const output = form?.querySelector('output');
|
||||
const status = form?.querySelector('[data-home-appearance-status]');
|
||||
if (!open || !dialog || !form || !input || !output || !status) return;
|
||||
|
||||
let saved = Number(input.value);
|
||||
const preview = value => {
|
||||
const transparency = Math.max(0, Math.min(85, Number(value) || 0));
|
||||
document.body.style.setProperty('--home-glass-opacity', `${100 - transparency}%`);
|
||||
output.value = `${transparency}%`;
|
||||
output.textContent = `${transparency}%`;
|
||||
};
|
||||
const restore = () => {
|
||||
input.value = String(saved);
|
||||
preview(saved);
|
||||
status.textContent = '';
|
||||
};
|
||||
const close = () => {
|
||||
restore();
|
||||
dialog.close();
|
||||
};
|
||||
|
||||
input.addEventListener('input', () => preview(input.value));
|
||||
open.addEventListener('click', () => {
|
||||
restore();
|
||||
dialog.showModal();
|
||||
input.focus();
|
||||
});
|
||||
form.querySelector('[data-home-appearance-close]').addEventListener('click', close);
|
||||
form.querySelector('[data-home-appearance-cancel]').addEventListener('click', close);
|
||||
dialog.addEventListener('cancel', event => {
|
||||
event.preventDefault();
|
||||
close();
|
||||
});
|
||||
dialog.addEventListener('click', event => {
|
||||
if (event.target !== dialog) return;
|
||||
const rect = dialog.getBoundingClientRect();
|
||||
if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) close();
|
||||
});
|
||||
dialog.addEventListener('close', () => open.focus());
|
||||
form.addEventListener('submit', async event => {
|
||||
event.preventDefault();
|
||||
const submit = form.querySelector('[type=submit]');
|
||||
if (submit.disabled) return;
|
||||
submit.disabled = true;
|
||||
status.textContent = '';
|
||||
try {
|
||||
const response = await fetch(form.action, {
|
||||
method: 'POST',
|
||||
body: new URLSearchParams(new FormData(form)),
|
||||
headers: {Accept: 'application/json'},
|
||||
signal: AbortSignal.timeout(15000),
|
||||
});
|
||||
if (!response.ok) throw new Error((await response.text()).trim());
|
||||
await response.json();
|
||||
saved = Number(input.value);
|
||||
preview(saved);
|
||||
status.textContent = form.dataset.saved;
|
||||
window.setTimeout(() => dialog.open && dialog.close(), 350);
|
||||
} catch (error) {
|
||||
status.textContent = error.message;
|
||||
} finally {
|
||||
submit.disabled = false;
|
||||
}
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,102 @@
|
||||
(() => {
|
||||
const pager = document.querySelector('[data-home-pager]');
|
||||
if (!pager) return;
|
||||
const search = pager.querySelector('[data-home-pager-page="search"]');
|
||||
const bookmarks = pager.querySelector('[data-home-pager-page="bookmarks"]');
|
||||
const indicator = document.querySelector('[data-home-page-indicator]');
|
||||
const buttons = document.querySelectorAll('[data-home-page-target]');
|
||||
const reduced = matchMedia('(prefers-reduced-motion: reduce)');
|
||||
let page = 0;
|
||||
let startY = 0;
|
||||
let lastY = 0;
|
||||
let startedAt = 0;
|
||||
let pointer = null;
|
||||
let wheel = 0;
|
||||
let wheelTimer = 0;
|
||||
|
||||
const modalOpen = () => Boolean(document.querySelector('dialog[open]'));
|
||||
const interactive = target => Boolean(target.closest('a,button,input,select,textarea,summary,[contenteditable="true"],dialog'));
|
||||
const sync = (focus = false) => {
|
||||
const name = page ? 'bookmarks' : 'search';
|
||||
pager.dataset.homePage = name;
|
||||
pager.style.setProperty('--home-pager-drag', '0px');
|
||||
search.inert = page !== 0;
|
||||
bookmarks.inert = page !== 1;
|
||||
search.setAttribute('aria-hidden', String(page !== 0));
|
||||
bookmarks.setAttribute('aria-hidden', String(page !== 1));
|
||||
buttons.forEach(button => {
|
||||
if (button.closest('[data-home-page-indicator]')) {
|
||||
if (button.dataset.homePageTarget === name) button.setAttribute('aria-current', 'page');
|
||||
else button.removeAttribute('aria-current');
|
||||
}
|
||||
});
|
||||
if (focus) {
|
||||
const target = page ? bookmarks.querySelector('h1') : search.querySelector('input[type="search"]');
|
||||
target?.focus({preventScroll:true});
|
||||
}
|
||||
};
|
||||
const show = (name, focus = false) => {
|
||||
const next = name === 'bookmarks' ? 1 : 0;
|
||||
if (next === page || modalOpen()) return;
|
||||
page = next;
|
||||
sync(focus);
|
||||
};
|
||||
|
||||
buttons.forEach(button => button.addEventListener('click', () => show(button.dataset.homePageTarget, true)));
|
||||
pager.addEventListener('wheel', event => {
|
||||
if (modalOpen()) return;
|
||||
if (page === 1 && (event.deltaY > 0 || bookmarks.scrollTop > 0)) return;
|
||||
if ((page === 0 && event.deltaY <= 0) || (page === 1 && event.deltaY >= 0)) return;
|
||||
event.preventDefault();
|
||||
wheel += event.deltaY;
|
||||
clearTimeout(wheelTimer);
|
||||
wheelTimer = setTimeout(() => { wheel = 0; }, 180);
|
||||
if (Math.abs(wheel) < 40) return;
|
||||
show(page ? 'search' : 'bookmarks');
|
||||
wheel = 0;
|
||||
}, {passive:false});
|
||||
|
||||
pager.addEventListener('pointerdown', event => {
|
||||
if (!event.isPrimary || modalOpen() || interactive(event.target)) return;
|
||||
if (page === 1 && bookmarks.scrollTop > 0) return;
|
||||
pointer = event.pointerId;
|
||||
startY = lastY = event.clientY;
|
||||
startedAt = performance.now();
|
||||
pager.dataset.homeDragging = '';
|
||||
pager.setPointerCapture(pointer);
|
||||
});
|
||||
pager.addEventListener('pointermove', event => {
|
||||
if (event.pointerId !== pointer) return;
|
||||
lastY = event.clientY;
|
||||
const delta = lastY - startY;
|
||||
const allowed = page === 0 ? Math.min(0, delta) : Math.max(0, delta);
|
||||
pager.style.setProperty('--home-pager-drag', `${allowed * .72}px`);
|
||||
});
|
||||
const finish = event => {
|
||||
if (event.pointerId !== pointer) return;
|
||||
const delta = lastY - startY;
|
||||
const velocity = delta / Math.max(1, performance.now() - startedAt);
|
||||
const advance = page === 0 && (delta < -72 || velocity < -.55);
|
||||
const retreat = page === 1 && (delta > 72 || velocity > .55) && bookmarks.scrollTop <= 0;
|
||||
pointer = null;
|
||||
delete pager.dataset.homeDragging;
|
||||
if (advance) show('bookmarks');
|
||||
else if (retreat) show('search');
|
||||
else pager.style.setProperty('--home-pager-drag', '0px');
|
||||
};
|
||||
pager.addEventListener('pointerup', finish);
|
||||
pager.addEventListener('pointercancel', finish);
|
||||
|
||||
addEventListener('keydown', event => {
|
||||
if (modalOpen() || interactive(event.target)) return;
|
||||
if ((event.key === 'PageDown' || event.key === 'ArrowDown') && page === 0) {
|
||||
event.preventDefault(); show('bookmarks', true);
|
||||
} else if ((event.key === 'PageUp' || event.key === 'ArrowUp') && page === 1 && bookmarks.scrollTop <= 0) {
|
||||
event.preventDefault(); show('search', true);
|
||||
} else if (event.key === 'Home' && page === 1) {
|
||||
event.preventDefault(); show('search', true);
|
||||
}
|
||||
});
|
||||
reduced.addEventListener?.('change', () => pager.style.setProperty('--home-pager-drag', '0px'));
|
||||
sync();
|
||||
})();
|
||||
@@ -0,0 +1,130 @@
|
||||
(() => {
|
||||
const root = document.querySelector('[data-home-search-suggest]');
|
||||
if (!root) return;
|
||||
const form = root.querySelector('form');
|
||||
const input = form.querySelector('input[name="q"]');
|
||||
const list = root.querySelector('[role="listbox"]');
|
||||
const labels = {
|
||||
page: root.dataset.pageLabel,
|
||||
file: root.dataset.fileLabel,
|
||||
quartier: root.dataset.quartierLabel,
|
||||
street: root.dataset.streetLabel,
|
||||
spot: root.dataset.spotLabel,
|
||||
};
|
||||
const cache = new Map();
|
||||
let controller;
|
||||
let timer;
|
||||
let sequence = 0;
|
||||
let active = -1;
|
||||
let candidates = [];
|
||||
|
||||
const rows = () => [...list.querySelectorAll('[role="option"]')];
|
||||
const close = () => {
|
||||
list.hidden = true;
|
||||
active = -1;
|
||||
input.setAttribute('aria-expanded', 'false');
|
||||
input.removeAttribute('aria-activedescendant');
|
||||
};
|
||||
const activate = index => {
|
||||
const options = rows();
|
||||
if (!options.length) return;
|
||||
active = (index + options.length) % options.length;
|
||||
options.forEach((option, position) => option.setAttribute('aria-selected', String(position === active)));
|
||||
input.setAttribute('aria-activedescendant', options[active].id);
|
||||
options[active].scrollIntoView({block:'nearest'});
|
||||
};
|
||||
const resultHref = query => {
|
||||
const url = new URL(form.action, location.href);
|
||||
url.searchParams.set('q', query);
|
||||
url.searchParams.set('scope', '/');
|
||||
return url.pathname + url.search;
|
||||
};
|
||||
const makeRow = (item, index) => {
|
||||
const link = document.createElement('a');
|
||||
link.id = `home-search-option-${index}`;
|
||||
link.className = 'home-search-suggestion';
|
||||
link.href = item.href;
|
||||
link.role = 'option';
|
||||
link.setAttribute('aria-selected', 'false');
|
||||
link.dataset.suggestionIndex = String(index);
|
||||
if (item.exact) link.dataset.exact = 'true';
|
||||
const kind = document.createElement('span');
|
||||
kind.className = 'home-search-suggestion-kind';
|
||||
kind.textContent = labels[item.kind] || item.kind;
|
||||
const main = document.createElement('span');
|
||||
main.className = 'home-search-suggestion-main';
|
||||
const title = document.createElement('strong');
|
||||
title.textContent = item.label;
|
||||
const detail = document.createElement('small');
|
||||
detail.textContent = [item.context, item.path].filter(Boolean).join(' · ');
|
||||
main.append(title, detail);
|
||||
const open = document.createElement('span');
|
||||
open.className = 'home-search-suggestion-open';
|
||||
open.textContent = item.exact ? root.dataset.directLabel : '↵';
|
||||
link.append(kind, main, open);
|
||||
link.addEventListener('pointerenter', () => activate(index));
|
||||
link.addEventListener('click', close);
|
||||
return link;
|
||||
};
|
||||
const render = (query, data) => {
|
||||
if (input.value.trim() !== query) return;
|
||||
candidates = Array.isArray(data.items) ? data.items : [];
|
||||
const fragment = document.createDocumentFragment();
|
||||
candidates.forEach((item, index) => fragment.append(makeRow(item, index)));
|
||||
const search = makeRow({kind:'search', label:`${root.dataset.allLabel}: “${query}”`, path:'', href:resultHref(query)}, candidates.length);
|
||||
search.classList.add('home-search-suggestion-search');
|
||||
search.querySelector('.home-search-suggestion-kind').textContent = '⌕';
|
||||
fragment.append(search);
|
||||
list.replaceChildren(fragment);
|
||||
active = -1;
|
||||
list.hidden = false;
|
||||
input.setAttribute('aria-expanded', 'true');
|
||||
};
|
||||
const request = async query => {
|
||||
if (cache.has(query)) { render(query, cache.get(query)); return; }
|
||||
controller?.abort();
|
||||
controller = new AbortController();
|
||||
const current = ++sequence;
|
||||
try {
|
||||
const url = new URL(root.dataset.endpoint, location.href);
|
||||
url.searchParams.set('q', query);
|
||||
const response = await fetch(url, {headers:{Accept:'application/json'}, credentials:'same-origin', cache:'no-store', signal:controller.signal});
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
const data = await response.json();
|
||||
if (current !== sequence) return;
|
||||
cache.set(query, data);
|
||||
if (cache.size > 24) cache.delete(cache.keys().next().value);
|
||||
render(query, data);
|
||||
} catch (error) {
|
||||
if (error.name !== 'AbortError' && current === sequence) close();
|
||||
}
|
||||
};
|
||||
input.addEventListener('input', () => {
|
||||
clearTimeout(timer);
|
||||
controller?.abort();
|
||||
candidates = [];
|
||||
close();
|
||||
const query = input.value.trim();
|
||||
if ([...query].length < 2) return;
|
||||
timer = setTimeout(() => request(query), 140);
|
||||
});
|
||||
input.addEventListener('keydown', event => {
|
||||
if (event.key === 'ArrowDown' && !list.hidden) { event.preventDefault(); activate(active + 1); }
|
||||
else if (event.key === 'ArrowUp' && !list.hidden) { event.preventDefault(); activate(active < 0 ? rows().length - 1 : active - 1); }
|
||||
else if (event.key === 'Escape') { event.preventDefault(); close(); }
|
||||
});
|
||||
form.addEventListener('submit', event => {
|
||||
if (event.ctrlKey || event.metaKey) return;
|
||||
const options = rows();
|
||||
let selected = active >= 0 ? options[active] : null;
|
||||
if (!selected) {
|
||||
const exact = candidates.findIndex(item => item.exact);
|
||||
if (exact >= 0) selected = options[exact];
|
||||
}
|
||||
if (!selected || selected.classList.contains('home-search-suggestion-search')) return;
|
||||
event.preventDefault();
|
||||
location.assign(selected.href);
|
||||
});
|
||||
document.addEventListener('pointerdown', event => { if (!root.contains(event.target)) close(); });
|
||||
root.addEventListener('focusout', () => setTimeout(() => { if (!root.contains(document.activeElement)) close(); }, 100));
|
||||
})();
|
||||
@@ -0,0 +1,83 @@
|
||||
(() => {
|
||||
const ja = document.documentElement.lang.startsWith('ja');
|
||||
const t = (a,b) => ja ? a : b;
|
||||
const city = document.querySelector('[data-city-map-dialog]');
|
||||
const cityButton = document.querySelector('[data-city-map-launch]');
|
||||
const launch = document.querySelector('[data-calendar-upcoming-launch]');
|
||||
const modal = document.querySelector('[data-calendar-upcoming-dialog]');
|
||||
const notification = document.querySelector('[data-notification-dialog]');
|
||||
const notificationButton = document.querySelector('[data-notification-launch]');
|
||||
// Keep the visual/tab order City → Calendar → Notifications → Profile.
|
||||
if (launch && notificationButton) notificationButton.before(launch);
|
||||
const bind = (dialog, button, close) => {
|
||||
if (!dialog || !button) return;
|
||||
dialog.setAttribute('aria-modal','true');
|
||||
button.setAttribute('aria-haspopup','dialog');
|
||||
dialog.querySelector(close)?.addEventListener('click',()=>dialog.close());
|
||||
dialog.addEventListener('click', e => {
|
||||
if (e.target !== dialog) return;
|
||||
const r=dialog.getBoundingClientRect();
|
||||
if(e.clientX<r.left || e.clientX>r.right || e.clientY<r.top || e.clientY>r.bottom) dialog.close();
|
||||
});
|
||||
};
|
||||
bind(city,cityButton,'[data-city-map-close]');
|
||||
if(cityButton && city) cityButton.addEventListener('click',()=>{
|
||||
const frame=city.querySelector('iframe');
|
||||
if(!frame.getAttribute('src')) frame.src=frame.dataset.src;
|
||||
if(!city.open) city.showModal();
|
||||
});
|
||||
if(notification) {
|
||||
notification.setAttribute('aria-modal','true');
|
||||
notification.querySelector('h2').textContent=t('通知','Notifications');
|
||||
notification.querySelector('footer a').textContent=t('すべての通知を見る','View all notifications');
|
||||
notificationButton?.setAttribute('aria-label',t('通知','Notifications'));
|
||||
notificationButton?.setAttribute('title',t('通知','Notifications'));
|
||||
}
|
||||
bind(modal,launch,'[data-calendar-upcoming-close]');
|
||||
if(!launch || !modal) return;
|
||||
const timezone=modal.dataset.timezone||'UTC';
|
||||
const dateFormat=new Intl.DateTimeFormat(ja?'ja-JP':'en-US',{timeZone:timezone,year:'numeric',month:'2-digit',day:'2-digit'});
|
||||
const timeFormat=new Intl.DateTimeFormat(ja?'ja-JP':'en-US',{timeZone:timezone,hour:'2-digit',minute:'2-digit',hourCycle:'h23'});
|
||||
const fullFormat=new Intl.DateTimeFormat(ja?'ja-JP':'en-US',{timeZone:timezone,dateStyle:'medium',timeStyle:'short'});
|
||||
const parts=value=>Object.fromEntries(new Intl.DateTimeFormat('en-CA',{timeZone:timezone,year:'numeric',month:'2-digit',day:'2-digit'}).formatToParts(value).filter(p=>p.type!=='literal').map(p=>[p.type,p.value]));
|
||||
let pending;
|
||||
modal.addEventListener('close',()=>pending?.abort());
|
||||
launch.addEventListener('click',async()=>{
|
||||
if(modal.open) return;
|
||||
modal.showModal();
|
||||
const list=modal.querySelector('[data-calendar-upcoming-list]');
|
||||
const status=modal.querySelector('[data-calendar-upcoming-status]');
|
||||
list.replaceChildren(); status.textContent=t('読み込み中…','Loading…');
|
||||
pending=new AbortController();
|
||||
const request=pending;
|
||||
const date=new Date(),civil=parts(date);
|
||||
const today=[civil.year,civil.month,civil.day].join('-');
|
||||
try {
|
||||
const r=await fetch('/_/api/v1/extension/organizer.calendar/upcoming?date='+today,{credentials:'same-origin',headers:{Accept:'application/json'},signal:request.signal,cache:'no-store'});
|
||||
if(!r.ok) throw Error('unavailable');
|
||||
const data=await r.json();
|
||||
if(request.signal.aborted) return;
|
||||
status.textContent=data.events.length?'':t('この期間の予定はありません。','No events in this period.');
|
||||
const fragment=document.createDocumentFragment();
|
||||
for(const event of data.events) {
|
||||
const a=document.createElement('a'); a.className='calendar-upcoming-item'; a.href=event.href;
|
||||
const day=document.createElement('time');day.className='calendar-upcoming-date';
|
||||
const start=document.createElement('time');start.className='calendar-upcoming-time';
|
||||
const title=document.createElement('strong');title.textContent=event.summary||t('無題','Untitled');
|
||||
if(event.all_day) {
|
||||
const end=new Date(Date.parse(event.end)-86400000).toISOString().slice(0,10);
|
||||
day.textContent=event.start.slice(0,10).replaceAll('-','/');
|
||||
start.textContent=t('終日','All day');
|
||||
a.title=event.calendar+' · '+event.start.slice(0,10)+(end===event.start.slice(0,10)?'':' – '+end);
|
||||
} else {
|
||||
const begins=new Date(event.start),ends=new Date(event.end);
|
||||
day.textContent=dateFormat.format(begins);
|
||||
start.textContent=timeFormat.format(begins);
|
||||
a.title=event.calendar+' · '+fullFormat.format(begins)+' – '+fullFormat.format(ends);
|
||||
}
|
||||
a.append(day,start,title);fragment.append(a);
|
||||
}
|
||||
list.append(fragment);
|
||||
} catch(e) { if(!request.signal.aborted) status.textContent=t('予定を取得できませんでした。','Events unavailable.'); }
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,9 @@
|
||||
/* Notification-only worker: no fetch handler or application cache. */
|
||||
'use strict';
|
||||
self.addEventListener('install',event=>event.waitUntil(self.skipWaiting()));
|
||||
self.addEventListener('push',event=>event.waitUntil((async()=>{
|
||||
let data;try{data=event.data.json();}catch{return;}if(!data||!/^[0-9a-f-]{36}$/.test(data.uuid||''))return;
|
||||
const clients=await self.clients.matchAll({type:'window',includeUncontrolled:true});clients.forEach(client=>client.postMessage({type:'pageswiki-notification'}));
|
||||
const ja=(self.navigator.language||'').startsWith('ja');await self.registration.showNotification(ja?'PagesWiki: 新着通知':'PagesWiki: new notification',{body:ja?'Inboxで確認できます。':'Open your Inbox to read it.',tag:'pageswiki-inbox',data:{url:'/v/notification?uuid='+encodeURIComponent(data.uuid)}});
|
||||
})()));
|
||||
self.addEventListener('notificationclick',event=>{event.notification.close();event.waitUntil((async()=>{const u=new URL(event.notification.data?.url||'/v/notification',self.location.origin);if(u.origin!==self.location.origin||u.pathname!=='/v/notification')return;const clients=await self.clients.matchAll({type:'window',includeUncontrolled:true}),existing=clients.find(c=>new URL(c.url).pathname==='/v/notification');if(existing){await existing.navigate(u.href);await existing.focus();}else await self.clients.openWindow(u.href);})());});
|
||||
@@ -0,0 +1,49 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
if(window.pageswikiNotificationsInitialized)return;window.pageswikiNotificationsInitialized=true;
|
||||
const api='/_/api/v1/notifications',ja=document.documentElement.lang.startsWith('ja'),t=(en,jp)=>ja?jp:en;
|
||||
const el=(tag,text,cls)=>{const n=document.createElement(tag);if(text!==undefined)n.textContent=text;if(cls)n.className=cls;return n;};
|
||||
const request=async(url=api+'?limit=30',options={})=>{const r=await fetch(url,{credentials:'same-origin',signal:AbortSignal.timeout(10000),...options,headers:{Accept:'application/json','Content-Type':'application/json',...options.headers}});if(!r.ok||r.redirected)throw Error(t('Notification request failed.','通知の処理に失敗しました。'));return r.json();};
|
||||
const href=item=>{try{const u=new URL(item.href||'/v/notification?uuid='+encodeURIComponent(item.uuid),location.origin);return u.origin===location.origin?u.href:'/v/notification';}catch{return '/v/notification';}};
|
||||
function render(root,items){root.replaceChildren(...items.map(item=>{const a=el('a',undefined,'notification-item'+(item.status==='unread'?' unread':''));a.href=href(item);a.append(el('strong',item.message||t('Notification','通知')),el('time',new Date(Number(item.created_at_ms)).toLocaleString()));return a;}));if(!items.length)root.append(el('p',t('No notifications.','通知はありません。'),'muted'));}
|
||||
document.addEventListener('DOMContentLoaded',()=>{
|
||||
const launch=document.querySelector('[data-notification-launch]'),dialog=document.querySelector('[data-notification-dialog]'),badge=document.querySelector('[data-notification-badge]'),dialogRoot=dialog?.querySelector('[data-notifications-list]'),pageRoot=document.querySelector('.notifications-page [data-notifications-list]');if(!dialogRoot&&!pageRoot)return;
|
||||
const owner=dialog?.dataset.owner,key='pageswiki.notifications.v1:'+location.host+':'+(dialog?.dataset.domain||'')+':'+owner;
|
||||
const read=(suffix,fallback)=>{try{return JSON.parse(localStorage.getItem(key+suffix))??fallback;}catch{return fallback;}},write=(suffix,value)=>{try{localStorage.setItem(key+suffix,JSON.stringify(value));}catch{}};
|
||||
const defaults={toast:true,browser:false,auto:false,sound:'none',volume:30};let prefs={...defaults,...read('.settings',{})};
|
||||
let previousVisit=Number(read('.visit',0)),lastServerTime=0,first=true,pending=false,autoPending=false,registration=null,subscription=null,pushReady=false,audio=null,seenIDs=[];const tabID=crypto.randomUUID();
|
||||
const settings=el('details',undefined,'notification-settings');settings.append(el('summary','⚙ '+t('Notification settings','通知設定')));const panel=el('div');settings.append(panel);dialog?.querySelector('footer')?.before(settings);const settingStatus=el('p');settingStatus.role='status';const controls={};
|
||||
function toggle(name,label){const l=el('label'),i=el('input');i.type='checkbox';i.checked=!!prefs[name];controls[name]=i;l.append(i,el('span',label));panel.append(l);i.onchange=()=>{prefs[name]=i.checked;write('.settings',prefs);};return i;}
|
||||
toggle('toast',t('Quiet toast while focused','操作中は右下に一時通知'));toggle('auto',t('Open Inbox on return if new notifications exist','再訪時に新着があればInboxを自動表示'));const browserToggle=toggle('browser',t('Background notifications (Web Push)','バックグラウンド通知(Web Push)'));
|
||||
const soundLabel=el('label',t('Sound','通知音')),sound=el('select');sound.ariaLabel=t('Sound','通知音');[['none',t('Off','なし')],['soft',t('Soft','ソフト')],['chime',t('Chime','チャイム')],['bell',t('Bell','ベル')]].forEach(([value,label])=>{const o=el('option',label);o.value=value;sound.append(o);});sound.value=prefs.sound;soundLabel.append(sound);panel.append(soundLabel);
|
||||
const volumeLabel=el('label',t('Volume','音量')),volume=el('input');volume.type='range';volume.min=0;volume.max=100;volume.value=prefs.volume;volume.ariaLabel=t('Volume','音量');volumeLabel.append(volume);panel.append(volumeLabel);
|
||||
async function unlockAudio(){try{audio??=new(window.AudioContext||window.webkitAudioContext)();await audio.resume();}catch{}}
|
||||
function play(){if(prefs.sound==='none'||!audio||audio.state!=='running')return;const notes=prefs.sound==='chime'?[660,880]:prefs.sound==='bell'?[880,440]:[520];notes.forEach((hz,i)=>{const osc=audio.createOscillator(),gain=audio.createGain(),start=audio.currentTime+i*.15;osc.frequency.value=hz;gain.gain.setValueAtTime(0,start);gain.gain.linearRampToValueAtTime(Math.min(100,Math.max(0,Number(prefs.volume)||0))/100*.12,start+.02);gain.gain.exponentialRampToValueAtTime(.0001,start+.3);osc.connect(gain);gain.connect(audio.destination);osc.start(start);osc.stop(start+.32);osc.onended=()=>{osc.disconnect();gain.disconnect();};});}
|
||||
sound.onchange=async()=>{prefs.sound=sound.value;write('.settings',prefs);await unlockAudio();play();};volume.oninput=()=>{prefs.volume=Number(volume.value);write('.settings',prefs);};const test=el('button',t('Test sound','試聴'));test.type='button';test.onclick=async()=>{await unlockAudio();play();};
|
||||
panel.append(test,el('small',t('Settings are per account and browser. Selected sounds need an active page and interaction; closed-tab sound follows OS settings. Push requires HTTPS, permission and a valid login session.','このアカウント・ブラウザごとの設定です。選択した音はページ動作中・操作後のみ再生します。タブ終了時の音はOS設定に従います。PushにはHTTPS・通知許可・有効なログインが必要です。')),settingStatus);
|
||||
const toasts=el('div',undefined,'notification-toasts');toasts.setAttribute('aria-live','polite');document.body.append(toasts);
|
||||
function toast(items){const box=el('div',undefined,'notification-toast'),a=el('a',items.length===1?(items[0].message||t('New notification','新着通知')):t(`${items.length} new notifications`,`${items.length}件の新着通知`));a.href=items.length===1?href(items[0]):'/v/notification';const close=el('button','×');close.type='button';close.ariaLabel=t('Dismiss','閉じる');close.onclick=()=>box.remove();box.append(a,close);toasts.append(box);while(toasts.children.length>3)toasts.firstElementChild.remove();setTimeout(()=>box.remove(),8000);}
|
||||
const paging=new WeakMap();
|
||||
async function refresh(target=dialogRoot||pageRoot,mark=false,onlyNew=false,append=false){
|
||||
let state=paging.get(target);if(!append||!state){state={since:previousVisit,mark,onlyNew,next:''};paging.set(target,state);}state.button?.remove();
|
||||
try{const data=await request(api+'?limit=30'+(append?'&before='+encodeURIComponent(state.next):''));let items=data.notifications||[];if(state.onlyNew)items=items.filter(n=>n.created_at_ms>=state.since);
|
||||
if(append){const holder=el('div');render(holder,items);if(items.length)target.append(...holder.children);}else render(target,items);
|
||||
if(state.mark){await Promise.all(items.filter(n=>n.status==='unread').map(n=>request(api+'/read',{method:'POST',body:JSON.stringify({uuid:n.uuid})})));if(badge)badge.hidden=true;}
|
||||
state.next=data.next_cursor;if(state.next&&(!state.onlyNew||items.length===30)){const more=el('button',t('Load more','さらに表示'));more.type='button';more.className='notification-more';more.onclick=()=>{more.disabled=true;refresh(target,state.mark,state.onlyNew,true);};state.button=more;target.after(more);}return data;
|
||||
}catch(e){if(append)target.append(el('p',e.message,'muted'));else target.replaceChildren(el('p',e.message,'muted'));return null;}
|
||||
}
|
||||
const focused=()=>!document.hidden&&document.hasFocus();
|
||||
function showInbox(automatic=false){if(!dialog||dialog.open)return;if(automatic&&(!focused()||document.querySelector('dialog[open]')||/^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement?.tagName)||document.activeElement?.isContentEditable)){autoPending=true;return;}autoPending=false;dialog.showModal();if(badge)badge.hidden=true;refresh(dialogRoot,true,automatic).then(data=>{if(data){previousVisit=data.server_time_ms||Date.now();write('.visit',previousVisit);}});}
|
||||
launch?.addEventListener('click',()=>showInbox());dialog?.addEventListener('click',e=>{if(e.target===dialog)dialog.close();});dialog?.querySelector('[data-notification-close]')?.addEventListener('click',()=>dialog.close());document.querySelector('[data-notifications-refresh]')?.addEventListener('click',()=>refresh(pageRoot||dialogRoot));if(pageRoot)refresh(pageRoot);
|
||||
async function deliver(items){if(!items.length)return;const run=async()=>{const seen=read('.delivered',[]),fresh=items.filter(n=>!seen.includes(n.uuid));if(!fresh.length)return;if(!focused())return;write('.delivered',[...fresh.map(n=>n.uuid),...seen].slice(0,200));if(prefs.toast){toast(fresh);play();}};if(navigator.locks)await navigator.locks.request(key+'.delivery',run);else await run();}
|
||||
async function poll(){if(pending)return;pending=true;try{const data=await request(api+'?unread=1&limit=30'),items=data.notifications||[];lastServerTime=data.server_time_ms||Date.now();if(badge&&!dialog?.open)badge.hidden=!items.length;if(first){first=false;if(prefs.auto&&previousVisit&&items.some(n=>n.created_at_ms>=previousVisit))showInbox(true);else if(!document.hidden){previousVisit=lastServerTime;write('.visit',previousVisit);}}else{if(!dialog?.open)await deliver(items.filter(n=>n.created_at_ms>=previousVisit));if(autoPending&&focused())showInbox(true);if(focused()&&!autoPending&&!dialog?.open){previousVisit=lastServerTime;write('.visit',previousVisit);}}if(dialog?.open&&focused()&&items.some(n=>n.created_at_ms>=previousVisit)){const updated=await refresh(dialogRoot,true);if(updated){previousVisit=updated.server_time_ms;write('.visit',previousVisit);}}seenIDs=focused()?items.map(n=>n.uuid):[];await syncPush();}catch{}finally{pending=false;}}
|
||||
const decode=v=>Uint8Array.from(atob(v.replace(/-/g,'+').replace(/_/g,'/')),c=>c.charCodeAt(0));
|
||||
async function registerWorker(){if(!window.isSecureContext||!('serviceWorker'in navigator)||!('PushManager'in window)||!('Notification'in window))throw Error(t('Web Push is unavailable in this browser.','このブラウザではWeb Pushを利用できません。'));registration=await navigator.serviceWorker.register('/static/js/notifications-worker.js',{scope:'/static/js/'});if(!registration.active)await new Promise((resolve,reject)=>{const worker=registration.installing||registration.waiting;if(!worker)return reject(Error('Worker unavailable'));const timer=setTimeout(()=>reject(Error('Worker activation timed out')),10000);worker.addEventListener('statechange',()=>{if(worker.state==='activated'){clearTimeout(timer);resolve();}});});return registration;}
|
||||
async function syncPush(){if(!prefs.browser||!subscription)return;let presence=read('.focus',{});if(focused()){presence={id:tabID,until:Date.now()+90000};write('.focus',presence);}else if(presence.id===tabID){presence={};write('.focus',presence);}await request(api+'/push',{method:'POST',body:JSON.stringify({subscription:subscription.toJSON(),focused:focused()||presence.until>Date.now(),seen:focused()?seenIDs:[]})});pushReady=true;}
|
||||
async function enablePush(ask){if(ask&&'Notification'in window&&Notification.permission!=='granted'){if(await Notification.requestPermission()!=='granted')throw Error(t('Browser notification permission was not granted.','ブラウザ通知が許可されていません。'));}await registerWorker();if(Notification.permission!=='granted')throw Error(t('Allow notifications in browser settings.','ブラウザ設定から通知を許可してください。'));const {public_key}=await request(api+'/push');subscription=await registration.pushManager.getSubscription();const globalOwner=localStorage.getItem('pageswiki.push.owner');if(subscription&&globalOwner!==key){await subscription.unsubscribe();subscription=null;}subscription??=await registration.pushManager.subscribe({userVisibleOnly:true,applicationServerKey:decode(public_key)});await syncPush();localStorage.setItem('pageswiki.push.owner',key);settingStatus.textContent=t('Background notifications enabled.','バックグラウンド通知を有効にしました。');}
|
||||
browserToggle.onchange=async()=>{browserToggle.disabled=true;try{prefs.browser=browserToggle.checked;if(prefs.browser){await enablePush(true);await unlockAudio();}else{subscription??=await(await registerWorker()).pushManager.getSubscription();if(subscription){await request(api+'/push',{method:'DELETE',body:JSON.stringify({subscription:subscription.toJSON()})});await subscription.unsubscribe();}subscription=null;pushReady=false;settingStatus.textContent=t('Background notifications disabled.','バックグラウンド通知を無効にしました。');}write('.settings',prefs);}catch(e){prefs.browser=pushReady;browserToggle.checked=prefs.browser;settingStatus.textContent=e.message;}finally{browserToggle.disabled=false;}};
|
||||
document.addEventListener('pointerdown',()=>{if(prefs.sound!=='none')unlockAudio();},{passive:true});document.addEventListener('visibilitychange',()=>{if(document.hidden){if(lastServerTime)write('.visit',lastServerTime);}else{if(prefs.auto){previousVisit=Number(read('.visit',previousVisit));first=true;}poll();}syncPush().catch(()=>{});});window.addEventListener('focus',()=>{poll();syncPush().catch(()=>{});});window.addEventListener('blur',()=>syncPush().catch(()=>{}));
|
||||
window.addEventListener('storage',e=>{if(e.key===key+'.settings'){prefs={...defaults,...read('.settings',{})};for(const name in controls)controls[name].checked=!!prefs[name];sound.value=prefs.sound;volume.value=prefs.volume;if(!prefs.browser)pushReady=false;}});navigator.serviceWorker?.addEventListener('message',e=>{if(e.data?.type==='pageswiki-notification')poll();});window.addEventListener('pagehide',()=>{if(lastServerTime&&!document.hidden)write('.visit',lastServerTime);});
|
||||
if(owner){poll();setInterval(()=>{if(!document.hidden||!pushReady)poll();},30000);if(prefs.browser)enablePush(false).catch(e=>{settingStatus.textContent=e.message;});}
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,101 @@
|
||||
(() => {
|
||||
const dialog = document.querySelector('[data-path-picker-dialog]');
|
||||
if (!dialog) return;
|
||||
const list = dialog.querySelector('[data-path-picker-list]');
|
||||
const status = dialog.querySelector('[data-path-picker-status]');
|
||||
const current = dialog.querySelector('[data-path-picker-current]');
|
||||
const up = dialog.querySelector('[data-path-picker-up]');
|
||||
const chooseFolder = dialog.querySelector('[data-path-picker-folder]');
|
||||
const choose = dialog.querySelector('[data-path-picker-select]');
|
||||
let target = null, mode = 'any', path = '/', parent = '/', selected = '', request = null;
|
||||
|
||||
const labels = {
|
||||
loading: dialog.dataset.loading,
|
||||
empty: dialog.dataset.empty,
|
||||
failed: dialog.dataset.failed,
|
||||
truncated: dialog.dataset.truncated,
|
||||
};
|
||||
const formatBytes = value => {
|
||||
if (!Number.isFinite(value) || value <= 0) return '';
|
||||
const units = ['B', 'KiB', 'MiB', 'GiB'];
|
||||
let number = value, index = 0;
|
||||
while (number >= 1024 && index < units.length - 1) { number /= 1024; index++; }
|
||||
return number.toFixed(index ? 1 : 0) + ' ' + units[index];
|
||||
};
|
||||
const commit = value => {
|
||||
if (!target) return;
|
||||
target.value = value;
|
||||
target.dispatchEvent(new Event('input', {bubbles: true}));
|
||||
target.dispatchEvent(new Event('change', {bubbles: true}));
|
||||
dialog.close();
|
||||
target.focus();
|
||||
};
|
||||
const markSelected = value => {
|
||||
selected = value;
|
||||
choose.disabled = !selected;
|
||||
list.querySelectorAll('[role=option]').forEach(item => item.setAttribute('aria-selected', String(item.dataset.path === selected)));
|
||||
};
|
||||
const load = async next => {
|
||||
request?.abort();
|
||||
request = new AbortController();
|
||||
status.textContent = labels.loading;
|
||||
list.replaceChildren();
|
||||
choose.disabled = true;
|
||||
selected = '';
|
||||
try {
|
||||
const response = await fetch('/_/api/v1/path-picker?path=' + encodeURIComponent(next || '/') + '&mode=' + encodeURIComponent(mode), {headers: {Accept: 'application/json'}, credentials: 'same-origin', cache: 'no-store', signal: request.signal});
|
||||
if (!response.ok) throw new Error('picker unavailable');
|
||||
const data = await response.json();
|
||||
path = data.path || '/'; parent = data.parent || '/'; current.textContent = path;
|
||||
up.disabled = path === '/';
|
||||
chooseFolder.hidden = !(mode === 'folder' || mode === 'any' || mode === 'image-or-folder');
|
||||
const fragment = document.createDocumentFragment();
|
||||
for (const entry of data.entries || []) {
|
||||
const item = document.createElement('button');
|
||||
item.type = 'button'; item.className = 'config-path-picker-item'; item.dataset.path = entry.path;
|
||||
item.setAttribute('role', 'option'); item.setAttribute('aria-selected', 'false');
|
||||
const icon = document.createElement('span'); icon.textContent = entry.kind === 'folder' ? '▰' : (entry.content_type || '').startsWith('image/') ? '▧' : '▤'; icon.setAttribute('aria-hidden', 'true');
|
||||
const name = document.createElement('span'); name.textContent = entry.name;
|
||||
const detail = document.createElement('small'); detail.textContent = entry.kind === 'folder' ? '' : formatBytes(entry.size);
|
||||
item.append(icon, name, detail);
|
||||
if (entry.kind === 'folder') item.addEventListener('click', () => load(entry.path));
|
||||
else {
|
||||
item.addEventListener('click', () => markSelected(entry.path));
|
||||
item.addEventListener('dblclick', () => commit(entry.path));
|
||||
}
|
||||
fragment.append(item);
|
||||
}
|
||||
list.append(fragment);
|
||||
if (data.selected) markSelected(data.selected);
|
||||
status.textContent = data.truncated ? labels.truncated : (data.entries || []).length ? '' : labels.empty;
|
||||
} catch (error) {
|
||||
if (error.name !== 'AbortError') status.textContent = labels.failed;
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('click', event => {
|
||||
const opener = event.target.closest('[data-path-picker]');
|
||||
if (!opener) return;
|
||||
target = document.getElementById(opener.dataset.pickerTarget);
|
||||
if (!target) return;
|
||||
mode = opener.dataset.pickerMode || 'any';
|
||||
dialog.showModal();
|
||||
load(target.value.trim() || '/');
|
||||
});
|
||||
up.addEventListener('click', () => load(parent));
|
||||
chooseFolder.addEventListener('click', () => commit(path));
|
||||
choose.addEventListener('click', () => selected && commit(selected));
|
||||
dialog.querySelectorAll('[data-path-picker-close]').forEach(button => button.addEventListener('click', () => dialog.close()));
|
||||
dialog.addEventListener('close', () => request?.abort());
|
||||
dialog.addEventListener('click', event => {
|
||||
if (event.target !== dialog) return;
|
||||
const box = dialog.getBoundingClientRect();
|
||||
if (event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom) dialog.close();
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-range-output]').forEach(input => {
|
||||
const output = document.getElementById(input.dataset.rangeOutput);
|
||||
const update = () => { if (output) output.value = input.value + '%'; };
|
||||
input.addEventListener('input', update); update();
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,86 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
const ja=document.documentElement.lang.startsWith('ja');
|
||||
const endpoint=(kind,operation)=>`/_/api/v1/extension/content.${kind}/${operation}`;
|
||||
async function request(url,body) {
|
||||
const controller=new AbortController(),timeout=setTimeout(()=>controller.abort(),15000);
|
||||
try {const response=await fetch(url,{cache:'no-store',signal:controller.signal,headers:{Accept:'application/json',...(body?{'Content-Type':'application/json'}:{})},...(body?{method:'POST',body:JSON.stringify(body)}:{})});
|
||||
if(!response.ok||response.redirected)throw new Error(response.status===401||response.redirected?(ja?'ログインし直してください。':'Please sign in again.'):await response.text());return await response.json();
|
||||
}finally{clearTimeout(timeout);}
|
||||
}
|
||||
const settingPanels=document.querySelectorAll('[data-periodical-settings]');
|
||||
const observer=new IntersectionObserver(entries=>entries.forEach(async entry=>{
|
||||
if(!entry.isIntersecting)return;const panel=entry.target;observer.unobserve(panel);
|
||||
const form=panel.querySelector('form'),status=form.querySelector('[data-periodical-status]');
|
||||
try {const data=await request(endpoint(panel.dataset.periodicalSettings,'settings'));form.elements.enabled.checked=data.enabled;form.elements.prefix.value=data.prefix;form.querySelector('fieldset').disabled=!!data.controlled;if(data.controlled)status.textContent=ja?'ドメインの入口設定で管理中です。コントローラのドメインパネルから変更してください。':'Managed by Domain entry settings. Change settings in the controller Domains panel.';}
|
||||
catch(error){status.textContent=error.message;}
|
||||
}));
|
||||
settingPanels.forEach(panel=>{observer.observe(panel);panel.querySelector('form').addEventListener('submit',async event=>{event.preventDefault();const form=event.target,status=form.querySelector('[data-periodical-status]'),fields=form.querySelector('fieldset');fields.disabled=true;try{await request(endpoint(panel.dataset.periodicalSettings,'settings'),{enabled:form.elements.enabled.checked,prefix:form.elements.prefix.value});status.textContent=ja?'保存しました。':'Saved.';}catch(error){status.textContent=error.message;}finally{fields.disabled=false;}});});
|
||||
document.querySelectorAll('[data-domain-entry-open]').forEach(button=>button.addEventListener('click',()=>document.getElementById(button.dataset.domainEntryOpen)?.showModal()));
|
||||
document.querySelectorAll('[data-domain-entry-close]').forEach(button=>button.addEventListener('click',()=>button.closest('dialog').close()));
|
||||
document.querySelectorAll('.domain-entry-dialog select[name=entry_layout]').forEach(select=>select.addEventListener('change',()=>{if(select.value==='diary'||select.value==='blog')select.form.elements[select.value+'_enabled'].checked=true;}));
|
||||
const root=document.querySelector('[data-periodical-kind]');if(!root)return;
|
||||
const composer=root.querySelector('[data-periodical-composer]'),postForm=composer?.querySelector('form');
|
||||
let requestID='',posting=false;
|
||||
root.querySelector('[data-periodical-compose]')?.addEventListener('click',()=>{if(!requestID){postForm.reset();requestID=crypto.randomUUID();}composer.showModal();});
|
||||
composer?.querySelector('[data-composer-close]')?.addEventListener('click',()=>{if(!posting)composer.close();});
|
||||
composer?.addEventListener('cancel',event=>{if(posting)event.preventDefault();});
|
||||
postForm?.addEventListener('input',()=>{requestID=crypto.randomUUID();});
|
||||
postForm?.addEventListener('submit',async event=>{
|
||||
event.preventDefault();if(posting)return;
|
||||
if(!requestID)requestID=crypto.randomUUID();
|
||||
const body=Object.fromEntries(new FormData(postForm));
|
||||
if (window.PagesWikiGetEditorText) body.body=window.PagesWikiGetEditorText();
|
||||
body.request_id=requestID;
|
||||
const fields=postForm.querySelector('fieldset'),status=postForm.querySelector('[data-composer-status]');
|
||||
posting=true;fields.disabled=true;status.textContent='';
|
||||
try {
|
||||
const result=await request(endpoint(root.dataset.periodicalKind,'posts'),body);requestID='';
|
||||
postForm.hidden=true;
|
||||
const done=document.createElement('section');done.dataset.periodicalPosted='true';
|
||||
const heading=document.createElement('h2');heading.textContent=ja?'記事を保存しました':'Article saved';done.append(heading);
|
||||
const warning=document.createElement('p');warning.textContent=result.published?(ja?'公開済みの記事をシェアできます。':'This article is public.'):(ja?'まだ公開承認されていません。承認するまで共有先では閲覧できません。':'Publication approval is pending. Shared links are not readable until approved.');done.append(warning);
|
||||
const targets=Array.isArray(result.share_targets)?result.share_targets:[];
|
||||
const select=document.createElement('select');select.setAttribute('aria-label',ja?'共有ドメイン':'Sharing domain');
|
||||
targets.forEach(target=>{const option=document.createElement('option');option.value=target.url;option.textContent=target.title+' — '+target.url;select.append(option);});
|
||||
const link=document.createElement('a');link.textContent=ja?'Xでシェア':'Share on X';link.target='_blank';link.rel='noopener noreferrer';link.dataset.shareX='true';
|
||||
const display=document.createElement('p');display.style.overflowWrap='anywhere';
|
||||
const update=()=>{const url=new URL('https://x.com/intent/tweet');const target=targets.find(item=>item.url===select.value);url.searchParams.set('text',body.title+' - '+(target?.title||document.title));url.searchParams.set('url',select.value);link.href=url.href;display.textContent=select.value;};
|
||||
if(targets.length){update();select.addEventListener('change',update);if(targets.length>1)done.append(select);done.append(display,link);}
|
||||
else {const message=document.createElement('p');message.textContent=ja?'共有先URLを取得できませんでした。ドメイン設定を確認してください。':'No sharing URL is available. Check Domain settings.';done.append(message);}
|
||||
link.addEventListener('click',event=>{if(!result.published&&!confirm(ja?'この記事はまだ公開されていません。未公開のURLをXの投稿画面へ渡しますか?':'This article is not public yet. Send its unpublished URL to the X composer?'))event.preventDefault();});
|
||||
const next=document.createElement('a');next.href='/v/'+root.dataset.periodicalKind+'/'+body.date.replaceAll('-','/');next.textContent=ja?'記事一覧へ':'Back to entries';next.dataset.postContinue='true';
|
||||
const navigation=document.createElement('nav');navigation.append(next);done.append(navigation);composer.append(done);
|
||||
posting=false;composer.addEventListener('close',()=>location.assign(next.href),{once:true});
|
||||
}
|
||||
catch(error){status.textContent=error.message;fields.disabled=false;posting=false;}
|
||||
});
|
||||
root.querySelector('[data-periodical-filters]')?.addEventListener('submit',event=>{
|
||||
event.preventDefault();const fields=event.target.elements,month=fields.month.value;
|
||||
const target='/v/'+root.dataset.periodicalKind+(month?'/'+month.replace('-', '/'):'');
|
||||
const query=new URLSearchParams();if(fields.category?.value)query.set('category',fields.category.value);
|
||||
let suffix=query.toString();if(fields.own?.checked)suffix+=(suffix?'&':'')+'own';
|
||||
location.assign(target+(suffix?'?'+suffix:''));
|
||||
});
|
||||
const dialog=root.querySelector('[data-periodical-dialog]'),form=dialog?.querySelector('form');
|
||||
root.querySelector('[data-periodical-add]')?.addEventListener('click',()=>{form.reset();form.elements.path.readOnly=false;form.querySelector('[data-periodical-status]').textContent='';dialog.showModal();});
|
||||
const planner=root.querySelector('[data-periodical-planner]'),planForm=planner?.querySelector('form');
|
||||
let planned=null;
|
||||
root.querySelector('[data-periodical-new]')?.addEventListener('click',()=>{planForm.reset();planned=null;planForm.querySelector('[data-planner-result]').hidden=true;planForm.querySelector('[data-planner-status]').textContent='';planner.showModal();});
|
||||
planner?.querySelector('[data-planner-close]').addEventListener('click',()=>planner.close());
|
||||
planForm?.addEventListener('input',()=>{planned=null;planForm.querySelector('[data-planner-result]').hidden=true;});
|
||||
planForm?.addEventListener('submit',async event=>{
|
||||
event.preventDefault();const button=planForm.querySelector('[type=submit]'),status=planForm.querySelector('[data-planner-status]');button.disabled=true;planned=null;planForm.querySelector('[data-planner-result]').hidden=true;
|
||||
const values=new URLSearchParams(new FormData(planForm)),date=planForm.elements.date.value;
|
||||
try {const data=await request(endpoint(root.dataset.periodicalKind,'plan')+'?'+values);if(new URLSearchParams(new FormData(planForm)).toString()!==values.toString())return;planned={...data,date};status.textContent=data.path;planForm.querySelector('[data-planner-editor]').href=data.editor_href;planForm.querySelector('[data-planner-result]').hidden=false;}
|
||||
catch(error){status.textContent=error.message;}finally{button.disabled=false;}
|
||||
});
|
||||
planner?.querySelector('[data-planner-register]').addEventListener('click',()=>{if(!planned)return;planner.close();form.reset();form.elements.path.value=planned.path;form.elements.date.value=planned.date;form.elements.path.readOnly=false;form.querySelector('[data-periodical-status]').textContent='';dialog.showModal();});
|
||||
root.querySelector('[data-periodical-close]')?.addEventListener('click',()=>dialog.close());
|
||||
root.querySelectorAll('[data-periodical-entry]').forEach(row=>{
|
||||
row.querySelector('[data-periodical-edit]')?.addEventListener('click',()=>{form.reset();for(const key of ['path','title','date','category','version'])form.elements[key].value=row.dataset[key];form.elements.page_uuid.value=row.dataset.page;form.elements.path.readOnly=true;form.querySelector('[data-periodical-status]').textContent='';dialog.showModal();});
|
||||
row.querySelector('[data-periodical-remove]')?.addEventListener('click',async event=>{if(!confirm(event.target.dataset.confirm))return;event.target.disabled=true;try{await request(endpoint(root.dataset.periodicalKind,'entries'),{path:row.dataset.path,page_uuid:row.dataset.page,version:Number(row.dataset.version),remove:true});location.reload();}catch(error){alert(error.message);event.target.disabled=false;}});
|
||||
});
|
||||
form?.addEventListener('submit',async event=>{event.preventDefault();const button=form.querySelector('[type=submit]'),status=form.querySelector('[data-periodical-status]');button.disabled=true;try{const data=Object.fromEntries(new FormData(form));data.version=Number(data.version);await request(endpoint(root.dataset.periodicalKind,'entries'),data);location.reload();}catch(error){status.textContent=error.message;button.disabled=false;}});
|
||||
addEventListener('pageshow',event=>{if(event.persisted)location.reload();});
|
||||
})();
|
||||
@@ -0,0 +1,136 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
const ja = document.documentElement.lang.startsWith('ja');
|
||||
const text = {loading: ja ? '読み込み中…' : 'Loading…', failed: ja ? '一覧を取得できませんでした。' : 'Could not load this listing.', retry: ja ? '再試行' : 'Retry', views: ja ? '表示形式' : 'View mode'};
|
||||
// Persist presentation only, never content, names or authorization.
|
||||
let preferred = 'list';
|
||||
try { const v = sessionStorage.getItem('public-navigation-view'); if (['list', 'detail', 'icon'].includes(v)) preferred = v; } catch (_) {}
|
||||
const sections = new Set(), queue = [];
|
||||
let active = 0;
|
||||
function pump() {
|
||||
while (active < 3 && queue.length) {
|
||||
const job = queue.shift();
|
||||
if (job.signal.aborted) { job.reject(new DOMException('Aborted', 'AbortError')); continue; }
|
||||
active++;
|
||||
job.run().then(job.resolve, job.reject).finally(() => { active--; pump(); });
|
||||
}
|
||||
}
|
||||
const scheduled = (signal, run) => new Promise((resolve, reject) => { queue.push({signal, run, resolve, reject}); pump(); });
|
||||
const observer = 'IntersectionObserver' in window ? new IntersectionObserver(entries => {
|
||||
for (const entry of entries) if (entry.isIntersecting) {
|
||||
observer.unobserve(entry.target);
|
||||
const state = entry.target.closest('[data-children-src]')?._publicChildren;
|
||||
if (state) load(state, entry.target.dataset.childrenNext, entry.target);
|
||||
}
|
||||
}, {rootMargin: '160px'}) : null;
|
||||
function watch(state) {
|
||||
state.body.querySelectorAll('[data-children-next]').forEach(target => {
|
||||
if (observer) observer.observe(target);
|
||||
else {
|
||||
const link = document.createElement('a'); link.href = target.dataset.childrenNext; link.textContent = ja ? '次の項目' : 'Next items';
|
||||
link.addEventListener('click', event => { event.preventDefault(); load(state, link.href, target); }); target.replaceChildren(link);
|
||||
}
|
||||
});
|
||||
}
|
||||
function status(target, message) { const p = document.createElement('p'); p.setAttribute('role', 'status'); p.textContent = message; target.replaceChildren(p); }
|
||||
async function load(state, source, appendTarget = null) {
|
||||
const generation = state.generation, signal = state.controller.signal, target = appendTarget || state.body;
|
||||
const current = () => !signal.aborted && state.generation === generation && target.isConnected;
|
||||
if (!current()) return;
|
||||
status(target, text.loading); state.section.setAttribute('aria-busy', 'true');
|
||||
try {
|
||||
const url = new URL(source, location.origin);
|
||||
if (url.origin !== location.origin || url.pathname !== '/v/children') throw new Error('Invalid navigation endpoint');
|
||||
const body = await scheduled(signal, async () => {
|
||||
const request = new AbortController(), abort = () => request.abort();
|
||||
signal.addEventListener('abort', abort, {once: true});
|
||||
const timeout = setTimeout(abort, 15000);
|
||||
try {
|
||||
const response = await fetch(url, {signal: request.signal, cache: 'no-store', headers: {Accept: 'text/html'}});
|
||||
if (!response.ok || response.redirected || !response.headers.get('Content-Type')?.includes('text/html')) throw new Error('Navigation unavailable');
|
||||
return await response.text();
|
||||
} finally { clearTimeout(timeout); signal.removeEventListener('abort', abort); }
|
||||
});
|
||||
if (!current()) return;
|
||||
const fragment = document.createElement('template'); fragment.innerHTML = body;
|
||||
if (appendTarget) appendTarget.replaceWith(fragment.content); else target.replaceChildren(fragment.content);
|
||||
watch(state);
|
||||
} catch (error) {
|
||||
if (!current()) return;
|
||||
status(target, text.failed);
|
||||
const retry = document.createElement('button'); retry.type = 'button'; retry.textContent = text.retry;
|
||||
retry.addEventListener('click', () => load(state, source, appendTarget)); target.append(retry);
|
||||
} finally { if (state.generation === generation) state.section.removeAttribute('aria-busy'); }
|
||||
}
|
||||
document.querySelectorAll('[data-children-src]').forEach(section => {
|
||||
const views = document.createElement('nav'); views.className = 'public-children-views'; views.setAttribute('aria-label', text.views);
|
||||
const body = document.createElement('div'); body.dataset.publicChildrenBody = '';
|
||||
const ready = section.hasAttribute('data-public-children-ready');
|
||||
if (ready) while (section.firstChild) body.append(section.firstChild);
|
||||
section.replaceChildren(views, body);
|
||||
const state = {section, body, generation: 0, controller: new AbortController()};
|
||||
section._publicChildren = state; sections.add(state);
|
||||
const buttons = [];
|
||||
const choose = (view, initial = false) => {
|
||||
state.controller.abort(); state.controller = new AbortController(); state.generation++;
|
||||
buttons.forEach(button => button.setAttribute('aria-pressed', String(button.dataset.view === view)));
|
||||
if (!initial) try { sessionStorage.setItem('public-navigation-view', view); } catch (_) {}
|
||||
if (ready && initial && view === 'list') { watch(state); return; }
|
||||
const url = new URL(section.dataset.childrenSrc, location.origin); url.searchParams.set('view', view); load(state, url);
|
||||
};
|
||||
for (const [view, icon, name] of [['icon', '▦', ja ? '縮小版表示' : 'Thumbnail view'], ['detail', '☷', ja ? '詳細表示' : 'Detail view'], ['list', '≡', ja ? '通常表示' : 'List view']]) {
|
||||
const button = document.createElement('button'); button.type = 'button'; button.textContent = icon; button.dataset.view = view;
|
||||
button.title = name; button.setAttribute('aria-label', name);
|
||||
button.addEventListener('click', () => choose(view)); views.append(button); buttons.push(button);
|
||||
}
|
||||
choose(preferred, true);
|
||||
});
|
||||
const tree = document.querySelector('[data-public-tree]');
|
||||
if (tree) {
|
||||
const rows = [...tree.querySelectorAll('[data-public-tree-path]')], filter = document.querySelector('[data-public-tree-filter]');
|
||||
const collapsed = new Set(), byPath = new Map(rows.map(row => [row.dataset.publicTreePath, row]));
|
||||
const parent = path => path.slice(0, path.lastIndexOf('/')) || '/';
|
||||
function update() {
|
||||
const query = filter.value.trim().toLocaleLowerCase(), matches = new Set();
|
||||
if (query) for (const row of rows) if (row.dataset.publicTreePath.toLocaleLowerCase().includes(query)) {
|
||||
for (let at = row.dataset.publicTreePath; byPath.has(at); at = parent(at)) matches.add(at);
|
||||
}
|
||||
let visible = 0;
|
||||
const ancestors = [];
|
||||
for (const row of rows) {
|
||||
const path = row.dataset.publicTreePath, depth = Number(row.dataset.depth);
|
||||
while (ancestors.length && ancestors.at(-1).depth >= depth) ancestors.pop();
|
||||
row.hidden = query ? !matches.has(path) : !!ancestors.at(-1)?.hidden;
|
||||
ancestors.push({depth, hidden: row.hidden || collapsed.has(path)});
|
||||
const toggle = row.querySelector('[data-public-tree-toggle]');
|
||||
if (toggle) { toggle.hidden = false; toggle.disabled = !!query; toggle.setAttribute('aria-expanded', String(!!query || !collapsed.has(path))); toggle.textContent = query || !collapsed.has(path) ? '▾' : '▸'; }
|
||||
if (!row.hidden) visible++;
|
||||
}
|
||||
document.querySelector('[data-public-tree-no-match]').hidden = visible > 0 || !query;
|
||||
}
|
||||
tree.addEventListener('click', event => {
|
||||
const toggle = event.target.closest('[data-public-tree-toggle]'); if (!toggle) return;
|
||||
const path = toggle.closest('[data-public-tree-path]').dataset.publicTreePath;
|
||||
collapsed.has(path) ? collapsed.delete(path) : collapsed.add(path); update();
|
||||
});
|
||||
tree.addEventListener('keydown', event => {
|
||||
if (event.altKey || event.ctrlKey || event.metaKey || !['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return;
|
||||
const row = event.target.closest('[data-public-tree-path]'); if (!row) return;
|
||||
const visible = rows.filter(item => !item.hidden), at = visible.indexOf(row), path = row.dataset.publicTreePath;
|
||||
let next;
|
||||
if (event.key === 'ArrowDown') next = visible[Math.min(at + 1, visible.length - 1)];
|
||||
if (event.key === 'ArrowUp') next = visible[Math.max(at - 1, 0)];
|
||||
if (event.key === 'Home') next = visible[0];
|
||||
if (event.key === 'End') next = visible.at(-1);
|
||||
if (event.key === 'ArrowLeft') { if (!filter.value.trim() && row.querySelector('[data-public-tree-toggle]') && !collapsed.has(path)) collapsed.add(path); else next = byPath.get(parent(path)); }
|
||||
if (event.key === 'ArrowRight') { if (collapsed.has(path)) collapsed.delete(path); else if (visible[at + 1]?.dataset.publicTreePath.startsWith(path + '/')) next = visible[at + 1]; }
|
||||
event.preventDefault(); update(); next?.querySelector('.public-tree-name').focus();
|
||||
});
|
||||
filter.addEventListener('input', update);
|
||||
document.querySelector('[data-public-expand]').addEventListener('click', () => { filter.value = ''; collapsed.clear(); update(); });
|
||||
document.querySelector('[data-public-collapse]').addEventListener('click', () => { filter.value = ''; rows.forEach(row => collapsed.add(row.dataset.publicTreePath)); update(); });
|
||||
document.querySelector('[data-public-tree-tools]').hidden = false; update();
|
||||
}
|
||||
window.addEventListener('pagehide', () => { observer?.disconnect(); for (const state of sections) state.controller.abort(); });
|
||||
window.addEventListener('pageshow', event => { if (event.persisted) location.reload(); });
|
||||
})();
|
||||
@@ -0,0 +1,69 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
const app = document.getElementById('tasks-app') || document.getElementById('calendar-app');
|
||||
if (!app) return;
|
||||
const calendar = app.id === 'calendar-app';
|
||||
if (calendar && !app.dataset.actor) return;
|
||||
const ja = document.documentElement.lang.startsWith('ja');
|
||||
const t = (en, jp) => ja ? jp : en;
|
||||
const api = '/_/api/v1/caldav-credentials';
|
||||
const el = (tag, text) => { const n = document.createElement(tag); if (text !== undefined) n.textContent = text; return n; };
|
||||
const button = el('button', '⇄'); button.type = 'button'; button.id = 'tasks-dav-open';
|
||||
button.title = button.ariaLabel = t('CalDAV / CLI access', 'CalDAV / CLI連携');
|
||||
app.querySelector(calendar ? '.calendar-toolbar' : '.tasks-toolbar .tasks-actions').append(button);
|
||||
const dialog = el('dialog'); dialog.id = 'tasks-dav-dialog'; dialog.setAttribute('aria-labelledby', 'tasks-dav-title');
|
||||
const header = el('header'); header.className = 'tasks-toolbar';
|
||||
const title = el('h2', t('CalDAV access', '予定・タスクのCalDAV連携')); title.id = 'tasks-dav-title';
|
||||
const close = el('button', '×'); close.type = 'button'; close.ariaLabel = t('Close', '閉じる'); header.append(title, close);
|
||||
const help = el('p', t('Choose calendars, tasks, or both. Calendar permissions still apply. Existing task passwords remain task-only. Wiki access is not granted. Use HTTPS.', '予定・タスクの対象を選んで発行します。予定には既存のカレンダー権限が適用されます。従来のパスワードはタスク専用のままです。Wikiへのアクセス権は付与されません。HTTPSで接続してください。'));
|
||||
const url = el('input'); url.readOnly = true; url.value = location.origin + '/_/api/v1/caldav/'; url.ariaLabel = 'CalDAV URL'; url.onclick = () => url.select();
|
||||
const form = el('form'); const label = el('input'); label.required = true; label.maxLength = 100; label.placeholder = t('Device / client name', '端末・クライアント名'); label.ariaLabel = label.placeholder;
|
||||
const access = el('select'); access.ariaLabel = t('Access', 'アクセス権限');
|
||||
for (const [value, text] of [['read', t('Read only', '読み取り専用')], ['write', t('Read / write', '読み書き')]]) { const option = el('option', text); option.value = value; if (value === 'write' && !calendar && app.dataset.writable !== 'true') option.disabled = true; access.append(option); }
|
||||
const scope = el('select'); scope.ariaLabel = t('Scope', '対象');
|
||||
const scopes = { tasks: t('Tasks only', 'タスクのみ'), calendar: t('Calendars only', '予定のみ'), all: t('Calendars and tasks', '予定とタスク') };
|
||||
for (const [value, text] of Object.entries(scopes)) { const option = el('option', text); option.value = value; option.selected = value === (calendar ? 'calendar' : 'tasks'); scope.append(option); }
|
||||
const days = el('select'); days.ariaLabel = t('Validity', '有効期間');
|
||||
for (const n of [30, 90, 365]) { const option = el('option', n + t(' days', '日間')); option.value = String(n); option.selected = n === 90; days.append(option); }
|
||||
const issue = el('button', t('Issue password', 'パスワードを発行')); issue.type = 'submit'; form.append(label, scope, access, days, issue);
|
||||
const compatLabel = el('label'); compatLabel.className = 'dav-compat-toggle';
|
||||
const compat = el('input'); compat.type = 'checkbox'; compat.id = 'tasks-dav-compat'; compat.setAttribute('aria-describedby', 'tasks-dav-compat-help');
|
||||
compatLabel.append(compat, document.createTextNode(t('OneTask compatibility (calendar-access advertisement)', 'OneTask互換モード(calendar-accessを宣言)')));
|
||||
const compatHelp = el('p', t('Opt in only for clients that require calendar-access. This is a limited implementation, not full RFC compliance. Task dates are date-only; recurrence, timezone definitions and alarms remain unsupported. Enabling this does not grant additional access.', 'calendar-accessを要求するクライアント向けの互換設定です。完全なRFC準拠ではありません。タスクの日付は日単位のみで、繰り返し・タイムゾーン定義・アラームは引き続き未対応です。アクセス権限は増えません。'));
|
||||
compatHelp.id = 'tasks-dav-compat-help'; compatHelp.className = 'dav-compat-help'; form.append(compatLabel, compatHelp);
|
||||
const secret = el('section'); secret.hidden = true;
|
||||
const status = el('p'); status.role = 'status';
|
||||
const tableWrap = el('div'); tableWrap.className = 'task-dav-table'; const table = el('table'); tableWrap.append(table);
|
||||
const note = el('p', t('Clients: chroncal, vdirsyncer + Todoman. Task start/due accept dates only. Recurring events and alarms cannot be created via DAV. Calendar events are deleted; tasks are archived.', '連携例:chroncal、vdirsyncer + Todoman。タスクの開始・期限は日付のみ対応。DAV経由の繰り返し予定・アラームの新規作成は未対応です。削除操作では予定は削除、タスクはアーカイブされます。'));
|
||||
dialog.append(header, help, url, form, secret, status, tableWrap, note); app.append(dialog);
|
||||
let busy = false, generation = 0;
|
||||
async function request(path = '', options = {}) {
|
||||
const res = await fetch(api + path, { credentials: 'same-origin', ...options, headers: { 'Content-Type': 'application/json', ...options.headers } });
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok || res.redirected) throw new Error(t('Request failed: ', '処理に失敗しました:') + (data.error || res.status));
|
||||
return data;
|
||||
}
|
||||
async function load() {
|
||||
const ticket = ++generation; const data = await request(); if (ticket !== generation || !dialog.open) return;
|
||||
table.replaceChildren(); const head = el('tr');
|
||||
[t('Name', '名称'), t('Scope', '対象'), t('Access', '権限'), t('Expires', '有効期限'), ''].forEach(v => head.append(el('th', v))); const thead = el('thead'); thead.append(head); table.append(thead); const body = el('tbody'); table.append(body);
|
||||
for (const c of data.items) {
|
||||
const row = el('tr'); row.append(el('td', c.label + (c.calendar_access_compat ? t(' · OneTask compatibility', ' · OneTask互換') : '')), el('td', scopes[c.scope || 'tasks']), el('td', c.write ? t('Read / write', '読み書き') : t('Read only', '読み取り専用')), el('td', new Date(c.expires_ms).toLocaleString()));
|
||||
const cell = el('td'), revoke = el('button', t('Revoke', '失効')); revoke.type = 'button';
|
||||
revoke.onclick = async () => { if (busy || !confirm(t('Revoke this password?', 'このパスワードを失効させますか?'))) return; busy = true; revoke.disabled = true; status.textContent = ''; try { await request('/' + encodeURIComponent(c.id), { method: 'DELETE' }); await load(); } catch (e) { status.textContent = e.message; } finally { busy = false; revoke.disabled = false; } };
|
||||
cell.append(revoke); row.append(cell); body.append(row);
|
||||
}
|
||||
}
|
||||
function hide() { if (busy) return; ++generation; dialog.close(); secret.replaceChildren(); secret.hidden = true; }
|
||||
close.onclick = hide; dialog.addEventListener('cancel', e => { e.preventDefault(); hide(); });
|
||||
button.onclick = async () => { if (dialog.open) return; status.textContent = ''; dialog.showModal(); try { await load(); } catch (e) { status.textContent = e.message; } };
|
||||
form.onsubmit = async e => {
|
||||
e.preventDefault(); if (busy) return; busy = true; issue.disabled = true; status.textContent = '';
|
||||
try {
|
||||
const data = await request('', { method: 'POST', body: JSON.stringify({ label: label.value, scope: scope.value, write: access.value === 'write', days: Number(days.value), calendar_access_compat: compat.checked }) });
|
||||
secret.replaceChildren(el('p', t('Shown only once. Save both values in your password manager before closing.', 'この画面を閉じると再表示できません。両方をパスワードマネージャーなどに保存してください。')));
|
||||
for (const [name, value] of [[t('Username (credential ID)', 'ユーザー名(認証情報ID)'), data.username], [t('Password', 'パスワード'), data.password]]) { const wrapper = el('label', name), field = el('input'); field.readOnly = true; field.value = value; field.autocomplete = 'off'; field.spellcheck = false; field.onclick = () => field.select(); wrapper.append(field); secret.append(wrapper); }
|
||||
secret.hidden = false; label.value = ''; await load();
|
||||
} catch (e) { status.textContent = e.message; } finally { busy = false; issue.disabled = false; }
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,35 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
const app=document.getElementById('tasks-app');if(!app)return;
|
||||
const ja=document.documentElement.lang.startsWith('ja'),t=(en,jp)=>ja?jp:en;
|
||||
const el=(tag,value)=>{const n=document.createElement(tag);if(value!==undefined)n.textContent=value;return n;};
|
||||
const panel=el('section');panel.id='tasks-focus';panel.ariaLabel='Pomodoro';
|
||||
const heading=el('strong','Pomodoro'),state=el('span'),clock=el('output','25:00');state.id='tasks-focus-state';clock.id='tasks-focus-clock';clock.setAttribute('aria-live','off');
|
||||
const phase=el('select');phase.ariaLabel=t('Phase','集中・休憩');[['focus',t('Focus','集中')],['break',t('Break','休憩')]].forEach(([v,label])=>{const o=el('option',label);o.value=v;phase.append(o);});
|
||||
const minutes=el('input');minutes.type='number';minutes.min=1;minutes.max=180;minutes.value=25;minutes.ariaLabel=t('Minutes','分');
|
||||
const buttons=el('div');buttons.className='tasks-actions';const actions={};[['start','▶',t('Start','開始')],['pause','Ⅱ',t('Pause','一時停止')],['resume','▶',t('Resume','再開')],['complete','✓',t('Finish session (not task)','セッションを終了(タスクは未完了のまま)')],['cancel','×',t('Cancel session','セッションを中断')]].forEach(([key,icon,label])=>{const b=el('button',icon);b.type='button';b.title=b.ariaLabel=label;b.dataset.action=key;b.addEventListener('click',()=>command(key));actions[key]=b;buttons.append(b);});
|
||||
const link=el('a',t('Linked task','関連タスク'));link.hidden=true;const status=el('small');status.role='status';
|
||||
panel.append(heading,state,clock,phase,minutes,el('span',t('min','分')),buttons,link,status);app.querySelector('.tasks-workspace').prepend(panel);
|
||||
let current=null,loading=false,pendingStart=null,chosenTask='',serverAt=Date.now(),perfAt=performance.now(),ready=false,draftChoice=false;
|
||||
const writable=app.dataset.writable==='true';
|
||||
function remaining(){return !current?Number(minutes.value)*60000:current.state==='running'?Math.max(0,Math.min(current.remaining_ms,current.deadline_ms-serverAt-(performance.now()-perfAt))):current.remaining_ms;}
|
||||
function render(){const active=current&&['running','paused'].includes(current.state);const ms=remaining(),secs=Math.ceil(ms/1000);clock.textContent=String(Math.floor(secs/60)).padStart(2,'0')+':'+String(secs%60).padStart(2,'0');
|
||||
phase.disabled=minutes.disabled=!!active||loading||!writable||!!pendingStart;
|
||||
for(const [key,b]of Object.entries(actions)){b.disabled=loading||!ready||!writable;b.hidden=key==='start'?!!active:key==='pause'?current?.state!=='running':key==='resume'?current?.state!=='paused':!active;}
|
||||
if(current?.state==='running'&&ms<=0)actions.pause.disabled=true;
|
||||
link.hidden=!current?.task_uuid;if(current?.task_uuid)link.href='/v/plan/task/'+encodeURIComponent(current.task_uuid);
|
||||
panel.dataset.state=current?.state||'idle';
|
||||
state.textContent=({running:t('Running','実行中'),paused:t('Paused','一時停止'),completed:t('Completed','終了'),cancelled:t('Cancelled','中断')})[current?.state]||'';
|
||||
}
|
||||
function accept(data){const previous=current;current=data.item;const active=current&&['running','paused'].includes(current.state);if(active)draftChoice=false;else if(draftChoice)current=null;serverAt=data.server_now_ms;perfAt=performance.now();ready=true;if(current&&(active||previous?.uuid!==current.uuid)){phase.value=current.phase;minutes.value=current.duration_ms/60000;}render();if(previous?.uuid!==current?.uuid||previous?.version!==current?.version)app.dispatchEvent(new Event('task-today-refresh'));}
|
||||
async function request(options={}){const r=await fetch('/_/api/v1/extension/organizer.tasks/focus',{credentials:'same-origin',signal:AbortSignal.timeout(10000),...options,headers:{'Content-Type':'application/json'}});const d=await r.json().catch(()=>({}));if(!r.ok||r.redirected){const err=new Error(r.status===412?t('Session changed, or another Domain has an active timer. Review before retrying.','別の画面で変更されたか、他ドメインでタイマーが動作中です。状態を確認してください。'):t('Timer unavailable. Check permissions and extension settings.','タイマーを利用できません。権限や拡張の設定を確認してください。'));err.status=r.status;throw err;}return d;}
|
||||
async function load(){if(loading)return;loading=true;try{accept(await request());}catch(e){status.textContent=e.message;ready=false;}finally{loading=false;render();}}
|
||||
async function command(action){if(loading||!ready)return;if(action==='cancel'&&!confirm(t('Cancel this session?','このセッションを中断しますか?')))return;
|
||||
let payload;if(action==='start'){if(!minutes.reportValidity())return;if(!pendingStart)pendingStart={uuid:crypto.randomUUID(),action,task_uuid:chosenTask,phase:phase.value,minutes:Number(minutes.value),version:0};payload=pendingStart;}else{if(!current)return;payload={uuid:current.uuid,action,version:current.version};}
|
||||
loading=true;status.textContent='';render();try{accept(await request({method:'POST',body:JSON.stringify(payload)}));pendingStart=null;chosenTask='';status.textContent=t('Saved','保存しました');}catch(e){status.textContent=e.message;if(e.status>=400&&e.status<500){pendingStart=null;chosenTask='';}try{accept(await request());if(current?.uuid===pendingStart?.uuid){pendingStart=null;chosenTask='';}}catch{ready=false;}}finally{loading=false;render();}
|
||||
}
|
||||
phase.addEventListener('change',()=>{minutes.value=phase.value==='break'?5:25;if(!current||!['running','paused'].includes(current.state)){current=null;draftChoice=true;}render();});minutes.addEventListener('input',()=>{if(!current||!['running','paused'].includes(current.state)){current=null;draftChoice=true;}render();});
|
||||
app.addEventListener('task-focus',async e=>{await load();if(pendingStart||(current&&['running','paused'].includes(current.state))){status.textContent=t('Resolve the pending request, or finish the current session first.','未完了の開始要求を再試行するか、現在のセッションを終了してください。');}else{chosenTask=e.detail.uuid;phase.value='focus';minutes.value=25;await command('start');}panel.scrollIntoView({block:'nearest',behavior:'smooth'});});
|
||||
document.addEventListener('visibilitychange',()=>{if(!document.hidden)load();});
|
||||
setInterval(()=>{if(!document.hidden)render();},1000);setInterval(()=>{if(!document.hidden)load();},30000);render();load();
|
||||
})();
|
||||
@@ -0,0 +1,75 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
if(window.PagesWikiTaskRows)return;
|
||||
const ja=document.documentElement.lang.startsWith('ja'),t=(en,jp)=>ja?jp:en,api='/_/api/v1/extension/organizer.tasks/items';
|
||||
const el=(tag,value,cls)=>{const n=document.createElement(tag);if(value!==undefined)n.textContent=value;if(cls)n.className=cls;return n;};
|
||||
const dirtyRows=new Set();
|
||||
const expandedRows=new Set();
|
||||
const labels={title:t('Title','件名'),status:t('Status','状態'),planned_on:t('Planned','取り組む日'),due_on:t('Due','期限'),review_on:t('Review','見直す日'),start_on:t('Work starts','工程開始'),end_on:t('Work ends','工程終了')};
|
||||
const header=document.createElement('div');header.className='task-inline-header';header.setAttribute('aria-hidden','true');
|
||||
['',...Object.values(labels),t('Actions','操作')].forEach(label=>header.append(el('span',label)));
|
||||
document.getElementById('tasks-list')?.before(header);
|
||||
async function request(url,options={}){const r=await fetch(url,{credentials:'same-origin',signal:AbortSignal.timeout(15000),...options,headers:{'Content-Type':'application/json',...options.headers}});const data=await r.json().catch(()=>({}));if(!r.ok||r.redirected){const messages={note_setup:t('Set a project and its related Wiki page first (project settings → note subfolder).','先にプロジェクトを選び、その設定で関連Wikiページとメモのサブ階層を指定してください。'),note_exists:t('A page already exists here. Link it explicitly in task details, or change the title.','同じPathのページが既にあります。タスクの詳細から明示的に関連付けるか、件名を変更してください。')};throw Error(messages[data.error]||(r.status===412?t('Changed elsewhere. Input kept; reload to discard it.','別の画面で変更されています。入力は保持しています。「再読込」で破棄して最新版を取得できます。'):t('Unable to save. Check permissions, dates and reminder requirements.','保存できません。権限・日付の順序・通知に必要な日付を確認してください。')));}return data;}
|
||||
function create(initial,options={}){
|
||||
let item={...initial},draft={},saving=false,childDraft=null;const writable=options.writable!==false;
|
||||
const row=el('article',undefined,'task-inline-row');row.dataset.taskId=item.uuid;row.setAttribute('role','listitem');
|
||||
const line=el('div',undefined,'task-inline-main'), dates=el('div',undefined,'task-inline-dates'), actions=el('div',undefined,'tasks-actions'),status=el('span',undefined,'task-inline-status');status.role='status';
|
||||
const inputs={};
|
||||
function message(text,state='error'){status.textContent=text;status.dataset.state=state;}
|
||||
function field(key,type,container){const label=el('label'),n=el(type==='select'?'select':'input');label.append(el('span',labels[key]));if(type!=='select')n.type=type;else ['todo','doing','done','cancelled'].forEach((v,i)=>{const o=el('option',[t('To do','未着手'),t('Doing','進行中'),t('Done','完了'),t('Cancelled','取りやめ')][i]);o.value=v;n.append(o);});n.name=key;n.value=item[key]||'';n.disabled=!writable;n.ariaLabel=labels[key];if(key==='title'){n.required=true;n.maxLength=300;label.className='task-inline-title';}inputs[key]=n;label.append(n);container.append(label);
|
||||
n.addEventListener('input',()=>{draft[key]=n.value;dirtyRows.add(row);});n.addEventListener('change',()=>{draft[key]=n.value;dirtyRows.add(row);flush();});
|
||||
n.addEventListener('keydown',e=>{if(e.key==='Enter'){e.preventDefault();n.blur();}if(e.key==='Escape'){e.preventDefault();n.value=item[key]||'';draft[key]=n.value;flush();}});}
|
||||
field('title','text',line);field('status','select',line);['planned_on','due_on','review_on','start_on','end_on'].forEach(k=>field(k,'date',dates));
|
||||
const complete=el('button','○');complete.type='button';complete.title=complete.ariaLabel=t('Toggle completion','完了を切り替え');complete.disabled=!writable;complete.dataset.action='complete';complete.addEventListener('click',()=>{draft.status=item.status==='done'?'todo':'done';inputs.status.value=draft.status;dirtyRows.add(row);flush();});line.prepend(complete);
|
||||
const parent=el('a','↳');parent.title=parent.ariaLabel=t('Parent task','親タスク');parent.hidden=!item.parent_uuid;if(item.parent_uuid){row.classList.add('task-is-child');parent.href='/v/plan/task/'+encodeURIComponent(item.parent_uuid);}row.append(parent,line,dates,actions,status);
|
||||
function button(label,icon,fn){const b=el('button',icon);b.type='button';b.title=b.ariaLabel=label;b.addEventListener('click',fn);actions.append(b);return b;}
|
||||
const detail=el('a','⋯');detail.title=detail.ariaLabel=t('Details','詳細');detail.href='/v/plan/task/'+item.uuid;detail.dataset.action='detail';if(options.onDetail)detail.addEventListener('click',e=>{if(e.ctrlKey||e.metaKey||e.shiftKey||e.button)return;e.preventDefault();if(blocked())return;options.onDetail(item.uuid);});actions.append(detail);
|
||||
function blocked(){if(saving||dirtyRows.has(row)){message(t('Save or reload this row first.','先にこの行の変更を保存するか再読込してください。'));return true;}return false;}
|
||||
button(t('Calendar time blocks','カレンダーへ時間枠を追加'),'▦',async()=>{if(blocked())return;try{const d=await request(api+'/'+item.uuid);document.getElementById('tasks-app')?.dispatchEvent(new CustomEvent('task-plan',{detail:d.item}));}catch(e){message(e.message);}}).dataset.action='plan';
|
||||
const reset=button(t('Reload row (discard edits)','行を再読込(編集を破棄)'),'↻',async()=>{if(saving)return;if(dirtyRows.has(row)&&!confirm(t('Discard changes in this row?','この行の変更を破棄しますか?')))return;try{const d=await request(api+'/'+item.uuid);item=d.item;draft={};dirtyRows.delete(row);Object.keys(inputs).forEach(k=>inputs[k].value=item[k]||'');paint();message('','idle');}catch(e){message(e.message);}});reset.dataset.action='reload';
|
||||
function buttonMore(cursor){const more=el('button',t('More subtasks','続きのサブタスク'));more.type='button';more.className='task-children-more';more.addEventListener('click',async()=>{if(dirtyRows.size)return;more.disabled=true;try{const d=await request(api+'?'+new URLSearchParams({view:'family',parent:item.uuid,limit:100,before:cursor}));if(dirtyRows.size)return;d.items.forEach(c=>more.before(create(c,{...options,initialChildren:[],context:false,nested:true})));if(d.next)more.replaceWith(buttonMore(d.next));else more.remove();}catch(e){message(e.message);}finally{more.disabled=false;}});return more;}
|
||||
const children=el('div',undefined,'task-inline-children');children.hidden=true;children.role='list';children.ariaLabel=t('Subtasks','サブタスク');row.append(children);
|
||||
let expand;function showChildren(show){children.hidden=!show;if(show)expandedRows.add(item.uuid);else expandedRows.delete(item.uuid);if(expand){expand.textContent=show?'▾':'▸';expand.setAttribute('aria-expanded',String(show));expand.title=expand.ariaLabel=show?t('Hide subtasks','サブタスクを閉じる'):t('Show subtasks','サブタスクを表示');}}
|
||||
if(!item.parent_uuid){
|
||||
let childRequest=0,loadAll;
|
||||
async function loadChildren(){
|
||||
if(blocked()||dirtyRows.size)return;
|
||||
const ticket=++childRequest;showChildren(true);
|
||||
try{const d=await request(api+'?'+new URLSearchParams({view:'family',parent:item.uuid,limit:100}));
|
||||
if(ticket!==childRequest||dirtyRows.size||!row.isConnected)return;
|
||||
children.replaceChildren();d.items.forEach(c=>children.append(create(c,{...options,initialChildren:[],context:false,nested:true})));
|
||||
if(!d.items.length)children.append(el('small',t('No subtasks.','サブタスクはありません。')));
|
||||
if(d.next)children.append(buttonMore(d.next));
|
||||
if(loadAll)loadAll.hidden=true;
|
||||
}catch(e){message(e.message);}
|
||||
}
|
||||
expand=button(t('Show subtasks','サブタスクを表示'),'▸',()=>{if(blocked()||dirtyRows.size)return;if(!children.hidden){childRequest++;showChildren(false);}else loadChildren();});expand.dataset.action='children';expand.setAttribute('aria-expanded','false');
|
||||
if(options.initialChildren?.length){loadAll=button(t('Load all subtasks, including other dates','別の日付も含めてすべてのサブタスクを表示'),'⇊',loadChildren);loadAll.dataset.action='children-all';}
|
||||
if(writable&&!item.archived){const add=el('form',undefined,'task-child-capture'),input=el('input'),submit=el('button','+');input.required=true;input.maxLength=300;input.placeholder=input.ariaLabel=t('New subtask','サブタスクを追加');submit.type='submit';submit.title=t('Add subtask','サブタスクを追加');add.append(input,submit);add.hidden=true;row.append(add);button(t('Add subtask','サブタスクを追加'),'+',()=>{if(blocked())return;add.hidden=!add.hidden;if(!add.hidden)input.focus();}).dataset.action='add-child';
|
||||
input.addEventListener('input',()=>{if(input.value)dirtyRows.add(add);else dirtyRows.delete(add);});
|
||||
add.addEventListener('submit',async e=>{e.preventDefault();if(submit.disabled||blocked())return;const title=input.value.trim();if(!title)return;submit.disabled=input.disabled=true;if(!childDraft||childDraft.title!==title)childDraft={uuid:crypto.randomUUID(),kind:'task',title,notes:'',parent_uuid:item.uuid,project_uuid:item.project_uuid,status:'todo',bucket:item.bucket,priority:item.priority,estimate_minutes:0,archived:false,version:0};try{const d=await request(api,{method:'POST',body:JSON.stringify(childDraft)});childDraft=null;childRequest++;input.value='';dirtyRows.delete(add);showChildren(true);children.querySelector('small')?.remove();children.append(create(d.item,{...options,initialChildren:[],context:false,nested:true}));document.getElementById('tasks-app')?.dispatchEvent(new Event('task-today-refresh'));}catch(err){message(err.message);}finally{submit.disabled=input.disabled=false;input.focus();}});
|
||||
}
|
||||
}
|
||||
if(options.context){row.dataset.context='true';const badge=el('small',t('Parent','親'),'task-context-badge');badge.title=t('Context only: this parent is outside the current filter.','親子関係を示すために表示しています。親自体は現在の条件の対象外です。');inputs.title.parentElement.append(badge);}
|
||||
async function openNote(edit){if(blocked()||dirtyRows.size)return;try{let data=await request(api+'/'+item.uuid+'/note');if(!data.linked){
|
||||
if(data.exists){message(t('A page already exists here. Link it in task details.','同じPathのページが既にあります。タスクの詳細から関連付けてください。'));return;}
|
||||
if(!data.writable){message(t('No permission to create this Wiki note.','このWikiメモを作成する権限がありません。'));return;}
|
||||
if(!confirm(t('Create a Wiki note at ','次のPathにWikiメモを作成します:')+data.path+'\n\n'+t('Its visibility follows the Wiki path, not this private task.','公開範囲は個人タスクではなく、WikiのPathの設定に従います。')))return;
|
||||
data=await request(api+'/'+item.uuid+'/note',{method:'POST',headers:{'If-Match':'"'+item.version+'"'},body:JSON.stringify({path:data.path})});item=data.item;edit=true;
|
||||
}
|
||||
if(edit&&!data.writable){message(t('This Wiki note is read-only.','このWikiメモは読み取り専用です。'));return;}location.assign(edit?data.edit_url:data.url);
|
||||
}catch(e){message(e.message);}}
|
||||
button(t('View Wiki note (create if missing)','Wikiメモを表示(未作成なら新規作成)'),'▤',()=>openNote(false)).dataset.action='note-view';
|
||||
const editNote=button(t('Edit / create Wiki note','Wikiメモを編集・新規作成'),'✎',()=>openNote(true));editNote.dataset.action='note-edit';editNote.disabled=!writable;
|
||||
if(options.planDate&&writable){button(t('Schedule for ','取り組む日を変更:')+options.planDate,'→',()=>{if(blocked())return;draft.planned_on=options.planDate;inputs.planned_on.value=draft.planned_on;dirtyRows.add(row);flush();}).dataset.action='schedule-day';}
|
||||
const estimate=el('small',undefined,'task-inline-estimate');actions.prepend(estimate);
|
||||
function paint(){row.dataset.done=String(['done','cancelled'].includes(item.status));complete.textContent=item.status==='done'?'✓':'○';row.dataset.archived=String(item.archived);estimate.textContent=item.estimate_minutes?item.estimate_minutes+' min':'';}
|
||||
async function flush(){if(saving||!writable||!Object.keys(draft).length)return;if(!inputs.title.reportValidity())return;saving=true;row.setAttribute('aria-busy','true');message(t('Saving…','保存中…'),'saving');try{while(Object.keys(draft).length){const patch={...draft};const fresh=await request(api+'/'+item.uuid);const saved=await request(api+'/'+item.uuid,{method:'PUT',headers:{'If-Match':'"'+item.version+'"'},body:JSON.stringify({...fresh.item,...patch})});item=saved.item;for(const [k,v]of Object.entries(patch)){if(draft[k]===v)delete draft[k];}paint();}dirtyRows.delete(row);message(t('Saved','保存しました'),'saved');document.getElementById('tasks-app')?.dispatchEvent(new Event('task-today-refresh'));options.onChanged?.(item,row);}catch(e){message(e.message);}finally{saving=false;row.removeAttribute('aria-busy');}}
|
||||
const restoreExpanded=expandedRows.has(item.uuid);
|
||||
if(options.initialChildren?.length){options.initialChildren.forEach(c=>children.append(create(c,{...options,initialChildren:[],context:false,nested:true})));showChildren(true);}
|
||||
else if(expand&&restoreExpanded){queueMicrotask(()=>{if(row.isConnected)expand.click();});}
|
||||
paint();return row;
|
||||
}
|
||||
window.addEventListener('beforeunload',e=>{if(dirtyRows.size){e.preventDefault();e.returnValue='';}});
|
||||
window.PagesWikiTaskRows={create,request,hasDirty:()=>dirtyRows.size>0};
|
||||
})();
|
||||
@@ -0,0 +1,2 @@
|
||||
(()=>{'use strict';if(window.pageswikiTaskNav)return;window.pageswikiTaskNav=true;const button=document.querySelector('[data-tasks-today-launch]'),dialog=document.querySelector('[data-tasks-today-dialog]'),list=dialog?.querySelector('[data-tasks-today-list]');if(!button||!dialog)return;const ja=document.documentElement.lang.startsWith('ja');let controller;
|
||||
button.onclick=async()=>{dialog.showModal();list.textContent=ja?'読み込み中…':'Loading…';controller?.abort();controller=new AbortController();try{const r=await fetch('/_/api/v1/extension/organizer.tasks/items?view=today&limit=100',{credentials:'same-origin',signal:controller.signal});if(!r.ok)throw Error();const data=await r.json();list.replaceChildren();for(const item of data.items){const a=document.createElement('a');a.className='notification-item task-nav-item';a.href='/v/plan/task/'+item.uuid;const state=document.createElement('span');state.textContent=item.status==='doing'?'◐':'○';const title=document.createElement('strong');title.textContent=(item.parent_uuid?'↳ ':'')+item.title;const date=document.createElement('time');date.textContent=item.due_on||item.planned_on;a.append(state,title,date);list.append(a);}if(!data.items.length)list.textContent=ja?'今日のタスクはありません。':'No tasks for today.';if(data.next){const a=document.createElement('a');a.href='/v/plan/today';a.textContent=ja?'さらに表示':'Show more';list.append(a);}}catch(e){if(e.name!=='AbortError')list.textContent=ja?'取得できませんでした。':'Unable to load tasks.';}};dialog.querySelector('[data-tasks-today-close]').onclick=()=>dialog.close();dialog.addEventListener('click',e=>{if(e.target===dialog)dialog.close();});dialog.addEventListener('close',()=>controller?.abort());})();
|
||||
@@ -0,0 +1,69 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
const app=document.getElementById('tasks-app');if(!app)return;
|
||||
const ja=document.documentElement.lang.startsWith('ja'), text=(en,jp)=>ja?jp:en;
|
||||
const root='/_/api/v1/extension/organizer.tasks/', writable=app.dataset.writable==='true';
|
||||
const el=(tag,value)=>{const n=document.createElement(tag);if(value!==undefined)n.textContent=value;return n;};
|
||||
const dialog=el('dialog');dialog.id='tasks-plan-dialog';dialog.setAttribute('aria-labelledby','tasks-plan-title');
|
||||
const header=el('header');header.className='tasks-toolbar';const title=el('h2',text('Calendar time blocks','カレンダーの時間枠'));title.id='tasks-plan-title';
|
||||
const close=el('button','×');close.type='button';close.ariaLabel=text('Close','閉じる');header.append(title,close);
|
||||
const help=el('p',text('Private local calendars only. Event titles include the task title; sharing this calendar later exposes that title. Notes are not copied. Unlink keeps the event.','自分専用・非公開のローカルカレンダーのみ。予定名にタスクの件名を含めます。後からカレンダーを公開・共有すると件名も見えます。メモはコピーせず、関連を解除しても予定は残ります。'));help.className='tasks-muted';
|
||||
const form=el('form'), inputs={}, fields=el('div');fields.className='task-plan-fields';
|
||||
function field(name,label,type){const wrap=el('label',label),input=el(type==='select'?'select':'input');if(type!=='select')input.type=type;input.name=name;input.required=true;inputs[name]=input;wrap.append(input);fields.append(wrap);return input;}
|
||||
const select=field('calendar_uuid',text('Calendar','カレンダー'),'select');
|
||||
const start=field('start',text('Start','開始'),'datetime-local'),end=field('end',text('End','終了'),'datetime-local');start.step=end.step=60;
|
||||
const zone=el('small'),save=el('button',text('Add time block','時間枠を追加'));save.type='submit';form.append(fields,zone,save);
|
||||
const status=el('p');status.role='status';status.setAttribute('aria-live','polite');
|
||||
const list=el('div');list.id='tasks-plan-list';const more=el('button',text('Load more','続きを表示'));more.type='button';more.hidden=true;
|
||||
const refresh=el('button','↻');refresh.type='button';refresh.ariaLabel=refresh.title=text('Refresh','更新');header.append(refresh);
|
||||
dialog.append(header,help,form,status,list,more);app.append(dialog);
|
||||
let task,ticket=0,busy=false,mutating=false,controller=null,draft=null,items=[],offset=0,timezone=app.dataset.timezone;
|
||||
const message=code=>({conflict:text('Changed elsewhere, or this request was unlinked. Reopen the task to review it.','別の画面で変更されたか、関連付けが解除されています。タスクを開き直してください。'),forbidden:text('This calendar must be private, local and owned by you.','自分所有の非公開・ローカルカレンダーのみ利用できます。'),not_found:text('Unavailable. Check the calendar and extension settings.','利用できません。カレンダーや拡張機能の設定を確認してください。'),invalid:text('Check dates (up to 24 hours), task status and timezone.','日時(24時間以内)・タスクの状態・タイムゾーンを確認してください。')}[code]||text('Request failed. Retry using the same request, or reopen this dialog to inspect pending blocks.','処理に失敗しました。同じ要求を再試行するか、画面を開き直して未完了の関連付けを確認してください。'));
|
||||
async function request(path,options={}){
|
||||
const res=await fetch(root+path,{credentials:'same-origin',signal:AbortSignal.any([controller.signal,AbortSignal.timeout(15000)]),...options,headers:{'Content-Type':'application/json',...options.headers}});
|
||||
if(res.status===204)return{};const data=await res.json().catch(()=>({}));if(!res.ok||res.redirected)throw new Error(message(data.error||(res.status===404?'not_found':'')));return data;
|
||||
}
|
||||
function localValue(date){const p=new Intl.DateTimeFormat('en-CA',{timeZone:timezone,year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(date);const get=k=>p.find(v=>v.type===k).value;return `${get('year')}-${get('month')}-${get('day')}T${get('hour')}:${get('minute')}`;}
|
||||
function display(date){return new Intl.DateTimeFormat(ja?'ja-JP':'en-GB',{timeZone:timezone,month:'short',day:'numeric',hour:'2-digit',minute:'2-digit'}).format(new Date(date));}
|
||||
function lock(value){busy=value;close.disabled=value&&mutating;refresh.disabled=more.disabled=value;save.disabled=value;Object.values(inputs).forEach(n=>n.disabled=value||!!draft);list.querySelectorAll('button').forEach(n=>n.disabled=value||!writable);}
|
||||
function dismiss(){if(mutating)return;ticket++;controller?.abort();dialog.close();draft=null;}
|
||||
close.addEventListener('click',dismiss);dialog.addEventListener('cancel',e=>{e.preventDefault();dismiss();});
|
||||
async function appendRows(gen){
|
||||
const batch=items.slice(offset,offset+10);offset+=batch.length;more.hidden=offset>=items.length;
|
||||
for(const b of batch){
|
||||
if(gen!==ticket||!dialog.open)return;
|
||||
const row=el('section');row.className='task-plan-row';row.dataset.uuid=b.uuid;const summary=el('span',display(b.start)+' – '+display(b.end));row.append(summary);list.append(row);
|
||||
try{
|
||||
const current=await request('blocks/'+b.uuid);if(gen!==ticket)return;
|
||||
if(current.available){const a=el('a',display(current.start)+' – '+display(current.end));a.href=current.href;summary.replaceWith(a);}
|
||||
else summary.textContent=text('Event unavailable (removed, shared, or calendar unavailable)','予定を参照できません(削除・共有・カレンダー利用不可)');
|
||||
if(b.state==='pending')row.append(el('small',text('Pending request','未完了の連携要求')));
|
||||
}catch(e){summary.textContent=e.message;}
|
||||
if(!writable)continue;
|
||||
const actions=el('div');actions.className='tasks-actions';
|
||||
if(b.state==='pending'){const retry=el('button',text('Retry','再試行'));retry.type='button';retry.addEventListener('click',()=>mutate(()=>request('blocks',{method:'POST',body:JSON.stringify({uuid:b.uuid,task_uuid:task.uuid,task_version:task.version,calendar_uuid:b.calendar_uuid,start:b.start,end:b.end})})));actions.append(retry);}
|
||||
const unlink=el('button',text('Unlink','関連を解除'));unlink.type='button';unlink.addEventListener('click',()=>{if(confirm(text('Unlink? The calendar event will be kept.','関連を解除しますか? カレンダーの予定は残ります。')))mutate(()=>request('blocks/'+b.uuid,{method:'DELETE'}));});actions.append(unlink);row.append(actions);
|
||||
}
|
||||
}
|
||||
async function reload(){const gen=++ticket;status.textContent=text('Loading…','読み込み中…');const data=await request('blocks?task_uuid='+encodeURIComponent(task.uuid));if(gen!==ticket)return;items=data.items;offset=0;list.replaceChildren();await appendRows(gen);if(gen===ticket)status.textContent=items.length?'':text('No time blocks yet.','時間枠はまだありません。');}
|
||||
async function mutate(fn){if(busy)return;mutating=true;lock(true);status.textContent='';try{await fn();app.dispatchEvent(new Event('task-today-refresh'));mutating=false;lock(true);await reload();}catch(e){status.textContent=e.message;}finally{mutating=false;lock(false);}}
|
||||
more.addEventListener('click',async()=>{if(busy)return;lock(true);try{await appendRows(ticket);}finally{lock(false);}});
|
||||
refresh.addEventListener('click',()=>mutate(async()=>{}));
|
||||
form.addEventListener('submit',e=>{e.preventDefault();if(busy||!task)return;
|
||||
if(!draft)draft={uuid:crypto.randomUUID(),task_uuid:task.uuid,task_version:task.version,calendar_uuid:select.value,start:start.value,end:end.value,timezone};
|
||||
mutate(async()=>{await request('blocks',{method:'POST',body:JSON.stringify(draft)});draft=null;});
|
||||
});
|
||||
app.addEventListener('task-plan',async e=>{
|
||||
if(dialog.open||busy)return;controller=new AbortController();task=e.detail;draft=null;list.replaceChildren();more.hidden=true;form.hidden=true;status.textContent=text('Loading…','読み込み中…');dialog.showModal();const gen=++ticket;lock(true);
|
||||
try{const data=await request('calendars');if(gen!==ticket)return;timezone=data.timezone;zone.textContent=timezone;select.replaceChildren();data.items.forEach(c=>{const o=el('option',c.name+' ('+c.pretty_name+')');o.value=c.id;select.append(o);});
|
||||
const now=new Date(Math.ceil(Date.now()/300000)*300000);start.value=localValue(now);end.value=localValue(new Date(now.getTime()+Math.min(1440,task.estimate_minutes||25)*60000));
|
||||
const plannedDate=app.dataset.view==='day'?app.dataset.selectedDate:task.planned_on;
|
||||
if(/^\d{4}-\d{2}-\d{2}$/.test(plannedDate||'')){
|
||||
start.value=plannedDate+start.value.slice(10);
|
||||
const wallTime=new Date(start.value+':00Z');wallTime.setUTCMinutes(wallTime.getUTCMinutes()+Math.min(1440,task.estimate_minutes||25));end.value=wallTime.toISOString().slice(0,16);
|
||||
}
|
||||
form.hidden=!writable||task.archived||['done','cancelled'].includes(task.status)||!data.items.length;
|
||||
await reload();if(!data.items.length)status.textContent=text('Create a private local calendar in Calendar settings first.','カレンダーの設定で、自分専用の非公開ローカルカレンダーを作成してください。');
|
||||
}catch(err){status.textContent=err.message;}finally{lock(false);}
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,2 @@
|
||||
(()=>{'use strict';const root=document.getElementById('task-schedule');if(!root)return;const ja=document.documentElement.lang.startsWith('ja'),t=(en,jp)=>ja?jp:en,month=root.dataset.month,project=new URLSearchParams(location.search).get('project')||'',[year,m]=month.split('-').map(Number),days=new Date(Date.UTC(year,m,0)).getUTCDate();const url=(y,n)=>'/v/plan/tasks/schedule/'+y+'/'+String(n).padStart(2,'0')+(project?'?project='+encodeURIComponent(project):'');const prev=new Date(Date.UTC(year,m-2,1)),next=new Date(Date.UTC(year,m,1));root.querySelector('[data-previous]').href=url(prev.getUTCFullYear(),prev.getUTCMonth()+1);root.querySelector('[data-next]').href=url(next.getUTCFullYear(),next.getUTCMonth()+1);root.querySelector('h1').textContent=t('Day schedule','日割り工程表');const input=root.querySelector('input');input.value=month;input.onchange=()=>{if(input.value){const [y,n]=input.value.split('-');location.href=url(y,n);}};root.querySelector('[data-help]').textContent=t('Inclusive work dates, independent of hourly calendar blocks. Change dates inline in the task list. Up to 200 items per month.','工程の開始日・終了日(両端を含む)です。時間枠のカレンダーとは独立しています。日付はタスク一覧で編集できます。月あたり最大200件。');const grid=root.querySelector('[role=table]');grid.style.setProperty('--days',days);const node=(tag,text,cls)=>{const n=document.createElement(tag);n.textContent=text;if(cls)n.className=cls;return n;};const head=node('div','','task-schedule-row');head.append(node('strong',t('Task / subtask','タスク/サブタスク')));for(let i=1;i<=days;i++){const d=node('span',i);d.title=new Date(Date.UTC(year,m-1,i)).toLocaleDateString(undefined,{weekday:'long',timeZone:'UTC'});head.append(d);}grid.append(head);
|
||||
fetch('/_/api/v1/extension/organizer.tasks/schedule?'+new URLSearchParams({month,project}),{credentials:'same-origin',signal:AbortSignal.timeout(15000)}).then(async r=>{if(!r.ok)throw Error();return r.json();}).then(data=>{for(const item of data.items){const row=node('div','','task-schedule-row'),a=node('a',(item.parent_uuid?'↳ ':'')+item.title);a.href='/v/plan/task/'+item.uuid;a.title=item.title;row.append(a);const start=item.start_on||item.end_on,end=item.end_on||item.start_on,left=start<month+'-01'?1:Number(start.slice(-2)),right=end>month+'-'+days?days:Number(end.slice(-2));const bar=node('a',start+' – '+end,'task-schedule-bar');bar.href=a.href;bar.title=item.title+' · '+bar.textContent;bar.style.gridColumn=(left+1)+' / '+(right+2);bar.dataset.status=item.status;row.append(bar);grid.append(row);}root.querySelector('[role=status]').textContent=data.partial?t('First 200 items shown. Filter by project.','200件まで表示しています。プロジェクトで絞り込んでください。'):data.items.length?'':t('No scheduled tasks.','工程日が設定されたタスクはありません。');}).catch(()=>{root.querySelector('[role=status]').textContent=t('Unable to load schedule.','工程表を取得できません。');});})();
|
||||
@@ -0,0 +1,36 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
const app=document.getElementById('tasks-app');if(!app||app.dataset.view!=='today')return;
|
||||
const ja=document.documentElement.lang.startsWith('ja'),t=(en,jp)=>ja?jp:en;
|
||||
const el=(tag,value)=>{const n=document.createElement(tag);if(value!==undefined)n.textContent=value;return n;};
|
||||
const panel=el('section');panel.id='tasks-day';panel.ariaLabel=t('Today overview','今日の見通し');
|
||||
const cards=el('div');cards.className='task-day-cards';const stats={};
|
||||
[['estimate',t('Remaining task estimates','未完了タスクの見積もり')],['allocated',t('Calendar time blocks','今日の時間枠')],['focus',t('Recorded focus time','記録済みの集中時間')]].forEach(([key,label])=>{const card=el('div');const value=el('strong','—');stats[key]=value;card.append(el('small',label),value);cards.append(card);});
|
||||
const note=el('p');note.className='tasks-muted';note.role='status';
|
||||
const details=el('details'),heading=el('summary',t('Today’s time blocks','今日の時間枠を表示')),list=el('ol');list.id='tasks-day-blocks';details.append(heading,list);
|
||||
panel.append(cards,note,details);document.getElementById('tasks-help').after(panel);
|
||||
let busy=false,queued=false,generation=0,controller,last=0;
|
||||
const duration=ms=>{const minutes=Math.floor(ms/60000);return minutes>=60?`${Math.floor(minutes/60)}${t('h ','時間 ')}${minutes%60}${t('m','分')}`:`${minutes}${t(' min','分')}`;};
|
||||
async function load(){
|
||||
if(document.hidden){queued=true;return;}if(busy){queued=true;return;}
|
||||
busy=true;queued=false;const ticket=++generation;controller=new AbortController();
|
||||
try{
|
||||
const res=await fetch('/_/api/v1/extension/organizer.tasks/today',{credentials:'same-origin',signal:AbortSignal.any([controller.signal,AbortSignal.timeout(15000)])});
|
||||
if(!res.ok||res.redirected)throw Error(t('Overview unavailable. Refresh to retry.','集約情報を取得できません。更新して再試行してください。'));const data=await res.json();if(ticket!==generation)return;
|
||||
last=Date.now();stats.estimate.textContent=duration(data.summary.estimate_minutes*60000)+(data.summary.tasks_partial?' +':'');stats.allocated.textContent=data.calendar_enabled?duration(data.allocated_ms)+(data.blocks_partial||data.unavailable_calendars?' +':''):'—';stats.focus.textContent=duration(data.summary.focus_ms)+(data.summary.focus_partial?' +':'');
|
||||
const messages=[t('Estimates include unfinished tasks planned for today or due by today. Focus excludes breaks; values are as of refresh.','見積もりは今日取り組む・今日までが期限の未完了タスク。集中時間は休憩を除いた更新時点の記録です。')];
|
||||
if(data.overlap_ms>0)messages.push(t('Overlapping allocations: ','時間枠の重複:')+duration(data.overlap_ms));
|
||||
if(data.summary.tasks_partial||data.summary.focus_partial||data.blocks_partial)messages.push(t('Only a bounded subset is shown (+); totals may be incomplete.','表示上限に達したため一部のみの集計です(+)。'));
|
||||
if(data.unavailable_calendars)messages.push(t('Some linked calendars are unavailable or no longer private/local.','取得できない、または非公開・ローカルの条件を満たさなくなったカレンダーがあります。'));
|
||||
if(!data.calendar_enabled)messages.push(t('Calendar extension disabled.','カレンダー拡張は無効です。'));
|
||||
note.textContent=messages.join(' ');list.replaceChildren();
|
||||
const fmt=new Intl.DateTimeFormat(ja?'ja-JP':'en-GB',{timeZone:data.timezone,month:'numeric',day:'numeric',hour:'2-digit',minute:'2-digit'});
|
||||
data.blocks.forEach(b=>{const row=el('li'),time=el('a',fmt.format(new Date(b.start_ms))+' – '+fmt.format(new Date(b.end_ms)));time.href=b.href;time.title=t('Open calendar event','カレンダーの予定を開く');const task=el('a',b.title);task.href='/v/plan/task/'+encodeURIComponent(b.task_uuid);row.append(time,task);list.append(row);});
|
||||
if(!data.blocks.length)list.append(el('li',t('No linked time blocks today.','今日の関連する時間枠はありません。')));
|
||||
}catch(e){if(e.name!=='AbortError')note.textContent=e.message;}
|
||||
finally{busy=false;if(queued&&!document.hidden){queued=false;load();}}
|
||||
}
|
||||
app.addEventListener('task-today-refresh',load);document.getElementById('tasks-refresh').addEventListener('click',load);
|
||||
document.addEventListener('visibilitychange',()=>{if(document.hidden){generation++;controller?.abort();}else if(queued||Date.now()-last>30000)load();});
|
||||
load();
|
||||
})();
|
||||
@@ -0,0 +1,150 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
const app = document.getElementById('tasks-app'); if (!app) return;
|
||||
const ja = document.documentElement.lang.startsWith('ja');
|
||||
const words = {
|
||||
carryover:['Carryover','持ち越し'],tomorrow:['Tomorrow','明日'],day:['Daily plan','日別の計画'],notes_subpath:['Wiki note subfolder (relative to the project Wiki page)','Wikiメモのサブ階層(プロジェクトの関連Wiki配下)'],
|
||||
start_on:['Work starts','工程開始'],end_on:['Work ends','工程終了'],schedule:['Day schedule','日割り工程表'],
|
||||
notify_due:['Notify on due date','期限日にInboxへ通知'],notify_planned:['Notify on planned date','取り組む日にInboxへ通知'],reminder_time:['Notification time','通知時刻'],reminder_help:['Inbox only. Saved using the Domain timezone. Missed reminders from earlier days are skipped.','Inbox通知のみ。保存時のドメインのタイムゾーンを使用します。前日以前の未配信分は送りません。'],reminder_zone:['Timezone on save','保存時のタイムゾーン'],
|
||||
task:['Task','タスク'], kind:['Show','表示対象'], archivedProjects:['Archived projects','アーカイブ済みのプロジェクト'],
|
||||
today:['Today','今日'], all:['All active tasks','すべての未完了'], inbox:['Inbox','取り込み箱'], backlog:['Backlog','Backlog'], someday:['Someday','いつか'], review:['Review','見直し'], done:['Completed','完了'], archived:['Archived','アーカイブ'], projects:['Projects','プロジェクト'],
|
||||
newTask:['New task','タスクを作成'], newProject:['New project','プロジェクトを作成'], edit:['Edit','編集'], close:['Close','閉じる'], save:['Save','保存'], archive:['Archive','アーカイブ'], restore:['Restore','復元'], more:['Load more','続きを表示'], refresh:['Refresh','更新'], search:['Filter titles','タイトルを絞り込む'], quick:['Capture a task…','タスクを書き留める…'], empty:['No matching items.','該当する項目はありません。'], loading:['Loading…','読み込み中…'], title:['Title','件名'], notes:['Notes (plain text)','メモ(プレーンテキスト)'], project:['Project','プロジェクト'], status:['Status','状態'], bucket:['Bucket','整理先'], priority:['Priority','優先度'], estimate:['Estimate (minutes)','見積もり(分)'], due_on:['Due date','期限'], planned_on:['Planned date','取り組む日'], review_on:['Review date','見直す日'], page:['Related Wiki Path','関連するWikiのPath'], noProject:['No project','プロジェクトなし'], todo:['To do','未着手'], doing:['In progress','進行中'], cancelled:['Cancelled','取りやめ'], normal:['Normal','通常'], low:['Low','低'], high:['High','高'], urgent:['Urgent','最優先'], history:['Revision history','変更履歴'], openProject:['Open project','プロジェクトを開く'], complete:['Complete','完了にする'], reopen:['Reopen','未完了に戻す'], private:['Private to you in this Domain.','このドメイン内の自分専用です。'], reviewHelp:['Review dates due, or active tasks unchanged for 30 days.','見直す日を迎えたタスク、または30日間変更されていない未完了のタスクです。'], todayHelp:['Tasks planned for today and tasks due today or overdue.','今日取り組むタスクと、今日までに期限を迎えた未完了のタスクです。'], conflict:['Changed in another window. Close and reopen to review the latest version. Your input has not been discarded.','別の画面で更新されています。入力内容は残しています。内容を控え、閉じて再度開くと最新版を確認できます。'], forbidden:['You do not have permission for this operation.','この操作の権限がありません。'], invalid:['Check the fields and the Wiki Path.','入力内容とWikiのPathを確認してください。'], not_found:['Item not found or no longer accessible.','項目が見つからないか、アクセスできません。'], internal:['The operation failed. Please try again.','処理に失敗しました。再度お試しください。'], busy:['The server is busy. Please try again.','処理が混み合っています。再度お試しください。'], login:['Please sign in again.','再度ログインしてください。'], projectSearch:['Find a project by title (up to 100 matches)','プロジェクト名で検索(最大100件)'], readonly:['Read-only account','読み取り専用アカウント'], linked:['Open related page','関連ページを開く'], hiddenLink:['The linked page is unavailable. Leave this blank to keep its reference.','関連ページは現在表示できません。未変更なら参照を保持します。'], unlink:['Remove page link','ページとの関連付けを解除'], discard:['Discard unsaved changes?','保存していない変更を破棄しますか?']
|
||||
};
|
||||
const t = key => (words[key] || words.internal)[ja ? 1 : 0];
|
||||
const $ = id => document.getElementById('tasks-' + id);
|
||||
const api = '/_/api/v1/extension/organizer.tasks/items';
|
||||
const view = app.dataset.view, projectID = view === 'project' ? app.dataset.id : '';
|
||||
const writable = app.dataset.writable === 'true';
|
||||
let today = app.dataset.today;
|
||||
let selectedDate=app.dataset.selectedDate||today;
|
||||
const loadedItems=new Map(),contextParents=new Map();
|
||||
const nextDay=date=>{const d=new Date(date+'T12:00:00Z');d.setUTCDate(d.getUTCDate()+1);return d.toISOString().slice(0,10);};
|
||||
const el = (tag, text, cls) => { const n = document.createElement(tag); if (text !== undefined) n.textContent = text; if (cls) n.className = cls; return n; };
|
||||
let generation = 0, next = '', editing = null, saving = false, dirty = false, detailGeneration = 0, projectGeneration = 0;
|
||||
let listController, dialogController;
|
||||
async function request(url, options = {}) {
|
||||
const res = await fetch(url, { credentials:'same-origin', ...options, headers: { 'Content-Type':'application/json', ...options.headers } });
|
||||
if (res.status === 401 || res.redirected) throw new Error(t('login'));
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new Error(t(data.error || 'internal'));
|
||||
return data;
|
||||
}
|
||||
const href = item => '/v/plan/' + item.kind + '/' + encodeURIComponent(item.uuid);
|
||||
const routes = {today:'/v/plan/today',all:'/v/plan/tasks',projects:'/v/plan/projects'};
|
||||
const icons = {carryover:'↶',today:'☀',tomorrow:'⇢',inbox:'↓',backlog:'≡',someday:'◇',review:'↻',all:'☷',projects:'▱',done:'✓',archived:'▣'};
|
||||
Object.keys(icons).forEach(key => { const a = el('a'); a.href = routes[key] || '/v/plan/tasks/' + key; a.append(el('span',icons[key]),el('span',t(key))); if(view===key||(key==='tomorrow'&&view==='day'&&selectedDate===nextDay(today)))a.setAttribute('aria-current','page'); $('nav').append(a); });
|
||||
const schedule=el('a','▦ '+t('schedule'));schedule.href='/v/plan/tasks/schedule'+(projectID?'?project='+projectID:'');$('nav').append(schedule);
|
||||
$('date').textContent = view==='day'?selectedDate:today; $('heading').textContent = t(view === 'project' ? 'project' : view === 'detail' || view === 'new' ? 'all' : view);
|
||||
$('help').textContent = t(view==='today'?'todayHelp':view==='review'?'reviewHelp':'private');
|
||||
$('search-label').textContent=t('search');$('quick-title').placeholder=t('quick');$('quick-title').setAttribute('aria-label',t('title'));
|
||||
$('kind-control').hidden=view!=='archived';$('kind-control').querySelector('span').textContent=t('kind');['task','project'].forEach(k=>{const o=el('option',t(k));o.value=k;$('kind').append(o);});$('kind').value=new URLSearchParams(location.search).get('kind')==='project'?'project':'task';$('kind').addEventListener('change',()=>load());$('project-archive').hidden=view!=='projects';$('project-archive').textContent=t('archivedProjects');
|
||||
$('new').title=$('new').ariaLabel=t(view==='projects'?'newProject':'newTask');$('refresh').title=$('refresh').ariaLabel=t('refresh');$('close').ariaLabel=t('close');$('more').textContent=t('more');$('save').textContent=t('save');$('history').querySelector('summary').textContent=t('history');
|
||||
$('capture').hidden=!writable||view==='projects'||view==='archived'||view==='done';$('new').hidden=!writable;
|
||||
if(['today','day','carryover'].includes(view)){
|
||||
const bar=el('nav',undefined,'task-date-nav');bar.ariaLabel=ja?'計画する日':'Planning date';
|
||||
const input=el('input');input.type='date';input.value=selectedDate;input.ariaLabel=bar.ariaLabel;
|
||||
const go=date=>{if(date)location.assign('/v/plan/tasks/day/'+date.replaceAll('-','/'));};
|
||||
const previous=el('button','‹'),following=el('button','›');previous.type=following.type='button';previous.title=previous.ariaLabel=ja?'前の日':'Previous day';following.title=following.ariaLabel=ja?'次の日':'Next day';
|
||||
previous.onclick=()=>{const d=new Date(selectedDate+'T12:00:00Z');d.setUTCDate(d.getUTCDate()-1);go(d.toISOString().slice(0,10));};following.onclick=()=>go(nextDay(selectedDate));input.onchange=()=>{if(input.validity.valid)go(input.value);};
|
||||
bar.append(previous,input,following);
|
||||
if(view==='carryover'){const label=el('label',ja?'割り当て先':'Schedule for'),target=el('input');target.type='date';target.value=selectedDate;target.ariaLabel=ja?'持ち越しの割り当て先':'Carryover target date';target.addEventListener('change',()=>{if(!target.value||!target.validity.valid)return;if(window.PagesWikiTaskRows.hasDirty()){target.value=selectedDate;return;}selectedDate=target.value;renderGroups();});label.append(target);bar.replaceChildren(label);}
|
||||
$('help').after(bar);
|
||||
if(view==='day')$('help').textContent=ja?'選択日に取り組む、または期限を迎える未完了タスク。新規タスクもこの日に割り当てます。':'Unfinished tasks planned or due on this date. New tasks are scheduled for this date.';
|
||||
if(view==='carryover')$('help').textContent=ja?'昨日以前の計画・期限が残っている未完了タスク。行の矢印で割り当て直します(期限は変更しません)。':'Unfinished tasks planned or due before today. Use the row arrow to reschedule without changing the due date.';
|
||||
}
|
||||
if(!writable)$('help').textContent+=' '+t('readonly');
|
||||
function blank(kind='task') { return { uuid:crypto.randomUUID(),kind,title:'',notes:'',status:'todo',bucket:['inbox','backlog','someday'].includes(view)?view:'inbox',priority:1,estimate_minutes:0,project_uuid:kind==='task'?projectID:'',page_uuid:'',due_on:'',planned_on:['today','day'].includes(view)&&kind==='task'?(view==='day'?selectedDate:today):'',review_on:'',archived:false,version:0 }; }
|
||||
function listView(){return ['project','detail','new'].includes(view)?'all':view;}
|
||||
async function load(append=false) {
|
||||
if(window.PagesWikiTaskRows?.hasDirty()){$('status').textContent=ja?'編集中の行を保存または再読込してください。':'Save or reload edited rows first.';return;}
|
||||
const ticket=++generation; listController?.abort();listController=new AbortController();$('status').textContent=t('loading');$('more').disabled=true;
|
||||
const q=new URLSearchParams({kind:view==='projects'?'project':view==='archived'?$('kind').value:'task',view:listView(),q:$('search').value,project:projectID,hierarchy:'1'});if(view==='day')q.set('date',selectedDate);if(append&&next)q.set('before',next);
|
||||
const parent=new URLSearchParams(location.search).get('parent');if(parent){q.set('parent',parent);q.set('view','family');}
|
||||
try { const data=await request(api+'?'+q,{signal:listController.signal});if(ticket!==generation||window.PagesWikiTaskRows?.hasDirty())return;if(data.today){today=data.today;$('date').textContent=view==='day'?selectedDate:today;}if(!append){loadedItems.clear();contextParents.clear();}data.items.forEach(item=>loadedItems.set(item.uuid,item));(data.parents||[]).forEach(item=>contextParents.set(item.uuid,item));renderGroups();next=data.next;$('more').hidden=!next;$('status').textContent=$('list').children.length?'':t('empty'); }
|
||||
catch(e){if(e.name!=='AbortError'&&ticket===generation)$('status').textContent=e.message;}finally{if(ticket===generation)$('more').disabled=false;}
|
||||
}
|
||||
function rowOptions(extra={}){return {writable,onDetail:open,planDate:view==='carryover'?selectedDate:'',onChanged:(saved,row)=>{loadedItems.set(saved.uuid,saved);if(view==='carryover'){load();return;}if(!window.PagesWikiTaskRows.hasDirty()&&(['done','cancelled'].includes(saved.status)&&!['done','archived'].includes(view))){if(row.querySelector('.task-inline-children .task-inline-row'))load();else{loadedItems.delete(saved.uuid);row.remove();}}},...extra};}
|
||||
function renderGroups(){
|
||||
$('list').replaceChildren();
|
||||
const groups=new Map();
|
||||
for(const item of loadedItems.values()){
|
||||
if(item.kind!=='task'){renderRow(item);continue;}
|
||||
const root=item.parent_uuid||item.uuid;
|
||||
if(!groups.has(root))groups.set(root,{parent:null,children:[]});
|
||||
const group=groups.get(root);if(item.parent_uuid)group.children.push(item);else group.parent=item;
|
||||
}
|
||||
for(const [id,group]of groups){
|
||||
const parent=group.parent||contextParents.get(id);
|
||||
if(parent)$('list').append(window.PagesWikiTaskRows.create(parent,rowOptions({context:!group.parent,initialChildren:group.children})));
|
||||
else group.children.forEach(renderRow);
|
||||
}
|
||||
}
|
||||
function renderRow(item) {
|
||||
if(item.kind==='task'&&window.PagesWikiTaskRows){$('list').append(window.PagesWikiTaskRows.create(item,rowOptions()));return;}
|
||||
const row=el('div',undefined,'task-row');row.role='listitem';row.dataset.done=String(item.status==='done'||item.status==='cancelled');
|
||||
if(item.kind==='task'&&writable){const b=el('button',item.status==='done'?'✓':'○');b.type='button';b.title=b.ariaLabel=t(item.status==='done'?'reopen':'complete');b.addEventListener('click',async()=>{b.disabled=true;try{const {item:fresh}=await request(api+'/'+item.uuid);fresh.status=fresh.status==='done'?'todo':'done';await saveItem(fresh);await load();}catch(e){$('status').textContent=e.message;}finally{b.disabled=false;}});row.append(b);}
|
||||
const main=el('div',undefined,'task-row-main'), a=el('a',item.title);a.href=href(item);if(item.kind==='task')a.addEventListener('click',e=>{if(e.button||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;e.preventDefault();open(item.uuid);});main.append(a);
|
||||
const meta=el('div',undefined,'task-row-meta');meta.append(el('span',t(item.status)));if(item.kind==='task'){if(item.due_on)meta.append(el('span',t('due_on')+' '+item.due_on,item.due_on<today?'task-overdue':''));if(item.planned_on)meta.append(el('span',t('planned_on')+' '+item.planned_on));if(item.priority>=2)meta.append(el('span',t(item.priority===3?'urgent':'high')));if(item.estimate_minutes)meta.append(el('span',item.estimate_minutes+' min'));}main.append(meta);row.append(main);$('list').append(row);
|
||||
}
|
||||
const fields={};
|
||||
function field(name,label,type,value,full=false,options=null){const l=el('label',label,full?'task-full':'');let input=el(type==='textarea'?'textarea':options?'select':'input');if(options)options.forEach(([val,text])=>{const o=el('option',text);o.value=val;input.append(o);});else if(type!=='textarea')input.type=type;input.name=name;input.value=value??'';input.disabled=!writable;fields[name]=input;l.append(input);$('fields').append(l);return input;}
|
||||
async function fillProjects(selected) {
|
||||
const ticket=++projectGeneration, target=fields.project_uuid;if(!target)return;
|
||||
try {const data=await request(api+'?'+new URLSearchParams({kind:'project',view:'all',limit:'100',q:fields.project_search?.value||''}));if(ticket!==projectGeneration||target!==fields.project_uuid)return;const items=data.items;if(selected&&!items.some(p=>p.uuid===selected)){try{const d=await request(api+'/'+selected);if(d.item.kind==='project')items.unshift(d.item);}catch{ /* inaccessible reference is not exposed */ }}target.replaceChildren();const none=el('option',t('noProject'));none.value='';target.append(none);items.forEach(p=>{const o=el('option',p.title);o.value=p.uuid;target.append(o);});target.value=selected||'';if(selected&&target.value!==selected){const o=el('option',t('not_found'));o.value=selected;target.append(o);target.value=selected;}}
|
||||
catch(e){$('error').textContent=e.message;}
|
||||
}
|
||||
async function open(id,kind='task') {
|
||||
if($('dialog').open&&!closeDialog())return;
|
||||
const ticket=++detailGeneration;dialogController?.abort();dialogController=new AbortController();$('error').textContent='';editing=null;dirty=false;$('fields').replaceChildren();Object.keys(fields).forEach(k=>delete fields[k]);$('history').open=false;$('history').querySelector('ol').replaceChildren();$('dialog-title').textContent=t('loading');$('save').disabled=true;$('archive').hidden=true;$('history').hidden=true;$('project-open').hidden=true;$('dialog').showModal();
|
||||
try {
|
||||
const data=id?await request(api+'/'+id,{signal:dialogController.signal}):{item:blank(kind),page_path:''};if(ticket!==detailGeneration)return;editing=data.item;
|
||||
$('dialog-title').textContent=t(id?'edit':kind==='project'?'newProject':'newTask');
|
||||
const title=field('title',t('title'),'text',editing.title,true);title.required=true;title.maxLength=300;
|
||||
const notes=field('notes',t('notes'),'textarea',editing.notes,true);notes.maxLength=16384;
|
||||
if(editing.kind==='task'){
|
||||
field('status',t('status'),'select',editing.status,false,['todo','doing','done','cancelled'].map(k=>[k,t(k)]));
|
||||
field('bucket',t('bucket'),'select',editing.bucket,false,['inbox','backlog','someday'].map(k=>[k,t(k)]));
|
||||
field('project_search',t('projectSearch'),'search','',true).addEventListener('input',debounce(()=>fillProjects(fields.project_uuid.value),250));
|
||||
field('project_uuid',t('project'),'select',editing.project_uuid,true,[[editing.project_uuid,t(editing.project_uuid?'loading':'noProject')]]);await fillProjects(editing.project_uuid);if(ticket!==detailGeneration)return;
|
||||
field('priority',t('priority'),'select',editing.priority,false,[[0,t('low')],[1,t('normal')],[2,t('high')],[3,t('urgent')]]);
|
||||
const estimate=field('estimate_minutes',t('estimate'),'number',editing.estimate_minutes);estimate.min=0;estimate.max=10080;
|
||||
['due_on','planned_on','review_on','start_on','end_on'].forEach(k=>field(k,t(k),'date',editing[k]));
|
||||
['notify_due','notify_planned'].forEach(k=>{const input=field(k,t(k),'checkbox','',true);input.checked=!!editing[k];input.parentElement.classList.add('task-toggle');});
|
||||
const clock=field('reminder_time',t('reminder_time'),'time',editing.reminder_time||'09:00');clock.step=60;
|
||||
const reminderHelp=el('small',t('reminder_help')+' '+t('reminder_zone')+': '+app.dataset.timezone,'task-full');$('fields').append(reminderHelp);
|
||||
const requirements=()=>{fields.due_on.required=fields.notify_due.checked;fields.planned_on.required=fields.notify_planned.checked;clock.required=fields.notify_due.checked||fields.notify_planned.checked;};fields.notify_due.addEventListener('change',requirements);fields.notify_planned.addEventListener('change',requirements);requirements();
|
||||
}
|
||||
if(editing.kind==='project'){const folder=field('notes_subpath',t('notes_subpath'),'text',editing.notes_subpath||'tasks',true);folder.maxLength=500;folder.placeholder='tasks';$('fields').append(el('small',ja?'例:関連Wikiが /projects/app、サブ階層が tasks → /projects/app/tasks/件名。Wikiの公開範囲に従います。':'Example: project Wiki /projects/app + subfolder tasks → /projects/app/tasks/title. Wiki permissions apply.','task-full'));}
|
||||
field('page_path',t('page'),'text',data.page_path,true).placeholder='/lab/project';
|
||||
if(data.page_path){const a=el('a',t('linked')+' ↗');a.href='/'+data.page_path.replace(/^\/+/, '').split('/').map(encodeURIComponent).join('/');$('fields').append(a);}else if(editing.page_uuid)$('fields').append(el('small',t('hiddenLink')));
|
||||
if(editing.page_uuid){const unlink=el('button',t('unlink'));unlink.type='button';unlink.disabled=!writable;unlink.addEventListener('click',()=>{editing.page_uuid='';fields.page_path.value='';fields.page_path.dataset.changed='true';dirty=true;unlink.disabled=true;});$('fields').append(unlink);}
|
||||
fields.page_path.addEventListener('input',()=>{fields.page_path.dataset.changed='true';});
|
||||
if(id&&editing.kind==='task'){
|
||||
if(writable&&!editing.archived&&!['done','cancelled'].includes(editing.status)){const focus=el('button',ja?'◷ このタスクに集中':'◷ Focus on this task','task-full');focus.type='button';focus.addEventListener('click',()=>{if(dirty){$('error').textContent=ja?'先にタスクの変更を保存してください。':'Save your task changes first.';return;}const task={...editing};if(closeDialog())app.dispatchEvent(new CustomEvent('task-focus',{detail:task}));});$('fields').append(focus);}
|
||||
const plan=el('button',ja?'▦ 時間枠をカレンダーへ':'▦ Calendar time blocks','task-full');plan.type='button';plan.id='tasks-plan-open';
|
||||
plan.addEventListener('click',()=>{if(dirty){$('error').textContent=ja?'先にタスクの変更を保存してください。':'Save your task changes first.';return;}app.dispatchEvent(new CustomEvent('task-plan',{detail:{...editing}}));});$('fields').append(plan);
|
||||
}
|
||||
$('archive').hidden=!id||!writable;$('archive').textContent=t(editing.archived?'restore':'archive');$('save').hidden=!writable;$('save').disabled=false;$('history').hidden=!id;
|
||||
if(editing.kind==='project'&&id){$('project-open').hidden=false;$('project-open').href=href(editing);$('project-open').textContent=t('openProject');}
|
||||
title.focus();
|
||||
}catch(e){if(e.name!=='AbortError'&&ticket===detailGeneration)$('error').textContent=e.message;}
|
||||
}
|
||||
function closeDialog(force=false){if(saving)return false;if(!force&&dirty&&!confirm(t('discard')))return false;detailGeneration++;projectGeneration++;dialogController?.abort();$('dialog').close();editing=null;dirty=false;return true;}
|
||||
$('close').addEventListener('click',()=>closeDialog());$('dialog').addEventListener('cancel',e=>{e.preventDefault();closeDialog();});
|
||||
$('form').addEventListener('input',()=>{dirty=true;});
|
||||
function readForm(){const item={...editing};['title','notes','notes_subpath','status','bucket','project_uuid','due_on','planned_on','review_on','start_on','end_on','reminder_time'].forEach(k=>{if(fields[k])item[k]=fields[k].value;});['notify_due','notify_planned'].forEach(k=>{if(fields[k])item[k]=fields[k].checked;});['priority','estimate_minutes'].forEach(k=>{if(fields[k])item[k]=Number(fields[k].value);});if(fields.page_path?.dataset.changed||(!item.page_uuid&&fields.page_path?.value))item.page_path=fields.page_path.value;return item;}
|
||||
async function saveItem(item){const data=await request(api+(item.version?'/'+item.uuid:''),{method:item.version?'PUT':'POST',headers:item.version?{'If-Match':'"'+item.version+'"'}:{},body:JSON.stringify(item)});app.dispatchEvent(new Event('task-today-refresh'));return data;}
|
||||
async function submit(archive=false){if(!editing||saving||!writable)return;if(!$('form').reportValidity())return;const item=readForm();if(archive)item.archived=!item.archived;saving=true;Object.values(fields).forEach(f=>f.disabled=true);$('save').disabled=$('archive').disabled=true;$('error').textContent='';try{await saveItem(item);saving=false;closeDialog(true);await load();if(projectID)await loadProject();}catch(e){$('error').textContent=e.message;}finally{saving=false;Object.values(fields).forEach(f=>f.disabled=!writable);$('save').disabled=$('archive').disabled=false;}}
|
||||
$('form').addEventListener('submit',e=>{e.preventDefault();submit();});$('archive').addEventListener('click',()=>submit(true));
|
||||
$('history').addEventListener('toggle',async()=>{if(!$('history').open||!editing?.version)return;const id=editing.uuid;try{const data=await request(api+'/'+id+'/history');if(editing?.uuid!==id)return;const ol=$('history').querySelector('ol');ol.replaceChildren();data.items.forEach(v=>ol.append(el('li','#'+v.version+' · '+new Date(v.created_at_ms).toLocaleString())));}catch(e){$('error').textContent=e.message;}});
|
||||
$('new').addEventListener('click',()=>open('',view==='projects'?'project':'task'));
|
||||
let capturing=false,captureDraft=null;
|
||||
$('capture').addEventListener('submit',async e=>{e.preventDefault();if(capturing)return;const title=$('quick-title').value.trim();if(!title)return;capturing=true;const b=$('capture').querySelector('button');b.disabled=$('quick-title').disabled=true;if(!captureDraft||captureDraft.title!==title)captureDraft={...blank(),title};try{await saveItem(captureDraft);captureDraft=null;$('quick-title').value='';await load();}catch(err){$('status').textContent=err.message;}finally{capturing=false;b.disabled=$('quick-title').disabled=false;$('quick-title').focus();}});
|
||||
function debounce(fn,delay){let timer;return()=>{clearTimeout(timer);timer=setTimeout(fn,delay);};}
|
||||
$('search').addEventListener('input',debounce(()=>load(),200));$('refresh').addEventListener('click',()=>load());$('more').addEventListener('click',()=>load(true));
|
||||
async function loadProject(){try{const {item}=await request(api+'/'+projectID);$('heading').textContent=item.title;$('help').textContent=(item.archived?t('archived')+' · ':'')+(item.notes||t('private'));$('new').hidden=$('capture').hidden=!writable||item.archived;$('project-edit').hidden=false;$('project-edit').title=$('project-edit').ariaLabel=t('edit');}catch(e){$('status').textContent=e.message;}}
|
||||
$('project-edit').addEventListener('click',()=>open(projectID));
|
||||
window.addEventListener('beforeunload',e=>{if(dirty){e.preventDefault();e.returnValue='';}});
|
||||
document.addEventListener('visibilitychange',()=>{if(!document.hidden&&!$('dialog').open&&!capturing)load();});
|
||||
load();if(projectID)loadProject();if(view==='detail')open(app.dataset.id);if(view==='new')open('');
|
||||
})();
|
||||
@@ -0,0 +1,86 @@
|
||||
(() => {
|
||||
const path = document.body?.dataset?.path || document.querySelector('.breadcrumb-bar')?.dataset?.path || location.pathname;
|
||||
const isTyping = target => target?.matches?.('input,textarea,select,[contenteditable="true"]');
|
||||
const openDialog = (title, content) => {
|
||||
const dialog = document.createElement('dialog'); dialog.className = 'viewer-shortcut-dialog';
|
||||
dialog.innerHTML = `<form method="dialog"><header><h2></h2><button value="cancel" aria-label="Close">×</button></header><div class="viewer-shortcut-content"></div></form>`;
|
||||
dialog.querySelector('h2').textContent = title; dialog.querySelector('.viewer-shortcut-content').append(content); document.body.append(dialog);
|
||||
dialog.addEventListener('close', () => dialog.remove()); dialog.showModal(); return dialog;
|
||||
};
|
||||
const formDialog = (title, action, fields) => {
|
||||
const form = document.createElement('form'); form.method='get'; form.action=action;
|
||||
for (const field of fields) { const label=document.createElement('label'); label.textContent=field.label; const input=document.createElement(field.tag||'input'); Object.assign(input,field.attrs||{}); label.append(input); form.append(label); }
|
||||
const submit=document.createElement('button'); submit.type='submit'; submit.textContent='Open'; form.append(submit); openDialog(title,form);
|
||||
};
|
||||
const findDialog = () => {
|
||||
const form=document.createElement('form'); form.method='get'; form.action='/v/search'; form.className='viewer-find-form';
|
||||
const input=document.createElement('input'); input.type='search'; input.name='q'; input.autocomplete='off'; input.placeholder='Find…'; input.setAttribute('aria-label','Find');
|
||||
const list=document.createElement('div'); list.className='viewer-find-suggestions';
|
||||
const candidates=[...document.querySelectorAll('a[href]')].map(a=>({href:a.href,label:(a.textContent||'').trim()||a.getAttribute('href')})).filter(x=>x.label&&x.href.startsWith(location.origin)).slice(0,80);
|
||||
const render=()=>{const q=input.value.toLowerCase();list.replaceChildren(...candidates.filter(x=>!q||x.label.toLowerCase().includes(q)).slice(0,12).map(x=>{const a=document.createElement('a');a.href=x.href;a.textContent=x.label;return a;}));};
|
||||
input.addEventListener('input',render); form.append(input,list); const button=document.createElement('button');button.type='submit';button.textContent='Search';form.append(button);openDialog('Find',form);setTimeout(()=>input.focus(),0);
|
||||
};
|
||||
const shortcutSheet = () => {
|
||||
const table=document.createElement('div'); table.className='viewer-shortcut-grid';
|
||||
[['e','Edit'],['/','Find'],['v','Change view'],['c','Create child'],['u','Upload'],['s','Share'],['p','Permissions'],['Ctrl+↑','Parent'],['Ctrl+↓','Children'],['Ctrl+→','Previous'],['Ctrl+←','Next'],['?','This cheat sheet']].forEach(([key,label])=>{const k=document.createElement('kbd');k.textContent=key;const d=document.createElement('span');d.textContent=label;table.append(k,d);});
|
||||
openDialog('Keyboard shortcuts',table);
|
||||
};
|
||||
const childrenDialog = async () => {
|
||||
const content=document.createElement('div'); content.className='viewer-children-dialog-content'; content.textContent='Loading…';
|
||||
const dialog=openDialog('Children',content);
|
||||
try {
|
||||
const response=await fetch(childrenURL(path),{headers:{'Accept':'text/html'}});
|
||||
if(!response.ok) throw new Error('children request failed');
|
||||
content.innerHTML=await response.text();
|
||||
content.querySelectorAll('a[href]').forEach(link=>link.addEventListener('click',event=>{event.preventDefault();dialog.close();window.location.assign(new URL(link.getAttribute('href'),location.href).href);}));
|
||||
} catch (_) { content.textContent='Unable to load children.'; }
|
||||
};
|
||||
const parentPath = value => { const clean=(value||'/').replace(/\/+$/,'')||'/'; const i=clean.lastIndexOf('/'); return i<=0?'/':clean.slice(0,i); };
|
||||
const childrenURL = value => '/v/children?path='+encodeURIComponent(value||'/');
|
||||
const focusView = () => { const buttons=[...document.querySelectorAll('[data-children-view]')]; if (!buttons.length) return; const active=buttons.findIndex(b=>b.classList.contains('active')); buttons[(active+1+buttons.length)%buttons.length].click(); };
|
||||
const share = () => {
|
||||
const url = new URL(location.href); url.hash=''; const wrap=document.createElement('div');
|
||||
const input=document.createElement('input'); input.value=url.href; input.readOnly=true; input.select();
|
||||
const copy=document.createElement('button'); copy.type='button'; copy.textContent='Copy link'; copy.onclick=async()=>{try{await navigator.clipboard.writeText(input.value);copy.textContent='Copied'}catch{input.select()}};
|
||||
const pageTitle=document.querySelector('meta[property="og:title"]')?.content || document.title.split(' · ')[0] || location.pathname.split('/').filter(Boolean).pop() || '/';
|
||||
const domainTitle=document.querySelector('meta[property="og:site_name"]')?.content || location.host;
|
||||
const text=pageTitle+' - '+domainTitle;
|
||||
const x=document.createElement('a'); x.href='https://twitter.com/intent/tweet?url='+encodeURIComponent(input.value)+'&text='+encodeURIComponent(text); x.target='_blank'; x.rel='noopener noreferrer'; x.dataset.shareX='true'; x.textContent='Share on X'; wrap.append(input,copy,x); openDialog('Share link',wrap);
|
||||
};
|
||||
document.addEventListener('click', event => {
|
||||
const link = event.target.closest?.('a[data-share-x]');
|
||||
if (!link || event.defaultPrevented) return;
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
window.open(link.href, '_blank', 'noopener,noreferrer');
|
||||
});
|
||||
document.querySelector('[data-viewer-delete]')?.addEventListener('click', async event => {
|
||||
const uuid = event.currentTarget.dataset.objectUuid;
|
||||
if (!uuid || !window.confirm('Delete this object?')) return;
|
||||
const response = await fetch('/_/api/v1/object/delete', {
|
||||
method: 'POST', headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({object_uuid: uuid}),
|
||||
});
|
||||
if (!response.ok) { window.alert('Delete failed'); return; }
|
||||
window.location.assign('/');
|
||||
});
|
||||
document.addEventListener('keydown', event => {
|
||||
if (event.defaultPrevented || isTyping(event.target) || document.querySelector('dialog[open]')) return;
|
||||
const key=event.key.toLowerCase();
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
if (key==='arrowup') { event.preventDefault(); location.href=parentPath(path); }
|
||||
else if (key==='arrowdown') { event.preventDefault(); childrenDialog(); }
|
||||
else if (key==='arrowright') { event.preventDefault(); history.forward(); }
|
||||
else if (key==='arrowleft') { event.preventDefault(); history.back(); }
|
||||
return;
|
||||
}
|
||||
if (key==='e') { event.preventDefault(); location.href='/e/-'+(path==='/'?'':path); }
|
||||
else if (key==='/') { event.preventDefault(); findDialog(); }
|
||||
else if (key==='v') { event.preventDefault(); focusView(); }
|
||||
else if (key==='c') { event.preventDefault(); location.href='/:/new?path='+encodeURIComponent(path); }
|
||||
else if (key==='u') { event.preventDefault(); location.href='/v/upload?path='+encodeURIComponent(path); }
|
||||
else if (key==='s') { event.preventDefault(); share(); }
|
||||
else if (key==='p') { event.preventDefault(); const trigger=document.querySelector('[data-governance-open]'); if(trigger) trigger.click(); else { const message=document.createElement('p'); message.textContent='Open the City governance dialog from the City view to manage permissions for this locality.'; openDialog('Permissions',message); } }
|
||||
else if (key==='?') { event.preventDefault(); shortcutSheet(); }
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,46 @@
|
||||
(() => {
|
||||
const form = document.getElementById('vim-settings-form');
|
||||
if (!form) return;
|
||||
const status = document.getElementById('vim-settings-status');
|
||||
let loading = 0;
|
||||
for (const input of form.querySelectorAll('[data-vim-upload]')) input.addEventListener('change', async () => {
|
||||
const file = input.files[0]; if (!file) return;
|
||||
loading++;
|
||||
try {
|
||||
if (file.size > 65536) throw new Error(form.dataset.invalid);
|
||||
const content = new TextDecoder('utf-8', {fatal:true}).decode(await file.arrayBuffer());
|
||||
if (content.includes('\0')) throw new Error(form.dataset.invalid);
|
||||
form.elements[input.dataset.vimUpload].value = content;
|
||||
form.elements.vim_enabled.checked = true;
|
||||
if (input.dataset.vimUpload === 'colorscheme') form.elements.color_name.value = file.name;
|
||||
status.textContent = '';
|
||||
} catch (_) { status.textContent = form.dataset.invalid; }
|
||||
finally { loading--; input.value = ''; }
|
||||
});
|
||||
for (const button of form.querySelectorAll('[data-vim-download]')) button.addEventListener('click', () => {
|
||||
const key = button.dataset.vimDownload, link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(new Blob([form.elements[key].value], {type:'text/plain;charset=utf-8'}));
|
||||
link.download = key === 'vimrc' ? '.vimrc' : (form.elements.color_name.value || 'pageswiki_custom.vim');
|
||||
link.click(); setTimeout(() => URL.revokeObjectURL(link.href), 1000);
|
||||
});
|
||||
form.querySelector('[data-vim-clear-color]').addEventListener('click', () => { form.elements.colorscheme.value = ''; form.elements.color_name.value = ''; });
|
||||
form.addEventListener('submit', async event => {
|
||||
event.preventDefault();
|
||||
if (loading) return;
|
||||
const reset = event.submitter?.name === 'reset';
|
||||
if (reset && !confirm(form.dataset.reset)) return;
|
||||
const body = new URLSearchParams(new FormData(form));
|
||||
if (reset) body.set('reset', 'true');
|
||||
const buttons = [...form.querySelectorAll('button[type=submit]')];
|
||||
if (buttons.some(button => button.disabled)) return;
|
||||
buttons.forEach(button => button.disabled = true);
|
||||
try {
|
||||
const response = await fetch(form.action, {method:'POST', body, headers:{Accept:'application/json'}, signal:AbortSignal.timeout(15000)});
|
||||
if (!response.ok) throw new Error((await response.text()).trim());
|
||||
await response.json();
|
||||
if (reset) { form.elements.font_size.value = 16; form.elements.vim_enabled.checked = false; form.elements.vimrc.value = ''; form.elements.colorscheme.value = ''; form.elements.color_name.value = ''; }
|
||||
status.textContent = form.dataset.saved;
|
||||
} catch (error) { status.textContent = error.message; }
|
||||
finally { buttons.forEach(button => button.disabled = false); }
|
||||
});
|
||||
})();
|
||||
+411
@@ -0,0 +1,411 @@
|
||||
var PagesWikiGenCity = (() => {
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// node_modules/gen-city/dist/index.js
|
||||
var require_dist = __commonJS({
|
||||
"node_modules/gen-city/dist/index.js"(exports, module) {
|
||||
(() => {
|
||||
"use strict";
|
||||
var t = { 895: (t2, i2) => {
|
||||
Object.defineProperty(i2, "__esModule", { value: true }), i2.Building = void 0, i2.Building = class {
|
||||
constructor(t3, i3) {
|
||||
if (4 !== i3.length) throw Error("Invalid building vertices");
|
||||
this.path = t3, this.vertices = i3;
|
||||
const e2 = this.vertices.map((t4) => t4.x), s = this.vertices.map((t4) => t4.y);
|
||||
this.position = { x: Math.min(...e2), y: Math.min(...s) }, this.width = Math.max(...e2) - this.position.x + 1, this.height = Math.max(...s) - this.position.y + 1;
|
||||
}
|
||||
remove() {
|
||||
const t3 = this.path.getBuildings(), i3 = t3.findIndex((t4) => t4 === this);
|
||||
-1 !== i3 && t3.splice(i3, 1);
|
||||
}
|
||||
each(t3) {
|
||||
for (let i3 = 0; i3 < this.width; i3++) for (let e2 = 0; e2 < this.height; e2++) t3({ x: this.position.x + i3, y: this.position.y + e2 });
|
||||
}
|
||||
};
|
||||
}, 863: function(t2, i2, e2) {
|
||||
var s = this && this.__awaiter || function(t3, i3, e3, s2) {
|
||||
return new (e3 || (e3 = Promise))(function(n2, r2) {
|
||||
function o2(t4) {
|
||||
try {
|
||||
a(s2.next(t4));
|
||||
} catch (t5) {
|
||||
r2(t5);
|
||||
}
|
||||
}
|
||||
function h2(t4) {
|
||||
try {
|
||||
a(s2.throw(t4));
|
||||
} catch (t5) {
|
||||
r2(t5);
|
||||
}
|
||||
}
|
||||
function a(t4) {
|
||||
var i4;
|
||||
t4.done ? n2(t4.value) : (i4 = t4.value, i4 instanceof e3 ? i4 : new e3(function(t5) {
|
||||
t5(i4);
|
||||
})).then(o2, h2);
|
||||
}
|
||||
a((s2 = s2.apply(t3, i3 || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(i2, "__esModule", { value: true }), i2.City = void 0;
|
||||
const n = e2(792), r = e2(82), o = e2(309), h = e2(679);
|
||||
i2.City = class {
|
||||
constructor({ width: t3, height: i3 }) {
|
||||
this.seed = null, this.matrix = [], this.nodes = [], this.gauge = 1, this.params = {}, this.width = t3, this.height = i3;
|
||||
}
|
||||
getSeed() {
|
||||
return this.seed;
|
||||
}
|
||||
getAllBuildings() {
|
||||
return this.getAllPaths().map((t3) => t3.getBuildings()).flat();
|
||||
}
|
||||
getAllNodes() {
|
||||
return this.nodes;
|
||||
}
|
||||
getAllPaths() {
|
||||
return this.nodes.map((t3) => t3.getOutputPaths()).flat();
|
||||
}
|
||||
generate(t3 = {}) {
|
||||
return s(this, void 0, void 0, function* () {
|
||||
this.reset(), this.params = Object.assign({ mode: o.CityGenerationMode.RUNTIME, seed: [], startPosition: { x: Math.round(this.width / 2), y: Math.round(this.height / 2) }, startDirections: [0, 90, 180, 270], streetMinLength: 10, buildingMinSize: 3, buildingMaxSize: 6, buildingMinSpace: 1, buildingMaxSpace: 3, buildingOffset: 0, probabilityIntersection: 0.1, probabilityTurn: 0.05, probabilityStreetEnd: 1e-3 }, t3), this.params.mode === o.CityGenerationMode.SEED && (this.seed = 0 === this.params.seed.length ? (0, h.generateSeed)() : this.params.seed);
|
||||
const i3 = this.addNode(this.params.startPosition);
|
||||
this.markAt(this.params.startPosition, i3), this.params.startDirections.forEach((t4) => {
|
||||
i3.addOutputPath(t4);
|
||||
}), this.generatePaths(), this.generateBuildings();
|
||||
});
|
||||
}
|
||||
reset() {
|
||||
for (let t3 = 0; t3 < this.height; t3++) {
|
||||
this.matrix[t3] = [];
|
||||
for (let i3 = 0; i3 < this.width; i3++) this.matrix[t3][i3] = null;
|
||||
}
|
||||
this.seed = null, this.gauge = 1, this.nodes = [];
|
||||
}
|
||||
generatePaths() {
|
||||
const t3 = () => {
|
||||
const i3 = this.getAllPaths();
|
||||
for (let t4 = 0, e3 = i3.length; t4 < e3; t4++) this.processingPath(i3[t4]);
|
||||
i3.every((t4) => t4.isCompleted()) || t3();
|
||||
};
|
||||
t3();
|
||||
}
|
||||
processingPath(t3) {
|
||||
if (t3.isCompleted()) return;
|
||||
const i3 = t3.getNextCursor();
|
||||
if (void 0 === this.getAt(i3) || this.variabilityChance(this.params.probabilityStreetEnd)) return void this.closePath(t3);
|
||||
const e3 = this.getCross(t3);
|
||||
if (null == e3 ? void 0 : e3.tile) {
|
||||
let i4 = null;
|
||||
return e3.tile instanceof n.Node ? i4 = e3.tile : e3.tile instanceof r.Path && (i4 = this.splitPath(e3.tile, e3.position)), void (i4 && t3.setNodeEnd(i4));
|
||||
}
|
||||
t3.setCursor(i3), this.markAt(t3.getCursor(), t3);
|
||||
const s2 = this.params.streetMinLength;
|
||||
t3.getLength() > s2 && !this.getCross(t3, s2) && (this.variabilityChance(this.params.probabilityIntersection) ? this.forkPath(t3) : this.variabilityChance(this.params.probabilityTurn) && this.turnPath(t3));
|
||||
}
|
||||
generateBuildings() {
|
||||
this.getAllPaths().forEach((t3) => {
|
||||
const i3 = (0, h.getShift)(t3.direction), e3 = t3.getNodeBeg().position.x + i3.x, s2 = t3.getNodeBeg().position.y + i3.y;
|
||||
(0, h.turnDirection)(t3.direction).forEach((i4) => {
|
||||
let n2 = this.params.buildingOffset;
|
||||
for (; t3.getLength() > n2; ) {
|
||||
const r2 = (0, h.getShift)(t3.direction, n2), o2 = (0, h.getShift)(i4, this.params.buildingOffset + 1), a = { x: e3 + r2.x + o2.x, y: s2 + r2.y + o2.y }, d = [this.variabilityRange(this.params.buildingMinSize, this.params.buildingMaxSize), this.variabilityRange(this.params.buildingMinSize, this.params.buildingMaxSize)];
|
||||
if (n2 + d[0] + this.params.buildingOffset > t3.getLength()) break;
|
||||
this.processingBuilding(t3, a, d, [t3.direction, i4]);
|
||||
const u = this.variabilityRange(this.params.buildingMinSpace, this.params.buildingMaxSpace);
|
||||
n2 += d[0] + u;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
processingBuilding(t3, i3, e3, s2) {
|
||||
const n2 = [], r2 = [];
|
||||
for (let t4 = 0; t4 < e3[0]; t4++) {
|
||||
const o3 = (0, h.getShift)(s2[0], t4), a = { x: i3.x + o3.x, y: i3.y + o3.y };
|
||||
for (let i4 = 0; i4 < e3[1]; i4++) {
|
||||
const o4 = (0, h.getShift)(s2[1], i4), d = { x: a.x + o4.x, y: a.y + o4.y };
|
||||
if (!this.isEmptyAt(d)) return;
|
||||
n2.push(d), 0 !== t4 && t4 !== e3[0] - 1 || 0 !== i4 && i4 !== e3[1] - 1 || r2.push(d);
|
||||
}
|
||||
}
|
||||
const o2 = t3.addBuilding(r2);
|
||||
n2.forEach((t4) => {
|
||||
this.markAt(t4, o2);
|
||||
});
|
||||
}
|
||||
getAt(t3) {
|
||||
var i3, e3;
|
||||
return null === (e3 = null === (i3 = this.matrix) || void 0 === i3 ? void 0 : i3[t3.y]) || void 0 === e3 ? void 0 : e3[t3.x];
|
||||
}
|
||||
markAt(t3, i3) {
|
||||
this.matrix[t3.y][t3.x] = i3;
|
||||
}
|
||||
isEmptyAt(t3) {
|
||||
return null === this.getAt(t3);
|
||||
}
|
||||
addNode(t3, i3) {
|
||||
const e3 = new n.Node(this.nodes.length, t3);
|
||||
return void 0 === i3 ? this.nodes.push(e3) : this.nodes.splice(i3, 0, e3), e3;
|
||||
}
|
||||
closePath(t3) {
|
||||
const i3 = t3.getCursor(), e3 = this.addNode(i3);
|
||||
return t3.setNodeEnd(e3), this.markAt(i3, e3), e3;
|
||||
}
|
||||
forkPath(t3) {
|
||||
let i3 = (0, h.forkDirection)(t3.direction).sort(() => this.variabilityChance(0.5) ? 1 : -1);
|
||||
if (i3 = this.filterDirections(t3, i3), 0 === i3.length || 1 === i3.length && i3[0] === t3.direction) return;
|
||||
const e3 = this.closePath(t3);
|
||||
for (let t4 = 0; t4 < i3.length; t4++) (t4 < 2 || this.variabilityChance(0.5)) && e3.addOutputPath(i3[t4]);
|
||||
this.markAt(e3.position, e3);
|
||||
}
|
||||
turnPath(t3) {
|
||||
let i3 = (0, h.turnDirection)(t3.direction).sort(() => this.variabilityChance(0.5) ? 1 : -1);
|
||||
if (i3 = this.filterDirections(t3, i3), 0 === i3.length) return;
|
||||
const e3 = this.closePath(t3);
|
||||
e3.addOutputPath(i3[0]), this.markAt(e3.position, e3);
|
||||
}
|
||||
splitPath(t3, i3) {
|
||||
const e3 = t3.getNodeBeg(), s2 = this.nodes.findIndex((t4) => t4 === e3), n2 = this.addNode(i3, s2 + 1), o2 = n2.addOutputPath(t3.direction);
|
||||
this.markAt(i3, n2);
|
||||
const h2 = t3.getNodeEnd();
|
||||
return h2 ? o2.setNodeEnd(h2) : o2.setCursor(t3.getCursor()), o2.each((t4) => {
|
||||
this.getAt(t4) instanceof r.Path && this.markAt(t4, o2);
|
||||
}), t3.setNodeEnd(n2), n2;
|
||||
}
|
||||
getCross(t3, i3 = 1) {
|
||||
const e3 = t3.getCursor();
|
||||
for (let s2 = 1; s2 <= i3; s2++) {
|
||||
const i4 = (0, h.getShift)(t3.direction, s2), n2 = { x: e3.x + i4.x, y: e3.y + i4.y };
|
||||
if (!this.isEmptyAt(n2)) return { tile: this.getAt(n2), position: n2 };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
filterDirections(t3, i3) {
|
||||
return i3.filter((i4) => {
|
||||
const e3 = (0, h.getShift)(i4), s2 = t3.getCursor(), n2 = { x: s2.x + e3.x, y: s2.y + e3.y };
|
||||
return this.isEmptyAt(n2);
|
||||
});
|
||||
}
|
||||
variabilityChance(t3) {
|
||||
if (!this.seed) return (0, h.randomChance)(t3);
|
||||
const i3 = this.seed[this.gauge % this.seed.length];
|
||||
return this.gauge++, i3 / 1e3 >= 1 - t3;
|
||||
}
|
||||
variabilityRange(t3, i3) {
|
||||
if (!this.seed) return (0, h.randomRange)(t3, i3);
|
||||
const e3 = this.seed[this.gauge % this.seed.length];
|
||||
return this.gauge++, Math.floor(t3 + e3 / 1e3 * (i3 - t3 + 1));
|
||||
}
|
||||
};
|
||||
}, 465: function(t2, i2, e2) {
|
||||
var s = this && this.__createBinding || (Object.create ? function(t3, i3, e3, s2) {
|
||||
void 0 === s2 && (s2 = e3);
|
||||
var n2 = Object.getOwnPropertyDescriptor(i3, e3);
|
||||
n2 && !("get" in n2 ? !i3.__esModule : n2.writable || n2.configurable) || (n2 = { enumerable: true, get: function() {
|
||||
return i3[e3];
|
||||
} }), Object.defineProperty(t3, s2, n2);
|
||||
} : function(t3, i3, e3, s2) {
|
||||
void 0 === s2 && (s2 = e3), t3[s2] = i3[e3];
|
||||
}), n = this && this.__exportStar || function(t3, i3) {
|
||||
for (var e3 in t3) "default" === e3 || Object.prototype.hasOwnProperty.call(i3, e3) || s(i3, t3, e3);
|
||||
};
|
||||
Object.defineProperty(i2, "__esModule", { value: true }), n(e2(863), i2), n(e2(895), i2), n(e2(792), i2), n(e2(82), i2), n(e2(309), i2);
|
||||
}, 792: (t2, i2, e2) => {
|
||||
Object.defineProperty(i2, "__esModule", { value: true }), i2.Node = void 0;
|
||||
const s = e2(82), n = e2(309);
|
||||
i2.Node = class {
|
||||
constructor(t3, i3) {
|
||||
this.outputPaths = [], this.inputPaths = [], this.id = t3, this.position = i3;
|
||||
}
|
||||
addOutputPath(t3) {
|
||||
const i3 = new s.Path(this, t3);
|
||||
return this.outputPaths.push(i3), i3;
|
||||
}
|
||||
removeOutputPath(t3) {
|
||||
const i3 = this.outputPaths.indexOf(t3);
|
||||
-1 !== i3 && this.outputPaths.splice(i3, 1);
|
||||
}
|
||||
getOutputPaths() {
|
||||
return this.outputPaths;
|
||||
}
|
||||
addInputPath(t3) {
|
||||
const i3 = t3.getNodeEnd();
|
||||
i3 && i3.removeInputPath(t3), this.inputPaths.push(t3);
|
||||
}
|
||||
removeInputPath(t3) {
|
||||
const i3 = this.inputPaths.indexOf(t3);
|
||||
-1 !== i3 && this.inputPaths.splice(i3, 1);
|
||||
}
|
||||
getInputPaths() {
|
||||
return this.inputPaths;
|
||||
}
|
||||
getAllPaths() {
|
||||
return this.outputPaths.concat(this.inputPaths);
|
||||
}
|
||||
getType() {
|
||||
const t3 = this.outputPaths.length + this.inputPaths.length;
|
||||
return 2 === t3 ? n.NodeType.TURN : 1 === t3 ? n.NodeType.END : n.NodeType.CROSS;
|
||||
}
|
||||
};
|
||||
}, 82: (t2, i2, e2) => {
|
||||
Object.defineProperty(i2, "__esModule", { value: true }), i2.Path = void 0;
|
||||
const s = e2(895), n = e2(679);
|
||||
i2.Path = class {
|
||||
constructor(t3, i3) {
|
||||
this.buildings = [], this.nodeEnd = null, this.direction = i3, this.nodeBeg = t3, this.cursor = t3.position;
|
||||
}
|
||||
getBuildings() {
|
||||
return this.buildings;
|
||||
}
|
||||
getPositions() {
|
||||
var t3, i3;
|
||||
return { beg: this.nodeBeg.position, end: null !== (i3 = null === (t3 = this.nodeEnd) || void 0 === t3 ? void 0 : t3.position) && void 0 !== i3 ? i3 : this.cursor };
|
||||
}
|
||||
isCompleted() {
|
||||
return Boolean(this.nodeEnd);
|
||||
}
|
||||
getNextCursor() {
|
||||
const t3 = (0, n.getShift)(this.direction);
|
||||
return { x: this.cursor.x + t3.x, y: this.cursor.y + t3.y };
|
||||
}
|
||||
getCursor() {
|
||||
return this.cursor;
|
||||
}
|
||||
setCursor(t3) {
|
||||
this.cursor = t3;
|
||||
}
|
||||
getNodeBeg() {
|
||||
return this.nodeBeg;
|
||||
}
|
||||
getNodeEnd() {
|
||||
return this.nodeEnd;
|
||||
}
|
||||
setNodeEnd(t3) {
|
||||
t3.addInputPath(this), this.nodeEnd = t3, this.cursor = t3.position;
|
||||
}
|
||||
addBuilding(t3) {
|
||||
const i3 = new s.Building(this, t3);
|
||||
return this.buildings.push(i3), i3;
|
||||
}
|
||||
getLength() {
|
||||
const t3 = this.getPositions();
|
||||
return Math.hypot(t3.beg.x - t3.end.x, t3.beg.y - t3.end.y);
|
||||
}
|
||||
remove() {
|
||||
this.nodeBeg.removeOutputPath(this), this.nodeEnd && this.nodeEnd.removeInputPath(this);
|
||||
}
|
||||
each(t3) {
|
||||
const i3 = (0, n.getShift)(this.direction), e3 = this.getLength(), s2 = Object.assign({}, this.nodeBeg.position);
|
||||
for (let n2 = 0; n2 <= e3; n2++) t3(s2), s2.x += i3.x, s2.y += i3.y;
|
||||
}
|
||||
};
|
||||
}, 309: (t2, i2) => {
|
||||
var e2, s;
|
||||
Object.defineProperty(i2, "__esModule", { value: true }), i2.NodeType = i2.CityGenerationMode = void 0, function(t3) {
|
||||
t3.RUNTIME = "RUNTIME", t3.SEED = "SEED";
|
||||
}(e2 || (i2.CityGenerationMode = e2 = {})), function(t3) {
|
||||
t3.TURN = "TURN", t3.CROSS = "CROSS", t3.END = "END";
|
||||
}(s || (i2.NodeType = s = {}));
|
||||
}, 679: (t2, i2) => {
|
||||
function e2(t3) {
|
||||
return t3 * (Math.PI / 180);
|
||||
}
|
||||
function s(t3) {
|
||||
return [(t3 + 90) % 360, (t3 - 90) % 360];
|
||||
}
|
||||
Object.defineProperty(i2, "__esModule", { value: true }), i2.between = i2.getShift = i2.forkDirection = i2.turnDirection = i2.degToRad = i2.generateSeed = i2.randomRange = i2.randomItem = i2.randomChance = void 0, i2.randomChance = function(t3) {
|
||||
return Math.random() > 1 - t3;
|
||||
}, i2.randomItem = function(t3) {
|
||||
return t3[Math.floor(Math.random() * t3.length)];
|
||||
}, i2.randomRange = function(t3, i3) {
|
||||
return Math.floor(t3 + Math.random() * (i3 - t3 + 1));
|
||||
}, i2.generateSeed = function(t3 = 32) {
|
||||
const i3 = [];
|
||||
for (let e3 = 0; e3 < t3; e3++) i3.push(Math.round(1e3 * Math.random()));
|
||||
return i3;
|
||||
}, i2.degToRad = e2, i2.turnDirection = s, i2.forkDirection = function(t3) {
|
||||
return [t3].concat(s(t3));
|
||||
}, i2.getShift = function(t3, i3 = 1) {
|
||||
return { x: Math.round(Math.cos(e2(t3))) * i3, y: Math.round(Math.sin(e2(t3))) * i3 };
|
||||
}, i2.between = function(t3, i3) {
|
||||
return t3 >= i3[0] && t3 <= i3[1];
|
||||
};
|
||||
} }, i = {}, e = function e2(s) {
|
||||
var n = i[s];
|
||||
if (void 0 !== n) return n.exports;
|
||||
var r = i[s] = { exports: {} };
|
||||
return t[s].call(r.exports, r, r.exports, e2), r.exports;
|
||||
}(465);
|
||||
module.exports = e;
|
||||
})();
|
||||
}
|
||||
});
|
||||
|
||||
// src/adapter.js
|
||||
var adapter_exports = {};
|
||||
__export(adapter_exports, {
|
||||
generateFabric: () => generateFabric
|
||||
});
|
||||
var import_gen_city = __toESM(require_dist());
|
||||
var seed = (value) => {
|
||||
let state = 2166136261;
|
||||
for (const char of String(value)) {
|
||||
state ^= char.charCodeAt(0);
|
||||
state = Math.imul(state, 16777619);
|
||||
}
|
||||
return Array.from({ length: 256 }, () => {
|
||||
state = Math.imul(state ^ state >>> 15, 2246822519);
|
||||
return Math.abs(state % 1001);
|
||||
});
|
||||
};
|
||||
async function generateFabric(key, width = 180, height = 100) {
|
||||
if (typeof key !== "string" || !key || key.length > 256 || !Number.isInteger(width) || !Number.isInteger(height) || width < 64 || width > 320 || height < 64 || height > 240) {
|
||||
throw new RangeError("City generation bounds exceeded");
|
||||
}
|
||||
const city = new import_gen_city.City({ width, height });
|
||||
await city.generate({ mode: import_gen_city.CityGenerationMode.SEED, seed: seed(key), streetMinLength: 9, probabilityIntersection: 0.12, probabilityTurn: 0.09, probabilityStreetEnd: 0.012, buildingMinSize: 3, buildingMaxSize: 7, buildingMinSpace: 1, buildingMaxSpace: 2, buildingOffset: 1 });
|
||||
const fabric = {
|
||||
generator: "gen-city",
|
||||
version: "1.4.6",
|
||||
width,
|
||||
height,
|
||||
roads: city.getAllPaths().map((path) => {
|
||||
const p = path.getPositions();
|
||||
return [p.beg.x, p.beg.y, p.end.x, p.end.y];
|
||||
}),
|
||||
buildings: city.getAllBuildings().map((building) => building.vertices.map((point) => [point.x, point.y]))
|
||||
};
|
||||
if (fabric.roads.length > 4096 || fabric.buildings.length > 4096) throw new RangeError("City geometry budget exceeded");
|
||||
return fabric;
|
||||
}
|
||||
return __toCommonJS(adapter_exports);
|
||||
})();
|
||||
+4048
-619
File diff suppressed because it is too large.
Load diff
+4
-4
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../assets/editor/node_modules/@marijn/find-cluster-break/src/index.js", "../../../assets/editor/node_modules/@codemirror/state/dist/index.js", "../../../assets/editor/node_modules/style-mod/src/style-mod.js", "../../../assets/editor/node_modules/w3c-keyname/index.js", "../../../assets/editor/node_modules/@codemirror/view/dist/index.js", "../../../assets/editor/node_modules/@lezer/common/dist/index.js", "../../../assets/editor/node_modules/@lezer/highlight/dist/index.js", "../../../assets/editor/node_modules/@codemirror/language/dist/index.js", "../../../assets/editor/node_modules/@codemirror/commands/dist/index.js", "../../../assets/editor/node_modules/@codemirror/autocomplete/dist/index.js", "../../../assets/editor/node_modules/@lezer/lr/dist/index.js", "../../../assets/editor/node_modules/@lezer/html/dist/index.js", "../../../assets/editor/node_modules/@lezer/css/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-css/dist/index.js", "../../../assets/editor/node_modules/@lezer/javascript/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-javascript/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-html/dist/index.js", "../../../assets/editor/node_modules/@lezer/markdown/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-markdown/dist/index.js", "../../../assets/editor/node_modules/@codemirror/search/dist/index.js", "../../../assets/editor/node_modules/@replit/codemirror-vim/dist/index.js", "../../../assets/editor/src/editor.js"],
|
||||
"sourcesContent": ["// These are filled with ranges (rangeFrom[i] up to but not including\n// rangeTo[i]) of code points that count as extending characters.\nlet rangeFrom = [], rangeTo = []\n\n;(() => {\n // Compressed representation of the Grapheme_Cluster_Break=Extend\n // information from\n // http://www.unicode.org/Public/16.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.\n // Each pair of elements represents a range, as an offet from the\n // previous range and a length. Numbers are in base-36, with the empty\n // string being a shorthand for 1.\n let numbers = \"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o\".split(\",\").map(s => s ? parseInt(s, 36) : 1)\n for (let i = 0, n = 0; i < numbers.length; i++)\n (i % 2 ? rangeTo : rangeFrom).push(n = n + numbers[i])\n})()\n\nexport function isExtendingChar(code) {\n if (code < 768) return false\n for (let from = 0, to = rangeFrom.length;;) {\n let mid = (from + to) >> 1\n if (code < rangeFrom[mid]) to = mid\n else if (code >= rangeTo[mid]) from = mid + 1\n else return true\n if (from == to) return false\n }\n}\n\nfunction isRegionalIndicator(code) {\n return code >= 0x1F1E6 && code <= 0x1F1FF\n}\n\nfunction check(code) {\n for (let i = 0; i < rangeFrom.length; i++) {\n if (rangeTo[i] > code) return rangeFrom[i] <= code\n }\n return false\n}\n\nconst ZWJ = 0x200d\n\nexport function findClusterBreak(str, pos, forward = true, includeExtending = true) {\n return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending)\n}\n\nfunction nextClusterBreak(str, pos, includeExtending) {\n if (pos == str.length) return pos\n // If pos is in the middle of a surrogate pair, move to its start\n if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) pos--\n let prev = codePointAt(str, pos)\n pos += codePointSize(prev)\n while (pos < str.length) {\n let next = codePointAt(str, pos)\n if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {\n pos += codePointSize(next)\n prev = next\n } else if (isRegionalIndicator(next)) {\n let countBefore = 0, i = pos - 2\n while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) { countBefore++; i -= 2 }\n if (countBefore % 2 == 0) break\n else pos += 2\n } else {\n break\n }\n }\n return pos\n}\n\nfunction prevClusterBreak(str, pos, includeExtending) {\n while (pos > 0) {\n let found = nextClusterBreak(str, pos - 2, includeExtending)\n if (found < pos) return found\n pos--\n }\n return 0\n}\n\nfunction codePointAt(str, pos) {\n let code0 = str.charCodeAt(pos)\n if (!surrogateHigh(code0) || pos + 1 == str.length) return code0\n let code1 = str.charCodeAt(pos + 1)\n if (!surrogateLow(code1)) return code0\n return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000\n}\n\nfunction surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000 }\nfunction surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00 }\nfunction codePointSize(code) { return code < 0x10000 ? 1 : 2 }\n", "import { findClusterBreak as findClusterBreak$1 } from '@marijn/find-cluster-break';\n\n/**\nThe data structure for documents. @nonabstract\n*/\nclass Text {\n /**\n Get the line description around the given position.\n */\n lineAt(pos) {\n if (pos < 0 || pos > this.length)\n throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);\n return this.lineInner(pos, false, 1, 0);\n }\n /**\n Get the description for the given (1-based) line number.\n */\n line(n) {\n if (n < 1 || n > this.lines)\n throw new RangeError(`Invalid line number ${n}Line truncated
|
||||
"mappings": ";;AAEA,MAAI,YAAY,CAAC;AAAjB,MAAoB,UAAU,CAAC;AAE9B,GAAC,MAAM;AAON,QAAI,UAAU,izCAAizC,MAAM,GAAG,EAAE,IAAI,OAAK,IAAI,SAAS,GAAG,EAAE,IAAI,CAAC;AAC12C,aAAS,IAAI,GAAG,IAAI,GAAG,IAAI,QAAQ,QAAQ;AACzC,OAAC,IAAI,IAAI,UAAU,WAAW,KAAK,IAAI,IAAI,QAAQ,CAAC,CAAC;AAAA,EACzD,GAAG;AAEI,WAAS,gBAAgB,MAAM;AACpC,QAAI,OAAO,IAAK,QAAO;AACvB,aAAS,OAAO,GAAG,KAAK,UAAU,YAAU;AAC1C,UAAI,MAAO,OAAO,MAAO;AACzB,UAAI,OAAO,UAAU,GAAG,EAAG,MAAK;AAAA,eACvB,QAAQ,QAAQ,GAAG,EAAG,QAAO,MAAM;AAAA,UACvC,QAAO;AACZ,UAAI,QAAQ,GAAI,QAAO;AAAA,IACzB;AAAA,EACF;AAEA,WAAS,oBAAoB,MAAM;AACjC,WAAO,QAAQ,UAAW,QAAQ;AAAA,EACpC;AASA,MAAM,MAAM;AAEL,WAAS,iBAAiB,KAAK,KAAK,UAAU,MAAM,mBAAmB,MAAM;AAClF,YAAQ,UAAU,mBAAmB,kBAAkB,KAAK,KAAK,gBAAgB;AAAA,EACnF;AAEA,WAAS,iBAAiB,KAAK,KAAK,kBAAkB;AACpD,QAAI,OAAO,IAAI,OAAQ,QAAO;AAE9B,QAAI,OAAO,aAAa,IAAI,WAAW,GAAG,CAAC,KAAK,cAAc,IAAI,WAAW,MAAM,CAAC,CAAC,EAAG;AACxF,QAAI,OAAO,YAAY,KAAK,GAAG;AAC/B,WAAO,cAAc,IAAI;AACzB,WAAO,MAAM,IAAI,QAAQ;AACvB,UAAI,OAAO,YAAY,KAAK,GAAG;AAC/B,UAAI,QAAQ,OAAO,QAAQ,OAAO,oBAAoB,gBAAgB,IAAI,GAAG;AAC3E,eAAO,cAAc,IAAI;AACzB,eAAO;AAAA,MACT,WAAW,oBAAoB,IAAI,GAAG;AACpC,YAAI,cAAc,GAAG,IAAI,MAAM;AAC/B,eAAO,KAAK,KAAK,oBAAoB,YAAY,KAAK,CAAC,CAAC,GAAG;AAAE;AAAe,eAAK;AAAA,QAAE;AACnF,YAAI,cAAc,KAAK,EAAG;AAAA,YACrB,QAAO;AAAA,MACd,OAAO;AACL;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,WAAS,iBAAiB,KAAK,KAAK,kBAAkB;AACpD,WAAO,MAAM,GAAG;AACd,UAAI,QAAQ,iBAAiB,KAAK,MAAM,GAAG,gBAAgB;AAC3D,UAAI,QAAQ,IAAK,QAAO;AACxB;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,WAAS,YAAY,KAAK,KAAK;AAC7B,QAAI,QAAQ,IAAI,WAAW,GAAG;AAC9B,QAAI,CAAC,cAAc,KAAK,KAAK,MAAM,KAAK,IAAI,OAAQ,QAAO;AAC3D,QAAI,QAAQ,IAAI,WAAW,MAAM,CAAC;AAClC,QAAI,CAAC,aAAa,KAAK,EAAG,QAAO;AACjC,YAAS,QAAQ,SAAW,OAAO,QAAQ,SAAU;AAAA,EACvD;AAEA,WAAS,aAAa,IAAI;AAAE,WAAO,MAAM,SAAU,KAAK;AAAA,EAAO;AAC/D,WAAS,cAAc,IAAI;AAAE,WAAO,MAAM,SAAU,KAAK;AAAA,EAAO;AAChE,WAAS,cAAc,MAAM;AAAE,WAAO,OAAO,QAAU,IAAI;AAAA,EAAE;;;ACjF7D,MAAMA,QAAN,MAAM,MAAK;AAAA;AAAA;AAAA;AAAA,IAIP,OAAO,KAAK;AACR,UAAI,MAAM,KAAK,MAAM,KAAK;AACtB,cAAM,IAAI,WAAW,oBAAoB,GAAG,0BAA0B,KAAK,MAAM,EAAE;AACvF,aAAO,KAAK,UAAU,KAAK,OAAO,GAAG,CAAC;AAAA,IAC1C;AAAA;AAAA;AAAA;AAAA,IAIA,KAAK,GAAG;AACJ,UAAI,IAAI,KAAK,IAAI,KAAK;AAClB,cAAM,IAAI,WAAW,uBAAuB,CAAC,OAAO,KAAK,KAAK,gBAAgB;AAClF,aAAO,KAAK,UAAU,GAAG,MAAM,GAAG,CAAC;AAAA,IACvC;AAAA;AAAA;AAAA;AAAA,IAIA,QAAQ,MAAM,IAAI,MAAM;AACpB,OAAC,MAAM,EAAE,IAAI,KAAK,MAAM,MAAM,EAAE;AAChC,UAAI,QAAQ,CAAC;AACb,WAAK;AAAA,QAAU;AAAA,QAAG;AAAA,QAAM;AAAA,QAAO;AAAA;AAAA,MAAe;AAC9C,UAAI,KAAK;AACL,aAAK;AAAA,UAAU;AAAA,UAAG,KAAK;AAAA,UAAQ;AAAA,UAAO,IAAoB;AAAA;AAAA,QAAe;AAC7E,WAAK;AAAA,QAAU;AAAA,QAAI,KAAK;AAAA,QAAQ;AAAA,QAAO;AAAA;AAAA,MAAiB;AACxD,aAAO,SAAS,KAAK,OAAO,KAAK,UAAU,KAAK,QAAQ,KAAK,MAAM;AAAA,IACvE;AAAA;AAAA;AAAA;AAAA,IAIA,OAAO,OAAO;AACV,aAAO,KAAK,QAAQ,KAAK,QAAQ,KAAK,QAAQ,KAAK;AAAA,IACvD;AAAA;AAAA;AAAA;AAAA,IAIA,MAAM,MAAM,KAAK,KAAK,QAAQ;AAC1B,OAAC,MAAM,EAAE,IAAI,KAAK,MAAM,MAAM,EAAE;AAChC,UAAI,QAAQ,CAAC;AACb,WAAK,UAAU,MAAM,IAAI,OAAO,CAAC;AACjC,aAAO,SAAS,KAAK,OAAO,KAAK,IAAI;AAAA,IACzC;AAAA;AAAA;AAAA;AAAA,IAIA,GAAG,OAAO;AACN,UAAI,SAAS;AACT,eAAO;AACX,UAAI,MAAM,UAAU,KAAK,UAAU,MAAM,SAAS,KAAK;AACnD,eAAO;AACX,UAAI,QAAQ,KAAK,cAAc,OAAO,CAAC,GAAG,MAAM,KAAK,SAAS,KAAK,cAAc,OAAO,EAAE;AAC1F,UAAI,IAAI,IAAI,cAAc,IAAI,GAAG,IAAI,IAAI,cAAc,KAAK;AAC5D,eAAS,OAAO,OAAO,MAAM,WAAS;AAClC,UAAE,KAAK,IAAI;AACX,UAAE,KAAK,IAAI;AACX,eAAO;AACP,YAAI,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE;AAC/D,iBAAO;AACX,eAAO,EAAE,MAAM;AACf,YAAI,EAAE,QAAQ,OAAO;AACjB,iBAAO;AAAA,MACf;AAAA,IACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,KAAK,MAAM,GAAG;AAAE,aAAO,IAAI,cAAc,MAAM,GAAG;AAAA,IAAG;AAAA;AAAA;AAAA;AAAA;AAAA,IAKrD,UAAU,MAAM,KAAK,KAAK,QAAQ;AAAE,aAAO,IAAI,kBAAkB,MAAM,MAAM,EAAE;AAAA,IAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQlF,UAAU,MAAM,IAAI;AAChB,UAAI;AACJ,UAAI,QAAQ,MAAM;AACd,gBAAQ,KAAK,KAAK;AAAA,MACtB,OACK;AACD,YAAI,MAAM;AACN,eAAK,KAAK,QAAQ;AACtB,YAAI,QAAQ,KAAK,KAAK,IAAI,EAAE;AAC5B,gBAAQ,KAAK,UAAU,OAAO,KAAK,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,SAAS,MAAM,IAAI,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE,EAAE,CAAC;AAAA,MAC1H;AACA,aAAO,IAAI,WAAW,KAAK;AAAA,IAC/B;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,WAAW;AAAE,aAAO,KAAK,YAAY,CAAC;AAAA,IAAG;AAAA;AAAA;AAAA;AAAA;AAAA,IAKzC,SAAS;AACL,UAAI,QAAQ,CAAC;AACb,WAAK,QAAQ,KAAK;AAClB,aAAO;AAAA,IACX;AAAA;AAAA;AAAA;AAAA,IAIA,cAAc;AAAA,IAAE;AAAA;AAAA;AAAA;AAAA,IAIhB,OAAO,GAAG,MAAM;AACZ,UAAI,KAAK,UAAU;AACf,cAAM,IAAI,WAAW,wCAAwC;AACjE,UAAI,KAAK,UAAU,KAAK,CAAC,KAAK,CAAC;AAC3B,eAAO,MAAK;AAChB,aAAO,KAAK,UAAU,KAAuB,IAAI,SAAS,IAAI,IAAI,SAAS,KAAK,SAAS,MAAM,MAAM,CAAC,CAAC,CAAC;AAAA,IAC5G;AAAA,EACJ;AAIA,MAAM,WAAN,MAAM,kBAAiBA,MAAK;AAAA,IACxB,YAAY,MAAM,SAAS,WAAW,IAAI,GAAG;AACzC,YAAM;AACN,WAAK,OAAO;AACZ,WAAK,SAAS;AAAA,IAClB;AAAA,IACA,IAAI,QAAQ;AAAE,aAAO,KAAK,KAAK;AAAA,IAAQ;AAAA,IACvC,IAAI,WAAW;AAAE,aAAO;AAAA,IAAM;AAAA,IAC9B,UAAU,QAAQ,QAAQ,MAAM,QAAQ;AACpC,eAAS,IAAI,KAAI,KAAK;AAClB,YAAIC,UAAS,KAAK,KAAK,CAAC,GAAG,MAAM,SAASA,QAAO;AACjD,aAAK,SAAS,OAAO,QAAQ;AACzB,iBAAO,IAAI,KAAK,QAAQ,KAAK,MAAMA,OAAM;AAC7C,iBAAS,MAAM;AACf;AAAA,MACJ;AAAA,IACJ;AAAA,IACA,UAAU,MAAM,IAAI,QAAQ,MAAM;AAC9B,UAAI,OAAO,QAAQ,KAAK,MAAM,KAAK,SAAS,OACtC,IAAI,UAAS,UAAU,KAAK,MAAM,MAAM,EAAE,GAAG,KAAK,Line truncated
|
||||
"names": ["Text", "string", "top", "number", "findClusterBreak", "surrogateLow", "surrogateHigh", "codePointAt", "codePointSize", "MapMode", "doc", "process", "insert", "i", "values", "compare", "config", "_a", "id", "prec", "content", "base", "scrollIntoView", "CharCategory", "require", "name", "defaults", "cur", "spec", "id", "doc", "name", "ie", "name", "BlockType", "off", "elt", "doc", "cur", "top", "rect", "Direction", "replace", "type", "_a", "findClusterBreak", "values", "t", "id", "pos", "flatten", "Text", "dist", "cache", "blockWrappers", "marks", "tile", "decorations", "from", "to", "offset", "textHeight", "i", "content", "child", "scrollIntoView", "base", "handlers", "observers", "insert", "event", "data", "QueryType", "DecorationComparator", "gap", "key", "view", "config", "shift", "meta", "command", "codePointAt", "codePointSize", "cmd", "t", "_a", "i", "values", "_a", "config", "t", "space", "top", "elt", "top", "values", "config", "gutter", "cur", "gutters", "asArray", "marker", "elt", "event", "number", "Range", "config", "parser", "name", "id", "types", "IterMode", "data", "_a", "mounted", "cur", "cache", "children", "positions", "node", "buffer", "contextHash", "length", "lookAhead", "base", "pair", "nodeSize", "nodeStart", "from", "to", "off", "string", "done", "inner", "r", "pos", "name", "base", "t", "sameArray", "config", "tags", "cur", "hasChild", "rangeFrom", "rangeTo", "name", "values", "data", "parser", "name", "top", "base", "_a", "doc", "parser", "_a", "language", "name", "values", "cur", "base", "lineEnd", "space", "closing", "cur", "lineEnd", "_a", "from", "to", "values", "config", "baseTheme$1", "baseTheme$1", "values", "from", "to", "baseTheme", "decorations", "config", "cur", "matching", "bracket", "pos", "string", "indentUnit", "_a", "name", "name", "t", "config", "data", "comment", "empty", "isAdjacent", "config", "command", "_a", "none", "isAdjacent", "t", "config", "bracket", "space", "matching", "cur", "findClusterBreak", "findClusterBreak", "nextChar", "lineEnd", "Text", "findClusterBreak", "dist", "insert", "Text", "changes", "cur", "space", "types", "score", "_a", "codePointAt", "codePointSize", "space", "config", "content", "off", "applyCompletion", "options", "id", "scrollIntoView", "name", "compare", "cur", "none", "noAttrs", "baseTheme", "pos", "m", "snippet", "Text", "inputHandler", "insert", "codePointSize", "codePointAt", "bracket", "doc", "config", "content", "baseTheme", "score", "_a", "parser", "base", "count", "top", "off", "i", "Type", "data", "id", "FragmentCursor", "insert", "name", "config", "t", "prec", "values", "name", "getAttrs", "tags", "id", "attrs", "dash", "id", "callee", "parser", "name", "tags", "identifier", "doc", "_a", "callee", "cur", "node", "parser", "newline", "space", "slash", "question", "bracketL", "spec_identifier", "parser", "id", "doc", "top", "node", "name", "parser", "_a", "name", "config", "doc", "android", "base", "empty", "insert", "elementName", "doc", "name", "identifier", "elt", "_a", "base", "config", "cur", "autoCloseTags", "selfClosers", "to", "insert", "hash", "Type", "content", "Line", "elt", "space", "count", "marks", "base", "empty", "off", "parser", "FragmentCursor", "none", "top", "rangeEnd", "t", "config", "nodeTypes", "name", "id", "rm", "spec", "conc", "Element", "comment", "cur", "node", "m", "next", "parser", "heading", "doc", "number", "cur", "node", "content", "space", "config", "insert", "changes", "empty", "_a", "codePointAt", "codePointSize", "off", "doc", "_a", "config", "QueryType", "doc", "findClusterBreak", "Pos", "defaultKeymap", "vim", "name", "find", "InputState", "keyName", "command", "keys", "prompt", "value", "keymap", "semicolon", "operator", "macroModeState", "onChange", "query", "e", "cur", "content", "top", "spaces", "base", "number", "tags", "i", "dir", "nextChar", "cm", "options", "searchState", "commandMatch", "noremap", "marks", "lineEnd", "numberRegex", "cmd", "count", "replace", "repeat", "doc", "_a", "handlers", "wordChar", "config", "scrollIntoView", "on", "space", "line", "max", "getDrawSelectionConfig", "defaultConfig", "elt", "from", "to", "vimPlugin", "cmd"]
|
||||
"sources": ["../../../assets/editor/node_modules/@marijn/find-cluster-break/src/index.js", "../../../assets/editor/node_modules/@codemirror/state/dist/index.js", "../../../assets/editor/node_modules/style-mod/src/style-mod.js", "../../../assets/editor/node_modules/w3c-keyname/index.js", "../../../assets/editor/node_modules/@codemirror/view/dist/index.js", "../../../assets/editor/node_modules/@lezer/common/dist/index.js", "../../../assets/editor/node_modules/@lezer/highlight/dist/index.js", "../../../assets/editor/node_modules/@codemirror/language/dist/index.js", "../../../assets/editor/node_modules/@codemirror/commands/dist/index.js", "../../../assets/editor/node_modules/@codemirror/autocomplete/dist/index.js", "../../../assets/editor/node_modules/@lezer/lr/dist/index.js", "../../../assets/editor/node_modules/@lezer/html/dist/index.js", "../../../assets/editor/node_modules/@lezer/css/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-css/dist/index.js", "../../../assets/editor/node_modules/@lezer/javascript/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-javascript/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-html/dist/index.js", "../../../assets/editor/node_modules/@lezer/markdown/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-markdown/dist/index.js", "../../../assets/editor/node_modules/@lezer/python/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-python/dist/index.js", "../../../assets/editor/node_modules/@lezer/json/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-json/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-sql/dist/index.js", "../../../assets/editor/node_modules/@lezer/yaml/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-yaml/dist/index.js", "../../../assets/editor/node_modules/@lezer/go/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-go/dist/index.js", "../../../assets/editor/node_modules/@lezer/rust/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-rust/dist/index.js", "../../../assets/editor/node_modules/@lezer/java/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-java/dist/index.js", "../../../assets/editor/node_modules/@lezer/cpp/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-cpp/dist/index.js", "../../../assets/editor/node_modules/@codemirror/legacy-modes/mode/shell.js", "../../../assets/editor/node_modules/@codemirror/legacy-modes/mode/toml.js", "../../../assets/editor/node_modules/@codemirror/search/dist/index.js", "../../../assets/editor/node_modules/@replit/codemirror-vim/dist/index.js", "../../../assets/editor/src/editor.js"],
|
||||
"sourcesContent": ["// These are filled with ranges (rangeFrom[i] up to but not including\n// rangeTo[i]) of code points that count as extending characters.\nlet rangeFrom = [], rangeTo = []\n\n;(() => {\n // Compressed representation of the Grapheme_Cluster_Break=Extend\n // information from\n // http://www.unicode.org/Public/16.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.\n // Each pair of elements represents a range, as an offet from the\n // previous range and a length. Numbers are in base-36, with the empty\n // string being a shorthand for 1.\n let numbers = \"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o\".split(\",\").map(s => s ? parseInt(s, 36) : 1)\n for (let i = 0, n = 0; i < numbers.length; i++)\n (i % 2 ? rangeTo : rangeFrom).push(n = n + numbers[i])\n})()\n\nexport function isExtendingChar(code) {\n if (code < 768) return false\n for (let from = 0, to = rangeFrom.length;;) {\n let mid = (from + to) >> 1\n if (code < rangeFrom[mid]) to = mid\n else if (code >= rangeTo[mid]) from = mid + 1\n else return true\n if (from == to) return false\n }\n}\n\nfunction isRegionalIndicator(code) {\n return code >= 0x1F1E6 && code <= 0x1F1FF\n}\n\nfunction check(code) {\n for (let i = 0; i < rangeFrom.length; i++) {\n if (rangeTo[i] > code) return rangeFrom[i] <= code\n }\n return false\n}\n\nconst ZWJ = 0x200d\n\nexport function findClusterBreak(str, pos, forward = true, includeExtending = true) {\n return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending)\n}\n\nfunction nextClusterBreak(str, pos, includeExtending) {\n if (pos == str.length) return pos\n // If pos is in the middle of a surrogate pair, move to its start\n if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) pos--\n let prev = codePointAt(str, pos)\n pos += codePointSize(prev)\n while (pos < str.length) {\n let next = codePointAt(str, pos)\n if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {\n pos += codePointSize(next)\n prev = next\n } else if (isRegionalIndicator(next)) {\n let countBefore = 0, i = pos - 2\n while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) { countBefore++; i -= 2 }\n if (countBefore % 2 == 0) break\n else pos += 2\n } else {\n break\n }\n }\n return pos\n}\n\nfunction prevClusterBreak(str, pos, includeExtending) {\n while (pos > 0) {\n let found = nextClusterBreak(str, pos - 2, includeExtending)\n if (found < pos) return found\n pos--\n }\n return 0\n}\n\nfunction codePointAt(str, pos) {\n let code0 = str.charCodeAt(pos)\n if (!surrogateHigh(code0) || pos + 1 == str.length) return code0\n let code1 = str.charCodeAt(pos + 1)\n if (!surrogateLow(code1)) return code0\n return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000\n}\n\nfunction surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000 }\nfunction surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00 }\nfunction codePointSize(code) { return code < 0x10000 ? 1 : 2 }\n", "import { findClusterBreak as findClusterBreak$1 } from '@marijn/find-cluster-break';\n\n/**\nThe data structure for documents. @nonabstract\n*/\nclass Text {\n /**\n Get the line description around the given position.\n */\n lineAt(pos) {\n if (pos < 0 || pos > this.length)\n throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);\n return this.lineInner(pos, false, 1, 0);\n }\n /**\n Get the description for the given (1-based) line number.\n */\n line(n) {\n if (n < 1 || n > this.lines)\n throw new RangeError(`Invalid line number ${n}Line truncated
|
||||
"mappings": ";;AAEA,MAAI,YAAY,CAAC;AAAjB,MAAoB,UAAU,CAAC;AAE9B,GAAC,MAAM;AAON,QAAI,UAAU,izCAAizC,MAAM,GAAG,EAAE,IAAI,OAAK,IAAI,SAAS,GAAG,EAAE,IAAI,CAAC;AAC12C,aAAS,IAAI,GAAG,IAAI,GAAG,IAAI,QAAQ,QAAQ;AACzC,OAAC,IAAI,IAAI,UAAU,WAAW,KAAK,IAAI,IAAI,QAAQ,CAAC,CAAC;AAAA,EACzD,GAAG;AAEI,WAAS,gBAAgB,MAAM;AACpC,QAAI,OAAO,IAAK,QAAO;AACvB,aAAS,OAAO,GAAG,KAAK,UAAU,YAAU;AAC1C,UAAI,MAAO,OAAO,MAAO;AACzB,UAAI,OAAO,UAAU,GAAG,EAAG,MAAK;AAAA,eACvB,QAAQ,QAAQ,GAAG,EAAG,QAAO,MAAM;AAAA,UACvC,QAAO;AACZ,UAAI,QAAQ,GAAI,QAAO;AAAA,IACzB;AAAA,EACF;AAEA,WAAS,oBAAoB,MAAM;AACjC,WAAO,QAAQ,UAAW,QAAQ;AAAA,EACpC;AASA,MAAM,MAAM;AAEL,WAAS,iBAAiB,KAAK,KAAK,UAAU,MAAM,mBAAmB,MAAM;AAClF,YAAQ,UAAU,mBAAmB,kBAAkB,KAAK,KAAK,gBAAgB;AAAA,EACnF;AAEA,WAAS,iBAAiB,KAAK,KAAK,kBAAkB;AACpD,QAAI,OAAO,IAAI,OAAQ,QAAO;AAE9B,QAAI,OAAO,aAAa,IAAI,WAAW,GAAG,CAAC,KAAK,cAAc,IAAI,WAAW,MAAM,CAAC,CAAC,EAAG;AACxF,QAAI,OAAO,YAAY,KAAK,GAAG;AAC/B,WAAO,cAAc,IAAI;AACzB,WAAO,MAAM,IAAI,QAAQ;AACvB,UAAI,OAAO,YAAY,KAAK,GAAG;AAC/B,UAAI,QAAQ,OAAO,QAAQ,OAAO,oBAAoB,gBAAgB,IAAI,GAAG;AAC3E,eAAO,cAAc,IAAI;AACzB,eAAO;AAAA,MACT,WAAW,oBAAoB,IAAI,GAAG;AACpC,YAAI,cAAc,GAAG,IAAI,MAAM;AAC/B,eAAO,KAAK,KAAK,oBAAoB,YAAY,KAAK,CAAC,CAAC,GAAG;AAAE;AAAe,eAAK;AAAA,QAAE;AACnF,YAAI,cAAc,KAAK,EAAG;AAAA,YACrB,QAAO;AAAA,MACd,OAAO;AACL;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,WAAS,iBAAiB,KAAK,KAAK,kBAAkB;AACpD,WAAO,MAAM,GAAG;AACd,UAAI,QAAQ,iBAAiB,KAAK,MAAM,GAAG,gBAAgB;AAC3D,UAAI,QAAQ,IAAK,QAAO;AACxB;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,WAAS,YAAY,KAAK,KAAK;AAC7B,QAAI,QAAQ,IAAI,WAAW,GAAG;AAC9B,QAAI,CAAC,cAAc,KAAK,KAAK,MAAM,KAAK,IAAI,OAAQ,QAAO;AAC3D,QAAI,QAAQ,IAAI,WAAW,MAAM,CAAC;AAClC,QAAI,CAAC,aAAa,KAAK,EAAG,QAAO;AACjC,YAAS,QAAQ,SAAW,OAAO,QAAQ,SAAU;AAAA,EACvD;AAEA,WAAS,aAAa,IAAI;AAAE,WAAO,MAAM,SAAU,KAAK;AAAA,EAAO;AAC/D,WAAS,cAAc,IAAI;AAAE,WAAO,MAAM,SAAU,KAAK;AAAA,EAAO;AAChE,WAAS,cAAc,MAAM;AAAE,WAAO,OAAO,QAAU,IAAI;AAAA,EAAE;;;ACjF7D,MAAMA,QAAN,MAAM,MAAK;AAAA;AAAA;AAAA;AAAA,IAIP,OAAO,KAAK;AACR,UAAI,MAAM,KAAK,MAAM,KAAK;AACtB,cAAM,IAAI,WAAW,oBAAoB,GAAG,0BAA0B,KAAK,MAAM,EAAE;AACvF,aAAO,KAAK,UAAU,KAAK,OAAO,GAAG,CAAC;AAAA,IAC1C;AAAA;AAAA;AAAA;AAAA,IAIA,KAAK,GAAG;AACJ,UAAI,IAAI,KAAK,IAAI,KAAK;AAClB,cAAM,IAAI,WAAW,uBAAuB,CAAC,OAAO,KAAK,KAAK,gBAAgB;AAClF,aAAO,KAAK,UAAU,GAAG,MAAM,GAAG,CAAC;AAAA,IACvC;AAAA;AAAA;AAAA;AAAA,IAIA,QAAQ,MAAM,IAAI,MAAM;AACpB,OAAC,MAAM,EAAE,IAAI,KAAK,MAAM,MAAM,EAAE;AAChC,UAAI,QAAQ,CAAC;AACb,WAAK;AAAA,QAAU;AAAA,QAAG;AAAA,QAAM;AAAA,QAAO;AAAA;AAAA,MAAe;AAC9C,UAAI,KAAK;AACL,aAAK;AAAA,UAAU;AAAA,UAAG,KAAK;AAAA,UAAQ;AAAA,UAAO,IAAoB;AAAA;AAAA,QAAe;AAC7E,WAAK;AAAA,QAAU;AAAA,QAAI,KAAK;AAAA,QAAQ;AAAA,QAAO;AAAA;AAAA,MAAiB;AACxD,aAAO,SAAS,KAAK,OAAO,KAAK,UAAU,KAAK,QAAQ,KAAK,MAAM;AAAA,IACvE;AAAA;AAAA;AAAA;AAAA,IAIA,OAAO,OAAO;AACV,aAAO,KAAK,QAAQ,KAAK,QAAQ,KAAK,QAAQ,KAAK;AAAA,IACvD;AAAA;AAAA;AAAA;AAAA,IAIA,MAAM,MAAM,KAAK,KAAK,QAAQ;AAC1B,OAAC,MAAM,EAAE,IAAI,KAAK,MAAM,MAAM,EAAE;AAChC,UAAI,QAAQ,CAAC;AACb,WAAK,UAAU,MAAM,IAAI,OAAO,CAAC;AACjC,aAAO,SAAS,KAAK,OAAO,KAAK,IAAI;AAAA,IACzC;AAAA;AAAA;AAAA;AAAA,IAIA,GAAG,OAAO;AACN,UAAI,SAAS;AACT,eAAO;AACX,UAAI,MAAM,UAAU,KAAK,UAAU,MAAM,SAAS,KAAK;AACnD,eAAO;AACX,UAAI,QAAQ,KAAK,cAAc,OAAO,CAAC,GAAG,MAAM,KAAK,SAAS,KAAK,cAAc,OAAO,EAAE;AAC1F,UAAIC,KAAI,IAAI,cAAc,IAAI,GAAG,IAAI,IAAI,cAAc,KAAK;AAC5D,eAAS,OAAO,OAAO,MAAM,WAAS;AAClC,QAAAA,GAAE,KAAK,IAAI;AACX,UAAE,KAAK,IAAI;AACX,eAAO;AACP,YAAIA,GAAE,aAAa,EAAE,aAAaA,GAAE,QAAQ,EAAE,QAAQA,GAAE,SAAS,EAAE;AAC/D,iBAAO;AACX,eAAOA,GAAE,MAAM;AACf,YAAIA,GAAE,QAAQ,OAAO;AACjB,iBAAO;AAAA,MACf;AAAA,IACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,KAAK,MAAM,GAAG;AAAE,aAAO,IAAI,cAAc,MAAM,GAAG;AAAA,IAAG;AAAA;AAAA;AAAA;AAAA;AAAA,IAKrD,UAAU,MAAM,KAAK,KAAK,QAAQ;AAAE,aAAO,IAAI,kBAAkB,MAAM,MAAM,EAAE;AAAA,IAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQlF,UAAU,MAAM,IAAI;AAChB,UAAI;AACJ,UAAI,QAAQ,MAAM;AACd,gBAAQ,KAAK,KAAK;AAAA,MACtB,OACK;AACD,YAAI,MAAM;AACN,eAAK,KAAK,QAAQ;AACtB,YAAI,QAAQ,KAAK,KAAK,IAAI,EAAE;AAC5B,gBAAQ,KAAK,UAAU,OAAO,KAAK,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,SAAS,MAAM,IAAI,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE,EAAE,CAAC;AAAA,MAC1H;AACA,aAAO,IAAI,WAAW,KAAK;AAAA,IAC/B;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,WAAW;AAAE,aAAO,KAAK,YAAY,CAAC;AAAA,IAAG;AAAA;AAAA;AAAA;AAAA;AAAA,IAKzC,SAAS;AACL,UAAI,QAAQ,CAAC;AACb,WAAK,QAAQ,KAAK;AAClB,aAAO;AAAA,IACX;AAAA;AAAA;AAAA;AAAA,IAIA,cAAc;AAAA,IAAE;AAAA;AAAA;AAAA;AAAA,IAIhB,OAAO,GAAG,MAAM;AACZ,UAAI,KAAK,UAAU;AACf,cAAM,IAAI,WAAW,wCAAwC;AACjE,UAAI,KAAK,UAAU,KAAK,CAAC,KAAK,CAAC;AAC3B,eAAO,MAAK;AAChB,aAAO,KAAK,UAAU,KAAuB,IAAI,SAAS,IAAI,IAAI,SAAS,KAAK,SAAS,MAAM,MAAM,CAAC,CAAC,CAAC;AAAA,IAC5G;AAAA,EACJ;AAIA,MAAM,WAAN,MAAM,kBAAiBD,MAAK;AAAA,IACxB,YAAY,MAAM,SAAS,WAAW,IAAI,GAAG;AACzC,YAAM;AACN,WAAK,OAAO;AACZ,WAAK,SAAS;AAAA,IAClB;AAAA,IACA,IAAI,QAAQ;AAAE,aAAO,KAAK,KAAK;AAAA,IAAQ;AAAA,IACvC,IAAI,WAAW;AAAE,aAAO;AAAA,IAAM;AAAA,IAC9B,UAAU,QAAQ,QAAQ,MAAM,QAAQ;AACpC,eAAS,IAAI,KAAI,KAAK;AAClB,YAAIE,UAAS,KAAK,KAAK,CAAC,GAAG,MAAM,SAASA,QAAO;AACjD,aAAK,SAAS,OAAO,QAAQ;AACzB,iBAAO,IAAI,KAAK,QAAQ,KAAK,MAAMA,OAAM;AAC7C,iBAAS,MAAM;AACf;AAAA,MACJ;AAAA,IACJ;AAAA,IACA,UAAU,MAAM,IAAI,QAAQ,MAAM;AAC9B,UAAI,OAAO,QAAQ,KAAK,MAAM,KAAK,SAAS,OACtC,IAAI,UAAS,UAAU,KAAK,MAAM,MAAM,EAALine truncated
|
||||
"names": ["Text", "a", "string", "top", "number", "findClusterBreak", "surrogateLow", "surrogateHigh", "codePointAt", "codePointSize", "MapMode", "json", "doc", "process", "insert", "i", "values", "compare", "config", "_a", "id", "prec", "content", "base", "scrollIntoView", "CharCategory", "require", "name", "defaults", "cur", "spec", "a", "id", "doc", "name", "ie", "name", "a", "BlockType", "off", "elt", "doc", "cur", "top", "rect", "Direction", "replace", "type", "isNum", "_a", "findClusterBreak", "values", "t", "id", "pos", "flatten", "Text", "dist", "cache", "blockWrappers", "marks", "tile", "decorations", "from", "to", "offset", "textHeight", "i", "content", "child", "scrollIntoView", "base", "handlers", "observers", "insert", "event", "data", "_b", "QueryType", "DecorationComparator", "gap", "key", "view", "config", "shift", "meta", "command", "codePointAt", "codePointSize", "cmd", "a", "t", "_a", "i", "values", "_a", "_b", "config", "t", "space", "top", "elt", "top", "values", "config", "gutter", "cur", "gutters", "asArray", "marker", "elt", "a", "event", "number", "Range", "config", "parser", "bracketed", "name", "id", "types", "IterMode", "data", "_a", "mounted", "cur", "cache", "nodeSet", "children", "positions", "node", "buffer", "contextHash", "length", "lookAhead", "base", "pair", "nodeSize", "nodeStart", "from", "to", "off", "string", "done", "inner", "r", "pos", "a", "name", "base", "t", "a", "sameArray", "config", "tags", "cur", "hasChild", "rangeFrom", "rangeTo", "name", "values", "data", "parser", "name", "top", "base", "_a", "doc", "stringStart", "parser", "_a", "language", "name", "a", "values", "cur", "base", "lineEnd", "space", "closing", "cur", "lineEnd", "a", "_a", "from", "to", "a", "values", "config", "baseTheme$1", "baseTheme$1", "values", "from", "to", "baseTheme", "decorations", "config", "cur", "matching", "bracket", "pos", "string", "indentUnit", "_a", "parser", "data", "line", "indentation", "off", "eol", "rangeEnd", "id", "name", "t", "config", "data", "tokens", "comment", "indent", "empty", "isAdjacent", "a", "config", "json", "command", "_a", "_b", "json", "none", "a", "isAdjacent", "t", "_f", "config", "bracket", "space", "matching", "cur", "findClusterBreak", "findClusterBreak", "nextChar", "lineEnd", "Text", "findClusterBreak", "dist", "indent", "insert", "Text", "changes", "cur", "space", "types", "words", "score", "_a", "codePointAt", "codePointSize", "a", "space", "config", "content", "off", "applyCompletion", "options", "id", "scrollIntoView", "name", "compare", "cur", "none", "noAttrs", "baseTheme", "indent", "pos", "m", "snippet", "Text", "inputHandler", "insert", "codePointSize", "codePointAt", "tokens", "bracket", "doc", "config", "content", "baseTheme", "score", "_a", "parser", "base", "count", "top", "off", "i", "Type", "data", "id", "readToken", "dialect", "FragmentCursor", "nodeSet", "Parse", "a", "tokens", "insert", "name", "config", "t", "prec", "values", "name", "getAttrs", "tags", "id", "attrs", "dash", "id", "callee", "parser", "name", "tags", "identifier", "doc", "_a", "callee", "cur", "node", "parser", "newline", "space", "slash", "question", "bracketL", "spec_identifier", "parser", "id", "doc", "top", "node", "name", "parser", "_a", "name", "config", "doc", "android", "base", "empty", "insert", "a", "elementName", "doc", "name", "identifier", "elt", "_a", "base", "config", "cur", "dialect", "autoCloseTags", "selfClosers", "_b", "to", "insert", "hash", "nodeSet", "Type", "content", "Line", "indent", "elt", "space", "count", "marks", "base", "empty", "off", "parser", "FragmentCursor", "eol", "none", "top", "rangeEnd", "t", "config", "nodeTypes", "name", "id", "rm", "spec", "a", "conc", "Element", "comment", "cur", "node", "m", "next", "parser", "heading", "doc", "number", "cur", "node", "content", "space", "config", "insert", "changes", "empty", "_a", "newline", "space", "hash", "dot", "backslash", "isHex", "spaces", "Context", "indent", "topIndent", "off", "spec_identifier", "parser", "cache", "ScopeNodes", "defID", "id", "gatherCompletions", "_a", "_b", "getScope", "doc", "top", "node", "name", "Identifier", "dontComplete", "localCompletionSource", "snippets", "base", "parser", "parser", "parser", "LineComment", "BlockComment", "String$1", "Number", "Bool", "ParenL", "BraceL", "BracketL", "Punctuation", "Identifier", "Type", "isAlpha", "keywords", "types", "defaults", "dialect", "_a", "cur", "doc", "id", "name", "top", "empty", "keyword", "parser", "language", "config", "eof", "Tag", "BracketL", "BraceL", "Context", "findColumn", "indentation", "indent", "off", "newlines", "parser", "parser", "identifier", "String", "Number", "newline", "carriageReturn", "space", "tab", "slash", "semicolon", "spec_identifier", "parser", "snippets", "cache", "ScopeNodes", "cur", "gatherCompletions", "getScope", "doc", "top", "node", "name", "Identifier", "dontComplete", "localCompletionSource", "parser", "kwCompletion", "keywords", "Dot", "count", "spec_identifier"Line truncated
|
||||
}
|
||||
Vendored
+119
-79
@@ -35,7 +35,19 @@
|
||||
}
|
||||
|
||||
.cm-cursor {
|
||||
border-left-color: #ffd866;
|
||||
/* Keep the insertion point visible without relying on a thin vertical bar. */
|
||||
width: 0.72em;
|
||||
border-left: 0;
|
||||
border-bottom: 2px solid #ffd866;
|
||||
margin-bottom: -2px;
|
||||
}
|
||||
|
||||
/* Vim mode draws a separate fat cursor layer; keep the same underline cue. */
|
||||
.cm-vimCursorLayer .cm-fat-cursor {
|
||||
background: transparent !important;
|
||||
border: 0 !important;
|
||||
border-bottom: 2px solid #ffd866 !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.cm-selectionBackground,
|
||||
@@ -252,13 +264,26 @@ body.mode-editor {
|
||||
body.mode-editor .topbar {
|
||||
height: 48px;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0.75rem;
|
||||
padding: 0.4rem 0.65rem;
|
||||
}
|
||||
|
||||
body.mode-editor .topbar .brand {
|
||||
flex: 0 0 auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
body.mode-editor .topbar .brand a {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
body.mode-editor .container {
|
||||
height: calc(100vh - 48px);
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 1rem;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body.mode-editor .card {
|
||||
@@ -267,6 +292,9 @@ body.mode-editor .card {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
body.mode-editor .editor-grid {
|
||||
@@ -275,7 +303,7 @@ body.mode-editor .editor-grid {
|
||||
height: auto;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
gap: 1rem;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
body.mode-editor .editor-pane {
|
||||
@@ -302,6 +330,21 @@ body.mode-editor #preview {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
box-sizing: border-box;
|
||||
border-width: 0 0 0 1px;
|
||||
}
|
||||
|
||||
body.mode-editor .editor-grid.preview-hidden {
|
||||
grid-template-columns: 1fr !important;
|
||||
}
|
||||
|
||||
body.mode-editor .editor-grid.preview-hidden .editor-pane {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body.mode-editor .editor-grid.preview-hidden #preview {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* cursor visibility */
|
||||
@@ -415,19 +458,22 @@ body.mode-editor .cm-tooltip-autocomplete ul::-webkit-scrollbar-thumb:hover {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.6rem;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.editor-head-left {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.editor-head-path {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
color: #aab5ce;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.editor-head-right {
|
||||
@@ -437,8 +483,8 @@ body.mode-editor .cm-tooltip-autocomplete ul::-webkit-scrollbar-thumb:hover {
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
.editor-format-button,
|
||||
.editor-menu-button {
|
||||
.editor-head button,
|
||||
.editor-head a {
|
||||
height: 2rem;
|
||||
min-width: 2rem;
|
||||
padding: 0 0.65rem;
|
||||
@@ -447,89 +493,83 @@ body.mode-editor .cm-tooltip-autocomplete ul::-webkit-scrollbar-thumb:hover {
|
||||
color: #d7dde8;
|
||||
border-radius: 0.25rem;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
font: inherit;
|
||||
text-decoration: none;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.editor-menu-button {
|
||||
font-size: 1.25rem;
|
||||
line-height: 1;
|
||||
.editor-head .danger {
|
||||
color: #ff8ca8;
|
||||
}
|
||||
|
||||
.editor-format-button:hover,
|
||||
.editor-menu-button:hover {
|
||||
.editor-head .editor-action-icon {
|
||||
width: 2rem;
|
||||
padding: 0.35rem;
|
||||
}
|
||||
|
||||
.editor-action-icon svg {
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.8;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.editor-head button:hover,
|
||||
.editor-head a:hover,
|
||||
.editor-preview-toggle[aria-pressed="true"] {
|
||||
background: #1b2640;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.editor-menu {
|
||||
position: absolute;
|
||||
top: 2.35rem;
|
||||
right: 0;
|
||||
display: none;
|
||||
min-width: 12rem;
|
||||
background: #101624;
|
||||
border: 1px solid #44506a;
|
||||
border-radius: 0.3rem;
|
||||
box-shadow: 0 0.5rem 1.4rem rgba(0,0,0,0.55);
|
||||
z-index: 2500;
|
||||
overflow: hidden;
|
||||
.editor-preview-toggle {
|
||||
width: 2rem;
|
||||
min-width: 2rem !important;
|
||||
padding: 0.35rem !important;
|
||||
}
|
||||
|
||||
.editor-menu.open {
|
||||
display: block;
|
||||
.editor-preview-toggle svg {
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.8;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.editor-menu button,
|
||||
.editor-menu a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 0.55rem 0.75rem;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.06);
|
||||
color: #d7dde8;
|
||||
text-align: left;
|
||||
text-decoration: none;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
.editor-preview-toggle .preview-pane-fill {
|
||||
fill: currentColor;
|
||||
stroke: none;
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.editor-menu button:hover,
|
||||
.editor-menu a:hover {
|
||||
background: #26324a;
|
||||
color: #ffffff;
|
||||
.editor-head .editor-format-icon {
|
||||
width: 2rem;
|
||||
padding: 0.35rem;
|
||||
}
|
||||
|
||||
.editor-menu .danger {
|
||||
color: #ff8ca8;
|
||||
.editor-format-icon svg {
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.8;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.editor-format-dialog {
|
||||
border: 1px solid #44506a;
|
||||
border-radius: 0.35rem;
|
||||
background: #101624;
|
||||
color: #d7dde8;
|
||||
padding: 1rem;
|
||||
min-width: 20rem;
|
||||
}
|
||||
|
||||
.editor-format-dialog::backdrop {
|
||||
background: rgba(0,0,0,0.55);
|
||||
}
|
||||
|
||||
.editor-format-dialog h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.editor-format-choice {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.editor-format-choice button {
|
||||
text-align: left;
|
||||
padding: 0.65rem 0.75rem;
|
||||
.editor-head .editor-format-icon.active {
|
||||
border-color: #ffd86f;
|
||||
color: #ffd86f;
|
||||
background: #1b2640;
|
||||
}
|
||||
|
||||
/* CodeMirror syntax colors: dark theme tuning */
|
||||
|
||||
Reference in new issue
Block a user