Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Canvas] Expression events. #102714

Closed
wants to merge 87 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
63ad0f8
expression_reveal_image skeleton.
Kuznietsov Jun 10, 2021
1240bb2
expression_functions added.
Kuznietsov Jun 10, 2021
72eac63
expression_renderers added.
Kuznietsov Jun 10, 2021
9e1e817
Backup of daily work.
Kuznietsov Jun 10, 2021
befec5d
Fixed errors.
Kuznietsov Jun 11, 2021
d60f43a
Merge branch 'master' into expression_reveal_image
kibanamachine Jun 11, 2021
03b214f
Added legacy support. Added button for legacy.
Kuznietsov Jun 11, 2021
cbbf981
Merge branch 'expression_reveal_image' of github.com:Kunzetsov/kibana…
Kuznietsov Jun 11, 2021
010b7b9
Added storybook.
Kuznietsov Jun 11, 2021
13789f1
Removed revealImage from canvas.
Kuznietsov Jun 11, 2021
96ec59b
setState while rendering error fixed.
Kuznietsov Jun 11, 2021
fc13023
tsconfig.json added.
Kuznietsov Jun 11, 2021
4196c5d
jest.config.js added.
Kuznietsov Jun 11, 2021
6be3ccf
Demo doc added.
Kuznietsov Jun 11, 2021
b317f8b
Types fixed.
Kuznietsov Jun 11, 2021
784450d
added limits.
Kuznietsov Jun 11, 2021
5de41e6
Removed not used imports.
Kuznietsov Jun 14, 2021
788c5f6
i18n namespaces fixed.
Kuznietsov Jun 14, 2021
3d6d5f3
Fixed test suite error.
Kuznietsov Jun 14, 2021
4911e14
Some errors fixed.
Kuznietsov Jun 14, 2021
3fb130a
Fixed eslint error.
Kuznietsov Jun 14, 2021
273a2a2
Removed more unused translations.
Kuznietsov Jun 14, 2021
02ed217
Moved UI and elements, related to expressionRevealImage from canvas.
Kuznietsov Jun 14, 2021
2e1e9bf
Fixed unused translations errors.
Kuznietsov Jun 14, 2021
2e727cd
Moved type of element to types.
Kuznietsov Jun 14, 2021
9680733
Fixed types and added service for representing elements, ui and suppo…
Kuznietsov Jun 14, 2021
3aebdf6
Added expression registration to canvas.
Kuznietsov Jun 15, 2021
49e52b0
Fixed
Kuznietsov Jun 15, 2021
5f9ab82
Fixed mutiple call of the function.
Kuznietsov Jun 15, 2021
0c11bcd
Removed support of a legacy lib for revealImage chart.
Kuznietsov Jun 15, 2021
2b36c94
Removed legacy presentation_utils plugin import.
Kuznietsov Jun 15, 2021
33b3ec7
Doc error fixed.
Kuznietsov Jun 15, 2021
82352a9
Merge branch 'master' into expression_reveal_image
kibanamachine Jun 15, 2021
aa1f474
Removed useless translations and tried to fix error.
Kuznietsov Jun 15, 2021
181f793
Merge branch 'expression_reveal_image' of github.com:Kunzetsov/kibana…
Kuznietsov Jun 15, 2021
7bad366
One more fix.
Kuznietsov Jun 15, 2021
2983097
Small imports fix.
Kuznietsov Jun 16, 2021
bf6c8ff
Merge branch 'master' into expression_reveal_image
kibanamachine Jun 16, 2021
226fc89
Fixed translations.
Kuznietsov Jun 16, 2021
ccd4450
Made fixes based on nits.
Kuznietsov Jun 16, 2021
390a547
Removed useless params.
Kuznietsov Jun 16, 2021
ec78576
fix.
Kuznietsov Jun 16, 2021
55b21d0
Fixed errors, related to jest and __mocks__.
Kuznietsov Jun 16, 2021
19e9024
Removed useless type definition.
Kuznietsov Jun 16, 2021
bdea22a
Replaced RendererHandlers with IInterpreterRendererHandlers.
Kuznietsov Jun 17, 2021
b4eaa1b
fixed supported_shareable.
Kuznietsov Jun 17, 2021
d552813
Moved elements back to canvas.
Kuznietsov Jun 17, 2021
596a027
Moved views to canvas, removed expression service and imported render…
Kuznietsov Jun 17, 2021
40af512
Fixed translations.
Kuznietsov Jun 17, 2021
6ba2baa
Types fix.
Kuznietsov Jun 17, 2021
8994828
Moved libs to presentation utils.
Kuznietsov Jun 17, 2021
7e71064
Fixed one mistake.
Kuznietsov Jun 17, 2021
199e16a
removed dataurl lib.
Kuznietsov Jun 17, 2021
fd998f1
Fixed jest files.
Kuznietsov Jun 17, 2021
5b95af7
elasticLogo removed.
Kuznietsov Jun 17, 2021
a290c31
Removed elastic_outline.
Kuznietsov Jun 17, 2021
29e3712
removed httpurl.
Kuznietsov Jun 17, 2021
4f2b9f9
Removed missing_asset.
Kuznietsov Jun 17, 2021
94dbd16
removed url.
Kuznietsov Jun 17, 2021
ce8c17b
replaced mostly all tests.
Kuznietsov Jun 17, 2021
7dc4ae5
Fixed types.
Kuznietsov Jun 18, 2021
b2cd923
Fixed types and removed function_wrapper.ts
Kuznietsov Jun 18, 2021
cc7c509
Fixed types of test helpers.
Kuznietsov Jun 18, 2021
f0200f2
Merge branch 'master' into expression_reveal_image
Kuznietsov Jun 18, 2021
340093f
Changed limits of presentationUtil plugin.
Kuznietsov Jun 18, 2021
1e98dc0
Fixed imports.
Kuznietsov Jun 18, 2021
84d193c
One more fix.
Kuznietsov Jun 18, 2021
e97aa5b
Fixed huge size of bundle.
Kuznietsov Jun 18, 2021
3be24f6
Reduced allow limit for presentationUtil
Kuznietsov Jun 18, 2021
9bf774c
Updated limits for presentationUtil.
Kuznietsov Jun 18, 2021
fec9bed
Fixed public API.
Kuznietsov Jun 18, 2021
b65b887
fixed type errors.
Kuznietsov Jun 18, 2021
292c382
Added `on(...)` handler.
Kuznietsov Jun 21, 2021
56577b5
Merge branch 'master' into expression_events
kibanamachine Jun 21, 2021
8ef2837
added Types for on(...).
Kuznietsov Jun 21, 2021
6ae56c9
Merge branch 'expression_events' of github.com:Kunzetsov/kibana into …
Kuznietsov Jun 21, 2021
973343d
Fixed types and handlers.
Kuznietsov Jun 22, 2021
447ca29
Updated docs.
Kuznietsov Jun 22, 2021
5520b09
Small refactor.
Kuznietsov Jun 22, 2021
fc8574b
Types fixed.
Kuznietsov Jun 22, 2021
8613a24
Made some type improvement.
Kuznietsov Jun 22, 2021
fb655d0
Typeof function check fixed.
Kuznietsov Jun 22, 2021
b9afc4a
Refactored.
Kuznietsov Jun 22, 2021
7c95c90
Fixed `magic` at `on(...)` function.
Kuznietsov Jun 22, 2021
f39e1fa
Merge branch 'master' into expression_events
Kuznietsov Jun 22, 2021
9772182
docs updated.
Kuznietsov Jun 22, 2021
9ccb8f6
Merge branch 'expression_events' of github.com:Kunzetsov/kibana into …
Kuznietsov Jun 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"esUi": "src/plugins/es_ui_shared",
"devTools": "src/plugins/dev_tools",
"expressions": "src/plugins/expressions",
"expressionRevealImage": "src/plugins/expression_reveal_image",
"inputControl": "src/plugins/input_control_vis",
"inspector": "src/plugins/inspector",
"inspectorViews": "src/legacy/core_plugins/inspector_views",
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ This API doesn't support angular, for registering angular dev tools, bootstrap a
|This plugin contains reusable code in the form of self-contained modules (or libraries). Each of these modules exports a set of functionality relevant to the domain of the module.


