world-clock-strip 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/dist/index.js +145 -130
- package/dist/index.js.map +1 -1
- package/dist/world-clock.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const x = ':host{--world-clock-radius: 18px;display:block;width:100%;color-scheme:dark;font-family:IBM Plex Sans,Avenir Next,Segoe UI,sans-serif;overflow:visible}*,*:before,*:after{box-sizing:border-box}.clock-strip{position:relative;width:100%;min-height:114px;padding-bottom:8px}.clock-strip--config-open{padding-bottom:344px}.clock-strip--preset-minimal .clock-strip__band{box-shadow:0 10px 22px #0000002e}.clock-strip--preset-cinematic .clock-strip__band{box-shadow:0 18px 42px #0000005c}.clock-strip--preset-wallboard .clock-strip__band{min-height:124px;border-radius:22px}.clock-strip__band{position:relative;min-height:114px;width:100%;overflow:hidden;border-radius:var(--world-clock-radius);border:none;background:#0b1522;box-shadow:0 14px 34px #00000047}.clock-strip__hover-zone{position:absolute;left:0;right:0;bottom:0;height:14px;display:grid;place-items:end center;z-index:3}.clock-strip__config-trigger{appearance:none;border:0;border-radius:999px;padding:7px 16px 8px;background:linear-gradient(180deg,#0b1522eb,#080f19fa);color:#dbe7f5e0;font:inherit;font-size:.78rem;font-weight:600;letter-spacing:.04em;box-shadow:0 8px 18px #00000047,inset 0 0 0 1px #8eaed02e;cursor:pointer;opacity:0;transform:translateY(10px);transition:opacity .15s ease,transform .15s ease,color .15s ease,box-shadow .15s ease}.clock-strip__hover-zone:hover .clock-strip__config-trigger,.clock-strip:focus-within .clock-strip__config-trigger,.clock-strip--config-open .clock-strip__config-trigger{opacity:1;transform:translateY(0)}.clock-strip__config-trigger:hover,.clock-strip__config-trigger:focus-visible{color:#f5f9fff5;box-shadow:0 12px 24px #00000057,inset 0 0 0 1px #aac8ea47;outline:none}.clock-config-drawer{position:absolute;left:0;right:0;bottom:0;z-index:2;opacity:0;transform:translateY(14px);pointer-events:none;transition:opacity .18s ease,transform .18s ease}.clock-config-drawer--open{opacity:1;transform:translateY(0);pointer-events:auto}.clock-config-drawer__form{display:grid;gap:12px;padding:12px 14px 16px;border-radius:20px;background:linear-gradient(180deg,#4a4f57b3,#363b42c2);box-shadow:0 18px 36px #0003,inset 0 0 0 1px #e0e5ec29;backdrop-filter:blur(16px) saturate(.82);-webkit-backdrop-filter:blur(16px) saturate(.82)}.clock-config-drawer__section-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.clock-config-drawer__section-copy{margin-top:0;font-size:.78rem;color:#ecf0f5c7}.clock-config-drawer__head-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}.clock-config-drawer__list-title{font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#eff3f7ad}.clock-config-drawer__section-copy code{font-family:IBM Plex Mono,SFMono-Regular,monospace;color:#f8fafcf5}.clock-config-status{font-size:.78rem;color:#f6f8faeb}.clock-config-drawer__ghost,.clock-config-drawer__primary,.clock-config-location__remove{appearance:none;border-radius:999px;padding:8px 14px;font:inherit;font-size:.8rem;font-weight:600;cursor:pointer;transition:background-color .15s ease,color .15s ease,box-shadow .15s ease,border-color .15s ease}.clock-config-drawer__ghost,.clock-config-location__remove{border:1px solid rgba(233,237,242,.18);background:#585d6694;color:#f7f9fbe6}.clock-config-drawer__primary{border:1px solid rgba(244,247,250,.2);background:linear-gradient(180deg,#7c818af5,#5a5f68fa);color:#f8fbfffa}.clock-config-drawer__ghost:hover,.clock-config-drawer__ghost:focus-visible,.clock-config-location__remove:hover,.clock-config-location__remove:focus-visible,.clock-config-drawer__primary:hover,.clock-config-drawer__primary:focus-visible{outline:none;box-shadow:0 10px 20px #0000002e}.clock-config-add-panel,.clock-config-drawer__list,.clock-config-advanced__custom{display:grid;gap:10px;padding:10px 12px;border-radius:14px;background:#ebeff31f;box-shadow:inset 0 0 0 1px #ffffff1f}.clock-config-search-results{display:grid;gap:8px;grid-template-columns:repeat(4,minmax(0,1fr))}.clock-config-search-result{appearance:none;display:grid;gap:2px;width:100%;text-align:left;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:#f8fafc1f;color:#fafbfcf5;padding:10px 12px;cursor:pointer}.clock-config-search-result span:last-child{font-size:.76rem;color:#eaeff4b8}.clock-config-search-result--selected,.clock-config-search-result:hover,.clock-config-search-result:focus-visible{outline:none;border-color:#ffffff38;background:#ffffff2e}.clock-config-search-empty,.clock-config-add-confirm__city{font-size:.82rem;color:#f3f6f9d1}.clock-config-add-confirm{display:grid;gap:10px}.clock-config-add-confirm__actions,.clock-config-location-list__actions{display:flex;gap:8px;flex-wrap:wrap}.clock-config-preset-save,.clock-config-preset{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center}.clock-config-presets{display:grid;gap:8px}.clock-config-field{display:grid;gap:7px}.clock-config-field--wide{min-width:0}.clock-config-field--time-zone{grid-column:1 / span 2}.clock-config-field__label{font-size:.74rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#95b3d4ad}.clock-config-field input,.clock-config-field select,.clock-config-textarea,.clock-config-preset-save input{width:100%;min-width:0;border:1px solid rgba(120,152,188,.18);border-radius:12px;background:#0d17228f;color:#f1f7fdf2;font:inherit;padding:10px 12px;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.clock-config-field input::placeholder,.clock-config-textarea::placeholder,.clock-config-preset-save input::placeholder{color:#a5b6cb70}.clock-config-field input:focus,.clock-config-field select:focus,.clock-config-textarea:focus,.clock-config-preset-save input:focus{outline:none;border-color:#8bb5df80;box-shadow:0 0 0 3px #4a7fbb2e}.clock-config-textarea{min-height:120px;resize:vertical}.clock-config-field--toggle{align-content:start}.clock-config-field__toggle-row{display:flex;align-items:center;gap:10px;min-height:42px;padding:0 2px;color:#e4edf7e6}.clock-config-field__toggle-row input{width:16px;height:16px}.clock-config-drawer__locations{display:grid;gap:12px;max-height:200px;overflow:auto;padding-right:2px}.clock-config-location,.clock-config-location-list__item{display:grid;grid-template-columns:minmax(140px,.9fr) minmax(180px,1.1fr) auto;gap:12px;align-items:end;padding:10px 12px;border-radius:14px;background:#0c151f5c;box-shadow:inset 0 0 0 1px #5e79981f;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.clock-config-location__remove{align-self:stretch;min-width:74px}.clock-config-location-list{list-style:none;margin:0;padding:0;display:grid;gap:8px}.clock-config-location-list__item{grid-template-columns:auto auto auto;align-items:center;padding:9px 12px;justify-content:space-between;width:20%;min-width:240px;max-width:320px}.clock-config-location-list__item--confirm{align-items:start;width:20%;min-width:240px;max-width:320px}.clock-config-location-list__item--selected{grid-template-columns:auto minmax(0,1fr) auto;align-items:start}.clock-config-location-list__bullet{font-size:1rem;font-weight:700;color:#d0dcebe0}.clock-config-location-list__body{min-width:0;max-width:none}.clock-config-location-list__body--button{appearance:none;border:0;background:transparent;color:inherit;text-align:left;padding:0;cursor:pointer}.clock-config-location-list__body--edit{display:grid;gap:8px}.clock-config-location-list__title,.clock-config-location-list__confirm{font-size:.9rem;font-weight:600;color:#f1f7fcf2}.clock-config-location-list__meta{margin-top:2px;font-size:.76rem;color:#b3c2d3c7;word-break:break-word}@media(max-width:1200px){.clock-config-search-results{grid-template-columns:repeat(3,minmax(0,1fr))}}.clock-config-advanced{display:none}.clock-config-advanced--open{display:block}.clock-config-advanced__grid{display:grid;grid-template-columns:150px minmax(240px,1fr);gap:12px;padding:10px 12px;border-radius:14px;background:#0a121c47;box-shadow:inset 0 0 0 1px #6683a51a}@media(max-width:900px){.clock-strip--config-open{padding-bottom:520px}.clock-config-drawer__section-head{flex-direction:column;align-items:stretch}.clock-config-search-results{grid-template-columns:repeat(2,minmax(0,1fr))}.clock-config-advanced__grid,.clock-config-location{grid-template-columns:1fr}.clock-config-field--time-zone{grid-column:auto}.clock-config-location__remove{justify-self:start}.clock-config-location-list__item,.clock-config-location-list__item--confirm{width:100%;min-width:0;max-width:none}}@media(max-width:560px){.clock-config-search-results{grid-template-columns:1fr}}.clock-strip__band:before{content:"";position:absolute;inset:0;background:var(--clock-strip-background)}.clock-strip__band:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(255,255,255,.08) 0%,rgba(255,255,255,.022) 10%,transparent 24%),linear-gradient(180deg,transparent 0%,rgba(2,6,14,.02) 58%,rgba(2,6,14,.12) 100%);pointer-events:none}.clock-strip__markers{position:absolute;inset:0}.clock-marker{position:absolute;z-index:1;display:grid;gap:4px;top:50%;min-width:156px;justify-items:center;text-align:center;transform:translate(-50%,-50%);overflow:visible;isolation:isolate;padding:0}.clock-marker--edge-left{justify-items:start;text-align:left;transform:translateY(-50%)}.clock-marker--edge-right{justify-items:end;text-align:right;transform:translateY(-50%)}.clock-marker__text{position:relative;z-index:1;min-width:0;max-width:100%;font-size:clamp(1.12rem,1.14vw,1.6rem);line-height:1.02;font-weight:700;letter-spacing:.02em;color:#fcfdfffa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:none}.clock-marker__text--time{font-size:clamp(1.12rem,1.14vw,1.6rem);font-weight:700;font-variant-numeric:tabular-nums}.clock-marker__meta{position:relative;z-index:1;display:block;max-width:100%;margin-top:1px;font-size:.9rem;font-weight:700;letter-spacing:.03em;color:#eef6ffd6;text-shadow:none;white-space:nowrap}.clock-marker__temp{position:relative;z-index:1;display:block;max-width:100%;margin-top:-1px;font-size:.84rem;font-weight:800;letter-spacing:.08em;color:#fff5e0e6;text-shadow:none;white-space:nowrap}.clock-weather{position:absolute;z-index:0;left:50%;top:6px;width:164px;height:90px;overflow:visible;transform:translate(-50%);pointer-events:none;opacity:.92;background-image:var(--clock-weather-image);background-repeat:no-repeat;background-position:center center;background-size:contain;filter:saturate(1.03) contrast(1.02) brightness(1.01);mix-blend-mode:normal;-webkit-mask-image:radial-gradient(ellipse at center,rgba(0,0,0,1) 0%,rgba(0,0,0,.98) 58%,rgba(0,0,0,.78) 80%,transparent 100%);mask-image:radial-gradient(ellipse at center,rgba(0,0,0,1) 0%,rgba(0,0,0,.98) 58%,rgba(0,0,0,.78) 80%,transparent 100%)}.clock-marker--edge-left .clock-weather,.clock-marker--edge-right .clock-weather{left:50%;-webkit-mask-image:radial-gradient(ellipse at center,rgba(0,0,0,1) 0%,rgba(0,0,0,.98) 58%,rgba(0,0,0,.82) 82%,transparent 100%);mask-image:radial-gradient(ellipse at center,rgba(0,0,0,1) 0%,rgba(0,0,0,.98) 58%,rgba(0,0,0,.82) 82%,transparent 100%)}.clock-weather:after{content:none}.clock-weather--image{box-shadow:none}.clock-weather--clear-day,.clock-weather--clear-night{top:0;width:126px;height:126px;background-size:contain;opacity:.9}.clock-weather--clear-day{background-position:center center}.clock-weather--clear-night{top:-42px;width:430px;height:156px;background-size:cover;background-position:center 26%;opacity:.8;-webkit-mask-image:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.42) 10%,rgba(0,0,0,.9) 22%,rgba(0,0,0,.98) 36%,rgba(0,0,0,.9) 66%,rgba(0,0,0,.48) 84%,transparent 100%),radial-gradient(ellipse at center,rgba(0,0,0,.98) 0%,rgba(0,0,0,.92) 50%,rgba(0,0,0,.58) 72%,transparent 100%);mask-image:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.42) 10%,rgba(0,0,0,.9) 22%,rgba(0,0,0,.98) 36%,rgba(0,0,0,.9) 66%,rgba(0,0,0,.48) 84%,transparent 100%),radial-gradient(ellipse at center,rgba(0,0,0,.98) 0%,rgba(0,0,0,.92) 50%,rgba(0,0,0,.58) 72%,transparent 100%);-webkit-mask-composite:source-in;mask-composite:intersect}.clock-weather--partly-cloudy{top:52px;width:104px;height:58px;background-size:contain;background-position:center center}.clock-weather--cloudy{top:22px;width:170px;height:92px;background-size:contain;background-position:center center}.clock-weather--rain,.clock-weather--storm,.clock-weather--snow,.clock-weather--fog{width:160px;height:86px;background-size:contain;background-position:center center}.clock-weather--storm{width:255px;height:146px;top:-30px;opacity:.96}.clock-weather--fog{width:196px;height:98px;background-size:contain;background-position:center center}.clock-weather__sun,.clock-weather__stars,.clock-weather__rain,.clock-weather__snow,.clock-weather__mist,.clock-weather__cloud{position:absolute}.clock-weather__stars{inset:0;background:radial-gradient(circle at 20% 26%,rgba(255,255,255,1) 0 1.2px,transparent 1.8px),radial-gradient(circle at 62% 18%,rgba(255,255,255,.92) 0 1.2px,transparent 1.8px),radial-gradient(circle at 78% 34%,rgba(255,255,255,.8) 0 1.1px,transparent 1.7px),radial-gradient(circle at 36% 42%,rgba(255,255,255,.86) 0 1.2px,transparent 1.8px),radial-gradient(circle at 53% 58%,rgba(255,255,255,.78) 0 1.1px,transparent 1.7px);opacity:1}.clock-weather__cloud{border-radius:999px;background:radial-gradient(circle at 32% 36%,rgba(255,255,255,.95) 0%,rgba(244,249,255,.78) 30%,rgba(222,235,250,.42) 58%,rgba(222,235,250,.08) 78%,transparent 100%);filter:blur(4px);animation:clock-cloud-drift 18s linear infinite;box-shadow:0 0 22px #c9dff72e,inset 0 1px #ffffff38;mix-blend-mode:normal}.clock-weather__cloud--a{left:0;top:12px;width:108px;height:36px}.clock-weather__cloud--b{right:28px;top:4px;width:92px;height:30px;animation-duration:22s}.clock-weather__cloud--c{left:68px;bottom:10px;width:122px;height:34px;animation-duration:26s}.clock-weather__sun{right:24px;top:2px;width:46px;height:46px;border-radius:999px;background:radial-gradient(circle,rgba(255,247,192,1) 0%,rgba(255,218,104,.92) 36%,rgba(255,196,75,.44) 62%,rgba(255,196,75,.08) 82%,transparent 100%);box-shadow:0 0 22px #ffd05c57,0 0 38px #ffd05c2e;filter:none;mix-blend-mode:normal}.clock-weather__rain{inset:10px 0 0;background:linear-gradient(105deg,transparent 0 38%,rgba(183,219,255,.9) 39% 40.6%,transparent 41.2% 100%) 0 0 / 50px 100% repeat-x,linear-gradient(105deg,transparent 0 54%,rgba(183,219,255,.82) 55% 56.4%,transparent 57% 100%) 18px 0 / 66px 100% repeat-x;opacity:1;transform:translateY(-2px);filter:none;text-shadow:0 0 10px rgba(183,219,255,.25);animation:clock-rain-fall .9s linear infinite;mix-blend-mode:normal}.clock-weather__snow{inset:0;background:radial-gradient(circle at 15% 24%,rgba(255,255,255,1) 0 2px,transparent 2.3px),radial-gradient(circle at 34% 16%,rgba(255,255,255,.94) 0 1.7px,transparent 2px),radial-gradient(circle at 58% 22%,rgba(255,255,255,1) 0 2px,transparent 2.3px),radial-gradient(circle at 76% 28%,rgba(255,255,255,.92) 0 1.7px,transparent 2px),radial-gradient(circle at 26% 56%,rgba(255,255,255,.92) 0 1.7px,transparent 2px),radial-gradient(circle at 66% 58%,rgba(255,255,255,1) 0 2px,transparent 2.3px);animation:clock-snow-fall 4.8s linear infinite;mix-blend-mode:normal}.clock-weather__mist{left:0;right:0;height:16px;border-radius:999px;background:linear-gradient(90deg,transparent 0%,rgba(237,244,255,.54) 18%,rgba(237,244,255,.82) 50%,rgba(237,244,255,.54) 82%,transparent 100%);filter:blur(8px);animation:clock-mist-shift 8s ease-in-out infinite alternate;mix-blend-mode:normal}.clock-weather__mist--a{top:18px}.clock-weather__mist--b{top:40px;animation-duration:10s}.clock-weather--storm .clock-weather__cloud{background:radial-gradient(circle at 35% 35%,rgba(223,230,240,.82) 0%,rgba(187,201,221,.62) 42%,rgba(176,191,212,.16) 72%,transparent 100%)}@keyframes clock-cloud-drift{0%{transform:translate(-4px)}50%{transform:translate(4px)}to{transform:translate(-4px)}}@keyframes clock-rain-fall{0%{transform:translateY(-6px)}to{transform:translateY(10px)}}@keyframes clock-snow-fall{0%{transform:translateY(-8px)}to{transform:translateY(12px)}}@keyframes clock-mist-shift{0%{transform:translate(-6px)}to{transform:translate(6px)}}@media(max-width:720px){.clock-strip,.clock-strip__band{min-height:0}.clock-strip__markers{position:relative;display:grid;gap:12px;padding:14px;grid-template-columns:repeat(auto-fit,minmax(144px,1fr))}.clock-marker{position:relative;top:auto;left:auto!important;right:auto!important;transform:none;min-height:84px;min-width:0;padding:16px 12px;border-radius:16px;border:1px solid rgba(197,219,246,.1);background:#060c162e;backdrop-filter:blur(4px)}.clock-marker--edge-left,.clock-marker--edge-right{justify-items:center;text-align:center;transform:none}.clock-weather{width:auto;height:auto;inset:0;transform:none}.clock-marker__text,.clock-marker__meta,.clock-marker__temp{white-space:normal}}';
|
|
2
|
-
const I = "world-clock-strip",
|
|
1
|
+
const _ = ':host{--world-clock-radius: 18px;display:block;width:100%;color-scheme:dark;font-family:IBM Plex Sans,Avenir Next,Segoe UI,sans-serif;overflow:visible}*,*:before,*:after{box-sizing:border-box}.clock-strip{position:relative;width:100%;min-height:114px;padding-bottom:8px}.clock-strip--config-open{padding-bottom:344px}.clock-strip--preset-minimal .clock-strip__band{box-shadow:0 10px 22px #0000002e}.clock-strip--preset-cinematic .clock-strip__band{box-shadow:0 18px 42px #0000005c}.clock-strip--preset-wallboard .clock-strip__band{min-height:124px;border-radius:22px}.clock-strip__band{position:relative;min-height:114px;width:100%;overflow:hidden;border-radius:var(--world-clock-radius);border:none;background:#0b1522;box-shadow:0 14px 34px #00000047}.clock-strip__hover-zone{position:absolute;left:0;right:0;bottom:0;height:14px;display:grid;place-items:end center;z-index:3}.clock-strip__config-trigger{appearance:none;border:0;border-radius:999px;padding:7px 16px 8px;background:linear-gradient(180deg,#0b1522eb,#080f19fa);color:#dbe7f5e0;font:inherit;font-size:.78rem;font-weight:600;letter-spacing:.04em;box-shadow:0 8px 18px #00000047,inset 0 0 0 1px #8eaed02e;cursor:pointer;opacity:0;transform:translateY(10px);transition:opacity .15s ease,transform .15s ease,color .15s ease,box-shadow .15s ease}.clock-strip__hover-zone:hover .clock-strip__config-trigger,.clock-strip:focus-within .clock-strip__config-trigger,.clock-strip--config-open .clock-strip__config-trigger{opacity:1;transform:translateY(0)}.clock-strip__config-trigger:hover,.clock-strip__config-trigger:focus-visible{color:#f5f9fff5;box-shadow:0 12px 24px #00000057,inset 0 0 0 1px #aac8ea47;outline:none}.clock-config-drawer{position:absolute;left:0;right:0;bottom:0;z-index:2;opacity:0;transform:translateY(14px);pointer-events:none;transition:opacity .18s ease,transform .18s ease}.clock-config-drawer--open{opacity:1;transform:translateY(0);pointer-events:auto}.clock-config-drawer__form{display:grid;gap:12px;padding:12px 14px 16px;border-radius:20px;background:linear-gradient(180deg,#4a4f57b3,#363b42c2);box-shadow:0 18px 36px #0003,inset 0 0 0 1px #e0e5ec29;backdrop-filter:blur(16px) saturate(.82);-webkit-backdrop-filter:blur(16px) saturate(.82)}.clock-config-drawer__section-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.clock-config-drawer__section-copy{margin-top:0;font-size:.78rem;color:#ecf0f5c7}.clock-config-drawer__head-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}.clock-config-drawer__list-title{font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#eff3f7ad}.clock-config-drawer__section-copy code{font-family:IBM Plex Mono,SFMono-Regular,monospace;color:#f8fafcf5}.clock-config-status{font-size:.78rem;color:#f6f8faeb}.clock-config-drawer__ghost,.clock-config-drawer__primary,.clock-config-location__remove{appearance:none;border-radius:999px;padding:8px 14px;font:inherit;font-size:.8rem;font-weight:600;cursor:pointer;transition:background-color .15s ease,color .15s ease,box-shadow .15s ease,border-color .15s ease}.clock-config-drawer__ghost,.clock-config-location__remove{border:1px solid rgba(233,237,242,.18);background:#585d6694;color:#f7f9fbe6}.clock-config-drawer__primary{border:1px solid rgba(244,247,250,.2);background:linear-gradient(180deg,#7c818af5,#5a5f68fa);color:#f8fbfffa}.clock-config-drawer__ghost:hover,.clock-config-drawer__ghost:focus-visible,.clock-config-location__remove:hover,.clock-config-location__remove:focus-visible,.clock-config-drawer__primary:hover,.clock-config-drawer__primary:focus-visible{outline:none;box-shadow:0 10px 20px #0000002e}.clock-config-add-panel,.clock-config-drawer__list,.clock-config-advanced__custom{display:grid;gap:10px;padding:10px 12px;border-radius:14px;background:#ebeff31f;box-shadow:inset 0 0 0 1px #ffffff1f}.clock-config-search-results{display:grid;gap:8px;grid-template-columns:repeat(4,minmax(0,1fr))}.clock-config-search-result{appearance:none;display:grid;gap:2px;width:100%;text-align:left;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:#f8fafc1f;color:#fafbfcf5;padding:10px 12px;cursor:pointer}.clock-config-search-result span:last-child{font-size:.76rem;color:#eaeff4b8}.clock-config-search-result--selected,.clock-config-search-result:hover,.clock-config-search-result:focus-visible{outline:none;border-color:#ffffff38;background:#ffffff2e}.clock-config-search-empty,.clock-config-add-confirm__city{font-size:.82rem;color:#f3f6f9d1}.clock-config-add-confirm{display:grid;gap:10px}.clock-config-add-confirm__actions,.clock-config-location-list__actions{display:flex;gap:8px;flex-wrap:wrap}.clock-config-preset-save,.clock-config-preset{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center}.clock-config-presets{display:grid;gap:8px}.clock-config-field{display:grid;gap:7px}.clock-config-field--wide{min-width:0}.clock-config-field--time-zone{grid-column:1 / span 2}.clock-config-field__label{font-size:.74rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#95b3d4ad}.clock-config-field input,.clock-config-field select,.clock-config-textarea,.clock-config-preset-save input{width:100%;min-width:0;border:1px solid rgba(120,152,188,.18);border-radius:12px;background:#0d17228f;color:#f1f7fdf2;font:inherit;padding:10px 12px;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.clock-config-field input::placeholder,.clock-config-textarea::placeholder,.clock-config-preset-save input::placeholder{color:#a5b6cb70}.clock-config-field input:focus,.clock-config-field select:focus,.clock-config-textarea:focus,.clock-config-preset-save input:focus{outline:none;border-color:#8bb5df80;box-shadow:0 0 0 3px #4a7fbb2e}.clock-config-textarea{min-height:120px;resize:vertical}.clock-config-field--toggle{align-content:start}.clock-config-field__toggle-row{display:flex;align-items:center;gap:10px;min-height:42px;padding:0 2px;color:#e4edf7e6}.clock-config-field__toggle-row input{width:16px;height:16px}.clock-config-drawer__locations{display:grid;gap:12px;max-height:200px;overflow:auto;padding-right:2px}.clock-config-location,.clock-config-location-list__item{display:grid;grid-template-columns:minmax(140px,.9fr) minmax(180px,1.1fr) auto;gap:12px;align-items:end;padding:10px 12px;border-radius:14px;background:#0c151f5c;box-shadow:inset 0 0 0 1px #5e79981f;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.clock-config-location__remove{align-self:stretch;min-width:74px}.clock-config-location-list{list-style:none;margin:0;padding:0;display:grid;gap:8px}.clock-config-location-list__item{grid-template-columns:auto auto auto;align-items:center;padding:9px 12px;justify-content:space-between;width:20%;min-width:240px;max-width:320px}.clock-config-location-list__item--confirm{align-items:start;width:20%;min-width:240px;max-width:320px}.clock-config-location-list__item--selected{grid-template-columns:auto minmax(0,1fr) auto;align-items:start}.clock-config-location-list__bullet{font-size:1rem;font-weight:700;color:#d0dcebe0}.clock-config-location-list__body{min-width:0;max-width:none}.clock-config-location-list__body--button{appearance:none;border:0;background:transparent;color:inherit;text-align:left;padding:0;cursor:pointer}.clock-config-location-list__body--edit{display:grid;gap:8px}.clock-config-location-list__title,.clock-config-location-list__confirm{font-size:.9rem;font-weight:600;color:#f1f7fcf2}.clock-config-location-list__meta{margin-top:2px;font-size:.76rem;color:#b3c2d3c7;word-break:break-word}@media(max-width:1200px){.clock-config-search-results{grid-template-columns:repeat(3,minmax(0,1fr))}}.clock-config-advanced{display:none}.clock-config-advanced--open{display:block}.clock-config-advanced__grid{display:grid;grid-template-columns:150px minmax(240px,1fr);gap:12px;padding:10px 12px;border-radius:14px;background:#0a121c47;box-shadow:inset 0 0 0 1px #6683a51a}@media(max-width:900px){.clock-strip--config-open{padding-bottom:520px}.clock-config-drawer__section-head{flex-direction:column;align-items:stretch}.clock-config-search-results{grid-template-columns:repeat(2,minmax(0,1fr))}.clock-config-advanced__grid,.clock-config-location{grid-template-columns:1fr}.clock-config-field--time-zone{grid-column:auto}.clock-config-location__remove{justify-self:start}.clock-config-location-list__item,.clock-config-location-list__item--confirm{width:100%;min-width:0;max-width:none}}@media(max-width:560px){.clock-config-search-results{grid-template-columns:1fr}}.clock-strip__band:before{content:"";position:absolute;inset:0;background:var(--clock-strip-background)}.clock-strip__band:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(255,255,255,.08) 0%,rgba(255,255,255,.022) 10%,transparent 24%),linear-gradient(180deg,transparent 0%,rgba(2,6,14,.02) 58%,rgba(2,6,14,.12) 100%);pointer-events:none}.clock-strip__markers{position:absolute;inset:0}.clock-marker{position:absolute;z-index:1;display:grid;gap:4px;top:50%;min-width:156px;justify-items:center;text-align:center;transform:translate(-50%,-50%);overflow:visible;isolation:isolate;padding:0}.clock-marker--edge-left{justify-items:start;text-align:left;transform:translateY(-50%)}.clock-marker--edge-right{justify-items:end;text-align:right;transform:translateY(-50%)}.clock-marker__text{position:relative;z-index:1;min-width:0;max-width:100%;font-size:clamp(1.12rem,1.14vw,1.6rem);line-height:1.02;font-weight:700;letter-spacing:.02em;color:#fcfdfffa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:none}.clock-marker__text--time{font-size:clamp(1.12rem,1.14vw,1.6rem);font-weight:700;font-variant-numeric:tabular-nums}.clock-marker__meta{position:relative;z-index:1;display:block;max-width:100%;margin-top:1px;font-size:.9rem;font-weight:700;letter-spacing:.03em;color:#eef6ffd6;text-shadow:none;white-space:nowrap}.clock-marker__temp{position:relative;z-index:1;display:block;max-width:100%;margin-top:-1px;font-size:.84rem;font-weight:800;letter-spacing:.08em;color:#fff5e0e6;text-shadow:none;white-space:nowrap}.clock-weather{position:absolute;z-index:0;left:50%;top:6px;width:164px;height:90px;overflow:visible;transform:translate(-50%);pointer-events:none;opacity:.92;background-image:var(--clock-weather-image);background-repeat:no-repeat;background-position:center center;background-size:contain;filter:saturate(1.03) contrast(1.02) brightness(1.01);mix-blend-mode:normal;-webkit-mask-image:radial-gradient(ellipse at center,rgba(0,0,0,1) 0%,rgba(0,0,0,.98) 58%,rgba(0,0,0,.78) 80%,transparent 100%);mask-image:radial-gradient(ellipse at center,rgba(0,0,0,1) 0%,rgba(0,0,0,.98) 58%,rgba(0,0,0,.78) 80%,transparent 100%)}.clock-marker--edge-left .clock-weather,.clock-marker--edge-right .clock-weather{left:50%;-webkit-mask-image:radial-gradient(ellipse at center,rgba(0,0,0,1) 0%,rgba(0,0,0,.98) 58%,rgba(0,0,0,.82) 82%,transparent 100%);mask-image:radial-gradient(ellipse at center,rgba(0,0,0,1) 0%,rgba(0,0,0,.98) 58%,rgba(0,0,0,.82) 82%,transparent 100%)}.clock-weather:after{content:none}.clock-weather--image{box-shadow:none}.clock-weather--clear-day,.clock-weather--clear-night{top:0;width:126px;height:126px;background-size:contain;opacity:.9}.clock-weather--clear-day{background-position:center center}.clock-weather--clear-night{top:-42px;width:430px;height:156px;background-size:cover;background-position:center 26%;opacity:.8;-webkit-mask-image:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.42) 10%,rgba(0,0,0,.9) 22%,rgba(0,0,0,.98) 36%,rgba(0,0,0,.9) 66%,rgba(0,0,0,.48) 84%,transparent 100%),radial-gradient(ellipse at center,rgba(0,0,0,.98) 0%,rgba(0,0,0,.92) 50%,rgba(0,0,0,.58) 72%,transparent 100%);mask-image:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.42) 10%,rgba(0,0,0,.9) 22%,rgba(0,0,0,.98) 36%,rgba(0,0,0,.9) 66%,rgba(0,0,0,.48) 84%,transparent 100%),radial-gradient(ellipse at center,rgba(0,0,0,.98) 0%,rgba(0,0,0,.92) 50%,rgba(0,0,0,.58) 72%,transparent 100%);-webkit-mask-composite:source-in;mask-composite:intersect}.clock-weather--partly-cloudy{top:52px;width:104px;height:58px;background-size:contain;background-position:center center}.clock-weather--cloudy{top:22px;width:170px;height:92px;background-size:contain;background-position:center center}.clock-weather--rain,.clock-weather--storm,.clock-weather--snow,.clock-weather--fog{width:160px;height:86px;background-size:contain;background-position:center center}.clock-weather--storm{width:255px;height:146px;top:-30px;opacity:.96}.clock-weather--fog{width:196px;height:98px;background-size:contain;background-position:center center}.clock-weather__sun,.clock-weather__stars,.clock-weather__rain,.clock-weather__snow,.clock-weather__mist,.clock-weather__cloud{position:absolute}.clock-weather__stars{inset:0;background:radial-gradient(circle at 20% 26%,rgba(255,255,255,1) 0 1.2px,transparent 1.8px),radial-gradient(circle at 62% 18%,rgba(255,255,255,.92) 0 1.2px,transparent 1.8px),radial-gradient(circle at 78% 34%,rgba(255,255,255,.8) 0 1.1px,transparent 1.7px),radial-gradient(circle at 36% 42%,rgba(255,255,255,.86) 0 1.2px,transparent 1.8px),radial-gradient(circle at 53% 58%,rgba(255,255,255,.78) 0 1.1px,transparent 1.7px);opacity:1}.clock-weather__cloud{border-radius:999px;background:radial-gradient(circle at 32% 36%,rgba(255,255,255,.95) 0%,rgba(244,249,255,.78) 30%,rgba(222,235,250,.42) 58%,rgba(222,235,250,.08) 78%,transparent 100%);filter:blur(4px);animation:clock-cloud-drift 18s linear infinite;box-shadow:0 0 22px #c9dff72e,inset 0 1px #ffffff38;mix-blend-mode:normal}.clock-weather__cloud--a{left:0;top:12px;width:108px;height:36px}.clock-weather__cloud--b{right:28px;top:4px;width:92px;height:30px;animation-duration:22s}.clock-weather__cloud--c{left:68px;bottom:10px;width:122px;height:34px;animation-duration:26s}.clock-weather__sun{right:24px;top:2px;width:46px;height:46px;border-radius:999px;background:radial-gradient(circle,rgba(255,247,192,1) 0%,rgba(255,218,104,.92) 36%,rgba(255,196,75,.44) 62%,rgba(255,196,75,.08) 82%,transparent 100%);box-shadow:0 0 22px #ffd05c57,0 0 38px #ffd05c2e;filter:none;mix-blend-mode:normal}.clock-weather__rain{inset:10px 0 0;background:linear-gradient(105deg,transparent 0 38%,rgba(183,219,255,.9) 39% 40.6%,transparent 41.2% 100%) 0 0 / 50px 100% repeat-x,linear-gradient(105deg,transparent 0 54%,rgba(183,219,255,.82) 55% 56.4%,transparent 57% 100%) 18px 0 / 66px 100% repeat-x;opacity:1;transform:translateY(-2px);filter:none;text-shadow:0 0 10px rgba(183,219,255,.25);animation:clock-rain-fall .9s linear infinite;mix-blend-mode:normal}.clock-weather__snow{inset:0;background:radial-gradient(circle at 15% 24%,rgba(255,255,255,1) 0 2px,transparent 2.3px),radial-gradient(circle at 34% 16%,rgba(255,255,255,.94) 0 1.7px,transparent 2px),radial-gradient(circle at 58% 22%,rgba(255,255,255,1) 0 2px,transparent 2.3px),radial-gradient(circle at 76% 28%,rgba(255,255,255,.92) 0 1.7px,transparent 2px),radial-gradient(circle at 26% 56%,rgba(255,255,255,.92) 0 1.7px,transparent 2px),radial-gradient(circle at 66% 58%,rgba(255,255,255,1) 0 2px,transparent 2.3px);animation:clock-snow-fall 4.8s linear infinite;mix-blend-mode:normal}.clock-weather__mist{left:0;right:0;height:16px;border-radius:999px;background:linear-gradient(90deg,transparent 0%,rgba(237,244,255,.54) 18%,rgba(237,244,255,.82) 50%,rgba(237,244,255,.54) 82%,transparent 100%);filter:blur(8px);animation:clock-mist-shift 8s ease-in-out infinite alternate;mix-blend-mode:normal}.clock-weather__mist--a{top:18px}.clock-weather__mist--b{top:40px;animation-duration:10s}.clock-weather--storm .clock-weather__cloud{background:radial-gradient(circle at 35% 35%,rgba(223,230,240,.82) 0%,rgba(187,201,221,.62) 42%,rgba(176,191,212,.16) 72%,transparent 100%)}@keyframes clock-cloud-drift{0%{transform:translate(-4px)}50%{transform:translate(4px)}to{transform:translate(-4px)}}@keyframes clock-rain-fall{0%{transform:translateY(-6px)}to{transform:translateY(10px)}}@keyframes clock-snow-fall{0%{transform:translateY(-8px)}to{transform:translateY(12px)}}@keyframes clock-mist-shift{0%{transform:translate(-6px)}to{transform:translate(6px)}}@media(max-width:720px){.clock-strip,.clock-strip__band{min-height:0}.clock-strip__markers{position:relative;display:grid;gap:12px;padding:14px;grid-template-columns:repeat(auto-fit,minmax(144px,1fr))}.clock-marker{position:relative;top:auto;left:auto!important;right:auto!important;transform:none;min-height:84px;min-width:0;padding:16px 12px;border-radius:16px;border:1px solid rgba(197,219,246,.1);background:#060c162e;backdrop-filter:blur(4px)}.clock-marker--edge-left,.clock-marker--edge-right{justify-items:center;text-align:center;transform:none}.clock-weather{width:auto;height:auto;inset:0;transform:none}.clock-marker__text,.clock-marker__meta,.clock-marker__temp{white-space:normal}}';
|
|
2
|
+
const I = "world-clock-strip", S = "world-clock-time-zone-options", h = "worldClock", v = "world-clock-strip:presets", d = "https://cdn.jsdelivr.net/npm/world-clock-strip@0.2.1/assets/weather/", C = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Set([
|
|
3
3
|
"America/Adak",
|
|
4
4
|
"America/Anchorage",
|
|
5
5
|
"America/Boise",
|
|
@@ -33,15 +33,7 @@ const I = "world-clock-strip", _ = "world-clock-time-zone-options", f = "worldCl
|
|
|
33
33
|
"Pacific/Honolulu",
|
|
34
34
|
"Pacific/Pago_Pago",
|
|
35
35
|
"Pacific/Saipan"
|
|
36
|
-
]),
|
|
37
|
-
"clear-day": d("Sunny.webp"),
|
|
38
|
-
"clear-night": d("starry-night.webp"),
|
|
39
|
-
cloudy: d("Cloudy.webp"),
|
|
40
|
-
rain: d("Rainy.webp"),
|
|
41
|
-
storm: d("storm.webp"),
|
|
42
|
-
snow: d("Snow.webp"),
|
|
43
|
-
fog: d("Foggy.webp")
|
|
44
|
-
}, w = [
|
|
36
|
+
]), y = [
|
|
45
37
|
{ label: "Las Vegas", timeZone: "America/Los_Angeles", weatherQuery: "Las Vegas, Nevada" },
|
|
46
38
|
{ label: "Israel", timeZone: "Asia/Jerusalem", weatherQuery: "Jerusalem, Israel" },
|
|
47
39
|
{ label: "New Delhi", timeZone: "Asia/Kolkata", weatherQuery: "New Delhi, India" },
|
|
@@ -89,6 +81,7 @@ class L extends HTMLElement {
|
|
|
89
81
|
"weather-enabled",
|
|
90
82
|
"weather-endpoint",
|
|
91
83
|
"visual-preset",
|
|
84
|
+
"weather-asset-base-url",
|
|
92
85
|
"read-only",
|
|
93
86
|
"persist-key",
|
|
94
87
|
"enable-url-state",
|
|
@@ -96,14 +89,15 @@ class L extends HTMLElement {
|
|
|
96
89
|
];
|
|
97
90
|
}
|
|
98
91
|
root;
|
|
99
|
-
locationsState = u(
|
|
92
|
+
locationsState = u(y);
|
|
100
93
|
weatherEnabledState = !0;
|
|
101
94
|
weatherEndpointState = "";
|
|
95
|
+
weatherAssetBaseUrlState = d;
|
|
102
96
|
visualPresetState = "default";
|
|
103
97
|
readOnlyState = !1;
|
|
104
98
|
persistKeyState = "";
|
|
105
99
|
enableUrlState = !1;
|
|
106
|
-
shareQueryParamState =
|
|
100
|
+
shareQueryParamState = h;
|
|
107
101
|
cityCatalogState = g;
|
|
108
102
|
weatherOverridesState = {};
|
|
109
103
|
weatherByKey = /* @__PURE__ */ new Map();
|
|
@@ -148,8 +142,12 @@ class L extends HTMLElement {
|
|
|
148
142
|
this.weatherEndpointState = String(r || "").trim(), this.handleConfigurationChange(!0, "attribute");
|
|
149
143
|
return;
|
|
150
144
|
}
|
|
145
|
+
if (e === "weather-asset-base-url") {
|
|
146
|
+
this.weatherAssetBaseUrlState = String(r || d).trim() || d, this.handleConfigurationChange(!1, "attribute");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
151
149
|
if (e === "visual-preset") {
|
|
152
|
-
this.visualPresetState =
|
|
150
|
+
this.visualPresetState = p(r), this.handleConfigurationChange(!1, "attribute");
|
|
153
151
|
return;
|
|
154
152
|
}
|
|
155
153
|
if (e === "read-only") {
|
|
@@ -164,7 +162,7 @@ class L extends HTMLElement {
|
|
|
164
162
|
this.enableUrlState = r != null && r !== "false";
|
|
165
163
|
return;
|
|
166
164
|
}
|
|
167
|
-
e === "share-query-param" && (this.shareQueryParamState = String(r ||
|
|
165
|
+
e === "share-query-param" && (this.shareQueryParamState = String(r || h).trim() || h);
|
|
168
166
|
}
|
|
169
167
|
get locations() {
|
|
170
168
|
return this.locationsState.map((e) => ({ ...e }));
|
|
@@ -188,7 +186,13 @@ class L extends HTMLElement {
|
|
|
188
186
|
return this.visualPresetState;
|
|
189
187
|
}
|
|
190
188
|
set visualPreset(e) {
|
|
191
|
-
this.visualPresetState =
|
|
189
|
+
this.visualPresetState = p(e), this.handleConfigurationChange(!1, "api");
|
|
190
|
+
}
|
|
191
|
+
get weatherAssetBaseUrl() {
|
|
192
|
+
return this.weatherAssetBaseUrlState;
|
|
193
|
+
}
|
|
194
|
+
set weatherAssetBaseUrl(e) {
|
|
195
|
+
this.weatherAssetBaseUrlState = String(e || d).trim() || d, this.handleConfigurationChange(!1, "api");
|
|
192
196
|
}
|
|
193
197
|
get readOnly() {
|
|
194
198
|
return this.readOnlyState;
|
|
@@ -206,7 +210,7 @@ class L extends HTMLElement {
|
|
|
206
210
|
return this.shareQueryParamState;
|
|
207
211
|
}
|
|
208
212
|
set shareQueryParam(e) {
|
|
209
|
-
this.shareQueryParamState = String(e ||
|
|
213
|
+
this.shareQueryParamState = String(e || h).trim() || h;
|
|
210
214
|
}
|
|
211
215
|
get cityCatalog() {
|
|
212
216
|
return this.cityCatalogState.map((e) => ({ ...e }));
|
|
@@ -232,7 +236,7 @@ class L extends HTMLElement {
|
|
|
232
236
|
this.applyConfigValue(e, "api");
|
|
233
237
|
}
|
|
234
238
|
readAttributes() {
|
|
235
|
-
this.hasAttribute("locations") && (this.locationsState = P(this.getAttribute("locations"), this.locationsState)), this.hasAttribute("weather-enabled") && (this.weatherEnabledState = this.getAttribute("weather-enabled") !== "false"), this.hasAttribute("weather-endpoint") && (this.weatherEndpointState = String(this.getAttribute("weather-endpoint") || "").trim()), this.hasAttribute("visual-preset") && (this.visualPresetState =
|
|
239
|
+
this.hasAttribute("locations") && (this.locationsState = P(this.getAttribute("locations"), this.locationsState)), this.hasAttribute("weather-enabled") && (this.weatherEnabledState = this.getAttribute("weather-enabled") !== "false"), this.hasAttribute("weather-endpoint") && (this.weatherEndpointState = String(this.getAttribute("weather-endpoint") || "").trim()), this.hasAttribute("weather-asset-base-url") && (this.weatherAssetBaseUrlState = String(this.getAttribute("weather-asset-base-url") || d).trim() || d), this.hasAttribute("visual-preset") && (this.visualPresetState = p(this.getAttribute("visual-preset"))), this.hasAttribute("read-only") && (this.readOnlyState = this.getAttribute("read-only") !== "false"), this.hasAttribute("persist-key") && (this.persistKeyState = String(this.getAttribute("persist-key") || "").trim()), this.hasAttribute("enable-url-state") && (this.enableUrlState = this.getAttribute("enable-url-state") !== "false"), this.hasAttribute("share-query-param") && (this.shareQueryParamState = String(this.getAttribute("share-query-param") || h).trim() || h);
|
|
236
240
|
}
|
|
237
241
|
initializeSharedState() {
|
|
238
242
|
if (this.persistKeyState) {
|
|
@@ -240,7 +244,7 @@ class L extends HTMLElement {
|
|
|
240
244
|
e && this.applyConfigValue(e, "storage");
|
|
241
245
|
}
|
|
242
246
|
if (this.enableUrlState) {
|
|
243
|
-
const e =
|
|
247
|
+
const e = se(this.shareQueryParamState);
|
|
244
248
|
e && this.applyConfigValue(e, "url");
|
|
245
249
|
}
|
|
246
250
|
}
|
|
@@ -248,7 +252,7 @@ class L extends HTMLElement {
|
|
|
248
252
|
this.weatherEnabledState || (this.weatherByKey = /* @__PURE__ */ new Map(), this.weatherFetchedAt = 0, this.weatherRequestKey = "", this.inFlightWeatherRequest?.abort(), this.inFlightWeatherRequest = null), this.persistCurrentConfig(), this.dispatchConfigChange(t), this.render(), this.isConnected && (e ? this.startWeatherRefresh(!0) : this.render());
|
|
249
253
|
}
|
|
250
254
|
applyConfigValue(e, t) {
|
|
251
|
-
e.locations && (this.locationsState = u(e.locations)), typeof e.weatherEnabled == "boolean" && (this.weatherEnabledState = e.weatherEnabled), typeof e.weatherEndpoint == "string" && (this.weatherEndpointState = e.weatherEndpoint.trim()), e.visualPreset && (this.visualPresetState =
|
|
255
|
+
e.locations && (this.locationsState = u(e.locations)), typeof e.weatherEnabled == "boolean" && (this.weatherEnabledState = e.weatherEnabled), typeof e.weatherEndpoint == "string" && (this.weatherEndpointState = e.weatherEndpoint.trim()), e.visualPreset && (this.visualPresetState = p(e.visualPreset)), this.syncConfigDraftFromState(), this.handleConfigurationChange(!0, t);
|
|
252
256
|
}
|
|
253
257
|
persistCurrentConfig() {
|
|
254
258
|
this.persistKeyState && de(this.persistKeyState, this.config);
|
|
@@ -299,8 +303,8 @@ class L extends HTMLElement {
|
|
|
299
303
|
if (i.signal.aborted || t !== this.buildWeatherRequestKey())
|
|
300
304
|
return;
|
|
301
305
|
const o = /* @__PURE__ */ new Map();
|
|
302
|
-
for (const
|
|
303
|
-
o.set(m(
|
|
306
|
+
for (const c of n.locations)
|
|
307
|
+
o.set(m(c), c.weather ?? null);
|
|
304
308
|
this.weatherByKey = o, this.weatherFetchedAt = Date.now(), this.weatherRequestKey = t;
|
|
305
309
|
} catch (n) {
|
|
306
310
|
if (i.signal.aborted)
|
|
@@ -385,7 +389,7 @@ class L extends HTMLElement {
|
|
|
385
389
|
return;
|
|
386
390
|
}
|
|
387
391
|
if (i === "select-common-city") {
|
|
388
|
-
const n = String(r.dataset.cityKey || ""), o = g.find((
|
|
392
|
+
const n = String(r.dataset.cityKey || ""), o = g.find((c) => w(c) === n);
|
|
389
393
|
if (!o)
|
|
390
394
|
return;
|
|
391
395
|
this.selectedCommonCityKey = n, this.addLocationPreferredName = o.label, this.render();
|
|
@@ -498,7 +502,7 @@ class L extends HTMLElement {
|
|
|
498
502
|
return;
|
|
499
503
|
}
|
|
500
504
|
if (r === "visualPreset" && t instanceof HTMLSelectElement) {
|
|
501
|
-
this.configDraftState.visualPreset =
|
|
505
|
+
this.configDraftState.visualPreset = p(t.value), this.applyConfigDraft(!0);
|
|
502
506
|
return;
|
|
503
507
|
}
|
|
504
508
|
}
|
|
@@ -516,15 +520,15 @@ class L extends HTMLElement {
|
|
|
516
520
|
weatherQuery: (r.weatherQuery || r.label).trim()
|
|
517
521
|
}))
|
|
518
522
|
);
|
|
519
|
-
this.locationsState = t.length ? t : u(
|
|
523
|
+
this.locationsState = t.length ? t : u(y), this.weatherEnabledState = this.configDraftState.weatherEnabled, this.weatherEndpointState = this.configDraftState.weatherEndpoint.trim(), this.visualPresetState = this.configDraftState.visualPreset, this.configDrawerOpen = e ? this.configDrawerOpen : !1, this.syncConfigDraftFromState(), this.handleConfigurationChange(!0, "drawer");
|
|
520
524
|
}
|
|
521
525
|
render() {
|
|
522
526
|
const e = this.captureRenderFocus();
|
|
523
527
|
if (!this.locationsState.length) {
|
|
524
|
-
this.root.innerHTML = `<style>${
|
|
528
|
+
this.root.innerHTML = `<style>${_}</style>`, this.restoreRenderFocus(e);
|
|
525
529
|
return;
|
|
526
530
|
}
|
|
527
|
-
const t = /* @__PURE__ */ new Date(), r = this.locationsState.map((o,
|
|
531
|
+
const t = /* @__PURE__ */ new Date(), r = this.locationsState.map((o, c) => {
|
|
528
532
|
const l = F(o.timeZone, t);
|
|
529
533
|
return {
|
|
530
534
|
label: o.label,
|
|
@@ -532,11 +536,11 @@ class L extends HTMLElement {
|
|
|
532
536
|
weatherQuery: o.weatherQuery || o.label,
|
|
533
537
|
timeParts: l,
|
|
534
538
|
weather: Y(o, this.weatherByKey, this.weatherOverridesState),
|
|
535
|
-
positionPercent: X(
|
|
539
|
+
positionPercent: X(c, this.locationsState.length)
|
|
536
540
|
};
|
|
537
|
-
}), i = W(r), n = i.reduce((o,
|
|
541
|
+
}), i = W(r), n = i.reduce((o, c) => Math.max(o, c.lane + 1), 1);
|
|
538
542
|
this.root.innerHTML = `
|
|
539
|
-
<style>${
|
|
543
|
+
<style>${_}</style>
|
|
540
544
|
<section class="clock-strip clock-strip--preset-${this.visualPresetState} ${this.configDrawerOpen && !this.readOnlyState ? "clock-strip--config-open" : ""}" part="base">
|
|
541
545
|
<section
|
|
542
546
|
class="clock-strip__band"
|
|
@@ -584,7 +588,7 @@ class L extends HTMLElement {
|
|
|
584
588
|
<button type="button" class="clock-config-drawer__ghost" data-action="toggle-add-location" aria-expanded="${this.addLocationOpen ? "true" : "false"}">+</button>
|
|
585
589
|
</div>
|
|
586
590
|
</div>
|
|
587
|
-
${this.statusMessage ? `<div class="clock-config-status">${
|
|
591
|
+
${this.statusMessage ? `<div class="clock-config-status">${s(this.statusMessage)}</div>` : ""}
|
|
588
592
|
${this.renderAddLocationPanel(t, r)}
|
|
589
593
|
${this.renderPresetPanel(i)}
|
|
590
594
|
${this.renderImportExportPanel()}
|
|
@@ -595,8 +599,8 @@ class L extends HTMLElement {
|
|
|
595
599
|
</ul>
|
|
596
600
|
</div>
|
|
597
601
|
${this.renderAdvancedSettings(e)}
|
|
598
|
-
<datalist id="${
|
|
599
|
-
${oe().map((n) => `<option value="${
|
|
602
|
+
<datalist id="${S}">
|
|
603
|
+
${oe().map((n) => `<option value="${s(n)}"></option>`).join("")}
|
|
600
604
|
</datalist>
|
|
601
605
|
</div>
|
|
602
606
|
</section>
|
|
@@ -609,7 +613,7 @@ class L extends HTMLElement {
|
|
|
609
613
|
<div class="clock-config-preset-save">
|
|
610
614
|
<input
|
|
611
615
|
type="text"
|
|
612
|
-
value="${
|
|
616
|
+
value="${s(this.presetNameDraft)}"
|
|
613
617
|
data-setting="presetName"
|
|
614
618
|
placeholder="Preset name"
|
|
615
619
|
/>
|
|
@@ -618,8 +622,8 @@ class L extends HTMLElement {
|
|
|
618
622
|
<div class="clock-config-presets">
|
|
619
623
|
${e.length ? e.map((t) => `
|
|
620
624
|
<div class="clock-config-preset">
|
|
621
|
-
<button type="button" class="clock-config-search-result" data-action="load-preset" data-preset-name="${
|
|
622
|
-
<button type="button" class="clock-config-location__remove" data-action="delete-preset" data-preset-name="${
|
|
625
|
+
<button type="button" class="clock-config-search-result" data-action="load-preset" data-preset-name="${s(t.name)}">${s(t.name)}</button>
|
|
626
|
+
<button type="button" class="clock-config-location__remove" data-action="delete-preset" data-preset-name="${s(t.name)}">Delete</button>
|
|
623
627
|
</div>
|
|
624
628
|
`).join("") : '<div class="clock-config-search-empty">No saved presets yet.</div>'}
|
|
625
629
|
</div>
|
|
@@ -635,7 +639,7 @@ class L extends HTMLElement {
|
|
|
635
639
|
class="clock-config-textarea"
|
|
636
640
|
data-setting="importExportDraft"
|
|
637
641
|
placeholder="Paste config JSON"
|
|
638
|
-
>${
|
|
642
|
+
>${s(this.importExportDraft)}</textarea>
|
|
639
643
|
</label>
|
|
640
644
|
<div class="clock-config-add-confirm__actions">
|
|
641
645
|
<button type="button" class="clock-config-drawer__ghost" data-action="copy-config-json">Copy current</button>
|
|
@@ -651,7 +655,7 @@ class L extends HTMLElement {
|
|
|
651
655
|
<span class="clock-config-field__label">Search city</span>
|
|
652
656
|
<input
|
|
653
657
|
type="search"
|
|
654
|
-
value="${
|
|
658
|
+
value="${s(this.addLocationQuery)}"
|
|
655
659
|
data-setting="addLocationQuery"
|
|
656
660
|
placeholder="Start typing a city"
|
|
657
661
|
spellcheck="false"
|
|
@@ -663,27 +667,27 @@ class L extends HTMLElement {
|
|
|
663
667
|
${e.length ? e.map((r) => `
|
|
664
668
|
<button
|
|
665
669
|
type="button"
|
|
666
|
-
class="clock-config-search-result ${this.selectedCommonCityKey ===
|
|
670
|
+
class="clock-config-search-result ${this.selectedCommonCityKey === w(r) ? "clock-config-search-result--selected" : ""}"
|
|
667
671
|
data-action="select-common-city"
|
|
668
|
-
data-city-key="${
|
|
672
|
+
data-city-key="${s(w(r))}"
|
|
669
673
|
>
|
|
670
|
-
<span>${
|
|
671
|
-
<span>${
|
|
674
|
+
<span>${s(r.label)}</span>
|
|
675
|
+
<span>${s(r.country)} · ${s(r.timeZone)}</span>
|
|
672
676
|
</button>
|
|
673
677
|
`).join("") : '<div class="clock-config-search-empty">No common city match. Use <strong>Advanced</strong> to add a custom city.</div>'}
|
|
674
678
|
</div>
|
|
675
679
|
${t ? `
|
|
676
680
|
<div class="clock-config-add-confirm">
|
|
677
681
|
<div class="clock-config-add-confirm__city">
|
|
678
|
-
Weather will use ${
|
|
682
|
+
Weather will use ${s(t.weatherQuery)}.
|
|
679
683
|
</div>
|
|
680
684
|
<label class="clock-config-field">
|
|
681
685
|
<span class="clock-config-field__label">Preferred name</span>
|
|
682
686
|
<input
|
|
683
687
|
type="text"
|
|
684
|
-
value="${
|
|
688
|
+
value="${s(this.addLocationPreferredName)}"
|
|
685
689
|
data-setting="addLocationPreferredName"
|
|
686
|
-
placeholder="${
|
|
690
|
+
placeholder="${s(t.label)}"
|
|
687
691
|
/>
|
|
688
692
|
</label>
|
|
689
693
|
<div class="clock-config-add-confirm__actions">
|
|
@@ -714,7 +718,7 @@ class L extends HTMLElement {
|
|
|
714
718
|
<span class="clock-config-field__label">Weather endpoint</span>
|
|
715
719
|
<input
|
|
716
720
|
type="text"
|
|
717
|
-
value="${
|
|
721
|
+
value="${s(e.weatherEndpoint)}"
|
|
718
722
|
placeholder="/api/weather/clocks"
|
|
719
723
|
data-setting="weatherEndpoint"
|
|
720
724
|
/>
|
|
@@ -731,18 +735,18 @@ class L extends HTMLElement {
|
|
|
731
735
|
<div class="clock-config-location">
|
|
732
736
|
<label class="clock-config-field">
|
|
733
737
|
<span class="clock-config-field__label">Preferred name</span>
|
|
734
|
-
<input type="text" value="${
|
|
738
|
+
<input type="text" value="${s(this.customLocationDraft.label)}" data-setting="customLabel" placeholder="Reykjavik" />
|
|
735
739
|
</label>
|
|
736
740
|
<label class="clock-config-field">
|
|
737
741
|
<span class="clock-config-field__label">Weather city</span>
|
|
738
|
-
<input type="text" value="${
|
|
742
|
+
<input type="text" value="${s(this.customLocationDraft.weatherQuery)}" data-setting="customWeatherQuery" placeholder="Reykjavik, Iceland" />
|
|
739
743
|
</label>
|
|
740
744
|
<label class="clock-config-field clock-config-field--time-zone">
|
|
741
745
|
<span class="clock-config-field__label">Time zone</span>
|
|
742
746
|
<input
|
|
743
747
|
type="search"
|
|
744
|
-
list="${
|
|
745
|
-
value="${
|
|
748
|
+
list="${S}"
|
|
749
|
+
value="${s(this.customLocationDraft.timeZone)}"
|
|
746
750
|
data-setting="customTimeZone"
|
|
747
751
|
placeholder="Search IANA time zone"
|
|
748
752
|
spellcheck="false"
|
|
@@ -761,7 +765,7 @@ class L extends HTMLElement {
|
|
|
761
765
|
<li class="clock-config-location-list__item clock-config-location-list__item--confirm">
|
|
762
766
|
<span class="clock-config-location-list__bullet">-</span>
|
|
763
767
|
<div class="clock-config-location-list__body">
|
|
764
|
-
<div class="clock-config-location-list__confirm">Remove ${
|
|
768
|
+
<div class="clock-config-location-list__confirm">Remove ${s(e.label)}?</div>
|
|
765
769
|
<div class="clock-config-location-list__actions">
|
|
766
770
|
<button type="button" class="clock-config-drawer__ghost" data-action="cancel-remove-location">No</button>
|
|
767
771
|
<button type="button" class="clock-config-location__remove" data-action="confirm-remove-location" data-index="${t}">Remove</button>
|
|
@@ -776,7 +780,7 @@ class L extends HTMLElement {
|
|
|
776
780
|
<span class="clock-config-field__label">Screen name</span>
|
|
777
781
|
<input
|
|
778
782
|
type="text"
|
|
779
|
-
value="${
|
|
783
|
+
value="${s(e.label)}"
|
|
780
784
|
data-index="${t}"
|
|
781
785
|
data-field="label"
|
|
782
786
|
placeholder="Macau"
|
|
@@ -786,13 +790,13 @@ class L extends HTMLElement {
|
|
|
786
790
|
<span class="clock-config-field__label">Weather city</span>
|
|
787
791
|
<input
|
|
788
792
|
type="text"
|
|
789
|
-
value="${
|
|
793
|
+
value="${s(e.weatherQuery)}"
|
|
790
794
|
data-index="${t}"
|
|
791
795
|
data-field="weatherQuery"
|
|
792
796
|
placeholder="Macau"
|
|
793
797
|
/>
|
|
794
798
|
</label>
|
|
795
|
-
<div class="clock-config-location-list__meta">${
|
|
799
|
+
<div class="clock-config-location-list__meta">${s(e.timeZone)}</div>
|
|
796
800
|
</div>
|
|
797
801
|
<button type="button" class="clock-config-location__remove" data-action="request-remove-location" data-index="${t}">Remove</button>
|
|
798
802
|
</li>
|
|
@@ -800,8 +804,8 @@ class L extends HTMLElement {
|
|
|
800
804
|
<li class="clock-config-location-list__item" part="config-location">
|
|
801
805
|
<span class="clock-config-location-list__bullet">-</span>
|
|
802
806
|
<button type="button" class="clock-config-location-list__body clock-config-location-list__body--button" data-action="select-location" data-index="${t}">
|
|
803
|
-
<div class="clock-config-location-list__title">${
|
|
804
|
-
<div class="clock-config-location-list__meta">${
|
|
807
|
+
<div class="clock-config-location-list__title">${s(e.label)}</div>
|
|
808
|
+
<div class="clock-config-location-list__meta">${s(e.timeZone)}</div>
|
|
805
809
|
</button>
|
|
806
810
|
<button type="button" class="clock-config-location__remove" data-action="request-remove-location" data-index="${t}">Remove</button>
|
|
807
811
|
</li>
|
|
@@ -814,7 +818,7 @@ class L extends HTMLElement {
|
|
|
814
818
|
return g.filter((r) => !e.has(m(r))).filter((r) => t ? `${r.label} ${r.country} ${r.timeZone} ${r.weatherQuery}`.toLowerCase().includes(t) : !0).slice(0, 8);
|
|
815
819
|
}
|
|
816
820
|
getSelectedCommonCity() {
|
|
817
|
-
return g.find((e) =>
|
|
821
|
+
return g.find((e) => w(e) === this.selectedCommonCityKey) ?? null;
|
|
818
822
|
}
|
|
819
823
|
resetAddLocationUi() {
|
|
820
824
|
this.addLocationQuery = "", this.addLocationPreferredName = "", this.selectedCommonCityKey = "";
|
|
@@ -823,7 +827,7 @@ class L extends HTMLElement {
|
|
|
823
827
|
this.pendingDeleteIndex = null, this.selectedLocationIndex = null, this.advancedSettingsOpen = !1, this.addLocationOpen = !1, this.resetAddLocationUi(), this.customLocationDraft = { label: "", timeZone: "", weatherQuery: "" };
|
|
824
828
|
}
|
|
825
829
|
async copyShareLink() {
|
|
826
|
-
const e =
|
|
830
|
+
const e = ce(this.config, this.shareQueryParamState);
|
|
827
831
|
await N(e), this.setStatusMessage("Share link copied");
|
|
828
832
|
}
|
|
829
833
|
async copyConfigJson() {
|
|
@@ -840,7 +844,7 @@ class L extends HTMLElement {
|
|
|
840
844
|
}
|
|
841
845
|
getSavedPresets() {
|
|
842
846
|
try {
|
|
843
|
-
const e = window.localStorage.getItem(
|
|
847
|
+
const e = window.localStorage.getItem(v);
|
|
844
848
|
if (!e)
|
|
845
849
|
return [];
|
|
846
850
|
const t = JSON.parse(e);
|
|
@@ -850,7 +854,7 @@ class L extends HTMLElement {
|
|
|
850
854
|
}
|
|
851
855
|
}
|
|
852
856
|
writeSavedPresets(e) {
|
|
853
|
-
window.localStorage.setItem(
|
|
857
|
+
window.localStorage.setItem(v, JSON.stringify(e));
|
|
854
858
|
}
|
|
855
859
|
saveCurrentPreset() {
|
|
856
860
|
const e = this.presetNameDraft.trim();
|
|
@@ -906,30 +910,30 @@ class L extends HTMLElement {
|
|
|
906
910
|
renderClockMarker(e) {
|
|
907
911
|
const t = e.label, r = e.timeParts.timeText, i = e.timeParts.dayText, n = j(
|
|
908
912
|
e.weather,
|
|
909
|
-
|
|
910
|
-
), o =
|
|
913
|
+
J()
|
|
914
|
+
), o = K(e.positionPercent), c = o === "clock-marker--edge-left" ? `left:${e.edgeInsetPx != null ? e.edgeInsetPx : Math.max(10, e.labelOffsetPx || 0)}px;` : o === "clock-marker--edge-right" ? `right:${e.edgeInsetPx != null ? e.edgeInsetPx : Math.max(10, -(e.labelOffsetPx || 0))}px;left:auto;` : `left:calc(${e.positionPercent}% ${z(e.labelOffsetPx || 0)});`, l = [t, r, i, n].filter(Boolean).join(" · ");
|
|
911
915
|
return `
|
|
912
916
|
<article
|
|
913
917
|
class="clock-marker ${o}"
|
|
914
918
|
part="marker"
|
|
915
|
-
title="${
|
|
916
|
-
style="${
|
|
919
|
+
title="${s(l)}"
|
|
920
|
+
style="${c}--clock-lane:${e.lane};"
|
|
917
921
|
>
|
|
918
922
|
${this.renderClockWeatherBackdrop(e)}
|
|
919
|
-
<div class="clock-marker__text" part="label">${
|
|
920
|
-
<div class="clock-marker__text clock-marker__text--time" part="time">${
|
|
921
|
-
<div class="clock-marker__meta" part="meta">${
|
|
922
|
-
${n ? `<div class="clock-marker__temp" part="temperature">${
|
|
923
|
+
<div class="clock-marker__text" part="label">${s(t)}</div>
|
|
924
|
+
<div class="clock-marker__text clock-marker__text--time" part="time">${s(r)}</div>
|
|
925
|
+
<div class="clock-marker__meta" part="meta">${s(i)}</div>
|
|
926
|
+
${n ? `<div class="clock-marker__temp" part="temperature">${s(n)}</div>` : ""}
|
|
923
927
|
</article>
|
|
924
928
|
`;
|
|
925
929
|
}
|
|
926
930
|
renderClockWeatherBackdrop(e) {
|
|
927
931
|
if (!this.weatherEnabledState)
|
|
928
932
|
return "";
|
|
929
|
-
const t = e.weather, r = t && t.state === "pass" ? String(t.condition || "cloudy") : G(e.timeParts.hour24), i = ge(r, t, e.timeParts.hour24);
|
|
933
|
+
const t = e.weather, r = t && t.state === "pass" ? String(t.condition || "cloudy") : G(e.timeParts.hour24), i = ge(r, t, e.timeParts.hour24, this.weatherAssetBaseUrlState);
|
|
930
934
|
return `
|
|
931
935
|
<div
|
|
932
|
-
class="clock-weather clock-weather--image clock-weather--${
|
|
936
|
+
class="clock-weather clock-weather--image clock-weather--${s(r)}"
|
|
933
937
|
aria-hidden="true"
|
|
934
938
|
style="--clock-weather-image:url('${i}')"
|
|
935
939
|
></div>
|
|
@@ -943,10 +947,10 @@ function R(a = I) {
|
|
|
943
947
|
function Ee(a = {}) {
|
|
944
948
|
R();
|
|
945
949
|
const e = document.createElement(I);
|
|
946
|
-
return a.locations && (e.locations = a.locations), a.weatherEnabled != null && (e.weatherEnabled = a.weatherEnabled), a.weatherEndpoint && (e.weatherEndpoint = a.weatherEndpoint), a.visualPreset && (e.visualPreset = a.visualPreset), a.readOnly != null && (e.readOnly = a.readOnly), a.persistKey && (e.persistKey = a.persistKey), a.enableUrlState != null && e.setAttribute("enable-url-state", String(a.enableUrlState)), a.shareQueryParam && (e.shareQueryParam = a.shareQueryParam), a.cityCatalog && (e.cityCatalog = a.cityCatalog), a.weatherOverrides && (e.weatherOverrides = a.weatherOverrides), e;
|
|
950
|
+
return a.locations && (e.locations = a.locations), a.weatherEnabled != null && (e.weatherEnabled = a.weatherEnabled), a.weatherEndpoint && (e.weatherEndpoint = a.weatherEndpoint), a.weatherAssetBaseUrl && (e.weatherAssetBaseUrl = a.weatherAssetBaseUrl), a.visualPreset && (e.visualPreset = a.visualPreset), a.readOnly != null && (e.readOnly = a.readOnly), a.persistKey && (e.persistKey = a.persistKey), a.enableUrlState != null && e.setAttribute("enable-url-state", String(a.enableUrlState)), a.shareQueryParam && (e.shareQueryParam = a.shareQueryParam), a.cityCatalog && (e.cityCatalog = a.cityCatalog), a.weatherOverrides && (e.weatherOverrides = a.weatherOverrides), e;
|
|
947
951
|
}
|
|
948
952
|
function u(a) {
|
|
949
|
-
const e = (Array.isArray(a) ? a :
|
|
953
|
+
const e = (Array.isArray(a) ? a : y).map((i) => ({
|
|
950
954
|
label: String(i?.label || "").trim(),
|
|
951
955
|
timeZone: String(i?.timeZone || "").trim(),
|
|
952
956
|
weatherQuery: String(i?.weatherQuery || i?.label || "").trim()
|
|
@@ -970,10 +974,10 @@ function b(a) {
|
|
|
970
974
|
locations: u(a.locations),
|
|
971
975
|
weatherEnabled: a.weatherEnabled !== !1,
|
|
972
976
|
weatherEndpoint: String(a.weatherEndpoint || "").trim(),
|
|
973
|
-
visualPreset:
|
|
977
|
+
visualPreset: p(a.visualPreset)
|
|
974
978
|
};
|
|
975
979
|
}
|
|
976
|
-
function
|
|
980
|
+
function p(a) {
|
|
977
981
|
return a === "minimal" || a === "cinematic" || a === "wallboard" ? a : "default";
|
|
978
982
|
}
|
|
979
983
|
function Z(a) {
|
|
@@ -1004,11 +1008,11 @@ function W(a) {
|
|
|
1004
1008
|
labelOffsetPx: 0
|
|
1005
1009
|
}));
|
|
1006
1010
|
}
|
|
1007
|
-
function
|
|
1011
|
+
function z(a) {
|
|
1008
1012
|
const e = Number(a || 0);
|
|
1009
1013
|
return e < 0 ? `- ${Math.abs(e)}px` : `+ ${e}px`;
|
|
1010
1014
|
}
|
|
1011
|
-
function
|
|
1015
|
+
function K(a) {
|
|
1012
1016
|
return a <= 8 ? "clock-marker--edge-left" : a >= 92 ? "clock-marker--edge-right" : "";
|
|
1013
1017
|
}
|
|
1014
1018
|
function F(a, e) {
|
|
@@ -1025,7 +1029,7 @@ function F(a, e) {
|
|
|
1025
1029
|
hour24: o === "PM" && n < 12 ? n + 12 : o === "AM" && n === 12 ? 0 : n,
|
|
1026
1030
|
minute24: Number(i.minute || "0"),
|
|
1027
1031
|
timeText: `${i.hour || ""}:${i.minute || ""} ${i.dayPeriod || ""}`.trim(),
|
|
1028
|
-
dayText:
|
|
1032
|
+
dayText: $(a, e, String(i.weekday || "")),
|
|
1029
1033
|
zoneText: String(i.timeZoneName || a)
|
|
1030
1034
|
};
|
|
1031
1035
|
} catch {
|
|
@@ -1033,12 +1037,12 @@ function F(a, e) {
|
|
|
1033
1037
|
hour24: e.getHours(),
|
|
1034
1038
|
minute24: e.getMinutes(),
|
|
1035
1039
|
timeText: e.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" }),
|
|
1036
|
-
dayText:
|
|
1040
|
+
dayText: $(a, e, e.toLocaleDateString("en-US", { weekday: "long" })),
|
|
1037
1041
|
zoneText: a
|
|
1038
1042
|
};
|
|
1039
1043
|
}
|
|
1040
1044
|
}
|
|
1041
|
-
function
|
|
1045
|
+
function $(a, e, t) {
|
|
1042
1046
|
const r = U(a, e);
|
|
1043
1047
|
return r ? `${t} ${r}${H(r)}` : t;
|
|
1044
1048
|
}
|
|
@@ -1065,20 +1069,20 @@ function j(a, e) {
|
|
|
1065
1069
|
const t = a?.state === "pass" ? Number(a.temperature) : Number.NaN;
|
|
1066
1070
|
if (!Number.isFinite(t))
|
|
1067
1071
|
return "";
|
|
1068
|
-
const r =
|
|
1072
|
+
const r = B(e), i = r === "F" ? q(t) : t;
|
|
1069
1073
|
return `${Math.round(i)}°${r}`;
|
|
1070
1074
|
}
|
|
1071
|
-
function
|
|
1075
|
+
function B(a) {
|
|
1072
1076
|
return Q.has(a) ? "F" : "C";
|
|
1073
1077
|
}
|
|
1074
|
-
function
|
|
1078
|
+
function J() {
|
|
1075
1079
|
try {
|
|
1076
1080
|
return String(Intl.DateTimeFormat().resolvedOptions().timeZone || "").trim();
|
|
1077
1081
|
} catch {
|
|
1078
1082
|
return "";
|
|
1079
1083
|
}
|
|
1080
1084
|
}
|
|
1081
|
-
function
|
|
1085
|
+
function q(a) {
|
|
1082
1086
|
return a * 9 / 5 + 32;
|
|
1083
1087
|
}
|
|
1084
1088
|
function Y(a, e, t) {
|
|
@@ -1098,12 +1102,12 @@ function V(a) {
|
|
|
1098
1102
|
...t.map((o) => ({ x: o.x - 100, time: o.time - 100 })),
|
|
1099
1103
|
...t,
|
|
1100
1104
|
...t.map((o) => ({ x: o.x + 100, time: o.time + 100 }))
|
|
1101
|
-
].sort((o,
|
|
1105
|
+
].sort((o, c) => o.x - c.x), i = 72, n = [];
|
|
1102
1106
|
for (let o = 0; o <= i; o += 1) {
|
|
1103
|
-
const
|
|
1107
|
+
const c = Number((o / i * 100).toFixed(2)), l = ae(c, r);
|
|
1104
1108
|
n.push({
|
|
1105
1109
|
color: re(l),
|
|
1106
|
-
percent:
|
|
1110
|
+
percent: c
|
|
1107
1111
|
});
|
|
1108
1112
|
}
|
|
1109
1113
|
return D(n);
|
|
@@ -1177,20 +1181,20 @@ function re(a) {
|
|
|
1177
1181
|
const o = n.percent - i.percent;
|
|
1178
1182
|
if (o <= 0)
|
|
1179
1183
|
return i.color;
|
|
1180
|
-
const
|
|
1181
|
-
return ie(i.color, n.color,
|
|
1184
|
+
const c = (e - i.percent) / o;
|
|
1185
|
+
return ie(i.color, n.color, c);
|
|
1182
1186
|
}
|
|
1183
1187
|
return t[t.length - 1].color;
|
|
1184
1188
|
}
|
|
1185
1189
|
function ie(a, e, t) {
|
|
1186
|
-
const r =
|
|
1190
|
+
const r = O(a), i = O(e);
|
|
1187
1191
|
return ne({
|
|
1188
1192
|
r: Math.round(r.r + (i.r - r.r) * t),
|
|
1189
1193
|
g: Math.round(r.g + (i.g - r.g) * t),
|
|
1190
1194
|
b: Math.round(r.b + (i.b - r.b) * t)
|
|
1191
1195
|
});
|
|
1192
1196
|
}
|
|
1193
|
-
function
|
|
1197
|
+
function O(a) {
|
|
1194
1198
|
const e = a.replace("#", "");
|
|
1195
1199
|
return {
|
|
1196
1200
|
r: Number.parseInt(e.slice(0, 2), 16),
|
|
@@ -1210,19 +1214,15 @@ function oe() {
|
|
|
1210
1214
|
}
|
|
1211
1215
|
return E;
|
|
1212
1216
|
}
|
|
1213
|
-
function
|
|
1214
|
-
const e = ["..", "assets", "weather", a].join("/");
|
|
1215
|
-
return new URL(e, import.meta.url).href;
|
|
1216
|
-
}
|
|
1217
|
-
function ce(a) {
|
|
1217
|
+
function se(a) {
|
|
1218
1218
|
try {
|
|
1219
1219
|
const t = new URL(window.location.href).searchParams.get(a);
|
|
1220
|
-
return t ?
|
|
1220
|
+
return t ? he(t) : null;
|
|
1221
1221
|
} catch {
|
|
1222
1222
|
return null;
|
|
1223
1223
|
}
|
|
1224
1224
|
}
|
|
1225
|
-
function
|
|
1225
|
+
function ce(a, e) {
|
|
1226
1226
|
const t = new URL(window.location.href);
|
|
1227
1227
|
return t.searchParams.set(e, ue(a)), t.toString();
|
|
1228
1228
|
}
|
|
@@ -1238,16 +1238,16 @@ function de(a, e) {
|
|
|
1238
1238
|
window.localStorage.setItem(a, JSON.stringify(e));
|
|
1239
1239
|
}
|
|
1240
1240
|
function ue(a) {
|
|
1241
|
-
return
|
|
1241
|
+
return fe(JSON.stringify(b(a)));
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
const e =
|
|
1243
|
+
function he(a) {
|
|
1244
|
+
const e = pe(a);
|
|
1245
1245
|
return b(JSON.parse(e));
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function fe(a) {
|
|
1248
1248
|
return btoa(unescape(encodeURIComponent(a))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1250
|
+
function pe(a) {
|
|
1251
1251
|
const e = a.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(a.length / 4) * 4, "=");
|
|
1252
1252
|
return decodeURIComponent(escape(atob(e)));
|
|
1253
1253
|
}
|
|
@@ -1259,8 +1259,23 @@ async function N(a) {
|
|
|
1259
1259
|
const e = document.createElement("textarea");
|
|
1260
1260
|
e.value = a, document.body.append(e), e.select(), document.execCommand("copy"), e.remove();
|
|
1261
1261
|
}
|
|
1262
|
-
function ge(a, e, t) {
|
|
1263
|
-
|
|
1262
|
+
function ge(a, e, t, r) {
|
|
1263
|
+
if (a === "partly-cloudy")
|
|
1264
|
+
return me(e, t) ? k("Partly_Cloudy_Day.webp", r) : k("Partly_Cloudy.webp", r);
|
|
1265
|
+
const i = {
|
|
1266
|
+
"clear-day": "Sunny.webp",
|
|
1267
|
+
"clear-night": "starry-night.webp",
|
|
1268
|
+
cloudy: "Cloudy.webp",
|
|
1269
|
+
rain: "Rainy.webp",
|
|
1270
|
+
storm: "storm.webp",
|
|
1271
|
+
snow: "Snow.webp",
|
|
1272
|
+
fog: "Foggy.webp"
|
|
1273
|
+
}[a] || "Cloudy.webp";
|
|
1274
|
+
return k(i, r);
|
|
1275
|
+
}
|
|
1276
|
+
function k(a, e) {
|
|
1277
|
+
const t = String(e || d).trim() || d;
|
|
1278
|
+
return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t) ? new URL(a, t.endsWith("/") ? t : `${t}/`).toString() : `${t.endsWith("/") ? t : `${t}/`}${a}`;
|
|
1264
1279
|
}
|
|
1265
1280
|
function me(a, e) {
|
|
1266
1281
|
return a && typeof a.isDay == "boolean" ? a.isDay : e >= 6 && e < 18;
|
|
@@ -1269,13 +1284,13 @@ function m(a) {
|
|
|
1269
1284
|
const e = String(a.weatherQuery || a.label || "").trim().toLowerCase(), t = String(a.timeZone || "").trim().toLowerCase();
|
|
1270
1285
|
return `${e}__${t}`;
|
|
1271
1286
|
}
|
|
1272
|
-
function
|
|
1287
|
+
function w(a) {
|
|
1273
1288
|
return `${a.label.toLowerCase()}__${a.timeZone.toLowerCase()}`;
|
|
1274
1289
|
}
|
|
1275
1290
|
async function be(a, e, t) {
|
|
1276
|
-
return e ?
|
|
1291
|
+
return e ? we(a, e, t) : ke(a, t);
|
|
1277
1292
|
}
|
|
1278
|
-
async function
|
|
1293
|
+
async function we(a, e, t) {
|
|
1279
1294
|
const r = await fetch(e, {
|
|
1280
1295
|
method: "POST",
|
|
1281
1296
|
headers: {
|
|
@@ -1292,7 +1307,7 @@ async function ke(a, e, t) {
|
|
|
1292
1307
|
locations: Array.isArray(i?.locations) ? i.locations : []
|
|
1293
1308
|
};
|
|
1294
1309
|
}
|
|
1295
|
-
async function
|
|
1310
|
+
async function ke(a, e) {
|
|
1296
1311
|
const t = await Promise.all(
|
|
1297
1312
|
a.map(async (r) => {
|
|
1298
1313
|
try {
|
|
@@ -1320,16 +1335,16 @@ async function ye(a, e) {
|
|
|
1320
1335
|
const t = String(a.label || "").trim(), r = String(a.timeZone || "").trim(), i = String(a.weatherQuery || a.label || "").trim();
|
|
1321
1336
|
if (!i)
|
|
1322
1337
|
throw new Error("Weather place missing");
|
|
1323
|
-
const n = await xe(i, e), o = await _e(n.latitude, n.longitude, r, e),
|
|
1338
|
+
const n = await xe(i, e), o = await _e(n.latitude, n.longitude, r, e), c = Number(o.weather_code), l = Number(o.is_day) === 1, f = Se(c, l);
|
|
1324
1339
|
return {
|
|
1325
1340
|
label: t,
|
|
1326
1341
|
timeZone: r,
|
|
1327
1342
|
weatherQuery: i,
|
|
1328
1343
|
weather: {
|
|
1329
1344
|
state: "pass",
|
|
1330
|
-
condition:
|
|
1331
|
-
description:
|
|
1332
|
-
code:
|
|
1345
|
+
condition: f.condition,
|
|
1346
|
+
description: f.description,
|
|
1347
|
+
code: c,
|
|
1333
1348
|
isDay: l,
|
|
1334
1349
|
temperature: Number.isFinite(Number(o.temperature_2m)) ? Number(o.temperature_2m) : null,
|
|
1335
1350
|
temperatureUnit: "°C",
|
|
@@ -1342,21 +1357,21 @@ async function ye(a, e) {
|
|
|
1342
1357
|
};
|
|
1343
1358
|
}
|
|
1344
1359
|
async function xe(a, e) {
|
|
1345
|
-
const t = a.toLowerCase(), r =
|
|
1360
|
+
const t = a.toLowerCase(), r = C.get(t);
|
|
1346
1361
|
if (r && r.expiresAt > Date.now())
|
|
1347
1362
|
return r.value;
|
|
1348
1363
|
const i = Array.from(
|
|
1349
1364
|
new Set([a, a.split(",")[0].trim(), a.replace(/\s+/g, " ").trim()].filter(Boolean))
|
|
1350
1365
|
);
|
|
1351
1366
|
let n = null;
|
|
1352
|
-
for (const
|
|
1367
|
+
for (const c of i) {
|
|
1353
1368
|
const l = new URL("https://geocoding-api.open-meteo.com/v1/search");
|
|
1354
|
-
l.searchParams.set("name",
|
|
1355
|
-
const
|
|
1356
|
-
if (!
|
|
1357
|
-
throw new Error(`Geocoding failed with ${
|
|
1358
|
-
const
|
|
1359
|
-
if (n = Array.isArray(
|
|
1369
|
+
l.searchParams.set("name", c), l.searchParams.set("count", "1"), l.searchParams.set("language", "en"), l.searchParams.set("format", "json");
|
|
1370
|
+
const f = await fetch(l, { signal: e });
|
|
1371
|
+
if (!f.ok)
|
|
1372
|
+
throw new Error(`Geocoding failed with ${f.status}`);
|
|
1373
|
+
const x = await f.json();
|
|
1374
|
+
if (n = Array.isArray(x.results) && x.results[0] || null, n)
|
|
1360
1375
|
break;
|
|
1361
1376
|
}
|
|
1362
1377
|
if (!n)
|
|
@@ -1366,24 +1381,24 @@ async function xe(a, e) {
|
|
|
1366
1381
|
longitude: Number(n.longitude),
|
|
1367
1382
|
displayName: [n.name, n.admin1 || n.country].filter(Boolean).join(", ")
|
|
1368
1383
|
};
|
|
1369
|
-
return
|
|
1384
|
+
return C.set(t, {
|
|
1370
1385
|
expiresAt: Date.now() + 864e5,
|
|
1371
1386
|
value: o
|
|
1372
1387
|
}), o;
|
|
1373
1388
|
}
|
|
1374
1389
|
async function _e(a, e, t, r) {
|
|
1375
|
-
const i = `${a}:${e}:${t}`, n =
|
|
1390
|
+
const i = `${a}:${e}:${t}`, n = A.get(i);
|
|
1376
1391
|
if (n && n.expiresAt > Date.now())
|
|
1377
1392
|
return n.value;
|
|
1378
1393
|
const o = new URL("https://api.open-meteo.com/v1/forecast");
|
|
1379
1394
|
o.searchParams.set("latitude", String(a)), o.searchParams.set("longitude", String(e)), o.searchParams.set("current", "temperature_2m,weather_code,is_day,cloud_cover,precipitation"), o.searchParams.set("timezone", t || "auto"), o.searchParams.set("forecast_days", "1");
|
|
1380
|
-
const
|
|
1381
|
-
if (!
|
|
1382
|
-
throw new Error(`Weather fetch failed with ${
|
|
1383
|
-
const l = await
|
|
1395
|
+
const c = await fetch(o, { signal: r });
|
|
1396
|
+
if (!c.ok)
|
|
1397
|
+
throw new Error(`Weather fetch failed with ${c.status}`);
|
|
1398
|
+
const l = await c.json();
|
|
1384
1399
|
if (!l.current)
|
|
1385
1400
|
throw new Error("Current weather unavailable");
|
|
1386
|
-
return
|
|
1401
|
+
return A.set(i, {
|
|
1387
1402
|
expiresAt: Date.now() + 9e5,
|
|
1388
1403
|
value: l.current
|
|
1389
1404
|
}), l.current;
|
|
@@ -1437,16 +1452,16 @@ function T(a) {
|
|
|
1437
1452
|
};
|
|
1438
1453
|
return Object.prototype.hasOwnProperty.call(e, a) ? e[a] : Number.MAX_SAFE_INTEGER;
|
|
1439
1454
|
}
|
|
1440
|
-
function
|
|
1455
|
+
function s(a) {
|
|
1441
1456
|
return String(a).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1442
1457
|
}
|
|
1443
1458
|
export {
|
|
1444
1459
|
I as WORLD_CLOCK_TAG_NAME,
|
|
1445
1460
|
L as WorldClockStripElement,
|
|
1446
1461
|
Ee as createWorldClockStrip,
|
|
1447
|
-
|
|
1462
|
+
y as defaultClockLocations,
|
|
1448
1463
|
R as defineWorldClockStrip,
|
|
1449
|
-
|
|
1464
|
+
he as deserializeWorldClockConfig,
|
|
1450
1465
|
G as getFallbackWeatherCondition,
|
|
1451
1466
|
me as isDaytimeWeather,
|
|
1452
1467
|
Se as mapWeatherCode,
|