Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,24 +1,26 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import React, { useCallback, useRef } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import styles from './FilePicker.module.css';
|
||||
|
||||
const FilePicker = React.memo(({ children, accept, multiple, onSelect }) => {
|
||||
const field = useRef(null);
|
||||
const fieldRef = useRef(null);
|
||||
|
||||
const handleTriggerClick = useCallback(() => {
|
||||
field.current.click();
|
||||
fieldRef.current.click();
|
||||
}, []);
|
||||
|
||||
const handleFieldChange = useCallback(
|
||||
({ target }) => {
|
||||
[...target.files].forEach((file) => {
|
||||
onSelect(file);
|
||||
});
|
||||
|
||||
onSelect(multiple ? [...target.files] : target.files[0]);
|
||||
target.value = null; // eslint-disable-line no-param-reassign
|
||||
},
|
||||
[onSelect],
|
||||
[multiple, onSelect],
|
||||
);
|
||||
|
||||
const tigger = React.cloneElement(children, {
|
||||
@@ -29,7 +31,7 @@ const FilePicker = React.memo(({ children, accept, multiple, onSelect }) => {
|
||||
<>
|
||||
{tigger}
|
||||
<input
|
||||
ref={field}
|
||||
ref={fieldRef}
|
||||
type="file"
|
||||
accept={accept}
|
||||
multiple={multiple}
|
||||
@@ -49,7 +51,7 @@ FilePicker.propTypes = {
|
||||
|
||||
FilePicker.defaultProps = {
|
||||
accept: undefined,
|
||||
multiple: false,
|
||||
multiple: undefined,
|
||||
};
|
||||
|
||||
export default FilePicker;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
.field {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import FilePicker from './FilePicker';
|
||||
|
||||
export default FilePicker;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { Input as SemanticUIInput } from 'semantic-ui-react';
|
||||
|
||||
import InputPassword from './InputPassword';
|
||||
@@ -7,8 +12,4 @@ export default class Input extends SemanticUIInput {
|
||||
static Password = InputPassword;
|
||||
|
||||
static Mask = InputMask;
|
||||
|
||||
focus = (options) => this.inputRef.current.focus(options);
|
||||
|
||||
blur = () => this.inputRef.current.blur();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Input } from 'semantic-ui-react';
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import zxcvbn from 'zxcvbn';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
.strengthBar {
|
||||
margin: 4px 0 0 !important;
|
||||
opacity: 0.5;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import InputMask from 'react-input-mask';
|
||||
|
||||
export default class MaskedInput extends InputMask {
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import Input from './Input';
|
||||
|
||||
export default Input;
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import remarkBreaks from 'remark-breaks';
|
||||
|
||||
import './Markdown.module.scss'; // FIXME: import as styles?
|
||||
|
||||
const ABSOLUTE_URL_REGEX = /^(?:https?:)?\/\//i;
|
||||
|
||||
const Markdown = React.memo(({ linkStopPropagation, ...props }) => {
|
||||
const handleLinkClick = useCallback((event) => {
|
||||
event.stopPropagation();
|
||||
}, []);
|
||||
|
||||
const linkRenderer = useCallback(
|
||||
({ node, ...linkProps }) => (
|
||||
/* eslint-disable-next-line jsx-a11y/anchor-has-content,
|
||||
jsx-a11y/click-events-have-key-events,
|
||||
jsx-a11y/no-static-element-interactions */
|
||||
<a
|
||||
{...linkProps} // eslint-disable-line react/jsx-props-no-spreading
|
||||
rel={
|
||||
ABSOLUTE_URL_REGEX.test(linkProps.href) && linkProps.target === '_blank'
|
||||
? 'noreferrer'
|
||||
: undefined
|
||||
}
|
||||
onClick={linkStopPropagation ? handleLinkClick : undefined}
|
||||
/>
|
||||
),
|
||||
[linkStopPropagation, handleLinkClick],
|
||||
);
|
||||
|
||||
return (
|
||||
<ReactMarkdown
|
||||
{...props} // eslint-disable-line react/jsx-props-no-spreading
|
||||
components={{
|
||||
a: linkRenderer,
|
||||
}}
|
||||
remarkPlugins={[remarkGfm, remarkBreaks]}
|
||||
className="markdown-body"
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
Markdown.propTypes = {
|
||||
linkStopPropagation: PropTypes.bool,
|
||||
};
|
||||
|
||||
Markdown.defaultProps = {
|
||||
linkStopPropagation: false,
|
||||
};
|
||||
|
||||
export default Markdown;
|
||||
@@ -1,953 +0,0 @@
|
||||
:global {
|
||||
.markdown-body {
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
margin: 0;
|
||||
/* color: #24292f;
|
||||
background-color: #ffffff;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
||||
font-size: 16px; */
|
||||
line-height: 1.5;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.markdown-body .octicon {
|
||||
display: inline-block;
|
||||
fill: currentColor;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
.markdown-body h1:hover .anchor .octicon-link:before,
|
||||
.markdown-body h2:hover .anchor .octicon-link:before,
|
||||
.markdown-body h3:hover .anchor .octicon-link:before,
|
||||
.markdown-body h4:hover .anchor .octicon-link:before,
|
||||
.markdown-body h5:hover .anchor .octicon-link:before,
|
||||
.markdown-body h6:hover .anchor .octicon-link:before {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
content: ' ';
|
||||
display: inline-block;
|
||||
background-color: currentColor;
|
||||
-webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
|
||||
mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
|
||||
}
|
||||
|
||||
.markdown-body details,
|
||||
.markdown-body figcaption,
|
||||
.markdown-body figure {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.markdown-body summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
.markdown-body [hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.markdown-body a {
|
||||
background-color: transparent;
|
||||
color: #0969da;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.markdown-body a:active,
|
||||
.markdown-body a:hover {
|
||||
outline-width: 0;
|
||||
}
|
||||
|
||||
.markdown-body abbr[title] {
|
||||
border-bottom: none;
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
|
||||
.markdown-body b,
|
||||
.markdown-body strong {
|
||||
font-weight: bold; // 600
|
||||
}
|
||||
|
||||
.markdown-body dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.markdown-body h1 {
|
||||
margin: .67em 0;
|
||||
font-weight: bold; // 600
|
||||
padding-bottom: .3em;
|
||||
font-size: 2em;
|
||||
border-bottom: 1px solid hsla(210, 18%, 87%, 1);
|
||||
}
|
||||
|
||||
.markdown-body mark {
|
||||
background-color: #fff8c5;
|
||||
color: #24292f;
|
||||
}
|
||||
|
||||
.markdown-body small {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.markdown-body sub,
|
||||
.markdown-body sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
.markdown-body sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
.markdown-body sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
.markdown-body img {
|
||||
border-style: none;
|
||||
max-width: 100%;
|
||||
box-sizing: content-box;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.markdown-body code,
|
||||
.markdown-body kbd,
|
||||
.markdown-body pre,
|
||||
.markdown-body samp {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.markdown-body figure {
|
||||
margin: 1em 40px;
|
||||
}
|
||||
|
||||
.markdown-body hr {
|
||||
box-sizing: content-box;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
border-bottom: 1px solid hsla(210, 18%, 87%, 1);
|
||||
height: .25em;
|
||||
padding: 0;
|
||||
margin: 24px 0;
|
||||
background-color: #d0d7de;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.markdown-body input {
|
||||
font: inherit;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.markdown-body [type=button],
|
||||
.markdown-body [type=reset],
|
||||
.markdown-body [type=submit] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
.markdown-body [type=button]::-moz-focus-inner,
|
||||
.markdown-body [type=reset]::-moz-focus-inner,
|
||||
.markdown-body [type=submit]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.markdown-body [type=button]:-moz-focusring,
|
||||
.markdown-body [type=reset]:-moz-focusring,
|
||||
.markdown-body [type=submit]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
.markdown-body [type=checkbox],
|
||||
.markdown-body [type=radio] {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.markdown-body [type=number]::-webkit-inner-spin-button,
|
||||
.markdown-body [type=number]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.markdown-body [type=search] {
|
||||
-webkit-appearance: textfield;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.markdown-body [type=search]::-webkit-search-cancel-button,
|
||||
.markdown-body [type=search]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
.markdown-body ::-webkit-input-placeholder {
|
||||
color: inherit;
|
||||
opacity: .54;
|
||||
}
|
||||
|
||||
.markdown-body ::-webkit-file-upload-button {
|
||||
-webkit-appearance: button;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.markdown-body a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.markdown-body hr::before {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.markdown-body hr::after {
|
||||
display: table;
|
||||
clear: both;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.markdown-body table {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
display: block;
|
||||
width: max-content;
|
||||
max-width: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.markdown-body td,
|
||||
.markdown-body th {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.markdown-body details summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.markdown-body details:not([open])>*:not(summary) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.markdown-body kbd {
|
||||
display: inline-block;
|
||||
padding: 3px 5px;
|
||||
font: 11px ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
|
||||
line-height: 10px;
|
||||
color: #24292f;
|
||||
vertical-align: middle;
|
||||
background-color: #f6f8fa;
|
||||
border: solid 1px rgba(175, 184, 193, 0.2);
|
||||
border-bottom-color: rgba(175, 184, 193, 0.2);
|
||||
border-radius: 6px;
|
||||
box-shadow: inset 0 -1px 0 rgba(175, 184, 193, 0.2);
|
||||
}
|
||||
|
||||
.markdown-body h1,
|
||||
.markdown-body h2,
|
||||
.markdown-body h3,
|
||||
.markdown-body h4,
|
||||
.markdown-body h5,
|
||||
.markdown-body h6 {
|
||||
margin-top: 24px;
|
||||
margin-bottom: 16px;
|
||||
font-weight: bold; // 600
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.markdown-body h2 {
|
||||
font-weight: bold; // 600
|
||||
padding-bottom: .3em;
|
||||
font-size: 1.5em;
|
||||
border-bottom: 1px solid hsla(210, 18%, 87%, 1);
|
||||
}
|
||||
|
||||
.markdown-body h3 {
|
||||
font-weight: bold; // 600
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
.markdown-body h4 {
|
||||
font-weight: bold; // 600
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.markdown-body h5 {
|
||||
font-weight: bold; // 600
|
||||
font-size: .875em;
|
||||
}
|
||||
|
||||
.markdown-body h6 {
|
||||
font-weight: bold; // 600
|
||||
font-size: .85em;
|
||||
color: #57606a;
|
||||
}
|
||||
|
||||
.markdown-body p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.markdown-body blockquote {
|
||||
margin: 0;
|
||||
padding: 0 1em;
|
||||
color: #57606a;
|
||||
border-left: .25em solid #d0d7de;
|
||||
}
|
||||
|
||||
.markdown-body ul,
|
||||
.markdown-body ol {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.markdown-body ol ol,
|
||||
.markdown-body ul ol {
|
||||
list-style-type: lower-roman;
|
||||
}
|
||||
|
||||
.markdown-body ul ul ol,
|
||||
.markdown-body ul ol ol,
|
||||
.markdown-body ol ul ol,
|
||||
.markdown-body ol ol ol {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
|
||||
.markdown-body dd {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.markdown-body tt,
|
||||
.markdown-body code {
|
||||
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.markdown-body pre {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
|
||||
font-size: 12px;
|
||||
word-wrap: normal;
|
||||
}
|
||||
|
||||
.markdown-body .octicon {
|
||||
display: inline-block;
|
||||
overflow: visible !important;
|
||||
vertical-align: text-bottom;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
.markdown-body ::placeholder {
|
||||
color: #6e7781;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.markdown-body input::-webkit-outer-spin-button,
|
||||
.markdown-body input::-webkit-inner-spin-button {
|
||||
margin: 0;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.markdown-body .pl-c {
|
||||
color: #6e7781;
|
||||
}
|
||||
|
||||
.markdown-body .pl-c1,
|
||||
.markdown-body .pl-s .pl-v {
|
||||
color: #0550ae;
|
||||
}
|
||||
|
||||
.markdown-body .pl-e,
|
||||
.markdown-body .pl-en {
|
||||
color: #8250df;
|
||||
}
|
||||
|
||||
.markdown-body .pl-smi,
|
||||
.markdown-body .pl-s .pl-s1 {
|
||||
color: #24292f;
|
||||
}
|
||||
|
||||
.markdown-body .pl-ent {
|
||||
color: #116329;
|
||||
}
|
||||
|
||||
.markdown-body .pl-k {
|
||||
color: #cf222e;
|
||||
}
|
||||
|
||||
.markdown-body .pl-s,
|
||||
.markdown-body .pl-pds,
|
||||
.markdown-body .pl-s .pl-pse .pl-s1,
|
||||
.markdown-body .pl-sr,
|
||||
.markdown-body .pl-sr .pl-cce,
|
||||
.markdown-body .pl-sr .pl-sre,
|
||||
.markdown-body .pl-sr .pl-sra {
|
||||
color: #0a3069;
|
||||
}
|
||||
|
||||
.markdown-body .pl-v,
|
||||
.markdown-body .pl-smw {
|
||||
color: #953800;
|
||||
}
|
||||
|
||||
.markdown-body .pl-bu {
|
||||
color: #82071e;
|
||||
}
|
||||
|
||||
.markdown-body .pl-ii {
|
||||
color: #f6f8fa;
|
||||
background-color: #82071e;
|
||||
}
|
||||
|
||||
.markdown-body .pl-c2 {
|
||||
color: #f6f8fa;
|
||||
background-color: #cf222e;
|
||||
}
|
||||
|
||||
.markdown-body .pl-sr .pl-cce {
|
||||
font-weight: bold;
|
||||
color: #116329;
|
||||
}
|
||||
|
||||
.markdown-body .pl-ml {
|
||||
color: #3b2300;
|
||||
}
|
||||
|
||||
.markdown-body .pl-mh,
|
||||
.markdown-body .pl-mh .pl-en,
|
||||
.markdown-body .pl-ms {
|
||||
font-weight: bold;
|
||||
color: #0550ae;
|
||||
}
|
||||
|
||||
.markdown-body .pl-mi {
|
||||
font-style: italic;
|
||||
color: #24292f;
|
||||
}
|
||||
|
||||
.markdown-body .pl-mb {
|
||||
font-weight: bold;
|
||||
color: #24292f;
|
||||
}
|
||||
|
||||
.markdown-body .pl-md {
|
||||
color: #82071e;
|
||||
background-color: #FFEBE9;
|
||||
}
|
||||
|
||||
.markdown-body .pl-mi1 {
|
||||
color: #116329;
|
||||
background-color: #dafbe1;
|
||||
}
|
||||
|
||||
.markdown-body .pl-mc {
|
||||
color: #953800;
|
||||
background-color: #ffd8b5;
|
||||
}
|
||||
|
||||
.markdown-body .pl-mi2 {
|
||||
color: #eaeef2;
|
||||
background-color: #0550ae;
|
||||
}
|
||||
|
||||
.markdown-body .pl-mdr {
|
||||
font-weight: bold;
|
||||
color: #8250df;
|
||||
}
|
||||
|
||||
.markdown-body .pl-ba {
|
||||
color: #57606a;
|
||||
}
|
||||
|
||||
.markdown-body .pl-sg {
|
||||
color: #8c959f;
|
||||
}
|
||||
|
||||
.markdown-body .pl-corl {
|
||||
text-decoration: underline;
|
||||
color: #0a3069;
|
||||
}
|
||||
|
||||
.markdown-body [data-catalyst] {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.markdown-body g-emoji {
|
||||
font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-size: 1em;
|
||||
font-style: normal !important;
|
||||
font-weight: normal; // 400
|
||||
line-height: 1;
|
||||
vertical-align: -0.075em;
|
||||
}
|
||||
|
||||
.markdown-body g-emoji img {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
.markdown-body::before {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.markdown-body::after {
|
||||
display: table;
|
||||
clear: both;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.markdown-body>*:first-child {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
.markdown-body>*:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.markdown-body a:not([href]) {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.markdown-body .absent {
|
||||
color: #cf222e;
|
||||
}
|
||||
|
||||
.markdown-body .anchor {
|
||||
float: left;
|
||||
padding-right: 4px;
|
||||
margin-left: -20px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.markdown-body .anchor:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.markdown-body p,
|
||||
.markdown-body blockquote,
|
||||
.markdown-body ul,
|
||||
.markdown-body ol,
|
||||
.markdown-body dl,
|
||||
.markdown-body table,
|
||||
.markdown-body pre,
|
||||
.markdown-body details {
|
||||
margin-top: 0;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.markdown-body blockquote>:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.markdown-body blockquote>:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.markdown-body sup>a::before {
|
||||
content: "[";
|
||||
}
|
||||
|
||||
.markdown-body sup>a::after {
|
||||
content: "]";
|
||||
}
|
||||
|
||||
.markdown-body h1 .octicon-link,
|
||||
.markdown-body h2 .octicon-link,
|
||||
.markdown-body h3 .octicon-link,
|
||||
.markdown-body h4 .octicon-link,
|
||||
.markdown-body h5 .octicon-link,
|
||||
.markdown-body h6 .octicon-link {
|
||||
color: #24292f;
|
||||
vertical-align: middle;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.markdown-body h1:hover .anchor,
|
||||
.markdown-body h2:hover .anchor,
|
||||
.markdown-body h3:hover .anchor,
|
||||
.markdown-body h4:hover .anchor,
|
||||
.markdown-body h5:hover .anchor,
|
||||
.markdown-body h6:hover .anchor {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.markdown-body h1:hover .anchor .octicon-link,
|
||||
.markdown-body h2:hover .anchor .octicon-link,
|
||||
.markdown-body h3:hover .anchor .octicon-link,
|
||||
.markdown-body h4:hover .anchor .octicon-link,
|
||||
.markdown-body h5:hover .anchor .octicon-link,
|
||||
.markdown-body h6:hover .anchor .octicon-link {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.markdown-body h1 tt,
|
||||
.markdown-body h1 code,
|
||||
.markdown-body h2 tt,
|
||||
.markdown-body h2 code,
|
||||
.markdown-body h3 tt,
|
||||
.markdown-body h3 code,
|
||||
.markdown-body h4 tt,
|
||||
.markdown-body h4 code,
|
||||
.markdown-body h5 tt,
|
||||
.markdown-body h5 code,
|
||||
.markdown-body h6 tt,
|
||||
.markdown-body h6 code {
|
||||
padding: 0 .2em;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
.markdown-body ul.no-list,
|
||||
.markdown-body ol.no-list {
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.markdown-body ol[type="1"] {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
.markdown-body ol[type=a] {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
|
||||
.markdown-body ol[type=i] {
|
||||
list-style-type: lower-roman;
|
||||
}
|
||||
|
||||
.markdown-body div>ol:not([type]) {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
.markdown-body ul ul,
|
||||
.markdown-body ul ol,
|
||||
.markdown-body ol ol,
|
||||
.markdown-body ol ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.markdown-body li>p {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.markdown-body li+li {
|
||||
margin-top: .25em;
|
||||
}
|
||||
|
||||
.markdown-body dl {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.markdown-body dl dt {
|
||||
padding: 0;
|
||||
margin-top: 16px;
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
font-weight: bold; // 600
|
||||
}
|
||||
|
||||
.markdown-body dl dd {
|
||||
padding: 0 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.markdown-body table th {
|
||||
font-weight: bold; // 600
|
||||
}
|
||||
|
||||
.markdown-body table th,
|
||||
.markdown-body table td {
|
||||
padding: 6px 13px;
|
||||
border: 1px solid #d0d7de;
|
||||
}
|
||||
|
||||
.markdown-body table tr {
|
||||
background-color: #ffffff;
|
||||
border-top: 1px solid hsla(210, 18%, 87%, 1);
|
||||
}
|
||||
|
||||
.markdown-body table tr:nth-child(2n) {
|
||||
background-color: #f6f8fa;
|
||||
}
|
||||
|
||||
.markdown-body table img {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.markdown-body img[align=right] {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.markdown-body img[align=left] {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.markdown-body .emoji {
|
||||
max-width: none;
|
||||
vertical-align: text-top;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.markdown-body span.frame {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.markdown-body span.frame>span {
|
||||
display: block;
|
||||
float: left;
|
||||
width: auto;
|
||||
padding: 7px;
|
||||
margin: 13px 0 0;
|
||||
overflow: hidden;
|
||||
border: 1px solid #d0d7de;
|
||||
}
|
||||
|
||||
.markdown-body span.frame span img {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.markdown-body span.frame span span {
|
||||
display: block;
|
||||
padding: 5px 0 0;
|
||||
clear: both;
|
||||
color: #24292f;
|
||||
}
|
||||
|
||||
.markdown-body span.align-center {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.markdown-body span.align-center>span {
|
||||
display: block;
|
||||
margin: 13px auto 0;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.markdown-body span.align-center span img {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.markdown-body span.align-right {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.markdown-body span.align-right>span {
|
||||
display: block;
|
||||
margin: 13px 0 0;
|
||||
overflow: hidden;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.markdown-body span.align-right span img {
|
||||
margin: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.markdown-body span.float-left {
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 13px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.markdown-body span.float-left span {
|
||||
margin: 13px 0 0;
|
||||
}
|
||||
|
||||
.markdown-body span.float-right {
|
||||
display: block;
|
||||
float: right;
|
||||
margin-left: 13px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.markdown-body span.float-right>span {
|
||||
display: block;
|
||||
margin: 13px auto 0;
|
||||
overflow: hidden;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.markdown-body code,
|
||||
.markdown-body tt {
|
||||
padding: .2em .4em;
|
||||
margin: 0;
|
||||
font-size: 85%;
|
||||
background-color: rgba(175, 184, 193, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.markdown-body code br,
|
||||
.markdown-body tt br {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.markdown-body del code {
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
.markdown-body pre code {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.markdown-body pre>code {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
word-break: normal;
|
||||
white-space: pre;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.markdown-body .highlight {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.markdown-body .highlight pre {
|
||||
margin-bottom: 0;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.markdown-body .highlight pre,
|
||||
.markdown-body pre {
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
font-size: 85%;
|
||||
line-height: 1.45;
|
||||
background-color: #f6f8fa;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.markdown-body pre code,
|
||||
.markdown-body pre tt {
|
||||
display: inline;
|
||||
max-width: auto;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
line-height: inherit;
|
||||
word-wrap: normal;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.markdown-body .csv-data td,
|
||||
.markdown-body .csv-data th {
|
||||
padding: 5px;
|
||||
overflow: hidden;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.markdown-body .csv-data .blob-num {
|
||||
padding: 10px 8px 9px;
|
||||
text-align: right;
|
||||
background: #ffffff;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.markdown-body .csv-data tr {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.markdown-body .csv-data th {
|
||||
font-weight: bold; // 600
|
||||
background: #f6f8fa;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.markdown-body .footnotes {
|
||||
font-size: 12px;
|
||||
color: #57606a;
|
||||
border-top: 1px solid #d0d7de;
|
||||
}
|
||||
|
||||
.markdown-body .footnotes ol {
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.markdown-body .footnotes li {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.markdown-body .footnotes li:target::before {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: -8px;
|
||||
bottom: -8px;
|
||||
left: -24px;
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
border: 2px solid #0969da;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.markdown-body .footnotes li:target {
|
||||
color: #24292f;
|
||||
}
|
||||
|
||||
.markdown-body .footnotes .data-footnote-backref g-emoji {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.markdown-body .task-list-item {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.markdown-body .task-list-item label {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.markdown-body .task-list-item.enabled label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.markdown-body .task-list-item+.task-list-item {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.markdown-body .task-list-item .handle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.markdown-body .task-list-item [type=checkbox] {
|
||||
margin: 0 .2em .25em -18px; // 0 .2em .25em -1.6em
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.markdown-body .contains-task-list:dir(rtl) .task-list-item [type=checkbox] {
|
||||
margin: 0 -1.6em .25em .2em;
|
||||
}
|
||||
|
||||
.markdown-body ::-webkit-calendar-picker-indicator {
|
||||
filter: invert(50%);
|
||||
}
|
||||
|
||||
.markdown-body .sr-only {
|
||||
border: 0;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
import Markdown from './Markdown';
|
||||
|
||||
export default Markdown;
|
||||
@@ -0,0 +1,117 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import React, { useCallback, useRef, useState } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import styles from './Masonry.module.scss';
|
||||
|
||||
const pixelsToNumber = (pixels) => {
|
||||
return Number(pixels.replace('px', ''));
|
||||
};
|
||||
|
||||
const Masonry = React.memo(({ children, columns, spacing }) => {
|
||||
const [maxColumnHeight, setMaxColumnHeight] = useState(0);
|
||||
|
||||
const wrapperRef = useRef(null);
|
||||
const resizeObserverRef = useRef(null);
|
||||
|
||||
const handleChildResize = useCallback(() => {
|
||||
const { current: wrapperElement } = wrapperRef;
|
||||
const columnHeights = new Array(columns).fill(0);
|
||||
|
||||
wrapperElement.childNodes.forEach((childElement) => {
|
||||
if (childElement.nodeType !== Node.ELEMENT_NODE || childElement.dataset.lineBreak) {
|
||||
return;
|
||||
}
|
||||
|
||||
const childComputedStyle = window.getComputedStyle(childElement);
|
||||
|
||||
const childHeight =
|
||||
Math.ceil(pixelsToNumber(childComputedStyle.height)) +
|
||||
pixelsToNumber(childComputedStyle.marginTop) +
|
||||
pixelsToNumber(childComputedStyle.marginBottom);
|
||||
|
||||
const index = columnHeights.indexOf(Math.min(...columnHeights));
|
||||
|
||||
columnHeights[index] += childHeight;
|
||||
childElement.style.order = index + 1; // eslint-disable-line no-param-reassign
|
||||
});
|
||||
|
||||
ReactDOM.flushSync(() => {
|
||||
setMaxColumnHeight(Math.max(...columnHeights));
|
||||
});
|
||||
}, [columns]);
|
||||
|
||||
const handleWrapperRef = useCallback(
|
||||
(element) => {
|
||||
wrapperRef.current = element;
|
||||
|
||||
if (resizeObserverRef.current) {
|
||||
resizeObserverRef.current.disconnect();
|
||||
}
|
||||
|
||||
if (!element) {
|
||||
resizeObserverRef.current = null;
|
||||
return;
|
||||
}
|
||||
|
||||
resizeObserverRef.current = new ResizeObserver(handleChildResize);
|
||||
|
||||
element.childNodes.forEach((childElement) => {
|
||||
if (!childElement.dataset.lineBreak) {
|
||||
resizeObserverRef.current.observe(childElement);
|
||||
}
|
||||
});
|
||||
},
|
||||
[children, handleChildResize], // eslint-disable-line react-hooks/exhaustive-deps
|
||||
);
|
||||
|
||||
const styledChildren = React.Children.map(
|
||||
children,
|
||||
(child) =>
|
||||
child &&
|
||||
React.cloneElement(child, {
|
||||
style: {
|
||||
margin: `${spacing / 2}px`,
|
||||
width: `calc(${(100 / columns).toFixed(2)}% - ${spacing}px)`,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const lineBreaks = [...Array(columns > 0 ? columns - 1 : 0)].map((_, index) => (
|
||||
<span
|
||||
data-line-break
|
||||
key={index} // eslint-disable-line react/no-array-index-key
|
||||
className={styles.lineBreak}
|
||||
style={{
|
||||
order: index + 1,
|
||||
}}
|
||||
/>
|
||||
));
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={handleWrapperRef}
|
||||
className={styles.wrapper}
|
||||
style={{
|
||||
height: `${maxColumnHeight}px`,
|
||||
margin: `-${spacing / 2}px`,
|
||||
}}
|
||||
>
|
||||
{styledChildren}
|
||||
{lineBreaks}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
Masonry.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
columns: PropTypes.number.isRequired,
|
||||
spacing: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
export default Masonry;
|
||||
@@ -0,0 +1,23 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
.lineBreak {
|
||||
flex-basis: 100%;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
width: 0 !important;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
align-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-flow: column wrap;
|
||||
width: 100%;
|
||||
|
||||
& > * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import Masonry from './Masonry';
|
||||
|
||||
export default Masonry;
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { Popup as SemanticUIPopup } from 'semantic-ui-react';
|
||||
|
||||
import PopupHeader from './PopupHeader';
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Popup as SemanticUIPopup } from 'semantic-ui-react';
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
.backButton {
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import Popup from './Popup';
|
||||
|
||||
export default Popup;
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import Input from './components/Input';
|
||||
import Popup from './components/Popup';
|
||||
import Markdown from './components/Markdown';
|
||||
import Masonry from './components/Masonry';
|
||||
import FilePicker from './components/FilePicker';
|
||||
|
||||
export { Input, Popup, Markdown, FilePicker };
|
||||
export { Input, Popup, Masonry, FilePicker };
|
||||
|
||||
Vendored
+2519
-2520
File diff suppressed because one or more lines are too long
@@ -1,7 +1,24 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import usePrevious from './use-previous';
|
||||
import useToggle from './use-toggle';
|
||||
import useForceUpdate from './use-force-update';
|
||||
import useEventCallback from './use-event-callback';
|
||||
import useDidUpdate from './use-did-update';
|
||||
import useWindowWidth from './use-window-width';
|
||||
import useTransitioning from './use-transitioning';
|
||||
import useClickAwayListener from './use-click-away-listener';
|
||||
|
||||
export { usePrevious, useToggle, useForceUpdate, useDidUpdate, useClickAwayListener };
|
||||
export {
|
||||
usePrevious,
|
||||
useToggle,
|
||||
useForceUpdate,
|
||||
useEventCallback,
|
||||
useDidUpdate,
|
||||
useWindowWidth,
|
||||
useTransitioning,
|
||||
useClickAwayListener,
|
||||
};
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
|
||||
export default (elementRefs, onAwayClick, onCancel) => {
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
export default (callback, dependencies) => {
|
||||
const isMounted = useRef(false);
|
||||
const isMountedRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (isMounted.current) {
|
||||
if (isMountedRef.current) {
|
||||
callback();
|
||||
} else {
|
||||
isMounted.current = true;
|
||||
isMountedRef.current = true;
|
||||
}
|
||||
}, dependencies); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
};
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
|
||||
export default (callback, dependencies) => {
|
||||
const callbackRef = useRef(() => {
|
||||
throw new Error('Cannot call an event handler while rendering.');
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
callbackRef.current = callback;
|
||||
}, [callback, ...dependencies]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return useCallback((...args) => callbackRef.current(...args), []);
|
||||
};
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import useToggle from './use-toggle';
|
||||
|
||||
export default () => useToggle()[1];
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
export default (value) => {
|
||||
const prevValue = useRef();
|
||||
const prevValueRef = useRef();
|
||||
|
||||
useEffect(() => {
|
||||
prevValue.current = value;
|
||||
prevValueRef.current = value;
|
||||
}, [value]);
|
||||
|
||||
return prevValue.current;
|
||||
return prevValueRef.current;
|
||||
};
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
export default (defaultState = false) => {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { useCallback, useLayoutEffect } from 'react';
|
||||
|
||||
export default (ref, className, dependencies) => {
|
||||
const handleTransitionEnd = useCallback((event) => {
|
||||
if (event.target === ref.current) {
|
||||
ref.current.classList.remove(className);
|
||||
}
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
useLayoutEffect(() => {
|
||||
ref.current.classList.add(className);
|
||||
}, dependencies); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return handleTransitionEnd;
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export default () => {
|
||||
const [width, setWidth] = useState(window.innerWidth);
|
||||
|
||||
useEffect(() => {
|
||||
const handleResize = () => {
|
||||
setWidth(window.innerWidth);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', handleResize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return width;
|
||||
};
|
||||
@@ -1,4 +1,9 @@
|
||||
.closeButton {
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
.closeButton {
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
margin: 0 !important;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
export default () => {
|
||||
document.dispatchEvent(new MouseEvent('click')); // FIXME: hack
|
||||
document.body.click(); // FIXME: hack
|
||||
};
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import usePopup from './use-popup';
|
||||
import closePopup from './close-popup';
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { ResizeObserver } from '@juggle/resize-observer';
|
||||
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
@@ -5,25 +10,25 @@ import { Button, Popup as SemanticUIPopup } from 'semantic-ui-react';
|
||||
|
||||
import styles from './Popup.module.css';
|
||||
|
||||
export default (Step, props) => {
|
||||
export default (Step, { position, onOpen, onClose } = {}) => {
|
||||
return useMemo(() => {
|
||||
const Popup = React.memo(({ children, onClose, ...stepProps }) => {
|
||||
const Popup = React.memo(({ children, ...stepProps }) => {
|
||||
const [isOpened, setIsOpened] = useState(false);
|
||||
|
||||
const wrapper = useRef(null);
|
||||
const resizeObserver = useRef(null);
|
||||
const wrapperRef = useRef(null);
|
||||
const resizeObserverRef = useRef(null);
|
||||
|
||||
const handleOpen = useCallback(() => {
|
||||
setIsOpened(true);
|
||||
|
||||
if (onOpen) {
|
||||
onOpen();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleClose = useCallback(() => {
|
||||
setIsOpened(false);
|
||||
|
||||
if (onClose) {
|
||||
onClose();
|
||||
}
|
||||
}, [onClose]);
|
||||
}, []);
|
||||
|
||||
const handleMouseDown = useCallback((event) => {
|
||||
event.stopPropagation();
|
||||
@@ -36,7 +41,6 @@ export default (Step, props) => {
|
||||
const handleTriggerClick = useCallback(
|
||||
(event) => {
|
||||
event.stopPropagation();
|
||||
|
||||
const { onClick } = children;
|
||||
|
||||
if (onClick) {
|
||||
@@ -47,26 +51,26 @@ export default (Step, props) => {
|
||||
);
|
||||
|
||||
const handleContentRef = useCallback((element) => {
|
||||
if (resizeObserver.current) {
|
||||
resizeObserver.current.disconnect();
|
||||
if (resizeObserverRef.current) {
|
||||
resizeObserverRef.current.disconnect();
|
||||
}
|
||||
|
||||
if (!element) {
|
||||
resizeObserver.current = null;
|
||||
resizeObserverRef.current = null;
|
||||
return;
|
||||
}
|
||||
|
||||
resizeObserver.current = new ResizeObserver(() => {
|
||||
if (resizeObserver.current.isInitial) {
|
||||
resizeObserver.current.isInitial = false;
|
||||
resizeObserverRef.current = new ResizeObserver(() => {
|
||||
if (resizeObserverRef.current.isInitial) {
|
||||
resizeObserverRef.current.isInitial = false;
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper.current.positionUpdate();
|
||||
wrapperRef.current.positionUpdate();
|
||||
});
|
||||
|
||||
resizeObserver.current.isInitial = true;
|
||||
resizeObserver.current.observe(element);
|
||||
resizeObserverRef.current.isInitial = true;
|
||||
resizeObserverRef.current.observe(element);
|
||||
}, []);
|
||||
|
||||
const tigger = React.cloneElement(children, {
|
||||
@@ -77,11 +81,11 @@ export default (Step, props) => {
|
||||
<SemanticUIPopup
|
||||
basic
|
||||
wide
|
||||
ref={wrapper}
|
||||
ref={wrapperRef}
|
||||
trigger={tigger}
|
||||
on="click"
|
||||
open={isOpened}
|
||||
position="bottom left"
|
||||
position={position || 'bottom left'}
|
||||
popperModifiers={[
|
||||
{
|
||||
name: 'preventOverflow',
|
||||
@@ -95,9 +99,9 @@ export default (Step, props) => {
|
||||
className={styles.wrapper}
|
||||
onOpen={handleOpen}
|
||||
onClose={handleClose}
|
||||
onUnmount={onClose}
|
||||
onMouseDown={handleMouseDown}
|
||||
onClick={handleClick}
|
||||
{...props} // eslint-disable-line react/jsx-props-no-spreading
|
||||
>
|
||||
<div ref={handleContentRef}>
|
||||
<Button icon="close" onClick={handleClose} className={styles.closeButton} />
|
||||
@@ -110,13 +114,8 @@ export default (Step, props) => {
|
||||
|
||||
Popup.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
onClose: PropTypes.func,
|
||||
};
|
||||
|
||||
Popup.defaultProps = {
|
||||
onClose: undefined,
|
||||
};
|
||||
|
||||
return Popup;
|
||||
}, [props]);
|
||||
}, [position, onOpen, onClose]);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import React, { useLayoutEffect } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
export const LOCATION_CHANGE_HANDLE = '@@router/LOCATION_CHANGE_HANDLE';
|
||||
|
||||
export const handleLocationChange = (location, action, isFirstRendering = false) => ({
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { HISTORY_METHOD_CALL } from './actions';
|
||||
|
||||
const createRouterMiddleware = (history) => {
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import { LOCATION_CHANGE_HANDLE } from './actions';
|
||||
|
||||
const createRouterReducer = (history) => {
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
export {
|
||||
LOCATION_CHANGE_HANDLE,
|
||||
HISTORY_METHOD_CALL,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import syntaxHighlighter from './syntax-highlighter';
|
||||
|
||||
export default syntaxHighlighter;
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* This file derives from https://github.com/chapel-lang/highlightjs-chapel
|
||||
* Licensed under the BSD 3-Clause License:
|
||||
*
|
||||
* Copyright (c) 2006, Ivan Sagalaev.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Language: Chapel
|
||||
Author: Brad Chamberlain <bradcray@gmail.com>
|
||||
Contributors:
|
||||
Description: A parallel language for productive programming at scale
|
||||
Website: https://chapel-lang.org
|
||||
*/
|
||||
|
||||
export default (hljs) => ({
|
||||
name: 'Chapel',
|
||||
aliases: ['chapel', 'chpl'],
|
||||
disableAutodetect: true,
|
||||
keywords: {
|
||||
keyword:
|
||||
'align as atomic begin bool borrowed break by bytes catch class cobegin coforall complex config const continue defer delete dmapped do domain else enum export except extern for forall forwarding if imag import in include index inline inout int iter label lambda let lifetime local locale module new noinit nothing on only otherwise out override owned param private proc prototype public real record reduce ref require return scan select serial shared single sparse string subdomain sync then this throw throws try try! type uint union unmanaged use var void when where while with yield zip',
|
||||
|
||||
// What other built-ins should we add here?
|
||||
built_in: 'here Locales write writef writeln',
|
||||
literal: 'false true nil none',
|
||||
},
|
||||
contains: [
|
||||
// Our line comments are like C's
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
|
||||
// Like C's block comment mode, but supporting nested comments:
|
||||
hljs.COMMENT('/\\*', '\\*/', { contains: ['self'] }),
|
||||
|
||||
// The following is similar to C's C_NUMBER_MODE, but it
|
||||
// requires a digit after '9.' like Chapel does to avoid
|
||||
// mis-coloring '0..10' and disambiguate calls like
|
||||
// '9.square()'
|
||||
{
|
||||
className: 'number',
|
||||
begin:
|
||||
// eslint-disable-next-line no-multi-str
|
||||
'(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d+)?|\\.\\d\
|
||||
+)([eE][-+]?\\d+)?)',
|
||||
relevance: 0,
|
||||
},
|
||||
// More could/should be done here to handle escapes and
|
||||
// the like, but for some reason, inheriting the C string
|
||||
// definitions didn't work well for me, so I went with this
|
||||
// basic approach for now.
|
||||
{
|
||||
className: 'string',
|
||||
variants: [
|
||||
{
|
||||
begin: '(b)?"',
|
||||
end: '"',
|
||||
},
|
||||
{
|
||||
begin: "(b)?'",
|
||||
end: "'",
|
||||
},
|
||||
{
|
||||
begin: '(b)?"""',
|
||||
end: '"""',
|
||||
},
|
||||
{
|
||||
begin: "(b)?'''",
|
||||
end: "'''",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
Language: Dafny
|
||||
Author: Roberto Saltini
|
||||
Description: Grammar definition for the Dafny language
|
||||
Website: https://github.com/dafny-lang/dafny
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2021, ConsenSys Software Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
export default (hljs) => {
|
||||
const IDENT_WITH_BRACKETS = /[a-zA-Z][a-zA-Z_<>0-9]*/;
|
||||
|
||||
const DAFNY_KEYWORDS = [
|
||||
'abstract',
|
||||
'allocated',
|
||||
'as',
|
||||
'assert',
|
||||
'assume',
|
||||
'break',
|
||||
'by',
|
||||
'calc',
|
||||
'case',
|
||||
'class',
|
||||
'codatatype',
|
||||
'colemma',
|
||||
'const',
|
||||
'constructor',
|
||||
'copredicate',
|
||||
'datatype',
|
||||
'decreases',
|
||||
'else',
|
||||
'ensures',
|
||||
'exists',
|
||||
'export',
|
||||
'extends',
|
||||
'forall',
|
||||
'fresh',
|
||||
'function',
|
||||
'for',
|
||||
'ghost',
|
||||
'if',
|
||||
'import',
|
||||
'include',
|
||||
'inductive',
|
||||
'invariant',
|
||||
'is',
|
||||
'iterator',
|
||||
'label',
|
||||
'lemma',
|
||||
'match',
|
||||
'method',
|
||||
'modifies',
|
||||
'modify',
|
||||
'module',
|
||||
'nameonly',
|
||||
'new',
|
||||
'newtype',
|
||||
'old',
|
||||
'opened',
|
||||
'predicate',
|
||||
'print',
|
||||
'provides',
|
||||
'reads',
|
||||
'real',
|
||||
'refines',
|
||||
'requires',
|
||||
'return',
|
||||
'returns',
|
||||
'reveal',
|
||||
'reveals',
|
||||
'static',
|
||||
'string',
|
||||
'then',
|
||||
'this',
|
||||
'trait',
|
||||
'twostate',
|
||||
'type',
|
||||
'unchanged',
|
||||
'var',
|
||||
'while',
|
||||
'witness',
|
||||
'yield',
|
||||
'yields',
|
||||
];
|
||||
|
||||
const DAFNY_TYPES = [
|
||||
'bool',
|
||||
'char',
|
||||
'imap',
|
||||
'iset',
|
||||
'int',
|
||||
'map',
|
||||
'multiset',
|
||||
'nat',
|
||||
'object',
|
||||
'object?',
|
||||
'ORDINAL',
|
||||
'seq',
|
||||
'set',
|
||||
'array',
|
||||
'bc',
|
||||
];
|
||||
const DAFNY_LITERALS = ['false', 'null', 'true'];
|
||||
const KEYWORDS = {
|
||||
keyword: DAFNY_KEYWORDS,
|
||||
type: DAFNY_TYPES,
|
||||
literal: DAFNY_LITERALS,
|
||||
};
|
||||
const TYPE_FOR_IDENTIFIERS = {
|
||||
begin: [/(?<!:):/, /[\s\n]*/, IDENT_WITH_BRACKETS],
|
||||
scope: {
|
||||
1: 'operator',
|
||||
3: 'type',
|
||||
},
|
||||
relevance: 0,
|
||||
};
|
||||
|
||||
const OPERATORS = {
|
||||
begin: `${/(?<!\w)/.source}(${[
|
||||
'&&',
|
||||
'\\|\\|',
|
||||
'<==>',
|
||||
'==>',
|
||||
'<==',
|
||||
'==',
|
||||
'!=',
|
||||
'!',
|
||||
'>',
|
||||
'<',
|
||||
'>=',
|
||||
'<=',
|
||||
'\\+',
|
||||
'-',
|
||||
'\\*',
|
||||
'/',
|
||||
'%',
|
||||
'>>',
|
||||
'<<',
|
||||
'&',
|
||||
'\\|',
|
||||
'\\^',
|
||||
'!!',
|
||||
'in',
|
||||
'!in',
|
||||
':=',
|
||||
':\\|',
|
||||
'::',
|
||||
'=',
|
||||
].join('|')})${/(?!\w)/.source}`,
|
||||
scope: 'operator',
|
||||
relevance: 0,
|
||||
};
|
||||
return {
|
||||
case_insensitive: false,
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.NUMBER_MODE,
|
||||
hljs.COMMENT(
|
||||
'/\\*', // begin
|
||||
'\\*/', // end
|
||||
{
|
||||
contains: [
|
||||
{
|
||||
scope: 'doctag',
|
||||
begin: '@\\w+',
|
||||
relevance: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
TYPE_FOR_IDENTIFIERS,
|
||||
OPERATORS,
|
||||
{
|
||||
begin: `\\b(${DAFNY_TYPES.join('|')})\\b${IDENT_WITH_BRACKETS.source}`,
|
||||
scope: 'type',
|
||||
},
|
||||
{
|
||||
begin: [/\b(class|module|trait)\b/, /\s*/, hljs.IDENT_RE],
|
||||
scope: {
|
||||
1: 'keyword',
|
||||
3: 'title.class',
|
||||
},
|
||||
relevance: 0,
|
||||
},
|
||||
{
|
||||
begin: [`(?:${hljs.IDENT_RE}\\s+)`, hljs.IDENT_RE, /\s*(?=\(|<)/],
|
||||
scope: {
|
||||
2: 'title.function',
|
||||
},
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
{
|
||||
begin: /</,
|
||||
end: />/,
|
||||
scope: 'type',
|
||||
relevance: 0,
|
||||
},
|
||||
{
|
||||
scope: 'params',
|
||||
begin: /\(/,
|
||||
end: /\)/,
|
||||
keywords: KEYWORDS,
|
||||
relevance: 0,
|
||||
contains: [
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
TYPE_FOR_IDENTIFIERS,
|
||||
OPERATORS,
|
||||
hljs.NUMBER_MODE,
|
||||
],
|
||||
},
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* This file derives from https://github.com/highlightjs/highlightjs-GN
|
||||
* Licensed under the MIT License:
|
||||
*
|
||||
* Copyright (c) 2019 Petr Hosek
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* highlight.js GN syntax highlighting definition
|
||||
*
|
||||
* @see https://github.com/highlightjs/highlight.js
|
||||
*
|
||||
* @package: highlightjs-GN
|
||||
* @author: Petr Hosek <petrhosek@gmail.com>
|
||||
* @since: 2019-05-28
|
||||
*
|
||||
* Description: GN is a meta-build system that generates build files for Ninja.
|
||||
* Category: common
|
||||
*/
|
||||
|
||||
export default (hljs) => {
|
||||
const SUBST = {
|
||||
className: 'subst',
|
||||
relevance: 2,
|
||||
variants: [
|
||||
{
|
||||
begin: '\\$[A-Za-z0-9_]+',
|
||||
},
|
||||
{
|
||||
begin: '\\${',
|
||||
end: '}',
|
||||
contains: [
|
||||
{
|
||||
className: 'variable',
|
||||
begin: hljs.UNDERSCORE_IDENT_RE,
|
||||
relevance: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const LINK = {
|
||||
className: 'link',
|
||||
relevance: 5,
|
||||
begin: ':\\w+',
|
||||
};
|
||||
|
||||
const NUMBER = {
|
||||
className: 'number',
|
||||
relevance: 0,
|
||||
begin: hljs.NUMBER_RE,
|
||||
};
|
||||
|
||||
const STRING = {
|
||||
className: 'string',
|
||||
relevance: 0,
|
||||
begin: '"',
|
||||
end: '"',
|
||||
illegal: '\\n',
|
||||
contains: [hljs.BACKSLASH_ESCAPE, SUBST, LINK],
|
||||
};
|
||||
|
||||
const KEYWORDS = {
|
||||
keyword: 'if else',
|
||||
literal:
|
||||
'true false ' +
|
||||
'current_cpu current_os current_toolchain ' +
|
||||
'default_toolchain host_cpu host_os ' +
|
||||
'root_build_dir root_gen_dir root_out_dir ' +
|
||||
'target_cpu target_gen_dir target_out_dir ' +
|
||||
'target_os target_name invoker',
|
||||
type:
|
||||
'action action_foreach copy executable group ' +
|
||||
'shared_library source_set static_library ' +
|
||||
'loadable_module generated_file',
|
||||
built_in:
|
||||
'assert config declare_args defined exec_script ' +
|
||||
'foreach get_label_info get_path_info ' +
|
||||
'get_target_outputs getenv import print ' +
|
||||
'process_file_template read_file rebase_path ' +
|
||||
'set_default_toolchain set_defaults ' +
|
||||
'set_sources_assignment_filter template tool ' +
|
||||
'toolchain toolchain_args propagates_configs ' +
|
||||
'write_file forward_variables_from target ' +
|
||||
'get_name_info not_needed',
|
||||
symbol:
|
||||
'all_dependent_configs allow_circular_includes_from ' +
|
||||
'args asmflags cflags cflags_c cflags_cc cflags_objc ' +
|
||||
'cflags_objcc check_includes complete_static_lib ' +
|
||||
'configs data data_deps defines depfile deps ' +
|
||||
'include_dirs inputs ldflags lib_dirs libs ' +
|
||||
'output_extension output_name outputs public ' +
|
||||
'public_configs public_deps script sources testonly ' +
|
||||
'visibility contents output_conversion rebase ' +
|
||||
'data_keys walk_keys',
|
||||
};
|
||||
|
||||
return {
|
||||
aliases: ['gn', 'gni'],
|
||||
keywords: KEYWORDS,
|
||||
contains: [NUMBER, STRING, hljs.HASH_COMMENT_MODE],
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* This file derives from https://github.com/highlightjs/highlightjs-gdscript
|
||||
* Licensed under the BSD 3-Clause License:
|
||||
*
|
||||
* Copyright (c) 2020, highlight.js
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Language: GDScript
|
||||
Author: Khairul Hidayat <me@khairul.my.id>, Nelson Sylvest*r Fritsch <info@nelsonfritsch.de>, Hugo Locurcio <hugo.locurcio@hugo.pro>
|
||||
Description: Programming language for Godot Engine
|
||||
*/
|
||||
|
||||
export default (hljs) => {
|
||||
const KEYWORDS = {
|
||||
keyword:
|
||||
'and in not or self void as assert breakpoint class class_name ' +
|
||||
'extends is func setget signal tool yield const enum export ' +
|
||||
'onready static var break continue if elif else for pass return ' +
|
||||
'match while remote sync master puppet remotesync mastersync ' +
|
||||
'puppetsync',
|
||||
|
||||
built_in:
|
||||
'Color8 ColorN abs acos asin atan atan2 bytes2var ' +
|
||||
'cartesian2polar ceil char clamp convert cos cosh db2linear ' +
|
||||
'decimals dectime deg2rad dict2inst ease exp floor fmod fposmod ' +
|
||||
'funcref get_stack hash inst2dict instance_from_id inverse_lerp ' +
|
||||
'is_equal_approx is_inf is_instance_valid is_nan is_zero_approx ' +
|
||||
'len lerp lerp_angle linear2db load log max min move_toward ' +
|
||||
'nearest_po2 ord parse_json polar2cartesian posmod pow preload ' +
|
||||
'print_stack push_error push_warning rad2deg rand_range ' +
|
||||
'rand_seed randf randi randomize range_lerp round seed sign sin ' +
|
||||
'sinh smoothstep sqrt step_decimals stepify str str2var tan tanh ' +
|
||||
'to_json type_exists typeof validate_json var2bytes var2str ' +
|
||||
'weakref wrapf wrapi bool int float String NodePath ' +
|
||||
'Vector2 Rect2 Transform2D Vector3 Rect3 Plane ' +
|
||||
'Quat Basis Transform Color RID Object NodePath ' +
|
||||
'Dictionary Array PoolByteArray PoolIntArray ' +
|
||||
'PoolRealArray PoolStringArray PoolVector2Array ' +
|
||||
'PoolVector3Array PoolColorArray',
|
||||
|
||||
literal: 'true false null',
|
||||
};
|
||||
|
||||
return {
|
||||
aliases: ['godot', 'gdscript'],
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
hljs.NUMBER_MODE,
|
||||
hljs.HASH_COMMENT_MODE,
|
||||
{
|
||||
className: 'comment',
|
||||
begin: /"""/,
|
||||
end: /"""/,
|
||||
},
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
{
|
||||
variants: [
|
||||
{
|
||||
className: 'function',
|
||||
beginKeywords: 'func',
|
||||
},
|
||||
{
|
||||
className: 'class',
|
||||
beginKeywords: 'class',
|
||||
},
|
||||
],
|
||||
end: /:/,
|
||||
contains: [hljs.UNDERSCORE_TITLE_MODE],
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* This file derives from https://github.com/highlightjs/highlightjs-hlsl
|
||||
* Licensed under the MIT License:
|
||||
*
|
||||
* Copyright (c) 2021 Stef Levesque (@stef-levesque)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Language: HLSL
|
||||
Description: High-level shader language
|
||||
Author: Stef Levesque
|
||||
Website: https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl
|
||||
Category: graphics
|
||||
*/
|
||||
|
||||
const HLSL_NUMBER_RE =
|
||||
'(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?([hHfFlL]?)|\\.\\d+)([eE][-+]?\\d+)?([hHfFlL]?))'; // 0x..., 0..., decimal, float, half, double
|
||||
|
||||
const HLSL_NUMBER_MODE = {
|
||||
className: 'number',
|
||||
begin: HLSL_NUMBER_RE,
|
||||
relevance: 0,
|
||||
};
|
||||
|
||||
export default (hljs) => {
|
||||
const matrixBases =
|
||||
// eslint-disable-next-line no-useless-concat
|
||||
'bool double float half int uint ' + 'min16float min10float min16int min12int min16uint';
|
||||
|
||||
const matrixSuffixes = [
|
||||
'',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'1x1',
|
||||
'1x2',
|
||||
'1x3',
|
||||
'1x4',
|
||||
'2x1',
|
||||
'2x2',
|
||||
'2x3',
|
||||
'2x4',
|
||||
'3x1',
|
||||
'3x2',
|
||||
'3x3',
|
||||
'3x4',
|
||||
'4x1',
|
||||
'4x2',
|
||||
'4x3',
|
||||
'4x4',
|
||||
];
|
||||
|
||||
const matrixTypes = [];
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const base of matrixBases.split(' ')) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const suffix of matrixSuffixes) {
|
||||
matrixTypes.push(base + suffix);
|
||||
}
|
||||
}
|
||||
|
||||
const semanticsSV =
|
||||
'SV_Coverage SV_Depth SV_DispatchThreadID SV_DomainLocation ' +
|
||||
'SV_GroupID SV_GroupIndex SV_GroupThreadID SV_GSInstanceID SV_InnerCoverage SV_InsideTessFactor ' +
|
||||
'SV_InstanceID SV_IsFrontFace SV_OutputControlPointID SV_Position SV_PrimitiveID ' +
|
||||
'SV_RenderTargetArrayIndex SV_SampleIndex SV_StencilRef SV_TessFactor SV_VertexID ' +
|
||||
'SV_ViewportArrayIndex, SV_ShadingRate';
|
||||
|
||||
const semanticsNum =
|
||||
'BINORMAL BLENDINDICES BLENDWEIGHT COLOR NORMAL POSITION PSIZE TANGENT TEXCOORD TESSFACTOR DEPTH ' +
|
||||
'SV_ClipDistance SV_CullDistance SV_DepthGreaterEqual SV_DepthLessEqual SV_Target ' +
|
||||
'SV_CLIPDISTANCE SV_CULLDISTANCE SV_DEPTHGREATEREQUAL SV_DEPTHLESSEQUAL SV_TARGET';
|
||||
|
||||
const semanticsTypes = semanticsNum.split(' ');
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const s of semanticsNum.split(' ')) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const n of Array(16).keys()) {
|
||||
semanticsTypes.push(s + n.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'HLSL',
|
||||
keywords: {
|
||||
keyword:
|
||||
'AppendStructuredBuffer asm asm_fragment BlendState break Buffer ByteAddressBuffer case ' +
|
||||
'cbuffer centroid class column_major compile compile_fragment CompileShader const continue ' +
|
||||
'ComputeShader ConsumeStructuredBuffer default DepthStencilState DepthStencilView discard do ' +
|
||||
'DomainShader dword else export extern false for fxgroup GeometryShader groupshared ' +
|
||||
'Hullshader if in inline inout InputPatch interface line lineadj linear LineStream ' +
|
||||
'matrix namespace nointerpolation noperspective ' +
|
||||
'NULL out OutputPatch packoffset pass pixelfragment PixelShader point PointStream precise ' +
|
||||
'RasterizerState RenderTargetView return register row_major RWBuffer RWByteAddressBuffer ' +
|
||||
'RWStructuredBuffer RWTexture1D RWTexture1DArray RWTexture2D RWTexture2DArray RWTexture3D sample ' +
|
||||
'sampler SamplerState SamplerComparisonState shared snorm stateblock stateblock_state static string ' +
|
||||
'struct switch StructuredBuffer tbuffer technique technique10 technique11 texture Texture1D ' +
|
||||
'Texture1DArray Texture2D Texture2DArray Texture2DMS Texture2DMSArray Texture3D TextureCube ' +
|
||||
'TextureCubeArray true typedef triangle triangleadj TriangleStream uint uniform unorm unsigned ' +
|
||||
'vector vertexfragment VertexShader void volatile while',
|
||||
|
||||
type:
|
||||
// Data Types
|
||||
`${matrixTypes.join(' ')} ` +
|
||||
`Buffer vector matrix sampler SamplerState PixelShader VertexShader ` +
|
||||
`texture Texture1D Texture1DArray Texture2D Texture2DArray Texture2DMS Texture2DMSArray Texture3D ` +
|
||||
`TextureCube TextureCubeArray struct typedef`,
|
||||
|
||||
built_in:
|
||||
// Semantics
|
||||
`POSITIONT FOG PSIZE VFACE VPOS ${semanticsTypes.join(
|
||||
' ',
|
||||
)} ${semanticsSV} ${semanticsSV.toUpperCase()} ` +
|
||||
// Functions
|
||||
`abort abs acos all AllMemoryBarrier AllMemoryBarrierWithGroupSync any asdouble asfloat asin asint asuint ` +
|
||||
`atan atan2 ceil CheckAccessFullyMapped clamp clip cos cosh countbits cross D3DCOLORtoUBYTE4 ddx ddx_coarse ` +
|
||||
`ddx_fine ddy ddy_coarse ddy_fine degrees determinant DeviceMemoryBarrier DeviceMemoryBarrierWithGroupSync ` +
|
||||
`distance dot dst errorf EvaluateAttributeAtCentroid EvaluateAttributeAtSample EvaluateAttributeSnapped ` +
|
||||
`exp exp2 f16tof32 f32tof16 faceforward firstbithigh firstbitlow floor fma fmod frac frexp fwidth ` +
|
||||
`GetRenderTargetSampleCount GetRenderTargetSamplePosition GroupMemoryBarrier GroupMemoryBarrierWithGroupSync ` +
|
||||
`InterlockedAdd InterlockedAnd InterlockedCompareExchange InterlockedCompareStore InterlockedExchange ` +
|
||||
`InterlockedMax InterlockedMin InterlockedOr InterlockedXor isfinite isinf isnan ldexp length lerp lit log ` +
|
||||
`log10 log2 mad max min modf msad4 mul noise normalize pow printf Process2DQuadTessFactorsAvg ` +
|
||||
`Process2DQuadTessFactorsMax Process2DQuadTessFactorsMin ProcessIsolineTessFactors ProcessQuadTessFactorsAvg ` +
|
||||
`ProcessQuadTessFactorsMax ProcessQuadTessFactorsMin ProcessTriTessFactorsAvg ProcessTriTessFactorsMax ` +
|
||||
`ProcessTriTessFactorsMin radians rcp reflect refract reversebits round rsqrt saturate sign sin sincos sinh ` +
|
||||
`smoothstep sqrt step tan tanh tex1D tex1Dbias tex1Dgrad tex1Dlod tex1Dproj tex2D tex2Dbias tex2Dgrad ` +
|
||||
`tex2Dlod tex2Dproj tex3D tex3Dbias tex3Dgrad tex3Dlod tex3Dproj texCUBE texCUBEbias texCUBEgrad texCUBElod ` +
|
||||
`texCUBEproj transpose trunc`,
|
||||
|
||||
literal: 'true false',
|
||||
},
|
||||
illegal: '"',
|
||||
contains: [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
HLSL_NUMBER_MODE,
|
||||
{
|
||||
className: 'meta',
|
||||
begin: '#',
|
||||
end: '$',
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* This file derives from https://github.com/highlightjs/highlightjs-terraform
|
||||
* Licensed under the MIT License:
|
||||
*
|
||||
* Copyright (c) 2020 highlightjs-terraform
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* highlight.js terraform syntax highlighting definition
|
||||
*
|
||||
* @see https://github.com/highlightjs/highlight.js
|
||||
*
|
||||
* :TODO:
|
||||
*
|
||||
* @package: highlightjs-terraform
|
||||
* @author: Nikos Tsirmirakis <nikos.tsirmirakis@winopsdba.com>
|
||||
* @since: 2019-03-20
|
||||
*
|
||||
* Description: Terraform (HCL) language definition
|
||||
* Category: scripting
|
||||
*/
|
||||
|
||||
export default (hljs) => {
|
||||
const NUMBERS = {
|
||||
className: 'number',
|
||||
begin: '\\b\\d+(\\.\\d+)?',
|
||||
relevance: 0,
|
||||
};
|
||||
const STRINGS = {
|
||||
className: 'string',
|
||||
begin: '"',
|
||||
end: '"',
|
||||
contains: [
|
||||
{
|
||||
className: 'variable',
|
||||
begin: '\\${',
|
||||
end: '\\}',
|
||||
relevance: 9,
|
||||
contains: [
|
||||
{
|
||||
className: 'string',
|
||||
begin: '"',
|
||||
end: '"',
|
||||
},
|
||||
{
|
||||
className: 'meta',
|
||||
begin: '[A-Za-z_0-9]*' + '\\(', // eslint-disable-line no-useless-concat
|
||||
end: '\\)',
|
||||
contains: [
|
||||
NUMBERS,
|
||||
{
|
||||
className: 'string',
|
||||
begin: '"',
|
||||
end: '"',
|
||||
contains: [
|
||||
{
|
||||
className: 'variable',
|
||||
begin: '\\${',
|
||||
end: '\\}',
|
||||
contains: [
|
||||
{
|
||||
className: 'string',
|
||||
begin: '"',
|
||||
end: '"',
|
||||
contains: [
|
||||
{
|
||||
className: 'variable',
|
||||
begin: '\\${',
|
||||
end: '\\}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
className: 'meta',
|
||||
begin: '[A-Za-z_0-9]*' + '\\(', // eslint-disable-line no-useless-concat
|
||||
end: '\\)',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
'self',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return {
|
||||
aliases: ['tf', 'hcl'],
|
||||
keywords: 'resource variable provider output locals module data terraform|10',
|
||||
literal: 'false true null',
|
||||
contains: [hljs.COMMENT('\\#', '$'), NUMBERS, STRINGS],
|
||||
};
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import languagesMap from './languages-map.json';
|
||||
|
||||
const LANGUAGES_BY_FILENAME = {};
|
||||
const LANGUAGES_BY_EXTENSION = {};
|
||||
|
||||
Object.entries(languagesMap).forEach(([language, { f: filenames, e: extensions }]) => {
|
||||
if (filenames) {
|
||||
filenames.forEach((filename) => {
|
||||
if (!LANGUAGES_BY_FILENAME[filename]) {
|
||||
LANGUAGES_BY_FILENAME[filename] = [];
|
||||
}
|
||||
|
||||
LANGUAGES_BY_FILENAME[filename].push(language);
|
||||
});
|
||||
}
|
||||
|
||||
if (extensions) {
|
||||
extensions.forEach((extension) => {
|
||||
if (!LANGUAGES_BY_EXTENSION[extension]) {
|
||||
LANGUAGES_BY_EXTENSION[extension] = [];
|
||||
}
|
||||
|
||||
LANGUAGES_BY_EXTENSION[extension].push(language);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export { LANGUAGES_BY_FILENAME, LANGUAGES_BY_EXTENSION };
|
||||
|
||||
export const detectLanguagesByFilename = (filename) => {
|
||||
let languages = LANGUAGES_BY_FILENAME[filename];
|
||||
|
||||
if (languages) {
|
||||
return languages;
|
||||
}
|
||||
|
||||
const extensions = filename.substring(1).split('.');
|
||||
|
||||
if (extensions.length === 1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (extensions.length > 2) {
|
||||
const extension = extensions.slice(-2).join('.');
|
||||
languages = LANGUAGES_BY_EXTENSION[extension];
|
||||
|
||||
if (languages) {
|
||||
return languages;
|
||||
}
|
||||
}
|
||||
|
||||
return LANGUAGES_BY_EXTENSION[extensions[extensions.length - 1]] || [];
|
||||
};
|
||||
|
||||
const createLanguageLoader = (language, loader) => async (registerLanguage) => {
|
||||
const { default: definition } = await loader();
|
||||
registerLanguage(language, definition);
|
||||
};
|
||||
|
||||
export const languageLoaders = {
|
||||
'4d': createLanguageLoader('4d', () => import('highlightjs-4d')),
|
||||
'sap-abap': createLanguageLoader('sap-abap', () => import('highlightjs-sap-abap')),
|
||||
apex: createLanguageLoader('apex', () => import('highlightjs-apex')),
|
||||
alan: createLanguageLoader('alan', () => import('highlightjs-alan')),
|
||||
ballerina: createLanguageLoader('ballerina', () => import('@ballerina/highlightjs-ballerina')),
|
||||
blade: createLanguageLoader('blade', () => import('highlightjs-blade')),
|
||||
cobol: createLanguageLoader('cobol', () => import('highlightjs-cobol')),
|
||||
chapel: createLanguageLoader('chapel', () => import('./language-definitions/chapel')),
|
||||
dafny: createLanguageLoader('dafny', () => import('./language-definitions/dafny')),
|
||||
godot: createLanguageLoader('godot', () => import('./language-definitions/godot')),
|
||||
gn: createLanguageLoader('gn', () => import('./language-definitions/gn')),
|
||||
gf: createLanguageLoader('gf', () => import('highlightjs-gf')),
|
||||
hlsl: createLanguageLoader('hlsl', () => import('./language-definitions/hlsl')),
|
||||
jolie: createLanguageLoader('jolie', () => import('highlightjs-jolie')),
|
||||
lean: createLanguageLoader('lean', () => import('highlightjs-lean')),
|
||||
lookml: createLanguageLoader('lookml', () => import('highlightjs-lookml')),
|
||||
macaulay2: createLanguageLoader('macaulay2', () => import('highlightjs-macaulay2')),
|
||||
mlir: createLanguageLoader('mlir', () => import('highlightjs-mlir')),
|
||||
papyrus: createLanguageLoader('papyrus', () => import('hightlightjs-papyrus')),
|
||||
qsharp: createLanguageLoader('qsharp', () => import('highlightjs-qsharp')),
|
||||
cshtml: createLanguageLoader('cshtml', () => import('highlightjs-cshtml-razor')),
|
||||
redbol: createLanguageLoader('redbol', () => import('highlightjs-redbol')),
|
||||
'rpm-specfile': createLanguageLoader('rpm-specfile', () => import('highlightjs-rpm-specfile')),
|
||||
solidity: createLanguageLoader('solidity', () => import('highlightjs-solidity')),
|
||||
supercollider: createLanguageLoader('supercollider', () => import('highlightjs-supercollider')),
|
||||
svelte: createLanguageLoader('svelte', () => import('highlightjs-svelte')),
|
||||
terraform: createLanguageLoader('terraform', () => import('./language-definitions/terraform')),
|
||||
xsharp: createLanguageLoader('xsharp', () => import('highlightjs-xsharp')),
|
||||
zenscript: createLanguageLoader('zenscript', () => import('highlightjs-zenscript')),
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import hljs from 'highlight.js';
|
||||
|
||||
import { detectLanguagesByFilename, languageLoaders } from './languages';
|
||||
|
||||
const loadLanguages = async (languages) => {
|
||||
for (let i = 0; i < languages.length; i += 1) {
|
||||
const language = languages[i];
|
||||
|
||||
if (!hljs.getLanguage(language) && languageLoaders[language]) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await languageLoaders[language](hljs.registerLanguage);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const highlight = (content, languages) =>
|
||||
languages.length === 1
|
||||
? hljs.highlight(content, { language: languages[0] })
|
||||
: hljs.highlightAuto(content, languages.length === 0 ? undefined : languages);
|
||||
|
||||
export default {
|
||||
detectLanguagesByFilename,
|
||||
loadLanguages,
|
||||
highlight,
|
||||
};
|
||||
Reference in New Issue
Block a user