Algorick commited on
Commit
b9efad2
·
verified ·
1 Parent(s): 3437bb4

acf7da19e856

Browse files
Files changed (6) hide show
  1. web/app.js +23 -2
  2. web/i18n/en.json +2 -1
  3. web/index.html +2 -2
  4. web/poster.js +3 -0
  5. web/style.css +10 -2
  6. web/tips.js +1 -1
web/app.js CHANGED
@@ -1023,9 +1023,12 @@ function showWorking(job) {
1023
  const stage = $("#stage");
1024
  brush.stop();
1025
  stage.dataset.state = "lavoro";
1026
- $("#shot-bar").hidden = true;
 
 
 
 
1027
  $("#base-bar").hidden = true;
1028
- $("#next-bar").hidden = true;
1029
  const frame = $("#develop-frame");
1030
  frame.style.setProperty("--ar", String(job.width / job.height));
1031
  $("#develop-grain").style.backgroundImage = `url(${grainTile()})`;
@@ -1112,6 +1115,7 @@ function showShot(item, fresh = false) {
1112
  img.classList.toggle("checker", Boolean(item.trasparente));
1113
  if (img.complete && img.naturalWidth) img.onload();
1114
  $("#shot-bar").hidden = false;
 
1115
  $("#shot-prompt").textContent = titleOf(item);
1116
  $("#shot-prompt").title = item.prompt_finale || "";
1117
  $("#shot-meta").replaceChildren(...metaSpans(item));
@@ -1160,6 +1164,7 @@ function showCompare(items = state.batch, fresh = false) {
1160
  ]));
1161
  }
1162
  $("#shot-bar").hidden = false;
 
1163
  $("#act-back").hidden = true;
1164
  $("#shot-prompt").textContent = isView(items[0]) ? "La stessa figura da altre angolazioni" : titleOf(items[0]);
1165
  $("#shot-prompt").title = items[0].prompt_finale || "";
@@ -1213,6 +1218,7 @@ function clearStage() {
1213
  state.batch = [];
1214
  $("#stage").dataset.state = "vuoto";
1215
  $("#shot-bar").hidden = true;
 
1216
  }
1217
 
1218
  /* ---------- bozze ---------- */
@@ -2034,7 +2040,22 @@ function wire() {
2034
  });
2035
  }
2036
 
 
 
 
 
 
 
2037
  async function init() {
 
 
 
 
 
 
 
 
 
2038
  if (window.PixBackend) await window.PixBackend.ready;
2039
  wire();
2040
  const s = await refreshStatus();
 
1023
  const stage = $("#stage");
1024
  brush.stop();
1025
  stage.dataset.state = "lavoro";
1026
+ const bar = $("#shot-bar");
1027
+ bar.hidden = false;
1028
+ bar.dataset.working = "";
1029
+ $("#shot-prompt").textContent = job.request.prompt || MODE_LABEL[job.request.mode] || "";
1030
+ $("#shot-meta").replaceChildren(el("span", { text: "In lavorazione" }));
1031
  $("#base-bar").hidden = true;
 
1032
  const frame = $("#develop-frame");
1033
  frame.style.setProperty("--ar", String(job.width / job.height));
1034
  $("#develop-grain").style.backgroundImage = `url(${grainTile()})`;
 
1115
  img.classList.toggle("checker", Boolean(item.trasparente));
1116
  if (img.complete && img.naturalWidth) img.onload();
1117
  $("#shot-bar").hidden = false;
1118
+ delete $("#shot-bar").dataset.working;
1119
  $("#shot-prompt").textContent = titleOf(item);
1120
  $("#shot-prompt").title = item.prompt_finale || "";
1121
  $("#shot-meta").replaceChildren(...metaSpans(item));
 
1164
  ]));
1165
  }
1166
  $("#shot-bar").hidden = false;
1167
+ delete $("#shot-bar").dataset.working;
1168
  $("#act-back").hidden = true;
1169
  $("#shot-prompt").textContent = isView(items[0]) ? "La stessa figura da altre angolazioni" : titleOf(items[0]);
1170
  $("#shot-prompt").title = items[0].prompt_finale || "";
 
