@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.
Files changed (221) hide show
  1. package/LICENSE +641 -641
  2. package/components/COMPONENTS.md +1116 -1116
  3. package/components/index.js +81 -81
  4. package/components/ln-accordion/ln-accordion-dev.scss +8 -8
  5. package/components/ln-accordion/ln-accordion.js +1 -1
  6. package/components/ln-accordion/ln-accordion.schema.json +30 -30
  7. package/components/ln-accordion/src/ln-accordion.js +1 -0
  8. package/components/ln-ajax/ln-ajax-dev.scss +8 -8
  9. package/components/ln-ajax/ln-ajax.js +1 -1
  10. package/components/ln-ajax/ln-ajax.schema.json +30 -30
  11. package/components/ln-api-connector/ln-api-connector.js +1 -1
  12. package/components/ln-api-connector/ln-api-connector.schema.json +96 -96
  13. package/components/ln-api-connector/src/ln-api-connector.js +1 -0
  14. package/components/ln-api-queue/ln-api-queue.js +1 -1
  15. package/components/ln-api-queue/ln-api-queue.schema.json +34 -34
  16. package/components/ln-api-queue/src/ln-api-queue.js +3 -13
  17. package/components/ln-autoresize/ln-autoresize-dev.scss +8 -8
  18. package/components/ln-autoresize/ln-autoresize.js +1 -1
  19. package/components/ln-autoresize/ln-autoresize.schema.json +22 -22
  20. package/components/ln-autosave/ln-autosave-dev.scss +13 -13
  21. package/components/ln-autosave/ln-autosave.js +1 -1
  22. package/components/ln-autosave/ln-autosave.schema.json +48 -48
  23. package/components/ln-autosave/src/autosave-model.js +34 -34
  24. package/components/ln-chart/ln-chart.js +1 -1
  25. package/components/ln-chart/ln-chart.schema.json +146 -146
  26. package/components/ln-chart/src/chart-model.js +154 -154
  27. package/components/ln-circular-progress/ln-circular-progress.js +1 -1
  28. package/components/ln-circular-progress/ln-circular-progress.schema.json +42 -42
  29. package/components/ln-confirm/ln-confirm-dev.scss +24 -24
  30. package/components/ln-confirm/ln-confirm.js +1 -1
  31. package/components/ln-confirm/ln-confirm.schema.json +66 -66
  32. package/components/ln-confirm/src/ln-confirm.js +178 -178
  33. package/components/ln-core/crypto.js +286 -265
  34. package/components/ln-core/dom.js +115 -115
  35. package/components/ln-core/form.js +136 -136
  36. package/components/ln-core/helpers.js +33 -33
  37. package/components/ln-core/http.js +48 -48
  38. package/components/ln-core/index.js +1 -1
  39. package/components/ln-core/ln-core.schema.json +109 -109
  40. package/components/ln-core/locale.js +55 -55
  41. package/components/ln-core/matching.js +78 -78
  42. package/components/ln-core/number.js +125 -125
  43. package/components/ln-core/template.js +206 -206
  44. package/components/ln-couchdb-connector/README.md +4 -0
  45. package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
  46. package/components/ln-couchdb-connector/ln-couchdb-connector.schema.json +50 -50
  47. package/components/ln-couchdb-connector/src/ln-couchdb-connector.js +19 -1
  48. package/components/ln-data-coordinator/README.md +9 -38
  49. package/components/ln-data-coordinator/ln-data-coordinator-dev.scss +8 -8
  50. package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
  51. package/components/ln-data-coordinator/ln-data-coordinator.schema.json +16 -16
  52. package/components/ln-data-coordinator/src/data-read-policy.js +0 -7
  53. package/components/ln-data-coordinator/src/ln-data-coordinator.js +428 -1299
  54. package/components/ln-data-store/README.md +3 -2
  55. package/components/ln-data-store/ln-data-store-dev.scss +13 -13
  56. package/components/ln-data-store/ln-data-store.js +1 -1
  57. package/components/ln-data-store/ln-data-store.schema.json +84 -84
  58. package/components/ln-data-store/src/data-store-model.js +184 -155
  59. package/components/ln-data-store/src/ln-data-store.js +58 -11
  60. package/components/ln-date/README.md +4 -0
  61. package/components/ln-date/ln-date.js +1 -1
  62. package/components/ln-date/ln-date.schema.json +92 -92
  63. package/components/ln-date/src/date-model.js +186 -186
  64. package/components/ln-date/src/ln-date.js +3 -3
  65. package/components/ln-debug/ln-debug.js +1 -1
  66. package/components/ln-debug/ln-debug.schema.json +28 -28
  67. package/components/ln-debug/src/console-sink.js +19 -19
  68. package/components/ln-debug/src/gate.js +95 -95
  69. package/components/ln-debug/src/generated-attributes.js +2 -2
  70. package/components/ln-dropdown/ln-dropdown-dev.scss +13 -13
  71. package/components/ln-dropdown/ln-dropdown.js +1 -1
  72. package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
  73. package/components/ln-editor/ln-editor.js +1 -1
  74. package/components/ln-editor/ln-editor.schema.json +58 -58
  75. package/components/ln-external-links/ln-external-links.js +1 -1
  76. package/components/ln-external-links/ln-external-links.schema.json +18 -18
  77. package/components/ln-fill/ln-fill.js +1 -1
  78. package/components/ln-fill/ln-fill.schema.json +23 -23
  79. package/components/ln-filter/ln-filter.js +1 -1
  80. package/components/ln-filter/ln-filter.schema.json +153 -153
  81. package/components/ln-filter/src/filter-model.js +185 -185
  82. package/components/ln-form/ln-form-dev.scss +8 -8
  83. package/components/ln-form/ln-form.js +1 -1
  84. package/components/ln-form/ln-form.schema.json +45 -45
  85. package/components/ln-http/ln-http.js +1 -1
  86. package/components/ln-http/ln-http.schema.json +6 -6
  87. package/components/ln-icon/ln-icon.schema.json +6 -6
  88. package/components/ln-include/ln-include.js +1 -1
  89. package/components/ln-include/ln-include.schema.json +23 -23
  90. package/components/ln-key/ln-key-dev.scss +18 -18
  91. package/components/ln-key/ln-key.js +1 -1
  92. package/components/ln-key/ln-key.schema.json +56 -56
  93. package/components/ln-key/src/ln-key.js +10 -10
  94. package/components/ln-link/ln-link-dev.scss +8 -8
  95. package/components/ln-link/ln-link.js +1 -1
  96. package/components/ln-link/ln-link.schema.json +22 -22
  97. package/components/ln-list/README.md +152 -152
  98. package/components/ln-list/ln-list-dev.scss +8 -8
  99. package/components/ln-list/ln-list.js +1 -1
  100. package/components/ln-list/ln-list.schema.json +166 -166
  101. package/components/ln-list/src/ln-list.js +4 -4
  102. package/components/ln-modal/README.md +4 -6
  103. package/components/ln-modal/ln-modal.js +1 -1
  104. package/components/ln-modal/ln-modal.schema.json +65 -65
  105. package/components/ln-modal/src/ln-modal.js +28 -8
  106. package/components/ln-nav/ln-nav.js +1 -1
  107. package/components/ln-nav/ln-nav.schema.json +25 -25
  108. package/components/ln-number/ln-number.js +1 -1
  109. package/components/ln-number/ln-number.schema.json +63 -63
  110. package/components/ln-number/src/number-model.js +31 -31
  111. package/components/ln-obfuscator/README.md +60 -60
  112. package/components/ln-obfuscator/ln-obfuscator.js +1 -1
  113. package/components/ln-obfuscator/ln-obfuscator.schema.json +49 -49
  114. package/components/ln-obfuscator/src/ln-obfuscator.js +159 -159
  115. package/components/ln-obfuscator/src/obfuscator-model.js +250 -250
  116. package/components/ln-options/ln-options.js +1 -1
  117. package/components/ln-options/ln-options.schema.json +41 -41
  118. package/components/ln-options/src/ln-options.js +1 -0
  119. package/components/ln-persist/README.md +151 -151
  120. package/components/ln-persist/ln-persist.js +1 -1
  121. package/components/ln-persist/ln-persist.schema.json +28 -28
  122. package/components/ln-persist/src/ln-persist.js +83 -83
  123. package/components/ln-picklist/README.md +230 -230
  124. package/components/ln-picklist/ln-picklist-dev.scss +22 -22
  125. package/components/ln-picklist/ln-picklist.js +1 -1
  126. package/components/ln-picklist/ln-picklist.schema.json +49 -49
  127. package/components/ln-picklist/src/ln-picklist.js +228 -228
  128. package/components/ln-popover/README.md +4 -0
  129. package/components/ln-popover/ln-popover-dev.scss +13 -13
  130. package/components/ln-popover/ln-popover.js +1 -1
  131. package/components/ln-popover/ln-popover.schema.json +82 -82
  132. package/components/ln-popover/src/ln-popover.js +9 -0
  133. package/components/ln-progress/ln-progress-dev.scss +8 -8
  134. package/components/ln-progress/ln-progress.js +1 -1
  135. package/components/ln-progress/ln-progress.schema.json +40 -40
  136. package/components/ln-router/ln-router.js +1 -1
  137. package/components/ln-router/ln-router.schema.json +76 -76
  138. package/components/ln-scroll/README.md +45 -45
  139. package/components/ln-scroll/ln-scroll.js +1 -1
  140. package/components/ln-scroll/ln-scroll.schema.json +85 -85
  141. package/components/ln-scroll/src/ln-scroll.js +150 -150
  142. package/components/ln-search/README.md +188 -188
  143. package/components/ln-search/ln-search.js +1 -1
  144. package/components/ln-search/ln-search.schema.json +103 -103
  145. package/components/ln-slug/ln-slug.js +1 -1
  146. package/components/ln-slug/ln-slug.schema.json +23 -23
  147. package/components/ln-sort/ln-sort.js +1 -1
  148. package/components/ln-sort/ln-sort.schema.json +104 -104
  149. package/components/ln-sort/src/ln-sort.js +321 -321
  150. package/components/ln-sort/src/sort-model.js +117 -117
  151. package/components/ln-sortable/ln-sortable-dev.scss +13 -13
  152. package/components/ln-sortable/ln-sortable.js +1 -1
  153. package/components/ln-sortable/ln-sortable.schema.json +36 -36
  154. package/components/ln-stat/ln-stat-dev.scss +8 -8
  155. package/components/ln-stat/ln-stat.js +1 -1
  156. package/components/ln-stat/ln-stat.schema.json +32 -32
  157. package/components/ln-stat/src/stat-model.js +28 -28
  158. package/components/ln-table/ln-table.js +1 -1
  159. package/components/ln-table/ln-table.schema.json +211 -211
  160. package/components/ln-table/src/ln-table.js +2 -0
  161. package/components/ln-table/src/table-model.js +98 -98
  162. package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
  163. package/components/ln-table-coordinator/ln-table-coordinator.schema.json +93 -93
  164. package/components/ln-table-coordinator/src/ln-table-coordinator.js +3 -3
  165. package/components/ln-tabs/README.md +2 -2
  166. package/components/ln-tabs/ln-tabs.js +1 -1
  167. package/components/ln-tabs/ln-tabs.schema.json +75 -75
  168. package/components/ln-tabs/src/ln-tabs.js +208 -207
  169. package/components/ln-tabs/src/tabs-model.js +82 -82
  170. package/components/ln-time/ln-time-dev.scss +13 -13
  171. package/components/ln-time/ln-time.js +1 -1
  172. package/components/ln-time/ln-time.schema.json +38 -38
  173. package/components/ln-toast/ln-toast.js +1 -1
  174. package/components/ln-toast/ln-toast.schema.json +65 -65
  175. package/components/ln-toggle/ln-toggle.js +1 -1
  176. package/components/ln-toggle/ln-toggle.schema.json +52 -52
  177. package/components/ln-tooltip/ln-tooltip.js +1 -1
  178. package/components/ln-tooltip/ln-tooltip.schema.json +86 -86
  179. package/components/ln-translations/ln-translations.js +1 -1
  180. package/components/ln-translations/ln-translations.schema.json +120 -120
  181. package/components/ln-ui-coordinator/README.md +62 -62
  182. package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
  183. package/components/ln-ui-coordinator/ln-ui-coordinator.schema.json +28 -28
  184. package/components/ln-ui-coordinator/src/ln-ui-coordinator.js +140 -140
  185. package/components/ln-upload/ln-upload.js +1 -1
  186. package/components/ln-upload/ln-upload.schema.json +193 -193
  187. package/components/ln-upload/src/upload-model.js +78 -78
  188. package/components/ln-validate/ln-validate.js +1 -1
  189. package/components/ln-validate/ln-validate.schema.json +50 -50
  190. package/components/ln-validate/src/validate-model.js +64 -64
  191. package/components/ln-websocket-connector/README.md +166 -166
  192. package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
  193. package/components/ln-websocket-connector/ln-websocket-connector.schema.json +29 -29
  194. package/components/ln-websocket-connector/src/ln-websocket-connector.js +283 -279
  195. package/ln-ashlar.html-data.json +7 -8
  196. package/package.json +84 -84
  197. package/theme/brand.css +73 -73
  198. package/theme/components/_confirm.scss +6 -6
  199. package/theme/components/_picklist.scss +3 -3
  200. package/theme/config/_palette.scss +274 -274
  201. package/theme/config/_theme.scss +292 -292
  202. package/theme/config/_tokens.scss +285 -285
  203. package/theme/config/mixins/_index.scss +62 -62
  204. package/theme/config/mixins/_picklist.scss +66 -66
  205. package/theme/ln-ashlar-dev.scss +66 -66
  206. package/theme/ln-ashlar-landing.scss +56 -56
  207. package/theme/ln-ashlar-theme.scss +63 -63
  208. package/theme/presentation/_bento.scss +151 -151
  209. package/theme/presentation/_cta.scss +111 -111
  210. package/theme/presentation/_effects.scss +216 -216
  211. package/theme/presentation/_features.scss +108 -108
  212. package/theme/presentation/_footer.scss +129 -129
  213. package/theme/presentation/_hero.scss +158 -158
  214. package/theme/presentation/_layout.scss +170 -170
  215. package/theme/presentation/_navbar.scss +140 -140
  216. package/theme/presentation/_pricing.scss +262 -262
  217. package/theme/presentation/_stats.scss +87 -87
  218. package/theme/presentation/_testimonials.scss +124 -124
  219. package/theme/presentation/_tokens.scss +39 -39
  220. package/theme/presentation/_typography.scss +163 -163
  221. package/web-types.json +12 -12
