@wildwinter/app-shell 0.55.0 → 0.57.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/index.d.cts CHANGED
@@ -525,6 +525,20 @@ interface FollowButton {
525
525
  * the author asking for it.
526
526
  */
527
527
  declare function followButton(opts: FollowButtonOptions): FollowButton;
528
+ interface SelectionFollowButtonOptions {
529
+ on: boolean;
530
+ /** Persist the choice. The button reflects the click itself. */
531
+ onToggle: (on: boolean) => void;
532
+ /** What the window stays on when it stops following: "line" (Patterpad), "card" (Storyletter). */
533
+ what?: string;
534
+ }
535
+ /**
536
+ * "Follow selection": the other direction from `followButton`. A helper window
537
+ * that shows whatever the editor has selected (Patterpad's fields window, after
538
+ * Pattershot's brief H1) moves along as the author moves; off, it stays on the
539
+ * node it shows. On by default in such a window: following is what it is for.
540
+ */
541
+ declare function selectionFollowButton(opts: SelectionFollowButtonOptions): FollowButton;
528
542
 
529
543
  interface ConfirmOptions {
530
544
  title: string;
@@ -796,7 +810,8 @@ declare function vcBadgeFor(s: ShardVc | undefined): VcBadge | null;
796
810
  declare function paintVcBadges(root: ParentNode, shards: VcMap): void;
797
811
  /** Turn a region's editing controls off - or back on, but only the ones WE
798
812
  * turned off, so a control disabled for its own reasons (the first card's
799
- * "previous", a redraw-turns box on "always") stays disabled. */
813
+ * "previous", a redraw-turns box on "always") stays disabled. `staysLive` is
814
+ * the app's own reading controls; the shell's (ALWAYS_LIVE) stay live too. */
800
815
  declare function lockControls(host: HTMLElement, off: boolean, staysLive: string): void;
801
816
  /** The notice a locked document opens with: who holds it, and why nothing types. */
802
817
  declare function lockNotice(holders: string[]): HTMLElement;
@@ -1242,4 +1257,4 @@ declare function historyNav(onBack: () => void, onForward: () => void): {
1242
1257
  set(canBack: boolean, canForward: boolean): void;
1243
1258
  };
1244
1259
 
1245
- export { type AboutOptions, type AnchoredPanel, type AnchoredPanelOptions, type Child, type Comment, type CommentMessage, type CommentsOptions, type ConfirmOptions, type Crumb, type DocLine, type ElProps, type FieldHint, type FollowButton, type FollowButtonOptions, type GameIdEditorOptions, ICON_NAMES, ICON_SIZE, type IconName, type IconSvgName, type Identity, type IdentityOptions, type JobBeginOptions, type JobProgressOptions, type JobProgressView, type LabelledToggleOptions, type NavHistory, type NavHistoryOptions, type Notes, type NotesEditorOptions, PALETTE, PALETTE_SIZE, PROPERTY_NAME_HINT, type PaneShell, type PaneShellOptions, type PaneShellState, type PaneSide, type PaneSideConfig, type PinButton, type PinButtonOptions, type PropertyRefOptions, RESERVED_PROPERTY_NAMES, type SaveController, type SaveControllerOptions, type SaveIndicator, type SaveStatus, type ShardVc, type StageChipsOptions, type StaleBarOptions, type StepperBarOptions, type StepperItem, type StepperTone, type TipRect, type ToastKind, type ToastOptions, type ToolWindowHeadOptions, type TooltipOptions, type VcBadge, type VcMap, askIdentity, bindPropertyName, bindPropertyRef, breadcrumb, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createNavHistory, createSaveController, dismissToast, el, firstIllegalPropertyName, foldVc, followButton, gameIdify, hideTip, historyNav, icon, iconBtn, iconHtml, iconNameOfGlyph, iconNode, iconSvg, initTooltips, isCaseOnlyPropertyName, isIconName, isValidGameId, isValidPropertyName, labelled, labelledToggle, lockControls, lockNotice, metaLine, mountJobProgress, mountPaneShell, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, propertyNameProblem, propertyNameify, propertyRefProblem, renderStepperBar, revalidatePropertyRefs, saveIndicator, showAbout, stageChips, staleBar, tagChips, tipAt, tipBold, toast, toolWindowHead, vcBadgeFor, wireReorder };
1260
+ export { type AboutOptions, type AnchoredPanel, type AnchoredPanelOptions, type Child, type Comment, type CommentMessage, type CommentsOptions, type ConfirmOptions, type Crumb, type DocLine, type ElProps, type FieldHint, type FollowButton, type FollowButtonOptions, type GameIdEditorOptions, ICON_NAMES, ICON_SIZE, type IconName, type IconSvgName, type Identity, type IdentityOptions, type JobBeginOptions, type JobProgressOptions, type JobProgressView, type LabelledToggleOptions, type NavHistory, type NavHistoryOptions, type Notes, type NotesEditorOptions, PALETTE, PALETTE_SIZE, PROPERTY_NAME_HINT, type PaneShell, type PaneShellOptions, type PaneShellState, type PaneSide, type PaneSideConfig, type PinButton, type PinButtonOptions, type PropertyRefOptions, RESERVED_PROPERTY_NAMES, type SaveController, type SaveControllerOptions, type SaveIndicator, type SaveStatus, type ShardVc, type StageChipsOptions, type StaleBarOptions, type StepperBarOptions, type StepperItem, type StepperTone, type TipRect, type ToastKind, type ToastOptions, type ToolWindowHeadOptions, type TooltipOptions, type VcBadge, type VcMap, askIdentity, bindPropertyName, bindPropertyRef, breadcrumb, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createNavHistory, createSaveController, dismissToast, el, firstIllegalPropertyName, foldVc, followButton, gameIdify, hideTip, historyNav, icon, iconBtn, iconHtml, iconNameOfGlyph, iconNode, iconSvg, initTooltips, isCaseOnlyPropertyName, isIconName, isValidGameId, isValidPropertyName, labelled, labelledToggle, lockControls, lockNotice, metaLine, mountJobProgress, mountPaneShell, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, propertyNameProblem, propertyNameify, propertyRefProblem, renderStepperBar, revalidatePropertyRefs, saveIndicator, selectionFollowButton, showAbout, stageChips, staleBar, tagChips, tipAt, tipBold, toast, toolWindowHead, vcBadgeFor, wireReorder };
package/dist/index.d.ts CHANGED
@@ -525,6 +525,20 @@ interface FollowButton {
525
525
  * the author asking for it.
526
526
  */
527
527
  declare function followButton(opts: FollowButtonOptions): FollowButton;
528
+ interface SelectionFollowButtonOptions {
529
+ on: boolean;
530
+ /** Persist the choice. The button reflects the click itself. */
531
+ onToggle: (on: boolean) => void;
532
+ /** What the window stays on when it stops following: "line" (Patterpad), "card" (Storyletter). */
533
+ what?: string;
534
+ }
535
+ /**
536
+ * "Follow selection": the other direction from `followButton`. A helper window
537
+ * that shows whatever the editor has selected (Patterpad's fields window, after
538
+ * Pattershot's brief H1) moves along as the author moves; off, it stays on the
539
+ * node it shows. On by default in such a window: following is what it is for.
540
+ */
541
+ declare function selectionFollowButton(opts: SelectionFollowButtonOptions): FollowButton;
528
542
 
529
543
  interface ConfirmOptions {
530
544
  title: string;
@@ -796,7 +810,8 @@ declare function vcBadgeFor(s: ShardVc | undefined): VcBadge | null;
796
810
  declare function paintVcBadges(root: ParentNode, shards: VcMap): void;
797
811
  /** Turn a region's editing controls off - or back on, but only the ones WE
798
812
  * turned off, so a control disabled for its own reasons (the first card's
799
- * "previous", a redraw-turns box on "always") stays disabled. */
813
+ * "previous", a redraw-turns box on "always") stays disabled. `staysLive` is
814
+ * the app's own reading controls; the shell's (ALWAYS_LIVE) stay live too. */
800
815
  declare function lockControls(host: HTMLElement, off: boolean, staysLive: string): void;
801
816
  /** The notice a locked document opens with: who holds it, and why nothing types. */
802
817
  declare function lockNotice(holders: string[]): HTMLElement;
@@ -1242,4 +1257,4 @@ declare function historyNav(onBack: () => void, onForward: () => void): {
1242
1257
  set(canBack: boolean, canForward: boolean): void;
1243
1258
  };
1244
1259
 
1245
- export { type AboutOptions, type AnchoredPanel, type AnchoredPanelOptions, type Child, type Comment, type CommentMessage, type CommentsOptions, type ConfirmOptions, type Crumb, type DocLine, type ElProps, type FieldHint, type FollowButton, type FollowButtonOptions, type GameIdEditorOptions, ICON_NAMES, ICON_SIZE, type IconName, type IconSvgName, type Identity, type IdentityOptions, type JobBeginOptions, type JobProgressOptions, type JobProgressView, type LabelledToggleOptions, type NavHistory, type NavHistoryOptions, type Notes, type NotesEditorOptions, PALETTE, PALETTE_SIZE, PROPERTY_NAME_HINT, type PaneShell, type PaneShellOptions, type PaneShellState, type PaneSide, type PaneSideConfig, type PinButton, type PinButtonOptions, type PropertyRefOptions, RESERVED_PROPERTY_NAMES, type SaveController, type SaveControllerOptions, type SaveIndicator, type SaveStatus, type ShardVc, type StageChipsOptions, type StaleBarOptions, type StepperBarOptions, type StepperItem, type StepperTone, type TipRect, type ToastKind, type ToastOptions, type ToolWindowHeadOptions, type TooltipOptions, type VcBadge, type VcMap, askIdentity, bindPropertyName, bindPropertyRef, breadcrumb, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createNavHistory, createSaveController, dismissToast, el, firstIllegalPropertyName, foldVc, followButton, gameIdify, hideTip, historyNav, icon, iconBtn, iconHtml, iconNameOfGlyph, iconNode, iconSvg, initTooltips, isCaseOnlyPropertyName, isIconName, isValidGameId, isValidPropertyName, labelled, labelledToggle, lockControls, lockNotice, metaLine, mountJobProgress, mountPaneShell, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, propertyNameProblem, propertyNameify, propertyRefProblem, renderStepperBar, revalidatePropertyRefs, saveIndicator, showAbout, stageChips, staleBar, tagChips, tipAt, tipBold, toast, toolWindowHead, vcBadgeFor, wireReorder };
1260
+ export { type AboutOptions, type AnchoredPanel, type AnchoredPanelOptions, type Child, type Comment, type CommentMessage, type CommentsOptions, type ConfirmOptions, type Crumb, type DocLine, type ElProps, type FieldHint, type FollowButton, type FollowButtonOptions, type GameIdEditorOptions, ICON_NAMES, ICON_SIZE, type IconName, type IconSvgName, type Identity, type IdentityOptions, type JobBeginOptions, type JobProgressOptions, type JobProgressView, type LabelledToggleOptions, type NavHistory, type NavHistoryOptions, type Notes, type NotesEditorOptions, PALETTE, PALETTE_SIZE, PROPERTY_NAME_HINT, type PaneShell, type PaneShellOptions, type PaneShellState, type PaneSide, type PaneSideConfig, type PinButton, type PinButtonOptions, type PropertyRefOptions, RESERVED_PROPERTY_NAMES, type SaveController, type SaveControllerOptions, type SaveIndicator, type SaveStatus, type ShardVc, type StageChipsOptions, type StaleBarOptions, type StepperBarOptions, type StepperItem, type StepperTone, type TipRect, type ToastKind, type ToastOptions, type ToolWindowHeadOptions, type TooltipOptions, type VcBadge, type VcMap, askIdentity, bindPropertyName, bindPropertyRef, breadcrumb, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createNavHistory, createSaveController, dismissToast, el, firstIllegalPropertyName, foldVc, followButton, gameIdify, hideTip, historyNav, icon, iconBtn, iconHtml, iconNameOfGlyph, iconNode, iconSvg, initTooltips, isCaseOnlyPropertyName, isIconName, isValidGameId, isValidPropertyName, labelled, labelledToggle, lockControls, lockNotice, metaLine, mountJobProgress, mountPaneShell, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, propertyNameProblem, propertyNameify, propertyRefProblem, renderStepperBar, revalidatePropertyRefs, saveIndicator, selectionFollowButton, showAbout, stageChips, staleBar, tagChips, tipAt, tipBold, toast, toolWindowHead, vcBadgeFor, wireReorder };
package/dist/index.js CHANGED
@@ -278,6 +278,27 @@ function followButton(opts) {
278
278
  reflect();
279
279
  } };
280
280
  }
