@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.
Files changed (56) hide show
  1. package/dist/{chunk-FPXEQKWM.js → chunk-62KWJPRP.js} +4 -4
  2. package/dist/{chunk-FPXEQKWM.js.map → chunk-62KWJPRP.js.map} +1 -1
  3. package/dist/{chunk-NKL6DNBZ.js → chunk-C245WRPF.js} +4 -4
  4. package/dist/{chunk-NKL6DNBZ.js.map → chunk-C245WRPF.js.map} +1 -1
  5. package/dist/chunk-EAE7UWQ5.js +84 -0
  6. package/dist/chunk-EAE7UWQ5.js.map +1 -0
  7. package/dist/{chunk-IFWLNIBR.js → chunk-FGAPO4N5.js} +31 -15
  8. package/dist/chunk-FGAPO4N5.js.map +1 -0
  9. package/dist/{chunk-5SQHL4YV.js → chunk-OMG6A5YB.js} +3 -3
  10. package/dist/{chunk-5SQHL4YV.js.map → chunk-OMG6A5YB.js.map} +1 -1
  11. package/dist/{chunk-XXDJCOXN.js → chunk-UQTUCOGV.js} +3 -3
  12. package/dist/{chunk-XXDJCOXN.js.map → chunk-UQTUCOGV.js.map} +1 -1
  13. package/dist/{chunk-XR4DRDMA.js → chunk-VXEFIL43.js} +3 -3
  14. package/dist/{chunk-XR4DRDMA.js.map → chunk-VXEFIL43.js.map} +1 -1
  15. package/dist/{chunk-QLVBKME7.js → chunk-W4WC4FO5.js} +70 -26
  16. package/dist/chunk-W4WC4FO5.js.map +1 -0
  17. package/dist/{chunk-IK3LWBQL.js → chunk-XSS7KM6F.js} +4 -4
  18. package/dist/{chunk-IK3LWBQL.js.map → chunk-XSS7KM6F.js.map} +1 -1
  19. package/dist/context-menu.cjs.map +1 -1
  20. package/dist/context-menu.js +2 -2
  21. package/dist/controls.css +27 -0
  22. package/dist/controls.css.map +1 -1
  23. package/dist/dialog.cjs.map +1 -1
  24. package/dist/dialog.js +2 -2
  25. package/dist/index.cjs +178 -36
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +22 -5
  28. package/dist/index.d.ts +22 -5
  29. package/dist/index.js +11 -10
  30. package/dist/index.js.map +1 -1
  31. package/dist/kit-gallery.cjs.map +1 -1
  32. package/dist/kit-gallery.js +3 -3
  33. package/dist/link-status.cjs.map +1 -1
  34. package/dist/link-status.js +2 -2
  35. package/dist/{property-list-5mS4J2uy.d.cts → property-list-BPGU3rhF.d.cts} +29 -5
  36. package/dist/{property-list-5mS4J2uy.d.ts → property-list-BPGU3rhF.d.ts} +29 -5
  37. package/dist/property-list.cjs +120 -36
  38. package/dist/property-list.cjs.map +1 -1
  39. package/dist/property-list.d.cts +1 -1
  40. package/dist/property-list.d.ts +1 -1
  41. package/dist/property-list.js +3 -2
  42. package/dist/settings.css +24 -0
  43. package/dist/settings.css.map +1 -1
  44. package/dist/updater-view.cjs.map +1 -1
  45. package/dist/updater-view.js +3 -3
  46. package/dist/value-control.cjs +232 -0
  47. package/dist/value-control.cjs.map +1 -0
  48. package/dist/value-control.d.cts +52 -0
  49. package/dist/value-control.d.ts +52 -0
  50. package/dist/value-control.js +4 -0
  51. package/dist/value-control.js.map +1 -0
  52. package/dist/welcome.cjs.map +1 -1
  53. package/dist/welcome.js +4 -4
  54. package/package.json +6 -1
  55. package/dist/chunk-IFWLNIBR.js.map +0 -1
  56. package/dist/chunk-QLVBKME7.js.map +0 -1
