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 shape #103219

Merged
merged 118 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
51a04ba
expression_reveal_image skeleton.
Kuznietsov Jun 10, 2021
d6dc04d
expression_functions added.
Kuznietsov Jun 10, 2021
8438ec4
expression_renderers added.
Kuznietsov Jun 10, 2021
73b357a
Backup of daily work.
Kuznietsov Jun 10, 2021
adc8613
Fixed errors.
Kuznietsov Jun 11, 2021
0d80fb4
Added legacy support. Added button for legacy.
Kuznietsov Jun 11, 2021
1bf5c60
Added storybook.
Kuznietsov Jun 11, 2021
f816d80
Removed revealImage from canvas.
Kuznietsov Jun 11, 2021
2a9a7fe
Types fixed.
Kuznietsov Jun 11, 2021
c160885
Fixed test suite error.
Kuznietsov Jun 14, 2021
21041b4
Fixed eslint error.
Kuznietsov Jun 14, 2021
bb8355a
Moved UI and elements, related to expressionRevealImage from canvas.
Kuznietsov Jun 14, 2021
04d1a85
Fixed unused translations errors.
Kuznietsov Jun 14, 2021
11c9892
Moved type of element to types.
Kuznietsov Jun 14, 2021
0e9b5a6
Fixed types and added service for representing elements, ui and suppo…
Kuznietsov Jun 14, 2021
1da3d57
Added expression registration to canvas.
Kuznietsov Jun 15, 2021
3f11831
Fixed
Kuznietsov Jun 15, 2021
cef9b5c
Fixed mutiple call of the function.
Kuznietsov Jun 15, 2021
f97929d
Removed support of a legacy lib for revealImage chart.
Kuznietsov Jun 15, 2021
a37722c
Removed legacy presentation_utils plugin import.
Kuznietsov Jun 15, 2021
463ad1d
Removed useless translations and tried to fix error.
Kuznietsov Jun 15, 2021
fce35ad
One more fix.
Kuznietsov Jun 15, 2021
7b2b608
Small imports fix.
Kuznietsov Jun 16, 2021
a00bf52
Fixed translations.
Kuznietsov Jun 16, 2021
e6a4212
Made fixes based on nits.
Kuznietsov Jun 16, 2021
c0d9b4c
Removed useless params.
Kuznietsov Jun 16, 2021
82876d8
fix.
Kuznietsov Jun 16, 2021
2c6e2db
Fixed errors, related to jest and __mocks__.
Kuznietsov Jun 16, 2021
e75ec81
Removed useless type definition.
Kuznietsov Jun 16, 2021
78503ab
Replaced RendererHandlers with IInterpreterRendererHandlers.
Kuznietsov Jun 17, 2021
d88654f
fixed supported_shareable.
Kuznietsov Jun 17, 2021
fb81f0e
Moved elements back to canvas.
Kuznietsov Jun 17, 2021
7180dee
Moved views to canvas, removed expression service and imported render…
Kuznietsov Jun 17, 2021
8fb2e7a
Fixed translations.
Kuznietsov Jun 17, 2021
63b7b4f
Moved libs to presentation utils.
Kuznietsov Jun 17, 2021
eed7182
Fixed types and removed function_wrapper.ts
Kuznietsov Jun 18, 2021
9191291
Fixed types of test helpers.
Kuznietsov Jun 18, 2021
a25c066
Fixed imports.
Kuznietsov Jun 18, 2021
6b69b4b
One more fix.
Kuznietsov Jun 18, 2021
3946fc6
Fixed public API.
Kuznietsov Jun 18, 2021
ad78689
Moved css to component.
Kuznietsov Jun 22, 2021
8848354
Fixed spaces at element.
Kuznietsov Jun 22, 2021
5b465fd
Removed unused plugin.
Kuznietsov Jun 22, 2021
7a0ebed
Basic setup of error plugin.
Kuznietsov Jun 23, 2021
a9f72b2
Removed not used `function` files at `error` expression.
Kuznietsov Jun 23, 2021
6b97196
Moved related components from canvas.
Kuznietsov Jun 23, 2021
ff1bbed
Changed imports of components.
Kuznietsov Jun 23, 2021
895e779
Removed useless translations and fixed .i18nrc.json
Kuznietsov Jun 23, 2021
97b5488
More fixes of i18nrc.
Kuznietsov Jun 23, 2021
4165080
Fixed async functions.
Kuznietsov Jun 23, 2021
0ebb754
Fixed one test with Expression input.
Kuznietsov Jun 24, 2021
13cd55e
generated plugin and copied code from expression_reveal_image
Kuznietsov Jun 24, 2021
89cbce3
fixed double import after merge.
Kuznietsov Jun 24, 2021
07cfce6
Changed all names from reveal_image to shape.
Kuznietsov Jun 24, 2021
f695751
moved shape to plugin and added all necessary configs
Kuznietsov Jun 24, 2021
3a85ad8
Fixed translations, fixed all imports and debug of svg.
Kuznietsov Jun 24, 2021
35feb32
`function` moved to `server`.
Kuznietsov Jun 29, 2021
47bca03
One shape is rewritten to `React` and rendering is written with passi…
Kuznietsov Jun 30, 2021
c909b1b
changed default width and heigth.
Kuznietsov Jun 30, 2021
71bcb17
Added `ShapeHOC`.
Kuznietsov Jun 30, 2021
f8132ac
Shapes changed.
Kuznietsov Jun 30, 2021
6b52aa0
small refactor.
Kuznietsov Jun 30, 2021
58f7e7f
Removed useless import.
Kuznietsov Jun 30, 2021
ae098d4
one more refactor.
Kuznietsov Jun 30, 2021
ec15303
Refactor + fix errors + updated limits.
Kuznietsov Jul 1, 2021
986949b
Changed ShapePreview from pure js to react and removed `dangerouslySe…
Kuznietsov Jul 1, 2021
cc0b938
Fixed types of viewbox.
Kuznietsov Jul 1, 2021
feeaf92
Changed types source for Shape components.
Kuznietsov Jul 1, 2021
988d0d7
small refactor.
Kuznietsov Jul 1, 2021
7565c54
Fixed imports.
Kuznietsov Jul 1, 2021
71415af
Removed `shape` from `canvas`
Kuznietsov Jul 1, 2021
7841dff
Updated docs.
Kuznietsov Jul 1, 2021
ee655aa
Basic setup of error plugin.
Kuznietsov Jun 23, 2021
89bc21b
Removed not used `function` files at `error` expression.
Kuznietsov Jun 23, 2021
0085e28
Changed imports of components.
Kuznietsov Jun 23, 2021
d91dcd1
Fixed errors, related to shape and autosuggestions.
Kuznietsov Jul 2, 2021
0668b4c
Fixed i18n for shape.
Kuznietsov Jul 2, 2021
508fbbb
Moved function from public to common and registered at server.
Kuznietsov Jul 2, 2021
9adbf1e
Fixed types error.
Kuznietsov Jul 2, 2021
af3b711
Fixed snapshots and shape mocks.
Kuznietsov Jul 2, 2021
73e54de
Moved some libs from `presentations_util` to `expression_shape`
Kuznietsov Jul 8, 2021
4c4ed6f
Shape refactored.
Kuznietsov Jul 8, 2021
05ae5ab
Shape picker fixed.
Kuznietsov Jul 9, 2021
83b99db
Moved `Popover` back to `canvas`
Kuznietsov Jul 7, 2021
bfeb642
Removed `Popover` export from presentation_utils components.
Kuznietsov Jul 7, 2021
838ad5b
Moved error_component and debug_component from presentation_util to e…
Kuznietsov Jul 7, 2021
c020f37
Removed `.i18nrc.json`.
Kuznietsov Jul 9, 2021
7326c69
Removed `.i18nrc.json`.
Kuznietsov Jul 9, 2021
ac84165
Removed useless scss.
Kuznietsov Jul 14, 2021
ad82dc1
Fixed color of `error`.
Kuznietsov Jul 9, 2021
365c7e8
added fixes of rebase.
Kuznietsov Jul 15, 2021
134fe5b
More fixes of rebase error .
Kuznietsov Jul 15, 2021
f0221b8
Removed useless .i18nrc.json file.
Kuznietsov Jul 15, 2021
7eeb8f2
More fixes.
Kuznietsov Jul 15, 2021
f54de25
More fixes of rebase.
Kuznietsov Jul 15, 2021
c448f0a
One more fix.
Kuznietsov Jul 15, 2021
41ddc50
More fixes.
Kuznietsov Jul 15, 2021
c19f54e
Fixed limits and translations.
Kuznietsov Jul 15, 2021
1210d38
Added.
Kuznietsov Jul 15, 2021
7590fc9
Fixed i18nrc.
Kuznietsov Jul 15, 2021
a9efd93
Fixed error..
Kuznietsov Jul 16, 2021
3235300
Moved shapes to async chunks.
Kuznietsov Jul 16, 2021
4184b53
One more fix.
Kuznietsov Jul 16, 2021
3dd8f20
Some fixes.
Kuznietsov Jul 16, 2021
1229026
Trying to fix the typecheck error.
Kuznietsov Jul 16, 2021
23083a7
Added temp of drawer.
Kuznietsov Jul 19, 2021
5fb9c65
Moved shapes to the async chunk in a less complex way.
Kuznietsov Jul 19, 2021
32d0d56
Made `ShapeDrawer` reusable among different `expressions`.
Kuznietsov Jul 19, 2021
8bdd5e9
Merge branch 'master' into expression_shape
Kuznietsov Jul 19, 2021
1abefd5
Changed type of `shapes` from `any` and `Shape` to `string`.
Kuznietsov Jul 19, 2021
7122811
Merge branch 'expression_shape' of github.com:Kunzetsov/kibana into e…
Kuznietsov Jul 19, 2021
d701f0c
Made changes, based on nits.
Kuznietsov Jul 20, 2021
2bec1e2
Removed not necessary changes.
Kuznietsov Jul 20, 2021
5c5c95c
Moved all reusable libs to `expression_shapes`.
Kuznietsov Jul 20, 2021
88c055d
Reduced the size of the bundle.
Kuznietsov Jul 20, 2021
07b6e08
Hope, fixed type check errors.
Kuznietsov Jul 20, 2021
02c525d
Removed getDefaultShapeData.
Kuznietsov Jul 20, 2021
94abbcc
Removed `getViewBox` from bundle.
Kuznietsov Jul 20, 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 @@ -18,6 +18,7 @@
"expressions": "src/plugins/expressions",
"expressionError": "src/plugins/expression_error",
"expressionRevealImage": "src/plugins/expression_reveal_image",
"expressionShape": "src/plugins/expression_shape",
"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 @@ -99,6 +99,10 @@ want to incorporate their own functions, types, and renderers into the service
for use in their own application.


|{kib-repo}blob/{branch}/src/plugins/expression_shape/README.md[expressionShape]
|Expression Shape plugin adds a shape function to the expression plugin and an associated renderer. The renderer will display the given shape with selected decorations.


|{kib-repo}blob/{branch}/src/plugins/home/README.md[home]
|Moves the legacy ui/registry/feature_catalogue module for registering "features" that should be shown in the home page's feature catalogue to a service within a "home" plugin. The feature catalogue refered to here should not be confused with the "feature" plugin for registering features used to derive UI capabilities for feature controls.

Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,4 @@ pageLoadAssetSize:
cases: 144442
expressionError: 22127
userSetup: 18532
expressionShape: 30033
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const storybookAliases = {
embeddable: 'src/plugins/embeddable/.storybook',
expression_error: 'src/plugins/expression_error/.storybook',
expression_reveal_image: 'src/plugins/expression_reveal_image/.storybook',
expression_shape: 'src/plugins/expression_shape/.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
10 changes: 10 additions & 0 deletions src/plugins/expression_shape/.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_shape/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# expressionShape

Expression Shape plugin adds a `shape` function to the expression plugin and an associated renderer. The renderer will display the given shape with selected decorations.

---

## Development

See the [kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md) for instructions setting up your development environment.
11 changes: 11 additions & 0 deletions src/plugins/expression_shape/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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 = 'expressionShape';
export const PLUGIN_NAME = 'expressionShape';
export const SVG = 'SVG';
13 changes: 13 additions & 0 deletions src/plugins/expression_shape/common/expression_functions/index.ts
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 { shapeFunction } from './shape_function';

export const functions = [shapeFunction];

export { shapeFunction };
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* 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';
import { ExpressionShapeFunction, Shape } from '../types';
import { SVG } from '../constants';
import { getAvailableShapes } from '../lib';

export const strings = {
help: i18n.translate('expressionShape.functions.shapeHelpText', {
defaultMessage: 'Creates a shape.',
}),
args: {
shape: i18n.translate('expressionShape.functions.shape.args.shapeHelpText', {
defaultMessage: 'Pick a shape.',
}),
border: i18n.translate('expressionShape.functions.shape.args.borderHelpText', {
defaultMessage: 'An {SVG} color for the border outlining the shape.',
values: {
SVG,
},
}),
borderWidth: i18n.translate('expressionShape.functions.shape.args.borderWidthHelpText', {
defaultMessage: 'The thickness of the border.',
}),
fill: i18n.translate('expressionShape.functions.shape.args.fillHelpText', {
defaultMessage: 'An {SVG} color to fill the shape.',
values: {
SVG,
},
}),
maintainAspect: i18n.translate('expressionShape.functions.shape.args.maintainAspectHelpText', {
defaultMessage: `Maintain the shape's original aspect ratio?`,
}),
},
};

