cortico-world-agent-speed 0.2.0 → 0.2.2
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/CHANGELOG.md +64 -0
- package/LICENSE +0 -14
- package/README.md +29 -11
- package/THIRD_PARTY_NOTICES.md +69 -0
- package/activity.d.ts +15 -0
- package/activity.js +88 -3
- package/describe.json +806 -0
- package/dist/webui.css +2 -0
- package/dist/webui.css.map +7 -0
- package/dist/webui.js +2 -0
- package/dist/webui.js.map +7 -0
- package/host/app-store.cjs +68 -0
- package/host/cursor.cjs +67 -0
- package/host/electron-main.cjs +666 -0
- package/host/input-shape.cjs +63 -0
- package/host/mouse-lease.cjs +77 -0
- package/host/overlay.cjs +139 -0
- package/host/portrait.cjs +52 -0
- package/host/preload.cjs +60 -14
- package/host/renderer-gone.cjs +24 -0
- package/host/windows.cjs +251 -0
- package/package.json +27 -7
- package/scripts/build-webui.mjs +40 -0
- package/scripts/speech-bank/build.py +166 -0
- package/scripts/speech-bank/dicts.py +76 -0
- package/src/ENV_PROMPT.en.md +51 -0
- package/src/ENV_PROMPT.md +51 -0
- package/src/asr/address.ts +25 -0
- package/src/asr/hotkey.ts +335 -0
- package/src/asr/result.ts +51 -0
- package/src/asr/segmenter.ts +269 -0
- package/src/asr/sherpa.ts +280 -0
- package/src/asr/simplify.ts +38 -0
- package/src/asr/system-recognizer.ts +292 -0
- package/src/asr/system-sapi.ps1 +173 -0
- package/src/asr/transcription-api.ts +176 -0
- package/src/chat.ts +212 -0
- package/src/config.ts +481 -0
- package/src/cua/ENV_PROMPT.en.md +29 -0
- package/src/cua/ENV_PROMPT.md +29 -0
- package/src/cua/config.ts +88 -0
- package/src/cua/cua.ts +712 -0
- package/src/cua/engine/darwin.ts +410 -0
- package/src/cua/engine/display.ts +55 -0
- package/src/cua/engine/fail.ts +15 -0
- package/src/cua/engine/foreground.ts +8 -0
- package/src/cua/engine/image.ts +57 -0
- package/src/cua/engine/keys.ts +70 -0
- package/src/cua/engine/linux-keys.ts +29 -0
- package/src/cua/engine/linux.ts +343 -0
- package/src/cua/engine/mac-keys.ts +57 -0
- package/src/cua/engine/user-activity.ts +54 -0
- package/src/cua/engine/wait-idle.ts +31 -0
- package/src/cua/engine/win32.ts +299 -0
- package/src/cua/engine-child.ts +274 -0
- package/src/cua/engine-ipc.ts +140 -0
- package/src/cua/i18n/de.ts +53 -0
- package/src/cua/i18n/en.ts +63 -0
- package/src/cua/i18n/es-419.ts +53 -0
- package/src/cua/i18n/fr.ts +53 -0
- package/src/cua/i18n/index.ts +26 -0
- package/src/cua/i18n/it.ts +53 -0
- package/src/cua/i18n/ja.ts +53 -0
- package/src/cua/i18n/ko.ts +53 -0
- package/src/cua/i18n/pt-BR.ts +53 -0
- package/src/cua/i18n/ru.ts +59 -0
- package/src/cua/i18n/zh-Hant.ts +53 -0
- package/src/cua/i18n/zh.ts +59 -0
- package/src/cua/model-text.ts +252 -0
- package/src/cua/terminal.ts +31 -0
- package/src/cua/tools.ts +153 -0
- package/src/definition.ts +146 -0
- package/src/host-reason.ts +32 -0
- package/src/i18n/de.ts +409 -0
- package/src/i18n/en.ts +443 -0
- package/src/i18n/es-419.ts +409 -0
- package/src/i18n/fr.ts +409 -0
- package/src/i18n/index.ts +56 -0
- package/src/i18n/it.ts +409 -0
- package/src/i18n/ja.ts +409 -0
- package/src/i18n/ko.ts +409 -0
- package/src/i18n/pt-BR.ts +409 -0
- package/src/i18n/ru.ts +415 -0
- package/src/i18n/zh-Hant.ts +409 -0
- package/src/i18n/zh.ts +440 -0
- package/src/index.ts +15 -0
- package/src/model-text.ts +344 -0
- package/src/moves.ts +101 -0
- package/src/pack-import.ts +361 -0
- package/src/packs.ts +449 -0
- package/src/runtime/download.ts +29 -0
- package/src/runtime/store.ts +293 -0
- package/src/script.ts +202 -0
- package/src/self.ts +247 -0
- package/src/server.ts +479 -0
- package/src/speech/data/CMUDICT-LICENSE +33 -0
- package/src/speech/data/IPADIC-COPYING +71 -0
- package/src/speech/data/UNICODE-LICENSE +39 -0
- package/src/speech/data/en.tsv.gz +0 -0
- package/src/speech/data/ja-ipadic.tsv.gz +0 -0
- package/src/speech/data/ja-unihan.tsv.gz +0 -0
- package/src/speech/data/zh.json +1 -0
- package/src/speech/index.ts +204 -0
- package/src/speech/ipa.ts +83 -0
- package/src/speech/japanese.ts +105 -0
- package/src/speech/jukujikun.ts +22 -0
- package/src/speech/korean.ts +35 -0
- package/src/speech/lang.ts +151 -0
- package/src/speech/rules.ts +72 -0
- package/src/speech/syllable.ts +76 -0
- package/src/status.ts +164 -0
- package/src/tools.ts +110 -0
- package/src/webui/api-rows.css +2 -0
- package/src/webui/api-rows.ts +44 -0
- package/src/webui/client.ts +451 -0
- package/src/webui/dress-dialog.css +14 -0
- package/src/webui/dress-dialog.ts +117 -0
- package/src/webui/dress-panel.ts +160 -0
- package/src/webui/key-capture.ts +60 -0
- package/src/webui/shared/modal.css +13 -0
- package/src/webui/shared/modal.ts +77 -0
- package/src/webui/shared/problem.css +15 -0
- package/src/webui/shared/problem.ts +217 -0
- package/src/webui/shared/strings.ts +5 -0
- package/src/webui/style.css +50 -0
- package/src/window-host.ts +116 -0
- package/src/world.ts +2926 -0
- package/web/activity-motion.js +117 -0
- package/web/appearance.js +60 -0
- package/web/body-host.js +257 -0
- package/web/coo/coo.js +384 -0
- package/web/coo/figure.js +15 -0
- package/web/coo/figure.json +1224 -0
- package/web/dist/dress-dialog.css +1 -0
- package/web/dist/dress-dialog.js +1 -0
- package/web/drag-row.js +49 -0
- package/web/drag.js +149 -0
- package/web/dress.css +170 -0
- package/web/dress.html +37 -0
- package/web/dress.js +786 -0
- package/web/figure-frame.html +16 -0
- package/web/figure-frame.js +128 -0
- package/web/frame-loop.js +55 -0
- package/web/hints.js +77 -0
- package/web/i18n/de.js +170 -0
- package/web/i18n/en.js +177 -0
- package/web/i18n/es-419.js +170 -0
- package/web/i18n/fr.js +170 -0
- package/web/i18n/it.js +170 -0
- package/web/i18n/ja.js +170 -0
- package/web/i18n/ko.js +170 -0
- package/web/i18n/pt-BR.js +170 -0
- package/web/i18n/ru.js +170 -0
- package/web/i18n/zh-Hant.js +170 -0
- package/web/i18n/zh.js +175 -0
- package/web/i18n.js +54 -0
- package/{renderer/vendor → web}/kit/body.js +31 -58
- package/web/looks.js +70 -0
- package/web/mic-worklet.js +36 -0
- package/web/mic.js +117 -0
- package/web/motion-frames.js +80 -0
- package/web/motion-level.js +40 -0
- package/web/new-year-2027.svg +238 -0
- package/web/overlay.html +16 -0
- package/web/overlay.js +100 -0
- package/web/pet-app.js +3000 -0
- package/web/pet.css +642 -0
- package/web/pet.html +21 -0
- package/web/scale-slider.js +259 -0
- package/web/show-hide.js +49 -0
- package/web/sound.js +245 -0
- package/web/speech/zh.json +1 -0
- package/web/speech/zh.ogg +0 -0
- package/web/speech.js +197 -0
- package/web/stage.js +160 -0
- package/web/swap-motion.js +119 -0
- package/web/ui.js +195 -0
- package/host/launch.js +0 -187
- package/host/library.cjs +0 -638
- package/host/main.cjs +0 -389
- package/index.js +0 -93
- package/renderer/index.html +0 -22
- package/renderer/pet-sandbox.html +0 -11
- package/renderer/pet.css +0 -38
- package/renderer/pet.js +0 -251
- package/renderer/vendor/activity-motion.js +0 -101
- package/renderer/vendor/figure-frame.js +0 -115
- package/renderer/vendor/pack.css +0 -2
- /package/{renderer/vendor → web}/kit/rig.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.modal{position:fixed;inset:0;background:var(--overlay,rgba(0,0,0,.4));backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;z-index:120;animation:modalFade .15s ease-out}.modalcard{box-sizing:border-box;background:var(--sheet,var(--surface,#fff));color:var(--ink,var(--text,#222));border:1px solid var(--border,var(--line,#ddd));border-radius:var(--radius-lg,14px);width:min(880px,92vw);max-height:min(84vh,920px);display:flex;flex-direction:column;box-shadow:0 18px 48px -28px var(--shadow-strong,rgba(0,0,0,.4));animation:modalPaperIn .16s ease-out}.modalhead{flex:none;display:flex;align-items:center;gap:10px;padding:13px 18px;border-bottom:1px solid var(--line,#ddd)}.modaltitle{font:600 15px var(--sans,sans-serif);color:var(--ink,var(--text,#222));flex:1;overflow-wrap:anywhere}.modalbody{flex:1;min-height:0;overflow:auto;padding:16px 10px;scrollbar-gutter:stable both-edges}.confirm-card .modalbody>.rowbar:last-child{margin:20px 0 0}@keyframes modalFade{0%{opacity:0}}@keyframes modalPaperIn{0%{opacity:0;transform:translateY(6px)}}@media(max-width:720px){.modalcard{width:96vw;max-height:92dvh}}:where(:root[data-motion=low]) :is(.modal,.modalcard){animation:none}@media(prefers-reduced-motion:reduce){:where(:root:not([data-motion])) :is(.modal,.modalcard){animation:none}}.figure-dialog-lead{margin:0 0 14px;font-size:13px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.figure-dialog-items{display:grid;gap:8px}.figure-dialog-item{display:flex;align-items:flex-start;gap:10px;padding:10px;border:1px solid var(--line);border-radius:8px;min-width:0}label.figure-dialog-item{cursor:pointer}.figure-dialog-item>input{flex:none;margin:4px 0 0;accent-color:var(--accent)}.figure-dialog-item>img{flex:none;width:52px;height:52px;object-fit:cover;border-radius:6px}.figure-dialog-info{display:flex;flex-direction:column;gap:3px;min-width:0;overflow-wrap:anywhere}.figure-dialog-info>b{font-size:14px}.figure-dialog-meta{font-size:12px;color:var(--ink-dim,var(--muted));line-height:1.5}.figure-dialog-meta p{margin:3px 0}.figure-dialog-note{font-size:12px;color:var(--accent)}.figure-dialog-warning{font-size:12px;color:var(--danger,var(--anger));margin:10px 0 0;overflow-wrap:anywhere;white-space:pre-wrap}.figure-dialog-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px;margin-top:20px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function y(a,t,i){let e=new(a.doc.defaultView?.AbortController??AbortController),n=()=>{e.signal.aborted||(e.abort(),t.remove(),i?.())};return a.signal.addEventListener("abort",n,{once:!0,signal:e.signal}),a.host.appendChild(t),{el:t,close:n,signal:e.signal,dispose:n}}function h(a,t){let i=a.doc.createElement("div");i.className="modal",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true");let e=y(a,i,t);return a.doc.addEventListener("keydown",n=>{n.key!=="Escape"||n.defaultPrevented||[...a.host.querySelectorAll(":scope > .modal")].at(-1)!==i||(n.preventDefault(),e.close())},{signal:e.signal}),i.addEventListener("mousedown",n=>{n.target===i&&e.close()},{signal:e.signal}),e}function w(a,t,i,e=!1){let n=a.doc.createElement("div");n.className="modalcard",e&&(n.classList.add("confirm-card"),n.style.width="min(460px,92vw)");let l=a.doc.createElement("div");l.className="modalhead";let m=a.doc.createElement("span");m.className="modaltitle",m.textContent=i;let f=a.doc.createElement("div");return f.className="modalbody",l.append(m),n.append(l,f),t.el.append(n),{card:n,head:l,body:f}}function k(a){if(!a||typeof a!="object")return!1;let t=a,i=e=>Array.isArray(e)&&e.every(n=>typeof n=="string");return typeof t.title=="string"&&(t.body===void 0||typeof t.body=="string")&&(t.busy===void 0||typeof t.busy=="boolean")&&(t.selectable===void 0||typeof t.selectable=="boolean")&&(t.warnings===void 0||i(t.warnings))&&Array.isArray(t.actions)&&t.actions.every(e=>e&&typeof e.key=="string"&&typeof e.label=="string"&&(e.selection===void 0||typeof e.selection=="boolean")&&(e.kind===void 0||e.kind==="primary"||e.kind==="danger")&&(e.file===void 0||e.file==="zip"||e.file==="directory"))&&(t.items===void 0||Array.isArray(t.items)&&t.items.every(e=>e&&typeof e.key=="string"&&typeof e.label=="string"&&i(e.meta)&&(e.image===void 0||typeof e.image=="string")&&(e.notice===void 0||typeof e.notice=="string")&&(e.details===void 0||e.details&&typeof e.details.title=="string"&&i(e.details.lines))))}function v(a,t,i){let e=!1,n=()=>{e||i({action:"cancel",selected:[]})},l=t.busy?y(a,a.doc.createElement("div"),n):h(a,n);t.busy&&(l.el.className="modal busy",l.el.setAttribute("role","dialog"),l.el.setAttribute("aria-modal","true"),l.el.setAttribute("aria-busy","true"));let{card:m,body:f}=w(a,l,t.title,!t.items?.length);m.classList.add("figure-dialog");let p=(c,o,d="")=>{let s=a.doc.createElement(c);return s.className=o,s.textContent=d,s};t.body&&f.append(p("p","figure-dialog-lead",t.body));let u=new Set(t.selectable?t.items?.map(c=>c.key):[]),b=[];if(t.items?.length){let c=p("div","figure-dialog-items");for(let o of t.items){let d=p(t.selectable?"label":"div","figure-dialog-item");if(t.selectable){let r=a.doc.createElement("input");r.type="checkbox",r.checked=!0,r.value=o.key,r.addEventListener("change",()=>{r.checked?u.add(o.key):u.delete(o.key);for(let g of b)g.disabled=u.size===0},{signal:l.signal}),d.append(r)}if(o.image){let r=URL.canParse(o.image,a.doc.baseURI)?new URL(o.image,a.doc.baseURI):null;if(r&&["http:","https:","data:","blob:"].includes(r.protocol)){let g=a.doc.createElement("img");g.src=r.href,g.alt="",d.append(g)}}let s=p("div","figure-dialog-info");s.append(p("b","",o.label));for(let r of o.meta)s.append(p("span","figure-dialog-meta",r));if(o.notice&&s.append(p("span","figure-dialog-note",o.notice)),o.details){let r=p("details","figure-dialog-meta");r.append(p("summary","",o.details.title));for(let g of o.details.lines)r.append(p("p","",g));s.append(r)}d.append(s),c.append(d)}f.append(c)}for(let c of t.warnings??[])f.append(p("p","figure-dialog-warning",c));let x=(c,o)=>{e=!0,l.close(),i({action:c,selected:[...u],...o?{files:o}:{}})};if(t.actions.length){let c=p("div","figure-dialog-actions");for(let o of t.actions){let d=a.doc.createElement("button");if(d.type="button",d.className=`btn sm ${o.kind??""}`,d.textContent=o.label,d.dataset.action=o.key,o.selection&&(b.push(d),d.disabled=u.size===0),o.file){let s=a.doc.createElement("input");s.type="file",s.hidden=!0,o.file==="zip"?s.accept=".zip,application/zip":s.setAttribute("webkitdirectory",""),s.addEventListener("change",()=>{let r=Array.from(s.files??[]).map(g=>({path:g.webkitRelativePath||g.name,file:g}));r.length&&x(o.key,r)},{signal:l.signal}),d.addEventListener("click",()=>s.click(),{signal:l.signal}),c.append(s)}else d.addEventListener("click",()=>x(o.key),{signal:l.signal});c.append(d)}f.append(c),c.querySelector("button:not(:disabled)")?.focus()}return l}function N(a,t){let i;a.doc.defaultView.addEventListener("message",e=>{e.source!==t.contentWindow||e.origin!==t.dataset.origin||(e.data?.type==="companion:dialog"&&k(e.data.view)?(i?.close(),i=v(a,e.data.view,n=>{t.contentWindow?.postMessage({type:"companion:dialog-action",id:e.data.id,result:n},e.origin)})):e.data?.type==="companion:dialog-close"&&(i?.close(),i=void 0))},{signal:a.signal})}function S(a,t){let i;return{show(e,n){i?.close(),!t.aborted&&(i=v({doc:a,host:a.body,signal:t},e,n))},close(){i?.close(),i=void 0}}}export{N as hostFrameDressDialogs,k as isDressDialog,S as localDressDialogs,v as showDressDialog};
|
package/web/drag-row.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reordering a row by dragging, across: drag.js with the copy fixed in the window and kept inside the row. The pressed
|
|
3
|
+
* item lifts out as a copy that follows the pointer along the row with the pointer hidden, and stays behind as an
|
|
4
|
+
* empty place the row moves to where it would land, the items it passes sliding aside. Near the row's ends the row
|
|
5
|
+
* scrolls, faster the nearer the pointer is. Esc, a cancelled pointer or the window losing focus slides the item, and
|
|
6
|
+
* the items it passed, back where they were. `drop(order)` gets the items' keys in their new order when it changed.
|
|
7
|
+
*/
|
|
8
|
+
import { dragItems, moveGap, settledBox, slideIn } from './drag.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wired once on `root`, which outlives the rows drawn in it: `item(target)` is the item a press on `target` lifts, or
|
|
12
|
+
* null (a button in it), its parent being the scrolling row; `key(el)` an item's key; `copyClass` the lifted copy's class.
|
|
13
|
+
*/
|
|
14
|
+
export function dragRow(root, { item, key, copyClass, drop }) {
|
|
15
|
+
// the pressed item and its row (known at the press: the row scrolls from the start of the drag), where it started
|
|
16
|
+
let lifted = null, row = null, home = null, before = '';
|
|
17
|
+
const items = () => [...row.children].filter((el) => !el.classList.contains(copyClass));
|
|
18
|
+
const others = () => items().filter((el) => el !== lifted);
|
|
19
|
+
dragItems(root, {
|
|
20
|
+
axis: 'x',
|
|
21
|
+
pick(target) {
|
|
22
|
+
const el = item(target);
|
|
23
|
+
if (el) { lifted = el; row = el.parentElement; }
|
|
24
|
+
return el;
|
|
25
|
+
},
|
|
26
|
+
scroller: () => row,
|
|
27
|
+
copyClass,
|
|
28
|
+
lifted() {
|
|
29
|
+
home = lifted.nextElementSibling;
|
|
30
|
+
before = items().map(key).join('\n');
|
|
31
|
+
},
|
|
32
|
+
/** The empty place goes before the first item whose middle (where it settles, not mid-slide) is past the pointer. */
|
|
33
|
+
locate(x) {
|
|
34
|
+
const next = others().find((el) => { const b = settledBox(el); return x < b.left + b.width / 2; }) ?? null;
|
|
35
|
+
moveGap(lifted, row, next, others(), 'x');
|
|
36
|
+
},
|
|
37
|
+
drop(el, from) {
|
|
38
|
+
// the item slides in from where its copy showed
|
|
39
|
+
slideIn(el, from - el.getBoundingClientRect().left, 'x');
|
|
40
|
+
const order = items().map(key);
|
|
41
|
+
if (order.join('\n') !== before) drop(order);
|
|
42
|
+
},
|
|
43
|
+
cancel() {
|
|
44
|
+
const was = lifted.getBoundingClientRect().left;
|
|
45
|
+
moveGap(lifted, row, home, others(), 'x');
|
|
46
|
+
slideIn(lifted, was - lifted.getBoundingClientRect().left, 'x');
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
package/web/drag.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reordering by dragging, down a list or along a row, with the pointer rather than the browser's drag and drop, which
|
|
3
|
+
* always shows its cursor and a faint snapshot of the element and does not scroll the list. The pressed element lifts
|
|
4
|
+
* out as a copy that follows the pointer with the pointer itself hidden, and stays behind as an empty place the list
|
|
5
|
+
* moves to where it would land (moveGap), the items it passes sliding aside. Near the list's ends it scrolls, faster
|
|
6
|
+
* the nearer the pointer is. Esc, a cancelled pointer or the window losing focus cancels; a drag the page is left in
|
|
7
|
+
* the middle of just ends, so the pointer shows again. The caller decides where things land and what a drop means.
|
|
8
|
+
*
|
|
9
|
+
* Used by the dressing page's favourite looks (drag-row.js, across) and, bundled, the settings window's lists
|
|
10
|
+
* (console/base/drag.ts, down). Slides follow the motion level (motion-level.js): none at low motion.
|
|
11
|
+
*/
|
|
12
|
+
import { motionLevel } from './motion-level.js';
|
|
13
|
+
|
|
14
|
+
const DRAG_SLOP = 4, SCROLL_EDGE = 56, SCROLL_MAX = 18, SHIFT_MS = 180, SHIFT_EASING = 'cubic-bezier(.32,.72,0,1)';
|
|
15
|
+
|
|
16
|
+
/** The names an axis reads and writes. */
|
|
17
|
+
const AXES = {
|
|
18
|
+
y: { client: 'clientY', start: 'top', end: 'bottom', size: 'height', scroll: 'scrollTop', scrollSize: 'scrollHeight', offsetSize: 'offsetHeight', translate: 'translateY', matrix: 'm42' },
|
|
19
|
+
x: { client: 'clientX', start: 'left', end: 'right', size: 'width', scroll: 'scrollLeft', scrollSize: 'scrollWidth', offsetSize: 'offsetWidth', translate: 'translateX', matrix: 'm41' },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `o`: { axis ('y' by default), pick(target) (the element a press on `target` lifts, or null), lifted?(el),
|
|
24
|
+
* locate(at) (where a drop at viewport coordinate `at` would land: on every move and scroll step), drop(el, copyAt)
|
|
25
|
+
* (the copy is gone; `copyAt` is where it showed along the axis, to slide the element in from), cancel(),
|
|
26
|
+
* scroller (the element, or a function giving it, that scrolls near its ends), copyClass, layer? }.
|
|
27
|
+
* With `layer` (a positioned box) the copy is laid inside its content, which cannot grow under it; without, the copy is
|
|
28
|
+
* fixed in the window and kept inside the scroller. `signal` ends it.
|
|
29
|
+
*/
|
|
30
|
+
export function dragItems(root, o, signal) {
|
|
31
|
+
const doc = root.ownerDocument, win = doc.defaultView, A = AXES[o.axis ?? 'y'];
|
|
32
|
+
const on = (target, type, fn, opts = {}) => target.addEventListener(type, fn, signal ? { ...opts, signal } : opts);
|
|
33
|
+
const scroller = () => (typeof o.scroller === 'function' ? o.scroller() : o.scroller);
|
|
34
|
+
let press, lift;
|
|
35
|
+
on(root, 'pointerdown', (event) => {
|
|
36
|
+
if (event.button !== 0 || lift) return;
|
|
37
|
+
const source = event.target, el = o.pick(source);
|
|
38
|
+
if (el) press = { id: event.pointerId, x: event.clientX, y: event.clientY, source, el };
|
|
39
|
+
});
|
|
40
|
+
// An image inside would start the browser's own drag, which cancels this one.
|
|
41
|
+
on(root, 'dragstart', (event) => { if (press) event.preventDefault(); });
|
|
42
|
+
function start(event) {
|
|
43
|
+
const { el, source } = press, box = el.getBoundingClientRect();
|
|
44
|
+
const copy = el.cloneNode(true);
|
|
45
|
+
copy.classList.add(o.copyClass); copy.inert = true; copy.setAttribute('aria-hidden', 'true');
|
|
46
|
+
copy.style.width = `${box.width}px`; copy.style.height = `${box.height}px`;
|
|
47
|
+
let limit = 0;
|
|
48
|
+
if (o.layer) {
|
|
49
|
+
// The layer's content as it is now: a copy past it would lengthen it, and the list would scroll on.
|
|
50
|
+
limit = o.layer[A.scrollSize];
|
|
51
|
+
o.layer.append(copy);
|
|
52
|
+
} else {
|
|
53
|
+
copy.style.top = `${box.top}px`; copy.style.left = `${box.left}px`;
|
|
54
|
+
doc.body.append(copy);
|
|
55
|
+
}
|
|
56
|
+
lift = { el, copy, offset: press[o.axis === 'x' ? 'x' : 'y'] - box[A.start], limit, at: event[A.client], scroller: scroller() };
|
|
57
|
+
// Moving the scroll by hand each frame: a smooth scroll-behavior would trail behind.
|
|
58
|
+
lift.behavior = lift.scroller.style.scrollBehavior;
|
|
59
|
+
lift.scroller.style.scrollBehavior = 'auto';
|
|
60
|
+
el.classList.add('is-dragging'); doc.documentElement.classList.add('is-list-dragging');
|
|
61
|
+
win.getSelection()?.removeAllRanges();
|
|
62
|
+
o.lifted?.(el);
|
|
63
|
+
// Keeps the moves coming when the pointer leaves the window; a pointer the browser no longer tracks cannot be captured.
|
|
64
|
+
try { source.setPointerCapture?.(event.pointerId); } catch { /* The drag goes on without capture. */ }
|
|
65
|
+
}
|
|
66
|
+
/** Keeps the copy under the pointer, inside the layer's content or the scroller. */
|
|
67
|
+
function place() {
|
|
68
|
+
if (!lift) return;
|
|
69
|
+
const size = lift.copy[A.offsetSize];
|
|
70
|
+
if (o.layer) {
|
|
71
|
+
const at = lift.at - lift.offset - o.layer.getBoundingClientRect()[A.start] + o.layer[A.scroll];
|
|
72
|
+
lift.copy.style[A.start] = `${Math.max(0, Math.min(at, lift.limit - size))}px`;
|
|
73
|
+
} else {
|
|
74
|
+
const box = lift.scroller.getBoundingClientRect();
|
|
75
|
+
lift.copy.style[A.start] = `${Math.max(box[A.start], Math.min(lift.at - lift.offset, box[A.end] - size))}px`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** Scrolls while the pointer is near the scroller's ends, faster the nearer it is. */
|
|
79
|
+
function scroll() {
|
|
80
|
+
if (!lift) return;
|
|
81
|
+
lift.frame = undefined;
|
|
82
|
+
const box = lift.scroller.getBoundingClientRect(), at = lift.at;
|
|
83
|
+
const depth = at < box[A.start] + SCROLL_EDGE ? at - box[A.start] - SCROLL_EDGE : at > box[A.end] - SCROLL_EDGE ? at - box[A.end] + SCROLL_EDGE : 0;
|
|
84
|
+
if (!depth) return;
|
|
85
|
+
const was = lift.scroller[A.scroll];
|
|
86
|
+
lift.scroller[A.scroll] += Math.sign(depth) * Math.max(1, Math.min(SCROLL_MAX, Math.abs(depth) / SCROLL_EDGE * SCROLL_MAX));
|
|
87
|
+
if (lift.scroller[A.scroll] === was) return;
|
|
88
|
+
o.locate(at); place();
|
|
89
|
+
lift.frame = win.requestAnimationFrame(scroll);
|
|
90
|
+
}
|
|
91
|
+
on(win, 'pointermove', (event) => {
|
|
92
|
+
if (!press || event.pointerId !== press.id) return;
|
|
93
|
+
if (!lift) { if (Math.hypot(event.clientX - press.x, event.clientY - press.y) < DRAG_SLOP) return; start(event); }
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
// Placed after the list has moved its gap, which may have shifted what it scrolls over.
|
|
96
|
+
lift.at = event[A.client]; o.locate(lift.at); place();
|
|
97
|
+
if (lift.frame === undefined) lift.frame = win.requestAnimationFrame(scroll);
|
|
98
|
+
});
|
|
99
|
+
on(win, 'pointerup', (event) => {
|
|
100
|
+
if (!press || event.pointerId !== press.id) return;
|
|
101
|
+
press = undefined;
|
|
102
|
+
if (!lift) return;
|
|
103
|
+
// The click that follows a drag, in the same turn, is the drop, not a click on the element.
|
|
104
|
+
const swallow = (stop) => { stop.stopPropagation(); stop.preventDefault(); };
|
|
105
|
+
on(win, 'click', swallow, { capture: true, once: true });
|
|
106
|
+
win.setTimeout(() => win.removeEventListener('click', swallow, { capture: true }), 0);
|
|
107
|
+
const { el, copy } = lift, at = copy.getBoundingClientRect()[A.start];
|
|
108
|
+
end(); o.drop(el, at);
|
|
109
|
+
});
|
|
110
|
+
const abandon = () => { press = undefined; if (lift) { end(); o.cancel(); } };
|
|
111
|
+
on(win, 'pointercancel', (event) => { if (press && event.pointerId === press.id) abandon(); });
|
|
112
|
+
on(doc, 'keydown', (event) => { if (event.key === 'Escape' && lift) abandon(); });
|
|
113
|
+
on(win, 'blur', abandon);
|
|
114
|
+
signal?.addEventListener('abort', () => { press = undefined; end(); }, { once: true });
|
|
115
|
+
function end() {
|
|
116
|
+
if (!lift) return;
|
|
117
|
+
if (lift.frame !== undefined) win.cancelAnimationFrame(lift.frame);
|
|
118
|
+
lift.copy.remove(); lift.el.classList.remove('is-dragging');
|
|
119
|
+
lift.scroller.style.scrollBehavior = lift.behavior;
|
|
120
|
+
lift = undefined;
|
|
121
|
+
doc.documentElement.classList.remove('is-list-dragging');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** An element's box without the slide it may be in the middle of, so a drop target does not chase the animation. */
|
|
126
|
+
export function settledBox(el) {
|
|
127
|
+
const win = el.ownerDocument.defaultView, box = el.getBoundingClientRect(), transform = win.getComputedStyle(el).transform;
|
|
128
|
+
const matrix = transform && transform !== 'none' && win.DOMMatrixReadOnly ? new win.DOMMatrixReadOnly(transform) : null;
|
|
129
|
+
const dx = matrix ? matrix.m41 : 0, dy = matrix ? matrix.m42 : 0;
|
|
130
|
+
return { top: box.top - dy, bottom: box.bottom - dy, height: box.height, left: box.left - dx, right: box.right - dx, width: box.width };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Slides `el` from `delta` pixels away along the axis to its place; nothing at low motion. */
|
|
134
|
+
export function slideIn(el, delta, axis = 'y', id) {
|
|
135
|
+
if (Math.abs(delta) <= .5 || motionLevel(el.ownerDocument.defaultView) === 'low') return;
|
|
136
|
+
el.animate?.([{ transform: `${AXES[axis].translate}(${delta}px)` }, { transform: 'none' }], { ...(id ? { id } : {}), duration: SHIFT_MS, easing: SHIFT_EASING });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Moves the dragged element's empty place to `next` in `parent`; the `moving` elements it passes slide aside. */
|
|
140
|
+
export function moveGap(gap, parent, next, moving, axis = 'y') {
|
|
141
|
+
if (next === gap || (gap.parentElement === parent && gap.nextElementSibling === next)) return;
|
|
142
|
+
const A = AXES[axis];
|
|
143
|
+
const others = moving.filter((el) => !gap.contains(el));
|
|
144
|
+
// Each starts from where it shows now, mid-slide or not.
|
|
145
|
+
const from = new Map(others.map((el) => [el, el.getBoundingClientRect()[A.start]]));
|
|
146
|
+
for (const el of others) for (const running of el.getAnimations?.() ?? []) if (running.id === 'drag-shift') running.cancel();
|
|
147
|
+
parent.insertBefore(gap, next);
|
|
148
|
+
for (const [el, at] of from) slideIn(el, at - el.getBoundingClientRect()[A.start], axis, 'drag-shift');
|
|
149
|
+
}
|
package/web/dress.css
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/* Embedded in the settings window the page grows to its content (appearance.js reports the height), so the
|
|
2
|
+
window scrolls it with its own scrollbar; opened on its own it scrolls as any page */
|
|
3
|
+
html:has(body.dress-page){overflow:auto; height:auto}
|
|
4
|
+
body.dress-page{
|
|
5
|
+
overflow:visible; height:auto; min-height:100%; background:var(--bg); color:var(--text);
|
|
6
|
+
padding:16px;
|
|
7
|
+
}
|
|
8
|
+
:root[data-embedded] body.dress-page{min-height:0; padding:0 0 2px; background:transparent}
|
|
9
|
+
:root[data-embedded]:has(body.dress-page){overflow:hidden}
|
|
10
|
+
/* The host console chooses the editor surface's light/dark and lends its accent (--host-accent). */
|
|
11
|
+
:root[data-ui-theme="light"] body.dress-page{
|
|
12
|
+
color-scheme:light;
|
|
13
|
+
--bg:#F3F2F6; --surface:#FFFFFF; --text:#1B1626; --muted:#6A6577; --line:#E2DFE8; --accent:var(--host-accent, #00A870);
|
|
14
|
+
}
|
|
15
|
+
:root[data-ui-theme="dark"] body.dress-page{
|
|
16
|
+
color-scheme:dark;
|
|
17
|
+
--bg:#0D1117; --surface:#151A22; --text:#E9EDF2; --muted:#8C95A3; --line:#252C37; --accent:var(--host-accent, #2FD59B);
|
|
18
|
+
}
|
|
19
|
+
.dress-page main{--swatch-bg:#E8E6EE}
|
|
20
|
+
:root[data-theme="dark"] .dress-page main{--swatch-bg:#10151C}
|
|
21
|
+
/* the preview across the top, as on the 开始 page (the same wall, floor and night/day button, stage.js); the choices below */
|
|
22
|
+
.dress-page main{display:flex; flex-direction:column; gap:20px}
|
|
23
|
+
.preview{
|
|
24
|
+
position:relative; height:300px; border-radius:12px; overflow:hidden; border:1px solid var(--line);
|
|
25
|
+
background-color:var(--wall); background-image:radial-gradient(var(--dot) 1.2px, transparent 1.3px); background-size:22px 22px;
|
|
26
|
+
}
|
|
27
|
+
.preview .floor{position:absolute; left:0; right:0; bottom:0; height:48px; background:var(--surface); border-top:1px solid var(--line)}
|
|
28
|
+
/* only the preview takes the pet's night/day (dress.js puts it on #preview); the page around it follows the settings window */
|
|
29
|
+
.preview{--wall:#E8E6EE; --dot:#CFCBD9; --surface:#FFFFFF; --text:#1B1626; --muted:#6A6577; --line:#E2DFE8; --shadow:rgba(27,22,38,.12)}
|
|
30
|
+
.preview[data-theme="dark"]{--wall:#10151C; --dot:#232B37; --surface:#151A22; --text:#E9EDF2; --muted:#8C95A3; --line:#252C37; --shadow:rgba(0,0,0,.32)}
|
|
31
|
+
/* the preview's top right corner: what happened, then saving the changes to the look picked, then saving a new look */
|
|
32
|
+
.preview .corner{position:absolute; top:12px; right:12px; display:flex; align-items:center; gap:8px}
|
|
33
|
+
.preview .saved{margin:0; font-size:12.5px; color:var(--muted)}
|
|
34
|
+
.save-look{display:grid; place-items:center; width:34px; height:34px; padding:0; border-radius:50%; cursor:pointer;
|
|
35
|
+
border:1px solid var(--line); background:var(--surface); color:var(--text); transition:border-color var(--motion-fast), color var(--motion-fast)}
|
|
36
|
+
.save-look:hover{border-color:var(--accent); color:var(--accent)}
|
|
37
|
+
.save-look[hidden]{display:none}
|
|
38
|
+
.save-look svg{width:18px; height:18px; display:block}
|
|
39
|
+
/* the look picked, changed since it was saved: a dot in its corner */
|
|
40
|
+
.opt.look.changed{position:relative}
|
|
41
|
+
.opt.look.changed::after{content:""; position:absolute; top:6px; left:6px; width:8px; height:8px; border-radius:50%; background:var(--accent)}
|
|
42
|
+
.save-look.done{animation:bump .5s var(--motion-pop); --bump:1.18}
|
|
43
|
+
/* saved looks: rename and remove in the tile's corner on hover or focus; renaming puts a field over the name */
|
|
44
|
+
.look-tile{position:relative; display:flex}
|
|
45
|
+
/* section headings as the settings window draws them on a page: a line above each but the first (console/styles.css .sheet h3) */
|
|
46
|
+
.section-head{grid-column:1 / -1; margin:10px 0 0; padding-top:22px; border-top:1px solid var(--line); font-size:15px; font-weight:600; line-height:1.4; letter-spacing:-.01em; color:var(--text)}
|
|
47
|
+
.section-head.first{margin-top:4px; padding-top:0; border-top:0}
|
|
48
|
+
/* favourites: one row; arrows move it a page at a time when it holds more than fit */
|
|
49
|
+
.looks-gallery{display:flex; align-items:center; gap:6px; min-width:0}
|
|
50
|
+
.looks-strip{display:flex; gap:8px; flex:1; min-width:0; overflow-x:auto; scroll-behavior:smooth; scrollbar-width:none; padding:2px}
|
|
51
|
+
.looks-strip::-webkit-scrollbar{display:none}
|
|
52
|
+
.looks-strip > *{flex:none}
|
|
53
|
+
.g-arrow{flex:none; display:grid; place-items:center; width:28px; height:28px; padding:0; border-radius:50%; cursor:pointer;
|
|
54
|
+
border:1px solid var(--line); background:var(--surface); color:var(--text)}
|
|
55
|
+
.g-arrow:hover:not(:disabled){border-color:var(--accent); color:var(--accent)}
|
|
56
|
+
.g-arrow:disabled{opacity:.35; cursor:default}
|
|
57
|
+
.g-arrow[hidden]{display:none}
|
|
58
|
+
.g-arrow svg{width:16px; height:16px; display:block}
|
|
59
|
+
.looks-empty{margin:0; font-size:13px; line-height:1.5; color:var(--muted)}
|
|
60
|
+
.slot.looks{grid-column:1 / -1}
|
|
61
|
+
.opt.look{gap:7px; position:relative}
|
|
62
|
+
/* the picture stands on the tile's floor at the share of it its size gives (looks.js pictureFill); the size in the corner */
|
|
63
|
+
.look-pic{display:flex; align-items:flex-end; justify-content:center; width:52px; height:52px; overflow:hidden; background:var(--swatch-bg); border-radius:6px}
|
|
64
|
+
.opt .look-pic > svg, .opt .look-pic > img{width:calc(100% * var(--look-fill)); height:calc(100% * var(--look-fill)); background:none; border-radius:0}
|
|
65
|
+
/* the size in the tile's top left, clear of the rename and remove buttons on its right; on a changed favourite it takes the
|
|
66
|
+
accent in place of the dot, which would push it under those buttons */
|
|
67
|
+
.look-size{position:absolute; top:4px; left:4px; padding:0 3px; border-radius:4px; font-size:9px; font-weight:600; line-height:13px;
|
|
68
|
+
font-variant-numeric:tabular-nums; color:var(--muted); background:color-mix(in srgb, var(--surface) 82%, transparent)}
|
|
69
|
+
.opt.look.changed:has(.look-size)::after{display:none}
|
|
70
|
+
.opt.look.changed .look-size{color:#fff; background:var(--accent)}
|
|
71
|
+
/* a favourite whose pack was uninstalled */
|
|
72
|
+
.opt.look.gone{opacity:.45; cursor:default}
|
|
73
|
+
.opt.look span{max-width:84px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
|
|
74
|
+
.look-acts{position:absolute; top:4px; right:4px; display:flex; gap:2px; opacity:0; pointer-events:none; transition:opacity var(--motion-fast) ease}
|
|
75
|
+
.look-tile:hover .look-acts, .look-tile:focus-within .look-acts{opacity:1; pointer-events:auto}
|
|
76
|
+
.look-act{display:grid; place-items:center; width:22px; height:22px; padding:0; border:0; border-radius:6px; cursor:pointer;
|
|
77
|
+
background:color-mix(in srgb, var(--surface) 85%, transparent); color:var(--muted)}
|
|
78
|
+
.look-act:hover{color:var(--text)}
|
|
79
|
+
.look-act.danger:hover{color:var(--anger)}
|
|
80
|
+
.look-act svg{width:14px; height:14px; display:block}
|
|
81
|
+
.look-name{position:absolute; left:4px; right:4px; bottom:4px; min-width:0; padding:1px 2px; font:inherit; font-size:11.5px; text-align:center;
|
|
82
|
+
border:1px solid var(--accent); border-radius:4px; background:var(--surface); color:var(--text)}
|
|
83
|
+
.dress{display:grid; grid-template-columns:minmax(4.5em, max-content) 1fr; gap:12px 14px; align-items:start}
|
|
84
|
+
.dress .row-label{font-size:14px; color:var(--muted); padding-top:18px}
|
|
85
|
+
.opts{display:flex; flex-wrap:wrap; gap:8px}
|
|
86
|
+
.opt{
|
|
87
|
+
font:inherit; cursor:pointer; width:min-content; min-width:72px; display:flex; flex-direction:column; align-items:center; gap:2px;
|
|
88
|
+
padding:8px 4px 6px; border-radius:10px; border:1px solid var(--line); background:var(--surface); color:var(--text);
|
|
89
|
+
transition:border-color var(--motion-fast), background-color var(--motion-fast);
|
|
90
|
+
}
|
|
91
|
+
.opt:hover{border-color:var(--accent)}
|
|
92
|
+
.opt[aria-pressed="true"]{border-color:var(--accent); background:color-mix(in srgb, var(--accent) 14%, var(--surface))}
|
|
93
|
+
.opt svg{width:52px; height:52px; display:block; background:var(--swatch-bg); border-radius:6px}
|
|
94
|
+
.opt span{font-size:12.5px}
|
|
95
|
+
.swatch svg{--skin-ink:var(--sl-ink); --skin-eye:var(--sl-eye)}
|
|
96
|
+
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .swatch svg{--skin-ink:var(--sd-ink); --skin-eye:var(--sd-eye)}}
|
|
97
|
+
:root[data-theme="dark"] .swatch svg{--skin-ink:var(--sd-ink); --skin-eye:var(--sd-eye)}
|
|
98
|
+
.slot{display:flex; flex-direction:column; gap:10px; min-width:0}
|
|
99
|
+
.cmap{display:flex; flex-wrap:wrap; gap:8px 22px; align-items:center}
|
|
100
|
+
.cm-group{display:flex; flex-wrap:wrap; align-items:center; gap:6px}
|
|
101
|
+
.cm-label{font-size:12.5px; color:var(--muted); margin-right:2px}
|
|
102
|
+
.dot{--dot-c:var(--dl); width:22px; height:22px; border-radius:50%; padding:0; cursor:pointer; border:0; background:var(--dot-c); box-shadow:0 0 0 1px var(--line)}
|
|
103
|
+
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .dot{--dot-c:var(--dd)}}
|
|
104
|
+
:root[data-theme="dark"] .dot{--dot-c:var(--dd)}
|
|
105
|
+
.dot.linked{background:transparent; border:5px solid var(--skin-ink); box-shadow:none}
|
|
106
|
+
.dot.linked.eye{border-color:var(--skin-eye)}
|
|
107
|
+
.dot[aria-pressed="true"]{box-shadow:0 0 0 2px var(--bg), 0 0 0 4px var(--text)}
|
|
108
|
+
button:focus-visible{outline:2px solid var(--accent); outline-offset:2px}
|
|
109
|
+
/* Coo's palette and accessories, or the whale's colour schemes, whichever body is chosen */
|
|
110
|
+
.dress:not([data-figure="coo"]) .coo-only{display:none}
|
|
111
|
+
.opt img{width:52px; height:52px; display:block; background:var(--swatch-bg); border-radius:6px; object-fit:cover}
|
|
112
|
+
.opt.wide{width:92px}
|
|
113
|
+
.opt.wide span{font-size:11.5px; text-align:center; line-height:1.25}
|
|
114
|
+
.opt.figure{width:116px}
|
|
115
|
+
/* a pack's name takes up to two lines, cut short with an ellipsis after that; the button's title holds the whole name */
|
|
116
|
+
.opt.figure span{
|
|
117
|
+
font-size:12.5px; line-height:1.25; text-align:center; max-width:100%; overflow-wrap:anywhere;
|
|
118
|
+
display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden;
|
|
119
|
+
}
|
|
120
|
+
@media (max-width:640px){
|
|
121
|
+
.preview{height:240px}
|
|
122
|
+
.dress{grid-template-columns:1fr; gap:6px}
|
|
123
|
+
.dress .row-label{padding-top:6px}
|
|
124
|
+
.opt{min-width:64px}
|
|
125
|
+
.opt svg, .opt img{width:46px; height:46px}
|
|
126
|
+
.look-pic{width:46px; height:46px}
|
|
127
|
+
}
|
|
128
|
+
/* importing packs: the tile after the figures, the problems under them, the dialog, the drop hint */
|
|
129
|
+
.opt.import{border-style:dashed}
|
|
130
|
+
.opt.import svg path{fill:none; stroke:var(--muted); stroke-width:1.6px; stroke-linecap:round; vector-effect:non-scaling-stroke}
|
|
131
|
+
.opt.import:hover svg path{stroke:var(--accent)}
|
|
132
|
+
.pack-problems{font-size:12.5px; color:var(--muted)}
|
|
133
|
+
.pack-problems summary{cursor:pointer}
|
|
134
|
+
.pack-problems ul{margin:6px 0 0; padding-left:18px}
|
|
135
|
+
.pack-problems li{margin:3px 0; overflow-wrap:anywhere}
|
|
136
|
+
.pack-problems b{color:var(--text); font-weight:600}
|
|
137
|
+
.btn{font:inherit; font-size:13.5px; cursor:pointer; padding:7px 14px; border-radius:9px; border:1px solid var(--line); background:var(--surface); color:var(--text)}
|
|
138
|
+
.btn:hover{border-color:var(--accent)}
|
|
139
|
+
.btn.primary{background:var(--accent); border-color:var(--accent); color:var(--surface)}
|
|
140
|
+
.btn:disabled{opacity:.5; cursor:default}
|
|
141
|
+
.drop-hint{position:fixed; inset:8px; z-index:10; display:grid; place-items:center; pointer-events:none; border:2px dashed var(--accent); border-radius:14px; background:color-mix(in srgb, var(--bg) 82%, transparent)}
|
|
142
|
+
.drop-hint[hidden]{display:none}
|
|
143
|
+
.drop-hint p{font-size:16px; margin:0}
|
|
144
|
+
/* uninstalling: the trash in an installed pack's tile corner, shown on hover or focus; the dialog asks */
|
|
145
|
+
.figure-tile{position:relative; display:flex}
|
|
146
|
+
.pack-erase{
|
|
147
|
+
position:absolute; top:6px; right:6px; display:grid; place-items:center; width:24px; height:24px; padding:0;
|
|
148
|
+
border:0; border-radius:6px; background:none; color:var(--muted); cursor:pointer;
|
|
149
|
+
opacity:0; pointer-events:none; transition:opacity var(--motion-fast) ease, color var(--motion-fast) ease;
|
|
150
|
+
}
|
|
151
|
+
.figure-tile:hover .pack-erase, .figure-tile:focus-within .pack-erase{opacity:1; pointer-events:auto}
|
|
152
|
+
.pack-erase:hover{color:var(--anger)}
|
|
153
|
+
.pack-erase svg{width:16px; height:16px; display:block}
|
|
154
|
+
.btn.danger{background:var(--anger); border-color:var(--anger); color:#fff}
|
|
155
|
+
/* dragging a favourite (drag-row.js), as the settings window drags its lists: an empty place where it would land,
|
|
156
|
+
a lifted copy following the pointer, the pointer itself hidden */
|
|
157
|
+
/* the empty place keeps the tile's size: an outline, not a border, so the strip (and the line under it) does not grow */
|
|
158
|
+
.look-tile.is-dragging{outline:1px dashed var(--line); outline-offset:-1px; border-radius:10px}
|
|
159
|
+
.look-tile.is-dragging > *{visibility:hidden}
|
|
160
|
+
html.is-list-dragging, html.is-list-dragging *{cursor:none !important; user-select:none}
|
|
161
|
+
.look-drag-copy{position:fixed; z-index:20; margin:0; pointer-events:none; border-radius:10px; box-shadow:0 0 0 1px var(--line), 0 14px 30px -14px rgba(0,0,0,.45)}
|
|
162
|
+
.look-drag-copy .look-acts{display:none}
|
|
163
|
+
/* the size row: its label and the slider with its percentage centred on one line */
|
|
164
|
+
.dress #lbSize, .slot.size{align-self:center; padding-top:0}
|
|
165
|
+
@media (max-width:640px){ .dress #lbSize{padding-top:6px} }
|
|
166
|
+
.size-row{display:flex; align-items:center; gap:14px; min-width:0}
|
|
167
|
+
.size-value{min-width:44px; font-size:13px; color:var(--muted); font-variant-numeric:tabular-nums}
|
|
168
|
+
|
|
169
|
+
/* motion levels (pet.css): the bump after a save is full motion only */
|
|
170
|
+
:where(:root:not([data-motion="high"])) { .save-look.done { animation: none; } }
|
package/web/dress.html
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN" data-theme="dark">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Cortico</title>
|
|
7
|
+
<link rel="stylesheet" href="/web/pet.css">
|
|
8
|
+
<link rel="stylesheet" href="/web/dress.css">
|
|
9
|
+
<link rel="stylesheet" href="/web/dist/dress-dialog.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body class="dress-page">
|
|
12
|
+
<main>
|
|
13
|
+
<div class="preview" id="preview" data-i18n-label="dress.preview">
|
|
14
|
+
<div class="floor" id="floor" aria-hidden="true"></div>
|
|
15
|
+
<div class="figure-layer" id="figureLayer"></div>
|
|
16
|
+
<div class="corner">
|
|
17
|
+
<p class="saved" id="saved" aria-live="polite"></p>
|
|
18
|
+
<button type="button" class="save-look" id="updateLook" hidden></button>
|
|
19
|
+
<button type="button" class="save-look" id="saveLook"></button>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="dress" id="dress">
|
|
23
|
+
<h2 class="section-head first" id="lbLooks" data-i18n="looks.title"></h2><div class="slot looks" id="optLooks" role="group" aria-labelledby="lbLooks"></div>
|
|
24
|
+
<h2 class="section-head" data-i18n="dress.custom"></h2>
|
|
25
|
+
<div class="row-label" id="lbFigure" data-i18n="dress.figure"></div><div class="slot" id="optFigure" role="group" aria-labelledby="lbFigure"></div>
|
|
26
|
+
<div class="row-label" id="lbSize" data-i18n="dress.size"></div><div class="slot size" id="optSize"></div>
|
|
27
|
+
<div class="row-label coo-only" id="lbPalette" data-i18n="dress.palette"></div><div class="slot coo-only" id="optPalette" role="group" aria-labelledby="lbPalette"></div>
|
|
28
|
+
<div class="row-label coo-only" id="lbHead" data-i18n="dress.head"></div><div class="slot coo-only" id="optHead" role="group" aria-labelledby="lbHead"></div>
|
|
29
|
+
<div class="row-label coo-only" id="lbSide" data-i18n="dress.side"></div><div class="slot coo-only" id="optSide" role="group" aria-labelledby="lbSide"></div>
|
|
30
|
+
<div class="row-label coo-only" id="lbGlasses" data-i18n="dress.glasses"></div><div class="slot coo-only" id="optGlasses" role="group" aria-labelledby="lbGlasses"></div>
|
|
31
|
+
<div class="row-label coo-only" id="lbNeck" data-i18n="dress.neck"></div><div class="slot coo-only" id="optNeck" role="group" aria-labelledby="lbNeck"></div>
|
|
32
|
+
</div>
|
|
33
|
+
</main>
|
|
34
|
+
<div class="drop-hint" id="dropHint" hidden><p data-i18n="dress.dropHint"></p></div>
|
|
35
|
+
<script type="module" src="/web/dress.js"></script>
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|