@c15t/dev-tools 2.0.0 → 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/README.md +42 -7
- 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 +1 -1
package/README.md
CHANGED
|
@@ -77,22 +77,57 @@ devtools.destroy();
|
|
|
77
77
|
|
|
78
78
|
### TanStack DevTools Plugin
|
|
79
79
|
|
|
80
|
-
Integrate
|
|
80
|
+
Integrate c15t into TanStack Devtools with the same `render: <Panel />` pattern
|
|
81
|
+
used by the official TanStack plugins:
|
|
81
82
|
|
|
82
83
|
```tsx
|
|
84
|
+
import * as React from 'react';
|
|
85
|
+
import { useRouter } from '@tanstack/react-router';
|
|
83
86
|
import { TanStackDevtools } from '@tanstack/react-devtools';
|
|
84
|
-
import {
|
|
87
|
+
import { ReactQueryDevtoolsPanel } from '@tanstack/react-query-devtools';
|
|
88
|
+
import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools';
|
|
89
|
+
import { c15tDevtools } from '@c15t/dev-tools/tanstack';
|
|
90
|
+
|
|
91
|
+
export function AppDevtools() {
|
|
92
|
+
const router = useRouter();
|
|
85
93
|
|
|
86
|
-
function App() {
|
|
87
94
|
return (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
<TanStackDevtools
|
|
96
|
+
plugins={[
|
|
97
|
+
{
|
|
98
|
+
name: 'TanStack Query',
|
|
99
|
+
render: <ReactQueryDevtoolsPanel />,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'TanStack Router',
|
|
103
|
+
render: <TanStackRouterDevtoolsPanel router={router} />,
|
|
104
|
+
},
|
|
105
|
+
c15tDevtools({
|
|
106
|
+
defaultOpen: true,
|
|
107
|
+
}),
|
|
108
|
+
]}
|
|
109
|
+
/>
|
|
92
110
|
);
|
|
93
111
|
}
|
|
94
112
|
```
|
|
95
113
|
|
|
114
|
+
If you want full control over the plugin entry, you can also render the exported
|
|
115
|
+
panel component directly:
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
import { C15tTanStackDevtoolsPanel } from '@c15t/dev-tools/tanstack';
|
|
119
|
+
|
|
120
|
+
<TanStackDevtools
|
|
121
|
+
plugins={[
|
|
122
|
+
{
|
|
123
|
+
id: 'c15t',
|
|
124
|
+
name: 'c15t',
|
|
125
|
+
render: <C15tTanStackDevtoolsPanel namespace="c15tStore" />,
|
|
126
|
+
},
|
|
127
|
+
]}
|
|
128
|
+
/>
|
|
129
|
+
```
|
|
130
|
+
|
|
96
131
|
## Console API
|
|
97
132
|
|
|
98
133
|
The DevTools expose a global API for quick debugging:
|
package/dist/379.js
CHANGED
|
@@ -2710,7 +2710,7 @@ function createPanel(options) {
|
|
|
2710
2710
|
}
|
|
2711
2711
|
}));
|
|
2712
2712
|
footerElement.appendChild(renderer_span({
|
|
2713
|
-
text: "v2.0.
|
|
2713
|
+
text: "v2.0.1"
|
|
2714
2714
|
}));
|
|
2715
2715
|
}
|
|
2716
2716
|
function renderErrorState(container) {
|
|
@@ -6731,6 +6731,133 @@ function createStateCopy(state) {
|
|
|
6731
6731
|
loadedScripts: state.loadedScripts
|
|
6732
6732
|
};
|
|
6733
6733
|
}
|
|
6734
|
+
const EMBEDDED_TABS = [
|
|
6735
|
+
{
|
|
6736
|
+
id: 'location',
|
|
6737
|
+
label: 'Location'
|
|
6738
|
+
},
|
|
6739
|
+
{
|
|
6740
|
+
id: 'policy',
|
|
6741
|
+
label: 'Policy'
|
|
6742
|
+
},
|
|
6743
|
+
{
|
|
6744
|
+
id: 'consents',
|
|
6745
|
+
label: 'Consents'
|
|
6746
|
+
},
|
|
6747
|
+
{
|
|
6748
|
+
id: "scripts",
|
|
6749
|
+
label: 'Scripts'
|
|
6750
|
+
},
|
|
6751
|
+
{
|
|
6752
|
+
id: 'iab',
|
|
6753
|
+
label: 'IAB'
|
|
6754
|
+
},
|
|
6755
|
+
{
|
|
6756
|
+
id: 'actions',
|
|
6757
|
+
label: 'Actions'
|
|
6758
|
+
},
|
|
6759
|
+
{
|
|
6760
|
+
id: 'events',
|
|
6761
|
+
label: 'Events'
|
|
6762
|
+
}
|
|
6763
|
+
];
|
|
6764
|
+
const EMBEDDED_THEME_VARIABLES = {
|
|
6765
|
+
'--c15t-surface': '#1f222b',
|
|
6766
|
+
'--c15t-surface-hover': '#272b35',
|
|
6767
|
+
'--c15t-surface-muted': '#252933',
|
|
6768
|
+
'--c15t-border': 'rgba(255, 255, 255, 0.08)',
|
|
6769
|
+
'--c15t-border-hover': 'rgba(255, 255, 255, 0.16)',
|
|
6770
|
+
'--c15t-text': '#eef2ff',
|
|
6771
|
+
'--c15t-text-muted': '#99a2b3',
|
|
6772
|
+
'--c15t-primary': '#8b5cf6',
|
|
6773
|
+
'--c15t-primary-hover': '#7c3aed',
|
|
6774
|
+
'--c15t-text-on-primary': '#f7f3ff',
|
|
6775
|
+
'--c15t-shadow-sm': 'none',
|
|
6776
|
+
'--c15t-shadow-md': 'none',
|
|
6777
|
+
'--c15t-devtools-surface-elevated': '#1f222b',
|
|
6778
|
+
'--c15t-devtools-surface-muted': '#272b35',
|
|
6779
|
+
'--c15t-devtools-surface-subtle': '#181b22',
|
|
6780
|
+
'--c15t-devtools-border-strong': 'rgba(255, 255, 255, 0.08)',
|
|
6781
|
+
'--c15t-devtools-code-surface': '#15181f',
|
|
6782
|
+
'--c15t-devtools-accent-soft': 'rgba(139, 92, 246, 0.18)',
|
|
6783
|
+
'--c15t-devtools-focus-ring': '#8b5cf6',
|
|
6784
|
+
'--c15t-devtools-badge-success-bg': 'rgba(16, 185, 129, 0.16)',
|
|
6785
|
+
'--c15t-devtools-badge-error-bg': 'rgba(248, 113, 113, 0.18)',
|
|
6786
|
+
'--c15t-devtools-badge-warning-bg': 'rgba(251, 191, 36, 0.18)',
|
|
6787
|
+
'--c15t-devtools-badge-info-bg': 'rgba(96, 165, 250, 0.18)',
|
|
6788
|
+
'--c15t-devtools-badge-neutral-bg': 'rgba(148, 163, 184, 0.16)',
|
|
6789
|
+
'--c15t-devtools-embedded-tab-active-border': 'rgba(139, 92, 246, 0.55)'
|
|
6790
|
+
};
|
|
6791
|
+
function createEmbeddedTabs(options) {
|
|
6792
|
+
const { onTabChange, disabledTabs = [] } = options;
|
|
6793
|
+
let activeTab = options.activeTab;
|
|
6794
|
+
const buttons = new Map();
|
|
6795
|
+
const tabList = renderer_div({
|
|
6796
|
+
role: 'tablist',
|
|
6797
|
+
ariaLabel: 'DevTools tabs',
|
|
6798
|
+
style: {
|
|
6799
|
+
display: 'flex',
|
|
6800
|
+
flexWrap: 'wrap',
|
|
6801
|
+
gap: '0.5rem',
|
|
6802
|
+
alignItems: 'center',
|
|
6803
|
+
paddingBottom: '0.25rem',
|
|
6804
|
+
borderBottom: '1px solid var(--c15t-devtools-border-strong, rgba(255, 255, 255, 0.08))'
|
|
6805
|
+
}
|
|
6806
|
+
});
|
|
6807
|
+
function applyButtonState(tab, buttonElement) {
|
|
6808
|
+
const isActive = tab === activeTab;
|
|
6809
|
+
const isDisabled = disabledTabs.includes(tab);
|
|
6810
|
+
buttonElement.disabled = isDisabled;
|
|
6811
|
+
buttonElement.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
6812
|
+
buttonElement.style.borderColor = isActive ? 'var(--c15t-devtools-embedded-tab-active-border, rgba(139, 92, 246, 0.55))' : 'transparent';
|
|
6813
|
+
buttonElement.style.backgroundColor = isActive ? 'var(--c15t-devtools-accent-soft, rgba(139, 92, 246, 0.18))' : 'transparent';
|
|
6814
|
+
buttonElement.style.color = isActive ? 'var(--c15t-text, #eef2ff)' : 'var(--c15t-text-muted, #99a2b3)';
|
|
6815
|
+
buttonElement.style.opacity = isDisabled ? '0.45' : '1';
|
|
6816
|
+
buttonElement.style.cursor = isDisabled ? 'not-allowed' : 'pointer';
|
|
6817
|
+
buttonElement.style.boxShadow = isActive ? 'inset 0 0 0 1px var(--c15t-devtools-embedded-tab-active-border, rgba(139, 92, 246, 0.55))' : 'none';
|
|
6818
|
+
}
|
|
6819
|
+
for (const tab of EMBEDDED_TABS){
|
|
6820
|
+
const buttonElement = renderer_button({
|
|
6821
|
+
role: 'tab',
|
|
6822
|
+
text: tab.label,
|
|
6823
|
+
onClick: ()=>{
|
|
6824
|
+
if (disabledTabs.includes(tab.id)) return;
|
|
6825
|
+
activeTab = tab.id;
|
|
6826
|
+
for (const [tabId, tabButton] of buttons)applyButtonState(tabId, tabButton);
|
|
6827
|
+
onTabChange(tab.id);
|
|
6828
|
+
},
|
|
6829
|
+
style: {
|
|
6830
|
+
display: 'inline-flex',
|
|
6831
|
+
alignItems: 'center',
|
|
6832
|
+
justifyContent: 'center',
|
|
6833
|
+
minHeight: '1.875rem',
|
|
6834
|
+
padding: '0.3125rem 0.75rem',
|
|
6835
|
+
border: '1px solid transparent',
|
|
6836
|
+
borderRadius: '999px',
|
|
6837
|
+
backgroundColor: 'transparent',
|
|
6838
|
+
fontFamily: 'inherit',
|
|
6839
|
+
fontSize: 'var(--c15t-devtools-font-size-xs, 0.75rem)',
|
|
6840
|
+
fontWeight: '500',
|
|
6841
|
+
lineHeight: '1.25',
|
|
6842
|
+
transition: 'background-color var(--c15t-duration-fast, 100ms) var(--c15t-easing, cubic-bezier(0.4, 0, 0.2, 1)), border-color var(--c15t-duration-fast, 100ms) var(--c15t-easing, cubic-bezier(0.4, 0, 0.2, 1)), box-shadow var(--c15t-duration-fast, 100ms) var(--c15t-easing, cubic-bezier(0.4, 0, 0.2, 1)), color var(--c15t-duration-fast, 100ms) var(--c15t-easing, cubic-bezier(0.4, 0, 0.2, 1))'
|
|
6843
|
+
}
|
|
6844
|
+
});
|
|
6845
|
+
if ('iab' === tab.id) buttonElement.title = 'Available when IAB TCF mode is enabled';
|
|
6846
|
+
applyButtonState(tab.id, buttonElement);
|
|
6847
|
+
buttons.set(tab.id, buttonElement);
|
|
6848
|
+
tabList.appendChild(buttonElement);
|
|
6849
|
+
}
|
|
6850
|
+
return {
|
|
6851
|
+
element: tabList,
|
|
6852
|
+
setActiveTab: (tab)=>{
|
|
6853
|
+
activeTab = tab;
|
|
6854
|
+
for (const [tabId, tabButton] of buttons)applyButtonState(tabId, tabButton);
|
|
6855
|
+
},
|
|
6856
|
+
destroy: ()=>{
|
|
6857
|
+
buttons.clear();
|
|
6858
|
+
}
|
|
6859
|
+
};
|
|
6860
|
+
}
|
|
6734
6861
|
function scriptDebugEventToLogEntry(event) {
|
|
6735
6862
|
return {
|
|
6736
6863
|
type: "script",
|
|
@@ -6914,9 +7041,11 @@ function createDevTools(options = {}) {
|
|
|
6914
7041
|
return instance;
|
|
6915
7042
|
}
|
|
6916
7043
|
function createDevToolsPanel(options) {
|
|
6917
|
-
const { namespace = 'c15tStore' } = options;
|
|
7044
|
+
const { namespace = 'c15tStore', mode = 'standalone' } = options;
|
|
7045
|
+
const isEmbedded = 'embedded' === mode;
|
|
6918
7046
|
let detachInstrumentation = null;
|
|
6919
7047
|
let detachScriptDebug = null;
|
|
7048
|
+
let contentArea = null;
|
|
6920
7049
|
const stateManager = createStateManager({
|
|
6921
7050
|
isOpen: true
|
|
6922
7051
|
});
|
|
@@ -6944,6 +7073,7 @@ function createDevToolsPanel(options) {
|
|
|
6944
7073
|
gpc: persistedOverrides.gpc
|
|
6945
7074
|
});
|
|
6946
7075
|
}
|
|
7076
|
+
renderActivePanel();
|
|
6947
7077
|
},
|
|
6948
7078
|
onDisconnect: ()=>{
|
|
6949
7079
|
stateManager.setConnected(false);
|
|
@@ -6951,6 +7081,7 @@ function createDevToolsPanel(options) {
|
|
|
6951
7081
|
detachInstrumentation = null;
|
|
6952
7082
|
detachScriptDebug?.();
|
|
6953
7083
|
detachScriptDebug = null;
|
|
7084
|
+
renderActivePanel();
|
|
6954
7085
|
}
|
|
6955
7086
|
});
|
|
6956
7087
|
const panelRenderer = createPanelRenderer({
|
|
@@ -6983,25 +7114,33 @@ function createDevToolsPanel(options) {
|
|
|
6983
7114
|
display: 'flex',
|
|
6984
7115
|
flexDirection: 'column',
|
|
6985
7116
|
height: '100%',
|
|
6986
|
-
|
|
7117
|
+
boxSizing: 'border-box',
|
|
7118
|
+
gap: '0.75rem',
|
|
7119
|
+
padding: '0.75rem',
|
|
7120
|
+
fontFamily: 'inherit',
|
|
6987
7121
|
fontSize: 'var(--c15t-devtools-font-size-sm)',
|
|
6988
|
-
color: 'var(--c15t-
|
|
6989
|
-
backgroundColor: '
|
|
7122
|
+
color: isEmbedded ? 'var(--c15t-text, #eef2ff)' : 'inherit',
|
|
7123
|
+
backgroundColor: 'transparent',
|
|
7124
|
+
colorScheme: isEmbedded ? 'dark' : void 0,
|
|
7125
|
+
...isEmbedded ? EMBEDDED_THEME_VARIABLES : {}
|
|
6990
7126
|
}
|
|
6991
7127
|
});
|
|
6992
|
-
|
|
7128
|
+
contentArea = renderer_div({
|
|
6993
7129
|
style: {
|
|
6994
7130
|
flex: '1',
|
|
7131
|
+
minHeight: '0',
|
|
6995
7132
|
overflowY: 'auto',
|
|
6996
|
-
overscrollBehavior: 'contain'
|
|
7133
|
+
overscrollBehavior: 'contain',
|
|
7134
|
+
backgroundColor: 'transparent'
|
|
6997
7135
|
}
|
|
6998
7136
|
});
|
|
6999
7137
|
function renderActivePanel() {
|
|
7138
|
+
if (!contentArea) return;
|
|
7000
7139
|
const activeTab = syncTabs();
|
|
7001
7140
|
panelRenderer.renderPanel(contentArea, activeTab);
|
|
7002
7141
|
}
|
|
7003
7142
|
let tabsInstance = null;
|
|
7004
|
-
let
|
|
7143
|
+
let disabledTabsKey = '';
|
|
7005
7144
|
function getDisabledTabs() {
|
|
7006
7145
|
const disabledTabs = [];
|
|
7007
7146
|
const storeState = storeConnector.getState();
|
|
@@ -7010,16 +7149,16 @@ function createDevToolsPanel(options) {
|
|
|
7010
7149
|
}
|
|
7011
7150
|
function syncTabs() {
|
|
7012
7151
|
const disabledTabs = getDisabledTabs();
|
|
7013
|
-
const
|
|
7152
|
+
const nextDisabledTabsKey = disabledTabs.join('|');
|
|
7014
7153
|
let activeTab = stateManager.getState().activeTab;
|
|
7015
7154
|
if (disabledTabs.includes(activeTab)) {
|
|
7016
7155
|
activeTab = 'consents';
|
|
7017
7156
|
stateManager.setActiveTab(activeTab);
|
|
7018
7157
|
}
|
|
7019
|
-
if (tabsInstance &&
|
|
7158
|
+
if (tabsInstance && disabledTabsKey === nextDisabledTabsKey) tabsInstance.setActiveTab(activeTab);
|
|
7020
7159
|
else {
|
|
7021
7160
|
tabsInstance?.destroy();
|
|
7022
|
-
tabsInstance =
|
|
7161
|
+
tabsInstance = createEmbeddedTabs({
|
|
7023
7162
|
activeTab,
|
|
7024
7163
|
onTabChange: (tab)=>{
|
|
7025
7164
|
stateManager.setActiveTab(tab);
|
|
@@ -7027,8 +7166,9 @@ function createDevToolsPanel(options) {
|
|
|
7027
7166
|
},
|
|
7028
7167
|
disabledTabs
|
|
7029
7168
|
});
|
|
7030
|
-
|
|
7031
|
-
if (!tabsInstance.element.parentElement) container.
|
|
7169
|
+
disabledTabsKey = nextDisabledTabsKey;
|
|
7170
|
+
if (!tabsInstance.element.parentElement) if (contentArea?.parentElement === container) container.insertBefore(tabsInstance.element, contentArea);
|
|
7171
|
+
else container.appendChild(tabsInstance.element);
|
|
7032
7172
|
}
|
|
7033
7173
|
return activeTab;
|
|
7034
7174
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -2764,7 +2764,7 @@ var __webpack_exports__ = {};
|
|
|
2764
2764
|
}
|
|
2765
2765
|
}));
|
|
2766
2766
|
footerElement.appendChild(renderer_span({
|
|
2767
|
-
text: "v2.0.
|
|
2767
|
+
text: "v2.0.1"
|
|
2768
2768
|
}));
|
|
2769
2769
|
}
|
|
2770
2770
|
function renderErrorState(container) {
|
|
@@ -6785,6 +6785,133 @@ var __webpack_exports__ = {};
|
|
|
6785
6785
|
loadedScripts: state.loadedScripts
|
|
6786
6786
|
};
|
|
6787
6787
|
}
|
|
6788
|
+
const EMBEDDED_TABS = [
|
|
6789
|
+
{
|
|
6790
|
+
id: 'location',
|
|
6791
|
+
label: 'Location'
|
|
6792
|
+
},
|
|
6793
|
+
{
|
|
6794
|
+
id: 'policy',
|
|
6795
|
+
label: 'Policy'
|
|
6796
|
+
},
|
|
6797
|
+
{
|
|
6798
|
+
id: 'consents',
|
|
6799
|
+
label: 'Consents'
|
|
6800
|
+
},
|
|
6801
|
+
{
|
|
6802
|
+
id: "scripts",
|
|
6803
|
+
label: 'Scripts'
|
|
6804
|
+
},
|
|
6805
|
+
{
|
|
6806
|
+
id: 'iab',
|
|
6807
|
+
label: 'IAB'
|
|
6808
|
+
},
|
|
6809
|
+
{
|
|
6810
|
+
id: 'actions',
|
|
6811
|
+
label: 'Actions'
|
|
6812
|
+
},
|
|
6813
|
+
{
|
|
6814
|
+
id: 'events',
|
|
6815
|
+
label: 'Events'
|
|
6816
|
+
}
|
|
6817
|
+
];
|
|
6818
|
+
const EMBEDDED_THEME_VARIABLES = {
|
|
6819
|
+
'--c15t-surface': '#1f222b',
|
|
6820
|
+
'--c15t-surface-hover': '#272b35',
|
|
6821
|
+
'--c15t-surface-muted': '#252933',
|
|
6822
|
+
'--c15t-border': 'rgba(255, 255, 255, 0.08)',
|
|
6823
|
+
'--c15t-border-hover': 'rgba(255, 255, 255, 0.16)',
|
|
6824
|
+
'--c15t-text': '#eef2ff',
|
|
6825
|
+
'--c15t-text-muted': '#99a2b3',
|
|
6826
|
+
'--c15t-primary': '#8b5cf6',
|
|
6827
|
+
'--c15t-primary-hover': '#7c3aed',
|
|
6828
|
+
'--c15t-text-on-primary': '#f7f3ff',
|
|
6829
|
+
'--c15t-shadow-sm': 'none',
|
|
6830
|
+
'--c15t-shadow-md': 'none',
|
|
6831
|
+
'--c15t-devtools-surface-elevated': '#1f222b',
|
|
6832
|
+
'--c15t-devtools-surface-muted': '#272b35',
|
|
6833
|
+
'--c15t-devtools-surface-subtle': '#181b22',
|
|
6834
|
+
'--c15t-devtools-border-strong': 'rgba(255, 255, 255, 0.08)',
|
|
6835
|
+
'--c15t-devtools-code-surface': '#15181f',
|
|
6836
|
+
'--c15t-devtools-accent-soft': 'rgba(139, 92, 246, 0.18)',
|
|
6837
|
+
'--c15t-devtools-focus-ring': '#8b5cf6',
|
|
6838
|
+
'--c15t-devtools-badge-success-bg': 'rgba(16, 185, 129, 0.16)',
|
|
6839
|
+
'--c15t-devtools-badge-error-bg': 'rgba(248, 113, 113, 0.18)',
|
|
6840
|
+
'--c15t-devtools-badge-warning-bg': 'rgba(251, 191, 36, 0.18)',
|
|
6841
|
+
'--c15t-devtools-badge-info-bg': 'rgba(96, 165, 250, 0.18)',
|
|
6842
|
+
'--c15t-devtools-badge-neutral-bg': 'rgba(148, 163, 184, 0.16)',
|
|
6843
|
+
'--c15t-devtools-embedded-tab-active-border': 'rgba(139, 92, 246, 0.55)'
|
|
6844
|
+
};
|
|
6845
|
+
function createEmbeddedTabs(options) {
|
|
6846
|
+
const { onTabChange, disabledTabs = [] } = options;
|
|
6847
|
+
let activeTab = options.activeTab;
|
|
6848
|
+
const buttons = new Map();
|
|
6849
|
+
const tabList = renderer_div({
|
|
6850
|
+
role: 'tablist',
|
|
6851
|
+
ariaLabel: 'DevTools tabs',
|
|
6852
|
+
style: {
|
|
6853
|
+
display: 'flex',
|
|
6854
|
+
flexWrap: 'wrap',
|
|
6855
|
+
gap: '0.5rem',
|
|
6856
|
+
alignItems: 'center',
|
|
6857
|
+
paddingBottom: '0.25rem',
|
|
6858
|
+
borderBottom: '1px solid var(--c15t-devtools-border-strong, rgba(255, 255, 255, 0.08))'
|
|
6859
|
+
}
|
|
6860
|
+
});
|
|
6861
|
+
function applyButtonState(tab, buttonElement) {
|
|
6862
|
+
const isActive = tab === activeTab;
|
|
6863
|
+
const isDisabled = disabledTabs.includes(tab);
|
|
6864
|
+
buttonElement.disabled = isDisabled;
|
|
6865
|
+
buttonElement.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
6866
|
+
buttonElement.style.borderColor = isActive ? 'var(--c15t-devtools-embedded-tab-active-border, rgba(139, 92, 246, 0.55))' : 'transparent';
|
|
6867
|
+
buttonElement.style.backgroundColor = isActive ? 'var(--c15t-devtools-accent-soft, rgba(139, 92, 246, 0.18))' : 'transparent';
|
|
6868
|
+
buttonElement.style.color = isActive ? 'var(--c15t-text, #eef2ff)' : 'var(--c15t-text-muted, #99a2b3)';
|
|
6869
|
+
buttonElement.style.opacity = isDisabled ? '0.45' : '1';
|
|
6870
|
+
buttonElement.style.cursor = isDisabled ? 'not-allowed' : 'pointer';
|
|
6871
|
+
buttonElement.style.boxShadow = isActive ? 'inset 0 0 0 1px var(--c15t-devtools-embedded-tab-active-border, rgba(139, 92, 246, 0.55))' : 'none';
|
|
6872
|
+
}
|
|
6873
|
+
for (const tab of EMBEDDED_TABS){
|
|
6874
|
+
const buttonElement = renderer_button({
|
|
6875
|
+
role: 'tab',
|
|
6876
|
+
text: tab.label,
|
|
6877
|
+
onClick: ()=>{
|
|
6878
|
+
if (disabledTabs.includes(tab.id)) return;
|
|
6879
|
+
activeTab = tab.id;
|
|
6880
|
+
for (const [tabId, tabButton] of buttons)applyButtonState(tabId, tabButton);
|
|
6881
|
+
onTabChange(tab.id);
|
|
6882
|
+
},
|
|
6883
|
+
style: {
|
|
6884
|
+
display: 'inline-flex',
|
|
6885
|
+
alignItems: 'center',
|
|
6886
|
+
justifyContent: 'center',
|
|
6887
|
+
minHeight: '1.875rem',
|
|
6888
|
+
padding: '0.3125rem 0.75rem',
|
|
6889
|
+
border: '1px solid transparent',
|
|
6890
|
+
borderRadius: '999px',
|
|
6891
|
+
backgroundColor: 'transparent',
|
|
6892
|
+
fontFamily: 'inherit',
|
|
6893
|
+
fontSize: 'var(--c15t-devtools-font-size-xs, 0.75rem)',
|
|
6894
|
+
fontWeight: '500',
|
|
6895
|
+
lineHeight: '1.25',
|
|
6896
|
+
transition: 'background-color var(--c15t-duration-fast, 100ms) var(--c15t-easing, cubic-bezier(0.4, 0, 0.2, 1)), border-color var(--c15t-duration-fast, 100ms) var(--c15t-easing, cubic-bezier(0.4, 0, 0.2, 1)), box-shadow var(--c15t-duration-fast, 100ms) var(--c15t-easing, cubic-bezier(0.4, 0, 0.2, 1)), color var(--c15t-duration-fast, 100ms) var(--c15t-easing, cubic-bezier(0.4, 0, 0.2, 1))'
|
|
6897
|
+
}
|
|
6898
|
+
});
|
|
6899
|
+
if ('iab' === tab.id) buttonElement.title = 'Available when IAB TCF mode is enabled';
|
|
6900
|
+
applyButtonState(tab.id, buttonElement);
|
|
6901
|
+
buttons.set(tab.id, buttonElement);
|
|
6902
|
+
tabList.appendChild(buttonElement);
|
|
6903
|
+
}
|
|
6904
|
+
return {
|
|
6905
|
+
element: tabList,
|
|
6906
|
+
setActiveTab: (tab)=>{
|
|
6907
|
+
activeTab = tab;
|
|
6908
|
+
for (const [tabId, tabButton] of buttons)applyButtonState(tabId, tabButton);
|
|
6909
|
+
},
|
|
6910
|
+
destroy: ()=>{
|
|
6911
|
+
buttons.clear();
|
|
6912
|
+
}
|
|
6913
|
+
};
|
|
6914
|
+
}
|
|
6788
6915
|
function scriptDebugEventToLogEntry(event) {
|
|
6789
6916
|
return {
|
|
6790
6917
|
type: "script",
|
|
@@ -6968,9 +7095,11 @@ var __webpack_exports__ = {};
|
|
|
6968
7095
|
return instance;
|
|
6969
7096
|
}
|
|
6970
7097
|
function createDevToolsPanel(options) {
|
|
6971
|
-
const { namespace = 'c15tStore' } = options;
|
|
7098
|
+
const { namespace = 'c15tStore', mode = 'standalone' } = options;
|
|
7099
|
+
const isEmbedded = 'embedded' === mode;
|
|
6972
7100
|
let detachInstrumentation = null;
|
|
6973
7101
|
let detachScriptDebug = null;
|
|
7102
|
+
let contentArea = null;
|
|
6974
7103
|
const stateManager = createStateManager({
|
|
6975
7104
|
isOpen: true
|
|
6976
7105
|
});
|
|
@@ -6998,6 +7127,7 @@ var __webpack_exports__ = {};
|
|
|
6998
7127
|
gpc: persistedOverrides.gpc
|
|
6999
7128
|
});
|
|
7000
7129
|
}
|
|
7130
|
+
renderActivePanel();
|
|
7001
7131
|
},
|
|
7002
7132
|
onDisconnect: ()=>{
|
|
7003
7133
|
stateManager.setConnected(false);
|
|
@@ -7005,6 +7135,7 @@ var __webpack_exports__ = {};
|
|
|
7005
7135
|
detachInstrumentation = null;
|
|
7006
7136
|
detachScriptDebug?.();
|
|
7007
7137
|
detachScriptDebug = null;
|
|
7138
|
+
renderActivePanel();
|
|
7008
7139
|
}
|
|
7009
7140
|
});
|
|
7010
7141
|
const panelRenderer = createPanelRenderer({
|
|
@@ -7037,25 +7168,33 @@ var __webpack_exports__ = {};
|
|
|
7037
7168
|
display: 'flex',
|
|
7038
7169
|
flexDirection: 'column',
|
|
7039
7170
|
height: '100%',
|
|
7040
|
-
|
|
7171
|
+
boxSizing: 'border-box',
|
|
7172
|
+
gap: '0.75rem',
|
|
7173
|
+
padding: '0.75rem',
|
|
7174
|
+
fontFamily: 'inherit',
|
|
7041
7175
|
fontSize: 'var(--c15t-devtools-font-size-sm)',
|
|
7042
|
-
color: 'var(--c15t-
|
|
7043
|
-
backgroundColor: '
|
|
7176
|
+
color: isEmbedded ? 'var(--c15t-text, #eef2ff)' : 'inherit',
|
|
7177
|
+
backgroundColor: 'transparent',
|
|
7178
|
+
colorScheme: isEmbedded ? 'dark' : void 0,
|
|
7179
|
+
...isEmbedded ? EMBEDDED_THEME_VARIABLES : {}
|
|
7044
7180
|
}
|
|
7045
7181
|
});
|
|
7046
|
-
|
|
7182
|
+
contentArea = renderer_div({
|
|
7047
7183
|
style: {
|
|
7048
7184
|
flex: '1',
|
|
7185
|
+
minHeight: '0',
|
|
7049
7186
|
overflowY: 'auto',
|
|
7050
|
-
overscrollBehavior: 'contain'
|
|
7187
|
+
overscrollBehavior: 'contain',
|
|
7188
|
+
backgroundColor: 'transparent'
|
|
7051
7189
|
}
|
|
7052
7190
|
});
|
|
7053
7191
|
function renderActivePanel() {
|
|
7192
|
+
if (!contentArea) return;
|
|
7054
7193
|
const activeTab = syncTabs();
|
|
7055
7194
|
panelRenderer.renderPanel(contentArea, activeTab);
|
|
7056
7195
|
}
|
|
7057
7196
|
let tabsInstance = null;
|
|
7058
|
-
let
|
|
7197
|
+
let disabledTabsKey = '';
|
|
7059
7198
|
function getDisabledTabs() {
|
|
7060
7199
|
const disabledTabs = [];
|
|
7061
7200
|
const storeState = storeConnector.getState();
|
|
@@ -7064,16 +7203,16 @@ var __webpack_exports__ = {};
|
|
|
7064
7203
|
}
|
|
7065
7204
|
function syncTabs() {
|
|
7066
7205
|
const disabledTabs = getDisabledTabs();
|
|
7067
|
-
const
|
|
7206
|
+
const nextDisabledTabsKey = disabledTabs.join('|');
|
|
7068
7207
|
let activeTab = stateManager.getState().activeTab;
|
|
7069
7208
|
if (disabledTabs.includes(activeTab)) {
|
|
7070
7209
|
activeTab = 'consents';
|
|
7071
7210
|
stateManager.setActiveTab(activeTab);
|
|
7072
7211
|
}
|
|
7073
|
-
if (tabsInstance &&
|
|
7212
|
+
if (tabsInstance && disabledTabsKey === nextDisabledTabsKey) tabsInstance.setActiveTab(activeTab);
|
|
7074
7213
|
else {
|
|
7075
7214
|
tabsInstance?.destroy();
|
|
7076
|
-
tabsInstance =
|
|
7215
|
+
tabsInstance = createEmbeddedTabs({
|
|
7077
7216
|
activeTab,
|
|
7078
7217
|
onTabChange: (tab)=>{
|
|
7079
7218
|
stateManager.setActiveTab(tab);
|
|
@@ -7081,8 +7220,9 @@ var __webpack_exports__ = {};
|
|
|
7081
7220
|
},
|
|
7082
7221
|
disabledTabs
|
|
7083
7222
|
});
|
|
7084
|
-
|
|
7085
|
-
if (!tabsInstance.element.parentElement) container.
|
|
7223
|
+
disabledTabsKey = nextDisabledTabsKey;
|
|
7224
|
+
if (!tabsInstance.element.parentElement) if (contentArea?.parentElement === container) container.insertBefore(tabsInstance.element, contentArea);
|
|
7225
|
+
else container.appendChild(tabsInstance.element);
|
|
7086
7226
|
}
|
|
7087
7227
|
return activeTab;
|
|
7088
7228
|
}
|
package/dist/react.cjs
CHANGED
|
@@ -2763,7 +2763,7 @@ var __webpack_exports__ = {};
|
|
|
2763
2763
|
}
|
|
2764
2764
|
}));
|
|
2765
2765
|
footerElement.appendChild(renderer_span({
|
|
2766
|
-
text: "v2.0.
|
|
2766
|
+
text: "v2.0.1"
|
|
2767
2767
|
}));
|
|
2768
2768
|
}
|
|
2769
2769
|
function renderErrorState(container) {
|
|
@@ -2981,7 +2981,7 @@ var __webpack_exports__ = {};
|
|
|
2981
2981
|
icon: EVENTS_ICON
|
|
2982
2982
|
}
|
|
2983
2983
|
];
|
|
2984
|
-
function
|
|
2984
|
+
function createTabs(options) {
|
|
2985
2985
|
const { onTabChange, disabledTabs = [] } = options;
|
|
2986
2986
|
let activeTab = options.activeTab;
|
|
2987
2987
|
let isOverflowMenuOpen = false;
|
|
@@ -6910,7 +6910,7 @@ var __webpack_exports__ = {};
|
|
|
6910
6910
|
currentActiveTab = 'consents';
|
|
6911
6911
|
}
|
|
6912
6912
|
if (tabsInstance) tabsInstance.destroy();
|
|
6913
|
-
tabsInstance =
|
|
6913
|
+
tabsInstance = createTabs({
|
|
6914
6914
|
activeTab: currentActiveTab,
|
|
6915
6915
|
onTabChange: (tab)=>{
|
|
6916
6916
|
stateManager.setActiveTab(tab);
|