@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,31 @@
|
|
|
1
|
+
export declare function pascal(id: string): string;
|
|
2
|
+
export declare const OWNED_AT = "ui/";
|
|
3
|
+
export declare function owned(body: string, rows: readonly {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly at?: string;
|
|
6
|
+
}[]): readonly string[];
|
|
7
|
+
export declare function translated(name: string, tag: string | Readonly<Record<string, string>>, arranges: boolean, raises: readonly string[], from: {
|
|
8
|
+
readonly wrappers: string;
|
|
9
|
+
readonly content: string;
|
|
10
|
+
readonly rows: string;
|
|
11
|
+
readonly validators: string;
|
|
12
|
+
readonly fonts: string;
|
|
13
|
+
readonly map: string;
|
|
14
|
+
readonly parts: string;
|
|
15
|
+
readonly consent: string;
|
|
16
|
+
readonly drag: string;
|
|
17
|
+
}, carries?: Readonly<Record<string, string>>, always?: readonly string[], places?: Readonly<Record<string, Readonly<Record<string, string>>>>, works?: string, measures?: readonly string[], reads?: string, gives?: readonly string[], keeps?: boolean, animates?: boolean, says?: string, called?: string, wires?: string, dresses?: string): string;
|
|
18
|
+
export declare const CARRIES: readonly string[];
|
|
19
|
+
export declare const READINGS: readonly string[];
|
|
20
|
+
export declare const APP: {
|
|
21
|
+
readonly wrappers: `${string}/wrappers`;
|
|
22
|
+
readonly content: `${string}/content`;
|
|
23
|
+
readonly rows: `${string}/charts`;
|
|
24
|
+
readonly validators: `${string}/validators`;
|
|
25
|
+
readonly fonts: `${string}/fonts`;
|
|
26
|
+
readonly map: `${string}/islands/map`;
|
|
27
|
+
readonly parts: `${string}/disclosure`;
|
|
28
|
+
readonly consent: `${string}/consent`;
|
|
29
|
+
readonly drag: `${string}/drag`;
|
|
30
|
+
};
|
|
31
|
+
export declare const declared: Set<string>;
|
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { join, resolve } from 'node:path';
|
|
11
|
+
import { argv, stdout } from 'node:process';
|
|
12
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
13
|
+
import { exit, invoked } from "@prestack/thread/core/invoked";
|
|
14
|
+
import { named as packageOf } from "@prestack/thread/core/scope";
|
|
15
|
+
import { findTree, inTree } from "@prestack/thread/core/tree";
|
|
16
|
+
import { classOfElement, looking } from "../variant.js";
|
|
17
|
+
const idOf = (name) => name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
18
|
+
export function pascal(id) {
|
|
19
|
+
return id
|
|
20
|
+
.split('-')
|
|
21
|
+
.map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
|
|
22
|
+
.join('');
|
|
23
|
+
}
|
|
24
|
+
const TAG = /<([A-Z][A-Za-z0-9]*)/g;
|
|
25
|
+
export const OWNED_AT = 'ui/';
|
|
26
|
+
export function owned(body, rows) {
|
|
27
|
+
const named = new Map();
|
|
28
|
+
for (const row of rows) {
|
|
29
|
+
const at = row.at;
|
|
30
|
+
if (typeof at !== 'string' || !at.startsWith(OWNED_AT))
|
|
31
|
+
continue;
|
|
32
|
+
named.set(pascal(row.id), at);
|
|
33
|
+
}
|
|
34
|
+
const found = new Set();
|
|
35
|
+
for (const [, tag] of body.matchAll(TAG))
|
|
36
|
+
if (tag !== undefined && named.has(tag))
|
|
37
|
+
found.add(tag);
|
|
38
|
+
return [...found].sort().map((one) => `import { ${one} } from '../${named.get(one) ?? ''}'`);
|
|
39
|
+
}
|
|
40
|
+
export function translated(name, tag, arranges, raises, from, carries = {}, always = [], places = {}, works, measures = [], reads, gives = [], keeps = false, animates = false, says, called, wires, dresses) {
|
|
41
|
+
const made = pascal(name);
|
|
42
|
+
const invoking = [
|
|
43
|
+
...(carries['dispatch'] === undefined ? [' readonly dispatch?: string'] : []),
|
|
44
|
+
...(carries['input'] === undefined ? [' readonly input?: Readonly<Record<string, unknown>>'] : []),
|
|
45
|
+
" readonly invokeOn?: 'press' | 'shown'",
|
|
46
|
+
];
|
|
47
|
+
const stated = Object.entries(carries);
|
|
48
|
+
const names = stated.find(([, kind]) => NAMES(kind));
|
|
49
|
+
const source = stated.find(([, kind]) => SOURCES(kind));
|
|
50
|
+
const silent = reads !== undefined && READS[reads]?.hidden === true;
|
|
51
|
+
const bare = typeof tag === 'string' && tag === '';
|
|
52
|
+
const worded = silent || bare || called !== undefined || Object.keys(places).length > 0 || (works !== undefined && !arranges) || stated.some(([, kind]) => NAMES(kind) || KINDS[kind]?.from === 'content');
|
|
53
|
+
const chosen = typeof tag === 'string' ? undefined : tag;
|
|
54
|
+
const first = typeof tag === 'string' ? tag : (Object.entries(tag).find(([key]) => key !== 'by')?.[1] ?? 'div');
|
|
55
|
+
const titled = called === undefined ? '' : ` aria-label={surface.text('${called}')}`;
|
|
56
|
+
const naming = (one) => names === undefined || SPEAKS.has(one)
|
|
57
|
+
? ''
|
|
58
|
+
: KINDS[names[1]]?.needed === false
|
|
59
|
+
? ` {...(props.${names[0]} === undefined ? {} : { 'aria-label': surface.text(props.${names[0]}) })}`
|
|
60
|
+
: one === 'img'
|
|
61
|
+
? ` alt={surface.text(props.${names[0]})}`
|
|
62
|
+
: ` aria-label={surface.text(props.${names[0]})}`;
|
|
63
|
+
const sourced = (one) => source === undefined ? '' : ` ${SOURCE[one] ?? 'src'}={props.${source[0]}}`;
|
|
64
|
+
const props = [
|
|
65
|
+
...(arranges
|
|
66
|
+
? [' readonly children: ReactNode']
|
|
67
|
+
: worded
|
|
68
|
+
? []
|
|
69
|
+
: [' readonly labelKey: MessageKey']),
|
|
70
|
+
...stated.map(([id, kind]) => {
|
|
71
|
+
const held = KINDS[kind];
|
|
72
|
+
const picks = chosen !== undefined && chosen['by'] === id;
|
|
73
|
+
const must = held?.needed === true || measures.includes(id) || picks;
|
|
74
|
+
const is = picks
|
|
75
|
+
? Object.keys(chosen).filter((key) => key !== 'by').map((key) => `'${key}'`).join(' | ')
|
|
76
|
+
: (held?.is ?? 'never');
|
|
77
|
+
return ` readonly ${id}${must ? '' : '?'}: ${is}`;
|
|
78
|
+
}),
|
|
79
|
+
...raises.map((one) => ` readonly ${one}?: boolean`),
|
|
80
|
+
];
|
|
81
|
+
const SAID = new Set(['tag', 'shows', 'reads', 'holds', 'each', 'by', 'takes', 'marks', 'gives', 'keyed', 'when']);
|
|
82
|
+
const named = [
|
|
83
|
+
...new Set(Object.values(places)
|
|
84
|
+
.map((made) => made?.['tag'])
|
|
85
|
+
.filter((one) => one !== undefined && /^[A-Z]/.test(one))
|
|
86
|
+
.map((one) => one.split('.')[0] ?? '')),
|
|
87
|
+
];
|
|
88
|
+
const worn = named.filter((one) => declared.has(idOf(one)));
|
|
89
|
+
const built = named.filter((one) => !declared.has(idOf(one)));
|
|
90
|
+
const nested = new Set();
|
|
91
|
+
for (const made of Object.values(places)) {
|
|
92
|
+
const held = made?.['holds'];
|
|
93
|
+
if (typeof held === 'string')
|
|
94
|
+
for (const one of held.split(/\s+/).filter(Boolean))
|
|
95
|
+
nested.add(one);
|
|
96
|
+
}
|
|
97
|
+
const region = (place, depth, rows = [], looped = false) => {
|
|
98
|
+
const made = (places[place] ?? {});
|
|
99
|
+
const row = rows[rows.length - 1];
|
|
100
|
+
const gave = rows.length === 0 ? '' : `, ${rows.join(', ')}`;
|
|
101
|
+
const pad = ' ' + ' '.repeat(depth);
|
|
102
|
+
const as = made['tag'] ?? 'span';
|
|
103
|
+
const meant = made['reads'] === undefined ? undefined : READS[made['reads']];
|
|
104
|
+
const from = made['shows'];
|
|
105
|
+
const kind = from === undefined ? undefined : carries[from];
|
|
106
|
+
const shape = kind === undefined ? undefined : KINDS[kind];
|
|
107
|
+
const points = shape?.from === 'source' && from !== undefined;
|
|
108
|
+
const pointed = points ? ` src={props.${String(from)}}${as === 'img' ? ' alt=""' : ''}` : '';
|
|
109
|
+
const shown = points
|
|
110
|
+
? ''
|
|
111
|
+
: from === undefined
|
|
112
|
+
? ''
|
|
113
|
+
: row !== undefined
|
|
114
|
+
? shape === undefined
|
|
115
|
+
? `{shown(props${gave}, surface${keeps ? ', kept' : ''}).${from}}`
|
|
116
|
+
: `{surface.text(String(${row}.${from}))}`
|
|
117
|
+
: shape === undefined
|
|
118
|
+
? `{shown(props, surface${keeps ? ', kept' : ''}${wires === undefined ? '' : ', wired'}).${from}}`
|
|
119
|
+
: shape.from === 'content'
|
|
120
|
+
? `{surface.text(props.${from})}`
|
|
121
|
+
: `{props.${from}}`;
|
|
122
|
+
const facing = meant?.orients === undefined || carries[meant.orients] === undefined
|
|
123
|
+
? ''
|
|
124
|
+
: ` aria-orientation={props.${meant.orients} === 'vertical' ? 'vertical' : 'horizontal'}`;
|
|
125
|
+
const taken = (made['takes'] ?? '')
|
|
126
|
+
.split(/\s+/)
|
|
127
|
+
.filter(Boolean)
|
|
128
|
+
.map((one) => GIVES[one] ?? '')
|
|
129
|
+
.join('');
|
|
130
|
+
const sized = made['marks'] === undefined || row === undefined
|
|
131
|
+
? ''
|
|
132
|
+
: ` style={marking(${made['marks']}(props${keeps ? ', kept' : ''}${gave}, at))}`;
|
|
133
|
+
const handed = made['gives'] === undefined
|
|
134
|
+
? ''
|
|
135
|
+
: ` {...${made['gives']}(props${keeps ? ', kept' : ''}${gave}${row === undefined ? '' : ', at'})}`;
|
|
136
|
+
const owns = row === undefined || IDENTIFIES[as] === undefined || made['by'] === undefined
|
|
137
|
+
? ''
|
|
138
|
+
: ` ${String(IDENTIFIES[as])}={String(${row}.${String(made['by'])})}`;
|
|
139
|
+
const bound = owns +
|
|
140
|
+
handed +
|
|
141
|
+
sized +
|
|
142
|
+
pointed +
|
|
143
|
+
facing +
|
|
144
|
+
taken +
|
|
145
|
+
(meant === undefined
|
|
146
|
+
? ''
|
|
147
|
+
: (meant.control ?? '') +
|
|
148
|
+
(from === undefined || row !== undefined || meant.state === undefined || carries[from] === undefined
|
|
149
|
+
? ''
|
|
150
|
+
: ` ${meant.state}={props.${from}${meant.state === 'checked' ? ' === true' : " ?? ''"}}`) +
|
|
151
|
+
(meant.answers ?? ''));
|
|
152
|
+
const held = (made['holds'] ?? '').split(/\s+/).filter(Boolean);
|
|
153
|
+
const within = held.map((one) => region(one, depth + 1, rows)).join('\n');
|
|
154
|
+
const body = within === '' ? (meant?.state === undefined ? shown : '') : `\n${within}\n${pad}`;
|
|
155
|
+
const dressed = /^[A-Z]/.test(as)
|
|
156
|
+
? ''
|
|
157
|
+
: place === dresses
|
|
158
|
+
? ` className={\`e-${name}-${place} \${surface.className ?? ''}\`}`
|
|
159
|
+
: looking(made)
|
|
160
|
+
? ` className="e-${name}-${place}"`
|
|
161
|
+
: '';
|
|
162
|
+
const written = SHUT.has(as)
|
|
163
|
+
? `<${as}${dressed}${bound} />`
|
|
164
|
+
: `<${as}${dressed}${bound}>${body}</${as}>`;
|
|
165
|
+
const only = made['when'];
|
|
166
|
+
const one = only !== undefined
|
|
167
|
+
? `${pad}{!${only}(props${keeps ? ', kept' : ''}${gave}) ? null : ${written}}`
|
|
168
|
+
: shape !== undefined && !shape.needed && from !== undefined && row === undefined
|
|
169
|
+
? `${pad}{props.${from} === undefined ? null : ${written}}`
|
|
170
|
+
: `${pad}${written}`;
|
|
171
|
+
const over = made['each'];
|
|
172
|
+
if (looped || over === undefined)
|
|
173
|
+
return one;
|
|
174
|
+
if (KINDS[carries[over] ?? '']?.is === 'number') {
|
|
175
|
+
return (`${pad}{Array.from({ length: Math.max(1, props.${over} ?? 1) }, (_, at) => (\n` +
|
|
176
|
+
`${region(place, depth + 2, rows, true).replace(`className="e-${name}-${place}"`, `key={at} className="e-${name}-${place}"`)}\n` +
|
|
177
|
+
`${pad}))}`);
|
|
178
|
+
}
|
|
179
|
+
const by = made['by'];
|
|
180
|
+
if (by === undefined) {
|
|
181
|
+
if (made['keyed'] !== 'position') {
|
|
182
|
+
throw new Error(`\`${name}\` repeats the place \`${place}\` over \`${String(over)}\` and names no field to identify a ` +
|
|
183
|
+
'row by. React matches an unkeyed list by position and keeps the previous row\'s state when it ' +
|
|
184
|
+
'reorders. Name the field with `by`, or state `keyed: \'position\'` where position IS identity.');
|
|
185
|
+
}
|
|
186
|
+
return (`${pad}{props.${over}.map((${`each${String(rows.length)}`}, at) => (\n` +
|
|
187
|
+
`${region(place, depth + 2, [...rows, `each${String(rows.length)}`], true).replace(`<${(places[place] ?? {})['tag'] ?? 'span'}`, `<${(places[place] ?? {})['tag'] ?? 'span'} key={at}`)}\n` +
|
|
188
|
+
`${pad}))}`);
|
|
189
|
+
}
|
|
190
|
+
return (`${pad}<Each rows={${carries[over] === undefined ? `${over}(props${keeps ? ', kept' : ''})` : `props.${over}`}} by={${carries[by] === undefined ? `'${by}'` : `props.${by}`}}>\n` +
|
|
191
|
+
`${pad} {(${`each${String(rows.length)}`}, at) => (\n${region(place, depth + 2, [...rows, `each${String(rows.length)}`], true)}\n${pad} )}\n` +
|
|
192
|
+
`${pad}</Each>`);
|
|
193
|
+
};
|
|
194
|
+
const repeats = Object.values(places).some((made) => {
|
|
195
|
+
const over = made?.['each'];
|
|
196
|
+
return over !== undefined && KINDS[carries[over] ?? '']?.is !== 'number' && made['keyed'] !== 'position';
|
|
197
|
+
});
|
|
198
|
+
const worked = Object.entries(places).some(([, made]) => {
|
|
199
|
+
const from = made?.['shows'];
|
|
200
|
+
return from !== undefined && carries[from] === undefined;
|
|
201
|
+
});
|
|
202
|
+
const answers = (reads !== undefined && READS[reads]?.answers !== undefined) || Object.values(places).some((made) => {
|
|
203
|
+
const said = made?.['reads'];
|
|
204
|
+
return said !== undefined && READS[said]?.answers !== undefined;
|
|
205
|
+
});
|
|
206
|
+
const inside = Object.keys(places)
|
|
207
|
+
.filter((place) => !nested.has(place))
|
|
208
|
+
.map((place) => region(place, 0))
|
|
209
|
+
.join('\n');
|
|
210
|
+
const roles = stated.find(([, kind]) => KINDS[kind]?.from === 'fonts');
|
|
211
|
+
const roled = roles !== undefined
|
|
212
|
+
? `: roleClass(props.${roles[0]}, className)`
|
|
213
|
+
: arranges
|
|
214
|
+
? ''
|
|
215
|
+
: ': roleClass(undefined, className)';
|
|
216
|
+
const measured = measures.length === 0 || wires !== undefined ? '' : ' style={surface.measures}';
|
|
217
|
+
const meant = reads === undefined ? undefined : READS[reads];
|
|
218
|
+
const wired = meant === undefined
|
|
219
|
+
? ''
|
|
220
|
+
: (meant.control ?? '') +
|
|
221
|
+
(meant.binds === undefined || carries[meant.binds] === undefined
|
|
222
|
+
? ''
|
|
223
|
+
: ` ${String(meant.state)}={props.${meant.binds} ?? ${KINDS[carries[meant.binds] ?? '']?.is === 'number' ? '0' : "''"}}`) +
|
|
224
|
+
(meant.answers ?? '');
|
|
225
|
+
const gathered = (gives ?? [])
|
|
226
|
+
.map((one) => GIVES[one] ?? '')
|
|
227
|
+
.join('');
|
|
228
|
+
const wired2 = wires === undefined ? '' : ' {...(wired.on ?? {})}';
|
|
229
|
+
const meaning = meant === undefined
|
|
230
|
+
? ''
|
|
231
|
+
: (meant.role === undefined || (meant.needs !== undefined && carries[meant.needs] === undefined)
|
|
232
|
+
? ''
|
|
233
|
+
: meant.needs === undefined || KINDS[carries[meant.needs] ?? '']?.needed === true
|
|
234
|
+
? ` role="${meant.role}"`
|
|
235
|
+
: ` {...(props.${meant.needs} === undefined ? {} : { role: '${meant.role}' as const })}`) +
|
|
236
|
+
(meant.hidden === true ? ' aria-hidden="true"' : '') +
|
|
237
|
+
(meant.orients === undefined || carries[meant.orients] === undefined
|
|
238
|
+
? ''
|
|
239
|
+
: ` aria-orientation={props.${meant.orients} === 'vertical' ? 'vertical' : 'horizontal'}`) +
|
|
240
|
+
(meant.reports === undefined || !measures.includes(meant.reports)
|
|
241
|
+
? ''
|
|
242
|
+
: ` aria-valuenow={Number(measured(props).${meant.reports})} aria-valuemin={0} aria-valuemax={100}`);
|
|
243
|
+
const opening = (one) => `<${one}${dresses === undefined ? ' className={surface.className}' : ''} {...surface.marks} {...surface.invokes} {...surface.a11y}${keeps ? ' {...(kept.on ?? {})}' : ''}${meaning}${titled}${announcing}${wired}${wired2}${gathered}${measured}${sourced(one)}${naming(one)}${EXTRA[one] ?? ''}${source === undefined ? '' : (FETCHES[one] ?? '')}`;
|
|
244
|
+
const empty = typeof tag === 'string' && SHUT.has(tag);
|
|
245
|
+
const holds = stated.find(([, kind]) => kind === 'holding');
|
|
246
|
+
const telling = says === undefined
|
|
247
|
+
? undefined
|
|
248
|
+
: KINDS[carries[says] ?? '']?.from === 'content'
|
|
249
|
+
? `{surface.text(props.${says}${holds === undefined ? '' : `, props.${holds[0]}`})}`
|
|
250
|
+
: `{props.${says}}`;
|
|
251
|
+
const announced = stated.find(([, kind]) => kind === 'announcing');
|
|
252
|
+
const announcing = announced === undefined ? '' : ` role={props.${announced[0]}}`;
|
|
253
|
+
const content = telling !== undefined
|
|
254
|
+
? telling
|
|
255
|
+
: works !== undefined && !arranges && !empty && inside === ''
|
|
256
|
+
? `{shows(props, surface${keeps ? ', kept' : ''})}`
|
|
257
|
+
: inside === ''
|
|
258
|
+
? `{${arranges ? 'props.children' : names === undefined ? 'surface.text(props.labelKey)' : 'null'}}`
|
|
259
|
+
: arranges
|
|
260
|
+
? `{props.children}\n${inside}`
|
|
261
|
+
: undefined;
|
|
262
|
+
const spoken = (one) => SPEAKS.has(one) && names !== undefined ? `{surface.text(props.${names[0]})}` : (content ?? inside);
|
|
263
|
+
const written = (one) => SHUT.has(one)
|
|
264
|
+
? `${opening(one)} />`
|
|
265
|
+
: `${opening(one)}>\n${SPEAKS.has(one) || content !== undefined ? ` ${spoken(one)}` : inside}\n </${one}>`;
|
|
266
|
+
const shut = bare && inside !== ''
|
|
267
|
+
? `<>\n${inside}\n </>`
|
|
268
|
+
: bare
|
|
269
|
+
? `shows(props, surface${keeps ? ', kept' : ''})`
|
|
270
|
+
: chosen === undefined
|
|
271
|
+
? written(first)
|
|
272
|
+
: `(() => {\n switch (props.${String(chosen['by'])}) {\n${Object.entries(chosen)
|
|
273
|
+
.filter(([key]) => key !== 'by')
|
|
274
|
+
.map(([key, one]) => ` case '${key}':\n return (\n ${written(one).split('\n').join('\n ')}\n )`)
|
|
275
|
+
.join('\n')}\n default:\n return null\n }\n })()`;
|
|
276
|
+
const fromProps = measures.filter((one) => carries[one] !== undefined);
|
|
277
|
+
const computes = measures.filter((one) => carries[one] === undefined);
|
|
278
|
+
const passed = fromProps.map((one) => `${JSON.stringify(one)}: String(props.${one} ?? '')`).join(', ');
|
|
279
|
+
const taken = measures.length === 0 || wires !== undefined
|
|
280
|
+
? ''
|
|
281
|
+
: computes.length === 0
|
|
282
|
+
? `\n measures: { ${passed} },`
|
|
283
|
+
: fromProps.length === 0
|
|
284
|
+
? `\n measures: measured(props${keeps ? ', kept' : ''}),`
|
|
285
|
+
: `\n measures: { ...measured(props${keeps ? ', kept' : ''}), ${passed} },`;
|
|
286
|
+
const wanted = [...(arranges || empty || says !== undefined || inside !== '' ? [] : ['shows']), ...(worked ? ['shown'] : []), ...(computes.length === 0 || wires !== undefined ? [] : ['measured']), ...[...new Set(Object.values(places).flatMap((made) => [made?.['marks'], made?.['gives'], made?.['when'], (made?.['each'] !== undefined && carries[made['each'] ?? ''] === undefined) ? made['each'] : undefined]).filter((one) => one !== undefined))], ...(answers ? ['does'] : []), ...(keeps ? ['uses'] : []), ...(wires === undefined ? [] : [wires])];
|
|
287
|
+
const held = always.length === 0 && raises.length === 0 && !keeps
|
|
288
|
+
? ''
|
|
289
|
+
: `\n holds: [\n${[
|
|
290
|
+
...always.map((one) => ` '${one}' as const,`),
|
|
291
|
+
...raises.map((one) => ` ...(props.${one} === true ? ['${one}' as const] : []),`),
|
|
292
|
+
...(keeps ? [' ...(kept.holds ?? []),'] : []),
|
|
293
|
+
].join('\n')}\n ],`;
|
|
294
|
+
return `/* GENERATED by thread — do not edit. Change the row and run \`thread elements\`. */
|
|
295
|
+
'use client'
|
|
296
|
+
|
|
297
|
+
${[
|
|
298
|
+
...(arranges || stated.some(([, kind]) => KINDS[kind]?.from === 'react' || KINDS[kind]?.from === 'both')
|
|
299
|
+
? ["import type { ReactNode } from 'react'"]
|
|
300
|
+
: []),
|
|
301
|
+
...((!arranges && !silent && !bare && called === undefined) || stated.some(([, kind]) => KINDS[kind]?.from === 'content')
|
|
302
|
+
? [`import type { MessageKey } from '${from.content}'`]
|
|
303
|
+
: []),
|
|
304
|
+
...(stated.some(([, kind]) => KINDS[kind]?.from === 'rows' || KINDS[kind]?.from === 'both') ? [`import type { Row } from '${from.rows}'`] : []),
|
|
305
|
+
...(roles !== undefined
|
|
306
|
+
? [`import { roleClass, type FontRoleId } from '${from.fonts}'`]
|
|
307
|
+
: arranges
|
|
308
|
+
? []
|
|
309
|
+
: [`import { roleClass } from '${from.fonts}'`]),
|
|
310
|
+
...(stated.some(([, kind]) => KINDS[kind]?.from === 'map') ? [`import type { MapIsland } from '${from.map}'`] : []),
|
|
311
|
+
...(stated.some(([, kind]) => KINDS[kind]?.from === 'parts') ? [`import type { TabItem } from '${from.parts}'`] : []),
|
|
312
|
+
...(stated.some(([, kind]) => KINDS[kind]?.from === 'consent') ? [`import type { ConsentDecision } from '${from.consent}'`] : []),
|
|
313
|
+
...(stated.some(([, kind]) => KINDS[kind]?.from === 'drag') ? [`import type { Subject } from '${from.drag}'`] : []),
|
|
314
|
+
...worn.map((one) => `import { ${one} } from './${idOf(one)}.tsx'`),
|
|
315
|
+
...(built.length === 0 || works === undefined ? [] : [`import { ${built.join(', ')} } from '${works}'`]),
|
|
316
|
+
...(Object.values(places).some((made) => made?.['marks'] !== undefined)
|
|
317
|
+
? [`import { measured as marking } from '${from.rows}'`]
|
|
318
|
+
: []),
|
|
319
|
+
].join('\n')}
|
|
320
|
+
|
|
321
|
+
import { type Element, element, useSurface } from '${from.wrappers}'
|
|
322
|
+
${Object.values(places).some((made) => (made?.['takes'] ?? '').split(/\s+/).includes('validator')) ? `import { limited } from '${from.validators}'\n` : ''}${repeats ? `import { Each } from '../elements/each.tsx'\n` : ''}${works === undefined || wanted.length === 0 ? '' : `import { ${wanted.join(', ')} } from '${works}'\n`}
|
|
323
|
+
|
|
324
|
+
export interface ${made}Props {
|
|
325
|
+
${[...props, ...invoking].join('\n')}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export const ${made}: Element<'${made}', ${made}Props> = element(
|
|
329
|
+
'${made}',
|
|
330
|
+
(props: ${made}Props, className) => {
|
|
331
|
+
${keeps ? ' const kept = uses(props)\n' : ''} const surface = useSurface({ className${roled},\n invokes: { ...(props.dispatch === undefined ? {} : { dispatch: props.dispatch }), ...(props.input === undefined ? {} : { input: props.input }), ...(props.invokeOn === undefined ? {} : { on: props.invokeOn }) },${held}${taken}${animates ? '\n animates: true,' : ''}${keeps ? "\n ...(kept.animates === undefined ? {} : { animates: kept.animates })," : ''} })${wires === undefined ? '' : `\n const wired = ${wires}(props${keeps ? ', kept' : ''}, surface)`}
|
|
332
|
+
return (
|
|
333
|
+
${shut}
|
|
334
|
+
)
|
|
335
|
+
},
|
|
336
|
+
'${classOfElement(name)}',
|
|
337
|
+
)
|
|
338
|
+
`;
|
|
339
|
+
}
|
|
340
|
+
const KINDS = {
|
|
341
|
+
children: { is: 'ReactNode', needed: true, from: 'react' },
|
|
342
|
+
wording: { is: 'MessageKey', needed: true, from: 'content' },
|
|
343
|
+
naming: { is: 'MessageKey', needed: true, from: 'content' },
|
|
344
|
+
flag: { is: 'boolean', needed: false },
|
|
345
|
+
count: { is: 'number', needed: false },
|
|
346
|
+
words: { is: 'string', needed: false },
|
|
347
|
+
source: { is: 'string', needed: true },
|
|
348
|
+
amount: { is: 'unknown', needed: false },
|
|
349
|
+
holding: { is: 'Readonly<Record<string, unknown>>', needed: false },
|
|
350
|
+
tuning: { is: 'Readonly<Record<string, number>>', needed: false },
|
|
351
|
+
mapping: { is: 'MapIsland', needed: true, from: 'map' },
|
|
352
|
+
parting: { is: 'readonly TabItem[]', needed: true, from: 'parts' },
|
|
353
|
+
judging: { is: 'ConsentDecision', needed: false, from: 'consent' },
|
|
354
|
+
judged: { is: '(said: ConsentDecision) => void', needed: true, from: 'consent' },
|
|
355
|
+
ruling: { is: 'string', needed: true },
|
|
356
|
+
subjecting: { is: 'Subject | readonly Subject[]', needed: false, from: 'drag' },
|
|
357
|
+
announcing: { is: "'alert' | 'status'", needed: false },
|
|
358
|
+
noting: { is: 'MessageKey', needed: false, from: 'content' },
|
|
359
|
+
titling: { is: 'MessageKey', needed: false, from: 'content' },
|
|
360
|
+
picture: { is: 'string', needed: false, from: 'source' },
|
|
361
|
+
styling: { is: 'FontRoleId', needed: false, from: 'fonts' },
|
|
362
|
+
telling: { is: '(said: boolean) => void', needed: false },
|
|
363
|
+
doing: { is: '() => void', needed: false },
|
|
364
|
+
picking: { is: '(said: string) => void', needed: false },
|
|
365
|
+
moving: { is: '(said: number) => void', needed: false },
|
|
366
|
+
choosing: { is: '(said: readonly string[]) => void', needed: false },
|
|
367
|
+
listing: { is: 'readonly Row[]', needed: true, from: 'rows' },
|
|
368
|
+
ordering: { is: 'readonly string[]', needed: true },
|
|
369
|
+
anything: { is: 'readonly object[]', needed: true },
|
|
370
|
+
drawing: { is: '(row: Row, at: number) => ReactNode', needed: true, from: 'both' },
|
|
371
|
+
};
|
|
372
|
+
const SOURCES = (kind) => kind === 'source';
|
|
373
|
+
const NAMES = (kind) => kind === 'naming' || kind === 'titling';
|
|
374
|
+
const SHUT = new Set(['img', 'hr', 'input', 'br', 'area', 'col', 'embed', 'source', 'track', 'wbr']);
|
|
375
|
+
const SOURCE = { a: 'href' };
|
|
376
|
+
const EXTRA = {
|
|
377
|
+
video: ' controls preload="metadata"',
|
|
378
|
+
audio: ' controls preload="metadata"',
|
|
379
|
+
};
|
|
380
|
+
const FETCHES = { a: ' download' };
|
|
381
|
+
const SPEAKS = new Set(['a']);
|
|
382
|
+
const IDENTIFIES = { option: 'value' };
|
|
383
|
+
const GIVES = {
|
|
384
|
+
name: ' name={props.name}',
|
|
385
|
+
rows: ' rows={props.rows ?? 4}',
|
|
386
|
+
validator: ' {...limited(props.validator)}',
|
|
387
|
+
min: ' min={props.min}',
|
|
388
|
+
max: ' max={props.max}',
|
|
389
|
+
step: ' step={props.step ?? 1}',
|
|
390
|
+
};
|
|
391
|
+
const READS = {
|
|
392
|
+
choice: {
|
|
393
|
+
control: ' type="checkbox" disabled={surface.marked(\'disabled\')}',
|
|
394
|
+
state: 'checked',
|
|
395
|
+
answers: ' onChange={(event) => does(props).changed(event.target.checked)}',
|
|
396
|
+
},
|
|
397
|
+
writing: {
|
|
398
|
+
control: " disabled={surface.marked('disabled')}",
|
|
399
|
+
state: 'value',
|
|
400
|
+
answers: ' onChange={(event) => does(props).wrote(event.target.value)}',
|
|
401
|
+
},
|
|
402
|
+
sliding: {
|
|
403
|
+
control: " type=\"range\" disabled={surface.marked('disabled')}",
|
|
404
|
+
state: 'value',
|
|
405
|
+
binds: 'value',
|
|
406
|
+
answers: ' onChange={(event) => does(props).moved(Number(event.target.value))}',
|
|
407
|
+
},
|
|
408
|
+
choosing: {
|
|
409
|
+
control: " type=\"radio\" disabled={surface.marked('disabled')}",
|
|
410
|
+
},
|
|
411
|
+
choices: { role: 'radiogroup', needs: 'labelKey' },
|
|
412
|
+
chooser: {
|
|
413
|
+
control: " disabled={surface.marked('disabled')}",
|
|
414
|
+
state: 'value',
|
|
415
|
+
answers: ' onChange={(event) => does(props).chose(event.target.value)}',
|
|
416
|
+
},
|
|
417
|
+
progress: { role: 'progressbar', reports: 'fraction' },
|
|
418
|
+
picture: { role: 'img' },
|
|
419
|
+
divider: { role: 'separator', orients: 'orientation' },
|
|
420
|
+
grouping: { role: 'group', needs: 'labelKey' },
|
|
421
|
+
placeholder: { hidden: true },
|
|
422
|
+
notice: { role: 'status' },
|
|
423
|
+
alarm: { role: 'alert' },
|
|
424
|
+
};
|
|
425
|
+
export const CARRIES = Object.keys(KINDS);
|
|
426
|
+
export const READINGS = Object.keys(READS);
|
|
427
|
+
const UI = packageOf('ui');
|
|
428
|
+
export const APP = { wrappers: `${UI}/wrappers`, content: `${UI}/content`, rows: `${UI}/charts`, validators: `${UI}/validators`, fonts: `${UI}/fonts`, map: `${UI}/islands/map`, parts: `${UI}/disclosure`, consent: `${UI}/consent`, drag: `${UI}/drag` };
|
|
429
|
+
const OWN = { wrappers: '../wrappers.tsx', content: '../content.tsx', rows: '../charts.tsx', validators: '../validators.ts', fonts: '../fonts.ts', map: '../islands/map.ts', parts: '../disclosure.tsx', consent: '../consent.ts', drag: '../drag.ts' };
|
|
430
|
+
export const declared = new Set();
|
|
431
|
+
const SHEET = `elements.${'ts'}`;
|
|
432
|
+
const BY = 'thread elements';
|
|
433
|
+
const INSTALLED = 'node_' + 'modules/';
|
|
434
|
+
function derived(row, own) {
|
|
435
|
+
if ((row.derives ?? []).some((one) => one.by === BY && one.at === row.at))
|
|
436
|
+
return true;
|
|
437
|
+
return !own && typeof row.at === 'string' && !row.at.startsWith(INSTALLED);
|
|
438
|
+
}
|
|
439
|
+
async function run() {
|
|
440
|
+
const own = argv.includes('--own');
|
|
441
|
+
const held = own
|
|
442
|
+
? (await import(__rewriteRelativeImportExtension(pathToFileURL(resolve(fileURLToPath(import.meta.url), '../../elements.ts')).href)))
|
|
443
|
+
: undefined;
|
|
444
|
+
const tree = own ? undefined : findTree();
|
|
445
|
+
const sheet = tree === undefined
|
|
446
|
+
? { ELEMENT: held?.ELEMENTS }
|
|
447
|
+
: (await import(__rewriteRelativeImportExtension(pathToFileURL(inTree(tree, SHEET)).href)));
|
|
448
|
+
if (sheet.ELEMENT === undefined) {
|
|
449
|
+
stdout.write(own
|
|
450
|
+
? 'elements: packages/ui/src/elements.ts exports no `ELEMENTS`.\n'
|
|
451
|
+
: `thread: ${String(tree?.name)}/${SHEET} exports no \`ELEMENT\`, so nothing declares an element here.\n`);
|
|
452
|
+
return 1;
|
|
453
|
+
}
|
|
454
|
+
const root = own ? resolve(fileURLToPath(import.meta.url), '../../../../..') : (tree?.at ?? '');
|
|
455
|
+
const from = own ? OWN : APP;
|
|
456
|
+
for (const one of sheet.ELEMENT.declares ?? [])
|
|
457
|
+
declared.add(one.id);
|
|
458
|
+
const rows = (sheet.ELEMENT.declares ?? []).filter((row) => derived(row, own));
|
|
459
|
+
const checking = argv.includes('--check');
|
|
460
|
+
for (const row of rows) {
|
|
461
|
+
if (row.at === undefined) {
|
|
462
|
+
stdout.write(`elements: \`${row.id}\` derives a file and names none, so nothing can be written for it.\n`);
|
|
463
|
+
return 1;
|
|
464
|
+
}
|
|
465
|
+
if (row.tag === undefined && row.works !== undefined) {
|
|
466
|
+
const made = translated(row.id, '', row.arranges === true, row.raises ?? [], from, row.carries, row.always, row.places, row.works, row.measures, row.reads, row.gives, row.keeps === true, row.animates === true, row.shows, row.called, row.wires, row.dresses);
|
|
467
|
+
const at = join(root, row.at);
|
|
468
|
+
if (!checking) {
|
|
469
|
+
writeFileSync(at, made, 'utf8');
|
|
470
|
+
stdout.write(`elements: wrote ${row.at}\n`);
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
if (!existsSync(at) || readFileSync(at, 'utf8') !== made) {
|
|
474
|
+
stdout.write(`elements: ${row.at} is not what the row produces. A derived file that differs from its ` +
|
|
475
|
+
'generator is a hand edit wearing a generated name. Run `thread elements` and commit what it writes.\n');
|
|
476
|
+
return 1;
|
|
477
|
+
}
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
if (row.tag === undefined) {
|
|
481
|
+
stdout.write(`elements: \`${row.id}\` is written by \`${BY}\` and states no tag, and a tag is what this ` +
|
|
482
|
+
'writes the element out of. State one on the row, or take the `derives` off and keep the file.\n');
|
|
483
|
+
return 1;
|
|
484
|
+
}
|
|
485
|
+
if (row.reads !== undefined && READS[row.reads] === undefined) {
|
|
486
|
+
stdout.write(`elements: \`${row.id}\` says it reads as \`${String(row.reads)}\`, and that is not something an ` +
|
|
487
|
+
`element reads as. It reads as one of: ${Object.keys(READS).join(' · ')}.\n`);
|
|
488
|
+
return 1;
|
|
489
|
+
}
|
|
490
|
+
const unknown = Object.entries(row.carries ?? {}).find(([, kind]) => KINDS[kind] === undefined);
|
|
491
|
+
if (unknown !== undefined) {
|
|
492
|
+
stdout.write(`elements: \`${row.id}\` says it carries \`${unknown[0]}\` as a \`${unknown[1]}\`, and that is ` +
|
|
493
|
+
`not a kind an element carries. It carries one of: ${Object.keys(KINDS).join(' · ')}.\n`);
|
|
494
|
+
return 1;
|
|
495
|
+
}
|
|
496
|
+
const text = translated(row.id, row.tag, row.arranges === true, row.raises ?? [], from, row.carries, row.always, row.places, row.works, row.measures, row.reads, row.gives, row.keeps === true, row.animates === true, row.shows, row.called, row.wires, row.dresses);
|
|
497
|
+
const where = join(root, row.at);
|
|
498
|
+
if (!checking) {
|
|
499
|
+
writeFileSync(where, text, 'utf8');
|
|
500
|
+
stdout.write(`elements: wrote ${row.at}\n`);
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
if (!existsSync(where)) {
|
|
504
|
+
stdout.write(`elements: \`${row.id}\` is declared at \`${row.at}\`, and the file is not there. ` +
|
|
505
|
+
'A row names a file and `--check` never writes one — run `thread elements` and commit what it writes.\n');
|
|
506
|
+
return 1;
|
|
507
|
+
}
|
|
508
|
+
if (readFileSync(where, 'utf8') !== text) {
|
|
509
|
+
stdout.write(`elements: ${row.at} is not what the row produces. A derived file that differs from its ` +
|
|
510
|
+
'generator is a hand edit wearing a generated name. Run `thread elements` and commit what it writes.\n');
|
|
511
|
+
return 1;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
stdout.write(checking
|
|
515
|
+
? `thread: ${String(rows.length)} element(s) written from their rows, all agreeing\n`
|
|
516
|
+
: `thread: wrote ${String(rows.length)} element(s) from their rows\n`);
|
|
517
|
+
return 0;
|
|
518
|
+
}
|
|
519
|
+
if (invoked(import.meta.url))
|
|
520
|
+
exit(await run());
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function walk(at: string, found?: string[], skip?: ReadonlySet<string>): readonly string[];
|
|
2
|
+
export declare function keyProps(at: string): readonly string[];
|
|
3
|
+
export declare function keysIn(text: string, props: readonly string[]): readonly string[];
|
|
4
|
+
export declare function readWording(at: string, language: string): Readonly<Record<string, string>>;
|
|
5
|
+
export declare function wordingFile(held: Readonly<Record<string, string>>): string;
|