package/dist/dialog.js CHANGED
@@ -1,5 +1,5 @@
1
- export { dialogFrame } from './chunk-XR4DRDMA.js';
2
- import './chunk-QLVBKME7.js';
1
+ export { dialogFrame } from './chunk-VXEFIL43.js';
2
+ import './chunk-W4WC4FO5.js';
3
3
  import './chunk-IU7EY6BI.js';
4
4
  //# sourceMappingURL=dialog.js.map
5
5
  //# sourceMappingURL=dialog.js.map
package/dist/index.cjs CHANGED
@@ -464,7 +464,7 @@ function tagChips(holder, onChange) {
464
464
  wrap.append(input);
465
465
  return wrap;
466
466
  }
467
- function stageChips(holder, onChange) {
467
+ function stageChips(holder, onChange, opts = {}) {
468
468
  const wrap = el("div", "shell-tags shell-stages");
469
469
  const input = el("input", "shell-tag-input");
470
470
  input.type = "text";
@@ -479,35 +479,79 @@ function stageChips(holder, onChange) {
479
479
  b.addEventListener("click", onClick);
480
480
  return b;
481
481
  };
482
+ const nameLabel = (chip2, v, i) => {
483
+ const label2 = el("span", "shell-tag-label", `${i + 1}. ${v}`);
484
+ label2.setAttribute("role", "button");
485
+ label2.tabIndex = 0;
486
+ label2.dataset["tip"] = `Rename ${v}`;
487
+ const edit = () => {
488
+ const field = el("input", "shell-tag-input shell-stage-rename");
489
+ field.type = "text";
490
+ field.value = v;
491
+ field.spellcheck = false;
492
+ field.setAttribute("aria-label", `Rename ${v}`);
493
+ let done = false;
494
+ const finish = (keep) => {
495
+ if (done) return;
496
+ done = true;
497
+ const to = field.value.trim();
498
+ const stages = holder.stages ?? [];
499
+ if (keep && to !== "" && to !== v && !stages.includes(to)) {
500
+ stages[stages.indexOf(v)] = to;
501
+ rebuild();
502
+ if (opts.onRename) opts.onRename(v, to);
503
+ else onChange?.();
504
+ } else {
505
+ rebuild();
506
+ }
507
+ };
508
+ field.addEventListener("keydown", (e) => {
509
+ if (e.key === "Enter") {
510
+ e.preventDefault();
511
+ finish(true);
512
+ } else if (e.key === "Escape") {
513
+ e.preventDefault();
514
+ e.stopPropagation();
515
+ finish(false);
516
+ }
517
+ });
518
+ field.addEventListener("blur", () => finish(true));
519
+ label2.replaceWith(field);
520
+ chip2.classList.add("editing");
521
+ field.focus();
522
+ field.select();
523
+ };
524
+ label2.addEventListener("click", (e) => {
525
+ e.preventDefault();
526
+ edit();
527
+ });
528
+ label2.addEventListener("keydown", (e) => {
529
+ if (e.key === "Enter" || e.key === " ") {
530
+ e.preventDefault();
531
+ edit();
532
+ }
533
+ });
534
+ return label2;
535
+ };
536
+ const moved = () => {
537
+ rebuild();
538
+ onChange?.();
539
+ opts.onReorder?.();
540
+ };
482
541
  const rebuild = () => {
483
542
  for (const c of Array.from(wrap.children)) if (c !== input) c.remove();
484
543
  const stages = holder.stages ?? [];
485
544
  stages.forEach((v, i) => {
486
- const chip2 = el("span", "shell-tag", `${i + 1}. ${v}`);
545
+ const chip2 = el("span", "shell-tag");
487
546
  chip2.dataset["stage"] = v;
488
547
  chip2.append(
489
- control(
490
- "back",
491
- `Move ${v} earlier`,
492
- i === 0,
493
- () => {
494
- if (moveItem(stages, i, -1)) {
495
- rebuild();
496
- onChange?.();
497
- }
498
- }
499
- ),
500
- control(
501
- "forward",
502
- `Move ${v} later`,
503
- i === stages.length - 1,
504
- () => {
505
- if (moveItem(stages, i, 1)) {
506
- rebuild();
507
- onChange?.();
508
- }
509
- }
510
- )
548
+ nameLabel(chip2, v, i),
549
+ control("back", `Move ${v} earlier`, i === 0, () => {
550
+ if (moveItem(stages, i, -1)) moved();
551
+ }),
552
+ control("forward", `Move ${v} later`, i === stages.length - 1, () => {
553
+ if (moveItem(stages, i, 1)) moved();
554
+ })
511
555
  );
512
556
  const x = el("button", "shell-tag-x", iconNode("close", CHIP_ICON));
513
557
  x.type = "button";
@@ -3076,6 +3120,85 @@ function mountLinkStatus(host, opts) {
3076
3120
  };
3077
3121
  }
3078
3122
 
3123
+ // src/value-control.ts
3124
+ function fallbackText(decl) {
3125
+ const d = decl.default;
3126
+ if (d !== void 0 && d !== null) {
3127
+ if (typeof d === "boolean") return d ? "True" : "False";
3128
+ if (Array.isArray(d)) return d.length === 0 ? "none" : d.join(", ");
3129
+ return d === "" ? "none" : String(d);
3130
+ }
3131
+ switch (decl.type) {
3132
+ case "boolean":
3133
+ return "False";
3134
+ case "number":
3135
+ return "0";
3136
+ case "enum":
3137
+ return decl.values?.[0] ?? "none";
3138
+ case "quality":
3139
+ return decl.stages?.[0] ?? "first stage";
3140
+ case "flags":
3141
+ return "none";
3142
+ default:
3143
+ return "empty";
3144
+ }
3145
+ }
3146
+ var defaultLabel = (decl) => `default (${fallbackText(decl)})`;
3147
+ function stageGateNote(gates) {
3148
+ if (gates <= 0) return "";
3149
+ return gates === 1 ? "1 gate compares against this ladder, and it now reads the new order." : `${gates} gates compare against this ladder, and each now reads the new order.`;
3150
+ }
3151
+ function rungStrip(opts) {
3152
+ const make = opts.doc === void 0 ? el : (tag, props) => {
3153
+ const node2 = opts.doc.createElement(tag);
3154
+ node2.className = props.className;
3155
+ if (props.text !== void 0) node2.textContent = props.text;
3156
+ if (props.tip !== void 0) {
3157
+ node2.title = props.tip;
3158
+ node2.setAttribute("aria-label", props.tip);
3159
+ }
3160
+ if (props.onClick) node2.addEventListener("click", props.onClick);
3161
+ if (tag === "button") node2.type = "button";
3162
+ return node2;
3163
+ };
3164
+ const strip = make("span", { className: "seg shell-rungs" });
3165
+ const decl = opts.decl ?? { type: "quality", stages: opts.stages };
3166
+ const unset = opts.value === void 0;
3167
+ const fallback = typeof decl.default === "string" && opts.stages.includes(decl.default) ? decl.default : opts.stages[0];
3168
+ const readOnly = opts.onPick === void 0;
3169
+ if (opts.onClear) {
3170
+ strip.append(make("button", {
3171
+ className: `seg-opt shell-rung shell-rung-default${unset ? " on" : ""}`,
3172
+ text: defaultLabel(decl),
3173
+ tip: unset ? "Not set here: the declared default holds" : "Clear the value, back to the default",
3174
+ onClick: () => {
3175
+ if (!unset) opts.onClear();
3176
+ }
3177
+ }));
3178
+ }
3179
+ for (const stage of opts.stages) {
3180
+ const current3 = opts.value === stage;
3181
+ const falls = unset && stage === fallback;
3182
+ const rung = make(readOnly ? "span" : "button", {
3183
+ className: `seg-opt shell-rung${current3 ? " on" : ""}${falls ? " fallback" : ""}`,
3184
+ text: stage,
3185
+ tip: current3 ? "The current stage" : falls ? "The stage it falls back to" : readOnly ? stage : opts.pickTip?.(stage) ?? `Set to "${stage}"`,
3186
+ ...readOnly ? {} : { onClick: () => {
3187
+ if (!current3) opts.onPick(stage);
3188
+ } }
3189
+ });
3190
+ strip.append(rung);
3191
+ }
3192
+ if (!unset && !opts.stages.includes(opts.value)) {
3193
+ strip.append(make("span", {
3194
+ className: "seg-opt shell-rung stray on",
3195
+ text: opts.value,
3196
+ tip: `"${opts.value}" is not one of the stages: pick the one it belongs at now`
3197
+ }));
3198
+ }
3199
+ return strip;
3200
+ }
3201
+
3079
3202
  // src/property-list.ts
3080
3203
  var PROPERTY_TYPES = [
3081
3204
  ["number", "Number"],
@@ -3091,35 +3214,37 @@ var option = (value, label2, selected) => {
3091
3214
  o.selected = selected;
3092
3215
  return o;
3093
3216
  };
3094
- var NONE = "(none)";
3217
+ var NONE_CHOSEN = "\0none";
3095
3218
  function defaultControl(p, onChange, opts = {}) {
3096
3219
  const typed = opts.typed === true;
3097
3220
  const write = (raw) => {
3098
- if (raw === "") {
3099
- if (typed) delete p.default;
3100
- else p.default = "";
3101
- } else if (typed && p.type === "boolean") p.default = raw === "true";
3221
+ if (raw === "") delete p.default;
3222
+ else if (raw === NONE_CHOSEN) p.default = "";
3223
+ else if (typed && p.type === "boolean") p.default = raw === "true";
3102
3224
  else if (typed && p.type === "number") p.default = Number(raw);
3103
3225
  else p.default = raw;
3104
3226
  onChange?.();
3105
3227
  };
3106
3228
  const current3 = p.default === void 0 || p.default === null ? "" : String(p.default);
3229
+ const unsetLabel = opts.unsetLabel ?? defaultLabel({ ...p, default: void 0 });
3107
3230
  if (p.type === "boolean") {
3108
3231
  const sel = el("select", "field set-default");
3109
- sel.append(option("", NONE, current3 === ""), option("true", "True", current3 === "true"), option("false", "False", current3 === "false"));
3232
+ sel.append(option("", unsetLabel, current3 === ""), option("true", "True", current3 === "true"), option("false", "False", current3 === "false"));
3110
3233
  sel.addEventListener("change", () => write(sel.value));
3111
3234
  return sel;
3112
3235
  }
3113
3236
  if (p.type === "enum") {
3114
3237
  const sel = el("select", "field set-default");
3115
- sel.append(option("", NONE, current3 === ""));
3238
+ const none = opts.noneChosen === true && p.default === "";
3239
+ sel.append(option("", unsetLabel, current3 === "" && !none));
3240
+ if (opts.noneChosen) sel.append(option(NONE_CHOSEN, "(none)", none));
3116
3241
  for (const v of p.values ?? []) sel.append(option(v, v, current3 === v));
3117
3242
  sel.addEventListener("change", () => write(sel.value));
3118
3243
  return sel;
3119
3244
  }
3120
3245
  if (p.type === "quality") {
3121
3246
  const sel = el("select", "field set-default");
3122
- sel.append(option("", "(first stage)", current3 === ""));
3247
+ sel.append(option("", unsetLabel, current3 === ""));
3123
3248
  for (const v of p.stages ?? []) sel.append(option(v, v, current3 === v));
3124
3249
  sel.addEventListener("change", () => write(sel.value));
3125
3250
  return sel;
@@ -3131,7 +3256,7 @@ function defaultControl(p, onChange, opts = {}) {
3131
3256
  }
3132
3257
  const input = el("input", "field set-default");
3133
3258
  input.type = p.type === "number" ? "number" : "text";
3134
- input.placeholder = "Default";
3259
+ input.placeholder = p.type === "number" ? `Default (${fallbackText({ type: "number" })})` : "Default";
3135
3260
  input.value = current3;
3136
3261
  input.addEventListener("input", () => write(input.value));
3137
3262
  return input;
@@ -3158,8 +3283,7 @@ function mountPropertyList(host, decls, opts = {}) {
3158
3283
  for (const [v, label2] of types) type.append(option(v, label2, v === p.type));
3159
3284
  type.addEventListener("change", () => {
3160
3285
  p.type = type.value;
3161
- if (opts.typed) delete p.default;
3162
- else p.default = "";
3286
+ delete p.default;
3163
3287
  if (p.type === "enum" || p.type === "flags") p.values ??= [];
3164
3288
  else delete p.values;
3165
3289
  if (p.type === "quality") p.stages ??= [];
@@ -3193,7 +3317,21 @@ function mountPropertyList(host, decls, opts = {}) {
3193
3317
  }, false, true);
3194
3318
  const details = keep(opts.extraDetails?.(p, i));
3195
3319
  if (p.type === "enum" || p.type === "flags") details.push(labelled("Values", tagChips(p, refreshDefault)));
3196
- if (p.type === "quality") details.push(labelled("Stages (in order)", stageChips(p, refreshDefault)));
3320
+ if (p.type === "quality") {
3321
+ const note = el("p", "shell-stage-note");
3322
+ const stages = stageChips(p, refreshDefault, {
3323
+ onRename: (from, to) => {
3324
+ if (p.default === from) p.default = to;
3325
+ const fresh = defaultControl(p, changed, opts);
3326
+ def.replaceWith(fresh);
3327
+ def = fresh;
3328
+ if (opts.onStageRename) opts.onStageRename(p, from, to);
3329
+ else changed();
3330
+ },
3331
+ onReorder: () => opts.onStageReorder?.(p, note)
3332
+ });
3333
+ details.push(labelled("Stages (in order)", stages), note);
3334
+ }
3197
3335
  if (opts.purpose !== false) {
3198
3336
  const purpose = el("input", "field set-purpose");
3199
3337
  purpose.type = "text";
@@ -3332,6 +3470,7 @@ exports.createNavHistory = createNavHistory;
3332
3470
  exports.createSaveController = createSaveController;
3333
3471
  exports.debounce = debounce;
3334
3472
  exports.defaultControl = defaultControl;
3473
+ exports.defaultLabel = defaultLabel;
3335
3474
  exports.defaultProblemCopy = defaultProblemCopy;
3336
3475
  exports.describeProblem = describeProblem;
3337
3476
  exports.dialogFrame = dialogFrame;
@@ -3339,6 +3478,7 @@ exports.dismissToast = dismissToast;
3339
3478
  exports.dupGuard = dupGuard;
3340
3479
  exports.el = el;
3341
3480
  exports.expandableRow = expandableRow;
3481
+ exports.fallbackText = fallbackText;
3342
3482
  exports.feedUpdaterDownloadProgress = feedUpdaterDownloadProgress;
3343
3483
  exports.firstIllegalPropertyName = firstIllegalPropertyName;
3344
3484
  exports.focusNewRow = focusNewRow;
@@ -3404,11 +3544,13 @@ exports.renderStepperBar = renderStepperBar;
3404
3544
  exports.revalidatePropertyRefs = revalidatePropertyRefs;
3405
3545
  exports.revealRow = revealRow;
3406
3546
  exports.revealRowWhenReady = revealRowWhenReady;
3547
+ exports.rungStrip = rungStrip;
3407
3548
  exports.saveIndicator = saveIndicator;
3408
3549
  exports.setKeyPlatform = setKeyPlatform;
3409
3550
  exports.showAbout = showAbout;
3410
3551
  exports.showUpdaterDialog = showUpdaterDialog;
3411
3552
  exports.stageChips = stageChips;
3553
+ exports.stageGateNote = stageGateNote;
3412
3554
  exports.staleBar = staleBar;
3413
3555
  exports.tagChips = tagChips;
3414
3556
  exports.tipAt = tipAt;