-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from nostr-dev-kit/add-kind30023
Add kind30023
- Loading branch information
Showing
14 changed files
with
276 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,84 @@ | ||
{ | ||
"name": "@nostr-dev-kit/ndk-svelte-components", | ||
"version": "0.8.8-2", | ||
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build && npm run package", | ||
"preview": "vite preview", | ||
"package": "svelte-kit sync && svelte-package && publint", | ||
"prepublishOnly": "npm run package", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"lint": "prettier --plugin-search-dir . --check . && eslint .", | ||
"format": "prettier --plugin-search-dir . --write .", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"svelte": "./dist/index.js" | ||
"name": "@nostr-dev-kit/ndk-svelte-components", | ||
"version": "0.8.8-2", | ||
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build && npm run package", | ||
"preview": "vite preview", | ||
"package": "svelte-kit sync && svelte-package && publint", | ||
"prepublishOnly": "npm run package", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"lint": "prettier --plugin-search-dir . --check . && eslint .", | ||
"format": "prettier --write .", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"svelte": "./dist/index.js" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"!dist/**/*.test.*", | ||
"!dist/**/*.spec.*" | ||
], | ||
"peerDependencies": { | ||
"svelte": "^3.54.0" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^7.2.0", | ||
"@storybook/addon-interactions": "^7.2.0", | ||
"@storybook/addon-links": "^7.2.0", | ||
"@storybook/blocks": "^7.2.0", | ||
"@storybook/manager-api": "^7.2.0", | ||
"@storybook/svelte": "^7.2.0", | ||
"@storybook/sveltekit": "^7.2.0", | ||
"@storybook/testing-library": "^0.2.0", | ||
"@storybook/theming": "^7.2.0", | ||
"@sveltejs/adapter-auto": "^2.1.0", | ||
"@sveltejs/kit": "^1.22.4", | ||
"@sveltejs/package": "^2.2.0", | ||
"@types/ramda": "^0.29.3", | ||
"@typescript-eslint/eslint-plugin": "^6.2.1", | ||
"@typescript-eslint/parser": "^6.2.1", | ||
"autoprefixer": "^10.4.14", | ||
"eslint": "^8.46.0", | ||
"eslint-config-prettier": "^8.10.0", | ||
"eslint-plugin-storybook": "^0.6.13", | ||
"eslint-plugin-svelte": "^2.32.4", | ||
"mdsvex": "^0.11.0", | ||
"postcss": "^8.4.27", | ||
"prettier": "^3.0.1", | ||
"prettier-plugin-svelte": "^3.0.3", | ||
"publint": "^0.2.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"storybook": "^7.2.3", | ||
"svelte": "^4.1.2", | ||
"svelte-check": "^3.4.6", | ||
"tailwindcss": "^3.3.3", | ||
"tslib": "^2.6.1", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.4.8" | ||
}, | ||
"svelte": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"type": "module", | ||
"dependencies": { | ||
"@nostr-dev-kit/ndk": "^0.8.7", | ||
"classnames": "^2.3.2", | ||
"hurdak": "github:ConsignCloud/hurdak", | ||
"isomorphic-dompurify": "^1.8.0", | ||
"marked": "^7.0.1", | ||
"marked-gfm-heading-id": "^3.0.6", | ||
"marked-mangle": "^1.1.2", | ||
"nostr-tools": "^1.14.0", | ||
"ramda": "^0.29.0", | ||
"rehype-autolink-headings": "^6.1.1", | ||
"rehype-slug": "^5.1.0", | ||
"svelte-preprocess": "^5.0.4" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"!dist/**/*.test.*", | ||
"!dist/**/*.spec.*" | ||
], | ||
"peerDependencies": { | ||
"svelte": "^3.54.0" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^7.2.0", | ||
"@storybook/addon-interactions": "^7.2.0", | ||
"@storybook/addon-links": "^7.2.0", | ||
"@storybook/blocks": "^7.2.0", | ||
"@storybook/manager-api": "^7.2.0", | ||
"@storybook/svelte": "^7.2.0", | ||
"@storybook/sveltekit": "^7.2.0", | ||
"@storybook/testing-library": "^0.2.0", | ||
"@storybook/theming": "^7.2.0", | ||
"@sveltejs/adapter-auto": "^2.1.0", | ||
"@sveltejs/kit": "^1.22.4", | ||
"@sveltejs/package": "^2.2.0", | ||
"@types/ramda": "^0.29.3", | ||
"@typescript-eslint/eslint-plugin": "^6.2.1", | ||
"@typescript-eslint/parser": "^6.2.1", | ||
"autoprefixer": "^10.4.14", | ||
"eslint": "^8.46.0", | ||
"eslint-config-prettier": "^8.10.0", | ||
"eslint-plugin-storybook": "^0.6.13", | ||
"eslint-plugin-svelte": "^2.32.4", | ||
"mdsvex": "^0.11.0", | ||
"postcss": "^8.4.27", | ||
"prettier": "^3.0.1", | ||
"prettier-plugin-svelte": "^3.0.3", | ||
"publint": "^0.2.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"storybook": "^7.2.0", | ||
"svelte": "^4.1.2", | ||
"svelte-check": "^3.4.6", | ||
"tailwindcss": "^3.3.3", | ||
"tslib": "^2.6.1", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.4.8" | ||
}, | ||
"svelte": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"type": "module", | ||
"dependencies": { | ||
"@nostr-dev-kit/ndk": "^0.8.7", | ||
"classnames": "^2.3.2", | ||
"hurdak": "github:ConsignCloud/hurdak", | ||
"nostr-tools": "^1.14.0", | ||
"ramda": "^0.29.0", | ||
"rehype-autolink-headings": "^6.1.1", | ||
"rehype-slug": "^5.1.0", | ||
"svelte-preprocess": "^5.0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script lang="ts"> | ||
import type { NDKArticle } from "@nostr-dev-kit/ndk"; | ||
import type NDK from "@nostr-dev-kit/ndk"; | ||
import NoteContentNewline from "./NoteContentNewline.svelte"; | ||
import NoteContentTopic from "./NoteContentTopic.svelte"; | ||
import NoteContentLink from "./NoteContentLink.svelte"; | ||
import EventCard from "../EventCard.svelte"; | ||
import NoteContentPerson from "./NoteContentPerson.svelte"; | ||
import { LINK, HTML, NEWLINE, TOPIC, parseContent } from "../../utils/notes.js"; | ||
import { markdownToHtml } from "$lib/utils/markdown"; | ||
export let ndk: NDK; | ||
export let article: NDKArticle; | ||
export let showMedia: boolean = true; | ||
export let anchorId: string | null = null; | ||
const htmlContent = markdownToHtml(article.content); | ||
const parsed = parseContent({ content: htmlContent, tags: article.tags, html: true }); | ||
</script> | ||
|
||
<div class="article"> | ||
{#each parsed as { type, value }, i} | ||
{#if type === NEWLINE} | ||
<NoteContentNewline {value} /> | ||
{:else if type === HTML} | ||
{@html value} | ||
{:else if type === TOPIC} | ||
<NoteContentTopic {value} /> | ||
{:else if type === LINK} | ||
<NoteContentLink {value} {showMedia} /> | ||
{:else if type.match(/^nostr:np(rofile|ub)$/)} | ||
<NoteContentPerson {ndk} {value} on:click /> | ||
{:else if type.startsWith("nostr:") && showMedia && value.id !== anchorId} | ||
<EventCard {ndk} id={value.id} relays={value.relays} /> | ||
{:else if type.startsWith("nostr:")} | ||
<!-- <NoteContentEntity {value} /> --> | ||
{:else} | ||
{@html value} | ||
{/if} | ||
{/each} | ||
</div> | ||
|
||
<style lang="postcss"> | ||
* > :global(.article img) { | ||
object-fit: contain; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<script lang="ts"> | ||
export let value: string = "" | ||
export let value: string = ''; | ||
</script> | ||
|
||
#{value} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { marked } from "marked"; | ||
import { gfmHeadingId } from "marked-gfm-heading-id"; | ||
import { mangle } from "marked-mangle"; | ||
import DOMPurify from "isomorphic-dompurify"; | ||
|
||
export const markdownToHtml = (content: string): string => { | ||
marked.use(mangle()); | ||
marked.use(gfmHeadingId()); | ||
|
||
return DOMPurify.sanitize( | ||
// eslint-disable-next-line no-misleading-character-class | ||
marked.parse(content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, "")), | ||
); | ||
}; |
Oops, something went wrong.