@canonical/react-ds-app-launchpad 0.7.1-experimental.0 → 0.9.0-experimental.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/ui/EditableBlock/Context.js +4 -0
- package/dist/esm/ui/EditableBlock/Context.js.map +1 -0
- package/dist/esm/ui/EditableBlock/EditableBlock.js +33 -0
- package/dist/esm/ui/EditableBlock/EditableBlock.js.map +1 -0
- package/dist/esm/ui/EditableBlock/EditableBlock.test.js +57 -0
- package/dist/esm/ui/EditableBlock/EditableBlock.test.js.map +1 -0
- package/dist/esm/ui/EditableBlock/hooks/index.js +2 -0
- package/dist/esm/ui/EditableBlock/hooks/index.js.map +1 -0
- package/dist/esm/ui/EditableBlock/hooks/useEditableBlock.js +11 -0
- package/dist/esm/ui/EditableBlock/hooks/useEditableBlock.js.map +1 -0
- package/dist/esm/ui/EditableBlock/index.js +3 -0
- package/dist/esm/ui/EditableBlock/index.js.map +1 -0
- package/dist/esm/ui/EditableBlock/styles.css +38 -0
- package/dist/esm/ui/EditableBlock/types.js.map +1 -0
- package/dist/esm/ui/FileTree/Context.js +4 -0
- package/dist/esm/ui/FileTree/Context.js.map +1 -0
- package/dist/esm/ui/FileTree/Provider.js +74 -0
- package/dist/esm/ui/FileTree/Provider.js.map +1 -0
- package/dist/esm/ui/FileTree/common/File/File.js +12 -0
- package/dist/esm/ui/FileTree/common/File/File.js.map +1 -0
- package/dist/esm/ui/FileTree/common/File/index.js +4 -0
- package/dist/esm/ui/FileTree/common/File/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/File/styles.css +4 -0
- package/dist/esm/ui/FileTree/common/File/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Folder/Folder.js +12 -0
- package/dist/esm/ui/FileTree/common/Folder/Folder.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Folder/index.js +4 -0
- package/dist/esm/ui/FileTree/common/Folder/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Folder/styles.css +4 -0
- package/dist/esm/ui/FileTree/common/Folder/types.js +2 -0
- package/dist/esm/ui/FileTree/common/Folder/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/IndentationBlock.js +16 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/IndentationBlock.js.map +1 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/index.js +4 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/styles.css +32 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/types.js +2 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/Context.js +10 -0
- package/dist/esm/ui/FileTree/common/Node/Context.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/Provider.js +163 -0
- package/dist/esm/ui/FileTree/common/Node/Provider.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/hooks/index.js +2 -0
- package/dist/esm/ui/FileTree/common/Node/hooks/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/hooks/useNode.js +12 -0
- package/dist/esm/ui/FileTree/common/Node/hooks/useNode.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/index.js +4 -0
- package/dist/esm/ui/FileTree/common/Node/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/styles.css +60 -0
- package/dist/esm/ui/FileTree/common/Node/types.js +2 -0
- package/dist/esm/ui/FileTree/common/Node/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/SearchBox/SearchBox.js +31 -0
- package/dist/esm/ui/FileTree/common/SearchBox/SearchBox.js.map +1 -0
- package/dist/esm/ui/FileTree/common/SearchBox/index.js +4 -0
- package/dist/esm/ui/FileTree/common/SearchBox/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/SearchBox/styles.css +61 -0
- package/dist/esm/ui/FileTree/common/SearchBox/types.js +2 -0
- package/dist/esm/ui/FileTree/common/SearchBox/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/TreeView/TreeView.js +60 -0
- package/dist/esm/ui/FileTree/common/TreeView/TreeView.js.map +1 -0
- package/dist/esm/ui/FileTree/common/TreeView/index.js +4 -0
- package/dist/esm/ui/FileTree/common/TreeView/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/TreeView/types.js +2 -0
- package/dist/esm/ui/FileTree/common/TreeView/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/index.js +5 -0
- package/dist/esm/ui/FileTree/common/index.js.map +1 -0
- package/dist/esm/ui/FileTree/hooks/index.js +2 -0
- package/dist/esm/ui/FileTree/hooks/index.js.map +1 -0
- package/dist/esm/ui/FileTree/hooks/useFileTree.js +11 -0
- package/dist/esm/ui/FileTree/hooks/useFileTree.js.map +1 -0
- package/dist/esm/ui/FileTree/index.js +10 -0
- package/dist/esm/ui/FileTree/index.js.map +1 -0
- package/dist/esm/ui/FileTree/styles.css +47 -0
- package/dist/esm/ui/FileTree/types.js +2 -0
- package/dist/esm/ui/{Button → FileTree}/types.js.map +1 -1
- package/dist/esm/ui/FileTree/utils/hashNodeName.js +11 -0
- package/dist/esm/ui/FileTree/utils/hashNodeName.js.map +1 -0
- package/dist/esm/ui/FileTree/utils/index.js +2 -0
- package/dist/esm/ui/FileTree/utils/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/Context.js +4 -0
- package/dist/esm/ui/GitDiffViewer/Context.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/Provider.js +31 -0
- package/dist/esm/ui/GitDiffViewer/Provider.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/CodeDiffViewer.js +119 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/CodeDiffViewer.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/HighlighTheme.css +171 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/DiffLine.js +33 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/DiffLine.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/index.js +4 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/styles.css +111 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/types.js +2 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/types.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/index.js +2 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/index.js +4 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/styles.css +39 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/types.js +2 -0
- package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/types.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/FileHeader/FileHeader.js +35 -0
- package/dist/esm/ui/GitDiffViewer/common/FileHeader/FileHeader.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/FileHeader/index.js +4 -0
- package/dist/esm/ui/GitDiffViewer/common/FileHeader/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/FileHeader/styles.css +75 -0
- package/dist/esm/ui/GitDiffViewer/common/FileHeader/types.js +2 -0
- package/dist/esm/ui/GitDiffViewer/common/FileHeader/types.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/common/index.js +3 -0
- package/dist/esm/ui/GitDiffViewer/common/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/hooks/index.js +2 -0
- package/dist/esm/ui/GitDiffViewer/hooks/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/hooks/useGitDiffViewer.js +11 -0
- package/dist/esm/ui/GitDiffViewer/hooks/useGitDiffViewer.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/index.js +9 -0
- package/dist/esm/ui/GitDiffViewer/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/styles.css +38 -0
- package/dist/esm/ui/GitDiffViewer/types.js +2 -0
- package/dist/esm/ui/GitDiffViewer/types.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/utils/index.js +2 -0
- package/dist/esm/ui/GitDiffViewer/utils/index.js.map +1 -0
- package/dist/esm/ui/GitDiffViewer/utils/parseGitDiff.js +73 -0
- package/dist/esm/ui/GitDiffViewer/utils/parseGitDiff.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/MarkdownEditor.js +74 -0
- package/dist/esm/ui/MarkdownEditor/MarkdownEditor.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/Toolbar.js +52 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/Toolbar.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Button/Button.js +19 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Button/Button.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Button/index.js +4 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Button/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Button/styles.css +17 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Button/types.js +2 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Button/types.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Group/Group.js +13 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Group/Group.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Group/index.js +4 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Group/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Group/styles.css +7 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Group/types.js +2 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Group/types.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Separator/Separator.js +13 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Separator/Separator.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Separator/index.js +4 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Separator/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Separator/styles.css +7 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Separator/types.js +2 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/Separator/types.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/index.js +4 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/common/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/index.js +9 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/styles.css +16 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/types.js +2 -0
- package/dist/esm/ui/MarkdownEditor/common/Toolbar/types.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/ViewModeTabs/ViewModeTabs.js +34 -0
- package/dist/esm/ui/MarkdownEditor/common/ViewModeTabs/ViewModeTabs.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/ViewModeTabs/index.js +4 -0
- package/dist/esm/ui/MarkdownEditor/common/ViewModeTabs/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/ViewModeTabs/styles.css +42 -0
- package/dist/esm/ui/MarkdownEditor/common/ViewModeTabs/types.js +2 -0
- package/dist/esm/ui/MarkdownEditor/common/ViewModeTabs/types.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/icons.js +10 -0
- package/dist/esm/ui/MarkdownEditor/common/icons.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/common/index.js +4 -0
- package/dist/esm/ui/MarkdownEditor/common/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/hooks/index.js +2 -0
- package/dist/esm/ui/MarkdownEditor/hooks/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/hooks/useEditor.js +277 -0
- package/dist/esm/ui/MarkdownEditor/hooks/useEditor.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/index.js +4 -0
- package/dist/esm/ui/MarkdownEditor/index.js.map +1 -0
- package/dist/esm/ui/MarkdownEditor/styles.css +69 -0
- package/dist/esm/ui/MarkdownEditor/types.js +2 -0
- package/dist/esm/ui/MarkdownEditor/types.js.map +1 -0
- package/dist/esm/ui/RelativeTime/RelativeTime.js +66 -0
- package/dist/esm/ui/RelativeTime/RelativeTime.js.map +1 -0
- package/dist/esm/ui/RelativeTime/index.js +4 -0
- package/dist/esm/ui/RelativeTime/index.js.map +1 -0
- package/dist/esm/ui/RelativeTime/types.js +2 -0
- package/dist/esm/ui/{Chip → RelativeTime}/types.js.map +1 -1
- package/dist/esm/ui/RelativeTime/utils/constants.js +6 -0
- package/dist/esm/ui/RelativeTime/utils/constants.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/formatHumanTime.js +43 -0
- package/dist/esm/ui/RelativeTime/utils/formatHumanTime.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/getOptimalUpdateInterval.js +24 -0
- package/dist/esm/ui/RelativeTime/utils/getOptimalUpdateInterval.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/index.js +4 -0
- package/dist/esm/ui/RelativeTime/utils/index.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/parseInstant.js +22 -0
- package/dist/esm/ui/RelativeTime/utils/parseInstant.js.map +1 -0
- package/dist/esm/ui/index.js +5 -1
- package/dist/esm/ui/index.js.map +1 -1
- package/dist/types/ui/EditableBlock/Context.d.ts +4 -0
- package/dist/types/ui/EditableBlock/Context.d.ts.map +1 -0
- package/dist/types/ui/EditableBlock/EditableBlock.d.ts +10 -0
- package/dist/types/ui/EditableBlock/EditableBlock.d.ts.map +1 -0
- package/dist/types/ui/EditableBlock/EditableBlock.test.d.ts +2 -0
- package/dist/types/ui/EditableBlock/EditableBlock.test.d.ts.map +1 -0
- package/dist/types/ui/EditableBlock/hooks/index.d.ts +2 -0
- package/dist/types/ui/EditableBlock/hooks/index.d.ts.map +1 -0
- package/dist/types/ui/EditableBlock/hooks/useEditableBlock.d.ts +4 -0
- package/dist/types/ui/EditableBlock/hooks/useEditableBlock.d.ts.map +1 -0
- package/dist/types/ui/EditableBlock/index.d.ts +3 -0
- package/dist/types/ui/EditableBlock/index.d.ts.map +1 -0
- package/dist/types/ui/EditableBlock/types.d.ts +24 -0
- package/dist/types/ui/EditableBlock/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/Context.d.ts +4 -0
- package/dist/types/ui/FileTree/Context.d.ts.map +1 -0
- package/dist/types/ui/FileTree/Provider.d.ts +7 -0
- package/dist/types/ui/FileTree/Provider.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/File/File.d.ts +10 -0
- package/dist/types/ui/FileTree/common/File/File.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/File/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/File/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/File/types.d.ts +16 -0
- package/dist/types/ui/FileTree/common/File/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Folder/Folder.d.ts +10 -0
- package/dist/types/ui/FileTree/common/Folder/Folder.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Folder/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/Folder/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Folder/types.d.ts +16 -0
- package/dist/types/ui/FileTree/common/Folder/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/IndentationBlock.d.ts +10 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/IndentationBlock.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/types.d.ts +12 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/Context.d.ts +5 -0
- package/dist/types/ui/FileTree/common/Node/Context.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/Provider.d.ts +6 -0
- package/dist/types/ui/FileTree/common/Node/Provider.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/hooks/index.d.ts +2 -0
- package/dist/types/ui/FileTree/common/Node/hooks/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/hooks/useNode.d.ts +3 -0
- package/dist/types/ui/FileTree/common/Node/hooks/useNode.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/index.d.ts +5 -0
- package/dist/types/ui/FileTree/common/Node/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/types.d.ts +28 -0
- package/dist/types/ui/FileTree/common/Node/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/SearchBox/SearchBox.d.ts +10 -0
- package/dist/types/ui/FileTree/common/SearchBox/SearchBox.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/SearchBox/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/SearchBox/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/SearchBox/types.d.ts +12 -0
- package/dist/types/ui/FileTree/common/SearchBox/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/TreeView/TreeView.d.ts +16 -0
- package/dist/types/ui/FileTree/common/TreeView/TreeView.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/TreeView/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/TreeView/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/TreeView/types.d.ts +20 -0
- package/dist/types/ui/FileTree/common/TreeView/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/index.d.ts +5 -0
- package/dist/types/ui/FileTree/common/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/hooks/index.d.ts +2 -0
- package/dist/types/ui/FileTree/hooks/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/hooks/useFileTree.d.ts +3 -0
- package/dist/types/ui/FileTree/hooks/useFileTree.d.ts.map +1 -0
- package/dist/types/ui/FileTree/index.d.ts +5 -0
- package/dist/types/ui/FileTree/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/types.d.ts +69 -0
- package/dist/types/ui/FileTree/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/utils/hashNodeName.d.ts +3 -0
- package/dist/types/ui/FileTree/utils/hashNodeName.d.ts.map +1 -0
- package/dist/types/ui/FileTree/utils/index.d.ts +2 -0
- package/dist/types/ui/FileTree/utils/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/Context.d.ts +4 -0
- package/dist/types/ui/GitDiffViewer/Context.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/Provider.d.ts +5 -0
- package/dist/types/ui/GitDiffViewer/Provider.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/CodeDiffViewer.d.ts +16 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/CodeDiffViewer.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/DiffLine.d.ts +11 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/DiffLine.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/index.d.ts +3 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/types.d.ts +20 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/types.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/index.d.ts +2 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/index.d.ts +3 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/types.d.ts +18 -0
- package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/types.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/FileHeader/FileHeader.d.ts +15 -0
- package/dist/types/ui/GitDiffViewer/common/FileHeader/FileHeader.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/FileHeader/index.d.ts +3 -0
- package/dist/types/ui/GitDiffViewer/common/FileHeader/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/FileHeader/types.d.ts +17 -0
- package/dist/types/ui/GitDiffViewer/common/FileHeader/types.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/common/index.d.ts +3 -0
- package/dist/types/ui/GitDiffViewer/common/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/hooks/index.d.ts +2 -0
- package/dist/types/ui/GitDiffViewer/hooks/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/hooks/useGitDiffViewer.d.ts +3 -0
- package/dist/types/ui/GitDiffViewer/hooks/useGitDiffViewer.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/index.d.ts +6 -0
- package/dist/types/ui/GitDiffViewer/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/types.d.ts +77 -0
- package/dist/types/ui/GitDiffViewer/types.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/utils/index.d.ts +2 -0
- package/dist/types/ui/GitDiffViewer/utils/index.d.ts.map +1 -0
- package/dist/types/ui/GitDiffViewer/utils/parseGitDiff.d.ts +4 -0
- package/dist/types/ui/GitDiffViewer/utils/parseGitDiff.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/MarkdownEditor.d.ts +10 -0
- package/dist/types/ui/MarkdownEditor/MarkdownEditor.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/Toolbar.d.ts +8 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Button/Button.d.ts +9 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Button/Button.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Button/index.d.ts +3 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Button/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Button/types.d.ts +14 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Button/types.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Group/Group.d.ts +9 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Group/Group.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Group/index.d.ts +3 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Group/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Group/types.d.ts +14 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Group/types.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Separator/Separator.d.ts +9 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Separator/Separator.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Separator/index.d.ts +3 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Separator/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Separator/types.d.ts +10 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/Separator/types.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/index.d.ts +4 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/common/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/index.d.ts +4 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/types.d.ts +20 -0
- package/dist/types/ui/MarkdownEditor/common/Toolbar/types.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/ViewModeTabs/ViewModeTabs.d.ts +9 -0
- package/dist/types/ui/MarkdownEditor/common/ViewModeTabs/ViewModeTabs.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/ViewModeTabs/index.d.ts +3 -0
- package/dist/types/ui/MarkdownEditor/common/ViewModeTabs/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/ViewModeTabs/types.d.ts +14 -0
- package/dist/types/ui/MarkdownEditor/common/ViewModeTabs/types.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/icons.d.ts +9 -0
- package/dist/types/ui/MarkdownEditor/common/icons.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/common/index.d.ts +4 -0
- package/dist/types/ui/MarkdownEditor/common/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/hooks/index.d.ts +2 -0
- package/dist/types/ui/MarkdownEditor/hooks/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/hooks/useEditor.d.ts +40 -0
- package/dist/types/ui/MarkdownEditor/hooks/useEditor.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/index.d.ts +3 -0
- package/dist/types/ui/MarkdownEditor/index.d.ts.map +1 -0
- package/dist/types/ui/MarkdownEditor/types.d.ts +44 -0
- package/dist/types/ui/MarkdownEditor/types.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/RelativeTime.d.ts +11 -0
- package/dist/types/ui/RelativeTime/RelativeTime.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/index.d.ts +3 -0
- package/dist/types/ui/RelativeTime/index.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/types.d.ts +36 -0
- package/dist/types/ui/RelativeTime/types.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/constants.d.ts +6 -0
- package/dist/types/ui/RelativeTime/utils/constants.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/formatHumanTime.d.ts +21 -0
- package/dist/types/ui/RelativeTime/utils/formatHumanTime.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/getOptimalUpdateInterval.d.ts +8 -0
- package/dist/types/ui/RelativeTime/utils/getOptimalUpdateInterval.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/index.d.ts +4 -0
- package/dist/types/ui/RelativeTime/utils/index.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/parseInstant.d.ts +9 -0
- package/dist/types/ui/RelativeTime/utils/parseInstant.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +5 -1
- package/dist/types/ui/index.d.ts.map +1 -1
- package/package.json +20 -19
- package/dist/esm/ui/Button/Button.js +0 -10
- package/dist/esm/ui/Button/Button.js.map +0 -1
- package/dist/esm/ui/Button/index.js +0 -2
- package/dist/esm/ui/Button/index.js.map +0 -1
- package/dist/esm/ui/Button/styles.css +0 -63
- package/dist/esm/ui/Chip/Chip.css +0 -79
- package/dist/esm/ui/Chip/Chip.js +0 -15
- package/dist/esm/ui/Chip/Chip.js.map +0 -1
- package/dist/esm/ui/Chip/index.js +0 -4
- package/dist/esm/ui/Chip/index.js.map +0 -1
- package/dist/types/ui/Button/Button.d.ts +0 -6
- package/dist/types/ui/Button/Button.d.ts.map +0 -1
- package/dist/types/ui/Button/index.d.ts +0 -3
- package/dist/types/ui/Button/index.d.ts.map +0 -1
- package/dist/types/ui/Button/types.d.ts +0 -15
- package/dist/types/ui/Button/types.d.ts.map +0 -1
- package/dist/types/ui/Chip/Chip.d.ts +0 -10
- package/dist/types/ui/Chip/Chip.d.ts.map +0 -1
- package/dist/types/ui/Chip/index.d.ts +0 -3
- package/dist/types/ui/Chip/index.d.ts.map +0 -1
- package/dist/types/ui/Chip/types.d.ts +0 -27
- package/dist/types/ui/Chip/types.d.ts.map +0 -1
- /package/dist/esm/ui/{Button → EditableBlock}/types.js +0 -0
- /package/dist/esm/ui/{Chip → FileTree/common/File}/types.js +0 -0
@@ -0,0 +1,277 @@
|
|
1
|
+
import { useCallback, useEffect } from "react";
|
2
|
+
const useEditor = (textareaRef) => {
|
3
|
+
const wrapText = useCallback((character) => {
|
4
|
+
const textarea = textareaRef.current;
|
5
|
+
if (!textarea)
|
6
|
+
return;
|
7
|
+
const { selectionStart, selectionEnd } = textarea;
|
8
|
+
const isSelected = selectionStart !== selectionEnd;
|
9
|
+
textarea.focus();
|
10
|
+
if (isSelected) {
|
11
|
+
const selectedText = textarea.value.slice(selectionStart, selectionEnd);
|
12
|
+
const wrappedText = character + selectedText + character;
|
13
|
+
document.execCommand("insertText", false, wrappedText);
|
14
|
+
// Adjust selection to exclude the wrapping characters
|
15
|
+
const newStart = selectionStart + character.length;
|
16
|
+
const newEnd = selectionEnd + character.length;
|
17
|
+
textarea.setSelectionRange(newStart, newEnd);
|
18
|
+
}
|
19
|
+
else {
|
20
|
+
const insertText = character + character;
|
21
|
+
document.execCommand("insertText", false, insertText);
|
22
|
+
// Move cursor between the characters
|
23
|
+
textarea.setSelectionRange(selectionStart + character.length, selectionStart + character.length);
|
24
|
+
}
|
25
|
+
}, [textareaRef]);
|
26
|
+
const prefixLines = useCallback((prefix) => {
|
27
|
+
const textarea = textareaRef.current;
|
28
|
+
if (!textarea)
|
29
|
+
return;
|
30
|
+
const { selectionStart, selectionEnd } = textarea;
|
31
|
+
const isSelected = selectionStart !== selectionEnd;
|
32
|
+
const text = textarea.value;
|
33
|
+
const lines = text.split("\n");
|
34
|
+
const lineStartIndex = text.substring(0, selectionStart).split("\n").length - 1;
|
35
|
+
const lineEndIndex = text.substring(0, selectionEnd).split("\n").length;
|
36
|
+
// Extract selected lines and apply prefix
|
37
|
+
const selectedLines = lines.slice(lineStartIndex, lineEndIndex);
|
38
|
+
const wrappedLines = selectedLines.map((line, index) => {
|
39
|
+
const prefixString = typeof prefix === "function" ? prefix(index) : prefix;
|
40
|
+
return `${prefixString}${line}`;
|
41
|
+
});
|
42
|
+
// Calculate start and end positions of the selected lines
|
43
|
+
let startPos = 0;
|
44
|
+
for (let i = 0; i < lineStartIndex; i++) {
|
45
|
+
startPos += lines[i].length + 1; // +1 for newline
|
46
|
+
}
|
47
|
+
let endPos = startPos;
|
48
|
+
for (let i = lineStartIndex; i < lineEndIndex; i++) {
|
49
|
+
endPos += lines[i].length + 1;
|
50
|
+
}
|
51
|
+
endPos -= 1;
|
52
|
+
textarea.focus();
|
53
|
+
textarea.setSelectionRange(startPos, endPos);
|
54
|
+
document.execCommand("insertText", false, wrappedLines.join("\n"));
|
55
|
+
if (isSelected) {
|
56
|
+
const newEnd = startPos + wrappedLines.join("\n").length;
|
57
|
+
textarea.setSelectionRange(startPos, newEnd);
|
58
|
+
}
|
59
|
+
}, [textareaRef]);
|
60
|
+
const handleItalic = useCallback(() => wrapText("*"), [wrapText]);
|
61
|
+
const handleBold = useCallback(() => wrapText("**"), [wrapText]);
|
62
|
+
const handleTitle = useCallback(() => prefixLines("### "), [prefixLines]);
|
63
|
+
const handleQuote = useCallback(() => prefixLines("> "), [prefixLines]);
|
64
|
+
const handleCode = useCallback(() => wrapText("`"), [wrapText]);
|
65
|
+
const handleUList = useCallback(() => prefixLines("- "), [prefixLines]);
|
66
|
+
const handleOList = useCallback(() => prefixLines((index) => `${index + 1}. `), [prefixLines]);
|
67
|
+
const handleLink = useCallback(() => {
|
68
|
+
const textarea = textareaRef.current;
|
69
|
+
if (!textarea)
|
70
|
+
return;
|
71
|
+
const { selectionStart, selectionEnd } = textarea;
|
72
|
+
const isSelected = selectionStart !== selectionEnd;
|
73
|
+
textarea.focus();
|
74
|
+
const linkPlaceholder = "url";
|
75
|
+
const placeholderLength = linkPlaceholder.length;
|
76
|
+
if (isSelected) {
|
77
|
+
const selectedText = textarea.value.slice(selectionStart, selectionEnd);
|
78
|
+
const newText = `[${selectedText}](${linkPlaceholder})`;
|
79
|
+
document.execCommand("insertText", false, newText);
|
80
|
+
// Adjust selection to the URL part
|
81
|
+
const newStart = selectionEnd + placeholderLength;
|
82
|
+
const newEnd = newStart + placeholderLength;
|
83
|
+
textarea.setSelectionRange(newStart, newEnd);
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
const insertText = "[](url)";
|
87
|
+
const originalStart = selectionStart;
|
88
|
+
document.execCommand("insertText", false, insertText);
|
89
|
+
// Position cursor between the square brackets
|
90
|
+
textarea.setSelectionRange(originalStart + 1, originalStart + 1);
|
91
|
+
}
|
92
|
+
}, [textareaRef]);
|
93
|
+
const formatShortcut = (key, { isShift = false, isCtrl = false }) => {
|
94
|
+
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|
95
|
+
const ctrlKey = isMac ? "⌘" : "^";
|
96
|
+
const shiftKey = "⇧";
|
97
|
+
return [isCtrl && ctrlKey, isShift && shiftKey, key.toUpperCase()]
|
98
|
+
.filter(Boolean)
|
99
|
+
.join(" ");
|
100
|
+
};
|
101
|
+
// To be called when a user types Enter in the textarea
|
102
|
+
// Will insert the appropriate Markdown syntax for the next line
|
103
|
+
// In case of lists, code block.
|
104
|
+
const handleMarkdownSyntaxAutoComplete = useCallback((event) => {
|
105
|
+
const textarea = textareaRef.current;
|
106
|
+
if (!textarea)
|
107
|
+
return false;
|
108
|
+
if (event.key !== "Enter")
|
109
|
+
return false;
|
110
|
+
const { selectionStart, selectionEnd } = textarea;
|
111
|
+
const hasSelection = selectionStart !== selectionEnd;
|
112
|
+
if (hasSelection)
|
113
|
+
return false;
|
114
|
+
const textBeforeCursor = textarea.value.substring(0, selectionStart);
|
115
|
+
const linesBeforeCursor = textBeforeCursor.split("\n");
|
116
|
+
const currentLine = linesBeforeCursor[linesBeforeCursor.length - 1];
|
117
|
+
// list autocompletion
|
118
|
+
const listRegex = /^(\s*)([-*]|\d+\.)\s/; // matches "- ", "* ", "1. "
|
119
|
+
const listMatch = currentLine.match(listRegex);
|
120
|
+
if (listMatch) {
|
121
|
+
const leadingWhitespace = listMatch[1];
|
122
|
+
const marker = listMatch[2];
|
123
|
+
const restOfLine = currentLine.substring(listMatch[0].length).trim();
|
124
|
+
// If the line is empty, exit list
|
125
|
+
// and replace current line with empty line
|
126
|
+
if (restOfLine.length === 0 || restOfLine === "[ ]") {
|
127
|
+
const lineStart = selectionStart - currentLine.length;
|
128
|
+
textarea.selectionStart = lineStart;
|
129
|
+
textarea.selectionEnd = selectionStart;
|
130
|
+
document.execCommand("insertText", false, "\n");
|
131
|
+
return true;
|
132
|
+
}
|
133
|
+
// Determine next marker based on type
|
134
|
+
const isCheckbox = /^\[([ xX])\]/.test(restOfLine);
|
135
|
+
const isOrdered = /\d/.test(marker);
|
136
|
+
let nextMarker;
|
137
|
+
if (isCheckbox) {
|
138
|
+
nextMarker = `${leadingWhitespace}- [ ]`;
|
139
|
+
}
|
140
|
+
else {
|
141
|
+
nextMarker = isOrdered
|
142
|
+
? `${Number.parseInt(marker) + 1}.`
|
143
|
+
: `${marker}`;
|
144
|
+
}
|
145
|
+
const nextLine = `\n${leadingWhitespace}${nextMarker} `;
|
146
|
+
document.execCommand("insertText", false, nextLine);
|
147
|
+
return true;
|
148
|
+
}
|
149
|
+
// code block autocompletion
|
150
|
+
const codeBlockRegex = /^(\s*)```/;
|
151
|
+
const codeBlockMatch = currentLine.match(codeBlockRegex);
|
152
|
+
if (codeBlockMatch) {
|
153
|
+
const occurrences = (textBeforeCursor.match(/```/g) || []).length;
|
154
|
+
if (occurrences % 2 === 1) {
|
155
|
+
const newText = `${textBeforeCursor}\n\n\`\`\`${textarea.value.substring(selectionStart)}`;
|
156
|
+
textarea.value = newText;
|
157
|
+
textarea.selectionStart = selectionStart + 1;
|
158
|
+
textarea.selectionEnd = selectionStart + 1;
|
159
|
+
return true;
|
160
|
+
}
|
161
|
+
}
|
162
|
+
return false;
|
163
|
+
}, [textareaRef]);
|
164
|
+
const handleShortcuts = useCallback((event) => {
|
165
|
+
const textarea = textareaRef.current;
|
166
|
+
if (!textarea)
|
167
|
+
return;
|
168
|
+
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|
169
|
+
const isCtrl = isMac ? event.metaKey : event.ctrlKey;
|
170
|
+
const isShift = event.shiftKey;
|
171
|
+
let shortcutHandled = false;
|
172
|
+
// Ctrl + b
|
173
|
+
if (isCtrl && event.key === "b") {
|
174
|
+
handleBold();
|
175
|
+
shortcutHandled = true;
|
176
|
+
}
|
177
|
+
// Ctrl + i
|
178
|
+
if (isCtrl && event.key === "i") {
|
179
|
+
handleItalic();
|
180
|
+
shortcutHandled = true;
|
181
|
+
}
|
182
|
+
// Ctrl + k
|
183
|
+
if (isCtrl && event.key === "k") {
|
184
|
+
handleLink();
|
185
|
+
shortcutHandled = true;
|
186
|
+
}
|
187
|
+
// Ctrl + .
|
188
|
+
if (isCtrl && event.key === ".") {
|
189
|
+
handleQuote();
|
190
|
+
shortcutHandled = true;
|
191
|
+
}
|
192
|
+
// Ctrl + e
|
193
|
+
if (isCtrl && event.key === "e") {
|
194
|
+
handleCode();
|
195
|
+
shortcutHandled = true;
|
196
|
+
}
|
197
|
+
// Ctrl + Shift + 7
|
198
|
+
if (isCtrl && isShift && event.key === "7") {
|
199
|
+
handleOList();
|
200
|
+
shortcutHandled = true;
|
201
|
+
}
|
202
|
+
// Ctrl + Shift + 8
|
203
|
+
if (isCtrl && isShift && event.key === "8") {
|
204
|
+
handleUList();
|
205
|
+
shortcutHandled = true;
|
206
|
+
}
|
207
|
+
if (!shortcutHandled) {
|
208
|
+
shortcutHandled = handleMarkdownSyntaxAutoComplete(event);
|
209
|
+
}
|
210
|
+
if (shortcutHandled) {
|
211
|
+
event.preventDefault();
|
212
|
+
}
|
213
|
+
else {
|
214
|
+
event.stopPropagation();
|
215
|
+
}
|
216
|
+
}, [
|
217
|
+
textareaRef,
|
218
|
+
handleBold,
|
219
|
+
handleItalic,
|
220
|
+
handleLink,
|
221
|
+
handleQuote,
|
222
|
+
handleCode,
|
223
|
+
handleOList,
|
224
|
+
handleUList,
|
225
|
+
handleMarkdownSyntaxAutoComplete,
|
226
|
+
]);
|
227
|
+
useEffect(() => {
|
228
|
+
if (!textareaRef.current)
|
229
|
+
return;
|
230
|
+
textareaRef.current.addEventListener("keydown", handleShortcuts);
|
231
|
+
return () => {
|
232
|
+
if (!textareaRef.current)
|
233
|
+
return;
|
234
|
+
textareaRef.current.removeEventListener("keydown", handleShortcuts);
|
235
|
+
};
|
236
|
+
}, [textareaRef, handleShortcuts]);
|
237
|
+
if (typeof window === "undefined")
|
238
|
+
return {};
|
239
|
+
return {
|
240
|
+
toolbar: {
|
241
|
+
italic: {
|
242
|
+
shortcut: formatShortcut("i", { isCtrl: true }),
|
243
|
+
handler: handleItalic,
|
244
|
+
},
|
245
|
+
bold: {
|
246
|
+
shortcut: formatShortcut("b", { isCtrl: true }),
|
247
|
+
handler: handleBold,
|
248
|
+
},
|
249
|
+
title: {
|
250
|
+
shortcut: undefined,
|
251
|
+
handler: handleTitle,
|
252
|
+
},
|
253
|
+
quote: {
|
254
|
+
shortcut: formatShortcut(".", { isCtrl: true }),
|
255
|
+
handler: handleQuote,
|
256
|
+
},
|
257
|
+
code: {
|
258
|
+
shortcut: formatShortcut("e", { isCtrl: true }),
|
259
|
+
handler: handleCode,
|
260
|
+
},
|
261
|
+
uList: {
|
262
|
+
shortcut: formatShortcut("8", { isCtrl: true, isShift: true }),
|
263
|
+
handler: handleUList,
|
264
|
+
},
|
265
|
+
oList: {
|
266
|
+
shortcut: formatShortcut("7", { isCtrl: true, isShift: true }),
|
267
|
+
handler: handleOList,
|
268
|
+
},
|
269
|
+
link: {
|
270
|
+
shortcut: formatShortcut("k", { isCtrl: true }),
|
271
|
+
handler: handleLink,
|
272
|
+
},
|
273
|
+
},
|
274
|
+
};
|
275
|
+
};
|
276
|
+
export default useEditor;
|
277
|
+
//# sourceMappingURL=useEditor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useEditor.js","sourceRoot":"","sources":["../../../../../src/ui/MarkdownEditor/hooks/useEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAkB/C,MAAM,SAAS,GAAG,CAChB,WAAwD,EACxD,EAAE;IACF,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,SAAiB,EAAE,EAAE;QACpB,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;QACrC,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;QAClD,MAAM,UAAU,GAAG,cAAc,KAAK,YAAY,CAAC;QACnD,QAAQ,CAAC,KAAK,EAAE,CAAC;QAEjB,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;YACxE,MAAM,WAAW,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;YACzD,QAAQ,CAAC,WAAW,CAAC,YAAY,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;YACvD,sDAAsD;YACtD,MAAM,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC;YACnD,MAAM,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC;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mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,cAAc,YAAY,CAAC"}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/* @canonical/generator-ds 0.9.0-experimental.4 */
|
2
|
+
.ds.markdown-editor {
|
3
|
+
--markdown-editor-editor-background-color: white;
|
4
|
+
--markdown-editor-editor-color: black;
|
5
|
+
--markdown-editor-editor-border-color: #7b7b7b;
|
6
|
+
|
7
|
+
--markdown-editor-tabs-hover-color: black;
|
8
|
+
--markdown-editor-tabs-hover-background-color: #f2f2f2;
|
9
|
+
--markdown-editor-tabs-inactive-color: #737373;
|
10
|
+
--markdown-editor-tabs-inactive-border-color: transparent;
|
11
|
+
--markdown-editor-tabs-inactive-background-color: #ebeaeb;
|
12
|
+
--markdown-editor-tabs-horizontal-padding: 12px;
|
13
|
+
--markdown-editor-tabs-vert-padding: 8px;
|
14
|
+
|
15
|
+
--markdown-editor-toolbar-hover-background-color: #f2f2f2;
|
16
|
+
--markdown-editor-toolbar-separator-color: rgba(0, 0, 0, 0.2);
|
17
|
+
--markdown-editor-toolbar-button-size: 27px;
|
18
|
+
--markdown-editor-toolbar-buttons-gap: 4px;
|
19
|
+
--markdown-editor-toolbar-horizontal-padding: 8px;
|
20
|
+
--markdown-editor-toolbar-vert-padding: 4px;
|
21
|
+
|
22
|
+
--markdown-editor-input-horizontal-padding: 8px;
|
23
|
+
--markdown-editor-input-vert-padding: 6px;
|
24
|
+
|
25
|
+
container-type: inline-size;
|
26
|
+
display: flex;
|
27
|
+
flex-direction: column;
|
28
|
+
|
29
|
+
& > .top-bar {
|
30
|
+
display: flex;
|
31
|
+
justify-content: space-between;
|
32
|
+
align-items: center;
|
33
|
+
flex-wrap: nowrap;
|
34
|
+
margin-bottom: -1px;
|
35
|
+
}
|
36
|
+
|
37
|
+
& > .editor-content {
|
38
|
+
color: var(--markdown-editor-editor-color);
|
39
|
+
background-color: var(--markdown-editor-editor-background-color);
|
40
|
+
border: 1px solid transparent;
|
41
|
+
ul.contains-task-list {
|
42
|
+
& li.task-list-item {
|
43
|
+
list-style: none;
|
44
|
+
}
|
45
|
+
& input[type="checkbox"] {
|
46
|
+
margin-inline-start: -1.25em;
|
47
|
+
margin-right: 0.313em;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
&.bordered {
|
53
|
+
> .editor-content {
|
54
|
+
border-color: var(--markdown-editor-editor-border-color);
|
55
|
+
padding: var(--markdown-editor-input-vert-padding)
|
56
|
+
var(--markdown-editor-input-horizontal-padding);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
& > textarea {
|
61
|
+
resize: vertical;
|
62
|
+
outline: none;
|
63
|
+
}
|
64
|
+
|
65
|
+
&:has(textarea:focus) {
|
66
|
+
outline: 1px solid Highlight;
|
67
|
+
outline: 1px solid -webkit-focus-ring-color;
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/MarkdownEditor/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
3
|
+
import { formatHumanTime, getOptimalUpdateInterval, parseInstant, } from "./utils/index.js";
|
4
|
+
const componentCssClassName = "ds relative-time";
|
5
|
+
/**
|
6
|
+
* The RelativeTime component displays timestamps in a human-readable relative format (like "2 hours ago" or "in 3 days").
|
7
|
+
*
|
8
|
+
* It features automatic live updates with interval optimization based on time distance, configurable "now" threshold,
|
9
|
+
* and renders as proper semantic HTML using the <time> element. The component leverages the Temporal API for calculations and Intl.RelativeTimeFormat for localization.
|
10
|
+
*/
|
11
|
+
const RelativeTime = ({ id, className, style, time, relativeTimeFormat, nowThreshold = 10, disableLiveUpdate = false, nowKeyword = "now", invalidDateKeyword = "invalid date", }) => {
|
12
|
+
const [relativeTime, setRelativeTime] = useState("");
|
13
|
+
const [localeTimeString, setLocaleTimeString] = useState("");
|
14
|
+
const [stringTime, setStringTime] = useState("");
|
15
|
+
const intervalRef = useRef(null);
|
16
|
+
const instantTime = useMemo(() => {
|
17
|
+
try {
|
18
|
+
return parseInstant(time);
|
19
|
+
}
|
20
|
+
catch (error) {
|
21
|
+
console.error(error);
|
22
|
+
return null;
|
23
|
+
}
|
24
|
+
}, [time]);
|
25
|
+
const updateRelativeTime = useCallback(() => {
|
26
|
+
if (instantTime === null) {
|
27
|
+
setRelativeTime(invalidDateKeyword);
|
28
|
+
setLocaleTimeString("");
|
29
|
+
setStringTime("");
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
const timeFormatter = relativeTimeFormat ||
|
33
|
+
new Intl.RelativeTimeFormat(undefined, { numeric: "auto" });
|
34
|
+
setRelativeTime(formatHumanTime(instantTime, {
|
35
|
+
nowThreshold,
|
36
|
+
nowKeyword,
|
37
|
+
relativeTimeFormat: timeFormatter,
|
38
|
+
}));
|
39
|
+
setLocaleTimeString(instantTime.toLocaleString());
|
40
|
+
setStringTime(instantTime.toString());
|
41
|
+
}, [
|
42
|
+
instantTime,
|
43
|
+
relativeTimeFormat,
|
44
|
+
nowThreshold,
|
45
|
+
nowKeyword,
|
46
|
+
invalidDateKeyword,
|
47
|
+
]);
|
48
|
+
useEffect(() => {
|
49
|
+
// initial calculation
|
50
|
+
updateRelativeTime();
|
51
|
+
if (disableLiveUpdate || instantTime === null)
|
52
|
+
return;
|
53
|
+
const updateInterval = getOptimalUpdateInterval(instantTime);
|
54
|
+
// SSR check
|
55
|
+
if (typeof window === "undefined")
|
56
|
+
return;
|
57
|
+
intervalRef.current = window.setInterval(updateRelativeTime, updateInterval);
|
58
|
+
return () => {
|
59
|
+
if (intervalRef.current)
|
60
|
+
window.clearInterval(intervalRef.current);
|
61
|
+
};
|
62
|
+
}, [instantTime, disableLiveUpdate, updateRelativeTime]);
|
63
|
+
return (_jsx("time", { id: id, style: style, className: [componentCssClassName, className].filter(Boolean).join(" "), title: localeTimeString, dateTime: stringTime, children: relativeTime }));
|
64
|
+
};
|
65
|
+
export default RelativeTime;
|
66
|
+
//# sourceMappingURL=RelativeTime.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RelativeTime.js","sourceRoot":"","sources":["../../../../src/ui/RelativeTime/RelativeTime.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,EACpB,EAAE,EACF,SAAS,EACT,KAAK,EACL,IAAI,EACJ,kBAAkB,EAClB,YAAY,GAAG,EAAE,EACjB,iBAAiB,GAAG,KAAK,EACzB,UAAU,GAAG,KAAK,EAClB,kBAAkB,GAAG,cAAc,GACjB,EAAsB,EAAE;IAC1C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEjD,MAAM,WAAW,GAAG,MAAM,CAAS,IAAI,CAAC,CAAC;IACzC,MAAM,WAAW,GAA4B,OAAO,CAAC,GAAG,EAAE;QACxD,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,IAAI,CA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,CAAC,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEzD,OAAO,CACL,eACE,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,UAAU,YAEnB,YAAY,GACR,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/RelativeTime/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,cAAc,YAAY,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/RelativeTime/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export const MINUTE_IN_SECONDS = 60;
|
2
|
+
export const HOUR_IN_SECONDS = MINUTE_IN_SECONDS * 60;
|
3
|
+
export const DAY_IN_SECONDS = HOUR_IN_SECONDS * 24;
|
4
|
+
export const MONTH_IN_SECONDS = DAY_IN_SECONDS * 30;
|
5
|
+
export const YEAR_IN_SECONDS = DAY_IN_SECONDS * 365;
|
6
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/ui/RelativeTime/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,GAAG,EAAE,CAAC;AACtD,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,GAAG,EAAE,CAAC;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,GAAG,EAAE,CAAC;AACpD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,GAAG,GAAG,CAAC"}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
/**
|
3
|
+
* Formats a given instant as a human-readable time relative to the current time.
|
4
|
+
* @param instant The instant to format.
|
5
|
+
* @param options The options to use for formatting.
|
6
|
+
* @returns A human-readable relative time string
|
7
|
+
*/
|
8
|
+
function formatHumanTime(instant, options) {
|
9
|
+
const now = Temporal.Now.instant();
|
10
|
+
const deltaSeconds = instant.epochSeconds - now.epochSeconds;
|
11
|
+
const absDeltaSeconds = Math.abs(deltaSeconds);
|
12
|
+
if (absDeltaSeconds < options.nowThreshold) {
|
13
|
+
return options.nowKeyword;
|
14
|
+
}
|
15
|
+
const timeZone = Temporal.Now.timeZoneId() || "UTC";
|
16
|
+
const instantZDT = instant.toZonedDateTimeISO(timeZone);
|
17
|
+
const nowZDT = now.toZonedDateTimeISO(timeZone);
|
18
|
+
const diff = instantZDT.since(nowZDT, { largestUnit: "years" });
|
19
|
+
const units = [
|
20
|
+
"years",
|
21
|
+
"months",
|
22
|
+
"days",
|
23
|
+
"hours",
|
24
|
+
"minutes",
|
25
|
+
"seconds",
|
26
|
+
];
|
27
|
+
let rtfUnit = "seconds";
|
28
|
+
let rtfValue = 0;
|
29
|
+
for (const unit of units) {
|
30
|
+
const value = diff[unit];
|
31
|
+
if (value !== 0) {
|
32
|
+
rtfUnit = unit;
|
33
|
+
rtfValue = value;
|
34
|
+
break;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
if (rtfValue === 0) {
|
38
|
+
return options.nowKeyword;
|
39
|
+
}
|
40
|
+
return options.relativeTimeFormat.format(rtfValue, rtfUnit);
|
41
|
+
}
|
42
|
+
export default formatHumanTime;
|
43
|
+
//# sourceMappingURL=formatHumanTime.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatHumanTime.js","sourceRoot":"","sources":["../../../../../src/ui/RelativeTime/utils/formatHumanTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAgBjD;;;;;GAKG;AACH,SAAS,eAAe,CACtB,OAAyB,EACzB,OAAyB;IAEzB,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACnC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IAC7D,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAE/C,IAAI,eAAe,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;QAC3C,OAAO,OAAO,CAAC,UAAU,CAAC;IAC5B,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,KAAK,CAAC;IACpD,MAAM,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IAEhE,MAAM,KAAK,GAAG;QACZ,OAAO;QACP,QAAQ;QACR,MAAM;QACN,OAAO;QACP,SAAS;QACT,SAAS;KAC8B,CAAC;IAE1C,IAAI,OAAO,GAAgC,SAAS,CAAC;IACrD,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YAChB,OAAO,GAAG,IAAI,CAAC;YACf,QAAQ,GAAG,KAAK,CAAC;YACjB,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,OAAO,CAAC,UAAU,CAAC;IAC5B,CAAC;IAED,OAAO,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED,eAAe,eAAe,CAAC"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
import * as constants from "./constants.js";
|
3
|
+
/**
|
4
|
+
* Calcualte the optimal update interval for a given instant based on the time distance from now.
|
5
|
+
* @returns The optimal update interval in milliseconds.
|
6
|
+
*/
|
7
|
+
function getOptimalUpdateInterval(instant) {
|
8
|
+
const now = Temporal.Now.instant();
|
9
|
+
const deltaSeconds = instant.epochSeconds - now.epochSeconds;
|
10
|
+
const absDeltaSeconds = Math.abs(deltaSeconds);
|
11
|
+
if (absDeltaSeconds < constants.MINUTE_IN_SECONDS) {
|
12
|
+
return 1000;
|
13
|
+
}
|
14
|
+
if (absDeltaSeconds < constants.HOUR_IN_SECONDS) {
|
15
|
+
return constants.MINUTE_IN_SECONDS * 1000;
|
16
|
+
}
|
17
|
+
if (absDeltaSeconds < constants.DAY_IN_SECONDS) {
|
18
|
+
return constants.HOUR_IN_SECONDS * 1000;
|
19
|
+
}
|
20
|
+
// for any other time distance, update once a day
|
21
|
+
return constants.DAY_IN_SECONDS * 1000;
|
22
|
+
}
|
23
|
+
export default getOptimalUpdateInterval;
|
24
|
+
//# sourceMappingURL=getOptimalUpdateInterval.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getOptimalUpdateInterval.js","sourceRoot":"","sources":["../../../../../src/ui/RelativeTime/utils/getOptimalUpdateInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C;;;GAGG;AACH,SAAS,wBAAwB,CAAC,OAAyB;IACzD,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACnC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IAC7D,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAE/C,IAAI,eAAe,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,eAAe,GAAG,SAAS,CAAC,eAAe,EAAE,CAAC;QAChD,OAAO,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAC5C,CAAC;IAED,IAAI,eAAe,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;QAC/C,OAAO,SAAS,CAAC,eAAe,GAAG,IAAI,CAAC;IAC1C,CAAC;IACD,iDAAiD;IACjD,OAAO,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC;AACzC,CAAC;AAED,eAAe,wBAAwB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ui/RelativeTime/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
/**
|
3
|
+
* Parser for Temporal.Instant.
|
4
|
+
* @param time - instance, date or string to parse
|
5
|
+
* @throws Error if time is invalid
|
6
|
+
*/
|
7
|
+
function parseInstant(time) {
|
8
|
+
if (time instanceof Temporal.Instant) {
|
9
|
+
return time;
|
10
|
+
}
|
11
|
+
if (time instanceof Date) {
|
12
|
+
return Temporal.Instant.fromEpochMilliseconds(time.getTime());
|
13
|
+
}
|
14
|
+
try {
|
15
|
+
return Temporal.Instant.from(time);
|
16
|
+
}
|
17
|
+
catch (e) {
|
18
|
+
throw new Error(`Invalid time string (ISO string or Date object expected): ${time}`);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
export default parseInstant;
|
22
|
+
//# sourceMappingURL=parseInstant.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseInstant.js","sourceRoot":"","sources":["../../../../../src/ui/RelativeTime/utils/parseInstant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAsC;IAC1D,IAAI,IAAI,YAAY,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,6DAA6D,IAAI,EAAE,CACpE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,eAAe,YAAY,CAAC"}
|
package/dist/esm/ui/index.js
CHANGED
@@ -1,2 +1,6 @@
|
|
1
|
-
export
|
1
|
+
export * from "./EditableBlock/index.js";
|
2
|
+
export * from "./FileTree/index.js";
|
3
|
+
export * from "./GitDiffViewer/index.js";
|
4
|
+
export * from "./MarkdownEditor/index.js";
|
5
|
+
export * from "./RelativeTime/index.js";
|
2
6
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/ui/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/ui/EditableBlock/Context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,QAAA,MAAM,cAAc,yDAA2D,CAAC;AAEhF,eAAe,cAAc,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type React from "react";
|
2
|
+
import type { EditElementProps, EditableBlockProps } from "./types.js";
|
3
|
+
import "./styles.css";
|
4
|
+
/**
|
5
|
+
* Component that renders toggling edit mode block
|
6
|
+
* @returns {React.ReactElement} - Rendered EditableBlock
|
7
|
+
*/
|
8
|
+
declare const EditableBlock: <T extends EditElementProps>({ id, EditComponent, className: userClassName, style, title, tag: TitleTag, }: EditableBlockProps<T>) => React.ReactElement;
|
9
|
+
export default EditableBlock;
|
10
|
+
//# sourceMappingURL=EditableBlock.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EditableBlock.d.ts","sourceRoot":"","sources":["../../../../src/ui/EditableBlock/EditableBlock.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,cAAc,CAAC;AAEtB;;;GAGG;AAEH,QAAA,MAAM,aAAa,GAAI,CAAC,SAAS,gBAAgB,iFAO9C,kBAAkB,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,YA2DhC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|