@livenetworks/ashlar 2.0.6 → 2.0.8
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/LICENSE +641 -641
- package/components/COMPONENTS.md +1116 -1116
- package/components/index.js +81 -81
- package/components/ln-accordion/ln-accordion-dev.scss +8 -8
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-accordion/ln-accordion.schema.json +30 -30
- package/components/ln-accordion/src/ln-accordion.js +1 -0
- package/components/ln-ajax/ln-ajax-dev.scss +8 -8
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-ajax/ln-ajax.schema.json +30 -30
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-connector/ln-api-connector.schema.json +96 -96
- package/components/ln-api-connector/src/ln-api-connector.js +1 -0
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-api-queue/ln-api-queue.schema.json +34 -34
- package/components/ln-api-queue/src/ln-api-queue.js +3 -13
- package/components/ln-autoresize/ln-autoresize-dev.scss +8 -8
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autoresize/ln-autoresize.schema.json +22 -22
- package/components/ln-autosave/ln-autosave-dev.scss +13 -13
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-autosave/ln-autosave.schema.json +48 -48
- package/components/ln-autosave/src/autosave-model.js +34 -34
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-chart/ln-chart.schema.json +146 -146
- package/components/ln-chart/src/chart-model.js +154 -154
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.schema.json +42 -42
- package/components/ln-confirm/ln-confirm-dev.scss +24 -24
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-confirm/ln-confirm.schema.json +66 -66
- package/components/ln-confirm/src/ln-confirm.js +178 -178
- package/components/ln-core/crypto.js +286 -265
- package/components/ln-core/dom.js +115 -115
- package/components/ln-core/form.js +136 -136
- package/components/ln-core/helpers.js +33 -33
- package/components/ln-core/http.js +48 -48
- package/components/ln-core/index.js +1 -1
- package/components/ln-core/ln-core.schema.json +109 -109
- package/components/ln-core/locale.js +55 -55
- package/components/ln-core/matching.js +78 -78
- package/components/ln-core/number.js +125 -125
- package/components/ln-core/template.js +206 -206
- package/components/ln-couchdb-connector/README.md +4 -0
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-couchdb-connector/ln-couchdb-connector.schema.json +50 -50
- package/components/ln-couchdb-connector/src/ln-couchdb-connector.js +19 -1
- package/components/ln-data-coordinator/README.md +9 -38
- package/components/ln-data-coordinator/ln-data-coordinator-dev.scss +8 -8
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.schema.json +16 -16
- package/components/ln-data-coordinator/src/data-read-policy.js +0 -7
- package/components/ln-data-coordinator/src/ln-data-coordinator.js +428 -1299
- package/components/ln-data-store/README.md +3 -2
- package/components/ln-data-store/ln-data-store-dev.scss +13 -13
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-data-store/ln-data-store.schema.json +84 -84
- package/components/ln-data-store/src/data-store-model.js +184 -155
- package/components/ln-data-store/src/ln-data-store.js +58 -11
- package/components/ln-date/README.md +4 -0
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-date/ln-date.schema.json +92 -92
- package/components/ln-date/src/date-model.js +186 -186
- package/components/ln-date/src/ln-date.js +3 -3
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-debug/ln-debug.schema.json +28 -28
- package/components/ln-debug/src/console-sink.js +19 -19
- package/components/ln-debug/src/gate.js +95 -95
- package/components/ln-debug/src/generated-attributes.js +2 -2
- package/components/ln-dropdown/ln-dropdown-dev.scss +13 -13
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-editor/ln-editor.schema.json +58 -58
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-external-links/ln-external-links.schema.json +18 -18
- package/components/ln-fill/ln-fill.js +1 -1
- package/components/ln-fill/ln-fill.schema.json +23 -23
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +153 -153
- package/components/ln-filter/src/filter-model.js +185 -185
- package/components/ln-form/ln-form-dev.scss +8 -8
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-form/ln-form.schema.json +45 -45
- package/components/ln-http/ln-http.js +1 -1
- package/components/ln-http/ln-http.schema.json +6 -6
- package/components/ln-icon/ln-icon.schema.json +6 -6
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-include/ln-include.schema.json +23 -23
- package/components/ln-key/ln-key-dev.scss +18 -18
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-key/ln-key.schema.json +56 -56
- package/components/ln-key/src/ln-key.js +10 -10
- package/components/ln-link/ln-link-dev.scss +8 -8
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-link/ln-link.schema.json +22 -22
- package/components/ln-list/README.md +152 -152
- package/components/ln-list/ln-list-dev.scss +8 -8
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-list/ln-list.schema.json +166 -166
- package/components/ln-list/src/ln-list.js +4 -4
- package/components/ln-modal/README.md +4 -6
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-modal/ln-modal.schema.json +65 -65
- package/components/ln-modal/src/ln-modal.js +28 -8
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-nav/ln-nav.schema.json +25 -25
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-number/ln-number.schema.json +63 -63
- package/components/ln-number/src/number-model.js +31 -31
- package/components/ln-obfuscator/README.md +60 -60
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.schema.json +49 -49
- package/components/ln-obfuscator/src/ln-obfuscator.js +159 -159
- package/components/ln-obfuscator/src/obfuscator-model.js +250 -250
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-options/ln-options.schema.json +41 -41
- package/components/ln-options/src/ln-options.js +1 -0
- package/components/ln-persist/README.md +151 -151
- package/components/ln-persist/ln-persist.js +1 -1
- package/components/ln-persist/ln-persist.schema.json +28 -28
- package/components/ln-persist/src/ln-persist.js +83 -83
- package/components/ln-picklist/README.md +230 -230
- package/components/ln-picklist/ln-picklist-dev.scss +22 -22
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-picklist/ln-picklist.schema.json +49 -49
- package/components/ln-picklist/src/ln-picklist.js +228 -228
- package/components/ln-popover/README.md +4 -0
- package/components/ln-popover/ln-popover-dev.scss +13 -13
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-popover/ln-popover.schema.json +82 -82
- package/components/ln-popover/src/ln-popover.js +9 -0
- package/components/ln-progress/ln-progress-dev.scss +8 -8
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-progress/ln-progress.schema.json +40 -40
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-router/ln-router.schema.json +76 -76
- package/components/ln-scroll/README.md +45 -45
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-scroll/ln-scroll.schema.json +85 -85
- package/components/ln-scroll/src/ln-scroll.js +150 -150
- package/components/ln-search/README.md +188 -188
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-search/ln-search.schema.json +103 -103
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-slug/ln-slug.schema.json +23 -23
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sort/ln-sort.schema.json +104 -104
- package/components/ln-sort/src/ln-sort.js +321 -321
- package/components/ln-sort/src/sort-model.js +117 -117
- package/components/ln-sortable/ln-sortable-dev.scss +13 -13
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-sortable/ln-sortable.schema.json +36 -36
- package/components/ln-stat/ln-stat-dev.scss +8 -8
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-stat/ln-stat.schema.json +32 -32
- package/components/ln-stat/src/stat-model.js +28 -28
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table/ln-table.schema.json +211 -211
- package/components/ln-table/src/ln-table.js +2 -0
- package/components/ln-table/src/table-model.js +98 -98
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.schema.json +93 -93
- package/components/ln-table-coordinator/src/ln-table-coordinator.js +3 -3
- package/components/ln-tabs/README.md +2 -2
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-tabs/ln-tabs.schema.json +75 -75
- package/components/ln-tabs/src/ln-tabs.js +208 -207
- package/components/ln-tabs/src/tabs-model.js +82 -82
- package/components/ln-time/ln-time-dev.scss +13 -13
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-time/ln-time.schema.json +38 -38
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toast/ln-toast.schema.json +65 -65
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-toggle/ln-toggle.schema.json +52 -52
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-tooltip/ln-tooltip.schema.json +86 -86
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-translations/ln-translations.schema.json +120 -120
- package/components/ln-ui-coordinator/README.md +62 -62
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.schema.json +28 -28
- package/components/ln-ui-coordinator/src/ln-ui-coordinator.js +140 -140
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-upload/ln-upload.schema.json +193 -193
- package/components/ln-upload/src/upload-model.js +78 -78
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-validate/ln-validate.schema.json +50 -50
- package/components/ln-validate/src/validate-model.js +64 -64
- package/components/ln-websocket-connector/README.md +166 -166
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/components/ln-websocket-connector/ln-websocket-connector.schema.json +29 -29
- package/components/ln-websocket-connector/src/ln-websocket-connector.js +283 -279
- package/ln-ashlar.html-data.json +7 -8
- package/package.json +84 -84
- package/theme/brand.css +73 -73
- package/theme/components/_confirm.scss +6 -6
- package/theme/components/_picklist.scss +3 -3
- package/theme/config/_palette.scss +274 -274
- package/theme/config/_theme.scss +292 -292
- package/theme/config/_tokens.scss +285 -285
- package/theme/config/mixins/_index.scss +62 -62
- package/theme/config/mixins/_picklist.scss +66 -66
- package/theme/ln-ashlar-dev.scss +66 -66
- package/theme/ln-ashlar-landing.scss +56 -56
- package/theme/ln-ashlar-theme.scss +63 -63
- package/theme/presentation/_bento.scss +151 -151
- package/theme/presentation/_cta.scss +111 -111
- package/theme/presentation/_effects.scss +216 -216
- package/theme/presentation/_features.scss +108 -108
- package/theme/presentation/_footer.scss +129 -129
- package/theme/presentation/_hero.scss +158 -158
- package/theme/presentation/_layout.scss +170 -170
- package/theme/presentation/_navbar.scss +140 -140
- package/theme/presentation/_pricing.scss +262 -262
- package/theme/presentation/_stats.scss +87 -87
- package/theme/presentation/_testimonials.scss +124 -124
- package/theme/presentation/_tokens.scss +39 -39
- package/theme/presentation/_typography.scss +163 -163
- package/web-types.json +12 -12
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
import { matchesFilterValues } from '../../ln-core/matching.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether two arrays of strings differ in length or content.
|
|
5
|
-
* @param {Array} a
|
|
6
|
-
* @param {Array} b
|
|
7
|
-
* @returns {boolean}
|
|
8
|
-
*/
|
|
9
|
-
export function arraysDiffer(a, b) {
|
|
10
|
-
if (!Array.isArray(a) || !Array.isArray(b)) return a !== b;
|
|
11
|
-
if (a.length !== b.length) return true;
|
|
12
|
-
for (let i = 0; i < a.length; i++) {
|
|
13
|
-
if (a[i] !== b[i]) return true;
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Evaluates a row across multiple active column filters (AND across columns, OR within column).
|
|
20
|
-
* @param {Record<number, string>} cellValuesByCol Index-to-text mapping of row cells
|
|
21
|
-
* @param {Record<string, { col: number|null, values: string[], attr?: string }>} filters Active column filter map
|
|
22
|
-
* @param {Element} [row] Optional row element for data-attribute matching fallback
|
|
23
|
-
* @returns {boolean}
|
|
24
|
-
*/
|
|
25
|
-
export function evaluateRowFilters(cellValuesByCol, filters, row) {
|
|
26
|
-
if (!filters || typeof filters !== 'object') return true;
|
|
27
|
-
const keys = Object.keys(filters);
|
|
28
|
-
if (keys.length === 0) return true;
|
|
29
|
-
|
|
30
|
-
for (let i = 0; i < keys.length; i++) {
|
|
31
|
-
const filter = filters[keys[i]];
|
|
32
|
-
let cellText = '';
|
|
33
|
-
if (filter.col !== null && filter.col !== undefined) {
|
|
34
|
-
cellText = cellValuesByCol[filter.col] || '';
|
|
35
|
-
} else if (filter.attr && row && typeof row.getAttribute === 'function') {
|
|
36
|
-
cellText = row.getAttribute(filter.attr) || '';
|
|
37
|
-
}
|
|
38
|
-
if (!matchesFilterValues(cellText, filter.values)) {
|
|
39
|
-
return false; // AND across columns: fail fast
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Resolves the 0-based column index of a table associated with a filter.
|
|
47
|
-
* Inspects explicit index, filterDom placement, popover trigger button in <th>,
|
|
48
|
-
* and table header cells matching the filter key.
|
|
49
|
-
*
|
|
50
|
-
* @param {HTMLTableElement} table Target table
|
|
51
|
-
* @param {HTMLElement} filterDom Filter root element (<ul data-ln-filter>)
|
|
52
|
-
* @param {string|null} key Active filter key (e.g. 'category', 'status')
|
|
53
|
-
* @param {number|null} explicitCol Explicitly provided colIndex, if any
|
|
54
|
-
* @returns {number|null} 0-based column index, or null if unresolvable
|
|
55
|
-
*/
|
|
56
|
-
export function resolveColumnIndex(table, filterDom, key, explicitCol) {
|
|
57
|
-
if (explicitCol !== null && explicitCol !== undefined && !isNaN(explicitCol)) {
|
|
58
|
-
return parseInt(explicitCol, 10);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (filterDom && typeof filterDom.getAttribute === 'function') {
|
|
62
|
-
const colAttr = filterDom.getAttribute('data-ln-filter-col');
|
|
63
|
-
if (colAttr !== null && !isNaN(parseInt(colAttr, 10))) {
|
|
64
|
-
return parseInt(colAttr, 10);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (typeof filterDom.closest === 'function') {
|
|
68
|
-
const th = filterDom.closest('th');
|
|
69
|
-
if (th && typeof th.cellIndex === 'number') {
|
|
70
|
-
return th.cellIndex;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const popover = filterDom.closest('[data-ln-popover], [id]');
|
|
74
|
-
if (popover && popover.id) {
|
|
75
|
-
const rootDoc = table && table.ownerDocument ? table.ownerDocument : (filterDom.ownerDocument || (typeof document !== 'undefined' ? document : null));
|
|
76
|
-
if (rootDoc && typeof rootDoc.querySelector === 'function') {
|
|
77
|
-
const trigger = rootDoc.querySelector('[data-ln-popover-for="' + popover.id + '"]');
|
|
78
|
-
if (trigger && typeof trigger.closest === 'function') {
|
|
79
|
-
const triggerTh = trigger.closest('th');
|
|
80
|
-
if (triggerTh && typeof triggerTh.cellIndex === 'number') {
|
|
81
|
-
return triggerTh.cellIndex;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (table && key && typeof table.querySelectorAll === 'function') {
|
|
90
|
-
const ths = table.querySelectorAll('thead th, tr:first-child th');
|
|
91
|
-
const keyLower = String(key).trim().toLowerCase();
|
|
92
|
-
|
|
93
|
-
// First pass: match data-ln-* attributes on <th>
|
|
94
|
-
for (let i = 0; i < ths.length; i++) {
|
|
95
|
-
const th = ths[i];
|
|
96
|
-
const attrVal = th.getAttribute('data-ln-table-filter-col') ||
|
|
97
|
-
th.getAttribute('data-ln-filter-col') ||
|
|
98
|
-
th.getAttribute('data-ln-filter-key') ||
|
|
99
|
-
th.getAttribute('data-ln-table-col') ||
|
|
100
|
-
th.getAttribute('data-ln-col') ||
|
|
101
|
-
th.getAttribute('data-ln-field');
|
|
102
|
-
if (attrVal && attrVal.trim().toLowerCase() === keyLower) {
|
|
103
|
-
return typeof th.cellIndex === 'number' ? th.cellIndex : i;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Second pass: match popover trigger inside <th>
|
|
108
|
-
if (filterDom) {
|
|
109
|
-
const popover = filterDom.closest ? filterDom.closest('[data-ln-popover], [id]') : null;
|
|
110
|
-
const popoverId = (popover && popover.id) || (filterDom.id || null);
|
|
111
|
-
if (popoverId) {
|
|
112
|
-
for (let i = 0; i < ths.length; i++) {
|
|
113
|
-
const th = ths[i];
|
|
114
|
-
if (typeof th.querySelector === 'function' && th.querySelector('[data-ln-popover-for="' + popoverId + '"]')) {
|
|
115
|
-
return typeof th.cellIndex === 'number' ? th.cellIndex : i;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Third pass: match header text (direct text content)
|
|
122
|
-
for (let i = 0; i < ths.length; i++) {
|
|
123
|
-
const th = ths[i];
|
|
124
|
-
const childNodes = Array.from(th.childNodes || []);
|
|
125
|
-
const textNodes = childNodes.filter(n => n.nodeType === 3);
|
|
126
|
-
const label = (textNodes.length > 0
|
|
127
|
-
? textNodes.map(n => n.textContent.trim()).join(' ')
|
|
128
|
-
: (th.textContent || '')
|
|
129
|
-
).trim().toLowerCase();
|
|
130
|
-
|
|
131
|
-
if (label && label === keyLower) {
|
|
132
|
-
return typeof th.cellIndex === 'number' ? th.cellIndex : i;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Derives the active key and values from a list of input descriptors.
|
|
142
|
-
* @param {Array<{ key: string, value: string, checked: boolean, isReset: boolean }>} descriptors
|
|
143
|
-
* @returns {{ key: string|null, values: string[] }}
|
|
144
|
-
*/
|
|
145
|
-
export function deriveActiveFilters(descriptors) {
|
|
146
|
-
if (!Array.isArray(descriptors)) return { key: null, values: [] };
|
|
147
|
-
|
|
148
|
-
let key = null;
|
|
149
|
-
const values = [];
|
|
150
|
-
|
|
151
|
-
for (let i = 0; i < descriptors.length; i++) {
|
|
152
|
-
const item = descriptors[i];
|
|
153
|
-
if (!key && item.key) key = item.key;
|
|
154
|
-
if (item.checked && !item.isReset && item.value) {
|
|
155
|
-
values.push(item.value);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return { key, values };
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Encodes an array of active filter values into a comma-joined,
|
|
164
|
-
* percent-encoded string for persistence in a state attribute.
|
|
165
|
-
* @param {string[]} values
|
|
166
|
-
* @returns {string|null}
|
|
167
|
-
*/
|
|
168
|
-
export function encodeFilterValues(values) {
|
|
169
|
-
if (!Array.isArray(values) || values.length === 0) return null;
|
|
170
|
-
return values.map(encodeURIComponent).join(',');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Decodes a comma-joined, percent-encoded filter-values string back
|
|
175
|
-
* into an array.
|
|
176
|
-
* @param {string|null} raw
|
|
177
|
-
* @returns {string[]}
|
|
178
|
-
*/
|
|
179
|
-
export function decodeFilterValues(raw) {
|
|
180
|
-
if (!raw) return [];
|
|
181
|
-
return raw.split(',').map(function (v) {
|
|
182
|
-
try { return decodeURIComponent(v); }
|
|
183
|
-
catch (e) { return v; }
|
|
184
|
-
}).filter(Boolean);
|
|
185
|
-
}
|
|
1
|
+
import { matchesFilterValues } from '../../ln-core/matching.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether two arrays of strings differ in length or content.
|
|
5
|
+
* @param {Array} a
|
|
6
|
+
* @param {Array} b
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
export function arraysDiffer(a, b) {
|
|
10
|
+
if (!Array.isArray(a) || !Array.isArray(b)) return a !== b;
|
|
11
|
+
if (a.length !== b.length) return true;
|
|
12
|
+
for (let i = 0; i < a.length; i++) {
|
|
13
|
+
if (a[i] !== b[i]) return true;
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Evaluates a row across multiple active column filters (AND across columns, OR within column).
|
|
20
|
+
* @param {Record<number, string>} cellValuesByCol Index-to-text mapping of row cells
|
|
21
|
+
* @param {Record<string, { col: number|null, values: string[], attr?: string }>} filters Active column filter map
|
|
22
|
+
* @param {Element} [row] Optional row element for data-attribute matching fallback
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export function evaluateRowFilters(cellValuesByCol, filters, row) {
|
|
26
|
+
if (!filters || typeof filters !== 'object') return true;
|
|
27
|
+
const keys = Object.keys(filters);
|
|
28
|
+
if (keys.length === 0) return true;
|
|
29
|
+
|
|
30
|
+
for (let i = 0; i < keys.length; i++) {
|
|
31
|
+
const filter = filters[keys[i]];
|
|
32
|
+
let cellText = '';
|
|
33
|
+
if (filter.col !== null && filter.col !== undefined) {
|
|
34
|
+
cellText = cellValuesByCol[filter.col] || '';
|
|
35
|
+
} else if (filter.attr && row && typeof row.getAttribute === 'function') {
|
|
36
|
+
cellText = row.getAttribute(filter.attr) || '';
|
|
37
|
+
}
|
|
38
|
+
if (!matchesFilterValues(cellText, filter.values)) {
|
|
39
|
+
return false; // AND across columns: fail fast
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Resolves the 0-based column index of a table associated with a filter.
|
|
47
|
+
* Inspects explicit index, filterDom placement, popover trigger button in <th>,
|
|
48
|
+
* and table header cells matching the filter key.
|
|
49
|
+
*
|
|
50
|
+
* @param {HTMLTableElement} table Target table
|
|
51
|
+
* @param {HTMLElement} filterDom Filter root element (<ul data-ln-filter>)
|
|
52
|
+
* @param {string|null} key Active filter key (e.g. 'category', 'status')
|
|
53
|
+
* @param {number|null} explicitCol Explicitly provided colIndex, if any
|
|
54
|
+
* @returns {number|null} 0-based column index, or null if unresolvable
|
|
55
|
+
*/
|
|
56
|
+
export function resolveColumnIndex(table, filterDom, key, explicitCol) {
|
|
57
|
+
if (explicitCol !== null && explicitCol !== undefined && !isNaN(explicitCol)) {
|
|
58
|
+
return parseInt(explicitCol, 10);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (filterDom && typeof filterDom.getAttribute === 'function') {
|
|
62
|
+
const colAttr = filterDom.getAttribute('data-ln-filter-col');
|
|
63
|
+
if (colAttr !== null && !isNaN(parseInt(colAttr, 10))) {
|
|
64
|
+
return parseInt(colAttr, 10);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (typeof filterDom.closest === 'function') {
|
|
68
|
+
const th = filterDom.closest('th');
|
|
69
|
+
if (th && typeof th.cellIndex === 'number') {
|
|
70
|
+
return th.cellIndex;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const popover = filterDom.closest('[data-ln-popover], [id]');
|
|
74
|
+
if (popover && popover.id) {
|
|
75
|
+
const rootDoc = table && table.ownerDocument ? table.ownerDocument : (filterDom.ownerDocument || (typeof document !== 'undefined' ? document : null));
|
|
76
|
+
if (rootDoc && typeof rootDoc.querySelector === 'function') {
|
|
77
|
+
const trigger = rootDoc.querySelector('[data-ln-popover-for="' + popover.id + '"]');
|
|
78
|
+
if (trigger && typeof trigger.closest === 'function') {
|
|
79
|
+
const triggerTh = trigger.closest('th');
|
|
80
|
+
if (triggerTh && typeof triggerTh.cellIndex === 'number') {
|
|
81
|
+
return triggerTh.cellIndex;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (table && key && typeof table.querySelectorAll === 'function') {
|
|
90
|
+
const ths = table.querySelectorAll('thead th, tr:first-child th');
|
|
91
|
+
const keyLower = String(key).trim().toLowerCase();
|
|
92
|
+
|
|
93
|
+
// First pass: match data-ln-* attributes on <th>
|
|
94
|
+
for (let i = 0; i < ths.length; i++) {
|
|
95
|
+
const th = ths[i];
|
|
96
|
+
const attrVal = th.getAttribute('data-ln-table-filter-col') ||
|
|
97
|
+
th.getAttribute('data-ln-filter-col') ||
|
|
98
|
+
th.getAttribute('data-ln-filter-key') ||
|
|
99
|
+
th.getAttribute('data-ln-table-col') ||
|
|
100
|
+
th.getAttribute('data-ln-col') ||
|
|
101
|
+
th.getAttribute('data-ln-field');
|
|
102
|
+
if (attrVal && attrVal.trim().toLowerCase() === keyLower) {
|
|
103
|
+
return typeof th.cellIndex === 'number' ? th.cellIndex : i;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Second pass: match popover trigger inside <th>
|
|
108
|
+
if (filterDom) {
|
|
109
|
+
const popover = filterDom.closest ? filterDom.closest('[data-ln-popover], [id]') : null;
|
|
110
|
+
const popoverId = (popover && popover.id) || (filterDom.id || null);
|
|
111
|
+
if (popoverId) {
|
|
112
|
+
for (let i = 0; i < ths.length; i++) {
|
|
113
|
+
const th = ths[i];
|
|
114
|
+
if (typeof th.querySelector === 'function' && th.querySelector('[data-ln-popover-for="' + popoverId + '"]')) {
|
|
115
|
+
return typeof th.cellIndex === 'number' ? th.cellIndex : i;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Third pass: match header text (direct text content)
|
|
122
|
+
for (let i = 0; i < ths.length; i++) {
|
|
123
|
+
const th = ths[i];
|
|
124
|
+
const childNodes = Array.from(th.childNodes || []);
|
|
125
|
+
const textNodes = childNodes.filter(n => n.nodeType === 3);
|
|
126
|
+
const label = (textNodes.length > 0
|
|
127
|
+
? textNodes.map(n => n.textContent.trim()).join(' ')
|
|
128
|
+
: (th.textContent || '')
|
|
129
|
+
).trim().toLowerCase();
|
|
130
|
+
|
|
131
|
+
if (label && label === keyLower) {
|
|
132
|
+
return typeof th.cellIndex === 'number' ? th.cellIndex : i;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Derives the active key and values from a list of input descriptors.
|
|
142
|
+
* @param {Array<{ key: string, value: string, checked: boolean, isReset: boolean }>} descriptors
|
|
143
|
+
* @returns {{ key: string|null, values: string[] }}
|
|
144
|
+
*/
|
|
145
|
+
export function deriveActiveFilters(descriptors) {
|
|
146
|
+
if (!Array.isArray(descriptors)) return { key: null, values: [] };
|
|
147
|
+
|
|
148
|
+
let key = null;
|
|
149
|
+
const values = [];
|
|
150
|
+
|
|
151
|
+
for (let i = 0; i < descriptors.length; i++) {
|
|
152
|
+
const item = descriptors[i];
|
|
153
|
+
if (!key && item.key) key = item.key;
|
|
154
|
+
if (item.checked && !item.isReset && item.value) {
|
|
155
|
+
values.push(item.value);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return { key, values };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Encodes an array of active filter values into a comma-joined,
|
|
164
|
+
* percent-encoded string for persistence in a state attribute.
|
|
165
|
+
* @param {string[]} values
|
|
166
|
+
* @returns {string|null}
|
|
167
|
+
*/
|
|
168
|
+
export function encodeFilterValues(values) {
|
|
169
|
+
if (!Array.isArray(values) || values.length === 0) return null;
|
|
170
|
+
return values.map(encodeURIComponent).join(',');
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Decodes a comma-joined, percent-encoded filter-values string back
|
|
175
|
+
* into an array.
|
|
176
|
+
* @param {string|null} raw
|
|
177
|
+
* @returns {string[]}
|
|
178
|
+
*/
|
|
179
|
+
export function decodeFilterValues(raw) {
|
|
180
|
+
if (!raw) return [];
|
|
181
|
+
return raw.split(',').map(function (v) {
|
|
182
|
+
try { return decodeURIComponent(v); }
|
|
183
|
+
catch (e) { return v; }
|
|
184
|
+
}).filter(Boolean);
|
|
185
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@use '../../theme/config/mixins' as *;
|
|
2
|
-
|
|
3
|
-
[data-ln-debug] {
|
|
4
|
-
// 1. Host Element Check: data-ln-form belongs only on <form> elements
|
|
5
|
-
[data-ln-form]:not(form) {
|
|
6
|
-
@include dev-inline-error("data-ln-form belongs only on <form> elements");
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
@use '../../theme/config/mixins' as *;
|
|
2
|
+
|
|
3
|
+
[data-ln-debug] {
|
|
4
|
+
// 1. Host Element Check: data-ln-form belongs only on <form> elements
|
|
5
|
+
[data-ln-form]:not(form) {
|
|
6
|
+
@include dev-inline-error("data-ln-form belongs only on <form> elements");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function E(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function g(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!g(o))return}e.apply(console,t)}}function B(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function b(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){b(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function j(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function W(e,t){const n=e.elements,o=[],l={};for(let i=0;i<n.length;i++){const r=n[i];r.name&&r.type==="checkbox"&&(l[r.name]=(l[r.name]||0)+1)}for(let i=0;i<n.length;i++){const r=n[i];if(r.type==="file"||r.type==="submit"||r.type==="button")continue;const c=r.getAttribute("data-ln-fill-as")||r.name;if(!c||!(c in t))continue;const s=t[c];if(r.type==="checkbox"){if(Array.isArray(s))r.checked=s.indexOf(r.value)!==-1;else if(l[r.name]>1){const u=String(s).split(",").map(function(a){return a.trim()});r.checked=u.indexOf(r.value)!==-1}else r.checked=j(s);o.push(r)}else if(r.type==="radio")r.checked=r.value===String(s),o.push(r);else if(r.type==="select-multiple"){if(Array.isArray(s))for(let u=0;u<r.options.length;u++)r.options[u].selected=s.indexOf(r.options[u].value)!==-1;o.push(r)}else r.value=s,o.push(r)}return o}const L={};function U(e,t){L[e]=t}function H(e){return L[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=U,window.lnCore.getDataMapper=H);function V(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,b(function(){new MutationObserver(function(){B(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function P(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];T[n]=t}function K(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=P,window.lnCore.getLocaleFallback=K,window.lnCore.ensureLocaleObserver=V);const m={};function Q(e,t){m[e]||(m[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=m[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function I(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++){const c=n[r],s=c.getAttribute("data-ln-field");t[s]!=null&&(c.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<o.length;r++){const c=o[r],s=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<s.length;u++){const a=s[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let r=0;r<l.length;r++){const c=l[r],s=c.getAttribute("data-ln-show");s in t&&c.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let r=0;r<i.length;r++){const c=i[r],s=c.getAttribute("data-ln-class").split(",");for(let u=0;u<s.length;u++){const a=s[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function J(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)I(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,c){return t[c]!==void 0?t[c]:""}))}const o=function(i,r){return t[r]!==void 0?t[r]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let i=0;i<l.length;i++){const r=l[i],c=r.attributes;for(let s=0;s<c.length;s++){const u=c[s];u.value.indexOf("{{")!==-1&&r.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function G(e,t,n,o,l,i){const r={};for(let s=0;s<e.children.length;s++){const u=e.children[s],a=u.getAttribute("data-ln-render-key");a&&(r[a]=u)}const c=document.createDocumentFragment();for(let s=0;s<t.length;s++){const u=t[s],a=String(o(u));let d=r[a];if(d)l(d,u,s);else{const f=Q(n,i);if(!f||($(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),l(d,u,s)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=I,window.lnCore.lnFill=J,window.lnCore.renderList=G);function C(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function X(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function z(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const l=o.trim().toLowerCase();return!(l==="false"||l==="0")}function Y(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function Z(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const o=new Set(e||[]),l=function(i,r){const c=i.getAttribute(r);return c!==null&&o.has(c)?c:t};return y.set(n,l),l}function ee(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function te(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function R(e,t,n,o,l){if(!e||t===null)return!0;const i=o||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const c=s=>{l?console.warn(s,l):console.warn(s)};if(r==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(c(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const s=e.values||[];return s.includes(t)?!0:(c(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return c(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(c(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(c(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(c(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(s){return c(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ne(e,t,n){for(const o in n){const[l,i,r]=n[o];Object.defineProperty(e,o,{get:function(){return l(t,i,r)},enumerable:!0,configurable:!0})}return e}function oe(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let l=o.read;if(!l&&o.type)switch(o.type){case"enum":l=Z(o.values,o.fallback);break;case"integer":l=X;break;case"float":l=ee;break;case"boolean":l=z;break;case"list":l=Y;break;case"json":l=te;break;case"string":default:l=C;break}l||(l=C),t[o.prop]=[l,n,o.fallback]}return t}function re(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ie(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}function A(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&r.push(e);for(const c of r)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(s){console.error("["+n+"] init failed",c,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function le(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function se(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function D(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ce(e){const t=D(),n=e.observed||[];for(let o=0;o<n.length;o++){const l=n[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const l=t.byDeclaredAttr.get(o);l.some(i=>i.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ie(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function M(e,t,n,o){for(let l=0;l<e.length;l++){const i=e[l];if(!t[i.attribute])continue;const r=i.effects&&i.effects[n];r?r(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function ue(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=D(),l=o.byAttr.get(n);if(E()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&g(t)){const i=o.byDeclaredAttr.get(n),r=t.getAttribute(n);for(let c=0;c<i.length;c++)R(i[c].spec,r,n,i[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&M(i,t,n,e.oldValue),o.reactiveWildcard.length&&M(o.reactiveWildcard,t,n,e.oldValue)}if(l)for(let i=0;i<l.length;i++){const r=l[i];if(r.handler){r.handler(t,n,e.oldValue);continue}r.onAttributeChange&&t[r.attribute]?r.onAttributeChange(t,n):(A(t,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(t))}}function ae(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,b(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ue(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function F(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function de(e){const t=F();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const l=o.query,i=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l];A(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l],r=i.query,c=Array.from(o.querySelectorAll(r));o.matches&&o.matches(r)&&c.push(o);for(let s=0;s<c.length;s++){const u=c[s];if(!document.contains(u)){const a=u[i.attribute];if(a&&typeof a.destroy=="function")try{a.destroy()}catch(d){console.error("["+i.attribute+"] destroy failed",u,d)}delete u[i.attribute]}}}}}}function fe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,b(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{de(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function we(e,t,n,o,l={}){const i=l.extraAttributes||[],r=l.onAttributeChange||null,c=l.onSubtreeChange||null,s=l.onInit||null,u=l.onAttrChange||null,a=l.effects||null,d=l.attributes||null,f=d?re(d):a,_e=d?new Set(Object.keys(d)):null,ve=l.persist||null;function p(k){const w=k||document.body;if(A(w,e,t,n),d&&E())for(const h in d){const Se=d[h],S=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&S.push(w);for(let O=0;O<S.length;O++){const x=S[O];g(x)&&R(Se,x.getAttribute(h),h,o,x)}}s&&s(w)}const v=[];if(e.indexOf("[")!==-1){const k=/\[([\w-]+)/g;let w;for(;(w=k.exec(e))!==null;)v.push(w[1])}else v.push(e);ce({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:s,observed:v.concat(i),onAttributeChange:r,onAttrChange:u,effects:f,declared:_e,persist:ve}),ae();const ke=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";F().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:c,query:ke}),fe(),window[t]=p;function N(){le()>0?se(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",N):N(),p}function q(e){return(e||"").replace(/^#/,"")}function _(e){const t=e===void 0?location.hash:e,n={},o=q(t);if(!o)return n;const l=o.split("&");for(let i=0;i<l.length;i++){const r=l[i];if(!r)continue;const c=r.indexOf(":"),s=c>-1?r.slice(0,c):r,u=c>-1?r.slice(c+1):"";if(s)try{n[s]=decodeURIComponent(u)}catch{n[s]=u}}return n}function he(e){if(!e)return null;const t=_();return e in t?t[e]:null}function be(e,t){if(!e)return;const n=_();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(i){const r=n[i];return r===""?i:i+":"+encodeURIComponent(r)}).join("&");q(location.hash)!==l&&(location.hash=l)}function pe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ge(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function me(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ce(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ye(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ae(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),l=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=he,window.lnCore.hashSet=be,window.lnCore.hashLinkClick=pe,window.lnCore.resolveHashNamespace=ge,window.lnCore.hashSortEncode=me,window.lnCore.hashSortDecode=Ce,window.lnCore.hashFilterEncode=ye,window.lnCore.hashFilterDecode=Ae),(function(){const e="data-ln-form",t="lnForm";if(window[t]!==void 0)return;const n={"data-ln-form":{type:"marker",description:"Identifies the form element as an enhanced ln-form"},"data-ln-form-action-edit":{prop:"_actionEdit",type:"string",read:C,fallback:"",description:"URL template or endpoint used when editing an existing record"},"data-ln-form-action-method":{prop:"_actionMethod",type:"enum",values:["PUT","POST","PATCH"],fallback:"PUT",description:"HTTP method used when submitting edit action"}},o=oe(n);function l(i){this.dom=i,ne(this,i,o),this._baseAction=i.getAttribute("action")||"";const r=this;return this._onLnFill=function(c){c.target===r.dom&&(c.detail?(r.fill(c.detail),r._applyActionMode(c.detail)):r.dom.reset())},this._onReset=function(){r._applyActionMode(null)},i.addEventListener("ln-fill",this._onLnFill),i.addEventListener("reset",this._onReset),this}l.prototype.fill=function(i){const r=W(this.dom,i);for(let c=0;c<r.length;c++){const s=r[c],u=s.tagName==="SELECT"||s.type==="checkbox"||s.type==="radio";s.dispatchEvent(new Event(u?"change":"input",{bubbles:!0}))}},l.prototype._ensureMethodInput=function(){let i=this.dom.querySelector('input[name="_method"]');return i||(i=document.createElement("input"),i.type="hidden",i.name="_method",i.value="",this.dom.appendChild(i)),i},l.prototype._applyActionMode=function(i){if(!this.dom.hasAttribute("data-ln-form-action-edit"))return;const r=i&&i.id!=null&&i.id!==""?i.id:null,c=this._ensureMethodInput();if(r!==null){const s=this._actionEdit;s?this.dom.setAttribute("action",s.replace(":id",encodeURIComponent(r))):this.dom.setAttribute("action",this._baseAction.replace(/\/$/,"")+"/"+encodeURIComponent(r)),c.value=this._actionMethod||"PUT"}else this.dom.setAttribute("action",this._baseAction),c.value=""},l.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-fill",this._onLnFill),this.dom.removeEventListener("reset",this._onReset),delete this.dom[t])},we(e,t,l,"ln-form",{attributes:n})})()})();
|
|
1
|
+
(function(){"use strict";function E(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function g(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!g(o))return}e.apply(console,t)}}function B(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function j(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function U(e,t){const n=e.elements,o=[],l={};for(let i=0;i<n.length;i++){const r=n[i];r.name&&r.type==="checkbox"&&(l[r.name]=(l[r.name]||0)+1)}for(let i=0;i<n.length;i++){const r=n[i];if(r.type==="file"||r.type==="submit"||r.type==="button")continue;const c=r.getAttribute("data-ln-fill-as")||r.name;if(!c||!(c in t))continue;const s=t[c];if(r.type==="checkbox"){if(Array.isArray(s))r.checked=s.indexOf(r.value)!==-1;else if(l[r.name]>1){const u=String(s).split(",").map(function(a){return a.trim()});r.checked=u.indexOf(r.value)!==-1}else r.checked=j(s);o.push(r)}else if(r.type==="radio")r.checked=r.value===String(s),o.push(r);else if(r.type==="select-multiple"){if(Array.isArray(s))for(let u=0;u<r.options.length;u++)r.options[u].selected=s.indexOf(r.options[u].value)!==-1;o.push(r)}else r.value=s,o.push(r)}return o}const L={};function W(e,t){L[e]=t}function H(e){return L[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=W,window.lnCore.getDataMapper=H);function V(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){B(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function P(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];T[n]=t}function K(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=P,window.lnCore.getLocaleFallback=K,window.lnCore.ensureLocaleObserver=V);const m={};function Q(e,t){m[e]||(m[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=m[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function I(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++){const c=n[r],s=c.getAttribute("data-ln-field");t[s]!=null&&(c.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<o.length;r++){const c=o[r],s=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<s.length;u++){const a=s[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let r=0;r<l.length;r++){const c=l[r],s=c.getAttribute("data-ln-show");s in t&&c.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let r=0;r<i.length;r++){const c=i[r],s=c.getAttribute("data-ln-class").split(",");for(let u=0;u<s.length;u++){const a=s[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function J(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)I(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,c){return t[c]!==void 0?t[c]:""}))}const o=function(i,r){return t[r]!==void 0?t[r]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let i=0;i<l.length;i++){const r=l[i],c=r.attributes;for(let s=0;s<c.length;s++){const u=c[s];u.value.indexOf("{{")!==-1&&r.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function G(e,t,n,o,l,i){const r={};for(let s=0;s<e.children.length;s++){const u=e.children[s],a=u.getAttribute("data-ln-render-key");a&&(r[a]=u)}const c=document.createDocumentFragment();for(let s=0;s<t.length;s++){const u=t[s],a=String(o(u));let d=r[a];if(d)l(d,u,s);else{const f=Q(n,i);if(!f||($(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),l(d,u,s)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=I,window.lnCore.lnFill=J,window.lnCore.renderList=G);function C(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function X(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function z(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const l=o.trim().toLowerCase();return!(l==="false"||l==="0")}function Y(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function Z(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const o=new Set(e||[]),l=function(i,r){const c=i.getAttribute(r);return c!==null&&o.has(c)?c:t};return y.set(n,l),l}function ee(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function te(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function D(e,t,n,o,l){if(!e||t===null)return!0;const i=o||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const c=s=>{l?console.warn(s,l):console.warn(s)};if(r==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(c(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const s=e.values||[];return s.includes(t)?!0:(c(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return c(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(c(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(c(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(c(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(s){return c(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ne(e,t,n){for(const o in n){const[l,i,r]=n[o];Object.defineProperty(e,o,{get:function(){return l(t,i,r)},enumerable:!0,configurable:!0})}return e}function oe(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let l=o.read;if(!l&&o.type)switch(o.type){case"enum":l=Z(o.values,o.fallback);break;case"integer":l=X;break;case"float":l=ee;break;case"boolean":l=z;break;case"list":l=Y;break;case"json":l=te;break;case"string":default:l=C;break}l||(l=C),t[o.prop]=[l,n,o.fallback]}return t}function re(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ie(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}function A(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&r.push(e);for(const c of r)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(s){console.error("["+n+"] init failed",c,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function le(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function se(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function R(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ce(e){const t=R(),n=e.observed||[];for(let o=0;o<n.length;o++){const l=n[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const l=t.byDeclaredAttr.get(o);l.some(i=>i.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ie(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function M(e,t,n,o){for(let l=0;l<e.length;l++){const i=e[l];if(!t[i.attribute])continue;const r=i.effects&&i.effects[n];r?r(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function ue(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=R(),l=o.byAttr.get(n);if(E()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&g(t)){const i=o.byDeclaredAttr.get(n),r=t.getAttribute(n);for(let c=0;c<i.length;c++)D(i[c].spec,r,n,i[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&M(i,t,n,e.oldValue),o.reactiveWildcard.length&&M(o.reactiveWildcard,t,n,e.oldValue)}if(l)for(let i=0;i<l.length;i++){const r=l[i];if(r.handler){r.handler(t,n,e.oldValue);continue}r.onAttributeChange&&t[r.attribute]?r.onAttributeChange(t,n):(A(t,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(t))}}function ae(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ue(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function F(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function de(e){const t=F();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const l=o.query,i=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l];A(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l],r=i.query,c=Array.from(o.querySelectorAll(r));o.matches&&o.matches(r)&&c.push(o);for(let s=0;s<c.length;s++){const u=c[s];if(!document.contains(u)){const a=u[i.attribute];if(a&&typeof a.destroy=="function")try{a.destroy()}catch(d){console.error("["+i.attribute+"] destroy failed",u,d)}delete u[i.attribute]}}}}}}function fe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{de(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function we(e,t,n,o,l={}){const i=l.extraAttributes||[],r=l.onAttributeChange||null,c=l.onSubtreeChange||null,s=l.onInit||null,u=l.onAttrChange||null,a=l.effects||null,d=l.attributes||null,f=d?re(d):a,xe=d?new Set(Object.keys(d)):null,ve=l.persist||null;function b(v){const w=v||document.body;if(A(w,e,t,n),d&&E())for(const h in d){const Se=d[h],k=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&k.push(w);for(let S=0;S<k.length;S++){const O=k[S];g(O)&&D(Se,O.getAttribute(h),h,o,O)}}s&&s(w)}const x=[];if(e.indexOf("[")!==-1){const v=/\[([\w-]+)/g;let w;for(;(w=v.exec(e))!==null;)x.push(w[1])}else x.push(e);ce({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:s,observed:x.concat(i),onAttributeChange:r,onAttrChange:u,effects:f,declared:xe,persist:ve}),ae();const ke=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";F().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:c,query:ke}),fe(),window[t]=b;function N(){le()>0?se(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",N):N(),b}function q(e){return(e||"").replace(/^#/,"")}function _(e){const t=e===void 0?location.hash:e,n={},o=q(t);if(!o)return n;const l=o.split("&");for(let i=0;i<l.length;i++){const r=l[i];if(!r)continue;const c=r.indexOf(":"),s=c>-1?r.slice(0,c):r,u=c>-1?r.slice(c+1):"";if(s)try{n[s]=decodeURIComponent(u)}catch{n[s]=u}}return n}function he(e){if(!e)return null;const t=_();return e in t?t[e]:null}function pe(e,t){if(!e)return;const n=_();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(i){const r=n[i];return r===""?i:i+":"+encodeURIComponent(r)}).join("&");q(location.hash)!==l&&(location.hash=l)}function be(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ge(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function me(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ce(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ye(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ae(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),l=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=he,window.lnCore.hashSet=pe,window.lnCore.hashLinkClick=be,window.lnCore.resolveHashNamespace=ge,window.lnCore.hashSortEncode=me,window.lnCore.hashSortDecode=Ce,window.lnCore.hashFilterEncode=ye,window.lnCore.hashFilterDecode=Ae);function _e(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=_e),(function(){const e="data-ln-form",t="lnForm";if(window[t]!==void 0)return;const n={"data-ln-form":{type:"marker",description:"Identifies the form element as an enhanced ln-form"},"data-ln-form-action-edit":{prop:"_actionEdit",type:"string",read:C,fallback:"",description:"URL template or endpoint used when editing an existing record"},"data-ln-form-action-method":{prop:"_actionMethod",type:"enum",values:["PUT","POST","PATCH"],fallback:"PUT",description:"HTTP method used when submitting edit action"}},o=oe(n);function l(i){this.dom=i,ne(this,i,o),this._baseAction=i.getAttribute("action")||"";const r=this;return this._onLnFill=function(c){c.target===r.dom&&(c.detail?(r.fill(c.detail),r._applyActionMode(c.detail)):r.dom.reset())},this._onReset=function(){r._applyActionMode(null)},i.addEventListener("ln-fill",this._onLnFill),i.addEventListener("reset",this._onReset),this}l.prototype.fill=function(i){const r=U(this.dom,i);for(let c=0;c<r.length;c++){const s=r[c],u=s.tagName==="SELECT"||s.type==="checkbox"||s.type==="radio";s.dispatchEvent(new Event(u?"change":"input",{bubbles:!0}))}},l.prototype._ensureMethodInput=function(){let i=this.dom.querySelector('input[name="_method"]');return i||(i=document.createElement("input"),i.type="hidden",i.name="_method",i.value="",this.dom.appendChild(i)),i},l.prototype._applyActionMode=function(i){if(!this.dom.hasAttribute("data-ln-form-action-edit"))return;const r=i&&i.id!=null&&i.id!==""?i.id:null,c=this._ensureMethodInput();if(r!==null){const s=this._actionEdit;s?this.dom.setAttribute("action",s.replace(":id",encodeURIComponent(r))):this.dom.setAttribute("action",this._baseAction.replace(/\/$/,"")+"/"+encodeURIComponent(r)),c.value=this._actionMethod||"PUT"}else this.dom.setAttribute("action",this._baseAction),c.value=""},l.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-fill",this._onLnFill),this.dom.removeEventListener("reset",this._onReset),delete this.dom[t])},we(e,t,l,"ln-form",{attributes:n})})()})();
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
|
|
3
|
-
"component": "ln-form",
|
|
4
|
-
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
-
"attributes": {
|
|
6
|
-
"data-ln-debug": {
|
|
7
|
-
"direction": null,
|
|
8
|
-
"sources": [
|
|
9
|
-
"ln-form-dev.scss"
|
|
10
|
-
]
|
|
11
|
-
},
|
|
12
|
-
"data-ln-form": {
|
|
13
|
-
"direction": null,
|
|
14
|
-
"sources": [
|
|
15
|
-
"ln-form-dev.scss",
|
|
16
|
-
"src/ln-form.js"
|
|
17
|
-
],
|
|
18
|
-
"type": "marker",
|
|
19
|
-
"description": "Identifies the form element as an enhanced ln-form"
|
|
20
|
-
},
|
|
21
|
-
"data-ln-form-action-edit": {
|
|
22
|
-
"direction": "author",
|
|
23
|
-
"sources": [
|
|
24
|
-
"src/ln-form.js"
|
|
25
|
-
],
|
|
26
|
-
"type": "string",
|
|
27
|
-
"fallback": "",
|
|
28
|
-
"description": "URL template or endpoint used when editing an existing record"
|
|
29
|
-
},
|
|
30
|
-
"data-ln-form-action-method": {
|
|
31
|
-
"direction": null,
|
|
32
|
-
"sources": [
|
|
33
|
-
"src/ln-form.js"
|
|
34
|
-
],
|
|
35
|
-
"type": "enum",
|
|
36
|
-
"values": [
|
|
37
|
-
"PUT",
|
|
38
|
-
"POST",
|
|
39
|
-
"PATCH"
|
|
40
|
-
],
|
|
41
|
-
"fallback": "PUT",
|
|
42
|
-
"description": "HTTP method used when submitting edit action"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
|
|
3
|
+
"component": "ln-form",
|
|
4
|
+
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"data-ln-debug": {
|
|
7
|
+
"direction": null,
|
|
8
|
+
"sources": [
|
|
9
|
+
"ln-form-dev.scss"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"data-ln-form": {
|
|
13
|
+
"direction": null,
|
|
14
|
+
"sources": [
|
|
15
|
+
"ln-form-dev.scss",
|
|
16
|
+
"src/ln-form.js"
|
|
17
|
+
],
|
|
18
|
+
"type": "marker",
|
|
19
|
+
"description": "Identifies the form element as an enhanced ln-form"
|
|
20
|
+
},
|
|
21
|
+
"data-ln-form-action-edit": {
|
|
22
|
+
"direction": "author",
|
|
23
|
+
"sources": [
|
|
24
|
+
"src/ln-form.js"
|
|
25
|
+
],
|
|
26
|
+
"type": "string",
|
|
27
|
+
"fallback": "",
|
|
28
|
+
"description": "URL template or endpoint used when editing an existing record"
|
|
29
|
+
},
|
|
30
|
+
"data-ln-form-action-method": {
|
|
31
|
+
"direction": null,
|
|
32
|
+
"sources": [
|
|
33
|
+
"src/ln-form.js"
|
|
34
|
+
],
|
|
35
|
+
"type": "enum",
|
|
36
|
+
"values": [
|
|
37
|
+
"PUT",
|
|
38
|
+
"POST",
|
|
39
|
+
"PATCH"
|
|
40
|
+
],
|
|
41
|
+
"fallback": "PUT",
|
|
42
|
+
"description": "HTTP method used when submitting edit action"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function S(t){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return t?window.lnCore._debugIsContained(t):window.lnCore._debugSink!==null;if(t&&t.closest){const e=t.closest("[data-ln-debug]");return!(!e||typeof document<"u"&&e===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const t=console.warn;console.warn=function(...e){if(typeof e[0]=="string"&&(e[0].startsWith("[ln-")||e[0].startsWith("[lnCore"))){let d=null;for(let a=1;a<e.length;a++)if(e[a]&&e[a].nodeType===1){d=e[a];break}if(!S(d))return}t.apply(console,e)}}function p(t,e,o){const d=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",e,t,d),t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:d}))}function C(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}const m={};function k(t,e){m[t]=e}function v(t){return m[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=k,window.lnCore.getDataMapper=v);function L(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,C(function(){new MutationObserver(function(){p(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const y={};function x(t,e){if(!t||typeof e!="object")return;const o=t.toLowerCase().split("-")[0];y[o]=e}function H(t){if(!t)return null;const e=t.toLowerCase().split("-")[0];return y[e]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=x,window.lnCore.getLocaleFallback=H,window.lnCore.ensureLocaleObserver=L);const b={};function O(t,e){b[t]||(b[t]=document.querySelector('[data-ln-template="'+t+'"]'));const o=b[t];return o?o.content.cloneNode(!0):(console.warn("["+(e||"ln-core")+'] Template "'+t+'" not found'),null)}function E(t,e){if(!t||!e)return t;const o=t.querySelectorAll("[data-ln-field]");for(let n=0;n<o.length;n++){const r=o[n],l=r.getAttribute("data-ln-field");e[l]!=null&&(r.textContent=e[l])}const d=t.querySelectorAll("[data-ln-attr]");for(let n=0;n<d.length;n++){const r=d[n],l=r.getAttribute("data-ln-attr").split(",");for(let i=0;i<l.length;i++){const c=l[i].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();e[f]!=null&&r.setAttribute(u,e[f])}}const a=t.querySelectorAll("[data-ln-show]");for(let n=0;n<a.length;n++){const r=a[n],l=r.getAttribute("data-ln-show");l in e&&r.classList.toggle("hidden",!e[l])}const s=t.querySelectorAll("[data-ln-class]");for(let n=0;n<s.length;n++){const r=s[n],l=r.getAttribute("data-ln-class").split(",");for(let i=0;i<l.length;i++){const c=l[i].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();f in e&&r.classList.toggle(u,!!e[f])}}return t}function D(t,e){t.matches&&t.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",t,e??null),t.dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0})));const o=t.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let d=0;d<o.length;d++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[d],e??null),o[d].dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0}));return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(t){if(!(!t.target.matches||!t.target.matches("[data-ln-fillable]")))if(t.detail)E(t.target,t.detail);else{const e=t.target.querySelectorAll("[data-ln-field]");for(let o=0;o<e.length;o++)e[o].textContent=""}})));function _(t,e){if(!t||!e)return t;const o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const s=o.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(n,r){return e[r]!==void 0?e[r]:""}))}const d=function(s,n){return e[n]!==void 0?e[n]:""},a=Array.from(t.querySelectorAll("*"));t.nodeType===1&&a.push(t);for(let s=0;s<a.length;s++){const n=a[s],r=n.attributes;for(let l=0;l<r.length;l++){const i=r[l];i.value.indexOf("{{")!==-1&&n.setAttribute(i.name,i.value.replace(/\{\{\s*(\w+)\s*\}\}/g,d))}}return t}function F(t,e,o,d,a,s){const n={};for(let l=0;l<t.children.length;l++){const i=t.children[l],c=i.getAttribute("data-ln-render-key");c&&(n[c]=i)}const r=document.createDocumentFragment();for(let l=0;l<e.length;l++){const i=e[l],c=String(d(i));let u=n[c];if(u)a(u,i,l);else{const f=O(o,s);if(!f||(_(f,i),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",c),a(u,i,l)}r.appendChild(u)}t.textContent="",t.appendChild(r)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=_,window.lnCore.fill=E,window.lnCore.lnFill=D,window.lnCore.renderList=F),typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function A(t){return(t||"").replace(/^#/,"")}function g(t){const e=t===void 0?location.hash:t,o={},d=A(e);if(!d)return o;const a=d.split("&");for(let s=0;s<a.length;s++){const n=a[s];if(!n)continue;const r=n.indexOf(":"),l=r>-1?n.slice(0,r):n,i=r>-1?n.slice(r+1):"";if(l)try{o[l]=decodeURIComponent(i)}catch{o[l]=i}}return o}function T(t){if(!t)return null;const e=g();return t in e?e[t]:null}function M(t,e){if(!t)return;const o=g();e==null?delete o[t]:o[t]=String(e);const a=Object.keys(o).map(function(s){const n=o[s];return n===""?s:s+":"+encodeURIComponent(n)}).join("&");A(location.hash)!==a&&(location.hash=a)}function q(t){return t.button===1||t.ctrlKey||t.metaKey||t.shiftKey?!1:(t.preventDefault(),!0)}function B(t,e){if(!t||!t.hasAttribute("data-ln-hash"))return null;const o=t.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const d=t.getAttribute("data-ln-sort")||t.getAttribute("data-ln-search-for")||t.getAttribute("data-ln-search")||t.getAttribute("data-ln-filter")||t.id;return d?e?d+"-"+e:d:e||null}function j(t,e){return!e||e==="none"||t===null||t===void 0?null:String(t)+"."+e}function W(t){return!t||typeof t!="string"?null:t.endsWith(".asc")?{fieldOrColumn:t.slice(0,-4),direction:"asc"}:t.endsWith(".desc")?{fieldOrColumn:t.slice(0,-5),direction:"desc"}:null}function U(t,e){return!t||!Array.isArray(e)||e.length===0?null:t+":"+e.map(encodeURIComponent).join(",")}function I(t){if(!t||typeof t!="string")return null;const e=t.indexOf(":");if(e===-1)return null;const o=t.slice(0,e),d=t.slice(e+1),a=d?d.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:o,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=g,window.lnCore.hashGet=T,window.lnCore.hashSet=M,window.lnCore.hashLinkClick=q,window.lnCore.resolveHashNamespace=B,window.lnCore.hashSortEncode=j,window.lnCore.hashSortDecode=W,window.lnCore.hashFilterEncode=U,window.lnCore.hashFilterDecode=I);function G(t){if(typeof t=="string")return t;if(t&&typeof t=="object"){if(typeof t.href=="string")return t.href;if(typeof t.url=="string")return t.url}return String(t||"")}function K(t,e){return e&&e.method?String(e.method).toUpperCase():t&&typeof t=="object"&&t.method?String(t.method).toUpperCase():"GET"}function N(t,e){return(e||"GET")+" "+(t||"")}function R(t){const e=(t||"").toUpperCase();return e==="GET"||e==="HEAD"}(function(){if(window.lnHttp)return;const t=window.fetch.bind(window),e=new Map,o=new Map;function d(n,r){r=r||{};const l=G(n),i=K(n,r),c=N(l,i);R(i)&&e.has(c)&&(e.get(c).abort(),e.delete(c));const u=new AbortController,f=r.signal;let h=null;f&&(f.aborted?u.abort(f.reason):(h=function(){u.abort(f.reason)},f.addEventListener("abort",h,{once:!0})));const w=Object.assign({},r,{signal:u.signal});return e.set(c,u),t(n,w).finally(function(){f&&h&&f.removeEventListener("abort",h),e.get(c)===u&&e.delete(c)})}d.toString=function(){return"function fetch() { [ln-http wrapped] }"},window.fetch=d;function a(n){if(!n.detail||!n.detail.url)return;const r=n.target,l=(n.detail.method||(n.detail.body?"POST":"GET")).toUpperCase(),i=n.detail.key;i&&o.has(i)&&(o.get(i).abort(),o.delete(i));const c=new AbortController,u=n.detail.signal;let f=null;u&&(u.aborted?c.abort(u.reason):(f=function(){c.abort(u.reason)},u.addEventListener("abort",f,{once:!0}))),i&&o.set(i,c);const h={method:l,signal:c.signal};n.detail.body!==void 0&&(h.body=n.detail.body),window.fetch(n.detail.url,h).then(function(w){u&&f&&u.removeEventListener("abort",f),i&&o.get(i)===c&&o.delete(i),p(r,"ln-http:response",{ok:w.ok,status:w.status,response:w})}).catch(function(w){u&&f&&u.removeEventListener("abort",f),i&&o.get(i)===c&&o.delete(i),!(w&&w.name==="AbortError")&&p(r,"ln-http:error",{ok:!1,status:0,error:w})})}function s(n){const r=n.detail||{};r.all?window.lnHttp.cancelAll():r.key?window.lnHttp.cancelByKey(r.key):r.url&&window.lnHttp.cancel(r.url)}document.addEventListener("ln-http:request",a),document.addEventListener("ln-http:cancel",s),window.lnHttp={cancel:function(n){let r=!1;return e.forEach(function(l,i){i.endsWith(" "+n)&&(l.abort(),e.delete(i),r=!0)}),r},cancelByKey:function(n){return o.has(n)?(o.get(n).abort(),o.delete(n),!0):!1},cancelAll:function(){e.forEach(function(n){n.abort()}),e.clear(),o.forEach(function(n){n.abort()}),o.clear()},get inflight(){const n=[];return e.forEach(function(r,l){const i=l.indexOf(" ");n.push({method:l.slice(0,i),url:l.slice(i+1)})}),o.forEach(function(r,l){n.push({key:l})}),n},destroy:function(){window.lnHttp.cancelAll(),document.removeEventListener("ln-http:request",a),document.removeEventListener("ln-http:cancel",s),window.fetch=t,delete window.lnHttp}}})()})();
|
|
1
|
+
(function(){"use strict";function A(t){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return t?window.lnCore._debugIsContained(t):window.lnCore._debugSink!==null;if(t&&t.closest){const e=t.closest("[data-ln-debug]");return!(!e||typeof document<"u"&&e===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const t=console.warn;console.warn=function(...e){if(typeof e[0]=="string"&&(e[0].startsWith("[ln-")||e[0].startsWith("[lnCore"))){let d=null;for(let a=1;a<e.length;a++)if(e[a]&&e[a].nodeType===1){d=e[a];break}if(!A(d))return}t.apply(console,e)}}function p(t,e,o){const d=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",e,t,d),t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:d}))}function C(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}const m={};function S(t,e){m[t]=e}function k(t){return m[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=S,window.lnCore.getDataMapper=k);function v(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,C(function(){new MutationObserver(function(){p(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const y={};function L(t,e){if(!t||typeof e!="object")return;const o=t.toLowerCase().split("-")[0];y[o]=e}function D(t){if(!t)return null;const e=t.toLowerCase().split("-")[0];return y[e]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=L,window.lnCore.getLocaleFallback=D,window.lnCore.ensureLocaleObserver=v);const b={};function H(t,e){b[t]||(b[t]=document.querySelector('[data-ln-template="'+t+'"]'));const o=b[t];return o?o.content.cloneNode(!0):(console.warn("["+(e||"ln-core")+'] Template "'+t+'" not found'),null)}function x(t,e){if(!t||!e)return t;const o=t.querySelectorAll("[data-ln-field]");for(let n=0;n<o.length;n++){const r=o[n],l=r.getAttribute("data-ln-field");e[l]!=null&&(r.textContent=e[l])}const d=t.querySelectorAll("[data-ln-attr]");for(let n=0;n<d.length;n++){const r=d[n],l=r.getAttribute("data-ln-attr").split(",");for(let i=0;i<l.length;i++){const c=l[i].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();e[f]!=null&&r.setAttribute(u,e[f])}}const a=t.querySelectorAll("[data-ln-show]");for(let n=0;n<a.length;n++){const r=a[n],l=r.getAttribute("data-ln-show");l in e&&r.classList.toggle("hidden",!e[l])}const s=t.querySelectorAll("[data-ln-class]");for(let n=0;n<s.length;n++){const r=s[n],l=r.getAttribute("data-ln-class").split(",");for(let i=0;i<l.length;i++){const c=l[i].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();f in e&&r.classList.toggle(u,!!e[f])}}return t}function O(t,e){t.matches&&t.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",t,e??null),t.dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0})));const o=t.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let d=0;d<o.length;d++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[d],e??null),o[d].dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0}));return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(t){if(!(!t.target.matches||!t.target.matches("[data-ln-fillable]")))if(t.detail)x(t.target,t.detail);else{const e=t.target.querySelectorAll("[data-ln-field]");for(let o=0;o<e.length;o++)e[o].textContent=""}})));function E(t,e){if(!t||!e)return t;const o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const s=o.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(n,r){return e[r]!==void 0?e[r]:""}))}const d=function(s,n){return e[n]!==void 0?e[n]:""},a=Array.from(t.querySelectorAll("*"));t.nodeType===1&&a.push(t);for(let s=0;s<a.length;s++){const n=a[s],r=n.attributes;for(let l=0;l<r.length;l++){const i=r[l];i.value.indexOf("{{")!==-1&&n.setAttribute(i.name,i.value.replace(/\{\{\s*(\w+)\s*\}\}/g,d))}}return t}function F(t,e,o,d,a,s){const n={};for(let l=0;l<t.children.length;l++){const i=t.children[l],c=i.getAttribute("data-ln-render-key");c&&(n[c]=i)}const r=document.createDocumentFragment();for(let l=0;l<e.length;l++){const i=e[l],c=String(d(i));let u=n[c];if(u)a(u,i,l);else{const f=H(o,s);if(!f||(E(f,i),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",c),a(u,i,l)}r.appendChild(u)}t.textContent="",t.appendChild(r)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=E,window.lnCore.fill=x,window.lnCore.lnFill=O,window.lnCore.renderList=F),typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function _(t){return(t||"").replace(/^#/,"")}function g(t){const e=t===void 0?location.hash:t,o={},d=_(e);if(!d)return o;const a=d.split("&");for(let s=0;s<a.length;s++){const n=a[s];if(!n)continue;const r=n.indexOf(":"),l=r>-1?n.slice(0,r):n,i=r>-1?n.slice(r+1):"";if(l)try{o[l]=decodeURIComponent(i)}catch{o[l]=i}}return o}function T(t){if(!t)return null;const e=g();return t in e?e[t]:null}function M(t,e){if(!t)return;const o=g();e==null?delete o[t]:o[t]=String(e);const a=Object.keys(o).map(function(s){const n=o[s];return n===""?s:s+":"+encodeURIComponent(n)}).join("&");_(location.hash)!==a&&(location.hash=a)}function U(t){return t.button===1||t.ctrlKey||t.metaKey||t.shiftKey?!1:(t.preventDefault(),!0)}function q(t,e){if(!t||!t.hasAttribute("data-ln-hash"))return null;const o=t.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const d=t.getAttribute("data-ln-sort")||t.getAttribute("data-ln-search-for")||t.getAttribute("data-ln-search")||t.getAttribute("data-ln-filter")||t.id;return d?e?d+"-"+e:d:e||null}function B(t,e){return!e||e==="none"||t===null||t===void 0?null:String(t)+"."+e}function j(t){return!t||typeof t!="string"?null:t.endsWith(".asc")?{fieldOrColumn:t.slice(0,-4),direction:"asc"}:t.endsWith(".desc")?{fieldOrColumn:t.slice(0,-5),direction:"desc"}:null}function I(t,e){return!t||!Array.isArray(e)||e.length===0?null:t+":"+e.map(encodeURIComponent).join(",")}function W(t){if(!t||typeof t!="string")return null;const e=t.indexOf(":");if(e===-1)return null;const o=t.slice(0,e),d=t.slice(e+1),a=d?d.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:o,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=g,window.lnCore.hashGet=T,window.lnCore.hashSet=M,window.lnCore.hashLinkClick=U,window.lnCore.resolveHashNamespace=q,window.lnCore.hashSortEncode=B,window.lnCore.hashSortDecode=j,window.lnCore.hashFilterEncode=I,window.lnCore.hashFilterDecode=W);function G(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=G);function K(t){if(typeof t=="string")return t;if(t&&typeof t=="object"){if(typeof t.href=="string")return t.href;if(typeof t.url=="string")return t.url}return String(t||"")}function N(t,e){return e&&e.method?String(e.method).toUpperCase():t&&typeof t=="object"&&t.method?String(t.method).toUpperCase():"GET"}function R(t,e){return(e||"GET")+" "+(t||"")}function P(t){const e=(t||"").toUpperCase();return e==="GET"||e==="HEAD"}(function(){if(window.lnHttp)return;const t=window.fetch.bind(window),e=new Map,o=new Map;function d(n,r){r=r||{};const l=K(n),i=N(n,r),c=R(l,i);P(i)&&e.has(c)&&(e.get(c).abort(),e.delete(c));const u=new AbortController,f=r.signal;let h=null;f&&(f.aborted?u.abort(f.reason):(h=function(){u.abort(f.reason)},f.addEventListener("abort",h,{once:!0})));const w=Object.assign({},r,{signal:u.signal});return e.set(c,u),t(n,w).finally(function(){f&&h&&f.removeEventListener("abort",h),e.get(c)===u&&e.delete(c)})}d.toString=function(){return"function fetch() { [ln-http wrapped] }"},window.fetch=d;function a(n){if(!n.detail||!n.detail.url)return;const r=n.target,l=(n.detail.method||(n.detail.body?"POST":"GET")).toUpperCase(),i=n.detail.key;i&&o.has(i)&&(o.get(i).abort(),o.delete(i));const c=new AbortController,u=n.detail.signal;let f=null;u&&(u.aborted?c.abort(u.reason):(f=function(){c.abort(u.reason)},u.addEventListener("abort",f,{once:!0}))),i&&o.set(i,c);const h={method:l,signal:c.signal};n.detail.body!==void 0&&(h.body=n.detail.body),window.fetch(n.detail.url,h).then(function(w){u&&f&&u.removeEventListener("abort",f),i&&o.get(i)===c&&o.delete(i),p(r,"ln-http:response",{ok:w.ok,status:w.status,response:w})}).catch(function(w){u&&f&&u.removeEventListener("abort",f),i&&o.get(i)===c&&o.delete(i),!(w&&w.name==="AbortError")&&p(r,"ln-http:error",{ok:!1,status:0,error:w})})}function s(n){const r=n.detail||{};r.all?window.lnHttp.cancelAll():r.key?window.lnHttp.cancelByKey(r.key):r.url&&window.lnHttp.cancel(r.url)}document.addEventListener("ln-http:request",a),document.addEventListener("ln-http:cancel",s),window.lnHttp={cancel:function(n){let r=!1;return e.forEach(function(l,i){i.endsWith(" "+n)&&(l.abort(),e.delete(i),r=!0)}),r},cancelByKey:function(n){return o.has(n)?(o.get(n).abort(),o.delete(n),!0):!1},cancelAll:function(){e.forEach(function(n){n.abort()}),e.clear(),o.forEach(function(n){n.abort()}),o.clear()},get inflight(){const n=[];return e.forEach(function(r,l){const i=l.indexOf(" ");n.push({method:l.slice(0,i),url:l.slice(i+1)})}),o.forEach(function(r,l){n.push({key:l})}),n},destroy:function(){window.lnHttp.cancelAll(),document.removeEventListener("ln-http:request",a),document.removeEventListener("ln-http:cancel",s),window.fetch=t,delete window.lnHttp}}})()})();
|