1218
  state.batch = [];
1219
  $("#stage").dataset.state = "vuoto";
1220
  $("#shot-bar").hidden = true;
1221
+ delete $("#shot-bar").dataset.working;
1222
  }
1223
 
1224
  /* ---------- bozze ---------- */
 
2040
  });
2041
  }
2042
 
2043
+ // Le viste restano invisibili finché non sono composte: niente salti di layout all'apertura.
2044
+ function reveal() {
2045
+ requestAnimationFrame(() => document.body.removeAttribute("data-booting"));
2046
+ }
2047
+ setTimeout(reveal, 8000);
2048
+
2049
  async function init() {
2050
+ try {
2051
+ await boot();
2052
+ } finally {
2053
+ await window.PixI18n?.ready?.catch(() => {});
2054
+ reveal();
2055
+ }
2056
+ }
2057
+
2058
+ async function boot() {
2059
  if (window.PixBackend) await window.PixBackend.ready;
2060
  wire();
2061
  const s = await refreshStatus();
web/i18n/en.json CHANGED
@@ -622,5 +622,6 @@
622
  "Per provarla online senza installare niente, PixRick si appoggia alle GPU gratuite di Hugging Face. Per questo ogni giorno hai un po' di tempo e un numero limitato di generazioni. Gratis, senza registrazione.": "To let you try it online without installing anything, PixRick runs on Hugging Face's free GPUs. That's why each day you get a little time and a limited number of generations. Free, no sign-up.",
623
  "Descrivi la scena: soggetto, ambiente, luce, stile. Il testo da scrivere nell'immagine va tra virgolette.": "Describe the scene: subject, place, light, style. Text to show inside the image goes in quotes.",
624
  "L'immagine è pronta ma il browser non è riuscito a salvarla. Riprova; se succede ancora, esci dalla navigazione privata.": "The image is ready but your browser couldn't save it. Try again; if it keeps happening, leave private browsing.",
625
- "Immagine non salvata": "Image not saved"
 
626
  }
 
622
  "Per provarla online senza installare niente, PixRick si appoggia alle GPU gratuite di Hugging Face. Per questo ogni giorno hai un po' di tempo e un numero limitato di generazioni. Gratis, senza registrazione.": "To let you try it online without installing anything, PixRick runs on Hugging Face's free GPUs. That's why each day you get a little time and a limited number of generations. Free, no sign-up.",
623
  "Descrivi la scena: soggetto, ambiente, luce, stile. Il testo da scrivere nell'immagine va tra virgolette.": "Describe the scene: subject, place, light, style. Text to show inside the image goes in quotes.",
624
  "L'immagine è pronta ma il browser non è riuscito a salvarla. Riprova; se succede ancora, esci dalla navigazione privata.": "The image is ready but your browser couldn't save it. Try again; if it keeps happening, leave private browsing.",
625
+ "Immagine non salvata": "Image not saved",
626
+ "In lavorazione": "In progress"
627
  }
web/index.html CHANGED
@@ -27,7 +27,7 @@
27
  <link rel="apple-touch-icon" href="/web/icons/apple-touch-icon.png">
28
  <link rel="manifest" href="/manifest.webmanifest">
29
  </head>
30
- <body data-view="studio" data-mode="crea">
31
  <svg class="sprite" aria-hidden="true">
32
  <symbol id="i-download" viewBox="0 0 24 24"><path d="M12 4v11m0 0-4.5-4.5M12 15l4.5-4.5M5 19h14"/></symbol>
33
  <symbol id="i-shuffle" viewBox="0 0 24 24"><path d="M4 7h3.5c2 0 3 1 4 3l1 2c1 2 2 3 4 3H20m0 0-2.5-2.5M20 15l-2.5 2.5M4 17h3.5c1.3 0 2.2-.4 2.9-1.2M20 7h-3.5c-1.3 0-2.2.4-2.9 1.2M20 7l-2.5-2.5M20 7l-2.5 2.5"/></symbol>
@@ -358,7 +358,7 @@
358
  <main class="poster" id="poster" hidden data-guide="locandina">
