drupal-canvas 0.1.1 → 0.1.3
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/README.md +6 -1
- package/dist/{FormattedText-CcQ03VEY.d.ts → FormattedText-BjQdnNmH.d.ts} +3 -1
- package/dist/FormattedText.d.ts +1 -1
- package/dist/{drupal-utils-CqLfxx9F.d.ts → drupal-utils-ByF92Aue.d.ts} +6 -0
- package/dist/{drupal-utils-Dfvj3HlO.js → drupal-utils-C41ZWu0D.js} +2 -1
- package/dist/drupal-utils.d.ts +1 -1
- package/dist/drupal-utils.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{next-image-standalone-CHJW9_qx.d.ts → next-image-standalone-BqTHJhzr.d.ts} +2 -1
- package/dist/next-image-standalone.d.ts +1 -1
- package/dist/utils-DG-hPO0N.js +10 -0
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/.vscode/launch.json +0 -16
- package/dist/.vscode/settings.json +0 -3
- package/dist/.vscode/tasks.json +0 -23
- package/dist/utils-DX1b9WpT.js +0 -1915
package/README.md
CHANGED
|
@@ -40,8 +40,13 @@ Access information about the current page.
|
|
|
40
40
|
```js
|
|
41
41
|
import { getPageData } from 'drupal-canvas';
|
|
42
42
|
|
|
43
|
-
const { pageTitle, breadcrumbs } = getPageData();
|
|
43
|
+
const { pageTitle, breadcrumbs, mainEntity } = getPageData();
|
|
44
|
+
const { bundle, entityTypeId, uuid } = mainEntity;
|
|
44
45
|
```
|
|
46
|
+
#### Main entity metadata
|
|
47
|
+
The main entity is the primary Drupal entity (e.g. article, canvas_page, blog) associated with the current page.
|
|
48
|
+
Access main entity metadata of the page you are on with `getPageData`. This can be used to construct JSON:API parameters for requests.
|
|
49
|
+
[View documentation and example here.](https://project.pages.drupalcode.org/canvas/code-components/data-fetching#main-entity-metadata)
|
|
45
50
|
|
|
46
51
|
### `getSiteData`
|
|
47
52
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
|
|
1
3
|
//#region src/FormattedText.d.ts
|
|
2
4
|
type FormattedTextProps = {
|
|
3
5
|
children: string;
|
|
@@ -11,6 +13,6 @@ declare function FormattedText({
|
|
|
11
13
|
children,
|
|
12
14
|
as,
|
|
13
15
|
...props
|
|
14
|
-
}: FormattedTextProps):
|
|
16
|
+
}: FormattedTextProps): react_jsx_runtime0.JSX.Element;
|
|
15
17
|
//#endregion
|
|
16
18
|
export { FormattedText as t };
|
package/dist/FormattedText.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as FormattedText } from "./FormattedText-
|
|
1
|
+
import { t as FormattedText } from "./FormattedText-BjQdnNmH.js";
|
|
2
2
|
export { FormattedText as default };
|
|
@@ -26,9 +26,15 @@ interface BreadcrumbLink {
|
|
|
26
26
|
text: string;
|
|
27
27
|
url: string;
|
|
28
28
|
}
|
|
29
|
+
interface EntityMetadata {
|
|
30
|
+
bundle: string;
|
|
31
|
+
entityTypeId: string;
|
|
32
|
+
uuid: string;
|
|
33
|
+
}
|
|
29
34
|
interface PageData {
|
|
30
35
|
pageTitle: string;
|
|
31
36
|
breadcrumbs: Array<BreadcrumbLink>;
|
|
37
|
+
mainEntity: EntityMetadata | null;
|
|
32
38
|
}
|
|
33
39
|
interface SiteData {
|
|
34
40
|
branding: {
|
|
@@ -38,7 +38,8 @@ function sortMenu(linkset) {
|
|
|
38
38
|
const getPageData = () => {
|
|
39
39
|
const pageData = {
|
|
40
40
|
pageTitle: window.drupalSettings?.canvasData?.v0?.pageTitle || "",
|
|
41
|
-
breadcrumbs: window.drupalSettings?.canvasData?.v0?.breadcrumbs || []
|
|
41
|
+
breadcrumbs: window.drupalSettings?.canvasData?.v0?.breadcrumbs || [],
|
|
42
|
+
mainEntity: window.drupalSettings?.canvasData?.v0?.mainEntity || null
|
|
42
43
|
};
|
|
43
44
|
window.parent.postMessage({
|
|
44
45
|
type: "_canvas_useswr_data_fetch",
|
package/dist/drupal-utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getSiteData, r as sortMenu, t as getPageData } from "./drupal-utils-
|
|
1
|
+
import { n as getSiteData, r as sortMenu, t as getPageData } from "./drupal-utils-ByF92Aue.js";
|
|
2
2
|
export { getPageData, getSiteData, sortMenu };
|
package/dist/drupal-utils.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as FormattedText } from "./FormattedText-
|
|
2
|
-
import { n as getSiteData, r as sortMenu, t as getPageData } from "./drupal-utils-
|
|
1
|
+
import { t as FormattedText } from "./FormattedText-BjQdnNmH.js";
|
|
2
|
+
import { n as getSiteData, r as sortMenu, t as getPageData } from "./drupal-utils-ByF92Aue.js";
|
|
3
3
|
import { t as CanvasJsonApiClient } from "./jsonapi-client-BamGkTjn.js";
|
|
4
4
|
import { n as sortMenu$1, t as getNodePath } from "./jsonapi-utils-co82I5eL.js";
|
|
5
|
-
import { t as Image } from "./next-image-standalone-
|
|
5
|
+
import { t as Image } from "./next-image-standalone-BqTHJhzr.js";
|
|
6
6
|
import { t as cn } from "./utils-Cn7jrjo0.js";
|
|
7
7
|
export { FormattedText, Image, CanvasJsonApiClient as JsonApiClient, cn, getNodePath, getPageData, getSiteData, sortMenu as sortLinksetMenu, sortMenu$1 as sortMenu };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as getSiteData, r as sortMenu, t as getPageData } from "./drupal-utils-
|
|
1
|
+
import { n as getSiteData, r as sortMenu, t as getPageData } from "./drupal-utils-C41ZWu0D.js";
|
|
2
2
|
import { t as FormattedText } from "./FormattedText-B8Lu3ByU.js";
|
|
3
3
|
import { t as CanvasJsonApiClient } from "./jsonapi-client-jLXdE88j.js";
|
|
4
4
|
import { n as sortMenu$1, t as getNodePath } from "./jsonapi-utils-oywSkEdN.js";
|
|
5
5
|
import { t as Image } from "./next-image-standalone-B4uHVOA8.js";
|
|
6
|
-
import { t as cn } from "./utils-
|
|
6
|
+
import { t as cn } from "./utils-DG-hPO0N.js";
|
|
7
7
|
|
|
8
8
|
export { FormattedText, Image, CanvasJsonApiClient as JsonApiClient, cn, getNodePath, getPageData, getSiteData, sortMenu as sortLinksetMenu, sortMenu$1 as sortMenu };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
1
2
|
import { ImageLoaderParams, ImageProps } from "next-image-standalone";
|
|
2
3
|
|
|
3
4
|
//#region src/next-image-standalone.d.ts
|
|
4
5
|
declare function Image(props: Omit<ImageProps, 'loader'> & {
|
|
5
6
|
loader?: (params: ImageLoaderParams) => string;
|
|
6
|
-
}):
|
|
7
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
7
8
|
//#endregion
|
|
8
9
|
export { Image as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Image } from "./next-image-standalone-
|
|
1
|
+
import { t as Image } from "./next-image-standalone-BqTHJhzr.js";
|
|
2
2
|
export { Image as default };
|
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drupal-canvas",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Utilities and base components for building Drupal Canvas Code Components",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://git.drupalcode.org/project/canvas.git",
|
package/dist/.vscode/launch.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"configurations": [
|
|
3
|
-
{
|
|
4
|
-
"name": "Listen for Xdebug",
|
|
5
|
-
"type": "php",
|
|
6
|
-
"request": "launch",
|
|
7
|
-
"hostname": "0.0.0.0",
|
|
8
|
-
"port": 9003,
|
|
9
|
-
"pathMappings": {
|
|
10
|
-
"/var/www/html": "${workspaceFolder}"
|
|
11
|
-
},
|
|
12
|
-
"preLaunchTask": "DDEV: Enable Xdebug",
|
|
13
|
-
"postDebugTask": "DDEV: Disable Xdebug"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
package/dist/.vscode/tasks.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "2.0.0",
|
|
3
|
-
"tasks": [
|
|
4
|
-
{
|
|
5
|
-
"label": "DDEV: Enable Xdebug",
|
|
6
|
-
"type": "shell",
|
|
7
|
-
"command": "ddev xdebug on",
|
|
8
|
-
"presentation": {
|
|
9
|
-
"reveal": "silent",
|
|
10
|
-
"close": true
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"label": "DDEV: Disable Xdebug",
|
|
15
|
-
"type": "shell",
|
|
16
|
-
"command": "ddev xdebug off",
|
|
17
|
-
"presentation": {
|
|
18
|
-
"reveal": "silent",
|
|
19
|
-
"close": true
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|