From 75af2001088aceb61ab43fa80fa142be37c4d911 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sun, 19 Feb 2023 14:56:31 +0100 Subject: [PATCH 01/77] Update submenu --- package.json | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 81fe5c98..5138c18c 100644 --- a/package.json +++ b/package.json @@ -1697,15 +1697,18 @@ }, { "command": "frontMatter.createFromTemplate", - "title": "Front Matter: New article from template" + "title": "New article from template", + "category": "Front Matter" }, { "command": "frontMatter.registerFolder", - "title": "Front Matter: Register folder" + "title": "Register folder", + "category": "Front Matter" }, { "command": "frontMatter.unregisterFolder", - "title": "Front Matter: Unregister folder" + "title": "Unregister folder", + "category": "Front Matter" }, { "command": "frontMatter.generateSlug", @@ -1886,6 +1889,10 @@ "category": "Front Matter" } ], + "submenus": [{ + "id": "frontmatter.submenu", + "label": "Front Matter" + }], "menus": { "editor/title": [ { @@ -1965,20 +1972,26 @@ } ], "explorer/context": [ + { + "submenu": "frontmatter.submenu", + "group": "frontmatter@1" + } + ], + "frontmatter.submenu": [ { "command": "frontMatter.createFromTemplate", "when": "explorerResourceIsFolder", - "group": "Front Matter@1" + "group": "frontmatter@1" }, { "command": "frontMatter.registerFolder", "when": "explorerResourceIsFolder", - "group": "Front Matter@2" + "group": "frontmatter@2" }, { "command": "frontMatter.unregisterFolder", "when": "explorerResourceIsFolder", - "group": "Front Matter@3" + "group": "frontmatter@3" } ], "commandPalette": [ From 7e398d206a77ba900f604318acc57d1149b0c2e7 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 24 Feb 2023 18:21:12 +0100 Subject: [PATCH 02/77] POC of rendering custom HTML --- package-lock.json | 34 +++++++++-- package.json | 12 ++-- src/commands/Dashboard.ts | 6 +- src/dashboardWebView/DashboardMessage.ts | 1 + .../components/Contents/Item.tsx | 23 +++++++- .../components/DataView/DataView.tsx | 2 +- .../components/Header/SyncButton.tsx | 2 +- src/dashboardWebView/hooks/useMedia.tsx | 16 +++--- src/dashboardWebView/hooks/useMessages.tsx | 20 +++---- src/dashboardWebView/hooks/usePages.tsx | 2 +- src/explorerView/ExplorerView.ts | 4 +- src/listeners/dashboard/BaseListener.ts | 7 ++- src/listeners/dashboard/DashboardListener.ts | 7 ++- src/listeners/dashboard/DataListener.ts | 9 +-- src/listeners/dashboard/ExtensionListener.ts | 11 ++-- src/listeners/dashboard/LogListener.ts | 5 +- src/listeners/dashboard/MediaListener.ts | 25 +++++---- src/listeners/dashboard/PagesListener.ts | 28 +++++++++- src/listeners/dashboard/SettingsListener.ts | 10 ++-- src/listeners/dashboard/SnippetListener.ts | 10 ++-- src/listeners/dashboard/TaxonomyListener.ts | 16 +++--- src/listeners/dashboard/TelemetryListener.ts | 5 +- src/listeners/general/BaseListener.ts | 15 +++-- src/listeners/general/GitListener.ts | 9 +-- src/listeners/general/ModeListener.ts | 4 +- src/listeners/panel/ArticleListener.ts | 5 +- src/listeners/panel/BaseListener.ts | 8 +-- src/listeners/panel/DataListener.ts | 11 ++-- src/listeners/panel/ExtensionListener.ts | 6 +- src/listeners/panel/MediaListener.ts | 10 ++-- src/listeners/panel/ScriptListener.ts | 10 ++-- src/listeners/panel/SettingsListener.ts | 11 ++-- src/listeners/panel/TaxonomyListener.ts | 34 +++++------ src/models/PostMessageData.ts | 5 ++ src/models/index.ts | 1 + .../components/Fields/DataFileField.tsx | 56 +++++++++---------- .../components/Fields/PreviewImage.tsx | 6 +- .../components/Fields/SlugField.tsx | 9 ++- .../components/Fields/WrapperField.tsx | 2 +- src/panelWebView/components/Git/GitAction.tsx | 2 +- src/panelWebView/hooks/useMessages.tsx | 12 ++-- 41 files changed, 275 insertions(+), 196 deletions(-) create mode 100644 src/models/PostMessageData.ts diff --git a/package-lock.json b/package-lock.json index f0f7da93..9263dd4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "devDependencies": { "@actions/core": "^1.8.2", "@bendera/vscode-webview-elements": "0.6.2", - "@estruyf/vscode": "0.0.3", + "@estruyf/vscode": "^1.1.0", "@headlessui/react": "1.5.0", "@heroicons/react": "1.0.4", "@iarna/toml": "2.2.3", @@ -316,17 +316,28 @@ "dev": true }, "node_modules/@estruyf/vscode": { - "version": "0.0.3", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@estruyf/vscode/-/vscode-1.1.0.tgz", + "integrity": "sha512-JOjok+d870IsBPqk/E+KeW9E5ar+slqW8Sae5PtNb1yB8aMudJy9DHV5wQeki/ZwggFYDv+6EPjyzW/71/5yVw==", "dev": true, - "license": "MIT", "dependencies": { - "@types/vscode-webview": "1.57.0" + "@types/vscode-webview": "1.57.0", + "uuid": "^9.0.0" }, "funding": { "type": "individual", "url": "https://github.com/sponsors/estruyf" } }, + "node_modules/@estruyf/vscode/node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@headlessui/react": { "version": "1.5.0", "dev": true, @@ -12088,10 +12099,21 @@ } }, "@estruyf/vscode": { - "version": "0.0.3", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@estruyf/vscode/-/vscode-1.1.0.tgz", + "integrity": "sha512-JOjok+d870IsBPqk/E+KeW9E5ar+slqW8Sae5PtNb1yB8aMudJy9DHV5wQeki/ZwggFYDv+6EPjyzW/71/5yVw==", "dev": true, "requires": { - "@types/vscode-webview": "1.57.0" + "@types/vscode-webview": "1.57.0", + "uuid": "^9.0.0" + }, + "dependencies": { + "uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true + } } }, "@headlessui/react": { diff --git a/package.json b/package.json index 5138c18c..0ad69900 100644 --- a/package.json +++ b/package.json @@ -1889,10 +1889,12 @@ "category": "Front Matter" } ], - "submenus": [{ - "id": "frontmatter.submenu", - "label": "Front Matter" - }], + "submenus": [ + { + "id": "frontmatter.submenu", + "label": "Front Matter" + } + ], "menus": { "editor/title": [ { @@ -2230,7 +2232,7 @@ "devDependencies": { "@actions/core": "^1.8.2", "@bendera/vscode-webview-elements": "0.6.2", - "@estruyf/vscode": "0.0.3", + "@estruyf/vscode": "^1.1.0", "@headlessui/react": "1.5.0", "@heroicons/react": "1.0.4", "@iarna/toml": "2.2.3", diff --git a/src/commands/Dashboard.ts b/src/commands/Dashboard.ts index 09619abf..005473ab 100644 --- a/src/commands/Dashboard.ts +++ b/src/commands/Dashboard.ts @@ -77,7 +77,7 @@ export class Dashboard { if (hasData) { Dashboard.postWebviewMessage({ command: DashboardCommand.viewData, - data: Dashboard.viewData + payload: Dashboard.viewData }); } } @@ -142,7 +142,7 @@ export class Dashboard { Dashboard.postWebviewMessage({ command: DashboardCommand.viewData, - data: null + payload: null }); } @@ -190,7 +190,7 @@ export class Dashboard { * Post data to the dashboard * @param msg */ - public static postWebviewMessage(msg: { command: DashboardCommand; data?: unknown }) { + public static postWebviewMessage(msg: { command: DashboardCommand; payload?: unknown }) { if (Dashboard.isDisposed) { return; } diff --git a/src/dashboardWebView/DashboardMessage.ts b/src/dashboardWebView/DashboardMessage.ts index 66539608..de8e6074 100644 --- a/src/dashboardWebView/DashboardMessage.ts +++ b/src/dashboardWebView/DashboardMessage.ts @@ -19,6 +19,7 @@ export enum DashboardMessage { searchPages = 'searchPages', openFile = 'openFile', deleteFile = 'deleteFile', + getCustomHtml = 'getCustomHtml', // Media Dashboard getMedia = 'getMedia', diff --git a/src/dashboardWebView/components/Contents/Item.tsx b/src/dashboardWebView/components/Contents/Item.tsx index 8245bf17..bffeb918 100644 --- a/src/dashboardWebView/components/Contents/Item.tsx +++ b/src/dashboardWebView/components/Contents/Item.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { useRecoilValue } from 'recoil'; import { MarkdownIcon } from '../../../panelWebView/components/Icons/MarkdownIcon'; import { DashboardMessage } from '../../DashboardMessage'; @@ -8,9 +7,11 @@ import { DateField } from '../Common/DateField'; import { Messenger } from '@estruyf/vscode/dist/client'; import { DashboardViewType } from '../../models'; import { ContentActions } from './ContentActions'; -import { useMemo } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import useThemeColors from '../../hooks/useThemeColors'; import { Status } from './Status'; +import * as React from 'react'; +import { messageHandler } from '@estruyf/vscode/dist/client'; export interface IItemProps extends Page { } @@ -27,6 +28,7 @@ export const Item: React.FunctionComponent = ({ const view = useRecoilValue(ViewSelector); const settings = useRecoilValue(SettingsSelector); const draftField = useMemo(() => settings?.draftField, [settings]); + const [customHtml, setCustomHtml] = useState(undefined); const { getColors } = useThemeColors(); const escapedTitle = useMemo(() => { @@ -49,7 +51,7 @@ export const Item: React.FunctionComponent = ({ Messenger.send(DashboardMessage.openFile, fmFilePath); }; - const tags: string[] | undefined = React.useMemo(() => { + const tags: string[] | undefined = useMemo(() => { if (!settings?.dashboardState?.contents?.tags) { return undefined; } @@ -74,6 +76,15 @@ export const Item: React.FunctionComponent = ({ return []; }, [settings, pageData]); + useEffect(() => { + messageHandler.request(DashboardMessage.getCustomHtml, { + path: fmFilePath, + data: pageData, + }).then((html) => { + setCustomHtml(html || ""); + }); + }, []); + if (view === DashboardViewType.Grid) { return (
  • @@ -157,6 +168,12 @@ export const Item: React.FunctionComponent = ({ )} )} + + { + customHtml && ( +
    + ) + }
  • diff --git a/src/dashboardWebView/components/DataView/DataView.tsx b/src/dashboardWebView/components/DataView/DataView.tsx index 8b9b5e95..a70c613f 100644 --- a/src/dashboardWebView/components/DataView/DataView.tsx +++ b/src/dashboardWebView/components/DataView/DataView.tsx @@ -44,7 +44,7 @@ export const DataView: React.FunctionComponent = ( const messageListener = (message: MessageEvent>) => { if (message.data.command === DashboardCommand.dataFileEntries) { - setDataEntries(message.data.data); + setDataEntries(message.data.payload); } }; diff --git a/src/dashboardWebView/components/Header/SyncButton.tsx b/src/dashboardWebView/components/Header/SyncButton.tsx index 887f5a6e..fac95142 100644 --- a/src/dashboardWebView/components/Header/SyncButton.tsx +++ b/src/dashboardWebView/components/Header/SyncButton.tsx @@ -22,7 +22,7 @@ export const SyncButton: React.FunctionComponent = ( }; const messageListener = (message: MessageEvent>) => { - const { command, data } = message.data; + const { command, payload } = message.data; if (command === GeneralCommands.toWebview.gitSyncingStart) { setIsSyncing(true); diff --git a/src/dashboardWebView/hooks/useMedia.tsx b/src/dashboardWebView/hooks/useMedia.tsx index 1fd6d293..d6400fd7 100644 --- a/src/dashboardWebView/hooks/useMedia.tsx +++ b/src/dashboardWebView/hooks/useMedia.tsx @@ -51,15 +51,15 @@ export default function useMedia() { message: MessageEvent> ) => { if (message.data.command === DashboardCommand.media) { - const data: MediaPaths = message.data.data as MediaPaths; + const payload: MediaPaths = message.data.payload as MediaPaths; setLoading(false); - setMedia(data.media); - setTotal(data.total); - setFolders(data.folders); - setSelectedFolder(data.selectedFolder); - setSearchedMedia(data.media); - setAllContentFolders(data.allContentFolders); - setAllStaticFolders(data.allStaticfolders); + setMedia(payload.media); + setTotal(payload.total); + setFolders(payload.folders); + setSelectedFolder(payload.selectedFolder); + setSearchedMedia(payload.media); + setAllContentFolders(payload.allContentFolders); + setAllStaticFolders(payload.allStaticfolders); } }; diff --git a/src/dashboardWebView/hooks/useMessages.tsx b/src/dashboardWebView/hooks/useMessages.tsx index b2bb709e..d85011bb 100644 --- a/src/dashboardWebView/hooks/useMessages.tsx +++ b/src/dashboardWebView/hooks/useMessages.tsx @@ -30,34 +30,34 @@ export default function useMessages() { switch (message.command) { case DashboardCommand.loading: - setLoading(message.data); + setLoading(message.payload); break; case DashboardCommand.viewData: - setViewData(message.data); - if (message.data?.type === NavigationType.Media) { + setViewData(message.payload); + if (message.payload?.type === NavigationType.Media) { setView(NavigationType.Media); - } else if (message.data?.type === NavigationType.Contents) { + } else if (message.payload?.type === NavigationType.Contents) { setView(NavigationType.Contents); - } else if (message.data?.type === NavigationType.Data) { + } else if (message.payload?.type === NavigationType.Data) { setView(NavigationType.Data); - } else if (message.data?.type === NavigationType.Taxonomy) { + } else if (message.payload?.type === NavigationType.Taxonomy) { setView(NavigationType.Taxonomy); - } else if (message.data?.type === NavigationType.Snippets) { + } else if (message.payload?.type === NavigationType.Snippets) { setView(NavigationType.Snippets); } break; case DashboardCommand.settings: - setSettings(message.data); + setSettings(message.payload); break; case DashboardCommand.pages: - setPages(message.data); + setPages(message.payload); setLoading(false); break; case DashboardCommand.searchReady: setSearchReady(true); break; case GeneralCommands.toWebview.setMode: - setMode(message.data); + setMode(message.payload); break; } }; diff --git a/src/dashboardWebView/hooks/usePages.tsx b/src/dashboardWebView/hooks/usePages.tsx index 41da1b01..473f6f0a 100644 --- a/src/dashboardWebView/hooks/usePages.tsx +++ b/src/dashboardWebView/hooks/usePages.tsx @@ -182,7 +182,7 @@ export default function usePages(pages: Page[]) { const searchListener = (message: MessageEvent>) => { switch (message.data.command) { case DashboardMessage.searchPages: - processPages(message.data.data); + processPages(message.data.payload); break; } }; diff --git a/src/explorerView/ExplorerView.ts b/src/explorerView/ExplorerView.ts index cd4500f3..0881ca90 100644 --- a/src/explorerView/ExplorerView.ts +++ b/src/explorerView/ExplorerView.ts @@ -115,7 +115,7 @@ export class ExplorerView implements WebviewViewProvider, Disposable { }); window.onDidChangeActiveTextEditor(() => { - this.sendMessage({ command: Command.loading, data: true }); + this.sendMessage({ command: Command.loading, payload: true }); if (this.visible) { DataListener.getFileData(); @@ -131,7 +131,7 @@ export class ExplorerView implements WebviewViewProvider, Disposable { * Post data to the panel * @param msg */ - public sendMessage(msg: { command: Command; data?: any }) { + public sendMessage(msg: { command: Command; payload?: any }) { this.panel?.webview?.postMessage(msg); } diff --git a/src/listeners/dashboard/BaseListener.ts b/src/listeners/dashboard/BaseListener.ts index 21fddf86..ed23489c 100644 --- a/src/listeners/dashboard/BaseListener.ts +++ b/src/listeners/dashboard/BaseListener.ts @@ -2,21 +2,22 @@ import { Dashboard } from '../../commands/Dashboard'; import { DashboardCommand } from '../../dashboardWebView/DashboardCommand'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { Logger } from '../../helpers/Logger'; +import { PostMessageData } from '../../models'; export abstract class BaseListener { - public static process(msg: { command: DashboardMessage; data: any }) {} + public static process(msg: PostMessageData) {} /** * Send a message to the webview * @param command * @param data */ - public static sendMsg(command: DashboardCommand, data: any) { + public static sendMsg(command: DashboardCommand, payload: any) { Logger.info(`Sending message to webview: ${command}`); Dashboard.postWebviewMessage({ command, - data + payload }); } } diff --git a/src/listeners/dashboard/DashboardListener.ts b/src/listeners/dashboard/DashboardListener.ts index d5144005..0a7c72d9 100644 --- a/src/listeners/dashboard/DashboardListener.ts +++ b/src/listeners/dashboard/DashboardListener.ts @@ -3,6 +3,7 @@ import { ExtensionState } from '../../constants'; import { DashboardCommand } from '../../dashboardWebView/DashboardCommand'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { Extension, Notifications } from '../../helpers'; +import { PostMessageData } from '../../models'; import { BaseListener } from './BaseListener'; export class DashboardListener extends BaseListener { @@ -10,7 +11,7 @@ export class DashboardListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: DashboardMessage; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -23,10 +24,10 @@ export class DashboardListener extends BaseListener { Dashboard.reload(); break; case DashboardMessage.setPageViewType: - Extension.getInstance().setState(ExtensionState.PagesView, msg.data, 'workspace'); + Extension.getInstance().setState(ExtensionState.PagesView, msg.payload, 'workspace'); break; case DashboardMessage.showWarning: - Notifications.warning(msg.data); + Notifications.warning(msg.payload); break; } } diff --git a/src/listeners/dashboard/DataListener.ts b/src/listeners/dashboard/DataListener.ts index 9271f08a..3fd28130 100644 --- a/src/listeners/dashboard/DataListener.ts +++ b/src/listeners/dashboard/DataListener.ts @@ -9,21 +9,22 @@ import * as yaml from 'js-yaml'; import { DataFileHelper } from '../../helpers'; import { existsAsync, readFileAsync, writeFileAsync } from '../../utils'; import { mkdirAsync } from '../../utils/mkdirAsync'; +import { PostMessageData } from '../../models'; export class DataListener extends BaseListener { - public static process(msg: { command: DashboardMessage; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { case DashboardMessage.getDataEntries: - if (!(msg?.data as DataFile).file) { + if (!(msg?.payload as DataFile).file) { this.sendMsg(DashboardCommand.dataFileEntries, []); } - this.processDataFile(msg?.data); + this.processDataFile(msg?.payload); break; case DashboardMessage.putDataEntries: - this.processDataUpdate(msg?.data); + this.processDataUpdate(msg?.payload); break; default: return; diff --git a/src/listeners/dashboard/ExtensionListener.ts b/src/listeners/dashboard/ExtensionListener.ts index d3b644e1..af7b5eb5 100644 --- a/src/listeners/dashboard/ExtensionListener.ts +++ b/src/listeners/dashboard/ExtensionListener.ts @@ -4,27 +4,28 @@ import { COMMAND_NAME } from '../../constants'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { CustomScript, Extension } from '../../helpers'; import { openFileInEditor } from '../../helpers/openFileInEditor'; +import { PostMessageData } from '../../models'; import { BaseListener } from './BaseListener'; export class ExtensionListener extends BaseListener { - public static process(msg: { command: DashboardMessage; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { case DashboardMessage.openFile: - openFileInEditor(msg.data); + openFileInEditor(msg.payload); break; case DashboardMessage.initializeProject: commands.executeCommand(COMMAND_NAME.init, SettingsListener.getSettings); break; case DashboardMessage.copyToClipboard: - env.clipboard.writeText(msg.data); + env.clipboard.writeText(msg.payload); break; case DashboardMessage.runCustomScript: - CustomScript.run(msg?.data?.script, msg?.data?.path); + CustomScript.run(msg?.payload?.script, msg?.payload?.path); break; case DashboardMessage.setState: - this.setState(msg?.data); + this.setState(msg?.payload); break; } } diff --git a/src/listeners/dashboard/LogListener.ts b/src/listeners/dashboard/LogListener.ts index f39802c7..f4879b7b 100644 --- a/src/listeners/dashboard/LogListener.ts +++ b/src/listeners/dashboard/LogListener.ts @@ -1,5 +1,6 @@ import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { Logger } from '../../helpers'; +import { PostMessageData } from '../../models'; import { BaseListener } from './BaseListener'; export class LogListener extends BaseListener { @@ -7,12 +8,12 @@ export class LogListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: DashboardMessage; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { case DashboardMessage.logError: - Logger.error(msg.data); + Logger.error(msg.payload); break; } } diff --git a/src/listeners/dashboard/MediaListener.ts b/src/listeners/dashboard/MediaListener.ts index d2ac5f23..c4212921 100644 --- a/src/listeners/dashboard/MediaListener.ts +++ b/src/listeners/dashboard/MediaListener.ts @@ -8,52 +8,53 @@ import { commands, env, Uri } from 'vscode'; import { COMMAND_NAME, TelemetryEvent } from '../../constants'; import * as os from 'os'; import { Folders } from '../../commands'; +import { PostMessageData } from '../../models'; export class MediaListener extends BaseListener { private static timers: { [folder: string]: any } = {}; - public static async process(msg: { command: DashboardMessage; data: any }) { + public static async process(msg: PostMessageData) { super.process(msg); switch (msg.command) { case DashboardMessage.getMedia: - const { page, folder, sorting } = msg?.data; + const { page, folder, sorting } = msg?.payload; this.sendMediaFiles(page, folder, sorting); break; case DashboardMessage.refreshMedia: Telemetry.send(TelemetryEvent.refreshMedia); MediaHelpers.resetMedia(); - this.sendMediaFiles(0, msg?.data?.folder); + this.sendMediaFiles(0, msg?.payload?.folder); break; case DashboardMessage.uploadMedia: Telemetry.send(TelemetryEvent.uploadMedia); - this.store(msg?.data); + this.store(msg?.payload); break; case DashboardMessage.deleteMedia: Telemetry.send(TelemetryEvent.deleteMedia); - this.delete(msg?.data); + this.delete(msg?.payload); break; case DashboardMessage.revealMedia: - this.openFileInFinder(msg?.data?.file); + this.openFileInFinder(msg?.payload?.file); break; case DashboardMessage.insertMedia: Telemetry.send(TelemetryEvent.insertMediaToContent); - MediaHelpers.insertMediaToMarkdown(msg?.data); + MediaHelpers.insertMediaToMarkdown(msg?.payload); break; case DashboardMessage.insertFile: Telemetry.send(TelemetryEvent.insertFileToContent); - MediaHelpers.insertMediaToMarkdown(msg?.data); + MediaHelpers.insertMediaToMarkdown(msg?.payload); break; case DashboardMessage.updateMediaMetadata: Telemetry.send(TelemetryEvent.updateMediaMetadata); - this.update(msg.data); + this.update(msg.payload); break; case DashboardMessage.createMediaFolder: - await commands.executeCommand(COMMAND_NAME.createFolder, msg?.data); + await commands.executeCommand(COMMAND_NAME.createFolder, msg?.payload); break; case DashboardMessage.createHexoAssetFolder: - if (msg?.data.hexoAssetFolderPath) { - Folders.createFolder(msg?.data.hexoAssetFolderPath); + if (msg?.payload.hexoAssetFolderPath) { + Folders.createFolder(msg?.payload.hexoAssetFolderPath); } break; } diff --git a/src/listeners/dashboard/PagesListener.ts b/src/listeners/dashboard/PagesListener.ts index d22f97e6..bdca5746 100644 --- a/src/listeners/dashboard/PagesListener.ts +++ b/src/listeners/dashboard/PagesListener.ts @@ -1,3 +1,4 @@ +import { PostMessageData } from './../../models/PostMessageData'; import { basename } from 'path'; import { commands, FileSystemWatcher, RelativePattern, TextDocument, Uri, workspace } from 'vscode'; import { Dashboard } from '../../commands/Dashboard'; @@ -21,7 +22,7 @@ export class PagesListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static async process(msg: { command: DashboardMessage; data: any }) { + public static async process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -41,14 +42,35 @@ export class PagesListener extends BaseListener { this.getPagesData(true); break; case DashboardMessage.searchPages: - this.searchPages(msg.data); + this.searchPages(msg.payload); break; case DashboardMessage.deleteFile: - this.deletePage(msg.data); + this.deletePage(msg.payload); + break; + case DashboardMessage.getCustomHtml: + const message = msg as any; + this.getCustomCardHtml(message.command, message.requestId, message.payload); break; } } + private static async getCustomCardHtml(command: string, requestId: string, payload: any) { + if (!command || !requestId || !payload) { + return; + } + + const slug = payload.data.slug; + if (!slug) { + return; + } + + Dashboard.postWebviewMessage({ + command, + requestId, + payload: `
    `, + } as any) + } + /** * Saved file watcher * @returns diff --git a/src/listeners/dashboard/SettingsListener.ts b/src/listeners/dashboard/SettingsListener.ts index cff08ca5..e179f703 100644 --- a/src/listeners/dashboard/SettingsListener.ts +++ b/src/listeners/dashboard/SettingsListener.ts @@ -6,7 +6,7 @@ import { DashboardCommand } from '../../dashboardWebView/DashboardCommand'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { DashboardSettings, Settings } from '../../helpers'; import { FrameworkDetector } from '../../helpers/FrameworkDetector'; -import { Framework } from '../../models'; +import { Framework, PostMessageData } from '../../models'; import { BaseListener } from './BaseListener'; export class SettingsListener extends BaseListener { @@ -14,7 +14,7 @@ export class SettingsListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: DashboardMessage; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -22,13 +22,13 @@ export class SettingsListener extends BaseListener { this.getSettings(); break; case DashboardMessage.updateSetting: - this.update(msg.data); + this.update(msg.payload); break; case DashboardMessage.setFramework: - this.setFramework(msg?.data); + this.setFramework(msg?.payload); break; case DashboardMessage.addFolder: - this.addFolder(msg?.data); + this.addFolder(msg?.payload); break; } } diff --git a/src/listeners/dashboard/SnippetListener.ts b/src/listeners/dashboard/SnippetListener.ts index c8f02ece..ba88db30 100644 --- a/src/listeners/dashboard/SnippetListener.ts +++ b/src/listeners/dashboard/SnippetListener.ts @@ -4,24 +4,24 @@ import { Dashboard } from '../../commands/Dashboard'; import { SETTING_CONTENT_SNIPPETS, TelemetryEvent } from '../../constants'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { Notifications, Settings, Telemetry } from '../../helpers'; -import { Snippets } from '../../models'; +import { PostMessageData, Snippets } from '../../models'; import { BaseListener } from './BaseListener'; import { SettingsListener } from './SettingsListener'; export class SnippetListener extends BaseListener { - public static process(msg: { command: DashboardMessage; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { case DashboardMessage.addSnippet: - this.addSnippet(msg.data); + this.addSnippet(msg.payload); break; case DashboardMessage.updateSnippet: - this.updateSnippet(msg.data); + this.updateSnippet(msg.payload); break; case DashboardMessage.insertSnippet: Telemetry.send(TelemetryEvent.insertContentSnippet); - this.insertSnippet(msg.data); + this.insertSnippet(msg.payload); break; } } diff --git a/src/listeners/dashboard/TaxonomyListener.ts b/src/listeners/dashboard/TaxonomyListener.ts index a463a35d..2a9e4e22 100644 --- a/src/listeners/dashboard/TaxonomyListener.ts +++ b/src/listeners/dashboard/TaxonomyListener.ts @@ -8,7 +8,7 @@ import { import { DashboardCommand } from '../../dashboardWebView/DashboardCommand'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { Settings, TaxonomyHelper } from '../../helpers'; -import { CustomTaxonomy } from '../../models'; +import { CustomTaxonomy, PostMessageData } from '../../models'; import { BaseListener } from './BaseListener'; export class TaxonomyListener extends BaseListener { @@ -16,7 +16,7 @@ export class TaxonomyListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: DashboardMessage; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -24,22 +24,22 @@ export class TaxonomyListener extends BaseListener { this.getData(); break; case DashboardMessage.editTaxonomy: - TaxonomyHelper.rename(msg.data); + TaxonomyHelper.rename(msg.payload); break; case DashboardMessage.mergeTaxonomy: - TaxonomyHelper.merge(msg.data); + TaxonomyHelper.merge(msg.payload); break; case DashboardMessage.deleteTaxonomy: - TaxonomyHelper.delete(msg.data); + TaxonomyHelper.delete(msg.payload); break; case DashboardMessage.moveTaxonomy: - TaxonomyHelper.move(msg.data); + TaxonomyHelper.move(msg.payload); break; case DashboardMessage.addToTaxonomy: - TaxonomyHelper.addTaxonomy(msg.data); + TaxonomyHelper.addTaxonomy(msg.payload); break; case DashboardMessage.createTaxonomy: - TaxonomyHelper.createNew(msg.data); + TaxonomyHelper.createNew(msg.payload); break; case DashboardMessage.importTaxonomy: commands.executeCommand(COMMAND_NAME.exportTaxonomy); diff --git a/src/listeners/dashboard/TelemetryListener.ts b/src/listeners/dashboard/TelemetryListener.ts index ad6df246..9d3cd93e 100644 --- a/src/listeners/dashboard/TelemetryListener.ts +++ b/src/listeners/dashboard/TelemetryListener.ts @@ -1,5 +1,6 @@ import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { Telemetry } from '../../helpers/Telemetry'; +import { PostMessageData } from '../../models'; import { BaseListener } from './BaseListener'; export class TelemetryListener extends BaseListener { @@ -7,12 +8,12 @@ export class TelemetryListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: DashboardMessage; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { case DashboardMessage.sendTelemetry: - Telemetry.send(msg.data.event, msg.data.properties, msg.data.metrics); + Telemetry.send(msg.payload.event, msg.payload.properties, msg.payload.metrics); break; } } diff --git a/src/listeners/general/BaseListener.ts b/src/listeners/general/BaseListener.ts index 8a963c65..fa1364ed 100644 --- a/src/listeners/general/BaseListener.ts +++ b/src/listeners/general/BaseListener.ts @@ -1,18 +1,17 @@ import { GeneralCommands } from './../../constants/GeneralCommands'; import { Dashboard } from '../../commands/Dashboard'; -import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { ExplorerView } from '../../explorerView/ExplorerView'; import { Extension } from '../../helpers'; import { Logger } from '../../helpers/Logger'; -import { CommandToCode } from '../../panelWebView/CommandToCode'; import { commands, Uri } from 'vscode'; +import { PostMessageData } from '../../models'; export abstract class BaseListener { - public static process(msg: { command: DashboardMessage | CommandToCode | string; data: any }) { + public static process(msg: PostMessageData) { switch (msg.command) { case GeneralCommands.toVSCode.openLink: - if (msg.data) { - commands.executeCommand('vscode.open', Uri.parse(msg.data)); + if (msg.payload) { + commands.executeCommand('vscode.open', Uri.parse(msg.payload)); } break; } @@ -23,14 +22,14 @@ export abstract class BaseListener { * @param command * @param data */ - public static sendMsg(command: string, data: any) { + public static sendMsg(command: string, payload: any) { Logger.info(`Sending message to webview (panel&dashboard): ${command}`); const extPath = Extension.getInstance().extensionPath; const panel = ExplorerView.getInstance(extPath); - panel.sendMessage({ command: command as any, data }); + panel.sendMessage({ command: command as any, payload }); - Dashboard.postWebviewMessage({ command: command as any, data }); + Dashboard.postWebviewMessage({ command: command as any, payload }); } } diff --git a/src/listeners/general/GitListener.ts b/src/listeners/general/GitListener.ts index c204187d..fa4da68b 100644 --- a/src/listeners/general/GitListener.ts +++ b/src/listeners/general/GitListener.ts @@ -20,6 +20,7 @@ import { } from '../../constants'; import { Folders } from '../../commands/Folders'; import { commands } from 'vscode'; +import { PostMessageData } from '../../models'; export class GitListener { private static isRegistered: boolean = false; @@ -49,7 +50,7 @@ export class GitListener { * Process the messages * @param msg */ - public static process(msg: { command: string; data: any }) { + public static process(msg: PostMessageData) { switch (msg.command) { case GeneralCommands.toVSCode.gitSync: this.sync(); @@ -148,12 +149,12 @@ export class GitListener { return this.client; } - private static sendMsg(command: string, data: any) { + private static sendMsg(command: string, payload: any) { const extPath = Extension.getInstance().extensionPath; const panel = ExplorerView.getInstance(extPath); - panel.sendMessage({ command: command as any, data }); + panel.sendMessage({ command: command as any, payload }); - Dashboard.postWebviewMessage({ command: command as any, data }); + Dashboard.postWebviewMessage({ command: command as any, payload }); } } diff --git a/src/listeners/general/ModeListener.ts b/src/listeners/general/ModeListener.ts index 0e7b3cc3..53a375e0 100644 --- a/src/listeners/general/ModeListener.ts +++ b/src/listeners/general/ModeListener.ts @@ -1,7 +1,7 @@ import { ModeSwitch } from './../../services/ModeSwitch'; import { CONTEXT, FEATURE_FLAG, GeneralCommands, SETTING_GLOBAL_MODES } from '../../constants'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; -import { Mode } from '../../models'; +import { Mode, PostMessageData } from '../../models'; import { CommandToCode } from '../../panelWebView/CommandToCode'; import { BaseListener } from './BaseListener'; import { Settings } from '../../helpers'; @@ -12,7 +12,7 @@ export class ModeListener extends BaseListener { * Process the messages * @param msg */ - public static process(msg: { command: DashboardMessage | CommandToCode; data: any }) { + public static process(msg: PostMessageData) { super.process(msg as any); switch (msg.command) { diff --git a/src/listeners/panel/ArticleListener.ts b/src/listeners/panel/ArticleListener.ts index df1ed126..4c6cbd47 100644 --- a/src/listeners/panel/ArticleListener.ts +++ b/src/listeners/panel/ArticleListener.ts @@ -1,4 +1,5 @@ import { Article } from '../../commands'; +import { PostMessageData } from '../../models'; import { Command } from '../../panelWebView/Command'; import { CommandToCode } from '../../panelWebView/CommandToCode'; import { BaseListener } from './BaseListener'; @@ -8,7 +9,7 @@ export class ArticleListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: any; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -16,7 +17,7 @@ export class ArticleListener extends BaseListener { Article.updateSlug(); break; case CommandToCode.generateSlug: - this.generateSlug(msg.data); + this.generateSlug(msg.payload); break; case CommandToCode.updateLastMod: Article.setLastModifiedDate(); diff --git a/src/listeners/panel/BaseListener.ts b/src/listeners/panel/BaseListener.ts index 7d38ea8d..f1757953 100644 --- a/src/listeners/panel/BaseListener.ts +++ b/src/listeners/panel/BaseListener.ts @@ -1,18 +1,18 @@ import { Extension } from './../../helpers/Extension'; import { ExplorerView } from './../../explorerView/ExplorerView'; import { Logger } from '../../helpers'; -import { CommandToCode } from '../../panelWebView/CommandToCode'; import { Command } from '../../panelWebView/Command'; +import { PostMessageData } from '../../models'; export abstract class BaseListener { - public static process(msg: { command: CommandToCode; data: any }) {} + public static process(msg: PostMessageData) {} /** * Send a message to the webview * @param command * @param data */ - public static sendMsg(command: Command, data: any) { + public static sendMsg(command: Command, payload: any) { Logger.info(`Sending message to panel: ${command}`); const extPath = Extension.getInstance().extensionPath; @@ -20,7 +20,7 @@ export abstract class BaseListener { panel.sendMessage({ command, - data + payload }); } } diff --git a/src/listeners/panel/DataListener.ts b/src/listeners/panel/DataListener.ts index a2905851..f3a17743 100644 --- a/src/listeners/panel/DataListener.ts +++ b/src/listeners/panel/DataListener.ts @@ -17,6 +17,7 @@ import { import { Article } from '../../commands'; import { ParsedFrontMatter } from '../../parsers'; import { processKnownPlaceholders } from '../../helpers/PlaceholderHelper'; +import { PostMessageData } from '../../models'; const FILE_LIMIT = 10; @@ -28,7 +29,7 @@ export class DataListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: CommandToCode; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -43,16 +44,16 @@ export class DataListener extends BaseListener { commands.executeCommand(COMMAND_NAME.createTemplate); break; case CommandToCode.updateMetadata: - this.updateMetadata(msg.data); + this.updateMetadata(msg.payload); break; case CommandToCode.frameworkCommand: - this.openTerminalWithCommand(msg.data.command); + this.openTerminalWithCommand(msg.payload.command); break; case CommandToCode.stopServer: this.stopServer(); break; case CommandToCode.updatePlaceholder: - this.updatePlaceholder(msg?.data?.field, msg?.data?.value, msg?.data?.title); + this.updatePlaceholder(msg?.payload?.field, msg?.payload?.value, msg?.payload?.title); break; case CommandToCode.generateContentType: commands.executeCommand(COMMAND_NAME.generateContentType); @@ -64,7 +65,7 @@ export class DataListener extends BaseListener { commands.executeCommand(COMMAND_NAME.setContentType); break; case CommandToCode.getDataEntries: - this.getDataFileEntries(msg.data); + this.getDataFileEntries(msg.payload); break; } } diff --git a/src/listeners/panel/ExtensionListener.ts b/src/listeners/panel/ExtensionListener.ts index fd63f1dc..bdfdecae 100644 --- a/src/listeners/panel/ExtensionListener.ts +++ b/src/listeners/panel/ExtensionListener.ts @@ -5,15 +5,15 @@ import * as os from 'os'; import { exec } from 'child_process'; import { Folders } from '../../commands/Folders'; import { COMMAND_NAME } from '../../constants'; -import { SettingsListener } from '.'; import { openFileInEditor } from '../../helpers'; +import { PostMessageData } from '../../models'; export class ExtensionListener extends BaseListener { /** * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: any; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -24,7 +24,7 @@ export class ExtensionListener extends BaseListener { this.openFolder(); break; case CommandToCode.openInEditor: - openFileInEditor(msg.data); + openFileInEditor(msg.payload); break; case CommandToCode.initProject: this.initialize(); diff --git a/src/listeners/panel/MediaListener.ts b/src/listeners/panel/MediaListener.ts index 98046cc3..c663b818 100644 --- a/src/listeners/panel/MediaListener.ts +++ b/src/listeners/panel/MediaListener.ts @@ -3,7 +3,7 @@ import { commands, window } from 'vscode'; import { Dashboard } from '../../commands/Dashboard'; import { COMMAND_NAME } from '../../constants'; import { ImageHelper } from '../../helpers'; -import { DashboardData } from '../../models'; +import { DashboardData, PostMessageData } from '../../models'; import { Command } from '../../panelWebView/Command'; import { CommandToCode } from '../../panelWebView/CommandToCode'; import { BaseListener } from './BaseListener'; @@ -13,7 +13,7 @@ export class MediaListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: any; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -24,7 +24,7 @@ export class MediaListener extends BaseListener { this.selectMedia(msg); break; case CommandToCode.getImageUrl: - this.generateUrl(msg.data); + this.generateUrl(msg.payload); break; } } @@ -47,10 +47,10 @@ export class MediaListener extends BaseListener { /** * Select a media file */ - private static async selectMedia(msg: { data: any }) { + private static async selectMedia(msg: PostMessageData) { await commands.executeCommand(COMMAND_NAME.dashboard, { type: 'media', - data: msg.data + data: msg.payload } as DashboardData); this.getMediaSelection(); } diff --git a/src/listeners/panel/ScriptListener.ts b/src/listeners/panel/ScriptListener.ts index 715b2e26..e80c47c8 100644 --- a/src/listeners/panel/ScriptListener.ts +++ b/src/listeners/panel/ScriptListener.ts @@ -1,6 +1,6 @@ import { SETTING_CUSTOM_SCRIPTS } from '../../constants'; import { CustomScript, Settings } from '../../helpers'; -import { CustomScript as ICustomScript } from '../../models'; +import { CustomScript as ICustomScript, PostMessageData } from '../../models'; import { CommandToCode } from '../../panelWebView/CommandToCode'; import { BaseListener } from './BaseListener'; @@ -9,7 +9,7 @@ export class ScriptListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: any; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -23,11 +23,11 @@ export class ScriptListener extends BaseListener { * Run a custom script * @param msg */ - private static runCustomScript(msg: { command: string; data: any }) { + private static runCustomScript(msg: PostMessageData) { const scripts: ICustomScript[] | undefined = Settings.get(SETTING_CUSTOM_SCRIPTS); - if (msg?.data?.title && msg?.data?.script && scripts) { - const customScript = scripts.find((s: ICustomScript) => s.title === msg.data.title); + if (msg?.payload?.title && msg?.payload?.script && scripts) { + const customScript = scripts.find((s: ICustomScript) => s.title === msg.payload.title); if (customScript?.script && customScript?.title) { CustomScript.run(customScript); } diff --git a/src/listeners/panel/SettingsListener.ts b/src/listeners/panel/SettingsListener.ts index d07f04dd..ff3f0dea 100644 --- a/src/listeners/panel/SettingsListener.ts +++ b/src/listeners/panel/SettingsListener.ts @@ -9,6 +9,7 @@ import { } from '../../constants'; import { Extension, Settings } from '../../helpers'; import { PanelSettings } from '../../helpers/PanelSettings'; +import { PostMessageData } from '../../models'; import { Command } from '../../panelWebView/Command'; import { CommandToCode } from '../../panelWebView/CommandToCode'; import { BaseListener } from './BaseListener'; @@ -18,7 +19,7 @@ export class SettingsListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: CommandToCode; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { @@ -32,19 +33,19 @@ export class SettingsListener extends BaseListener { this.toggleWritingSettings(); break; case CommandToCode.updateModifiedUpdating: - this.updateSetting(SETTING_AUTO_UPDATE_DATE, msg.data || false); + this.updateSetting(SETTING_AUTO_UPDATE_DATE, msg.payload || false); break; case CommandToCode.updateFmHighlight: this.updateSetting( SETTING_CONTENT_FRONTMATTER_HIGHLIGHT, - msg.data !== null && msg.data !== undefined ? msg.data : false + msg.payload !== null && msg.payload !== undefined ? msg.payload : false ); break; case CommandToCode.updatePreviewUrl: - this.updateSetting(SETTING_PREVIEW_HOST, msg.data || ''); + this.updateSetting(SETTING_PREVIEW_HOST, msg.payload || ''); break; case CommandToCode.updateStartCommand: - this.updateSetting(SETTING_FRAMEWORK_START, msg.data || ''); + this.updateSetting(SETTING_FRAMEWORK_START, msg.payload || ''); break; } } diff --git a/src/listeners/panel/TaxonomyListener.ts b/src/listeners/panel/TaxonomyListener.ts index cfbe5b05..f22f286d 100644 --- a/src/listeners/panel/TaxonomyListener.ts +++ b/src/listeners/panel/TaxonomyListener.ts @@ -3,7 +3,7 @@ import { TagType } from '../../panelWebView/TagType'; import { BaseListener } from './BaseListener'; import { window } from 'vscode'; import { ArticleHelper, Settings } from '../../helpers'; -import { BlockFieldData, CustomTaxonomyData, TaxonomyType } from '../../models'; +import { BlockFieldData, CustomTaxonomyData, PostMessageData, TaxonomyType } from '../../models'; import { DataListener } from '.'; import { SETTING_TAXONOMY_CATEGORIES, SETTING_TAXONOMY_TAGS } from '../../constants'; @@ -12,45 +12,45 @@ export class TaxonomyListener extends BaseListener { * Process the messages for the dashboard views * @param msg */ - public static process(msg: { command: any; data: any }) { + public static process(msg: PostMessageData) { super.process(msg); switch (msg.command) { case CommandToCode.updateTags: this.updateTags( - msg.data?.fieldName, - msg.data?.values || [], - msg.data?.parents || [], - msg.data?.blockData + msg.payload?.fieldName, + msg.payload?.values || [], + msg.payload?.parents || [], + msg.payload?.blockData ); break; case CommandToCode.updateCategories: this.updateTags( - msg.data?.fieldName, - msg.data?.values || [], - msg.data?.parents || [], - msg.data?.blockData + msg.payload?.fieldName, + msg.payload?.values || [], + msg.payload?.parents || [], + msg.payload?.blockData ); break; case CommandToCode.updateKeywords: this.updateTags( TagType.keywords.toLowerCase(), - msg.data?.values || [], - msg.data?.parents || [], - msg.data?.blockData + msg.payload?.values || [], + msg.payload?.parents || [], + msg.payload?.blockData ); break; case CommandToCode.updateCustomTaxonomy: - this.updateCustomTaxonomy(msg.data); + this.updateCustomTaxonomy(msg.payload); break; case CommandToCode.addTagToSettings: - this.addTags(TagType.tags, msg.data); + this.addTags(TagType.tags, msg.payload); break; case CommandToCode.addCategoryToSettings: - this.addTags(TagType.categories, msg.data); + this.addTags(TagType.categories, msg.payload); break; case CommandToCode.addToCustomTaxonomy: - this.addCustomTaxonomy(msg.data); + this.addCustomTaxonomy(msg.payload); break; } } diff --git a/src/models/PostMessageData.ts b/src/models/PostMessageData.ts new file mode 100644 index 00000000..9fd0b412 --- /dev/null +++ b/src/models/PostMessageData.ts @@ -0,0 +1,5 @@ +export interface PostMessageData { + command: string; + payload: any; + requestId?: string +} \ No newline at end of file diff --git a/src/models/index.ts b/src/models/index.ts index f42a401f..9f7ec5cd 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -14,6 +14,7 @@ export * from './GitSettings'; export * from './MediaPaths'; export * from './Mode'; export * from './PanelSettings'; +export * from './PostMessageData'; export * from './Snippets'; export * from './SortOrder'; export * from './SortType'; diff --git a/src/panelWebView/components/Fields/DataFileField.tsx b/src/panelWebView/components/Fields/DataFileField.tsx index 3391ec56..28036169 100644 --- a/src/panelWebView/components/Fields/DataFileField.tsx +++ b/src/panelWebView/components/Fields/DataFileField.tsx @@ -38,10 +38,10 @@ export const DataFileField: React.FunctionComponent = ({ const dsRef = React.useRef | null>(null); const messageListener = (message: MessageEvent>) => { - const { command, data } = message.data; + const { command, payload } = message.data; if (command === Command.dataFileEntries) { - setDataEntries(data || null); + setDataEntries(payload || null); } }; @@ -179,18 +179,18 @@ export const DataFileField: React.FunctionComponent = ({ > {isOpen ? availableChoices.map((choice, index) => ( -
  • - {choice.title || ( - Clear value - )} -
  • - )) +
  • + {choice.title || ( + Clear value + )} +
  • + )) : null} @@ -205,21 +205,21 @@ export const DataFileField: React.FunctionComponent = ({ {crntSelected instanceof Array ? crntSelected.map((value: string) => ( - - )) + + )) : crntSelected && ( - - )} + + )} ); }; diff --git a/src/panelWebView/components/Fields/PreviewImage.tsx b/src/panelWebView/components/Fields/PreviewImage.tsx index 49cbdb41..029e3e61 100644 --- a/src/panelWebView/components/Fields/PreviewImage.tsx +++ b/src/panelWebView/components/Fields/PreviewImage.tsx @@ -21,9 +21,9 @@ export const PreviewImage: React.FunctionComponent = ({ const message = event.data; if (message.command === Command.sendMediaUrl) { - const data = message.data; - if (data?.original === value && data.url) { - setImgUrl(data.url); + const payload = message.payload; + if (payload?.original === value && payload.url) { + setImgUrl(payload.url); } } }; diff --git a/src/panelWebView/components/Fields/SlugField.tsx b/src/panelWebView/components/Fields/SlugField.tsx index cdf0e7c8..5dd3c762 100644 --- a/src/panelWebView/components/Fields/SlugField.tsx +++ b/src/panelWebView/components/Fields/SlugField.tsx @@ -38,9 +38,9 @@ export const SlugField: React.FunctionComponent = ({ const messageListener = useCallback( (message: MessageEvent>) => { - const { command, data } = message.data; + const { command, payload } = message.data; if (command === Command.updatedSlug) { - setSlug(data?.slugWithPrefixAndSuffix); + setSlug(payload?.slugWithPrefixAndSuffix); } }, [text] @@ -87,9 +87,8 @@ export const SlugField: React.FunctionComponent = ({ -
    +
    {draftField && draftField.name && } @@ -181,13 +187,13 @@ export const Item: React.FunctionComponent = ({ )}
    )} - - { - customHtml && ( -
    - ) - }
    + + { + customHtml && ( +
    + ) + }
    ); diff --git a/src/listeners/dashboard/PagesListener.ts b/src/listeners/dashboard/PagesListener.ts index bdca5746..b831c891 100644 --- a/src/listeners/dashboard/PagesListener.ts +++ b/src/listeners/dashboard/PagesListener.ts @@ -47,30 +47,9 @@ export class PagesListener extends BaseListener { case DashboardMessage.deleteFile: this.deletePage(msg.payload); break; - case DashboardMessage.getCustomHtml: - const message = msg as any; - this.getCustomCardHtml(message.command, message.requestId, message.payload); - break; } } - private static async getCustomCardHtml(command: string, requestId: string, payload: any) { - if (!command || !requestId || !payload) { - return; - } - - const slug = payload.data.slug; - if (!slug) { - return; - } - - Dashboard.postWebviewMessage({ - command, - requestId, - payload: `
    `, - } as any) - } - /** * Saved file watcher * @returns From 872487db4aa31ba317a8eb1e55968e440e3bedad Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sun, 26 Feb 2023 15:38:38 +0100 Subject: [PATCH 05/77] Added the UI scripts to experimental features --- CHANGELOG.md | 25 +++++++++++++++++++++++++ src/commands/Dashboard.ts | 21 ++++++++++++--------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd3a1b58..b190fc22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,32 @@ # Change Log +## [8.4.0] - 2022-xx-xx + +### ๐Ÿงช Experimental features + +- External UI script support for dashboards +- Visual Studio Code Theming support for the dashboards + +> **Info**: To enable the experimental features you need to set the `frontMatter.experimental` setting to `true`. + +### โœจ New features + +- [#513](https://github.com/estruyf/vscode-front-matter/issues/513): Added support for external UI scripts to add custom HTML on the dashboard elements + +### ๐ŸŽจ Enhancements + +### โšก๏ธ Optimizations + +### ๐Ÿž Fixes + ## [8.3.0] - 2022-02-14 - [Release notes](https://beta.frontmatter.codes/updates/v8.3.0) +### ๐Ÿงช Experimental features + +- Visual Studio Code Theming support for the dashboards + +> **Info**: To enable the experimental features you need to set the `frontMatter.experimental` setting to `true`. + ### โœจ New features - [#407](https://github.com/estruyf/vscode-front-matter/issues/407): External config support diff --git a/src/commands/Dashboard.ts b/src/commands/Dashboard.ts index af5141d9..69ff5d9b 100644 --- a/src/commands/Dashboard.ts +++ b/src/commands/Dashboard.ts @@ -232,13 +232,15 @@ export class Dashboard { const extensibilityScripts = SettingsHelper.get(SETTING_EXTENSIBILITY_SCRIPTS) || []; const scriptsToLoad: string[] = []; - for (const script of extensibilityScripts) { - if (script.startsWith('https://')) { - scriptsToLoad.push(script); - } else { - const absScriptPath = Folders.getAbsFilePath(script); - const scriptUri = webView.asWebviewUri(Uri.file(absScriptPath)); - scriptsToLoad.push(scriptUri.toString()); + if (experimental) { + for (const script of extensibilityScripts) { + if (script.startsWith('https://')) { + scriptsToLoad.push(script); + } else { + const absScriptPath = Folders.getAbsFilePath(script); + const scriptUri = webView.asWebviewUri(Uri.file(absScriptPath)); + scriptsToLoad.push(scriptUri.toString()); + } } } @@ -279,14 +281,15 @@ export class Dashboard { version.usedVersion ? '' : `data-showWelcome="true"` } ${experimental ? `data-experimental="${experimental}"` : ''} >
    - Daily usage - ${(scriptsToLoad || []) .map((script) => { return ``; }) .join('')} + + + Daily usage `; From cf6133b1434109868a2d13e278ab7699c8c3c7c1 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sun, 26 Feb 2023 15:38:50 +0100 Subject: [PATCH 06/77] 8.4.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9263dd4e..a7d9ba10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-front-matter-beta", - "version": "8.3.0", + "version": "8.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-front-matter-beta", - "version": "8.3.0", + "version": "8.4.0", "license": "MIT", "devDependencies": { "@actions/core": "^1.8.2", diff --git a/package.json b/package.json index de943543..63499c00 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Front Matter CMS", "description": "Front Matter is a CMS that runs within Visual Studio Code. It gives you the power and control of a full-blown CMS while also providing you the flexibility and speed of the static site generator of your choice like: Hugo, Jekyll, Docusaurus, NextJs, Gatsby, and many more...", "icon": "assets/frontmatter-teal-128x128.png", - "version": "8.3.0", + "version": "8.4.0", "preview": false, "publisher": "eliostruyf", "galleryBanner": { From 026bcd0a840799f775ceba8721de9348f21506c8 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Mon, 27 Feb 2023 17:37:16 +0100 Subject: [PATCH 07/77] #513 - support for custom field + panel view --- src/commands/Dashboard.ts | 6 +- .../components/Contents/Item.tsx | 9 --- src/dashboardWebView/index.tsx | 15 +++++ src/explorerView/ExplorerView.ts | 34 +++++++++-- src/models/CustomPanelViewResult.ts | 4 ++ src/models/index.ts | 1 + src/panelWebView/ViewPanel.tsx | 5 +- .../components/CustomView/CustomView.tsx | 43 ++++++++++++++ .../components/CustomView/index.ts | 1 + .../components/Fields/CustomField.tsx | 58 +++++++++++++++++++ .../components/Fields/WrapperField.tsx | 33 ++++++++++- src/panelWebView/components/Fields/index.ts | 3 +- 12 files changed, 191 insertions(+), 21 deletions(-) create mode 100644 src/models/CustomPanelViewResult.ts create mode 100644 src/panelWebView/components/CustomView/CustomView.tsx create mode 100644 src/panelWebView/components/CustomView/index.ts create mode 100644 src/panelWebView/components/Fields/CustomField.tsx diff --git a/src/commands/Dashboard.ts b/src/commands/Dashboard.ts index 69ff5d9b..44f4a2d0 100644 --- a/src/commands/Dashboard.ts +++ b/src/commands/Dashboard.ts @@ -254,10 +254,10 @@ export class Dashboard { } 'self' 'unsafe-inline' https://*`, `script-src ${ isProd ? `'nonce-${nonce}'` : `http://${localServerUrl} http://0.0.0.0:${localPort}` - } https://* 'unsafe-eval'`, - `style-src ${webView.cspSource} 'self' 'unsafe-inline'`, + } 'unsafe-eval' https://*`, + `style-src ${webView.cspSource} 'self' 'unsafe-inline' https://*`, `font-src ${webView.cspSource}`, - `connect-src https://o1022172.ingest.sentry.io ${ + `connect-src https://o1022172.ingest.sentry.io https://* ${ isProd ? `` : `ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}` diff --git a/src/dashboardWebView/components/Contents/Item.tsx b/src/dashboardWebView/components/Contents/Item.tsx index 5a4e91ce..74f90686 100644 --- a/src/dashboardWebView/components/Contents/Item.tsx +++ b/src/dashboardWebView/components/Contents/Item.tsx @@ -17,15 +17,6 @@ export interface IItemProps extends Page { } const PREVIEW_IMAGE_FIELD = 'fmPreviewImage'; -declare global { - interface Window { - fmExternal: { - getCardImage(filePath: string, data: any): Promise; - getCardFooter: (filePath: string, data: any) => Promise; - } - } -} - export const Item: React.FunctionComponent = ({ fmFilePath, date, diff --git a/src/dashboardWebView/index.tsx b/src/dashboardWebView/index.tsx index 7fb30802..ff7b698e 100644 --- a/src/dashboardWebView/index.tsx +++ b/src/dashboardWebView/index.tsx @@ -9,6 +9,7 @@ import { MemoryRouter } from 'react-router-dom'; import './styles.css'; import { Preview } from './components/Preview'; import { SettingsProvider } from './providers/SettingsProvider'; +import { CustomPanelViewResult } from '../models'; declare const acquireVsCodeApi: () => { getState: () => T; @@ -16,6 +17,20 @@ declare const acquireVsCodeApi: () => { postMessage: (msg: unknown) => void; }; +declare global { + interface Window { + fmExternal: { + getCustomFields: { + name: string, + html: (data: any, change: (value: any) => void) => Promise + }[]; + getPanelView: (data: any) => Promise; + getCardImage: (filePath: string, data: any) => Promise; + getCardFooter: (filePath: string, data: any) => Promise; + } + } +} + export const routePaths: { [name: string]: string } = { welcome: '/welcome', contents: '/contents', diff --git a/src/explorerView/ExplorerView.ts b/src/explorerView/ExplorerView.ts index 0881ca90..5a0025a5 100644 --- a/src/explorerView/ExplorerView.ts +++ b/src/explorerView/ExplorerView.ts @@ -7,7 +7,7 @@ import { DataListener, SettingsListener } from './../listeners/panel'; -import { TelemetryEvent } from '../constants'; +import { SETTING_EXPERIMENTAL, SETTING_EXTENSIBILITY_SCRIPTS, TelemetryEvent } from '../constants'; import { CancellationToken, Disposable, @@ -25,6 +25,7 @@ import { WebviewHelper } from '@estruyf/vscode'; import { Extension } from '../helpers/Extension'; import { Telemetry } from '../helpers/Telemetry'; import { GitListener, ModeListener } from '../listeners/general'; +import { Folders } from '../commands'; export class ExplorerView implements WebviewViewProvider, Disposable { public static readonly viewType = 'frontMatter.explorer'; @@ -201,17 +202,34 @@ export class ExplorerView implements WebviewViewProvider, Disposable { scriptUri = `http://${localServerUrl}/${dashboardFile}`; } + // Get experimental setting + const experimental = Settings.get(SETTING_EXPERIMENTAL); + const extensibilityScripts = Settings.get(SETTING_EXTENSIBILITY_SCRIPTS) || []; + + const scriptsToLoad: string[] = []; + if (experimental) { + for (const script of extensibilityScripts) { + if (script.startsWith('https://')) { + scriptsToLoad.push(script); + } else { + const absScriptPath = Folders.getAbsFilePath(script); + const scriptUri = webView.asWebviewUri(Uri.file(absScriptPath)); + scriptsToLoad.push(scriptUri.toString()); + } + } + } + const csp = [ `default-src 'none';`, `img-src ${`vscode-file://vscode-app`} ${ webView.cspSource } https://api.visitorbadge.io 'self' 'unsafe-inline' https://*`, - `script-src 'unsafe-eval' ${ + `script-src 'unsafe-eval' https://* ${ isProd ? `'nonce-${nonce}'` : `http://${localServerUrl} http://0.0.0.0:${localPort}` }`, - `style-src ${webView.cspSource} 'self' 'unsafe-inline'`, + `style-src ${webView.cspSource} 'self' 'unsafe-inline' https://*`, `font-src ${webView.cspSource}`, - `connect-src https://o1022172.ingest.sentry.io ${ + `connect-src https://o1022172.ingest.sentry.io https://* ${ isProd ? `` : `ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}` @@ -235,9 +253,15 @@ export class ExplorerView implements WebviewViewProvider, Disposable { isBeta ? 'BETA' : 'main' }" data-version="${version.usedVersion}" >
    - Daily usage + ${(scriptsToLoad || []) + .map((script) => { + return ``; + }) + .join('')} + + Daily usage `; diff --git a/src/models/CustomPanelViewResult.ts b/src/models/CustomPanelViewResult.ts new file mode 100644 index 00000000..6d08317f --- /dev/null +++ b/src/models/CustomPanelViewResult.ts @@ -0,0 +1,4 @@ +export interface CustomPanelViewResult { + title: string; + content: string; +} diff --git a/src/models/index.ts b/src/models/index.ts index 9f7ec5cd..2f825d57 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -2,6 +2,7 @@ export * from './BaseFieldProps'; export * from './BlockFieldData'; export * from './Choice'; export * from './ContentFolder'; +export * from './CustomPanelViewResult'; export * from './CustomPlaceholder'; export * from './CustomTaxonomyData'; export * from './DashboardData'; diff --git a/src/panelWebView/ViewPanel.tsx b/src/panelWebView/ViewPanel.tsx index b3da7c48..9357bdba 100644 --- a/src/panelWebView/ViewPanel.tsx +++ b/src/panelWebView/ViewPanel.tsx @@ -12,11 +12,12 @@ import useMessages from './hooks/useMessages'; import { FeatureFlag } from '../components/features/FeatureFlag'; import { FEATURE_FLAG } from '../constants/Features'; import { GitAction } from './components/Git/GitAction'; +import { CustomView } from './components/CustomView'; export interface IViewPanelProps { } export const ViewPanel: React.FunctionComponent = ( - props: React.PropsWithChildren + { }: React.PropsWithChildren ) => { const { loading, @@ -50,6 +51,8 @@ export const ViewPanel: React.FunctionComponent = (
    + + diff --git a/src/panelWebView/components/CustomView/CustomView.tsx b/src/panelWebView/components/CustomView/CustomView.tsx new file mode 100644 index 00000000..7bdbce76 --- /dev/null +++ b/src/panelWebView/components/CustomView/CustomView.tsx @@ -0,0 +1,43 @@ +import * as React from 'react'; +import { useEffect, useState } from 'react'; +import { CustomPanelViewResult } from '../../../models'; +import { Collapsible } from '../Collapsible'; + +export interface ICustomViewProps { + metadata: any; +} + +export const CustomView: React.FunctionComponent = ({ metadata }: React.PropsWithChildren) => { + const [customViewTitle, setCustomViewTitle] = useState(undefined); + const [customHtml, setCustomHtml] = useState(undefined); + + useEffect(() => { + console.log(window.fmExternal) + if (window.fmExternal && window.fmExternal.getPanelView) { + window.fmExternal.getPanelView(metadata).then((viewDetails: CustomPanelViewResult | undefined) => { + if (viewDetails && viewDetails.title && viewDetails.content) { + setCustomViewTitle(viewDetails.title); + setCustomHtml(viewDetails.content); + } else { + setCustomViewTitle(undefined); + setCustomHtml(undefined); + } + }); + } + }, []); + + if (!customHtml || !customViewTitle) { + return null; + } + + + return ( + +
    + + ); +}; \ No newline at end of file diff --git a/src/panelWebView/components/CustomView/index.ts b/src/panelWebView/components/CustomView/index.ts new file mode 100644 index 00000000..2a6f5aed --- /dev/null +++ b/src/panelWebView/components/CustomView/index.ts @@ -0,0 +1 @@ +export * from './CustomView'; diff --git a/src/panelWebView/components/Fields/CustomField.tsx b/src/panelWebView/components/Fields/CustomField.tsx new file mode 100644 index 00000000..19cf3a2c --- /dev/null +++ b/src/panelWebView/components/Fields/CustomField.tsx @@ -0,0 +1,58 @@ +import { CodeIcon } from '@heroicons/react/outline'; +import * as React from 'react'; +import { useEffect, useMemo, useState } from 'react'; +import { BaseFieldProps, CustomPanelViewResult } from '../../../models'; +import { FieldMessage } from './FieldMessage'; +import { FieldTitle } from './FieldTitle'; + +export interface ICustomFieldProps extends BaseFieldProps { + fieldData: { + name: string, + html: (data: any, onChange: (value: any) => void) => Promise, + }; + onChange: (value: any) => void; +} + +export const CustomField: React.FunctionComponent = ({ label, value, required, description, fieldData, onChange }: React.PropsWithChildren) => { + const [customHtml, setCustomHtml] = useState(null); + + const internalChange = (newValue: any) => { + onChange(newValue); + }; + + const showRequiredState = useMemo(() => { + return required && !value; + }, [required, value]); + + useEffect(() => { + if (fieldData.html) { + fieldData.html(value, internalChange).then((data) => { + if (data) { + setCustomHtml(data); + } else { + setCustomHtml(null); + } + }); + } + }, [fieldData, value]); + + if (!customHtml) { + return null; + } + + return ( +
    + } required={required} /> + +
    +
    +
    + + +
    + ); +}; \ No newline at end of file diff --git a/src/panelWebView/components/Fields/WrapperField.tsx b/src/panelWebView/components/Fields/WrapperField.tsx index eaea04a4..b4549f43 100644 --- a/src/panelWebView/components/Fields/WrapperField.tsx +++ b/src/panelWebView/components/Fields/WrapperField.tsx @@ -2,7 +2,7 @@ import { Messenger } from '@estruyf/vscode/dist/client'; import * as React from 'react'; import { useCallback, useEffect, useState } from 'react'; import { DateHelper } from '../../../helpers/DateHelper'; -import { BlockFieldData, Field, PanelSettings, WhenOperator } from '../../../models'; +import { BlockFieldData, CustomPanelViewResult, Field, PanelSettings, WhenOperator } from '../../../models'; import { Command } from '../../Command'; import { CommandToCode } from '../../CommandToCode'; import { TagType } from '../../TagType'; @@ -26,7 +26,8 @@ import { SlugField, PreviewImageField, PreviewImageValue, - NumberField + NumberField, + CustomField } from '.'; import { fieldWhenClause } from '../../../utils/fieldWhenClause'; @@ -65,6 +66,10 @@ export const WrapperField: React.FunctionComponent = ({ renderFields }: React.PropsWithChildren) => { const [fieldValue, setFieldValue] = useState(undefined); + const [customFields, setCustomFields] = useState<{ + name: string; + html: (data: any, onChange: (value: any) => void) => Promise; + }[]>([]); const listener = useCallback( (event: any) => { @@ -132,6 +137,14 @@ export const WrapperField: React.FunctionComponent = ({ }; }, [field, parent]); + useEffect(() => { + if (window.fmExternal && window.fmExternal.getCustomFields) { + setCustomFields(window.fmExternal.getCustomFields || []); + } else { + setCustomFields([]); + } + }, []); + if (field.hidden || fieldValue === undefined) { return null; } @@ -470,6 +483,22 @@ export const WrapperField: React.FunctionComponent = ({ /> ); + } else if (customFields.find(f => f.name === field.type)) { + const fieldData = customFields.find(f => f.name === field.type); + if (fieldData) { + return ( + onSendUpdate(field.name, value, parentFields)} + fieldData={fieldData} /> + ); + } else { + return null; + } } else { console.warn(`Unknown field type: ${field.type}`); return null; diff --git a/src/panelWebView/components/Fields/index.ts b/src/panelWebView/components/Fields/index.ts index 8c862ee8..d4a6fd60 100644 --- a/src/panelWebView/components/Fields/index.ts +++ b/src/panelWebView/components/Fields/index.ts @@ -1,8 +1,10 @@ export * from './ChoiceButton'; export * from './ChoiceField'; +export * from './CustomField'; export * from './DataFileField'; export * from './DateTimeField'; export * from './DraftField'; +export * from './FieldMessage'; export * from './FieldTitle'; export * from './FileField'; export * from './ImageFallback'; @@ -11,7 +13,6 @@ export * from './NumberField'; export * from './PreviewImage'; export * from './PreviewImageField'; export * from './RequiredAsterix'; -export * from './FieldMessage'; export * from './SlugField'; export * from './TextField'; export * from './Toggle'; From 8bc63a48a0861e58999a766094a7aa940d9c7f84 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Tue, 28 Feb 2023 12:49:03 +0100 Subject: [PATCH 08/77] #513 - devmode for ext --- src/commands/Dashboard.ts | 3 ++- src/dashboardWebView/components/App.tsx | 27 +++++++++++++++++++++++-- src/dashboardWebView/index.tsx | 1 + src/panelWebView/ViewPanel.tsx | 22 ++++++++++++++++++++ src/panelWebView/styles.css | 21 +++++++++++++++++++ 5 files changed, 71 insertions(+), 3 deletions(-) diff --git a/src/commands/Dashboard.ts b/src/commands/Dashboard.ts index 44f4a2d0..218eff00 100644 --- a/src/commands/Dashboard.ts +++ b/src/commands/Dashboard.ts @@ -121,7 +121,8 @@ export class Dashboard { ViewColumn.One, { enableScripts: true, - retainContextWhenHidden: true + retainContextWhenHidden: true, + enableCommandUris: true } ); diff --git a/src/dashboardWebView/components/App.tsx b/src/dashboardWebView/components/App.tsx index d9719a83..4475555f 100644 --- a/src/dashboardWebView/components/App.tsx +++ b/src/dashboardWebView/components/App.tsx @@ -14,7 +14,7 @@ import { Messenger } from '@estruyf/vscode/dist/client'; import { TaxonomyView } from './TaxonomyView'; import { Route, Routes, useNavigate } from 'react-router-dom'; import { routePaths } from '..'; -import { useEffect, useMemo } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { UnknownView } from './UnknownView'; import { ErrorBoundary } from '@sentry/react'; import { ErrorView } from './ErrorView'; @@ -30,6 +30,7 @@ export const App: React.FunctionComponent = ({ const { loading, pages, settings } = useMessages(); const view = useRecoilValue(DashboardViewSelector); const mode = useRecoilValue(ModeAtom); + const [isDevMode, setIsDevMode] = useState(false); const navigate = useNavigate(); useDarkMode(); @@ -60,6 +61,13 @@ export const App: React.FunctionComponent = ({ navigate(routePaths[view]); }, [view]); + useEffect(() => { + console.log(window.fmExternal) + if (window.fmExternal.isDevelopment) { + setIsDevMode(true); + } + }, []); + if (!settings) { return ; } @@ -86,6 +94,21 @@ Stack: ${componentStack}` }} >
    + { + isDevMode && ( +
    + Development mode + + + Reload + +
    + ) + } + } /> } />
    - + ); }; diff --git a/src/dashboardWebView/index.tsx b/src/dashboardWebView/index.tsx index ff7b698e..c7655d8b 100644 --- a/src/dashboardWebView/index.tsx +++ b/src/dashboardWebView/index.tsx @@ -20,6 +20,7 @@ declare const acquireVsCodeApi: () => { declare global { interface Window { fmExternal: { + isDevelopment: boolean; getCustomFields: { name: string, html: (data: any, change: (value: any) => void) => Promise diff --git a/src/panelWebView/ViewPanel.tsx b/src/panelWebView/ViewPanel.tsx index 9357bdba..9f749f13 100644 --- a/src/panelWebView/ViewPanel.tsx +++ b/src/panelWebView/ViewPanel.tsx @@ -13,12 +13,14 @@ import { FeatureFlag } from '../components/features/FeatureFlag'; import { FEATURE_FLAG } from '../constants/Features'; import { GitAction } from './components/Git/GitAction'; import { CustomView } from './components/CustomView'; +import { useEffect, useState } from 'react'; export interface IViewPanelProps { } export const ViewPanel: React.FunctionComponent = ( { }: React.PropsWithChildren ) => { + const [isDevMode, setIsDevMode] = useState(false); const { loading, mediaSelecting, @@ -30,6 +32,13 @@ export const ViewPanel: React.FunctionComponent = ( mode } = useMessages(); + useEffect(() => { + console.log(window.fmExternal) + if (window.fmExternal.isDevelopment) { + setIsDevMode(true); + } + }, []); + if (mediaSelecting) { return (
    @@ -48,6 +57,19 @@ export const ViewPanel: React.FunctionComponent = ( return (
    + { + isDevMode && ( + + ) + } +
    diff --git a/src/panelWebView/styles.css b/src/panelWebView/styles.css index 78348027..732e179c 100644 --- a/src/panelWebView/styles.css +++ b/src/panelWebView/styles.css @@ -1010,3 +1010,24 @@ vscode-divider { .ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill { fill: var(--vscode-button-background) !important; } + +/* Extensibility Developer Bar */ +.developer__bar { + background: var(--vscode-statusBar-debuggingBackground); + position: relative; + padding: 5px 15px; + display: flex; + align-items: center; + justify-content: center; + + a { + color: var(--vscode-statusBar-debuggingForeground); + + &:hover, + &:focus { + color: var(--vscode-statusBarItem-hoverForeground); + background: var(--vscode-statusBarItem-hoverBackground); + outline: none; + } + } +} From cbeda07d259c20722d275c0433486d8406ff32f4 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Tue, 28 Feb 2023 14:45:18 +0100 Subject: [PATCH 09/77] #513 - Added devtools command --- src/dashboardWebView/components/App.tsx | 8 +++++++- src/panelWebView/ViewPanel.tsx | 6 ++++++ src/panelWebView/styles.css | 5 ++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/dashboardWebView/components/App.tsx b/src/dashboardWebView/components/App.tsx index 4475555f..a3e182d4 100644 --- a/src/dashboardWebView/components/App.tsx +++ b/src/dashboardWebView/components/App.tsx @@ -100,11 +100,17 @@ Stack: ${componentStack}` Development mode Reload + + DevTools +
    ) } diff --git a/src/panelWebView/ViewPanel.tsx b/src/panelWebView/ViewPanel.tsx index 9f749f13..ccf4f2e9 100644 --- a/src/panelWebView/ViewPanel.tsx +++ b/src/panelWebView/ViewPanel.tsx @@ -66,6 +66,12 @@ export const ViewPanel: React.FunctionComponent = ( title="Reload the dashboard"> Reload + + DevTools +
    ) } diff --git a/src/panelWebView/styles.css b/src/panelWebView/styles.css index 732e179c..4bce5816 100644 --- a/src/panelWebView/styles.css +++ b/src/panelWebView/styles.css @@ -1022,10 +1022,13 @@ vscode-divider { a { color: var(--vscode-statusBar-debuggingForeground); + margin: 0 0.25em; + padding: 0 0.25em; + text-decoration: none; &:hover, &:focus { - color: var(--vscode-statusBarItem-hoverForeground); + color: var(--vscode-statusBar-debuggingForeground); background: var(--vscode-statusBarItem-hoverBackground); outline: none; } From cf29121bc0cc0062b77b0b8280b643655f6a8861 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Tue, 28 Feb 2023 19:33:57 +0100 Subject: [PATCH 10/77] Fix isDevelopment check --- src/dashboardWebView/components/App.tsx | 3 +-- src/panelWebView/ViewPanel.tsx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/dashboardWebView/components/App.tsx b/src/dashboardWebView/components/App.tsx index a3e182d4..685e7b0f 100644 --- a/src/dashboardWebView/components/App.tsx +++ b/src/dashboardWebView/components/App.tsx @@ -62,8 +62,7 @@ export const App: React.FunctionComponent = ({ }, [view]); useEffect(() => { - console.log(window.fmExternal) - if (window.fmExternal.isDevelopment) { + if (window.fmExternal && window.fmExternal.isDevelopment) { setIsDevMode(true); } }, []); diff --git a/src/panelWebView/ViewPanel.tsx b/src/panelWebView/ViewPanel.tsx index ccf4f2e9..f3351adc 100644 --- a/src/panelWebView/ViewPanel.tsx +++ b/src/panelWebView/ViewPanel.tsx @@ -33,8 +33,7 @@ export const ViewPanel: React.FunctionComponent = ( } = useMessages(); useEffect(() => { - console.log(window.fmExternal) - if (window.fmExternal.isDevelopment) { + if (window.fmExternal && window.fmExternal.isDevelopment) { setIsDevMode(true); } }, []); From 3b0ea3132cee067ec19dcc3f1ca437cd859fd932 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 2 Mar 2023 11:50:24 +0100 Subject: [PATCH 11/77] #518: Fix YAML parser --- CHANGELOG.md | 2 ++ src/helpers/ArticleHelper.ts | 2 +- src/parsers/ParserEngines.ts | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b190fc22..75835f5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ ### ๐Ÿž Fixes +- [#518](https://github.com/estruyf/vscode-front-matter/issues/518): Fix an issue where the `YAML` parser adds line breaks to long strings + ## [8.3.0] - 2022-02-14 - [Release notes](https://beta.frontmatter.codes/updates/v8.3.0) ### ๐Ÿงช Experimental features diff --git a/src/helpers/ArticleHelper.ts b/src/helpers/ArticleHelper.ts index 11d045a3..46624367 100644 --- a/src/helpers/ArticleHelper.ts +++ b/src/helpers/ArticleHelper.ts @@ -203,7 +203,7 @@ export class ArticleHelper { noArrayIndent: !indentArray, skipInvalid: true, noCompatMode: true, - lineWidth: 500, + lineWidth: 50000, indent: spaces || 2 } as DumpOptions as any); } diff --git a/src/parsers/ParserEngines.ts b/src/parsers/ParserEngines.ts index d8b82ce9..6003ce49 100644 --- a/src/parsers/ParserEngines.ts +++ b/src/parsers/ParserEngines.ts @@ -1,4 +1,5 @@ import * as yaml from 'yaml'; +import * as jsyaml from 'js-yaml'; import * as toml from '@iarna/toml'; import { Format, FrontMatterParser } from '.'; @@ -48,11 +49,12 @@ export const Engines = { } } - return docYaml.toString(); + const jsonObj = docYaml.toJSON(); + return jsyaml.dump(jsonObj, options); } } - return yaml.stringify(obj, options); + return jsyaml.dump(obj, options); } } } From 4ffcd76aac0440b9e1825176c7285dc85afde2d7 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 2 Mar 2023 11:51:05 +0100 Subject: [PATCH 12/77] Remove log --- src/panelWebView/components/CustomView/CustomView.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/panelWebView/components/CustomView/CustomView.tsx b/src/panelWebView/components/CustomView/CustomView.tsx index 7bdbce76..9ac0bf73 100644 --- a/src/panelWebView/components/CustomView/CustomView.tsx +++ b/src/panelWebView/components/CustomView/CustomView.tsx @@ -12,7 +12,6 @@ export const CustomView: React.FunctionComponent = ({ metadata const [customHtml, setCustomHtml] = useState(undefined); useEffect(() => { - console.log(window.fmExternal) if (window.fmExternal && window.fmExternal.getPanelView) { window.fmExternal.getPanelView(metadata).then((viewDetails: CustomPanelViewResult | undefined) => { if (viewDetails && viewDetails.title && viewDetails.content) { From cae62232c6612de5b6f53e9a130d1da9d20b7ad8 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 2 Mar 2023 21:22:41 +0100 Subject: [PATCH 13/77] Fix panel alignment --- assets/media/styles.css | 76 ++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/assets/media/styles.css b/assets/media/styles.css index f9c9f15c..d8e8f4a1 100644 --- a/assets/media/styles.css +++ b/assets/media/styles.css @@ -33,8 +33,12 @@ position: inherit !important; } -.z-10 { z-index: 10 !important; } -.z-20 { z-index: 10 !important; } +.z-10 { + z-index: 10 !important; +} +.z-20 { + z-index: 10 !important; +} .w-full { width: 100% !important; @@ -44,11 +48,12 @@ .ext_settings, .git_actions, .initialize_actions { - padding: 1rem 1.25rem; + padding: 1rem 1.25rem; box-sizing: border-box; } -#app, .frontmatter { +#app, +.frontmatter { height: 100%; } @@ -58,7 +63,7 @@ align-items: center; opacity: 0.8; text-align: center; - padding: 1rem 1.25rem; + padding: 1rem 1.25rem; } .spinner, @@ -103,7 +108,7 @@ padding-bottom: var(--input-margin-vertical); display: flex; flex-direction: column; - justify-content: space-between; + justify-content: start; } .frontmatter h3 { @@ -113,7 +118,7 @@ .frontmatter p, .frontmatter h4, .frontmatter ul { - margin-bottom: .5rem; + margin-bottom: 0.5rem; } .article__tags h3, @@ -131,7 +136,8 @@ margin-right: 0.5rem; } -.seo__status__details, .seo__status__keywords { +.seo__status__details, +.seo__status__keywords { margin-bottom: 1rem; } @@ -162,11 +168,11 @@ } .article__tags__dropbox.open { - border: 1px solid rgba(0, 0, 0, .9); + border: 1px solid rgba(0, 0, 0, 0.9); } .article__tags ul { - color: var(--vscode-dropdown-foreground); + color: var(--vscode-dropdown-foreground); background-color: var(--vscode-dropdown-background); } @@ -176,16 +182,16 @@ } .article__tags li:active { - color: var(--vscode-button-foreground); + color: var(--vscode-button-foreground); background-color: var(--vscode-button-background); } -.article__tags li[aria-selected="true"] { +.article__tags li[aria-selected='true'] { color: var(--vscode-button-foreground); background-color: var(--vscode-button-hoverBackground); } -.article__tags li[aria-disabled="true"] { +.article__tags li[aria-disabled='true'] { display: none; } @@ -224,7 +230,7 @@ } .ext_link_block svg { - margin-right: .5rem; + margin-right: 0.5rem; display: block; width: 16px; height: 16px; @@ -258,16 +264,16 @@ } .ext_link_block button.active { - color: var(--vscode-button-foreground); - background: var(--vscode-button-background); + color: var(--vscode-button-foreground); + background: var(--vscode-button-background); } .ext_link_block button.active:hover { - cursor: pointer; - background: var(--vscode-button-hoverBackground); + cursor: pointer; + background: var(--vscode-button-hoverBackground); } -.ext_link_block a:hover, -.ext_link_block a:active, +.ext_link_block a:hover, +.ext_link_block a:active, .ext_link_block a:focus, .ext_link_block a:visited { color: var(--vscode-button-secondaryForeground); @@ -301,15 +307,15 @@ } .table__cell__validation .valid { - color: #46EC86; + color: #46ec86; } .table__cell__validation .warning { - color: #E6AF2E; + color: #e6af2e; } .table__cell__validation div span + span { - margin-left: .5rem; + margin-left: 0.5rem; } .seo__status__note { @@ -325,7 +331,7 @@ height: 24px; } -.field__toggle input { +.field__toggle input { opacity: 0; width: 0; height: 0; @@ -339,21 +345,21 @@ right: 0; bottom: 0; background-color: var(--vscode-button-secondaryBackground); - -webkit-transition: .4s; - transition: .4s; + -webkit-transition: 0.4s; + transition: 0.4s; border-radius: 34px; } .field__toggle__slider:before { position: absolute; - content: ""; + content: ''; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; - -webkit-transition: .4s; - transition: .4s; + -webkit-transition: 0.4s; + transition: 0.4s; border-radius: 50%; } @@ -405,7 +411,7 @@ input:checked + .field__toggle__slider:before { } .file_list__items__item { - color: var(--vscode-foreground); + color: var(--vscode-foreground); font-size: var(--vscode-font-size); font-weight: var(--vscode-font-weight); cursor: pointer; @@ -419,7 +425,7 @@ input:checked + .field__toggle__slider:before { } .file_list__items__item:hover { - background-color: var(--vscode-list-hoverBackground); + background-color: var(--vscode-list-hoverBackground); color: var(--vscode-list-hoverForeground); cursor: pointer; } @@ -429,7 +435,7 @@ input:checked + .field__toggle__slider:before { flex-shrink: 0; height: 20px; width: 20px; - margin-right: .25rem; + margin-right: 0.25rem; } .file_list__items__item span { @@ -454,7 +460,7 @@ input:checked + .field__toggle__slider:before { .sponsor svg { height: 20px; width: 20px; - margin-right: .25rem; + margin-right: 0.25rem; } .sponsor a { @@ -471,7 +477,7 @@ input:checked + .field__toggle__slider:before { } .sponsor a > span { - margin-right: .25rem; + margin-right: 0.25rem; } /* Timepicker */ @@ -494,4 +500,4 @@ input:checked + .field__toggle__slider:before { .react-datepicker-time__input input { border: 1px solid #aeaeae !important; -} \ No newline at end of file +} From 6f45277b497bc412ea9f2e73dda62a26ab9f472d Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sat, 4 Mar 2023 10:45:18 +0100 Subject: [PATCH 14/77] #522 - Add Astro support --- CHANGELOG.md | 2 ++ src/constants/FrameworkDetectors.ts | 17 ++++++++++++++++- src/listeners/dashboard/SettingsListener.ts | 15 +++++++++++++-- src/models/Framework.ts | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75835f5a..99a8f372 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ ### ๐ŸŽจ Enhancements +- [#522](https://github.com/estruyf/vscode-front-matter/issues/522): Configuration support added for [Astro](https://astro.build) + ### โšก๏ธ Optimizations ### ๐Ÿž Fixes diff --git a/src/constants/FrameworkDetectors.ts b/src/constants/FrameworkDetectors.ts index 130ccc37..adcec85c 100644 --- a/src/constants/FrameworkDetectors.ts +++ b/src/constants/FrameworkDetectors.ts @@ -1,4 +1,18 @@ export const FrameworkDetectors = [ + { + framework: { + name: 'astro', + dist: 'dist', + static: 'public', + build: 'npm run build', + server: 'http://127.0.0.1:3000' + }, + requiredFiles: ['astro.config.mjs'], + requiredDependencies: ['astro'], + commands: { + start: 'npm run dev' + } + }, { framework: { name: 'gatsby', @@ -17,7 +31,8 @@ export const FrameworkDetectors = [ name: 'hugo', dist: 'public', static: 'static', - build: 'hugo' + build: 'hugo', + server: 'http://127.0.0.1:1313' }, requiredFiles: ['config.toml', 'config.yaml', 'config.yml'], commands: { diff --git a/src/listeners/dashboard/SettingsListener.ts b/src/listeners/dashboard/SettingsListener.ts index e179f703..10bbbe77 100644 --- a/src/listeners/dashboard/SettingsListener.ts +++ b/src/listeners/dashboard/SettingsListener.ts @@ -1,7 +1,12 @@ import { join } from 'path'; import { commands, Uri } from 'vscode'; import { Folders } from '../../commands/Folders'; -import { COMMAND_NAME, SETTING_CONTENT_STATIC_FOLDER, SETTING_FRAMEWORK_ID } from '../../constants'; +import { + COMMAND_NAME, + SETTING_CONTENT_STATIC_FOLDER, + SETTING_FRAMEWORK_ID, + SETTING_PREVIEW_HOST +} from '../../constants'; import { DashboardCommand } from '../../dashboardWebView/DashboardCommand'; import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; import { DashboardSettings, Settings } from '../../helpers'; @@ -62,12 +67,18 @@ export class SettingsListener extends BaseListener { if (frameworkId) { const allFrameworks = FrameworkDetector.getAll(); - const framework = allFrameworks.find((f: Framework) => f.name === frameworkId); + const framework: Framework | undefined = allFrameworks.find( + (f: Framework) => f.name === frameworkId + ); if (framework) { if (framework.static) { await Settings.update(SETTING_CONTENT_STATIC_FOLDER, framework.static, true); } + if (framework.server) { + await Settings.update(SETTING_PREVIEW_HOST, framework.server, true); + } + await FrameworkDetector.checkDefaultSettings(framework); } else { await Settings.update(SETTING_CONTENT_STATIC_FOLDER, '', true); diff --git a/src/models/Framework.ts b/src/models/Framework.ts index e8e4a92f..111c5c26 100644 --- a/src/models/Framework.ts +++ b/src/models/Framework.ts @@ -3,4 +3,5 @@ export interface Framework { dist: string; static: string; build: string; + server?: string; } From f2c8c0a8d624bb6594f179f345bb98fff74f3192 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sat, 4 Mar 2023 10:48:36 +0100 Subject: [PATCH 15/77] Added default servers for frameworks --- src/constants/FrameworkDetectors.ts | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/constants/FrameworkDetectors.ts b/src/constants/FrameworkDetectors.ts index adcec85c..ba3cccc9 100644 --- a/src/constants/FrameworkDetectors.ts +++ b/src/constants/FrameworkDetectors.ts @@ -5,7 +5,7 @@ export const FrameworkDetectors = [ dist: 'dist', static: 'public', build: 'npm run build', - server: 'http://127.0.0.1:3000' + server: 'http://localhost:3000' }, requiredFiles: ['astro.config.mjs'], requiredDependencies: ['astro'], @@ -18,7 +18,8 @@ export const FrameworkDetectors = [ name: 'gatsby', dist: 'public', static: 'static', - build: 'gatsby build' + build: 'gatsby build', + server: 'http://localhost:8000' }, requiredFiles: ['gatsby-config.js'], requiredDependencies: ['gatsby'], @@ -32,7 +33,7 @@ export const FrameworkDetectors = [ dist: 'public', static: 'static', build: 'hugo', - server: 'http://127.0.0.1:1313' + server: 'http://localhost:1313' }, requiredFiles: ['config.toml', 'config.yaml', 'config.yml'], commands: { @@ -44,7 +45,8 @@ export const FrameworkDetectors = [ name: 'next', dist: '.next', static: 'public', - build: 'next build' + build: 'next build', + server: 'http://localhost:3000' }, requiredFiles: ['next.config.js'], requiredDependencies: ['next'], @@ -57,7 +59,8 @@ export const FrameworkDetectors = [ name: 'nuxt', dist: 'dist', static: 'static', - build: 'nuxt' + build: 'nuxt', + server: 'http://localhost:3000' }, requiredFiles: ['nuxt.config.js'], requiredDependencies: ['nuxt'], @@ -70,7 +73,8 @@ export const FrameworkDetectors = [ name: 'jekyll', dist: '_site', static: 'assets', - build: 'bundle exec jekyll build' + build: 'bundle exec jekyll build', + server: 'http://localhost:4000' }, requiredFiles: ['Gemfile'], requiredDependencies: ['jekyll'], @@ -83,7 +87,8 @@ export const FrameworkDetectors = [ name: 'docusaurus', dist: 'build', static: 'static', - build: 'npx docusaurus build' + build: 'npx docusaurus build', + server: 'http://localhost:3000' }, requiredFiles: ['docusaurus.config.js'], requiredDependencies: ['@docusaurus/core'], @@ -95,7 +100,8 @@ export const FrameworkDetectors = [ framework: { name: '11ty', dist: '_site', - build: 'npx @11ty/eleventy' + build: 'npx @11ty/eleventy', + server: 'http://localhost:8080' }, requiredDependencies: ['@11ty/eleventy'], commands: { @@ -106,7 +112,8 @@ export const FrameworkDetectors = [ framework: { name: 'hexo', dist: 'public', - build: 'npx hexo-cli generate' + build: 'npx hexo-cli generate', + server: 'http://localhost:4000' }, requiredFiles: ['_config.js'], requiredDependencies: ['hexo'], From ced176adad7da5008a4f342702f17880d1978f76 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sat, 4 Mar 2023 11:13:41 +0100 Subject: [PATCH 16/77] #524 - Remove global settings --- CHANGELOG.md | 1 + src/panelWebView/ViewPanel.tsx | 8 ++++++-- src/panelWebView/components/BaseView.tsx | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99a8f372..e7377ea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### ๐ŸŽจ Enhancements - [#522](https://github.com/estruyf/vscode-front-matter/issues/522): Configuration support added for [Astro](https://astro.build) +- [#524](https://github.com/estruyf/vscode-front-matter/issues/524): Removed the **Global settings** view from the panel. You can still get it back by configuring a [custom view mode](https://frontmatter.codes/docs/panel#view-modes). ### โšก๏ธ Optimizations diff --git a/src/panelWebView/ViewPanel.tsx b/src/panelWebView/ViewPanel.tsx index f3351adc..c3d50cd8 100644 --- a/src/panelWebView/ViewPanel.tsx +++ b/src/panelWebView/ViewPanel.tsx @@ -13,7 +13,7 @@ import { FeatureFlag } from '../components/features/FeatureFlag'; import { FEATURE_FLAG } from '../constants/Features'; import { GitAction } from './components/Git/GitAction'; import { CustomView } from './components/CustomView'; -import { useEffect, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; export interface IViewPanelProps { } @@ -32,6 +32,10 @@ export const ViewPanel: React.FunctionComponent = ( mode } = useMessages(); + const allPanelValues = useMemo(() => { + return Object.values(FEATURE_FLAG.panel).filter(v => v !== FEATURE_FLAG.panel.globalSettings) + }, [FEATURE_FLAG.panel]); + useEffect(() => { if (window.fmExternal && window.fmExternal.isDevelopment) { setIsDevMode(true); @@ -80,7 +84,7 @@ export const ViewPanel: React.FunctionComponent = ( - + diff --git a/src/panelWebView/components/BaseView.tsx b/src/panelWebView/components/BaseView.tsx index 2158fa9e..c0e95939 100644 --- a/src/panelWebView/components/BaseView.tsx +++ b/src/panelWebView/components/BaseView.tsx @@ -11,6 +11,7 @@ import { FeatureFlag } from '../../components/features/FeatureFlag'; import { FEATURE_FLAG } from '../../constants/Features'; import { Messenger } from '@estruyf/vscode/dist/client'; import { GitAction } from './Git/GitAction'; +import { useMemo } from 'react'; export interface IBaseViewProps { settings: PanelSettings | undefined; @@ -50,6 +51,10 @@ const BaseView: React.FunctionComponent = ({ (s) => s.bulk && (s.type === 'content' || !s.type) ); + const allPanelValues = useMemo(() => { + return Object.values(FEATURE_FLAG.panel).filter(v => v !== FEATURE_FLAG.panel.globalSettings) + }, [FEATURE_FLAG.panel]); + return (
    @@ -63,7 +68,7 @@ const BaseView: React.FunctionComponent = ({ <> - + From 34f5e9c41b2256153c0ddf62c7af8aaff7580256 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sat, 4 Mar 2023 11:59:39 +0100 Subject: [PATCH 17/77] #523 - number options --- CHANGELOG.md | 1 + package.json | 301 +++++++++--------- src/explorerView/ExplorerView.ts | 2 +- src/models/PanelSettings.ts | 10 + .../components/Fields/NumberField.tsx | 17 +- .../components/Fields/WrapperField.tsx | 3 +- 6 files changed, 174 insertions(+), 160 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7377ea2..a2ac1f92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### ๐ŸŽจ Enhancements - [#522](https://github.com/estruyf/vscode-front-matter/issues/522): Configuration support added for [Astro](https://astro.build) +- [#523](https://github.com/estruyf/vscode-front-matter/issues/523): Added support for `floating`/`decimal` numbers with a new number field property called `numberOptions` - [#524](https://github.com/estruyf/vscode-front-matter/issues/524): Removed the **Global settings** view from the panel. You can still get it back by configuring a [custom view mode](https://frontmatter.codes/docs/panel#view-modes). ### โšก๏ธ Optimizations diff --git a/package.json b/package.json index 63499c00..766dd43e 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,7 @@ "color": "#0e131f", "theme": "dark" }, - "badges": [ - { + "badges": [{ "description": "version", "url": "https://img.shields.io/github/package-json/v/estruyf/vscode-front-matter?color=green&label=vscode-front-matter&style=flat-square", "href": "https://github.com/estruyf/vscode-front-matter" @@ -55,8 +54,7 @@ ], "main": "./dist/extension.js", "contributes": { - "keybindings": [ - { + "keybindings": [{ "command": "frontMatter.dashboard", "key": "alt+d" }, @@ -74,24 +72,20 @@ } ], "viewsContainers": { - "activitybar": [ - { - "id": "frontmatter-explorer", - "title": "Front Matter", - "icon": "assets/frontmatter-short-min.svg" - } - ] + "activitybar": [{ + "id": "frontmatter-explorer", + "title": "Front Matter", + "icon": "assets/frontmatter-short-min.svg" + }] }, "views": { - "frontmatter-explorer": [ - { - "id": "frontMatter.explorer", - "name": "Front Matter", - "icon": "assets/frontmatter-short-min.svg", - "contextualTitle": "Front Matter", - "type": "webview" - } - ] + "frontmatter-explorer": [{ + "id": "frontMatter.explorer", + "name": "Front Matter", + "icon": "assets/frontmatter-short-min.svg", + "contextualTitle": "Front Matter", + "type": "webview" + }] }, "configuration": { "title": "Front Matter: use frontmatter.json for shared team settings", @@ -126,8 +120,7 @@ "frontMatter.content.defaultFileType": { "type": "string", "default": "md", - "oneOf": [ - { + "oneOf": [{ "enum": [ "md", "mdx" @@ -143,8 +136,7 @@ "frontMatter.content.defaultSorting": { "type": "string", "default": "", - "oneOf": [ - { + "oneOf": [{ "enum": [ "LastModifiedAsc", "LastModifiedDesc", @@ -471,8 +463,7 @@ "command": { "$id": "#scriptCommand", "type": "string", - "oneOf": [ - { + "oneOf": [{ "enum": [ "node", "bash", @@ -646,8 +637,7 @@ "title", "file" ], - "anyOf": [ - { + "anyOf": [{ "required": [ "schema" ] @@ -701,8 +691,7 @@ "id", "path" ], - "anyOf": [ - { + "anyOf": [{ "required": [ "schema" ] @@ -1048,8 +1037,7 @@ "default": "", "description": "The ID of your taxonomy field. It cannot contain the \"tags\" or \"categories\" value.", "not": { - "anyOf": [ - { + "anyOf": [{ "const": "" }, { @@ -1093,6 +1081,32 @@ "type": "string" } }, + "numberOptions": { + "type": "object", + "description": "Specify the options for the number field", + "properties": { + "isDecimal": { + "type": "boolean", + "default": false, + "description": "Specify if the number is a decimal" + }, + "min": { + "type": "number", + "default": 0, + "description": "The minimum value" + }, + "max": { + "type": "number", + "default": 0, + "description": "The maximum value" + }, + "step": { + "type": "number", + "default": 1, + "description": "The step value" + } + } + }, "taxonomyLimit": { "type": "number", "default": 0, @@ -1183,8 +1197,7 @@ "type", "name" ], - "allOf": [ - { + "allOf": [{ "if": { "properties": { "type": { @@ -1342,51 +1355,48 @@ "fields" ] }, - "default": [ - { - "name": "default", - "pageBundle": false, - "fields": [ - { - "title": "Title", - "name": "title", - "type": "string" - }, - { - "title": "Description", - "name": "description", - "type": "string" - }, - { - "title": "Publishing date", - "name": "date", - "type": "datetime", - "default": "{{now}}", - "isPublishDate": true - }, - { - "title": "Content preview", - "name": "preview", - "type": "image" - }, - { - "title": "Is in draft", - "name": "draft", - "type": "boolean" - }, - { - "title": "Tags", - "name": "tags", - "type": "tags" - }, - { - "title": "Categories", - "name": "categories", - "type": "categories" - } - ] - } - ], + "default": [{ + "name": "default", + "pageBundle": false, + "fields": [{ + "title": "Title", + "name": "title", + "type": "string" + }, + { + "title": "Description", + "name": "description", + "type": "string" + }, + { + "title": "Publishing date", + "name": "date", + "type": "datetime", + "default": "{{now}}", + "isPublishDate": true + }, + { + "title": "Content preview", + "name": "preview", + "type": "image" + }, + { + "title": "Is in draft", + "name": "draft", + "type": "boolean" + }, + { + "title": "Tags", + "name": "tags", + "type": "tags" + }, + { + "title": "Categories", + "name": "categories", + "type": "categories" + } + ] + }], "scope": "Taxonomy" }, "frontMatter.taxonomy.customTaxonomy": { @@ -1399,8 +1409,7 @@ "type": "string", "description": "ID for your taxonomy field. It cannot contain the \"tags\" or \"categories\" value.", "not": { - "anyOf": [ - { + "anyOf": [{ "const": "" }, { @@ -1582,8 +1591,7 @@ } } }, - "commands": [ - { + "commands": [{ "command": "frontMatter.config.reload", "title": "Reload config", "category": "Front Matter" @@ -1897,15 +1905,12 @@ "category": "Front Matter" } ], - "submenus": [ - { - "id": "frontmatter.submenu", - "label": "Front Matter" - } - ], + "submenus": [{ + "id": "frontmatter.submenu", + "label": "Front Matter" + }], "menus": { - "editor/title": [ - { + "editor/title": [{ "command": "frontMatter.markup.heading", "group": "navigation@-133", "when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg" @@ -1981,14 +1986,11 @@ "when": "frontMatter:enabled == true && frontMatter:dashboard:open == true" } ], - "explorer/context": [ - { - "submenu": "frontmatter.submenu", - "group": "frontmatter@1" - } - ], - "frontmatter.submenu": [ - { + "explorer/context": [{ + "submenu": "frontmatter.submenu", + "group": "frontmatter@1" + }], + "frontmatter.submenu": [{ "command": "frontMatter.createFromTemplate", "when": "explorerResourceIsFolder", "group": "frontmatter@1" @@ -2004,8 +2006,7 @@ "group": "frontmatter@3" } ], - "commandPalette": [ - { + "commandPalette": [{ "command": "frontMatter.init", "when": "frontMatterCanInit" }, @@ -2146,8 +2147,7 @@ "when": "frontMatter:file:isValid == true" } ], - "view/title": [ - { + "view/title": [{ "command": "frontMatter.collapseSections", "group": "navigation@0", "when": "view == frontMatter.explorer" @@ -2164,57 +2164,52 @@ } ] }, - "grammars": [ - { - "path": "./syntaxes/hugo.tmLanguage.json", - "scopeName": "frontmatter.markdown.hugo", - "injectTo": [ - "text.html.markdown" - ] - } - ], - "walkthroughs": [ - { - "id": "frontmatter.welcome", - "title": "Get started with Front Matter", - "description": "Discover the features of Front Matter and learn how to use the CMS for your SSG or static site.", - "steps": [ - { - "id": "frontmatter.welcome.init", - "title": "Get started", - "description": "Initial steps to get started.\n[Open dashboard](command:frontMatter.dashboard)", - "media": { - "markdown": "assets/walkthrough/get-started.md" - }, - "completionEvents": [ - "onContext:frontMatterInitialized" - ] + "grammars": [{ + "path": "./syntaxes/hugo.tmLanguage.json", + "scopeName": "frontmatter.markdown.hugo", + "injectTo": [ + "text.html.markdown" + ] + }], + "walkthroughs": [{ + "id": "frontmatter.welcome", + "title": "Get started with Front Matter", + "description": "Discover the features of Front Matter and learn how to use the CMS for your SSG or static site.", + "steps": [{ + "id": "frontmatter.welcome.init", + "title": "Get started", + "description": "Initial steps to get started.\n[Open dashboard](command:frontMatter.dashboard)", + "media": { + "markdown": "assets/walkthrough/get-started.md" }, - { - "id": "frontmatter.welcome.documentation", - "title": "Documentation", - "description": "Check out the documentation for Front Matter.\n[View our documentation](https://frontmatter.codes/docs)", - "media": { - "markdown": "assets/walkthrough/documentation.md" - }, - "completionEvents": [ - "onLink:https://frontmatter.codes/docs" - ] + "completionEvents": [ + "onContext:frontMatterInitialized" + ] + }, + { + "id": "frontmatter.welcome.documentation", + "title": "Documentation", + "description": "Check out the documentation for Front Matter.\n[View our documentation](https://frontmatter.codes/docs)", + "media": { + "markdown": "assets/walkthrough/documentation.md" }, - { - "id": "frontmatter.welcome.supporter", - "title": "Support the project", - "description": "Become a supporter.\n[Support the project](https://github.com/sponsors/estruyf)", - "media": { - "markdown": "assets/walkthrough/support-the-project.md" - }, - "completionEvents": [ - "onLink:https://github.com/sponsors/estruyf" - ] - } - ] - } - ] + "completionEvents": [ + "onLink:https://frontmatter.codes/docs" + ] + }, + { + "id": "frontmatter.welcome.supporter", + "title": "Support the project", + "description": "Become a supporter.\n[Support the project](https://github.com/sponsors/estruyf)", + "media": { + "markdown": "assets/walkthrough/support-the-project.md" + }, + "completionEvents": [ + "onLink:https://github.com/sponsors/estruyf" + ] + } + ] + }] }, "scripts": { "dev:ext": "npm run clean && npm-run-all --parallel watch:*", @@ -2339,4 +2334,4 @@ "vsce": { "dependencies": false } -} +} \ No newline at end of file diff --git a/src/explorerView/ExplorerView.ts b/src/explorerView/ExplorerView.ts index 5a0025a5..31d0f63a 100644 --- a/src/explorerView/ExplorerView.ts +++ b/src/explorerView/ExplorerView.ts @@ -238,7 +238,7 @@ export class ExplorerView implements WebviewViewProvider, Disposable { return ` - + diff --git a/src/models/PanelSettings.ts b/src/models/PanelSettings.ts index 576b7d36..e9db4547 100644 --- a/src/models/PanelSettings.ts +++ b/src/models/PanelSettings.ts @@ -104,10 +104,20 @@ export interface Field { dataFileKey?: string; dataFileValue?: string; + // Number field options + numberOptions?: NumberOptions; + // When clause when?: WhenClause; } +export interface NumberOptions { + isDecimal?: boolean; + min?: number; + max?: number; + step?: number; +} + export enum WhenOperator { equals = 'eq', notEquals = 'neq', diff --git a/src/panelWebView/components/Fields/NumberField.tsx b/src/panelWebView/components/Fields/NumberField.tsx index 2f5364bf..c27db2af 100644 --- a/src/panelWebView/components/Fields/NumberField.tsx +++ b/src/panelWebView/components/Fields/NumberField.tsx @@ -1,32 +1,34 @@ import { CalculatorIcon } from '@heroicons/react/outline'; import * as React from 'react'; -import { useEffect, useMemo } from 'react'; -import { BaseFieldProps } from '../../../models'; +import { useCallback, useEffect, useMemo } from 'react'; +import { BaseFieldProps, NumberOptions } from '../../../models'; import { FieldTitle } from './FieldTitle'; import { FieldMessage } from './FieldMessage'; export interface INumberFieldProps extends BaseFieldProps { + options?: NumberOptions; onChange: (nrValue: number | null) => void; } export const NumberField: React.FunctionComponent = ({ label, description, + options, value, required, onChange }: React.PropsWithChildren) => { const [nrValue, setNrValue] = React.useState(value); - const onValueChange = (txtValue: string) => { - let newValue: number | null = parseInt(txtValue); + const onValueChange = useCallback((txtValue: string) => { + let newValue: number | null = options?.isDecimal ? parseFloat(txtValue) : parseInt(txtValue); if (isNaN(newValue)) { newValue = null; } setNrValue(newValue); onChange(newValue); - }; + }, [options?.isDecimal]); const showRequiredState = useMemo(() => { return required && (nrValue === null || nrValue === undefined); @@ -38,6 +40,8 @@ export const NumberField: React.FunctionComponent = ({ } }, [value]); + console.log(`NumberField: ${label} - ${value} - ${JSON.stringify(options)}`) + return (
    } required={required} /> @@ -46,6 +50,9 @@ export const NumberField: React.FunctionComponent = ({ type={`number`} className={`metadata_field__number`} value={`${nrValue}`} + min={options?.min ?? undefined} + max={options?.max ?? undefined} + step={options?.step ?? undefined} onChange={(e) => onValueChange(e.target.value)} /> diff --git a/src/panelWebView/components/Fields/WrapperField.tsx b/src/panelWebView/components/Fields/WrapperField.tsx index b4549f43..3f0295e6 100644 --- a/src/panelWebView/components/Fields/WrapperField.tsx +++ b/src/panelWebView/components/Fields/WrapperField.tsx @@ -217,7 +217,7 @@ export const WrapperField: React.FunctionComponent = ({ ); } else if (field.type === 'number') { - let nrValue: number | null = parseInt(fieldValue as string); + let nrValue: number | null = field.numberOptions?.isDecimal ? parseFloat(fieldValue as string) : parseInt(fieldValue as string); if (isNaN(nrValue)) { nrValue = null; } @@ -228,6 +228,7 @@ export const WrapperField: React.FunctionComponent = ({ key={field.name} label={field.title || field.name} description={field.description} + options={field.numberOptions} onChange={(value) => onSendUpdate(field.name, value, parentFields)} value={nrValue} required={!!field.required} From 9f11b94c60dc5bad9b128ed9c07800da9235408e Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sat, 4 Mar 2023 12:11:42 +0100 Subject: [PATCH 18/77] #520 - Add url protocol --- CHANGELOG.md | 1 + src/commands/Preview.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ac1f92..f394b852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ ### ๐Ÿž Fixes - [#518](https://github.com/estruyf/vscode-front-matter/issues/518): Fix an issue where the `YAML` parser adds line breaks to long strings +- [#520](https://github.com/estruyf/vscode-front-matter/issues/520): Add the URL protocol to the host on opening the preview if it's missing ## [8.3.0] - 2022-02-14 - [Release notes](https://beta.frontmatter.codes/updates/v8.3.0) diff --git a/src/commands/Preview.ts b/src/commands/Preview.ts index 2604eff9..a541f0aa 100644 --- a/src/commands/Preview.ts +++ b/src/commands/Preview.ts @@ -161,7 +161,8 @@ export class Preview { light: Uri.file(join(extensionPath, 'assets/icons/frontmatter-short-light.svg')) }; - const localhostUrl = await env.asExternalUri(Uri.parse(settings.host)); + const crntUrl = settings.host.startsWith('http') ? settings.host : `http://${settings.host}`; + const localhostUrl = await env.asExternalUri(Uri.parse(crntUrl)); const cspSource = webView.webview.cspSource; From 9a2b0cb005ef04d9a22f6441b956e576f89f7f25 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Mon, 6 Mar 2023 10:15:42 +0100 Subject: [PATCH 19/77] Update changelog date --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75835f5a..51e4321d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [8.4.0] - 2022-xx-xx +## [8.4.0] - 2023-xx-xx ### ๐Ÿงช Experimental features @@ -21,7 +21,7 @@ - [#518](https://github.com/estruyf/vscode-front-matter/issues/518): Fix an issue where the `YAML` parser adds line breaks to long strings -## [8.3.0] - 2022-02-14 - [Release notes](https://beta.frontmatter.codes/updates/v8.3.0) +## [8.3.0] - 2023-02-14 - [Release notes](https://beta.frontmatter.codes/updates/v8.3.0) ### ๐Ÿงช Experimental features From 53dd1303dcc396eb8fcacc1223fd956afda3d29a Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Mon, 6 Mar 2023 10:46:23 +0100 Subject: [PATCH 20/77] #518 - revert and update yaml parser + config --- package-lock.json | 47 +++++- package.json | 277 +++++++++++++++++++---------------- src/parsers/ParserEngines.ts | 7 +- 3 files changed, 200 insertions(+), 131 deletions(-) diff --git a/package-lock.json b/package-lock.json index a7d9ba10..ec417b06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -104,7 +104,7 @@ "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.1", "webpack-dev-server": "^4.6.0", - "yaml": "^1.10.2", + "yaml": "^2.2.1", "yawn-yaml": "^1.5.0" }, "engines": { @@ -3155,6 +3155,15 @@ "node": ">=10" } }, + "node_modules/cosmiconfig/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/cross-spawn": { "version": "6.0.5", "dev": true, @@ -7996,6 +8005,15 @@ } } }, + "node_modules/postcss-load-config/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/postcss-loader": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-7.0.2.tgz", @@ -11818,11 +11836,12 @@ "license": "ISC" }, "node_modules/yaml": { - "version": "1.10.2", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz", + "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==", "dev": true, - "license": "ISC", "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/yaml-js": { @@ -14149,6 +14168,14 @@ "parse-json": "^5.0.0", "path-type": "^4.0.0", "yaml": "^1.10.0" + }, + "dependencies": { + "yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true + } } }, "cross-spawn": { @@ -17289,6 +17316,14 @@ "requires": { "lilconfig": "^2.0.5", "yaml": "^1.10.2" + }, + "dependencies": { + "yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true + } } }, "postcss-loader": { @@ -19850,7 +19885,9 @@ "dev": true }, "yaml": { - "version": "1.10.2", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz", + "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==", "dev": true }, "yaml-js": { diff --git a/package.json b/package.json index 766dd43e..41906011 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "color": "#0e131f", "theme": "dark" }, - "badges": [{ + "badges": [ + { "description": "version", "url": "https://img.shields.io/github/package-json/v/estruyf/vscode-front-matter?color=green&label=vscode-front-matter&style=flat-square", "href": "https://github.com/estruyf/vscode-front-matter" @@ -54,7 +55,8 @@ ], "main": "./dist/extension.js", "contributes": { - "keybindings": [{ + "keybindings": [ + { "command": "frontMatter.dashboard", "key": "alt+d" }, @@ -72,20 +74,24 @@ } ], "viewsContainers": { - "activitybar": [{ - "id": "frontmatter-explorer", - "title": "Front Matter", - "icon": "assets/frontmatter-short-min.svg" - }] + "activitybar": [ + { + "id": "frontmatter-explorer", + "title": "Front Matter", + "icon": "assets/frontmatter-short-min.svg" + } + ] }, "views": { - "frontmatter-explorer": [{ - "id": "frontMatter.explorer", - "name": "Front Matter", - "icon": "assets/frontmatter-short-min.svg", - "contextualTitle": "Front Matter", - "type": "webview" - }] + "frontmatter-explorer": [ + { + "id": "frontMatter.explorer", + "name": "Front Matter", + "icon": "assets/frontmatter-short-min.svg", + "contextualTitle": "Front Matter", + "type": "webview" + } + ] }, "configuration": { "title": "Front Matter: use frontmatter.json for shared team settings", @@ -120,7 +126,8 @@ "frontMatter.content.defaultFileType": { "type": "string", "default": "md", - "oneOf": [{ + "oneOf": [ + { "enum": [ "md", "mdx" @@ -136,7 +143,8 @@ "frontMatter.content.defaultSorting": { "type": "string", "default": "", - "oneOf": [{ + "oneOf": [ + { "enum": [ "LastModifiedAsc", "LastModifiedDesc", @@ -463,7 +471,8 @@ "command": { "$id": "#scriptCommand", "type": "string", - "oneOf": [{ + "oneOf": [ + { "enum": [ "node", "bash", @@ -637,7 +646,8 @@ "title", "file" ], - "anyOf": [{ + "anyOf": [ + { "required": [ "schema" ] @@ -691,7 +701,8 @@ "id", "path" ], - "anyOf": [{ + "anyOf": [ + { "required": [ "schema" ] @@ -1037,7 +1048,8 @@ "default": "", "description": "The ID of your taxonomy field. It cannot contain the \"tags\" or \"categories\" value.", "not": { - "anyOf": [{ + "anyOf": [ + { "const": "" }, { @@ -1197,7 +1209,8 @@ "type", "name" ], - "allOf": [{ + "allOf": [ + { "if": { "properties": { "type": { @@ -1355,48 +1368,51 @@ "fields" ] }, - "default": [{ - "name": "default", - "pageBundle": false, - "fields": [{ - "title": "Title", - "name": "title", - "type": "string" - }, - { - "title": "Description", - "name": "description", - "type": "string" - }, - { - "title": "Publishing date", - "name": "date", - "type": "datetime", - "default": "{{now}}", - "isPublishDate": true - }, - { - "title": "Content preview", - "name": "preview", - "type": "image" - }, - { - "title": "Is in draft", - "name": "draft", - "type": "boolean" - }, - { - "title": "Tags", - "name": "tags", - "type": "tags" - }, - { - "title": "Categories", - "name": "categories", - "type": "categories" - } - ] - }], + "default": [ + { + "name": "default", + "pageBundle": false, + "fields": [ + { + "title": "Title", + "name": "title", + "type": "string" + }, + { + "title": "Description", + "name": "description", + "type": "string" + }, + { + "title": "Publishing date", + "name": "date", + "type": "datetime", + "default": "{{now}}", + "isPublishDate": true + }, + { + "title": "Content preview", + "name": "preview", + "type": "image" + }, + { + "title": "Is in draft", + "name": "draft", + "type": "boolean" + }, + { + "title": "Tags", + "name": "tags", + "type": "tags" + }, + { + "title": "Categories", + "name": "categories", + "type": "categories" + } + ] + } + ], "scope": "Taxonomy" }, "frontMatter.taxonomy.customTaxonomy": { @@ -1409,7 +1425,8 @@ "type": "string", "description": "ID for your taxonomy field. It cannot contain the \"tags\" or \"categories\" value.", "not": { - "anyOf": [{ + "anyOf": [ + { "const": "" }, { @@ -1591,7 +1608,8 @@ } } }, - "commands": [{ + "commands": [ + { "command": "frontMatter.config.reload", "title": "Reload config", "category": "Front Matter" @@ -1905,12 +1923,15 @@ "category": "Front Matter" } ], - "submenus": [{ - "id": "frontmatter.submenu", - "label": "Front Matter" - }], + "submenus": [ + { + "id": "frontmatter.submenu", + "label": "Front Matter" + } + ], "menus": { - "editor/title": [{ + "editor/title": [ + { "command": "frontMatter.markup.heading", "group": "navigation@-133", "when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg" @@ -1986,11 +2007,14 @@ "when": "frontMatter:enabled == true && frontMatter:dashboard:open == true" } ], - "explorer/context": [{ - "submenu": "frontmatter.submenu", - "group": "frontmatter@1" - }], - "frontmatter.submenu": [{ + "explorer/context": [ + { + "submenu": "frontmatter.submenu", + "group": "frontmatter@1" + } + ], + "frontmatter.submenu": [ + { "command": "frontMatter.createFromTemplate", "when": "explorerResourceIsFolder", "group": "frontmatter@1" @@ -2006,7 +2030,8 @@ "group": "frontmatter@3" } ], - "commandPalette": [{ + "commandPalette": [ + { "command": "frontMatter.init", "when": "frontMatterCanInit" }, @@ -2147,7 +2172,8 @@ "when": "frontMatter:file:isValid == true" } ], - "view/title": [{ + "view/title": [ + { "command": "frontMatter.collapseSections", "group": "navigation@0", "when": "view == frontMatter.explorer" @@ -2164,52 +2190,57 @@ } ] }, - "grammars": [{ - "path": "./syntaxes/hugo.tmLanguage.json", - "scopeName": "frontmatter.markdown.hugo", - "injectTo": [ - "text.html.markdown" - ] - }], - "walkthroughs": [{ - "id": "frontmatter.welcome", - "title": "Get started with Front Matter", - "description": "Discover the features of Front Matter and learn how to use the CMS for your SSG or static site.", - "steps": [{ - "id": "frontmatter.welcome.init", - "title": "Get started", - "description": "Initial steps to get started.\n[Open dashboard](command:frontMatter.dashboard)", - "media": { - "markdown": "assets/walkthrough/get-started.md" + "grammars": [ + { + "path": "./syntaxes/hugo.tmLanguage.json", + "scopeName": "frontmatter.markdown.hugo", + "injectTo": [ + "text.html.markdown" + ] + } + ], + "walkthroughs": [ + { + "id": "frontmatter.welcome", + "title": "Get started with Front Matter", + "description": "Discover the features of Front Matter and learn how to use the CMS for your SSG or static site.", + "steps": [ + { + "id": "frontmatter.welcome.init", + "title": "Get started", + "description": "Initial steps to get started.\n[Open dashboard](command:frontMatter.dashboard)", + "media": { + "markdown": "assets/walkthrough/get-started.md" + }, + "completionEvents": [ + "onContext:frontMatterInitialized" + ] }, - "completionEvents": [ - "onContext:frontMatterInitialized" - ] - }, - { - "id": "frontmatter.welcome.documentation", - "title": "Documentation", - "description": "Check out the documentation for Front Matter.\n[View our documentation](https://frontmatter.codes/docs)", - "media": { - "markdown": "assets/walkthrough/documentation.md" + { + "id": "frontmatter.welcome.documentation", + "title": "Documentation", + "description": "Check out the documentation for Front Matter.\n[View our documentation](https://frontmatter.codes/docs)", + "media": { + "markdown": "assets/walkthrough/documentation.md" + }, + "completionEvents": [ + "onLink:https://frontmatter.codes/docs" + ] }, - "completionEvents": [ - "onLink:https://frontmatter.codes/docs" - ] - }, - { - "id": "frontmatter.welcome.supporter", - "title": "Support the project", - "description": "Become a supporter.\n[Support the project](https://github.com/sponsors/estruyf)", - "media": { - "markdown": "assets/walkthrough/support-the-project.md" - }, - "completionEvents": [ - "onLink:https://github.com/sponsors/estruyf" - ] - } - ] - }] + { + "id": "frontmatter.welcome.supporter", + "title": "Support the project", + "description": "Become a supporter.\n[Support the project](https://github.com/sponsors/estruyf)", + "media": { + "markdown": "assets/walkthrough/support-the-project.md" + }, + "completionEvents": [ + "onLink:https://github.com/sponsors/estruyf" + ] + } + ] + } + ] }, "scripts": { "dev:ext": "npm run clean && npm-run-all --parallel watch:*", @@ -2328,10 +2359,10 @@ "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.1", "webpack-dev-server": "^4.6.0", - "yaml": "^1.10.2", + "yaml": "^2.2.1", "yawn-yaml": "^1.5.0" }, "vsce": { "dependencies": false } -} \ No newline at end of file +} diff --git a/src/parsers/ParserEngines.ts b/src/parsers/ParserEngines.ts index 6003ce49..161bd4f8 100644 --- a/src/parsers/ParserEngines.ts +++ b/src/parsers/ParserEngines.ts @@ -49,12 +49,13 @@ export const Engines = { } } - const jsonObj = docYaml.toJSON(); - return jsyaml.dump(jsonObj, options); + return docYaml.toString({ + lineWidth: 5000 + }); } } - return jsyaml.dump(obj, options); + return yaml.stringify(obj, options); } } } From 14515e4f59b677599f31c971c989d9547bb0a03a Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Tue, 7 Mar 2023 15:14:15 +0100 Subject: [PATCH 21/77] #526 - Fix content menu --- CHANGELOG.md | 1 + pnpm-lock.yaml | 23 ++++++++++++++----- .../components/Contents/ContentActions.tsx | 2 +- .../components/Header/Header.tsx | 2 +- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50138075..ba15e85a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - [#518](https://github.com/estruyf/vscode-front-matter/issues/518): Fix an issue where the `YAML` parser adds line breaks to long strings - [#520](https://github.com/estruyf/vscode-front-matter/issues/520): Add the URL protocol to the host on opening the preview if it's missing +- [#526](https://github.com/estruyf/vscode-front-matter/issues/526): Fix card content menu ## [8.3.0] - 2023-02-14 - [Release notes](https://beta.frontmatter.codes/updates/v8.3.0) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 034927bb..f75798e9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,7 +3,7 @@ lockfileVersion: 5.4 specifiers: '@actions/core': ^1.8.2 '@bendera/vscode-webview-elements': 0.6.2 - '@estruyf/vscode': 0.0.3 + '@estruyf/vscode': ^1.1.0 '@headlessui/react': 1.5.0 '@heroicons/react': 1.0.4 '@iarna/toml': 2.2.3 @@ -96,13 +96,13 @@ specifiers: webpack-bundle-analyzer: ^4.5.0 webpack-cli: ^4.9.1 webpack-dev-server: ^4.6.0 - yaml: ^1.10.2 + yaml: ^2.2.1 yawn-yaml: ^1.5.0 devDependencies: '@actions/core': 1.10.0 '@bendera/vscode-webview-elements': 0.6.2 - '@estruyf/vscode': 0.0.3 + '@estruyf/vscode': 1.1.0 '@headlessui/react': 1.5.0_w7o5yyljkiidx2s2nzb26ottzu '@heroicons/react': 1.0.4_react@17.0.1 '@iarna/toml': 2.2.3 @@ -195,7 +195,7 @@ devDependencies: webpack-bundle-analyzer: 4.7.0 webpack-cli: 4.10.0_y7ttplitmkohdpgkllksfboxwa webpack-dev-server: 4.11.1_pda42hcaj7d62cr262fr632kue - yaml: 1.10.2 + yaml: 2.2.1 yawn-yaml: 1.5.0 packages: @@ -313,10 +313,11 @@ packages: - supports-color dev: true - /@estruyf/vscode/0.0.3: - resolution: {integrity: sha512-Mak13ZHj/TcyL0snPHsrqELlhpvV1JszZFScCcm1G2dp6UdP4dSk32MlNH5FusGhTIEOI6APE8krldMcZjS/3w==} + /@estruyf/vscode/1.1.0: + resolution: {integrity: sha512-JOjok+d870IsBPqk/E+KeW9E5ar+slqW8Sae5PtNb1yB8aMudJy9DHV5wQeki/ZwggFYDv+6EPjyzW/71/5yVw==} dependencies: '@types/vscode-webview': 1.57.0 + uuid: 9.0.0 dev: true /@headlessui/react/1.5.0_w7o5yyljkiidx2s2nzb26ottzu: @@ -7137,6 +7138,11 @@ packages: hasBin: true dev: true + /uuid/9.0.0: + resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} + hasBin: true + dev: true + /uvu/0.5.6: resolution: {integrity: sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==} engines: {node: '>=8'} @@ -7542,6 +7548,11 @@ packages: engines: {node: '>= 6'} dev: true + /yaml/2.2.1: + resolution: {integrity: sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==} + engines: {node: '>= 14'} + dev: true + /yargs-parser/20.2.4: resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} engines: {node: '>=10'} diff --git a/src/dashboardWebView/components/Contents/ContentActions.tsx b/src/dashboardWebView/components/Contents/ContentActions.tsx index 57499bf1..6536eec5 100644 --- a/src/dashboardWebView/components/Contents/ContentActions.tsx +++ b/src/dashboardWebView/components/Contents/ContentActions.tsx @@ -96,7 +96,7 @@ export const ContentActions: React.FunctionComponent = ({ ) }`} > - + {!listView && (
    diff --git a/src/dashboardWebView/components/Header/Header.tsx b/src/dashboardWebView/components/Header/Header.tsx index 07c5a232..9aa05c58 100644 --- a/src/dashboardWebView/components/Header/Header.tsx +++ b/src/dashboardWebView/components/Header/Header.tsx @@ -141,7 +141,7 @@ export const Header: React.FunctionComponent = ({ }, [location.search]); return ( -
    Date: Tue, 7 Mar 2023 15:32:08 +0100 Subject: [PATCH 22/77] #521 - fix snippets placeholder --- CHANGELOG.md | 1 + .../components/SnippetsView/Snippets.tsx | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba15e85a..233ec591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - [#518](https://github.com/estruyf/vscode-front-matter/issues/518): Fix an issue where the `YAML` parser adds line breaks to long strings - [#520](https://github.com/estruyf/vscode-front-matter/issues/520): Add the URL protocol to the host on opening the preview if it's missing +- [#521](https://github.com/estruyf/vscode-front-matter/issues/521): Fix empty snippets dashboard placeholder - [#526](https://github.com/estruyf/vscode-front-matter/issues/526): Fix card content menu ## [8.3.0] - 2023-02-14 - [Release notes](https://beta.frontmatter.codes/updates/v8.3.0) diff --git a/src/dashboardWebView/components/SnippetsView/Snippets.tsx b/src/dashboardWebView/components/SnippetsView/Snippets.tsx index 7b795fce..ebd7b76b 100644 --- a/src/dashboardWebView/components/SnippetsView/Snippets.tsx +++ b/src/dashboardWebView/components/SnippetsView/Snippets.tsx @@ -78,6 +78,8 @@ export const Snippets: React.FunctionComponent = ( }); }, []); + console.log('snippets', snippetKeys); + return ( = ( 0)} value={snippetFilter} onChange={(value: string) => setSnippetFilter(value)} onReset={() => setSnippetFilter('')} @@ -121,7 +123,7 @@ export const Snippets: React.FunctionComponent = (
    )} - {snippetKeys && snippetKeys.length > 0 ? ( + {(snippetKeys && snippetKeys.length > 0) ? (
      = ( ))}
    ) : ( -
    -
    +
    -

    No snippets found

    +

    No snippets found

    +

    + + Read more to get started with snippets + +

    )} From ecacba53a70eb9cb8ad0877f4aa5ed62afdb9208 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 9 Mar 2023 18:09:18 +0100 Subject: [PATCH 23/77] Added chatbot integration --- package-lock.json | 1619 ++++++++++++++++- package.json | 10 + src/commands/Chatbot.ts | 122 ++ src/commands/index.ts | 1 + src/constants/Extension.ts | 1 + src/constants/TelemetryEvent.ts | 3 + .../components/Chatbot/Chatbot.tsx | 296 +++ .../components/Chatbot/models/InitResponse.ts | 16 + .../Chatbot/models/NewConversationResponse.ts | 6 + src/dashboardWebView/index.tsx | 4 + src/dashboardWebView/styles.css | 40 + src/extension.ts | 10 +- webpack/dashboard.config.js | 100 +- 13 files changed, 2174 insertions(+), 54 deletions(-) create mode 100644 src/commands/Chatbot.ts create mode 100644 src/dashboardWebView/components/Chatbot/Chatbot.tsx create mode 100644 src/dashboardWebView/components/Chatbot/models/InitResponse.ts create mode 100644 src/dashboardWebView/components/Chatbot/models/NewConversationResponse.ts diff --git a/package-lock.json b/package-lock.json index ec417b06..9f51a6e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@headlessui/react": "1.5.0", "@heroicons/react": "1.0.4", "@iarna/toml": "2.2.3", + "@microsoft/fetch-event-source": "^2.0.1", "@octokit/rest": "^18.12.0", "@popperjs/core": "^2.11.6", "@sentry/react": "^6.13.3", @@ -45,6 +46,7 @@ "@webpack-cli/serve": "^1.6.0", "ajv": "^8.8.2", "array-move": "^4.0.0", + "assert": "^2.0.0", "autoprefixer": "^10.4.13", "chai": "^4.3.6", "css-loader": "5.2.7", @@ -76,16 +78,19 @@ "postcss-loader": "^7.0.2", "prettier": "^2.8.3", "prettier-plugin-tailwindcss": "^0.2.2", + "process": "^0.11.10", "react": "17.0.1", "react-datepicker": "4.2.1", "react-dom": "17.0.1", "react-dropzone": "^11.3.4", + "react-markdown": "^8.0.5", "react-popper": "^2.3.0", "react-quill": "^2.0.0-beta.4", "react-router-dom": "^6.3.0", "react-sortable-hoc": "^2.0.0", "react-toastify": "^8.1.0", "recoil": "^0.4.1", + "remark-gfm": "^3.0.1", "rimraf": "^3.0.2", "semver": "^7.3.7", "simple-git": "^3.10.0", @@ -496,6 +501,12 @@ "exenv-es6": "^1.0.0" } }, + "node_modules/@microsoft/fetch-event-source": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@microsoft/fetch-event-source/-/fetch-event-source-2.0.1.tgz", + "integrity": "sha512-W6CLUJ2eBMw3Rec70qrsEW0jOm/3twwJv21mrmj2yORiaVmVYGS4sSS5yUwvQc1ZlDLYGPnClVWmUUMagKNsfA==", + "dev": true + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "dev": true, @@ -957,6 +968,15 @@ "@types/node": "*" } }, + "node_modules/@types/hast": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz", + "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==", + "dev": true, + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/html-minifier-terser": { "version": "5.1.1", "dev": true, @@ -2048,6 +2068,18 @@ "node": ">=8" } }, + "node_modules/assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "dev": true, + "dependencies": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, "node_modules/assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -2118,6 +2150,18 @@ "postcss": "^8.1.0" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/azure-devops-node-api": { "version": "11.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-11.2.0.tgz", @@ -2128,6 +2172,16 @@ "typed-rest-client": "^1.8.4" } }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/balanced-match": { "version": "1.0.0", "dev": true, @@ -2497,6 +2551,16 @@ } ] }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chai": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", @@ -3014,6 +3078,16 @@ "node": ">= 0.8" } }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/commander": { "version": "2.20.0", "dev": true, @@ -3329,6 +3403,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/decode-named-character-reference": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", + "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + "dev": true, + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/decompress-response": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", @@ -3490,6 +3577,15 @@ "dev": true, "license": "ISC" }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/destroy": { "version": "1.0.4", "dev": true, @@ -3832,6 +3928,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==", + "dev": true + }, "node_modules/escalade": { "version": "3.1.1", "dev": true, @@ -4642,6 +4744,15 @@ } } }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/form-data": { "version": "3.0.1", "dev": true, @@ -4742,13 +4853,14 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.1", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", "dev": true, - "license": "MIT", "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4842,6 +4954,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/got": { "version": "11.8.6", "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", @@ -4966,9 +5090,10 @@ } }, "node_modules/has-symbols": { - "version": "1.0.2", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -4990,6 +5115,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hast-util-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz", + "integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/he": { "version": "1.2.0", "dev": true, @@ -5484,6 +5619,12 @@ "dev": true, "optional": true }, + "node_modules/inline-style-parser": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz", + "integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==", + "dev": true + }, "node_modules/internal-slot": { "version": "1.0.3", "dev": true, @@ -5600,6 +5741,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "engines": { + "node": ">=4" + } + }, "node_modules/is-callable": { "version": "1.2.4", "dev": true, @@ -5677,6 +5841,21 @@ "node": ">=8" } }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -5698,6 +5877,22 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-negative-zero": { "version": "2.0.2", "dev": true, @@ -5831,6 +6026,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-unicode-supported": { "version": "0.1.0", "dev": true, @@ -6049,6 +6263,15 @@ "node": ">=0.10.0" } }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/klona": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz", @@ -6285,6 +6508,16 @@ "dev": true, "license": "MIT" }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/loose-envify": { "version": "1.4.0", "dev": true, @@ -6349,6 +6582,59 @@ "markdown-it": "bin/markdown-it.js" } }, + "node_modules/markdown-table": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.3.tgz", + "integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-definitions": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.2.tgz", + "integrity": "sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "unist-util-visit": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.2.2.tgz", + "integrity": "sha512-MTtdFRz/eMDHXzeK6W3dO7mXUlF82Gom4y0oOgvHhh/HXZAGvIQDUvQ0SuUx+j2tv44b8xTHOm8K/9OoRFnXKw==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mdast-util-from-markdown": { "version": "1.0.0", "dev": true, @@ -6370,6 +6656,154 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-gfm": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-2.0.2.tgz", + "integrity": "sha512-qvZ608nBppZ4icQlhQQIAdc6S3Ffj9RGmzwUKUWuEICFnd1LVkN3EktF7ZHAgfcEdvZB5owU9tQgt99e2TlLjg==", + "dev": true, + "dependencies": { + "mdast-util-from-markdown": "^1.0.0", + "mdast-util-gfm-autolink-literal": "^1.0.0", + "mdast-util-gfm-footnote": "^1.0.0", + "mdast-util-gfm-strikethrough": "^1.0.0", + "mdast-util-gfm-table": "^1.0.0", + "mdast-util-gfm-task-list-item": "^1.0.0", + "mdast-util-to-markdown": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-1.0.3.tgz", + "integrity": "sha512-My8KJ57FYEy2W2LyNom4n3E7hKTuQk/0SES0u16tjA9Z3oFkF4RrC/hPAPgjlSpezsOvI8ObcXcElo92wn5IGA==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "ccount": "^2.0.0", + "mdast-util-find-and-replace": "^2.0.0", + "micromark-util-character": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-1.0.2.tgz", + "integrity": "sha512-56D19KOGbE00uKVj3sgIykpwKL179QsVFwx/DCW0u/0+URsryacI4MAdNJl0dh+u2PSsD9FtxPFbHCzJ78qJFQ==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0", + "micromark-util-normalize-identifier": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-1.0.3.tgz", + "integrity": "sha512-DAPhYzTYrRcXdMjUtUjKvW9z/FNAMTdU0ORyMcbmkwYNbKocDpdk+PX1L1dQgOID/+vVs1uBQ7ElrBQfZ0cuiQ==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-1.0.7.tgz", + "integrity": "sha512-jjcpmNnQvrmN5Vx7y7lEc2iIOEytYv7rTvu+MeyAsSHTASGCCRA79Igg2uKssgOs1i1po8s3plW0sTu1wkkLGg==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^1.0.0", + "mdast-util-to-markdown": "^1.3.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-1.0.2.tgz", + "integrity": "sha512-PFTA1gzfp1B1UaiJVyhJZA1rm0+Tzn690frc/L8vNX1Jop4STZgOE6bxUhnzdVSB+vm2GU1tIsuQcA9bxTQpMQ==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-3.0.1.tgz", + "integrity": "sha512-WmI1gTXUBJo4/ZmSk79Wcb2HcjPJBzM1nlI/OUWA8yk2X9ik3ffNbBGsU+09BFmXaL1IBb9fiuvq6/KMiNycSg==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-12.3.0.tgz", + "integrity": "sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==", + "dev": true, + "dependencies": { + "@types/hast": "^2.0.0", + "@types/mdast": "^3.0.0", + "mdast-util-definitions": "^5.0.0", + "micromark-util-sanitize-uri": "^1.1.0", + "trim-lines": "^3.0.0", + "unist-util-generated": "^2.0.0", + "unist-util-position": "^4.0.0", + "unist-util-visit": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz", + "integrity": "sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^3.0.0", + "mdast-util-to-string": "^3.0.0", + "micromark-util-decode-string": "^1.0.0", + "unist-util-visit": "^4.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdast-util-to-string": { "version": "3.1.0", "dev": true, @@ -6502,6 +6936,128 @@ "parse-entities": "^3.0.0" } }, + "node_modules/micromark-extension-gfm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-2.0.1.tgz", + "integrity": "sha512-p2sGjajLa0iYiGQdT0oelahRYtMWvLjy8J9LOCxzIQsllMCGLbsLW+Nc+N4vi02jcRJvedVJ68cjelKIO6bpDA==", + "dev": true, + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^1.0.0", + "micromark-extension-gfm-footnote": "^1.0.0", + "micromark-extension-gfm-strikethrough": "^1.0.0", + "micromark-extension-gfm-table": "^1.0.0", + "micromark-extension-gfm-tagfilter": "^1.0.0", + "micromark-extension-gfm-task-list-item": "^1.0.0", + "micromark-util-combine-extensions": "^1.0.0", + "micromark-util-types": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-1.0.3.tgz", + "integrity": "sha512-i3dmvU0htawfWED8aHMMAzAVp/F0Z+0bPh3YrbTPPL1v4YAlCZpy5rBO5p0LPYiZo0zFVkoYh7vDU7yQSiCMjg==", + "dev": true, + "dependencies": { + "micromark-util-character": "^1.0.0", + "micromark-util-sanitize-uri": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-1.0.4.tgz", + "integrity": "sha512-E/fmPmDqLiMUP8mLJ8NbJWJ4bTw6tS+FEQS8CcuDtZpILuOb2kjLqPEeAePF1djXROHXChM/wPJw0iS4kHCcIg==", + "dev": true, + "dependencies": { + "micromark-core-commonmark": "^1.0.0", + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-normalize-identifier": "^1.0.0", + "micromark-util-sanitize-uri": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-1.0.4.tgz", + "integrity": "sha512-/vjHU/lalmjZCT5xt7CcHVJGq8sYRm80z24qAKXzaHzem/xsDYb2yLL+NNVbYvmpLx3O7SYPuGL5pzusL9CLIQ==", + "dev": true, + "dependencies": { + "micromark-util-chunked": "^1.0.0", + "micromark-util-classify-character": "^1.0.0", + "micromark-util-resolve-all": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-1.0.5.tgz", + "integrity": "sha512-xAZ8J1X9W9K3JTJTUL7G6wSKhp2ZYHrFk5qJgY/4B33scJzE2kpfRL6oiw/veJTbt7jiM/1rngLlOKPWr1G+vg==", + "dev": true, + "dependencies": { + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-1.0.1.tgz", + "integrity": "sha512-Ty6psLAcAjboRa/UKUbbUcwjVAv5plxmpUTy2XC/3nJFL37eHej8jrHrRzkqcpipJliuBH30DTs7+3wqNcQUVA==", + "dev": true, + "dependencies": { + "micromark-util-types": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-1.0.3.tgz", + "integrity": "sha512-PpysK2S1Q/5VXi72IIapbi/jliaiOFzv7THH4amwXeYXLq3l1uo8/2Be0Ac1rEwK20MQEsGH2ltAZLNY2KI/0Q==", + "dev": true, + "dependencies": { + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/micromark-factory-destination": { "version": "1.0.0", "dev": true, @@ -6697,6 +7253,28 @@ "micromark-util-symbol": "^1.0.0" } }, + "node_modules/micromark-util-decode-string": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.0.2.tgz", + "integrity": "sha512-DLT5Ho02qr6QWVNYbRZ3RYOSSWWFuH3tJexd3dgN1odEuPNxCngTCXJum7+ViRAd9BbdxCvMToPOD/IvVhzG6Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-decode-numeric-character-reference": "^1.0.0", + "micromark-util-symbol": "^1.0.0" + } + }, "node_modules/micromark-util-encode": { "version": "1.0.0", "dev": true, @@ -6764,7 +7342,9 @@ } }, "node_modules/micromark-util-sanitize-uri": { - "version": "1.0.0", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.1.0.tgz", + "integrity": "sha512-RoxtuSCX6sUNtxhbmsEFQfWzs8VN7cTctmBPvYivo98xb/kDEoTCtJQX5wyzIYEmk/lvNFTat4hL8oW0KndFpg==", "dev": true, "funding": [ { @@ -6776,7 +7356,6 @@ "url": "https://opencollective.com/unified" } ], - "license": "MIT", "dependencies": { "micromark-util-character": "^1.0.0", "micromark-util-encode": "^1.0.0", @@ -7115,6 +7694,15 @@ "node": ">=14.14" } }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/mrmime": { "version": "1.0.0", "dev": true, @@ -8319,6 +8907,15 @@ "renderkid": "^2.0.4" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "dev": true, @@ -8334,6 +8931,16 @@ "react-is": "^16.8.1" } }, + "node_modules/property-information": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.2.0.tgz", + "integrity": "sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "dev": true, @@ -9231,6 +9838,43 @@ "dev": true, "license": "MIT" }, + "node_modules/react-markdown": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-8.0.5.tgz", + "integrity": "sha512-jGJolWWmOWAvzf+xMdB9zwStViODyyFQhNB/bwCerbBKmrTmgmA599CGiOlP58OId1IMoIRsA8UdI1Lod4zb5A==", + "dev": true, + "dependencies": { + "@types/hast": "^2.0.0", + "@types/prop-types": "^15.0.0", + "@types/unist": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^2.0.0", + "prop-types": "^15.0.0", + "property-information": "^6.0.0", + "react-is": "^18.0.0", + "remark-parse": "^10.0.0", + "remark-rehype": "^10.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-object": "^0.4.0", + "unified": "^10.0.0", + "unist-util-visit": "^4.0.0", + "vfile": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=16", + "react": ">=16" + } + }, + "node_modules/react-markdown/node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, "node_modules/react-onclickoutside": { "version": "6.12.0", "dev": true, @@ -9473,6 +10117,53 @@ "node": ">= 0.10" } }, + "node_modules/remark-gfm": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-3.0.1.tgz", + "integrity": "sha512-lEFDoi2PICJyNrACFOfDD3JlLkuSbOa5Wd8EPt06HUdptv8Gn0bxYTdbU/XXQ3swAPkEaGxxPN9cbnMHvVu1Ig==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-gfm": "^2.0.0", + "micromark-extension-gfm": "^2.0.0", + "unified": "^10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.1.tgz", + "integrity": "sha512-1fUyHr2jLsVOkhbvPRBJ5zTKZZyD6yZzYaWCS6BPBdQ8vEMBCH+9zNCDA6tET/zHCi/jLqjCWtlJZUPk+DbnFw==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-from-markdown": "^1.0.0", + "unified": "^10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-10.1.0.tgz", + "integrity": "sha512-EFmR5zppdBp0WQeDVZ/b66CWJipB2q2VLNFMabzDSGR66Z2fQii83G5gTBbgGEnEEA0QRussvrFHxk1HWGJskw==", + "dev": true, + "dependencies": { + "@types/hast": "^2.0.0", + "@types/mdast": "^3.0.0", + "mdast-util-to-hast": "^12.1.0", + "unified": "^10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/renderkid": { "version": "2.0.7", "dev": true, @@ -9638,6 +10329,18 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/safe-buffer": { "version": "5.1.2", "dev": true, @@ -10109,6 +10812,16 @@ "source-map": "^0.6.0" } }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/spdx-correct": { "version": "3.1.1", "dev": true, @@ -10383,6 +11096,15 @@ "node": ">=8.9.0" } }, + "node_modules/style-to-object": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.4.1.tgz", + "integrity": "sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==", + "dev": true, + "dependencies": { + "inline-style-parser": "0.1.1" + } + }, "node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -10661,6 +11383,26 @@ "dev": true, "license": "MIT/X11" }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.1.0.tgz", + "integrity": "sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/truncate-utf8-bytes": { "version": "1.0.2", "dev": true, @@ -10883,6 +11625,37 @@ "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", "dev": true }, + "node_modules/unified": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", + "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "bail": "^2.0.0", + "extend": "^3.0.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unified/node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/uniforms": { "version": "3.7.0", "dev": true, @@ -10970,6 +11743,42 @@ "dev": true, "license": "0BSD" }, + "node_modules/unist-util-generated": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-2.0.1.tgz", + "integrity": "sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.4.tgz", + "integrity": "sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/unist-util-stringify-position": { "version": "3.0.0", "dev": true, @@ -10982,6 +11791,35 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/unist-util-visit": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.1.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/universal-user-agent": { "version": "6.0.0", "dev": true, @@ -11062,6 +11900,19 @@ "dev": true, "license": "WTFPL" }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "dev": true, @@ -11097,6 +11948,24 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/uvu": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/uvu/-/uvu-0.5.6.tgz", + "integrity": "sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==", + "dev": true, + "dependencies": { + "dequal": "^2.0.0", + "diff": "^5.0.0", + "kleur": "^4.0.3", + "sade": "^1.7.3" + }, + "bin": { + "uvu": "bin.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "dev": true, @@ -11114,6 +11983,36 @@ "node": ">= 0.8" } }, + "node_modules/vfile": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^3.0.0", + "vfile-message": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/vscode-extension-tester": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/vscode-extension-tester/-/vscode-extension-tester-5.3.0.tgz", @@ -11683,6 +12582,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/wildcard": { "version": "2.0.0", "dev": true, @@ -11957,6 +12876,16 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } }, "dependencies": { @@ -12249,6 +13178,12 @@ "exenv-es6": "^1.0.0" } }, + "@microsoft/fetch-event-source": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@microsoft/fetch-event-source/-/fetch-event-source-2.0.1.tgz", + "integrity": "sha512-W6CLUJ2eBMw3Rec70qrsEW0jOm/3twwJv21mrmj2yORiaVmVYGS4sSS5yUwvQc1ZlDLYGPnClVWmUUMagKNsfA==", + "dev": true + }, "@nodelib/fs.scandir": { "version": "2.1.5", "dev": true, @@ -12602,6 +13537,15 @@ "@types/node": "*" } }, + "@types/hast": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz", + "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==", + "dev": true, + "requires": { + "@types/unist": "*" + } + }, "@types/html-minifier-terser": { "version": "5.1.1", "dev": true @@ -13401,6 +14345,18 @@ "version": "2.1.0", "dev": true }, + "assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "dev": true, + "requires": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -13443,6 +14399,12 @@ "postcss-value-parser": "^4.2.0" } }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true + }, "azure-devops-node-api": { "version": "11.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-11.2.0.tgz", @@ -13453,6 +14415,12 @@ "typed-rest-client": "^1.8.4" } }, + "bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "dev": true + }, "balanced-match": { "version": "1.0.0", "dev": true @@ -13699,6 +14667,12 @@ "integrity": "sha512-qMBmvmQmFXaSxexkjjfMvD5rnDL0+m+dUMZKoDYsGG8iZN29RuYh9eRoMvKsT6uMAWlyUUGDEQGJJYjzCIO9ew==", "dev": true }, + "ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true + }, "chai": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", @@ -14065,6 +15039,12 @@ "delayed-stream": "~1.0.0" } }, + "comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dev": true + }, "commander": { "version": "2.20.0", "dev": true @@ -14274,6 +15254,15 @@ "version": "4.0.0", "dev": true }, + "decode-named-character-reference": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", + "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + "dev": true, + "requires": { + "character-entities": "^2.0.0" + } + }, "decompress-response": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", @@ -14381,6 +15370,12 @@ "version": "2.3.1", "dev": true }, + "dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true + }, "destroy": { "version": "1.0.4", "dev": true @@ -14626,6 +15621,12 @@ "is-symbol": "^1.0.2" } }, + "es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==", + "dev": true + }, "escalade": { "version": "3.1.1", "dev": true @@ -15203,6 +16204,15 @@ "version": "1.14.8", "dev": true }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, "form-data": { "version": "3.0.1", "dev": true, @@ -15262,12 +16272,14 @@ "dev": true }, "get-intrinsic": { - "version": "1.1.1", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" } }, "get-stream": { @@ -15326,6 +16338,15 @@ "slash": "^3.0.0" } }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.3" + } + }, "got": { "version": "11.8.6", "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", @@ -15417,7 +16438,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.2", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true }, "has-tostringtag": { @@ -15427,6 +16450,12 @@ "has-symbols": "^1.0.2" } }, + "hast-util-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz", + "integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==", + "dev": true + }, "he": { "version": "1.2.0", "dev": true @@ -15758,6 +16787,12 @@ "dev": true, "optional": true }, + "inline-style-parser": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz", + "integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==", + "dev": true + }, "internal-slot": { "version": "1.0.3", "dev": true, @@ -15828,6 +16863,12 @@ "has-tostringtag": "^1.0.0" } }, + "is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "dev": true + }, "is-callable": { "version": "1.2.4", "dev": true @@ -15863,6 +16904,15 @@ "version": "3.0.0", "dev": true }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -15876,6 +16926,16 @@ "version": "2.0.0", "dev": true }, + "is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + } + }, "is-negative-zero": { "version": "2.0.2", "dev": true @@ -15940,6 +17000,19 @@ "has-symbols": "^1.0.2" } }, + "is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, "is-unicode-supported": { "version": "0.1.0", "dev": true @@ -16100,6 +17173,12 @@ "version": "6.0.3", "dev": true }, + "kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true + }, "klona": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz", @@ -16267,6 +17346,12 @@ } } }, + "longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "dev": true + }, "loose-envify": { "version": "1.4.0", "dev": true, @@ -16316,6 +17401,43 @@ "uc.micro": "^1.0.5" } }, + "markdown-table": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.3.tgz", + "integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==", + "dev": true + }, + "mdast-util-definitions": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.2.tgz", + "integrity": "sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "unist-util-visit": "^4.0.0" + } + }, + "mdast-util-find-and-replace": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.2.2.tgz", + "integrity": "sha512-MTtdFRz/eMDHXzeK6W3dO7mXUlF82Gom4y0oOgvHhh/HXZAGvIQDUvQ0SuUx+j2tv44b8xTHOm8K/9OoRFnXKw==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true + } + } + }, "mdast-util-from-markdown": { "version": "1.0.0", "dev": true, @@ -16332,6 +17454,118 @@ "unist-util-stringify-position": "^3.0.0" } }, + "mdast-util-gfm": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-2.0.2.tgz", + "integrity": "sha512-qvZ608nBppZ4icQlhQQIAdc6S3Ffj9RGmzwUKUWuEICFnd1LVkN3EktF7ZHAgfcEdvZB5owU9tQgt99e2TlLjg==", + "dev": true, + "requires": { + "mdast-util-from-markdown": "^1.0.0", + "mdast-util-gfm-autolink-literal": "^1.0.0", + "mdast-util-gfm-footnote": "^1.0.0", + "mdast-util-gfm-strikethrough": "^1.0.0", + "mdast-util-gfm-table": "^1.0.0", + "mdast-util-gfm-task-list-item": "^1.0.0", + "mdast-util-to-markdown": "^1.0.0" + } + }, + "mdast-util-gfm-autolink-literal": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-1.0.3.tgz", + "integrity": "sha512-My8KJ57FYEy2W2LyNom4n3E7hKTuQk/0SES0u16tjA9Z3oFkF4RrC/hPAPgjlSpezsOvI8ObcXcElo92wn5IGA==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "ccount": "^2.0.0", + "mdast-util-find-and-replace": "^2.0.0", + "micromark-util-character": "^1.0.0" + } + }, + "mdast-util-gfm-footnote": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-1.0.2.tgz", + "integrity": "sha512-56D19KOGbE00uKVj3sgIykpwKL179QsVFwx/DCW0u/0+URsryacI4MAdNJl0dh+u2PSsD9FtxPFbHCzJ78qJFQ==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0", + "micromark-util-normalize-identifier": "^1.0.0" + } + }, + "mdast-util-gfm-strikethrough": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-1.0.3.tgz", + "integrity": "sha512-DAPhYzTYrRcXdMjUtUjKvW9z/FNAMTdU0ORyMcbmkwYNbKocDpdk+PX1L1dQgOID/+vVs1uBQ7ElrBQfZ0cuiQ==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0" + } + }, + "mdast-util-gfm-table": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-1.0.7.tgz", + "integrity": "sha512-jjcpmNnQvrmN5Vx7y7lEc2iIOEytYv7rTvu+MeyAsSHTASGCCRA79Igg2uKssgOs1i1po8s3plW0sTu1wkkLGg==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^1.0.0", + "mdast-util-to-markdown": "^1.3.0" + } + }, + "mdast-util-gfm-task-list-item": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-1.0.2.tgz", + "integrity": "sha512-PFTA1gzfp1B1UaiJVyhJZA1rm0+Tzn690frc/L8vNX1Jop4STZgOE6bxUhnzdVSB+vm2GU1tIsuQcA9bxTQpMQ==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0" + } + }, + "mdast-util-phrasing": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-3.0.1.tgz", + "integrity": "sha512-WmI1gTXUBJo4/ZmSk79Wcb2HcjPJBzM1nlI/OUWA8yk2X9ik3ffNbBGsU+09BFmXaL1IBb9fiuvq6/KMiNycSg==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "unist-util-is": "^5.0.0" + } + }, + "mdast-util-to-hast": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-12.3.0.tgz", + "integrity": "sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==", + "dev": true, + "requires": { + "@types/hast": "^2.0.0", + "@types/mdast": "^3.0.0", + "mdast-util-definitions": "^5.0.0", + "micromark-util-sanitize-uri": "^1.1.0", + "trim-lines": "^3.0.0", + "unist-util-generated": "^2.0.0", + "unist-util-position": "^4.0.0", + "unist-util-visit": "^4.0.0" + } + }, + "mdast-util-to-markdown": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz", + "integrity": "sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^3.0.0", + "mdast-util-to-string": "^3.0.0", + "micromark-util-decode-string": "^1.0.0", + "unist-util-visit": "^4.0.0", + "zwitch": "^2.0.0" + } + }, "mdast-util-to-string": { "version": "3.1.0", "dev": true @@ -16416,6 +17650,100 @@ "parse-entities": "^3.0.0" } }, + "micromark-extension-gfm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-2.0.1.tgz", + "integrity": "sha512-p2sGjajLa0iYiGQdT0oelahRYtMWvLjy8J9LOCxzIQsllMCGLbsLW+Nc+N4vi02jcRJvedVJ68cjelKIO6bpDA==", + "dev": true, + "requires": { + "micromark-extension-gfm-autolink-literal": "^1.0.0", + "micromark-extension-gfm-footnote": "^1.0.0", + "micromark-extension-gfm-strikethrough": "^1.0.0", + "micromark-extension-gfm-table": "^1.0.0", + "micromark-extension-gfm-tagfilter": "^1.0.0", + "micromark-extension-gfm-task-list-item": "^1.0.0", + "micromark-util-combine-extensions": "^1.0.0", + "micromark-util-types": "^1.0.0" + } + }, + "micromark-extension-gfm-autolink-literal": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-1.0.3.tgz", + "integrity": "sha512-i3dmvU0htawfWED8aHMMAzAVp/F0Z+0bPh3YrbTPPL1v4YAlCZpy5rBO5p0LPYiZo0zFVkoYh7vDU7yQSiCMjg==", + "dev": true, + "requires": { + "micromark-util-character": "^1.0.0", + "micromark-util-sanitize-uri": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + } + }, + "micromark-extension-gfm-footnote": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-1.0.4.tgz", + "integrity": "sha512-E/fmPmDqLiMUP8mLJ8NbJWJ4bTw6tS+FEQS8CcuDtZpILuOb2kjLqPEeAePF1djXROHXChM/wPJw0iS4kHCcIg==", + "dev": true, + "requires": { + "micromark-core-commonmark": "^1.0.0", + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-normalize-identifier": "^1.0.0", + "micromark-util-sanitize-uri": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + } + }, + "micromark-extension-gfm-strikethrough": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-1.0.4.tgz", + "integrity": "sha512-/vjHU/lalmjZCT5xt7CcHVJGq8sYRm80z24qAKXzaHzem/xsDYb2yLL+NNVbYvmpLx3O7SYPuGL5pzusL9CLIQ==", + "dev": true, + "requires": { + "micromark-util-chunked": "^1.0.0", + "micromark-util-classify-character": "^1.0.0", + "micromark-util-resolve-all": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + } + }, + "micromark-extension-gfm-table": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-1.0.5.tgz", + "integrity": "sha512-xAZ8J1X9W9K3JTJTUL7G6wSKhp2ZYHrFk5qJgY/4B33scJzE2kpfRL6oiw/veJTbt7jiM/1rngLlOKPWr1G+vg==", + "dev": true, + "requires": { + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + } + }, + "micromark-extension-gfm-tagfilter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-1.0.1.tgz", + "integrity": "sha512-Ty6psLAcAjboRa/UKUbbUcwjVAv5plxmpUTy2XC/3nJFL37eHej8jrHrRzkqcpipJliuBH30DTs7+3wqNcQUVA==", + "dev": true, + "requires": { + "micromark-util-types": "^1.0.0" + } + }, + "micromark-extension-gfm-task-list-item": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-1.0.3.tgz", + "integrity": "sha512-PpysK2S1Q/5VXi72IIapbi/jliaiOFzv7THH4amwXeYXLq3l1uo8/2Be0Ac1rEwK20MQEsGH2ltAZLNY2KI/0Q==", + "dev": true, + "requires": { + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + } + }, "micromark-factory-destination": { "version": "1.0.0", "dev": true, @@ -16501,6 +17829,18 @@ "micromark-util-symbol": "^1.0.0" } }, + "micromark-util-decode-string": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.0.2.tgz", + "integrity": "sha512-DLT5Ho02qr6QWVNYbRZ3RYOSSWWFuH3tJexd3dgN1odEuPNxCngTCXJum7+ViRAd9BbdxCvMToPOD/IvVhzG6Q==", + "dev": true, + "requires": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-decode-numeric-character-reference": "^1.0.0", + "micromark-util-symbol": "^1.0.0" + } + }, "micromark-util-encode": { "version": "1.0.0", "dev": true @@ -16524,7 +17864,9 @@ } }, "micromark-util-sanitize-uri": { - "version": "1.0.0", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.1.0.tgz", + "integrity": "sha512-RoxtuSCX6sUNtxhbmsEFQfWzs8VN7cTctmBPvYivo98xb/kDEoTCtJQX5wyzIYEmk/lvNFTat4hL8oW0KndFpg==", "dev": true, "requires": { "micromark-util-character": "^1.0.0", @@ -16740,6 +18082,12 @@ } } }, + "mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true + }, "mrmime": { "version": "1.0.0", "dev": true @@ -17493,6 +18841,12 @@ "renderkid": "^2.0.4" } }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "dev": true @@ -17506,6 +18860,12 @@ "react-is": "^16.8.1" } }, + "property-information": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.2.0.tgz", + "integrity": "sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg==", + "dev": true + }, "proxy-addr": { "version": "2.0.7", "dev": true, @@ -18146,6 +19506,37 @@ "version": "16.13.1", "dev": true }, + "react-markdown": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-8.0.5.tgz", + "integrity": "sha512-jGJolWWmOWAvzf+xMdB9zwStViODyyFQhNB/bwCerbBKmrTmgmA599CGiOlP58OId1IMoIRsA8UdI1Lod4zb5A==", + "dev": true, + "requires": { + "@types/hast": "^2.0.0", + "@types/prop-types": "^15.0.0", + "@types/unist": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^2.0.0", + "prop-types": "^15.0.0", + "property-information": "^6.0.0", + "react-is": "^18.0.0", + "remark-parse": "^10.0.0", + "remark-rehype": "^10.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-object": "^0.4.0", + "unified": "^10.0.0", + "unist-util-visit": "^4.0.0", + "vfile": "^5.0.0" + }, + "dependencies": { + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + } + } + }, "react-onclickoutside": { "version": "6.12.0", "dev": true, @@ -18299,6 +19690,41 @@ "version": "0.2.7", "dev": true }, + "remark-gfm": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-3.0.1.tgz", + "integrity": "sha512-lEFDoi2PICJyNrACFOfDD3JlLkuSbOa5Wd8EPt06HUdptv8Gn0bxYTdbU/XXQ3swAPkEaGxxPN9cbnMHvVu1Ig==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "mdast-util-gfm": "^2.0.0", + "micromark-extension-gfm": "^2.0.0", + "unified": "^10.0.0" + } + }, + "remark-parse": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.1.tgz", + "integrity": "sha512-1fUyHr2jLsVOkhbvPRBJ5zTKZZyD6yZzYaWCS6BPBdQ8vEMBCH+9zNCDA6tET/zHCi/jLqjCWtlJZUPk+DbnFw==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.0", + "mdast-util-from-markdown": "^1.0.0", + "unified": "^10.0.0" + } + }, + "remark-rehype": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-10.1.0.tgz", + "integrity": "sha512-EFmR5zppdBp0WQeDVZ/b66CWJipB2q2VLNFMabzDSGR66Z2fQii83G5gTBbgGEnEEA0QRussvrFHxk1HWGJskw==", + "dev": true, + "requires": { + "@types/hast": "^2.0.0", + "@types/mdast": "^3.0.0", + "mdast-util-to-hast": "^12.1.0", + "unified": "^10.0.0" + } + }, "renderkid": { "version": "2.0.7", "dev": true, @@ -18399,6 +19825,15 @@ "queue-microtask": "^1.2.2" } }, + "sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "requires": { + "mri": "^1.1.0" + } + }, "safe-buffer": { "version": "5.1.2", "dev": true @@ -18733,6 +20168,12 @@ "source-map": "^0.6.0" } }, + "space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dev": true + }, "spdx-correct": { "version": "3.1.1", "dev": true, @@ -18917,6 +20358,15 @@ } } }, + "style-to-object": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.4.1.tgz", + "integrity": "sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==", + "dev": true, + "requires": { + "inline-style-parser": "0.1.1" + } + }, "supports-color": { "version": "7.2.0", "dev": true, @@ -19101,6 +20551,18 @@ "version": "0.3.9", "dev": true }, + "trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dev": true + }, + "trough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.1.0.tgz", + "integrity": "sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==", + "dev": true + }, "truncate-utf8-bytes": { "version": "1.0.2", "dev": true, @@ -19262,6 +20724,29 @@ "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", "dev": true }, + "unified": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", + "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0", + "bail": "^2.0.0", + "extend": "^3.0.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^5.0.0" + }, + "dependencies": { + "is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "dev": true + } + } + }, "uniforms": { "version": "3.7.0", "dev": true, @@ -19326,6 +20811,30 @@ } } }, + "unist-util-generated": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-2.0.1.tgz", + "integrity": "sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A==", + "dev": true + }, + "unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0" + } + }, + "unist-util-position": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.4.tgz", + "integrity": "sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0" + } + }, "unist-util-stringify-position": { "version": "3.0.0", "dev": true, @@ -19333,6 +20842,27 @@ "@types/unist": "^2.0.0" } }, + "unist-util-visit": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.1.1" + } + }, + "unist-util-visit-parents": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + } + }, "universal-user-agent": { "version": "6.0.0", "dev": true @@ -19384,6 +20914,19 @@ "version": "1.0.4", "dev": true }, + "util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "util-deprecate": { "version": "1.0.2", "dev": true @@ -19408,6 +20951,18 @@ "version": "8.3.2", "dev": true }, + "uvu": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/uvu/-/uvu-0.5.6.tgz", + "integrity": "sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==", + "dev": true, + "requires": { + "dequal": "^2.0.0", + "diff": "^5.0.0", + "kleur": "^4.0.3", + "sade": "^1.7.3" + } + }, "validate-npm-package-license": { "version": "3.0.4", "dev": true, @@ -19420,6 +20975,28 @@ "version": "1.1.2", "dev": true }, + "vfile": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^3.0.0", + "vfile-message": "^3.0.0" + } + }, + "vfile-message": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^3.0.0" + } + }, "vscode-extension-tester": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/vscode-extension-tester/-/vscode-extension-tester-5.3.0.tgz", @@ -19793,6 +21370,20 @@ "is-symbol": "^1.0.3" } }, + "which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + } + }, "wildcard": { "version": "2.0.0", "dev": true @@ -19979,6 +21570,12 @@ "yocto-queue": { "version": "0.1.0", "dev": true + }, + "zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true } } } diff --git a/package.json b/package.json index 41906011..54a288aa 100644 --- a/package.json +++ b/package.json @@ -1868,6 +1868,11 @@ "title": "Preview content", "category": "Front Matter" }, + { + "command": "frontMatter.chatbot", + "title": "Ask a bot to help you configure Front Matter", + "category": "Front Matter" + }, { "command": "frontMatter.promoteSettings", "title": "Promote settings from local to team level", @@ -2270,6 +2275,7 @@ "@headlessui/react": "1.5.0", "@heroicons/react": "1.0.4", "@iarna/toml": "2.2.3", + "@microsoft/fetch-event-source": "^2.0.1", "@octokit/rest": "^18.12.0", "@popperjs/core": "^2.11.6", "@sentry/react": "^6.13.3", @@ -2300,6 +2306,7 @@ "@webpack-cli/serve": "^1.6.0", "ajv": "^8.8.2", "array-move": "^4.0.0", + "assert": "^2.0.0", "autoprefixer": "^10.4.13", "chai": "^4.3.6", "css-loader": "5.2.7", @@ -2331,16 +2338,19 @@ "postcss-loader": "^7.0.2", "prettier": "^2.8.3", "prettier-plugin-tailwindcss": "^0.2.2", + "process": "^0.11.10", "react": "17.0.1", "react-datepicker": "4.2.1", "react-dom": "17.0.1", "react-dropzone": "^11.3.4", + "react-markdown": "^8.0.5", "react-popper": "^2.3.0", "react-quill": "^2.0.0-beta.4", "react-router-dom": "^6.3.0", "react-sortable-hoc": "^2.0.0", "react-toastify": "^8.1.0", "recoil": "^0.4.1", + "remark-gfm": "^3.0.1", "rimraf": "^3.0.2", "semver": "^7.3.7", "simple-git": "^3.10.0", diff --git a/src/commands/Chatbot.ts b/src/commands/Chatbot.ts new file mode 100644 index 00000000..2d35b9e5 --- /dev/null +++ b/src/commands/Chatbot.ts @@ -0,0 +1,122 @@ +import { processFmPlaceholders } from './../helpers/processFmPlaceholders'; +import { processPathPlaceholders } from './../helpers/processPathPlaceholders'; +import { Telemetry } from './../helpers/Telemetry'; +import { + SETTING_PREVIEW_HOST, + SETTING_PREVIEW_PATHNAME, + CONTEXT, + TelemetryEvent, + PreviewCommands, + SETTING_EXPERIMENTAL, + SETTING_DATE_FORMAT +} from './../constants'; +import { ArticleHelper } from './../helpers/ArticleHelper'; +import { join } from 'path'; +import { commands, env, Uri, ViewColumn, window } from 'vscode'; +import { Extension, parseWinPath, processKnownPlaceholders, Settings } from '../helpers'; +import { ContentFolder, ContentType, PreviewSettings } from '../models'; +import { format } from 'date-fns'; +import { DateHelper } from '../helpers/DateHelper'; +import { Article } from '.'; +import { urlJoin } from 'url-join-ts'; +import { WebviewHelper } from '@estruyf/vscode'; +import { Folders } from './Folders'; + +export class Chatbot { + /** + * Open the Chatbot in the editor + */ + public static async open(extensionPath: string) { + // Create the preview webview + const webView = window.createWebviewPanel( + 'frontMatterChatbot', + 'Front Matter - Ask me anything', + { + viewColumn: ViewColumn.Beside, + preserveFocus: true + }, + { + enableScripts: true + } + ); + + webView.iconPath = { + dark: Uri.file(join(extensionPath, 'assets/icons/frontmatter-short-dark.svg')), + light: Uri.file(join(extensionPath, 'assets/icons/frontmatter-short-light.svg')) + }; + + const cspSource = webView.webview.cspSource; + + webView.webview.onDidReceiveMessage((message) => { + switch (message.command) { + case PreviewCommands.toVSCode.open: + if (message.data) { + commands.executeCommand('vscode.open', message.data); + } + return; + } + }); + + const dashboardFile = 'dashboardWebView.js'; + const localPort = `9000`; + const localServerUrl = `localhost:${localPort}`; + + const nonce = WebviewHelper.getNonce(); + + const ext = Extension.getInstance(); + const isProd = ext.isProductionMode; + const version = ext.getVersion(); + const isBeta = ext.isBetaVersion(); + const extensionUri = ext.extensionPath; + + const csp = [ + `default-src 'none';`, + `img-src ${cspSource} http: https:;`, + `script-src ${ + isProd ? `'nonce-${nonce}'` : `http://${localServerUrl} http://0.0.0.0:${localPort}` + } 'unsafe-eval'`, + `style-src ${cspSource} 'self' 'unsafe-inline' http: https:`, + `connect-src https://* ${ + isProd + ? `` + : `ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}` + }` + ]; + + let scriptUri = ''; + if (isProd) { + scriptUri = webView.webview + .asWebviewUri(Uri.joinPath(extensionUri, 'dist', dashboardFile)) + .toString(); + } else { + scriptUri = `http://${localServerUrl}/${dashboardFile}`; + } + + // Get experimental setting + const experimental = Settings.get(SETTING_EXPERIMENTAL); + + webView.webview.html = ` + + + + + + + + Front Matter Docs Chatbot + + +
    + + + + + `; + + Telemetry.send(TelemetryEvent.openChatbot); + } +} diff --git a/src/commands/index.ts b/src/commands/index.ts index 7c391ede..0d3b53d0 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,6 +1,7 @@ export * from './Article'; export * from './Backers'; export * from './Cache'; +export * from './Chatbot'; export * from './Content'; export * from './Dashboard'; export * from './Diagnostics'; diff --git a/src/constants/Extension.ts b/src/constants/Extension.ts index 2cd9f3ad..e0db6fa7 100644 --- a/src/constants/Extension.ts +++ b/src/constants/Extension.ts @@ -28,6 +28,7 @@ export const COMMAND_NAME = { initTemplate: getCommandName('initTemplate'), collapseSections: getCommandName('collapseSections'), preview: getCommandName('preview'), + chatbot: getCommandName('chatbot'), dashboard: getCommandName('dashboard'), dashboardMedia: getCommandName('dashboard.media'), dashboardSnippets: getCommandName('dashboard.snippets'), diff --git a/src/constants/TelemetryEvent.ts b/src/constants/TelemetryEvent.ts index 5f5e238a..7d2f5a80 100644 --- a/src/constants/TelemetryEvent.ts +++ b/src/constants/TelemetryEvent.ts @@ -28,6 +28,9 @@ export const TelemetryEvent = { updateMediaMetadata: 'updateMediaMetadata', openExplorerView: 'openExplorerView', + // Chatbot + openChatbot: 'openChatbot', + // Content types generateContentType: 'generateContentType', addMissingFields: 'addMissingFields', diff --git a/src/dashboardWebView/components/Chatbot/Chatbot.tsx b/src/dashboardWebView/components/Chatbot/Chatbot.tsx new file mode 100644 index 00000000..46d4b1b4 --- /dev/null +++ b/src/dashboardWebView/components/Chatbot/Chatbot.tsx @@ -0,0 +1,296 @@ +import * as React from 'react'; +import { InitResponse } from './models/InitResponse'; +import { NewConversationResponse } from './models/NewConversationResponse'; +import { fetchEventSource } from '@microsoft/fetch-event-source'; +import { ChatIcon, PaperAirplaneIcon, ThumbDownIcon, ThumbUpIcon } from '@heroicons/react/outline'; +import { ThumbDownIcon as ThumbDownSolidIcon, ThumbUpIcon as ThumbUpSolidIcon } from '@heroicons/react/solid'; +import ReactMarkdown from 'react-markdown' +import remarkGfm from 'remark-gfm' +import { useCallback, useEffect } from 'react'; + +export interface IChatbotProps { } + +export const Chatbot: React.FunctionComponent = (props: React.PropsWithChildren) => { + const [company, setCompany] = React.useState(undefined); + const [chatId, setChatId] = React.useState(undefined); + const [message, setMessage] = React.useState(""); + const [questions, setQuestions] = React.useState([]); + const [answers, setAnswers] = React.useState([]); + const [answerIds, setAnswerIds] = React.useState([]); + const [sources, setSources] = React.useState([]); + const [loading, setLoading] = React.useState(false); + + const [upVote, setUpVotes] = React.useState([]); + const [downVote, setDownvotes] = React.useState([]); + + const init = async () => { + setLoading(true); + const initResponse = await fetch('https://aijsplayground-production.up.railway.app/initializeMendable', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + anon_key: "466f5321-12d9-4d64-9e5b-ea5db41ed2ba" + }) + }); + + if (!initResponse.ok) { + return; + } + + const initJson: InitResponse = await initResponse.json(); + + const newChatResponse = await fetch('https://aijsplayground-production.up.railway.app/newConversation', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + anon_key: "466f5321-12d9-4d64-9e5b-ea5db41ed2ba", + messages: [] + }) + }) + + if (!newChatResponse.ok) { + return; + } + + const newChat: NewConversationResponse = await newChatResponse.json(); + + setCompany(initJson.company.name); + setChatId(newChat.conversation_id); + setLoading(false); + }; + + const onUpVote = useCallback(async (index: number) => { + setUpVotes(prev => [...prev, index]) + setDownvotes(prev => prev.filter(i => i !== index)) + callVote(index, true) + }, []); + + const onDownVote = useCallback(async (index: number) => { + setDownvotes(prev => [...prev, index]) + setUpVotes(prev => prev.filter(i => i !== index)) + callVote(index, false) + }, []); + + const callVote = async (index: number, vote: boolean) => { + await fetch(`https://aijsplayground-production.up.railway.app/updateMessageRating/${index}`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + ratingValue: vote ? 1 : -1, + }) + }) + } + + const callChatbot = useCallback(async () => { + const nrOfQuestions = questions.length + 1; + setLoading(true); + + setQuestions(prev => [...prev, message]) + setAnswers(prev => [...prev, ""]) + setSources(prev => [...prev, []]) + setAnswerIds(prev => [...prev, 0]) + + setTimeout(() => { + setMessage("") + }, 0); + + if (!company || !chatId) { + return; + } + + await fetchEventSource('https://aijsplayground-production.up.railway.app/qaChat', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'accept': 'application/json', + }, + body: JSON.stringify({ + company: company, + conversation_id: chatId, + history: [{ prompt: "", response: "", sources: [] }], + question: message, + }), + onmessage: (event) => { + setLoading(false); + const data = JSON.parse(event.data); + const chunk = data.chunk; + + if (chunk === "<|source|>") { + setSources(prev => { + const metadata = [...new Set(data.metadata.map((m: any) => m.link))] as string[] + + const crntSources: string[][] = Object.assign([], prev) + if (crntSources.length === nrOfQuestions) { + crntSources[nrOfQuestions - 1] = metadata; + } else { + crntSources.push(metadata); + } + + return crntSources; + }); + } else if (chunk === "<|message_id|>" && data.metadata) { + setAnswerIds(prev => { + const crntAnswerIds: number[] = Object.assign([], prev) + if (crntAnswerIds.length === nrOfQuestions) { + crntAnswerIds[nrOfQuestions - 1] = data.metadata; + } else { + crntAnswerIds.push(data.metadata); + } + + return crntAnswerIds; + }); + } else { + setAnswers(prev => { + const crntAnswers: string[] = Object.assign([], prev) + if (crntAnswers.length === nrOfQuestions) { + crntAnswers[nrOfQuestions - 1] = crntAnswers[nrOfQuestions - 1] + chunk; + } else { + crntAnswers.push(chunk); + } + + return crntAnswers; + }); + } + } + }); + }, [company, chatId, message, questions]); + + useEffect(() => { + init(); + }, []); + + return ( +
    +
    +

    + + Ask Font Matter AI +

    +

    + Our AI, powered by mendable.ai, has processed the documentation and can assist you with any queries regarding Front Matter. Go ahead and ask away! +

    +
    + +
    + +
    +
    + { + questions.map((question, idx) => ( +
      +
    • {question}
    • + {answers.length > 0 && answers[idx] && ( +
    • +
      +

      Answer

      + + { + answerIds[idx] && ( +
      + + +
      + ) + } +
      + + + + { + sources[idx].length > 0 && sources[idx] && ( +
      +

      Resources

      +
        + {sources[idx].map((source, idx) => ( +
      • + {source} +
      • + ))} +
      +
      + ) + } + +
      + Warning: Anwers might be wrong. In case of doubt, please consult the docs. +
      +
    • + )} +
    + )) + } +
    + + { + loading && ( +
    +
    +
    +
    +
    +
    +
    + ) + } +
    + +