359
  <section class="poster-stage" id="poster-stage">
360
  <div class="poster-canvas-wrap" id="poster-wrap">
361
- <canvas id="poster-canvas" aria-label="Anteprima della locandina"></canvas>
362
  <div class="pp-overlay" id="pp-overlay" aria-hidden="true">
363
  <div class="pp-frame" id="pp-frame" hidden><span class="pp-handle"></span></div>
364
  </div>
 
27
  <link rel="apple-touch-icon" href="/web/icons/apple-touch-icon.png">
28
  <link rel="manifest" href="/manifest.webmanifest">
29
  </head>
30
+ <body data-view="studio" data-mode="crea" data-booting>
31
  <svg class="sprite" aria-hidden="true">
32
  <symbol id="i-download" viewBox="0 0 24 24"><path d="M12 4v11m0 0-4.5-4.5M12 15l4.5-4.5M5 19h14"/></symbol>
33
  <symbol id="i-shuffle" viewBox="0 0 24 24"><path d="M4 7h3.5c2 0 3 1 4 3l1 2c1 2 2 3 4 3H20m0 0-2.5-2.5M20 15l-2.5 2.5M4 17h3.5c1.3 0 2.2-.4 2.9-1.2M20 7h-3.5c-1.3 0-2.2.4-2.9 1.2M20 7l-2.5-2.5M20 7l-2.5 2.5"/></symbol>
 
358
  <main class="poster" id="poster" hidden data-guide="locandina">
359
  <section class="poster-stage" id="poster-stage">
360
  <div class="poster-canvas-wrap" id="poster-wrap">
361
+ <canvas id="poster-canvas" width="2000" height="3000" aria-label="Anteprima della locandina"></canvas>
362
  <div class="pp-overlay" id="pp-overlay" aria-hidden="true">
363
  <div class="pp-frame" id="pp-frame" hidden><span class="pp-handle"></span></div>
364
  </div>
