@highfivve/ad-tag 5.8.30 → 5.8.32

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.
@@ -0,0 +1,205 @@
1
+ import daisyui from 'daisyui';
2
+ import daisyuiThemes from 'daisyui/src/theming/themes';
3
+ import tailwindAnimate from 'tailwindcss-animate';
4
+ import tailwindColors from 'tailwindcss/colors';
5
+ const colorSafeList = [];
6
+ const deprecated = ['lightBlue', 'warmGray', 'trueGray', 'coolGray', 'blueGray'];
7
+ const themeColors = {
8
+ turquoise: {
9
+ '50': 'rgba(130, 218, 216, 0.5)',
10
+ '200': '#82dad8',
11
+ '300': '#42cbc9',
12
+ '400': '#00c8c8',
13
+ '600': '#56a9a8'
14
+ },
15
+ blue: {
16
+ '50': 'rgba(183, 203, 226, 0.5)',
17
+ '200': '#b7cbe2',
18
+ '300': '#7da6d7',
19
+ '400': '#052e53'
20
+ },
21
+ berry: {
22
+ '50': '#bba1b0',
23
+ '200': '#c45f8d',
24
+ '400': '#ba0e5f',
25
+ '500': '#c5015d'
26
+ },
27
+ purple: {
28
+ '50': 'rgba(172, 149, 232, 0.5)',
29
+ '400': '#ac95e8',
30
+ '500': '#8a7de0'
31
+ },
32
+ pink: {
33
+ '50': 'rgba(241, 118, 175, 0.5)',
34
+ '400': '#f176af'
35
+ },
36
+ yellow: {
37
+ '50': 'rgba(232, 208, 106, 0.5)',
38
+ '400': '#e8d06a'
39
+ },
40
+ orange: {
41
+ '50': 'rgba(234, 148, 69, 0.5)',
42
+ '400': '#ea9445'
43
+ },
44
+ red: {
45
+ '50': 'rgba(248, 131, 131, 0.5)',
46
+ '400': '#f88383'
47
+ },
48
+ gray: {
49
+ '50': 'rgba(66, 203, 201, 0.05)',
50
+ '200': 'rgba(203, 0, 95, 0.04)',
51
+ '400': '#e7e7e7',
52
+ '450': '#e1e1e1'
53
+ },
54
+ darkgray: {
55
+ '200': '#a2a3a5'
56
+ },
57
+ green: {
58
+ '400': '#49817B',
59
+ '600': '#006E65'
60
+ },
61
+ background: 'hsl(var(--background))',
62
+ foreground: 'hsl(var(--foreground))',
63
+ card: {
64
+ DEFAULT: 'hsl(var(--card))',
65
+ foreground: 'hsl(var(--card-foreground))'
66
+ },
67
+ popover: {
68
+ DEFAULT: 'hsl(var(--popover))',
69
+ foreground: 'hsl(var(--popover-foreground))'
70
+ },
71
+ primary: {
72
+ DEFAULT: 'hsl(var(--primary))',
73
+ foreground: 'hsl(var(--primary-foreground))'
74
+ },
75
+ secondary: {
76
+ DEFAULT: 'hsl(var(--secondary))',
77
+ foreground: 'hsl(var(--secondary-foreground))'
78
+ },
79
+ muted: {
80
+ DEFAULT: 'hsl(var(--muted))',
81
+ foreground: 'hsl(var(--muted-foreground))'
82
+ },
83
+ accent: {
84
+ DEFAULT: 'hsl(var(--accent))',
85
+ foreground: 'hsl(var(--accent-foreground))'
86
+ },
87
+ destructive: {
88
+ DEFAULT: 'hsl(var(--destructive))',
89
+ foreground: 'hsl(var(--destructive-foreground))'
90
+ },
91
+ border: 'hsl(var(--border))',
92
+ input: 'hsl(var(--input))',
93
+ ring: 'hsl(var(--ring))',
94
+ chart: {
95
+ '1': 'hsl(var(--chart-1))',
96
+ '2': 'hsl(var(--chart-2))',
97
+ '3': 'hsl(var(--chart-3))',
98
+ '4': 'hsl(var(--chart-4))',
99
+ '5': 'hsl(var(--chart-5))'
100
+ }
101
+ };
102
+ const themeAndTailwindColors = { ...themeColors, ...tailwindColors };
103
+ for (const colorName in themeAndTailwindColors) {
104
+ if (deprecated.includes(colorName)) {
105
+ continue;
106
+ }
107
+ const shades = [50, 200, 300, 400, 500, 600];
108
+ const color = colorName;
109
+ const pallette = themeAndTailwindColors[color];
110
+ if (typeof pallette === 'object') {
111
+ shades.forEach(shade => {
112
+ if (shade in pallette) {
113
+ colorSafeList.push(`stroke-${color}-${shade}`);
114
+ colorSafeList.push(`fill-${color}-${shade}`);
115
+ colorSafeList.push(`bg-${color}-${shade}`);
116
+ colorSafeList.push(`text-${color}-${shade}`);
117
+ }
118
+ });
119
+ }
120
+ }
121
+ export default {
122
+ darkMode: ['class'],
123
+ corePlugins: {
124
+ preflight: false
125
+ },
126
+ content: ['./ad-tag/source/ts/console/**/*.{js,ts,jsx,tsx}'],
127
+ theme: {
128
+ extend: {
129
+ gridTemplateRows: {
130
+ layout: 'auto 1fr auto auto'
131
+ },
132
+ gridTemplateColumns: {
133
+ layout: 'minmax(300px, max-content) minmax(0, 1fr)'
134
+ },
135
+ colors: themeColors,
136
+ borderRadius: {
137
+ lg: 'var(--radius)',
138
+ md: 'calc(var(--radius) - 2px)',
139
+ sm: 'calc(var(--radius) - 4px)'
140
+ },
141
+ keyframes: {
142
+ fadeInOut: {
143
+ '0%, 100%': { opacity: '0' },
144
+ '50%': { opacity: '1' }
145
+ }
146
+ },
147
+ animation: {
148
+ 'loading-screen-rotate': 'loading-screen-rotate 2s linear infinite',
149
+ 'loading-screen-dash': 'loading-screen-dash 1.5s ease-in-out infinite',
150
+ fadeIn: 'fadeInOut 1s ease-in-out'
151
+ },
152
+ fontFamily: {
153
+ sans: ['Brownfox-Formular', 'ui-sans-serif', 'system-ui'],
154
+ BrownfoxFormular: ['Brownfox-Formular'],
155
+ roboto: ['Roboto', 'Arial', 'sans-serif']
156
+ }
157
+ },
158
+ screens: {
159
+ sm: '640px',
160
+ md: '768px',
161
+ lg: '1024px',
162
+ xl: '1515px',
163
+ tall: {
164
+ raw: '(min-height: 1100px)'
165
+ },
166
+ xTall: {
167
+ raw: '(min-height: 1300px)'
168
+ },
169
+ xxTall: {
170
+ raw: '(min-height: 1500px)'
171
+ }
172
+ }
173
+ },
174
+ safelist: colorSafeList,
175
+ plugins: [tailwindAnimate, daisyui],
176
+ daisyui: {
177
+ prefix: 'd-',
178
+ logs: false,
179
+ themes: [
180
+ {
181
+ light: {
182
+ ...daisyuiThemes.light,
183
+ primary: '#000000',
184
+ secondary: '#00c8c8',
185
+ accent: '#ba0e5f',
186
+ info: '#7da6d7',
187
+ success: '#006e65',
188
+ warning: '#e8d06a',
189
+ error: '#c5015d'
190
+ },
191
+ dark: {
192
+ ...daisyuiThemes.dark,
193
+ primary: '#ffffff',
194
+ secondary: '#00c8c8',
195
+ accent: '#ba0e5f',
196
+ info: '#7da6d7',
197
+ success: '#42cbc9',
198
+ warning: '#e8d06a',
199
+ error: '#f88383'
200
+ }
201
+ }
202
+ ],
203
+ darkTheme: 'dark'
204
+ }
205
+ };
@@ -1,4 +1,7 @@
1
+ import { BrowserStorageKeys } from 'ad-tag/util/browserStorageKeys';
2
+ import { getBrowserStorageValue, setBrowserStorageValue } from 'ad-tag/util/localStorage';
1
3
  export const allThemes = ['light', 'dark'];