export const errors = {
invalidShape: (shape: string) =>
new Error(
i18n.translate('expressionShape.functions.shape.invalidShapeErrorMessage', {
defaultMessage: "Invalid value: '{shape}'. Such a shape doesn't exist.",
values: {
shape,
},
})
),
};

export const shapeFunction: ExpressionShapeFunction = () => {
const { help, args: argHelp } = strings;

return {
name: 'shape',
aliases: [],
inputTypes: ['null'],
help,
args: {
shape: {
types: ['string'],
help: argHelp.shape,
aliases: ['_'],
default: 'square',
options: Object.values(Shape),
},
border: {
types: ['string'],
aliases: ['stroke'],
help: argHelp.border,
},
borderWidth: {
types: ['number'],
aliases: ['strokeWidth'],
help: argHelp.borderWidth,
default: 0,
},
fill: {
types: ['string'],
help: argHelp.fill,
default: 'black',
},
maintainAspect: {
types: ['boolean'],
help: argHelp.maintainAspect,
default: false,
options: [true, false],
},
},
fn: (input, args) => {
const avaliableShapes = getAvailableShapes();
if (!avaliableShapes.includes(args.shape)) {
throw errors.invalidShape(args.shape);
}

return {
type: 'shape',
...args,
};
},
};
};
12 changes: 12 additions & 0 deletions src/plugins/expression_shape/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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';
export * from './types';
export * from './expression_functions';
export { getAvailableShapes } from './lib';
11 changes: 11 additions & 0 deletions src/plugins/expression_shape/common/lib/available_shapes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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 { Shape } from '../types';

