isotone 1.0.9 → 1.1.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/core.d.ts CHANGED
@@ -197,8 +197,10 @@ interface OverlayVariant {
197
197
  * when the file was not hashable), so a later change to the real file can
198
198
  * be detected and three-way merged into the override.
199
199
  */
200
+ /** `added`: a file the project does not have; the variant introduces it. */
200
201
  files: Record<string, {
201
202
  base: string | null;
203
+ added?: true;
202
204
  }>;
203
205
  }
204
206
  /** An overlay variant as the endpoint lists it: the manifest plus what the
@@ -297,12 +299,24 @@ declare function overlayGroups<T extends OverlayVariant>(variants: T[]): Overlay
297
299
  */
298
300
  declare function variantAppliesTo(pattern: string | undefined, route: string): boolean;
299
301
  declare function overlayAxes(list: OverlayVariantsList, route: string): SelectVariantAxis[];
302
+ /**
303
+ * The tab's live variant store, which the Vite plugin creates on the page
304
+ * in live mode (`window.__isotoneLive`). Only the part the panel uses.
305
+ */
306
+ interface LiveVariantSelection {
307
+ readonly active: string[];
308
+ /** Switch the tab; true when the page has to reload to show it. */
309
+ select(next: string[]): boolean;
310
+ subscribe(listener: () => void): () => void;
311
+ reload(): void;
312
+ }
300
313
  /**
301
314
  * A `VariantsSource` over the overlay endpoint. One select axis per group on
302
315
  * the route; choosing an option replaces that group's active member and
303
- * posts the whole active set, and the server answers by hot-swapping the
304
- * files, so nothing here has to re-render anything. `refresh()` re-reads
305
- * the listing; the panel calls it when it opens.
316
+ * posts the whole active set. In live mode the tab's store switches the page
317
+ * at once (or asks for a reload), and the post makes the pick the server's
318
+ * default; otherwise the server answers the post by hot-swapping the files.
319
+ * `refresh()` re-reads the listing; the panel calls it when it opens.
306
320
  */
