@livenetworks/ashlar 2.0.2 → 2.0.3
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/components/ln-confirm/README.md +2 -2
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-confirm/src/ln-confirm.js +1 -3
- package/components/ln-core/attrs.js +273 -273
- package/components/ln-core/events.js +122 -122
- package/components/ln-core/lifecycle.js +403 -403
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-debug/src/generated-attributes.js +1 -0
- package/components/ln-router/README.md +33 -0
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-router/ln-router.schema.json +8 -0
- package/components/ln-router/src/ln-router.js +51 -28
- package/components/ln-router/src/router-model.js +85 -0
- package/ln-ashlar.html-data.json +4 -0
- package/package.json +1 -1
- package/web-types.json +7 -0
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
// ─── Environment & Debug Gates ─────────────────────────────
|
|
2
|
-
|
|
3
|
-
export function hasActiveDebug() {
|
|
4
|
-
if (typeof window === 'undefined') return false;
|
|
5
|
-
if (window.lnDebug === true) return true;
|
|
6
|
-
if (window.lnCore && window.lnCore._debugSink) return true;
|
|
7
|
-
if (typeof document !== 'undefined' && document.body) {
|
|
8
|
-
return document.body.hasAttribute('data-ln-debug') || document.body.querySelector('[data-ln-debug]') !== null;
|
|
9
|
-
}
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function isDevMode(el) {
|
|
14
|
-
if (typeof window === 'undefined') return false;
|
|
15
|
-
if (window.lnDebug === true) return true;
|
|
16
|
-
|
|
17
|
-
// Authoritative gate check when ln-debug is active
|
|
18
|
-
if (window.lnCore && window.lnCore._debugIsContained) {
|
|
19
|
-
if (el) return window.lnCore._debugIsContained(el);
|
|
20
|
-
return window.lnCore._debugSink !== null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Direct DOM containment fallback (e.g. standalone tests or before gate boots)
|
|
24
|
-
if (el && el.closest) {
|
|
25
|
-
const host = el.closest('[data-ln-debug]');
|
|
26
|
-
if (!host || (typeof document !== 'undefined' && host === document.documentElement)) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
if (typeof document !== 'undefined' && document.body) {
|
|
32
|
-
return document.body.hasAttribute('data-ln-debug');
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ─── Global Console Warning Interceptor (Production Mode) ──
|
|
38
|
-
if (typeof window !== 'undefined') {
|
|
39
|
-
window.lnCore = window.lnCore || {};
|
|
40
|
-
if (!window.lnCore._warnBound) {
|
|
41
|
-
window.lnCore._warnBound = true;
|
|
42
|
-
const originalWarn = console.warn;
|
|
43
|
-
console.warn = function (...args) {
|
|
44
|
-
const isLibraryWarning = typeof args[0] === 'string' &&
|
|
45
|
-
(args[0].startsWith('[ln-') || args[0].startsWith('[lnCore'));
|
|
46
|
-
|
|
47
|
-
if (isLibraryWarning) {
|
|
48
|
-
let el = null;
|
|
49
|
-
for (let i = 1; i < args.length; i++) {
|
|
50
|
-
if (args[i] && args[i].nodeType === 1) {
|
|
51
|
-
el = args[i];
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (!isDevMode(el)) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
originalWarn.apply(console, args);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ─── Event Dispatch & Sinks ────────────────────────────────
|
|
65
|
-
|
|
66
|
-
// Nullable console-observation sink. Installed/removed only by ln-debug's
|
|
67
|
-
// gate (components/ln-debug/src/gate.js). window.lnCore is guaranteed already
|
|
68
|
-
// initialized by the module-load-time block above (_warnBound),
|
|
69
|
-
// so the hot-path read needs no defensive "window.lnCore &&" guard.
|
|
70
|
-
export function setDebugSink(sink, isContained) {
|
|
71
|
-
window.lnCore = window.lnCore || {};
|
|
72
|
-
window.lnCore._debugSink = sink;
|
|
73
|
-
window.lnCore._debugIsContained = isContained || null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Nullable persist restore/save sink. Installed/removed only by ln-persist
|
|
77
|
-
// (components/ln-persist/src/ln-persist.js) — mirrors setDebugSink exactly.
|
|
78
|
-
export function setPersistSink(sink) {
|
|
79
|
-
window.lnCore = window.lnCore || {};
|
|
80
|
-
window.lnCore._persistSink = sink;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function dispatch(element, eventName, detail) {
|
|
84
|
-
const payload = detail || {};
|
|
85
|
-
if (window.lnCore._debugSink) window.lnCore._debugSink('event', eventName, element, payload);
|
|
86
|
-
element.dispatchEvent(new CustomEvent(eventName, {
|
|
87
|
-
bubbles: true,
|
|
88
|
-
detail: payload
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function dispatchCancelable(element, eventName, detail) {
|
|
93
|
-
const payload = detail || {};
|
|
94
|
-
if (window.lnCore._debugSink) window.lnCore._debugSink('event', eventName, element, payload);
|
|
95
|
-
const event = new CustomEvent(eventName, {
|
|
96
|
-
bubbles: true,
|
|
97
|
-
cancelable: true,
|
|
98
|
-
detail: payload
|
|
99
|
-
});
|
|
100
|
-
element.dispatchEvent(event);
|
|
101
|
-
return event;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Re-filter / re-sort / re-render a data-driven list-like component, then
|
|
106
|
-
* notify the coordinator that fresh data is requested.
|
|
107
|
-
*/
|
|
108
|
-
export function requestData(component, eventName, keyName) {
|
|
109
|
-
component._applyFilterAndSort();
|
|
110
|
-
component._vStart = -1;
|
|
111
|
-
component._vEnd = -1;
|
|
112
|
-
component._render();
|
|
113
|
-
component._updateFooter();
|
|
114
|
-
|
|
115
|
-
const detail = {
|
|
116
|
-
sort: component.currentSort,
|
|
117
|
-
filters: component.currentFilters,
|
|
118
|
-
search: component.currentSearch
|
|
119
|
-
};
|
|
120
|
-
detail[keyName] = component.name;
|
|
121
|
-
dispatch(component.dom, eventName, detail);
|
|
122
|
-
}
|
|
1
|
+
// ─── Environment & Debug Gates ─────────────────────────────
|
|
2
|
+
|
|
3
|
+
export function hasActiveDebug() {
|
|
4
|
+
if (typeof window === 'undefined') return false;
|
|
5
|
+
if (window.lnDebug === true) return true;
|
|
6
|
+
if (window.lnCore && window.lnCore._debugSink) return true;
|
|
7
|
+
if (typeof document !== 'undefined' && document.body) {
|
|
8
|
+
return document.body.hasAttribute('data-ln-debug') || document.body.querySelector('[data-ln-debug]') !== null;
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function isDevMode(el) {
|
|
14
|
+
if (typeof window === 'undefined') return false;
|
|
15
|
+
if (window.lnDebug === true) return true;
|
|
16
|
+
|
|
17
|
+
// Authoritative gate check when ln-debug is active
|
|
18
|
+
if (window.lnCore && window.lnCore._debugIsContained) {
|
|
19
|
+
if (el) return window.lnCore._debugIsContained(el);
|
|
20
|
+
return window.lnCore._debugSink !== null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Direct DOM containment fallback (e.g. standalone tests or before gate boots)
|
|
24
|
+
if (el && el.closest) {
|
|
25
|
+
const host = el.closest('[data-ln-debug]');
|
|
26
|
+
if (!host || (typeof document !== 'undefined' && host === document.documentElement)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
if (typeof document !== 'undefined' && document.body) {
|
|
32
|
+
return document.body.hasAttribute('data-ln-debug');
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ─── Global Console Warning Interceptor (Production Mode) ──
|
|
38
|
+
if (typeof window !== 'undefined') {
|
|
39
|
+
window.lnCore = window.lnCore || {};
|
|
40
|
+
if (!window.lnCore._warnBound) {
|
|
41
|
+
window.lnCore._warnBound = true;
|
|
42
|
+
const originalWarn = console.warn;
|
|
43
|
+
console.warn = function (...args) {
|
|
44
|
+
const isLibraryWarning = typeof args[0] === 'string' &&
|
|
45
|
+
(args[0].startsWith('[ln-') || args[0].startsWith('[lnCore'));
|
|
46
|
+
|
|
47
|
+
if (isLibraryWarning) {
|
|
48
|
+
let el = null;
|
|
49
|
+
for (let i = 1; i < args.length; i++) {
|
|
50
|
+
if (args[i] && args[i].nodeType === 1) {
|
|
51
|
+
el = args[i];
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!isDevMode(el)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
originalWarn.apply(console, args);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ─── Event Dispatch & Sinks ────────────────────────────────
|
|
65
|
+
|
|
66
|
+
// Nullable console-observation sink. Installed/removed only by ln-debug's
|
|
67
|
+
// gate (components/ln-debug/src/gate.js). window.lnCore is guaranteed already
|
|
68
|
+
// initialized by the module-load-time block above (_warnBound),
|
|
69
|
+
// so the hot-path read needs no defensive "window.lnCore &&" guard.
|
|
70
|
+
export function setDebugSink(sink, isContained) {
|
|
71
|
+
window.lnCore = window.lnCore || {};
|
|
72
|
+
window.lnCore._debugSink = sink;
|
|
73
|
+
window.lnCore._debugIsContained = isContained || null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Nullable persist restore/save sink. Installed/removed only by ln-persist
|
|
77
|
+
// (components/ln-persist/src/ln-persist.js) — mirrors setDebugSink exactly.
|
|
78
|
+
export function setPersistSink(sink) {
|
|
79
|
+
window.lnCore = window.lnCore || {};
|
|
80
|
+
window.lnCore._persistSink = sink;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function dispatch(element, eventName, detail) {
|
|
84
|
+
const payload = detail || {};
|
|
85
|
+
if (window.lnCore._debugSink) window.lnCore._debugSink('event', eventName, element, payload);
|
|
86
|
+
element.dispatchEvent(new CustomEvent(eventName, {
|
|
87
|
+
bubbles: true,
|
|
88
|
+
detail: payload
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function dispatchCancelable(element, eventName, detail) {
|
|
93
|
+
const payload = detail || {};
|
|
94
|
+
if (window.lnCore._debugSink) window.lnCore._debugSink('event', eventName, element, payload);
|
|
95
|
+
const event = new CustomEvent(eventName, {
|
|
96
|
+
bubbles: true,
|
|
97
|
+
cancelable: true,
|
|
98
|
+
detail: payload
|
|
99
|
+
});
|
|
100
|
+
element.dispatchEvent(event);
|
|
101
|
+
return event;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Re-filter / re-sort / re-render a data-driven list-like component, then
|
|
106
|
+
* notify the coordinator that fresh data is requested.
|
|
107
|
+
*/
|
|
108
|
+
export function requestData(component, eventName, keyName) {
|
|
109
|
+
component._applyFilterAndSort();
|
|
110
|
+
component._vStart = -1;
|
|
111
|
+
component._vEnd = -1;
|
|
112
|
+
component._render();
|
|
113
|
+
component._updateFooter();
|
|
114
|
+
|
|
115
|
+
const detail = {
|
|
116
|
+
sort: component.currentSort,
|
|
117
|
+
filters: component.currentFilters,
|
|
118
|
+
search: component.currentSearch
|
|
119
|
+
};
|
|
120
|
+
detail[keyName] = component.name;
|
|
121
|
+
dispatch(component.dom, eventName, detail);
|
|
122
|
+
}
|