export const getAvailableShapes = () => Object.values(Shape);
10 changes: 10 additions & 0 deletions src/plugins/expression_shape/common/lib/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 './view_box';
export * from './available_shapes';
48 changes: 48 additions & 0 deletions src/plugins/expression_shape/common/lib/view_box.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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 { ViewBoxParams } from '../../../presentation_util/common';
import { ParentNodeParams } from '../types';

function getMinxAndWidth(viewBoxParams: ViewBoxParams, { borderOffset, width }: ParentNodeParams) {
let { minX, width: shapeWidth } = viewBoxParams;
if (width) {
const xOffset = (shapeWidth / width) * borderOffset;
minX -= xOffset;
shapeWidth += xOffset * 2;
} else {
shapeWidth = 0;
}

return [minX, shapeWidth];
}

function getMinyAndHeight(
viewBoxParams: ViewBoxParams,
{ borderOffset, height }: ParentNodeParams
) {
let { minY, height: shapeHeight } = viewBoxParams;
if (height) {
const yOffset = (shapeHeight / height) * borderOffset;
minY -= yOffset;
shapeHeight += yOffset * 2;
} else {
shapeHeight = 0;
}

return [minY, shapeHeight];
}

export function getViewBox(
viewBoxParams: ViewBoxParams,
parentNodeParams: ParentNodeParams
): ViewBoxParams {
const [minX, width] = getMinxAndWidth(viewBoxParams, parentNodeParams);
const [minY, height] = getMinyAndHeight(viewBoxParams, parentNodeParams);
return { minX, minY, width, height };
}
46 changes: 46 additions & 0 deletions src/plugins/expression_shape/common/types/expression_functions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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 } from 'src/plugins/expressions';

