expressive-charts 0.13.0 → 1.0.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.cjs CHANGED
@@ -2155,7 +2155,7 @@ const INERT$1 = {
2155
2155
  function createRunner(options) {
2156
2156
  const { surface } = options;
2157
2157
  let effects = options.effects;
2158
- const motion$3 = options.motion ?? motion;
2158
+ const motion$2 = options.motion ?? motion;
2159
2159
  const clock = options.clock ?? defaultClock;
2160
2160
  const icons = options.icons ?? NO_ICONS$1;
2161
2161
  const entries = /* @__PURE__ */ new Map();
@@ -2167,8 +2167,8 @@ function createRunner(options) {
2167
2167
  const texts = /* @__PURE__ */ new Map();
2168
2168
  let holds = 0;
2169
2169
  let flushing = false;
2170
- const unsubscribe = motion$3.subscribe(() => {
2171
- if (motion$3.mode === "off") endRunning();
2170
+ const unsubscribe = motion$2.subscribe(() => {
2171
+ if (motion$2.mode === "off") endRunning();
2172
2172
  });
2173
2173
  function track(input) {
2174
2174
  const key = input.mark.key;
@@ -2213,7 +2213,7 @@ function createRunner(options) {
2213
2213
  done,
2214
2214
  scope: runScope({
2215
2215
  clock,
2216
- motion: motion$3,
2216
+ motion: motion$2,
2217
2217
  icons,
2218
2218
  batch,
2219
2219
  previous,
@@ -2232,7 +2232,7 @@ function createRunner(options) {
2232
2232
  const mark = more.mark ?? entry.mark;
2233
2233
  const ctx = run.scope.context;
2234
2234
  try {
2235
- if (more.end || motion$3.mode === "off") {
2235
+ if (more.end || motion$2.mode === "off") {
2236
2236
  if (effect.kind === "data") effect.end(mark, data, ctx);
2237
2237
  else effect.end(mark, ctx);
2238
2238
  finish(run);
@@ -12409,7 +12409,7 @@ function playTransition(pairs, options) {
12409
12409
  if (!isTransitionEffect(effect)) throw new TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${describeEffect(effect)}.`);
12410
12410
  const start = options.start ?? 0;
12411
12411
  if (!(typeof start === "number" && start >= 0 && start <= 1)) throw new RangeError(`playTransition: start must be a number from 0 to 1, got ${String(start)}.`);
12412
- const motion$2 = options.motion ?? motion;
12412
+ const motion$1 = options.motion ?? motion;
12413
12413
  const clock = options.clock ?? defaultClock;
12414
12414
  const icons = options.icons ?? NO_ICONS;
12415
12415
  const count = pairs.length;
@@ -12420,8 +12420,8 @@ function playTransition(pairs, options) {
12420
12420
  const finished = new Promise((r) => {
12421
12421
  resolve = r;
12422
12422
  });
12423
- let unsubscribe = count > 0 ? motion$2.subscribe(() => {
12424
- if (motion$2.mode === "off") endRunning();
12423
+ let unsubscribe = count > 0 ? motion$1.subscribe(() => {
12424
+ if (motion$1.mode === "off") endRunning();
12425
12425
  }) : void 0;
12426
12426
  const settled = () => {
12427
12427
  if (--waiting > 0) return;
@@ -12432,7 +12432,7 @@ function playTransition(pairs, options) {
12432
12432
  function begin(pair, index, done) {
12433
12433
  const scope = runScope({
12434
12434
  clock,
12435
- motion: motion$2,
12435
+ motion: motion$1,
12436
12436
  icons,
12437
12437
  batch: {
12438
12438
  index,
@@ -12455,7 +12455,7 @@ function playTransition(pairs, options) {
12455
12455
  runs[index] = run;
12456
12456
  const { from, to } = pair;
12457
12457
  try {
12458
- if (motion$2.mode === "off") {
12458
+ if (motion$1.mode === "off") {
12459
12459
  effect.end(from, to, run.context);
12460
12460
  finish(run);
12461
12461
  } else Promise.resolve(effect.run(from, to, run.context)).then(() => finish(run), (error) => fail(run, error));
@@ -15668,7 +15668,7 @@ function configure(options) {
15668
15668
  }
15669
15669
  }
15670
15670
  // src/index.ts
15671
- const VERSION = "0.13.0";
15671
+ const VERSION = "1.0.0";
15672
15672
  const env = {
15673
15673
  presets: presetRegistry,
15674
15674
  icons: iconRegistry,
@@ -15695,13 +15695,12 @@ function expressive(target, options) {
15695
15695
  function fromVegaView(view, options) {
15696
15696
  return fromVegaView$1(view, options, env);
15697
15697
  }
15698
- function motionSwitch(target, second, third) {
15699
- const old = third !== void 0 || second !== void 0 && (typeof second !== "object" || second === null || "chooseMode" in second);
15700
- const options = (old ? third : second) ?? {};
15701
- const motion$1 = old && second !== void 0 ? second : options.motion ?? motion;
15698
+ function motionSwitch(target, options = {}) {
15699
+ if (arguments[2] !== void 0 || typeof options === "object" && options !== null && "chooseMode" in options) throw new TypeError("Since 1.0 motionSwitch takes (target, options), with the motion among the options: motionSwitch(target, { motion, ...options }).");
15700
+ if (typeof options !== "object" || options === null) throw new TypeError(`motionSwitch: options must be an object, got ${options === null ? "null" : typeof options}.`);
15702
15701
  return motionSwitch$1(target, {
15703
15702
  ...options,
15704
- motion: motion$1
15703
+ motion: options.motion ?? motion
15705
15704
  });
15706
15705
  }
15707
15706
  exports.VERSION = VERSION;