307
321
  declare function createOverlayVariantsSource(cfg: {
308
322
  /** Absolute or same-origin URL of the variants endpoint. */
@@ -312,6 +326,8 @@ declare function createOverlayVariantsSource(cfg: {
312
326
  storage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'> | null;
313
327
  /** The element knobs write their properties on. Default: `document.documentElement`. */
314
328
  knobRoot?: Parameters<typeof applyKnobValues>[2] | null;
329
+ /** The tab's live store. Default: the one the Vite plugin put on the page, if any. */
330
+ live?: LiveVariantSelection | null;
315
331
  }): VariantsSource & {
316
332
  refresh(): Promise<void>;
317
333
  readonly list: OverlayVariantsList | null;
@@ -391,7 +407,6 @@ interface NodeLike {
391
407
  * so it is unit-testable.
392
408
  */
393
409
  declare function describeIterationElement(el: NodeLike, maxDepth?: number): IterationElement;
394
- /** Lazy DOM views: describing one element never walks unrelated subtrees. */
395
410
  declare function elementAsNode(el: Element): NodeLike;
396
411
  /** A matcher over a console route: include a page only when it is not hidden
397
412
  * (denylist) or, when a visible list is given, only when it matches. */
@@ -436,4 +451,4 @@ declare function createIterationStore(cfg?: IterationStoreConfig): {
436
451
  readonly hasUnsyncedNotes: boolean;
437
452
  };
438
453
 
439
- export { type ColorSwatch, type ColorVariantAxis, type IterationElement, type IterationNote, type IterationStoreConfig, KNOBS_STORAGE_KEY, type KnobAxis, type NodeLike, type NoteContext, OVERLAY_DEFAULT_OPTION, OVERLAY_GROUP_ID, type OverlayGroup, type OverlayVariant, type OverlayVariantStatus, type OverlayVariantsList, type RangeVariantAxis, type RouteGateOptions, type SaveLocation, type SelectVariantAxis, VARIANTS_ENDPOINT, type VariantAction, type VariantAxis, type VariantAxisCondition, type VariantOption, type VariantReference, type VariantRemoval, type VariantSelections, type VariantsSource, applyKnobValues, axisDefault, createIterationStore, createOverlayVariantsSource, createVariantsSource, defaultSelections, describeIterationElement, elementAsNode, formatRangeValue, isAxisVisible, isDirty, isRouteVisible, isValidSelection, knobCssValue, knobDelta, knobVar, knobsFor, overlayAxes, overlayGroups, parseVariantParam, serializeVariantParam, variantAppliesTo, visibleAxes };
454
+ export { type ColorSwatch, type ColorVariantAxis, type IterationElement, type IterationNote, type IterationStoreConfig, KNOBS_STORAGE_KEY, type KnobAxis, type LiveVariantSelection, type NodeLike, type NoteContext, OVERLAY_DEFAULT_OPTION, OVERLAY_GROUP_ID, type OverlayGroup, type OverlayVariant, type OverlayVariantStatus, type OverlayVariantsList, type RangeVariantAxis, type RouteGateOptions, type SaveLocation, type SelectVariantAxis, VARIANTS_ENDPOINT, type VariantAction, type VariantAxis, type VariantAxisCondition, type VariantOption, type VariantReference, type VariantRemoval, type VariantSelections, type VariantsSource, applyKnobValues, axisDefault, createIterationStore, createOverlayVariantsSource, createVariantsSource, defaultSelections, describeIterationElement, elementAsNode, formatRangeValue, isAxisVisible, isDirty, isRouteVisible, isValidSelection, knobCssValue, knobDelta, knobVar, knobsFor, overlayAxes, overlayGroups, parseVariantParam, serializeVariantParam, variantAppliesTo, visibleAxes };
package/dist/core.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  describeIterationElement,
4
4
  elementAsNode,
5
5
  isRouteVisible
6
- } from "./chunk-JGIX4XEH.js";
6
+ } from "./chunk-FKEKBZ3E.js";
7
7
  import {
8
8
  KNOBS_STORAGE_KEY,
9
9
  OVERLAY_DEFAULT_OPTION,
@@ -28,7 +28,7 @@ import {
28
28
  serializeVariantParam,
29
29
  variantAppliesTo,
30
30
  visibleAxes
31
- } from "./chunk-OSETWKGE.js";
31
+ } from "./chunk-PUXQGUMQ.js";
32
32
  import "./chunk-A4DX2V4C.js";
33
33
  export {
34
34
  KNOBS_STORAGE_KEY,
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  describeIterationElement,
5
5
  elementAsNode,
6
6
  isRouteVisible
7
- } from "./chunk-JGIX4XEH.js";
7
+ } from "./chunk-FKEKBZ3E.js";
8
8
  import {
9
9
  FEEDBACK_STORAGE_KEY,
10
10
  KNOBS_STORAGE_KEY,
@@ -32,7 +32,7 @@ import {
32
32
  serializeVariantParam,
33
33
  visibleAxes,
34
34
  writeBrowserStorage
35
- } from "./chunk-OSETWKGE.js";
35
+ } from "./chunk-PUXQGUMQ.js";
36
36
  import {
37
37
  MAX_FEEDBACK_LENGTH
38
38
  } from "./chunk-A4DX2V4C.js";
@@ -2081,6 +2081,7 @@ function IterationPanel({
2081
2081
  );
2082
2082
  cancelEdit();
2083
2083
  setNotice("");
2084
+ setPicking(false);
2084
2085
  focusComposer();
2085
2086
  try {
2086
2087
  const savedId = await store.saveNote(
@@ -2328,7 +2329,7 @@ function IterationPanel({
2328
2329
  return;
2329
2330
  }
2330
2331
  if (e.key !== "Escape" && e.key !== "Enter") return;
2331
- if (e.composedPath().includes(textareaRef.current) && e.key === "Enter")
2332
+ if (e.key === "Enter" && e.composedPath().includes(textareaRef.current) && (e.shiftKey || e.isComposing || textareaRef.current?.value.trim()))
2332
2333
  return;
2333
2334
  e.preventDefault();
2334
2335
  e.stopImmediatePropagation();