export enum Shape {
ARROW = 'arrow',
ARROW_MULTI = 'arrowMulti',
BOOKMARK = 'bookmark',
CIRCLE = 'circle',
CROSS = 'cross',
HEXAGON = 'hexagon',
KITE = 'kite',
PENTAGON = 'pentagon',
RHOMBUS = 'rhombus',
SEMICIRCLE = 'semicircle',
SPEECH_BUBBLE = 'speechBubble',
SQUARE = 'square',
STAR = 'star',
TAG = 'tag',
TRIANGLE = 'triangle',
TRIANGLE_RIGHT = 'triangleRight',
}

interface Arguments {
border: string;
borderWidth: number;
shape: Shape;
fill: string;
maintainAspect: boolean;
}

export interface Output extends Arguments {
type: 'shape';
}

export type ExpressionShapeFunction = () => ExpressionFunctionDefinition<
'shape',
number | null,
Arguments,
Output
>;
28 changes: 28 additions & 0 deletions src/plugins/expression_shape/common/types/expression_renderers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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 { Shape } from './expression_functions';

export type OriginString = 'bottom' | 'left' | 'top' | 'right';
export interface ShapeRendererConfig {
border: string;
borderWidth: number;
shape: Shape;
fill: string;
maintainAspect: boolean;
}

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

export interface ParentNodeParams {
borderOffset: number;
width: number;
height: number;
}
9 changes: 9 additions & 0 deletions src/plugins/expression_shape/common/types/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 './expression_functions';
export * from './expression_renderers';
13 changes: 13 additions & 0 deletions src/plugins/expression_shape/jest.config.js
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.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/src/plugins/expression_shape'],
};
13 changes: 13 additions & 0 deletions src/plugins/expression_shape/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"id": "expressionShape",
"version": "1.0.0",
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"extraPublicDirs": [
"common"
],
"requiredPlugins": ["expressions", "presentationUtil"],
"optionalPlugins": [],
"requiredBundles": []
}
12 changes: 12 additions & 0 deletions src/plugins/expression_shape/public/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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 { lazy } from 'react';

export * from './shape_component';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so it looks like exporting * from here exports the component itself, which causes it to end up in the main bundle, defeating the purpose of the lazy wherever that is.

Or just export it as lazy from here to keep it out of the bundle and import the lazy where it's currently used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

export const LazyShapeDrawer = lazy(() => import('./shape_drawer'));
Loading