@wildwinter/app-shell 0.47.0 → 0.49.0
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/{chunk-FPXEQKWM.js → chunk-62KWJPRP.js} +4 -4
- package/dist/{chunk-FPXEQKWM.js.map → chunk-62KWJPRP.js.map} +1 -1
- package/dist/{chunk-NKL6DNBZ.js → chunk-C245WRPF.js} +4 -4
- package/dist/{chunk-NKL6DNBZ.js.map → chunk-C245WRPF.js.map} +1 -1
- package/dist/chunk-EAE7UWQ5.js +84 -0
- package/dist/chunk-EAE7UWQ5.js.map +1 -0
- package/dist/{chunk-IFWLNIBR.js → chunk-FGAPO4N5.js} +31 -15
- package/dist/chunk-FGAPO4N5.js.map +1 -0
- package/dist/{chunk-5SQHL4YV.js → chunk-OMG6A5YB.js} +3 -3
- package/dist/{chunk-5SQHL4YV.js.map → chunk-OMG6A5YB.js.map} +1 -1
- package/dist/{chunk-XXDJCOXN.js → chunk-UQTUCOGV.js} +3 -3
- package/dist/{chunk-XXDJCOXN.js.map → chunk-UQTUCOGV.js.map} +1 -1
- package/dist/{chunk-XR4DRDMA.js → chunk-VXEFIL43.js} +3 -3
- package/dist/{chunk-XR4DRDMA.js.map → chunk-VXEFIL43.js.map} +1 -1
- package/dist/{chunk-QLVBKME7.js → chunk-W4WC4FO5.js} +70 -26
- package/dist/chunk-W4WC4FO5.js.map +1 -0
- package/dist/{chunk-IK3LWBQL.js → chunk-XSS7KM6F.js} +4 -4
- package/dist/{chunk-IK3LWBQL.js.map → chunk-XSS7KM6F.js.map} +1 -1
- package/dist/context-menu.cjs.map +1 -1
- package/dist/context-menu.js +2 -2
- package/dist/controls.css +27 -0
- package/dist/controls.css.map +1 -1
- package/dist/dialog.cjs.map +1 -1
- package/dist/dialog.js +2 -2
- package/dist/index.cjs +178 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -5
- package/dist/index.d.ts +22 -5
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/kit-gallery.cjs.map +1 -1
- package/dist/kit-gallery.js +3 -3
- package/dist/link-status.cjs.map +1 -1
- package/dist/link-status.js +2 -2
- package/dist/{property-list-5mS4J2uy.d.cts → property-list-BPGU3rhF.d.cts} +29 -5
- package/dist/{property-list-5mS4J2uy.d.ts → property-list-BPGU3rhF.d.ts} +29 -5
- package/dist/property-list.cjs +120 -36
- package/dist/property-list.cjs.map +1 -1
- package/dist/property-list.d.cts +1 -1
- package/dist/property-list.d.ts +1 -1
- package/dist/property-list.js +3 -2
- package/dist/settings.css +24 -0
- package/dist/settings.css.map +1 -1
- package/dist/updater-view.cjs.map +1 -1
- package/dist/updater-view.js +3 -3
- package/dist/value-control.cjs +232 -0
- package/dist/value-control.cjs.map +1 -0
- package/dist/value-control.d.cts +52 -0
- package/dist/value-control.d.ts +52 -0
- package/dist/value-control.js +4 -0
- package/dist/value-control.js.map +1 -0
- package/dist/welcome.cjs.map +1 -1
- package/dist/welcome.js +4 -4
- package/package.json +6 -1
- package/dist/chunk-IFWLNIBR.js.map +0 -1
- package/dist/chunk-QLVBKME7.js.map +0 -1
package/dist/property-list.cjs
CHANGED
|
@@ -410,7 +410,7 @@ function tagChips(holder, onChange) {
|
|
|
410
410
|
wrap.append(input);
|
|
411
411
|
return wrap;
|
|
412
412
|
}
|
|
413
|
-
function stageChips(holder, onChange) {
|
|
413
|
+
function stageChips(holder, onChange, opts = {}) {
|
|
414
414
|
const wrap = el("div", "shell-tags shell-stages");
|
|
415
415
|
const input = el("input", "shell-tag-input");
|
|
416
416
|
input.type = "text";
|
|
@@ -425,35 +425,79 @@ function stageChips(holder, onChange) {
|
|
|
425
425
|
b.addEventListener("click", onClick);
|
|
426
426
|
return b;
|
|
427
427
|
};
|
|
428
|
+
const nameLabel = (chip, v, i) => {
|
|
429
|
+
const label = el("span", "shell-tag-label", `${i + 1}. ${v}`);
|
|
430
|
+
label.setAttribute("role", "button");
|
|
431
|
+
label.tabIndex = 0;
|
|
432
|
+
label.dataset["tip"] = `Rename ${v}`;
|
|
433
|
+
const edit = () => {
|
|
434
|
+
const field = el("input", "shell-tag-input shell-stage-rename");
|
|
435
|
+
field.type = "text";
|
|
436
|
+
field.value = v;
|
|
437
|
+
field.spellcheck = false;
|
|
438
|
+
field.setAttribute("aria-label", `Rename ${v}`);
|
|
439
|
+
let done = false;
|
|
440
|
+
const finish = (keep) => {
|
|
441
|
+
if (done) return;
|
|
442
|
+
done = true;
|
|
443
|
+
const to = field.value.trim();
|
|
444
|
+
const stages = holder.stages ?? [];
|
|
445
|
+
if (keep && to !== "" && to !== v && !stages.includes(to)) {
|
|
446
|
+
stages[stages.indexOf(v)] = to;
|
|
447
|
+
rebuild();
|
|
448
|
+
if (opts.onRename) opts.onRename(v, to);
|
|
449
|
+
else onChange?.();
|
|
450
|
+
} else {
|
|
451
|
+
rebuild();
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
field.addEventListener("keydown", (e) => {
|
|
455
|
+
if (e.key === "Enter") {
|
|
456
|
+
e.preventDefault();
|
|
457
|
+
finish(true);
|
|
458
|
+
} else if (e.key === "Escape") {
|
|
459
|
+
e.preventDefault();
|
|
460
|
+
e.stopPropagation();
|
|
461
|
+
finish(false);
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
field.addEventListener("blur", () => finish(true));
|
|
465
|
+
label.replaceWith(field);
|
|
466
|
+
chip.classList.add("editing");
|
|
467
|
+
field.focus();
|
|
468
|
+
field.select();
|
|
469
|
+
};
|
|
470
|
+
label.addEventListener("click", (e) => {
|
|
471
|
+
e.preventDefault();
|
|
472
|
+
edit();
|
|
473
|
+
});
|
|
474
|
+
label.addEventListener("keydown", (e) => {
|
|
475
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
476
|
+
e.preventDefault();
|
|
477
|
+
edit();
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
return label;
|
|
481
|
+
};
|
|
482
|
+
const moved = () => {
|
|
483
|
+
rebuild();
|
|
484
|
+
onChange?.();
|
|
485
|
+
opts.onReorder?.();
|
|
486
|
+
};
|
|
428
487
|
const rebuild = () => {
|
|
429
488
|
for (const c of Array.from(wrap.children)) if (c !== input) c.remove();
|
|
430
489
|
const stages = holder.stages ?? [];
|
|
431
490
|
stages.forEach((v, i) => {
|
|
432
|
-
const chip = el("span", "shell-tag"
|
|
491
|
+
const chip = el("span", "shell-tag");
|
|
433
492
|
chip.dataset["stage"] = v;
|
|
434
493
|
chip.append(
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
onChange?.();
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
),
|
|
446
|
-
control(
|
|
447
|
-
"forward",
|
|
448
|
-
`Move ${v} later`,
|
|
449
|
-
i === stages.length - 1,
|
|
450
|
-
() => {
|
|
451
|
-
if (moveItem(stages, i, 1)) {
|
|
452
|
-
rebuild();
|
|
453
|
-
onChange?.();
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
)
|
|
494
|
+
nameLabel(chip, v, i),
|
|
495
|
+
control("back", `Move ${v} earlier`, i === 0, () => {
|
|
496
|
+
if (moveItem(stages, i, -1)) moved();
|
|
497
|
+
}),
|
|
498
|
+
control("forward", `Move ${v} later`, i === stages.length - 1, () => {
|
|
499
|
+
if (moveItem(stages, i, 1)) moved();
|
|
500
|
+
})
|
|
457
501
|
);
|
|
458
502
|
const x = el("button", "shell-tag-x", iconNode("close", CHIP_ICON));
|
|
459
503
|
x.type = "button";
|
|
@@ -627,6 +671,31 @@ function firstIllegalPropertyName(host) {
|
|
|
627
671
|
return host.querySelector("input.illegal");
|
|
628
672
|
}
|
|
629
673
|
|
|
674
|
+
// src/value-control.ts
|
|
675
|
+
function fallbackText(decl) {
|
|
676
|
+
const d = decl.default;
|
|
677
|
+
if (d !== void 0 && d !== null) {
|
|
678
|
+
if (typeof d === "boolean") return d ? "True" : "False";
|
|
679
|
+
if (Array.isArray(d)) return d.length === 0 ? "none" : d.join(", ");
|
|
680
|
+
return d === "" ? "none" : String(d);
|
|
681
|
+
}
|
|
682
|
+
switch (decl.type) {
|
|
683
|
+
case "boolean":
|
|
684
|
+
return "False";
|
|
685
|
+
case "number":
|
|
686
|
+
return "0";
|
|
687
|
+
case "enum":
|
|
688
|
+
return decl.values?.[0] ?? "none";
|
|
689
|
+
case "quality":
|
|
690
|
+
return decl.stages?.[0] ?? "first stage";
|
|
691
|
+
case "flags":
|
|
692
|
+
return "none";
|
|
693
|
+
default:
|
|
694
|
+
return "empty";
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
var defaultLabel = (decl) => `default (${fallbackText(decl)})`;
|
|
698
|
+
|
|
630
699
|
// src/property-list.ts
|
|
631
700
|
var PROPERTY_TYPES = [
|
|
632
701
|
["number", "Number"],
|
|
@@ -642,35 +711,37 @@ var option = (value, label, selected) => {
|
|
|
642
711
|
o.selected = selected;
|
|
643
712
|
return o;
|
|
644
713
|
};
|
|
645
|
-
var
|
|
714
|
+
var NONE_CHOSEN = "\0none";
|
|
646
715
|
function defaultControl(p, onChange, opts = {}) {
|
|
647
716
|
const typed = opts.typed === true;
|
|
648
717
|
const write = (raw) => {
|
|
649
|
-
if (raw === "")
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
} else if (typed && p.type === "boolean") p.default = raw === "true";
|
|
718
|
+
if (raw === "") delete p.default;
|
|
719
|
+
else if (raw === NONE_CHOSEN) p.default = "";
|
|
720
|
+
else if (typed && p.type === "boolean") p.default = raw === "true";
|
|
653
721
|
else if (typed && p.type === "number") p.default = Number(raw);
|
|
654
722
|
else p.default = raw;
|
|
655
723
|
onChange?.();
|
|
656
724
|
};
|
|
657
725
|
const current = p.default === void 0 || p.default === null ? "" : String(p.default);
|
|
726
|
+
const unsetLabel = opts.unsetLabel ?? defaultLabel({ ...p, default: void 0 });
|
|
658
727
|
if (p.type === "boolean") {
|
|
659
728
|
const sel = el("select", "field set-default");
|
|
660
|
-
sel.append(option("",
|
|
729
|
+
sel.append(option("", unsetLabel, current === ""), option("true", "True", current === "true"), option("false", "False", current === "false"));
|
|
661
730
|
sel.addEventListener("change", () => write(sel.value));
|
|
662
731
|
return sel;
|
|
663
732
|
}
|
|
664
733
|
if (p.type === "enum") {
|
|
665
734
|
const sel = el("select", "field set-default");
|
|
666
|
-
|
|
735
|
+
const none = opts.noneChosen === true && p.default === "";
|
|
736
|
+
sel.append(option("", unsetLabel, current === "" && !none));
|
|
737
|
+
if (opts.noneChosen) sel.append(option(NONE_CHOSEN, "(none)", none));
|
|
667
738
|
for (const v of p.values ?? []) sel.append(option(v, v, current === v));
|
|
668
739
|
sel.addEventListener("change", () => write(sel.value));
|
|
669
740
|
return sel;
|
|
670
741
|
}
|
|
671
742
|
if (p.type === "quality") {
|
|
672
743
|
const sel = el("select", "field set-default");
|
|
673
|
-
sel.append(option("",
|
|
744
|
+
sel.append(option("", unsetLabel, current === ""));
|
|
674
745
|
for (const v of p.stages ?? []) sel.append(option(v, v, current === v));
|
|
675
746
|
sel.addEventListener("change", () => write(sel.value));
|
|
676
747
|
return sel;
|
|
@@ -682,7 +753,7 @@ function defaultControl(p, onChange, opts = {}) {
|
|
|
682
753
|
}
|
|
683
754
|
const input = el("input", "field set-default");
|
|
684
755
|
input.type = p.type === "number" ? "number" : "text";
|
|
685
|
-
input.placeholder = "Default";
|
|
756
|
+
input.placeholder = p.type === "number" ? `Default (${fallbackText({ type: "number" })})` : "Default";
|
|
686
757
|
input.value = current;
|
|
687
758
|
input.addEventListener("input", () => write(input.value));
|
|
688
759
|
return input;
|
|
@@ -709,8 +780,7 @@ function mountPropertyList(host, decls, opts = {}) {
|
|
|
709
780
|
for (const [v, label] of types) type.append(option(v, label, v === p.type));
|
|
710
781
|
type.addEventListener("change", () => {
|
|
711
782
|
p.type = type.value;
|
|
712
|
-
|
|
713
|
-
else p.default = "";
|
|
783
|
+
delete p.default;
|
|
714
784
|
if (p.type === "enum" || p.type === "flags") p.values ??= [];
|
|
715
785
|
else delete p.values;
|
|
716
786
|
if (p.type === "quality") p.stages ??= [];
|
|
@@ -744,7 +814,21 @@ function mountPropertyList(host, decls, opts = {}) {
|
|
|
744
814
|
}, false, true);
|
|
745
815
|
const details = keep(opts.extraDetails?.(p, i));
|
|
746
816
|
if (p.type === "enum" || p.type === "flags") details.push(labelled("Values", tagChips(p, refreshDefault)));
|
|
747
|
-
if (p.type === "quality")
|
|
817
|
+
if (p.type === "quality") {
|
|
818
|
+
const note = el("p", "shell-stage-note");
|
|
819
|
+
const stages = stageChips(p, refreshDefault, {
|
|
820
|
+
onRename: (from, to) => {
|
|
821
|
+
if (p.default === from) p.default = to;
|
|
822
|
+
const fresh = defaultControl(p, changed, opts);
|
|
823
|
+
def.replaceWith(fresh);
|
|
824
|
+
def = fresh;
|
|
825
|
+
if (opts.onStageRename) opts.onStageRename(p, from, to);
|
|
826
|
+
else changed();
|
|
827
|
+
},
|
|
828
|
+
onReorder: () => opts.onStageReorder?.(p, note)
|
|
829
|
+
});
|
|
830
|
+
details.push(labelled("Stages (in order)", stages), note);
|
|
831
|
+
}
|
|
748
832
|
if (opts.purpose !== false) {
|
|
749
833
|
const purpose = el("input", "field set-purpose");
|
|
750
834
|
purpose.type = "text";
|