@codesuma/baseline 1.0.15 → 1.0.17

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.
@@ -23,14 +23,14 @@
23
23
  .page.enterUp {
24
24
  opacity: 1;
25
25
  transform: translateY(0);
26
- pointer-events: auto;
26
+ pointer-events: inherit;
27
27
  }
28
28
 
29
29
  /* Back enter: from top */
30
30
  .page.enterDown {
31
31
  opacity: 1;
32
32
  transform: translateY(0);
33
- pointer-events: auto;
33
+ pointer-events: inherit;
34
34
  }
35
35
 
36
36
  /* Forward exit: to top (hide above screen) */
@@ -11,6 +11,24 @@ export function Base<K extends keyof HTMLElementTagNameMap>(name: K = 'div' as K
11
11
  const el = document.createElement(name)
12
12
  el.setAttribute('data-base-id', id)
13
13
 
14
+ try {
15
+ const stack = new Error().stack
16
+ if (stack) {
17
+ const lines = stack.split('\n')
18
+ // V8: Error, at Base, at Caller -> index 2
19
+ // Firefox/Safari: Base@..., Caller@... -> index 1
20
+ const callerLine = lines[0].includes('Error') ? lines[2] : lines[1]
21
+ if (callerLine) {
22
+ const match = callerLine.match(/at\s+([^\s(]+)/) || callerLine.match(/^([^\s@]+)/)
23
+ if (match?.[1]) {
24
+ el.setAttribute('data-component-name', match[1].replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase())
25
+ }
26
+ }
27
+ }
28
+ } catch (e) {
29
+ // Ignore stack trace errors
30
+ }
31
+
14
32
  const component: any = { id, el, isMounted: false, parent: undefined }
15
33
 
16
34
  Object.assign(component, createEmitter(), createAppender(component), createStyler(component))
@@ -23,6 +41,22 @@ export function BaseSVG<K extends keyof SVGElementTagNameMap>(name: K = 'svg' as
23
41
  const el = document.createElementNS('http://www.w3.org/2000/svg', name)
24
42
  el.setAttribute('data-base-id', id)
25
43
 
44
+ try {
45
+ const stack = new Error().stack
46
+ if (stack) {
47
+ const lines = stack.split('\n')
48
+ const callerLine = lines[0].includes('Error') ? lines[2] : lines[1]
49
+ if (callerLine) {
50
+ const match = callerLine.match(/at\s+([^\s(]+)/) || callerLine.match(/^([^\s@]+)/)
51
+ if (match?.[1]) {
52
+ el.setAttribute('data-component-name', match[1].replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase())
53
+ }
54
+ }
55
+ }
56
+ } catch (e) {
57
+ // Ignore stack trace errors
58
+ }
59
+
26
60
  const component: any = { id, el, isMounted: false, parent: undefined }
27
61
 
28
62
  Object.assign(component, createEmitter(), createAppender(component), createStyler(component))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesuma/baseline",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "A minimal, imperative UI framework for building fast web apps. No virtual DOM, no magic, no dependencies.",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",