@@ -1,83 +1,83 @@
1
- import { setPersistSink, observeAttributes } from '../../ln-core/index.js';
2
-
3
- (function () {
4
- if (window.lnCore && window.lnCore._persistBound) return;
5
- window.lnCore = window.lnCore || {};
6
- window.lnCore._persistBound = true;
7
-
8
- // ─── Attribute Contract (SSOT) ──────────────────────────
9
- const ATTRIBUTES = {
10
- 'data-ln-persist': { type: 'string', description: 'Storage key identifier for persisting component state in localStorage' },
11
- 'data-ln-persist-scope': { type: 'enum', values: ['global', 'page'], fallback: 'global', description: 'Persistence scope namespace (global or per-page path)' }
12
- };
13
-
14
- function _pageKey() {
15
- const path = location.pathname.replace(/\/+$/, '').toLowerCase();
16
- return path || '/';
17
- }
18
-
19
- // el-first key: ln:{id}:{attr}, or ln:{id}:{pathname}:{attr} when
20
- // data-ln-persist-scope="page" is present.
21
- function _resolveKey(el, attr) {
22
- const explicit = el.getAttribute('data-ln-persist');
23
- const id = (explicit !== null && explicit !== '') ? explicit : el.id;
24
- if (!id) {
25
- console.warn('[ln-persist] Element requires id or data-ln-persist="key"', el);
26
- return null;
27
- }
28
- const scoped = el.getAttribute('data-ln-persist-scope') === 'page';
29
- return scoped
30
- ? ('ln:' + id + ':' + _pageKey() + ':' + attr)
31
- : ('ln:' + id + ':' + attr);
32
- }
33
-
34
- let _storageOk = null;
35
- function _checkStorage() {
36
- if (_storageOk !== null) return _storageOk;
37
- try {
38
- if (typeof localStorage === 'undefined') return (_storageOk = false);
39
- const t = '__ln_persist_test__';
40
- localStorage.setItem(t, t);
41
- localStorage.removeItem(t);
42
- return (_storageOk = true);
43
- } catch (e) {
44
- return (_storageOk = false);
45
- }
46
- }
47
-
48
- const _wiredAttrs = new Set();
49
-
50
- function _persistSink(el, selector) {
51
- const registry = window.lnCore && window.lnCore._attrRegistry;
52
- const entries = (registry && registry.persist) || [];
53
- let entry = null;
54
- for (let i = 0; i < entries.length; i++) {
55
- if (entries[i].selector === selector) { entry = entries[i]; break; }
56
- }
57
- if (!entry) return;
58
- const persist = entry.persist;
59
-
60
- if (!_wiredAttrs.has(persist.attr)) {
61
- _wiredAttrs.add(persist.attr);
62
- observeAttributes([persist.attr], function (changedEl, name) {
63
- if (!changedEl.hasAttribute('data-ln-persist')) return;
64
- if (persist.hashActive && persist.hashActive(changedEl)) return;
65
- const key = _resolveKey(changedEl, name);
66
- if (!key || !_checkStorage()) return;
67
- const value = changedEl.getAttribute(name);
68
- try {
69
- if (value === null) localStorage.removeItem(key);
70
- else localStorage.setItem(key, value);
71
- } catch (e) { /* quota / private mode — silent */ }
72
- });
73
- }
74
-
75
- if (persist.hashActive && persist.hashActive(el)) return;
76
- const key = _resolveKey(el, persist.attr);
77
- if (!key || !_checkStorage()) return;
78
- const saved = localStorage.getItem(key);
79
- if (saved !== null) el.setAttribute(persist.attr, saved);
80
- }
81
-
82
- setPersistSink(_persistSink);
83
- })();
1
+ import { setPersistSink, observeAttributes } from '../../ln-core/index.js';
2
+
3
+ (function () {
4
+ if (window.lnCore && window.lnCore._persistBound) return;
5
+ window.lnCore = window.lnCore || {};
6
+ window.lnCore._persistBound = true;
7
+
8
+ // ─── Attribute Contract (SSOT) ──────────────────────────
9
+ const ATTRIBUTES = {
10
+ 'data-ln-persist': { type: 'string', description: 'Storage key identifier for persisting component state in localStorage' },
11
+ 'data-ln-persist-scope': { type: 'enum', values: ['global', 'page'], fallback: 'global', description: 'Persistence scope namespace (global or per-page path)' }
12
+ };
13
+
14
+ function _pageKey() {
15
+ const path = location.pathname.replace(/\/+$/, '').toLowerCase();
16
+ return path || '/';
17
+ }
18
+
19
+ // el-first key: ln:{id}:{attr}, or ln:{id}:{pathname}:{attr} when
20
+ // data-ln-persist-scope="page" is present.
21
+ function _resolveKey(el, attr) {
22
+ const explicit = el.getAttribute('data-ln-persist');
23
+ const id = (explicit !== null && explicit !== '') ? explicit : el.id;
24
+ if (!id) {
25
+ console.warn('[ln-persist] Element requires id or data-ln-persist="key"', el);
26
+ return null;
27
+ }
28
+ const scoped = el.getAttribute('data-ln-persist-scope') === 'page';
29
+ return scoped
30
+ ? ('ln:' + id + ':' + _pageKey() + ':' + attr)
31
+ : ('ln:' + id + ':' + attr);
32
+ }
33
+
34
+ let _storageOk = null;
35
+ function _checkStorage() {
36
+ if (_storageOk !== null) return _storageOk;
37
+ try {
38
+ if (typeof localStorage === 'undefined') return (_storageOk = false);
39
+ const t = '__ln_persist_test__';
40
+ localStorage.setItem(t, t);
41
+ localStorage.removeItem(t);
42
+ return (_storageOk = true);
43
+ } catch (e) {
44
+ return (_storageOk = false);
45
+ }
46
+ }
47
+
48
+ const _wiredAttrs = new Set();
49
+
50
+ function _persistSink(el, selector) {
51
+ const registry = window.lnCore && window.lnCore._attrRegistry;
52
+ const entries = (registry && registry.persist) || [];
53
+ let entry = null;
54
+ for (let i = 0; i < entries.length; i++) {
55
+ if (entries[i].selector === selector) { entry = entries[i]; break; }
56
+ }
57
+ if (!entry) return;
58
+ const persist = entry.persist;
59
+
60
+ if (!_wiredAttrs.has(persist.attr)) {
61
+ _wiredAttrs.add(persist.attr);
62
+ observeAttributes([persist.attr], function (changedEl, name) {
63
+ if (!changedEl.hasAttribute('data-ln-persist')) return;
64
+ if (persist.hashActive && persist.hashActive(changedEl)) return;
65
+ const key = _resolveKey(changedEl, name);
66
+ if (!key || !_checkStorage()) return;
67
+ const value = changedEl.getAttribute(name);
68
+ try {
69
+ if (value === null) localStorage.removeItem(key);
70
+ else localStorage.setItem(key, value);
71
+ } catch (e) { /* quota / private mode — silent */ }
72
+ });
73
+ }
74
+
75
+ if (persist.hashActive && persist.hashActive(el)) return;
76
+ const key = _resolveKey(el, persist.attr);
77
+ if (!key || !_checkStorage()) return;
78
+ const saved = localStorage.getItem(key);
79
+ if (saved !== null) el.setAttribute(persist.attr, saved);
80
+ }
81
+
82
+ setPersistSink(_persistSink);
83
+ })();
@@ -1,230 +1,230 @@
1
- # ln-picklist
2
-
3
- > Applied to a container (`data-ln-picklist`) wrapping `<ul data-ln-picklist-list="available">` and `<ul data-ln-picklist-list="selected">`.
4
- > It listens for native `change` events on child `<input type="checkbox">`: when `checked` is true, it moves the parent `<li>` via
5
- > `appendChild` into the `selected` list; when unchecked, it returns it to `available`. Native checkboxes drive both DOM placement
6
- > and form submission (`name`/`value`) with zero hidden inputs or state mirrors.
7
-
8
- ---
9
-
10
- ## 🧭 Philosophy & Architecture
11
-
12
- One parent element (the root) carries the component. It listens for `change`;
13
- checking an item moves it to the other list, unchecking returns it. That is the
14
- entire mechanism — there is no second act.
15
-
16
- Why it is worth having at all: `<select multiple>` is hostile: ctrl-clicking,
17
- no room to see what you picked, and a scroll position that eats your selection.
18
- A picklist puts the pool on the left and the choices on the right, both fully
19
- visible.
20
-
21
- The component itself is deliberately tiny. **The checkbox is the state.** Its
22
- `checked` property and the list the `<li>` currently sits in are the same fact,
23
- and `name` / `value` carry the selection to the server natively — unchecked
24
- boxes are simply not submitted. So there are no hidden inputs, no state
25
- attribute and no JS mirror to keep in sync.
26
-
27
- Everything else composes:
28
-
29
- | Want | Use |
30
- |---|---|
31
- | Filtering a long list | [`ln-search`](../ln-search/README.md) on each `<ul>` |
32
- | Counts, empty states, "select all" | Your page or a project coordinator |
33
- | Drag-and-drop ordering | [`ln-sortable`](../ln-sortable/README.md) |
34
-
35
- ---
36
-
37
- ## 📦 Minimal Blueprint
38
-
39
- ```html
40
- <section data-ln-picklist>
41
- <ul data-ln-picklist-list="available">
42
- <li>
43
- <label>
44
- <input type="checkbox" name="countries[]" value="de">
45
- Germany
46
- </label>
47
- </li>
48
- <li>
49
- <label>
50
- <input type="checkbox" name="countries[]" value="fr">
51
- France
52
- </label>
53
- </li>
54
- </ul>
55
-
56
- <ul data-ln-picklist-list="selected"></ul>
57
- </section>
58
- ```
59
-
60
- On initialization, `ln-picklist` automatically scans all items and transfers any checked
61
- checkbox (`<input type="checkbox" checked>`) into the `selected` list. All items can be
62
- authored in the `available` pool from backend templates, leaving `selected` initially
63
- empty. On form reset, both lists are automatically re-synchronized with `defaultChecked`.
64
-
65
- ### With search on both lists
66
-
67
- `ln-picklist` has no search of its own. Point an `ln-search` control at each
68
- list's `id` and it hides non-matching `<li>` children for free:
69
-
70
- ```html
71
- <section data-ln-picklist>
72
- <section>
73
- <h3 id="pool-h">Available</h3>
74
-
75
- <search aria-label="Search available">
76
- <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-search"></use></svg>
77
- <input type="search" data-ln-search-for="pool" placeholder="Search…">
78
- <button type="button" data-ln-search-clear aria-label="Clear search">
79
- <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-x"></use></svg>
80
- </button>
81
- </search>
82
-
83
- <ul data-ln-picklist-list="available" id="pool" data-ln-search="" aria-labelledby="pool-h">
84
- …
85
- </ul>
86
- </section>
87
-
88
- <section>
89
- <h3 id="picked-h">Selected</h3>
90
- <search aria-label="Search selected">
91
- <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-search"></use></svg>
92
- <input type="search" data-ln-search-for="picked" placeholder="Search…">
93
- <button type="button" data-ln-search-clear aria-label="Clear search">
94
- <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-x"></use></svg>
95
- </button>
96
- </search>
97
-
98
- <ul data-ln-picklist-list="selected" id="picked" data-ln-search="" aria-labelledby="picked-h">
99
- …
100
- </ul>
101
- </section>
102
- </section>
103
- ```
104
-
105
- The `change` event of that search input bubbles to the picklist root; the
106
- component ignores it, because it only acts on checkboxes that live inside one
107
- of its two lists.
108
-
109
- ---
110
-
111
- ## 🛠️ Declarative API Contract
112
-
113
- ### HTML Attributes
114
-
115
- | Attribute | Element | Values | Description |
116
- |---|---|---|---|
117
- | `data-ln-picklist` | Root | `""` \| `"disabled"` | Initializes the component. `"disabled"` blocks moving. |
118
- | `data-ln-picklist-max` | Root | integer (e.g. `"5"`) | Maximum selection limit. Blocks further additions to `selected` and dispatches `ln-picklist:max-reached`. |
119
- | `data-ln-picklist-list` | `<ul>` / `<ol>` | `available` \| `selected` | Marks which list is which. Both are required. |
120
-
121
- There is no attribute on the item. It is found from the checkbox that changed.
122
-
123
- ### JS API
124
-
125
- Accessed via `element.lnPicklist`:
126
-
127
- | Helper | Signature | Description |
128
- |---|---|---|
129
- | `enable` | `()` | Allows moving (sets `data-ln-picklist=""`). |
130
- | `disable` | `()` | Blocks moving (sets `data-ln-picklist="disabled"`). |
131
- | `sync` | `()` | Synchronizes items between available/selected according to checkbox state. |
132
- | `destroy` | `()` | Detaches listeners and cleans up the instance property. |
133
-
134
- ---
135
-
136
- ## ⚡ DOM Events
137
-
138
- All events bubble from the root.
139
-
140
- ### `ln-picklist:max-reached`
141
-
142
- Fires when an item move to `selected` is blocked because the `data-ln-picklist-max` limit has been reached. The checkbox is automatically reverted.
143
-
144
- `detail`: `{ max, item, checkbox, count }`
145
-
146
- ### `ln-picklist:before-move`
147
-
148
- Cancelable. Fires before the item moves. Calling `preventDefault()` aborts the
149
- move **and reverts the checkbox**, so the DOM never contradicts itself.
150
-
151
- `detail`: `{ item, from, to, checkbox }`
152
-
153
- ### `ln-picklist:move`
154
-
155
- Fires after the item has been re-parented.
156
-
157
- `detail`: `{ item, from, to, checkbox }`
158
-
159
- ### `ln-picklist:enabled` / `ln-picklist:disabled`
160
-
161
- Fire when the root attribute crosses the `disabled` boundary.
162
-
163
- `detail`: `{ target }`
164
-
165
- ---
166
-
167
- ## ⚠️ Common Pitfalls
168
-
169
- > [!CAUTION]
170
- > 1. **Rendering a checked item on the left (or an unchecked item on the
171
- > right).** The component treats `checked` and list membership as one fact.
172
- > Mismatched markup stays mismatched until the user touches that checkbox.
173
- > 2. **Omitting one of the two lists.** The component logs a warning and does
174
- > not attach its listener, rather than failing on the first click. With
175
- > `data-ln-debug` on `<body>` the diagnostic is drawn in place.
176
- > 3. **Expecting a name on the item.** The submitted value is the checkbox's
177
- > own `name`/`value`. Give every checkbox the same array-style `name`
178
- > (`countries[]`) and a distinct `value`.
179
- > 4. **Expecting the left list to keep its order.** An unchecked item is
180
- > appended to the end of the available list, not returned to its original
181
- > position.
182
-
183
- ---
184
-
185
- ## 🔧 Internals
186
-
187
- ### Target filtering
188
-
189
- `change` bubbles, so anything composed inside the root reaches the listener.
190
- It acts only when `e.target` resolves to a checkbox whose `<li>` sits directly
191
- in one of the two known lists.
192
-
193
- ### Disabled
194
-
195
- The browser toggles the checkbox before any listener runs, so when disabled the
196
- component *reverts* the toggle rather than merely returning — otherwise the box
197
- would read checked while the item stayed put.
198
-
199
- ### Focus
200
-
201
- Re-parenting a node that holds focus blurs it to `<body>` in Chromium, so focus
202
- is restored to the checkbox after the move — but only when it genuinely had
203
- focus, so a synthetic `change` from a script cannot steal it.
204
-
205
- ### Attribute-driven enable/disable
206
-
207
- `data-ln-picklist` is observed by the shared attribute observer; flipping it to
208
- `"disabled"` and back emits the paired events. No re-initialization.
209
-
210
- ### Form reset
211
-
212
- Resetting a form restores the controls **silently** — the spec fires no
213
- `change` and no `input` for them, only `reset` on the form. So the change
214
- handler never hears about it, and without help the items would sit in whichever
215
- list the user left them while their boxes flipped back.
216
-
217
- The component snapshots the authored placement at boot and re-appends each item
218
- to the list it came from. The work is deferred with `setTimeout(…, 0)`, because
219
- `reset` fires *before* the controls are restored, and skipped if another
220
- listener cancelled the reset. Items the page has since removed are not
221
- resurrected.
222
-
223
- ---
224
-
225
- ## 🎨 Styling
226
-
227
- `@mixin picklist` lays the two lists out side by side and applies
228
- `check-list-outline` to each — checkbox pills with a **visible, focusable**
229
- input. `check-list` is deliberately not used: `@mixin pill` hides the input with
230
- `display: none`, which would drop the control out of the tab order.
1
+ # ln-picklist
2
+
3
+ > Applied to a container (`data-ln-picklist`) wrapping `<ul data-ln-picklist-list="available">` and `<ul data-ln-picklist-list="selected">`.
4
+ > It listens for native `change` events on child `<input type="checkbox">`: when `checked` is true, it moves the parent `<li>` via
5
+ > `appendChild` into the `selected` list; when unchecked, it returns it to `available`. Native checkboxes drive both DOM placement
6
+ > and form submission (`name`/`value`) with zero hidden inputs or state mirrors.
7
+
8
+ ---
9
+
10
+ ## 🧭 Philosophy & Architecture
11
+
12
+ One parent element (the root) carries the component. It listens for `change`;
13
+ checking an item moves it to the other list, unchecking returns it. That is the
14
+ entire mechanism — there is no second act.
15
+
16
+ Why it is worth having at all: `<select multiple>` is hostile: ctrl-clicking,
17
+ no room to see what you picked, and a scroll position that eats your selection.
18
+ A picklist puts the pool on the left and the choices on the right, both fully
19
+ visible.
20
+
21
+ The component itself is deliberately tiny. **The checkbox is the state.** Its
22
+ `checked` property and the list the `<li>` currently sits in are the same fact,
23
+ and `name` / `value` carry the selection to the server natively — unchecked
24
+ boxes are simply not submitted. So there are no hidden inputs, no state
25
+ attribute and no JS mirror to keep in sync.
26
+
27
+ Everything else composes:
28
+
29
+ | Want | Use |
30
+ |---|---|
31
+ | Filtering a long list | [`ln-search`](../ln-search/README.md) on each `<ul>` |
32
+ | Counts, empty states, "select all" | Your page or a project coordinator |
33
+ | Drag-and-drop ordering | [`ln-sortable`](../ln-sortable/README.md) |
34
+
35
+ ---
36
+
37
+ ## 📦 Minimal Blueprint
38
+
39
+ ```html
40
+ <section data-ln-picklist>
41
+ <ul data-ln-picklist-list="available">
42
+ <li>
43
+ <label>
44
+ <input type="checkbox" name="countries[]" value="de">
45
+ Germany
46
+ </label>
47
+ </li>
48
+ <li>
49
+ <label>
50
+ <input type="checkbox" name="countries[]" value="fr">
51
+ France
52
+ </label>
53
+ </li>
54
+ </ul>
55
+
56
+ <ul data-ln-picklist-list="selected"></ul>
57
+ </section>
58
+ ```
59
+
60
+ On initialization, `ln-picklist` automatically scans all items and transfers any checked
61
+ checkbox (`<input type="checkbox" checked>`) into the `selected` list. All items can be
62
+ authored in the `available` pool from backend templates, leaving `selected` initially
63
+ empty. On form reset, both lists are automatically re-synchronized with `defaultChecked`.
64
+
65
+ ### With search on both lists
66
+
67
+ `ln-picklist` has no search of its own. Point an `ln-search` control at each
68
+ list's `id` and it hides non-matching `<li>` children for free:
69
+
70
+ ```html
71
+ <section data-ln-picklist>
72
+ <section>
73
+ <h3 id="pool-h">Available</h3>
74
+
75
+ <search aria-label="Search available">
76
+ <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-search"></use></svg>
77
+ <input type="search" data-ln-search-for="pool" placeholder="Search…">
78
+ <button type="button" data-ln-search-clear aria-label="Clear search">
79
+ <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-x"></use></svg>
80
+ </button>
81
+ </search>
82
+
83
+ <ul data-ln-picklist-list="available" id="pool" data-ln-search="" aria-labelledby="pool-h">
84
+ …
85
+ </ul>
86
+ </section>
87
+
88
+ <section>
89
+ <h3 id="picked-h">Selected</h3>
90
+ <search aria-label="Search selected">
91
+ <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-search"></use></svg>
92
+ <input type="search" data-ln-search-for="picked" placeholder="Search…">
93
+ <button type="button" data-ln-search-clear aria-label="Clear search">
94
+ <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-x"></use></svg>
95
+ </button>
96
+ </search>
97
+
98
+ <ul data-ln-picklist-list="selected" id="picked" data-ln-search="" aria-labelledby="picked-h">
99
+ …
100
+ </ul>
101
+ </section>
102
+ </section>
103
+ ```
104
+
105
+ The `change` event of that search input bubbles to the picklist root; the
106
+ component ignores it, because it only acts on checkboxes that live inside one
107
+ of its two lists.
108
+
109
+ ---
110
+
111
+ ## 🛠️ Declarative API Contract
112
+
113
+ ### HTML Attributes
114
+
115
+ | Attribute | Element | Values | Description |
116
+ |---|---|---|---|
117
+ | `data-ln-picklist` | Root | `""` \| `"disabled"` | Initializes the component. `"disabled"` blocks moving. |
118
+ | `data-ln-picklist-max` | Root | integer (e.g. `"5"`) | Maximum selection limit. Blocks further additions to `selected` and dispatches `ln-picklist:max-reached`. |
119
+ | `data-ln-picklist-list` | `<ul>` / `<ol>` | `available` \| `selected` | Marks which list is which. Both are required. |
120
+
121
+ There is no attribute on the item. It is found from the checkbox that changed.
122
+
123
+ ### JS API
124
+
125
+ Accessed via `element.lnPicklist`:
126
+
127
+ | Helper | Signature | Description |
128
+ |---|---|---|
129
+ | `enable` | `()` | Allows moving (sets `data-ln-picklist=""`). |
130
+ | `disable` | `()` | Blocks moving (sets `data-ln-picklist="disabled"`). |
131
+ | `sync` | `()` | Synchronizes items between available/selected according to checkbox state. |
132
+ | `destroy` | `()` | Detaches listeners and cleans up the instance property. |
133
+
134
+ ---
135
+
136
+ ## ⚡ DOM Events
137
+
138
+ All events bubble from the root.
139
+
140
+ ### `ln-picklist:max-reached`
141
+
142
+ Fires when an item move to `selected` is blocked because the `data-ln-picklist-max` limit has been reached. The checkbox is automatically reverted.
143
+
144
+ `detail`: `{ max, item, checkbox, count }`
145
+
146
+ ### `ln-picklist:before-move`
147
+
148
+ Cancelable. Fires before the item moves. Calling `preventDefault()` aborts the
149
+ move **and reverts the checkbox**, so the DOM never contradicts itself.
150
+
151
+ `detail`: `{ item, from, to, checkbox }`
152
+
153
+ ### `ln-picklist:move`
154
+
155
+ Fires after the item has been re-parented.
156
+
157
+ `detail`: `{ item, from, to, checkbox }`
158
+
159
+ ### `ln-picklist:enabled` / `ln-picklist:disabled`
160
+
161
+ Fire when the root attribute crosses the `disabled` boundary.
162
+
163
+ `detail`: `{ target }`
164
+
165
+ ---
166
+
167
+ ## ⚠️ Common Pitfalls
168
+
169
+ > [!CAUTION]
170
+ > 1. **Rendering a checked item on the left (or an unchecked item on the
171
+ > right).** The component treats `checked` and list membership as one fact.
172
+ > Mismatched markup stays mismatched until the user touches that checkbox.
173
+ > 2. **Omitting one of the two lists.** The component logs a warning and does
174
+ > not attach its listener, rather than failing on the first click. With
175
+ > `data-ln-debug` on `<body>` the diagnostic is drawn in place.
176
+ > 3. **Expecting a name on the item.** The submitted value is the checkbox's
177
+ > own `name`/`value`. Give every checkbox the same array-style `name`
178
+ > (`countries[]`) and a distinct `value`.
179
+ > 4. **Expecting the left list to keep its order.** An unchecked item is
180
+ > appended to the end of the available list, not returned to its original
181
+ > position.
182
+
183
+ ---
184
+
185
+ ## 🔧 Internals
186
+
187
+ ### Target filtering
188
+
189
+ `change` bubbles, so anything composed inside the root reaches the listener.
190
+ It acts only when `e.target` resolves to a checkbox whose `<li>` sits directly
191
+ in one of the two known lists.
192
+
193
+ ### Disabled
194
+
195
+ The browser toggles the checkbox before any listener runs, so when disabled the
196
+ component *reverts* the toggle rather than merely returning — otherwise the box
197
+ would read checked while the item stayed put.
198
+
199
+ ### Focus
200
+
201
+ Re-parenting a node that holds focus blurs it to `<body>` in Chromium, so focus
202
+ is restored to the checkbox after the move — but only when it genuinely had
203
+ focus, so a synthetic `change` from a script cannot steal it.
204
+
205
+ ### Attribute-driven enable/disable
206
+
207
+ `data-ln-picklist` is observed by the shared attribute observer; flipping it to
208
+ `"disabled"` and back emits the paired events. No re-initialization.
209
+
210
+ ### Form reset
211
+
212
+ Resetting a form restores the controls **silently** — the spec fires no
213
+ `change` and no `input` for them, only `reset` on the form. So the change
214
+ handler never hears about it, and without help the items would sit in whichever
215
+ list the user left them while their boxes flipped back.
216
+
217
+ The component snapshots the authored placement at boot and re-appends each item
218
+ to the list it came from. The work is deferred with `setTimeout(…, 0)`, because
219
+ `reset` fires *before* the controls are restored, and skipped if another
220
+ listener cancelled the reset. Items the page has since removed are not
221
+ resurrected.
222
+
223
+ ---
224
+
225
+ ## 🎨 Styling
226
+
227
+ `@mixin picklist` lays the two lists out side by side and applies
228
+ `check-list-outline` to each — checkbox pills with a **visible, focusable**
229
+ input. `check-list` is deliberately not used: `@mixin pill` hides the input with
230
+ `display: none`, which would drop the control out of the tab order.