@c15t/dev-tools 2.0.0 → 2.0.4
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 +64 -159
- package/dist/379.js +153 -13
- package/dist/index.cjs +153 -13
- package/dist/react.cjs +3 -3
- package/dist/tanstack.cjs +331 -541
- package/dist/tanstack.js +80 -15
- package/dist-types/tanstack.d.ts +45 -13
- package/dist-types/version.d.ts +1 -1
- package/package.json +18 -4
package/dist/tanstack.js
CHANGED
|
@@ -1,19 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { createDevToolsPanel } from "./379.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
import * as __rspack_external_react from "react";
|
|
4
|
+
const embeddedPanelStyle = {
|
|
5
|
+
height: '100%',
|
|
6
|
+
width: '100%',
|
|
7
|
+
minHeight: 0
|
|
8
|
+
};
|
|
9
|
+
const EMBEDDED_PANEL_RELEASE_DELAY_MS = 60000;
|
|
10
|
+
const sharedEmbeddedPanels = new Map();
|
|
11
|
+
function acquireEmbeddedPanel(namespace) {
|
|
12
|
+
const existingPanel = sharedEmbeddedPanels.get(namespace);
|
|
13
|
+
if (existingPanel) {
|
|
14
|
+
if (existingPanel.releaseTimeout) {
|
|
15
|
+
clearTimeout(existingPanel.releaseTimeout);
|
|
16
|
+
existingPanel.releaseTimeout = null;
|
|
17
|
+
}
|
|
18
|
+
existingPanel.refCount += 1;
|
|
19
|
+
return existingPanel;
|
|
20
|
+
}
|
|
21
|
+
const panel = createDevToolsPanel({
|
|
22
|
+
namespace,
|
|
23
|
+
mode: 'embedded'
|
|
24
|
+
});
|
|
25
|
+
const entry = {
|
|
26
|
+
panel,
|
|
27
|
+
refCount: 1,
|
|
28
|
+
releaseTimeout: null
|
|
29
|
+
};
|
|
30
|
+
sharedEmbeddedPanels.set(namespace, entry);
|
|
31
|
+
return entry;
|
|
32
|
+
}
|
|
33
|
+
function releaseEmbeddedPanel(namespace) {
|
|
34
|
+
const entry = sharedEmbeddedPanels.get(namespace);
|
|
35
|
+
if (!entry) return;
|
|
36
|
+
entry.refCount = Math.max(0, entry.refCount - 1);
|
|
37
|
+
if (entry.refCount > 0 || entry.releaseTimeout) return;
|
|
38
|
+
entry.releaseTimeout = setTimeout(()=>{
|
|
39
|
+
const currentEntry = sharedEmbeddedPanels.get(namespace);
|
|
40
|
+
if (!currentEntry || currentEntry.refCount > 0) return;
|
|
41
|
+
currentEntry.panel.destroy();
|
|
42
|
+
sharedEmbeddedPanels.delete(namespace);
|
|
43
|
+
}, EMBEDDED_PANEL_RELEASE_DELAY_MS);
|
|
44
|
+
}
|
|
45
|
+
function C15tTanStackDevtoolsPanel({ namespace = 'c15tStore', style, ...props }) {
|
|
46
|
+
const containerRef = __rspack_external_react.useRef(null);
|
|
47
|
+
__rspack_external_react.useLayoutEffect(()=>{
|
|
48
|
+
const container = containerRef.current;
|
|
49
|
+
if (!container) return;
|
|
50
|
+
const entry = acquireEmbeddedPanel(namespace);
|
|
51
|
+
container.replaceChildren(entry.panel.element);
|
|
52
|
+
return ()=>{
|
|
53
|
+
if (entry.panel.element.parentElement === container) container.removeChild(entry.panel.element);
|
|
54
|
+
releaseEmbeddedPanel(namespace);
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
57
|
+
namespace
|
|
58
|
+
]);
|
|
59
|
+
return __rspack_external_react.createElement('div', {
|
|
60
|
+
...props,
|
|
61
|
+
ref: containerRef,
|
|
62
|
+
style: {
|
|
63
|
+
...embeddedPanelStyle,
|
|
64
|
+
...style
|
|
16
65
|
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function createC15tDevtoolsPlugin(options = {}) {
|
|
69
|
+
const { namespace = 'c15tStore', id = 'c15t', name = 'c15t', defaultOpen = false, ...panelProps } = options;
|
|
70
|
+
return {
|
|
71
|
+
id,
|
|
72
|
+
name,
|
|
73
|
+
defaultOpen,
|
|
74
|
+
render: __rspack_external_react.createElement(C15tTanStackDevtoolsPanel, {
|
|
75
|
+
...panelProps,
|
|
76
|
+
namespace
|
|
77
|
+
})
|
|
17
78
|
};
|
|
18
79
|
}
|
|
19
|
-
|
|
80
|
+
function c15tDevtools(options = {}) {
|
|
81
|
+
return createC15tDevtoolsPlugin(options);
|
|
82
|
+
}
|
|
83
|
+
const c15tDevtoolsPlugin = c15tDevtools;
|
|
84
|
+
export { C15tTanStackDevtoolsPanel, c15tDevtools, c15tDevtoolsPlugin };
|
package/dist-types/tanstack.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TanStack DevTools
|
|
2
|
+
* TanStack DevTools integration
|
|
3
3
|
*
|
|
4
|
-
* Provides
|
|
4
|
+
* Provides a React panel component and plugin factory that follow
|
|
5
|
+
* TanStack Devtools' documented `render: <Panel />` API.
|
|
5
6
|
*
|
|
6
7
|
* @example
|
|
7
8
|
* ```tsx
|
|
@@ -20,26 +21,57 @@
|
|
|
20
21
|
*
|
|
21
22
|
* @packageDocumentation
|
|
22
23
|
*/
|
|
24
|
+
import type { HTMLAttributes, ReactElement } from 'react';
|
|
25
|
+
import * as React from 'react';
|
|
23
26
|
/**
|
|
24
|
-
*
|
|
27
|
+
* Props for the embedded c15t panel used inside TanStack Devtools.
|
|
25
28
|
*/
|
|
26
|
-
export interface
|
|
29
|
+
export interface C15tTanStackDevtoolsPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
30
|
+
/**
|
|
31
|
+
* Namespace for the c15tStore on window.
|
|
32
|
+
* @default 'c15tStore'
|
|
33
|
+
*/
|
|
34
|
+
namespace?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Plugin configuration for React TanStack Devtools.
|
|
38
|
+
*/
|
|
39
|
+
export interface TanStackDevtoolsPlugin {
|
|
40
|
+
id?: string;
|
|
27
41
|
name: string;
|
|
28
|
-
|
|
29
|
-
render:
|
|
42
|
+
defaultOpen?: boolean;
|
|
43
|
+
render: ReactElement;
|
|
30
44
|
}
|
|
31
45
|
/**
|
|
32
|
-
* Options for the c15t
|
|
46
|
+
* Options for the c15t TanStack Devtools plugin factory.
|
|
33
47
|
*/
|
|
34
|
-
export interface C15tDevtoolsPluginOptions {
|
|
48
|
+
export interface C15tDevtoolsPluginOptions extends C15tTanStackDevtoolsPanelProps {
|
|
35
49
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @default '
|
|
50
|
+
* Stable plugin identifier used by TanStack Devtools.
|
|
51
|
+
* @default 'c15t'
|
|
38
52
|
*/
|
|
39
|
-
|
|
53
|
+
id?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Display name shown in the TanStack Devtools sidebar.
|
|
56
|
+
* @default 'c15t'
|
|
57
|
+
*/
|
|
58
|
+
name?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the c15t panel should be open on first load.
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
defaultOpen?: boolean;
|
|
40
64
|
}
|
|
41
65
|
/**
|
|
42
|
-
*
|
|
66
|
+
* React panel component for embedding c15t DevTools inside TanStack Devtools.
|
|
67
|
+
*/
|
|
68
|
+
export declare function C15tTanStackDevtoolsPanel({ namespace, style, ...props }: C15tTanStackDevtoolsPanelProps): React.JSX.Element;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a c15t plugin config for TanStack Devtools.
|
|
71
|
+
*/
|
|
72
|
+
export declare function c15tDevtools(options?: C15tDevtoolsPluginOptions): TanStackDevtoolsPlugin;
|
|
73
|
+
/**
|
|
74
|
+
* Backward-compatible alias for the TanStack Devtools plugin factory.
|
|
43
75
|
*/
|
|
44
|
-
export declare
|
|
76
|
+
export declare const c15tDevtoolsPlugin: typeof c15tDevtools;
|
|
45
77
|
export type { DevToolsPosition, DevToolsTab } from './core/state-manager';
|
package/dist-types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.0.
|
|
1
|
+
export declare const version = "2.0.4";
|
package/package.json
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/dev-tools",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.4",
|
|
4
|
+
"description": "Developer tools for c15t — React utilities for inspecting consent state, debugging, and dogfooding the SDK.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"c15t",
|
|
7
|
+
"consent",
|
|
8
|
+
"privacy",
|
|
9
|
+
"developer-tools",
|
|
10
|
+
"devtools",
|
|
11
|
+
"react",
|
|
12
|
+
"gdpr",
|
|
13
|
+
"cmp",
|
|
14
|
+
"debugging"
|
|
15
|
+
],
|
|
5
16
|
"homepage": "https://c15t.com",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/c15t/c15t/issues"
|
|
19
|
+
},
|
|
6
20
|
"repository": {
|
|
7
21
|
"type": "git",
|
|
8
22
|
"url": "https://github.com/c15t/c15t.git",
|
|
@@ -38,7 +52,7 @@
|
|
|
38
52
|
"prebuild": "bunx genversion --esm --semi src/version.ts",
|
|
39
53
|
"build": "bun prebuild && rslib build && bun ../../scripts/normalize-dist-types.mjs",
|
|
40
54
|
"check-types": "bun prebuild && tsc --noEmit",
|
|
41
|
-
"dev": "bun prebuild && rslib build --watch",
|
|
55
|
+
"dev": "sh -c 'bun prebuild && rslib build --no-dts --no-clean && rslib build --watch --no-dts --no-clean'",
|
|
42
56
|
"fmt": "bun biome format --write . && bun biome check --formatter-enabled=false --linter-enabled=false --write",
|
|
43
57
|
"lint": "bun biome lint ./src"
|
|
44
58
|
},
|
|
@@ -53,7 +67,7 @@
|
|
|
53
67
|
"@radix-ui/react-slot": "1.2.4",
|
|
54
68
|
"@radix-ui/react-switch": "1.2.6",
|
|
55
69
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
56
|
-
"c15t": "2.0.
|
|
70
|
+
"c15t": "2.0.4",
|
|
57
71
|
"class-variance-authority": "^0.7.1",
|
|
58
72
|
"lucide-react": "^1.7.0",
|
|
59
73
|
"motion": "^12.38.0",
|