@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.

Potentially problematic release.


This version of @nei7/nuxt-notion might be problematic. Click here for more details.

Files changed (85) hide show
  1. package/README.md +84 -0
  2. package/dist/module.d.mts +9 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +32 -0
  5. package/dist/runtime/components/BulletedListItem.d.vue.ts +7 -0
  6. package/dist/runtime/components/BulletedListItem.vue +12 -0
  7. package/dist/runtime/components/BulletedListItem.vue.d.ts +7 -0
  8. package/dist/runtime/components/Callout.d.vue.ts +7 -0
  9. package/dist/runtime/components/Callout.vue +40 -0
  10. package/dist/runtime/components/Callout.vue.d.ts +7 -0
  11. package/dist/runtime/components/Code.d.vue.ts +7 -0
  12. package/dist/runtime/components/Code.vue +22 -0
  13. package/dist/runtime/components/Code.vue.d.ts +7 -0
  14. package/dist/runtime/components/Divider.d.vue.ts +7 -0
  15. package/dist/runtime/components/Divider.vue +9 -0
  16. package/dist/runtime/components/Divider.vue.d.ts +7 -0
  17. package/dist/runtime/components/Embed.d.vue.ts +7 -0
  18. package/dist/runtime/components/Embed.vue +74 -0
  19. package/dist/runtime/components/Embed.vue.d.ts +7 -0
  20. package/dist/runtime/components/Equation.d.vue.ts +7 -0
  21. package/dist/runtime/components/Equation.vue +13 -0
  22. package/dist/runtime/components/Equation.vue.d.ts +7 -0
  23. package/dist/runtime/components/File.d.vue.ts +7 -0
  24. package/dist/runtime/components/File.vue +21 -0
  25. package/dist/runtime/components/File.vue.d.ts +7 -0
  26. package/dist/runtime/components/Header.d.vue.ts +7 -0
  27. package/dist/runtime/components/Header.vue +24 -0
  28. package/dist/runtime/components/Header.vue.d.ts +7 -0
  29. package/dist/runtime/components/Image.d.vue.ts +7 -0
  30. package/dist/runtime/components/Image.vue +33 -0
  31. package/dist/runtime/components/Image.vue.d.ts +7 -0
  32. package/dist/runtime/components/ListRenderer.d.vue.ts +8 -0
  33. package/dist/runtime/components/ListRenderer.vue +50 -0
  34. package/dist/runtime/components/ListRenderer.vue.d.ts +8 -0
  35. package/dist/runtime/components/MathFormula.d.vue.ts +9 -0
  36. package/dist/runtime/components/MathFormula.vue +22 -0
  37. package/dist/runtime/components/MathFormula.vue.d.ts +9 -0
  38. package/dist/runtime/components/NumberedListItem.d.vue.ts +7 -0
  39. package/dist/runtime/components/NumberedListItem.vue +12 -0
  40. package/dist/runtime/components/NumberedListItem.vue.d.ts +7 -0
  41. package/dist/runtime/components/Paragraph.d.vue.ts +7 -0
  42. package/dist/runtime/components/Paragraph.vue +19 -0
  43. package/dist/runtime/components/Paragraph.vue.d.ts +7 -0
  44. package/dist/runtime/components/Quote.d.vue.ts +7 -0
  45. package/dist/runtime/components/Quote.vue +17 -0
  46. package/dist/runtime/components/Quote.vue.d.ts +7 -0
  47. package/dist/runtime/components/Renderer.d.vue.ts +7 -0
  48. package/dist/runtime/components/Renderer.vue +111 -0
  49. package/dist/runtime/components/Renderer.vue.d.ts +7 -0
  50. package/dist/runtime/components/Text.d.vue.ts +7 -0
  51. package/dist/runtime/components/Text.vue +20 -0
  52. package/dist/runtime/components/Text.vue.d.ts +7 -0
  53. package/dist/runtime/components/TextRenderer.d.vue.ts +7 -0
  54. package/dist/runtime/components/TextRenderer.vue +14 -0
  55. package/dist/runtime/components/TextRenderer.vue.d.ts +7 -0
  56. package/dist/runtime/components/TodoListItem.d.vue.ts +7 -0
  57. package/dist/runtime/components/TodoListItem.vue +23 -0
  58. package/dist/runtime/components/TodoListItem.vue.d.ts +7 -0
  59. package/dist/runtime/components/Video.d.vue.ts +7 -0
  60. package/dist/runtime/components/Video.vue +39 -0
  61. package/dist/runtime/components/Video.vue.d.ts +7 -0
  62. package/dist/runtime/components/WebBookmark.d.vue.ts +7 -0
  63. package/dist/runtime/components/WebBookmark.vue +58 -0
  64. package/dist/runtime/components/WebBookmark.vue.d.ts +7 -0
  65. package/dist/runtime/composables/notion.d.ts +4 -0
  66. package/dist/runtime/composables/notion.js +9 -0
  67. package/dist/runtime/composables/useNotionClient.d.ts +2 -0
  68. package/dist/runtime/composables/useNotionClient.js +14 -0
  69. package/dist/runtime/server/api/_notion/blocks.get.d.ts +2 -0
  70. package/dist/runtime/server/api/_notion/blocks.get.js +14 -0
  71. package/dist/runtime/server/api/_notion/link-meta.get.d.ts +2 -0
  72. package/dist/runtime/server/api/_notion/link-meta.get.js +44 -0
  73. package/dist/runtime/server/api/_notion/page.get.d.ts +2 -0
  74. package/dist/runtime/server/api/_notion/page.get.js +13 -0
  75. package/dist/runtime/server/api/_notion/query-database.get.d.ts +2 -0
  76. package/dist/runtime/server/api/_notion/query-database.get.js +15 -0
  77. package/dist/runtime/server/tsconfig.json +3 -0
  78. package/dist/runtime/types/index.d.ts +14 -0
  79. package/dist/runtime/types/index.js +0 -0
  80. package/dist/runtime/types/notion.d.ts +11 -0
  81. package/dist/runtime/types/notion.js +0 -0
  82. package/dist/runtime/utils/index.d.ts +7 -0
  83. package/dist/runtime/utils/index.js +41 -0
  84. package/dist/types.d.mts +3 -0
  85. package/package.json +68 -0