|{kib-repo}blob/{branch}/src/plugins/expression_reveal_image/README.md[expressionRevealImage]
|Expression Reveal Image plugin is an extracted Canvas chart. It is registrating the revealImage chart, expression elements, functions and views to canvas and expression plugins.


|<<kibana-expressions-plugin>>
|Expression pipeline is a chain of functions that *pipe* its output to the
input of the next function. Functions can be configured using arguments provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface IInterpreterRenderHandlers
| [getRenderMode](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.getrendermode.md) | <code>() =&gt; RenderMode</code> | |
| [hasCompatibleActions](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.hascompatibleactions.md) | <code>(event: any) =&gt; Promise&lt;boolean&gt;</code> | |
| [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.issynccolorsenabled.md) | <code>() =&gt; boolean</code> | |
| [on](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.on.md) | <code>(this: any, event: any, fn: (...args: any) =&gt; void) =&gt; void</code> | |
| [onDestroy](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.ondestroy.md) | <code>(fn: () =&gt; void) =&gt; void</code> | |
| [reload](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.reload.md) | <code>() =&gt; void</code> | |
| [uiState](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.uistate.md) | <code>unknown</code> | This uiState interface is actually <code>PersistedState</code> from the visualizations plugin, but expressions cannot know about vis or it creates a mess of circular dependencies. Downstream consumers of the uiState handler will need to cast for now. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [IInterpreterRenderHandlers](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.md) &gt; [on](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.on.md)

