@fuf-stack/pixels 0.33.2 → 0.34.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.
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkLBJ3YG36cjs = require('../chunk-LBJ3YG36.cjs');
4
+ var _chunk7UNMWC2Wcjs = require('../chunk-7UNMWC2W.cjs');
5
5
  require('../chunk-4X43AGXE.cjs');
6
6
  require('../chunk-D4TLDLEX.cjs');
7
7
 
8
8
 
9
9
 
10
- exports.Json = _chunkLBJ3YG36cjs.Json_default; exports.default = _chunkLBJ3YG36cjs.Json_default2;
10
+ exports.Json = _chunk7UNMWC2Wcjs.Json_default; exports.default = _chunk7UNMWC2Wcjs.Json_default2;
11
11
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Json_default,
3
3
  Json_default2
4
- } from "../chunk-OPDWDH3W.js";
4
+ } from "../chunk-J7QVKEAW.js";
5
5
  import "../chunk-HL5BEHIS.js";
6
6
  import "../chunk-J7N2552D.js";
7
7
  export {
@@ -2701,6 +2701,20 @@ var NullRenderer_default = NullRenderer;
2701
2701
 
2702
2702
  // src/Json/Json.tsx
2703
2703
 
2704
+ var handleCopy = (rawValue, onCopy) => {
2705
+ let isObject = false;
2706
+ try {
2707
+ if (rawValue !== NullRenderer_default && typeof rawValue === "object") {
2708
+ isObject = true;
2709
+ }
2710
+ } catch (_err) {
2711
+ }
2712
+ const copyValue = isObject ? JSON.stringify(rawValue) : rawValue;
2713
+ setTimeout(() => navigator.clipboard.writeText(copyValue), 1);
2714
+ if (onCopy) {
2715
+ onCopy(copyValue);
2716
+ }
2717
+ };
2704
2718
  var Json = ({
2705
2719
  className = void 0,
2706
2720
  collapsed = false,
@@ -2715,10 +2729,6 @@ var Json = ({
2715
2729
  () => resolvedTheme === "dark" || document.body.classList.contains("dark"),
2716
2730
  [resolvedTheme]
2717
2731
  );
2718
- const handleCopy = (event) => {
2719
- const copiedValue = event.currentTarget.textContent || "";
2720
- onCopy == null ? void 0 : onCopy(copiedValue);
2721
- };
2722
2732
  let content = null;
2723
2733
  let error = null;
2724
2734
  try {
@@ -2738,7 +2748,7 @@ var Json = ({
2738
2748
  backgroundColor: "unset"
2739
2749
  }),
2740
2750
  value: parsedValue,
2741
- onCopy: handleCopy,
2751
+ onCopied: (_, rawValue) => handleCopy(rawValue, onCopy),
2742
2752
  children: [
2743
2753
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CopiedRenderer_default, {}),
2744
2754
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NullRenderer_default, {})
@@ -2770,4 +2780,4 @@ var Json_default2 = Json_default;
2770
2780
 
2771
2781
 
2772
2782
  exports.Json_default = Json_default; exports.Json_default2 = Json_default2;
2773
- //# sourceMappingURL=chunk-LBJ3YG36.cjs.map
2783
+ //# sourceMappingURL=chunk-7UNMWC2W.cjs.map