@devgateway/dvz-wp-commons 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,10 @@
1
- import React from 'react';
2
- export type MapCSVSourceConfigProps = {
1
+ export function MapCSVSourceConfig({ attributes: { app, csv, hasMultipleMeasures, enableSummaryView }, setAttributes }: {
3
2
  attributes: {
4
- app: string;
5
- csv: string;
6
- hasMultipleMeasures: boolean;
7
- enableSummaryView: boolean;
3
+ app: any;
4
+ csv: any;
5
+ hasMultipleMeasures: any;
6
+ enableSummaryView: any;
8
7
  };
9
- setAttributes: (attributes: any) => void;
10
- };
11
- export declare const MapCSVSourceConfig: ({ attributes: { app, csv, hasMultipleMeasures, enableSummaryView }, setAttributes }: MapCSVSourceConfigProps) => React.JSX.Element[];
8
+ setAttributes: any;
9
+ }): import("react").JSX.Element[];
12
10
  export default MapCSVSourceConfig;
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { PanelBody, PanelRow, ToggleControl, TextareaControl } from '@wordpress/components';
1
+ import { PanelBody, PanelRow, ToggleControl, TextareaControl, SelectControl } from '@wordpress/components';
3
2
  import { __ } from '@wordpress/i18n';
4
3
  export const MapCSVSourceConfig = ({ attributes: { app, csv, hasMultipleMeasures, enableSummaryView }, setAttributes }) => {
5
4
  return ([React.createElement(PanelBody, { initialOpen: false, title: __("CSV Configuration") },
@@ -1,25 +1,2 @@
1
- import React from 'react';
2
- import { Measure } from './types';
3
- export type MeasuresProps = {
4
- onMeasuresChange?: (measure: string) => void;
5
- onFormatChange: (format: string, field: string) => void;
6
- onUseCustomAxisFormatChange?: (value: boolean) => void;
7
- onSetSingleMeasure: (measure: string) => void;
8
- onCustomLabelToggleChange?: (measure: string) => void;
9
- onCustomLabelChange?: (measure: string, value: string) => void;
10
- allMeasures: Measure[];
11
- setAttributes: (attributes: any) => void;
12
- title?: string;
13
- format?: any;
14
- currentType?: string;
15
- attributes: {
16
- panelStatus?: any;
17
- measures: Measure[];
18
- dimension1: string;
19
- dimension2?: string;
20
- type: string;
21
- app: string;
22
- };
23
- };
24
- export declare const Measures: (props: MeasuresProps) => React.JSX.Element;
1
+ export function Measures(props: any): import("react").JSX.Element;
25
2
  export default Measures;
package/build/Measures.js CHANGED
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { __ } from '@wordpress/i18n';
3
2
  import { CheckboxControl, PanelBody, PanelRow, SelectControl, ToggleControl, TextControl } from '@wordpress/components';
4
3
  import Format from './Format';
@@ -14,7 +13,7 @@ export const Measures = (props) => {
14
13
  const { onMeasuresChange, onFormatChange, onUseCustomAxisFormatChange, onSetSingleMeasure, onCustomLabelToggleChange, onCustomLabelChange, allMeasures, setAttributes, title, format, attributes: { panelStatus, measures, dimension1, dimension2, type, app } } = props;
15
14
  const MToggle = ({ measure }) => {
16
15
  const userMeasure = measures[app] ? measures[app][measure.value] : {};
17
- return (React.createElement(ToggleControl, { label: getTranslation(measure), checked: userMeasure ? userMeasure.selected : false, onChange: (value) => onMeasuresChange?.(measure.value) }));
16
+ return (React.createElement(ToggleControl, { label: getTranslation(measure), checked: userMeasure ? userMeasure.selected : false, onChange: (value) => onMeasuresChange(measure.value) }));
18
17
  };
19
18
  const MCheckbox = ({ measure }) => {
20
19
  const userMeasure = measures[app] ? measures[app][measure.value] : {};
@@ -65,19 +64,17 @@ export const Measures = (props) => {
65
64
  /*
66
65
  Multiple measures conditions
67
66
 
68
- Bar:
69
- no dimensions selected
70
- one dimension is selected
71
- - not available when second dimension gets selected
72
-
73
- Line:
74
- - Always multi measure as measures represents line series, one dimension should always be selected
67
+ Bar & Line:
68
+ no dimensions selected
69
+ one dimension is selected
70
+ - not available when second dimension gets selected
75
71
 
76
72
  Pie:
77
73
  no dimensions selected
78
74
  - not available when any dimension is selected
79
75
  */
80
- ((type == 'line') || (type == 'radar') ||
76
+ ((type == 'radar') ||
77
+ (type == 'line' && dimension2 == 'none') ||
81
78
  (type == 'bar' && dimension2 == 'none') ||
82
79
  (type == 'pie' && dimension1 == 'none' && dimension2 == 'none')) && allMeasures && [...new Set(allMeasures.map(p => getTranslation(p.group)))].map(g => {
83
80
  return (React.createElement(PanelBody, { initialOpen: panelStatus[g], onToggle: e => togglePanel(g, panelStatus, setAttributes), title: `${g} (${countSelected(g)} / ${countTotal(g)} ) ` }, allMeasures.filter(f => getTranslation(f.group) === g)
@@ -86,27 +83,23 @@ export const Measures = (props) => {
86
83
  }),
87
84
  /*Single measure conditions
88
85
 
89
- Bar:
90
- 2 dimensions selected
91
- Line:
92
- never
93
- Pie:
94
- any dimensions selected
86
+ Bar & Lie:
87
+ 2 dimensions selected
88
+ Pie:
89
+ any dimensions selected
95
90
 
96
- */
97
- ((type == 'big-number') || (type == 'bar' && dimension2 != 'none') || (type == 'pie' && (dimension1 != 'none' || dimension2 != 'none'))) && allMeasures && [...new Set(allMeasures.map(p => getTranslation(p.group)))].map(g => {
91
+ */
92
+ ((type == 'big-number') || (type == 'line' && dimension2 != 'none') || (type == 'bar' && dimension2 != 'none') || (type == 'pie' && (dimension1 != 'none' || dimension2 != 'none'))) && allMeasures && [...new Set(allMeasures.map(p => getTranslation(p.group)))].map(g => {
98
93
  return (React.createElement(PanelBody, { initialOpen: panelStatus[g], onToggle: e => togglePanel(g, panelStatus, setAttributes), title: `${g} (${countSelected(g)} / ${countTotal(g)} ) ` }, allMeasures.filter(f => getTranslation(f.group) === g)
99
94
  .map(m => React.createElement(PanelRow, null,
100
95
  React.createElement(MeasureOptions, { single: true, measure: m })))));
101
96
  }),
102
- (type == 'overlay') && allMeasures && React.createElement(SelectControl, { label: "Measure",
103
- // @ts-ignore
104
- value: selectedMeasures && selectedMeasures[0] ? selectedMeasures[0].value : null, options: [{ value: '', label: 'Select Measure' }, ...allMeasures], onChange: (measure) => onSetSingleMeasure(measure), __nextHasNoMarginBottom: true }),
97
+ (type == 'overlay') && allMeasures && React.createElement(SelectControl, { label: "Measure", value: selectedMeasures && selectedMeasures[0] ? selectedMeasures[0].value : null, options: [{ value: '', label: 'Select Measure' }, ...allMeasures], onChange: (measure) => onSetSingleMeasure(measure), __nextHasNoMarginBottom: true }),
105
98
  (type != 'overlay') && React.createElement(PanelBody, { title: __("Format"), initialOpen: panelStatus["FORMAT"], onToggle: e => togglePanel("FORMAT", panelStatus, setAttributes) },
106
99
  React.createElement(Format, { hiddenCustomAxisFormat: type == 'radar' || type == 'big-number', format: format || (measures[app] && measures[app].format ? measures[app].format : defaultFormat), customFormat: measures[app] && measures[app].customFormat ? measures[app].customFormat : defaultFormat, useCustomAxisFormat: measures[app] ? measures[app].useCustomAxisFormat : false, onFormatChange: (format, field) => {
107
100
  onFormatChange(format, field);
108
101
  }, onUseCustomAxisFormatChange: value => {
109
- onUseCustomAxisFormatChange?.(value);
102
+ onUseCustomAxisFormatChange(value);
110
103
  } }))),
111
104
  (type != 'overlay') && selectedMeasures && selectedMeasures.length > 0 &&
112
105
  React.createElement(PanelBody, { title: __("Measure Label Customization"), initialOpen: panelStatus["MEASURES_LABEL_CUSTOMIZATION"], onToggle: e => togglePanel("MEASURES_LABEL_CUSTOMIZATION", panelStatus, setAttributes) }, selectedMeasures && [...new Set(selectedMeasures.map(p => getTranslation(p.group)))].map(g => {
@@ -115,11 +108,11 @@ export const Measures = (props) => {
115
108
  const userMeasure = measures[app] ? measures[app][m.value] : {};
116
109
  return (React.createElement(React.Fragment, null,
117
110
  React.createElement(PanelRow, null,
118
- React.createElement(ToggleControl, { label: getTranslation(m), checked: userMeasure ? userMeasure.hasCustomLabel : false, onChange: (value) => onCustomLabelToggleChange?.(m.value) }),
111
+ React.createElement(ToggleControl, { label: getTranslation(m), checked: userMeasure ? userMeasure.hasCustomLabel : false, onChange: (value) => onCustomLabelToggleChange(m.value) }),
119
112
  " "),
120
113
  userMeasure.hasCustomLabel &&
121
114
  React.createElement(PanelRow, null,
122
- React.createElement(TextControl, { label: __("Custom Label"), value: userMeasure ? userMeasure.customLabel : "", onChange: (value) => onCustomLabelChange?.(m.value, value) }))));
115
+ React.createElement(TextControl, { label: __("Custom Label"), value: userMeasure ? userMeasure.customLabel : "", onChange: (value) => onCustomLabelChange(m.value, value) }))));
123
116
  })));
124
117
  })));
125
118
  };
@@ -1,6 +1,6 @@
1
- export declare function extractAxisValues(csvData: string): string[];
2
- export declare function transformDataToAppObject(data: any[], appName: string, existingObject?: any): any;
3
- export declare function getSelectedItemsForApp(config: Record<string, any>, appName: string): {};
4
- export declare function getSelectedLabelsForApp(data: any, appName: string): any[];
5
- export declare function updateMeasureLabels(data: any, measures: any, app: string): void;
6
- export declare function getStoredOrSetItem(key: any, fallback: any, overwrite?: boolean): any;
1
+ export function extractAxisValues(csvData: any): any;
2
+ export function transformDataToAppObject(data: any, appName: any, existingObject?: {}): {};
3
+ export function getSelectedItemsForApp(config: any, appName: any): {};
4
+ export function getSelectedLabelsForApp(data: any, appName: any): any[];
5
+ export function updateMeasureLabels(data: any, measures: any, app: any): void;
6
+ export function getStoredOrSetItem(key: any, fallback: any, overwrite?: boolean): any;
@@ -1,4 +1,4 @@
1
- import isEmpty from 'lodash.isempty';
1
+ import _ from 'lodash';
2
2
  import { getTranslatedOptions } from "./APIutils";
3
3
  export function extractAxisValues(csvData) {
4
4
  const lines = csvData.split("\n");
@@ -12,20 +12,22 @@ export function transformDataToAppObject(data, appName, existingObject = {}) {
12
12
  return existingObject;
13
13
  }
14
14
  existingObject[appName] = {};
15
- data?.forEach((item) => {
16
- const key = item.value;
17
- existingObject[appName][key] = {
18
- selected: false,
19
- format: {
20
- style: "percent",
21
- minimumFractionDigits: 1,
22
- maximumFractionDigits: 1,
23
- currency: "USD",
24
- },
25
- hasCustomLabel: false,
26
- customLabel: item.label || key,
27
- };
28
- });
15
+ if (data) {
16
+ data.forEach((item) => {
17
+ const key = item.value;
18
+ existingObject[appName][key] = {
19
+ selected: false,
20
+ format: {
21
+ style: "percent",
22
+ minimumFractionDigits: 1,
23
+ maximumFractionDigits: 1,
24
+ currency: "USD",
25
+ },
26
+ hasCustomLabel: false,
27
+ customLabel: item.label || key,
28
+ };
29
+ });
30
+ }
29
31
  return existingObject;
30
32
  }
31
33
  export function getSelectedItemsForApp(config, appName) {
@@ -42,7 +44,7 @@ export function getSelectedItemsForApp(config, appName) {
42
44
  return selectedEntries;
43
45
  }
44
46
  export function getSelectedLabelsForApp(data, appName) {
45
- const appData = data[appName];
47
+ const appData = data;
46
48
  if (!appData) {
47
49
  return [];
48
50
  }
@@ -66,20 +68,14 @@ export function updateMeasureLabels(data, measures, app) {
66
68
  }
67
69
  });
68
70
  }
69
- ;
70
71
  export function getStoredOrSetItem(key, fallback, overwrite = false) {
71
72
  const fallbackValue = fallback || [];
72
- if (overwrite && !isEmpty(fallbackValue)) {
73
+ if (overwrite && !_.isEmpty(fallbackValue)) {
73
74
  sessionStorage
74
75
  .setItem(key, JSON.stringify(fallbackValue));
75
76
  return fallbackValue;
76
77
  }
77
- const storedItem = sessionStorage.getItem(key);
78
- if (storedItem === null) {
79
- sessionStorage.setItem(key, JSON.stringify(fallbackValue));
80
- return fallbackValue;
81
- }
82
- const stored = JSON.parse(storedItem);
78
+ const stored = JSON.parse(sessionStorage.getItem(key));
83
79
  if (!stored) {
84
80
  sessionStorage.setItem(key, JSON.stringify(fallbackValue));
85
81
  return fallbackValue;
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- export declare const Tooltip: (props: any) => React.JSX.Element[];
1
+ export function Tooltip(props: any): React.JSX.Element[];
3
2
  export default Tooltip;
3
+ import React from 'react';
package/build/Util.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- export declare const togglePanel: <T extends Record<string, any> = Record<string, any>>(name: string, panelStatus: Record<string, boolean>, setAttributes: (attributes: T) => void) => void;
2
- export declare const panelFocus: <T extends Record<string, any> = Record<string, any>>(name: string, panelStatus: Record<string, boolean>, setAttributes: (attributes: T) => void) => void;
3
- declare const _default: {
4
- togglePanel: <T extends Record<string, any> = Record<string, any>>(name: string, panelStatus: Record<string, boolean>, setAttributes: (attributes: T) => void) => void;
5
- panelFocus: <T extends Record<string, any> = Record<string, any>>(name: string, panelStatus: Record<string, boolean>, setAttributes: (attributes: T) => void) => void;
6
- };
1
+ export function togglePanel(name: any, panelStatus: any, setAttributes: any): void;
2
+ export function panelFocus(name: any): void;
3
+ declare namespace _default {
4
+ export { togglePanel };
5
+ }
7
6
  export default _default;
package/build/Util.js CHANGED
@@ -3,9 +3,9 @@ export const togglePanel = (name, panelStatus, setAttributes) => {
3
3
  newStatus[name] = newStatus[name] == true ? false : true;
4
4
  setAttributes({ panelStatus: newStatus });
5
5
  };
6
- export const panelFocus = (name, panelStatus, setAttributes) => {
6
+ export const panelFocus = (name) => {
7
7
  const newStatus = { ...panelStatus };
8
8
  newStatus[name] = newStatus[name] == true ? false : true;
9
9
  setAttributes({ panelFocus: newStatus });
10
10
  };
11
- export default { togglePanel, panelFocus };
11
+ export default { togglePanel };
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- export declare const ChartIcon: () => React.JSX.Element;
1
+ export function ChartIcon(): React.JSX.Element;
3
2
  export default ChartIcon;
3
+ import React from 'react';
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- export declare const GenericIcon: () => React.JSX.Element;
1
+ export function GenericIcon(): React.JSX.Element;
3
2
  export default GenericIcon;
3
+ import React from 'react';
@@ -1,2 +1,2 @@
1
- export { GenericIcon } from './Generic';
2
- export { ChartIcon } from './Chart';
1
+ export { GenericIcon } from "./Generic";
2
+ export { ChartIcon } from "./Chart";
package/build/index.d.ts CHANGED
@@ -1,18 +1,16 @@
1
- export { APIConfig } from './APIConfig';
2
- export { getTranslatedOptions, getTranslation, isSupersetAPI } from './APIutils';
3
- export { BlockEditWithAPIMetadata, BlockEditWithFilters, type BlockEditWithFiltersState, type BlockEditWithAPIMetadataState, type BlockEditWithAPIMetadataProps, type BlockEditWithFiltersProps, ComponentWithSettings, type ComponentWithSettingsProps, type ComponentWithSettingsState, SizeConfig, type SizeConfigProps } from './Blocks';
4
- export { categorical, sequential, diverging, type ChartColorsProps, ChartColors } from './ChartColors';
5
- export { ChartLegends, type LegendProps as ChartLegendsProps } from './ChartLegends';
6
- export { ChartMeasures, type ChartMeasuresProps } from './ChartMeasures';
7
- export { DEFAULT_FORMAT_SETTINGS, BLOCKS_CATEGORY, BLOCKS_NS } from './Constants';
8
- export { CSVConfig } from './CSVSourceConfig';
9
- export { DataFilters, type DataFiltersProps } from './DataFilters';
10
- export { Format, type FormatProps } from './Format';
11
- export { MapCSVSourceConfig, type MapCSVSourceConfigProps } from './MapCSVSourceConfig';
12
- export { Measures, type MeasuresProps } from './Measures';
13
- export { extractAxisValues, getSelectedLabelsForApp, transformDataToAppObject, updateMeasureLabels, getSelectedItemsForApp, getStoredOrSetItem } from './MobileConfigUtils';
14
- export { Tooltip, } from './Tooltip';
15
- export * from './types';
16
- export { panelFocus, togglePanel } from './Util';
17
- export * from './icons';
18
- export * from './post-type';
1
+ export { APIConfig } from "./APIConfig";
2
+ export { CSVConfig } from "./CSVSourceConfig";
3
+ export { DataFilters } from "./DataFilters";
4
+ export { Format } from "./Format";
5
+ export { MapCSVSourceConfig } from "./MapCSVSourceConfig";
6
+ export { Measures } from "./Measures";
7
+ export { Tooltip } from "./Tooltip";
8
+ export { ChartLegends } from "./ChartLegends";
9
+ export { ChartMeasures } from "./ChartMeasures";
10
+ export { getTranslatedOptions, getTranslation, isSupersetAPI } from "./APIutils";
11
+ export { BlockEditWithAPIMetadata, BlockEditWithFilters, ComponentWithSettings, SizeConfig } from "./Blocks";
12
+ export { categorical, sequential, diverging, ChartColors } from "./ChartColors";
13
+ export { DEFAULT_FORMAT_SETTINGS, BLOCKS_CATEGORY, BLOCKS_NS } from "./Constants";
14
+ export { extractAxisValues, getSelectedLabelsForApp, transformDataToAppObject, updateMeasureLabels, getSelectedItemsForApp, getStoredOrSetItem } from "./MobileConfigUtils";
15
+ export { panelFocus, togglePanel } from "./Util";
16
+ export { GenericIcon, ChartIcon } from "./icons/index";
package/build/index.js CHANGED
@@ -2,18 +2,15 @@ export { APIConfig } from './APIConfig';
2
2
  export { getTranslatedOptions, getTranslation, isSupersetAPI } from './APIutils';
3
3
  export { BlockEditWithAPIMetadata, BlockEditWithFilters, ComponentWithSettings, SizeConfig } from './Blocks';
4
4
  export { categorical, sequential, diverging, ChartColors } from './ChartColors';
5
- export { ChartLegends } from './ChartLegends';
6
- export { ChartMeasures } from './ChartMeasures';
7
5
  export { DEFAULT_FORMAT_SETTINGS, BLOCKS_CATEGORY, BLOCKS_NS } from './Constants';
8
6
  export { CSVConfig } from './CSVSourceConfig';
9
- export { DataFilters } from './DataFilters';
10
- export { Format } from './Format';
11
- export { MapCSVSourceConfig } from './MapCSVSourceConfig';
12
- export { Measures } from './Measures';
7
+ export { DataFilters, } from './DataFilters';
8
+ export { Format, } from './Format';
9
+ export { MapCSVSourceConfig, } from './MapCSVSourceConfig';
10
+ export { Measures, } from './Measures';
13
11
  export { extractAxisValues, getSelectedLabelsForApp, transformDataToAppObject, updateMeasureLabels, getSelectedItemsForApp, getStoredOrSetItem } from './MobileConfigUtils';
14
12
  export { Tooltip, } from './Tooltip';
15
- export * from './types';
16
13
  export { panelFocus, togglePanel } from './Util';
17
- export * from './icons';
18
- // export * from './hooks';
19
- export * from './post-type';
14
+ export { ChartLegends } from './ChartLegends';
15
+ export { ChartMeasures } from './ChartMeasures';
16
+ export { GenericIcon, ChartIcon } from './icons/index';
@@ -1 +1 @@
1
- {"root":["../src/APIConfig.tsx","../src/APIutils.ts","../src/Blocks.tsx","../src/CSVSourceConfig.tsx","../src/ChartColors.tsx","../src/ChartLegends.tsx","../src/ChartMeasures.tsx","../src/Constants.ts","../src/DataFilters.tsx","../src/Format.tsx","../src/MapCSVSourceConfig.tsx","../src/Measures.tsx","../src/MobileConfigUtils.ts","../src/Tooltip.tsx","../src/Util.tsx","../src/common-types.d.ts","../src/index.ts","../src/post-type.ts","../src/types.ts","../src/hooks/index.ts","../src/icons/Chart.tsx","../src/icons/Generic.tsx","../src/icons/index.ts"],"version":"5.8.3"}
1
+ {"root":["../src/APIConfig.js","../src/APIutils.js","../src/Blocks.js","../src/CSVSourceConfig.js","../src/ChartColors.jsx","../src/ChartLegends.jsx","../src/ChartMeasures.jsx","../src/Constants.js","../src/DataFilters.jsx","../src/Format.jsx","../src/MapCSVSourceConfig.js","../src/Measures.jsx","../src/MobileConfigUtils.js","../src/Tooltip.jsx","../src/Util.jsx","../src/index.js","../src/hooks/index.ts","../src/icons/Chart.js","../src/icons/Generic.js","../src/icons/index.js"],"version":"5.9.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-wp-commons",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "description": "Common Utilities for Data Viz Wordpress that can be also used in other projects",
6
6
  "author": "Sebastian Dimunzio",
@@ -34,41 +34,41 @@
34
34
  "registry": "https://registry.npmjs.org/"
35
35
  },
36
36
  "devDependencies": {
37
- "@babel/runtime": "^7.27.0",
37
+ "@babel/runtime": "^7.28.4",
38
38
  "@colbyfayock/semantic-release-pnpm": "^1.2.2",
39
39
  "@semantic-release/changelog": "^6.0.3",
40
40
  "@types/lodash.isempty": "^4.4.9",
41
- "@types/papaparse": "^5.3.15",
41
+ "@types/papaparse": "^5.3.16",
42
42
  "@types/react": "18.3.1",
43
- "@types/wordpress__block-editor": "^11.5.16",
44
- "@wordpress/scripts": "^30.15.0",
45
- "dotenv": "^16.5.0",
46
- "dotenv-webpack": "^8.1.0",
47
- "semantic-release": "^24.2.3",
43
+ "@types/wordpress__block-editor": "^11.5.17",
44
+ "@wordpress/scripts": "^30.25.0",
45
+ "dotenv": "^17.2.3",
46
+ "dotenv-webpack": "^8.1.1",
47
+ "semantic-release": "^24.2.9",
48
48
  "semantic-release-monorepo": "^8.0.2",
49
- "ts-loader": "^9.5.2",
50
- "typescript": "^5.8.3"
51
- },
52
- "scripts": {
53
- "build": "tsc -b",
54
- "format:js": "wp-scripts format-js",
55
- "lint:js": "wp-scripts lint-js",
56
- "start": "tsc -w"
49
+ "ts-loader": "^9.5.4",
50
+ "typescript": "^5.9.3"
57
51
  },
58
52
  "dependencies": {
59
- "@wordpress/api-fetch": "^7.22.0",
60
- "@wordpress/block-editor": "^14.17.0",
61
- "@wordpress/components": "^29.8.0",
62
- "@wordpress/data": "^10.22.0",
63
- "@wordpress/editor": "^14.22.0",
64
- "@wordpress/element": "^6.22.0",
65
- "@wordpress/i18n": "^5.22.0",
66
- "@wordpress/icons": "^10.22.0",
53
+ "@wordpress/api-fetch": "^7.32.0",
54
+ "@wordpress/block-editor": "^15.5.0",
55
+ "@wordpress/components": "^30.5.0",
56
+ "@wordpress/data": "^10.32.0",
57
+ "@wordpress/editor": "^14.32.0",
58
+ "@wordpress/element": "^6.32.0",
59
+ "@wordpress/i18n": "^6.5.0",
60
+ "@wordpress/icons": "^10.32.0",
67
61
  "classnames": "^2.5.1",
68
62
  "lodash.isempty": "^4.4.0",
69
- "papaparse": "^5.5.2"
63
+ "papaparse": "^5.5.3"
70
64
  },
71
65
  "peerDependencies": {
72
66
  "react": "18.3.1"
67
+ },
68
+ "scripts": {
69
+ "build": "tsc -b",
70
+ "format:js": "wp-scripts format-js",
71
+ "lint:js": "wp-scripts lint-js",
72
+ "start": "tsc -w"
73
73
  }
74
- }
74
+ }
@@ -1,193 +0,0 @@
1
- import { About, Cury, Meta, Self, WpTerm } from "./types";
2
- export interface Post {
3
- id: number;
4
- date: Date;
5
- date_gmt: Date;
6
- guid: PostGUID;
7
- modified: Date;
8
- modified_gmt: Date;
9
- slug: string;
10
- status: string;
11
- type: string;
12
- link: string;
13
- title: PostGUID;
14
- content: PostContent;
15
- excerpt: PostContent;
16
- author: number;
17
- featured_media: number;
18
- comment_status: string;
19
- ping_status: string;
20
- sticky: boolean;
21
- template: string;
22
- format: string;
23
- meta: Meta;
24
- categories: number[];
25
- tags: any[];
26
- bread_crumbs: any[];
27
- class_list: string[];
28
- acf: any[];
29
- yoast_head: string;
30
- yoast_head_json: PostYoastHeadJSON;
31
- meta_fields: {
32
- [key: string]: string[];
33
- };
34
- meta_fields_2: {
35
- [key: string]: string[];
36
- };
37
- _links: PostLinks;
38
- }
39
- export interface PostLinks {
40
- self: Self[];
41
- collection: About[];
42
- about: About[];
43
- author: PostAuthorElement[];
44
- replies: PostAuthorElement[];
45
- "version-history": PostVersionHistory[];
46
- "predecessor-version": PostPredecessorVersion[];
47
- "wp:attachment": About[];
48
- "wp:term": WpTerm[];
49
- curies: Cury[];
50
- }
51
- export interface PostAuthorElement {
52
- embeddable: boolean;
53
- href: string;
54
- }
55
- export interface PostPredecessorVersion {
56
- id: number;
57
- href: string;
58
- }
59
- export interface PostVersionHistory {
60
- count: number;
61
- href: string;
62
- }
63
- export declare enum PostTaxonomy {
64
- BreadCrumbs = "bread_crumbs",
65
- Category = "category",
66
- PostTag = "post_tag"
67
- }
68
- export interface PostContent {
69
- rendered: string;
70
- protected: boolean;
71
- }
72
- export interface PostGUID {
73
- rendered: string;
74
- }
75
- export interface PostMeta {
76
- _acf_changed: boolean;
77
- inline_featured_image: boolean;
78
- redirect_url: string;
79
- myguten_meta_block_field: string;
80
- footnotes: string;
81
- }
82
- export interface PostYoastHeadJSON {
83
- title?: string;
84
- robots?: PostRobots;
85
- canonical?: string;
86
- og_locale?: string;
87
- og_type?: string;
88
- og_title?: string;
89
- og_url?: string;
90
- og_site_name?: string;
91
- article_published_time?: Date;
92
- article_modified_time?: Date;
93
- og_image?: PostOgImage[];
94
- author?: string;
95
- twitter_card?: string;
96
- twitter_creator?: string;
97
- twitter_site?: string;
98
- twitter_misc?: PostTwitterMisc;
99
- schema?: PostSchema;
100
- og_description?: string;
101
- }
102
- export interface PostOgImage {
103
- width: number | string;
104
- height: number | string;
105
- url: string;
106
- type: string;
107
- }
108
- export interface PostRobots {
109
- index: string;
110
- follow: string;
111
- "max-snippet": string;
112
- "max-image-preview": string;
113
- "max-video-preview": string;
114
- }
115
- export interface PostSchema {
116
- "@context": string;
117
- "@graph": PostGraph[];
118
- }
119
- export interface PostGraph {
120
- "@type": string;
121
- "@id": string;
122
- isPartOf?: Breadcrumb;
123
- author?: GraphAuthorClass;
124
- headline?: string;
125
- datePublished?: Date;
126
- dateModified?: Date;
127
- mainEntityOfPage?: Breadcrumb;
128
- wordCount?: number;
129
- commentCount?: number;
130
- publisher?: Breadcrumb;
131
- inLanguage?: string;
132
- potentialAction?: PotentialAction[];
133
- url?: string;
134
- name?: string;
135
- description?: string;
136
- alternateName?: string;
137
- logo?: PostImage;
138
- image?: PostImage;
139
- sameAs?: string[];
140
- articleSection?: string[];
141
- breadcrumb?: Breadcrumb;
142
- itemListElement?: ItemListElement[];
143
- thumbnailUrl?: string;
144
- primaryImageOfPage?: Breadcrumb;
145
- contentUrl?: string;
146
- }
147
- export interface GraphAuthorClass {
148
- name: string;
149
- "@id": string;
150
- }
151
- export interface Breadcrumb {
152
- "@id": string;
153
- }
154
- export interface PostImage {
155
- "@id": string;
156
- "@type"?: string;
157
- inLanguage?: string;
158
- url?: string;
159
- contentUrl?: string;
160
- caption?: string;
161
- width?: number;
162
- height?: number;
163
- }
164
- export interface ItemListElement {
165
- "@type": string;
166
- position: number;
167
- name: string;
168
- item?: string;
169
- }
170
- export interface PotentialAction {
171
- "@type": PotentialActionType;
172
- name?: string;
173
- target: string[] | TargetClass;
174
- "query-input"?: QueryInput;
175
- }
176
- export declare enum PotentialActionType {
177
- CommentAction = "CommentAction",
178
- ReadAction = "ReadAction",
179
- SearchAction = "SearchAction"
180
- }
181
- export interface QueryInput {
182
- "@type": string;
183
- valueRequired: boolean;
184
- valueName: string;
185
- }
186
- export interface TargetClass {
187
- "@type": string;
188
- urlTemplate: string;
189
- }
190
- export interface PostTwitterMisc {
191
- "Written by": string;
192
- "Est. reading time"?: string;
193
- }
@@ -1,12 +0,0 @@
1
- export var PostTaxonomy;
2
- (function (PostTaxonomy) {
3
- PostTaxonomy["BreadCrumbs"] = "bread_crumbs";
4
- PostTaxonomy["Category"] = "category";
5
- PostTaxonomy["PostTag"] = "post_tag";
6
- })(PostTaxonomy || (PostTaxonomy = {}));
7
- export var PotentialActionType;
8
- (function (PotentialActionType) {
9
- PotentialActionType["CommentAction"] = "CommentAction";
10
- PotentialActionType["ReadAction"] = "ReadAction";
11
- PotentialActionType["SearchAction"] = "SearchAction";
12
- })(PotentialActionType || (PotentialActionType = {}));