22 lines
1.3 KiB
Python
22 lines
1.3 KiB
Python
from pathlib import Path
|
|
folder=Path(__file__).resolve().parent;p=folder/'payload/assets/ui/console-app.js'
|
|
s=p.read_text(encoding='utf-8')
|
|
old=' function polishedIcons(html){return glyphIcons.reduce((value,[glyph,name])=>value.replaceAll(glyph,icon(name)),html)}'
|
|
new=''' const glyphLookup=new Map(glyphIcons.map(([glyph,name])=>[glyph,icon(name)]));
|
|
const glyphMatcher=new RegExp(glyphIcons.map(([glyph])=>glyph).join("|"),"gu");
|
|
function polishedIcons(html){return html.replace(glyphMatcher,glyph=>glyphLookup.get(glyph))}'''
|
|
assert old in s;s=s.replace(old,new)
|
|
s=s.replace(' const people = (state.people || []).map(p => [',' const people = (["auto","queue"].includes(view) ? (state.people || []) : []).map(p => [')
|
|
s=s.replace(' const task = state.task ? {',' const task = ["auto","queue"].includes(view) && state.task ? {')
|
|
p.write_text(s,encoding='utf-8',newline='\n')
|
|
p=folder/'payload/assets/ui/console-responsive.css'
|
|
with p.open('a',encoding='utf-8') as f:
|
|
f.write('''
|
|
/* Offscreen list rows need no painting until they approach the scroll viewport. */
|
|
#stage :is(.queue-row, .event-row, .db-conversation, .db-account) {
|
|
content-visibility: auto;
|
|
contain-intrinsic-size: auto 72px;
|
|
}
|
|
''')
|
|
print('Prepared single-pass icon replacement and offscreen row rendering')
|