4
+ const isThemeConfig = (value) => value === 'system' || allThemes.some(theme => theme === value);
2
5
  export class ThemingService {
3
6
  constructor(rootElement) {
4
7
  this.rootElement = rootElement;
@@ -6,17 +9,20 @@ export class ThemingService {
6
9
  this.rootElement = rootElement;
7
10
  };
8
11
  this.currentTheme = () => (this.rootElement?.classList.contains('dark') ? 'dark' : 'light');
9
- this.applyTheme = (themeConfig = 'system') => {
12
+ this.currentThemeConfig = () => {
13
+ const stored = getBrowserStorageValue(BrowserStorageKeys.moliConsoleTheme, window.localStorage);
14
+ return stored && isThemeConfig(stored) ? stored : 'system';
15
+ };
16
+ this.setThemeConfig = (themeConfig) => {
17
+ setBrowserStorageValue(BrowserStorageKeys.moliConsoleTheme, themeConfig, window.localStorage);
18
+ this.applyTheme(themeConfig);
19
+ };
20
+ this.applyTheme = (themeConfig = this.currentThemeConfig()) => {
10
21
  const theme = themeConfig === 'system' ? ThemingService.currentSystemTheme() : themeConfig;
11
22
  this.updateThemeCssClass(theme);
12
23
  };
13
- this.enableSystemThemeListener = () => window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
14
- if (e.matches) {
15
- this.applyTheme('dark');
16
- }
17
- else {
18
- this.applyTheme('light');
19
- }
24
+ this.enableSystemThemeListener = () => window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
25
+ this.applyTheme();
20
26
  });
21
27
  this.updateThemeCssClass = (theme) => {
22
28
  if (theme !== 'light') {
@@ -25,6 +31,7 @@ export class ThemingService {
25
31
  else {
26
32
  this.rootElement?.classList.remove('dark');
27
33
  }
34
+ this.rootElement?.setAttribute('data-theme', theme);
28
35
  };
29
36
  }
30
37
  }
@@ -75,7 +75,7 @@ const formatSizesConfigMsg = (missingSizes) => {
75
75
  };
76
76
  return (React.createElement("div", null,
77
77
  "The following slots have sizes that need to be supported/defined:",
78
- React.createElement("table", { className: 'size-valid-table' },
78
+ React.createElement("table", { className: "d-table d-table-xs w-auto text-center [&_td]:border [&_th]:border [&_th]:bg-base-200" },
79
79
  React.createElement("thead", null,
80
80
  React.createElement("tr", null,
81
81
  React.createElement("th", null, "Slot ID"),
@@ -1,3 +1,3 @@
1
1
  export const packageJson = {
2
- version: '5.8.30'
2
+ version: '5.8.32'
3
3
  };
@@ -3,6 +3,7 @@ export const BrowserStorageKeys = {
3
3
  moliPubCode: 'moli-pub-code',
4
4
  moliVersion: 'moli-version',
5
5
  molyAnalyticsSession: 'moli-analytics-session',
6
+ moliConsoleTheme: 'moli-console-theme',
6
7
  testSlotSize: (id) => `moli-test-slot-size-${id}`,
7
8
  debugDelay: 'moli-debug-delay',
8
9
  abTest: 'moli-ab-test'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highfivve/ad-tag",
3
- "version": "5.8.30",
3
+ "version": "5.8.32",
4
4
  "license": "Apache-2.0",
5
5
  "description": "An ad tag implementation called moli",
6
6
  "main": "./lib/index.js",
@@ -82,6 +82,7 @@
82
82
  "chai-as-promised": "^7.1.1",
83
83
  "commander": "^12.1.0",
84
84
  "cssnano": "^5.1.15",
85
+ "daisyui": "^4.12.24",
85
86
  "esbuild": "^0.23.0",
86
87
  "eslint": "^7.26.0",
87
88
  "eslint-config-prettier": "^8.3.0",
@@ -107,6 +108,8 @@
107
108
  "rollup-plugin-postcss": "^4.0.2",
108
109
  "sinon": "10.0.0",
109
110
  "sinon-chai": "3.6.0",
111
+ "tailwindcss": "^3.4.19",
112
+ "tailwindcss-animate": "^1.0.7",
110
113
  "ts-json-schema-generator": "2.3.0",
111
114
  "ts-loader": "^9.5.1",
112
115
  "ts-node": "^10.9.2",