@red-hat-developer-hub/backstage-plugin-dynamic-home-page 1.8.0 → 1.9.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @red-hat-developer-hub/backstage-plugin-dynamic-home-page
2
2
 
3
+ ## 1.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1e6b861: Add customizable homepage functionality with drag, drop, resize, and widget management capabilities
8
+
3
9
  ## 1.8.0
4
10
 
5
11
  ### Minor Changes
@@ -10,22 +10,22 @@ dynamicPlugins:
10
10
  importName: OnboardingSection
11
11
  config:
12
12
  layouts:
13
- xl: { w: 12, h: 5 }
14
- lg: { w: 12, h: 5 }
15
- md: { w: 12, h: 5 }
16
- sm: { w: 12, h: 5 }
17
- xs: { w: 12, h: 7 }
18
- xxs: { w: 12, h: 13 }
13
+ xl: { w: 12, h: 6 }
14
+ lg: { w: 12, h: 6 }
15
+ md: { w: 12, h: 7 }
16
+ sm: { w: 12, h: 8 }
17
+ xs: { w: 12, h: 9 }
18
+ xxs: { w: 12, h: 14 }
19
19
  - mountPoint: home.page/cards
20
20
  importName: EntitySection
21
21
  config:
22
22
  layouts:
23
- xl: { w: 12, h: 6 }
24
- lg: { w: 12, h: 6 }
25
- md: { w: 12, h: 6 }
26
- sm: { w: 12, h: 6 }
27
- xs: { w: 12, h: 10 }
28
- xxs: { w: 12, h: 14.5 }
23
+ xl: { w: 12, h: 7 }
24
+ lg: { w: 12, h: 7 }
25
+ md: { w: 12, h: 8 }
26
+ sm: { w: 12, h: 9 }
27
+ xs: { w: 12, h: 11 }
28
+ xxs: { w: 12, h: 15 }
29
29
  - mountPoint: home.page/cards
30
30
  importName: TemplateSection
31
31
  config:
@@ -1,5 +1,7 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useMemo } from 'react';
3
+ import GlobalStyles from '@mui/material/GlobalStyles';
4
+ import { useTheme } from '@mui/material/styles';
3
5
  import { ErrorBoundary } from '@backstage/core-components';
4
6
  import { CustomHomepageGrid } from '@backstage/plugin-home';
5
7
  import { makeStyles } from 'tss-react/mui';
@@ -19,6 +21,7 @@ const useStyles = makeStyles()({
19
21
  });
20
22
  const CustomizableGrid = (props) => {
21
23
  const { classes } = useStyles();
24
+ const theme = useTheme();
22
25
  const cards = useMemo(() => {
23
26
  return props.mountPoints.map((mountPoint, index) => {
24
27
  const id = (index + 1).toString();
@@ -33,8 +36,8 @@ const CustomizableGrid = (props) => {
33
36
  y: layout.y ?? 0,
34
37
  w: layout.w ?? 12,
35
38
  h: layout.h ?? 4,
36
- isDraggable: false,
37
- isResizable: false
39
+ isDraggable: true,
40
+ isResizable: true
38
41
  };
39
42
  }
40
43
  } else {
@@ -45,8 +48,8 @@ const CustomizableGrid = (props) => {
45
48
  y: 0,
46
49
  w: 12,
47
50
  h: 4,
48
- isDraggable: false,
49
- isResizable: false
51
+ isDraggable: true,
52
+ isResizable: true
50
53
  };
51
54
  });
52
55
  }
@@ -71,7 +74,46 @@ const CustomizableGrid = (props) => {
71
74
  card.id
72
75
  ));
73
76
  }, [cards, classes.cardWrapper]);
