@herb-tools/dev-tools 0.7.0
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 +18 -0
- package/dist/herb-dev-tools.esm.js +1689 -0
- package/dist/herb-dev-tools.esm.js.map +1 -0
- package/dist/herb-dev-tools.umd.js +1698 -0
- package/dist/herb-dev-tools.umd.js.map +1 -0
- package/dist/types/error-overlay.d.ts +40 -0
- package/dist/types/herb-overlay.d.ts +53 -0
- package/dist/types/index.d.ts +5 -0
- package/package.json +41 -0
- package/src/error-overlay.ts +945 -0
- package/src/herb-overlay.ts +1001 -0
- package/src/index.ts +31 -0
- package/src/styles.css +761 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import './styles.css';
|
|
2
|
+
import { HerbOverlay, type HerbDevToolsOptions } from './herb-overlay.js';
|
|
3
|
+
|
|
4
|
+
export { HerbOverlay };
|
|
5
|
+
export type { HerbDevToolsOptions };
|
|
6
|
+
|
|
7
|
+
export function initHerbDevTools(options: HerbDevToolsOptions = {}): HerbOverlay {
|
|
8
|
+
return new HerbOverlay(options);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
12
|
+
const hasDebugMode = document.querySelector('meta[name="herb-debug-mode"]')?.getAttribute('content') === 'true';
|
|
13
|
+
const hasDebugErb = document.querySelector('[data-herb-debug-erb]') !== null;
|
|
14
|
+
const hasValidationErrors = document.querySelector('template[data-herb-validation-errors]') !== null;
|
|
15
|
+
const hasValidationError = document.querySelector('template[data-herb-validation-error]') !== null;
|
|
16
|
+
const hasParserErrors = document.querySelector('template[data-herb-parser-error]') !== null;
|
|
17
|
+
const shouldAutoInit = hasDebugMode || hasDebugErb || hasValidationErrors || hasValidationError || hasParserErrors;
|
|
18
|
+
|
|
19
|
+
if (shouldAutoInit) {
|
|
20
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
21
|
+
initHerbDevTools();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (typeof window !== 'undefined') {
|
|
27
|
+
(window as any).HerbDevTools = {
|
|
28
|
+
init: initHerbDevTools,
|
|
29
|
+
HerbOverlay
|
|
30
|
+
};
|
|
31
|
+
}
|