Skip to content

Commit bb021cc

Browse files
authored
Dashboard: rename widget-types to widget-primitives and consolidate the widget contract (#78749)
* add version number graphic to welcome banner parametric 0-9 glyphs with per-stroke gradients, all WPDS tokens * rename widget-types to widget-kit the data layer is a host-agnostic widget toolkit, not only types * move render contract and resolver to widget-kit getLazyWidgetComponent moves to widget-kit/tools; widget-dashboard no longer declares the contract types * consume widget-kit contract from its barrel drop the widget-dashboard re-exports; WidgetModule and UseWidgetTypesResult stay internal to the kit * rewrite the widget-kit README define what the toolkit is and its purpose; use host instead of surface; note the future private @wordpress/widget-kit package * rename widget-kit to widget-primitives aligns with the Gutenberg "primitives" idiom for shared foundational layers (per #78749 review)
1 parent 4f30749 commit bb021cc

29 files changed

Lines changed: 133 additions & 114 deletions

routes/dashboard/stage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { store as viewportStore } from '@wordpress/viewport';
1414
import { useDashboardGridSettings, useDashboardLayout } from './hooks';
1515
import { WidgetDashboard } from './widget-dashboard';
1616
import type { DashboardWidget } from './widget-dashboard';
17-
import { useWidgetTypes } from './widget-types';
17+
import { useWidgetTypes } from './widget-primitives';
1818

1919
function Dashboard() {
2020
const [ layout, setLayout, resetLayout ] = useDashboardLayout(

routes/dashboard/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"types": [ "style-imports" ]
1212
},
1313
"include": [ "**/*.ts", "**/*.tsx" ],
14-
"exclude": [ "**/test/**", "build", "node_modules", "widget-types" ]
14+
"exclude": [ "**/test/**", "build", "node_modules", "widget-primitives" ]
1515
}

routes/dashboard/widget-dashboard/components/inserter/inserter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useDashboardInternalContext } from '../../context/dashboard-context';
1313
import { useDashboardUIContext } from '../../context/ui-context';
1414
import { createDashboardWidget } from '../../utils/create-dashboard-widget';
1515
import { WidgetPicker } from '../widget-picker';
16-
import type { WidgetType } from '../../types';
16+
import type { WidgetType } from '../../../widget-primitives';
1717

1818
/**
1919
* Modal-based widget inserter. The dialog stays hidden until `inserterOpen`

routes/dashboard/widget-dashboard/components/widget-chrome/widget-chrome.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ import { useDashboardInternalContext } from '../../context/dashboard-context';
2626
import { WidgetContextProvider } from '../../context/widget-context';
2727
import { WidgetRender } from '../widget-render';
2828
import styles from './widget-chrome.module.css';
29-
import type { DashboardWidget, WidgetType } from '../../types';
29+
import type { DashboardWidget } from '../../types';
30+
import type { WidgetType } from '../../../widget-primitives';
3031

3132
interface ErrorBoundaryProps {
3233
children: ReactNode;

routes/dashboard/widget-dashboard/components/widget-picker/widget-picker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useDashboardInternalContext } from '../../context/dashboard-context';
1313
import { createDashboardWidget } from '../../utils/create-dashboard-widget';
1414
import { WidgetRender } from '../widget-render';
1515
import styles from './widget-picker.module.css';
16-
import type { WidgetType } from '../../types';
16+
import type { WidgetType } from '../../../widget-primitives';
1717

1818
const DEFAULT_VIEW: View = {
1919
type: 'pickerGrid',

routes/dashboard/widget-dashboard/components/widget-render/widget-render.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { useCallback } from '@wordpress/element';
77
* Internal dependencies
88
*/
99
import { useDashboardInternalContext } from '../../context/dashboard-context';
10-
import { getLazyWidgetComponent } from '../../utils/get-lazy-widget-component';
11-
import type { DashboardWidget, WidgetType } from '../../types';
10+
import { getLazyWidgetComponent } from '../../../widget-primitives';
11+
import type { DashboardWidget } from '../../types';
12+
import type { WidgetType } from '../../../widget-primitives';
1213

1314
interface WidgetRenderInternalProps {
1415
widget: DashboardWidget< unknown >;

routes/dashboard/widget-dashboard/components/widget-settings/utils/get-widget-settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { sprintf, __ } from '@wordpress/i18n';
66
/**
77
* Internal dependencies
88
*/
9-
import type { WidgetType } from '../../../../widget-types/types';
9+
import type { WidgetType } from '../../../../widget-primitives';
1010

1111
/**
1212
* Localized "<Widget> settings" label, falling back to a generic title

routes/dashboard/widget-dashboard/components/widget-settings/widget-settings-toolbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import { WidgetToolbar } from '../widget-toolbar';
55
import { WidgetSettingsTrigger } from './widget-settings-trigger';
66
import styles from './widget-settings-toolbar.module.css';
7-
import type { DashboardWidget, WidgetType } from '../../types';
7+
import type { DashboardWidget } from '../../types';
8+
import type { WidgetType } from '../../../widget-primitives';
89

910
export interface WidgetSettingsToolbarProps {
1011
/** The instance whose settings this toolbar configures. */

routes/dashboard/widget-dashboard/components/widget-settings/widget-settings-trigger.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { IconButton } from '@wordpress/ui';
1313
*/
1414
import { useDashboardUIContext } from '../../context/ui-context';
1515
import { getAdminMenuInset } from './utils';
16-
import type { DashboardWidget, WidgetType } from '../../types';
16+
import type { DashboardWidget } from '../../types';
17+
import type { WidgetType } from '../../../widget-primitives';
1718

1819
export interface WidgetSettingsTriggerProps {
1920
/**

routes/dashboard/widget-dashboard/components/widgets/widgets.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import type {
2828
DashboardWidget,
2929
GridTilePlacement,
3030
MasonryTilePlacement,
31-
WidgetName,
3231
} from '../../types';
32+
import type { WidgetName } from '../../../widget-primitives';
3333

3434
// Floor applied as `minColumnWidth` on every surface render. Acts as a
3535
// safety net for stored settings that predate the layered model (where

0 commit comments

Comments
 (0)