## IInterpreterRenderHandlers.on property

<b>Signature:</b>

```typescript
on: (this: any, event: any, fn: (...args: any) => void) => void;
```
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface IInterpreterRenderHandlers
| [getRenderMode](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.getrendermode.md) | <code>() =&gt; RenderMode</code> | |
| [hasCompatibleActions](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.hascompatibleactions.md) | <code>(event: any) =&gt; Promise&lt;boolean&gt;</code> | |
| [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.issynccolorsenabled.md) | <code>() =&gt; boolean</code> | |
| [on](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.on.md) | <code>(this: any, event: any, fn: (...args: any) =&gt; void) =&gt; void</code> | |
| [onDestroy](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.ondestroy.md) | <code>(fn: () =&gt; void) =&gt; void</code> | |
| [reload](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.reload.md) | <code>() =&gt; void</code> | |
| [uiState](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.uistate.md) | <code>unknown</code> | This uiState interface is actually <code>PersistedState</code> from the visualizations plugin, but expressions cannot know about vis or it creates a mess of circular dependencies. Downstream consumers of the uiState handler will need to cast for now. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) &gt; [IInterpreterRenderHandlers](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.md) &gt; [on](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.on.md)

## IInterpreterRenderHandlers.on property

<b>Signature:</b>

```typescript
on: (this: any, event: any, fn: (...args: any) => void) => void;
```
3 changes: 2 additions & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pageLoadAssetSize:
watcher: 43598
runtimeFields: 41752
stackAlerts: 29684
presentationUtil: 49767
presentationUtil: 94301
spacesOss: 18817
indexPatternFieldEditor: 90489
osquery: 107090
Expand All @@ -110,4 +110,5 @@ pageLoadAssetSize:
timelines: 28613
screenshotMode: 17856
visTypePie: 35583
expressionRevealImage: 62826
cases: 144442
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const storybookAliases = {
dashboard_enhanced: 'x-pack/plugins/dashboard_enhanced/.storybook',
data_enhanced: 'x-pack/plugins/data_enhanced/.storybook',
embeddable: 'src/plugins/embeddable/.storybook',
expression_reveal_image: 'src/plugins/expression_reveal_image/.storybook',
infra: 'x-pack/plugins/infra/.storybook',
security_solution: 'x-pack/plugins/security_solution/.storybook',
ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/.storybook',
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/expression_reveal_image/.i18nrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"prefix": "expressionRevealImage",
"paths": {
"expressionRevealImage": "."
},
"translations": ["translations/ja-JP.json"]
}
10 changes: 10 additions & 0 deletions src/plugins/expression_reveal_image/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

// eslint-disable-next-line import/no-commonjs
module.exports = require('@kbn/storybook').defaultConfig;
9 changes: 9 additions & 0 deletions src/plugins/expression_reveal_image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# expressionRevealImage

Expression Reveal Image plugin is an extracted Canvas chart. It is registrating the `revealImage` chart, expression elements, functions and views to canvas and expression plugins.

---

## Development

See the [kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md) for instructions setting up your development environment.
9 changes: 9 additions & 0 deletions src/plugins/expression_reveal_image/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export const PLUGIN_ID = 'expressionRevealImage';
export const PLUGIN_NAME = 'expressionRevealImage';
10 changes: 10 additions & 0 deletions src/plugins/expression_reveal_image/common/i18n/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export const BASE64 = '`base64`';
export const URL = 'URL';
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { i18n } from '@kbn/i18n';
import { revealImage } from '../../../canvas_plugin_src/functions/common/revealImage';
import { FunctionHelp } from '../function_help';
import { FunctionFactory } from '../../../types';
import { Position } from '../../../types';
import { BASE64, URL } from '../../constants';