web/poster.js CHANGED
@@ -1278,6 +1278,9 @@
1278
  window.PosterStudio = {
1279
  async show() {
1280
  wire();
 
 
 
1281
  await Promise.all([ensureFonts(), restore()]);
1282
  render();
1283
  },
 
1278
  window.PosterStudio = {
1279
  async show() {
1280
  wire();
1281
+ const [W, H] = FORMATS[S.format] || FORMATS["2:3"];
1282
+ const cv = canvas();
1283
+ if (cv.width !== W || cv.height !== H) { cv.width = W; cv.height = H; }
1284
  await Promise.all([ensureFonts(), restore()]);
1285
  render();
1286
  },
web/style.css CHANGED
@@ -363,6 +363,8 @@ kbd {
363
  .save-btn[data-saved="true"] { background: transparent; color: var(--ok); box-shadow: inset 0 0 0 1px rgba(127, 216, 166, 0.35); pointer-events: none; }
364
 
365
  .shot-actions.compare-actions { display: none; }
 
 
366
  .compare-hint { color: var(--faint); font-size: 12.5px; margin-right: 6px; }
367
  body[data-stage="confronto"] .shot-actions.compare-actions { display: flex; }
368
  body[data-stage="confronto"] .shot-actions.single-actions { display: none; }
@@ -562,7 +564,7 @@ body:not([data-mode="crea"]) .refs { display: flex; }
562
  #prompt:focus { outline: none; }
563
  #prompt::placeholder { color: var(--faint); }
564
 
565
- .composer-foot { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
566
  .pills { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
567
  .pill {
568
  display: inline-flex;
@@ -668,6 +670,7 @@ body:not([data-mode="crea"]) .refs { display: flex; }
668
  letter-spacing: 0.01em;
669
  }
670
  .panel-note { margin: 8px 0 0; color: var(--faint); font-size: 12px; }
 
671
  .row-head { display: flex; justify-content: space-between; align-items: baseline; }
672
  .row-head output { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
673
 
@@ -1947,7 +1950,7 @@ body[data-scope="cestino"] .selection-bar [data-scope]:not([data-scope="cestino"
1947
  .notice-actions { display: flex; align-items: center; gap: 4px; }
1948
  .notice-actions .detail-btn { height: 34px; padding: 0 12px; }
1949
  .notice-actions .icon-btn { width: 34px; height: 34px; border: 0; }
1950
- .composer-foot .error:not(:empty) { flex-basis: 100%; color: var(--muted); }
1951
  .composer-foot .error:not(:empty)::before { content: "→ "; color: var(--accent); }
1952
  @media (max-width: 760px) {
1953
  .notice { grid-template-columns: auto minmax(0, 1fr); padding-right: 44px; }
@@ -1955,3 +1958,8 @@ body[data-scope="cestino"] .selection-bar [data-scope]:not([data-scope="cestino"
1955
  .notice-actions:has(#notice-retry[hidden]) { display: contents; }
1956
  .notice-actions .icon-btn { position: absolute; top: 8px; right: 6px; }
1957
  }
 
 
 
 
 
 
363
  .save-btn[data-saved="true"] { background: transparent; color: var(--ok); box-shadow: inset 0 0 0 1px rgba(127, 216, 166, 0.35); pointer-events: none; }
364
 
365
  .shot-actions.compare-actions { display: none; }
366
+ #shot-bar[data-working] .shot-actions, #shot-bar[data-working] .back { visibility: hidden; }
367
+ #shot-bar[data-working] .shot-meta { color: var(--faint); }
368
  .compare-hint { color: var(--faint); font-size: 12.5px; margin-right: 6px; }
369
  body[data-stage="confronto"] .shot-actions.compare-actions { display: flex; }
370
  body[data-stage="confronto"] .shot-actions.single-actions { display: none; }
 
564
  #prompt:focus { outline: none; }
565
  #prompt::placeholder { color: var(--faint); }
566
 
567
+ .composer-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
568
  .pills { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
569
  .pill {
570
  display: inline-flex;
 
670
  letter-spacing: 0.01em;
671
  }
672
  .panel-note { margin: 8px 0 0; color: var(--faint); font-size: 12px; }
673
+ #pp-template-desc { min-height: 2.9em; }
674
  .row-head { display: flex; justify-content: space-between; align-items: baseline; }
675
  .row-head output { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
676
 
 
1950
  .notice-actions { display: flex; align-items: center; gap: 4px; }
1951
  .notice-actions .detail-btn { height: 34px; padding: 0 12px; }
1952
  .notice-actions .icon-btn { width: 34px; height: 34px; border: 0; }
1953
+ .composer-foot .error:not(:empty) { order: -1; flex-basis: 100%; color: var(--muted); }
1954
  .composer-foot .error:not(:empty)::before { content: "→ "; color: var(--accent); }
1955
  @media (max-width: 760px) {
1956
  .notice { grid-template-columns: auto minmax(0, 1fr); padding-right: 44px; }
 
1958
  .notice-actions:has(#notice-retry[hidden]) { display: contents; }
1959
  .notice-actions .icon-btn { position: absolute; top: 8px; right: 6px; }
1960
  }
1961
+
1962
+ /* Apertura: le viste compaiono già composte. */
1963
+ main { transition: opacity 0.2s ease, visibility 0s; }
1964
+ body[data-booting] main { opacity: 0; visibility: hidden; }
1965
+ @media (prefers-reduced-motion: reduce) { main { transition: none; } }
web/tips.js CHANGED
@@ -170,7 +170,7 @@ const tips = {
170
  show({ node, text, section }) {
171
  if (!node.isConnected) return;
172
  this.target = node;
173
- this.el.querySelector(".tip-text").textContent = text;
174
  this.el.dataset.guide = section || "";
175
  this.el.querySelector(".tip-more").hidden = !section;
176
  this.el.hidden = false;
 
170
  show({ node, text, section }) {
171
  if (!node.isConnected) return;
172
  this.target = node;
173
+ this.el.querySelector(".tip-text").textContent = window.PixI18n?.t ? window.PixI18n.t(text) : text;
174
  this.el.dataset.guide = section || "";
175
  this.el.querySelector(".tip-more").hidden = !section;
176
  this.el.hidden = false;