uivisor 0.1.8 → 0.1.9
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/dist/overlay/index.js +19 -15
- package/package.json +1 -1
package/dist/overlay/index.js
CHANGED
|
@@ -410,7 +410,8 @@ var ICONS = {
|
|
|
410
410
|
phone: sv('<rect x="5" y="1.8" width="6" height="12.4" rx="1.6"/><path d="M7 12.4h2"/>'),
|
|
411
411
|
tablet: sv('<rect x="3.3" y="2.2" width="9.4" height="11.6" rx="1.6"/><path d="M7 11.7h2"/>'),
|
|
412
412
|
desktop: sv('<rect x="1.8" y="2.8" width="12.4" height="8" rx="1"/><path d="M5.8 14h4.4 M8 10.8v3.2"/>'),
|
|
413
|
-
live: sv('<circle cx="8" cy="8" r="2"/><path d="M4.6 4.6a4.8 4.8 0 0 0 0 6.8 M11.4 4.6a4.8 4.8 0 0 1 0 6.8"/>')
|
|
413
|
+
live: sv('<circle cx="8" cy="8" r="2"/><path d="M4.6 4.6a4.8 4.8 0 0 0 0 6.8 M11.4 4.6a4.8 4.8 0 0 1 0 6.8"/>'),
|
|
414
|
+
all: sv('<path d="M8 2.5v11 M3.2 5.2l9.6 5.6 M12.8 5.2l-9.6 5.6"/>')
|
|
414
415
|
};
|
|
415
416
|
var SECTIONS = [
|
|
416
417
|
{
|
|
@@ -1696,7 +1697,7 @@ var Uivisor = class {
|
|
|
1696
1697
|
const host = this.q(".uiv-framehost");
|
|
1697
1698
|
host.style.width = `${this.frameWidth}px`;
|
|
1698
1699
|
const bp = activeBreakpoint(this.frameWidth, this.bpSystem()).name;
|
|
1699
|
-
this.q(".uiv-framew").textContent = `${this.frameWidth}px \xB7 ${bp}`;
|
|
1700
|
+
this.q(".uiv-framew").textContent = `${this.frameWidth}px \xB7 ${this.bpLabel(bp)}`;
|
|
1700
1701
|
this.updateBp();
|
|
1701
1702
|
this.reposition();
|
|
1702
1703
|
}
|
|
@@ -2115,7 +2116,7 @@ var Uivisor = class {
|
|
|
2115
2116
|
/** A control's label, with an "inherited from {bp}" badge when the value cascaded. */
|
|
2116
2117
|
ctlLabel(label, props) {
|
|
2117
2118
|
const from = this.inheritedFrom(props);
|
|
2118
|
-
const badge = from ? ` <span class="uiv-inh" title="inherited from ${escapeAttr(from)} \u2014 not set at this breakpoint">\u2923${escapeHtml(from)}</span>` : "";
|
|
2119
|
+
const badge = from ? ` <span class="uiv-inh" title="inherited from ${escapeAttr(this.bpLabel(from))} \u2014 not set at this breakpoint">\u2923${escapeHtml(this.bpLabel(from))}</span>` : "";
|
|
2119
2120
|
return `<span class="clabel">${label}${badge}</span>`;
|
|
2120
2121
|
}
|
|
2121
2122
|
/** Is any of `props` authored in the project CSS? For inherited properties we
|
|
@@ -2250,29 +2251,32 @@ var Uivisor = class {
|
|
|
2250
2251
|
const items = collapsed ? "" : rows.map((r) => `<div class="uiv-rrow"><span class="uiv-rk">${r.k}</span><span class="uiv-rv">${r.v}</span></div>`).join("");
|
|
2251
2252
|
return `<div class="uiv-sec">${this.accordionTitle("Current styles")}<div class="uiv-readout">${items}</div></div>`;
|
|
2252
2253
|
}
|
|
2254
|
+
/** Display label for a breakpoint name — the unprefixed "base" scope reads "all"
|
|
2255
|
+
* (applies to every size by default); internal key stays "base". */
|
|
2256
|
+
bpLabel(name) {
|
|
2257
|
+
return name === "base" ? "all" : name;
|
|
2258
|
+
}
|
|
2253
2259
|
/** A device icon for a breakpoint chip, by its threshold (size proxy). */
|
|
2254
2260
|
bpIcon(name) {
|
|
2255
2261
|
if (name === "live") return ICONS.live;
|
|
2256
|
-
|
|
2262
|
+
if (name === "base") return ICONS.all;
|
|
2263
|
+
const px2 = this.bpSystem().breakpoints.find((b) => b.name === name)?.minWidth ?? 0;
|
|
2257
2264
|
if (px2 < 768) return ICONS.phone;
|
|
2258
2265
|
if (px2 < 1024) return ICONS.tablet;
|
|
2259
2266
|
return ICONS.desktop;
|
|
2260
2267
|
}
|
|
2261
|
-
/** Breakpoint chips
|
|
2262
|
-
* the panel (Live
|
|
2268
|
+
/** Breakpoint chips with icons. Order: "all" (base, the default) → Live → each
|
|
2269
|
+
* project breakpoint. Reused by the panel (Live) and the over-frame bar. */
|
|
2263
2270
|
breakpointChipsHtml() {
|
|
2264
2271
|
const sys = this.bpSystem();
|
|
2265
|
-
const names = ["base", ...sys.breakpoints.map((b) => b.name)];
|
|
2266
2272
|
const frameBp = this.responsive ? activeBreakpoint(this.frameWidth, sys).name : null;
|
|
2267
2273
|
const winBp = currentBreakpoint(sys).name;
|
|
2268
|
-
const
|
|
2274
|
+
const isActive = (n) => this.responsive ? n === frameBp : n === winBp;
|
|
2275
|
+
const chip = (n, on, title) => `<button class="uiv-chip${on ? " on" : ""}" data-bp="${n}" title="${escapeAttr(title)}">${this.bpIcon(n)}<span>${n === "live" ? "Live" : this.bpLabel(n)}</span></button>`;
|
|
2276
|
+
const all = chip("base", isActive("base"), "No breakpoint \u2014 applies to every size by default");
|
|
2269
2277
|
const live = chip("live", !this.responsive, "Follow your real browser window");
|
|
2270
|
-
const
|
|
2271
|
-
|
|
2272
|
-
const px2 = n === "base" ? 0 : sys.breakpoints.find((b) => b.name === n).minWidth;
|
|
2273
|
-
return chip(n, active, sys.dir === "min" ? `\u2265 ${px2}px` : `\u2264 ${px2}px`);
|
|
2274
|
-
}).join("");
|
|
2275
|
-
return live + chips;
|
|
2278
|
+
const rest = sys.breakpoints.map((b) => chip(b.name, isActive(b.name), sys.dir === "min" ? `\u2265 ${b.minWidth}px` : `\u2264 ${b.minWidth}px`)).join("");
|
|
2279
|
+
return all + live + rest;
|
|
2276
2280
|
}
|
|
2277
2281
|
/** Panel breakpoint bar — shown only in Live mode (in responsive mode the bar
|
|
2278
2282
|
* lives over the virtual screen instead). */
|
|
@@ -2283,7 +2287,7 @@ var Uivisor = class {
|
|
|
2283
2287
|
const liveW = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
2284
2288
|
const detected = sys.name === "detected" ? "" : " (defaults)";
|
|
2285
2289
|
const cascade = sys.dir === "min" ? `Mobile-first: an edit applies to this breakpoint and <b>wider</b>.` : `Desktop-first: an edit applies to this breakpoint and <b>narrower</b>.`;
|
|
2286
|
-
const hint = `Live \u2014 window <b>${liveW}px</b> = <b>${winBp}</b>. ${cascade} Click a size to shrink the screen.`;
|
|
2290
|
+
const hint = `Live \u2014 window <b>${liveW}px</b> = <b>${this.bpLabel(winBp)}</b>. ${cascade} Click a size to shrink the screen.`;
|
|
2287
2291
|
return `<div class="uiv-sec"><div class="uiv-sectitle">Screen / breakpoint${detected}</div><div class="uiv-chips">${this.breakpointChipsHtml()}</div><div class="uiv-bphint">${hint}</div></div>`;
|
|
2288
2292
|
}
|
|
2289
2293
|
/** Populate the bar over the virtual screen (responsive mode) with the chips. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uivisor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dev-only visual UI tweaker that turns mouse edits into a precise, breakpoint-aware prompt for your AI coding agent — without touching your source.",
|
|
6
6
|
"license": "MIT",
|