hunk
dict | file
stringlengths 0
11.8M
| file_path
stringlengths 2
234
| label
int64 0
1
| commit_url
stringlengths 74
103
| dependency_score
sequencelengths 5
5
|
---|---|---|---|---|---|
{
"id": 3,
"code_window": [
"}\n",
"export const Heading: FunctionComponent<HeadingProps> = ({ children }) => <H2>{children}</H2>;\n"
],
"labels": [
"keep",
"replace"
],
"after_edit": [
"\n",
"export const Heading: FunctionComponent<HeadingProps> = ({ children, disableAnchor }) => {\n",
" if (disableAnchor || typeof children !== 'string') {\n",
" return <H2>{children}</H2>;\n",
" }\n",
" const tagID = children.toLowerCase().replace(/[^a-z0-9]/gi, '-');\n",
" return (\n",
" <HeaderMdx as=\"h2\" id={tagID}>\n",
" {children}\n",
" </HeaderMdx>\n",
" );\n",
"};"
],
"file_path": "addons/docs/src/blocks/Heading.tsx",
"type": "replace",
"edit_start_line_idx": 6
} | import renderer from 'react-test-renderer';
import React from 'react';
import App from './App';
it('renders without crashing', () => {
const rendered = renderer.create(<App />).toJSON();
expect(rendered).toBeTruthy();
});
| examples-native/crna-kitchen-sink/App.test.js | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.0001737933635013178,
0.0001737933635013178,
0.0001737933635013178,
0.0001737933635013178,
0
] |
{
"id": 3,
"code_window": [
"}\n",
"export const Heading: FunctionComponent<HeadingProps> = ({ children }) => <H2>{children}</H2>;\n"
],
"labels": [
"keep",
"replace"
],
"after_edit": [
"\n",
"export const Heading: FunctionComponent<HeadingProps> = ({ children, disableAnchor }) => {\n",
" if (disableAnchor || typeof children !== 'string') {\n",
" return <H2>{children}</H2>;\n",
" }\n",
" const tagID = children.toLowerCase().replace(/[^a-z0-9]/gi, '-');\n",
" return (\n",
" <HeaderMdx as=\"h2\" id={tagID}>\n",
" {children}\n",
" </HeaderMdx>\n",
" );\n",
"};"
],
"file_path": "addons/docs/src/blocks/Heading.tsx",
"type": "replace",
"edit_start_line_idx": 6
} | import React from 'react';
import ReactDOM from 'react-dom';
import { document } from 'global';
import App from './App';
import './index.css';
ReactDOM.render(<App />, document.getElementById('root'));
| examples/cra-kitchen-sink/src/index.js | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.00017391485744155943,
0.00017391485744155943,
0.00017391485744155943,
0.00017391485744155943,
0
] |
{
"id": 4,
"code_window": [
"import React, { FunctionComponent } from 'react';\n",
"import { H3 } from '@storybook/components/html';\n",
"\n"
],
"labels": [
"keep",
"add",
"keep"
],
"after_edit": [
"import { HeaderMdx } from './mdx';\n",
"import { HeadingProps } from './Heading';\n"
],
"file_path": "addons/docs/src/blocks/Subheading.tsx",
"type": "add",
"edit_start_line_idx": 2
} | import React, { FunctionComponent } from 'react';
import { H3 } from '@storybook/components/html';
interface SubheadingProps {
children: JSX.Element | string;
}
export const Subheading: FunctionComponent<SubheadingProps> = ({ children }) => <H3>{children}</H3>;
| addons/docs/src/blocks/Subheading.tsx | 1 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.592387855052948,
0.592387855052948,
0.592387855052948,
0.592387855052948,
0
] |
{
"id": 4,
"code_window": [
"import React, { FunctionComponent } from 'react';\n",
"import { H3 } from '@storybook/components/html';\n",
"\n"
],
"labels": [
"keep",
"add",
"keep"
],
"after_edit": [
"import { HeaderMdx } from './mdx';\n",
"import { HeadingProps } from './Heading';\n"
],
"file_path": "addons/docs/src/blocks/Subheading.tsx",
"type": "add",
"edit_start_line_idx": 2
} | import { buildStatic } from '@storybook/core/server';
import options from './options';
buildStatic(options);
| app/html/src/server/build.ts | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.00016686155868228525,
0.00016686155868228525,
0.00016686155868228525,
0.00016686155868228525,
0
] |
{
"id": 4,
"code_window": [
"import React, { FunctionComponent } from 'react';\n",
"import { H3 } from '@storybook/components/html';\n",
"\n"
],
"labels": [
"keep",
"add",
"keep"
],
"after_edit": [
"import { HeaderMdx } from './mdx';\n",
"import { HeadingProps } from './Heading';\n"
],
"file_path": "addons/docs/src/blocks/Subheading.tsx",
"type": "add",
"edit_start_line_idx": 2
} | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`csf-to-mdx transforms correctly using "component-id.input.js" data 1`] = `
"import Button from './Button';
import { Meta, Story } from '@storybook/addon-docs/blocks';
<Meta title='Button' id='button-id' />
<Story name='someStory'><Button label='Story 1' /></Story>"
`;
| lib/codemod/src/transforms/__testfixtures__/csf-to-mdx/component-id.output.snapshot | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.000180221744813025,
0.0001736300764605403,
0.00016703839355614036,
0.0001736300764605403,
0.000006591675628442317
] |
{
"id": 4,
"code_window": [
"import React, { FunctionComponent } from 'react';\n",
"import { H3 } from '@storybook/components/html';\n",
"\n"
],
"labels": [
"keep",
"add",
"keep"
],
"after_edit": [
"import { HeaderMdx } from './mdx';\n",
"import { HeadingProps } from './Heading';\n"
],
"file_path": "addons/docs/src/blocks/Subheading.tsx",
"type": "add",
"edit_start_line_idx": 2
} | import { parseJsDoc } from './jsdocParser';
describe('parseJsDoc', () => {
it('should set includesJsDoc to false when the value is null', () => {
const { includesJsDoc, description, extractedTags } = parseJsDoc(null);
expect(includesJsDoc).toBeFalsy();
expect(description).toBeUndefined();
expect(extractedTags).toBeUndefined();
});
it('should set includesJsDocto to false when the value dont contains JSDoc', () => {
const { includesJsDoc, description, extractedTags } = parseJsDoc('Hey!');
expect(includesJsDoc).toBeFalsy();
expect(description).toBeUndefined();
expect(extractedTags).toBeUndefined();
});
it('should set includesJsDoc to true when the value contains JSDoc', () => {
const { includesJsDoc } = parseJsDoc('Hey!\n@version 1.2');
expect(includesJsDoc).toBeTruthy();
});
it('should remove all JSDoc tags from the description', () => {
const { description } = parseJsDoc('Hey!\n@version 1.2\n@deprecated');
expect(description).toBe('Hey!');
});
describe('@ignore', () => {
it('should set ignore to true when @ignore is present', () => {
const { ignore, description, extractedTags } = parseJsDoc('Hey!\n@ignore');
expect(ignore).toBeTruthy();
expect(description).toBeUndefined();
expect(extractedTags).toBeUndefined();
});
it('should set ignore to false when @ignore is not present', () => {
const { ignore } = parseJsDoc('Hey!\n@version 1.2');
expect(ignore).toBeFalsy();
});
});
describe('@param', () => {
it('should ignore invalid @param tags', () => {
const { extractedTags } = parseJsDoc('@param');
expect(extractedTags.params).toBeNull();
});
it('should return a @param with a name', () => {
const { extractedTags } = parseJsDoc('@param event');
expect(extractedTags.params).not.toBeNull();
expect(extractedTags.params[0].name).toBe('event');
expect(extractedTags.params[0].type).toBeNull();
expect(extractedTags.params[0].description).toBeNull();
});
it('should return a @param with a name and a type', () => {
const { extractedTags } = parseJsDoc('@param {SyntheticEvent} event');
expect(extractedTags.params).not.toBeNull();
expect(extractedTags.params[0].name).toBe('event');
expect(extractedTags.params[0].type).not.toBeNull();
expect(extractedTags.params[0].type.name).toBe('SyntheticEvent');
expect(extractedTags.params[0].description).toBeNull();
});
it('should return a @param with a name, a type and a description', () => {
const { extractedTags } = parseJsDoc('@param {SyntheticEvent} event - React event');
expect(extractedTags.params).not.toBeNull();
expect(extractedTags.params[0].name).toBe('event');
expect(extractedTags.params[0].type).not.toBeNull();
expect(extractedTags.params[0].type.name).toBe('SyntheticEvent');
expect(extractedTags.params[0].description).toBe('React event');
});
it('should support multiple @param tags', () => {
const { extractedTags } = parseJsDoc(
'@param {SyntheticEvent} event1 - React event\n@param {SyntheticEvent} event2 - React event\n@param {SyntheticEvent} event3 - React event'
);
['event1', 'event2', 'event3'].forEach((x, i) => {
expect(extractedTags.params[i].name).toBe(x);
expect(extractedTags.params[i].type).not.toBeNull();
expect(extractedTags.params[i].type.name).toBe('SyntheticEvent');
expect(extractedTags.params[i].description).toBe('React event');
});
});
it('should not return extra @param', () => {
const { extractedTags } = parseJsDoc('@param event');
expect(Object.keys(extractedTags.params).length).toBe(1);
});
it('should support multiline description when there is a @param', () => {
const { description, extractedTags } = parseJsDoc(
'This is a\nmultiline description\n@param event'
);
expect(description).toBe('This is a\nmultiline description');
expect(extractedTags.params).not.toBeNull();
expect(extractedTags.params[0].name).toBe('event');
});
it('should support multiline @param description', () => {
const { extractedTags } = parseJsDoc(
'@param event - This is a\nmultiline description\n@param anotherEvent'
);
expect(extractedTags.params).not.toBeNull();
expect(extractedTags.params[0].name).toBe('event');
expect(extractedTags.params[0].description).toBe('This is a\nmultiline description');
expect(extractedTags.params[1].name).toBe('anotherEvent');
});
['@arg', '@argument'].forEach(x => {
it(`should support ${x} alias`, () => {
const { extractedTags } = parseJsDoc(`${x} {SyntheticEvent} event - React event`);
expect(extractedTags.params).not.toBeNull();
expect(extractedTags.params[0].name).toBe('event');
expect(extractedTags.params[0].type).not.toBeNull();
expect(extractedTags.params[0].type.name).toBe('SyntheticEvent');
expect(extractedTags.params[0].description).toBe('React event');
});
});
describe('getTypeName', () => {
it('should support record type with a single field', () => {
const { extractedTags } = parseJsDoc('@param {{a: number}} event');
expect(extractedTags.params[0].getTypeName()).toBe('({a: number})');
});
it('should support record type with multiple fields', () => {
const { extractedTags } = parseJsDoc('@param {{a: number, b: string}} event');
expect(extractedTags.params[0].getTypeName()).toBe('({a: number, b: string})');
});
it('should support record type with a field having only a name', () => {
const { extractedTags } = parseJsDoc('@param {{a}} event');
expect(extractedTags.params[0].getTypeName()).toBe('({a})');
});
it('should support union type', () => {
const { extractedTags } = parseJsDoc('@param {(number|boolean)} event');
expect(extractedTags.params[0].getTypeName()).toBe('(number|boolean)');
});
it('should support array type', () => {
const { extractedTags } = parseJsDoc('@param {number[]} event');
expect(extractedTags.params[0].getTypeName()).toBe('number[]');
});
it('should support untyped array type', () => {
const { extractedTags } = parseJsDoc('@param {[]} event');
expect(extractedTags.params[0].getTypeName()).toBe('[]');
});
it('should support nullable type', () => {
const { extractedTags } = parseJsDoc('@param {?number} event');
expect(extractedTags.params[0].getTypeName()).toBe('number');
});
it('should support non nullable type', () => {
const { extractedTags } = parseJsDoc('@param {!number} event');
expect(extractedTags.params[0].getTypeName()).toBe('number');
});
it('should support optional param with []', () => {
const { extractedTags } = parseJsDoc('@param {number} [event]');
expect(extractedTags.params[0].getTypeName()).toBe('number');
});
it('should support optional param with =', () => {
const { extractedTags } = parseJsDoc('@param {number=} event');
expect(extractedTags.params[0].getTypeName()).toBe('number');
});
it('should support any type', () => {
const { extractedTags } = parseJsDoc('@param {*} event');
expect(extractedTags.params[0].getTypeName()).toBe('any');
});
});
describe('getPrettyName', () => {
it('should return @param name', () => {
const { extractedTags } = parseJsDoc('@param {SyntheticEvent} event - React event');
expect(extractedTags.params[0].getPrettyName()).toBe('event');
});
it('should fix missing space between the @param name and the description separator', () => {
const { extractedTags } = parseJsDoc('@param {SyntheticEvent} event- React event');
expect(extractedTags.params[0].getPrettyName()).toBe('event');
});
it('should fix @param name ending with . followed by a @returns tag', () => {
const { extractedTags } = parseJsDoc('@param {SyntheticEvent} event.\n');
expect(extractedTags.params[0].getPrettyName()).toBe('event');
});
});
});
describe('@returns', () => {
it('should ignore invalid @returns', () => {
const { extractedTags } = parseJsDoc('@returns');
expect(extractedTags.returns).toBeNull();
});
it('should return a @returns with a type', () => {
const { extractedTags } = parseJsDoc('@returns {string}');
expect(extractedTags.returns).not.toBeNull();
expect(extractedTags.returns.type).not.toBeNull();
expect(extractedTags.returns.type.name).toBe('string');
});
it('should return a @returns with a type and a description', () => {
const { extractedTags } = parseJsDoc('@returns {string} - A bar description');
expect(extractedTags.returns).not.toBeNull();
expect(extractedTags.returns.type).not.toBeNull();
expect(extractedTags.returns.type.name).toBe('string');
expect(extractedTags.returns.description).toBe('A bar description');
});
it('should support multiline @returns description', () => {
const { extractedTags } = parseJsDoc(
'@returns {string} - This is\na multiline\ndescription\n'
);
expect(extractedTags.returns).not.toBeNull();
expect(extractedTags.returns.type).not.toBeNull();
expect(extractedTags.returns.type.name).toBe('string');
expect(extractedTags.returns.description).toBe('This is\na multiline\ndescription');
});
it('should only consider the last @returns tag when there is multiple', () => {
const { extractedTags } = parseJsDoc('@returns {string}\n@returns {number}');
expect(extractedTags.returns).not.toBeNull();
expect(extractedTags.returns.type).not.toBeNull();
expect(extractedTags.returns.type.name).toBe('number');
});
describe('getTypeName', () => {
it('should support named type', () => {
const { extractedTags } = parseJsDoc('@returns {string}');
expect(extractedTags.returns.getTypeName()).toBe('string');
});
it('should support record type with a single field', () => {
const { extractedTags } = parseJsDoc('@returns {{a: number}}');
expect(extractedTags.returns.getTypeName()).toBe('({a: number})');
});
it('should support record type with multiple fields', () => {
const { extractedTags } = parseJsDoc('@returns {{a: number, b: string}}');
expect(extractedTags.returns.getTypeName()).toBe('({a: number, b: string})');
});
it('should support record type with a field having only a name', () => {
const { extractedTags } = parseJsDoc('@returns {{a}}');
expect(extractedTags.returns.getTypeName()).toBe('({a})');
});
it('should support array type', () => {
const { extractedTags } = parseJsDoc('@returns {integer[]}');
expect(extractedTags.returns.getTypeName()).toBe('integer[]');
});
it('should support untyped array type', () => {
const { extractedTags } = parseJsDoc('@returns {[]}');
expect(extractedTags.returns.getTypeName()).toBe('[]');
});
it('should support union type', () => {
const { extractedTags } = parseJsDoc('@returns {(number|boolean)}');
expect(extractedTags.returns.getTypeName()).toBe('(number|boolean)');
});
it('should support any type', () => {
const { extractedTags } = parseJsDoc('@returns {*}');
expect(extractedTags.returns.getTypeName()).toBe('any');
});
it('should support void', () => {
const { extractedTags } = parseJsDoc('@returns {void}');
expect(extractedTags.returns.getTypeName()).toBe('void');
});
});
});
it('should ignore unsupported JSDoc tags', () => {
const { extractedTags } = parseJsDoc('Hey!\n@param event', { tags: [] });
expect(extractedTags.params).toBeNull();
});
it('should remove extra newline characters between tags', () => {
const { extractedTags } = parseJsDoc(
'Hey!\n@param {SyntheticEvent} event - Original event.\n \n \n \n@returns {string}'
);
expect(extractedTags.params).not.toBeNull();
expect(Object.keys(extractedTags.params).length).toBe(1);
expect(extractedTags.params[0].name).toBe('event');
expect(extractedTags.params[0].type.name).toBe('SyntheticEvent');
expect(extractedTags.params[0].description).toBe('Original event.');
expect(extractedTags.returns).not.toBeNull();
expect(extractedTags.returns.type.name).toBe('string');
});
});
| addons/docs/src/lib/jsdocParser.test.ts | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.00041939536458812654,
0.00018330670718569309,
0.00016582850366830826,
0.0001690297940513119,
0.00004524385803961195
] |
{
"id": 5,
"code_window": [
"\n",
"interface SubheadingProps {\n",
" children: JSX.Element | string;\n",
"}\n",
"export const Subheading: FunctionComponent<SubheadingProps> = ({ children }) => <H3>{children}</H3>;\n"
],
"labels": [
"keep",
"replace",
"replace",
"replace",
"replace"
],
"after_edit": [
"export const Subheading: FunctionComponent<HeadingProps> = ({ children, disableAnchor }) => {\n",
" if (disableAnchor || typeof children !== 'string') {\n",
" return <H3>{children}</H3>;\n",
" }\n",
" const tagID = children.toLowerCase().replace(/[^a-z0-9]/gi, '-');\n",
" return (\n",
" <HeaderMdx as=\"h3\" id={tagID}>\n",
" {children}\n",
" </HeaderMdx>\n",
" );\n",
"};"
],
"file_path": "addons/docs/src/blocks/Subheading.tsx",
"type": "replace",
"edit_start_line_idx": 3
} | import React, { FunctionComponent } from 'react';
import { H2 } from '@storybook/components/html';
interface HeadingProps {
children: JSX.Element | string;
}
export const Heading: FunctionComponent<HeadingProps> = ({ children }) => <H2>{children}</H2>;
| addons/docs/src/blocks/Heading.tsx | 1 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.039781440049409866,
0.039781440049409866,
0.039781440049409866,
0.039781440049409866,
0
] |
{
"id": 5,
"code_window": [
"\n",
"interface SubheadingProps {\n",
" children: JSX.Element | string;\n",
"}\n",
"export const Subheading: FunctionComponent<SubheadingProps> = ({ children }) => <H3>{children}</H3>;\n"
],
"labels": [
"keep",
"replace",
"replace",
"replace",
"replace"
],
"after_edit": [
"export const Subheading: FunctionComponent<HeadingProps> = ({ children, disableAnchor }) => {\n",
" if (disableAnchor || typeof children !== 'string') {\n",
" return <H3>{children}</H3>;\n",
" }\n",
" const tagID = children.toLowerCase().replace(/[^a-z0-9]/gi, '-');\n",
" return (\n",
" <HeaderMdx as=\"h3\" id={tagID}>\n",
" {children}\n",
" </HeaderMdx>\n",
" );\n",
"};"
],
"file_path": "addons/docs/src/blocks/Subheading.tsx",
"type": "replace",
"edit_start_line_idx": 3
} | declare module 'global';
declare module 'json-fn';
| lib/channel-websocket/src/typings.d.ts | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.00017368566477671266,
0.00017368566477671266,
0.00017368566477671266,
0.00017368566477671266,
0
] |
{
"id": 5,
"code_window": [
"\n",
"interface SubheadingProps {\n",
" children: JSX.Element | string;\n",
"}\n",
"export const Subheading: FunctionComponent<SubheadingProps> = ({ children }) => <H3>{children}</H3>;\n"
],
"labels": [
"keep",
"replace",
"replace",
"replace",
"replace"
],
"after_edit": [
"export const Subheading: FunctionComponent<HeadingProps> = ({ children, disableAnchor }) => {\n",
" if (disableAnchor || typeof children !== 'string') {\n",
" return <H3>{children}</H3>;\n",
" }\n",
" const tagID = children.toLowerCase().replace(/[^a-z0-9]/gi, '-');\n",
" return (\n",
" <HeaderMdx as=\"h3\" id={tagID}>\n",
" {children}\n",
" </HeaderMdx>\n",
" );\n",
"};"
],
"file_path": "addons/docs/src/blocks/Subheading.tsx",
"type": "replace",
"edit_start_line_idx": 3
} | {
"extends": "tslint-config-airbnb",
"rules": {
"variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case"]
}
} | examples/cra-ts-kitchen-sink/tslint.json | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.00017086055595427752,
0.00017086055595427752,
0.00017086055595427752,
0.00017086055595427752,
0
] |
{
"id": 5,
"code_window": [
"\n",
"interface SubheadingProps {\n",
" children: JSX.Element | string;\n",
"}\n",
"export const Subheading: FunctionComponent<SubheadingProps> = ({ children }) => <H3>{children}</H3>;\n"
],
"labels": [
"keep",
"replace",
"replace",
"replace",
"replace"
],
"after_edit": [
"export const Subheading: FunctionComponent<HeadingProps> = ({ children, disableAnchor }) => {\n",
" if (disableAnchor || typeof children !== 'string') {\n",
" return <H3>{children}</H3>;\n",
" }\n",
" const tagID = children.toLowerCase().replace(/[^a-z0-9]/gi, '-');\n",
" return (\n",
" <HeaderMdx as=\"h3\" id={tagID}>\n",
" {children}\n",
" </HeaderMdx>\n",
" );\n",
"};"
],
"file_path": "addons/docs/src/blocks/Subheading.tsx",
"type": "replace",
"edit_start_line_idx": 3
} | import { configure } from '@storybook/react';
// automatically import all files ending in *.stories.js
configure(require.context('../src/stories', true, /\.stories\.js$/), module);
| lib/cli/generators/REACT_SCRIPTS/template-csf/.storybook/config.js | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.00017235695850104094,
0.00017235695850104094,
0.00017235695850104094,
0.00017235695850104094,
0
] |
{
"id": 6,
"code_window": [
"interface HeaderMdxProps {\n",
" as: string;\n",
" id: string;\n",
"}\n",
"\n",
"const HeaderMdx: FC<HeaderMdxProps> = props => {\n",
" const { as, id, children, ...rest } = props;\n",
"\n",
" // An id should have been added on every header by the \"remark-slug\" plugin.\n",
" if (!isNil(id)) {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"export const HeaderMdx: FC<HeaderMdxProps> = props => {\n"
],
"file_path": "addons/docs/src/blocks/mdx.tsx",
"type": "replace",
"edit_start_line_idx": 176
} | import React, { FunctionComponent } from 'react';
import { H2 } from '@storybook/components/html';
interface HeadingProps {
children: JSX.Element | string;
}
export const Heading: FunctionComponent<HeadingProps> = ({ children }) => <H2>{children}</H2>;
| addons/docs/src/blocks/Heading.tsx | 1 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.9033135771751404,
0.9033135771751404,
0.9033135771751404,
0.9033135771751404,
0
] |
{
"id": 6,
"code_window": [
"interface HeaderMdxProps {\n",
" as: string;\n",
" id: string;\n",
"}\n",
"\n",
"const HeaderMdx: FC<HeaderMdxProps> = props => {\n",
" const { as, id, children, ...rest } = props;\n",
"\n",
" // An id should have been added on every header by the \"remark-slug\" plugin.\n",
" if (!isNil(id)) {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"export const HeaderMdx: FC<HeaderMdxProps> = props => {\n"
],
"file_path": "addons/docs/src/blocks/mdx.tsx",
"type": "replace",
"edit_start_line_idx": 176
} | import React from 'react';
import Button from './Button';
export default {
title: 'Some.Button',
decorators: [withKnobs, storyFn => <div className="foo">{storyFn}</div>],
};
export const story1 = () => <Button label="The Button" />;
story1.story = {
name: 'with decorator',
decorators: [withKnobs],
};
| lib/codemod/src/transforms/__testfixtures__/csf-to-mdx/decorators.input.js | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.00017572329670656472,
0.00017416520859114826,
0.00017260710592381656,
0.00017416520859114826,
0.0000015580953913740814
] |
{
"id": 6,
"code_window": [
"interface HeaderMdxProps {\n",
" as: string;\n",
" id: string;\n",
"}\n",
"\n",
"const HeaderMdx: FC<HeaderMdxProps> = props => {\n",
" const { as, id, children, ...rest } = props;\n",
"\n",
" // An id should have been added on every header by the \"remark-slug\" plugin.\n",
" if (!isNil(id)) {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"export const HeaderMdx: FC<HeaderMdxProps> = props => {\n"
],
"file_path": "addons/docs/src/blocks/mdx.tsx",
"type": "replace",
"edit_start_line_idx": 176
} | export function babelDefault(config) {
return {
...config,
presets: [
...config.presets,
[
require.resolve('babel-preset-rax'),
{ development: process.env.BABEL_ENV === 'development' },
],
],
};
}
| app/rax/src/server/framework-preset-rax.js | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.00017149417544715106,
0.00017141932039521635,
0.0001713444507913664,
0.00017141932039521635,
7.486232789233327e-8
] |
{
"id": 6,
"code_window": [
"interface HeaderMdxProps {\n",
" as: string;\n",
" id: string;\n",
"}\n",
"\n",
"const HeaderMdx: FC<HeaderMdxProps> = props => {\n",
" const { as, id, children, ...rest } = props;\n",
"\n",
" // An id should have been added on every header by the \"remark-slug\" plugin.\n",
" if (!isNil(id)) {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"export const HeaderMdx: FC<HeaderMdxProps> = props => {\n"
],
"file_path": "addons/docs/src/blocks/mdx.tsx",
"type": "replace",
"edit_start_line_idx": 176
} | import React, { Component as ReactComponent, ComponentType } from 'react';
import { STORY_CHANGED } from '@storybook/core-events';
import { API } from '@storybook/api';
import { ADD_TESTS } from '../shared';
// TODO: import type from @types/jest
interface AssertionResult {
status: string;
fullName: string;
title: string;
failureMessages: string[];
}
export interface Test {
name: string;
result: {
status: string;
assertionResults: AssertionResult[];
};
}
interface InjectedProps {
tests?: Test[];
}
export interface HocProps {
api: API;
active?: boolean;
}
export interface HocState {
kind?: string;
storyName?: string;
tests?: Test[];
}
const provideTests = (Component: ComponentType<InjectedProps>) =>
class TestProvider extends ReactComponent<HocProps, HocState> {
state: HocState = {};
static defaultProps = {
active: false,
};
componentDidMount() {
this.mounted = true;
const { api } = this.props;
this.stopListeningOnStory = api.on(STORY_CHANGED, () => {
const { kind, storyName, tests } = this.state;
if (this.mounted && (kind || storyName || tests)) {
this.onAddTests({});
}
});
api.on(ADD_TESTS, this.onAddTests);
}
componentWillUnmount() {
this.mounted = false;
const { api } = this.props;
this.stopListeningOnStory();
api.off(ADD_TESTS, this.onAddTests);
}
onAddTests = ({ kind, storyName, tests }: HocState) => {
this.setState({ kind, storyName, tests });
};
mounted: boolean;
stopListeningOnStory: () => void;
render() {
const { active } = this.props;
const { tests } = this.state;
return active ? <Component tests={tests} /> : null;
}
};
export default provideTests;
| addons/jest/src/hoc/provideJestResult.tsx | 0 | https://github.com/storybookjs/storybook/commit/14df7d561a1d050b536d894b06154a820dc6f059 | [
0.006606452167034149,
0.0015427080215886235,
0.0001688469637883827,
0.0002325799287064001,
0.0021584457717835903
] |
{
"id": 0,
"code_window": [
" markerSize,\n",
" data1,\n",
" annotationData,\n",
" ),\n",
" );\n",
" }\n",
" });\n",
"\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" colorScale,\n",
" sliceId,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts",
"type": "add",
"edit_start_line_idx": 238
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import {
AnnotationData,
AnnotationOpacity,
CategoricalColorScale,
EventAnnotationLayer,
FilterState,
FormulaAnnotationLayer,
getTimeFormatter,
IntervalAnnotationLayer,
isTimeseriesAnnotationResult,
NumberFormatter,
smartDateDetailedFormatter,
smartDateFormatter,
TimeFormatter,
TimeseriesAnnotationLayer,
TimeseriesDataRecord,
} from '@superset-ui/core';
import { SeriesOption } from 'echarts';
import {
CallbackDataParams,
DefaultStatesMixin,
ItemStyleOption,
LineStyleOption,
OptionName,
SeriesLabelOption,
SeriesLineLabelOption,
ZRLineType,
} from 'echarts/types/src/util/types';
import {
MarkArea1DDataItemOption,
MarkArea2DDataItemOption,
} from 'echarts/types/src/component/marker/MarkAreaModel';
import { MarkLine1DDataItemOption } from 'echarts/types/src/component/marker/MarkLineModel';
import { extractForecastSeriesContext } from '../utils/forecast';
import { ForecastSeriesEnum, LegendOrientation } from '../types';
import { EchartsTimeseriesSeriesType } from './types';
import {
evalFormula,
extractRecordAnnotations,
formatAnnotationLabel,
parseAnnotationOpacity,
} from '../utils/annotation';
import { currentSeries, getChartPadding } from '../utils/series';
import { OpacityEnum, TIMESERIES_CONSTANTS } from '../constants';
export function transformSeries(
series: SeriesOption,
colorScale: CategoricalColorScale,
opts: {
area?: boolean;
filterState?: FilterState;
seriesContexts?: { [key: string]: ForecastSeriesEnum[] };
markerEnabled?: boolean;
markerSize?: number;
areaOpacity?: number;
seriesType?: EchartsTimeseriesSeriesType;
stack?: boolean;
yAxisIndex?: number;
showValue?: boolean;
onlyTotal?: boolean;
formatter?: NumberFormatter;
totalStackedValues?: number[];
showValueIndexes?: number[];
thresholdValues?: number[];
richTooltip?: boolean;
seriesKey?: OptionName;
sliceId?: number;
},
): SeriesOption | undefined {
const { name } = series;
const {
area,
filterState,
seriesContexts = {},
markerEnabled,
markerSize,
areaOpacity = 1,
seriesType,
stack,
yAxisIndex = 0,
showValue,
onlyTotal,
formatter,
totalStackedValues = [],
showValueIndexes = [],
thresholdValues = [],
richTooltip,
seriesKey,
sliceId,
} = opts;
const contexts = seriesContexts[name || ''] || [];
const hasForecast =
contexts.includes(ForecastSeriesEnum.ForecastTrend) ||
contexts.includes(ForecastSeriesEnum.ForecastLower) ||
contexts.includes(ForecastSeriesEnum.ForecastUpper);
const forecastSeries = extractForecastSeriesContext(name || '');
const isConfidenceBand =
forecastSeries.type === ForecastSeriesEnum.ForecastLower ||
forecastSeries.type === ForecastSeriesEnum.ForecastUpper;
const isFiltered =
filterState?.selectedValues && !filterState?.selectedValues.includes(name);
const opacity = isFiltered
? OpacityEnum.SemiTransparent
: OpacityEnum.NonTransparent;
// don't create a series if doing a stack or area chart and the result
// is a confidence band
if ((stack || area) && isConfidenceBand) return undefined;
const isObservation = forecastSeries.type === ForecastSeriesEnum.Observation;
const isTrend = forecastSeries.type === ForecastSeriesEnum.ForecastTrend;
let stackId;
if (isConfidenceBand) {
stackId = forecastSeries.name;
} else if (stack && isObservation) {
// the suffix of the observation series is '' (falsy), which disables
// stacking. Therefore we need to set something that is truthy.
stackId = 'obs';
} else if (stack && isTrend) {
stackId = forecastSeries.type;
}
let plotType;
if (
!isConfidenceBand &&
(seriesType === 'scatter' || (hasForecast && isObservation))
) {
plotType = 'scatter';
} else if (isConfidenceBand) {
plotType = 'line';
} else {
plotType = seriesType === 'bar' ? 'bar' : 'line';
}
// forcing the colorScale to return a different color for same metrics across different queries
const itemStyle = {
color: colorScale(seriesKey || forecastSeries.name, sliceId),
opacity,
};
let emphasis = {};
let showSymbol = false;
if (!isConfidenceBand) {
if (plotType === 'scatter') {
showSymbol = true;
} else if (hasForecast && isObservation) {
showSymbol = true;
} else if (plotType === 'line' && showValue) {
showSymbol = true;
} else if (plotType === 'line' && !richTooltip && !markerEnabled) {
// this is hack to make timeseries line chart clickable when tooltip trigger is 'item'
// so that the chart can emit cross-filtering
showSymbol = true;
itemStyle.opacity = 0;
emphasis = {
itemStyle: {
opacity: 1,
},
};
} else if (markerEnabled) {
showSymbol = true;
}
}
const lineStyle = isConfidenceBand
? { opacity: OpacityEnum.Transparent }
: { opacity };
return {
...series,
yAxisIndex,
name: forecastSeries.name,
itemStyle,
// @ts-ignore
type: plotType,
smooth: seriesType === 'smooth',
triggerLineEvent: true,
// @ts-ignore
step: ['start', 'middle', 'end'].includes(seriesType as string)
? seriesType
: undefined,
stack: stackId,
lineStyle,
areaStyle:
area || forecastSeries.type === ForecastSeriesEnum.ForecastUpper
? {
opacity: opacity * areaOpacity,
}
: undefined,
emphasis: {
// bold on hover as required since 5.3.0 to retain backwards feature parity:
// https://apache.github.io/echarts-handbook/en/basics/release-note/5-3-0/#removing-the-default-bolding-emphasis-effect-in-the-line-chart
// TODO: should consider only adding emphasis to currently hovered series
lineStyle: {
width: 'bolder',
},
...emphasis,
},
showSymbol,
symbolSize: markerSize,
label: {
show: !!showValue,
position: 'top',
formatter: (params: any) => {
const {
value: [, numericValue],
dataIndex,
seriesIndex,
seriesName,
} = params;
const isSelectedLegend = currentSeries.legend === seriesName;
if (!formatter) return numericValue;
if (!stack || isSelectedLegend) return formatter(numericValue);
if (!onlyTotal) {
if (numericValue >= thresholdValues[dataIndex]) {
return formatter(numericValue);
}
return '';
}
if (seriesIndex === showValueIndexes[dataIndex]) {
return formatter(totalStackedValues[dataIndex]);
}
return '';
},
},
};
}
export function transformFormulaAnnotation(
layer: FormulaAnnotationLayer,
data: TimeseriesDataRecord[],
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption {
const { name, color, opacity, width, style } = layer;
return {
name,
id: name,
itemStyle: {
color: color || colorScale(name, sliceId),
},
lineStyle: {
opacity: parseAnnotationOpacity(opacity),
type: style as ZRLineType,
width,
},
type: 'line',
smooth: true,
data: evalFormula(layer, data),
symbolSize: 0,
};
}
export function transformIntervalAnnotation(
layer: IntervalAnnotationLayer,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
annotations.forEach(annotation => {
const { name, color, opacity, showLabel } = layer;
const { descriptions, intervalEnd, time, title } = annotation;
const label = formatAnnotationLabel(name, title, descriptions);
const intervalData: (
| MarkArea1DDataItemOption
| MarkArea2DDataItemOption
)[] = [
[
{
name: label,
xAxis: time,
},
{
xAxis: intervalEnd,
},
],
];
const intervalLabel: SeriesLabelOption = showLabel
? {
show: true,
color: '#000000',
position: 'insideTop',
verticalAlign: 'top',
fontWeight: 'bold',
// @ts-ignore
emphasis: {
position: 'insideTop',
verticalAlign: 'top',
backgroundColor: '#ffffff',
},
}
: {
show: false,
color: '#000000',
// @ts-ignore
emphasis: {
fontWeight: 'bold',
show: true,
position: 'insideTop',
verticalAlign: 'top',
backgroundColor: '#ffffff',
},
};
series.push({
id: `Interval - ${label}`,
type: 'line',
animation: false,
markArea: {
silent: false,
itemStyle: {
color: color || colorScale(name, sliceId),
opacity: parseAnnotationOpacity(opacity || AnnotationOpacity.Medium),
emphasis: {
opacity: 0.8,
},
} as ItemStyleOption,
label: intervalLabel,
data: intervalData,
},
});
});
return series;
}
export function transformEventAnnotation(
layer: EventAnnotationLayer,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
annotations.forEach(annotation => {
const { name, color, opacity, style, width, showLabel } = layer;
const { descriptions, time, title } = annotation;
const label = formatAnnotationLabel(name, title, descriptions);
const eventData: MarkLine1DDataItemOption[] = [
{
name: label,
xAxis: time,
},
];
const lineStyle: LineStyleOption & DefaultStatesMixin['emphasis'] = {
width,
type: style as ZRLineType,
color: color || colorScale(name, sliceId),
opacity: parseAnnotationOpacity(opacity),
emphasis: {
width: width ? width + 1 : width,
opacity: 1,
},
};
const eventLabel: SeriesLineLabelOption = showLabel
? {
show: true,
color: '#000000',
position: 'insideEndTop',
fontWeight: 'bold',
formatter: (params: CallbackDataParams) => params.name,
// @ts-ignore
emphasis: {
backgroundColor: '#ffffff',
},
}
: {
show: false,
color: '#000000',
position: 'insideEndTop',
// @ts-ignore
emphasis: {
formatter: (params: CallbackDataParams) => params.name,
fontWeight: 'bold',
show: true,
backgroundColor: '#ffffff',
},
};
series.push({
id: `Event - ${label}`,
type: 'line',
animation: false,
markLine: {
silent: false,
symbol: 'none',
lineStyle,
label: eventLabel,
data: eventData,
},
});
});
return series;
}
export function transformTimeseriesAnnotation(
layer: TimeseriesAnnotationLayer,
markerSize: number,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
): SeriesOption[] {
const series: SeriesOption[] = [];
const { hideLine, name, opacity, showMarkers, style, width } = layer;
const result = annotationData[name];
if (isTimeseriesAnnotationResult(result)) {
result.forEach(annotation => {
const { key, values } = annotation;
series.push({
type: 'line',
id: key,
name: key,
data: values.map(row => [row.x, row.y] as [OptionName, number]),
symbolSize: showMarkers ? markerSize : 0,
lineStyle: {
opacity: parseAnnotationOpacity(opacity),
type: style as ZRLineType,
width: hideLine ? 0 : width,
},
});
});
}
return series;
}
export function getPadding(
showLegend: boolean,
legendOrientation: LegendOrientation,
addYAxisTitleOffset: boolean,
zoomable: boolean,
margin?: string | number | null,
addXAxisTitleOffset?: boolean,
yAxisTitlePosition?: string,
yAxisTitleMargin?: number,
xAxisTitleMargin?: number,
): {
bottom: number;
left: number;
right: number;
top: number;
} {
const yAxisOffset = addYAxisTitleOffset
? TIMESERIES_CONSTANTS.yAxisLabelTopOffset
: 0;
const xAxisOffset = addXAxisTitleOffset ? Number(xAxisTitleMargin) || 0 : 0;
return getChartPadding(showLegend, legendOrientation, margin, {
top:
yAxisTitlePosition && yAxisTitlePosition === 'Top'
? TIMESERIES_CONSTANTS.gridOffsetTop + (Number(yAxisTitleMargin) || 0)
: TIMESERIES_CONSTANTS.gridOffsetTop + yAxisOffset,
bottom: zoomable
? TIMESERIES_CONSTANTS.gridOffsetBottomZoomable + xAxisOffset
: TIMESERIES_CONSTANTS.gridOffsetBottom + xAxisOffset,
left:
yAxisTitlePosition === 'Left'
? TIMESERIES_CONSTANTS.gridOffsetLeft + (Number(yAxisTitleMargin) || 0)
: TIMESERIES_CONSTANTS.gridOffsetLeft,
right:
showLegend && legendOrientation === LegendOrientation.Right
? 0
: TIMESERIES_CONSTANTS.gridOffsetRight,
});
}
export function getTooltipTimeFormatter(
format?: string,
): TimeFormatter | StringConstructor {
if (format === smartDateFormatter.id) {
return smartDateDetailedFormatter;
}
if (format) {
return getTimeFormatter(format);
}
return String;
}
export function getXAxisFormatter(
format?: string,
): TimeFormatter | StringConstructor | undefined {
if (format === smartDateFormatter.id || !format) {
return undefined;
}
if (format) {
return getTimeFormatter(format);
}
return String;
}
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts | 1 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.006954318378120661,
0.0006347577436827123,
0.00016396377759519964,
0.00017392630979884416,
0.0013730641221627593
] |
{
"id": 0,
"code_window": [
" markerSize,\n",
" data1,\n",
" annotationData,\n",
" ),\n",
" );\n",
" }\n",
" });\n",
"\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" colorScale,\n",
" sliceId,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts",
"type": "add",
"edit_start_line_idx": 238
} | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""allow_run_sync_async
Revision ID: 4500485bde7d
Revises: 41f6a59a61f2
Create Date: 2016-09-12 23:33:14.789632
"""
# revision identifiers, used by Alembic.
revision = "4500485bde7d"
down_revision = "41f6a59a61f2"
import sqlalchemy as sa
from alembic import op
def upgrade():
op.add_column("dbs", sa.Column("allow_run_async", sa.Boolean(), nullable=True))
op.add_column("dbs", sa.Column("allow_run_sync", sa.Boolean(), nullable=True))
def downgrade():
try:
op.drop_column("dbs", "allow_run_sync")
op.drop_column("dbs", "allow_run_async")
except Exception:
pass
| superset/migrations/versions/4500485bde7d_allow_run_sync_async.py | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.0001727676426526159,
0.00017166852194350213,
0.0001698578125797212,
0.0001723766908980906,
0.0000012142161267547635
] |
{
"id": 0,
"code_window": [
" markerSize,\n",
" data1,\n",
" annotationData,\n",
" ),\n",
" );\n",
" }\n",
" });\n",
"\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" colorScale,\n",
" sliceId,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts",
"type": "add",
"edit_start_line_idx": 238
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
D3_FORMAT_OPTIONS,
D3_FORMAT_DOCS,
sections,
} from '@superset-ui/chart-controls';
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Query'),
expanded: true,
controlSetRows: [
['metrics'],
['adhoc_filters'],
['groupby'],
['row_limit'],
['timeseries_limit_metric'],
['order_desc'],
],
},
{
label: t('Chart Options'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
['color_scheme'],
[
{
name: 'treemap_ratio',
config: {
type: 'TextControl',
label: t('Ratio'),
renderTrigger: true,
isFloat: true,
default: 0.5 * (1 + Math.sqrt(5)), // d3 default, golden ratio
description: t('Target aspect ratio for treemap tiles.'),
},
},
],
[
{
name: 'number_format',
config: {
type: 'SelectControl',
freeForm: true,
label: t('Number format'),
renderTrigger: true,
default: 'SMART_NUMBER',
choices: D3_FORMAT_OPTIONS,
description: D3_FORMAT_DOCS,
},
},
],
],
},
],
controlOverrides: {
color_scheme: {
renderTrigger: false,
},
},
};
export default config;
| superset-frontend/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00017443402612116188,
0.00017145245510619134,
0.00016333803068846464,
0.00017276930157095194,
0.00000330061948261573
] |
{
"id": 0,
"code_window": [
" markerSize,\n",
" data1,\n",
" annotationData,\n",
" ),\n",
" );\n",
" }\n",
" });\n",
"\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" colorScale,\n",
" sliceId,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts",
"type": "add",
"edit_start_line_idx": 238
} | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
| tests/unit_tests/datasets/commands/importers/v1/__init__.py | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00017325942462775856,
0.00017301345360465348,
0.0001727674825815484,
0.00017301345360465348,
2.459710231050849e-7
] |
{
"id": 1,
"code_window": [
" layer,\n",
" markerSize,\n",
" data,\n",
" annotationData,\n",
" ),\n",
" );\n",
" }\n",
" });\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" colorScale,\n",
" sliceId,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts",
"type": "add",
"edit_start_line_idx": 261
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import {
AnnotationData,
AnnotationOpacity,
CategoricalColorScale,
EventAnnotationLayer,
FilterState,
FormulaAnnotationLayer,
getTimeFormatter,
IntervalAnnotationLayer,
isTimeseriesAnnotationResult,
NumberFormatter,
smartDateDetailedFormatter,
smartDateFormatter,
TimeFormatter,
TimeseriesAnnotationLayer,
TimeseriesDataRecord,
} from '@superset-ui/core';
import { SeriesOption } from 'echarts';
import {
CallbackDataParams,
DefaultStatesMixin,
ItemStyleOption,
LineStyleOption,
OptionName,
SeriesLabelOption,
SeriesLineLabelOption,
ZRLineType,
} from 'echarts/types/src/util/types';
import {
MarkArea1DDataItemOption,
MarkArea2DDataItemOption,
} from 'echarts/types/src/component/marker/MarkAreaModel';
import { MarkLine1DDataItemOption } from 'echarts/types/src/component/marker/MarkLineModel';
import { extractForecastSeriesContext } from '../utils/forecast';
import { ForecastSeriesEnum, LegendOrientation } from '../types';
import { EchartsTimeseriesSeriesType } from './types';
import {
evalFormula,
extractRecordAnnotations,
formatAnnotationLabel,
parseAnnotationOpacity,
} from '../utils/annotation';
import { currentSeries, getChartPadding } from '../utils/series';
import { OpacityEnum, TIMESERIES_CONSTANTS } from '../constants';
export function transformSeries(
series: SeriesOption,
colorScale: CategoricalColorScale,
opts: {
area?: boolean;
filterState?: FilterState;
seriesContexts?: { [key: string]: ForecastSeriesEnum[] };
markerEnabled?: boolean;
markerSize?: number;
areaOpacity?: number;
seriesType?: EchartsTimeseriesSeriesType;
stack?: boolean;
yAxisIndex?: number;
showValue?: boolean;
onlyTotal?: boolean;
formatter?: NumberFormatter;
totalStackedValues?: number[];
showValueIndexes?: number[];
thresholdValues?: number[];
richTooltip?: boolean;
seriesKey?: OptionName;
sliceId?: number;
},
): SeriesOption | undefined {
const { name } = series;
const {
area,
filterState,
seriesContexts = {},
markerEnabled,
markerSize,
areaOpacity = 1,
seriesType,
stack,
yAxisIndex = 0,
showValue,
onlyTotal,
formatter,
totalStackedValues = [],
showValueIndexes = [],
thresholdValues = [],
richTooltip,
seriesKey,
sliceId,
} = opts;
const contexts = seriesContexts[name || ''] || [];
const hasForecast =
contexts.includes(ForecastSeriesEnum.ForecastTrend) ||
contexts.includes(ForecastSeriesEnum.ForecastLower) ||
contexts.includes(ForecastSeriesEnum.ForecastUpper);
const forecastSeries = extractForecastSeriesContext(name || '');
const isConfidenceBand =
forecastSeries.type === ForecastSeriesEnum.ForecastLower ||
forecastSeries.type === ForecastSeriesEnum.ForecastUpper;
const isFiltered =
filterState?.selectedValues && !filterState?.selectedValues.includes(name);
const opacity = isFiltered
? OpacityEnum.SemiTransparent
: OpacityEnum.NonTransparent;
// don't create a series if doing a stack or area chart and the result
// is a confidence band
if ((stack || area) && isConfidenceBand) return undefined;
const isObservation = forecastSeries.type === ForecastSeriesEnum.Observation;
const isTrend = forecastSeries.type === ForecastSeriesEnum.ForecastTrend;
let stackId;
if (isConfidenceBand) {
stackId = forecastSeries.name;
} else if (stack && isObservation) {
// the suffix of the observation series is '' (falsy), which disables
// stacking. Therefore we need to set something that is truthy.
stackId = 'obs';
} else if (stack && isTrend) {
stackId = forecastSeries.type;
}
let plotType;
if (
!isConfidenceBand &&
(seriesType === 'scatter' || (hasForecast && isObservation))
) {
plotType = 'scatter';
} else if (isConfidenceBand) {
plotType = 'line';
} else {
plotType = seriesType === 'bar' ? 'bar' : 'line';
}
// forcing the colorScale to return a different color for same metrics across different queries
const itemStyle = {
color: colorScale(seriesKey || forecastSeries.name, sliceId),
opacity,
};
let emphasis = {};
let showSymbol = false;
if (!isConfidenceBand) {
if (plotType === 'scatter') {
showSymbol = true;
} else if (hasForecast && isObservation) {
showSymbol = true;
} else if (plotType === 'line' && showValue) {
showSymbol = true;
} else if (plotType === 'line' && !richTooltip && !markerEnabled) {
// this is hack to make timeseries line chart clickable when tooltip trigger is 'item'
// so that the chart can emit cross-filtering
showSymbol = true;
itemStyle.opacity = 0;
emphasis = {
itemStyle: {
opacity: 1,
},
};
} else if (markerEnabled) {
showSymbol = true;
}
}
const lineStyle = isConfidenceBand
? { opacity: OpacityEnum.Transparent }
: { opacity };
return {
...series,
yAxisIndex,
name: forecastSeries.name,
itemStyle,
// @ts-ignore
type: plotType,
smooth: seriesType === 'smooth',
triggerLineEvent: true,
// @ts-ignore
step: ['start', 'middle', 'end'].includes(seriesType as string)
? seriesType
: undefined,
stack: stackId,
lineStyle,
areaStyle:
area || forecastSeries.type === ForecastSeriesEnum.ForecastUpper
? {
opacity: opacity * areaOpacity,
}
: undefined,
emphasis: {
// bold on hover as required since 5.3.0 to retain backwards feature parity:
// https://apache.github.io/echarts-handbook/en/basics/release-note/5-3-0/#removing-the-default-bolding-emphasis-effect-in-the-line-chart
// TODO: should consider only adding emphasis to currently hovered series
lineStyle: {
width: 'bolder',
},
...emphasis,
},
showSymbol,
symbolSize: markerSize,
label: {
show: !!showValue,
position: 'top',
formatter: (params: any) => {
const {
value: [, numericValue],
dataIndex,
seriesIndex,
seriesName,
} = params;
const isSelectedLegend = currentSeries.legend === seriesName;
if (!formatter) return numericValue;
if (!stack || isSelectedLegend) return formatter(numericValue);
if (!onlyTotal) {
if (numericValue >= thresholdValues[dataIndex]) {
return formatter(numericValue);
}
return '';
}
if (seriesIndex === showValueIndexes[dataIndex]) {
return formatter(totalStackedValues[dataIndex]);
}
return '';
},
},
};
}
export function transformFormulaAnnotation(
layer: FormulaAnnotationLayer,
data: TimeseriesDataRecord[],
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption {
const { name, color, opacity, width, style } = layer;
return {
name,
id: name,
itemStyle: {
color: color || colorScale(name, sliceId),
},
lineStyle: {
opacity: parseAnnotationOpacity(opacity),
type: style as ZRLineType,
width,
},
type: 'line',
smooth: true,
data: evalFormula(layer, data),
symbolSize: 0,
};
}
export function transformIntervalAnnotation(
layer: IntervalAnnotationLayer,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
annotations.forEach(annotation => {
const { name, color, opacity, showLabel } = layer;
const { descriptions, intervalEnd, time, title } = annotation;
const label = formatAnnotationLabel(name, title, descriptions);
const intervalData: (
| MarkArea1DDataItemOption
| MarkArea2DDataItemOption
)[] = [
[
{
name: label,
xAxis: time,
},
{
xAxis: intervalEnd,
},
],
];
const intervalLabel: SeriesLabelOption = showLabel
? {
show: true,
color: '#000000',
position: 'insideTop',
verticalAlign: 'top',
fontWeight: 'bold',
// @ts-ignore
emphasis: {
position: 'insideTop',
verticalAlign: 'top',
backgroundColor: '#ffffff',
},
}
: {
show: false,
color: '#000000',
// @ts-ignore
emphasis: {
fontWeight: 'bold',
show: true,
position: 'insideTop',
verticalAlign: 'top',
backgroundColor: '#ffffff',
},
};
series.push({
id: `Interval - ${label}`,
type: 'line',
animation: false,
markArea: {
silent: false,
itemStyle: {
color: color || colorScale(name, sliceId),
opacity: parseAnnotationOpacity(opacity || AnnotationOpacity.Medium),
emphasis: {
opacity: 0.8,
},
} as ItemStyleOption,
label: intervalLabel,
data: intervalData,
},
});
});
return series;
}
export function transformEventAnnotation(
layer: EventAnnotationLayer,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
annotations.forEach(annotation => {
const { name, color, opacity, style, width, showLabel } = layer;
const { descriptions, time, title } = annotation;
const label = formatAnnotationLabel(name, title, descriptions);
const eventData: MarkLine1DDataItemOption[] = [
{
name: label,
xAxis: time,
},
];
const lineStyle: LineStyleOption & DefaultStatesMixin['emphasis'] = {
width,
type: style as ZRLineType,
color: color || colorScale(name, sliceId),
opacity: parseAnnotationOpacity(opacity),
emphasis: {
width: width ? width + 1 : width,
opacity: 1,
},
};
const eventLabel: SeriesLineLabelOption = showLabel
? {
show: true,
color: '#000000',
position: 'insideEndTop',
fontWeight: 'bold',
formatter: (params: CallbackDataParams) => params.name,
// @ts-ignore
emphasis: {
backgroundColor: '#ffffff',
},
}
: {
show: false,
color: '#000000',
position: 'insideEndTop',
// @ts-ignore
emphasis: {
formatter: (params: CallbackDataParams) => params.name,
fontWeight: 'bold',
show: true,
backgroundColor: '#ffffff',
},
};
series.push({
id: `Event - ${label}`,
type: 'line',
animation: false,
markLine: {
silent: false,
symbol: 'none',
lineStyle,
label: eventLabel,
data: eventData,
},
});
});
return series;
}
export function transformTimeseriesAnnotation(
layer: TimeseriesAnnotationLayer,
markerSize: number,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
): SeriesOption[] {
const series: SeriesOption[] = [];
const { hideLine, name, opacity, showMarkers, style, width } = layer;
const result = annotationData[name];
if (isTimeseriesAnnotationResult(result)) {
result.forEach(annotation => {
const { key, values } = annotation;
series.push({
type: 'line',
id: key,
name: key,
data: values.map(row => [row.x, row.y] as [OptionName, number]),
symbolSize: showMarkers ? markerSize : 0,
lineStyle: {
opacity: parseAnnotationOpacity(opacity),
type: style as ZRLineType,
width: hideLine ? 0 : width,
},
});
});
}
return series;
}
export function getPadding(
showLegend: boolean,
legendOrientation: LegendOrientation,
addYAxisTitleOffset: boolean,
zoomable: boolean,
margin?: string | number | null,
addXAxisTitleOffset?: boolean,
yAxisTitlePosition?: string,
yAxisTitleMargin?: number,
xAxisTitleMargin?: number,
): {
bottom: number;
left: number;
right: number;
top: number;
} {
const yAxisOffset = addYAxisTitleOffset
? TIMESERIES_CONSTANTS.yAxisLabelTopOffset
: 0;
const xAxisOffset = addXAxisTitleOffset ? Number(xAxisTitleMargin) || 0 : 0;
return getChartPadding(showLegend, legendOrientation, margin, {
top:
yAxisTitlePosition && yAxisTitlePosition === 'Top'
? TIMESERIES_CONSTANTS.gridOffsetTop + (Number(yAxisTitleMargin) || 0)
: TIMESERIES_CONSTANTS.gridOffsetTop + yAxisOffset,
bottom: zoomable
? TIMESERIES_CONSTANTS.gridOffsetBottomZoomable + xAxisOffset
: TIMESERIES_CONSTANTS.gridOffsetBottom + xAxisOffset,
left:
yAxisTitlePosition === 'Left'
? TIMESERIES_CONSTANTS.gridOffsetLeft + (Number(yAxisTitleMargin) || 0)
: TIMESERIES_CONSTANTS.gridOffsetLeft,
right:
showLegend && legendOrientation === LegendOrientation.Right
? 0
: TIMESERIES_CONSTANTS.gridOffsetRight,
});
}
export function getTooltipTimeFormatter(
format?: string,
): TimeFormatter | StringConstructor {
if (format === smartDateFormatter.id) {
return smartDateDetailedFormatter;
}
if (format) {
return getTimeFormatter(format);
}
return String;
}
export function getXAxisFormatter(
format?: string,
): TimeFormatter | StringConstructor | undefined {
if (format === smartDateFormatter.id || !format) {
return undefined;
}
if (format) {
return getTimeFormatter(format);
}
return String;
}
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts | 1 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.012131775729358196,
0.001137405401095748,
0.00016461544146295637,
0.00017579266568645835,
0.0023136280942708254
] |
{
"id": 1,
"code_window": [
" layer,\n",
" markerSize,\n",
" data,\n",
" annotationData,\n",
" ),\n",
" );\n",
" }\n",
" });\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" colorScale,\n",
" sliceId,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts",
"type": "add",
"edit_start_line_idx": 261
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { t, ChartMetadata, ChartPlugin } from '@superset-ui/core';
import transformProps from '../transformProps';
import thumbnail from './images/thumbnail.png';
import example1 from './images/Bar_Chart.jpg';
import example2 from './images/Bar_Chart_2.jpg';
import example3 from './images/BarChart3.jpg';
import controlPanel from './controlPanel';
const metadata = new ChartMetadata({
category: t('Ranking'),
credits: ['http://nvd3.org'],
description: t(
'Compares metrics from different categories using bars. Bar lengths are used to indicate the magnitude of each value and color is used to differentiate groups.',
),
exampleGallery: [
{ url: example1, caption: 'Stacked style' },
{ url: example2, caption: 'Grouped style' },
{ url: example3 },
],
name: t('Bar Chart'),
tags: [
t('Additive'),
t('Bar'),
t('Categorical'),
t('Comparison'),
t('Discrete'),
t('Legacy'),
t('Percentages'),
t('Popular'),
t('Stacked'),
t('Vertical'),
t('nvd3'),
],
thumbnail,
useLegacyApi: true,
});
export default class DistBarChartPlugin extends ChartPlugin {
constructor() {
super({
loadChart: () => import('../ReactNVD3'),
metadata,
transformProps,
controlPanel,
});
}
}
| superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/index.js | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00018851486674975604,
0.00017655195551924407,
0.00017083548300433904,
0.0001748635113472119,
0.0000052749060159840155
] |
{
"id": 1,
"code_window": [
" layer,\n",
" markerSize,\n",
" data,\n",
" annotationData,\n",
" ),\n",
" );\n",
" }\n",
" });\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" colorScale,\n",
" sliceId,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts",
"type": "add",
"edit_start_line_idx": 261
} | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# isort:skip_file
"""Unit tests for Sql Lab"""
import json
from datetime import datetime, timedelta
import pytest
from celery.exceptions import SoftTimeLimitExceeded
from parameterized import parameterized
from random import random
from unittest import mock
import prison
from freezegun import freeze_time
from superset import db, security_manager
from superset.connectors.sqla.models import SqlaTable
from superset.db_engine_specs import BaseEngineSpec
from superset.db_engine_specs.hive import HiveEngineSpec
from superset.db_engine_specs.presto import PrestoEngineSpec
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.exceptions import SupersetErrorException
from superset.models.sql_lab import Query, SavedQuery
from superset.result_set import SupersetResultSet
from superset.sqllab.limiting_factor import LimitingFactor
from superset.sql_lab import (
cancel_query,
execute_sql_statements,
apply_limit_if_exists,
)
from superset.sql_parse import CtasMethod
from superset.utils.core import (
backend,
datetime_to_epoch,
)
from superset.utils.database import get_example_database, get_main_database
from .base_tests import SupersetTestCase
from .conftest import CTAS_SCHEMA_NAME
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
QUERY_1 = "SELECT * FROM birth_names LIMIT 1"
QUERY_2 = "SELECT * FROM NO_TABLE"
QUERY_3 = "SELECT * FROM birth_names LIMIT 10"
@pytest.mark.sql_json_flow
class TestSqlLab(SupersetTestCase):
"""Testings for Sql Lab"""
def run_some_queries(self):
db.session.query(Query).delete()
db.session.commit()
self.run_sql(QUERY_1, client_id="client_id_1", user_name="admin")
self.run_sql(QUERY_2, client_id="client_id_3", user_name="admin")
self.run_sql(QUERY_3, client_id="client_id_2", user_name="gamma_sqllab")
self.logout()
def tearDown(self):
self.logout()
db.session.query(Query).delete()
db.session.commit()
db.session.close()
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_sql_json(self):
examples_db = get_example_database()
engine_name = examples_db.db_engine_spec.engine_name
self.login("admin")
data = self.run_sql("SELECT * FROM birth_names LIMIT 10", "1")
self.assertLess(0, len(data["data"]))
data = self.run_sql("SELECT * FROM unexistant_table", "2")
if backend() == "presto":
assert (
data["errors"][0]["error_type"]
== SupersetErrorType.TABLE_DOES_NOT_EXIST_ERROR
)
assert data["errors"][0]["level"] == ErrorLevel.ERROR
assert data["errors"][0]["extra"] == {
"engine_name": "Presto",
"issue_codes": [
{
"code": 1003,
"message": "Issue 1003 - There is a syntax error in the SQL query. Perhaps there was a misspelling or a typo.",
},
{
"code": 1005,
"message": "Issue 1005 - The table was deleted or renamed in the database.",
},
],
}
else:
assert (
data["errors"][0]["error_type"]
== SupersetErrorType.GENERIC_DB_ENGINE_ERROR
)
assert data["errors"][0]["level"] == ErrorLevel.ERROR
assert data["errors"][0]["extra"] == {
"issue_codes": [
{
"code": 1002,
"message": "Issue 1002 - The database returned an unexpected error.",
}
],
"engine_name": engine_name,
}
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_sql_json_dml_disallowed(self):
self.login("admin")
data = self.run_sql("DELETE FROM birth_names", "1")
assert data == {
"errors": [
{
"message": "Only SELECT statements are allowed against this database.",
"error_type": SupersetErrorType.DML_NOT_ALLOWED_ERROR,
"level": ErrorLevel.ERROR,
"extra": {
"issue_codes": [
{
"code": 1022,
"message": "Issue 1022 - Database does not allow data manipulation.",
}
]
},
}
]
}
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_sql_json_to_saved_query_info(self):
"""
SQLLab: Test SQLLab query execution info propagation to saved queries
"""
self.login("admin")
sql_statement = "SELECT * FROM birth_names LIMIT 10"
examples_db_id = get_example_database().id
saved_query = SavedQuery(db_id=examples_db_id, sql=sql_statement)
db.session.add(saved_query)
db.session.commit()
with freeze_time(datetime.now().isoformat(timespec="seconds")):
self.run_sql(sql_statement, "1")
saved_query_ = (
db.session.query(SavedQuery)
.filter(
SavedQuery.db_id == examples_db_id, SavedQuery.sql == sql_statement
)
.one_or_none()
)
assert saved_query_.rows is not None
assert saved_query_.last_run == datetime.now()
# Rollback changes
db.session.delete(saved_query_)
db.session.commit()
@parameterized.expand([CtasMethod.TABLE, CtasMethod.VIEW])
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_sql_json_cta_dynamic_db(self, ctas_method):
examples_db = get_example_database()
if examples_db.backend == "sqlite":
# sqlite doesn't support database creation
return
with mock.patch(
"superset.sqllab.sqllab_execution_context.get_cta_schema_name",
lambda d, u, s, sql: f"{u.username}_database",
):
old_allow_ctas = examples_db.allow_ctas
examples_db.allow_ctas = True # enable cta
self.login("admin")
tmp_table_name = f"test_target_{ctas_method.lower()}"
self.run_sql(
"SELECT * FROM birth_names",
"1",
database_name="examples",
tmp_table_name=tmp_table_name,
select_as_cta=True,
ctas_method=ctas_method,
)
# assertions
db.session.commit()
examples_db = get_example_database()
engine = examples_db.get_sqla_engine()
data = engine.execute(
f"SELECT * FROM admin_database.{tmp_table_name}"
).fetchall()
names_count = engine.execute(f"SELECT COUNT(*) FROM birth_names").first()
self.assertEqual(
names_count[0], len(data)
) # SQL_MAX_ROW not applied due to the SQLLAB_CTAS_NO_LIMIT set to True
# cleanup
engine.execute(f"DROP {ctas_method} admin_database.{tmp_table_name}")
examples_db.allow_ctas = old_allow_ctas
db.session.commit()
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_multi_sql(self):
self.login("admin")
multi_sql = """
SELECT * FROM birth_names LIMIT 1;
SELECT * FROM birth_names LIMIT 2;
"""
data = self.run_sql(multi_sql, "2234")
self.assertLess(0, len(data["data"]))
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_explain(self):
self.login("admin")
data = self.run_sql("EXPLAIN SELECT * FROM birth_names", "1")
self.assertLess(0, len(data["data"]))
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_sql_json_has_access(self):
examples_db = get_example_database()
examples_db_permission_view = security_manager.add_permission_view_menu(
"database_access", examples_db.perm
)
astronaut = security_manager.add_role("ExampleDBAccess")
security_manager.add_permission_role(astronaut, examples_db_permission_view)
# Gamma user, with sqllab and db permission
self.create_user_with_roles("Gagarin", ["ExampleDBAccess", "Gamma", "sql_lab"])
data = self.run_sql(QUERY_1, "1", user_name="Gagarin")
db.session.query(Query).delete()
db.session.commit()
self.assertLess(0, len(data["data"]))
def test_sql_json_schema_access(self):
examples_db = get_example_database()
db_backend = examples_db.backend
if db_backend == "sqlite":
# sqlite doesn't support database creation
return
sqllab_test_db_schema_permission_view = (
security_manager.add_permission_view_menu(
"schema_access", f"[{examples_db.name}].[{CTAS_SCHEMA_NAME}]"
)
)
schema_perm_role = security_manager.add_role("SchemaPermission")
security_manager.add_permission_role(
schema_perm_role, sqllab_test_db_schema_permission_view
)
self.create_user_with_roles(
"SchemaUser", ["SchemaPermission", "Gamma", "sql_lab"]
)
examples_db.get_sqla_engine().execute(
f"CREATE TABLE IF NOT EXISTS {CTAS_SCHEMA_NAME}.test_table AS SELECT 1 as c1, 2 as c2"
)
data = self.run_sql(
f"SELECT * FROM {CTAS_SCHEMA_NAME}.test_table", "3", user_name="SchemaUser"
)
self.assertEqual(1, len(data["data"]))
data = self.run_sql(
f"SELECT * FROM {CTAS_SCHEMA_NAME}.test_table",
"4",
user_name="SchemaUser",
schema=CTAS_SCHEMA_NAME,
)
self.assertEqual(1, len(data["data"]))
# postgres needs a schema as a part of the table name.
if db_backend == "mysql":
data = self.run_sql(
"SELECT * FROM test_table",
"5",
user_name="SchemaUser",
schema=CTAS_SCHEMA_NAME,
)
self.assertEqual(1, len(data["data"]))
db.session.query(Query).delete()
get_example_database().get_sqla_engine().execute(
f"DROP TABLE IF EXISTS {CTAS_SCHEMA_NAME}.test_table"
)
db.session.commit()
def test_queries_endpoint(self):
self.run_some_queries()
# Not logged in, should error out
resp = self.client.get("/superset/queries/0")
# Redirects to the login page
self.assertEqual(401, resp.status_code)
# Admin sees queries
self.login("admin")
data = self.get_json_resp("/superset/queries/0")
self.assertEqual(2, len(data))
data = self.get_json_resp("/superset/queries/0.0")
self.assertEqual(2, len(data))
# Run 2 more queries
self.run_sql("SELECT * FROM birth_names LIMIT 1", client_id="client_id_4")
self.run_sql("SELECT * FROM birth_names LIMIT 2", client_id="client_id_5")
self.login("admin")
data = self.get_json_resp("/superset/queries/0")
self.assertEqual(4, len(data))
now = datetime.now() + timedelta(days=1)
query = (
db.session.query(Query)
.filter_by(sql="SELECT * FROM birth_names LIMIT 1")
.first()
)
query.changed_on = now
db.session.commit()
data = self.get_json_resp(
"/superset/queries/{}".format(float(datetime_to_epoch(now)) - 1000)
)
self.assertEqual(1, len(data))
self.logout()
resp = self.client.get("/superset/queries/0")
# Redirects to the login page
self.assertEqual(401, resp.status_code)
def test_search_query_on_db_id(self):
self.run_some_queries()
self.login("admin")
examples_dbid = get_example_database().id
# Test search queries on database Id
data = self.get_json_resp(
f"/superset/search_queries?database_id={examples_dbid}"
)
self.assertEqual(3, len(data))
db_ids = [k["dbId"] for k in data]
self.assertEqual([examples_dbid for i in range(3)], db_ids)
resp = self.get_resp("/superset/search_queries?database_id=-1")
data = json.loads(resp)
self.assertEqual(0, len(data))
def test_search_query_on_user(self):
self.run_some_queries()
self.login("admin")
# Test search queries on user Id
user_id = security_manager.find_user("admin").id
data = self.get_json_resp("/superset/search_queries?user_id={}".format(user_id))
self.assertEqual(2, len(data))
user_ids = {k["userId"] for k in data}
self.assertEqual(set([user_id]), user_ids)
user_id = security_manager.find_user("gamma_sqllab").id
resp = self.get_resp("/superset/search_queries?user_id={}".format(user_id))
data = json.loads(resp)
self.assertEqual(1, len(data))
self.assertEqual(data[0]["userId"], user_id)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_search_query_on_status(self):
self.run_some_queries()
self.login("admin")
# Test search queries on status
resp = self.get_resp("/superset/search_queries?status=success")
data = json.loads(resp)
self.assertEqual(2, len(data))
states = [k["state"] for k in data]
self.assertEqual(["success", "success"], states)
resp = self.get_resp("/superset/search_queries?status=failed")
data = json.loads(resp)
self.assertEqual(1, len(data))
self.assertEqual(data[0]["state"], "failed")
def test_search_query_on_text(self):
self.run_some_queries()
self.login("admin")
url = "/superset/search_queries?search_text=birth"
data = self.get_json_resp(url)
self.assertEqual(2, len(data))
self.assertIn("birth", data[0]["sql"])
def test_search_query_on_time(self):
self.run_some_queries()
self.login("admin")
first_query_time = (
db.session.query(Query).filter_by(sql=QUERY_1).one()
).start_time
second_query_time = (
db.session.query(Query).filter_by(sql=QUERY_3).one()
).start_time
# Test search queries on time filter
from_time = "from={}".format(int(first_query_time))
to_time = "to={}".format(int(second_query_time))
params = [from_time, to_time]
resp = self.get_resp("/superset/search_queries?" + "&".join(params))
data = json.loads(resp)
self.assertEqual(2, len(data))
def test_search_query_only_owned(self) -> None:
"""
Test a search query with a user that does not have can_access_all_queries.
"""
# Test search_queries for Alpha user
self.run_some_queries()
self.login("gamma_sqllab")
user_id = security_manager.find_user("gamma_sqllab").id
data = self.get_json_resp("/superset/search_queries")
self.assertEqual(1, len(data))
user_ids = {k["userId"] for k in data}
self.assertEqual(set([user_id]), user_ids)
def test_alias_duplicate(self):
self.run_sql(
"SELECT name as col, gender as col FROM birth_names LIMIT 10",
client_id="2e2df3",
user_name="admin",
raise_on_error=True,
)
def test_ps_conversion_no_dict(self):
cols = [["string_col", "string"], ["int_col", "int"], ["float_col", "float"]]
data = [["a", 4, 4.0]]
results = SupersetResultSet(data, cols, BaseEngineSpec)
self.assertEqual(len(data), results.size)
self.assertEqual(len(cols), len(results.columns))
def test_pa_conversion_tuple(self):
cols = ["string_col", "int_col", "list_col", "float_col"]
data = [("Text", 111, [123], 1.0)]
results = SupersetResultSet(data, cols, BaseEngineSpec)
self.assertEqual(len(data), results.size)
self.assertEqual(len(cols), len(results.columns))
def test_pa_conversion_dict(self):
cols = ["string_col", "dict_col", "int_col"]
data = [["a", {"c1": 1, "c2": 2, "c3": 3}, 4]]
results = SupersetResultSet(data, cols, BaseEngineSpec)
self.assertEqual(len(data), results.size)
self.assertEqual(len(cols), len(results.columns))
def test_sqllab_viz(self):
self.login("admin")
examples_dbid = get_example_database().id
payload = {
"chartType": "dist_bar",
"datasourceName": f"test_viz_flow_table_{random()}",
"schema": "superset",
"columns": [
{"is_dttm": False, "type": "STRING", "name": f"viz_type_{random()}"},
{"is_dttm": False, "type": "OBJECT", "name": f"ccount_{random()}"},
],
"sql": """\
SELECT *
FROM birth_names
LIMIT 10""",
"dbId": examples_dbid,
}
data = {"data": json.dumps(payload)}
resp = self.get_json_resp("/superset/sqllab_viz/", data=data)
self.assertIn("table_id", resp)
# ensure owner is set correctly
table_id = resp["table_id"]
table = db.session.query(SqlaTable).filter_by(id=table_id).one()
self.assertEqual([owner.username for owner in table.owners], ["admin"])
view_menu = security_manager.find_view_menu(table.get_perm())
assert view_menu is not None
# Cleanup
db.session.delete(table)
db.session.commit()
def test_sqllab_viz_bad_payload(self):
self.login("admin")
payload = {
"chartType": "dist_bar",
"schema": "superset",
"columns": [
{"is_dttm": False, "type": "STRING", "name": f"viz_type_{random()}"},
{"is_dttm": False, "type": "OBJECT", "name": f"ccount_{random()}"},
],
"sql": """\
SELECT *
FROM birth_names
LIMIT 10""",
}
data = {"data": json.dumps(payload)}
url = "/superset/sqllab_viz/"
response = self.client.post(url, data=data, follow_redirects=True)
assert response.status_code == 400
def test_sqllab_table_viz(self):
self.login("admin")
examples_db = get_example_database()
examples_db.get_sqla_engine().execute(
"DROP TABLE IF EXISTS test_sqllab_table_viz"
)
examples_db.get_sqla_engine().execute(
"CREATE TABLE test_sqllab_table_viz AS SELECT 2 as col"
)
examples_dbid = examples_db.id
payload = {
"datasourceName": "test_sqllab_table_viz",
"columns": [],
"dbId": examples_dbid,
}
data = {"data": json.dumps(payload)}
resp = self.get_json_resp("/superset/get_or_create_table/", data=data)
self.assertIn("table_id", resp)
# ensure owner is set correctly
table_id = resp["table_id"]
table = db.session.query(SqlaTable).filter_by(id=table_id).one()
self.assertEqual([owner.username for owner in table.owners], ["admin"])
db.session.delete(table)
get_example_database().get_sqla_engine().execute(
"DROP TABLE test_sqllab_table_viz"
)
db.session.commit()
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_sql_limit(self):
self.login("admin")
test_limit = 1
data = self.run_sql("SELECT * FROM birth_names", client_id="sql_limit_1")
self.assertGreater(len(data["data"]), test_limit)
data = self.run_sql(
"SELECT * FROM birth_names", client_id="sql_limit_2", query_limit=test_limit
)
self.assertEqual(len(data["data"]), test_limit)
data = self.run_sql(
"SELECT * FROM birth_names LIMIT {}".format(test_limit),
client_id="sql_limit_3",
query_limit=test_limit + 1,
)
self.assertEqual(len(data["data"]), test_limit)
self.assertEqual(data["query"]["limitingFactor"], LimitingFactor.QUERY)
data = self.run_sql(
"SELECT * FROM birth_names LIMIT {}".format(test_limit + 1),
client_id="sql_limit_4",
query_limit=test_limit,
)
self.assertEqual(len(data["data"]), test_limit)
self.assertEqual(data["query"]["limitingFactor"], LimitingFactor.DROPDOWN)
data = self.run_sql(
"SELECT * FROM birth_names LIMIT {}".format(test_limit),
client_id="sql_limit_5",
query_limit=test_limit,
)
self.assertEqual(len(data["data"]), test_limit)
self.assertEqual(
data["query"]["limitingFactor"], LimitingFactor.QUERY_AND_DROPDOWN
)
data = self.run_sql(
"SELECT * FROM birth_names",
client_id="sql_limit_6",
query_limit=10000,
)
self.assertEqual(len(data["data"]), 1200)
self.assertEqual(data["query"]["limitingFactor"], LimitingFactor.NOT_LIMITED)
data = self.run_sql(
"SELECT * FROM birth_names",
client_id="sql_limit_7",
query_limit=1200,
)
self.assertEqual(len(data["data"]), 1200)
self.assertEqual(data["query"]["limitingFactor"], LimitingFactor.NOT_LIMITED)
def test_query_api_filter(self) -> None:
"""
Test query api without can_only_access_owned_queries perm added to
Admin and make sure all queries show up.
"""
self.run_some_queries()
self.login(username="admin")
url = "/api/v1/query/"
data = self.get_json_resp(url)
admin = security_manager.find_user("admin")
gamma_sqllab = security_manager.find_user("gamma_sqllab")
self.assertEqual(3, len(data["result"]))
user_queries = [result.get("user").get("username") for result in data["result"]]
assert admin.username in user_queries
assert gamma_sqllab.username in user_queries
def test_query_api_can_access_all_queries(self) -> None:
"""
Test query api with can_access_all_queries perm added to
gamma and make sure all queries show up.
"""
session = db.session
# Add all_query_access perm to Gamma user
all_queries_view = security_manager.find_permission_view_menu(
"all_query_access", "all_query_access"
)
security_manager.add_permission_role(
security_manager.find_role("gamma_sqllab"), all_queries_view
)
session.commit()
# Test search_queries for Admin user
self.run_some_queries()
self.login("gamma_sqllab")
url = "/api/v1/query/"
data = self.get_json_resp(url)
self.assertEqual(3, len(data["result"]))
# Remove all_query_access from gamma sqllab
all_queries_view = security_manager.find_permission_view_menu(
"all_query_access", "all_query_access"
)
security_manager.del_permission_role(
security_manager.find_role("gamma_sqllab"), all_queries_view
)
session.commit()
def test_query_admin_can_access_all_queries(self) -> None:
"""
Test query api with all_query_access perm added to
Admin and make sure only Admin queries show up. This is the default
"""
# Test search_queries for Admin user
self.run_some_queries()
self.login("admin")
url = "/api/v1/query/"
data = self.get_json_resp(url)
self.assertEqual(3, len(data["result"]))
def test_api_database(self):
self.login("admin")
self.create_fake_db()
get_example_database()
get_main_database()
arguments = {
"keys": [],
"filters": [{"col": "expose_in_sqllab", "opr": "eq", "value": True}],
"order_column": "database_name",
"order_direction": "asc",
"page": 0,
"page_size": -1,
}
url = f"api/v1/database/?q={prison.dumps(arguments)}"
self.assertEqual(
{"examples", "fake_db_100", "main"},
{r.get("database_name") for r in self.get_json_resp(url)["result"]},
)
self.delete_fake_db()
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
@mock.patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
{"ENABLE_TEMPLATE_PROCESSING": True},
clear=True,
)
def test_sql_json_parameter_error(self):
self.login("admin")
data = self.run_sql(
"SELECT * FROM birth_names WHERE state = '{{ state }}' LIMIT 10",
"1",
template_params=json.dumps({"state": "CA"}),
)
assert data["status"] == "success"
data = self.run_sql(
"SELECT * FROM birth_names WHERE state = '{{ stat }}' LIMIT 10",
"2",
template_params=json.dumps({"state": "CA"}),
)
assert data["errors"][0]["error_type"] == "MISSING_TEMPLATE_PARAMS_ERROR"
assert data["errors"][0]["extra"] == {
"issue_codes": [
{
"code": 1006,
"message": "Issue 1006 - One or more parameters specified in the query are missing.",
}
],
"template_parameters": {"state": "CA"},
"undefined_parameters": ["stat"],
}
@mock.patch("superset.sql_lab.get_query")
@mock.patch("superset.sql_lab.execute_sql_statement")
def test_execute_sql_statements(self, mock_execute_sql_statement, mock_get_query):
sql = """
-- comment
SET @value = 42;
SELECT @value AS foo;
-- comment
"""
mock_session = mock.MagicMock()
mock_query = mock.MagicMock()
mock_query.database.allow_run_async = False
mock_cursor = mock.MagicMock()
mock_query.database.get_sqla_engine.return_value.raw_connection.return_value.cursor.return_value = (
mock_cursor
)
mock_query.database.db_engine_spec.run_multiple_statements_as_one = False
mock_get_query.return_value = mock_query
execute_sql_statements(
query_id=1,
rendered_query=sql,
return_results=True,
store_results=False,
user_name="admin",
session=mock_session,
start_time=None,
expand_data=False,
log_params=None,
)
mock_execute_sql_statement.assert_has_calls(
[
mock.call(
"SET @value = 42",
mock_query,
"admin",
mock_session,
mock_cursor,
None,
False,
),
mock.call(
"SELECT @value AS foo",
mock_query,
"admin",
mock_session,
mock_cursor,
None,
False,
),
]
)
@mock.patch("superset.sql_lab.results_backend", None)
@mock.patch("superset.sql_lab.get_query")
@mock.patch("superset.sql_lab.execute_sql_statement")
def test_execute_sql_statements_no_results_backend(
self, mock_execute_sql_statement, mock_get_query
):
sql = """
-- comment
SET @value = 42;
SELECT @value AS foo;
-- comment
"""
mock_session = mock.MagicMock()
mock_query = mock.MagicMock()
mock_query.database.allow_run_async = True
mock_cursor = mock.MagicMock()
mock_query.database.get_sqla_engine.return_value.raw_connection.return_value.cursor.return_value = (
mock_cursor
)
mock_query.database.db_engine_spec.run_multiple_statements_as_one = False
mock_get_query.return_value = mock_query
with pytest.raises(SupersetErrorException) as excinfo:
execute_sql_statements(
query_id=1,
rendered_query=sql,
return_results=True,
store_results=False,
user_name="admin",
session=mock_session,
start_time=None,
expand_data=False,
log_params=None,
)
assert excinfo.value.error == SupersetError(
message="Results backend is not configured.",
error_type=SupersetErrorType.RESULTS_BACKEND_NOT_CONFIGURED_ERROR,
level=ErrorLevel.ERROR,
extra={
"issue_codes": [
{
"code": 1021,
"message": (
"Issue 1021 - Results backend needed for asynchronous "
"queries is not configured."
),
}
]
},
)
@mock.patch("superset.sql_lab.get_query")
@mock.patch("superset.sql_lab.execute_sql_statement")
def test_execute_sql_statements_ctas(
self, mock_execute_sql_statement, mock_get_query
):
sql = """
-- comment
SET @value = 42;
SELECT @value AS foo;
-- comment
"""
mock_session = mock.MagicMock()
mock_query = mock.MagicMock()
mock_query.database.allow_run_async = False
mock_cursor = mock.MagicMock()
mock_query.database.get_sqla_engine.return_value.raw_connection.return_value.cursor.return_value = (
mock_cursor
)
mock_query.database.db_engine_spec.run_multiple_statements_as_one = False
mock_get_query.return_value = mock_query
# set the query to CTAS
mock_query.select_as_cta = True
mock_query.ctas_method = CtasMethod.TABLE
execute_sql_statements(
query_id=1,
rendered_query=sql,
return_results=True,
store_results=False,
user_name="admin",
session=mock_session,
start_time=None,
expand_data=False,
log_params=None,
)
mock_execute_sql_statement.assert_has_calls(
[
mock.call(
"SET @value = 42",
mock_query,
"admin",
mock_session,
mock_cursor,
None,
False,
),
mock.call(
"SELECT @value AS foo",
mock_query,
"admin",
mock_session,
mock_cursor,
None,
True, # apply_ctas
),
]
)
# try invalid CTAS
sql = "DROP TABLE my_table"
with pytest.raises(SupersetErrorException) as excinfo:
execute_sql_statements(
query_id=1,
rendered_query=sql,
return_results=True,
store_results=False,
user_name="admin",
session=mock_session,
start_time=None,
expand_data=False,
log_params=None,
)
assert excinfo.value.error == SupersetError(
message="CTAS (create table as select) can only be run with a query where the last statement is a SELECT. Please make sure your query has a SELECT as its last statement. Then, try running your query again.",
error_type=SupersetErrorType.INVALID_CTAS_QUERY_ERROR,
level=ErrorLevel.ERROR,
extra={
"issue_codes": [
{
"code": 1023,
"message": "Issue 1023 - The CTAS (create table as select) doesn't have a SELECT statement at the end. Please make sure your query has a SELECT as its last statement. Then, try running your query again.",
}
]
},
)
# try invalid CVAS
mock_query.ctas_method = CtasMethod.VIEW
sql = """
-- comment
SET @value = 42;
SELECT @value AS foo;
-- comment
"""
with pytest.raises(SupersetErrorException) as excinfo:
execute_sql_statements(
query_id=1,
rendered_query=sql,
return_results=True,
store_results=False,
user_name="admin",
session=mock_session,
start_time=None,
expand_data=False,
log_params=None,
)
assert excinfo.value.error == SupersetError(
message="CVAS (create view as select) can only be run with a query with a single SELECT statement. Please make sure your query has only a SELECT statement. Then, try running your query again.",
error_type=SupersetErrorType.INVALID_CVAS_QUERY_ERROR,
level=ErrorLevel.ERROR,
extra={
"issue_codes": [
{
"code": 1024,
"message": "Issue 1024 - CVAS (create view as select) query has more than one statement.",
},
{
"code": 1025,
"message": "Issue 1025 - CVAS (create view as select) query is not a SELECT statement.",
},
]
},
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_sql_json_soft_timeout(self):
examples_db = get_example_database()
if examples_db.backend == "sqlite":
return
self.login("admin")
with mock.patch.object(
examples_db.db_engine_spec, "handle_cursor"
) as handle_cursor:
handle_cursor.side_effect = SoftTimeLimitExceeded()
data = self.run_sql("SELECT * FROM birth_names LIMIT 1", "1")
assert data == {
"errors": [
{
"message": (
"The query was killed after 21600 seconds. It might be too complex, "
"or the database might be under heavy load."
),
"error_type": SupersetErrorType.SQLLAB_TIMEOUT_ERROR,
"level": ErrorLevel.ERROR,
"extra": {
"issue_codes": [
{
"code": 1026,
"message": "Issue 1026 - Query is too complex and takes too long to run.",
},
{
"code": 1027,
"message": "Issue 1027 - The database is currently running too many queries.",
},
]
},
}
]
}
def test_apply_limit_if_exists_when_incremented_limit_is_none(self):
sql = """
SET @value = 42;
SELECT @value AS foo;
"""
database = get_example_database()
mock_query = mock.MagicMock()
mock_query.limit = 300
final_sql = apply_limit_if_exists(database, None, mock_query, sql)
assert final_sql == sql
def test_apply_limit_if_exists_when_increased_limit(self):
sql = """
SET @value = 42;
SELECT @value AS foo;
"""
database = get_example_database()
mock_query = mock.MagicMock()
mock_query.limit = 300
final_sql = apply_limit_if_exists(database, 1000, mock_query, sql)
assert "LIMIT 1000" in final_sql
@pytest.mark.parametrize("spec", [HiveEngineSpec, PrestoEngineSpec])
def test_cancel_query_implicit(spec: BaseEngineSpec) -> None:
query = mock.MagicMock()
query.database.db_engine_spec = spec
assert cancel_query(query)
| tests/integration_tests/sqllab_tests.py | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.0018973209662362933,
0.0003339781833346933,
0.00016235497605521232,
0.0001721186563372612,
0.00037908219383098185
] |
{
"id": 1,
"code_window": [
" layer,\n",
" markerSize,\n",
" data,\n",
" annotationData,\n",
" ),\n",
" );\n",
" }\n",
" });\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" colorScale,\n",
" sliceId,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts",
"type": "add",
"edit_start_line_idx": 261
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import JSONbig from 'json-bigint';
import React, { PureComponent } from 'react';
import JSONTree from 'react-json-tree';
import {
AutoSizer,
Column,
Grid,
ScrollSync,
SortDirection,
SortDirectionType,
SortIndicator,
Table,
} from 'react-virtualized';
import { getMultipleTextDimensions, t, styled } from '@superset-ui/core';
import { Tooltip } from 'src/components/Tooltip';
import Button from '../Button';
import CopyToClipboard from '../CopyToClipboard';
import ModalTrigger from '../ModalTrigger';
function safeJsonObjectParse(
data: unknown,
): null | unknown[] | Record<string, unknown> {
// First perform a cheap proxy to avoid calling JSON.parse on data that is clearly not a
// JSON object or array
if (
typeof data !== 'string' ||
['{', '['].indexOf(data.substring(0, 1)) === -1
) {
return null;
}
// We know `data` is a string starting with '{' or '[', so try to parse it as a valid object
try {
const jsonData = JSON.parse(data);
if (jsonData && typeof jsonData === 'object') {
return jsonData;
}
return null;
} catch (_) {
return null;
}
}
const GRID_POSITION_ADJUSTMENT = 4;
const SCROLL_BAR_HEIGHT = 15;
const JSON_TREE_THEME = {
scheme: 'monokai',
author: 'wimer hazenberg (http://www.monokai.nl)',
base00: '#272822',
base01: '#383830',
base02: '#49483e',
base03: '#75715e',
base04: '#a59f85',
base05: '#f8f8f2',
base06: '#f5f4f1',
base07: '#f9f8f5',
base08: '#f92672',
base09: '#fd971f',
base0A: '#f4bf75',
base0B: '#a6e22e',
base0C: '#a1efe4',
base0D: '#66d9ef',
base0E: '#ae81ff',
base0F: '#cc6633',
};
// This regex handles all possible number formats in javascript, including ints, floats,
// exponential notation, NaN, and Infinity.
// See https://stackoverflow.com/a/30987109 for more details
const ONLY_NUMBER_REGEX = /^(NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity))$/;
const StyledFilterableTable = styled.div`
${({ theme }) => `
height: 100%;
overflow-x: auto;
margin-top: ${theme.gridUnit * 2}px;
overflow-y: hidden;
.ReactVirtualized__Grid__innerScrollContainer {
border: 1px solid ${theme.colors.grayscale.light2};
}
.ReactVirtualized__Table__headerRow {
font-weight: ${theme.typography.weights.bold};
display: flex;
flex-direction: row;
align-items: center;
border: 1px solid ${theme.colors.grayscale.light2};
}
.ReactVirtualized__Table__row {
display: flex;
flex-direction: row;
}
.ReactVirtualized__Table__headerTruncatedText,
.grid-header-cell {
display: inline-block;
max-width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.ReactVirtualized__Table__headerColumn,
.ReactVirtualized__Table__rowColumn,
.grid-cell {
min-width: 0px;
border-right: 1px solid ${theme.colors.grayscale.light2};
align-self: center;
padding: ${theme.gridUnit * 3}px;
font-size: ${theme.typography.sizes.s}px;
}
.grid-header-cell {
font-weight: ${theme.typography.weights.bold};
cursor: pointer;
}
.ReactVirtualized__Table__headerColumn:last-of-type,
.ReactVirtualized__Table__rowColumn:last-of-type {
border-right: 0px;
}
.ReactVirtualized__Table__headerColumn:focus,
.ReactVirtualized__Table__Grid:focus {
outline: none;
}
.ReactVirtualized__Table__rowColumn {
text-overflow: ellipsis;
white-space: nowrap;
}
.ReactVirtualized__Table__sortableHeaderColumn {
cursor: pointer;
}
.ReactVirtualized__Table__sortableHeaderIconContainer {
display: flex;
align-items: center;
}
.ReactVirtualized__Table__sortableHeaderIcon {
flex: 0 0 ${theme.gridUnit * 6}px;
height: 1em;
width: 1em;
fill: currentColor;
}
.even-row {
background: ${theme.colors.grayscale.light4};
}
.odd-row {
background: ${theme.colors.grayscale.light5};
}
.header-style {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.header-style-disabled {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: ${theme.colors.grayscale.light1};
}
.cell-text-for-measuring {
font-family: ${theme.typography.families.sansSerif};
font-size: ${theme.typography.sizes.s}px;
}
`}
`;
// when more than MAX_COLUMNS_FOR_TABLE are returned, switch from table to grid view
export const MAX_COLUMNS_FOR_TABLE = 50;
type CellDataType = string | number | null;
type Datum = Record<string, CellDataType>;
interface FilterableTableProps {
orderedColumnKeys: string[];
data: Record<string, unknown>[];
height: number;
filterText: string;
headerHeight: number;
overscanColumnCount: number;
overscanRowCount: number;
rowHeight: number;
striped: boolean;
expandedColumns: string[];
}
interface FilterableTableState {
sortBy?: string;
sortDirection?: SortDirectionType;
fitted: boolean;
displayedList: Datum[];
}
export default class FilterableTable extends PureComponent<
FilterableTableProps,
FilterableTableState
> {
static defaultProps = {
filterText: '',
headerHeight: 32,
overscanColumnCount: 10,
overscanRowCount: 10,
rowHeight: 32,
striped: true,
expandedColumns: [],
};
list: Datum[];
complexColumns: Record<string, boolean>;
widthsForColumnsByKey: Record<string, number>;
totalTableWidth: number;
totalTableHeight: number;
container: React.RefObject<HTMLDivElement>;
constructor(props: FilterableTableProps) {
super(props);
this.list = this.formatTableData(props.data);
this.addJsonModal = this.addJsonModal.bind(this);
this.getCellContent = this.getCellContent.bind(this);
this.renderGridCell = this.renderGridCell.bind(this);
this.renderGridCellHeader = this.renderGridCellHeader.bind(this);
this.renderGrid = this.renderGrid.bind(this);
this.renderTableCell = this.renderTableCell.bind(this);
this.renderTableHeader = this.renderTableHeader.bind(this);
this.sortResults = this.sortResults.bind(this);
this.renderTable = this.renderTable.bind(this);
this.rowClassName = this.rowClassName.bind(this);
this.sort = this.sort.bind(this);
// columns that have complex type and were expanded into sub columns
this.complexColumns = props.orderedColumnKeys.reduce(
(obj, key) => ({
...obj,
[key]: props.expandedColumns.some(name => name.startsWith(`${key}.`)),
}),
{},
);
this.widthsForColumnsByKey = this.getWidthsForColumns();
this.totalTableWidth = props.orderedColumnKeys
.map(key => this.widthsForColumnsByKey[key])
.reduce((curr, next) => curr + next);
this.totalTableHeight = props.height;
this.state = {
fitted: false,
displayedList: [...this.list],
};
this.container = React.createRef();
}
componentDidMount() {
this.fitTableToWidthIfNeeded();
}
getDatum(list: Datum[], index: number) {
return list[index % list.length];
}
getWidthsForColumns() {
const PADDING = 50; // accounts for cell padding and width of sorting icon
const widthsByColumnKey = {};
const cellContent = ([] as string[]).concat(
...this.props.orderedColumnKeys.map(key => {
const cellContentList = this.list.map((data: Datum) =>
this.getCellContent({ cellData: data[key], columnKey: key }),
);
cellContentList.push(key);
return cellContentList;
}),
);
const colWidths = getMultipleTextDimensions({
className: 'cell-text-for-measuring',
texts: cellContent,
}).map(dimension => dimension.width);
this.props.orderedColumnKeys.forEach((key, index) => {
// we can't use Math.max(...colWidths.slice(...)) here since the number
// of elements might be bigger than the number of allowed arguments in a
// JavaScript function
widthsByColumnKey[key] =
colWidths
.slice(
index * (this.list.length + 1),
(index + 1) * (this.list.length + 1),
)
.reduce((a, b) => Math.max(a, b)) + PADDING;
});
return widthsByColumnKey;
}
getCellContent({
cellData,
columnKey,
}: {
cellData: CellDataType;
columnKey: string;
}) {
if (cellData === null) {
return 'NULL';
}
const content = String(cellData);
const firstCharacter = content.substring(0, 1);
let truncated;
if (firstCharacter === '[') {
truncated = '[…]';
} else if (firstCharacter === '{') {
truncated = '{…}';
} else {
truncated = '';
}
return this.complexColumns[columnKey] ? truncated : content;
}
formatTableData(data: Record<string, unknown>[]): Datum[] {
return data.map(row => {
const newRow = {};
Object.entries(row).forEach(([key, val]) => {
if (['string', 'number'].indexOf(typeof val) >= 0) {
newRow[key] = val;
} else {
newRow[key] = val === null ? null : JSONbig.stringify(val);
}
});
return newRow;
});
}
hasMatch(text: string, row: Datum) {
const values: string[] = [];
Object.keys(row).forEach(key => {
if (row.hasOwnProperty(key)) {
const cellValue = row[key];
if (typeof cellValue === 'string') {
values.push(cellValue.toLowerCase());
} else if (
cellValue !== null &&
typeof cellValue.toString === 'function'
) {
values.push(cellValue.toString());
}
}
});
const lowerCaseText = text.toLowerCase();
return values.some(v => v.includes(lowerCaseText));
}
rowClassName({ index }: { index: number }) {
let className = '';
if (this.props.striped) {
className = index % 2 === 0 ? 'even-row' : 'odd-row';
}
return className;
}
sort({
sortBy,
sortDirection,
}: {
sortBy: string;
sortDirection: SortDirectionType;
}) {
let updatedState: FilterableTableState;
const shouldClearSort =
this.state.sortDirection === SortDirection.DESC &&
this.state.sortBy === sortBy;
if (shouldClearSort) {
updatedState = {
...this.state,
sortBy: undefined,
sortDirection: undefined,
displayedList: [...this.list],
};
} else {
updatedState = {
...this.state,
sortBy,
sortDirection,
displayedList: [...this.list].sort(
this.sortResults(sortBy, sortDirection === SortDirection.DESC),
),
};
}
this.setState(updatedState);
}
fitTableToWidthIfNeeded() {
const containerWidth = this.container.current?.clientWidth ?? 0;
if (this.totalTableWidth < containerWidth) {
// fit table width if content doesn't fill the width of the container
this.totalTableWidth = containerWidth;
}
this.setState({ fitted: true });
}
addJsonModal(
node: React.ReactNode,
jsonObject: Record<string, unknown> | unknown[],
jsonString: CellDataType,
) {
return (
<ModalTrigger
modalBody={<JSONTree data={jsonObject} theme={JSON_TREE_THEME} />}
modalFooter={
<Button>
<CopyToClipboard shouldShowText={false} text={jsonString} />
</Button>
}
modalTitle={t('Cell content')}
triggerNode={node}
/>
);
}
// Parse any numbers from strings so they'll sort correctly
parseNumberFromString = (value: string | number | null) => {
if (typeof value === 'string') {
if (ONLY_NUMBER_REGEX.test(value)) {
return parseFloat(value);
}
}
return value;
};
sortResults(sortBy: string, descending: boolean) {
return (a: Datum, b: Datum) => {
const aValue = this.parseNumberFromString(a[sortBy]);
const bValue = this.parseNumberFromString(b[sortBy]);
// equal items sort equally
if (aValue === bValue) {
return 0;
}
// nulls sort after anything else
if (aValue === null) {
return 1;
}
if (bValue === null) {
return -1;
}
if (descending) {
return aValue < bValue ? 1 : -1;
}
return aValue < bValue ? -1 : 1;
};
}
sortGrid = (label: string) => {
this.sort({
sortBy: label,
sortDirection:
this.state.sortDirection === SortDirection.DESC ||
this.state.sortBy !== label
? SortDirection.ASC
: SortDirection.DESC,
});
};
renderTableHeader({
dataKey,
label,
sortBy,
sortDirection,
}: {
dataKey: string;
label: string;
sortBy: string;
sortDirection: SortDirectionType;
}) {
const className =
this.props.expandedColumns.indexOf(label) > -1
? 'header-style-disabled'
: 'header-style';
return (
<Tooltip
id="header-tooltip"
title={label}
placement="topLeft"
css={{ display: 'block' }}
>
<div className={className}>
{label}
{sortBy === dataKey && (
<SortIndicator sortDirection={sortDirection} />
)}
</div>
</Tooltip>
);
}
renderGridCellHeader({
columnIndex,
key,
style,
}: {
columnIndex: number;
key: string;
style: React.CSSProperties;
}) {
const label = this.props.orderedColumnKeys[columnIndex];
const className =
this.props.expandedColumns.indexOf(label) > -1
? 'header-style-disabled'
: 'header-style';
return (
<Tooltip
key={key}
id="header-tooltip"
title={label}
placement="topLeft"
css={{ display: 'block' }}
>
<div
style={{
...style,
top:
typeof style.top === 'number'
? style.top - GRID_POSITION_ADJUSTMENT
: style.top,
}}
className={`${className} grid-cell grid-header-cell`}
role="columnheader"
tabIndex={columnIndex}
onClick={() => this.sortGrid(label)}
>
{label}
{this.state.sortBy === label && (
<SortIndicator sortDirection={this.state.sortDirection} />
)}
</div>
</Tooltip>
);
}
renderGridCell({
columnIndex,
key,
rowIndex,
style,
}: {
columnIndex: number;
key: string;
rowIndex: number;
style: React.CSSProperties;
}) {
const columnKey = this.props.orderedColumnKeys[columnIndex];
const cellData = this.state.displayedList[rowIndex][columnKey];
const cellText = this.getCellContent({ cellData, columnKey });
const content =
cellData === null ? <i className="text-muted">{cellText}</i> : cellText;
const cellNode = (
<div
key={key}
style={{
...style,
top:
typeof style.top === 'number'
? style.top - GRID_POSITION_ADJUSTMENT
: style.top,
}}
className={`grid-cell ${this.rowClassName({ index: rowIndex })}`}
>
<div css={{ width: 'inherit' }}>{content}</div>
</div>
);
const jsonObject = safeJsonObjectParse(cellData);
if (jsonObject) {
return this.addJsonModal(cellNode, jsonObject, cellData);
}
return cellNode;
}
renderGrid() {
const {
orderedColumnKeys,
overscanColumnCount,
overscanRowCount,
rowHeight,
} = this.props;
let { height } = this.props;
let totalTableHeight = height;
if (
this.container.current &&
this.totalTableWidth > this.container.current.clientWidth
) {
// exclude the height of the horizontal scroll bar from the height of the table
// and the height of the table container if the content overflows
height -= SCROLL_BAR_HEIGHT;
totalTableHeight -= SCROLL_BAR_HEIGHT;
}
const getColumnWidth = ({ index }: { index: number }) =>
this.widthsForColumnsByKey[orderedColumnKeys[index]];
// fix height of filterable table
return (
<StyledFilterableTable>
<ScrollSync>
{({ onScroll, scrollLeft }) => (
<>
<AutoSizer disableHeight>
{({ width }) => (
<div>
<Grid
cellRenderer={this.renderGridCellHeader}
columnCount={orderedColumnKeys.length}
columnWidth={getColumnWidth}
height={rowHeight}
rowCount={1}
rowHeight={rowHeight}
scrollLeft={scrollLeft}
width={width}
style={{ overflow: 'hidden' }}
/>
<Grid
cellRenderer={this.renderGridCell}
columnCount={orderedColumnKeys.length}
columnWidth={getColumnWidth}
height={totalTableHeight - rowHeight}
onScroll={onScroll}
overscanColumnCount={overscanColumnCount}
overscanRowCount={overscanRowCount}
rowCount={this.list.length}
rowHeight={rowHeight}
width={width}
/>
</div>
)}
</AutoSizer>
</>
)}
</ScrollSync>
</StyledFilterableTable>
);
}
renderTableCell({
cellData,
columnKey,
}: {
cellData: CellDataType;
columnKey: string;
}) {
const cellNode = this.getCellContent({ cellData, columnKey });
const content =
cellData === null ? <i className="text-muted">{cellNode}</i> : cellNode;
const jsonObject = safeJsonObjectParse(cellData);
if (jsonObject) {
return this.addJsonModal(cellNode, jsonObject, cellData);
}
return content;
}
renderTable() {
const { sortBy, sortDirection } = this.state;
const {
filterText,
headerHeight,
orderedColumnKeys,
overscanRowCount,
rowHeight,
} = this.props;
let sortedAndFilteredList = this.state.displayedList;
// filter list
if (filterText) {
sortedAndFilteredList = sortedAndFilteredList.filter((row: Datum) =>
this.hasMatch(filterText, row),
);
}
let { height } = this.props;
let totalTableHeight = height;
if (
this.container.current &&
this.totalTableWidth > this.container.current.clientWidth
) {
// exclude the height of the horizontal scroll bar from the height of the table
// and the height of the table container if the content overflows
height -= SCROLL_BAR_HEIGHT;
totalTableHeight -= SCROLL_BAR_HEIGHT;
}
const rowGetter = ({ index }: { index: number }) =>
this.getDatum(sortedAndFilteredList, index);
return (
<StyledFilterableTable
className="filterable-table-container"
ref={this.container}
>
{this.state.fitted && (
<Table
ref="Table"
headerHeight={headerHeight}
height={totalTableHeight}
overscanRowCount={overscanRowCount}
rowClassName={this.rowClassName}
rowHeight={rowHeight}
rowGetter={rowGetter}
rowCount={sortedAndFilteredList.length}
sort={this.sort}
sortBy={sortBy}
sortDirection={sortDirection}
width={this.totalTableWidth}
>
{orderedColumnKeys.map(columnKey => (
<Column
cellRenderer={({ cellData }) =>
this.renderTableCell({ cellData, columnKey })
}
dataKey={columnKey}
disableSort={false}
headerRenderer={this.renderTableHeader}
width={this.widthsForColumnsByKey[columnKey]}
label={columnKey}
key={columnKey}
/>
))}
</Table>
)}
</StyledFilterableTable>
);
}
render() {
if (this.props.orderedColumnKeys.length > MAX_COLUMNS_FOR_TABLE) {
return this.renderGrid();
}
return this.renderTable();
}
}
| superset-frontend/src/components/FilterableTable/FilterableTable.tsx | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00034040125319734216,
0.0001760698069119826,
0.000162582378834486,
0.00017220010340679437,
0.000023447406420018524
] |
{
"id": 2,
"code_window": [
" markerSize: number,\n",
" data: TimeseriesDataRecord[],\n",
" annotationData: AnnotationData,\n",
"): SeriesOption[] {\n",
" const series: SeriesOption[] = [];\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" colorScale: CategoricalColorScale,\n",
" sliceId?: number,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "add",
"edit_start_line_idx": 420
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import {
AnnotationData,
AnnotationOpacity,
CategoricalColorScale,
EventAnnotationLayer,
FilterState,
FormulaAnnotationLayer,
getTimeFormatter,
IntervalAnnotationLayer,
isTimeseriesAnnotationResult,
NumberFormatter,
smartDateDetailedFormatter,
smartDateFormatter,
TimeFormatter,
TimeseriesAnnotationLayer,
TimeseriesDataRecord,
} from '@superset-ui/core';
import { SeriesOption } from 'echarts';
import {
CallbackDataParams,
DefaultStatesMixin,
ItemStyleOption,
LineStyleOption,
OptionName,
SeriesLabelOption,
SeriesLineLabelOption,
ZRLineType,
} from 'echarts/types/src/util/types';
import {
MarkArea1DDataItemOption,
MarkArea2DDataItemOption,
} from 'echarts/types/src/component/marker/MarkAreaModel';
import { MarkLine1DDataItemOption } from 'echarts/types/src/component/marker/MarkLineModel';
import { extractForecastSeriesContext } from '../utils/forecast';
import { ForecastSeriesEnum, LegendOrientation } from '../types';
import { EchartsTimeseriesSeriesType } from './types';
import {
evalFormula,
extractRecordAnnotations,
formatAnnotationLabel,
parseAnnotationOpacity,
} from '../utils/annotation';
import { currentSeries, getChartPadding } from '../utils/series';
import { OpacityEnum, TIMESERIES_CONSTANTS } from '../constants';
export function transformSeries(
series: SeriesOption,
colorScale: CategoricalColorScale,
opts: {
area?: boolean;
filterState?: FilterState;
seriesContexts?: { [key: string]: ForecastSeriesEnum[] };
markerEnabled?: boolean;
markerSize?: number;
areaOpacity?: number;
seriesType?: EchartsTimeseriesSeriesType;
stack?: boolean;
yAxisIndex?: number;
showValue?: boolean;
onlyTotal?: boolean;
formatter?: NumberFormatter;
totalStackedValues?: number[];
showValueIndexes?: number[];
thresholdValues?: number[];
richTooltip?: boolean;
seriesKey?: OptionName;
sliceId?: number;
},
): SeriesOption | undefined {
const { name } = series;
const {
area,
filterState,
seriesContexts = {},
markerEnabled,
markerSize,
areaOpacity = 1,
seriesType,
stack,
yAxisIndex = 0,
showValue,
onlyTotal,
formatter,
totalStackedValues = [],
showValueIndexes = [],
thresholdValues = [],
richTooltip,
seriesKey,
sliceId,
} = opts;
const contexts = seriesContexts[name || ''] || [];
const hasForecast =
contexts.includes(ForecastSeriesEnum.ForecastTrend) ||
contexts.includes(ForecastSeriesEnum.ForecastLower) ||
contexts.includes(ForecastSeriesEnum.ForecastUpper);
const forecastSeries = extractForecastSeriesContext(name || '');
const isConfidenceBand =
forecastSeries.type === ForecastSeriesEnum.ForecastLower ||
forecastSeries.type === ForecastSeriesEnum.ForecastUpper;
const isFiltered =
filterState?.selectedValues && !filterState?.selectedValues.includes(name);
const opacity = isFiltered
? OpacityEnum.SemiTransparent
: OpacityEnum.NonTransparent;
// don't create a series if doing a stack or area chart and the result
// is a confidence band
if ((stack || area) && isConfidenceBand) return undefined;
const isObservation = forecastSeries.type === ForecastSeriesEnum.Observation;
const isTrend = forecastSeries.type === ForecastSeriesEnum.ForecastTrend;
let stackId;
if (isConfidenceBand) {
stackId = forecastSeries.name;
} else if (stack && isObservation) {
// the suffix of the observation series is '' (falsy), which disables
// stacking. Therefore we need to set something that is truthy.
stackId = 'obs';
} else if (stack && isTrend) {
stackId = forecastSeries.type;
}
let plotType;
if (
!isConfidenceBand &&
(seriesType === 'scatter' || (hasForecast && isObservation))
) {
plotType = 'scatter';
} else if (isConfidenceBand) {
plotType = 'line';
} else {
plotType = seriesType === 'bar' ? 'bar' : 'line';
}
// forcing the colorScale to return a different color for same metrics across different queries
const itemStyle = {
color: colorScale(seriesKey || forecastSeries.name, sliceId),
opacity,
};
let emphasis = {};
let showSymbol = false;
if (!isConfidenceBand) {
if (plotType === 'scatter') {
showSymbol = true;
} else if (hasForecast && isObservation) {
showSymbol = true;
} else if (plotType === 'line' && showValue) {
showSymbol = true;
} else if (plotType === 'line' && !richTooltip && !markerEnabled) {
// this is hack to make timeseries line chart clickable when tooltip trigger is 'item'
// so that the chart can emit cross-filtering
showSymbol = true;
itemStyle.opacity = 0;
emphasis = {
itemStyle: {
opacity: 1,
},
};
} else if (markerEnabled) {
showSymbol = true;
}
}
const lineStyle = isConfidenceBand
? { opacity: OpacityEnum.Transparent }
: { opacity };
return {
...series,
yAxisIndex,
name: forecastSeries.name,
itemStyle,
// @ts-ignore
type: plotType,
smooth: seriesType === 'smooth',
triggerLineEvent: true,
// @ts-ignore
step: ['start', 'middle', 'end'].includes(seriesType as string)
? seriesType
: undefined,
stack: stackId,
lineStyle,
areaStyle:
area || forecastSeries.type === ForecastSeriesEnum.ForecastUpper
? {
opacity: opacity * areaOpacity,
}
: undefined,
emphasis: {
// bold on hover as required since 5.3.0 to retain backwards feature parity:
// https://apache.github.io/echarts-handbook/en/basics/release-note/5-3-0/#removing-the-default-bolding-emphasis-effect-in-the-line-chart
// TODO: should consider only adding emphasis to currently hovered series
lineStyle: {
width: 'bolder',
},
...emphasis,
},
showSymbol,
symbolSize: markerSize,
label: {
show: !!showValue,
position: 'top',
formatter: (params: any) => {
const {
value: [, numericValue],
dataIndex,
seriesIndex,
seriesName,
} = params;
const isSelectedLegend = currentSeries.legend === seriesName;
if (!formatter) return numericValue;
if (!stack || isSelectedLegend) return formatter(numericValue);
if (!onlyTotal) {
if (numericValue >= thresholdValues[dataIndex]) {
return formatter(numericValue);
}
return '';
}
if (seriesIndex === showValueIndexes[dataIndex]) {
return formatter(totalStackedValues[dataIndex]);
}
return '';
},
},
};
}
export function transformFormulaAnnotation(
layer: FormulaAnnotationLayer,
data: TimeseriesDataRecord[],
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption {
const { name, color, opacity, width, style } = layer;
return {
name,
id: name,
itemStyle: {
color: color || colorScale(name, sliceId),
},
lineStyle: {
opacity: parseAnnotationOpacity(opacity),
type: style as ZRLineType,
width,
},
type: 'line',
smooth: true,
data: evalFormula(layer, data),
symbolSize: 0,
};
}
export function transformIntervalAnnotation(
layer: IntervalAnnotationLayer,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
annotations.forEach(annotation => {
const { name, color, opacity, showLabel } = layer;
const { descriptions, intervalEnd, time, title } = annotation;
const label = formatAnnotationLabel(name, title, descriptions);
const intervalData: (
| MarkArea1DDataItemOption
| MarkArea2DDataItemOption
)[] = [
[
{
name: label,
xAxis: time,
},
{
xAxis: intervalEnd,
},
],
];
const intervalLabel: SeriesLabelOption = showLabel
? {
show: true,
color: '#000000',
position: 'insideTop',
verticalAlign: 'top',
fontWeight: 'bold',
// @ts-ignore
emphasis: {
position: 'insideTop',
verticalAlign: 'top',
backgroundColor: '#ffffff',
},
}
: {
show: false,
color: '#000000',
// @ts-ignore
emphasis: {
fontWeight: 'bold',
show: true,
position: 'insideTop',
verticalAlign: 'top',
backgroundColor: '#ffffff',
},
};
series.push({
id: `Interval - ${label}`,
type: 'line',
animation: false,
markArea: {
silent: false,
itemStyle: {
color: color || colorScale(name, sliceId),
opacity: parseAnnotationOpacity(opacity || AnnotationOpacity.Medium),
emphasis: {
opacity: 0.8,
},
} as ItemStyleOption,
label: intervalLabel,
data: intervalData,
},
});
});
return series;
}
export function transformEventAnnotation(
layer: EventAnnotationLayer,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
annotations.forEach(annotation => {
const { name, color, opacity, style, width, showLabel } = layer;
const { descriptions, time, title } = annotation;
const label = formatAnnotationLabel(name, title, descriptions);
const eventData: MarkLine1DDataItemOption[] = [
{
name: label,
xAxis: time,
},
];
const lineStyle: LineStyleOption & DefaultStatesMixin['emphasis'] = {
width,
type: style as ZRLineType,
color: color || colorScale(name, sliceId),
opacity: parseAnnotationOpacity(opacity),
emphasis: {
width: width ? width + 1 : width,
opacity: 1,
},
};
const eventLabel: SeriesLineLabelOption = showLabel
? {
show: true,
color: '#000000',
position: 'insideEndTop',
fontWeight: 'bold',
formatter: (params: CallbackDataParams) => params.name,
// @ts-ignore
emphasis: {
backgroundColor: '#ffffff',
},
}
: {
show: false,
color: '#000000',
position: 'insideEndTop',
// @ts-ignore
emphasis: {
formatter: (params: CallbackDataParams) => params.name,
fontWeight: 'bold',
show: true,
backgroundColor: '#ffffff',
},
};
series.push({
id: `Event - ${label}`,
type: 'line',
animation: false,
markLine: {
silent: false,
symbol: 'none',
lineStyle,
label: eventLabel,
data: eventData,
},
});
});
return series;
}
export function transformTimeseriesAnnotation(
layer: TimeseriesAnnotationLayer,
markerSize: number,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
): SeriesOption[] {
const series: SeriesOption[] = [];
const { hideLine, name, opacity, showMarkers, style, width } = layer;
const result = annotationData[name];
if (isTimeseriesAnnotationResult(result)) {
result.forEach(annotation => {
const { key, values } = annotation;
series.push({
type: 'line',
id: key,
name: key,
data: values.map(row => [row.x, row.y] as [OptionName, number]),
symbolSize: showMarkers ? markerSize : 0,
lineStyle: {
opacity: parseAnnotationOpacity(opacity),
type: style as ZRLineType,
width: hideLine ? 0 : width,
},
});
});
}
return series;
}
export function getPadding(
showLegend: boolean,
legendOrientation: LegendOrientation,
addYAxisTitleOffset: boolean,
zoomable: boolean,
margin?: string | number | null,
addXAxisTitleOffset?: boolean,
yAxisTitlePosition?: string,
yAxisTitleMargin?: number,
xAxisTitleMargin?: number,
): {
bottom: number;
left: number;
right: number;
top: number;
} {
const yAxisOffset = addYAxisTitleOffset
? TIMESERIES_CONSTANTS.yAxisLabelTopOffset
: 0;
const xAxisOffset = addXAxisTitleOffset ? Number(xAxisTitleMargin) || 0 : 0;
return getChartPadding(showLegend, legendOrientation, margin, {
top:
yAxisTitlePosition && yAxisTitlePosition === 'Top'
? TIMESERIES_CONSTANTS.gridOffsetTop + (Number(yAxisTitleMargin) || 0)
: TIMESERIES_CONSTANTS.gridOffsetTop + yAxisOffset,
bottom: zoomable
? TIMESERIES_CONSTANTS.gridOffsetBottomZoomable + xAxisOffset
: TIMESERIES_CONSTANTS.gridOffsetBottom + xAxisOffset,
left:
yAxisTitlePosition === 'Left'
? TIMESERIES_CONSTANTS.gridOffsetLeft + (Number(yAxisTitleMargin) || 0)
: TIMESERIES_CONSTANTS.gridOffsetLeft,
right:
showLegend && legendOrientation === LegendOrientation.Right
? 0
: TIMESERIES_CONSTANTS.gridOffsetRight,
});
}
export function getTooltipTimeFormatter(
format?: string,
): TimeFormatter | StringConstructor {
if (format === smartDateFormatter.id) {
return smartDateDetailedFormatter;
}
if (format) {
return getTimeFormatter(format);
}
return String;
}
export function getXAxisFormatter(
format?: string,
): TimeFormatter | StringConstructor | undefined {
if (format === smartDateFormatter.id || !format) {
return undefined;
}
if (format) {
return getTimeFormatter(format);
}
return String;
}
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts | 1 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.9982646107673645,
0.19486044347286224,
0.00016530579887330532,
0.00020592217333614826,
0.39238524436950684
] |
{
"id": 2,
"code_window": [
" markerSize: number,\n",
" data: TimeseriesDataRecord[],\n",
" annotationData: AnnotationData,\n",
"): SeriesOption[] {\n",
" const series: SeriesOption[] = [];\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" colorScale: CategoricalColorScale,\n",
" sliceId?: number,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "add",
"edit_start_line_idx": 420
} | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""annotations
Revision ID: ddd6ebdd853b
Revises: ca69c70ec99b
Create Date: 2017-09-13 16:36:39.144489
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "ddd6ebdd853b"
down_revision = "ca69c70ec99b"
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"annotation_layer",
sa.Column("created_on", sa.DateTime(), nullable=True),
sa.Column("changed_on", sa.DateTime(), nullable=True),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=250), nullable=True),
sa.Column("descr", sa.Text(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["changed_by_fk"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["created_by_fk"], ["ab_user.id"]),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"annotation",
sa.Column("created_on", sa.DateTime(), nullable=True),
sa.Column("changed_on", sa.DateTime(), nullable=True),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("start_dttm", sa.DateTime(), nullable=True),
sa.Column("end_dttm", sa.DateTime(), nullable=True),
sa.Column("layer_id", sa.Integer(), nullable=True),
sa.Column("short_descr", sa.String(length=500), nullable=True),
sa.Column("long_descr", sa.Text(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["changed_by_fk"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["created_by_fk"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["layer_id"], ["annotation_layer.id"]),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
"ti_dag_state",
"annotation",
["layer_id", "start_dttm", "end_dttm"],
unique=False,
)
def downgrade():
op.drop_index("ti_dag_state", table_name="annotation")
op.drop_table("annotation")
op.drop_table("annotation_layer")
| superset/migrations/versions/ddd6ebdd853b_annotations.py | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.0001784816849976778,
0.00017134708468802273,
0.0001649601908866316,
0.00017094388022087514,
0.000004996501047571655
] |
{
"id": 2,
"code_window": [
" markerSize: number,\n",
" data: TimeseriesDataRecord[],\n",
" annotationData: AnnotationData,\n",
"): SeriesOption[] {\n",
" const series: SeriesOption[] = [];\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" colorScale: CategoricalColorScale,\n",
" sliceId?: number,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "add",
"edit_start_line_idx": 420
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React, { useEffect, useRef, useState } from 'react';
import { InputNumber } from 'src/components/Input';
import { t, styled } from '@superset-ui/core';
import { debounce } from 'lodash';
import ControlHeader from 'src/explore/components/ControlHeader';
type ValueType = (number | null)[];
export type BoundsControlProps = {
onChange?: (value: ValueType) => void;
value?: ValueType;
};
const StyledDiv = styled.div`
display: flex;
`;
const MinInput = styled(InputNumber)`
flex: 1;
margin-right: ${({ theme }) => theme.gridUnit}px;
`;
const MaxInput = styled(InputNumber)`
flex: 1;
margin-left: ${({ theme }) => theme.gridUnit}px;
`;
const parseNumber = (value: undefined | number | string | null) =>
value === null || Number.isNaN(Number(value)) ? null : Number(value);
export default function BoundsControl({
onChange = () => {},
value = [null, null],
...props
}: BoundsControlProps) {
const [minMax, setMinMax] = useState<ValueType>([
parseNumber(value[0]),
parseNumber(value[1]),
]);
const min = value[0];
const max = value[1];
const debouncedOnChange = useRef(debounce(onChange, 300)).current;
const update = (mm: ValueType) => {
setMinMax(mm);
debouncedOnChange([
mm[0] === undefined ? null : mm[0],
mm[1] === undefined ? null : mm[1],
]);
};
useEffect(() => {
setMinMax([parseNumber(min), parseNumber(max)]);
}, [min, max]);
const onMinChange = (value: number | string | undefined) => {
update([parseNumber(value), minMax[1]]);
};
const onMaxChange = (value: number | string | undefined) => {
update([minMax[0], parseNumber(value)]);
};
return (
<div>
<ControlHeader {...props} />
<StyledDiv>
<MinInput
data-test="min-bound"
placeholder={t('Min')}
// emit (string | number | undefined)
onChange={onMinChange}
// accept (number | undefined)
value={minMax[0] === null ? undefined : minMax[0]}
/>
<MaxInput
data-test="max-bound"
placeholder={t('Max')}
// emit (number | string | undefined)
onChange={onMaxChange}
// accept (number | undefined)
value={minMax[1] === null ? undefined : minMax[1]}
/>
</StyledDiv>
</div>
);
}
| superset-frontend/src/explore/components/controls/BoundsControl.tsx | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00017893596668727696,
0.00017456425121054053,
0.00016767064516898245,
0.00017363650840707123,
0.0000035114203456032556
] |
{
"id": 2,
"code_window": [
" markerSize: number,\n",
" data: TimeseriesDataRecord[],\n",
" annotationData: AnnotationData,\n",
"): SeriesOption[] {\n",
" const series: SeriesOption[] = [];\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" colorScale: CategoricalColorScale,\n",
" sliceId?: number,\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "add",
"edit_start_line_idx": 420
} | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from textwrap import dedent
from superset.db_engine_specs.redshift import RedshiftEngineSpec
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec
class TestRedshiftDbEngineSpec(TestDbEngineSpec):
def test_extract_errors(self):
"""
Test that custom error messages are extracted correctly.
"""
msg = 'FATAL: password authentication failed for user "wronguser"'
result = RedshiftEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
error_type=SupersetErrorType.CONNECTION_ACCESS_DENIED_ERROR,
message='Either the username "wronguser" or the password is incorrect.',
level=ErrorLevel.ERROR,
extra={
"invalid": ["username", "password"],
"engine_name": "Amazon Redshift",
"issue_codes": [
{
"code": 1014,
"message": "Issue 1014 - Either the username "
"or the password is wrong.",
},
{
"code": 1015,
"message": "Issue 1015 - Either the database is "
"spelled incorrectly or does not exist.",
},
],
},
)
]
msg = (
'redshift: error: could not translate host name "badhost" '
"to address: nodename nor servname provided, or not known"
)
result = RedshiftEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
error_type=SupersetErrorType.CONNECTION_INVALID_HOSTNAME_ERROR,
message='The hostname "badhost" cannot be resolved.',
level=ErrorLevel.ERROR,
extra={
"invalid": ["host"],
"engine_name": "Amazon Redshift",
"issue_codes": [
{
"code": 1007,
"message": "Issue 1007 - The hostname provided "
"can't be resolved.",
}
],
},
)
]
msg = dedent(
"""
psql: error: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 12345?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 12345?
"""
)
result = RedshiftEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
error_type=SupersetErrorType.CONNECTION_PORT_CLOSED_ERROR,
message='Port 12345 on hostname "localhost" refused the connection.',
level=ErrorLevel.ERROR,
extra={
"invalid": ["host", "port"],
"engine_name": "Amazon Redshift",
"issue_codes": [
{"code": 1008, "message": "Issue 1008 - The port is closed."}
],
},
)
]
msg = dedent(
"""
psql: error: could not connect to server: Operation timed out
Is the server running on host "example.com" (93.184.216.34) and accepting
TCP/IP connections on port 12345?
"""
)
result = RedshiftEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
error_type=SupersetErrorType.CONNECTION_HOST_DOWN_ERROR,
message=(
'The host "example.com" might be down, '
"and can't be reached on port 12345."
),
level=ErrorLevel.ERROR,
extra={
"engine_name": "Amazon Redshift",
"issue_codes": [
{
"code": 1009,
"message": "Issue 1009 - The host might be down, "
"and can't be reached on the provided port.",
}
],
"invalid": ["host", "port"],
},
)
]
# response with IP only
msg = dedent(
"""
psql: error: could not connect to server: Operation timed out
Is the server running on host "93.184.216.34" and accepting
TCP/IP connections on port 12345?
"""
)
result = RedshiftEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
error_type=SupersetErrorType.CONNECTION_HOST_DOWN_ERROR,
message=(
'The host "93.184.216.34" might be down, '
"and can't be reached on port 12345."
),
level=ErrorLevel.ERROR,
extra={
"engine_name": "Amazon Redshift",
"issue_codes": [
{
"code": 1009,
"message": "Issue 1009 - The host might be down, "
"and can't be reached on the provided port.",
}
],
"invalid": ["host", "port"],
},
)
]
msg = 'database "badDB" does not exist'
result = RedshiftEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
error_type=SupersetErrorType.CONNECTION_UNKNOWN_DATABASE_ERROR,
message='We were unable to connect to your database named "badDB".'
" Please verify your database name and try again.",
level=ErrorLevel.ERROR,
extra={
"engine_name": "Amazon Redshift",
"issue_codes": [
{
"code": 10015,
"message": "Issue 1015 - Either the database is "
"spelled incorrectly or does not exist.",
}
],
"invalid": ["database"],
},
)
]
| tests/integration_tests/db_engine_specs/redshift_tests.py | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00017930453759618104,
0.00017046388529706746,
0.0001669516204856336,
0.00016966357361525297,
0.0000033035839805961587
] |
{
"id": 3,
"code_window": [
"): SeriesOption[] {\n",
" const series: SeriesOption[] = [];\n",
" const { hideLine, name, opacity, showMarkers, style, width } = layer;\n",
" const result = annotationData[name];\n",
" if (isTimeseriesAnnotationResult(result)) {\n",
" result.forEach(annotation => {\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" const { hideLine, name, opacity, showMarkers, style, width, color } = layer;\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "replace",
"edit_start_line_idx": 422
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable camelcase */
import {
AnnotationLayer,
CategoricalColorNamespace,
DataRecordValue,
TimeseriesDataRecord,
getNumberFormatter,
isEventAnnotationLayer,
isFormulaAnnotationLayer,
isIntervalAnnotationLayer,
isTimeseriesAnnotationLayer,
} from '@superset-ui/core';
import { EChartsCoreOption, SeriesOption } from 'echarts';
import {
DEFAULT_FORM_DATA,
EchartsMixedTimeseriesFormData,
EchartsMixedTimeseriesChartTransformedProps,
EchartsMixedTimeseriesProps,
} from './types';
import { ForecastSeriesEnum } from '../types';
import { parseYAxisBound } from '../utils/controls';
import {
currentSeries,
dedupSeries,
extractSeries,
getLegendProps,
} from '../utils/series';
import { extractAnnotationLabels } from '../utils/annotation';
import {
extractForecastSeriesContext,
extractForecastValuesFromTooltipParams,
formatForecastTooltipSeries,
rebaseForecastDatum,
} from '../utils/forecast';
import { convertInteger } from '../utils/convertInteger';
import { defaultGrid, defaultTooltip, defaultYAxis } from '../defaults';
import {
getPadding,
getTooltipTimeFormatter,
getXAxisFormatter,
transformEventAnnotation,
transformFormulaAnnotation,
transformIntervalAnnotation,
transformSeries,
transformTimeseriesAnnotation,
} from '../Timeseries/transformers';
import { TIMESERIES_CONSTANTS } from '../constants';
export default function transformProps(
chartProps: EchartsMixedTimeseriesProps,
): EchartsMixedTimeseriesChartTransformedProps {
const {
width,
height,
formData,
queriesData,
hooks,
filterState,
datasource,
} = chartProps;
const { annotation_data: annotationData_ } = queriesData[0];
const annotationData = annotationData_ || {};
const { verboseMap = {} } = datasource;
const data1 = (queriesData[0].data || []) as TimeseriesDataRecord[];
const data2 = (queriesData[1].data || []) as TimeseriesDataRecord[];
const {
area,
areaB,
annotationLayers,
colorScheme,
contributionMode,
legendOrientation,
legendType,
logAxis,
logAxisSecondary,
markerEnabled,
markerEnabledB,
markerSize,
markerSizeB,
opacity,
opacityB,
minorSplitLine,
seriesType,
seriesTypeB,
showLegend,
showValue,
showValueB,
stack,
stackB,
truncateYAxis,
tooltipTimeFormat,
yAxisFormat,
yAxisFormatSecondary,
xAxisTimeFormat,
yAxisBounds,
yAxisIndex,
yAxisIndexB,
yAxisTitleSecondary,
zoomable,
richTooltip,
tooltipSortByMetric,
xAxisLabelRotation,
groupby,
groupbyB,
emitFilter,
emitFilterB,
xAxisTitle,
yAxisTitle,
xAxisTitleMargin,
yAxisTitleMargin,
yAxisTitlePosition,
sliceId,
}: EchartsMixedTimeseriesFormData = { ...DEFAULT_FORM_DATA, ...formData };
const colorScale = CategoricalColorNamespace.getScale(colorScheme as string);
const rebasedDataA = rebaseForecastDatum(data1, verboseMap);
const rawSeriesA = extractSeries(rebasedDataA, {
fillNeighborValue: stack ? 0 : undefined,
});
const rebasedDataB = rebaseForecastDatum(data2, verboseMap);
const rawSeriesB = extractSeries(rebasedDataB, {
fillNeighborValue: stackB ? 0 : undefined,
});
const series: SeriesOption[] = [];
const formatter = getNumberFormatter(contributionMode ? ',.0%' : yAxisFormat);
const formatterSecondary = getNumberFormatter(
contributionMode ? ',.0%' : yAxisFormatSecondary,
);
const primarySeries = new Set<string>();
const secondarySeries = new Set<string>();
const mapSeriesIdToAxis = (
seriesOption: SeriesOption,
index?: number,
): void => {
if (index === 1) {
secondarySeries.add(seriesOption.id as string);
} else {
primarySeries.add(seriesOption.id as string);
}
};
rawSeriesA.forEach(seriesOption =>
mapSeriesIdToAxis(seriesOption, yAxisIndex),
);
rawSeriesB.forEach(seriesOption =>
mapSeriesIdToAxis(seriesOption, yAxisIndexB),
);
rawSeriesA.forEach(entry => {
const transformedSeries = transformSeries(entry, colorScale, {
area,
markerEnabled,
markerSize,
areaOpacity: opacity,
seriesType,
showValue,
stack,
yAxisIndex,
filterState,
seriesKey: entry.name,
sliceId,
});
if (transformedSeries) series.push(transformedSeries);
});
rawSeriesB.forEach(entry => {
const transformedSeries = transformSeries(entry, colorScale, {
area: areaB,
markerEnabled: markerEnabledB,
markerSize: markerSizeB,
areaOpacity: opacityB,
seriesType: seriesTypeB,
showValue: showValueB,
stack: stackB,
yAxisIndex: yAxisIndexB,
filterState,
seriesKey: primarySeries.has(entry.name as string)
? `${entry.name} (1)`
: entry.name,
sliceId,
});
if (transformedSeries) series.push(transformedSeries);
});
annotationLayers
.filter((layer: AnnotationLayer) => layer.show)
.forEach((layer: AnnotationLayer) => {
if (isFormulaAnnotationLayer(layer))
series.push(
transformFormulaAnnotation(layer, data1, colorScale, sliceId),
);
else if (isIntervalAnnotationLayer(layer)) {
series.push(
...transformIntervalAnnotation(
layer,
data1,
annotationData,
colorScale,
sliceId,
),
);
} else if (isEventAnnotationLayer(layer)) {
series.push(
...transformEventAnnotation(
layer,
data1,
annotationData,
colorScale,
sliceId,
),
);
} else if (isTimeseriesAnnotationLayer(layer)) {
series.push(
...transformTimeseriesAnnotation(
layer,
markerSize,
data1,
annotationData,
),
);
}
});
// yAxisBounds need to be parsed to replace incompatible values with undefined
let [min, max] = (yAxisBounds || []).map(parseYAxisBound);
// default to 0-100% range when doing row-level contribution chart
if (contributionMode === 'row' && stack) {
if (min === undefined) min = 0;
if (max === undefined) max = 1;
}
const tooltipTimeFormatter = getTooltipTimeFormatter(tooltipTimeFormat);
const xAxisFormatter = getXAxisFormatter(xAxisTimeFormat);
const addYAxisTitleOffset = !!(yAxisTitle || yAxisTitleSecondary);
const addXAxisTitleOffset = !!xAxisTitle;
const chartPadding = getPadding(
showLegend,
legendOrientation,
addYAxisTitleOffset,
zoomable,
null,
addXAxisTitleOffset,
yAxisTitlePosition,
convertInteger(yAxisTitleMargin),
convertInteger(xAxisTitleMargin),
);
const labelMap = rawSeriesA.reduce((acc, datum) => {
const label = datum.name as string;
return {
...acc,
[label]: label.split(', '),
};
}, {}) as Record<string, DataRecordValue[]>;
const labelMapB = rawSeriesB.reduce((acc, datum) => {
const label = datum.name as string;
return {
...acc,
[label]: label.split(', '),
};
}, {}) as Record<string, DataRecordValue[]>;
const { setDataMask = () => {} } = hooks;
const alignTicks = yAxisIndex !== yAxisIndexB;
const echartOptions: EChartsCoreOption = {
useUTC: true,
grid: {
...defaultGrid,
...chartPadding,
},
xAxis: {
type: 'time',
name: xAxisTitle,
nameGap: convertInteger(xAxisTitleMargin),
nameLocation: 'middle',
axisLabel: {
formatter: xAxisFormatter,
rotate: xAxisLabelRotation,
},
},
yAxis: [
{
...defaultYAxis,
type: logAxis ? 'log' : 'value',
min,
max,
minorTick: { show: true },
minorSplitLine: { show: minorSplitLine },
axisLabel: { formatter },
scale: truncateYAxis,
name: yAxisTitle,
nameGap: convertInteger(yAxisTitleMargin),
nameLocation: yAxisTitlePosition === 'Left' ? 'middle' : 'end',
alignTicks,
},
{
...defaultYAxis,
type: logAxisSecondary ? 'log' : 'value',
min,
max,
minorTick: { show: true },
splitLine: { show: false },
minorSplitLine: { show: minorSplitLine },
axisLabel: { formatter: formatterSecondary },
scale: truncateYAxis,
name: yAxisTitleSecondary,
alignTicks,
},
],
tooltip: {
...defaultTooltip,
appendToBody: true,
trigger: richTooltip ? 'axis' : 'item',
formatter: (params: any) => {
const xValue: number = richTooltip
? params[0].value[0]
: params.value[0];
const forecastValue: any[] = richTooltip ? params : [params];
if (richTooltip && tooltipSortByMetric) {
forecastValue.sort((a, b) => b.data[1] - a.data[1]);
}
const rows: Array<string> = [`${tooltipTimeFormatter(xValue)}`];
const forecastValues =
extractForecastValuesFromTooltipParams(forecastValue);
Object.keys(forecastValues).forEach(key => {
const value = forecastValues[key];
const content = formatForecastTooltipSeries({
...value,
seriesName: key,
formatter: primarySeries.has(key) ? formatter : formatterSecondary,
});
if (currentSeries.name === key) {
rows.push(`<span style="font-weight: 700">${content}</span>`);
} else {
rows.push(`<span style="opacity: 0.7">${content}</span>`);
}
});
return rows.join('<br />');
},
},
legend: {
...getLegendProps(legendType, legendOrientation, showLegend, zoomable),
// @ts-ignore
data: rawSeriesA
.concat(rawSeriesB)
.filter(
entry =>
extractForecastSeriesContext((entry.name || '') as string).type ===
ForecastSeriesEnum.Observation,
)
.map(entry => entry.name || '')
.concat(extractAnnotationLabels(annotationLayers, annotationData)),
},
series: dedupSeries(series),
toolbox: {
show: zoomable,
top: TIMESERIES_CONSTANTS.toolboxTop,
right: TIMESERIES_CONSTANTS.toolboxRight,
feature: {
dataZoom: {
yAxisIndex: false,
title: {
zoom: 'zoom area',
back: 'restore zoom',
},
},
},
},
dataZoom: zoomable
? [
{
type: 'slider',
start: TIMESERIES_CONSTANTS.dataZoomStart,
end: TIMESERIES_CONSTANTS.dataZoomEnd,
bottom: TIMESERIES_CONSTANTS.zoomBottom,
},
]
: [],
};
return {
formData,
width,
height,
echartOptions,
setDataMask,
emitFilter,
emitFilterB,
labelMap,
labelMapB,
groupby,
groupbyB,
seriesBreakdown: rawSeriesA.length,
selectedValues: filterState.selectedValues || [],
};
}
| superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts | 1 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.9945607781410217,
0.1320730596780777,
0.00016304035671055317,
0.00017822881636675447,
0.3268450200557709
] |
{
"id": 3,
"code_window": [
"): SeriesOption[] {\n",
" const series: SeriesOption[] = [];\n",
" const { hideLine, name, opacity, showMarkers, style, width } = layer;\n",
" const result = annotationData[name];\n",
" if (isTimeseriesAnnotationResult(result)) {\n",
" result.forEach(annotation => {\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" const { hideLine, name, opacity, showMarkers, style, width, color } = layer;\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "replace",
"edit_start_line_idx": 422
} | {
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "ISO": "RW-02", "NAME_1": "Eastern" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 30.41507328300014, -2.313087665999902 ], [ 30.383447306000051, -2.305542906999946 ], [ 30.378589722000129, -2.303062438999888 ], [ 30.362518351000062, -2.307816670999969 ], [ 30.352751505000128, -2.316911722999933 ], [ 30.348610082000107, -2.322351935999933 ], [ 30.344018189000053, -2.328383890999959 ], [ 30.331150756000056, -2.340269469999981 ], [ 30.316784709000046, -2.34760752299988 ], [ 30.297974487000147, -2.353705341999941 ], [ 30.278854207000052, -2.357632750999912 ], [ 30.262731161000147, -2.358356220999909 ], [ 30.250328816000092, -2.355565693999935 ], [ 30.219116252000106, -2.34037282299991 ], [ 30.207489054000064, -2.339235940999913 ], [ 30.203923381000095, -2.345953877999932 ], [ 30.203406617000041, -2.355358988999896 ], [ 30.201339559000075, -2.362386982999894 ], [ 30.156174357000111, -2.419024352999884 ], [ 30.13912113400005, -2.430806578999892 ], [ 30.116796916000112, -2.431530049999893 ], [ 30.093852580000146, -2.422641702999968 ], [ 30.072975301000099, -2.408792418999909 ], [ 30.056542196000123, -2.394426370999909 ], [ 30.025536336000073, -2.35773610499993 ], [ 30.013340698000093, -2.34833099399988 ], [ 30.001920207000069, -2.344300230999892 ], [ 29.992308390000062, -2.343990172999895 ], [ 29.983885131000079, -2.344816995999921 ], [ 29.976133667000056, -2.343680114999913 ], [ 29.958519715000079, -2.328532809999928 ], [ 29.956781100967021, -2.327037671051698 ], [ 29.959142617238001, -2.324316793784988 ], [ 29.960476970136028, -2.321453493583874 ], [ 29.961623085936651, -2.318994121181731 ], [ 29.964000201847796, -2.299822165160776 ], [ 29.967570917763624, -2.281075905029013 ], [ 29.967927611370158, -2.279203267416847 ], [ 29.968464144204859, -2.277640421068611 ], [ 29.980381630807585, -2.242926412923623 ], [ 29.985911009885172, -2.193833801988376 ], [ 29.984257362587186, -2.160657532918833 ], [ 29.995006060581204, -2.139883606443277 ], [ 30.009888873672537, -2.123605531170313 ], [ 30.016503456569239, -2.111461569196081 ], [ 30.016606810256064, -2.099937724846143 ], [ 30.016658487099505, -2.081799297599503 ], [ 30.017847044605389, -2.072135803424601 ], [ 30.022394570852725, -2.068260071645 ], [ 30.032006387284923, -2.064022604659499 ], [ 30.038207559031605, -2.060611959973983 ], [ 30.043426878847356, -2.055134257739837 ], [ 30.050609903424288, -2.053170553877976 ], [ 30.054227252785495, -2.057459697706918 ], [ 30.058878131820336, -2.063609192610159 ], [ 30.067456418578843, -2.064539368596968 ], [ 30.073605915280723, -2.063764222241048 ], [ 30.076396442341945, -2.062885723097679 ], [ 30.079755410184021, -2.062058899898318 ], [ 30.085698200411628, -2.060922017437179 ], [ 30.092261107364209, -2.059475077512843 ], [ 30.09804886796087, -2.057666403281871 ], [ 30.107040566768717, -2.055754374464811 ], [ 30.115102089589755, -2.055030904952332 ], [ 30.117995970337745, -2.054927552164827 ], [ 30.121406615023261, -2.054307434540476 ], [ 30.123835406878527, -2.050586731492501 ], [ 30.129829873050198, -2.045470764464199 ], [ 30.13680619205212, -2.040354797435953 ], [ 30.14254227580534, -2.037357565699097 ], [ 30.153239296955974, -2.032706686664255 ], [ 30.165383258930262, -2.028417542835371 ], [ 30.177630573691999, -2.031879862565631 ], [ 30.188172565211687, -2.045729147781969 ], [ 30.194942177739279, -2.056116110570031 ], [ 30.202538612566912, -2.065624574214723 ], [ 30.209049843575428, -2.074667949866011 ], [ 30.21581945700234, -2.065056132534494 ], [ 30.223725951091751, -2.046969382131294 ], [ 30.230340533988453, -2.010899232313704 ], [ 30.233337768423269, -1.974829081596852 ], [ 30.233957884248923, -1.963253561302849 ], [ 30.239383909639685, -1.957052389556168 ], [ 30.253801634737613, -1.950954570596991 ], [ 30.267444212580301, -1.944443339588474 ], [ 30.272146767559263, -1.936020081561537 ], [ 30.272508502765163, -1.916383037547178 ], [ 30.270441445216477, -1.900001608587388 ], [ 30.264550332731631, -1.894058817460461 ], [ 30.258349160085629, -1.886462383532205 ], [ 30.259020954553364, -1.872664776058571 ], [ 30.255196897818564, -1.858247050960642 ], [ 30.248375609346851, -1.848531881740939 ], [ 30.247083698154142, -1.843209209137683 ], [ 30.251062783620569, -1.840315329289012 ], [ 30.258142455409995, -1.832822245450302 ], [ 30.266720742168502, -1.826931132965399 ], [ 30.272405149977658, -1.823520488279939 ], [ 30.272095091615142, -1.80827594088197 ], [ 30.2643436262573, -1.777580140511077 ], [ 30.254008340312623, -1.743266988980395 ], [ 30.250442665996218, -1.722286357829148 ], [ 30.254266722731074, -1.711175924629231 ], [ 30.25762569057315, -1.699703757122677 ], [ 30.251734577188984, -1.686267884854999 ], [ 30.237471881721945, -1.670816630982756 ], [ 30.218041543282595, -1.646683737564445 ], [ 30.199903115136635, -1.623119284027723 ], [ 30.186880654918298, -1.60937335249821 ], [ 30.177010456067649, -1.591596659558206 ], [ 30.169310667553248, -1.57123614603131 ], [ 30.165124877411131, -1.54886025089985 ], [ 30.170395873171003, -1.532065410790096 ], [ 30.178354043204536, -1.524934063056548 ], [ 30.178767454354499, -1.520334859965828 ], [ 30.173289753019674, -1.517389303273717 ], [ 30.163522906956587, -1.517389303273717 ], [ 30.151585650557308, -1.521575093415834 ], [ 30.14254227580534, -1.524313944532935 ], [ 30.141818805393541, -1.515115541049397 ], [ 30.13928666075077, -1.499715964020538 ], [ 30.135049192865949, -1.490310853163351 ], [ 30.126419229264002, -1.471500630549656 ], [ 30.117685911975229, -1.455222555276691 ], [ 30.106523802831191, -1.438376037424177 ], [ 30.093914752863554, -1.417292053485482 ], [ 30.087403522754357, -1.412072734569051 ], [ 30.081874144576091, -1.404527975685539 ], [ 30.078721881409706, -1.394347717573112 ], [ 30.073089150443934, -1.389903545012601 ], [ 30.070195270595264, -1.38912839865668 ], [ 30.065984342603315, -1.386944953546788 ], [ 30.095506226000111, -1.371129658999962 ], [ 30.136330607000104, -1.35521331799994 ], [ 30.147182658000077, -1.345084736999894 ], [ 30.15235030100007, -1.329891865999869 ], [ 30.158448120000116, -1.291134541999924 ], [ 30.165579468000146, -1.277491963999921 ], [ 30.173434286000088, -1.272841084999953 ], [ 30.18139245600014, -1.271497497999903 ], [ 30.189350627000124, -1.270877379999931 ], [ 30.196740356000134, -1.26870696999994 ], [ 30.212191610000104, -1.259508564999933 ], [ 30.256685018000098, -1.217237243999946 ], [ 30.269759156000077, -1.200494079999899 ], [ 30.280507853000074, -1.182407327999982 ], [ 30.282419882000113, -1.175792744999896 ], [ 30.284641968000074, -1.161426695999893 ], [ 30.287535848000061, -1.15543222999986 ], [ 30.290949658000102, -1.15262085699996 ], [ 30.294563843000105, -1.149644469999885 ], [ 30.311307007000039, -1.142099710999929 ], [ 30.317404826000086, -1.137035419999961 ], [ 30.322572469000079, -1.121842549999926 ], [ 30.329032023000082, -1.0805014029999 ], [ 30.337455282000064, -1.066238707999929 ], [ 30.352751505000128, -1.06076100699994 ], [ 30.36928796400008, -1.063241474999913 ], [ 30.386341186000038, -1.068202412999952 ], [ 30.403187703000128, -1.070372822999943 ], [ 30.418897339000068, -1.066445413999887 ], [ 30.432023153000046, -1.060554300999883 ], [ 30.445614054000146, -1.058693948999874 ], [ 30.460828622942586, -1.063427549541814 ], [ 30.471785843000134, -1.066836591999916 ], [ 30.463855835000118, -1.075127054999939 ], [ 30.456156047000093, -1.086082457999922 ], [ 30.453003785000135, -1.097347919999976 ], [ 30.456311076000134, -1.108096617999905 ], [ 30.470883829000115, -1.118121845999923 ], [ 30.474191121000104, -1.131764424999929 ], [ 30.472072388000129, -1.137655537999933 ], [ 30.468300008000085, -1.14333994499988 ], [ 30.465612834000069, -1.149334410999899 ], [ 30.467266479000045, -1.155328876999931 ], [ 30.476051473000098, -1.161219990999925 ], [ 30.484009643000093, -1.159979755999899 ], [ 30.49052087400014, -1.156465758999943 ], [ 30.494654989000082, -1.155328876999931 ], [ 30.506953979000116, -1.164217223999941 ], [ 30.511191447000044, -1.170418395999931 ], [ 30.515118856000129, -1.196256611999942 ], [ 30.521216675000062, -1.210829365999913 ], [ 30.539406779000046, -1.241008401999906 ], [ 30.545297892000121, -1.261368915999938 ], [ 30.554599650000057, -1.273461201999922 ], [ 30.556615031000092, -1.281626077999945 ], [ 30.55563317900004, -1.284726663999891 ], [ 30.553359416000035, -1.289067483999872 ], [ 30.550982300000044, -1.294958597999965 ], [ 30.549948771000061, -1.302400003999892 ], [ 30.555323120000139, -1.318419697999943 ], [ 30.568242228000145, -1.328134867999978 ], [ 30.597697795000045, -1.340330504999898 ], [ 30.608239787000116, -1.347771911999914 ], [ 30.623225952000098, -1.362034606999899 ], [ 30.632424357000104, -1.367615660999917 ], [ 30.698466837000126, -1.392110290999966 ], [ 30.718103881000104, -1.394900817999925 ], [ 30.737534220000043, -1.406683043999919 ], [ 30.743218628000079, -1.432831318999931 ], [ 30.741358277000074, -1.458876240999913 ], [ 30.738257690000069, -1.470658467999911 ], [ 30.732935018000035, -1.476446227999887 ], [ 30.738877808000041, -1.489468687999917 ], [ 30.755414266000116, -1.511586201999933 ], [ 30.767816610000068, -1.524815368999924 ], [ 30.772260783000092, -1.532463479999905 ], [ 30.781975952000039, -1.568430276999962 ], [ 30.791587768000056, -1.590961201999988 ], [ 30.807245728000112, -1.60326019299994 ], [ 30.831016887000146, -1.594165139999873 ], [ 30.838303263000057, -1.61535247799992 ], [ 30.837476440000103, -1.641087340999917 ], [ 30.824557333000087, -1.719945576999933 ], [ 30.82424727300014, -1.730694273999873 ], [ 30.826521037000134, -1.735861917999955 ], [ 30.835409383000069, -1.749504495999872 ], [ 30.837889852000046, -1.758702900999964 ], [ 30.826417684000035, -1.786194762999941 ], [ 30.829931681000062, -1.796736754999912 ], [ 30.837889852000046, -1.836837666999898 ], [ 30.832412150000039, -1.853787536999903 ], [ 30.822231893000094, -1.86877370199997 ], [ 30.816599162000045, -1.884173278999867 ], [ 30.82424727300014, -1.902053324999926 ], [ 30.808020874000078, -1.914765725999885 ], [ 30.801923055000145, -1.921276956999947 ], [ 30.796962118000124, -1.929338479999927 ], [ 30.826934449000134, -1.934092711999924 ], [ 30.829931681000062, -1.960551044999917 ], [ 30.816754191000086, -2.01873870799993 ], [ 30.835461059000068, -2.014707946999934 ], [ 30.853496135000057, -2.02369964499988 ], [ 30.868740682000123, -2.038995869999923 ], [ 30.879437703000121, -2.053465270999951 ], [ 30.88780928500006, -2.08250742599995 ], [ 30.853392782000128, -2.193818460999893 ], [ 30.844711141000062, -2.23784678099986 ], [ 30.848948608000114, -2.306266377999947 ], [ 30.844711141000062, -2.326626891999879 ], [ 30.834375855000076, -2.34533375999996 ], [ 30.821353394000141, -2.354738870999924 ], [ 30.804558553000049, -2.362180276999936 ], [ 30.789107300000069, -2.371068623999861 ], [ 30.77515466300008, -2.374479267999973 ], [ 30.767919963000111, -2.378613382999902 ], [ 30.758824910000044, -2.381093851999879 ], [ 30.750660034000134, -2.379130146999941 ], [ 30.698466837000126, -2.353395283999944 ], [ 30.68771813900014, -2.349984638999928 ], [ 30.674799031000134, -2.351741637999908 ], [ 30.663326864000112, -2.360733336999942 ], [ 30.649064168000109, -2.387605081999951 ], [ 30.637850382000067, -2.3970101929999 ], [ 30.616921427000079, -2.398147073999908 ], [ 30.595217325000078, -2.391945901999932 ], [ 30.573926636000124, -2.389258727999987 ], [ 30.554599650000057, -2.400627542999885 ], [ 30.521733440000048, -2.399387308999863 ], [ 30.488453817000106, -2.383781025999909 ], [ 30.434141886000134, -2.339235940999913 ], [ 30.428405802000043, -2.331381123999961 ], [ 30.42323815900005, -2.317325133999944 ], [ 30.418483927000068, -2.311847431999865 ], [ 30.41507328300014, -2.313087665999902 ] ] ] } },
{ "type": "Feature", "properties": { "ISO": "RW-05", "NAME_1": "Southern" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 29.956781100967021, -2.327037671051698 ], [ 29.949933716000146, -2.3211491899999 ], [ 29.941923869000107, -2.316601663999947 ], [ 29.931691935000117, -2.316911722999933 ], [ 29.928798055000129, -2.322492776999951 ], [ 29.928901408000058, -2.331794534999887 ], [ 29.922390177000068, -2.382954202999883 ], [ 29.929573202000142, -2.459848733999877 ], [ 29.90792077600014, -2.535399678999909 ], [ 29.903725677797752, -2.637946527810016 ], [ 29.903269898000076, -2.649087828999896 ], [ 29.897895548000122, -2.671101988999879 ], [ 29.888387085000147, -2.692909443999909 ], [ 29.87619144700011, -2.713580016999913 ], [ 29.862858927000104, -2.731666768999929 ], [ 29.842395060000058, -2.752440693999887 ], [ 29.823584839000034, -2.763499450999888 ], [ 29.803379354000128, -2.767323505999926 ], [ 29.778522990000113, -2.766600036999918 ], [ 29.756198771000129, -2.759882099999899 ], [ 29.744726603000117, -2.759985452999928 ], [ 29.737285197000062, -2.769287210999948 ], [ 29.733977905000074, -2.790267841999949 ], [ 29.729637085000093, -2.799569599999884 ], [ 29.719921916000146, -2.805460713999892 ], [ 29.697546021000107, -2.808251240999937 ], [ 29.67868412200005, -2.805357360999949 ], [ 29.637086889000045, -2.791628628999916 ], [ 29.626387573000045, -2.788097431999873 ], [ 29.619256225000129, -2.787684020999947 ], [ 29.589490600000147, -2.798432718999962 ], [ 29.582049194000092, -2.802980244999915 ], [ 29.57409102400004, -2.806080829999942 ], [ 29.563755737000122, -2.805667418999931 ], [ 29.541844930000082, -2.808561298999919 ], [ 29.523138061000111, -2.82044687899986 ], [ 29.504121135000048, -2.826854756999893 ], [ 29.480866740000124, -2.81372894299993 ], [ 29.444674800000087, -2.806989288999972 ], [ 29.425366251000128, -2.803393655999926 ], [ 29.407434530000046, -2.805460713999892 ], [ 29.36428470900006, -2.824167581999873 ], [ 29.339686727000071, -2.826441344999893 ], [ 29.330850057000134, -2.807424417999911 ], [ 29.329661499000053, -2.794918720999917 ], [ 29.320359741000118, -2.774144795999874 ], [ 29.318085978000056, -2.762569274999933 ], [ 29.321496623000087, -2.75213063599989 ], [ 29.335345907000089, -2.735180765999885 ], [ 29.337516316000062, -2.723811949999899 ], [ 29.331418497000129, -2.711409606999922 ], [ 29.309714396000118, -2.691049092999904 ], [ 29.30948054400011, -2.690126857999886 ], [ 29.328380084773073, -2.680160705552112 ], [ 29.333392699013814, -2.678662090583032 ], [ 29.342539426553287, -2.673856181917245 ], [ 29.3566470932887, -2.648689759724618 ], [ 29.359954385186711, -2.612619609907085 ], [ 29.348275511205884, -2.595463034591376 ], [ 29.343262897864406, -2.587969951651985 ], [ 29.341919309828256, -2.580941956705942 ], [ 29.343107868233517, -2.571691874580381 ], [ 29.345019896151257, -2.561925028517237 ], [ 29.340885781953261, -2.555672181725811 ], [ 29.335924843656585, -2.545853658819283 ], [ 29.328380084773073, -2.535880108080505 ], [ 29.322385618601402, -2.523426087743758 ], [ 29.320215208265211, -2.508233216289909 ], [ 29.311946979869219, -2.497122783089992 ], [ 29.298511106702165, -2.490973288186694 ], [ 29.279907590562857, -2.485133851645969 ], [ 29.267815306331329, -2.478570944693331 ], [ 29.266885130344463, -2.471853008109861 ], [ 29.271432656591799, -2.458727194204641 ], [ 29.280114297037187, -2.4460147914495 ], [ 29.301198281875202, -2.434749329517956 ], [ 29.321713825032987, -2.423483867586413 ], [ 29.325796263286918, -2.414388815091741 ], [ 29.322799030650742, -2.403123353160254 ], [ 29.319853473958631, -2.393718242303066 ], [ 29.328276731985568, -2.380230694091267 ], [ 29.338301959567787, -2.364366029069004 ], [ 29.339128782767091, -2.355167623786826 ], [ 29.332307493396058, -2.341214987581623 ], [ 29.325692909600093, -2.324781881778449 ], [ 29.328380084773073, -2.311242656723266 ], [ 29.33850866604206, -2.299150371592361 ], [ 29.353649860652524, -2.291398906234519 ], [ 29.368480996001153, -2.28912514311088 ], [ 29.379746458832017, -2.292535787796396 ], [ 29.392458860687839, -2.286799704043119 ], [ 29.411062376827203, -2.272795390994531 ], [ 29.431267861622473, -2.26948809909652 ], [ 29.448579466569129, -2.2690746879465 ], [ 29.460413369281525, -2.268557923109654 ], [ 29.466511188240702, -2.269436423152399 ], [ 29.481083942070256, -2.254295228541991 ], [ 29.505940305900367, -2.234864889203266 ], [ 29.519272826279916, -2.227423483107259 ], [ 29.530176553005504, -2.217811666675061 ], [ 29.542940631704766, -2.209853496641585 ], [ 29.548728392301427, -2.203755677682409 ], [ 29.55286250560016, -2.197864564298186 ], [ 29.55823685594612, -2.199776592215983 ], [ 29.564541379580987, -2.202205384071249 ], [ 29.571879433788808, -2.199311504222578 ], [ 29.580044310296671, -2.196934388311377 ], [ 29.586917275611768, -2.193058655632456 ], [ 29.597614296762345, -2.18659910056806 ], [ 29.605779173270207, -2.182258281694374 ], [ 29.605417438064308, -2.168564027008244 ], [ 29.601696735016276, -2.154766419534667 ], [ 29.598751178324221, -2.148565247787985 ], [ 29.59983638394192, -2.138384990574878 ], [ 29.608983112380713, -2.121590149565748 ], [ 29.614667520189869, -2.107740866148049 ], [ 29.61471919613399, -2.100299460052042 ], [ 29.618388223237901, -2.093994935517856 ], [ 29.62086869193655, -2.089137350908004 ], [ 29.625777951591147, -2.082109355962018 ], [ 29.632702594649004, -2.071464010755506 ], [ 29.634304564204228, -2.062162252685823 ], [ 29.63513138740359, -2.053480612240492 ], [ 29.636268268965409, -2.045109030157619 ], [ 29.633322712273355, -2.038391093574091 ], [ 29.629808714800333, -2.027177307586669 ], [ 29.630790566731264, -2.00604164770391 ], [ 29.627224893314178, -1.984027486879029 ], [ 29.622729043010906, -1.973950582453426 ], [ 29.632909300224014, -1.973950582453426 ], [ 29.647947142046974, -1.974622376921161 ], [ 29.659522663240296, -1.97095334981725 ], [ 29.668669391679089, -1.962736796466004 ], [ 29.670994830746849, -1.9522464817897 ], [ 29.666550658186281, -1.944081605281895 ], [ 29.662726600552162, -1.932919496137856 ], [ 29.662468219932407, -1.921809062937939 ], [ 29.666343951712008, -1.914057597580097 ], [ 29.671511595583638, -1.901241842936713 ], [ 29.668721067623153, -1.874680156763816 ], [ 29.663966836700126, -1.85008217355346 ], [ 29.664276895062642, -1.837989888422612 ], [ 29.667584186960653, -1.82641436902793 ], [ 29.670323037178377, -1.798560771662267 ], [ 29.666964069336302, -1.764971090543384 ], [ 29.663140014400142, -1.7468326632968 ], [ 29.660246132752832, -1.736704082027757 ], [ 29.65766231126662, -1.733086731767287 ], [ 29.663605100594907, -1.731278056636995 ], [ 29.67502559305666, -1.72967608798109 ], [ 29.686187702200698, -1.731743144630457 ], [ 29.702620808003871, -1.742646872255364 ], [ 29.721379352874806, -1.74951983757046 ], [ 29.733885049155674, -1.7471943985027 ], [ 29.741584837670075, -1.748434632852025 ], [ 29.745150511087218, -1.757684714078323 ], [ 29.755434121087774, -1.773704407832156 ], [ 29.768766640568003, -1.793548156522206 ], [ 29.780548867336336, -1.81173826151155 ], [ 29.794501504440859, -1.824967429103594 ], [ 29.79951411778228, -1.839333475559442 ], [ 29.818479369127544, -1.85142576158961 ], [ 29.845816201656362, -1.860727519659292 ], [ 29.865091509565502, -1.860520814084339 ], [ 29.884935260953512, -1.856903463823812 ], [ 29.902401894631737, -1.857316874973833 ], [ 29.914494179762585, -1.860934225234303 ], [ 29.921367145077681, -1.865895162631659 ], [ 29.929325316010534, -1.870029277728975 ], [ 29.936715046162419, -1.875041891969772 ], [ 29.943019570696606, -1.880984681298003 ], [ 29.951184447204469, -1.889149557805865 ], [ 29.96079626363661, -1.899484843750542 ], [ 29.970511432856313, -1.906099427546565 ], [ 29.978469602889845, -1.907649720258405 ], [ 29.981105101219441, -1.909406718545256 ], [ 29.980588337281915, -1.910698629737965 ], [ 29.982603717987161, -1.914057597580097 ], [ 29.985600950623336, -1.922584209293859 ], [ 29.988288124897053, -1.930180645020755 ], [ 29.990355182445683, -1.933487936918766 ], [ 29.993249063193673, -1.937415345541751 ], [ 29.996246295829849, -1.943616517288433 ], [ 29.999243529365344, -1.951161276171945 ], [ 30.002137409214072, -1.958395976692998 ], [ 30.000432086871285, -1.962788473309388 ], [ 30.000122029408089, -1.964648825283064 ], [ 29.999966998877881, -1.968472881118601 ], [ 29.999243529365344, -1.974829081596852 ], [ 29.997331501447604, -1.981133607030358 ], [ 29.993920856762088, -1.986301250002668 ], [ 30.003377643563397, -2.001184063094058 ], [ 30.009888873672537, -2.016583639223597 ], [ 30.005341348324521, -2.024231751793934 ], [ 30.001827350851556, -2.028055807629414 ], [ 29.993714150287758, -2.031311422684041 ], [ 29.986376096979257, -2.038752828780048 ], [ 29.984464069061517, -2.04841632205563 ], [ 29.990561888020693, -2.060560283130599 ], [ 29.999140175678519, -2.065882955733855 ], [ 30.003480996350902, -2.066503072458829 ], [ 30.009165404160058, -2.068363423533185 ], [ 30.015469928694245, -2.070327129193686 ], [ 30.017847044605389, -2.072135803424601 ], [ 30.016658487099505, -2.081799297599503 ], [ 30.016606810256064, -2.099937724846143 ], [ 30.016503456569239, -2.111461569196081 ], [ 30.009888873672537, -2.123605531170313 ], [ 29.995006060581204, -2.139883606443277 ], [ 29.984257362587186, -2.160657532918833 ], [ 29.985911009885172, -2.193833801988376 ], [ 29.980381630807585, -2.242926412923623 ], [ 29.968464144204859, -2.277640421068611 ], [ 29.967927611370158, -2.279203267416847 ], [ 29.967570917763624, -2.281075905029013 ], [ 29.964000201847796, -2.299822165160776 ], [ 29.961623085936651, -2.318994121181731 ], [ 29.960476970136028, -2.321453493583874 ], [ 29.959142617238001, -2.324316793784988 ], [ 29.956781100967021, -2.327037671051698 ] ] ] } },
{ "type": "Feature", "properties": { "ISO": "RW-04", "NAME_1": "Western" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 29.30948054400011, -2.690126857999886 ], [ 29.306045370000106, -2.676579690999873 ], [ 29.30733728000007, -2.664797464999964 ], [ 29.306613810000044, -2.660146585999897 ], [ 29.294418172000064, -2.651051533999933 ], [ 29.276124716000083, -2.640612893999986 ], [ 29.254989054000134, -2.635548603999922 ], [ 29.212769409000089, -2.630277608999975 ], [ 29.190445190000105, -2.623456318999928 ], [ 29.129725383000107, -2.596997985999849 ], [ 29.113447307000087, -2.5946208699999 ], [ 29.055259643000085, -2.598444925999928 ], [ 29.032573690000106, -2.620665791999969 ], [ 29.015365438000117, -2.720711364999957 ], [ 29.00012089000009, -2.703658141999924 ], [ 28.979605347000103, -2.693529560999963 ], [ 28.949736369000107, -2.690325621999904 ], [ 28.936403849000072, -2.685054625999967 ], [ 28.899093465000135, -2.66066335099994 ], [ 28.891342000000122, -2.65270517999997 ], [ 28.898059937000141, -2.57632741299993 ], [ 28.891342000000122, -2.553073017999907 ], [ 28.881058390000135, -2.542634378999963 ], [ 28.869844605000083, -2.537260029999914 ], [ 28.860956258000073, -2.531162210999952 ], [ 28.857235555000074, -2.518346455999961 ], [ 28.860852905000058, -2.505220641999912 ], [ 28.878216187000078, -2.489717711999987 ], [ 28.874702189000118, -2.477522073999879 ], [ 28.864573608000057, -2.459435322999866 ], [ 28.860852905000058, -2.439591572999873 ], [ 28.858837524000108, -2.418197529999958 ], [ 28.866330607000123, -2.391945901999932 ], [ 28.880386596000051, -2.379853616999938 ], [ 28.907258342000063, -2.370551858999917 ], [ 28.928135620000035, -2.364454039999956 ], [ 28.945447225000123, -2.35422210699997 ], [ 28.959658244000082, -2.339752705999942 ], [ 28.971233765000136, -2.321665954999929 ], [ 28.978778524000091, -2.306783141999887 ], [ 28.982189168000104, -2.296034443999872 ], [ 28.983377726000128, -2.287352802999905 ], [ 28.993661336000031, -2.277740986999987 ], [ 29.00213627100004, -2.274743753999886 ], [ 29.03092004400014, -2.275673928999936 ], [ 29.075413452000134, -2.263891702999928 ], [ 29.109829956000084, -2.236709899999951 ], [ 29.134841349000084, -2.197745869999963 ], [ 29.150550984000063, -2.150410257999908 ], [ 29.156338745000141, -2.108655700999861 ], [ 29.154271687000062, -2.072688903999975 ], [ 29.127710001000139, -1.915695901999925 ], [ 29.125539592000081, -1.879108988999889 ], [ 29.130500529000102, -1.84334889699997 ], [ 29.149310750000041, -1.799320575999914 ], [ 29.186640035000039, -1.739618238999896 ], [ 29.212252645000035, -1.698654886999861 ], [ 29.233336629000064, -1.65865732799989 ], [ 29.245428914000058, -1.640983987999974 ], [ 29.293694702000039, -1.600986429999921 ], [ 29.30382328200011, -1.587860615999944 ], [ 29.331211792000147, -1.531429951999925 ], [ 29.342787313000088, -1.516547138999968 ], [ 29.358496948000038, -1.509932555999882 ], [ 29.434926392000136, -1.506831969999936 ], [ 29.437406861000113, -1.506211852999868 ], [ 29.439628947000131, -1.504764912999875 ], [ 29.44169600400005, -1.502594501999894 ], [ 29.445065226000054, -1.497286823999929 ], [ 29.449406289768433, -1.503488343012634 ], [ 29.467286334596622, -1.527827942905276 ], [ 29.491419228914253, -1.556146628264287 ], [ 29.51296830084641, -1.563588033460974 ], [ 29.531881875348233, -1.569582500531965 ], [ 29.540046751856096, -1.569375794956954 ], [ 29.546661334752798, -1.566740296627415 ], [ 29.550640420219224, -1.569169087583361 ], [ 29.555963092822481, -1.570822734881347 ], [ 29.572189492151324, -1.578419170608242 ], [ 29.590741331447248, -1.5876175749911 ], [ 29.610946817141894, -1.58648069252996 ], [ 29.630583861156254, -1.587875956510175 ], [ 29.634717975354249, -1.618158346630423 ], [ 29.63611323933452, -1.659137757901192 ], [ 29.635699828184499, -1.688128235929355 ], [ 29.634459593835174, -1.709935690279906 ], [ 29.646913613272602, -1.724921856158744 ], [ 29.65766231126662, -1.733086731767287 ], [ 29.660246132752832, -1.736704082027757 ], [ 29.663140014400142, -1.7468326632968 ], [ 29.666964069336302, -1.764971090543384 ], [ 29.670323037178377, -1.798560771662267 ], [ 29.667584186960653, -1.82641436902793 ], [ 29.664276895062642, -1.837989888422612 ], [ 29.663966836700126, -1.85008217355346 ], [ 29.668721067623153, -1.874680156763816 ], [ 29.671511595583638, -1.901241842936713 ], [ 29.666343951712008, -1.914057597580097 ], [ 29.662468219932407, -1.921809062937939 ], [ 29.662726600552162, -1.932919496137856 ], [ 29.666550658186281, -1.944081605281895 ], [ 29.670994830746849, -1.9522464817897 ], [ 29.668669391679089, -1.962736796466004 ], [ 29.659522663240296, -1.97095334981725 ], [ 29.647947142046974, -1.974622376921161 ], [ 29.632909300224014, -1.973950582453426 ], [ 29.622729043010906, -1.973950582453426 ], [ 29.627224893314178, -1.984027486879029 ], [ 29.630790566731264, -2.00604164770391 ], [ 29.629808714800333, -2.027177307586669 ], [ 29.633322712273355, -2.038391093574091 ], [ 29.636268268965409, -2.045109030157619 ], [ 29.63513138740359, -2.053480612240492 ], [ 29.634304564204228, -2.062162252685823 ], [ 29.632702594649004, -2.071464010755506 ], [ 29.625777951591147, -2.082109355962018 ], [ 29.62086869193655, -2.089137350908004 ], [ 29.618388223237901, -2.093994935517856 ], [ 29.61471919613399, -2.100299460052042 ], [ 29.614667520189869, -2.107740866148049 ], [ 29.608983112380713, -2.121590149565748 ], [ 29.59983638394192, -2.138384990574878 ], [ 29.598751178324221, -2.148565247787985 ], [ 29.601696735016276, -2.154766419534667 ], [ 29.605417438064308, -2.168564027008244 ], [ 29.605779173270207, -2.182258281694374 ], [ 29.597614296762345, -2.18659910056806 ], [ 29.586917275611768, -2.193058655632456 ], [ 29.580044310296671, -2.196934388311377 ], [ 29.571879433788808, -2.199311504222578 ], [ 29.564541379580987, -2.202205384071249 ], [ 29.55823685594612, -2.199776592215983 ], [ 29.55286250560016, -2.197864564298186 ], [ 29.548728392301427, -2.203755677682409 ], [ 29.542940631704766, -2.209853496641585 ], [ 29.530176553005504, -2.217811666675061 ], [ 29.519272826279916, -2.227423483107259 ], [ 29.505940305900367, -2.234864889203266 ], [ 29.481083942070256, -2.254295228541991 ], [ 29.466511188240702, -2.269436423152399 ], [ 29.460413369281525, -2.268557923109654 ], [ 29.448579466569129, -2.2690746879465 ], [ 29.431267861622473, -2.26948809909652 ], [ 29.411062376827203, -2.272795390994531 ], [ 29.392458860687839, -2.286799704043119 ], [ 29.379746458832017, -2.292535787796396 ], [ 29.368480996001153, -2.28912514311088 ], [ 29.353649860652524, -2.291398906234519 ], [ 29.33850866604206, -2.299150371592361 ], [ 29.328380084773073, -2.311242656723266 ], [ 29.325692909600093, -2.324781881778449 ], [ 29.332307493396058, -2.341214987581623 ], [ 29.339128782767091, -2.355167623786826 ], [ 29.338301959567787, -2.364366029069004 ], [ 29.328276731985568, -2.380230694091267 ], [ 29.319853473958631, -2.393718242303066 ], [ 29.322799030650742, -2.403123353160254 ], [ 29.325796263286918, -2.414388815091741 ], [ 29.321713825032987, -2.423483867586413 ], [ 29.301198281875202, -2.434749329517956 ], [ 29.280114297037187, -2.4460147914495 ], [ 29.271432656591799, -2.458727194204641 ], [ 29.266885130344463, -2.471853008109861 ], [ 29.267815306331329, -2.478570944693331 ], [ 29.279907590562857, -2.485133851645969 ], [ 29.298511106702165, -2.490973288186694 ], [ 29.311946979869219, -2.497122783089992 ], [ 29.320215208265211, -2.508233216289909 ], [ 29.322385618601402, -2.523426087743758 ], [ 29.328380084773073, -2.535880108080505 ], [ 29.335924843656585, -2.545853658819283 ], [ 29.340885781953261, -2.555672181725811 ], [ 29.345019896151257, -2.561925028517237 ], [ 29.343107868233517, -2.571691874580381 ], [ 29.341919309828256, -2.580941956705942 ], [ 29.343262897864406, -2.587969951651985 ], [ 29.348275511205884, -2.595463034591376 ], [ 29.359954385186711, -2.612619609907085 ], [ 29.3566470932887, -2.648689759724618 ], [ 29.342539426553287, -2.673856181917245 ], [ 29.333392699013814, -2.678662090583032 ], [ 29.328380084773073, -2.680160705552112 ], [ 29.30948054400011, -2.690126857999886 ] ] ] } },
{ "type": "Feature", "properties": { "ISO": "RW-03", "NAME_1": "Northern" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 29.917429240000047, -1.47520599399985 ], [ 29.938461548000134, -1.47293223099993 ], [ 29.960424032000105, -1.464767353999903 ], [ 30.028326863000075, -1.427146911999984 ], [ 30.03866215000005, -1.424976500999904 ], [ 30.047757202000128, -1.403169046999963 ], [ 30.060779663000062, -1.389733174999918 ], [ 30.065984342603315, -1.386944953546788 ], [ 30.070195270595264, -1.38912839865668 ], [ 30.073089150443934, -1.389903545012601 ], [ 30.078721881409706, -1.394347717573112 ], [ 30.081874144576091, -1.404527975685539 ], [ 30.087403522754357, -1.412072734569051 ], [ 30.093914752863554, -1.417292053485482 ], [ 30.106523802831191, -1.438376037424177 ], [ 30.117685911975229, -1.455222555276691 ], [ 30.126419229264002, -1.471500630549656 ], [ 30.135049192865949, -1.490310853163351 ], [ 30.13928666075077, -1.499715964020538 ], [ 30.141818805393541, -1.515115541049397 ], [ 30.14254227580534, -1.524313944532935 ], [ 30.151585650557308, -1.521575093415834 ], [ 30.163522906956587, -1.517389303273717 ], [ 30.173289753019674, -1.517389303273717 ], [ 30.178767454354499, -1.520334859965828 ], [ 30.178354043204536, -1.524934063056548 ], [ 30.170395873171003, -1.532065410790096 ], [ 30.165124877411131, -1.54886025089985 ], [ 30.169310667553248, -1.57123614603131 ], [ 30.177010456067649, -1.591596659558206 ], [ 30.186880654918298, -1.60937335249821 ], [ 30.199903115136635, -1.623119284027723 ], [ 30.218041543282595, -1.646683737564445 ], [ 30.237471881721945, -1.670816630982756 ], [ 30.251734577188984, -1.686267884854999 ], [ 30.25762569057315, -1.699703757122677 ], [ 30.254266722731074, -1.711175924629231 ], [ 30.250442665996218, -1.722286357829148 ], [ 30.254008340312623, -1.743266988980395 ], [ 30.2643436262573, -1.777580140511077 ], [ 30.272095091615142, -1.80827594088197 ], [ 30.272405149977658, -1.823520488279939 ], [ 30.266720742168502, -1.826931132965399 ], [ 30.258142455409995, -1.832822245450302 ], [ 30.251062783620569, -1.840315329289012 ], [ 30.247083698154142, -1.843209209137683 ], [ 30.239745644845641, -1.842124003519984 ], [ 30.223364215885852, -1.836697979028543 ], [ 30.192151650678113, -1.814528788572716 ], [ 30.159182087183581, -1.792617981434717 ], [ 30.142645628592845, -1.782902813114333 ], [ 30.134842487290939, -1.779388815641312 ], [ 30.129778197106077, -1.79246295270309 ], [ 30.122853554947596, -1.80946449928723 ], [ 30.117375853612714, -1.816492494233216 ], [ 30.107867389968078, -1.815045552510242 ], [ 30.083372760444547, -1.819386374081887 ], [ 30.063115599705156, -1.828481425677239 ], [ 30.057534544683449, -1.835819479885117 ], [ 30.046682493901926, -1.848325176165929 ], [ 30.033556679996764, -1.856076640624451 ], [ 30.021257689290906, -1.84780841042982 ], [ 30.007925169810733, -1.839126770883752 ], [ 29.998313353378535, -1.842434062781763 ], [ 29.990716917651582, -1.854526347912611 ], [ 29.982500365199655, -1.868168925755356 ], [ 29.978056191739824, -1.878297507024342 ], [ 29.983533893974027, -1.893490377578871 ], [ 29.987461302597012, -1.905479309922214 ], [ 29.983740600448357, -1.908373190670204 ], [ 29.981105101219441, -1.909406718545256 ], [ 29.978469602889845, -1.907649720258405 ], [ 29.970511432856313, -1.906099427546565 ], [ 29.96079626363661, -1.899484843750542 ], [ 29.951184447204469, -1.889149557805865 ], [ 29.943019570696606, -1.880984681298003 ], [ 29.936715046162419, -1.875041891969772 ], [ 29.929325316010534, -1.870029277728975 ], [ 29.921367145077681, -1.865895162631659 ], [ 29.914494179762585, -1.860934225234303 ], [ 29.902401894631737, -1.857316874973833 ], [ 29.884935260953512, -1.856903463823812 ], [ 29.865091509565502, -1.860520814084339 ], [ 29.845816201656362, -1.860727519659292 ], [ 29.818479369127544, -1.85142576158961 ], [ 29.79951411778228, -1.839333475559442 ], [ 29.794501504440859, -1.824967429103594 ], [ 29.780548867336336, -1.81173826151155 ], [ 29.768766640568003, -1.793548156522206 ], [ 29.755434121087774, -1.773704407832156 ], [ 29.745150511087218, -1.757684714078323 ], [ 29.741584837670075, -1.748434632852025 ], [ 29.733885049155674, -1.7471943985027 ], [ 29.721379352874806, -1.74951983757046 ], [ 29.702620808003871, -1.742646872255364 ], [ 29.686187702200698, -1.731743144630457 ], [ 29.67502559305666, -1.72967608798109 ], [ 29.663605100594907, -1.731278056636995 ], [ 29.65766231126662, -1.733086731767287 ], [ 29.646913613272602, -1.724921856158744 ], [ 29.634459593835174, -1.709935690279906 ], [ 29.635699828184499, -1.688128235929355 ], [ 29.63611323933452, -1.659137757901192 ], [ 29.634717975354249, -1.618158346630423 ], [ 29.630583861156254, -1.587875956510175 ], [ 29.610946817141894, -1.58648069252996 ], [ 29.590741331447248, -1.5876175749911 ], [ 29.572189492151324, -1.578419170608242 ], [ 29.555963092822481, -1.570822734881347 ], [ 29.550640420219224, -1.569169087583361 ], [ 29.546661334752798, -1.566740296627415 ], [ 29.540046751856096, -1.569375794956954 ], [ 29.531881875348233, -1.569582500531965 ], [ 29.51296830084641, -1.563588033460974 ], [ 29.491419228914253, -1.556146628264287 ], [ 29.467286334596622, -1.527827942905276 ], [ 29.449406289768433, -1.503488343012634 ], [ 29.445065226000054, -1.497286823999929 ], [ 29.464330282000105, -1.466937764999898 ], [ 29.498746785000094, -1.431074319999951 ], [ 29.538640991000079, -1.402342223999938 ], [ 29.577915080000082, -1.388389587999953 ], [ 29.618119344000092, -1.39055999699994 ], [ 29.639099976000125, -1.389009703999918 ], [ 29.657703491000063, -1.383945413999939 ], [ 29.678322388000083, -1.372369892999899 ], [ 29.693773641000064, -1.361207783999873 ], [ 29.710516805000111, -1.352526142999906 ], [ 29.734804728000086, -1.348185322999925 ], [ 29.746690308000041, -1.350872496999955 ], [ 29.767980997000109, -1.36379160499996 ], [ 29.77490563900011, -1.366272073999937 ], [ 29.783173869000052, -1.361414488999927 ], [ 29.789168335000056, -1.341674092999952 ], [ 29.798211711000135, -1.330925394999937 ], [ 29.80746179200014, -1.325137633999873 ], [ 29.816143432000104, -1.322553812999956 ], [ 29.825024114000087, -1.323880810999896 ], [ 29.825135132000071, -1.323897399999936 ], [ 29.836090536000142, -1.329478454999943 ], [ 29.864202514000056, -1.370302835999937 ], [ 29.868646688000069, -1.391283466999937 ], [ 29.871023804000117, -1.432417906999916 ], [ 29.880738973000064, -1.453605244999963 ], [ 29.897895548000122, -1.469624938999928 ], [ 29.917429240000047, -1.47520599399985 ] ] ] } },
{ "type": "Feature", "properties": { "ISO": "RW-01", "NAME_1": "Kigali City" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 30.017847044605389, -2.072135803424601 ], [ 30.015469928694245, -2.070327129193686 ], [ 30.009165404160058, -2.068363423533185 ], [ 30.003480996350902, -2.066503072458829 ], [ 29.999140175678519, -2.065882955733855 ], [ 29.990561888020693, -2.060560283130599 ], [ 29.984464069061517, -2.04841632205563 ], [ 29.986376096979257, -2.038752828780048 ], [ 29.993714150287758, -2.031311422684041 ], [ 30.001827350851556, -2.028055807629414 ], [ 30.005341348324521, -2.024231751793934 ], [ 30.009888873672537, -2.016583639223597 ], [ 30.003377643563397, -2.001184063094058 ], [ 29.993920856762088, -1.986301250002668 ], [ 29.997331501447604, -1.981133607030358 ], [ 29.999243529365344, -1.974829081596852 ], [ 29.999966998877881, -1.968472881118601 ], [ 30.000122029408089, -1.964648825283064 ], [ 30.000432086871285, -1.962788473309388 ], [ 30.002137409214072, -1.958395976692998 ], [ 29.999243529365344, -1.951161276171945 ], [ 29.996246295829849, -1.943616517288433 ], [ 29.993249063193673, -1.937415345541751 ], [ 29.990355182445683, -1.933487936918766 ], [ 29.988288124897053, -1.930180645020755 ], [ 29.985600950623336, -1.922584209293859 ], [ 29.982603717987161, -1.914057597580097 ], [ 29.980588337281915, -1.910698629737965 ], [ 29.981105101219441, -1.909406718545256 ], [ 29.983740600448357, -1.908373190670204 ], [ 29.987461302597012, -1.905479309922214 ], [ 29.983533893974027, -1.893490377578871 ], [ 29.978056191739824, -1.878297507024342 ], [ 29.982500365199655, -1.868168925755356 ], [ 29.990716917651582, -1.854526347912611 ], [ 29.998313353378535, -1.842434062781763 ], [ 30.007925169810733, -1.839126770883752 ], [ 30.021257689290906, -1.84780841042982 ], [ 30.033556679996764, -1.856076640624451 ], [ 30.046682493901926, -1.848325176165929 ], [ 30.057534544683449, -1.835819479885117 ], [ 30.063115599705156, -1.828481425677239 ], [ 30.083372760444547, -1.819386374081887 ], [ 30.107867389968078, -1.815045552510242 ], [ 30.117375853612714, -1.816492494233216 ], [ 30.122853554947596, -1.80946449928723 ], [ 30.129778197106077, -1.79246295270309 ], [ 30.134842487290939, -1.779388815641312 ], [ 30.142645628592845, -1.782902813114333 ], [ 30.159182087183581, -1.792617981434717 ], [ 30.192151650678113, -1.814528788572716 ], [ 30.223364215885852, -1.836697979028543 ], [ 30.239745644845641, -1.842124003519984 ], [ 30.247083698154142, -1.843209209137683 ], [ 30.248375609346851, -1.848531881740939 ], [ 30.255196897818564, -1.858247050960642 ], [ 30.259020954553364, -1.872664776058571 ], [ 30.258349160085629, -1.886462383532205 ], [ 30.264550332731631, -1.894058817460461 ], [ 30.270441445216477, -1.900001608587388 ], [ 30.272508502765163, -1.916383037547178 ], [ 30.272146767559263, -1.936020081561537 ], [ 30.267444212580301, -1.944443339588474 ], [ 30.253801634737613, -1.950954570596991 ], [ 30.239383909639685, -1.957052389556168 ], [ 30.233957884248923, -1.963253561302849 ], [ 30.233337768423269, -1.974829081596852 ], [ 30.230340533988453, -2.010899232313704 ], [ 30.223725951091751, -2.046969382131294 ], [ 30.21581945700234, -2.065056132534494 ], [ 30.209049843575428, -2.074667949866011 ], [ 30.202538612566912, -2.065624574214723 ], [ 30.194942177739279, -2.056116110570031 ], [ 30.188172565211687, -2.045729147781969 ], [ 30.177630573691999, -2.031879862565631 ], [ 30.165383258930262, -2.028417542835371 ], [ 30.153239296955974, -2.032706686664255 ], [ 30.14254227580534, -2.037357565699097 ], [ 30.13680619205212, -2.040354797435953 ], [ 30.129829873050198, -2.045470764464199 ], [ 30.123835406878527, -2.050586731492501 ], [ 30.121406615023261, -2.054307434540476 ], [ 30.117995970337745, -2.054927552164827 ], [ 30.115102089589755, -2.055030904952332 ], [ 30.107040566768717, -2.055754374464811 ], [ 30.09804886796087, -2.057666403281871 ], [ 30.092261107364209, -2.059475077512843 ], [ 30.085698200411628, -2.060922017437179 ], [ 30.079755410184021, -2.062058899898318 ], [ 30.076396442341945, -2.062885723097679 ], [ 30.073605915280723, -2.063764222241048 ], [ 30.067456418578843, -2.064539368596968 ], [ 30.058878131820336, -2.063609192610159 ], [ 30.054227252785495, -2.057459697706918 ], [ 30.050609903424288, -2.053170553877976 ], [ 30.043426878847356, -2.055134257739837 ], [ 30.038207559031605, -2.060611959973983 ], [ 30.032006387284923, -2.064022604659499 ], [ 30.022394570852725, -2.068260071645 ], [ 30.017847044605389, -2.072135803424601 ] ] ] } }
]
}
| superset-frontend/plugins/legacy-plugin-chart-country-map/src/countries/rwanda.geojson | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.0012900123838335276,
0.0007350882515311241,
0.00018016417743638158,
0.0007350882515311241,
0.0005549240740947425
] |
{
"id": 3,
"code_window": [
"): SeriesOption[] {\n",
" const series: SeriesOption[] = [];\n",
" const { hideLine, name, opacity, showMarkers, style, width } = layer;\n",
" const result = annotationData[name];\n",
" if (isTimeseriesAnnotationResult(result)) {\n",
" result.forEach(annotation => {\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" const { hideLine, name, opacity, showMarkers, style, width, color } = layer;\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "replace",
"edit_start_line_idx": 422
} | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import logging
from typing import Any, Dict
from marshmallow.exceptions import ValidationError
from superset.commands.base import BaseCommand
from superset.commands.exceptions import CommandInvalidError
from superset.commands.importers.exceptions import IncorrectVersionError
from superset.queries.saved_queries.commands.importers import v1
logger = logging.getLogger(__name__)
command_versions = [
v1.ImportSavedQueriesCommand,
]
class ImportSavedQueriesCommand(BaseCommand):
"""
Import Saved Queries
This command dispatches the import to different versions of the command
until it finds one that matches.
"""
def __init__(self, contents: Dict[str, str], *args: Any, **kwargs: Any):
self.contents = contents
self.args = args
self.kwargs = kwargs
def run(self) -> None:
# iterate over all commands until we find a version that can
# handle the contents
for version in command_versions:
command = version(self.contents, *self.args, **self.kwargs)
try:
command.run()
return
except IncorrectVersionError:
logger.debug("File not handled by command, skipping")
except (CommandInvalidError, ValidationError) as exc:
# found right version, but file is invalid
logger.exception("Error running import command")
raise exc
raise CommandInvalidError("Could not find a valid command to import file")
def validate(self) -> None:
pass
| superset/queries/saved_queries/commands/importers/dispatcher.py | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00026195470127277076,
0.00018887760234065354,
0.00017293394193984568,
0.00017814250895753503,
0.00002994560963998083
] |
{
"id": 3,
"code_window": [
"): SeriesOption[] {\n",
" const series: SeriesOption[] = [];\n",
" const { hideLine, name, opacity, showMarkers, style, width } = layer;\n",
" const result = annotationData[name];\n",
" if (isTimeseriesAnnotationResult(result)) {\n",
" result.forEach(annotation => {\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" const { hideLine, name, opacity, showMarkers, style, width, color } = layer;\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "replace",
"edit_start_line_idx": 422
} | {
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "NAME_1": "Marche", "ISO": "IT-57" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 13.916724724800755, 42.894584737494966 ], [ 13.816123316587612, 42.877523900747057 ], [ 13.774078751107728, 42.859485469040976 ], [ 13.72485564570424, 42.855721080540967 ], [ 13.699303310176438, 42.822615601908971 ], [ 13.663599836744181, 42.807127380591886 ], [ 13.635516366621307, 42.803302389555917 ], [ 13.624398869633838, 42.816541735840168 ], [ 13.571461264925428, 42.800507078974697 ], [ 13.534478518585237, 42.816644505459031 ], [ 13.529114552507343, 42.795341939318952 ], [ 13.502316530881258, 42.77096911334872 ], [ 13.504224310152731, 42.747084947943236 ], [ 13.488800659368593, 42.733673712789717 ], [ 13.45210847879806, 42.733911387405264 ], [ 13.427396937983231, 42.706425296381987 ], [ 13.388807677200528, 42.687300169831964 ], [ 13.357755645107735, 42.694098094891459 ], [ 13.318860293576895, 42.722726303502505 ], [ 13.287762036842247, 42.739220780618439 ], [ 13.264502280253325, 42.740181239807953 ], [ 13.254152834006465, 42.721450249452147 ], [ 13.189215833537546, 42.733577628927513 ], [ 13.194196609710362, 42.758495152417026 ], [ 13.216506774642644, 42.771476382264211 ], [ 13.245124119367892, 42.772627564469211 ], [ 13.264029091353761, 42.808243691532653 ], [ 13.247943837114077, 42.849474969304353 ], [ 13.230901403504342, 42.854000781086668 ], [ 13.187557255135516, 42.834477293749117 ], [ 13.154557655927601, 42.834622019074921 ], [ 13.112247784161525, 42.889333511514792 ], [ 13.080726005213807, 42.899528199248792 ], [ 13.052779583571294, 42.919795984326626 ], [ 13.037783946901206, 42.907543886926589 ], [ 13.002523591790149, 42.895566931650528 ], [ 12.990237852892305, 42.871119626373641 ], [ 12.976152797799937, 42.869804191194859 ], [ 12.968393686547856, 42.900677357671562 ], [ 12.976787230481836, 42.925680045230955 ], [ 12.895822077078666, 42.964592022053552 ], [ 12.908166392222691, 42.984870486793781 ], [ 12.888007381548421, 43.009515662968809 ], [ 12.906705859589829, 43.035395397263976 ], [ 12.889934815853701, 43.058884079266129 ], [ 12.897327701037113, 43.09348462558588 ], [ 12.875466379546546, 43.123444504315579 ], [ 12.843003102618345, 43.12234421735328 ], [ 12.832360997938194, 43.147299177125888 ], [ 12.862490472547746, 43.165966038681233 ], [ 12.868244076689649, 43.195212528606049 ], [ 12.862344919549191, 43.211252115588152 ], [ 12.836606568022578, 43.217532939478069 ], [ 12.824756867376795, 43.266567356241374 ], [ 12.789242008456791, 43.284482206696424 ], [ 12.802226056220443, 43.307567531768846 ], [ 12.791086899941561, 43.337301187764439 ], [ 12.749689714158825, 43.378058380156517 ], [ 12.746809419868166, 43.390452943940701 ], [ 12.774427487657977, 43.401966497068408 ], [ 12.765912305254945, 43.426038772824619 ], [ 12.767446108847878, 43.459847887521505 ], [ 12.735763292396454, 43.463753373193889 ], [ 12.715265434552691, 43.446085501981578 ], [ 12.709384576537682, 43.425115966803361 ], [ 12.66317659085316, 43.43683082384991 ], [ 12.62515821359421, 43.420658567814272 ], [ 12.604760711837301, 43.437982931144361 ], [ 12.56425968478989, 43.459799784697672 ], [ 12.49981472840371, 43.521458051934118 ], [ 12.480534309027922, 43.527453820583894 ], [ 12.457387863637186, 43.517307933907453 ], [ 12.433186279253926, 43.538406998059394 ], [ 12.417935631818168, 43.534894000786394 ], [ 12.399043882069481, 43.513218797495249 ], [ 12.366736516080339, 43.534085932253056 ], [ 12.333181381108808, 43.523578304491927 ], [ 12.31290682962284, 43.543096871186982 ], [ 12.344949885177261, 43.553627442519236 ], [ 12.373496499035324, 43.584287738557151 ], [ 12.351156356678519, 43.611476044063558 ], [ 12.263183396169937, 43.589072032206587 ], [ 12.225280421846268, 43.593915565530374 ], [ 12.218159327299237, 43.603497960259112 ], [ 12.217786380802849, 43.604323121809841 ], [ 12.213834576267299, 43.61088376589796 ], [ 12.187218825608769, 43.636039460004476 ], [ 12.203692080567693, 43.651743968009342 ], [ 12.232656485132241, 43.655595902256927 ], [ 12.251079533243413, 43.672570743323874 ], [ 12.273479375928517, 43.675964237760326 ], [ 12.320768370299373, 43.694666916950439 ], [ 12.330116713202194, 43.707044149327373 ], [ 12.368190442424893, 43.71510153409055 ], [ 12.327074389378867, 43.751009835620714 ], [ 12.283780916917237, 43.76491721980068 ], [ 12.284853869138802, 43.794794791762179 ], [ 12.315886833910598, 43.805637702470797 ], [ 12.33543921078245, 43.824118636046755 ], [ 12.347371693262831, 43.867020012594963 ], [ 12.386230551428406, 43.881984733828588 ], [ 12.420010773732276, 43.872231174687357 ], [ 12.417681311971824, 43.899048936454307 ], [ 12.48740431178164, 43.896469315118438 ], [ 12.49394529981652, 43.915564808052956 ], [ 12.542596427514786, 43.889081906580529 ], [ 12.541692224843722, 43.864027769312649 ], [ 12.584400319589555, 43.884103453977268 ], [ 12.602561423884056, 43.86343482663694 ], [ 12.600999399191556, 43.850510878434605 ], [ 12.623274694683218, 43.821151727050641 ], [ 12.681317061618605, 43.828070669756386 ], [ 12.682295035094915, 43.852796654608937 ], [ 12.723632264320612, 43.861236755559105 ], [ 12.722653233043534, 43.880566371936155 ], [ 12.734831054339262, 43.896024749086486 ], [ 12.727907581132266, 43.924182452501476 ], [ 12.755640592249428, 43.961954709655835 ], [ 12.750621437533921, 43.968544500728427 ], [ 12.797592701131089, 43.965174407536736 ], [ 12.882185026563768, 43.928843918415211 ], [ 12.907332215722676, 43.923002451206116 ], [ 12.986315895884651, 43.865335277194411 ], [ 13.022041503428627, 43.849821066708408 ], [ 13.067573556099875, 43.821916513278723 ], [ 13.128498126782517, 43.776816456258771 ], [ 13.219789197382234, 43.717697570473433 ], [ 13.307963186618588, 43.668418436700328 ], [ 13.375420345710637, 43.643981453778686 ], [ 13.413824707555477, 43.62371569378822 ], [ 13.481587787160663, 43.606808724967074 ], [ 13.514888763874522, 43.624379272982068 ], [ 13.53160503930083, 43.619539230467723 ], [ 13.565564875589491, 43.589131307393075 ], [ 13.572892841047944, 43.571073275376946 ], [ 13.625544343192777, 43.550333122731104 ], [ 13.622952259080298, 43.503264185700985 ], [ 13.670913983503887, 43.423885394403797 ], [ 13.709885252901977, 43.336811803013191 ], [ 13.735357405632325, 43.308378168785488 ], [ 13.777727030541088, 43.234270982027127 ], [ 13.803650160825169, 43.172324532615271 ], [ 13.844697447729336, 43.096726964764699 ], [ 13.852405949976751, 43.0544896242939 ], [ 13.872683224305113, 42.987350114447253 ], [ 13.892990732898433, 42.936701041954201 ], [ 13.916724724800755, 42.894584737494966 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Abruzzo", "ISO": "IT-65" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 14.233094736844542, 42.465408449024338 ], [ 14.259919074419273, 42.440958540248019 ], [ 14.320923772076622, 42.404985670789472 ], [ 14.409916365403955, 42.358090012693381 ], [ 14.410145351013178, 42.34787727634469 ], [ 14.441202555547132, 42.312316019711155 ], [ 14.502406052834061, 42.271809117925812 ], [ 14.50826546902605, 42.252503041083983 ], [ 14.563059109050114, 42.223933001549412 ], [ 14.62078725762824, 42.199270731361651 ], [ 14.717219238683663, 42.170204636206051 ], [ 14.717765760822685, 42.107717501779526 ], [ 14.751524634670931, 42.080592191862785 ], [ 14.779549206678633, 42.069826092393903 ], [ 14.761709287838086, 42.041686685310019 ], [ 14.782246961659654, 42.03510522100111 ], [ 14.765818464354835, 42.018088344224324 ], [ 14.727161086607271, 42.003246147525523 ], [ 14.670244377350645, 41.948202807650823 ], [ 14.663763356271486, 41.916289062991815 ], [ 14.641321987150839, 41.899342290368502 ], [ 14.614244513551007, 41.889188438808077 ], [ 14.598641695486231, 41.853465546955221 ], [ 14.567979076507637, 41.818119509367691 ], [ 14.550771436132116, 41.816587375281273 ], [ 14.533345113013381, 41.791585377669456 ], [ 14.48954516735024, 41.760969858882625 ], [ 14.465140215227283, 41.777175312849181 ], [ 14.454744170997854, 41.795807644752422 ], [ 14.445696547537173, 41.837823152507006 ], [ 14.375890767079124, 41.878472677297999 ], [ 14.343491250232539, 41.868952105986303 ], [ 14.324496797125946, 41.895656179046505 ], [ 14.302740182045241, 41.894221597303449 ], [ 14.279300964143342, 41.909518272888199 ], [ 14.266367103605036, 41.895796673666737 ], [ 14.226873756031999, 41.874797787526546 ], [ 14.21686752526225, 41.853771558598808 ], [ 14.155622375810376, 41.839612463530287 ], [ 14.147157882335579, 41.827297321146354 ], [ 14.164648133055799, 41.80946941878944 ], [ 14.170691877691496, 41.779708146634697 ], [ 14.201914373000662, 41.766995000264195 ], [ 14.193963271972601, 41.748023553701856 ], [ 14.158677477034754, 41.74702474601149 ], [ 14.115264658940367, 41.736933820690531 ], [ 14.069570906247812, 41.737225381408905 ], [ 14.053477370805631, 41.719612014472446 ], [ 14.053246219551411, 41.701698685139711 ], [ 14.026922804646032, 41.702701603081053 ], [ 14.019180269188272, 41.682360810913849 ], [ 13.994407574240309, 41.693692836911588 ], [ 13.956438332477653, 41.695669426858679 ], [ 13.941015156699477, 41.687972757233084 ], [ 13.919701411270122, 41.71724358135657 ], [ 13.89763893693722, 41.732134254419954 ], [ 13.880585016448974, 41.72829710444789 ], [ 13.823480811890143, 41.740884308191021 ], [ 13.810136331327767, 41.753868855786827 ], [ 13.790142019301378, 41.742969511743183 ], [ 13.765912204726451, 41.748702417466134 ], [ 13.748649336676205, 41.773587431717665 ], [ 13.716492042916633, 41.797397523762093 ], [ 13.692708067659144, 41.791522967374952 ], [ 13.662891496340114, 41.811268090273479 ], [ 13.63845929409505, 41.804317946667346 ], [ 13.63127241458872, 41.782645519324547 ], [ 13.586099572066995, 41.76643483256229 ], [ 13.576229509611961, 41.755018809205026 ], [ 13.520432946280071, 41.772965539585904 ], [ 13.50440742760016, 41.801543496052787 ], [ 13.463751577454873, 41.809450717205642 ], [ 13.451554363454068, 41.822817937681997 ], [ 13.407463067282647, 41.83746446307255 ], [ 13.391512384066456, 41.819786708627994 ], [ 13.366833915817226, 41.833068138188764 ], [ 13.359835255309399, 41.869376933330074 ], [ 13.383994309041661, 41.904186669042808 ], [ 13.356555612045883, 41.92573862211708 ], [ 13.337529960650786, 41.925980487880267 ], [ 13.322622080905733, 41.945157799363002 ], [ 13.286035101953608, 41.950368901050894 ], [ 13.2315416304117, 41.981688602069163 ], [ 13.199082173301921, 41.986496263187547 ], [ 13.139947933551502, 42.015346562494095 ], [ 13.107740704300078, 42.025104605550808 ], [ 13.101323964660519, 42.009748286903843 ], [ 13.058121607990385, 42.015554349080034 ], [ 13.02662171301999, 42.050027646246441 ], [ 13.018487902907868, 42.074938195218941 ], [ 13.037007376516502, 42.118997634984225 ], [ 13.059821994116945, 42.122954529094393 ], [ 13.086165958188138, 42.144334609116008 ], [ 13.087057415640288, 42.177871038920259 ], [ 13.122312478849601, 42.177119397736753 ], [ 13.158308551518324, 42.157494956084136 ], [ 13.192711209324177, 42.158257556288703 ], [ 13.237228454051005, 42.12913098733938 ], [ 13.265000251731703, 42.136789926341372 ], [ 13.305290680556327, 42.138256333433226 ], [ 13.323194376101069, 42.161412509267684 ], [ 13.353963092799255, 42.174943636363409 ], [ 13.352232570651134, 42.19127877322623 ], [ 13.33189413054904, 42.208179471632604 ], [ 13.319935807435737, 42.229637860111815 ], [ 13.28212792987294, 42.23722655316849 ], [ 13.271242878606939, 42.254163387508633 ], [ 13.238635371632126, 42.272824691956629 ], [ 13.22893262267136, 42.287175296775608 ], [ 13.226462981830029, 42.319330568331061 ], [ 13.191351061361985, 42.332334245211037 ], [ 13.153349002710204, 42.356994106668139 ], [ 13.189398306857452, 42.381111437583108 ], [ 13.189201958226942, 42.400220126524466 ], [ 13.15516715154677, 42.414216312915428 ], [ 13.116168386454083, 42.443909781783191 ], [ 13.15405333366988, 42.462332424957502 ], [ 13.171535326789312, 42.486081202394658 ], [ 13.177769627522387, 42.512636323290614 ], [ 13.157356701348391, 42.527716086144046 ], [ 13.176085156583463, 42.552646291933776 ], [ 13.174272316382705, 42.567512898475428 ], [ 13.191362658468133, 42.587517659346418 ], [ 13.226788582099001, 42.582836772562032 ], [ 13.245935333596099, 42.572705807059442 ], [ 13.261546699490447, 42.583099750497468 ], [ 13.291260373436115, 42.570537370209983 ], [ 13.327113247102783, 42.579935059903171 ], [ 13.342823763659114, 42.574902272269654 ], [ 13.38178069237987, 42.581013207403942 ], [ 13.406420484028999, 42.628797402691156 ], [ 13.408283307006782, 42.642863529562753 ], [ 13.369918601352065, 42.648968157148225 ], [ 13.349682744561218, 42.668716743016056 ], [ 13.357755645107735, 42.694098094891459 ], [ 13.388807677200528, 42.687300169831964 ], [ 13.427396937983231, 42.706425296381987 ], [ 13.45210847879806, 42.733911387405264 ], [ 13.488800659368593, 42.733673712789717 ], [ 13.504224310152731, 42.747084947943236 ], [ 13.502316530881258, 42.77096911334872 ], [ 13.529114552507343, 42.795341939318952 ], [ 13.534478518585237, 42.816644505459031 ], [ 13.571461264925428, 42.800507078974697 ], [ 13.624398869633838, 42.816541735840168 ], [ 13.635516366621307, 42.803302389555917 ], [ 13.663599836744181, 42.807127380591886 ], [ 13.699303310176438, 42.822615601908971 ], [ 13.72485564570424, 42.855721080540967 ], [ 13.774078751107728, 42.859485469040976 ], [ 13.816123316587612, 42.877523900747057 ], [ 13.916724724800755, 42.894584737494966 ], [ 13.940261590286207, 42.814281241061359 ], [ 13.960990666705019, 42.769881546581686 ], [ 13.995827523092627, 42.708337620726006 ], [ 14.038847503423087, 42.654779555068707 ], [ 14.075265254754333, 42.601629611221618 ], [ 14.123731993512131, 42.549463769402422 ], [ 14.205996100913337, 42.478537193821388 ], [ 14.233094736844542, 42.465408449024338 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Molise", "ISO": "IT-67" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 15.13804572601151, 41.926645131283351 ], [ 15.131434658668908, 41.903020468357226 ], [ 15.138799094149407, 41.879280886008274 ], [ 15.103662499331355, 41.846740100367967 ], [ 15.100268188895479, 41.833788284985346 ], [ 15.11644311204285, 41.814535319156661 ], [ 15.115135695304557, 41.789559297141047 ], [ 15.097373450288227, 41.765933609661168 ], [ 15.102843255471287, 41.741275748922241 ], [ 15.133599011611897, 41.697974418054727 ], [ 15.106073507209885, 41.685610971240514 ], [ 15.069561949061683, 41.6600669667693 ], [ 15.048312513445644, 41.655520501691832 ], [ 15.044698171360217, 41.640346094960961 ], [ 15.022689641148363, 41.621853006204077 ], [ 14.988700165326026, 41.637807884412567 ], [ 14.955895630688966, 41.643400959043788 ], [ 14.934875641972228, 41.621619242178546 ], [ 14.947021944093835, 41.609683372769084 ], [ 14.948537857070249, 41.573751713836685 ], [ 14.937030621498904, 41.527855827102236 ], [ 14.966394423870211, 41.519007319233154 ], [ 15.007617821316355, 41.486388790667682 ], [ 14.9822669632229, 41.469066131494557 ], [ 14.946414272248898, 41.455974077131096 ], [ 14.884420400615085, 41.444779771122839 ], [ 14.867695147263719, 41.427822853780604 ], [ 14.843115392073251, 41.426607271996453 ], [ 14.790181661567996, 41.452551867281493 ], [ 14.773960106309859, 41.445526426643241 ], [ 14.764700386857301, 41.417368064904643 ], [ 14.717278583928451, 41.400827771466147 ], [ 14.699623329791864, 41.410843581190385 ], [ 14.671443331166333, 41.40664145578166 ], [ 14.633779448306827, 41.387432981213287 ], [ 14.60303922297425, 41.363962337538197 ], [ 14.56632577764718, 41.392130642127142 ], [ 14.551523203529202, 41.379385180268038 ], [ 14.488605940440827, 41.390708420083016 ], [ 14.477989489025873, 41.410171904803192 ], [ 14.453967497959626, 41.427913314418106 ], [ 14.427611314256213, 41.429106270905756 ], [ 14.342178761593951, 41.454080402706865 ], [ 14.327161984410347, 41.453437422302535 ], [ 14.277555162757212, 41.485849135713487 ], [ 14.249421810605362, 41.484551902892456 ], [ 14.241625288222719, 41.496661590456945 ], [ 14.204853211254242, 41.499934198876645 ], [ 14.167302350595877, 41.494416225636385 ], [ 14.15164277331812, 41.482656041498579 ], [ 14.125270002804655, 41.507369669026666 ], [ 14.078369433168255, 41.447083963600356 ], [ 14.107489615994126, 41.416432516304923 ], [ 14.084769192623909, 41.400034099677676 ], [ 14.042388571469933, 41.39278043584752 ], [ 14.017694511788269, 41.423418784127833 ], [ 14.005020681923792, 41.42500310896304 ], [ 14.005781248381961, 41.452833570330199 ], [ 13.977906078513243, 41.462487472719815 ], [ 13.992776635760507, 41.482081471864106 ], [ 13.972906893010684, 41.494036417114664 ], [ 14.022159092117356, 41.527012522732193 ], [ 14.023659888804259, 41.56103265831527 ], [ 13.997814151055278, 41.579429587065952 ], [ 14.010990423866678, 41.607538602272108 ], [ 13.996666499222393, 41.624139801618973 ], [ 13.988294022558046, 41.653832035951005 ], [ 13.96736001429295, 41.674030248299324 ], [ 13.941015156699477, 41.687972757233084 ], [ 13.956438332477653, 41.695669426858679 ], [ 13.994407574240309, 41.693692836911588 ], [ 14.019180269188272, 41.682360810913849 ], [ 14.026922804646032, 41.702701603081053 ], [ 14.053246219551411, 41.701698685139711 ], [ 14.053477370805631, 41.719612014472446 ], [ 14.069570906247812, 41.737225381408905 ], [ 14.115264658940367, 41.736933820690531 ], [ 14.158677477034754, 41.74702474601149 ], [ 14.193963271972601, 41.748023553701856 ], [ 14.201914373000662, 41.766995000264195 ], [ 14.170691877691496, 41.779708146634697 ], [ 14.164648133055799, 41.80946941878944 ], [ 14.147157882335579, 41.827297321146354 ], [ 14.155622375810376, 41.839612463530287 ], [ 14.21686752526225, 41.853771558598808 ], [ 14.226873756031999, 41.874797787526546 ], [ 14.266367103605036, 41.895796673666737 ], [ 14.279300964143342, 41.909518272888199 ], [ 14.302740182045241, 41.894221597303449 ], [ 14.324496797125946, 41.895656179046505 ], [ 14.343491250232539, 41.868952105986303 ], [ 14.375890767079124, 41.878472677297999 ], [ 14.445696547537173, 41.837823152507006 ], [ 14.454744170997854, 41.795807644752422 ], [ 14.465140215227283, 41.777175312849181 ], [ 14.48954516735024, 41.760969858882625 ], [ 14.533345113013381, 41.791585377669456 ], [ 14.550771436132116, 41.816587375281273 ], [ 14.567979076507637, 41.818119509367691 ], [ 14.598641695486231, 41.853465546955221 ], [ 14.614244513551007, 41.889188438808077 ], [ 14.641321987150839, 41.899342290368502 ], [ 14.663763356271486, 41.916289062991815 ], [ 14.670244377350645, 41.948202807650823 ], [ 14.727161086607271, 42.003246147525523 ], [ 14.765818464354835, 42.018088344224324 ], [ 14.782246961659654, 42.03510522100111 ], [ 14.761709287838086, 42.041686685310019 ], [ 14.779549206678633, 42.069826092393903 ], [ 14.859157068121885, 42.03450852975633 ], [ 14.915703271218687, 42.017746565350102 ], [ 14.993590838894631, 42.004786688217678 ], [ 15.089402310381283, 41.938448900335395 ], [ 15.13804572601151, 41.926645131283351 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Lazio", "ISO": "IT-62" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 12.243624215182994, 41.737867752004576 ], [ 12.21984172576858, 41.770544517463918 ], [ 12.224221068356169, 41.781894623661735 ], [ 12.203510232991254, 41.829742950622609 ], [ 12.177670531091044, 41.873527292519725 ], [ 12.140738377440915, 41.916242170859483 ], [ 12.049786154042998, 41.956510706301302 ], [ 12.023977794115932, 41.9838407723609 ], [ 11.979957764680886, 41.996447684381316 ], [ 11.963893192053675, 42.014262224653557 ], [ 11.915734127794892, 42.039369819661665 ], [ 11.879449276579523, 42.038062209548563 ], [ 11.844990932008793, 42.03018711427066 ], [ 11.820141894992286, 42.049536549235356 ], [ 11.807310650324283, 42.079543870693783 ], [ 11.754958031180241, 42.127185779225059 ], [ 11.733766971184139, 42.158058111336828 ], [ 11.739298231747759, 42.17132357829577 ], [ 11.720683865102703, 42.190416743498588 ], [ 11.695050642129432, 42.235708369959994 ], [ 11.63247438265163, 42.295532042355823 ], [ 11.556419466737141, 42.338389879074853 ], [ 11.45113006521626, 42.377247045229865 ], [ 11.452083509204654, 42.382292243429404 ], [ 11.449780207458822, 42.394039298977411 ], [ 11.48192765192338, 42.419786865353608 ], [ 11.488888408440369, 42.439370363574263 ], [ 11.5165750923461, 42.433556015626905 ], [ 11.5435113232683, 42.442114789784405 ], [ 11.617709310728431, 42.43604425816801 ], [ 11.615960005868102, 42.488638172954708 ], [ 11.561235582203089, 42.517293007395715 ], [ 11.58435064511499, 42.542754621250182 ], [ 11.578557204548636, 42.56621098077828 ], [ 11.600890164619015, 42.56979561892458 ], [ 11.616191560285268, 42.559874834984541 ], [ 11.685941663536957, 42.584843991943252 ], [ 11.680049983789461, 42.595313337790387 ], [ 11.711617343731417, 42.61103075771284 ], [ 11.733129585050669, 42.606061885389607 ], [ 11.751830319925919, 42.625595434716409 ], [ 11.804776035350242, 42.643999178416067 ], [ 11.808407124577794, 42.659751170671854 ], [ 11.784515149937148, 42.671321054910202 ], [ 11.781143070502255, 42.705325727112402 ], [ 11.797080998601096, 42.706513129263726 ], [ 11.818658361058541, 42.745771945513361 ], [ 11.779418833765593, 42.758017440230866 ], [ 11.759273255676629, 42.782236462285411 ], [ 11.753349313045744, 42.802236022458374 ], [ 11.775874040438593, 42.820673635327459 ], [ 11.80300110081736, 42.800970061202577 ], [ 11.815446802121066, 42.8237621024116 ], [ 11.850593088594648, 42.838683189875887 ], [ 11.894963940648154, 42.834668794073558 ], [ 11.9049256096552, 42.827894644781637 ], [ 11.931307756390986, 42.778440340033235 ], [ 11.97948183640772, 42.764585315682403 ], [ 11.968726058972106, 42.734578430361644 ], [ 11.949145956380136, 42.727403910843449 ], [ 11.926292757558661, 42.70474094517725 ], [ 11.941329826271726, 42.683300890387194 ], [ 11.97797968717965, 42.675525143512083 ], [ 12.024711325237149, 42.651486672789197 ], [ 12.073715387792065, 42.656670308861656 ], [ 12.119543863273396, 42.649823514219221 ], [ 12.140774611037447, 42.656300823454188 ], [ 12.16101159955824, 42.676909990906495 ], [ 12.197280568141618, 42.66384549189879 ], [ 12.243340641492326, 42.628091062814853 ], [ 12.229194591134986, 42.610401984449375 ], [ 12.245948987694959, 42.599948884482593 ], [ 12.238720421699664, 42.572005785237558 ], [ 12.275043308590547, 42.559914794904557 ], [ 12.267169292630577, 42.532617674399198 ], [ 12.316442039191863, 42.488380024679998 ], [ 12.374173937561823, 42.481128252615896 ], [ 12.40352334299747, 42.49996109026506 ], [ 12.417899011365868, 42.458454637334462 ], [ 12.411381843078695, 42.446006775687508 ], [ 12.422269521962855, 42.421603933820791 ], [ 12.466712791879388, 42.419465501787407 ], [ 12.481361930332469, 42.404163922927708 ], [ 12.511129429006887, 42.403566741975922 ], [ 12.513271034315048, 42.378624695109885 ], [ 12.531231637708686, 42.365074276401081 ], [ 12.54893846608655, 42.38232862011472 ], [ 12.569990346498846, 42.382910275544901 ], [ 12.614891063683718, 42.414481756275805 ], [ 12.611962216367422, 42.436246623261539 ], [ 12.621374616963509, 42.468667316790956 ], [ 12.642693800303487, 42.464506052831879 ], [ 12.649855656287059, 42.443090953236819 ], [ 12.665982787549353, 42.440973358947438 ], [ 12.702785342659867, 42.460899122061797 ], [ 12.741568095117392, 42.470532509047949 ], [ 12.711133549815331, 42.500796903906114 ], [ 12.731537309034664, 42.50885750668111 ], [ 12.773542713309421, 42.513093990305528 ], [ 12.773202317644337, 42.531279914395533 ], [ 12.823016965798367, 42.537487077923757 ], [ 12.847831716929839, 42.552803148549408 ], [ 12.892729022539914, 42.563497445659642 ], [ 12.880089884947566, 42.602361789521886 ], [ 12.896340286536367, 42.616444035750412 ], [ 12.931535760230684, 42.603591925951825 ], [ 12.953388674077495, 42.619021280586111 ], [ 13.004317781651098, 42.615237367650955 ], [ 13.015329889827614, 42.631916161535301 ], [ 13.058573752524453, 42.622842295271468 ], [ 13.097805149524875, 42.636308500135243 ], [ 13.1304959748211, 42.659301116771282 ], [ 13.14423367035819, 42.64631056821036 ], [ 13.174140797605588, 42.666105124295683 ], [ 13.17333487487914, 42.687313921861367 ], [ 13.190655787651554, 42.712751553959187 ], [ 13.189215833537546, 42.733577628927513 ], [ 13.254152834006465, 42.721450249452147 ], [ 13.264502280253325, 42.740181239807953 ], [ 13.287762036842247, 42.739220780618439 ], [ 13.318860293576895, 42.722726303502505 ], [ 13.357755645107735, 42.694098094891459 ], [ 13.349682744561218, 42.668716743016056 ], [ 13.369918601352065, 42.648968157148225 ], [ 13.408283307006782, 42.642863529562753 ], [ 13.406420484028999, 42.628797402691156 ], [ 13.38178069237987, 42.581013207403942 ], [ 13.342823763659114, 42.574902272269654 ], [ 13.327113247102783, 42.579935059903171 ], [ 13.291260373436115, 42.570537370209983 ], [ 13.261546699490447, 42.583099750497468 ], [ 13.245935333596099, 42.572705807059442 ], [ 13.226788582099001, 42.582836772562032 ], [ 13.191362658468133, 42.587517659346418 ], [ 13.174272316382705, 42.567512898475428 ], [ 13.176085156583463, 42.552646291933776 ], [ 13.157356701348391, 42.527716086144046 ], [ 13.177769627522387, 42.512636323290614 ], [ 13.171535326789312, 42.486081202394658 ], [ 13.15405333366988, 42.462332424957502 ], [ 13.116168386454083, 42.443909781783191 ], [ 13.15516715154677, 42.414216312915428 ], [ 13.189201958226942, 42.400220126524466 ], [ 13.189398306857452, 42.381111437583108 ], [ 13.153349002710204, 42.356994106668139 ], [ 13.191351061361985, 42.332334245211037 ], [ 13.226462981830029, 42.319330568331061 ], [ 13.22893262267136, 42.287175296775608 ], [ 13.238635371632126, 42.272824691956629 ], [ 13.271242878606939, 42.254163387508633 ], [ 13.28212792987294, 42.23722655316849 ], [ 13.319935807435737, 42.229637860111815 ], [ 13.33189413054904, 42.208179471632604 ], [ 13.352232570651134, 42.19127877322623 ], [ 13.353963092799255, 42.174943636363409 ], [ 13.323194376101069, 42.161412509267684 ], [ 13.305290680556327, 42.138256333433226 ], [ 13.265000251731703, 42.136789926341372 ], [ 13.237228454051005, 42.12913098733938 ], [ 13.192711209324177, 42.158257556288703 ], [ 13.158308551518324, 42.157494956084136 ], [ 13.122312478849601, 42.177119397736753 ], [ 13.087057415640288, 42.177871038920259 ], [ 13.086165958188138, 42.144334609116008 ], [ 13.059821994116945, 42.122954529094393 ], [ 13.037007376516502, 42.118997634984225 ], [ 13.018487902907868, 42.074938195218941 ], [ 13.02662171301999, 42.050027646246441 ], [ 13.058121607990385, 42.015554349080034 ], [ 13.101323964660519, 42.009748286903843 ], [ 13.107740704300078, 42.025104605550808 ], [ 13.139947933551502, 42.015346562494095 ], [ 13.199082173301921, 41.986496263187547 ], [ 13.2315416304117, 41.981688602069163 ], [ 13.286035101953608, 41.950368901050894 ], [ 13.322622080905733, 41.945157799363002 ], [ 13.337529960650786, 41.925980487880267 ], [ 13.356555612045883, 41.92573862211708 ], [ 13.383994309041661, 41.904186669042808 ], [ 13.359835255309399, 41.869376933330074 ], [ 13.366833915817226, 41.833068138188764 ], [ 13.391512384066456, 41.819786708627994 ], [ 13.407463067282647, 41.83746446307255 ], [ 13.451554363454068, 41.822817937681997 ], [ 13.463751577454873, 41.809450717205642 ], [ 13.50440742760016, 41.801543496052787 ], [ 13.520432946280071, 41.772965539585904 ], [ 13.576229509611961, 41.755018809205026 ], [ 13.586099572066995, 41.76643483256229 ], [ 13.63127241458872, 41.782645519324547 ], [ 13.63845929409505, 41.804317946667346 ], [ 13.662891496340114, 41.811268090273479 ], [ 13.692708067659144, 41.791522967374952 ], [ 13.716492042916633, 41.797397523762093 ], [ 13.748649336676205, 41.773587431717665 ], [ 13.765912204726451, 41.748702417466134 ], [ 13.790142019301378, 41.742969511743183 ], [ 13.810136331327767, 41.753868855786827 ], [ 13.823480811890143, 41.740884308191021 ], [ 13.880585016448974, 41.72829710444789 ], [ 13.89763893693722, 41.732134254419954 ], [ 13.919701411270122, 41.71724358135657 ], [ 13.941015156699477, 41.687972757233084 ], [ 13.96736001429295, 41.674030248299324 ], [ 13.988294022558046, 41.653832035951005 ], [ 13.996666499222393, 41.624139801618973 ], [ 14.010990423866678, 41.607538602272108 ], [ 13.997814151055278, 41.579429587065952 ], [ 14.023659888804259, 41.56103265831527 ], [ 14.022159092117356, 41.527012522732193 ], [ 13.972906893010684, 41.494036417114664 ], [ 13.992776635760507, 41.482081471864106 ], [ 13.977906078513243, 41.462487472719815 ], [ 13.96078305537627, 41.463598228750378 ], [ 13.910858089491217, 41.428684734875262 ], [ 13.875139873699007, 41.426416378851599 ], [ 13.861798821502379, 41.418086883241308 ], [ 13.886318363847954, 41.384444270562106 ], [ 13.87361822819487, 41.374715852777321 ], [ 13.873679899232473, 41.335624633308768 ], [ 13.894737593899951, 41.310536935531758 ], [ 13.882337481196213, 41.290942098019215 ], [ 13.85105968643807, 41.289571048510211 ], [ 13.827571151221267, 41.27745612015719 ], [ 13.839808293780914, 41.263381760699367 ], [ 13.816849546994408, 41.243674625778475 ], [ 13.773747395312757, 41.242659244952463 ], [ 13.762112597963092, 41.222596729924064 ], [ 13.70604450899979, 41.25406299445018 ], [ 13.680471034918009, 41.244354828059244 ], [ 13.665111338708915, 41.253395862247707 ], [ 13.621035889635651, 41.260720933157266 ], [ 13.582661217608983, 41.246227680134368 ], [ 13.568366938308595, 41.23091568535888 ], [ 13.575590529786815, 41.203920497693929 ], [ 13.547626223995934, 41.207493140737213 ], [ 13.519197590960211, 41.224828907399115 ], [ 13.470157603358928, 41.237452863282094 ], [ 13.408487669288096, 41.269154497361022 ], [ 13.35596163068562, 41.286647777229383 ], [ 13.291613725200516, 41.297520192109076 ], [ 13.266395305621572, 41.294887165983866 ], [ 13.251298475787786, 41.283246797915304 ], [ 13.205787158560835, 41.283044614002137 ], [ 13.143000785840909, 41.263281928488524 ], [ 13.10539478545415, 41.241218611715226 ], [ 13.094520924672103, 41.224432960841646 ], [ 13.045546957771077, 41.226785711189045 ], [ 13.017523069669894, 41.285752805594328 ], [ 12.980249882362532, 41.335714658861335 ], [ 12.920076602746525, 41.381583560048405 ], [ 12.854489252539297, 41.411507599035218 ], [ 12.789126696841363, 41.41792269586535 ], [ 12.765493527125701, 41.410134495338852 ], [ 12.695024784253908, 41.449694262705769 ], [ 12.669143689860418, 41.456495508401247 ], [ 12.62235298403411, 41.444698910602284 ], [ 12.575329053610455, 41.508153767730811 ], [ 12.533546176042105, 41.553399658709239 ], [ 12.437108471491987, 41.640773949659469 ], [ 12.352154355397891, 41.696842184143328 ], [ 12.307121283239484, 41.717328153939548 ], [ 12.251858905229881, 41.736896543113481 ], [ 12.249030304315591, 41.737460603537251 ], [ 12.243624215182994, 41.737867752004576 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Campania", "ISO": "IT-72" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 14.159209066658033, 40.808043221787997 ], [ 14.156050422033594, 40.818097532129826 ], [ 14.120786624483953, 40.820572632156797 ], [ 14.107691054054898, 40.831580419992939 ], [ 14.077525100805707, 40.825469836316174 ], [ 14.084763956023316, 40.79340204503562 ], [ 14.041708252606711, 40.791138894051699 ], [ 14.048001810932179, 40.835638021273418 ], [ 14.044821927182637, 40.864839335001378 ], [ 14.032569577693506, 40.898985283284119 ], [ 13.996745257067078, 40.956267765594689 ], [ 13.922475322999604, 41.026536040397588 ], [ 13.890605758450894, 41.096115342334834 ], [ 13.835732197841459, 41.162798878577057 ], [ 13.813881613968306, 41.184494623503326 ], [ 13.762112597963092, 41.222596729924064 ], [ 13.773747395312757, 41.242659244952463 ], [ 13.816849546994408, 41.243674625778475 ], [ 13.839808293780914, 41.263381760699367 ], [ 13.827571151221267, 41.27745612015719 ], [ 13.85105968643807, 41.289571048510211 ], [ 13.882337481196213, 41.290942098019215 ], [ 13.894737593899951, 41.310536935531758 ], [ 13.873679899232473, 41.335624633308768 ], [ 13.87361822819487, 41.374715852777321 ], [ 13.886318363847954, 41.384444270562106 ], [ 13.861798821502379, 41.418086883241308 ], [ 13.875139873699007, 41.426416378851599 ], [ 13.910858089491217, 41.428684734875262 ], [ 13.96078305537627, 41.463598228750378 ], [ 13.977906078513243, 41.462487472719815 ], [ 14.005781248381961, 41.452833570330199 ], [ 14.005020681923792, 41.42500310896304 ], [ 14.017694511788269, 41.423418784127833 ], [ 14.042388571469933, 41.39278043584752 ], [ 14.084769192623909, 41.400034099677676 ], [ 14.107489615994126, 41.416432516304923 ], [ 14.078369433168255, 41.447083963600356 ], [ 14.125270002804655, 41.507369669026666 ], [ 14.15164277331812, 41.482656041498579 ], [ 14.167302350595877, 41.494416225636385 ], [ 14.204853211254242, 41.499934198876645 ], [ 14.241625288222719, 41.496661590456945 ], [ 14.249421810605362, 41.484551902892456 ], [ 14.277555162757212, 41.485849135713487 ], [ 14.327161984410347, 41.453437422302535 ], [ 14.342178761593951, 41.454080402706865 ], [ 14.427611314256213, 41.429106270905756 ], [ 14.453967497959626, 41.427913314418106 ], [ 14.477989489025873, 41.410171904803192 ], [ 14.488605940440827, 41.390708420083016 ], [ 14.551523203529202, 41.379385180268038 ], [ 14.56632577764718, 41.392130642127142 ], [ 14.60303922297425, 41.363962337538197 ], [ 14.633779448306827, 41.387432981213287 ], [ 14.671443331166333, 41.40664145578166 ], [ 14.699623329791864, 41.410843581190385 ], [ 14.717278583928451, 41.400827771466147 ], [ 14.764700386857301, 41.417368064904643 ], [ 14.773960106309859, 41.445526426643241 ], [ 14.790181661567996, 41.452551867281493 ], [ 14.843115392073251, 41.426607271996453 ], [ 14.867695147263719, 41.427822853780604 ], [ 14.884420400615085, 41.444779771122839 ], [ 14.946414272248898, 41.455974077131096 ], [ 14.9822669632229, 41.469066131494557 ], [ 15.007617821316355, 41.486388790667682 ], [ 15.023892892177068, 41.476947367867346 ], [ 15.032443012371683, 41.452684907432086 ], [ 15.076251397415279, 41.432778119149155 ], [ 15.098780028445717, 41.433768457841687 ], [ 15.081552475879354, 41.387731211509674 ], [ 15.058467630508098, 41.37213470669095 ], [ 15.072190201309729, 41.332460329543984 ], [ 15.130560172252572, 41.317185586189773 ], [ 15.126770590082126, 41.302951905626742 ], [ 15.150198891415716, 41.282737062280482 ], [ 15.201002932669999, 41.286271979523725 ], [ 15.216282568267189, 41.275235909018967 ], [ 15.24704587477339, 41.271362534970514 ], [ 15.27984391576175, 41.240794970102989 ], [ 15.246175057200286, 41.23611113175145 ], [ 15.257382332625827, 41.197397522955399 ], [ 15.227501700965593, 41.184928377191191 ], [ 15.209345463529804, 41.167686590369684 ], [ 15.210788474066577, 41.148670655533842 ], [ 15.235663186761132, 41.13988247747259 ], [ 15.267187977130732, 41.106639611262736 ], [ 15.291726587294121, 41.093543911413299 ], [ 15.314357197196216, 41.103885682062035 ], [ 15.367453556121735, 41.084879005874846 ], [ 15.396375502806071, 41.106816248061449 ], [ 15.446099979446805, 41.078014443546188 ], [ 15.478347259454361, 41.078662320097102 ], [ 15.48948875144854, 41.070031694646033 ], [ 15.54287667544658, 41.055854618942718 ], [ 15.572035681793091, 40.99887659506971 ], [ 15.566617504226254, 40.968780341068111 ], [ 15.54228574107659, 40.946396218045543 ], [ 15.526732364992951, 40.907587699022557 ], [ 15.467632576334575, 40.889603444774494 ], [ 15.473142246509635, 40.874939310811293 ], [ 15.402734376663188, 40.881610859059357 ], [ 15.37835716702776, 40.867667766642327 ], [ 15.378332833760068, 40.840749921909861 ], [ 15.334971175904856, 40.834880040351152 ], [ 15.385559164864789, 40.791530003125288 ], [ 15.389024140768031, 40.76762606317358 ], [ 15.379057675155597, 40.750930543730014 ], [ 15.381476215488266, 40.724150828828016 ], [ 15.402582214087802, 40.716334660450386 ], [ 15.430167131655969, 40.692082931156556 ], [ 15.470001738950776, 40.673170766867571 ], [ 15.503590705950067, 40.662938679799268 ], [ 15.492094742728577, 40.647492898499202 ], [ 15.467774888541504, 40.639236398026043 ], [ 15.449472593367625, 40.60910203831952 ], [ 15.475362514829769, 40.59244978120423 ], [ 15.510128227559274, 40.585747461625907 ], [ 15.544736059892832, 40.530036937936458 ], [ 15.550469378933272, 40.509247823616299 ], [ 15.5388564308718, 40.488050024089354 ], [ 15.577925741121616, 40.469475550230811 ], [ 15.59476542266378, 40.440842336696321 ], [ 15.650445185436945, 40.408250544209864 ], [ 15.710122280505271, 40.37729949168444 ], [ 15.704519019563069, 40.344018205961149 ], [ 15.726879580673128, 40.31544638889784 ], [ 15.749161607890032, 40.298736065507562 ], [ 15.792286333182377, 40.289779700255096 ], [ 15.805766226581706, 40.274527041916187 ], [ 15.805372404582542, 40.251409616845777 ], [ 15.774084861097998, 40.217343503654782 ], [ 15.712527211915466, 40.178444954093003 ], [ 15.70173806747766, 40.161469081808079 ], [ 15.70582992362662, 40.117732324916886 ], [ 15.668591111143968, 40.073250811342533 ], [ 15.676164249131885, 40.054899075570482 ], [ 15.64533920803013, 40.042961242453416 ], [ 15.63251054681157, 40.067402921335173 ], [ 15.571766129067834, 40.078331757611998 ], [ 15.53067204379305, 40.073834366725464 ], [ 15.503294967009449, 40.064051463757558 ], [ 15.484407549577814, 40.038364849881198 ], [ 15.460097014765381, 40.033698392382448 ], [ 15.418571522521907, 39.990599986484021 ], [ 15.380500205656862, 40.000825191786461 ], [ 15.342096189919776, 40.005213640657161 ], [ 15.314859884676819, 40.031881755795204 ], [ 15.291689306566715, 40.023533919464903 ], [ 15.276172533428127, 40.066770519214202 ], [ 15.262854193009373, 40.082704877823375 ], [ 15.239350820460725, 40.093316296176965 ], [ 15.209135978730576, 40.121169528234049 ], [ 15.178842007846182, 40.127282103810039 ], [ 15.146325297602194, 40.160010493079596 ], [ 15.11789165849347, 40.17725479171407 ], [ 15.08537688741764, 40.173662592039072 ], [ 15.065846061628028, 40.164396020593109 ], [ 15.036263242963697, 40.172461282917183 ], [ 14.990894450510559, 40.218945952107866 ], [ 14.958666498564012, 40.230368988773442 ], [ 14.935258184357147, 40.228593293626886 ], [ 14.906478820971062, 40.253954954017651 ], [ 14.942882561528334, 40.274851826763147 ], [ 14.946990661390139, 40.295253976355085 ], [ 14.939311616290231, 40.319325320968581 ], [ 14.945638960255515, 40.336883776092321 ], [ 14.993556123209913, 40.353606438103 ], [ 15.001336489934884, 40.377622011709377 ], [ 14.98019525844879, 40.429273063028404 ], [ 14.939261173487409, 40.486387626805644 ], [ 14.906753652188737, 40.546896627801914 ], [ 14.858465868084236, 40.607771951800153 ], [ 14.821681169725144, 40.641641425879619 ], [ 14.788948223221798, 40.665296903922851 ], [ 14.747374506336627, 40.677728383742732 ], [ 14.713837841116039, 40.662551193579219 ], [ 14.691665564759738, 40.634302743546833 ], [ 14.642104667148208, 40.64726735686564 ], [ 14.619894591450288, 40.646065995241834 ], [ 14.576913837512469, 40.618265711700097 ], [ 14.529589777231259, 40.607217944938554 ], [ 14.495423644486671, 40.627039601746262 ], [ 14.418907643931304, 40.610291529598719 ], [ 14.408032845645661, 40.599576492295611 ], [ 14.352310017857361, 40.582081073137338 ], [ 14.324520440734144, 40.569041073039486 ], [ 14.320442579758389, 40.58780684798743 ], [ 14.35179175371322, 40.634501239235988 ], [ 14.364544382895277, 40.627740932594406 ], [ 14.399704165158296, 40.637978946631051 ], [ 14.429619800269547, 40.665652097080098 ], [ 14.439007792298625, 40.681837648761125 ], [ 14.481795739180809, 40.700538322586489 ], [ 14.466243489580712, 40.73600731831673 ], [ 14.447137076968358, 40.754675334823787 ], [ 14.413484599785507, 40.752314855690507 ], [ 14.360077828829402, 40.785683917006182 ], [ 14.36011535444138, 40.785410472773641 ], [ 14.360251918458266, 40.784890477301573 ], [ 14.3163968080659, 40.825106612243601 ], [ 14.273932841198341, 40.844693329860718 ], [ 14.220621072827205, 40.826391363433046 ], [ 14.221487776010152, 40.825456969695949 ], [ 14.187286159428215, 40.792255829443562 ], [ 14.159209066658033, 40.808043221787997 ] ] ], [ [ [ 13.871807657324034, 40.761130609271376 ], [ 13.907808805295879, 40.748877131290257 ], [ 13.955072179858057, 40.740445579747934 ], [ 13.965289409472268, 40.712697068319706 ], [ 13.923472304759613, 40.69739743504266 ], [ 13.873661896267247, 40.696909581039868 ], [ 13.858568386254772, 40.73806069329229 ], [ 13.871807657324034, 40.761130609271376 ] ] ], [ [ [ 14.260009037053527, 40.561385987160975 ], [ 14.252459739562132, 40.5417539852007 ], [ 14.197944362970134, 40.536806430830957 ], [ 14.19817176339502, 40.559366982568442 ], [ 14.240478243810877, 40.55574525751296 ], [ 14.260009037053527, 40.561385987160975 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Basilicata", "ISO": "IT-77" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 16.866520499668283, 40.398077514192892 ], [ 16.8498850700311, 40.37355040588789 ], [ 16.786363791856015, 40.302738117795847 ], [ 16.74948118698984, 40.245793860475189 ], [ 16.7312739437983, 40.202710863304247 ], [ 16.684080799705409, 40.144215968694446 ], [ 16.643872047782747, 40.119038643631164 ], [ 16.627769254874952, 40.129728068067337 ], [ 16.587215663522358, 40.1331186274315 ], [ 16.530009955226454, 40.118094100957798 ], [ 16.517974206452287, 40.128776870450274 ], [ 16.494670011903974, 40.125077536577813 ], [ 16.451984489238399, 40.134802367154315 ], [ 16.408948710657526, 40.120957650210997 ], [ 16.414240147970194, 40.080684623345668 ], [ 16.394386831405217, 40.049941451965552 ], [ 16.398430607556122, 40.018966697011926 ], [ 16.360272110891486, 39.968040498832323 ], [ 16.358086774676181, 39.954099882644357 ], [ 16.337802482389325, 39.936175228628265 ], [ 16.359662865299139, 39.919604145320484 ], [ 16.343227915437797, 39.902433354171329 ], [ 16.313933699193221, 39.931042918212661 ], [ 16.268430068459704, 39.935962388514334 ], [ 16.237998581816154, 39.925469211575844 ], [ 16.216533235044402, 39.927826545789564 ], [ 16.214690825793138, 39.89597885241043 ], [ 16.158954956614938, 39.919403153889732 ], [ 16.13797202683994, 39.901412696220945 ], [ 16.10331854227962, 39.906921230830648 ], [ 16.083045642336341, 39.896614558034841 ], [ 16.053497689349385, 39.898141290113777 ], [ 16.016656539924252, 39.927102606370006 ], [ 16.006877336575705, 39.956936136947832 ], [ 16.03051323634573, 39.993442454178826 ], [ 15.979203220547033, 39.982400536126505 ], [ 15.968515587435704, 39.991734725493401 ], [ 15.928019428714327, 40.001071708350104 ], [ 15.898015860583042, 39.981682994323926 ], [ 15.867660744101688, 39.990126364509422 ], [ 15.85023312397009, 40.006032852939647 ], [ 15.820049773546554, 40.001869081591508 ], [ 15.7951173134072, 39.971655732450522 ], [ 15.771190926378711, 39.955600227110843 ], [ 15.755915690898368, 39.923556830088529 ], [ 15.74259964087619, 39.934377272986289 ], [ 15.731927700557574, 39.964080374662238 ], [ 15.681132539114742, 40.006164212514875 ], [ 15.664461279404959, 40.039578465560027 ], [ 15.64533920803013, 40.042961242453416 ], [ 15.676164249131885, 40.054899075570482 ], [ 15.668591111143968, 40.073250811342533 ], [ 15.70582992362662, 40.117732324916886 ], [ 15.70173806747766, 40.161469081808079 ], [ 15.712527211915466, 40.178444954093003 ], [ 15.774084861097998, 40.217343503654782 ], [ 15.805372404582542, 40.251409616845777 ], [ 15.805766226581706, 40.274527041916187 ], [ 15.792286333182377, 40.289779700255096 ], [ 15.749161607890032, 40.298736065507562 ], [ 15.726879580673128, 40.31544638889784 ], [ 15.704519019563069, 40.344018205961149 ], [ 15.710122280505271, 40.37729949168444 ], [ 15.650445185436945, 40.408250544209864 ], [ 15.59476542266378, 40.440842336696321 ], [ 15.577925741121616, 40.469475550230811 ], [ 15.5388564308718, 40.488050024089354 ], [ 15.550469378933272, 40.509247823616299 ], [ 15.544736059892832, 40.530036937936458 ], [ 15.510128227559274, 40.585747461625907 ], [ 15.475362514829769, 40.59244978120423 ], [ 15.449472593367625, 40.60910203831952 ], [ 15.467774888541504, 40.639236398026043 ], [ 15.492094742728577, 40.647492898499202 ], [ 15.503590705950067, 40.662938679799268 ], [ 15.470001738950776, 40.673170766867571 ], [ 15.430167131655969, 40.692082931156556 ], [ 15.402582214087802, 40.716334660450386 ], [ 15.381476215488266, 40.724150828828016 ], [ 15.379057675155597, 40.750930543730014 ], [ 15.389024140768031, 40.76762606317358 ], [ 15.385559164864789, 40.791530003125288 ], [ 15.334971175904856, 40.834880040351152 ], [ 15.378332833760068, 40.840749921909861 ], [ 15.37835716702776, 40.867667766642327 ], [ 15.402734376663188, 40.881610859059357 ], [ 15.473142246509635, 40.874939310811293 ], [ 15.467632576334575, 40.889603444774494 ], [ 15.526732364992951, 40.907587699022557 ], [ 15.54228574107659, 40.946396218045543 ], [ 15.566617504226254, 40.968780341068111 ], [ 15.572035681793091, 40.99887659506971 ], [ 15.54287667544658, 41.055854618942718 ], [ 15.558910089025613, 41.087386312554408 ], [ 15.587553655190982, 41.098375363016565 ], [ 15.617416838117101, 41.099257909521661 ], [ 15.646555063996876, 41.089622589240051 ], [ 15.67941423190765, 41.086802050723875 ], [ 15.752597503895766, 41.09733718603276 ], [ 15.768400657013768, 41.083189768068827 ], [ 15.798734074792447, 41.091983429516766 ], [ 15.805370198876005, 41.110887159429119 ], [ 15.880662209653886, 41.1368357790315 ], [ 15.920968885486133, 41.11115106815091 ], [ 15.953384641931338, 41.11080943690488 ], [ 15.976253883848804, 41.094166700937087 ], [ 16.007250296230751, 41.059106301231871 ], [ 16.040539275046878, 41.036365263709271 ], [ 16.027934449533653, 41.024081169241654 ], [ 16.03198448642927, 40.998384237598842 ], [ 16.002854462927345, 40.970209302067275 ], [ 15.976628515816243, 40.958452914034915 ], [ 16.093637771020642, 40.920267862131311 ], [ 16.121297926185125, 40.899238930570981 ], [ 16.138067180941668, 40.918353365652834 ], [ 16.162970589440999, 40.928579973098536 ], [ 16.202464180777746, 40.91753154312751 ], [ 16.223804873424637, 40.886585430749491 ], [ 16.231198953989836, 40.85488696286604 ], [ 16.278230362717853, 40.801605356805801 ], [ 16.316226019289413, 40.783105613747253 ], [ 16.35007526007734, 40.748897269547726 ], [ 16.380389453514745, 40.7363977872037 ], [ 16.400152104123748, 40.7074054089844 ], [ 16.430509334698211, 40.704754582332427 ], [ 16.479679068453933, 40.736799074442722 ], [ 16.496076968684548, 40.7582853502864 ], [ 16.522550517293254, 40.746448958777911 ], [ 16.566965861175103, 40.754460021791346 ], [ 16.574607359572742, 40.763047340935309 ], [ 16.607937887857332, 40.751831472202689 ], [ 16.632819727970865, 40.753570629433973 ], [ 16.724908461460032, 40.713832764509149 ], [ 16.696624245409158, 40.702082812769056 ], [ 16.725656280417642, 40.677600802934442 ], [ 16.70975934091565, 40.632833730154339 ], [ 16.723972665131939, 40.602445657517798 ], [ 16.705688619711175, 40.550190491091698 ], [ 16.724378920090814, 40.535291821890254 ], [ 16.715820357193785, 40.52424837120406 ], [ 16.737072231631775, 40.503827497731272 ], [ 16.719589356455479, 40.481411054233689 ], [ 16.735593149660005, 40.467924173455962 ], [ 16.792606590898046, 40.461952229969413 ], [ 16.809382462945358, 40.433073958449789 ], [ 16.85067693823083, 40.401239151529715 ], [ 16.866520499668283, 40.398077514192892 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Sicilia", "ISO": "IT-82" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 15.620346148337672, 38.272714104126621 ], [ 15.610822331229892, 38.256581694015296 ], [ 15.583623902963463, 38.246702842682197 ], [ 15.567533711822881, 38.224454616505163 ], [ 15.549741174324984, 38.168067280667636 ], [ 15.521791866461216, 38.128259743595223 ], [ 15.493774293659541, 38.074860017890565 ], [ 15.477210919609986, 38.054592593751927 ], [ 15.441742519189123, 38.024604187967036 ], [ 15.349353098000632, 37.923404907232836 ], [ 15.345718178210866, 37.9144927954327 ], [ 15.30629059519949, 37.878225246572789 ], [ 15.297746285458794, 37.850730946200144 ], [ 15.269144061246548, 37.830683456223944 ], [ 15.211785312401613, 37.753541768111042 ], [ 15.204813508149298, 37.739300180566566 ], [ 15.218347297125332, 37.708373057921762 ], [ 15.199178717709675, 37.67667901868262 ], [ 15.19321911343402, 37.646669211679672 ], [ 15.174308796230401, 37.63210669649586 ], [ 15.177234100407068, 37.576567966811339 ], [ 15.14299444951518, 37.5435608249106 ], [ 15.116154249704165, 37.531572209463292 ], [ 15.085542600179418, 37.480461488320159 ], [ 15.09154768367479, 37.405900289095463 ], [ 15.090968265288339, 37.358650926211638 ], [ 15.097889932403097, 37.321145577794191 ], [ 15.139282760849454, 37.306814124738516 ], [ 15.161635813947148, 37.289290236834553 ], [ 15.194784465448047, 37.28254611184871 ], [ 15.209130536696255, 37.291123512392723 ], [ 15.241039816942077, 37.260561029189255 ], [ 15.234662095483818, 37.241550803471533 ], [ 15.206511116736072, 37.245176596207273 ], [ 15.182838493801263, 37.209213512975701 ], [ 15.201318615616682, 37.178237561004813 ], [ 15.200700761669111, 37.161449201380591 ], [ 15.220482550760822, 37.144501028835123 ], [ 15.220736036016792, 37.129403432424915 ], [ 15.263153374943595, 37.106058131641909 ], [ 15.295748411366302, 37.106744907290114 ], [ 15.301400920036075, 37.08020049475374 ], [ 15.278044183212145, 37.065250398156479 ], [ 15.279388562828645, 37.034850861471547 ], [ 15.314950168079672, 37.037095817154253 ], [ 15.336742362349964, 37.007567970656837 ], [ 15.314988829869794, 37.00370965552252 ], [ 15.303953473491593, 37.014665559898368 ], [ 15.267779666870748, 37.002517777553841 ], [ 15.259127268464418, 36.973273559254586 ], [ 15.229798520306765, 36.970281072716055 ], [ 15.18641516201054, 36.945700404976066 ], [ 15.153430417592096, 36.914459319499173 ], [ 15.137111408095411, 36.880138603412895 ], [ 15.11078498882015, 36.848318775071277 ], [ 15.109847716561257, 36.816926326629073 ], [ 15.094173499881173, 36.799330357903621 ], [ 15.094945940962395, 36.776550293603798 ], [ 15.121503299190675, 36.731482372995544 ], [ 15.125864332692412, 36.698470991391439 ], [ 15.140249269461791, 36.685038500739481 ], [ 15.132740582699743, 36.667592486816893 ], [ 15.112394694570201, 36.673149468092717 ], [ 15.081668848619422, 36.649052301474853 ], [ 15.056603708589332, 36.661816465334432 ], [ 15.042291549504059, 36.688924516345992 ], [ 15.020715977043594, 36.701244491452449 ], [ 14.996140793884068, 36.702071567881788 ], [ 14.956615361967101, 36.694085566259744 ], [ 14.91855048954346, 36.719820994147426 ], [ 14.894564320685843, 36.729440587698413 ], [ 14.862180240842454, 36.73021760375272 ], [ 14.783088724724452, 36.703605217418627 ], [ 14.743315756836376, 36.720590189596955 ], [ 14.689837002580591, 36.7212365037255 ], [ 14.67072175954698, 36.742523768759078 ], [ 14.639124466767374, 36.761057892611468 ], [ 14.587519593396761, 36.777131810168314 ], [ 14.531337102895543, 36.780480063582146 ], [ 14.493513126068704, 36.786545921839348 ], [ 14.459481165274696, 36.827247954080939 ], [ 14.435869011618289, 36.884901560926018 ], [ 14.383042073374371, 36.956142167235207 ], [ 14.36289007894703, 36.978355998564581 ], [ 14.296132340025203, 37.037071746796379 ], [ 14.244244817826129, 37.065120465875985 ], [ 14.15680902618227, 37.095083857845097 ], [ 14.069107004980502, 37.110497263397022 ], [ 14.036310030220911, 37.106088285965349 ], [ 13.975326408047987, 37.108624514768039 ], [ 13.935463170504883, 37.096364223606194 ], [ 13.906933918649367, 37.095926574714717 ], [ 13.859261931864877, 37.112215501260259 ], [ 13.838819277271757, 37.137327802705705 ], [ 13.824081645659465, 37.144489121312546 ], [ 13.751391912614627, 37.149257767322553 ], [ 13.726155043732094, 37.170251545214654 ], [ 13.663438752935146, 37.193382305381569 ], [ 13.639134952704138, 37.229457601446668 ], [ 13.614128532699459, 37.241932177741525 ], [ 13.551278279891916, 37.286971199276358 ], [ 13.537610373162121, 37.282245671910623 ], [ 13.511819912453293, 37.291507754170325 ], [ 13.482362951073918, 37.288187436426021 ], [ 13.453078033881855, 37.29450961305195 ], [ 13.426511341545266, 37.309741739705181 ], [ 13.401853386645735, 37.333047555577629 ], [ 13.352930129528831, 37.358192061514536 ], [ 13.323054156962977, 37.363270959407515 ], [ 13.297808335665282, 37.387163042195141 ], [ 13.271616526832393, 37.391692034578092 ], [ 13.25385005118752, 37.424547833012078 ], [ 13.217219576235795, 37.459232232505613 ], [ 13.195921280236707, 37.465288149281101 ], [ 13.16891096280863, 37.491989931013187 ], [ 13.130621329067825, 37.492482604364653 ], [ 13.078217280048774, 37.505723056988131 ], [ 13.038555597310442, 37.495739874676126 ], [ 13.013365563228772, 37.499193676591638 ], [ 13.012000991138658, 37.512672981640542 ], [ 12.988764487439948, 37.540942978403329 ], [ 12.955871540383399, 37.567142939554117 ], [ 12.917718699294339, 37.577103227087463 ], [ 12.905249982259935, 37.573800182533603 ], [ 12.858243340718824, 37.582635089836103 ], [ 12.764810897098247, 37.578846409472916 ], [ 12.672842309630546, 37.559953263156949 ], [ 12.629979952345151, 37.601544115807648 ], [ 12.614031921626323, 37.634690805929743 ], [ 12.586256380844615, 37.654347622300364 ], [ 12.554141780596723, 37.663354572722476 ], [ 12.533603303577465, 37.658694208050775 ], [ 12.50129305265591, 37.674639266724455 ], [ 12.47175409740324, 37.703354833104719 ], [ 12.470065952570831, 37.747043140962468 ], [ 12.455000730382348, 37.773443643193616 ], [ 12.425464527236738, 37.803122659647322 ], [ 12.457424788581399, 37.813685648897255 ], [ 12.485775971237057, 37.873528073999957 ], [ 12.459171178329752, 37.908365833656589 ], [ 12.491641076230104, 37.951078812231117 ], [ 12.495428489195056, 37.984971491592916 ], [ 12.519225915880426, 38.009096223747534 ], [ 12.518667856535634, 38.021388038795841 ], [ 12.577507287130301, 38.07065871551017 ], [ 12.61057580357679, 38.065747732816071 ], [ 12.660530628411481, 38.091470859764335 ], [ 12.656923266113562, 38.107293760770858 ], [ 12.709737940506489, 38.108936563477471 ], [ 12.73764972739586, 38.141047953650926 ], [ 12.718952480918313, 38.166954947697718 ], [ 12.766006543026739, 38.180244564664854 ], [ 12.790927354295686, 38.135140441038509 ], [ 12.790191436891874, 38.112036453041135 ], [ 12.82656661145619, 38.06673508644198 ], [ 12.868640630809621, 38.051287382758147 ], [ 12.871379850279526, 38.036609368024408 ], [ 12.892975024030848, 38.024275740104422 ], [ 12.937580730273634, 38.029298024178189 ], [ 12.997146701865564, 38.04778112925424 ], [ 13.078238476304161, 38.088303327759441 ], [ 13.068259710642668, 38.12055865287541 ], [ 13.052968353344415, 38.139267590294345 ], [ 13.083371836469881, 38.157693260105198 ], [ 13.080727172015258, 38.173919184802344 ], [ 13.105628439528767, 38.190942281564723 ], [ 13.161806512960485, 38.172703524215912 ], [ 13.194510753113198, 38.169957161718251 ], [ 13.237527038289175, 38.186328881334624 ], [ 13.247960595659801, 38.198952135268883 ], [ 13.276695105647374, 38.202259106370228 ], [ 13.31821465852568, 38.224074273199484 ], [ 13.326026646479612, 38.203696289341316 ], [ 13.365571504869258, 38.182525028767209 ], [ 13.374944607487661, 38.153950608181773 ], [ 13.364965270166127, 38.125591874425972 ], [ 13.403803091182441, 38.100380078492023 ], [ 13.44271945325602, 38.094806804480605 ], [ 13.50508007056388, 38.108328113446923 ], [ 13.535635135696607, 38.107174969239551 ], [ 13.540588952429593, 38.058288112237527 ], [ 13.567778919500867, 38.037914699626064 ], [ 13.619184489761485, 38.011855262558669 ], [ 13.66415232415042, 37.99431583406993 ], [ 13.703790144608996, 37.990767155067623 ], [ 13.710673077713961, 37.977514424836329 ], [ 13.744956937265288, 37.97014325242624 ], [ 13.797415950181863, 37.975084841551947 ], [ 13.834113613616919, 37.982616006690868 ], [ 13.895970434304703, 38.004134547354695 ], [ 13.945821457910004, 38.028198099630664 ], [ 13.980413876941281, 38.029019819609275 ], [ 14.032677766470748, 38.036432375490676 ], [ 14.062435322027428, 38.019057750261794 ], [ 14.106424714319855, 38.014616767315658 ], [ 14.145953048068606, 38.025990590915953 ], [ 14.228191040775826, 38.010200925672628 ], [ 14.308972501072578, 38.007868353473775 ], [ 14.338524312734634, 38.018662616617846 ], [ 14.372828424405931, 38.015843392664799 ], [ 14.424108959872589, 38.040073877874129 ], [ 14.476222101704741, 38.033362786138241 ], [ 14.533180644535403, 38.044978403256884 ], [ 14.556420981769362, 38.060117806075667 ], [ 14.581193212099963, 38.05857964150028 ], [ 14.62988633241703, 38.070261620905981 ], [ 14.671147377794176, 38.094001340831859 ], [ 14.746639696568018, 38.164848730671984 ], [ 14.784392976637561, 38.151634650788154 ], [ 14.890712874027479, 38.172431117955398 ], [ 14.91627087696688, 38.192276200396932 ], [ 14.939763021150959, 38.179317469540251 ], [ 14.967379619499484, 38.15343996682352 ], [ 15.01192894377415, 38.149051695634732 ], [ 15.04327751296869, 38.151931730489643 ], [ 15.0561691250259, 38.131508400634345 ], [ 15.088840548986392, 38.119976879661145 ], [ 15.170632877840696, 38.151704105989324 ], [ 15.212148356620004, 38.186423627245169 ], [ 15.2409004971045, 38.218307872702177 ], [ 15.267902756504466, 38.206673805215374 ], [ 15.292829295879352, 38.206377865122825 ], [ 15.35356481124162, 38.217766678300251 ], [ 15.400331434277167, 38.231733432940892 ], [ 15.449662701381305, 38.25139580276484 ], [ 15.517414710341038, 38.296111828160505 ], [ 15.540318718934579, 38.301250237974777 ], [ 15.582826481113786, 38.282692115496445 ], [ 15.620346148337672, 38.272714104126621 ] ] ], [ [ [ 12.001338332686156, 36.819661948028632 ], [ 12.013349513226412, 36.825166200600933 ], [ 12.048781767346448, 36.799772657196172 ], [ 12.055815416816841, 36.775283222103887 ], [ 12.04903348586487, 36.75021904267512 ], [ 12.028354756678679, 36.735822082550655 ], [ 11.99292563857586, 36.737391427786136 ], [ 11.972575299650945, 36.762987047826947 ], [ 11.956855060005097, 36.768120697408563 ], [ 11.944124853803897, 36.790414065145143 ], [ 11.926590387126746, 36.802270851662641 ], [ 11.935080337209341, 36.831850194129586 ], [ 11.952807786261927, 36.839350636395331 ], [ 12.001338332686156, 36.819661948028632 ] ] ], [ [ [ 14.962466846470075, 38.521237776918056 ], [ 14.963601284636502, 38.489470618737272 ], [ 14.95706422452991, 38.476995665514934 ], [ 14.962545891087851, 38.451664447127463 ], [ 14.932086439620228, 38.461325275059409 ], [ 14.899469616897939, 38.479118791441941 ], [ 14.912497673128025, 38.518430888138688 ], [ 14.962466846470075, 38.521237776918056 ] ] ], [ [ [ 14.866795420976718, 38.583120946134784 ], [ 14.873648002616923, 38.56117091011874 ], [ 14.870997471899106, 38.536623862952403 ], [ 14.856459138235246, 38.534191707896916 ], [ 14.7966416115573, 38.560805623444921 ], [ 14.806728905885013, 38.582838901367822 ], [ 14.866795420976718, 38.583120946134784 ] ] ], [ [ [ 14.963728919324604, 38.412110374782472 ], [ 14.997138555980982, 38.396245433898173 ], [ 15.006074871643767, 38.375670345058722 ], [ 14.976419829806018, 38.369017087033043 ], [ 14.94904639545881, 38.385117802190109 ], [ 14.938909911151866, 38.409450486955564 ], [ 14.963728919324604, 38.412110374782472 ] ] ], [ [ [ 12.531392236044239, 35.529131400569234 ], [ 12.594007254966566, 35.520752474917714 ], [ 12.625312895781605, 35.510249851149297 ], [ 12.632694802799049, 35.493691935511407 ], [ 12.599256775872124, 35.495536848104997 ], [ 12.531392236044239, 35.529131400569234 ] ] ], [ [ [ 12.308425094827154, 37.952359904880211 ], [ 12.316978777572901, 37.936746035538015 ], [ 12.338813453951579, 37.936551144141951 ], [ 12.370581120035887, 37.918471422626801 ], [ 12.350710882988219, 37.907625567544613 ], [ 12.337267540460264, 37.919798492909585 ], [ 12.281612867696966, 37.919082001926391 ], [ 12.27445482905493, 37.936098475611416 ], [ 12.308425094827154, 37.952359904880211 ] ] ], [ [ [ 15.215086812903774, 38.771489616362679 ], [ 15.188535505846845, 38.787810483247718 ], [ 15.212847905420386, 38.810230132318225 ], [ 15.242266312200414, 38.804968646886941 ], [ 15.22687539317695, 38.777225761841812 ], [ 15.215086812903774, 38.771489616362679 ] ] ], [ [ [ 12.063892447961523, 37.990046615286985 ], [ 12.080731245706808, 37.957935452237372 ], [ 12.056291167683506, 37.952010025932594 ], [ 12.033644505265652, 37.98868327847859 ], [ 12.063892447961523, 37.990046615286985 ] ] ], [ [ [ 14.587088181331261, 38.5586363913323 ], [ 14.555769030268445, 38.557764730911217 ], [ 14.545412704530776, 38.585251813565982 ], [ 14.575692923211708, 38.58127409985574 ], [ 14.587088181331261, 38.5586363913323 ] ] ], [ [ [ 12.333515460236345, 38.020659775189543 ], [ 12.351242153395424, 37.988604967889486 ], [ 12.329806226444436, 37.987056677802215 ], [ 12.319885054289854, 38.00103131392008 ], [ 12.333515460236345, 38.020659775189543 ] ] ], [ [ [ 12.877266946555523, 35.874824549181604 ], [ 12.880737764934763, 35.854604159086144 ], [ 12.859511330851046, 35.855029995323733 ], [ 12.848486472578902, 35.868318017906375 ], [ 12.877266946555523, 35.874824549181604 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Sardegna", "ISO": "IT-88" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 8.364308832460738, 39.032933946514468 ], [ 8.350785837539155, 39.096924173142888 ], [ 8.373142350406905, 39.112218809100682 ], [ 8.386417613773503, 39.099234735012615 ], [ 8.425741780700889, 39.108923674287148 ], [ 8.431567328398716, 39.095885102180084 ], [ 8.456489585553841, 39.083743272264719 ], [ 8.464582369894186, 39.0579977288143 ], [ 8.488416179711441, 39.084560172988489 ], [ 8.461029983735315, 39.121211987456157 ], [ 8.433533070217505, 39.129849308880949 ], [ 8.437124246531861, 39.155962482607947 ], [ 8.396331226875333, 39.19929901470762 ], [ 8.372247536805327, 39.209547735719369 ], [ 8.366645119503179, 39.228174340294416 ], [ 8.425311418251237, 39.269513775614762 ], [ 8.436990414785157, 39.291998612469733 ], [ 8.41588984390394, 39.336128208273976 ], [ 8.396694754088372, 39.337680373369246 ], [ 8.385543291124392, 39.365553881732971 ], [ 8.386019975066564, 39.393630027265758 ], [ 8.410738738936939, 39.418027793941931 ], [ 8.410899534931186, 39.441184528717301 ], [ 8.38326218944901, 39.457359252472209 ], [ 8.38740063715168, 39.475861580196877 ], [ 8.404096841789039, 39.486697799204187 ], [ 8.451117346122821, 39.545646694754524 ], [ 8.470855057563892, 39.601623618324453 ], [ 8.449561440308321, 39.63422287616973 ], [ 8.458990581462954, 39.667441600105136 ], [ 8.444373762196008, 39.678341333175084 ], [ 8.45534374119338, 39.711115842900064 ], [ 8.447251322683552, 39.715033032204666 ], [ 8.444058297845011, 39.758157965732998 ], [ 8.458445621029414, 39.769425448474628 ], [ 8.498394142309047, 39.718337702601289 ], [ 8.521088237656851, 39.74616095934234 ], [ 8.545365739603943, 39.795188710564695 ], [ 8.554758738366502, 39.838761289256702 ], [ 8.544541527879254, 39.884645062858795 ], [ 8.506808506879135, 39.908042445657884 ], [ 8.468109445449912, 39.904172871228113 ], [ 8.438569196132065, 39.875296777385024 ], [ 8.39890874130953, 39.917957649591912 ], [ 8.402006993684447, 39.944804707591686 ], [ 8.392714051677073, 39.979239905544617 ], [ 8.409098322830157, 39.996225597491645 ], [ 8.4138705096822, 40.018134239692401 ], [ 8.38575660643578, 40.043874315467441 ], [ 8.421542834102294, 40.042593322545649 ], [ 8.453700210526991, 40.050806230485506 ], [ 8.489199609775245, 40.07962761262359 ], [ 8.484900801585249, 40.117781892357876 ], [ 8.460057734769462, 40.150382063093716 ], [ 8.455762002122277, 40.176678430601207 ], [ 8.46765782640399, 40.199491416913773 ], [ 8.462102927605008, 40.214042854112058 ], [ 8.482967782171983, 40.285356300427331 ], [ 8.419873225487256, 40.337211236832353 ], [ 8.390284132282178, 40.337590586494848 ], [ 8.389169066465326, 40.365927330550704 ], [ 8.399777553015525, 40.403487557467166 ], [ 8.398198071573514, 40.429983830210432 ], [ 8.373937160324529, 40.490827416349369 ], [ 8.33921463033789, 40.509170949178078 ], [ 8.312841063468092, 40.55988268021823 ], [ 8.306795060562616, 40.585579247957213 ], [ 8.28678379380248, 40.595181189689399 ], [ 8.24564856424964, 40.580918096795841 ], [ 8.243817490863893, 40.569869324548399 ], [ 8.198149257364024, 40.571194178843776 ], [ 8.216851907866941, 40.594132495222553 ], [ 8.209754541321063, 40.614763524246015 ], [ 8.189122536802381, 40.6157769879133 ], [ 8.181488846274094, 40.597838730144424 ], [ 8.150882657744898, 40.579431542643761 ], [ 8.146459843808985, 40.626076070106642 ], [ 8.186731290417402, 40.639192703485037 ], [ 8.203143333402743, 40.688458968235118 ], [ 8.174851803197214, 40.694655135651367 ], [ 8.169001039571148, 40.709139363304146 ], [ 8.135188808462805, 40.737672985811948 ], [ 8.165903082190416, 40.765735048371553 ], [ 8.160165676456456, 40.790894359566913 ], [ 8.175763767930116, 40.800965571898871 ], [ 8.218263609634201, 40.868499345105498 ], [ 8.219316444888596, 40.900089331640871 ], [ 8.19233299449715, 40.912844894288988 ], [ 8.177303684930747, 40.93899178225476 ], [ 8.19829877692168, 40.96918174634515 ], [ 8.226477351168164, 40.953137137252014 ], [ 8.248761464577843, 40.891528911294721 ], [ 8.290013728468832, 40.858063304887317 ], [ 8.315553315662108, 40.844305472179521 ], [ 8.368602505520867, 40.837958753673959 ], [ 8.413655491836273, 40.839001665253754 ], [ 8.449312361570623, 40.821259733125956 ], [ 8.48634542458125, 40.819753867903209 ], [ 8.539795709463183, 40.826345017949592 ], [ 8.607670219591617, 40.851243888495198 ], [ 8.632368541967613, 40.881332066067465 ], [ 8.703342433347586, 40.915834472887354 ], [ 8.768447972037942, 40.915885612971159 ], [ 8.789901408657371, 40.922169439093082 ], [ 8.836548400955509, 40.957215054082361 ], [ 8.873002218222721, 40.9954647664253 ], [ 8.879882421892361, 41.02866153879679 ], [ 8.929013859305602, 41.043657988400334 ], [ 8.976072821173165, 41.083942314639366 ], [ 9.013252846650778, 41.125421402491042 ], [ 9.041684587909272, 41.137332160812733 ], [ 9.058023954384028, 41.128136968208274 ], [ 9.110178784484209, 41.134931434453897 ], [ 9.118813271116325, 41.151907328055593 ], [ 9.152488916787394, 41.155421297235982 ], [ 9.167743955413608, 41.168108004245418 ], [ 9.154112382116059, 41.19721124242357 ], [ 9.169604110203815, 41.241647572852358 ], [ 9.225239579965679, 41.259235558603642 ], [ 9.280526624336662, 41.227842508135119 ], [ 9.310312544569488, 41.191032182331114 ], [ 9.33820333563237, 41.204690611265889 ], [ 9.363314231806568, 41.207577702953735 ], [ 9.37055948983476, 41.183107341675964 ], [ 9.406335815376138, 41.176419947915058 ], [ 9.421973740486916, 41.166527123905794 ], [ 9.44216631386236, 41.130987270572824 ], [ 9.440575562151706, 41.103338957286375 ], [ 9.471747208867898, 41.125825493835009 ], [ 9.485682439300243, 41.14643173979308 ], [ 9.510156774876371, 41.140732043116962 ], [ 9.526151160648924, 41.156838262095143 ], [ 9.56689335800259, 41.115866201315924 ], [ 9.570631550902654, 41.10051623311648 ], [ 9.540332280828283, 41.089798707615458 ], [ 9.523532498193934, 41.053432125392234 ], [ 9.5267364921588, 41.028805273149459 ], [ 9.561215139982988, 41.037713654899051 ], [ 9.550932067285583, 41.006719185273077 ], [ 9.576839528790343, 41.002856336560122 ], [ 9.596284407683932, 41.02089065742954 ], [ 9.621460471814142, 41.006128545716066 ], [ 9.585337947086829, 40.988017670424192 ], [ 9.593879562598126, 40.968475871835764 ], [ 9.568348073152915, 40.942788258634977 ], [ 9.57483390690974, 40.927986025601307 ], [ 9.502369522571234, 40.927469844234594 ], [ 9.506574039175662, 40.911328942313915 ], [ 9.563364823637638, 40.919062553218033 ], [ 9.591853672706213, 40.900813286194747 ], [ 9.613599925013288, 40.919803849109314 ], [ 9.645201233556634, 40.91764279950317 ], [ 9.615952950632765, 40.889586661690885 ], [ 9.656629782263501, 40.875017700139054 ], [ 9.652356615523603, 40.861338084934282 ], [ 9.693524558667404, 40.846371583141384 ], [ 9.681174574187596, 40.826581798604437 ], [ 9.672488949361048, 40.782806967446739 ], [ 9.686692259918782, 40.766499141587353 ], [ 9.71496009747543, 40.753130104094559 ], [ 9.714967908049504, 40.709884824652249 ], [ 9.746015287426273, 40.687180545222141 ], [ 9.751736026225293, 40.673909873533226 ], [ 9.742215091643507, 40.645441278164505 ], [ 9.751756272777094, 40.600867865533424 ], [ 9.788361201079789, 40.572786976430166 ], [ 9.79883319278407, 40.542373647144366 ], [ 9.827156630307062, 40.527419686901681 ], [ 9.819951157667955, 40.496181845051112 ], [ 9.792594825834543, 40.443063896769374 ], [ 9.773819603303279, 40.421824189208181 ], [ 9.772903296826222, 40.406776356379275 ], [ 9.754099215526155, 40.381078511878094 ], [ 9.717499977807996, 40.366525316993133 ], [ 9.665662502951383, 40.319759403284223 ], [ 9.632007733505871, 40.276992423357974 ], [ 9.623004118509019, 40.245013418570394 ], [ 9.62570791363547, 40.20793461875833 ], [ 9.661407270578231, 40.139075809575594 ], [ 9.700634925079205, 40.102176733301313 ], [ 9.728917956483786, 40.090830464115868 ], [ 9.73561561773716, 40.078805524355438 ], [ 9.705487888679023, 40.033566904151158 ], [ 9.69998205942014, 40.000733324507458 ], [ 9.686638269734638, 39.984172365612359 ], [ 9.68684841696661, 39.948420752615696 ], [ 9.71583009891175, 39.928376775117584 ], [ 9.683180800541191, 39.905530202245558 ], [ 9.68225398589062, 39.871348011294344 ], [ 9.696731380301868, 39.853434880175683 ], [ 9.685396544704846, 39.842122967696916 ], [ 9.6684348899149, 39.776746882352953 ], [ 9.674692933634295, 39.751545785657541 ], [ 9.675953198801379, 39.71088518215663 ], [ 9.647192466538273, 39.65169940800736 ], [ 9.656693117263307, 39.605752642274972 ], [ 9.651360579107424, 39.549247675578215 ], [ 9.639066120202125, 39.539617430038852 ], [ 9.632592766546987, 39.49679386867475 ], [ 9.64595077720776, 39.461390526136867 ], [ 9.60799879466475, 39.388434176351588 ], [ 9.597419393954896, 39.345757249866509 ], [ 9.604892959986065, 39.317984932400961 ], [ 9.628449086427286, 39.306341099151489 ], [ 9.591190773436047, 39.278429536456436 ], [ 9.570181577720398, 39.239291183167552 ], [ 9.56444255480584, 39.188970940428121 ], [ 9.570014078170757, 39.170220262457079 ], [ 9.563962976617491, 39.141620783618393 ], [ 9.539145275554002, 39.133078669466251 ], [ 9.518764282875539, 39.113292857504959 ], [ 9.502533949386999, 39.131297013497189 ], [ 9.484413990133646, 39.135670852300144 ], [ 9.434020513984725, 39.125533746030051 ], [ 9.370871642481637, 39.173890848894352 ], [ 9.34583058744982, 39.181139466701055 ], [ 9.338719329974811, 39.193597734975548 ], [ 9.297485008731426, 39.213251671383446 ], [ 9.247380133799837, 39.216435942000302 ], [ 9.229861550600374, 39.228077897580974 ], [ 9.192131570153915, 39.221188681912288 ], [ 9.164784954077406, 39.204355578133921 ], [ 9.146008425984421, 39.183950015917475 ], [ 9.123443341387182, 39.206024460491676 ], [ 9.095924251467293, 39.214114972811522 ], [ 9.061233566472248, 39.193414469706624 ], [ 9.019239336988436, 39.149177594849512 ], [ 9.008920210274903, 39.121278304363656 ], [ 9.016258197917308, 39.087457646522012 ], [ 9.045790505496619, 39.05613822070525 ], [ 9.024373679681046, 39.020170731483745 ], [ 9.011828886071092, 38.987145221212117 ], [ 8.990119285746422, 38.974914798905338 ], [ 8.914648265202242, 38.919862878646725 ], [ 8.903154607915321, 38.905104474402442 ], [ 8.854598796065897, 38.87855144525998 ], [ 8.832535599298616, 38.877421364787622 ], [ 8.81974047291895, 38.894516186157468 ], [ 8.794087412683661, 38.894651739914231 ], [ 8.780468537334531, 38.913059783171882 ], [ 8.720211860799056, 38.936671400025254 ], [ 8.714643904348016, 38.925006223446353 ], [ 8.649668990313863, 38.894893488901438 ], [ 8.606658664128265, 38.892835967411209 ], [ 8.623590569093201, 38.937562276485643 ], [ 8.612564649401723, 38.957923324744662 ], [ 8.588811996133748, 38.964470988085736 ], [ 8.565008955240407, 38.999764012014488 ], [ 8.57486874418619, 39.017048953045069 ], [ 8.565025403021801, 39.045385492980159 ], [ 8.544198274458241, 39.046430102658157 ], [ 8.527168313566477, 39.059145730906813 ], [ 8.498665461338218, 39.063385811571159 ], [ 8.468459601739065, 39.049183441719165 ], [ 8.452738193894787, 39.024731093140403 ], [ 8.45141656443216, 38.989450599370748 ], [ 8.430288210811481, 38.960053845851242 ], [ 8.403208224256772, 38.962312119213593 ], [ 8.364308832460738, 39.032933946514468 ] ] ], [ [ [ 8.32540466693259, 41.105530319198159 ], [ 8.344731034005394, 41.097372580485455 ], [ 8.340597969653675, 41.071279976256733 ], [ 8.321948218229601, 41.055850289340761 ], [ 8.283372596285172, 41.064442420482948 ], [ 8.250951595761434, 41.033282540098618 ], [ 8.24900349954342, 41.017718637207011 ], [ 8.26358580188028, 41.002671325597568 ], [ 8.25583000047096, 40.984974699235401 ], [ 8.208651850218953, 40.990181300241026 ], [ 8.223692690613069, 41.043441072831854 ], [ 8.244620229246053, 41.04690859959851 ], [ 8.266655712735265, 41.073222472297957 ], [ 8.285290993053762, 41.076740070464389 ], [ 8.276168612878873, 41.105031077336641 ], [ 8.32540466693259, 41.105530319198159 ] ] ], [ [ [ 8.308209596117633, 39.180184763884121 ], [ 8.310181019225501, 39.113172088895872 ], [ 8.281287669158997, 39.096225854084921 ], [ 8.247908595801581, 39.10847634491801 ], [ 8.250320489532699, 39.13340261387075 ], [ 8.219609899605526, 39.14778967563484 ], [ 8.230517081744248, 39.164359987449373 ], [ 8.27168483339662, 39.179798860995916 ], [ 8.308209596117633, 39.180184763884121 ] ] ], [ [ [ 9.428391538901959, 41.263691963391182 ], [ 9.438362784199334, 41.235355473844592 ], [ 9.437184543043289, 41.213654572107153 ], [ 9.416590381892078, 41.216870133827136 ], [ 9.381329209071581, 41.210329897616852 ], [ 9.378054816805575, 41.234656112347984 ], [ 9.428391538901959, 41.263691963391182 ] ] ], [ [ [ 9.4711456231316, 41.245181819948058 ], [ 9.481668009796447, 41.236115893321134 ], [ 9.478828029497095, 41.199524595448054 ], [ 9.464770333003226, 41.189466398169287 ], [ 9.444808170302613, 41.202808125427147 ], [ 9.4711456231316, 41.245181819948058 ] ] ], [ [ [ 9.734127341026772, 40.922616081987996 ], [ 9.742751340952003, 40.912302777304866 ], [ 9.692782284731393, 40.887846796742934 ], [ 9.673540623711338, 40.891771265879804 ], [ 9.734127341026772, 40.922616081987996 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Calabria", "ISO": "IT-78" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 16.643872047782747, 40.119038643631164 ], [ 16.609069047586942, 40.084914132452681 ], [ 16.598989646350233, 40.037393556802158 ], [ 16.618466903715284, 39.976432212791444 ], [ 16.628884033675135, 39.967378595533269 ], [ 16.604540569532581, 39.931000125305125 ], [ 16.554897098172898, 39.888384470293097 ], [ 16.49674663742093, 39.817776801989737 ], [ 16.486177477469244, 39.782487962534013 ], [ 16.499737310816528, 39.741491144143289 ], [ 16.529399762719766, 39.72443546944374 ], [ 16.529229974798003, 39.66648848600007 ], [ 16.563156858736136, 39.642770479500221 ], [ 16.607169302028051, 39.624602524263217 ], [ 16.630321896727686, 39.620304879309948 ], [ 16.688554328431682, 39.621529975776603 ], [ 16.735620998625635, 39.616393318076554 ], [ 16.770404597778438, 39.620792956163193 ], [ 16.817650630522952, 39.588084686340011 ], [ 16.826685305021815, 39.5681748870322 ], [ 16.866594982064523, 39.538618585949472 ], [ 16.901813411030201, 39.524923186528554 ], [ 16.943775147773774, 39.501843123946145 ], [ 16.979915208488404, 39.49109099357846 ], [ 17.024495707648889, 39.483847542057944 ], [ 17.046792852599712, 39.443914843932127 ], [ 17.080892046733261, 39.42183980194779 ], [ 17.120848906124376, 39.405101823008913 ], [ 17.153309260640107, 39.401890756960064 ], [ 17.109202066561899, 39.30718812530678 ], [ 17.104804115050545, 39.266366272881413 ], [ 17.110721538116305, 39.245293927002464 ], [ 17.148421459653566, 39.206097992223178 ], [ 17.122933045721442, 39.157622415502942 ], [ 17.110292550964481, 39.124233408997902 ], [ 17.109797479855697, 39.098408232378816 ], [ 17.130419118800507, 39.075313719448211 ], [ 17.146749906774026, 39.04647926796914 ], [ 17.195935210873991, 39.026939444177877 ], [ 17.171135807587493, 39.00399893252969 ], [ 17.15950399942432, 38.981177160695744 ], [ 17.170130505904339, 38.956806070090266 ], [ 17.1298920940526, 38.925964105647644 ], [ 17.093435579966847, 38.905589445063676 ], [ 17.047383968971111, 38.919290226459502 ], [ 17.010146672026192, 38.911728555747509 ], [ 16.997539998438764, 38.930041383114357 ], [ 16.953722536342802, 38.938074486105606 ], [ 16.876436999686561, 38.925078723022381 ], [ 16.836431811506902, 38.91532458940641 ], [ 16.770280431961663, 38.893127263588909 ], [ 16.701330094608103, 38.860044288828249 ], [ 16.603037641323738, 38.809059256006925 ], [ 16.566705291753053, 38.76518299800312 ], [ 16.567806010410177, 38.753789098710179 ], [ 16.542562984680742, 38.726993326907781 ], [ 16.5357098509302, 38.703711961390688 ], [ 16.558631955185202, 38.679531192964347 ], [ 16.556437133760845, 38.654993611754058 ], [ 16.573113582510029, 38.563921862352302 ], [ 16.57187958784246, 38.535018215439784 ], [ 16.579321405739933, 38.502845410713846 ], [ 16.581893952075042, 38.451972337671535 ], [ 16.570778040233009, 38.426733500946781 ], [ 16.502952827657605, 38.364824886530016 ], [ 16.473316493605143, 38.344058222518804 ], [ 16.421644695567014, 38.325788737853287 ], [ 16.329623382028338, 38.297325651030633 ], [ 16.192498202275104, 38.157901184904119 ], [ 16.166327395667569, 38.137310831821324 ], [ 16.143116563742083, 38.043647693160814 ], [ 16.14419374932119, 38.031248330418542 ], [ 16.116230253487743, 37.981726729522215 ], [ 16.096945972787054, 37.956589630623682 ], [ 16.064455271369138, 37.925634592477714 ], [ 16.019065894086246, 37.92250169216458 ], [ 15.998006296389701, 37.915784380640069 ], [ 15.957393613210277, 37.919350437456984 ], [ 15.920156671742037, 37.929696550130402 ], [ 15.839800992821678, 37.919175354929692 ], [ 15.764249137788196, 37.916065938921705 ], [ 15.732663585817043, 37.925391017610629 ], [ 15.697005412326474, 37.948879179137727 ], [ 15.677694649806915, 37.954360456225714 ], [ 15.645926064961929, 37.991383504103446 ], [ 15.633557804085898, 38.018403099022407 ], [ 15.654058626846291, 38.031034800967745 ], [ 15.649400355680955, 38.06821970237224 ], [ 15.634663603195154, 38.075780946338043 ], [ 15.630615093468343, 38.101922211223467 ], [ 15.647960431789853, 38.114303259986492 ], [ 15.655062442611456, 38.152486186238569 ], [ 15.640545972429004, 38.168847763845989 ], [ 15.632699275171131, 38.193964031234877 ], [ 15.636501780513694, 38.232184016607398 ], [ 15.679056154722234, 38.247164852597805 ], [ 15.749190119664066, 38.257113009778372 ], [ 15.794217772042524, 38.280267316809464 ], [ 15.817086228532293, 38.30071921819313 ], [ 15.829623957338676, 38.32481368083296 ], [ 15.832983009472313, 38.355945081584508 ], [ 15.858128646054096, 38.380210541279901 ], [ 15.865231208102076, 38.402023740702205 ], [ 15.898369025069988, 38.451502116469229 ], [ 15.930650522959755, 38.537291721874986 ], [ 15.92827030467862, 38.550340143332093 ], [ 15.901163621716938, 38.564431597583308 ], [ 15.892751376987754, 38.577820060418659 ], [ 15.82671287053741, 38.62297066525592 ], [ 15.848160850628483, 38.659206061511739 ], [ 15.872071240154741, 38.673228745351643 ], [ 15.94757098060272, 38.690947996068736 ], [ 15.986023532349796, 38.723020127622398 ], [ 16.031585499734604, 38.727881466288274 ], [ 16.104433366109063, 38.711806199266618 ], [ 16.146869325817402, 38.724255113829344 ], [ 16.182207836747793, 38.747675617169435 ], [ 16.213656761258605, 38.811617080503289 ], [ 16.221110032930266, 38.86632307887605 ], [ 16.218328970437177, 38.92034881328064 ], [ 16.153666356842781, 38.954288819518062 ], [ 16.131583643869185, 38.99847206479788 ], [ 16.101841742581904, 39.025253609918479 ], [ 16.076314498400883, 39.112911828368667 ], [ 16.066866482872999, 39.133468836544473 ], [ 16.051120235531968, 39.297917418812148 ], [ 16.036686676257524, 39.348400705322078 ], [ 15.993540530214803, 39.445373726313086 ], [ 15.958623346522634, 39.478324028232528 ], [ 15.925195480003239, 39.526531697602081 ], [ 15.881706003935909, 39.543857583615804 ], [ 15.873953234705429, 39.553901656054336 ], [ 15.831838677023111, 39.667770528607278 ], [ 15.817375321044356, 39.677397364168058 ], [ 15.808367856977423, 39.730569938869387 ], [ 15.794836952104992, 39.773476079658792 ], [ 15.779478001156937, 39.847287453293447 ], [ 15.791068147769572, 39.864803803336798 ], [ 15.7789793960117, 39.893671789949913 ], [ 15.755915690898368, 39.923556830088529 ], [ 15.771190926378711, 39.955600227110843 ], [ 15.7951173134072, 39.971655732450522 ], [ 15.820049773546554, 40.001869081591508 ], [ 15.85023312397009, 40.006032852939647 ], [ 15.867660744101688, 39.990126364509422 ], [ 15.898015860583042, 39.981682994323926 ], [ 15.928019428714327, 40.001071708350104 ], [ 15.968515587435704, 39.991734725493401 ], [ 15.979203220547033, 39.982400536126505 ], [ 16.03051323634573, 39.993442454178826 ], [ 16.006877336575705, 39.956936136947832 ], [ 16.016656539924252, 39.927102606370006 ], [ 16.053497689349385, 39.898141290113777 ], [ 16.083045642336341, 39.896614558034841 ], [ 16.10331854227962, 39.906921230830648 ], [ 16.13797202683994, 39.901412696220945 ], [ 16.158954956614938, 39.919403153889732 ], [ 16.214690825793138, 39.89597885241043 ], [ 16.216533235044402, 39.927826545789564 ], [ 16.237998581816154, 39.925469211575844 ], [ 16.268430068459704, 39.935962388514334 ], [ 16.313933699193221, 39.931042918212661 ], [ 16.343227915437797, 39.902433354171329 ], [ 16.359662865299139, 39.919604145320484 ], [ 16.337802482389325, 39.936175228628265 ], [ 16.358086774676181, 39.954099882644357 ], [ 16.360272110891486, 39.968040498832323 ], [ 16.398430607556122, 40.018966697011926 ], [ 16.394386831405217, 40.049941451965552 ], [ 16.414240147970194, 40.080684623345668 ], [ 16.408948710657526, 40.120957650210997 ], [ 16.451984489238399, 40.134802367154315 ], [ 16.494670011903974, 40.125077536577813 ], [ 16.517974206452287, 40.128776870450274 ], [ 16.530009955226454, 40.118094100957798 ], [ 16.587215663522358, 40.1331186274315 ], [ 16.627769254874952, 40.129728068067337 ], [ 16.643872047782747, 40.119038643631164 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Piemonte", "ISO": "IT-21" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 8.714815174881675, 46.09804279081736 ], [ 8.705672484500239, 46.081394093847756 ], [ 8.72876349224258, 46.029232087331479 ], [ 8.719322009721374, 46.011145796848069 ], [ 8.682299171094328, 45.986887611440487 ], [ 8.587887044177481, 45.916927845249063 ], [ 8.569446777720254, 45.89412925833448 ], [ 8.59231149983346, 45.852446370533762 ], [ 8.595200847790371, 45.83361402360179 ], [ 8.581647069925868, 45.813658208247368 ], [ 8.563511048799057, 45.807244946742649 ], [ 8.555665076912646, 45.774990328805643 ], [ 8.593750066231086, 45.730411491946249 ], [ 8.645960658884343, 45.721760671151984 ], [ 8.654357860758891, 45.707882509292425 ], [ 8.640799341547064, 45.676808279132736 ], [ 8.663680494156496, 45.674546720559881 ], [ 8.688553806896952, 45.639874069408847 ], [ 8.665198890688039, 45.631545228821317 ], [ 8.703148019933277, 45.600057010319233 ], [ 8.713196449584625, 45.519932090625453 ], [ 8.727892399133076, 45.502399393701012 ], [ 8.760351535295721, 45.496846429706295 ], [ 8.790803153924333, 45.478742071744755 ], [ 8.789348168175083, 45.461981956635682 ], [ 8.810067916568718, 45.445977423625223 ], [ 8.842896248692092, 45.393838041390069 ], [ 8.793381044089305, 45.378959659211212 ], [ 8.765430269810571, 45.388937745921652 ], [ 8.748289688853285, 45.37437755550819 ], [ 8.746697388767794, 45.356290458692733 ], [ 8.726539794810881, 45.332890066588128 ], [ 8.716121244207653, 45.302881122157743 ], [ 8.666586878749541, 45.292206631564504 ], [ 8.655710324668691, 45.325680474023962 ], [ 8.611778288009791, 45.354426176833201 ], [ 8.57881241734154, 45.347234506016505 ], [ 8.550375560328902, 45.354804219183826 ], [ 8.526375783366499, 45.342199974686004 ], [ 8.538366851396061, 45.319354089703189 ], [ 8.507710448765685, 45.307751565921187 ], [ 8.498337449907515, 45.292226427781266 ], [ 8.530940559593054, 45.268162132148653 ], [ 8.548040690490801, 45.237925410148698 ], [ 8.525670255888459, 45.219291610951387 ], [ 8.556876204319108, 45.205174288687068 ], [ 8.543949901535527, 45.181289529736389 ], [ 8.552512637228491, 45.160115666304094 ], [ 8.580001304300779, 45.152699208855978 ], [ 8.588272927391358, 45.135687919716126 ], [ 8.610978613935336, 45.123630110551638 ], [ 8.608474967104097, 45.10834571605433 ], [ 8.635487215942755, 45.089036457490536 ], [ 8.646950960782187, 45.055540965692479 ], [ 8.634737779035316, 45.040962422644348 ], [ 8.671159891654959, 45.027174314391246 ], [ 8.75096015203165, 45.020384055316526 ], [ 8.802312636785397, 45.026074628628663 ], [ 8.823892219987417, 45.04658902639779 ], [ 8.881058583395392, 45.054080341583258 ], [ 8.898066853153219, 45.050658118098262 ], [ 8.901273696575366, 45.007762784387303 ], [ 8.92498293889208, 44.98339026392734 ], [ 8.948592285341832, 44.988471402903564 ], [ 8.978124116162544, 44.96720639657908 ], [ 8.969596754325078, 44.943513664948043 ], [ 8.988206286266058, 44.930852047307923 ], [ 9.008047616978732, 44.902982206252304 ], [ 9.030363538382424, 44.888499204898523 ], [ 9.055710650732996, 44.889051788594678 ], [ 9.070108666833333, 44.866025741296575 ], [ 9.051379379077911, 44.845924900329351 ], [ 9.081615817515431, 44.81446287144356 ], [ 9.108992328237115, 44.80543785312711 ], [ 9.155119546657721, 44.809408488129399 ], [ 9.173504927518719, 44.796148854153024 ], [ 9.171725568500902, 44.771683552512471 ], [ 9.213550435359078, 44.752348219624373 ], [ 9.20283026703275, 44.72205710765688 ], [ 9.20031986650889, 44.686404806099667 ], [ 9.206434823669957, 44.660204532226395 ], [ 9.198675885722679, 44.648758232729335 ], [ 9.20297322777567, 44.613494121389706 ], [ 9.183520923748612, 44.591640485662445 ], [ 9.152554983969685, 44.574221158210314 ], [ 9.112968880959361, 44.58110909700892 ], [ 9.104484677627125, 44.606612259456654 ], [ 9.075853438802275, 44.623699039315156 ], [ 9.053681216510572, 44.620884835270502 ], [ 9.013153036142141, 44.666791557548983 ], [ 8.972515235098644, 44.663349583004432 ], [ 8.959523102917657, 44.676021069774741 ], [ 8.927883877261284, 44.674268010124834 ], [ 8.908261178318767, 44.646823643954789 ], [ 8.882693538437506, 44.639020647016586 ], [ 8.904354612581981, 44.620825893271089 ], [ 8.917502849410619, 44.561055017009437 ], [ 8.89494050249658, 44.555369382571854 ], [ 8.826840445761208, 44.561799380765827 ], [ 8.824397540914365, 44.53864144851012 ], [ 8.795107398637262, 44.521856823088505 ], [ 8.796653932674031, 44.500109236340535 ], [ 8.782453626018144, 44.488361025287467 ], [ 8.767564336338809, 44.524964010557852 ], [ 8.720998035385316, 44.579865416558121 ], [ 8.681419819092236, 44.574882508739982 ], [ 8.666756586579965, 44.582456803886345 ], [ 8.620169123973987, 44.576729797825578 ], [ 8.60088684508005, 44.567823557321532 ], [ 8.613452993148364, 44.546602747701627 ], [ 8.5761615944997, 44.509226681676189 ], [ 8.560059320073831, 44.502845947712885 ], [ 8.534783194965605, 44.513350884981044 ], [ 8.453011038403229, 44.509811222680518 ], [ 8.449498672110682, 44.497388095000019 ], [ 8.403879279100115, 44.508971681395231 ], [ 8.394448314049942, 44.480229506554863 ], [ 8.358490861829067, 44.464935699382785 ], [ 8.350053090205758, 44.484810925314491 ], [ 8.320803203176194, 44.488403832203005 ], [ 8.304553658861346, 44.502647252956699 ], [ 8.271312522344425, 44.506797275016162 ], [ 8.252777445079877, 44.52874739172254 ], [ 8.22416288176799, 44.514174953545904 ], [ 8.218479553078948, 44.48182573716123 ], [ 8.196435047300378, 44.46360440003091 ], [ 8.221835830597765, 44.429556468179641 ], [ 8.203499648958614, 44.40489303591702 ], [ 8.149519219361119, 44.384792022968341 ], [ 8.14863717053858, 44.354810721924125 ], [ 8.134283905431907, 44.332099621955315 ], [ 8.106968945588099, 44.332818123315185 ], [ 8.101956775119451, 44.300931025227875 ], [ 8.076021695437712, 44.313958462045086 ], [ 8.059739808101254, 44.300703827902872 ], [ 8.088599544850677, 44.274298017757879 ], [ 8.063096634217187, 44.253074194549185 ], [ 8.080619613650059, 44.241710730597916 ], [ 8.065363260272326, 44.216936583575809 ], [ 8.087962853890144, 44.203160425578318 ], [ 8.094194318175587, 44.175407994425953 ], [ 8.067310192013958, 44.144689929309102 ], [ 8.042931067612338, 44.142826509399953 ], [ 8.009445818085219, 44.15560664325028 ], [ 7.978931542874537, 44.13354203581811 ], [ 8.006633536039438, 44.12570291859754 ], [ 8.004633814641833, 44.102326670875662 ], [ 7.971531404232715, 44.113095205126783 ], [ 7.937197952637066, 44.099747479051274 ], [ 7.925962472956769, 44.110302209860116 ], [ 7.88394395599448, 44.104658567968052 ], [ 7.866119599251603, 44.118155382027098 ], [ 7.815310656735465, 44.123244234570365 ], [ 7.775143121862861, 44.139971613343839 ], [ 7.746024607649917, 44.135356779840833 ], [ 7.723123588946839, 44.120817201411178 ], [ 7.719295838473721, 44.104480817033682 ], [ 7.740081233899363, 44.077324158211461 ], [ 7.714329727043173, 44.061558889222972 ], [ 7.713246747975248, 44.087828927448427 ], [ 7.67193328494051, 44.120451827278529 ], [ 7.684645253449835, 44.173915453436088 ], [ 7.6449891232579, 44.178124495098587 ], [ 7.617380267275574, 44.14983900718665 ], [ 7.565022895081815, 44.152344311383082 ], [ 7.521404851615582, 44.137797150862653 ], [ 7.497204270535271, 44.141856826220319 ], [ 7.45995894858939, 44.12585733021649 ], [ 7.428170599653418, 44.130412011727273 ], [ 7.425850485381555, 44.114228442800872 ], [ 7.392652171315304, 44.125560177776343 ], [ 7.355476238282638, 44.117144221073715 ], [ 7.343266903825134, 44.145291565095711 ], [ 7.286744283607515, 44.145583050298519 ], [ 7.219666455989657, 44.168352183922678 ], [ 7.188674222026387, 44.198902738535367 ], [ 7.163572576497832, 44.207851439334362 ], [ 7.141649939800888, 44.200969633209908 ], [ 7.086430047495385, 44.229308284708893 ], [ 7.068538382001325, 44.233688584329421 ], [ 7.033387517832566, 44.224355779072134 ], [ 7.005252082903752, 44.237426164163104 ], [ 6.994965093041854, 44.28071190217721 ], [ 6.969985610288285, 44.285330131749376 ], [ 6.959912607701003, 44.312114042089476 ], [ 6.926784976416632, 44.333187028198623 ], [ 6.922010698397107, 44.351726936570955 ], [ 6.888823581831114, 44.36107512060665 ], [ 6.896151344107024, 44.371950633988824 ], [ 6.893488217963649, 44.420849077251745 ], [ 6.934649601425642, 44.429937552390044 ], [ 6.906328028856554, 44.467826816403637 ], [ 6.875702205091097, 44.482250332769617 ], [ 6.853413312154607, 44.527881332474124 ], [ 6.877207046867999, 44.552867010664976 ], [ 6.91430948496239, 44.559006372172234 ], [ 6.933685093709813, 44.575013963902521 ], [ 6.933124925475237, 44.592639573400533 ], [ 6.955043672585919, 44.621805952322688 ], [ 6.947599136327262, 44.652622442124283 ], [ 6.987115517497958, 44.689524313388659 ], [ 7.030411022722888, 44.691467787795112 ], [ 7.062260253045888, 44.679859724240828 ], [ 7.076159015682995, 44.683848738132717 ], [ 7.065112671436522, 44.7137819116477 ], [ 7.041061421291772, 44.719558055038618 ], [ 7.023670715493413, 44.739702363961591 ], [ 7.019236393049165, 44.775958362683781 ], [ 7.000079320674002, 44.789046566638831 ], [ 7.023850184782191, 44.82333100658704 ], [ 7.006570471632654, 44.839508898437892 ], [ 6.969539045696018, 44.846643027398791 ], [ 6.931505434975123, 44.863438210678119 ], [ 6.912837670054149, 44.844855229009227 ], [ 6.862942563783793, 44.850719592379853 ], [ 6.808954117891057, 44.87546892284724 ], [ 6.771186321114425, 44.903049003708915 ], [ 6.74999962173807, 44.907485420266944 ], [ 6.753188583307626, 44.938433935913288 ], [ 6.765061519889106, 44.959074361133816 ], [ 6.750432417563165, 44.978150061672089 ], [ 6.743217065344981, 45.015914454272554 ], [ 6.726020616117039, 45.021676389646835 ], [ 6.675447047985418, 45.019325396043797 ], [ 6.665428237505354, 45.031615433565875 ], [ 6.661522688661323, 45.071683424102098 ], [ 6.627259868476274, 45.101771276520154 ], [ 6.633393877484786, 45.114807067236086 ], [ 6.673057730232576, 45.124534219029826 ], [ 6.680208224149355, 45.140414698384305 ], [ 6.71203493549247, 45.144765762789412 ], [ 6.740199547823683, 45.136973271724301 ], [ 6.769156841737924, 45.159839941294202 ], [ 6.813103262619924, 45.148529097652769 ], [ 6.850404181809829, 45.127453582802659 ], [ 6.897924929520398, 45.141345931590365 ], [ 6.884424581260233, 45.157569558028968 ], [ 6.893519542896275, 45.169007780328698 ], [ 6.931976099107119, 45.17109715714183 ], [ 6.967018015993172, 45.19518473211523 ], [ 6.960615668295435, 45.202982940369701 ], [ 7.006349306895656, 45.21727508655075 ], [ 7.050968530212865, 45.225705848176112 ], [ 7.066990730496424, 45.210293057545648 ], [ 7.107070681254653, 45.243608681877944 ], [ 7.136916881025262, 45.255549535102354 ], [ 7.135284431323893, 45.282437288547627 ], [ 7.109400589924697, 45.327702820335873 ], [ 7.126078542957362, 45.327329671996338 ], [ 7.138458420736455, 45.351178794989544 ], [ 7.159508110845342, 45.359459233234681 ], [ 7.163280767433855, 45.381789269864299 ], [ 7.182413156487096, 45.400962138459093 ], [ 7.152258373604588, 45.422630265275991 ], [ 7.114426605764367, 45.433461384958953 ], [ 7.104329571840415, 45.466958756615561 ], [ 7.121665161917869, 45.506238285201867 ], [ 7.141055509566042, 45.510921157630349 ], [ 7.157272270847698, 45.486601879706704 ], [ 7.230384227160346, 45.475462723419447 ], [ 7.269497278219059, 45.514677044267565 ], [ 7.322953196485625, 45.514451294711463 ], [ 7.364023612362701, 45.525053441026714 ], [ 7.375713968516539, 45.516492736602778 ], [ 7.422174649234082, 45.54600706667194 ], [ 7.447963076345624, 45.555567375822363 ], [ 7.470864867029825, 45.577686920710079 ], [ 7.499021008394017, 45.583109996106927 ], [ 7.532669279667474, 45.577171119402522 ], [ 7.565487319324157, 45.591564461445593 ], [ 7.599082245809964, 45.578445314603762 ], [ 7.609065934816604, 45.562876784140776 ], [ 7.645939996483633, 45.568991839216913 ], [ 7.676792735028634, 45.552093724962155 ], [ 7.716345015474464, 45.55895637549127 ], [ 7.732703534982383, 45.550335202936211 ], [ 7.785323506423492, 45.574788949351337 ], [ 7.795674250246953, 45.586385441018443 ], [ 7.848871322540834, 45.602262239198481 ], [ 7.896248937227446, 45.599768545372221 ], [ 7.915904355570726, 45.633087585247772 ], [ 7.939504004237182, 45.643697391533522 ], [ 7.905208199525089, 45.681961972446246 ], [ 7.936624515996284, 45.724342593321118 ], [ 7.929003239798807, 45.74244267625572 ], [ 7.900164962190673, 45.74924676293584 ], [ 7.863100279395171, 45.790989123359545 ], [ 7.868816135070534, 45.867721946645133 ], [ 7.864048284549527, 45.916439364669955 ], [ 7.876964877160916, 45.926428299417744 ], [ 7.87776449690777, 45.972265006701988 ], [ 7.908819617839213, 45.997316767982973 ], [ 7.988913566381116, 45.996487437847939 ], [ 8.012179386955596, 46.011914941820869 ], [ 8.012766652627016, 46.031968171537486 ], [ 8.034410258786403, 46.045356486285442 ], [ 8.022581113285, 46.068224516494574 ], [ 8.032772853982188, 46.098416876142281 ], [ 8.108052276867831, 46.111593369035766 ], [ 8.114971355812239, 46.13031341577549 ], [ 8.143376358336798, 46.136739899375364 ], [ 8.164551419874467, 46.183291960761146 ], [ 8.153461186860881, 46.191652394028189 ], [ 8.139002741167099, 46.226077367993526 ], [ 8.110140435464347, 46.249301215986634 ], [ 8.081325878330318, 46.258199218318538 ], [ 8.137708932817825, 46.301612827385533 ], [ 8.161355552174117, 46.2962088069064 ], [ 8.211722247776068, 46.309184947745791 ], [ 8.223702324521655, 46.333638386724083 ], [ 8.264730862841919, 46.35149514517299 ], [ 8.263397643340268, 46.363663212670879 ], [ 8.311947536384032, 46.376556280409275 ], [ 8.316902520281253, 46.39724028756909 ], [ 8.300311653964764, 46.419351150651799 ], [ 8.339405150445044, 46.432813131818392 ], [ 8.356177839724218, 46.447461162411962 ], [ 8.445494368747655, 46.463705354009129 ], [ 8.465881587319069, 46.442905352520896 ], [ 8.457665214965788, 46.422356558821242 ], [ 8.468529063232712, 46.411625993946423 ], [ 8.46096824391152, 46.38653553104055 ], [ 8.468552434210409, 46.364872745622819 ], [ 8.464441486676577, 46.332985463551019 ], [ 8.427662002847081, 46.298401028965827 ], [ 8.456246349576583, 46.263513127104964 ], [ 8.46875542432576, 46.233485266385692 ], [ 8.532580816421557, 46.218059143653662 ], [ 8.540685643270923, 46.197671082273963 ], [ 8.569425166982835, 46.177019954009261 ], [ 8.573054981382638, 46.165018534486883 ], [ 8.602911739685858, 46.154200110445913 ], [ 8.594879562429186, 46.14223785407323 ], [ 8.611712590471026, 46.121821092450801 ], [ 8.647690407030458, 46.123166167152256 ], [ 8.658286439473834, 46.112564704178837 ], [ 8.714815174881675, 46.09804279081736 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Valle d'Aosta", "ISO": "IT-23" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 7.864048284549527, 45.916439364669955 ], [ 7.868816135070534, 45.867721946645133 ], [ 7.863100279395171, 45.790989123359545 ], [ 7.900164962190673, 45.74924676293584 ], [ 7.929003239798807, 45.74244267625572 ], [ 7.936624515996284, 45.724342593321118 ], [ 7.905208199525089, 45.681961972446246 ], [ 7.939504004237182, 45.643697391533522 ], [ 7.915904355570726, 45.633087585247772 ], [ 7.896248937227446, 45.599768545372221 ], [ 7.848871322540834, 45.602262239198481 ], [ 7.795674250246953, 45.586385441018443 ], [ 7.785323506423492, 45.574788949351337 ], [ 7.732703534982383, 45.550335202936211 ], [ 7.716345015474464, 45.55895637549127 ], [ 7.676792735028634, 45.552093724962155 ], [ 7.645939996483633, 45.568991839216913 ], [ 7.609065934816604, 45.562876784140776 ], [ 7.599082245809964, 45.578445314603762 ], [ 7.565487319324157, 45.591564461445593 ], [ 7.532669279667474, 45.577171119402522 ], [ 7.499021008394017, 45.583109996106927 ], [ 7.470864867029825, 45.577686920710079 ], [ 7.447963076345624, 45.555567375822363 ], [ 7.422174649234082, 45.54600706667194 ], [ 7.375713968516539, 45.516492736602778 ], [ 7.364023612362701, 45.525053441026714 ], [ 7.322953196485625, 45.514451294711463 ], [ 7.269497278219059, 45.514677044267565 ], [ 7.230384227160346, 45.475462723419447 ], [ 7.157272270847698, 45.486601879706704 ], [ 7.141055509566042, 45.510921157630349 ], [ 7.121665161917869, 45.506238285201867 ], [ 7.104329571840415, 45.466958756615561 ], [ 7.07555334093479, 45.47421841727089 ], [ 7.04788903474158, 45.472479637136537 ], [ 7.055021567244497, 45.493106040478715 ], [ 6.999687712960812, 45.504571682125579 ], [ 6.989627735730454, 45.563109260953482 ], [ 6.977857290746678, 45.588941463605757 ], [ 6.98454643056606, 45.625531823311512 ], [ 6.999981518113932, 45.640600793168979 ], [ 6.960858558624606, 45.655066505025189 ], [ 6.930115767521179, 45.647132609406079 ], [ 6.893524892052889, 45.675959596648752 ], [ 6.869583793313772, 45.680555984401039 ], [ 6.827844997534027, 45.70391910255028 ], [ 6.809186914888365, 45.724759751024763 ], [ 6.801326682921887, 45.781259955436383 ], [ 6.812233694797402, 45.796752745759662 ], [ 6.809387323207018, 45.820775225806678 ], [ 6.818645090953184, 45.836208649091326 ], [ 6.84250487132072, 45.842224310902409 ], [ 6.865877271953953, 45.833842727762274 ], [ 6.895464428468137, 45.842780422328893 ], [ 6.939628645194489, 45.846834893471694 ], [ 6.950740399725474, 45.85883469126307 ], [ 6.999257723546286, 45.874158894834729 ], [ 7.004278906742844, 45.89981749610002 ], [ 7.018406761474257, 45.914698408947729 ], [ 7.045749352912737, 45.922252897743419 ], [ 7.065241203253342, 45.899849249141354 ], [ 7.118271606316963, 45.859539337671599 ], [ 7.154124355202157, 45.87932265742559 ], [ 7.19026131255262, 45.858596417707183 ], [ 7.216412732881811, 45.888754730519238 ], [ 7.259707342625866, 45.890367564487796 ], [ 7.290710292935383, 45.920456471545393 ], [ 7.329669990072669, 45.910556112143105 ], [ 7.343855238687847, 45.915253909210492 ], [ 7.381796716109362, 45.896905490963356 ], [ 7.431670538191572, 45.918419271142731 ], [ 7.444278391774223, 45.931480369395999 ], [ 7.474708055101137, 45.936120895151618 ], [ 7.478126222470627, 45.952628323414523 ], [ 7.502336178205274, 45.96066162002645 ], [ 7.538129001053798, 45.95503189218978 ], [ 7.550348973662794, 45.986203028921629 ], [ 7.578094128784747, 45.98625465792729 ], [ 7.584121495296412, 45.972162866088766 ], [ 7.639219507632195, 45.970321210054472 ], [ 7.657886502956366, 45.976626281659456 ], [ 7.680118681346386, 45.958038397887428 ], [ 7.709992825584522, 45.947489053735993 ], [ 7.707657640236871, 45.934160021054417 ], [ 7.734554907653767, 45.923651525293671 ], [ 7.747306141704758, 45.937760733892489 ], [ 7.76861851258554, 45.93711037102171 ], [ 7.801154318822281, 45.917250341890579 ], [ 7.819574998639345, 45.926685607478362 ], [ 7.864048284549527, 45.916439364669955 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Lombardia", "ISO": "IT-25" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 10.453137486280417, 46.530551006376491 ], [ 10.457940426074908, 46.510589612535959 ], [ 10.484530696550369, 46.493600815227822 ], [ 10.551960791889435, 46.491456659887895 ], [ 10.5770823544136, 46.473365119864184 ], [ 10.600492368602493, 46.468664278553447 ], [ 10.62183698232052, 46.447960643498341 ], [ 10.619058845987286, 46.418139569286161 ], [ 10.630461791644922, 46.402550825532771 ], [ 10.607379470468391, 46.379297361818317 ], [ 10.56669012988675, 46.377771946644636 ], [ 10.537700756973118, 46.354125478149989 ], [ 10.515934154219075, 46.346362635835334 ], [ 10.565620658695345, 46.326343362838116 ], [ 10.579572506115124, 46.298828440309336 ], [ 10.5756661740896, 46.275682356355205 ], [ 10.585730953341056, 46.245339104589632 ], [ 10.541399639511907, 46.188619472517068 ], [ 10.565243127153281, 46.167064260281073 ], [ 10.549269646520719, 46.146427420419862 ], [ 10.541578022803836, 46.103269276899439 ], [ 10.517182333882371, 46.080078850290789 ], [ 10.490919693294744, 46.066808681959714 ], [ 10.481369928636584, 46.049909693390049 ], [ 10.486224613266241, 46.029550942041716 ], [ 10.457093819272199, 46.008047883122501 ], [ 10.45340790318558, 45.976552541292826 ], [ 10.486604675164379, 45.97115833691754 ], [ 10.483026188136582, 45.951928010356426 ], [ 10.50736171353573, 45.924972901856911 ], [ 10.507690115721706, 45.905344248374675 ], [ 10.490990555237122, 45.882317512761368 ], [ 10.502311221986171, 45.871261904682299 ], [ 10.508197559112407, 45.823737571314034 ], [ 10.543266710425025, 45.818364034178273 ], [ 10.53088115094733, 45.795861647361939 ], [ 10.563473316357877, 45.784112642397865 ], [ 10.600486986389416, 45.802819453164318 ], [ 10.645327553740028, 45.804127150933425 ], [ 10.654640146273255, 45.832627615335021 ], [ 10.675723848826138, 45.8304607026962 ], [ 10.701843840259544, 45.841035047335652 ], [ 10.751296018256296, 45.836564234095796 ], [ 10.77694329212455, 45.843111729252207 ], [ 10.791684910073323, 45.833098943008885 ], [ 10.840150465662774, 45.832755997726998 ], [ 10.771985692206837, 45.750779332840239 ], [ 10.702006906309597, 45.672735282586068 ], [ 10.631043056919495, 45.609508661923044 ], [ 10.628467648905106, 45.602056603117113 ], [ 10.643011353579887, 45.457311194063664 ], [ 10.665232922753923, 45.427716386094765 ], [ 10.712515372218581, 45.41855005434428 ], [ 10.716841862234498, 45.395567861088324 ], [ 10.685544251498941, 45.353684468269194 ], [ 10.686763001537594, 45.342174748815239 ], [ 10.714970718949052, 45.334076403624806 ], [ 10.730482235632913, 45.3158576029101 ], [ 10.737415803955814, 45.287244810284214 ], [ 10.782815233962854, 45.31542152102169 ], [ 10.816490846451321, 45.294083948827875 ], [ 10.846608062258477, 45.256568806670998 ], [ 10.899661781178617, 45.246921933929329 ], [ 10.936790164805236, 45.232938371884963 ], [ 10.930730099512154, 45.21800994911392 ], [ 10.946957398972511, 45.205736791508841 ], [ 10.990386615931225, 45.196110850918217 ], [ 10.998122243048241, 45.185056797558403 ], [ 10.994517318948212, 45.150355586098982 ], [ 11.028365453922307, 45.159237928360341 ], [ 11.043847620237013, 45.134279276634871 ], [ 11.028696816153289, 45.123045378715808 ], [ 11.072942481278847, 45.098748587337752 ], [ 11.105400623323501, 45.109054134685124 ], [ 11.127404576990585, 45.103227162611951 ], [ 11.138738154354986, 45.123863309587939 ], [ 11.18922532548914, 45.109772763105561 ], [ 11.187325751331203, 45.082511461091812 ], [ 11.174294908174176, 45.061561284975092 ], [ 11.201449215265384, 45.060203664620765 ], [ 11.238533460327497, 45.043207215133144 ], [ 11.256959287226669, 45.053907575806086 ], [ 11.275497053591401, 45.01731177473939 ], [ 11.313215727492507, 45.009730221335523 ], [ 11.338246004621542, 44.9894206325339 ], [ 11.424416955925867, 44.961895424017229 ], [ 11.426742032083617, 44.950083525538552 ], [ 11.378192691041217, 44.957925883674584 ], [ 11.357155462134562, 44.950080514966444 ], [ 11.329319188598506, 44.960698110358308 ], [ 11.301583514420189, 44.962358973165543 ], [ 11.26669316699075, 44.943990176740606 ], [ 11.241432752864233, 44.945916750304725 ], [ 11.148671422513441, 44.934233644327719 ], [ 11.124333257199879, 44.95136975990409 ], [ 11.073025379974478, 44.962610660532178 ], [ 11.059570643380418, 44.949248237484305 ], [ 10.994007523592993, 44.953860149161983 ], [ 10.941373456294496, 44.921913848977091 ], [ 10.876633012271745, 44.917058763642466 ], [ 10.819754130672523, 44.936723468558121 ], [ 10.743719814603844, 44.949076854017548 ], [ 10.738673161525933, 44.985742167670317 ], [ 10.6866799950343, 44.986592637925163 ], [ 10.663882897431137, 44.968587306232052 ], [ 10.630511006619228, 44.928924081076325 ], [ 10.598825423724444, 44.91474458489116 ], [ 10.56606698410156, 44.908465116300668 ], [ 10.519853032428268, 44.912726452848148 ], [ 10.504315232298701, 44.922427602652341 ], [ 10.431837991925526, 44.9470727902523 ], [ 10.416767804868922, 44.9776500124309 ], [ 10.383365843522611, 44.979109051357895 ], [ 10.365288026395547, 44.966102859451155 ], [ 10.308900794774491, 44.987377481089773 ], [ 10.304687589325436, 44.999038101152983 ], [ 10.274466594177545, 44.997930114237128 ], [ 10.260030522103106, 45.014230632908664 ], [ 10.211067558052486, 45.034031827374484 ], [ 10.193959028655518, 45.028155279573078 ], [ 10.157721357914674, 45.044079043589697 ], [ 10.106190811475322, 45.022130358597117 ], [ 10.057349645498142, 45.041447329686036 ], [ 10.0435097235061, 45.063079876059597 ], [ 10.02131684360069, 45.077179225939766 ], [ 10.029232475063258, 45.094895560331175 ], [ 9.992727070401752, 45.129758215367517 ], [ 9.978336355512388, 45.133735119270568 ], [ 9.936468007782542, 45.104821692521114 ], [ 9.915507360803078, 45.138990963633191 ], [ 9.881033418501282, 45.127001883271589 ], [ 9.879389107296902, 45.111846736280178 ], [ 9.900628060643536, 45.095442144192369 ], [ 9.88284346447543, 45.07450797650943 ], [ 9.863435093676989, 45.092470790453007 ], [ 9.844004570527707, 45.096810852713389 ], [ 9.83550722304215, 45.071884539731592 ], [ 9.778962207252645, 45.089584063765884 ], [ 9.753101094412109, 45.086599438751541 ], [ 9.730062461424572, 45.063578562821966 ], [ 9.712537614644791, 45.0587652847017 ], [ 9.659538767806902, 45.082092135323819 ], [ 9.631419791538958, 45.087796124686491 ], [ 9.638307226000176, 45.124304710787669 ], [ 9.618412910683592, 45.133019757928849 ], [ 9.601881983534748, 45.104140694527516 ], [ 9.537442638959911, 45.114877071858814 ], [ 9.550611373015634, 45.095231153104677 ], [ 9.532026203856985, 45.078432026699588 ], [ 9.501469257408381, 45.103568055174939 ], [ 9.439006409963381, 45.093446269262977 ], [ 9.370819944710394, 45.048153672491217 ], [ 9.376196795230499, 45.041667331359051 ], [ 9.36620436884829, 45.003608589142502 ], [ 9.347463128731336, 44.997410855194246 ], [ 9.314532002976938, 44.936819921584991 ], [ 9.287612456242892, 44.934235310270182 ], [ 9.290113399812011, 44.882206412908275 ], [ 9.341675182676603, 44.869811990008031 ], [ 9.358424690507526, 44.814946812774394 ], [ 9.329870700878169, 44.799990264651051 ], [ 9.316759748943644, 44.783949464687609 ], [ 9.28697494270069, 44.772496369004877 ], [ 9.28589944581023, 44.759427838170708 ], [ 9.332580793519327, 44.735040353474609 ], [ 9.308480647426125, 44.705634462073775 ], [ 9.324637473044445, 44.690015632043192 ], [ 9.298505879631204, 44.681021554408332 ], [ 9.257588757117496, 44.681220195290933 ], [ 9.240482795971243, 44.688306337484079 ], [ 9.20031986650889, 44.686404806099667 ], [ 9.20283026703275, 44.72205710765688 ], [ 9.213550435359078, 44.752348219624373 ], [ 9.171725568500902, 44.771683552512471 ], [ 9.173504927518719, 44.796148854153024 ], [ 9.155119546657721, 44.809408488129399 ], [ 9.108992328237115, 44.80543785312711 ], [ 9.081615817515431, 44.81446287144356 ], [ 9.051379379077911, 44.845924900329351 ], [ 9.070108666833333, 44.866025741296575 ], [ 9.055710650732996, 44.889051788594678 ], [ 9.030363538382424, 44.888499204898523 ], [ 9.008047616978732, 44.902982206252304 ], [ 8.988206286266058, 44.930852047307923 ], [ 8.969596754325078, 44.943513664948043 ], [ 8.978124116162544, 44.96720639657908 ], [ 8.948592285341832, 44.988471402903564 ], [ 8.92498293889208, 44.98339026392734 ], [ 8.901273696575366, 45.007762784387303 ], [ 8.898066853153219, 45.050658118098262 ], [ 8.881058583395392, 45.054080341583258 ], [ 8.823892219987417, 45.04658902639779 ], [ 8.802312636785397, 45.026074628628663 ], [ 8.75096015203165, 45.020384055316526 ], [ 8.671159891654959, 45.027174314391246 ], [ 8.634737779035316, 45.040962422644348 ], [ 8.646950960782187, 45.055540965692479 ], [ 8.635487215942755, 45.089036457490536 ], [ 8.608474967104097, 45.10834571605433 ], [ 8.610978613935336, 45.123630110551638 ], [ 8.588272927391358, 45.135687919716126 ], [ 8.580001304300779, 45.152699208855978 ], [ 8.552512637228491, 45.160115666304094 ], [ 8.543949901535527, 45.181289529736389 ], [ 8.556876204319108, 45.205174288687068 ], [ 8.525670255888459, 45.219291610951387 ], [ 8.548040690490801, 45.237925410148698 ], [ 8.530940559593054, 45.268162132148653 ], [ 8.498337449907515, 45.292226427781266 ], [ 8.507710448765685, 45.307751565921187 ], [ 8.538366851396061, 45.319354089703189 ], [ 8.526375783366499, 45.342199974686004 ], [ 8.550375560328902, 45.354804219183826 ], [ 8.57881241734154, 45.347234506016505 ], [ 8.611778288009791, 45.354426176833201 ], [ 8.655710324668691, 45.325680474023962 ], [ 8.666586878749541, 45.292206631564504 ], [ 8.716121244207653, 45.302881122157743 ], [ 8.726539794810881, 45.332890066588128 ], [ 8.746697388767794, 45.356290458692733 ], [ 8.748289688853285, 45.37437755550819 ], [ 8.765430269810571, 45.388937745921652 ], [ 8.793381044089305, 45.378959659211212 ], [ 8.842896248692092, 45.393838041390069 ], [ 8.810067916568718, 45.445977423625223 ], [ 8.789348168175083, 45.461981956635682 ], [ 8.790803153924333, 45.478742071744755 ], [ 8.760351535295721, 45.496846429706295 ], [ 8.727892399133076, 45.502399393701012 ], [ 8.713196449584625, 45.519932090625453 ], [ 8.703148019933277, 45.600057010319233 ], [ 8.665198890688039, 45.631545228821317 ], [ 8.688553806896952, 45.639874069408847 ], [ 8.663680494156496, 45.674546720559881 ], [ 8.640799341547064, 45.676808279132736 ], [ 8.654357860758891, 45.707882509292425 ], [ 8.645960658884343, 45.721760671151984 ], [ 8.593750066231086, 45.730411491946249 ], [ 8.555665076912646, 45.774990328805643 ], [ 8.563511048799057, 45.807244946742649 ], [ 8.581647069925868, 45.813658208247368 ], [ 8.595200847790371, 45.83361402360179 ], [ 8.59231149983346, 45.852446370533762 ], [ 8.569446777720254, 45.89412925833448 ], [ 8.587887044177481, 45.916927845249063 ], [ 8.682299171094328, 45.986887611440487 ], [ 8.719322009721374, 46.011145796848069 ], [ 8.72876349224258, 46.029232087331479 ], [ 8.705672484500239, 46.081394093847756 ], [ 8.714815174881675, 46.09804279081736 ], [ 8.742687498164713, 46.122145971221016 ], [ 8.75678030339164, 46.10376260458537 ], [ 8.783424607493638, 46.09394306503885 ], [ 8.815292700283887, 46.097257056560274 ], [ 8.852050539206351, 46.075521195677062 ], [ 8.854517049155156, 46.061628082020619 ], [ 8.827975316093498, 46.033317081490409 ], [ 8.792063805963835, 46.004983092810662 ], [ 8.795635379696927, 45.99204713430963 ], [ 8.831275503648497, 45.987983170424876 ], [ 8.868233490295093, 45.960387270298384 ], [ 8.894274628167889, 45.958465751355156 ], [ 8.894005081203279, 45.929988336141385 ], [ 8.924614438967307, 45.905851032333345 ], [ 8.934301677606481, 45.862060771077012 ], [ 8.949537469933587, 45.843477958941989 ], [ 8.99328220193666, 45.822634640562974 ], [ 9.030634394731111, 45.820785628241694 ], [ 9.054006893561279, 45.872898973712473 ], [ 9.07779410719257, 45.885593936537433 ], [ 9.076324450409576, 45.911439676950948 ], [ 9.041898003210347, 45.927149686376893 ], [ 9.019395194076884, 45.928577795302388 ], [ 9.014063885666987, 45.960156367397587 ], [ 8.988409471494432, 45.972608602526073 ], [ 9.022644523876545, 45.992673128647809 ], [ 9.022462901579489, 46.016469870026071 ], [ 9.009097503113667, 46.027173018259923 ], [ 9.016289825911485, 46.048925752817162 ], [ 9.049376158490421, 46.062407523275127 ], [ 9.073369350682672, 46.06261964455139 ], [ 9.089211215121402, 46.09007235744582 ], [ 9.071634933247356, 46.11951509957693 ], [ 9.120802181968019, 46.13461184638453 ], [ 9.16037280203693, 46.170851336840322 ], [ 9.19296933801483, 46.179233972084759 ], [ 9.200326448944121, 46.207193239226697 ], [ 9.221300739791337, 46.229870404727528 ], [ 9.246130131161591, 46.23224962618098 ], [ 9.251640605921533, 46.265487721135763 ], [ 9.300050105433163, 46.326587678708435 ], [ 9.295739227451453, 46.355681588912837 ], [ 9.281473301775467, 46.358876484005684 ], [ 9.275710902626802, 46.394740794806808 ], [ 9.280637478609261, 46.412359119038804 ], [ 9.249473866110254, 46.431159545203855 ], [ 9.246549513988498, 46.446433689318091 ], [ 9.271688111592715, 46.454521355677961 ], [ 9.281928889045414, 46.496420894144819 ], [ 9.309582544936559, 46.504471439153654 ], [ 9.364683797619366, 46.507728837934899 ], [ 9.389428242546398, 46.473260116263305 ], [ 9.412823700810831, 46.466914373570276 ], [ 9.424811093596384, 46.489517814732281 ], [ 9.449387895657791, 46.499719339706488 ], [ 9.459259917791815, 46.484925421565549 ], [ 9.453925346217828, 46.418403817219314 ], [ 9.468748677636757, 46.388694646866668 ], [ 9.464232545777858, 46.374232575041141 ], [ 9.493650036179691, 46.36535264125002 ], [ 9.51390076702155, 46.333237835509557 ], [ 9.53712974927576, 46.309650641225538 ], [ 9.582895853937289, 46.294477762998177 ], [ 9.635082453781282, 46.286216945045936 ], [ 9.674341223860116, 46.302754342060652 ], [ 9.714497746252984, 46.293069616507537 ], [ 9.725924590505992, 46.313701748599506 ], [ 9.723021760371559, 46.340445028575701 ], [ 9.743631538156698, 46.351517555801763 ], [ 9.777477412757241, 46.334962345720633 ], [ 9.850439147418037, 46.364641685614842 ], [ 9.869618332319533, 46.362485984280688 ], [ 9.906360621196155, 46.380884117000875 ], [ 9.924533285337995, 46.366123039004194 ], [ 9.952661972726514, 46.37946825643656 ], [ 9.964490577620275, 46.363412529427016 ], [ 9.996352302176094, 46.350935638872308 ], [ 9.981430656140477, 46.322683801712088 ], [ 9.99468004131108, 46.314046462577622 ], [ 9.998270548618676, 46.282929615326545 ], [ 10.030107476727441, 46.277121259668817 ], [ 10.055456296912093, 46.262922161695805 ], [ 10.047772571399415, 46.232168016850707 ], [ 10.070837217564151, 46.217140300377849 ], [ 10.094518258064804, 46.228553009589291 ], [ 10.123287577428995, 46.223773924012932 ], [ 10.145676243466818, 46.230382713290446 ], [ 10.17453054294748, 46.254668831380812 ], [ 10.155928277262275, 46.290597141821074 ], [ 10.116406438072646, 46.314740603350636 ], [ 10.10431590158213, 46.33354168359989 ], [ 10.107768507935175, 46.351381923609011 ], [ 10.128639546601239, 46.360861592199136 ], [ 10.127721873646669, 46.377619224730452 ], [ 10.163941027522622, 46.390895394832576 ], [ 10.160591850595154, 46.415813697559763 ], [ 10.128943463233981, 46.431893508025908 ], [ 10.101254190875753, 46.422331348676046 ], [ 10.062013478672799, 46.427202369434845 ], [ 10.039811092559413, 46.445702727053728 ], [ 10.052817417484055, 46.46127908467983 ], [ 10.04304482462593, 46.479412857764594 ], [ 10.053098023758078, 46.53146417705166 ], [ 10.044730882822483, 46.53645913327361 ], [ 10.101094870693583, 46.582777220902472 ], [ 10.101666701756598, 46.610111986503838 ], [ 10.130171656553753, 46.605599696544608 ], [ 10.190628325313037, 46.62608553110357 ], [ 10.211533722261033, 46.617825068213747 ], [ 10.239062677816213, 46.635187015145299 ], [ 10.257877512557927, 46.610894754420372 ], [ 10.244002741757665, 46.578400947821841 ], [ 10.283535246529629, 46.571223555814406 ], [ 10.295748754446249, 46.550400448464785 ], [ 10.337062487834965, 46.543431763322381 ], [ 10.363373882134008, 46.555567513378435 ], [ 10.397555441507793, 46.543941509765332 ], [ 10.419340040355499, 46.551052878254879 ], [ 10.453137486280417, 46.530551006376491 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Trentino-Alto Adige", "ISO": "IT-32" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 12.477594353987696, 46.679821263820415 ], [ 12.434241768382297, 46.668280548276847 ], [ 12.40574775752375, 46.643199132043549 ], [ 12.379773560307624, 46.642907395660067 ], [ 12.385163313207311, 46.622781708630662 ], [ 12.360103329521952, 46.619484689912667 ], [ 12.339704826308852, 46.631377894466908 ], [ 12.283836514981516, 46.617926058700036 ], [ 12.261219936117886, 46.629124883929407 ], [ 12.241838869164997, 46.616319015468221 ], [ 12.194459958824906, 46.604908993707497 ], [ 12.17132832777285, 46.634101428883532 ], [ 12.14512592229409, 46.634070197920217 ], [ 12.106037543526625, 46.658925365075284 ], [ 12.06826965936267, 46.675071285755863 ], [ 12.064790096139555, 46.62320174368201 ], [ 12.045450211447861, 46.607950647789593 ], [ 12.049772255788398, 46.593759353607624 ], [ 11.998418896176526, 46.532855717993563 ], [ 11.966147470771402, 46.544677921566731 ], [ 11.93388524405429, 46.527897553245836 ], [ 11.911883948346714, 46.532960254465912 ], [ 11.851350817996213, 46.517836393747451 ], [ 11.815453512431437, 46.500317507540231 ], [ 11.81315754008342, 46.478140392353112 ], [ 11.874215856205984, 46.47287531740534 ], [ 11.888793266283193, 46.441995973635798 ], [ 11.850518726101749, 46.434309295439363 ], [ 11.832040043421976, 46.387187001015675 ], [ 11.804010741008502, 46.364979853511628 ], [ 11.774378553466406, 46.358241658147129 ], [ 11.831850611592179, 46.325146525942117 ], [ 11.836767942022291, 46.302667840555699 ], [ 11.826260827389966, 46.28497039753362 ], [ 11.83763758508778, 46.270722310987217 ], [ 11.885247948001281, 46.278808757500386 ], [ 11.886261583179003, 46.25819042121941 ], [ 11.924814917214018, 46.24295248185642 ], [ 11.919401196854444, 46.220828193682514 ], [ 11.939554654903995, 46.198773376055563 ], [ 11.962269324687739, 46.187859812157001 ], [ 11.928626243220465, 46.175801189354324 ], [ 11.921767061193089, 46.149340983052618 ], [ 11.893414937041362, 46.121146904608878 ], [ 11.819681895478151, 46.107963079255946 ], [ 11.813669793680626, 46.102265664206392 ], [ 11.716789161492585, 46.102936683256239 ], [ 11.682346410473615, 46.089987027619472 ], [ 11.686389386142302, 46.066258871879377 ], [ 11.706441012288908, 46.045993265895838 ], [ 11.666902007585069, 46.038061962892805 ], [ 11.666650287801597, 46.017098891176069 ], [ 11.690004516380618, 45.988807204602971 ], [ 11.673230085830337, 45.96435139784159 ], [ 11.587592031352596, 45.968997079148025 ], [ 11.577230068511547, 46.006520286308763 ], [ 11.538910644294184, 46.013303872095001 ], [ 11.491200756328805, 46.008549616860321 ], [ 11.446781740879834, 45.980893452051546 ], [ 11.400149737755815, 45.980101820348132 ], [ 11.372396425666413, 45.973169322543271 ], [ 11.380749169633175, 45.942673602852942 ], [ 11.358056948042769, 45.925294623631288 ], [ 11.324349210629329, 45.917415884948554 ], [ 11.261236326732414, 45.918248225665415 ], [ 11.239323863122346, 45.855981907902638 ], [ 11.218453825517342, 45.843961758490614 ], [ 11.188499049848369, 45.811862931731994 ], [ 11.19351040695461, 45.793851439526684 ], [ 11.173567324026381, 45.786520949705313 ], [ 11.18065594286405, 45.762907469824022 ], [ 11.174652158321308, 45.733106869646967 ], [ 11.138661966205575, 45.709315634596486 ], [ 11.138509794435102, 45.696848300040045 ], [ 11.092399049248421, 45.695151100203852 ], [ 11.05772665332614, 45.71759893734226 ], [ 11.04137698011948, 45.706319095878065 ], [ 11.007558013760217, 45.710422202607127 ], [ 10.968319505533913, 45.680121097270728 ], [ 10.937459644557659, 45.673415698080639 ], [ 10.91199760492265, 45.688314669818133 ], [ 10.918781936923571, 45.700553584667162 ], [ 10.889578631809837, 45.71507464915414 ], [ 10.843832376572811, 45.718592819105673 ], [ 10.865244391890631, 45.761301294964355 ], [ 10.884776880540127, 45.778237603717777 ], [ 10.872797363143709, 45.788561840771635 ], [ 10.88340432129991, 45.816971555951397 ], [ 10.840150465662774, 45.832755997726998 ], [ 10.791684910073323, 45.833098943008885 ], [ 10.77694329212455, 45.843111729252207 ], [ 10.751296018256296, 45.836564234095796 ], [ 10.701843840259544, 45.841035047335652 ], [ 10.675723848826138, 45.8304607026962 ], [ 10.654640146273255, 45.832627615335021 ], [ 10.645327553740028, 45.804127150933425 ], [ 10.600486986389416, 45.802819453164318 ], [ 10.563473316357877, 45.784112642397865 ], [ 10.53088115094733, 45.795861647361939 ], [ 10.543266710425025, 45.818364034178273 ], [ 10.508197559112407, 45.823737571314034 ], [ 10.502311221986171, 45.871261904682299 ], [ 10.490990555237122, 45.882317512761368 ], [ 10.507690115721706, 45.905344248374675 ], [ 10.50736171353573, 45.924972901856911 ], [ 10.483026188136582, 45.951928010356426 ], [ 10.486604675164379, 45.97115833691754 ], [ 10.45340790318558, 45.976552541292826 ], [ 10.457093819272199, 46.008047883122501 ], [ 10.486224613266241, 46.029550942041716 ], [ 10.481369928636584, 46.049909693390049 ], [ 10.490919693294744, 46.066808681959714 ], [ 10.517182333882371, 46.080078850290789 ], [ 10.541578022803836, 46.103269276899439 ], [ 10.549269646520719, 46.146427420419862 ], [ 10.565243127153281, 46.167064260281073 ], [ 10.541399639511907, 46.188619472517068 ], [ 10.585730953341056, 46.245339104589632 ], [ 10.5756661740896, 46.275682356355205 ], [ 10.579572506115124, 46.298828440309336 ], [ 10.565620658695345, 46.326343362838116 ], [ 10.515934154219075, 46.346362635835334 ], [ 10.537700756973118, 46.354125478149989 ], [ 10.56669012988675, 46.377771946644636 ], [ 10.607379470468391, 46.379297361818317 ], [ 10.630461791644922, 46.402550825532771 ], [ 10.619058845987286, 46.418139569286161 ], [ 10.62183698232052, 46.447960643498341 ], [ 10.600492368602493, 46.468664278553447 ], [ 10.5770823544136, 46.473365119864184 ], [ 10.551960791889435, 46.491456659887895 ], [ 10.484530696550369, 46.493600815227822 ], [ 10.457940426074908, 46.510589612535959 ], [ 10.453137486280417, 46.530551006376491 ], [ 10.47257269863271, 46.543555354691392 ], [ 10.489164242888078, 46.615017689434161 ], [ 10.445953812902333, 46.641103666412405 ], [ 10.410754576344383, 46.635140057065577 ], [ 10.394139163610172, 46.654751107944264 ], [ 10.3874179941125, 46.687280241977447 ], [ 10.418273791549, 46.717810260842214 ], [ 10.401046661138766, 46.732088496098065 ], [ 10.434777865484039, 46.752188941444032 ], [ 10.440535083613451, 46.773750917580323 ], [ 10.424673271166068, 46.788789302240758 ], [ 10.448274566047058, 46.801370954975766 ], [ 10.457628887398128, 46.828852809081788 ], [ 10.480096678376221, 46.858711710237344 ], [ 10.49894207641335, 46.847505431832872 ], [ 10.550722648396803, 46.849897724323661 ], [ 10.57050648192663, 46.842446563092508 ], [ 10.596427047940534, 46.857296569998454 ], [ 10.671446110003954, 46.870696202205927 ], [ 10.723320563737353, 46.837385538507348 ], [ 10.763203143203853, 46.823486004225018 ], [ 10.73049412975501, 46.787907096607732 ], [ 10.756022970634271, 46.785146809063477 ], [ 10.788784393840276, 46.794700579379253 ], [ 10.813742096663844, 46.775543982490305 ], [ 10.836786464101106, 46.781939377908756 ], [ 10.882208080088313, 46.763193329936129 ], [ 10.914950418229758, 46.773755244806267 ], [ 10.94397290620674, 46.775137657474076 ], [ 11.021671831787359, 46.765911960230248 ], [ 11.039798522774962, 46.805084235259287 ], [ 11.08353835027779, 46.822866323440124 ], [ 11.071439677737036, 46.851798538029662 ], [ 11.101546106138906, 46.889859710163215 ], [ 11.094982288256752, 46.907480735653152 ], [ 11.115012732548061, 46.931005378346214 ], [ 11.139551429332077, 46.927628964493096 ], [ 11.188908731929837, 46.970157508311438 ], [ 11.241393713200225, 46.969618595193012 ], [ 11.262770713265743, 46.980339022793999 ], [ 11.35828650177176, 46.990361692319375 ], [ 11.400908519190615, 46.965244764173036 ], [ 11.44209068065523, 46.976499944643862 ], [ 11.479858518248923, 47.010996642746363 ], [ 11.512598761831118, 47.004666919187805 ], [ 11.538076938508821, 46.984108086544133 ], [ 11.580790890106861, 47.001488974872238 ], [ 11.627210453739464, 47.012577350938948 ], [ 11.664104053923309, 46.992627610513104 ], [ 11.711231915465195, 46.993023559218408 ], [ 11.727242365851717, 46.972938716252997 ], [ 11.747168164872111, 46.968902722792613 ], [ 11.78178266658257, 46.992059053905692 ], [ 11.836210497951651, 46.992896204961966 ], [ 11.86055426891121, 47.008417316145412 ], [ 11.915327526073638, 47.032548487723787 ], [ 11.968401567134622, 47.040606418356745 ], [ 11.979903674415667, 47.049882954949666 ], [ 12.020061028533313, 47.046760178266005 ], [ 12.035318118731553, 47.057916397724881 ], [ 12.0700459954537, 47.059928232429037 ], [ 12.092982732979195, 47.076283716845708 ], [ 12.121547556459328, 47.07459904340007 ], [ 12.186680722821988, 47.091783746462163 ], [ 12.225591385120209, 47.082706242418112 ], [ 12.240192643587909, 47.067939196581435 ], [ 12.216738668262758, 47.058503403637125 ], [ 12.204790459886221, 47.027888815689195 ], [ 12.148150696767896, 47.024367654475085 ], [ 12.120988263371178, 47.006653577586583 ], [ 12.136698765529035, 46.983004686119941 ], [ 12.131524775170522, 46.964116548417287 ], [ 12.168205333581767, 46.937889135890799 ], [ 12.158905935417868, 46.909441538495912 ], [ 12.190163939062986, 46.906233948867204 ], [ 12.215033121002342, 46.874191038754368 ], [ 12.236201428650046, 46.888515731726763 ], [ 12.266493435174448, 46.887141483897416 ], [ 12.3061764362029, 46.833940906975641 ], [ 12.282430622956195, 46.814991651332349 ], [ 12.308663366714429, 46.784818999171137 ], [ 12.351169807524649, 46.777069359197128 ], [ 12.377918330627839, 46.721930524882104 ], [ 12.442903554077526, 46.688126391314299 ], [ 12.477594353987696, 46.679821263820415 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Veneto", "ISO": "IT-34" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 12.731981346929517, 46.633812917020975 ], [ 12.704720976229961, 46.618395649042476 ], [ 12.656792202741341, 46.572548390270775 ], [ 12.643940103489632, 46.576050673904099 ], [ 12.619164000901229, 46.54003574363432 ], [ 12.630021099358675, 46.500706650862952 ], [ 12.654062693711976, 46.484387004388218 ], [ 12.606068810736311, 46.46412668753316 ], [ 12.569953967915158, 46.475485617219491 ], [ 12.505862751259476, 46.440960490447459 ], [ 12.495264127430424, 46.412015894739106 ], [ 12.460518570722595, 46.380424738784768 ], [ 12.462942620928919, 46.369262691123176 ], [ 12.428666028515835, 46.351595883347713 ], [ 12.411457007551078, 46.330832012826249 ], [ 12.379068429405287, 46.331765614241071 ], [ 12.354654621268041, 46.319682129508053 ], [ 12.350831858178859, 46.293839191731635 ], [ 12.329143279762611, 46.28212268940716 ], [ 12.321218957014205, 46.264462489124661 ], [ 12.337709119674917, 46.239469040694146 ], [ 12.376419789080604, 46.222941372544227 ], [ 12.401680924864214, 46.228997067632491 ], [ 12.407258988015641, 46.20702410437184 ], [ 12.430593246531046, 46.209434984281849 ], [ 12.456918901584235, 46.170649269606074 ], [ 12.491512301471893, 46.15689665632506 ], [ 12.498785893497102, 46.137002936592083 ], [ 12.484425216221593, 46.104472459913453 ], [ 12.427844796541025, 46.076320872241908 ], [ 12.405080946521153, 46.042738797214213 ], [ 12.428183916001387, 45.995763442032363 ], [ 12.422292547674648, 45.956162876192423 ], [ 12.453498473269844, 45.947338440652871 ], [ 12.463104732122902, 45.934519941144409 ], [ 12.500833930340061, 45.92520959783154 ], [ 12.558984977651161, 45.847064698896894 ], [ 12.559299514513793, 45.825924963706363 ], [ 12.597392331352548, 45.822141613324327 ], [ 12.632159593655436, 45.829259280678841 ], [ 12.6502842175107, 45.80366692779895 ], [ 12.678930064903973, 45.794695433935537 ], [ 12.729994678142107, 45.837277947244054 ], [ 12.7428643273857, 45.826619806734584 ], [ 12.775032524710353, 45.853099181988554 ], [ 12.804297392582283, 45.84462434008941 ], [ 12.874983452853575, 45.850344635505188 ], [ 12.869670839862275, 45.833757538900443 ], [ 12.890058566370064, 45.820474414610935 ], [ 12.952065058743775, 45.822206125128666 ], [ 12.974233159067852, 45.807594093245008 ], [ 12.98467844226532, 45.781401861265294 ], [ 13.007591397652526, 45.765629920803661 ], [ 13.001293763229432, 45.750017825919919 ], [ 13.03016183824842, 45.725265881098395 ], [ 13.044369758996009, 45.684310500663592 ], [ 13.101006696653197, 45.643537301216966 ], [ 13.063390589292295, 45.63096313599889 ], [ 12.978115091194276, 45.626475782692303 ], [ 12.917840903408994, 45.612634236403345 ], [ 12.715455759289888, 45.524405861655872 ], [ 12.650171669838459, 45.505452602194808 ], [ 12.584296373343642, 45.479612415770504 ], [ 12.480266037536193, 45.449391090381987 ], [ 12.452796456189196, 45.438663469708992 ], [ 12.426900474479593, 45.417969132915744 ], [ 12.39957028868327, 45.429795526877143 ], [ 12.360135237015312, 45.396087803066187 ], [ 12.330680730020926, 45.353546431967644 ], [ 12.328953986158091, 45.337529142420451 ], [ 12.306011509909748, 45.287846353066129 ], [ 12.295898558485664, 45.244463373020679 ], [ 12.30625325909608, 45.194384794946828 ], [ 12.330904503694141, 45.163707930073755 ], [ 12.327262213667385, 45.122644958304853 ], [ 12.337233926183172, 45.089522101291998 ], [ 12.393531755506727, 45.045503079398536 ], [ 12.444145243464877, 45.013209173126583 ], [ 12.485137429725333, 44.992954419077201 ], [ 12.510904944009836, 44.991382762013103 ], [ 12.553936465624114, 44.965983569142878 ], [ 12.51560589061717, 44.934472601593868 ], [ 12.465007790125687, 44.84373283740662 ], [ 12.429039622497266, 44.830929676894186 ], [ 12.421587502422597, 44.812285399857451 ], [ 12.396763299630519, 44.790683970678295 ], [ 12.353281638907733, 44.817027717038023 ], [ 12.336318417129377, 44.852236883893454 ], [ 12.303835739267303, 44.855387754810387 ], [ 12.286650719688124, 44.870305355244575 ], [ 12.282185363293957, 44.911509869004064 ], [ 12.294747074496529, 44.925370819517163 ], [ 12.280868808441033, 44.941767201366297 ], [ 12.256183144383797, 44.942528489027481 ], [ 12.224971806218676, 44.922980719297946 ], [ 12.194173928031269, 44.92535048898683 ], [ 12.169144604547229, 44.942089931580838 ], [ 12.142424359394441, 44.927903858805074 ], [ 12.116183235544007, 44.957672768984963 ], [ 12.091563584372308, 44.970207037874687 ], [ 12.056888799992176, 44.970601221013226 ], [ 11.962678867873572, 44.986827714374193 ], [ 11.926377187102922, 44.974792814737057 ], [ 11.899559982557815, 44.977804410503595 ], [ 11.838317927322215, 44.972789300742051 ], [ 11.804719119685782, 44.976961254991707 ], [ 11.783826507166234, 44.964186070522324 ], [ 11.747036296701273, 44.958096663787153 ], [ 11.744746369310423, 44.937127796685296 ], [ 11.672844863527706, 44.915165703183959 ], [ 11.624808733599158, 44.889223040537608 ], [ 11.592083579366152, 44.892039155417017 ], [ 11.586428680547797, 44.911339161814546 ], [ 11.534130503841563, 44.936245910947797 ], [ 11.469601804442512, 44.936373070133506 ], [ 11.434076896437318, 44.929395433737284 ], [ 11.426742032083617, 44.950083525538552 ], [ 11.424416955925867, 44.961895424017229 ], [ 11.338246004621542, 44.9894206325339 ], [ 11.313215727492507, 45.009730221335523 ], [ 11.275497053591401, 45.01731177473939 ], [ 11.256959287226669, 45.053907575806086 ], [ 11.238533460327497, 45.043207215133144 ], [ 11.201449215265384, 45.060203664620765 ], [ 11.174294908174176, 45.061561284975092 ], [ 11.187325751331203, 45.082511461091812 ], [ 11.18922532548914, 45.109772763105561 ], [ 11.138738154354986, 45.123863309587939 ], [ 11.127404576990585, 45.103227162611951 ], [ 11.105400623323501, 45.109054134685124 ], [ 11.072942481278847, 45.098748587337752 ], [ 11.028696816153289, 45.123045378715808 ], [ 11.043847620237013, 45.134279276634871 ], [ 11.028365453922307, 45.159237928360341 ], [ 10.994517318948212, 45.150355586098982 ], [ 10.998122243048241, 45.185056797558403 ], [ 10.990386615931225, 45.196110850918217 ], [ 10.946957398972511, 45.205736791508841 ], [ 10.930730099512154, 45.21800994911392 ], [ 10.936790164805236, 45.232938371884963 ], [ 10.899661781178617, 45.246921933929329 ], [ 10.846608062258477, 45.256568806670998 ], [ 10.816490846451321, 45.294083948827875 ], [ 10.782815233962854, 45.31542152102169 ], [ 10.737415803955814, 45.287244810284214 ], [ 10.730482235632913, 45.3158576029101 ], [ 10.714970718949052, 45.334076403624806 ], [ 10.686763001537594, 45.342174748815239 ], [ 10.685544251498941, 45.353684468269194 ], [ 10.716841862234498, 45.395567861088324 ], [ 10.712515372218581, 45.41855005434428 ], [ 10.665232922753923, 45.427716386094765 ], [ 10.643011353579887, 45.457311194063664 ], [ 10.628467648905106, 45.602056603117113 ], [ 10.631043056919495, 45.609508661923044 ], [ 10.702006906309597, 45.672735282586068 ], [ 10.771985692206837, 45.750779332840239 ], [ 10.840150465662774, 45.832755997726998 ], [ 10.88340432129991, 45.816971555951397 ], [ 10.872797363143709, 45.788561840771635 ], [ 10.884776880540127, 45.778237603717777 ], [ 10.865244391890631, 45.761301294964355 ], [ 10.843832376572811, 45.718592819105673 ], [ 10.889578631809837, 45.71507464915414 ], [ 10.918781936923571, 45.700553584667162 ], [ 10.91199760492265, 45.688314669818133 ], [ 10.937459644557659, 45.673415698080639 ], [ 10.968319505533913, 45.680121097270728 ], [ 11.007558013760217, 45.710422202607127 ], [ 11.04137698011948, 45.706319095878065 ], [ 11.05772665332614, 45.71759893734226 ], [ 11.092399049248421, 45.695151100203852 ], [ 11.138509794435102, 45.696848300040045 ], [ 11.138661966205575, 45.709315634596486 ], [ 11.174652158321308, 45.733106869646967 ], [ 11.18065594286405, 45.762907469824022 ], [ 11.173567324026381, 45.786520949705313 ], [ 11.19351040695461, 45.793851439526684 ], [ 11.188499049848369, 45.811862931731994 ], [ 11.218453825517342, 45.843961758490614 ], [ 11.239323863122346, 45.855981907902638 ], [ 11.261236326732414, 45.918248225665415 ], [ 11.324349210629329, 45.917415884948554 ], [ 11.358056948042769, 45.925294623631288 ], [ 11.380749169633175, 45.942673602852942 ], [ 11.372396425666413, 45.973169322543271 ], [ 11.400149737755815, 45.980101820348132 ], [ 11.446781740879834, 45.980893452051546 ], [ 11.491200756328805, 46.008549616860321 ], [ 11.538910644294184, 46.013303872095001 ], [ 11.577230068511547, 46.006520286308763 ], [ 11.587592031352596, 45.968997079148025 ], [ 11.673230085830337, 45.96435139784159 ], [ 11.690004516380618, 45.988807204602971 ], [ 11.666650287801597, 46.017098891176069 ], [ 11.666902007585069, 46.038061962892805 ], [ 11.706441012288908, 46.045993265895838 ], [ 11.686389386142302, 46.066258871879377 ], [ 11.682346410473615, 46.089987027619472 ], [ 11.716789161492585, 46.102936683256239 ], [ 11.813669793680626, 46.102265664206392 ], [ 11.819681895478151, 46.107963079255946 ], [ 11.893414937041362, 46.121146904608878 ], [ 11.921767061193089, 46.149340983052618 ], [ 11.928626243220465, 46.175801189354324 ], [ 11.962269324687739, 46.187859812157001 ], [ 11.939554654903995, 46.198773376055563 ], [ 11.919401196854444, 46.220828193682514 ], [ 11.924814917214018, 46.24295248185642 ], [ 11.886261583179003, 46.25819042121941 ], [ 11.885247948001281, 46.278808757500386 ], [ 11.83763758508778, 46.270722310987217 ], [ 11.826260827389966, 46.28497039753362 ], [ 11.836767942022291, 46.302667840555699 ], [ 11.831850611592179, 46.325146525942117 ], [ 11.774378553466406, 46.358241658147129 ], [ 11.804010741008502, 46.364979853511628 ], [ 11.832040043421976, 46.387187001015675 ], [ 11.850518726101749, 46.434309295439363 ], [ 11.888793266283193, 46.441995973635798 ], [ 11.874215856205984, 46.47287531740534 ], [ 11.81315754008342, 46.478140392353112 ], [ 11.815453512431437, 46.500317507540231 ], [ 11.851350817996213, 46.517836393747451 ], [ 11.911883948346714, 46.532960254465912 ], [ 11.93388524405429, 46.527897553245836 ], [ 11.966147470771402, 46.544677921566731 ], [ 11.998418896176526, 46.532855717993563 ], [ 12.049772255788398, 46.593759353607624 ], [ 12.045450211447861, 46.607950647789593 ], [ 12.064790096139555, 46.62320174368201 ], [ 12.06826965936267, 46.675071285755863 ], [ 12.106037543526625, 46.658925365075284 ], [ 12.14512592229409, 46.634070197920217 ], [ 12.17132832777285, 46.634101428883532 ], [ 12.194459958824906, 46.604908993707497 ], [ 12.241838869164997, 46.616319015468221 ], [ 12.261219936117886, 46.629124883929407 ], [ 12.283836514981516, 46.617926058700036 ], [ 12.339704826308852, 46.631377894466908 ], [ 12.360103329521952, 46.619484689912667 ], [ 12.385163313207311, 46.622781708630662 ], [ 12.379773560307624, 46.642907395660067 ], [ 12.40574775752375, 46.643199132043549 ], [ 12.434241768382297, 46.668280548276847 ], [ 12.477594353987696, 46.679821263820415 ], [ 12.514262497490696, 46.678058181559969 ], [ 12.57040187213742, 46.650770812026813 ], [ 12.621417775327824, 46.660753212851482 ], [ 12.64245631786881, 46.651934739465794 ], [ 12.690107827955677, 46.65597243694647 ], [ 12.731981346929517, 46.633812917020975 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Liguria", "ISO": "IT-42" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 8.486071903347417, 44.308319786532742 ], [ 8.448126451427843, 44.285446296457877 ], [ 8.442363161115221, 44.265206589792527 ], [ 8.456329590367696, 44.258401239006382 ], [ 8.415849392833646, 44.220905155171558 ], [ 8.422249925455526, 44.192570065536138 ], [ 8.329069907015196, 44.161256552237411 ], [ 8.291604159456728, 44.152153239350199 ], [ 8.269068025901213, 44.139320153512834 ], [ 8.237492244864173, 44.102182538929142 ], [ 8.22676614559122, 44.080359675347708 ], [ 8.226053366347173, 44.044009602220683 ], [ 8.168703017889378, 44.00096449074627 ], [ 8.161385245078504, 43.970137302582025 ], [ 8.173963051770174, 43.957942580110675 ], [ 8.142052988641391, 43.94761115734552 ], [ 8.128289346297041, 43.92690697613056 ], [ 8.094201263629575, 43.916948418333703 ], [ 8.066430506584727, 43.888864550750036 ], [ 8.040574026548846, 43.887440517659336 ], [ 8.015014873324802, 43.872013762748018 ], [ 7.968739236810413, 43.859925585889748 ], [ 7.965612931311611, 43.852092327983001 ], [ 7.907827080232422, 43.837259130743007 ], [ 7.872114707167014, 43.836065873907252 ], [ 7.830362574204225, 43.816211786618524 ], [ 7.805557910977198, 43.823293167779241 ], [ 7.752866080679861, 43.806933344543374 ], [ 7.736471546282501, 43.795475033299397 ], [ 7.711864463238277, 43.801131453790568 ], [ 7.673216607070946, 43.776033831105771 ], [ 7.588339165264485, 43.792024721673727 ], [ 7.55574155999181, 43.77978205710609 ], [ 7.529601085691219, 43.784254369135482 ], [ 7.506777261012433, 43.838218616077185 ], [ 7.494791069329108, 43.855955894885604 ], [ 7.515170428409882, 43.883831854955297 ], [ 7.562643523734295, 43.9006587532255 ], [ 7.55970913829734, 43.916553440516687 ], [ 7.587796017019619, 43.955416258712027 ], [ 7.608877036502558, 43.956044042915913 ], [ 7.652096049942485, 43.973520037079112 ], [ 7.670344906809393, 43.998227560720196 ], [ 7.662305180337917, 44.027489060647746 ], [ 7.702825588682283, 44.045796398076497 ], [ 7.714329727043173, 44.061558889222972 ], [ 7.740081233899363, 44.077324158211461 ], [ 7.719295838473721, 44.104480817033682 ], [ 7.723123588946839, 44.120817201411178 ], [ 7.746024607649917, 44.135356779840833 ], [ 7.775143121862861, 44.139971613343839 ], [ 7.815310656735465, 44.123244234570365 ], [ 7.866119599251603, 44.118155382027098 ], [ 7.88394395599448, 44.104658567968052 ], [ 7.925962472956769, 44.110302209860116 ], [ 7.937197952637066, 44.099747479051274 ], [ 7.971531404232715, 44.113095205126783 ], [ 8.004633814641833, 44.102326670875662 ], [ 8.006633536039438, 44.12570291859754 ], [ 7.978931542874537, 44.13354203581811 ], [ 8.009445818085219, 44.15560664325028 ], [ 8.042931067612338, 44.142826509399953 ], [ 8.067310192013958, 44.144689929309102 ], [ 8.094194318175587, 44.175407994425953 ], [ 8.087962853890144, 44.203160425578318 ], [ 8.065363260272326, 44.216936583575809 ], [ 8.080619613650059, 44.241710730597916 ], [ 8.063096634217187, 44.253074194549185 ], [ 8.088599544850677, 44.274298017757879 ], [ 8.059739808101254, 44.300703827902872 ], [ 8.076021695437712, 44.313958462045086 ], [ 8.101956775119451, 44.300931025227875 ], [ 8.106968945588099, 44.332818123315185 ], [ 8.134283905431907, 44.332099621955315 ], [ 8.14863717053858, 44.354810721924125 ], [ 8.149519219361119, 44.384792022968341 ], [ 8.203499648958614, 44.40489303591702 ], [ 8.221835830597765, 44.429556468179641 ], [ 8.196435047300378, 44.46360440003091 ], [ 8.218479553078948, 44.48182573716123 ], [ 8.22416288176799, 44.514174953545904 ], [ 8.252777445079877, 44.52874739172254 ], [ 8.271312522344425, 44.506797275016162 ], [ 8.304553658861346, 44.502647252956699 ], [ 8.320803203176194, 44.488403832203005 ], [ 8.350053090205758, 44.484810925314491 ], [ 8.358490861829067, 44.464935699382785 ], [ 8.394448314049942, 44.480229506554863 ], [ 8.403879279100115, 44.508971681395231 ], [ 8.449498672110682, 44.497388095000019 ], [ 8.453011038403229, 44.509811222680518 ], [ 8.534783194965605, 44.513350884981044 ], [ 8.560059320073831, 44.502845947712885 ], [ 8.5761615944997, 44.509226681676189 ], [ 8.613452993148364, 44.546602747701627 ], [ 8.60088684508005, 44.567823557321532 ], [ 8.620169123973987, 44.576729797825578 ], [ 8.666756586579965, 44.582456803886345 ], [ 8.681419819092236, 44.574882508739982 ], [ 8.720998035385316, 44.579865416558121 ], [ 8.767564336338809, 44.524964010557852 ], [ 8.782453626018144, 44.488361025287467 ], [ 8.796653932674031, 44.500109236340535 ], [ 8.795107398637262, 44.521856823088505 ], [ 8.824397540914365, 44.53864144851012 ], [ 8.826840445761208, 44.561799380765827 ], [ 8.89494050249658, 44.555369382571854 ], [ 8.917502849410619, 44.561055017009437 ], [ 8.904354612581981, 44.620825893271089 ], [ 8.882693538437506, 44.639020647016586 ], [ 8.908261178318767, 44.646823643954789 ], [ 8.927883877261284, 44.674268010124834 ], [ 8.959523102917657, 44.676021069774741 ], [ 8.972515235098644, 44.663349583004432 ], [ 9.013153036142141, 44.666791557548983 ], [ 9.053681216510572, 44.620884835270502 ], [ 9.075853438802275, 44.623699039315156 ], [ 9.104484677627125, 44.606612259456654 ], [ 9.112968880959361, 44.58110909700892 ], [ 9.152554983969685, 44.574221158210314 ], [ 9.183520923748612, 44.591640485662445 ], [ 9.20297322777567, 44.613494121389706 ], [ 9.245502627472387, 44.619647816927909 ], [ 9.272230477095945, 44.595915226960678 ], [ 9.300410245095064, 44.607777379619492 ], [ 9.340150300043842, 44.578668882512012 ], [ 9.389368023284453, 44.590219462077535 ], [ 9.421306236588197, 44.592604305201768 ], [ 9.42307656270188, 44.574612236558231 ], [ 9.440701055438527, 44.566716617138447 ], [ 9.476536032684049, 44.565195097756479 ], [ 9.5046076784718, 44.529960002362955 ], [ 9.496803432387546, 44.482730402724556 ], [ 9.470235902102335, 44.473268527406979 ], [ 9.458198517902064, 44.442204087139388 ], [ 9.479034348453366, 44.409258522169431 ], [ 9.493902292042117, 44.423896725086465 ], [ 9.55122873534609, 44.428081808227709 ], [ 9.559177528006002, 44.438135252920112 ], [ 9.598170786726497, 44.436740323692085 ], [ 9.636038298729819, 44.413902798781251 ], [ 9.655289531762499, 44.411660311003473 ], [ 9.674979443495076, 44.364713021974985 ], [ 9.686700448591354, 44.365939567169846 ], [ 9.706301260291486, 44.366189155557272 ], [ 9.729455184652446, 44.328330595849053 ], [ 9.7583142978248, 44.318351982440106 ], [ 9.764178639738594, 44.305515239957543 ], [ 9.805714973677329, 44.282803445656675 ], [ 9.851527007782172, 44.270861769545263 ], [ 9.857027383161213, 44.234029824024503 ], [ 9.928121740347001, 44.195609077517979 ], [ 9.89236544733131, 44.168021474016506 ], [ 9.966465907266667, 44.169432464011592 ], [ 9.979011937466387, 44.161027578677995 ], [ 9.976347899537693, 44.139547987819341 ], [ 10.002127623361172, 44.107651484842258 ], [ 10.017885463973887, 44.1192810519726 ], [ 10.04614155604953, 44.115472329305732 ], [ 10.069262695388113, 44.097999078445014 ], [ 10.066221102968724, 44.086165737172792 ], [ 10.028686887526804, 44.059166947300525 ], [ 10.018772948617334, 44.044476889729317 ], [ 10.000637168879118, 44.051175801345188 ], [ 9.964242319642853, 44.037265778562116 ], [ 9.909188436844516, 44.070462226211454 ], [ 9.881169615620225, 44.080980403424903 ], [ 9.853838481067772, 44.106337417844216 ], [ 9.848703126824033, 44.109565080840994 ], [ 9.848529669964124, 44.109996275275719 ], [ 9.831219984638476, 44.10616210950802 ], [ 9.823889095421503, 44.082697575455818 ], [ 9.847278800551017, 44.061229085841198 ], [ 9.820888189018312, 44.058745653690259 ], [ 9.782145351534881, 44.072717117343402 ], [ 9.756079998483822, 44.091118611885157 ], [ 9.738482304883664, 44.092515560932661 ], [ 9.725644247436247, 44.112493890594571 ], [ 9.65749923725803, 44.145379884779352 ], [ 9.635464679204361, 44.133521318611351 ], [ 9.609165785063544, 44.156588962275045 ], [ 9.61009400168712, 44.166720448744776 ], [ 9.568984311460413, 44.182207569876979 ], [ 9.552850434859785, 44.202865676018362 ], [ 9.501397302686488, 44.222539652060959 ], [ 9.495532068470238, 44.234690128809717 ], [ 9.439490986634592, 44.242539442797863 ], [ 9.365019306282973, 44.296946899813058 ], [ 9.233913655402102, 44.3484790025203 ], [ 9.214167177597366, 44.334701661260539 ], [ 9.212394522684779, 44.310559119377565 ], [ 9.155528082777876, 44.315765497855679 ], [ 9.155090304038309, 44.347714060622636 ], [ 9.140098110425622, 44.361127464980349 ], [ 9.06980685874443, 44.377902473642429 ], [ 8.951967080571469, 44.391261808797971 ], [ 8.886972627521846, 44.407384353363312 ], [ 8.871372088990269, 44.405229821259965 ], [ 8.831292437921507, 44.420997169218694 ], [ 8.775610256254758, 44.420377301535183 ], [ 8.741320382934131, 44.42657809776437 ], [ 8.69292688838711, 44.408346809329231 ], [ 8.678254279795972, 44.392650545991266 ], [ 8.640202096769906, 44.386518635772283 ], [ 8.624350001145197, 44.371859373912123 ], [ 8.526265406370618, 44.331369988998162 ], [ 8.509346068312819, 44.328446892655833 ], [ 8.486071903347417, 44.308319786532742 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Friuli Venezia Giulia", "ISO": "IT-36" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 13.536229675353241, 45.784268587085208 ], [ 13.520736456328555, 45.757091496390395 ], [ 13.532056417292116, 45.72371042702796 ], [ 13.424270306689502, 45.677236481850343 ], [ 13.351198404682442, 45.679028609018445 ], [ 13.291559284449798, 45.704070152764409 ], [ 13.233325753637928, 45.714708273671071 ], [ 13.185788887928551, 45.711154248492527 ], [ 13.15673882577927, 45.702661197743048 ], [ 13.142977180131599, 45.685666475649178 ], [ 13.109309870208609, 45.662882743675198 ], [ 13.101006696653197, 45.643537301216966 ], [ 13.044369758996009, 45.684310500663592 ], [ 13.03016183824842, 45.725265881098395 ], [ 13.001293763229432, 45.750017825919919 ], [ 13.007591397652526, 45.765629920803661 ], [ 12.98467844226532, 45.781401861265294 ], [ 12.974233159067852, 45.807594093245008 ], [ 12.952065058743775, 45.822206125128666 ], [ 12.890058566370064, 45.820474414610935 ], [ 12.869670839862275, 45.833757538900443 ], [ 12.874983452853575, 45.850344635505188 ], [ 12.804297392582283, 45.84462434008941 ], [ 12.775032524710353, 45.853099181988554 ], [ 12.7428643273857, 45.826619806734584 ], [ 12.729994678142107, 45.837277947244054 ], [ 12.678930064903973, 45.794695433935537 ], [ 12.6502842175107, 45.80366692779895 ], [ 12.632159593655436, 45.829259280678841 ], [ 12.597392331352548, 45.822141613324327 ], [ 12.559299514513793, 45.825924963706363 ], [ 12.558984977651161, 45.847064698896894 ], [ 12.500833930340061, 45.92520959783154 ], [ 12.463104732122902, 45.934519941144409 ], [ 12.453498473269844, 45.947338440652871 ], [ 12.422292547674648, 45.956162876192423 ], [ 12.428183916001387, 45.995763442032363 ], [ 12.405080946521153, 46.042738797214213 ], [ 12.427844796541025, 46.076320872241908 ], [ 12.484425216221593, 46.104472459913453 ], [ 12.498785893497102, 46.137002936592083 ], [ 12.491512301471893, 46.15689665632506 ], [ 12.456918901584235, 46.170649269606074 ], [ 12.430593246531046, 46.209434984281849 ], [ 12.407258988015641, 46.20702410437184 ], [ 12.401680924864214, 46.228997067632491 ], [ 12.376419789080604, 46.222941372544227 ], [ 12.337709119674917, 46.239469040694146 ], [ 12.321218957014205, 46.264462489124661 ], [ 12.329143279762611, 46.28212268940716 ], [ 12.350831858178859, 46.293839191731635 ], [ 12.354654621268041, 46.319682129508053 ], [ 12.379068429405287, 46.331765614241071 ], [ 12.411457007551078, 46.330832012826249 ], [ 12.428666028515835, 46.351595883347713 ], [ 12.462942620928919, 46.369262691123176 ], [ 12.460518570722595, 46.380424738784768 ], [ 12.495264127430424, 46.412015894739106 ], [ 12.505862751259476, 46.440960490447459 ], [ 12.569953967915158, 46.475485617219491 ], [ 12.606068810736311, 46.46412668753316 ], [ 12.654062693711976, 46.484387004388218 ], [ 12.630021099358675, 46.500706650862952 ], [ 12.619164000901229, 46.54003574363432 ], [ 12.643940103489632, 46.576050673904099 ], [ 12.656792202741341, 46.572548390270775 ], [ 12.704720976229961, 46.618395649042476 ], [ 12.731981346929517, 46.633812917020975 ], [ 12.756477964839398, 46.647217508942923 ], [ 12.795023658248079, 46.642523491315686 ], [ 12.837321305106995, 46.62742547204126 ], [ 12.851989495938813, 46.605078732514912 ], [ 12.92869855636547, 46.61033647882163 ], [ 12.987686720922126, 46.599426836905494 ], [ 13.021430497344955, 46.6021319860482 ], [ 13.045923269615976, 46.595353601813798 ], [ 13.083549630705722, 46.601831527967349 ], [ 13.125139380196366, 46.591201248472771 ], [ 13.168416161239225, 46.588833265897527 ], [ 13.178796491905137, 46.578323643929274 ], [ 13.218005533374047, 46.570293579645686 ], [ 13.237377315724771, 46.553186035322334 ], [ 13.252717672378873, 46.560567869107757 ], [ 13.320184835235942, 46.552886654180014 ], [ 13.344443122316713, 46.569864274399215 ], [ 13.372750478531833, 46.579359606683191 ], [ 13.408755748412133, 46.570999321908431 ], [ 13.427267608049144, 46.557632273725801 ], [ 13.473394948903877, 46.557337282681146 ], [ 13.504100254887009, 46.56607596194813 ], [ 13.519874583101826, 46.546960098118554 ], [ 13.563496872959398, 46.551259653910272 ], [ 13.62716557244349, 46.541513674117226 ], [ 13.676779593197066, 46.523253633814178 ], [ 13.70641739192703, 46.520973174516207 ], [ 13.706335276510222, 46.483748074241156 ], [ 13.698751471499479, 46.45649472535024 ], [ 13.684235576038576, 46.437419589030554 ], [ 13.647457369744124, 46.445971198143475 ], [ 13.592201157791676, 46.436412196972206 ], [ 13.575266955923125, 46.408860596694105 ], [ 13.516261188630054, 46.376782071359166 ], [ 13.436827684357157, 46.354366620754291 ], [ 13.447371487227191, 46.336377241492315 ], [ 13.402797089155285, 46.299995428305401 ], [ 13.391872584511557, 46.279286544331796 ], [ 13.398584934087816, 46.253406559528514 ], [ 13.422483037705982, 46.234390689178284 ], [ 13.423452394793999, 46.206336667620704 ], [ 13.457028054782834, 46.226422724724614 ], [ 13.503000991942859, 46.215682159466752 ], [ 13.545723978381513, 46.212120131108982 ], [ 13.56509080896517, 46.187813252763959 ], [ 13.614534735988322, 46.184410637170551 ], [ 13.632584106641781, 46.190744995858779 ], [ 13.663203312362564, 46.180118082470358 ], [ 13.646932126682826, 46.140434117979154 ], [ 13.583510994980605, 46.100618028414274 ], [ 13.544117178358453, 46.082967654252045 ], [ 13.529945042582941, 46.067698251817824 ], [ 13.496495433167397, 46.058616406105379 ], [ 13.510016063634117, 46.046246001906653 ], [ 13.494292813494102, 46.01454772086322 ], [ 13.476190270924157, 46.006253859694752 ], [ 13.501685417747593, 45.980470653087536 ], [ 13.568246366048216, 45.968075463072736 ], [ 13.590541485162463, 45.98977343978067 ], [ 13.639496045315886, 45.980051151929992 ], [ 13.637545531807964, 45.935389351428007 ], [ 13.609231238724055, 45.899249297543392 ], [ 13.5744583412146, 45.843081422958299 ], [ 13.587794822327266, 45.834129299375718 ], [ 13.596289003274157, 45.807939687815633 ], [ 13.627271823210652, 45.797473492507173 ], [ 13.669400445009785, 45.799639951187046 ], [ 13.746151755846281, 45.755216684097029 ], [ 13.783605071991119, 45.748232184741006 ], [ 13.827080705862715, 45.714263891695815 ], [ 13.831046195593512, 45.692694727915857 ], [ 13.858129378922293, 45.665668525737438 ], [ 13.918066026827372, 45.631142812739562 ], [ 13.879144535589699, 45.611684608381786 ], [ 13.851118286816629, 45.58485458633767 ], [ 13.786989173221519, 45.582894467786424 ], [ 13.719605283111997, 45.605717636695367 ], [ 13.748407229500256, 45.608920842874298 ], [ 13.786222583873739, 45.599542286720627 ], [ 13.780444275993936, 45.612146516708918 ], [ 13.779659974804042, 45.611900376508359 ], [ 13.780262713552126, 45.612510679337753 ], [ 13.776780204854585, 45.613507700839463 ], [ 13.774047685405618, 45.612773917625347 ], [ 13.77674102650122, 45.613563202287914 ], [ 13.74868994048864, 45.644039532983967 ], [ 13.769104473509245, 45.652992296306067 ], [ 13.753336827602222, 45.680443464218939 ], [ 13.720088568803389, 45.700998257568834 ], [ 13.711255401392943, 45.710847141227418 ], [ 13.69633607332176, 45.720884991615634 ], [ 13.632010140454948, 45.768215285232934 ], [ 13.58128818065358, 45.780522065531933 ], [ 13.536229675353241, 45.784268587085208 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Puglia", "ISO": "IT-75" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 17.967821402873685, 40.659775357583207 ], [ 17.967842054664601, 40.659637578755287 ], [ 17.982176659936592, 40.644444511556387 ], [ 17.998613846560186, 40.649032569992094 ], [ 18.018141596568501, 40.621976473143683 ], [ 18.045139096582577, 40.597176308206564 ], [ 18.03524928475559, 40.574939602605752 ], [ 18.042271955323475, 40.558564130726388 ], [ 18.07473422911994, 40.539533363905704 ], [ 18.078750527215441, 40.527716997059414 ], [ 18.13924555766269, 40.487775458258319 ], [ 18.203014074260494, 40.467089758096563 ], [ 18.249107580082818, 40.437387892512781 ], [ 18.278961143685919, 40.407314492816887 ], [ 18.305529582281746, 40.39203408645718 ], [ 18.317252259187288, 40.37200841909533 ], [ 18.362692562089926, 40.341528179216603 ], [ 18.385980703318051, 40.314460507049915 ], [ 18.422830971555886, 40.294179242766738 ], [ 18.440446173731861, 40.269421998769559 ], [ 18.464541057106238, 40.222069979220031 ], [ 18.463653187238489, 40.1929208884115 ], [ 18.478963057761124, 40.178118834421483 ], [ 18.488680108478899, 40.146988165193036 ], [ 18.513405740801922, 40.138322352453869 ], [ 18.506806896043205, 40.124713851979898 ], [ 18.520381599098918, 40.107082372874117 ], [ 18.484679591217734, 40.077469345671844 ], [ 18.475588154777686, 40.045500385227911 ], [ 18.435772435922175, 40.02474520281902 ], [ 18.431663414478702, 40.000598922539652 ], [ 18.408273807788987, 39.977840200029632 ], [ 18.390176267586313, 39.905849364996996 ], [ 18.399034356485867, 39.889082337540358 ], [ 18.385916677239251, 39.83112254634338 ], [ 18.3893459348871, 39.815644885979772 ], [ 18.368992764954022, 39.793763550799241 ], [ 18.346169153964986, 39.791463315866402 ], [ 18.327075040248197, 39.807370933697499 ], [ 18.263237587583358, 39.83620364214552 ], [ 18.204743310445124, 39.838545208470514 ], [ 18.151219755620716, 39.861218577425014 ], [ 18.120747470265439, 39.884673633439327 ], [ 18.076996337705307, 39.907032851860308 ], [ 18.047563745047491, 39.928785212326076 ], [ 17.994845029032493, 39.995220419007872 ], [ 18.017640895614825, 40.0070169409491 ], [ 18.019149013999829, 40.027121038186785 ], [ 17.997661663182896, 40.05066005947036 ], [ 18.0110097652124, 40.086058631222642 ], [ 18.010877206470717, 40.106847148114767 ], [ 17.987180225540367, 40.140341217180413 ], [ 17.96383965084955, 40.147539873925822 ], [ 17.919810324797353, 40.192135477931153 ], [ 17.924205105136288, 40.217532307303991 ], [ 17.904518088714809, 40.256203398421732 ], [ 17.855879855144192, 40.285617948530096 ], [ 17.839384054516358, 40.280574871103646 ], [ 17.816364154173215, 40.2895929638429 ], [ 17.678494388567557, 40.304714471705964 ], [ 17.510536880093341, 40.29458360354559 ], [ 17.494765184344832, 40.309956318369956 ], [ 17.458034183322493, 40.316977672315076 ], [ 17.427192680092762, 40.332479193698319 ], [ 17.402127641518792, 40.332308008608159 ], [ 17.340023312626446, 40.361898920666675 ], [ 17.311295425901271, 40.366335963073539 ], [ 17.267664725469068, 40.390601800782775 ], [ 17.23264593170185, 40.401082378230889 ], [ 17.229547552012033, 40.423806445583793 ], [ 17.255667123891413, 40.442731924211969 ], [ 17.246732582299543, 40.462135596256594 ], [ 17.220167281566319, 40.479340906273016 ], [ 17.181832291059017, 40.481441220108756 ], [ 17.162639860831291, 40.506111022222449 ], [ 17.128680788831151, 40.517333912660199 ], [ 17.085051012664458, 40.519752128237606 ], [ 17.044997516152119, 40.512372476591977 ], [ 16.995265770975411, 40.494937038319392 ], [ 16.958392544394702, 40.475304592773057 ], [ 16.901624644124155, 40.435487747136207 ], [ 16.866520499668283, 40.398077514192892 ], [ 16.85067693823083, 40.401239151529715 ], [ 16.809382462945358, 40.433073958449789 ], [ 16.792606590898046, 40.461952229969413 ], [ 16.735593149660005, 40.467924173455962 ], [ 16.719589356455479, 40.481411054233689 ], [ 16.737072231631775, 40.503827497731272 ], [ 16.715820357193785, 40.52424837120406 ], [ 16.724378920090814, 40.535291821890254 ], [ 16.705688619711175, 40.550190491091698 ], [ 16.723972665131939, 40.602445657517798 ], [ 16.70975934091565, 40.632833730154339 ], [ 16.725656280417642, 40.677600802934442 ], [ 16.696624245409158, 40.702082812769056 ], [ 16.724908461460032, 40.713832764509149 ], [ 16.632819727970865, 40.753570629433973 ], [ 16.607937887857332, 40.751831472202689 ], [ 16.574607359572742, 40.763047340935309 ], [ 16.566965861175103, 40.754460021791346 ], [ 16.522550517293254, 40.746448958777911 ], [ 16.496076968684548, 40.7582853502864 ], [ 16.479679068453933, 40.736799074442722 ], [ 16.430509334698211, 40.704754582332427 ], [ 16.400152104123748, 40.7074054089844 ], [ 16.380389453514745, 40.7363977872037 ], [ 16.35007526007734, 40.748897269547726 ], [ 16.316226019289413, 40.783105613747253 ], [ 16.278230362717853, 40.801605356805801 ], [ 16.231198953989836, 40.85488696286604 ], [ 16.223804873424637, 40.886585430749491 ], [ 16.202464180777746, 40.91753154312751 ], [ 16.162970589440999, 40.928579973098536 ], [ 16.138067180941668, 40.918353365652834 ], [ 16.121297926185125, 40.899238930570981 ], [ 16.093637771020642, 40.920267862131311 ], [ 15.976628515816243, 40.958452914034915 ], [ 16.002854462927345, 40.970209302067275 ], [ 16.03198448642927, 40.998384237598842 ], [ 16.027934449533653, 41.024081169241654 ], [ 16.040539275046878, 41.036365263709271 ], [ 16.007250296230751, 41.059106301231871 ], [ 15.976253883848804, 41.094166700937087 ], [ 15.953384641931338, 41.11080943690488 ], [ 15.920968885486133, 41.11115106815091 ], [ 15.880662209653886, 41.1368357790315 ], [ 15.805370198876005, 41.110887159429119 ], [ 15.798734074792447, 41.091983429516766 ], [ 15.768400657013768, 41.083189768068827 ], [ 15.752597503895766, 41.09733718603276 ], [ 15.67941423190765, 41.086802050723875 ], [ 15.646555063996876, 41.089622589240051 ], [ 15.617416838117101, 41.099257909521661 ], [ 15.587553655190982, 41.098375363016565 ], [ 15.558910089025613, 41.087386312554408 ], [ 15.54287667544658, 41.055854618942718 ], [ 15.48948875144854, 41.070031694646033 ], [ 15.478347259454361, 41.078662320097102 ], [ 15.446099979446805, 41.078014443546188 ], [ 15.396375502806071, 41.106816248061449 ], [ 15.367453556121735, 41.084879005874846 ], [ 15.314357197196216, 41.103885682062035 ], [ 15.291726587294121, 41.093543911413299 ], [ 15.267187977130732, 41.106639611262736 ], [ 15.235663186761132, 41.13988247747259 ], [ 15.210788474066577, 41.148670655533842 ], [ 15.209345463529804, 41.167686590369684 ], [ 15.227501700965593, 41.184928377191191 ], [ 15.257382332625827, 41.197397522955399 ], [ 15.246175057200286, 41.23611113175145 ], [ 15.27984391576175, 41.240794970102989 ], [ 15.24704587477339, 41.271362534970514 ], [ 15.216282568267189, 41.275235909018967 ], [ 15.201002932669999, 41.286271979523725 ], [ 15.150198891415716, 41.282737062280482 ], [ 15.126770590082126, 41.302951905626742 ], [ 15.130560172252572, 41.317185586189773 ], [ 15.072190201309729, 41.332460329543984 ], [ 15.058467630508098, 41.37213470669095 ], [ 15.081552475879354, 41.387731211509674 ], [ 15.098780028445717, 41.433768457841687 ], [ 15.076251397415279, 41.432778119149155 ], [ 15.032443012371683, 41.452684907432086 ], [ 15.023892892177068, 41.476947367867346 ], [ 15.007617821316355, 41.486388790667682 ], [ 14.966394423870211, 41.519007319233154 ], [ 14.937030621498904, 41.527855827102236 ], [ 14.948537857070249, 41.573751713836685 ], [ 14.947021944093835, 41.609683372769084 ], [ 14.934875641972228, 41.621619242178546 ], [ 14.955895630688966, 41.643400959043788 ], [ 14.988700165326026, 41.637807884412567 ], [ 15.022689641148363, 41.621853006204077 ], [ 15.044698171360217, 41.640346094960961 ], [ 15.048312513445644, 41.655520501691832 ], [ 15.069561949061683, 41.6600669667693 ], [ 15.106073507209885, 41.685610971240514 ], [ 15.133599011611897, 41.697974418054727 ], [ 15.102843255471287, 41.741275748922241 ], [ 15.097373450288227, 41.765933609661168 ], [ 15.115135695304557, 41.789559297141047 ], [ 15.11644311204285, 41.814535319156661 ], [ 15.100268188895479, 41.833788284985346 ], [ 15.103662499331355, 41.846740100367967 ], [ 15.138799094149407, 41.879280886008274 ], [ 15.131434658668908, 41.903020468357226 ], [ 15.13804572601151, 41.926645131283351 ], [ 15.207805075916561, 41.919205524708843 ], [ 15.292875134551151, 41.920242724996946 ], [ 15.33592161755637, 41.91672952119292 ], [ 15.363393031921104, 41.903208324091608 ], [ 15.391713097847639, 41.900625351712399 ], [ 15.458268386266584, 41.903694794065693 ], [ 15.5248292456901, 41.91188875351466 ], [ 15.62304804245311, 41.927434398078482 ], [ 15.686531237313428, 41.914427683100897 ], [ 15.74996829957608, 41.916519805334723 ], [ 15.924564573212335, 41.933138460475568 ], [ 16.012148696915489, 41.950441827831838 ], [ 16.089751302222417, 41.938670449910177 ], [ 16.118143314565003, 41.916566102410073 ], [ 16.153279366965752, 41.908526188741838 ], [ 16.176461870562761, 41.884823734289725 ], [ 16.176685121700945, 41.855114567992317 ], [ 16.195100045620581, 41.822157839422275 ], [ 16.197729387670723, 41.803593546067098 ], [ 16.186602786058501, 41.7721220288797 ], [ 16.140036909796461, 41.74091130657613 ], [ 16.104912400832717, 41.729740540639327 ], [ 16.074156167458362, 41.711066539066515 ], [ 16.065379999674214, 41.695707467359007 ], [ 16.014461790851378, 41.669517970374443 ], [ 15.943518803238563, 41.64247945381004 ], [ 15.903320764627811, 41.618280522031291 ], [ 15.894229415781005, 41.575561021582743 ], [ 15.904561155329191, 41.532462491659722 ], [ 15.918247981294723, 41.505528407703295 ], [ 15.945303542071471, 41.471316423954143 ], [ 15.980566017950173, 41.445737130701986 ], [ 16.168684713996839, 41.369403309080653 ], [ 16.20703390472384, 41.359425150558515 ], [ 16.266533342484124, 41.326920023603002 ], [ 16.359056434515566, 41.304711275156599 ], [ 16.421768094575235, 41.280205312991747 ], [ 16.453176955177064, 41.259786257985446 ], [ 16.531833456771125, 41.238745795844366 ], [ 16.582084531461913, 41.208224236510311 ], [ 16.626142957947891, 41.19483146546839 ], [ 16.660195953711245, 41.192234043074201 ], [ 16.695374643421076, 41.177960021934226 ], [ 16.779316701444284, 41.159614009477494 ], [ 16.809634877705928, 41.140327299853347 ], [ 16.839964262302402, 41.138787241402724 ], [ 16.890475283385395, 41.118774036821961 ], [ 16.928565253847083, 41.111823843842672 ], [ 16.960641707940056, 41.097888768083763 ], [ 17.04647311548511, 41.08032280952245 ], [ 17.093610347042976, 41.062347227180609 ], [ 17.142406887405837, 41.036936664239654 ], [ 17.175409394343436, 41.02910148036716 ], [ 17.201639427273665, 41.003672395632144 ], [ 17.237035534340912, 40.993127236796084 ], [ 17.30672777973005, 40.952234056193277 ], [ 17.334322838583446, 40.928914692529311 ], [ 17.350114793232891, 40.905737619317264 ], [ 17.385233364506828, 40.894500132707492 ], [ 17.414832241948947, 40.870678423194235 ], [ 17.457210595682028, 40.849207447309333 ], [ 17.472812708280124, 40.832214887956866 ], [ 17.559432862089427, 40.798149933421385 ], [ 17.681531302772374, 40.767220706287134 ], [ 17.722702072645884, 40.750993017086408 ], [ 17.747325052347506, 40.733317980012579 ], [ 17.828069859455915, 40.695086341392965 ], [ 17.874073768528216, 40.684849259108191 ], [ 17.941952466916266, 40.682003863642549 ], [ 17.967842054664601, 40.659637578755287 ], [ 17.967821402873685, 40.659775357583207 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Emilia-Romagna", "ISO": "IT-45" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 11.426742032083617, 44.950083525538552 ], [ 11.434076896437318, 44.929395433737284 ], [ 11.469601804442512, 44.936373070133506 ], [ 11.534130503841563, 44.936245910947797 ], [ 11.586428680547797, 44.911339161814546 ], [ 11.592083579366152, 44.892039155417017 ], [ 11.624808733599158, 44.889223040537608 ], [ 11.672844863527706, 44.915165703183959 ], [ 11.744746369310423, 44.937127796685296 ], [ 11.747036296701273, 44.958096663787153 ], [ 11.783826507166234, 44.964186070522324 ], [ 11.804719119685782, 44.976961254991707 ], [ 11.838317927322215, 44.972789300742051 ], [ 11.899559982557815, 44.977804410503595 ], [ 11.926377187102922, 44.974792814737057 ], [ 11.962678867873572, 44.986827714374193 ], [ 12.056888799992176, 44.970601221013226 ], [ 12.091563584372308, 44.970207037874687 ], [ 12.116183235544007, 44.957672768984963 ], [ 12.142424359394441, 44.927903858805074 ], [ 12.169144604547229, 44.942089931580838 ], [ 12.194173928031269, 44.92535048898683 ], [ 12.224971806218676, 44.922980719297946 ], [ 12.256183144383797, 44.942528489027481 ], [ 12.280868808441033, 44.941767201366297 ], [ 12.294747074496529, 44.925370819517163 ], [ 12.282185363293957, 44.911509869004064 ], [ 12.286650719688124, 44.870305355244575 ], [ 12.303835739267303, 44.855387754810387 ], [ 12.336318417129377, 44.852236883893454 ], [ 12.353281638907733, 44.817027717038023 ], [ 12.396763299630519, 44.790683970678295 ], [ 12.373167744436515, 44.796189982720975 ], [ 12.308601320945781, 44.842309586799153 ], [ 12.284776890713863, 44.840730621243686 ], [ 12.258928443694801, 44.815625761248278 ], [ 12.272469324514285, 44.800255476730747 ], [ 12.248307327934029, 44.762765017864361 ], [ 12.24024368510516, 44.691004509201683 ], [ 12.281782336336889, 44.593728770804567 ], [ 12.279585959870486, 44.521616960464797 ], [ 12.292122054049669, 44.454274541947946 ], [ 12.316539219597622, 44.402909237426165 ], [ 12.329881533009056, 44.34622591654329 ], [ 12.351403280969004, 44.286428896975416 ], [ 12.383523730403532, 44.224494066038943 ], [ 12.429749191552583, 44.17884505008135 ], [ 12.514764883888684, 44.106290467004364 ], [ 12.560896338599905, 44.076357202886648 ], [ 12.575472785086774, 44.078509085864319 ], [ 12.620537996440133, 44.034965843177154 ], [ 12.655697552884895, 44.008169159969057 ], [ 12.7137120462748, 43.974330223646156 ], [ 12.750621437533921, 43.968544500728427 ], [ 12.755640592249428, 43.961954709655835 ], [ 12.727907581132266, 43.924182452501476 ], [ 12.734831054339262, 43.896024749086486 ], [ 12.722653233043534, 43.880566371936155 ], [ 12.723632264320612, 43.861236755559105 ], [ 12.682295035094915, 43.852796654608937 ], [ 12.681317061618605, 43.828070669756386 ], [ 12.623274694683218, 43.821151727050641 ], [ 12.600999399191556, 43.850510878434605 ], [ 12.602561423884056, 43.86343482663694 ], [ 12.584400319589555, 43.884103453977268 ], [ 12.541692224843722, 43.864027769312649 ], [ 12.542596427514786, 43.889081906580529 ], [ 12.49394529981652, 43.915564808052956 ], [ 12.515665508624716, 43.941532892837728 ], [ 12.506556296821341, 43.970932962241498 ], [ 12.509471054667955, 43.991203470347216 ], [ 12.452949907529879, 43.969389671688909 ], [ 12.436867357127205, 43.95662264201156 ], [ 12.403605266934079, 43.951083316738448 ], [ 12.41472455709323, 43.928748022411412 ], [ 12.417681311971824, 43.899048936454307 ], [ 12.420010773732276, 43.872231174687357 ], [ 12.386230551428406, 43.881984733828588 ], [ 12.347371693262831, 43.867020012594963 ], [ 12.33543921078245, 43.824118636046755 ], [ 12.315886833910598, 43.805637702470797 ], [ 12.284853869138802, 43.794794791762179 ], [ 12.283780916917237, 43.76491721980068 ], [ 12.209310650537891, 43.757072811925767 ], [ 12.194632649708918, 43.731924318484459 ], [ 12.164047757038764, 43.762261497059818 ], [ 12.123577531976904, 43.749150702621009 ], [ 12.108553634830672, 43.75306296446324 ], [ 12.07706063014915, 43.740654258107035 ], [ 12.053002579133906, 43.756965634181277 ], [ 12.006392013227856, 43.766521343917958 ], [ 11.986510468773206, 43.761927473254701 ], [ 11.953380474185742, 43.776088699442468 ], [ 11.947062127345196, 43.790873229599811 ], [ 11.918787746585977, 43.793688209688696 ], [ 11.896425545216882, 43.807780500873619 ], [ 11.856060664062033, 43.815900783054154 ], [ 11.824546537186261, 43.815487203452925 ], [ 11.784461168815685, 43.847577909138039 ], [ 11.732476127598087, 43.863166840451385 ], [ 11.710166740227887, 43.877445949456387 ], [ 11.71703165391205, 43.921817608914274 ], [ 11.682381492268279, 43.938266386002638 ], [ 11.688787668904713, 43.959020971909545 ], [ 11.654930702118914, 43.974695394509013 ], [ 11.645639817071638, 43.989379763752055 ], [ 11.694909020908105, 44.035339846605098 ], [ 11.709428609451034, 44.066596776126211 ], [ 11.748876930689061, 44.104141416373203 ], [ 11.744182821844486, 44.126068444063392 ], [ 11.720301358024065, 44.120707083632645 ], [ 11.678021275065802, 44.12217898340797 ], [ 11.653815194212527, 44.10254201680057 ], [ 11.597290446973293, 44.12515193988429 ], [ 11.617760466393849, 44.14623494313517 ], [ 11.615364491489578, 44.158254382894683 ], [ 11.552452064763022, 44.165339200971871 ], [ 11.544818930124899, 44.152608622872954 ], [ 11.50598106522928, 44.163474498560667 ], [ 11.480162809026298, 44.18378616446347 ], [ 11.447627004684865, 44.199485294647211 ], [ 11.451297227596203, 44.220568337692413 ], [ 11.426106860938283, 44.235053142541808 ], [ 11.398332282850768, 44.222675990938242 ], [ 11.38054512740419, 44.200000764930891 ], [ 11.342809365390291, 44.205819212674719 ], [ 11.322621016764005, 44.182242651367389 ], [ 11.280713653565755, 44.155339220957785 ], [ 11.234639631485775, 44.158412047509842 ], [ 11.195854696217628, 44.143544295934831 ], [ 11.218360298092501, 44.129403334102008 ], [ 11.260226123504275, 44.11584191382385 ], [ 11.248036195242927, 44.0975722911435 ], [ 11.21457852896846, 44.098878775644351 ], [ 11.159202384871927, 44.112422020768342 ], [ 11.127642600601822, 44.109684564851399 ], [ 11.093220805811606, 44.094457474362336 ], [ 11.054281790580342, 44.091498811408606 ], [ 11.029107254614813, 44.095811513602932 ], [ 11.002009019916432, 44.110892493871205 ], [ 10.994956505218397, 44.130795662085632 ], [ 10.91825041970572, 44.063010928347147 ], [ 10.8991394712562, 44.06647692394688 ], [ 10.90280224627811, 44.086087839051764 ], [ 10.878707279434002, 44.098619523232912 ], [ 10.848664830564152, 44.098058533390997 ], [ 10.766150428314752, 44.140676418482343 ], [ 10.743933574360867, 44.15623768325333 ], [ 10.661676932485278, 44.153849188989042 ], [ 10.641209711772985, 44.159835083075379 ], [ 10.623752784508222, 44.141205125189174 ], [ 10.624055850627933, 44.120366100014934 ], [ 10.593103763332431, 44.115415140687752 ], [ 10.577509040919645, 44.131900250108593 ], [ 10.53225640711192, 44.155042076894738 ], [ 10.522938734170062, 44.17483843156549 ], [ 10.485214943883053, 44.204496089194585 ], [ 10.492902584145824, 44.217000077312917 ], [ 10.46493668770187, 44.231136802133079 ], [ 10.430263427472214, 44.227434895583222 ], [ 10.407397558311063, 44.249308117473937 ], [ 10.371588787979585, 44.269379212010861 ], [ 10.342755174438937, 44.269631812107924 ], [ 10.296616312209331, 44.285460928023809 ], [ 10.25385666310428, 44.268580690340926 ], [ 10.229177129849372, 44.296731055339286 ], [ 10.167905844961496, 44.329910491998845 ], [ 10.142034727843635, 44.353867637999663 ], [ 10.098985744047011, 44.346167534604376 ], [ 10.05317829251922, 44.373033329550267 ], [ 10.021696590860561, 44.382934288668821 ], [ 9.98928472008847, 44.404331168942889 ], [ 10.006937090071204, 44.431734306687034 ], [ 9.980666157480284, 44.445043860969363 ], [ 9.970712722807278, 44.464439669965991 ], [ 9.92205491298057, 44.47228809198814 ], [ 9.827717218284638, 44.468275353519275 ], [ 9.732074203798588, 44.379378074547219 ], [ 9.716899238458241, 44.383174494867355 ], [ 9.686700448591354, 44.365939567169846 ], [ 9.674979443495076, 44.364713021974985 ], [ 9.655289531762499, 44.411660311003473 ], [ 9.636038298729819, 44.413902798781251 ], [ 9.598170786726497, 44.436740323692085 ], [ 9.559177528006002, 44.438135252920112 ], [ 9.55122873534609, 44.428081808227709 ], [ 9.493902292042117, 44.423896725086465 ], [ 9.479034348453366, 44.409258522169431 ], [ 9.458198517902064, 44.442204087139388 ], [ 9.470235902102335, 44.473268527406979 ], [ 9.496803432387546, 44.482730402724556 ], [ 9.5046076784718, 44.529960002362955 ], [ 9.476536032684049, 44.565195097756479 ], [ 9.440701055438527, 44.566716617138447 ], [ 9.42307656270188, 44.574612236558231 ], [ 9.421306236588197, 44.592604305201768 ], [ 9.389368023284453, 44.590219462077535 ], [ 9.340150300043842, 44.578668882512012 ], [ 9.300410245095064, 44.607777379619492 ], [ 9.272230477095945, 44.595915226960678 ], [ 9.245502627472387, 44.619647816927909 ], [ 9.20297322777567, 44.613494121389706 ], [ 9.198675885722679, 44.648758232729335 ], [ 9.206434823669957, 44.660204532226395 ], [ 9.20031986650889, 44.686404806099667 ], [ 9.240482795971243, 44.688306337484079 ], [ 9.257588757117496, 44.681220195290933 ], [ 9.298505879631204, 44.681021554408332 ], [ 9.324637473044445, 44.690015632043192 ], [ 9.308480647426125, 44.705634462073775 ], [ 9.332580793519327, 44.735040353474609 ], [ 9.28589944581023, 44.759427838170708 ], [ 9.28697494270069, 44.772496369004877 ], [ 9.316759748943644, 44.783949464687609 ], [ 9.329870700878169, 44.799990264651051 ], [ 9.358424690507526, 44.814946812774394 ], [ 9.341675182676603, 44.869811990008031 ], [ 9.290113399812011, 44.882206412908275 ], [ 9.287612456242892, 44.934235310270182 ], [ 9.314532002976938, 44.936819921584991 ], [ 9.347463128731336, 44.997410855194246 ], [ 9.36620436884829, 45.003608589142502 ], [ 9.376196795230499, 45.041667331359051 ], [ 9.370819944710394, 45.048153672491217 ], [ 9.439006409963381, 45.093446269262977 ], [ 9.501469257408381, 45.103568055174939 ], [ 9.532026203856985, 45.078432026699588 ], [ 9.550611373015634, 45.095231153104677 ], [ 9.537442638959911, 45.114877071858814 ], [ 9.601881983534748, 45.104140694527516 ], [ 9.618412910683592, 45.133019757928849 ], [ 9.638307226000176, 45.124304710787669 ], [ 9.631419791538958, 45.087796124686491 ], [ 9.659538767806902, 45.082092135323819 ], [ 9.712537614644791, 45.0587652847017 ], [ 9.730062461424572, 45.063578562821966 ], [ 9.753101094412109, 45.086599438751541 ], [ 9.778962207252645, 45.089584063765884 ], [ 9.83550722304215, 45.071884539731592 ], [ 9.844004570527707, 45.096810852713389 ], [ 9.863435093676989, 45.092470790453007 ], [ 9.88284346447543, 45.07450797650943 ], [ 9.900628060643536, 45.095442144192369 ], [ 9.879389107296902, 45.111846736280178 ], [ 9.881033418501282, 45.127001883271589 ], [ 9.915507360803078, 45.138990963633191 ], [ 9.936468007782542, 45.104821692521114 ], [ 9.978336355512388, 45.133735119270568 ], [ 9.992727070401752, 45.129758215367517 ], [ 10.029232475063258, 45.094895560331175 ], [ 10.02131684360069, 45.077179225939766 ], [ 10.0435097235061, 45.063079876059597 ], [ 10.057349645498142, 45.041447329686036 ], [ 10.106190811475322, 45.022130358597117 ], [ 10.157721357914674, 45.044079043589697 ], [ 10.193959028655518, 45.028155279573078 ], [ 10.211067558052486, 45.034031827374484 ], [ 10.260030522103106, 45.014230632908664 ], [ 10.274466594177545, 44.997930114237128 ], [ 10.304687589325436, 44.999038101152983 ], [ 10.308900794774491, 44.987377481089773 ], [ 10.365288026395547, 44.966102859451155 ], [ 10.383365843522611, 44.979109051357895 ], [ 10.416767804868922, 44.9776500124309 ], [ 10.431837991925526, 44.9470727902523 ], [ 10.504315232298701, 44.922427602652341 ], [ 10.519853032428268, 44.912726452848148 ], [ 10.56606698410156, 44.908465116300668 ], [ 10.598825423724444, 44.91474458489116 ], [ 10.630511006619228, 44.928924081076325 ], [ 10.663882897431137, 44.968587306232052 ], [ 10.6866799950343, 44.986592637925163 ], [ 10.738673161525933, 44.985742167670317 ], [ 10.743719814603844, 44.949076854017548 ], [ 10.819754130672523, 44.936723468558121 ], [ 10.876633012271745, 44.917058763642466 ], [ 10.941373456294496, 44.921913848977091 ], [ 10.994007523592993, 44.953860149161983 ], [ 11.059570643380418, 44.949248237484305 ], [ 11.073025379974478, 44.962610660532178 ], [ 11.124333257199879, 44.95136975990409 ], [ 11.148671422513441, 44.934233644327719 ], [ 11.241432752864233, 44.945916750304725 ], [ 11.26669316699075, 44.943990176740606 ], [ 11.301583514420189, 44.962358973165543 ], [ 11.329319188598506, 44.960698110358308 ], [ 11.357155462134562, 44.950080514966444 ], [ 11.378192691041217, 44.957925883674584 ], [ 11.426742032083617, 44.950083525538552 ] ], [ [ 12.224258762985661, 43.809859256369499 ], [ 12.218027798425904, 43.802789746346761 ], [ 12.169755048823186, 43.8046252237787 ], [ 12.186139625861239, 43.77413008249804 ], [ 12.237261526973207, 43.787003998912297 ], [ 12.224258762985661, 43.809859256369499 ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Toscana", "ISO": "IT-52" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 11.137898216451434, 42.434638438303686 ], [ 11.166126551890356, 42.437636073525638 ], [ 11.189654025327302, 42.481411503348255 ], [ 11.190423126022779, 42.517381664198844 ], [ 11.158172567772702, 42.562051702538078 ], [ 11.11718412047307, 42.565828953581935 ], [ 11.104838807595412, 42.596836112894721 ], [ 11.062590142399284, 42.639026672474849 ], [ 11.015341488277125, 42.6554535145792 ], [ 10.98269942497882, 42.713105692374278 ], [ 10.951543177308338, 42.736891449650813 ], [ 10.911811915315129, 42.753440650190704 ], [ 10.846215252571277, 42.769071698294333 ], [ 10.784595658308115, 42.775658958026163 ], [ 10.733274714014815, 42.803491794861017 ], [ 10.762826904264868, 42.812864972651695 ], [ 10.776017617378773, 42.843712410176359 ], [ 10.769426802133466, 42.869494249460331 ], [ 10.78663213865979, 42.888227261196185 ], [ 10.775452153519767, 42.9073452011352 ], [ 10.712290513244273, 42.940009161733649 ], [ 10.679618402091787, 42.949137979613248 ], [ 10.593861539590783, 42.954277102904321 ], [ 10.563485663561972, 42.951463392354825 ], [ 10.521183701795493, 42.922569521248668 ], [ 10.499061040007023, 42.935954545486467 ], [ 10.48391622957676, 42.967200712352557 ], [ 10.483003149688123, 42.988391918036584 ], [ 10.515717291046785, 43.002521789806352 ], [ 10.531618530083911, 43.052529533669542 ], [ 10.53977705294149, 43.134139462316561 ], [ 10.534535841324834, 43.199834990547963 ], [ 10.525840885111775, 43.240345348944082 ], [ 10.501515971880741, 43.290842087342199 ], [ 10.465231408003874, 43.316714034742212 ], [ 10.424991223265959, 43.398378202854644 ], [ 10.406780663369558, 43.408796492071957 ], [ 10.382193136006398, 43.445817726865016 ], [ 10.330446324827131, 43.473835410031597 ], [ 10.318925046133391, 43.510311610186918 ], [ 10.295578804684215, 43.541365856957398 ], [ 10.295648522479487, 43.568699364313112 ], [ 10.285598111021359, 43.642186028235315 ], [ 10.272559433175225, 43.671896157748336 ], [ 10.282597017340706, 43.686419694251853 ], [ 10.277599435348328, 43.737515899767409 ], [ 10.261012872597867, 43.807910985035981 ], [ 10.231220053353372, 43.882839671018559 ], [ 10.180905208132991, 43.942617060260375 ], [ 10.137487304533995, 43.980490585950463 ], [ 10.066931837782507, 44.02665631885781 ], [ 10.018772948617334, 44.044476889729317 ], [ 10.028686887526804, 44.059166947300525 ], [ 10.066221102968724, 44.086165737172792 ], [ 10.069262695388113, 44.097999078445014 ], [ 10.04614155604953, 44.115472329305732 ], [ 10.017885463973887, 44.1192810519726 ], [ 10.002127623361172, 44.107651484842258 ], [ 9.976347899537693, 44.139547987819341 ], [ 9.979011937466387, 44.161027578677995 ], [ 9.966465907266667, 44.169432464011592 ], [ 9.89236544733131, 44.168021474016506 ], [ 9.928121740347001, 44.195609077517979 ], [ 9.857027383161213, 44.234029824024503 ], [ 9.851527007782172, 44.270861769545263 ], [ 9.805714973677329, 44.282803445656675 ], [ 9.764178639738594, 44.305515239957543 ], [ 9.7583142978248, 44.318351982440106 ], [ 9.729455184652446, 44.328330595849053 ], [ 9.706301260291486, 44.366189155557272 ], [ 9.686700448591354, 44.365939567169846 ], [ 9.716899238458241, 44.383174494867355 ], [ 9.732074203798588, 44.379378074547219 ], [ 9.827717218284638, 44.468275353519275 ], [ 9.92205491298057, 44.47228809198814 ], [ 9.970712722807278, 44.464439669965991 ], [ 9.980666157480284, 44.445043860969363 ], [ 10.006937090071204, 44.431734306687034 ], [ 9.98928472008847, 44.404331168942889 ], [ 10.021696590860561, 44.382934288668821 ], [ 10.05317829251922, 44.373033329550267 ], [ 10.098985744047011, 44.346167534604376 ], [ 10.142034727843635, 44.353867637999663 ], [ 10.167905844961496, 44.329910491998845 ], [ 10.229177129849372, 44.296731055339286 ], [ 10.25385666310428, 44.268580690340926 ], [ 10.296616312209331, 44.285460928023809 ], [ 10.342755174438937, 44.269631812107924 ], [ 10.371588787979585, 44.269379212010861 ], [ 10.407397558311063, 44.249308117473937 ], [ 10.430263427472214, 44.227434895583222 ], [ 10.46493668770187, 44.231136802133079 ], [ 10.492902584145824, 44.217000077312917 ], [ 10.485214943883053, 44.204496089194585 ], [ 10.522938734170062, 44.17483843156549 ], [ 10.53225640711192, 44.155042076894738 ], [ 10.577509040919645, 44.131900250108593 ], [ 10.593103763332431, 44.115415140687752 ], [ 10.624055850627933, 44.120366100014934 ], [ 10.623752784508222, 44.141205125189174 ], [ 10.641209711772985, 44.159835083075379 ], [ 10.661676932485278, 44.153849188989042 ], [ 10.743933574360867, 44.15623768325333 ], [ 10.766150428314752, 44.140676418482343 ], [ 10.848664830564152, 44.098058533390997 ], [ 10.878707279434002, 44.098619523232912 ], [ 10.90280224627811, 44.086087839051764 ], [ 10.8991394712562, 44.06647692394688 ], [ 10.91825041970572, 44.063010928347147 ], [ 10.994956505218397, 44.130795662085632 ], [ 11.002009019916432, 44.110892493871205 ], [ 11.029107254614813, 44.095811513602932 ], [ 11.054281790580342, 44.091498811408606 ], [ 11.093220805811606, 44.094457474362336 ], [ 11.127642600601822, 44.109684564851399 ], [ 11.159202384871927, 44.112422020768342 ], [ 11.21457852896846, 44.098878775644351 ], [ 11.248036195242927, 44.0975722911435 ], [ 11.260226123504275, 44.11584191382385 ], [ 11.218360298092501, 44.129403334102008 ], [ 11.195854696217628, 44.143544295934831 ], [ 11.234639631485775, 44.158412047509842 ], [ 11.280713653565755, 44.155339220957785 ], [ 11.322621016764005, 44.182242651367389 ], [ 11.342809365390291, 44.205819212674719 ], [ 11.38054512740419, 44.200000764930891 ], [ 11.398332282850768, 44.222675990938242 ], [ 11.426106860938283, 44.235053142541808 ], [ 11.451297227596203, 44.220568337692413 ], [ 11.447627004684865, 44.199485294647211 ], [ 11.480162809026298, 44.18378616446347 ], [ 11.50598106522928, 44.163474498560667 ], [ 11.544818930124899, 44.152608622872954 ], [ 11.552452064763022, 44.165339200971871 ], [ 11.615364491489578, 44.158254382894683 ], [ 11.617760466393849, 44.14623494313517 ], [ 11.597290446973293, 44.12515193988429 ], [ 11.653815194212527, 44.10254201680057 ], [ 11.678021275065802, 44.12217898340797 ], [ 11.720301358024065, 44.120707083632645 ], [ 11.744182821844486, 44.126068444063392 ], [ 11.748876930689061, 44.104141416373203 ], [ 11.709428609451034, 44.066596776126211 ], [ 11.694909020908105, 44.035339846605098 ], [ 11.645639817071638, 43.989379763752055 ], [ 11.654930702118914, 43.974695394509013 ], [ 11.688787668904713, 43.959020971909545 ], [ 11.682381492268279, 43.938266386002638 ], [ 11.71703165391205, 43.921817608914274 ], [ 11.710166740227887, 43.877445949456387 ], [ 11.732476127598087, 43.863166840451385 ], [ 11.784461168815685, 43.847577909138039 ], [ 11.824546537186261, 43.815487203452925 ], [ 11.856060664062033, 43.815900783054154 ], [ 11.896425545216882, 43.807780500873619 ], [ 11.918787746585977, 43.793688209688696 ], [ 11.947062127345196, 43.790873229599811 ], [ 11.953380474185742, 43.776088699442468 ], [ 11.986510468773206, 43.761927473254701 ], [ 12.006392013227856, 43.766521343917958 ], [ 12.053002579133906, 43.756965634181277 ], [ 12.07706063014915, 43.740654258107035 ], [ 12.108553634830672, 43.75306296446324 ], [ 12.123577531976904, 43.749150702621009 ], [ 12.164047757038764, 43.762261497059818 ], [ 12.194632649708918, 43.731924318484459 ], [ 12.209310650537891, 43.757072811925767 ], [ 12.283780916917237, 43.76491721980068 ], [ 12.327074389378867, 43.751009835620714 ], [ 12.368190442424893, 43.71510153409055 ], [ 12.330116713202194, 43.707044149327373 ], [ 12.320768370299373, 43.694666916950439 ], [ 12.273479375928517, 43.675964237760326 ], [ 12.251079533243413, 43.672570743323874 ], [ 12.232656485132241, 43.655595902256927 ], [ 12.203692080567693, 43.651743968009342 ], [ 12.187218825608769, 43.636039460004476 ], [ 12.213834576267299, 43.61088376589796 ], [ 12.162662184634627, 43.561366653013451 ], [ 12.1420987596074, 43.535767858757197 ], [ 12.102727692492511, 43.529932862855986 ], [ 12.095094816253868, 43.499164729110468 ], [ 12.130960584789749, 43.482638199457249 ], [ 12.141232493176382, 43.468928758500091 ], [ 12.104025518177544, 43.460449493686149 ], [ 12.080291716830777, 43.433845453583565 ], [ 12.056878656138249, 43.43825456989736 ], [ 12.025210456317867, 43.415573891329821 ], [ 12.032936004757882, 43.400224918132338 ], [ 12.077832704202351, 43.398686630398963 ], [ 12.0730261238472, 43.370413952571923 ], [ 12.118769196017796, 43.364358717264508 ], [ 12.135456822352674, 43.341703744476646 ], [ 12.132523236121528, 43.293069704763937 ], [ 12.178171933082247, 43.283078530610709 ], [ 12.193818427023867, 43.313071520470551 ], [ 12.223707911309594, 43.296262861883832 ], [ 12.210062888370022, 43.282727299189425 ], [ 12.166431131296299, 43.268724009663877 ], [ 12.148583105463311, 43.25461712363942 ], [ 12.121823857012492, 43.255194558160653 ], [ 12.085921455264767, 43.236334317847799 ], [ 12.04889637624834, 43.253107259048463 ], [ 12.027489928451001, 43.19161710352121 ], [ 11.987476471753645, 43.180519047881212 ], [ 11.924029185723887, 43.147778351398962 ], [ 11.920937233202343, 43.117586867694072 ], [ 11.930407872461666, 43.094296131577003 ], [ 11.923748981642674, 43.075216034579967 ], [ 11.936380167345131, 43.05563026321385 ], [ 11.956587920973996, 43.068676848299738 ], [ 11.980820454949008, 43.056369361589894 ], [ 11.971935909575629, 43.022299480049107 ], [ 11.948552285393299, 42.961964282552294 ], [ 11.932721565093408, 42.908497908904948 ], [ 11.958812280991564, 42.891646493502201 ], [ 11.95865704951477, 42.871057606049234 ], [ 11.929018727873537, 42.869290194570581 ], [ 11.894963940648154, 42.834668794073558 ], [ 11.850593088594648, 42.838683189875887 ], [ 11.815446802121066, 42.8237621024116 ], [ 11.80300110081736, 42.800970061202577 ], [ 11.775874040438593, 42.820673635327459 ], [ 11.753349313045744, 42.802236022458374 ], [ 11.759273255676629, 42.782236462285411 ], [ 11.779418833765593, 42.758017440230866 ], [ 11.818658361058541, 42.745771945513361 ], [ 11.797080998601096, 42.706513129263726 ], [ 11.781143070502255, 42.705325727112402 ], [ 11.784515149937148, 42.671321054910202 ], [ 11.808407124577794, 42.659751170671854 ], [ 11.804776035350242, 42.643999178416067 ], [ 11.751830319925919, 42.625595434716409 ], [ 11.733129585050669, 42.606061885389607 ], [ 11.711617343731417, 42.61103075771284 ], [ 11.680049983789461, 42.595313337790387 ], [ 11.685941663536957, 42.584843991943252 ], [ 11.616191560285268, 42.559874834984541 ], [ 11.600890164619015, 42.56979561892458 ], [ 11.578557204548636, 42.56621098077828 ], [ 11.58435064511499, 42.542754621250182 ], [ 11.561235582203089, 42.517293007395715 ], [ 11.615960005868102, 42.488638172954708 ], [ 11.617709310728431, 42.43604425816801 ], [ 11.5435113232683, 42.442114789784405 ], [ 11.5165750923461, 42.433556015626905 ], [ 11.488888408440369, 42.439370363574263 ], [ 11.48192765192338, 42.419786865353608 ], [ 11.449780207458822, 42.394039298977411 ], [ 11.452083509204654, 42.382292243429404 ], [ 11.24353378688952, 42.418489320852316 ], [ 11.206295503596159, 42.404736364128695 ], [ 11.212516815822216, 42.38719105499198 ], [ 11.187837752076476, 42.372562878871307 ], [ 11.152686236313878, 42.361332431466053 ], [ 11.142379881704183, 42.377312070285264 ], [ 11.098008793675119, 42.393199070331953 ], [ 11.089741076900664, 42.408285610515868 ], [ 11.097604117999007, 42.440016458107834 ], [ 11.137898216451434, 42.434638438303686 ] ] ], [ [ [ 10.431358135572067, 42.82460108333089 ], [ 10.433711627446755, 42.775025510410195 ], [ 10.401618963253672, 42.757448553391548 ], [ 10.432765266380132, 42.734894524075841 ], [ 10.431663023417768, 42.712600119881763 ], [ 10.384700912135024, 42.713988079448768 ], [ 10.344611131574114, 42.76394954443505 ], [ 10.291956357444839, 42.754055685680996 ], [ 10.289988425600216, 42.738710441877458 ], [ 10.237560404751447, 42.747920579876862 ], [ 10.236704059154111, 42.72604704388408 ], [ 10.188139569372041, 42.736248640623216 ], [ 10.151433519670505, 42.730511255622908 ], [ 10.122240968951392, 42.741778506525009 ], [ 10.103689197011477, 42.76761482266091 ], [ 10.103316961802214, 42.786578934278801 ], [ 10.141351550272722, 42.807147709432833 ], [ 10.205543490360391, 42.807237238412995 ], [ 10.219575171310746, 42.793103602044624 ], [ 10.269405620727852, 42.803455977595441 ], [ 10.275209766288649, 42.817507038154048 ], [ 10.316168491118011, 42.820064713390153 ], [ 10.317373230264174, 42.804643086257769 ], [ 10.357425334237732, 42.799330463754877 ], [ 10.360270747773836, 42.817989071326544 ], [ 10.379261695658027, 42.82749635849347 ], [ 10.407719808583579, 42.871342227380296 ], [ 10.444024012694339, 42.846846598401314 ], [ 10.431358135572067, 42.82460108333089 ] ] ], [ [ [ 10.882474264983172, 42.389283134916894 ], [ 10.904094827469665, 42.383241220355529 ], [ 10.924684472847364, 42.355313327159074 ], [ 10.929255336433807, 42.325527089886563 ], [ 10.899674790465667, 42.330400119271054 ], [ 10.8824220634085, 42.351859158554369 ], [ 10.882474264983172, 42.389283134916894 ] ] ], [ [ [ 9.83394551054948, 43.058608891379137 ], [ 9.847599823543803, 43.045145348167502 ], [ 9.841816507853947, 43.029834700752346 ], [ 9.810080833203831, 43.002285795245726 ], [ 9.79606236251192, 43.02594331658544 ], [ 9.802881343399664, 43.050260675505584 ], [ 9.83394551054948, 43.058608891379137 ] ] ], [ [ [ 12.224258762985661, 43.809859256369499 ], [ 12.237261526973207, 43.787003998912297 ], [ 12.186139625861239, 43.77413008249804 ], [ 12.169755048823186, 43.8046252237787 ], [ 12.218027798425904, 43.802789746346761 ], [ 12.224258762985661, 43.809859256369499 ] ] ], [ [ [ 10.330008294648978, 42.322195083756036 ], [ 10.293735596116125, 42.31734760944277 ], [ 10.292666461771354, 42.344251147187904 ], [ 10.32748748610314, 42.342677840425459 ], [ 10.330008294648978, 42.322195083756036 ] ] ], [ [ [ 10.086524645785744, 42.603315992618306 ], [ 10.100293281962097, 42.574893730275178 ], [ 10.052134187902384, 42.573869206361159 ], [ 10.086524645785744, 42.603315992618306 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAME_1": "Umbria", "ISO": "IT-55" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 13.189215833537546, 42.733577628927513 ], [ 13.190655787651554, 42.712751553959187 ], [ 13.17333487487914, 42.687313921861367 ], [ 13.174140797605588, 42.666105124295683 ], [ 13.14423367035819, 42.64631056821036 ], [ 13.1304959748211, 42.659301116771282 ], [ 13.097805149524875, 42.636308500135243 ], [ 13.058573752524453, 42.622842295271468 ], [ 13.015329889827614, 42.631916161535301 ], [ 13.004317781651098, 42.615237367650955 ], [ 12.953388674077495, 42.619021280586111 ], [ 12.931535760230684, 42.603591925951825 ], [ 12.896340286536367, 42.616444035750412 ], [ 12.880089884947566, 42.602361789521886 ], [ 12.892729022539914, 42.563497445659642 ], [ 12.847831716929839, 42.552803148549408 ], [ 12.823016965798367, 42.537487077923757 ], [ 12.773202317644337, 42.531279914395533 ], [ 12.773542713309421, 42.513093990305528 ], [ 12.731537309034664, 42.50885750668111 ], [ 12.711133549815331, 42.500796903906114 ], [ 12.741568095117392, 42.470532509047949 ], [ 12.702785342659867, 42.460899122061797 ], [ 12.665982787549353, 42.440973358947438 ], [ 12.649855656287059, 42.443090953236819 ], [ 12.642693800303487, 42.464506052831879 ], [ 12.621374616963509, 42.468667316790956 ], [ 12.611962216367422, 42.436246623261539 ], [ 12.614891063683718, 42.414481756275805 ], [ 12.569990346498846, 42.382910275544901 ], [ 12.54893846608655, 42.38232862011472 ], [ 12.531231637708686, 42.365074276401081 ], [ 12.513271034315048, 42.378624695109885 ], [ 12.511129429006887, 42.403566741975922 ], [ 12.481361930332469, 42.404163922927708 ], [ 12.466712791879388, 42.419465501787407 ], [ 12.422269521962855, 42.421603933820791 ], [ 12.411381843078695, 42.446006775687508 ], [ 12.417899011365868, 42.458454637334462 ], [ 12.40352334299747, 42.49996109026506 ], [ 12.374173937561823, 42.481128252615896 ], [ 12.316442039191863, 42.488380024679998 ], [ 12.267169292630577, 42.532617674399198 ], [ 12.275043308590547, 42.559914794904557 ], [ 12.238720421699664, 42.572005785237558 ], [ 12.245948987694959, 42.599948884482593 ], [ 12.229194591134986, 42.610401984449375 ], [ 12.243340641492326, 42.628091062814853 ], [ 12.197280568141618, 42.66384549189879 ], [ 12.16101159955824, 42.676909990906495 ], [ 12.140774611037447, 42.656300823454188 ], [ 12.119543863273396, 42.649823514219221 ], [ 12.073715387792065, 42.656670308861656 ], [ 12.024711325237149, 42.651486672789197 ], [ 11.97797968717965, 42.675525143512083 ], [ 11.941329826271726, 42.683300890387194 ], [ 11.926292757558661, 42.70474094517725 ], [ 11.949145956380136, 42.727403910843449 ], [ 11.968726058972106, 42.734578430361644 ], [ 11.97948183640772, 42.764585315682403 ], [ 11.931307756390986, 42.778440340033235 ], [ 11.9049256096552, 42.827894644781637 ], [ 11.894963940648154, 42.834668794073558 ], [ 11.929018727873537, 42.869290194570581 ], [ 11.95865704951477, 42.871057606049234 ], [ 11.958812280991564, 42.891646493502201 ], [ 11.932721565093408, 42.908497908904948 ], [ 11.948552285393299, 42.961964282552294 ], [ 11.971935909575629, 43.022299480049107 ], [ 11.980820454949008, 43.056369361589894 ], [ 11.956587920973996, 43.068676848299738 ], [ 11.936380167345131, 43.05563026321385 ], [ 11.923748981642674, 43.075216034579967 ], [ 11.930407872461666, 43.094296131577003 ], [ 11.920937233202343, 43.117586867694072 ], [ 11.924029185723887, 43.147778351398962 ], [ 11.987476471753645, 43.180519047881212 ], [ 12.027489928451001, 43.19161710352121 ], [ 12.04889637624834, 43.253107259048463 ], [ 12.085921455264767, 43.236334317847799 ], [ 12.121823857012492, 43.255194558160653 ], [ 12.148583105463311, 43.25461712363942 ], [ 12.166431131296299, 43.268724009663877 ], [ 12.210062888370022, 43.282727299189425 ], [ 12.223707911309594, 43.296262861883832 ], [ 12.193818427023867, 43.313071520470551 ], [ 12.178171933082247, 43.283078530610709 ], [ 12.132523236121528, 43.293069704763937 ], [ 12.135456822352674, 43.341703744476646 ], [ 12.118769196017796, 43.364358717264508 ], [ 12.0730261238472, 43.370413952571923 ], [ 12.077832704202351, 43.398686630398963 ], [ 12.032936004757882, 43.400224918132338 ], [ 12.025210456317867, 43.415573891329821 ], [ 12.056878656138249, 43.43825456989736 ], [ 12.080291716830777, 43.433845453583565 ], [ 12.104025518177544, 43.460449493686149 ], [ 12.141232493176382, 43.468928758500091 ], [ 12.130960584789749, 43.482638199457249 ], [ 12.095094816253868, 43.499164729110468 ], [ 12.102727692492511, 43.529932862855986 ], [ 12.1420987596074, 43.535767858757197 ], [ 12.162662184634627, 43.561366653013451 ], [ 12.213834576267299, 43.61088376589796 ], [ 12.217786380802849, 43.604323121809841 ], [ 12.218159327299237, 43.603497960259112 ], [ 12.225280421846268, 43.593915565530374 ], [ 12.263183396169937, 43.589072032206587 ], [ 12.351156356678519, 43.611476044063558 ], [ 12.373496499035324, 43.584287738557151 ], [ 12.344949885177261, 43.553627442519236 ], [ 12.31290682962284, 43.543096871186982 ], [ 12.333181381108808, 43.523578304491927 ], [ 12.366736516080339, 43.534085932253056 ], [ 12.399043882069481, 43.513218797495249 ], [ 12.417935631818168, 43.534894000786394 ], [ 12.433186279253926, 43.538406998059394 ], [ 12.457387863637186, 43.517307933907453 ], [ 12.480534309027922, 43.527453820583894 ], [ 12.49981472840371, 43.521458051934118 ], [ 12.56425968478989, 43.459799784697672 ], [ 12.604760711837301, 43.437982931144361 ], [ 12.62515821359421, 43.420658567814272 ], [ 12.66317659085316, 43.43683082384991 ], [ 12.709384576537682, 43.425115966803361 ], [ 12.715265434552691, 43.446085501981578 ], [ 12.735763292396454, 43.463753373193889 ], [ 12.767446108847878, 43.459847887521505 ], [ 12.765912305254945, 43.426038772824619 ], [ 12.774427487657977, 43.401966497068408 ], [ 12.746809419868166, 43.390452943940701 ], [ 12.749689714158825, 43.378058380156517 ], [ 12.791086899941561, 43.337301187764439 ], [ 12.802226056220443, 43.307567531768846 ], [ 12.789242008456791, 43.284482206696424 ], [ 12.824756867376795, 43.266567356241374 ], [ 12.836606568022578, 43.217532939478069 ], [ 12.862344919549191, 43.211252115588152 ], [ 12.868244076689649, 43.195212528606049 ], [ 12.862490472547746, 43.165966038681233 ], [ 12.832360997938194, 43.147299177125888 ], [ 12.843003102618345, 43.12234421735328 ], [ 12.875466379546546, 43.123444504315579 ], [ 12.897327701037113, 43.09348462558588 ], [ 12.889934815853701, 43.058884079266129 ], [ 12.906705859589829, 43.035395397263976 ], [ 12.888007381548421, 43.009515662968809 ], [ 12.908166392222691, 42.984870486793781 ], [ 12.895822077078666, 42.964592022053552 ], [ 12.976787230481836, 42.925680045230955 ], [ 12.968393686547856, 42.900677357671562 ], [ 12.976152797799937, 42.869804191194859 ], [ 12.990237852892305, 42.871119626373641 ], [ 13.002523591790149, 42.895566931650528 ], [ 13.037783946901206, 42.907543886926589 ], [ 13.052779583571294, 42.919795984326626 ], [ 13.080726005213807, 42.899528199248792 ], [ 13.112247784161525, 42.889333511514792 ], [ 13.154557655927601, 42.834622019074921 ], [ 13.187557255135516, 42.834477293749117 ], [ 13.230901403504342, 42.854000781086668 ], [ 13.247943837114077, 42.849474969304353 ], [ 13.264029091353761, 42.808243691532653 ], [ 13.245124119367892, 42.772627564469211 ], [ 13.216506774642644, 42.771476382264211 ], [ 13.194196609710362, 42.758495152417026 ], [ 13.189215833537546, 42.733577628927513 ] ] ] } }
]
}
| superset-frontend/plugins/legacy-plugin-chart-country-map/src/countries/italy_regions.geojson | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.0013813298428431153,
0.0009793370263651013,
0.0007300735451281071,
0.0008266076329164207,
0.00028697081143036485
] |
{
"id": 4,
"code_window": [
" symbolSize: showMarkers ? markerSize : 0,\n",
" lineStyle: {\n",
" opacity: parseAnnotationOpacity(opacity),\n",
" type: style as ZRLineType,\n",
" width: hideLine ? 0 : width,\n",
" },\n",
" });\n",
" });\n",
" }\n",
" return series;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" color: color || colorScale(name, sliceId),\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "add",
"edit_start_line_idx": 437
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import {
AnnotationData,
AnnotationOpacity,
CategoricalColorScale,
EventAnnotationLayer,
FilterState,
FormulaAnnotationLayer,
getTimeFormatter,
IntervalAnnotationLayer,
isTimeseriesAnnotationResult,
NumberFormatter,
smartDateDetailedFormatter,
smartDateFormatter,
TimeFormatter,
TimeseriesAnnotationLayer,
TimeseriesDataRecord,
} from '@superset-ui/core';
import { SeriesOption } from 'echarts';
import {
CallbackDataParams,
DefaultStatesMixin,
ItemStyleOption,
LineStyleOption,
OptionName,
SeriesLabelOption,
SeriesLineLabelOption,
ZRLineType,
} from 'echarts/types/src/util/types';
import {
MarkArea1DDataItemOption,
MarkArea2DDataItemOption,
} from 'echarts/types/src/component/marker/MarkAreaModel';
import { MarkLine1DDataItemOption } from 'echarts/types/src/component/marker/MarkLineModel';
import { extractForecastSeriesContext } from '../utils/forecast';
import { ForecastSeriesEnum, LegendOrientation } from '../types';
import { EchartsTimeseriesSeriesType } from './types';
import {
evalFormula,
extractRecordAnnotations,
formatAnnotationLabel,
parseAnnotationOpacity,
} from '../utils/annotation';
import { currentSeries, getChartPadding } from '../utils/series';
import { OpacityEnum, TIMESERIES_CONSTANTS } from '../constants';
export function transformSeries(
series: SeriesOption,
colorScale: CategoricalColorScale,
opts: {
area?: boolean;
filterState?: FilterState;
seriesContexts?: { [key: string]: ForecastSeriesEnum[] };
markerEnabled?: boolean;
markerSize?: number;
areaOpacity?: number;
seriesType?: EchartsTimeseriesSeriesType;
stack?: boolean;
yAxisIndex?: number;
showValue?: boolean;
onlyTotal?: boolean;
formatter?: NumberFormatter;
totalStackedValues?: number[];
showValueIndexes?: number[];
thresholdValues?: number[];
richTooltip?: boolean;
seriesKey?: OptionName;
sliceId?: number;
},
): SeriesOption | undefined {
const { name } = series;
const {
area,
filterState,
seriesContexts = {},
markerEnabled,
markerSize,
areaOpacity = 1,
seriesType,
stack,
yAxisIndex = 0,
showValue,
onlyTotal,
formatter,
totalStackedValues = [],
showValueIndexes = [],
thresholdValues = [],
richTooltip,
seriesKey,
sliceId,
} = opts;
const contexts = seriesContexts[name || ''] || [];
const hasForecast =
contexts.includes(ForecastSeriesEnum.ForecastTrend) ||
contexts.includes(ForecastSeriesEnum.ForecastLower) ||
contexts.includes(ForecastSeriesEnum.ForecastUpper);
const forecastSeries = extractForecastSeriesContext(name || '');
const isConfidenceBand =
forecastSeries.type === ForecastSeriesEnum.ForecastLower ||
forecastSeries.type === ForecastSeriesEnum.ForecastUpper;
const isFiltered =
filterState?.selectedValues && !filterState?.selectedValues.includes(name);
const opacity = isFiltered
? OpacityEnum.SemiTransparent
: OpacityEnum.NonTransparent;
// don't create a series if doing a stack or area chart and the result
// is a confidence band
if ((stack || area) && isConfidenceBand) return undefined;
const isObservation = forecastSeries.type === ForecastSeriesEnum.Observation;
const isTrend = forecastSeries.type === ForecastSeriesEnum.ForecastTrend;
let stackId;
if (isConfidenceBand) {
stackId = forecastSeries.name;
} else if (stack && isObservation) {
// the suffix of the observation series is '' (falsy), which disables
// stacking. Therefore we need to set something that is truthy.
stackId = 'obs';
} else if (stack && isTrend) {
stackId = forecastSeries.type;
}
let plotType;
if (
!isConfidenceBand &&
(seriesType === 'scatter' || (hasForecast && isObservation))
) {
plotType = 'scatter';
} else if (isConfidenceBand) {
plotType = 'line';
} else {
plotType = seriesType === 'bar' ? 'bar' : 'line';
}
// forcing the colorScale to return a different color for same metrics across different queries
const itemStyle = {
color: colorScale(seriesKey || forecastSeries.name, sliceId),
opacity,
};
let emphasis = {};
let showSymbol = false;
if (!isConfidenceBand) {
if (plotType === 'scatter') {
showSymbol = true;
} else if (hasForecast && isObservation) {
showSymbol = true;
} else if (plotType === 'line' && showValue) {
showSymbol = true;
} else if (plotType === 'line' && !richTooltip && !markerEnabled) {
// this is hack to make timeseries line chart clickable when tooltip trigger is 'item'
// so that the chart can emit cross-filtering
showSymbol = true;
itemStyle.opacity = 0;
emphasis = {
itemStyle: {
opacity: 1,
},
};
} else if (markerEnabled) {
showSymbol = true;
}
}
const lineStyle = isConfidenceBand
? { opacity: OpacityEnum.Transparent }
: { opacity };
return {
...series,
yAxisIndex,
name: forecastSeries.name,
itemStyle,
// @ts-ignore
type: plotType,
smooth: seriesType === 'smooth',
triggerLineEvent: true,
// @ts-ignore
step: ['start', 'middle', 'end'].includes(seriesType as string)
? seriesType
: undefined,
stack: stackId,
lineStyle,
areaStyle:
area || forecastSeries.type === ForecastSeriesEnum.ForecastUpper
? {
opacity: opacity * areaOpacity,
}
: undefined,
emphasis: {
// bold on hover as required since 5.3.0 to retain backwards feature parity:
// https://apache.github.io/echarts-handbook/en/basics/release-note/5-3-0/#removing-the-default-bolding-emphasis-effect-in-the-line-chart
// TODO: should consider only adding emphasis to currently hovered series
lineStyle: {
width: 'bolder',
},
...emphasis,
},
showSymbol,
symbolSize: markerSize,
label: {
show: !!showValue,
position: 'top',
formatter: (params: any) => {
const {
value: [, numericValue],
dataIndex,
seriesIndex,
seriesName,
} = params;
const isSelectedLegend = currentSeries.legend === seriesName;
if (!formatter) return numericValue;
if (!stack || isSelectedLegend) return formatter(numericValue);
if (!onlyTotal) {
if (numericValue >= thresholdValues[dataIndex]) {
return formatter(numericValue);
}
return '';
}
if (seriesIndex === showValueIndexes[dataIndex]) {
return formatter(totalStackedValues[dataIndex]);
}
return '';
},
},
};
}
export function transformFormulaAnnotation(
layer: FormulaAnnotationLayer,
data: TimeseriesDataRecord[],
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption {
const { name, color, opacity, width, style } = layer;
return {
name,
id: name,
itemStyle: {
color: color || colorScale(name, sliceId),
},
lineStyle: {
opacity: parseAnnotationOpacity(opacity),
type: style as ZRLineType,
width,
},
type: 'line',
smooth: true,
data: evalFormula(layer, data),
symbolSize: 0,
};
}
export function transformIntervalAnnotation(
layer: IntervalAnnotationLayer,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
annotations.forEach(annotation => {
const { name, color, opacity, showLabel } = layer;
const { descriptions, intervalEnd, time, title } = annotation;
const label = formatAnnotationLabel(name, title, descriptions);
const intervalData: (
| MarkArea1DDataItemOption
| MarkArea2DDataItemOption
)[] = [
[
{
name: label,
xAxis: time,
},
{
xAxis: intervalEnd,
},
],
];
const intervalLabel: SeriesLabelOption = showLabel
? {
show: true,
color: '#000000',
position: 'insideTop',
verticalAlign: 'top',
fontWeight: 'bold',
// @ts-ignore
emphasis: {
position: 'insideTop',
verticalAlign: 'top',
backgroundColor: '#ffffff',
},
}
: {
show: false,
color: '#000000',
// @ts-ignore
emphasis: {
fontWeight: 'bold',
show: true,
position: 'insideTop',
verticalAlign: 'top',
backgroundColor: '#ffffff',
},
};
series.push({
id: `Interval - ${label}`,
type: 'line',
animation: false,
markArea: {
silent: false,
itemStyle: {
color: color || colorScale(name, sliceId),
opacity: parseAnnotationOpacity(opacity || AnnotationOpacity.Medium),
emphasis: {
opacity: 0.8,
},
} as ItemStyleOption,
label: intervalLabel,
data: intervalData,
},
});
});
return series;
}
export function transformEventAnnotation(
layer: EventAnnotationLayer,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
colorScale: CategoricalColorScale,
sliceId?: number,
): SeriesOption[] {
const series: SeriesOption[] = [];
const annotations = extractRecordAnnotations(layer, annotationData);
annotations.forEach(annotation => {
const { name, color, opacity, style, width, showLabel } = layer;
const { descriptions, time, title } = annotation;
const label = formatAnnotationLabel(name, title, descriptions);
const eventData: MarkLine1DDataItemOption[] = [
{
name: label,
xAxis: time,
},
];
const lineStyle: LineStyleOption & DefaultStatesMixin['emphasis'] = {
width,
type: style as ZRLineType,
color: color || colorScale(name, sliceId),
opacity: parseAnnotationOpacity(opacity),
emphasis: {
width: width ? width + 1 : width,
opacity: 1,
},
};
const eventLabel: SeriesLineLabelOption = showLabel
? {
show: true,
color: '#000000',
position: 'insideEndTop',
fontWeight: 'bold',
formatter: (params: CallbackDataParams) => params.name,
// @ts-ignore
emphasis: {
backgroundColor: '#ffffff',
},
}
: {
show: false,
color: '#000000',
position: 'insideEndTop',
// @ts-ignore
emphasis: {
formatter: (params: CallbackDataParams) => params.name,
fontWeight: 'bold',
show: true,
backgroundColor: '#ffffff',
},
};
series.push({
id: `Event - ${label}`,
type: 'line',
animation: false,
markLine: {
silent: false,
symbol: 'none',
lineStyle,
label: eventLabel,
data: eventData,
},
});
});
return series;
}
export function transformTimeseriesAnnotation(
layer: TimeseriesAnnotationLayer,
markerSize: number,
data: TimeseriesDataRecord[],
annotationData: AnnotationData,
): SeriesOption[] {
const series: SeriesOption[] = [];
const { hideLine, name, opacity, showMarkers, style, width } = layer;
const result = annotationData[name];
if (isTimeseriesAnnotationResult(result)) {
result.forEach(annotation => {
const { key, values } = annotation;
series.push({
type: 'line',
id: key,
name: key,
data: values.map(row => [row.x, row.y] as [OptionName, number]),
symbolSize: showMarkers ? markerSize : 0,
lineStyle: {
opacity: parseAnnotationOpacity(opacity),
type: style as ZRLineType,
width: hideLine ? 0 : width,
},
});
});
}
return series;
}
export function getPadding(
showLegend: boolean,
legendOrientation: LegendOrientation,
addYAxisTitleOffset: boolean,
zoomable: boolean,
margin?: string | number | null,
addXAxisTitleOffset?: boolean,
yAxisTitlePosition?: string,
yAxisTitleMargin?: number,
xAxisTitleMargin?: number,
): {
bottom: number;
left: number;
right: number;
top: number;
} {
const yAxisOffset = addYAxisTitleOffset
? TIMESERIES_CONSTANTS.yAxisLabelTopOffset
: 0;
const xAxisOffset = addXAxisTitleOffset ? Number(xAxisTitleMargin) || 0 : 0;
return getChartPadding(showLegend, legendOrientation, margin, {
top:
yAxisTitlePosition && yAxisTitlePosition === 'Top'
? TIMESERIES_CONSTANTS.gridOffsetTop + (Number(yAxisTitleMargin) || 0)
: TIMESERIES_CONSTANTS.gridOffsetTop + yAxisOffset,
bottom: zoomable
? TIMESERIES_CONSTANTS.gridOffsetBottomZoomable + xAxisOffset
: TIMESERIES_CONSTANTS.gridOffsetBottom + xAxisOffset,
left:
yAxisTitlePosition === 'Left'
? TIMESERIES_CONSTANTS.gridOffsetLeft + (Number(yAxisTitleMargin) || 0)
: TIMESERIES_CONSTANTS.gridOffsetLeft,
right:
showLegend && legendOrientation === LegendOrientation.Right
? 0
: TIMESERIES_CONSTANTS.gridOffsetRight,
});
}
export function getTooltipTimeFormatter(
format?: string,
): TimeFormatter | StringConstructor {
if (format === smartDateFormatter.id) {
return smartDateDetailedFormatter;
}
if (format) {
return getTimeFormatter(format);
}
return String;
}
export function getXAxisFormatter(
format?: string,
): TimeFormatter | StringConstructor | undefined {
if (format === smartDateFormatter.id || !format) {
return undefined;
}
if (format) {
return getTimeFormatter(format);
}
return String;
}
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts | 1 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.9789907932281494,
0.022894416004419327,
0.0001646554737817496,
0.00040674619958736,
0.13583874702453613
] |
{
"id": 4,
"code_window": [
" symbolSize: showMarkers ? markerSize : 0,\n",
" lineStyle: {\n",
" opacity: parseAnnotationOpacity(opacity),\n",
" type: style as ZRLineType,\n",
" width: hideLine ? 0 : width,\n",
" },\n",
" });\n",
" });\n",
" }\n",
" return series;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" color: color || colorScale(name, sliceId),\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "add",
"edit_start_line_idx": 437
} | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Any, Dict
from flask_appbuilder import CompactCRUDMixin
from flask_appbuilder.api import expose
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.security.decorators import has_access
from flask_babel import lazy_gettext as _
from wtforms.validators import StopValidation
from superset.constants import MODEL_VIEW_RW_METHOD_PERMISSION_MAP, RouteMethod
from superset.models.annotations import Annotation, AnnotationLayer
from superset.superset_typing import FlaskResponse
from superset.views.base import SupersetModelView
class StartEndDttmValidator: # pylint: disable=too-few-public-methods
"""
Validates dttm fields.
"""
def __call__(self, form: Dict[str, Any], field: Any) -> None:
if not form["start_dttm"].data and not form["end_dttm"].data:
raise StopValidation(_("annotation start time or end time is required."))
if (
form["end_dttm"].data
and form["start_dttm"].data
and form["end_dttm"].data < form["start_dttm"].data
):
raise StopValidation(
_("Annotation end time must be no earlier than start time.")
)
class AnnotationModelView(SupersetModelView, CompactCRUDMixin):
datamodel = SQLAInterface(Annotation)
include_route_methods = RouteMethod.CRUD_SET | {"annotation"}
class_permission_name = "Annotation"
method_permission_name = MODEL_VIEW_RW_METHOD_PERMISSION_MAP
list_title = _("Annotations")
show_title = _("Show Annotation")
add_title = _("Add Annotation")
edit_title = _("Edit Annotation")
list_columns = ["short_descr", "start_dttm", "end_dttm"]
edit_columns = [
"layer",
"short_descr",
"long_descr",
"start_dttm",
"end_dttm",
"json_metadata",
]
add_columns = edit_columns
label_columns = {
"layer": _("Layer"),
"short_descr": _("Label"),
"long_descr": _("Description"),
"start_dttm": _("Start"),
"end_dttm": _("End"),
"json_metadata": _("JSON Metadata"),
}
description_columns = {
"json_metadata": "This JSON represents any additional metadata this \
annotation needs to add more context."
}
validators_columns = {"start_dttm": [StartEndDttmValidator()]}
def pre_add(self, item: "AnnotationModelView") -> None:
if not item.start_dttm:
item.start_dttm = item.end_dttm
elif not item.end_dttm:
item.end_dttm = item.start_dttm
def pre_update(self, item: "AnnotationModelView") -> None:
self.pre_add(item)
@expose("/<pk>/annotation/", methods=["GET"])
@has_access
def annotation(self, pk: int) -> FlaskResponse: # pylint: disable=unused-argument
return super().render_app_template()
class AnnotationLayerModelView(SupersetModelView):
datamodel = SQLAInterface(AnnotationLayer)
include_route_methods = RouteMethod.CRUD_SET | {RouteMethod.API_READ}
related_views = [AnnotationModelView]
class_permission_name = "Annotation"
method_permission_name = MODEL_VIEW_RW_METHOD_PERMISSION_MAP
list_title = _("Annotation Layers")
show_title = _("Show Annotation Layer")
add_title = _("Add Annotation Layer")
edit_title = _("Edit Annotation Layer")
list_columns = ["id", "name", "descr"]
edit_columns = ["name", "descr"]
add_columns = edit_columns
label_columns = {"name": _("Name"), "descr": _("Description")}
@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
return super().render_app_template()
| superset/views/annotations.py | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.002847380703315139,
0.0006264782859943807,
0.00016913555737119168,
0.00017737841699272394,
0.0009353741188533604
] |
{
"id": 4,
"code_window": [
" symbolSize: showMarkers ? markerSize : 0,\n",
" lineStyle: {\n",
" opacity: parseAnnotationOpacity(opacity),\n",
" type: style as ZRLineType,\n",
" width: hideLine ? 0 : width,\n",
" },\n",
" });\n",
" });\n",
" }\n",
" return series;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" color: color || colorScale(name, sliceId),\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "add",
"edit_start_line_idx": 437
} | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React, { useEffect, useState } from 'react';
import {
JsonObject,
seedRandom,
SuperChart,
SequentialD3,
} from '@superset-ui/core';
import CountryMapChartPlugin, {
countries,
} from '@superset-ui/legacy-plugin-chart-country-map';
import { withKnobs, select } from '@storybook/addon-knobs';
import { withResizableChartDemo } from '../../../shared/components/ResizableChartDemo';
new CountryMapChartPlugin().configure({ key: 'country-map' }).register();
export default {
title: 'Legacy Chart Plugins/legacy-plugin-chart-country-map',
decorators: [withKnobs, withResizableChartDemo],
};
function generateData(geojson: JsonObject) {
return geojson.features.map(feat => ({
metric: Math.round(seedRandom() * 10000) / 100,
country_id: feat.properties.ISO,
}));
}
export const basic = function BasicCountryMapStory({ width, height }) {
const country = select('Country', Object.keys(countries!), 'france');
const colorSchema = select<any>(
'Color schema',
SequentialD3,
SequentialD3.find(x => x.id === 'schemeOranges'),
);
const [data, setData] = useState<JsonObject>();
useEffect(() => {
const controller = new AbortController();
const { signal } = controller;
fetch(countries[country], { signal })
.then(resp => resp.json())
.then(geojson => {
setData(generateData(geojson));
});
return () => {
controller.abort();
};
}, [country]);
if (!data) {
return (
<div style={{ color: '#aaa', textAlign: 'center', padding: 20 }}>
Loading...
</div>
);
}
return (
<SuperChart
chartType="country-map"
width={width}
height={height}
queriesData={[{ data }]}
formData={{
linearColorScheme: colorSchema.id,
numberFormat: '.3s',
selectCountry: country,
}}
/>
);
};
| superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-country-map/CountryMapStories.tsx | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00017677934374660254,
0.0001726898190099746,
0.00016377470456063747,
0.0001735451223794371,
0.000003720020231412491
] |
{
"id": 4,
"code_window": [
" symbolSize: showMarkers ? markerSize : 0,\n",
" lineStyle: {\n",
" opacity: parseAnnotationOpacity(opacity),\n",
" type: style as ZRLineType,\n",
" width: hideLine ? 0 : width,\n",
" },\n",
" });\n",
" });\n",
" }\n",
" return series;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" color: color || colorScale(name, sliceId),\n"
],
"file_path": "superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts",
"type": "add",
"edit_start_line_idx": 437
} | /* eslint-disable camelcase */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { GenericDataType } from './QueryResponse';
export interface AdhocColumn {
hasCustomLabel?: boolean;
label?: string;
optionName?: string;
sqlExpression: string;
expressionType: 'SQL';
}
/**
* A column that is physically defined in datasource.
*/
export type PhysicalColumn = string;
/**
* Column information defined in datasource.
*/
export interface Column {
id: number;
type?: string;
type_generic?: GenericDataType;
column_name: string;
groupby?: boolean;
is_dttm?: boolean;
filterable?: boolean;
verbose_name?: string | null;
description?: string | null;
expression?: string | null;
database_expression?: string | null;
python_date_format?: string | null;
}
export default {};
export function isPhysicalColumn(
column?: AdhocColumn | PhysicalColumn,
): column is PhysicalColumn {
return typeof column === 'string';
}
export function isAdhocColumn(column?: AdhocColumn | PhysicalColumn) {
return (column as AdhocColumn)?.sqlExpression !== undefined;
}
| superset-frontend/packages/superset-ui-core/src/query/types/Column.ts | 0 | https://github.com/apache/superset/commit/11562971fb95a601d11b2902f1704b72409f302d | [
0.00022917869500815868,
0.00018039481074083596,
0.00016761646838858724,
0.00017293360724579543,
0.000020073994164704345
] |
{
"id": 0,
"code_window": [
"_Note: Gaps between patch versions are faulty/broken releases._\n",
"\n",
"See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.\n",
"\n",
"## 4.7.10\n",
"\n",
" * **Internal**\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"## 4.7.11\n",
"\n",
" * **Bug Fix**\n",
" * Fix unicode regexes stripping their unicode flag before being passed on two `regexpu`.\n",
"\n"
],
"file_path": "CHANGELOG.md",
"type": "add",
"edit_start_line_idx": 15
} | import rewritePattern from "regexpu/rewrite-pattern";
import * as regex from "../../helpers/regex";
export function check(node) {
return regex.is(node, "u");
}
export function Literal(node) {
if (!regex.is(node, "u")) return;
regex.pullFlag(node, "u");
node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);
}
| src/babel/transformation/transformers/es6/regex.unicode.js | 1 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.00017199135618284345,
0.00017036605277098715,
0.00016874073480721563,
0.00017036605277098715,
0.0000016253106878139079
] |
{
"id": 0,
"code_window": [
"_Note: Gaps between patch versions are faulty/broken releases._\n",
"\n",
"See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.\n",
"\n",
"## 4.7.10\n",
"\n",
" * **Internal**\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"## 4.7.11\n",
"\n",
" * **Bug Fix**\n",
" * Fix unicode regexes stripping their unicode flag before being passed on two `regexpu`.\n",
"\n"
],
"file_path": "CHANGELOG.md",
"type": "add",
"edit_start_line_idx": 15
} | var t = () => 5 + 5;
| test/fixtures/transformation/es6-arrow-functions/empty-arguments/actual.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.00017508072778582573,
0.00017508072778582573,
0.00017508072778582573,
0.00017508072778582573,
0
] |
{
"id": 0,
"code_window": [
"_Note: Gaps between patch versions are faulty/broken releases._\n",
"\n",
"See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.\n",
"\n",
"## 4.7.10\n",
"\n",
" * **Internal**\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"## 4.7.11\n",
"\n",
" * **Bug Fix**\n",
" * Fix unicode regexes stripping their unicode flag before being passed on two `regexpu`.\n",
"\n"
],
"file_path": "CHANGELOG.md",
"type": "add",
"edit_start_line_idx": 15
} | import foo, {baz as xyz} from "foo";
| test/fixtures/transformation/es6-modules-system/imports-mixing/actual.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.00017040077364072204,
0.00017040077364072204,
0.00017040077364072204,
0.00017040077364072204,
0
] |
{
"id": 0,
"code_window": [
"_Note: Gaps between patch versions are faulty/broken releases._\n",
"\n",
"See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.\n",
"\n",
"## 4.7.10\n",
"\n",
" * **Internal**\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"## 4.7.11\n",
"\n",
" * **Bug Fix**\n",
" * Fix unicode regexes stripping their unicode flag before being passed on two `regexpu`.\n",
"\n"
],
"file_path": "CHANGELOG.md",
"type": "add",
"edit_start_line_idx": 15
} | define(["exports", "foo", "babel-runtime/helpers/interop-require"], function (exports, _foo, _babelRuntimeHelpersInteropRequire) {
"use strict";
var _interopRequire = _babelRuntimeHelpersInteropRequire["default"];
var foo = _interopRequire(_foo);
}); | test/fixtures/transformation/runtime/modules-amd/expected.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.00016337230044882745,
0.00016337230044882745,
0.00016337230044882745,
0.00016337230044882745,
0
] |
{
"id": 1,
"code_window": [
"\n",
"export function Literal(node) {\n",
" if (!regex.is(node, \"u\")) return;\n",
" regex.pullFlag(node, \"u\");\n",
" node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep"
],
"after_edit": [],
"file_path": "src/babel/transformation/transformers/es6/regex.unicode.js",
"type": "replace",
"edit_start_line_idx": 9
} | # Changelog
> **Tags:**
> - [New Feature]
> - [Bug Fix]
> - [Spec Compliancy]
> - [Breaking Change]
> - [Documentation]
> - [Internal]
> - [Polish]
_Note: Gaps between patch versions are faulty/broken releases._
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
## 4.7.10
* **Internal**
* Deprecate `playground.methodBinding` and `playground.objectGetterMemoization`.
* **Bug Fix**
* Fix `inputSourceMap` option. Thanks [@Rich-Harris](https://github.com/Rich-Harris)!
## 4.7.9
* **Polish**
* Allow `inputSourceMap` to be set to `false` to skip the source map inference.
* Infer computed literal property names.
* **Bug Fix**
* Fix nested labeled for-ofs.
* Fix block scoping `break` colliding with the parent switch case.
* **Internal**
* Upgrade `acorn-babel`.
## 4.7.8
* **Bug Fix**
* Fix computed classes not properly setting symbols.
## 4.7.7
* **Bug Fix**
* Fix `types` API exposure.
## 4.7.6
* **Bug Fix**
* Fix non-Identifier/Literal computed class methods.
* **Polish**
* Add a fallback if `stack` on an error is unconfigurable.
* Hoist `esModule` module declarations to the top of the file to handle circular dependencies better.
## 4.7.5
* **Bug Fix**
* Don't remap` break`s to call the iterator return.
* **Polish**
* Use a different helper for computed classes for much nicer output. Also fixes a bug in symbols being non-enumerable so they wouldn't be set on the class.
## 4.7.4
* **Bug Fix**
* Rewrite named function expressions in optional async function transformers.
* Hoist directives.
* Remove `Number` from the list of valid `runtime` constructors.
* **Internal**
* `spec.typeofSymbol` transformer has been renamed to `es6.symbols`.
## 4.7.2
* **New Feature**
* `"both"` option for `sourceMap`.
* Add output types to external helpers. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
* **Bug Fix**
* Fix node duplication sometimes resulting in a recursion error.
* Ignore `break`s within cases inside `for...of`.
* **Polish**
* Split up variable declarations and export declarations to allow easier transformation.
## 4.7.0
* **Bug Fix**
* Add `alternate` to list of `STATEMENT_OR_BLOCK` keys.
* Add support for module specifiers to `t.isReferenced`.
* **New Feature**
* Add `inputSourceMap` option.
* **Polish**
* Throw an error on different `babel` and `babel-runtime` versions.
* Replicate module environment for `babel-node` eval.
* Clean up classes output.
* **Spec Compliancy**
* Make it illegal to use a rest parameter on a setter.
## 4.6.6
* **Bug Fix**
* Fix incorrect method call in `utility.deadCodeElimination` transformer.
* Fix `es6.blockScopingTDZ` transformer duplicating binding nodes.
## 4.6.5
* **Internal**
* `useStrict` transformer has been renamed to `strict`.
## 4.6.4
* **Bug Fix**
* Fix `ForOfStatement` not proplery inheriting labels.
* When in closure mode in block scoping transformer, properly check for variable shadowing.
* **New Feature**
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
## 4.6.3
* **Bug Fix**
* Fix `arguments` being incorrectly aliased in arrow function rest parameter optimisation.
* Make deoptimisation trigger safer.
* **New Feature**
* Flow types are now retained when blacklisting the `flow` transformer.
## 4.6.1
* **Bug Fix**
* Fix generators in template directory being transformed.
* Fix exposure of `util` for plugins.
## 4.6.0
* **New Feature**
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
* **Spec Compliancy**
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliancy in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
* **Polish**
* Rest parameters that are only refered to via number properties on member expressions are desugared into a direct `arguments` reference. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
* `$ babel` no longer exits on syntax errors.
* **Internal**
* Upgrade `browserify`.
* Upgrade `source-map`.
* Publicly expose more internals.
## 4.5.5
* **Polish**
* Delete old extensions when overriding them in `babel/register`.
## 4.5.3
* **Bug Fix**
* Fix whitelisting logic for helper build script.
## 4.5.2
* **New Feature**
* `returnUsedHelpers` option and add whitelist to `buildHelpers`.
* **Bug Fix**
* Fix function arity on self referencing inferred named functions.
* **Internal**
* Bump `acorn-babel`.
* Start converting source to ES6...
## 4.5.1
**Babel now compiles itself!**

## 4.5.0
* **New Feature**
* Add `.babelrc` support.
* **Bug Fix**
* Move use strict directives to the module formatter bodies.
* **Internal**
* Make default `bin/babel` behaviour to ignore non-compilable files and add a `--copy-files` flag to revert to the old behaviour.
## 4.4.6
* **Bug Fix**
* Fix extending a class expression with no methods/only constructor. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
* Allow `MemberExpression` as a valid `left` of `ForOfStatement`.
* **Polish**
* Throw an error when people try and transpile code with the `@jsx React.DOM` pragma as it conflicts with the custom jsx constructo method detection.
* Crawl all comments for `@jsx` pragma.
* **Internal**
* Upgrade `chalk`.
* Upgrade `core-js`.
## 4.4.5
* **Internal**
* Remove function self reference optimisation.
## 4.4.4
* **Bug Fix**
* Handle inferred function ids to be reassigned and deopt to a slower but working equivalent.
* Don't unpack array patterns that have more elements than their right hand array expression.
* **Polish**
* Improve syntax highlighting in the code frame. Thanks [@lydell](https://github.com/lydell)!
* **Internal**
* Upgrade `acorn-babel`.
## 4.4.3
* **Bug Fix**
* Fix `for...of` iterator break returns being duplicated.
* Only call `return` on the iterator if it exists.
* **Internal**
* Rename `selfContained` transformer to `runtime`.
## 4.4.2
* **New Feature**
* Add `moduleId` option for specifying a custom module id.
## 4.4.0
* **New Feature**
* `/*** @jsx NAMESPACE **/` comments are now honored by the `react` transformer.
* `getModuleName` option.
* Infer function expression names. Thanks [@RReverser](https://github.com/RReverser)!
* **Bug Fix**
* Add proper control flow for tail recursion optimisation.
* **Internal**
* Remove useless `format` options and move the `format.compact` option to `format`.
* **Polish**
* Newline handling of the code generator has been heavily improved.
* Code generator now deopts whitespace if the input size is >100KB.
## 4.3.0
* **Breaking Change**
* Remove `commonStandard` module formatter and make it the default behaviour of all the strict module formatters.
## 4.2.1
* **Polish**
* Add auxiliary comment to let scoping closure flow control.
## 4.2.0
* **Polish**
* Use an assignment instead of a define for `__esModule` in loose mode.
* **Internal**
* Add error for `eval();` usage and enable strict mode for parsing.
## 4.1.0
* **New Feature**
* Add `BABEL_CACHE_PATH` and `BABEL_DISABLE_CACHE` environment variables.
* **Internal**
* Replace many internal util functions with modules. Thanks [@sindresorhus](https://github.com/sindresorhus)!
## 4.0.2
* **Bug Fix**
* Fix generators not properly propagating their internal declarations.
* **Polish**
* Update setter param length error message.
* Use ranges on dependencies.
## 4.0.0
* 6to5 is now known as Babel.
* Global helpers/runtime has now been given the more descriptive name of "external helpers".
| CHANGELOG.md | 1 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.00017246462812181562,
0.0001670889469096437,
0.0001632394705666229,
0.00016652903286740184,
0.0000025572931008355226
] |
{
"id": 1,
"code_window": [
"\n",
"export function Literal(node) {\n",
" if (!regex.is(node, \"u\")) return;\n",
" regex.pullFlag(node, \"u\");\n",
" node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep"
],
"after_edit": [],
"file_path": "src/babel/transformation/transformers/es6/regex.unicode.js",
"type": "replace",
"edit_start_line_idx": 9
} | foo({
[bar]: "foobar"
});
| test/fixtures/transformation/es6-properties.computed-loose/argument/actual.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.0001698727282928303,
0.0001698727282928303,
0.0001698727282928303,
0.0001698727282928303,
0
] |
{
"id": 1,
"code_window": [
"\n",
"export function Literal(node) {\n",
" if (!regex.is(node, \"u\")) return;\n",
" regex.pullFlag(node, \"u\");\n",
" node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep"
],
"after_edit": [],
"file_path": "src/babel/transformation/transformers/es6/regex.unicode.js",
"type": "replace",
"edit_start_line_idx": 9
} | x | y ^ z;
x | (y ^ z);
(x | y) ^ z;
| test/fixtures/generation/edgecase/bitwise-precedence/actual.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.0001773599797161296,
0.0001773599797161296,
0.0001773599797161296,
0.0001773599797161296,
0
] |
{
"id": 1,
"code_window": [
"\n",
"export function Literal(node) {\n",
" if (!regex.is(node, \"u\")) return;\n",
" regex.pullFlag(node, \"u\");\n",
" node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep"
],
"after_edit": [],
"file_path": "src/babel/transformation/transformers/es6/regex.unicode.js",
"type": "replace",
"edit_start_line_idx": 9
} | import merge from "lodash/object/merge";
import path from "path";
import fs from "fs";
var cache = {};
function exists(filename) {
var cached = cache[filename];
if (cached != null) return cached;
return cache[filename] = fs.existsSync(filename);
}
export default function (loc, opts = {}) {
var rel = ".babelrc";
function find(start, rel) {
var file = path.join(start, rel);
if (exists(file)) {
var content = fs.readFileSync(file, "utf8");
var json;
try {
json = JSON.parse(content);
} catch (err) {
err.message = `${file}: ${err.message}`;
throw err;
}
if (json.breakConfig) return;
merge(opts, json, function(a, b) {
if (Array.isArray(a)) {
return a.concat(b);
}
});
}
var up = path.dirname(start);
if (up !== start) { // root
find(up, rel);
}
}
find(loc, rel);
return opts;
};
| src/babel/api/register/resolve-rc.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.00017607081099413335,
0.00017362996004521847,
0.0001695237006060779,
0.00017597294936422259,
0.000002952134536826634
] |
{
"id": 2,
"code_window": [
" node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);\n",
"}"
],
"labels": [
"add",
"keep"
],
"after_edit": [
" regex.pullFlag(node, \"u\");\n"
],
"file_path": "src/babel/transformation/transformers/es6/regex.unicode.js",
"type": "add",
"edit_start_line_idx": 11
} | import rewritePattern from "regexpu/rewrite-pattern";
import * as regex from "../../helpers/regex";
export function check(node) {
return regex.is(node, "u");
}
export function Literal(node) {
if (!regex.is(node, "u")) return;
regex.pullFlag(node, "u");
node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);
}
| src/babel/transformation/transformers/es6/regex.unicode.js | 1 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.9978773593902588,
0.5288012623786926,
0.059725139290094376,
0.5288012623786926,
0.46907609701156616
] |
{
"id": 2,
"code_window": [
" node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);\n",
"}"
],
"labels": [
"add",
"keep"
],
"after_edit": [
" regex.pullFlag(node, \"u\");\n"
],
"file_path": "src/babel/transformation/transformers/es6/regex.unicode.js",
"type": "add",
"edit_start_line_idx": 11
} | "use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var z = _extends({}, x);
| test/fixtures/transformation/es7-object-spread/variable-declaration/expected.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.00016979403153527528,
0.00016979403153527528,
0.00016979403153527528,
0.00016979403153527528,
0
] |
{
"id": 2,
"code_window": [
" node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);\n",
"}"
],
"labels": [
"add",
"keep"
],
"after_edit": [
" regex.pullFlag(node, \"u\");\n"
],
"file_path": "src/babel/transformation/transformers/es6/regex.unicode.js",
"type": "add",
"edit_start_line_idx": 11
} | import * as messages from "../../../messages";
import * as util from "../../../util";
import * as t from "../../../types";
export var check = t.isForOfStatement;
export function ForOfStatement(node, parent, scope, file) {
var callback = spec;
if (file.isLoose("es6.forOf")) callback = loose;
var build = callback(node, parent, scope, file);
var declar = build.declar;
var loop = build.loop;
var block = loop.body;
// inherit comments from the original loop
t.inheritsComments(loop, node);
// ensure that it's a block so we can take all its statements
t.ensureBlock(node);
// add the value declaration to the new loop body
if (declar) {
block.body.push(declar);
}
// push the rest of the original loop body onto our new body
block.body = block.body.concat(node.body.body);
t.inherits(loop, node);
// todo: find out why this is necessary? #538
loop._scopeInfo = node._scopeInfo;
if (build.replaceParent) this.parentPath.node = build.node;
return build.node;
}
var loose = function (node, parent, scope, file) {
var left = node.left;
var declar, id;
if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) {
// for (i of test), for ({ i } of test)
id = left;
} else if (t.isVariableDeclaration(left)) {
// for (var i of test)
id = scope.generateUidIdentifier("ref");
declar = t.variableDeclaration(left.kind, [
t.variableDeclarator(left.declarations[0].id, id)
]);
} else {
throw file.errorWithNode(left, messages.get("unknownForHead", left.type));
}
var iteratorKey = scope.generateUidIdentifier("iterator");
var isArrayKey = scope.generateUidIdentifier("isArray");
var loop = util.template("for-of-loose", {
LOOP_OBJECT: iteratorKey,
IS_ARRAY: isArrayKey,
OBJECT: node.right,
INDEX: scope.generateUidIdentifier("i"),
ID: id
});
if (!declar) {
// no declaration so we need to remove the variable declaration at the top of
// the for-of-loose template
loop.body.body.shift();
}
//
return {
declar: declar,
node: loop,
loop: loop
};
};
var spec = function (node, parent, scope, file) {
var left = node.left;
var declar;
var stepKey = scope.generateUidIdentifier("step");
var stepValue = t.memberExpression(stepKey, t.identifier("value"));
if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) {
// for (i of test), for ({ i } of test)
declar = t.expressionStatement(t.assignmentExpression("=", left, stepValue));
} else if (t.isVariableDeclaration(left)) {
// for (var i of test)
declar = t.variableDeclaration(left.kind, [
t.variableDeclarator(left.declarations[0].id, stepValue)
]);
} else {
throw file.errorWithNode(left, messages.get("unknownForHead", left.type));
}
//
var iteratorKey = scope.generateUidIdentifier("iterator");
var template = util.template("for-of", {
ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"),
ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"),
ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"),
ITERATOR_KEY: iteratorKey,
STEP_KEY: stepKey,
OBJECT: node.right,
BODY: null
});
var isLabeledParent = t.isLabeledStatement(parent);
var tryBody = template[3].block.body;
var loop = tryBody[0];
if (isLabeledParent) {
tryBody[0] = t.labeledStatement(parent.label, loop);
}
//
return {
replaceParent: isLabeledParent,
declar: declar,
loop: loop,
node: template
};
};
| src/babel/transformation/transformers/es6/for-of.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.11440221965312958,
0.01357270497828722,
0.0001636526285437867,
0.001102800597436726,
0.029706621542572975
] |
{
"id": 2,
"code_window": [
" node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);\n",
"}"
],
"labels": [
"add",
"keep"
],
"after_edit": [
" regex.pullFlag(node, \"u\");\n"
],
"file_path": "src/babel/transformation/transformers/es6/regex.unicode.js",
"type": "add",
"edit_start_line_idx": 11
} | var hello = `hello`;
var hello = `
line
terminators`;
var tagged = tagged`hello`;
var tagged = member.call`hello`;
var tagged = new call`hello`;
var tagged = new (call`hello`());
var tageed = member[call`hello`];
var middles = `
Is the order a rabbit?
`;
var middles = `
Is the order ${ order }?
`;
var middles = `
Is the order ${ order }?
`;
var middles = `
1. ${ cocoa }
2. ${ chino }
3. ${ rize }
4. ${ syaro }
5. ${ chiya }
`;
| test/fixtures/generation/harmony-edgecase/templates/actual.js | 0 | https://github.com/babel/babel/commit/24807120bf63a33e5ccffbc4d3dbc7a21a033a6b | [
0.00018113046826329082,
0.00017490072059445083,
0.00017217858112417161,
0.0001731468946672976,
0.0000036642263694375288
] |
{
"id": 0,
"code_window": [
" pathname: '/guides/flow',\n",
" },\n",
" {\n",
" pathname: '/guides/typescript',\n",
" },\n",
" {\n",
" pathname: '/guides/right-to-left',\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
" title: 'TypeScript',\n"
],
"file_path": "docs/src/modules/components/withRoot.js",
"type": "add",
"edit_start_line_idx": 91
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00022540065401699394,
0.00017504763673059642,
0.00016488076653331518,
0.0001688258780632168,
0.000015811918274266645
] |
{
"id": 0,
"code_window": [
" pathname: '/guides/flow',\n",
" },\n",
" {\n",
" pathname: '/guides/typescript',\n",
" },\n",
" {\n",
" pathname: '/guides/right-to-left',\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
" title: 'TypeScript',\n"
],
"file_path": "docs/src/modules/components/withRoot.js",
"type": "add",
"edit_start_line_idx": 91
} | // @flow
import React from 'react';
import { assert } from 'chai';
import { createShallow, getClasses } from '../test-utils';
import TableRow from './TableRow';
describe('<TableRow />', () => {
let shallow;
let classes;
before(() => {
shallow = createShallow({ dive: true });
classes = getClasses(<TableRow />);
});
it('should render a tr', () => {
const wrapper = shallow(<TableRow />);
assert.strictEqual(wrapper.name(), 'tr');
});
it('should render a div', () => {
const wrapper = shallow(<TableRow component="div" />);
assert.strictEqual(wrapper.name(), 'div');
});
it('should spread custom props on the root node', () => {
const wrapper = shallow(<TableRow data-my-prop="woofTableRow" />);
assert.strictEqual(
wrapper.prop('data-my-prop'),
'woofTableRow',
'custom prop should be woofTableRow',
);
});
it('should render with the user and root classes', () => {
const wrapper = shallow(<TableRow className="woofTableRow" />);
assert.strictEqual(wrapper.hasClass('woofTableRow'), true);
assert.strictEqual(wrapper.hasClass(classes.root), true);
});
it('should render children', () => {
const children = <td className="test" />;
const wrapper = shallow(<TableRow>{children}</TableRow>);
assert.strictEqual(wrapper.childAt(0).equals(children), true);
});
it('should render with the head class when in the context of a table head', () => {
const wrapper = shallow(<TableRow />);
wrapper.setContext({ table: { head: true } });
assert.strictEqual(wrapper.hasClass(classes.root), true);
assert.strictEqual(wrapper.hasClass(classes.head), true, 'should have the head class');
});
it('should render with the footer class when in the context of a table footer', () => {
const wrapper = shallow(<TableRow />);
wrapper.setContext({ table: { footer: true } });
assert.strictEqual(wrapper.hasClass(classes.root), true);
assert.strictEqual(wrapper.hasClass(classes.footer), true, 'should have the footer class');
});
});
| src/Table/TableRow.spec.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017687173385638744,
0.0001725345355225727,
0.0001699762506177649,
0.00017168314661830664,
0.0000022643248485110234
] |
{
"id": 0,
"code_window": [
" pathname: '/guides/flow',\n",
" },\n",
" {\n",
" pathname: '/guides/typescript',\n",
" },\n",
" {\n",
" pathname: '/guides/right-to-left',\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
" title: 'TypeScript',\n"
],
"file_path": "docs/src/modules/components/withRoot.js",
"type": "add",
"edit_start_line_idx": 91
} | // flow-typed signature: b348c864c3d29e0464f632d630c1c7fb
// flow-typed version: <<STUB>>/babel-plugin-istanbul_v^4.1.5/flow_v0.59.0
/**
* This is an autogenerated libdef stub for:
*
* 'babel-plugin-istanbul'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'babel-plugin-istanbul' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'babel-plugin-istanbul/lib/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'babel-plugin-istanbul/lib/index.js' {
declare module.exports: $Exports<'babel-plugin-istanbul/lib/index'>;
}
| flow-typed/npm/babel-plugin-istanbul_vx.x.x.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00023568709730170667,
0.00018633359286468476,
0.000166392041137442,
0.00017162760195787996,
0.00002859501910279505
] |
{
"id": 0,
"code_window": [
" pathname: '/guides/flow',\n",
" },\n",
" {\n",
" pathname: '/guides/typescript',\n",
" },\n",
" {\n",
" pathname: '/guides/right-to-left',\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
" title: 'TypeScript',\n"
],
"file_path": "docs/src/modules/components/withRoot.js",
"type": "add",
"edit_start_line_idx": 91
} | import * as React from 'react';
import {
withStyles,
WithStyles,
createMuiTheme,
MuiThemeProvider,
Theme,
withTheme,
StyleRules,
} from '../../src/styles';
import Button from '../../src/Button/Button';
import { StyleRulesCallback } from '../../src/styles/withStyles';
import { Contrast } from '../../src/index';
import {WithTheme} from "../../src/styles/withTheme";
// Shared types for examples
type ComponentClassNames = 'root';
interface ComponentProps {
text: string;
}
// Example 1
const styles: StyleRulesCallback<'root'> = ({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
});
const StyledExampleOne = withStyles(styles)<
ComponentProps
>(({ classes, text }) => <div className={classes.root}>{text}</div>);
<StyledExampleOne text="I am styled!" />;
// Example 2
const Component: React.SFC<
ComponentProps & WithStyles<ComponentClassNames>
> = ({ classes, text }) => <div className={classes.root}>{text}</div>;
const StyledExampleTwo = withStyles(styles)(Component);
<StyledExampleTwo text="I am styled!" />;
// Example 3
const styleRule: StyleRules<ComponentClassNames> = {
root: {
display: 'flex',
alignItems: 'stretch',
height: '100vh',
width: '100%',
},
};
const ComponentWithChildren: React.SFC<WithStyles<ComponentClassNames>> = ({
classes,
children,
}) => <div className={classes.root}>{children}</div>;
const StyledExampleThree = withStyles(styleRule)<{}>(ComponentWithChildren);
<StyledExampleThree />;
// Also works with a plain object
const stylesAsPojo = {
root: {
background: 'hotpink',
},
};
const AnotherStyledSFC = withStyles({
root: { background: 'hotpink' },
})(({ classes }) => <div className={classes.root}>Stylish!</div>);
// Overriding styles
const theme = createMuiTheme({
palette: {
type: 'dark',
common: {
white: '#ffffff',
},
},
typography: {
display4: {
fontSize: 24,
},
fontSize: 18,
},
mixins: {
toolbar: {
backgroundColor: 'red',
}
},
breakpoints: {
step: 3,
},
transitions: {
duration: {
short: 50,
},
},
spacing: {},
zIndex: {
appBar: 42,
},
overrides: {
MuiButton: {
// Name of the styleSheet
root: {
// Name of the rule
background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
borderRadius: 3,
border: 0,
color: 'white',
height: 48,
padding: '0 30px',
boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .30)',
},
},
},
});
function OverridesTheme() {
return (
<MuiThemeProvider theme={theme}>
<Button>{'Overrides'}</Button>
</MuiThemeProvider>
);
}
// withTheme
const ComponentWithTheme = withTheme()(
({ theme }) => (
<div>{theme.spacing.unit}</div>
)
);
<ComponentWithTheme />
// withStyles + withTheme
type AllTheProps = WithTheme & WithStyles<'root'>
const AllTheComposition = withTheme()(
withStyles(styles)(
({ theme, classes }: AllTheProps) => (
<div className={classes.root}>{theme.palette.text.primary}</div>
)));
<AllTheComposition />
// Can't use withStyles effectively as a decorator in TypeScript
// due to https://github.com/Microsoft/TypeScript/issues/4881
//@withStyles(styles)
const DecoratedComponent = withStyles(styles)(
class extends React.Component<ComponentProps & WithStyles<'root'>> {
render() {
const { classes, text } = this.props;
return <div className={classes.root}>{text}</div>;
}
}
);
// no 'classes' property required at element creation time (#8267)
<DecoratedComponent text="foo" />;
| test/typescript/styles.spec.tsx | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0009839789709076285,
0.00022049884137231857,
0.00016487778339069337,
0.0001725445908959955,
0.00019094301387667656
] |
{
"id": 1,
"code_window": [
"\n",
"- [dx-react-grid-material-ui](https://devexpress.github.io/devextreme-reactive/react/grid/) A data grid for Material-UI with paging, sorting, filtering, grouping and editing features.\n",
"- [material-ui-pickers](https://github.com/dmtrKovalenko/material-ui-pickers) Components, that implement Material Design date and time pickers for Material-UI.\n",
"- [material-ui-time-picker](https://github.com/TeamWertarbyte/material-ui-time-picker) A TimePicker for Material-UI.\n",
"- [mui-datatables](https://github.com/gregnb/mui-datatables) Responsive data tables for Material-UI with filtering, sorting, search and more.\n",
"\n",
"## Complementary Projects\n",
"\n",
"- [react-autosuggest](https://github.com/moroshko/react-autosuggest) WAI-ARIA compliant React autosuggest component.\n",
"- [react-number-format](https://github.com/s-yadav/react-number-format) React component to format numbers in an input or as a text.\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"- [Wertarbyte](https://next.mui.wertarbyte.com/) Wertarbyte are using Material-UI for many of their projects. This is a collection of complimentary components they have built.\n"
],
"file_path": "docs/src/pages/discover-more/related-projects.md",
"type": "add",
"edit_start_line_idx": 13
} | import React from 'react';
import PropTypes from 'prop-types';
import find from 'lodash/find';
import { Provider } from 'react-redux';
import pure from 'recompose/pure';
import AppWrapper from 'docs/src/modules/components/AppWrapper';
import initRedux from 'docs/src/modules/redux/initRedux';
import findPages from /* preval */ 'docs/src/modules/utils/findPages';
import { loadCSS } from 'fg-loadcss/src/loadCSS';
if (process.browser) {
loadCSS(
'https://fonts.googleapis.com/icon?family=Material+Icons',
document.querySelector('#insertion-point-jss'),
);
loadCSS(
'https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css',
document.querySelector('#insertion-point-jss'),
);
}
const pages = [
{
pathname: '/getting-started',
children: [
{
pathname: '/getting-started/installation',
},
{
pathname: '/getting-started/usage',
},
{
pathname: '/getting-started/example-projects',
},
{
pathname: '/getting-started/supported-components',
},
{
pathname: '/getting-started/supported-platforms',
},
{
pathname: '/getting-started/frequently-asked-questions',
},
],
},
{
pathname: '/customization',
children: [
{
pathname: '/customization/overrides',
},
{
pathname: '/customization/themes',
},
{
pathname: '/customization/css-in-js',
title: 'CSS in JS',
},
],
},
{
pathname: '/guides',
children: [
{
pathname: '/guides/api',
title: 'API',
},
{
pathname: '/guides/composition',
},
{
pathname: '/guides/minimizing-bundle-size',
},
{
pathname: '/guides/server-rendering',
},
{
pathname: '/guides/testing',
},
{
pathname: '/guides/migration-v0.x',
title: 'Migration from v0.x',
},
{
pathname: '/guides/comparison',
},
{
pathname: '/guides/flow',
},
{
pathname: '/guides/typescript',
},
{
pathname: '/guides/right-to-left',
title: 'Right-to-left',
},
{
pathname: '/guides/interoperability',
title: 'Style Library Interoperability',
},
],
},
{
pathname: '/style',
children: [
{
pathname: '/style/reboot',
},
{
pathname: '/style/color',
},
{
pathname: '/style/icons',
},
{
pathname: '/style/typography',
},
],
},
{
pathname: '/layout',
children: [
{
pathname: '/layout/basics',
},
{
pathname: '/layout/grid',
},
{
pathname: '/layout/hidden',
},
{
pathname: '/layout/css-in-js',
title: 'CSS in JS',
},
{
pathname: '/layout/portal',
},
],
},
{
...findPages[1],
title: 'Component Demos',
},
{
...findPages[0],
title: 'Component API',
},
{
pathname: '/discover-more',
children: [
{
pathname: '/discover-more/vision',
},
{
pathname: '/discover-more/backers',
title: 'Sponsors & Backers',
},
{
pathname: '/discover-more/community',
},
{
pathname: '/discover-more/showcase',
},
{
pathname: '/discover-more/related-projects',
},
{
pathname: '/discover-more/roadmap',
},
{
pathname: '/discover-more/team',
},
{
pathname: '/discover-more/governance',
},
],
},
{
pathname: '/',
title: false,
},
];
function findActivePage(currentPages, url) {
const activePage = find(currentPages, page => {
if (page.children) {
return url.pathname.indexOf(page.pathname) !== -1;
}
// Should be an exact match if no children
return url.pathname === page.pathname;
});
if (!activePage) {
return null;
}
// We need to drill down
if (activePage.pathname !== url.pathname) {
return findActivePage(activePage.children, url);
}
return activePage;
}
function withRoot(BaseComponent) {
// Prevent rerendering
const PureBaseComponent = pure(BaseComponent);
type WithRootProps = {
reduxServerState?: Object,
sheetsRegistry?: Object,
url: Object,
};
class WithRoot extends React.Component<WithRootProps> {
static childContextTypes = {
url: PropTypes.object,
pages: PropTypes.array,
activePage: PropTypes.object,
};
static getInitialProps(ctx) {
let initialProps = {};
const redux = initRedux({});
if (BaseComponent.getInitialProps) {
const baseComponentInitialProps = BaseComponent.getInitialProps({ ...ctx, redux });
initialProps = {
...baseComponentInitialProps,
...initialProps,
};
}
if (process.browser) {
return initialProps;
}
return {
...initialProps,
// No need to include other initial Redux state because when it
// initialises on the client-side it'll create it again anyway
reduxServerState: redux.getState(),
};
}
constructor(props, context) {
super(props, context);
this.redux = initRedux(this.props.reduxServerState || {});
}
getChildContext() {
return {
url: this.props.url ? this.props.url : null,
pages,
activePage: findActivePage(pages, this.props.url),
};
}
redux = null;
render() {
const { sheetsRegistry, ...other } = this.props;
return (
<Provider store={this.redux}>
<AppWrapper sheetsRegistry={sheetsRegistry}>
<PureBaseComponent initialProps={other} />
</AppWrapper>
</Provider>
);
}
}
return WithRoot;
}
export default withRoot;
| docs/src/modules/components/withRoot.js | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00018485910550225526,
0.00016610973398201168,
0.0001634290092624724,
0.0001652309438213706,
0.000003872624802170321
] |
{
"id": 1,
"code_window": [
"\n",
"- [dx-react-grid-material-ui](https://devexpress.github.io/devextreme-reactive/react/grid/) A data grid for Material-UI with paging, sorting, filtering, grouping and editing features.\n",
"- [material-ui-pickers](https://github.com/dmtrKovalenko/material-ui-pickers) Components, that implement Material Design date and time pickers for Material-UI.\n",
"- [material-ui-time-picker](https://github.com/TeamWertarbyte/material-ui-time-picker) A TimePicker for Material-UI.\n",
"- [mui-datatables](https://github.com/gregnb/mui-datatables) Responsive data tables for Material-UI with filtering, sorting, search and more.\n",
"\n",
"## Complementary Projects\n",
"\n",
"- [react-autosuggest](https://github.com/moroshko/react-autosuggest) WAI-ARIA compliant React autosuggest component.\n",
"- [react-number-format](https://github.com/s-yadav/react-number-format) React component to format numbers in an input or as a text.\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"- [Wertarbyte](https://next.mui.wertarbyte.com/) Wertarbyte are using Material-UI for many of their projects. This is a collection of complimentary components they have built.\n"
],
"file_path": "docs/src/pages/discover-more/related-projects.md",
"type": "add",
"edit_start_line_idx": 13
} | import React from 'react';
import withRoot from 'docs/src/modules/components/withRoot';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from './reboot.md';
function Page() {
return <MarkdownDocs markdown={markdown} />;
}
export default withRoot(Page);
| pages/api/reboot.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00040022554458118975,
0.0002831941528711468,
0.00016616277571301907,
0.0002831941528711468,
0.00011703138443408534
] |
{
"id": 1,
"code_window": [
"\n",
"- [dx-react-grid-material-ui](https://devexpress.github.io/devextreme-reactive/react/grid/) A data grid for Material-UI with paging, sorting, filtering, grouping and editing features.\n",
"- [material-ui-pickers](https://github.com/dmtrKovalenko/material-ui-pickers) Components, that implement Material Design date and time pickers for Material-UI.\n",
"- [material-ui-time-picker](https://github.com/TeamWertarbyte/material-ui-time-picker) A TimePicker for Material-UI.\n",
"- [mui-datatables](https://github.com/gregnb/mui-datatables) Responsive data tables for Material-UI with filtering, sorting, search and more.\n",
"\n",
"## Complementary Projects\n",
"\n",
"- [react-autosuggest](https://github.com/moroshko/react-autosuggest) WAI-ARIA compliant React autosuggest component.\n",
"- [react-number-format](https://github.com/s-yadav/react-number-format) React component to format numbers in an input or as a text.\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"- [Wertarbyte](https://next.mui.wertarbyte.com/) Wertarbyte are using Material-UI for many of their projects. This is a collection of complimentary components they have built.\n"
],
"file_path": "docs/src/pages/discover-more/related-projects.md",
"type": "add",
"edit_start_line_idx": 13
} | import * as React from 'react';
import { Breakpoint } from '../styles/createBreakpoints';
export interface HiddenJsProps {
only?: Breakpoint | Array<Breakpoint>;
xsUp?: boolean;
smUp?: boolean;
mdUp?: boolean;
lgUp?: boolean;
xlUp?: boolean;
xsDown?: boolean;
smDown?: boolean;
mdDown?: boolean;
lgDown?: boolean;
xlDown?: boolean;
}
declare const HiddenJs: React.ComponentType<HiddenJsProps>;
export default HiddenJs;
| src/Hidden/HiddenJs.d.ts | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00040022554458118975,
0.00024360709358006716,
0.000165000616107136,
0.00016559513460379094,
0.00011074623034801334
] |
{
"id": 1,
"code_window": [
"\n",
"- [dx-react-grid-material-ui](https://devexpress.github.io/devextreme-reactive/react/grid/) A data grid for Material-UI with paging, sorting, filtering, grouping and editing features.\n",
"- [material-ui-pickers](https://github.com/dmtrKovalenko/material-ui-pickers) Components, that implement Material Design date and time pickers for Material-UI.\n",
"- [material-ui-time-picker](https://github.com/TeamWertarbyte/material-ui-time-picker) A TimePicker for Material-UI.\n",
"- [mui-datatables](https://github.com/gregnb/mui-datatables) Responsive data tables for Material-UI with filtering, sorting, search and more.\n",
"\n",
"## Complementary Projects\n",
"\n",
"- [react-autosuggest](https://github.com/moroshko/react-autosuggest) WAI-ARIA compliant React autosuggest component.\n",
"- [react-number-format](https://github.com/s-yadav/react-number-format) React component to format numbers in an input or as a text.\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"- [Wertarbyte](https://next.mui.wertarbyte.com/) Wertarbyte are using Material-UI for many of their projects. This is a collection of complimentary components they have built.\n"
],
"file_path": "docs/src/pages/discover-more/related-projects.md",
"type": "add",
"edit_start_line_idx": 13
} | import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import MobileStepper from 'material-ui/MobileStepper';
import Paper from 'material-ui/Paper';
import Typography from 'material-ui/Typography';
import Button from 'material-ui/Button';
import KeyboardArrowLeft from 'material-ui-icons/KeyboardArrowLeft';
import KeyboardArrowRight from 'material-ui-icons/KeyboardArrowRight';
const styles = theme => ({
root: {
maxWidth: 400,
flexGrow: 1,
},
header: {
display: 'flex',
alignItems: 'center',
height: 50,
paddingLeft: theme.spacing.unit * 4,
marginBottom: 20,
background: theme.palette.background.default,
},
});
class TextMobileStepper extends React.Component {
state = {
activeStep: 0,
};
handleNext = () => {
this.setState({
activeStep: this.state.activeStep + 1,
});
};
handleBack = () => {
this.setState({
activeStep: this.state.activeStep - 1,
});
};
render() {
const { classes, theme } = this.props;
return (
<div className={classes.root}>
<Paper square elevation={0} className={classes.header}>
<Typography>Step {this.state.activeStep + 1} of 6</Typography>
</Paper>
<MobileStepper
type="text"
steps={6}
position="static"
activeStep={this.state.activeStep}
className={classes.mobileStepper}
nextButton={
<Button dense onClick={this.handleNext} disabled={this.state.activeStep === 5}>
Next
{theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
</Button>
}
backButton={
<Button dense onClick={this.handleBack} disabled={this.state.activeStep === 0}>
{theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
Back
</Button>
}
/>
</div>
);
}
}
TextMobileStepper.propTypes = {
classes: PropTypes.object.isRequired,
theme: PropTypes.object.isRequired,
};
export default withStyles(styles, { withTheme: true })(TextMobileStepper);
| docs/src/pages/demos/stepper/TextMobileStepper.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00040022609755396843,
0.0001999448286369443,
0.00016533007146790624,
0.00016740162391215563,
0.00007180684042396024
] |
{
"id": 2,
"code_window": [
"Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:\n",
"\n",
"```jsx\n",
"const DecoratedClass = decorate(\n",
" class extends React.Component<Props & WithStyles<'root'>> {\n",
" render() {\n",
" const { text, type, color, classes } = this.props\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 42
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.9977280497550964,
0.14883729815483093,
0.0001647247263463214,
0.0024339165538549423,
0.32733505964279175
] |
{
"id": 2,
"code_window": [
"Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:\n",
"\n",
"```jsx\n",
"const DecoratedClass = decorate(\n",
" class extends React.Component<Props & WithStyles<'root'>> {\n",
" render() {\n",
" const { text, type, color, classes } = this.props\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 42
} | import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
const styles = theme => ({
root: theme.typography.button,
});
function TypographyTheme(props) {
return <div className={props.classes.root}>This div looks like a button.</div>;
}
TypographyTheme.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(TypographyTheme);
| docs/src/pages/style/TypographyTheme.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0003135428996756673,
0.00023841485381126404,
0.00016328679339494556,
0.00023841485381126404,
0.00007512805314036086
] |
{
"id": 2,
"code_window": [
"Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:\n",
"\n",
"```jsx\n",
"const DecoratedClass = decorate(\n",
" class extends React.Component<Props & WithStyles<'root'>> {\n",
" render() {\n",
" const { text, type, color, classes } = this.props\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 42
} | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
const SvgIconCustom = global.__MUI_SvgIcon__ || SvgIcon;
let MoreVert = props =>
<SvgIconCustom {...props}>
<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" />
</SvgIconCustom>;
MoreVert = pure(MoreVert);
MoreVert.muiName = 'SvgIcon';
export default MoreVert;
| packages/material-ui-icons/src/MoreVert.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0001733008975861594,
0.00017022024258039892,
0.0001671395730227232,
0.00017022024258039892,
0.000003080662281718105
] |
{
"id": 2,
"code_window": [
"Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:\n",
"\n",
"```jsx\n",
"const DecoratedClass = decorate(\n",
" class extends React.Component<Props & WithStyles<'root'>> {\n",
" render() {\n",
" const { text, type, color, classes } = this.props\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 42
} | // This is using the API from https://github.com/vesparny/brcast
interface MuiContext {
getState(): Object;
subscribe(callback: Function): Function;
}
export interface ThemeListener {
contextTypes: {
'material-ui': object;
};
initial(context: Object): Object;
subscribe(context: Object, callback: Function): Function;
}
export default ThemeListener;
| src/styles/themeListener.d.ts | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0001742217573337257,
0.000173883032402955,
0.0001735443074721843,
0.000173883032402955,
3.387249307706952e-7
] |
{
"id": 3,
"code_window": [
" return (\n",
" <Typography type={type} color={color} classes={classes}>\n",
" {text}\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 50
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.33394894003868103,
0.023352423682808876,
0.00016313366359099746,
0.0005302062490954995,
0.08302856236696243
] |
{
"id": 3,
"code_window": [
" return (\n",
" <Typography type={type} color={color} classes={classes}>\n",
" {text}\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 50
} | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M422.625 18.28c-24.68.13-51.932 15.455-74.094 36.907 1.868 1.036 3.742 2.07 5.626 3.157 8.05 4.642 15.615 9.363 22.72 14.125 25.19-9.583 55.47-14.465 103.437-2.97-12.036-37.07-33.633-51.345-57.688-51.22zM237.78 40.22l28.97 94.25c12.57 6.443 24.827 13.41 36.813 20.843l-36.625-111.97c-8.476-1.68-16.657-2.662-24.563-3-1.54-.065-3.074-.108-4.594-.124zm-19.218 1.124c-1.602.206-3.202.427-4.78.687-8.815 1.454-17.338 3.755-25.595 6.876l15.688 58.625c13.62 4.75 26.922 10.064 39.906 15.907l-25.218-82.093zm69.875 7.593l40.157 122.876c15.922 11.124 31.32 23.128 46.25 35.906L325.906 64.374c-13.092-6.527-25.568-11.643-37.47-15.438zm-117.5 7.844c-14.657 7.857-28.523 18.348-41.875 31.095 18.42 3.334 36.298 7.632 53.657 12.813L170.937 56.78zm179.25 20.907l53.282 155.97c10.798 10.382 21.322 21.187 31.624 32.374.395-1.174.75-2.332 1.125-3.5L379.843 97.407c-8.84-6.63-18.706-13.185-29.656-19.72zM136.595 108.25c-17.05 11.436-32.43 27.876-45.344 50.22-42.303 73.19-61.83 198.325-24.53 265.717l-.064-.062c.752 23.392-7.597 45.63-17.812 67.594 27.268-12.192 54.897-17.815 82.687-20.783l-.468-.343c87.895 19.01 212.87-49.42 260.688-132.156 13.547-23.44 20.606-46.14 22.28-67.72-77.218-81.572-166.868-139.912-277.436-162.468zm271.469 14L444.188 228c2.638-20.573.96-39.855-5.688-58.25-5.856-16.202-15.717-32.01-30.438-47.5z" /></svg> | packages/material-ui-icons/test/fixtures/game-icons/svg/icons/lorc/originals/svg/000000/transparent/acorn.svg | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0017624679021537304,
0.0017624679021537304,
0.0017624679021537304,
0.0017624679021537304,
0
] |
{
"id": 3,
"code_window": [
" return (\n",
" <Typography type={type} color={color} classes={classes}>\n",
" {text}\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 50
} | ---
filename: /src/Table/Table.js
---
<!--- This documentation is automatically generated, do not try to edit it. -->
# Table
## Props
| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| <span style="color: #31a148">children *</span> | node | | The content of the table, normally `TableHeader` and `TableBody`. |
| classes | object | | Useful to extend the style applied to components. |
| component | union: string |<br> func<br> | 'table' | The component used for the root node. Either a string to use a DOM element or a component. |
Any other properties supplied will be [spread to the root element](/guides/api#spread).
## CSS API
You can override all the class names injected by Material-UI thanks to the `classes` property.
This property accepts the following keys:
- `root`
Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) section
and the [implementation of the component](https://github.com/mui-org/material-ui/tree/v1-beta/src/Table/Table.js)
for more detail.
If using the `overrides` key of the theme as documented
[here](/customization/themes#customizing-all-instances-of-a-component-type),
you need to use the following style sheet name: `MuiTable`.
## Demos
- [Tables](/demos/tables)
| pages/api/table.md | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00016505994426552206,
0.00016349456564057618,
0.00016101125220302492,
0.00016395353304687887,
0.0000015288326267182129
] |
{
"id": 3,
"code_window": [
" return (\n",
" <Typography type={type} color={color} classes={classes}>\n",
" {text}\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 50
} | import React from 'react';
import { assert } from 'chai';
import { createShallow, getClasses, createMount } from '../test-utils';
import consoleErrorMock from '../../test/utils/consoleErrorMock';
import { MenuItem } from '../Menu';
import Input from '../Input';
import Select from './Select';
describe('<Select />', () => {
let shallow;
let classes;
let mount;
const props = {
input: <Input />,
children: [<MenuItem value="1">1</MenuItem>, <MenuItem value="2">2</MenuItem>],
};
before(() => {
shallow = createShallow({ dive: true });
classes = getClasses(<Select {...props} />);
mount = createMount();
});
after(() => {
mount.cleanUp();
});
it('should render a correct top element', () => {
const wrapper = shallow(<Select {...props} />);
assert.strictEqual(wrapper.type(), Input);
});
it('should provide the classes to the input component', () => {
const wrapper = shallow(<Select {...props} />);
assert.deepEqual(wrapper.props().inputProps.classes, classes);
});
describe('warning', () => {
before(() => {
consoleErrorMock.spy();
});
after(() => {
consoleErrorMock.reset();
});
it('should warn if the input is invalid', () => {
const FakeInput = () => <div />;
props.input = <FakeInput />;
shallow(<Select {...props} />);
assert.match(
consoleErrorMock.args()[0][0],
/Material-UI: you have provided an invalid value to the `input` property/,
);
});
});
it('should be able to mount the component', () => {
const wrapper = mount(
<Select {...props} value={10}>
<MenuItem value="">
<em>None</em>
</MenuItem>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</Select>,
);
assert.strictEqual(wrapper.find('input').props().value, 10);
});
});
| src/Select/Select.spec.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0008228782680816948,
0.0002524788724258542,
0.00016689416952431202,
0.00017193431267514825,
0.00021560346067417413
] |
{
"id": 4,
"code_window": [
"\n",
"Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:\n",
"\n",
"```jsx\n",
"const DecoratedNoProps = decorate(\n",
" class extends React.Component<WithStyles<'root'>> {\n",
" render() {\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 59
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.9980935454368591,
0.13710777461528778,
0.0001636223605601117,
0.0019094368908554316,
0.3374747335910797
] |
{
"id": 4,
"code_window": [
"\n",
"Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:\n",
"\n",
"```jsx\n",
"const DecoratedNoProps = decorate(\n",
" class extends React.Component<WithStyles<'root'>> {\n",
" render() {\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 59
} | import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import AddIcon from 'material-ui-icons/Add';
import Button from 'material-ui/Button';
import DeleteIcon from 'material-ui-icons/Delete';
import IconButton from 'material-ui/IconButton';
import Typography from 'material-ui/Typography';
import Tooltip from 'material-ui/Tooltip';
const styles = theme => ({
fab: {
margin: theme.spacing.unit * 2,
},
absolute: {
flip: false,
position: 'absolute',
bottom: 32,
right: 32,
},
});
function SimpleTooltips(props) {
const { classes } = props;
return (
<div>
<Tooltip id="tooltip-icon" title="Delete" placement="bottom">
<IconButton aria-label="Delete">
<DeleteIcon />
</IconButton>
</Tooltip>
<Tooltip id="tooltip-fab" className={classes.fab} title="Add" placement="bottom">
<Button fab color="primary" aria-label="Add">
<AddIcon />
</Button>
</Tooltip>
<br />
<br />
<Typography>The fab on the right is absolutely positioned:</Typography>
<Tooltip placement="bottom" title="Position absolute">
<Button fab color="accent" className={props.classes.absolute}>
<AddIcon />
</Button>
</Tooltip>
</div>
);
}
SimpleTooltips.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(SimpleTooltips);
| docs/src/pages/demos/tooltips/SimpleTooltips.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0005603923345915973,
0.00026281087775714695,
0.00016695019439794123,
0.00017220467270817608,
0.0001465149107389152
] |
{
"id": 4,
"code_window": [
"\n",
"Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:\n",
"\n",
"```jsx\n",
"const DecoratedNoProps = decorate(\n",
" class extends React.Component<WithStyles<'root'>> {\n",
" render() {\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 59
} | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
const SvgIconCustom = global.__MUI_SvgIcon__ || SvgIcon;
let QueueMusic = props =>
<SvgIconCustom {...props}>
<path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z" />
</SvgIconCustom>;
QueueMusic = pure(QueueMusic);
QueueMusic.muiName = 'SvgIcon';
export default QueueMusic;
| packages/material-ui-icons/src/QueueMusic.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017261976609006524,
0.00017001357628032565,
0.00016740738647058606,
0.00017001357628032565,
0.0000026061898097395897
] |
{
"id": 4,
"code_window": [
"\n",
"Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:\n",
"\n",
"```jsx\n",
"const DecoratedNoProps = decorate(\n",
" class extends React.Component<WithStyles<'root'>> {\n",
" render() {\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 59
} | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
const SvgIconCustom = global.__MUI_SvgIcon__ || SvgIcon;
let FileDownload = props =>
<SvgIconCustom {...props}>
<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z" />
</SvgIconCustom>;
FileDownload = pure(FileDownload);
FileDownload.muiName = 'SvgIcon';
export default FileDownload;
| packages/material-ui-icons/src/FileDownload.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0001741842133924365,
0.00017091527115553617,
0.00016764634347055107,
0.00017091527115553617,
0.0000032689349609427154
] |
{
"id": 5,
"code_window": [
" return (\n",
" <Typography classes={this.props.classes}>\n",
" Hello, World!\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 66
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.8168877959251404,
0.05894045531749725,
0.00016337120905518532,
0.0003044115146622062,
0.20293523371219635
] |
{
"id": 5,
"code_window": [
" return (\n",
" <Typography classes={this.props.classes}>\n",
" Hello, World!\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 66
} | import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import green from 'material-ui/colors/green';
import SvgIcon from 'material-ui/SvgIcon';
const styles = {
root: {
display: 'flex',
alignItems: 'flex-end',
justifyContent: 'space-around',
width: '70%',
},
iconHover: {
'&:hover': {
fill: green[200],
},
},
};
const HomeIcon = props => (
<SvgIcon {...props}>
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
</SvgIcon>
);
function SvgIcons(props) {
const { classes } = props;
return (
<div className={classes.root}>
<HomeIcon />
<HomeIcon color="accent" />
<HomeIcon color="action" />
<HomeIcon color="contrast" />
<HomeIcon color="disabled" />
<HomeIcon
className={classes.icon}
color="primary"
style={{
width: 30,
height: 30,
}}
/>
<HomeIcon
color="error"
className={classes.iconHover}
style={{
width: 36,
height: 36,
}}
/>
</div>
);
}
SvgIcons.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(SvgIcons);
| docs/src/pages/style/SvgIcons.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00033551003434695303,
0.0001961040688911453,
0.00016831136599648744,
0.00017360223864670843,
0.0000569844305573497
] |
{
"id": 5,
"code_window": [
" return (\n",
" <Typography classes={this.props.classes}>\n",
" Hello, World!\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 66
} | import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { capitalizeFirstLetter } from '../utils/helpers';
export const styles = theme => ({
root: {
userSelect: 'none',
},
colorAccent: {
color: theme.palette.secondary.A200,
},
colorAction: {
color: theme.palette.action.active,
},
colorContrast: {
color: theme.palette.getContrastText(theme.palette.primary[500]),
},
colorDisabled: {
color: theme.palette.action.disabled,
},
colorError: {
color: theme.palette.error[500],
},
colorPrimary: {
color: theme.palette.primary[500],
},
});
function Icon(props) {
const { children, classes, className: classNameProp, color, ...other } = props;
const className = classNames(
'material-icons',
classes.root,
{
[classes[`color${capitalizeFirstLetter(color)}`]]: color !== 'inherit',
},
classNameProp,
);
return (
<span className={className} aria-hidden="true" {...other}>
{children}
</span>
);
}
Icon.propTypes = {
/**
* The name of the icon font ligature.
*/
children: PropTypes.node,
/**
* Useful to extend the style applied to components.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The color of the component. It's using the theme palette when that makes sense.
*/
color: PropTypes.oneOf([
'inherit',
'accent',
'action',
'contrast',
'disabled',
'error',
'primary',
]),
};
Icon.defaultProps = {
color: 'inherit',
};
Icon.muiName = 'Icon';
export default withStyles(styles, { name: 'MuiIcon' })(Icon);
| src/Icon/Icon.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0009969096863642335,
0.00026315610739402473,
0.000163845150382258,
0.00017292634584009647,
0.0002594457764644176
] |
{
"id": 5,
"code_window": [
" return (\n",
" <Typography classes={this.props.classes}>\n",
" Hello, World!\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 66
} | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
const SvgIconCustom = global.__MUI_SvgIcon__ || SvgIcon;
let Assessment = props =>
<SvgIconCustom {...props}>
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z" />
</SvgIconCustom>;
Assessment = pure(Assessment);
Assessment.muiName = 'SvgIcon';
export default Assessment;
| packages/material-ui-icons/src/Assessment.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0001743003522278741,
0.0001740028674248606,
0.0001737053826218471,
0.0001740028674248606,
2.9748480301350355e-7
] |
{
"id": 6,
"code_window": [
"\n",
"Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:\n",
"\n",
"```jsx\n",
"const DecoratedNoProps = decorate<{}>( // <-- note the type argument!\n",
" class extends React.Component<WithStyles<'root'>> {\n",
" render() {\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 75
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.998348593711853,
0.1419232189655304,
0.00016432077973149717,
0.003027929924428463,
0.3361298739910126
] |
{
"id": 6,
"code_window": [
"\n",
"Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:\n",
"\n",
"```jsx\n",
"const DecoratedNoProps = decorate<{}>( // <-- note the type argument!\n",
" class extends React.Component<WithStyles<'root'>> {\n",
" render() {\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 75
} | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
const SvgIconCustom = global.__MUI_SvgIcon__ || SvgIcon;
let FontDownload = props =>
<SvgIconCustom {...props}>
<path d="M9.93 13.5h4.14L12 7.98zM20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-4.05 16.5l-1.14-3H9.17l-1.12 3H5.96l5.11-13h1.86l5.11 13h-2.09z" />
</SvgIconCustom>;
FontDownload = pure(FontDownload);
FontDownload.muiName = 'SvgIcon';
export default FontDownload;
| packages/material-ui-icons/src/FontDownload.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017515303625259548,
0.00017157371621578932,
0.00016799439617898315,
0.00017157371621578932,
0.000003579320036806166
] |
{
"id": 6,
"code_window": [
"\n",
"Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:\n",
"\n",
"```jsx\n",
"const DecoratedNoProps = decorate<{}>( // <-- note the type argument!\n",
" class extends React.Component<WithStyles<'root'>> {\n",
" render() {\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 75
} | import React from 'react';
import withRoot from 'docs/src/modules/components/withRoot';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from 'docs/src/pages/demos/popovers/popovers.md';
function Page() {
return (
<MarkdownDocs
markdown={markdown}
demos={{
'pages/demos/popovers/AnchorPlayground.js': {
js: require('docs/src/pages/demos/popovers/AnchorPlayground').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/popovers/AnchorPlayground'), 'utf8')
`,
},
'pages/demos/popovers/MouseOverPopover.js': {
js: require('docs/src/pages/demos/popovers/MouseOverPopover').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/popovers/MouseOverPopover'), 'utf8')
`,
},
}}
/>
);
}
export default withRoot(Page);
| pages/demos/popovers.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017653054965194315,
0.0001720493019092828,
0.0001692150835879147,
0.0001712257944745943,
0.0000027976304863841506
] |
{
"id": 6,
"code_window": [
"\n",
"Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:\n",
"\n",
"```jsx\n",
"const DecoratedNoProps = decorate<{}>( // <-- note the type argument!\n",
" class extends React.Component<WithStyles<'root'>> {\n",
" render() {\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { WithStyles } from 'material-ui/styles';\n",
"\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "add",
"edit_start_line_idx": 75
} | ---
filename: /src/Progress/CircularProgress.js
---
<!--- This documentation is automatically generated, do not try to edit it. -->
# CircularProgress
## Props
| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| classes | object | | Useful to extend the style applied to components. |
| color | enum: 'primary' |<br> 'accent' |<br> 'inherit'<br> | 'primary' | The color of the component. It's using the theme palette when that makes sense. |
| max | number | 100 | The max value of progress in determinate mode. |
| min | number | 0 | The min value of progress in determinate mode. |
| mode | enum: 'determinate' |<br> 'indeterminate'<br> | 'indeterminate' | The mode of show your progress. Indeterminate for when there is no value for progress. Determinate for controlled progress value. |
| size | number | 40 | The size of the circle. |
| thickness | number | 3.6 | The thickness of the circle. |
| value | number | 0 | The value of progress in determinate mode. |
Any other properties supplied will be [spread to the root element](/guides/api#spread).
## CSS API
You can override all the class names injected by Material-UI thanks to the `classes` property.
This property accepts the following keys:
- `root`
- `primaryColor`
- `accentColor`
- `svgIndeterminate`
- `svgDeterminate`
- `circle`
- `circleIndeterminate`
Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) section
and the [implementation of the component](https://github.com/mui-org/material-ui/tree/v1-beta/src/Progress/CircularProgress.js)
for more detail.
If using the `overrides` key of the theme as documented
[here](/customization/themes#customizing-all-instances-of-a-component-type),
you need to use the following style sheet name: `MuiCircularProgress`.
## Demos
- [Progress](/demos/progress)
| pages/api/circular-progress.md | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017219664005097002,
0.0001670804194873199,
0.0001623631687834859,
0.00016640633111819625,
0.000003603046252464992
] |
{
"id": 7,
"code_window": [
" <Typography classes={this.props.classes}>\n",
" Hello, World!\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 82
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.9802646636962891,
0.07523941248655319,
0.0001628883765079081,
0.0003933936241082847,
0.24385029077529907
] |
{
"id": 7,
"code_window": [
" <Typography classes={this.props.classes}>\n",
" Hello, World!\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 82
} | import React from 'react';
import { assert } from 'chai';
import { createShallow } from '../test-utils';
import GridListTileBar from './GridListTileBar';
describe('<GridListTileBar />', () => {
let shallow;
before(() => {
shallow = createShallow({ dive: true });
});
const tileData = {
img: 'images/grid-list/00-52-29-429_640.jpg',
title: 'Breakfast',
author: 'jill111',
};
describe('prop: title', () => {
it('should renders title', () => {
const wrapper = shallow(<GridListTileBar title={tileData.title} />);
assert.strictEqual(
wrapper.children('div').text(),
tileData.title,
'should contain the title',
);
});
});
});
| src/GridList/GridListTileBar.spec.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017845701950136572,
0.00017600176215637475,
0.00017456979549024254,
0.0001754901313688606,
0.0000015687626273575006
] |
{
"id": 7,
"code_window": [
" <Typography classes={this.props.classes}>\n",
" Hello, World!\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 82
} | // @inheritedComponent ListItem
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import ListItem from '../List/ListItem';
export const styles = theme => ({
root: {
...theme.typography.subheading,
height: 24,
boxSizing: 'content-box',
background: 'none',
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
'&:focus': {
background: theme.palette.text.divider,
},
'&:hover': {
backgroundColor: theme.palette.text.divider,
},
},
selected: {
backgroundColor: theme.palette.text.divider,
},
});
function MenuItem(props) {
const { classes, className: classNameProp, component, selected, role, ...other } = props;
const className = classNames(
classes.root,
{
[classes.selected]: selected,
},
classNameProp,
);
return (
<ListItem
button
role={role}
tabIndex={-1}
className={className}
component={component}
{...other}
/>
);
}
MenuItem.propTypes = {
/**
* Menu item contents.
*/
children: PropTypes.node,
/**
* Useful to extend the style applied to components.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
*/
component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
/**
* @ignore
*/
role: PropTypes.string,
/**
* Use to apply selected styling.
*/
selected: PropTypes.bool,
};
MenuItem.defaultProps = {
role: 'menuitem',
selected: false,
};
export default withStyles(styles, { name: 'MuiMenuItem' })(MenuItem);
| src/Menu/MenuItem.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0006039801519364119,
0.00023484951816499233,
0.0001665417366893962,
0.00017203792231157422,
0.00013802248577121645
] |
{
"id": 7,
"code_window": [
" <Typography classes={this.props.classes}>\n",
" Hello, World!\n",
" </Typography>\n",
" )\n",
" }\n",
" }\n",
");\n",
"```\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" );\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 82
} | // @flow weak
export default function unwrap(component: Object) {
return component.Naked ? unwrap(component.Naked) : component;
}
| src/test-utils/unwrap.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0001631555933272466,
0.0001631555933272466,
0.0001631555933272466,
0.0001631555933272466,
0
] |
{
"id": 8,
"code_window": [
"\n",
"The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:\n",
"\n",
"```js\n",
"import { Theme } from 'material-ui/styles/createMuiTheme'\n",
"import { Breakpoint } from 'material-ui/styles/createBreakpoints'\n",
"\n",
"declare module 'material-ui/styles/createMuiTheme' {\n",
" interface Theme {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { Theme } from 'material-ui/styles/createMuiTheme';\n",
"import { Breakpoint } from 'material-ui/styles/createBreakpoints';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 98
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.9965195655822754,
0.0709770917892456,
0.00016373379912693053,
0.00016977750055957586,
0.2476198375225067
] |
{
"id": 8,
"code_window": [
"\n",
"The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:\n",
"\n",
"```js\n",
"import { Theme } from 'material-ui/styles/createMuiTheme'\n",
"import { Breakpoint } from 'material-ui/styles/createBreakpoints'\n",
"\n",
"declare module 'material-ui/styles/createMuiTheme' {\n",
" interface Theme {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { Theme } from 'material-ui/styles/createMuiTheme';\n",
"import { Breakpoint } from 'material-ui/styles/createBreakpoints';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 98
} | // flow-typed signature: ec19001e0177117e91afd65023737d4d
// flow-typed version: <<STUB>>/dom-helpers_v^3.2.1/flow_v0.59.0
/**
* This is an autogenerated libdef stub for:
*
* 'dom-helpers'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'dom-helpers' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'dom-helpers/activeElement' {
declare module.exports: any;
}
declare module 'dom-helpers/class/addClass' {
declare module.exports: any;
}
declare module 'dom-helpers/class/hasClass' {
declare module.exports: any;
}
declare module 'dom-helpers/class/index' {
declare module.exports: any;
}
declare module 'dom-helpers/class/removeClass' {
declare module.exports: any;
}
declare module 'dom-helpers/events/filter' {
declare module.exports: any;
}
declare module 'dom-helpers/events/index' {
declare module.exports: any;
}
declare module 'dom-helpers/events/listen' {
declare module.exports: any;
}
declare module 'dom-helpers/events/off' {
declare module.exports: any;
}
declare module 'dom-helpers/events/on' {
declare module.exports: any;
}
declare module 'dom-helpers/ownerDocument' {
declare module.exports: any;
}
declare module 'dom-helpers/ownerWindow' {
declare module.exports: any;
}
declare module 'dom-helpers/query/closest' {
declare module.exports: any;
}
declare module 'dom-helpers/query/contains' {
declare module.exports: any;
}
declare module 'dom-helpers/query/height' {
declare module.exports: any;
}
declare module 'dom-helpers/query/index' {
declare module.exports: any;
}
declare module 'dom-helpers/query/isWindow' {
declare module.exports: any;
}
declare module 'dom-helpers/query/matches' {
declare module.exports: any;
}
declare module 'dom-helpers/query/offset' {
declare module.exports: any;
}
declare module 'dom-helpers/query/offsetParent' {
declare module.exports: any;
}
declare module 'dom-helpers/query/position' {
declare module.exports: any;
}
declare module 'dom-helpers/query/querySelectorAll' {
declare module.exports: any;
}
declare module 'dom-helpers/query/scrollLeft' {
declare module.exports: any;
}
declare module 'dom-helpers/query/scrollParent' {
declare module.exports: any;
}
declare module 'dom-helpers/query/scrollTop' {
declare module.exports: any;
}
declare module 'dom-helpers/query/width' {
declare module.exports: any;
}
declare module 'dom-helpers/style/getComputedStyle' {
declare module.exports: any;
}
declare module 'dom-helpers/style/index' {
declare module.exports: any;
}
declare module 'dom-helpers/style/removeStyle' {
declare module.exports: any;
}
declare module 'dom-helpers/transition/animate' {
declare module.exports: any;
}
declare module 'dom-helpers/transition/end' {
declare module.exports: any;
}
declare module 'dom-helpers/transition/index' {
declare module.exports: any;
}
declare module 'dom-helpers/transition/isTransform' {
declare module.exports: any;
}
declare module 'dom-helpers/transition/properties' {
declare module.exports: any;
}
declare module 'dom-helpers/util/camelize' {
declare module.exports: any;
}
declare module 'dom-helpers/util/camelizeStyle' {
declare module.exports: any;
}
declare module 'dom-helpers/util/hyphenate' {
declare module.exports: any;
}
declare module 'dom-helpers/util/hyphenateStyle' {
declare module.exports: any;
}
declare module 'dom-helpers/util/inDOM' {
declare module.exports: any;
}
declare module 'dom-helpers/util/requestAnimationFrame' {
declare module.exports: any;
}
declare module 'dom-helpers/util/scrollbarSize' {
declare module.exports: any;
}
declare module 'dom-helpers/util/scrollTo' {
declare module.exports: any;
}
// Filename aliases
declare module 'dom-helpers/activeElement.js' {
declare module.exports: $Exports<'dom-helpers/activeElement'>;
}
declare module 'dom-helpers/class/addClass.js' {
declare module.exports: $Exports<'dom-helpers/class/addClass'>;
}
declare module 'dom-helpers/class/hasClass.js' {
declare module.exports: $Exports<'dom-helpers/class/hasClass'>;
}
declare module 'dom-helpers/class/index.js' {
declare module.exports: $Exports<'dom-helpers/class/index'>;
}
declare module 'dom-helpers/class/removeClass.js' {
declare module.exports: $Exports<'dom-helpers/class/removeClass'>;
}
declare module 'dom-helpers/events/filter.js' {
declare module.exports: $Exports<'dom-helpers/events/filter'>;
}
declare module 'dom-helpers/events/index.js' {
declare module.exports: $Exports<'dom-helpers/events/index'>;
}
declare module 'dom-helpers/events/listen.js' {
declare module.exports: $Exports<'dom-helpers/events/listen'>;
}
declare module 'dom-helpers/events/off.js' {
declare module.exports: $Exports<'dom-helpers/events/off'>;
}
declare module 'dom-helpers/events/on.js' {
declare module.exports: $Exports<'dom-helpers/events/on'>;
}
declare module 'dom-helpers/index' {
declare module.exports: $Exports<'dom-helpers'>;
}
declare module 'dom-helpers/index.js' {
declare module.exports: $Exports<'dom-helpers'>;
}
declare module 'dom-helpers/ownerDocument.js' {
declare module.exports: $Exports<'dom-helpers/ownerDocument'>;
}
declare module 'dom-helpers/ownerWindow.js' {
declare module.exports: $Exports<'dom-helpers/ownerWindow'>;
}
declare module 'dom-helpers/query/closest.js' {
declare module.exports: $Exports<'dom-helpers/query/closest'>;
}
declare module 'dom-helpers/query/contains.js' {
declare module.exports: $Exports<'dom-helpers/query/contains'>;
}
declare module 'dom-helpers/query/height.js' {
declare module.exports: $Exports<'dom-helpers/query/height'>;
}
declare module 'dom-helpers/query/index.js' {
declare module.exports: $Exports<'dom-helpers/query/index'>;
}
declare module 'dom-helpers/query/isWindow.js' {
declare module.exports: $Exports<'dom-helpers/query/isWindow'>;
}
declare module 'dom-helpers/query/matches.js' {
declare module.exports: $Exports<'dom-helpers/query/matches'>;
}
declare module 'dom-helpers/query/offset.js' {
declare module.exports: $Exports<'dom-helpers/query/offset'>;
}
declare module 'dom-helpers/query/offsetParent.js' {
declare module.exports: $Exports<'dom-helpers/query/offsetParent'>;
}
declare module 'dom-helpers/query/position.js' {
declare module.exports: $Exports<'dom-helpers/query/position'>;
}
declare module 'dom-helpers/query/querySelectorAll.js' {
declare module.exports: $Exports<'dom-helpers/query/querySelectorAll'>;
}
declare module 'dom-helpers/query/scrollLeft.js' {
declare module.exports: $Exports<'dom-helpers/query/scrollLeft'>;
}
declare module 'dom-helpers/query/scrollParent.js' {
declare module.exports: $Exports<'dom-helpers/query/scrollParent'>;
}
declare module 'dom-helpers/query/scrollTop.js' {
declare module.exports: $Exports<'dom-helpers/query/scrollTop'>;
}
declare module 'dom-helpers/query/width.js' {
declare module.exports: $Exports<'dom-helpers/query/width'>;
}
declare module 'dom-helpers/style/getComputedStyle.js' {
declare module.exports: $Exports<'dom-helpers/style/getComputedStyle'>;
}
declare module 'dom-helpers/style/index.js' {
declare module.exports: $Exports<'dom-helpers/style/index'>;
}
declare module 'dom-helpers/style/removeStyle.js' {
declare module.exports: $Exports<'dom-helpers/style/removeStyle'>;
}
declare module 'dom-helpers/transition/animate.js' {
declare module.exports: $Exports<'dom-helpers/transition/animate'>;
}
declare module 'dom-helpers/transition/end.js' {
declare module.exports: $Exports<'dom-helpers/transition/end'>;
}
declare module 'dom-helpers/transition/index.js' {
declare module.exports: $Exports<'dom-helpers/transition/index'>;
}
declare module 'dom-helpers/transition/isTransform.js' {
declare module.exports: $Exports<'dom-helpers/transition/isTransform'>;
}
declare module 'dom-helpers/transition/properties.js' {
declare module.exports: $Exports<'dom-helpers/transition/properties'>;
}
declare module 'dom-helpers/util/camelize.js' {
declare module.exports: $Exports<'dom-helpers/util/camelize'>;
}
declare module 'dom-helpers/util/camelizeStyle.js' {
declare module.exports: $Exports<'dom-helpers/util/camelizeStyle'>;
}
declare module 'dom-helpers/util/hyphenate.js' {
declare module.exports: $Exports<'dom-helpers/util/hyphenate'>;
}
declare module 'dom-helpers/util/hyphenateStyle.js' {
declare module.exports: $Exports<'dom-helpers/util/hyphenateStyle'>;
}
declare module 'dom-helpers/util/inDOM.js' {
declare module.exports: $Exports<'dom-helpers/util/inDOM'>;
}
declare module 'dom-helpers/util/requestAnimationFrame.js' {
declare module.exports: $Exports<'dom-helpers/util/requestAnimationFrame'>;
}
declare module 'dom-helpers/util/scrollbarSize.js' {
declare module.exports: $Exports<'dom-helpers/util/scrollbarSize'>;
}
declare module 'dom-helpers/util/scrollTo.js' {
declare module.exports: $Exports<'dom-helpers/util/scrollTo'>;
}
| flow-typed/npm/dom-helpers_vx.x.x.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00021479740098584443,
0.00016936089377850294,
0.00015849665214773268,
0.00016540732758585364,
0.000010429784197185654
] |
{
"id": 8,
"code_window": [
"\n",
"The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:\n",
"\n",
"```js\n",
"import { Theme } from 'material-ui/styles/createMuiTheme'\n",
"import { Breakpoint } from 'material-ui/styles/createBreakpoints'\n",
"\n",
"declare module 'material-ui/styles/createMuiTheme' {\n",
" interface Theme {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { Theme } from 'material-ui/styles/createMuiTheme';\n",
"import { Breakpoint } from 'material-ui/styles/createBreakpoints';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 98
} | import React from 'react';
import PropTypes from 'prop-types';
import Downshift from 'downshift';
import TextField from 'material-ui/TextField';
import Paper from 'material-ui/Paper';
import { MenuItem } from 'material-ui/Menu';
import { withStyles } from 'material-ui/styles';
const suggestions = [
{ label: 'Afghanistan' },
{ label: 'Aland Islands' },
{ label: 'Albania' },
{ label: 'Algeria' },
{ label: 'American Samoa' },
{ label: 'Andorra' },
{ label: 'Angola' },
{ label: 'Anguilla' },
{ label: 'Antarctica' },
{ label: 'Antigua and Barbuda' },
{ label: 'Argentina' },
{ label: 'Armenia' },
{ label: 'Aruba' },
{ label: 'Australia' },
{ label: 'Austria' },
{ label: 'Azerbaijan' },
{ label: 'Bahamas' },
{ label: 'Bahrain' },
{ label: 'Bangladesh' },
{ label: 'Barbados' },
{ label: 'Belarus' },
{ label: 'Belgium' },
{ label: 'Belize' },
{ label: 'Benin' },
{ label: 'Bermuda' },
{ label: 'Bhutan' },
{ label: 'Bolivia, Plurinational State of' },
{ label: 'Bonaire, Sint Eustatius and Saba' },
{ label: 'Bosnia and Herzegovina' },
{ label: 'Botswana' },
{ label: 'Bouvet Island' },
{ label: 'Brazil' },
{ label: 'British Indian Ocean Territory' },
{ label: 'Brunei Darussalam' },
];
function renderInput(inputProps) {
const { classes, autoFocus, value, ref, ...other } = inputProps;
return (
<TextField
autoFocus={autoFocus}
className={classes.textField}
value={value}
inputRef={ref}
InputProps={{
classes: {
input: classes.input,
},
...other,
}}
/>
);
}
function renderSuggestion(params) {
const { suggestion, index, itemProps, theme, highlightedIndex, selectedItem } = params;
const isHighlighted = highlightedIndex === index;
const isSelected = selectedItem === suggestion.label;
return (
<MenuItem
{...itemProps}
key={suggestion.label}
selected={isHighlighted}
component="div"
style={{
fontWeight: isSelected
? theme.typography.fontWeightMedium
: theme.typography.fontWeightRegular,
}}
>
{suggestion.label}
</MenuItem>
);
}
function renderSuggestionsContainer(options) {
const { containerProps, children } = options;
return (
<Paper {...containerProps} square>
{children}
</Paper>
);
}
function getSuggestions(inputValue) {
let count = 0;
return suggestions.filter(suggestion => {
const keep =
(!inputValue || suggestion.label.toLowerCase().includes(inputValue.toLowerCase())) &&
count < 5;
if (keep) {
count += 1;
}
return keep;
});
}
const styles = {
container: {
flexGrow: 1,
height: 200,
},
textField: {
width: '100%',
},
};
function IntegrationAutosuggest(props) {
const { classes, theme } = props;
return (
<Downshift
render={({
getInputProps,
getItemProps,
isOpen,
inputValue,
selectedItem,
highlightedIndex,
}) => (
<div className={classes.container}>
{renderInput(
getInputProps({
classes,
placeholder: 'Search a country (start with a)',
id: 'integration-downshift',
}),
)}
{isOpen
? renderSuggestionsContainer({
children: getSuggestions(inputValue).map((suggestion, index) =>
renderSuggestion({
suggestion,
index,
theme,
itemProps: getItemProps({ item: suggestion.label }),
highlightedIndex,
selectedItem,
}),
),
})
: null}
</div>
)}
/>
);
}
IntegrationAutosuggest.propTypes = {
classes: PropTypes.object.isRequired,
theme: PropTypes.object.isRequired,
};
export default withStyles(styles, { withTheme: true })(IntegrationAutosuggest);
| docs/src/pages/demos/autocomplete/IntegrationDownshift.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00021341412502806634,
0.00017463778203818947,
0.0001659767294768244,
0.00017210586520377547,
0.000010577607099548914
] |
{
"id": 8,
"code_window": [
"\n",
"The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:\n",
"\n",
"```js\n",
"import { Theme } from 'material-ui/styles/createMuiTheme'\n",
"import { Breakpoint } from 'material-ui/styles/createBreakpoints'\n",
"\n",
"declare module 'material-ui/styles/createMuiTheme' {\n",
" interface Theme {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { Theme } from 'material-ui/styles/createMuiTheme';\n",
"import { Breakpoint } from 'material-ui/styles/createBreakpoints';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 98
} | import * as React from 'react';
import { StandardProps } from '..';
import { Orientation } from './Stepper';
import { ButtonBaseProps, ButtonBaseClassKey } from '../ButtonBase';
export type StepButtonIcon = React.ReactElement<any> | string | number;
export interface StepButtonProps extends StandardProps<ButtonBaseProps, StepButtonClasskey> {
active?: boolean;
alternativeLabel?: boolean;
children: React.ReactElement<any>;
completed?: boolean;
disabled?: boolean;
icon?: StepButtonIcon;
last?: boolean;
optional?: React.ReactNode;
orientation: Orientation;
}
export type StepButtonClasskey = ButtonBaseClassKey | 'root' | 'alternativeLabel';
declare const StepButton: React.ComponentType<StepButtonProps>;
export default StepButton;
| src/Stepper/StepButton.d.ts | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017573634977452457,
0.0001714150421321392,
0.00016303476877510548,
0.00017547397874295712,
0.000005926709491177462
] |
{
"id": 9,
"code_window": [
"And a custom theme factory with additional defaulted options:\n",
"\n",
"```js\n",
"import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'\n",
"\n",
"export default function createMyTheme(options: ThemeOptions) {\n",
" return createMuiTheme({\n",
" appDrawer: {\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import createMuiTheme, { ThemeOptions } from 'material-ui/styles/createMuiTheme';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 121
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.9986159801483154,
0.1307658553123474,
0.00016579468501731753,
0.00017630112415645272,
0.327140748500824
] |
{
"id": 9,
"code_window": [
"And a custom theme factory with additional defaulted options:\n",
"\n",
"```js\n",
"import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'\n",
"\n",
"export default function createMyTheme(options: ThemeOptions) {\n",
" return createMuiTheme({\n",
" appDrawer: {\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import createMuiTheme, { ThemeOptions } from 'material-ui/styles/createMuiTheme';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 121
} | import { PropTypes, StandardProps } from '..';
import { PaperProps, PaperClassKey } from '../Paper/Paper';
export interface AppBarProps extends StandardProps<PaperProps, AppBarClassKey> {
color?: PropTypes.Color;
position?: 'static' | 'fixed' | 'absolute';
}
export type AppBarClassKey =
| PaperClassKey
| 'positionFixed'
| 'positionAbsolute'
| 'positionStatic'
| 'colorDefault'
| 'colorPrimary'
| 'colorAccent';
declare const AppBar: React.ComponentType<AppBarProps>;
export default AppBar;
| src/AppBar/AppBar.d.ts | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017758319154381752,
0.00017359988123644143,
0.00016749567294027656,
0.00017572077922523022,
0.0000043827817535202485
] |
{
"id": 9,
"code_window": [
"And a custom theme factory with additional defaulted options:\n",
"\n",
"```js\n",
"import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'\n",
"\n",
"export default function createMyTheme(options: ThemeOptions) {\n",
" return createMuiTheme({\n",
" appDrawer: {\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import createMuiTheme, { ThemeOptions } from 'material-ui/styles/createMuiTheme';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 121
} | 6.11
| .nvmrc | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0001778884034138173,
0.0001778884034138173,
0.0001778884034138173,
0.0001778884034138173,
0
] |
{
"id": 9,
"code_window": [
"And a custom theme factory with additional defaulted options:\n",
"\n",
"```js\n",
"import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'\n",
"\n",
"export default function createMyTheme(options: ThemeOptions) {\n",
" return createMuiTheme({\n",
" appDrawer: {\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import createMuiTheme, { ThemeOptions } from 'material-ui/styles/createMuiTheme';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 121
} | ---
filename: /src/BottomNavigation/BottomNavigation.js
---
<!--- This documentation is automatically generated, do not try to edit it. -->
# BottomNavigation
## Props
| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| <span style="color: #31a148">children *</span> | node | | The content of the component. |
| classes | object | | Useful to extend the style applied to components. |
| onChange | func | | Callback fired when the value changes.<br><br>**Signature:**<br>`function(event: object, value: any) => void`<br>*event:* The event source of the callback<br>*value:* We default to the index of the child |
| showLabels | bool | false | If `true`, all `BottomNavigationButton`s will show their labels. By default only the selected `BottomNavigationButton` will show its label. |
| value | any | | The value of the currently selected `BottomNavigationButton`. |
Any other properties supplied will be [spread to the root element](/guides/api#spread).
## CSS API
You can override all the class names injected by Material-UI thanks to the `classes` property.
This property accepts the following keys:
- `root`
Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) section
and the [implementation of the component](https://github.com/mui-org/material-ui/tree/v1-beta/src/BottomNavigation/BottomNavigation.js)
for more detail.
If using the `overrides` key of the theme as documented
[here](/customization/themes#customizing-all-instances-of-a-component-type),
you need to use the following style sheet name: `MuiBottomNavigation`.
## Demos
- [Bottom Navigation](/demos/bottom-navigation)
| pages/api/bottom-navigation.md | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017758319154381752,
0.0001684495946392417,
0.00016410952957812697,
0.00016576889902353287,
0.000004855833140027244
] |
{
"id": 10,
"code_window": [
"```\n",
"\n",
"This could be used like:\n",
"\n",
"```js\n",
"import createMyTheme from './styles/createMyTheme'\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
],
"after_edit": [
"import createMyTheme from './styles/createMyTheme';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 137
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.9286018013954163,
0.06325466185808182,
0.00016592482279520482,
0.0007893385482020676,
0.23127931356430054
] |
{
"id": 10,
"code_window": [
"```\n",
"\n",
"This could be used like:\n",
"\n",
"```js\n",
"import createMyTheme from './styles/createMyTheme'\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
],
"after_edit": [
"import createMyTheme from './styles/createMyTheme';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 137
} | import React from 'react';
import withRoot from 'docs/src/modules/components/withRoot';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from './step-label.md';
function Page() {
return <MarkdownDocs markdown={markdown} />;
}
export default withRoot(Page);
| pages/api/step-label.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017961906269192696,
0.00017522473353892565,
0.00017083041893783957,
0.00017522473353892565,
0.000004394321877043694
] |
{
"id": 10,
"code_window": [
"```\n",
"\n",
"This could be used like:\n",
"\n",
"```js\n",
"import createMyTheme from './styles/createMyTheme'\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
],
"after_edit": [
"import createMyTheme from './styles/createMyTheme';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 137
} | import { parse as parseDoctrine } from 'doctrine';
import recast from 'recast';
import kebabCase from 'lodash/kebabCase';
import { pageToTitle } from './helpers';
const SOURCE_CODE_ROOT_URL = 'https://github.com/mui-org/material-ui/tree/v1-beta';
const PATH_REPLACE_REGEX = /\\/g;
const PATH_SEPARATOR = '/';
function normalizePath(path) {
return path.replace(PATH_REPLACE_REGEX, PATH_SEPARATOR);
}
function generateHeader(reactAPI) {
return ['---', `filename: ${normalizePath(reactAPI.filename)}`, '---'].join('\n');
}
function getDeprecatedInfo(type) {
const deprecatedPropType = 'deprecated(PropTypes.';
const indexStart = type.raw.indexOf(deprecatedPropType);
if (indexStart !== -1) {
return {
propTypes: type.raw.substring(indexStart + deprecatedPropType.length, type.raw.indexOf(',')),
explanation: recast.parse(type.raw).program.body[0].expression.arguments[1].value,
};
}
return false;
}
function escapeCell(value) {
// As the pipe is use for the table structure
return value.replace(/</g, '<').replace(/\|/g, '|');
}
function generatePropDescription(description, type) {
let deprecated = '';
if (type.name === 'custom') {
const deprecatedInfo = getDeprecatedInfo(type);
if (deprecatedInfo) {
deprecated = `*Deprecated*. ${deprecatedInfo.explanation}<br><br>`;
}
}
const parsed = parseDoctrine(description);
// Two new lines result in a newline in the table.
// All other new lines must be eliminated to prevent markdown mayhem.
const jsDocText = escapeCell(parsed.description)
.replace(/\n\n/g, '<br>')
.replace(/\n/g, ' ')
.replace(/\r/g, '');
if (parsed.tags.some(tag => tag.title === 'ignore')) {
return null;
}
let signature = '';
if (type.name === 'func' && parsed.tags.length > 0) {
// Remove new lines from tag descriptions to avoid markdown errors.
parsed.tags.forEach(tag => {
if (tag.description) {
tag.description = tag.description.replace(/\n/g, ' ');
}
});
// Split up the parsed tags into 'arguments' and 'returns' parsed objects. If there's no
// 'returns' parsed object (i.e., one with title being 'returns'), make one of type 'void'.
const parsedLength = parsed.tags.length;
let parsedArgs = [];
let parsedReturns;
if (parsed.tags[parsedLength - 1].title === 'returns') {
parsedArgs = parsed.tags.slice(0, parsedLength - 1);
parsedReturns = parsed.tags[parsedLength - 1];
} else {
parsedArgs = parsed.tags;
parsedReturns = { type: { name: 'void' } };
}
signature += '<br><br>**Signature:**<br>`function(';
signature += parsedArgs.map(tag => `${tag.name}: ${tag.type.name}`).join(', ');
signature += `) => ${parsedReturns.type.name}\`<br>`;
signature += parsedArgs.map(tag => `*${tag.name}:* ${tag.description}`).join('<br>');
if (parsedReturns.description) {
signature += `<br> *returns* (${parsedReturns.type.name}): ${parsedReturns.description}`;
}
}
return `${deprecated}${jsDocText}${signature}`;
}
function generatePropType(type) {
switch (type.name) {
case 'custom': {
const deprecatedInfo = getDeprecatedInfo(type);
if (deprecatedInfo !== false) {
return generatePropType({
name: deprecatedInfo.propTypes,
});
}
return type.raw;
}
case 'union':
case 'enum': {
let values = type.value.map(v => v.value || v.name).map(value => {
if (typeof value === 'string') {
return escapeCell(value);
}
return `{${Object.keys(value)
.map(subValue => {
return `${subValue}?: ${generatePropType(value[subValue])}`;
})
.join(', ')}}`;
});
// Display one value per line as it's better for visibility.
if (values.length < 5) {
values = values.join(' |<br> ');
} else {
values = values.join(', ');
}
return `${type.name}: ${values}<br>`;
}
default:
return type.name;
}
}
function getProp(props, key) {
switch (key) {
case 'classes':
return {
...props[key],
required: false,
};
default:
return props[key];
}
}
function generateProps(reactAPI) {
const header = '## Props';
let text = `${header}
| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|\n`;
text = Object.keys(reactAPI.props).reduce((textProps, propRaw) => {
const prop = getProp(reactAPI.props, propRaw);
const description = generatePropDescription(prop.description, prop.flowType || prop.type);
if (description === null) {
return textProps;
}
let defaultValue = '';
if (prop.defaultValue) {
defaultValue = escapeCell(prop.defaultValue.value.replace(/\n/g, ''));
}
if (prop.required) {
propRaw = `<span style="color: #31a148">${propRaw}\u2009*</span>`;
}
const type = prop.flowType || prop.type;
if (type && type.name === 'custom') {
if (getDeprecatedInfo(prop.type)) {
propRaw = `~~${propRaw}~~`;
}
}
textProps += `| ${propRaw} | ${generatePropType(type)} | ${defaultValue} | ${description} |\n`;
return textProps;
}, text);
return text;
}
function generateClasses(reactAPI) {
if (!reactAPI.styles.classes.length) {
return '';
}
if (!reactAPI.styles.name) {
throw new Error(`Missing styles name on ${reactAPI.name} component`);
}
return `## CSS API
You can override all the class names injected by Material-UI thanks to the \`classes\` property.
This property accepts the following keys:
${reactAPI.styles.classes.map(className => `- \`${className}\``).join('\n')}
Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) section
and the [implementation of the component](${SOURCE_CODE_ROOT_URL}${normalizePath(
reactAPI.filename,
)})
for more detail.
If using the \`overrides\` key of the theme as documented
[here](/customization/themes#customizing-all-instances-of-a-component-type),
you need to use the following style sheet name: \`${reactAPI.styles.name}\`.
`;
}
const inheritedComponentRegexp = /\/\/ @inheritedComponent (.*)/;
function generateInheritance(reactAPI) {
const inheritedComponent = reactAPI.src.match(inheritedComponentRegexp);
if (!inheritedComponent) {
return '';
}
const component = inheritedComponent[1];
let pathname;
switch (component) {
case 'CSSTransition':
pathname = 'https://reactcommunity.org/react-transition-group/#CSSTransition';
break;
case 'Transition':
pathname = 'https://reactcommunity.org/react-transition-group/#Transition';
break;
default:
pathname = `/api/${kebabCase(component)}`;
break;
}
return `## Inheritance
The properties of the [<${component} />](${pathname}) component are also available.
`;
}
function generateDemos(reactAPI) {
const pagesMarkdown = reactAPI.pagesMarkdown.reduce((accumulator, page) => {
if (page.components.includes(reactAPI.name)) {
accumulator.push(page);
}
return accumulator;
}, []);
if (pagesMarkdown.length === 0) {
return '';
}
return `## Demos
${pagesMarkdown.map(page => `- [${pageToTitle(page)}](${page.pathname})`).join('\n')}
`;
}
export default function generateMarkdown(reactAPI: Object) {
return [
generateHeader(reactAPI),
'',
'<!--- This documentation is automatically generated, do not try to edit it. -->',
'',
`# ${reactAPI.name}`,
'',
reactAPI.description,
'',
generateProps(reactAPI),
'Any other properties supplied will be [spread to the root element](/guides/api#spread).',
'',
`${generateClasses(reactAPI)}${generateInheritance(reactAPI)}${generateDemos(reactAPI)}`,
].join('\n');
}
| docs/src/modules/utils/generateMarkdown.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00030487417825497687,
0.00017521472182124853,
0.00016504214727319777,
0.00016981700900942087,
0.00002498696994734928
] |
{
"id": 10,
"code_window": [
"```\n",
"\n",
"This could be used like:\n",
"\n",
"```js\n",
"import createMyTheme from './styles/createMyTheme'\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
],
"after_edit": [
"import createMyTheme from './styles/createMyTheme';\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 137
} | **/yarn.lock
| examples/.gitignore | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.0001777936122380197,
0.0001777936122380197,
0.0001777936122380197,
0.0001777936122380197,
0
] |
{
"id": 11,
"code_window": [
"\n",
"const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})\n",
"```"
],
"labels": [
"keep",
"replace",
"keep"
],
"after_edit": [
"const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }});\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 139
} | # TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to [TypeScript](https://www.typescriptlang.org/).
Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript) example.
## Usage of `withStyles`
The usage of `withStyles` in TypeScript can be a little tricky, so it's worth showing some examples. You can first call `withStyles()` to create a decorator function, like so:
```js
const decorate = withStyles(({ palette, spacing }) => ({
root: {
padding: spacing.unit,
background: palette.background,
color: palette.primary,
},
}));
```
This can then subsequently be used to decorate either a stateless functional component or a class component. Suppose we have in either case the following props:
```js
interface Props {
text: string;
type: TypographyProps['type'];
color: TypographyProps['color'];
}
```
Functional components are straightforward:
```jsx
const DecoratedSFC = decorate<Props>(({ text, type, color, classes }) => (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
));
```
Class components are a little more cumbersome. Due to a [current limitation in TypeScript's decorator support](https://github.com/Microsoft/TypeScript/issues/4881), `withStyles` can't be used as a class decorator. Instead, we decorate a class component like so:
```jsx
const DecoratedClass = decorate(
class extends React.Component<Props & WithStyles<'root'>> {
render() {
const { text, type, color, classes } = this.props
return (
<Typography type={type} color={color} classes={classes}>
{text}
</Typography>
)
}
}
);
```
Note that in the class example you didn't need to annotate `<Props>` in the call to `decorate`; type inference took care of everything. One caveat is that if your styled component takes _no_ additional props in addition to `classes`. The natural thing would be to write:
```jsx
const DecoratedNoProps = decorate(
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
Unfortunately, TypeScript infers the wrong type in this case and you'll have trouble when you go to make an element of this component. In this case, you'll need to provide an explicit `{}` type argument, like so:
```jsx
const DecoratedNoProps = decorate<{}>( // <-- note the type argument!
class extends React.Component<WithStyles<'root'>> {
render() {
return (
<Typography classes={this.props.classes}>
Hello, World!
</Typography>
)
}
}
);
```
To avoid worrying about this edge case it may be a good habit to always provide an explicit type argument to `decorate`.
## Customization of `Theme`
When adding custom properties to the `Theme`, you may continue to use it in a strongly typed way by exploiting
[Typescript's module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`:
```js
import { Theme } from 'material-ui/styles/createMuiTheme'
import { Breakpoint } from 'material-ui/styles/createBreakpoints'
declare module 'material-ui/styles/createMuiTheme' {
interface Theme {
appDrawer: {
width: React.CSSProperties['width']
breakpoint: Breakpoint
}
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
appDrawer?: {
width?: React.CSSProperties['width']
breakpoint?: Breakpoint
}
}
}
```
And a custom theme factory with additional defaulted options:
```js
import {default as createMuiTheme, ThemeOptions} from 'material-ui/styles/createMuiTheme'
export default function createMyTheme(options: ThemeOptions) {
return createMuiTheme({
appDrawer: {
width: 225,
breakpoint: 'lg',
},
...options,
})
}
```
This could be used like:
```js
import createMyTheme from './styles/createMyTheme'
const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})
```
| docs/src/pages/guides/typescript.md | 1 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.9975693821907043,
0.06840304285287857,
0.00016632574261166155,
0.00019428056839387864,
0.24836087226867676
] |
{
"id": 11,
"code_window": [
"\n",
"const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})\n",
"```"
],
"labels": [
"keep",
"replace",
"keep"
],
"after_edit": [
"const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }});\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 139
} | // flow-typed signature: cc81cfc8fcbcb8ac9b277e6d41966bff
// flow-typed version: <<STUB>>/karma-webpack_v^2.0.6/flow_v0.59.0
/**
* This is an autogenerated libdef stub for:
*
* 'karma-webpack'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'karma-webpack' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'karma-webpack/lib/karma-webpack' {
declare module.exports: any;
}
declare module 'karma-webpack/lib/mocha-env-loader' {
declare module.exports: any;
}
// Filename aliases
declare module 'karma-webpack/index' {
declare module.exports: $Exports<'karma-webpack'>;
}
declare module 'karma-webpack/index.js' {
declare module.exports: $Exports<'karma-webpack'>;
}
declare module 'karma-webpack/lib/karma-webpack.js' {
declare module.exports: $Exports<'karma-webpack/lib/karma-webpack'>;
}
declare module 'karma-webpack/lib/mocha-env-loader.js' {
declare module.exports: $Exports<'karma-webpack/lib/mocha-env-loader'>;
}
| flow-typed/npm/karma-webpack_vx.x.x.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00017082666454371065,
0.0001673947845119983,
0.00016531036817468703,
0.0001664412411628291,
0.0000019492945284582675
] |
{
"id": 11,
"code_window": [
"\n",
"const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})\n",
"```"
],
"labels": [
"keep",
"replace",
"keep"
],
"after_edit": [
"const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }});\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 139
} | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
const SvgIconCustom = global.__MUI_SvgIcon__ || SvgIcon;
let Filter6 = props =>
<SvgIconCustom {...props}>
<path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zm-8-2h2c1.1 0 2-.89 2-2v-2c0-1.11-.9-2-2-2h-2V7h4V5h-4c-1.1 0-2 .89-2 2v6c0 1.11.9 2 2 2zm0-4h2v2h-2v-2z" />
</SvgIconCustom>;
Filter6 = pure(Filter6);
Filter6.muiName = 'SvgIcon';
export default Filter6;
| packages/material-ui-icons/src/Filter6.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00016954018792603165,
0.00016777554992586374,
0.00016601091192569584,
0.00016777554992586374,
0.0000017646380001679063
] |
{
"id": 11,
"code_window": [
"\n",
"const theme = createMyTheme({appDrawer: {breakpoint: 'md'}})\n",
"```"
],
"labels": [
"keep",
"replace",
"keep"
],
"after_edit": [
"const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }});\n"
],
"file_path": "docs/src/pages/guides/typescript.md",
"type": "replace",
"edit_start_line_idx": 139
} | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
const SvgIconCustom = global.__MUI_SvgIcon__ || SvgIcon;
let Camera = props =>
<SvgIconCustom {...props}>
<path d="M9.4 10.5l4.77-8.26C13.47 2.09 12.75 2 12 2c-2.4 0-4.6.85-6.32 2.25l3.66 6.35.06-.1zM21.54 9c-.92-2.92-3.15-5.26-6-6.34L11.88 9h9.66zm.26 1h-7.49l.29.5 4.76 8.25C21 16.97 22 14.61 22 12c0-.69-.07-1.35-.2-2zM8.54 12l-3.9-6.75C3.01 7.03 2 9.39 2 12c0 .69.07 1.35.2 2h7.49l-1.15-2zm-6.08 3c.92 2.92 3.15 5.26 6 6.34L12.12 15H2.46zm11.27 0l-3.9 6.76c.7.15 1.42.24 2.17.24 2.4 0 4.6-.85 6.32-2.25l-3.66-6.35-.93 1.6z" />
</SvgIconCustom>;
Camera = pure(Camera);
Camera.muiName = 'SvgIcon';
export default Camera;
| packages/material-ui-icons/src/Camera.js | 0 | https://github.com/mui/material-ui/commit/0bb64f1fc262de14cce489249aedf777c592414a | [
0.00024384772405028343,
0.00020817748736590147,
0.00017250723612960428,
0.00020817748736590147,
0.000035670243960339576
] |
{
"id": 0,
"code_window": [
"/**\n",
" * This class provides renderer-specific plugins for exporting content from a renderer.\n",
" * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n",
" *\n",
" * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n",
" * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n",
" * @example\n",
" * import { Application, Graphics } from 'pixi.js';\n",
" *\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" * Do not instantiate these plugins directly. It is available from the `renderer.extract` property.\n"
],
"file_path": "packages/extract/src/Extract.ts",
"type": "replace",
"edit_start_line_idx": 12
} | import { extensions, ExtensionType, Rectangle, RenderTexture, utils } from '@pixi/core';
import type { ExtensionMetadata, ICanvas, ISystem, Renderer } from '@pixi/core';
import type { DisplayObject } from '@pixi/display';
const TEMP_RECT = new Rectangle();
const BYTES_PER_PIXEL = 4;
/**
* This class provides renderer-specific plugins for exporting content from a renderer.
* For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).
*
* Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.
* See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.
* @example
* import { Application, Graphics } from 'pixi.js';
*
* // Create a new app (will auto-add extract plugin to renderer)
* const app = new Application();
*
* // Draw a red circle
* const graphics = new Graphics()
* .beginFill(0xFF0000)
* .drawCircle(0, 0, 50);
*
* // Render the graphics as an HTMLImageElement
* const image = app.renderer.plugins.image(graphics);
* document.body.appendChild(image);
* @memberof PIXI
*/
export class Extract implements ISystem
{
/** @ignore */
static extension: ExtensionMetadata = {
name: 'extract',
type: ExtensionType.RendererSystem,
};
private renderer: Renderer;
/**
* @param renderer - A reference to the current renderer
*/
constructor(renderer: Renderer)
{
this.renderer = renderer;
}
/**
* Will return a HTML Image of the target
* @param target - A displayObject or renderTexture
* to convert. If left empty will use the main renderer
* @param format - Image format, e.g. "image/jpeg" or "image/webp".
* @param quality - JPEG or Webp compression from 0 to 1. Default is 0.92.
* @returns - HTML Image of the target
*/
public async image(target: DisplayObject | RenderTexture, format?: string, quality?: number): Promise<HTMLImageElement>
{
const image = new Image();
image.src = await this.base64(target, format, quality);
return image;
}
/**
* Will return a base64 encoded string of this target. It works by calling
* `Extract.getCanvas` and then running toDataURL on that.
* @param target - A displayObject or renderTexture
* to convert. If left empty will use the main renderer
* @param format - Image format, e.g. "image/jpeg" or "image/webp".
* @param quality - JPEG or Webp compression from 0 to 1. Default is 0.92.
* @returns - A base64 encoded string of the texture.
*/
public async base64(target: DisplayObject | RenderTexture, format?: string, quality?: number): Promise<string>
{
const canvas = this.canvas(target);
if (canvas.toDataURL !== undefined)
{
return canvas.toDataURL(format, quality);
}
if (canvas.convertToBlob !== undefined)
{
const blob = await canvas.convertToBlob({ type: format, quality });
return await new Promise<string>((resolve) =>
{
const reader = new FileReader();
reader.onload = () => resolve(reader.result as string);
reader.readAsDataURL(blob);
});
}
throw new Error('Extract.base64() requires ICanvas.toDataURL or ICanvas.convertToBlob to be implemented');
}
/**
* Creates a Canvas element, renders this target to it and then returns it.
* @param target - A displayObject or renderTexture
* to convert. If left empty will use the main renderer
* @param frame - The frame the extraction is restricted to.
* @returns - A Canvas element with the texture rendered on.
*/
public canvas(target: DisplayObject | RenderTexture, frame?: Rectangle): ICanvas
{
const renderer = this.renderer;
let resolution;
let flipY = false;
let renderTexture;
let generated = false;
if (target)
{
if (target instanceof RenderTexture)
{
renderTexture = target;
}
else
{
renderTexture = this.renderer.generateTexture(target);
generated = true;
}
}
if (renderTexture)
{
resolution = renderTexture.baseTexture.resolution;
frame = frame ?? renderTexture.frame;
flipY = false;
renderer.renderTexture.bind(renderTexture);
}
else
{
resolution = renderer.resolution;
if (!frame)
{
frame = TEMP_RECT;
frame.width = renderer.width;
frame.height = renderer.height;
}
flipY = true;
renderer.renderTexture.bind(null);
}
const width = Math.round(frame.width * resolution);
const height = Math.round(frame.height * resolution);
let canvasBuffer = new utils.CanvasRenderTarget(width, height, 1);
const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);
// read pixels to the array
const gl = renderer.gl;
gl.readPixels(
Math.round(frame.x * resolution),
Math.round(frame.y * resolution),
width,
height,
gl.RGBA,
gl.UNSIGNED_BYTE,
webglPixels
);
// add the pixels to the canvas
const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);
Extract.arrayPostDivide(webglPixels, canvasData.data);
canvasBuffer.context.putImageData(canvasData, 0, 0);
// pulling pixels
if (flipY)
{
const target = new utils.CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);
target.context.scale(1, -1);
// we can't render to itself because we should be empty before render.
target.context.drawImage(canvasBuffer.canvas, 0, -height);
canvasBuffer.destroy();
canvasBuffer = target;
}
if (generated)
{
renderTexture.destroy(true);
}
// send the canvas back..
return canvasBuffer.canvas;
}
/**
* Will return a one-dimensional array containing the pixel data of the entire texture in RGBA
* order, with integer values between 0 and 255 (included).
* @param target - A displayObject or renderTexture
* to convert. If left empty will use the main renderer
* @param frame - The frame the extraction is restricted to.
* @returns - One-dimensional array containing the pixel data of the entire texture
*/
public pixels(target?: DisplayObject | RenderTexture, frame?: Rectangle): Uint8Array
{
const renderer = this.renderer;
let resolution;
let renderTexture;
let generated = false;
if (target)
{
if (target instanceof RenderTexture)
{
renderTexture = target;
}
else
{
renderTexture = this.renderer.generateTexture(target);
generated = true;
}
}
if (renderTexture)
{
resolution = renderTexture.baseTexture.resolution;
frame = frame ?? renderTexture.frame;
renderer.renderTexture.bind(renderTexture);
}
else
{
resolution = renderer.resolution;
if (!frame)
{
frame = TEMP_RECT;
frame.width = renderer.width;
frame.height = renderer.height;
}
renderer.renderTexture.bind(null);
}
const width = Math.round(frame.width * resolution);
const height = Math.round(frame.height * resolution);
const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);
// read pixels to the array
const gl = renderer.gl;
gl.readPixels(
Math.round(frame.x * resolution),
Math.round(frame.y * resolution),
width,
height,
gl.RGBA,
gl.UNSIGNED_BYTE,
webglPixels
);
if (generated)
{
renderTexture.destroy(true);
}
Extract.arrayPostDivide(webglPixels, webglPixels);
return webglPixels;
}
/** Destroys the extract. */
public destroy(): void
{
this.renderer = null;
}
/**
* Takes premultiplied pixel data and produces regular pixel data
* @private
* @param pixels - array of pixel data
* @param out - output array
*/
static arrayPostDivide(
pixels: number[] | Uint8Array | Uint8ClampedArray, out: number[] | Uint8Array | Uint8ClampedArray
): void
{
for (let i = 0; i < pixels.length; i += 4)
{
const alpha = out[i + 3] = pixels[i + 3];
if (alpha !== 0)
{
out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));
out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));
out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));
}
else
{
out[i] = pixels[i];
out[i + 1] = pixels[i + 1];
out[i + 2] = pixels[i + 2];
}
}
}
}
extensions.add(Extract);
| packages/extract/src/Extract.ts | 1 | https://github.com/pixijs/pixijs/commit/bacf0de3195b04aedc050c7afcaeb9d42bf6289b | [
0.002512729959562421,
0.0002714802685659379,
0.0001661984424572438,
0.0001935737964231521,
0.00040365211316384375
] |
{
"id": 0,
"code_window": [
"/**\n",
" * This class provides renderer-specific plugins for exporting content from a renderer.\n",
" * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n",
" *\n",
" * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n",
" * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n",
" * @example\n",
" * import { Application, Graphics } from 'pixi.js';\n",
" *\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" * Do not instantiate these plugins directly. It is available from the `renderer.extract` property.\n"
],
"file_path": "packages/extract/src/Extract.ts",
"type": "replace",
"edit_start_line_idx": 12
} | export * from './AssetExtension';
export * from './Assets';
export * from './cache';
export * from './detections';
export * from './loader';
export * from './resolver';
export * from './utils';
| packages/assets/src/index.ts | 0 | https://github.com/pixijs/pixijs/commit/bacf0de3195b04aedc050c7afcaeb9d42bf6289b | [
0.0001669002085691318,
0.0001669002085691318,
0.0001669002085691318,
0.0001669002085691318,
0
] |
{
"id": 0,
"code_window": [
"/**\n",
" * This class provides renderer-specific plugins for exporting content from a renderer.\n",
" * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n",
" *\n",
" * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n",
" * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n",
" * @example\n",
" * import { Application, Graphics } from 'pixi.js';\n",
" *\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" * Do not instantiate these plugins directly. It is available from the `renderer.extract` property.\n"
],
"file_path": "packages/extract/src/Extract.ts",
"type": "replace",
"edit_start_line_idx": 12
} | import { BLEND_MODES } from '@pixi/core';
import { canUseNewCanvasBlendModes } from './canUseNewCanvasBlendModes';
/**
* Maps blend combinations to Canvas.
* @memberof PIXI
* @function mapCanvasBlendModesToPixi
* @private
* @param {string[]} [array=[]] - The array to output into.
* @returns {string[]} Mapped modes.
*/
// TODO after upgrading to typeScript 4.6, replace `string[]` with `GlobalCompositeOperation[]`
export function mapCanvasBlendModesToPixi(array: string[] = []): string[]
{
if (canUseNewCanvasBlendModes())
{
array[BLEND_MODES.NORMAL] = 'source-over';
array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???
array[BLEND_MODES.MULTIPLY] = 'multiply';
array[BLEND_MODES.SCREEN] = 'screen';
array[BLEND_MODES.OVERLAY] = 'overlay';
array[BLEND_MODES.DARKEN] = 'darken';
array[BLEND_MODES.LIGHTEN] = 'lighten';
array[BLEND_MODES.COLOR_DODGE] = 'color-dodge';
array[BLEND_MODES.COLOR_BURN] = 'color-burn';
array[BLEND_MODES.HARD_LIGHT] = 'hard-light';
array[BLEND_MODES.SOFT_LIGHT] = 'soft-light';
array[BLEND_MODES.DIFFERENCE] = 'difference';
array[BLEND_MODES.EXCLUSION] = 'exclusion';
array[BLEND_MODES.HUE] = 'hue';
array[BLEND_MODES.SATURATION] = 'saturation';
array[BLEND_MODES.COLOR] = 'color';
array[BLEND_MODES.LUMINOSITY] = 'luminosity';
}
else
{
// this means that the browser does not support the cool new blend modes in canvas 'cough' ie 'cough'
array[BLEND_MODES.NORMAL] = 'source-over';
array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???
array[BLEND_MODES.MULTIPLY] = 'source-over';
array[BLEND_MODES.SCREEN] = 'source-over';
array[BLEND_MODES.OVERLAY] = 'source-over';
array[BLEND_MODES.DARKEN] = 'source-over';
array[BLEND_MODES.LIGHTEN] = 'source-over';
array[BLEND_MODES.COLOR_DODGE] = 'source-over';
array[BLEND_MODES.COLOR_BURN] = 'source-over';
array[BLEND_MODES.HARD_LIGHT] = 'source-over';
array[BLEND_MODES.SOFT_LIGHT] = 'source-over';
array[BLEND_MODES.DIFFERENCE] = 'source-over';
array[BLEND_MODES.EXCLUSION] = 'source-over';
array[BLEND_MODES.HUE] = 'source-over';
array[BLEND_MODES.SATURATION] = 'source-over';
array[BLEND_MODES.COLOR] = 'source-over';
array[BLEND_MODES.LUMINOSITY] = 'source-over';
}
// not-premultiplied, only for webgl
array[BLEND_MODES.NORMAL_NPM] = array[BLEND_MODES.NORMAL];
array[BLEND_MODES.ADD_NPM] = array[BLEND_MODES.ADD];
array[BLEND_MODES.SCREEN_NPM] = array[BLEND_MODES.SCREEN];
// composite operations
array[BLEND_MODES.SRC_IN] = 'source-in';
array[BLEND_MODES.SRC_OUT] = 'source-out';
array[BLEND_MODES.SRC_ATOP] = 'source-atop';
array[BLEND_MODES.DST_OVER] = 'destination-over';
array[BLEND_MODES.DST_IN] = 'destination-in';
array[BLEND_MODES.DST_OUT] = 'destination-out';
array[BLEND_MODES.DST_ATOP] = 'destination-atop';
array[BLEND_MODES.XOR] = 'xor';
// SUBTRACT from flash, does not exist in canvas
array[BLEND_MODES.SUBTRACT] = 'source-over';
return array;
}
| packages/canvas-renderer/src/utils/mapCanvasBlendModesToPixi.ts | 0 | https://github.com/pixijs/pixijs/commit/bacf0de3195b04aedc050c7afcaeb9d42bf6289b | [
0.00021620260667987168,
0.00017810318968258798,
0.00016478631005156785,
0.00016691343626007438,
0.000017782791474019177
] |
{
"id": 0,
"code_window": [
"/**\n",
" * This class provides renderer-specific plugins for exporting content from a renderer.\n",
" * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n",
" *\n",
" * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n",
" * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n",
" * @example\n",
" * import { Application, Graphics } from 'pixi.js';\n",
" *\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" * Do not instantiate these plugins directly. It is available from the `renderer.extract` property.\n"
],
"file_path": "packages/extract/src/Extract.ts",
"type": "replace",
"edit_start_line_idx": 12
} | varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform float m[20];
uniform float uAlpha;
void main(void)
{
vec4 c = texture2D(uSampler, vTextureCoord);
if (uAlpha == 0.0) {
gl_FragColor = c;
return;
}
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (c.a > 0.0) {
c.rgb /= c.a;
}
vec4 result;
result.r = (m[0] * c.r);
result.r += (m[1] * c.g);
result.r += (m[2] * c.b);
result.r += (m[3] * c.a);
result.r += m[4];
result.g = (m[5] * c.r);
result.g += (m[6] * c.g);
result.g += (m[7] * c.b);
result.g += (m[8] * c.a);
result.g += m[9];
result.b = (m[10] * c.r);
result.b += (m[11] * c.g);
result.b += (m[12] * c.b);
result.b += (m[13] * c.a);
result.b += m[14];
result.a = (m[15] * c.r);
result.a += (m[16] * c.g);
result.a += (m[17] * c.b);
result.a += (m[18] * c.a);
result.a += m[19];
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
// Premultiply alpha again.
rgb *= result.a;
gl_FragColor = vec4(rgb, result.a);
}
| packages/filter-color-matrix/src/colorMatrix.frag | 0 | https://github.com/pixijs/pixijs/commit/bacf0de3195b04aedc050c7afcaeb9d42bf6289b | [
0.0001663266884861514,
0.00016516206960659474,
0.00016437529120594263,
0.00016503121878486127,
5.951176262897206e-7
] |
{
"id": 1,
"code_window": [
" * @example\n",
" * import { Application, Graphics } from 'pixi.js';\n",
" *\n",
" * // Create a new app (will auto-add extract plugin to renderer)\n",
" * const app = new Application();\n",
" *\n",
" * // Draw a red circle\n",
" * const graphics = new Graphics()\n",
" * .beginFill(0xFF0000)\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" * // Create a new application (extract will be auto-added to renderer)\n"
],
"file_path": "packages/extract/src/Extract.ts",
"type": "replace",
"edit_start_line_idx": 17
} | import { BaseTexture, extensions, ExtensionType } from '@pixi/core';
import { Graphics } from '@pixi/graphics';
import { BasePrepare } from './BasePrepare';
import type { ExtensionMetadata, IRenderer, ISystem, Renderer } from '@pixi/core';
import type { IDisplayObjectExtended } from './BasePrepare';
/**
* Built-in hook to upload PIXI.Texture objects to the GPU.
* @private
* @param renderer - instance of the webgl renderer
* @param item - Item to check
* @returns If item was uploaded.
*/
function uploadBaseTextures(renderer: IRenderer | BasePrepare, item: IDisplayObjectExtended | BaseTexture): boolean
{
if (item instanceof BaseTexture)
{
// if the texture already has a GL texture, then the texture has been prepared or rendered
// before now. If the texture changed, then the changer should be calling texture.update() which
// reuploads the texture without need for preparing it again
if (!item._glTextures[(renderer as Renderer).CONTEXT_UID])
{
(renderer as Renderer).texture.bind(item);
}
return true;
}
return false;
}
/**
* Built-in hook to upload PIXI.Graphics to the GPU.
* @private
* @param renderer - instance of the webgl renderer
* @param item - Item to check
* @returns If item was uploaded.
*/
function uploadGraphics(renderer: IRenderer | BasePrepare, item: IDisplayObjectExtended): boolean
{
if (!(item instanceof Graphics))
{
return false;
}
const { geometry } = item;
// update dirty graphics to get batches
item.finishPoly();
geometry.updateBatches();
const { batches } = geometry;
// upload all textures found in styles
for (let i = 0; i < batches.length; i++)
{
const { texture } = batches[i].style;
if (texture)
{
uploadBaseTextures(renderer, texture.baseTexture);
}
}
// if its not batchable - update vao for particular shader
if (!geometry.batchable)
{
(renderer as Renderer).geometry.bind(geometry, (item as any)._resolveDirectShader((renderer as Renderer)));
}
return true;
}
/**
* Built-in hook to find graphics.
* @private
* @param item - Display object to check
* @param queue - Collection of items to upload
* @returns if a PIXI.Graphics object was found.
*/
function findGraphics(item: IDisplayObjectExtended, queue: Array<any>): boolean
{
if (item instanceof Graphics)
{
queue.push(item);
return true;
}
return false;
}
/**
* The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for
* asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.
*
* Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.
* See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.
* @example
* import { Application, Graphics } from 'pixi.js';
*
* // Create a new application
* const app = new Application();
* document.body.appendChild(app.view);
*
* // Don't start rendering right away
* app.stop();
*
* // create a display object
* const rect = new Graphics()
* .beginFill(0x00ff00)
* .drawRect(40, 40, 200, 200);
*
* // Add to the stage
* app.stage.addChild(rect);
*
* // Don't start rendering until the graphic is uploaded to the GPU
* app.renderer.prepare.upload(app.stage, () => {
* app.start();
* });
* @memberof PIXI
*/
export class Prepare extends BasePrepare implements ISystem
{
/** @ignore */
static extension: ExtensionMetadata = {
name: 'prepare',
type: ExtensionType.RendererSystem,
};
/**
* @param {PIXI.Renderer} renderer - A reference to the current renderer
*/
constructor(renderer: Renderer)
{
super(renderer);
this.uploadHookHelper = this.renderer;
// Add textures and graphics to upload
this.registerFindHook(findGraphics);
this.registerUploadHook(uploadBaseTextures);
this.registerUploadHook(uploadGraphics);
}
}
extensions.add(Prepare);
| packages/prepare/src/Prepare.ts | 1 | https://github.com/pixijs/pixijs/commit/bacf0de3195b04aedc050c7afcaeb9d42bf6289b | [
0.9946521520614624,
0.06792858988046646,
0.0001656769309192896,
0.00016999327635858208,
0.24772335588932037
] |
{
"id": 1,
"code_window": [
" * @example\n",
" * import { Application, Graphics } from 'pixi.js';\n",
" *\n",
" * // Create a new app (will auto-add extract plugin to renderer)\n",
" * const app = new Application();\n",
" *\n",
" * // Draw a red circle\n",
" * const graphics = new Graphics()\n",
" * .beginFill(0xFF0000)\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" * // Create a new application (extract will be auto-added to renderer)\n"
],
"file_path": "packages/extract/src/Extract.ts",
"type": "replace",
"edit_start_line_idx": 17
} | import { FORMATS, MIPMAP_MODES, MSAA_QUALITY, SCALE_MODES, TYPES } from '@pixi/constants';
import { Runner } from '@pixi/runner';
import { BaseTexture } from '../textures/BaseTexture';
import { DepthResource } from '../textures/resources/DepthResource';
import type { GLFramebuffer } from './GLFramebuffer';
/**
* A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses
* one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.
*
* On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.
* @memberof PIXI
*/
export class Framebuffer
{
/** Width of framebuffer in pixels. */
public width: number;
/** Height of framebuffer in pixels. */
public height: number;
/**
* Desired number of samples for antialiasing. 0 means AA should not be used.
*
* Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.
* Antialiasing is the same as for main buffer with renderer `antialias: true` options.
* Seriously affects GPU memory consumption and GPU performance.
* @example
* import { MSAA_QUALITY } from 'pixi.js';
*
* renderTexture.framebuffer.multisample = MSAA_QUALITY.HIGH;
* // ...
* renderer.render(myContainer, { renderTexture });
* renderer.framebuffer.blit(); // Copies data from MSAA framebuffer to texture
* @default PIXI.MSAA_QUALITY.NONE
*/
public multisample: MSAA_QUALITY;
stencil: boolean;
depth: boolean;
dirtyId: number;
dirtyFormat: number;
dirtySize: number;
depthTexture: BaseTexture;
colorTextures: Array<BaseTexture>;
glFramebuffers: {[key: string]: GLFramebuffer};
disposeRunner: Runner;
/**
* @param width - Width of the frame buffer
* @param height - Height of the frame buffer
*/
constructor(width: number, height: number)
{
this.width = Math.round(width || 100);
this.height = Math.round(height || 100);
this.stencil = false;
this.depth = false;
this.dirtyId = 0;
this.dirtyFormat = 0;
this.dirtySize = 0;
this.depthTexture = null;
this.colorTextures = [];
this.glFramebuffers = {};
this.disposeRunner = new Runner('disposeFramebuffer');
this.multisample = MSAA_QUALITY.NONE;
}
/**
* Reference to the colorTexture.
* @readonly
*/
get colorTexture(): BaseTexture
{
return this.colorTextures[0];
}
/**
* Add texture to the colorTexture array.
* @param index - Index of the array to add the texture to
* @param texture - Texture to add to the array
*/
addColorTexture(index = 0, texture?: BaseTexture): this
{
// TODO add some validation to the texture - same width / height etc?
this.colorTextures[index] = texture || new BaseTexture(null, {
scaleMode: SCALE_MODES.NEAREST,
resolution: 1,
mipmap: MIPMAP_MODES.OFF,
width: this.width,
height: this.height,
});
this.dirtyId++;
this.dirtyFormat++;
return this;
}
/**
* Add a depth texture to the frame buffer.
* @param texture - Texture to add.
*/
addDepthTexture(texture?: BaseTexture): this
{
/* eslint-disable max-len */
this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {
scaleMode: SCALE_MODES.NEAREST,
resolution: 1,
width: this.width,
height: this.height,
mipmap: MIPMAP_MODES.OFF,
format: FORMATS.DEPTH_COMPONENT,
type: TYPES.UNSIGNED_SHORT,
});
this.dirtyId++;
this.dirtyFormat++;
return this;
}
/** Enable depth on the frame buffer. */
enableDepth(): this
{
this.depth = true;
this.dirtyId++;
this.dirtyFormat++;
return this;
}
/** Enable stencil on the frame buffer. */
enableStencil(): this
{
this.stencil = true;
this.dirtyId++;
this.dirtyFormat++;
return this;
}
/**
* Resize the frame buffer
* @param width - Width of the frame buffer to resize to
* @param height - Height of the frame buffer to resize to
*/
resize(width: number, height: number): void
{
width = Math.round(width);
height = Math.round(height);
if (width === this.width && height === this.height) return;
this.width = width;
this.height = height;
this.dirtyId++;
this.dirtySize++;
for (let i = 0; i < this.colorTextures.length; i++)
{
const texture = this.colorTextures[i];
const resolution = texture.resolution;
// take into account the fact the texture may have a different resolution..
texture.setSize(width / resolution, height / resolution);
}
if (this.depthTexture)
{
const resolution = this.depthTexture.resolution;
this.depthTexture.setSize(width / resolution, height / resolution);
}
}
/** Disposes WebGL resources that are connected to this geometry. */
dispose(): void
{
this.disposeRunner.emit(this, false);
}
/** Destroys and removes the depth texture added to this framebuffer. */
destroyDepthTexture(): void
{
if (this.depthTexture)
{
this.depthTexture.destroy();
this.depthTexture = null;
++this.dirtyId;
++this.dirtyFormat;
}
}
}
| packages/core/src/framebuffer/Framebuffer.ts | 0 | https://github.com/pixijs/pixijs/commit/bacf0de3195b04aedc050c7afcaeb9d42bf6289b | [
0.00017685993225313723,
0.00017027869762387127,
0.00016196655633393675,
0.0001707336923573166,
0.000003232829385524383
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.