export const help: FunctionHelp<FunctionFactory<typeof revealImage>> = {
help: i18n.translate('xpack.canvas.functions.revealImageHelpText', {
export const help = {
help: i18n.translate('expressionRevealImage.functions.revealImageHelpText', {
defaultMessage: 'Configures an image reveal element.',
}),
args: {
image: i18n.translate('xpack.canvas.functions.revealImage.args.imageHelpText', {
image: i18n.translate('expressionRevealImage.functions.revealImage.args.imageHelpText', {
defaultMessage:
'The image to reveal. Provide an image asset as a {BASE64} data {URL}, ' +
'or pass in a sub-expression.',
Expand All @@ -26,16 +24,19 @@ export const help: FunctionHelp<FunctionFactory<typeof revealImage>> = {
URL,
},
}),
emptyImage: i18n.translate('xpack.canvas.functions.revealImage.args.emptyImageHelpText', {
defaultMessage:
'An optional background image to reveal over. ' +
'Provide an image asset as a `{BASE64}` data {URL}, or pass in a sub-expression.',
values: {
BASE64,
URL,
},
}),
origin: i18n.translate('xpack.canvas.functions.revealImage.args.originHelpText', {
emptyImage: i18n.translate(
'expressionRevealImage.functions.revealImage.args.emptyImageHelpText',
{
defaultMessage:
'An optional background image to reveal over. ' +
'Provide an image asset as a `{BASE64}` data {URL}, or pass in a sub-expression.',
values: {
BASE64,
URL,
},
}
),
origin: i18n.translate('expressionRevealImage.functions.revealImage.args.originHelpText', {
defaultMessage: 'The position to start the image fill. For example, {list}, or {end}.',
values: {
list: Object.values(Position)
Expand All @@ -50,7 +51,7 @@ export const help: FunctionHelp<FunctionFactory<typeof revealImage>> = {
export const errors = {
invalidPercent: (percent: number) =>
new Error(
i18n.translate('xpack.canvas.functions.revealImage.invalidPercentErrorMessage', {
i18n.translate('expressionRevealImage.functions.revealImage.invalidPercentErrorMessage', {
defaultMessage: "Invalid value: '{percent}'. Percentage must be between 0 and 1",
values: {
percent,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { errors as revealImage } from './dict/reveal_image';

export const getFunctionErrors = () => ({
revealImage,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { help as revealImage } from './dict/reveal_image';

/**
* Help text for Canvas Functions should be properly localized. This function will
* return a dictionary of help strings, organized by `ExpressionFunctionDefinition`
* specification and then by available arguments within each `ExpressionFunctionDefinition`.
*
* This a function, rather than an object, to future-proof string initialization,
* if ever necessary.
*/
export const getFunctionHelp = () => ({
revealImage,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from './function_help';
export * from './function_errors';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export { strings as revealImage } from './reveal_image';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';

export const strings = {
getDisplayName: () =>
i18n.translate('expressionRevealImage.renderer.revealImage.displayName', {
defaultMessage: 'Image reveal',
}),
getHelpDescription: () =>
i18n.translate('expressionRevealImage.renderer.revealImage.helpDescription', {
defaultMessage: 'Reveal a percentage of an image to make a custom gauge-style chart',
}),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from './renderer_strings';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { revealImage } from './dict';

/**
* Help text for Canvas Functions should be properly localized. This function will
* return a dictionary of help strings, organized by `ExpressionFunctionDefinition`
* specification and then by available arguments within each `ExpressionFunctionDefinition`.
*
* This a function, rather than an object, to future-proof string initialization,
* if ever necessary.
*/
export const getRendererStrings = () => ({
revealImage,
});
10 changes: 10 additions & 0 deletions src/plugins/expression_reveal_image/common/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from './expression_functions';
export * from './expression_renderers';
9 changes: 9 additions & 0 deletions src/plugins/expression_reveal_image/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from './constants';
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { ExpressionFunctionDefinition, ExpressionValueRender } from 'src/plugins/expressions';

export enum Origin {
TOP = 'top',
LEFT = 'left',
BOTTOM = 'bottom',
RIGHT = 'right',
}

interface Arguments {
image: string | null;
emptyImage: string | null;
origin: Origin;
}

export interface Output {
image: string;
emptyImage: string;
origin: Origin;
percent: number;
}

export type ExpressionRevealImageFunction = () => ExpressionFunctionDefinition<
'revealImage',
number,
Arguments,
ExpressionValueRender<Output>
>;

export enum Position {
TOP = 'top',
BOTTOM = 'bottom',
LEFT = 'left',
RIGHT = 'right',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export type OriginString = 'bottom' | 'left' | 'top' | 'right';
export interface RevealImageRendererConfig {
percent: number;
origin?: OriginString;
image?: string;
emptyImage?: string;
}

export interface NodeDimensions {
width: number;
height: number;
}

export interface HandlerEmitters {
resize?: (size: { height: number; width: number }) => void;
}
Loading