@nei7/nuxt-notion 1.0.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/README.md +84 -0
- package/dist/module.d.mts +9 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +32 -0
- package/dist/runtime/components/BulletedListItem.d.vue.ts +7 -0
- package/dist/runtime/components/BulletedListItem.vue +12 -0
- package/dist/runtime/components/BulletedListItem.vue.d.ts +7 -0
- package/dist/runtime/components/Callout.d.vue.ts +7 -0
- package/dist/runtime/components/Callout.vue +40 -0
- package/dist/runtime/components/Callout.vue.d.ts +7 -0
- package/dist/runtime/components/Code.d.vue.ts +7 -0
- package/dist/runtime/components/Code.vue +22 -0
- package/dist/runtime/components/Code.vue.d.ts +7 -0
- package/dist/runtime/components/Divider.d.vue.ts +7 -0
- package/dist/runtime/components/Divider.vue +9 -0
- package/dist/runtime/components/Divider.vue.d.ts +7 -0
- package/dist/runtime/components/Embed.d.vue.ts +7 -0
- package/dist/runtime/components/Embed.vue +74 -0
- package/dist/runtime/components/Embed.vue.d.ts +7 -0
- package/dist/runtime/components/Equation.d.vue.ts +7 -0
- package/dist/runtime/components/Equation.vue +13 -0
- package/dist/runtime/components/Equation.vue.d.ts +7 -0
- package/dist/runtime/components/File.d.vue.ts +7 -0
- package/dist/runtime/components/File.vue +21 -0
- package/dist/runtime/components/File.vue.d.ts +7 -0
- package/dist/runtime/components/Header.d.vue.ts +7 -0
- package/dist/runtime/components/Header.vue +24 -0
- package/dist/runtime/components/Header.vue.d.ts +7 -0
- package/dist/runtime/components/Image.d.vue.ts +7 -0
- package/dist/runtime/components/Image.vue +33 -0
- package/dist/runtime/components/Image.vue.d.ts +7 -0
- package/dist/runtime/components/ListRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/ListRenderer.vue +50 -0
- package/dist/runtime/components/ListRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/MathFormula.d.vue.ts +9 -0
- package/dist/runtime/components/MathFormula.vue +22 -0
- package/dist/runtime/components/MathFormula.vue.d.ts +9 -0
- package/dist/runtime/components/NumberedListItem.d.vue.ts +7 -0
- package/dist/runtime/components/NumberedListItem.vue +12 -0
- package/dist/runtime/components/NumberedListItem.vue.d.ts +7 -0
- package/dist/runtime/components/Paragraph.d.vue.ts +7 -0
- package/dist/runtime/components/Paragraph.vue +19 -0
- package/dist/runtime/components/Paragraph.vue.d.ts +7 -0
- package/dist/runtime/components/Quote.d.vue.ts +7 -0
- package/dist/runtime/components/Quote.vue +17 -0
- package/dist/runtime/components/Quote.vue.d.ts +7 -0
- package/dist/runtime/components/Renderer.d.vue.ts +7 -0
- package/dist/runtime/components/Renderer.vue +111 -0
- package/dist/runtime/components/Renderer.vue.d.ts +7 -0
- package/dist/runtime/components/Text.d.vue.ts +7 -0
- package/dist/runtime/components/Text.vue +20 -0
- package/dist/runtime/components/Text.vue.d.ts +7 -0
- package/dist/runtime/components/TextRenderer.d.vue.ts +7 -0
- package/dist/runtime/components/TextRenderer.vue +14 -0
- package/dist/runtime/components/TextRenderer.vue.d.ts +7 -0
- package/dist/runtime/components/TodoListItem.d.vue.ts +7 -0
- package/dist/runtime/components/TodoListItem.vue +23 -0
- package/dist/runtime/components/TodoListItem.vue.d.ts +7 -0
- package/dist/runtime/components/Video.d.vue.ts +7 -0
- package/dist/runtime/components/Video.vue +39 -0
- package/dist/runtime/components/Video.vue.d.ts +7 -0
- package/dist/runtime/components/WebBookmark.d.vue.ts +7 -0
- package/dist/runtime/components/WebBookmark.vue +58 -0
- package/dist/runtime/components/WebBookmark.vue.d.ts +7 -0
- package/dist/runtime/composables/notion.d.ts +4 -0
- package/dist/runtime/composables/notion.js +9 -0
- package/dist/runtime/composables/useNotionClient.d.ts +2 -0
- package/dist/runtime/composables/useNotionClient.js +14 -0
- package/dist/runtime/server/api/_notion/blocks.get.d.ts +2 -0
- package/dist/runtime/server/api/_notion/blocks.get.js +14 -0
- package/dist/runtime/server/api/_notion/link-meta.get.d.ts +2 -0
- package/dist/runtime/server/api/_notion/link-meta.get.js +44 -0
- package/dist/runtime/server/api/_notion/page.get.d.ts +2 -0
- package/dist/runtime/server/api/_notion/page.get.js +13 -0
- package/dist/runtime/server/api/_notion/query-database.get.d.ts +2 -0
- package/dist/runtime/server/api/_notion/query-database.get.js +15 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/types/index.d.ts +14 -0
- package/dist/runtime/types/index.js +0 -0
- package/dist/runtime/types/notion.d.ts +11 -0
- package/dist/runtime/types/notion.js +0 -0
- package/dist/runtime/utils/index.d.ts +7 -0
- package/dist/runtime/utils/index.js +41 -0
- package/dist/types.d.mts +3 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Get your module up and running quickly.
|
|
3
|
+
|
|
4
|
+
Find and replace all on all files (CMD+SHIFT+F):
|
|
5
|
+
- Name: My Module
|
|
6
|
+
- Package name: my-module
|
|
7
|
+
- Description: My new Nuxt module
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# My Module
|
|
11
|
+
|
|
12
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
13
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
14
|
+
[![License][license-src]][license-href]
|
|
15
|
+
[![Nuxt][nuxt-src]][nuxt-href]
|
|
16
|
+
|
|
17
|
+
My new Nuxt module for doing amazing things.
|
|
18
|
+
|
|
19
|
+
- [✨ Release Notes](/CHANGELOG.md)
|
|
20
|
+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
|
|
21
|
+
<!-- - [📖 Documentation](https://example.com) -->
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
<!-- Highlight some of the features your module provide here -->
|
|
26
|
+
- ⛰ Foo
|
|
27
|
+
- 🚠 Bar
|
|
28
|
+
- 🌲 Baz
|
|
29
|
+
|
|
30
|
+
## Quick Setup
|
|
31
|
+
|
|
32
|
+
Install the module to your Nuxt application with one command:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx nuxi module add my-module
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
That's it! You can now use My Module in your Nuxt app ✨
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Contribution
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary>Local development</summary>
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Install dependencies
|
|
48
|
+
npm install
|
|
49
|
+
|
|
50
|
+
# Generate type stubs
|
|
51
|
+
npm run dev:prepare
|
|
52
|
+
|
|
53
|
+
# Develop with the playground
|
|
54
|
+
npm run dev
|
|
55
|
+
|
|
56
|
+
# Build the playground
|
|
57
|
+
npm run dev:build
|
|
58
|
+
|
|
59
|
+
# Run ESLint
|
|
60
|
+
npm run lint
|
|
61
|
+
|
|
62
|
+
# Run Vitest
|
|
63
|
+
npm run test
|
|
64
|
+
npm run test:watch
|
|
65
|
+
|
|
66
|
+
# Release new version
|
|
67
|
+
npm run release
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
</details>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<!-- Badges -->
|
|
74
|
+
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
|
|
75
|
+
[npm-version-href]: https://npmjs.com/package/my-module
|
|
76
|
+
|
|
77
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
78
|
+
[npm-downloads-href]: https://npm.chart.dev/my-module
|
|
79
|
+
|
|
80
|
+
[license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
81
|
+
[license-href]: https://npmjs.com/package/my-module
|
|
82
|
+
|
|
83
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt
|
|
84
|
+
[nuxt-href]: https://nuxt.com
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, addVitePlugin, addComponentsDir, addImportsDir, addServerScanDir } from '@nuxt/kit';
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
3
|
+
|
|
4
|
+
const module$1 = defineNuxtModule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "nuxt-notion",
|
|
7
|
+
configKey: "nuxtNotion"
|
|
8
|
+
},
|
|
9
|
+
defaults: {},
|
|
10
|
+
moduleDependencies: {
|
|
11
|
+
"nuxt-shiki": {
|
|
12
|
+
version: "^0.3.2"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(_options, nuxt) {
|
|
16
|
+
const resolver = createResolver(import.meta.url);
|
|
17
|
+
nuxt.options.runtimeConfig.nuxtNotion = {
|
|
18
|
+
notionApiKey: _options.notionApiKey
|
|
19
|
+
};
|
|
20
|
+
addVitePlugin(tailwindcss());
|
|
21
|
+
addComponentsDir({
|
|
22
|
+
path: resolver.resolve("./runtime/components"),
|
|
23
|
+
pathPrefix: false,
|
|
24
|
+
prefix: "Notion",
|
|
25
|
+
global: true
|
|
26
|
+
});
|
|
27
|
+
addImportsDir(resolver.resolve("./runtime/composables"));
|
|
28
|
+
addServerScanDir(resolver.resolve("./runtime/server"));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { module$1 as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BulletedListItemBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: BulletedListItemBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BulletedListItemBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: BulletedListItemBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CalloutBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: CalloutBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import TextRenderer from "./TextRenderer.vue";
|
|
3
|
+
import { notionColorToCss } from "../utils";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
block: { type: Object, required: true }
|
|
6
|
+
});
|
|
7
|
+
const color = notionColorToCss(props.block.callout.color);
|
|
8
|
+
const { icon } = props.block.callout;
|
|
9
|
+
const imgUrl = () => {
|
|
10
|
+
if (!icon) return;
|
|
11
|
+
if (icon.type === "external") return icon.external.url;
|
|
12
|
+
if (icon.type === "file") return icon.file.url;
|
|
13
|
+
};
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div
|
|
18
|
+
class="p-3 my-5 flex space-x-3"
|
|
19
|
+
:class="color"
|
|
20
|
+
>
|
|
21
|
+
<div
|
|
22
|
+
v-if="icon"
|
|
23
|
+
class="flex items-center justify-center "
|
|
24
|
+
>
|
|
25
|
+
<span v-if="icon.type === 'emoji'">
|
|
26
|
+
{{ icon.emoji }}
|
|
27
|
+
</span>
|
|
28
|
+
|
|
29
|
+
<img
|
|
30
|
+
v-else-if="icon.type === 'external' || icon.type === 'file'"
|
|
31
|
+
class="w-5 h-5 rounded-md"
|
|
32
|
+
:src="imgUrl()"
|
|
33
|
+
>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div>
|
|
37
|
+
<TextRenderer :text="block.callout.rich_text" />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CalloutBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: CalloutBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CodeBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: CodeBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
block: { type: Object, required: true }
|
|
4
|
+
});
|
|
5
|
+
const code = props.block.code.rich_text[0]?.plain_text || "";
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div class="relative w-full">
|
|
10
|
+
<Shiki
|
|
11
|
+
:lang="
|
|
12
|
+
block.code.language
|
|
13
|
+
"
|
|
14
|
+
:code="code"
|
|
15
|
+
unwrap
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
code.shiki{display:block;padding:1rem;width:100%}pre:has(code.shiki){background:transparent;margin:0;padding:0}
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CodeBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: CodeBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DividerBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: DividerBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DividerBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: DividerBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NotionEmbed } from '../types/notion.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
embed: NotionEmbed;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import TextRenderer from "./TextRenderer.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
embed: { type: Object, required: true }
|
|
6
|
+
});
|
|
7
|
+
const embedUrl = computed(() => {
|
|
8
|
+
if (props.embed.type === "video")
|
|
9
|
+
return props.embed.video.external.url;
|
|
10
|
+
else return props.embed.embed.url;
|
|
11
|
+
});
|
|
12
|
+
const isYouTube = computed(() => {
|
|
13
|
+
return embedUrl.value.includes("youtube.com") || embedUrl.value.includes("youtu.be");
|
|
14
|
+
});
|
|
15
|
+
const isSpotify = computed(() => {
|
|
16
|
+
return embedUrl.value.includes("open.spotify.com");
|
|
17
|
+
});
|
|
18
|
+
const youtubeUrl = computed(() => {
|
|
19
|
+
if (!isYouTube.value) return "";
|
|
20
|
+
try {
|
|
21
|
+
const matches = embedUrl.value.match(/[?&]v=([\w-]{11})/);
|
|
22
|
+
const videoId = matches ? matches[1] : "";
|
|
23
|
+
return `https://www.youtube.com/embed/${videoId}`;
|
|
24
|
+
} catch {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const spotifyUrl = computed(() => {
|
|
29
|
+
if (!isSpotify.value) return "";
|
|
30
|
+
try {
|
|
31
|
+
const matches = embedUrl.value.match(/https?:\/\/open\.spotify\.com\/track\/([A-Za-z0-9]+)/);
|
|
32
|
+
const trackId = matches ? matches[1] : "";
|
|
33
|
+
return `https://open.spotify.com/embed/track/${trackId}`;
|
|
34
|
+
} catch {
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const caption = computed(() => {
|
|
39
|
+
if (props.embed.type === "embed") return props.embed.embed.caption;
|
|
40
|
+
else return props.embed.video.caption;
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div
|
|
46
|
+
v-if="isYouTube"
|
|
47
|
+
class="relative aspect-video not-prose"
|
|
48
|
+
>
|
|
49
|
+
<iframe
|
|
50
|
+
|
|
51
|
+
class="absolute inset-0 w-full h-full m-0! rounded-notion"
|
|
52
|
+
:src="youtubeUrl"
|
|
53
|
+
frameborder="0"
|
|
54
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
55
|
+
allowfullscreen
|
|
56
|
+
loading="lazy"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
<div
|
|
60
|
+
v-else-if="isSpotify"
|
|
61
|
+
class="relative h-48"
|
|
62
|
+
>
|
|
63
|
+
<iframe
|
|
64
|
+
class="absolute inset-0 h-full w-full m-0! rounded-notion"
|
|
65
|
+
:src="spotifyUrl"
|
|
66
|
+
frameBorder="0"
|
|
67
|
+
allowfullscreen
|
|
68
|
+
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
|
|
69
|
+
loading="lazy"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<TextRenderer :text="caption" />
|
|
74
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NotionEmbed } from '../types/notion.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
embed: NotionEmbed;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EquationBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: EquationBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import MathFormula from "./MathFormula.vue";
|
|
3
|
+
defineProps({
|
|
4
|
+
block: { type: Object, required: true }
|
|
5
|
+
});
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<MathFormula
|
|
10
|
+
:expression="block.equation.expression"
|
|
11
|
+
:display-mode="true"
|
|
12
|
+
/>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EquationBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: EquationBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FileBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: FileBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
block: { type: Object, required: true }
|
|
5
|
+
});
|
|
6
|
+
const fileUrl = computed(() => {
|
|
7
|
+
if (props.block.file.type === "external") return props.block.file.external.url;
|
|
8
|
+
else return props.block.file.file.url;
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div class="my-3">
|
|
14
|
+
<a
|
|
15
|
+
:href="fileUrl"
|
|
16
|
+
download
|
|
17
|
+
>
|
|
18
|
+
{{ block.file.name }}
|
|
19
|
+
</a>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FileBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: FileBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BlockObjectResponse } from '@notionhq/client/build/src/api-endpoints';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: BlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import TextRenderer from "./TextRenderer.vue";
|
|
3
|
+
defineProps({
|
|
4
|
+
block: { type: Object, required: true }
|
|
5
|
+
});
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<h1
|
|
10
|
+
v-if="block.type === 'heading_1'"
|
|
11
|
+
>
|
|
12
|
+
<TextRenderer :text="block.heading_1.rich_text" />
|
|
13
|
+
</h1>
|
|
14
|
+
<h2
|
|
15
|
+
v-else-if="block.type === 'heading_2'"
|
|
16
|
+
>
|
|
17
|
+
<TextRenderer :text="block.heading_2.rich_text" />
|
|
18
|
+
</h2>
|
|
19
|
+
<h3
|
|
20
|
+
v-else-if="block.type === 'heading_3'"
|
|
21
|
+
>
|
|
22
|
+
<TextRenderer :text="block.heading_3.rich_text" />
|
|
23
|
+
</h3>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BlockObjectResponse } from '@notionhq/client/build/src/api-endpoints';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: BlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ImageBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: ImageBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import TextRenderer from "./TextRenderer.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
block: { type: Object, required: true }
|
|
6
|
+
});
|
|
7
|
+
const imageUrl = computed(() => {
|
|
8
|
+
if (props.block.image.type === "external") {
|
|
9
|
+
return props.block.image.external?.url;
|
|
10
|
+
} else if (props.block.image.type === "file") {
|
|
11
|
+
return props.block.image.file?.url;
|
|
12
|
+
}
|
|
13
|
+
return "";
|
|
14
|
+
});
|
|
15
|
+
const imageCaption = computed(() => {
|
|
16
|
+
return props.block.image.caption.map((item) => item.plain_text).join("");
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<img
|
|
22
|
+
:src="imageUrl"
|
|
23
|
+
:alt="imageCaption || 'Image'"
|
|
24
|
+
class="w-full h-auto rounded-lg shadow-md"
|
|
25
|
+
loading="lazy"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
v-if="block.image.caption.length > 0"
|
|
29
|
+
class="mt-2 text-center"
|
|
30
|
+
>
|
|
31
|
+
<TextRenderer :text="block.image.caption" />
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ImageBlockObjectResponse } from '@notionhq/client';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: ImageBlockObjectResponse;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NotionListBlock, NotionListType } from '../types/notion.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blocks: NotionListBlock[];
|
|
4
|
+
type: NotionListType;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import BulletedList from "./BulletedListItem.vue";
|
|
4
|
+
import NumberedListItem from "./NumberedListItem.vue";
|
|
5
|
+
import TodoListItem from "./TodoListItem.vue";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
blocks: { type: Array, required: true },
|
|
8
|
+
type: { type: String, required: true }
|
|
9
|
+
});
|
|
10
|
+
const listHtmlTag = computed(() => {
|
|
11
|
+
switch (props.type) {
|
|
12
|
+
case "bulleted_list_item":
|
|
13
|
+
return "ul";
|
|
14
|
+
case "numbered_list_item":
|
|
15
|
+
return "ol";
|
|
16
|
+
case "to_do":
|
|
17
|
+
default:
|
|
18
|
+
return "div";
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<component
|
|
25
|
+
:is="listHtmlTag"
|
|
26
|
+
class="list-inside mb-6 space-y-2 text-slate-700 "
|
|
27
|
+
:class="{
|
|
28
|
+
'list-disc': props.type === 'bulleted_list_item',
|
|
29
|
+
'list-decimal': props.type === 'numbered_list_item'
|
|
30
|
+
}"
|
|
31
|
+
>
|
|
32
|
+
<template
|
|
33
|
+
v-for="block in blocks"
|
|
34
|
+
:key="block.id"
|
|
35
|
+
>
|
|
36
|
+
<BulletedList
|
|
37
|
+
v-if="block.type === 'bulleted_list_item'"
|
|
38
|
+
:block="block"
|
|
39
|
+
/>
|
|
40
|
+
<NumberedListItem
|
|
41
|
+
v-else-if="block.type === 'numbered_list_item'"
|
|
42
|
+
:block="block"
|
|
43
|
+
/>
|
|
44
|
+
<TodoListItem
|
|
45
|
+
v-else-if="block.type === 'to_do'"
|
|
46
|
+
:block="block"
|
|
47
|
+
/>
|
|
48
|
+
</template>
|
|
49
|
+
</component>
|
|
50
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NotionListBlock, NotionListType } from '../types/notion.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blocks: NotionListBlock[];
|
|
4
|
+
type: NotionListType;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
displayMode?: boolean;
|
|
3
|
+
expression: string;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
|
+
displayMode: boolean;
|
|
7
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|