@livenetworks/ashlar 1.6.1 → 2.0.1
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 -0
- package/README.md +190 -86
- package/{js → components}/COMPONENTS.md +1116 -1108
- package/{js → components}/index.js +81 -58
- package/{js → components}/ln-accordion/README.md +7 -6
- package/components/ln-accordion/ln-accordion-dev.scss +8 -0
- package/components/ln-accordion/ln-accordion.js +1 -0
- package/components/ln-accordion/ln-accordion.schema.json +30 -0
- package/components/ln-accordion/ln-accordion.scss +8 -0
- package/{js → components}/ln-accordion/src/ln-accordion.js +8 -2
- package/{js → components}/ln-ajax/README.md +171 -160
- package/components/ln-ajax/ln-ajax-dev.scss +8 -0
- package/components/ln-ajax/ln-ajax.js +1 -0
- package/components/ln-ajax/ln-ajax.schema.json +30 -0
- package/{js → components}/ln-ajax/src/ln-ajax.js +65 -30
- package/{js → components}/ln-api-connector/README.md +27 -5
- package/components/ln-api-connector/ln-api-connector.js +1 -0
- package/components/ln-api-connector/ln-api-connector.schema.json +96 -0
- package/components/ln-api-connector/src/connector-core.js +97 -0
- package/components/ln-api-connector/src/ln-api-connector.js +447 -0
- package/{js → components}/ln-api-queue/README.md +12 -9
- package/components/ln-api-queue/ln-api-queue.js +1 -0
- package/components/ln-api-queue/ln-api-queue.schema.json +34 -0
- package/{js → components}/ln-api-queue/src/ln-api-queue.js +33 -14
- package/{js → components}/ln-api-queue/src/queue-storage.js +7 -3
- package/{js → components}/ln-autoresize/README.md +129 -127
- package/components/ln-autoresize/ln-autoresize-dev.scss +8 -0
- package/components/ln-autoresize/ln-autoresize.js +1 -0
- package/components/ln-autoresize/ln-autoresize.schema.json +22 -0
- package/{js → components}/ln-autoresize/src/ln-autoresize.js +8 -1
- package/{js → components}/ln-autosave/README.md +127 -124
- package/components/ln-autosave/ln-autosave-dev.scss +13 -0
- package/components/ln-autosave/ln-autosave.js +1 -0
- package/components/ln-autosave/ln-autosave.schema.json +48 -0
- package/components/ln-autosave/src/autosave-model.js +34 -0
- package/{js → components}/ln-autosave/src/ln-autosave.js +65 -58
- package/components/ln-chart/README.md +145 -0
- package/components/ln-chart/ln-chart-dev.scss +20 -0
- package/components/ln-chart/ln-chart.js +1 -0
- package/components/ln-chart/ln-chart.schema.json +146 -0
- package/components/ln-chart/ln-chart.scss +8 -0
- package/components/ln-chart/src/chart-model.js +154 -0
- package/components/ln-chart/src/ln-chart.js +176 -0
- package/{js → components}/ln-circular-progress/README.md +15 -14
- package/components/ln-circular-progress/ln-circular-progress-dev.scss +8 -0
- package/components/ln-circular-progress/ln-circular-progress.js +1 -0
- package/components/ln-circular-progress/ln-circular-progress.schema.json +42 -0
- package/{js → components}/ln-circular-progress/src/ln-circular-progress.js +32 -50
- package/{js → components}/ln-confirm/README.md +69 -18
- package/components/ln-confirm/ln-confirm-dev.scss +24 -0
- package/components/ln-confirm/ln-confirm.js +1 -0
- package/components/ln-confirm/ln-confirm.schema.json +66 -0
- package/components/ln-confirm/ln-confirm.scss +24 -0
- package/{js → components}/ln-confirm/src/ln-confirm.js +180 -171
- package/{js → components}/ln-core/README.md +374 -149
- package/components/ln-core/attrs.js +273 -0
- package/components/ln-core/compare.js +40 -0
- package/components/ln-core/crypto.js +265 -0
- package/components/ln-core/date.js +50 -0
- package/components/ln-core/dom.js +115 -0
- package/components/ln-core/events.js +122 -0
- package/components/ln-core/form.js +136 -0
- package/{js → components}/ln-core/hash.js +149 -92
- package/components/ln-core/helpers.js +33 -0
- package/components/ln-core/http.js +48 -0
- package/components/ln-core/index.js +11 -0
- package/components/ln-core/lifecycle.js +403 -0
- package/components/ln-core/ln-core.schema.json +109 -0
- package/components/ln-core/locale.js +55 -0
- package/components/ln-core/matching.js +78 -0
- package/components/ln-core/number.js +125 -0
- package/components/ln-core/progress.js +30 -0
- package/components/ln-core/template.js +206 -0
- package/{js → components}/ln-core/window-cache.js +247 -213
- package/{js → components}/ln-couchdb-connector/README.md +7 -5
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -0
- package/components/ln-couchdb-connector/ln-couchdb-connector.schema.json +50 -0
- package/{js → components}/ln-couchdb-connector/src/ln-couchdb-connector.js +29 -43
- package/{js → components}/ln-data-coordinator/README.md +109 -73
- package/components/ln-data-coordinator/ln-data-coordinator-dev.scss +8 -0
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -0
- package/components/ln-data-coordinator/ln-data-coordinator.schema.json +196 -0
- package/components/ln-data-coordinator/src/data-read-policy.js +41 -0
- package/{js → components}/ln-data-coordinator/src/ln-data-coordinator.js +411 -154
- package/{js → components}/ln-data-coordinator/src/mutation-receipts.js +0 -5
- package/{js → components}/ln-data-store/README.md +42 -17
- package/components/ln-data-store/ln-data-store-dev.scss +13 -0
- package/components/ln-data-store/ln-data-store.js +1 -0
- package/components/ln-data-store/ln-data-store.schema.json +84 -0
- package/components/ln-data-store/src/data-store-model.js +155 -0
- package/{js → components}/ln-data-store/src/ln-data-store.js +407 -105
- package/components/ln-data-store/src/window-index.js +119 -0
- package/{js → components}/ln-date/README.md +17 -7
- package/{js → components}/ln-date/ln-date-dev.scss +14 -14
- package/components/ln-date/ln-date.js +1 -0
- package/components/ln-date/ln-date.schema.json +92 -0
- package/components/ln-date/src/date-model.js +186 -0
- package/components/ln-date/src/ln-date.js +486 -0
- package/components/ln-debug/README.md +132 -0
- package/components/ln-debug/ln-debug.js +1 -0
- package/components/ln-debug/ln-debug.schema.json +28 -0
- package/components/ln-debug/src/console-sink.js +19 -0
- package/components/ln-debug/src/debug-verifier.js +331 -0
- package/components/ln-debug/src/gate.js +95 -0
- package/components/ln-debug/src/generated-attributes.js +299 -0
- package/components/ln-debug/src/ln-debug.js +60 -0
- package/{js → components}/ln-dropdown/README.md +150 -140
- package/components/ln-dropdown/ln-dropdown-dev.scss +13 -0
- package/components/ln-dropdown/ln-dropdown.js +1 -0
- package/components/ln-dropdown/ln-dropdown.schema.json +90 -0
- package/components/ln-dropdown/ln-dropdown.scss +18 -0
- package/{js → components}/ln-dropdown/src/ln-dropdown.js +114 -11
- package/{js → components}/ln-editor/README.md +11 -9
- package/components/ln-editor/ln-editor-dev.scss +18 -0
- package/components/ln-editor/ln-editor.js +1 -0
- package/components/ln-editor/ln-editor.schema.json +58 -0
- package/components/ln-editor/ln-editor.scss +13 -0
- package/{js → components}/ln-editor/src/ln-editor.js +59 -11
- package/{js → components}/ln-external-links/README.md +10 -8
- package/components/ln-external-links/ln-external-links.js +1 -0
- package/components/ln-external-links/ln-external-links.schema.json +18 -0
- package/{js → components}/ln-external-links/src/ln-external-links.js +13 -11
- package/{js → components}/ln-fill/README.md +6 -8
- package/components/ln-fill/ln-fill.js +1 -0
- package/components/ln-fill/ln-fill.schema.json +23 -0
- package/{js → components}/ln-fill/src/ln-fill.js +7 -1
- package/components/ln-filter/README.md +131 -0
- package/components/ln-filter/ln-filter-dev.scss +13 -0
- package/components/ln-filter/ln-filter.js +1 -0
- package/components/ln-filter/ln-filter.schema.json +153 -0
- package/components/ln-filter/src/filter-model.js +185 -0
- package/components/ln-filter/src/ln-filter.js +435 -0
- package/{js → components}/ln-form/README.md +260 -264
- package/components/ln-form/ln-form-dev.scss +8 -0
- package/components/ln-form/ln-form.js +1 -0
- package/components/ln-form/ln-form.schema.json +45 -0
- package/{js → components}/ln-form/src/ln-form.js +107 -99
- package/{js → components}/ln-http/README.md +11 -6
- package/components/ln-http/ln-http.js +1 -0
- package/components/ln-http/ln-http.schema.json +6 -0
- package/components/ln-http/src/http-core.js +51 -0
- package/{js → components}/ln-http/src/ln-http.js +28 -33
- package/{js → components}/ln-icon/README.md +16 -9
- package/components/ln-icon/ln-icon.schema.json +6 -0
- package/components/ln-include/README.md +75 -0
- package/components/ln-include/ln-include-dev.scss +13 -0
- package/components/ln-include/ln-include.js +1 -0
- package/components/ln-include/ln-include.schema.json +23 -0
- package/components/ln-include/src/ln-include.js +111 -0
- package/components/ln-key/README.md +130 -0
- package/components/ln-key/ln-key-dev.scss +18 -0
- package/components/ln-key/ln-key.js +1 -0
- package/components/ln-key/ln-key.schema.json +56 -0
- package/components/ln-key/src/key-model.js +146 -0
- package/components/ln-key/src/ln-key.js +201 -0
- package/{js → components}/ln-link/README.md +7 -9
- package/components/ln-link/ln-link-dev.scss +8 -0
- package/components/ln-link/ln-link.js +1 -0
- package/components/ln-link/ln-link.schema.json +22 -0
- package/{js → components}/ln-link/src/ln-link.js +16 -11
- package/components/ln-list/README.md +152 -0
- package/components/ln-list/ln-list-dev.scss +8 -0
- package/components/ln-list/ln-list.js +1 -0
- package/components/ln-list/ln-list.schema.json +166 -0
- package/components/ln-list/ln-list.scss +25 -0
- package/{js → components}/ln-list/src/ln-list.js +1301 -1216
- package/{js → components}/ln-modal/README.md +13 -10
- package/components/ln-modal/ln-modal-dev.scss +18 -0
- package/components/ln-modal/ln-modal.js +1 -0
- package/components/ln-modal/ln-modal.schema.json +54 -0
- package/components/ln-modal/ln-modal.scss +51 -0
- package/{js → components}/ln-modal/src/ln-modal.js +164 -137
- package/{js → components}/ln-nav/README.md +11 -11
- package/components/ln-nav/ln-nav.js +1 -0
- package/components/ln-nav/ln-nav.schema.json +25 -0
- package/{js → components}/ln-nav/src/ln-nav.js +25 -14
- package/components/ln-number/README.md +205 -0
- package/{js → components}/ln-number/ln-number-dev.scss +13 -13
- package/components/ln-number/ln-number.js +1 -0
- package/components/ln-number/ln-number.schema.json +63 -0
- package/components/ln-number/src/ln-number.js +400 -0
- package/components/ln-number/src/number-model.js +31 -0
- package/components/ln-obfuscator/README.md +60 -0
- package/components/ln-obfuscator/ln-obfuscator.js +1 -0
- package/components/ln-obfuscator/ln-obfuscator.schema.json +49 -0
- package/components/ln-obfuscator/src/ln-obfuscator.js +159 -0
- package/components/ln-obfuscator/src/obfuscator-model.js +250 -0
- package/{js → components}/ln-options/README.md +3 -1
- package/components/ln-options/ln-options-dev.scss +13 -0
- package/components/ln-options/ln-options.js +1 -0
- package/components/ln-options/ln-options.schema.json +41 -0
- package/{js → components}/ln-options/src/ln-options.js +13 -5
- package/components/ln-persist/README.md +151 -0
- package/components/ln-persist/ln-persist.js +1 -0
- package/components/ln-persist/ln-persist.schema.json +28 -0
- package/components/ln-persist/src/ln-persist.js +83 -0
- package/components/ln-picklist/README.md +230 -0
- package/components/ln-picklist/ln-picklist-dev.scss +22 -0
- package/components/ln-picklist/ln-picklist.js +1 -0
- package/components/ln-picklist/ln-picklist.schema.json +49 -0
- package/components/ln-picklist/src/ln-picklist.js +228 -0
- package/{js → components}/ln-popover/README.md +164 -162
- package/components/ln-popover/ln-popover-dev.scss +13 -0
- package/components/ln-popover/ln-popover.js +1 -0
- package/components/ln-popover/ln-popover.schema.json +82 -0
- package/components/ln-popover/ln-popover.scss +18 -0
- package/{js → components}/ln-popover/src/ln-popover.js +42 -36
- package/{js → components}/ln-progress/README.md +410 -413
- package/components/ln-progress/ln-progress-dev.scss +8 -0
- package/components/ln-progress/ln-progress.js +1 -0
- package/components/ln-progress/ln-progress.schema.json +40 -0
- package/components/ln-progress/src/ln-progress.js +91 -0
- package/components/ln-progress/src/progress-model.js +20 -0
- package/{js → components}/ln-router/README.md +443 -432
- package/components/ln-router/ln-router-dev.scss +13 -0
- package/components/ln-router/ln-router.js +1 -0
- package/components/ln-router/ln-router.schema.json +68 -0
- package/{js → components}/ln-router/src/ln-router.js +585 -539
- package/components/ln-router/src/router-model.js +50 -0
- package/components/ln-scroll/README.md +45 -0
- package/components/ln-scroll/ln-scroll.js +1 -0
- package/components/ln-scroll/ln-scroll.schema.json +85 -0
- package/components/ln-scroll/src/ln-scroll.js +150 -0
- package/components/ln-search/README.md +188 -0
- package/components/ln-search/ln-search-dev.scss +13 -0
- package/components/ln-search/ln-search.js +1 -0
- package/components/ln-search/ln-search.schema.json +103 -0
- package/components/ln-search/src/ln-search.js +330 -0
- package/{js → components}/ln-slug/README.md +6 -3
- package/components/ln-slug/ln-slug-dev.scss +18 -0
- package/components/ln-slug/ln-slug.js +1 -0
- package/components/ln-slug/ln-slug.schema.json +23 -0
- package/{js → components}/ln-slug/src/ln-slug.js +20 -13
- package/components/ln-slug/src/slug-model.js +21 -0
- package/{js → components}/ln-sort/README.md +178 -170
- package/{js → components}/ln-sort/ln-sort-dev.scss +8 -8
- package/components/ln-sort/ln-sort.js +1 -0
- package/components/ln-sort/ln-sort.schema.json +104 -0
- package/components/ln-sort/src/ln-sort.js +321 -0
- package/components/ln-sort/src/sort-model.js +117 -0
- package/{js → components}/ln-sortable/README.md +7 -11
- package/components/ln-sortable/ln-sortable-dev.scss +13 -0
- package/components/ln-sortable/ln-sortable.js +1 -0
- package/components/ln-sortable/ln-sortable.schema.json +36 -0
- package/{js → components}/ln-sortable/src/ln-sortable.js +8 -13
- package/{js → components}/ln-stat/README.md +3 -1
- package/components/ln-stat/ln-stat-dev.scss +8 -0
- package/components/ln-stat/ln-stat.js +1 -0
- package/components/ln-stat/ln-stat.schema.json +32 -0
- package/{js → components}/ln-stat/src/ln-stat.js +14 -18
- package/components/ln-stat/src/stat-model.js +28 -0
- package/{js → components}/ln-table/README.md +37 -24
- package/{js → components}/ln-table/ln-table-dev.scss +17 -17
- package/components/ln-table/ln-table.js +1 -0
- package/components/ln-table/ln-table.schema.json +211 -0
- package/components/ln-table/ln-table.scss +15 -0
- package/{js → components}/ln-table/src/ln-table.js +1365 -1493
- package/components/ln-table/src/table-model.js +98 -0
- package/components/ln-table-coordinator/README.md +61 -0
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -0
- package/components/ln-table-coordinator/ln-table-coordinator.schema.json +93 -0
- package/components/ln-table-coordinator/src/ln-table-coordinator.js +193 -0
- package/{js → components}/ln-tabs/README.md +32 -14
- package/components/ln-tabs/ln-tabs-dev.scss +24 -0
- package/components/ln-tabs/ln-tabs.js +1 -0
- package/components/ln-tabs/ln-tabs.schema.json +75 -0
- package/components/ln-tabs/ln-tabs.scss +8 -0
- package/components/ln-tabs/src/ln-tabs.js +207 -0
- package/components/ln-tabs/src/tabs-model.js +82 -0
- package/{js → components}/ln-time/README.md +96 -95
- package/components/ln-time/ln-time-dev.scss +13 -0
- package/components/ln-time/ln-time.js +1 -0
- package/components/ln-time/ln-time.schema.json +38 -0
- package/{js → components}/ln-time/src/ln-time.js +206 -223
- package/components/ln-time/src/time-model.js +64 -0
- package/{js → components}/ln-toast/README.md +23 -5
- package/components/ln-toast/ln-toast-dev.scss +8 -0
- package/components/ln-toast/ln-toast.js +1 -0
- package/components/ln-toast/ln-toast.schema.json +65 -0
- package/components/ln-toast/ln-toast.scss +59 -0
- package/{js → components}/ln-toast/src/ln-toast.js +233 -232
- package/{js → components}/ln-toggle/README.md +198 -196
- package/{js → components}/ln-toggle/ln-toggle-dev.scss +13 -13
- package/components/ln-toggle/ln-toggle.js +1 -0
- package/components/ln-toggle/ln-toggle.schema.json +52 -0
- package/components/ln-toggle/ln-toggle.scss +37 -0
- package/{js → components}/ln-toggle/src/ln-toggle.js +61 -46
- package/{js → components}/ln-tooltip/README.md +6 -6
- package/{js → components}/ln-tooltip/ln-tooltip-dev.scss +9 -9
- package/components/ln-tooltip/ln-tooltip.js +1 -0
- package/components/ln-tooltip/ln-tooltip.schema.json +86 -0
- package/components/ln-tooltip/ln-tooltip.scss +9 -0
- package/{js → components}/ln-tooltip/src/ln-tooltip.js +14 -3
- package/{js → components}/ln-translations/README.md +3 -1
- package/components/ln-translations/ln-translations-dev.scss +13 -0
- package/components/ln-translations/ln-translations.js +1 -0
- package/components/ln-translations/ln-translations.schema.json +120 -0
- package/{js → components}/ln-translations/src/ln-translations.js +25 -10
- package/components/ln-ui-coordinator/README.md +101 -0
- package/components/ln-ui-coordinator/ln-ui-coordinator-dev.scss +8 -0
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -0
- package/components/ln-ui-coordinator/ln-ui-coordinator.schema.json +60 -0
- package/{js/ln-modal-coordinator/src/ln-modal-coordinator.js → components/ln-ui-coordinator/src/ln-ui-coordinator.js} +403 -345
- package/components/ln-upload/README.md +133 -0
- package/components/ln-upload/ln-upload-dev.scss +18 -0
- package/components/ln-upload/ln-upload.js +1 -0
- package/components/ln-upload/ln-upload.schema.json +193 -0
- package/components/ln-upload/ln-upload.scss +20 -0
- package/components/ln-upload/src/ln-upload.js +652 -0
- package/components/ln-upload/src/upload-model.js +78 -0
- package/{js → components}/ln-validate/README.md +182 -180
- package/{js → components}/ln-validate/ln-validate-dev.scss +15 -15
- package/components/ln-validate/ln-validate.js +1 -0
- package/components/ln-validate/ln-validate.schema.json +50 -0
- package/components/ln-validate/ln-validate.scss +7 -0
- package/{js → components}/ln-validate/src/ln-validate.js +23 -45
- package/components/ln-validate/src/validate-model.js +64 -0
- package/components/ln-websocket-connector/README.md +166 -0
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -0
- package/components/ln-websocket-connector/ln-websocket-connector.schema.json +29 -0
- package/components/ln-websocket-connector/src/ln-websocket-connector.js +279 -0
- package/ln-ashlar.html-data.json +1796 -0
- package/package.json +84 -61
- package/{scss → theme}/base/_global.scss +1 -2
- package/{scss → theme}/base/_reset.scss +1 -1
- package/{scss → theme}/base/_typography.scss +2 -0
- package/theme/brand.css +73 -0
- package/{scss → theme}/components/_app-shell.scss +8 -0
- package/theme/components/_button.scss +24 -0
- package/theme/components/_chart.scss +5 -0
- package/theme/components/_confirm.scss +6 -0
- package/{scss → theme}/components/_date.scss +30 -22
- package/{scss → theme}/components/_dropdown.scss +6 -1
- package/theme/components/_form.scss +140 -0
- package/{scss → theme}/components/_layout.scss +6 -0
- package/{scss → theme}/components/_ln-table.scss +1 -6
- package/theme/components/_picklist.scss +3 -0
- package/{scss → theme}/components/_sort.scss +10 -10
- package/theme/components/_status-badge.scss +6 -0
- package/{scss → theme}/components/_table.scss +16 -0
- package/{scss → theme}/components/_tabs.scss +0 -4
- package/theme/components/_toast.scss +48 -0
- package/{scss → theme}/components/_toggle.scss +1 -1
- package/theme/components/_upload.scss +45 -0
- package/{scss → theme}/config/_breakpoints.scss +1 -1
- package/theme/config/_contrast.scss +128 -0
- package/{scss → theme}/config/_density.scss +191 -205
- package/theme/config/_palette.scss +274 -0
- package/theme/config/_theme.scss +293 -0
- package/{scss → theme}/config/_tokens.scss +285 -441
- package/{scss → theme}/config/mixins/_accordion.scss +1 -1
- package/{scss → theme}/config/mixins/_alert.scss +1 -0
- package/{scss → theme}/config/mixins/_app-shell.scss +4 -2
- package/{scss → theme}/config/mixins/_borders.scss +2 -0
- package/theme/config/mixins/_btn.scss +175 -0
- package/{scss → theme}/config/mixins/_card.scss +55 -46
- package/theme/config/mixins/_chart.scss +82 -0
- package/{scss → theme}/config/mixins/_collapsible.scss +2 -1
- package/{scss → theme}/config/mixins/_colors.scss +8 -14
- package/{scss → theme}/config/mixins/_diagnostics.scss +48 -48
- package/theme/config/mixins/_dropdown.scss +169 -0
- package/{scss → theme}/config/mixins/_editor.scss +0 -7
- package/{scss → theme}/config/mixins/_filter.scss +47 -47
- package/{scss → theme}/config/mixins/_footer.scss +1 -1
- package/{scss → theme}/config/mixins/_form.scss +49 -18
- package/{scss → theme}/config/mixins/_index.scss +62 -61
- package/{scss → theme}/config/mixins/_layout.scss +6 -2
- package/{scss → theme}/config/mixins/_ln-table.scss +31 -10
- package/{scss → theme}/config/mixins/_loader.scss +1 -1
- package/{scss → theme}/config/mixins/_modal.scss +145 -149
- package/{scss → theme}/config/mixins/_motion.scss +13 -0
- package/{scss → theme}/config/mixins/_nav.scss +7 -7
- package/theme/config/mixins/_picklist.scss +66 -0
- package/theme/config/mixins/_popover.scss +96 -0
- package/{scss → theme}/config/mixins/_sidebar.scss +7 -4
- package/{scss → theme}/config/mixins/_sort.scss +43 -42
- package/{scss → theme}/config/mixins/_status-badge.scss +15 -2
- package/{scss → theme}/config/mixins/_table.scss +25 -14
- package/{scss → theme}/config/mixins/_tabs.scss +1 -1
- package/{scss → theme}/config/mixins/_toast.scss +174 -179
- package/{scss → theme}/config/mixins/_tooltip.scss +2 -2
- package/{scss → theme}/config/mixins/_typography.scss +16 -5
- package/{scss → theme}/config/mixins/_upload.scss +8 -6
- package/theme/ln-ashlar-core.scss +24 -0
- package/theme/ln-ashlar-dev.scss +66 -0
- package/theme/ln-ashlar-landing.scss +56 -0
- package/{scss/ln-ashlar.scss → theme/ln-ashlar-theme.scss} +63 -69
- package/theme/ln-ashlar.scss +8 -0
- package/theme/presentation/_bento.scss +151 -0
- package/theme/presentation/_cta.scss +111 -0
- package/theme/presentation/_effects.scss +216 -0
- package/theme/presentation/_features.scss +108 -0
- package/theme/presentation/_footer.scss +129 -0
- package/theme/presentation/_hero.scss +158 -0
- package/theme/presentation/_layout.scss +170 -0
- package/theme/presentation/_navbar.scss +140 -0
- package/theme/presentation/_pricing.scss +262 -0
- package/theme/presentation/_stats.scss +87 -0
- package/theme/presentation/_testimonials.scss +124 -0
- package/theme/presentation/_tokens.scss +39 -0
- package/theme/presentation/_typography.scss +163 -0
- package/{scss → theme}/utilities/_animations.scss +38 -0
- package/{scss → theme}/utilities/_utilities.scss +6 -0
- package/web-types.json +2312 -0
- package/js/ln-accordion/ln-accordion.js +0 -1
- package/js/ln-ajax/ln-ajax.js +0 -1
- package/js/ln-api-connector/ln-api-connector.js +0 -1
- package/js/ln-api-connector/src/ln-api-connector.js +0 -368
- package/js/ln-api-queue/ln-api-queue.js +0 -1
- package/js/ln-autoresize/ln-autoresize.js +0 -1
- package/js/ln-autosave/ln-autosave.js +0 -1
- package/js/ln-circular-progress/ln-circular-progress.js +0 -1
- package/js/ln-confirm/_ln-confirm.scss +0 -24
- package/js/ln-confirm/ln-confirm.js +0 -1
- package/js/ln-core/crypto.js +0 -83
- package/js/ln-core/helpers.js +0 -788
- package/js/ln-core/index.js +0 -7
- package/js/ln-core/persist.js +0 -97
- package/js/ln-couchdb-connector/ln-couchdb-connector.js +0 -1
- package/js/ln-data-coordinator/ln-data-coordinator.js +0 -1
- package/js/ln-data-coordinator/src/data-read-policy.js +0 -18
- package/js/ln-data-store/ln-data-store.js +0 -1
- package/js/ln-date/ln-date.js +0 -1
- package/js/ln-date/src/ln-date.js +0 -603
- package/js/ln-debug/README.md +0 -58
- package/js/ln-debug/ln-debug.js +0 -1
- package/js/ln-debug/src/ln-debug.js +0 -19
- package/js/ln-dropdown/ln-dropdown.js +0 -1
- package/js/ln-dropdown/ln-dropdown.scss +0 -15
- package/js/ln-editor/ln-editor.js +0 -1
- package/js/ln-editor/ln-editor.scss +0 -43
- package/js/ln-external-links/ln-external-links.js +0 -1
- package/js/ln-fill/ln-fill.js +0 -1
- package/js/ln-filter/README.md +0 -189
- package/js/ln-filter/ln-filter-dev.scss +0 -8
- package/js/ln-filter/ln-filter.js +0 -1
- package/js/ln-filter/src/ln-filter.js +0 -419
- package/js/ln-form/ln-form.js +0 -1
- package/js/ln-http/ln-http.js +0 -1
- package/js/ln-link/ln-link.js +0 -1
- package/js/ln-list/README.md +0 -129
- package/js/ln-list/ln-list.js +0 -1
- package/js/ln-list/ln-list.scss +0 -28
- package/js/ln-modal/ln-modal-dev.scss +0 -13
- package/js/ln-modal/ln-modal.js +0 -1
- package/js/ln-modal/ln-modal.scss +0 -35
- package/js/ln-modal-coordinator/README.md +0 -99
- package/js/ln-modal-coordinator/ln-modal-coordinator-dev.scss +0 -8
- package/js/ln-modal-coordinator/ln-modal-coordinator.js +0 -1
- package/js/ln-nav/ln-nav.js +0 -1
- package/js/ln-number/README.md +0 -149
- package/js/ln-number/ln-number.js +0 -1
- package/js/ln-number/src/ln-number.js +0 -443
- package/js/ln-options/ln-options.js +0 -1
- package/js/ln-popover/ln-popover.js +0 -1
- package/js/ln-progress/ln-progress.js +0 -1
- package/js/ln-progress/src/ln-progress.js +0 -98
- package/js/ln-router/ln-router.js +0 -1
- package/js/ln-search/README.md +0 -158
- package/js/ln-search/ln-search-dev.scss +0 -8
- package/js/ln-search/ln-search.js +0 -1
- package/js/ln-search/src/ln-search.js +0 -117
- package/js/ln-slug/ln-slug.js +0 -1
- package/js/ln-sort/ln-sort.js +0 -1
- package/js/ln-sort/src/ln-sort.js +0 -178
- package/js/ln-sortable/ln-sortable.js +0 -1
- package/js/ln-stat/ln-stat.js +0 -1
- package/js/ln-table/ln-table.js +0 -1
- package/js/ln-table/ln-table.scss +0 -11
- package/js/ln-table-coordinator/README.md +0 -73
- package/js/ln-table-coordinator/ln-table-coordinator.js +0 -1
- package/js/ln-table-coordinator/src/ln-table-coordinator.js +0 -160
- package/js/ln-tabs/ln-tabs-dev.scss +0 -18
- package/js/ln-tabs/ln-tabs.js +0 -1
- package/js/ln-tabs/src/ln-tabs.js +0 -188
- package/js/ln-time/ln-time.js +0 -1
- package/js/ln-toast/ln-toast.js +0 -1
- package/js/ln-toggle/ln-toggle.js +0 -1
- package/js/ln-tooltip/ln-tooltip.js +0 -1
- package/js/ln-tooltip/ln-tooltip.scss +0 -9
- package/js/ln-translations/ln-translations.js +0 -1
- package/js/ln-upload/README.md +0 -255
- package/js/ln-upload/ln-upload.js +0 -1
- package/js/ln-upload/ln-upload.scss +0 -20
- package/js/ln-upload/src/ln-upload.js +0 -423
- package/js/ln-validate/ln-validate.js +0 -1
- package/scss/components/_button.scss +0 -20
- package/scss/components/_confirm.scss +0 -5
- package/scss/components/_form.scss +0 -107
- package/scss/components/_status-badge.scss +0 -4
- package/scss/components/_toast.scss +0 -68
- package/scss/components/_upload.scss +0 -51
- package/scss/config/_theme.scss +0 -216
- package/scss/config/mixins/_btn.scss +0 -179
- package/scss/config/mixins/_confirm.scss +0 -31
- package/scss/config/mixins/_dropdown.scss +0 -141
- package/scss/config/mixins/_popover.scss +0 -64
- package/scss/ln-ashlar-dev.scss +0 -39
- /package/{js → components}/ln-core/positioning.js +0 -0
- /package/{js → components}/ln-core/reactive.js +0 -0
- /package/{js → components}/ln-filter/ln-filter.scss +0 -0
- /package/{js → components}/ln-icon/ln-icon.js +0 -0
- /package/{js → components}/ln-icon/src/ln-icon.js +0 -0
- /package/{js → components}/ln-search/ln-search.scss +0 -0
- /package/{js → components}/ln-toast/template.html +0 -0
- /package/{scss → theme}/components/_accordion.scss +0 -0
- /package/{scss → theme}/components/_ajax.scss +0 -0
- /package/{scss → theme}/components/_alert.scss +0 -0
- /package/{scss → theme}/components/_avatar.scss +0 -0
- /package/{scss → theme}/components/_breadcrumbs.scss +0 -0
- /package/{scss → theme}/components/_card.scss +0 -0
- /package/{scss → theme}/components/_chip.scss +0 -0
- /package/{scss → theme}/components/_circular-progress.scss +0 -0
- /package/{scss → theme}/components/_editor.scss +0 -0
- /package/{scss → theme}/components/_empty-state.scss +0 -0
- /package/{scss → theme}/components/_filter.scss +0 -0
- /package/{scss → theme}/components/_link.scss +0 -0
- /package/{scss → theme}/components/_loader.scss +0 -0
- /package/{scss → theme}/components/_modal.scss +0 -0
- /package/{scss → theme}/components/_nav.scss +0 -0
- /package/{scss → theme}/components/_page-header.scss +0 -0
- /package/{scss → theme}/components/_popover.scss +0 -0
- /package/{scss → theme}/components/_progress.scss +0 -0
- /package/{scss → theme}/components/_prose.scss +0 -0
- /package/{scss → theme}/components/_scrollbar.scss +0 -0
- /package/{scss → theme}/components/_sections.scss +0 -0
- /package/{scss → theme}/components/_sidebar.scss +0 -0
- /package/{scss → theme}/components/_stat-card.scss +0 -0
- /package/{scss → theme}/components/_stepper.scss +0 -0
- /package/{scss → theme}/components/_timeline.scss +0 -0
- /package/{scss → theme}/components/_tooltip.scss +0 -0
- /package/{scss → theme}/components/_translations.scss +0 -0
- /package/{scss → theme}/config/_icons.scss +0 -0
- /package/{scss → theme}/config/_mixins.scss +0 -0
- /package/{scss → theme}/config/mixins/_ajax.scss +0 -0
- /package/{scss → theme}/config/mixins/_avatar.scss +0 -0
- /package/{scss → theme}/config/mixins/_breadcrumbs.scss +0 -0
- /package/{scss → theme}/config/mixins/_breakpoints.scss +0 -0
- /package/{scss → theme}/config/mixins/_chip.scss +0 -0
- /package/{scss → theme}/config/mixins/_circular-progress.scss +0 -0
- /package/{scss → theme}/config/mixins/_display.scss +0 -0
- /package/{scss → theme}/config/mixins/_empty-state.scss +0 -0
- /package/{scss → theme}/config/mixins/_focus.scss +0 -0
- /package/{scss → theme}/config/mixins/_interaction.scss +0 -0
- /package/{scss → theme}/config/mixins/_kbd.scss +0 -0
- /package/{scss → theme}/config/mixins/_link.scss +0 -0
- /package/{scss → theme}/config/mixins/_page-header.scss +0 -0
- /package/{scss → theme}/config/mixins/_position.scss +0 -0
- /package/{scss → theme}/config/mixins/_progress.scss +0 -0
- /package/{scss → theme}/config/mixins/_prose.scss +0 -0
- /package/{scss → theme}/config/mixins/_shadows.scss +0 -0
- /package/{scss → theme}/config/mixins/_sizing.scss +0 -0
- /package/{scss → theme}/config/mixins/_spacing.scss +0 -0
- /package/{scss → theme}/config/mixins/_stat-card.scss +0 -0
- /package/{scss → theme}/config/mixins/_stepper.scss +0 -0
- /package/{scss → theme}/config/mixins/_timeline.scss +0 -0
- /package/{scss → theme}/config/mixins/_transitions.scss +0 -0
- /package/{scss → theme}/config/mixins/_translations.scss +0 -0
- /package/{scss → theme}/tabler-icons.txt +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
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-search",
|
|
4
|
+
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"data-ln-debug": {
|
|
7
|
+
"direction": null,
|
|
8
|
+
"sources": [
|
|
9
|
+
"ln-search-dev.scss"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"data-ln-hash": {
|
|
13
|
+
"direction": null,
|
|
14
|
+
"sources": [
|
|
15
|
+
"src/ln-search.js"
|
|
16
|
+
],
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "URL hash routing key for search state persistence"
|
|
19
|
+
},
|
|
20
|
+
"data-ln-list-source": {
|
|
21
|
+
"direction": "author",
|
|
22
|
+
"sources": [
|
|
23
|
+
"src/ln-search.js"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"data-ln-search": {
|
|
27
|
+
"direction": "both",
|
|
28
|
+
"sources": [
|
|
29
|
+
"ln-search-dev.scss",
|
|
30
|
+
"src/ln-search.js"
|
|
31
|
+
],
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Active search query term on target element or container"
|
|
34
|
+
},
|
|
35
|
+
"data-ln-search-clear": {
|
|
36
|
+
"direction": "author",
|
|
37
|
+
"sources": [
|
|
38
|
+
"src/ln-search.js"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"data-ln-search-clear-for": {
|
|
42
|
+
"direction": "author",
|
|
43
|
+
"sources": [
|
|
44
|
+
"src/ln-search.js"
|
|
45
|
+
],
|
|
46
|
+
"type": "trigger",
|
|
47
|
+
"description": "Click trigger to clear search input for target"
|
|
48
|
+
},
|
|
49
|
+
"data-ln-search-exclude": {
|
|
50
|
+
"direction": "author",
|
|
51
|
+
"sources": [
|
|
52
|
+
"src/ln-search.js"
|
|
53
|
+
],
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "CSS selector matching child items to exclude from search"
|
|
56
|
+
},
|
|
57
|
+
"data-ln-search-fields": {
|
|
58
|
+
"direction": "author",
|
|
59
|
+
"sources": [
|
|
60
|
+
"src/ln-search.js"
|
|
61
|
+
],
|
|
62
|
+
"type": "list",
|
|
63
|
+
"description": "Comma-separated field names to include in client search"
|
|
64
|
+
},
|
|
65
|
+
"data-ln-search-for": {
|
|
66
|
+
"direction": "author",
|
|
67
|
+
"sources": [
|
|
68
|
+
"ln-search-dev.scss",
|
|
69
|
+
"src/ln-search.js"
|
|
70
|
+
],
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "Target table or list element ID that this input controls"
|
|
73
|
+
},
|
|
74
|
+
"data-ln-search-hide": {
|
|
75
|
+
"direction": "runtime",
|
|
76
|
+
"sources": [
|
|
77
|
+
"ln-search.scss",
|
|
78
|
+
"src/ln-search.js"
|
|
79
|
+
],
|
|
80
|
+
"type": "enum",
|
|
81
|
+
"values": [
|
|
82
|
+
"collapse",
|
|
83
|
+
"none"
|
|
84
|
+
],
|
|
85
|
+
"fallback": "collapse",
|
|
86
|
+
"description": "CSS hiding strategy for non-matching rows"
|
|
87
|
+
},
|
|
88
|
+
"data-ln-search-items": {
|
|
89
|
+
"direction": "author",
|
|
90
|
+
"sources": [
|
|
91
|
+
"src/ln-search.js"
|
|
92
|
+
],
|
|
93
|
+
"type": "string",
|
|
94
|
+
"description": "CSS selector matching searchable child items"
|
|
95
|
+
},
|
|
96
|
+
"data-ln-table-source": {
|
|
97
|
+
"direction": "author",
|
|
98
|
+
"sources": [
|
|
99
|
+
"src/ln-search.js"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { dispatchCancelable, hashGet, hashSet, queueBoot, registerComponent, resolveHashNamespace, defineAttrs, attrSpec, attrStr } from '../../ln-core';
|
|
2
|
+
import { collapseSearchParts, matchesSearchTokens, normalizeSearchTerm, parseSearchFields, tokenizeSearchQuery } from '../../ln-core/matching.js';
|
|
3
|
+
|
|
4
|
+
(function () {
|
|
5
|
+
const DOM_SELECTOR = 'data-ln-search';
|
|
6
|
+
const DOM_ATTRIBUTE = 'lnSearch';
|
|
7
|
+
const CONTROL_SELECTOR = 'data-ln-search-for';
|
|
8
|
+
const CONTROL_ATTRIBUTE = 'lnSearchControl';
|
|
9
|
+
const ITEMS_ATTR = 'data-ln-search-items';
|
|
10
|
+
const FIELDS_ATTR = 'data-ln-search-fields';
|
|
11
|
+
const EXCLUDE_ATTR = 'data-ln-search-exclude';
|
|
12
|
+
const HIDE_ATTR = 'data-ln-search-hide';
|
|
13
|
+
const HASH_ATTR = 'data-ln-hash';
|
|
14
|
+
|
|
15
|
+
if (window[DOM_ATTRIBUTE] !== undefined) return;
|
|
16
|
+
|
|
17
|
+
// ─── Attribute Contract (SSOT) ──────────────────────────
|
|
18
|
+
const ATTRIBUTES = {
|
|
19
|
+
'data-ln-search': { type: 'string', effect: _syncAttribute, description: 'Active search query term on target element or container' },
|
|
20
|
+
'data-ln-hash': { type: 'string', effect: _syncAttribute, description: 'URL hash routing key for search state persistence' },
|
|
21
|
+
'data-ln-search-for': { prop: 'targetId', type: 'string', read: attrStr, fallback: null, description: 'Target table or list element ID that this input controls' },
|
|
22
|
+
'data-ln-search-fields': { type: 'list', description: 'Comma-separated field names to include in client search' },
|
|
23
|
+
'data-ln-search-items': { type: 'string', description: 'CSS selector matching searchable child items' },
|
|
24
|
+
'data-ln-search-exclude': { type: 'string', description: 'CSS selector matching child items to exclude from search' },
|
|
25
|
+
'data-ln-search-hide': { type: 'enum', values: ['collapse', 'none'], fallback: 'collapse', description: 'CSS hiding strategy for non-matching rows' },
|
|
26
|
+
'data-ln-search-clear-for': { type: 'trigger', description: 'Click trigger to clear search input for target' }
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const ATTR_SPEC = attrSpec(ATTRIBUTES);
|
|
30
|
+
|
|
31
|
+
// ─── DOM Helpers ───────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
function _resolveSearchHashNamespace(target) {
|
|
34
|
+
const fromTarget = resolveHashNamespace(target, 'search');
|
|
35
|
+
if (fromTarget) return fromTarget;
|
|
36
|
+
if (target.id) {
|
|
37
|
+
const control = document.querySelector('[' + CONTROL_SELECTOR + '="' + target.id + '"]');
|
|
38
|
+
if (control) {
|
|
39
|
+
const fromControl = resolveHashNamespace(control, 'search');
|
|
40
|
+
if (fromControl) return fromControl;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _resolveInput(host) {
|
|
47
|
+
return host.matches('input, textarea') ? host : host.querySelector('input, textarea');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function _collectText(node, parts) {
|
|
51
|
+
const children = node.childNodes;
|
|
52
|
+
for (let i = 0; i < children.length; i++) {
|
|
53
|
+
const child = children[i];
|
|
54
|
+
if (child.nodeType === 3) {
|
|
55
|
+
parts.push(child.nodeValue);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (child.nodeType !== 1) continue;
|
|
59
|
+
if (child.hasAttribute(EXCLUDE_ATTR)) continue;
|
|
60
|
+
_collectText(child, parts);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _searchText(el) {
|
|
65
|
+
if (el._lnSearchText !== undefined) return el._lnSearchText;
|
|
66
|
+
const parts = [];
|
|
67
|
+
_collectText(el, parts);
|
|
68
|
+
const text = collapseSearchParts(parts);
|
|
69
|
+
el._lnSearchText = text;
|
|
70
|
+
return text;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function _syncControls(target, term) {
|
|
74
|
+
if (!target.id) return;
|
|
75
|
+
const controls = document.querySelectorAll('[' + CONTROL_SELECTOR + '="' + target.id + '"]');
|
|
76
|
+
for (const control of controls) {
|
|
77
|
+
const input = _resolveInput(control);
|
|
78
|
+
if (input && input.value !== term) input.value = term;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ─── State Component (Search Target) ───────────────────────
|
|
83
|
+
|
|
84
|
+
function _stateComponent(dom) {
|
|
85
|
+
this.dom = dom;
|
|
86
|
+
this.term = dom.getAttribute(DOM_SELECTOR) || '';
|
|
87
|
+
this._destroyed = false;
|
|
88
|
+
|
|
89
|
+
const self = this;
|
|
90
|
+
this.nsKey = _resolveSearchHashNamespace(dom);
|
|
91
|
+
this.hashEnabled = !!this.nsKey;
|
|
92
|
+
|
|
93
|
+
this._onHashChange = function () {
|
|
94
|
+
if (self._destroyed || !self.hashEnabled) return;
|
|
95
|
+
const query = hashGet(self.nsKey);
|
|
96
|
+
const current = self.dom.getAttribute(DOM_SELECTOR) || '';
|
|
97
|
+
if (query !== null && query !== current) {
|
|
98
|
+
self.dom.setAttribute(DOM_SELECTOR, query);
|
|
99
|
+
} else if (query === null && current !== '') {
|
|
100
|
+
self.dom.setAttribute(DOM_SELECTOR, '');
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
if (this.hashEnabled) {
|
|
105
|
+
window.addEventListener('hashchange', this._onHashChange);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
queueBoot(function () {
|
|
109
|
+
if (self._destroyed) return;
|
|
110
|
+
if (self.hashEnabled) {
|
|
111
|
+
const hashVal = hashGet(self.nsKey);
|
|
112
|
+
if (hashVal !== null && hashVal !== self.term) {
|
|
113
|
+
self.term = hashVal;
|
|
114
|
+
self.dom.setAttribute(DOM_SELECTOR, hashVal);
|
|
115
|
+
_syncControls(self.dom, hashVal);
|
|
116
|
+
self._apply();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (normalizeSearchTerm(self.term)) {
|
|
121
|
+
_syncControls(self.dom, self.term);
|
|
122
|
+
self._apply();
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
_stateComponent.prototype._apply = function () {
|
|
130
|
+
const dom = this.dom;
|
|
131
|
+
const term = normalizeSearchTerm(this.term);
|
|
132
|
+
const tokens = tokenizeSearchQuery(term);
|
|
133
|
+
|
|
134
|
+
if (this.hashEnabled) {
|
|
135
|
+
hashSet(this.nsKey, this.term ? this.term : null);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const fields = parseSearchFields(dom.getAttribute(FIELDS_ATTR));
|
|
139
|
+
const evt = dispatchCancelable(dom, 'ln-search:change', {
|
|
140
|
+
term: term,
|
|
141
|
+
tokens: tokens,
|
|
142
|
+
targetId: dom.id,
|
|
143
|
+
fields: fields
|
|
144
|
+
});
|
|
145
|
+
if (evt.defaultPrevented) return;
|
|
146
|
+
|
|
147
|
+
const itemsSelector = dom.getAttribute(ITEMS_ATTR);
|
|
148
|
+
const items = itemsSelector ? dom.querySelectorAll(itemsSelector) : dom.children;
|
|
149
|
+
|
|
150
|
+
for (let i = 0; i < items.length; i++) {
|
|
151
|
+
const el = items[i];
|
|
152
|
+
el.removeAttribute(HIDE_ATTR);
|
|
153
|
+
if (el.hasAttribute(EXCLUDE_ATTR)) continue;
|
|
154
|
+
if (tokens.length === 0) continue;
|
|
155
|
+
|
|
156
|
+
const text = _searchText(el);
|
|
157
|
+
if (!matchesSearchTokens(text, tokens)) {
|
|
158
|
+
el.setAttribute(HIDE_ATTR, 'true');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
_stateComponent.prototype.destroy = function () {
|
|
164
|
+
if (!this.dom[DOM_ATTRIBUTE]) return;
|
|
165
|
+
this._destroyed = true;
|
|
166
|
+
if (this.hashEnabled && this._onHashChange) {
|
|
167
|
+
window.removeEventListener('hashchange', this._onHashChange);
|
|
168
|
+
}
|
|
169
|
+
delete this.dom[DOM_ATTRIBUTE];
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// ─── Control Component (Search Input / Proxy) ──────────────
|
|
173
|
+
|
|
174
|
+
function _controlComponent(dom) {
|
|
175
|
+
this.dom = dom;
|
|
176
|
+
defineAttrs(this, dom, ATTR_SPEC);
|
|
177
|
+
this.input = _resolveInput(dom);
|
|
178
|
+
|
|
179
|
+
this._attachHandler();
|
|
180
|
+
|
|
181
|
+
if (this.input && this.input.value.trim()) {
|
|
182
|
+
const self = this;
|
|
183
|
+
queueBoot(function () {
|
|
184
|
+
const target = document.getElementById(self.targetId);
|
|
185
|
+
if (!target) return;
|
|
186
|
+
if ((target.getAttribute(DOM_SELECTOR) || '').trim()) return;
|
|
187
|
+
self._write(self.input.value);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return this;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
_controlComponent.prototype._write = function (value) {
|
|
195
|
+
const target = document.getElementById(this.targetId);
|
|
196
|
+
if (!target) return;
|
|
197
|
+
if (target.getAttribute(DOM_SELECTOR) === value) return;
|
|
198
|
+
target.setAttribute(DOM_SELECTOR, value);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
_controlComponent.prototype._attachHandler = function () {
|
|
202
|
+
if (!this.input) return;
|
|
203
|
+
const self = this;
|
|
204
|
+
|
|
205
|
+
this._onInput = function () {
|
|
206
|
+
self._write(self.input.value);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
this.input.addEventListener('input', this._onInput);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
_controlComponent.prototype.destroy = function () {
|
|
213
|
+
if (!this.dom[CONTROL_ATTRIBUTE]) return;
|
|
214
|
+
if (this.input && this._onInput) {
|
|
215
|
+
this.input.removeEventListener('input', this._onInput);
|
|
216
|
+
}
|
|
217
|
+
delete this.dom[CONTROL_ATTRIBUTE];
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// ─── Global Delegated Clear Triggers ───────────────────────
|
|
221
|
+
|
|
222
|
+
function _resolveTargetAndInputFromClearBtn(btn) {
|
|
223
|
+
const explicitId = btn.getAttribute('data-ln-search-clear-for');
|
|
224
|
+
if (explicitId) {
|
|
225
|
+
const target = document.getElementById(explicitId);
|
|
226
|
+
const control = document.querySelector('[' + CONTROL_SELECTOR + '="' + explicitId + '"]');
|
|
227
|
+
const input = control ? _resolveInput(control) : null;
|
|
228
|
+
return { target: target, input: input };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const target = btn.closest('[' + DOM_SELECTOR + ']');
|
|
232
|
+
if (target) {
|
|
233
|
+
const control = target.id ? document.querySelector('[' + CONTROL_SELECTOR + '="' + target.id + '"]') : null;
|
|
234
|
+
const input = control ? _resolveInput(control) : null;
|
|
235
|
+
return { target: target, input: input };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const view = btn.closest('[data-ln-table-source], [data-ln-list-source]');
|
|
239
|
+
if (view) {
|
|
240
|
+
const sourceId = view.getAttribute('data-ln-table-source') || view.getAttribute('data-ln-list-source');
|
|
241
|
+
const sourceTarget = sourceId ? document.getElementById(sourceId) : null;
|
|
242
|
+
if (sourceTarget && sourceTarget.hasAttribute(DOM_SELECTOR)) {
|
|
243
|
+
const control = document.querySelector('[' + CONTROL_SELECTOR + '="' + sourceId + '"]');
|
|
244
|
+
const input = control ? _resolveInput(control) : null;
|
|
245
|
+
return { target: sourceTarget, input: input };
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const controlWrap = btn.closest('[' + CONTROL_SELECTOR + ']');
|
|
250
|
+
if (controlWrap) {
|
|
251
|
+
const targetId = controlWrap.getAttribute(CONTROL_SELECTOR);
|
|
252
|
+
const target = targetId ? document.getElementById(targetId) : null;
|
|
253
|
+
const input = _resolveInput(controlWrap);
|
|
254
|
+
return { target: target, input: input };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const parent = btn.parentElement;
|
|
258
|
+
if (parent) {
|
|
259
|
+
const controlEl = parent.querySelector('[' + CONTROL_SELECTOR + ']');
|
|
260
|
+
if (controlEl) {
|
|
261
|
+
const targetId = controlEl.getAttribute(CONTROL_SELECTOR);
|
|
262
|
+
const target = targetId ? document.getElementById(targetId) : null;
|
|
263
|
+
const input = _resolveInput(controlEl);
|
|
264
|
+
return { target: target, input: input };
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return { target: null, input: null };
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
document.addEventListener('click', function (e) {
|
|
272
|
+
const btn = e.target.closest('[data-ln-search-clear], [data-ln-search-clear-for]');
|
|
273
|
+
if (!btn) return;
|
|
274
|
+
|
|
275
|
+
const res = _resolveTargetAndInputFromClearBtn(btn);
|
|
276
|
+
if (!res.target && !res.input) return;
|
|
277
|
+
|
|
278
|
+
e.preventDefault();
|
|
279
|
+
|
|
280
|
+
if (res.input) {
|
|
281
|
+
res.input.value = '';
|
|
282
|
+
res.input.focus();
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (res.target) {
|
|
286
|
+
res.target.setAttribute(DOM_SELECTOR, '');
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
// ─── Attribute Sync ────────────────────────────────────────
|
|
291
|
+
|
|
292
|
+
function _syncAttribute(el, attrName) {
|
|
293
|
+
const instance = el[DOM_ATTRIBUTE];
|
|
294
|
+
if (!instance || instance._destroyed) return;
|
|
295
|
+
|
|
296
|
+
if (attrName === HASH_ATTR) {
|
|
297
|
+
if (instance._onHashChange) window.removeEventListener('hashchange', instance._onHashChange);
|
|
298
|
+
instance.nsKey = _resolveSearchHashNamespace(el);
|
|
299
|
+
instance.hashEnabled = !!instance.nsKey;
|
|
300
|
+
if (instance.hashEnabled) window.addEventListener('hashchange', instance._onHashChange);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const next = el.getAttribute(DOM_SELECTOR) || '';
|
|
305
|
+
if (next === instance.term) return;
|
|
306
|
+
|
|
307
|
+
instance.term = next;
|
|
308
|
+
_syncControls(el, next);
|
|
309
|
+
instance._apply();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// ─── Registration ──────────────────────────────────────────
|
|
313
|
+
|
|
314
|
+
registerComponent(DOM_SELECTOR, DOM_ATTRIBUTE, _stateComponent, 'ln-search', {
|
|
315
|
+
attributes: ATTRIBUTES,
|
|
316
|
+
onSubtreeChange: function (el, mut) {
|
|
317
|
+
const target = mut.target;
|
|
318
|
+
if (target && target._lnSearchText !== undefined) delete target._lnSearchText;
|
|
319
|
+
if (target && target.parentElement && target.parentElement._lnSearchText !== undefined) {
|
|
320
|
+
delete target.parentElement._lnSearchText;
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
persist: {
|
|
324
|
+
attr: DOM_SELECTOR,
|
|
325
|
+
hashActive: function (el) { return !!_resolveSearchHashNamespace(el); }
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
registerComponent(CONTROL_SELECTOR, CONTROL_ATTRIBUTE, _controlComponent, 'ln-search-control');
|
|
330
|
+
})();
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# ln-slug
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Applied to an `<input name="slug" data-ln-slug-from="sourceName">` within a `<form>`. It queries the source field by `name`
|
|
4
|
+
> and listens for its native `input` events: while the slug input remains pristine, it computes the slugified string and sets
|
|
5
|
+
> `slug.value`, dispatching a synthetic `input` event. If the user types directly into the slug field, it marks it as dirty and halts mirroring until cleared.
|
|
4
6
|
|
|
5
7
|
## Attributes
|
|
6
8
|
|
|
@@ -29,7 +31,8 @@ The component tracks a `_pristine` flag per instance. Mirroring only runs while
|
|
|
29
31
|
|
|
30
32
|
| Situation | Result |
|
|
31
33
|
|-----------|--------|
|
|
32
|
-
| Slug field is empty at init | pristine = `true` (
|
|
34
|
+
| Slug field is empty at init & source has text | pristine = `true` (mirrors source text immediately on init) |
|
|
35
|
+
| Slug field is empty at init & source is empty | pristine = `true` (mirroring active on future typing) |
|
|
33
36
|
| Slug field is non-empty at init (server-rendered) | pristine = `false` (never overwrite) |
|
|
34
37
|
| User types non-empty value into slug field | pristine = `false` (mirroring stops) |
|
|
35
38
|
| User clears slug field | pristine = `true` (mirroring resumes) |
|
|
@@ -70,7 +73,7 @@ The component dispatches a synthetic `new Event('input', { bubbles: true })` on
|
|
|
70
73
|
|
|
71
74
|
## 🔧 Internals
|
|
72
75
|
|
|
73
|
-
Source: `
|
|
76
|
+
Source: `components/ln-slug/ln-slug.js`. Single IIFE, `registerComponent`, per-element instance — same micro-component pattern as `ln-autoresize` (no Proxy/state machine, no templates).
|
|
74
77
|
|
|
75
78
|
### Instance state
|
|
76
79
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use '../../theme/config/mixins' as *;
|
|
2
|
+
|
|
3
|
+
[data-ln-debug] {
|
|
4
|
+
// 1. Host Element Check: data-ln-slug-from belongs only on <input>
|
|
5
|
+
[data-ln-slug-from]:not(input) {
|
|
6
|
+
@include dev-inline-error("data-ln-slug-from belongs only on <input> elements");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// 2. Source Key Check: source field name cannot be empty
|
|
10
|
+
[data-ln-slug-from=""] {
|
|
11
|
+
@include dev-inline-error("data-ln-slug-from source field name cannot be empty");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 3. Form Nesting Check: slug input must be inside a <form>
|
|
15
|
+
[data-ln-slug-from]:not(form [data-ln-slug-from]) {
|
|
16
|
+
@include dev-inline-error("data-ln-slug-from must be nested inside a <form> element");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";function L(){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 p(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 r=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){r=t[o];break}if(!p(r))return}e.apply(console,t)}}function B(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}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()}const x={};function j(e,t){x[e]=t}function W(e){return x[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=j,window.lnCore.getDataMapper=W);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 $={};function H(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function U(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=H,window.lnCore.getLocaleFallback=U,window.lnCore.ensureLocaleObserver=V);const C={};function Q(e,t){C[e]||(C[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=C[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function N(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const u=n[l],s=u.getAttribute("data-ln-field");t[s]!=null&&(u.textContent=t[s])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const u=r[l],s=u.getAttribute("data-ln-attr").split(",");for(let c=0;c<s.length;c++){const d=s[c].trim().split(":");if(d.length!==2)continue;const a=d[0].trim(),f=d[1].trim();t[f]!=null&&u.setAttribute(a,t[f])}}const o=e.querySelectorAll("[data-ln-show]");for(let l=0;l<o.length;l++){const u=o[l],s=u.getAttribute("data-ln-show");s in t&&u.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let l=0;l<i.length;l++){const u=i[l],s=u.getAttribute("data-ln-class").split(",");for(let c=0;c<s.length;c++){const d=s[c].trim().split(":");if(d.length!==2)continue;const a=d[0].trim(),f=d[1].trim();f in t&&u.classList.toggle(a,!!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 r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].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)N(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 T(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(l,u){return t[u]!==void 0?t[u]:""}))}const r=function(i,l){return t[l]!==void 0?t[l]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let i=0;i<o.length;i++){const l=o[i],u=l.attributes;for(let s=0;s<u.length;s++){const c=u[s];c.value.indexOf("{{")!==-1&&l.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function K(e,t,n,r,o,i){const l={};for(let s=0;s<e.children.length;s++){const c=e.children[s],d=c.getAttribute("data-ln-render-key");d&&(l[d]=c)}const u=document.createDocumentFragment();for(let s=0;s<t.length;s++){const c=t[s],d=String(r(c));let a=l[d];if(a)o(a,c,s);else{const f=Q(n,i);if(!f||(T(f,c),a=f.firstElementChild,!a))continue;a.setAttribute("data-ln-render-key",d),o(a,c,s)}u.appendChild(a)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=T,window.lnCore.fill=N,window.lnCore.lnFill=J,window.lnCore.renderList=K);function m(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function P(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function z(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const o=r.trim().toLowerCase();return!(o==="false"||o==="0")}function G(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function X(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const r=new Set(e||[]),o=function(i,l){const u=i.getAttribute(l);return u!==null&&r.has(u)?u:t};return y.set(n,o),o}function Y(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function Z(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function D(e,t,n,r,o){if(!e||t===null)return!0;const i=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const u=s=>{o?console.warn(s,o):console.warn(s)};if(l==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(u(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const s=e.values||[];return s.includes(t)?!0:(u(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return u(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(u(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(u(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(u(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(s){return u(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ee(e,t,n){for(const r in n){const[o,i,l]=n[r];Object.defineProperty(e,r,{get:function(){return o(t,i,l)},enumerable:!0,configurable:!0})}return e}function te(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let o=r.read;if(!o&&r.type)switch(r.type){case"enum":o=X(r.values,r.fallback);break;case"integer":o=P;break;case"float":o=Y;break;case"boolean":o=z;break;case"list":o=G;break;case"json":o=Z;break;case"string":default:o=m;break}o||(o=m),t[r.prop]=[o,n,r.fallback]}return t}function ne(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function re(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,r){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&l.push(e);for(const u of l)if(!u[n]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,t);try{u[n]=new r(u)}catch(s){console.error("["+n+"] init failed",u,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function oe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ie(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 I(){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 le(e){const t=I(),n=e.observed||[];for(let r=0;r<n.length;r++){const o=n[r];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const o=t.byDeclaredAttr.get(r);o.some(i=>i.componentTag===e.componentTag)||o.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=re(e);if(r===null)t.reactiveWildcard.push(e);else for(const o of r)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function R(e,t,n,r){for(let o=0;o<e.length;o++){const i=e[o];if(!t[i.attribute])continue;const l=i.effects&&i.effects[n];l?l(t,n,r):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,r)}}function se(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=I(),o=r.byAttr.get(n);if(L()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&p(t)){const i=r.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let u=0;u<i.length;u++)D(i[u].spec,l,n,i[u].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||o)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=r.byReactive.get(n);i&&R(i,t,n,e.oldValue),r.reactiveWildcard.length&&R(r.reactiveWildcard,t,n,e.oldValue)}if(o)for(let i=0;i<o.length;i++){const l=o[i];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(A(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function ue(){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{se(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function q(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function ce(e){const t=q();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const o=r.query,i=e.target.nodeType===1?e.target.matches(o)?e.target:e.target.closest(o):e.target.parentElement?e.target.parentElement.closest(o):null;i&&r.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let o=0;o<t.length;o++){const i=t[o];A(r,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let o=0;o<t.length;o++){const i=t[o],l=i.query,u=Array.from(r.querySelectorAll(l));r.matches&&r.matches(l)&&u.push(r);for(let s=0;s<u.length;s++){const c=u[s];if(!document.contains(c)){const d=c[i.attribute];if(d&&typeof d.destroy=="function")try{d.destroy()}catch(a){console.error("["+i.attribute+"] destroy failed",c,a)}delete c[i.attribute]}}}}}}function ae(){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 r=t[n];if(r.type==="childList")try{ce(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function de(e,t,n,r,o={}){const i=o.extraAttributes||[],l=o.onAttributeChange||null,u=o.onSubtreeChange||null,s=o.onInit||null,c=o.onAttrChange||null,d=o.effects||null,a=o.attributes||null,f=a?ne(a):d,Ae=a?new Set(Object.keys(a)):null,_e=o.persist||null;function g(S){const w=S||document.body;if(A(w,e,t,n),a&&L())for(const h in a){const Se=a[h],k=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&k.push(w);for(let O=0;O<k.length;O++){const E=k[O];p(E)&&D(Se,E.getAttribute(h),h,r,E)}}s&&s(w)}const v=[];if(e.indexOf("[")!==-1){const S=/\[([\w-]+)/g;let w;for(;(w=S.exec(e))!==null;)v.push(w[1])}else v.push(e);le({selector:e,attribute:t,componentTag:r,attributes:a,ComponentFn:n,onInit:s,observed:v.concat(i),onAttributeChange:l,onAttrChange:c,effects:f,declared:Ae,persist:_e}),ue();const ve=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";q().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:u,query:ve}),ae(),window[t]=g;function M(){oe()>0?ie(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",M):M(),g}function F(e){return(e||"").replace(/^#/,"")}function _(e){const t=e===void 0?location.hash:e,n={},r=F(t);if(!r)return n;const o=r.split("&");for(let i=0;i<o.length;i++){const l=o[i];if(!l)continue;const u=l.indexOf(":"),s=u>-1?l.slice(0,u):l,c=u>-1?l.slice(u+1):"";if(s)try{n[s]=decodeURIComponent(c)}catch{n[s]=c}}return n}function fe(e){if(!e)return null;const t=_();return e in t?t[e]:null}function we(e,t){if(!e)return;const n=_();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(i){const l=n[i];return l===""?i:i+":"+encodeURIComponent(l)}).join("&");F(location.hash)!==o&&(location.hash=o)}function he(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function be(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 r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function ge(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function pe(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 Ce(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function me(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),o=r?r.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=fe,window.lnCore.hashSet=we,window.lnCore.hashLinkClick=he,window.lnCore.resolveHashNamespace=be,window.lnCore.hashSortEncode=ge,window.lnCore.hashSortDecode=pe,window.lnCore.hashFilterEncode=Ce,window.lnCore.hashFilterDecode=me);function ye(e,t="-"){if(e==null)return"";const n=t||"-",r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,n).replace(new RegExp(`${r}+`,"g"),n).replace(new RegExp(`^${r}+|${r}+$`,"g"),"")}(function(){const e="data-ln-slug-from",t="lnSlug";if(window[t]!==void 0)return;const n={"data-ln-slug-from":{prop:"sourceName",type:"string",read:m,fallback:"",description:"Name of the source input field to derive URL slug from"}},r=te(n);function o(i){if(i.tagName!=="INPUT")return console.warn("[ln-slug] Can only be applied to <input>, got:",i.tagName),this;const l=i.form;if(!l)return console.warn("[ln-slug] Slug input is not inside a <form>:",i),this;ee(this,i,r);const u=l.elements[this.sourceName];if(!u)return console.warn('[ln-slug] Source field "'+this.sourceName+'" not found in form:',i),this;if(typeof u.addEventListener!="function")return console.warn('[ln-slug] Source field "'+this.sourceName+'" is a RadioNodeList (same-name group) — single source field required:',i),this;this.dom=i,this.source=u,this._pristine=i.value==="",this._mirroring=!1;const s=this;return this._onSource=function(){s._pristine&&s._mirror()},this._onSlug=function(){s._mirroring||(s._pristine=s.dom.value==="")},u.addEventListener("input",this._onSource),i.addEventListener("input",this._onSlug),this._pristine&&u.value&&u.value.trim()!==""&&this._mirror(),this}o.prototype._mirror=function(){this._mirroring=!0,this.dom.value=ye(this.source.value),this.dom.dispatchEvent(new Event("input",{bubbles:!0})),this._mirroring=!1},o.prototype.destroy=function(){this.dom[t]&&(this.source.removeEventListener("input",this._onSource),this.dom.removeEventListener("input",this._onSlug),delete this.dom[t])},de(e,t,o,"ln-slug",{attributes:n})})()})();
|
|
@@ -0,0 +1,23 @@
|
|
|
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-slug",
|
|
4
|
+
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"data-ln-debug": {
|
|
7
|
+
"direction": null,
|
|
8
|
+
"sources": [
|
|
9
|
+
"ln-slug-dev.scss"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"data-ln-slug-from": {
|
|
13
|
+
"direction": null,
|
|
14
|
+
"sources": [
|
|
15
|
+
"ln-slug-dev.scss",
|
|
16
|
+
"src/ln-slug.js"
|
|
17
|
+
],
|
|
18
|
+
"type": "string",
|
|
19
|
+
"fallback": "",
|
|
20
|
+
"description": "Name of the source input field to derive URL slug from"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { registerComponent } from '../../ln-core';
|
|
1
|
+
import { registerComponent, defineAttrs, attrSpec, attrStr } from '../../ln-core';
|
|
2
|
+
import { generateSlug } from './slug-model.js';
|
|
2
3
|
|
|
3
4
|
(function () {
|
|
4
5
|
const DOM_SELECTOR = 'data-ln-slug-from';
|
|
@@ -6,12 +7,11 @@ import { registerComponent } from '../../ln-core';
|
|
|
6
7
|
|
|
7
8
|
if (window[DOM_ATTRIBUTE] !== undefined) return;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
10
|
+
// ─── Attribute Contract (SSOT) ──────────────────────────
|
|
11
|
+
const ATTRIBUTES = {
|
|
12
|
+
'data-ln-slug-from': { prop: 'sourceName', type: 'string', read: attrStr, fallback: '', description: 'Name of the source input field to derive URL slug from' }
|
|
13
|
+
};
|
|
14
|
+
const ATTR_SPEC = attrSpec(ATTRIBUTES);
|
|
15
15
|
|
|
16
16
|
function _component(dom) {
|
|
17
17
|
if (dom.tagName !== 'INPUT') {
|
|
@@ -23,14 +23,14 @@ import { registerComponent } from '../../ln-core';
|
|
|
23
23
|
console.warn('[ln-slug] Slug input is not inside a <form>:', dom);
|
|
24
24
|
return this;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
const source = form.elements[sourceName];
|
|
26
|
+
defineAttrs(this, dom, ATTR_SPEC);
|
|
27
|
+
const source = form.elements[this.sourceName];
|
|
28
28
|
if (!source) {
|
|
29
|
-
console.warn('[ln-slug] Source field "' + sourceName + '" not found in form:', dom);
|
|
29
|
+
console.warn('[ln-slug] Source field "' + this.sourceName + '" not found in form:', dom);
|
|
30
30
|
return this;
|
|
31
31
|
}
|
|
32
32
|
if (typeof source.addEventListener !== 'function') {
|
|
33
|
-
console.warn('[ln-slug] Source field "' + sourceName + '" is a RadioNodeList (same-name group) — single source field required:', dom);
|
|
33
|
+
console.warn('[ln-slug] Source field "' + this.sourceName + '" is a RadioNodeList (same-name group) — single source field required:', dom);
|
|
34
34
|
return this;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -53,12 +53,17 @@ import { registerComponent } from '../../ln-core';
|
|
|
53
53
|
source.addEventListener('input', this._onSource);
|
|
54
54
|
dom.addEventListener('input', this._onSlug);
|
|
55
55
|
|
|
56
|
+
// Initial check — if source field already has text and slug is pristine, mirror immediately
|
|
57
|
+
if (this._pristine && source.value && source.value.trim() !== '') {
|
|
58
|
+
this._mirror();
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
return this;
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
_component.prototype._mirror = function () {
|
|
60
65
|
this._mirroring = true;
|
|
61
|
-
this.dom.value =
|
|
66
|
+
this.dom.value = generateSlug(this.source.value);
|
|
62
67
|
this.dom.dispatchEvent(new Event('input', { bubbles: true }));
|
|
63
68
|
this._mirroring = false;
|
|
64
69
|
};
|
|
@@ -70,5 +75,7 @@ import { registerComponent } from '../../ln-core';
|
|
|
70
75
|
delete this.dom[DOM_ATTRIBUTE];
|
|
71
76
|
};
|
|
72
77
|
|
|
73
|
-
registerComponent(DOM_SELECTOR, DOM_ATTRIBUTE, _component, 'ln-slug'
|
|
78
|
+
registerComponent(DOM_SELECTOR, DOM_ATTRIBUTE, _component, 'ln-slug', {
|
|
79
|
+
attributes: ATTRIBUTES
|
|
80
|
+
});
|
|
74
81
|
})();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a clean, URL-safe slug from arbitrary input text.
|
|
3
|
+
* Performs diacritic stripping, non-alphanumeric replacement, and separator collapsing.
|
|
4
|
+
* @param {unknown} value
|
|
5
|
+
* @param {string} [separator='-']
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export function generateSlug(value, separator = '-') {
|
|
9
|
+
if (value === null || value === undefined) return '';
|
|
10
|
+
|
|
11
|
+
const sep = separator || '-';
|
|
12
|
+
const escapedSep = sep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
13
|
+
|
|
14
|
+
return String(value)
|
|
15
|
+
.normalize('NFD') // Normalize accented characters (e.g. é -> e + ´)
|
|
16
|
+
.replace(/[\u0300-\u036f]/g, '') // Remove diacritics
|
|
17
|
+
.toLowerCase()
|
|
18
|
+
.replace(/[^a-z0-9]+/g, sep) // Replace non-alphanumeric with separator
|
|
19
|
+
.replace(new RegExp(`${escapedSep}+`, 'g'), sep) // Collapse multiple separators
|
|
20
|
+
.replace(new RegExp(`^${escapedSep}+|${escapedSep}+$`, 'g'), ''); // Trim leading/trailing separators
|
|
21
|
+
}
|