@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/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.0"
2767
+ text: "v2.0.4"
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
- fontFamily: 'var(--c15t-devtools-font-family)',
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-devtools-text)',
7043
- backgroundColor: 'var(--c15t-devtools-surface)'
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
- const contentArea = renderer_div({
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 iabDisabled = true;
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 nextIabDisabled = disabledTabs.includes('iab');
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 && iabDisabled === nextIabDisabled) tabsInstance.setActiveTab(activeTab);
7212
+ if (tabsInstance && disabledTabsKey === nextDisabledTabsKey) tabsInstance.setActiveTab(activeTab);
7074
7213
  else {
7075
7214
  tabsInstance?.destroy();
7076
- tabsInstance = createTabs({
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
- iabDisabled = nextIabDisabled;
7085
- if (!tabsInstance.element.parentElement) container.appendChild(tabsInstance.element);
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.0"
2766
+ text: "v2.0.4"
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 tabs_createTabs(options) {
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 = tabs_createTabs({
6913
+ tabsInstance = createTabs({
6914
6914
  activeTab: currentActiveTab,
6915
6915
  onTabChange: (tab)=>{
6916
6916
  stateManager.setActiveTab(tab);