@k8ordo/ui 1.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +206 -171
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/components/_internal/focus-ring.css +37 -0
- package/dist/components/_internal/focus-ring.module.mjs +9 -0
- package/dist/components/_internal/form-value.d.mts +33 -0
- package/dist/components/_internal/form-value.mjs +91 -0
- package/dist/components/_internal/high-contrast.css +18 -0
- package/dist/components/_internal/high-contrast.module.mjs +5 -0
- package/dist/components/_internal/ignore-changes.d.mts +20 -0
- package/dist/components/_internal/ignore-changes.mjs +37 -0
- package/dist/components/_internal/nav-link.css +78 -0
- package/dist/components/_internal/nav-link.d.mts +5 -0
- package/dist/components/_internal/nav-link.mjs +8 -0
- package/dist/components/_internal/nav-link.module.mjs +14 -0
- package/dist/components/_internal/sr-only.css +17 -0
- package/dist/components/_internal/sr-only.module.mjs +5 -0
- package/dist/components/_internal/status-tone.css +37 -0
- package/dist/components/_internal/status-tone.d.mts +20 -0
- package/dist/components/_internal/status-tone.mjs +22 -0
- package/dist/components/_internal/status-tone.module.mjs +14 -0
- package/dist/components/ai/_internal/attachment-preview.css +75 -0
- package/dist/components/ai/_internal/attachment-preview.d.mts +14 -0
- package/dist/components/ai/_internal/attachment-preview.mjs +50 -0
- package/dist/components/ai/_internal/attachment-preview.module.mjs +14 -0
- package/dist/components/ai/_internal/collapsible.css +62 -0
- package/dist/components/ai/_internal/collapsible.d.mts +4 -3
- package/dist/components/ai/_internal/collapsible.mjs +42 -33
- package/dist/components/ai/_internal/collapsible.module.mjs +12 -0
- package/dist/components/ai/_internal/icons.d.mts +7 -0
- package/dist/components/ai/_internal/icons.mjs +14 -0
- package/dist/components/ai/_internal/streaming-cursor.css +28 -0
- package/dist/components/ai/_internal/streaming-cursor.d.mts +2 -3
- package/dist/components/ai/_internal/streaming-cursor.mjs +2 -1
- package/dist/components/ai/_internal/streaming-cursor.module.mjs +8 -0
- package/dist/components/ai/attachment/attachment.css +17 -0
- package/dist/components/ai/attachment/attachment.d.mts +14 -0
- package/dist/components/ai/attachment/attachment.mjs +25 -0
- package/dist/components/ai/attachment/attachment.module.mjs +8 -0
- package/dist/components/ai/attachment/index.d.mts +13 -0
- package/dist/components/ai/attachment/index.mjs +8 -0
- package/dist/components/ai/conversation/conversation.css +71 -0
- package/dist/components/ai/conversation/conversation.d.mts +8 -11
- package/dist/components/ai/conversation/conversation.mjs +39 -40
- package/dist/components/ai/conversation/conversation.module.mjs +11 -0
- package/dist/components/ai/conversation/index.d.mts +15 -2
- package/dist/components/ai/conversation/index.mjs +8 -1
- package/dist/components/ai/index.d.mts +8 -10
- package/dist/components/ai/index.mjs +7 -5
- package/dist/components/ai/message/index.d.mts +39 -2
- package/dist/components/ai/message/index.mjs +12 -1
- package/dist/components/ai/message/message.css +71 -0
- package/dist/components/ai/message/message.d.mts +33 -5
- package/dist/components/ai/message/message.mjs +98 -12
- package/dist/components/ai/message/message.module.mjs +18 -0
- package/dist/components/ai/prompt-input/index.d.mts +31 -2
- package/dist/components/ai/prompt-input/index.mjs +10 -1
- package/dist/components/ai/prompt-input/prompt-input.css +101 -0
- package/dist/components/ai/prompt-input/prompt-input.d.mts +15 -8
- package/dist/components/ai/prompt-input/prompt-input.mjs +152 -42
- package/dist/components/ai/prompt-input/prompt-input.module.mjs +15 -0
- package/dist/components/ai/reasoning/reasoning.css +16 -0
- package/dist/components/ai/reasoning/reasoning.d.mts +2 -3
- package/dist/components/ai/reasoning/reasoning.mjs +5 -5
- package/dist/components/ai/reasoning/reasoning.module.mjs +8 -0
- package/dist/components/ai/response/response.css +453 -0
- package/dist/components/ai/response/response.d.mts +4 -6
- package/dist/components/ai/response/response.mjs +20 -15
- package/dist/components/ai/response/response.module.mjs +8 -0
- package/dist/components/ai/source/index.d.mts +12 -0
- package/dist/components/ai/source/index.mjs +8 -0
- package/dist/components/ai/source/source.css +54 -0
- package/dist/components/ai/source/source.d.mts +13 -0
- package/dist/components/ai/source/source.mjs +51 -0
- package/dist/components/ai/source/source.module.mjs +12 -0
- package/dist/components/ai/suggestion/index.d.mts +13 -2
- package/dist/components/ai/suggestion/index.mjs +7 -1
- package/dist/components/ai/suggestion/suggestion.css +32 -0
- package/dist/components/ai/suggestion/suggestion.d.mts +3 -6
- package/dist/components/ai/suggestion/suggestion.mjs +8 -11
- package/dist/components/ai/suggestion/suggestion.module.mjs +8 -0
- package/dist/components/ai/tool-invocation/approval-bar.css +26 -0
- package/dist/components/ai/tool-invocation/approval-bar.d.mts +11 -0
- package/dist/components/ai/tool-invocation/approval-bar.mjs +59 -0
- package/dist/components/ai/tool-invocation/approval-bar.module.mjs +9 -0
- package/dist/components/ai/tool-invocation/tool-invocation.css +55 -0
- package/dist/components/ai/tool-invocation/tool-invocation.d.mts +5 -5
- package/dist/components/ai/tool-invocation/tool-invocation.mjs +39 -18
- package/dist/components/ai/tool-invocation/tool-invocation.module.mjs +15 -0
- package/dist/components/ai/types.d.mts +21 -4
- package/dist/components/buttons/button/button.css +158 -0
- package/dist/components/buttons/button/button.d.mts +32 -9
- package/dist/components/buttons/button/button.mjs +46 -36
- package/dist/components/buttons/button/button.module.mjs +23 -0
- package/dist/components/buttons/button/index.d.mts +2 -2
- package/dist/components/buttons/copy-button/copy-button.css +15 -0
- package/dist/components/buttons/copy-button/copy-button.d.mts +10 -0
- package/dist/components/buttons/copy-button/copy-button.mjs +70 -0
- package/dist/components/buttons/copy-button/copy-button.module.mjs +8 -0
- package/dist/components/buttons/copy-button/index.d.mts +2 -0
- package/dist/components/buttons/copy-button/index.mjs +2 -0
- package/dist/components/buttons/icon-button/icon-button.css +81 -0
- package/dist/components/buttons/icon-button/icon-button.d.mts +39 -12
- package/dist/components/buttons/icon-button/icon-button.mjs +71 -58
- package/dist/components/buttons/icon-button/icon-button.module.mjs +15 -0
- package/dist/components/buttons/icon-button/index.d.mts +2 -2
- package/dist/components/buttons/toolbar/index.d.mts +14 -0
- package/dist/components/buttons/toolbar/index.mjs +9 -0
- package/dist/components/buttons/toolbar/toolbar.css +30 -0
- package/dist/components/buttons/toolbar/toolbar.d.mts +18 -0
- package/dist/components/buttons/toolbar/toolbar.mjs +111 -0
- package/dist/components/buttons/toolbar/toolbar.module.mjs +9 -0
- package/dist/components/data-display/accordion/accordion-button.css +48 -0
- package/dist/components/data-display/accordion/accordion-button.d.mts +2 -3
- package/dist/components/data-display/accordion/accordion-button.mjs +5 -4
- package/dist/components/data-display/accordion/accordion-button.module.mjs +9 -0
- package/dist/components/data-display/accordion/accordion-item.css +11 -0
- package/dist/components/data-display/accordion/accordion-item.d.mts +2 -3
- package/dist/components/data-display/accordion/accordion-item.mjs +2 -1
- package/dist/components/data-display/accordion/accordion-item.module.mjs +5 -0
- package/dist/components/data-display/accordion/accordion-panel.css +9 -0
- package/dist/components/data-display/accordion/accordion-panel.d.mts +2 -3
- package/dist/components/data-display/accordion/accordion-panel.mjs +2 -2
- package/dist/components/data-display/accordion/accordion-panel.module.mjs +5 -0
- package/dist/components/data-display/accordion/accordion.css +19 -0
- package/dist/components/data-display/accordion/accordion.d.mts +2 -3
- package/dist/components/data-display/accordion/accordion.mjs +2 -1
- package/dist/components/data-display/accordion/accordion.module.mjs +5 -0
- package/dist/components/data-display/accordion/context.d.mts +3 -3
- package/dist/components/data-display/accordion/index.d.mts +2 -3
- package/dist/components/data-display/avatar/avatar.css +95 -0
- package/dist/components/data-display/avatar/avatar.d.mts +2 -3
- package/dist/components/data-display/avatar/avatar.mjs +22 -6
- package/dist/components/data-display/avatar/avatar.module.mjs +18 -0
- package/dist/components/data-display/badge/badge.css +160 -0
- package/dist/components/data-display/badge/badge.d.mts +2 -3
- package/dist/components/data-display/badge/badge.mjs +30 -5
- package/dist/components/data-display/badge/badge.module.mjs +21 -0
- package/dist/components/data-display/card/card.css +44 -0
- package/dist/components/data-display/card/card.d.mts +2 -3
- package/dist/components/data-display/card/card.mjs +12 -2
- package/dist/components/data-display/card/card.module.mjs +12 -0
- package/dist/components/data-display/carousel/carousel.css +83 -0
- package/dist/components/data-display/carousel/carousel.d.mts +11 -0
- package/dist/components/data-display/carousel/carousel.mjs +186 -0
- package/dist/components/data-display/carousel/carousel.module.mjs +18 -0
- package/dist/components/data-display/carousel/index.d.mts +11 -0
- package/dist/components/data-display/carousel/index.mjs +8 -0
- package/dist/components/data-display/code/code.css +37 -0
- package/dist/components/data-display/code/code.d.mts +2 -3
- package/dist/components/data-display/code/code.mjs +7 -6
- package/dist/components/data-display/code/code.module.mjs +9 -0
- package/dist/components/data-display/code/find-all-colors.d.mts +2 -3
- package/dist/components/data-display/code/find-all-colors.mjs +0 -161
- package/dist/components/data-display/code-block/code-block.css +161 -0
- package/dist/components/data-display/code-block/code-block.d.mts +12 -0
- package/dist/components/data-display/code-block/code-block.mjs +44 -0
- package/dist/components/data-display/code-block/code-block.module.mjs +11 -0
- package/dist/components/data-display/code-block/highlight.d.mts +9 -0
- package/dist/components/data-display/code-block/highlight.mjs +54 -0
- package/dist/components/data-display/code-block/index.d.mts +2 -0
- package/dist/components/data-display/code-block/index.mjs +2 -0
- package/dist/components/data-display/data-table/data-table.css +74 -0
- package/dist/components/data-display/data-table/data-table.d.mts +31 -0
- package/dist/components/data-display/data-table/data-table.mjs +155 -0
- package/dist/components/data-display/data-table/data-table.module.mjs +14 -0
- package/dist/components/data-display/data-table/index.d.mts +2 -0
- package/dist/components/data-display/data-table/index.mjs +2 -0
- package/dist/components/data-display/heading/heading.css +99 -0
- package/dist/components/data-display/heading/heading.d.mts +2 -3
- package/dist/components/data-display/heading/heading.mjs +15 -14
- package/dist/components/data-display/heading/heading.module.mjs +20 -0
- package/dist/components/data-display/kbd/index.d.mts +2 -0
- package/dist/components/data-display/kbd/index.mjs +2 -0
- package/dist/components/data-display/kbd/kbd.css +21 -0
- package/dist/components/data-display/kbd/kbd.d.mts +8 -0
- package/dist/components/data-display/kbd/kbd.mjs +17 -0
- package/dist/components/data-display/kbd/kbd.module.mjs +5 -0
- package/dist/components/data-display/prose/index.d.mts +2 -0
- package/dist/components/data-display/prose/index.mjs +2 -0
- package/dist/components/data-display/prose/prose.css +253 -0
- package/dist/components/data-display/prose/prose.d.mts +5 -0
- package/dist/components/data-display/prose/prose.mjs +10 -0
- package/dist/components/data-display/prose/prose.module.mjs +5 -0
- package/dist/components/data-display/table/table.css +107 -0
- package/dist/components/data-display/table/table.d.mts +10 -9
- package/dist/components/data-display/table/table.mjs +26 -15
- package/dist/components/data-display/table/table.module.mjs +22 -0
- package/dist/components/data-display/tree/index.d.mts +2 -0
- package/dist/components/data-display/tree/index.mjs +2 -0
- package/dist/components/data-display/tree/tree.css +84 -0
- package/dist/components/data-display/tree/tree.d.mts +20 -0
- package/dist/components/data-display/tree/tree.mjs +151 -0
- package/dist/components/data-display/tree/tree.module.mjs +15 -0
- package/dist/components/feedback/alert/alert.css +42 -0
- package/dist/components/feedback/alert/alert.d.mts +3 -4
- package/dist/components/feedback/alert/alert.mjs +20 -23
- package/dist/components/feedback/alert/alert.module.mjs +14 -0
- package/dist/components/feedback/callout/callout.css +38 -0
- package/dist/components/feedback/callout/callout.d.mts +10 -0
- package/dist/components/feedback/callout/callout.mjs +38 -0
- package/dist/components/feedback/callout/callout.module.mjs +11 -0
- package/dist/components/feedback/callout/index.d.mts +2 -0
- package/dist/components/feedback/callout/index.mjs +2 -0
- package/dist/components/feedback/empty-state/empty-state.css +36 -0
- package/dist/components/feedback/empty-state/empty-state.d.mts +10 -0
- package/dist/components/feedback/empty-state/empty-state.mjs +27 -0
- package/dist/components/feedback/empty-state/empty-state.module.mjs +11 -0
- package/dist/components/feedback/empty-state/index.d.mts +2 -0
- package/dist/components/feedback/empty-state/index.mjs +2 -0
- package/dist/components/feedback/progress/progress.css +78 -0
- package/dist/components/feedback/progress/progress.d.mts +5 -5
- package/dist/components/feedback/progress/progress.mjs +17 -3
- package/dist/components/feedback/progress/progress.module.mjs +12 -0
- package/dist/components/feedback/skeleton/skeleton.css +64 -0
- package/dist/components/feedback/skeleton/skeleton.d.mts +2 -3
- package/dist/components/feedback/skeleton/skeleton.mjs +19 -2
- package/dist/components/feedback/skeleton/skeleton.module.mjs +17 -0
- package/dist/components/feedback/spinner/spinner.css +40 -0
- package/dist/components/feedback/spinner/spinner.d.mts +2 -3
- package/dist/components/feedback/spinner/spinner.mjs +13 -7
- package/dist/components/feedback/spinner/spinner.module.mjs +12 -0
- package/dist/components/feedback/toast/context.d.mts +8 -9
- package/dist/components/feedback/toast/provider.css +69 -0
- package/dist/components/feedback/toast/provider.d.mts +2 -3
- package/dist/components/feedback/toast/provider.mjs +17 -13
- package/dist/components/feedback/toast/provider.module.mjs +12 -0
- package/dist/components/feedback/toast/toast.d.mts +2 -3
- package/dist/components/form/autocomplete/autocomplete.css +154 -0
- package/dist/components/form/autocomplete/autocomplete.d.mts +2 -3
- package/dist/components/form/autocomplete/autocomplete.mjs +70 -46
- package/dist/components/form/autocomplete/autocomplete.module.mjs +21 -0
- package/dist/components/form/calendar/calendar.css +98 -0
- package/dist/components/form/calendar/calendar.d.mts +14 -0
- package/dist/components/form/calendar/calendar.mjs +182 -0
- package/dist/components/form/calendar/calendar.module.mjs +18 -0
- package/dist/components/form/calendar/index.d.mts +2 -0
- package/dist/components/form/calendar/index.mjs +2 -0
- package/dist/components/form/checkbox/checkbox.css +90 -0
- package/dist/components/form/checkbox/checkbox.d.mts +5 -3
- package/dist/components/form/checkbox/checkbox.mjs +30 -27
- package/dist/components/form/checkbox/checkbox.module.mjs +13 -0
- package/dist/components/form/checkbox-card/checkbox-card.css +138 -0
- package/dist/components/form/checkbox-card/checkbox-card.d.mts +3 -4
- package/dist/components/form/checkbox-card/checkbox-card.mjs +17 -23
- package/dist/components/form/checkbox-card/checkbox-card.module.mjs +17 -0
- package/dist/components/form/checkbox-group/checkbox-group.css +15 -0
- package/dist/components/form/checkbox-group/checkbox-group.d.mts +7 -5
- package/dist/components/form/checkbox-group/checkbox-group.mjs +12 -16
- package/dist/components/form/checkbox-group/checkbox-group.module.mjs +8 -0
- package/dist/components/form/checkbox-group/index.d.mts +5 -3
- package/dist/components/form/color-picker/color-picker.css +172 -0
- package/dist/components/form/color-picker/color-picker.d.mts +28 -0
- package/dist/components/form/color-picker/color-picker.mjs +239 -0
- package/dist/components/form/color-picker/color-picker.module.mjs +20 -0
- package/dist/components/form/color-picker/index.d.mts +2 -0
- package/dist/components/form/color-picker/index.mjs +2 -0
- package/dist/components/form/combobox/combobox.css +143 -0
- package/dist/components/form/combobox/combobox.d.mts +32 -0
- package/dist/components/form/combobox/combobox.mjs +278 -0
- package/dist/components/form/combobox/combobox.module.mjs +19 -0
- package/dist/components/form/combobox/index.d.mts +2 -0
- package/dist/components/form/combobox/index.mjs +2 -0
- package/dist/components/form/date-field/date-field.css +31 -0
- package/dist/components/form/date-field/date-field.d.mts +8 -0
- package/dist/components/form/date-field/date-field.mjs +20 -0
- package/dist/components/form/date-field/date-field.module.mjs +5 -0
- package/dist/components/form/date-field/index.d.mts +2 -0
- package/dist/components/form/date-field/index.mjs +2 -0
- package/dist/components/form/date-picker/date-picker.css +90 -0
- package/dist/components/form/date-picker/date-picker.d.mts +12 -0
- package/dist/components/form/date-picker/date-picker.mjs +77 -0
- package/dist/components/form/date-picker/date-picker.module.mjs +14 -0
- package/dist/components/form/date-picker/index.d.mts +2 -0
- package/dist/components/form/date-picker/index.mjs +2 -0
- package/dist/components/form/file-field/file-field.css +88 -0
- package/dist/components/form/file-field/file-field.d.mts +18 -19
- package/dist/components/form/file-field/file-field.mjs +130 -42
- package/dist/components/form/file-field/file-field.module.mjs +17 -0
- package/dist/components/form/file-field/index.d.mts +20 -2
- package/dist/components/form/file-field/index.mjs +9 -1
- package/dist/components/form/form/form.css +11 -0
- package/dist/components/form/form/form.d.mts +4 -4
- package/dist/components/form/form/form.mjs +2 -1
- package/dist/components/form/form/form.module.mjs +5 -0
- package/dist/components/form/form-control/form-control.css +43 -0
- package/dist/components/form/form-control/form-control.d.mts +2 -3
- package/dist/components/form/form-control/form-control.mjs +11 -10
- package/dist/components/form/form-control/form-control.module.mjs +12 -0
- package/dist/components/form/number-field/cast.d.mts +2 -3
- package/dist/components/form/number-field/cast.mjs +3 -22
- package/dist/components/form/number-field/number-field.css +122 -0
- package/dist/components/form/number-field/number-field.d.mts +10 -10
- package/dist/components/form/number-field/number-field.mjs +126 -54
- package/dist/components/form/number-field/number-field.module.mjs +10 -0
- package/dist/components/form/password-input/password-input.css +88 -0
- package/dist/components/form/password-input/password-input.d.mts +2 -3
- package/dist/components/form/password-input/password-input.mjs +15 -12
- package/dist/components/form/password-input/password-input.module.mjs +12 -0
- package/dist/components/form/radio/radio.css +89 -0
- package/dist/components/form/radio/radio.d.mts +4 -3
- package/dist/components/form/radio/radio.mjs +16 -19
- package/dist/components/form/radio/radio.module.mjs +16 -0
- package/dist/components/form/radio-card/radio-card.css +147 -0
- package/dist/components/form/radio-card/radio-card.d.mts +4 -4
- package/dist/components/form/radio-card/radio-card.mjs +17 -23
- package/dist/components/form/radio-card/radio-card.module.mjs +19 -0
- package/dist/components/form/range-slider/index.d.mts +2 -0
- package/dist/components/form/range-slider/index.mjs +2 -0
- package/dist/components/form/range-slider/range-slider.css +67 -0
- package/dist/components/form/range-slider/range-slider.d.mts +30 -0
- package/dist/components/form/range-slider/range-slider.mjs +135 -0
- package/dist/components/form/range-slider/range-slider.module.mjs +14 -0
- package/dist/components/form/select/select.css +74 -0
- package/dist/components/form/select/select.d.mts +2 -3
- package/dist/components/form/select/select.mjs +25 -8
- package/dist/components/form/select/select.module.mjs +12 -0
- package/dist/components/form/slider/range-input-class.css +97 -0
- package/dist/components/form/slider/range-input-class.d.mts +7 -0
- package/dist/components/form/slider/range-input-class.mjs +10 -0
- package/dist/components/form/slider/range-input-class.module.mjs +8 -0
- package/dist/components/form/slider/slider.css +55 -0
- package/dist/components/form/slider/slider.d.mts +6 -7
- package/dist/components/form/slider/slider.mjs +44 -11
- package/dist/components/form/slider/slider.module.mjs +12 -0
- package/dist/components/form/switch/switch.css +103 -0
- package/dist/components/form/switch/switch.d.mts +2 -3
- package/dist/components/form/switch/switch.mjs +14 -17
- package/dist/components/form/switch/switch.module.mjs +16 -0
- package/dist/components/form/text-field/text-field.css +41 -0
- package/dist/components/form/text-field/text-field.d.mts +4 -5
- package/dist/components/form/text-field/text-field.mjs +2 -3
- package/dist/components/form/text-field/text-field.module.mjs +5 -0
- package/dist/components/form/textarea/textarea.css +50 -0
- package/dist/components/form/textarea/textarea.d.mts +3 -3
- package/dist/components/form/textarea/textarea.mjs +6 -20
- package/dist/components/form/textarea/textarea.module.mjs +9 -0
- package/dist/components/icons/base.css +40 -0
- package/dist/components/icons/base.d.mts +4 -5
- package/dist/components/icons/base.mjs +10 -10
- package/dist/components/icons/base.module.mjs +13 -0
- package/dist/components/icons/browsers.d.mts +5 -6
- package/dist/components/icons/color-scale.d.mts +2 -3
- package/dist/components/icons/github-mark.d.mts +2 -3
- package/dist/components/icons/logo.css +17 -0
- package/dist/components/icons/logo.d.mts +3 -4
- package/dist/components/icons/logo.mjs +4 -3
- package/dist/components/icons/logo.module.mjs +9 -0
- package/dist/components/icons/lucide-deep.d.mts +3 -1
- package/dist/components/icons/lucide-imports.d.mts +3 -1
- package/dist/components/icons/lucide-imports.mjs +3 -1
- package/dist/components/icons/lucide.d.mts +60 -61
- package/dist/components/icons/qiita.d.mts +2 -3
- package/dist/components/icons/twitter.css +9 -0
- package/dist/components/icons/twitter.d.mts +2 -3
- package/dist/components/icons/twitter.mjs +2 -1
- package/dist/components/icons/twitter.module.mjs +5 -0
- package/dist/components/icons/vertical-writing.d.mts +2 -3
- package/dist/components/index.d.mts +62 -29
- package/dist/components/index.mjs +36 -14
- package/dist/components/layout/_shared/gap.css +25 -0
- package/dist/components/layout/_shared/gap.d.mts +8 -9
- package/dist/components/layout/_shared/gap.mjs +6 -5
- package/dist/components/layout/_shared/gap.module.mjs +11 -0
- package/dist/components/layout/_shared/padding.css +25 -0
- package/dist/components/layout/_shared/padding.d.mts +8 -9
- package/dist/components/layout/_shared/padding.mjs +6 -5
- package/dist/components/layout/_shared/padding.module.mjs +11 -0
- package/dist/components/layout/grid/grid.css +93 -0
- package/dist/components/layout/grid/grid.d.mts +5 -6
- package/dist/components/layout/grid/grid.mjs +21 -20
- package/dist/components/layout/grid/grid.module.mjs +25 -0
- package/dist/components/layout/resizable-panels/index.d.mts +18 -0
- package/dist/components/layout/resizable-panels/index.mjs +9 -0
- package/dist/components/layout/resizable-panels/resizable-panels.css +77 -0
- package/dist/components/layout/resizable-panels/resizable-panels.d.mts +21 -0
- package/dist/components/layout/resizable-panels/resizable-panels.mjs +164 -0
- package/dist/components/layout/resizable-panels/resizable-panels.module.mjs +16 -0
- package/dist/components/layout/separator/separator.css +37 -0
- package/dist/components/layout/separator/separator.d.mts +2 -3
- package/dist/components/layout/separator/separator.mjs +12 -9
- package/dist/components/layout/separator/separator.module.mjs +12 -0
- package/dist/components/layout/stack/stack.css +49 -0
- package/dist/components/layout/stack/stack.d.mts +3 -4
- package/dist/components/layout/stack/stack.mjs +11 -10
- package/dist/components/layout/stack/stack.module.mjs +17 -0
- package/dist/components/navigation/anchor/anchor.css +29 -0
- package/dist/components/navigation/anchor/anchor.d.mts +2 -3
- package/dist/components/navigation/anchor/anchor.mjs +5 -2
- package/dist/components/navigation/anchor/anchor.module.mjs +8 -0
- package/dist/components/navigation/breadcrumb/breadcrumb.css +72 -0
- package/dist/components/navigation/breadcrumb/breadcrumb.d.mts +5 -6
- package/dist/components/navigation/breadcrumb/breadcrumb.mjs +15 -9
- package/dist/components/navigation/breadcrumb/breadcrumb.module.mjs +14 -0
- package/dist/components/navigation/breadcrumb/index.d.mts +2 -3
- package/dist/components/navigation/pagination/pagination.css +36 -0
- package/dist/components/navigation/pagination/pagination.d.mts +2 -3
- package/dist/components/navigation/pagination/pagination.mjs +9 -8
- package/dist/components/navigation/pagination/pagination.module.mjs +11 -0
- package/dist/components/navigation/side-nav/index.d.mts +16 -0
- package/dist/components/navigation/side-nav/index.mjs +10 -0
- package/dist/components/navigation/side-nav/side-nav.css +73 -0
- package/dist/components/navigation/side-nav/side-nav.d.mts +31 -0
- package/dist/components/navigation/side-nav/side-nav.mjs +62 -0
- package/dist/components/navigation/side-nav/side-nav.module.mjs +11 -0
- package/dist/components/navigation/stepper/index.d.mts +2 -0
- package/dist/components/navigation/stepper/index.mjs +2 -0
- package/dist/components/navigation/stepper/stepper.css +151 -0
- package/dist/components/navigation/stepper/stepper.d.mts +19 -0
- package/dist/components/navigation/stepper/stepper.mjs +87 -0
- package/dist/components/navigation/stepper/stepper.module.mjs +29 -0
- package/dist/components/navigation/table-of-contents/index.d.mts +2 -0
- package/dist/components/navigation/table-of-contents/index.mjs +2 -0
- package/dist/components/navigation/table-of-contents/table-of-contents.css +17 -0
- package/dist/components/navigation/table-of-contents/table-of-contents.d.mts +12 -0
- package/dist/components/navigation/table-of-contents/table-of-contents.mjs +94 -0
- package/dist/components/navigation/table-of-contents/table-of-contents.module.mjs +8 -0
- package/dist/components/navigation/tabs/index.d.mts +19 -2
- package/dist/components/navigation/tabs/index.mjs +9 -1
- package/dist/components/navigation/tabs/tabs.css +70 -0
- package/dist/components/navigation/tabs/tabs.d.mts +16 -19
- package/dist/components/navigation/tabs/tabs.mjs +52 -49
- package/dist/components/navigation/tabs/tabs.module.mjs +12 -0
- package/dist/components/observers/fragment-instance.d.mts +1 -0
- package/dist/components/observers/in-view/in-view.d.mts +11 -0
- package/dist/components/observers/in-view/in-view.mjs +60 -0
- package/dist/components/observers/in-view/index.d.mts +2 -0
- package/dist/components/observers/in-view/index.mjs +2 -0
- package/dist/components/observers/resize/index.d.mts +2 -0
- package/dist/components/observers/resize/index.mjs +2 -0
- package/dist/components/observers/resize/resize.d.mts +7 -0
- package/dist/components/observers/resize/resize.mjs +25 -0
- package/dist/components/overlays/_internal/modal-dialog-context.d.mts +4 -5
- package/dist/components/overlays/_internal/use-can-hover.d.mts +2 -3
- package/dist/components/overlays/_internal/use-hover-intent.d.mts +3 -4
- package/dist/components/overlays/_internal/use-list-navigation.d.mts +17 -11
- package/dist/components/overlays/_internal/use-list-navigation.mjs +42 -26
- package/dist/components/overlays/command-palette/command-palette.css +91 -0
- package/dist/components/overlays/command-palette/command-palette.d.mts +24 -0
- package/dist/components/overlays/command-palette/command-palette.mjs +139 -0
- package/dist/components/overlays/command-palette/command-palette.module.mjs +14 -0
- package/dist/components/overlays/command-palette/index.d.mts +2 -0
- package/dist/components/overlays/command-palette/index.mjs +2 -0
- package/dist/components/overlays/context-menu/context-menu.d.mts +13 -0
- package/dist/components/overlays/context-menu/context-menu.mjs +79 -0
- package/dist/components/overlays/context-menu/index.d.mts +21 -0
- package/dist/components/overlays/context-menu/index.mjs +13 -0
- package/dist/components/overlays/dialog/dialog.css +31 -0
- package/dist/components/overlays/dialog/dialog.d.mts +12 -17
- package/dist/components/overlays/dialog/dialog.mjs +11 -13
- package/dist/components/overlays/dialog/dialog.module.mjs +10 -0
- package/dist/components/overlays/dialog/index.d.mts +17 -2
- package/dist/components/overlays/dialog/index.mjs +8 -1
- package/dist/components/overlays/drawer/drawer.css +48 -0
- package/dist/components/overlays/drawer/drawer.d.mts +2 -3
- package/dist/components/overlays/drawer/drawer.mjs +11 -10
- package/dist/components/overlays/drawer/drawer.module.mjs +13 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +19 -26
- package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +12 -20
- package/dist/components/overlays/dropdown-menu/hooks.d.mts +7 -7
- package/dist/components/overlays/dropdown-menu/hooks.mjs +3 -3
- package/dist/components/overlays/dropdown-menu/index.d.mts +30 -2
- package/dist/components/overlays/dropdown-menu/index.mjs +12 -1
- package/dist/components/overlays/dropdown-menu/shared.css +51 -0
- package/dist/components/overlays/dropdown-menu/shared.d.mts +3 -6
- package/dist/components/overlays/dropdown-menu/shared.mjs +4 -6
- package/dist/components/overlays/dropdown-menu/shared.module.mjs +8 -0
- package/dist/components/overlays/dropdown-menu/sub-menu.css +28 -0
- package/dist/components/overlays/dropdown-menu/sub-menu.d.mts +3 -6
- package/dist/components/overlays/dropdown-menu/sub-menu.mjs +16 -16
- package/dist/components/overlays/dropdown-menu/sub-menu.module.mjs +9 -0
- package/dist/components/overlays/dropdown-menu/use-safe-triangle.d.mts +2 -3
- package/dist/components/overlays/list-box/hooks.d.mts +6 -5
- package/dist/components/overlays/list-box/hooks.mjs +5 -4
- package/dist/components/overlays/list-box/index.d.mts +27 -2
- package/dist/components/overlays/list-box/index.mjs +9 -1
- package/dist/components/overlays/list-box/list-box.css +74 -0
- package/dist/components/overlays/list-box/list-box.d.mts +20 -23
- package/dist/components/overlays/list-box/list-box.mjs +17 -21
- package/dist/components/overlays/list-box/list-box.module.mjs +10 -0
- package/dist/components/overlays/modal/modal.css +119 -0
- package/dist/components/overlays/modal/modal.d.mts +2 -3
- package/dist/components/overlays/modal/modal.mjs +14 -11
- package/dist/components/overlays/modal/modal.module.mjs +11 -0
- package/dist/components/overlays/popover/anchor-positioning.d.mts +4 -5
- package/dist/components/overlays/popover/escape-stack.d.mts +2 -3
- package/dist/components/overlays/popover/hooks.d.mts +7 -8
- package/dist/components/overlays/popover/index.d.mts +25 -2
- package/dist/components/overlays/popover/index.mjs +8 -1
- package/dist/components/overlays/popover/popover.css +51 -0
- package/dist/components/overlays/popover/popover.d.mts +18 -20
- package/dist/components/overlays/popover/popover.mjs +13 -12
- package/dist/components/overlays/popover/popover.module.mjs +11 -0
- package/dist/components/overlays/tooltip/bridge.css +68 -0
- package/dist/components/overlays/tooltip/bridge.d.mts +2 -3
- package/dist/components/overlays/tooltip/bridge.mjs +7 -21
- package/dist/components/overlays/tooltip/bridge.module.mjs +11 -0
- package/dist/components/overlays/tooltip/index.d.mts +22 -2
- package/dist/components/overlays/tooltip/index.mjs +8 -1
- package/dist/components/overlays/tooltip/tooltip.css +15 -0
- package/dist/components/overlays/tooltip/tooltip.d.mts +19 -24
- package/dist/components/overlays/tooltip/tooltip.mjs +5 -9
- package/dist/components/overlays/tooltip/tooltip.module.mjs +5 -0
- package/dist/components/providers/index.d.mts +1 -2
- package/dist/components/providers/portal-root.d.mts +9 -7
- package/dist/components/providers/portal-root.mjs +7 -7
- package/dist/components/providers/ui-provider.d.mts +2 -6
- package/dist/components/providers/ui-provider.mjs +1 -5
- package/dist/helpers/chain.d.mts +2 -3
- package/dist/helpers/chain.mjs +0 -23
- package/dist/helpers/create-safe-context.d.mts +2 -3
- package/dist/helpers/create-safe-context.mjs +0 -17
- package/dist/helpers/index.d.mts +1 -2
- package/dist/helpers/index.mjs +2 -3
- package/dist/helpers/merge-props.d.mts +2 -3
- package/dist/helpers/merge-props.mjs +2 -37
- package/dist/helpers/merge-refs.d.mts +2 -3
- package/dist/helpers/merge-refs.mjs +0 -32
- package/dist/hooks/click-away/index.d.mts +2 -3
- package/dist/hooks/controllable-state/index.d.mts +2 -3
- package/dist/hooks/controllable-state/index.mjs +9 -11
- package/dist/hooks/index.d.mts +2 -23
- package/dist/hooks/index.mjs +2 -22
- package/dist/hooks/writing-mode/index.d.mts +15 -5
- package/dist/hooks/writing-mode/index.mjs +21 -14
- package/dist/i18n/current.d.mts +23 -0
- package/dist/i18n/current.mjs +43 -0
- package/dist/i18n/en.d.mts +2 -3
- package/dist/i18n/en.mjs +46 -0
- package/dist/i18n/index.d.mts +3 -2
- package/dist/i18n/index.mjs +4 -3
- package/dist/i18n/ja.d.mts +2 -3
- package/dist/i18n/ja.mjs +46 -0
- package/dist/i18n/messages.d.mts +81 -3
- package/dist/i18n/usage.d.mts +8 -0
- package/dist/i18n/usage.mjs +131 -0
- package/dist/index.d.mts +40 -47
- package/dist/index.mjs +36 -42
- package/dist/integrations/_shared/openui-defs.d.mts +3 -4
- package/dist/integrations/_shared/openui-defs.mjs +123 -54
- package/dist/integrations/_shared/renderers.css +50 -0
- package/dist/integrations/_shared/renderers.d.mts +71 -52
- package/dist/integrations/_shared/renderers.mjs +292 -34
- package/dist/integrations/_shared/renderers.module.mjs +14 -0
- package/dist/integrations/_shared/schemas.d.mts +388 -104
- package/dist/integrations/_shared/schemas.mjs +165 -27
- package/dist/integrations/ai-sdk/index.d.mts +2 -2
- package/dist/integrations/ai-sdk/map-parts.d.mts +25 -7
- package/dist/integrations/ai-sdk/map-parts.mjs +28 -3
- package/dist/integrations/json-render/catalog.d.mts +336 -18
- package/dist/integrations/json-render/catalog.mjs +120 -57
- package/dist/integrations/json-render/registry.d.mts +3 -4
- package/dist/integrations/json-render/registry.mjs +38 -4
- package/dist/integrations/openui/form-views.d.mts +23 -18
- package/dist/integrations/openui/form-views.mjs +27 -3
- package/dist/integrations/openui/library.d.mts +59 -7
- package/dist/integrations/openui/library.mjs +18 -3
- package/dist/integrations/openui/prompt.d.mts +2 -3
- package/dist/internal/accepts-file.d.mts +8 -0
- package/dist/internal/accepts-file.mjs +19 -0
- package/dist/internal/carries-files.d.mts +3 -0
- package/dist/internal/carries-files.mjs +4 -0
- package/dist/internal/clamp.d.mts +2 -3
- package/dist/internal/clamp.mjs +0 -11
- package/dist/internal/commit-input-value.d.mts +10 -0
- package/dist/internal/commit-input-value.mjs +15 -0
- package/dist/internal/dropped-files.d.mts +3 -0
- package/dist/internal/dropped-files.mjs +8 -0
- package/dist/{hooks/focus-trap/index.d.mts → internal/focus-trap.d.mts} +6 -7
- package/dist/{hooks/focus-trap/index.mjs → internal/focus-trap.mjs} +5 -5
- package/dist/internal/hex-color.d.mts +22 -0
- package/dist/internal/hex-color.mjs +53 -0
- package/dist/internal/iso-date.d.mts +39 -0
- package/dist/internal/iso-date.mjs +98 -0
- package/dist/internal/to-precision.d.mts +2 -3
- package/dist/internal/to-precision.mjs +0 -8
- package/dist/styles/index.css +513 -2534
- package/dist/styles/tailwind.css +217 -17
- package/dist/styles/tokens.d.mts +1 -2
- package/dist/styles/tokens.mjs +1 -2
- package/dist/types/variables.d.mts +7 -9
- package/docs/GUIDE.md +340 -158
- package/docs/llms.txt +18 -10
- package/docs/props.generated.json +2157 -292
- package/docs/references/ai-chat.md +396 -113
- package/docs/references/color.md +258 -113
- package/docs/references/components.md +1891 -461
- package/docs/references/generative-ui.md +163 -34
- package/docs/references/interaction-design.md +103 -73
- package/docs/references/spatial-design.md +112 -90
- package/docs/references/types.md +101 -0
- package/docs/references/typography.md +182 -73
- package/package.json +71 -70
- package/dist/components/_internal/focus-ring.d.mts +0 -8
- package/dist/components/_internal/focus-ring.mjs +0 -8
- package/dist/components/layout/scroll-linked/index.d.mts +0 -2
- package/dist/components/layout/scroll-linked/index.mjs +0 -2
- package/dist/components/layout/scroll-linked/scroll-linked.d.mts +0 -14
- package/dist/components/layout/scroll-linked/scroll-linked.mjs +0 -59
- package/dist/helpers/cn.d.mts +0 -5
- package/dist/helpers/cn.mjs +0 -27
- package/dist/hooks/breakpoint/index.d.mts +0 -5
- package/dist/hooks/breakpoint/index.mjs +0 -24
- package/dist/hooks/client/index.d.mts +0 -4
- package/dist/hooks/client/index.mjs +0 -6
- package/dist/hooks/clipboard/index.d.mts +0 -7
- package/dist/hooks/clipboard/index.mjs +0 -15
- package/dist/hooks/debounced-transition/index.d.mts +0 -5
- package/dist/hooks/debounced-transition/index.mjs +0 -49
- package/dist/hooks/deferred-debounce/index.d.mts +0 -4
- package/dist/hooks/deferred-debounce/index.mjs +0 -9
- package/dist/hooks/disclosure/index.d.mts +0 -10
- package/dist/hooks/disclosure/index.mjs +0 -20
- package/dist/hooks/hash/index.d.mts +0 -4
- package/dist/hooks/hash/index.mjs +0 -25
- package/dist/hooks/hover/index.d.mts +0 -12
- package/dist/hooks/hover/index.mjs +0 -19
- package/dist/hooks/intersection-observer/index.d.mts +0 -3
- package/dist/hooks/intersection-observer/index.mjs +0 -3
- package/dist/hooks/intersection-observer/use-in-view.d.mts +0 -11
- package/dist/hooks/intersection-observer/use-in-view.mjs +0 -18
- package/dist/hooks/intersection-observer/use-intersection-observer.d.mts +0 -11
- package/dist/hooks/intersection-observer/use-intersection-observer.mjs +0 -33
- package/dist/hooks/interval/index.d.mts +0 -4
- package/dist/hooks/interval/index.mjs +0 -19
- package/dist/hooks/local-storage/index.d.mts +0 -4
- package/dist/hooks/local-storage/index.mjs +0 -46
- package/dist/hooks/resize/index.d.mts +0 -8
- package/dist/hooks/resize/index.mjs +0 -24
- package/dist/hooks/scroll-direction/index.d.mts +0 -13
- package/dist/hooks/scroll-direction/index.mjs +0 -67
- package/dist/hooks/scroll-lock/index.d.mts +0 -9
- package/dist/hooks/scroll-lock/index.mjs +0 -59
- package/dist/hooks/session-storage/index.d.mts +0 -4
- package/dist/hooks/session-storage/index.mjs +0 -46
- package/dist/hooks/step/index.d.mts +0 -15
- package/dist/hooks/step/index.mjs +0 -39
- package/dist/hooks/timeout/index.d.mts +0 -4
- package/dist/hooks/timeout/index.mjs +0 -19
- package/dist/hooks/window-resize/index.d.mts +0 -11
- package/dist/hooks/window-resize/index.mjs +0 -21
- package/dist/hooks/window-size/index.d.mts +0 -8
- package/dist/hooks/window-size/index.mjs +0 -31
- package/dist/i18n/context.d.mts +0 -9
- package/dist/i18n/context.mjs +0 -19
- package/dist/styles/base.css +0 -315
- package/dist/styles/tokens.css +0 -380
- package/dist/styles/tokens.generated.d.mts +0 -840
- package/dist/styles/tokens.generated.mjs +0 -813
- package/dist/styles/utilities.css +0 -62
- package/docs/references/helpers.md +0 -120
- package/docs/references/hooks.md +0 -314
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccordionProps, AlertProps, AnchorProps, AvatarProps, BadgeProps, BreadcrumbProps, ButtonProps, CardProps, ChevronIconProps, CodeProps, DialogProps, DrawerProps, DropdownMenuProps, FileFieldProps, FormControlProps, FormProps, GridProps, HeadingProps, IconButtonProps, IconProps, ModalProps, PopoverProps, ProgressProps,
|
|
1
|
+
import { AccordionProps, AlertProps, AnchorProps, AvatarProps, BadgeProps, BreadcrumbProps, ButtonProps, CalloutProps, CardProps, CarouselProps, ChevronIconProps, CodeProps, CopyButtonProps, DataTableProps, DialogProps, DrawerProps, DropdownMenuProps, EmptyStateProps, FileFieldProps, FormControlProps, FormProps, GridProps, HeadingProps, IconButtonProps, IconProps, KbdProps, ModalProps, PopoverProps, ProgressProps, SeparatorProps, SideNavProps, SkeletonProps, SpinnerProps, StackProps, StatusIconProps, StepperProps, TableProps, TabsProps, ToastProps, ToolbarProps, TooltipProps, TreeProps, schemas_d_exports } from "../_shared/schemas.mjs";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { ComponentRenderProps } from "@openuidev/react-lang";
|
|
4
4
|
//#region src/integrations/openui/library.d.ts
|
|
@@ -14,15 +14,13 @@ import { ComponentRenderProps } from "@openuidev/react-lang";
|
|
|
14
14
|
*
|
|
15
15
|
* 合成モデルの違い: 子要素は json-render の slots ではなく、
|
|
16
16
|
* `z.array(Child.ref)` という型付きサブコンポーネントの prop で表す。
|
|
17
|
-
* NOTE: OpenUI は自己参照スキーマを安定して扱えないため、Stack/Grid 自身の
|
|
18
|
-
* 入れ子は非対応(Card には Stack/Grid を入れられる)。
|
|
19
17
|
*/
|
|
20
18
|
type ContainerRenderProps<P> = ComponentRenderProps<P & {
|
|
21
19
|
children: ReadonlyArray<{
|
|
22
20
|
typeName: string;
|
|
23
21
|
}>;
|
|
24
22
|
}>;
|
|
25
|
-
declare const library: import("@openuidev/lang-core").Library<import("react").FC<ComponentRenderProps<{
|
|
23
|
+
export declare const library: import("@openuidev/lang-core").Library<import("react").FC<ComponentRenderProps<{
|
|
26
24
|
name: string;
|
|
27
25
|
placeholder?: string | undefined;
|
|
28
26
|
defaultValue?: string | undefined;
|
|
@@ -60,6 +58,49 @@ declare const library: import("@openuidev/lang-core").Library<import("react").FC
|
|
|
60
58
|
disabled?: boolean | undefined;
|
|
61
59
|
min?: number | undefined;
|
|
62
60
|
max?: number | undefined;
|
|
61
|
+
}>> | import("react").FC<ComponentRenderProps<{
|
|
62
|
+
name: string;
|
|
63
|
+
label: string;
|
|
64
|
+
defaultValue?: [number, number] | undefined;
|
|
65
|
+
min?: number | undefined;
|
|
66
|
+
max?: number | undefined;
|
|
67
|
+
step?: number | undefined;
|
|
68
|
+
invalid?: boolean | undefined;
|
|
69
|
+
disabled?: boolean | undefined;
|
|
70
|
+
}>> | import("react").FC<ComponentRenderProps<{
|
|
71
|
+
name: string;
|
|
72
|
+
label: string;
|
|
73
|
+
defaultValue?: string | undefined;
|
|
74
|
+
swatches?: {
|
|
75
|
+
value: string;
|
|
76
|
+
label: string;
|
|
77
|
+
}[] | undefined;
|
|
78
|
+
invalid?: boolean | undefined;
|
|
79
|
+
disabled?: boolean | undefined;
|
|
80
|
+
required?: boolean | undefined;
|
|
81
|
+
}>> | import("react").FC<ComponentRenderProps<{
|
|
82
|
+
name: string;
|
|
83
|
+
label: string;
|
|
84
|
+
defaultValue?: string | undefined;
|
|
85
|
+
min?: string | undefined;
|
|
86
|
+
max?: string | undefined;
|
|
87
|
+
invalid?: boolean | undefined;
|
|
88
|
+
disabled?: boolean | undefined;
|
|
89
|
+
required?: boolean | undefined;
|
|
90
|
+
}>> | import("react").FC<ComponentRenderProps<{
|
|
91
|
+
name: string;
|
|
92
|
+
label: string;
|
|
93
|
+
defaultValue?: string | undefined;
|
|
94
|
+
min?: string | undefined;
|
|
95
|
+
max?: string | undefined;
|
|
96
|
+
invalid?: boolean | undefined;
|
|
97
|
+
disabled?: boolean | undefined;
|
|
98
|
+
required?: boolean | undefined;
|
|
99
|
+
}>> | import("react").FC<ComponentRenderProps<{
|
|
100
|
+
name: string;
|
|
101
|
+
defaultValue?: string | undefined;
|
|
102
|
+
min?: string | undefined;
|
|
103
|
+
max?: string | undefined;
|
|
63
104
|
}>> | import("react").FC<ComponentRenderProps<{
|
|
64
105
|
name: string;
|
|
65
106
|
label: string;
|
|
@@ -137,6 +178,18 @@ declare const library: import("@openuidev/lang-core").Library<import("react").FC
|
|
|
137
178
|
}[];
|
|
138
179
|
defaultValue?: string[] | undefined;
|
|
139
180
|
label: string;
|
|
181
|
+
}>> | import("react").FC<ComponentRenderProps<{
|
|
182
|
+
name: string;
|
|
183
|
+
label: string;
|
|
184
|
+
options: {
|
|
185
|
+
value: string;
|
|
186
|
+
label: string;
|
|
187
|
+
}[];
|
|
188
|
+
defaultValue?: string | undefined;
|
|
189
|
+
placeholder?: string | undefined;
|
|
190
|
+
invalid?: boolean | undefined;
|
|
191
|
+
disabled?: boolean | undefined;
|
|
192
|
+
required?: boolean | undefined;
|
|
140
193
|
}>> | import("react").FC<ComponentRenderProps<{
|
|
141
194
|
name: string;
|
|
142
195
|
options: {
|
|
@@ -146,6 +199,5 @@ declare const library: import("@openuidev/lang-core").Library<import("react").FC
|
|
|
146
199
|
defaultValue?: string[] | undefined;
|
|
147
200
|
invalid?: boolean | undefined;
|
|
148
201
|
disabled?: boolean | undefined;
|
|
149
|
-
}>> | (({ props, renderNode }: ContainerRenderProps<StackProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<GridProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<CardProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<FormProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<ModalProps>) => import("react").JSX.Element) | (({ props, renderNode }: ContainerRenderProps<DialogProps>) => import("react").JSX.Element) | (({ props, renderNode }: ContainerRenderProps<DrawerProps>) => import("react").JSX.Element) | (({ props, renderNode }: ContainerRenderProps<PopoverProps>) => ReactNode) | (({ props }: ComponentRenderProps<TooltipProps>) => ReactNode) | (({ props }: ComponentRenderProps<DropdownMenuProps>) => ReactNode) | (({ props }: ComponentRenderProps<ToastProps>) => import("react").JSX.Element) | (({ props }: ComponentRenderProps<ButtonProps>) => ReactNode) | (({ props }: ComponentRenderProps<IconButtonProps>) => ReactNode) | (({ props }: ComponentRenderProps<BadgeProps>) => ReactNode) | (({ props }: ComponentRenderProps<HeadingProps>) => ReactNode) | (({ props }: ComponentRenderProps<AnchorProps>) => ReactNode) | (({ props }: ComponentRenderProps<AvatarProps>) => ReactNode) | (({ props }: ComponentRenderProps<CodeProps>) => ReactNode) | (({ props }: ComponentRenderProps<IconProps>) => ReactNode) | (({ props }: ComponentRenderProps<ChevronIconProps>) => ReactNode) | (({ props }: ComponentRenderProps<StatusIconProps>) => ReactNode) | (({ props }: ComponentRenderProps<AlertProps>) => ReactNode) | (({ props }: ComponentRenderProps<SpinnerProps>) => ReactNode) | (({ props }: ComponentRenderProps<ProgressProps>) => ReactNode) | (({ props }: ComponentRenderProps<SkeletonProps>) => ReactNode) | (({ props }: ComponentRenderProps<SeparatorProps>) => ReactNode) | (({ props }: ComponentRenderProps<
|
|
150
|
-
//#endregion
|
|
151
|
-
export { library };
|
|
202
|
+
}>> | (({ props, renderNode }: ContainerRenderProps<StackProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<GridProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<CardProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<FormProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<ModalProps>) => import("react").JSX.Element) | (({ props, renderNode }: ContainerRenderProps<DialogProps>) => import("react").JSX.Element) | (({ props, renderNode }: ContainerRenderProps<DrawerProps>) => import("react").JSX.Element) | (({ props, renderNode }: ContainerRenderProps<PopoverProps>) => ReactNode) | (({ props }: ComponentRenderProps<TooltipProps>) => ReactNode) | (({ props }: ComponentRenderProps<DropdownMenuProps>) => ReactNode) | (({ props }: ComponentRenderProps<ToolbarProps>) => ReactNode) | (({ props }: ComponentRenderProps<ToastProps>) => import("react").JSX.Element) | (({ props }: ComponentRenderProps<ButtonProps>) => ReactNode) | (({ props }: ComponentRenderProps<IconButtonProps>) => ReactNode) | (({ props }: ComponentRenderProps<CopyButtonProps>) => ReactNode) | (({ props }: ComponentRenderProps<BadgeProps>) => ReactNode) | (({ props }: ComponentRenderProps<HeadingProps>) => ReactNode) | (({ props }: ComponentRenderProps<AnchorProps>) => ReactNode) | (({ props }: ComponentRenderProps<AvatarProps>) => ReactNode) | (({ props }: ComponentRenderProps<CodeProps>) => ReactNode) | (({ props }: ComponentRenderProps<KbdProps>) => ReactNode) | (({ props }: ComponentRenderProps<EmptyStateProps>) => ReactNode) | (({ props, renderNode }: ContainerRenderProps<CarouselProps>) => ReactNode) | (({ props }: ComponentRenderProps<IconProps>) => ReactNode) | (({ props }: ComponentRenderProps<ChevronIconProps>) => ReactNode) | (({ props }: ComponentRenderProps<StatusIconProps>) => ReactNode) | (({ props }: ComponentRenderProps<AlertProps>) => ReactNode) | (({ props }: ComponentRenderProps<CalloutProps>) => ReactNode) | (({ props }: ComponentRenderProps<SpinnerProps>) => ReactNode) | (({ props }: ComponentRenderProps<ProgressProps>) => ReactNode) | (({ props }: ComponentRenderProps<SkeletonProps>) => ReactNode) | (({ props }: ComponentRenderProps<SeparatorProps>) => ReactNode) | (({ props }: ComponentRenderProps<TabsProps>) => ReactNode) | (({ props }: ComponentRenderProps<AccordionProps>) => ReactNode) | (({ props }: ComponentRenderProps<BreadcrumbProps>) => ReactNode) | (({ props }: ComponentRenderProps<StepperProps>) => ReactNode) | (({ props }: ComponentRenderProps<TableProps>) => ReactNode) | (({ props }: ComponentRenderProps<DataTableProps>) => import("react").JSX.Element) | (({ props }: ComponentRenderProps<TreeProps>) => ReactNode) | (({ props }: ComponentRenderProps<SideNavProps>) => ReactNode) | (({ props }: ComponentRenderProps<FileFieldProps>) => import("react").JSX.Element) | (({ props }: ComponentRenderProps<FormControlProps>) => import("react").JSX.Element)>;
|
|
203
|
+
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { buildComponentLibrary } from "../_shared/openui-defs.mjs";
|
|
3
|
-
import { DialogWidget, DrawerWidget, FileFieldWidget, FormControlWidget, ModalWidget, ToastWidget, renderAccordion, renderAlert, renderAnchor, renderAvatar, renderBadge, renderBreadcrumb, renderButton, renderCard, renderChevronIcon, renderCode, renderDropdownMenu, renderForm, renderGrid, renderHeading, renderIcon, renderIconButton, renderPopover, renderProgress,
|
|
4
|
-
import { AutocompleteView, CheckboxCardView, CheckboxGroupView, CheckboxView, ListBoxView, NumberFieldView, PaginationView, PasswordInputView, RadioCardView, RadioView, SelectView, SliderView, SwitchView, TextFieldView, TextareaView } from "./form-views.mjs";
|
|
3
|
+
import { DataTableWidget, DialogWidget, DrawerWidget, FileFieldWidget, FormControlWidget, ModalWidget, ToastWidget, renderAccordion, renderAlert, renderAnchor, renderAvatar, renderBadge, renderBreadcrumb, renderButton, renderCallout, renderCard, renderCarousel, renderChevronIcon, renderCode, renderCopyButton, renderDropdownMenu, renderEmptyState, renderForm, renderGrid, renderHeading, renderIcon, renderIconButton, renderKbd, renderPopover, renderProgress, renderSeparator, renderSideNav, renderSkeleton, renderSpinner, renderStack, renderStatusIcon, renderStepper, renderTable, renderTabs, renderToolbar, renderTooltip, renderTree } from "../_shared/renderers.mjs";
|
|
4
|
+
import { AutocompleteView, CalendarView, CheckboxCardView, CheckboxGroupView, CheckboxView, ColorPickerView, ComboboxView, DateFieldView, DatePickerView, ListBoxView, NumberFieldView, PaginationView, PasswordInputView, RadioCardView, RadioView, RangeSliderView, SelectView, SliderView, SwitchView, TextFieldView, TextareaView } from "./form-views.mjs";
|
|
5
5
|
import { Fragment } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/integrations/openui/library.tsx
|
|
@@ -26,32 +26,46 @@ const library = buildComponentLibrary({
|
|
|
26
26
|
Popover: ({ props, renderNode }) => renderPopover(props, renderChildren(props.children, renderNode)),
|
|
27
27
|
Tooltip: ({ props }) => renderTooltip(props),
|
|
28
28
|
DropdownMenu: ({ props }) => renderDropdownMenu(props),
|
|
29
|
+
Toolbar: ({ props }) => renderToolbar(props),
|
|
29
30
|
Toast: ({ props }) => /* @__PURE__ */ jsx(ToastWidget, { props }),
|
|
30
31
|
Button: ({ props }) => renderButton(props),
|
|
31
32
|
IconButton: ({ props }) => renderIconButton(props),
|
|
33
|
+
CopyButton: ({ props }) => renderCopyButton(props),
|
|
32
34
|
Badge: ({ props }) => renderBadge(props),
|
|
33
35
|
Heading: ({ props }) => renderHeading(props),
|
|
34
36
|
Anchor: ({ props }) => renderAnchor(props),
|
|
35
37
|
Avatar: ({ props }) => renderAvatar(props),
|
|
36
38
|
Code: ({ props }) => renderCode(props),
|
|
39
|
+
Kbd: ({ props }) => renderKbd(props),
|
|
40
|
+
EmptyState: ({ props }) => renderEmptyState(props),
|
|
41
|
+
Carousel: ({ props, renderNode }) => renderCarousel(props, props.children.map((child) => renderNode(child))),
|
|
37
42
|
Icon: ({ props }) => renderIcon(props),
|
|
38
43
|
ChevronIcon: ({ props }) => renderChevronIcon(props),
|
|
39
44
|
StatusIcon: ({ props }) => renderStatusIcon(props),
|
|
40
45
|
Alert: ({ props }) => renderAlert(props),
|
|
46
|
+
Callout: ({ props }) => renderCallout(props),
|
|
41
47
|
Spinner: ({ props }) => renderSpinner(props),
|
|
42
48
|
Progress: ({ props }) => renderProgress(props),
|
|
43
49
|
Skeleton: ({ props }) => renderSkeleton(props),
|
|
44
50
|
Separator: ({ props }) => renderSeparator(props),
|
|
45
|
-
ScrollLinked: ({ props }) => renderScrollLinked(props),
|
|
46
51
|
Tabs: ({ props }) => renderTabs(props),
|
|
47
52
|
Accordion: ({ props }) => renderAccordion(props),
|
|
48
53
|
Breadcrumb: ({ props }) => renderBreadcrumb(props),
|
|
54
|
+
Stepper: ({ props }) => renderStepper(props),
|
|
49
55
|
Table: ({ props }) => renderTable(props),
|
|
56
|
+
DataTable: ({ props }) => /* @__PURE__ */ jsx(DataTableWidget, { props }),
|
|
57
|
+
Tree: ({ props }) => renderTree(props),
|
|
58
|
+
SideNav: ({ props }) => renderSideNav(props),
|
|
50
59
|
TextField: TextFieldView,
|
|
51
60
|
Textarea: TextareaView,
|
|
52
61
|
PasswordInput: PasswordInputView,
|
|
53
62
|
NumberField: NumberFieldView,
|
|
54
63
|
Slider: SliderView,
|
|
64
|
+
RangeSlider: RangeSliderView,
|
|
65
|
+
ColorPicker: ColorPickerView,
|
|
66
|
+
DateField: DateFieldView,
|
|
67
|
+
DatePicker: DatePickerView,
|
|
68
|
+
Calendar: CalendarView,
|
|
55
69
|
Checkbox: CheckboxView,
|
|
56
70
|
Switch: SwitchView,
|
|
57
71
|
Select: SelectView,
|
|
@@ -61,6 +75,7 @@ const library = buildComponentLibrary({
|
|
|
61
75
|
Pagination: PaginationView,
|
|
62
76
|
ListBox: ListBoxView,
|
|
63
77
|
CheckboxGroup: CheckboxGroupView,
|
|
78
|
+
Combobox: ComboboxView,
|
|
64
79
|
Autocomplete: AutocompleteView,
|
|
65
80
|
FileField: ({ props }) => /* @__PURE__ */ jsx(FileFieldWidget, { props }),
|
|
66
81
|
FormControl: ({ props }) => /* @__PURE__ */ jsx(FormControlWidget, { props })
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PromptOptions } from "@openuidev/lang-core";
|
|
2
2
|
//#region src/integrations/openui/prompt.d.ts
|
|
3
|
-
declare const prompt: (options?: PromptOptions) => string;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { prompt };
|
|
3
|
+
export declare const prompt: (options?: PromptOptions) => string;
|
|
4
|
+
//#endregion
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/internal/accepts-file.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* `<input type="file">` の `accept` と同じ規則でファイルを選り分ける。
|
|
4
|
+
* ブラウザがこの規則を当てるのはファイル選択ダイアログだけで、ドロップや
|
|
5
|
+
* 貼り付けで届いたファイルは素通しになるため、自前で当てる。
|
|
6
|
+
*/
|
|
7
|
+
export declare const acceptsFile: (file: File, accept: string) => boolean;
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/internal/accepts-file.ts
|
|
2
|
+
/**
|
|
3
|
+
* `<input type="file">` の `accept` と同じ規則でファイルを選り分ける。
|
|
4
|
+
* ブラウザがこの規則を当てるのはファイル選択ダイアログだけで、ドロップや
|
|
5
|
+
* 貼り付けで届いたファイルは素通しになるため、自前で当てる。
|
|
6
|
+
*/
|
|
7
|
+
const acceptsFile = (file, accept) => {
|
|
8
|
+
const tokens = accept.split(",").map((token) => token.trim().toLowerCase()).filter((token) => token !== "");
|
|
9
|
+
if (tokens.length === 0) return true;
|
|
10
|
+
const type = file.type.toLowerCase();
|
|
11
|
+
const name = file.name.toLowerCase();
|
|
12
|
+
return tokens.some((token) => {
|
|
13
|
+
if (token.startsWith(".")) return name.endsWith(token);
|
|
14
|
+
if (token.endsWith("/*")) return type.startsWith(token.slice(0, -1));
|
|
15
|
+
return type === token;
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { acceptsFile };
|
package/dist/internal/clamp.mjs
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
//#region src/internal/clamp.ts
|
|
2
2
|
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
3
|
-
if (import.meta.vitest) describe("clamp", () => {
|
|
4
|
-
it("minとmaxの間の値の場合はそのまま返す", () => {
|
|
5
|
-
expect(clamp(5, 0, 10)).toBe(5);
|
|
6
|
-
});
|
|
7
|
-
it("minより小さい場合はminを返す", () => {
|
|
8
|
-
expect(clamp(-5, 0, 10)).toBe(0);
|
|
9
|
-
});
|
|
10
|
-
it("maxより大きい場合はmaxを返す", () => {
|
|
11
|
-
expect(clamp(15, 0, 10)).toBe(10);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
3
|
//#endregion
|
|
15
4
|
export { clamp };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/internal/commit-input-value.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* コードから入力欄の値を変え、打ち込んだときと同じく input イベントで知らせる。
|
|
4
|
+
*
|
|
5
|
+
* React が value を書いても DOM のイベントは出ないので、フォーム側
|
|
6
|
+
* (@k8ordo/form の useForm は input イベントで dirty・ルール・エラーの解除を
|
|
7
|
+
* 見る)は変化に気づけない。値が変わらなかったときは出さない。
|
|
8
|
+
*/
|
|
9
|
+
export declare const commitInputValue: (input: HTMLInputElement, value: string) => void;
|
|
10
|
+
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/internal/commit-input-value.ts
|
|
2
|
+
/**
|
|
3
|
+
* コードから入力欄の値を変え、打ち込んだときと同じく input イベントで知らせる。
|
|
4
|
+
*
|
|
5
|
+
* React が value を書いても DOM のイベントは出ないので、フォーム側
|
|
6
|
+
* (@k8ordo/form の useForm は input イベントで dirty・ルール・エラーの解除を
|
|
7
|
+
* 見る)は変化に気づけない。値が変わらなかったときは出さない。
|
|
8
|
+
*/
|
|
9
|
+
const commitInputValue = (input, value) => {
|
|
10
|
+
if (input.value === value) return;
|
|
11
|
+
input.value = value;
|
|
12
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { commitInputValue };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/internal/dropped-files.ts
|
|
2
|
+
const droppedFiles = (dataTransfer) => Array.from(dataTransfer.items).flatMap((item) => {
|
|
3
|
+
if (item.kind !== "file" || item.webkitGetAsEntry()?.isDirectory === true) return [];
|
|
4
|
+
const file = item.getAsFile();
|
|
5
|
+
return file === null ? [] : [file];
|
|
6
|
+
});
|
|
7
|
+
//#endregion
|
|
8
|
+
export { droppedFiles };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/internal/focus-trap.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* 非モーダルなポップアップのフォーカス管理。
|
|
5
5
|
*
|
|
6
|
-
* floating-ui の `<FloatingFocusManager modal={false}>` 相当を自前で再現する:
|
|
7
6
|
* - 開いたとき、ポップアップ内へ初期フォーカスを移す
|
|
8
7
|
* (内部に roving tabindex のリストがある場合は、そのリストナビゲーション側の
|
|
9
8
|
* フォーカスが後で上書きするため、ここではコンテナ/先頭要素に当てるだけでよい)
|
|
10
9
|
* - 閉じたとき、フォーカスがまだポップアップ内(または喪失)していればトリガーへ戻す。
|
|
11
10
|
* 外側を意図的にクリック/フォーカスした場合は奪い返さない。
|
|
12
11
|
*
|
|
13
|
-
* ハードな Tab トラップや close-on-focus-out
|
|
14
|
-
*
|
|
12
|
+
* ハードな Tab トラップや close-on-focus-out は行わない。非モーダルなので Tab で
|
|
13
|
+
* ポップアップの外へ抜けられるのが期待される振る舞いで、抜けたときに閉じるかは
|
|
14
|
+
* 呼び出し側が決める。外側クリック / Escape による dismiss も呼び出し側が担う。
|
|
15
15
|
*/
|
|
16
|
-
declare const useFocusTrap: (contentRef: RefObject<HTMLElement | null>, triggerRef: RefObject<Element | null>, enabled: boolean) => void;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { useFocusTrap };
|
|
16
|
+
export declare const useFocusTrap: (contentRef: RefObject<HTMLElement | null>, triggerRef: RefObject<Element | null>, enabled: boolean) => void;
|
|
17
|
+
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/internal/focus-trap.ts
|
|
4
4
|
const FOCUSABLE_SELECTOR = [
|
|
5
5
|
"a[href]",
|
|
6
6
|
"button:not([disabled])",
|
|
@@ -13,15 +13,15 @@ const FOCUSABLE_SELECTOR = [
|
|
|
13
13
|
/**
|
|
14
14
|
* 非モーダルなポップアップのフォーカス管理。
|
|
15
15
|
*
|
|
16
|
-
* floating-ui の `<FloatingFocusManager modal={false}>` 相当を自前で再現する:
|
|
17
16
|
* - 開いたとき、ポップアップ内へ初期フォーカスを移す
|
|
18
17
|
* (内部に roving tabindex のリストがある場合は、そのリストナビゲーション側の
|
|
19
18
|
* フォーカスが後で上書きするため、ここではコンテナ/先頭要素に当てるだけでよい)
|
|
20
19
|
* - 閉じたとき、フォーカスがまだポップアップ内(または喪失)していればトリガーへ戻す。
|
|
21
20
|
* 外側を意図的にクリック/フォーカスした場合は奪い返さない。
|
|
22
21
|
*
|
|
23
|
-
* ハードな Tab トラップや close-on-focus-out
|
|
24
|
-
*
|
|
22
|
+
* ハードな Tab トラップや close-on-focus-out は行わない。非モーダルなので Tab で
|
|
23
|
+
* ポップアップの外へ抜けられるのが期待される振る舞いで、抜けたときに閉じるかは
|
|
24
|
+
* 呼び出し側が決める。外側クリック / Escape による dismiss も呼び出し側が担う。
|
|
25
25
|
*/
|
|
26
26
|
const useFocusTrap = (contentRef, triggerRef, enabled) => {
|
|
27
27
|
useEffect(() => {
|
|
@@ -30,7 +30,7 @@ const useFocusTrap = (contentRef, triggerRef, enabled) => {
|
|
|
30
30
|
if (!content) return;
|
|
31
31
|
const trigger = triggerRef.current;
|
|
32
32
|
if (!content.contains(document.activeElement)) {
|
|
33
|
-
const first = content.querySelector(FOCUSABLE_SELECTOR);
|
|
33
|
+
const first = content.querySelector("[data-autofocus]") ?? content.querySelector(FOCUSABLE_SELECTOR);
|
|
34
34
|
if (first) first.focus();
|
|
35
35
|
else {
|
|
36
36
|
content.tabIndex = -1;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/internal/hex-color.d.ts
|
|
2
|
+
/** 色相 0〜359、彩度と明度は 0〜100 の整数。 */
|
|
3
|
+
export type Hsl = {
|
|
4
|
+
h: number;
|
|
5
|
+
s: number;
|
|
6
|
+
l: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* `#rrggbb`(`#` は省いてよく、大文字も可)を小文字にそろえる。読めなければ
|
|
10
|
+
* null。`shorthand` なら `#rgb` も 6 桁に広げて読む。打っている途中の `#256`
|
|
11
|
+
* (`#2563eb` の打ちかけ)を色と取らないよう、打鍵のたびには広げない。
|
|
12
|
+
*/
|
|
13
|
+
export declare const parseHex: (text: string, { shorthand }?: {
|
|
14
|
+
shorthand?: boolean;
|
|
15
|
+
}) => string | null;
|
|
16
|
+
/**
|
|
17
|
+
* 灰色(彩度 0)には色相が無いので、`fallbackHue` を残す。そうしないと
|
|
18
|
+
* 彩度を 0 まで下げたとたんに色相のつまみが端へ飛ぶ。
|
|
19
|
+
*/
|
|
20
|
+
export declare const hexToHsl: (hex: string, fallbackHue?: number) => Hsl;
|
|
21
|
+
export declare const hslToHex: ({ h, s, l }: Hsl) => string;
|
|
22
|
+
//#endregion
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/internal/hex-color.ts
|
|
2
|
+
const HEX = /^#?(?<digits>[\da-f]{3}|[\da-f]{6})$/iu;
|
|
3
|
+
/**
|
|
4
|
+
* `#rrggbb`(`#` は省いてよく、大文字も可)を小文字にそろえる。読めなければ
|
|
5
|
+
* null。`shorthand` なら `#rgb` も 6 桁に広げて読む。打っている途中の `#256`
|
|
6
|
+
* (`#2563eb` の打ちかけ)を色と取らないよう、打鍵のたびには広げない。
|
|
7
|
+
*/
|
|
8
|
+
const parseHex = (text, { shorthand = false } = {}) => {
|
|
9
|
+
const digits = HEX.exec(text.trim())?.groups?.digits;
|
|
10
|
+
if (digits === void 0 || digits.length === 3 && !shorthand) return null;
|
|
11
|
+
return `#${(digits.length === 3 ? digits.replaceAll(/./gu, "$&$&") : digits).toLowerCase()}`;
|
|
12
|
+
};
|
|
13
|
+
const channels = (hex) => [
|
|
14
|
+
Number.parseInt(hex.slice(1, 3), 16) / 255,
|
|
15
|
+
Number.parseInt(hex.slice(3, 5), 16) / 255,
|
|
16
|
+
Number.parseInt(hex.slice(5, 7), 16) / 255
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* 灰色(彩度 0)には色相が無いので、`fallbackHue` を残す。そうしないと
|
|
20
|
+
* 彩度を 0 まで下げたとたんに色相のつまみが端へ飛ぶ。
|
|
21
|
+
*/
|
|
22
|
+
const hexToHsl = (hex, fallbackHue = 0) => {
|
|
23
|
+
const [r, g, b] = channels(hex);
|
|
24
|
+
const max = Math.max(r, g, b);
|
|
25
|
+
const min = Math.min(r, g, b);
|
|
26
|
+
const lightness = (max + min) / 2;
|
|
27
|
+
const delta = max - min;
|
|
28
|
+
if (delta === 0) return {
|
|
29
|
+
h: fallbackHue,
|
|
30
|
+
s: 0,
|
|
31
|
+
l: Math.round(lightness * 100)
|
|
32
|
+
};
|
|
33
|
+
const saturation = delta / (1 - Math.abs(2 * lightness - 1));
|
|
34
|
+
const sector = max === r ? ((g - b) / delta + 6) % 6 : max === g ? (b - r) / delta + 2 : (r - g) / delta + 4;
|
|
35
|
+
return {
|
|
36
|
+
h: Math.round(sector * 60) % 360,
|
|
37
|
+
s: Math.round(saturation * 100),
|
|
38
|
+
l: Math.round(lightness * 100)
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const hslToHex = ({ h, s, l }) => {
|
|
42
|
+
const saturation = s / 100;
|
|
43
|
+
const lightness = l / 100;
|
|
44
|
+
const amount = saturation * Math.min(lightness, 1 - lightness);
|
|
45
|
+
const channel = (offset) => {
|
|
46
|
+
const k = (offset + h / 30) % 12;
|
|
47
|
+
const value = lightness - amount * Math.max(-1, Math.min(k - 3, 9 - k, 1));
|
|
48
|
+
return Math.round(value * 255).toString(16).padStart(2, "0");
|
|
49
|
+
};
|
|
50
|
+
return `#${channel(0)}${channel(8)}${channel(4)}`;
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { hexToHsl, hslToHex, parseHex };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/internal/iso-date.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* `YYYY-MM-DD`(`<input type="date">` の value と `z.iso.date()` の形)のまま
|
|
4
|
+
* 暦日を扱う。
|
|
5
|
+
*
|
|
6
|
+
* 暦日はタイムゾーンを持たないので、計算は UTC の Date で行い、書式にも
|
|
7
|
+
* `timeZone: 'UTC'` を渡す。ローカル時刻の Date で持つと、UTC より西の
|
|
8
|
+
* タイムゾーンで 1 日前にずれる。Temporal.PlainDate が本来の道具だが、
|
|
9
|
+
* Baseline に入っていない。
|
|
10
|
+
*/
|
|
11
|
+
export type IsoDate = string;
|
|
12
|
+
/** 実在する暦日の `YYYY-MM-DD` なら UTC の Date を返す(2 月 30 日などは null)。 */
|
|
13
|
+
export declare const toUtcDate: (value: string) => Date | null;
|
|
14
|
+
export declare const isIsoDate: (value: string) => boolean;
|
|
15
|
+
export declare const addDays: (value: IsoDate, days: number) => IsoDate;
|
|
16
|
+
/** 月をまたいでも日は繰り越さず、移った先の月末で止める(1/31 の翌月は 2/28)。 */
|
|
17
|
+
export declare const addMonths: (value: IsoDate, months: number) => IsoDate;
|
|
18
|
+
export declare const startOfMonth: (value: IsoDate) => IsoDate;
|
|
19
|
+
export declare const endOfMonth: (value: IsoDate) => IsoDate;
|
|
20
|
+
/** 0 = 日曜 … 6 = 土曜(`Date#getUTCDay` と同じ)。 */
|
|
21
|
+
export declare const dayOfWeek: (value: IsoDate) => number;
|
|
22
|
+
/** 週の始まりの曜日(0 = 日曜)から数えて、その日を含む週の初日。 */
|
|
23
|
+
export declare const startOfWeek: (value: IsoDate, firstDay: number) => IsoDate;
|
|
24
|
+
export declare const isSameMonth: (a: IsoDate, b: IsoDate) => boolean;
|
|
25
|
+
/** 4 桁の年の `YYYY-MM-DD` は文字列の順がそのまま日付の順になる。 */
|
|
26
|
+
export declare const clampDate: (value: IsoDate, min: IsoDate | undefined, max: IsoDate | undefined) => IsoDate;
|
|
27
|
+
export declare const isWithin: (value: IsoDate, min: IsoDate | undefined, max: IsoDate | undefined) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 月の表に並べる 6 週ぶんの日付。月の外の日も含む。行数を月ごとに変えないのは、
|
|
30
|
+
* 月を送ったときに高さが変わってポップオーバーの下の縁が跳ねないようにするため。
|
|
31
|
+
*/
|
|
32
|
+
export declare const monthWeeks: (month: IsoDate, firstDay: number) => IsoDate[][];
|
|
33
|
+
/** 書式用の UTC の Date。`Intl.DateTimeFormat` には `timeZone: 'UTC'` と組で渡す。 */
|
|
34
|
+
export declare const formatDate: (value: IsoDate) => Date;
|
|
35
|
+
/** 閲覧者のタイムゾーンでの今日。サーバーでは閲覧者の今日が分からないので、ブラウザでだけ呼ぶ。 */
|
|
36
|
+
export declare const localToday: (now: Date) => IsoDate;
|
|
37
|
+
/** 閲覧者のタイムゾーンで日付が変わるたびに `onChange` を呼ぶ。返す関数で購読をやめる。 */
|
|
38
|
+
export declare const subscribeToDateChange: (onChange: () => void) => (() => void);
|
|
39
|
+
//#endregion
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
//#region src/internal/iso-date.ts
|
|
2
|
+
const ISO_DATE = /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})$/u;
|
|
3
|
+
const utc = (year, monthIndex, day) => {
|
|
4
|
+
const date = /* @__PURE__ */ new Date(0);
|
|
5
|
+
date.setUTCFullYear(year, monthIndex, day);
|
|
6
|
+
return date;
|
|
7
|
+
};
|
|
8
|
+
const pad = (value, length) => String(value).padStart(length, "0");
|
|
9
|
+
const fromUtc = (date) => `${pad(date.getUTCFullYear(), 4)}-${pad(date.getUTCMonth() + 1, 2)}-${pad(date.getUTCDate(), 2)}`;
|
|
10
|
+
/** 実在する暦日の `YYYY-MM-DD` なら UTC の Date を返す(2 月 30 日などは null)。 */
|
|
11
|
+
const toUtcDate = (value) => {
|
|
12
|
+
const groups = ISO_DATE.exec(value)?.groups;
|
|
13
|
+
if (groups === void 0) return null;
|
|
14
|
+
const year = Number(groups.year);
|
|
15
|
+
const month = Number(groups.month);
|
|
16
|
+
const day = Number(groups.day);
|
|
17
|
+
const date = utc(year, month - 1, day);
|
|
18
|
+
return date.getUTCMonth() === month - 1 && date.getUTCDate() === day ? date : null;
|
|
19
|
+
};
|
|
20
|
+
const isIsoDate = (value) => toUtcDate(value) !== null;
|
|
21
|
+
const parts = (value) => {
|
|
22
|
+
const date = toUtcDate(value);
|
|
23
|
+
if (date === null) throw new RangeError(`YYYY-MM-DD の暦日ではありません: ${value}`);
|
|
24
|
+
return [
|
|
25
|
+
date.getUTCFullYear(),
|
|
26
|
+
date.getUTCMonth(),
|
|
27
|
+
date.getUTCDate()
|
|
28
|
+
];
|
|
29
|
+
};
|
|
30
|
+
const addDays = (value, days) => {
|
|
31
|
+
const [year, month, day] = parts(value);
|
|
32
|
+
return fromUtc(utc(year, month, day + days));
|
|
33
|
+
};
|
|
34
|
+
const daysInMonth = (year, monthIndex) => utc(year, monthIndex + 1, 0).getUTCDate();
|
|
35
|
+
/** 月をまたいでも日は繰り越さず、移った先の月末で止める(1/31 の翌月は 2/28)。 */
|
|
36
|
+
const addMonths = (value, months) => {
|
|
37
|
+
const [year, month, day] = parts(value);
|
|
38
|
+
const first = utc(year, month + months, 1);
|
|
39
|
+
const lastDay = daysInMonth(first.getUTCFullYear(), first.getUTCMonth());
|
|
40
|
+
first.setUTCDate(Math.min(day, lastDay));
|
|
41
|
+
return fromUtc(first);
|
|
42
|
+
};
|
|
43
|
+
const startOfMonth = (value) => {
|
|
44
|
+
const [year, month] = parts(value);
|
|
45
|
+
return fromUtc(utc(year, month, 1));
|
|
46
|
+
};
|
|
47
|
+
const endOfMonth = (value) => {
|
|
48
|
+
const [year, month] = parts(value);
|
|
49
|
+
return fromUtc(utc(year, month + 1, 0));
|
|
50
|
+
};
|
|
51
|
+
/** 0 = 日曜 … 6 = 土曜(`Date#getUTCDay` と同じ)。 */
|
|
52
|
+
const dayOfWeek = (value) => {
|
|
53
|
+
const [year, month, day] = parts(value);
|
|
54
|
+
return utc(year, month, day).getUTCDay();
|
|
55
|
+
};
|
|
56
|
+
/** 週の始まりの曜日(0 = 日曜)から数えて、その日を含む週の初日。 */
|
|
57
|
+
const startOfWeek = (value, firstDay) => addDays(value, -((dayOfWeek(value) - firstDay + 7) % 7));
|
|
58
|
+
const isSameMonth = (a, b) => a.slice(0, 7) === b.slice(0, 7);
|
|
59
|
+
/** 4 桁の年の `YYYY-MM-DD` は文字列の順がそのまま日付の順になる。 */
|
|
60
|
+
const clampDate = (value, min, max) => {
|
|
61
|
+
if (min !== void 0 && value < min) return min;
|
|
62
|
+
if (max !== void 0 && value > max) return max;
|
|
63
|
+
return value;
|
|
64
|
+
};
|
|
65
|
+
const isWithin = (value, min, max) => (min === void 0 || value >= min) && (max === void 0 || value <= max);
|
|
66
|
+
/**
|
|
67
|
+
* 月の表に並べる 6 週ぶんの日付。月の外の日も含む。行数を月ごとに変えないのは、
|
|
68
|
+
* 月を送ったときに高さが変わってポップオーバーの下の縁が跳ねないようにするため。
|
|
69
|
+
*/
|
|
70
|
+
const monthWeeks = (month, firstDay) => {
|
|
71
|
+
const start = startOfWeek(startOfMonth(month), firstDay);
|
|
72
|
+
return Array.from({ length: 6 }, (_, week) => Array.from({ length: 7 }, (_day, weekday) => addDays(start, week * 7 + weekday)));
|
|
73
|
+
};
|
|
74
|
+
/** 書式用の UTC の Date。`Intl.DateTimeFormat` には `timeZone: 'UTC'` と組で渡す。 */
|
|
75
|
+
const formatDate = (value) => {
|
|
76
|
+
const [year, month, day] = parts(value);
|
|
77
|
+
return utc(year, month, day);
|
|
78
|
+
};
|
|
79
|
+
/** 閲覧者のタイムゾーンでの今日。サーバーでは閲覧者の今日が分からないので、ブラウザでだけ呼ぶ。 */
|
|
80
|
+
const localToday = (now) => `${pad(now.getFullYear(), 4)}-${pad(now.getMonth() + 1, 2)}-${pad(now.getDate(), 2)}`;
|
|
81
|
+
/** 閲覧者のタイムゾーンで日付が変わるたびに `onChange` を呼ぶ。返す関数で購読をやめる。 */
|
|
82
|
+
const subscribeToDateChange = (onChange) => {
|
|
83
|
+
let timer;
|
|
84
|
+
const schedule = () => {
|
|
85
|
+
const now = /* @__PURE__ */ new Date();
|
|
86
|
+
const tomorrow = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
|
|
87
|
+
timer = setTimeout(() => {
|
|
88
|
+
onChange();
|
|
89
|
+
schedule();
|
|
90
|
+
}, tomorrow.getTime() - now.getTime());
|
|
91
|
+
};
|
|
92
|
+
schedule();
|
|
93
|
+
return () => {
|
|
94
|
+
clearTimeout(timer);
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { addDays, addMonths, clampDate, dayOfWeek, endOfMonth, formatDate, isIsoDate, isSameMonth, isWithin, localToday, monthWeeks, startOfMonth, startOfWeek, subscribeToDateChange, toUtcDate };
|
|
@@ -3,13 +3,5 @@ const toPrecision = (value, precision) => {
|
|
|
3
3
|
const scaleFactor = 10 ** (precision ?? 10);
|
|
4
4
|
return Math.round(value * scaleFactor) / scaleFactor;
|
|
5
5
|
};
|
|
6
|
-
if (import.meta.vitest) it("数値を指定した桁数に丸める", () => {
|
|
7
|
-
expect(toPrecision(1.2345, 0)).toBe(1);
|
|
8
|
-
expect(toPrecision(1.2345, 1)).toBe(1.2);
|
|
9
|
-
expect(toPrecision(1.2345, 2)).toBe(1.23);
|
|
10
|
-
expect(toPrecision(1.2345, 3)).toBe(1.235);
|
|
11
|
-
expect(toPrecision(1.2345, 4)).toBe(1.2345);
|
|
12
|
-
expect(toPrecision(1.2345, 5)).toBe(1.2345);
|
|
13
|
-
});
|
|
14
6
|
//#endregion
|
|
15
7
|
export { toPrecision };
|