@eunomia/elements 1.0.0-beta.3 → 1.0.0-beta.4
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/README.md +1 -1
- package/dist/cdn/components/chunks/{chunk-3LMI7KUA.js → chunk-2JLDJFYD.js} +1 -1
- package/dist/cdn/components/chunks/chunk-4MXL6PZC.js +124 -0
- package/dist/cdn/components/chunks/{chunk-32KRPOPV.js → chunk-5XJGYXW7.js} +6 -6
- package/dist/cdn/components/chunks/{chunk-O2HNWH65.js → chunk-5XJLIHAU.js} +7 -7
- package/dist/cdn/components/chunks/{chunk-5GF2Q3NR.js → chunk-74AOAB4X.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-WYMBUIKX.js → chunk-A6KGFALA.js} +4 -4
- package/dist/cdn/components/chunks/chunk-BMQOI7HX.js +371 -0
- package/dist/cdn/components/chunks/{chunk-LJYTHDZP.js → chunk-D2M4BV5Y.js} +6 -6
- package/dist/cdn/components/chunks/{chunk-NEYBPT3D.js → chunk-EJIX2D4Z.js} +2 -2
- package/dist/cdn/components/chunks/{chunk-BYBUXKXC.js → chunk-EOWBYZV7.js} +2 -2
- package/dist/cdn/components/chunks/chunk-EST3M4AO.js +1 -0
- package/dist/cdn/components/chunks/{chunk-TBKKTJOX.js → chunk-GSJEJLFA.js} +3 -3
- package/dist/cdn/components/chunks/{chunk-5RCCZVFZ.js → chunk-IJ5WFMK4.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-RWONCXTF.js → chunk-KVYUNKUO.js} +2 -2
- package/dist/cdn/components/chunks/chunk-LGLQ36QB.js +16 -0
- package/dist/cdn/components/chunks/{chunk-53QH6MPM.js → chunk-NHFWATVN.js} +1 -1
- package/dist/cdn/components/chunks/chunk-OAULRKHQ.js +38 -0
- package/dist/cdn/components/chunks/chunk-P32B7BFD.js +118 -0
- package/dist/cdn/components/chunks/{chunk-ZPFHTJSS.js → chunk-PCM7D3YF.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-ABYEBP57.js → chunk-PED5ATYN.js} +11 -8
- package/dist/cdn/components/chunks/{chunk-ON42P6FI.js → chunk-RJCJXB7Y.js} +5 -5
- package/dist/cdn/components/chunks/{chunk-5C7YND22.js → chunk-S2UCEWNG.js} +8 -8
- package/dist/cdn/components/chunks/{chunk-EAGGN3ZI.js → chunk-SIHZFOTK.js} +9 -9
- package/dist/cdn/components/chunks/{chunk-6UPI7GHJ.js → chunk-UAGCQF23.js} +7 -7
- package/dist/cdn/components/chunks/{chunk-6IILPCSQ.js → chunk-X2AUBZD2.js} +3 -3
- package/dist/cdn/components/chunks/chunk-YGUJJ25C.js +263 -0
- package/dist/cdn/components/eun-alert.js +65 -45
- package/dist/cdn/components/eun-badge.js +1 -1
- package/dist/cdn/components/eun-breadcrumb-item.js +14 -10
- package/dist/cdn/components/eun-breadcrumb.js +11 -7
- package/dist/cdn/components/eun-button.js +1 -1
- package/dist/cdn/components/eun-calendar.js +16 -16
- package/dist/cdn/components/eun-card.js +21 -12
- package/dist/cdn/components/eun-carousel.js +35 -27
- package/dist/cdn/components/eun-check-card.js +3 -3
- package/dist/cdn/components/eun-checkbox-list.js +3 -3
- package/dist/cdn/components/eun-checkbox.js +1 -1
- package/dist/cdn/components/eun-chip.js +45 -207
- package/dist/cdn/components/eun-collapse.js +13 -12
- package/dist/cdn/components/eun-color-picker.js +12 -12
- package/dist/cdn/components/eun-counter.js +8 -8
- package/dist/cdn/components/eun-date-picker.js +50 -50
- package/dist/cdn/components/eun-drawer.js +3 -3
- package/dist/cdn/components/eun-dropdown-button.js +1 -1
- package/dist/cdn/components/eun-dropdown-item.js +6 -6
- package/dist/cdn/components/eun-fab.js +31 -53
- package/dist/cdn/components/eun-icon.js +1 -1
- package/dist/cdn/components/eun-image-card.js +18 -11
- package/dist/cdn/components/eun-image-carousel.js +16 -16
- package/dist/cdn/components/eun-infinite-list.js +1 -1
- package/dist/cdn/components/eun-input-file.js +12 -12
- package/dist/cdn/components/eun-input-phone.js +13 -13
- package/dist/cdn/components/eun-input.js +1 -1
- package/dist/cdn/components/eun-label.js +4 -4
- package/dist/cdn/components/eun-link.js +29 -11
- package/dist/cdn/components/eun-loader.js +1 -1
- package/dist/cdn/components/eun-modal.js +6 -6
- package/dist/cdn/components/eun-pagination.js +3 -3
- package/dist/cdn/components/eun-password-strength.js +9 -6
- package/dist/cdn/components/eun-progress-bar.js +13 -13
- package/dist/cdn/components/eun-radio-card.js +2 -2
- package/dist/cdn/components/eun-radio-list.js +1 -1
- package/dist/cdn/components/eun-radio.js +1 -1
- package/dist/cdn/components/eun-scheduler-event-editor.js +2 -2
- package/dist/cdn/components/eun-scheduler-event.js +1 -1
- package/dist/cdn/components/eun-scheduler.js +10 -10
- package/dist/cdn/components/eun-search.js +7 -7
- package/dist/cdn/components/eun-select.js +10 -10
- package/dist/cdn/components/eun-sidebar.js +9 -9
- package/dist/cdn/components/eun-skeleton.js +1 -1
- package/dist/cdn/components/eun-slider.js +8 -8
- package/dist/cdn/components/eun-sliding-card.js +4 -3
- package/dist/cdn/components/eun-step.js +8 -8
- package/dist/cdn/components/eun-stepper.js +8 -8
- package/dist/cdn/components/eun-switch.js +10 -10
- package/dist/cdn/components/eun-tab-group.js +19 -11
- package/dist/cdn/components/eun-tab-panel.js +1 -1
- package/dist/cdn/components/eun-tab.js +1 -1
- package/dist/cdn/components/eun-table-action-bar.js +1 -1
- package/dist/cdn/components/eun-table-cell.js +1 -1
- package/dist/cdn/components/eun-table-column.js +1 -1
- package/dist/cdn/components/eun-table-header.js +1 -1
- package/dist/cdn/components/eun-table-item.js +1 -1
- package/dist/cdn/components/eun-table-skeleton-row.js +1 -1
- package/dist/cdn/components/eun-table.js +3 -3
- package/dist/cdn/components/eun-tag.js +34 -126
- package/dist/cdn/components/eun-textarea.js +22 -22
- package/dist/cdn/components/eun-time-picker.js +25 -25
- package/dist/cdn/components/eun-toast.js +40 -36
- package/dist/cdn/components/eun-toggle-group.js +199 -66
- package/dist/cdn/components/eun-toggle-item.js +41 -24
- package/dist/cdn/components/eun-toggle.js +11 -8
- package/dist/cdn/components/eun-toolbar.js +14 -7
- package/dist/cdn/components/eun-tooltip.js +122 -87
- package/dist/cdn/styles/eunomia-themes.css +1 -1
- package/dist/cdn/styles/themes/eunomia-theme.css +1 -1
- package/dist/cdn/styles/themes/eunomia-theme.scss +1 -0
- package/dist/cdn/styles/themes/mixins/eunomia-neutrals.mixin.scss +71 -0
- package/dist/cdn/styles/themes/prebuilt-themes/eunomia/eunomia-dark.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/eunomia/eunomia.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/eunomia/eunomia.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/eunomia/eunomia.theme.scss +2 -0
- package/dist/cdn/styles/themes/prebuilt-themes/fire/eunomia-fire-dark.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/fire/eunomia-fire.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/fire/eunomia-fire.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/fire/eunomia-fire.theme.scss +2 -0
- package/dist/cdn/styles/themes/prebuilt-themes/forest/eunomia-forest-dark.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/forest/eunomia-forest.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/forest/eunomia-forest.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/forest/eunomia-forest.theme.scss +2 -0
- package/dist/cdn/styles/themes/prebuilt-themes/gold/eunomia-gold-dark.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/gold/eunomia-gold.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/gold/eunomia-gold.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/gold/eunomia-gold.theme.scss +2 -0
- package/dist/cdn/styles/themes/prebuilt-themes/ocean/eunomia-ocean-dark.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/ocean/eunomia-ocean.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/ocean/eunomia-ocean.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/ocean/eunomia-ocean.theme.scss +2 -0
- package/dist/cdn/styles/themes/prebuilt-themes/salmon/eunomia-salmon-dark.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/salmon/eunomia-salmon.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/salmon/eunomia-salmon.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/salmon/eunomia-salmon.theme.scss +2 -0
- package/dist/cdn/styles/themes/prebuilt-themes/violet/eunomia-violet-dark.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/violet/eunomia-violet.mixin.scss +3 -13
- package/dist/cdn/styles/themes/prebuilt-themes/violet/eunomia-violet.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/violet/eunomia-violet.theme.scss +2 -0
- package/dist/cdn/styles/tools/indexes/eunomia-tools.index.scss +1 -0
- package/dist/cdn/styles/tools/mixins/settings/eunomia-alpha.mixin.scss +39 -0
- package/dist/cdn/styles/tools/mixins/settings/eunomia-border.mixin.scss +3 -3
- package/dist/cdn/styles/tools/mixins/settings/eunomia-font.mixin.scss +12 -12
- package/dist/cdn/styles/tools/mixins/settings/eunomia-radius.mixin.scss +4 -4
- package/dist/components/action/button/button.d.ts +2 -0
- package/dist/components/action/button/button.js +2 -0
- package/dist/components/action/button/button.styles.js +132 -384
- package/dist/components/action/dropdown-button/dropdown-button.d.ts +7 -0
- package/dist/components/action/dropdown-button/dropdown-button.js +11 -0
- package/dist/components/action/dropdown-button/dropdown-button.styles.js +8 -8
- package/dist/components/action/dropdown-button/dropdown-item.styles.js +6 -6
- package/dist/components/action/fab/fab.d.ts +3 -1
- package/dist/components/action/fab/fab.js +3 -1
- package/dist/components/action/fab/fab.styles.js +26 -49
- package/dist/components/action/link/link.d.ts +50 -0
- package/dist/components/action/link/link.js +69 -1
- package/dist/components/action/link/link.styles.js +19 -2
- package/dist/components/action/shared-styles/button-palette.styles.d.ts +27 -0
- package/dist/components/action/shared-styles/button-palette.styles.js +151 -0
- package/dist/components/action/toggle/toggle-group.d.ts +41 -7
- package/dist/components/action/toggle/toggle-group.js +161 -45
- package/dist/components/action/toggle/toggle-group.styles.d.ts +6 -5
- package/dist/components/action/toggle/toggle-group.styles.js +152 -35
- package/dist/components/action/toggle/toggle-item.styles.js +37 -20
- package/dist/components/action/toggle/toggle.d.ts +1 -1
- package/dist/components/action/toggle/toggle.js +1 -1
- package/dist/components/action/toggle/toggle.styles.d.ts +2 -2
- package/dist/components/action/toggle/toggle.styles.js +13 -10
- package/dist/components/alert/alert/alert.d.ts +4 -3
- package/dist/components/alert/alert/alert.js +4 -3
- package/dist/components/alert/alert/alert.styles.js +57 -36
- package/dist/components/alert/drawer/drawer.styles.js +3 -3
- package/dist/components/alert/modal/modal.styles.js +6 -6
- package/dist/components/alert/toast/toast.d.ts +4 -3
- package/dist/components/alert/toast/toast.js +4 -3
- package/dist/components/alert/toast/toast.styles.js +41 -36
- package/dist/components/content/badge/badge.styles.js +1 -1
- package/dist/components/content/card/card.d.ts +4 -4
- package/dist/components/content/card/card.js +4 -4
- package/dist/components/content/card/card.styles.js +19 -10
- package/dist/components/content/card/image-card.d.ts +1 -1
- package/dist/components/content/card/image-card.js +1 -1
- package/dist/components/content/card/image-card.styles.js +17 -10
- package/dist/components/content/card/sliding-card.styles.js +3 -2
- package/dist/components/content/chip/chip.d.ts +16 -7
- package/dist/components/content/chip/chip.js +18 -6
- package/dist/components/content/chip/chip.styles.d.ts +1 -1
- package/dist/components/content/chip/chip.styles.js +43 -207
- package/dist/components/content/collapse/collapse.styles.js +10 -9
- package/dist/components/content/icon/icon.style.js +1 -1
- package/dist/components/content/image-carousel/image-carousel.styles.js +14 -14
- package/dist/components/content/password-strength/password-strength.styles.js +7 -4
- package/dist/components/content/progress-bar/progress-bar.styles.js +9 -9
- package/dist/components/content/shared-styles/tone-surface.styles.d.ts +31 -0
- package/dist/components/content/shared-styles/tone-surface.styles.js +149 -0
- package/dist/components/content/tag/tag.d.ts +16 -6
- package/dist/components/content/tag/tag.js +19 -6
- package/dist/components/content/tag/tag.styles.d.ts +1 -1
- package/dist/components/content/tag/tag.styles.js +40 -125
- package/dist/components/content/tooltip/tooltip.d.ts +15 -4
- package/dist/components/content/tooltip/tooltip.js +21 -4
- package/dist/components/content/tooltip/tooltip.styles.js +115 -79
- package/dist/components/form/checkbox/check-card.styles.js +2 -2
- package/dist/components/form/checkbox/checkbox-list.d.ts +1 -1
- package/dist/components/form/checkbox/checkbox.d.ts +1 -1
- package/dist/components/form/checkbox/checkbox.styles.js +6 -6
- package/dist/components/form/color-picker/color-picker.d.ts +1 -1
- package/dist/components/form/color-picker/color-picker.styles.js +7 -7
- package/dist/components/form/counter/counter.d.ts +1 -1
- package/dist/components/form/counter/counter.styles.js +7 -7
- package/dist/components/form/date-picker/date-picker-day-grid.styles.js +2 -2
- package/dist/components/form/date-picker/date-picker-grid.styles.js +15 -15
- package/dist/components/form/date-picker/date-picker-month-grid.styles.js +1 -1
- package/dist/components/form/date-picker/date-picker-year-grid.styles.js +1 -1
- package/dist/components/form/date-picker/date-picker.d.ts +1 -1
- package/dist/components/form/date-picker/date-picker.styles.js +12 -12
- package/dist/components/form/input/input.d.ts +1 -1
- package/dist/components/form/input-file/input-file.d.ts +1 -1
- package/dist/components/form/input-file/input-file.styles.js +9 -9
- package/dist/components/form/input-phone/input-phone.d.ts +1 -1
- package/dist/components/form/input-phone/input-phone.styles.js +7 -7
- package/dist/components/form/label/label.styles.js +4 -4
- package/dist/components/form/radio/radio-card.styles.js +1 -1
- package/dist/components/form/radio/radio-list.d.ts +1 -1
- package/dist/components/form/radio/radio.d.ts +1 -1
- package/dist/components/form/radio/radio.styles.js +2 -2
- package/dist/components/form/search/search.styles.js +6 -6
- package/dist/components/form/select/select.d.ts +1 -1
- package/dist/components/form/select/select.styles.js +6 -6
- package/dist/components/form/shared-styles/card.styles.js +1 -1
- package/dist/components/form/shared-styles/field.styles.js +7 -7
- package/dist/components/form/shared-styles/form-labels.styles.js +1 -1
- package/dist/components/form/shared-styles/listbox.styles.js +6 -6
- package/dist/components/form/slider/slider.d.ts +1 -1
- package/dist/components/form/slider/slider.styles.js +6 -6
- package/dist/components/form/switch/switch.d.ts +1 -1
- package/dist/components/form/switch/switch.styles.js +8 -8
- package/dist/components/form/textarea/textarea.d.ts +1 -1
- package/dist/components/form/textarea/textarea.styles.js +6 -6
- package/dist/components/form/time-picker/time-picker-columns.styles.js +6 -6
- package/dist/components/form/time-picker/time-picker-list.styles.js +2 -2
- package/dist/components/form/time-picker/time-picker.d.ts +1 -1
- package/dist/components/form/time-picker/time-picker.styles.js +8 -8
- package/dist/components/loader/loader/loader.styles.js +2 -2
- package/dist/components/loader/skeleton/skeleton.styles.js +8 -5
- package/dist/components/navigation/breadcrumb/breadcrumb-item.d.ts +7 -0
- package/dist/components/navigation/breadcrumb/breadcrumb-item.js +15 -1
- package/dist/components/navigation/breadcrumb/breadcrumb-item.styles.js +3 -3
- package/dist/components/navigation/breadcrumb/breadcrumb.d.ts +1 -0
- package/dist/components/navigation/breadcrumb/breadcrumb.js +7 -1
- package/dist/components/navigation/breadcrumb/breadcrumb.styles.js +3 -3
- package/dist/components/navigation/carousel/carousel.d.ts +40 -6
- package/dist/components/navigation/carousel/carousel.js +61 -12
- package/dist/components/navigation/carousel/carousel.styles.js +19 -7
- package/dist/components/navigation/pagination/pagination.styles.js +3 -3
- package/dist/components/navigation/sidebar/sidebar.styles.js +9 -9
- package/dist/components/navigation/stepper/step.styles.js +8 -8
- package/dist/components/navigation/stepper/stepper.styles.js +8 -8
- package/dist/components/navigation/tabs/tab/tab.styles.js +5 -5
- package/dist/components/navigation/tabs/tab-group/tab-group.d.ts +9 -0
- package/dist/components/navigation/tabs/tab-group/tab-group.js +19 -2
- package/dist/components/navigation/tabs/tab-group/tab-group.styles.js +12 -4
- package/dist/components/navigation/tabs/tab-panel/tab-panel.styles.js +1 -1
- package/dist/components/navigation/toolbar/toolbar.d.ts +2 -0
- package/dist/components/navigation/toolbar/toolbar.js +2 -0
- package/dist/components/navigation/toolbar/toolbar.styles.js +16 -7
- package/dist/features/scheduler/calendar/calendar.js +1 -1
- package/dist/features/scheduler/calendar/calendar.styles.js +3 -3
- package/dist/features/scheduler/scheduler/scheduler.styles.js +2 -2
- package/dist/features/scheduler/scheduler-event/scheduler-event.styles.js +2 -2
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.styles.js +2 -2
- package/dist/features/scheduler/shared/scheduler-event-popover.styles.js +4 -4
- package/dist/features/scheduler/shared/scheduler-hour-grid.styles.js +1 -1
- package/dist/features/scheduler/shared/scheduler-month-view.styles.js +1 -1
- package/dist/features/scheduler/shared/scheduler-year-view.styles.js +1 -1
- package/dist/features/table/native-table.css +11 -11
- package/dist/features/table/table/table.styles.js +2 -2
- package/dist/features/table/table-action-bar/table-action-bar.styles.js +2 -2
- package/dist/features/table/table-cell/table-cell.styles.js +2 -2
- package/dist/features/table/table-column/table-column.styles.js +3 -3
- package/dist/features/table/table-header/table-header.styles.js +4 -4
- package/dist/features/table/table-item/table-item.styles.js +6 -6
- package/dist/features/table/table-skeleton-row/table-skeleton-row.styles.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -2
- package/dist/jsx.d.ts +18 -5
- package/dist/mixins/button.mixin.d.ts +1 -0
- package/dist/mixins/button.mixin.js +10 -0
- package/dist/mixins/check.mixin.d.ts +1 -1
- package/dist/mixins/editable.mixin.d.ts +1 -1
- package/dist/mixins/form.mixin.d.ts +5 -1
- package/dist/mixins/form.mixin.js +32 -12
- package/dist/mixins/overflow-navigation.mixin.js +2 -1
- package/dist/mixins/radio.mixin.d.ts +1 -1
- package/dist/mixins/validators.mixin.d.ts +9 -3
- package/dist/utils/rich-text.utils.d.ts +33 -0
- package/dist/utils/rich-text.utils.js +140 -49
- package/dist/utils/theme-generator.utils.d.ts +24 -3
- package/dist/utils/theme-generator.utils.js +66 -21
- package/package.json +6 -1
- package/styles/themes/eunomia-theme.scss +1 -0
- package/styles/themes/mixins/eunomia-neutrals.mixin.scss +71 -0
- package/styles/themes/prebuilt-themes/eunomia/eunomia-dark.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/eunomia/eunomia.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/eunomia/eunomia.theme.scss +2 -0
- package/styles/themes/prebuilt-themes/fire/eunomia-fire-dark.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/fire/eunomia-fire.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/fire/eunomia-fire.theme.scss +2 -0
- package/styles/themes/prebuilt-themes/forest/eunomia-forest-dark.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/forest/eunomia-forest.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/forest/eunomia-forest.theme.scss +2 -0
- package/styles/themes/prebuilt-themes/gold/eunomia-gold-dark.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/gold/eunomia-gold.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/gold/eunomia-gold.theme.scss +2 -0
- package/styles/themes/prebuilt-themes/ocean/eunomia-ocean-dark.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/ocean/eunomia-ocean.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/ocean/eunomia-ocean.theme.scss +2 -0
- package/styles/themes/prebuilt-themes/salmon/eunomia-salmon-dark.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/salmon/eunomia-salmon.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/salmon/eunomia-salmon.theme.scss +2 -0
- package/styles/themes/prebuilt-themes/violet/eunomia-violet-dark.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/violet/eunomia-violet.mixin.scss +3 -13
- package/styles/themes/prebuilt-themes/violet/eunomia-violet.theme.scss +2 -0
- package/styles/tools/indexes/eunomia-tools.index.scss +1 -0
- package/styles/tools/mixins/settings/eunomia-alpha.mixin.scss +39 -0
- package/styles/tools/mixins/settings/eunomia-border.mixin.scss +3 -3
- package/styles/tools/mixins/settings/eunomia-font.mixin.scss +12 -12
- package/styles/tools/mixins/settings/eunomia-radius.mixin.scss +4 -4
- package/dist/cdn/components/chunks/chunk-5TH3P53V.js +0 -16
- package/dist/cdn/components/chunks/chunk-KNM5QHDK.js +0 -38
- package/dist/cdn/components/chunks/chunk-MBF52GEL.js +0 -1
- package/dist/cdn/components/chunks/chunk-Z6PJYSC3.js +0 -622
- package/dist/cdn/components/chunks/chunk-ZKPCO5RB.js +0 -262
package/dist/index.js
CHANGED
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
// alongside them, composing the others and writing the result onto
|
|
26
26
|
// `document.documentElement`, exported so a consumer doesn't have to
|
|
27
27
|
// reassemble that composition themselves just to apply a custom brand.
|
|
28
|
+
// `buildThemeCss` is its pure counterpart, returning the same tokens as a
|
|
29
|
+
// stylesheet so an SSR app can ship the brand in the HTML itself instead
|
|
30
|
+
// of flashing the base theme until `initializeTheme` runs after hydration.
|
|
28
31
|
// `EUNOMIA_BREAKPOINTS` is exported so a consumer's own responsive layout
|
|
29
32
|
// code can switch at the exact same pixel widths the components already
|
|
30
33
|
// react to internally, instead of guessing or duplicating those numbers.
|
|
@@ -103,8 +106,8 @@ export { debounce, throttle } from "./utils/time.utils.js";
|
|
|
103
106
|
export { createDragReorder } from "./utils/drag-drop.utils.js";
|
|
104
107
|
export { EUNOMIA_BREAKPOINTS } from "./breakpoints.js";
|
|
105
108
|
export { setDefaultLocale, getDefaultLocale } from "./i18n/index.js";
|
|
106
|
-
export { buildPalette, buildTints, initializeTheme, } from "./utils/theme-generator.utils.js";
|
|
107
|
-
export { findRichTextColor, formatRichText, getPlainTextLength, joinAlign, RICH_TEXT_COLORS, splitAlign, } from "./utils/rich-text.utils.js";
|
|
109
|
+
export { buildPalette, buildTints, buildThemeCss, initializeTheme, } from "./utils/theme-generator.utils.js";
|
|
110
|
+
export { findRichTextColor, formatRichText, getPlainTextLength, joinAlign, parseInlineNodes, RICH_TEXT_COLORS, splitAlign, toHtml, toPlainText, } from "./utils/rich-text.utils.js";
|
|
108
111
|
export { LoadMoreEvent } from "./events/loadmore.event.js";
|
|
109
112
|
export { PageChangeEvent } from "./events/pagechange.event.js";
|
|
110
113
|
export { PageSizeChangeEvent } from "./events/pagesizechange.event.js";
|
package/dist/jsx.d.ts
CHANGED
|
@@ -20,14 +20,27 @@
|
|
|
20
20
|
* erased, so importing it (`import type {} from "@eunomia/elements/jsx"`)
|
|
21
21
|
* never calls `customElements.define(...)` and carries none of the SSR
|
|
22
22
|
* risk a value import of a component does. `react`'s types describe
|
|
23
|
-
* `
|
|
24
|
-
* still doesn't depend on React at runtime, so a non-React
|
|
25
|
-
* resolves this module at all.
|
|
23
|
+
* `HTMLAttributes`/`Key`/`Ref` here, but only as a type dependency: this
|
|
24
|
+
* package still doesn't depend on React at runtime, so a non-React
|
|
25
|
+
* consumer never resolves this module at all.
|
|
26
26
|
*/
|
|
27
|
-
import type {
|
|
27
|
+
import type { HTMLAttributes, Key, Ref } from "react";
|
|
28
28
|
type EunomiaTagName = Extract<keyof HTMLElementTagNameMap, `eun-${string}`>;
|
|
29
|
-
type
|
|
29
|
+
type EunomiaOwnProps<T> = Partial<Omit<T, keyof HTMLElement | keyof HTMLOrSVGElement>>;
|
|
30
|
+
/**
|
|
31
|
+
* Props allowed on a `<eun-*>` tag in TSX: the element's own reactive
|
|
32
|
+
* properties, plus every standard HTML/ARIA attribute and event handler
|
|
33
|
+
* React already knows about (id, style, title, tabIndex, aria-*, onClick,
|
|
34
|
+
* ...). `className` is deliberately excluded: React only rewrites it to
|
|
35
|
+
* the `class` attribute for elements it recognizes, not arbitrary custom
|
|
36
|
+
* elements — `class` is the one that actually works here. Custom events
|
|
37
|
+
* (`eunnavigate`, `eunchange`, ...) aren't included — those are typed and
|
|
38
|
+
* wired per-component with a ref, when that component is migrated.
|
|
39
|
+
*/
|
|
40
|
+
type EunomiaElementProps<T> = EunomiaOwnProps<T> & Omit<HTMLAttributes<T>, "className" | keyof EunomiaOwnProps<T>> & {
|
|
30
41
|
ref?: Ref<T>;
|
|
42
|
+
key?: Key | null;
|
|
43
|
+
class?: string;
|
|
31
44
|
};
|
|
32
45
|
type EunomiaJSXElements = {
|
|
33
46
|
[K in EunomiaTagName]: EunomiaElementProps<HTMLElementTagNameMap[K]>;
|
|
@@ -26,6 +26,13 @@ export const ButtonMixin = (superClass) => {
|
|
|
26
26
|
* @default "button"
|
|
27
27
|
*/
|
|
28
28
|
this.type = "button";
|
|
29
|
+
/**
|
|
30
|
+
* Keeps a `light` or `dark` button white or black in every theme.
|
|
31
|
+
* Without it, they follow the grey scale, which flips with the active
|
|
32
|
+
* theme. Has no effect on the other variants.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
this.fixedColor = false;
|
|
29
36
|
/**
|
|
30
37
|
* The button size.
|
|
31
38
|
* @default "m"
|
|
@@ -152,6 +159,9 @@ export const ButtonMixin = (superClass) => {
|
|
|
152
159
|
__decorate([
|
|
153
160
|
property({ reflect: true })
|
|
154
161
|
], ButtonMixinClass.prototype, "variant", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
property({ type: Boolean, reflect: true, attribute: "fixed-color" })
|
|
164
|
+
], ButtonMixinClass.prototype, "fixedColor", void 0);
|
|
155
165
|
__decorate([
|
|
156
166
|
property({ reflect: true })
|
|
157
167
|
], ButtonMixinClass.prototype, "size", void 0);
|
|
@@ -21,4 +21,4 @@ export declare class CheckMixinInterface {
|
|
|
21
21
|
* @template T A LitElement class extended with other mixins (Disabled, Readonly, Validators, Form).
|
|
22
22
|
* @returns A class extending the provided superclass with checkable behavior.
|
|
23
23
|
*/
|
|
24
|
-
export declare const CheckMixin: <T extends Constructor<LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface & FormMixinInterface<string>>>(superClass: T) => Constructor<CheckMixinInterface> & T;
|
|
24
|
+
export declare const CheckMixin: <T extends Constructor<LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<unknown> & FormMixinInterface<string>>>(superClass: T) => Constructor<CheckMixinInterface> & T;
|
|
@@ -29,4 +29,4 @@ export declare class EditableMixinInterface {
|
|
|
29
29
|
* shape (e.g. `string` for a single-value field, `string[]` for a multi-value one).
|
|
30
30
|
* @returns A class extending the provided superclass with editable behavior.
|
|
31
31
|
*/
|
|
32
|
-
export declare const EditableMixin: <U, T extends Constructor<LitElement & DisabledMixinInterface & ValidatorsMixinInterface & FormMixinInterface<U>>>(superClass: T) => Constructor<EditableMixinInterface> & T;
|
|
32
|
+
export declare const EditableMixin: <U, T extends Constructor<LitElement & DisabledMixinInterface & ValidatorsMixinInterface<unknown> & FormMixinInterface<U>>>(superClass: T) => Constructor<EditableMixinInterface> & T;
|
|
@@ -13,12 +13,14 @@ export declare class FormMixinInterface<T> {
|
|
|
13
13
|
setFormValue(value?: T): void;
|
|
14
14
|
renderDescription(): typeof nothing | TemplateResult;
|
|
15
15
|
name?: string;
|
|
16
|
+
hint?: string;
|
|
16
17
|
description?: string | string[] | undefined;
|
|
17
18
|
valueState?: T;
|
|
18
19
|
hideError?: boolean;
|
|
19
20
|
form: HTMLFormElement | null;
|
|
20
21
|
dirty: boolean;
|
|
21
22
|
touched: boolean;
|
|
23
|
+
controlled: boolean;
|
|
22
24
|
get pristine(): boolean;
|
|
23
25
|
get untouched(): boolean;
|
|
24
26
|
get value(): T;
|
|
@@ -32,4 +34,6 @@ export declare class FormMixinInterface<T> {
|
|
|
32
34
|
* @param superClass - Base class to extend.
|
|
33
35
|
* @returns A class extending the provided base with form capabilities.
|
|
34
36
|
*/
|
|
35
|
-
|
|
37
|
+
type ValidatorsMixinShape = Omit<ValidatorsMixinInterface, "validators">;
|
|
38
|
+
export declare const FormMixin: <T extends Constructor<LitElement & ValidatorsMixinShape & DisabledMixinInterface>, U>(superClass: T) => Constructor<FormMixinInterface<U>> & T;
|
|
39
|
+
export {};
|
|
@@ -13,13 +13,6 @@ import { html, nothing } from "lit";
|
|
|
13
13
|
import { property, state } from "lit/decorators.js";
|
|
14
14
|
import { when } from "lit/directives/when.js";
|
|
15
15
|
import { ChangeEvent } from "../events/change.event.js";
|
|
16
|
-
/**
|
|
17
|
-
* Mixin that adds form-related behavior and value management.
|
|
18
|
-
*
|
|
19
|
-
* @template U - Type of the form field value.
|
|
20
|
-
* @param superClass - Base class to extend.
|
|
21
|
-
* @returns A class extending the provided base with form capabilities.
|
|
22
|
-
*/
|
|
23
16
|
export const FormMixin = (superClass) => {
|
|
24
17
|
var _FormMixinClass_markDirty, _FormMixinClass_markTouched;
|
|
25
18
|
class FormMixinClass extends superClass {
|
|
@@ -60,6 +53,23 @@ export const FormMixin = (superClass) => {
|
|
|
60
53
|
* @default false
|
|
61
54
|
*/
|
|
62
55
|
this.touched = false;
|
|
56
|
+
/**
|
|
57
|
+
* Opts this field out of the native reset algorithm's value wipe: when
|
|
58
|
+
* `true`, `formResetCallback` leaves `value`/`checked` untouched.
|
|
59
|
+
*
|
|
60
|
+
* Exists for consumers who drive `value` as a controlled React prop
|
|
61
|
+
* (or equivalent in another framework): a browser-native `form.reset()`
|
|
62
|
+
* cannot be observed by React's reconciler unless a prop actually
|
|
63
|
+
* changes, so a native input only "survives" a stray reset (e.g. the
|
|
64
|
+
* unconditional one `useActionState` triggers via `requestFormReset` on
|
|
65
|
+
* every `<form action={fn}>` submission, success or not) because
|
|
66
|
+
* react-dom force-resyncs its `.value` on every commit — a defense
|
|
67
|
+
* custom elements don't get. Setting `controlled` makes the field's own
|
|
68
|
+
* app state the sole source of truth for `value`: the app decides when
|
|
69
|
+
* to clear it, the same way it already decides what to display it as.
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
this.controlled = false;
|
|
63
73
|
/**
|
|
64
74
|
* Marks the field dirty on its own `eunchange` — dispatched only from a
|
|
65
75
|
* genuine user-interaction handler, never from the `value`/`checked`
|
|
@@ -255,13 +265,20 @@ export const FormMixin = (superClass) => {
|
|
|
255
265
|
* `value` attribute. Skipping the assignment there (as an earlier
|
|
256
266
|
* version of this method did) left a typed-in value stuck after
|
|
257
267
|
* `form.reset()`.
|
|
268
|
+
*
|
|
269
|
+
* Skips that assignment entirely when {@link controlled} is set: the
|
|
270
|
+
* consuming app owns `value` in that mode, so this callback only clears
|
|
271
|
+
* {@link dirty}/{@link touched}, leaving the value itself for the app
|
|
272
|
+
* to update (or not) on its own terms.
|
|
258
273
|
*/
|
|
259
274
|
formResetCallback() {
|
|
260
|
-
if (this.
|
|
261
|
-
this.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
275
|
+
if (!this.controlled) {
|
|
276
|
+
if (this.checkable) {
|
|
277
|
+
this.checked = false;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
this.value = this.defaultValue;
|
|
281
|
+
}
|
|
265
282
|
}
|
|
266
283
|
this.dirty = false;
|
|
267
284
|
this.touched = false;
|
|
@@ -326,6 +343,9 @@ export const FormMixin = (superClass) => {
|
|
|
326
343
|
__decorate([
|
|
327
344
|
state()
|
|
328
345
|
], FormMixinClass.prototype, "touched", void 0);
|
|
346
|
+
__decorate([
|
|
347
|
+
property({ type: Boolean })
|
|
348
|
+
], FormMixinClass.prototype, "controlled", void 0);
|
|
329
349
|
__decorate([
|
|
330
350
|
property({
|
|
331
351
|
attribute: "default-value",
|
|
@@ -77,9 +77,10 @@ export const NavigationOverflowMixin = (superClass) => {
|
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Determines if the scrollable element is currently overflowing.
|
|
80
|
+
* Overridable, for content that isn't all in the `navigation` slot.
|
|
80
81
|
*
|
|
81
82
|
* @returns true if on overflow, false otherwise.
|
|
82
|
-
* @
|
|
83
|
+
* @protected
|
|
83
84
|
*/
|
|
84
85
|
isOnOverflow() {
|
|
85
86
|
const slot = this.shadowRoot?.querySelector('slot[name="navigation"]');
|
|
@@ -28,4 +28,4 @@ export declare class RadioMixinInterface {
|
|
|
28
28
|
* @template T A LitElement class extended with other mixins (Disabled, Readonly, Validators, Form).
|
|
29
29
|
* @returns A class extending the provided superclass with radio behavior.
|
|
30
30
|
*/
|
|
31
|
-
export declare const RadioMixin: <T extends Constructor<LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface & FormMixinInterface<string>>>(superClass: T) => Constructor<RadioMixinInterface> & T;
|
|
31
|
+
export declare const RadioMixin: <T extends Constructor<LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<unknown> & FormMixinInterface<string>>>(superClass: T) => Constructor<RadioMixinInterface> & T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
import { Mutable } from "../types/form-validators.type.js";
|
|
2
|
+
import { Mutable, Validators } from "../types/form-validators.type.js";
|
|
3
3
|
import { Constructor } from "../utils/constructor.type.js";
|
|
4
4
|
/**
|
|
5
5
|
* Defines a Validity object.
|
|
@@ -11,8 +11,13 @@ export interface Validity {
|
|
|
11
11
|
/**
|
|
12
12
|
* Interface defining the contract for components using `ValidatorsMixin`.
|
|
13
13
|
* Provides integration with the native form lifecycle,
|
|
14
|
+
*
|
|
15
|
+
* @template U Type of value being validated — same as the type parameter
|
|
16
|
+
* passed to `ValidatorsMixin` itself, kept in sync by hand at each call
|
|
17
|
+
* site since it can't be inferred from `ValidatorsMixin(superClass)`'s own
|
|
18
|
+
* single argument.
|
|
14
19
|
*/
|
|
15
|
-
export declare class ValidatorsMixinInterface {
|
|
20
|
+
export declare class ValidatorsMixinInterface<U = unknown> {
|
|
16
21
|
checkLocalValidators: () => Validity;
|
|
17
22
|
buildCommonValidators: () => Validity;
|
|
18
23
|
checkValidity: (dataToCheck: any) => boolean;
|
|
@@ -21,6 +26,7 @@ export declare class ValidatorsMixinInterface {
|
|
|
21
26
|
required: boolean;
|
|
22
27
|
errorMessages: string[];
|
|
23
28
|
validationMessage: string | string[];
|
|
29
|
+
validators?: Validators<U>[];
|
|
24
30
|
}
|
|
25
31
|
/**
|
|
26
32
|
* Mixin that adds validation capabilities to a LitElement.
|
|
@@ -28,4 +34,4 @@ export declare class ValidatorsMixinInterface {
|
|
|
28
34
|
* @template U Type of value being validated.
|
|
29
35
|
* @param superClass Base class to extend.
|
|
30
36
|
*/
|
|
31
|
-
export declare const ValidatorsMixin: <T extends Constructor<LitElement>, U>(superClass: T) => Constructor<ValidatorsMixinInterface
|
|
37
|
+
export declare const ValidatorsMixin: <T extends Constructor<LitElement>, U>(superClass: T) => Constructor<ValidatorsMixinInterface<U>> & T;
|
|
@@ -146,6 +146,39 @@ export declare function renderInline(nodes: InlineNode[]): TemplateResult;
|
|
|
146
146
|
* @returns the formatted template.
|
|
147
147
|
*/
|
|
148
148
|
export declare function formatRichText(text: string): TemplateResult;
|
|
149
|
+
/**
|
|
150
|
+
* Strips every Markdown-lite marker from a value and returns what a reader
|
|
151
|
+
* actually sees, as a plain string : the `[align:...]` directive, `**`,
|
|
152
|
+
* `{color=name}`, link URLs and so on are removed (a link keeps its label),
|
|
153
|
+
* and one newline is kept between lines. Needs no DOM, so it runs anywhere,
|
|
154
|
+
* including on the server, unlike {@link formatRichText}.
|
|
155
|
+
*
|
|
156
|
+
* Always consistent with {@link getPlainTextLength} :
|
|
157
|
+
* `toPlainText(text).length === getPlainTextLength(text)`. Handy for
|
|
158
|
+
* structured data (JSON-LD), meta descriptions, search indexes or
|
|
159
|
+
* notifications.
|
|
160
|
+
*
|
|
161
|
+
* @param text the raw Markdown-lite string.
|
|
162
|
+
* @returns the plain text.
|
|
163
|
+
*/
|
|
164
|
+
export declare function toPlainText(text: string): string;
|
|
165
|
+
/**
|
|
166
|
+
* Converts a Markdown-lite string into an HTML string, with the same markup
|
|
167
|
+
* as {@link formatRichText} (`<p>`, `<ul>`, `<strong>`, ...). Needs no DOM
|
|
168
|
+
* and no Lit, so it fits server rendering (a Next.js Server Component, an
|
|
169
|
+
* email, an RSS feed) where {@link formatRichText}'s template can't be used.
|
|
170
|
+
*
|
|
171
|
+
* Every piece of text and every attribute is escaped, and a link whose URL
|
|
172
|
+
* uses anything other than a relative path, a fragment, `http`, `https`,
|
|
173
|
+
* `mailto` or `tel` (such as `javascript:`) is rendered as its plain label,
|
|
174
|
+
* so the result is safe to inject with `innerHTML` or React's
|
|
175
|
+
* `dangerouslySetInnerHTML`. The `[align:...]` directive is stripped, read
|
|
176
|
+
* it with {@link splitAlign} if you need it.
|
|
177
|
+
*
|
|
178
|
+
* @param text the raw Markdown-lite string.
|
|
179
|
+
* @returns the HTML string.
|
|
180
|
+
*/
|
|
181
|
+
export declare function toHtml(text: string): string;
|
|
149
182
|
/**
|
|
150
183
|
* Populates a contenteditable root with the given Markdown-lite value,
|
|
151
184
|
* replacing its entire content — used both for the `formatting` toolbar's
|
|
@@ -126,15 +126,6 @@ export function parseInlineNodes(text) {
|
|
|
126
126
|
continue;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
// `***text***` : bold and italic together produce adjacent `**`+`*`
|
|
130
|
-
// delimiters at both ends (from nesting `<strong><em>`/`</em></strong>`),
|
|
131
|
-
// which the plain `**` check below can't tell apart from "close bold,
|
|
132
|
-
// then a stray, unmatched italic `*`" — it greedily consumes the first
|
|
133
|
-
// two of the three as bold's own closer, leaving the third orphaned
|
|
134
|
-
// with no closer of its own within the once-was-italic content, and
|
|
135
|
-
// the italic wrapping is silently lost on reparse. Handling the
|
|
136
|
-
// three-character run as one atomic unit first — same convention real
|
|
137
|
-
// Markdown uses for `***bold italic***` — avoids that ambiguity.
|
|
138
129
|
if (text.startsWith("***", i)) {
|
|
139
130
|
const closeIndex = text.indexOf("***", i + 3);
|
|
140
131
|
if (closeIndex !== -1) {
|
|
@@ -266,6 +257,39 @@ function renderInlineNode(node) {
|
|
|
266
257
|
return html `<a href=${node.href}>${renderInline(node.children)}</a>`;
|
|
267
258
|
}
|
|
268
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Splits a Markdown-lite body (without its `[align:...]` directive) into
|
|
262
|
+
* blocks : consecutive `- ` lines become one list, other non-empty lines
|
|
263
|
+
* become paragraphs, and empty lines are dropped. Shared by every output
|
|
264
|
+
* format ({@link formatRichText}, {@link toHtml}, {@link toPlainText}) so
|
|
265
|
+
* they can never disagree on what counts as a paragraph or a list.
|
|
266
|
+
*
|
|
267
|
+
* @param body the Markdown-lite body.
|
|
268
|
+
* @returns the blocks, in order.
|
|
269
|
+
*/
|
|
270
|
+
function splitBlocks(body) {
|
|
271
|
+
const blocks = [];
|
|
272
|
+
let list = [];
|
|
273
|
+
const flushList = () => {
|
|
274
|
+
if (list.length) {
|
|
275
|
+
blocks.push({ type: "list", items: list });
|
|
276
|
+
list = [];
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
body.split("\n").forEach((line) => {
|
|
280
|
+
const trimmed = line.trim();
|
|
281
|
+
if (trimmed.startsWith("- ")) {
|
|
282
|
+
list.push(trimmed.slice(2));
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
flushList();
|
|
286
|
+
if (trimmed) {
|
|
287
|
+
blocks.push({ type: "paragraph", text: trimmed });
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
flushList();
|
|
291
|
+
return blocks;
|
|
292
|
+
}
|
|
269
293
|
/**
|
|
270
294
|
* Converts a multi-line Markdown-lite string into a Lit template — see
|
|
271
295
|
* {@link parseInlineNodes} for the supported inline syntax.
|
|
@@ -284,30 +308,115 @@ function renderInlineNode(node) {
|
|
|
284
308
|
*/
|
|
285
309
|
export function formatRichText(text) {
|
|
286
310
|
const { body } = splitAlign(text);
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
311
|
+
return html `${splitBlocks(body).map((block) => block.type === "list"
|
|
312
|
+
? html `<ul>
|
|
313
|
+
${block.items.map((item) => html `<li>${renderInline(parseInlineNodes(item))}</li>`)}
|
|
314
|
+
</ul>`
|
|
315
|
+
: html `<p>${renderInline(parseInlineNodes(block.text))}</p>`)}`;
|
|
316
|
+
}
|
|
317
|
+
function inlineToPlainText(nodes) {
|
|
318
|
+
return nodes
|
|
319
|
+
.map((node) => node.type === "text" ? node.value : inlineToPlainText(node.children))
|
|
320
|
+
.join("");
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Strips every Markdown-lite marker from a value and returns what a reader
|
|
324
|
+
* actually sees, as a plain string : the `[align:...]` directive, `**`,
|
|
325
|
+
* `{color=name}`, link URLs and so on are removed (a link keeps its label),
|
|
326
|
+
* and one newline is kept between lines. Needs no DOM, so it runs anywhere,
|
|
327
|
+
* including on the server, unlike {@link formatRichText}.
|
|
328
|
+
*
|
|
329
|
+
* Always consistent with {@link getPlainTextLength} :
|
|
330
|
+
* `toPlainText(text).length === getPlainTextLength(text)`. Handy for
|
|
331
|
+
* structured data (JSON-LD), meta descriptions, search indexes or
|
|
332
|
+
* notifications.
|
|
333
|
+
*
|
|
334
|
+
* @param text the raw Markdown-lite string.
|
|
335
|
+
* @returns the plain text.
|
|
336
|
+
*/
|
|
337
|
+
export function toPlainText(text) {
|
|
338
|
+
const { body } = splitAlign(text);
|
|
339
|
+
const lines = body.length ? body.split("\n") : [""];
|
|
340
|
+
return lines
|
|
341
|
+
.map((line) => inlineToPlainText(parseInlineNodes(line)))
|
|
342
|
+
.join("\n");
|
|
343
|
+
}
|
|
344
|
+
const HTML_ESCAPES = {
|
|
345
|
+
"&": "&",
|
|
346
|
+
"<": "<",
|
|
347
|
+
">": ">",
|
|
348
|
+
'"': """,
|
|
349
|
+
"'": "'",
|
|
350
|
+
};
|
|
351
|
+
function escapeHtml(value) {
|
|
352
|
+
return value.replace(/[&<>"']/g, (char) => HTML_ESCAPES[char]);
|
|
353
|
+
}
|
|
354
|
+
const SAFE_URL_SCHEMES = new Set(["http:", "https:", "mailto:", "tel:"]);
|
|
355
|
+
/**
|
|
356
|
+
* Whether a link destination is safe to put in an `href` : relative URLs,
|
|
357
|
+
* fragments and the `http`, `https`, `mailto` and `tel` schemes. Anything
|
|
358
|
+
* else (`javascript:`, `data:`, ...) is refused.
|
|
359
|
+
*
|
|
360
|
+
* @param href the raw destination.
|
|
361
|
+
* @returns `true` when it can be emitted as an `href`.
|
|
362
|
+
*/
|
|
363
|
+
function isSafeHref(href) {
|
|
364
|
+
const normalized = href.replace(/[\u0000-\u0020]/g, "");
|
|
365
|
+
const scheme = /^([a-z][a-z0-9+.-]*:)/i.exec(normalized);
|
|
366
|
+
return !scheme || SAFE_URL_SCHEMES.has(scheme[1].toLowerCase());
|
|
367
|
+
}
|
|
368
|
+
function inlineToHtml(nodes) {
|
|
369
|
+
return nodes.map(inlineNodeToHtml).join("");
|
|
370
|
+
}
|
|
371
|
+
function inlineNodeToHtml(node) {
|
|
372
|
+
switch (node.type) {
|
|
373
|
+
case "text":
|
|
374
|
+
return escapeHtml(node.value);
|
|
375
|
+
case "bold":
|
|
376
|
+
return `<strong>${inlineToHtml(node.children)}</strong>`;
|
|
377
|
+
case "italic":
|
|
378
|
+
return `<em>${inlineToHtml(node.children)}</em>`;
|
|
379
|
+
case "underline":
|
|
380
|
+
return `<u>${inlineToHtml(node.children)}</u>`;
|
|
381
|
+
case "color": {
|
|
382
|
+
const color = findRichTextColor(node.color);
|
|
383
|
+
return `<span data-color="${escapeHtml(node.color)}" style="color: ${color?.text ?? "inherit"}">${inlineToHtml(node.children)}</span>`;
|
|
303
384
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
385
|
+
case "highlight": {
|
|
386
|
+
const color = findRichTextColor(node.color);
|
|
387
|
+
return `<span data-highlight="${escapeHtml(node.color)}" style="background-color: ${color?.highlight ?? "transparent"}">${inlineToHtml(node.children)}</span>`;
|
|
307
388
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
389
|
+
case "link":
|
|
390
|
+
return isSafeHref(node.href)
|
|
391
|
+
? `<a href="${escapeHtml(node.href)}">${inlineToHtml(node.children)}</a>`
|
|
392
|
+
: inlineToHtml(node.children);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Converts a Markdown-lite string into an HTML string, with the same markup
|
|
397
|
+
* as {@link formatRichText} (`<p>`, `<ul>`, `<strong>`, ...). Needs no DOM
|
|
398
|
+
* and no Lit, so it fits server rendering (a Next.js Server Component, an
|
|
399
|
+
* email, an RSS feed) where {@link formatRichText}'s template can't be used.
|
|
400
|
+
*
|
|
401
|
+
* Every piece of text and every attribute is escaped, and a link whose URL
|
|
402
|
+
* uses anything other than a relative path, a fragment, `http`, `https`,
|
|
403
|
+
* `mailto` or `tel` (such as `javascript:`) is rendered as its plain label,
|
|
404
|
+
* so the result is safe to inject with `innerHTML` or React's
|
|
405
|
+
* `dangerouslySetInnerHTML`. The `[align:...]` directive is stripped, read
|
|
406
|
+
* it with {@link splitAlign} if you need it.
|
|
407
|
+
*
|
|
408
|
+
* @param text the raw Markdown-lite string.
|
|
409
|
+
* @returns the HTML string.
|
|
410
|
+
*/
|
|
411
|
+
export function toHtml(text) {
|
|
412
|
+
const { body } = splitAlign(text);
|
|
413
|
+
return splitBlocks(body)
|
|
414
|
+
.map((block) => block.type === "list"
|
|
415
|
+
? `<ul>${block.items
|
|
416
|
+
.map((item) => `<li>${inlineToHtml(parseInlineNodes(item))}</li>`)
|
|
417
|
+
.join("")}</ul>`
|
|
418
|
+
: `<p>${inlineToHtml(parseInlineNodes(block.text))}</p>`)
|
|
419
|
+
.join("");
|
|
311
420
|
}
|
|
312
421
|
/**
|
|
313
422
|
* Builds one `<p>` per line of `body`, each with its inline Markdown-lite
|
|
@@ -351,13 +460,6 @@ function buildParagraphs(body) {
|
|
|
351
460
|
render(html `${lines.map((line) => html `<p>${renderInline(parseInlineNodes(line))}</p>`)}`, scratch);
|
|
352
461
|
stripComments(scratch);
|
|
353
462
|
const paragraphs = Array.from(scratch.children);
|
|
354
|
-
// A genuinely empty <p> (an empty line, most commonly the sole paragraph
|
|
355
|
-
// of an otherwise-empty field) has no content a browser can anchor a
|
|
356
|
-
// caret inside — clicking into it then often places the caret at the
|
|
357
|
-
// *root* level instead, right before the <p>, so anything typed lands
|
|
358
|
-
// there as a stray text node the block-based serializer never sees
|
|
359
|
-
// (value silently stays empty forever). A <br> gives every empty
|
|
360
|
-
// paragraph a real caret position of its own.
|
|
361
463
|
paragraphs.forEach((paragraph) => {
|
|
362
464
|
if (!paragraph.hasChildNodes()) {
|
|
363
465
|
paragraph.appendChild(document.createElement("br"));
|
|
@@ -394,20 +496,9 @@ const INLINE_TAG_MARKERS = {
|
|
|
394
496
|
};
|
|
395
497
|
function serializeInlineNode(node) {
|
|
396
498
|
if (node.nodeType === Node.TEXT_NODE) {
|
|
397
|
-
// U+200B (zero-width space) : the textarea's own toolbar uses it as an
|
|
398
|
-
// invisible caret anchor for a "pending" mark toggled with nothing
|
|
399
|
-
// selected (see textarea.ts's `PENDING_CARET_TEXT`) ; a real character
|
|
400
|
-
// a browser can place a caret next to inside an otherwise-empty inline
|
|
401
|
-
// element, but never meant to be real content, so it never survives
|
|
402
|
-
// into `value`.
|
|
403
499
|
return (node.textContent ?? "").replace(/\u200B/g, "");
|
|
404
500
|
}
|
|
405
501
|
if (node.nodeName === "BR") {
|
|
406
|
-
// The editor only ever inserts a `<br>` as an empty paragraph's sole
|
|
407
|
-
// child (so it stays focusable/visible) — never as a mid-paragraph soft
|
|
408
|
-
// break — so it always serializes to nothing, not a newline (block
|
|
409
|
-
// boundaries already produce one `\n` per paragraph in
|
|
410
|
-
// `serializeEditableRoot`).
|
|
411
502
|
return "";
|
|
412
503
|
}
|
|
413
504
|
if (!(node instanceof HTMLElement)) {
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* theme" widget run; see Theming > Custom theme for how it works and why
|
|
6
6
|
* each step is shaped the way it is.
|
|
7
7
|
*
|
|
8
|
-
* Only `buildPalette`, `buildTints`,
|
|
9
|
-
* types their signatures need) are exported
|
|
8
|
+
* Only `buildPalette`, `buildTints`, `initializeTheme`, and
|
|
9
|
+
* `buildThemeCss` (plus the types their signatures need) are exported
|
|
10
|
+
* from `index.ts`. Everything
|
|
10
11
|
* else below, the raw color math, the shade/tint step definitions, is
|
|
11
12
|
* kept file-private on purpose: none of it is meant to be reached on its
|
|
12
|
-
* own, it exists to be composed by those
|
|
13
|
+
* own, it exists to be composed by those four, and every extra export
|
|
13
14
|
* is a promise to a consumer that constrains how this file can change
|
|
14
15
|
* later. If a real need for one of these on its own ever comes up, it's
|
|
15
16
|
* a one-line change to export it.
|
|
@@ -60,6 +61,26 @@ export declare function buildTints(primaryHex: EunomiaHexColor, isDark: boolean)
|
|
|
60
61
|
*
|
|
61
62
|
* Client-side only: call it once the DOM exists (after mount, not during
|
|
62
63
|
* an SSR render), since it writes directly to `document.documentElement`.
|
|
64
|
+
* Because it only runs after the page has painted, the base theme shows
|
|
65
|
+
* for a frame first; `buildThemeCss` below avoids that flash.
|
|
63
66
|
*/
|
|
64
67
|
export declare function initializeTheme(primary: EunomiaHexColor, secondary: EunomiaHexColor, isDark?: boolean, surfaceColor?: EunomiaHexColor, darkSurfaceColor?: EunomiaHexColor, fontFamily?: string): void;
|
|
68
|
+
export interface EunomiaThemeCssOptions {
|
|
69
|
+
surfaceColor?: EunomiaHexColor;
|
|
70
|
+
darkSurfaceColor?: EunomiaHexColor;
|
|
71
|
+
fontFamily?: string;
|
|
72
|
+
brand?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The pure, stylesheet counterpart of `initializeTheme`: the same tokens,
|
|
76
|
+
* for both light and dark mode, returned as a CSS string instead of being
|
|
77
|
+
* written onto the DOM. Render it in a `<style>` in the document `<head>`
|
|
78
|
+
* (during SSR, or at build time) and the custom brand is there on first
|
|
79
|
+
* paint, with no flash of the base theme while the app hydrates.
|
|
80
|
+
*
|
|
81
|
+
* The rules are prefixed with `:root` so they outrank the prebuilt
|
|
82
|
+
* `[data-brand][data-theme]` rules whatever the stylesheet order, and
|
|
83
|
+
* switching mode is just a `data-theme` change, no regeneration needed.
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildThemeCss(primary: EunomiaHexColor, secondary: EunomiaHexColor, options?: EunomiaThemeCssOptions): string;
|
|
65
86
|
export {};
|