@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,400 @@
|
|
|
1
|
+
import { cleanNumericString, dispatch, ensureLocaleObserver, formatNumber, getLocale, getSeparators, interceptValueProperty, parseNumber, registerComponent } from '../../ln-core';
|
|
2
|
+
import { calculateCursorPosition } from './number-model.js';
|
|
3
|
+
|
|
4
|
+
(function () {
|
|
5
|
+
const DOM_SELECTOR = 'data-ln-number';
|
|
6
|
+
const DOM_ATTRIBUTE = 'lnNumber';
|
|
7
|
+
|
|
8
|
+
if (window[DOM_ATTRIBUTE] !== undefined) return;
|
|
9
|
+
|
|
10
|
+
function _syncAttribute(el) {
|
|
11
|
+
const inst = el[DOM_ATTRIBUTE];
|
|
12
|
+
if (!inst) return;
|
|
13
|
+
if (inst.isTextElement) {
|
|
14
|
+
inst._initTextElement();
|
|
15
|
+
} else if (!isNaN(inst.value)) {
|
|
16
|
+
inst._displayFormatted(inst.value);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ─── Attribute Contract (SSOT) ──────────────────────────
|
|
21
|
+
const ATTRIBUTES = {
|
|
22
|
+
'data-ln-number': { type: 'marker', effect: _syncAttribute, description: 'Activates localized number formatting on input or text element' },
|
|
23
|
+
'data-ln-value': { type: 'float', effect: _syncAttribute, description: 'Raw unformatted numeric value' },
|
|
24
|
+
'data-ln-number-decimals': { type: 'integer', fallback: 0, min: 0, max: 20, effect: _syncAttribute, description: 'Number of decimal fraction digits' },
|
|
25
|
+
'data-ln-number-min': { type: 'float', effect: _syncAttribute, description: 'Minimum allowed numeric value' },
|
|
26
|
+
'data-ln-number-max': { type: 'float', effect: _syncAttribute, description: 'Maximum allowed numeric value' }
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const _inputValueDesc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
|
30
|
+
|
|
31
|
+
// ─── Component ─────────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
function _component(dom) {
|
|
34
|
+
if (dom[DOM_ATTRIBUTE]) return dom[DOM_ATTRIBUTE];
|
|
35
|
+
dom[DOM_ATTRIBUTE] = this;
|
|
36
|
+
this.dom = dom;
|
|
37
|
+
const self = this;
|
|
38
|
+
|
|
39
|
+
// ── Subscribe to global locale changes ──────────────
|
|
40
|
+
this._onLocaleChange = function () {
|
|
41
|
+
if (self.isTextElement) {
|
|
42
|
+
self._formatTextContent();
|
|
43
|
+
} else if (!isNaN(self.value)) {
|
|
44
|
+
self._displayFormatted(self.value);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
ensureLocaleObserver();
|
|
48
|
+
document.addEventListener('ln-core:locale-change', this._onLocaleChange);
|
|
49
|
+
|
|
50
|
+
if (dom.tagName !== 'INPUT') {
|
|
51
|
+
this.isTextElement = true;
|
|
52
|
+
this._initTextElement();
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ── Create hidden input ─────────────────────────────
|
|
57
|
+
const hidden = document.createElement('input');
|
|
58
|
+
hidden.type = 'hidden';
|
|
59
|
+
hidden.name = dom.name;
|
|
60
|
+
dom.removeAttribute('name');
|
|
61
|
+
if (dom.hasAttribute('data-ln-fill-as')) {
|
|
62
|
+
hidden.setAttribute('data-ln-fill-as', dom.getAttribute('data-ln-fill-as'));
|
|
63
|
+
}
|
|
64
|
+
dom.type = 'text';
|
|
65
|
+
dom.setAttribute('inputmode', 'decimal');
|
|
66
|
+
dom.insertAdjacentElement('afterend', hidden);
|
|
67
|
+
this._hidden = hidden;
|
|
68
|
+
|
|
69
|
+
// ── Intercept programmatic value sets on hidden input ──
|
|
70
|
+
Object.defineProperty(hidden, 'value', {
|
|
71
|
+
get: function () {
|
|
72
|
+
return _inputValueDesc.get.call(hidden);
|
|
73
|
+
},
|
|
74
|
+
set: function (val) {
|
|
75
|
+
_inputValueDesc.set.call(hidden, val);
|
|
76
|
+
if (val !== '' && !isNaN(parseFloat(val))) {
|
|
77
|
+
const maxDecimals = self.dom.getAttribute('data-ln-number-decimals');
|
|
78
|
+
self._setDisplayRaw(formatNumber(parseFloat(val), getLocale(self.dom), { maxDecimals }));
|
|
79
|
+
} else {
|
|
80
|
+
self._setDisplayRaw('');
|
|
81
|
+
}
|
|
82
|
+
self.dom.dispatchEvent(new Event('input', { bubbles: true }));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// ── Intercept programmatic value sets on visible input (2-way binding) ──
|
|
87
|
+
interceptValueProperty(dom, _inputValueDesc, {
|
|
88
|
+
get: function () {
|
|
89
|
+
return _inputValueDesc.get.call(dom);
|
|
90
|
+
},
|
|
91
|
+
set: function (val) {
|
|
92
|
+
if (val === '') {
|
|
93
|
+
self._setDisplayRaw('');
|
|
94
|
+
self._setHiddenRaw('');
|
|
95
|
+
dom.dispatchEvent(new Event('input', { bubbles: true }));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const num = typeof val === 'number' ? val : parseFloat(String(val));
|
|
99
|
+
if (isNaN(num)) {
|
|
100
|
+
self._setDisplayRaw(String(val));
|
|
101
|
+
self._setHiddenRaw('');
|
|
102
|
+
} else {
|
|
103
|
+
self._setHiddenRaw(num);
|
|
104
|
+
const maxDecimals = dom.getAttribute('data-ln-number-decimals');
|
|
105
|
+
self._setDisplayRaw(formatNumber(num, getLocale(dom), { maxDecimals }));
|
|
106
|
+
}
|
|
107
|
+
dom.dispatchEvent(new Event('input', { bubbles: true }));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// ── Bind input event ────────────────────────────────
|
|
112
|
+
this._onInput = function () {
|
|
113
|
+
self._handleInput();
|
|
114
|
+
};
|
|
115
|
+
dom.addEventListener('input', this._onInput);
|
|
116
|
+
|
|
117
|
+
// ── Bind keydown event (Backspace over group separators) ──
|
|
118
|
+
this._onKeyDown = function (e) {
|
|
119
|
+
if (e.key !== 'Backspace') return;
|
|
120
|
+
const start = dom.selectionStart;
|
|
121
|
+
const end = dom.selectionEnd;
|
|
122
|
+
|
|
123
|
+
if (start !== end || start === 0) return;
|
|
124
|
+
|
|
125
|
+
const info = getSeparators(getLocale(dom));
|
|
126
|
+
const val = _inputValueDesc.get.call(dom);
|
|
127
|
+
const charBefore = val[start - 1];
|
|
128
|
+
|
|
129
|
+
if (charBefore === info.groupSep || /\s/.test(charBefore)) {
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
const deleteIdx = start - 2 >= 0 ? start - 2 : 0;
|
|
132
|
+
const newVal = val.slice(0, deleteIdx) + val.slice(start);
|
|
133
|
+
_inputValueDesc.set.call(dom, newVal);
|
|
134
|
+
dom.setSelectionRange(deleteIdx, deleteIdx);
|
|
135
|
+
dom.dispatchEvent(new Event('input', { bubbles: true }));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
dom.addEventListener('keydown', this._onKeyDown);
|
|
139
|
+
|
|
140
|
+
// ── Bind paste event ────────────────────────────────
|
|
141
|
+
this._onPaste = function (e) {
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
const pasted = (e.clipboardData || window.clipboardData).getData('text');
|
|
144
|
+
const num = parseNumber(pasted, getLocale(dom));
|
|
145
|
+
self.value = isNaN(num) ? NaN : num;
|
|
146
|
+
};
|
|
147
|
+
dom.addEventListener('paste', this._onPaste);
|
|
148
|
+
|
|
149
|
+
// ── Handle pre-filled value ─────────────────────────
|
|
150
|
+
const initial = dom.value;
|
|
151
|
+
if (initial !== '') {
|
|
152
|
+
const num = parseFloat(initial);
|
|
153
|
+
if (!isNaN(num)) {
|
|
154
|
+
const maxDecimals = dom.getAttribute('data-ln-number-decimals');
|
|
155
|
+
this._setHiddenRaw(num);
|
|
156
|
+
this._setDisplayRaw(formatNumber(num, getLocale(dom), { maxDecimals }));
|
|
157
|
+
dom.dispatchEvent(new Event('input', { bubbles: true }));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
_component.prototype._initTextElement = function () {
|
|
165
|
+
const dom = this.dom;
|
|
166
|
+
let valAttr = dom.getAttribute('data-ln-value');
|
|
167
|
+
let numAttr = dom.getAttribute('data-ln-number');
|
|
168
|
+
|
|
169
|
+
let candidate = null;
|
|
170
|
+
if (valAttr !== null && valAttr !== '') {
|
|
171
|
+
candidate = valAttr;
|
|
172
|
+
} else if (numAttr !== null && numAttr !== '' && numAttr !== 'true') {
|
|
173
|
+
candidate = numAttr;
|
|
174
|
+
} else {
|
|
175
|
+
candidate = dom.textContent.trim();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const num = parseFloat(candidate);
|
|
179
|
+
if (!isNaN(num)) {
|
|
180
|
+
this._rawValue = num;
|
|
181
|
+
if (!dom.hasAttribute('data-ln-value')) {
|
|
182
|
+
dom.setAttribute('data-ln-value', String(num));
|
|
183
|
+
}
|
|
184
|
+
this._formatTextContent();
|
|
185
|
+
} else {
|
|
186
|
+
this._rawValue = null;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
_component.prototype._formatTextContent = function () {
|
|
191
|
+
if (this._rawValue !== null && !isNaN(this._rawValue)) {
|
|
192
|
+
const maxDecimals = this.dom.getAttribute('data-ln-number-decimals');
|
|
193
|
+
this.dom.textContent = formatNumber(this._rawValue, getLocale(this.dom), { maxDecimals });
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
_component.prototype._handleInput = function () {
|
|
198
|
+
const dom = this.dom;
|
|
199
|
+
const raw = _inputValueDesc.get.call(dom);
|
|
200
|
+
|
|
201
|
+
// Branch 1: empty
|
|
202
|
+
if (raw === '') {
|
|
203
|
+
this._setHiddenRaw('');
|
|
204
|
+
dispatch(dom, 'ln-number:input', { value: NaN, formatted: '' });
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Branch 2: just minus sign
|
|
209
|
+
if (raw === '-') {
|
|
210
|
+
this._setHiddenRaw('');
|
|
211
|
+
dispatch(dom, 'ln-number:input', { value: NaN, formatted: '-' });
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Save cursor context: count digits to the left of cursor
|
|
216
|
+
const cursorPos = dom.selectionStart;
|
|
217
|
+
let digitsBeforeCursor = 0;
|
|
218
|
+
for (let i = 0; i < cursorPos; i++) {
|
|
219
|
+
if (/[0-9]/.test(raw[i])) digitsBeforeCursor++;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const locale = getLocale(dom);
|
|
223
|
+
const info = getSeparators(locale);
|
|
224
|
+
let workingStr = raw;
|
|
225
|
+
let cleaned = cleanNumericString(raw, info.groupSep, info.decimalSep);
|
|
226
|
+
let num = parseFloat(cleaned);
|
|
227
|
+
|
|
228
|
+
if (isNaN(num)) {
|
|
229
|
+
this._setHiddenRaw('');
|
|
230
|
+
dispatch(dom, 'ln-number:input', { value: NaN, formatted: raw });
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Transformation (Non-Terminal): Apply data-ln-number-decimals truncation
|
|
235
|
+
const maxDecimalsAttr = dom.getAttribute('data-ln-number-decimals');
|
|
236
|
+
const decimalIndex = cleaned.indexOf('.');
|
|
237
|
+
if (maxDecimalsAttr !== null && decimalIndex !== -1) {
|
|
238
|
+
const allowed = parseInt(maxDecimalsAttr, 10);
|
|
239
|
+
const afterDec = cleaned.slice(decimalIndex + 1);
|
|
240
|
+
if (allowed === 0) {
|
|
241
|
+
cleaned = cleaned.slice(0, decimalIndex);
|
|
242
|
+
workingStr = workingStr.split(info.decimalSep)[0];
|
|
243
|
+
num = parseFloat(cleaned);
|
|
244
|
+
this._setDisplayRaw(workingStr);
|
|
245
|
+
} else if (afterDec.length > allowed) {
|
|
246
|
+
cleaned = cleaned.slice(0, decimalIndex + 1 + allowed);
|
|
247
|
+
const parts = workingStr.split(info.decimalSep);
|
|
248
|
+
workingStr = parts[0] + info.decimalSep + parts[1].slice(0, allowed);
|
|
249
|
+
num = parseFloat(cleaned);
|
|
250
|
+
this._setDisplayRaw(workingStr);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Max Clamping: Evaluated BEFORE trailing separator / zero branches
|
|
255
|
+
const maxAttr = dom.getAttribute('data-ln-number-max');
|
|
256
|
+
if (maxAttr !== null && num > parseFloat(maxAttr)) {
|
|
257
|
+
const maxVal = parseFloat(maxAttr);
|
|
258
|
+
const formatted = formatNumber(maxVal, locale, { maxDecimals: maxDecimalsAttr });
|
|
259
|
+
this._setDisplayRaw(formatted);
|
|
260
|
+
this._setHiddenRaw(maxVal);
|
|
261
|
+
dom.setSelectionRange(formatted.length, formatted.length);
|
|
262
|
+
dispatch(dom, 'ln-number:input', { value: maxVal, formatted: formatted });
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Trailing Decimal Separator (user is about to type decimals)
|
|
267
|
+
if (workingStr.endsWith(info.decimalSep) || (info.decimalSep !== '.' && workingStr.endsWith('.'))) {
|
|
268
|
+
this._setHiddenRaw(num);
|
|
269
|
+
dispatch(dom, 'ln-number:input', { value: num, formatted: workingStr });
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Trailing Zeros after Decimal (user is still typing fractional part)
|
|
274
|
+
const curDecIdx = cleaned.indexOf('.');
|
|
275
|
+
if (curDecIdx !== -1) {
|
|
276
|
+
const afterDec = cleaned.slice(curDecIdx + 1);
|
|
277
|
+
if (afterDec.endsWith('0')) {
|
|
278
|
+
this._setHiddenRaw(num);
|
|
279
|
+
dispatch(dom, 'ln-number:input', { value: num, formatted: workingStr });
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Standard Formatting
|
|
285
|
+
let formatted;
|
|
286
|
+
if (maxDecimalsAttr !== null) {
|
|
287
|
+
formatted = formatNumber(num, locale, { maxDecimals: maxDecimalsAttr });
|
|
288
|
+
} else {
|
|
289
|
+
const userDecimals = curDecIdx !== -1 ? cleaned.slice(curDecIdx + 1).length : 0;
|
|
290
|
+
formatted = formatNumber(num, locale, { userDecimals });
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this._setDisplayRaw(formatted);
|
|
294
|
+
|
|
295
|
+
// Restore cursor position
|
|
296
|
+
const newPos = calculateCursorPosition(formatted, digitsBeforeCursor);
|
|
297
|
+
dom.setSelectionRange(newPos, newPos);
|
|
298
|
+
|
|
299
|
+
// Update hidden input
|
|
300
|
+
this._setHiddenRaw(num);
|
|
301
|
+
|
|
302
|
+
dispatch(dom, 'ln-number:input', { value: num, formatted: formatted });
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
_component.prototype._setHiddenRaw = function (val) {
|
|
306
|
+
if (this._hidden) {
|
|
307
|
+
_inputValueDesc.set.call(this._hidden, String(val));
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
_component.prototype._setDisplayRaw = function (str) {
|
|
312
|
+
if (this.isTextElement) {
|
|
313
|
+
this.dom.textContent = String(str);
|
|
314
|
+
} else {
|
|
315
|
+
_inputValueDesc.set.call(this.dom, String(str));
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
_component.prototype._displayFormatted = function (num) {
|
|
320
|
+
if (this.isTextElement) {
|
|
321
|
+
this._formatTextContent();
|
|
322
|
+
} else {
|
|
323
|
+
const maxDecimals = this.dom.getAttribute('data-ln-number-decimals');
|
|
324
|
+
this._setDisplayRaw(formatNumber(num, getLocale(this.dom), { maxDecimals }));
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// ─── Public API ───────────────────────────────────────────
|
|
329
|
+
|
|
330
|
+
Object.defineProperty(_component.prototype, 'value', {
|
|
331
|
+
get: function () {
|
|
332
|
+
if (this.isTextElement) {
|
|
333
|
+
return this._rawValue;
|
|
334
|
+
}
|
|
335
|
+
const raw = _inputValueDesc.get.call(this._hidden);
|
|
336
|
+
return raw === '' ? NaN : parseFloat(raw);
|
|
337
|
+
},
|
|
338
|
+
set: function (val) {
|
|
339
|
+
const num = typeof val === 'number' ? val : parseFloat(val);
|
|
340
|
+
if (this.isTextElement) {
|
|
341
|
+
if (isNaN(num)) {
|
|
342
|
+
this._rawValue = null;
|
|
343
|
+
this.dom.textContent = '';
|
|
344
|
+
} else {
|
|
345
|
+
this._rawValue = num;
|
|
346
|
+
this.dom.setAttribute('data-ln-value', String(num));
|
|
347
|
+
this._formatTextContent();
|
|
348
|
+
}
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (isNaN(num)) {
|
|
353
|
+
this._setDisplayRaw('');
|
|
354
|
+
this._setHiddenRaw('');
|
|
355
|
+
this.dom.dispatchEvent(new Event('input', { bubbles: true }));
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this._setHiddenRaw(num);
|
|
359
|
+
const maxDecimals = this.dom.getAttribute('data-ln-number-decimals');
|
|
360
|
+
this._setDisplayRaw(formatNumber(num, getLocale(this.dom), { maxDecimals }));
|
|
361
|
+
this.dom.dispatchEvent(new Event('input', { bubbles: true }));
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
Object.defineProperty(_component.prototype, 'formatted', {
|
|
366
|
+
get: function () {
|
|
367
|
+
if (this.isTextElement) {
|
|
368
|
+
return this.dom.textContent;
|
|
369
|
+
}
|
|
370
|
+
return _inputValueDesc.get.call(this.dom);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
_component.prototype.destroy = function () {
|
|
375
|
+
if (!this.dom[DOM_ATTRIBUTE]) return;
|
|
376
|
+
if (this._onLocaleChange) {
|
|
377
|
+
document.removeEventListener('ln-core:locale-change', this._onLocaleChange);
|
|
378
|
+
}
|
|
379
|
+
if (!this.isTextElement) {
|
|
380
|
+
this.dom.removeEventListener('input', this._onInput);
|
|
381
|
+
this.dom.removeEventListener('keydown', this._onKeyDown);
|
|
382
|
+
this.dom.removeEventListener('paste', this._onPaste);
|
|
383
|
+
if (this._hidden) {
|
|
384
|
+
this.dom.name = this._hidden.name;
|
|
385
|
+
this._hidden.remove();
|
|
386
|
+
}
|
|
387
|
+
this.dom.type = 'number';
|
|
388
|
+
this.dom.removeAttribute('inputmode');
|
|
389
|
+
}
|
|
390
|
+
delete this.dom[DOM_ATTRIBUTE];
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
// ─── Init ──────────────────────────────────────────────────
|
|
394
|
+
|
|
395
|
+
registerComponent(DOM_SELECTOR, DOM_ATTRIBUTE, _component, 'ln-number', {
|
|
396
|
+
attributes: ATTRIBUTES,
|
|
397
|
+
extraAttributes: ['lang'],
|
|
398
|
+
onAttributeChange: _syncAttribute
|
|
399
|
+
});
|
|
400
|
+
})();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-map the cursor position in the formatted string based on digits
|
|
3
|
+
* that were present before the cursor prior to formatting.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} formattedStr Formatted string to place cursor into
|
|
6
|
+
* @param {number} digitsBeforeCursor Count of digits preceding the cursor in the unformatted input
|
|
7
|
+
* @returns {number} Index in formattedStr where cursor should be positioned
|
|
8
|
+
*/
|
|
9
|
+
export function calculateCursorPosition(formattedStr, digitsBeforeCursor) {
|
|
10
|
+
if (!formattedStr) return 0;
|
|
11
|
+
if (digitsBeforeCursor <= 0) {
|
|
12
|
+
// If input starts with a negative sign or empty, position at first position
|
|
13
|
+
return formattedStr.startsWith('-') ? 1 : 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let targetDigits = digitsBeforeCursor;
|
|
17
|
+
let newPos = 0;
|
|
18
|
+
|
|
19
|
+
for (let i = 0; i < formattedStr.length && targetDigits > 0; i++) {
|
|
20
|
+
newPos = i + 1;
|
|
21
|
+
if (/[0-9]/.test(formattedStr[i])) {
|
|
22
|
+
targetDigits--;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (targetDigits > 0) {
|
|
27
|
+
newPos = formattedStr.length;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return newPos;
|
|
31
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# ln-obfuscator
|
|
2
|
+
|
|
3
|
+
> Binds to any DOM element carrying `data-ln-obfuscator` (`<span>`, `<p>`, `<a>`, headings, table cells) and automatically deobfuscates its text nodes and `href` attributes at runtime.
|
|
4
|
+
> Operates with zero configuration using ROT13 as default, and supports universal Base64 and XOR ciphers via optional attributes for international scripts (Cyrillic, CJK, etc.) while maintaining an internal idempotency guard without DOM pollution.
|
|
5
|
+
|
|
6
|
+
## Markup anatomy
|
|
7
|
+
|
|
8
|
+
### 1. Default ROT Caesar (Letters & Digits)
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<!-- Authored HTML (Obfuscated) -->
|
|
12
|
+
<span data-ln-obfuscator>Uryyb Jbeyq!</span>
|
|
13
|
+
<a data-ln-obfuscator href="znvygb:pbagnpg@rknzcyr.pbz">pbagnpg@rknzcyr.pbz</a>
|
|
14
|
+
<a data-ln-obfuscator="5" href="yjc:+834-25-678-901">+834-25-678-901</a>
|
|
15
|
+
|
|
16
|
+
<!-- Runtime result (Deobfuscated) -->
|
|
17
|
+
<span data-ln-obfuscator>Hello World!</span>
|
|
18
|
+
<a data-ln-obfuscator href="mailto:contact@example.com">contact@example.com</a>
|
|
19
|
+
<a data-ln-obfuscator="5" href="tel:+389-70-123-456">+389-70-123-456</a>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 2. Universal Base64 & XOR (Unicode & International Scripts)
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<!-- Base64 Codec (Unicode / UTF-8 safe) -->
|
|
26
|
+
<span data-ln-obfuscator data-ln-obfuscator-codec="base64">VW5pY29kZSBOb3RlOiBjb250YWN0QGV4YW1wbGUuY29tIChUZWw6ICsxLTgwMC01NTUtMDE5OSk=</span>
|
|
27
|
+
<!-- Runtime: "Unicode Note: contact@example.com (Tel: +1-800-555-0199)" -->
|
|
28
|
+
|
|
29
|
+
<!-- XOR Codec with Custom Key -->
|
|
30
|
+
<span data-ln-obfuscator data-ln-obfuscator-codec="xor" data-ln-obfuscator-key="secret-key">MAoNFAwQSAUREBIJWVIGG0MfBBoHJQYKBBldBwBXEAoOUk0gSAdfWVhUTkpVRABeUExeVVJLXF0=</span>
|
|
31
|
+
<!-- Runtime: "Confidential: contact@example.com (Tel: +1-800-555-0199)" -->
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Attribute contract
|
|
35
|
+
|
|
36
|
+
| Attribute | Role | Default | Description |
|
|
37
|
+
|---|---|---|---|
|
|
38
|
+
| `data-ln-obfuscator` | Selector & Shift | `13` | Triggers deobfuscation. Optional integer sets ROT shift offset. Default is ROT13. |
|
|
39
|
+
| `data-ln-obfuscator-codec` | Codec mode | `rot` | Encryption/encoding mode: `'rot'` (default), `'base64'`, or `'xor'`. |
|
|
40
|
+
| `data-ln-obfuscator-key` | XOR key | `'ln-ashlar'` | Secret key for `'xor'` codec. Automatically activates XOR codec when provided. |
|
|
41
|
+
|
|
42
|
+
## Events API
|
|
43
|
+
|
|
44
|
+
- `ln-obfuscator:deobfuscated`: Dispatched on the target element with `{ target, codec, shift, key }` upon deobfuscation.
|
|
45
|
+
|
|
46
|
+
## JavaScript API
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
// Scan DOM for uninitialized obfuscated elements
|
|
50
|
+
window.lnObfuscator(document.body);
|
|
51
|
+
|
|
52
|
+
// Pure cipher utilities
|
|
53
|
+
const rot = window.lnObfuscator.obfuscate('contact@example.com', 13);
|
|
54
|
+
const b64 = window.lnObfuscator.obfuscate('Contact: info@example.com', { codec: 'base64' });
|
|
55
|
+
const xor = window.lnObfuscator.obfuscate('Confidential: info@example.com', { codec: 'xor', key: 'secret-key' });
|
|
56
|
+
|
|
57
|
+
window.lnObfuscator.deobfuscate(rot, 13);
|
|
58
|
+
window.lnObfuscator.deobfuscate(b64, { codec: 'base64' });
|
|
59
|
+
window.lnObfuscator.deobfuscate(xor, { codec: 'xor', key: 'secret-key' });
|
|
60
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";function B(){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 _(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 i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){r=t[i];break}if(!_(r))return}e.apply(console,t)}}function L(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 m(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){m(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}const D={};function z(e,t){D[e]=t}function G(e){return D[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=z,window.lnCore.getDataMapper=G);function Z(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,m(function(){new MutationObserver(function(){L(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function Y(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function ee(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Y,window.lnCore.getLocaleFallback=ee,window.lnCore.ensureLocaleObserver=Z);const k={};function te(e,t){k[e]||(k[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=k[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function I(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let o=0;o<n.length;o++){const f=n[o],s=f.getAttribute("data-ln-field");t[s]!=null&&(f.textContent=t[s])}const r=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<r.length;o++){const f=r[o],s=f.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 u=d[0].trim(),h=d[1].trim();t[h]!=null&&f.setAttribute(u,t[h])}}const i=e.querySelectorAll("[data-ln-show]");for(let o=0;o<i.length;o++){const f=i[o],s=f.getAttribute("data-ln-show");s in t&&f.classList.toggle("hidden",!t[s])}const l=e.querySelectorAll("[data-ln-class]");for(let o=0;o<l.length;o++){const f=l[o],s=f.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 u=d[0].trim(),h=d[1].trim();h in t&&f.classList.toggle(u,!!t[h])}}return e}function ne(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)I(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function R(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const l=n.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,f){return t[f]!==void 0?t[f]:""}))}const r=function(l,o){return t[o]!==void 0?t[o]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let l=0;l<i.length;l++){const o=i[l],f=o.attributes;for(let s=0;s<f.length;s++){const c=f[s];c.value.indexOf("{{")!==-1&&o.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function re(e,t,n,r,i,l){const o={};for(let s=0;s<e.children.length;s++){const c=e.children[s],d=c.getAttribute("data-ln-render-key");d&&(o[d]=c)}const f=document.createDocumentFragment();for(let s=0;s<t.length;s++){const c=t[s],d=String(r(c));let u=o[d];if(u)i(u,c,s);else{const h=te(n,l);if(!h||(R(h,c),u=h.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),i(u,c,s)}f.appendChild(u)}e.textContent="",e.appendChild(f)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=R,window.lnCore.fill=I,window.lnCore.lnFill=ne,window.lnCore.renderList=re);function F(e,t,n,r,i){if(!e||t===null)return!0;const l=r||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const f=s=>{i?console.warn(s,i):console.warn(s)};if(o==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(f(`[${l}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const s=e.values||[];return s.includes(t)?!0:(f(`[${l}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return f(`[${l}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(f(`[${l}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(f(`[${l}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(f(`[${l}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(s){return f(`[${l}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function oe(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 ie(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}function S(e,t,n,r){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o=Array.from(e.querySelectorAll(l));e.matches&&e.matches(l)&&o.push(e);for(const f of o)if(!f[n]){window.lnCore._persistSink&&f.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(f,t);try{f[n]=new r(f)}catch(s){console.error("["+n+"] init failed",f,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function le(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function se(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function q(){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 fe(e){const t=q(),n=e.observed||[];for(let r=0;r<n.length;r++){const i=n[r];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).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 i=t.byDeclaredAttr.get(r);i.some(l=>l.componentTag===e.componentTag)||i.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=ie(e);if(r===null)t.reactiveWildcard.push(e);else for(const i of r)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function H(e,t,n,r){for(let i=0;i<e.length;i++){const l=e[i];if(!t[l.attribute])continue;const o=l.effects&&l.effects[n];o?o(t,n,r):l.onAttrChange&&(!l.declared||l.declared.has(n))&&l.onAttrChange(t,n,r)}}function ce(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=q(),i=r.byAttr.get(n);if(B()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&_(t)){const l=r.byDeclaredAttr.get(n),o=t.getAttribute(n);for(let f=0;f<l.length;f++)F(l[f].spec,o,n,l[f].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||i)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const l=r.byReactive.get(n);l&&H(l,t,n,e.oldValue),r.reactiveWildcard.length&&H(r.reactiveWildcard,t,n,e.oldValue)}if(i)for(let l=0;l<i.length;l++){const o=i[l];if(o.handler){o.handler(t,n,e.oldValue);continue}o.onAttributeChange&&t[o.attribute]?o.onAttributeChange(t,n):(S(t,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(t))}}function ue(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,m(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ce(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 M(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function de(e){const t=M();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const i=r.query,l=e.target.nodeType===1?e.target.matches(i)?e.target:e.target.closest(i):e.target.parentElement?e.target.parentElement.closest(i):null;l&&r.onSubtreeChange(l,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let i=0;i<t.length;i++){const l=t[i];S(r,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let i=0;i<t.length;i++){const l=t[i],o=l.query,f=Array.from(r.querySelectorAll(o));r.matches&&r.matches(o)&&f.push(r);for(let s=0;s<f.length;s++){const c=f[s];if(!document.contains(c)){const d=c[l.attribute];if(d&&typeof d.destroy=="function")try{d.destroy()}catch(u){console.error("["+l.attribute+"] destroy failed",c,u)}delete c[l.attribute]}}}}}}function ae(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,m(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{de(r)}catch(i){console.error("[ln-core] lifecycle handler failed",r.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function he(e,t,n,r,i={}){const l=i.extraAttributes||[],o=i.onAttributeChange||null,f=i.onSubtreeChange||null,s=i.onInit||null,c=i.onAttrChange||null,d=i.effects||null,u=i.attributes||null,h=u?oe(u):d,p=u?new Set(Object.keys(u)):null,A=i.persist||null;function y(v){const g=v||document.body;if(S(g,e,t,n),u&&B())for(const C in u){const ke=u[C],E=Array.from(g.querySelectorAll("["+C+"]"));g.matches&&g.matches("["+C+"]")&&E.push(g);for(let O=0;O<E.length;O++){const N=E[O];_(N)&&F(ke,N.getAttribute(C),C,r,N)}}s&&s(g)}const a=[];if(e.indexOf("[")!==-1){const v=/\[([\w-]+)/g;let g;for(;(g=v.exec(e))!==null;)a.push(g[1])}else a.push(e);fe({selector:e,attribute:t,componentTag:r,attributes:u,ComponentFn:n,onInit:s,observed:a.concat(l),onAttributeChange:o,onAttrChange:c,effects:h,declared:p,persist:A}),ue();const b=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";M().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:f,query:b}),ae(),window[t]=y;function X(){le()>0?se(function(){y(document.body)}):y(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",X):X(),y}function W(e){return(e||"").replace(/^#/,"")}function x(e){const t=e===void 0?location.hash:e,n={},r=W(t);if(!r)return n;const i=r.split("&");for(let l=0;l<i.length;l++){const o=i[l];if(!o)continue;const f=o.indexOf(":"),s=f>-1?o.slice(0,f):o,c=f>-1?o.slice(f+1):"";if(s)try{n[s]=decodeURIComponent(c)}catch{n[s]=c}}return n}function we(e){if(!e)return null;const t=x();return e in t?t[e]:null}function be(e,t){if(!e)return;const n=x();t==null?delete n[e]:n[e]=String(t);const i=Object.keys(n).map(function(l){const o=n[l];return o===""?l:l+":"+encodeURIComponent(o)}).join("&");W(location.hash)!==i&&(location.hash=i)}function ge(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function pe(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 ye(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ce(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function me(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ae(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),i=r?r.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:n,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=x,window.lnCore.hashGet=we,window.lnCore.hashSet=be,window.lnCore.hashLinkClick=ge,window.lnCore.resolveHashNamespace=pe,window.lnCore.hashSortEncode=ye,window.lnCore.hashSortDecode=Ce,window.lnCore.hashFilterEncode=me,window.lnCore.hashFilterDecode=Ae);function j(e,t){if(e.length!==1)return e;const n=e.charCodeAt(0);if(n>=65&&n<=90){const r=((n-65+t)%26+26)%26;return String.fromCharCode(65+r)}if(n>=97&&n<=122){const r=((n-97+t)%26+26)%26;return String.fromCharCode(97+r)}if(n>=48&&n<=57){const r=((n-48+t)%10+10)%10;return String.fromCharCode(48+r)}return e}function V(e){if(e==null||e==="")return"";const t=String(e);if(typeof TextEncoder<"u"&&typeof btoa<"u"){const n=new TextEncoder().encode(t);let r="";const i=n.length;for(let l=0;l<i;l++)r+=String.fromCharCode(n[l]);return btoa(r)}return typeof Buffer<"u"?Buffer.from(t,"utf-8").toString("base64"):""}function U(e){if(e==null||e==="")return"";try{const t=String(e).trim();if(typeof atob<"u"&&typeof TextDecoder<"u"){const n=atob(t),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return new TextDecoder().decode(r)}if(typeof Buffer<"u")return Buffer.from(t,"base64").toString("utf-8")}catch{return e}return e}function K(e,t){const n=String(t||"ln-ashlar");let r;typeof TextEncoder<"u"?r=new TextEncoder().encode(n):typeof Buffer<"u"?r=Buffer.from(n,"utf-8"):r=[108,110];const i=r.length||1,l=new Uint8Array(e.length);for(let o=0;o<e.length;o++)l[o]=e[o]^r[o%i];return l}function Q(e,t="ln-ashlar"){if(e==null||e==="")return"";const n=String(e);let r;if(typeof TextEncoder<"u")r=new TextEncoder().encode(n);else if(typeof Buffer<"u")r=Buffer.from(n,"utf-8");else return"";const i=K(r,t);let l="";for(let o=0;o<i.length;o++)l+=String.fromCharCode(i[o]);return typeof btoa<"u"?btoa(l):typeof Buffer<"u"?Buffer.from(i).toString("base64"):""}function J(e,t="ln-ashlar"){if(e==null||e==="")return"";try{const n=String(e).trim();let r="";if(typeof atob<"u")r=atob(n);else if(typeof Buffer<"u")r=Buffer.from(n,"base64").toString("binary");else return e;const i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);const l=K(i,t);if(typeof TextDecoder<"u")return new TextDecoder().decode(l);if(typeof Buffer<"u")return Buffer.from(l).toString("utf-8")}catch{return e}return e}function P(e){if(typeof e=="number"||typeof e=="string"&&/^-?\d+$/.test(String(e).trim()))return{codec:"rot",shift:Number(e)||13,key:"ln-ashlar"};if(e&&typeof e=="object"){const t=(e.codec||(e.key?"xor":"rot")).toLowerCase().trim(),n=t==="xor"||t==="base64"?t:"rot",r=Number(e.shift)||13,i=e.key||"ln-ashlar";return{codec:n,shift:r,key:i}}return{codec:"rot",shift:13,key:"ln-ashlar"}}function _e(e,t=13){if(e==null||(typeof e!="string"&&(e=String(e)),e.length===0))return"";const n=P(t);return n.codec==="base64"?V(e):n.codec==="xor"?Q(e,n.key):e.replace(/[a-zA-Z0-9]/g,r=>j(r,n.shift))}function T(e,t=13){if(e==null||(typeof e!="string"&&(e=String(e)),e.length===0))return"";const n=P(t);return n.codec==="base64"?U(e):n.codec==="xor"?J(e,n.key):e.replace(/[a-zA-Z0-9]/g,r=>j(r,-n.shift))}(function(){const e="data-ln-obfuscator",t="lnObfuscator";if(window[t]!==void 0)return;function n(o){const f=o[t];f&&f.deobfuscate()}const r={"data-ln-obfuscator":{type:"enum",values:["rot13","base64","xor"],fallback:"rot13",effect:n,description:"Codec used to deobfuscate text or links"},"data-ln-obfuscator-codec":{type:"enum",values:["rot13","base64","xor"],fallback:"rot13",effect:n,description:"Explicit codec override attribute"},"data-ln-obfuscator-key":{type:"string",effect:n,description:"Encryption or masking key for XOR codec"}};function i(o){return o[t]?o[t]:(o[t]=this,this.dom=o,this._originalTextNodes=null,this._originalHref=null,this.deobfuscate(),this)}i.prototype.deobfuscate=function(){const o=!!(this.dom.matches&&(this.dom.matches("a")||this.dom.matches("area")));if(this._originalHref===null&&o&&this.dom.hasAttribute("href")&&(this._originalHref=this.dom.getAttribute("href")),(!this._originalTextNodes||this._originalTextNodes.length===0||this._originalTextNodes.some(a=>!this.dom.contains(a.node)))&&(this._originalTextNodes=[],typeof document<"u"&&document.createTreeWalker)){const a=document.createTreeWalker(this.dom,NodeFilter.SHOW_TEXT,{acceptNode:function(w){return w.parentElement&&w.parentElement.classList&&w.parentElement.classList.contains("sr-only")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;a.nextNode();)this._originalTextNodes.push({node:a.currentNode,raw:a.currentNode.nodeValue})}const s=this.dom.getAttribute(e),c=parseInt(s,10),d=isNaN(c)?13:c,u=(this.dom.getAttribute("data-ln-obfuscator-codec")||"").toLowerCase().trim(),h=this.dom.getAttribute("data-ln-obfuscator-key");let p="rot";u==="xor"||u==="base64"?p=u:h&&(p="xor");const A=h||"ln-ashlar",y={codec:p,shift:d,key:A};if(o&&this.dom.getAttribute("data-ln-external-link")==="processed"){const a=this.dom.querySelectorAll(".sr-only");for(let b=0;b<a.length;b++)a[b].remove();this.dom.removeAttribute("data-ln-external-link"),this.dom.removeAttribute("target");const w=(this.dom.rel||"").split(/\s+/).filter(function(b){return b&&b!=="noopener"&&b!=="noreferrer"});w.length>0?this.dom.rel=w.join(" "):this.dom.removeAttribute("rel")}if(this._originalTextNodes)for(let a=0;a<this._originalTextNodes.length;a++){const w=this._originalTextNodes[a];w.node&&w.raw&&w.raw.length>0&&(w.node.nodeValue=T(w.raw,y))}if(o&&this._originalHref){const a=T(this._originalHref,y);this.dom.setAttribute("href",a)}L(this.dom,"ln-obfuscator:deobfuscated",{target:this.dom,codec:p,shift:d,key:p==="xor"?A:null})},i.prototype.destroy=function(){if(this.dom[t]){if(this._originalTextNodes)for(let o=0;o<this._originalTextNodes.length;o++){const f=this._originalTextNodes[o];f.node&&f.raw&&(f.node.nodeValue=f.raw)}this._originalHref!==null&&this.dom.setAttribute("href",this._originalHref),delete this.dom[t]}};const l=he(e,t,i,"ln-obfuscator",{attributes:r});l.obfuscate=_e,l.deobfuscate=T,l.utf8ToBase64=V,l.base64ToUtf8=U,l.xorObfuscate=Q,l.xorDeobfuscate=J})()})();
|
|
@@ -0,0 +1,49 @@
|
|
|
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-obfuscator",
|
|
4
|
+
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"data-ln-external-link": {
|
|
7
|
+
"direction": "both",
|
|
8
|
+
"sources": [
|
|
9
|
+
"src/ln-obfuscator.js"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"data-ln-obfuscator": {
|
|
13
|
+
"direction": "author",
|
|
14
|
+
"sources": [
|
|
15
|
+
"src/ln-obfuscator.js"
|
|
16
|
+
],
|
|
17
|
+
"type": "enum",
|
|
18
|
+
"values": [
|
|
19
|
+
"rot13",
|
|
20
|
+
"base64",
|
|
21
|
+
"xor"
|
|
22
|
+
],
|
|
23
|
+
"fallback": "rot13",
|
|
24
|
+
"description": "Codec used to deobfuscate text or links"
|
|
25
|
+
},
|
|
26
|
+
"data-ln-obfuscator-codec": {
|
|
27
|
+
"direction": "author",
|
|
28
|
+
"sources": [
|
|
29
|
+
"src/ln-obfuscator.js"
|
|
30
|
+
],
|
|
31
|
+
"type": "enum",
|
|
32
|
+
"values": [
|
|
33
|
+
"rot13",
|
|
34
|
+
"base64",
|
|
35
|
+
"xor"
|
|
36
|
+
],
|
|
37
|
+
"fallback": "rot13",
|
|
38
|
+
"description": "Explicit codec override attribute"
|
|
39
|
+
},
|
|
40
|
+
"data-ln-obfuscator-key": {
|
|
41
|
+
"direction": "author",
|
|
42
|
+
"sources": [
|
|
43
|
+
"src/ln-obfuscator.js"
|
|
44
|
+
],
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Encryption or masking key for XOR codec"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|