74
- return /* @__PURE__ */ jsx(CustomHomepageGrid, { children });
77
+ const defaultConfig = useMemo(() => {
78
+ if (!props.mountPoints || props.mountPoints.length === 0) {
79
+ return [];
80
+ }
81
+ return props.mountPoints.map((mountPoint, index) => {
82
+ const layout = mountPoint.config?.layouts?.xl || {};
83
+ return {
84
+ component: /* @__PURE__ */ jsx(mountPoint.Component, { ...mountPoint.config?.props || {} }),
85
+ x: layout.x ?? 0,
86
+ y: layout.y ?? index * 5,
87
+ width: layout.w ?? 12,
88
+ height: layout.h ?? 4,
89
+ movable: true,
90
+ resizable: true,
91
+ draggable: true,
92
+ deletable: true
93
+ };
94
+ });
95
+ }, [props.mountPoints]);
96
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
97
+ /* @__PURE__ */ jsx(
98
+ GlobalStyles,
99
+ {
100
+ styles: {
101
+ '[class*="makeStyles-settingsOverlay"]': {
102
+ backgroundColor: theme.palette.mode === "dark" ? "rgba(20, 20, 20, 0.95) !important" : "rgba(40, 40, 40, 0.93) !important"
103
+ }
104
+ }
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsx(
108
+ CustomHomepageGrid,
109
+ {
110
+ config: defaultConfig,
111
+ preventCollision: false,
112
+ compactType: "vertical",
113
+ children
114
+ }
115
+ )
116
+ ] });
75
117
  };
76
118
 
77
119
  export { CustomizableGrid };
