@hebium-ui/core 0.0.0-stage → 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -2
  3. package/dist/index.d.ts +51 -0
  4. package/dist/index.js +51 -0
  5. package/dist/logics/avatar-placeholder/get-avatar-placeholder.d.ts +4 -0
  6. package/dist/logics/avatar-placeholder/get-avatar-placeholder.js +10 -0
  7. package/dist/logics/avatar-placeholder/get-avatar-placeholder.js.map +1 -0
  8. package/dist/logics/avatar-placeholder/should-show-avatar-placeholder.d.ts +12 -0
  9. package/dist/logics/avatar-placeholder/should-show-avatar-placeholder.js +8 -0
  10. package/dist/logics/avatar-placeholder/should-show-avatar-placeholder.js.map +1 -0
  11. package/dist/logics/bool/to-bool.d.ts +4 -0
  12. package/dist/logics/bool/to-bool.js +9 -0
  13. package/dist/logics/bool/to-bool.js.map +1 -0
  14. package/dist/logics/bool/to-strbool.d.ts +5 -0
  15. package/dist/logics/bool/to-strbool.js +8 -0
  16. package/dist/logics/bool/to-strbool.js.map +1 -0
  17. package/dist/logics/cc/cc-all.d.ts +7 -0
  18. package/dist/logics/cc/cc-all.js +15 -0
  19. package/dist/logics/cc/cc-all.js.map +1 -0
  20. package/dist/logics/cc/cc.d.ts +7 -0
  21. package/dist/logics/cc/cc.js +9 -0
  22. package/dist/logics/cc/cc.js.map +1 -0
  23. package/dist/logics/checkbox-control/checkbox-control.d.ts +33 -0
  24. package/dist/logics/checkbox-control/checkbox-control.js +32 -0
  25. package/dist/logics/checkbox-control/checkbox-control.js.map +1 -0
  26. package/dist/logics/dialog-control/dialog-control.d.ts +48 -0
  27. package/dist/logics/dialog-control/dialog-control.js +51 -0
  28. package/dist/logics/dialog-control/dialog-control.js.map +1 -0
  29. package/dist/logics/input-control/input-control.d.ts +29 -0
  30. package/dist/logics/input-control/input-control.js +22 -0
  31. package/dist/logics/input-control/input-control.js.map +1 -0
  32. package/dist/logics/label-marker/label-marker.d.ts +36 -0
  33. package/dist/logics/label-marker/label-marker.js +19 -0
  34. package/dist/logics/label-marker/label-marker.js.map +1 -0
  35. package/dist/logics/menu-control/menu-control.d.ts +63 -0
  36. package/dist/logics/menu-control/menu-control.js +136 -0
  37. package/dist/logics/menu-control/menu-control.js.map +1 -0
  38. package/dist/logics/ms/ms-all.d.ts +7 -0
  39. package/dist/logics/ms/ms-all.js +19 -0
  40. package/dist/logics/ms/ms-all.js.map +1 -0
  41. package/dist/logics/popover-control/popover-control.d.ts +24 -0
  42. package/dist/logics/popover-control/popover-control.js +21 -0
  43. package/dist/logics/popover-control/popover-control.js.map +1 -0
  44. package/dist/logics/progress-control/progress-control.d.ts +46 -0
  45. package/dist/logics/progress-control/progress-control.js +48 -0
  46. package/dist/logics/progress-control/progress-control.js.map +1 -0
  47. package/dist/logics/radio-control/radio-control.d.ts +30 -0
  48. package/dist/logics/radio-control/radio-control.js +30 -0
  49. package/dist/logics/radio-control/radio-control.js.map +1 -0
  50. package/dist/logics/radiogroup-control/radiogroup-control.d.ts +25 -0
  51. package/dist/logics/radiogroup-control/radiogroup-control.js +22 -0
  52. package/dist/logics/radiogroup-control/radiogroup-control.js.map +1 -0
  53. package/dist/logics/segmented-control/segmented-control.d.ts +16 -0
  54. package/dist/logics/segmented-control/segmented-control.js +12 -0
  55. package/dist/logics/segmented-control/segmented-control.js.map +1 -0
  56. package/dist/logics/tabs-control/tabs-control.d.ts +52 -0
  57. package/dist/logics/tabs-control/tabs-control.js +74 -0
  58. package/dist/logics/tabs-control/tabs-control.js.map +1 -0
  59. package/dist/logics/tabs-control/tabs-keymap.js +13 -0
  60. package/dist/logics/tabs-control/tabs-keymap.js.map +1 -0
  61. package/dist/logics/tooltip-control/tooltip-control.d.ts +31 -0
  62. package/dist/logics/tooltip-control/tooltip-control.js +53 -0
  63. package/dist/logics/tooltip-control/tooltip-control.js.map +1 -0
  64. package/dist/recipes/alert/alert.d.ts +65 -0
  65. package/dist/recipes/alert/alert.js +66 -0
  66. package/dist/recipes/alert/alert.js.map +1 -0
  67. package/dist/recipes/anchor/anchor.d.ts +108 -0
  68. package/dist/recipes/anchor/anchor.js +75 -0
  69. package/dist/recipes/anchor/anchor.js.map +1 -0
  70. package/dist/recipes/avatar/avatar.d.ts +21 -0
  71. package/dist/recipes/avatar/avatar.js +31 -0
  72. package/dist/recipes/avatar/avatar.js.map +1 -0
  73. package/dist/recipes/blockquote/blockquote.d.ts +31 -0
  74. package/dist/recipes/blockquote/blockquote.js +33 -0
  75. package/dist/recipes/blockquote/blockquote.js.map +1 -0
  76. package/dist/recipes/button/button.d.ts +120 -0
  77. package/dist/recipes/button/button.js +89 -0
  78. package/dist/recipes/button/button.js.map +1 -0
  79. package/dist/recipes/checkbox/checkbox.d.ts +64 -0
  80. package/dist/recipes/checkbox/checkbox.js +86 -0
  81. package/dist/recipes/checkbox/checkbox.js.map +1 -0
  82. package/dist/recipes/code/code.d.ts +8 -0
  83. package/dist/recipes/code/code.js +14 -0
  84. package/dist/recipes/code/code.js.map +1 -0
  85. package/dist/recipes/container/container.d.ts +8 -0
  86. package/dist/recipes/container/container.js +15 -0
  87. package/dist/recipes/container/container.js.map +1 -0
  88. package/dist/recipes/details/details.d.ts +22 -0
  89. package/dist/recipes/details/details.js +38 -0
  90. package/dist/recipes/details/details.js.map +1 -0
  91. package/dist/recipes/dialog/dialog.d.ts +30 -0
  92. package/dist/recipes/dialog/dialog.js +46 -0
  93. package/dist/recipes/dialog/dialog.js.map +1 -0
  94. package/dist/recipes/dl/dl.d.ts +14 -0
  95. package/dist/recipes/dl/dl.js +26 -0
  96. package/dist/recipes/dl/dl.js.map +1 -0
  97. package/dist/recipes/drawer/drawer.d.ts +51 -0
  98. package/dist/recipes/drawer/drawer.js +69 -0
  99. package/dist/recipes/drawer/drawer.js.map +1 -0
  100. package/dist/recipes/fieldset/fieldset.d.ts +8 -0
  101. package/dist/recipes/fieldset/fieldset.js +16 -0
  102. package/dist/recipes/fieldset/fieldset.js.map +1 -0
  103. package/dist/recipes/focus-ring/focus-ring.d.ts +8 -0
  104. package/dist/recipes/focus-ring/focus-ring.js +10 -0
  105. package/dist/recipes/focus-ring/focus-ring.js.map +1 -0
  106. package/dist/recipes/heading/heading.d.ts +56 -0
  107. package/dist/recipes/heading/heading.js +35 -0
  108. package/dist/recipes/heading/heading.js.map +1 -0
  109. package/dist/recipes/hr/hr.d.ts +8 -0
  110. package/dist/recipes/hr/hr.js +14 -0
  111. package/dist/recipes/hr/hr.js.map +1 -0
  112. package/dist/recipes/input/input.d.ts +59 -0
  113. package/dist/recipes/input/input.js +65 -0
  114. package/dist/recipes/input/input.js.map +1 -0
  115. package/dist/recipes/label/label.d.ts +49 -0
  116. package/dist/recipes/label/label.js +63 -0
  117. package/dist/recipes/label/label.js.map +1 -0
  118. package/dist/recipes/menu/menu.d.ts +31 -0
  119. package/dist/recipes/menu/menu.js +34 -0
  120. package/dist/recipes/menu/menu.js.map +1 -0
  121. package/dist/recipes/paragraph/paragraph.d.ts +45 -0
  122. package/dist/recipes/paragraph/paragraph.js +30 -0
  123. package/dist/recipes/paragraph/paragraph.js.map +1 -0
  124. package/dist/recipes/popover/popover.d.ts +135 -0
  125. package/dist/recipes/popover/popover.js +105 -0
  126. package/dist/recipes/popover/popover.js.map +1 -0
  127. package/dist/recipes/progress/progress.d.ts +69 -0
  128. package/dist/recipes/progress/progress.js +59 -0
  129. package/dist/recipes/progress/progress.js.map +1 -0
  130. package/dist/recipes/radio/radio.d.ts +44 -0
  131. package/dist/recipes/radio/radio.js +74 -0
  132. package/dist/recipes/radio/radio.js.map +1 -0
  133. package/dist/recipes/radiogroup/radiogroup.d.ts +23 -0
  134. package/dist/recipes/radiogroup/radiogroup.js +26 -0
  135. package/dist/recipes/radiogroup/radiogroup.js.map +1 -0
  136. package/dist/recipes/section/section.d.ts +64 -0
  137. package/dist/recipes/section/section.js +46 -0
  138. package/dist/recipes/section/section.js.map +1 -0
  139. package/dist/recipes/segmented-control/segmented-control.d.ts +11 -0
  140. package/dist/recipes/segmented-control/segmented-control.js +40 -0
  141. package/dist/recipes/segmented-control/segmented-control.js.map +1 -0
  142. package/dist/recipes/select/select.d.ts +24 -0
  143. package/dist/recipes/select/select.js +50 -0
  144. package/dist/recipes/select/select.js.map +1 -0
  145. package/dist/recipes/table/table.d.ts +59 -0
  146. package/dist/recipes/table/table.js +53 -0
  147. package/dist/recipes/table/table.js.map +1 -0
  148. package/dist/recipes/tabs/tabs.d.ts +17 -0
  149. package/dist/recipes/tabs/tabs.js +45 -0
  150. package/dist/recipes/tabs/tabs.js.map +1 -0
  151. package/dist/recipes/visually-hidden/visually-hidden.d.ts +8 -0
  152. package/dist/recipes/visually-hidden/visually-hidden.js +10 -0
  153. package/dist/recipes/visually-hidden/visually-hidden.js.map +1 -0
  154. package/dist/style.css +1 -0
  155. package/dist/styles/css-vars.d.ts +6 -0
  156. package/dist/styles/css-vars.js +6 -0
  157. package/dist/styles/css-vars.js.map +1 -0
  158. package/dist/styles/make-recipe-type.d.ts +5 -0
  159. package/dist/styles/make-recipe.d.ts +15 -0
  160. package/dist/styles/make-recipe.js +51 -0
  161. package/dist/styles/make-recipe.js.map +1 -0
  162. package/dist/styles/primitive-css/active.module.js +10 -0
  163. package/dist/styles/primitive-css/active.module.js.map +1 -0
  164. package/dist/styles/primitive-css/base.module.js +15 -0
  165. package/dist/styles/primitive-css/base.module.js.map +1 -0
  166. package/dist/styles/primitive-css/checked.module.js +10 -0
  167. package/dist/styles/primitive-css/checked.module.js.map +1 -0
  168. package/dist/styles/primitive-css/composite.module.js +6 -0
  169. package/dist/styles/primitive-css/composite.module.js.map +1 -0
  170. package/dist/styles/primitive-css/disabled.module.js +18 -0
  171. package/dist/styles/primitive-css/disabled.module.js.map +1 -0
  172. package/dist/styles/primitive-css/focus.module.js +10 -0
  173. package/dist/styles/primitive-css/focus.module.js.map +1 -0
  174. package/dist/styles/primitive-css/hover.module.js +15 -0
  175. package/dist/styles/primitive-css/hover.module.js.map +1 -0
  176. package/dist/styles/primitive-css/icon.module.js +11 -0
  177. package/dist/styles/primitive-css/icon.module.js.map +1 -0
  178. package/dist/styles/primitive-css/misc.module.js +21 -0
  179. package/dist/styles/primitive-css/misc.module.js.map +1 -0
  180. package/dist/styles/primitive-css/neutral.module.js +144 -0
  181. package/dist/styles/primitive-css/neutral.module.js.map +1 -0
  182. package/dist/styles/primitive-css/pseudo-element.module.js +19 -0
  183. package/dist/styles/primitive-css/pseudo-element.module.js.map +1 -0
  184. package/dist/styles/primitive.gen.d.ts +454 -0
  185. package/dist/styles/primitive.gen.js +318 -0
  186. package/dist/styles/primitive.gen.js.map +1 -0
  187. package/package.json +43 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wancup
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
- # Temporary Holding Version
1
+ # @hebium-ui/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Framework-agnostic CSS recipes, shared interaction logic, and the global stylesheet for Hebium UI.
4
+
5
+ > [!WARNING]
6
+ > Hebium UI is under active development. Its APIs may change without notice, including breaking changes.
7
+
8
+ The source repository is currently private. Public release is planned, but no timeline has been set.
@@ -0,0 +1,51 @@
1
+ import { getAvatarPlaceholder } from "./logics/avatar-placeholder/get-avatar-placeholder.js";
2
+ import { AvatarSource, shouldShowAvatarPlaceholder } from "./logics/avatar-placeholder/should-show-avatar-placeholder.js";
3
+ import { toBool } from "./logics/bool/to-bool.js";
4
+ import { Strbool, toStrbool } from "./logics/bool/to-strbool.js";
5
+ import { cc } from "./logics/cc/cc.js";
6
+ import { ccAll } from "./logics/cc/cc-all.js";
7
+ import { CheckboxControlAttributes, CheckboxErrorAttributes, CheckboxLabelAttributes, CheckboxState, checkboxControl } from "./logics/checkbox-control/checkbox-control.js";
8
+ import { DialogCloseAttributes, DialogContentAttributeOptions, DialogContentAttributes, DialogHeadingAttributes, DialogState, DialogTriggerAttributeOptions, DialogTriggerAttributes, dialogControl } from "./logics/dialog-control/dialog-control.js";
9
+ import { AlertSlots, AlertVariants, alertRecipe } from "./recipes/alert/alert.js";
10
+ import { AnchorSlots, AnchorVariants, anchorRecipe } from "./recipes/anchor/anchor.js";
11
+ import { AvatarSlots, AvatarVariants, avatartRecipe } from "./recipes/avatar/avatar.js";
12
+ import { BlockquoteSlots, BlockquoteVariants, blockquoteRecipe } from "./recipes/blockquote/blockquote.js";
13
+ import { ButtonSlots, ButtonVariants, buttonRecipe } from "./recipes/button/button.js";
14
+ import { CheckboxSlots, CheckboxVariants, checkboxRecipe } from "./recipes/checkbox/checkbox.js";
15
+ import { CodeSlots, CodeVariants, codeRecipe } from "./recipes/code/code.js";
16
+ import { ContainerSlots, ContainerVariants, containerRecipe } from "./recipes/container/container.js";
17
+ import { DetailsSlots, DetailsVariants, detailsRecipe } from "./recipes/details/details.js";
18
+ import { DialogSlots, DialogVariants, dialogRecipe } from "./recipes/dialog/dialog.js";
19
+ import { DdSlots, DdVariants, DlSlots, DlVariants, DtSlots, DtVariants, ddRecipe, dlRecipe, dtRecipe } from "./recipes/dl/dl.js";
20
+ import { DrawerSlots, DrawerVariants, drawerRecipe } from "./recipes/drawer/drawer.js";
21
+ import { FieldsetSlots, FieldsetVariants, fieldsetRecipe } from "./recipes/fieldset/fieldset.js";
22
+ import { FocusRingSlots, FocusRingVariants, focusRingRecipe } from "./recipes/focus-ring/focus-ring.js";
23
+ import { HeadingSlots, HeadingVariants, headingRecipe } from "./recipes/heading/heading.js";
24
+ import { HrSlots, HrVariants, hrRecipe } from "./recipes/hr/hr.js";
25
+ import { InputSlots, InputVariants, inputRecipe } from "./recipes/input/input.js";
26
+ import { LabelSlots, LabelVariants, labelRecipe } from "./recipes/label/label.js";
27
+ import { MenuitemSlots, MenuitemVariants, menuitemRecipe } from "./recipes/menu/menu.js";
28
+ import { ParagraphSlots, ParagraphVariants, paragraphRecipe } from "./recipes/paragraph/paragraph.js";
29
+ import { PopoverSlots, PopoverVariants, popoverRecipe } from "./recipes/popover/popover.js";
30
+ import { ProgressSlots, ProgressVariants, progressRecipe } from "./recipes/progress/progress.js";
31
+ import { RadioSlots, RadioVariants, radioRecipe } from "./recipes/radio/radio.js";
32
+ import { RadiogroupSlots, RadiogroupVariants, radiogroupRecipe } from "./recipes/radiogroup/radiogroup.js";
33
+ import { SectionSlots, SectionVariants, sectionRecipe } from "./recipes/section/section.js";
34
+ import { SegmentedControlItemSlots, SegmentedControlItemVariants, SegmentedControlRootSlots, SegmentedControlRootVariants, segmentedControlItemRecipe, segmentedControlRootRecipe } from "./recipes/segmented-control/segmented-control.js";
35
+ import { SelectSlots, SelectVariants, selectRecipe } from "./recipes/select/select.js";
36
+ import { CaptionSlots, CaptionVariants, TableSlots, TableVariants, TdSlots, TdVariants, ThSlots, ThVariants, TrSlots, TrVariants, captionRecipe, tableRecipe, tdRecipe, thRecipe, trRecipe } from "./recipes/table/table.js";
37
+ import { TabSlots, TabVariants, TablistSlots, TablistVariants, TabpanelSlots, TabpanelVariants, TabrootSlots, TabrootVariants, tabRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe } from "./recipes/tabs/tabs.js";
38
+ import { VisuallyHiddenSlots, VisuallyHiddenVariants, visuallyHiddenRecipe } from "./recipes/visually-hidden/visually-hidden.js";
39
+ import { InputControlAttributes, InputControlState, InputLabelAttributes, InputState, inputControl } from "./logics/input-control/input-control.js";
40
+ import { DEFAULT_LABEL_MAKER, LabelMarker, LabelMarkerData, LabelMarkerNodeData, LabelMarkerNullData, labelMarker } from "./logics/label-marker/label-marker.js";
41
+ import { MenuContentAttributeOptions, MenuContentAttributes, MenuItemActivation, MenuItemActivationOptions, MenuItemAttributeOptions, MenuItemAttributes, MenuState, MenuTriggerAttributeOptions, MenuTriggerAttributes, menuControl } from "./logics/menu-control/menu-control.js";
42
+ import { msAll } from "./logics/ms/ms-all.js";
43
+ import { PopoverContentAttributes, PopoverState, PopoverTriggerAttributeOptions, PopoverTriggerAttributes, popoverControl } from "./logics/popover-control/popover-control.js";
44
+ import { ProgressBarAttributes, ProgressLabelAttributes, ProgressResolveOptions, ProgressState, ProgressValueAttributes, progressControl } from "./logics/progress-control/progress-control.js";
45
+ import { RadioControlAttributes, RadioErrorAttributes, RadioLabelAttributes, RadioState, radioControl } from "./logics/radio-control/radio-control.js";
46
+ import { RadiogroupLabelAttributes, RadiogroupRootAttributes, RadiogroupState, radiogroupControl } from "./logics/radiogroup-control/radiogroup-control.js";
47
+ import { SegmentedControlItemAttributes, SegmentedControlItemState, segmentedControl } from "./logics/segmented-control/segmented-control.js";
48
+ import { TabsListAttributeOptions, TabsListAttributes, TabsPanelAttributes, TabsRootAttributes, TabsState, TabsTabAttributeOptions, TabsTabAttributes, tabsControl } from "./logics/tabs-control/tabs-control.js";
49
+ import { TooltipContentAttributes, TooltipState, TooltipTriggerAttributeOptions, TooltipTriggerAttributes, tooltipControl, triggerId } from "./logics/tooltip-control/tooltip-control.js";
50
+ 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 };
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ import { getAvatarPlaceholder } from "./logics/avatar-placeholder/get-avatar-placeholder.js";
2
+ import { shouldShowAvatarPlaceholder } from "./logics/avatar-placeholder/should-show-avatar-placeholder.js";
3
+ import { toBool } from "./logics/bool/to-bool.js";
4
+ import { toStrbool } from "./logics/bool/to-strbool.js";
5
+ import { cc } from "./logics/cc/cc.js";
6
+ import { ccAll } from "./logics/cc/cc-all.js";
7
+ import { inputControl } from "./logics/input-control/input-control.js";
8
+ import { checkboxControl } from "./logics/checkbox-control/checkbox-control.js";
9
+ import { dialogControl } from "./logics/dialog-control/dialog-control.js";
10
+ import { DEFAULT_LABEL_MAKER, labelMarker } from "./logics/label-marker/label-marker.js";
11
+ import { popoverControl } from "./logics/popover-control/popover-control.js";
12
+ import { menuControl } from "./logics/menu-control/menu-control.js";
13
+ import { msAll } from "./logics/ms/ms-all.js";
14
+ import { progressControl } from "./logics/progress-control/progress-control.js";
15
+ import { radioControl } from "./logics/radio-control/radio-control.js";
16
+ import { radiogroupControl } from "./logics/radiogroup-control/radiogroup-control.js";
17
+ import { segmentedControl } from "./logics/segmented-control/segmented-control.js";
18
+ import { tabsControl } from "./logics/tabs-control/tabs-control.js";
19
+ import { tooltipControl, triggerId } from "./logics/tooltip-control/tooltip-control.js";
20
+ import { alertRecipe } from "./recipes/alert/alert.js";
21
+ import { anchorRecipe } from "./recipes/anchor/anchor.js";
22
+ import { avatartRecipe } from "./recipes/avatar/avatar.js";
23
+ import { blockquoteRecipe } from "./recipes/blockquote/blockquote.js";
24
+ import { buttonRecipe } from "./recipes/button/button.js";
25
+ import { checkboxRecipe } from "./recipes/checkbox/checkbox.js";
26
+ import { codeRecipe } from "./recipes/code/code.js";
27
+ import { containerRecipe } from "./recipes/container/container.js";
28
+ import { detailsRecipe } from "./recipes/details/details.js";
29
+ import { dialogRecipe } from "./recipes/dialog/dialog.js";
30
+ import { ddRecipe, dlRecipe, dtRecipe } from "./recipes/dl/dl.js";
31
+ import { drawerRecipe } from "./recipes/drawer/drawer.js";
32
+ import { fieldsetRecipe } from "./recipes/fieldset/fieldset.js";
33
+ import { focusRingRecipe } from "./recipes/focus-ring/focus-ring.js";
34
+ import { headingRecipe } from "./recipes/heading/heading.js";
35
+ import { hrRecipe } from "./recipes/hr/hr.js";
36
+ import { inputRecipe } from "./recipes/input/input.js";
37
+ import { labelRecipe } from "./recipes/label/label.js";
38
+ import { menuitemRecipe } from "./recipes/menu/menu.js";
39
+ import { paragraphRecipe } from "./recipes/paragraph/paragraph.js";
40
+ import { popoverRecipe } from "./recipes/popover/popover.js";
41
+ import { progressRecipe } from "./recipes/progress/progress.js";
42
+ import { radioRecipe } from "./recipes/radio/radio.js";
43
+ import { radiogroupRecipe } from "./recipes/radiogroup/radiogroup.js";
44
+ import { sectionRecipe } from "./recipes/section/section.js";
45
+ import { segmentedControlItemRecipe, segmentedControlRootRecipe } from "./recipes/segmented-control/segmented-control.js";
46
+ import { selectRecipe } from "./recipes/select/select.js";
47
+ import { captionRecipe, tableRecipe, tdRecipe, thRecipe, trRecipe } from "./recipes/table/table.js";
48
+ import { tabRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe } from "./recipes/tabs/tabs.js";
49
+ import { visuallyHiddenRecipe } from "./recipes/visually-hidden/visually-hidden.js";
50
+ 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 };
@@ -0,0 +1,4 @@
1
+ //#region src/logics/avatar-placeholder/get-avatar-placeholder.d.ts
2
+ export declare function getAvatarPlaceholder(name: string): string;
3
+ //#endregion
4
+ //# sourceMappingURL=get-avatar-placeholder.d.ts.map
@@ -0,0 +1,10 @@
1
+ //#region src/logics/avatar-placeholder/get-avatar-placeholder.ts
2
+ function getAvatarPlaceholder(name) {
3
+ const normalizedName = name.trim();
4
+ if (/[^\p{ASCII}]/u.test(normalizedName)) return Array.from(normalizedName)[0] ?? "";
5
+ return normalizedName.split(/\s+/).map((word) => word[0]?.toUpperCase()).join("").slice(0, 2);
6
+ }
7
+ //#endregion
8
+ export { getAvatarPlaceholder };
9
+
10
+ //# sourceMappingURL=get-avatar-placeholder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-avatar-placeholder.js","names":[],"sources":["../../../src/logics/avatar-placeholder/get-avatar-placeholder.ts"],"sourcesContent":["export function getAvatarPlaceholder(name: string): string {\n const normalizedName = name.trim();\n\n if (/[^\\p{ASCII}]/u.test(normalizedName)) {\n return Array.from(normalizedName)[0] ?? \"\";\n }\n\n return normalizedName\n .split(/\\s+/)\n .map((word) => word[0]?.toUpperCase())\n .join(\"\")\n .slice(0, 2);\n}\n"],"mappings":";AAAA,SAAgB,qBAAqB,MAAsB;CACzD,MAAM,iBAAiB,KAAK,KAAK;CAEjC,IAAI,gBAAgB,KAAK,cAAc,GACrC,OAAO,MAAM,KAAK,cAAc,CAAC,CAAC,MAAM;CAG1C,OAAO,eACJ,MAAM,KAAK,CAAC,CACZ,KAAK,SAAS,KAAK,EAAE,EAAE,YAAY,CAAC,CAAC,CACrC,KAAK,EAAE,CAAC,CACR,MAAM,GAAG,CAAC;AACf"}
@@ -0,0 +1,12 @@
1
+ //#region src/logics/avatar-placeholder/should-show-avatar-placeholder.d.ts
2
+ export interface AvatarSource<Value = string> {
3
+ src?: Value | undefined;
4
+ srcSet?: Value | undefined;
5
+ }
6
+ interface AvatarPlaceholderOptions<Value = string> extends AvatarSource<Value> {
7
+ failedSource: AvatarSource<Value> | null;
8
+ }
9
+ export declare function shouldShowAvatarPlaceholder<Value = string>({ src, srcSet, failedSource }: AvatarPlaceholderOptions<Value>): boolean;
10
+ //#endregion
11
+ export {};
12
+ //# sourceMappingURL=should-show-avatar-placeholder.d.ts.map
@@ -0,0 +1,8 @@
1
+ //#region src/logics/avatar-placeholder/should-show-avatar-placeholder.ts
2
+ function shouldShowAvatarPlaceholder({ src, srcSet, failedSource }) {
3
+ return !src && !srcSet || failedSource !== null && failedSource.src === src && failedSource.srcSet === srcSet;
4
+ }
5
+ //#endregion
6
+ export { shouldShowAvatarPlaceholder };
7
+
8
+ //# sourceMappingURL=should-show-avatar-placeholder.js.map
@@ -0,0 +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>,\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"}
@@ -0,0 +1,4 @@
1
+ //#region src/logics/bool/to-bool.d.ts
2
+ export declare function toBool(value: boolean | "true" | "false" | null | undefined): boolean;
3
+ //#endregion
4
+ //# sourceMappingURL=to-bool.d.ts.map
@@ -0,0 +1,9 @@
1
+ //#region src/logics/bool/to-bool.ts
2
+ function toBool(value) {
3
+ if (value == null || value === void 0) return false;
4
+ return value !== false && value !== "false";
5
+ }
6
+ //#endregion
7
+ export { toBool };
8
+
9
+ //# sourceMappingURL=to-bool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-bool.js","names":[],"sources":["../../../src/logics/bool/to-bool.ts"],"sourcesContent":["export function toBool(value: boolean | \"true\" | \"false\" | null | undefined): boolean {\n if (value == null || value === undefined) return false;\n return value !== false && value !== \"false\";\n}\n"],"mappings":";AAAA,SAAgB,OAAO,OAA+D;CACpF,IAAI,SAAS,QAAQ,UAAU,KAAA,GAAW,OAAO;CACjD,OAAO,UAAU,SAAS,UAAU;AACtC"}
@@ -0,0 +1,5 @@
1
+ //#region src/logics/bool/to-strbool.d.ts
2
+ export type Strbool = "true" | "false";
3
+ export declare function toStrbool(value: boolean): Strbool;
4
+ //#endregion
5
+ //# sourceMappingURL=to-strbool.d.ts.map
@@ -0,0 +1,8 @@
1
+ //#region src/logics/bool/to-strbool.ts
2
+ function toStrbool(value) {
3
+ return value ? "true" : "false";
4
+ }
5
+ //#endregion
6
+ export { toStrbool };
7
+
8
+ //# sourceMappingURL=to-strbool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-strbool.js","names":[],"sources":["../../../src/logics/bool/to-strbool.ts"],"sourcesContent":["export type Strbool = \"true\" | \"false\";\n\nexport function toStrbool(value: boolean): Strbool {\n return value ? \"true\" : \"false\";\n}\n"],"mappings":";AAEA,SAAgB,UAAU,OAAyB;CACjD,OAAO,QAAQ,SAAS;AAC1B"}
@@ -0,0 +1,7 @@
1
+ //#region src/logics/cc/cc-all.d.ts
2
+ type SlotClassNames<S extends string> = Partial<Record<S, string | undefined>>;
3
+ /** 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>, ...overrides: SlotClassNames<S>[]): Record<S, string>;
5
+ //#endregion
6
+ export {};
7
+ //# sourceMappingURL=cc-all.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { cc } from "./cc.js";
2
+ //#region src/logics/cc/cc-all.ts
3
+ /** Apply cc() to every slot of a recipe result, merging optional user overrides. Lovery C.C. **/
4
+ function ccAll(recipe, ...overrides) {
5
+ const result = {};
6
+ for (const key in recipe) {
7
+ const targets = overrides.map((o) => o?.[key]);
8
+ result[key] = cc(recipe[key], ...targets);
9
+ }
10
+ return result;
11
+ }
12
+ //#endregion
13
+ export { ccAll };
14
+
15
+ //# sourceMappingURL=cc-all.js.map
@@ -0,0 +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>,\n ...overrides: 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"}
@@ -0,0 +1,7 @@
1
+ //#region src/logics/cc/cc.d.ts
2
+ type ClassNameLike = string | null | undefined;
3
+ /** Concat ClassNames. Lovely C.C. **/
4
+ export declare function cc(...classNames: ClassNameLike[]): string;
5
+ //#endregion
6
+ export {};
7
+ //# sourceMappingURL=cc.d.ts.map
@@ -0,0 +1,9 @@
1
+ //#region src/logics/cc/cc.ts
2
+ /** Concat ClassNames. Lovely C.C. **/
3
+ function cc(...classNames) {
4
+ return classNames.filter(Boolean).join(" ");
5
+ }
6
+ //#endregion
7
+ export { cc };
8
+
9
+ //# sourceMappingURL=cc.js.map
@@ -0,0 +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,YAAqC;CACzD,OAAO,WACJ,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;AACb"}
@@ -0,0 +1,33 @@
1
+ import { Strbool } from "../bool/to-strbool.js";
2
+ //#region src/logics/checkbox-control/checkbox-control.d.ts
3
+ export interface CheckboxState {
4
+ id: string;
5
+ invalid: boolean;
6
+ indeterminate: boolean;
7
+ disabled: boolean;
8
+ }
9
+ export interface CheckboxControlAttributes {
10
+ type: "checkbox";
11
+ id: string;
12
+ "aria-invalid": boolean;
13
+ "aria-describedby": string | undefined;
14
+ "aria-checked": "mixed" | undefined;
15
+ }
16
+ declare function getControlAttributes(state: CheckboxState): CheckboxControlAttributes;
17
+ export interface CheckboxLabelAttributes {
18
+ for: string;
19
+ "data-disabled": Strbool;
20
+ }
21
+ declare function getLabelAttributes(state: CheckboxState): CheckboxLabelAttributes;
22
+ export interface CheckboxErrorAttributes {
23
+ id: string;
24
+ }
25
+ declare function getErrorAttributes(state: CheckboxState): CheckboxErrorAttributes;
26
+ export declare const checkboxControl: {
27
+ readonly getControlAttributes: typeof getControlAttributes;
28
+ readonly getLabelAttributes: typeof getLabelAttributes;
29
+ readonly getErrorAttributes: typeof getErrorAttributes;
30
+ };
31
+ //#endregion
32
+ export {};
33
+ //# sourceMappingURL=checkbox-control.d.ts.map
@@ -0,0 +1,32 @@
1
+ import { toStrbool } from "../bool/to-strbool.js";
2
+ import { inputControl } from "../input-control/input-control.js";
3
+ //#region src/logics/checkbox-control/checkbox-control.ts
4
+ function errorId(state) {
5
+ return `${state.id}-error`;
6
+ }
7
+ function getControlAttributes(state) {
8
+ return {
9
+ type: "checkbox",
10
+ ...inputControl.getControlAttributes(state),
11
+ "aria-describedby": state.invalid ? errorId(state) : void 0,
12
+ "aria-checked": state.indeterminate ? "mixed" : void 0
13
+ };
14
+ }
15
+ function getLabelAttributes(state) {
16
+ return {
17
+ for: state.id,
18
+ "data-disabled": toStrbool(state.disabled)
19
+ };
20
+ }
21
+ function getErrorAttributes(state) {
22
+ return { id: errorId(state) };
23
+ }
24
+ const checkboxControl = {
25
+ getControlAttributes,
26
+ getLabelAttributes,
27
+ getErrorAttributes
28
+ };
29
+ //#endregion
30
+ export { checkboxControl };
31
+
32
+ //# sourceMappingURL=checkbox-control.js.map
@@ -0,0 +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 \"aria-checked\": \"mixed\" | undefined;\n}\n\nfunction getControlAttributes(state: 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 \"aria-checked\": state.indeterminate ? \"mixed\" : undefined,\n };\n}\n\nexport interface CheckboxLabelAttributes {\n for: string;\n \"data-disabled\": Strbool;\n}\n\nfunction getLabelAttributes(state: 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: 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,OAA8B;CAC7C,OAAO,GAAG,MAAM,GAAG;AACrB;AAUA,SAAS,qBAAqB,OAAiD;CAG7E,OAAO;EACL,MAAM;EACN,GAJsB,aAAa,qBAAqB,KAIvC;EACjB,oBAAoB,MAAM,UAAU,QAAQ,KAAK,IAAI,KAAA;EACrD,gBAAgB,MAAM,gBAAgB,UAAU,KAAA;CAClD;AACF;AAOA,SAAS,mBAAmB,OAA+C;CACzE,OAAO;EACL,KAAK,MAAM;EACX,iBAAiB,UAAU,MAAM,QAAQ;CAC3C;AACF;AAMA,SAAS,mBAAmB,OAA+C;CACzE,OAAO,EACL,IAAI,QAAQ,KAAK,EACnB;AACF;AAEA,MAAa,kBAAkB;CAC7B;CACA;CACA;AACF"}
@@ -0,0 +1,48 @@
1
+ //#region src/logics/dialog-control/dialog-control.d.ts
2
+ export interface DialogState {
3
+ id: string;
4
+ }
5
+ declare function headingId(dialogId: string): string;
6
+ export interface DialogTriggerAttributeOptions {
7
+ modal: boolean;
8
+ isButtonElement: boolean;
9
+ }
10
+ export interface DialogTriggerAttributes {
11
+ type: "button" | undefined;
12
+ command: "show-modal" | undefined;
13
+ commandfor: string | undefined;
14
+ }
15
+ declare function getTriggerAttributes(state: DialogState, options: DialogTriggerAttributeOptions): DialogTriggerAttributes;
16
+ export interface DialogContentAttributeOptions {
17
+ hasHeading: boolean;
18
+ ariaLabel?: string | undefined;
19
+ ariaLabelledBy?: string | undefined;
20
+ }
21
+ export interface DialogContentAttributes {
22
+ id: string;
23
+ "aria-label": string | undefined;
24
+ "aria-labelledby": string | undefined;
25
+ }
26
+ declare function getContentAttributes(state: DialogState, options: DialogContentAttributeOptions): DialogContentAttributes;
27
+ export interface DialogHeadingAttributes {
28
+ id: string;
29
+ }
30
+ declare function getHeadingAttributes(state: DialogState): DialogHeadingAttributes;
31
+ export interface DialogCloseAttributes {
32
+ type: "button";
33
+ command: "request-close";
34
+ commandfor: string;
35
+ }
36
+ declare function getCloseAttributes(state: DialogState): DialogCloseAttributes;
37
+ declare function openDialog(dialogId: string, modal: boolean): void;
38
+ export declare const dialogControl: {
39
+ readonly getTriggerAttributes: typeof getTriggerAttributes;
40
+ readonly getContentAttributes: typeof getContentAttributes;
41
+ readonly getHeadingAttributes: typeof getHeadingAttributes;
42
+ readonly getCloseAttributes: typeof getCloseAttributes;
43
+ readonly openDialog: typeof openDialog;
44
+ readonly headingId: typeof headingId;
45
+ };
46
+ //#endregion
47
+ export {};
48
+ //# sourceMappingURL=dialog-control.d.ts.map
@@ -0,0 +1,51 @@
1
+ //#region src/logics/dialog-control/dialog-control.ts
2
+ function headingId(dialogId) {
3
+ return `${dialogId}-heading`;
4
+ }
5
+ function getTriggerAttributes(state, options) {
6
+ return {
7
+ type: options.isButtonElement ? "button" : void 0,
8
+ command: options.modal ? "show-modal" : void 0,
9
+ commandfor: options.modal ? state.id : void 0
10
+ };
11
+ }
12
+ function getContentAttributes(state, options) {
13
+ return {
14
+ id: state.id,
15
+ "aria-label": options.ariaLabel,
16
+ "aria-labelledby": options.ariaLabelledBy ?? (!options.ariaLabel && options.hasHeading ? headingId(state.id) : void 0)
17
+ };
18
+ }
19
+ function getHeadingAttributes(state) {
20
+ return { id: headingId(state.id) };
21
+ }
22
+ function getCloseAttributes(state) {
23
+ return {
24
+ type: "button",
25
+ command: "request-close",
26
+ commandfor: state.id
27
+ };
28
+ }
29
+ function getDialogElement(dialogId) {
30
+ const element = document.getElementById(dialogId);
31
+ if (!(element instanceof HTMLDialogElement)) throw new Error("[Hebium UI|Dialog] Dialog element is not found");
32
+ return element;
33
+ }
34
+ function openDialog(dialogId, modal) {
35
+ const element = getDialogElement(dialogId);
36
+ if (element.open) return;
37
+ if (modal) element.showModal();
38
+ else element.show();
39
+ }
40
+ const dialogControl = {
41
+ getTriggerAttributes,
42
+ getContentAttributes,
43
+ getHeadingAttributes,
44
+ getCloseAttributes,
45
+ openDialog,
46
+ headingId
47
+ };
48
+ //#endregion
49
+ export { dialogControl };
50
+
51
+ //# sourceMappingURL=dialog-control.js.map
@@ -0,0 +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,\n options: 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: DialogState,\n options: 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: 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: 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,OAA6C;CACzE,OAAO,EACL,IAAI,UAAU,MAAM,EAAE,EACxB;AACF;AAQA,SAAS,mBAAmB,OAA2C;CACrE,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"}
@@ -0,0 +1,29 @@
1
+ import { LabelVariants } from "../../recipes/label/label.js";
2
+ //#region src/logics/input-control/input-control.d.ts
3
+ export interface InputControlState {
4
+ id: string;
5
+ invalid: boolean;
6
+ }
7
+ export interface InputState extends InputControlState {
8
+ required: boolean;
9
+ disabled: boolean;
10
+ readOnly?: boolean | undefined;
11
+ }
12
+ export interface InputControlAttributes {
13
+ id: string;
14
+ "aria-invalid": boolean;
15
+ }
16
+ declare function getControlAttributes(state: InputControlState): InputControlAttributes;
17
+ export interface InputLabelAttributes {
18
+ for: string;
19
+ "data-required": boolean;
20
+ variant: LabelVariants["variant"] | undefined;
21
+ }
22
+ declare function getLabelAttributes(state: InputState): InputLabelAttributes;
23
+ export declare const inputControl: {
24
+ readonly getControlAttributes: typeof getControlAttributes;
25
+ readonly getLabelAttributes: typeof getLabelAttributes;
26
+ };
27
+ //#endregion
28
+ export {};
29
+ //# sourceMappingURL=input-control.d.ts.map
@@ -0,0 +1,22 @@
1
+ //#region src/logics/input-control/input-control.ts
2
+ function getControlAttributes(state) {
3
+ return {
4
+ id: state.id,
5
+ "aria-invalid": state.invalid
6
+ };
7
+ }
8
+ function getLabelAttributes(state) {
9
+ return {
10
+ for: state.id,
11
+ "data-required": state.required,
12
+ variant: state.disabled ? "disabled" : state.readOnly ? "readonly" : void 0
13
+ };
14
+ }
15
+ const inputControl = {
16
+ getControlAttributes,
17
+ getLabelAttributes
18
+ };
19
+ //#endregion
20
+ export { inputControl };
21
+
22
+ //# sourceMappingURL=input-control.js.map
@@ -0,0 +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,OAAkD;CAC9E,OAAO;EACL,IAAI,MAAM;EACV,gBAAgB,MAAM;CACxB;AACF;AAQA,SAAS,mBAAmB,OAAyC;CACnE,OAAO;EACL,KAAK,MAAM;EACX,iBAAiB,MAAM;EACvB,SAAS,MAAM,WAAW,aAAa,MAAM,WAAW,aAAa,KAAA;CACvE;AACF;AAEA,MAAa,eAAe;CAC1B;CACA;AACF"}
@@ -0,0 +1,36 @@
1
+ import { LabelVariants } from "../../recipes/label/label.js";
2
+ //#region src/logics/label-marker/label-marker.d.ts
3
+ interface BaseMarker<Node> {
4
+ label: Node;
5
+ "aria-label"?: string | undefined;
6
+ /**
7
+ * The visual style of the marker. Defaults to `"asterisk"` when `label` is `"*"`, otherwise `"text"`.
8
+ */
9
+ variant?: LabelVariants["marker"] | undefined;
10
+ }
11
+ interface RequiredMarker<Node> extends BaseMarker<Node> {
12
+ type: "required";
13
+ }
14
+ interface OptionalMarker<Node> extends BaseMarker<Node> {
15
+ type: "optional";
16
+ }
17
+ export type LabelMarker<Node> = RequiredMarker<Node> | OptionalMarker<Node> | {
18
+ type: "none";
19
+ };
20
+ export interface LabelMarkerNullData {
21
+ label: null;
22
+ }
23
+ export interface LabelMarkerNodeData<Node> {
24
+ label: Node;
25
+ variant: LabelVariants["marker"];
26
+ "aria-label"?: string | undefined;
27
+ }
28
+ export type LabelMarkerData<Node> = LabelMarkerNullData | LabelMarkerNodeData<Node>;
29
+ export declare const DEFAULT_LABEL_MAKER: {
30
+ readonly type: "required";
31
+ readonly label: "(required)";
32
+ };
33
+ export declare function labelMarker<Node>(marker: LabelMarker<Node>, required: boolean | undefined): LabelMarkerData<Node>;
34
+ //#endregion
35
+ export {};
36
+ //# sourceMappingURL=label-marker.d.ts.map
@@ -0,0 +1,19 @@
1
+ //#region src/logics/label-marker/label-marker.ts
2
+ const DEFAULT_LABEL_MAKER = {
3
+ type: "required",
4
+ label: "(required)"
5
+ };
6
+ function labelMarker(marker, required) {
7
+ if (marker.type === "none") return { label: null };
8
+ if (!(marker.type === "required" ? required : !required)) return { label: null };
9
+ const ariaLabel = "aria-label" in marker ? marker["aria-label"] : void 0;
10
+ return {
11
+ label: marker.label,
12
+ variant: marker.variant ?? (marker.label === "*" ? "asterisk" : "text"),
13
+ ...ariaLabel !== void 0 && { "aria-label": ariaLabel }
14
+ };
15
+ }
16
+ //#endregion
17
+ export { DEFAULT_LABEL_MAKER, labelMarker };
18
+
19
+ //# sourceMappingURL=label-marker.js.map
@@ -0,0 +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>, required: boolean | undefined): 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,YAAkB,QAA2B,UAAsD;CACjH,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"}