@perspective-dev/viewer 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/perspective-viewer.js +8 -8
- package/dist/cdn/perspective-viewer.js.map +3 -3
- package/dist/css/blueprint.css +1 -0
- package/dist/css/botanical.css +1 -1
- package/dist/css/dracula.css +1 -1
- package/dist/css/eggplant.css +1 -0
- package/dist/css/gruvbox-dark.css +1 -1
- package/dist/css/gruvbox.css +1 -1
- package/dist/css/icons.css +1 -1
- package/dist/css/intl/ar.css +1 -0
- package/dist/css/intl/de.css +1 -1
- package/dist/css/intl/es.css +1 -1
- package/dist/css/intl/fr.css +1 -1
- package/dist/css/intl/ja.css +1 -1
- package/dist/css/intl/pt.css +1 -1
- package/dist/css/intl/zh.css +1 -1
- package/dist/css/intl.css +1 -1
- package/dist/css/ledger.css +1 -0
- package/dist/css/monokai.css +1 -1
- package/dist/css/nord.css +1 -0
- package/dist/css/phosphor.css +1 -1
- package/dist/css/pro-dark.css +1 -1
- package/dist/css/pro.css +1 -1
- package/dist/css/solarized-dark.css +1 -1
- package/dist/css/solarized.css +1 -1
- package/dist/css/themes.css +1 -1
- package/dist/css/vaporwave.css +1 -1
- package/dist/css/velvet.css +1 -0
- package/dist/docs/perspective-docs.json +1 -1
- package/dist/esm/column-format.d.ts +16 -3
- package/dist/esm/extensions.d.ts +0 -5
- package/dist/esm/perspective-viewer.inline.js +7 -7
- package/dist/esm/perspective-viewer.inline.js.map +3 -3
- package/dist/esm/perspective-viewer.js +8 -8
- package/dist/esm/perspective-viewer.js.map +3 -3
- package/dist/esm/ts-rs/ViewOnUpdateResp.d.ts +1 -1
- package/dist/wasm/perspective-viewer.d.ts +62 -73
- package/dist/wasm/perspective-viewer.js +230 -238
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +18 -28
- package/package.json +7 -7
- package/src/css/_context_menu.css +1 -1
- package/src/css/_dropdown_menu.css +1 -1
- package/src/css/_viewer_bundle.css +7 -8
- package/src/css/column-dropdown.css +0 -3
- package/src/css/column-selector.css +8 -5
- package/src/css/column-settings-panel.css +0 -206
- package/src/css/column-style.css +95 -0
- package/src/css/config-selector.css +18 -10
- package/src/css/filter-dropdown.css +5 -5
- package/src/css/form/debug.css +28 -4
- package/src/css/function-dropdown.css +5 -5
- package/src/css/panel-tab.css +23 -0
- package/src/css/plugin-selector.css +6 -5
- package/src/css/render-warning.css +1 -1
- package/src/css/status-bar.css +52 -21
- package/src/css/type-icon.css +1 -3
- package/src/css/{containers → ui/containers}/context-menu.css +22 -16
- package/src/css/ui/containers/dropdown-menu-items.css +66 -0
- package/src/css/{containers → ui/containers}/dropdown-menu.css +8 -53
- package/src/css/{containers → ui/containers}/tabs.css +13 -3
- package/src/css/{dom → ui/dom}/select.css +19 -8
- package/src/css/viewer.css +32 -31
- package/src/rust/agent/tools.rs +5 -2
- package/src/rust/components/chat_panel.rs +1 -1
- package/src/rust/components/{form/code_editor.rs → code_editor.rs} +4 -2
- package/src/rust/components/column_dropdown.rs +2 -2
- package/src/rust/components/column_selector/active_column.rs +15 -9
- package/src/rust/components/column_selector/aggregate_selector.rs +1 -1
- package/src/rust/components/column_selector/config_selector.rs +2 -2
- package/src/rust/components/column_selector/filter_column.rs +8 -5
- package/src/rust/components/column_selector/inactive_column.rs +4 -2
- package/src/rust/components/column_selector/pivot_column.rs +4 -3
- package/src/rust/components/column_selector/sort_column.rs +7 -4
- package/src/rust/components/column_selector.rs +3 -3
- package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +1 -1
- package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +15 -17
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_selector.rs +1 -1
- package/src/rust/components/column_settings_sidebar/style_tab.rs +296 -238
- package/src/rust/components/column_settings_sidebar.rs +3 -4
- package/src/rust/components/copy_dropdown.rs +1 -1
- package/src/rust/components/datetime_column_style/custom.rs +1 -3
- package/src/rust/components/datetime_column_style/simple.rs +16 -6
- package/src/rust/components/datetime_column_style.rs +51 -12
- package/src/rust/components/{form/debug.rs → debug_panel.rs} +5 -5
- package/src/rust/components/{containers/dragdrop_list.rs → dragdrop_list.rs} +2 -10
- package/src/rust/components/export_dropdown.rs +1 -1
- package/src/rust/components/expression_editor.rs +1 -1
- package/src/rust/components/filter_dropdown.rs +2 -2
- package/src/rust/components/function_dropdown.rs +2 -2
- package/src/rust/components/main_panel/frame_theme.rs +3 -59
- package/src/rust/components/main_panel/reconcile.rs +9 -4
- package/src/rust/components/main_panel/render.rs +62 -11
- package/src/rust/components/main_panel/update.rs +39 -10
- package/src/rust/components/main_panel.rs +26 -2
- package/src/rust/components/mod.rs +5 -7
- package/src/rust/components/new_panel_menu.rs +97 -0
- package/src/rust/components/number_series_style.rs +2 -3
- package/src/rust/components/panel_menu.rs +61 -87
- package/src/rust/components/panel_tab.rs +100 -43
- package/src/rust/components/plugin_tab.rs +125 -87
- package/src/rust/components/render_warning.rs +2 -2
- package/src/rust/components/{status_bar_counter.rs → rows_counter.rs} +10 -10
- package/src/rust/components/settings_panel.rs +3 -2
- package/src/rust/components/status_bar.rs +113 -20
- package/src/rust/components/status_indicator.rs +5 -14
- package/src/rust/components/string_column_style.rs +1 -2
- package/src/rust/components/{style/mod.rs → style.rs} +32 -15
- package/src/rust/components/style_controls/number_string_format/digits_section.rs +25 -15
- package/src/rust/components/style_controls/number_string_format/misc_section.rs +7 -3
- package/src/rust/components/style_controls/number_string_format/style_section.rs +2 -1
- package/src/rust/components/style_controls/number_string_format/types.rs +24 -0
- package/src/rust/components/style_controls/number_string_format.rs +37 -14
- package/src/rust/components/viewer/msg.rs +43 -30
- package/src/rust/components/viewer/panels.rs +50 -19
- package/src/rust/components/viewer/render.rs +15 -13
- package/src/rust/components/viewer/settings.rs +137 -68
- package/src/rust/components/viewer/snapshots.rs +5 -10
- package/src/rust/components/viewer/wiring.rs +1 -21
- package/src/rust/components/viewer.rs +15 -10
- package/src/rust/components/window_editor.rs +8 -9
- package/src/rust/config/column_config_schema.rs +358 -52
- package/src/rust/config/datetime_column_style.rs +4 -21
- package/src/rust/config/mod.rs +0 -2
- package/src/rust/config/number_string_format.rs +211 -18
- package/src/rust/config/workspace_config.rs +2 -1
- package/src/rust/custom_elements/debug_plugin.rs +1 -10
- package/src/rust/custom_elements/mod.rs +0 -3
- package/src/rust/custom_elements/viewer.rs +0 -18
- package/src/rust/js/plugin.rs +0 -86
- package/src/rust/lib.rs +12 -15
- package/src/rust/presentation/column_locator.rs +3 -7
- package/src/rust/presentation.rs +85 -38
- package/src/rust/queries/hosted_tables.rs +38 -0
- package/src/rust/queries/mod.rs +2 -0
- package/src/rust/queries/palette_set.rs +1 -1
- package/src/rust/queries/plugin_column_styles.rs +2 -2
- package/src/rust/renderer/activate.rs +1 -3
- package/src/rust/renderer/dispatch.rs +117 -30
- package/src/rust/renderer/limits.rs +24 -5
- package/src/rust/renderer/plugin_config.rs +56 -8
- package/src/rust/renderer/props.rs +2 -1
- package/src/rust/renderer.rs +14 -27
- package/src/rust/session/props.rs +4 -3
- package/src/rust/session/view_subscription.rs +19 -6
- package/src/rust/session.rs +38 -70
- package/src/rust/tasks/create_panel.rs +1 -1
- package/src/rust/tasks/dismiss_render_warning.rs +1 -1
- package/src/rust/tasks/eject.rs +1 -0
- package/src/rust/tasks/pipeline.rs +0 -60
- package/src/rust/tasks/presize_panels.rs +24 -1
- package/src/rust/tasks/restore_and_render.rs +0 -17
- package/src/rust/tasks/send_column_config.rs +1 -1
- package/src/rust/tasks/send_plugin_config.rs +1 -1
- package/src/rust/tasks/set_edit_mode.rs +1 -1
- package/src/rust/ui/containers/control_group.rs +113 -0
- package/src/rust/{components → ui}/containers/dropdown_menu.rs +5 -2
- package/src/rust/{components → ui}/containers/mod.rs +1 -4
- package/src/rust/{components → ui}/containers/scroll_panel.rs +0 -22
- package/src/rust/{components → ui}/containers/scroll_panel_item.rs +0 -13
- package/src/rust/{components → ui}/containers/select.rs +8 -8
- package/src/rust/{components → ui}/containers/sidebar.rs +5 -32
- package/src/rust/{components → ui}/containers/split_panel.rs +8 -80
- package/src/rust/{components → ui}/containers/tab_list.rs +15 -9
- package/src/rust/{components → ui}/context_menu.rs +8 -13
- package/src/rust/{presentation/drag_helpers.rs → ui/dragdrop.rs} +26 -31
- package/src/rust/{components → ui}/font_loader.rs +0 -26
- package/src/rust/{components → ui}/form/color_selector.rs +4 -2
- package/src/rust/ui/form/intl_label.rs +81 -0
- package/src/rust/{components → ui}/form/mirrored_textarea.rs +0 -53
- package/src/rust/{components → ui}/form/mod.rs +1 -10
- package/src/rust/{components → ui}/form/multi_stop_gradient_selector.rs +4 -5
- package/src/rust/{components → ui}/form/named_value_picker.rs +1 -6
- package/src/rust/{components → ui}/form/number_field.rs +1 -1
- package/src/rust/{components → ui}/form/number_range_field.rs +1 -1
- package/src/rust/{components → ui}/form/optional_field.rs +3 -1
- package/src/rust/{components → ui}/form/palette_selector.rs +4 -5
- package/src/rust/{components → ui}/form/select_enum_field.rs +2 -2
- package/src/rust/{components → ui}/form/select_value_field.rs +2 -2
- package/src/rust/ui/mod.rs +56 -0
- package/src/rust/ui/modal.rs +61 -0
- package/src/rust/{components → ui}/portal.rs +174 -79
- package/src/rust/{components/style/style_provider.rs → ui/style.rs} +4 -34
- package/src/rust/utils/completion.rs +0 -6
- package/src/rust/{config/css_scale.rs → utils/css.rs} +38 -35
- package/src/rust/utils/mod.rs +2 -0
- package/src/rust/workspace.rs +35 -0
- package/src/svg/boolean-type.svg +3 -2
- package/src/svg/checkbox-checked-icon.svg +4 -7
- package/src/svg/checkbox-hover.svg +3 -3
- package/src/svg/checkbox-off.svg +2 -3
- package/src/svg/checkbox-on.svg +3 -3
- package/src/svg/checkbox-unchecked-icon.svg +3 -3
- package/src/svg/datagrid-select-column.svg +8 -15
- package/src/svg/datagrid-select-region.svg +8 -15
- package/src/svg/datagrid-select-row-tree.svg +7 -12
- package/src/svg/datagrid-select-row.svg +8 -13
- package/src/svg/date-type.svg +4 -23
- package/src/svg/drawer-tab-hover.svg +4 -6
- package/src/svg/drawer-tab-invert-hover.svg +5 -5
- package/src/svg/drawer-tab-invert.svg +3 -5
- package/src/svg/drawer-tab.svg +5 -5
- package/src/svg/mega-menu-icons-candlestick.svg +5 -37
- package/src/svg/mega-menu-icons-ohlc.svg +4 -39
- package/src/svg/mega-menu-icons-sunburst.svg +4 -38
- package/src/svg/mega-menu-icons-treemap.svg +3 -43
- package/src/svg/mega-menu-icons-y-scatter.svg +12 -72
- package/src/svg/new-panel-icon.svg +4 -0
- package/src/svg/number-type.svg +3 -3
- package/src/svg/radio-hover.svg +3 -3
- package/src/svg/radio-off.svg +3 -3
- package/src/svg/radio-on.svg +3 -3
- package/src/svg/status_ok.svg +3 -26
- package/src/svg/string-type.svg +4 -8
- package/src/svg/theme-icon.svg +5 -5
- package/src/themes/blueprint.css +133 -0
- package/src/themes/botanical.css +3 -52
- package/src/themes/defaults.css +3 -144
- package/src/themes/dracula.css +1 -71
- package/src/themes/eggplant.css +131 -0
- package/src/themes/gruvbox-dark.css +2 -79
- package/src/themes/gruvbox.css +2 -40
- package/src/themes/icons.css +2 -10
- package/src/themes/intl/ar.css +185 -0
- package/src/themes/intl/de.css +65 -33
- package/src/themes/intl/es.css +60 -28
- package/src/themes/intl/fr.css +60 -28
- package/src/themes/intl/ja.css +62 -30
- package/src/themes/intl/pt.css +58 -26
- package/src/themes/intl/zh.css +68 -36
- package/src/themes/intl.css +42 -7
- package/src/themes/ledger.css +137 -0
- package/src/themes/monokai.css +1 -64
- package/src/themes/nord.css +131 -0
- package/src/themes/phosphor.css +1 -61
- package/src/themes/pro-dark.css +1 -52
- package/src/themes/pro.css +98 -0
- package/src/themes/solarized-dark.css +1 -46
- package/src/themes/solarized.css +1 -24
- package/src/themes/themes.css +10 -5
- package/src/themes/vaporwave.css +1 -57
- package/src/themes/velvet.css +132 -0
- package/src/ts/column-format.ts +52 -2
- package/src/ts/extensions.ts +0 -13
- package/src/ts/ts-rs/ViewOnUpdateResp.ts +1 -1
- package/src/css/plugin-settings-panel.css +0 -99
- package/src/rust/components/modal.rs +0 -177
- package/src/rust/custom_elements/copy_dropdown.rs +0 -219
- package/src/rust/custom_elements/export_dropdown.rs +0 -216
- package/src/rust/custom_elements/modal.rs +0 -299
- package/src/svg/dropdown-selector-light.svg +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline5.js +0 -0
- /package/src/css/{containers → ui/containers}/scroll-panel.css +0 -0
- /package/src/css/{containers → ui/containers}/split-panel.css +0 -0
- /package/src/css/{dom → ui/dom}/checkbox.css +0 -0
- /package/src/css/{dom → ui/dom}/scrollbar.css +0 -0
- /package/src/css/{form → ui/form}/mirrored-textarea.css +0 -0
- /package/src/rust/components/{form → code_editor}/highlight.rs +0 -0
- /package/src/rust/{components → ui}/containers/sidebar_close_button.rs +0 -0
- /package/src/rust/{components → ui}/form/number_input.rs +0 -0
|
@@ -10,31 +10,6 @@
|
|
|
10
10
|
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
|
-
//! A `<textarea>` whose box is sized by its own text.
|
|
14
|
-
//!
|
|
15
|
-
//! A textarea cannot grow with its content — it scrolls at whatever height
|
|
16
|
-
//! it was given. The technique here, shared by [`CodeEditor`] and the chat
|
|
17
|
-
//! prompt, is to make the textarea a purely functional layer: it takes the
|
|
18
|
-
//! keystrokes, the selection and the caret, but paints no glyphs
|
|
19
|
-
//! (`color: transparent`). Underneath sits a `<pre>` mirror of the same
|
|
20
|
-
//! characters which IS painted and IS in flow, so the ordinary layout
|
|
21
|
-
//! engine sizes the box.
|
|
22
|
-
//!
|
|
23
|
-
//! This is deliberately not a JS measure-and-resize loop
|
|
24
|
-
//! (`scrollHeight` → inline `height`): that re-measures on a reflow it
|
|
25
|
-
//! just forced, drifts whenever font-size or the loaded font changes
|
|
26
|
-
//! without an `input` event to re-trigger it, and jitters at fractional
|
|
27
|
-
//! line heights. Here the two layers share their text metrics, so growth
|
|
28
|
-
//! is exact by construction and free at runtime.
|
|
29
|
-
//!
|
|
30
|
-
//! Consumers decide the AXES: the mirror's `white-space` governs growth,
|
|
31
|
-
//! so `pre-wrap` grows only downward (the chat prompt) while `pre` also
|
|
32
|
-
//! grows sideways (the expression editor). They also own the box —
|
|
33
|
-
//! padding, borders, min/max size — with `mirrored-textarea.css` fixing
|
|
34
|
-
//! only what MUST agree between the two layers.
|
|
35
|
-
//!
|
|
36
|
-
//! [`CodeEditor`]: super::code_editor::CodeEditor
|
|
37
|
-
|
|
38
13
|
use yew::html::IntoPropValue;
|
|
39
14
|
use yew::prelude::*;
|
|
40
15
|
|
|
@@ -55,20 +30,13 @@ impl IntoPropValue<Mirror> for Html {
|
|
|
55
30
|
|
|
56
31
|
#[derive(Properties, PartialEq)]
|
|
57
32
|
pub struct MirroredTextareaProps {
|
|
58
|
-
/// `id` of the `<textarea>` itself — consumer CSS and tests key on it.
|
|
59
33
|
pub id: AttrValue,
|
|
60
34
|
|
|
61
|
-
/// The mirror's content: the same characters the textarea holds,
|
|
62
|
-
/// as plain text, or marked up (`CodeEditor` passes highlighted
|
|
63
|
-
/// spans). A stale mirror means a caret that drifts from the glyphs,
|
|
64
|
-
/// so this is re-rendered unconditionally — see [`Mirror`].
|
|
65
35
|
pub mirror: Mirror,
|
|
66
36
|
|
|
67
|
-
/// `id` of the mirror `<pre>`, for consumers that style it directly.
|
|
68
37
|
#[prop_or_default]
|
|
69
38
|
pub mirror_id: Option<AttrValue>,
|
|
70
39
|
|
|
71
|
-
/// Extra classes for the positioned container.
|
|
72
40
|
#[prop_or_default]
|
|
73
41
|
pub class: Classes,
|
|
74
42
|
|
|
@@ -78,19 +46,9 @@ pub struct MirroredTextareaProps {
|
|
|
78
46
|
#[prop_or_default]
|
|
79
47
|
pub mirror_ref: NodeRef,
|
|
80
48
|
|
|
81
|
-
/// The `placeholder` ATTRIBUTE, which exists for assistive tech: it
|
|
82
|
-
/// is painted transparent, because a CSS-`content` label cannot be
|
|
83
|
-
/// written into an attribute and so cannot be localized. The text a
|
|
84
|
-
/// sighted user reads comes from the mirror instead — see
|
|
85
|
-
/// [`Self::is_empty`].
|
|
86
49
|
#[prop_or_default]
|
|
87
50
|
pub placeholder: AttrValue,
|
|
88
51
|
|
|
89
|
-
/// Whether [`Self::mirror`] is empty, which the component cannot see
|
|
90
|
-
/// for itself (the mirror is opaque `Html`). Tags the mirror with
|
|
91
|
-
/// `is-empty` so a consumer's stylesheet can supply placeholder text
|
|
92
|
-
/// through `content`, and therefore through the intl label
|
|
93
|
-
/// mechanism, rather than through the untranslatable attribute.
|
|
94
52
|
#[prop_or_default]
|
|
95
53
|
pub is_empty: bool,
|
|
96
54
|
|
|
@@ -106,8 +64,6 @@ pub struct MirroredTextareaProps {
|
|
|
106
64
|
#[prop_or_default]
|
|
107
65
|
pub onscroll: Callback<Event>,
|
|
108
66
|
|
|
109
|
-
/// Extra nodes inside the positioned container, e.g. `CodeEditor`'s
|
|
110
|
-
/// minimum-height sizer.
|
|
111
67
|
#[prop_or_default]
|
|
112
68
|
pub children: Children,
|
|
113
69
|
}
|
|
@@ -116,11 +72,6 @@ pub struct MirroredTextareaProps {
|
|
|
116
72
|
pub fn MirroredTextarea(props: &MirroredTextareaProps) -> Html {
|
|
117
73
|
html! {
|
|
118
74
|
<div class={classes!("mirrored-textarea", props.class.clone())}>
|
|
119
|
-
// `scrollable` is the viewer's webkit scrollbar styling: the
|
|
120
|
-
// input layer scrolls wherever a consumer lets it (the
|
|
121
|
-
// expression editor syncs its `scrollTop` to the mirror and
|
|
122
|
-
// line numbers), and is inert where it does not (the chat
|
|
123
|
-
// prompt, whose wrapper scrolls instead).
|
|
124
75
|
<textarea
|
|
125
76
|
id={props.id.clone()}
|
|
126
77
|
ref={props.textarea_ref.clone()}
|
|
@@ -142,10 +93,6 @@ pub fn MirroredTextarea(props: &MirroredTextareaProps) -> Html {
|
|
|
142
93
|
)}
|
|
143
94
|
>
|
|
144
95
|
{ props.mirror.0.clone() }
|
|
145
|
-
// A trailing newline opens a line box in the textarea but
|
|
146
|
-
// not in the `<pre>` (which has no caret to place there),
|
|
147
|
-
// so the mirror would come up one line short exactly when
|
|
148
|
-
// the text is about to overflow. The space forces it.
|
|
149
96
|
{ " " }
|
|
150
97
|
</pre>
|
|
151
98
|
</div>
|
|
@@ -10,15 +10,8 @@
|
|
|
10
10
|
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
|
-
//! A module for form controls (though form controls like `<Select>` which are
|
|
14
|
-
//! also container elements should go in the `containers` module).
|
|
15
|
-
//!
|
|
16
|
-
//! Components in this module should not be imported from the `components`
|
|
17
|
-
//! parent module directly.
|
|
18
|
-
|
|
19
|
-
pub mod code_editor;
|
|
20
13
|
pub mod color_selector;
|
|
21
|
-
pub mod
|
|
14
|
+
pub mod intl_label;
|
|
22
15
|
pub mod mirrored_textarea;
|
|
23
16
|
pub mod multi_stop_gradient_selector;
|
|
24
17
|
pub mod named_value_picker;
|
|
@@ -29,5 +22,3 @@ pub mod optional_field;
|
|
|
29
22
|
pub mod palette_selector;
|
|
30
23
|
pub mod select_enum_field;
|
|
31
24
|
pub mod select_value_field;
|
|
32
|
-
|
|
33
|
-
mod highlight;
|
|
@@ -15,10 +15,9 @@ use wasm_bindgen::JsCast;
|
|
|
15
15
|
use web_sys::*;
|
|
16
16
|
use yew::prelude::*;
|
|
17
17
|
|
|
18
|
-
use crate::
|
|
18
|
+
use crate::ui::form::intl_label::IntlLabel;
|
|
19
|
+
use crate::utils::{GradientStopSpec, canonicalize_gradient_stops};
|
|
19
20
|
|
|
20
|
-
/// The widget for [`crate::config::ControlSpec::GradientStops`]: a
|
|
21
|
-
/// horizontal gradient preview bar with one handle per stop.
|
|
22
21
|
#[derive(Properties, PartialEq)]
|
|
23
22
|
pub struct MultiStopGradientProps {
|
|
24
23
|
pub stops: Vec<GradientStopSpec>,
|
|
@@ -30,7 +29,7 @@ pub struct MultiStopGradientProps {
|
|
|
30
29
|
pub discrete: bool,
|
|
31
30
|
|
|
32
31
|
#[prop_or_default]
|
|
33
|
-
pub
|
|
32
|
+
pub label: Option<String>,
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
fn event_index(target: &Element) -> Option<usize> {
|
|
@@ -335,7 +334,7 @@ pub fn multi_stop_gradient_selector(props: &MultiStopGradientProps) -> Html {
|
|
|
335
334
|
let pinned = props.discrete && !can_remove;
|
|
336
335
|
html! {
|
|
337
336
|
<>
|
|
338
|
-
<
|
|
337
|
+
<IntlLabel name={props.label.clone().unwrap_or_else(|| "gradient".to_owned())} />
|
|
339
338
|
<div class="color-gradient-container gradient-stops-selector">
|
|
340
339
|
<div
|
|
341
340
|
class={if props.discrete {"gradient-stops-bar discrete"} else {"gradient-stops-bar"}}
|
|
@@ -16,18 +16,13 @@ use wasm_bindgen::JsCast;
|
|
|
16
16
|
use web_sys::{Event, HtmlSelectElement, MouseEvent};
|
|
17
17
|
use yew::prelude::*;
|
|
18
18
|
|
|
19
|
-
use crate::
|
|
19
|
+
use crate::utils::{CssKind, NamedValue};
|
|
20
20
|
|
|
21
|
-
/// The named-value controls above a CSS-valued style field: a stateless
|
|
22
|
-
/// quick-action `<select>` over every named value of the field's kind,
|
|
23
|
-
/// and a Pin button that force-adds the field's value to the workspace
|
|
24
|
-
/// palette.
|
|
25
21
|
#[derive(Properties, PartialEq)]
|
|
26
22
|
pub struct NamedValuePickerProps {
|
|
27
23
|
pub kind: CssKind,
|
|
28
24
|
pub entries: Rc<Vec<NamedValue>>,
|
|
29
25
|
|
|
30
|
-
/// Loads the named entry's value into the field.
|
|
31
26
|
pub on_select: Callback<String>,
|
|
32
27
|
|
|
33
28
|
#[prop_or_default]
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
use web_sys::{HtmlInputElement, InputEvent};
|
|
14
14
|
use yew::{Callback, Properties, TargetCast, function_component, html};
|
|
15
15
|
|
|
16
|
-
use crate::
|
|
16
|
+
use crate::ui::form::optional_field::OptionalField;
|
|
17
17
|
|
|
18
18
|
#[derive(Properties, Debug, PartialEq, Clone)]
|
|
19
19
|
pub struct NumberFieldProps {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
use web_sys::HtmlInputElement;
|
|
14
14
|
use yew::{Callback, Properties, function_component, html, use_callback, use_node_ref};
|
|
15
15
|
|
|
16
|
-
use crate::
|
|
16
|
+
use crate::ui::form::optional_field::OptionalField;
|
|
17
17
|
|
|
18
18
|
#[derive(Properties, Debug, PartialEq, Clone)]
|
|
19
19
|
pub struct NumberRangeFieldProps {
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
use yew::{Callback, Children, Html, MouseEvent, Properties, classes, function_component, html};
|
|
14
14
|
|
|
15
|
+
use crate::ui::form::intl_label::IntlLabel;
|
|
16
|
+
|
|
15
17
|
#[derive(Properties, PartialEq)]
|
|
16
18
|
pub struct OptionalFieldProps {
|
|
17
19
|
pub checked: bool,
|
|
@@ -30,7 +32,7 @@ pub struct OptionalFieldProps {
|
|
|
30
32
|
pub fn optional_field(props: &OptionalFieldProps) -> Html {
|
|
31
33
|
html! {
|
|
32
34
|
<>
|
|
33
|
-
<
|
|
35
|
+
<IntlLabel name={props.label.clone()} />
|
|
34
36
|
<div
|
|
35
37
|
class={classes!(props.class.clone(), props.checked.then_some("is-default-value"))}
|
|
36
38
|
>
|
|
@@ -14,9 +14,8 @@ use wasm_bindgen::JsCast;
|
|
|
14
14
|
use web_sys::*;
|
|
15
15
|
use yew::prelude::*;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/// reordering, and a trailing add tile.
|
|
17
|
+
use crate::ui::form::intl_label::IntlLabel;
|
|
18
|
+
|
|
20
19
|
#[derive(Properties, PartialEq)]
|
|
21
20
|
pub struct PaletteProps {
|
|
22
21
|
pub values: Vec<String>,
|
|
@@ -28,7 +27,7 @@ pub struct PaletteProps {
|
|
|
28
27
|
pub max: Option<usize>,
|
|
29
28
|
|
|
30
29
|
#[prop_or_default]
|
|
31
|
-
pub
|
|
30
|
+
pub label: Option<String>,
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
const DRAG_THRESHOLD_PX: f64 = 4.0;
|
|
@@ -340,7 +339,7 @@ pub fn palette_selector(props: &PaletteProps) -> Html {
|
|
|
340
339
|
|
|
341
340
|
html! {
|
|
342
341
|
<>
|
|
343
|
-
<
|
|
342
|
+
<IntlLabel name={props.label.clone().unwrap_or_else(|| "palette".to_owned())} />
|
|
344
343
|
<div class="color-gradient-container palette-selector">
|
|
345
344
|
<div
|
|
346
345
|
class={classes!("palette-swatches", drag.is_some().then_some("reordering"))}
|
|
@@ -16,8 +16,8 @@ use itertools::Itertools;
|
|
|
16
16
|
use strum::IntoEnumIterator;
|
|
17
17
|
use yew::{Callback, Properties, function_component, html};
|
|
18
18
|
|
|
19
|
-
use crate::
|
|
20
|
-
use crate::
|
|
19
|
+
use crate::ui::containers::select::{Select, SelectItem};
|
|
20
|
+
use crate::ui::form::optional_field::OptionalField;
|
|
21
21
|
|
|
22
22
|
#[derive(Properties, Debug, PartialEq, Clone)]
|
|
23
23
|
pub struct SelectEnumFieldProps<T>
|
|
@@ -16,8 +16,8 @@ use std::rc::Rc;
|
|
|
16
16
|
use itertools::Itertools;
|
|
17
17
|
use yew::{Callback, Properties, function_component, html};
|
|
18
18
|
|
|
19
|
-
use crate::
|
|
20
|
-
use crate::
|
|
19
|
+
use crate::ui::containers::select::{Select, SelectItem};
|
|
20
|
+
use crate::ui::form::optional_field::OptionalField;
|
|
21
21
|
|
|
22
22
|
#[derive(Properties, Debug, PartialEq, Clone)]
|
|
23
23
|
pub struct SelectValueFieldProps<T>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
+
|
|
13
|
+
//! Generic widgets and DOM infrastructure with no dependency on viewer
|
|
14
|
+
//! state: nothing here may import `config`, `session`, `renderer`,
|
|
15
|
+
//! `presentation`, `tasks`, `queries`, `workspace`, `agent`,
|
|
16
|
+
//! `custom_elements`, `components`, or `js::plugin`.
|
|
17
|
+
|
|
18
|
+
pub mod containers;
|
|
19
|
+
pub mod context_menu;
|
|
20
|
+
pub mod dragdrop;
|
|
21
|
+
pub mod font_loader;
|
|
22
|
+
pub mod form;
|
|
23
|
+
pub mod modal;
|
|
24
|
+
pub use modal::{ModalLink, SetModalLink};
|
|
25
|
+
pub mod portal;
|
|
26
|
+
pub mod style;
|
|
27
|
+
|
|
28
|
+
pub use containers::control_group::ControlGroup;
|
|
29
|
+
pub use containers::dropdown_menu::{DropDownMenu, DropDownMenuItem};
|
|
30
|
+
pub use containers::scroll_panel::ScrollPanel;
|
|
31
|
+
pub use containers::scroll_panel_item::ScrollPanelItem;
|
|
32
|
+
pub use containers::select::{Select, SelectItem};
|
|
33
|
+
pub use containers::sidebar::Sidebar;
|
|
34
|
+
pub use containers::sidebar_close_button::SidebarCloseButton;
|
|
35
|
+
pub use containers::split_panel::{Orientation, SplitPanel};
|
|
36
|
+
pub use containers::tab_list::{TabItem, TabList};
|
|
37
|
+
pub use context_menu::{ContextMenu, ContextMenuEntry, ContextMenuItem};
|
|
38
|
+
pub use dragdrop::{
|
|
39
|
+
DragDropContainer, DragEndCallback, DragTargetState, PointerDownCallback,
|
|
40
|
+
clear_document_selection, closest_draggable,
|
|
41
|
+
};
|
|
42
|
+
pub use font_loader::{FontLoader, FontLoaderProps, FontLoaderStatus};
|
|
43
|
+
pub use form::color_selector::ColorSelector;
|
|
44
|
+
pub use form::intl_label::{IntlLabel, intl_content_style, intl_slug};
|
|
45
|
+
pub use form::mirrored_textarea::MirroredTextarea;
|
|
46
|
+
pub use form::multi_stop_gradient_selector::MultiStopGradientSelector;
|
|
47
|
+
pub use form::named_value_picker::NamedValuePicker;
|
|
48
|
+
pub use form::number_field::NumberField;
|
|
49
|
+
pub use form::number_input::NumberInput;
|
|
50
|
+
pub use form::number_range_field::NumberRangeField;
|
|
51
|
+
pub use form::optional_field::OptionalField;
|
|
52
|
+
pub use form::palette_selector::PaletteSelector;
|
|
53
|
+
pub use form::select_enum_field::SelectEnumField;
|
|
54
|
+
pub use form::select_value_field::SelectValueField;
|
|
55
|
+
pub use portal::{MODAL_SLOT, PortalModal};
|
|
56
|
+
pub use style::StyleProvider;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
+
|
|
13
|
+
use std::cell::Cell;
|
|
14
|
+
use std::rc::Rc;
|
|
15
|
+
|
|
16
|
+
use yew::html::ImplicitClone;
|
|
17
|
+
use yew::prelude::*;
|
|
18
|
+
|
|
19
|
+
use crate::utils::WeakScope;
|
|
20
|
+
|
|
21
|
+
/// Whether a modal has been flipped to open upward from its anchor, provided
|
|
22
|
+
/// as a Yew context by `PortalModal`.
|
|
23
|
+
#[derive(Clone, Default, Eq, PartialEq)]
|
|
24
|
+
pub struct ModalOrientation(Rc<Cell<bool>>);
|
|
25
|
+
|
|
26
|
+
impl ImplicitClone for ModalOrientation {}
|
|
27
|
+
|
|
28
|
+
impl ModalOrientation {
|
|
29
|
+
pub fn set(&self, value: bool) {
|
|
30
|
+
self.0.set(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
impl From<ModalOrientation> for bool {
|
|
35
|
+
fn from(x: ModalOrientation) -> Self {
|
|
36
|
+
x.0.get()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// Props that expose a weak link to their component, so an owner can send it
|
|
41
|
+
/// messages after the fact (the column-style editors hosted in a modal).
|
|
42
|
+
pub trait ModalLink<T>
|
|
43
|
+
where
|
|
44
|
+
T: Component,
|
|
45
|
+
{
|
|
46
|
+
fn weak_link(&self) -> &'_ WeakScope<T>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
pub trait SetModalLink {
|
|
50
|
+
fn set_modal_link(&self);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
impl<T> SetModalLink for &Context<T>
|
|
54
|
+
where
|
|
55
|
+
T: Component,
|
|
56
|
+
T::Properties: ModalLink<T>,
|
|
57
|
+
{
|
|
58
|
+
fn set_modal_link(&self) {
|
|
59
|
+
*self.props().weak_link().borrow_mut() = Some(self.link().clone());
|
|
60
|
+
}
|
|
61
|
+
}
|