281
+ function selectionFollowButton(opts) {
282
+ const what = opts.what ?? "line";
283
+ const b = el("button", "btn swin-follow", "Follow selection");
284
+ b.type = "button";
285
+ let on = opts.on;
286
+ const reflect = () => {
287
+ b.classList.toggle("on", on);
288
+ b.setAttribute("aria-pressed", String(on));
289
+ b.dataset["tip"] = on ? `Shows whatever is selected in the editor. Click to stay on this ${what}.` : `Stays on this ${what}. Click to follow the selection.`;
290
+ };
291
+ reflect();
292
+ b.addEventListener("click", () => {
293
+ on = !on;
294
+ reflect();
295
+ opts.onToggle(on);
296
+ });
297
+ return { el: b, set: (next) => {
298
+ on = next;
299
+ reflect();
300
+ } };
301
+ }
281
302
 
282
303
  // src/confirm.ts
283
304
  function confirmDialog(opts) {
@@ -554,11 +575,12 @@ function paintVcBadges(root, shards) {
554
575
  host.append(span);
555
576
  });
556
577
  }
578
+ var ALWAYS_LIVE = ".shell-fold-cap";
557
579
  function lockControls(host, off, staysLive) {
558
580
  host.classList.toggle("vc-readonly", off);
559
581
  if (off) {
560
582
  host.querySelectorAll("input, textarea, select, button").forEach((c) => {
561
- if (c.disabled || staysLive !== "" && c.matches(staysLive)) return;
583
+ if (c.disabled || c.matches(ALWAYS_LIVE) || staysLive !== "" && c.matches(staysLive)) return;
562
584
  c.disabled = true;
563
585
  c.classList.add("vc-off");
564
586
  });
@@ -1260,6 +1282,6 @@ function historyNav(onBack, onForward) {
1260
1282
  };
1261
1283
  }
1262
1284
 
1263
- export { PALETTE, PALETTE_SIZE, askIdentity, closeAnchoredPanel, colourFor, colourIndex, confirmDialog, createNavHistory, createSaveController, dismissToast, foldVc, followButton, gameIdify, historyNav, isValidGameId, lockControls, lockNotice, mountJobProgress, mountPaneShell, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, renderStepperBar, saveIndicator, showAbout, staleBar, toast, toolWindowHead, vcBadgeFor };
1285
+ export { PALETTE, PALETTE_SIZE, askIdentity, closeAnchoredPanel, colourFor, colourIndex, confirmDialog, createNavHistory, createSaveController, dismissToast, foldVc, followButton, gameIdify, historyNav, isValidGameId, lockControls, lockNotice, mountJobProgress, mountPaneShell, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, renderStepperBar, saveIndicator, selectionFollowButton, showAbout, staleBar, toast, toolWindowHead, vcBadgeFor };
1264
1286
  //# sourceMappingURL=index.js.map
1265
1287
  //# sourceMappingURL=index.js.map