@flux-ui/visuals 3.6.1 → 3.7.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.js CHANGED
@@ -9261,7 +9261,7 @@ function friendlyDateTime(dateTimeish) {
9261
9261
  else throw new InvalidArgumentError(`Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`);
9262
9262
  }
9263
9263
  //#endregion
9264
- //#region ../../node_modules/.bun/@basmilius+utils@3.52.0+f2ed1ec6a4c7f7fd/node_modules/@basmilius/utils/dist/index.mjs
9264
+ //#region ../../node_modules/.bun/@basmilius+utils@3.53.0+f2ed1ec6a4c7f7fd/node_modules/@basmilius/utils/dist/index.mjs
9265
9265
  function x$1(e) {
9266
9266
  let t = {};
9267
9267
  do {
@@ -9311,7 +9311,7 @@ function K$1(e, t, n) {
9311
9311
  Object.defineProperty(e, t, { value: n });
9312
9312
  }
9313
9313
  //#endregion
9314
- //#region ../../node_modules/.bun/@basmilius+http-client@3.52.0+9129bae305b09d14/node_modules/@basmilius/http-client/dist/index.mjs
9314
+ //#region ../../node_modules/.bun/@basmilius+http-client@3.53.0+9129bae305b09d14/node_modules/@basmilius/http-client/dist/index.mjs
9315
9315
  function adapter_default(Parent) {
9316
9316
  return class extends Parent {
9317
9317
  constructor(...args) {
@@ -9805,7 +9805,7 @@ var HttpAdapter = _HttpAdapter = class HttpAdapter {
9805
9805
  return matches[1].replaceAll("'", "").replaceAll("\"", "").replaceAll("/", "-").replaceAll(":", "-");
9806
9806
  }
9807
9807
  static parseRequestError(data, statusCode) {
9808
- return new RequestError_default(data.code, data.error, data.error_description, statusCode);
9808
+ return new RequestError_default(data.code, data.error, data.error_description ?? data.errorDescription, statusCode);
9809
9809
  }
9810
9810
  static parseValidationError(data) {
9811
9811
  let errors;
@@ -9815,7 +9815,7 @@ var HttpAdapter = _HttpAdapter = class HttpAdapter {
9815
9815
  errors[key] = _HttpAdapter.parseValidationError(value);
9816
9816
  });
9817
9817
  }
9818
- return new ValidationError_default(data.code, data.error, data.error_description, errors, data.params);
9818
+ return new ValidationError_default(data.code, data.error, data.error_description ?? data.errorDescription, errors, data.params);
9819
9819
  }
9820
9820
  };
9821
9821
  HttpAdapter = _HttpAdapter = __decorate([adapter_default], HttpAdapter);
@@ -9923,12 +9923,12 @@ var FluxVisualAnimatedColors_default = /* @__PURE__ */ defineComponent({
9923
9923
  },
9924
9924
  setup(__props) {
9925
9925
  const canvasRef = useTemplateRef("canvas");
9926
- const componentId = se$1();
9927
- const inView = k$1(canvasRef, { initial: true });
9928
9926
  const contextRef = ref();
9929
9927
  const animationFrame = ref(0);
9930
9928
  const tick = ref(0);
9931
9929
  const size = ref(null);
9930
+ const componentId = se$1();
9931
+ const inView = k$1(canvasRef, { initial: true });
9932
9932
  const reducedMotion = v$1();
9933
9933
  const polygons = computed(() => {
9934
9934
  if (!__props.colors || __props.colors.length === 0) return [];
@@ -9954,6 +9954,45 @@ var FluxVisualAnimatedColors_default = /* @__PURE__ */ defineComponent({
9954
9954
  }
9955
9955
  return polygons;
9956
9956
  });
9957
+ watch(canvasRef, (canvas, _, onCleanup) => {
9958
+ if (!canvas) {
9959
+ contextRef.value = void 0;
9960
+ size.value = null;
9961
+ return;
9962
+ }
9963
+ contextRef.value = canvas.getContext("2d", {
9964
+ alpha: true,
9965
+ colorSpace: "display-p3"
9966
+ });
9967
+ if (typeof ResizeObserver === "undefined") {
9968
+ size.value = {
9969
+ width: canvas.offsetWidth,
9970
+ height: canvas.offsetHeight
9971
+ };
9972
+ canvas.width = canvas.offsetWidth;
9973
+ canvas.height = canvas.offsetHeight;
9974
+ return;
9975
+ }
9976
+ const observer = new ResizeObserver(() => {
9977
+ const width = canvas.offsetWidth;
9978
+ const height = canvas.offsetHeight;
9979
+ if (!width || !height || size.value?.width === width && size.value?.height === height) return;
9980
+ canvas.width = width;
9981
+ canvas.height = height;
9982
+ size.value = {
9983
+ width,
9984
+ height
9985
+ };
9986
+ });
9987
+ observer.observe(canvas);
9988
+ onCleanup(() => observer.disconnect());
9989
+ }, { immediate: true });
9990
+ watch([
9991
+ polygons,
9992
+ () => __props.opacity,
9993
+ size,
9994
+ inView
9995
+ ], () => restart());
9957
9996
  onBeforeUnmount(() => cancel());
9958
9997
  function cancel() {
9959
9998
  cancelAnimationFrame(animationFrame.value);
@@ -10003,45 +10042,6 @@ var FluxVisualAnimatedColors_default = /* @__PURE__ */ defineComponent({
10003
10042
  }
10004
10043
  schedule();
10005
10044
  }
10006
- watch(canvasRef, (canvas, _, onCleanup) => {
10007
- if (!canvas) {
10008
- contextRef.value = void 0;
10009
- size.value = null;
10010
- return;
10011
- }
10012
- contextRef.value = canvas.getContext("2d", {
10013
- alpha: true,
10014
- colorSpace: "display-p3"
10015
- });
10016
- if (typeof ResizeObserver === "undefined") {
10017
- size.value = {
10018
- width: canvas.offsetWidth,
10019
- height: canvas.offsetHeight
10020
- };
10021
- canvas.width = canvas.offsetWidth;
10022
- canvas.height = canvas.offsetHeight;
10023
- return;
10024
- }
10025
- const observer = new ResizeObserver(() => {
10026
- const width = canvas.offsetWidth;
10027
- const height = canvas.offsetHeight;
10028
- if (!width || !height || size.value?.width === width && size.value?.height === height) return;
10029
- canvas.width = width;
10030
- canvas.height = height;
10031
- size.value = {
10032
- width,
10033
- height
10034
- };
10035
- });
10036
- observer.observe(canvas);
10037
- onCleanup(() => observer.disconnect());
10038
- }, { immediate: true });
10039
- watch([
10040
- polygons,
10041
- () => __props.opacity,
10042
- size,
10043
- inView
10044
- ], () => restart());
10045
10045
  return (_ctx, _cache) => {
10046
10046
  return openBlock(), createElementBlock("canvas", {
10047
10047
  ref: "canvas",
@@ -11347,38 +11347,6 @@ var FluxVisualFlickeringGrid_default = /* @__PURE__ */ defineComponent({
11347
11347
  context.fillRect(0, 0, 1, 1);
11348
11348
  return context.getImageData(0, 0, 1, 1).data;
11349
11349
  });
11350
- function draw(context, width, height, columns, rows, squares, dpr) {
11351
- context.clearRect(0, 0, width * dpr, height * dpr);
11352
- const [r, g, b] = unref(rgb);
11353
- for (let i = 0; i < columns; ++i) for (let j = 0; j < rows; ++j) {
11354
- context.fillStyle = `rgb(${r} ${g} ${b} / ${squares[i * rows + j]})`;
11355
- context.fillRect((i * (__props.size + __props.gap) + width / 2 - (columns / 2 * (__props.size + __props.gap) - __props.gap / 2)) * dpr, (j * (__props.size + __props.gap) + height / 2 - (rows / 2 * (__props.size + __props.gap) - __props.gap / 2)) * dpr, __props.size * dpr, __props.size * dpr);
11356
- }
11357
- }
11358
- function setup(canvas) {
11359
- const width = canvas.clientWidth;
11360
- const height = canvas.clientHeight;
11361
- const dpr = window.devicePixelRatio || 1;
11362
- canvas.width = width * dpr;
11363
- canvas.height = height * dpr;
11364
- canvas.style.width = `${width}px`;
11365
- canvas.style.height = `${height}px`;
11366
- const columns = Math.ceil(width / (__props.size + __props.gap));
11367
- const rows = Math.ceil(height / (__props.size + __props.gap));
11368
- const squares = new Float32Array(columns * rows);
11369
- for (let i = 0; i < squares.length; ++i) squares[i] = mulberry.next() * __props.maxOpacity;
11370
- return {
11371
- width,
11372
- height,
11373
- columns,
11374
- rows,
11375
- squares,
11376
- dpr
11377
- };
11378
- }
11379
- function tick(squares, delta) {
11380
- for (let i = 0; i < squares.length; ++i) if (mulberry.next() < __props.flickerChance * delta) squares[i] = mulberry.next() * __props.maxOpacity;
11381
- }
11382
11350
  watch([canvasRef, inView], ([canvas, inView], _, onCleanup) => {
11383
11351
  if (!canvas || !inView) return;
11384
11352
  const context = canvas.getContext("2d");
@@ -11412,6 +11380,38 @@ var FluxVisualFlickeringGrid_default = /* @__PURE__ */ defineComponent({
11412
11380
  cancelAnimationFrame(frame);
11413
11381
  });
11414
11382
  }, { immediate: true });
11383
+ function draw(context, width, height, columns, rows, squares, dpr) {
11384
+ context.clearRect(0, 0, width * dpr, height * dpr);
11385
+ const [r, g, b] = unref(rgb);
11386
+ for (let i = 0; i < columns; ++i) for (let j = 0; j < rows; ++j) {
11387
+ context.fillStyle = `rgb(${r} ${g} ${b} / ${squares[i * rows + j]})`;
11388
+ context.fillRect((i * (__props.size + __props.gap) + width / 2 - (columns / 2 * (__props.size + __props.gap) - __props.gap / 2)) * dpr, (j * (__props.size + __props.gap) + height / 2 - (rows / 2 * (__props.size + __props.gap) - __props.gap / 2)) * dpr, __props.size * dpr, __props.size * dpr);
11389
+ }
11390
+ }
11391
+ function setup(canvas) {
11392
+ const width = canvas.clientWidth;
11393
+ const height = canvas.clientHeight;
11394
+ const dpr = window.devicePixelRatio || 1;
11395
+ canvas.width = width * dpr;
11396
+ canvas.height = height * dpr;
11397
+ canvas.style.width = `${width}px`;
11398
+ canvas.style.height = `${height}px`;
11399
+ const columns = Math.ceil(width / (__props.size + __props.gap));
11400
+ const rows = Math.ceil(height / (__props.size + __props.gap));
11401
+ const squares = new Float32Array(columns * rows);
11402
+ for (let i = 0; i < squares.length; ++i) squares[i] = mulberry.next() * __props.maxOpacity;
11403
+ return {
11404
+ width,
11405
+ height,
11406
+ columns,
11407
+ rows,
11408
+ squares,
11409
+ dpr
11410
+ };
11411
+ }
11412
+ function tick(squares, delta) {
11413
+ for (let i = 0; i < squares.length; ++i) if (mulberry.next() < __props.flickerChance * delta) squares[i] = mulberry.next() * __props.maxOpacity;
11414
+ }
11415
11415
  return (_ctx, _cache) => {
11416
11416
  return openBlock(), createElementBlock("canvas", {
11417
11417
  ref: "canvas",
@@ -11570,8 +11570,8 @@ var FluxVisualHighlighter_default = /* @__PURE__ */ defineComponent({
11570
11570
  emits: ["hidden", "shown"],
11571
11571
  setup(__props, { expose: __expose, emit: __emit }) {
11572
11572
  const emit = __emit;
11573
- const group = useHighlighterGroupInjection();
11574
11573
  const targetRef = useTemplateRef("target");
11574
+ const group = useHighlighterGroupInjection();
11575
11575
  const inView = group ? shallowRef(true) : k$1(targetRef, { initial: !__props.whenInView });
11576
11576
  const effectiveVariant = computed(() => __props.variant ?? group?.defaults.variant ?? "highlight");
11577
11577
  const effectiveColor = computed(() => __props.color ?? group?.defaults.color ?? "var(--warning-200)");
@@ -11586,6 +11586,39 @@ var FluxVisualHighlighter_default = /* @__PURE__ */ defineComponent({
11586
11586
  let settleTimer;
11587
11587
  let shownTimer;
11588
11588
  let revealed = false;
11589
+ watch([
11590
+ effectiveVariant,
11591
+ effectiveColor,
11592
+ effectiveStrokeWidth,
11593
+ effectiveAnimationDuration,
11594
+ effectiveIterations,
11595
+ effectivePadding,
11596
+ effectiveMultiline
11597
+ ], () => build());
11598
+ watch(inView, () => {
11599
+ if (!group) reveal();
11600
+ });
11601
+ onMounted(() => {
11602
+ const element = targetRef.value;
11603
+ if (group && element) {
11604
+ entry = {
11605
+ element,
11606
+ getAnnotation: () => annotation
11607
+ };
11608
+ group.add(entry);
11609
+ }
11610
+ build();
11611
+ });
11612
+ onBeforeUnmount(() => {
11613
+ if (group && entry) {
11614
+ group.remove(entry);
11615
+ entry = null;
11616
+ }
11617
+ window.clearTimeout(shownTimer);
11618
+ stopSettleWatch();
11619
+ annotation?.remove();
11620
+ annotation = null;
11621
+ });
11589
11622
  function emitShown() {
11590
11623
  window.clearTimeout(shownTimer);
11591
11624
  if (v$1()) {
@@ -11654,39 +11687,6 @@ var FluxVisualHighlighter_default = /* @__PURE__ */ defineComponent({
11654
11687
  observer.observe(element);
11655
11688
  observer.observe(document.body);
11656
11689
  }
11657
- onMounted(() => {
11658
- const element = targetRef.value;
11659
- if (group && element) {
11660
- entry = {
11661
- element,
11662
- getAnnotation: () => annotation
11663
- };
11664
- group.add(entry);
11665
- }
11666
- build();
11667
- });
11668
- watch([
11669
- effectiveVariant,
11670
- effectiveColor,
11671
- effectiveStrokeWidth,
11672
- effectiveAnimationDuration,
11673
- effectiveIterations,
11674
- effectivePadding,
11675
- effectiveMultiline
11676
- ], () => build());
11677
- watch(inView, () => {
11678
- if (!group) reveal();
11679
- });
11680
- onBeforeUnmount(() => {
11681
- if (group && entry) {
11682
- group.remove(entry);
11683
- entry = null;
11684
- }
11685
- window.clearTimeout(shownTimer);
11686
- stopSettleWatch();
11687
- annotation?.remove();
11688
- annotation = null;
11689
- });
11690
11690
  __expose({
11691
11691
  hide,
11692
11692
  replay,
@@ -11782,6 +11782,26 @@ var FluxVisualNumberFlow_default = /* @__PURE__ */ defineComponent({
11782
11782
  "ease-in-out": (progress) => progress < .5 ? 2 * progress * progress : 1 - (-2 * progress + 2) ** 2 / 2
11783
11783
  };
11784
11784
  const CUBIC_BEZIER_PATTERN = /^cubic-bezier\(\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*\)$/;
11785
+ const swiftOutEasing = cubicBezier(.55, 0, .1, 1);
11786
+ const labelRef = useTemplateRef("label");
11787
+ let frame = 0;
11788
+ let current = __props.animateOnMount ? 0 : __props.value;
11789
+ const easingFunction = computed(() => {
11790
+ if (typeof __props.easing === "function") return __props.easing;
11791
+ const keyword = EASINGS[__props.easing];
11792
+ if (keyword) return keyword;
11793
+ return parseCubicBezier(__props.easing) ?? swiftOutEasing;
11794
+ });
11795
+ const formatter = computed(() => new Intl.NumberFormat(__props.locale, __props.format ?? { maximumFractionDigits: 0 }));
11796
+ const initialText = formatter.value.format(__props.animateOnMount ? 0 : __props.value);
11797
+ const accessibleValue = computed(() => formatter.value.format(__props.value));
11798
+ watch(() => __props.value, (next) => tween(current, next));
11799
+ watch(formatter, () => render(current));
11800
+ onMounted(() => {
11801
+ if (__props.animateOnMount) tween(0, __props.value);
11802
+ else render(__props.value);
11803
+ });
11804
+ onBeforeUnmount(cancel);
11785
11805
  function cubicBezier(x1, y1, x2, y2) {
11786
11806
  const ax = 3 * x1 - 3 * x2 + 1;
11787
11807
  const bx = 3 * x2 - 6 * x1;
@@ -11824,19 +11844,6 @@ var FluxVisualNumberFlow_default = /* @__PURE__ */ defineComponent({
11824
11844
  if (!match) return null;
11825
11845
  return cubicBezier(Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4]));
11826
11846
  }
11827
- const swiftOutEasing = cubicBezier(.55, 0, .1, 1);
11828
- const easingFunction = computed(() => {
11829
- if (typeof __props.easing === "function") return __props.easing;
11830
- const keyword = EASINGS[__props.easing];
11831
- if (keyword) return keyword;
11832
- return parseCubicBezier(__props.easing) ?? swiftOutEasing;
11833
- });
11834
- const formatter = computed(() => new Intl.NumberFormat(__props.locale, __props.format ?? { maximumFractionDigits: 0 }));
11835
- const initialText = formatter.value.format(__props.animateOnMount ? 0 : __props.value);
11836
- const accessibleValue = computed(() => formatter.value.format(__props.value));
11837
- const labelRef = useTemplateRef("label");
11838
- let frame = 0;
11839
- let current = __props.animateOnMount ? 0 : __props.value;
11840
11847
  function render(next) {
11841
11848
  current = next;
11842
11849
  const element = labelRef.value;
@@ -11868,13 +11875,6 @@ var FluxVisualNumberFlow_default = /* @__PURE__ */ defineComponent({
11868
11875
  };
11869
11876
  frame = requestAnimationFrame(step);
11870
11877
  }
11871
- onMounted(() => {
11872
- if (__props.animateOnMount) tween(0, __props.value);
11873
- else render(__props.value);
11874
- });
11875
- watch(() => __props.value, (next) => tween(current, next));
11876
- watch(formatter, () => render(current));
11877
- onBeforeUnmount(cancel);
11878
11878
  return (_ctx, _cache) => {
11879
11879
  return openBlock(), createElementBlock("span", {
11880
11880
  ref: "label",
@@ -12010,10 +12010,22 @@ var FluxVisualSlotText_default = /* @__PURE__ */ defineComponent({
12010
12010
  let state = null;
12011
12011
  let revertTimeout;
12012
12012
  let restingText;
12013
- const glyph = (char) => char === " " ? NBSP : char;
12014
- const chromaticColor = (index, total) => {
12013
+ watch(() => __props.text, (value) => set(value));
12014
+ onMounted(() => {
12015
+ const element = labelRef.value;
12016
+ if (element) buildSlotText(element, __props.text);
12017
+ });
12018
+ onBeforeUnmount(() => {
12019
+ window.clearTimeout(revertTimeout);
12020
+ const element = labelRef.value;
12021
+ if (element) clearSlotText(element, __props.text);
12022
+ });
12023
+ function glyph(char) {
12024
+ return char === " " ? NBSP : char;
12025
+ }
12026
+ function chromaticColor(index, total) {
12015
12027
  return `hsl(${(total <= 1 ? 0 : index / (total - 1)) * 320 % 360} 92% 60%)`;
12016
- };
12028
+ }
12017
12029
  function baseOptions() {
12018
12030
  return {
12019
12031
  direction: __props.direction,
@@ -12206,16 +12218,6 @@ var FluxVisualSlotText_default = /* @__PURE__ */ defineComponent({
12206
12218
  });
12207
12219
  }, revertAfter);
12208
12220
  }
12209
- onMounted(() => {
12210
- const element = labelRef.value;
12211
- if (element) buildSlotText(element, __props.text);
12212
- });
12213
- watch(() => __props.text, (value) => set(value));
12214
- onBeforeUnmount(() => {
12215
- window.clearTimeout(revertTimeout);
12216
- const element = labelRef.value;
12217
- if (element) clearSlotText(element, __props.text);
12218
- });
12219
12221
  __expose({
12220
12222
  flash,
12221
12223
  set
@@ -12254,6 +12256,8 @@ var FluxVisualTextScramble_default = /* @__PURE__ */ defineComponent({
12254
12256
  const labelRef = useTemplateRef("label");
12255
12257
  let frame = 0;
12256
12258
  let currentText = __props.text;
12259
+ watch(() => __props.text, (value) => set(value));
12260
+ onBeforeUnmount(cancel);
12257
12261
  function cancel() {
12258
12262
  if (frame) {
12259
12263
  cancelAnimationFrame(frame);
@@ -12338,8 +12342,6 @@ var FluxVisualTextScramble_default = /* @__PURE__ */ defineComponent({
12338
12342
  if (!element) return;
12339
12343
  scramble(element, currentText, currentText, true);
12340
12344
  }
12341
- watch(() => __props.text, (value) => set(value));
12342
- onBeforeUnmount(cancel);
12343
12345
  __expose({
12344
12346
  replay,
12345
12347
  set