@icen.ai/ui 0.9.0 → 0.11.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/AGENTS.md +82 -254
- package/LICENSE +21 -0
- package/README.md +60 -96
- package/dist/base.css +258 -188
- package/dist/behaviors/accordion.mjs +8 -8
- package/dist/behaviors/ai-branch.d.mts +1 -1
- package/dist/behaviors/ai-branch.mjs +1011 -94
- package/dist/behaviors/ai-chat.d.mts +9 -9
- package/dist/behaviors/ai-chat.mjs +1122 -169
- package/dist/behaviors/ai-composer.d.mts +47 -15
- package/dist/behaviors/ai-composer.mjs +2018 -534
- package/dist/behaviors/ai-core.d.mts +1 -1
- package/dist/behaviors/ai-core.mjs +1017 -107
- package/dist/behaviors/ai-diff.mjs +1020 -127
- package/dist/behaviors/ai-feedback.d.mts +1 -1
- package/dist/behaviors/ai-feedback.mjs +1036 -126
- package/dist/behaviors/ai-panel.d.mts +10 -10
- package/dist/behaviors/ai-panel.mjs +1285 -266
- package/dist/behaviors/ai-provider.d.mts +1 -1
- package/dist/behaviors/ai-provider.mjs +1004 -101
- package/dist/behaviors/ai-threads.d.mts +1 -1
- package/dist/behaviors/ai-threads.mjs +1069 -154
- package/dist/behaviors/ai-tool.d.mts +3 -3
- package/dist/behaviors/ai-tool.mjs +2087 -413
- package/dist/behaviors/ai-tools.d.mts +89 -16
- package/dist/behaviors/ai-tools.mjs +5365 -380
- package/dist/behaviors/autocomplete.d.mts +53 -0
- package/dist/behaviors/autocomplete.mjs +1601 -0
- package/dist/behaviors/back-top.d.mts +1 -1
- package/dist/behaviors/back-top.mjs +952 -14
- package/dist/behaviors/carousel.d.mts +1 -1
- package/dist/behaviors/carousel.mjs +914 -12
- package/dist/behaviors/cascader.d.mts +48 -0
- package/dist/behaviors/cascader.mjs +1867 -0
- package/dist/behaviors/charts.d.mts +72 -8
- package/dist/behaviors/charts.mjs +1953 -272
- package/dist/behaviors/code-block.d.mts +36 -0
- package/dist/behaviors/code-block.mjs +1619 -0
- package/dist/behaviors/command-palette.d.mts +9 -6
- package/dist/behaviors/command-palette.mjs +164 -62
- package/dist/behaviors/context-menu.d.mts +10 -9
- package/dist/behaviors/context-menu.mjs +1113 -44
- package/dist/behaviors/controls.d.mts +21 -21
- package/dist/behaviors/controls.mjs +1024 -134
- package/dist/behaviors/copy.d.mts +21 -2
- package/dist/behaviors/copy.mjs +1207 -42
- package/dist/behaviors/datatable.d.mts +55 -5
- package/dist/behaviors/datatable.mjs +2033 -212
- package/dist/behaviors/date-picker.d.mts +0 -1
- package/dist/behaviors/date-picker.mjs +1341 -293
- package/dist/behaviors/design.d.mts +54 -0
- package/dist/behaviors/design.mjs +109 -0
- package/dist/behaviors/dropdown.d.mts +5 -6
- package/dist/behaviors/dropdown.mjs +262 -110
- package/dist/behaviors/events.d.mts +127 -10
- package/dist/behaviors/events.mjs +58 -3
- package/dist/behaviors/feedback.d.mts +30 -0
- package/dist/behaviors/feedback.mjs +296 -0
- package/dist/behaviors/focus.d.mts +8 -0
- package/dist/behaviors/focus.mjs +24 -0
- package/dist/behaviors/form-validate.d.mts +111 -0
- package/dist/behaviors/form-validate.mjs +1746 -0
- package/dist/behaviors/i18n.d.mts +790 -0
- package/dist/behaviors/i18n.mjs +1713 -0
- package/dist/behaviors/icons.d.mts +93 -0
- package/dist/behaviors/icons.mjs +113 -0
- package/dist/behaviors/input.d.mts +9 -1
- package/dist/behaviors/input.mjs +1059 -60
- package/dist/behaviors/kb-access.d.mts +3 -3
- package/dist/behaviors/kb-access.mjs +2135 -239
- package/dist/behaviors/kb-acl.d.mts +8 -8
- package/dist/behaviors/kb-acl.mjs +1120 -179
- package/dist/behaviors/kb-answer.d.mts +2 -2
- package/dist/behaviors/kb-answer.mjs +2120 -435
- package/dist/behaviors/kb-audit.d.mts +3 -3
- package/dist/behaviors/kb-audit.mjs +1077 -154
- package/dist/behaviors/kb-canvas.d.mts +3 -3
- package/dist/behaviors/kb-canvas.mjs +1101 -177
- package/dist/behaviors/kb-chain.d.mts +2 -2
- package/dist/behaviors/kb-chain.mjs +1023 -100
- package/dist/behaviors/kb-checkpoint.d.mts +3 -3
- package/dist/behaviors/kb-checkpoint.mjs +1320 -169
- package/dist/behaviors/kb-chunks.d.mts +2 -2
- package/dist/behaviors/kb-chunks.mjs +1153 -213
- package/dist/behaviors/kb-citation.d.mts +3 -3
- package/dist/behaviors/kb-citation.mjs +1221 -185
- package/dist/behaviors/kb-clarify.d.mts +2 -2
- package/dist/behaviors/kb-clarify.mjs +1059 -130
- package/dist/behaviors/kb-conflict.d.mts +2 -2
- package/dist/behaviors/kb-conflict.mjs +1042 -119
- package/dist/behaviors/kb-connector.d.mts +2 -2
- package/dist/behaviors/kb-connector.mjs +1105 -176
- package/dist/behaviors/kb-core.d.mts +7 -2
- package/dist/behaviors/kb-core.mjs +1078 -162
- package/dist/behaviors/kb-eval.d.mts +2 -2
- package/dist/behaviors/kb-eval.mjs +1977 -144
- package/dist/behaviors/kb-explain.d.mts +3 -3
- package/dist/behaviors/kb-explain.mjs +1037 -104
- package/dist/behaviors/kb-filter.d.mts +2 -2
- package/dist/behaviors/kb-filter.mjs +2014 -178
- package/dist/behaviors/kb-gap.d.mts +3 -3
- package/dist/behaviors/kb-gap.mjs +1044 -121
- package/dist/behaviors/kb-hittest.d.mts +3 -3
- package/dist/behaviors/kb-hittest.mjs +1095 -151
- package/dist/behaviors/kb-metadata.mjs +1058 -130
- package/dist/behaviors/kb-passage.d.mts +4 -4
- package/dist/behaviors/kb-passage.mjs +1102 -161
- package/dist/behaviors/kb-pipeline.d.mts +4 -4
- package/dist/behaviors/kb-pipeline.mjs +1083 -162
- package/dist/behaviors/kb-qa.mjs +1089 -160
- package/dist/behaviors/kb-rerank.d.mts +2 -2
- package/dist/behaviors/kb-rerank.mjs +1048 -114
- package/dist/behaviors/kb-retrieval.d.mts +2 -2
- package/dist/behaviors/kb-retrieval.mjs +2079 -226
- package/dist/behaviors/kb-review.d.mts +2 -2
- package/dist/behaviors/kb-review.mjs +1996 -159
- package/dist/behaviors/kb-sandbox.d.mts +3 -3
- package/dist/behaviors/kb-sandbox.mjs +1033 -105
- package/dist/behaviors/kb-segment.d.mts +2 -2
- package/dist/behaviors/kb-segment.mjs +1112 -179
- package/dist/behaviors/kb-select.d.mts +24 -0
- package/dist/behaviors/kb-select.mjs +1995 -0
- package/dist/behaviors/kb-sources.d.mts +3 -3
- package/dist/behaviors/kb-sources.mjs +1085 -170
- package/dist/behaviors/kb-sql.d.mts +3 -3
- package/dist/behaviors/kb-sql.mjs +1144 -226
- package/dist/behaviors/kb-trace.d.mts +3 -3
- package/dist/behaviors/kb-trace.mjs +1051 -131
- package/dist/behaviors/kb-visibility.d.mts +2 -2
- package/dist/behaviors/kb-visibility.mjs +1087 -158
- package/dist/behaviors/kb-who-can.d.mts +2 -2
- package/dist/behaviors/kb-who-can.mjs +1980 -137
- package/dist/behaviors/mentions.d.mts +93 -0
- package/dist/behaviors/mentions.mjs +2153 -0
- package/dist/behaviors/modal.d.mts +4 -3
- package/dist/behaviors/modal.mjs +1056 -33
- package/dist/behaviors/nav.d.mts +1 -1
- package/dist/behaviors/nav.mjs +6 -6
- package/dist/behaviors/notification.d.mts +16 -8
- package/dist/behaviors/notification.mjs +1629 -268
- package/dist/behaviors/panel.d.mts +4 -0
- package/dist/behaviors/panel.mjs +995 -0
- package/dist/behaviors/popover.d.mts +28 -5
- package/dist/behaviors/popover.mjs +225 -24
- package/dist/behaviors/scroll-area.d.mts +17 -0
- package/dist/behaviors/scroll-area.mjs +59 -0
- package/dist/behaviors/select.d.mts +5 -2
- package/dist/behaviors/select.mjs +1416 -117
- package/dist/behaviors/sidebar.d.mts +1 -1
- package/dist/behaviors/sidebar.mjs +13 -13
- package/dist/behaviors/slider.d.mts +1 -1
- package/dist/behaviors/slider.mjs +12 -12
- package/dist/behaviors/split-pane.d.mts +1 -1
- package/dist/behaviors/split-pane.mjs +9 -7
- package/dist/behaviors/suggestions.d.mts +27 -0
- package/dist/behaviors/suggestions.mjs +1090 -0
- package/dist/behaviors/svg-parse.d.mts +14 -0
- package/dist/behaviors/svg-parse.mjs +37 -0
- package/dist/behaviors/tabs.d.mts +2 -2
- package/dist/behaviors/tabs.mjs +35 -25
- package/dist/behaviors/tag-input.d.mts +23 -5
- package/dist/behaviors/tag-input.mjs +1360 -104
- package/dist/behaviors/theme-switcher.d.mts +24 -0
- package/dist/behaviors/theme-switcher.mjs +1996 -0
- package/dist/behaviors/theme.d.mts +15 -8
- package/dist/behaviors/theme.mjs +406 -30
- package/dist/behaviors/toast.d.mts +24 -25
- package/dist/behaviors/toast.mjs +1267 -88
- package/dist/behaviors/tooltip.d.mts +4 -0
- package/dist/behaviors/tooltip.mjs +378 -0
- package/dist/behaviors/tree-select.d.mts +69 -0
- package/dist/behaviors/tree-select.mjs +1921 -0
- package/dist/behaviors/tree.d.mts +1 -1
- package/dist/behaviors/tree.mjs +18 -18
- package/dist/behaviors/upload.d.mts +3 -2
- package/dist/behaviors/upload.mjs +1077 -66
- package/dist/behaviors/url-safety.d.mts +8 -0
- package/dist/behaviors/url-safety.mjs +11 -0
- package/dist/cli.mjs +5 -6
- package/dist/components/accordion.d.mts +2 -0
- package/dist/components/ai-branch.d.mts +2 -0
- package/dist/components/ai-chat.css +682 -582
- package/dist/components/ai-chat.d.mts +2 -0
- package/dist/components/ai-composer.d.mts +2 -0
- package/dist/components/ai-context.d.mts +2 -0
- package/dist/components/ai-context.mjs +1 -0
- package/dist/components/ai-diff.css +153 -132
- package/dist/components/ai-diff.d.mts +2 -0
- package/dist/components/ai-feedback.d.mts +2 -0
- package/dist/components/ai-files.d.mts +2 -0
- package/dist/components/ai-message.d.mts +2 -0
- package/dist/components/ai-panel.css +353 -343
- package/dist/components/ai-reasoning.d.mts +2 -0
- package/dist/components/ai-subagent.d.mts +2 -0
- package/dist/components/ai-subagent.mjs +1 -0
- package/dist/components/ai-threads.d.mts +2 -0
- package/dist/components/ai-todo.d.mts +2 -0
- package/dist/components/ai-todo.mjs +1 -0
- package/dist/components/ai-tool-call.d.mts +2 -0
- package/dist/components/ai-tool-call.mjs +1 -0
- package/dist/components/ai-tool.css +397 -242
- package/dist/components/ai-usage.d.mts +2 -0
- package/dist/components/alert.d.mts +2 -0
- package/dist/components/autocomplete.css +61 -0
- package/dist/components/autocomplete.d.mts +2 -0
- package/dist/components/autocomplete.mjs +3 -0
- package/dist/components/avatar.d.mts +2 -0
- package/dist/components/back-top.css +74 -40
- package/dist/components/back-top.d.mts +2 -0
- package/dist/components/badge.css +44 -41
- package/dist/components/badge.d.mts +2 -0
- package/dist/components/breadcrumb.css +85 -46
- package/dist/components/breadcrumb.d.mts +2 -0
- package/dist/components/btn.css +105 -94
- package/dist/components/btn.d.mts +2 -0
- package/dist/components/card.css +124 -113
- package/dist/components/card.d.mts +2 -0
- package/dist/components/carousel.d.mts +2 -0
- package/dist/components/cascader.css +332 -0
- package/dist/components/cascader.d.mts +2 -0
- package/dist/components/cascader.mjs +3 -0
- package/dist/components/chart-area.css +54 -2
- package/dist/components/chart-area.d.mts +2 -0
- package/dist/components/chart-bar.css +147 -38
- package/dist/components/chart-bar.d.mts +2 -0
- package/dist/components/chart-calendar.d.mts +2 -0
- package/dist/components/chart-gauge.css +36 -13
- package/dist/components/chart-gauge.d.mts +2 -0
- package/dist/components/chart-graph.css +35 -20
- package/dist/components/chart-graph.d.mts +2 -0
- package/dist/components/chart-heatmap.css +67 -39
- package/dist/components/chart-heatmap.d.mts +2 -0
- package/dist/components/chart-line.css +62 -3
- package/dist/components/chart-line.d.mts +2 -0
- package/dist/components/chart-map.d.mts +2 -0
- package/dist/components/chart-pie.css +38 -6
- package/dist/components/chart-pie.d.mts +2 -0
- package/dist/components/chart-radar.css +57 -5
- package/dist/components/chart-radar.d.mts +2 -0
- package/dist/components/chart-scatter.css +47 -7
- package/dist/components/chart-scatter.d.mts +2 -0
- package/dist/components/chart-sparkline.css +25 -2
- package/dist/components/chart-sparkline.d.mts +2 -0
- package/dist/components/chart-stack.css +27 -13
- package/dist/components/chart-stack.d.mts +2 -0
- package/dist/components/charts.css +220 -84
- package/dist/components/charts.d.mts +2 -0
- package/dist/components/code-block.css +420 -0
- package/dist/components/code-block.d.mts +2 -0
- package/dist/components/code-block.mjs +4 -0
- package/dist/components/command-palette.css +150 -122
- package/dist/components/command-palette.d.mts +2 -0
- package/dist/components/content.css +274 -263
- package/dist/components/context-menu.d.mts +2 -0
- package/dist/components/copy.css +73 -45
- package/dist/components/copy.d.mts +2 -0
- package/dist/components/datatable.css +457 -202
- package/dist/components/datatable.d.mts +2 -0
- package/dist/components/date-picker.css +136 -105
- package/dist/components/date-picker.d.mts +2 -0
- package/dist/components/desc.d.mts +2 -0
- package/dist/components/dropdown.d.mts +2 -0
- package/dist/components/empty.css +72 -69
- package/dist/components/empty.d.mts +2 -0
- package/dist/components/feedback.css +211 -191
- package/dist/components/form-validate.css +134 -0
- package/dist/components/form-validate.d.mts +2 -0
- package/dist/components/form-validate.mjs +3 -0
- package/dist/components/form.css +157 -131
- package/dist/components/form.d.mts +2 -0
- package/dist/components/icon.css +113 -0
- package/dist/components/icon.d.mts +2 -0
- package/dist/components/icon.mjs +3 -0
- package/dist/components/input.css +163 -108
- package/dist/components/input.d.mts +2 -0
- package/dist/components/kb-access.d.mts +2 -0
- package/dist/components/kb-acl.d.mts +2 -0
- package/dist/components/kb-agent.css +300 -206
- package/dist/components/kb-answer.d.mts +2 -0
- package/dist/components/kb-audit.d.mts +2 -0
- package/dist/components/kb-canvas.d.mts +2 -0
- package/dist/components/kb-chain.d.mts +2 -0
- package/dist/components/kb-checkpoint.d.mts +2 -0
- package/dist/components/kb-chunks.d.mts +2 -0
- package/dist/components/kb-citation.d.mts +2 -0
- package/dist/components/kb-clarify.d.mts +2 -0
- package/dist/components/kb-conflict.d.mts +2 -0
- package/dist/components/kb-connector.d.mts +2 -0
- package/dist/components/kb-data.css +431 -315
- package/dist/components/kb-eval.d.mts +2 -0
- package/dist/components/kb-explain.d.mts +2 -0
- package/dist/components/kb-filter.d.mts +2 -0
- package/dist/components/kb-gap.d.mts +2 -0
- package/dist/components/kb-ground.css +333 -229
- package/dist/components/kb-hittest.d.mts +2 -0
- package/dist/components/kb-ingest.css +613 -434
- package/dist/components/kb-metadata.d.mts +2 -0
- package/dist/components/kb-ops.css +422 -302
- package/dist/components/kb-passage.d.mts +2 -0
- package/dist/components/kb-perm.css +374 -314
- package/dist/components/kb-pipeline.d.mts +2 -0
- package/dist/components/kb-qa.d.mts +2 -0
- package/dist/components/kb-rerank.d.mts +2 -0
- package/dist/components/kb-retrieval.d.mts +2 -0
- package/dist/components/kb-review.d.mts +2 -0
- package/dist/components/kb-sandbox.d.mts +2 -0
- package/dist/components/kb-search.css +653 -459
- package/dist/components/kb-segment.d.mts +2 -0
- package/dist/components/kb-sources.d.mts +2 -0
- package/dist/components/kb-sql.d.mts +2 -0
- package/dist/components/kb-trace.d.mts +2 -0
- package/dist/components/kb-visibility.d.mts +2 -0
- package/dist/components/kb-who-can.d.mts +2 -0
- package/dist/components/kb.css +170 -135
- package/dist/components/kb.d.mts +2 -0
- package/dist/components/kbd.d.mts +2 -0
- package/dist/components/layout.css +86 -83
- package/dist/components/layout.d.mts +2 -0
- package/dist/components/list.d.mts +2 -0
- package/dist/components/material-chinese.css +83 -0
- package/dist/components/material-soviet.css +86 -0
- package/dist/components/material.css +318 -0
- package/dist/components/media-card.d.mts +2 -0
- package/dist/components/media.css +225 -176
- package/dist/components/mentions.css +190 -0
- package/dist/components/mentions.d.mts +2 -0
- package/dist/components/mentions.mjs +3 -0
- package/dist/components/menu.css +121 -109
- package/dist/components/modal.css +116 -118
- package/dist/components/modal.d.mts +2 -0
- package/dist/components/nav.css +136 -129
- package/dist/components/nav.d.mts +2 -0
- package/dist/components/notification.css +247 -177
- package/dist/components/notification.d.mts +2 -0
- package/dist/components/pagination.css +62 -57
- package/dist/components/pagination.d.mts +2 -0
- package/dist/components/panel.css +70 -68
- package/dist/components/panel.d.mts +2 -0
- package/dist/components/panel.mjs +1 -0
- package/dist/components/pill.css +83 -72
- package/dist/components/pill.d.mts +2 -0
- package/dist/components/popover.css +80 -57
- package/dist/components/popover.d.mts +2 -0
- package/dist/components/progress.d.mts +2 -0
- package/dist/components/rating.d.mts +2 -0
- package/dist/components/result.d.mts +2 -0
- package/dist/components/scroll-area.css +29 -54
- package/dist/components/scroll-area.d.mts +2 -0
- package/dist/components/scroll-area.mjs +1 -0
- package/dist/components/segmented.css +167 -146
- package/dist/components/segmented.d.mts +2 -0
- package/dist/components/select.css +250 -191
- package/dist/components/select.d.mts +2 -0
- package/dist/components/sidebar.css +157 -143
- package/dist/components/sidebar.d.mts +2 -0
- package/dist/components/skeleton.d.mts +2 -0
- package/dist/components/slider.css +135 -128
- package/dist/components/slider.d.mts +2 -0
- package/dist/components/spinner.d.mts +2 -0
- package/dist/components/split-pane.css +120 -108
- package/dist/components/split-pane.d.mts +2 -0
- package/dist/components/stat.css +116 -109
- package/dist/components/stat.d.mts +2 -0
- package/dist/components/steps.css +114 -108
- package/dist/components/steps.d.mts +2 -0
- package/dist/components/switch.css +192 -149
- package/dist/components/switch.d.mts +2 -0
- package/dist/components/table.css +158 -112
- package/dist/components/table.d.mts +2 -0
- package/dist/components/tabs.css +143 -116
- package/dist/components/tabs.d.mts +2 -0
- package/dist/components/tag-input.css +52 -133
- package/dist/components/tag-input.d.mts +2 -0
- package/dist/components/tag.css +90 -72
- package/dist/components/tag.d.mts +2 -0
- package/dist/components/theme-switcher.css +105 -0
- package/dist/components/theme-switcher.d.mts +2 -0
- package/dist/components/theme-switcher.mjs +3 -0
- package/dist/components/timeline.d.mts +2 -0
- package/dist/components/toast.css +115 -97
- package/dist/components/toast.d.mts +2 -0
- package/dist/components/toolbar.css +47 -43
- package/dist/components/toolbar.d.mts +2 -0
- package/dist/components/tooltip.css +103 -43
- package/dist/components/tooltip.d.mts +2 -0
- package/dist/components/tooltip.mjs +1 -0
- package/dist/components/tree-select.css +439 -0
- package/dist/components/tree-select.d.mts +2 -0
- package/dist/components/tree-select.mjs +3 -0
- package/dist/components/tree.d.mts +2 -0
- package/dist/components/upload.css +138 -97
- package/dist/components/upload.d.mts +2 -0
- package/dist/fonts/LICENSES/ark-pixel/OFL.txt +96 -0
- package/dist/fonts/LICENSES/cubic-11/OFL.txt +108 -0
- package/dist/fonts/LICENSES/galmuri/LICENSE.txt +93 -0
- package/dist/fonts/OFL.txt +96 -0
- package/dist/fonts/README.md +14 -0
- package/dist/fonts/fusion-pixel-12px-zh-hans.woff2 +0 -0
- package/dist/index.d.mts +85 -70
- package/dist/index.mjs +17330 -5773
- package/dist/react.d.mts +91 -0
- package/dist/react.mjs +8307 -0
- package/dist/registry.json +918 -70
- package/dist/tokens/chinese.css +44 -0
- package/dist/tokens/colors.css +371 -1222
- package/dist/tokens/design.css +209 -0
- package/dist/tokens/dtcg.json +15926 -0
- package/dist/tokens/figma.variables.json +10779 -0
- package/dist/tokens/icon-masks.css +78 -0
- package/dist/tokens/pixel.css +53 -0
- package/dist/tokens/scrollbars.css +40 -0
- package/dist/tokens/soviet.css +44 -0
- package/dist/tokens/style-profiles.css +36 -547
- package/dist/tokens/themes.json +308 -0
- package/dist/tokens/tokens-studio.json +11648 -0
- package/dist/tokens/typography.css +21 -18
- package/dist/tokens.css +1783 -1806
- package/dist/ui.css +14796 -10750
- package/dist/vue.d.mts +344 -0
- package/dist/vue.mjs +7876 -0
- package/docs/spec/ai-input-experience.md +75 -0
- package/docs/spec/ai-native.md +238 -147
- package/docs/spec/design-philosophy.md +189 -0
- package/docs/spec/design-primitives.md +196 -0
- package/docs/spec/kb-family.md +147 -115
- package/docs/spec/scrollbars.md +46 -0
- package/package.json +56 -8
- package/dist/retro-effects.css +0 -255
- package/dist/tokens/retro-effects.css +0 -255
- package/docs/research/2026-10-03-ai-kb-components.md +0 -392
- package/docs/research/2026-10-03-kb-permissions.md +0 -992
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { ChartEventDetail } from './charts.
|
|
2
|
-
import { AiUsage } from './ai-core.
|
|
3
|
-
import { AiDoneEventDetail } from './ai-provider.
|
|
4
|
-
import { AiComposerRefSource } from './ai-composer.
|
|
5
|
-
import {
|
|
6
|
-
import './
|
|
7
|
-
import './
|
|
1
|
+
import { ChartEventDetail } from './charts.mjs';
|
|
2
|
+
import { AiUsage } from './ai-core.mjs';
|
|
3
|
+
import { AiDoneEventDetail } from './ai-provider.mjs';
|
|
4
|
+
import { AiComposerRefSource } from './ai-composer.mjs';
|
|
5
|
+
import { MentionEntity, MentionValue } from './mentions.mjs';
|
|
6
|
+
import { KbCitation, KbSegmentConfig, KbRetrievalQuery, KbFilterNode, KbCheckpointScope, KbSandboxMessage, KbChainStep, KbAclEntry, KbIdentity, KbAclDecision, KbAccessRequest, KbRole, KbAuditChannel, KbHygieneIssue } from './kb-core.mjs';
|
|
7
|
+
import './icons.mjs';
|
|
8
|
+
import './popover.mjs';
|
|
9
|
+
import './ai-panel.mjs';
|
|
10
|
+
import './suggestions.mjs';
|
|
8
11
|
|
|
9
12
|
interface IcenGestureDetail {
|
|
10
|
-
/** 手势命中源:最近的 [data-gestures] 宿主 */
|
|
13
|
+
/** 手势命中源:最近的 [data-icen-gestures] 宿主 */
|
|
11
14
|
source: HTMLElement;
|
|
12
15
|
/** 原始 DOM 事件(click / contextmenu / pointerdown / mouseup…) */
|
|
13
16
|
originalEvent: Event;
|
|
@@ -20,6 +23,8 @@ interface IcenGestureDetail {
|
|
|
20
23
|
type IcenPolicy = (e: CustomEvent<IcenGestureDetail>) => void;
|
|
21
24
|
/** 手势层事件名(策略层只认这五种,编译期收死)。 */
|
|
22
25
|
type IcenGestureEvent = 'icen:click' | 'icen:dblclick' | 'icen:contextmenu' | 'icen:longpress' | 'icen:text-select';
|
|
26
|
+
/** 滑动手势事件名(策略层不收——swipe 只有事件语义,无全站默认行为需求)。 */
|
|
27
|
+
type IcenSwipeEvent = 'icen:swipe-left' | 'icen:swipe-right' | 'icen:swipe-up' | 'icen:swipe-down';
|
|
23
28
|
/**
|
|
24
29
|
* 全库事件注册表:事件名 → detail 契约。onIcen 推断、emitIcen 校验,双侧同表。
|
|
25
30
|
* 新增事件必须在此登记(模板签名兜底只留给宿主自定义事件)。
|
|
@@ -30,6 +35,25 @@ interface IcenEventMap {
|
|
|
30
35
|
'icen:contextmenu': IcenGestureDetail;
|
|
31
36
|
'icen:longpress': IcenGestureDetail;
|
|
32
37
|
'icen:text-select': IcenGestureDetail;
|
|
38
|
+
'icen:swipe-left': IcenGestureDetail & {
|
|
39
|
+
dx: number;
|
|
40
|
+
dy: number;
|
|
41
|
+
};
|
|
42
|
+
'icen:swipe-right': IcenGestureDetail & {
|
|
43
|
+
dx: number;
|
|
44
|
+
dy: number;
|
|
45
|
+
};
|
|
46
|
+
'icen:swipe-up': IcenGestureDetail & {
|
|
47
|
+
dx: number;
|
|
48
|
+
dy: number;
|
|
49
|
+
};
|
|
50
|
+
'icen:swipe-down': IcenGestureDetail & {
|
|
51
|
+
dx: number;
|
|
52
|
+
dy: number;
|
|
53
|
+
};
|
|
54
|
+
'icen:locale-change': {
|
|
55
|
+
changed: string[];
|
|
56
|
+
};
|
|
33
57
|
'icen:chart-hover': ChartEventDetail;
|
|
34
58
|
'icen:chart-click': ChartEventDetail;
|
|
35
59
|
'icen:chart-dblclick': ChartEventDetail;
|
|
@@ -42,6 +66,12 @@ interface IcenEventMap {
|
|
|
42
66
|
'icen:chart-legend-visibility': {
|
|
43
67
|
visible: boolean;
|
|
44
68
|
};
|
|
69
|
+
/** 缩放/刷选(renderChart spec.zoom):类目索引区间 [from, to](含端点) */
|
|
70
|
+
'icen:chart-zoom': {
|
|
71
|
+
chart: string;
|
|
72
|
+
from: number;
|
|
73
|
+
to: number;
|
|
74
|
+
};
|
|
45
75
|
'icen:tab-change': {
|
|
46
76
|
tab: HTMLElement | null;
|
|
47
77
|
panel: HTMLElement | null;
|
|
@@ -118,6 +148,11 @@ interface IcenEventMap {
|
|
|
118
148
|
text: string;
|
|
119
149
|
reason: string;
|
|
120
150
|
};
|
|
151
|
+
'icen:code-block-toggle': {
|
|
152
|
+
el: HTMLElement;
|
|
153
|
+
action: 'num' | 'wrap' | 'fold';
|
|
154
|
+
value: boolean;
|
|
155
|
+
};
|
|
121
156
|
'icen:back-top': Record<string, never>;
|
|
122
157
|
'icen:modal-open': {
|
|
123
158
|
id: string;
|
|
@@ -142,6 +177,10 @@ interface IcenEventMap {
|
|
|
142
177
|
value: string;
|
|
143
178
|
date: Date | null;
|
|
144
179
|
};
|
|
180
|
+
'icen:panel-toggle': {
|
|
181
|
+
panel: HTMLElement;
|
|
182
|
+
expanded: boolean;
|
|
183
|
+
};
|
|
145
184
|
'icen:accordion-toggle': {
|
|
146
185
|
item: HTMLElement;
|
|
147
186
|
index: number;
|
|
@@ -199,6 +238,65 @@ interface IcenEventMap {
|
|
|
199
238
|
'icen:table-export': {
|
|
200
239
|
count: number;
|
|
201
240
|
};
|
|
241
|
+
/** 单元格编辑提交(editable 列;宿主应用数据后调 handle.updateCell 或 setData) */
|
|
242
|
+
'icen:table-cell-edit': {
|
|
243
|
+
rowKey: string;
|
|
244
|
+
field: string;
|
|
245
|
+
value: unknown;
|
|
246
|
+
row: unknown;
|
|
247
|
+
};
|
|
248
|
+
/** 列拖拽重排完成 */
|
|
249
|
+
'icen:table-column-reorder': {
|
|
250
|
+
key: string;
|
|
251
|
+
fromIndex: number;
|
|
252
|
+
toIndex: number;
|
|
253
|
+
};
|
|
254
|
+
/** 分组行展开/折叠 */
|
|
255
|
+
'icen:table-group-toggle': {
|
|
256
|
+
key: string;
|
|
257
|
+
collapsed: boolean;
|
|
258
|
+
};
|
|
259
|
+
/** 列宽拖拽完成(拖动过程中不派发,防事件洪泛) */
|
|
260
|
+
'icen:table-column-resize': {
|
|
261
|
+
key: string;
|
|
262
|
+
width: string;
|
|
263
|
+
};
|
|
264
|
+
'icen:form-field-validate': {
|
|
265
|
+
name: string;
|
|
266
|
+
valid: boolean;
|
|
267
|
+
message?: string;
|
|
268
|
+
};
|
|
269
|
+
'icen:form-valid': {
|
|
270
|
+
names: string[];
|
|
271
|
+
};
|
|
272
|
+
'icen:form-invalid': {
|
|
273
|
+
errors: Record<string, string>;
|
|
274
|
+
first: string | null;
|
|
275
|
+
};
|
|
276
|
+
'icen:cascader-change': {
|
|
277
|
+
value: string[];
|
|
278
|
+
path: string[];
|
|
279
|
+
};
|
|
280
|
+
'icen:tree-select-change': {
|
|
281
|
+
value: string[];
|
|
282
|
+
labels: string[];
|
|
283
|
+
};
|
|
284
|
+
'icen:mention-select': {
|
|
285
|
+
item: MentionEntity<unknown>;
|
|
286
|
+
query: string;
|
|
287
|
+
};
|
|
288
|
+
'icen:mention-change': {
|
|
289
|
+
value: MentionValue<unknown>[];
|
|
290
|
+
text: string;
|
|
291
|
+
mentions: MentionEntity<unknown>[];
|
|
292
|
+
};
|
|
293
|
+
'icen:autocomplete-select': {
|
|
294
|
+
value: string;
|
|
295
|
+
label: string;
|
|
296
|
+
};
|
|
297
|
+
'icen:autocomplete-change': {
|
|
298
|
+
value: string;
|
|
299
|
+
};
|
|
202
300
|
'icen:upload': {
|
|
203
301
|
files: File[];
|
|
204
302
|
};
|
|
@@ -235,10 +333,14 @@ interface IcenEventMap {
|
|
|
235
333
|
};
|
|
236
334
|
'icen:ai-send': {
|
|
237
335
|
text: string;
|
|
336
|
+
refs?: AiComposerRefSource[];
|
|
337
|
+
files?: File[];
|
|
238
338
|
};
|
|
239
339
|
'icen:ai-stop': Record<string, never>;
|
|
240
340
|
'icen:ai-queue': {
|
|
241
341
|
text: string;
|
|
342
|
+
refs?: AiComposerRefSource[];
|
|
343
|
+
files?: File[];
|
|
242
344
|
};
|
|
243
345
|
'icen:ai-dequeue': {
|
|
244
346
|
index: number;
|
|
@@ -246,6 +348,10 @@ interface IcenEventMap {
|
|
|
246
348
|
'icen:ai-attach': {
|
|
247
349
|
files: File[];
|
|
248
350
|
};
|
|
351
|
+
'icen:ai-attachment-remove': {
|
|
352
|
+
file: File;
|
|
353
|
+
files: File[];
|
|
354
|
+
};
|
|
249
355
|
'icen:ai-model-change': {
|
|
250
356
|
provider: string;
|
|
251
357
|
model: string;
|
|
@@ -283,6 +389,17 @@ interface IcenEventMap {
|
|
|
283
389
|
name: string;
|
|
284
390
|
el: HTMLElement;
|
|
285
391
|
};
|
|
392
|
+
/** 工具审批(requiresApproval 的工具在挂载卡上等待宿主裁决;approve 才执行 run) */
|
|
393
|
+
'icen:ai-tool-approve': {
|
|
394
|
+
name: string;
|
|
395
|
+
input: Record<string, unknown>;
|
|
396
|
+
el: HTMLElement;
|
|
397
|
+
};
|
|
398
|
+
'icen:ai-tool-reject': {
|
|
399
|
+
name: string;
|
|
400
|
+
input: Record<string, unknown>;
|
|
401
|
+
el: HTMLElement;
|
|
402
|
+
};
|
|
286
403
|
'icen:ai-usage': AiUsage;
|
|
287
404
|
'icen:ai-done': AiDoneEventDetail;
|
|
288
405
|
'icen:ai-thread-select': {
|
|
@@ -491,7 +608,7 @@ interface IcenListenOptions {
|
|
|
491
608
|
/**
|
|
492
609
|
* 统一绑定器(全库事件一个入口):
|
|
493
610
|
* onIcen('icen:tab-change', (e) => e.detail.index) 全局
|
|
494
|
-
* onIcen('icen:chart-click', '.chart', (e) => …) 选择器委托
|
|
611
|
+
* onIcen('icen:chart-click', '.icen-chart', (e) => …) 选择器委托
|
|
495
612
|
* onIcen('icen:upload', (e) => …, { within: formEl }) 子树限定
|
|
496
613
|
* onIcen('icen:ai-done', (e) => …, { signal: ctrl.signal }) 广播 + 信号解绑
|
|
497
614
|
* 返回解绑函数 —— React useEffect / Vue onUnmounted 直接 return。
|
|
@@ -520,4 +637,4 @@ declare function initGestures(): () => void;
|
|
|
520
637
|
/** 摘除手势层委托(等同 initGestures 返回的销毁函数;未启动时为 no-op)。 */
|
|
521
638
|
declare function destroyGestures(): void;
|
|
522
639
|
|
|
523
|
-
export { type IcenEventMap, type IcenGestureDetail, type IcenGestureEvent, type IcenListenOptions, type IcenPolicy, destroyGestures, emitIcen, getEventPolicy, initGestures, onIcen, resetEventPolicies, setEventPolicy };
|
|
640
|
+
export { type IcenEventMap, type IcenGestureDetail, type IcenGestureEvent, type IcenListenOptions, type IcenPolicy, type IcenSwipeEvent, destroyGestures, emitIcen, getEventPolicy, initGestures, onIcen, resetEventPolicies, setEventPolicy };
|
|
@@ -55,10 +55,13 @@ var LONGPRESS_MS = 520;
|
|
|
55
55
|
var LONGPRESS_MOVE = 12;
|
|
56
56
|
var CLICK_DELAY = 220;
|
|
57
57
|
var CLICK_DRAG_TOLERANCE = 5;
|
|
58
|
+
var SWIPE_MIN = 48;
|
|
59
|
+
var SWIPE_AXIS_RATIO = 2;
|
|
60
|
+
var SWIPE_SCROLL_HINT = 12;
|
|
58
61
|
function gestureHost(e, name) {
|
|
59
62
|
const t = e.target;
|
|
60
63
|
if (!(t instanceof Element)) return null;
|
|
61
|
-
return t.closest(`[data-gestures~="${name}"]`);
|
|
64
|
+
return t.closest(`[data-icen-gestures~="${name}"]`);
|
|
62
65
|
}
|
|
63
66
|
function pointOf(e) {
|
|
64
67
|
return e instanceof MouseEvent || typeof PointerEvent !== "undefined" && e instanceof PointerEvent ? { x: e.clientX, y: e.clientY } : { x: 0, y: 0 };
|
|
@@ -96,6 +99,11 @@ function initGestures() {
|
|
|
96
99
|
downPos = { x: e.clientX, y: e.clientY };
|
|
97
100
|
suppressTrailingClick = false;
|
|
98
101
|
};
|
|
102
|
+
const onUpPos = (e) => {
|
|
103
|
+
if (downPos && Math.hypot(e.clientX - downPos.x, e.clientY - downPos.y) <= CLICK_DRAG_TOLERANCE) {
|
|
104
|
+
downPos = null;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
99
107
|
const isDragRelease = (e) => downPos != null && Math.hypot(e.clientX - downPos.x, e.clientY - downPos.y) > CLICK_DRAG_TOLERANCE;
|
|
100
108
|
const onClick = (e) => {
|
|
101
109
|
const host = gestureHost(e, "click");
|
|
@@ -104,8 +112,11 @@ function initGestures() {
|
|
|
104
112
|
suppressTrailingClick = false;
|
|
105
113
|
return;
|
|
106
114
|
}
|
|
107
|
-
if (isDragRelease(e))
|
|
108
|
-
|
|
115
|
+
if (isDragRelease(e)) {
|
|
116
|
+
downPos = null;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (host.matches('[data-icen-gestures~="dblclick"]')) {
|
|
109
120
|
if (clickTimer) clearTimeout(clickTimer);
|
|
110
121
|
pending = { host, e };
|
|
111
122
|
clickTimer = setTimeout(() => {
|
|
@@ -160,6 +171,39 @@ function initGestures() {
|
|
|
160
171
|
if (!lp) return;
|
|
161
172
|
if (Math.hypot(e.clientX - lp.x, e.clientY - lp.y) > LONGPRESS_MOVE) clearLp();
|
|
162
173
|
};
|
|
174
|
+
let sw = null;
|
|
175
|
+
const clearSwipe = () => {
|
|
176
|
+
sw = null;
|
|
177
|
+
};
|
|
178
|
+
const onSwipeDown = (e) => {
|
|
179
|
+
const host = gestureHost(e, "swipe");
|
|
180
|
+
if (!host) return;
|
|
181
|
+
sw = { host, x: e.clientX, y: e.clientY, scroll: false };
|
|
182
|
+
};
|
|
183
|
+
const onSwipeMove = (e) => {
|
|
184
|
+
if (!sw) return;
|
|
185
|
+
const adx = Math.abs(e.clientX - sw.x);
|
|
186
|
+
const ady = Math.abs(e.clientY - sw.y);
|
|
187
|
+
if (ady > adx && ady >= SWIPE_SCROLL_HINT) sw.scroll = true;
|
|
188
|
+
};
|
|
189
|
+
const onSwipeUp = (e) => {
|
|
190
|
+
const cur = sw;
|
|
191
|
+
sw = null;
|
|
192
|
+
if (!cur) return;
|
|
193
|
+
const dx = e.clientX - cur.x;
|
|
194
|
+
const dy = e.clientY - cur.y;
|
|
195
|
+
const adx = Math.abs(dx);
|
|
196
|
+
const ady = Math.abs(dy);
|
|
197
|
+
const main = Math.max(adx, ady);
|
|
198
|
+
if (main < SWIPE_MIN) return;
|
|
199
|
+
if (Math.min(adx, ady) * SWIPE_AXIS_RATIO >= main) return;
|
|
200
|
+
let dir;
|
|
201
|
+
if (adx >= ady) dir = dx < 0 ? "left" : "right";
|
|
202
|
+
else dir = dy < 0 ? "up" : "down";
|
|
203
|
+
if (cur.scroll && (dir === "left" || dir === "right")) return;
|
|
204
|
+
const { x, y } = pointOf(e);
|
|
205
|
+
emitIcen(cur.host, `icen:swipe-${dir}`, { source: cur.host, originalEvent: e, x, y, dx, dy });
|
|
206
|
+
};
|
|
163
207
|
const onTextSelect = (e) => {
|
|
164
208
|
const host = gestureHost(e, "text-select");
|
|
165
209
|
if (!host) return;
|
|
@@ -169,6 +213,7 @@ function initGestures() {
|
|
|
169
213
|
emit(host, "icen:text-select", e, text);
|
|
170
214
|
};
|
|
171
215
|
document.addEventListener("pointerdown", onDownPos);
|
|
216
|
+
document.addEventListener("pointerup", onUpPos);
|
|
172
217
|
document.addEventListener("click", onClick);
|
|
173
218
|
document.addEventListener("dblclick", onDblClick);
|
|
174
219
|
document.addEventListener("contextmenu", onContextMenu);
|
|
@@ -176,9 +221,14 @@ function initGestures() {
|
|
|
176
221
|
document.addEventListener("pointermove", onLpMove);
|
|
177
222
|
document.addEventListener("pointerup", clearLp);
|
|
178
223
|
document.addEventListener("pointercancel", clearLp);
|
|
224
|
+
document.addEventListener("pointerdown", onSwipeDown);
|
|
225
|
+
document.addEventListener("pointermove", onSwipeMove);
|
|
226
|
+
document.addEventListener("pointerup", onSwipeUp);
|
|
227
|
+
document.addEventListener("pointercancel", clearSwipe);
|
|
179
228
|
document.addEventListener("mouseup", onTextSelect);
|
|
180
229
|
gesturesTeardown = () => {
|
|
181
230
|
document.removeEventListener("pointerdown", onDownPos);
|
|
231
|
+
document.removeEventListener("pointerup", onUpPos);
|
|
182
232
|
document.removeEventListener("click", onClick);
|
|
183
233
|
document.removeEventListener("dblclick", onDblClick);
|
|
184
234
|
document.removeEventListener("contextmenu", onContextMenu);
|
|
@@ -186,9 +236,14 @@ function initGestures() {
|
|
|
186
236
|
document.removeEventListener("pointermove", onLpMove);
|
|
187
237
|
document.removeEventListener("pointerup", clearLp);
|
|
188
238
|
document.removeEventListener("pointercancel", clearLp);
|
|
239
|
+
document.removeEventListener("pointerdown", onSwipeDown);
|
|
240
|
+
document.removeEventListener("pointermove", onSwipeMove);
|
|
241
|
+
document.removeEventListener("pointerup", onSwipeUp);
|
|
242
|
+
document.removeEventListener("pointercancel", clearSwipe);
|
|
189
243
|
document.removeEventListener("mouseup", onTextSelect);
|
|
190
244
|
cancelPendingClick();
|
|
191
245
|
clearLp();
|
|
246
|
+
clearSwipe();
|
|
192
247
|
gesturesInit = false;
|
|
193
248
|
gesturesTeardown = null;
|
|
194
249
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface CountdownState {
|
|
2
|
+
duration: number;
|
|
3
|
+
remaining: number;
|
|
4
|
+
paused: boolean;
|
|
5
|
+
timer: number;
|
|
6
|
+
startedAt: number;
|
|
7
|
+
}
|
|
8
|
+
interface FeedbackClock {
|
|
9
|
+
pause(reason?: string): void;
|
|
10
|
+
resume(reason?: string): void;
|
|
11
|
+
reset(ms: number): void;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
14
|
+
declare function createFeedbackClock(el: HTMLElement, state: CountdownState, expire: () => void, progress: string, pauseOnHover?: () => boolean): FeedbackClock;
|
|
15
|
+
type FeedbackAction = (signal: AbortSignal) => void | boolean | Promise<void | boolean>;
|
|
16
|
+
/** Cancel the UI continuation and signal cooperative work; stale promises never
|
|
17
|
+
* dismiss a replaced card or resurrect controls after the owner was destroyed. */
|
|
18
|
+
declare function cancelFeedbackAction(card: HTMLElement): void;
|
|
19
|
+
declare function runFeedbackAction(card: HTMLElement, button: HTMLButtonElement, action: FeedbackAction, hooks: {
|
|
20
|
+
busy(value: boolean): void;
|
|
21
|
+
complete(accepted: boolean): void;
|
|
22
|
+
error(error: unknown): void;
|
|
23
|
+
}): void;
|
|
24
|
+
declare function setFeedbackError(host: HTMLElement, message?: string): void;
|
|
25
|
+
/** Isolate caller text from the layout direction (CJK/Latin in an RTL shell). */
|
|
26
|
+
declare function setFeedbackText(host: HTMLElement, value: string): void;
|
|
27
|
+
declare function rememberFeedbackOrigin(card: HTMLElement): void;
|
|
28
|
+
declare function restoreFeedbackFocus(card: HTMLElement): void;
|
|
29
|
+
|
|
30
|
+
export { type CountdownState, type FeedbackAction, type FeedbackClock, cancelFeedbackAction, createFeedbackClock, rememberFeedbackOrigin, restoreFeedbackFocus, runFeedbackAction, setFeedbackError, setFeedbackText };
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// src/behaviors/icons.ts
|
|
2
|
+
var ICON_PATHS = {
|
|
3
|
+
file: "M6 2.5h5.5L16 7v9.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-12a2 2 0 0 1 2-2ZM11.5 2.5V7H16",
|
|
4
|
+
folder: "M3 5a1.5 1.5 0 0 1 1.5-1.5H8l2 2h5.5A1.5 1.5 0 0 1 17 7v8a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 15Z",
|
|
5
|
+
globe: "M17.5 10a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0ZM2.5 10h15M10 2.5c-4 4-4 11 0 15 4-4 4-11 0-15Z",
|
|
6
|
+
document: "M6 2.5h5.5L16 7v9.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-12a2 2 0 0 1 2-2ZM11.5 2.5V7H16M7 10.5h6M7 13.5h6",
|
|
7
|
+
agent: "M10 6V3M8 3h2M5 6h10a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2ZM1.5 10h1.5M17 10h1.5M7 10v2M13 10v2M8 14h4",
|
|
8
|
+
paperclip: "M14 7 8.3 12.7a1.6 1.6 0 0 1-2.3-2.3l6.3-6.3a3.2 3.2 0 0 1 4.5 4.5l-7 7a4.7 4.7 0 0 1-6.7-6.7l7-7",
|
|
9
|
+
stop: "M6.5 5h7A1.5 1.5 0 0 1 15 6.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 5 13.5v-7A1.5 1.5 0 0 1 6.5 5Z",
|
|
10
|
+
terminal: "M5 3.5h10a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2ZM6 7l3 3-3 3M11 13h3",
|
|
11
|
+
branch: "M6 6v8M14 6v2a4 4 0 0 1-4 4H6M8 4a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM8 16a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM16 4a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",
|
|
12
|
+
"line-numbers": "M3 5h2M3 10h2M3 15h2M8 5h9M8 10h9M8 15h9",
|
|
13
|
+
wrap: "M3 5h14M3 10h10a3 3 0 0 1 0 6h-3M12.5 13.5 10 16l2.5 2.5",
|
|
14
|
+
calendar: "M5.5 4h9A2.5 2.5 0 0 1 17 6.5v8a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 3 14.5v-8A2.5 2.5 0 0 1 5.5 4ZM6.5 2.5v3M13.5 2.5v3M3 8h14M6.5 11h.1M10 11h.1M13.5 11h.1M6.5 14h.1M10 14h.1",
|
|
15
|
+
close: "M6 6l8 8M14 6l-8 8",
|
|
16
|
+
check: "M4.5 10.2l3.6 3.6 7.4-7.6",
|
|
17
|
+
"chevron-down": "M5.5 7.75 10 12.25l4.5-4.5",
|
|
18
|
+
"chevron-up": "M5.5 12.25 10 7.75l4.5 4.5",
|
|
19
|
+
"chevron-right": "M7.75 5.5 12.25 10l-4.5 4.5",
|
|
20
|
+
"chevron-left": "M12.25 5.5 7.75 10l4.5 4.5",
|
|
21
|
+
"arrow-right": "M3.5 10h13M11 4.5l5.5 5.5-5.5 5.5",
|
|
22
|
+
"arrow-left": "M16.5 10h-13M9 4.5 3.5 10 9 15.5",
|
|
23
|
+
"arrow-up": "M10 16.5v-13M4.5 9 10 3.5 15.5 9",
|
|
24
|
+
"arrow-down": "M10 3.5v13M4.5 11l5.5 5.5 5.5-5.5",
|
|
25
|
+
plus: "M10 4v12M4 10h12",
|
|
26
|
+
minus: "M4 10h12",
|
|
27
|
+
sort: "M6 15V4M3 7l3-3 3 3M14 5v11M11 13l3 3 3-3",
|
|
28
|
+
search: "M13.3 13.3 17 17M14.5 8.5a6 6 0 1 1-12 0 6 6 0 0 1 12 0",
|
|
29
|
+
sun: "M13.5 10a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0M10 1.75v1.5M10 16.75v1.5M1.75 10h1.5M16.75 10h1.5M4.17 4.17l1.06 1.06M14.77 14.77l1.06 1.06M4.17 15.83l1.06-1.06M14.77 5.23l1.06-1.06",
|
|
30
|
+
moon: "M17.25 11.15A7.5 7.5 0 0 1 8.85 2.75a7.5 7.5 0 1 0 8.4 8.4Z",
|
|
31
|
+
modern: "M6.5 3h7A3.5 3.5 0 0 1 17 6.5v7a3.5 3.5 0 0 1-3.5 3.5h-7A3.5 3.5 0 0 1 3 13.5v-7A3.5 3.5 0 0 1 6.5 3ZM7 10l3-3 3 3-3 3Z",
|
|
32
|
+
pixel: "M3 3h5v5H3ZM12 3h5v5h-5ZM3 12h5v5H3ZM12 12h5v5h-5Z",
|
|
33
|
+
chinese: "M3 8c3 0 5-2 7-5 2 3 4 5 7 5M4 8h12M6 8v8m8-8v8M3 16h14M8 16v-5h4v5",
|
|
34
|
+
soviet: "M3 17h14M5 17V8h4v9m0-12h6v12M7 8V5h2m2 3h2m-2 3h2m-2 3h2M10 5V3h4v2",
|
|
35
|
+
more: "M4 9.9v.2M10 9.9v.2M16 9.9v.2",
|
|
36
|
+
copy: "M7 7h8a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V7ZM13 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",
|
|
37
|
+
edit: "M11.5 4.5l4 4M4 12l9-9a1.4 1.4 0 0 1 2 0l2 2a1.4 1.4 0 0 1 0 2l-9 9-5 1Z",
|
|
38
|
+
link: "M8 6l2-2a4.2 4.2 0 0 1 6 6l-2 2M12 14l-2 2a4.2 4.2 0 0 1-6-6l2-2M7 13l6-6",
|
|
39
|
+
trash: "M3.5 5.5h13M7 5.5V3h6v2.5M5 5.5l.7 11.5h8.6L15 5.5M8 9v5M12 9v5",
|
|
40
|
+
spinner: "M10 3a7 7 0 1 1-7 7",
|
|
41
|
+
"circle-check": "M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0ZM6 10l2.7 2.7 5.3-5.4",
|
|
42
|
+
"circle-error": "M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0ZM7.2 7.2l5.6 5.6M12.8 7.2l-5.6 5.6",
|
|
43
|
+
"circle-info": "M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0ZM10 9v5M10 6.1v.15",
|
|
44
|
+
"triangle-alert": "M8.7 3.5a1.5 1.5 0 0 1 2.6 0l6.4 11.3a1.5 1.5 0 0 1-1.3 2.2H3.6a1.5 1.5 0 0 1-1.3-2.2ZM10 7.2v4.4M10 14v.15",
|
|
45
|
+
refresh: "M16.5 7.2A7 7 0 0 0 4.3 5.9L2.5 8M2.5 3.5V8H7M3.5 12.8a7 7 0 0 0 12.2 1.3l1.8-2.1M13 12h4.5v4.5",
|
|
46
|
+
external: "M11.5 3H17v5.5M17 3l-8 8M8 3H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3",
|
|
47
|
+
home: "M3.5 10.25 10 4l6.5 6.25M5.75 8.75v7a.75.75 0 0 0 .75.75h7.5a.75.75 0 0 0 .75-.75v-7",
|
|
48
|
+
settings: "M3.5 5.5h13M3.5 10h13M3.5 14.5h13M7 4v3M12.5 8.5v3M8 13v3",
|
|
49
|
+
star: "M10 2.5l2.4 5.1 5.6.4-4.2 3.7 1.3 5.5-5.1-3-5.1 3 1.3-5.5L1.8 8l5.6-.4Z",
|
|
50
|
+
eye: "M2.2 10s3-5.4 7.8-5.4S17.8 10 17.8 10s-3 5.4-7.8 5.4S2.2 10 2.2 10ZM10 12.4a2.4 2.4 0 1 0 0-4.8 2.4 2.4 0 0 0 0 4.8Z",
|
|
51
|
+
"eye-off": "M2.2 10s3-5.4 7.8-5.4S17.8 10 17.8 10s-3 5.4-7.8 5.4S2.2 10 2.2 10ZM10 12.4a2.4 2.4 0 1 0 0-4.8 2.4 2.4 0 0 0 0 4.8ZM3.5 3.5l13 13",
|
|
52
|
+
inbox: "M3.5 12.25h3.7l1.5 2.5h2.6l1.5-2.5h3.7M4.7 5.5l-1.2 6.75v3.25a1.5 1.5 0 0 0 1.5 1.5h10a1.5 1.5 0 0 0 1.5-1.5v-3.25L15.3 5.5a1.3 1.3 0 0 0-1.25-1H5.95a1.3 1.3 0 0 0-1.25 1Z",
|
|
53
|
+
bell: "M10 3.5a4.5 4.5 0 0 1 4.5 4.5c0 4.5 1.8 5.7 2.5 6.5H3c.7-.8 2.5-2 2.5-6.5A4.5 4.5 0 0 1 10 3.5ZM8.5 16.5a1.6 1.6 0 0 0 3 0",
|
|
54
|
+
users: "M13.8 16.5v-1.5a3.5 3.5 0 0 0-3.5-3.5H6.3a3.5 3.5 0 0 0-3.5 3.5v1.5M8.3 8.9a2.7 2.7 0 1 0 0-5.4 2.7 2.7 0 0 0 0 5.4ZM16.5 16.5v-1.3a3.3 3.3 0 0 0-2.3-3.1M12.3 3.7a2.7 2.7 0 0 1 0 5.2",
|
|
55
|
+
activity: "M17 10h-2.6l-2 5.8L8 4.2 6 10H3",
|
|
56
|
+
"trend-up": "M3.5 14.5l4.2-4.2 2.8 2.8 5.9-5.9M12.4 7.2h4.2v4.2",
|
|
57
|
+
"trend-down": "M3.5 5.5l4.2 4.2 2.8-2.8 5.9 5.9M12.4 12.8h4.2V8.6",
|
|
58
|
+
rocket: "M10 2.5c2 1.5 3.2 4 3.2 6.8 0 1.5-.3 2.9-.8 4.2H7.6c-.5-1.3-.8-2.7-.8-4.2 0-2.8 1.2-5.3 3.2-6.8ZM10 8.6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM7.6 12.5 5.6 15.4c-.9.3-1.6 1-2 2M12.4 12.5l2 2.9c.9.3 1.6 1 2 2M8.7 13.8c0 1.8.5 3.1 1.3 4.2.8-1.1 1.3-2.4 1.3-4.2",
|
|
59
|
+
bold: "M6.5 4h4.2a3 3 0 0 1 0 6H6.5M6.5 10h5a3 3 0 0 1 0 6H6.5M6.5 4v12",
|
|
60
|
+
italic: "M8.5 4.5h7M4.5 15.5h7M12.5 4.5l-5 11",
|
|
61
|
+
underline: "M6 4v5.5a4 4 0 0 0 8 0V4M4.5 16h11",
|
|
62
|
+
"align-left": "M3.5 4.5h13M3.5 10h8.5M3.5 15.5h11",
|
|
63
|
+
"align-center": "M3.5 4.5h13M5.75 10h8.5M4.5 15.5h11",
|
|
64
|
+
"align-right": "M3.5 4.5h13M8 10h8.5M5.5 15.5h11",
|
|
65
|
+
list: "M6.5 5h10M6.5 10h10M6.5 15h10M3.5 5h.01M3.5 10h.01M3.5 15h.01",
|
|
66
|
+
server: "M3 3h14a1.5 1.5 0 0 1 1.5 1.5v2A1.5 1.5 0 0 1 17 8H3a1.5 1.5 0 0 1-1.5-1.5v-2A1.5 1.5 0 0 1 3 3ZM3 12h14a1.5 1.5 0 0 1 1.5 1.5v2A1.5 1.5 0 0 1 17 17H3a1.5 1.5 0 0 1-1.5-1.5v-2A1.5 1.5 0 0 1 3 12ZM5 5.5h.01M5 14.5h.01",
|
|
67
|
+
sparkle: "M10 2.5l1.6 4.3 4.3 1.6-4.3 1.6L10 14.3l-1.6-4.3-4.3-1.6 4.3-1.6ZM15.5 12.5l.8 2.1 2.1.8-2.1.8-.8 2.1-.8-2.1-2.1-.8 2.1-.8Z",
|
|
68
|
+
play: "M6.5 4.8v10.4c0 .9 1 1.5 1.8 1l8.3-5.2a1.2 1.2 0 0 0 0-2L8.3 3.8a1.2 1.2 0 0 0-1.8 1Z",
|
|
69
|
+
"chart-line": "M3.5 3.5v13h13M6.5 12l2.8-2.8 2.2 2.2 4-4.4",
|
|
70
|
+
layers: "M10 3.2 3.6 6.5 10 9.8l6.4-3.3ZM4.5 10.4 10 13.2l5.5-2.8M4.5 13.6 10 16.4l5.5-2.8",
|
|
71
|
+
box: "M17 6 10 3.2 3 6v8l7 2.8 7-2.8ZM3 6l7 2.8L17 6M10 9v7.8",
|
|
72
|
+
filter: "M4 4.5h12l-4.4 5.1v5l-3.2-1.6V9.6Z",
|
|
73
|
+
columns: "M3.5 4h13v12h-13ZM8.2 4v12M12.8 4v12",
|
|
74
|
+
download: "M10 3.5v8M6.8 8.3 10 11.5l3.2-3.2M4 15v2.5a1.5 1.5 0 0 0 1.5 1.5h9a1.5 1.5 0 0 0 1.5-1.5V15"
|
|
75
|
+
};
|
|
76
|
+
var custom = /* @__PURE__ */ new Map();
|
|
77
|
+
function iconPath(name) {
|
|
78
|
+
return Object.hasOwn(ICON_PATHS, name) ? ICON_PATHS[name] : custom.get(name) ?? null;
|
|
79
|
+
}
|
|
80
|
+
function iconAttributes(o = {}) {
|
|
81
|
+
const size = Number.isFinite(o.size) && o.size > 0 ? o.size : 16;
|
|
82
|
+
return { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", width: String(size), height: String(size), fill: "none", stroke: "currentColor", "stroke-width": "1.6", "stroke-linecap": "round", "stroke-linejoin": "round", focusable: "false", class: ["icen-symbol", o.className].filter(Boolean).join(" "), ...o.label ? { role: "img", "aria-label": o.label } : { "aria-hidden": "true" } };
|
|
83
|
+
}
|
|
84
|
+
function createIcon(name, o = {}) {
|
|
85
|
+
if (typeof document === "undefined") return null;
|
|
86
|
+
const path = iconPath(name);
|
|
87
|
+
if (!path) return null;
|
|
88
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
89
|
+
for (const [key, value] of Object.entries(iconAttributes(o))) svg.setAttribute(key, value);
|
|
90
|
+
const line = document.createElementNS(svg.namespaceURI, "path");
|
|
91
|
+
line.setAttribute("d", path);
|
|
92
|
+
svg.append(line);
|
|
93
|
+
return svg;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/behaviors/feedback.ts
|
|
97
|
+
function createFeedbackClock(el, state, expire, progress, pauseOnHover = () => true) {
|
|
98
|
+
if (typeof document === "undefined") return { pause() {
|
|
99
|
+
}, resume() {
|
|
100
|
+
}, reset() {
|
|
101
|
+
}, destroy() {
|
|
102
|
+
} };
|
|
103
|
+
const reasons = /* @__PURE__ */ new Set();
|
|
104
|
+
const ac = new AbortController();
|
|
105
|
+
let destroyed = false;
|
|
106
|
+
function sync(reset = false) {
|
|
107
|
+
state.paused = state.duration > 0 && reasons.size > 0;
|
|
108
|
+
el.classList.toggle("is-paused", state.paused);
|
|
109
|
+
const fill = el.querySelector(progress);
|
|
110
|
+
if (fill) {
|
|
111
|
+
if (reset) {
|
|
112
|
+
fill.style.animationName = "none";
|
|
113
|
+
void fill.offsetWidth;
|
|
114
|
+
fill.style.animationName = "";
|
|
115
|
+
fill.style.animationDuration = `${state.duration}ms`;
|
|
116
|
+
}
|
|
117
|
+
fill.style.animationPlayState = state.paused ? "paused" : "running";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function stop() {
|
|
121
|
+
if (!state.timer) return;
|
|
122
|
+
window.clearTimeout(state.timer);
|
|
123
|
+
state.timer = 0;
|
|
124
|
+
state.remaining = Math.max(0, state.remaining - (Date.now() - state.startedAt));
|
|
125
|
+
}
|
|
126
|
+
function start() {
|
|
127
|
+
if (destroyed || state.duration <= 0 || reasons.size || state.timer) return;
|
|
128
|
+
if (state.remaining <= 0) {
|
|
129
|
+
expire();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
state.startedAt = Date.now();
|
|
133
|
+
state.timer = window.setTimeout(() => {
|
|
134
|
+
state.timer = 0;
|
|
135
|
+
state.remaining = 0;
|
|
136
|
+
if (!destroyed) expire();
|
|
137
|
+
}, state.remaining);
|
|
138
|
+
}
|
|
139
|
+
const clock = {
|
|
140
|
+
pause(reason = "manual") {
|
|
141
|
+
if (destroyed) return;
|
|
142
|
+
reasons.add(reason);
|
|
143
|
+
stop();
|
|
144
|
+
sync();
|
|
145
|
+
},
|
|
146
|
+
resume(reason = "manual") {
|
|
147
|
+
if (destroyed) return;
|
|
148
|
+
reasons.delete(reason);
|
|
149
|
+
sync();
|
|
150
|
+
start();
|
|
151
|
+
},
|
|
152
|
+
reset(ms) {
|
|
153
|
+
if (destroyed) return;
|
|
154
|
+
stop();
|
|
155
|
+
state.duration = Number.isFinite(ms) ? Math.max(0, ms) : 0;
|
|
156
|
+
state.remaining = state.duration;
|
|
157
|
+
sync(true);
|
|
158
|
+
start();
|
|
159
|
+
},
|
|
160
|
+
destroy() {
|
|
161
|
+
if (destroyed) return;
|
|
162
|
+
destroyed = true;
|
|
163
|
+
stop();
|
|
164
|
+
reasons.clear();
|
|
165
|
+
ac.abort();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
el.addEventListener("mouseenter", () => {
|
|
169
|
+
if (pauseOnHover()) clock.pause("hover");
|
|
170
|
+
}, { signal: ac.signal });
|
|
171
|
+
el.addEventListener("mouseleave", () => clock.resume("hover"), { signal: ac.signal });
|
|
172
|
+
el.addEventListener("focusin", () => clock.pause("focus"), { signal: ac.signal });
|
|
173
|
+
el.addEventListener("focusout", (event) => {
|
|
174
|
+
if (!(event.relatedTarget instanceof Node) || !el.contains(event.relatedTarget)) clock.resume("focus");
|
|
175
|
+
}, { signal: ac.signal });
|
|
176
|
+
const visibility = () => document.hidden ? clock.pause("visibility") : clock.resume("visibility");
|
|
177
|
+
document.addEventListener("visibilitychange", visibility, { signal: ac.signal });
|
|
178
|
+
if (document.hidden) reasons.add("visibility");
|
|
179
|
+
if (el.contains(document.activeElement)) reasons.add("focus");
|
|
180
|
+
clock.reset(state.duration);
|
|
181
|
+
return clock;
|
|
182
|
+
}
|
|
183
|
+
var pending = /* @__PURE__ */ new WeakMap();
|
|
184
|
+
function cancelFeedbackAction(card) {
|
|
185
|
+
pending.get(card)?.abort();
|
|
186
|
+
}
|
|
187
|
+
function runFeedbackAction(card, button, action, hooks) {
|
|
188
|
+
if (typeof document === "undefined") return;
|
|
189
|
+
if (pending.has(card) || card.classList.contains("is-leaving") || !card.isConnected) return;
|
|
190
|
+
const ac = new AbortController();
|
|
191
|
+
const controls = Array.from(card.querySelectorAll(".icen-toast-action,.icen-notification-action"));
|
|
192
|
+
const original = controls.map((item) => item.getAttribute("aria-disabled"));
|
|
193
|
+
let spinner = null;
|
|
194
|
+
let busy = false;
|
|
195
|
+
let signalled = false;
|
|
196
|
+
const restore = () => {
|
|
197
|
+
if (busy) {
|
|
198
|
+
busy = false;
|
|
199
|
+
controls.forEach((item, index) => original[index] == null ? item.removeAttribute("aria-disabled") : item.setAttribute("aria-disabled", original[index]));
|
|
200
|
+
button.removeAttribute("aria-busy");
|
|
201
|
+
spinner?.remove();
|
|
202
|
+
}
|
|
203
|
+
if (signalled) {
|
|
204
|
+
signalled = false;
|
|
205
|
+
hooks.busy(false);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const operation = { abort() {
|
|
209
|
+
ac.abort();
|
|
210
|
+
if (pending.get(card) === operation) {
|
|
211
|
+
pending.delete(card);
|
|
212
|
+
restore();
|
|
213
|
+
}
|
|
214
|
+
} };
|
|
215
|
+
pending.set(card, operation);
|
|
216
|
+
const finish = (result, error) => {
|
|
217
|
+
if (ac.signal.aborted || pending.get(card) !== operation) return;
|
|
218
|
+
pending.delete(card);
|
|
219
|
+
try {
|
|
220
|
+
if (card.isConnected && !card.classList.contains("is-leaving")) {
|
|
221
|
+
if (error !== void 0) hooks.error(error);
|
|
222
|
+
else hooks.complete(result !== false);
|
|
223
|
+
}
|
|
224
|
+
} finally {
|
|
225
|
+
restore();
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
try {
|
|
229
|
+
signalled = true;
|
|
230
|
+
hooks.busy(true);
|
|
231
|
+
const result = action(ac.signal);
|
|
232
|
+
if (result && typeof result.then === "function") {
|
|
233
|
+
busy = true;
|
|
234
|
+
controls.forEach((item) => item.setAttribute("aria-disabled", "true"));
|
|
235
|
+
button.setAttribute("aria-busy", "true");
|
|
236
|
+
let label = button.querySelector(".icen-feedback-action-label");
|
|
237
|
+
if (!label) {
|
|
238
|
+
label = document.createElement("span");
|
|
239
|
+
label.className = "icen-feedback-action-label";
|
|
240
|
+
while (button.firstChild) label.append(button.firstChild);
|
|
241
|
+
button.append(label);
|
|
242
|
+
}
|
|
243
|
+
spinner = document.createElement("span");
|
|
244
|
+
spinner.className = "icen-feedback-action-spinner";
|
|
245
|
+
spinner.setAttribute("aria-hidden", "true");
|
|
246
|
+
spinner.append(createIcon("spinner"));
|
|
247
|
+
button.append(spinner);
|
|
248
|
+
void Promise.resolve(result).then((value) => finish(value), (error) => finish(false, error ?? new Error("Action rejected")));
|
|
249
|
+
} else finish(result);
|
|
250
|
+
} catch (error) {
|
|
251
|
+
finish(false, error ?? new Error("Action failed"));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function setFeedbackError(host, message) {
|
|
255
|
+
if (typeof document === "undefined") return;
|
|
256
|
+
let error = host.querySelector(":scope > .icen-feedback-error");
|
|
257
|
+
if (!message) {
|
|
258
|
+
error?.remove();
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (!error) {
|
|
262
|
+
error = document.createElement("span");
|
|
263
|
+
error.className = "icen-feedback-error";
|
|
264
|
+
error.setAttribute("role", "alert");
|
|
265
|
+
host.append(error);
|
|
266
|
+
}
|
|
267
|
+
setFeedbackText(error, message);
|
|
268
|
+
}
|
|
269
|
+
function setFeedbackText(host, value) {
|
|
270
|
+
if (typeof document === "undefined") return;
|
|
271
|
+
const text = document.createElement("bdi");
|
|
272
|
+
text.textContent = value;
|
|
273
|
+
host.replaceChildren(text);
|
|
274
|
+
}
|
|
275
|
+
var origins = /* @__PURE__ */ new WeakMap();
|
|
276
|
+
function rememberFeedbackOrigin(card) {
|
|
277
|
+
if (typeof document === "undefined") return;
|
|
278
|
+
const focused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
279
|
+
const previous = focused?.closest(".icen-toast,.icen-notification");
|
|
280
|
+
const chain = [...focused ? [focused] : [], ...previous ? origins.get(previous) ?? [] : []];
|
|
281
|
+
origins.set(card, [...new Set(chain)].filter((item) => item.isConnected));
|
|
282
|
+
}
|
|
283
|
+
function restoreFeedbackFocus(card) {
|
|
284
|
+
if (typeof document === "undefined") return;
|
|
285
|
+
const origin = origins.get(card)?.find((item) => item.isConnected && !item.closest("[hidden],[inert],.is-leaving") && !item.matches(':disabled,[aria-disabled="true"]'));
|
|
286
|
+
if (card.contains(document.activeElement)) origin?.focus({ preventScroll: true });
|
|
287
|
+
}
|
|
288
|
+
export {
|
|
289
|
+
cancelFeedbackAction,
|
|
290
|
+
createFeedbackClock,
|
|
291
|
+
rememberFeedbackOrigin,
|
|
292
|
+
restoreFeedbackFocus,
|
|
293
|
+
runFeedbackAction,
|
|
294
|
+
setFeedbackError,
|
|
295
|
+
setFeedbackText
|
|
296
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Shared native focus contract. Geometry-free visibility checks also include
|
|
2
|
+
* fixed-position controls, which offsetParent incorrectly excludes. */
|
|
3
|
+
declare const FOCUSABLE = "button, [href], input:not([type=\"hidden\"]), select, textarea, icen-input, icen-select, icen-textarea, [tabindex], [contenteditable]:not([contenteditable=\"false\"]), audio[controls], video[controls], details>summary";
|
|
4
|
+
/** Availability also applies to intentionally programmatic tabindex=-1 targets. */
|
|
5
|
+
declare function isAvailableForFocus(el: HTMLElement): boolean;
|
|
6
|
+
declare function focusableWithin(root: ParentNode): HTMLElement[];
|
|
7
|
+
|
|
8
|
+
export { FOCUSABLE, focusableWithin, isAvailableForFocus };
|