@nice-code/state 0.11.0 → 0.13.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.
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
4
|
-
//#endregion
|
|
5
2
|
let react = require("react");
|
|
6
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
4
|
let _tanstack_react_virtual = require("@tanstack/react-virtual");
|
|
@@ -212,6 +209,44 @@ const DEVTOOL_JSON_PUNCTUATION = "#475569";
|
|
|
212
209
|
const MONO_FONT = "ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace";
|
|
213
210
|
const SANS_FONT = "ui-sans-serif, system-ui, sans-serif";
|
|
214
211
|
//#endregion
|
|
212
|
+
//#region ../nice-devtools-shared/src/env.ts
|
|
213
|
+
function readViteEnv() {
|
|
214
|
+
try {
|
|
215
|
+
return {}.env;
|
|
216
|
+
} catch {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function readNodeEnv() {
|
|
221
|
+
try {
|
|
222
|
+
return process.env.NODE_ENV;
|
|
223
|
+
} catch {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Whether the devtools should be active.
|
|
229
|
+
*
|
|
230
|
+
* Detection order: Vite's `import.meta.env`, then `process.env.NODE_ENV`, then —
|
|
231
|
+
* if neither is resolvable (e.g. unbundled browser ESM) — default to enabled so
|
|
232
|
+
* the panel never silently vanishes. Real production builds always resolve one
|
|
233
|
+
* of the first two and correctly get `false`.
|
|
234
|
+
*
|
|
235
|
+
* `forceEnable` short-circuits to `true` for consumers who want the panel in
|
|
236
|
+
* production builds as well.
|
|
237
|
+
*/
|
|
238
|
+
function isDevtoolsEnabled(forceEnable) {
|
|
239
|
+
if (forceEnable === true) return true;
|
|
240
|
+
const viteEnv = readViteEnv();
|
|
241
|
+
if (viteEnv != null) {
|
|
242
|
+
if (typeof viteEnv.DEV === "boolean") return viteEnv.DEV;
|
|
243
|
+
if (typeof viteEnv.MODE === "string") return viteEnv.MODE !== "production";
|
|
244
|
+
}
|
|
245
|
+
const nodeEnv = readNodeEnv();
|
|
246
|
+
if (nodeEnv != null) return nodeEnv !== "production";
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
215
250
|
//#region ../nice-devtools-shared/src/format.ts
|
|
216
251
|
/** Pretty-print any value to JSON, degrading gracefully for cyclic / non-JSON values. */
|
|
217
252
|
function safeStringify(value, indent = 2) {
|
|
@@ -479,32 +514,6 @@ function SectionLabel({ label, color = DEVTOOL_COLOR_SEMANTIC_SYSTEM }) {
|
|
|
479
514
|
});
|
|
480
515
|
}
|
|
481
516
|
//#endregion
|
|
482
|
-
//#region ../../node_modules/.bun/react-dom@19.2.7+e14d3f224186685e/node_modules/react-dom/cjs/react-dom.production.js
|
|
483
|
-
/**
|
|
484
|
-
* @license React
|
|
485
|
-
* react-dom.production.js
|
|
486
|
-
*
|
|
487
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
488
|
-
*
|
|
489
|
-
* This source code is licensed under the MIT license found in the
|
|
490
|
-
* LICENSE file in the root directory of this source tree.
|
|
491
|
-
*/
|
|
492
|
-
var require_react_dom_production = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
493
|
-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
494
|
-
}));
|
|
495
|
-
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
496
|
-
function checkDCE() {
|
|
497
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") return;
|
|
498
|
-
try {
|
|
499
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
|
|
500
|
-
} catch (err) {
|
|
501
|
-
console.error(err);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
checkDCE();
|
|
505
|
-
module.exports = require_react_dom_production();
|
|
506
|
-
})))();
|
|
507
|
-
//#endregion
|
|
508
517
|
//#region ../nice-devtools-shared/src/components/PanelChrome.tsx
|
|
509
518
|
const DOCKED_SIZE_MIN = 140;
|
|
510
519
|
const POSITION_GRID = [
|
|
@@ -2537,7 +2546,7 @@ const EMPTY_SNAPSHOT = {
|
|
|
2537
2546
|
paused: false
|
|
2538
2547
|
};
|
|
2539
2548
|
function NiceStateDevtools({ forceEnable, ...props }) {
|
|
2540
|
-
if (!forceEnable
|
|
2549
|
+
if (!isDevtoolsEnabled(forceEnable)) return null;
|
|
2541
2550
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NiceStateDevtools_Panel, { ...props });
|
|
2542
2551
|
}
|
|
2543
2552
|
function NiceStateDevtools_Panel({ core, position: defaultPosition = "dock-right", initialOpen = false }) {
|