rotion 0.0.4 → 0.0.5
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/dist/exporter/blocks.js +4 -1
- package/dist/exporter/blocks.js.map +1 -1
- package/dist/exporter/breadcrumbs.d.ts +2 -7
- package/dist/exporter/breadcrumbs.js +91 -82
- package/dist/exporter/breadcrumbs.js.map +1 -1
- package/dist/exporter/types.d.ts +9 -1
- package/dist/ui/cjs/index.js +28 -12
- package/dist/ui/cjs/index.js.map +1 -1
- package/dist/ui/cjs/types/exporter/breadcrumbs.d.ts +2 -7
- package/dist/ui/cjs/types/exporter/types.d.ts +9 -1
- package/dist/ui/cjs/types/ui/components/Page/BreadcrumbBlock/BreadcrumbBlock.d.ts +1 -1
- package/dist/ui/cjs/types/ui/components/Page/BreadcrumbBlock/BreadcrumbBlock.types.d.ts +16 -2
- package/dist/ui/cjs/types/ui/components/Page/Page.d.ts +1 -1
- package/dist/ui/cjs/types/ui/components/Page/Page.types.d.ts +1 -0
- package/dist/ui/cjs/types/ui/components/Page/PageHandler.d.ts +1 -1
- package/dist/ui/cjs/types/ui/components/Page/PageHandler.types.d.ts +1 -0
- package/dist/ui/esm/index.js +28 -12
- package/dist/ui/esm/index.js.map +1 -1
- package/dist/ui/esm/types/exporter/breadcrumbs.d.ts +2 -7
- package/dist/ui/esm/types/exporter/types.d.ts +9 -1
- package/dist/ui/esm/types/ui/components/Page/BreadcrumbBlock/BreadcrumbBlock.d.ts +1 -1
- package/dist/ui/esm/types/ui/components/Page/BreadcrumbBlock/BreadcrumbBlock.types.d.ts +16 -2
- package/dist/ui/esm/types/ui/components/Page/Page.d.ts +1 -1
- package/dist/ui/esm/types/ui/components/Page/Page.types.d.ts +1 -0
- package/dist/ui/esm/types/ui/components/Page/PageHandler.d.ts +1 -1
- package/dist/ui/esm/types/ui/components/Page/PageHandler.types.d.ts +1 -0
- package/dist/ui/styles/page.css +26 -0
- package/dist/ui/types.d.ts +17 -5
- package/dist/ui/umd/index.js +28 -12
- package/dist/ui/umd/index.js.map +1 -1
- package/dist/ui/umd/types/exporter/breadcrumbs.d.ts +2 -7
- package/dist/ui/umd/types/exporter/types.d.ts +9 -1
- package/dist/ui/umd/types/ui/components/Page/BreadcrumbBlock/BreadcrumbBlock.d.ts +1 -1
- package/dist/ui/umd/types/ui/components/Page/BreadcrumbBlock/BreadcrumbBlock.types.d.ts +16 -2
- package/dist/ui/umd/types/ui/components/Page/Page.d.ts +1 -1
- package/dist/ui/umd/types/ui/components/Page/Page.types.d.ts +1 -0
- package/dist/ui/umd/types/ui/components/Page/PageHandler.d.ts +1 -1
- package/dist/ui/umd/types/ui/components/Page/PageHandler.types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Breadcrumb } from './types.js';
|
|
2
2
|
export interface FetchBreadcrumbsProps {
|
|
3
3
|
type: 'page_id' | 'database_id' | 'block_id' | 'workspace';
|
|
4
4
|
id: string;
|
|
5
5
|
limit?: number;
|
|
6
6
|
}
|
|
7
|
-
export type
|
|
8
|
-
export interface Breadcrumbs {
|
|
9
|
-
name: string;
|
|
10
|
-
icon: BreadcrumbsIcon;
|
|
11
|
-
}
|
|
12
|
-
export declare const FetchBreadcrumbs: ({ type, id, limit }: FetchBreadcrumbsProps) => Promise<Breadcrumbs[]>;
|
|
7
|
+
export declare const FetchBreadcrumbs: ({ type, id, limit }: FetchBreadcrumbsProps) => Promise<Breadcrumb[]>;
|
|
@@ -208,7 +208,15 @@ export type ParagraphBlockObjectResponseEx = ParagraphBlockObjectResponse & {
|
|
|
208
208
|
color: SelectColor;
|
|
209
209
|
};
|
|
210
210
|
};
|
|
211
|
-
export type
|
|
211
|
+
export type Breadcrumb = {
|
|
212
|
+
id: string;
|
|
213
|
+
name: string;
|
|
214
|
+
icon: MentionIcon;
|
|
215
|
+
};
|
|
216
|
+
export type BreadcrumbBlockObjectResponseEx = BreadcrumbBlockObjectResponse & {
|
|
217
|
+
list: Breadcrumb[];
|
|
218
|
+
};
|
|
219
|
+
export type BlockObjectResponse = ParagraphBlockObjectResponseEx | Heading1BlockObjectResponse | Heading2BlockObjectResponse | Heading3BlockObjectResponse | BulletedListItemBlockObjectResponseEx | NumberedListItemBlockObjectResponseEx | QuoteBlockObjectResponse | ToDoBlockObjectResponse | ToggleBlockObjectResponseEx | TemplateBlockObjectResponse | SyncedBlockBlockObjectResponse | ChildPageBlockObjectResponseEx | ChildDatabaseBlockObjectResponseEx | EquationBlockObjectResponse | CodeBlockObjectResponse | CalloutBlockObjectResponseEx | DividerBlockObjectResponse | BreadcrumbBlockObjectResponseEx | TableOfContentsBlockObjectResponse | ColumnListBlockObjectResponseEx | ColumnBlockObjectResponse | LinkToPageBlockObjectResponse | TableBlockObjectResponseEx | TableRowBlockObjectResponse | EmbedBlockObjectResponseEx | BookmarkBlockObjectResponseEx | ImageBlockObjectResponseEx | VideoBlockObjectResponseEx | PdfBlockObjectResponse | FileBlockObjectResponse | AudioBlockObjectResponse | LinkPreviewBlockObjectResponse | UnsupportedBlockObjectResponse;
|
|
212
220
|
export type ListBlockChildrenResponseEx = ListBlockChildrenResponse & {
|
|
213
221
|
results: Array<BlockObjectResponse>;
|
|
214
222
|
children?: ListBlockChildrenResponse;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { BreadcrumbBlockProps } from './BreadcrumbBlock.types';
|
|
3
|
-
declare const BreadcrumbBlock: ({ block }: BreadcrumbBlockProps) => React.JSX.Element;
|
|
3
|
+
declare const BreadcrumbBlock: ({ block, link, hrefs, query }: BreadcrumbBlockProps) => React.JSX.Element;
|
|
4
4
|
export default BreadcrumbBlock;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ParsedUrlQueryInput } from 'node:querystring';
|
|
4
|
+
import type { Link } from '../../types';
|
|
5
|
+
import type { Breadcrumb, BreadcrumbBlockObjectResponseEx } from '../../../../exporter';
|
|
6
|
+
export interface BreadcrumbLinkProps {
|
|
7
|
+
breadcrumb: Breadcrumb;
|
|
8
|
+
link?: Link;
|
|
9
|
+
href?: string;
|
|
10
|
+
query?: ParsedUrlQueryInput;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
2
13
|
export interface BreadcrumbBlockProps {
|
|
3
|
-
block:
|
|
14
|
+
block: BreadcrumbBlockObjectResponseEx;
|
|
15
|
+
link?: Link;
|
|
16
|
+
hrefs?: string[];
|
|
17
|
+
query?: ParsedUrlQueryInput;
|
|
4
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PageProps } from './Page.types';
|
|
3
|
-
export declare const Page: ({ blocks, href, link, query, modules }: PageProps) => React.JSX.Element;
|
|
3
|
+
export declare const Page: ({ blocks, href, link, query, modules, breadcrumb_hrefs }: PageProps) => React.JSX.Element;
|
|
4
4
|
export default Page;
|
|
@@ -11,5 +11,5 @@ export declare const blockType: {
|
|
|
11
11
|
code: string;
|
|
12
12
|
quote: string;
|
|
13
13
|
};
|
|
14
|
-
export declare const PageHandler: ({ block, href, link, query, modules }: HandlerProps) => React.JSX.Element;
|
|
14
|
+
export declare const PageHandler: ({ block, href, link, query, modules, breadcrumb_hrefs }: HandlerProps) => React.JSX.Element;
|
|
15
15
|
export default PageHandler;
|
package/dist/ui/esm/index.js
CHANGED
|
@@ -19313,11 +19313,28 @@ var BookmarkBlock = function (_a) {
|
|
|
19313
19313
|
React.createElement(TextBlock, { tag: "span", block: block.bookmark.caption }))));
|
|
19314
19314
|
};
|
|
19315
19315
|
|
|
19316
|
-
|
|
19316
|
+
var BreadcrumbLink = function (_a) {
|
|
19317
|
+
var breadcrumb = _a.breadcrumb, link = _a.link, href = _a.href, query = _a.query, children = _a.children;
|
|
19318
|
+
var id = breadcrumb.id, name = breadcrumb.name;
|
|
19319
|
+
var _b = getLinkPathAndLinkKey(href || ''), path = _b[0], slugKey = _b[1];
|
|
19320
|
+
var file = slugKey === 'id' ? id : encodeURIComponent(name.toLowerCase()).replace(/%20/g, '-');
|
|
19321
|
+
if (link && href) {
|
|
19322
|
+
var Link = link;
|
|
19323
|
+
return (React.createElement(Link, { className: "notionate-blocks-breadcrumb-a", href: { pathname: "".concat(path).concat(file), query: query } }, children));
|
|
19324
|
+
}
|
|
19325
|
+
if (href) {
|
|
19326
|
+
return (React.createElement("a", { className: "notionate-blocks-breadcrumb-a", href: "".concat(path).concat(file).concat(queryToString(query)) }, children));
|
|
19327
|
+
}
|
|
19328
|
+
return (React.createElement("span", { className: "notionate-blocks-breadcrumb-a" }, children));
|
|
19329
|
+
};
|
|
19317
19330
|
var BreadcrumbBlock = function (_a) {
|
|
19318
|
-
var block = _a.block;
|
|
19319
|
-
var
|
|
19320
|
-
return (React.createElement("div", { className: "notionate-blocks-breadcrumb" },
|
|
19331
|
+
var block = _a.block, link = _a.link, hrefs = _a.hrefs, query = _a.query;
|
|
19332
|
+
var max = block.list.length;
|
|
19333
|
+
return (React.createElement("div", { className: "notionate-blocks-breadcrumb" }, block.list.map(function (v, i) { return (React.createElement(BreadcrumbLink, { key: "crumb-".concat(i), breadcrumb: v, href: hrefs === undefined ? undefined : hrefs[i], link: link, query: query },
|
|
19334
|
+
v.icon.type === 'emoji' && React.createElement("span", { className: "notionate-blocks-breadcrumb-emoji" }, v.icon.emoji),
|
|
19335
|
+
v.icon.type !== 'emoji' && React.createElement("img", { className: "notionate-blocks-breadcrumb-icon", src: v.icon.src, width: 20, height: 20, alt: v.name }),
|
|
19336
|
+
React.createElement("span", { className: "notionate-blocks-breadcrumb-title" }, v.name),
|
|
19337
|
+
i + 1 < max && React.createElement("span", { className: "notionate-blocks-breadcrumb-slash" }, "/"))); })));
|
|
19321
19338
|
};
|
|
19322
19339
|
|
|
19323
19340
|
var BulletedListBlocks = function (_a) {
|
|
@@ -19814,9 +19831,9 @@ var VideoBlock = function (_a) {
|
|
|
19814
19831
|
};
|
|
19815
19832
|
|
|
19816
19833
|
var blockType = {
|
|
19817
|
-
heading_1: '
|
|
19818
|
-
heading_2: '
|
|
19819
|
-
heading_3: '
|
|
19834
|
+
heading_1: 'h2',
|
|
19835
|
+
heading_2: 'h3',
|
|
19836
|
+
heading_3: 'h4',
|
|
19820
19837
|
bulleted_list_item: 'li',
|
|
19821
19838
|
numbered_list_item: 'li',
|
|
19822
19839
|
divider: 'hr',
|
|
@@ -19826,13 +19843,12 @@ var blockType = {
|
|
|
19826
19843
|
};
|
|
19827
19844
|
var PageHandler = function (_a) {
|
|
19828
19845
|
var _b;
|
|
19829
|
-
var block = _a.block, href = _a.href, link = _a.link, query = _a.query, modules = _a.modules;
|
|
19846
|
+
var block = _a.block, href = _a.href, link = _a.link, query = _a.query, modules = _a.modules, breadcrumb_hrefs = _a.breadcrumb_hrefs;
|
|
19830
19847
|
switch (block.type) {
|
|
19831
19848
|
case 'bookmark':
|
|
19832
19849
|
return React.createElement(BookmarkBlock, { block: block, key: block.id });
|
|
19833
19850
|
case 'breadcrumb':
|
|
19834
|
-
|
|
19835
|
-
return React.createElement(BreadcrumbBlock, { block: block, key: block.id });
|
|
19851
|
+
return React.createElement(BreadcrumbBlock, { block: block, hrefs: breadcrumb_hrefs, link: link, query: query, key: block.id });
|
|
19836
19852
|
case 'bulleted_list_item':
|
|
19837
19853
|
return React.createElement(BulletedListBlocks, { block: block, key: block.id });
|
|
19838
19854
|
case 'callout':
|
|
@@ -19904,7 +19920,7 @@ var ListBlock = function (_a) {
|
|
|
19904
19920
|
};
|
|
19905
19921
|
|
|
19906
19922
|
var Page = function (_a) {
|
|
19907
|
-
var blocks = _a.blocks, href = _a.href, link = _a.link, query = _a.query, modules = _a.modules;
|
|
19923
|
+
var blocks = _a.blocks, href = _a.href, link = _a.link, query = _a.query, modules = _a.modules, breadcrumb_hrefs = _a.breadcrumb_hrefs;
|
|
19908
19924
|
var results = blocks.results;
|
|
19909
19925
|
var listType = {
|
|
19910
19926
|
bulleted_list_item: 'ul',
|
|
@@ -19939,7 +19955,7 @@ var Page = function (_a) {
|
|
|
19939
19955
|
}
|
|
19940
19956
|
}
|
|
19941
19957
|
else {
|
|
19942
|
-
var elem = PageHandler({ block: block, href: href, link: link, query: query, modules: modules });
|
|
19958
|
+
var elem = PageHandler({ block: block, href: href, link: link, query: query, modules: modules, breadcrumb_hrefs: breadcrumb_hrefs });
|
|
19943
19959
|
if (elem !== undefined) {
|
|
19944
19960
|
children.push(elem);
|
|
19945
19961
|
}
|