@@ -0,0 +1,2 @@
1
+ declare const _default: import("h3").EventHandler<Omit<import("h3").EventHandlerRequest, "body">, Promise<import("@notionhq/client").QueryDataSourceResponse>>;
2
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { getValidatedQuery } from "h3";
2
+ import { useNotionClient } from "../../../composables/useNotionClient.js";
3
+ import { z } from "zod";
4
+ import { defineCachedEventHandler } from "nitropack/runtime";
5
+ const schema = z.object({
6
+ data_source_id: z.string(),
7
+ filter: z.object().optional(),
8
+ sorts: z.array(z.object()).optional(),
9
+ page_size: z.number().optional().default(25)
10
+ });
11
+ export default defineCachedEventHandler(async (event) => {
12
+ const client = useNotionClient();
13
+ const query = await getValidatedQuery(event, schema.parse);
14
+ return client.dataSources.query(query);
15
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "../../../.nuxt/tsconfig.server.json",
3
+ }
@@ -0,0 +1,14 @@
1
+ export type LinkMetadataSuccessResponse = {
2
+ success: true;
3
+ title: string;
4
+ description?: string;
5
+ image?: string;
6
+ icon?: string;
7
+ url: string;
8
+ };
9
+ export type LinkMetadataErrorResponse = {
10
+ success: false;
11
+ title: string;
12
+ url: string;
13
+ };
14
+ export type LinkMetadataResponse = LinkMetadataErrorResponse | LinkMetadataSuccessResponse;
File without changes
@@ -0,0 +1,11 @@
1
+ import type { BlockObjectResponse, BulletedListItemBlockObjectResponse, NumberedListItemBlockObjectResponse, PartialBlockObjectResponse, RichTextItemResponse, ToDoBlockObjectResponse, EmbedBlockObjectResponse, VideoBlockObjectResponse } from '@notionhq/client';
2
+ export type NotionColor = RichTextItemResponse['annotations']['color'];
3
+ export type AnyNotionBlock = BlockObjectResponse | PartialBlockObjectResponse;
4
+ export type NotionAnnotations = RichTextItemResponse['annotations'];
5
+ export type NotionListBlock = BulletedListItemBlockObjectResponse | NumberedListItemBlockObjectResponse | ToDoBlockObjectResponse;
6
+ export type NotionListType = NotionListBlock['type'];
7
+ export type NotionEmbed = EmbedBlockObjectResponse | VideoBlockObjectResponse & {
8
+ video: {
9
+ type: 'external';
10
+ };
11
+ };
File without changes
@@ -0,0 +1,7 @@
1
+ import type { BlockObjectResponse } from '@notionhq/client';
2
+ import type { NotionAnnotations, NotionColor } from '../types/notion.js';
3
+ export declare function isNotionBlockType<T extends BlockObjectResponse, U extends T['type']>(block: T, ...types: U[]): block is T & {
4
+ type: U;
5
+ };
6
+ export declare const notionColorToCss: (color: NotionColor) => string;
7
+ export declare const notionAnnotationsToCss: (annotations: NotionAnnotations) => string[];
@@ -0,0 +1,41 @@
1
+ export function isNotionBlockType(block, ...types) {
2
+ for (const t of types) if (t === block.type) return true;
3
+ return false;
4
+ }
5
+ const colorsMap = {
6
+ default: "text-gray-900 dark:text-gray-100",
7
+ gray: "text-gray-500 dark:text-gray-400",
8
+ brown: "text-orange-800 dark:text-orange-300",
9
+ orange: "text-orange-600 dark:text-orange-400",
10
+ yellow: "text-yellow-600 dark:text-yellow-300",
11
+ green: "text-green-600 dark:text-green-400",
12
+ blue: "text-blue-600 dark:text-blue-400",
13
+ purple: "text-purple-600 dark:text-purple-400",
14
+ pink: "text-pink-600 dark:text-pink-400",
15
+ red: "text-red-600 dark:text-red-400",
16
+ gray_background: "bg-gray-100 dark:bg-gray-800",
17
+ brown_background: "bg-orange-100 dark:bg-orange-900/50",
18
+ orange_background: "bg-orange-100 dark:bg-orange-900/50",
19
+ yellow_background: "bg-yellow-100 dark:bg-yellow-900/50",
20
+ green_background: "bg-green-100 dark:bg-green-900/50",
21
+ blue_background: "bg-blue-100 dark:bg-blue-900/50",
22
+ purple_background: "bg-purple-100 dark:bg-purple-900/50",
23
+ pink_background: "bg-pink-100 dark:bg-pink-900/50",
24
+ red_background: "bg-red-100 dark:bg-red-900/50",
25
+ default_background: ""
26
+ };
27
+ export const notionColorToCss = (color) => {
28
+ return colorsMap[color];
29
+ };
30
+ export const notionAnnotationsToCss = (annotations) => {
31
+ const classes = [];
32
+ if (annotations.strikethrough) classes.push("line-through");
33
+ if (annotations.underline) classes.push("underline");
34
+ if (annotations.bold) classes.push("font-bold");
35
+ if (annotations.italic) classes.push("italic");
36
+ if (annotations.code) {
37
+ classes.push("bg-gray-100 dark:bg-gray-800 px-1 py-0.5 text-sm font-mono");
38
+ }
39
+ classes.push(notionColorToCss(annotations.color));
40
+ return classes;
41
+ };
@@ -0,0 +1,3 @@
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@nei7/nuxt-notion",
3
+ "version": "1.0.0",
4
+ "description": "My new Nuxt module",
5
+ "repository": "your-org/my-module",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types.d.mts",
11
+ "import": "./dist/module.mjs"
12
+ }
13
+ },
14
+ "main": "./dist/module.mjs",
15
+ "typesVersions": {
16
+ "*": {
17
+ ".": [
18
+ "./dist/types.d.mts"
19
+ ]
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "dependencies": {
26
+ "@notionhq/client": "^5.6.0",
27
+ "@nuxt/kit": "^4.2.2",
28
+ "@tailwindcss/typography": "^0.5.19",
29
+ "@tailwindcss/vite": "^4.1.18",
30
+ "defu": "^6.1.4",
31
+ "katex": "^0.16.27",
32
+ "metascraper": "^5.49.7",
33
+ "metascraper-description": "^5.49.7",
34
+ "metascraper-image": "^5.49.7",
35
+ "metascraper-logo": "^5.49.7",
36
+ "metascraper-logo-favicon": "^5.49.7",
37
+ "metascraper-title": "^5.49.7",
38
+ "tailwindcss": "^4.1.18",
39
+ "zod": "^4.2.1"
40
+ },
41
+ "devDependencies": {
42
+ "@nuxt/devtools": "^3.1.1",
43
+ "@nuxt/eslint-config": "^1.12.1",
44
+ "@nuxt/module-builder": "^1.0.2",
45
+ "@nuxt/schema": "^4.2.2",
46
+ "@nuxt/test-utils": "^3.21.0",
47
+ "@types/node": "latest",
48
+ "changelogen": "^0.6.2",
49
+ "eslint": "^9.39.2",
50
+ "nuxt": "^4.2.2",
51
+ "typescript": "~5.9.3",
52
+ "vitest": "^4.0.15",
53
+ "vue-tsc": "^3.1.8"
54
+ },
55
+ "peerDependencies": {
56
+ "nuxt-shiki": "^0.3.2"
57
+ },
58
+ "scripts": {
59
+ "dev": "npm run dev:prepare && nuxi dev playground",
60
+ "dev:build": "nuxi build playground",
61
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
62
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
63
+ "lint": "eslint .",
64
+ "test": "vitest run",
65
+ "test:watch": "vitest watch",
66
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
67
+ }
68
+ }