@pixerate/editor-svelte 0.122.0 → 0.124.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.
@@ -87,7 +87,8 @@
87
87
  valueDomain: frozen?.valueDomain,
88
88
  valueDomain2: frozen?.valueDomain2,
89
89
  xDomain: frozen?.xDomain,
90
- readout: frozen?.readout
90
+ readout: frozen?.readout,
91
+ raceFrame: view.current.raceFrame
91
92
  })
92
93
  );
93
94
  $effect(() => {
@@ -39,6 +39,7 @@
39
39
  defaultChartErrorBarValue,
40
40
  formatChartAmountList,
41
41
  isCartesianChart,
42
+ listChartMaps,
42
43
  suggestChartReferences,
43
44
  parseChartAmountList,
44
45
  type ChartAxis,
@@ -71,6 +72,9 @@
71
72
  const spec = $derived(view.current.spec);
72
73
  const selectedSeries = $derived(view.current.selectedSeries);
73
74
  const selection = $derived(view.current.selection);
75
+ const raceFrame = $derived(view.current.raceFrame);
76
+ const racePlaying = $derived(view.current.racePlaying);
77
+ const raceAt = $derived(raceFrame ?? Math.max(0, spec.categories.length - 1));
74
78
  const show = (section: ChartInspectorSection) => !sections || sections.includes(section);
75
79
  const cartesian = $derived(isCartesianChart(spec.type));
76
80
  const family = $derived(chartFamily(spec));
@@ -424,6 +428,58 @@
424
428
  </div>
425
429
  </div>
426
430
  {/if}
431
+ {#if spec.type === 'choropleth'}
432
+ {@const maps = listChartMaps()}
433
+ <div class="flex items-center gap-2">
434
+ <label for="{idPrefix}-map" class="{chartLabelClass} w-20 shrink-0">Map</label>
435
+ <select id="{idPrefix}-map" class={chartInputClass} value={spec.map} data-option="map" onchange={(e) => controller.update({ map: e.currentTarget.value })}>
436
+ {#each [...new Set([spec.map, ...maps.map((m) => m.id)])] as id (id)}
437
+ <option value={id}>{maps.find((m) => m.id === id)?.name ?? `${id} (not loaded)`}</option>
438
+ {/each}
439
+ </select>
440
+ </div>
441
+ <div class="flex items-center gap-2">
442
+ <label for="{idPrefix}-map-steps" class="{chartLabelClass} w-20 shrink-0">Classes</label>
443
+ <div class="min-w-0 flex-1">
444
+ <ChartCommitInput id="{idPrefix}-map-steps" value={String(spec.mapSteps)} inputmode="numeric" data-option="mapSteps" disabled={spec.mapThresholds.length > 0} oncommit={(text) => controller.update({ mapSteps: Number(text) }).ok} />
445
+ </div>
446
+ </div>
447
+ <div class="flex items-center gap-2">
448
+ <label for="{idPrefix}-map-breaks" class="{chartLabelClass} w-20 shrink-0">Breaks</label>
449
+ <div class="min-w-0 flex-1">
450
+ <ChartCommitInput id="{idPrefix}-map-breaks" value={spec.mapThresholds.join(', ')} placeholder="Equal classes" data-option="mapThresholds" oncommit={(text) => controller.update({ mapThresholds: text.trim() ? text.split(',').map((t) => Number(t.trim())) : [] }).ok} />
451
+ </div>
452
+ </div>
453
+ {/if}
454
+ {#if spec.type === 'barrace'}
455
+ <div class="flex items-center gap-2">
456
+ <label for="{idPrefix}-race-top" class="{chartLabelClass} w-20 shrink-0">Bars</label>
457
+ <div class="min-w-0 flex-1">
458
+ <ChartCommitInput id="{idPrefix}-race-top" value={String(spec.raceTopN)} inputmode="numeric" data-option="raceTopN" oncommit={(text) => controller.update({ raceTopN: Number(text) }).ok} />
459
+ </div>
460
+ </div>
461
+ {#if spec.categories.length > 1}
462
+ <div class="flex items-center gap-2">
463
+ <label for="{idPrefix}-race-frame" class="{chartLabelClass} w-20 shrink-0">Time</label>
464
+ <div class="flex min-w-0 flex-1 items-center gap-1">
465
+ <button type="button" class={chartButtonClass} data-action="race-play" aria-label={racePlaying ? 'Pause the race' : 'Play the race'} onclick={() => (racePlaying ? controller.pauseRace() : controller.playRace())}>{racePlaying ? 'Pause' : 'Play'}</button>
466
+ <input
467
+ id="{idPrefix}-race-frame"
468
+ type="range"
469
+ min="0"
470
+ max={spec.categories.length - 1}
471
+ step="0.01"
472
+ value={raceAt}
473
+ data-option="raceFrame"
474
+ aria-valuetext={spec.categories[Math.round(raceAt)]}
475
+ class="min-w-0 flex-1 accent-primary"
476
+ oninput={(e) => controller.setRaceFrame(Number(e.currentTarget.value))}
477
+ />
478
+ <span class="w-12 shrink-0 truncate text-right tabular-nums text-muted-foreground" data-race-time="">{spec.categories[Math.round(raceAt)]}</span>
479
+ </div>
480
+ </div>
481
+ {/if}
482
+ {/if}
427
483
  {#if spec.type === 'sankey'}
428
484
  <div class="flex items-center gap-2">
429
485
  <label for="{idPrefix}-sankey-color" class="{chartLabelClass} w-20 shrink-0">Flows</label>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.122.0",
3
+ "version": "0.124.0",
4
4
  "description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -168,7 +168,7 @@
168
168
  "@tiptap/extension-bubble-menu": "^2.27.3",
169
169
  "@tiptap/extension-placeholder": "^2.27.3",
170
170
  "@tiptap/starter-kit": "^2.27.3",
171
- "@pixerate/editor": "0.165.0"
171
+ "@pixerate/editor": "0.167.0"
172
172
  },
173
173
  "peerDependencies": {
174
174
  "@dagrejs/dagre": "^1.1.4",