@prestack/thread-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +348 -0
- package/dist/attach.d.ts +1 -0
- package/dist/attach.js +1 -0
- package/dist/ui/animations/anm_appear.d.ts +16 -0
- package/dist/ui/animations/anm_appear.js +10 -0
- package/dist/ui/animations/anm_blur_in.d.ts +22 -0
- package/dist/ui/animations/anm_blur_in.js +16 -0
- package/dist/ui/animations/anm_blur_out.d.ts +22 -0
- package/dist/ui/animations/anm_blur_out.js +16 -0
- package/dist/ui/animations/anm_dismiss.d.ts +22 -0
- package/dist/ui/animations/anm_dismiss.js +16 -0
- package/dist/ui/animations/anm_drop.d.ts +22 -0
- package/dist/ui/animations/anm_drop.js +16 -0
- package/dist/ui/animations/anm_fall.d.ts +22 -0
- package/dist/ui/animations/anm_fall.js +16 -0
- package/dist/ui/animations/anm_flash.d.ts +19 -0
- package/dist/ui/animations/anm_flash.js +16 -0
- package/dist/ui/animations/anm_glow.d.ts +16 -0
- package/dist/ui/animations/anm_glow.js +14 -0
- package/dist/ui/animations/anm_lift.d.ts +16 -0
- package/dist/ui/animations/anm_lift.js +14 -0
- package/dist/ui/animations/anm_nudge.d.ts +16 -0
- package/dist/ui/animations/anm_nudge.js +14 -0
- package/dist/ui/animations/anm_pop_in.d.ts +29 -0
- package/dist/ui/animations/anm_pop_in.js +20 -0
- package/dist/ui/animations/anm_pop_out.d.ts +29 -0
- package/dist/ui/animations/anm_pop_out.js +20 -0
- package/dist/ui/animations/anm_press.d.ts +19 -0
- package/dist/ui/animations/anm_press.js +10 -0
- package/dist/ui/animations/anm_pulse.d.ts +20 -0
- package/dist/ui/animations/anm_pulse.js +11 -0
- package/dist/ui/animations/anm_rise.d.ts +22 -0
- package/dist/ui/animations/anm_rise.js +16 -0
- package/dist/ui/animations/anm_shake.d.ts +23 -0
- package/dist/ui/animations/anm_shake.js +11 -0
- package/dist/ui/animations/anm_slide_in_left.d.ts +22 -0
- package/dist/ui/animations/anm_slide_in_left.js +16 -0
- package/dist/ui/animations/anm_slide_in_right.d.ts +22 -0
- package/dist/ui/animations/anm_slide_in_right.js +16 -0
- package/dist/ui/animations/anm_slide_out_left.d.ts +22 -0
- package/dist/ui/animations/anm_slide_out_left.js +16 -0
- package/dist/ui/animations/anm_slide_out_right.d.ts +22 -0
- package/dist/ui/animations/anm_slide_out_right.js +16 -0
- package/dist/ui/animations/anm_spin.d.ts +16 -0
- package/dist/ui/animations/anm_spin.js +10 -0
- package/dist/ui/animations/anm_swell.d.ts +16 -0
- package/dist/ui/animations/anm_swell.js +14 -0
- package/dist/ui/animations/anm_wobble.d.ts +27 -0
- package/dist/ui/animations/anm_wobble.js +22 -0
- package/dist/ui/animations/anm_zoom_in.d.ts +22 -0
- package/dist/ui/animations/anm_zoom_in.js +16 -0
- package/dist/ui/animations/anm_zoom_out.d.ts +22 -0
- package/dist/ui/animations/anm_zoom_out.js +16 -0
- package/dist/ui/animations.d.ts +59 -0
- package/dist/ui/animations.js +227 -0
- package/dist/ui/attach.d.ts +3 -0
- package/dist/ui/attach.js +497 -0
- package/dist/ui/charts.d.ts +32 -0
- package/dist/ui/charts.js +35 -0
- package/dist/ui/checked.d.ts +19 -0
- package/dist/ui/checked.js +3 -0
- package/dist/ui/collector.d.ts +32 -0
- package/dist/ui/collector.js +75 -0
- package/dist/ui/compositions.d.ts +21 -0
- package/dist/ui/compositions.js +305 -0
- package/dist/ui/consent.d.ts +22 -0
- package/dist/ui/consent.js +44 -0
- package/dist/ui/content.d.ts +9 -0
- package/dist/ui/content.js +11 -0
- package/dist/ui/contrast.d.ts +3 -0
- package/dist/ui/contrast.js +23 -0
- package/dist/ui/controls.d.ts +14 -0
- package/dist/ui/controls.js +2 -0
- package/dist/ui/disclosure.d.ts +14 -0
- package/dist/ui/disclosure.js +2 -0
- package/dist/ui/dismiss-layer.d.ts +14 -0
- package/dist/ui/dismiss-layer.js +66 -0
- package/dist/ui/door.d.ts +40 -0
- package/dist/ui/door.js +100 -0
- package/dist/ui/drag.d.ts +82 -0
- package/dist/ui/drag.js +212 -0
- package/dist/ui/elements/accordion.d.ts +12 -0
- package/dist/ui/elements/accordion.js +16 -0
- package/dist/ui/elements/accordion.works.d.ts +22 -0
- package/dist/ui/elements/accordion.works.js +44 -0
- package/dist/ui/elements/aspect-ratio.d.ts +10 -0
- package/dist/ui/elements/aspect-ratio.js +9 -0
- package/dist/ui/elements/aspect-ratio.works.d.ts +2 -0
- package/dist/ui/elements/aspect-ratio.works.js +3 -0
- package/dist/ui/elements/avatar.d.ts +11 -0
- package/dist/ui/elements/avatar.js +10 -0
- package/dist/ui/elements/avatar.works.d.ts +4 -0
- package/dist/ui/elements/avatar.works.js +16 -0
- package/dist/ui/elements/badge.d.ts +11 -0
- package/dist/ui/elements/badge.js +10 -0
- package/dist/ui/elements/badge.works.d.ts +5 -0
- package/dist/ui/elements/badge.works.js +6 -0
- package/dist/ui/elements/bars.d.ts +14 -0
- package/dist/ui/elements/bars.js +17 -0
- package/dist/ui/elements/bars.works.d.ts +12 -0
- package/dist/ui/elements/bars.works.js +20 -0
- package/dist/ui/elements/box.d.ts +12 -0
- package/dist/ui/elements/box.js +11 -0
- package/dist/ui/elements/breadcrumb.d.ts +10 -0
- package/dist/ui/elements/breadcrumb.js +12 -0
- package/dist/ui/elements/breadcrumb.works.d.ts +7 -0
- package/dist/ui/elements/breadcrumb.works.js +21 -0
- package/dist/ui/elements/button.d.ts +17 -0
- package/dist/ui/elements/button.js +16 -0
- package/dist/ui/elements/button.works.d.ts +17 -0
- package/dist/ui/elements/button.works.js +34 -0
- package/dist/ui/elements/column.d.ts +9 -0
- package/dist/ui/elements/column.js +8 -0
- package/dist/ui/elements/consent.d.ts +13 -0
- package/dist/ui/elements/consent.js +21 -0
- package/dist/ui/elements/consent.works.d.ts +41 -0
- package/dist/ui/elements/consent.works.js +79 -0
- package/dist/ui/elements/donut.d.ts +13 -0
- package/dist/ui/elements/donut.js +16 -0
- package/dist/ui/elements/donut.works.d.ts +11 -0
- package/dist/ui/elements/donut.works.js +28 -0
- package/dist/ui/elements/each.d.ts +14 -0
- package/dist/ui/elements/each.js +9 -0
- package/dist/ui/elements/each.works.d.ts +3 -0
- package/dist/ui/elements/each.works.js +68 -0
- package/dist/ui/elements/empty.d.ts +9 -0
- package/dist/ui/elements/empty.js +12 -0
- package/dist/ui/elements/field.d.ts +16 -0
- package/dist/ui/elements/field.js +15 -0
- package/dist/ui/elements/field.works.d.ts +17 -0
- package/dist/ui/elements/field.works.js +45 -0
- package/dist/ui/elements/funnel.d.ts +14 -0
- package/dist/ui/elements/funnel.js +17 -0
- package/dist/ui/elements/funnel.works.d.ts +12 -0
- package/dist/ui/elements/funnel.works.js +23 -0
- package/dist/ui/elements/gauge.d.ts +12 -0
- package/dist/ui/elements/gauge.js +15 -0
- package/dist/ui/elements/gauge.works.d.ts +11 -0
- package/dist/ui/elements/gauge.works.js +31 -0
- package/dist/ui/elements/glyph.d.ts +10 -0
- package/dist/ui/elements/glyph.js +9 -0
- package/dist/ui/elements/glyph.works.d.ts +5 -0
- package/dist/ui/elements/glyph.works.js +16 -0
- package/dist/ui/elements/grid.d.ts +9 -0
- package/dist/ui/elements/grid.js +8 -0
- package/dist/ui/elements/heatmap.d.ts +15 -0
- package/dist/ui/elements/heatmap.js +17 -0
- package/dist/ui/elements/heatmap.works.d.ts +11 -0
- package/dist/ui/elements/heatmap.works.js +11 -0
- package/dist/ui/elements/hit-box.d.ts +19 -0
- package/dist/ui/elements/hit-box.js +15 -0
- package/dist/ui/elements/hit-box.works.d.ts +87 -0
- package/dist/ui/elements/hit-box.works.js +451 -0
- package/dist/ui/elements/image.d.ts +10 -0
- package/dist/ui/elements/image.js +9 -0
- package/dist/ui/elements/line-chart.d.ts +13 -0
- package/dist/ui/elements/line-chart.js +16 -0
- package/dist/ui/elements/line-chart.works.d.ts +12 -0
- package/dist/ui/elements/line-chart.works.js +27 -0
- package/dist/ui/elements/link.d.ts +12 -0
- package/dist/ui/elements/link.js +15 -0
- package/dist/ui/elements/link.works.d.ts +10 -0
- package/dist/ui/elements/link.works.js +15 -0
- package/dist/ui/elements/media.d.ts +11 -0
- package/dist/ui/elements/media.js +22 -0
- package/dist/ui/elements/menu.d.ts +12 -0
- package/dist/ui/elements/menu.js +18 -0
- package/dist/ui/elements/menu.works.d.ts +50 -0
- package/dist/ui/elements/menu.works.js +100 -0
- package/dist/ui/elements/money.d.ts +10 -0
- package/dist/ui/elements/money.js +9 -0
- package/dist/ui/elements/money.works.d.ts +4 -0
- package/dist/ui/elements/money.works.js +4 -0
- package/dist/ui/elements/pagination.d.ts +11 -0
- package/dist/ui/elements/pagination.js +12 -0
- package/dist/ui/elements/pagination.works.d.ts +5 -0
- package/dist/ui/elements/pagination.works.js +15 -0
- package/dist/ui/elements/progress.d.ts +11 -0
- package/dist/ui/elements/progress.js +11 -0
- package/dist/ui/elements/progress.works.d.ts +2 -0
- package/dist/ui/elements/progress.works.js +6 -0
- package/dist/ui/elements/radio-group.d.ts +15 -0
- package/dist/ui/elements/radio-group.js +16 -0
- package/dist/ui/elements/radio-group.works.d.ts +10 -0
- package/dist/ui/elements/radio-group.works.js +22 -0
- package/dist/ui/elements/row.d.ts +9 -0
- package/dist/ui/elements/row.js +8 -0
- package/dist/ui/elements/scatter.d.ts +13 -0
- package/dist/ui/elements/scatter.js +15 -0
- package/dist/ui/elements/scatter.works.d.ts +11 -0
- package/dist/ui/elements/scatter.works.js +24 -0
- package/dist/ui/elements/select.d.ts +13 -0
- package/dist/ui/elements/select.js +11 -0
- package/dist/ui/elements/select.works.d.ts +4 -0
- package/dist/ui/elements/select.works.js +3 -0
- package/dist/ui/elements/separator.d.ts +10 -0
- package/dist/ui/elements/separator.js +9 -0
- package/dist/ui/elements/skeleton.d.ts +8 -0
- package/dist/ui/elements/skeleton.js +9 -0
- package/dist/ui/elements/slider.d.ts +14 -0
- package/dist/ui/elements/slider.js +10 -0
- package/dist/ui/elements/slider.works.d.ts +4 -0
- package/dist/ui/elements/slider.works.js +3 -0
- package/dist/ui/elements/sparkline.d.ts +10 -0
- package/dist/ui/elements/sparkline.js +15 -0
- package/dist/ui/elements/sparkline.works.d.ts +10 -0
- package/dist/ui/elements/sparkline.works.js +19 -0
- package/dist/ui/elements/spinner.d.ts +9 -0
- package/dist/ui/elements/spinner.js +12 -0
- package/dist/ui/elements/stack.d.ts +9 -0
- package/dist/ui/elements/stack.js +8 -0
- package/dist/ui/elements/stat.d.ts +12 -0
- package/dist/ui/elements/stat.js +10 -0
- package/dist/ui/elements/stat.works.d.ts +3 -0
- package/dist/ui/elements/stat.works.js +10 -0
- package/dist/ui/elements/surface.d.ts +9 -0
- package/dist/ui/elements/surface.js +15 -0
- package/dist/ui/elements/surface.works.d.ts +7 -0
- package/dist/ui/elements/surface.works.js +4 -0
- package/dist/ui/elements/table.d.ts +13 -0
- package/dist/ui/elements/table.js +16 -0
- package/dist/ui/elements/table.works.d.ts +11 -0
- package/dist/ui/elements/table.works.js +15 -0
- package/dist/ui/elements/tabs.d.ts +12 -0
- package/dist/ui/elements/tabs.js +16 -0
- package/dist/ui/elements/tabs.works.d.ts +25 -0
- package/dist/ui/elements/tabs.works.js +53 -0
- package/dist/ui/elements/text.d.ts +13 -0
- package/dist/ui/elements/text.js +9 -0
- package/dist/ui/elements/textarea.d.ts +14 -0
- package/dist/ui/elements/textarea.js +11 -0
- package/dist/ui/elements/textarea.works.d.ts +4 -0
- package/dist/ui/elements/textarea.works.js +3 -0
- package/dist/ui/elements/time.d.ts +11 -0
- package/dist/ui/elements/time.js +14 -0
- package/dist/ui/elements/time.works.d.ts +11 -0
- package/dist/ui/elements/time.works.js +16 -0
- package/dist/ui/elements/toggle.d.ts +11 -0
- package/dist/ui/elements/toggle.js +10 -0
- package/dist/ui/elements/toggle.works.d.ts +4 -0
- package/dist/ui/elements/toggle.works.js +3 -0
- package/dist/ui/elements/tooltip.d.ts +12 -0
- package/dist/ui/elements/tooltip.js +15 -0
- package/dist/ui/elements/tooltip.works.d.ts +28 -0
- package/dist/ui/elements/tooltip.works.js +54 -0
- package/dist/ui/elements/value.d.ts +12 -0
- package/dist/ui/elements/value.js +9 -0
- package/dist/ui/elements/value.works.d.ts +4 -0
- package/dist/ui/elements/value.works.js +4 -0
- package/dist/ui/elements.d.ts +1143 -0
- package/dist/ui/elements.js +68 -0
- package/dist/ui/focus-scope.d.ts +7 -0
- package/dist/ui/focus-scope.js +109 -0
- package/dist/ui/fonts.d.ts +103 -0
- package/dist/ui/fonts.js +243 -0
- package/dist/ui/generators/dev.d.ts +2 -0
- package/dist/ui/generators/dev.js +61 -0
- package/dist/ui/generators/elements.d.ts +31 -0
- package/dist/ui/generators/elements.js +520 -0
- package/dist/ui/generators/i18n.d.ts +5 -0
- package/dist/ui/generators/i18n.js +264 -0
- package/dist/ui/generators/icons.d.ts +1 -0
- package/dist/ui/generators/icons.js +187 -0
- package/dist/ui/generators/react.d.ts +26 -0
- package/dist/ui/generators/react.js +218 -0
- package/dist/ui/generators/routes.d.ts +11 -0
- package/dist/ui/generators/routes.js +597 -0
- package/dist/ui/generators/show.d.ts +1 -0
- package/dist/ui/generators/show.js +231 -0
- package/dist/ui/generators/styles.d.ts +1 -0
- package/dist/ui/generators/styles.js +502 -0
- package/dist/ui/generators/variants.d.ts +12 -0
- package/dist/ui/generators/variants.js +162 -0
- package/dist/ui/i18n/catalogs/en.d.ts +172 -0
- package/dist/ui/i18n/catalogs/en.js +148 -0
- package/dist/ui/i18n/format.d.ts +13 -0
- package/dist/ui/i18n/format.js +161 -0
- package/dist/ui/i18n/locales.d.ts +9 -0
- package/dist/ui/i18n/locales.js +20 -0
- package/dist/ui/i18n/parse.d.ts +45 -0
- package/dist/ui/i18n/parse.js +249 -0
- package/dist/ui/i18n/translator.d.ts +10 -0
- package/dist/ui/i18n/translator.js +22 -0
- package/dist/ui/i18n/types.d.ts +33 -0
- package/dist/ui/i18n/types.js +9 -0
- package/dist/ui/icons.d.ts +67 -0
- package/dist/ui/icons.js +249 -0
- package/dist/ui/islands/map.d.ts +33 -0
- package/dist/ui/islands/map.js +44 -0
- package/dist/ui/localizations.d.ts +33 -0
- package/dist/ui/localizations.js +51 -0
- package/dist/ui/makers/message.d.ts +1 -0
- package/dist/ui/makers/message.js +230 -0
- package/dist/ui/material.d.ts +83 -0
- package/dist/ui/material.js +95 -0
- package/dist/ui/materials/mat_bordered.d.ts +22 -0
- package/dist/ui/materials/mat_bordered.js +12 -0
- package/dist/ui/materials/mat_ceramic.d.ts +22 -0
- package/dist/ui/materials/mat_ceramic.js +12 -0
- package/dist/ui/materials/mat_clay.d.ts +22 -0
- package/dist/ui/materials/mat_clay.js +12 -0
- package/dist/ui/materials/mat_elevated.d.ts +32 -0
- package/dist/ui/materials/mat_elevated.js +23 -0
- package/dist/ui/materials/mat_flat.d.ts +50 -0
- package/dist/ui/materials/mat_flat.js +33 -0
- package/dist/ui/materials/mat_glass.d.ts +32 -0
- package/dist/ui/materials/mat_glass.js +19 -0
- package/dist/ui/materials/mat_lit.d.ts +22 -0
- package/dist/ui/materials/mat_lit.js +12 -0
- package/dist/ui/materials/mat_moulded.d.ts +16 -0
- package/dist/ui/materials/mat_moulded.js +10 -0
- package/dist/ui/materials.d.ts +56 -0
- package/dist/ui/materials.js +175 -0
- package/dist/ui/modes.d.ts +25 -0
- package/dist/ui/modes.js +25 -0
- package/dist/ui/navigation.d.ts +3 -0
- package/dist/ui/navigation.js +24 -0
- package/dist/ui/positioning.d.ts +24 -0
- package/dist/ui/positioning.js +48 -0
- package/dist/ui/presented.d.ts +10 -0
- package/dist/ui/presented.js +81 -0
- package/dist/ui/provider.d.ts +31 -0
- package/dist/ui/provider.js +104 -0
- package/dist/ui/render-loop.d.ts +12 -0
- package/dist/ui/render-loop.js +94 -0
- package/dist/ui/roving-focus.d.ts +15 -0
- package/dist/ui/roving-focus.js +143 -0
- package/dist/ui/screens.d.ts +17 -0
- package/dist/ui/screens.js +112 -0
- package/dist/ui/scroll-lock.d.ts +2 -0
- package/dist/ui/scroll-lock.js +24 -0
- package/dist/ui/series.d.ts +9 -0
- package/dist/ui/series.js +67 -0
- package/dist/ui/signals.d.ts +120 -0
- package/dist/ui/signals.js +286 -0
- package/dist/ui/styleguide.d.ts +27 -0
- package/dist/ui/styleguide.js +138 -0
- package/dist/ui/styleguides.d.ts +11 -0
- package/dist/ui/styleguides.js +299 -0
- package/dist/ui/themes.d.ts +5 -0
- package/dist/ui/themes.js +16 -0
- package/dist/ui/token.d.ts +16 -0
- package/dist/ui/token.js +37 -0
- package/dist/ui/tokens/shadow.d.ts +6 -0
- package/dist/ui/tokens/shadow.js +17 -0
- package/dist/ui/tokens.d.ts +180 -0
- package/dist/ui/tokens.js +200 -0
- package/dist/ui/validators.d.ts +37 -0
- package/dist/ui/validators.js +184 -0
- package/dist/ui/variant.d.ts +122 -0
- package/dist/ui/variant.js +201 -0
- package/dist/ui/variants/var_avatar-round.d.ts +23 -0
- package/dist/ui/variants/var_avatar-round.js +13 -0
- package/dist/ui/variants/var_bubble-me.d.ts +21 -0
- package/dist/ui/variants/var_bubble-me.js +13 -0
- package/dist/ui/variants/var_bubble-them.d.ts +18 -0
- package/dist/ui/variants/var_bubble-them.js +12 -0
- package/dist/ui/variants/var_button-border.d.ts +116 -0
- package/dist/ui/variants/var_button-border.js +75 -0
- package/dist/ui/variants/var_button-cta.d.ts +116 -0
- package/dist/ui/variants/var_button-cta.js +75 -0
- package/dist/ui/variants/var_button-destructive-ghost.d.ts +113 -0
- package/dist/ui/variants/var_button-destructive-ghost.js +71 -0
- package/dist/ui/variants/var_button-destructive.d.ts +116 -0
- package/dist/ui/variants/var_button-destructive.js +75 -0
- package/dist/ui/variants/var_button-fill.d.ts +116 -0
- package/dist/ui/variants/var_button-fill.js +75 -0
- package/dist/ui/variants/var_button-ghost.d.ts +113 -0
- package/dist/ui/variants/var_button-ghost.js +71 -0
- package/dist/ui/variants/var_button-glass.d.ts +84 -0
- package/dist/ui/variants/var_button-glass.js +54 -0
- package/dist/ui/variants/var_button-normal.d.ts +116 -0
- package/dist/ui/variants/var_button-normal.js +75 -0
- package/dist/ui/variants/var_button-quiet.d.ts +119 -0
- package/dist/ui/variants/var_button-quiet.js +73 -0
- package/dist/ui/variants/var_card.d.ts +30 -0
- package/dist/ui/variants/var_card.js +16 -0
- package/dist/ui/variants/var_chip.d.ts +18 -0
- package/dist/ui/variants/var_chip.js +12 -0
- package/dist/ui/variants/var_choice.d.ts +26 -0
- package/dist/ui/variants/var_choice.js +14 -0
- package/dist/ui/variants/var_framed.d.ts +11 -0
- package/dist/ui/variants/var_framed.js +9 -0
- package/dist/ui/variants/var_glyph-plain.d.ts +14 -0
- package/dist/ui/variants/var_glyph-plain.js +10 -0
- package/dist/ui/variants/var_input.d.ts +61 -0
- package/dist/ui/variants/var_input.js +42 -0
- package/dist/ui/variants/var_link-inline.d.ts +39 -0
- package/dist/ui/variants/var_link-inline.js +28 -0
- package/dist/ui/variants/var_list-row.d.ts +47 -0
- package/dist/ui/variants/var_list-row.js +33 -0
- package/dist/ui/variants/var_rule.d.ts +11 -0
- package/dist/ui/variants/var_rule.js +9 -0
- package/dist/ui/variants/var_skeleton-block.d.ts +17 -0
- package/dist/ui/variants/var_skeleton-block.js +11 -0
- package/dist/ui/variants/var_spinner-turning.d.ts +17 -0
- package/dist/ui/variants/var_spinner-turning.js +11 -0
- package/dist/ui/variants/var_stat-tile.d.ts +18 -0
- package/dist/ui/variants/var_stat-tile.js +12 -0
- package/dist/ui/variants/var_tab-bar.d.ts +24 -0
- package/dist/ui/variants/var_tab-bar.js +14 -0
- package/dist/ui/variants/var_tap-target.d.ts +33 -0
- package/dist/ui/variants/var_tap-target.js +24 -0
- package/dist/ui/variants.d.ts +174 -0
- package/dist/ui/variants.js +50 -0
- package/dist/ui/wrappers.d.ts +128 -0
- package/dist/ui/wrappers.js +220 -0
- package/package.json +16 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { gestureFor, gestureNames, holds as declared, recognise } from "../signals.js";
|
|
4
|
+
import { useCallback, useEffect, useId, useRef, useState, useSyncExternalStore } from 'react';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import { accepted, beginDrag, claimGesture, collect, currentLayout, dragSession, dragStatusOf, dwell, endDrag, innermostTarget, moveDrag, pullEdges, registerTarget, releaseGesture, subscribeDrag, } from "../drag.js";
|
|
7
|
+
import { measured, placed } from "../charts.js";
|
|
8
|
+
import { nameOf } from "../token.js";
|
|
9
|
+
import { useUi } from "../wrappers.js";
|
|
10
|
+
const held = (row) => `var(${nameOf(row)})`;
|
|
11
|
+
const TOUCH_ACTION = {
|
|
12
|
+
x: 'touch-down',
|
|
13
|
+
y: 'touch-across',
|
|
14
|
+
both: 'touch-own',
|
|
15
|
+
};
|
|
16
|
+
const wallClock = () => (typeof performance === 'object' ? performance.now() : Date.now()) / 1000;
|
|
17
|
+
const settleMs = () => {
|
|
18
|
+
if (typeof document !== 'object')
|
|
19
|
+
return 0;
|
|
20
|
+
const said = getComputedStyle(document.documentElement).getPropertyValue('--motion-normal').trim();
|
|
21
|
+
const ms = /^([\d.]+)ms$/.exec(said);
|
|
22
|
+
if (ms !== null)
|
|
23
|
+
return Number(ms[1]);
|
|
24
|
+
const seconds = /^([\d.]+)s$/.exec(said);
|
|
25
|
+
return seconds === null ? 0 : Number(seconds[1]) * 1000;
|
|
26
|
+
};
|
|
27
|
+
const SWING_AT = 220;
|
|
28
|
+
const SWING_MAX = 12;
|
|
29
|
+
const STIFFNESS = 180;
|
|
30
|
+
const DAMPING = 14;
|
|
31
|
+
const SETTLED = 0.05;
|
|
32
|
+
const EMPTY = {};
|
|
33
|
+
export function uses(props) {
|
|
34
|
+
const id = useId();
|
|
35
|
+
const { edgeScroll: pull } = useUi();
|
|
36
|
+
const claimed = gestureFor(props.gesture);
|
|
37
|
+
if (claimed === undefined) {
|
|
38
|
+
throw new Error(`<HitBox gesture="${props.gesture}"> — nothing registered that gesture, so this region would ` +
|
|
39
|
+
`take the pointer and do nothing. Registered: ${gestureNames().join(' · ')}. Contribute one with defineGesture.`);
|
|
40
|
+
}
|
|
41
|
+
const [down, setDown] = useState(false);
|
|
42
|
+
const [phase, setPhase] = useState('idle');
|
|
43
|
+
const [produced, setProduced] = useState({});
|
|
44
|
+
const released = useRef(Number.NEGATIVE_INFINITY);
|
|
45
|
+
const took = useRef(null);
|
|
46
|
+
const [pointer, setPointer] = useState(null);
|
|
47
|
+
const [settling, setSettling] = useState(false);
|
|
48
|
+
const speed = useRef(0);
|
|
49
|
+
const moved = useRef(0);
|
|
50
|
+
const [lean, setLean] = useState(0);
|
|
51
|
+
const leanSpeed = useRef(0);
|
|
52
|
+
const lastTick = useRef(0);
|
|
53
|
+
const grabbed = useRef(props.grabs);
|
|
54
|
+
grabbed.current = props.grabs;
|
|
55
|
+
const grabsKey = props.grabs === undefined ? '' : JSON.stringify(props.grabs);
|
|
56
|
+
const tuned = useRef(props.tuning);
|
|
57
|
+
tuned.current = props.tuning;
|
|
58
|
+
const tuningKey = props.tuning === undefined ? '' : JSON.stringify(props.tuning);
|
|
59
|
+
const node = useRef(null);
|
|
60
|
+
const clockNow = useRef(0);
|
|
61
|
+
const wants = props.gesture === 'pinch' || props.gesture === 'rotate';
|
|
62
|
+
const synthesised = useRef(null);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const surfaceNode = node.current;
|
|
65
|
+
if (!wants || surfaceNode === null)
|
|
66
|
+
return undefined;
|
|
67
|
+
const SPAN = 100;
|
|
68
|
+
const put = (scale, radians) => {
|
|
69
|
+
const box = surfaceNode.getBoundingClientRect();
|
|
70
|
+
const cx = box.left + box.width / 2;
|
|
71
|
+
const cy = box.top + box.height / 2;
|
|
72
|
+
const reach = (SPAN / 2) * scale;
|
|
73
|
+
const dxr = Math.cos(radians) * reach;
|
|
74
|
+
const dyr = Math.sin(radians) * reach;
|
|
75
|
+
tracked.current.set(-1, { id: -1, x: cx + dxr, y: cy + dyr, startX: cx + SPAN / 2, startY: cy, startT: clockNow.current, down: true });
|
|
76
|
+
tracked.current.set(-2, { id: -2, x: cx - dxr, y: cy - dyr, startX: cx - SPAN / 2, startY: cy, startT: clockNow.current, down: true });
|
|
77
|
+
at.current = { x: cx, y: cy };
|
|
78
|
+
setDown(true);
|
|
79
|
+
if (synthesised.current !== null)
|
|
80
|
+
clearTimeout(synthesised.current);
|
|
81
|
+
synthesised.current = window.setTimeout(() => {
|
|
82
|
+
tracked.current.delete(-1);
|
|
83
|
+
tracked.current.delete(-2);
|
|
84
|
+
setDown(false);
|
|
85
|
+
releaseGesture(id);
|
|
86
|
+
setPhase('idle');
|
|
87
|
+
setProduced(EMPTY);
|
|
88
|
+
}, 140);
|
|
89
|
+
};
|
|
90
|
+
let scale = 1;
|
|
91
|
+
let radians = 0;
|
|
92
|
+
const onWheel = (e) => {
|
|
93
|
+
if (!e.ctrlKey)
|
|
94
|
+
return;
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
scale = Math.min(4, Math.max(0.25, scale * Math.exp(-e.deltaY / 100)));
|
|
97
|
+
put(scale, radians);
|
|
98
|
+
};
|
|
99
|
+
const onGesture = (e) => {
|
|
100
|
+
const held = e;
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
scale = held.scale ?? scale;
|
|
103
|
+
radians = ((held.rotation ?? 0) * Math.PI) / 180;
|
|
104
|
+
put(scale, radians);
|
|
105
|
+
};
|
|
106
|
+
surfaceNode.addEventListener('wheel', onWheel, { passive: false });
|
|
107
|
+
surfaceNode.addEventListener('gesturechange', onGesture);
|
|
108
|
+
return () => {
|
|
109
|
+
surfaceNode.removeEventListener('wheel', onWheel);
|
|
110
|
+
surfaceNode.removeEventListener('gesturechange', onGesture);
|
|
111
|
+
if (synthesised.current !== null)
|
|
112
|
+
clearTimeout(synthesised.current);
|
|
113
|
+
};
|
|
114
|
+
}, [wants, id]);
|
|
115
|
+
const tracked = useRef(new Map());
|
|
116
|
+
const at = useRef({ x: 0, y: 0 });
|
|
117
|
+
const lastFrame = useRef(0);
|
|
118
|
+
const key = props.accepts?.join(',') ?? '';
|
|
119
|
+
const status = useSyncExternalStore(subscribeDrag, useCallback(() => dragStatusOf(id, key === '' ? undefined : key.split(',')), [id, key]), useCallback(() => 'idle', []));
|
|
120
|
+
const carrying = status === 'carrying';
|
|
121
|
+
const raises = claimed.raises;
|
|
122
|
+
return {
|
|
123
|
+
on: {},
|
|
124
|
+
pull,
|
|
125
|
+
animates: down || carrying || settling,
|
|
126
|
+
holds: [
|
|
127
|
+
...(phase === 'active' || phase === 'done'
|
|
128
|
+
? declared.filter((one) => raises.some((s) => s.name === one.id)).map((one) => one.id)
|
|
129
|
+
: []),
|
|
130
|
+
...(carrying ? ['carrying'] : []),
|
|
131
|
+
...(status === 'over' && dwell() >= (props.dwell ?? 0) ? ['draggedOver'] : []),
|
|
132
|
+
...(status === 'refusing' ? ['refusing'] : []),
|
|
133
|
+
],
|
|
134
|
+
id,
|
|
135
|
+
claimed,
|
|
136
|
+
down,
|
|
137
|
+
setDown,
|
|
138
|
+
phase,
|
|
139
|
+
setPhase,
|
|
140
|
+
produced,
|
|
141
|
+
setProduced,
|
|
142
|
+
released,
|
|
143
|
+
took,
|
|
144
|
+
pointer,
|
|
145
|
+
setPointer,
|
|
146
|
+
settling,
|
|
147
|
+
setSettling,
|
|
148
|
+
speed,
|
|
149
|
+
moved,
|
|
150
|
+
lean,
|
|
151
|
+
setLean,
|
|
152
|
+
leanSpeed,
|
|
153
|
+
lastTick,
|
|
154
|
+
grabbed,
|
|
155
|
+
grabsKey,
|
|
156
|
+
tuned,
|
|
157
|
+
tuningKey,
|
|
158
|
+
node,
|
|
159
|
+
clockNow,
|
|
160
|
+
wants,
|
|
161
|
+
synthesised,
|
|
162
|
+
tracked,
|
|
163
|
+
at,
|
|
164
|
+
lastFrame,
|
|
165
|
+
key,
|
|
166
|
+
status,
|
|
167
|
+
carrying,
|
|
168
|
+
raises,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export function wires(props, kept, surface) {
|
|
172
|
+
const { dispatch: invoke } = useUi();
|
|
173
|
+
const { pull, id, claimed, down, setDown, phase, setPhase, produced, setProduced, released, took, pointer, setPointer, settling, setSettling, speed, moved, lean, setLean, leanSpeed, lastTick, grabbed, grabsKey, tuned, tuningKey, node, clockNow, wants, synthesised, tracked, at, lastFrame, key, status, carrying, raises } = kept;
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
if (!down)
|
|
176
|
+
return undefined;
|
|
177
|
+
const give = (e) => {
|
|
178
|
+
const session = dragSession();
|
|
179
|
+
if (session?.from === id) {
|
|
180
|
+
const target = innermostTarget(currentLayout().hitBoxesAt(e.clientX, e.clientY));
|
|
181
|
+
const finished = endDrag();
|
|
182
|
+
if (target?.onDrop !== undefined && finished !== undefined && accepted(target.accepts, finished)) {
|
|
183
|
+
target.onDrop(finished);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
tracked.current.clear();
|
|
187
|
+
setDown(false);
|
|
188
|
+
setPointer(null);
|
|
189
|
+
took.current = null;
|
|
190
|
+
releaseGesture(id);
|
|
191
|
+
setPhase('idle');
|
|
192
|
+
};
|
|
193
|
+
const follow = (e) => {
|
|
194
|
+
advance(e.pointerId, e.clientX, e.clientY);
|
|
195
|
+
};
|
|
196
|
+
window.addEventListener('pointermove', follow);
|
|
197
|
+
window.addEventListener('pointerup', give);
|
|
198
|
+
window.addEventListener('pointercancel', give);
|
|
199
|
+
return () => {
|
|
200
|
+
window.removeEventListener('pointermove', follow);
|
|
201
|
+
window.removeEventListener('pointerup', give);
|
|
202
|
+
window.removeEventListener('pointercancel', give);
|
|
203
|
+
};
|
|
204
|
+
}, [down, id]);
|
|
205
|
+
useEffect(() => () => {
|
|
206
|
+
releaseGesture(id);
|
|
207
|
+
if (dragSession()?.from === id)
|
|
208
|
+
endDrag();
|
|
209
|
+
}, [id]);
|
|
210
|
+
const onDrop = props.onDrop;
|
|
211
|
+
const named = props.dispatch;
|
|
212
|
+
const carriedInput = props.input;
|
|
213
|
+
const collects = props.collects;
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
if (props.accepts === undefined)
|
|
216
|
+
return undefined;
|
|
217
|
+
const target = {
|
|
218
|
+
id,
|
|
219
|
+
accepts: key.split(','),
|
|
220
|
+
...(props.dwell === undefined ? {} : { dwell: props.dwell }),
|
|
221
|
+
...(collects === undefined ? {} : { collects: () => collects }),
|
|
222
|
+
...(onDrop === undefined && named === undefined
|
|
223
|
+
? {}
|
|
224
|
+
: {
|
|
225
|
+
onDrop: (finished) => {
|
|
226
|
+
if (onDrop !== undefined)
|
|
227
|
+
onDrop();
|
|
228
|
+
if (named === undefined)
|
|
229
|
+
return;
|
|
230
|
+
if (invoke === undefined)
|
|
231
|
+
throw new Error(`\`${named}\` cannot be invoked from here — no dispatch is wired`);
|
|
232
|
+
void invoke(named, { ...(carriedInput ?? {}), ...(finished.subject[0] ?? {}) });
|
|
233
|
+
},
|
|
234
|
+
}),
|
|
235
|
+
};
|
|
236
|
+
return registerTarget(target);
|
|
237
|
+
}, [id, key, props.accepts, props.dwell, collects, onDrop, named, carriedInput, invoke]);
|
|
238
|
+
const t = surface.t;
|
|
239
|
+
clockNow.current = t;
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
if (!down)
|
|
242
|
+
return;
|
|
243
|
+
const dt = Math.max(0, t - lastFrame.current);
|
|
244
|
+
lastFrame.current = t;
|
|
245
|
+
const pointers = [...tracked.current.values()].map((p) => ({
|
|
246
|
+
id: p.id,
|
|
247
|
+
x: p.x,
|
|
248
|
+
y: p.y,
|
|
249
|
+
startX: p.startX,
|
|
250
|
+
startY: p.startY,
|
|
251
|
+
held: t - p.startT,
|
|
252
|
+
down: p.down,
|
|
253
|
+
}));
|
|
254
|
+
const result = recognise(props.gesture, {
|
|
255
|
+
pointers,
|
|
256
|
+
t,
|
|
257
|
+
params: tuned.current ?? {},
|
|
258
|
+
sinceRelease: wallClock() - released.current,
|
|
259
|
+
});
|
|
260
|
+
const takesPointer = grabbed.current !== undefined;
|
|
261
|
+
const mine = result.phase === 'idle' || !takesPointer ? true : claimGesture(id);
|
|
262
|
+
setPhase(mine ? result.phase : 'idle');
|
|
263
|
+
setProduced(mine && result.values !== undefined ? result.values : EMPTY);
|
|
264
|
+
if (!mine)
|
|
265
|
+
return;
|
|
266
|
+
const session = dragSession();
|
|
267
|
+
if (result.phase !== 'idle' && grabbed.current !== undefined && session === undefined) {
|
|
268
|
+
beginDrag({ gesture: props.gesture, subject: grabbed.current, from: id, x: at.current.x, y: at.current.y, t });
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (session === undefined || session.from !== id)
|
|
272
|
+
return;
|
|
273
|
+
const target = innermostTarget(currentLayout().hitBoxesAt(at.current.x, at.current.y));
|
|
274
|
+
moveDrag({ x: at.current.x, y: at.current.y, ...(target === undefined ? {} : { over: target.id }), t });
|
|
275
|
+
if (target?.collects !== undefined && dwell() >= (target.dwell ?? 0))
|
|
276
|
+
collect(target.collects());
|
|
277
|
+
pullEdges(at.current.x, at.current.y, dt, pull ?? {});
|
|
278
|
+
}, [down, t, pointer, id, props.gesture, grabsKey, tuningKey, pull]);
|
|
279
|
+
useEffect(() => {
|
|
280
|
+
if (phase !== 'done')
|
|
281
|
+
return undefined;
|
|
282
|
+
const frame = requestAnimationFrame(() => {
|
|
283
|
+
releaseGesture(id);
|
|
284
|
+
setPhase('idle');
|
|
285
|
+
setProduced(EMPTY);
|
|
286
|
+
});
|
|
287
|
+
return () => cancelAnimationFrame(frame);
|
|
288
|
+
}, [phase, id]);
|
|
289
|
+
const onPointerDown = (e) => {
|
|
290
|
+
if (grabbed.current !== undefined) {
|
|
291
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
}
|
|
294
|
+
const box = e.currentTarget.getBoundingClientRect();
|
|
295
|
+
setPointer({ x: e.clientX, y: e.clientY });
|
|
296
|
+
took.current =
|
|
297
|
+
box.width > 0 && box.height > 0
|
|
298
|
+
? { width: box.width, height: box.height, gripX: e.clientX - box.left, gripY: e.clientY - box.top }
|
|
299
|
+
: null;
|
|
300
|
+
speed.current = 0;
|
|
301
|
+
moved.current = wallClock();
|
|
302
|
+
tracked.current.set(e.pointerId, { id: e.pointerId, x: e.clientX, y: e.clientY, startX: e.clientX, startY: e.clientY, startT: t, down: true });
|
|
303
|
+
at.current = { x: e.clientX, y: e.clientY };
|
|
304
|
+
lastFrame.current = t;
|
|
305
|
+
setDown(true);
|
|
306
|
+
};
|
|
307
|
+
const advance = (pointerId, x, y) => {
|
|
308
|
+
const p = tracked.current.get(pointerId);
|
|
309
|
+
if (p === undefined)
|
|
310
|
+
return;
|
|
311
|
+
if (p.x === x && p.y === y)
|
|
312
|
+
return;
|
|
313
|
+
const e = { pointerId, clientX: x, clientY: y };
|
|
314
|
+
const at2 = wallClock();
|
|
315
|
+
const dt = Math.max(1 / 240, at2 - moved.current);
|
|
316
|
+
const raw = (e.clientX - p.x) / dt;
|
|
317
|
+
speed.current = speed.current * 0.7 + raw * 0.3;
|
|
318
|
+
moved.current = at2;
|
|
319
|
+
p.x = e.clientX;
|
|
320
|
+
p.y = e.clientY;
|
|
321
|
+
at.current = { x: e.clientX, y: e.clientY };
|
|
322
|
+
setPointer({ x: e.clientX, y: e.clientY });
|
|
323
|
+
};
|
|
324
|
+
const onPointerMove = (e) => {
|
|
325
|
+
advance(e.pointerId, e.clientX, e.clientY);
|
|
326
|
+
};
|
|
327
|
+
const finish = (e, cancelled) => {
|
|
328
|
+
const p = tracked.current.get(e.pointerId);
|
|
329
|
+
if (p !== undefined) {
|
|
330
|
+
p.x = e.clientX;
|
|
331
|
+
p.y = e.clientY;
|
|
332
|
+
p.down = false;
|
|
333
|
+
at.current = { x: e.clientX, y: e.clientY };
|
|
334
|
+
}
|
|
335
|
+
const session = dragSession();
|
|
336
|
+
if (session?.from === id) {
|
|
337
|
+
const target = cancelled ? undefined : innermostTarget(currentLayout().hitBoxesAt(e.clientX, e.clientY));
|
|
338
|
+
const finished = endDrag();
|
|
339
|
+
if (target?.onDrop !== undefined && finished !== undefined && accepted(target.accepts, finished)) {
|
|
340
|
+
target.onDrop(finished);
|
|
341
|
+
}
|
|
342
|
+
releaseGesture(id);
|
|
343
|
+
speed.current = 0;
|
|
344
|
+
}
|
|
345
|
+
const last = p !== undefined && tracked.current.size === 1 && !cancelled ? p : undefined;
|
|
346
|
+
let completed = false;
|
|
347
|
+
if (last !== undefined) {
|
|
348
|
+
const result = recognise(props.gesture, {
|
|
349
|
+
pointers: [
|
|
350
|
+
{ id: last.id, x: last.x, y: last.y, startX: last.startX, startY: last.startY, held: t - last.startT, down: false },
|
|
351
|
+
],
|
|
352
|
+
t,
|
|
353
|
+
params: props.tuning ?? {},
|
|
354
|
+
sinceRelease: wallClock() - released.current,
|
|
355
|
+
});
|
|
356
|
+
if (result.phase !== 'idle' && claimGesture(id)) {
|
|
357
|
+
setPhase(result.phase);
|
|
358
|
+
setProduced(result.values ?? EMPTY);
|
|
359
|
+
completed = true;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
tracked.current.delete(e.pointerId);
|
|
363
|
+
if (tracked.current.size === 0) {
|
|
364
|
+
setDown(false);
|
|
365
|
+
releaseGesture(id);
|
|
366
|
+
setPointer(null);
|
|
367
|
+
took.current = null;
|
|
368
|
+
if (!completed)
|
|
369
|
+
setPhase('idle');
|
|
370
|
+
if (!cancelled)
|
|
371
|
+
released.current = wallClock();
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
const session = dragSession();
|
|
375
|
+
const mine = carrying && session !== undefined && session.from === id;
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
if (!mine && !settling) {
|
|
378
|
+
lastTick.current = t;
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const step = Math.min(1 / 20, Math.max(0, t - lastTick.current));
|
|
382
|
+
lastTick.current = t;
|
|
383
|
+
if (step === 0)
|
|
384
|
+
return;
|
|
385
|
+
const target = mine ? Math.max(-SWING_MAX, Math.min(SWING_MAX, speed.current / SWING_AT)) : 0;
|
|
386
|
+
const force = -STIFFNESS * (lean - target) - DAMPING * leanSpeed.current;
|
|
387
|
+
const next = lean + leanSpeed.current * step;
|
|
388
|
+
leanSpeed.current += force * step;
|
|
389
|
+
if (!mine && Math.abs(next) < SETTLED && Math.abs(leanSpeed.current) < SETTLED) {
|
|
390
|
+
leanSpeed.current = 0;
|
|
391
|
+
if (lean !== 0)
|
|
392
|
+
setLean(0);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
setLean(next);
|
|
396
|
+
}, [t, mine, settling, lean]);
|
|
397
|
+
useEffect(() => {
|
|
398
|
+
if (mine) {
|
|
399
|
+
setSettling(true);
|
|
400
|
+
return undefined;
|
|
401
|
+
}
|
|
402
|
+
if (!settling)
|
|
403
|
+
return undefined;
|
|
404
|
+
if (Math.abs(lean) < SETTLED && Math.abs(leanSpeed.current) < SETTLED) {
|
|
405
|
+
const timer = setTimeout(() => setSettling(false), settleMs());
|
|
406
|
+
return () => clearTimeout(timer);
|
|
407
|
+
}
|
|
408
|
+
return undefined;
|
|
409
|
+
}, [mine, settling, lean]);
|
|
410
|
+
const swing = lean;
|
|
411
|
+
useEffect(() => {
|
|
412
|
+
if (!mine)
|
|
413
|
+
return undefined;
|
|
414
|
+
const root = document.documentElement;
|
|
415
|
+
const was = root.style.userSelect;
|
|
416
|
+
root.style.userSelect = held('picking-off');
|
|
417
|
+
return () => {
|
|
418
|
+
root.style.userSelect = was;
|
|
419
|
+
};
|
|
420
|
+
}, [mine]);
|
|
421
|
+
const travels = props.moves !== false;
|
|
422
|
+
const flying = mine && travels && took.current !== null && pointer !== null;
|
|
423
|
+
const layer = flying && took.current !== null && pointer !== null ? (_jsx("div", { "aria-hidden": true, className: placed('hit-box', 'carried'), style: measured({
|
|
424
|
+
width: `${String(took.current.width)}px`,
|
|
425
|
+
height: `${String(took.current.height)}px`,
|
|
426
|
+
carry: `translate3d(${String(pointer.x - took.current.gripX)}px, ${String(pointer.y - took.current.gripY)}px, 0)` +
|
|
427
|
+
' var(--transform-carried, scale(1)) var(--transform-carried-turn, rotate(0deg))' +
|
|
428
|
+
` rotate(${swing.toFixed(2)}deg)`,
|
|
429
|
+
grip: `${took.current.gripX.toFixed(1)}px ${took.current.gripY.toFixed(1)}px`,
|
|
430
|
+
}), children: props.children })) : null;
|
|
431
|
+
return {
|
|
432
|
+
on: {
|
|
433
|
+
ref: node,
|
|
434
|
+
'data-hitbox': id,
|
|
435
|
+
style: measured({
|
|
436
|
+
touch: held(props.grabs === undefined ? 'touch-page' : (TOUCH_ACTION[(props.axis ?? 'both')] ?? 'touch-own')),
|
|
437
|
+
pick: held(props.grabs === undefined ? 'picking-open' : 'picking-off'),
|
|
438
|
+
shown: held(flying ? 'visibility-hidden' : 'visibility-shown'),
|
|
439
|
+
flow: held(flying ? 'position-lifted' : 'position-flow'),
|
|
440
|
+
}),
|
|
441
|
+
onPointerDown,
|
|
442
|
+
onPointerMove,
|
|
443
|
+
onPointerUp: (e) => finish(e, false),
|
|
444
|
+
onPointerCancel: (e) => finish(e, true),
|
|
445
|
+
},
|
|
446
|
+
layer,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
export function shown(_props, _surface, _kept, wired) {
|
|
450
|
+
return { carried: wired.layer === null ? null : createPortal(wired.layer, document.body) };
|
|
451
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MessageKey } from '../content.tsx';
|
|
2
|
+
import { type Element } from '../wrappers.tsx';
|
|
3
|
+
export interface ImageProps {
|
|
4
|
+
readonly src: string;
|
|
5
|
+
readonly altKey: MessageKey;
|
|
6
|
+
readonly dispatch?: string;
|
|
7
|
+
readonly input?: Readonly<Record<string, unknown>>;
|
|
8
|
+
readonly invokeOn?: 'press' | 'shown';
|
|
9
|
+
}
|
|
10
|
+
export declare const Image: Element<'Image', ImageProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { roleClass } from "../fonts.js";
|
|
4
|
+
import { element, useSurface } from "../wrappers.js";
|
|
5
|
+
export const Image = element('Image', (props, className) => {
|
|
6
|
+
const surface = useSurface({ className: roleClass(undefined, className),
|
|
7
|
+
invokes: { ...(props.dispatch === undefined ? {} : { dispatch: props.dispatch }), ...(props.input === undefined ? {} : { input: props.input }), ...(props.invokeOn === undefined ? {} : { on: props.invokeOn }) }, });
|
|
8
|
+
return (_jsx("img", { className: surface.className, ...surface.marks, ...surface.invokes, ...surface.a11y, src: props.src, alt: surface.text(props.altKey) }));
|
|
9
|
+
}, 'e-image');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MessageKey } from '../content.tsx';
|
|
2
|
+
import type { Row } from '../charts.tsx';
|
|
3
|
+
import { type Element } from '../wrappers.tsx';
|
|
4
|
+
export interface LineChartProps {
|
|
5
|
+
readonly rows: readonly Row[];
|
|
6
|
+
readonly by?: string;
|
|
7
|
+
readonly value: string;
|
|
8
|
+
readonly titleKey?: MessageKey;
|
|
9
|
+
readonly dispatch?: string;
|
|
10
|
+
readonly input?: Readonly<Record<string, unknown>>;
|
|
11
|
+
readonly invokeOn?: 'press' | 'shown';
|
|
12
|
+
}
|
|
13
|
+
export declare const LineChart: Element<'LineChart', LineChartProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { roleClass } from "../fonts.js";
|
|
4
|
+
import { element, useSurface } from "../wrappers.js";
|
|
5
|
+
import { Each } from "./each.js";
|
|
6
|
+
import { drawing, lines, uses } from "./line-chart.works.js";
|
|
7
|
+
export const LineChart = element('LineChart', (props, className) => {
|
|
8
|
+
const kept = uses(props);
|
|
9
|
+
const surface = useSurface({ className: roleClass(undefined, className),
|
|
10
|
+
invokes: { ...(props.dispatch === undefined ? {} : { dispatch: props.dispatch }), ...(props.input === undefined ? {} : { input: props.input }), ...(props.invokeOn === undefined ? {} : { on: props.invokeOn }) },
|
|
11
|
+
holds: [
|
|
12
|
+
...(kept.holds ?? []),
|
|
13
|
+
],
|
|
14
|
+
...(kept.animates === undefined ? {} : { animates: kept.animates }), });
|
|
15
|
+
return (_jsx("svg", { className: surface.className, ...surface.marks, ...surface.invokes, ...surface.a11y, ...(kept.on ?? {}), role: "img", ...(props.titleKey === undefined ? {} : { 'aria-label': surface.text(props.titleKey) }), children: _jsx(Each, { rows: lines(props, kept), by: 'group', children: (each0, at) => (_jsx("polyline", { ...drawing(props, kept, each0, at) })) }) }));
|
|
16
|
+
}, 'e-line-chart');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Row } from '../charts.tsx';
|
|
2
|
+
import type { LineChartProps } from './line-chart.tsx';
|
|
3
|
+
export declare function lines(props: LineChartProps, _kept?: unknown): readonly Row[];
|
|
4
|
+
export declare function uses(props: LineChartProps): {
|
|
5
|
+
readonly holds?: readonly string[];
|
|
6
|
+
readonly animates?: boolean;
|
|
7
|
+
readonly on?: Readonly<Record<string, unknown>>;
|
|
8
|
+
readonly ramp: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
export declare function drawing(props: LineChartProps, kept: {
|
|
11
|
+
readonly ramp: readonly string[];
|
|
12
|
+
}, row: Row, at: number): Readonly<Record<string, string | number>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { seriesColour } from "../series.js";
|
|
2
|
+
import { num, polyline, str, useRamp } from "../charts.js";
|
|
3
|
+
const WIDE = 300;
|
|
4
|
+
const TALL = 120;
|
|
5
|
+
export function lines(props, _kept) {
|
|
6
|
+
if (props.by === undefined)
|
|
7
|
+
return [{ group: '' }];
|
|
8
|
+
return [...new Set(props.rows.map((one) => str(one, props.by)))].map((group) => ({ group }));
|
|
9
|
+
}
|
|
10
|
+
export function uses(props) {
|
|
11
|
+
const ramp = useRamp(lines(props).length);
|
|
12
|
+
return {
|
|
13
|
+
...(props.rows.length === 0 ? { holds: ['empty'] } : {}),
|
|
14
|
+
on: { viewBox: `0 0 ${String(WIDE)} ${String(TALL)}` },
|
|
15
|
+
ramp,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function drawing(props, kept, row, at) {
|
|
19
|
+
const group = str(row, 'group');
|
|
20
|
+
const mine = props.rows.filter((one) => props.by === undefined || str(one, props.by) === group);
|
|
21
|
+
return {
|
|
22
|
+
points: polyline(mine.map((one) => num(one, props.value)), WIDE, TALL),
|
|
23
|
+
fill: 'none',
|
|
24
|
+
stroke: seriesColour(kept.ramp, at),
|
|
25
|
+
strokeWidth: 2,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MessageKey } from '../content.tsx';
|
|
2
|
+
import { type FontRoleId } from '../fonts.ts';
|
|
3
|
+
import { type Element } from '../wrappers.tsx';
|
|
4
|
+
export interface LinkProps {
|
|
5
|
+
readonly navigateTo: string;
|
|
6
|
+
readonly labelKey: MessageKey;
|
|
7
|
+
readonly is?: FontRoleId;
|
|
8
|
+
readonly dispatch?: string;
|
|
9
|
+
readonly input?: Readonly<Record<string, unknown>>;
|
|
10
|
+
readonly invokeOn?: 'press' | 'shown';
|
|
11
|
+
}
|
|
12
|
+
export declare const Link: Element<'Link', LinkProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { roleClass } from "../fonts.js";
|
|
4
|
+
import { element, useSurface } from "../wrappers.js";
|
|
5
|
+
import { uses } from "./link.works.js";
|
|
6
|
+
export const Link = element('Link', (props, className) => {
|
|
7
|
+
const kept = uses(props);
|
|
8
|
+
const surface = useSurface({ className: roleClass(props.is, className),
|
|
9
|
+
invokes: { ...(props.dispatch === undefined ? {} : { dispatch: props.dispatch }), ...(props.input === undefined ? {} : { input: props.input }), ...(props.invokeOn === undefined ? {} : { on: props.invokeOn }) },
|
|
10
|
+
holds: [
|
|
11
|
+
...(kept.holds ?? []),
|
|
12
|
+
],
|
|
13
|
+
...(kept.animates === undefined ? {} : { animates: kept.animates }), });
|
|
14
|
+
return (_jsx("a", { className: surface.className, ...surface.marks, ...surface.invokes, ...surface.a11y, ...(kept.on ?? {}), children: surface.text(props.labelKey) }));
|
|
15
|
+
}, 'e-link');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MouseEvent } from 'react';
|
|
2
|
+
import type { LinkProps } from './link.tsx';
|
|
3
|
+
export declare function uses(props: LinkProps): {
|
|
4
|
+
readonly holds?: readonly string[];
|
|
5
|
+
readonly animates?: boolean;
|
|
6
|
+
readonly on: {
|
|
7
|
+
readonly href: string;
|
|
8
|
+
readonly onClick: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { usePress } from "../wrappers.js";
|
|
2
|
+
export function uses(props) {
|
|
3
|
+
const press = usePress({ navigateTo: props.navigateTo }, { element: 'Link', name: props.labelKey });
|
|
4
|
+
return {
|
|
5
|
+
on: {
|
|
6
|
+
href: `#${props.navigateTo}`,
|
|
7
|
+
onClick: (event) => {
|
|
8
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0)
|
|
9
|
+
return;
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
press?.();
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MessageKey } from '../content.tsx';
|
|
2
|
+
import { type Element } from '../wrappers.tsx';
|
|
3
|
+
export interface MediaProps {
|
|
4
|
+
readonly as: 'image' | 'video' | 'audio' | 'file';
|
|
5
|
+
readonly src: string;
|
|
6
|
+
readonly altKey: MessageKey;
|
|
7
|
+
readonly dispatch?: string;
|
|
8
|
+
readonly input?: Readonly<Record<string, unknown>>;
|
|
9
|
+
readonly invokeOn?: 'press' | 'shown';
|
|
10
|
+
}
|
|
11
|
+
export declare const Media: Element<'Media', MediaProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { roleClass } from "../fonts.js";
|
|
4
|
+
import { element, useSurface } from "../wrappers.js";
|
|
5
|
+
export const Media = element('Media', (props, className) => {
|
|
6
|
+
const surface = useSurface({ className: roleClass(undefined, className),
|
|
7
|
+
invokes: { ...(props.dispatch === undefined ? {} : { dispatch: props.dispatch }), ...(props.input === undefined ? {} : { input: props.input }), ...(props.invokeOn === undefined ? {} : { on: props.invokeOn }) }, });
|
|
8
|
+
return ((() => {
|
|
9
|
+
switch (props.as) {
|
|
10
|
+
case 'image':
|
|
11
|
+
return (_jsx("img", { className: surface.className, ...surface.marks, ...surface.invokes, ...surface.a11y, src: props.src, alt: surface.text(props.altKey) }));
|
|
12
|
+
case 'video':
|
|
13
|
+
return (_jsx("video", { className: surface.className, ...surface.marks, ...surface.invokes, ...surface.a11y, src: props.src, "aria-label": surface.text(props.altKey), controls: true, preload: "metadata", children: null }));
|
|
14
|
+
case 'audio':
|
|
15
|
+
return (_jsx("audio", { className: surface.className, ...surface.marks, ...surface.invokes, ...surface.a11y, src: props.src, "aria-label": surface.text(props.altKey), controls: true, preload: "metadata", children: null }));
|
|
16
|
+
case 'file':
|
|
17
|
+
return (_jsx("a", { className: surface.className, ...surface.marks, ...surface.invokes, ...surface.a11y, href: props.src, download: true, children: surface.text(props.altKey) }));
|
|
18
|
+
default:
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
})());
|
|
22
|
+
}, 'e-media');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MessageKey } from '../content.tsx';
|
|
2
|
+
import type { Row } from '../charts.tsx';
|
|
3
|
+
import { type Element } from '../wrappers.tsx';
|
|
4
|
+
export interface MenuProps {
|
|
5
|
+
readonly labelKey: MessageKey;
|
|
6
|
+
readonly items: readonly Row[];
|
|
7
|
+
readonly side?: string;
|
|
8
|
+
readonly dispatch?: string;
|
|
9
|
+
readonly input?: Readonly<Record<string, unknown>>;
|
|
10
|
+
readonly invokeOn?: 'press' | 'shown';
|
|
11
|
+
}
|
|
12
|
+
export declare const Menu: Element<'Menu', MenuProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { roleClass } from "../fonts.js";
|
|
4
|
+
import { Presented, MenuRow } from "./menu.works.js";
|
|
5
|
+
import { element, useSurface } from "../wrappers.js";
|
|
6
|
+
import { Each } from "./each.js";
|
|
7
|
+
import { measured, opener, portal, listing, row, uses } from "./menu.works.js";
|
|
8
|
+
export const Menu = element('Menu', (props, className) => {
|
|
9
|
+
const kept = uses(props);
|
|
10
|
+
const surface = useSurface({ className: roleClass(undefined, className),
|
|
11
|
+
invokes: { ...(props.dispatch === undefined ? {} : { dispatch: props.dispatch }), ...(props.input === undefined ? {} : { input: props.input }), ...(props.invokeOn === undefined ? {} : { on: props.invokeOn }) },
|
|
12
|
+
holds: [
|
|
13
|
+
...(kept.holds ?? []),
|
|
14
|
+
],
|
|
15
|
+
measures: measured(props, kept),
|
|
16
|
+
...(kept.animates === undefined ? {} : { animates: kept.animates }), });
|
|
17
|
+
return (_jsxs("span", { ...surface.marks, ...surface.invokes, ...surface.a11y, ...(kept.on ?? {}), style: surface.measures, children: [_jsx("button", { className: `e-menu-opener ${surface.className ?? ''}`, ...opener(props, kept), children: surface.text(props.labelKey) }), _jsx(Presented, { ...portal(props, kept), children: _jsx("div", { className: "e-menu-layer", ...listing(props, kept), children: _jsx(Each, { rows: props.items, by: props.labelKey, children: (each0, at) => (_jsx(MenuRow, { ...row(props, kept, each0, at) })) }) }) })] }));
|
|
18
|
+
}, 'e-menu');
|