@@ -1 +1 @@
1
- {"version":3,"file":"CustomizableGrid.esm.js","sources":["../../src/components/CustomizableGrid.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// This complete read-only home page grid picks up the idea and styles from\n// https://github.com/backstage/backstage/blob/master/plugins/home\n// Esp. from the CustomHomepageGrid component:\n// https://github.com/backstage/backstage/blob/master/plugins/home/src/components/CustomHomepage/CustomHomepageGrid.tsx\n// but without the drag and drop functionality.\n\nimport type { ComponentType } from 'react';\n\nimport { useMemo } from 'react';\nimport { Layout } from 'react-grid-layout';\n\nimport { ErrorBoundary } from '@backstage/core-components';\nimport { CustomHomepageGrid } from '@backstage/plugin-home';\n\nimport { makeStyles } from 'tss-react/mui';\n\n// Removes the doubled scrollbar\nimport 'react-grid-layout/css/styles.css';\n\nimport { HomePageCardMountPoint } from '../types';\n\ninterface Card {\n id: string;\n Component: ComponentType<any>;\n props?: Record<string, any>;\n layouts: Record<string, Layout>;\n}\n\nconst useStyles = makeStyles()({\n // Make card content scrollable (so that cards don't overlap)\n cardWrapper: {\n '& > div[class*=\"MuiCard-root\"]': {\n width: '100%',\n height: '100%',\n },\n '& div[class*=\"MuiCardContent-root\"]': {\n overflow: 'auto',\n },\n },\n});\n\n/**\n * @public\n */\nexport interface CustomizableGridProps {\n mountPoints: HomePageCardMountPoint[];\n breakpoints?: Record<string, number>;\n cols?: Record<string, number>;\n}\n\n/**\n * @public\n */\nexport const CustomizableGrid = (props: CustomizableGridProps) => {\n const { classes } = useStyles();\n\n const cards = useMemo<Card[]>(() => {\n return props.mountPoints.map<Card>((mountPoint, index) => {\n const id = (index + 1).toString();\n const layouts: Record<string, Layout> = {};\n\n if (mountPoint.config?.layouts) {\n for (const [breakpoint, layout] of Object.entries(\n mountPoint.config.layouts,\n )) {\n layouts[breakpoint] = {\n i: id,\n x: layout.x ?? 0,\n y: layout.y ?? 0,\n w: layout.w ?? 12,\n h: layout.h ?? 4,\n isDraggable: false,\n isResizable: false,\n };\n }\n } else {\n // Default layout for cards without a layout configuration\n ['xl', 'lg', 'md', 'sm', 'xs', 'xxs'].forEach(breakpoint => {\n layouts[breakpoint] = {\n i: id,\n x: 0,\n y: 0,\n w: 12,\n h: 4,\n isDraggable: false,\n isResizable: false,\n };\n });\n }\n\n return {\n id,\n Component: mountPoint.Component,\n props: mountPoint.config?.props,\n layouts,\n };\n });\n }, [props.mountPoints]);\n\n const children = useMemo(() => {\n return cards.map(card => (\n <div\n key={card.id}\n data-cardid={card.id}\n data-testid={`home-page card ${card.id}`}\n data-layout={JSON.stringify(card.layouts)}\n className={classes.cardWrapper}\n >\n <ErrorBoundary>\n <card.Component {...card.props} />\n </ErrorBoundary>\n </div>\n ));\n }, [cards, classes.cardWrapper]);\n\n return <CustomHomepageGrid>{children}</CustomHomepageGrid>;\n};\n"],"names":[],"mappings":";;;;;;;AA4CA,MAAM,SAAA,GAAY,YAAa,CAAA;AAAA;AAAA,EAE7B,WAAa,EAAA;AAAA,IACX,gCAAkC,E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EAAA,CAAA;AAAA,YACH,CAAG,EAAA,EAAA;AAAA,YACH,CAAG,EAAA,CAAA;AAAA,YACH,WAAa,EAAA,KAAA;AAAA,YACb,WAAa,EAAA;AAAA,WACf;AAAA,SACD,CAAA;AAAA;AAGH,MAAO,OAAA;AAAA,QACL,EAAA;AAAA,QACA,WAAW,UAAW,CAAA,SAAA;AAAA,QACtB,KAAA,EAAO,WAAW,MAAQ,EAAA,KAAA;AAAA,QAC1B;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACA,EAAA,CAAC,KAAM,CAAA,WAAW,CAAC,CAAA;AAEtB,EAAM,MAAA,QAAA,GAAW,QAAQ,MAAM;AAC7B,IAAO,OAAA,KAAA,CAAM,IAAI,CACf,IAAA,qBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QAEC,eAAa,IAAK,CAAA,EAAA;AAAA,QAClB,aAAA,EAAa,CAAkB,eAAA,EAAA,IAAA,CAAK,EAAE,CAAA,CAAA;AAAA,QACtC,aAAa,EAAA,IAAA,CAAK,SAAU,CAAA,IAAA,CAAK,OAAO,CAAA;AAAA,QACxC,WAAW,OAAQ,CAAA,WAAA;AAAA,QAEnB,QAAA,kBAAA,GAAA,CAAC,iBACC,QAAC,kBAAA,GAAA,CAAA,IAAA,CAAK,WAAL,EAAgB,GAAG,IAAK,CAAA,KAAA,EAAO,CAClC,EAAA;AAAA,OAAA;AAAA,MARK,IAAK,CAAA;AAAA,KAUb,CAAA;AAAA,GACA,EAAA,CAAC,KAAO,EAAA,OAAA,CAAQ,WAAW,CAAC,CAAA;AAE/B,EAAO,uBAAA,GAAA,CAAC,sBAAoB,QAAS,EAAA,CAAA;AACvC;;;;"}
1
+ {"version":3,"file":"CustomizableGrid.esm.js","sources":["../../src/components/CustomizableGrid.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// This complete read-only home page grid picks up the idea and styles from\n// https://github.com/backstage/backstage/blob/master/plugins/home\n// Esp. from the CustomHomepageGrid component:\n// https://github.com/backstage/backstage/blob/master/plugins/home/src/components/CustomHomepage/CustomHomepageGrid.tsx\n// but without the drag and drop functionality.\n\nimport type { ComponentType } from 'react';\n\nimport { useMemo } from 'react';\nimport { Layout } from 'react-grid-layout';\nimport GlobalStyles from '@mui/material/GlobalStyles';\nimport { useTheme } from '@mui/material/styles';\n\nimport { ErrorBoundary } from '@backstage/core-components';\nimport { CustomHomepageGrid } from '@backstage/plugin-home';\n\nimport { makeStyles } from 'tss-react/mui';\n\n// Removes the doubled scrollbar\nimport 'react-grid-layout/css/styles.css';\n\nimport { HomePageCardMountPoint } from '../types';\n\ninterface Card {\n id: string;\n Component: ComponentType<any>;\n props?: Record<string, any>;\n layouts: Record<string, Layout>;\n}\n\nconst useStyles = makeStyles()({\n // Make card content scrollable (so that cards don't overlap)\n cardWrapper: {\n '& > div[class*=\"MuiCard-root\"]': {\n width: '100%',\n height: '100%',\n },\n '& div[class*=\"MuiCardContent-root\"]': {\n overflow: 'auto',\n },\n },\n});\n\n/**\n * @public\n */\nexport interface CustomizableGridProps {\n mountPoints: HomePageCardMountPoint[];\n breakpoints?: Record<string, number>;\n cols?: Record<string, number>;\n}\n\n/**\n * @public\n */\nexport const CustomizableGrid = (props: CustomizableGridProps) => {\n const { classes } = useStyles();\n const theme = useTheme();\n\n const cards = useMemo<Card[]>(() => {\n return props.mountPoints.map<Card>((mountPoint, index) => {\n const id = (index + 1).toString();\n const layouts: Record<string, Layout> = {};\n\n if (mountPoint.config?.layouts) {\n for (const [breakpoint, layout] of Object.entries(\n mountPoint.config.layouts,\n )) {\n layouts[breakpoint] = {\n i: id,\n x: layout.x ?? 0,\n y: layout.y ?? 0,\n w: layout.w ?? 12,\n h: layout.h ?? 4,\n isDraggable: true,\n isResizable: true,\n };\n }\n } else {\n // Default layout for cards without a layout configuration\n ['xl', 'lg', 'md', 'sm', 'xs', 'xxs'].forEach(breakpoint => {\n layouts[breakpoint] = {\n i: id,\n x: 0,\n y: 0,\n w: 12,\n h: 4,\n isDraggable: true,\n isResizable: true,\n };\n });\n }\n\n return {\n id,\n Component: mountPoint.Component,\n props: mountPoint.config?.props,\n layouts,\n };\n });\n }, [props.mountPoints]);\n\n const children = useMemo(() => {\n return cards.map(card => (\n <div\n key={card.id}\n data-cardid={card.id}\n data-testid={`home-page card ${card.id}`}\n data-layout={JSON.stringify(card.layouts)}\n className={classes.cardWrapper}\n >\n <ErrorBoundary>\n <card.Component {...card.props} />\n </ErrorBoundary>\n </div>\n ));\n }, [cards, classes.cardWrapper]);\n\n // Create default layout configuration for initial display AND restore defaults functionality\n const defaultConfig = useMemo(() => {\n if (!props.mountPoints || props.mountPoints.length === 0) {\n return [];\n }\n\n return props.mountPoints.map((mountPoint, index) => {\n const layout = mountPoint.config?.layouts?.xl || {};\n\n return {\n component: (\n <mountPoint.Component {...(mountPoint.config?.props || {})} />\n ),\n x: layout.x ?? 0,\n y: layout.y ?? index * 5,\n width: layout.w ?? 12,\n height: layout.h ?? 4,\n movable: true,\n resizable: true,\n draggable: true,\n deletable: true,\n };\n });\n }, [props.mountPoints]);\n\n return (\n <>\n <GlobalStyles\n styles={{\n '[class*=\"makeStyles-settingsOverlay\"]': {\n backgroundColor:\n theme.palette.mode === 'dark'\n ? 'rgba(20, 20, 20, 0.95) !important'\n : 'rgba(40, 40, 40, 0.93) !important',\n },\n }}\n />\n <CustomHomepageGrid\n config={defaultConfig}\n preventCollision={false}\n compactType=\"vertical\"\n >\n {children}\n </CustomHomepageGrid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA8CA,MAAM,SA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ts = {
2
+ onboarding: {
3
+ xl: { w: 12, h: 6 },
4
+ lg: { w: 12, h: 6 },
5
+ md: { w: 12, h: 7 },
6
+ sm: { w: 12, h: 8 },
7
+ xs: { w: 12, h: 9 },
8
+ xxs: { w: 12, h: 14 }
9
+ },
10
+ entity: {
11
+ xl: { w: 12, h: 7 },
12
+ lg: { w: 12, h: 7 },
13
+ md: { w: 12, h: 8 },
14
+ sm: { w: 12, h: 9 },
15
+ xs: { w: 12, h: 11 },
16
+ xxs: { w: 12, h: 15 }
17
+ },
18
+ template: {
19
+ xl: { w: 12, h: 5 },
20
+ lg: { w: 12, h: 5 },
21
+ md: { w: 12, h: 5 },
22
+ sm: { w: 12, h: 5 },
23
+ xs: { w: 12, h: 7.5 },
24
+ xxs: { w: 12, h: 13.5 }
25
+ }
26
+ };
27
+
28
+ export { defaultLayouts };
29
+ //# sourceMappingURL=defaults.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.esm.js","sources":["../src/defaults.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type Breakpoints = 'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'xxs';\n\n// prettier-ignore\nexport const commonWidths: Record<string, Record<Breakpoints, number>> = {\n small: { xl: 2, lg: 2, md: 2, sm: 3, xs: 4, xxs: 2 },\n half: { xl: 2, lg: 2, md: 2, sm: 3, xs: 4, xxs: 2 },\n '1/2': { xl: 2, lg: 2, md: 2, sm: 3, xs: 4, xxs: 2 },\n '1/3': { xl: 2, lg: 2, md: 2, sm: 3, xs: 4, xxs: 2 },\n '2/2': { xl: 2, lg: 2, md: 2, sm: 3, xs: 4, xxs: 2 },\n full: { xl: 2, lg: 2, md: 2, sm: 3, xs: 4, xxs: 2 },\n};\n\n// prettier-ignore\nexport const commonHeights: Record<string, Record<Breakpoints, number>> = {\n tiny: { xl: 1, lg: 1, md: 1, sm: 1, xs: 1, xxs: 1 },\n small: { xl: 2, lg: 2, md: 2, sm: 2, xs: 2, xxs: 2 },\n medium: { xl: 4, lg: 4, md: 4, sm: 4, xs: 4, xxs: 4 },\n large: { xl: 6, lg: 6, md: 6, sm: 6, xs: 6, xxs: 6 },\n xlarge: { xl: 10, lg: 6, md: 6, sm: 6, xs: 6, xxs: 6 },\n xxlarge: { xl: 14, lg: 6, md: 6, sm: 6, xs: 6, xxs: 6 },\n};\n\n/**\n * Default layout configurations for homepage cards\n * @public\n */\nexport const defaultLayouts = {\n onboarding: {\n xl: { w: 12, h: 6 },\n lg: { w: 12, h: 6 },\n md: { w: 12, h: 7 },\n sm: { w: 12, h: 8 },\n xs: { w: 12, h: 9 },\n xxs: { w: 12, h: 14 },\n },\n entity: {\n xl: { w: 12, h: 7 },\n lg: { w: 12, h: 7 },\n md: { w: 12, h: 8 },\n sm: { w: 12, h: 9 },\n xs: { w: 12, h: 11 },\n xxs: { w: 12, h: 15 },\n },\n template: {\n xl: { w: 12, h: 5 },\n lg: { w: 12, h: 5 },\n md: { w: 12, h: 5 },\n sm: { w: 12, h: 5 },\n xs: { w: 12, h: 7.5 },\n xxs: { w: 12, h: 13.5 },\n },\n};\n"],"names":[],"mappings":"AA0CO,MAAM,cAAiB,GAAA;AAAA,EAC5B,UAAY,EAAA;AAAA,IACV,EAAI,EAAA,EAAE,CAAG,EAAA,EAAA,EAAI,GAAG,CAAE,EAAA;AAAA,IAClB,EAAI,EAAA,EAAE,CAAG,EAAA,EAAA,EAAI,GAAG,CAAE,EAAA;AAAA,IAClB,EAAI,EAAA,EAAE,CAAG,EAAA,EAAA,EAAI,GAAG,CAAE,EAAA;AA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275
275
  */
276
276
  declare const homepageTranslations: _backstage_core_plugin_api_alpha.TranslationResource<"plugin.homepage">;
277
277
 
278
- export { Breakpoint, CatalogStarredEntitiesCard, DynamicCustomizableHomePage, type DynamicCustomizableHomePageProps, DynamicHomePage, type DynamicHomePageProps, EntitySection, FeaturedDocsCard, Headline, type HeadlineProps, type HomePageCardMountPoint, type HomePageCardMountPointConfig, JokeCard, type Layout, type LocalClockProps, Markdown, MarkdownCard, type MarkdownCardProps, type MarkdownProps, OnboardingSection, Placeholder, type PlaceholderProps, QuickAccessCard, type QuickAccessCardProps, RecentlyVisitedCard, SearchBar, type SearchBarProps, TemplateSection, TopVisitedCard, VisitListener, WorldClock, type WorldClockProps, dynamicHomePagePlugin, homepageTranslationRef, homepageTranslations };
278
+ /**
279
+ * Default layout configurations for homepage cards
280
+ * @public
281
+ */
282
+ declare const defaultLayouts: {
283
+ onboarding: {
284
+ xl: {
285
+ w: number;
286
+ h: number;
287
+ };
288
+ lg: {
289
+ w: number;
290
+ h: number;
291
+ };
292
+ md: {
293
+ w: number;
294
+ h: number;
295
+ };
296
+ sm: {
297
+ w: number;
298
+ h: number;
299
+ };
300
+ xs: {
301
+ w: number;
302
+ h: number;
303
+ };
304
+ xxs: {
305
+ w: number;
306
+ h: number;
307
+ };
308
+ };
309
+ entity: {
310
+ xl: {
311
+ w: number;
312
+ h: number;
313
+ };
314
+ lg: {
315
+ w: number;
316
+ h: number;
317
+ };
318
+ md: {
319
+ w: number;
320
+ h: number;
321
+ };
322
+ sm: {
323
+ w: number;
324
+ h: number;
325
+ };
326
+ xs: {
327
+ w: number;
328
+ h: number;
329
+ };
330
+ xxs: {
331
+ w: number;
332
+ h: number;
333
+ };
334
+ };
335
+ template: {
336
+ xl: {
337
+ w: number;
338
+ h: number;
339
+ };
340
+ lg: {
341
+ w: number;
342
+ h: number;
343
+ };
344
+ md: {
345
+ w: number;
346
+ h: number;
347
+ };
348
+ sm: {
349
+ w: number;
350
+ h: number;
351
+ };
352
+ xs: {
353
+ w: number;
354
+ h: number;
355
+ };
356
+ xxs: {
357
+ w: number;
358
+ h: number;
359
+ };
360
+ };
361
+ };
362
+
363
+ export { Breakpoint, CatalogStarredEntitiesCard, DynamicCustomizableHomePage, type DynamicCustomizableHomePageProps, DynamicHomePage, type DynamicHomePageProps, EntitySection, FeaturedDocsCard, Headline, type HeadlineProps, type HomePageCardMountPoint, type HomePageCardMountPointConfig, JokeCard, type Layout, type LocalClockProps, Markdown, MarkdownCard, type MarkdownCardProps, type MarkdownProps, OnboardingSection, Placeholder, type PlaceholderProps, QuickAccessCard, type QuickAccessCardProps, RecentlyVisitedCard, SearchBar, type SearchBarProps, TemplateSection, TopVisitedCard, VisitListener, WorldClock, type WorldClockProps, defaultLayouts, dynamicHomePagePlugin, homepageTranslationRef, homepageTranslations };
package/dist/index.esm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { CatalogStarredEntitiesCard, DynamicCustomizableHomePage, DynamicHomePage, EntitySection, FeaturedDocsCard, Headline, JokeCard, Markdown, MarkdownCard, OnboardingSection, Placeholder, QuickAccessCard, RecentlyVisitedCard, SearchBar, TemplateSection, TopVisitedCard, VisitListener, WorldClock, dynamicHomePagePlugin } from './plugin.esm.js';
2
2
  export { homepageTranslations } from './translations/index.esm.js';
3
+ export { defaultLayouts } from './defaults.esm.js';
3
4
  export { homepageTranslationRef } from './translations/ref.esm.js';
4
5
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/backstage-plugin-dynamic-home-page",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",