isotone 1.0.10 → 1.1.1

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;
@@ -435,4 +451,4 @@ declare function createIterationStore(cfg?: IterationStoreConfig): {
435
451
  readonly hasUnsyncedNotes: boolean;
436
452
  };
437
453
 
438
- 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-OOFRFHCN.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,