@c15t/dev-tools 2.0.0-rc.8 → 2.0.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.
package/dist/tanstack.js CHANGED
@@ -1,19 +1,84 @@
1
+ "use client";
1
2
  import { createDevToolsPanel } from "./379.js";
2
- function c15tDevtoolsPlugin(options = {}) {
3
- const { namespace = 'c15tStore' } = options;
4
- return {
5
- name: 'c15t',
6
- label: 'Consent',
7
- render: (container)=>{
8
- const panel = createDevToolsPanel({
9
- namespace,
10
- mode: 'embedded'
11
- });
12
- container.appendChild(panel.element);
13
- return ()=>{
14
- panel.destroy();
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
- export { c15tDevtoolsPlugin };
80
+ function c15tDevtools(options = {}) {
81
+ return createC15tDevtoolsPlugin(options);
82
+ }
83
+ const c15tDevtoolsPlugin = c15tDevtools;
84
+ export { C15tTanStackDevtoolsPanel, c15tDevtools, c15tDevtoolsPlugin };
@@ -1,7 +1,8 @@
1
1
  /**
2
- * TanStack DevTools Plugin
2
+ * TanStack DevTools integration
3
3
  *
4
- * Provides c15t integration for TanStack DevTools
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
- * TanStack DevTools plugin interface
27
+ * Props for the embedded c15t panel used inside TanStack Devtools.
25
28
  */
26
- export interface DevToolsPlugin {
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
- label: string;
29
- render: (container: HTMLElement) => () => void;
42
+ defaultOpen?: boolean;
43
+ render: ReactElement;
30
44
  }
31
45
  /**
32
- * Options for the c15t DevTools plugin
46
+ * Options for the c15t TanStack Devtools plugin factory.
33
47
  */
34
- export interface C15tDevtoolsPluginOptions {
48
+ export interface C15tDevtoolsPluginOptions extends C15tTanStackDevtoolsPanelProps {
35
49
  /**
36
- * Namespace for the c15tStore on window
37
- * @default 'c15tStore'
50
+ * Stable plugin identifier used by TanStack Devtools.
51
+ * @default 'c15t'
38
52
  */
39
- namespace?: string;
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
- * Creates a c15t plugin for TanStack DevTools
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 function c15tDevtoolsPlugin(options?: C15tDevtoolsPluginOptions): DevToolsPlugin;
76
+ export declare const c15tDevtoolsPlugin: typeof c15tDevtools;
45
77
  export type { DevToolsPosition, DevToolsTab } from './core/state-manager';
@@ -1 +1 @@
1
- export declare const version = "2.0.0-rc.8";
1
+ export declare const version = "2.0.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c15t/dev-tools",
3
- "version": "2.0.0-rc.8",
3
+ "version": "2.0.1",
4
4
  "description": "A collection of developer tools and utilities for the c15t ecosystem, currently under active development.",
5
5
  "homepage": "https://c15t.com",
6
6
  "repository": {
@@ -8,7 +8,7 @@
8
8
  "url": "https://github.com/c15t/c15t.git",
9
9
  "directory": "packages/dev-tools"
10
10
  },
11
- "license": "GPL-3.0-only",
11
+ "license": "Apache-2.0",
12
12
  "type": "module",
13
13
  "exports": {
14
14
  ".": {
@@ -53,9 +53,8 @@
53
53
  "@radix-ui/react-slot": "1.2.4",
54
54
  "@radix-ui/react-switch": "1.2.6",
55
55
  "@radix-ui/react-tooltip": "^1.2.8",
56
- "c15t": "2.0.0-rc.8",
56
+ "c15t": "2.0.0",
57
57
  "class-variance-authority": "^0.7.1",
58
- "clsx": "2.1.1",
59
58
  "lucide-react": "^1.7.0",
60
59
  "motion": "^12.38.0",
61
60
  "react-draggable": "^4.5.0",
@@ -65,7 +64,7 @@
65
64
  "zustand": "^5.0.12"
66
65
  },
67
66
  "devDependencies": {
68
- "@c15t/typescript-config": "0.0.1-beta.1",
67
+ "@c15t/typescript-config": "0.0.1",
69
68
  "@types/react": "19.2.14",
70
69
  "@types/react-dom": "19.2.3",
71
70
  "postcss": "^8.5.8"