@neo-ui-kit/react 1.3.17 → 1.3.18

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/README.md CHANGED
@@ -65,7 +65,7 @@ import "@neo-ui-kit/react/styles.css";
65
65
  To test repository changes before publishing, run `npm run package` from the repository root and install the resulting archive in a separate application:
66
66
 
67
67
  ```bash
68
- npm install /path/to/adui/release/neo-ui-kit-react-1.3.17.tgz
68
+ npm install /path/to/adui/release/neo-ui-kit-react-1.3.18.tgz
69
69
  ```
70
70
 
71
71
  Maintainers publish new versions from `Pro100Dimka/adui` using the `release.yml` GitHub Actions workflow, a matching `v<version>` tag, and the `npm-publication` environment. npm trusts its OIDC identity; no `NPM_TOKEN` is required. The workflow checks the project and packed consumer before publishing the tested archive. Published `1.0.0` cannot be overwritten: code and README changes in npm require a new package version. See the [repository release instructions](https://github.com/Pro100Dimka/adui#npm-пакет).
@@ -2590,6 +2590,7 @@ var RotaryKnob = (p) => {
2590
2590
  const baseRef = useRef14(null);
2591
2591
  const feedbackRef = useRef14(null);
2592
2592
  const rotorRef = useRef14(null);
2593
+ const rasterRef = useRef14(null);
2593
2594
  const controlRef = useRef14(null);
2594
2595
  const readoutRef = useRef14(null);
2595
2596
  const controllerRef = useRef14(null);
@@ -2660,6 +2661,69 @@ var RotaryKnob = (p) => {
2660
2661
  let previousFrame = 0;
2661
2662
  let disposed = false;
2662
2663
  let renderingSize = 0;
2664
+ let rasterTimer = 0;
2665
+ const raster = rasterRef.current;
2666
+ const rasterContext = paintable ? raster?.getContext("2d") : null;
2667
+ function invalidateRaster() {
2668
+ clearTimeout(rasterTimer);
2669
+ if (!rasterContext || !("filter" in rasterContext) || !raster) return;
2670
+ raster.hidden = true;
2671
+ delete root.dataset.rasterized;
2672
+ if (!disposed) rasterTimer = window.setTimeout(cacheRaster, 500);
2673
+ }
2674
+ function cacheRaster() {
2675
+ if (!raster || !rasterContext || disposed || renderingSize || drag || animationFrame || root.matches(":hover") || !canvas.width) return;
2676
+ const size = parseFloat(getComputedStyle(root).width);
2677
+ if (!size) return;
2678
+ const ratio = devicePixelRatio || 1;
2679
+ const padding = Math.ceil(parseFloat(getComputedStyle(root).fontSize) * 8);
2680
+ const extent = size + padding * 2;
2681
+ raster.width = raster.height = Math.ceil(extent * ratio);
2682
+ Object.assign(raster.style, {
2683
+ left: `${-padding}px`,
2684
+ top: `${-padding}px`,
2685
+ width: `${raster.width / ratio}px`,
2686
+ height: `${raster.height / ratio}px`
2687
+ });
2688
+ const turned = document.createElement("canvas");
2689
+ turned.width = turned.height = Math.ceil(size * ratio);
2690
+ const turning = turned.getContext("2d");
2691
+ if (!turning) return;
2692
+ turning.translate(size * ratio / 2, size * ratio / 2);
2693
+ turning.rotate((valueAngle(visualValue) - initialAngle) / degrees);
2694
+ turning.drawImage(
2695
+ rotor,
2696
+ -size * ratio / 2,
2697
+ -size * ratio / 2,
2698
+ size * ratio,
2699
+ size * ratio
2700
+ );
2701
+ for (const [source, element] of [
2702
+ [canvas, canvas],
2703
+ [feedback, feedback],
2704
+ [turned, rotor.parentElement]
2705
+ ]) {
2706
+ if (!element) return;
2707
+ rasterContext.filter = getComputedStyle(element).filter.replace(
2708
+ /(-?[\d.]+)px/g,
2709
+ (_, pixels) => `${Number(pixels) * ratio}px`
2710
+ );
2711
+ rasterContext.drawImage(
2712
+ source,
2713
+ 0,
2714
+ 0,
2715
+ source === turned ? size * ratio : source.width,
2716
+ source === turned ? size * ratio : source.height,
2717
+ padding * ratio,
2718
+ padding * ratio,
2719
+ size * ratio,
2720
+ size * ratio
2721
+ );
2722
+ }
2723
+ rasterContext.filter = "none";
2724
+ raster.hidden = false;
2725
+ root.dataset.rasterized = "true";
2726
+ }
2663
2727
  async function render() {
2664
2728
  if (disposed || !painted) return;
2665
2729
  const cssSize = root.getBoundingClientRect().width;
@@ -2671,6 +2735,7 @@ var RotaryKnob = (p) => {
2671
2735
  );
2672
2736
  if (!size || renderingSize === size || [canvas, rotor, feedback].every((layer) => layer.width === size && layer.height === size)) return;
2673
2737
  renderingSize = size;
2738
+ invalidateRaster();
2674
2739
  canvas.width = canvas.height = size;
2675
2740
  const center = size / 2;
2676
2741
  const radius = size * 0.445;
@@ -2947,6 +3012,7 @@ var RotaryKnob = (p) => {
2947
3012
  }
2948
3013
  function paintFeedback() {
2949
3014
  if (!painted || !feedback.width || disposed) return;
3015
+ invalidateRaster();
2950
3016
  const scale2 = feedback.width * 0.445;
2951
3017
  const start = (startAngle - 90) / degrees;
2952
3018
  const end = (valueAngle(visualValue) - 90) / degrees;
@@ -3254,6 +3320,14 @@ var RotaryKnob = (p) => {
3254
3320
  root.addEventListener("pointerleave", resetHover, {
3255
3321
  signal: listeners.signal
3256
3322
  });
3323
+ for (const event of ["pointerenter", "pointerleave"])
3324
+ root.addEventListener(event, invalidateRaster, { signal: listeners.signal });
3325
+ const tokens = typeof MutationObserver === "undefined" ? null : new MutationObserver(invalidateRaster);
3326
+ for (let node = root; node; node = node.parentElement)
3327
+ tokens?.observe(node, {
3328
+ attributes: true,
3329
+ attributeFilter: ["style", "class", "data-ad-theme", "data-ad-color-scheme"]
3330
+ });
3257
3331
  window.addEventListener("blur", () => finishDrag(true), {
3258
3332
  signal: listeners.signal
3259
3333
  });
@@ -3289,6 +3363,8 @@ var RotaryKnob = (p) => {
3289
3363
  finishDrag();
3290
3364
  listeners.abort();
3291
3365
  observer.disconnect();
3366
+ tokens?.disconnect();
3367
+ clearTimeout(rasterTimer);
3292
3368
  clearTimeout(renderTimer);
3293
3369
  cancelAnimationFrame(animationFrame);
3294
3370
  cancelAnimationFrame(hoverFrame);
@@ -3350,6 +3426,7 @@ var RotaryKnob = (p) => {
3350
3426
  }
3351
3427
  ),
3352
3428
  /* @__PURE__ */ jsx29("span", { className: "knob__surface knob__rotor-frame", "aria-hidden": "true", children: /* @__PURE__ */ jsx29("canvas", { className: "knob__rotor", ref: rotorRef }) }),
3429
+ /* @__PURE__ */ jsx29("canvas", { className: "knob__raster", ref: rasterRef, hidden: true, "aria-hidden": "true" }),
3353
3430
  /* @__PURE__ */ jsx29("span", { className: "knob__sheen", "aria-hidden": "true" }),
3354
3431
  /* @__PURE__ */ jsx29(
3355
3432
  "div",
@@ -76,6 +76,13 @@
76
76
  user-select: none;
77
77
  -webkit-user-select: none;
78
78
  }
79
+ .ad-rotary-knob .knob__raster {
80
+ position: absolute;
81
+ pointer-events: none;
82
+ }
83
+ .ad-rotary-knob[data-rasterized] .knob__surface {
84
+ visibility: hidden;
85
+ }
79
86
  .ad-rotary-knob .knob__control:active,
80
87
  .ad-rotary-knob.is-dragging .knob__control {
81
88
  cursor: grabbing;
package/dist/forms.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  defaultFieldRegistry,
5
5
  useForm,
6
6
  useFormContext
7
- } from "./chunks/chunk-TMCWA446.js";
7
+ } from "./chunks/chunk-NTNL3ELP.js";
8
8
  import "./chunks/chunk-6VPAU3TV.js";
9
9
  import "./chunks/chunk-BJSFN52W.js";
10
10
  import "./chunks/chunk-FCOU3ODR.js";
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  useSvgId,
63
63
  variantMaterial,
64
64
  vectorElement
65
- } from "./chunks/chunk-TMCWA446.js";
65
+ } from "./chunks/chunk-NTNL3ELP.js";
66
66
  import {
67
67
  ThemeProvider,
68
68
  createNeonRenderer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo-ui-kit/react",
3
- "version": "1.3.17",
3
+ "version": "1.3.18",
4
4
  "description": "NEO UI — React component library",
5
5
  "type": "module",
6
6
  "license": "MIT",