@hebium-ui/core 0.1.0-alpha.1 → 0.1.0-alpha.3
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/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/logics/avatar-placeholder/get-avatar-placeholder.d.ts +0 -2
- package/dist/logics/avatar-placeholder/get-avatar-placeholder.js +1 -2
- package/dist/logics/avatar-placeholder/should-show-avatar-placeholder.d.ts +1 -3
- package/dist/logics/avatar-placeholder/should-show-avatar-placeholder.js +1 -2
- package/dist/logics/avatar-placeholder/should-show-avatar-placeholder.js.map +1 -1
- package/dist/logics/bool/to-bool.d.ts +0 -2
- package/dist/logics/bool/to-bool.js +1 -2
- package/dist/logics/bool/to-strbool.d.ts +0 -2
- package/dist/logics/bool/to-strbool.js +1 -2
- package/dist/logics/cc/cc-all.d.ts +1 -3
- package/dist/logics/cc/cc-all.js +1 -2
- package/dist/logics/cc/cc-all.js.map +1 -1
- package/dist/logics/cc/cc.d.ts +1 -3
- package/dist/logics/cc/cc.js +1 -2
- package/dist/logics/cc/cc.js.map +1 -1
- package/dist/logics/checkbox-control/checkbox-control.d.ts +4 -6
- package/dist/logics/checkbox-control/checkbox-control.js +2 -3
- package/dist/logics/checkbox-control/checkbox-control.js.map +1 -1
- package/dist/logics/dialog-control/dialog-control.d.ts +4 -6
- package/dist/logics/dialog-control/dialog-control.js +1 -2
- package/dist/logics/dialog-control/dialog-control.js.map +1 -1
- package/dist/logics/input-control/input-control.d.ts +2 -4
- package/dist/logics/input-control/input-control.js +1 -2
- package/dist/logics/input-control/input-control.js.map +1 -1
- package/dist/logics/label-marker/label-marker.d.ts +1 -3
- package/dist/logics/label-marker/label-marker.js +1 -2
- package/dist/logics/label-marker/label-marker.js.map +1 -1
- package/dist/logics/menu-control/menu-control.d.ts +4 -6
- package/dist/logics/menu-control/menu-control.js +1 -2
- package/dist/logics/menu-control/menu-control.js.map +1 -1
- package/dist/logics/ms/ms-all.d.ts +2 -3
- package/dist/logics/ms/ms-all.js +1 -2
- package/dist/logics/ms/ms-all.js.map +1 -1
- package/dist/logics/popover-control/popover-control.d.ts +2 -4
- package/dist/logics/popover-control/popover-control.js +1 -2
- package/dist/logics/popover-control/popover-control.js.map +1 -1
- package/dist/logics/progress-control/progress-control.d.ts +3 -5
- package/dist/logics/progress-control/progress-control.js +1 -2
- package/dist/logics/progress-control/progress-control.js.map +1 -1
- package/dist/logics/radio-control/radio-control.d.ts +3 -5
- package/dist/logics/radio-control/radio-control.js +1 -2
- package/dist/logics/radio-control/radio-control.js.map +1 -1
- package/dist/logics/radiogroup-control/radiogroup-control.d.ts +2 -4
- package/dist/logics/radiogroup-control/radiogroup-control.js +1 -2
- package/dist/logics/radiogroup-control/radiogroup-control.js.map +1 -1
- package/dist/logics/segmented-control/segmented-control.d.ts +1 -3
- package/dist/logics/segmented-control/segmented-control.js +1 -2
- package/dist/logics/segmented-control/segmented-control.js.map +1 -1
- package/dist/logics/tabs-control/tabs-control.d.ts +4 -6
- package/dist/logics/tabs-control/tabs-control.js +1 -2
- package/dist/logics/tabs-control/tabs-control.js.map +1 -1
- package/dist/logics/tabs-control/tabs-keymap.js +1 -2
- package/dist/logics/tabs-control/tabs-keymap.js.map +1 -1
- package/dist/logics/tooltip-control/tooltip-control.d.ts +2 -4
- package/dist/logics/tooltip-control/tooltip-control.js +1 -2
- package/dist/logics/tooltip-control/tooltip-control.js.map +1 -1
- package/dist/recipes/alert/alert.d.ts +2 -4
- package/dist/recipes/alert/alert.js +5 -4
- package/dist/recipes/alert/alert.js.map +1 -1
- package/dist/recipes/anchor/anchor.d.ts +0 -2
- package/dist/recipes/anchor/anchor.js +1 -2
- package/dist/recipes/avatar/avatar.d.ts +0 -2
- package/dist/recipes/avatar/avatar.js +1 -2
- package/dist/recipes/blockquote/blockquote.d.ts +0 -2
- package/dist/recipes/blockquote/blockquote.js +4 -3
- package/dist/recipes/blockquote/blockquote.js.map +1 -1
- package/dist/recipes/button/button.d.ts +6 -4
- package/dist/recipes/button/button.js +9 -5
- package/dist/recipes/button/button.js.map +1 -1
- package/dist/recipes/checkbox/checkbox.d.ts +2 -24
- package/dist/recipes/checkbox/checkbox.js +14 -20
- package/dist/recipes/checkbox/checkbox.js.map +1 -1
- package/dist/recipes/code/code.d.ts +0 -2
- package/dist/recipes/code/code.js +1 -2
- package/dist/recipes/container/container.d.ts +0 -2
- package/dist/recipes/container/container.js +1 -2
- package/dist/recipes/details/details.d.ts +3 -5
- package/dist/recipes/details/details.js +10 -6
- package/dist/recipes/details/details.js.map +1 -1
- package/dist/recipes/dialog/dialog.d.ts +3 -3
- package/dist/recipes/dialog/dialog.js +6 -3
- package/dist/recipes/dialog/dialog.js.map +1 -1
- package/dist/recipes/dl/dl.d.ts +0 -2
- package/dist/recipes/dl/dl.js +9 -5
- package/dist/recipes/dl/dl.js.map +1 -1
- package/dist/recipes/drawer/drawer.d.ts +0 -2
- package/dist/recipes/drawer/drawer.js +1 -2
- package/dist/recipes/fieldset/fieldset.d.ts +0 -2
- package/dist/recipes/fieldset/fieldset.js +4 -3
- package/dist/recipes/fieldset/fieldset.js.map +1 -1
- package/dist/recipes/focus-ring/focus-ring.d.ts +0 -2
- package/dist/recipes/focus-ring/focus-ring.js +1 -2
- package/dist/recipes/heading/heading.d.ts +0 -2
- package/dist/recipes/heading/heading.js +1 -2
- package/dist/recipes/hr/hr.d.ts +0 -2
- package/dist/recipes/hr/hr.js +4 -3
- package/dist/recipes/hr/hr.js.map +1 -1
- package/dist/recipes/input/input.d.ts +3 -5
- package/dist/recipes/input/input.js +8 -7
- package/dist/recipes/input/input.js.map +1 -1
- package/dist/recipes/label/label.d.ts +0 -2
- package/dist/recipes/label/label.js +1 -2
- package/dist/recipes/menu/menu.d.ts +0 -2
- package/dist/recipes/menu/menu.js +1 -2
- package/dist/recipes/paragraph/paragraph.d.ts +13 -2
- package/dist/recipes/paragraph/paragraph.js +32 -23
- package/dist/recipes/paragraph/paragraph.js.map +1 -1
- package/dist/recipes/popover/popover.d.ts +0 -2
- package/dist/recipes/popover/popover.js +4 -3
- package/dist/recipes/popover/popover.js.map +1 -1
- package/dist/recipes/progress/progress.d.ts +0 -2
- package/dist/recipes/progress/progress.js +1 -2
- package/dist/recipes/radio/radio.d.ts +3 -5
- package/dist/recipes/radio/radio.js +7 -6
- package/dist/recipes/radio/radio.js.map +1 -1
- package/dist/recipes/radiogroup/radiogroup.d.ts +0 -2
- package/dist/recipes/radiogroup/radiogroup.js +1 -2
- package/dist/recipes/section/section.d.ts +3 -3
- package/dist/recipes/section/section.js +6 -3
- package/dist/recipes/section/section.js.map +1 -1
- package/dist/recipes/segmented-control/segmented-control.d.ts +0 -2
- package/dist/recipes/segmented-control/segmented-control.js +5 -3
- package/dist/recipes/segmented-control/segmented-control.js.map +1 -1
- package/dist/recipes/select/select.d.ts +2 -4
- package/dist/recipes/select/select.js +8 -7
- package/dist/recipes/select/select.js.map +1 -1
- package/dist/recipes/skip-link/skip-link.d.ts +6 -0
- package/dist/recipes/skip-link/skip-link.js +9 -0
- package/dist/recipes/skip-link/skip-link.js.map +1 -0
- package/dist/recipes/table/table.d.ts +6 -6
- package/dist/recipes/table/table.js +18 -7
- package/dist/recipes/table/table.js.map +1 -1
- package/dist/recipes/tabs/tabs.d.ts +0 -2
- package/dist/recipes/tabs/tabs.js +4 -3
- package/dist/recipes/tabs/tabs.js.map +1 -1
- package/dist/recipes/text/text.d.ts +53 -0
- package/dist/recipes/text/text.js +42 -0
- package/dist/recipes/text/text.js.map +1 -0
- package/dist/recipes/visually-hidden/visually-hidden.d.ts +0 -2
- package/dist/recipes/visually-hidden/visually-hidden.js +1 -2
- package/dist/style.css +1 -1
- package/dist/styles/css-vars.d.ts +0 -2
- package/dist/styles/css-vars.js +1 -2
- package/dist/styles/make-recipe-type.d.ts +0 -2
- package/dist/styles/make-recipe.d.ts +1 -3
- package/dist/styles/make-recipe.js +3 -4
- package/dist/styles/make-recipe.js.map +1 -1
- package/dist/styles/primitive-css/active.module.js +1 -2
- package/dist/styles/primitive-css/base.module.js +2 -2
- package/dist/styles/primitive-css/base.module.js.map +1 -1
- package/dist/styles/primitive-css/checked.module.js +5 -4
- package/dist/styles/primitive-css/checked.module.js.map +1 -1
- package/dist/styles/primitive-css/composite.module.js +1 -2
- package/dist/styles/primitive-css/disabled.module.js +1 -2
- package/dist/styles/primitive-css/focus.module.js +3 -4
- package/dist/styles/primitive-css/focus.module.js.map +1 -1
- package/dist/styles/primitive-css/hover.module.js +3 -3
- package/dist/styles/primitive-css/hover.module.js.map +1 -1
- package/dist/styles/primitive-css/icon.module.js +2 -4
- package/dist/styles/primitive-css/icon.module.js.map +1 -1
- package/dist/styles/primitive-css/misc.module.js +3 -3
- package/dist/styles/primitive-css/misc.module.js.map +1 -1
- package/dist/styles/primitive-css/neutral.module.js +22 -14
- package/dist/styles/primitive-css/neutral.module.js.map +1 -1
- package/dist/styles/primitive-css/pseudo-element.module.js +1 -2
- package/dist/styles/primitive.gen.d.ts +56 -21
- package/dist/styles/primitive.gen.js +47 -23
- package/dist/styles/primitive.gen.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -33,8 +33,10 @@ import { RadiogroupSlots, RadiogroupVariants, radiogroupRecipe } from "./recipes
|
|
|
33
33
|
import { SectionSlots, SectionVariants, sectionRecipe } from "./recipes/section/section.js";
|
|
34
34
|
import { SegmentedControlItemSlots, SegmentedControlItemVariants, SegmentedControlRootSlots, SegmentedControlRootVariants, segmentedControlItemRecipe, segmentedControlRootRecipe } from "./recipes/segmented-control/segmented-control.js";
|
|
35
35
|
import { SelectSlots, SelectVariants, selectRecipe } from "./recipes/select/select.js";
|
|
36
|
+
import { SkipLinkSlots, SkipLinkVariants, skipLinkRecipe } from "./recipes/skip-link/skip-link.js";
|
|
36
37
|
import { CaptionSlots, CaptionVariants, TableSlots, TableVariants, TdSlots, TdVariants, ThSlots, ThVariants, TrSlots, TrVariants, captionRecipe, tableRecipe, tdRecipe, thRecipe, trRecipe } from "./recipes/table/table.js";
|
|
37
38
|
import { TabSlots, TabVariants, TablistSlots, TablistVariants, TabpanelSlots, TabpanelVariants, TabrootSlots, TabrootVariants, tabRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe } from "./recipes/tabs/tabs.js";
|
|
39
|
+
import { TextSlots, TextVariants, textRecipe } from "./recipes/text/text.js";
|
|
38
40
|
import { VisuallyHiddenSlots, VisuallyHiddenVariants, visuallyHiddenRecipe } from "./recipes/visually-hidden/visually-hidden.js";
|
|
39
41
|
import { InputControlAttributes, InputControlState, InputLabelAttributes, InputState, inputControl } from "./logics/input-control/input-control.js";
|
|
40
42
|
import { DEFAULT_LABEL_MAKER, LabelMarker, LabelMarkerData, LabelMarkerNodeData, LabelMarkerNullData, labelMarker } from "./logics/label-marker/label-marker.js";
|
|
@@ -48,4 +50,4 @@ import { SegmentedControlItemAttributes, SegmentedControlItemState, segmentedCon
|
|
|
48
50
|
import { TabsListAttributeOptions, TabsListAttributes, TabsPanelAttributes, TabsRootAttributes, TabsState, TabsTabAttributeOptions, TabsTabAttributes, tabsControl } from "./logics/tabs-control/tabs-control.js";
|
|
49
51
|
import { TooltipContentAttributes, TooltipState, TooltipTriggerAttributeOptions, TooltipTriggerAttributes, tooltipControl, triggerId } from "./logics/tooltip-control/tooltip-control.js";
|
|
50
52
|
import { CSS_VARS } from "./styles/css-vars.js";
|
|
51
|
-
export { AlertSlots, AlertVariants, AnchorSlots, AnchorVariants, AvatarSlots, AvatarSource, AvatarVariants, BlockquoteSlots, BlockquoteVariants, ButtonSlots, ButtonVariants, CSS_VARS, CaptionSlots, CaptionVariants, CheckboxControlAttributes, CheckboxErrorAttributes, CheckboxLabelAttributes, CheckboxSlots, CheckboxState, CheckboxVariants, CodeSlots, CodeVariants, ContainerSlots, ContainerVariants, DEFAULT_LABEL_MAKER, DdSlots, DdVariants, DetailsSlots, DetailsVariants, DialogCloseAttributes, DialogContentAttributeOptions, DialogContentAttributes, DialogHeadingAttributes, DialogSlots, DialogState, DialogTriggerAttributeOptions, DialogTriggerAttributes, DialogVariants, DlSlots, DlVariants, DrawerSlots, DrawerVariants, DtSlots, DtVariants, FieldsetSlots, FieldsetVariants, FocusRingSlots, FocusRingVariants, HeadingSlots, HeadingVariants, HrSlots, HrVariants, InputControlAttributes, InputControlState, InputLabelAttributes, InputSlots, InputState, InputVariants, LabelMarker, LabelMarkerData, LabelMarkerNodeData, LabelMarkerNullData, LabelSlots, LabelVariants, MenuContentAttributeOptions, MenuContentAttributes, MenuItemActivation, MenuItemActivationOptions, MenuItemAttributeOptions, MenuItemAttributes, MenuState, MenuTriggerAttributeOptions, MenuTriggerAttributes, MenuitemSlots, MenuitemVariants, ParagraphSlots, ParagraphVariants, PopoverContentAttributes, PopoverSlots, PopoverState, PopoverTriggerAttributeOptions, PopoverTriggerAttributes, PopoverVariants, ProgressBarAttributes, ProgressLabelAttributes, ProgressResolveOptions, ProgressSlots, ProgressState, ProgressValueAttributes, ProgressVariants, RadioControlAttributes, RadioErrorAttributes, RadioLabelAttributes, RadioSlots, RadioState, RadioVariants, RadiogroupLabelAttributes, RadiogroupRootAttributes, RadiogroupSlots, RadiogroupState, RadiogroupVariants, SectionSlots, SectionVariants, SegmentedControlItemAttributes, SegmentedControlItemSlots, SegmentedControlItemState, SegmentedControlItemVariants, SegmentedControlRootSlots, SegmentedControlRootVariants, SelectSlots, SelectVariants, Strbool, TabSlots, TabVariants, TableSlots, TableVariants, TablistSlots, TablistVariants, TabpanelSlots, TabpanelVariants, TabrootSlots, TabrootVariants, TabsListAttributeOptions, TabsListAttributes, TabsPanelAttributes, TabsRootAttributes, TabsState, TabsTabAttributeOptions, TabsTabAttributes, TdSlots, TdVariants, ThSlots, ThVariants, TooltipContentAttributes, TooltipState, TooltipTriggerAttributeOptions, TooltipTriggerAttributes, TrSlots, TrVariants, VisuallyHiddenSlots, VisuallyHiddenVariants, alertRecipe, anchorRecipe, avatartRecipe, blockquoteRecipe, buttonRecipe, captionRecipe, cc, ccAll, checkboxControl, checkboxRecipe, codeRecipe, containerRecipe, ddRecipe, detailsRecipe, dialogControl, dialogRecipe, dlRecipe, drawerRecipe, dtRecipe, fieldsetRecipe, focusRingRecipe, getAvatarPlaceholder, headingRecipe, hrRecipe, inputControl, inputRecipe, labelMarker, labelRecipe, menuControl, menuitemRecipe, msAll, paragraphRecipe, popoverControl, popoverRecipe, progressControl, progressRecipe, radioControl, radioRecipe, radiogroupControl, radiogroupRecipe, sectionRecipe, segmentedControl, segmentedControlItemRecipe, segmentedControlRootRecipe, selectRecipe, shouldShowAvatarPlaceholder, tabRecipe, tableRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe, tabsControl, tdRecipe, thRecipe, toBool, toStrbool, tooltipControl, trRecipe, triggerId, visuallyHiddenRecipe };
|
|
53
|
+
export { AlertSlots, AlertVariants, AnchorSlots, AnchorVariants, AvatarSlots, AvatarSource, AvatarVariants, BlockquoteSlots, BlockquoteVariants, ButtonSlots, ButtonVariants, CSS_VARS, CaptionSlots, CaptionVariants, CheckboxControlAttributes, CheckboxErrorAttributes, CheckboxLabelAttributes, CheckboxSlots, CheckboxState, CheckboxVariants, CodeSlots, CodeVariants, ContainerSlots, ContainerVariants, DEFAULT_LABEL_MAKER, DdSlots, DdVariants, DetailsSlots, DetailsVariants, DialogCloseAttributes, DialogContentAttributeOptions, DialogContentAttributes, DialogHeadingAttributes, DialogSlots, DialogState, DialogTriggerAttributeOptions, DialogTriggerAttributes, DialogVariants, DlSlots, DlVariants, DrawerSlots, DrawerVariants, DtSlots, DtVariants, FieldsetSlots, FieldsetVariants, FocusRingSlots, FocusRingVariants, HeadingSlots, HeadingVariants, HrSlots, HrVariants, InputControlAttributes, InputControlState, InputLabelAttributes, InputSlots, InputState, InputVariants, LabelMarker, LabelMarkerData, LabelMarkerNodeData, LabelMarkerNullData, LabelSlots, LabelVariants, MenuContentAttributeOptions, MenuContentAttributes, MenuItemActivation, MenuItemActivationOptions, MenuItemAttributeOptions, MenuItemAttributes, MenuState, MenuTriggerAttributeOptions, MenuTriggerAttributes, MenuitemSlots, MenuitemVariants, ParagraphSlots, ParagraphVariants, PopoverContentAttributes, PopoverSlots, PopoverState, PopoverTriggerAttributeOptions, PopoverTriggerAttributes, PopoverVariants, ProgressBarAttributes, ProgressLabelAttributes, ProgressResolveOptions, ProgressSlots, ProgressState, ProgressValueAttributes, ProgressVariants, RadioControlAttributes, RadioErrorAttributes, RadioLabelAttributes, RadioSlots, RadioState, RadioVariants, RadiogroupLabelAttributes, RadiogroupRootAttributes, RadiogroupSlots, RadiogroupState, RadiogroupVariants, SectionSlots, SectionVariants, SegmentedControlItemAttributes, SegmentedControlItemSlots, SegmentedControlItemState, SegmentedControlItemVariants, SegmentedControlRootSlots, SegmentedControlRootVariants, SelectSlots, SelectVariants, SkipLinkSlots, SkipLinkVariants, Strbool, TabSlots, TabVariants, TableSlots, TableVariants, TablistSlots, TablistVariants, TabpanelSlots, TabpanelVariants, TabrootSlots, TabrootVariants, TabsListAttributeOptions, TabsListAttributes, TabsPanelAttributes, TabsRootAttributes, TabsState, TabsTabAttributeOptions, TabsTabAttributes, TdSlots, TdVariants, TextSlots, TextVariants, ThSlots, ThVariants, TooltipContentAttributes, TooltipState, TooltipTriggerAttributeOptions, TooltipTriggerAttributes, TrSlots, TrVariants, VisuallyHiddenSlots, VisuallyHiddenVariants, alertRecipe, anchorRecipe, avatartRecipe, blockquoteRecipe, buttonRecipe, captionRecipe, cc, ccAll, checkboxControl, checkboxRecipe, codeRecipe, containerRecipe, ddRecipe, detailsRecipe, dialogControl, dialogRecipe, dlRecipe, drawerRecipe, dtRecipe, fieldsetRecipe, focusRingRecipe, getAvatarPlaceholder, headingRecipe, hrRecipe, inputControl, inputRecipe, labelMarker, labelRecipe, menuControl, menuitemRecipe, msAll, paragraphRecipe, popoverControl, popoverRecipe, progressControl, progressRecipe, radioControl, radioRecipe, radiogroupControl, radiogroupRecipe, sectionRecipe, segmentedControl, segmentedControlItemRecipe, segmentedControlRootRecipe, selectRecipe, shouldShowAvatarPlaceholder, skipLinkRecipe, tabRecipe, tableRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe, tabsControl, tdRecipe, textRecipe, thRecipe, toBool, toStrbool, tooltipControl, trRecipe, triggerId, visuallyHiddenRecipe };
|
package/dist/index.js
CHANGED
|
@@ -44,8 +44,10 @@ import { radiogroupRecipe } from "./recipes/radiogroup/radiogroup.js";
|
|
|
44
44
|
import { sectionRecipe } from "./recipes/section/section.js";
|
|
45
45
|
import { segmentedControlItemRecipe, segmentedControlRootRecipe } from "./recipes/segmented-control/segmented-control.js";
|
|
46
46
|
import { selectRecipe } from "./recipes/select/select.js";
|
|
47
|
+
import { skipLinkRecipe } from "./recipes/skip-link/skip-link.js";
|
|
47
48
|
import { captionRecipe, tableRecipe, tdRecipe, thRecipe, trRecipe } from "./recipes/table/table.js";
|
|
48
49
|
import { tabRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe } from "./recipes/tabs/tabs.js";
|
|
50
|
+
import { textRecipe } from "./recipes/text/text.js";
|
|
49
51
|
import { visuallyHiddenRecipe } from "./recipes/visually-hidden/visually-hidden.js";
|
|
50
52
|
import { CSS_VARS } from "./styles/css-vars.js";
|
|
51
|
-
export { CSS_VARS, DEFAULT_LABEL_MAKER, alertRecipe, anchorRecipe, avatartRecipe, blockquoteRecipe, buttonRecipe, captionRecipe, cc, ccAll, checkboxControl, checkboxRecipe, codeRecipe, containerRecipe, ddRecipe, detailsRecipe, dialogControl, dialogRecipe, dlRecipe, drawerRecipe, dtRecipe, fieldsetRecipe, focusRingRecipe, getAvatarPlaceholder, headingRecipe, hrRecipe, inputControl, inputRecipe, labelMarker, labelRecipe, menuControl, menuitemRecipe, msAll, paragraphRecipe, popoverControl, popoverRecipe, progressControl, progressRecipe, radioControl, radioRecipe, radiogroupControl, radiogroupRecipe, sectionRecipe, segmentedControl, segmentedControlItemRecipe, segmentedControlRootRecipe, selectRecipe, shouldShowAvatarPlaceholder, tabRecipe, tableRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe, tabsControl, tdRecipe, thRecipe, toBool, toStrbool, tooltipControl, trRecipe, triggerId, visuallyHiddenRecipe };
|
|
53
|
+
export { CSS_VARS, DEFAULT_LABEL_MAKER, alertRecipe, anchorRecipe, avatartRecipe, blockquoteRecipe, buttonRecipe, captionRecipe, cc, ccAll, checkboxControl, checkboxRecipe, codeRecipe, containerRecipe, ddRecipe, detailsRecipe, dialogControl, dialogRecipe, dlRecipe, drawerRecipe, dtRecipe, fieldsetRecipe, focusRingRecipe, getAvatarPlaceholder, headingRecipe, hrRecipe, inputControl, inputRecipe, labelMarker, labelRecipe, menuControl, menuitemRecipe, msAll, paragraphRecipe, popoverControl, popoverRecipe, progressControl, progressRecipe, radioControl, radioRecipe, radiogroupControl, radiogroupRecipe, sectionRecipe, segmentedControl, segmentedControlItemRecipe, segmentedControlRootRecipe, selectRecipe, shouldShowAvatarPlaceholder, skipLinkRecipe, tabRecipe, tableRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe, tabsControl, tdRecipe, textRecipe, thRecipe, toBool, toStrbool, tooltipControl, trRecipe, triggerId, visuallyHiddenRecipe };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// src/logics/avatar-placeholder/get-avatar-placeholder.ts
|
|
2
2
|
function getAvatarPlaceholder(name) {
|
|
3
3
|
const normalizedName = name.trim();
|
|
4
4
|
if (/[^\p{ASCII}]/u.test(normalizedName)) return Array.from(normalizedName)[0] ?? "";
|
|
5
5
|
return normalizedName.split(/\s+/).map((word) => word[0]?.toUpperCase()).join("").slice(0, 2);
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { getAvatarPlaceholder };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=get-avatar-placeholder.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/logics/avatar-placeholder/should-show-avatar-placeholder.d.ts
|
|
2
1
|
export interface AvatarSource<Value = string> {
|
|
3
2
|
src?: Value | undefined;
|
|
4
3
|
srcSet?: Value | undefined;
|
|
@@ -6,7 +5,6 @@ export interface AvatarSource<Value = string> {
|
|
|
6
5
|
interface AvatarPlaceholderOptions<Value = string> extends AvatarSource<Value> {
|
|
7
6
|
failedSource: AvatarSource<Value> | null;
|
|
8
7
|
}
|
|
9
|
-
export declare function shouldShowAvatarPlaceholder<Value = string>({ src, srcSet, failedSource }: AvatarPlaceholderOptions<Value
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare function shouldShowAvatarPlaceholder<Value = string>({ src, srcSet, failedSource }: Readonly<AvatarPlaceholderOptions<Value>>): boolean;
|
|
11
9
|
export {};
|
|
12
10
|
//# sourceMappingURL=should-show-avatar-placeholder.d.ts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/logics/avatar-placeholder/should-show-avatar-placeholder.ts
|
|
2
2
|
function shouldShowAvatarPlaceholder({ src, srcSet, failedSource }) {
|
|
3
3
|
return !src && !srcSet || failedSource !== null && failedSource.src === src && failedSource.srcSet === srcSet;
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
export { shouldShowAvatarPlaceholder };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=should-show-avatar-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-show-avatar-placeholder.js","names":[],"sources":["../../../src/logics/avatar-placeholder/should-show-avatar-placeholder.ts"],"sourcesContent":["export interface AvatarSource<Value = string> {\n src?: Value | undefined;\n srcSet?: Value | undefined;\n}\n\ninterface AvatarPlaceholderOptions<Value = string> extends AvatarSource<Value> {\n failedSource: AvatarSource<Value> | null;\n}\n\nexport function shouldShowAvatarPlaceholder<Value = string>(\n { src, srcSet, failedSource }: AvatarPlaceholderOptions<Value
|
|
1
|
+
{"version":3,"file":"should-show-avatar-placeholder.js","names":[],"sources":["../../../src/logics/avatar-placeholder/should-show-avatar-placeholder.ts"],"sourcesContent":["export interface AvatarSource<Value = string> {\n src?: Value | undefined;\n srcSet?: Value | undefined;\n}\n\ninterface AvatarPlaceholderOptions<Value = string> extends AvatarSource<Value> {\n failedSource: AvatarSource<Value> | null;\n}\n\nexport function shouldShowAvatarPlaceholder<Value = string>(\n { src, srcSet, failedSource }: Readonly<AvatarPlaceholderOptions<Value>>,\n): boolean {\n return (!src && !srcSet)\n || (failedSource !== null && failedSource.src === src && failedSource.srcSet === srcSet);\n}\n"],"mappings":";AASA,SAAgB,4BACd,EAAE,KAAK,QAAQ,gBACN;CACT,OAAQ,CAAC,OAAO,CAAC,UACX,iBAAiB,QAAQ,aAAa,QAAQ,OAAO,aAAa,WAAW;AACrF"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/logics/bool/to-bool.ts
|
|
2
2
|
function toBool(value) {
|
|
3
3
|
if (value == null || value === void 0) return false;
|
|
4
4
|
return value !== false && value !== "false";
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
export { toBool };
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=to-bool.js.map
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//#region src/logics/cc/cc-all.d.ts
|
|
2
1
|
type SlotClassNames<S extends string> = Partial<Record<S, string | undefined>>;
|
|
3
2
|
/** Apply cc() to every slot of a recipe result, merging optional user overrides. Lovery C.C. **/
|
|
4
|
-
export declare function ccAll<S extends string>(recipe: Record<S, string
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function ccAll<S extends string>(recipe: Readonly<Record<S, string>>, ...overrides: readonly Readonly<SlotClassNames<S>>[]): Record<S, string>;
|
|
6
4
|
export {};
|
|
7
5
|
//# sourceMappingURL=cc-all.d.ts.map
|
package/dist/logics/cc/cc-all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cc } from "./cc.js";
|
|
2
|
-
|
|
2
|
+
// src/logics/cc/cc-all.ts
|
|
3
3
|
/** Apply cc() to every slot of a recipe result, merging optional user overrides. Lovery C.C. **/
|
|
4
4
|
function ccAll(recipe, ...overrides) {
|
|
5
5
|
const result = {};
|
|
@@ -9,7 +9,6 @@ function ccAll(recipe, ...overrides) {
|
|
|
9
9
|
}
|
|
10
10
|
return result;
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { ccAll };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=cc-all.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cc-all.js","names":[],"sources":["../../../src/logics/cc/cc-all.ts"],"sourcesContent":["import { cc } from \"./cc\";\n\ntype SlotClassNames<S extends string> = Partial<Record<S, string | undefined>>;\n\n/** Apply cc() to every slot of a recipe result, merging optional user overrides. Lovery C.C. **/\nexport function ccAll<S extends string>(\n recipe: Record<S, string
|
|
1
|
+
{"version":3,"file":"cc-all.js","names":[],"sources":["../../../src/logics/cc/cc-all.ts"],"sourcesContent":["import { cc } from \"./cc\";\n\ntype SlotClassNames<S extends string> = Partial<Record<S, string | undefined>>;\n\n/** Apply cc() to every slot of a recipe result, merging optional user overrides. Lovery C.C. **/\nexport function ccAll<S extends string>(\n recipe: Readonly<Record<S, string>>,\n ...overrides: readonly Readonly<SlotClassNames<S>>[]\n): Record<S, string> {\n const result = {} as Record<S, string>;\n for (const key in recipe) {\n const targets = overrides.map((o) => o?.[key]);\n result[key] = cc(recipe[key], ...targets);\n }\n return result;\n}\n"],"mappings":";;;AAKA,SAAgB,MACd,QACA,GAAG,WACgB;CACnB,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,OAAO,QAAQ;EACxB,MAAM,UAAU,UAAU,KAAK,MAAM,IAAI,IAAI;EAC7C,OAAO,OAAO,GAAG,OAAO,MAAM,GAAG,OAAO;CAC1C;CACA,OAAO;AACT"}
|
package/dist/logics/cc/cc.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//#region src/logics/cc/cc.d.ts
|
|
2
1
|
type ClassNameLike = string | null | undefined;
|
|
3
2
|
/** Concat ClassNames. Lovely C.C. **/
|
|
4
|
-
export declare function cc(...classNames: ClassNameLike[]): string;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function cc(...classNames: readonly ClassNameLike[]): string;
|
|
6
4
|
export {};
|
|
7
5
|
//# sourceMappingURL=cc.d.ts.map
|
package/dist/logics/cc/cc.js
CHANGED
package/dist/logics/cc/cc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cc.js","names":[],"sources":["../../../src/logics/cc/cc.ts"],"sourcesContent":["type ClassNameLike = string | null | undefined;\n\n/** Concat ClassNames. Lovely C.C. **/\nexport function cc(...classNames: ClassNameLike[]): string {\n return classNames\n .filter(Boolean)\n .join(\" \");\n}\n"],"mappings":";;AAGA,SAAgB,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"cc.js","names":[],"sources":["../../../src/logics/cc/cc.ts"],"sourcesContent":["type ClassNameLike = string | null | undefined;\n\n/** Concat ClassNames. Lovely C.C. **/\nexport function cc(...classNames: readonly ClassNameLike[]): string {\n return classNames\n .filter(Boolean)\n .join(\" \");\n}\n"],"mappings":";;AAGA,SAAgB,GAAG,GAAG,YAA8C;CAClE,OAAO,WACJ,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;AACb"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Strbool } from "../bool/to-strbool.js";
|
|
2
|
-
//#region src/logics/checkbox-control/checkbox-control.d.ts
|
|
3
2
|
export interface CheckboxState {
|
|
4
3
|
id: string;
|
|
5
4
|
invalid: boolean;
|
|
@@ -11,23 +10,22 @@ export interface CheckboxControlAttributes {
|
|
|
11
10
|
id: string;
|
|
12
11
|
"aria-invalid": boolean;
|
|
13
12
|
"aria-describedby": string | undefined;
|
|
14
|
-
"
|
|
13
|
+
"data-indeterminate": Strbool;
|
|
15
14
|
}
|
|
16
|
-
declare function getControlAttributes(state: CheckboxState): CheckboxControlAttributes;
|
|
15
|
+
declare function getControlAttributes(state: Readonly<CheckboxState>): CheckboxControlAttributes;
|
|
17
16
|
export interface CheckboxLabelAttributes {
|
|
18
17
|
for: string;
|
|
19
18
|
"data-disabled": Strbool;
|
|
20
19
|
}
|
|
21
|
-
declare function getLabelAttributes(state: CheckboxState): CheckboxLabelAttributes;
|
|
20
|
+
declare function getLabelAttributes(state: Readonly<CheckboxState>): CheckboxLabelAttributes;
|
|
22
21
|
export interface CheckboxErrorAttributes {
|
|
23
22
|
id: string;
|
|
24
23
|
}
|
|
25
|
-
declare function getErrorAttributes(state: CheckboxState): CheckboxErrorAttributes;
|
|
24
|
+
declare function getErrorAttributes(state: Readonly<CheckboxState>): CheckboxErrorAttributes;
|
|
26
25
|
export declare const checkboxControl: {
|
|
27
26
|
readonly getControlAttributes: typeof getControlAttributes;
|
|
28
27
|
readonly getLabelAttributes: typeof getLabelAttributes;
|
|
29
28
|
readonly getErrorAttributes: typeof getErrorAttributes;
|
|
30
29
|
};
|
|
31
|
-
//#endregion
|
|
32
30
|
export {};
|
|
33
31
|
//# sourceMappingURL=checkbox-control.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toStrbool } from "../bool/to-strbool.js";
|
|
2
2
|
import { inputControl } from "../input-control/input-control.js";
|
|
3
|
-
|
|
3
|
+
// src/logics/checkbox-control/checkbox-control.ts
|
|
4
4
|
function errorId(state) {
|
|
5
5
|
return `${state.id}-error`;
|
|
6
6
|
}
|
|
@@ -9,7 +9,7 @@ function getControlAttributes(state) {
|
|
|
9
9
|
type: "checkbox",
|
|
10
10
|
...inputControl.getControlAttributes(state),
|
|
11
11
|
"aria-describedby": state.invalid ? errorId(state) : void 0,
|
|
12
|
-
"
|
|
12
|
+
"data-indeterminate": toStrbool(state.indeterminate)
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
function getLabelAttributes(state) {
|
|
@@ -26,7 +26,6 @@ const checkboxControl = {
|
|
|
26
26
|
getLabelAttributes,
|
|
27
27
|
getErrorAttributes
|
|
28
28
|
};
|
|
29
|
-
//#endregion
|
|
30
29
|
export { checkboxControl };
|
|
31
30
|
|
|
32
31
|
//# sourceMappingURL=checkbox-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-control.js","names":[],"sources":["../../../src/logics/checkbox-control/checkbox-control.ts"],"sourcesContent":["import { type Strbool, toStrbool } from \"../bool\";\nimport { inputControl } from \"../input-control\";\n\nexport interface CheckboxState {\n id: string;\n invalid: boolean;\n indeterminate: boolean;\n disabled: boolean;\n}\n\nfunction errorId(state: CheckboxState): string {\n return `${state.id}-error`;\n}\n\nexport interface CheckboxControlAttributes {\n type: \"checkbox\";\n id: string;\n \"aria-invalid\": boolean;\n \"aria-describedby\": string | undefined;\n \"
|
|
1
|
+
{"version":3,"file":"checkbox-control.js","names":[],"sources":["../../../src/logics/checkbox-control/checkbox-control.ts"],"sourcesContent":["import { type Strbool, toStrbool } from \"../bool\";\nimport { inputControl } from \"../input-control\";\n\nexport interface CheckboxState {\n id: string;\n invalid: boolean;\n indeterminate: boolean;\n disabled: boolean;\n}\n\nfunction errorId(state: Readonly<CheckboxState>): string {\n return `${state.id}-error`;\n}\n\nexport interface CheckboxControlAttributes {\n type: \"checkbox\";\n id: string;\n \"aria-invalid\": boolean;\n \"aria-describedby\": string | undefined;\n \"data-indeterminate\": Strbool;\n}\n\nfunction getControlAttributes(state: Readonly<CheckboxState>): CheckboxControlAttributes {\n const inputAttributes = inputControl.getControlAttributes(state);\n\n return {\n type: \"checkbox\",\n ...inputAttributes,\n \"aria-describedby\": state.invalid ? errorId(state) : undefined,\n \"data-indeterminate\": toStrbool(state.indeterminate),\n };\n}\n\nexport interface CheckboxLabelAttributes {\n for: string;\n \"data-disabled\": Strbool;\n}\n\nfunction getLabelAttributes(state: Readonly<CheckboxState>): CheckboxLabelAttributes {\n return {\n for: state.id,\n \"data-disabled\": toStrbool(state.disabled),\n };\n}\n\nexport interface CheckboxErrorAttributes {\n id: string;\n}\n\nfunction getErrorAttributes(state: Readonly<CheckboxState>): CheckboxErrorAttributes {\n return {\n id: errorId(state),\n };\n}\n\nexport const checkboxControl = {\n getControlAttributes,\n getLabelAttributes,\n getErrorAttributes,\n} as const;\n"],"mappings":";;;AAUA,SAAS,QAAQ,OAAwC;CACvD,OAAO,GAAG,MAAM,GAAG;AACrB;AAUA,SAAS,qBAAqB,OAA2D;CAGvF,OAAO;EACL,MAAM;EACN,GAJsB,aAAa,qBAAqB,KAIvC;EACjB,oBAAoB,MAAM,UAAU,QAAQ,KAAK,IAAI,KAAA;EACrD,sBAAsB,UAAU,MAAM,aAAa;CACrD;AACF;AAOA,SAAS,mBAAmB,OAAyD;CACnF,OAAO;EACL,KAAK,MAAM;EACX,iBAAiB,UAAU,MAAM,QAAQ;CAC3C;AACF;AAMA,SAAS,mBAAmB,OAAyD;CACnF,OAAO,EACL,IAAI,QAAQ,KAAK,EACnB;AACF;AAEA,MAAa,kBAAkB;CAC7B;CACA;CACA;AACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/logics/dialog-control/dialog-control.d.ts
|
|
2
1
|
export interface DialogState {
|
|
3
2
|
id: string;
|
|
4
3
|
}
|
|
@@ -12,7 +11,7 @@ export interface DialogTriggerAttributes {
|
|
|
12
11
|
command: "show-modal" | undefined;
|
|
13
12
|
commandfor: string | undefined;
|
|
14
13
|
}
|
|
15
|
-
declare function getTriggerAttributes(state: DialogState
|
|
14
|
+
declare function getTriggerAttributes(state: Readonly<DialogState>, options: Readonly<DialogTriggerAttributeOptions>): DialogTriggerAttributes;
|
|
16
15
|
export interface DialogContentAttributeOptions {
|
|
17
16
|
hasHeading: boolean;
|
|
18
17
|
ariaLabel?: string | undefined;
|
|
@@ -23,17 +22,17 @@ export interface DialogContentAttributes {
|
|
|
23
22
|
"aria-label": string | undefined;
|
|
24
23
|
"aria-labelledby": string | undefined;
|
|
25
24
|
}
|
|
26
|
-
declare function getContentAttributes(state: DialogState
|
|
25
|
+
declare function getContentAttributes(state: Readonly<DialogState>, options: Readonly<DialogContentAttributeOptions>): DialogContentAttributes;
|
|
27
26
|
export interface DialogHeadingAttributes {
|
|
28
27
|
id: string;
|
|
29
28
|
}
|
|
30
|
-
declare function getHeadingAttributes(state: DialogState): DialogHeadingAttributes;
|
|
29
|
+
declare function getHeadingAttributes(state: Readonly<DialogState>): DialogHeadingAttributes;
|
|
31
30
|
export interface DialogCloseAttributes {
|
|
32
31
|
type: "button";
|
|
33
32
|
command: "request-close";
|
|
34
33
|
commandfor: string;
|
|
35
34
|
}
|
|
36
|
-
declare function getCloseAttributes(state: DialogState): DialogCloseAttributes;
|
|
35
|
+
declare function getCloseAttributes(state: Readonly<DialogState>): DialogCloseAttributes;
|
|
37
36
|
declare function openDialog(dialogId: string, modal: boolean): void;
|
|
38
37
|
export declare const dialogControl: {
|
|
39
38
|
readonly getTriggerAttributes: typeof getTriggerAttributes;
|
|
@@ -43,6 +42,5 @@ export declare const dialogControl: {
|
|
|
43
42
|
readonly openDialog: typeof openDialog;
|
|
44
43
|
readonly headingId: typeof headingId;
|
|
45
44
|
};
|
|
46
|
-
//#endregion
|
|
47
45
|
export {};
|
|
48
46
|
//# sourceMappingURL=dialog-control.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/logics/dialog-control/dialog-control.ts
|
|
2
2
|
function headingId(dialogId) {
|
|
3
3
|
return `${dialogId}-heading`;
|
|
4
4
|
}
|
|
@@ -45,7 +45,6 @@ const dialogControl = {
|
|
|
45
45
|
openDialog,
|
|
46
46
|
headingId
|
|
47
47
|
};
|
|
48
|
-
//#endregion
|
|
49
48
|
export { dialogControl };
|
|
50
49
|
|
|
51
50
|
//# sourceMappingURL=dialog-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-control.js","names":[],"sources":["../../../src/logics/dialog-control/dialog-control.ts"],"sourcesContent":["export interface DialogState {\n id: string;\n}\n\nfunction headingId(dialogId: string): string {\n return `${dialogId}-heading`;\n}\n\nexport interface DialogTriggerAttributeOptions {\n modal: boolean;\n isButtonElement: boolean;\n}\n\nexport interface DialogTriggerAttributes {\n type: \"button\" | undefined;\n command: \"show-modal\" | undefined;\n commandfor: string | undefined;\n}\n\nfunction getTriggerAttributes(\n state: DialogState
|
|
1
|
+
{"version":3,"file":"dialog-control.js","names":[],"sources":["../../../src/logics/dialog-control/dialog-control.ts"],"sourcesContent":["export interface DialogState {\n id: string;\n}\n\nfunction headingId(dialogId: string): string {\n return `${dialogId}-heading`;\n}\n\nexport interface DialogTriggerAttributeOptions {\n modal: boolean;\n isButtonElement: boolean;\n}\n\nexport interface DialogTriggerAttributes {\n type: \"button\" | undefined;\n command: \"show-modal\" | undefined;\n commandfor: string | undefined;\n}\n\nfunction getTriggerAttributes(\n state: Readonly<DialogState>,\n options: Readonly<DialogTriggerAttributeOptions>,\n): DialogTriggerAttributes {\n return {\n type: options.isButtonElement ? \"button\" : undefined,\n command: options.modal ? \"show-modal\" : undefined,\n commandfor: options.modal ? state.id : undefined,\n };\n}\n\nexport interface DialogContentAttributeOptions {\n hasHeading: boolean;\n ariaLabel?: string | undefined;\n ariaLabelledBy?: string | undefined;\n}\n\nexport interface DialogContentAttributes {\n id: string;\n \"aria-label\": string | undefined;\n \"aria-labelledby\": string | undefined;\n}\n\nfunction getContentAttributes(\n state: Readonly<DialogState>,\n options: Readonly<DialogContentAttributeOptions>,\n): DialogContentAttributes {\n return {\n id: state.id,\n \"aria-label\": options.ariaLabel,\n \"aria-labelledby\": options.ariaLabelledBy\n ?? (!options.ariaLabel && options.hasHeading ? headingId(state.id) : undefined),\n };\n}\n\nexport interface DialogHeadingAttributes {\n id: string;\n}\n\nfunction getHeadingAttributes(state: Readonly<DialogState>): DialogHeadingAttributes {\n return {\n id: headingId(state.id),\n };\n}\n\nexport interface DialogCloseAttributes {\n type: \"button\";\n command: \"request-close\";\n commandfor: string;\n}\n\nfunction getCloseAttributes(state: Readonly<DialogState>): DialogCloseAttributes {\n return {\n type: \"button\",\n command: \"request-close\",\n commandfor: state.id,\n };\n}\n\nfunction getDialogElement(dialogId: string): HTMLDialogElement {\n const element = document.getElementById(dialogId);\n if (!(element instanceof HTMLDialogElement)) {\n throw new Error(\"[Hebium UI|Dialog] Dialog element is not found\");\n }\n return element;\n}\n\nfunction openDialog(dialogId: string, modal: boolean): void {\n const element = getDialogElement(dialogId);\n if (element.open) return;\n\n if (modal) {\n element.showModal();\n } else {\n element.show();\n }\n}\n\nexport const dialogControl = {\n getTriggerAttributes,\n getContentAttributes,\n getHeadingAttributes,\n getCloseAttributes,\n openDialog,\n headingId,\n} as const;\n"],"mappings":";AAIA,SAAS,UAAU,UAA0B;CAC3C,OAAO,GAAG,SAAS;AACrB;AAaA,SAAS,qBACP,OACA,SACyB;CACzB,OAAO;EACL,MAAM,QAAQ,kBAAkB,WAAW,KAAA;EAC3C,SAAS,QAAQ,QAAQ,eAAe,KAAA;EACxC,YAAY,QAAQ,QAAQ,MAAM,KAAK,KAAA;CACzC;AACF;AAcA,SAAS,qBACP,OACA,SACyB;CACzB,OAAO;EACL,IAAI,MAAM;EACV,cAAc,QAAQ;EACtB,mBAAmB,QAAQ,mBACrB,CAAC,QAAQ,aAAa,QAAQ,aAAa,UAAU,MAAM,EAAE,IAAI,KAAA;CACzE;AACF;AAMA,SAAS,qBAAqB,OAAuD;CACnF,OAAO,EACL,IAAI,UAAU,MAAM,EAAE,EACxB;AACF;AAQA,SAAS,mBAAmB,OAAqD;CAC/E,OAAO;EACL,MAAM;EACN,SAAS;EACT,YAAY,MAAM;CACpB;AACF;AAEA,SAAS,iBAAiB,UAAqC;CAC7D,MAAM,UAAU,SAAS,eAAe,QAAQ;CAChD,IAAI,EAAE,mBAAmB,oBACvB,MAAM,IAAI,MAAM,gDAAgD;CAElE,OAAO;AACT;AAEA,SAAS,WAAW,UAAkB,OAAsB;CAC1D,MAAM,UAAU,iBAAiB,QAAQ;CACzC,IAAI,QAAQ,MAAM;CAElB,IAAI,OACF,QAAQ,UAAU;MAElB,QAAQ,KAAK;AAEjB;AAEA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LabelVariants } from "../../recipes/label/label.js";
|
|
2
|
-
//#region src/logics/input-control/input-control.d.ts
|
|
3
2
|
export interface InputControlState {
|
|
4
3
|
id: string;
|
|
5
4
|
invalid: boolean;
|
|
@@ -13,17 +12,16 @@ export interface InputControlAttributes {
|
|
|
13
12
|
id: string;
|
|
14
13
|
"aria-invalid": boolean;
|
|
15
14
|
}
|
|
16
|
-
declare function getControlAttributes(state: InputControlState): InputControlAttributes;
|
|
15
|
+
declare function getControlAttributes(state: Readonly<InputControlState>): InputControlAttributes;
|
|
17
16
|
export interface InputLabelAttributes {
|
|
18
17
|
for: string;
|
|
19
18
|
"data-required": boolean;
|
|
20
19
|
variant: LabelVariants["variant"] | undefined;
|
|
21
20
|
}
|
|
22
|
-
declare function getLabelAttributes(state: InputState): InputLabelAttributes;
|
|
21
|
+
declare function getLabelAttributes(state: Readonly<InputState>): InputLabelAttributes;
|
|
23
22
|
export declare const inputControl: {
|
|
24
23
|
readonly getControlAttributes: typeof getControlAttributes;
|
|
25
24
|
readonly getLabelAttributes: typeof getLabelAttributes;
|
|
26
25
|
};
|
|
27
|
-
//#endregion
|
|
28
26
|
export {};
|
|
29
27
|
//# sourceMappingURL=input-control.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/logics/input-control/input-control.ts
|
|
2
2
|
function getControlAttributes(state) {
|
|
3
3
|
return {
|
|
4
4
|
id: state.id,
|
|
@@ -16,7 +16,6 @@ const inputControl = {
|
|
|
16
16
|
getControlAttributes,
|
|
17
17
|
getLabelAttributes
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { inputControl };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=input-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-control.js","names":[],"sources":["../../../src/logics/input-control/input-control.ts"],"sourcesContent":["import { type LabelVariants } from \"~/recipes\";\n\nexport interface InputControlState {\n id: string;\n invalid: boolean;\n}\n\nexport interface InputState extends InputControlState {\n required: boolean;\n disabled: boolean;\n readOnly?: boolean | undefined;\n}\n\nexport interface InputControlAttributes {\n id: string;\n \"aria-invalid\": boolean;\n}\n\nfunction getControlAttributes(state: InputControlState): InputControlAttributes {\n return {\n id: state.id,\n \"aria-invalid\": state.invalid,\n };\n}\n\nexport interface InputLabelAttributes {\n for: string;\n \"data-required\": boolean;\n variant: LabelVariants[\"variant\"] | undefined;\n}\n\nfunction getLabelAttributes(state: InputState): InputLabelAttributes {\n return {\n for: state.id,\n \"data-required\": state.required,\n variant: state.disabled ? \"disabled\" : state.readOnly ? \"readonly\" : undefined,\n };\n}\n\nexport const inputControl = {\n getControlAttributes,\n getLabelAttributes,\n} as const;\n"],"mappings":";AAkBA,SAAS,qBAAqB,
|
|
1
|
+
{"version":3,"file":"input-control.js","names":[],"sources":["../../../src/logics/input-control/input-control.ts"],"sourcesContent":["import { type LabelVariants } from \"~/recipes\";\n\nexport interface InputControlState {\n id: string;\n invalid: boolean;\n}\n\nexport interface InputState extends InputControlState {\n required: boolean;\n disabled: boolean;\n readOnly?: boolean | undefined;\n}\n\nexport interface InputControlAttributes {\n id: string;\n \"aria-invalid\": boolean;\n}\n\nfunction getControlAttributes(state: Readonly<InputControlState>): InputControlAttributes {\n return {\n id: state.id,\n \"aria-invalid\": state.invalid,\n };\n}\n\nexport interface InputLabelAttributes {\n for: string;\n \"data-required\": boolean;\n variant: LabelVariants[\"variant\"] | undefined;\n}\n\nfunction getLabelAttributes(state: Readonly<InputState>): InputLabelAttributes {\n return {\n for: state.id,\n \"data-required\": state.required,\n variant: state.disabled ? \"disabled\" : state.readOnly ? \"readonly\" : undefined,\n };\n}\n\nexport const inputControl = {\n getControlAttributes,\n getLabelAttributes,\n} as const;\n"],"mappings":";AAkBA,SAAS,qBAAqB,OAA4D;CACxF,OAAO;EACL,IAAI,MAAM;EACV,gBAAgB,MAAM;CACxB;AACF;AAQA,SAAS,mBAAmB,OAAmD;CAC7E,OAAO;EACL,KAAK,MAAM;EACX,iBAAiB,MAAM;EACvB,SAAS,MAAM,WAAW,aAAa,MAAM,WAAW,aAAa,KAAA;CACvE;AACF;AAEA,MAAa,eAAe;CAC1B;CACA;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LabelVariants } from "../../recipes/label/label.js";
|
|
2
|
-
//#region src/logics/label-marker/label-marker.d.ts
|
|
3
2
|
interface BaseMarker<Node> {
|
|
4
3
|
label: Node;
|
|
5
4
|
"aria-label"?: string | undefined;
|
|
@@ -30,7 +29,6 @@ export declare const DEFAULT_LABEL_MAKER: {
|
|
|
30
29
|
readonly type: "required";
|
|
31
30
|
readonly label: "(required)";
|
|
32
31
|
};
|
|
33
|
-
export declare function labelMarker<Node>(marker: LabelMarker<Node
|
|
34
|
-
//#endregion
|
|
32
|
+
export declare function labelMarker<Node>(marker: Readonly<LabelMarker<Node>>, required: boolean | undefined): LabelMarkerData<Node>;
|
|
35
33
|
export {};
|
|
36
34
|
//# sourceMappingURL=label-marker.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/logics/label-marker/label-marker.ts
|
|
2
2
|
const DEFAULT_LABEL_MAKER = {
|
|
3
3
|
type: "required",
|
|
4
4
|
label: "(required)"
|
|
@@ -13,7 +13,6 @@ function labelMarker(marker, required) {
|
|
|
13
13
|
...ariaLabel !== void 0 && { "aria-label": ariaLabel }
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { DEFAULT_LABEL_MAKER, labelMarker };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=label-marker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-marker.js","names":[],"sources":["../../../src/logics/label-marker/label-marker.ts"],"sourcesContent":["import { type LabelVariants } from \"~/recipes\";\n\ninterface BaseMarker<Node> {\n label: Node;\n \"aria-label\"?: string | undefined;\n /**\n * The visual style of the marker. Defaults to `\"asterisk\"` when `label` is `\"*\"`, otherwise `\"text\"`.\n */\n variant?: LabelVariants[\"marker\"] | undefined;\n}\n\ninterface RequiredMarker<Node> extends BaseMarker<Node> {\n type: \"required\";\n}\n\ninterface OptionalMarker<Node> extends BaseMarker<Node> {\n type: \"optional\";\n}\n\nexport type LabelMarker<Node> =\n | RequiredMarker<Node>\n | OptionalMarker<Node>\n | { type: \"none\" };\n\nexport interface LabelMarkerNullData {\n label: null;\n}\n\nexport interface LabelMarkerNodeData<Node> {\n label: Node;\n variant: LabelVariants[\"marker\"];\n \"aria-label\"?: string | undefined;\n}\n\nexport type LabelMarkerData<Node> = LabelMarkerNullData | LabelMarkerNodeData<Node>;\n\nexport const DEFAULT_LABEL_MAKER = {\n type: \"required\",\n label: \"(required)\",\n} as const satisfies LabelMarker<string>;\n\nexport function labelMarker<Node>(marker: LabelMarker<Node
|
|
1
|
+
{"version":3,"file":"label-marker.js","names":[],"sources":["../../../src/logics/label-marker/label-marker.ts"],"sourcesContent":["import { type LabelVariants } from \"~/recipes\";\n\ninterface BaseMarker<Node> {\n label: Node;\n \"aria-label\"?: string | undefined;\n /**\n * The visual style of the marker. Defaults to `\"asterisk\"` when `label` is `\"*\"`, otherwise `\"text\"`.\n */\n variant?: LabelVariants[\"marker\"] | undefined;\n}\n\ninterface RequiredMarker<Node> extends BaseMarker<Node> {\n type: \"required\";\n}\n\ninterface OptionalMarker<Node> extends BaseMarker<Node> {\n type: \"optional\";\n}\n\nexport type LabelMarker<Node> =\n | RequiredMarker<Node>\n | OptionalMarker<Node>\n | { type: \"none\" };\n\nexport interface LabelMarkerNullData {\n label: null;\n}\n\nexport interface LabelMarkerNodeData<Node> {\n label: Node;\n variant: LabelVariants[\"marker\"];\n \"aria-label\"?: string | undefined;\n}\n\nexport type LabelMarkerData<Node> = LabelMarkerNullData | LabelMarkerNodeData<Node>;\n\nexport const DEFAULT_LABEL_MAKER = {\n type: \"required\",\n label: \"(required)\",\n} as const satisfies LabelMarker<string>;\n\nexport function labelMarker<Node>(\n marker: Readonly<LabelMarker<Node>>,\n required: boolean | undefined,\n): LabelMarkerData<Node> {\n if (marker.type === \"none\") {\n return { label: null };\n }\n const shown = marker.type === \"required\" ? required : !required;\n if (!shown) {\n return { label: null };\n }\n const ariaLabel = \"aria-label\" in marker ? marker[\"aria-label\"] : undefined;\n return {\n label: marker.label,\n variant: marker.variant ?? (marker.label === \"*\" ? \"asterisk\" : \"text\"),\n ...(ariaLabel !== undefined && { \"aria-label\": ariaLabel }),\n };\n}\n"],"mappings":";AAoCA,MAAa,sBAAsB;CACjC,MAAM;CACN,OAAO;AACT;AAEA,SAAgB,YACd,QACA,UACuB;CACvB,IAAI,OAAO,SAAS,QAClB,OAAO,EAAE,OAAO,KAAK;CAGvB,IAAI,EADU,OAAO,SAAS,aAAa,WAAW,CAAC,WAErD,OAAO,EAAE,OAAO,KAAK;CAEvB,MAAM,YAAY,gBAAgB,SAAS,OAAO,gBAAgB,KAAA;CAClE,OAAO;EACL,OAAO,OAAO;EACd,SAAS,OAAO,YAAY,OAAO,UAAU,MAAM,aAAa;EAChE,GAAI,cAAc,KAAA,KAAa,EAAE,cAAc,UAAU;CAC3D;AACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/logics/menu-control/menu-control.d.ts
|
|
2
1
|
export interface MenuState {
|
|
3
2
|
menuId: string;
|
|
4
3
|
}
|
|
@@ -11,7 +10,7 @@ export interface MenuTriggerAttributes {
|
|
|
11
10
|
popovertarget: string;
|
|
12
11
|
type: "button" | undefined;
|
|
13
12
|
}
|
|
14
|
-
declare function getTriggerAttributes(state: MenuState
|
|
13
|
+
declare function getTriggerAttributes(state: Readonly<MenuState>, options: Readonly<MenuTriggerAttributeOptions>): MenuTriggerAttributes;
|
|
15
14
|
export interface MenuContentAttributeOptions {
|
|
16
15
|
ariaLabel?: string | undefined;
|
|
17
16
|
ariaLabelledBy?: string | undefined;
|
|
@@ -23,7 +22,7 @@ export interface MenuContentAttributes {
|
|
|
23
22
|
"aria-label": string | undefined;
|
|
24
23
|
"aria-labelledby": string | undefined;
|
|
25
24
|
}
|
|
26
|
-
declare function getContentAttributes(state: MenuState
|
|
25
|
+
declare function getContentAttributes(state: Readonly<MenuState>, options: Readonly<MenuContentAttributeOptions>): MenuContentAttributes;
|
|
27
26
|
export interface MenuItemAttributeOptions {
|
|
28
27
|
focusKey?: string | undefined;
|
|
29
28
|
disabled?: boolean | undefined;
|
|
@@ -35,7 +34,7 @@ export interface MenuItemAttributes {
|
|
|
35
34
|
"data-hui-menuitem": string;
|
|
36
35
|
"data-hui-focus-key"?: string | undefined;
|
|
37
36
|
}
|
|
38
|
-
declare function getItemAttributes(state: MenuState
|
|
37
|
+
declare function getItemAttributes(state: Readonly<MenuState>, options: Readonly<MenuItemAttributeOptions>): MenuItemAttributes;
|
|
39
38
|
declare function handleMenuTriggerKeydown(e: KeyboardEvent, menuId: string): void;
|
|
40
39
|
type ItemAction = "none" | "action" | "focus-move" | "focus-set" | "focus-out";
|
|
41
40
|
declare function handleMenuitemKeydown(e: KeyboardEvent, activation: MenuItemActivation): ItemAction;
|
|
@@ -43,7 +42,7 @@ export interface MenuItemActivationOptions {
|
|
|
43
42
|
activation: MenuItemActivation;
|
|
44
43
|
disabled: boolean;
|
|
45
44
|
}
|
|
46
|
-
declare function handleMenuitemActivation(e: Event, menuId: string, options: MenuItemActivationOptions
|
|
45
|
+
declare function handleMenuitemActivation(e: Event, menuId: string, options: Readonly<MenuItemActivationOptions>, onActivate?: (() => void) | undefined): void;
|
|
47
46
|
declare function moveMenuitemFocus(e: KeyboardEvent, menuId: string): void;
|
|
48
47
|
declare function setMenuitemFocus(e: KeyboardEvent, menuId: string): void;
|
|
49
48
|
declare function hideMenu(menuId: string): void;
|
|
@@ -58,6 +57,5 @@ export declare const menuControl: {
|
|
|
58
57
|
readonly setMenuitemFocus: typeof setMenuitemFocus;
|
|
59
58
|
readonly hideMenu: typeof hideMenu;
|
|
60
59
|
};
|
|
61
|
-
//#endregion
|
|
62
60
|
export {};
|
|
63
61
|
//# sourceMappingURL=menu-control.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toStrbool } from "../bool/to-strbool.js";
|
|
2
2
|
import { popoverControl } from "../popover-control/popover-control.js";
|
|
3
|
-
|
|
3
|
+
// src/logics/menu-control/menu-control.ts
|
|
4
4
|
const nextIndexMap = {
|
|
5
5
|
"ArrowUp": (currentIndex, itemsLength) => (currentIndex - 1 + itemsLength) % itemsLength,
|
|
6
6
|
"ArrowDown": (currentIndex, itemsLength) => (currentIndex + 1) % itemsLength,
|
|
@@ -130,7 +130,6 @@ const menuControl = {
|
|
|
130
130
|
setMenuitemFocus,
|
|
131
131
|
hideMenu
|
|
132
132
|
};
|
|
133
|
-
//#endregion
|
|
134
133
|
export { menuControl };
|
|
135
134
|
|
|
136
135
|
//# sourceMappingURL=menu-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-control.js","names":[],"sources":["../../../src/logics/menu-control/menu-control.ts"],"sourcesContent":["import { toStrbool } from \"../bool\";\nimport { popoverControl } from \"../popover-control\";\n\nexport interface MenuState {\n menuId: string;\n}\n\nexport type MenuItemActivation = \"managed\" | \"native\";\n\ntype indexMap = (currentIndex: number, itemsLength: number) => number;\nconst nextIndexMap: Readonly<Record<string, indexMap>> = {\n \"ArrowUp\": (currentIndex, itemsLength) => (currentIndex - 1 + itemsLength) % itemsLength,\n \"ArrowDown\": (currentIndex, itemsLength) => (currentIndex + 1) % itemsLength,\n \"Home\": (): number => 0,\n \"End\": (_, itemsLength) => itemsLength - 1,\n} as const;\n\nconst openKeys = new Set([\"ArrowUp\", \"ArrowDown\", \"Enter\", \" \"]);\nconst itemMotionKeys = Object.keys(nextIndexMap);\nconst itemActivationKeys = new Set([\"Enter\", \" \"]);\n\nconst menuitemDatasetItemKey = \"data-hui-menuitem\";\nconst menuitemDatasetFocusKeyKey = \"data-hui-focus-key\";\nconst menuitemDatasetFocusKeyName = \"huiFocusKey\";\n\nfunction triggerId(menuId: string): string {\n return `${menuId}-trigger`;\n}\n\ninterface MenuitemDataset {\n [menuitemDatasetItemKey]: string;\n [menuitemDatasetFocusKeyKey]?: string;\n}\n\nfunction menuitemDataset(menuId: string, focusKey?: string): MenuitemDataset {\n if (focusKey) {\n return {\n [menuitemDatasetItemKey]: `${menuId}-item`,\n [menuitemDatasetFocusKeyKey]: focusKey,\n };\n } else {\n return {\n [menuitemDatasetItemKey]: `${menuId}-item`,\n };\n }\n}\n\nexport interface MenuTriggerAttributeOptions {\n isButtonElement: boolean;\n}\n\nexport interface MenuTriggerAttributes {\n id: string;\n popovertarget: string;\n type: \"button\" | undefined;\n}\n\nfunction getTriggerAttributes(\n state: MenuState,\n options: MenuTriggerAttributeOptions,\n): MenuTriggerAttributes {\n return {\n id: triggerId(state.menuId),\n ...popoverControl.getTriggerAttributes(\n { popoverId: state.menuId },\n options,\n ),\n };\n}\n\nexport interface MenuContentAttributeOptions {\n ariaLabel?: string | undefined;\n ariaLabelledBy?: string | undefined;\n}\n\nexport interface MenuContentAttributes {\n role: \"menu\";\n id: string;\n popover: \"auto\";\n \"aria-label\": string | undefined;\n \"aria-labelledby\": string | undefined;\n}\n\nfunction getContentAttributes(\n state: MenuState,\n options: MenuContentAttributeOptions,\n): MenuContentAttributes {\n return {\n role: \"menu\",\n ...popoverControl.getContentAttributes({ popoverId: state.menuId }),\n \"aria-label\": options.ariaLabel,\n \"aria-labelledby\": options.ariaLabelledBy\n ?? (!options.ariaLabel ? triggerId(state.menuId) : undefined),\n };\n}\n\nexport interface MenuItemAttributeOptions {\n focusKey?: string | undefined;\n disabled?: boolean | undefined;\n}\n\nexport interface MenuItemAttributes {\n role: \"menuitem\";\n tabindex: -1;\n \"aria-disabled\": \"true\" | \"false\" | undefined;\n \"data-hui-menuitem\": string;\n \"data-hui-focus-key\"?: string | undefined;\n}\n\nfunction getItemAttributes(\n state: MenuState,\n options: MenuItemAttributeOptions,\n): MenuItemAttributes {\n return {\n role: \"menuitem\",\n tabindex: -1,\n \"aria-disabled\": options.disabled === undefined ? undefined : toStrbool(options.disabled),\n ...menuitemDataset(state.menuId, options.focusKey),\n };\n}\n\nfunction getMenu(menuId: string): HTMLElement {\n const menu = document.getElementById(menuId);\n if (!(menu instanceof HTMLElement)) {\n throw new Error(\"[Hebium UI|Menu] Menu element is not found\");\n }\n return menu;\n}\n\nfunction getFocusableMenuitems(menuId: string): HTMLElement[] {\n const itemDataset = menuitemDataset(menuId);\n const menuitemList = getMenu(menuId).querySelectorAll(\n `[${menuitemDatasetItemKey}=\"${itemDataset[menuitemDatasetItemKey]}\"]`,\n );\n return Array.from(menuitemList)\n .filter((e) => e instanceof HTMLElement);\n}\n\nfunction isCharKey(key: string): boolean {\n return key.length === 1 && /^\\S$/.test(key);\n}\n\nfunction handleMenuTriggerKeydown(e: KeyboardEvent, menuId: string): void {\n if (!openKeys.has(e.key)) return;\n const trigger = e.target;\n if (!(trigger instanceof HTMLElement)) {\n throw new Error(\"[Hebuim UI|Menu] Only HTMLElement events are supported\");\n }\n const menu = getMenu(menuId);\n\n e.preventDefault();\n menu.showPopover({ source: trigger });\n if (e.key === \"ArrowUp\") {\n const menuitems = getFocusableMenuitems(menuId);\n menuitems.at(-1)?.focus();\n } else {\n const menuitems = getFocusableMenuitems(menuId);\n menuitems.at(0)?.focus();\n }\n}\n\ntype ItemAction = \"none\" | \"action\" | \"focus-move\" | \"focus-set\" | \"focus-out\";\nfunction handleMenuitemKeydown(e: KeyboardEvent, activation: MenuItemActivation): ItemAction {\n if (itemActivationKeys.has(e.key)) return activation === \"managed\" ? \"action\" : \"none\";\n if (itemMotionKeys.includes(e.key)) return \"focus-move\";\n if (e.key === \"Tab\") return \"focus-out\";\n if (isCharKey(e.key)) return \"focus-set\";\n return \"none\";\n}\n\nexport interface MenuItemActivationOptions {\n activation: MenuItemActivation;\n disabled: boolean;\n}\n\nfunction handleMenuitemActivation(\n e: Event,\n menuId: string,\n options: MenuItemActivationOptions,\n onActivate?: (() => void) | undefined,\n): void {\n if (e.defaultPrevented) return;\n if (options.activation === \"managed\") e.preventDefault();\n if (options.disabled) return;\n onActivate?.();\n hideMenu(menuId);\n}\n\nfunction moveMenuitemFocus(e: KeyboardEvent, menuId: string): void {\n const currentItem = e.target;\n if (!(currentItem instanceof HTMLElement)) {\n throw new Error(\"[Hebuim UI|Menu] Only HTMLElement events are supported\");\n }\n\n const menuitems = getFocusableMenuitems(menuId);\n const currentIndex = menuitems.indexOf(currentItem);\n\n const map = nextIndexMap[e.key];\n if (typeof map === \"undefined\") {\n throw new Error(\"[Hebuim UI|Menu] Unexpected event key: \" + e.key);\n }\n const nextIndex = map(currentIndex, menuitems.length);\n const nextElement = menuitems[nextIndex];\n\n e.preventDefault();\n nextElement?.focus();\n}\n\nfunction findFocusItemIndex(\n menuitems: HTMLElement[],\n currentIndex: number,\n char: string,\n): number {\n const normalizedChar = char.toLowerCase();\n\n for (let offset = 1; offset <= menuitems.length; offset++) {\n const index = (currentIndex + offset) % menuitems.length;\n const item = menuitems[index];\n\n if (item?.dataset[menuitemDatasetFocusKeyName]?.toLowerCase() === normalizedChar) {\n return index;\n }\n }\n\n return -1;\n}\n\nfunction setMenuitemFocus(e: KeyboardEvent, menuId: string): void {\n const currentItem = e.target;\n if (!(currentItem instanceof HTMLElement)) {\n throw new Error(\"[Hebuim UI|Menu] Only HTMLElement events are supported\");\n }\n\n const menuitems = getFocusableMenuitems(menuId);\n const currentIndex = menuitems.indexOf(currentItem);\n const char = e.key.slice(0, 1);\n const nextIndex = findFocusItemIndex(menuitems, currentIndex, char);\n if (nextIndex === -1) return;\n const nextElement = menuitems[nextIndex];\n\n e.preventDefault();\n nextElement?.focus();\n}\n\nfunction hideMenu(menuId: string): void {\n const menu = getMenu(menuId);\n menu.hidePopover();\n}\n\nexport const menuControl = {\n getTriggerAttributes,\n getContentAttributes,\n getItemAttributes,\n handleMenuTriggerKeydown,\n handleMenuitemKeydown,\n handleMenuitemActivation,\n moveMenuitemFocus,\n setMenuitemFocus,\n hideMenu,\n} as const;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"menu-control.js","names":[],"sources":["../../../src/logics/menu-control/menu-control.ts"],"sourcesContent":["import { toStrbool } from \"../bool\";\nimport { popoverControl } from \"../popover-control\";\n\nexport interface MenuState {\n menuId: string;\n}\n\nexport type MenuItemActivation = \"managed\" | \"native\";\n\ntype indexMap = (currentIndex: number, itemsLength: number) => number;\nconst nextIndexMap: Readonly<Record<string, indexMap>> = {\n \"ArrowUp\": (currentIndex, itemsLength) => (currentIndex - 1 + itemsLength) % itemsLength,\n \"ArrowDown\": (currentIndex, itemsLength) => (currentIndex + 1) % itemsLength,\n \"Home\": (): number => 0,\n \"End\": (_, itemsLength) => itemsLength - 1,\n} as const;\n\nconst openKeys: ReadonlySet<string> = new Set([\"ArrowUp\", \"ArrowDown\", \"Enter\", \" \"]);\nconst itemMotionKeys: readonly string[] = Object.keys(nextIndexMap);\nconst itemActivationKeys: ReadonlySet<string> = new Set([\"Enter\", \" \"]);\n\nconst menuitemDatasetItemKey = \"data-hui-menuitem\";\nconst menuitemDatasetFocusKeyKey = \"data-hui-focus-key\";\nconst menuitemDatasetFocusKeyName = \"huiFocusKey\";\n\nfunction triggerId(menuId: string): string {\n return `${menuId}-trigger`;\n}\n\ninterface MenuitemDataset {\n [menuitemDatasetItemKey]: string;\n [menuitemDatasetFocusKeyKey]?: string;\n}\n\nfunction menuitemDataset(menuId: string, focusKey?: string): MenuitemDataset {\n if (focusKey) {\n return {\n [menuitemDatasetItemKey]: `${menuId}-item`,\n [menuitemDatasetFocusKeyKey]: focusKey,\n };\n } else {\n return {\n [menuitemDatasetItemKey]: `${menuId}-item`,\n };\n }\n}\n\nexport interface MenuTriggerAttributeOptions {\n isButtonElement: boolean;\n}\n\nexport interface MenuTriggerAttributes {\n id: string;\n popovertarget: string;\n type: \"button\" | undefined;\n}\n\nfunction getTriggerAttributes(\n state: Readonly<MenuState>,\n options: Readonly<MenuTriggerAttributeOptions>,\n): MenuTriggerAttributes {\n return {\n id: triggerId(state.menuId),\n ...popoverControl.getTriggerAttributes(\n { popoverId: state.menuId },\n options,\n ),\n };\n}\n\nexport interface MenuContentAttributeOptions {\n ariaLabel?: string | undefined;\n ariaLabelledBy?: string | undefined;\n}\n\nexport interface MenuContentAttributes {\n role: \"menu\";\n id: string;\n popover: \"auto\";\n \"aria-label\": string | undefined;\n \"aria-labelledby\": string | undefined;\n}\n\nfunction getContentAttributes(\n state: Readonly<MenuState>,\n options: Readonly<MenuContentAttributeOptions>,\n): MenuContentAttributes {\n return {\n role: \"menu\",\n ...popoverControl.getContentAttributes({ popoverId: state.menuId }),\n \"aria-label\": options.ariaLabel,\n \"aria-labelledby\": options.ariaLabelledBy\n ?? (!options.ariaLabel ? triggerId(state.menuId) : undefined),\n };\n}\n\nexport interface MenuItemAttributeOptions {\n focusKey?: string | undefined;\n disabled?: boolean | undefined;\n}\n\nexport interface MenuItemAttributes {\n role: \"menuitem\";\n tabindex: -1;\n \"aria-disabled\": \"true\" | \"false\" | undefined;\n \"data-hui-menuitem\": string;\n \"data-hui-focus-key\"?: string | undefined;\n}\n\nfunction getItemAttributes(\n state: Readonly<MenuState>,\n options: Readonly<MenuItemAttributeOptions>,\n): MenuItemAttributes {\n return {\n role: \"menuitem\",\n tabindex: -1,\n \"aria-disabled\": options.disabled === undefined ? undefined : toStrbool(options.disabled),\n ...menuitemDataset(state.menuId, options.focusKey),\n };\n}\n\nfunction getMenu(menuId: string): HTMLElement {\n const menu = document.getElementById(menuId);\n if (!(menu instanceof HTMLElement)) {\n throw new Error(\"[Hebium UI|Menu] Menu element is not found\");\n }\n return menu;\n}\n\nfunction getFocusableMenuitems(menuId: string): HTMLElement[] {\n const itemDataset = menuitemDataset(menuId);\n const menuitemList = getMenu(menuId).querySelectorAll(\n `[${menuitemDatasetItemKey}=\"${itemDataset[menuitemDatasetItemKey]}\"]`,\n );\n return Array.from(menuitemList)\n .filter((e) => e instanceof HTMLElement);\n}\n\nfunction isCharKey(key: string): boolean {\n return key.length === 1 && /^\\S$/.test(key);\n}\n\nfunction handleMenuTriggerKeydown(e: KeyboardEvent, menuId: string): void {\n if (!openKeys.has(e.key)) return;\n const trigger = e.target;\n if (!(trigger instanceof HTMLElement)) {\n throw new Error(\"[Hebuim UI|Menu] Only HTMLElement events are supported\");\n }\n const menu = getMenu(menuId);\n\n e.preventDefault();\n menu.showPopover({ source: trigger });\n if (e.key === \"ArrowUp\") {\n const menuitems = getFocusableMenuitems(menuId);\n menuitems.at(-1)?.focus();\n } else {\n const menuitems = getFocusableMenuitems(menuId);\n menuitems.at(0)?.focus();\n }\n}\n\ntype ItemAction = \"none\" | \"action\" | \"focus-move\" | \"focus-set\" | \"focus-out\";\nfunction handleMenuitemKeydown(e: KeyboardEvent, activation: MenuItemActivation): ItemAction {\n if (itemActivationKeys.has(e.key)) return activation === \"managed\" ? \"action\" : \"none\";\n if (itemMotionKeys.includes(e.key)) return \"focus-move\";\n if (e.key === \"Tab\") return \"focus-out\";\n if (isCharKey(e.key)) return \"focus-set\";\n return \"none\";\n}\n\nexport interface MenuItemActivationOptions {\n activation: MenuItemActivation;\n disabled: boolean;\n}\n\nfunction handleMenuitemActivation(\n e: Event,\n menuId: string,\n options: Readonly<MenuItemActivationOptions>,\n onActivate?: (() => void) | undefined,\n): void {\n if (e.defaultPrevented) return;\n if (options.activation === \"managed\") e.preventDefault();\n if (options.disabled) return;\n onActivate?.();\n hideMenu(menuId);\n}\n\nfunction moveMenuitemFocus(e: KeyboardEvent, menuId: string): void {\n const currentItem = e.target;\n if (!(currentItem instanceof HTMLElement)) {\n throw new Error(\"[Hebuim UI|Menu] Only HTMLElement events are supported\");\n }\n\n const menuitems = getFocusableMenuitems(menuId);\n const currentIndex = menuitems.indexOf(currentItem);\n\n const map = nextIndexMap[e.key];\n if (typeof map === \"undefined\") {\n throw new Error(\"[Hebuim UI|Menu] Unexpected event key: \" + e.key);\n }\n const nextIndex = map(currentIndex, menuitems.length);\n const nextElement = menuitems[nextIndex];\n\n e.preventDefault();\n nextElement?.focus();\n}\n\nfunction findFocusItemIndex(\n menuitems: readonly HTMLElement[],\n currentIndex: number,\n char: string,\n): number {\n const normalizedChar = char.toLowerCase();\n\n for (let offset = 1; offset <= menuitems.length; offset++) {\n const index = (currentIndex + offset) % menuitems.length;\n const item = menuitems[index];\n\n if (item?.dataset[menuitemDatasetFocusKeyName]?.toLowerCase() === normalizedChar) {\n return index;\n }\n }\n\n return -1;\n}\n\nfunction setMenuitemFocus(e: KeyboardEvent, menuId: string): void {\n const currentItem = e.target;\n if (!(currentItem instanceof HTMLElement)) {\n throw new Error(\"[Hebuim UI|Menu] Only HTMLElement events are supported\");\n }\n\n const menuitems = getFocusableMenuitems(menuId);\n const currentIndex = menuitems.indexOf(currentItem);\n const char = e.key.slice(0, 1);\n const nextIndex = findFocusItemIndex(menuitems, currentIndex, char);\n if (nextIndex === -1) return;\n const nextElement = menuitems[nextIndex];\n\n e.preventDefault();\n nextElement?.focus();\n}\n\nfunction hideMenu(menuId: string): void {\n const menu = getMenu(menuId);\n menu.hidePopover();\n}\n\nexport const menuControl = {\n getTriggerAttributes,\n getContentAttributes,\n getItemAttributes,\n handleMenuTriggerKeydown,\n handleMenuitemKeydown,\n handleMenuitemActivation,\n moveMenuitemFocus,\n setMenuitemFocus,\n hideMenu,\n} as const;\n"],"mappings":"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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type ReadonlySlotStyles<S extends string, P extends object> = Partial<Readonly<Record<S, P | undefined>>>;
|
|
2
2
|
type SlotStyles<S extends string, P extends object> = Partial<Record<S, P | undefined>>;
|
|
3
3
|
/** Merge styles to every slot. **/
|
|
4
|
-
export declare function msAll<S extends string, P extends object>(defaultStyels:
|
|
5
|
-
//#endregion
|
|
4
|
+
export declare function msAll<S extends string, P extends object>(defaultStyels: ReadonlySlotStyles<S, P>, overrides: ReadonlySlotStyles<S, P>): SlotStyles<S, P>;
|
|
6
5
|
export {};
|
|
7
6
|
//# sourceMappingURL=ms-all.d.ts.map
|
package/dist/logics/ms/ms-all.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/logics/ms/ms-all.ts
|
|
2
2
|
/** Merge styles to every slot. **/
|
|
3
3
|
function msAll(defaultStyels, overrides) {
|
|
4
4
|
const keys = /* @__PURE__ */ new Set([...Object.keys(defaultStyels), ...Object.keys(overrides)]);
|
|
@@ -13,7 +13,6 @@ function msAll(defaultStyels, overrides) {
|
|
|
13
13
|
});
|
|
14
14
|
return output;
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { msAll };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=ms-all.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ms-all.js","names":[],"sources":["../../../src/logics/ms/ms-all.ts"],"sourcesContent":["type SlotStyles<S extends string, P extends object> = Partial<Record<S, P | undefined>>;\n\n/** Merge styles to every slot. **/\nexport function msAll<S extends string, P extends object>(\n defaultStyels:
|
|
1
|
+
{"version":3,"file":"ms-all.js","names":[],"sources":["../../../src/logics/ms/ms-all.ts"],"sourcesContent":["type ReadonlySlotStyles<S extends string, P extends object> = Partial<Readonly<Record<S, P | undefined>>>;\ntype SlotStyles<S extends string, P extends object> = Partial<Record<S, P | undefined>>;\n\n/** Merge styles to every slot. **/\nexport function msAll<S extends string, P extends object>(\n defaultStyels: ReadonlySlotStyles<S, P>,\n overrides: ReadonlySlotStyles<S, P>,\n): SlotStyles<S, P> {\n const keys = new Set([...Object.keys(defaultStyels), ...Object.keys(overrides)]);\n const output: SlotStyles<S, P> = {};\n keys.forEach((k) => {\n const defaultValue = defaultStyels[k as S];\n const overrideValue = overrides[k as S];\n output[k as S] = { ...defaultValue, ...overrideValue };\n });\n return output;\n}\n"],"mappings":";;AAIA,SAAgB,MACd,eACA,WACkB;CAClB,MAAM,uBAAO,IAAI,IAAI,CAAC,GAAG,OAAO,KAAK,aAAa,GAAG,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC;CAC/E,MAAM,SAA2B,CAAC;CAClC,KAAK,SAAS,MAAM;EAClB,MAAM,eAAe,cAAc;EACnC,MAAM,gBAAgB,UAAU;EAChC,OAAO,KAAU;GAAE,GAAG;GAAc,GAAG;EAAc;CACvD,CAAC;CACD,OAAO;AACT"}
|